tuscany-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From edslatt...@apache.org
Subject svn commit: r366158 [18/25] - in /incubator/tuscany/cpp/sdo: ./ bin/ dependencies/ include/ include/commonj/ include/commonj/sdo/ lib/ projects/ projects/tuscany_sdo/ projects/tuscany_sdo/sdo_runtime/ projects/tuscany_sdo/sdo_samples/ projects/tuscany_...
Date Thu, 05 Jan 2006 10:58:55 GMT
Propchange: incubator/tuscany/cpp/sdo/runtime/core/src/commonj/sdo/TypeImpl.cpp
------------------------------------------------------------------------------
    svn:eol-style = native

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

Added: incubator/tuscany/cpp/sdo/runtime/core/src/commonj/sdo/TypeImpl.h
URL: http://svn.apache.org/viewcvs/incubator/tuscany/cpp/sdo/runtime/core/src/commonj/sdo/TypeImpl.h?rev=366158&view=auto
==============================================================================
--- incubator/tuscany/cpp/sdo/runtime/core/src/commonj/sdo/TypeImpl.h (added)
+++ incubator/tuscany/cpp/sdo/runtime/core/src/commonj/sdo/TypeImpl.h Thu Jan  5 02:55:00 2006
@@ -0,0 +1,307 @@
+/*
+ *
+ *  Copyright 2005 The Apache Software Foundation or its licensors, as applicable.
+ *
+ *  Licensed under the Apache License, Version 2.0 (the "License");
+ *  you may not use this file except in compliance with the License.
+ *  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ *  Unless required by applicable law or agreed to in writing, software
+ *  distributed under the License is distributed on an "AS IS" BASIS,
+ *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ *  See the License for the specific language governing permissions and
+ *  limitations under the License.
+ */
+
+/* $Rev$ $Date: 2005/12/22 16:54:15 $ */
+
+#ifndef _TYPEIMPL_H_
+#define _TYPEIMPL_H_
+
+#include "commonj/sdo/disable_warn.h"
+
+#include <list>
+#include <map>
+#include <vector>
+#include "commonj/sdo/DASType.h"
+#include "commonj/sdo/PropertyImpl.h"
+#include "commonj/sdo/SDODate.h"
+
+
+#define MAX_LONG_SIZE 20 
+#define MAX_FLOAT_SIZE 32
+#define MAX_DOUBLE_SIZE 32
+#define BOOL_SIZE 5
+#define CHAR_SIZE 1
+#define BYTE_SIZE 1
+
+using namespace std;
+
+namespace commonj{
+namespace sdo{
+
+class DataObject;
+class PropertyList;
+class MetadataGraph;
+
+
+#ifndef PROPERTY_LIST
+    typedef std::list<PropertyImpl*> PROPERTY_LIST;
+#endif
+
+/**  
+ * TypeImpl implements the abstract class Type.
+ * A representation of the type of property of a data object.
+ */
+
+
+class TypeImpl : public DASType
+{
+
+public:
+
+    
+     virtual ~TypeImpl();
+
+    /**  convert - converts between types
+     *
+     * When a DataObject is queried for the value of one of its 
+     * properties, the method to call varies according to the
+     * type of the property.
+     * If the wrong API is called (E.g getBoolean() called on
+     * an Integer value), then a conversion is attempted.
+     * Many conversions will succeed and return the value,
+     * others will throw an InvalidConversionException
+     */
+     
+     unsigned int convertDate(        void ** value, const SDODate i) const;
+     unsigned int convert(    void ** value,const char* s) const; 
+     unsigned int convert(    void ** value,const wchar_t* s, unsigned int len) const; 
+     unsigned int convert(    void ** value,const char* s, unsigned int len) const; 
+     unsigned int convert(            void ** value,const bool b) const; 
+     unsigned int convert(            void ** value,const char c) const; 
+     unsigned int convert(            void ** value,const wchar_t c) const; 
+     unsigned int convert(            void ** value,const short s) const; 
+     unsigned int convert(            void ** value,const long i) const; 
+     unsigned int convert(            void ** value,const int64_t l) const; 
+     unsigned int convert(            void ** value,const float f) const; 
+     unsigned int convert(            void ** value,const long double d) const; 
+     unsigned int convert(            void ** value,DataObject* dob) const; 
+
+     const char*          convertToCString(    void* value , char** inbuf, unsigned int len) const; 
+     const bool           convertToBoolean(   void* value, unsigned int len) const; 
+     const char           convertToByte(      void* value,unsigned int len ) const; 
+     unsigned int         convertToString( void* value , wchar_t* val, unsigned int len,
+                            unsigned int max) const; 
+     unsigned int         convertToBytes(     void* value , char* val, unsigned int len,
+                            unsigned int max) const; 
+     const wchar_t        convertToCharacter(  void* value ,unsigned int len) const; 
+     const short          convertToShort(     void* value ,unsigned int len) const; 
+     const long           convertToInteger(   void* value ,unsigned int len) const; 
+     const int64_t        convertToLong(      void* value ,unsigned int len) const; 
+     const float          convertToFloat(     void* value ,unsigned int len) const; 
+     const long double    convertToDouble(void* value ,unsigned int len) const; 
+     DataObject*          convertToDataObject(void* value ,unsigned int len) const; 
+     const SDODate         convertToDate      (void* value ,unsigned int len) const; 
+
+     /**  equals - compares
+     *
+     * equals returns true if the name and uri are the same
+     */
+
+     bool equals(const Type& t);
+
+    ///////////////////////////////////////////////////////////////////////////
+    // Returns the name of the type.
+    ///////////////////////////////////////////////////////////////////////////
+    const char* getName() const;
+  
+    ///////////////////////////////////////////////////////////////////////////
+    // Alias support.
+    // @return nth alias
+    ///////////////////////////////////////////////////////////////////////////
+    virtual const char* getAlias(unsigned int index = 0) const ;
+    virtual unsigned int getAliasCount() const ;
+    virtual void setAlias(const char* alias);
+
+    
+
+    ///////////////////////////////////////////////////////////////////////////
+    // Returns the namespace URI of the type.
+    ///////////////////////////////////////////////////////////////////////////
+    const char* getURI() const;
+
+    ///////////////////////////////////////////////////////////////////////////
+    // Returns the list of the properties of this type.
+    ///////////////////////////////////////////////////////////////////////////
+    PropertyList  getProperties() const;
+
+     ///////////////////////////////////////////////////////////////////////////
+    //  add a property to a Type whilst building - this is for DAS 
+    ///////////////////////////////////////////////////////////////////////////
+    void   addProperty(const char* name,
+                               const TypeImpl& t, bool many, bool rdonly, bool cont);
+  
+    ///////////////////////////////////////////////////////////////////////////
+    // Returns the property with the specified name.
+    ///////////////////////////////////////////////////////////////////////////
+    const Property& getProperty(const char* propertyName) const ;
+    const Property& getProperty(unsigned int index)  const ;
+
+    PropertyImpl* getPropertyImpl(const char* propertyName) const ;
+    PropertyImpl* getPropertyImpl(unsigned int index)  const ;
+    
+
+    ///////////////////////////////////////////////////////////////////////////
+    // Substitute support
+    ///////////////////////////////////////////////////////////////////////////
+      // get the property with no substitute possible.
+    PropertyImpl* getPropertyImplPure(const char* propertyName) const ;
+
+    // get the type of the property even if its a substitute
+    const Type& getRealPropertyType(const char* propertyName) const ;
+    const TypeImpl* getRealPropertyTypeImpl(const char* propertyName) const ;
+
+
+
+    unsigned int getPropertyIndex(const char* propertyName)  const ;
+
+    unsigned int getPropertiesSize() const;
+    ///////////////////////////////////////////////////////////////////////////
+    // Indicates if this Type specifies DataObjects.
+     ///////////////////////////////////////////////////////////////////////////
+    bool isDataObjectType() const;
+  
+    ///////////////////////////////////////////////////////////////////////////
+    // Indicates if this Type specifies Sequenced DataObjects.
+    ///////////////////////////////////////////////////////////////////////////
+    bool isSequencedType() const;
+    void setSequenced(bool set);
+
+    ///////////////////////////////////////////////////////////////////////////
+    // Indicates if this Type allows any form of open content.  If false,
+    // dataObject.getInstanceProperties() must be the same as 
+    // DataObject.getType().getProperties().
+    ///////////////////////////////////////////////////////////////////////////
+    bool isOpenType() const;
+    void setOpen(bool set);
+
+    ///////////////////////////////////////////////////////////////////////////
+    // Indicates if this type may not be instantiated.
+    ///////////////////////////////////////////////////////////////////////////
+    bool isAbstractType() const;
+    void setAbstract(bool set);
+
+    ///////////////////////////////////////////////////////////////////////////
+    // Set the base type for inherited types
+    ///////////////////////////////////////////////////////////////////////////
+    void setBaseType(const Type* tb);
+    const Type* getBaseType() const;
+
+
+    ///////////////////////////////////////////////////////////////////////////
+    // Indicates a non-object type
+    ///////////////////////////////////////////////////////////////////////////
+    bool isDataType() const;
+
+    ///////////////////////////////////////////////////////////////////////////
+    // Indicates a non-object type
+    ///////////////////////////////////////////////////////////////////////////
+    Type::Types getTypeEnum() const;
+
+    ///////////////////////////////////////////////////////////////////////////
+    // set this type as a change summary holder
+    ///////////////////////////////////////////////////////////////////////////
+    void addChangeSummary();
+
+    ///////////////////////////////////////////////////////////////////////////
+    // Say if this type is allowed to have a summary
+    ///////////////////////////////////////////////////////////////////////////
+    bool isChangeSummaryType() const;
+
+    ///////////////////////////////////////////////////////////////////////////
+    // Used by the DAS to resolve the base type properties list
+    ///////////////////////////////////////////////////////////////////////////
+    void initCompoundProperties();
+
+    ///////////////////////////////////////////////////////////////////////////
+    // Used by the DAS to chack for nested change summaries
+    ///////////////////////////////////////////////////////////////////////////
+    void validateChangeSummary();
+
+    virtual bool equals(const Type& tother) const;
+
+private:
+    friend class DataFactoryImpl;
+
+    bool changeSummaryType;
+
+    void* newValue(void* v, int size) const;
+
+    PROPERTY_LIST getCompoundProperties();
+
+    void throwIfNestedChangeSummary() const;
+
+    TypeImpl(const char* uri,const char* name, 
+        bool isSeq= false, 
+        bool isOp = false,
+        bool isAbs = false, 
+        bool isData = false);
+    
+    TypeImpl(const Type* base, const char* uri,const char* name, 
+        bool isSeq = false, 
+        bool isOp = false,
+        bool isAbs = false,
+        bool isData = false); 
+
+    void init(const char* uri, const char* inname, 
+         bool isSeq,
+         bool isOp,
+         bool isAbs,
+         bool isData);
+
+
+
+    TypeImpl();
+    TypeImpl(const TypeImpl& t);
+
+
+    char* name;
+    char* typeURI;
+
+
+    bool isPrimitive;
+    bool isSequenced;
+    bool isOpen;
+    bool isAbstract;
+
+    // baseType properties included
+    bool isResolved;
+    // check for circular dependency
+    bool isResolving;
+
+    Types typeEnum;
+    
+    static char* types[num_types];
+
+    // alias support
+
+    std::vector<char*> aliases;
+
+
+    PROPERTY_LIST props;
+
+
+    // type inheritance
+    TypeImpl* baseType;
+    // says how many of the props are really in this data object type.
+    unsigned int localPropsSize;
+
+};
+
+};
+};
+
+#endif //_TYPEIMPL_H_

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

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

