tuscany-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ajbor...@apache.org
Subject svn commit: r440722 - /incubator/tuscany/cpp/sdo/runtime/core/src/commonj/sdo/
Date Wed, 06 Sep 2006 14:23:51 GMT
Author: ajborley
Date: Wed Sep  6 07:23:49 2006
New Revision: 440722

URL: http://svn.apache.org/viewvc?view=rev&rev=440722
Log:
Applied Geoff's patch for TUSCANY-697

Modified:
    incubator/tuscany/cpp/sdo/runtime/core/src/commonj/sdo/DataFactory.h
    incubator/tuscany/cpp/sdo/runtime/core/src/commonj/sdo/DataFactoryImpl.cpp
    incubator/tuscany/cpp/sdo/runtime/core/src/commonj/sdo/DataFactoryImpl.h
    incubator/tuscany/cpp/sdo/runtime/core/src/commonj/sdo/DataGraph.h
    incubator/tuscany/cpp/sdo/runtime/core/src/commonj/sdo/DataGraphImpl.cpp
    incubator/tuscany/cpp/sdo/runtime/core/src/commonj/sdo/DataGraphImpl.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/PropertyDefinition.cpp
    incubator/tuscany/cpp/sdo/runtime/core/src/commonj/sdo/PropertyDefinition.h
    incubator/tuscany/cpp/sdo/runtime/core/src/commonj/sdo/TypeDefinition.cpp
    incubator/tuscany/cpp/sdo/runtime/core/src/commonj/sdo/TypeDefinition.h
    incubator/tuscany/cpp/sdo/runtime/core/src/commonj/sdo/XMLDocument.h
    incubator/tuscany/cpp/sdo/runtime/core/src/commonj/sdo/XMLDocumentImpl.cpp
    incubator/tuscany/cpp/sdo/runtime/core/src/commonj/sdo/XMLDocumentImpl.h
    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/DataFactory.h
URL: http://svn.apache.org/viewvc/incubator/tuscany/cpp/sdo/runtime/core/src/commonj/sdo/DataFactory.h?view=diff&rev=440722&r1=440721&r2=440722
==============================================================================
--- incubator/tuscany/cpp/sdo/runtime/core/src/commonj/sdo/DataFactory.h (original)
+++ incubator/tuscany/cpp/sdo/runtime/core/src/commonj/sdo/DataFactory.h Wed Sep  6 07:23:49 2006
@@ -458,11 +458,10 @@
             const char* propname , 
             char* c) = 0;
 
-// #pragma message( "GMW: Unimplemented method, writable string parameter" )
-//         virtual SDO_API void setDefault(
-//             const Type& t, 
-//             const SDOString& propname , 
-//             SDOString& c) = 0;
+        virtual SDO_API void setDefault(
+            const Type& t, 
+            const SDOString& propname , 
+            SDOString& outstr) = 0;
 
         virtual SDO_API void setDefault(
             const Type& t, 
@@ -594,12 +593,11 @@
             const char* propname , 
             char* c) = 0;
 
-// #pragma message( "GMW: Unimplemented method, writable string parameter" )
-//         virtual SDO_API void setDefault(
-//             const SDOString& typuri, 
-//             const SDOString& typnam, 
-//             const SDOString& propname , 
-//             SDOString& c) = 0;
+        virtual SDO_API void setDefault(
+            const SDOString& typuri, 
+            const SDOString& typnam, 
+            const SDOString& propname , 
+            SDOString& c) = 0;
 
         virtual SDO_API void setDefault(
             const char* typuri, 

Modified: incubator/tuscany/cpp/sdo/runtime/core/src/commonj/sdo/DataFactoryImpl.cpp
URL: http://svn.apache.org/viewvc/incubator/tuscany/cpp/sdo/runtime/core/src/commonj/sdo/DataFactoryImpl.cpp?view=diff&rev=440722&r1=440721&r2=440722
==============================================================================
--- incubator/tuscany/cpp/sdo/runtime/core/src/commonj/sdo/DataFactoryImpl.cpp (original)
+++ incubator/tuscany/cpp/sdo/runtime/core/src/commonj/sdo/DataFactoryImpl.cpp Wed Sep  6 07:23:49 2006
@@ -971,12 +971,11 @@
         setDefault(t.getURI(), t.getName(), propname, c);
     }
 
-// #pragma message( "GMW: Unimplemented method, writable string parameter" )
-//     void DataFactoryImpl::setDefault(
-//         const Type& t, const SDOString& propname , SDOString& c) 
-//     {
-//         setDefault(t.getURI(), t.getName(), propname.c_str(), c.c_str());
-//     }
+    void DataFactoryImpl::setDefault(
+        const Type& t, const SDOString& propname , SDOString& outstr)
+    {
+        setDefault(t.getURI(), t.getName(), propname, outstr);
+    }
 
     void DataFactoryImpl::setDefault(
         const Type& t, const char* propname , short s) 
@@ -1134,13 +1133,14 @@
         if (pi != 0)pi->setDefault(c);
     }
 
-// #pragma message( "GMW: Unimplemented method, writable string parameter" )
-//     void DataFactoryImpl::setDefault(
-//         const SDOString& typuri, const SDOString& typnam, 
-//         const SDOString& propname , SDOString& c) 
-//     {
-//       setDefault(typuri.c_str(), typnam.c_str(), propname.c_str(), c.c_str());
-//     }
+    void DataFactoryImpl::setDefault(
+        const SDOString& typuri, const SDOString& typnam, 
+        const SDOString& propname , SDOString& c) 
+    {
+        const TypeImpl* ti = findTypeImpl(typuri, typnam);
+        PropertyImpl* pi = ti->getPropertyImpl(propname);
+        if (pi != 0)pi->setDefault(c);
+    }
 
     void DataFactoryImpl::setDefault(
         const char* typuri, const char* typnam, 

Modified: incubator/tuscany/cpp/sdo/runtime/core/src/commonj/sdo/DataFactoryImpl.h
URL: http://svn.apache.org/viewvc/incubator/tuscany/cpp/sdo/runtime/core/src/commonj/sdo/DataFactoryImpl.h?view=diff&rev=440722&r1=440721&r2=440722
==============================================================================
--- incubator/tuscany/cpp/sdo/runtime/core/src/commonj/sdo/DataFactoryImpl.h (original)
+++ incubator/tuscany/cpp/sdo/runtime/core/src/commonj/sdo/DataFactoryImpl.h Wed Sep  6 07:23:49 2006
@@ -316,11 +316,10 @@
         const char* propname , 
         char* c) ;
 
-// #pragma message( "GMW: Unimplemented method, writable string parameter" )
-//     virtual void setDefault(
-//         const Type& t, 
-//         const SDOString& propname , 
-//         SDOString& c) ;
+    virtual void setDefault(
+        const Type& t, 
+        const SDOString& propname , 
+        SDOString& outstr);
 
     virtual void setDefault(
         const Type& t, 
@@ -453,12 +452,11 @@
         const char* propname ,
         char* c) ;
 
