You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@tuscany.apache.org by ed...@apache.org on 2006/02/20 17:41:07 UTC

svn commit: r379156 - /incubator/tuscany/cpp/sdo/runtime/core/src/commonj/sdo/

Author: edslattery
Date: Mon Feb 20 08:41:03 2006
New Revision: 379156

URL: http://svn.apache.org/viewcvs?rev=379156&view=rev
Log:
Fix for Tuscany-31 and merge of known problems from the PHP release

Modified:
    incubator/tuscany/cpp/sdo/runtime/core/src/commonj/sdo/ChangeSummaryImpl.cpp
    incubator/tuscany/cpp/sdo/runtime/core/src/commonj/sdo/DataFactoryImpl.cpp
    incubator/tuscany/cpp/sdo/runtime/core/src/commonj/sdo/DataObject.h
    incubator/tuscany/cpp/sdo/runtime/core/src/commonj/sdo/DataObjectImpl.cpp
    incubator/tuscany/cpp/sdo/runtime/core/src/commonj/sdo/DataObjectImpl.h
    incubator/tuscany/cpp/sdo/runtime/core/src/commonj/sdo/DataObjectList.h
    incubator/tuscany/cpp/sdo/runtime/core/src/commonj/sdo/DataObjectListImpl.cpp
    incubator/tuscany/cpp/sdo/runtime/core/src/commonj/sdo/DataObjectListImpl.h
    incubator/tuscany/cpp/sdo/runtime/core/src/commonj/sdo/Logger.cpp
    incubator/tuscany/cpp/sdo/runtime/core/src/commonj/sdo/SDORuntimeException.cpp
    incubator/tuscany/cpp/sdo/runtime/core/src/commonj/sdo/SDOSAX2Parser.cpp
    incubator/tuscany/cpp/sdo/runtime/core/src/commonj/sdo/SDOSchemaSAX2Parser.cpp
    incubator/tuscany/cpp/sdo/runtime/core/src/commonj/sdo/SDOXMLStreamWriter.cpp
    incubator/tuscany/cpp/sdo/runtime/core/src/commonj/sdo/SDOXMLStreamWriter.h
    incubator/tuscany/cpp/sdo/runtime/core/src/commonj/sdo/SDOXMLString.cpp
    incubator/tuscany/cpp/sdo/runtime/core/src/commonj/sdo/SDOXMLWriter.cpp
    incubator/tuscany/cpp/sdo/runtime/core/src/commonj/sdo/SDOXMLWriter.h
    incubator/tuscany/cpp/sdo/runtime/core/src/commonj/sdo/SDOXSDStreamWriter.cpp
    incubator/tuscany/cpp/sdo/runtime/core/src/commonj/sdo/SDOXSDStreamWriter.h
    incubator/tuscany/cpp/sdo/runtime/core/src/commonj/sdo/SDOXSDWriter.cpp
    incubator/tuscany/cpp/sdo/runtime/core/src/commonj/sdo/SDOXSDWriter.h
    incubator/tuscany/cpp/sdo/runtime/core/src/commonj/sdo/SdoRuntime.cpp
    incubator/tuscany/cpp/sdo/runtime/core/src/commonj/sdo/Sequence.h
    incubator/tuscany/cpp/sdo/runtime/core/src/commonj/sdo/SequenceImpl.cpp
    incubator/tuscany/cpp/sdo/runtime/core/src/commonj/sdo/SequenceImpl.h
    incubator/tuscany/cpp/sdo/runtime/core/src/commonj/sdo/SettingList.cpp
    incubator/tuscany/cpp/sdo/runtime/core/src/commonj/sdo/SettingList.h
    incubator/tuscany/cpp/sdo/runtime/core/src/commonj/sdo/Type.h
    incubator/tuscany/cpp/sdo/runtime/core/src/commonj/sdo/TypeImpl.cpp
    incubator/tuscany/cpp/sdo/runtime/core/src/commonj/sdo/XMLHelper.h
    incubator/tuscany/cpp/sdo/runtime/core/src/commonj/sdo/XMLHelperImpl.cpp
    incubator/tuscany/cpp/sdo/runtime/core/src/commonj/sdo/XMLHelperImpl.h
    incubator/tuscany/cpp/sdo/runtime/core/src/commonj/sdo/XSDHelper.h
    incubator/tuscany/cpp/sdo/runtime/core/src/commonj/sdo/XSDHelperImpl.cpp
    incubator/tuscany/cpp/sdo/runtime/core/src/commonj/sdo/XSDHelperImpl.h

Modified: incubator/tuscany/cpp/sdo/runtime/core/src/commonj/sdo/ChangeSummaryImpl.cpp
URL: http://svn.apache.org/viewcvs/incubator/tuscany/cpp/sdo/runtime/core/src/commonj/sdo/ChangeSummaryImpl.cpp?rev=379156&r1=379155&r2=379156&view=diff
==============================================================================
--- incubator/tuscany/cpp/sdo/runtime/core/src/commonj/sdo/ChangeSummaryImpl.cpp (original)
+++ incubator/tuscany/cpp/sdo/runtime/core/src/commonj/sdo/ChangeSummaryImpl.cpp Mon Feb 20 08:41:03 2006
@@ -15,7 +15,7 @@
  *  limitations under the License.
  */
 
-/* $Rev$ $Date: 2005/12/22 16:54:14 $ */
+/* $Rev$ $Date: 2006/02/17 16:01:05 $ */
 
 #include "commonj/sdo/ChangeSummaryImpl.h"
 
@@ -191,11 +191,11 @@
 
                 for (int j=0 ; j < slist.size();j++)
                 {
-                    if (!strcmp(slist[j].getProperty().getName(),
+                    if (!strcmp(slist.get(j)->getProperty().getName(),
                                     prop.getName())
                                    
                                    
-                        && slist[j].getIndex() == 
+                        && slist.get(j)->getIndex() == 
                               index)
                     {
                         // these are settings of the same prop/index, we
@@ -271,7 +271,7 @@
 
             if (!ob->isSet(pl[i]))
             { 
-                sl.append(Setting(false,false, 0,0,pl[i],0));
+                sl.append(new Setting(false,false, 0,0,pl[i],0));
                 continue;
             }
             if (pl[i].isMany())
@@ -283,18 +283,18 @@
                     // needs to be the data object in cases where...
                     if (pl[i].getType().isDataType()) {
                         setPropValue(&value,&len,ob,pl[j]);
-                        sl.append(Setting(true,false,value,len,pl[i],j));
+                        sl.append(new Setting(true,false,value,len,pl[i],j));
                     }
                     else {
                         value = (void*)dol[j];
-                        sl.append(Setting(true,false,value,0,pl[i],j));
+                        sl.append(new Setting(true,false,value,0,pl[i],j));
                     }
                 }
             }
             else 
             {
                 setPropValue(&value,&len,ob,pl[i]);
-                sl.append(Setting(true,ob->isNull(pl[i]),value,len,pl[i],0));
+                sl.append(new Setting(true,ob->isNull(pl[i]),value,len,pl[i],0));
             }
 
         }
@@ -315,17 +315,18 @@
             {
                 for (int i=0;i<sl.size();i++)
                 {
-                    if (!strcmp(slist[j].getProperty().getName(),
-                                   sl[i].getProperty().getName())
+                    if (!strcmp(slist.get(j)->getProperty().getName(),
+                                   sl.get(i)->getProperty().getName())
                                    
                                    
-                        && slist[j].getIndex() == 
-                              sl[i].getIndex())
+                        && slist.get(j)->getIndex() == 
+                              sl.get(i)->getIndex())
                     {
                     // these are settings of the same prop/index, we
                     // need the old value to get transferred.
                         sl.remove(i);
-                        sl.insert(i,slist[j]);
+                        sl.insert(i,new Setting(*(slist.get(j))));
+                  
                     }
                 }
             }
@@ -801,7 +802,7 @@
 
         for (int i=0;i<slist.size();i++)
         {
-            if (!strcmp(slist[i].getProperty().getName(),prop.getName()))
+            if (!strcmp(slist.get(i)->getProperty().getName(),prop.getName()))
             {
                 LOGINFO(INFO,"ChangeSummary: Change of a property which was already changed - ignore");
                 return;
@@ -814,7 +815,7 @@
 
         if (!ob->isSet(prop))
         { 
-            slist.append(Setting(false,false,0,0,prop,0));
+            slist.append(new Setting(false,false,0,0,prop,0));
             return;
         }
 
@@ -828,7 +829,7 @@
             DataObjectList& dol = ob->getList(prop);
             if (dol.size() == 0)
             {
-                slist.append(Setting(false,false,0,0,prop,0));
+                slist.append(new Setting(false,false,0,0,prop,0));
                 return;
             }
             for (int i=0;i< dol.size(); i++)
@@ -837,18 +838,18 @@
                 if (prop.getType().isDataType()) {
                     setManyPropValue(&value, &len, (DataObjectImpl*)ob,
                         (DataObjectImpl*)dob, prop);
-                    slist.append(Setting(true,false,value,len,prop,i));
+                    slist.append(new Setting(true,false,value,len,prop,i));
                 }
                 else{
                     value = (void*)dob;
-                    slist.append(Setting(true,false,value,0,prop,i));
+                    slist.append(new Setting(true,false,value,0,prop,i));
                 }
             }
         }
         else 
         {
             setPropValue(&value,&len,ob,prop);
-            slist.append(Setting(true,ob->isNull(prop),value,len,prop,0));
+            slist.append(new Setting(true,ob->isNull(prop),value,len,prop,0));
         }
 
         return;
@@ -1130,8 +1131,8 @@
             for (int i=0;i < sl.size(); i++)
             {
                 if (!strcmp(property.getName(),
-                    sl[i].getProperty().getName()))
-                    return (sl[i]);
+                    sl.get(i)->getProperty().getName()))
+                    return (*sl.get(i));
             }
         }
 
@@ -1142,8 +1143,8 @@
             for (int i=0;i < sl.size(); i++)
             {
                 if (!strcmp(property.getName(),
-                    sl[i].getProperty().getName()))
-                    return (sl[i]);
+                    sl.get(i)->getProperty().getName()))
+                    return (*sl.get(i));
             }
         }
 
@@ -1347,7 +1348,7 @@
 
         unsigned int len = stringConvert(&datavalue, (const char*)value , p);
 
-        slist.append(Setting(true,false,datavalue,len,p,index));
+        slist.append(new Setting(true,false,datavalue,len,p,index));
         
         // The datavalue will be freed by the deletion of the setting later
      }
@@ -1388,7 +1389,7 @@
         // against existing settings
 
 
-        slist.append(Setting(true,false,(void*)indob,0,p,index));
+        slist.append(new Setting(true,false,(void*)indob,0,p,index));
     
      }
 

Modified: incubator/tuscany/cpp/sdo/runtime/core/src/commonj/sdo/DataFactoryImpl.cpp
URL: http://svn.apache.org/viewcvs/incubator/tuscany/cpp/sdo/runtime/core/src/commonj/sdo/DataFactoryImpl.cpp?rev=379156&r1=379155&r2=379156&view=diff
==============================================================================
--- incubator/tuscany/cpp/sdo/runtime/core/src/commonj/sdo/DataFactoryImpl.cpp (original)
+++ incubator/tuscany/cpp/sdo/runtime/core/src/commonj/sdo/DataFactoryImpl.cpp Mon Feb 20 08:41:03 2006
@@ -15,7 +15,7 @@
  *  limitations under the License.
  */
 