Added: incubator/tuscany/cpp/sdo/runtime/core/src/commonj/sdo/TypeList.cpp
URL: http://svn.apache.org/viewcvs/incubator/tuscany/cpp/sdo/runtime/core/src/commonj/sdo/TypeList.cpp?rev=366158&view=auto
==============================================================================
--- incubator/tuscany/cpp/sdo/runtime/core/src/commonj/sdo/TypeList.cpp (added)
+++ incubator/tuscany/cpp/sdo/runtime/core/src/commonj/sdo/TypeList.cpp Thu Jan  5 02:55:00 2006
@@ -0,0 +1,84 @@
+/*
+ *
+ *  Copyright 2005 The Apache Software Foundation or its licensors, as applicable.
+ *
+ *  Licensed under the Apache License, Version 2.0 (the "License");
+ *  you may not use this file except in compliance with the License.
+ *  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ *  Unless required by applicable law or agreed to in writing, software
+ *  distributed under the License is distributed on an "AS IS" BASIS,
+ *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ *  See the License for the specific language governing permissions and
+ *  limitations under the License.
+ */
+
+/* $Rev$ $Date: 2005/12/22 16:54:15 $ */
+
+#ifndef SDO_EXPORTS
+    #define SDO_EXPORTS
+#endif
+
+#include "commonj/sdo/export.h"
+#include <iostream>
+#include "commonj/sdo/Property.h"
+#include "commonj/sdo/Type.h"
+#include "commonj/sdo/TypeList.h"
+#include "commonj/sdo/Logger.h"
+
+using namespace std;
+
+namespace commonj{
+namespace sdo {
+
+
+/** TypeList provides access to a list of Types.
+ *
+ * The data factory can return a list of types available. This
+ * class wraps that list and provides access to Types by 
+ * iteration
+ */
+
+SDO_API TypeList::TypeList(std::vector<const Type*> p) : plist (p)
+{
+}
+
+SDO_API TypeList::TypeList(const TypeList &pin)
+{
+    plist = std::vector<const Type*>(pin.getVec());
+}
+
+SDO_API TypeList::TypeList()
+{
+}
+
+SDO_API TypeList::~TypeList()
+{
+}
+
+
+SDO_API const Type& TypeList::operator[] (int pos) const
+{
+    return *plist[pos];
+}
+
+SDO_API int TypeList::size () const
+{
+    return plist.size();
+}
+
+std::vector<const Type*> TypeList::getVec() const
+{
+    return plist;
+}
+
+SDO_API void TypeList::insert (const Type* t) 
+{
+    plist.insert(plist.end(),t);
+}
+
+};
+};
+

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

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