-// #pragma message( "GMW: Unimplemented method, writable string parameter" )
-//     virtual void setDefault(
-//         const SDOString& typuri, 
-//         const SDOString& typnam, 
-//         const SDOString& propname ,
-//         SDOString& c) ;
+    virtual void setDefault(
+        const SDOString& typuri, 
+        const SDOString& typnam, 
+        const SDOString& propname ,
+        SDOString& c) ;
 
     virtual void setDefault(
         const char* typuri, 

Modified: incubator/tuscany/cpp/sdo/runtime/core/src/commonj/sdo/DataGraph.h
URL: http://svn.apache.org/viewvc/incubator/tuscany/cpp/sdo/runtime/core/src/commonj/sdo/DataGraph.h?view=diff&rev=440722&r1=440721&r2=440722
==============================================================================
--- incubator/tuscany/cpp/sdo/runtime/core/src/commonj/sdo/DataGraph.h (original)
+++ incubator/tuscany/cpp/sdo/runtime/core/src/commonj/sdo/DataGraph.h Wed Sep  6 07:23:49 2006
@@ -68,6 +68,8 @@
 
     virtual SDO_API DataObjectPtr createRootObject(const char* uri,
                         const char* name) = 0;
+    virtual SDO_API DataObjectPtr createRootObject(const SDOString& uri,
+                        const SDOString& name) = 0;
 
    /**
      * Creates a root data object - used by DAS implementations.
@@ -90,6 +92,8 @@
 
     virtual SDO_API const Type& getType(const char* uri,
                             const char* name) = 0;
+    virtual SDO_API const Type& getType(const SDOString& uri,
+                            const SDOString& name) = 0;
 
 
 };

Modified: incubator/tuscany/cpp/sdo/runtime/core/src/commonj/sdo/DataGraphImpl.cpp
URL: http://svn.apache.org/viewvc/incubator/tuscany/cpp/sdo/runtime/core/src/commonj/sdo/DataGraphImpl.cpp?view=diff&rev=440722&r1=440721&r2=440722
==============================================================================
--- incubator/tuscany/cpp/sdo/runtime/core/src/commonj/sdo/DataGraphImpl.cpp (original)
+++ incubator/tuscany/cpp/sdo/runtime/core/src/commonj/sdo/DataGraphImpl.cpp Wed Sep  6 07:23:49 2006
@@ -65,9 +65,32 @@
     }
 
 
+//     DataObjectPtr DataGraphImpl::createRootObject(const char* uri,
+//                         const char* name)
+//     {
+//         if (root != 0)
+//         {
+//             SDO_THROW_EXCEPTION("createRootObject",SDOUnsupportedOperationException,
+//                 "Root data object already exists");
+//         }
+//         root = factory->create(uri,name);
+//         if (root->getInstanceProperties()[0].getType().isDataType())
+//         {
+//             SDO_THROW_EXCEPTION("createRootObject",SDOUnsupportedOperationException,
+//                 "Root data object cannot have a datatype property at element 0");
+//         }
+//         return root;
+//     }
+
     DataObjectPtr DataGraphImpl::createRootObject(const char* uri,
                         const char* name)
     {
+      return createRootObject(SDOString(uri), SDOString(name));
+    }
+
+    DataObjectPtr DataGraphImpl::createRootObject(const SDOString& uri,
+                        const SDOString& name)
+    {
         if (root != 0)
         {
             SDO_THROW_EXCEPTION("createRootObject",SDOUnsupportedOperationException,
@@ -109,6 +132,11 @@
 
     const Type& DataGraphImpl::getType(const char* uri,
                             const char* name)
+    {
+        return factory->getType(uri,name);
+    }
+    const Type& DataGraphImpl::getType(const SDOString& uri,
+                            const SDOString& name)
     {
         return factory->getType(uri,name);
     }

Modified: incubator/tuscany/cpp/sdo/runtime/core/src/commonj/sdo/DataGraphImpl.h
URL: http://svn.apache.org/viewvc/incubator/tuscany/cpp/sdo/runtime/core/src/commonj/sdo/DataGraphImpl.h?view=diff&rev=440722&r1=440721&r2=440722
==============================================================================
--- incubator/tuscany/cpp/sdo/runtime/core/src/commonj/sdo/DataGraphImpl.h (original)
+++ incubator/tuscany/cpp/sdo/runtime/core/src/commonj/sdo/DataGraphImpl.h Wed Sep  6 07:23:49 2006
@@ -70,6 +70,8 @@
 
     virtual DataObjectPtr createRootObject(const char* uri,
                         const char* name);
+    virtual DataObjectPtr createRootObject(const SDOString& uri,
+                        const SDOString& name);
 
     /**
      * Creates the root data object - for use by DAS implementations
@@ -93,6 +95,8 @@
 
     virtual const Type& getType(const char* uri,
                             const char* name);
+    virtual const Type& getType(const SDOString& uri,
+                            const SDOString& name);
 
     private:
 

Modified: incubator/tuscany/cpp/sdo/runtime/core/src/commonj/sdo/DataObjectList.h
URL: http://svn.apache.org/viewvc/incubator/tuscany/cpp/sdo/runtime/core/src/commonj/sdo/DataObjectList.h?view=diff&rev=440722&r1=440721&r2=440722
==============================================================================
--- incubator/tuscany/cpp/sdo/runtime/core/src/commonj/sdo/DataObjectList.h (original)
+++ incubator/tuscany/cpp/sdo/runtime/core/src/commonj/sdo/DataObjectList.h Wed Sep  6 07:23:49 2006
@@ -98,6 +98,7 @@
     virtual SDO_API void setDouble(unsigned int index, long double d)  = 0;
     virtual SDO_API void setDate(unsigned int index, const SDODate d)  = 0;
     virtual SDO_API void setCString(unsigned int index, char* d)  = 0;
+    virtual SDO_API void setCString(unsigned int index, const SDOString& d)  = 0;
     virtual SDO_API void setDataObject(unsigned int index, DataObjectPtr dob)  = 0;
 
     /**  getLength returns the length of a string element
@@ -137,6 +138,7 @@
     virtual SDO_API void append (const char* d, unsigned int len) = 0;
 
     virtual SDO_API void insert (unsigned int index, const char* d) = 0;
+    virtual SDO_API void insert (unsigned int index, const SDOString& d) = 0;
     virtual SDO_API void append (const char* d) = 0;
     virtual SDO_API void append (const SDOString& d) = 0;
 

Modified: incubator/tuscany/cpp/sdo/runtime/core/src/commonj/sdo/DataObjectListImpl.cpp
URL: http://svn.apache.org/viewvc/incubator/tuscany/cpp/sdo/runtime/core/src/commonj/sdo/DataObjectListImpl.cpp?view=diff&rev=440722&r1=440721&r2=440722
==============================================================================
--- incubator/tuscany/cpp/sdo/runtime/core/src/commonj/sdo/DataObjectListImpl.cpp (original)
+++ incubator/tuscany/cpp/sdo/runtime/core/src/commonj/sdo/DataObjectListImpl.cpp Wed Sep  6 07:23:49 2006
@@ -624,6 +624,17 @@
     ((DataObjectImpl*)dob)->setCString(d);
     insert(index, dol);
 }
+void DataObjectListImpl::insert (unsigned int index, const SDOString& d)
+{
+    if (theFactory == 0) return;
+
+    if (typeUnset)setType(Type::SDOTypeNamespaceURI, BytesLiteral);
+
+    RefCountingPointer<DataObject> dol = theFactory->create(typeURI, typeName);
+    DataObject* dob = dol;
+    ((DataObjectImpl*)dob)->setCString(d);
+    insert(index, dol);
+}
 
 void DataObjectListImpl::append (const char* d)
 {
@@ -1058,6 +1069,17 @@
     ((DataObjectImpl*)dob)->setDate(d);
 }
 void DataObjectListImpl::setCString(unsigned int index, char* d) 
+{
+    validateIndex(index);
+    if (container != 0)
+    {
+        container->logChange(pindex);
+    }
+    RefCountingPointer<DataObject> dd = ((*this)[index]);
+    DataObject* dob = dd;
+    ((DataObjectImpl*)dob)->setCString(d);
+}
+void DataObjectListImpl::setCString(unsigned int index, const SDOString& d) 
 {
     validateIndex(index);
     if (container != 0)

Modified: incubator/tuscany/cpp/sdo/runtime/core/src/commonj/sdo/DataObjectListImpl.h
URL: http://svn.apache.org/viewvc/incubator/tuscany/cpp/sdo/runtime/core/src/commonj/sdo/DataObjectListImpl.h?view=diff&rev=440722&r1=440721&r2=440722
==============================================================================
--- incubator/tuscany/cpp/sdo/runtime/core/src/commonj/sdo/DataObjectListImpl.h (original)
+++ incubator/tuscany/cpp/sdo/runtime/core/src/commonj/sdo/DataObjectListImpl.h Wed Sep  6 07:23:49 2006
@@ -92,6 +92,7 @@
     virtual void setDouble(unsigned int index, long double d);
     virtual void setDate(unsigned int index, const SDODate d);
     virtual void setCString(unsigned int index, char* d);
+    virtual void setCString(unsigned int index, const SDOString& d);
     virtual void setDataObject(unsigned int index, DataObjectPtr dob);
 
     virtual unsigned int getLength(unsigned int index) const;
@@ -117,6 +118,7 @@
     virtual  void append (const char* d, unsigned int len) ;
 
     virtual  void insert (unsigned int index, const char* d) ;
+    virtual  void insert (unsigned int index, const SDOString& d) ;
     virtual  void append (const char* d) ;
     virtual  void append (const SDOString& d) ;
 

Modified: incubator/tuscany/cpp/sdo/runtime/core/src/commonj/sdo/PropertyDefinition.cpp
URL: http://svn.apache.org/viewvc/incubator/tuscany/cpp/sdo/runtime/core/src/commonj/sdo/PropertyDefinition.cpp?view=diff&rev=440722&r1=440721&r2=440722
==============================================================================
--- incubator/tuscany/cpp/sdo/runtime/core/src/commonj/sdo/PropertyDefinition.cpp (original)
+++ incubator/tuscany/cpp/sdo/runtime/core/src/commonj/sdo/PropertyDefinition.cpp Wed Sep  6 07:23:49 2006
@@ -65,6 +65,10 @@
          {
              propertydefinition->substituteName = name;
          }
+         void PropertyDefinition::setSubstituteName(const SDOString& name)
+         {
+             propertydefinition->substituteName = name.c_str();
+         }
 
          const char* PropertyDefinition::getSubstituteName() const
          {
@@ -76,6 +80,10 @@
          {
              propertydefinition->substituteUri = name;
          }
+         void PropertyDefinition::setSubstituteUri(const SDOString& name)
+         {
+             propertydefinition->substituteUri = name.c_str();
+         }
 
          const char* PropertyDefinition::getSubstituteUri() const
          {
@@ -83,11 +91,11 @@
          }
 
         // where there are substitute names for this property.
-         void PropertyDefinition::addSubstitute(const char* name,
-            const char* localname)
+         void PropertyDefinition::addSubstitute(const SDOString& name,
+            const SDOString& localname)
          {
-             propertydefinition->substituteNames.push_back(name);
-             propertydefinition->substituteLocalNames.push_back(localname);
+             propertydefinition->substituteNames.push_back(name.c_str());
+             propertydefinition->substituteLocalNames.push_back(localname.c_str());
          }
 
          int PropertyDefinition::getSubstituteCount() const
@@ -118,6 +126,10 @@
          {
              propertydefinition->aliases = aliases;
          }
+         void PropertyDefinition::setAliases(const SDOString& aliases)
+         {
+             propertydefinition->aliases = aliases.c_str();
+         }
 
          const char* PropertyDefinition::getAliases() const
          {
@@ -128,6 +140,10 @@
          {
              propertydefinition->name = name;
          }
+         void PropertyDefinition::setName(const SDOString& name)
+         {
+             propertydefinition->name = name.c_str();
+         }
 
          const char* PropertyDefinition::getName() const
          {
@@ -138,6 +154,10 @@
          {
              propertydefinition->localname = name;
          }
+         void PropertyDefinition::setLocalName(const SDOString& name)
+         {
+             propertydefinition->localname = name.c_str();
+         }
 
          const char* PropertyDefinition::getLocalName() const
          {
@@ -152,6 +172,14 @@
              propertydefinition->fullTypeName += "#";
              propertydefinition->fullTypeName += name;
          }
+         void PropertyDefinition::setType(const SDOString& uri, const SDOString& name)
+         {
+             propertydefinition->typeUri = uri.c_str();
+             propertydefinition->typeName = name.c_str();
+             propertydefinition->fullTypeName = uri.c_str();
+             propertydefinition->fullTypeName += "#";
+             propertydefinition->fullTypeName += name.c_str();
+         }
 
          const char * PropertyDefinition::getTypeName() const
          {
@@ -177,11 +205,19 @@
          {
              propertydefinition->fullLocalTypeName = name;
          }
+         void PropertyDefinition::setTypeFullLocalName(const SDOString& name)
+         {
+             propertydefinition->fullLocalTypeName = name.c_str();
+         }
 
 
          void PropertyDefinition::setDefaultValue(const char* value)
          {
              propertydefinition->defaultValue = value;
+         }
+         void PropertyDefinition::setDefaultValue(const SDOString& value)
+         {
+             propertydefinition->defaultValue = value.c_str();
          }
 
          const char* PropertyDefinition::getDefaultValue() const

Modified: incubator/tuscany/cpp/sdo/runtime/core/src/commonj/sdo/PropertyDefinition.h
URL: http://svn.apache.org/viewvc/incubator/tuscany/cpp/sdo/runtime/core/src/commonj/sdo/PropertyDefinition.h?view=diff&rev=440722&r1=440721&r2=440722
==============================================================================
--- incubator/tuscany/cpp/sdo/runtime/core/src/commonj/sdo/PropertyDefinition.h (original)
+++ incubator/tuscany/cpp/sdo/runtime/core/src/commonj/sdo/PropertyDefinition.h Wed Sep  6 07:23:49 2006
@@ -23,6 +23,7 @@
 #include "export.h"
 
 #include <vector>
+#include "commonj/sdo/SDOString.h"
 
 
 
@@ -57,37 +58,47 @@
                        
             // where this property is to be substituted for another
             /*SDO_API*/ void setSubstituteName(const char * name);
+            /*SDO_API*/ void setSubstituteName(const SDOString& name);
             /*SDO_API*/ const char* getSubstituteName() const;
 
             /*SDO_API*/ void setSubstituteUri(const char* name);
+            /*SDO_API*/ void setSubstituteUri(const SDOString& name);
             /*SDO_API*/ const char* getSubstituteUri() const;
 
             // where there are substitute names for this property.
             /*SDO_API*/ void addSubstitute(const char* name,
                 const char* localname);
+            /*SDO_API*/ void addSubstitute(const SDOString& name,
+                const SDOString& localname);
             /*SDO_API*/ int getSubstituteCount() const;
             /*SDO_API*/ const char* getSubstituteNames(int index) const;
             /*SDO_API*/ const char* getSubstituteLocalNames(int index) const;
 
             
             /*SDO_API*/ void setAliases(const char* aliases);
+            /*SDO_API*/ void setAliases(const SDOString& aliases);
             /*SDO_API*/ const char* getAliases() const;
 
             /*SDO_API*/ void setName(const char* name);
+            /*SDO_API*/ void setName(const SDOString& name);
             /*SDO_API*/ const char* getName() const;
             
             /*SDO_API*/ void setLocalName(const char* name);
+            /*SDO_API*/ void setLocalName(const SDOString& name);
             /*SDO_API*/ const char* getLocalName() const;
-            
+
             /*SDO_API*/ void setType(const char* uri, const char* name);
+            /*SDO_API*/ void setType(const SDOString& uri, const SDOString& name);
             /*SDO_API*/ const char * getTypeName() const;
             /*SDO_API*/ const char * getTypeUri() const;
             /*SDO_API*/ const char * getTypeFullName() const;
             /*SDO_API*/ const char * getTypeFullLocalName() const ;
             
             /*SDO_API*/ void setTypeFullLocalName(const char* name);
+            /*SDO_API*/ void setTypeFullLocalName(const SDOString& name);
 
             /*SDO_API*/ void setDefaultValue(const char* value);
+            /*SDO_API*/ void setDefaultValue(const SDOString& value);
             /*SDO_API*/ const char* getDefaultValue() const;
 
             /*SDO_API*/ bool getIsMany() const;

Modified: incubator/tuscany/cpp/sdo/runtime/core/src/commonj/sdo/TypeDefinition.cpp
URL: http://svn.apache.org/viewvc/incubator/tuscany/cpp/sdo/runtime/core/src/commonj/sdo/TypeDefinition.cpp?view=diff&rev=440722&r1=440721&r2=440722
==============================================================================
--- incubator/tuscany/cpp/sdo/runtime/core/src/commonj/sdo/TypeDefinition.cpp (original)
+++ incubator/tuscany/cpp/sdo/runtime/core/src/commonj/sdo/TypeDefinition.cpp Wed Sep  6 07:23:49 2006
@@ -62,6 +62,10 @@
         {
             typedefinition->uri = inuri;
         }
+        void TypeDefinition::setUri(const SDOString& inuri) 
+        {
+            typedefinition->uri = inuri.c_str();
+        }
 
         const char * TypeDefinition::getUri() const
         {
@@ -73,6 +77,10 @@
         {
             typedefinition->name = inname;
         }
+        void TypeDefinition::setName(const SDOString& inname)
+        {
+            typedefinition->name = inname.c_str();
+        }
 
         const char * TypeDefinition::getName() const
         {
@@ -84,6 +92,10 @@
         {
             typedefinition->localname = inname;
         }
+        void TypeDefinition::setLocalName(const SDOString& inname) 
+        {
+            typedefinition->localname = inname.c_str();
+        }
 
         const char * TypeDefinition::getLocalName() const
         {
@@ -95,6 +107,10 @@
         {
             typedefinition->aliases = inaliases;
         }
+        void TypeDefinition::setAliases(const SDOString& inaliases)
+        {
+            typedefinition->aliases = inaliases.c_str();
+        }
         
         const char * TypeDefinition::getAliases() const
         {
@@ -108,6 +124,14 @@
             typedefinition->parentTypeName = name;
             typedefinition->isRestriction = isrestriction;
         }
+        void TypeDefinition::setParentType(const SDOString& uri,
+                                           const SDOString& name,
+                                           bool isrestriction)
+        {
+            typedefinition->parentTypeUri = uri.c_str();
+            typedefinition->parentTypeName = name.c_str();
+            typedefinition->isRestriction = isrestriction;
+        }
 
         const char * TypeDefinition::getParentTypeUri() const
         {
@@ -122,6 +146,10 @@
         void TypeDefinition::setIDPropertyName(const char * idpropname)
         {
             typedefinition->IDPropertyName = idpropname;
+        }
+        void TypeDefinition::setIDPropertyName(const SDOString& idpropname)
+        {
+            typedefinition->IDPropertyName = idpropname.c_str();
         }
         
         const char * TypeDefinition::getIDPropertyName() const

Modified: incubator/tuscany/cpp/sdo/runtime/core/src/commonj/sdo/TypeDefinition.h
URL: http://svn.apache.org/viewvc/incubator/tuscany/cpp/sdo/runtime/core/src/commonj/sdo/TypeDefinition.h?view=diff&rev=440722&r1=440721&r2=440722
==============================================================================
--- incubator/tuscany/cpp/sdo/runtime/core/src/commonj/sdo/TypeDefinition.h (original)
+++ incubator/tuscany/cpp/sdo/runtime/core/src/commonj/sdo/TypeDefinition.h Wed Sep  6 07:23:49 2006
@@ -24,6 +24,7 @@
 
 
 #include "commonj/sdo/PropertyDefinition.h"
+#include "commonj/sdo/SDOString.h"
 #include "list"
 
 
@@ -55,24 +56,33 @@
             TypeDefinitionImpl* getTypeDefinition();       
         
             /*SDO_API*/ void setUri(const char * inuri) ;
+            /*SDO_API*/ void setUri(const SDOString& inuri) ;
+
             /*SDO_API*/ const char * getUri() const;
 
             /*SDO_API*/ void setName(const char * inname) ;
+            /*SDO_API*/ void setName(const SDOString& inname) ;
             /*SDO_API*/ const char * getName() const;
 
             /*SDO_API*/ void setLocalName(const char * inname) ;
+            /*SDO_API*/ void setLocalName(const SDOString& inname) ;
             /*SDO_API*/ const char * getLocalName() const;
 
             /*SDO_API*/ void setAliases(const char * inaliases) ;
+            /*SDO_API*/ void setAliases(const SDOString& inaliases) ;
             /*SDO_API*/ const char * getAliases() const;
 
-      
+
             /*SDO_API*/ void setParentType(const char* uri, const char* name,
                 bool isrestriction);
+            /*SDO_API*/ void setParentType(const SDOString& uri,
+                                           const SDOString& name,
+                                           bool isrestriction);
             /*SDO_API*/ const char * getParentTypeUri() const;
             /*SDO_API*/ const char * getParentTypeName() const;
 
             /*SDO_API*/ void setIDPropertyName(const char * idpropname) ;
+            /*SDO_API*/ void setIDPropertyName(const SDOString& idpropname) ;
             /*SDO_API*/ const char * getIDPropertyName() const;
 
 

Modified: incubator/tuscany/cpp/sdo/runtime/core/src/commonj/sdo/XMLDocument.h
URL: http://svn.apache.org/viewvc/incubator/tuscany/cpp/sdo/runtime/core/src/commonj/sdo/XMLDocument.h?view=diff&rev=440722&r1=440721&r2=440722
==============================================================================
--- incubator/tuscany/cpp/sdo/runtime/core/src/commonj/sdo/XMLDocument.h (original)
+++ incubator/tuscany/cpp/sdo/runtime/core/src/commonj/sdo/XMLDocument.h Wed Sep  6 07:23:49 2006
@@ -86,6 +86,7 @@
          * This sets the encoding to save this data to XML.
          */
             SDO_API virtual void setEncoding(const char* encoding) = 0;
+            SDO_API virtual void setEncoding(const SDOString& encoding) = 0;
 
         /**  getXMLDeclaration
          *
@@ -110,6 +111,7 @@
          * NOT IMPLEMENTED
          */
             SDO_API virtual void setXMLVersion(const char* xmlVersion) = 0;
+            SDO_API virtual void setXMLVersion(const SDOString& xmlVersion) = 0;
 
         /**  getSchemaLocation- return the schema location
          *
@@ -122,6 +124,7 @@
          * Sets the XML Schema location.
          */
             SDO_API virtual void setSchemaLocation(const char* schemaLocation) = 0;
+            SDO_API virtual void setSchemaLocation(const SDOString& schemaLocation) = 0;
 
         /**  getNoNamespaceSchemaLocation
          *
@@ -134,6 +137,7 @@
          * Sets the nonamespace schema location
          */
             SDO_API virtual void setNoNamespaceSchemaLocation(const char* noNamespaceSchemaLocation) = 0;        
+            SDO_API virtual void setNoNamespaceSchemaLocation(const SDOString& noNamespaceSchemaLocation) = 0;        
             
             SDO_API friend std::istream& operator>>(std::istream& input, XMLDocument& doc);
             

Modified: incubator/tuscany/cpp/sdo/runtime/core/src/commonj/sdo/XMLDocumentImpl.cpp
URL: http://svn.apache.org/viewvc/incubator/tuscany/cpp/sdo/runtime/core/src/commonj/sdo/XMLDocumentImpl.cpp?view=diff&rev=440722&r1=440721&r2=440722
==============================================================================
--- incubator/tuscany/cpp/sdo/runtime/core/src/commonj/sdo/XMLDocumentImpl.cpp (original)
+++ incubator/tuscany/cpp/sdo/runtime/core/src/commonj/sdo/XMLDocumentImpl.cpp Wed Sep  6 07:23:49 2006
@@ -44,6 +44,10 @@
         {
             encoding = enc;
         }
+        void XMLDocumentImpl::setEncoding(const SDOString& enc)
+        {
+            encoding = enc.c_str();
+        }
         
         void XMLDocumentImpl::setXMLDeclaration(bool xmlDecl)
         {
@@ -54,15 +58,27 @@
         {
             xmlVersion = xmlVer;
         }
+        void XMLDocumentImpl::setXMLVersion(const SDOString& xmlVer)
+        {
+            xmlVersion = xmlVer.c_str();
+        }
         
         void XMLDocumentImpl::setSchemaLocation(const char* schemaLoc)
         {
             schemaLocation = schemaLoc;
         }
+        void XMLDocumentImpl::setSchemaLocation(const SDOString& schemaLoc)
+        {
+            schemaLocation = schemaLoc.c_str();
+        }
         
         void XMLDocumentImpl::setNoNamespaceSchemaLocation(const char* noNamespaceSchemaLoc)
         {
             noNamespaceSchemaLocation = noNamespaceSchemaLoc;
+        }
+        void XMLDocumentImpl::setNoNamespaceSchemaLocation(const SDOString& noNamespaceSchemaLoc)
+        {
+            noNamespaceSchemaLocation = noNamespaceSchemaLoc.c_str();
         }
         
     } // End - namespace sdo

Modified: incubator/tuscany/cpp/sdo/runtime/core/src/commonj/sdo/XMLDocumentImpl.h
URL: http://svn.apache.org/viewvc/incubator/tuscany/cpp/sdo/runtime/core/src/commonj/sdo/XMLDocumentImpl.h?view=diff&rev=440722&r1=440721&r2=440722
==============================================================================
--- incubator/tuscany/cpp/sdo/runtime/core/src/commonj/sdo/XMLDocumentImpl.h (original)
+++ incubator/tuscany/cpp/sdo/runtime/core/src/commonj/sdo/XMLDocumentImpl.h Wed Sep  6 07:23:49 2006
@@ -62,18 +62,22 @@
 			virtual const char* getRootElementName() const {return rootElementName;}
             virtual const char* getEncoding() const {return encoding;}
             virtual void setEncoding(const char* enc);
+            virtual void setEncoding(const SDOString& enc);
 
             virtual bool getXMLDeclaration() const {return xmlDeclaration;}
             virtual void setXMLDeclaration(bool xmlDecl);
 
             virtual const char* getXMLVersion() const {return xmlVersion;}
             virtual void setXMLVersion(const char* xmlVer);
+            virtual void setXMLVersion(const SDOString& xmlVer);
 
             virtual const char* getSchemaLocation() const {return schemaLocation;}
             virtual void setSchemaLocation(const char* schemaLoc);
+            virtual void setSchemaLocation(const SDOString& schemaLoc);
 
             virtual const char* getNoNamespaceSchemaLocation() const { return noNamespaceSchemaLocation;}
             virtual void setNoNamespaceSchemaLocation(const char* noNamespaceSchemaLoc);
+            virtual void setNoNamespaceSchemaLocation(const SDOString& noNamespaceSchemaLoc);
             
             
             friend std::istream& operator>>(std::istream& input, XMLDocumentImpl& doc);

Modified: incubator/tuscany/cpp/sdo/runtime/core/src/commonj/sdo/XMLHelper.h
URL: http://svn.apache.org/viewvc/incubator/tuscany/cpp/sdo/runtime/core/src/commonj/sdo/XMLHelper.h?view=diff&rev=440722&r1=440721&r2=440722
==============================================================================
--- incubator/tuscany/cpp/sdo/runtime/core/src/commonj/sdo/XMLHelper.h (original)
+++ incubator/tuscany/cpp/sdo/runtime/core/src/commonj/sdo/XMLHelper.h Wed Sep  6 07:23:49 2006
@@ -48,32 +48,56 @@
            SDO_API virtual XMLDocumentPtr createDocument(
                const char* elementname = 0,
                const char* rootElementURI=0) = 0;
+           SDO_API virtual XMLDocumentPtr createDocument(
+               const SDOString& elementname,
+               const SDOString& rootElementURI) = 0;
 
            SDO_API virtual XMLDocumentPtr loadFile(
                 const char* xmlFile,
                 const char* targetNamespaceURI=0) = 0;
+           SDO_API virtual XMLDocumentPtr loadFile(
+                const SDOString& xmlFile,
+                const SDOString& targetNamespaceURI = SDOString::SDONullString) = 0;
+
             SDO_API virtual XMLDocumentPtr load(
                 std::istream& inXml,
                 const char* targetNamespaceURI=0) = 0;
             SDO_API virtual XMLDocumentPtr load(
+                std::istream& inXml,
+                const SDOString& targetNamespaceURI = SDOString::SDONullString) = 0;
+
+            SDO_API virtual XMLDocumentPtr load(
                 const char* inXml,
                 const char* targetNamespaceURI=0) = 0;
+            SDO_API virtual XMLDocumentPtr load(
+                const SDOString& inXml,
+                const SDOString& targetNamespaceURI = SDOString::SDONullString) = 0;
             
             /**  save saves the graph to XML
              *
              * save - Serializes the datagraph to the XML file
              */
 
-            SDO_API virtual void    save(XMLDocumentPtr doc, const char* xmlFile,
-                int indent = -1) = 0;                
+              SDO_API virtual void save(XMLDocumentPtr doc, 
+                                        const char* xmlFile,
+                                        int indent = -1) = 0;
+              SDO_API virtual void save(XMLDocumentPtr doc,
+                                        const SDOString& xmlFile,
+                                        int indent = -1) = 0;
+
             SDO_API virtual void save(
                 DataObjectPtr dataObject,
                 const char* rootElementURI,
                 const char* rootElementName,
                 const char* xmlFile,
                 int indent = -1) = 0;
-            
-            
+            SDO_API virtual void save(
+                DataObjectPtr dataObject,
+                const SDOString& rootElementURI,
+                const SDOString& rootElementName,
+                const SDOString& xmlFile,
+                int indent = -1) = 0;
+
             /**  save saves the graph to XML
              *
              * save - Serializes the datagraph to the XML stream
@@ -81,12 +105,19 @@
 
             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,
                 int indent = -1) = 0;
+            SDO_API virtual void save(
+                DataObjectPtr dataObject,
+                const SDOString& rootElementURI,
+                const SDOString& rootElementName,
+                std::ostream& outXml,
+                int indent = -1) = 0;
             
             /**  save saves the graph to XML
              *
@@ -99,6 +130,11 @@
                 const char* rootElementURI,
                 const char* rootElementName,
                 int indent = -1) = 0;
+            SDO_API virtual char* save(
+                DataObjectPtr dataObject,
+                const SDOString& rootElementURI,
+                const SDOString& rootElementName,
+                int indent = -1) = 0;
             
             /**  createDocument creates an XMLDocument
              *
@@ -111,6 +147,10 @@
                 DataObjectPtr dataObject,
                 const char* rootElementURI,
                 const char* rootElementName) = 0;
+            SDO_API virtual XMLDocumentPtr createDocument(
+                DataObjectPtr dataObject,
+                const SDOString& rootElementURI,
+                const SDOString& rootElementName) = 0;
             
             /***********************************/
             /* Destructor */

Modified: incubator/tuscany/cpp/sdo/runtime/core/src/commonj/sdo/XMLHelperImpl.cpp
URL: http://svn.apache.org/viewvc/incubator/tuscany/cpp/sdo/runtime/core/src/commonj/sdo/XMLHelperImpl.cpp?view=diff&rev=440722&r1=440721&r2=440722
==============================================================================
--- incubator/tuscany/cpp/sdo/runtime/core/src/commonj/sdo/XMLHelperImpl.cpp (original)
+++ incubator/tuscany/cpp/sdo/runtime/core/src/commonj/sdo/XMLHelperImpl.cpp Wed Sep  6 07:23:49 2006
@@ -98,75 +98,176 @@
         }
 
 
-        const TypeImpl* XMLHelperImpl::findRoot(DataFactory* df,
-			                                        const char* rootElementURI)
-		{
-            if (rootElementURI  != 0)
-            {
-                return ((DataFactoryImpl*)df)->findTypeImpl
-                    (rootElementURI, "RootType");
-            }
+//       const TypeImpl* XMLHelperImpl::findRoot(DataFactory* df,
+//                                               const char* rootElementURI)
+//       {
+//         if (rootElementURI != 0)
+//           {
+//             return ((DataFactoryImpl*)df)->findTypeImpl
+//               (rootElementURI, "RootType");
+//           }
 
-			const TypeList& tl = df->getTypes();
-            for (int i=0;i<tl.size();i++)
-            {
-                if (!strcmp("RootType",tl[i].getName()))
-                {
-                    return ((DataFactoryImpl*)df)->findTypeImpl
-                            (tl[i].getURI(), "RootType");
-                }
-            }
-			return 0;
-		}
+//         const TypeList& tl = df->getTypes();
+//         for (int i=0;i<tl.size();i++)
+//           {
+//             if (!strcmp("RootType",tl[i].getName()))
+//               {
+//                 return ((DataFactoryImpl*)df)->findTypeImpl(tl[i].getURI(), "RootType");
+//               }
+//           }
+
+//         return 0;
+
+//       }
+      const TypeImpl* XMLHelperImpl::findRoot(DataFactory* df,
+                                                  const SDOString& rootElementURI)
+      {
+
+        const TypeImpl* rootTypePtr = ((DataFactoryImpl*)df)->findTypeImpl(rootElementURI.c_str(),
+                                                                           "RootType");
+
+        if (rootTypePtr != 0)
+        {
+           return rootTypePtr;
+        }
+
+        const TypeList& tl = df->getTypes();
+        for (int i = 0; i < tl.size(); i++)
+        {
+           if (!strcmp("RootType", tl[i].getName()))
+           {
+              return ((DataFactoryImpl*)df)->findTypeImpl(tl[i].getURI(), "RootType");
+           }
+        }
+        return 0;
+      }
 
         XMLDocumentPtr XMLHelperImpl::createDocument(const char* elementname,
                                                      const char* rootElementURI)
         {
-            DataFactory* dp = (DataFactory*)getDataFactory();
-            if (dp == 0) return 0;
+           if (rootElementURI == 0)
+           {
+              if (elementname == 0)
+              {
+                 return createDocument(SDOString::SDONullString, SDOString::SDONullString);
+              }
+              else
+              {
+                 return createDocument(SDOString(elementname), SDOString::SDONullString);
+              }
+           }
+           else
+           {
+              if (elementname == 0)
+              {
+                 return createDocument(SDOString::SDONullString, SDOString(rootElementURI));
+              }
+              else
+              {
+                 return createDocument(SDOString(elementname), SDOString(rootElementURI));
+              }
+           }
+        }
+
+//         XMLDocumentPtr XMLHelperImpl::createDocument(const char* elementname,
+//                                                      const char* rootElementURI)
+//         {
+//             DataFactory* dp = (DataFactory*)getDataFactory();
+//             if (dp == 0) return 0;
+
+//             const TypeImpl* rType = findRoot(dp,rootElementURI);
+//             if (rType == 0)
+//             {
+// 				std::string msg("createDocument - cannot find element ");
+//                 if (elementname != 0) msg += elementname;
+//                 SDO_THROW_EXCEPTION("createDocument", SDOUnsupportedOperationException,
+//                 msg.c_str());
+// 			}
+
+//             if ((elementname != 0) && (strlen(elementname) != 0))
+//             {
+//                 PropertyImpl* pl = rType->getPropertyImpl(elementname);
+//                 if (pl == 0)
+//                 {
+//                      std::string msg("createDocument - cannot find element ");
+//                      msg += elementname;
+//                      SDO_THROW_EXCEPTION("createDocument", SDOUnsupportedOperationException,
+//                      msg.c_str());
+// 				}
+
+//                 const Type& tp = pl->getType();
+//                 DataObjectPtr dob = dp->create(tp);
+//                 return new XMLDocumentImpl(dob,
+//                      tp.getURI(), /*tp.getName()*/ elementname);
+//             }
+//             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());
+//             }
+
+// 			std::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());
+//         }
+
+      // +++
+
+       XMLDocumentPtr XMLHelperImpl::createDocument(const SDOString& elementname,
+                                                    const SDOString& rootElementURI)
+       {
+          DataFactory* dp = (DataFactory*)getDataFactory();
+          if (dp == 0) return 0;
 
-			const TypeImpl* rType = findRoot(dp,rootElementURI);
-            if (rType == 0)
-            {
-				std::string msg("createDocument - cannot find element ");
-                if (elementname != 0) msg += elementname;
+          const TypeImpl* rType = findRoot(dp, rootElementURI);
+          if (rType == 0)
+          {
+             std::string msg("createDocument - cannot find element ");
+             msg += elementname;
+             SDO_THROW_EXCEPTION("createDocument", SDOUnsupportedOperationException,
+                                 msg.c_str());
+          }
+
+          if (elementname.length() != 0)
+          {
+             PropertyImpl* pl = rType->getPropertyImpl(elementname);
+             if (pl == 0)
+             {
+                std::string msg("createDocument - cannot find element ");
+                msg += elementname;
                 SDO_THROW_EXCEPTION("createDocument", SDOUnsupportedOperationException,
-                msg.c_str());
-			}
+                                    msg.c_str());
+             }
 
-            if ((elementname != 0) && (strlen(elementname) != 0))
-            {
-                PropertyImpl* pl = rType->getPropertyImpl(elementname);
-                if (pl == 0)
-                {
-                     std::string msg("createDocument - cannot find element ");
-                     msg += elementname;
-                     SDO_THROW_EXCEPTION("createDocument", SDOUnsupportedOperationException,
-                     msg.c_str());
-				}
-
-                const Type& tp = pl->getType();
-                DataObjectPtr dob = dp->create(tp);
-                return new XMLDocumentImpl(dob,
-                     tp.getURI(), /*tp.getName()*/ elementname);
-            }
-            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());
-            }
+             const Type& tp = pl->getType();
+             DataObjectPtr dob = dp->create(tp);
+             return new XMLDocumentImpl(dob,
+                                        tp.getURI(), /*tp.getName()*/ 
+                                        elementname.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());
+          }
 
-			std::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());
-        }
+          std::string msg("createDocument - unable to find root type in namespace ");
+             msg += " NULL";
+          SDO_THROW_EXCEPTION("createDocument", SDOUnsupportedOperationException,
+                              msg.c_str());
+       }
+
+      // ---
 
         XMLDocumentPtr XMLHelperImpl::createDocument(
             DataObjectPtr dataObject,
@@ -175,6 +276,13 @@
         {
             return new XMLDocumentImpl(dataObject, rootElementURI, rootElementName);
         }
+        XMLDocumentPtr XMLHelperImpl::createDocument(
+            DataObjectPtr dataObject,
+            const SDOString& rootElementURI,
+            const SDOString& rootElementName)
+        {
+            return new XMLDocumentImpl(dataObject, rootElementURI.c_str(), rootElementName.c_str());
+        }
         
         XMLDocumentPtr XMLHelperImpl::loadFile(
             const char* xmlFile,
@@ -190,6 +298,22 @@
             }
             return 0;
         }