-/* $Rev$ $Date: 2005/12/22 16:54:14 $ */
+/* $Rev$ $Date: 2006/02/08 14:43:56 $ */
 
 //////////////////////////////////////////////////////////////////////
 // DataFactoryImpl.cpp: implementation of the DataFactory class.
@@ -32,6 +32,7 @@
 #include "commonj/sdo/PropertyList.h"
 
 #include <iostream>
+#include <stdio.h>
 
 
 using namespace std;
@@ -357,9 +358,9 @@
     if(typeIter == types.end())
     {
         string msg("Type not found: ");
-        msg += uri;
+        if (uri != 0)msg += uri;
         msg += " ";
-        msg += inTypeName;
+        if (inTypeName != 0)msg += inTypeName;
         SDO_THROW_EXCEPTION("addPropertyToType",
         SDOTypeNotFoundException, msg.c_str());
 
@@ -380,9 +381,9 @@
     if (typeIter2 == types.end())
     {
         string msg("Type not found: ");
-        msg += propTypeUri;
+        if (propTypeUri != 0)msg += propTypeUri;
         msg += " ";
-        msg += propTypeName;
+        if (propTypeName != 0)msg += propTypeName;
         SDO_THROW_EXCEPTION("addPropertyToType",
         SDOTypeNotFoundException, msg.c_str());
     }
@@ -901,9 +902,9 @@
     if (type == 0)
     {
         string msg("Type not found :");
-        msg += uri;
+        if (uri != 0)msg += uri;
         msg += " ";
-        msg += inTypeName;
+        if (inTypeName != 0)msg += inTypeName;
         SDO_THROW_EXCEPTION("getTypeImpl" ,
         SDOTypeNotFoundException, msg.c_str());
     }
@@ -1058,7 +1059,7 @@
         string msg("Instantiation of unknown type :");
         if (uri != 0) msg += uri;
         msg += " ";
-        msg += typeName;
+        if (typeName != 0)msg += typeName;
         SDO_THROW_EXCEPTION("create" ,
         SDOTypeNotFoundException, msg.c_str());
     }
@@ -1066,9 +1067,9 @@
     if (ti->isAbstractType())
     {
         string msg("Instantiation of abstract type :");
-        msg += uri;
+        if (uri != 0)msg += uri;
         msg += " ";
-        msg += typeName;
+        if (typeName != 0)msg += typeName;
         SDO_THROW_EXCEPTION("create" ,
         SDOUnsupportedOperationException, msg.c_str());
     }

Modified: incubator/tuscany/cpp/sdo/runtime/core/src/commonj/sdo/DataObject.h
URL: http://svn.apache.org/viewcvs/incubator/tuscany/cpp/sdo/runtime/core/src/commonj/sdo/DataObject.h?rev=379156&r1=379155&r2=379156&view=diff
==============================================================================
--- incubator/tuscany/cpp/sdo/runtime/core/src/commonj/sdo/DataObject.h (original)
+++ incubator/tuscany/cpp/sdo/runtime/core/src/commonj/sdo/DataObject.h Mon Feb 20 08:41:03 2006
@@ -15,7 +15,7 @@
  *  limitations under the License.
  */
 
-/* $Rev$ $Date: 2005/12/22 16:54:14 $ */
+/* $Rev$ $Date: 2006/02/02 16:41:30 $ */
 
 #ifndef _DATAOBJECT_H_
 #define _DATAOBJECT_H_
@@ -109,7 +109,11 @@
    
     virtual SDO_API PropertyList getInstanceProperties() = 0;
 
-    
+    /**
+     * See if the property currently exists
+     */
+
+    virtual SDO_API bool hasProperty(const char* name) = 0;
     /**
      * These are just like getType().getProperty(), but may return
      * values other than the property list for open types.

Modified: incubator/tuscany/cpp/sdo/runtime/core/src/commonj/sdo/DataObjectImpl.cpp
URL: http://svn.apache.org/viewcvs/incubator/tuscany/cpp/sdo/runtime/core/src/commonj/sdo/DataObjectImpl.cpp?rev=379156&r1=379155&r2=379156&view=diff
==============================================================================
--- incubator/tuscany/cpp/sdo/runtime/core/src/commonj/sdo/DataObjectImpl.cpp (original)
+++ incubator/tuscany/cpp/sdo/runtime/core/src/commonj/sdo/DataObjectImpl.cpp Mon Feb 20 08:41:03 2006
@@ -15,7 +15,7 @@
  *  limitations under the License.
  */
 
-/* $Rev$ $Date: 2006/01/17 14:55:15 $ */
+/* $Rev$ $Date: 2006/02/02 16:41:30 $ */
 
 #include "commonj/sdo/disable_warn.h"
 #include "commonj/sdo/DataObjectImpl.h"
@@ -40,6 +40,7 @@
 #include "commonj/sdo/DataFactoryImpl.h"
 
 #include <string>
+#include <stdio.h>
 using std::string;
 
 
@@ -1227,9 +1228,26 @@
                     d->setNull();
                 }
                 else {
-                    const Property& p = d->getProperty(prop);
+                    const PropertyImpl* p = d->getPropertyImpl(prop);
+                    if (p == 0)
+                    {
+                        if(d->getType().isOpenType())
+                        {
+                            string msg("Cannot set unassigned open property to null:");
+                            msg += prop;
+                            SDO_THROW_EXCEPTION("setNull", SDOUnsupportedOperationException,
+                            msg.c_str());
+                        }
+                        else
+                        {
+                            string msg("Property Not Found:");
+                            msg += prop;
+                            SDO_THROW_EXCEPTION("setNull", SDOPropertyNotFoundException,
+                            msg.c_str());
+                        }
+                    }
                     delete prop;
-                    d->setNull(p);
+                    d->setNull((Property&)*p);
                     return;
                 }
             }
@@ -1396,6 +1414,18 @@
         }
         return (Property&)*pi;
     }
+
+    /**
+     * See if the property currently exists
+     */
+
+    bool DataObjectImpl::hasProperty(const char* name)
+    {
+        PropertyImpl* pi = getPropertyImpl(name);
+        if (pi == 0) return false;
+        return true;
+    }
+
 
     PropertyImpl* DataObjectImpl::getPropertyImpl(unsigned int index)
     {

Modified: incubator/tuscany/cpp/sdo/runtime/core/src/commonj/sdo/DataObjectImpl.h
URL: http://svn.apache.org/viewcvs/incubator/tuscany/cpp/sdo/runtime/core/src/commonj/sdo/DataObjectImpl.h?rev=379156&r1=379155&r2=379156&view=diff
==============================================================================
--- incubator/tuscany/cpp/sdo/runtime/core/src/commonj/sdo/DataObjectImpl.h (original)
+++ incubator/tuscany/cpp/sdo/runtime/core/src/commonj/sdo/DataObjectImpl.h Mon Feb 20 08:41:03 2006
@@ -15,7 +15,7 @@
  *  limitations under the License.
  */
 
-/* $Rev$ $Date: 2006/01/05 13:13:23 $ */
+/* $Rev$ $Date: 2006/02/02 16:41:30 $ */
 
 #ifndef _DATAOBJECTIMPL_H_
 #define _DATAOBJECTIMPL_H_
@@ -389,6 +389,11 @@
     virtual DataObjectPtr createDataObject(const Property& property);
 
 
+    /**
+     * See if the property currently exists
+     */
+
+    virtual bool hasProperty(const char* name);
 
 
     virtual void detach();
@@ -552,7 +557,7 @@
     virtual bool remove(DataObjectImpl* indol);
     virtual bool isSet(const Property& prop, unsigned int propertyIndex);
 
-
+   
     virtual DataObjectImpl* getDataObjectImpl(const char* path); 
     virtual DataObjectImpl* getDataObjectImpl(unsigned int propertyIndex); 
     virtual DataObjectImpl* getDataObjectImpl(const Property& property); 

Modified: incubator/tuscany/cpp/sdo/runtime/core/src/commonj/sdo/DataObjectList.h
URL: http://svn.apache.org/viewcvs/incubator/tuscany/cpp/sdo/runtime/core/src/commonj/sdo/DataObjectList.h?rev=379156&r1=379155&r2=379156&view=diff
==============================================================================
--- incubator/tuscany/cpp/sdo/runtime/core/src/commonj/sdo/DataObjectList.h (original)
+++ incubator/tuscany/cpp/sdo/runtime/core/src/commonj/sdo/DataObjectList.h Mon Feb 20 08:41:03 2006
@@ -15,7 +15,7 @@
  *  limitations under the License.
  */
 
-/* $Rev$ $Date: 2005/12/22 16:54:15 $ */
+/* $Rev$ $Date: 2006/02/02 16:41:30 $ */
 
 #ifndef _DATAOBJECTLIST_H_
 #define _DATAOBJECTLIST_H_
@@ -166,6 +166,25 @@
      */
 
     virtual SDO_API DataObjectPtr  remove (unsigned int index) = 0;
+
+    /*  getType returns type
+     *
+     * Returns the type.
+     * May throw SDOTYpeNotFoundException for unset open types
+     */
+
+
+   virtual SDO_API const Type& getType() = 0;
+
+    /*  getTypeEnum returns an enumerator for the type
+     *
+     * Returns an enumerator for the type for easy switching on basic types.
+     * The enumerator is part of the Type class
+     * May throw SDOTypeNotFoundException for open types
+     */
+
+    virtual SDO_API const Type::Types getTypeEnum() = 0;
+
 };
 };
 };

Modified: incubator/tuscany/cpp/sdo/runtime/core/src/commonj/sdo/DataObjectListImpl.cpp
URL: http://svn.apache.org/viewcvs/incubator/tuscany/cpp/sdo/runtime/core/src/commonj/sdo/DataObjectListImpl.cpp?rev=379156&r1=379155&r2=379156&view=diff
==============================================================================
--- incubator/tuscany/cpp/sdo/runtime/core/src/commonj/sdo/DataObjectListImpl.cpp (original)
+++ incubator/tuscany/cpp/sdo/runtime/core/src/commonj/sdo/DataObjectListImpl.cpp Mon Feb 20 08:41:03 2006
@@ -15,7 +15,7 @@
  *  limitations under the License.
  */
 
-/* $Rev$ $Date: 2006/01/17 21:35:03 $ */
+/* $Rev$ $Date: 2006/02/02 16:41:30 $ */
 
 #include "commonj/sdo/DataObjectListImpl.h"
 
@@ -30,6 +30,8 @@
 #include "commonj/sdo/DataObjectImpl.h"
 #include "commonj/sdo/DataFactoryImpl.h"
 