Added: incubator/tuscany/cpp/sdo/runtime/core/src/commonj/sdo/TypeList.h
URL: http://svn.apache.org/viewcvs/incubator/tuscany/cpp/sdo/runtime/core/src/commonj/sdo/TypeList.h?rev=366158&view=auto
==============================================================================
--- incubator/tuscany/cpp/sdo/runtime/core/src/commonj/sdo/TypeList.h (added)
+++ incubator/tuscany/cpp/sdo/runtime/core/src/commonj/sdo/TypeList.h Thu Jan  5 02:55:00 2006
@@ -0,0 +1,56 @@
+/*
+ *
+ *  Copyright 2005 The Apache Software Foundation or its licensors, as applicable.
+ *
+ *  Licensed under the Apache License, Version 2.0 (the "License");
+ *  you may not use this file except in compliance with the License.
+ *  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ *  Unless required by applicable law or agreed to in writing, software
+ *  distributed under the License is distributed on an "AS IS" BASIS,
+ *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ *  See the License for the specific language governing permissions and
+ *  limitations under the License.
+ */
+
+/* $Rev$ $Date: 2005/12/22 16:54:15 $ */
+
+#ifndef _TYPELIST_H_
+#define _TYPELIST_H_
+#include "commonj/sdo/export.h"
+
+#include <vector>
+#include "commonj/sdo/Type.h"
+
+namespace commonj{
+namespace sdo
+{
+class Type;
+
+/** TypeList - provides access to a list of Types
+ *
+ * The data factory can return a list of types available. This
+ * class wraps that list and provides access to Types by 
+ * iteration
+ */
+
+class TypeList
+{
+private: 
+    std::vector<const Type*> plist;
+    std::vector<const Type*> getVec() const;
+public:
+    SDO_API TypeList(const TypeList &pin);
+    SDO_API TypeList(std::vector<const Type*> p);
+    SDO_API TypeList();
+    virtual SDO_API ~TypeList();
+    SDO_API const Type& operator[] (int pos) const;
+    SDO_API int size () const;
+    SDO_API void insert (const Type* t);
+};
+};
+};
+
+#endif

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

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

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

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

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

Added: incubator/tuscany/cpp/sdo/runtime/core/src/commonj/sdo/XMLDocument.h
URL: http://svn.apache.org/viewcvs/incubator/tuscany/cpp/sdo/runtime/core/src/commonj/sdo/XMLDocument.h?rev=366158&view=auto
==============================================================================
--- incubator/tuscany/cpp/sdo/runtime/core/src/commonj/sdo/XMLDocument.h (added)
+++ incubator/tuscany/cpp/sdo/runtime/core/src/commonj/sdo/XMLDocument.h Thu Jan  5 02:55:00 2006
@@ -0,0 +1,145 @@
+/*
+ *
+ *  Copyright 2005 The Apache Software Foundation or its licensors, as applicable.
+ *
+ *  Licensed under the Apache License, Version 2.0 (the "License");
+ *  you may not use this file except in compliance with the License.
+ *  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ *  Unless required by applicable law or agreed to in writing, software
+ *  distributed under the License is distributed on an "AS IS" BASIS,
+ *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ *  See the License for the specific language governing permissions and
+ *  limitations under the License.
+ */
+
+/* $Rev$ $Date: 2005/12/22 16:54:15 $ */
+
+#ifndef _XMLDOCUMENT_H_
+#define _XMLDOCUMENT_H_
+
+
+#include "commonj/sdo/export.h"
+
+#include "commonj/sdo/DataObject.h"
+
+namespace commonj
+{
+    namespace sdo
+    {
+        /**  XMLDocument - place for holding a graph
+         *
+         * The XMLDocument class provides a place to hold a loaded
+         * graph of data. The root element name is maintained here so that
+         * the graph can be serialized to the same name later.
+         */
+
+        
+        class XMLDocument : public RefCountingObject
+        {
+            
+        public:
+            
+            SDO_API virtual ~XMLDocument();
+            
+        /**  getRootDataObject- return the topmost data object
+         *
+         * When XML data is loaded, there is one base element which becomes
+         * the root data object. As this data object is not a property of any
+         * other data object, it has no name
+         * The XMLDocument stores the name which was in the XML file.
+         * This root data object has a URI and a Name only within this
+         * XMLDocument
+         */
+
+            SDO_API virtual DataObjectPtr getRootDataObject() const = 0;
+
+        /**  getRootElementName- return the topmost data objects name
+         *
+         * When XML data is loaded, there is one base element which becomes
+         * the root data object. As this data object is not a property of any
+         * other data object, it has no name
+         * The XMLDocument stores the name/uri which was in the XML file.
+         */
+            SDO_API virtual const char* getRootElementURI() const = 0;
+
+        /**  getRootElementURI- return the topmost data objects uri
+         *
+         * When XML data is loaded, there is one base element which becomes
+         * the root data object. As this data object is not a property of any
+         * other data object, it has no name
+         * The XMLDocument stores the name/uri which was in the XML file.
+         */
+            SDO_API virtual const char* getRootElementName() const = 0;
+
+        /**  getEncoding- return the encoding for this document
+         *
+         * NOT IMPLEMENTED
+         * This returns the encoding specified in the original XML.
+         */
+            SDO_API virtual const char* getEncoding() const = 0;
+
+        /**  setEncoding- set the encoding to save this document
+         *
+         * This sets the encoding to save this data to XML.
+         */
+            SDO_API virtual void setEncoding(const char* encoding) = 0;
+
+        /**  getXMLDeclaration
+         *
+         * NOT IMPLEMENTED
+         */
+            SDO_API virtual bool getXMLDeclaration() const = 0;
+
+        /**  setXMLDeclaration
+         *
+         * Sets the XMLDeclaration
+         */
+            SDO_API virtual void setXMLDeclaration(bool xmlDeclaration) = 0;
+
+        /**  getXMLVersion- return the xml version for this document
+         *
+         * NOT IMPLEMENTED
+         */
+            SDO_API virtual const char* getXMLVersion() const = 0;
+
+        /**  setXMLVersion- sets the version for this document
+         *
+         * NOT IMPLEMENTED
+         */
+            SDO_API virtual void setXMLVersion(const char* xmlVersion) = 0;
+
+        /**  getSchemaLocation- return the schema location
+         *
+         * NOT IMPLEMENTED
+         */
+            SDO_API virtual const char* getSchemaLocation() const = 0;
+
+        /**  setSchemaLocation
+         *
+         * Sets the XML Schema location.
+         */
+            SDO_API virtual void setSchemaLocation(const char* schemaLocation) = 0;
+
+        /**  getNoNamespaceSchemaLocation
+         *
+         * NOT IMPLEMENTED
+         */
+            SDO_API virtual const char* getNoNamespaceSchemaLocation() const = 0;
+
+        /**  setNoNamespaceSchemaLocation
+         *
+         * Sets the nonamespace schema location
+         */
+            SDO_API virtual void setNoNamespaceSchemaLocation(const char* noNamespaceSchemaLocation) = 0;        
+            
+            SDO_API friend std::istream& operator>>(std::istream& input, XMLDocument& doc);
+            
+        };
+    } // End - namespace sdo
+} // End - namespace commonj
+
+
+#endif //_XMLDOCUMENT_H_

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

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