+        XMLDocumentPtr XMLHelperImpl::loadFile(
+            const SDOString& xmlFile,
+            const SDOString& targetNamespaceURI)
+        {
+            DataObjectPtr rootDataObject;
+            clearErrors();
+            SDOSAX2Parser sdoParser(getDataFactory(),
+                                    targetNamespaceURI.c_str(),
+                                    rootDataObject,
+                                    this);
+            if (sdoParser.parse(xmlFile.c_str()) == 0)
+            {                
+                return createDocument(rootDataObject);
+            }
+            return 0;
+        }
 
         
         XMLDocumentPtr XMLHelperImpl::load(
@@ -203,6 +327,19 @@
             inXml>>sdoParser;
             return createDocument(rootDataObject);
         }
+        XMLDocumentPtr XMLHelperImpl::load(
+            std::istream& inXml,
+            const SDOString& targetNamespaceURI)
+        {
+            DataObjectPtr rootDataObject;
+            SDOSAX2Parser sdoParser(getDataFactory(),
+                                    targetNamespaceURI.c_str(),
+                                    rootDataObject,
+                                    this);
+            clearErrors();
+            inXml>>sdoParser;
+            return createDocument(rootDataObject);
+        }
         
         XMLDocumentPtr XMLHelperImpl::load(
             const char* inXml,
@@ -211,12 +348,24 @@
             std::istringstream str(inXml);
             return load(str, targetNamespaceURI);
         }