+#include <stdio.h>
+
 namespace commonj{
 namespace sdo {
 
@@ -159,6 +161,30 @@
 DATAOBJECT_VECTOR DataObjectListImpl::getVec() const
 {
     return plist;
+}
+
+
+
+const Type& DataObjectListImpl::getType()
+{
+    if (typeUnset)
+    {
+        string msg("The list property is open, and the type of the contents has not bee determined yet.");
+        SDO_THROW_EXCEPTION("Get Type", SDOTypeNotFoundException,
+            msg.c_str());
+    }
+    return theFactory->getType(typeURI, typeName);
+}
+
+
+const Type::Types DataObjectListImpl::getTypeEnum()
+{
+    if (typeUnset)
+    {
+        return Type::UndefinedOpenPropertyType;
+
+    }
+    return theFactory->getType(typeURI, typeName).getTypeEnum();
 }
 
 

Modified: incubator/tuscany/cpp/sdo/runtime/core/src/commonj/sdo/DataObjectListImpl.h
URL: http://svn.apache.org/viewcvs/incubator/tuscany/cpp/sdo/runtime/core/src/commonj/sdo/DataObjectListImpl.h?rev=379156&r1=379155&r2=379156&view=diff
==============================================================================
--- incubator/tuscany/cpp/sdo/runtime/core/src/commonj/sdo/DataObjectListImpl.h (original)
+++ incubator/tuscany/cpp/sdo/runtime/core/src/commonj/sdo/DataObjectListImpl.h Mon Feb 20 08:41:03 2006
@@ -15,7 +15,7 @@
  *  limitations under the License.
  */
 
-/* $Rev$ $Date: 2006/01/17 21:35:03 $ */
+/* $Rev$ $Date: 2006/02/02 16:41:30 $ */
 
 #ifndef _DATAOBJECTLISTIMPL_H_
 #define _DATAOBJECTLISTIMPL_H_
@@ -144,6 +144,23 @@
     virtual void checkType(const Type& listType, const Type& objectType);
     virtual void setType(const char* uri, const char* name);    
 
+   /*  getType returns type
+     *
+     * Returns the type.
+     * May throw SDOTYpeNotFoundException for unset open types
+     */
+
+
+   virtual const Type& getType();
+
+    /*  getTypeEnum returns an enumerator for the type
+     *
+     * Returns an enumerator for the type for easy switching on basic types.
+     * The enumerator is part of the Type class
+     * May throw SDOTypeNotFoundException for open types
+     */
+
+    virtual const Type::Types getTypeEnum();
 
 
 private: 

Modified: incubator/tuscany/cpp/sdo/runtime/core/src/commonj/sdo/Logger.cpp
URL: http://svn.apache.org/viewcvs/incubator/tuscany/cpp/sdo/runtime/core/src/commonj/sdo/Logger.cpp?rev=379156&r1=379155&r2=379156&view=diff
==============================================================================
--- incubator/tuscany/cpp/sdo/runtime/core/src/commonj/sdo/Logger.cpp (original)
+++ incubator/tuscany/cpp/sdo/runtime/core/src/commonj/sdo/Logger.cpp Mon Feb 20 08:41:03 2006
@@ -15,12 +15,13 @@
  *  limitations under the License.
  */
 
-/* $Rev$ $Date: 2005/12/22 16:54:15 $ */
+/* $Rev$ $Date: 2006/01/23 16:39:24 $ */
 
 #include "commonj/sdo/Logger.h"
 #include <iostream>
 #include <stdarg.h>
 #include "commonj/sdo/DefaultLogWriter.h"
+#include <stdio.h>
 
 using namespace std;
 

Modified: 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=379156&r1=379155&r2=379156&view=diff
==============================================================================
--- incubator/tuscany/cpp/sdo/runtime/core/src/commonj/sdo/SDORuntimeException.cpp (original)
+++ incubator/tuscany/cpp/sdo/runtime/core/src/commonj/sdo/SDORuntimeException.cpp Mon Feb 20 08:41:03 2006
@@ -15,9 +15,11 @@
  *  limitations under the License.
  */
 
-/* $Rev$ $Date: 2005/12/22 16:54:15 $ */
+/* $Rev$ $Date: 2006/01/23 16:39:24 $ */
 
 #include "commonj/sdo/SDORuntimeException.h"
+
+#include <stdio.h>
               
 // ========================================================================
 // Constructor

Modified: incubator/tuscany/cpp/sdo/runtime/core/src/commonj/sdo/SDOSAX2Parser.cpp
URL: http://svn.apache.org/viewcvs/incubator/tuscany/cpp/sdo/runtime/core/src/commonj/sdo/SDOSAX2Parser.cpp?rev=379156&r1=379155&r2=379156&view=diff
==============================================================================
--- incubator/tuscany/cpp/sdo/runtime/core/src/commonj/sdo/SDOSAX2Parser.cpp (original)
+++ incubator/tuscany/cpp/sdo/runtime/core/src/commonj/sdo/SDOSAX2Parser.cpp Mon Feb 20 08:41:03 2006
@@ -15,7 +15,7 @@
  *  limitations under the License.
  */
 
-/* $Rev$ $Date: 2006/01/23 10:23:20 $ */
+/* $Rev$ $Date: 2006/02/08 14:43:56 $ */
 
 #include "commonj/sdo/SDOSAX2Parser.h"
 
@@ -775,22 +775,31 @@
                         
                         // NOTE: always creating DO doesn't cater for DataType as top element
 
-                        newDO = dataFactory->create(typeURI, typeName);
-
-                        // set the property setting if the root is an extended primitive
                         const Type& tp = dataFactory->getType(typeURI,typeName);
-                        // get the type definition, and see if its an extended primitive.
-
-                        XSDTypeInfo* typeInfo = (XSDTypeInfo*)
-                            ((DASType*)&tp)->getDASValue("XMLDAS::TypeInfo");
-                        if (typeInfo)
+                        if (tp.isDataType())
                         {
-                            const TypeDefinition& typeDefinition = typeInfo->getTypeDefinition();
-                            if (typeDefinition.isExtendedPrimitive)
+                            newDO = dataFactory->create(tns, "RootType");
+                            currentPropertySetting = PropertySetting(newDO, localname,
+                            bToBeNull);
+                        }
+                        else
+                        {
+
+                            newDO = dataFactory->create(typeURI, typeName);
+
+                            // get the type definition, and see if its an extended primitive.
+
+                            XSDTypeInfo* typeInfo = (XSDTypeInfo*)
+                              ((DASType*)&tp)->getDASValue("XMLDAS::TypeInfo");
+                            if (typeInfo)
                             {
-                                // The name of this element is the name of a property on the current DO
-                                currentPropertySetting = PropertySetting(newDO, localname,
-                                bToBeNull);
+                                const TypeDefinition& typeDefinition = typeInfo->getTypeDefinition();
+                                if (typeDefinition.isExtendedPrimitive)
+                                {
+                                    // The name of this element is the name of a property on the current DO
+                                    currentPropertySetting = PropertySetting(newDO, localname,
+                                    bToBeNull);
+                                }
                             }
                         }
                         

Modified: incubator/tuscany/cpp/sdo/runtime/core/src/commonj/sdo/SDOSchemaSAX2Parser.cpp
URL: http://svn.apache.org/viewcvs/incubator/tuscany/cpp/sdo/runtime/core/src/commonj/sdo/SDOSchemaSAX2Parser.cpp?rev=379156&r1=379155&r2=379156&view=diff
==============================================================================
--- incubator/tuscany/cpp/sdo/runtime/core/src/commonj/sdo/SDOSchemaSAX2Parser.cpp (original)
+++ incubator/tuscany/cpp/sdo/runtime/core/src/commonj/sdo/SDOSchemaSAX2Parser.cpp Mon Feb 20 08:41:03 2006
@@ -15,7 +15,7 @@
  *  limitations under the License.
  */
 
-/* $Rev$ $Date: 2005/12/22 16:54:15 $ */
+/* $Rev$ $Date: 2006/02/08 15:53:52 $ */
 
 #include "commonj/sdo/SDOSchemaSAX2Parser.h"
 #include "commonj/sdo/XSDPropertyInfo.h"
@@ -23,6 +23,8 @@
 #include "commonj/sdo/SDORuntimeException.h"
 #include "commonj/sdo/Logging.h"
 
+#include <stdio.h>
+
 namespace commonj
 {
     namespace sdo
@@ -68,6 +70,8 @@
                 {
                     bInSchema = true;
                     // Handle namespace definitions
+
+
                     schemaInfo.getSchemaNamespaces().merge(namespaces);
                     
                     // Handle attributes
@@ -78,7 +82,8 @@
                             schemaInfo.setTargetNamespaceURI(attributes[i].getValue());
                         }                        
                     }
-                    
+
+
                     currentType.uri = schemaInfo.getTargetNamespaceURI();
                     currentType.name = "RootType";
                     currentType.localname="RootType";
@@ -136,6 +141,14 @@
                     startGroup(localname, prefix, URI, namespaces, attributes);
                 } // end Group handling
                 
+                else if (localname.equalsIgnoreCase("group") 
+                      || localname.equalsIgnoreCase("attributeGroup"))
+                {
+                    if (setter)
+                    {
+                        setter->setError("Schema contains group or attributeGroup which are not yet implemented");
+                    }
+                }
                 ///////////////////////////////////////////////////////////////////////
                 // Handle simpleType
                 // These become new types
@@ -783,7 +796,7 @@
         }
         
         // ============================================================================