Added: incubator/tuscany/cpp/sdo/runtime/core/src/commonj/sdo/XMLDocumentImpl.cpp
URL: http://svn.apache.org/viewcvs/incubator/tuscany/cpp/sdo/runtime/core/src/commonj/sdo/XMLDocumentImpl.cpp?rev=366158&view=auto
==============================================================================
--- incubator/tuscany/cpp/sdo/runtime/core/src/commonj/sdo/XMLDocumentImpl.cpp (added)
+++ incubator/tuscany/cpp/sdo/runtime/core/src/commonj/sdo/XMLDocumentImpl.cpp Thu Jan  5 02:55:00 2006
@@ -0,0 +1,69 @@
+/*
+ *
+ *  Copyright 2005 The Apache Software Foundation or its licensors, as applicable.
+ *
+ *  Licensed under the Apache License, Version 2.0 (the "License");
+ *  you may not use this file except in compliance with the License.
+ *  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ *  Unless required by applicable law or agreed to in writing, software
+ *  distributed under the License is distributed on an "AS IS" BASIS,
+ *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ *  See the License for the specific language governing permissions and
+ *  limitations under the License.
+ */
+
+/* $Rev$ $Date: 2005/12/22 16:54:15 $ */
+
+#include "commonj/sdo/XMLDocumentImpl.h"
+
+namespace commonj
+{
+    namespace sdo
+    {
+        XMLDocumentImpl::XMLDocumentImpl(
+            DataObjectPtr dob,
+            const char* rootURI,
+            const char* rootName)
+            : dataObject(dob), 
+              rootElementURI(rootURI),
+              rootElementName(rootName),
+              xmlDeclaration(true),
+              encoding("UTF-8"),
+              xmlVersion("1.0")
+        {
+        }
+        
+        XMLDocumentImpl::~XMLDocumentImpl()
+        {
+        }
+
+        void XMLDocumentImpl::setEncoding(const char* enc)
+        {
+            encoding = enc;
+        }
+        
+        void XMLDocumentImpl::setXMLDeclaration(bool xmlDecl)
+        {
+            xmlDeclaration = xmlDecl;
+        }
+        
+        void XMLDocumentImpl::setXMLVersion(const char* xmlVer)
+        {
+            xmlVersion = xmlVer;
+        }
+        
+        void XMLDocumentImpl::setSchemaLocation(const char* schemaLoc)
+        {
+            schemaLocation = schemaLoc;
+        }
+        
+        void XMLDocumentImpl::setNoNamespaceSchemaLocation(const char* noNamespaceSchemaLoc)
+        {
+            noNamespaceSchemaLocation = noNamespaceSchemaLoc;
+        }
+        
+    } // End - namespace sdo
+} // End - namespace commonj

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

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