-        
+        XMLDocumentPtr XMLHelperImpl::load(
+            const SDOString& inXml,
+            const SDOString& targetNamespaceURI)
+        {
+            std::istringstream str(inXml);
+            return load(str, targetNamespaceURI);
+        }
+
         void XMLHelperImpl::save(XMLDocumentPtr doc, const char* xmlFile, int indent)
         {
             SDOXMLFileWriter writer(xmlFile, dataFactory);
             writer.write(doc, indent);
         }
+        void XMLHelperImpl::save(XMLDocumentPtr doc, const SDOString& xmlFile, int indent)
+        {
+            SDOXMLFileWriter writer(xmlFile.c_str(), dataFactory);
+            writer.write(doc, indent);
+        }
         
         void XMLHelperImpl::save(
             DataObjectPtr dataObject,
@@ -228,6 +377,16 @@
             save(createDocument(dataObject,rootElementURI, rootElementName), xmlFile,
                 indent);
         }
+        void XMLHelperImpl::save(
+            DataObjectPtr dataObject,
+            const SDOString& rootElementURI,
+            const SDOString& rootElementName,
+            const SDOString& xmlFile,
+            int indent)
+        {
+            save(createDocument(dataObject,rootElementURI, rootElementName), xmlFile,
+                indent);
+        }
         
         
         // Serializes the datagraph to a stream