-        // setType
+        // setType 
         // ============================================================================
         void SDOSchemaSAX2Parser::setType(
             PropertyDefinition& property,
@@ -941,6 +954,14 @@
             if (qname.getURI().equalsIgnoreCase("http://www.w3.org/2001/XMLSchema"))
             {
                 uri = Type::SDOTypeNamespaceURI;
+                if (qname.getLocalName().equalsIgnoreCase("ID"))
+                {
+                    name = "String";
+                }
+                if (qname.getLocalName().equalsIgnoreCase("NCName"))
+                {
+                    name = "String";
+                }
                 if (qname.getLocalName().equalsIgnoreCase("string"))
                 {
                     name = "String";

Modified: incubator/tuscany/cpp/sdo/runtime/core/src/commonj/sdo/SDOXMLStreamWriter.cpp
URL: http://svn.apache.org/viewcvs/incubator/tuscany/cpp/sdo/runtime/core/src/commonj/sdo/SDOXMLStreamWriter.cpp?rev=379156&r1=379155&r2=379156&view=diff
==============================================================================
--- incubator/tuscany/cpp/sdo/runtime/core/src/commonj/sdo/SDOXMLStreamWriter.cpp (original)
+++ incubator/tuscany/cpp/sdo/runtime/core/src/commonj/sdo/SDOXMLStreamWriter.cpp Mon Feb 20 08:41:03 2006
@@ -15,7 +15,7 @@
  *  limitations under the License.
  */
 
-/* $Rev$ $Date: 2005/12/22 16:54:15 $ */
+/* $Rev$ $Date: 2006/02/01 16:24:13 $ */
 
 #include "commonj/sdo/SDOXMLStreamWriter.h"
 #include <sstream>
@@ -37,9 +37,9 @@
         {    
         }
         
-        int SDOXMLStreamWriter::write(XMLDocumentPtr doc)
+        int SDOXMLStreamWriter::write(XMLDocumentPtr doc, int indent)
         {
-            int rc = SDOXMLBufferWriter::write(doc);
+            int rc = SDOXMLBufferWriter::write(doc, indent);
 
             // Now stream the buffer
             outXmlStream << getBuffer();

Modified: incubator/tuscany/cpp/sdo/runtime/core/src/commonj/sdo/SDOXMLStreamWriter.h
URL: http://svn.apache.org/viewcvs/incubator/tuscany/cpp/sdo/runtime/core/src/commonj/sdo/SDOXMLStreamWriter.h?rev=379156&r1=379155&r2=379156&view=diff
==============================================================================
--- incubator/tuscany/cpp/sdo/runtime/core/src/commonj/sdo/SDOXMLStreamWriter.h (original)
+++ incubator/tuscany/cpp/sdo/runtime/core/src/commonj/sdo/SDOXMLStreamWriter.h Mon Feb 20 08:41:03 2006
@@ -15,7 +15,7 @@
  *  limitations under the License.
  */
 
-/* $Rev$ $Date: 2005/12/22 16:54:15 $ */
+/* $Rev$ $Date: 2006/02/01 16:24:13 $ */
 
 #ifndef _SDOXMLSTREAMWRITER_H_
 #define _SDOXMLSTREAMWRITER_H_
@@ -42,7 +42,7 @@
             SDOXMLStreamWriter(std::ostream& outXML, DataFactoryPtr dataFactory = NULL);                
             virtual ~SDOXMLStreamWriter();
             
-            int write(XMLDocumentPtr doc);
+            int write(XMLDocumentPtr doc, int indent = -1);
         private:
             std::ostream& outXmlStream;
             

Modified: incubator/tuscany/cpp/sdo/runtime/core/src/commonj/sdo/SDOXMLString.cpp
URL: http://svn.apache.org/viewcvs/incubator/tuscany/cpp/sdo/runtime/core/src/commonj/sdo/SDOXMLString.cpp?rev=379156&r1=379155&r2=379156&view=diff
==============================================================================
--- incubator/tuscany/cpp/sdo/runtime/core/src/commonj/sdo/SDOXMLString.cpp (original)
+++ incubator/tuscany/cpp/sdo/runtime/core/src/commonj/sdo/SDOXMLString.cpp Mon Feb 20 08:41:03 2006
@@ -15,11 +15,13 @@
  *  limitations under the License.
  */
 
-/* $Rev$ $Date: 2005/12/22 16:54:15 $ */
+/* $Rev$ $Date: 2006/01/23 16:39:24 $ */
 
 #include "commonj/sdo/SDOXMLString.h"
 #include <iostream>
 #include "libxml/globals.h"
+
+#include <ctype.h>
 
 namespace commonj
 {

Modified: incubator/tuscany/cpp/sdo/runtime/core/src/commonj/sdo/SDOXMLWriter.cpp
URL: http://svn.apache.org/viewcvs/incubator/tuscany/cpp/sdo/runtime/core/src/commonj/sdo/SDOXMLWriter.cpp?rev=379156&r1=379155&r2=379156&view=diff
==============================================================================
--- incubator/tuscany/cpp/sdo/runtime/core/src/commonj/sdo/SDOXMLWriter.cpp (original)
+++ incubator/tuscany/cpp/sdo/runtime/core/src/commonj/sdo/SDOXMLWriter.cpp Mon Feb 20 08:41:03 2006
@@ -15,7 +15,7 @@
  *  limitations under the License.
  */
 
-/* $Rev$ $Date: 2006/01/17 21:35:03 $ */
+/* $Rev$ $Date: 2006/02/17 16:01:05 $ */
 
 #include "commonj/sdo/SDOXMLWriter.h"
 #include "commonj/sdo/SDOXMLString.h"
@@ -64,7 +64,7 @@
             }
         }
         
-        int SDOXMLWriter::write(XMLDocumentPtr doc)
+        int SDOXMLWriter::write(XMLDocumentPtr doc, int indent)
         {
             if (!doc)
             {
@@ -85,8 +85,22 @@
             //namespaceStack.push(namespaces);
             namespaceMap.empty();
             
-            //xmlTextWriterSetIndent(writer, 1);
-            //xmlTextWriterSetIndentString(writer, SDOXMLString("  "));
+            if (indent >= 0)
+            {
+                xmlTextWriterSetIndent(writer, 1);
+                if (indent > 0)
+                {
+                    char * chars = new char[indent+1];
+                    for (int i=0;i<indent;i++)chars[i] = ' ';
+                    chars[indent] = 0;
+                    xmlTextWriterSetIndentString(writer, SDOXMLString(chars));
+                    delete chars;
+                }
+                else
+                {
+                    xmlTextWriterSetIndentString(writer, SDOXMLString(""));
+                }
+            }
             
             if (doc->getXMLDeclaration())
             {
@@ -148,41 +162,41 @@
             {
                 try {
 
-                    if (sl[j].getProperty().isMany()) 
+                    if (sl.get(j)->getProperty().isMany()) 
                     {
                         // manys are elements
                         continue;
                     }
         
-                    if (sl[j].getProperty().getType().isDataType())
+                    if (sl.get(j)->getProperty().getType().isDataType())
                     {
                         // data types are OK
                         rc = xmlTextWriterWriteAttribute(writer, 
-                            SDOXMLString(sl[j].getProperty().getName()),
-                            SDOXMLString(sl[j].getCStringValue()));
+                            SDOXMLString(sl.get(j)->getProperty().getName()),
+                            SDOXMLString(sl.get(j)->getCStringValue()));
                     }
                     else 
                     {
-                        DataObjectPtr dob = sl[j].getDataObjectValue();
+                        DataObjectPtr dob = sl.get(j)->getDataObjectValue();
                         if (dob) 
                         {
                             if (cs->isDeleted(dob))
                             {
                             rc = xmlTextWriterWriteAttribute(writer, 
-                                SDOXMLString(sl[j].getProperty().getName()),
+                                SDOXMLString(sl.get(j)->getProperty().getName()),
                                 SDOXMLString(cs->getOldXpath(dob)));
                             }
                             else 
                             {
                             rc = xmlTextWriterWriteAttribute(writer, 
-                                SDOXMLString(sl[j].getProperty().getName()),
+                                SDOXMLString(sl.get(j)->getProperty().getName()),
                                 SDOXMLString(dob->objectToXPath()));
                             }
                         }
                         else
                         {
                             rc = xmlTextWriterWriteAttribute(writer, 
-                                SDOXMLString(sl[j].getProperty().getName()),
+                                SDOXMLString(sl.get(j)->getProperty().getName()),
                                 SDOXMLString(""));
                         }
                     }
@@ -218,33 +232,33 @@
                 {
 
                     // single values will have been covered by the attributes.
-                    if (!sl[j].getProperty().isMany()) continue;
+                    if (!sl.get(j)->getProperty().isMany()) continue;
         
-                    if (sl[j].getProperty().getType().isDataType())
+                    if (sl.get(j)->getProperty().getType().isDataType())
                     {
 
                         rc = xmlTextWriterWriteElement(
                             writer,
-                            SDOXMLString(sl[j].getProperty().getName()),
-                            SDOXMLString(sl[j].getCStringValue()));
+                            SDOXMLString(sl.get(j)->getProperty().getName()),
+                            SDOXMLString(sl.get(j)->getCStringValue()));
                             
                     } // if datatype
                     else
                     {
-                        DataObjectPtr dob2 = sl[j].getDataObjectValue();
+                        DataObjectPtr dob2 = sl.get(j)->getDataObjectValue();
                         if (!dob2) 
                         {
                             continue;
                         }
                         if (cs->isDeleted(dob2))
                         {
-                            handleChangeSummaryDeletedObject(sl[j].getProperty().getName(), cs,dob2);
+                            handleChangeSummaryDeletedObject(sl.get(j)->getProperty().getName(), cs,dob2);
                         }
                         else
                         {
                             rc = xmlTextWriterStartElement(
                                 writer,
-                                SDOXMLString(sl[j].getProperty().getName()));
+                                SDOXMLString(sl.get(j)->getProperty().getName()));
                             rc = xmlTextWriterWriteAttribute(
                                 writer,
                                 SDOXMLString("sdo:ref"),
@@ -296,26 +310,26 @@
         
                 for (int j=0;j< sl.size(); j++)
                 {
-                    //if (!sl[j].isSet()) 
+                    //if (!sl.get(j)->isSet()) 
                     //{
                     //    // unset properties dont need recording - ah but they do!
                     //
                     //    continue;
                     //}
-                    if ( sl[j].getProperty().isMany()) 
+                    if ( sl.get(j)->getProperty().isMany()) 
                     {
                         // manys are elements
                         continue;
                     }
-                    if (!sl[j].getProperty().getType().isDataType())
+                    if (!sl.get(j)->getProperty().getType().isDataType())
                     {
                         // data objects are element in a deleted data object.
                         continue;
                     }
 
                     rc = xmlTextWriterWriteAttribute(writer, 
-                        SDOXMLString(sl[j].getProperty().getName()),
-                        SDOXMLString(sl[j].getCStringValue()));
+                        SDOXMLString(sl.get(j)->getProperty().getName()),
+                        SDOXMLString(sl.get(j)->getCStringValue()));
 
                 } // for attributes
         
@@ -329,14 +343,14 @@
                 for (k=sl.size()-1;k>=0; k--)
                 {
 
-                     if ( !sl[k].getProperty().getType().isDataType() &&
-                          sl[k].getProperty().isMany()) 
+                     if ( !sl.get(k)->getProperty().getType().isDataType() &&
+                          sl.get(k)->getProperty().isMany()) 
                     {
                         // its a dataobject type
-                        DataObjectPtr dob2 = sl[k].getDataObjectValue();
+                        DataObjectPtr dob2 = sl.get(k)->getDataObjectValue();
                         if (!dob2) continue;
                         if (!cs->isDeleted(dob2)) continue;
-                        handleChangeSummaryDeletedObject(sl[k].
+                        handleChangeSummaryDeletedObject(sl.get(k)->
                                    getProperty().getName(),cs,dob2);
                     }
                 } // for attributes
@@ -344,27 +358,27 @@
                 for (k=0;k< sl.size(); k++)
                 {
 
-                     if ( !sl[k].getProperty().getType().isDataType())
+                     if ( !sl.get(k)->getProperty().getType().isDataType())
                     {
-                        if (sl[k].getProperty().isMany()) continue; 
+                        if (sl.get(k)->getProperty().isMany()) continue; 
                         // its a single valued dataobject type
 
-                        DataObjectPtr dob2 = sl[k].getDataObjectValue();
+                        DataObjectPtr dob2 = sl.get(k)->getDataObjectValue();
                         if (!dob2) continue;
                         if (!cs->isDeleted(dob2)) continue;
-                        handleChangeSummaryDeletedObject(sl[k].
+                        handleChangeSummaryDeletedObject(sl.get(k)->
                                    getProperty().getName(),cs,dob2);
 
                     }
                     else 
                     {
-                        if ( !sl[k].getProperty().isMany()) continue; 
+                        if ( !sl.get(k)->getProperty().isMany()) continue; 
                         
                         // could only be many valued data type
         
                         rc = xmlTextWriterWriteElement(writer, 
-                            SDOXMLString(sl[k].getProperty().getName()),
-                            SDOXMLString(sl[k].getCStringValue()));
+                            SDOXMLString(sl.get(k)->getProperty().getName()),
+                            SDOXMLString(sl.get(k)->getCStringValue()));
                     }
                 } // for attributes
             }

Modified: incubator/tuscany/cpp/sdo/runtime/core/src/commonj/sdo/SDOXMLWriter.h
URL: http://svn.apache.org/viewcvs/incubator/tuscany/cpp/sdo/runtime/core/src/commonj/sdo/SDOXMLWriter.h?rev=379156&r1=379155&r2=379156&view=diff
==============================================================================
--- incubator/tuscany/cpp/sdo/runtime/core/src/commonj/sdo/SDOXMLWriter.h (original)
+++ incubator/tuscany/cpp/sdo/runtime/core/src/commonj/sdo/SDOXMLWriter.h Mon Feb 20 08:41:03 2006
@@ -15,7 +15,7 @@
  *  limitations under the License.
  */
 
-/* $Rev$ $Date: 2006/01/06 09:55:37 $ */
+/* $Rev$ $Date: 2006/02/01 12:53:49 $ */
 
 #ifndef _SDOXMLWRITER_H_
 #define _SDOXMLWRITER_H_
@@ -50,7 +50,7 @@
             
             virtual ~SDOXMLWriter();
             
-            int write(XMLDocumentPtr doc);
+            int write(XMLDocumentPtr doc, int indent=-1);
 
         protected:
             void setWriter(xmlTextWriterPtr textWriter);

Modified: incubator/tuscany/cpp/sdo/runtime/core/src/commonj/sdo/SDOXSDStreamWriter.cpp
URL: http://svn.apache.org/viewcvs/incubator/tuscany/cpp/sdo/runtime/core/src/commonj/sdo/SDOXSDStreamWriter.cpp?rev=379156&r1=379155&r2=379156&view=diff
==============================================================================
--- incubator/tuscany/cpp/sdo/runtime/core/src/commonj/sdo/SDOXSDStreamWriter.cpp (original)
+++ incubator/tuscany/cpp/sdo/runtime/core/src/commonj/sdo/SDOXSDStreamWriter.cpp Mon Feb 20 08:41:03 2006
@@ -15,7 +15,7 @@
  *  limitations under the License.
  */
 
-/* $Rev$ $Date: 2005/12/22 16:54:15 $ */
+/* $Rev$ $Date: 2006/02/01 16:24:13 $ */
 
 #include "commonj/sdo/SDOXSDStreamWriter.h"
 #include <sstream>
@@ -38,9 +38,9 @@
         }
         
         int SDOXSDStreamWriter::write(const TypeList& types, const SDOXMLString& targetNamespaceURI,
-            const propertyMap& openprops)
+            const propertyMap& openprops, int indent)
         {
-            int rc = SDOXSDBufferWriter::write(types, targetNamespaceURI, openprops);
+            int rc = SDOXSDBufferWriter::write(types, targetNamespaceURI, openprops, indent);
 
             // Now stream the buffer
             outXmlStream << getBuffer();

Modified: incubator/tuscany/cpp/sdo/runtime/core/src/commonj/sdo/SDOXSDStreamWriter.h
URL: http://svn.apache.org/viewcvs/incubator/tuscany/cpp/sdo/runtime/core/src/commonj/sdo/SDOXSDStreamWriter.h?rev=379156&r1=379155&r2=379156&view=diff
==============================================================================
--- incubator/tuscany/cpp/sdo/runtime/core/src/commonj/sdo/SDOXSDStreamWriter.h (original)
+++ incubator/tuscany/cpp/sdo/runtime/core/src/commonj/sdo/SDOXSDStreamWriter.h Mon Feb 20 08:41:03 2006
@@ -15,7 +15,7 @@
  *  limitations under the License.
  */
 
-/* $Rev$ $Date: 2005/12/22 16:54:15 $ */
+/* $Rev$ $Date: 2006/02/01 16:24:13 $ */
 
 #ifndef _SDOXSDSTREAMWRITER_H_
 #define _SDOXSDSTREAMWRITER_H_
@@ -43,7 +43,7 @@
             virtual ~SDOXSDStreamWriter();
             
             int write(const TypeList& types, const SDOXMLString& targetNamespaceURI,
-                const propertyMap& openprops);
+                const propertyMap& openprops, int indent = -1);
         private:
             std::ostream& outXmlStream;
             

Modified: incubator/tuscany/cpp/sdo/runtime/core/src/commonj/sdo/SDOXSDWriter.cpp
URL: http://svn.apache.org/viewcvs/incubator/tuscany/cpp/sdo/runtime/core/src/commonj/sdo/SDOXSDWriter.cpp?rev=379156&r1=379155&r2=379156&view=diff
==============================================================================
--- incubator/tuscany/cpp/sdo/runtime/core/src/commonj/sdo/SDOXSDWriter.cpp (original)
+++ incubator/tuscany/cpp/sdo/runtime/core/src/commonj/sdo/SDOXSDWriter.cpp Mon Feb 20 08:41:03 2006
@@ -15,7 +15,7 @@
  *  limitations under the License.
  */
 
-/* $Rev$ $Date: 2006/01/04 14:11:37 $ */
+/* $Rev$ $Date: 2006/02/01 12:53:49 $ */
 
 #include "commonj/sdo/SDOXSDWriter.h"
 #include "iostream"
@@ -159,7 +159,7 @@
         ////////////////////////////////////////
 
         int SDOXSDWriter::write(const TypeList& types, const SDOXMLString& targetNamespaceURI,
-                                const propertyMap& openprops)
+                                const propertyMap& openprops, int indent)
         {
             int i;
             if (writer == NULL)
@@ -170,7 +170,23 @@
             
             int rc = 0;
             
-            
+            if (indent >= 0)
+            {
+                xmlTextWriterSetIndent(writer, 1);
+                if (indent > 0)
+                {
+                    char * chars = new char[indent+1];
+                    for (int i=0;i<indent;i++)chars[i] = ' ';
+                    chars[indent] = 0;
+                    xmlTextWriterSetIndentString(writer, SDOXMLString(chars));
+                    delete chars;
+                }
+                else
+                {
+                    xmlTextWriterSetIndentString(writer, SDOXMLString(""));
+                }
+            }
+           
             // --------------------------------------------------------------
             // Write the <schema> definition including namespace information
             // --------------------------------------------------------------

Modified: incubator/tuscany/cpp/sdo/runtime/core/src/commonj/sdo/SDOXSDWriter.h
URL: http://svn.apache.org/viewcvs/incubator/tuscany/cpp/sdo/runtime/core/src/commonj/sdo/SDOXSDWriter.h?rev=379156&r1=379155&r2=379156&view=diff
==============================================================================
--- incubator/tuscany/cpp/sdo/runtime/core/src/commonj/sdo/SDOXSDWriter.h (original)
+++ incubator/tuscany/cpp/sdo/runtime/core/src/commonj/sdo/SDOXSDWriter.h Mon Feb 20 08:41:03 2006
@@ -15,7 +15,7 @@
  *  limitations under the License.
  */
 
-/* $Rev$ $Date: 2005/12/22 16:54:15 $ */
+/* $Rev$ $Date: 2006/02/01 12:53:49 $ */
 
 #ifndef _SDOXSDWRITER_H_
 #define _SDOXSDWRITER_H_
@@ -48,7 +48,7 @@
             virtual ~SDOXSDWriter();
 
             int write(const TypeList& types, const SDOXMLString& targetNamespaceURI,
-                const propertyMap& openprops);
+                const propertyMap& openprops, int indent = -1);
 
         protected:
             void setWriter(xmlTextWriterPtr textWriter);

Modified: incubator/tuscany/cpp/sdo/runtime/core/src/commonj/sdo/SdoRuntime.cpp
URL: http://svn.apache.org/viewcvs/incubator/tuscany/cpp/sdo/runtime/core/src/commonj/sdo/SdoRuntime.cpp?rev=379156&r1=379155&r2=379156&view=diff
==============================================================================
--- incubator/tuscany/cpp/sdo/runtime/core/src/commonj/sdo/SdoRuntime.cpp (original)
+++ incubator/tuscany/cpp/sdo/runtime/core/src/commonj/sdo/SdoRuntime.cpp Mon Feb 20 08:41:03 2006
@@ -15,10 +15,11 @@
  *  limitations under the License.
  */
 
-/* $Rev$ $Date: 2005/12/22 16:54:15 $ */
+/* $Rev$ $Date: 2006/01/23 16:39:24 $ */
 
 #include "commonj/sdo/SdoRuntime.h"
 #include <iostream>
+#include <stdio.h>
 
 namespace commonj{
 namespace sdo{

Modified: incubator/tuscany/cpp/sdo/runtime/core/src/commonj/sdo/Sequence.h
URL: http://svn.apache.org/viewcvs/incubator/tuscany/cpp/sdo/runtime/core/src/commonj/sdo/Sequence.h?rev=379156&r1=379155&r2=379156&view=diff
==============================================================================
--- incubator/tuscany/cpp/sdo/runtime/core/src/commonj/sdo/Sequence.h (original)
+++ incubator/tuscany/cpp/sdo/runtime/core/src/commonj/sdo/Sequence.h Mon Feb 20 08:41:03 2006
@@ -15,7 +15,7 @@
  *  limitations under the License.
  */
 
-/* $Rev$ $Date: 2005/12/22 16:54:15 $ */
+/* $Rev$ $Date: 2006/02/02 16:41:30 $ */
 
 #ifndef _SEQUENCE_H_
 #define _SEQUENCE_H_
@@ -65,6 +65,12 @@
      */
 
     SDO_API virtual const Property& getProperty(unsigned int index) = 0;
+
+    /**
+     * Return the data object associated with this sequence
+     */
+
+    SDO_API virtual const DataObjectPtr getDataObject() = 0;
 
     /**
      *

Modified: incubator/tuscany/cpp/sdo/runtime/core/src/commonj/sdo/SequenceImpl.cpp
URL: http://svn.apache.org/viewcvs/incubator/tuscany/cpp/sdo/runtime/core/src/commonj/sdo/SequenceImpl.cpp?rev=379156&r1=379155&r2=379156&view=diff
==============================================================================
--- incubator/tuscany/cpp/sdo/runtime/core/src/commonj/sdo/SequenceImpl.cpp (original)
+++ incubator/tuscany/cpp/sdo/runtime/core/src/commonj/sdo/SequenceImpl.cpp Mon Feb 20 08:41:03 2006
@@ -15,7 +15,7 @@
  *  limitations under the License.
  */
 
-/* $Rev$ $Date: 2005/12/22 16:54:15 $ */
+/* $Rev$ $Date: 2006/02/17 16:01:05 $ */
 
 #include "commonj/sdo/disable_warn.h"
 #include "commonj/sdo/Property.h"
@@ -55,7 +55,7 @@
 
     SequenceImpl::SequenceImpl(DataObject* indo)
     {
-        the_do = indo;
+        the_do = (DataObjectImpl*)indo;
     }
 
     SequenceImpl::SequenceImpl(SequenceImpl* inseq)
@@ -69,6 +69,16 @@
           return the_list.size();
     }
 
+    
+    /**
+     * Return the data object associated with this sequence
+     */
+
+    const DataObjectPtr SequenceImpl::getDataObject()
+    {
+        return the_do;
+    }
+
     const Property& SequenceImpl::getProperty(unsigned int index)
     {
         SEQUENCE_ITEM_LIST::iterator i;
@@ -432,11 +442,74 @@
     }
   
 
+#define doadder(primtype,primval)\
+    bool SequenceImpl::add##primtype(const char* propertyName, primval v)\
+    {\
+        const PropertyImpl* p = the_do->getPropertyImpl(propertyName);\
+        if (p == 0)\
+        {\
+            if (the_do->getType().isOpenType())\
+            {\
+                p = the_do->define ##primtype (propertyName, v->getType());\
+            }\
+            if (p == 0)\
+            {\
+                string msg("Cannot find property:");\
+                msg += propertyName;\
+                SDO_THROW_EXCEPTION("getProperty", SDOPropertyNotFoundException,\
+                msg.c_str());\
+            }\
+        }\
+        return add##primtype((const Property&)*p,v);\
+    }\
+    bool SequenceImpl::add##primtype(unsigned int propertyIndex, primval v)\
+    {\
+        return add##primtype(the_do->getProperty(propertyIndex), v);\
+    }\
+    bool SequenceImpl::add##primtype(const Property& p, primval v)\
+    {\
+        if (p.isMany())\
+        {\
+            DataObjectList& dol = the_do->getList(p);\
+            dol.append((primval)v);\
+            /* the_list.push_back(seq_item(&p,dol.size()-1));*/\
+            return true;\
+        }\
+        SEQUENCE_ITEM_LIST::iterator i;\
+        for (i=the_list.begin();i != the_list.end();++i) {\
+            const Property* pp = (*i).getProp();\
+            if (pp == 0) continue;\
+            if (!strcmp(pp->getName(),p.getName()))\
+            {\
+            SDO_THROW_EXCEPTION("add", SDOUnsupportedOperationException,\
+            "Sequence::add of property which already exists in sequence");\
+            }\
+        }\
+        the_do->set##primtype(p,v);\
+        the_list.push_back(seq_item(&p,0));\
+        return true;\
+    }
+
 
 #define adder(primtype,primval)\
     bool SequenceImpl::add##primtype(const char* propertyName, primval v)\
     {\
-        return add##primtype(the_do->getProperty(propertyName),v);\
+        const PropertyImpl* p = the_do->getPropertyImpl(propertyName);\
+        if (p == 0)\
+        {\
+            if (the_do->getType().isOpenType())\
+            {\
+                p = the_do->define ##primtype (propertyName);\
+            }\
+            if (p == 0)\
+            {\
+                string msg("Cannot find property:");\
+                msg += propertyName;\
+                SDO_THROW_EXCEPTION("getProperty", SDOPropertyNotFoundException,\
+                msg.c_str());\
+            }\
+        }\
+        return add##primtype((const Property&)*p,v);\
     }\
     bool SequenceImpl::add##primtype(unsigned int propertyIndex, primval v)\
     {\
@@ -476,13 +549,28 @@
 adder(Float, float);
 adder(Double, long double);
 adder(Date, const SDODate);
-adder(DataObject, RefCountingPointer<DataObject>);
+doadder(DataObject, RefCountingPointer<DataObject>);
 
 
 #define charAdder(primtype,primval)\
     bool SequenceImpl::add##primtype(const char* propertyName, primval v, unsigned int len)\
     {\
-        return add##primtype(the_do->getProperty(propertyName),v, len);\
+        const PropertyImpl* p = the_do->getPropertyImpl(propertyName);\
+        if (p == 0)\
+        {\
+            if (the_do->getType().isOpenType())\
+            {\
+                p = the_do->define ##primtype (propertyName);\
+            }\
+            if (p == 0)\
+            {\
+                string msg("Cannot find property:");\
+                msg += propertyName;\
+                SDO_THROW_EXCEPTION("getProperty", SDOPropertyNotFoundException,\
+                msg.c_str());\
+            }\
+        }\
+        return add##primtype((const Property&)*p,v, len);\
     }\
     bool SequenceImpl::add##primtype(unsigned int propertyIndex, primval v, unsigned int len)\
     {\
@@ -517,11 +605,87 @@
 charAdder ( Bytes , const char* );
 
 
-
 #define inserter(primtype,primval)\
     bool SequenceImpl::add##primtype(unsigned int index, const char* propertyName, primval v)\
     {\
-        return add##primtype(index,the_do->getProperty(propertyName),v);\
+        const PropertyImpl* p = the_do->getPropertyImpl(propertyName);\
+        if (p == 0)\
+        {\
+            if (the_do->getType().isOpenType())\
+            {\
+                p = the_do->define ##primtype (propertyName);\
+            }\
+            if (p == 0)\
+            {\
+                string msg("Cannot find property:");\
+                msg += propertyName;\
+                SDO_THROW_EXCEPTION("getProperty", SDOPropertyNotFoundException,\
+                msg.c_str());\
+            }\
+        }\
+        return add##primtype(index,(const Property&)*p,v);\
+    }\
+    bool SequenceImpl::add##primtype(unsigned int index, unsigned int propertyIndex, primval v)\
+    {\
+        return add##primtype(index,the_do->getProperty(propertyIndex), v);\
+    }\
+    bool SequenceImpl::add##primtype(unsigned int index, const Property& p, primval v)\
+    {\
+        SEQUENCE_ITEM_LIST::iterator i;\
+        SEQUENCE_ITEM_LIST::iterator i2 = the_list.end();\
+        int j;\
+        if (index >= the_list.size()) {\
+            return add##primtype(p,v);\
+        }\
+        if (p.isMany())\
+        {\
+            DataObjectList& dol = the_do->getList(p);\
+            dol.append((primval)v);\
+            j = 0;\
+            for (i=the_list.begin();(j < index) && (i != the_list.end());++i) {\
+                j++;\
+            }\
+            /*the_list.insert(i,seq_item(&p,dol.size()-1));*/\
+            return true;\
+        }\
+        j = 0;\
+        for (i=the_list.begin();i != the_list.end();++i) {\
+            const Property* pp = (*i).getProp();\
+            if (pp == 0) continue;\
+            if (!strcmp(pp->getName(),p.getName()))\
+            {\
+                SDO_THROW_EXCEPTION("Insert", SDOUnsupportedOperationException,\
+                "Sequence::insert of property which already exists in sequence");\
+            }\
+            if (j == index) {\
+                i2 = i;\
+            }\
+            j++;\
+        }\
+        the_do->set##primtype(p,v);\
+        the_list.insert(i2,seq_item(&p,0));\
+        return true;\
+    }
+
+#define doinserter(primtype,primval)\
+    bool SequenceImpl::add##primtype(unsigned int index, const char* propertyName, primval v)\
+    {\
+        const PropertyImpl* p = the_do->getPropertyImpl(propertyName);\
+        if (p == 0)\
+        {\
+            if (the_do->getType().isOpenType())\
+            {\
+                p = the_do->define ##primtype (propertyName, v->getType());\
+            }\
+            if (p == 0)\
+            {\
+                string msg("Cannot find property:");\
+                msg += propertyName;\
+                SDO_THROW_EXCEPTION("getProperty", SDOPropertyNotFoundException,\
+                msg.c_str());\
+            }\
+        }\
+        return add##primtype(index,(const Property&)*p,v);\
     }\
     bool SequenceImpl::add##primtype(unsigned int index, unsigned int propertyIndex, primval v)\
     {\
@@ -575,14 +739,29 @@
 inserter(Float, float);
 inserter(Double, long double);
 inserter(Date, const SDODate);
-inserter(DataObject, RefCountingPointer<DataObject>);
+doinserter(DataObject, RefCountingPointer<DataObject>);
 
 
 
 #define charInserter(primtype,primval)\
     bool SequenceImpl::add##primtype(unsigned int index, const char* propertyName, primval v, unsigned int len)\
     {\
-        return add##primtype(index,the_do->getProperty(propertyName),v, len);\
+        const PropertyImpl* p = the_do->getPropertyImpl(propertyName);\
+        if (p == 0)\
+        {\
+            if (the_do->getType().isOpenType())\
+            {\
+                p = the_do->define ##primtype (propertyName);\
+            }\
+            if (p == 0)\
+            {\
+                string msg("Cannot find property:");\
+                msg += propertyName;\
+                SDO_THROW_EXCEPTION("getProperty", SDOPropertyNotFoundException,\
+                msg.c_str());\
+            }\
+        }\
+        return add##primtype(index,(const Property&)*p,v, len);\
     }\
     bool SequenceImpl::add##primtype(unsigned int index, unsigned int propertyIndex, primval v, unsigned int len)\
     {\

Modified: incubator/tuscany/cpp/sdo/runtime/core/src/commonj/sdo/SequenceImpl.h
URL: http://svn.apache.org/viewcvs/incubator/tuscany/cpp/sdo/runtime/core/src/commonj/sdo/SequenceImpl.h?rev=379156&r1=379155&r2=379156&view=diff
==============================================================================
--- incubator/tuscany/cpp/sdo/runtime/core/src/commonj/sdo/SequenceImpl.h (original)
+++ incubator/tuscany/cpp/sdo/runtime/core/src/commonj/sdo/SequenceImpl.h Mon Feb 20 08:41:03 2006
@@ -15,7 +15,7 @@
  *  limitations under the License.
  */
 
-/* $Rev$ $Date: 2005/12/22 16:54:15 $ */
+/* $Rev$ $Date: 2006/02/17 16:01:05 $ */
 
 #ifndef _SEQUENCEIMPL_H_
 #define _SEQUENCEIMPL_H_
@@ -34,7 +34,7 @@
 namespace sdo{
 
 class Property; /* forward declaration */
-class DataObject;
+class DataObjectImpl;
 
 /**  SequenceImpl implements the abstract class Sequence.
  *
@@ -57,6 +57,12 @@
     ///////////////////////////////////////////////////////////////////////////
     virtual const Property& getProperty(unsigned int index);
 
+    /**
+     * Return the data object associated with this sequence
+     */
+
+    SDO_API virtual const DataObjectPtr getDataObject();
+
     ///////////////////////////////////////////////////////////////////////////
     // Returns the property for the given entry index.
     ///////////////////////////////////////////////////////////////////////////
@@ -294,7 +300,7 @@
 
     SequenceImpl();
 
-    DataObject* the_do;
+    DataObjectImpl* the_do;
 
     class seq_item {
        public:

Modified: incubator/tuscany/cpp/sdo/runtime/core/src/commonj/sdo/SettingList.cpp
URL: http://svn.apache.org/viewcvs/incubator/tuscany/cpp/sdo/runtime/core/src/commonj/sdo/SettingList.cpp?rev=379156&r1=379155&r2=379156&view=diff
==============================================================================
--- incubator/tuscany/cpp/sdo/runtime/core/src/commonj/sdo/SettingList.cpp (original)
+++ incubator/tuscany/cpp/sdo/runtime/core/src/commonj/sdo/SettingList.cpp Mon Feb 20 08:41:03 2006
@@ -15,7 +15,7 @@
  *  limitations under the License.
  */
 
-/* $Rev$ $Date: 2005/12/22 16:54:15 $ */
+/* $Rev$ $Date: 2006/02/17 16:01:05 $ */
 
 #include "commonj/sdo/SDORuntimeException.h"
 
@@ -27,9 +27,9 @@
 namespace sdo {
 
 
-SettingList::SettingList(SETTING_VECTOR p) : slist (p)
-{
-}
+//SettingList::SettingList(SETTING_VECTOR p) : slist (p)
+//{
+//}
 
 /*SettingList::SettingList(const SettingList &pin)
 {
@@ -44,13 +44,26 @@
 
 SettingList::~SettingList()
 {
+    while (slist.size() > 0)
+    {
+        Setting* s = slist[0];
+        slist.erase(slist.begin());
+        delete s;
+    }
+
 }
 
 
 Setting& SettingList::operator[] (int pos) const
 {    
     validateIndex(pos);
-    return (Setting&)slist[pos];
+    return (*slist[pos]);
+}
+
+Setting* SettingList::get(int pos) 
+{    
+    validateIndex(pos);
+    return (slist[pos]);
 }
 
 int SettingList::size () const
@@ -58,17 +71,17 @@
     return slist.size();
 }
 
-SETTING_VECTOR SettingList::getVec() const
-{
-    return slist;
-}
+//SETTING_VECTOR SettingList::getVec() const
+//{
+//    return slist;
+//}
 
-void SettingList::insert (unsigned int index, const Setting& d)
+void SettingList::insert (unsigned int index,  Setting* d)
 {
     slist.insert(slist.begin()+index, d);
 }
 
-void SettingList::append (const Setting& d)
+void SettingList::append ( Setting* d)
 {
     slist.insert(slist.end(),d);
 }
@@ -76,7 +89,9 @@
 void SettingList::remove(unsigned int index)
 {
     validateIndex(index);
+    const Setting* s = slist[index];
     slist.erase(slist.begin()+index);
+    delete s;
     return;
 }
 

Modified: incubator/tuscany/cpp/sdo/runtime/core/src/commonj/sdo/SettingList.h
URL: http://svn.apache.org/viewcvs/incubator/tuscany/cpp/sdo/runtime/core/src/commonj/sdo/SettingList.h?rev=379156&r1=379155&r2=379156&view=diff
==============================================================================
--- incubator/tuscany/cpp/sdo/runtime/core/src/commonj/sdo/SettingList.h (original)
+++ incubator/tuscany/cpp/sdo/runtime/core/src/commonj/sdo/SettingList.h Mon Feb 20 08:41:03 2006
@@ -15,7 +15,7 @@
  *  limitations under the License.
  */
 
-/* $Rev$ $Date: 2005/12/22 16:54:15 $ */
+/* $Rev$ $Date: 2006/02/17 16:01:05 $ */
 
 #ifndef SETTINGLIST_H
 #define SETTINGLIST_H
@@ -28,7 +28,7 @@
 namespace commonj{
 namespace sdo{
 
-typedef std::vector<Setting> SETTING_VECTOR;
+typedef std::vector< Setting*> SETTING_VECTOR;
 
 /**  SettingList is a list of settings returned by a change summary
  */
@@ -37,7 +37,7 @@
 {
 
 public:
-    SettingList(SETTING_VECTOR sl);
+    //SettingList(SETTING_VECTOR sl);
     SettingList();
 
     virtual ~SettingList();
@@ -47,7 +47,7 @@
      * This gives access to elements of the list
      */
 
-    virtual Setting& operator[] (int pos) const;
+    SDO_API virtual Setting& operator[] (int pos) const;
 
     /**  size() returns the number of settings
      *
@@ -55,16 +55,16 @@
      * These may be creations, deletions or changes.
      */
 
-    virtual int size () const;
+    SDO_API virtual int size () const;
     
-    virtual void insert (unsigned int index, const Setting& d);
-    virtual void append (const Setting& d);
+    virtual void insert (unsigned int index,  Setting* d);
+    virtual void append ( Setting* d);
     virtual void remove (unsigned int index);
+    virtual Setting* get (int pos);
 
 
 private: 
     SETTING_VECTOR slist;
-    SETTING_VECTOR getVec() const;
 
     void validateIndex(int index) const;
 };

Modified: incubator/tuscany/cpp/sdo/runtime/core/src/commonj/sdo/Type.h
URL: http://svn.apache.org/viewcvs/incubator/tuscany/cpp/sdo/runtime/core/src/commonj/sdo/Type.h?rev=379156&r1=379155&r2=379156&view=diff
==============================================================================
--- incubator/tuscany/cpp/sdo/runtime/core/src/commonj/sdo/Type.h (original)
+++ incubator/tuscany/cpp/sdo/runtime/core/src/commonj/sdo/Type.h Mon Feb 20 08:41:03 2006
@@ -15,7 +15,7 @@
  *  limitations under the License.
  */
 
-/* $Rev$ $Date: 2005/12/22 16:54:15 $ */
+/* $Rev$ $Date: 2006/02/02 16:41:30 $ */
 
 #ifndef _SDO_TYPE_H_
 #define _SDO_TYPE_H_
@@ -73,6 +73,7 @@
     DataObjectType,
     ChangeSummaryType,
     TextType,
+    UndefinedOpenPropertyType,
     num_types
    };
 

Modified: incubator/tuscany/cpp/sdo/runtime/core/src/commonj/sdo/TypeImpl.cpp
URL: http://svn.apache.org/viewcvs/incubator/tuscany/cpp/sdo/runtime/core/src/commonj/sdo/TypeImpl.cpp?rev=379156&r1=379155&r2=379156&view=diff
==============================================================================
--- incubator/tuscany/cpp/sdo/runtime/core/src/commonj/sdo/TypeImpl.cpp (original)
+++ incubator/tuscany/cpp/sdo/runtime/core/src/commonj/sdo/TypeImpl.cpp Mon Feb 20 08:41:03 2006
@@ -15,7 +15,11 @@
  *  limitations under the License.
  */
 
-/* $Rev$ $Date: 2006/01/04 14:21:08 $ */
+/* $Rev$ $Date: 2006/01/25 15:51:00 $ */
+
+#ifdef HAVE_CONFIG_H
+#include "config.h"
+#endif
 
 #include "commonj/sdo/Logger.h"
 
@@ -23,6 +27,8 @@
 #include "commonj/sdo/TypeImpl.h"
 
 #include <iostream>
+#include <wchar.h>
+#include <stdio.h>
 using namespace std;
 
 #include <list>

Modified: incubator/tuscany/cpp/sdo/runtime/core/src/commonj/sdo/XMLHelper.h
URL: http://svn.apache.org/viewcvs/incubator/tuscany/cpp/sdo/runtime/core/src/commonj/sdo/XMLHelper.h?rev=379156&r1=379155&r2=379156&view=diff
==============================================================================
--- incubator/tuscany/cpp/sdo/runtime/core/src/commonj/sdo/XMLHelper.h (original)
+++ incubator/tuscany/cpp/sdo/runtime/core/src/commonj/sdo/XMLHelper.h Mon Feb 20 08:41:03 2006
@@ -15,7 +15,7 @@
  *  limitations under the License.
  */
 
-/* $Rev$ $Date: 2006/01/24 10:53:23 $ */
+/* $Rev$ $Date: 2006/02/01 16:24:13 $ */
 
 #ifndef _XMLHELPER_H_
 #define _XMLHELPER_H_
@@ -46,6 +46,7 @@
              */
 
            SDO_API virtual XMLDocumentPtr createDocument(
+               const char* elementname = 0,
                const char* rootElementURI=0) = 0;
 
            SDO_API virtual XMLDocumentPtr loadFile(
@@ -63,12 +64,14 @@
              * save - Serializes the datagraph to the XML file
              */
 
-            SDO_API virtual void    save(XMLDocumentPtr doc, const char* xmlFile) = 0;                
+            SDO_API virtual void    save(XMLDocumentPtr doc, const char* xmlFile,
+                int indent = -1) = 0;                
             SDO_API virtual void save(
                 DataObjectPtr dataObject,
                 const char* rootElementURI,
                 const char* rootElementName,
-                const char* xmlFile) = 0;
+                const char* xmlFile,
+                int indent = -1) = 0;
             
             
             /**  save saves the graph to XML
@@ -76,23 +79,26 @@
              * save - Serializes the datagraph to the XML stream
              */
 
-            SDO_API virtual void save(XMLDocumentPtr doc, std::ostream& outXml) = 0;
+            SDO_API virtual void save(XMLDocumentPtr doc, std::ostream& outXml,
+                int indent = -1) = 0;
             SDO_API virtual void save(
                 DataObjectPtr dataObject,
                 const char* rootElementURI,
                 const char* rootElementName,
-                std::ostream& outXml) = 0;
+                std::ostream& outXml,
+                int indent = -1) = 0;
             
             /**  save saves the graph to XML
              *
              * save - Serializes the datagraph to a string
              */
 
-            SDO_API virtual char* save(XMLDocumentPtr doc) = 0;
+            SDO_API virtual char* save(XMLDocumentPtr doc, int indent = -1) = 0;
             SDO_API virtual char* save(
                 DataObjectPtr dataObject,
                 const char* rootElementURI,
-                const char* rootElementName) = 0;
+                const char* rootElementName,
+                int indent = -1) = 0;
             
             /**  createDocument creates an XMLDocument
              *

Modified: incubator/tuscany/cpp/sdo/runtime/core/src/commonj/sdo/XMLHelperImpl.cpp
URL: http://svn.apache.org/viewcvs/incubator/tuscany/cpp/sdo/runtime/core/src/commonj/sdo/XMLHelperImpl.cpp?rev=379156&r1=379155&r2=379156&view=diff
==============================================================================
--- incubator/tuscany/cpp/sdo/runtime/core/src/commonj/sdo/XMLHelperImpl.cpp (original)
+++ incubator/tuscany/cpp/sdo/runtime/core/src/commonj/sdo/XMLHelperImpl.cpp Mon Feb 20 08:41:03 2006
@@ -15,7 +15,7 @@
  *  limitations under the License.
  */
 
-/* $Rev$ $Date: 2006/01/24 11:07:23 $ */
+/* $Rev$ $Date: 2006/02/01 16:24:13 $ */
 
 #include "commonj/sdo/SDOXMLFileWriter.h"   // Include first to avoid libxml compile problems!
 #include "commonj/sdo/SDOXMLStreamWriter.h" // Include first to avoid libxml compile problems!
@@ -94,12 +94,13 @@
         }
 
 
-        XMLDocumentPtr XMLHelperImpl::createDocument(const char* rootElementURI)
+        XMLDocumentPtr XMLHelperImpl::createDocument(const char* elementname,
+                                                     const char* rootElementURI)
         {
             DataFactory* dp = (DataFactory*)getDataFactory();
             if (dp != 0)
             {
-                const TypeImpl* rType;
+                const TypeImpl* rType = NULL;
                 if (rootElementURI  != 0)
                 {
                     rType = ((DataFactoryImpl*)dp)->findTypeImpl
@@ -114,17 +115,49 @@
                         {
                             rType = ((DataFactoryImpl*)dp)->findTypeImpl
                                 (tl[i].getURI(), "RootType");
-                            // could continue and check for other roots
-                            // here if duplicates become a problem
                             break;
                         }
                     }
                 }
-                if (rType != 0)
+                if (rType)
                 {
-                    DataObjectPtr dob = dp->create(*rType);
-                    return new XMLDocumentImpl(dob,
-                        rType->getURI(), rType->getName());
+                    if (elementname && strlen(elementname) != 0)
+                    {
+                        PropertyImpl* pl = rType->getPropertyImpl(elementname);
+                        if (pl != 0)
+                        {
+                            const Type& tp = pl->getType();
+                            DataObjectPtr dob = dp->create(tp);
+                            return new XMLDocumentImpl(dob,
+                                 tp.getURI(), /*tp.getName()*/ elementname);
+                        }
+                        else
+                        {
+                            string msg("createDocument - cannot find element ");
+                            msg += elementname;
+                            SDO_THROW_EXCEPTION("createDocument", SDOUnsupportedOperationException,
+                            msg.c_str());
+                        }
+                    }
+                    else
+                    {
+                        const Property& pl = rType->getProperty((unsigned int)0);
+                        const Type& tp = pl.getType();
+                        DataObjectPtr dob = dp->create(tp);
+                           return new XMLDocumentImpl(dob,
+                                  tp.getURI(), /*tp.getName()*/ pl.getName());
+                    }
+                }
+                else
+                {
+                     string msg("createDocument - unable to find root type in namespace ");
+                     if (rootElementURI != 0) 
+                         msg += rootElementURI;
+                     else
+                         msg += " NULL";
+                     
+                     SDO_THROW_EXCEPTION("createDocument", SDOUnsupportedOperationException,
+                     msg.c_str());
                 }
             }
             return 0;
@@ -174,42 +207,47 @@
             return load(str, targetNamespaceURI);
         }
         
-        void XMLHelperImpl::save(XMLDocumentPtr doc, const char* xmlFile)
+        void XMLHelperImpl::save(XMLDocumentPtr doc, const char* xmlFile, int indent)
         {
             SDOXMLFileWriter writer(xmlFile, dataFactory);
-            writer.write(doc);
+            writer.write(doc, indent);
         }
         
         void XMLHelperImpl::save(
             DataObjectPtr dataObject,
             const char* rootElementURI,
             const char* rootElementName,
-            const char* xmlFile)
+            const char* xmlFile,
+            int indent)
         {
-            save(createDocument(dataObject,rootElementURI, rootElementName), xmlFile);
+            save(createDocument(dataObject,rootElementURI, rootElementName), xmlFile,
+                indent);
         }
         
         
         // Serializes the datagraph to a stream
-        void XMLHelperImpl::save(XMLDocumentPtr doc, std::ostream& outXml)
+        void XMLHelperImpl::save(XMLDocumentPtr doc, std::ostream& outXml,
+            int indent)
         {
             SDOXMLStreamWriter writer(outXml, dataFactory);
-            writer.write(doc);                
+            writer.write(doc, indent);                
         }
         void XMLHelperImpl::save(
             DataObjectPtr dataObject,
             const char* rootElementURI,
             const char* rootElementName,
-            std::ostream& outXml)
+            std::ostream& outXml,
+            int indent )
         {
-            save(createDocument(dataObject,rootElementURI, rootElementName), outXml);
+            save(createDocument(dataObject,rootElementURI, rootElementName), outXml, indent);
         }
         
         // Serializes the datagraph to a string
-        char* XMLHelperImpl::save(XMLDocumentPtr doc)
+        char* XMLHelperImpl::save(XMLDocumentPtr doc,
+            int indent)
         {
             SDOXMLBufferWriter writer(dataFactory);
-            writer.write(doc);
+            writer.write(doc, indent);
             SDOXMLString ret = writer.getBuffer();
             char* retString = new char[strlen(ret) +1];
             strcpy(retString, ret);
@@ -218,9 +256,11 @@
         char* XMLHelperImpl::save(
             DataObjectPtr dataObject,
             const char* rootElementURI,
-            const char* rootElementName)
+            const char* rootElementName,
+            int indent)
         {
-            return save(createDocument(dataObject,rootElementURI, rootElementName));
+            return save(createDocument(dataObject,rootElementURI, rootElementName),
+                indent);
         }
 
         int XMLHelperImpl::getErrorCount() const

Modified: incubator/tuscany/cpp/sdo/runtime/core/src/commonj/sdo/XMLHelperImpl.h
URL: http://svn.apache.org/viewcvs/incubator/tuscany/cpp/sdo/runtime/core/src/commonj/sdo/XMLHelperImpl.h?rev=379156&r1=379155&r2=379156&view=diff
==============================================================================
--- incubator/tuscany/cpp/sdo/runtime/core/src/commonj/sdo/XMLHelperImpl.h (original)
+++ incubator/tuscany/cpp/sdo/runtime/core/src/commonj/sdo/XMLHelperImpl.h Mon Feb 20 08:41:03 2006
@@ -15,7 +15,7 @@
  *  limitations under the License.
  */
 
-/* $Rev$ $Date: 2006/01/24 10:53:23 $ */
+/* $Rev$ $Date: 2006/02/01 16:24:13 $ */
 
 #ifndef _XMLHELPERIMPL_H_
 #define _XMLHELPERIMPL_H_
@@ -64,6 +64,7 @@
              */
 
            virtual XMLDocumentPtr createDocument(
+               const char* elementname= 0,
                const char* rootElementURI=0);
 
            virtual XMLDocumentPtr loadFile(
@@ -86,34 +87,37 @@
              * save - Serializes the datagraph to the XML file
              */
 
-            void save(XMLDocumentPtr doc, const char* xmlFile);
+            void save(XMLDocumentPtr doc, const char* xmlFile, int indent = -1);
             void save(
                 DataObjectPtr dataObject,
                 const char* rootElementURI,
                 const char* rootElementName,
-                const char* xmlFile);
+                const char* xmlFile, int indent = -1);
 
             /**  save saves the graph to XML
              *
              * save - Serializes the datagraph to a stream
              */
 
-            void save(XMLDocumentPtr doc, std::ostream& outXml);
+            void save(XMLDocumentPtr doc, std::ostream& outXml,
+                int indent = -1);
             void save(
                 DataObjectPtr dataObject,
                 const char* rootElementURI,
                 const char* rootElementName,
-                std::ostream& outXml);
+                std::ostream& outXml,
+                int indent = -1);
 
             /**  save saves the graph to XML
              *
              * save - Serializes the datagraph to a string
              */
-            char* save(XMLDocumentPtr doc);
+            char* save(XMLDocumentPtr doc,int indent = -1);
             char* save(
                 DataObjectPtr dataObject,
                 const char* rootElementURI,
-                const char* rootElementName);
+                const char* rootElementName,
+                int indent = -1);
                             
         private:
             int     parse(const char* source);

Modified: incubator/tuscany/cpp/sdo/runtime/core/src/commonj/sdo/XSDHelper.h
URL: http://svn.apache.org/viewcvs/incubator/tuscany/cpp/sdo/runtime/core/src/commonj/sdo/XSDHelper.h?rev=379156&r1=379155&r2=379156&view=diff
==============================================================================
--- incubator/tuscany/cpp/sdo/runtime/core/src/commonj/sdo/XSDHelper.h (original)
+++ incubator/tuscany/cpp/sdo/runtime/core/src/commonj/sdo/XSDHelper.h Mon Feb 20 08:41:03 2006
@@ -15,7 +15,7 @@
  *  limitations under the License.
  */
 
-/* $Rev$ $Date: 2005/12/22 16:54:15 $ */
+/* $Rev$ $Date: 2006/02/01 16:24:13 $ */
 
 #ifndef _XSDHELPER_H_
 #define _XSDHELPER_H_
@@ -65,15 +65,18 @@
 
             SDO_API virtual char* generate(
                 const TypeList& types,
-                const char* targetNamespaceURI = "") = 0;
+                const char* targetNamespaceURI = "",
+                int indent = -1) = 0;
             SDO_API virtual void generate(
                 const TypeList& types,
                 std::ostream& outXsd,
-                const char* targetNamespaceURI = "") = 0;
+                const char* targetNamespaceURI = "",
+                int indent = -1) = 0;
             SDO_API virtual void generateFile(
                 const TypeList& types,
                 const char* fileName,
-                const char* targetNamespaceURI = "") = 0;
+                const char* targetNamespaceURI = "",
+                int indent = -1) = 0;
 
             /***********************************/
             /* Destructor */

Modified: incubator/tuscany/cpp/sdo/runtime/core/src/commonj/sdo/XSDHelperImpl.cpp
URL: http://svn.apache.org/viewcvs/incubator/tuscany/cpp/sdo/runtime/core/src/commonj/sdo/XSDHelperImpl.cpp?rev=379156&r1=379155&r2=379156&view=diff
==============================================================================
--- incubator/tuscany/cpp/sdo/runtime/core/src/commonj/sdo/XSDHelperImpl.cpp (original)
+++ incubator/tuscany/cpp/sdo/runtime/core/src/commonj/sdo/XSDHelperImpl.cpp Mon Feb 20 08:41:03 2006
@@ -15,7 +15,7 @@
  *  limitations under the License.
  */
 
-/* $Rev$ $Date: 2006/01/05 08:34:35 $ */
+/* $Rev$ $Date: 2006/02/01 16:24:13 $ */
 
 #include "commonj/sdo/SDOXMLFileWriter.h"   // Include first to avoid libxml compile problems!
 #include "commonj/sdo/SDOXMLStreamWriter.h" // Include first to avoid libxml compile problems!
@@ -521,36 +521,39 @@
         void XSDHelperImpl::generateFile(
             const TypeList& types,
             const char* fileName, 
-            const char* targetNamespaceURI
+            const char* targetNamespaceURI,
+            int indent
             )
         {
             SDOXSDFileWriter writer(fileName);
             DataFactory* fac = dataFactory;
             writer.write(types, targetNamespaceURI, 
-                ((DataFactoryImpl*)fac)->getOpenProperties());
+                ((DataFactoryImpl*)fac)->getOpenProperties(), indent);
         }
         
         void XSDHelperImpl::generate(
             const TypeList& types,
             std::ostream& outXml,
-            const char* targetNamespaceURI
+            const char* targetNamespaceURI,
+            int indent
             )
         {
             SDOXSDStreamWriter writer(outXml);
             DataFactory* fac = dataFactory;
             writer.write(types,    targetNamespaceURI, 
-                ((DataFactoryImpl*)fac)->getOpenProperties());                
+                ((DataFactoryImpl*)fac)->getOpenProperties(), indent);                
         }
         
         char* XSDHelperImpl::generate(
             const TypeList& types,
-            const char* targetNamespaceURI
+            const char* targetNamespaceURI,
+            int indent
             )
         {
             SDOXSDBufferWriter writer;
             DataFactory* fac = dataFactory;
             writer.write(types, targetNamespaceURI, 
-                ((DataFactoryImpl*)fac)->getOpenProperties());
+                ((DataFactoryImpl*)fac)->getOpenProperties(), indent);
             SDOXMLString ret = writer.getBuffer();
             char* retString = new char[strlen(ret) +1];
             strcpy(retString, ret);

Modified: incubator/tuscany/cpp/sdo/runtime/core/src/commonj/sdo/XSDHelperImpl.h
URL: http://svn.apache.org/viewcvs/incubator/tuscany/cpp/sdo/runtime/core/src/commonj/sdo/XSDHelperImpl.h?rev=379156&r1=379155&r2=379156&view=diff
==============================================================================
--- incubator/tuscany/cpp/sdo/runtime/core/src/commonj/sdo/XSDHelperImpl.h (original)
+++ incubator/tuscany/cpp/sdo/runtime/core/src/commonj/sdo/XSDHelperImpl.h Mon Feb 20 08:41:03 2006
@@ -15,7 +15,7 @@
  *  limitations under the License.
  */
 
-/* $Rev$ $Date: 2005/12/22 16:54:15 $ */
+/* $Rev$ $Date: 2006/02/01 16:24:13 $ */
 
 #ifndef _XSDHELPERIMPL_H_
 #define _XSDHELPERIMPL_H_
@@ -94,17 +94,20 @@
 
             virtual char* generate(
                 const TypeList& types,
-                const char* targetNamespaceURI = ""
+                const char* targetNamespaceURI = "",
+                int indent = -1
                 );
             void generate(
                 const TypeList& types,
                 std::ostream& outXsd,
-                const char* targetNamespaceURI = ""
+                const char* targetNamespaceURI = "", 
+                int indent = -1
                 );
             virtual void generateFile(
                 const TypeList& types,
                 const char* fileName,
-                const char* targetNamespaceURI = "");
+                const char* targetNamespaceURI = "", 
+                int indent = -1);
             
             virtual DataFactoryPtr getDataFactory();