Added: incubator/tuscany/cpp/sdo/runtime/core/src/commonj/sdo/XMLDocumentImpl.h
URL: http://svn.apache.org/viewcvs/incubator/tuscany/cpp/sdo/runtime/core/src/commonj/sdo/XMLDocumentImpl.h?rev=366158&view=auto
==============================================================================
--- incubator/tuscany/cpp/sdo/runtime/core/src/commonj/sdo/XMLDocumentImpl.h (added)
+++ incubator/tuscany/cpp/sdo/runtime/core/src/commonj/sdo/XMLDocumentImpl.h Thu Jan  5 02:55:00 2006
@@ -0,0 +1,95 @@
+/*
+ *
+ *  Copyright 2005 The Apache Software Foundation or its licensors, as applicable.
+ *
+ *  Licensed under the Apache License, Version 2.0 (the "License");
+ *  you may not use this file except in compliance with the License.
+ *  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ *  Unless required by applicable law or agreed to in writing, software
+ *  distributed under the License is distributed on an "AS IS" BASIS,
+ *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ *  See the License for the specific language governing permissions and
+ *  limitations under the License.
+ */
+
+/* $Rev$ $Date: 2005/12/22 16:54:15 $ */
+
+#ifndef _XMLDocumentImpl_H_
+#define _XMLDocumentImpl_H_
+
+#include "commonj/sdo/disable_warn.h"
+
+#include "commonj/sdo/XMLDocument.h"
+#include "commonj/sdo/DataObject.h"
+#include "commonj/sdo/SDOXMLString.h"
+
+
+namespace commonj
+{
+    namespace sdo
+    {
+        
+/**  XMLDocumentImpl place for holding a graph
+ *
+ * The XMLDocumentImpl class implements the abstract XMLDocument.
+ * Provides a place to hold a loaded
+ * graph of data. The root element name is maintained here so that
+ * the graph can be serialized to the same name later.
+ */
+        
+        class XMLDocumentImpl : public XMLDocument
+        {
+            
+        public:
+            XMLDocumentImpl();
+            
+            XMLDocumentImpl(
+                DataObjectPtr dataObject);
+
+            XMLDocumentImpl(
+                DataObjectPtr dataObject,
+                const char* rootElementURI,
+                const char* rootElementName);
+
+            virtual ~XMLDocumentImpl();
+            
+            virtual DataObjectPtr getRootDataObject() const {return dataObject;}
+            virtual const char* getRootElementURI() const {return rootElementURI;}
+            virtual const char* getRootElementName() const {return rootElementName;}
+            virtual const char* getEncoding() const {return encoding;}
+            virtual void setEncoding(const char* 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 const char* getSchemaLocation() const {return schemaLocation;}
+            virtual void setSchemaLocation(const char* schemaLoc);
+
+            virtual const char* getNoNamespaceSchemaLocation() const { return noNamespaceSchemaLocation;}
+            virtual void setNoNamespaceSchemaLocation(const char* noNamespaceSchemaLoc);
+            
+            
+            friend std::istream& operator>>(std::istream& input, XMLDocumentImpl& doc);
+        private:
+            DataObjectPtr    dataObject;
+            SDOXMLString    rootElementURI;
+            SDOXMLString    rootElementName;
+            SDOXMLString    encoding;
+            bool            xmlDeclaration;
+            SDOXMLString    xmlVersion;
+            SDOXMLString    schemaLocation;
+            SDOXMLString    noNamespaceSchemaLocation;
+
+            
+        };
+    } // End - namespace sdo
+} // End - namespace commonj
+
+
+#endif //_XMLDocumentImpl_H_

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

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

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

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

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

Added: 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=366158&view=auto
==============================================================================
--- incubator/tuscany/cpp/sdo/runtime/core/src/commonj/sdo/XMLHelper.h (added)
+++ incubator/tuscany/cpp/sdo/runtime/core/src/commonj/sdo/XMLHelper.h Thu Jan  5 02:55:00 2006
@@ -0,0 +1,133 @@
+/*
+ *
+ *  Copyright 2005 The Apache Software Foundation or its licensors, as applicable.
+ *
+ *  Licensed under the Apache License, Version 2.0 (the "License");
+ *  you may not use this file except in compliance with the License.
+ *  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ *  Unless required by applicable law or agreed to in writing, software
+ *  distributed under the License is distributed on an "AS IS" BASIS,
+ *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ *  See the License for the specific language governing permissions and
+ *  limitations under the License.
+ */
+
+/* $Rev$ $Date: 2005/12/22 16:54:15 $ */
+
+#ifndef _XMLHELPER_H_
+#define _XMLHELPER_H_
+
+
+#include "commonj/sdo/export.h"
+#include "commonj/sdo/XMLDocument.h"
+#include "commonj/sdo/RefCountingObject.h"
+
+namespace commonj
+{
+    namespace sdo
+    {
+        /**  
+         *
+         * XMLHelper provides the ability to load XML data into 
+         * a data object graph, according to  a schema
+         */
+
+        class XMLHelper : public RefCountingObject
+        {
+        public:
+            
+            /**  load/loadFile - loads xml data
+             *
+             * De-serializes the specified XML file building a graph of DataObjects.
+             * Returns a pointer to the root data object
+             */
+
+            SDO_API virtual XMLDocumentPtr loadFile(
+                const char* xmlFile,
+                const char* targetNamespaceURI=0) = 0;
+            SDO_API virtual XMLDocumentPtr load(
+                std::istream& inXml,
+                const char* targetNamespaceURI=0) = 0;
+            SDO_API virtual XMLDocumentPtr load(
+                const char* inXml,
+                const char* targetNamespaceURI=0) = 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) = 0;                
+            SDO_API virtual void save(
+                DataObjectPtr dataObject,
+                const char* rootElementURI,
+                const char* rootElementName,
+                const char* xmlFile) = 0;
+            
+            
+            /**  save saves the graph to XML
+             *
+             * save - Serializes the datagraph to the XML stream
+             */
+
+            SDO_API virtual void save(XMLDocumentPtr doc, std::ostream& outXml) = 0;
+            SDO_API virtual void save(
+                DataObjectPtr dataObject,
+                const char* rootElementURI,
+                const char* rootElementName,
+                std::ostream& outXml) = 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(
+                DataObjectPtr dataObject,
+                const char* rootElementURI,
+                const char* rootElementName) = 0;
+            
+            /**  createDocument creates an XMLDocument
+             *
+             * An XMLDocument holds a root data object and all its
+             * tree of children. This provides the means of storing the
+             * name to be applied to the root element when serializing
+             */
+
+            SDO_API virtual XMLDocumentPtr createDocument(
+                DataObjectPtr dataObject,
+                const char* rootElementURI,
+                const char* rootElementName) = 0;
+            
+            /***********************************/
+            /* Destructor */
+            /***********************************/
+            SDO_API virtual ~XMLHelper();
+
+            /** getErrorCount gets number of parse errors
+             *
+             * Parser error count - the parse may have 
+             * succeeded or partially succeeded or failed. There
+             * may be errors to report or handle.
+             */
+
+            virtual int  getErrorCount() const = 0;
+
+            /** getErrorMessage gets the nth error message
+             *
+             * Each error has a message, usually giving the line and file
+             * in which the parser error occurred.
+             */
+
+            virtual const char* getErrorMessage(int errnum) const = 0;
+
+            
+        };
+    } // End - namespace sdo
+} // End - namespace commonj
+
+#endif //_XMLHELPER_H_

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

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