@@ -237,6 +396,7 @@
             SDOXMLStreamWriter writer(outXml, dataFactory);
             writer.write(doc, indent);                
         }
+
         void XMLHelperImpl::save(
             DataObjectPtr dataObject,
             const char* rootElementURI,
@@ -246,6 +406,15 @@
         {
             save(createDocument(dataObject,rootElementURI, rootElementName), outXml, indent);
         }
+        void XMLHelperImpl::save(
+            DataObjectPtr dataObject,
+            const SDOString& rootElementURI,
+            const SDOString& rootElementName,
+            std::ostream& outXml,
+            int indent )
+        {
+            save(createDocument(dataObject,rootElementURI, rootElementName), outXml, indent);
+        }
         
         // Serializes the datagraph to a std::string
         char* XMLHelperImpl::save(XMLDocumentPtr doc,
@@ -262,6 +431,15 @@
             DataObjectPtr dataObject,
             const char* rootElementURI,
             const char* rootElementName,
+            int indent)
+        {
+            return save(createDocument(dataObject,rootElementURI, rootElementName),
+                indent);
+        }
+        char* XMLHelperImpl::save(
+            DataObjectPtr dataObject,
+            const SDOString& rootElementURI,
+            const SDOString& rootElementName,
             int indent)
         {
             return save(createDocument(dataObject,rootElementURI, rootElementName),

Modified: incubator/tuscany/cpp/sdo/runtime/core/src/commonj/sdo/XMLHelperImpl.h
URL: http://svn.apache.org/viewvc/incubator/tuscany/cpp/sdo/runtime/core/src/commonj/sdo/XMLHelperImpl.h?view=diff&rev=440722&r1=440721&r2=440722
==============================================================================
--- incubator/tuscany/cpp/sdo/runtime/core/src/commonj/sdo/XMLHelperImpl.h (original)
+++ incubator/tuscany/cpp/sdo/runtime/core/src/commonj/sdo/XMLHelperImpl.h Wed Sep  6 07:23:49 2006
@@ -67,32 +67,62 @@
                const char* elementname= 0,
                const char* rootElementURI=0);
 
+           virtual XMLDocumentPtr createDocument(
+               const SDOString& elementname,
+               const SDOString& rootElementURI);
+
            virtual XMLDocumentPtr loadFile(
                 const char* xmlFile,
                 const char* targetNamespaceURI = 0);
+           virtual XMLDocumentPtr loadFile(
+                const SDOString& xmlFile,
+                const SDOString& targetNamespaceURI = SDOString::SDONullString);
+
             virtual XMLDocumentPtr load(
                 std::istream& inXml,
                 const char* targetNamespaceURI = 0);
             virtual XMLDocumentPtr load(
+                std::istream& inXml,
+                const SDOString& targetNamespaceURI = SDOString::SDONullString);
+
+            virtual XMLDocumentPtr load(
                 const char* inXml,
                 const char* targetNamespaceURI = 0);
-            
+            virtual XMLDocumentPtr load(
+                const SDOString& inXml,
+                const SDOString& targetNamespaceURI = SDOString::SDONullString);
+
             virtual XMLDocumentPtr createDocument(
                 DataObjectPtr dataObject,
                 const char* rootElementURI,
                 const char* rootElementName);
+            virtual XMLDocumentPtr createDocument(
+                DataObjectPtr dataObject,
+                const SDOString& rootElementURI,
+                const SDOString& rootElementName);
 
             /**  save saves the graph to XML
              *
              * save - Serializes the datagraph to the XML file
              */
 
-            void save(XMLDocumentPtr doc, const char* xmlFile, int indent = -1);
+            void save(XMLDocumentPtr doc,
+                      const char* xmlFile,
+                      int indent = -1);
+            void save(XMLDocumentPtr doc,
+                      const SDOString& xmlFile,
+                      int indent = -1);
+
             void save(
                 DataObjectPtr dataObject,
                 const char* rootElementURI,
                 const char* rootElementName,
                 const char* xmlFile, int indent = -1);
+            void save(
+                DataObjectPtr dataObject,
+                const SDOString& rootElementURI,
+                const SDOString& rootElementName,
+                const SDOString& xmlFile, int indent = -1);
 
             /**  save saves the graph to XML
              *
@@ -107,6 +137,12 @@
                 const char* rootElementName,
                 std::ostream& outXml,
                 int indent = -1);
+            void save(
+                DataObjectPtr dataObject,
+                const SDOString& rootElementURI,
+                const SDOString& rootElementName,
+                std::ostream& outXml,
+                int indent = -1);
 
             /**  save saves the graph to XML
              *
@@ -118,6 +154,11 @@
                 const char* rootElementURI,
                 const char* rootElementName,
                 int indent = -1);
+            char* save(
+                DataObjectPtr dataObject,
+                const SDOString& rootElementURI,
+                const SDOString& rootElementName,
+                int indent = -1);
                             
         private:
             int     parse(const char* source);
@@ -131,8 +172,10 @@
 
             XMLDocumentPtr createDocument(DataObjectPtr dataObject);
 
-            const TypeImpl* findRoot(DataFactory* df,
-			                                        const char* rootElementURI);
+//               const TypeImpl* findRoot(DataFactory* df,
+//                                         const char* rootElementURI);
+              const TypeImpl* findRoot(DataFactory* df,
+                                           const SDOString& rootElementURI);
 
             DataFactoryPtr getDataFactory();
         };

Modified: incubator/tuscany/cpp/sdo/runtime/core/src/commonj/sdo/XSDHelper.h
URL: http://svn.apache.org/viewvc/incubator/tuscany/cpp/sdo/runtime/core/src/commonj/sdo/XSDHelper.h?view=diff&rev=440722&r1=440721&r2=440722
==============================================================================
--- incubator/tuscany/cpp/sdo/runtime/core/src/commonj/sdo/XSDHelper.h (original)
+++ incubator/tuscany/cpp/sdo/runtime/core/src/commonj/sdo/XSDHelper.h Wed Sep  6 07:23:49 2006
@@ -52,9 +52,10 @@
              */
 
             SDO_API virtual const char* defineFile(const char* schemaFile, bool loadImportNamespace = false) = 0;
+            SDO_API virtual const char* defineFile(const SDOString& schemaFile, bool loadImportNamespace = false) = 0;
             SDO_API virtual const char* define(std::istream& schema, bool loadImportNamespace = false) = 0;
             SDO_API virtual const char* define(const char* schema, bool loadImportNamespace = false) = 0;
-            
+            SDO_API virtual const char* define(const SDOString& schema, bool loadImportNamespace = false) = 0;
 
             /**  generate buildsXSD from types/properties
              *
@@ -68,15 +69,29 @@
                 const TypeList& types,
                 const char* targetNamespaceURI = "",
                 int indent = -1) = 0;
+            SDO_API virtual char* generate(
+                const TypeList& types,
+                const SDOString& targetNamespaceURI = SDOString::SDONullString,
+                int indent = -1) = 0;
             SDO_API virtual void generate(
                 const TypeList& types,
                 std::ostream& outXsd,
                 const char* targetNamespaceURI = "",
                 int indent = -1) = 0;
+            SDO_API virtual void generate(
+                const TypeList& types,
+                std::ostream& outXsd,
+                const SDOString& targetNamespaceURI = SDOString::SDONullString,
+                int indent = -1) = 0;
             SDO_API virtual void generateFile(
                 const TypeList& types,
                 const char* fileName,
                 const char* targetNamespaceURI = "",
+                int indent = -1) = 0;
+            SDO_API virtual void generateFile(
+                const TypeList& types,
+                const SDOString& fileName,
+                const SDOString& targetNamespaceURI = SDOString::SDONullString,
                 int indent = -1) = 0;
 
             /***********************************/

Modified: incubator/tuscany/cpp/sdo/runtime/core/src/commonj/sdo/XSDHelperImpl.cpp
URL: http://svn.apache.org/viewvc/incubator/tuscany/cpp/sdo/runtime/core/src/commonj/sdo/XSDHelperImpl.cpp?view=diff&rev=440722&r1=440721&r2=440722
==============================================================================
--- incubator/tuscany/cpp/sdo/runtime/core/src/commonj/sdo/XSDHelperImpl.cpp (original)
+++ incubator/tuscany/cpp/sdo/runtime/core/src/commonj/sdo/XSDHelperImpl.cpp Wed Sep  6 07:23:49 2006
@@ -87,6 +87,18 @@
             }
             return 0;
         }