Added: 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=366158&view=auto
==============================================================================
--- incubator/tuscany/cpp/sdo/runtime/core/src/commonj/sdo/XMLHelperImpl.cpp (added)
+++ incubator/tuscany/cpp/sdo/runtime/core/src/commonj/sdo/XMLHelperImpl.cpp Thu Jan  5 02:55:00 2006
@@ -0,0 +1,226 @@
+/*
+ *
+ *  Copyright 2005 The Apache Software Foundation or its licensors, as applicable.
+ *
+ *  Licensed under the Apache License, Version 2.0 (the "License");
+ *  you may not use this file except in compliance with the License.
+ *  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ *  Unless required by applicable law or agreed to in writing, software
+ *  distributed under the License is distributed on an "AS IS" BASIS,
+ *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ *  See the License for the specific language governing permissions and
+ *  limitations under the License.
+ */
+
+/* $Rev$ $Date: 2005/12/22 16:54:15 $ */
+
+#include "commonj/sdo/SDOXMLFileWriter.h"   // Include first to avoid libxml compile problems!
+#include "commonj/sdo/SDOXMLStreamWriter.h" // Include first to avoid libxml compile problems!
+#include "commonj/sdo/SDOXMLBufferWriter.h" // Include first to avoid libxml compile problems!
+#include "commonj/sdo/XMLHelperImpl.h"
+#include "commonj/sdo/XMLDocumentImpl.h"
+#include <iostream>
+#include <fstream>
+#include <sstream>
+#include "commonj/sdo/SDOSAX2Parser.h"
+#include "commonj/sdo/XSDPropertyInfo.h"
+#include "commonj/sdo/XSDTypeInfo.h"
+#include "commonj/sdo/SDORuntimeException.h"
+#include "commonj/sdo/DataFactoryImpl.h"
+
+
+namespace commonj
+{
+    namespace sdo
+    {
+        
+        
+        //////////////////////////////////////////////////////////////////////
+        // Construction/Destruction
+        //////////////////////////////////////////////////////////////////////
+        
+        XMLHelperImpl::XMLHelperImpl(DataFactoryPtr df)
+        {
+            dataFactory = (DataFactory*)df;
+        }
+        
+        XMLHelperImpl::~XMLHelperImpl()
+        {
+            clearErrors();
+        }
+
+        DataFactoryPtr XMLHelperImpl::getDataFactory()
+        {
+            if (!dataFactory) 
+            {
+                dataFactory = DataFactory::getDataFactory();
+            }
+            return dataFactory;
+        }
+
+        XMLDocumentPtr XMLHelperImpl::createDocument(DataObjectPtr dataObject)
+        {
+            
+            SDOXMLString rootElementName = "";
+            SDOXMLString rootElementURI = "";
+            if (dataObject)
+            {
+                // Set the root element name to the name of the containment property
+                // or null if there is no container
+                   try
+                {
+                    DataObjectPtr cont = dataObject->getContainer();
+                    if (cont != 0)
+                    {
+                        const Property& containmentProp = dataObject->getContainmentProperty();
+                        rootElementName = containmentProp.getName();
+                        rootElementURI = cont->getType().getURI();
+                    }
+                    else
+                    {
+                        DataFactory* df = dataFactory;
+                        rootElementURI = dataObject->getType().getURI();
+                        rootElementName = ((DataFactoryImpl*)df)->getRootElementName();
+                    }
+                }
+                catch (SDOPropertyNotFoundException&)
+                {}
+            }
+
+            return new XMLDocumentImpl(dataObject, rootElementURI, rootElementName);
+        }
+
+        XMLDocumentPtr XMLHelperImpl::createDocument(
+            DataObjectPtr dataObject,
+            const char* rootElementURI,
+            const char* rootElementName)
+        {
+            return new XMLDocumentImpl(dataObject, rootElementURI, rootElementName);
+        }
+        
+        XMLDocumentPtr XMLHelperImpl::loadFile(
+            const char* xmlFile,
+            const char* targetNamespaceURI)
+        {
+            DataObjectPtr rootDataObject;
+            clearErrors();
+            SDOSAX2Parser sdoParser(getDataFactory(), targetNamespaceURI, rootDataObject,
+                this);
+            if (sdoParser.parse(xmlFile) == 0)
+            {                
+                return createDocument(rootDataObject);
+            }
+            return 0;
+        }
+
+        
+        XMLDocumentPtr XMLHelperImpl::load(
+            istream& inXml,
+            const char* targetNamespaceURI)
+        {
+            DataObjectPtr rootDataObject;
+            SDOSAX2Parser sdoParser(getDataFactory(), targetNamespaceURI, rootDataObject,
+                this);
+            clearErrors();
+            inXml>>sdoParser;
+            return createDocument(rootDataObject);
+        }
+        
+        XMLDocumentPtr XMLHelperImpl::load(
+            const char* inXml,
+            const char* targetNamespaceURI)
+        {
+            istringstream str(inXml);
+            return load(str, targetNamespaceURI);
+        }
+        
+        void XMLHelperImpl::save(XMLDocumentPtr doc, const char* xmlFile)
+        {
+            SDOXMLFileWriter writer(xmlFile, dataFactory);
+            writer.write(doc);
+        }
+        
+        void XMLHelperImpl::save(
+            DataObjectPtr dataObject,
+            const char* rootElementURI,
+            const char* rootElementName,
+            const char* xmlFile)
+        {
+            save(createDocument(dataObject,rootElementURI, rootElementName), xmlFile);
+        }
+        
+        
+        // Serializes the datagraph to a stream
+        void XMLHelperImpl::save(XMLDocumentPtr doc, std::ostream& outXml)
+        {
+            SDOXMLStreamWriter writer(outXml, dataFactory);
+            writer.write(doc);                
+        }
+        void XMLHelperImpl::save(
+            DataObjectPtr dataObject,
+            const char* rootElementURI,
+            const char* rootElementName,
+            std::ostream& outXml)
+        {
+            save(createDocument(dataObject,rootElementURI, rootElementName), outXml);
+        }
+        
+        // Serializes the datagraph to a string
+        char* XMLHelperImpl::save(XMLDocumentPtr doc)
+        {
+            SDOXMLBufferWriter writer(dataFactory);
+            writer.write(doc);
+            SDOXMLString ret = writer.getBuffer();
+            char* retString = new char[strlen(ret) +1];
+            strcpy(retString, ret);
+            return retString;
+        }
+        char* XMLHelperImpl::save(
+            DataObjectPtr dataObject,
+            const char* rootElementURI,
+            const char* rootElementName)
+        {
+            return save(createDocument(dataObject,rootElementURI, rootElementName));
+        }
+
+        int XMLHelperImpl::getErrorCount() const
+        {
+            return parseErrors.size();
+        }
+
+
+        const char* XMLHelperImpl::getErrorMessage(int errnum) const
+        {
+            if (errnum >= 0 && errnum < parseErrors.size())
+            {
+                return parseErrors[errnum];
+            }
+            return 0;
+        }
+
+        void XMLHelperImpl::setError(const char* message)
+        {
+            if (message == 0) return;
+            char * m = new char[strlen(message) + 1];
+            strcpy(m,message);
+            m[strlen(message)] = 0;
+            parseErrors.push_back(m);
+        }
+
+        void XMLHelperImpl::clearErrors()
+        {
+            while (!parseErrors.empty()) 
+            {
+                if (*parseErrors.begin() != 0)
+                {
+                    delete (char*)(*parseErrors.begin());
+                }
+                parseErrors.erase(parseErrors.begin());
+            }
+        }
+        
+    } // End - namespace sdo
+} // End - namespace commonj

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

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

Added: 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=366158&view=auto
==============================================================================
--- incubator/tuscany/cpp/sdo/runtime/core/src/commonj/sdo/XMLHelperImpl.h (added)
+++ incubator/tuscany/cpp/sdo/runtime/core/src/commonj/sdo/XMLHelperImpl.h Thu Jan  5 02:55:00 2006
@@ -0,0 +1,133 @@
+/*
+ *
+ *  Copyright 2005 The Apache Software Foundation or its licensors, as applicable.
+ *
+ *  Licensed under the Apache License, Version 2.0 (the "License");
+ *  you may not use this file except in compliance with the License.
+ *  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ *  Unless required by applicable law or agreed to in writing, software
+ *  distributed under the License is distributed on an "AS IS" BASIS,
+ *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ *  See the License for the specific language governing permissions and
+ *  limitations under the License.
+ */
+
+/* $Rev$ $Date: 2005/12/22 16:54:15 $ */
+
+#ifndef _XMLHELPERIMPL_H_
+#define _XMLHELPERIMPL_H_
+
+#include "commonj/sdo/disable_warn.h"
+
+#include "commonj/sdo/XMLHelper.h"
+#include "commonj/sdo/export.h"
+#include "commonj/sdo/SDOXMLString.h"
+#include "commonj/sdo/SAX2Namespaces.h"
+#include "commonj/sdo/SchemaInfo.h"
+#include "commonj/sdo/TypeDefinitions.h"
+#include "commonj/sdo/ParserErrorSetter.h"
+
+namespace commonj
+{
+    namespace sdo
+    {
+        
+        /**  
+         *
+         * XMLHelperImpl is the implementation of the abstract class
+         * XMLHelper.
+         * Provides the ability to load XML data into 
+         * a data object graph, according to  a schema
+         */
+        
+        class XMLHelperImpl : public XMLHelper, ParserErrorSetter
+        {
+        public:            
+            // Constructor
+            XMLHelperImpl(DataFactoryPtr dataFactory);
+            
+            // Destructor
+            virtual ~XMLHelperImpl();
+            
+            virtual int  getErrorCount() const;
+            virtual const char*  getErrorMessage(int errnum) const;
+            virtual void setError(const char* error);
+
+
+            /**  load/loadFile - loads xml data
+             *
+             * De-serializes the specified XML file building a graph of DataObjects.
+             * Returns a pointer to the root data object
+             */
+
+            virtual XMLDocumentPtr loadFile(
+                const char* xmlFile,
+                const char* targetNamespaceURI = 0);
+            virtual XMLDocumentPtr load(
+                istream& inXml,
+                const char* targetNamespaceURI = 0);
+            virtual XMLDocumentPtr load(
+                const char* inXml,
+                const char* targetNamespaceURI = 0);
+            
+            virtual XMLDocumentPtr createDocument(
+                DataObjectPtr dataObject,
+                const char* rootElementURI,
+                const char* rootElementName);
+
+            /**  save saves the graph to XML
+             *
+             * save - Serializes the datagraph to the XML file
+             */
+
+            void save(XMLDocumentPtr doc, const char* xmlFile);
+            void save(
+                DataObjectPtr dataObject,
+                const char* rootElementURI,
+                const char* rootElementName,
+                const char* xmlFile);
+
+            /**  save saves the graph to XML
+             *
+             * save - Serializes the datagraph to a stream
+             */
+
+            void save(XMLDocumentPtr doc, std::ostream& outXml);
+            void save(
+                DataObjectPtr dataObject,
+                const char* rootElementURI,
+                const char* rootElementName,
+                std::ostream& outXml);
+
+            /**  save saves the graph to XML
+             *
+             * save - Serializes the datagraph to a string
+             */
+            char* save(XMLDocumentPtr doc);
+            char* save(
+                DataObjectPtr dataObject,
+                const char* rootElementURI,
+                const char* rootElementName);
+                            
+        private:
+            int     parse(const char* source);
+            void clearErrors();
+
+            std::vector<char*> parseErrors;
+            
+            // Instance variables
+            DataFactoryPtr    dataFactory;
+            SDOXMLString targetNamespaceURI;
+
+            XMLDocumentPtr createDocument(DataObjectPtr dataObject);
+
+            DataFactoryPtr getDataFactory();
+        };
+        
+    } // End - namespace sdo
+} // End - namespace commonj
+
+#endif // _XMLHELPERIMPL_H_

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

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

Added: incubator/tuscany/cpp/sdo/runtime/core/src/commonj/sdo/XMLQName.cpp
URL: http://svn.apache.org/viewcvs/incubator/tuscany/cpp/sdo/runtime/core/src/commonj/sdo/XMLQName.cpp?rev=366158&view=auto
==============================================================================
--- incubator/tuscany/cpp/sdo/runtime/core/src/commonj/sdo/XMLQName.cpp (added)
+++ incubator/tuscany/cpp/sdo/runtime/core/src/commonj/sdo/XMLQName.cpp Thu Jan  5 02:55:00 2006
@@ -0,0 +1,84 @@
+/*
+ *
+ *  Copyright 2005 The Apache Software Foundation or its licensors, as applicable.
+ *
+ *  Licensed under the Apache License, Version 2.0 (the "License");
+ *  you may not use this file except in compliance with the License.
+ *  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ *  Unless required by applicable law or agreed to in writing, software
+ *  distributed under the License is distributed on an "AS IS" BASIS,
+ *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ *  See the License for the specific language governing permissions and
+ *  limitations under the License.
+ */
+
+/* $Rev$ $Date: 2005/12/22 16:54:15 $ */
+
+#include "commonj/sdo/XMLQName.h"
+namespace commonj
+{
+    namespace sdo
+    {
+   
+
+        XMLQName::XMLQName()
+        {
+        }
+
+        XMLQName::XMLQName(const SDOXMLString& sdouri)
+        {
+            int index = sdouri.lastIndexOf('#');
+            if (index < 0)
+            {
+                localName = sdouri;
+            }
+            else
+            {
+                uri = sdouri.substring(0, index);
+                localName = sdouri.substring(index+1);
+            }
+        }
+                
+        XMLQName::XMLQName(
+            const SDOXMLString& qname, 
+            const SAX2Namespaces& globalNamespaces,
+            const SAX2Namespaces& localNamespaces)
+        {
+            SDOXMLString prefix;
+
+            int index = qname.firstIndexOf(':');
+            if (index < 0)
+            {
+                localName = qname;
+            }
+            else
+            {
+                prefix = qname.substring(0, index);
+                localName = qname.substring(index+1);
+            }
+                
+            const SDOXMLString* namespaceURI = localNamespaces.find(prefix);
+            if (namespaceURI == 0)
+            {
+                namespaceURI = globalNamespaces.find(prefix);
+            }
+            if (namespaceURI != 0)
+            {
+                uri = *namespaceURI;
+            }
+            
+        }
+        
+        XMLQName::~XMLQName()
+        {
+        }
+        
+        SDOXMLString XMLQName::getSDOName() const
+        {
+            return uri + "#" + localName;
+        }
+    } // End - namespace sdo
+} // End - namespace commonj

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

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