+        const char* XSDHelperImpl::defineFile(const SDOString& schema, bool loadImportNamespace)
+        {
+
+            SDOSchemaSAX2Parser schemaParser(schemaInfo, this, loadImportNamespace);
+            clearErrors();
+            if (schemaParser.parse(schema.c_str()) == 0)
+            {
+                defineTypes(schemaParser.getTypeDefinitions());
+                return schemaInfo.getTargetNamespaceURI();
+            }
+            return 0;
+        }
         
         const char*  XSDHelperImpl::define(std::istream& schema, bool loadImportNamespace)
         {
@@ -107,6 +119,16 @@
             return schemaInfo.getTargetNamespaceURI();
             return define(str);
         }
+        const char*  XSDHelperImpl::define(const SDOString& schema, bool loadImportNamespace)
+        {
+            std::istringstream str(schema);
+            SDOSchemaSAX2Parser schemaParser(schemaInfo, this, loadImportNamespace);
+            clearErrors();
+            str  >> schemaParser;
+            defineTypes(schemaParser.getTypeDefinitions());
+            return schemaInfo.getTargetNamespaceURI();
+            return define(str);
+        }
         
         void XSDHelperImpl::newSubstitute(const char* entryName,
                                           PropertyDefinitionImpl& prop)
@@ -518,6 +540,18 @@
             writer.write(types, targetNamespaceURI, 
                 ((DataFactoryImpl*)fac)->getOpenProperties(), indent);
         }