Added: incubator/tuscany/cpp/sdo/runtime/core/src/commonj/sdo/XMLQName.h
URL: http://svn.apache.org/viewcvs/incubator/tuscany/cpp/sdo/runtime/core/src/commonj/sdo/XMLQName.h?rev=366158&view=auto
==============================================================================
--- incubator/tuscany/cpp/sdo/runtime/core/src/commonj/sdo/XMLQName.h (added)
+++ incubator/tuscany/cpp/sdo/runtime/core/src/commonj/sdo/XMLQName.h Thu Jan  5 02:55:00 2006
@@ -0,0 +1,66 @@
+/*
+ *
+ *  Copyright 2005 The Apache Software Foundation or its licensors, as applicable.
+ *
+ *  Licensed under the Apache License, Version 2.0 (the "License");
+ *  you may not use this file except in compliance with the License.
+ *  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ *  Unless required by applicable law or agreed to in writing, software
+ *  distributed under the License is distributed on an "AS IS" BASIS,
+ *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ *  See the License for the specific language governing permissions and
+ *  limitations under the License.
+ */
+
+/* $Rev$ $Date: 2005/12/22 16:54:15 $ */
+
+#ifndef _XMLQName_H_
+#define _XMLQName_H_
+
+#include "commonj/sdo/disable_warn.h"
+
+#include "commonj/sdo/SAX2Namespaces.h"
+#include "commonj/sdo/SDOXMLString.h"
+#include "commonj/sdo/DataObject.h"
+
+namespace commonj
+{
+    namespace sdo
+    {
+        
+/**  XMLQname  wraps a qualified name
+ *
+ * This class holds a QName and provides access to its
+ * members
+ */
+
+        class XMLQName 
+        {
+            
+        public:
+            XMLQName();
+            XMLQName(const SDOXMLString& sdoUri);
+            XMLQName(
+                const SDOXMLString& qname, 
+                const SAX2Namespaces& globalNamespaces,
+                const SAX2Namespaces& localNamespaces = SAX2Namespaces());
+
+            SDOXMLString getSDOName() const ;
+            const SDOXMLString& getURI() const {return uri;}
+            const SDOXMLString& getLocalName() const {return localName;}
+            virtual ~XMLQName();
+
+        private:
+            SDOXMLString uri;
+            SDOXMLString localName;
+            
+                        
+        };
+    } // End - namespace sdo
+} // End - namespace commonj
+
+
+#endif //_XMLQName_H_

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

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

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

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

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

Added: 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=366158&view=auto
==============================================================================
--- incubator/tuscany/cpp/sdo/runtime/core/src/commonj/sdo/XSDHelper.h (added)
+++ incubator/tuscany/cpp/sdo/runtime/core/src/commonj/sdo/XSDHelper.h Thu Jan  5 02:55:00 2006
@@ -0,0 +1,117 @@
+/*
+ *
+ *  Copyright 2005 The Apache Software Foundation or its licensors, as applicable.
+ *
+ *  Licensed under the Apache License, Version 2.0 (the "License");
+ *  you may not use this file except in compliance with the License.
+ *  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ *  Unless required by applicable law or agreed to in writing, software
+ *  distributed under the License is distributed on an "AS IS" BASIS,
+ *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ *  See the License for the specific language governing permissions and
+ *  limitations under the License.
+ */
+
+/* $Rev$ $Date: 2005/12/22 16:54:15 $ */
+
+#ifndef _XSDHELPER_H_
+#define _XSDHELPER_H_
+
+
+#include "commonj/sdo/export.h"
+#include "commonj/sdo/RefCountingObject.h"
+#include "commonj/sdo/DataFactory.h"
+
+namespace commonj
+{
+    namespace sdo
+    {
+        
+        /**  
+         *
+         * XSDHelper provides the means of loading and saving XSD information 
+         * from/to the metadata (Types and properties)
+         */
+        
+        class XSDHelper : public RefCountingObject
+        {
+        public:
+            
+            /**  define builds types/properties from file or stream
+             *
+             * define/defineFile
+             *
+             * Populates the data factory with Types and Properties from the schema
+             * Loads from file, stream or char* buffer.
+             * The return value is the URI of the root Type
+             *
+             */
+
+            SDO_API virtual const char* defineFile(const char* schemaFile) = 0;
+            SDO_API virtual const char* define(std::istream& schema) = 0;
+            SDO_API virtual const char* define(const char* schema) = 0;
+            
+
+            /**  generate buildsXSD from types/properties
+             *
+             * generate/generateFile
+             *
+             * Saves the types/properties to an XSD stream or file
+             *
+             */
+
+            SDO_API virtual char* generate(
+                const TypeList& types,
+                const char* targetNamespaceURI = "") = 0;
+            SDO_API virtual void generate(
+                const TypeList& types,
+                std::ostream& outXsd,
+                const char* targetNamespaceURI = "") = 0;
+            SDO_API virtual void generateFile(
+                const TypeList& types,
+                const char* fileName,
+                const char* targetNamespaceURI = "") = 0;
+
+            /***********************************/
+            /* Destructor */
+            /***********************************/
+            SDO_API virtual ~XSDHelper();
+
+            /**  getDataFactory() 
+             *
+             * Return the DataFactory
+             */
+
+            SDO_API virtual DataFactoryPtr getDataFactory() = 0;
+
+            /**  getRootTypeURI
+             *
+             * Return the URI for the root Type
+             */
+
+            SDO_API virtual const char* getRootTypeURI() = 0;
+            
+            /** getErrorCount gets number of parse errors
+             *
+             * Parser error count - the parse may have 
+             * succeeded or partially succeeded or failed. There
+             * may be errors to report or handle.
+             */
+
+            virtual int  getErrorCount() const = 0;
+
+            /** getErrorMessage gets the nth error message
+             *
+             * Each error has a message, usually giving the line and file
+             * in which the parser error occurred.
+             */
+
+            virtual const char* getErrorMessage(int errnum) const = 0;
+        };
+    }//End - namespace sdo
+} // End - namespace commonj
+
+#endif //_XSDHELPER_H_

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

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



Mime
View raw message