+        void XSDHelperImpl::generateFile(
+            const TypeList& types,
+            const SDOString& fileName, 
+            const SDOString& targetNamespaceURI,
+            int indent
+            )
+        {
+            SDOXSDFileWriter writer(fileName.c_str());
+            DataFactory* fac = dataFactory;
+            writer.write(types, targetNamespaceURI.c_str(), 
+                ((DataFactoryImpl*)fac)->getOpenProperties(), indent);
+        }
         
         void XSDHelperImpl::generate(
             const TypeList& types,
@@ -531,6 +565,18 @@
             writer.write(types,    targetNamespaceURI, 
                 ((DataFactoryImpl*)fac)->getOpenProperties(), indent);                
         }
+        void XSDHelperImpl::generate(
+            const TypeList& types,
+            std::ostream& outXml,
+            const SDOString& targetNamespaceURI,
+            int indent
+            )
+        {
+            SDOXSDStreamWriter writer(outXml);
+            DataFactory* fac = dataFactory;
+            writer.write(types,    targetNamespaceURI.c_str(), 
+                ((DataFactoryImpl*)fac)->getOpenProperties(), indent);                
+        }
         
         char* XSDHelperImpl::generate(
             const TypeList& types,
@@ -541,6 +587,21 @@
             SDOXSDBufferWriter writer;
             DataFactory* fac = dataFactory;
             writer.write(types, targetNamespaceURI, 
+                ((DataFactoryImpl*)fac)->getOpenProperties(), indent);
+            SDOXMLString ret = writer.getBuffer();
+            char* retString = new char[strlen(ret) +1];
+            strcpy(retString, ret);
+            return retString;
+        }
+        char* XSDHelperImpl::generate(
+            const TypeList& types,
+            const SDOString& targetNamespaceURI,
+            int indent
+            )
+        {
+            SDOXSDBufferWriter writer;
+            DataFactory* fac = dataFactory;
+            writer.write(types, targetNamespaceURI.c_str(), 
                 ((DataFactoryImpl*)fac)->getOpenProperties(), indent);
             SDOXMLString ret = writer.getBuffer();
             char* retString = new char[strlen(ret) +1];

Modified: incubator/tuscany/cpp/sdo/runtime/core/src/commonj/sdo/XSDHelperImpl.h
URL: http://svn.apache.org/viewvc/incubator/tuscany/cpp/sdo/runtime/core/src/commonj/sdo/XSDHelperImpl.h?view=diff&rev=440722&r1=440721&r2=440722
==============================================================================
--- incubator/tuscany/cpp/sdo/runtime/core/src/commonj/sdo/XSDHelperImpl.h (original)
+++ incubator/tuscany/cpp/sdo/runtime/core/src/commonj/sdo/XSDHelperImpl.h Wed Sep  6 07:23:49 2006
@@ -63,8 +63,10 @@
              *
              */
             virtual const char* defineFile(const char* schemaFile, bool loadImportNamespace = false);
+            virtual const char* defineFile(const SDOString& schemaFile, bool loadImportNamespace = false);
             virtual const char* define(std::istream& schema, bool loadImportNamespace = false);
             virtual const char* define(const char* schema, bool loadImportNamespace = false);
+            virtual const char* define(const SDOString& schema, bool loadImportNamespace = false);
             
             /** getErrorCount gets number of parse errors
              *
@@ -97,16 +99,32 @@
                 const char* targetNamespaceURI = "",
                 int indent = -1
                 );
+            virtual char* generate(
+                const TypeList& types,
+                const SDOString& targetNamespaceURI = SDOString::SDONullString,
+                int indent = -1
+                );
             void generate(
                 const TypeList& types,
                 std::ostream& outXsd,
                 const char* targetNamespaceURI = "", 
                 int indent = -1
                 );
+            void generate(
+                const TypeList& types,
+                std::ostream& outXsd,
+                const SDOString& targetNamespaceURI = SDOString::SDONullString,
+                int indent = -1
+                );
             virtual void generateFile(
                 const TypeList& types,
                 const char* fileName,
                 const char* targetNamespaceURI = "", 
+                int indent = -1);
+            virtual void generateFile(
+                const TypeList& types,
+                const SDOString& fileName,
+                const SDOString& targetNamespaceURI = SDOString::SDONullString, 
                 int indent = -1);
             
             virtual DataFactoryPtr getDataFactory();



---------------------------------------------------------------------
To unsubscribe, e-mail: tuscany-commits-unsubscribe@ws.apache.org
For additional commands, e-mail: tuscany-commits-help@ws.apache.org


Mime
View raw message