summaryrefslogtreecommitdiffstats
path: root/sdo-cpp
diff options
context:
space:
mode:
authorjsdelfino <jsdelfino@13f79535-47bb-0310-9956-ffa450edef68>2009-11-16 06:48:18 +0000
committerjsdelfino <jsdelfino@13f79535-47bb-0310-9956-ffa450edef68>2009-11-16 06:48:18 +0000
commit2cd577564c1e4a37b25f4064b84af15d112b0654 (patch)
treec2181bdc5c0e13fd9fa54b5fb9f4e4f359971303 /sdo-cpp
parentc5846d0e19e3b5fd9d818d714fea2df3f3ef90eb (diff)
Cleaning up SVN structure, moving sdo trunk to sdo-cpp/trunk.
git-svn-id: http://svn.us.apache.org/repos/asf/tuscany@880627 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'sdo-cpp')
-rw-r--r--sdo-cpp/trunk/AUTHORS0
-rwxr-xr-xsdo-cpp/trunk/COPYING203
-rw-r--r--sdo-cpp/trunk/ChangeLog0
-rw-r--r--sdo-cpp/trunk/GettingStarted.html294
-rw-r--r--sdo-cpp/trunk/INSTALL2
-rwxr-xr-xsdo-cpp/trunk/LICENSE177
-rw-r--r--sdo-cpp/trunk/Makefile.am50
-rw-r--r--sdo-cpp/trunk/NEWS0
-rw-r--r--sdo-cpp/trunk/NOTICE5
-rw-r--r--sdo-cpp/trunk/README96
-rw-r--r--sdo-cpp/trunk/README_ANT_INSTALL333
-rw-r--r--sdo-cpp/trunk/VSExpress/tuscany_sdo/Build/Build.vcproj72
-rw-r--r--sdo-cpp/trunk/VSExpress/tuscany_sdo/Build/Build.vcproj.user65
-rw-r--r--sdo-cpp/trunk/VSExpress/tuscany_sdo/sdo_axiom/sdo_axiom.vcproj263
-rw-r--r--sdo-cpp/trunk/VSExpress/tuscany_sdo/sdo_axiom_test/sdo_axiom_test.vcproj249
-rw-r--r--sdo-cpp/trunk/VSExpress/tuscany_sdo/sdo_runtime/sdo_runtime.vcproj2242
-rw-r--r--sdo-cpp/trunk/VSExpress/tuscany_sdo/sdo_test/sdo_test.vcproj336
-rw-r--r--sdo-cpp/trunk/VSExpress/tuscany_sdo/tuscany_sdo.sln59
-rw-r--r--sdo-cpp/trunk/antscripts/OpenPGP.jarbin0 -> 36696 bytes
-rw-r--r--sdo-cpp/trunk/antscripts/TuscanyMSVC8DevStudioCCompiler.jarbin0 -> 2684 bytes
-rw-r--r--sdo-cpp/trunk/antscripts/compile-targets.xml310
-rwxr-xr-xsdo-cpp/trunk/antscripts/platform.properties42
-rw-r--r--sdo-cpp/trunk/antscripts/system.xml647
-rwxr-xr-xsdo-cpp/trunk/autogen.sh31
-rw-r--r--sdo-cpp/trunk/build.bat63
-rwxr-xr-xsdo-cpp/trunk/build.sh22
-rw-r--r--sdo-cpp/trunk/build.xml244
-rw-r--r--sdo-cpp/trunk/builddist.bat146
-rwxr-xr-xsdo-cpp/trunk/builddist.sh22
-rw-r--r--sdo-cpp/trunk/configure.ac112
-rwxr-xr-xsdo-cpp/trunk/configure.sh47
-rw-r--r--sdo-cpp/trunk/doc/BuildingSTDCXX.html145
-rw-r--r--sdo-cpp/trunk/doc/CommittersGuide.txt89
-rw-r--r--sdo-cpp/trunk/doc/DesignNotes.htm259
-rw-r--r--sdo-cpp/trunk/doc/css/maven-base.css168
-rw-r--r--sdo-cpp/trunk/doc/css/maven-theme.css173
-rwxr-xr-xsdo-cpp/trunk/makebindist.sh34
-rw-r--r--sdo-cpp/trunk/runtime/Makefile.am18
-rw-r--r--sdo-cpp/trunk/runtime/core/Makefile.am22
-rw-r--r--sdo-cpp/trunk/runtime/core/build.xml187
-rw-r--r--sdo-cpp/trunk/runtime/core/interop/interop.cpp198
-rw-r--r--sdo-cpp/trunk/runtime/core/interop/interop.h32
-rw-r--r--sdo-cpp/trunk/runtime/core/interop/main.cpp88
-rw-r--r--sdo-cpp/trunk/runtime/core/interop/runinterop.bat25
-rw-r--r--sdo-cpp/trunk/runtime/core/sdo_axiom/Makefile.am38
-rw-r--r--sdo-cpp/trunk/runtime/core/sdo_axiom/deploy.bat54
-rw-r--r--sdo-cpp/trunk/runtime/core/sdo_axiom/sdo_axiom.cpp271
-rw-r--r--sdo-cpp/trunk/runtime/core/sdo_axiom/sdo_axiom.h86
-rw-r--r--sdo-cpp/trunk/runtime/core/sdo_axiom/sdo_axiom_export.h39
-rw-r--r--sdo-cpp/trunk/runtime/core/sdo_axiom_test/Makefile.am40
-rw-r--r--sdo-cpp/trunk/runtime/core/sdo_axiom_test/build.xml78
-rw-r--r--sdo-cpp/trunk/runtime/core/sdo_axiom_test/sdo_axiom_test.cpp136
-rw-r--r--sdo-cpp/trunk/runtime/core/sdo_axiom_test/sdo_axiom_test.h38
-rw-r--r--sdo-cpp/trunk/runtime/core/src/.cdtbuild62
-rw-r--r--sdo-cpp/trunk/runtime/core/src/.cdtproject34
-rw-r--r--sdo-cpp/trunk/runtime/core/src/.project38
-rw-r--r--sdo-cpp/trunk/runtime/core/src/.settings/org.eclipse.cdt.managedbuilder.core.prefs9
-rw-r--r--sdo-cpp/trunk/runtime/core/src/Makefile.am21
-rw-r--r--sdo-cpp/trunk/runtime/core/src/commonj/Makefile.am18
-rw-r--r--sdo-cpp/trunk/runtime/core/src/commonj/sdo/ChangeSummary.cpp30
-rw-r--r--sdo-cpp/trunk/runtime/core/src/commonj/sdo/ChangeSummary.h209
-rw-r--r--sdo-cpp/trunk/runtime/core/src/commonj/sdo/ChangeSummaryBuilder.cpp1163
-rw-r--r--sdo-cpp/trunk/runtime/core/src/commonj/sdo/ChangeSummaryBuilder.h303
-rw-r--r--sdo-cpp/trunk/runtime/core/src/commonj/sdo/ChangeSummaryImpl.cpp1598
-rw-r--r--sdo-cpp/trunk/runtime/core/src/commonj/sdo/ChangeSummaryImpl.h405
-rw-r--r--sdo-cpp/trunk/runtime/core/src/commonj/sdo/ChangedDataObjectList.h93
-rw-r--r--sdo-cpp/trunk/runtime/core/src/commonj/sdo/ChangedDataObjectListImpl.cpp247
-rw-r--r--sdo-cpp/trunk/runtime/core/src/commonj/sdo/ChangedDataObjectListImpl.h99
-rw-r--r--sdo-cpp/trunk/runtime/core/src/commonj/sdo/CopyHelper.cpp598
-rw-r--r--sdo-cpp/trunk/runtime/core/src/commonj/sdo/CopyHelper.h76
-rw-r--r--sdo-cpp/trunk/runtime/core/src/commonj/sdo/DASProperty.cpp34
-rw-r--r--sdo-cpp/trunk/runtime/core/src/commonj/sdo/DASProperty.h48
-rw-r--r--sdo-cpp/trunk/runtime/core/src/commonj/sdo/DASType.cpp34
-rw-r--r--sdo-cpp/trunk/runtime/core/src/commonj/sdo/DASType.h55
-rw-r--r--sdo-cpp/trunk/runtime/core/src/commonj/sdo/DASValue.cpp59
-rw-r--r--sdo-cpp/trunk/runtime/core/src/commonj/sdo/DASValue.h56
-rw-r--r--sdo-cpp/trunk/runtime/core/src/commonj/sdo/DASValues.cpp70
-rw-r--r--sdo-cpp/trunk/runtime/core/src/commonj/sdo/DASValues.h59
-rw-r--r--sdo-cpp/trunk/runtime/core/src/commonj/sdo/DataFactory.cpp46
-rw-r--r--sdo-cpp/trunk/runtime/core/src/commonj/sdo/DataFactory.h784
-rw-r--r--sdo-cpp/trunk/runtime/core/src/commonj/sdo/DataFactoryImpl.cpp1682
-rw-r--r--sdo-cpp/trunk/runtime/core/src/commonj/sdo/DataFactoryImpl.h704
-rw-r--r--sdo-cpp/trunk/runtime/core/src/commonj/sdo/DataGraph.cpp35
-rw-r--r--sdo-cpp/trunk/runtime/core/src/commonj/sdo/DataGraph.h105
-rw-r--r--sdo-cpp/trunk/runtime/core/src/commonj/sdo/DataGraphImpl.cpp147
-rw-r--r--sdo-cpp/trunk/runtime/core/src/commonj/sdo/DataGraphImpl.h112
-rw-r--r--sdo-cpp/trunk/runtime/core/src/commonj/sdo/DataObject.cpp33
-rw-r--r--sdo-cpp/trunk/runtime/core/src/commonj/sdo/DataObject.h561
-rw-r--r--sdo-cpp/trunk/runtime/core/src/commonj/sdo/DataObjectImpl.cpp4826
-rw-r--r--sdo-cpp/trunk/runtime/core/src/commonj/sdo/DataObjectImpl.h724
-rw-r--r--sdo-cpp/trunk/runtime/core/src/commonj/sdo/DataObjectList.cpp43
-rw-r--r--sdo-cpp/trunk/runtime/core/src/commonj/sdo/DataObjectList.h202
-rw-r--r--sdo-cpp/trunk/runtime/core/src/commonj/sdo/DataObjectListImpl.cpp1126
-rw-r--r--sdo-cpp/trunk/runtime/core/src/commonj/sdo/DataObjectListImpl.h221
-rw-r--r--sdo-cpp/trunk/runtime/core/src/commonj/sdo/DataTypeInfo.cpp73
-rw-r--r--sdo-cpp/trunk/runtime/core/src/commonj/sdo/DataTypeInfo.h135
-rw-r--r--sdo-cpp/trunk/runtime/core/src/commonj/sdo/DefaultLogWriter.cpp55
-rw-r--r--sdo-cpp/trunk/runtime/core/src/commonj/sdo/DefaultLogWriter.h54
-rw-r--r--sdo-cpp/trunk/runtime/core/src/commonj/sdo/EqualityHelper.cpp372
-rw-r--r--sdo-cpp/trunk/runtime/core/src/commonj/sdo/EqualityHelper.h99
-rw-r--r--sdo-cpp/trunk/runtime/core/src/commonj/sdo/GroupDefinition.cpp36
-rw-r--r--sdo-cpp/trunk/runtime/core/src/commonj/sdo/GroupDefinition.h59
-rw-r--r--sdo-cpp/trunk/runtime/core/src/commonj/sdo/GroupEvent.cpp65
-rw-r--r--sdo-cpp/trunk/runtime/core/src/commonj/sdo/GroupEvent.h70
-rw-r--r--sdo-cpp/trunk/runtime/core/src/commonj/sdo/HelperProvider.cpp49
-rw-r--r--sdo-cpp/trunk/runtime/core/src/commonj/sdo/HelperProvider.h67
-rw-r--r--sdo-cpp/trunk/runtime/core/src/commonj/sdo/LogWriter.cpp34
-rw-r--r--sdo-cpp/trunk/runtime/core/src/commonj/sdo/LogWriter.h46
-rw-r--r--sdo-cpp/trunk/runtime/core/src/commonj/sdo/Logger.cpp102
-rw-r--r--sdo-cpp/trunk/runtime/core/src/commonj/sdo/Logger.h71
-rw-r--r--sdo-cpp/trunk/runtime/core/src/commonj/sdo/Logging.h171
-rw-r--r--sdo-cpp/trunk/runtime/core/src/commonj/sdo/Makefile.am104
-rw-r--r--sdo-cpp/trunk/runtime/core/src/commonj/sdo/ParserErrorSetter.cpp40
-rw-r--r--sdo-cpp/trunk/runtime/core/src/commonj/sdo/ParserErrorSetter.h51
-rw-r--r--sdo-cpp/trunk/runtime/core/src/commonj/sdo/Property.cpp44
-rw-r--r--sdo-cpp/trunk/runtime/core/src/commonj/sdo/Property.h208
-rw-r--r--sdo-cpp/trunk/runtime/core/src/commonj/sdo/PropertyDefinition.cpp325
-rw-r--r--sdo-cpp/trunk/runtime/core/src/commonj/sdo/PropertyDefinition.h139
-rw-r--r--sdo-cpp/trunk/runtime/core/src/commonj/sdo/PropertyDefinitionImpl.cpp49
-rw-r--r--sdo-cpp/trunk/runtime/core/src/commonj/sdo/PropertyDefinitionImpl.h93
-rw-r--r--sdo-cpp/trunk/runtime/core/src/commonj/sdo/PropertyImpl.cpp594
-rw-r--r--sdo-cpp/trunk/runtime/core/src/commonj/sdo/PropertyImpl.h294
-rw-r--r--sdo-cpp/trunk/runtime/core/src/commonj/sdo/PropertyList.cpp85
-rw-r--r--sdo-cpp/trunk/runtime/core/src/commonj/sdo/PropertyList.h86
-rw-r--r--sdo-cpp/trunk/runtime/core/src/commonj/sdo/PropertySetting.cpp69
-rw-r--r--sdo-cpp/trunk/runtime/core/src/commonj/sdo/PropertySetting.h65
-rw-r--r--sdo-cpp/trunk/runtime/core/src/commonj/sdo/RefCountingObject.cpp83
-rw-r--r--sdo-cpp/trunk/runtime/core/src/commonj/sdo/RefCountingObject.h67
-rw-r--r--sdo-cpp/trunk/runtime/core/src/commonj/sdo/RefCountingPointer.cpp155
-rw-r--r--sdo-cpp/trunk/runtime/core/src/commonj/sdo/RefCountingPointer.h283
-rw-r--r--sdo-cpp/trunk/runtime/core/src/commonj/sdo/SAX2Attribute.cpp51
-rw-r--r--sdo-cpp/trunk/runtime/core/src/commonj/sdo/SAX2Attribute.h66
-rw-r--r--sdo-cpp/trunk/runtime/core/src/commonj/sdo/SAX2Attributes.cpp129
-rw-r--r--sdo-cpp/trunk/runtime/core/src/commonj/sdo/SAX2Attributes.h80
-rw-r--r--sdo-cpp/trunk/runtime/core/src/commonj/sdo/SAX2Namespaces.cpp95
-rw-r--r--sdo-cpp/trunk/runtime/core/src/commonj/sdo/SAX2Namespaces.h69
-rw-r--r--sdo-cpp/trunk/runtime/core/src/commonj/sdo/SAX2Parser.cpp539
-rw-r--r--sdo-cpp/trunk/runtime/core/src/commonj/sdo/SAX2Parser.h117
-rw-r--r--sdo-cpp/trunk/runtime/core/src/commonj/sdo/SDO.h54
-rw-r--r--sdo-cpp/trunk/runtime/core/src/commonj/sdo/SDODataConverter.cpp1117
-rw-r--r--sdo-cpp/trunk/runtime/core/src/commonj/sdo/SDODataConverter.h86
-rw-r--r--sdo-cpp/trunk/runtime/core/src/commonj/sdo/SDODate.cpp80
-rw-r--r--sdo-cpp/trunk/runtime/core/src/commonj/sdo/SDODate.h79
-rw-r--r--sdo-cpp/trunk/runtime/core/src/commonj/sdo/SDORuntimeException.cpp187
-rw-r--r--sdo-cpp/trunk/runtime/core/src/commonj/sdo/SDORuntimeException.h363
-rw-r--r--sdo-cpp/trunk/runtime/core/src/commonj/sdo/SDOSAX2Parser.cpp1561
-rw-r--r--sdo-cpp/trunk/runtime/core/src/commonj/sdo/SDOSAX2Parser.h179
-rw-r--r--sdo-cpp/trunk/runtime/core/src/commonj/sdo/SDOSPI.h27
-rw-r--r--sdo-cpp/trunk/runtime/core/src/commonj/sdo/SDOSchemaSAX2Parser.cpp1434
-rw-r--r--sdo-cpp/trunk/runtime/core/src/commonj/sdo/SDOSchemaSAX2Parser.h236
-rw-r--r--sdo-cpp/trunk/runtime/core/src/commonj/sdo/SDOString.h31
-rw-r--r--sdo-cpp/trunk/runtime/core/src/commonj/sdo/SDOUserMacros.h30
-rw-r--r--sdo-cpp/trunk/runtime/core/src/commonj/sdo/SDOUtils.cpp335
-rw-r--r--sdo-cpp/trunk/runtime/core/src/commonj/sdo/SDOUtils.h82
-rw-r--r--sdo-cpp/trunk/runtime/core/src/commonj/sdo/SDOValue.cpp236
-rw-r--r--sdo-cpp/trunk/runtime/core/src/commonj/sdo/SDOValue.h258
-rw-r--r--sdo-cpp/trunk/runtime/core/src/commonj/sdo/SDOXMLBufferWriter.cpp58
-rw-r--r--sdo-cpp/trunk/runtime/core/src/commonj/sdo/SDOXMLBufferWriter.h53
-rw-r--r--sdo-cpp/trunk/runtime/core/src/commonj/sdo/SDOXMLFileWriter.cpp46
-rw-r--r--sdo-cpp/trunk/runtime/core/src/commonj/sdo/SDOXMLFileWriter.h54
-rw-r--r--sdo-cpp/trunk/runtime/core/src/commonj/sdo/SDOXMLStreamWriter.cpp52
-rw-r--r--sdo-cpp/trunk/runtime/core/src/commonj/sdo/SDOXMLStreamWriter.h56
-rw-r--r--sdo-cpp/trunk/runtime/core/src/commonj/sdo/SDOXMLString.cpp235
-rw-r--r--sdo-cpp/trunk/runtime/core/src/commonj/sdo/SDOXMLString.h96
-rw-r--r--sdo-cpp/trunk/runtime/core/src/commonj/sdo/SDOXMLWriter.cpp1419
-rw-r--r--sdo-cpp/trunk/runtime/core/src/commonj/sdo/SDOXMLWriter.h147
-rw-r--r--sdo-cpp/trunk/runtime/core/src/commonj/sdo/SDOXSDBufferWriter.cpp56
-rw-r--r--sdo-cpp/trunk/runtime/core/src/commonj/sdo/SDOXSDBufferWriter.h54
-rw-r--r--sdo-cpp/trunk/runtime/core/src/commonj/sdo/SDOXSDFileWriter.cpp45
-rw-r--r--sdo-cpp/trunk/runtime/core/src/commonj/sdo/SDOXSDFileWriter.h53
-rw-r--r--sdo-cpp/trunk/runtime/core/src/commonj/sdo/SDOXSDStreamWriter.cpp53
-rw-r--r--sdo-cpp/trunk/runtime/core/src/commonj/sdo/SDOXSDStreamWriter.h57
-rw-r--r--sdo-cpp/trunk/runtime/core/src/commonj/sdo/SDOXSDWriter.cpp849
-rw-r--r--sdo-cpp/trunk/runtime/core/src/commonj/sdo/SDOXSDWriter.h77
-rw-r--r--sdo-cpp/trunk/runtime/core/src/commonj/sdo/SchemaInfo.cpp39
-rw-r--r--sdo-cpp/trunk/runtime/core/src/commonj/sdo/SchemaInfo.h64
-rw-r--r--sdo-cpp/trunk/runtime/core/src/commonj/sdo/SdoCheck.cpp29
-rw-r--r--sdo-cpp/trunk/runtime/core/src/commonj/sdo/SdoCheck.h35
-rw-r--r--sdo-cpp/trunk/runtime/core/src/commonj/sdo/SdoRuntime.cpp66
-rw-r--r--sdo-cpp/trunk/runtime/core/src/commonj/sdo/SdoRuntime.h76
-rw-r--r--sdo-cpp/trunk/runtime/core/src/commonj/sdo/Sequence.cpp39
-rw-r--r--sdo-cpp/trunk/runtime/core/src/commonj/sdo/Sequence.h319
-rw-r--r--sdo-cpp/trunk/runtime/core/src/commonj/sdo/SequenceImpl.cpp1314
-rw-r--r--sdo-cpp/trunk/runtime/core/src/commonj/sdo/SequenceImpl.h403
-rw-r--r--sdo-cpp/trunk/runtime/core/src/commonj/sdo/Setting.cpp308
-rw-r--r--sdo-cpp/trunk/runtime/core/src/commonj/sdo/Setting.h151
-rw-r--r--sdo-cpp/trunk/runtime/core/src/commonj/sdo/SettingList.cpp114
-rw-r--r--sdo-cpp/trunk/runtime/core/src/commonj/sdo/SettingList.h77
-rw-r--r--sdo-cpp/trunk/runtime/core/src/commonj/sdo/Type.cpp36
-rw-r--r--sdo-cpp/trunk/runtime/core/src/commonj/sdo/Type.h228
-rw-r--r--sdo-cpp/trunk/runtime/core/src/commonj/sdo/TypeDefinition.cpp259
-rw-r--r--sdo-cpp/trunk/runtime/core/src/commonj/sdo/TypeDefinition.h125
-rw-r--r--sdo-cpp/trunk/runtime/core/src/commonj/sdo/TypeDefinitionImpl.cpp50
-rw-r--r--sdo-cpp/trunk/runtime/core/src/commonj/sdo/TypeDefinitionImpl.h87
-rw-r--r--sdo-cpp/trunk/runtime/core/src/commonj/sdo/TypeDefinitions.cpp89
-rw-r--r--sdo-cpp/trunk/runtime/core/src/commonj/sdo/TypeDefinitions.h72
-rw-r--r--sdo-cpp/trunk/runtime/core/src/commonj/sdo/TypeDefinitionsImpl.cpp54
-rw-r--r--sdo-cpp/trunk/runtime/core/src/commonj/sdo/TypeDefinitionsImpl.h61
-rw-r--r--sdo-cpp/trunk/runtime/core/src/commonj/sdo/TypeImpl.cpp4065
-rw-r--r--sdo-cpp/trunk/runtime/core/src/commonj/sdo/TypeImpl.h337
-rw-r--r--sdo-cpp/trunk/runtime/core/src/commonj/sdo/TypeList.cpp86
-rw-r--r--sdo-cpp/trunk/runtime/core/src/commonj/sdo/TypeList.h58
-rw-r--r--sdo-cpp/trunk/runtime/core/src/commonj/sdo/XMLDocument.cpp33
-rw-r--r--sdo-cpp/trunk/runtime/core/src/commonj/sdo/XMLDocument.h151
-rw-r--r--sdo-cpp/trunk/runtime/core/src/commonj/sdo/XMLDocumentImpl.cpp87
-rw-r--r--sdo-cpp/trunk/runtime/core/src/commonj/sdo/XMLDocumentImpl.h102
-rw-r--r--sdo-cpp/trunk/runtime/core/src/commonj/sdo/XMLHelper.cpp36
-rw-r--r--sdo-cpp/trunk/runtime/core/src/commonj/sdo/XMLHelper.h184
-rw-r--r--sdo-cpp/trunk/runtime/core/src/commonj/sdo/XMLHelperImpl.cpp397
-rw-r--r--sdo-cpp/trunk/runtime/core/src/commonj/sdo/XMLHelperImpl.h184
-rw-r--r--sdo-cpp/trunk/runtime/core/src/commonj/sdo/XMLQName.cpp86
-rw-r--r--sdo-cpp/trunk/runtime/core/src/commonj/sdo/XMLQName.h68
-rw-r--r--sdo-cpp/trunk/runtime/core/src/commonj/sdo/XSDHelper.cpp37
-rw-r--r--sdo-cpp/trunk/runtime/core/src/commonj/sdo/XSDHelper.h139
-rw-r--r--sdo-cpp/trunk/runtime/core/src/commonj/sdo/XSDHelperImpl.cpp602
-rw-r--r--sdo-cpp/trunk/runtime/core/src/commonj/sdo/XSDHelperImpl.h172
-rw-r--r--sdo-cpp/trunk/runtime/core/src/commonj/sdo/XSDPropertyInfo.cpp56
-rw-r--r--sdo-cpp/trunk/runtime/core/src/commonj/sdo/XSDPropertyInfo.h66
-rw-r--r--sdo-cpp/trunk/runtime/core/src/commonj/sdo/XSDTypeInfo.cpp55
-rw-r--r--sdo-cpp/trunk/runtime/core/src/commonj/sdo/XSDTypeInfo.h59
-rw-r--r--sdo-cpp/trunk/runtime/core/src/commonj/sdo/XpathHelper.cpp88
-rw-r--r--sdo-cpp/trunk/runtime/core/src/commonj/sdo/XpathHelper.h57
-rw-r--r--sdo-cpp/trunk/runtime/core/src/commonj/sdo/disable_warn.h29
-rw-r--r--sdo-cpp/trunk/runtime/core/src/commonj/sdo/export.h51
-rw-r--r--sdo-cpp/trunk/runtime/core/src/deploy.bat58
-rw-r--r--sdo-cpp/trunk/runtime/core/test/.cdtbuild59
-rw-r--r--sdo-cpp/trunk/runtime/core/test/.settings/org.eclipse.cdt.managedbuilder.core.prefs9
-rw-r--r--sdo-cpp/trunk/runtime/core/test/47293Catalog.xml22
-rw-r--r--sdo-cpp/trunk/runtime/core/test/47293Catalog.xsd35
-rw-r--r--sdo-cpp/trunk/runtime/core/test/47293Customer.xsd50
-rw-r--r--sdo-cpp/trunk/runtime/core/test/47293Order.xsd67
-rw-r--r--sdo-cpp/trunk/runtime/core/test/48601.xsd46
-rw-r--r--sdo-cpp/trunk/runtime/core/test/48686.xml31
-rw-r--r--sdo-cpp/trunk/runtime/core/test/48686.xsd42
-rw-r--r--sdo-cpp/trunk/runtime/core/test/48736.xml30
-rw-r--r--sdo-cpp/trunk/runtime/core/test/48736.xsd49
-rw-r--r--sdo-cpp/trunk/runtime/core/test/48736_xml.txt42
-rw-r--r--sdo-cpp/trunk/runtime/core/test/48736_xsd.txt29
-rw-r--r--sdo-cpp/trunk/runtime/core/test/Atom1.0.xsd205
-rw-r--r--sdo-cpp/trunk/runtime/core/test/BadElement.xml29
-rw-r--r--sdo-cpp/trunk/runtime/core/test/BadElement.xsd102
-rw-r--r--sdo-cpp/trunk/runtime/core/test/Catalog.xsd34
-rw-r--r--sdo-cpp/trunk/runtime/core/test/Customer.xsd47
-rw-r--r--sdo-cpp/trunk/runtime/core/test/Makefile.am32
-rw-r--r--sdo-cpp/trunk/runtime/core/test/OddChars.xml27
-rw-r--r--sdo-cpp/trunk/runtime/core/test/OddChars.xsd103
-rw-r--r--sdo-cpp/trunk/runtime/core/test/Order.xsd59
-rw-r--r--sdo-cpp/trunk/runtime/core/test/Readme.txt108
-rw-r--r--sdo-cpp/trunk/runtime/core/test/SdoGenerate.cpp169
-rw-r--r--sdo-cpp/trunk/runtime/core/test/StockQuoteService.wsdl176
-rw-r--r--sdo-cpp/trunk/runtime/core/test/Style1.xsd72
-rw-r--r--sdo-cpp/trunk/runtime/core/test/Style2.xsd74
-rw-r--r--sdo-cpp/trunk/runtime/core/test/Style3.xsd74
-rw-r--r--sdo-cpp/trunk/runtime/core/test/Style4.xsd80
-rw-r--r--sdo-cpp/trunk/runtime/core/test/TravelBookingSchema.xsd103
-rw-r--r--sdo-cpp/trunk/runtime/core/test/TravelBookingUsingSchema.xml67
-rw-r--r--sdo-cpp/trunk/runtime/core/test/axis.xsd40
-rw-r--r--sdo-cpp/trunk/runtime/core/test/b46617b.xml27
-rw-r--r--sdo-cpp/trunk/runtime/core/test/b46617b.xsd79
-rw-r--r--sdo-cpp/trunk/runtime/core/test/b46633.txt8
-rw-r--r--sdo-cpp/trunk/runtime/core/test/b46634_out.txt2
-rw-r--r--sdo-cpp/trunk/runtime/core/test/b46693.xsd176
-rw-r--r--sdo-cpp/trunk/runtime/core/test/b47137.txt6
-rw-r--r--sdo-cpp/trunk/runtime/core/test/b47137.xsd32
-rw-r--r--sdo-cpp/trunk/runtime/core/test/b47137b.txt31
-rw-r--r--sdo-cpp/trunk/runtime/core/test/b47137b.xsd59
-rw-r--r--sdo-cpp/trunk/runtime/core/test/b47293.txt27
-rw-r--r--sdo-cpp/trunk/runtime/core/test/b48602.xsd29
-rw-r--r--sdo-cpp/trunk/runtime/core/test/b48633.xml29
-rw-r--r--sdo-cpp/trunk/runtime/core/test/b48633.xsd41
-rw-r--r--sdo-cpp/trunk/runtime/core/test/b48633_xml.txt10
-rw-r--r--sdo-cpp/trunk/runtime/core/test/b48633b.xsd26
-rw-r--r--sdo-cpp/trunk/runtime/core/test/b48633b_xsd.txt31
-rw-r--r--sdo-cpp/trunk/runtime/core/test/b48636.xml29
-rw-r--r--sdo-cpp/trunk/runtime/core/test/b48636.xsd36
-rw-r--r--sdo-cpp/trunk/runtime/core/test/b48636_xml.txt36
-rw-r--r--sdo-cpp/trunk/runtime/core/test/b48636_xsd.txt26
-rw-r--r--sdo-cpp/trunk/runtime/core/test/b48686.xml30
-rw-r--r--sdo-cpp/trunk/runtime/core/test/b48686.xsd41
-rw-r--r--sdo-cpp/trunk/runtime/core/test/b48686_xml.txt46
-rw-r--r--sdo-cpp/trunk/runtime/core/test/b48686_xsd.txt28
-rw-r--r--sdo-cpp/trunk/runtime/core/test/badelement.txt2
-rw-r--r--sdo-cpp/trunk/runtime/core/test/bothgroups.xsd44
-rw-r--r--sdo-cpp/trunk/runtime/core/test/bothgroups_xsd.txt29
-rw-r--r--sdo-cpp/trunk/runtime/core/test/bothgroupssamename.xsd44
-rw-r--r--sdo-cpp/trunk/runtime/core/test/bothgroupssamename_xsd.txt29
-rw-r--r--sdo-cpp/trunk/runtime/core/test/bug2.txt9
-rw-r--r--sdo-cpp/trunk/runtime/core/test/bug45933-output.txt2
-rw-r--r--sdo-cpp/trunk/runtime/core/test/bug48300.xml174
-rw-r--r--sdo-cpp/trunk/runtime/core/test/bug48300.xsd84
-rw-r--r--sdo-cpp/trunk/runtime/core/test/bug48300_xml.txt424
-rw-r--r--sdo-cpp/trunk/runtime/core/test/bug48300_xsd.txt58
-rw-r--r--sdo-cpp/trunk/runtime/core/test/bugs/1/company.xml41
-rw-r--r--sdo-cpp/trunk/runtime/core/test/bugs/1/company.xsd64
-rw-r--r--sdo-cpp/trunk/runtime/core/test/bugs/1/include.xsd69
-rw-r--r--sdo-cpp/trunk/runtime/core/test/bugs/1/ok1.xsd34
-rw-r--r--sdo-cpp/trunk/runtime/core/test/bugs/1/ok2.xsd33
-rw-r--r--sdo-cpp/trunk/runtime/core/test/bugs/1/ok3.xsd32
-rw-r--r--sdo-cpp/trunk/runtime/core/test/build.xml71
-rw-r--r--sdo-cpp/trunk/runtime/core/test/bunique-out.txt1
-rw-r--r--sdo-cpp/trunk/runtime/core/test/bunique-out.xsd_safe.txt53
-rw-r--r--sdo-cpp/trunk/runtime/core/test/bunique-outxml.txt2
-rw-r--r--sdo-cpp/trunk/runtime/core/test/buniqueread-out.txt2
-rw-r--r--sdo-cpp/trunk/runtime/core/test/calculator.xsd32
-rw-r--r--sdo-cpp/trunk/runtime/core/test/calculator2.wsdl90
-rw-r--r--sdo-cpp/trunk/runtime/core/test/calculator2a.wsdl88
-rw-r--r--sdo-cpp/trunk/runtime/core/test/carotest3.txt36
-rw-r--r--sdo-cpp/trunk/runtime/core/test/cdata-in.xml29
-rw-r--r--sdo-cpp/trunk/runtime/core/test/cdata-out.xml2
-rw-r--r--sdo-cpp/trunk/runtime/core/test/cdata.xsd39
-rw-r--r--sdo-cpp/trunk/runtime/core/test/clone-in.xml29
-rw-r--r--sdo-cpp/trunk/runtime/core/test/clone-out-win.xml8
-rw-r--r--sdo-cpp/trunk/runtime/core/test/clone-out.xml9
-rw-r--r--sdo-cpp/trunk/runtime/core/test/clone.xsd33
-rw-r--r--sdo-cpp/trunk/runtime/core/test/company.xsd50
-rw-r--r--sdo-cpp/trunk/runtime/core/test/company_with_nillable_SN.xml30
-rw-r--r--sdo-cpp/trunk/runtime/core/test/company_with_nillable_SN.xsd49
-rw-r--r--sdo-cpp/trunk/runtime/core/test/companyabs.xsd65
-rw-r--r--sdo-cpp/trunk/runtime/core/test/companyref.xsd67
-rw-r--r--sdo-cpp/trunk/runtime/core/test/companysubs.xsd64
-rw-r--r--sdo-cpp/trunk/runtime/core/test/csload-output.txt2
-rw-r--r--sdo-cpp/trunk/runtime/core/test/csload2-output.txt2
-rw-r--r--sdo-cpp/trunk/runtime/core/test/csload3-output.txt2
-rw-r--r--sdo-cpp/trunk/runtime/core/test/cssave-output.txt2
-rw-r--r--sdo-cpp/trunk/runtime/core/test/cssave2-output.txt2
-rw-r--r--sdo-cpp/trunk/runtime/core/test/datetest.txt4
-rw-r--r--sdo-cpp/trunk/runtime/core/test/defaults.txt10
-rw-r--r--sdo-cpp/trunk/runtime/core/test/doctest.txt2
-rw-r--r--sdo-cpp/trunk/runtime/core/test/doctest.xml27
-rw-r--r--sdo-cpp/trunk/runtime/core/test/doctest.xsd48
-rw-r--r--sdo-cpp/trunk/runtime/core/test/elementFormDefaultQualifiedSeq.xsd40
-rw-r--r--sdo-cpp/trunk/runtime/core/test/elementFormDefaultQualifiedSeq_expected.xml4
-rw-r--r--sdo-cpp/trunk/runtime/core/test/employee.xsd45
-rw-r--r--sdo-cpp/trunk/runtime/core/test/emptycs1.txt2
-rw-r--r--sdo-cpp/trunk/runtime/core/test/emptycs2.txt2
-rw-r--r--sdo-cpp/trunk/runtime/core/test/emptycs3.txt2
-rw-r--r--sdo-cpp/trunk/runtime/core/test/error1.xml30
-rw-r--r--sdo-cpp/trunk/runtime/core/test/error1.xsd49
-rw-r--r--sdo-cpp/trunk/runtime/core/test/extension.xsd58
-rw-r--r--sdo-cpp/trunk/runtime/core/test/fidelity.xml49
-rw-r--r--sdo-cpp/trunk/runtime/core/test/fidelity.xsd92
-rw-r--r--sdo-cpp/trunk/runtime/core/test/g/gCustomer.xsd50
-rw-r--r--sdo-cpp/trunk/runtime/core/test/g/gOrder.xml21
-rw-r--r--sdo-cpp/trunk/runtime/core/test/g/gOrder.xsd58
-rw-r--r--sdo-cpp/trunk/runtime/core/test/g3.xsd41
-rw-r--r--sdo-cpp/trunk/runtime/core/test/getproptest.txt8
-rw-r--r--sdo-cpp/trunk/runtime/core/test/graham1.xsd40
-rw-r--r--sdo-cpp/trunk/runtime/core/test/graham2.xsd39
-rw-r--r--sdo-cpp/trunk/runtime/core/test/graham3.xsd41
-rw-r--r--sdo-cpp/trunk/runtime/core/test/groupingroup.xsd45
-rw-r--r--sdo-cpp/trunk/runtime/core/test/groupingroup_xsd.txt25
-rw-r--r--sdo-cpp/trunk/runtime/core/test/grouprefingroup.xsd45
-rw-r--r--sdo-cpp/trunk/runtime/core/test/grouprefingroup_xsd.txt29
-rw-r--r--sdo-cpp/trunk/runtime/core/test/grouptoolate.xsd37
-rw-r--r--sdo-cpp/trunk/runtime/core/test/grouptoolate_xsd.txt26
-rw-r--r--sdo-cpp/trunk/runtime/core/test/groupwithprefix.xsd37
-rw-r--r--sdo-cpp/trunk/runtime/core/test/groupwithprefix_xsd.txt26
-rw-r--r--sdo-cpp/trunk/runtime/core/test/groupwrongname.xsd38
-rw-r--r--sdo-cpp/trunk/runtime/core/test/inc1.txt22
-rw-r--r--sdo-cpp/trunk/runtime/core/test/inc2.txt21
-rw-r--r--sdo-cpp/trunk/runtime/core/test/include.xsd34
-rw-r--r--sdo-cpp/trunk/runtime/core/test/include1.xsd38
-rw-r--r--sdo-cpp/trunk/runtime/core/test/include2.xsd37
-rw-r--r--sdo-cpp/trunk/runtime/core/test/includeother3.xsd34
-rw-r--r--sdo-cpp/trunk/runtime/core/test/jira1112expected.xml9
-rw-r--r--sdo-cpp/trunk/runtime/core/test/jira490.txt53
-rw-r--r--sdo-cpp/trunk/runtime/core/test/jira705.xsd31
-rw-r--r--sdo-cpp/trunk/runtime/core/test/jira705_out.txt5
-rw-r--r--sdo-cpp/trunk/runtime/core/test/jira980_animaltypes.xsd39
-rw-r--r--sdo-cpp/trunk/runtime/core/test/jira980_jungle.xsd28
-rw-r--r--sdo-cpp/trunk/runtime/core/test/jira980_jungle_out.txt2
-rw-r--r--sdo-cpp/trunk/runtime/core/test/jira980_mixedJungle.xsd28
-rw-r--r--sdo-cpp/trunk/runtime/core/test/jira980_mixedJungle_out.txt2
-rw-r--r--sdo-cpp/trunk/runtime/core/test/jira980_splitJungle_out.txt2
-rw-r--r--sdo-cpp/trunk/runtime/core/test/list1.xml32
-rw-r--r--sdo-cpp/trunk/runtime/core/test/list1.xsd44
-rw-r--r--sdo-cpp/trunk/runtime/core/test/list1_xml.txt70
-rw-r--r--sdo-cpp/trunk/runtime/core/test/list1_xsd.txt28
-rw-r--r--sdo-cpp/trunk/runtime/core/test/loadload-output.txt2
-rw-r--r--sdo-cpp/trunk/runtime/core/test/main.cpp220
-rw-r--r--sdo-cpp/trunk/runtime/core/test/maintest.txt188
-rw-r--r--sdo-cpp/trunk/runtime/core/test/many.xml33
-rw-r--r--sdo-cpp/trunk/runtime/core/test/many.xsd21
-rw-r--r--sdo-cpp/trunk/runtime/core/test/matttest1.txt2
-rw-r--r--sdo-cpp/trunk/runtime/core/test/merle1.txt10
-rw-r--r--sdo-cpp/trunk/runtime/core/test/my-core.xsd40
-rw-r--r--sdo-cpp/trunk/runtime/core/test/my-implementation-local-java.xsd43
-rw-r--r--sdo-cpp/trunk/runtime/core/test/my.xsd31
-rw-r--r--sdo-cpp/trunk/runtime/core/test/noschema.xml2
-rw-r--r--sdo-cpp/trunk/runtime/core/test/notns.txt2
-rw-r--r--sdo-cpp/trunk/runtime/core/test/nulltest.txt91
-rw-r--r--sdo-cpp/trunk/runtime/core/test/oddchars.txt22
-rw-r--r--sdo-cpp/trunk/runtime/core/test/openloadNS.xml32
-rw-r--r--sdo-cpp/trunk/runtime/core/test/openloadNS.xsd53
-rw-r--r--sdo-cpp/trunk/runtime/core/test/openloadNS2.xml32
-rw-r--r--sdo-cpp/trunk/runtime/core/test/openloadNS2.xsd28
-rw-r--r--sdo-cpp/trunk/runtime/core/test/openloadNSout.txt2
-rw-r--r--sdo-cpp/trunk/runtime/core/test/openseq.txt3
-rw-r--r--sdo-cpp/trunk/runtime/core/test/order1.txt19
-rw-r--r--sdo-cpp/trunk/runtime/core/test/order2.txt19
-rw-r--r--sdo-cpp/trunk/runtime/core/test/overlappingtypes.xsd57
-rw-r--r--sdo-cpp/trunk/runtime/core/test/partial.xml33
-rw-r--r--sdo-cpp/trunk/runtime/core/test/person.xsd34
-rw-r--r--sdo-cpp/trunk/runtime/core/test/pete.xml40
-rw-r--r--sdo-cpp/trunk/runtime/core/test/pete.xsd42
-rw-r--r--sdo-cpp/trunk/runtime/core/test/qualified.xml2
-rw-r--r--sdo-cpp/trunk/runtime/core/test/querytest.txt17
-rw-r--r--sdo-cpp/trunk/runtime/core/test/saveopen-output.txt2
-rw-r--r--sdo-cpp/trunk/runtime/core/test/sca-binding-sca.xsd41
-rw-r--r--sdo-cpp/trunk/runtime/core/test/sca-binding-webservice.xsd40
-rw-r--r--sdo-cpp/trunk/runtime/core/test/sca-binding-ws.xsd41
-rw-r--r--sdo-cpp/trunk/runtime/core/test/sca-core.xsd233
-rw-r--r--sdo-cpp/trunk/runtime/core/test/sca-implementation-dll.xsd41
-rw-r--r--sdo-cpp/trunk/runtime/core/test/sca-implementation-java.xsd41
-rw-r--r--sdo-cpp/trunk/runtime/core/test/sca-implementation-local-java.xsd43
-rw-r--r--sdo-cpp/trunk/runtime/core/test/sca-interface-cpp.xsd68
-rw-r--r--sdo-cpp/trunk/runtime/core/test/sca-interface-java.xsd44
-rw-r--r--sdo-cpp/trunk/runtime/core/test/sca-interface-wsdl.xsd43
-rw-r--r--sdo-cpp/trunk/runtime/core/test/sca-property-java.xsd43
-rw-r--r--sdo-cpp/trunk/runtime/core/test/sca-property-xsd.xsd41
-rw-r--r--sdo-cpp/trunk/runtime/core/test/sca.xsd41
-rw-r--r--sdo-cpp/trunk/runtime/core/test/scenario1.txt10
-rw-r--r--sdo-cpp/trunk/runtime/core/test/scenario2.txt8
-rw-r--r--sdo-cpp/trunk/runtime/core/test/scenario3.txt22
-rw-r--r--sdo-cpp/trunk/runtime/core/test/scenario4.txt108
-rw-r--r--sdo-cpp/trunk/runtime/core/test/scenario5.txt8
-rw-r--r--sdo-cpp/trunk/runtime/core/test/sdotest.cpp9466
-rw-r--r--sdo-cpp/trunk/runtime/core/test/sdotest.h220
-rw-r--r--sdo-cpp/trunk/runtime/core/test/sdotest2.cpp2226
-rw-r--r--sdo-cpp/trunk/runtime/core/test/sequence.txt45
-rw-r--r--sdo-cpp/trunk/runtime/core/test/setmany.txt23
-rw-r--r--sdo-cpp/trunk/runtime/core/test/setnull.txt42
-rw-r--r--sdo-cpp/trunk/runtime/core/test/showdefault1.txt15
-rw-r--r--sdo-cpp/trunk/runtime/core/test/showdefault2.txt18
-rw-r--r--sdo-cpp/trunk/runtime/core/test/simple.txt8
-rw-r--r--sdo-cpp/trunk/runtime/core/test/simple.xml21
-rw-r--r--sdo-cpp/trunk/runtime/core/test/simple.xsd23
-rw-r--r--sdo-cpp/trunk/runtime/core/test/stock.wsdl407
-rw-r--r--sdo-cpp/trunk/runtime/core/test/stock.xml45
-rw-r--r--sdo-cpp/trunk/runtime/core/test/stock_wsdl.txt47
-rw-r--r--sdo-cpp/trunk/runtime/core/test/stock_xml.txt127
-rw-r--r--sdo-cpp/trunk/runtime/core/test/t2/include3.xsd34
-rw-r--r--sdo-cpp/trunk/runtime/core/test/t2/includeother.xsd34
-rw-r--r--sdo-cpp/trunk/runtime/core/test/t2/includeother1.xsd38
-rw-r--r--sdo-cpp/trunk/runtime/core/test/t2/includeother2.xsd37
-rw-r--r--sdo-cpp/trunk/runtime/core/test/test/include3.xsd35
-rw-r--r--sdo-cpp/trunk/runtime/core/test/test/includeother.xsd34
-rw-r--r--sdo-cpp/trunk/runtime/core/test/test/includeother1.xsd38
-rw-r--r--sdo-cpp/trunk/runtime/core/test/test/includeother2.xsd37
-rw-r--r--sdo-cpp/trunk/runtime/core/test/test2/includeother3.xsd35
-rw-r--r--sdo-cpp/trunk/runtime/core/test/testabstract.txt5
-rw-r--r--sdo-cpp/trunk/runtime/core/test/testerrors.txt5
-rw-r--r--sdo-cpp/trunk/runtime/core/test/testinc2.txt21
-rw-r--r--sdo-cpp/trunk/runtime/core/test/testopen.txt24
-rw-r--r--sdo-cpp/trunk/runtime/core/test/testopen3.xml21
-rw-r--r--sdo-cpp/trunk/runtime/core/test/testorder.txt19
-rw-r--r--sdo-cpp/trunk/runtime/core/test/teststyles.txt93
-rw-r--r--sdo-cpp/trunk/runtime/core/test/testsubsload.txt7
-rw-r--r--sdo-cpp/trunk/runtime/core/test/testutils.txt100
-rw-r--r--sdo-cpp/trunk/runtime/core/test/testwsdl.txt2
-rw-r--r--sdo-cpp/trunk/runtime/core/test/testwsdl.xml22
-rw-r--r--sdo-cpp/trunk/runtime/core/test/travel.txt146
-rw-r--r--sdo-cpp/trunk/runtime/core/test/tuscany963.out.xml.txt2
-rw-r--r--sdo-cpp/trunk/runtime/core/test/tuscany963.xml21
-rw-r--r--sdo-cpp/trunk/runtime/core/test/tuscany963.xsd44
-rw-r--r--sdo-cpp/trunk/runtime/core/test/types.xsd34
-rw-r--r--sdo-cpp/trunk/runtime/core/test/userdata.txt10
-rw-r--r--sdo-cpp/trunk/runtime/core/test/utils.cpp551
-rw-r--r--sdo-cpp/trunk/runtime/core/test/xhtml_in.xml60
-rw-r--r--sdo-cpp/trunk/runtime/core/test/xhtml_out.txt41
-rw-r--r--sdo-cpp/trunk/runtime/core/test/xsiTypeAbstract.xsd44
-rw-r--r--sdo-cpp/trunk/runtime/core/test/xsiTypeAbstract_expected.xml4
-rw-r--r--sdo-cpp/trunk/samples/AUTHORS0
-rwxr-xr-xsdo-cpp/trunk/samples/COPYING203
-rw-r--r--sdo-cpp/trunk/samples/ChangeLog0
-rw-r--r--sdo-cpp/trunk/samples/GettingStarted.html236
-rw-r--r--sdo-cpp/trunk/samples/INSTALL2
-rwxr-xr-xsdo-cpp/trunk/samples/LICENSE177
-rw-r--r--sdo-cpp/trunk/samples/Makefile.am20
-rw-r--r--sdo-cpp/trunk/samples/NEWS0
-rw-r--r--sdo-cpp/trunk/samples/NOTICE5
-rw-r--r--sdo-cpp/trunk/samples/README2
-rwxr-xr-xsdo-cpp/trunk/samples/autogen.sh31
-rwxr-xr-xsdo-cpp/trunk/samples/build.sh22
-rw-r--r--sdo-cpp/trunk/samples/build.xml68
-rw-r--r--sdo-cpp/trunk/samples/configure.ac73
-rw-r--r--sdo-cpp/trunk/samples/misc/ChangeSummarySave.cpp188
-rw-r--r--sdo-cpp/trunk/samples/misc/ChangeSummarySave.xsd49
-rw-r--r--sdo-cpp/trunk/samples/misc/Makefile.am40
-rw-r--r--sdo-cpp/trunk/samples/misc/ObjectCreation.cpp251
-rw-r--r--sdo-cpp/trunk/samples/misc/Query.cpp178
-rw-r--r--sdo-cpp/trunk/samples/misc/Substitutes.cpp121
-rw-r--r--sdo-cpp/trunk/samples/misc/VSExpress/misc.sln20
-rw-r--r--sdo-cpp/trunk/samples/misc/VSExpress/sdo_misc/sdo_misc.vcproj245
-rw-r--r--sdo-cpp/trunk/samples/misc/VSExpress/sdo_misc/sdo_misc.vcproj.user65
-rw-r--r--sdo-cpp/trunk/samples/misc/XSDLoading.cpp110
-rw-r--r--sdo-cpp/trunk/samples/misc/XSDLoading.xml30
-rw-r--r--sdo-cpp/trunk/samples/misc/XSDLoading.xsd48
-rw-r--r--sdo-cpp/trunk/samples/misc/build.bat40
-rw-r--r--sdo-cpp/trunk/samples/misc/build.xml133
-rw-r--r--sdo-cpp/trunk/samples/misc/companysubs.xsd63
-rw-r--r--sdo-cpp/trunk/samples/misc/deploy.bat52
-rw-r--r--sdo-cpp/trunk/samples/misc/samples.cpp36
-rw-r--r--sdo-cpp/trunk/samples/misc/samples.h54
-rw-r--r--sdo-cpp/trunk/sdotest.bat37
-rwxr-xr-xsdo-cpp/trunk/sdotest.sh35
506 files changed, 77590 insertions, 0 deletions
diff --git a/sdo-cpp/trunk/AUTHORS b/sdo-cpp/trunk/AUTHORS
new file mode 100644
index 0000000000..e69de29bb2
--- /dev/null
+++ b/sdo-cpp/trunk/AUTHORS
diff --git a/sdo-cpp/trunk/COPYING b/sdo-cpp/trunk/COPYING
new file mode 100755
index 0000000000..6b0b1270ff
--- /dev/null
+++ b/sdo-cpp/trunk/COPYING
@@ -0,0 +1,203 @@
+
+ Apache License
+ Version 2.0, January 2004
+ http://www.apache.org/licenses/
+
+ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
+
+ 1. Definitions.
+
+ "License" shall mean the terms and conditions for use, reproduction,
+ and distribution as defined by Sections 1 through 9 of this document.
+
+ "Licensor" shall mean the copyright owner or entity authorized by
+ the copyright owner that is granting the License.
+
+ "Legal Entity" shall mean the union of the acting entity and all
+ other entities that control, are controlled by, or are under common
+ control with that entity. For the purposes of this definition,
+ "control" means (i) the power, direct or indirect, to cause the
+ direction or management of such entity, whether by contract or
+ otherwise, or (ii) ownership of fifty percent (50%) or more of the
+ outstanding shares, or (iii) beneficial ownership of such entity.
+
+ "You" (or "Your") shall mean an individual or Legal Entity
+ exercising permissions granted by this License.
+
+ "Source" form shall mean the preferred form for making modifications,
+ including but not limited to software source code, documentation
+ source, and configuration files.
+
+ "Object" form shall mean any form resulting from mechanical
+ transformation or translation of a Source form, including but
+ not limited to compiled object code, generated documentation,
+ and conversions to other media types.
+
+ "Work" shall mean the work of authorship, whether in Source or
+ Object form, made available under the License, as indicated by a
+ copyright notice that is included in or attached to the work
+ (an example is provided in the Appendix below).
+
+ "Derivative Works" shall mean any work, whether in Source or Object
+ form, that is based on (or derived from) the Work and for which the
+ editorial revisions, annotations, elaborations, or other modifications
+ represent, as a whole, an original work of authorship. For the purposes
+ of this License, Derivative Works shall not include works that remain
+ separable from, or merely link (or bind by name) to the interfaces of,
+ the Work and Derivative Works thereof.
+
+ "Contribution" shall mean any work of authorship, including
+ the original version of the Work and any modifications or additions
+ to that Work or Derivative Works thereof, that is intentionally
+ submitted to Licensor for inclusion in the Work by the copyright owner
+ or by an individual or Legal Entity authorized to submit on behalf of
+ the copyright owner. For the purposes of this definition, "submitted"
+ means any form of electronic, verbal, or written communication sent
+ to the Licensor or its representatives, including but not limited to
+ communication on electronic mailing lists, source code control systems,
+ and issue tracking systems that are managed by, or on behalf of, the
+ Licensor for the purpose of discussing and improving the Work, but
+ excluding communication that is conspicuously marked or otherwise
+ designated in writing by the copyright owner as "Not a Contribution."
+
+ "Contributor" shall mean Licensor and any individual or Legal Entity
+ on behalf of whom a Contribution has been received by Licensor and
+ subsequently incorporated within the Work.
+
+ 2. Grant of Copyright License. Subject to the terms and conditions of
+ this License, each Contributor hereby grants to You a perpetual,
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
+ copyright license to reproduce, prepare Derivative Works of,
+ publicly display, publicly perform, sublicense, and distribute the
+ Work and such Derivative Works in Source or Object form.
+
+ 3. Grant of Patent License. Subject to the terms and conditions of
+ this License, each Contributor hereby grants to You a perpetual,
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
+ (except as stated in this section) patent license to make, have made,
+ use, offer to sell, sell, import, and otherwise transfer the Work,
+ where such license applies only to those patent claims licensable
+ by such Contributor that are necessarily infringed by their
+ Contribution(s) alone or by combination of their Contribution(s)
+ with the Work to which such Contribution(s) was submitted. If You
+ institute patent litigation against any entity (including a
+ cross-claim or counterclaim in a lawsuit) alleging that the Work
+ or a Contribution incorporated within the Work constitutes direct
+ or contributory patent infringement, then any patent licenses
+ granted to You under this License for that Work shall terminate
+ as of the date such litigation is filed.
+
+ 4. Redistribution. You may reproduce and distribute copies of the
+ Work or Derivative Works thereof in any medium, with or without
+ modifications, and in Source or Object form, provided that You
+ meet the following conditions:
+
+ (a) You must give any other recipients of the Work or
+ Derivative Works a copy of this License; and
+
+ (b) You must cause any modified files to carry prominent notices
+ stating that You changed the files; and
+
+ (c) You must retain, in the Source form of any Derivative Works
+ that You distribute, all copyright, patent, trademark, and
+ attribution notices from the Source form of the Work,
+ excluding those notices that do not pertain to any part of
+ the Derivative Works; and
+
+ (d) If the Work includes a "NOTICE" text file as part of its
+ distribution, then any Derivative Works that You distribute must
+ include a readable copy of the attribution notices contained
+ within such NOTICE file, excluding those notices that do not
+ pertain to any part of the Derivative Works, in at least one
+ of the following places: within a NOTICE text file distributed
+ as part of the Derivative Works; within the Source form or
+ documentation, if provided along with the Derivative Works; or,
+ within a display generated by the Derivative Works, if and
+ wherever such third-party notices normally appear. The contents
+ of the NOTICE file are for informational purposes only and
+ do not modify the License. You may add Your own attribution
+ notices within Derivative Works that You distribute, alongside
+ or as an addendum to the NOTICE text from the Work, provided
+ that such additional attribution notices cannot be construed
+ as modifying the License.
+
+ You may add Your own copyright statement to Your modifications and
+ may provide additional or different license terms and conditions
+ for use, reproduction, or distribution of Your modifications, or
+ for any such Derivative Works as a whole, provided Your use,
+ reproduction, and distribution of the Work otherwise complies with
+ the conditions stated in this License.
+
+ 5. Submission of Contributions. Unless You explicitly state otherwise,
+ any Contribution intentionally submitted for inclusion in the Work
+ by You to the Licensor shall be under the terms and conditions of
+ this License, without any additional terms or conditions.
+ Notwithstanding the above, nothing herein shall supersede or modify
+ the terms of any separate license agreement you may have executed
+ with Licensor regarding such Contributions.
+
+ 6. Trademarks. This License does not grant permission to use the trade
+ names, trademarks, service marks, or product names of the Licensor,
+ except as required for reasonable and customary use in describing the
+ origin of the Work and reproducing the content of the NOTICE file.
+
+ 7. Disclaimer of Warranty. Unless required by applicable law or
+ agreed to in writing, Licensor provides the Work (and each
+ Contributor provides its Contributions) on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
+ implied, including, without limitation, any warranties or conditions
+ of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
+ PARTICULAR PURPOSE. You are solely responsible for determining the
+ appropriateness of using or redistributing the Work and assume any
+ risks associated with Your exercise of permissions under this License.
+
+ 8. Limitation of Liability. In no event and under no legal theory,
+ whether in tort (including negligence), contract, or otherwise,
+ unless required by applicable law (such as deliberate and grossly
+ negligent acts) or agreed to in writing, shall any Contributor be
+ liable to You for damages, including any direct, indirect, special,
+ incidental, or consequential damages of any character arising as a
+ result of this License or out of the use or inability to use the
+ Work (including but not limited to damages for loss of goodwill,
+ work stoppage, computer failure or malfunction, or any and all
+ other commercial damages or losses), even if such Contributor
+ has been advised of the possibility of such damages.
+
+ 9. Accepting Warranty or Additional Liability. While redistributing
+ the Work or Derivative Works thereof, You may choose to offer,
+ and charge a fee for, acceptance of support, warranty, indemnity,
+ or other liability obligations and/or rights consistent with this
+ License. However, in accepting such obligations, You may act only
+ on Your own behalf and on Your sole responsibility, not on behalf
+ of any other Contributor, and only if You agree to indemnify,
+ defend, and hold each Contributor harmless for any liability
+ incurred by, or claims asserted against, such Contributor by reason
+ of your accepting any such warranty or additional liability.
+
+ END OF TERMS AND CONDITIONS
+
+ APPENDIX: How to apply the Apache License to your work.
+
+ To apply the Apache License to your work, attach the following
+ boilerplate notice, with the fields enclosed by brackets "[]"
+ replaced with your own identifying information. (Don't include
+ the brackets!) The text should be enclosed in the appropriate
+ comment syntax for the file format. We also recommend that a
+ file or class name and description of purpose be included on the
+ same "printed page" as the copyright notice for easier
+ identification within third-party archives.
+
+ Copyright [yyyy] [name of copyright owner]
+
+ 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.
+
diff --git a/sdo-cpp/trunk/ChangeLog b/sdo-cpp/trunk/ChangeLog
new file mode 100644
index 0000000000..e69de29bb2
--- /dev/null
+++ b/sdo-cpp/trunk/ChangeLog
diff --git a/sdo-cpp/trunk/GettingStarted.html b/sdo-cpp/trunk/GettingStarted.html
new file mode 100644
index 0000000000..163650dcd2
--- /dev/null
+++ b/sdo-cpp/trunk/GettingStarted.html
@@ -0,0 +1,294 @@
+<!--
+ Licensed to the Apache Software Foundation (ASF) under one
+ or more contributor license agreements. See the NOTICE file
+ distributed with this work for additional information
+ regarding copyright ownership. The ASF licenses this file
+ to you 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.
+-->
+
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
+<HTML>
+<HEAD>
+ <META CONTENT="text/html; charset=iso-8859-1" HTTP-EQUIV="Content-Type">
+ <META CONTENT="text/css" HTTP-EQUIV="Content-Style-Type">
+ <STYLE MEDIA="all" TYPE="text/css">
+@import url("doc/css/maven-base.css");
+@import url("doc/css/maven-theme.css");
+ </STYLE>
+
+ <LINK HREF="doc/css/maven-theme.css" MEDIA="print" REL="stylesheet"
+ TYPE="text/css">
+ <TITLE>Tuscany - Getting Started</TITLE>
+</HEAD>
+
+<BODY>
+<DIV ID="bodyColumn">
+ <DIV ID="contentBox">
+ <DIV CLASS="section">
+ <H1>Tuscany - Getting Started - SDO C++ Milestone release 3</H1>
+
+ <P>Tuscany SDO C++ is an implementation of the
+ <A HREF="http://www.osoa.org/display/Main/SDO+-+Previously+Published+Specifications">Service Data Objects
+ for C++ 2.01 specification</A>.
+ This page describes what is needed to install Tuscany SDO for C++.<BR/>If you haven't already done so, the first
+ step is to download the SDO C++ Milestone 3 release of Apache Tuscany from our
+ <A HREF="http://incubator.apache.org/tuscany/downloads.html" target='_blank'>download page</A>.<BR/>
+ </P>
+ </DIV>
+ <DIV CLASS="section">
+ <H2>Contents</H2>
+ <OL>
+ <LI><A HREF="#requirements">System Requirements</A></LI>
+ <LI><A HREF="#install">Installing Tuscany SDO..</A>
+ <UL>
+ <LI><A HREF="#linuxsrc">..from the source release on Linux or Mac OS X</A></LI>
+ <!--LI><A HREF="#linuxsrcstdcxx">..from the source release on Linux with Apache STDCXX</A></LI-->
+ <LI><A HREF="#winbin">..from the binary release on Windows</A></LI>
+ <LI><A HREF="#winsrc">..from the source release on Windows</A></LI>
+ <LI><A HREF="#winsrcstdcxx">..from the source release on Windows with Apache STDCXX</A></LI>
+ </UL></LI>
+ <LI><A HREF="#samples">Samples</A></LI>
+ <LI><A HREF="#help">Getting Help</A></LI>
+ </OL>
+ </DIV>
+
+ <DIV CLASS="section">
+ <A NAME="requirements"><H2>System Requirements</H2></A>
+
+ <P>In order to use Tuscany SDO there are some minimum requirements:</P>
+ <TABLE CLASS="bodyTable">
+
+ <TBODY>
+ <TR CLASS="a">
+ <TD><B>Software</B></TD>
+ <TD><B>Download Link</B></TD>
+ </TR>
+ <TR CLASS="b">
+ <TD>Operating systems:
+ <UL>
+ <LI>Windows XP SP2</LI>
+ <LI>Linux</LI>
+ <LI>Mac OS X</LI>
+ </UL>
+ </TD>
+ <TD>
+ </TD>
+ </TR>
+ <TR CLASS="b">
+ <TD>libxml2 version 2.6.20</TD>
+
+ <TD>
+ <A HREF="http://xmlsoft.org/downloads.html"
+ TARGET="_blank">http://xmlsoft.org/downloads.html</A><BR/>
+ Most Linux systems have libxml2 by default. On Windows you need to download
+ and install libxml2, iconv and zlib from
+ <A HREF="http://www.zlatkovic.com/libxml.en.html" TARGET="_blank">http://www.zlatkovic.com/libxml.en.html</A><BR/>
+ Please read the installation notes for libxml2 particularly regarding it's
+ pre-req's iconv and zlib on Windows. <BR/>
+ These libraries will need to be on the PATH in order to run Tuscany SDO.
+ </TD>
+ </TR>
+ <TR CLASS="a">
+ <TD><STRONG>Optional: </STRONG>Axis2C Release 0.96</TD>
+
+ <TD>
+ Required to build the sdo_axiom utility library. This is a pre-req of the Tuscany Native WebService binding extension.
+ <A HREF="http://ws.apache.org/axis2/c/download.cgi"
+ TARGET="_blank">http://ws.apache.org/axis2/c/download.cgi</A><BR/>
+ Please download and follow the installation instructions. Ensure you can run the Axis2C samples
+ </TD>
+ </TR>
+ <TR CLASS="b">
+ <TD><STRONG>Optional: </STRONG>STDCXX Release 4.1.3</TD>
+
+ <TD>
+ <A HREF="http://incubator.apache.org/stdcxx/download.html"
+ TARGET="_blank">http://incubator.apache.org/stdcxx/download.html</A><BR/>
+ STDCXX is the Apache implementation of the C++ Standard Library. Tuscany SDO
+ can be built using this library implementation rather than the default
+ platform libraries available on your operating system.<BR/>
+ If you wish to use STDCXX please follow
+ <A HREF="doc/BuildingSTDCXX.html">these instructions to build STDCXX for Tuscany SDO</A>
+ before following the instructions below to build SDO with STDCXX.<BR/>
+ </TD>
+ </TR>
+ </TBODY>
+ </TABLE>
+ </DIV>
+ <DIV CLASS="section">
+ <A NAME="install"><H2>Installing Tuscany SDO for C++</H2></A>
+ <A NAME="linuxsrc"><H3>Getting Tuscany SDO for C++ working with the source release on Linux or Mac OS X</H3></A>
+ <OL>
+ <LI>Extract the source tar package to a folder &lt;tuscany_sdo_install_dir&gt;</LI>
+ <LI>The following environment variables are required:
+ <UL>
+ <LI>LIBXML2_INCLUDE=&lt;path to libxml2 includes&gt;</LI>
+ <LI>LIBXML2_LIB=&lt;path to libxml2 lib&gt;<BR/>
+ Note: If you are using the default installation of libxml2 these are usually:<BR/>
+ LIBXML2_LIB=/usr/lib<BR/>
+ LIBXML2_INCLUDE=/usr/include/libxml2<BR/></LI>
+
+ <LI>Optional: AXIS2C_HOME=&lt;path to axis2c version 0.96&gt; Required if building the sdo_axiom utility library.<br>
+ <b>Note:</b> There is currently no Axis2C port available for Mac OS X</LI>
+ </UL></LI>
+ <LI>Build the source with the following command sequence:
+ <UL>
+ <LI>./configure --prefix=&lt;tuscany_sdo_install_dir&gt;/deploy --enable-static=no</LI>
+ <LI>make</LI>
+ <LI>make install</LI>
+ </UL>
+ NOTE: If you don't provide a --prefix configure option, it will by default install into
+ /usr/local/tuscany/sdo. Use ./configure --help to see all the available options.<br>
+ To build the sdo_axiom utility library you must specify the --with-axis2c=yes option on the configure command<p>
+ A script, <b>build.sh</b>, is provided that will build and install SDO for C++. This script will install to the
+ location specified by the TUSCANY_SDOCPP environment variable if set or into a deploy directory at &lt;tuscany_sdo_install_dir&gt;/deploy.
+ This script will check for the correct environment variable settings and will only build the sdo_axiom utility
+ library if AXIS2C_HOME is set.</LI>
+ <LI>Run the test:
+ <UL>
+ <LI>./sdotest.sh</LI>
+ </UL>The output will indicate the number of tests passed:
+<xmp>Using SDO installed at /usr/local/tuscany/sdo
+I/O warning : failed to load external entity "not_present.xsd"
+I/O warning : failed to load external entity "not-present.xml"
+I/O warning : failed to load external entity "sca-policy.xsd"
+I/O warning : failed to load external entity "xml.xsd"
+I/O warning : failed to load external entity "xhtml1-strict.xsd"
+Total tests:118 Tests passed:118</xmp>
+ The I/O warning messages can be ignored.
+ </LI>
+ </OL>
+ <!--A NAME="linuxsrcstdcxx"><H3>Getting Tuscany SDO for C++ working with the source release and Apache STDCXX on Linux</H3></A-->
+
+ <A NAME="winbin"><H3>Getting Tuscany SDO for C++ working with the binary release on Windows</H3></A>
+ <OL>
+ <LI>Unzip the supplied zip file to a folder &lt;tuscany_sdo_install_dir&gt;</LI>
+ <LI>Add the &lt;tuscany_sdo_install_dir&gt;\bin directory to the PATH environment variable</LI>
+ <LI>Ensure that libxml2, iconv and zlib are on the PATH environment variable. See <A HREF="#winbin">Requirements</A></LI>
+ </OL>
+ <A NAME="winsrc"><H3>Getting Tuscany SDO for C++ working with the source release on Windows</H3></A>
+ <OL>
+ <LI>Unzip the supplied source zip file to a folder &lt;tuscany_sdo_install_dir&gt;</LI>
+ <LI>The following environment variables are required:
+ <UL>
+ <LI>LIBXML2_HOME=&lt;path to installed libxml2&gt;</LI>
+ <LI>ICONV_HOME=&lt;path to installed iconv&gt;</LI>
+ <LI>ZLIB_HOME=&lt;path to installed zlib&gt;</LI>
+ <LI>Optional: AXIS2C_HOME=&lt;path to axis2c version 0.96&gt;Required if building the sdo_axiom utility library.</LI>
+ </UL></LI>
+ <LI>You must have set up the environment for Microsoft Visual C++ tools. The build command
+ will call vcvars32 to set the environment. Ensure the directory containing this is on your path.
+ This will be where you installed the compiler.</LI>
+ <LI>Build the source:
+ <UL>
+ <LI>cd &lt;tuscany_sdo_install_dir&gt;</LI>
+ <LI>build</LI>
+ </UL>
+ This will build all the projects and put the required output into the &lt;tuscany_sdo_install_dir&gt;\deploy directory</LI>
+ <LI>Run the test program:
+ <UL>
+ <LI>sdotest.bat</LI>
+ </UL>
+ The output will indicate the number of test run and passed. For example:
+<xmp>using TUSCANY_SDOCPP: d:\tuscany_sdo_cpp-1.0-incubator-M3-src\deploy
+I/O warning : failed to load external entity "not_present.xsd"
+I/O warning : failed to load external entity "not-present.xml"
+I/O warning : failed to load external entity "sca-policy.xsd"
+I/O warning : failed to load external entity "xml.xsd"
+I/O warning : failed to load external entity "xhtml1-strict.xsd"
+Total tests:118 Tests passed:118</xmp>
+The I/O warning messages can be ignored.
+ </LI>
+ <LI>Add the &lt;tuscany_sdo_install_dir&gt;\deploy\bin directory to the PATH environment variable</LI>
+ <LI>Ensure that libxml2, iconv and zlib are on the PATH environment variable. See <A HREF="#winbin">Requirements</A></LI>
+ </OL>
+ <A NAME="winsrcstdcxx"><H3>Getting Tuscany SDO for C++ working with the source release and Apache STDCXX on Windows</H3></A>
+ <P>STDCXX is an implementation of the C++ Standard Library provided by Apache.
+ The website is at <A HREF="http://incubator.apache.org/stdcxx/">http://incubator.apache.org/stdcxx/</A>.
+ </P>
+ <P>You must begin by downloading and building STDCXX as described <A HREF="doc/BuildingSTDCXX.html">here</A>
+ </P>
+ <P>STDCXX is supported only when used with Microsoft Visual Studio C++ V7.1. Launch the
+ MSVC++ 7.1 studio by opening the file &lt;tuscany_sdo_install_dir&gt;\projectsvc7\tuscany_sdo\tuscany_sdo.sln
+ </P>
+ <P>Both the sdo_runtime and sdo_test projects include build configurations that
+ use STDCXX. There are several ways to access the build configurations, and all
+ are equally effective. As an example, open the Property pages for sdo_test by
+ right clicking on sdo_test in the Solution Explorer pane and selecting
+ Properties. The Configuration property in the top left corner of the pane is a
+ drop down box offering four options: Debug, Release, stdcxx-Debug,
+ stdcxx-Release. Choose the one you want and then launch the build.
+ </P>
+ <P>All components that are linked (by the linker) must all use the same C++
+ Standard library. Therefore, if either sdo_test or sdo_runtime are built with
+ STDCXX then both must be.
+ </P>
+ <P>Tuscany SCA does not currently offer the option to build with stdcxx and so it
+ cannot be used with a version of SDO built using stdcxx.
+ </P>
+ </DIV>
+
+ <DIV CLASS="section">
+ <A NAME="samples"><H2>Samples</H2></A>
+ <TABLE CLASS="bodyTable">
+ <TBODY>
+ <TR CLASS="a">
+ <TD STYLE="vertical-align: top; white-space: nowrap;">SDO Technology samples
+ </TD>
+ <TD>Simple samples that emphasize how to to use SDO technology. Follow the
+ instructions on the samples <A HREF="samples/GettingStarted.html">Getting Started</A>
+ page to build and run the Tuscany SDO samples
+ </TD>
+ </TR>
+ </TBODY>
+ </TABLE>
+ </DIV>
+ <DIV CLASS="section">
+ <A NAME="help"><H2>Getting Help</H2></A>
+
+ <P>First place to look is at the Tuscany FAQ at
+ <A HREF="http://cwiki.apache.org/TUSCANY/tuscany-sdo-faq.html"
+ TARGET="_blank">http://cwiki.apache.org/TUSCANY/tuscany-sdo-faq.html</A> </P>
+
+ <P>Any problem with this release can be reported to the Tuscany
+ <A HREF="http://cwiki.apache.org/TUSCANY/mailing-lists.html"
+ TARGET="_blank">mailing lists</A> or create a JIRA issue at&nbsp;<A HREF="http://issues.apache.org/jira/browse/Tuscany"
+ TARGET="_blank">http://issues.apache.org/jira/browse/Tuscany</A>.</P>
+
+
+ <P>&nbsp;</P>
+
+ <P>&nbsp;</P>
+
+ <P>&nbsp;</P>
+ <TABLE CLASS="bodyTable">
+ <TBODY>
+ <TR CLASS="a">
+ <TD>
+
+ <P>Thank you for your interest in Tuscany.</P> <STRONG><EM>-The
+ Tuscany Development Team</EM></STRONG>
+
+ <P></P>
+
+ </TD>
+ </TR>
+ </TBODY>
+ </DIV>
+ </DIV>
+</DIV>
+</BODY>
+
+</HTML>
+
diff --git a/sdo-cpp/trunk/INSTALL b/sdo-cpp/trunk/INSTALL
new file mode 100644
index 0000000000..07946d51f4
--- /dev/null
+++ b/sdo-cpp/trunk/INSTALL
@@ -0,0 +1,2 @@
+Please read the GettingStarted.html document for information on
+building and installing Tuscany SDO for C++
diff --git a/sdo-cpp/trunk/LICENSE b/sdo-cpp/trunk/LICENSE
new file mode 100755
index 0000000000..f433b1a53f
--- /dev/null
+++ b/sdo-cpp/trunk/LICENSE
@@ -0,0 +1,177 @@
+
+ Apache License
+ Version 2.0, January 2004
+ http://www.apache.org/licenses/
+
+ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
+
+ 1. Definitions.
+
+ "License" shall mean the terms and conditions for use, reproduction,
+ and distribution as defined by Sections 1 through 9 of this document.
+
+ "Licensor" shall mean the copyright owner or entity authorized by
+ the copyright owner that is granting the License.
+
+ "Legal Entity" shall mean the union of the acting entity and all
+ other entities that control, are controlled by, or are under common
+ control with that entity. For the purposes of this definition,
+ "control" means (i) the power, direct or indirect, to cause the
+ direction or management of such entity, whether by contract or
+ otherwise, or (ii) ownership of fifty percent (50%) or more of the
+ outstanding shares, or (iii) beneficial ownership of such entity.
+
+ "You" (or "Your") shall mean an individual or Legal Entity
+ exercising permissions granted by this License.
+
+ "Source" form shall mean the preferred form for making modifications,
+ including but not limited to software source code, documentation
+ source, and configuration files.
+
+ "Object" form shall mean any form resulting from mechanical
+ transformation or translation of a Source form, including but
+ not limited to compiled object code, generated documentation,
+ and conversions to other media types.
+
+ "Work" shall mean the work of authorship, whether in Source or
+ Object form, made available under the License, as indicated by a
+ copyright notice that is included in or attached to the work
+ (an example is provided in the Appendix below).
+
+ "Derivative Works" shall mean any work, whether in Source or Object
+ form, that is based on (or derived from) the Work and for which the
+ editorial revisions, annotations, elaborations, or other modifications
+ represent, as a whole, an original work of authorship. For the purposes
+ of this License, Derivative Works shall not include works that remain
+ separable from, or merely link (or bind by name) to the interfaces of,
+ the Work and Derivative Works thereof.
+
+ "Contribution" shall mean any work of authorship, including
+ the original version of the Work and any modifications or additions
+ to that Work or Derivative Works thereof, that is intentionally
+ submitted to Licensor for inclusion in the Work by the copyright owner
+ or by an individual or Legal Entity authorized to submit on behalf of
+ the copyright owner. For the purposes of this definition, "submitted"
+ means any form of electronic, verbal, or written communication sent
+ to the Licensor or its representatives, including but not limited to
+ communication on electronic mailing lists, source code control systems,
+ and issue tracking systems that are managed by, or on behalf of, the
+ Licensor for the purpose of discussing and improving the Work, but
+ excluding communication that is conspicuously marked or otherwise
+ designated in writing by the copyright owner as "Not a Contribution."
+
+ "Contributor" shall mean Licensor and any individual or Legal Entity
+ on behalf of whom a Contribution has been received by Licensor and
+ subsequently incorporated within the Work.
+
+ 2. Grant of Copyright License. Subject to the terms and conditions of
+ this License, each Contributor hereby grants to You a perpetual,
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
+ copyright license to reproduce, prepare Derivative Works of,
+ publicly display, publicly perform, sublicense, and distribute the
+ Work and such Derivative Works in Source or Object form.
+
+ 3. Grant of Patent License. Subject to the terms and conditions of
+ this License, each Contributor hereby grants to You a perpetual,
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
+ (except as stated in this section) patent license to make, have made,
+ use, offer to sell, sell, import, and otherwise transfer the Work,
+ where such license applies only to those patent claims licensable
+ by such Contributor that are necessarily infringed by their
+ Contribution(s) alone or by combination of their Contribution(s)
+ with the Work to which such Contribution(s) was submitted. If You
+ institute patent litigation against any entity (including a
+ cross-claim or counterclaim in a lawsuit) alleging that the Work
+ or a Contribution incorporated within the Work constitutes direct
+ or contributory patent infringement, then any patent licenses
+ granted to You under this License for that Work shall terminate
+ as of the date such litigation is filed.
+
+ 4. Redistribution. You may reproduce and distribute copies of the
+ Work or Derivative Works thereof in any medium, with or without
+ modifications, and in Source or Object form, provided that You
+ meet the following conditions:
+
+ (a) You must give any other recipients of the Work or
+ Derivative Works a copy of this License; and
+
+ (b) You must cause any modified files to carry prominent notices
+ stating that You changed the files; and
+
+ (c) You must retain, in the Source form of any Derivative Works
+ that You distribute, all copyright, patent, trademark, and
+ attribution notices from the Source form of the Work,
+ excluding those notices that do not pertain to any part of
+ the Derivative Works; and
+
+ (d) If the Work includes a "NOTICE" text file as part of its
+ distribution, then any Derivative Works that You distribute must
+ include a readable copy of the attribution notices contained
+ within such NOTICE file, excluding those notices that do not
+ pertain to any part of the Derivative Works, in at least one
+ of the following places: within a NOTICE text file distributed
+ as part of the Derivative Works; within the Source form or
+ documentation, if provided along with the Derivative Works; or,
+ within a display generated by the Derivative Works, if and
+ wherever such third-party notices normally appear. The contents
+ of the NOTICE file are for informational purposes only and
+ do not modify the License. You may add Your own attribution
+ notices within Derivative Works that You distribute, alongside
+ or as an addendum to the NOTICE text from the Work, provided
+ that such additional attribution notices cannot be construed
+ as modifying the License.
+
+ You may add Your own copyright statement to Your modifications and
+ may provide additional or different license terms and conditions
+ for use, reproduction, or distribution of Your modifications, or
+ for any such Derivative Works as a whole, provided Your use,
+ reproduction, and distribution of the Work otherwise complies with
+ the conditions stated in this License.
+
+ 5. Submission of Contributions. Unless You explicitly state otherwise,
+ any Contribution intentionally submitted for inclusion in the Work
+ by You to the Licensor shall be under the terms and conditions of
+ this License, without any additional terms or conditions.
+ Notwithstanding the above, nothing herein shall supersede or modify
+ the terms of any separate license agreement you may have executed
+ with Licensor regarding such Contributions.
+
+ 6. Trademarks. This License does not grant permission to use the trade
+ names, trademarks, service marks, or product names of the Licensor,
+ except as required for reasonable and customary use in describing the
+ origin of the Work and reproducing the content of the NOTICE file.
+
+ 7. Disclaimer of Warranty. Unless required by applicable law or
+ agreed to in writing, Licensor provides the Work (and each
+ Contributor provides its Contributions) on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
+ implied, including, without limitation, any warranties or conditions
+ of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
+ PARTICULAR PURPOSE. You are solely responsible for determining the
+ appropriateness of using or redistributing the Work and assume any
+ risks associated with Your exercise of permissions under this License.
+
+ 8. Limitation of Liability. In no event and under no legal theory,
+ whether in tort (including negligence), contract, or otherwise,
+ unless required by applicable law (such as deliberate and grossly
+ negligent acts) or agreed to in writing, shall any Contributor be
+ liable to You for damages, including any direct, indirect, special,
+ incidental, or consequential damages of any character arising as a
+ result of this License or out of the use or inability to use the
+ Work (including but not limited to damages for loss of goodwill,
+ work stoppage, computer failure or malfunction, or any and all
+ other commercial damages or losses), even if such Contributor
+ has been advised of the possibility of such damages.
+
+ 9. Accepting Warranty or Additional Liability. While redistributing
+ the Work or Derivative Works thereof, You may choose to offer,
+ and charge a fee for, acceptance of support, warranty, indemnity,
+ or other liability obligations and/or rights consistent with this
+ License. However, in accepting such obligations, You may act only
+ on Your own behalf and on Your sole responsibility, not on behalf
+ of any other Contributor, and only if You agree to indemnify,
+ defend, and hold each Contributor harmless for any liability
+ incurred by, or claims asserted against, such Contributor by reason
+ of your accepting any such warranty or additional liability.
+
+ END OF TERMS AND CONDITIONS
diff --git a/sdo-cpp/trunk/Makefile.am b/sdo-cpp/trunk/Makefile.am
new file mode 100644
index 0000000000..044bd63afd
--- /dev/null
+++ b/sdo-cpp/trunk/Makefile.am
@@ -0,0 +1,50 @@
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements. See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership. The ASF licenses this file
+# to you 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.
+
+SUBDIRS = runtime
+DIST_SUBDIRS = runtime samples
+datadir=$(prefix)
+
+data_DATA = INSTALL README LICENSE COPYING NOTICE GettingStarted.html
+EXTRA_DIST = LICENSE COPYING INSTALL README NOTICE autogen.sh build.sh builddist.sh configure.sh makebindist.sh sdotest.sh GettingStarted.html doc
+dist-hook:
+ rm -rf `find $(distdir)/ -type d -name .svn`
+ rm -rf `find $(distdir)/ -type d -name .deps`
+
+install-data-hook:
+ rm -rf $(prefix)/samples
+ cp -r samples $(prefix)
+ rm -rf `find $(prefix)/samples -type d -name .svn`
+ rm -rf `find $(prefix)/samples -type d -name .deps`
+ rm -rf $(prefix)/doc
+ cp -r doc $(prefix)
+ rm -rf `find $(prefix)/doc -type d -name .svn`
+ rm -rf `find $(prefix)/doc -type d -name .deps`
+
+bindist: dist
+ rm -rf ${PACKAGE}-${PACKAGE_VERSION}
+ rm -rf ${PACKAGE}-${PACKAGE_VERSION}-src
+ rm -rf ${PACKAGE}-${PACKAGE_VERSION}-bin
+ gunzip -f ${PACKAGE}-${PACKAGE_VERSION}.tar.gz
+ tar -xf ${PACKAGE}-${PACKAGE_VERSION}.tar
+ mv ${PACKAGE}-${PACKAGE_VERSION} ${PACKAGE}-${PACKAGE_VERSION}-src
+ tar -cf - ${PACKAGE}-${PACKAGE_VERSION}-src | gzip -c > ${PACKAGE}-${PACKAGE_VERSION}-src.tar.gz
+ cd ${PACKAGE}-${PACKAGE_VERSION}-src \
+ && sh ../makebindist.sh
+ mkdir ${PACKAGE}-${PACKAGE_VERSION}-bin
+ cp -r ${PACKAGE}-${PACKAGE_VERSION}-src/deploy/* ${PACKAGE}-${PACKAGE_VERSION}-bin
+ tar -cf - ${PACKAGE}-${PACKAGE_VERSION}-bin | gzip -c > ${PACKAGE}-${PACKAGE_VERSION}-bin.tar.gz
diff --git a/sdo-cpp/trunk/NEWS b/sdo-cpp/trunk/NEWS
new file mode 100644
index 0000000000..e69de29bb2
--- /dev/null
+++ b/sdo-cpp/trunk/NEWS
diff --git a/sdo-cpp/trunk/NOTICE b/sdo-cpp/trunk/NOTICE
new file mode 100644
index 0000000000..4a1e01a59e
--- /dev/null
+++ b/sdo-cpp/trunk/NOTICE
@@ -0,0 +1,5 @@
+Apache Tuscany SDO for C++
+Copyright 2005, 2007 The Apache Software Foundation
+
+This product includes software developed by
+The Apache Software Foundation (http://www.apache.org/) \ No newline at end of file
diff --git a/sdo-cpp/trunk/README b/sdo-cpp/trunk/README
new file mode 100644
index 0000000000..d5bd6f5e78
--- /dev/null
+++ b/sdo-cpp/trunk/README
@@ -0,0 +1,96 @@
+Apache Tuscany SDO C++ M3
+=========================
+
+http://incubator.apache.org/tuscany
+
+Tuscany is an effort undergoing incubation at the Apache Software Foundation
+(ASF), sponsored by the Web Services PMC.
+
+Incubation is required of all newly accepted projects until a further review
+indicates that the infrastructure, communications, and decision making process
+have stabilized in a manner consistent with other successful ASF projects.
+
+While incubation status is not necessarily a reflection of the completeness or
+stability of the code, it does indicate that the project has yet to be fully
+endorsed by the ASF.
+
+
+Getting Started
+===============
+
+Documentation describing the system requirements and the steps to install
+Tuscany SDO C++ and run the samples can be found in the GettingStarted.html
+file.
+
+
+About Tuscany SDO for C++
+=========================
+
+Tuscany SDO is an implementation of the Service Data Objects for C++ 2.01
+specification found at
+http://www.osoa.org/display/Main/SDO+-+Previously+Published+Specifications
+
+Supported SDO features
+ * All features are supported unless listed under the known restrictions
+ below. See the Service Data Objects for C++ 2.01 specification.
+
+New features in this release
+ * 30-40% performance improvement
+ * Multiple bug fixes and internal enhancements
+
+Known Restrictions
+The implementation adheres closely to the specification, but there are a number
+of features which did not make it into this release. These are documented
+below.
+
+Generic get/set:
+The C++ implementation defines a set of access methods directly appropriate to
+each Type. For example getString(), setString(), getBoolean(), setBoolean().
+There is no generic get() method as there is no common base object to return -
+unlike the java implementation which can return an Object.
+
+Typesafe interface:
+There is no code generation in this version, so there is no interface such that
+a property called "Name" can be accessed via object->getName(). The name must
+be accessed via object->getString("Name");
+
+Change Summary Serialization:
+Change summaries contain creations, deletions and modifications to data graphs.
+The specification indicates that these will be serialized to XML such that
+creations and deletions will become attributes of the change summary element,
+whilst changes become elements within the change summary element. This
+implementation saves all creations, deletions and changes as elements within
+the change summary element.
+
+Change Summary Undo:
+The undo method of a change summary is not implemented.
+
+Read-Only:
+Read-only data elements are not supported by this implementation. Properties
+may be set read-only, but the property may still be modified without an error.
+
+Opposites:
+Opposites are not supported by this implementation.
+
+Date and Time:
+Date support is limited to using a time_t. There are no calendar or duration
+style objects, and no helpers for conversions.
+
+BigDecimal and BigInteger:
+The equivalent of the java BigDecimal and BigInteger objects are not
+implemented.
+
+NLS support:
+Data objects may contain multi-byte data in the form of an SDO string, but
+locale information is not stored with the data. The creation API only allows
+properties and types to have ascii names (taking a char* as the name).
+
+Inheritance:
+Type inheritance is single only.
+
+
+
+
+Thank you for using Tuscany!
+
+The Tuscany Team.
diff --git a/sdo-cpp/trunk/README_ANT_INSTALL b/sdo-cpp/trunk/README_ANT_INSTALL
new file mode 100644
index 0000000000..ab328664a8
--- /dev/null
+++ b/sdo-cpp/trunk/README_ANT_INSTALL
@@ -0,0 +1,333 @@
+Licensed to the Apache Software Foundation (ASF) under one
+or more contributor license agreements. See the NOTICE file
+distributed with this work for additional information
+regarding copyright ownership. The ASF licenses this file
+to you 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.
+
+Using ant to build TuscanySDO Native
+
+This guide shows how to build TuscanySDO Native with apache ant.
+Traditionally TuscanySDO was compiled with automake, but we decided
+it would be easier to maintain and more flexible if we switched to
+ant. Above all, using ant will standardize the build system across
+all platforms, obviating the need to support both automake and
+microsoft VC projects. The ant build process is still in its beta
+and will be formalized for Release M4. Currently the only item
+remaining is to write an ant build file for the samples.
+
+
+Required Software to build TuscanySDO Native with ant
+=====================================================
+
+Java:
+ Most Linux, Mac, and Windows systems come with Java
+ Java 1.4.2 or later
+
+Ant:
+ Ant comes installed with almost all Linux distributions
+ version 1.6 or later
+ Download: http://ant.apache.org/
+
+antcontrib:
+ version 1.0b3 or later
+ Download: http://ant-contrib.sourceforge.net/
+
+antcontrib cpptasks.jar
+ version 1.0b4 or later
+ Download: http://ant-contrib.sourceforge.net/
+ Information: http://ant-contrib.sourceforge.net/cc.html
+
+
+Installation Instructions
+=========================
+
+Linux/Mac
+---------
+
+Make sure JAVA_HOME is set before starting.
+
+Install ant according to http://ant.apache.org/manual/index.html.
+
+Set the ANT_HOME variable to the directory where you install ant.
+export ANT_HOME="/home/your/ant"
+
+Add $ANT_HOME/bin to your path.
+export PATH="${PATH}:${ANT_HOME}/bin"
+
+The optional ant tasks included in antcontrib and cpptasks are needed to
+compile Tuscany Native with ant. Additional ant tasks (antcontrib and cpptasks)
+should be installed in $ANT_HOME/lib
+So place the antcontrib and cpptasks jars there.
+
+If you dont have write access to $ANT_HOME/lib, do the following:
+- create ${user.home}/.ant/lib
+- place the jars here
+
+Typically its a good idea to avoid adding optional ant tasks to your classpath,
+this can be problematic.
+
+Since the antcontrib compiler adaptor for microsoft msvc 8 has several bugs, we've
+written our own. Even though this compiler is for Windows, it is referenced in the
+ant build scripts and thus needs to be added to the classpath even for Linux/Mac.
+Add the TuscanyMSVC8DevStudioCCompiler jar to your classpath.
+export CLASSPATH="${CLASSPATH}:/TuscanySourceDir/antscripts/TuscanyMSVC8DevStudioCCompiler.jar"
+
+Windows
+-------
+
+Make sure JAVA_HOME is set before starting.
+
+Install ant according to http://ant.apache.org/manual/index.html.
+
+Set the ANT_HOME variable to the directory where you install ant.
+set ANT_HOME=c:\ant
+
+Add %ANT_HOME%\bin to your path.
+set PATH=%PATH%;%ANT_HOME%\bin
+
+The optional ant tasks included in antcontrib and cpptasks are needed to
+compile Tuscany Native with ant. Additional ant tasks (antcontrib and cpptasks)
+should be installed in %ANT_HOME%\lib
+So place the antcontrib and cpptasks jars there.
+
+If you dont have write access to %ANT_HOME%\lib, do the following:
+- create %user.home%\.ant\lib
+- place the jars here
+
+Typically its a good idea to avoid adding optional ant tasks to your classpath,
+this can be problematic.
+
+Since the antcontrib compiler adaptor for microsoft msvc 8 has several bugs, we've
+written our own, namely TuscanyMSVC8DevStudioCCompiler. The Tuscany MSVC8 adaptor
+just makes sure that the correct parameters are passed to the compiler.
+Add the TuscanyMSVC8DevStudioCCompiler jar to your classpath.
+set CLASSPATH=%CLASSPATH%:c:\TuscanySourceDir\antscripts\TuscanyMSVC8DevStudioCCompiler.jar
+
+USAGE
+=====
+
+From the TuscanySDO Native root source directory, the entire application can be
+compiled, linked, and installed by simply executing ant with no targets. This will
+execute the default "all" target.
+
+# ant
+
+The ant build system will scan your environment variables and ant configuration file
+and try to autoconfigure everything needed to build. The environment variables can be
+overridden by the ant configuration file: antscripts/platform.properties. The only
+configuration that is mandatory to build TuscanySDO Native is the location of libxml2.
+
+To configure the location of libxml2, do one of the following:
+ export LIBXML2_LIB=/libxml2/lib/dir
+ export LIBXML2_INCLUDE=/libxml2/include/dir
+ -- OR --
+ edit antscripts/platform.properties
+ platform.libxml2.lib.dir=/libxml2/lib/dir
+ platform.libxml2.include.dir=/libxml2/include/dir
+
+The platform.properties configuration always overrides environment variables.
+See the CONFIGURATION section below for more information.
+
+To compile in debug mode, add the following define to the ant command line or
+edit the platform.properties file as seen in the CONFIGURATION section below.
+
+# ant -Ddebug=true
+
+The TuscanySDO Native ant build process is hierarchical. Currently there are
+build scripts in the following locations, which can all be invoked from the
+root TuscanySDO directory:
+ TUSCANY_SDO_SRC_ROOT/build.xml
+ TUSCANY_SDO_SRC_ROOT/runtime/core/build.xml
+ TUSCANY_SDO_SRC_ROOT/runtime/core/test/build.xml
+ TUSCANY_SDO_SRC_ROOT/runtime/core/sdo_axiom_test/build.xml
+
+
+For a listing of public targets for any build.xml file, execute the following:
+(display shown for the root src directory)
+
+# ant -p
+Buildfile: build.xml
+
+Main targets:
+
+ all build and install all TuscanySdoNative source code and documentation
+ build Build all TuscanySdoNative source code and documentation
+ clean Clean all TuscanySdoNative compiled source code
+ install Install TuscanySdoNative libraries and headers
+ test Run SDO tests, not implemented yet
+ distribution Create a source and bin distribution structure
+ pack.distribution Pack the bin and source distribution into .zip and .tar.gz files. Also generates the .asc and .md5 files
+Default target: all
+
+
+Public targets are those that have descriptions and are usually the only ones needed for
+compiling, installing and cleaning. For more avanced use, the private targets can be seen
+by looking at the actual build.xml file.
+
+
+GENERATING A PROJECT DISTRIBUTION
+=================================
+
+To create a src and bin distribution of Tuscany SDO subproject, there must be set some properties on platform.properties files:
+
+Property Required Example Description
+-------- -------- ------- -----------
+
+platform.public.key.path Yes "E:/gnupg/trustdb.gpg" The public key ring file path
+
+platform.secret.key.path Yes "E:/gnupg/secring.gpg" The secret key ring file path
+
+platform.key.id Yes "148CAFB2" The key id used to sign the distribution files
+
+platform.tuscanySDO.distribution.dir NO "C:\distribution\" The folder where the distribution files will be generated, default=tuscanySDO.root.dir/distribution
+
+platform.tuscanySDO.release.file.name NO "tuscany_das_native-1.0-incubator-M4-" The beginning of src and bin packed distribution file name, default="tuscany_cpp_das".
+ TUSCANY_DASCPP_RELEASE_NAME env var may be used as an alternative
+
+Also is required the bcpg-jdk<latest_version>-<latest_version>.jar and
+jce-jdk<latest_version>-<latest_version>.jar files defines on classpath.
+Both can be found at http://www.bouncycastle.org/latest_releases.html
+
+Use the "distribution" target to generate the src and bin distribution
+file structure under platform.tuscanySDO.distribution.dir folder. Then
+use the "pack.distribution" target to pack the bin and src distribution
+folders as .zip and .tar.gz and generate their .asc and .md5 files. A
+password must be set on the command line when using pack.distribution
+target, this password is used to sign the packed distribution files with
+the secret key defined on platform.secret.key.path
+
+Make sure an 1.6 JRE version is set in your JAVA_HOME when signing the
+distribution.
+
+Usage:
+ant distribution
+// do whatever you want on the generated distribution files
+ant pack.distribution -Dpassword="123456"
+
+
+CONFIGURATION
+==============
+
+The following explains how to configure the TuscanySDO Native ant build system.
+The build system is configured either by environment variables and/or by the
+antscripts/platform.properties file. Some options can only be configured via the
+platform.properties file. If an option can be configured in both places, the option
+specified in the platform.properties file overrides the environment variable.
+
+The TuscanySDO Native ant build system is capable of automatically configuring
+everything except the location of the libxml2 library. All other configuration
+options can be determined. (except of course the location of the optional 3rd-party
+packages: axis2c)
+
+From anywhere there is a TuscanySDO Native build.xml file, the current system
+configuration can be displayed by executing the display.system ant target as
+follows:
+
+# ant display.system
+Buildfile: build.xml
+
+check.libxml2:
+
+check.ws:
+
+display.system:
+ [echo]
+ [echo] TuscanySDO paths
+ [echo] tuscanySDO.root.dir= /amd/homes/bjohnson/tuscany_svn_head/sdo
+ [echo] tuscanySDO.root.src.dir= /amd/homes/bjohnson/tuscany_svn_head/sdo/runtime
+ [echo] tuscanySDO.install.dir= /nfs/homes/bjohnson/tuscany_svn_head/sdo/deploy
+ [echo] sdo.impl.library.name= tuscany_sdo
+ [echo] sdo.impl.library.path= /nfs/homes/bjohnson/tuscany_svn_head/sdo/deploy/lib
+ [echo] sdo.impl.include.path= /amd/homes/bjohnson/tuscany_svn_head/sdo/runtime/core/src
+ [echo] tuscanySDO.library.version= '.0.0.0'
+ [echo]
+ [echo] TuscanySDO compiler configuration
+ [echo] compiler.name= 'g++'
+ [echo] debug.compile= 'false'
+ [echo] lib.ext= '.so'
+ [echo] dll.ext= ''
+ [echo] lib.prefix= 'lib'
+ [echo] object.ext= '.o'
+ [echo] exe.ext= ''
+ [echo] script.ext= '.sh'
+ [echo] external.definitions.file= ''
+ [echo]
+ [echo] libxml2 location
+ [echo] libxml2.lib.dir= /usr/lib
+ [echo] libxml2.include.dir= /usr/include/libxml2
+ [echo]
+ [echo] axis2c location
+ [echo] axis2c.home.dir= /nfs/homes/bjohnson/3rdparty/axis2c-src-0.96/deploy
+ [echo]
+
+BUILD SUCCESSFUL
+Total time: 0 seconds
+
+
+Compilation configuration
+-------------------------
+
+The compilation options can all be determined by the ant build system by
+examining the platform. The values can only be overriden by editing the
+platform.properties file. Following is a list of the options and their
+default values:
+
+platform.lib.ext= (Defaults to ".so" for Unix and ".lib" for Windows)
+platform.dll.ext= (Defaults to "" for Unix and ".dll" for Windows. Not used for Unix)
+platform.exe.ext= (Defaults to "" for Unix and ".exe" for Windows)
+platform.object.ext= (Defaults to ".o" for Unix and ".obj" for Windows)
+platform.script.ext= (Defaults to ".sh" for Unix and ".bat" for Windows)
+platform.compiler.name= (Defaults to "g++" for Unix and "msvc8" for Windows)
+platform.debug.compile= (Defaults to "false" for both Unix and Windows)
+
+To configure ant to use a compiler other than g++ or msvc, or to add your own
+ant tasks/definitions, specify a path for the platform.external.definitions.file
+and platform.compiler.name in the platform.properties configuration file. This
+is especially useful for compiling on other platforms like AIX or Solaris.
+
+Tuscany SDO installation path
+-----------------------------
+
+The Tuscany SDO installation directory can be configured as follows:
+ export TUSCANY_SDOCPP=/tuscany/sdo/native/install/dir
+ -- OR --
+ edit antscripts/platform.properties
+ platform.tuscanySDO.install.dir=/tuscany/sdo/native/install/dir
+
+The Tuscany SDO installation directory defaults to:
+ TUSCANY_SDO_SRC_ROOT/deploy
+
+
+3rd Party configuration
+-----------------------
+
+AXIS2C:
+If not specified, then the values are left empty and the sdo_axiom library will not be compiled.
+
+ export AXIS2C_HOME=/axis2c/home/dir
+ -- OR --
+ edit antscripts/platform.properties
+ platform.axis2c.home.dir=/axis2c/home/dir
+
+LIBXML2:
+If not specified, then the the build will fail.
+
+ export LIBXML2_LIB=/libxml2/library/directory
+ export LIBXML2_INCLUDE=/libxml2/include/directory
+ -- OR --
+ edit antscripts/platform.properties
+ platform.libxml2.lib.dir=/libxml2/library/directory
+ platform.libxml2.include.dir=/libxml2/include/directory
+
+
diff --git a/sdo-cpp/trunk/VSExpress/tuscany_sdo/Build/Build.vcproj b/sdo-cpp/trunk/VSExpress/tuscany_sdo/Build/Build.vcproj
new file mode 100644
index 0000000000..7ff03ea565
--- /dev/null
+++ b/sdo-cpp/trunk/VSExpress/tuscany_sdo/Build/Build.vcproj
@@ -0,0 +1,72 @@
+<?xml version="1.0" encoding="Windows-1252"?>
+<VisualStudioProject
+ ProjectType="Visual C++"
+ Version="8.00"
+ Name="Build"
+ ProjectGUID="{9540B934-24BA-45F0-965B-8231E256DF03}"
+ Keyword="MakeFileProj"
+ >
+ <Platforms>
+ <Platform
+ Name="Win32"
+ />
+ </Platforms>
+ <ToolFiles>
+ </ToolFiles>
+ <Configurations>
+ <Configuration
+ Name="Debug|Win32"
+ OutputDirectory=".\Debug"
+ IntermediateDirectory=".\Debug"
+ ConfigurationType="10"
+ InheritedPropertySheets="$(VCInstallDir)VCProjectDefaults\UpgradeFromVC60.vsprops"
+ UseOfMFC="0"
+ ATLMinimizesCRunTimeLibraryUsage="false"
+ >
+ <Tool
+ Name="VCPreBuildEventTool"
+ />
+ <Tool
+ Name="VCCustomBuildTool"
+ />
+ <Tool
+ Name="VCMIDLTool"
+ TypeLibraryName=".\Debug/Build.tlb"
+ HeaderFileName=""
+ />
+ <Tool
+ Name="VCPostBuildEventTool"
+ />
+ </Configuration>
+ <Configuration
+ Name="Release|Win32"
+ OutputDirectory=".\Release"
+ IntermediateDirectory=".\Release"
+ ConfigurationType="10"
+ InheritedPropertySheets="$(VCInstallDir)VCProjectDefaults\UpgradeFromVC60.vsprops"
+ UseOfMFC="0"
+ ATLMinimizesCRunTimeLibraryUsage="false"
+ >
+ <Tool
+ Name="VCPreBuildEventTool"
+ />
+ <Tool
+ Name="VCCustomBuildTool"
+ />
+ <Tool
+ Name="VCMIDLTool"
+ TypeLibraryName=".\Release/Build.tlb"
+ HeaderFileName=""
+ />
+ <Tool
+ Name="VCPostBuildEventTool"
+ />
+ </Configuration>
+ </Configurations>
+ <References>
+ </References>
+ <Files>
+ </Files>
+ <Globals>
+ </Globals>
+</VisualStudioProject>
diff --git a/sdo-cpp/trunk/VSExpress/tuscany_sdo/Build/Build.vcproj.user b/sdo-cpp/trunk/VSExpress/tuscany_sdo/Build/Build.vcproj.user
new file mode 100644
index 0000000000..81bcd3e2a5
--- /dev/null
+++ b/sdo-cpp/trunk/VSExpress/tuscany_sdo/Build/Build.vcproj.user
@@ -0,0 +1,65 @@
+<?xml version="1.0" encoding="Windows-1252"?>
+<VisualStudioUserFile
+ ProjectType="Visual C++"
+ Version="8.00"
+ ShowAllFiles="false"
+ >
+ <Configurations>
+ <Configuration
+ Name="Debug|Win32"
+ >
+ <DebugSettings
+ Command="..\sdo_test\$(ConfigurationName)\sdo_test.exe"
+ WorkingDirectory="..\..\..\runtime\core\test"
+ CommandArguments=""
+ Attach="false"
+ DebuggerType="3"
+ Remote="1"
+ RemoteMachine=""
+ RemoteCommand=""
+ HttpUrl=""
+ PDBPath=""
+ SQLDebugging=""
+ Environment="PATH=$(ProjectDir)..\sdo_runtime\$(ConfigurationName);%PATH%"
+ EnvironmentMerge="true"
+ DebuggerFlavor="0"
+ MPIRunCommand=""
+ MPIRunArguments=""
+ MPIRunWorkingDirectory=""
+ ApplicationCommand=""
+ ApplicationArguments=""
+ ShimCommand=""
+ MPIAcceptMode=""
+ MPIAcceptFilter=""
+ />
+ </Configuration>
+ <Configuration
+ Name="Release|Win32"
+ >
+ <DebugSettings
+ Command="..\sdo_test\$(ConfigurationName)\sdo_test.exe"
+ WorkingDirectory="..\..\..\runtime\core\test"
+ CommandArguments=""
+ Attach="false"
+ DebuggerType="3"
+ Remote="1"
+ RemoteMachine=""
+ RemoteCommand=""
+ HttpUrl=""
+ PDBPath=""
+ SQLDebugging=""
+ Environment="PATH=$(ProjectDir)..\sdo_runtime\$(ConfigurationName);%PATH%"
+ EnvironmentMerge="true"
+ DebuggerFlavor="0"
+ MPIRunCommand=""
+ MPIRunArguments=""
+ MPIRunWorkingDirectory=""
+ ApplicationCommand=""
+ ApplicationArguments=""
+ ShimCommand=""
+ MPIAcceptMode=""
+ MPIAcceptFilter=""
+ />
+ </Configuration>
+ </Configurations>
+</VisualStudioUserFile>
diff --git a/sdo-cpp/trunk/VSExpress/tuscany_sdo/sdo_axiom/sdo_axiom.vcproj b/sdo-cpp/trunk/VSExpress/tuscany_sdo/sdo_axiom/sdo_axiom.vcproj
new file mode 100644
index 0000000000..d260b1029c
--- /dev/null
+++ b/sdo-cpp/trunk/VSExpress/tuscany_sdo/sdo_axiom/sdo_axiom.vcproj
@@ -0,0 +1,263 @@
+<?xml version="1.0" encoding="Windows-1252"?>
+<VisualStudioProject
+ ProjectType="Visual C++"
+ Version="8.00"
+ Name="sdo_axiom"
+ ProjectGUID="{E95539B9-8E1A-4F4C-8565-ECCF510F26F2}"
+ >
+ <Platforms>
+ <Platform
+ Name="Win32"
+ />
+ </Platforms>
+ <ToolFiles>
+ </ToolFiles>
+ <Configurations>
+ <Configuration
+ Name="Release|Win32"
+ OutputDirectory=".\Release"
+ IntermediateDirectory=".\Release"
+ ConfigurationType="2"
+ InheritedPropertySheets="$(VCInstallDir)VCProjectDefaults\UpgradeFromVC60.vsprops"
+ UseOfMFC="0"
+ ATLMinimizesCRunTimeLibraryUsage="false"
+ CharacterSet="2"
+ >
+ <Tool
+ Name="VCPreBuildEventTool"
+ />
+ <Tool
+ Name="VCCustomBuildTool"
+ />
+ <Tool
+ Name="VCXMLDataGeneratorTool"
+ />
+ <Tool
+ Name="VCWebServiceProxyGeneratorTool"
+ />
+ <Tool
+ Name="VCMIDLTool"
+ PreprocessorDefinitions="NDEBUG"
+ MkTypLibCompatible="true"
+ SuppressStartupBanner="true"
+ TargetEnvironment="1"
+ TypeLibraryName=".\Release/sdo_axiom.tlb"
+ HeaderFileName=""
+ />
+ <Tool
+ Name="VCCLCompilerTool"
+ Optimization="2"
+ InlineFunctionExpansion="1"
+ AdditionalIncludeDirectories="..\..\..\deploy\include,$(AXIS2C_HOME)\include"
+ PreprocessorDefinitions="WIN32;NDEBUG;_WINDOWS;_USRDLL;SDO_AXIOM_EXPORTS"
+ StringPooling="true"
+ RuntimeLibrary="2"
+ EnableFunctionLevelLinking="true"
+ PrecompiledHeaderFile=".\Release/sdo_axiom.pch"
+ AssemblerListingLocation=".\Release/"
+ ObjectFile=".\Release/"
+ ProgramDataBaseFileName=".\Release/"
+ WarningLevel="3"
+ SuppressStartupBanner="true"
+ />
+ <Tool
+ Name="VCManagedResourceCompilerTool"
+ />
+ <Tool
+ Name="VCResourceCompilerTool"
+ PreprocessorDefinitions="NDEBUG"
+ Culture="2057"
+ />
+ <Tool
+ Name="VCPreLinkEventTool"
+ />
+ <Tool
+ Name="VCLinkerTool"
+ AdditionalDependencies="axis2_parser.lib axis2_util.lib axiom.lib tuscany_sdo.lib $(NOINHERIT)"
+ OutputFile="Release/tuscany_sdo_axiom.dll"
+ LinkIncremental="1"
+ SuppressStartupBanner="true"
+ AdditionalLibraryDirectories="..\..\..\deploy\lib,$(AXIS2C_HOME)\lib"
+ ProgramDatabaseFile=".\Release/tuscany_sdo_axiom.pdb"
+ ImportLibrary=".\Release/tuscany_sdo_axiom.lib"
+ TargetMachine="1"
+ />
+ <Tool
+ Name="VCALinkTool"
+ />
+ <Tool
+ Name="VCManifestTool"
+ />
+ <Tool
+ Name="VCXDCMakeTool"
+ />
+ <Tool
+ Name="VCBscMakeTool"
+ SuppressStartupBanner="true"
+ OutputFile=".\Release/sdo_axiom.bsc"
+ />
+ <Tool
+ Name="VCFxCopTool"
+ />
+ <Tool
+ Name="VCAppVerifierTool"
+ />
+ <Tool
+ Name="VCWebDeploymentTool"
+ />
+ <Tool
+ Name="VCPostBuildEventTool"
+ CommandLine="..\..\..\runtime\core\sdo_axiom\deploy.bat ..\..\..\ Release"
+ />
+ </Configuration>
+ <Configuration
+ Name="Debug|Win32"
+ OutputDirectory=".\Debug"
+ IntermediateDirectory=".\Debug"
+ ConfigurationType="2"
+ InheritedPropertySheets="$(VCInstallDir)VCProjectDefaults\UpgradeFromVC60.vsprops"
+ UseOfMFC="0"
+ ATLMinimizesCRunTimeLibraryUsage="false"
+ CharacterSet="2"
+ >
+ <Tool
+ Name="VCPreBuildEventTool"
+ />
+ <Tool
+ Name="VCCustomBuildTool"
+ />
+ <Tool
+ Name="VCXMLDataGeneratorTool"
+ />
+ <Tool
+ Name="VCWebServiceProxyGeneratorTool"
+ />
+ <Tool
+ Name="VCMIDLTool"
+ PreprocessorDefinitions="_DEBUG"
+ MkTypLibCompatible="true"
+ SuppressStartupBanner="true"
+ TargetEnvironment="1"
+ TypeLibraryName=".\Debug/sdo_axiom.tlb"
+ HeaderFileName=""
+ />
+ <Tool
+ Name="VCCLCompilerTool"
+ Optimization="0"
+ AdditionalIncludeDirectories="..\..\..\deploy\include,$(AXIS2C_HOME)\include"
+ PreprocessorDefinitions="WIN32;_DEBUG;_WINDOWS;_USRDLL;SDO_AXIOM_EXPORTS"
+ MinimalRebuild="true"
+ BasicRuntimeChecks="3"
+ RuntimeLibrary="3"
+ PrecompiledHeaderFile=".\Debug/sdo_axiom.pch"
+ AssemblerListingLocation=".\Debug/"
+ ObjectFile=".\Debug/"
+ ProgramDataBaseFileName=".\Debug/"
+ WarningLevel="3"
+ SuppressStartupBanner="true"
+ DebugInformationFormat="4"
+ />
+ <Tool
+ Name="VCManagedResourceCompilerTool"
+ />
+ <Tool
+ Name="VCResourceCompilerTool"
+ PreprocessorDefinitions="_DEBUG"
+ Culture="2057"
+ />
+ <Tool
+ Name="VCPreLinkEventTool"
+ />
+ <Tool
+ Name="VCLinkerTool"
+ AdditionalDependencies="axis2_parser.lib axis2_util.lib axiom.lib tuscany_sdo.lib $(NOINHERIT)"
+ OutputFile="Debug/tuscany_sdo_axiom.dll"
+ LinkIncremental="2"
+ SuppressStartupBanner="true"
+ AdditionalLibraryDirectories="..\..\..\deploy\lib,$(AXIS2C_HOME)\lib"
+ GenerateDebugInformation="true"
+ ProgramDatabaseFile=".\Debug/tuscany_sdo_axiom.pdb"
+ ImportLibrary=".\Debug/tuscany_sdo_axiom.lib"
+ TargetMachine="1"
+ />
+ <Tool
+ Name="VCALinkTool"
+ />
+ <Tool
+ Name="VCManifestTool"
+ />
+ <Tool
+ Name="VCXDCMakeTool"
+ />
+ <Tool
+ Name="VCBscMakeTool"
+ SuppressStartupBanner="true"
+ OutputFile=".\Debug/sdo_axiom.bsc"
+ />
+ <Tool
+ Name="VCFxCopTool"
+ />
+ <Tool
+ Name="VCAppVerifierTool"
+ />
+ <Tool
+ Name="VCWebDeploymentTool"
+ />
+ <Tool
+ Name="VCPostBuildEventTool"
+ CommandLine="..\..\..\runtime\core\sdo_axiom\deploy.bat ..\..\..\ Debug"
+ />
+ </Configuration>
+ </Configurations>
+ <References>
+ </References>
+ <Files>
+ <Filter
+ Name="Source Files"
+ Filter="cpp;c;cxx;rc;def;r;odl;idl;hpj;bat"
+ >
+ <File
+ RelativePath="..\..\..\runtime\core\sdo_axiom\sdo_axiom.cpp"
+ >
+ <FileConfiguration
+ Name="Release|Win32"
+ >
+ <Tool
+ Name="VCCLCompilerTool"
+ AdditionalIncludeDirectories=""
+ PreprocessorDefinitions=""
+ />
+ </FileConfiguration>
+ <FileConfiguration
+ Name="Debug|Win32"
+ >
+ <Tool
+ Name="VCCLCompilerTool"
+ AdditionalIncludeDirectories=""
+ PreprocessorDefinitions=""
+ />
+ </FileConfiguration>
+ </File>
+ </Filter>
+ <Filter
+ Name="Header Files"
+ Filter="h;hpp;hxx;hm;inl"
+ >
+ <File
+ RelativePath="..\..\..\runtime\core\sdo_axiom\sdo_axiom.h"
+ >
+ </File>
+ <File
+ RelativePath="..\..\..\runtime\core\sdo_axiom\sdo_axiom_export.h"
+ >
+ </File>
+ </Filter>
+ <Filter
+ Name="Resource Files"
+ Filter="ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe"
+ >
+ </Filter>
+ </Files>
+ <Globals>
+ </Globals>
+</VisualStudioProject>
diff --git a/sdo-cpp/trunk/VSExpress/tuscany_sdo/sdo_axiom_test/sdo_axiom_test.vcproj b/sdo-cpp/trunk/VSExpress/tuscany_sdo/sdo_axiom_test/sdo_axiom_test.vcproj
new file mode 100644
index 0000000000..8249f3d205
--- /dev/null
+++ b/sdo-cpp/trunk/VSExpress/tuscany_sdo/sdo_axiom_test/sdo_axiom_test.vcproj
@@ -0,0 +1,249 @@
+<?xml version="1.0" encoding="Windows-1252"?>
+<VisualStudioProject
+ ProjectType="Visual C++"
+ Version="8.00"
+ Name="sdo_axiom_test"
+ ProjectGUID="{606A0280-529A-40A1-9B3C-80111D3AE920}"
+ >
+ <Platforms>
+ <Platform
+ Name="Win32"
+ />
+ </Platforms>
+ <ToolFiles>
+ </ToolFiles>
+ <Configurations>
+ <Configuration
+ Name="Release|Win32"
+ OutputDirectory=".\Release"
+ IntermediateDirectory=".\Release"
+ ConfigurationType="1"
+ InheritedPropertySheets="$(VCInstallDir)VCProjectDefaults\UpgradeFromVC60.vsprops"
+ UseOfMFC="0"
+ ATLMinimizesCRunTimeLibraryUsage="false"
+ CharacterSet="2"
+ >
+ <Tool
+ Name="VCPreBuildEventTool"
+ />
+ <Tool
+ Name="VCCustomBuildTool"
+ />
+ <Tool
+ Name="VCXMLDataGeneratorTool"
+ />
+ <Tool
+ Name="VCWebServiceProxyGeneratorTool"
+ />
+ <Tool
+ Name="VCMIDLTool"
+ TypeLibraryName=".\Release/sdo_axiom_test.tlb"
+ HeaderFileName=""
+ />
+ <Tool
+ Name="VCCLCompilerTool"
+ Optimization="2"
+ InlineFunctionExpansion="1"
+ AdditionalIncludeDirectories="..\..\..\deploy\include,$(AXIS2C_HOME)\include"
+ PreprocessorDefinitions="WIN32;NDEBUG;_CONSOLE;_CRT_SECURE_NO_DEPRECATE"
+ StringPooling="true"
+ RuntimeLibrary="2"
+ EnableFunctionLevelLinking="true"
+ PrecompiledHeaderFile=".\Release/sdo_axiom_test.pch"
+ AssemblerListingLocation=".\Release/"
+ ObjectFile=".\Release/"
+ ProgramDataBaseFileName=".\Release/"
+ WarningLevel="3"
+ SuppressStartupBanner="true"
+ />
+ <Tool
+ Name="VCManagedResourceCompilerTool"
+ />
+ <Tool
+ Name="VCResourceCompilerTool"
+ PreprocessorDefinitions="NDEBUG"
+ Culture="2057"
+ />
+ <Tool
+ Name="VCPreLinkEventTool"
+ />
+ <Tool
+ Name="VCLinkerTool"
+ AdditionalDependencies="tuscany_sdo.lib tuscany_sdo_axiom.lib $(NOINHERIT)"
+ OutputFile=".\Release/sdo_axiom_test.exe"
+ LinkIncremental="1"
+ SuppressStartupBanner="true"
+ AdditionalLibraryDirectories="..\..\..\deploy\lib"
+ ProgramDatabaseFile=".\Release/sdo_axiom_test.pdb"
+ SubSystem="1"
+ TargetMachine="1"
+ />
+ <Tool
+ Name="VCALinkTool"
+ />
+ <Tool
+ Name="VCManifestTool"
+ />
+ <Tool
+ Name="VCXDCMakeTool"
+ />
+ <Tool
+ Name="VCBscMakeTool"
+ SuppressStartupBanner="true"
+ OutputFile=".\Release/sdo_axiom_test.bsc"
+ />
+ <Tool
+ Name="VCFxCopTool"
+ />
+ <Tool
+ Name="VCAppVerifierTool"
+ />
+ <Tool
+ Name="VCWebDeploymentTool"
+ />
+ <Tool
+ Name="VCPostBuildEventTool"
+ />
+ </Configuration>
+ <Configuration
+ Name="Debug|Win32"
+ OutputDirectory=".\Debug"
+ IntermediateDirectory=".\Debug"
+ ConfigurationType="1"
+ InheritedPropertySheets="$(VCInstallDir)VCProjectDefaults\UpgradeFromVC60.vsprops"
+ UseOfMFC="0"
+ ATLMinimizesCRunTimeLibraryUsage="false"
+ CharacterSet="2"
+ >
+ <Tool
+ Name="VCPreBuildEventTool"
+ />
+ <Tool
+ Name="VCCustomBuildTool"
+ />
+ <Tool
+ Name="VCXMLDataGeneratorTool"
+ />
+ <Tool
+ Name="VCWebServiceProxyGeneratorTool"
+ />
+ <Tool
+ Name="VCMIDLTool"
+ TypeLibraryName=".\Debug/sdo_axiom_test.tlb"
+ HeaderFileName=""
+ />
+ <Tool
+ Name="VCCLCompilerTool"
+ Optimization="0"
+ AdditionalIncludeDirectories="..\..\..\deploy\include,$(AXIS2C_HOME)\include"
+ PreprocessorDefinitions="WIN32;_DEBUG;_CONSOLE;_CRT_SECURE_NO_DEPRECATE"
+ MinimalRebuild="true"
+ BasicRuntimeChecks="3"
+ RuntimeLibrary="3"
+ PrecompiledHeaderFile=".\Debug/sdo_axiom_test.pch"
+ AssemblerListingLocation=".\Debug/"
+ ObjectFile=".\Debug/"
+ ProgramDataBaseFileName=".\Debug/"
+ WarningLevel="3"
+ SuppressStartupBanner="true"
+ DebugInformationFormat="4"
+ />
+ <Tool
+ Name="VCManagedResourceCompilerTool"
+ />
+ <Tool
+ Name="VCResourceCompilerTool"
+ PreprocessorDefinitions="_DEBUG"
+ Culture="2057"
+ />
+ <Tool
+ Name="VCPreLinkEventTool"
+ />
+ <Tool
+ Name="VCLinkerTool"
+ AdditionalDependencies="tuscany_sdo.lib tuscany_sdo_axiom.lib $(NOINHERIT)"
+ OutputFile=".\Debug/sdo_axiom_test.exe"
+ LinkIncremental="2"
+ SuppressStartupBanner="true"
+ AdditionalLibraryDirectories="..\..\..\deploy\lib"
+ GenerateDebugInformation="true"
+ ProgramDatabaseFile=".\Debug/sdo_axiom_test.pdb"
+ SubSystem="1"
+ TargetMachine="1"
+ />
+ <Tool
+ Name="VCALinkTool"
+ />
+ <Tool
+ Name="VCManifestTool"
+ />
+ <Tool
+ Name="VCXDCMakeTool"
+ />
+ <Tool
+ Name="VCBscMakeTool"
+ SuppressStartupBanner="true"
+ OutputFile=".\Debug/sdo_axiom_test.bsc"
+ />
+ <Tool
+ Name="VCFxCopTool"
+ />
+ <Tool
+ Name="VCAppVerifierTool"
+ />
+ <Tool
+ Name="VCWebDeploymentTool"
+ />
+ <Tool
+ Name="VCPostBuildEventTool"
+ />
+ </Configuration>
+ </Configurations>
+ <References>
+ </References>
+ <Files>
+ <Filter
+ Name="Source Files"
+ Filter="cpp;c;cxx;rc;def;r;odl;idl;hpj;bat"
+ >
+ <File
+ RelativePath="..\..\..\runtime\core\sdo_axiom_test\sdo_axiom_test.cpp"
+ >
+ <FileConfiguration
+ Name="Release|Win32"
+ >
+ <Tool
+ Name="VCCLCompilerTool"
+ AdditionalIncludeDirectories=""
+ PreprocessorDefinitions=""
+ />
+ </FileConfiguration>
+ <FileConfiguration
+ Name="Debug|Win32"
+ >
+ <Tool
+ Name="VCCLCompilerTool"
+ AdditionalIncludeDirectories=""
+ PreprocessorDefinitions=""
+ />
+ </FileConfiguration>
+ </File>
+ </Filter>
+ <Filter
+ Name="Header Files"
+ Filter="h;hpp;hxx;hm;inl"
+ >
+ <File
+ RelativePath="..\..\..\runtime\core\sdo_axiom_test\sdo_axiom_test.h"
+ >
+ </File>
+ </Filter>
+ <Filter
+ Name="Resource Files"
+ Filter="ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe"
+ >
+ </Filter>
+ </Files>
+ <Globals>
+ </Globals>
+</VisualStudioProject>
diff --git a/sdo-cpp/trunk/VSExpress/tuscany_sdo/sdo_runtime/sdo_runtime.vcproj b/sdo-cpp/trunk/VSExpress/tuscany_sdo/sdo_runtime/sdo_runtime.vcproj
new file mode 100644
index 0000000000..6718789ae8
--- /dev/null
+++ b/sdo-cpp/trunk/VSExpress/tuscany_sdo/sdo_runtime/sdo_runtime.vcproj
@@ -0,0 +1,2242 @@
+<?xml version="1.0" encoding="Windows-1252"?>
+<VisualStudioProject
+ ProjectType="Visual C++"
+ Version="8.00"
+ Name="sdo_runtime"
+ ProjectGUID="{964F3F93-8D1C-46BE-9724-2313CE7380AA}"
+ RootNamespace="sdo_runtime"
+ >
+ <Platforms>
+ <Platform
+ Name="Win32"
+ />
+ </Platforms>
+ <ToolFiles>
+ </ToolFiles>
+ <Configurations>
+ <Configuration
+ Name="Release|Win32"
+ OutputDirectory=".\Release"
+ IntermediateDirectory=".\Release"
+ ConfigurationType="2"
+ InheritedPropertySheets="$(VCInstallDir)VCProjectDefaults\UpgradeFromVC60.vsprops"
+ UseOfMFC="0"
+ ATLMinimizesCRunTimeLibraryUsage="false"
+ CharacterSet="2"
+ >
+ <Tool
+ Name="VCPreBuildEventTool"
+ />
+ <Tool
+ Name="VCCustomBuildTool"
+ />
+ <Tool
+ Name="VCXMLDataGeneratorTool"
+ />
+ <Tool
+ Name="VCWebServiceProxyGeneratorTool"
+ />
+ <Tool
+ Name="VCMIDLTool"
+ PreprocessorDefinitions="NDEBUG"
+ MkTypLibCompatible="true"
+ SuppressStartupBanner="true"
+ TargetEnvironment="1"
+ TypeLibraryName=".\Release/sdo_runtime.tlb"
+ HeaderFileName=""
+ />
+ <Tool
+ Name="VCCLCompilerTool"
+ Optimization="2"
+ InlineFunctionExpansion="1"
+ AdditionalIncludeDirectories="..\..\..\runtime\core\src,$(LIBXML2_HOME)\include,$(ICONV_HOME)\include,$(ZLIB_HOME)\include"
+ PreprocessorDefinitions="WIN32;NDEBUG;_WINDOWS;_USRDLL;SDO_EXPORTS;_CRT_SECURE_NO_DEPRECATE"
+ StringPooling="true"
+ RuntimeLibrary="2"
+ EnableFunctionLevelLinking="true"
+ PrecompiledHeaderFile=".\Release/sdo_runtime.pch"
+ AssemblerListingLocation=".\Release/"
+ ObjectFile=".\Release/"
+ ProgramDataBaseFileName=".\Release/"
+ WarningLevel="3"
+ SuppressStartupBanner="true"
+ />
+ <Tool
+ Name="VCManagedResourceCompilerTool"
+ />
+ <Tool
+ Name="VCResourceCompilerTool"
+ PreprocessorDefinitions="NDEBUG"
+ Culture="2057"
+ />
+ <Tool
+ Name="VCPreLinkEventTool"
+ />
+ <Tool
+ Name="VCLinkerTool"
+ AdditionalDependencies="libxml2.lib $(NOINHERIT)"
+ OutputFile="Release\tuscany_sdo.dll"
+ LinkIncremental="1"
+ SuppressStartupBanner="true"
+ AdditionalLibraryDirectories="$(LIBXML2_HOME)\lib"
+ ProgramDatabaseFile=".\Release/tuscany_sdo.pdb"
+ ImportLibrary=".\Release/tuscany_sdo.lib"
+ TargetMachine="1"
+ />
+ <Tool
+ Name="VCALinkTool"
+ />
+ <Tool
+ Name="VCManifestTool"
+ />
+ <Tool
+ Name="VCXDCMakeTool"
+ />
+ <Tool
+ Name="VCBscMakeTool"
+ SuppressStartupBanner="true"
+ OutputFile=".\Release/sdo_runtime.bsc"
+ />
+ <Tool
+ Name="VCFxCopTool"
+ />
+ <Tool
+ Name="VCAppVerifierTool"
+ />
+ <Tool
+ Name="VCWebDeploymentTool"
+ />
+ <Tool
+ Name="VCPostBuildEventTool"
+ Description="deploy"
+ CommandLine="..\..\..\runtime\core\src\deploy.bat ..\..\..\ Release"
+ />
+ </Configuration>
+ <Configuration
+ Name="Debug|Win32"
+ OutputDirectory=".\Debug"
+ IntermediateDirectory=".\Debug"
+ ConfigurationType="2"
+ InheritedPropertySheets="$(VCInstallDir)VCProjectDefaults\UpgradeFromVC60.vsprops"
+ UseOfMFC="0"
+ ATLMinimizesCRunTimeLibraryUsage="false"
+ CharacterSet="2"
+ >
+ <Tool
+ Name="VCPreBuildEventTool"
+ />
+ <Tool
+ Name="VCCustomBuildTool"
+ />
+ <Tool
+ Name="VCXMLDataGeneratorTool"
+ />
+ <Tool
+ Name="VCWebServiceProxyGeneratorTool"
+ />
+ <Tool
+ Name="VCMIDLTool"
+ PreprocessorDefinitions="_DEBUG"
+ MkTypLibCompatible="true"
+ SuppressStartupBanner="true"
+ TargetEnvironment="1"
+ TypeLibraryName=".\Debug/sdo_runtime.tlb"
+ HeaderFileName=""
+ />
+ <Tool
+ Name="VCCLCompilerTool"
+ Optimization="0"
+ AdditionalIncludeDirectories="..\..\..\runtime\core\src,$(LIBXML2_HOME)\include,$(ICONV_HOME)\include,$(ZLIB_HOME)\include"
+ PreprocessorDefinitions="WIN32;_DEBUG;_WINDOWS;_USRDLL;SDO_EXPORTS;_CRT_SECURE_NO_DEPRECATE"
+ MinimalRebuild="true"
+ BasicRuntimeChecks="3"
+ RuntimeLibrary="3"
+ PrecompiledHeaderFile=".\Debug/sdo_runtime.pch"
+ AssemblerListingLocation=".\Debug/"
+ ObjectFile=".\Debug/"
+ ProgramDataBaseFileName=".\Debug/"
+ WarningLevel="3"
+ SuppressStartupBanner="true"
+ DebugInformationFormat="4"
+ />
+ <Tool
+ Name="VCManagedResourceCompilerTool"
+ />
+ <Tool
+ Name="VCResourceCompilerTool"
+ PreprocessorDefinitions="_DEBUG"
+ Culture="2057"
+ />
+ <Tool
+ Name="VCPreLinkEventTool"
+ />
+ <Tool
+ Name="VCLinkerTool"
+ AdditionalDependencies="libxml2.lib $(NOINHERIT)"
+ OutputFile="Debug\tuscany_sdo.dll"
+ LinkIncremental="2"
+ SuppressStartupBanner="true"
+ AdditionalLibraryDirectories="$(LIBXML2_HOME)\lib"
+ GenerateDebugInformation="true"
+ ProgramDatabaseFile=".\Debug/tuscany_sdo.pdb"
+ ImportLibrary=".\Debug/tuscany_sdo.lib"
+ TargetMachine="1"
+ />
+ <Tool
+ Name="VCALinkTool"
+ />
+ <Tool
+ Name="VCManifestTool"
+ />
+ <Tool
+ Name="VCXDCMakeTool"
+ />
+ <Tool
+ Name="VCBscMakeTool"
+ SuppressStartupBanner="true"
+ OutputFile=".\Debug/sdo_runtime.bsc"
+ />
+ <Tool
+ Name="VCFxCopTool"
+ />
+ <Tool
+ Name="VCAppVerifierTool"
+ />
+ <Tool
+ Name="VCWebDeploymentTool"
+ />
+ <Tool
+ Name="VCPostBuildEventTool"
+ Description="deploy"
+ CommandLine="..\..\..\runtime\core\src\deploy.bat ..\..\..\ Debug"
+ />
+ </Configuration>
+ </Configurations>
+ <References>
+ </References>
+ <Files>
+ <Filter
+ Name="Source Files"
+ Filter="cpp;c;cxx;rc;def;r;odl;idl;hpj;bat"
+ >
+ <File
+ RelativePath="..\..\..\runtime\core\src\commonj\sdo\ChangedDataObjectListImpl.cpp"
+ >
+ <FileConfiguration
+ Name="Release|Win32"
+ >
+ <Tool
+ Name="VCCLCompilerTool"
+ AdditionalIncludeDirectories=""
+ PreprocessorDefinitions=""
+ />
+ </FileConfiguration>
+ <FileConfiguration
+ Name="Debug|Win32"
+ >
+ <Tool
+ Name="VCCLCompilerTool"
+ AdditionalIncludeDirectories=""
+ PreprocessorDefinitions=""
+ />
+ </FileConfiguration>
+ </File>
+ <File
+ RelativePath="..\..\..\runtime\core\src\commonj\sdo\ChangeSummary.cpp"
+ >
+ <FileConfiguration
+ Name="Release|Win32"
+ >
+ <Tool
+ Name="VCCLCompilerTool"
+ AdditionalIncludeDirectories=""
+ PreprocessorDefinitions=""
+ />
+ </FileConfiguration>
+ <FileConfiguration
+ Name="Debug|Win32"
+ >
+ <Tool
+ Name="VCCLCompilerTool"
+ AdditionalIncludeDirectories=""
+ PreprocessorDefinitions=""
+ />
+ </FileConfiguration>
+ </File>
+ <File
+ RelativePath="..\..\..\runtime\core\src\commonj\sdo\ChangeSummaryBuilder.cpp"
+ >
+ <FileConfiguration
+ Name="Release|Win32"
+ >
+ <Tool
+ Name="VCCLCompilerTool"
+ AdditionalIncludeDirectories=""
+ PreprocessorDefinitions=""
+ />
+ </FileConfiguration>
+ <FileConfiguration
+ Name="Debug|Win32"
+ >
+ <Tool
+ Name="VCCLCompilerTool"
+ AdditionalIncludeDirectories=""
+ PreprocessorDefinitions=""
+ />
+ </FileConfiguration>
+ </File>
+ <File
+ RelativePath="..\..\..\runtime\core\src\commonj\sdo\ChangeSummaryImpl.cpp"
+ >
+ <FileConfiguration
+ Name="Release|Win32"
+ >
+ <Tool
+ Name="VCCLCompilerTool"
+ AdditionalIncludeDirectories=""
+ PreprocessorDefinitions=""
+ />
+ </FileConfiguration>
+ <FileConfiguration
+ Name="Debug|Win32"
+ >
+ <Tool
+ Name="VCCLCompilerTool"
+ AdditionalIncludeDirectories=""
+ PreprocessorDefinitions=""
+ />
+ </FileConfiguration>
+ </File>
+ <File
+ RelativePath="..\..\..\runtime\core\src\commonj\sdo\CopyHelper.cpp"
+ >
+ <FileConfiguration
+ Name="Release|Win32"
+ >
+ <Tool
+ Name="VCCLCompilerTool"
+ AdditionalIncludeDirectories=""
+ PreprocessorDefinitions=""
+ />
+ </FileConfiguration>
+ <FileConfiguration
+ Name="Debug|Win32"
+ >
+ <Tool
+ Name="VCCLCompilerTool"
+ AdditionalIncludeDirectories=""
+ PreprocessorDefinitions=""
+ />
+ </FileConfiguration>
+ </File>
+ <File
+ RelativePath="..\..\..\runtime\core\src\commonj\sdo\DASProperty.cpp"
+ >
+ <FileConfiguration
+ Name="Release|Win32"
+ >
+ <Tool
+ Name="VCCLCompilerTool"
+ AdditionalIncludeDirectories=""
+ PreprocessorDefinitions=""
+ />
+ </FileConfiguration>
+ <FileConfiguration
+ Name="Debug|Win32"
+ >
+ <Tool
+ Name="VCCLCompilerTool"
+ AdditionalIncludeDirectories=""
+ PreprocessorDefinitions=""
+ />
+ </FileConfiguration>
+ </File>
+ <File
+ RelativePath="..\..\..\runtime\core\src\commonj\sdo\DASType.cpp"
+ >
+ <FileConfiguration
+ Name="Release|Win32"
+ >
+ <Tool
+ Name="VCCLCompilerTool"
+ AdditionalIncludeDirectories=""
+ PreprocessorDefinitions=""
+ />
+ </FileConfiguration>
+ <FileConfiguration
+ Name="Debug|Win32"
+ >
+ <Tool
+ Name="VCCLCompilerTool"
+ AdditionalIncludeDirectories=""
+ PreprocessorDefinitions=""
+ />
+ </FileConfiguration>
+ </File>
+ <File
+ RelativePath="..\..\..\runtime\core\src\commonj\sdo\DASValue.cpp"
+ >
+ <FileConfiguration
+ Name="Release|Win32"
+ >
+ <Tool
+ Name="VCCLCompilerTool"
+ AdditionalIncludeDirectories=""
+ PreprocessorDefinitions=""
+ />
+ </FileConfiguration>
+ <FileConfiguration
+ Name="Debug|Win32"
+ >
+ <Tool
+ Name="VCCLCompilerTool"
+ AdditionalIncludeDirectories=""
+ PreprocessorDefinitions=""
+ />
+ </FileConfiguration>
+ </File>
+ <File
+ RelativePath="..\..\..\runtime\core\src\commonj\sdo\DASValues.cpp"
+ >
+ <FileConfiguration
+ Name="Release|Win32"
+ >
+ <Tool
+ Name="VCCLCompilerTool"
+ AdditionalIncludeDirectories=""
+ PreprocessorDefinitions=""
+ />
+ </FileConfiguration>
+ <FileConfiguration
+ Name="Debug|Win32"
+ >
+ <Tool
+ Name="VCCLCompilerTool"
+ AdditionalIncludeDirectories=""
+ PreprocessorDefinitions=""
+ />
+ </FileConfiguration>
+ </File>
+ <File
+ RelativePath="..\..\..\runtime\core\src\commonj\sdo\DataFactory.cpp"
+ >
+ <FileConfiguration
+ Name="Release|Win32"
+ >
+ <Tool
+ Name="VCCLCompilerTool"
+ AdditionalIncludeDirectories=""
+ PreprocessorDefinitions=""
+ />
+ </FileConfiguration>
+ <FileConfiguration
+ Name="Debug|Win32"
+ >
+ <Tool
+ Name="VCCLCompilerTool"
+ AdditionalIncludeDirectories=""
+ PreprocessorDefinitions=""
+ />
+ </FileConfiguration>
+ </File>
+ <File
+ RelativePath="..\..\..\runtime\core\src\commonj\sdo\DataFactoryImpl.cpp"
+ >
+ <FileConfiguration
+ Name="Release|Win32"
+ >
+ <Tool
+ Name="VCCLCompilerTool"
+ AdditionalIncludeDirectories=""
+ PreprocessorDefinitions=""
+ />
+ </FileConfiguration>
+ <FileConfiguration
+ Name="Debug|Win32"
+ >
+ <Tool
+ Name="VCCLCompilerTool"
+ AdditionalIncludeDirectories=""
+ PreprocessorDefinitions=""
+ />
+ </FileConfiguration>
+ </File>
+ <File
+ RelativePath="..\..\..\runtime\core\src\commonj\sdo\DataGraph.cpp"
+ >
+ <FileConfiguration
+ Name="Release|Win32"
+ >
+ <Tool
+ Name="VCCLCompilerTool"
+ AdditionalIncludeDirectories=""
+ PreprocessorDefinitions=""
+ />
+ </FileConfiguration>
+ <FileConfiguration
+ Name="Debug|Win32"
+ >
+ <Tool
+ Name="VCCLCompilerTool"
+ AdditionalIncludeDirectories=""
+ PreprocessorDefinitions=""
+ />
+ </FileConfiguration>
+ </File>
+ <File
+ RelativePath="..\..\..\runtime\core\src\commonj\sdo\DataGraphImpl.cpp"
+ >
+ <FileConfiguration
+ Name="Release|Win32"
+ >
+ <Tool
+ Name="VCCLCompilerTool"
+ AdditionalIncludeDirectories=""
+ PreprocessorDefinitions=""
+ />
+ </FileConfiguration>
+ <FileConfiguration
+ Name="Debug|Win32"
+ >
+ <Tool
+ Name="VCCLCompilerTool"
+ AdditionalIncludeDirectories=""
+ PreprocessorDefinitions=""
+ />
+ </FileConfiguration>
+ </File>
+ <File
+ RelativePath="..\..\..\runtime\core\src\commonj\sdo\DataObject.cpp"
+ >
+ <FileConfiguration
+ Name="Release|Win32"
+ >
+ <Tool
+ Name="VCCLCompilerTool"
+ AdditionalIncludeDirectories=""
+ PreprocessorDefinitions=""
+ />
+ </FileConfiguration>
+ <FileConfiguration
+ Name="Debug|Win32"
+ >
+ <Tool
+ Name="VCCLCompilerTool"
+ AdditionalIncludeDirectories=""
+ PreprocessorDefinitions=""
+ />
+ </FileConfiguration>
+ </File>
+ <File
+ RelativePath="..\..\..\runtime\core\src\commonj\sdo\DataObjectImpl.cpp"
+ >
+ <FileConfiguration
+ Name="Release|Win32"
+ >
+ <Tool
+ Name="VCCLCompilerTool"
+ AdditionalIncludeDirectories=""
+ PreprocessorDefinitions=""
+ />
+ </FileConfiguration>
+ <FileConfiguration
+ Name="Debug|Win32"
+ >
+ <Tool
+ Name="VCCLCompilerTool"
+ AdditionalIncludeDirectories=""
+ PreprocessorDefinitions=""
+ />
+ </FileConfiguration>
+ </File>
+ <File
+ RelativePath="..\..\..\runtime\core\src\commonj\sdo\DataObjectList.cpp"
+ >
+ <FileConfiguration
+ Name="Release|Win32"
+ >
+ <Tool
+ Name="VCCLCompilerTool"
+ AdditionalIncludeDirectories=""
+ PreprocessorDefinitions=""
+ />
+ </FileConfiguration>
+ <FileConfiguration
+ Name="Debug|Win32"
+ >
+ <Tool
+ Name="VCCLCompilerTool"
+ AdditionalIncludeDirectories=""
+ PreprocessorDefinitions=""
+ />
+ </FileConfiguration>
+ </File>
+ <File
+ RelativePath="..\..\..\runtime\core\src\commonj\sdo\DataObjectListImpl.cpp"
+ >
+ <FileConfiguration
+ Name="Release|Win32"
+ >
+ <Tool
+ Name="VCCLCompilerTool"
+ AdditionalIncludeDirectories=""
+ PreprocessorDefinitions=""
+ />
+ </FileConfiguration>
+ <FileConfiguration
+ Name="Debug|Win32"
+ >
+ <Tool
+ Name="VCCLCompilerTool"
+ AdditionalIncludeDirectories=""
+ PreprocessorDefinitions=""
+ />
+ </FileConfiguration>
+ </File>
+ <File
+ RelativePath="..\..\..\runtime\core\src\commonj\sdo\DataTypeInfo.cpp"
+ >
+ </File>
+ <File
+ RelativePath="..\..\..\runtime\core\src\commonj\sdo\DefaultLogWriter.cpp"
+ >
+ <FileConfiguration
+ Name="Release|Win32"
+ >
+ <Tool
+ Name="VCCLCompilerTool"
+ AdditionalIncludeDirectories=""
+ PreprocessorDefinitions=""
+ />
+ </FileConfiguration>
+ <FileConfiguration
+ Name="Debug|Win32"
+ >
+ <Tool
+ Name="VCCLCompilerTool"
+ AdditionalIncludeDirectories=""
+ PreprocessorDefinitions=""
+ />
+ </FileConfiguration>
+ </File>
+ <File
+ RelativePath="..\..\..\runtime\core\src\commonj\sdo\EqualityHelper.cpp"
+ >
+ <FileConfiguration
+ Name="Release|Win32"
+ >
+ <Tool
+ Name="VCCLCompilerTool"
+ AdditionalIncludeDirectories=""
+ PreprocessorDefinitions=""
+ />
+ </FileConfiguration>
+ <FileConfiguration
+ Name="Debug|Win32"
+ >
+ <Tool
+ Name="VCCLCompilerTool"
+ AdditionalIncludeDirectories=""
+ PreprocessorDefinitions=""
+ />
+ </FileConfiguration>
+ </File>
+ <File
+ RelativePath="..\..\..\runtime\core\src\commonj\sdo\GroupDefinition.cpp"
+ >
+ <FileConfiguration
+ Name="Release|Win32"
+ >
+ <Tool
+ Name="VCCLCompilerTool"
+ AdditionalIncludeDirectories=""
+ PreprocessorDefinitions=""
+ />
+ </FileConfiguration>
+ <FileConfiguration
+ Name="Debug|Win32"
+ >
+ <Tool
+ Name="VCCLCompilerTool"
+ AdditionalIncludeDirectories=""
+ PreprocessorDefinitions=""
+ />
+ </FileConfiguration>
+ </File>
+ <File
+ RelativePath="..\..\..\runtime\core\src\commonj\sdo\GroupEvent.cpp"
+ >
+ <FileConfiguration
+ Name="Release|Win32"
+ >
+ <Tool
+ Name="VCCLCompilerTool"
+ AdditionalIncludeDirectories=""
+ PreprocessorDefinitions=""
+ />
+ </FileConfiguration>
+ <FileConfiguration
+ Name="Debug|Win32"
+ >
+ <Tool
+ Name="VCCLCompilerTool"
+ AdditionalIncludeDirectories=""
+ PreprocessorDefinitions=""
+ />
+ </FileConfiguration>
+ </File>
+ <File
+ RelativePath="..\..\..\runtime\core\src\commonj\sdo\HelperProvider.cpp"
+ >
+ <FileConfiguration
+ Name="Release|Win32"
+ >
+ <Tool
+ Name="VCCLCompilerTool"
+ AdditionalIncludeDirectories=""
+ PreprocessorDefinitions=""
+ />
+ </FileConfiguration>
+ <FileConfiguration
+ Name="Debug|Win32"
+ >
+ <Tool
+ Name="VCCLCompilerTool"
+ AdditionalIncludeDirectories=""
+ PreprocessorDefinitions=""
+ />
+ </FileConfiguration>
+ </File>
+ <File
+ RelativePath="..\..\..\runtime\core\src\commonj\sdo\Logger.cpp"
+ >
+ <FileConfiguration
+ Name="Release|Win32"
+ >
+ <Tool
+ Name="VCCLCompilerTool"
+ AdditionalIncludeDirectories=""
+ PreprocessorDefinitions=""
+ />
+ </FileConfiguration>
+ <FileConfiguration
+ Name="Debug|Win32"
+ >
+ <Tool
+ Name="VCCLCompilerTool"
+ AdditionalIncludeDirectories=""
+ PreprocessorDefinitions=""
+ />
+ </FileConfiguration>
+ </File>
+ <File
+ RelativePath="..\..\..\runtime\core\src\commonj\sdo\LogWriter.cpp"
+ >
+ <FileConfiguration
+ Name="Release|Win32"
+ >
+ <Tool
+ Name="VCCLCompilerTool"
+ AdditionalIncludeDirectories=""
+ PreprocessorDefinitions=""
+ />
+ </FileConfiguration>
+ <FileConfiguration
+ Name="Debug|Win32"
+ >
+ <Tool
+ Name="VCCLCompilerTool"
+ AdditionalIncludeDirectories=""
+ PreprocessorDefinitions=""
+ />
+ </FileConfiguration>
+ </File>
+ <File
+ RelativePath="..\..\..\runtime\core\src\commonj\sdo\ParserErrorSetter.cpp"
+ >
+ <FileConfiguration
+ Name="Release|Win32"
+ >
+ <Tool
+ Name="VCCLCompilerTool"
+ AdditionalIncludeDirectories=""
+ PreprocessorDefinitions=""
+ />
+ </FileConfiguration>
+ <FileConfiguration
+ Name="Debug|Win32"
+ >
+ <Tool
+ Name="VCCLCompilerTool"
+ AdditionalIncludeDirectories=""
+ PreprocessorDefinitions=""
+ />
+ </FileConfiguration>
+ </File>
+ <File
+ RelativePath="..\..\..\runtime\core\src\commonj\sdo\Property.cpp"
+ >
+ <FileConfiguration
+ Name="Release|Win32"
+ >
+ <Tool
+ Name="VCCLCompilerTool"
+ AdditionalIncludeDirectories=""
+ PreprocessorDefinitions=""
+ />
+ </FileConfiguration>
+ <FileConfiguration
+ Name="Debug|Win32"
+ >
+ <Tool
+ Name="VCCLCompilerTool"
+ AdditionalIncludeDirectories=""
+ PreprocessorDefinitions=""
+ />
+ </FileConfiguration>
+ </File>
+ <File
+ RelativePath="..\..\..\runtime\core\src\commonj\sdo\PropertyDefinition.cpp"
+ >
+ <FileConfiguration
+ Name="Release|Win32"
+ >
+ <Tool
+ Name="VCCLCompilerTool"
+ AdditionalIncludeDirectories=""
+ PreprocessorDefinitions=""
+ />
+ </FileConfiguration>
+ <FileConfiguration
+ Name="Debug|Win32"
+ >
+ <Tool
+ Name="VCCLCompilerTool"
+ AdditionalIncludeDirectories=""
+ PreprocessorDefinitions=""
+ />
+ </FileConfiguration>
+ </File>
+ <File
+ RelativePath="..\..\..\runtime\core\src\commonj\sdo\PropertyDefinitionImpl.cpp"
+ >
+ <FileConfiguration
+ Name="Release|Win32"
+ >
+ <Tool
+ Name="VCCLCompilerTool"
+ AdditionalIncludeDirectories=""
+ PreprocessorDefinitions=""
+ />
+ </FileConfiguration>
+ <FileConfiguration
+ Name="Debug|Win32"
+ >
+ <Tool
+ Name="VCCLCompilerTool"
+ AdditionalIncludeDirectories=""
+ PreprocessorDefinitions=""
+ />
+ </FileConfiguration>
+ </File>
+ <File
+ RelativePath="..\..\..\runtime\core\src\commonj\sdo\PropertyImpl.cpp"
+ >
+ <FileConfiguration
+ Name="Release|Win32"
+ >
+ <Tool
+ Name="VCCLCompilerTool"
+ AdditionalIncludeDirectories=""
+ PreprocessorDefinitions=""
+ />
+ </FileConfiguration>
+ <FileConfiguration
+ Name="Debug|Win32"
+ >
+ <Tool
+ Name="VCCLCompilerTool"
+ AdditionalIncludeDirectories=""
+ PreprocessorDefinitions=""
+ />
+ </FileConfiguration>
+ </File>
+ <File
+ RelativePath="..\..\..\runtime\core\src\commonj\sdo\PropertyList.cpp"
+ >
+ <FileConfiguration
+ Name="Release|Win32"
+ >
+ <Tool
+ Name="VCCLCompilerTool"
+ AdditionalIncludeDirectories=""
+ PreprocessorDefinitions=""
+ />
+ </FileConfiguration>
+ <FileConfiguration
+ Name="Debug|Win32"
+ >
+ <Tool
+ Name="VCCLCompilerTool"
+ AdditionalIncludeDirectories=""
+ PreprocessorDefinitions=""
+ />
+ </FileConfiguration>
+ </File>
+ <File
+ RelativePath="..\..\..\runtime\core\src\commonj\sdo\PropertySetting.cpp"
+ >
+ <FileConfiguration
+ Name="Release|Win32"
+ >
+ <Tool
+ Name="VCCLCompilerTool"
+ AdditionalIncludeDirectories=""
+ PreprocessorDefinitions=""
+ />
+ </FileConfiguration>
+ <FileConfiguration
+ Name="Debug|Win32"
+ >
+ <Tool
+ Name="VCCLCompilerTool"
+ AdditionalIncludeDirectories=""
+ PreprocessorDefinitions=""
+ />
+ </FileConfiguration>
+ </File>
+ <File
+ RelativePath="..\..\..\runtime\core\src\commonj\sdo\RefCountingObject.cpp"
+ >
+ <FileConfiguration
+ Name="Release|Win32"
+ >
+ <Tool
+ Name="VCCLCompilerTool"
+ AdditionalIncludeDirectories=""
+ PreprocessorDefinitions=""
+ />
+ </FileConfiguration>
+ <FileConfiguration
+ Name="Debug|Win32"
+ >
+ <Tool
+ Name="VCCLCompilerTool"
+ AdditionalIncludeDirectories=""
+ PreprocessorDefinitions=""
+ />
+ </FileConfiguration>
+ </File>
+ <File
+ RelativePath="..\..\..\runtime\core\src\commonj\sdo\RefCountingPointer.cpp"
+ >
+ <FileConfiguration
+ Name="Release|Win32"
+ >
+ <Tool
+ Name="VCCLCompilerTool"
+ AdditionalIncludeDirectories=""
+ PreprocessorDefinitions=""
+ />
+ </FileConfiguration>
+ <FileConfiguration
+ Name="Debug|Win32"
+ >
+ <Tool
+ Name="VCCLCompilerTool"
+ AdditionalIncludeDirectories=""
+ PreprocessorDefinitions=""
+ />
+ </FileConfiguration>
+ </File>
+ <File
+ RelativePath="..\..\..\runtime\core\src\commonj\sdo\SAX2Attribute.cpp"
+ >
+ <FileConfiguration
+ Name="Release|Win32"
+ >
+ <Tool
+ Name="VCCLCompilerTool"
+ AdditionalIncludeDirectories=""
+ PreprocessorDefinitions=""
+ />
+ </FileConfiguration>
+ <FileConfiguration
+ Name="Debug|Win32"
+ >
+ <Tool
+ Name="VCCLCompilerTool"
+ AdditionalIncludeDirectories=""
+ PreprocessorDefinitions=""
+ />
+ </FileConfiguration>
+ </File>
+ <File
+ RelativePath="..\..\..\runtime\core\src\commonj\sdo\SAX2Attributes.cpp"
+ >
+ <FileConfiguration
+ Name="Release|Win32"
+ >
+ <Tool
+ Name="VCCLCompilerTool"
+ AdditionalIncludeDirectories=""
+ PreprocessorDefinitions=""
+ />
+ </FileConfiguration>
+ <FileConfiguration
+ Name="Debug|Win32"
+ >
+ <Tool
+ Name="VCCLCompilerTool"
+ AdditionalIncludeDirectories=""
+ PreprocessorDefinitions=""
+ />
+ </FileConfiguration>
+ </File>
+ <File
+ RelativePath="..\..\..\runtime\core\src\commonj\sdo\SAX2Namespaces.cpp"
+ >
+ <FileConfiguration
+ Name="Release|Win32"
+ >
+ <Tool
+ Name="VCCLCompilerTool"
+ AdditionalIncludeDirectories=""
+ PreprocessorDefinitions=""
+ />
+ </FileConfiguration>
+ <FileConfiguration
+ Name="Debug|Win32"
+ >
+ <Tool
+ Name="VCCLCompilerTool"
+ AdditionalIncludeDirectories=""
+ PreprocessorDefinitions=""
+ />
+ </FileConfiguration>
+ </File>
+ <File
+ RelativePath="..\..\..\runtime\core\src\commonj\sdo\SAX2Parser.cpp"
+ >
+ <FileConfiguration
+ Name="Release|Win32"
+ >
+ <Tool
+ Name="VCCLCompilerTool"
+ AdditionalIncludeDirectories=""
+ PreprocessorDefinitions=""
+ />
+ </FileConfiguration>
+ <FileConfiguration
+ Name="Debug|Win32"
+ >
+ <Tool
+ Name="VCCLCompilerTool"
+ AdditionalIncludeDirectories=""
+ PreprocessorDefinitions=""
+ />
+ </FileConfiguration>
+ </File>
+ <File
+ RelativePath="..\..\..\runtime\core\src\commonj\sdo\SchemaInfo.cpp"
+ >
+ <FileConfiguration
+ Name="Release|Win32"
+ >
+ <Tool
+ Name="VCCLCompilerTool"
+ AdditionalIncludeDirectories=""
+ PreprocessorDefinitions=""
+ />
+ </FileConfiguration>
+ <FileConfiguration
+ Name="Debug|Win32"
+ >
+ <Tool
+ Name="VCCLCompilerTool"
+ AdditionalIncludeDirectories=""
+ PreprocessorDefinitions=""
+ />
+ </FileConfiguration>
+ </File>
+ <File
+ RelativePath="..\..\..\runtime\core\src\commonj\sdo\SdoCheck.cpp"
+ >
+ <FileConfiguration
+ Name="Release|Win32"
+ >
+ <Tool
+ Name="VCCLCompilerTool"
+ AdditionalIncludeDirectories=""
+ PreprocessorDefinitions=""
+ />
+ </FileConfiguration>
+ <FileConfiguration
+ Name="Debug|Win32"
+ >
+ <Tool
+ Name="VCCLCompilerTool"
+ AdditionalIncludeDirectories=""
+ PreprocessorDefinitions=""
+ />
+ </FileConfiguration>
+ </File>
+ <File
+ RelativePath="..\..\..\runtime\core\src\commonj\sdo\SDODataConverter.cpp"
+ >
+ </File>
+ <File
+ RelativePath="..\..\..\runtime\core\src\commonj\sdo\SDODate.cpp"
+ >
+ <FileConfiguration
+ Name="Release|Win32"
+ >
+ <Tool
+ Name="VCCLCompilerTool"
+ AdditionalIncludeDirectories=""
+ PreprocessorDefinitions=""
+ />
+ </FileConfiguration>
+ <FileConfiguration
+ Name="Debug|Win32"
+ >
+ <Tool
+ Name="VCCLCompilerTool"
+ AdditionalIncludeDirectories=""
+ PreprocessorDefinitions=""
+ />
+ </FileConfiguration>
+ </File>
+ <File
+ RelativePath="..\..\..\runtime\core\src\commonj\sdo\SdoRuntime.cpp"
+ >
+ <FileConfiguration
+ Name="Release|Win32"
+ >
+ <Tool
+ Name="VCCLCompilerTool"
+ AdditionalIncludeDirectories=""
+ PreprocessorDefinitions=""
+ />
+ </FileConfiguration>
+ <FileConfiguration
+ Name="Debug|Win32"
+ >
+ <Tool
+ Name="VCCLCompilerTool"
+ AdditionalIncludeDirectories=""
+ PreprocessorDefinitions=""
+ />
+ </FileConfiguration>
+ </File>
+ <File
+ RelativePath="..\..\..\runtime\core\src\commonj\sdo\SDORuntimeException.cpp"
+ >
+ <FileConfiguration
+ Name="Release|Win32"
+ >
+ <Tool
+ Name="VCCLCompilerTool"
+ AdditionalIncludeDirectories=""
+ PreprocessorDefinitions=""
+ />
+ </FileConfiguration>
+ <FileConfiguration
+ Name="Debug|Win32"
+ >
+ <Tool
+ Name="VCCLCompilerTool"
+ AdditionalIncludeDirectories=""
+ PreprocessorDefinitions=""
+ />
+ </FileConfiguration>
+ </File>
+ <File
+ RelativePath="..\..\..\runtime\core\src\commonj\sdo\SDOSAX2Parser.cpp"
+ >
+ <FileConfiguration
+ Name="Release|Win32"
+ >
+ <Tool
+ Name="VCCLCompilerTool"
+ AdditionalIncludeDirectories=""
+ PreprocessorDefinitions=""
+ />
+ </FileConfiguration>
+ <FileConfiguration
+ Name="Debug|Win32"
+ >
+ <Tool
+ Name="VCCLCompilerTool"
+ AdditionalIncludeDirectories=""
+ PreprocessorDefinitions=""
+ />
+ </FileConfiguration>
+ </File>
+ <File
+ RelativePath="..\..\..\runtime\core\src\commonj\sdo\SDOSchemaSAX2Parser.cpp"
+ >
+ <FileConfiguration
+ Name="Release|Win32"
+ >
+ <Tool
+ Name="VCCLCompilerTool"
+ AdditionalIncludeDirectories=""
+ PreprocessorDefinitions=""
+ />
+ </FileConfiguration>
+ <FileConfiguration
+ Name="Debug|Win32"
+ >
+ <Tool
+ Name="VCCLCompilerTool"
+ AdditionalIncludeDirectories=""
+ PreprocessorDefinitions=""
+ />
+ </FileConfiguration>
+ </File>
+ <File
+ RelativePath="..\..\..\runtime\core\src\commonj\sdo\SDOUtils.cpp"
+ >
+ <FileConfiguration
+ Name="Release|Win32"
+ >
+ <Tool
+ Name="VCCLCompilerTool"
+ AdditionalIncludeDirectories=""
+ PreprocessorDefinitions=""
+ />
+ </FileConfiguration>
+ <FileConfiguration
+ Name="Debug|Win32"
+ >
+ <Tool
+ Name="VCCLCompilerTool"
+ AdditionalIncludeDirectories=""
+ PreprocessorDefinitions=""
+ />
+ </FileConfiguration>
+ </File>
+ <File
+ RelativePath="..\..\..\runtime\core\src\commonj\sdo\SDOValue.cpp"
+ >
+ </File>
+ <File
+ RelativePath="..\..\..\runtime\core\src\commonj\sdo\SDOXMLBufferWriter.cpp"
+ >
+ <FileConfiguration
+ Name="Release|Win32"
+ >
+ <Tool
+ Name="VCCLCompilerTool"
+ AdditionalIncludeDirectories=""
+ PreprocessorDefinitions=""
+ />
+ </FileConfiguration>
+ <FileConfiguration
+ Name="Debug|Win32"
+ >
+ <Tool
+ Name="VCCLCompilerTool"
+ AdditionalIncludeDirectories=""
+ PreprocessorDefinitions=""
+ />
+ </FileConfiguration>
+ </File>
+ <File
+ RelativePath="..\..\..\runtime\core\src\commonj\sdo\SDOXMLFileWriter.cpp"
+ >
+ <FileConfiguration
+ Name="Release|Win32"
+ >
+ <Tool
+ Name="VCCLCompilerTool"
+ AdditionalIncludeDirectories=""
+ PreprocessorDefinitions=""
+ />
+ </FileConfiguration>
+ <FileConfiguration
+ Name="Debug|Win32"
+ >
+ <Tool
+ Name="VCCLCompilerTool"
+ AdditionalIncludeDirectories=""
+ PreprocessorDefinitions=""
+ />
+ </FileConfiguration>
+ </File>
+ <File
+ RelativePath="..\..\..\runtime\core\src\commonj\sdo\SDOXMLStreamWriter.cpp"
+ >
+ <FileConfiguration
+ Name="Release|Win32"
+ >
+ <Tool
+ Name="VCCLCompilerTool"
+ AdditionalIncludeDirectories=""
+ PreprocessorDefinitions=""
+ />
+ </FileConfiguration>
+ <FileConfiguration
+ Name="Debug|Win32"
+ >
+ <Tool
+ Name="VCCLCompilerTool"
+ AdditionalIncludeDirectories=""
+ PreprocessorDefinitions=""
+ />
+ </FileConfiguration>
+ </File>
+ <File
+ RelativePath="..\..\..\runtime\core\src\commonj\sdo\SDOXMLString.cpp"
+ >
+ <FileConfiguration
+ Name="Release|Win32"
+ >
+ <Tool
+ Name="VCCLCompilerTool"
+ AdditionalIncludeDirectories=""
+ PreprocessorDefinitions=""
+ />
+ </FileConfiguration>
+ <FileConfiguration
+ Name="Debug|Win32"
+ >
+ <Tool
+ Name="VCCLCompilerTool"
+ AdditionalIncludeDirectories=""
+ PreprocessorDefinitions=""
+ />
+ </FileConfiguration>
+ </File>
+ <File
+ RelativePath="..\..\..\runtime\core\src\commonj\sdo\SDOXMLWriter.cpp"
+ >
+ <FileConfiguration
+ Name="Release|Win32"
+ >
+ <Tool
+ Name="VCCLCompilerTool"
+ AdditionalIncludeDirectories=""
+ PreprocessorDefinitions=""
+ />
+ </FileConfiguration>
+ <FileConfiguration
+ Name="Debug|Win32"
+ >
+ <Tool
+ Name="VCCLCompilerTool"
+ AdditionalIncludeDirectories=""
+ PreprocessorDefinitions=""
+ />
+ </FileConfiguration>
+ </File>
+ <File
+ RelativePath="..\..\..\runtime\core\src\commonj\sdo\SDOXSDBufferWriter.cpp"
+ >
+ <FileConfiguration
+ Name="Release|Win32"
+ >
+ <Tool
+ Name="VCCLCompilerTool"
+ AdditionalIncludeDirectories=""
+ PreprocessorDefinitions=""
+ />
+ </FileConfiguration>
+ <FileConfiguration
+ Name="Debug|Win32"
+ >
+ <Tool
+ Name="VCCLCompilerTool"
+ AdditionalIncludeDirectories=""
+ PreprocessorDefinitions=""
+ />
+ </FileConfiguration>
+ </File>
+ <File
+ RelativePath="..\..\..\runtime\core\src\commonj\sdo\SDOXSDFileWriter.cpp"
+ >
+ <FileConfiguration
+ Name="Release|Win32"
+ >
+ <Tool
+ Name="VCCLCompilerTool"
+ AdditionalIncludeDirectories=""
+ PreprocessorDefinitions=""
+ />
+ </FileConfiguration>
+ <FileConfiguration
+ Name="Debug|Win32"
+ >
+ <Tool
+ Name="VCCLCompilerTool"
+ AdditionalIncludeDirectories=""
+ PreprocessorDefinitions=""
+ />
+ </FileConfiguration>
+ </File>
+ <File
+ RelativePath="..\..\..\runtime\core\src\commonj\sdo\SDOXSDStreamWriter.cpp"
+ >
+ <FileConfiguration
+ Name="Release|Win32"
+ >
+ <Tool
+ Name="VCCLCompilerTool"
+ AdditionalIncludeDirectories=""
+ PreprocessorDefinitions=""
+ />
+ </FileConfiguration>
+ <FileConfiguration
+ Name="Debug|Win32"
+ >
+ <Tool
+ Name="VCCLCompilerTool"
+ AdditionalIncludeDirectories=""
+ PreprocessorDefinitions=""
+ />
+ </FileConfiguration>
+ </File>
+ <File
+ RelativePath="..\..\..\runtime\core\src\commonj\sdo\SDOXSDWriter.cpp"
+ >
+ <FileConfiguration
+ Name="Release|Win32"
+ >
+ <Tool
+ Name="VCCLCompilerTool"
+ AdditionalIncludeDirectories=""
+ PreprocessorDefinitions=""
+ />
+ </FileConfiguration>
+ <FileConfiguration
+ Name="Debug|Win32"
+ >
+ <Tool
+ Name="VCCLCompilerTool"
+ AdditionalIncludeDirectories=""
+ PreprocessorDefinitions=""
+ />
+ </FileConfiguration>
+ </File>
+ <File
+ RelativePath="..\..\..\runtime\core\src\commonj\sdo\Sequence.cpp"
+ >
+ <FileConfiguration
+ Name="Release|Win32"
+ >
+ <Tool
+ Name="VCCLCompilerTool"
+ AdditionalIncludeDirectories=""
+ PreprocessorDefinitions=""
+ />
+ </FileConfiguration>
+ <FileConfiguration
+ Name="Debug|Win32"
+ >
+ <Tool
+ Name="VCCLCompilerTool"
+ AdditionalIncludeDirectories=""
+ PreprocessorDefinitions=""
+ />
+ </FileConfiguration>
+ </File>
+ <File
+ RelativePath="..\..\..\runtime\core\src\commonj\sdo\SequenceImpl.cpp"
+ >
+ <FileConfiguration
+ Name="Release|Win32"
+ >
+ <Tool
+ Name="VCCLCompilerTool"
+ AdditionalIncludeDirectories=""
+ PreprocessorDefinitions=""
+ />
+ </FileConfiguration>
+ <FileConfiguration
+ Name="Debug|Win32"
+ >
+ <Tool
+ Name="VCCLCompilerTool"
+ AdditionalIncludeDirectories=""
+ PreprocessorDefinitions=""
+ />
+ </FileConfiguration>
+ </File>
+ <File
+ RelativePath="..\..\..\runtime\core\src\commonj\sdo\Setting.cpp"
+ >
+ <FileConfiguration
+ Name="Release|Win32"
+ >
+ <Tool
+ Name="VCCLCompilerTool"
+ AdditionalIncludeDirectories=""
+ PreprocessorDefinitions=""
+ />
+ </FileConfiguration>
+ <FileConfiguration
+ Name="Debug|Win32"
+ >
+ <Tool
+ Name="VCCLCompilerTool"
+ AdditionalIncludeDirectories=""
+ PreprocessorDefinitions=""
+ />
+ </FileConfiguration>
+ </File>
+ <File
+ RelativePath="..\..\..\runtime\core\src\commonj\sdo\SettingList.cpp"
+ >
+ <FileConfiguration
+ Name="Release|Win32"
+ >
+ <Tool
+ Name="VCCLCompilerTool"
+ AdditionalIncludeDirectories=""
+ PreprocessorDefinitions=""
+ />
+ </FileConfiguration>
+ <FileConfiguration
+ Name="Debug|Win32"
+ >
+ <Tool
+ Name="VCCLCompilerTool"
+ AdditionalIncludeDirectories=""
+ PreprocessorDefinitions=""
+ />
+ </FileConfiguration>
+ </File>
+ <File
+ RelativePath="..\..\..\runtime\core\src\commonj\sdo\Type.cpp"
+ >
+ <FileConfiguration
+ Name="Release|Win32"
+ >
+ <Tool
+ Name="VCCLCompilerTool"
+ AdditionalIncludeDirectories=""
+ PreprocessorDefinitions=""
+ />
+ </FileConfiguration>
+ <FileConfiguration
+ Name="Debug|Win32"
+ >
+ <Tool
+ Name="VCCLCompilerTool"
+ AdditionalIncludeDirectories=""
+ PreprocessorDefinitions=""
+ />
+ </FileConfiguration>
+ </File>
+ <File
+ RelativePath="..\..\..\runtime\core\src\commonj\sdo\TypeDefinition.cpp"
+ >
+ <FileConfiguration
+ Name="Release|Win32"
+ >
+ <Tool
+ Name="VCCLCompilerTool"
+ AdditionalIncludeDirectories=""
+ PreprocessorDefinitions=""
+ />
+ </FileConfiguration>
+ <FileConfiguration
+ Name="Debug|Win32"
+ >
+ <Tool
+ Name="VCCLCompilerTool"
+ AdditionalIncludeDirectories=""
+ PreprocessorDefinitions=""
+ />
+ </FileConfiguration>
+ </File>
+ <File
+ RelativePath="..\..\..\runtime\core\src\commonj\sdo\TypeDefinitionImpl.cpp"
+ >
+ <FileConfiguration
+ Name="Release|Win32"
+ >
+ <Tool
+ Name="VCCLCompilerTool"
+ AdditionalIncludeDirectories=""
+ PreprocessorDefinitions=""
+ />
+ </FileConfiguration>
+ <FileConfiguration
+ Name="Debug|Win32"
+ >
+ <Tool
+ Name="VCCLCompilerTool"
+ AdditionalIncludeDirectories=""
+ PreprocessorDefinitions=""
+ />
+ </FileConfiguration>
+ </File>
+ <File
+ RelativePath="..\..\..\runtime\core\src\commonj\sdo\TypeDefinitions.cpp"
+ >
+ <FileConfiguration
+ Name="Release|Win32"
+ >
+ <Tool
+ Name="VCCLCompilerTool"
+ AdditionalIncludeDirectories=""
+ PreprocessorDefinitions=""
+ />
+ </FileConfiguration>
+ <FileConfiguration
+ Name="Debug|Win32"
+ >
+ <Tool
+ Name="VCCLCompilerTool"
+ AdditionalIncludeDirectories=""
+ PreprocessorDefinitions=""
+ />
+ </FileConfiguration>
+ </File>
+ <File
+ RelativePath="..\..\..\runtime\core\src\commonj\sdo\TypeDefinitionsImpl.cpp"
+ >
+ <FileConfiguration
+ Name="Release|Win32"
+ >
+ <Tool
+ Name="VCCLCompilerTool"
+ AdditionalIncludeDirectories=""
+ PreprocessorDefinitions=""
+ />
+ </FileConfiguration>
+ <FileConfiguration
+ Name="Debug|Win32"
+ >
+ <Tool
+ Name="VCCLCompilerTool"
+ AdditionalIncludeDirectories=""
+ PreprocessorDefinitions=""
+ />
+ </FileConfiguration>
+ </File>
+ <File
+ RelativePath="..\..\..\runtime\core\src\commonj\sdo\TypeImpl.cpp"
+ >
+ <FileConfiguration
+ Name="Release|Win32"
+ >
+ <Tool
+ Name="VCCLCompilerTool"
+ AdditionalIncludeDirectories=""
+ PreprocessorDefinitions=""
+ />
+ </FileConfiguration>
+ <FileConfiguration
+ Name="Debug|Win32"
+ >
+ <Tool
+ Name="VCCLCompilerTool"
+ AdditionalIncludeDirectories=""
+ PreprocessorDefinitions=""
+ />
+ </FileConfiguration>
+ </File>
+ <File
+ RelativePath="..\..\..\runtime\core\src\commonj\sdo\TypeList.cpp"
+ >
+ <FileConfiguration
+ Name="Release|Win32"
+ >
+ <Tool
+ Name="VCCLCompilerTool"
+ AdditionalIncludeDirectories=""
+ PreprocessorDefinitions=""
+ />
+ </FileConfiguration>
+ <FileConfiguration
+ Name="Debug|Win32"
+ >
+ <Tool
+ Name="VCCLCompilerTool"
+ AdditionalIncludeDirectories=""
+ PreprocessorDefinitions=""
+ />
+ </FileConfiguration>
+ </File>
+ <File
+ RelativePath="..\..\..\runtime\core\src\commonj\sdo\XMLDocument.cpp"
+ >
+ <FileConfiguration
+ Name="Release|Win32"
+ >
+ <Tool
+ Name="VCCLCompilerTool"
+ AdditionalIncludeDirectories=""
+ PreprocessorDefinitions=""
+ />
+ </FileConfiguration>
+ <FileConfiguration
+ Name="Debug|Win32"
+ >
+ <Tool
+ Name="VCCLCompilerTool"
+ AdditionalIncludeDirectories=""
+ PreprocessorDefinitions=""
+ />
+ </FileConfiguration>
+ </File>
+ <File
+ RelativePath="..\..\..\runtime\core\src\commonj\sdo\XMLDocumentImpl.cpp"
+ >
+ <FileConfiguration
+ Name="Release|Win32"
+ >
+ <Tool
+ Name="VCCLCompilerTool"
+ AdditionalIncludeDirectories=""
+ PreprocessorDefinitions=""
+ />
+ </FileConfiguration>
+ <FileConfiguration
+ Name="Debug|Win32"
+ >
+ <Tool
+ Name="VCCLCompilerTool"
+ AdditionalIncludeDirectories=""
+ PreprocessorDefinitions=""
+ />
+ </FileConfiguration>
+ </File>
+ <File
+ RelativePath="..\..\..\runtime\core\src\commonj\sdo\XMLHelper.cpp"
+ >
+ <FileConfiguration
+ Name="Release|Win32"
+ >
+ <Tool
+ Name="VCCLCompilerTool"
+ AdditionalIncludeDirectories=""
+ PreprocessorDefinitions=""
+ />
+ </FileConfiguration>
+ <FileConfiguration
+ Name="Debug|Win32"
+ >
+ <Tool
+ Name="VCCLCompilerTool"
+ AdditionalIncludeDirectories=""
+ PreprocessorDefinitions=""
+ />
+ </FileConfiguration>
+ </File>
+ <File
+ RelativePath="..\..\..\runtime\core\src\commonj\sdo\XMLHelperImpl.cpp"
+ >
+ <FileConfiguration
+ Name="Release|Win32"
+ >
+ <Tool
+ Name="VCCLCompilerTool"
+ AdditionalIncludeDirectories=""
+ PreprocessorDefinitions=""
+ />
+ </FileConfiguration>
+ <FileConfiguration
+ Name="Debug|Win32"
+ >
+ <Tool
+ Name="VCCLCompilerTool"
+ AdditionalIncludeDirectories=""
+ PreprocessorDefinitions=""
+ />
+ </FileConfiguration>
+ </File>
+ <File
+ RelativePath="..\..\..\runtime\core\src\commonj\sdo\XMLQName.cpp"
+ >
+ <FileConfiguration
+ Name="Release|Win32"
+ >
+ <Tool
+ Name="VCCLCompilerTool"
+ AdditionalIncludeDirectories=""
+ PreprocessorDefinitions=""
+ />
+ </FileConfiguration>
+ <FileConfiguration
+ Name="Debug|Win32"
+ >
+ <Tool
+ Name="VCCLCompilerTool"
+ AdditionalIncludeDirectories=""
+ PreprocessorDefinitions=""
+ />
+ </FileConfiguration>
+ </File>
+ <File
+ RelativePath="..\..\..\runtime\core\src\commonj\sdo\XpathHelper.cpp"
+ >
+ <FileConfiguration
+ Name="Release|Win32"
+ >
+ <Tool
+ Name="VCCLCompilerTool"
+ AdditionalIncludeDirectories=""
+ PreprocessorDefinitions=""
+ />
+ </FileConfiguration>
+ <FileConfiguration
+ Name="Debug|Win32"
+ >
+ <Tool
+ Name="VCCLCompilerTool"
+ AdditionalIncludeDirectories=""
+ PreprocessorDefinitions=""
+ />
+ </FileConfiguration>
+ </File>
+ <File
+ RelativePath="..\..\..\runtime\core\src\commonj\sdo\XSDHelper.cpp"
+ >
+ <FileConfiguration
+ Name="Release|Win32"
+ >
+ <Tool
+ Name="VCCLCompilerTool"
+ AdditionalIncludeDirectories=""
+ PreprocessorDefinitions=""
+ />
+ </FileConfiguration>
+ <FileConfiguration
+ Name="Debug|Win32"
+ >
+ <Tool
+ Name="VCCLCompilerTool"
+ AdditionalIncludeDirectories=""
+ PreprocessorDefinitions=""
+ />
+ </FileConfiguration>
+ </File>
+ <File
+ RelativePath="..\..\..\runtime\core\src\commonj\sdo\XSDHelperImpl.cpp"
+ >
+ <FileConfiguration
+ Name="Release|Win32"
+ >
+ <Tool
+ Name="VCCLCompilerTool"
+ AdditionalIncludeDirectories=""
+ PreprocessorDefinitions=""
+ />
+ </FileConfiguration>
+ <FileConfiguration
+ Name="Debug|Win32"
+ >
+ <Tool
+ Name="VCCLCompilerTool"
+ AdditionalIncludeDirectories=""
+ PreprocessorDefinitions=""
+ />
+ </FileConfiguration>
+ </File>
+ <File
+ RelativePath="..\..\..\runtime\core\src\commonj\sdo\XSDPropertyInfo.cpp"
+ >
+ <FileConfiguration
+ Name="Release|Win32"
+ >
+ <Tool
+ Name="VCCLCompilerTool"
+ AdditionalIncludeDirectories=""
+ PreprocessorDefinitions=""
+ />
+ </FileConfiguration>
+ <FileConfiguration
+ Name="Debug|Win32"
+ >
+ <Tool
+ Name="VCCLCompilerTool"
+ AdditionalIncludeDirectories=""
+ PreprocessorDefinitions=""
+ />
+ </FileConfiguration>
+ </File>
+ <File
+ RelativePath="..\..\..\runtime\core\src\commonj\sdo\XSDTypeInfo.cpp"
+ >
+ <FileConfiguration
+ Name="Release|Win32"
+ >
+ <Tool
+ Name="VCCLCompilerTool"
+ AdditionalIncludeDirectories=""
+ PreprocessorDefinitions=""
+ />
+ </FileConfiguration>
+ <FileConfiguration
+ Name="Debug|Win32"
+ >
+ <Tool
+ Name="VCCLCompilerTool"
+ AdditionalIncludeDirectories=""
+ PreprocessorDefinitions=""
+ />
+ </FileConfiguration>
+ </File>
+ </Filter>
+ <Filter
+ Name="Header Files"
+ Filter="h;hpp;hxx;hm;inl"
+ >
+ <File
+ RelativePath="..\..\..\runtime\core\src\commonj\sdo\ChangedDataObjectList.h"
+ >
+ </File>
+ <File
+ RelativePath="..\..\..\runtime\core\src\commonj\sdo\ChangedDataObjectListImpl.h"
+ >
+ </File>
+ <File
+ RelativePath="..\..\..\runtime\core\src\commonj\sdo\ChangeSummary.h"
+ >
+ </File>
+ <File
+ RelativePath="..\..\..\runtime\core\src\commonj\sdo\ChangeSummaryBuilder.h"
+ >
+ </File>
+ <File
+ RelativePath="..\..\..\runtime\core\src\commonj\sdo\ChangeSummaryImpl.h"
+ >
+ </File>
+ <File
+ RelativePath="..\..\..\runtime\core\src\commonj\sdo\CopyHelper.h"
+ >
+ </File>
+ <File
+ RelativePath="..\..\..\runtime\core\src\commonj\sdo\DASProperty.h"
+ >
+ </File>
+ <File
+ RelativePath="..\..\..\runtime\core\src\commonj\sdo\DASType.h"
+ >
+ </File>
+ <File
+ RelativePath="..\..\..\runtime\core\src\commonj\sdo\DASValue.h"
+ >
+ </File>
+ <File
+ RelativePath="..\..\..\runtime\core\src\commonj\sdo\DASValues.h"
+ >
+ </File>
+ <File
+ RelativePath="..\..\..\runtime\core\src\commonj\sdo\DataFactory.h"
+ >
+ </File>
+ <File
+ RelativePath="..\..\..\runtime\core\src\commonj\sdo\DataFactoryImpl.h"
+ >
+ </File>
+ <File
+ RelativePath="..\..\..\runtime\core\src\commonj\sdo\DataGraph.h"
+ >
+ </File>
+ <File
+ RelativePath="..\..\..\runtime\core\src\commonj\sdo\DataGraphImpl.h"
+ >
+ </File>
+ <File
+ RelativePath="..\..\..\runtime\core\src\commonj\sdo\DataObject.h"
+ >
+ </File>
+ <File
+ RelativePath="..\..\..\runtime\core\src\commonj\sdo\DataObjectImpl.h"
+ >
+ </File>
+ <File
+ RelativePath="..\..\..\runtime\core\src\commonj\sdo\DataObjectList.h"
+ >
+ </File>
+ <File
+ RelativePath="..\..\..\runtime\core\src\commonj\sdo\DataObjectListImpl.h"
+ >
+ </File>
+ <File
+ RelativePath="..\..\..\runtime\core\src\commonj\sdo\DataTypeInfo.h"
+ >
+ </File>
+ <File
+ RelativePath="..\..\..\runtime\core\src\commonj\sdo\DefaultLogWriter.h"
+ >
+ </File>
+ <File
+ RelativePath="..\..\..\runtime\core\src\commonj\sdo\disable_warn.h"
+ >
+ </File>
+ <File
+ RelativePath="..\..\..\runtime\core\src\commonj\sdo\EqualityHelper.h"
+ >
+ </File>
+ <File
+ RelativePath="..\..\..\runtime\core\src\commonj\sdo\export.h"
+ >
+ </File>
+ <File
+ RelativePath="..\..\..\runtime\core\src\commonj\sdo\GroupDefinition.h"
+ >
+ </File>
+ <File
+ RelativePath="..\..\..\runtime\core\src\commonj\sdo\GroupEvent.h"
+ >
+ </File>
+ <File
+ RelativePath="..\..\..\runtime\core\src\commonj\sdo\HelperProvider.h"
+ >
+ </File>
+ <File
+ RelativePath="..\..\..\runtime\core\src\commonj\sdo\Logger.h"
+ >
+ </File>
+ <File
+ RelativePath="..\..\..\runtime\core\src\commonj\sdo\Logging.h"
+ >
+ </File>
+ <File
+ RelativePath="..\..\..\runtime\core\src\commonj\sdo\LogWriter.h"
+ >
+ </File>
+ <File
+ RelativePath="..\..\..\runtime\core\src\commonj\sdo\ParserErrorSetter.h"
+ >
+ </File>
+ <File
+ RelativePath="..\..\..\runtime\core\src\commonj\sdo\Property.h"
+ >
+ </File>
+ <File
+ RelativePath="..\..\..\runtime\core\src\commonj\sdo\PropertyDefinition.h"
+ >
+ </File>
+ <File
+ RelativePath="..\..\..\runtime\core\src\commonj\sdo\PropertyDefinitionImpl.h"
+ >
+ </File>
+ <File
+ RelativePath="..\..\..\runtime\core\src\commonj\sdo\PropertyImpl.h"
+ >
+ </File>
+ <File
+ RelativePath="..\..\..\runtime\core\src\commonj\sdo\PropertyList.h"
+ >
+ </File>
+ <File
+ RelativePath="..\..\..\runtime\core\src\commonj\sdo\PropertySetting.h"
+ >
+ </File>
+ <File
+ RelativePath="..\..\..\runtime\core\src\commonj\sdo\RefCountingObject.h"
+ >
+ </File>
+ <File
+ RelativePath="..\..\..\runtime\core\src\commonj\sdo\RefCountingPointer.h"
+ >
+ </File>
+ <File
+ RelativePath="..\..\..\runtime\core\src\commonj\sdo\SAX2Attribute.h"
+ >
+ </File>
+ <File
+ RelativePath="..\..\..\runtime\core\src\commonj\sdo\SAX2Attributes.h"
+ >
+ </File>
+ <File
+ RelativePath="..\..\..\runtime\core\src\commonj\sdo\SAX2Namespaces.h"
+ >
+ </File>
+ <File
+ RelativePath="..\..\..\runtime\core\src\commonj\sdo\SAX2Parser.h"
+ >
+ </File>
+ <File
+ RelativePath="..\..\..\runtime\core\src\commonj\sdo\SchemaInfo.h"
+ >
+ </File>
+ <File
+ RelativePath="..\..\..\runtime\core\src\commonj\sdo\SDO.h"
+ >
+ </File>
+ <File
+ RelativePath="..\..\..\runtime\core\src\commonj\sdo\SdoCheck.h"
+ >
+ </File>
+ <File
+ RelativePath="..\..\..\runtime\core\src\commonj\sdo\SDODataConverter.h"
+ >
+ </File>
+ <File
+ RelativePath="..\..\..\runtime\core\src\commonj\sdo\SDODate.h"
+ >
+ </File>
+ <File
+ RelativePath="..\..\..\runtime\core\src\commonj\sdo\SdoRuntime.h"
+ >
+ </File>
+ <File
+ RelativePath="..\..\..\runtime\core\src\commonj\sdo\SDORuntimeException.h"
+ >
+ </File>
+ <File
+ RelativePath="..\..\..\runtime\core\src\commonj\sdo\SDOSAX2Parser.h"
+ >
+ </File>
+ <File
+ RelativePath="..\..\..\runtime\core\src\commonj\sdo\SDOSchemaSAX2Parser.h"
+ >
+ </File>
+ <File
+ RelativePath="..\..\..\runtime\core\src\commonj\sdo\SDOSPI.h"
+ >
+ </File>
+ <File
+ RelativePath="..\..\..\runtime\core\src\commonj\sdo\SDOString.h"
+ >
+ </File>
+ <File
+ RelativePath="..\..\..\runtime\core\src\commonj\sdo\SDOUserMacros.h"
+ >
+ </File>
+ <File
+ RelativePath="..\..\..\runtime\core\src\commonj\sdo\SDOUtils.h"
+ >
+ </File>
+ <File
+ RelativePath="..\..\..\runtime\core\src\commonj\sdo\SDOValue.h"
+ >
+ </File>
+ <File
+ RelativePath="..\..\..\runtime\core\src\commonj\sdo\SDOXMLBufferWriter.h"
+ >
+ </File>
+ <File
+ RelativePath="..\..\..\runtime\core\src\commonj\sdo\SDOXMLFileWriter.h"
+ >
+ </File>
+ <File
+ RelativePath="..\..\..\runtime\core\src\commonj\sdo\SDOXMLStreamWriter.h"
+ >
+ </File>
+ <File
+ RelativePath="..\..\..\runtime\core\src\commonj\sdo\SDOXMLString.h"
+ >
+ </File>
+ <File
+ RelativePath="..\..\..\runtime\core\src\commonj\sdo\SDOXMLWriter.h"
+ >
+ </File>
+ <File
+ RelativePath="..\..\..\runtime\core\src\commonj\sdo\SDOXSDBufferWriter.h"
+ >
+ </File>
+ <File
+ RelativePath="..\..\..\runtime\core\src\commonj\sdo\SDOXSDFileWriter.h"
+ >
+ </File>
+ <File
+ RelativePath="..\..\..\runtime\core\src\commonj\sdo\SDOXSDStreamWriter.h"
+ >
+ </File>
+ <File
+ RelativePath="..\..\..\runtime\core\src\commonj\sdo\SDOXSDWriter.h"
+ >
+ </File>
+ <File
+ RelativePath="..\..\..\runtime\core\src\commonj\sdo\Sequence.h"
+ >
+ </File>
+ <File
+ RelativePath="..\..\..\runtime\core\src\commonj\sdo\SequenceImpl.h"
+ >
+ </File>
+ <File
+ RelativePath="..\..\..\runtime\core\src\commonj\sdo\Setting.h"
+ >
+ </File>
+ <File
+ RelativePath="..\..\..\runtime\core\src\commonj\sdo\SettingList.h"
+ >
+ </File>
+ <File
+ RelativePath="..\..\..\runtime\core\src\commonj\sdo\Type.h"
+ >
+ </File>
+ <File
+ RelativePath="..\..\..\runtime\core\src\commonj\sdo\TypeDefinition.h"
+ >
+ </File>
+ <File
+ RelativePath="..\..\..\runtime\core\src\commonj\sdo\TypeDefinitionImpl.h"
+ >
+ </File>
+ <File
+ RelativePath="..\..\..\runtime\core\src\commonj\sdo\TypeDefinitions.h"
+ >
+ </File>
+ <File
+ RelativePath="..\..\..\runtime\core\src\commonj\sdo\TypeDefinitionsImpl.h"
+ >
+ </File>
+ <File
+ RelativePath="..\..\..\runtime\core\src\commonj\sdo\TypeImpl.h"
+ >
+ </File>
+ <File
+ RelativePath="..\..\..\runtime\core\src\commonj\sdo\TypeList.h"
+ >
+ </File>
+ <File
+ RelativePath="..\..\..\runtime\core\src\commonj\sdo\XMLDocument.h"
+ >
+ </File>
+ <File
+ RelativePath="..\..\..\runtime\core\src\commonj\sdo\XMLDocumentImpl.h"
+ >
+ </File>
+ <File
+ RelativePath="..\..\..\runtime\core\src\commonj\sdo\XMLHelper.h"
+ >
+ </File>
+ <File
+ RelativePath="..\..\..\runtime\core\src\commonj\sdo\XMLHelperImpl.h"
+ >
+ </File>
+ <File
+ RelativePath="..\..\..\runtime\core\src\commonj\sdo\XMLQName.h"
+ >
+ </File>
+ <File
+ RelativePath="..\..\..\runtime\core\src\commonj\sdo\XpathHelper.h"
+ >
+ </File>
+ <File
+ RelativePath="..\..\..\runtime\core\src\commonj\sdo\XSDHelper.h"
+ >
+ </File>
+ <File
+ RelativePath="..\..\..\runtime\core\src\commonj\sdo\XSDHelperImpl.h"
+ >
+ </File>
+ <File
+ RelativePath="..\..\..\runtime\core\src\commonj\sdo\XSDPropertyInfo.h"
+ >
+ </File>
+ <File
+ RelativePath="..\..\..\runtime\core\src\commonj\sdo\XSDTypeInfo.h"
+ >
+ </File>
+ </Filter>
+ <Filter
+ Name="Resource Files"
+ Filter="ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe"
+ >
+ </Filter>
+ </Files>
+ <Globals>
+ </Globals>
+</VisualStudioProject>
diff --git a/sdo-cpp/trunk/VSExpress/tuscany_sdo/sdo_test/sdo_test.vcproj b/sdo-cpp/trunk/VSExpress/tuscany_sdo/sdo_test/sdo_test.vcproj
new file mode 100644
index 0000000000..eac28c5fb0
--- /dev/null
+++ b/sdo-cpp/trunk/VSExpress/tuscany_sdo/sdo_test/sdo_test.vcproj
@@ -0,0 +1,336 @@
+<?xml version="1.0" encoding="Windows-1252"?>
+<VisualStudioProject
+ ProjectType="Visual C++"
+ Version="8.00"
+ Name="sdo_test"
+ ProjectGUID="{42A8E4D8-B25A-4737-A747-9804170FDAFF}"
+ >
+ <Platforms>
+ <Platform
+ Name="Win32"
+ />
+ </Platforms>
+ <ToolFiles>
+ </ToolFiles>
+ <Configurations>
+ <Configuration
+ Name="Debug|Win32"
+ OutputDirectory=".\Debug"
+ IntermediateDirectory=".\Debug"
+ ConfigurationType="1"
+ InheritedPropertySheets="$(VCInstallDir)VCProjectDefaults\UpgradeFromVC60.vsprops"
+ UseOfMFC="0"
+ ATLMinimizesCRunTimeLibraryUsage="false"
+ CharacterSet="2"
+ >
+ <Tool
+ Name="VCPreBuildEventTool"
+ />
+ <Tool
+ Name="VCCustomBuildTool"
+ />
+ <Tool
+ Name="VCXMLDataGeneratorTool"
+ />
+ <Tool
+ Name="VCWebServiceProxyGeneratorTool"
+ />
+ <Tool
+ Name="VCMIDLTool"
+ TypeLibraryName=".\Debug/sdo_test.tlb"
+ HeaderFileName=""
+ />
+ <Tool
+ Name="VCCLCompilerTool"
+ AdditionalOptions="/Zm200 "
+ Optimization="0"
+ AdditionalIncludeDirectories="..\..\..\deploy\include"
+ PreprocessorDefinitions="WIN32;_DEBUG;_CONSOLE;_CRT_SECURE_NO_DEPRECATE"
+ MinimalRebuild="true"
+ BasicRuntimeChecks="3"
+ RuntimeLibrary="3"
+ PrecompiledHeaderFile=".\Debug/sdo_test.pch"
+ AssemblerListingLocation=".\Debug/"
+ ObjectFile=".\Debug/"
+ ProgramDataBaseFileName=".\Debug/"
+ BrowseInformation="1"
+ WarningLevel="3"
+ SuppressStartupBanner="true"
+ DebugInformationFormat="4"
+ />
+ <Tool
+ Name="VCManagedResourceCompilerTool"
+ />
+ <Tool
+ Name="VCResourceCompilerTool"
+ PreprocessorDefinitions="_DEBUG"
+ Culture="2057"
+ />
+ <Tool
+ Name="VCPreLinkEventTool"
+ />
+ <Tool
+ Name="VCLinkerTool"
+ AdditionalDependencies="tuscany_sdo.lib $(NOINHERIT)"
+ OutputFile=".\Debug/sdo_test.exe"
+ LinkIncremental="2"
+ SuppressStartupBanner="true"
+ AdditionalLibraryDirectories="..\..\..\deploy\lib"
+ GenerateDebugInformation="true"
+ ProgramDatabaseFile=".\Debug/sdo_test.pdb"
+ SubSystem="1"
+ TargetMachine="1"
+ />
+ <Tool
+ Name="VCALinkTool"
+ />
+ <Tool
+ Name="VCManifestTool"
+ />
+ <Tool
+ Name="VCXDCMakeTool"
+ />
+ <Tool
+ Name="VCBscMakeTool"
+ SuppressStartupBanner="true"
+ OutputFile=".\Debug/sdo_test.bsc"
+ />
+ <Tool
+ Name="VCFxCopTool"
+ />
+ <Tool
+ Name="VCAppVerifierTool"
+ />
+ <Tool
+ Name="VCWebDeploymentTool"
+ />
+ <Tool
+ Name="VCPostBuildEventTool"
+ />
+ </Configuration>
+ <Configuration
+ Name="Release|Win32"
+ OutputDirectory=".\Release"
+ IntermediateDirectory=".\Release"
+ ConfigurationType="1"
+ InheritedPropertySheets="$(VCInstallDir)VCProjectDefaults\UpgradeFromVC60.vsprops"
+ UseOfMFC="0"
+ ATLMinimizesCRunTimeLibraryUsage="false"
+ CharacterSet="2"
+ >
+ <Tool
+ Name="VCPreBuildEventTool"
+ />
+ <Tool
+ Name="VCCustomBuildTool"
+ />
+ <Tool
+ Name="VCXMLDataGeneratorTool"
+ />
+ <Tool
+ Name="VCWebServiceProxyGeneratorTool"
+ />
+ <Tool
+ Name="VCMIDLTool"
+ TypeLibraryName=".\Release/sdo_test.tlb"
+ HeaderFileName=""
+ />
+ <Tool
+ Name="VCCLCompilerTool"
+ Optimization="4"
+ AdditionalIncludeDirectories="..\..\..\deploy\include"
+ PreprocessorDefinitions="WIN32;NDEBUG;_CONSOLE;_CRT_SECURE_NO_DEPRECATE"
+ RuntimeLibrary="2"
+ PrecompiledHeaderFile=".\Release/sdo_test.pch"
+ AssemblerListingLocation=".\Release/"
+ ObjectFile=".\Release/"
+ ProgramDataBaseFileName=".\Release/"
+ WarningLevel="3"
+ SuppressStartupBanner="true"
+ />
+ <Tool
+ Name="VCManagedResourceCompilerTool"
+ />
+ <Tool
+ Name="VCResourceCompilerTool"
+ PreprocessorDefinitions="NDEBUG"
+ Culture="2057"
+ />
+ <Tool
+ Name="VCPreLinkEventTool"
+ />
+ <Tool
+ Name="VCLinkerTool"
+ AdditionalDependencies="tuscany_sdo.lib $(NOINHERIT)"
+ OutputFile=".\Release/sdo_test.exe"
+ LinkIncremental="1"
+ SuppressStartupBanner="true"
+ AdditionalLibraryDirectories="..\..\..\deploy\lib"
+ ProgramDatabaseFile=".\Release/sdo_test.pdb"
+ SubSystem="1"
+ TargetMachine="1"
+ />
+ <Tool
+ Name="VCALinkTool"
+ />
+ <Tool
+ Name="VCManifestTool"
+ />
+ <Tool
+ Name="VCXDCMakeTool"
+ />
+ <Tool
+ Name="VCBscMakeTool"
+ SuppressStartupBanner="true"
+ OutputFile=".\Release/sdo_test.bsc"
+ />
+ <Tool
+ Name="VCFxCopTool"
+ />
+ <Tool
+ Name="VCAppVerifierTool"
+ />
+ <Tool
+ Name="VCWebDeploymentTool"
+ />
+ <Tool
+ Name="VCPostBuildEventTool"
+ />
+ </Configuration>
+ </Configurations>
+ <References>
+ </References>
+ <Files>
+ <Filter
+ Name="Source Files"
+ Filter="cpp;c;cxx;rc;def;r;odl;idl;hpj;bat"
+ >
+ <File
+ RelativePath="..\..\..\runtime\core\test\main.cpp"
+ >
+ <FileConfiguration
+ Name="Debug|Win32"
+ >
+ <Tool
+ Name="VCCLCompilerTool"
+ AdditionalIncludeDirectories=""
+ PreprocessorDefinitions=""
+ />
+ </FileConfiguration>
+ <FileConfiguration
+ Name="Release|Win32"
+ >
+ <Tool
+ Name="VCCLCompilerTool"
+ AdditionalIncludeDirectories=""
+ PreprocessorDefinitions=""
+ />
+ </FileConfiguration>
+ </File>
+ <File
+ RelativePath="..\..\..\runtime\core\test\SdoGenerate.cpp"
+ >
+ <FileConfiguration
+ Name="Debug|Win32"
+ >
+ <Tool
+ Name="VCCLCompilerTool"
+ AdditionalIncludeDirectories=""
+ PreprocessorDefinitions=""
+ />
+ </FileConfiguration>
+ <FileConfiguration
+ Name="Release|Win32"
+ >
+ <Tool
+ Name="VCCLCompilerTool"
+ AdditionalIncludeDirectories=""
+ PreprocessorDefinitions=""
+ />
+ </FileConfiguration>
+ </File>
+ <File
+ RelativePath="..\..\..\runtime\core\test\sdotest.cpp"
+ >
+ <FileConfiguration
+ Name="Debug|Win32"
+ >
+ <Tool
+ Name="VCCLCompilerTool"
+ AdditionalIncludeDirectories=""
+ PreprocessorDefinitions=""
+ />
+ </FileConfiguration>
+ <FileConfiguration
+ Name="Release|Win32"
+ >
+ <Tool
+ Name="VCCLCompilerTool"
+ AdditionalIncludeDirectories=""
+ PreprocessorDefinitions=""
+ />
+ </FileConfiguration>
+ </File>
+ <File
+ RelativePath="..\..\..\runtime\core\test\sdotest2.cpp"
+ >
+ <FileConfiguration
+ Name="Debug|Win32"
+ >
+ <Tool
+ Name="VCCLCompilerTool"
+ AdditionalIncludeDirectories=""
+ PreprocessorDefinitions=""
+ />
+ </FileConfiguration>
+ <FileConfiguration
+ Name="Release|Win32"
+ >
+ <Tool
+ Name="VCCLCompilerTool"
+ AdditionalIncludeDirectories=""
+ PreprocessorDefinitions=""
+ />
+ </FileConfiguration>
+ </File>
+ <File
+ RelativePath="..\..\..\runtime\core\test\utils.cpp"
+ >
+ <FileConfiguration
+ Name="Debug|Win32"
+ >
+ <Tool
+ Name="VCCLCompilerTool"
+ AdditionalIncludeDirectories=""
+ PreprocessorDefinitions=""
+ />
+ </FileConfiguration>
+ <FileConfiguration
+ Name="Release|Win32"
+ >
+ <Tool
+ Name="VCCLCompilerTool"
+ AdditionalIncludeDirectories=""
+ PreprocessorDefinitions=""
+ />
+ </FileConfiguration>
+ </File>
+ </Filter>
+ <Filter
+ Name="Header Files"
+ Filter="h;hpp;hxx;hm;inl"
+ >
+ <File
+ RelativePath="..\..\..\runtime\core\test\sdotest.h"
+ >
+ </File>
+ </Filter>
+ <Filter
+ Name="Resource Files"
+ Filter="ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe"
+ >
+ </Filter>
+ </Files>
+ <Globals>
+ </Globals>
+</VisualStudioProject>
diff --git a/sdo-cpp/trunk/VSExpress/tuscany_sdo/tuscany_sdo.sln b/sdo-cpp/trunk/VSExpress/tuscany_sdo/tuscany_sdo.sln
new file mode 100644
index 0000000000..2596c8133e
--- /dev/null
+++ b/sdo-cpp/trunk/VSExpress/tuscany_sdo/tuscany_sdo.sln
@@ -0,0 +1,59 @@
+
+Microsoft Visual Studio Solution File, Format Version 9.00
+# Visual C++ Express 2005
+Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "Build", "Build\Build.vcproj", "{9540B934-24BA-45F0-965B-8231E256DF03}"
+ ProjectSection(ProjectDependencies) = postProject
+ {42A8E4D8-B25A-4737-A747-9804170FDAFF} = {42A8E4D8-B25A-4737-A747-9804170FDAFF}
+ {E95539B9-8E1A-4F4C-8565-ECCF510F26F2} = {E95539B9-8E1A-4F4C-8565-ECCF510F26F2}
+ {964F3F93-8D1C-46BE-9724-2313CE7380AA} = {964F3F93-8D1C-46BE-9724-2313CE7380AA}
+ {606A0280-529A-40A1-9B3C-80111D3AE920} = {606A0280-529A-40A1-9B3C-80111D3AE920}
+ EndProjectSection
+EndProject
+Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "sdo_axiom", "sdo_axiom\sdo_axiom.vcproj", "{E95539B9-8E1A-4F4C-8565-ECCF510F26F2}"
+ ProjectSection(ProjectDependencies) = postProject
+ {964F3F93-8D1C-46BE-9724-2313CE7380AA} = {964F3F93-8D1C-46BE-9724-2313CE7380AA}
+ EndProjectSection
+EndProject
+Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "sdo_axiom_test", "sdo_axiom_test\sdo_axiom_test.vcproj", "{606A0280-529A-40A1-9B3C-80111D3AE920}"
+ ProjectSection(ProjectDependencies) = postProject
+ {E95539B9-8E1A-4F4C-8565-ECCF510F26F2} = {E95539B9-8E1A-4F4C-8565-ECCF510F26F2}
+ EndProjectSection
+EndProject
+Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "sdo_runtime", "sdo_runtime\sdo_runtime.vcproj", "{964F3F93-8D1C-46BE-9724-2313CE7380AA}"
+EndProject
+Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "sdo_test", "sdo_test\sdo_test.vcproj", "{42A8E4D8-B25A-4737-A747-9804170FDAFF}"
+ ProjectSection(ProjectDependencies) = postProject
+ {964F3F93-8D1C-46BE-9724-2313CE7380AA} = {964F3F93-8D1C-46BE-9724-2313CE7380AA}
+ EndProjectSection
+EndProject
+Global
+ GlobalSection(SolutionConfigurationPlatforms) = preSolution
+ Debug|Win32 = Debug|Win32
+ Release|Win32 = Release|Win32
+ EndGlobalSection
+ GlobalSection(ProjectConfigurationPlatforms) = postSolution
+ {9540B934-24BA-45F0-965B-8231E256DF03}.Debug|Win32.ActiveCfg = Debug|Win32
+ {9540B934-24BA-45F0-965B-8231E256DF03}.Debug|Win32.Build.0 = Debug|Win32
+ {9540B934-24BA-45F0-965B-8231E256DF03}.Release|Win32.ActiveCfg = Release|Win32
+ {9540B934-24BA-45F0-965B-8231E256DF03}.Release|Win32.Build.0 = Release|Win32
+ {E95539B9-8E1A-4F4C-8565-ECCF510F26F2}.Debug|Win32.ActiveCfg = Debug|Win32
+ {E95539B9-8E1A-4F4C-8565-ECCF510F26F2}.Debug|Win32.Build.0 = Debug|Win32
+ {E95539B9-8E1A-4F4C-8565-ECCF510F26F2}.Release|Win32.ActiveCfg = Release|Win32
+ {E95539B9-8E1A-4F4C-8565-ECCF510F26F2}.Release|Win32.Build.0 = Release|Win32
+ {606A0280-529A-40A1-9B3C-80111D3AE920}.Debug|Win32.ActiveCfg = Debug|Win32
+ {606A0280-529A-40A1-9B3C-80111D3AE920}.Debug|Win32.Build.0 = Debug|Win32
+ {606A0280-529A-40A1-9B3C-80111D3AE920}.Release|Win32.ActiveCfg = Release|Win32
+ {606A0280-529A-40A1-9B3C-80111D3AE920}.Release|Win32.Build.0 = Release|Win32
+ {964F3F93-8D1C-46BE-9724-2313CE7380AA}.Debug|Win32.ActiveCfg = Debug|Win32
+ {964F3F93-8D1C-46BE-9724-2313CE7380AA}.Debug|Win32.Build.0 = Debug|Win32
+ {964F3F93-8D1C-46BE-9724-2313CE7380AA}.Release|Win32.ActiveCfg = Release|Win32
+ {964F3F93-8D1C-46BE-9724-2313CE7380AA}.Release|Win32.Build.0 = Release|Win32
+ {42A8E4D8-B25A-4737-A747-9804170FDAFF}.Debug|Win32.ActiveCfg = Debug|Win32
+ {42A8E4D8-B25A-4737-A747-9804170FDAFF}.Debug|Win32.Build.0 = Debug|Win32
+ {42A8E4D8-B25A-4737-A747-9804170FDAFF}.Release|Win32.ActiveCfg = Release|Win32
+ {42A8E4D8-B25A-4737-A747-9804170FDAFF}.Release|Win32.Build.0 = Release|Win32
+ EndGlobalSection
+ GlobalSection(SolutionProperties) = preSolution
+ HideSolutionNode = FALSE
+ EndGlobalSection
+EndGlobal
diff --git a/sdo-cpp/trunk/antscripts/OpenPGP.jar b/sdo-cpp/trunk/antscripts/OpenPGP.jar
new file mode 100644
index 0000000000..cdd3f570d1
--- /dev/null
+++ b/sdo-cpp/trunk/antscripts/OpenPGP.jar
Binary files differ
diff --git a/sdo-cpp/trunk/antscripts/TuscanyMSVC8DevStudioCCompiler.jar b/sdo-cpp/trunk/antscripts/TuscanyMSVC8DevStudioCCompiler.jar
new file mode 100644
index 0000000000..9ffc08fd1f
--- /dev/null
+++ b/sdo-cpp/trunk/antscripts/TuscanyMSVC8DevStudioCCompiler.jar
Binary files differ
diff --git a/sdo-cpp/trunk/antscripts/compile-targets.xml b/sdo-cpp/trunk/antscripts/compile-targets.xml
new file mode 100644
index 0000000000..3fb80f495c
--- /dev/null
+++ b/sdo-cpp/trunk/antscripts/compile-targets.xml
@@ -0,0 +1,310 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ Licensed to the Apache Software Foundation (ASF) under one
+ or more contributor license agreements. See the NOTICE file
+ distributed with this work for additional information
+ regarding copyright ownership. The ASF licenses this file
+ to you 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.
+-->
+<project name='compiler-targets'>
+
+ <import file="./system.xml"/>
+
+ <!--
+ Do a cpp compilation.
+ Inherits from "Tuscany-BaseCompiler", which has an include path of:
+ ${tuscanySDO.root.src.dir}/core/src
+ @param objdir - directory where the object files will be written
+ @param srcdir - directory where the source files are located.
+ @param infiles - a space seperated list of the files to compile
+ @param custom-cc-elements - any extra cpp elements, may also be extra <includepath> elements
+ -->
+ <macrodef name="cpp-compile">
+ <attribute name="objdir" default="."/>
+ <attribute name="srcdir" default="."/>
+ <attribute name="infiles" default="*.cpp"/>
+ <element name="custom-cc-elements" optional="true"/>
+ <sequential>
+ <mkdir dir='@{objdir}'/>
+ <cc subsystem='console'
+ objdir='@{objdir}'
+ debug='${debug.compile}'>
+ <compiler refid='${compiler.name}-Compiler'/>
+ <fileset dir='@{srcdir}' includes='@{infiles}'/>
+ <custom-cc-elements/>
+ </cc>
+
+ </sequential>
+ </macrodef>
+
+ <!--
+ Do a cpp link which results in either a library (linktype of plugin, shared, or static)
+ or an executable (linktype of executable).
+ Inherits from "Tuscany-BaseLinker"
+ @param outfile - name of the library to create, OS prefixes and suffixes will be added
+ @param destdir - directory where the library will be written
+ @param infiles - a space seperated list of the object files to link
+ @param linktype - executable, plugin, shared, static
+ @param custom-ld-elements - any extra cpp elements, may also be extra <libset> elements
+ -->
+ <macrodef name="cpp-link">
+ <attribute name="outfile" default="out"/>
+ <attribute name="outdir" default="."/>
+ <attribute name="indir" default="."/>
+ <attribute name="infiles" default="*${object.ext}"/>
+ <attribute name="linktype" default="shared"/>
+ <element name="custom-ld-elements" optional="true"/>
+ <sequential>
+ <mkdir dir='@{outdir}'/>
+ <cc link='@{linktype}'
+ subsystem='console'
+ outfile='@{outdir}/@{outfile}'
+ debug='${debug.compile}'>
+ <linker refid='${compiler.name}-Linker'/>
+ <fileset dir='@{indir}' includes='@{infiles}'/>
+ <custom-ld-elements/>
+ </cc>
+ <cpp-embed-manifest dir="@{outdir}" file="@{outfile}" outtype="@{outtype}"/>
+ </sequential>
+ </macrodef>
+
+ <!--
+ Do a cpp build which compiles and links, resulting in either a library (linktype
+ of plugin, shared, or static) or an executable (linktype of executable).
+ Inherits from both "Tuscany-BaseCompiler" and "Tuscany-BaseLinker"
+ @param srcdir - directory where the source files are located.
+ @param infiles - a space seperated list of the source files to compile and link
+ @param outdir - directory where the output file will be written
+ @param outfile - name of the library or binary to create, OS prefixes and suffixes may be added
+ @param outtype - executable, plugin, shared, static
+ @param custom-build-elements - any extra elements needed for compiling or linking
+ may also be extra <includepath> or <libset> elements
+ -->
+ <macrodef name="cpp-build">
+ <attribute name="srcdir" default="."/>
+ <attribute name="infiles" default="*.cpp"/>
+ <attribute name="outdir" default="."/>
+ <attribute name="outfile" default="out"/>
+ <attribute name="outtype" default="shared"/>
+ <element name="custom-build-elements" optional="true"/>
+ <sequential>
+ <mkdir dir='@{outdir}'/>
+ <cc outtype='@{outtype}'
+ subsystem='console'
+ objdir='@{outdir}'
+ outfile='@{outdir}/@{outfile}'
+ debug='${debug.compile}'>
+ <compiler refid='${compiler.name}-Compiler'/>
+ <linker refid='${compiler.name}-Linker'/>
+ <fileset dir='@{srcdir}' includes='@{infiles}'/>
+ <custom-build-elements/>
+ </cc>
+ <cpp-embed-manifest dir="@{outdir}" file="@{outfile}" outtype="@{outtype}"/>
+ </sequential>
+ </macrodef>
+
+ <!--
+ Install a single file
+ @param file - file to install
+ @param srcdir - directory of file to install
+ @param destdir - Where to install the file
+ @param executable - set permissions to executable, defaults true
+ -->
+ <macrodef name="cpp-install-file">
+ <attribute name="srcfile"/>
+ <attribute name="srcdir" default="."/>
+ <attribute name="destfile" default="@{srcfile}"/>
+ <attribute name="destdir"/>
+ <attribute name="executable" default="true"/>
+ <sequential>
+ <mkdir dir="@{destdir}"/>
+ <copy file="@{srcdir}/@{srcfile}" tofile="@{destdir}/@{destfile}" overwrite='true'/>
+ <if>
+ <equals arg1="@{executable}" arg2="true"/>
+ <then>
+ <chmod file="@{destdir}/@{destfile}" perm="755"/>
+ </then>
+ </if>
+ </sequential>
+ </macrodef>
+
+ <!--
+ Install multiple files
+ @param files - space seperated list of files to install
+ @param srcdir - location of files to install
+ @param destdir - Where to install files
+ @param executable - set permissions to executable, defaults false
+ -->
+ <macrodef name="cpp-install-files">
+ <attribute name="files" default="*.*"/>
+ <attribute name="srcdir" default="."/>
+ <attribute name="destdir"/>
+ <attribute name="executable" default="false"/>
+ <sequential>
+ <mkdir dir="@{destdir}"/>
+ <copy todir="@{destdir}" overwrite='true'>
+ <fileset dir="@{srcdir}" includes="@{files}"/>
+ </copy>
+ <if>
+ <equals arg1="@{executable}" arg2="true"/>
+ <then>
+ <chmod file="@{destdir}/@{files}" perm="755"/>
+ </then>
+ </if>
+ </sequential>
+ </macrodef>
+
+ <!--
+ Install a library
+ @param lib - library to install
+ @param srcdir - directory of file to install
+ @param destdir - Where to install the file
+ @param executable - set permissions to executable, defaults true
+ -->
+ <macrodef name="cpp-install-lib">
+ <attribute name="lib"/>
+ <attribute name="srcdir" default="."/>
+ <attribute name="destrootdir"/>
+ <attribute name="version" default="${tuscanySDO.library.version}"/>
+ <sequential>
+ <cpp-install-file
+ srcfile="${lib.prefix}@{lib}${lib.ext}"
+ srcdir="@{srcdir}"
+ destfile="${lib.prefix}@{lib}${lib.ext}@{version}"
+ destdir="@{destrootdir}/lib"/>
+ <if>
+ <os family="windows"/>
+ <then>
+ <cpp-install-file
+ srcfile="${lib.prefix}@{lib}${dll.ext}"
+ srcdir="@{srcdir}"
+ destfile="${lib.prefix}@{lib}${dll.ext}@{version}"
+ destdir="@{destrootdir}/bin"/>
+ </then>
+ </if>
+ </sequential>
+ </macrodef>
+
+ <!--
+ Create a symlink on unix and mac only
+ @param lib - library file to install
+ @param srclibdir - location of library files to install
+ @param destlibdir - Where to install library files
+ -->
+ <macrodef name="cpp-symlink">
+ <attribute name="linkdir" default=""/>
+ <attribute name="resourcedir" default="."/>
+ <attribute name="link"/>
+ <attribute name="resource"/>
+ <sequential>
+ <if>
+ <or>
+ <os family="unix"/>
+ <os family="mac"/>
+ </or>
+ <then>
+ <mkdir dir="@{linkdir}"/>
+ <symlink
+ link="@{linkdir}/@{link}"
+ resource="@{resourcedir}/@{resource}"
+ overwrite="true"/>
+ </then>
+ </if>
+ </sequential>
+ </macrodef>
+
+ <!--
+ Embed the manifest in the library or executable on Windows only
+ Uses the Microsoft manifest tool "mt"
+ @param dir - the directory where the lib/exe resides
+ @param file - the filename with no suffixes or prefixes
+ @param outtype - the outtype that's passed to the cc task, used to create the filename
+ -->
+ <macrodef name="cpp-embed-manifest">
+ <attribute name="dir"/>
+ <attribute name="file"/>
+ <attribute name="outtype"/>
+ <sequential>
+ <if>
+ <os family="windows"/>
+ <then>
+ <if>
+ <equals arg1="@{outtype}" arg2="executable"/>
+ <then>
+ <property name="file.name" value="@{file}${exe.ext}"/>
+ </then>
+ </if>
+ <property name="file.name" value="${lib.prefix}@{file}${dll.ext}"/>
+
+ <exec executable="mt">
+ <arg line="-manifest @{dir}/${file.name}.manifest -outputresource:@{dir}/${file.name};2"/>
+ </exec>
+ </then>
+ </if>
+ </sequential>
+ </macrodef>
+
+ <!--
+ Delete files from a directory, and possible delete the directory
+ @param files - space seperated list of files to delete
+ @param headerdir - directory where files to delete are
+ @param quiet - verbosity, "true" or "false"
+ @param rmdir - delete the directory after deleting files, "true" or "false"
+ @param custom-delete-elements - anything else you need done additionally
+ -->
+ <macrodef name="cpp-clean-files">
+ <attribute name="files" default="*.*"/>
+ <attribute name="dir" default="."/>
+ <attribute name="quiet" default="true"/>
+ <attribute name="rmdir" default="false"/>
+ <element name="custom-delete-elements" optional="true"/>
+ <sequential>
+ <delete quiet="@{quiet}">
+ <fileset dir="@{dir}" includes="@{files}"/>
+ </delete>
+ <if>
+ <equals arg1="@{rmdir}" arg2="true"/>
+ <then>
+ <delete dir="@{dir}"/>
+ </then>
+ </if>
+ <custom-delete-elements/>
+ </sequential>
+ </macrodef>
+
+ <!--
+ Delete a library from a root library directory, and possible delete the directory
+ On windows, it will delete both bin/<library>.dll and lib/<library>.lib
+ On Unix, it will delete lib/<library>
+ @param lib - library to delete
+ @param librootdir - directory where the library to delete is located
+ @param quiet - verbosity, "true" or "false"
+ -->
+ <macrodef name="cpp-clean-lib">
+ <attribute name="lib"/>
+ <attribute name="librootdir"/>
+ <attribute name="quiet" default="true"/>
+ <attribute name="version" default="${tuscanySDO.library.version}"/>
+ <sequential>
+ <delete quiet="@{quiet}" file="@{librootdir}/lib/${lib.prefix}@{lib}${lib.ext}@{version}"/>
+ <if>
+ <os family="windows"/>
+ <then>
+ <delete quiet="@{quiet}" file="@{librootdir}/bin/${lib.prefix}@{lib}${dll.ext}@{version}"/>
+ </then>
+ </if>
+ </sequential>
+ </macrodef>
+
+</project>
diff --git a/sdo-cpp/trunk/antscripts/platform.properties b/sdo-cpp/trunk/antscripts/platform.properties
new file mode 100755
index 0000000000..47c90ec9ac
--- /dev/null
+++ b/sdo-cpp/trunk/antscripts/platform.properties
@@ -0,0 +1,42 @@
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements. See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership. The ASF licenses this file
+# to you 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.
+
+platform.lib.ext=
+platform.dll.ext=
+platform.exe.ext=
+platform.object.ext=
+platform.script.ext=
+platform.compiler.name=
+platform.debug.compile=
+platform.external.definitions.file=
+
+platform.tuscanySDO.root.dir=
+platform.tuscanySDO.install.dir=
+platform.tuscanySDO.release.file.name=
+platform.tuscanySDO.distribution.dir=
+
+platform.public.key.path=
+platform.secret.key.path=
+platform.key.id=
+
+platform.sdo.impl.library.name=
+platform.sdo.impl.library.path=
+platform.sdo.impl.include.path=
+
+platform.axis2c.home.dir=
+platform.libxml2.lib.dir=
+platform.libxml2.include.dir=
diff --git a/sdo-cpp/trunk/antscripts/system.xml b/sdo-cpp/trunk/antscripts/system.xml
new file mode 100644
index 0000000000..2773197884
--- /dev/null
+++ b/sdo-cpp/trunk/antscripts/system.xml
@@ -0,0 +1,647 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ Licensed to the Apache Software Foundation (ASF) under one
+ or more contributor license agreements. See the NOTICE file
+ distributed with this work for additional information
+ regarding copyright ownership. The ASF licenses this file
+ to you 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.
+-->
+<project name="system-import">
+
+ <property file="${basedir}/antscripts/platform.properties"/>
+ <property environment="env"/>
+
+ <!-- These 3 lines pull in antcontrib and cctasks -->
+ <taskdef resource="net/sf/antcontrib/antlib.xml"/>
+ <taskdef resource="cpptasks.tasks"/>
+ <typedef resource="cpptasks.types"/>
+
+ <typedef onerror="ignore" name="signer" classname="org.apache.commons.openpgp.ant.OpenPgpSignerTask" classpath="${basedir}/antscripts/OpenPGP.jar"/>
+
+ <!--
+ Configure the tuscanySDO.root.dir
+ Take the override value from platform.properties if set
+ -->
+ <if>
+ <and>
+ <isset property="platform.tuscanySDO.root.dir"/>
+ <length string="${platform.tuscanySDO.root.dir}" when="greater" length="0" trim="true"/>
+ </and>
+ <then>
+ <property name="tuscanySDO.root.dir" location="${platform.tuscanySDO.root.dir}"/>
+ </then>
+ <else>
+ <property name="tuscanySDO.root.dir" location="."/>
+ </else>
+ </if>
+
+ <property name="tuscanySDO.root.src.dir" location="${tuscanySDO.root.dir}/runtime"/>
+
+ <!--
+ Configure the tuscanySDO.install.dir
+ Take the override value from platform.properties if set
+ Else take it from the env var TUSCANY_SDOCPP
+ Else use a default of ${tuscanySDO.root.dir}/deploy
+ -->
+ <if>
+ <and>
+ <isset property="platform.tuscanySDO.install.dir"/>
+ <length string="${platform.tuscanySDO.install.dir}" when="greater" length="0" trim="true"/>
+ </and>
+ <then>
+ <property name="tuscanySDO.install.dir" location="${platform.tuscanySDO.install.dir}"/>
+ </then>
+ <elseif>
+ <isset property="env.TUSCANY_SDOCPP"/>
+ <then>
+ <property name="tuscanySDO.install.dir" location="${env.TUSCANY_SDOCPP}"/>
+ </then>
+ </elseif>
+ <else>
+ <property name="tuscanySDO.install.dir" location="${tuscanySDO.root.dir}/deploy"/>
+ </else>
+ </if>
+
+ <!--
+ Configure the version for all tuscanySDO library generation
+ If on windows, set it to empty
+ Else take the override value from platform.properties if set
+ Else default it to "0.0.0"
+ -->
+ <if>
+ <os family="windows"/>
+ <then>
+ <property name="tuscanySDO.library.version" value=""/>
+ </then>
+ <elseif>
+ <and>
+ <isset property="platform.tuscanySDO.library.version"/>
+ <length string="${platform.tuscanySDO.library.version}" when="greater" length="0" trim="true"/>
+ </and>
+ <then>
+ <property name="tuscanySDO.library.version" value="${platform.tuscanySDO.library.version}"/>
+ </then>
+ </elseif>
+ <else>
+ <property name="tuscanySDO.library.version" value=".0.0.0"/>
+ </else>
+ </if>
+
+<!--
+ Configure tuscanySDO.release.file.name that defines the generated packed file used on releases
+ Take the override value from platform.properties if set
+ Else take it from env var TUSCANY_SDOCPP_RELEASE_NAME
+ If both are not defined, use as default "tuscany_sdo_cpp" name
+ -->
+ <if>
+ <and>
+ <isset property="platform.tuscanySDO.release.file.name"/>
+ <length string="${platform.tuscanySDO.release.file.name}" when="greater" length="0" trim="true"/>
+ </and>
+ <then>
+ <property name="tuscanySDO.release.file.name" value="${platform.tuscanySDO.release.file.name}"/>
+ </then>
+ <elseif>
+ <and>
+ <isset property="env.TUSCANY_SDOCPP_RELEASE_NAME"/>
+ <length string="${env.TUSCANY_SDOCPP_RELEASE_NAME}" when="greater" length="0" trim="true"/>
+ </and>
+ <then>
+ <property name="tuscanySDO.release.file.name" value="${env.TUSCANY_SDOCPP_RELEASE_NAME}"/>
+ </then>
+ </elseif>
+ <else>
+ <property name="tuscanySDO.release.file.name" value="tuscany_sdo_cpp"/>
+ </else>
+ </if>
+
+<!--
+ Configure distribution.dir that defines where the distribution files will be placed
+ Take the override value from platform.properties if set
+ Else assumes ${basedir}/distribution as the distribution folder
+ -->
+ <if>
+ <and>
+ <isset property="platform.tuscanySDO.distribution.dir"/>
+ <length string="${platform.tuscanySDO.distribution.dir}" when="greater" length="0" trim="true"/>
+ </and>
+ <then>
+ <property name="distribution.dir" location="${platform.tuscanySDO.distribution.dir}"/>
+ </then>
+ <else>
+ <property name="distribution.dir" value="${basedir}/distribution"/>
+ </else>
+ </if>
+
+<!--
+ Load key id, public and secret key path from platform.properties files into key.id, public.key.path and secret.key.path variables respectively
+ Also checks if the user defined the password on the command line
+ -->
+ <target name="check.keys">
+ <if>
+ <and>
+ <isset property="platform.public.key.path"/>
+ <isset property="platform.key.id"/>
+ <isset property="platform.secret.key.path"/>
+ <length string="${platform.public.key.path}" when="greater" length="0" trim="true"/>
+ <length string="${platform.key.id}" when="greater" length="0" trim="true"/>
+ <length string="${platform.secret.key.path}" when="greater" length="0" trim="true"/>
+ </and>
+ <then>
+ <property name="public.key.path" location="${platform.public.key.path}"/>
+ <property name="secret.key.path" location="${platform.secret.key.path}"/>
+ <property name="key.id" value="${platform.key.id}"/>
+ </then>
+ <else>
+ <fail message="The public, secret and key id must be defined on platform.properties file"/>
+ </else>
+ </if>
+ <if>
+ <and>
+ <isset property="password"/>
+ <length string="${password}" when="greater" length="0" trim="true"/> </and>
+ <then>
+ <property name="secret.key.password" value="${password}"/>
+ </then>
+ <else>
+ <fail message='Secret key password was not properly set. Add on the ant command line, for example, -Dpassword="123"'/>
+ </else>
+ </if>
+ </target>
+
+ <!--
+ Configure ${enable_ws} and ${axis2c.home.dir}, which is needed to compile the ws extension
+ Take the override value from platform.properties if set
+ Else take it from the env var AXIS2C_HOME
+ The axis2c.home.dir property can only be obtained by calling this target
+ -->
+ <target name="check.ws" depends="check.libxml2">
+ <if>
+ <and>
+ <isset property="platform.axis2c.home.dir"/>
+ <length string="${platform.axis2c.home.dir}" when="greater" length="0" trim="true"/>
+ </and>
+ <then>
+ <property name="enable_ws" value="true"/>
+ <property name="axis2c.home.dir" location="${platform.axis2c.home.dir}"/>
+ </then>
+ <elseif>
+ <isset property="env.AXIS2C_HOME"/>
+ <then>
+ <property name="enable_ws" value="true"/>
+ <property name="axis2c.home.dir" location="${env.AXIS2C_HOME}"/>
+ </then>
+ </elseif>
+ <else>
+ <echo message="TuscanySDO ws extension is not enabled" level="warning"/>
+ </else>
+ </if>
+ </target>
+
+ <!--
+ Configure ${enable_libxml2}, which is needed to compile the ws extension
+ Take the override value from platform.properties if set
+ Else take it from the env var AXIS2C_HOME
+ The libxml2.* properties can only be obtained by calling this target
+ -->
+ <target name="check.libxml2">
+ <if>
+ <and>
+ <isset property="platform.libxml2.lib.dir"/>
+ <isset property="platform.libxml2.include.dir"/>
+ <length string="${platform.libxml2.lib.dir}" when="greater" length="0" trim="true"/>
+ <length string="${platform.libxml2.include.dir}" when="greater" length="0" trim="true"/>
+ </and>
+ <then>
+ <property name="enable_libxml2" value="true"/>
+ <property name="libxml2.lib.dir" location="${platform.libxml2.lib.dir}"/>
+ <property name="libxml2.include.dir" location="${platform.libxml2.include.dir}"/>
+ <condition property="iconv.home.dir" value="${platform.iconv.home.dir}">
+ <os family="windows"/>
+ </condition>
+ </then>
+ <elseif>
+ <and>
+ <isset property="env.LIBXML2_LIB"/>
+ <isset property="env.LIBXML2_INCLUDE"/>
+ </and>
+ <then>
+ <property name="enable_libxml2" value="true"/>
+ <property name="libxml2.lib.dir" location="${env.LIBXML2_LIB}"/>
+ <property name="libxml2.include.dir" location="${env.LIBXML2_INCLUDE}"/>
+ <condition property="iconv.home.dir" value="${env.ICONV_HOME}">
+ <os family="windows"/>
+ </condition>
+ </then>
+ </elseif>
+ <else>
+ <fail message="Unable to find libxml2 installation, must be set by LIBXML2_LIB and LIBXML2_INCLUDE or in platform.properties file"/>
+ </else>
+ </if>
+ </target>
+
+ <!--
+ Configure the debug.compile flag
+ Try looking first on the command line
+ Then take the override value from platform.properties if set
+ Else its false
+ -->
+ <if>
+ <isset property="debug"/>
+ <then>
+ <!-- Tests if its set on the ant command line "ant -Ddebug=true" -->
+ <if>
+ <istrue value="${debug}"/>
+ <then>
+ <property name="debug.compile" value="true"/>
+ </then>
+ </if>
+ </then>
+ <elseif>
+ <and>
+ <isset property="platform.debug.compile"/>
+ <istrue value="${platform.debug.compile}"/>
+ <length string="${platform.debug.compile}" when="greater" length="0" trim="true"/>
+ </and>
+ <then>
+ <property name="debug.compile" value="true"/>
+ </then>
+ </elseif>
+ </if>
+ <property name="debug.compile" value="false"/>
+
+ <!--
+ Configure the compiler.name
+ Take the override value from platform.properties if set
+ Else set it based on the OS
+ -->
+ <if>
+ <and>
+ <isset property="platform.compiler.name"/>
+ <length string="${platform.compiler.name}" when="greater" length="0" trim="true"/>
+ </and>
+ <then>
+ <property name="compiler.name" value="${platform.compiler.name}"/>
+ </then>
+ <else>
+ <condition property="compiler.name" value="msvc8">
+ <os family="windows"/>
+ </condition>
+
+ <condition property="compiler.name" value="g++">
+ <os family="unix"/>
+ </condition>
+
+ <condition property="compiler.name" value="mac_g++">
+ <os family="mac"/>
+ </condition>
+ </else>
+ </if>
+
+ <!--
+ Configure the lib.ext
+ Take the override value from platform.properties if set
+ Else set it based on the OS
+ -->
+ <if>
+ <and>
+ <isset property="platform.lib.ext"/>
+ <length string="${platform.lib.ext}" when="greater" length="0" trim="true"/>
+ </and>
+ <then>
+ <property name="lib.ext" value="${platform.lib.ext}"/>
+ </then>
+ <else>
+ <condition property="lib.ext" value=".lib">
+ <os family="windows"/>
+ </condition>
+
+ <condition property="lib.ext" value=".dylib">
+ <os family="mac"/>
+ </condition>
+
+ <condition property="lib.ext" value=".so">
+ <os family="unix"/>
+ </condition>
+ </else>
+ </if>
+
+ <!--
+ Configure the dll.ext, used for windows only
+ Take the override value from platform.properties if set
+ Else set it based on the OS
+ -->
+ <if>
+ <and>
+ <isset property="platform.dll.ext"/>
+ <length string="${platform.dll.ext}" when="greater" length="0" trim="true"/>
+ </and>
+ <then>
+ <property name="dll.ext" value="${platform.dll.ext}"/>
+ </then>
+ <else>
+ <condition property="dll.ext" value=".dll">
+ <os family="windows"/>
+ </condition>
+
+ <property name="dll.ext" value=""/>
+
+ </else>
+ </if>
+
+ <!--
+ Configure the lib.prefix
+ Take the override value from platform.properties if set
+ Else set it based on the OS
+ -->
+ <if>
+ <and>
+ <isset property="platform.lib.prefix"/>
+ <length string="${platform.lib.prefix}" when="greater" length="0" trim="true"/>
+ </and>
+ <then>
+ <property name="lib.prefix" value="${platform.lib.prefix}"/>
+ </then>
+ <else>
+ <condition property="lib.prefix" value="">
+ <os family="windows"/>
+ </condition>
+
+ <condition property="lib.prefix" value="lib">
+ <or>
+ <os family="unix"/>
+ <os family="mac"/>
+ </or>
+ </condition>
+ </else>
+ </if>
+
+
+ <!--
+ Configure the object.ext
+ Take the override value from platform.properties if set
+ Else set it based on the OS
+ -->
+ <if>
+ <and>
+ <isset property="platform.object.ext"/>
+ <length string="${platform.object.ext}" when="greater" length="0" trim="true"/>
+ </and>
+ <then>
+ <property name="object.ext" value="${platform.object.ext}"/>
+ </then>
+ <else>
+ <condition property="object.ext" value=".obj">
+ <os family="windows"/>
+ </condition>
+
+ <condition property="object.ext" value=".o">
+ <or>
+ <os family="unix"/>
+ <os family="mac"/>
+ </or>
+ </condition>
+ </else>
+ </if>
+
+
+ <!--
+ Configure the exe.ext
+ Take the override value from platform.properties if set
+ Else set it based on the OS
+ -->
+ <if>
+ <and>
+ <isset property="platform.exe.ext"/>
+ <length string="${platform.exe.ext}" when="greater" length="0" trim="true"/>
+ </and>
+ <then>
+ <property name="exe.ext" value="${platform.exe.ext}"/>
+ </then>
+ <else>
+ <condition property="exe.ext" value=".exe">
+ <os family="windows"/>
+ </condition>
+
+ <condition property="exe.ext" value="">
+ <or>
+ <os family="unix"/>
+ <os family="mac"/>
+ </or>
+ </condition>
+ </else>
+ </if>
+
+
+ <!--
+ Configure the script.ext
+ Take the override value from platform.properties if set
+ Else set it based on the OS
+ -->
+ <if>
+ <and>
+ <isset property="platform.script.ext"/>
+ <length string="${platform.script.ext}" when="greater" length="0" trim="true"/>
+ </and>
+ <then>
+ <property name="script.ext" value="${platform.script.ext}"/>
+ </then>
+ <else>
+ <condition property="script.ext" value=".bat">
+ <os family="windows"/>
+ </condition>
+
+ <condition property="script.ext" value=".sh">
+ <or>
+ <os family="unix"/>
+ <os family="mac"/>
+ </or>
+ </condition>
+ </else>
+ </if>
+
+ <!--
+ Configure the SDO implementation library and include path, which
+ will be used for sdo axiom compilation. By default, sdo axiom will
+ include and link the TuscanySDO implementation, but this allows for
+ compiling with other SDO implementations
+ Set the following:
+ sdo.impl.library.name
+ sdo.impl.library.path
+ sdo.impl.include.path
+ -->
+ <if>
+ <and>
+ <isset property="platform.sdo.impl.library.name"/>
+ <isset property="platform.sdo.impl.library.path"/>
+ <isset property="platform.sdo.impl.include.path"/>
+ <length string="${platform.sdo.impl.library.name}" when="greater" length="0" trim="true"/>
+ <length string="${platform.sdo.impl.library.path}" when="greater" length="0" trim="true"/>
+ <length string="${platform.sdo.impl.include.path}" when="greater" length="0" trim="true"/>
+ </and>
+ <then>
+ <property name="sdo.impl.library.name" value="${platform.sdo.impl.library.name}"/>
+ <property name="sdo.impl.library.path" location="${platform.sdo.impl.library.path}"/>
+ <property name="sdo.impl.include.path" location="${platform.sdo.impl.include.path}"/>
+ </then>
+ <else>
+ <property name="sdo.impl.library.name" value="tuscany_sdo"/>
+ <property name="sdo.impl.library.path" location="${tuscanySDO.install.dir}/lib"/>
+ <property name="sdo.impl.include.path" location="${tuscanySDO.root.src.dir}/core/src"/>
+ </else>
+ </if>
+
+
+ <condition property="windows" value="true">
+ <os family="windows"/>
+ </condition>
+
+ <condition property="mac" value="true">
+ <os family="mac"/>
+ </condition>
+
+ <!--
+ Base compiler definition
+ For now the base compiler is empty.
+ -->
+ <compiler id="Tuscany-BaseCompiler" multithreaded="true" exceptions="true" rtti="true"/>
+
+ <!--
+ Specific compiler definitions
+ The compilerarg location functionality completely omits the arg: antcontrib bug 1794857
+ -->
+
+ <!-- MSVC compilers for windows -->
+ <compiler id="msvc-Compiler" extends="Tuscany-BaseCompiler" name="msvc">
+ <defineset define="WIN32,_CRT_SECURE_NO_DEPRECATE,_CRT_NON_CONFORMING_SWPRINTFS"/>
+ </compiler>
+
+ <!-- MSVC compilers for windows
+ The standard msvc ant contrib cc task compiler doesnt work so well,
+ so we made our own until the bugs are resolved. The actual implementation
+ of TuscanyMSVC8DevStudioCCompiler is in TuscanySCA/tools/ant_cpptasks
+ -->
+ <compiler id="msvc8-Compiler"
+ extends="Tuscany-BaseCompiler"
+ classname="tuscany.antCompilers.TuscanyMSVC8DevStudioCCompiler">
+ <defineset define="WIN32,_CRT_SECURE_NO_DEPRECATE,_CRT_NON_CONFORMING_SWPRINTFS"/>
+ </compiler>
+
+ <!-- g++ compiler for most Unix platforms -->
+ <compiler id="g++-Compiler" extends="Tuscany-BaseCompiler" name="g++"/>
+
+ <!-- g++ compiler for most Unix platforms
+ Used for cross compilation with the -m32 flag -->
+ <compiler id="g++m32-Compiler" extends="Tuscany-BaseCompiler" name="g++">
+ <compilerarg value="-m32"/>
+ </compiler>
+
+ <!-- g++ compiler for Apple mac -->
+ <compiler id="mac_g++-Compiler" extends="Tuscany-BaseCompiler" name="g++">
+ <defineset define="IS_DARWIN"/>
+ </compiler>
+
+ <!--
+ Base linker definition
+ -->
+ <linker id="Tuscany-BaseLinker">
+ <syslibset if="windows" libs="kernel32,user32,ws2_32"/>
+ </linker>
+
+ <!--
+ Specific linker definitions
+ The linker extends funcionality isnt working correctly: antcontrib bug 1794867
+ Specifically, the syslibset for dl was not working on Linux
+ -->
+ <linker id="msvc-Linker" extends="Tuscany-BaseLinker" name="msvc">
+ <syslibset libs="kernel32,user32,ws2_32"/>
+ </linker>
+
+ <linker id="msvc8-Linker" extends="Tuscany-BaseLinker" name="msvc">
+ <syslibset libs="kernel32,user32,ws2_32"/>
+ </linker>
+
+ <linker id="g++-Linker" extends="Tuscany-BaseLinker" name="g++"/>
+
+ <linker id="g++m32-Linker" extends="Tuscany-BaseLinker" name="g++">
+ <linkerarg value="-m32"/>
+ </linker>
+
+ <!--
+ Setup the external definitions file, if there is one
+ -->
+ <if>
+ <and>
+ <isset property="platform.external.definitions.file"/>
+ <length string="${platform.external.definitions.file}" when="greater" length="0" trim="true"/>
+ </and>
+ <then>
+ <property name="external.definitions.file" value="${platform.external.definitions.file}"/>
+ <import file="${external.definitions.file}"/>
+ </then>
+ </if>
+ <property name="external.definitions.file" value=""/>
+
+ <target name="display.system" depends="check.ws,check.libxml2">
+
+ <!-- Tuscany paths, etc -->
+ <echo message=" "/>
+ <echo message="TuscanySDO paths"/>
+ <echo message=" tuscanySDO.root.dir= ${tuscanySDO.root.dir}"/>
+ <echo message=" tuscanySDO.root.src.dir= ${tuscanySDO.root.src.dir}"/>
+ <echo message=" tuscanySDO.install.dir= ${tuscanySDO.install.dir}"/>
+ <echo message=" sdo.impl.library.name= ${sdo.impl.library.name}"/>
+ <echo message=" sdo.impl.library.path= ${sdo.impl.library.path}"/>
+ <echo message=" sdo.impl.include.path= ${sdo.impl.include.path}"/>
+ <echo message=" tuscanySDO.library.version= '${tuscanySDO.library.version}'"/>
+
+ <!-- compilers, libs, etc -->
+ <echo message=" "/>
+ <echo message="TuscanySDO compiler configuration"/>
+ <echo message=" compiler.name= '${compiler.name}'"/>
+ <echo message=" debug.compile= '${debug.compile}'"/>
+ <echo message=" lib.ext= '${lib.ext}'"/>
+ <echo message=" dll.ext= '${dll.ext}'"/>
+ <echo message=" lib.prefix= '${lib.prefix}'"/>
+ <echo message=" object.ext= '${object.ext}'"/>
+ <echo message=" exe.ext= '${exe.ext}'"/>
+ <echo message=" script.ext= '${script.ext}'"/>
+ <echo message=" external.definitions.file= '${external.definitions.file}'"/>
+
+ <!-- libxml2 -->
+ <if>
+ <isset property="enable_libxml2"/>
+ <then>
+ <echo message=" "/>
+ <echo message="libxml2 location"/>
+ <echo message=" libxml2.lib.dir= ${libxml2.lib.dir}"/>
+ <echo message=" libxml2.include.dir= ${libxml2.include.dir}"/>
+ </then>
+ </if>
+
+ <!-- axis2c -->
+ <if>
+ <isset property="enable_ws"/>
+ <then>
+ <echo message=" "/>
+ <echo message="axis2c location"/>
+ <echo message=" axis2c.home.dir= ${axis2c.home.dir}"/>
+ </then>
+ </if>
+
+ <echo message=" "/>
+
+ </target>
+
+</project>
diff --git a/sdo-cpp/trunk/autogen.sh b/sdo-cpp/trunk/autogen.sh
new file mode 100755
index 0000000000..18277601c8
--- /dev/null
+++ b/sdo-cpp/trunk/autogen.sh
@@ -0,0 +1,31 @@
+#!/bin/bash
+
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements. See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership. The ASF licenses this file
+# to you 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.
+
+for i in "libtoolize --force" aclocal autoconf autoheader
+do
+ echo -n "Running $i..."
+ $i || exit 1
+ echo 'done.'
+done
+
+echo -n 'Running automake...'
+automake --add-missing
+echo 'done.'
+exit 0
+
diff --git a/sdo-cpp/trunk/build.bat b/sdo-cpp/trunk/build.bat
new file mode 100644
index 0000000000..aa94aa57b4
--- /dev/null
+++ b/sdo-cpp/trunk/build.bat
@@ -0,0 +1,63 @@
+@echo off
+@REM Licensed to the Apache Software Foundation (ASF) under one
+@REM or more contributor license agreements. See the NOTICE file
+@REM distributed with this work for additional information
+@REM regarding copyright ownership. The ASF licenses this file
+@REM to you under the Apache License, Version 2.0 (the
+@REM "License"); you may not use this file except in compliance
+@REM with the License. You may obtain a copy of the License at
+@REM
+@REM http://www.apache.org/licenses/LICENSE-2.0
+@REM
+@REM Unless required by applicable law or agreed to in writing,
+@REM software distributed under the License is distributed on an
+@REM "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+@REM KIND, either express or implied. See the License for the
+@REM specific language governing permissions and limitations
+@REM under the License.
+
+
+@setlocal
+
+set config=Release
+if .Debug == .%1 (
+echo Building Debug version
+set config=Debug
+)
+
+if "%LIBXML2_HOME%" == "" (
+echo "LIBXML2_HOME not set"
+goto end
+)
+echo using LIBXML2: %LIBXML2_HOME%
+
+if "%ICONV_HOME%" == "" (
+echo "ICONV_HOME not set"
+goto end
+)
+echo using ICONV: %ICONV_HOME%"
+
+
+set TUSCANY_SDOCPP=%cd%\deploy
+call vcvars32
+cd vsexpress\tuscany_sdo\sdo_runtime
+call vcbuild sdo_runtime.vcproj "%config%|Win32"
+
+cd ..\sdo_test
+call vcbuild sdo_test.vcproj "%config%|Win32"
+
+if "%AXIS2C_HOME%" == "" (
+echo "AXIS2C_HOME not set: sdo_axiom will not be built"
+goto noaxis
+)
+echo using AXIS2C: %AXIS2C_HOME%
+
+cd ..\sdo_axiom
+call vcbuild sdo_axiom.vcproj "%config%|Win32"
+
+cd ..\sdo_axiom_test
+call vcbuild sdo_axiom_test.vcproj "%config%|Win32"
+
+:noaxis
+
+@endlocal
diff --git a/sdo-cpp/trunk/build.sh b/sdo-cpp/trunk/build.sh
new file mode 100755
index 0000000000..c306d2a20d
--- /dev/null
+++ b/sdo-cpp/trunk/build.sh
@@ -0,0 +1,22 @@
+#!/bin/sh
+
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements. See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership. The ASF licenses this file
+# to you 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.
+
+./configure.sh
+make install
+
diff --git a/sdo-cpp/trunk/build.xml b/sdo-cpp/trunk/build.xml
new file mode 100644
index 0000000000..e2d9bc9456
--- /dev/null
+++ b/sdo-cpp/trunk/build.xml
@@ -0,0 +1,244 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ Licensed to the Apache Software Foundation (ASF) under one
+ or more contributor license agreements. See the NOTICE file
+ distributed with this work for additional information
+ regarding copyright ownership. The ASF licenses this file
+ to you 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.
+-->
+
+<project name="TuscanySdoNative" default="all" basedir=".">
+<property name="test.dir" location="runtime/test"/>
+<property name="samples.dir" location="samples"/>
+<property name="tools.dir" location="tools"/>
+
+ <!--
+ This is the root level ant build.xml file for TuscanySDO Native
+ Nothing is actually performed here, it just delegates to subdirectory
+ build.xml files. Common scripts used by all ant build files can be
+ found in the ant subdirectory.
+ -->
+
+ <import file="antscripts/system.xml"/>
+
+ <property name="distribution.bin.dir" location="${distribution.dir}/bin"/>
+ <property name="distribution.src.dir" location="${distribution.dir}/src"/>
+ <property name="pack.dir" location="${distribution.dir}"/>
+
+ <property name="runtime.sdo.dir" value="runtime/core"/>
+
+ <!--
+ Public targets
+ -->
+
+ <target name="all" description="build and install all TuscanySdoNative source code and documentation">
+ <antcall target="build"/>
+ <antcall target="install"/>
+ </target>
+
+ <target name="build" description="Build all TuscanySdoNative source code and documentation">
+ <antcall target="build.sdo"/>
+ <!--antcall target="generate.docs"/-->
+ </target>
+
+ <target name="distribution" description="Generate all TuscanyDASNative distribution structure">
+ <antcall target="distribution.sdo"/>
+ </target>
+
+ <target name="install" description="Install TuscanySdoNative libraries and headers">
+ <antcall target="install.sdo"/>
+ <!--antcall target="install.docs"/-->
+ </target>
+
+ <target name="clean" description="Clean all TuscanySdoNative compiled source code">
+ <antcall target="clean.sdo"/>
+ <!--antcall target="clean.docs"/-->
+ </target>
+
+<target name="samples" description="Build and Install all TuscanyDASNative samples">
+ <antcall target="build.samples"/>
+</target>
+
+<target name="pack.distribution" description="Build all TuscanySDONative source code and documentation" depends="check.keys">
+ <delete quiet="true" file="${pack.dir}/${tuscanySDO.release.file.name}bin.zip"/>
+ <delete quiet="true" file="${pack.dir}/${tuscanySDO.release.file.name}src.zip"/>
+ <delete quiet="true" file="${pack.dir}/${tuscanySDO.release.file.name}bin.tar.gz"/>
+ <delete quiet="true" file="${pack.dir}/${tuscanySDO.release.file.name}src.tar.gz"/>
+ <delete quiet="true" file="${pack.dir}/${tuscanySDO.release.file.name}bin.zip.md5"/>
+ <delete quiet="true" file="${pack.dir}/${tuscanySDO.release.file.name}src.zip.md5"/>
+ <delete quiet="true" file="${pack.dir}/${tuscanySDO.release.file.name}bin.tar.gz.md5"/>
+ <delete quiet="true" file="${pack.dir}/${tuscanySDO.release.file.name}src.tar.gz.md5"/>
+ <delete quiet="true" file="${pack.dir}/${tuscanySDO.release.file.name}bin.zip.asc"/>
+ <delete quiet="true" file="${pack.dir}/${tuscanySDO.release.file.name}src.zip.asc"/>
+ <delete quiet="true" file="${pack.dir}/${tuscanySDO.release.file.name}bin.tar.gz.asc"/>
+ <delete quiet="true" file="${pack.dir}/${tuscanySDO.release.file.name}src.tar.gz.asc"/>
+ <delete quiet="true" dir="${pack.dir}/${tuscanySDO.release.file.name}bin"/>
+ <delete quiet="true" dir="${pack.dir}/${tuscanySDO.release.file.name}src"/>
+
+ <!--Packs the bin distribution-->
+ <mkdir dir="${pack.dir}/${tuscanySDO.release.file.name}bin"/>
+ <copy todir="${pack.dir}/${tuscanySDO.release.file.name}bin">
+ <fileset dir="${distribution.bin.dir}" includes="**"/>
+ </copy>
+
+ <if>
+ <os family="windows"/>
+ <then>
+ <zip destfile="${pack.dir}/${tuscanySDO.release.file.name}bin.zip" level="9">
+ <fileset dir="${pack.dir}" includes="${tuscanySDO.release.file.name}bin/"/>
+ </zip>
+ </then>
+ <else>
+ <tar destfile="${pack.dir}/${tuscanySDO.release.file.name}bin.tar.gz" compression="gzip" longfile="gnu">
+ <fileset dir="${pack.dir}" includes="${tuscanySDO.release.file.name}bin/"/>
+ </tar>
+ </else>
+ </if>
+
+
+
+ <delete quiet="true" dir="${pack.dir}/${tuscanySDO.release.file.name}bin"/>
+
+ <!--Packs the src distribution-->
+ <mkdir dir="${pack.dir}/${tuscanySDO.release.file.name}src"/>
+ <copy todir="${pack.dir}/${tuscanySDO.release.file.name}src">
+ <fileset dir="${distribution.src.dir}" includes="**"/>
+ </copy>
+
+ <if>
+ <os family="windows"/>
+ <then>
+ <zip destfile="${pack.dir}/${tuscanySDO.release.file.name}src.zip" level="9">
+ <fileset dir="${pack.dir}" includes="${tuscanySDO.release.file.name}src/"/>
+ </zip>
+
+ <!--Generate the checksum files-->
+ <checksum forceOverwrite="yes" file="${pack.dir}/${tuscanySDO.release.file.name}bin.zip" fileext=".md5"/>
+ <checksum forceOverwrite="yes" file="${pack.dir}/${tuscanySDO.release.file.name}src.zip" fileext=".md5"/>
+
+ <signer asciiarmor="true" artefact="${pack.dir}/${tuscanySDO.release.file.name}bin.zip" secring="${secret.key.path}" pubring="${public.key.path}" password="${secret.key.password}" keyid="${key.id}"/>
+ <signer asciiarmor="true" artefact="${pack.dir}/${tuscanySDO.release.file.name}src.zip" secring="${secret.key.path}" pubring="${public.key.path}" password="${secret.key.password}" keyid="${key.id}"/>
+
+ </then>
+ <else>
+ <tar destfile="${pack.dir}/${tuscanySDO.release.file.name}src.tar.gz" compression="gzip" longfile="gnu">
+ <fileset dir="${pack.dir}" includes="${tuscanySDO.release.file.name}src/"/>
+ </tar>
+
+ <!--Generate the checksum files-->
+ <checksum forceOverwrite="yes" file="${pack.dir}/${tuscanySDO.release.file.name}bin.tar.gz" fileext=".md5"/>
+ <checksum forceOverwrite="yes" file="${pack.dir}/${tuscanySDO.release.file.name}src.tar.gz" fileext=".md5"/>
+
+
+ <signer asciiarmor="true" artefact="${pack.dir}/${tuscanySDO.release.file.name}bin.tar.gz" secring="${secret.key.path}" pubring="${public.key.path}" password="${secret.key.password}" keyid="${key.id}"/>
+ <signer asciiarmor="true" artefact="${pack.dir}/${tuscanySDO.release.file.name}src.tar.gz" secring="${secret.key.path}" pubring="${public.key.path}" password="${secret.key.password}" keyid="${key.id}"/>
+
+ </else>
+ </if>
+
+ <delete quiet="true" dir="${pack.dir}/${tuscanySDO.release.file.name}src"/>
+
+ </target>
+
+ <target name="test" description="Run SDO tests">
+ <ant target="test" antfile="${runtime.sdo.dir}/build.xml" inheritAll="false"/>
+ </target>
+
+
+ <!--
+ Internal targets
+ They can still be called, they're just not described, so wont show up in "ant -p"
+ Using antfile and inheritAll="false" to maintain the subdir build.xml basedir settings
+ -->
+
+ <target name="build.sdo">
+ <ant target="build" antfile="${runtime.sdo.dir}/build.xml" inheritAll="false"/>
+ </target>
+
+ <target name="generate.docs">
+ <!--ant target="generate.docs" antfile="${runtime.sdo.dir}/build.xml" inheritAll="false"/-->
+ </target>
+
+ <target name="install.sdo">
+ <ant target="install" antfile="${runtime.sdo.dir}/build.xml" inheritAll="false"/>
+ </target>
+
+ <target name="install.docs">
+ <!--ant target="install.docs" antfile="${runtime.sdo.dir}/build.xml" inheritAll="false"/-->
+ </target>
+
+ <target name="clean.sdo">
+ <ant target="clean" antfile="${runtime.sdo.dir}/build.xml" inheritAll="false"/>
+ </target>
+
+ <target name="clean.docs">
+ <!--ant target="clean.docs" antfile="${runtime.sdo.dir}/build.xml" inheritAll="false"/-->
+ </target>
+
+<target name="distribution.sdo">
+ <delete dir="${distribution.dir}" quiet="true"/>
+ <antcall target="clean"/>
+
+ <!-- Create source distribution -->
+ <copy
+ overwrite="true"
+ todir="${distribution.src.dir}">
+ <fileset dir="." excludes="samples/ deploy/ distribution/ **/VSExpress/ antscripts/OpenPGP.jar"/>
+ </copy>
+
+ <!--<antcall target="tools"/>-->
+ <antcall target="all"/>
+ <antcall target="samples"/>
+
+
+
+ <!-- Create bin distribution -->
+ <copy
+ overwrite="true"
+ todir="${distribution.bin.dir}">
+ <fileset dir="${tuscanySDO.install.dir}"/>
+ </copy>
+ <copy
+ overwrite="true"
+ todir="${distribution.dir}/bin/antscripts">
+ <fileset dir="antscripts" excludes="OpenPGP.jar"/>
+ </copy>
+
+ <ant target="distribution" antfile="${samples.dir}/build.xml"/>
+
+ <copy
+ overwrite="true"
+ todir="${distribution.src.dir}">
+ <fileset dir="${distribution.bin.dir}/" includes="samples/" excludes="**/bin/"/>
+ </copy>
+
+ <delete includeemptydirs="true">
+ <fileset dir="${distribution.dir}" includes="**/VSExpress"/>
+ </delete>
+
+ </target>
+
+ <target name="build.samples">
+ <ant target="all" antfile="${samples.dir}/build.xml" inheritAll="false"/>
+ </target>
+
+ <target name="clean.samples">
+ <ant target="clean" antfile="${samples.dir}/build.xml" inheritAll="false"/>
+ </target>
+
+<target name="clean.distribution">
+ <delete dir="${distribution.dir}/" quiet="true"/>
+ </target>
+
+</project>
diff --git a/sdo-cpp/trunk/builddist.bat b/sdo-cpp/trunk/builddist.bat
new file mode 100644
index 0000000000..8da6a53057
--- /dev/null
+++ b/sdo-cpp/trunk/builddist.bat
@@ -0,0 +1,146 @@
+@echo off
+
+@REM Licensed to the Apache Software Foundation (ASF) under one
+@REM or more contributor license agreements. See the NOTICE file
+@REM distributed with this work for additional information
+@REM regarding copyright ownership. The ASF licenses this file
+@REM to you under the Apache License, Version 2.0 (the
+@REM "License"); you may not use this file except in compliance
+@REM with the License. You may obtain a copy of the License at
+@REM
+@REM http://www.apache.org/licenses/LICENSE-2.0
+@REM
+@REM Unless required by applicable law or agreed to in writing,
+@REM software distributed under the License is distributed on an
+@REM "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+@REM KIND, either express or implied. See the License for the
+@REM specific language governing permissions and limitations
+@REM under the License.
+
+
+setlocal
+if "%LIBXML2_HOME%" == "" (
+echo "LIBXML2_HOME not set"
+goto end
+)
+echo using LIBXML2: %LIBXML2_HOME%
+
+if "%ICONV_HOME%" == "" (
+echo "ICONV_HOME not set"
+goto end
+)
+echo using ICONV: %ICONV_HOME%"
+
+if "%AXIS2C_HOME%" == "" (
+echo "AXIS2C_HOME not set"
+goto end
+)
+
+echo using AXIS2C: %AXIS2C_HOME%
+
+call vcvars32
+
+echo Build of SDO started....
+set PACKAGE=tuscany_sdo_cpp
+set VERSION=1.0-incubator-M3
+set SRC_PACKAGE=%PACKAGE%-%VERSION%-src
+set BIN_PACKAGE=%PACKAGE%-%VERSION%-bin
+
+cd ..
+set FROM_DIR=%cd%\sdo
+set TO_SRC=%cd%
+set TO_BIN=%cd%
+
+echo Copying SDO source... %TO_SRC%\%SRC_PACKAGE%
+
+if not exist %TO_SRC% mkdir %TO_SRC%
+rmdir /S /Q %TO_SRC%\%SRC_PACKAGE%
+if not exist %TO_SRC%\%SRC_PACKAGE% mkdir %TO_SRC%\%SRC_PACKAGE%
+if not exist %TO_SRC%\%SRC_PACKAGE%\VSExpress mkdir %TO_SRC%\%SRC_PACKAGE%\VSExpress
+if not exist %TO_SRC%\%SRC_PACKAGE%\runtime mkdir %TO_SRC%\%SRC_PACKAGE%\runtime
+if not exist %TO_SRC%\%SRC_PACKAGE%\deploy mkdir %TO_SRC%\%SRC_PACKAGE%\deploy
+if not exist %TO_SRC%\%SRC_PACKAGE%\doc mkdir %TO_SRC%\%SRC_PACKAGE%\doc
+
+xcopy /t /e %FROM_DIR%\deploy %TO_SRC%\%SRC_PACKAGE%\deploy
+xcopy/s %FROM_DIR%\runtime %TO_SRC%\%SRC_PACKAGE%\runtime
+xcopy/s %FROM_DIR%\VSExpress %TO_SRC%\%SRC_PACKAGE%\VSExpress
+xcopy/s %FROM_DIR%\doc %TO_SRC%\%SRC_PACKAGE%\doc
+
+copy %FROM_DIR%\INSTALL %TO_SRC%\%SRC_PACKAGE%
+copy %FROM_DIR%\LICENSE %TO_SRC%\%SRC_PACKAGE%
+copy %FROM_DIR%\COPYING %TO_SRC%\%SRC_PACKAGE%
+copy %FROM_DIR%\NOTICE %TO_SRC%\%SRC_PACKAGE%
+copy %FROM_DIR%\README %TO_SRC%\%SRC_PACKAGE%
+copy %FROM_DIR%\GettingStarted.html %TO_SRC%\%SRC_PACKAGE%
+copy %FROM_DIR%\build.bat %TO_SRC%\%SRC_PACKAGE%
+copy %FROM_DIR%\sdotest.bat %TO_SRC%\%SRC_PACKAGE%
+
+
+if not exist %TO_SRC%\%SRC_PACKAGE%\samples mkdir %TO_SRC%\%SRC_PACKAGE%\samples
+if not exist %TO_SRC%\%SRC_PACKAGE%\samples\misc mkdir %TO_SRC%\%SRC_PACKAGE%\samples\misc
+copy %FROM_DIR%\samples\build.bat %TO_SRC%\%SRC_PACKAGE%\samples
+copy %FROM_DIR%\samples\INSTALL %TO_SRC%\%SRC_PACKAGE%\samples
+copy %FROM_DIR%\samples\LICENSE %TO_SRC%\%SRC_PACKAGE%\samples
+copy %FROM_DIR%\samples\COPYING %TO_SRC%\%SRC_PACKAGE%\samples
+copy %FROM_DIR%\samples\NOTICE %TO_SRC%\%SRC_PACKAGE%\samples
+copy %FROM_DIR%\samples\README %TO_SRC%\%SRC_PACKAGE%\samples
+copy %FROM_DIR%\samples\GettingStarted.html %TO_SRC%\%SRC_PACKAGE%\samples
+
+xcopy /s /e %FROM_DIR%\samples\misc %TO_SRC%\%SRC_PACKAGE%\samples\misc
+
+cd %TO_SRC%\%SRC_PACKAGE%
+del /S Makefile.am
+
+echo Building SDO....
+
+cd %FROM_DIR%
+call build
+
+echo Installing SDO....
+
+if not exist %TO_BIN% mkdir %TO_BIN%
+rmdir /S /Q %TO_BIN%\%BIN_PACKAGE%
+if not exist %TO_BIN%\%BIN_PACKAGE% mkdir %TO_BIN%\%BIN_PACKAGE%
+if not exist %TO_BIN%\%BIN_PACKAGE%\doc mkdir %TO_BIN%\%BIN_PACKAGE%\doc
+
+xcopy/s %FROM_DIR%\deploy %TO_BIN%\%BIN_PACKAGE%
+xcopy/s %FROM_DIR%\doc %TO_BIN%\%BIN_PACKAGE%\doc
+copy %FROM_DIR%\INSTALL %TO_BIN%\%BIN_PACKAGE%
+copy %FROM_DIR%\LICENSE %TO_BIN%\%BIN_PACKAGE%
+copy %FROM_DIR%\COPYING %TO_BIN%\%BIN_PACKAGE%
+copy %FROM_DIR%\NOTICE %TO_BIN%\%BIN_PACKAGE%
+copy %FROM_DIR%\README %TO_BIN%\%BIN_PACKAGE%
+copy %FROM_DIR%\GettingStarted.html %TO_BIN%\%BIN_PACKAGE%
+
+
+echo Building samples
+
+set TUSCANY_SDOCPP=%FROM_DIR%\deploy
+cd %FROM_DIR%\samples\misc
+
+call build
+
+if not exist %TO_BIN%\%BIN_PACKAGE%\samples mkdir %TO_BIN%\%BIN_PACKAGE%\samples
+if not exist %TO_BIN%\%BIN_PACKAGE%\samples\misc mkdir %TO_BIN%\%BIN_PACKAGE%\samples\misc
+
+xcopy/s /Y %FROM_DIR%\samples\misc %TO_BIN%\%BIN_PACKAGE%\samples\misc
+xcopy/s %FROM_DIR%\deploy\samples\misc %TO_BIN%\%BIN_PACKAGE%\samples\misc
+
+copy %FROM_DIR%\samples\INSTALL %TO_BIN%\%BIN_PACKAGE%\samples
+copy %FROM_DIR%\samples\LICENSE %TO_BIN%\%BIN_PACKAGE%\samples
+copy %FROM_DIR%\samples\COPYING %TO_BIN%\%BIN_PACKAGE%\samples
+copy %FROM_DIR%\samples\NOTICE %TO_BIN%\%BIN_PACKAGE%\samples
+copy %FROM_DIR%\samples\README %TO_BIN%\%BIN_PACKAGE%\samples
+copy %FROM_DIR%\samples\GettingStarted.html %TO_BIN%\%BIN_PACKAGE%\samples
+
+cd %TO_BIN%\%BIN_PACKAGE%
+del /S Makefile.am
+
+echo Creating zip file: %TO_SRC%\%SRC_PACKAGE%.zip
+jar -cMf %TO_SRC%\%SRC_PACKAGE%.zip -C %TO_SRC% %SRC_PACKAGE%
+echo Creating zip file: %TO_BIN%\%BIN_PACKAGE%.zip
+jar -cMf %TO_BIN%\%BIN_PACKAGE%.zip -C %TO_BIN% %BIN_PACKAGE%
+
+:end
+echo SDO Build complete.
+endlocal
diff --git a/sdo-cpp/trunk/builddist.sh b/sdo-cpp/trunk/builddist.sh
new file mode 100755
index 0000000000..7bf6b761c7
--- /dev/null
+++ b/sdo-cpp/trunk/builddist.sh
@@ -0,0 +1,22 @@
+#!/bin/sh
+
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements. See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership. The ASF licenses this file
+# to you 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.
+
+./configure.sh
+make bindist
+
diff --git a/sdo-cpp/trunk/configure.ac b/sdo-cpp/trunk/configure.ac
new file mode 100644
index 0000000000..2755395a05
--- /dev/null
+++ b/sdo-cpp/trunk/configure.ac
@@ -0,0 +1,112 @@
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements. See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership. The ASF licenses this file
+# to you 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.
+
+dnl run autogen.sh to generate the configure script.
+
+AC_PREREQ(2.59)
+AC_INIT(tuscany-sdo, 1.0-M3)
+AC_CANONICAL_SYSTEM
+AM_CONFIG_HEADER(config.h)
+AM_INIT_AUTOMAKE([tar-ustar])
+AC_PREFIX_DEFAULT(/usr/local/tuscany/sdo)
+
+# Checks for programs.
+AC_PROG_CXX
+AC_PROG_CC
+AC_PROG_CPP
+AC_PROG_INSTALL
+AC_PROG_LN_S
+AC_PROG_MAKE_SET
+AC_PROG_LIBTOOL
+
+# Check for running on Darwin
+AC_MSG_CHECKING([Checking if running on Darwin])
+UNAME=`uname -s`
+if test "x$UNAME" = "xDarwin"; then
+ AC_DEFINE([IS_DARWIN], [1], [Set to 1 when running on Darwin - Mac OSX])
+ AC_MSG_RESULT(yes)
+ AC_SUBST([libsuffix],[".dylib"])
+ is_darwin=true
+else
+ AC_MSG_RESULT(no)
+ AC_SUBST([libsuffix],[".so"])
+ is_darwin=false
+fi
+AM_CONDITIONAL([DARWIN], [test x$is_darmin = xtrue])
+
+# Checks for libraries.
+
+# Checks for header files.
+AC_HEADER_STDC
+AC_CHECK_HEADERS([inttypes.h stdlib.h string.h sys/time.h wchar.h])
+
+# Checks for typedefs, structures, and compiler characteristics.
+AC_HEADER_STDBOOL
+AC_C_CONST
+AC_STRUCT_TM
+
+# Checks for library functions.
+AC_FUNC_ERROR_AT_LINE
+AC_FUNC_VPRINTF
+AC_CHECK_FUNCS([strchr strrchr])
+
+# Configure TUSCANY_SDOCPP
+TUSCANY_SDOCPP=`echo "$TUSCANY_SDOCPP"`
+if test "x$TUSCANY_SDOCPP" = "x"; then
+ SDOPWD=`pwd`
+ AC_SUBST([TUSCANY_SDOCPP], ["$SDOPWD"])
+fi
+
+# Configure LIBXML2_INCLUDE and LIBXML2_LIB
+LIBXML2_INCLUDE=`echo "$LIBXML2_INCLUDE"`
+if test "x$LIBXML2_INCLUDE" = "x"; then
+ AC_SUBST([LIBXML2_INCLUDE], ["/usr/include/libxml2"])
+fi
+
+LIBXML2_LIB=`echo "$LIBXML2_LIB"`
+if test "x$LIBXML2_LIB" = "x"; then
+ AC_SUBST([LIBXML2_LIB], ["/usr/lib"])
+fi
+
+AC_MSG_CHECKING(whether to build SDO Axiom utility)
+AC_ARG_WITH(axis2c, [AS_HELP_STRING([--with-axis2c],[build SDO Axiom utility [default=no]])],
+[ case "${withval}" in
+ yes)
+ AC_MSG_RESULT(yes)
+ with_axis2c=true
+ ;;
+ *)
+ AC_MSG_RESULT(no)
+ with_axis2c=false
+ ;;
+ esac ],
+[ AC_MSG_RESULT(no)
+ with_axis2c=false ]
+)
+AM_CONDITIONAL([WITH_AXIS2C], [test x$with_axis2c = xtrue])
+
+AC_CONFIG_FILES([Makefile
+ runtime/Makefile
+ runtime/core/Makefile
+ runtime/core/src/Makefile
+ runtime/core/src/commonj/Makefile
+ runtime/core/src/commonj/sdo/Makefile
+ runtime/core/test/Makefile
+ runtime/core/sdo_axiom/Makefile
+ runtime/core/sdo_axiom_test/Makefile])
+AC_OUTPUT
+
diff --git a/sdo-cpp/trunk/configure.sh b/sdo-cpp/trunk/configure.sh
new file mode 100755
index 0000000000..01d21cf4b6
--- /dev/null
+++ b/sdo-cpp/trunk/configure.sh
@@ -0,0 +1,47 @@
+#!/bin/sh
+
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements. See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership. The ASF licenses this file
+# to you 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.
+
+
+if [ x$LIBXML2_INCLUDE = x ]; then
+export LIBXML2_INCLUDE=/usr/include/libxml2
+fi
+if [ x$LIBXML2_LIB = x ]; then
+export LIBXML2_LIB=/usr/lib
+fi
+
+if [ x$AXIS2C_HOME = x ]; then
+echo "AXIS2C_HOME not set. not building SDO Axiom utility"
+
+else
+echo "Using Axis2C installed at $AXIS2C_HOME"
+WITH_AXIS2C=--with-axis2c
+fi
+
+TUSCANY_SDOCPP_HOME=`pwd`
+if [ x$TUSCANY_SDOCPP = x ]; then
+ export TUSCANY_SDOCPP=`pwd`/deploy
+fi
+./autogen.sh
+./configure --prefix=${TUSCANY_SDOCPP} ${WITH_AXIS2C} --enable-static=no
+
+cd ${TUSCANY_SDOCPP_HOME}/samples
+./autogen.sh
+./configure --prefix=${TUSCANY_SDOCPP} ${WITH_AXIS2C} --enable-static=no
+
+cd $TUSCANY_SDOCPP_HOME
diff --git a/sdo-cpp/trunk/doc/BuildingSTDCXX.html b/sdo-cpp/trunk/doc/BuildingSTDCXX.html
new file mode 100644
index 0000000000..6ffc018157
--- /dev/null
+++ b/sdo-cpp/trunk/doc/BuildingSTDCXX.html
@@ -0,0 +1,145 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
+<!--
+ Licensed to the Apache Software Foundation (ASF) under one
+ or more contributor license agreements. See the NOTICE file
+ distributed with this work for additional information
+ regarding copyright ownership. The ASF licenses this file
+ to you 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.
+-->
+
+<HTML>
+<HEAD>
+ <META CONTENT="text/html; charset=iso-8859-1" HTTP-EQUIV="Content-Type">
+ <META CONTENT="text/css" HTTP-EQUIV="Content-Style-Type">
+ <STYLE MEDIA="all" TYPE="text/css">
+@import url("css/maven-base.css");
+@import url("css/maven-theme.css");
+ </STYLE>
+
+ <LINK HREF="css/maven-theme.css" MEDIA="print" REL="stylesheet"
+ TYPE="text/css">
+ <TITLE>Tuscany SDO C++ - Building STDCXX for Tuscany SDO</TITLE>
+</HEAD>
+
+<BODY>
+<DIV ID="bodyColumn">
+ <DIV ID="contentBox">
+ <DIV CLASS="section">
+ <H1>Tuscany SDO C++ - Building STDCXX for Tuscany SDO</H1>
+
+ <P>STDCXX is an implementation of the C++ Standard Library provided by Apache.
+ </P>
+ <P>The website is at <A href="http://incubator.apache.org/stdcxx/">http://incubator.apache.org/stdcxx/</A>.
+ </P>
+ <P>At the time of writing, the current release is 4.1.3 and is available as
+ source distribution only. This document explains how to build stdcxx for
+ Windows XP and Red Hat Enterprise Linux 3 in the way required by the SDO build
+ process.
+ </P>
+ </DIV>
+ <DIV CLASS="section">
+ <H2>Contents</H2>
+ <OL>
+ <LI><A HREF="#install">Building STDCXX..</A>
+ <UL>
+ <LI><A HREF="#linux">..on Linux</A></LI>
+ <LI><A HREF="#win">..on Windows</A></LI>
+ </UL></LI>
+ </OL>
+ </DIV>
+
+ <DIV CLASS="section">
+ <A NAME="install"><H2>Building STDCXX</H2></A>
+ <A NAME="linux"><H3>Building STDCXX on Linux</H3></A>
+
+ <OL>
+ <LI>The release is distributed as a gzipped tar file, called
+ stdcxx-incubating-4.1.3.tar.gz. Extract the contents of this file into a
+ convenient directory. For this example, let's assume it is
+ /home/Tuscany/stdcxx-4.1.3
+ </LI>
+ <LI>Define the STDCXX_HOME environment variable to refer to this directory. The
+ Tuscany SDO build system uses this environment variable to locate stdcxx.
+ </LI>
+ <LI>Change directory to STDCXX_HOME. Then build a debug version of the stdcxx
+ library using the following command:
+ <PRE>gmake BUILDDIR=$STDCXX_HOME/Debug BUILDTYPE=15d CONFIG=gcc.config</PRE>
+ This will create a sub-directory of STDCXX_HOME called Debug and place the
+ build products below that.
+ </LI>
+ <LI>For a release version the command is:
+ <PRE>gmake BUILDDIR=$STDCXX_HOME/Release BUILDTYPE=12d CONFIG=gcc.config</PRE>
+ </LI>
+ </OL>
+ <P>This provides Tuscany SDO with the versions of stdcxx that it needs for both
+ Release and Debug builds.
+ </P>
+ <A NAME="win"><H3>Building STDCXX on Windows</H3></A>
+ <P>STDCXX is supported only when used with Microsoft Visual Studio C++ V7.1
+ </P>
+ <OL>
+ <LI>The release is distributed as a gzipped tar file, called stdcxx-incubating-4.1.3.tar.gz.
+ Extract the contents of this file into a convenient directory. For this example let's
+ assume it is C:\Tuscany\stdcxx-4.1.3
+ </LI>
+ <LI>Define the STDCXX_HOME environment variable to refer to this directory. The
+ Tuscany SDO build system uses this environment variable to locate stdcxx.
+ </LI>
+ <LI>Create two directories to contain the results of building stdcxx. The first is
+ for the debug enabled version and must be:
+ <PRE>&lt;STDCXX_HOME&gt;\Debug</PRE>
+ </LI>
+ <LI>The second is for the release (ie optimised) version and must be
+ <PRE>&lt;STDCXX_HOME&gt;\Release</PRE>
+ </LI>
+ <LI>Launch an MSVC++ 7.1 command window. In the command window, set the default
+ directory to &lt;STDCXX_HOME&gt; where there is a file called generate.bat. Create
+ the project definitions that MSVC++ 7.1 will need in order to build stdcxx by
+ running generate.bat using the following command:
+ <PRE>.\generate.bat /BUILDDIR:&lt;STDCXX_HOME&gt;\Debug /CONFIG:VC71</PRE>
+ It is necessary to provide the full, absolute path to the build directory - it
+ is not sufficient to provide a relative path. (This restriction will be fixed
+ in a future release.)
+ </LI>
+ <LI>Repeat this operation for the release build, via the command:
+ <PRE>.\generate.bat /BUILDDIR:&lt;STDCXX_HOME&gt;\Release /CONFIG:VC71</PRE>
+ </LI>
+ <LI>Still using the MSVC++ 7.1 command window, set the default directory to one of
+ the two build directories eg
+ <PRE>cd &lt;STDCXX_HOME&gt;\Debug</PRE>
+ </LI>
+ <LI>Then launch the developer studio via
+ <PRE>cd &lt;STDCXX_HOME&gt;\Debug</PRE>
+ </LI>
+ <LI>Select the configuration to build. For the Debug version of SDO this will be
+ "15d Debug Thread-safe Dll". Then select "Build Solution". The build will take
+ a while to complete and runs a test suite when it is finished. The test suite
+ is extensive and produces a scattering of errors, however the library build
+ itself is fine.
+ </LI>
+ <LI>Repeat this process for the release version, setting the default directory to
+ <PRE>cd &lt;STDCXX_HOME&gt;\Release</PRE>
+ and choosing "12d Optimized Thread-safe Dll" as the build configuration.
+ </LI>
+ </OL>
+ <P>This provides Tuscany SDO with the versions of stdcxx that it needs for both
+ Release and Debug builds.
+ </P>
+ </DIV>
+ </DIV>
+</DIV>
+</BODY>
+
+</HTML>
+
diff --git a/sdo-cpp/trunk/doc/CommittersGuide.txt b/sdo-cpp/trunk/doc/CommittersGuide.txt
new file mode 100644
index 0000000000..fb22cbf06d
--- /dev/null
+++ b/sdo-cpp/trunk/doc/CommittersGuide.txt
@@ -0,0 +1,89 @@
+
+Licensed to the Apache Software Foundation (ASF) under one
+or more contributor license agreements. See the NOTICE file
+distributed with this work for additional information
+regarding copyright ownership. The ASF licenses this file
+to you 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.
+
+
+
+Tuscany SDO Committers Guide
+============================
+
+All classes should be in the commonj/sdo namespace.
+
+The Tuscany SDO codebase consists of a number of abstract classes representing the SDO API. These
+are accompanied by a set of classes whose names end in Impl, which are the implementations of the
+API. For example the DataObject API is represented by the DataObject class, and implemented by
+the DataObjectImpl class.
+
+When pointers to classes are handed out by the library, they are really pointing at instances of
+the Impl class, but the application must not make that assumption.
+
+DataObjects and DataFactories inherit from a base class which maintains a reference count on
+itself (RefCountingObject). The pointers handed out are really classes holding a pointer to
+the object, such that they can contribute to the reference count when copied. These RefCountingPointers
+must not be deleted, they dispose of the underlying object when the reference count drops to
+zero.
+
+There is trace commented out of RefCountingObject, which can count and report the references. It is
+particularly useful to check that all instances are cleared at the end of a program run.
+
+The API for metadata consists of the DataFactory, Property and Type classes. All Properties and Types
+handed out to the client are const, so setting up the modifying the types is done using APIS of the
+data factory.
+
+The process of creating types is usually done by loading them from XSD, but can also be performed
+by using the data factory. Properties and Types may both be defined, but the data factory 'locks'
+itself as soon as the first DataObject is created. It does this because at that point it needs to
+resolve the type hierarchy, and perform validation. For consistency a Type may not be modified once
+an instance has been created.
+
+A data object contains properties, which are of a particular Type, however the API allows access to
+all properties using any of the methods. getString() may be called on a Boolean property etc. The
+conversion is attempted by the Type class, and either throws an exception or passes back a converted
+value according to the tables in the specification.
+
+The get/set APIs of DataObject are supplied by a set of macros in DataObjectImpl.cpp. These are
+duplicated for string and non-string, and also make it hard to debug effectively. They will be
+removed and replaced by methods in the future. For now, the easiest way to debug them is to be
+aware that each eventually calls the private no-params method, so for example all the getString(...)
+methods eventually call getString().
+
+The internal string handling is partially working with the SDOXMLString class, and partially still uses
+allocated char* buffers, these will be replaced by SDOXMLStrings in the future.
+
+The parsers for XML are absed on the SAX2Parser class, but the bulk of the processing is done by the
+startElementNS and similar methods in the SDOSchemaSAX2parser and SDOSAX2Parser classes. These are called
+back by the libxml2 library, and build a picture of the information which it then decoded by the XSDhelper
+or XMLHelper class into metadata or data.
+
+There are easy targets for improvements of performance, particularly in DataObject and parsing of XSD
+input, here is a list of a few that I can think of:
+
+DataObject frequently maps from Property to index, and this could be re-organized to avoid most of these.
+
+The allocation of space for property values could in most cases be dropped - its usually s fixed size
+element.
+
+The use of DataObject as a means of storing lists of primitives is not optimal, and should be replaced.
+
+The ChangeSummary class holds the previous value of any property when it is changed. At present, for many-
+valued properties, it holds the entire list as it was before an addition. This could just keep a record of
+the changes, and only save the old list when serializing.
+
+Parsing the XSD loops though types checking that all substitutes are covered, it would be good to
+replace this.
+
+ \ No newline at end of file
diff --git a/sdo-cpp/trunk/doc/DesignNotes.htm b/sdo-cpp/trunk/doc/DesignNotes.htm
new file mode 100644
index 0000000000..f6d532a4cd
--- /dev/null
+++ b/sdo-cpp/trunk/doc/DesignNotes.htm
@@ -0,0 +1,259 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
+<!--
+ Licensed to the Apache Software Foundation (ASF) under one
+ or more contributor license agreements. See the NOTICE file
+ distributed with this work for additional information
+ regarding copyright ownership. The ASF licenses this file
+ to you 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.
+-->
+<html><head>
+
+
+<meta http-equiv="Content-Type" content="text/html;charset=utf-8">
+ <META CONTENT="text/css" HTTP-EQUIV="Content-Style-Type">
+ <STYLE MEDIA="all" TYPE="text/css">
+@import url("css/maven-base.css");
+@import url("css/maven-theme.css");
+ </STYLE>
+
+ <LINK HREF="css/maven-theme.css" MEDIA="print" REL="stylesheet"
+ TYPE="text/css">
+
+ <meta name="robots" content="noindex,nofollow">
+ <title>Tuscany SDO for C++ Design Notes</title>
+
+</head>
+<body dir="ltr" lang="en">
+<div id="page" dir="ltr" lang="en"><!-- start page -->
+
+<h1 id="title">Tuscany SDO for C++ Design Notes</h1>
+<div id="content" dir="ltr" lang="en">
+<a id="top"></a>
+<p>See the 'live' verson of these notes at <a HREF="http://wiki.apache.org/ws/Tuscany/TuscanyCpp/DesignNotes">http://wiki.apache.org/ws/Tuscany/TuscanyCpp/DesignNotes</A>
+<h2 id="head-780571e8917285d0f0c1ebae03ade69ebb3fe51a">1. Logging</h2>
+
+<p>Logging is not mentioned in the V2.01 specification, however, a
+rudimentary logging capability is provided in the current
+implementation, using three classes. </p>
+<ul>
+<li><p> LogWriter </p>
+<ul>
+<li style="list-style-type: none;"><p>This defines an abstract class with a single <strong>log</strong> method. </p>
+</li>
+</ul>
+</li>
+<li class="gap"><p> DefaultLogWriter </p>
+<ul>
+<li style="list-style-type: none;"><p>Instantiates <strong>LogWriter</strong> implementng a <strong>log</strong> method that writes to <strong>cout</strong> </p>
+</li>
+</ul>
+</li>
+<li class="gap"><p> Logger </p>
+<ul>
+<li style="list-style-type: none;"><p>A class with a static pointer to a <strong>Logwriter</strong> object. When the class is loaded the pointer is initialized to a reference to an instance of <strong>DefaultLogWriter</strong>. <strong>Logger</strong> provides its own <strong>log</strong> and <strong>logArgs</strong> methods that use the <strong>log</strong> method of <strong>DefaultLogWriter</strong> </p>
+</li>
+</ul>
+</li>
+</ul>
+<p>In the current implementation, logging is seldom used. </p>
+
+<h2 id="head-7290fb54a6fb6ba18c63fd8a5cd6790051a515fc">2. Conversion from C style strings to C++ style strings</h2>
+
+
+<h2 id="head-507cb2b48b05cbdfcdb3d687945efc737433c25f">3. Debugging the XML parser</h2>
+
+<p>SDO uses the SAX parser provided by libxml2 (<a rel="nofollow" href="http://xmlsoft.org/index.html"><img src="DesignNotes_files/moin-www.png" alt="[WWW]" height="11" width="11"> http://xmlsoft.org/index.html</a>)
+to parse XML documents (and therefore XSD documents also). The SAX
+parser uses a callback mechanism to report XML events to its caller.
+These callback routines are supplied to the parser using a struct of
+type xmlSAXHandler, called SDOSAX2Handler that is defined in
+SAX2Parser.cpp. However, since libxml2 is written in C and operates
+with no knowledge of objects or classes, it is necessary to bridge the
+gap between libxml2's C-style call back mechanism and the objects that
+comprise SDO. This is done as follows. </p>
+<p>The file SAX2Parser.cpp defines (C style) functions for all the
+callback routines required by libxml2. Looking through that file, it is
+clear that many of those functions, such as sdo_internalSubset(), are
+empty, meaning that SDO will simply ignore that particular event if it
+is reported by libxml2. Where a callback function is not empty, the
+active contents usually take the form of a call such as </p>
+<p>(SAX2Parser*) ctx)-&gt;startDocument() </p>
+<p>This call is forwarding the event reported by libxml2 to a method within a parser object created by SDO. </p>
+<p>To understand this, we have to step back a little. A client of
+libxml2 initiates the parse of an XML instance by calling the
+xmlSAXUserParseFile() function. This function takes three parameters.
+The first is the struct containing the list of callback functions (ie
+SDOSAX2Handler) and the third is the name of the XML file to parse. The
+second parameter is of type <strong>void*</strong> and is not used by
+libxml2 directly. However, it is passed to every callback functon that
+libxml2 calls as part of this parse to supply them with whatever
+context information it represents. In Tuscany SDO that context is in
+fact a pointer to an object that implements the appropriate parsing of
+the file and these objects are instances of one of two classes, both of
+which are derived from a common base. The base class is SAX2Parser, and
+that defines virtual methods to handle events returned by libxml2. (In
+fact it defines methods for that subset of the events that SDO will
+use.) The two concrete classes are SDOSAX2Parser and
+SDOSchemaSAX2Parser. The former is used when parsing XML instance
+documents and the latter when parsing XML Schema Definitions. Both
+classes re-implement the methods that process SAX events to handle them
+in the appropriate way for either XML or XSD. </p>
+<p>Therefore, the overall process for parsing an XML or XSD input
+document and generating the corresponding data object or meta data
+structures in SDO as follows. </p>
+<p>1. Create an instance of SDOSAX2Parser for parsing XML instance
+documents or an instance of SDOSchemaSAX2Parser for parsing an XSD
+document. </p>
+<p>2. Pass the address of the SAX2Parser object just created to libxml2
+as the context parameter of the xmlSAXUserParseFile() function. </p>
+<p>3. As the parse unfolds, libxml2 will use the SDOSAX2Handler struct
+to call the callback function that is appropriate for each event that
+it is reporting. These will be C functions in SAX2Parser.cpp </p>
+<p>4. Many of those functions will simply return having done nothing
+because SDO has no interest in that particular event. However, when a
+SAX event is of interest, the C callback function will use the context
+parameter that libxml2 has supplied to it (ie the address of a
+SAX2Parser object) to call the method on that object that corresponds
+to the current SAX event. </p>
+<p>Simple. </p>
+<p>To watch the parsing of a file as it unfolds there are three broad
+options. If the file is an XSD then place breakpoints on the methods of
+SDOSchemaSAX2Parser. If it is an XML instance then set breakpoints on
+the methods of SDOSAX2Parser. If it could be either, then place
+breakpoints on the C functions that are named in SDOSAX2Handler and
+that are found in SAX2Parser.cpp </p>
+
+<h2 id="head-c0ac7aae89a380ef5b343dc5ebc99b721000ad93">4. Modifying the SDO Build to use the Apache stdcxx Standard C++ library</h2>
+
+<p>stdcxx is an implementation of the C++ Standard Library provided by Apache. The website is at <a rel="nofollow" href="http://incubator.apache.org/stdcxx/"><img src="DesignNotes_files/moin-www.png" alt="[WWW]" height="11" width="11"> http://incubator.apache.org/stdcxx/</a>. </p>
+<p>To build SDO using stdcxx rather than the native C++ library on
+Windows, the following modifications to the Microsoft Visual Studio
+.NET 2003 build environment are necessary. We assume that a source
+extract of stdcxx is already available in a directory called
+C:\Tuscany\stdcxx-4.1.3 (based on the version number of the current
+release at the time of writing). We also assume that debug and release
+versions of this library have been built in directories called
+C:\Tuscany\stdcxx-4.1.3\Debug and C:\Tuscany\stdcxx-4.1.3\Release. The
+process for building these is described here <a href="http://wiki.apache.org/ws-data/attachments/Tuscany%282f%29TuscanyCpp%282f%29DesignNotes/attachments/HowToBuildStdcxxForTuscanySDO.txt">HowToBuildStdcxxForTuscanySDO.txt</a> </p>
+<p>1. Define an environment variable, STDCXX_HOME to identify the root of the source extract tree ie C:\Tuscany\stdcxx-4.1.3 </p>
+<p>This is not strictly necessary but is convenient given how often we will refer to that location. </p>
+<p>2. Add the stdcxx include directories to the appropriate search path. These directories are </p>
+<ul>
+<li style="list-style-type: none;"><p>$(STDCXX_HOME)\include </p>
+<p>$(STDCXX_HOME)\include\ansi </p>
+<p>and either </p>
+<p>$(STDCXX_HOME)\Debug\include\15d - for a debug build </p>
+<p>or </p>
+<p>$(STDCXX_HOME)\Release\include\12d - for a release build </p>
+</li>
+</ul>
+<p>For MSVC 7.1 these should be appended to the list found in
+Configuration Properties -&gt; C/C++ -&gt; General -&gt; Additional
+Include Directories </p>
+<p>3. Add environment variable definitions. These variables are </p>
+<ul>
+<li style="list-style-type: none;"><p>_RWSTD_USE_CONFIG </p>
+<p>_RWSHARED </p>
+<p>and _RWSTDDEBUG for a debug build </p>
+</li>
+</ul>
+<p>4. Add the stdcxx library directory to the appropriate search path. This directory is </p>
+<ul>
+<li style="list-style-type: none;"><p>$(STDCXX_HOME)\Debug\lib - for a debug build </p>
+<p>and </p>
+<p>$(STDCXX_HOME)\Release\lib - for a release build </p>
+</li>
+</ul>
+<p>For MSVC 7.1 these should be appended to the list found in
+Configuration Properties -&gt; Linker -&gt; General -&gt; Additional
+Library Directories </p>
+<p>5. Add the stdcxx library name as a dependency. The library name is </p>
+<ul>
+<li style="list-style-type: none;"><p>stdlib15d.lib - for a debug build </p>
+<p>and </p>
+<p>stdlib12d.lib - for a release build </p>
+</li>
+</ul>
+<p>For MSVC 7.1 these should be appended to the list found in
+Configuration Properties -&gt; Linker -&gt; Input -&gt; Additional
+Dependencies </p>
+
+<h2 id="head-feededf8be9c9caa8efe879e11523875c15f44ce">5. Discriminated Types</h2>
+
+<p>Prior to the changes introduced in revision 502599, in response to
+JIRA TUSCANY-546, the C++ implementation made extensive use of C style
+macros, particularly in DataObjectImpl.cpp. This code had been
+motivated by the requirement for SDO to process a variety of different
+data types (integer, float, string etc) in very similar ways.
+Unfortunately, while macro code makes it easy to clone behaviour by
+instantiating the macro for different datatypes, it has several
+disdavantages. By far the most serious is the impossibility of
+debugging code that has been generated by the macro preprocessor,
+closely followed by the fact that most non-trivial macros are difficult
+to read and understand. These twin problems lead onto the common result
+that macro generated code is often inefficient. </p>
+<p>TUSCANY-546 remedies these problems by introducing a new class,
+SDOValue, defined in SDOValue.cpp and SDOValue.h. This class consists
+fundamentally of a union of all the possible data types that SDO must
+accommmodate, together with an enumerated type that identifies which
+particular data type is stored in the current object. The union and
+enumeration are themselves defined in DataTypeInfo.cpp and
+DataTypeInfo.h. </p>
+<p>Not surprisingly, SDOValue provides constructors to initialise an
+SDOValue object from any of the primitive data types. There are also
+retrieval methods that will extract a primitive value from an SDOValue,
+converting as necessary (and throwing an exception for those
+conversions that are impossible). For the most part these methods are
+straightforward. The only slight complications arise when dealing with
+primitives that are strings of characters. There are three such data
+types - </p>
+<p>String: This is a null terminated sequence of single byte
+characters. It corresponds to the C notion of a string, and the C++
+std::string class. </p>
+<p>WideString: This is a null terminated sequence of double byte
+characters. In C++ this might be represented by the std::wstring class,
+although in this implementation it is represented in the C fashion,
+using a pointer to a null terminated sequence of wchar_t elements. </p>
+<p>ByteArray: A sequence of bytes that is not terminated by a null character. An associated length value is therefore required. </p>
+<p>SDOValue objects represent such values with pointers to other
+objects or allocations of memory, therefore, copy operators and
+destructors must allow for the need to copy or delete the items that
+are at the far end of these pointers. </p>
+<p>From then on, the general strategy is straightforward. All methods
+that are part of the SDO external interface must be preserved. However,
+as far as possible, other methods that used to be replicated (by macro
+expansion) for each different datatype, are replaced by a single method
+that works with SDOValue objects. Where it is necessary to work with
+the actual primitive data type explicitly, this is normally done via a
+switch statement. The external methods that were previously generated
+by macro expansion are replaced by explicit code that is little more
+than a veneer that converts between the SDOValue that is used
+internally and the primitive data type that is required by the public
+interface. Numerous examples of this appear in DataObjectImpl.cpp, the
+getBoolean and setBoolean methods being typical. </p>
+<p>Code to convert between the various primitive data types is already
+available in the TypeImpl class. However, this is not ideal since a) as
+coded it is dependent on the TypeImpl class, even though that isn't
+strictly necessary and therefore b) it tends to bloat the already large
+TypeImpl class. The SDOValue code provides it's own conversion methods
+in the SDODataConverter class. The intention is to migrate all
+conversions in SDO to the methods in that class, however, that
+transition is not yet complete. </p>
+<a id="bottom"></a>
+
+</div>
+<p id="pageinfo" class="info" dir="ltr" lang="en">last edited 28.02.2007 13:24:53 by <span title="blueice2n1.uk.ibm.com">GeoffWinn</span></p>
+</div> <!-- end page -->
+
+</body></html> \ No newline at end of file
diff --git a/sdo-cpp/trunk/doc/css/maven-base.css b/sdo-cpp/trunk/doc/css/maven-base.css
new file mode 100644
index 0000000000..e23caf04e5
--- /dev/null
+++ b/sdo-cpp/trunk/doc/css/maven-base.css
@@ -0,0 +1,168 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you 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$ */
+
+body {
+ margin: 0px;
+ padding: 0px;
+}
+img {
+ border:none;
+}
+table {
+ padding:0px;
+ width: 100%;
+ margin-left: -2px;
+ margin-right: -2px;
+}
+acronym {
+ cursor: help;
+ border-bottom: 1px dotted #feb;
+}
+table.bodyTable th, table.bodyTable td {
+ padding: 2px 4px 2px 4px;
+ vertical-align: top;
+}
+div.clear{
+ clear:both;
+ visibility: hidden;
+}
+div.clear hr{
+ display: none;
+}
+#bannerLeft, #bannerRight {
+ font-size: xx-large;
+ font-weight: bold;
+}
+#bannerLeft img, #bannerRight img {
+ margin: 0px;
+}
+.xleft, #bannerLeft img {
+ float:left;
+ text-shadow: #7CFC00;
+}
+.xright, #bannerRight img {
+ float:right;
+ text-shadow: #7CFC00;
+}
+#banner {
+ padding: 0px;
+}
+#banner img {
+ border: none;
+}
+#breadcrumbs {
+ padding: 3px 10px 3px 10px;
+}
+#leftColumn {
+ width: 150px;
+ float:left;
+}
+#bodyColumn {
+ margin-right: 1.5em;
+ margin-left: 30px;
+}
+#legend {
+ padding: 8px 0 8px 0;
+}
+#navcolumn {
+ padding: 8px 4px 0 8px;
+}
+#navcolumn h5 {
+ margin: 0;
+ padding: 0;
+ font-size: small;
+}
+#navcolumn ul {
+ margin: 0;
+ padding: 0;
+ font-size: small;
+}
+#navcolumn li {
+ list-style-type: none;
+ background-image: none;
+ background-repeat: no-repeat;
+ background-position: 0 0.4em;
+ padding-left: 16px;
+ list-style-position: ouside;
+ line-height: 1.2em;
+ font-size: smaller;
+}
+#navcolumn li.expanded {
+ background-image: url(../images/expanded.gif);
+}
+#navcolumn li.collapsed {
+ background-image: url(../images/collapsed.gif);
+}
+#poweredBy {
+ text-align: center;
+}
+#navcolumn img {
+ margin-top: 10px;
+ margin-bottom: 3px;
+}
+#poweredBy img {
+ display:block;
+ margin: 20px 0 20px 17px;
+ border: 1px solid black;
+ width: 90px;
+ height: 30px;
+}
+#search img {
+ margin: 0px;
+ display: block;
+}
+#search #q, #search #btnG {
+ border: 1px solid #999;
+ margin-bottom:10px;
+}
+#search form {
+ margin: 0px;
+}
+#lastPublished {
+ font-size: x-small;
+}
+.navSection {
+ margin-bottom: 2px;
+ padding: 8px;
+}
+.navSectionHead {
+ font-weight: bold;
+ font-size: x-small;
+}
+.section {
+ padding: 4px;
+}
+#footer {
+ padding: 3px 10px 3px 10px;
+ font-size: x-small;
+}
+#breadcrumbs {
+ font-size: x-small;
+ margin: 0pt;
+}
+.source {
+ padding: 12px;
+ margin: 1em 7px 1em 7px;
+}
+.source pre {
+ margin: 0px;
+ padding: 0px;
+}
diff --git a/sdo-cpp/trunk/doc/css/maven-theme.css b/sdo-cpp/trunk/doc/css/maven-theme.css
new file mode 100644
index 0000000000..91cf29cda2
--- /dev/null
+++ b/sdo-cpp/trunk/doc/css/maven-theme.css
@@ -0,0 +1,173 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you 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$ */
+
+body {
+ padding: 0px 0px 10px 0px;
+}
+body, td, select, input, li{
+ font-family: Verdana, Helvetica, Arial, sans-serif;
+ #font-size: 13px;
+ padding: 4px 4px 4px 4px;
+ line-height: 1.5em;
+ font-size: small;
+}
+code{
+ font-family: Courier, monospace;
+ font-size: 13px;
+}
+a {
+ text-decoration: none;
+}
+a:link {
+ color:#36a;
+}
+a:visited {
+ color:#47a;
+}
+a:active, a:hover {
+ color:#69c;
+}
+#legend li.externalLink {
+ background: url(../images/external.png) left top no-repeat;
+ padding-left: 18px;
+}
+a.externalLink, a.externalLink:link, a.externalLink:visited, a.externalLink:active, a.externalLink:hover {
+ background: url(../images/external.png) right center no-repeat;
+ padding-right: 18px;
+}
+#legend li.newWindow {
+ background: url(../images/newwindow.png) left top no-repeat;
+ padding-left: 18px;
+}
+a.newWindow, a.newWindow:link, a.newWindow:visited, a.newWindow:active, a.newWindow:hover {
+ background: url(../images/newwindow.png) right center no-repeat;
+ padding-right: 18px;
+}
+h1 {
+ font-size: x-large;
+ line-height: 1em;
+}
+
+
+h2 {
+ padding: 4px 4px 4px 6px;
+ border: 1px solid #999;
+ color: #900;
+ background-color: #ddd;
+
+ font-size: large;
+}
+h3 {
+ padding: 4px 4px 4px 6px;
+ border: 1px solid #aaa;
+ color: #900;
+ background-color: #eee;
+ font-weight: normal;
+ font-size: large;
+}
+h4 {
+ padding: 4px 4px 4px 6px;
+ border: 1px solid #bbb;
+ color: #900;
+ background-color: #fff;
+ font-weight: normal;
+ font-size: large;
+}
+h5 {
+ padding: 4px 4px 4px 6px;
+ color: #900;
+ font-size: normal;
+}
+p {
+ line-height: 1.5em;
+ font-size: small;
+}
+#breadcrumbs {
+ border-top: 1px solid #aaa;
+ border-bottom: 1px solid #aaa;
+ background-color: #ccc;
+}
+#leftColumn {
+ margin: 10px 0 0 5px;
+ border: 1px solid #999;
+ background-color: #eee;
+}
+#navcolumn h5 {
+ font-size: smaller;
+ border-bottom: 1px solid #aaaaaa;
+ padding-top: 2px;
+ color: #000;
+}
+
+table.bodyTable th {
+ color: white;
+ background-color: #bbb;
+ text-align: left;
+ font-weight: bold;
+}
+
+table.bodyTable th, table.bodyTable td {
+ font-size: small;
+}
+
+table.bodyTable tr.a {
+ background-color: #ddd;
+}
+
+table.bodyTable tr.b {
+ background-color: #eee;
+}
+
+.source {
+ border: 1px solid #999;
+}
+dl {
+ padding: 4px 4px 4px 6px;
+ border: 1px solid #aaa;
+ background-color: #ffc;
+}
+dt {
+ color: #900;
+}
+#organizationLogo img, #projectLogo img, #projectLogo span{
+ margin: 8px;
+}
+#banner {
+ border-bottom: 1px solid #fff;
+}
+.sourcecode {
+ border: 1px solid #999;
+ font-family: Courier, monospace;
+ font-size: 13px;
+ white-space: pre;
+ padding: 4px 4px 4px 6px;
+ margin: 4px 4px 4px 6px;
+}
+pre {
+ border: 1px solid #999;
+ font-family: Courier, monospace;
+ font-size: 13px;
+ white-space: pre;
+ padding: 4px 4px 4px 6px;
+ margin: 4px 4px 4px 6px;
+}
+
+
diff --git a/sdo-cpp/trunk/makebindist.sh b/sdo-cpp/trunk/makebindist.sh
new file mode 100755
index 0000000000..e2cbd7cddf
--- /dev/null
+++ b/sdo-cpp/trunk/makebindist.sh
@@ -0,0 +1,34 @@
+#!/bin/sh
+
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements. See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership. The ASF licenses this file
+# to you 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.
+
+TUSCANY_SDOCPP_HOME=`pwd`
+
+./configure.sh
+
+make install
+
+cd ${TUSCANY_SDOCPP_HOME}/samples
+make install
+
+cd ${TUSCANY_SDOCPP_HOME}/deploy
+for i in `find . -name "*.la"`
+do
+ rm $i
+done
+
diff --git a/sdo-cpp/trunk/runtime/Makefile.am b/sdo-cpp/trunk/runtime/Makefile.am
new file mode 100644
index 0000000000..edc02bb540
--- /dev/null
+++ b/sdo-cpp/trunk/runtime/Makefile.am
@@ -0,0 +1,18 @@
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements. See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership. The ASF licenses this file
+# to you 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.
+
+SUBDIRS = core
diff --git a/sdo-cpp/trunk/runtime/core/Makefile.am b/sdo-cpp/trunk/runtime/core/Makefile.am
new file mode 100644
index 0000000000..4c20ebe8c6
--- /dev/null
+++ b/sdo-cpp/trunk/runtime/core/Makefile.am
@@ -0,0 +1,22 @@
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements. See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership. The ASF licenses this file
+# to you 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.
+
+if WITH_AXIS2C
+ AXIOM_UTILS = sdo_axiom sdo_axiom_test
+endif
+
+SUBDIRS = src test ${AXIOM_UTILS}
diff --git a/sdo-cpp/trunk/runtime/core/build.xml b/sdo-cpp/trunk/runtime/core/build.xml
new file mode 100644
index 0000000000..9dc3dc5244
--- /dev/null
+++ b/sdo-cpp/trunk/runtime/core/build.xml
@@ -0,0 +1,187 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ Licensed to the Apache Software Foundation (ASF) under one
+ or more contributor license agreements. See the NOTICE file
+ distributed with this work for additional information
+ regarding copyright ownership. The ASF licenses this file
+ to you 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.
+-->
+<project name="TuscanySdoNative_core" default="all" basedir="../..">
+
+ <import file="${basedir}/antscripts/system.xml"/>
+ <import file="${basedir}/antscripts/compile-targets.xml"/>
+
+ <!--
+ Notice that the basedir for this project is set to the TuscanySDO root dir
+ This makes path setting in system.xml much simpler, but we'll just have to
+ set a property here to this directory.
+ -->
+ <property name="this.dir" location="${basedir}/runtime/core"/>
+ <property name="sdo.base.dir" value="commonj/sdo"/>
+
+ <property name="sdo.dir" location="${this.dir}/src/${sdo.base.dir}"/>
+ <property name="sdo_axiom.dir" location="${this.dir}/sdo_axiom"/>
+ <property name="sdo.lib.dir" location="${sdo.dir}/.libs"/>
+ <property name="sdo_axiom.lib.dir" location="${sdo_axiom.dir}/.libs"/>
+
+ <property name="tuscany.sdo.lib" value="tuscany_sdo"/>
+ <property name="tuscany.sdo_axiom.lib" value="tuscany_sdo_axiom"/>
+
+
+ <!--
+ Public targets
+ -->
+ <target name="all" description="compile, link, and install all TuscanySdoNative source code">
+ <antcall target="build.sdo"/>
+ <antcall target="install.sdo"/>
+ <antcall target="build.sdo_axiom"/>
+ <antcall target="install.sdo_axiom"/>
+ </target>
+
+ <target name="build" description="compile and link all TuscanySdoNative source code">
+ <antcall target="build.sdo"/>
+ <antcall target="install.sdo"/>
+ <antcall target="build.sdo_axiom"/>
+ </target>
+
+ <target name="install" description="Install TuscanySdoNative libraries and headers">
+ <antcall target="install.sdo"/>
+ <antcall target="install.sdo_axiom"/>
+ </target>
+
+ <target name="clean" description="Clean all TuscanySdoNative core compiled source code">
+ <antcall target="clean.sdo"/>
+ <antcall target="clean.sdo_axiom"/>
+ <antcall target="clean.test"/>
+ </target>
+
+ <target name="test" description="Build and Run TuscanySdoNative sdo and sdo_axiom tests">
+ <antcall target="test.sdo"/>
+ <antcall target="test.sdo_axiom"/>
+ </target>
+
+ <!--
+ Internal targets
+ They can still be called, they're just not described, so wont show up in "ant -p"
+ -->
+
+ <!-- build -->
+
+ <target name="build.sdo" depends="check.libxml2" if="enable_libxml2">
+ <cpp-build
+ srcdir="${sdo.dir}"
+ outdir="${sdo.lib.dir}"
+ outfile="${tuscany.sdo.lib}">
+ <custom-build-elements>
+ <defineset if="windows" define="SDO_EXPORTS"/>
+ <includepath path="${tuscanySDO.root.src.dir}/core/src"/>
+ <includepath path="${libxml2.include.dir}"/>
+ <includepath if="windows" path="${iconv.home.dir}/include"/>
+ <libset if="windows" dir="${libxml2.lib.dir}" libs="libxml2"/>
+ <libset unless="windows" dir="${libxml2.lib.dir}" libs="xml2"/>
+ </custom-build-elements>
+ </cpp-build>
+ </target>
+
+ <target name="build.sdo_axiom" depends="check.libxml2,check.ws" if="enable_ws">
+ <cpp-build
+ srcdir="${sdo_axiom.dir}"
+ outdir="${sdo_axiom.lib.dir}"
+ outfile="${tuscany.sdo_axiom.lib}">
+ <custom-build-elements>
+ <defineset if="windows" define="SDO_AXIOM_EXPORTS"/>
+ <includepath path="${sdo.impl.include.path}"/>
+ <includepath path="${axis2c.home.dir}/include"/>
+ <libset dir="${sdo.impl.library.path}" libs="${sdo.impl.library.name}"/>
+ <libset dir="${axis2c.home.dir}/lib" libs="axis2_util"/>
+ <libset dir="${axis2c.home.dir}/lib" libs="axis2_axiom"/>
+ <libset dir="${axis2c.home.dir}/lib" libs="axis2_parser"/>
+ <libset if="windows" dir="${axis2c.home.dir}/lib" libs="axiom"/>
+ <libset unless="windows" dir="${axis2c.home.dir}/lib" libs="axis2_axiom"/>
+ </custom-build-elements>
+ </cpp-build>
+ </target>
+
+ <!-- install -->
+
+ <target name="install.sdo" depends="check.libxml2" if="enable_libxml2">
+ <cpp-install-lib
+ lib="${tuscany.sdo.lib}"
+ srcdir="${sdo.lib.dir}"
+ destrootdir="${tuscanySDO.install.dir}"/>
+ <cpp-symlink
+ linkdir="${tuscanySDO.install.dir}/lib"
+ link="${lib.prefix}${tuscany.sdo.lib}${lib.ext}"
+ resource="${lib.prefix}${tuscany.sdo.lib}${lib.ext}${tuscanySDO.library.version}"/>
+ <cpp-install-files
+ srcdir="${sdo.dir}"
+ files="*.h"
+ destdir="${tuscanySDO.install.dir}/include/${sdo.base.dir}"/>
+ </target>
+
+ <target name="install.sdo_axiom" depends="check.libxml2,check.ws" if="enable_ws">
+ <cpp-install-lib
+ lib="${tuscany.sdo_axiom.lib}"
+ srcdir="${sdo_axiom.lib.dir}"
+ destrootdir="${tuscanySDO.install.dir}"/>
+ <cpp-symlink
+ linkdir="${tuscanySDO.install.dir}/lib"
+ link="${lib.prefix}${tuscany.sdo_axiom.lib}${lib.ext}"
+ resource="${lib.prefix}${tuscany.sdo_axiom.lib}${lib.ext}${tuscanySDO.library.version}"/>
+ <cpp-install-files
+ srcdir="${sdo_axiom.dir}"
+ files="*.h"
+ destdir="${tuscanySDO.install.dir}/include"/>
+ </target>
+
+ <!-- clean -->
+
+ <target name="clean.sdo">
+ <cpp-clean-files
+ dir="${tuscanySDO.install.dir}/include/${sdo.base.dir}"
+ rmdir="true"/>
+ <cpp-clean-lib
+ lib="${tuscany.sdo.lib}"
+ librootdir="${tuscanySDO.install.dir}"/>
+ <cpp-clean-files
+ dir="${sdo.lib.dir}"
+ rmdir="true"/>
+ </target>
+
+ <target name="clean.sdo_axiom">
+ <cpp-clean-files dir="${tuscanySDO.install.dir}/include"/>
+ <cpp-clean-lib
+ lib="${tuscany.sdo_axiom.lib}"
+ librootdir="${tuscanySDO.install.dir}"/>
+ <cpp-clean-files
+ dir="${sdo_axiom.lib.dir}"
+ rmdir="true"/>
+ </target>
+
+ <target name="clean.test">
+ <ant target="clean" antfile="${this.dir}/test/build.xml" inheritAll="false"/>
+ <ant target="clean" antfile="${this.dir}/sdo_axiom_test/build.xml" inheritAll="false"/>
+ </target>
+
+ <!-- Test -->
+
+ <target name="test.sdo">
+ <ant target="all" antfile="${this.dir}/test/build.xml" inheritAll="false"/>
+ </target>
+
+ <target name="test.sdo_axiom">
+ <ant target="all" antfile="${this.dir}/sdo_axiom_test/build.xml" inheritAll="false"/>
+ </target>
+
+</project>
diff --git a/sdo-cpp/trunk/runtime/core/interop/interop.cpp b/sdo-cpp/trunk/runtime/core/interop/interop.cpp
new file mode 100644
index 0000000000..7e4c480e26
--- /dev/null
+++ b/sdo-cpp/trunk/runtime/core/interop/interop.cpp
@@ -0,0 +1,198 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you 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$ */
+
+
+#include "interop.h"
+
+using namespace std;
+
+/*
+ * Ensure that SDO can read an XML file and
+ * write it back out again without changing the XML. The
+ * test XML files can be found in tuscany/interop/src/main/resources
+ */
+void Interop::test1ReadAndWriteXML(char *commonDir, char *filename)
+{
+ int i,j;
+
+ cout << " \nC++ interop test1 - read and write XML: " << filename << endl;
+ try
+ {
+ DataFactoryPtr mdg = DataFactory::getDataFactory();
+
+ /**
+ * Get an XSD helper to load XSD information into the
+ * data factory
+ */
+ XSDHelperPtr myXSDHelper = HelperProvider::getXSDHelper(mdg);
+ char fullxsdfilename[200];
+ strcpy (fullxsdfilename, commonDir );
+ strcat (fullxsdfilename, filename );
+ strcat (fullxsdfilename,".xsd");
+ cout << "Read the XSD file " << fullxsdfilename << endl;
+ myXSDHelper->defineFile(fullxsdfilename);
+
+ /**
+ * Check if there were any errors. The parse may still
+ * succeed, but errors indicate some elements were not
+ * understood
+ */
+ if ((i = myXSDHelper->getErrorCount()) > 0)
+ {
+ cout << "XSD Loading reported some errors:" << endl;
+ for (j=0;j<i;j++)
+ {
+ const char *m = myXSDHelper->getErrorMessage(j);
+ if (m != 0) cout << m;
+ cout << endl;
+ }
+ }
+
+ /**
+ * Use the same data factory to load XML corresponding to
+ * data objects adhering to the previously loaded schema
+ */
+ XMLHelperPtr myXMLHelper = HelperProvider::getXMLHelper(mdg);
+ char fullxmlfilename[200];
+ strcpy (fullxmlfilename, commonDir );
+ strcat (fullxmlfilename, filename );
+ strcat(fullxmlfilename,"-in.xml");
+ cout << "Read the XML file " << fullxmlfilename << endl;
+ XMLDocumentPtr myXMLDocument = myXMLHelper->loadFile(fullxmlfilename, "http://www.apache.org/tuscany/interop");
+
+ /**
+ * Check if there were any errors. The parse may still
+ * succeed, but errors indicate some elements did not match
+ * the schema, or were malformed.
+ *
+ */
+ if ((i = myXMLHelper->getErrorCount()) > 0)
+ {
+ cout << "XML Loading reported some errors:" << endl;
+ for (j=0;j<i;j++)
+ {
+ const char *m = myXMLHelper->getErrorMessage(j);
+ if (m != 0) cout << m;
+ cout << endl;
+ }
+ }
+
+ DataObjectPtr newdob = myXMLDocument->getRootDataObject();
+ cout << "Get current state of DataObject\n";
+ DataObjectPtr dc = newdob->getContainer();
+
+ if ( !dc )
+ {
+ cout << "There is no container" << endl;
+ }
+ else
+ {
+ cout <<" Container of type " << dc->getType().getName();
+ }
+
+ PropertyList pl = newdob->getInstanceProperties();
+/*
+ // Print out the top level elements of the document
+ for ( int i=0; i < pl.size(); i++ )
+ {
+ const Property& p = pl[i];
+ if ( newdob->isSet(p))
+ {
+ if ( p.getType().isDataType() )
+ {
+ cout << "isDataType = TRUE \n";
+ cout << p.getName() << "=" << newdob->getCString(i) << endl;
+ }
+ else
+ {
+ cout << "isDataType = FALSE \n";
+ if ( p.isMany )
+ {
+ cout << "isMany = TRUE \n";
+ DataObjectList& dol= newdob->getList (i);
+
+ for ( int i=0; i < dol.size(); i++ )
+ {
+ cout << p.getName() << "[" << i << "] " << "=" << dol[i] << endl;
+ }
+ }
+ else
+ {
+ cout << "isMany = FALSE \n";
+ cout << p.getName() << "=" << newdob->getDataObject(i) << endl;
+ }
+ }
+ }
+ }
+*/
+ // write the XML element back out to a file
+ char outxmlfilename[200];
+ strcpy (outxmlfilename, filename );
+ strcat (outxmlfilename, "-cpp-out.xml" );
+ cout << "Write the XML file " << outxmlfilename << endl;
+ myXMLHelper->save(myXMLDocument, outxmlfilename);
+
+ }
+ catch (SDORuntimeException e)
+ {
+ cout << "Exception in interop test" << endl;
+ cout << e.getMessageText();
+ cout << e;
+ }
+}
+
+/*
+ * Ensure that SDO can read an XSD file and
+ * write it back out again without changing the XSD. The
+ * test XML files can be found in tuscany/interop/src/main/resources
+ */
+void Interop::test4ReadAndWriteXSD(char *commonDir, char *filename)
+{
+ /**
+ * Get an XSD helper to load XSD information into the
+ * data factory
+ */
+
+ DataFactoryPtr mdg = DataFactory::getDataFactory();
+ XSDHelperPtr myXSDHelper = HelperProvider::getXSDHelper(mdg);
+
+ char fullxsdfilename[200];
+ strcpy (fullxsdfilename, commonDir );
+ strcat (fullxsdfilename, filename );
+ strcat (fullxsdfilename,".xsd");
+ cout << "Read the XSD file " << fullxsdfilename << endl;
+ const char * URIOfRootType = myXSDHelper->defineFile(fullxsdfilename);
+
+ cout << "URI of root type" << URIOfRootType << endl;
+
+ /**
+ * Now write the XSD back again
+ */
+ DataFactoryPtr df = myXSDHelper->getDataFactory();
+ TypeList typeList = df->getTypes();
+
+ char outxsdfilename[200];
+ strcpy (outxsdfilename, filename );
+ strcat(outxsdfilename,"-cpp-out.xsd");
+ cout << "Write an XSD back out " << outxsdfilename << endl;
+ myXSDHelper->generateFile(typeList, outxsdfilename);
+
+}
diff --git a/sdo-cpp/trunk/runtime/core/interop/interop.h b/sdo-cpp/trunk/runtime/core/interop/interop.h
new file mode 100644
index 0000000000..deebc64082
--- /dev/null
+++ b/sdo-cpp/trunk/runtime/core/interop/interop.h
@@ -0,0 +1,32 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you 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$ */
+
+#include "commonj/sdo/SDO.h"
+
+
+using namespace commonj::sdo;
+
+class Interop
+{
+ public:
+ static void test1ReadAndWriteXML(char *, char *);
+ static void test4ReadAndWriteXSD(char *, char *);
+};
diff --git a/sdo-cpp/trunk/runtime/core/interop/main.cpp b/sdo-cpp/trunk/runtime/core/interop/main.cpp
new file mode 100644
index 0000000000..b22ffe3d6c
--- /dev/null
+++ b/sdo-cpp/trunk/runtime/core/interop/main.cpp
@@ -0,0 +1,88 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you 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$ */
+
+#include "interop.h"
+
+using namespace std;
+/*
+ * The interop tests exercised here do not actually interoperate with other
+ * SDO implementations but simply check that and data that is read
+ * in and written out remains unchanged
+ */
+int main (int argc, char** argv)
+{
+ char *commonDir = "..\\..\\..\\..\\..\\interop\\src\\main\\resources\\";
+
+ cout << "SOME TESTS COMMENTED OUT - CHECK SOURCE \n";
+
+ Interop::test1ReadAndWriteXML(commonDir, "interop01");
+ Interop::test1ReadAndWriteXML(commonDir, "interop02");
+ Interop::test1ReadAndWriteXML(commonDir, "interop03");
+ //Interop::test1ReadAndWriteXML(commonDir, "interop04");
+ Interop::test1ReadAndWriteXML(commonDir, "interop05");
+ Interop::test1ReadAndWriteXML(commonDir, "interop06");
+ Interop::test1ReadAndWriteXML(commonDir, "interop07");
+ Interop::test1ReadAndWriteXML(commonDir, "interop08");
+ Interop::test1ReadAndWriteXML(commonDir, "interop09");
+ Interop::test1ReadAndWriteXML(commonDir, "interop10");
+ Interop::test1ReadAndWriteXML(commonDir, "interop11");
+ Interop::test1ReadAndWriteXML(commonDir, "interop12");
+ //Interop::test1ReadAndWriteXML(commonDir, "interop13");
+ Interop::test1ReadAndWriteXML(commonDir, "interop14");
+ Interop::test1ReadAndWriteXML(commonDir, "interop15");
+ Interop::test1ReadAndWriteXML(commonDir, "interop16");
+ Interop::test1ReadAndWriteXML(commonDir, "interop17");
+ Interop::test1ReadAndWriteXML(commonDir, "interop18");
+ Interop::test1ReadAndWriteXML(commonDir, "interop19");
+ Interop::test1ReadAndWriteXML(commonDir, "interop20");
+ Interop::test1ReadAndWriteXML(commonDir, "interop21");
+ Interop::test1ReadAndWriteXML(commonDir, "interop22");
+ Interop::test1ReadAndWriteXML(commonDir, "interop23");
+ Interop::test1ReadAndWriteXML(commonDir, "interop24");
+ Interop::test1ReadAndWriteXML(commonDir, "interop25");
+ Interop::test1ReadAndWriteXML(commonDir, "interop26");
+ Interop::test1ReadAndWriteXML(commonDir, "interop27");
+ Interop::test1ReadAndWriteXML(commonDir, "interop28");
+ Interop::test1ReadAndWriteXML(commonDir, "interop29");
+ Interop::test1ReadAndWriteXML(commonDir, "interop30");
+ Interop::test1ReadAndWriteXML(commonDir, "interop31");
+ Interop::test1ReadAndWriteXML(commonDir, "interop32");
+ Interop::test1ReadAndWriteXML(commonDir, "interop33");
+ Interop::test1ReadAndWriteXML(commonDir, "interop34");
+ Interop::test1ReadAndWriteXML(commonDir, "interop35");
+ Interop::test1ReadAndWriteXML(commonDir, "interop36");
+ Interop::test1ReadAndWriteXML(commonDir, "interop37");
+ Interop::test1ReadAndWriteXML(commonDir, "interop38");
+ Interop::test1ReadAndWriteXML(commonDir, "interop39");
+ Interop::test1ReadAndWriteXML(commonDir, "interop40");
+ Interop::test1ReadAndWriteXML(commonDir, "interop41");
+ Interop::test1ReadAndWriteXML(commonDir, "interop42");
+ Interop::test1ReadAndWriteXML(commonDir, "interop43");
+ Interop::test1ReadAndWriteXML(commonDir, "interop44");
+ Interop::test1ReadAndWriteXML(commonDir, "interop45");
+ Interop::test1ReadAndWriteXML(commonDir, "interop46");
+ Interop::test1ReadAndWriteXML(commonDir, "interop47");
+ Interop::test1ReadAndWriteXML(commonDir, "interop50");
+
+ Interop::test4ReadAndWriteXSD(commonDir, "interop01");
+
+ return 0;
+}
diff --git a/sdo-cpp/trunk/runtime/core/interop/runinterop.bat b/sdo-cpp/trunk/runtime/core/interop/runinterop.bat
new file mode 100644
index 0000000000..270687dbfd
--- /dev/null
+++ b/sdo-cpp/trunk/runtime/core/interop/runinterop.bat
@@ -0,0 +1,25 @@
+@echo off
+
+@REM Licensed to the Apache Software Foundation (ASF) under one
+@REM or more contributor license agreements. See the NOTICE file
+@REM distributed with this work for additional information
+@REM regarding copyright ownership. The ASF licenses this file
+@REM to you under the Apache License, Version 2.0 (the
+@REM "License"); you may not use this file except in compliance
+@REM with the License. You may obtain a copy of the License at
+@REM
+@REM http://www.apache.org/licenses/LICENSE-2.0
+@REM
+@REM Unless required by applicable law or agreed to in writing,
+@REM software distributed under the License is distributed on an
+@REM "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+@REM KIND, either express or implied. See the License for the
+@REM specific language governing permissions and limitations
+@REM under the License.
+set SDO_BASE=..\..\..
+
+set PATH=%LIBXML2_HOME%\bin;%ICONV_HOME%\bin;%ZLIB_HOME%\bin;%SDO_BASE%\deploy\bin
+
+Debug\sdo_interop.exe
+
+
diff --git a/sdo-cpp/trunk/runtime/core/sdo_axiom/Makefile.am b/sdo-cpp/trunk/runtime/core/sdo_axiom/Makefile.am
new file mode 100644
index 0000000000..ff6371212a
--- /dev/null
+++ b/sdo-cpp/trunk/runtime/core/sdo_axiom/Makefile.am
@@ -0,0 +1,38 @@
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements. See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership. The ASF licenses this file
+# to you 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.
+
+SUBDIRS =
+
+nobase_include_HEADERS = sdo_axiom.h \
+sdo_axiom_export.h
+
+lib_LTLIBRARIES = libtuscany_sdo_axiom.la
+
+libtuscany_sdo_axiom_la_SOURCES = \
+ sdo_axiom.cpp
+
+libtuscany_sdo_axiom_la_LIBADD = \
+ -L$(top_builddir)/runtime/core/src/commonj/sdo -ltuscany_sdo \
+ -L$(AXIS2C_HOME)/lib \
+ -laxis2_util \
+ -laxis2_axiom \
+ -laxis2_parser
+
+INCLUDES = -I$(top_builddir)/runtime/core/src \
+ -I$(top_builddir)/runtime/core/sdo_axiom \
+ -I${AXIS2C_HOME}/include
+
diff --git a/sdo-cpp/trunk/runtime/core/sdo_axiom/deploy.bat b/sdo-cpp/trunk/runtime/core/sdo_axiom/deploy.bat
new file mode 100644
index 0000000000..a6dd6e5c46
--- /dev/null
+++ b/sdo-cpp/trunk/runtime/core/sdo_axiom/deploy.bat
@@ -0,0 +1,54 @@
+@echo off
+
+@REM Licensed to the Apache Software Foundation (ASF) under one
+@REM or more contributor license agreements. See the NOTICE file
+@REM distributed with this work for additional information
+@REM regarding copyright ownership. The ASF licenses this file
+@REM to you under the Apache License, Version 2.0 (the
+@REM "License"); you may not use this file except in compliance
+@REM with the License. You may obtain a copy of the License at
+@REM
+@REM http://www.apache.org/licenses/LICENSE-2.0
+@REM
+@REM Unless required by applicable law or agreed to in writing,
+@REM software distributed under the License is distributed on an
+@REM "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+@REM KIND, either express or implied. See the License for the
+@REM specific language governing permissions and limitations
+@REM under the License.
+
+
+setlocal
+
+if . == .%1 (
+echo sdo root not specified
+goto usage
+)
+set deploydir=%1\deploy
+set srcdir=%1\runtime\core\sdo_axiom
+
+if . == .%2 (
+echo input directory not specified
+goto usage
+)
+set inpath=%2
+echo %inpath%
+
+if not exist %deploydir% mkdir %deploydir%
+if not exist %deploydir%\bin mkdir %deploydir%\bin
+if not exist %deploydir%\lib mkdir %deploydir%\lib
+if not exist %deploydir%\include mkdir %deploydir%\include
+
+copy %srcdir%\*.h %deploydir%\include\
+
+copy %inpath%\tuscany_sdo_axiom.lib %deploydir%\lib
+copy %inpath%\tuscany_sdo_axiom.dll %deploydir%\bin
+
+if exist %inpath%\tuscany_sdo_axiom.pdb copy %inpath%\tuscany_sdo_axiom.pdb %deploydir%\bin
+
+goto end
+:usage
+echo Usage: deploy <sdo-root> <build-output>
+:end
+
+endlocal
diff --git a/sdo-cpp/trunk/runtime/core/sdo_axiom/sdo_axiom.cpp b/sdo-cpp/trunk/runtime/core/sdo_axiom/sdo_axiom.cpp
new file mode 100644
index 0000000000..874756a321
--- /dev/null
+++ b/sdo-cpp/trunk/runtime/core/sdo_axiom/sdo_axiom.cpp
@@ -0,0 +1,271 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you 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$ */
+
+#if defined(WIN32) || defined (_WINDOWS)
+#pragma warning(disable: 4786)
+#endif
+
+#include "sdo_axiom.h"
+
+using namespace commonj::sdo;
+using namespace std;
+
+
+namespace commonj
+{
+ namespace sdo_axiom
+ {
+
+ int AxiomHelper::axiswritercount = 0;
+
+ AxiomHelper* AxiomHelper::getHelper()
+ {
+ return new AxiomHelper();
+ }
+
+ void AxiomHelper::releaseHelper(AxiomHelper* h)
+ {
+ if (h) delete h;
+ }
+
+ void AxiomHelper::deleteEnv()
+ {
+ if (the_env)axis2_env_free(the_env);
+ }
+
+ void AxiomHelper::createEnv()
+ {
+ the_env = axis2_env_create_all("tuscany_sdo_axiom.log",AXIS2_LOG_LEVEL_WARNING);
+
+ if (the_env == 0) return;
+
+ return;
+ }
+
+
+ AxiomHelper::AxiomHelper()
+ {
+ createEnv();
+ }
+
+ AxiomHelper::~AxiomHelper()
+ {
+ deleteEnv();
+ }
+
+
+ axis2_env_t* AxiomHelper::getEnv()
+ {
+ return the_env;
+ }
+
+ axiom_node_t* AxiomHelper::toAxiomNode(DataObjectPtr dob,
+ const char* targetNamespaceURI, const char* elementName)
+ {
+
+ axiom_document_t* doc = toAxiomDoc(dob,
+ targetNamespaceURI, elementName);
+
+ if (!doc)
+ {
+ return 0;
+ }
+
+ axiom_node_t* root_node =
+ AXIOM_DOCUMENT_GET_ROOT_ELEMENT(doc, the_env);
+ if (!root_node)
+ {
+ cout << "No Root Element in the document" << endl;
+ return 0;
+ }
+
+
+ return root_node;
+ }
+
+ axiom_document_t* AxiomHelper::toAxiomDoc(DataObjectPtr dob,
+ const char* targetNamespaceURI, const char* elementName)
+ {
+
+ DataFactoryPtr df = dob->getDataFactory();
+ XSDHelperPtr xs = HelperProvider::getXSDHelper(df);
+ XMLHelperPtr xm = HelperProvider::getXMLHelper(df);
+ if (!the_env)
+ {
+ cout << "No Axis Environment" << endl;
+ return 0;
+ }
+
+ XMLDocumentPtr doc = xm->createDocument(
+ dob,
+ targetNamespaceURI,
+ elementName);
+
+ char * str = xm->save(doc);
+
+ //if (str) {
+ // cout << "toAxiomDoc " << str << endl;
+ //}
+
+ axiom_xml_reader_t * reader =
+ axiom_xml_reader_create_for_memory(the_env,
+ (void*)str,
+ strlen(str),
+ (const axis2_char_t *)"UTF-8",
+ AXIS2_XML_PARSER_TYPE_BUFFER);
+
+ if (!reader)
+ {
+ cout << "No Axis Reader" << endl;
+ return 0;
+ }
+
+ axiom_stax_builder_t* builder =
+ axiom_stax_builder_create(the_env, reader);
+
+ if (!builder)
+ {
+ cout << "No Axis Builder" << endl;
+ AXIOM_XML_READER_FREE(reader, the_env);
+ return 0;
+ }
+
+ axiom_document_t* document =
+ AXIOM_STAX_BUILDER_GET_DOCUMENT(builder, the_env);
+
+ if (!document)
+ {
+ cout << "No Axis Document" << endl;
+ AXIOM_STAX_BUILDER_FREE(builder, the_env);
+ return 0;
+ }
+
+ axiom_node_t* root_node =
+ AXIOM_DOCUMENT_GET_ROOT_ELEMENT(document, the_env);
+ if (!root_node)
+ {
+ cout << "No Root Element in the document" << endl;
+ AXIOM_STAX_BUILDER_FREE(builder, the_env);
+ return 0;
+ }
+
+
+ AXIOM_DOCUMENT_BUILD_ALL(document, the_env);
+
+ return document;
+ }
+
+ DataObjectPtr AxiomHelper::toSdo(axiom_document_t* document,
+ DataFactoryPtr factory,
+ const char* targetNamespaceURI)
+ {
+
+ if (!the_env)
+ {
+ cout << "No Axis Environment" << endl;
+ return 0;
+ }
+
+ axiom_node_t* root_node =
+ AXIOM_DOCUMENT_GET_ROOT_ELEMENT(document, the_env);
+
+ return toSdo(root_node,factory, targetNamespaceURI);
+ }
+
+ DataObjectPtr AxiomHelper::toSdo(axiom_node_t* root_node,
+ DataFactoryPtr factory,
+ const char* targetNamespaceURI)
+ {
+
+ if (!the_env)
+ {
+ cout << "No Axis Environment" << endl;
+ return 0;
+ }
+
+ XMLHelperPtr helper = HelperProvider::getXMLHelper(factory);
+
+ axiom_xml_writer_t* writer = axiom_xml_writer_create_for_memory(
+ the_env, NULL, AXIS2_TRUE, 0,
+ AXIS2_XML_PARSER_TYPE_BUFFER);
+
+ axiom_output_t* output = axiom_output_create(the_env, writer);
+
+
+ if (!root_node)
+ {
+ cout << "No Root Element in the document" << endl;
+ AXIOM_OUTPUT_FREE(output, the_env);
+ return 0;
+ }
+
+ AXIOM_NODE_SERIALIZE(root_node, the_env, output);
+
+ axis2_char_t* buffer = (axis2_char_t*)AXIOM_XML_WRITER_GET_XML(writer, the_env);
+
+ XMLDocumentPtr theXMLDocument = helper->load(buffer, targetNamespaceURI);
+
+ if (theXMLDocument != 0)
+ {
+ return theXMLDocument->getRootDataObject();
+ }
+ cout << "The XML document returned from load was zero" << endl;
+ return 0;
+ }
+
+ void AxiomHelper::output(axiom_document_t* document)
+ {
+
+ if (!the_env)
+ {
+ cout << "No Axis Environment" << endl;
+ return;
+ }
+
+ axiom_xml_writer_t* writer = axiom_xml_writer_create_for_memory(
+ the_env, NULL, AXIS2_TRUE, 0,
+ AXIS2_XML_PARSER_TYPE_BUFFER);
+
+ axiom_output_t* output = axiom_output_create(the_env, writer);
+
+ axiom_node_t* root_node =
+ AXIOM_DOCUMENT_GET_ROOT_ELEMENT(document, the_env);
+
+ if (!root_node)
+ {
+ cout << "No Root Element in the document" << endl;
+ AXIOM_OUTPUT_FREE(output, the_env);
+ return;
+ }
+
+ AXIOM_NODE_SERIALIZE(root_node, the_env, output);
+
+ axis2_char_t* buffer = (axis2_char_t*)AXIOM_XML_WRITER_GET_XML(writer, the_env);
+
+ printf("Output XML:n %s ", buffer);
+
+ AXIOM_OUTPUT_FREE(output, the_env);
+
+ return;
+ }
+ }
+}
+
diff --git a/sdo-cpp/trunk/runtime/core/sdo_axiom/sdo_axiom.h b/sdo-cpp/trunk/runtime/core/sdo_axiom/sdo_axiom.h
new file mode 100644
index 0000000000..aedcf1935a
--- /dev/null
+++ b/sdo-cpp/trunk/runtime/core/sdo_axiom/sdo_axiom.h
@@ -0,0 +1,86 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you 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$ */
+
+#ifndef _SDO_AXIOM_H_
+#define _SDO_AXIOM_H_
+
+#include "sdo_axiom_export.h"
+
+#include "axiom.h"
+//#include "axis2_om_document.h"
+//#include "axis2_om_stax_builder.h"
+
+
+#include "commonj/sdo/SDO.h"
+
+
+
+namespace commonj
+{
+ namespace sdo_axiom
+ {
+
+/**
+ * AxiomHelper writes a data object tree to XML
+ */
+ class AxiomHelper
+ {
+
+ public:
+
+ SDO_AXIOM_API AxiomHelper();
+
+ SDO_AXIOM_API virtual ~AxiomHelper();
+
+ SDO_AXIOM_API static AxiomHelper* getHelper();
+
+ SDO_AXIOM_API static void releaseHelper(AxiomHelper* ax);
+
+ SDO_AXIOM_API axiom_document_t* toAxiomDoc(commonj::sdo::DataObjectPtr dob,
+ const char* targetNamespaceURI = "", const char* elementName = "");
+ SDO_AXIOM_API axiom_node_t* toAxiomNode(commonj::sdo::DataObjectPtr dob,
+ const char* targetNamespaceURI = "", const char* elementName = "");
+
+ SDO_AXIOM_API commonj::sdo::DataObjectPtr toSdo(axiom_document_t* doc, commonj::sdo::DataFactoryPtr factory, const char* targetNamespaceURI=0);
+ SDO_AXIOM_API commonj::sdo::DataObjectPtr toSdo(axiom_node_t* root_node, commonj::sdo::DataFactoryPtr factory, const char* targetNamespaceURI=0);
+
+ SDO_AXIOM_API axis2_env_t* getEnv();
+
+ SDO_AXIOM_API void output(axiom_document_t* document);
+
+
+ protected:
+ private:
+
+ void deleteEnv();
+
+ void createEnv();
+
+ static int axiswritercount;
+
+ axis2_env_t *the_env;
+
+ };
+ } // End - namespace sdo_axiom
+} // End - namespace commonj
+
+
+#endif //_SDO_AXIOM_H_
diff --git a/sdo-cpp/trunk/runtime/core/sdo_axiom/sdo_axiom_export.h b/sdo-cpp/trunk/runtime/core/sdo_axiom/sdo_axiom_export.h
new file mode 100644
index 0000000000..bc9c8f55ed
--- /dev/null
+++ b/sdo-cpp/trunk/runtime/core/sdo_axiom/sdo_axiom_export.h
@@ -0,0 +1,39 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you 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$ */
+
+
+#ifdef WIN32
+
+#ifdef SDO_AXIOM_EXPORTS
+# define SDO_AXIOM_API __declspec(dllexport)
+# define SDO_AXIOM_EXPIMP
+#else
+# define SDO_AXIOM_API __declspec(dllimport)
+# define SDO_AXIOM_EXPIMP extern
+#endif
+
+#else
+
+# define SDO_AXIOM_API
+# define SDO_AXIOM_EXPIMP
+
+#endif
+
diff --git a/sdo-cpp/trunk/runtime/core/sdo_axiom_test/Makefile.am b/sdo-cpp/trunk/runtime/core/sdo_axiom_test/Makefile.am
new file mode 100644
index 0000000000..636ad99c8b
--- /dev/null
+++ b/sdo-cpp/trunk/runtime/core/sdo_axiom_test/Makefile.am
@@ -0,0 +1,40 @@
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements. See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership. The ASF licenses this file
+# to you 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.
+
+noinst_PROGRAMS = tuscany_sdo_axiom_test
+SUBDIRS =
+TESTS = tuscany_sdo_axiom_test
+TESTS_ENVIRONMENT = LD_LIBRARY_PATH=${LD_LIBRARY_PATH}:${LIBXML2_LIB}:$(AXIS2C_HOME)/lib
+tuscany_sdo_axiom_test_SOURCES = sdo_axiom_test.cpp
+
+noinst_HEADERS=*.h
+
+tuscany_sdo_axiom_test_LDADD = \
+ -L$(top_builddir)/runtime/core/src/commonj/sdo -ltuscany_sdo \
+ -L$(top_builddir)/runtime/core/sdo_axiom -ltuscany_sdo_axiom \
+ -L${LIBXML2_LIB} -lxml2 \
+ -L$(AXIS2C_HOME)/lib \
+ -laxis2_util \
+ -laxis2_axiom \
+ -laxis2_parser \
+ -laxis2_minizip
+
+INCLUDES = -I$(top_builddir)/runtime/core/sdo_axiom_test \
+ -I$(top_builddir)/runtime/core/src \
+ -I$(top_builddir)/runtime/core/sdo_axiom \
+ -I${AXIS2C_HOME}/include
+
diff --git a/sdo-cpp/trunk/runtime/core/sdo_axiom_test/build.xml b/sdo-cpp/trunk/runtime/core/sdo_axiom_test/build.xml
new file mode 100644
index 0000000000..d6358492e2
--- /dev/null
+++ b/sdo-cpp/trunk/runtime/core/sdo_axiom_test/build.xml
@@ -0,0 +1,78 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ Licensed to the Apache Software Foundation (ASF) under one
+ or more contributor license agreements. See the NOTICE file
+ distributed with this work for additional information
+ regarding copyright ownership. The ASF licenses this file
+ to you 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.
+-->
+<project name="TuscanySdoNative_axiom_test" default="all" basedir="../../..">
+
+ <import file="${basedir}/antscripts/system.xml"/>
+ <import file="${basedir}/antscripts/compile-targets.xml"/>
+
+ <!--
+ Notice that the basedir for this project is set to the TuscanySDO root dir
+ This makes path setting in system.xml much simpler, but we'll just have to
+ set a property here to this directory.
+ -->
+ <property name="this.dir" location="${basedir}/runtime/core/sdo_axiom_test"/>
+ <property name="sdo_axiom.test.src.dir" location="${this.dir}"/>
+ <property name="sdo_axiom.test.build.dir" location="${this.dir}/build"/>
+ <property name="sdo_axiom.test.app" value="sdo_axiom_test"/>
+
+ <!--
+ Public targets
+ -->
+ <target name="all" description="compile, link, and run TuscanySdoNative sdo_axiom test suite">
+ <antcall target="build"/>
+ <antcall target="run"/>
+ </target>
+
+ <target name="build"
+ depends="check.ws"
+ if="enable_ws"
+ description="compile and link TuscanySdoNative sdo_axiom test suite">
+ <cpp-build
+ srcdir="${sdo_axiom.test.src.dir}"
+ infiles="*.cpp"
+ outdir="${sdo_axiom.test.build.dir}"
+ outfile="${sdo_axiom.test.app}"
+ outtype="executable">
+ <custom-build-elements>
+ <defineset if="windows" define="_MBCS"/>
+ <includepath path="${axis2c.home.dir}/include"/>
+ <includepath path="${sdo.impl.include.path}"/>
+ <includepath path="${tuscanySDO.install.dir}/include"/>
+ <libset dir="${sdo.impl.library.path}" libs="${sdo.impl.library.name}"/>
+ <libset dir="${tuscanySDO.install.dir}/lib" libs="tuscany_sdo_axiom"/>
+ <libset dir="${axis2c.home.dir}/lib" libs="axis2_util"/>
+ </custom-build-elements>
+ </cpp-build>
+
+ <cpp-install-file
+ srcfile="${sdo_axiom.test.app}${exe.ext}"
+ srcdir="${sdo_axiom.test.build.dir}"
+ destdir="${this.dir}"/>
+ </target>
+
+ <target name="run" depends="build" description="Run TuscanySdoNative sdo_axiom test suite">
+ <exec executable="${this.dir}/${sdo_axiom.test.app}${exe.ext}"/>
+ </target>
+
+ <target name="clean" description="Clean TuscanySdoNative sdo_axiom test suite">
+ <delete dir="${sdo_axiom.test.build.dir}" quiet="@{quiet}"/>
+ </target>
+
+</project>
diff --git a/sdo-cpp/trunk/runtime/core/sdo_axiom_test/sdo_axiom_test.cpp b/sdo-cpp/trunk/runtime/core/sdo_axiom_test/sdo_axiom_test.cpp
new file mode 100644
index 0000000000..ed6db4bb3c
--- /dev/null
+++ b/sdo-cpp/trunk/runtime/core/sdo_axiom_test/sdo_axiom_test.cpp
@@ -0,0 +1,136 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you 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$ */
+
+#include <stdio.h>
+
+#pragma warning(disable:4786)
+
+#include <iostream>
+
+#include "sdo_axiom_test.h"
+
+
+using namespace commonj::sdo::internal;
+
+void axiomtest::axiom_test()
+{
+
+ DataFactoryPtr mdg = DataFactory::getDataFactory();
+
+ mdg->addType("myspace","Company");
+
+ mdg->addType("myspace","Department");
+
+ mdg->addType("myspace","Employee");
+
+ mdg->addPropertyToType("myspace","Company","name",
+ "commonj.sdo","String", false, false, false);
+
+ mdg->addPropertyToType("myspace","Company","norbert",
+ "commonj.sdo","String", false, false, false);
+
+ mdg->addPropertyToType("myspace","Company","departments",
+ "myspace","Department", true, false, true);
+
+ mdg->addPropertyToType("myspace","Department","name",
+ "commonj.sdo","String", false, false, false);
+
+ mdg->addPropertyToType("myspace","Department","employees",
+ "myspace","Employee", true, false, true);
+
+ mdg->addPropertyToType("myspace","Employee","name",
+ "commonj.sdo","String", false, false, false);
+
+ const Type& tcc = mdg->getType("myspace","Company");
+
+ DataObjectPtr company = mdg->create((Type&)tcc);
+ company->setCString("name","The VDB Company Inc");
+ company->setCString("norbert","Spandex Courvette");
+
+
+ DataObjectPtr dept1 = company->createDataObject("departments");
+ dept1->setCString("name","Accounts");
+
+ DataObjectPtr dept2 = company->createDataObject("departments");
+ dept2->setCString("name","Billing");
+
+ DataObjectPtr emp1 = dept1->createDataObject("employees");
+ emp1->setCString("name","Albert");
+
+ DataObjectPtr emp2 = dept1->createDataObject("employees");
+ emp2->setCString("name","Ben");
+
+ DataObjectPtr emp3 = dept2->createDataObject("employees");
+ emp3->setCString("name","Cyril");
+
+ DataObjectPtr emp4 = dept2->createDataObject("employees");
+ emp4->setCString("name","Dominic");
+
+ AxiomHelper* ax = AxiomHelper::getHelper();
+
+ if (ax)
+ {
+ axiom_document_t* doc = ax->toAxiomDoc(company);
+
+ if (doc)
+ {
+ ax->output(doc);
+
+ DataObjectPtr newdob = ax->toSdo(doc,mdg);
+
+ if (newdob)
+ {
+ cout << "Printing first data object..." << endl;
+ SDOUtils::printDataObject(cout,newdob);
+ cout << "Finished" << endl;
+ }
+
+ axiom_node_t* node =
+ AXIOM_DOCUMENT_GET_ROOT_ELEMENT(doc, ax->getEnv());
+
+
+ DataObjectPtr newdob2 = ax->toSdo(node,mdg);
+
+ if (newdob2)
+ {
+ cout << "Printing second data object..." << endl;
+ SDOUtils::printDataObject(cout,newdob2);
+ cout << "Finished" << endl;
+ }
+
+
+ }
+
+ }
+
+ return;
+
+}
+
+extern "C"{
+
+int main (int argc, char** argv)
+{
+ axiomtest::axiom_test();
+ return 0;
+}
+
+}
diff --git a/sdo-cpp/trunk/runtime/core/sdo_axiom_test/sdo_axiom_test.h b/sdo-cpp/trunk/runtime/core/sdo_axiom_test/sdo_axiom_test.h
new file mode 100644
index 0000000000..280a94ceec
--- /dev/null
+++ b/sdo-cpp/trunk/runtime/core/sdo_axiom_test/sdo_axiom_test.h
@@ -0,0 +1,38 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you 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$ */
+
+#include "sdo_axiom.h"
+#include "commonj/sdo/SDO.h"
+
+
+using namespace commonj::sdo;
+using namespace commonj::sdo_axiom;
+using namespace std;
+
+
+
+// test
+
+class axiomtest {
+ public:
+
+ static void axiom_test();
+};
diff --git a/sdo-cpp/trunk/runtime/core/src/.cdtbuild b/sdo-cpp/trunk/runtime/core/src/.cdtbuild
new file mode 100644
index 0000000000..70abbcf6bf
--- /dev/null
+++ b/sdo-cpp/trunk/runtime/core/src/.cdtbuild
@@ -0,0 +1,62 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ Licensed to the Apache Software Foundation (ASF) under one
+ or more contributor license agreements. See the NOTICE file
+ distributed with this work for additional information
+ regarding copyright ownership. The ASF licenses this file
+ to you 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.
+-->
+
+<?fileVersion 3.0.0?>
+
+<ManagedProjectBuildInfo>
+<project id="tuscany_sdo.cdt.managedbuild.target.gnu.so.1649887895" name="Shared Library (Gnu)" projectType="cdt.managedbuild.target.gnu.so">
+<configuration artifactExtension="so" artifactName="tuscany_sdo" cleanCommand="rm -rf" description="" errorParsers="org.eclipse.cdt.core.MakeErrorParser;org.eclipse.cdt.core.GCCErrorParser;org.eclipse.cdt.core.GLDErrorParser;org.eclipse.cdt.core.GASErrorParser" id="cdt.managedbuild.config.gnu.so.debug.804736841" name="Debug" parent="cdt.managedbuild.config.gnu.so.debug">
+<toolChain id="cdt.managedbuild.toolchain.gnu.so.debug.853581152" name="GCC Tool Chain" superClass="cdt.managedbuild.toolchain.gnu.so.debug">
+<tool command="gcc" id="cdt.managedbuild.tool.gnu.c.compiler.so.debug.1430134894" name="GCC C Compiler" superClass="cdt.managedbuild.tool.gnu.c.compiler.so.debug"/>
+<tool command="g++" id="cdt.managedbuild.tool.gnu.cpp.compiler.so.debug.1021362517" name="GCC C++ Compiler" superClass="cdt.managedbuild.tool.gnu.cpp.compiler.so.debug">
+<option id="gnu.cpp.compiler.option.preprocessor.def.2069673202" superClass="gnu.cpp.compiler.option.preprocessor.def" valueType="definedSymbols">
+<listOptionValue builtIn="false" value="_DEBUG"/>
+</option>
+<option id="gnu.cpp.compiler.option.include.paths.1923756814" superClass="gnu.cpp.compiler.option.include.paths" valueType="includePath">
+<listOptionValue builtIn="false" value="${project_loc}"/>
+<listOptionValue builtIn="false" value="${LIBXML2_INCLUDE}"/>
+</option>
+<option id="gnu.cpp.compiler.option.warnings.allwarn.1941506556" superClass="gnu.cpp.compiler.option.warnings.allwarn" value="false" valueType="boolean"/>
+</tool>
+<tool command="gcc" id="cdt.managedbuild.tool.gnu.c.linker.so.debug.1367539588" name="GCC C Linker" superClass="cdt.managedbuild.tool.gnu.c.linker.so.debug"/>
+<tool command="g++" id="cdt.managedbuild.tool.gnu.cpp.linker.so.debug.2094383123" name="GCC C++ Linker" superClass="cdt.managedbuild.tool.gnu.cpp.linker.so.debug"/>
+<tool command="as" id="cdt.managedbuild.tool.gnu.assembler.so.debug.662724583" name="GCC Assembler" superClass="cdt.managedbuild.tool.gnu.assembler.so.debug"/>
+<macros/>
+</toolChain>
+</configuration>
+<configuration artifactExtension="so" artifactName="tuscany_sdo" cleanCommand="rm -rf" description="" errorParsers="org.eclipse.cdt.core.MakeErrorParser;org.eclipse.cdt.core.GCCErrorParser;org.eclipse.cdt.core.GLDErrorParser;org.eclipse.cdt.core.GASErrorParser" id="cdt.managedbuild.config.gnu.so.release.1588435275" name="Release" parent="cdt.managedbuild.config.gnu.so.release">
+<toolChain id="cdt.managedbuild.toolchain.gnu.so.release.1916451262" name="GCC Tool Chain" superClass="cdt.managedbuild.toolchain.gnu.so.release">
+<tool command="gcc" id="cdt.managedbuild.tool.gnu.c.compiler.so.release.994589200" name="GCC C Compiler" superClass="cdt.managedbuild.tool.gnu.c.compiler.so.release"/>
+<tool command="g++" id="cdt.managedbuild.tool.gnu.cpp.compiler.so.release.1429553177" name="GCC C++ Compiler" superClass="cdt.managedbuild.tool.gnu.cpp.compiler.so.release">
+<option id="gnu.cpp.compiler.option.include.paths.1557660473" superClass="gnu.cpp.compiler.option.include.paths" valueType="includePath">
+<listOptionValue builtIn="false" value="${project_loc}"/>
+<listOptionValue builtIn="false" value="/usr/include/libxml2"/>
+</option>
+<option id="gnu.cpp.compiler.option.warnings.allwarn.687619026" superClass="gnu.cpp.compiler.option.warnings.allwarn" value="false" valueType="boolean"/>
+</tool>
+<tool command="gcc" id="cdt.managedbuild.tool.gnu.c.linker.so.release.316500641" name="GCC C Linker" superClass="cdt.managedbuild.tool.gnu.c.linker.so.release"/>
+<tool command="g++" id="cdt.managedbuild.tool.gnu.cpp.linker.so.release.1432920590" name="GCC C++ Linker" superClass="cdt.managedbuild.tool.gnu.cpp.linker.so.release"/>
+<tool command="as" id="cdt.managedbuild.tool.gnu.assembler.so.release.1095309957" name="GCC Assembler" superClass="cdt.managedbuild.tool.gnu.assembler.so.release"/>
+<macros/>
+</toolChain>
+</configuration>
+<macros/>
+</project>
+</ManagedProjectBuildInfo>
diff --git a/sdo-cpp/trunk/runtime/core/src/.cdtproject b/sdo-cpp/trunk/runtime/core/src/.cdtproject
new file mode 100644
index 0000000000..f5b94e8340
--- /dev/null
+++ b/sdo-cpp/trunk/runtime/core/src/.cdtproject
@@ -0,0 +1,34 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ Licensed to the Apache Software Foundation (ASF) under one
+ or more contributor license agreements. See the NOTICE file
+ distributed with this work for additional information
+ regarding copyright ownership. The ASF licenses this file
+ to you 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.
+-->
+
+<?eclipse-cdt version="2.0"?>
+
+<cdtproject id="org.eclipse.cdt.managedbuilder.core.managedMake">
+<extension id="org.eclipse.cdt.managedbuilder.core.ManagedBuildManager" point="org.eclipse.cdt.core.ScannerInfoProvider"/>
+<extension id="org.eclipse.cdt.core.ELF" point="org.eclipse.cdt.core.BinaryParser"/>
+<extension id="org.eclipse.cdt.core.domsourceindexer" point="org.eclipse.cdt.core.CIndexer"/>
+<data>
+<item id="org.eclipse.cdt.core.pathentry">
+<pathentry kind="src" path=""/>
+<pathentry kind="out" path=""/>
+<pathentry kind="con" path="org.eclipse.cdt.managedbuilder.MANAGED_CONTAINER"/>
+</item>
+</data>
+</cdtproject>
diff --git a/sdo-cpp/trunk/runtime/core/src/.project b/sdo-cpp/trunk/runtime/core/src/.project
new file mode 100644
index 0000000000..a30112fb0c
--- /dev/null
+++ b/sdo-cpp/trunk/runtime/core/src/.project
@@ -0,0 +1,38 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ Licensed to the Apache Software Foundation (ASF) under one
+ or more contributor license agreements. See the NOTICE file
+ distributed with this work for additional information
+ regarding copyright ownership. The ASF licenses this file
+ to you 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.
+-->
+
+<projectDescription>
+ <name>tuscany_sdo</name>
+ <comment></comment>
+ <projects>
+ </projects>
+ <buildSpec>
+ <buildCommand>
+ <name>org.eclipse.cdt.managedbuilder.core.genmakebuilder</name>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ </buildSpec>
+ <natures>
+ <nature>org.eclipse.cdt.core.cnature</nature>
+ <nature>org.eclipse.cdt.managedbuilder.core.managedBuildNature</nature>
+ <nature>org.eclipse.cdt.core.ccnature</nature>
+ </natures>
+</projectDescription>
diff --git a/sdo-cpp/trunk/runtime/core/src/.settings/org.eclipse.cdt.managedbuilder.core.prefs b/sdo-cpp/trunk/runtime/core/src/.settings/org.eclipse.cdt.managedbuilder.core.prefs
new file mode 100644
index 0000000000..37a23c6dd7
--- /dev/null
+++ b/sdo-cpp/trunk/runtime/core/src/.settings/org.eclipse.cdt.managedbuilder.core.prefs
@@ -0,0 +1,9 @@
+#Wed Feb 15 15:54:27 GMT 2006
+eclipse.preferences.version=1
+environment/buildEnvironmentInclude/cdt.managedbuild.config.gnu.so.debug.804736841=<?xml version\="1.0" encoding\="UTF-8"?>\n<environment>\n<variable name\="CPATH" operation\="remove"/>\n<variable name\="CPLUS_INCLUDE_PATH" operation\="remove"/>\n</environment>\n
+environment/buildEnvironmentInclude/cdt.managedbuild.config.gnu.so.release.1588435275=<?xml version\="1.0" encoding\="UTF-8"?>\n<environment>\n<variable name\="CPATH" operation\="remove"/>\n<variable name\="CPLUS_INCLUDE_PATH" operation\="remove"/>\n</environment>\n
+environment/buildEnvironmentLibrary/cdt.managedbuild.config.gnu.so.debug.804736841=<?xml version\="1.0" encoding\="UTF-8"?>\n<environment>\n<variable name\="LIBRARY_PATH" operation\="remove"/>\n</environment>\n
+environment/buildEnvironmentLibrary/cdt.managedbuild.config.gnu.so.release.1588435275=<?xml version\="1.0" encoding\="UTF-8"?>\n<environment>\n<variable name\="LIBRARY_PATH" operation\="remove"/>\n</environment>\n
+environment/project=<?xml version\="1.0" encoding\="UTF-8"?>\n<environment/>\n
+environment/project/cdt.managedbuild.config.gnu.so.debug.804736841=<?xml version\="1.0" encoding\="UTF-8"?>\n<environment>\n<variable delimiter\="" name\="LIBXML2_INCLUDE" operation\="replace" value\="/usr/include/libxml2"/>\n</environment>\n
+environment/project/cdt.managedbuild.config.gnu.so.release.1588435275=<?xml version\="1.0" encoding\="UTF-8"?>\n<environment>\n<variable delimiter\="" name\="LIBXML2_INCLUDE" operation\="replace" value\="/usr/include/libxml2"/>\n</environment>\n
diff --git a/sdo-cpp/trunk/runtime/core/src/Makefile.am b/sdo-cpp/trunk/runtime/core/src/Makefile.am
new file mode 100644
index 0000000000..9a47026580
--- /dev/null
+++ b/sdo-cpp/trunk/runtime/core/src/Makefile.am
@@ -0,0 +1,21 @@
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements. See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership. The ASF licenses this file
+# to you 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.
+
+SUBDIRS = commonj
+
+nobase_include_HEADERS = \
+commonj/sdo/*.h \ No newline at end of file
diff --git a/sdo-cpp/trunk/runtime/core/src/commonj/Makefile.am b/sdo-cpp/trunk/runtime/core/src/commonj/Makefile.am
new file mode 100644
index 0000000000..cc127b70dc
--- /dev/null
+++ b/sdo-cpp/trunk/runtime/core/src/commonj/Makefile.am
@@ -0,0 +1,18 @@
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements. See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership. The ASF licenses this file
+# to you 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.
+
+SUBDIRS = sdo
diff --git a/sdo-cpp/trunk/runtime/core/src/commonj/sdo/ChangeSummary.cpp b/sdo-cpp/trunk/runtime/core/src/commonj/sdo/ChangeSummary.cpp
new file mode 100644
index 0000000000..384956471c
--- /dev/null
+++ b/sdo-cpp/trunk/runtime/core/src/commonj/sdo/ChangeSummary.cpp
@@ -0,0 +1,30 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you 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$ */
+
+#include "commonj/sdo/Logger.h"
+
+#include "commonj/sdo/ChangeSummary.h"
+namespace commonj{
+namespace sdo{
+
+};
+};
+
diff --git a/sdo-cpp/trunk/runtime/core/src/commonj/sdo/ChangeSummary.h b/sdo-cpp/trunk/runtime/core/src/commonj/sdo/ChangeSummary.h
new file mode 100644
index 0000000000..d8a62f98d9
--- /dev/null
+++ b/sdo-cpp/trunk/runtime/core/src/commonj/sdo/ChangeSummary.h
@@ -0,0 +1,209 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you 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$ */
+
+#ifndef _CHANGESUMMARY_H_
+#define _CHANGESUMMARY_H_
+#include "commonj/sdo/export.h"
+
+
+#include "commonj/sdo/SettingList.h"
+#include "commonj/sdo/ChangedDataObjectList.h"
+
+
+namespace commonj{
+namespace sdo {
+
+ /**
+ *
+ * A change summary is used to record changes to the objects in a data graph.
+ * This allows applications to efficiently and incrementally update
+ * back-end storage when required.
+ */
+
+ class ChangeSummary : public RefCountingObject
+ {
+ public:
+
+ /** getChangedDataObjects() returns a list of changed objects.
+ *
+ * The new and modified objects in the list are references to objects that
+ * are associated with this change summary.
+ * The deleted objects in the list are references to copies of the objects
+ * as they appeared at the time that event logging was enabled;
+ * if the deleted objects have references to other objects,
+ * the references will also refer to copies of the target objects.
+ * Return a list of changed data objects.
+ */
+
+ virtual SDO_API ChangedDataObjectList& getChangedDataObjects() = 0;
+
+
+ /** getOldValues returns a list of old values as settings.
+ *
+ * Returns a list of Settings
+ * that represent the property values of the given dataObject
+ * at the point when logging began.
+ * In the case of a deleted object,
+ * the list will include Settings for all the properties.
+ * An old value Setting indicates the value at the
+ * point logging begins. A setting is only produced for
+ * modified objects if either the old value differs from the current value or
+ * if the isSet differs from the current value.
+ * No Settings are produced for created objects.
+ * Param dataObject the object in question.
+ * Return a list of settings.
+ */
+
+ virtual SDO_API SettingList& getOldValues(DataObjectPtr dataObject) = 0;
+
+ /** getOldXpath returns the old path before the setting.
+ *
+ * Returns a path where the object was located before the setting took place.
+ */
+
+
+ virtual SDO_API const char* getOldXpath(RefCountingPointer<commonj::sdo::DataObject> dol) = 0;
+
+ /** beginLogging() sets the change summary in logging mode.
+ *
+ * The change summary is initially inactive. Setting it to logging mode
+ * starts the process of recording all the settings made.
+ */
+
+ virtual SDO_API void beginLogging() = 0;
+
+ /** endLogging() stops logging.
+ *
+ * This method stops logging, but does not clear out the change summary.
+ * The changes are valid until the summary is next set to logging, at which time
+ * all old settings are lost.
+ */
+
+ virtual SDO_API void endLogging() = 0;
+
+
+
+ /** isLogging() returns true if logging is enabled.
+ *
+ * Indicates whether change logging is on (true) or off (false).
+ */
+
+ virtual SDO_API bool isLogging() = 0;
+
+
+
+ /** isCreated() returns true if the object was created during logging.
+ *
+ * Returns whether or not the specified data object was created while logging.
+ * Any object that was added to the data graph
+ * but was not in the data graph when logging began,
+ * will be considered created.
+ * Param dataObject the data object in question.
+ * Return true if the specified data object was created.
+ */
+
+ virtual SDO_API bool isCreated(DataObjectPtr dataObject) = 0;
+
+ /** isDeleted() - true if the object was deleted during logging.
+ *
+ * Returns whether or not the specified data object was deleted while logging.
+ * Any object that is not contained by the data graph will be considered
+ * deleted.
+ * Param dataObject the data object in question.
+ * Return true if the specified data object was deleted.
+ */
+
+ virtual SDO_API bool isDeleted(DataObjectPtr dataObject) = 0;
+
+
+ /** isModified() - true if the object was changed during logging.
+ *
+ * Returns whether or not the specified data object was updated while logging.
+ * An object that was contained in the data graph when logging began,
+ * and remains in the graph when logging ends will be considered for changes.
+ * An object considered modified must have at least one old value Setting.
+ * Param dataObject the data object in question.
+ * Return true if the specified data object was modified.
+ */
+
+ virtual SDO_API bool isModified(DataObjectPtr dataObject) = 0;
+
+ /** getOldValue() gets the setting showing the old value.
+ *
+ * Returns a setting for the specified property
+ * representing the property value of the given dataObject
+ * at the point when logging began.
+ * Returns null if the property has not changed and
+ * has not been deleted.
+ * Param dataObject the object in question.
+ * Param property the property of the object.
+ * Return the Setting for the specified property.
+ */
+
+ virtual SDO_API const Setting& getOldValue(DataObjectPtr dataObject, const Property& property) = 0;
+
+ /** getOldContainer() gets the container before the setting.
+ *
+ * Returns the value of the container data object
+ * at the point when logging began.
+ * Param dataObject the object in question.
+ * Return the old container data object.
+ */
+
+ virtual SDO_API DataObjectPtr getOldContainer(DataObjectPtr dataObject) = 0;
+
+ /** getOldContainmentProperty() - gives the property before setting.
+ *
+ * Returns the value of the containment property data object property
+ * at the point when logging began.
+ * Param dataObject the object in question.
+ * Return the old containment property.
+ */
+
+ virtual SDO_API const Property& getOldContainmentProperty(DataObjectPtr dataObject) = 0;
+
+ /** undoChanges() - Not Implemented.
+ *
+ * NOT IMPLEMENTED
+ *
+ * Undoes all changes in the log to restore the tree of
+ * DataObjects to its original state when logging began.
+ * isLogging() is unchanged. The log is cleared.
+ */
+
+ virtual SDO_API void undoChanges() = 0;
+
+ /** getOldSequence() - Not Implemented.
+ *
+ * NOT IMPLEMENTED
+ *
+ * This method gives back the sequence of a data object as it
+ * appeared when logging was switched on. The data object may be
+ * a deleted data object or a changed data object. If the
+ * data object was not sequenced, this returns null.
+ */
+
+ virtual SDO_API SequencePtr getOldSequence(DataObjectPtr dataObject) = 0;
+
+};
+};
+};
+#endif //_CHANGESUMMARY_H_
diff --git a/sdo-cpp/trunk/runtime/core/src/commonj/sdo/ChangeSummaryBuilder.cpp b/sdo-cpp/trunk/runtime/core/src/commonj/sdo/ChangeSummaryBuilder.cpp
new file mode 100644
index 0000000000..9c7377c950
--- /dev/null
+++ b/sdo-cpp/trunk/runtime/core/src/commonj/sdo/ChangeSummaryBuilder.cpp
@@ -0,0 +1,1163 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you 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$ */
+
+#include "commonj/sdo/ChangeSummaryBuilder.h"
+
+#include "commonj/sdo/SDORuntimeException.h"
+#include "commonj/sdo/ChangeSummary.h"
+#include "commonj/sdo/XSDPropertyInfo.h"
+#include "commonj/sdo/XMLQName.h"
+#include "commonj/sdo/DASProperty.h"
+#include "commonj/sdo/Logging.h"
+
+#include <stdio.h>
+#include <stdlib.h>
+namespace commonj
+{
+ namespace sdo
+ {
+
+// ========================================================================
+// Constructor/Destructor
+// ========================================================================
+
+ ChangeSummaryBuilder::ChangeSummaryBuilder(
+ DataFactoryPtr df,
+ DataObjectPtr& rootDO)
+
+ : dataFactory(df),
+ rootDataObject(rootDO)
+
+
+ {
+ LOGINFO(INFO,"CSBuilder constructor");
+ currentState = baseState;
+ }
+
+ ChangeSummaryBuilder::~ChangeSummaryBuilder()
+ {
+ LOGINFO(INFO,"CSBuilder destructor");
+ }
+
+
+// ========================================================================
+// Deletion handling
+// ========================================================================
+
+ void ChangeSummaryBuilder::populateDeletion(ChangeSummaryImplPtr csi,DataObjectPtr dob,
+ int currentIndex)
+ {
+ LOGENTRY(INFO,"CSBuilder populateDeletion");
+ try {
+
+ std::list<deletionAttribute>::iterator attributesiter;
+ std::list<deletionElement>::iterator elementsiter;
+
+ for (attributesiter= deletions[currentIndex].attributes.begin();
+ attributesiter!= deletions[currentIndex].attributes.end();
+ ++attributesiter)
+ {
+
+ LOGINFO_1(INFO,"CSBuilder Populate deletion attribute:%s",
+ (const char*)((*attributesiter).name));
+
+ dob->setCString((const char*)((*attributesiter).name),
+ (const char*)((*attributesiter).value));
+ }
+ for (elementsiter= deletions[currentIndex].elements.begin();
+ elementsiter!= deletions[currentIndex].elements.end();
+ ++elementsiter)
+ {
+
+ LOGINFO_1(INFO,"CSBuilder:Populate deletion element:%s",
+ (const char*)((*elementsiter).name));
+
+ SDOXMLString value = (*elementsiter).value;
+ SDOXMLString prop = (*elementsiter).name;
+
+ if ((*elementsiter).isDeletion)
+ {
+ for (unsigned int i = 0; i < deletions.size(); i++)
+ {
+ if (value.equals (deletions[i].reference))
+ {
+ if (deletions[i].dob == 0)
+ {
+ handleDeletion(csi,i,dob,(*elementsiter).value,
+ (*elementsiter).name);
+ }
+ // dob may have been set by the line above.
+ if (deletions[i].dob != 0)
+ {
+ DataObjectList& dli = dob->getList((const char*)prop);
+ dli.insert(0,deletions[i].dob);
+ }
+ break;
+ }
+ }
+ }
+ else
+ {
+ DataObjectList& dli = dob->getList((const char*)prop);
+ dli.append((const char*)value);
+ }
+ }
+ }
+ catch (SDORuntimeException e)
+ {
+ LOGSDOEXCEPTION(ERROR,"Error populating a deletion record",e);
+ }
+ LOGEXIT(INFO,"CSBuilder populateDeletion");
+ return;
+ }
+
+
+// ========================================================================
+// Deletion handling
+// ========================================================================
+
+ void ChangeSummaryBuilder::handleDeletion(
+ ChangeSummaryImplPtr csi,
+ int currentIndex,
+ DataObjectPtr cont,
+ SDOXMLString path,
+ SDOXMLString prop)
+ {
+ LOGENTRY(INFO,"CSBuilder handleDeletion(2)");
+
+ if (deletions[currentIndex].completedprocessing)
+ {
+ LOGEXIT(INFO,"CSBuilder handleDeletion(2) - Exit1");
+ return;
+ }
+
+ PropertyPtr p = cont->getInstanceProperty((const char*)prop);
+ if (!p) {
+ SDOString msg("Cannot find property: ");
+ msg += (const char*)prop;
+ throw SDOPropertyNotFoundException(TUSCANY_SDO_EINFO,
+ msg.c_str());
+ }
+ DataObjectPtr dob = dataFactory->create(
+ p->getType());
+ populateDeletion(csi,dob,currentIndex);
+ deletions[currentIndex].dob = dob;
+ deletions[currentIndex].completedprocessing=true;
+ csi->appendToDeletions(*p,dob,cont,path);
+
+ LOGEXIT(INFO,"CSBuilder handleDeletion(2) - Exit2");
+
+ return;
+ }
+
+// ========================================================================
+// Deletion handling
+// ========================================================================
+
+ void ChangeSummaryBuilder::handleDeletion(
+ ChangeSummaryImplPtr csi,
+ int currentIndex,
+ SDOXMLString path)
+ {
+
+ // find the original container - and see if it
+ // still exists.
+ // supposing the container doesnt exist, we need
+ // to process the deletion of that one first, or
+ // locate it in the already deleted elements.
+
+ LOGENTRY(INFO,"CSBuilder:handleDeletion");
+
+ if (deletions[currentIndex].completedprocessing)
+ {
+ LOGEXIT(INFO,"CSBuilder:handleDeletion - Exit1");
+ return;
+ }
+
+ int index = path.lastIndexOf('/');
+ if (index < 0)
+ {
+ LOGERROR(WARNING,"CSBuilder logs deletion of the root object - not possible");
+ LOGEXIT(INFO,"CSBuilder:handleDeletion - Exit2");
+ return;
+ }
+
+ SDOXMLString prop =
+ path.substring(index+1);
+ SDOXMLString contpath =
+ path.substring(0,index);
+
+ index = prop.lastIndexOf('.');
+ if (index >= 0) prop = prop.substring(0,index);
+
+ index = prop.lastIndexOf('[');
+ if (index >= 0) prop = prop.substring(0,index);
+
+ DataObjectPtr cont;
+
+ if (contpath.isNull())
+ {
+ cont = rootDataObject;
+
+ LOGINFO_1(INFO,"Handling deletion from root of %s",(const char*)prop);
+ }
+ else
+ {
+ try {
+ cont = rootDataObject->getDataObject((const char*)contpath);
+ LOGINFO_2(INFO,"Handling deletion from %s of %s",
+ (const char*)contpath,(const char*)prop);
+ }
+ catch (SDORuntimeException e)
+ {
+ cont = 0;
+ LOGINFO(INFO,"Container was a deleted object");
+ }
+ }
+
+ if (cont != 0)
+ {
+ handleDeletion(csi,currentIndex,cont,path,prop);
+ LOGEXIT(INFO,"CSBuilder:handleDeletion - Exit3");
+ return;
+ }
+ else
+ {
+ // this data object was also deleted
+ cont = csi->matchDeletedObject(contpath);
+ if (cont != 0)
+ {
+ // we found a previously deleted object for
+ // the container.
+ handleDeletion(csi,currentIndex,cont,path,prop);
+ LOGEXIT(INFO,"CSBuilder:handleDeletion - Exit4");
+ return;
+ }
+
+ }
+
+ // it could be a deletion which has not been processed yet
+ for (unsigned int i = 0; i < deletions.size(); i++)
+ {
+ if (contpath.equals (deletions[i].reference))
+ {
+ // matching deletion found
+ if (i == currentIndex)
+ {
+ LOGERROR(WARNING,"Loop detected in handling deletes");
+ LOGEXIT(INFO,"CSBuilder:handleDeletion - Exit5");
+ return;
+ }
+ // Handle the deletion first
+ handleDeletion(csi,i,contpath);
+ LOGEXIT(INFO,"CSBuilder:handleDeletion - Exit6");
+ return;
+ }
+ }
+ LOGERROR(WARNING,"Failed to find a matching delete ");
+ LOGEXIT(INFO,"CSBuilder:handleDeletion - Exit7");
+ return;
+ }
+
+// ========================================================================
+// Deletion handling
+// ========================================================================
+
+ SDOXMLString ChangeSummaryBuilder::shiftedIndex(int index)
+ {
+ int pos = createDeletes[index].value.lastIndexOf('.');
+ if (pos < 0) return createDeletes[index].value;
+
+ int val = atoi((const char*)(createDeletes[index].
+ value.substring(pos+1)));
+
+ char buf[10];
+
+ sprintf(buf, ".%d", val + createDeletes[index].indexshift);
+
+ return createDeletes[index].value.substring(0,pos) + buf;
+ }
+
+// ========================================================================
+// Deletion handling
+// ========================================================================
+
+ void ChangeSummaryBuilder::shiftIndices(int index, int delta)
+ {
+ int pos = createDeletes[index].value.lastIndexOf('.');
+ if (pos < 0) return;
+
+ SDOXMLString refstring = createDeletes[index].value.substring(0,pos);
+ pos = atoi((const char*)(createDeletes[index].value.substring(pos+1)));
+
+ for (unsigned int k=index+1;k<createDeletes.size();k++)
+ {
+
+ if (createDeletes[k].type.equals("create")) continue;
+
+ int pos2 = createDeletes[k].value.lastIndexOf('.');
+ if (pos2 < 0) continue;
+
+ SDOXMLString refto = createDeletes[k].value.substring(0,pos2);
+ pos2 = atoi((const char*)(createDeletes[k].value.substring(pos2+1)));
+
+ if (refstring.equals(refto) && pos2 >= pos)
+ {
+ createDeletes[k].indexshift += delta;
+ }
+ }
+ }
+
+// ========================================================================
+// Rebuilding of a change summary from the lists
+// ========================================================================
+
+ void ChangeSummaryBuilder::buildChangeSummary(
+ DataObjectPtr changeSummaryDO)
+ {
+ LOGENTRY(INFO,"CSBuilder:buildChangeSummary");
+
+ unsigned int i;
+
+ try {
+ if (changeSummaryDO == 0)
+ {
+ // there is no summary data object to rebuild
+ LOGEXIT(INFO,"CSBuilder:buildChangeSummary Exit1");
+ return;
+ }
+ ChangeSummaryImplPtr csi =
+ staticCast<ChangeSummaryImplPtr>(changeSummaryDO->getChangeSummary());
+ if (!csi)
+ {
+ // there is no change summary - this shouldnt happen
+ LOGEXIT(INFO,"CSBuilder:buildChangeSummary Exit2");
+ return;
+ }
+
+ // add the creations and deletions in order
+
+ for (i = 0; i < createDeletes.size(); i++)
+ {
+
+ LOGINFO_1(INFO,"CSBuilder:create/delete:%s",
+ (const char*)(createDeletes[i].value));
+
+ SDOXMLString thispath;
+
+ if (createDeletes[i].indexshift != 0)
+ {
+ thispath = shiftedIndex(i);
+ }
+ else
+ {
+ thispath = createDeletes[i].value;
+ }
+
+ if (!createDeletes[i].type.equals("delete"))
+ {
+ DataObjectPtr dob;
+ if (thispath.isNull())
+ {
+ dob = rootDataObject;
+ }
+ else
+ {
+ dob = rootDataObject->getDataObject((const char*)thispath);
+ }
+ if (dob != 0) {
+
+ LOGINFO(INFO,"CSBuilder:add create to change summary");
+
+ csi->appendToCreations(dob->getContainmentProperty(),
+ dob, dob->getContainer());
+ shiftIndices(i,-1);
+ }
+ else
+ {
+ LOGERROR_1(WARNING,"Failed to find object at %s",
+ (const char*)createDeletes[i].value);
+ }
+ }
+ else
+ {
+ // its a deletion - match it.
+ for (unsigned int j = 0; j < deletions.size(); j++)
+ {
+ if (deletions[j].completedprocessing)continue;
+
+ if (thispath.equals (deletions[j].reference))
+ {
+ // matching deletion found
+ LOGINFO_1(INFO,"CSBuilder:matched delete:%s",
+ (const char*)deletions[j].reference);
+
+ handleDeletion(csi, j,createDeletes[i].value);
+ // update the path on any higher items in the current
+ // many-valued property.
+ shiftIndices(i,1);
+
+ break;
+ }
+ }
+ }
+ }
+
+ // add the changes
+
+ std::list<changeAttribute>::iterator a;
+ std::list<changeElement>::iterator e;
+
+ for (unsigned i = 0; i< changes.size(); i++)
+ {
+ DataObjectPtr dob;
+ if (changes[i].reference.isNull())
+ {
+ dob = rootDataObject;
+ }
+ else
+ {
+ dob = rootDataObject->getDataObject((const char*)changes[i].reference);
+ }
+ if (dob != 0)
+ {
+ LOGINFO_1(INFO,"Located a change at %s",
+ (const char*)changes[i].reference);
+
+ // Need to get the changelogitem, and append settings to
+ // it.Append attributes
+
+ for (a=changes[i].attributes.begin();
+ a != changes[i].attributes.end();++a)
+ {
+ PropertyPtr p = dob->getInstanceProperty((const char*)((*a).name));
+ if (!p) {
+ SDOString msg("Cannot find property: ");
+ msg += (const char*)((*a).name);
+ throw SDOPropertyNotFoundException(TUSCANY_SDO_EINFO,
+ msg.c_str());
+ }
+ if (p->getType().isDataType())
+ {
+ csi->appendToChanges(
+ *p,dob,(*a).value,0);
+ }
+ else
+ {
+ for (unsigned int j = 0; j < deletions.size(); j++)
+ {
+ if ((*a).value.equals (deletions[j].reference))
+ {
+ csi->appendToChanges(
+ *p,dob,deletions[j].dob,0);
+ break;
+ }
+ }
+ }
+ }
+ for (e=changes[i].elements.begin();
+ e != changes[i].elements.end();++e)
+ {
+ PropertyPtr p = dob->getInstanceProperty
+ ((const char*)((*e).name));
+ if (!p) {
+ SDOString msg("Cannot find property: ");
+ msg += (const char*)((*e).name);
+ throw SDOPropertyNotFoundException(TUSCANY_SDO_EINFO,
+ msg.c_str());
+ }
+ if ((*e).isDeletion)
+ {
+
+ LOGINFO_1(INFO,"CSBuilder Change was a deletion of:%s",
+ (const char*)((*e).path));
+
+ for (unsigned int j = 0; j < deletions.size(); j++)
+ {
+ if ((*e).path.equals (deletions[j].reference))
+ {
+ // matching deletion found
+ if (deletions[j].dob != 0)
+ {
+ csi->appendToChanges(
+ *p,dob,deletions[j].dob,(*e).index);
+ }
+ break;
+ }
+ }
+ }
+ else if ((*e).isReference)
+ {
+ LOGINFO_2(INFO,"CSBuilder:Change was a reference from:%s to %s" ,
+ (const char*)((*e).path),
+ (const char*)((*e).value));
+
+ DataObjectPtr pdob = rootDataObject->getDataObject((const char*)(*e).value);
+ if (pdob != 0)
+ {
+ csi->appendToChanges(*p,dob,pdob,(*e).index);
+ }
+ }
+ else
+ {
+ LOGINFO_1(INFO,"CSBuilder:Change was a many valued item:%s" ,
+ (const char*)((*e).name));
+
+ csi->appendToChanges(*p,dob,(*e).value,(*e).index);
+ }
+ }
+ }
+ else
+ {
+ LOGERROR_1(WARNING,"CSBuilder:Failed to find object at %s",
+ (const char*)(changes[i].reference));
+ }
+ }
+ }
+ catch (SDORuntimeException e)
+ {
+ LOGSDOEXCEPTION(ERROR,"CSBuilder:Error rebuilding change summary",e);
+ }
+ LOGEXIT(INFO,"CSBuilder:buildChangeSummary Exit3");
+ }
+
+// ========================================================================
+// Parsing code
+// ========================================================================
+
+ void ChangeSummaryBuilder::processStart(
+ const SDOXMLString& localname,
+ const SDOXMLString& prefix,
+ const SDOXMLString& URI,
+ const SAX2Namespaces& namespaces,
+ const SAX2Attributes& attributes)
+ {
+ char cbuf[32];
+ int i;
+
+ LOGENTRY(INFO,"CSBuilder:processStart");
+
+ if (currentState == baseState)
+ {
+ if (localname.equalsIgnoreCase("create") ||
+ localname.equalsIgnoreCase("delete"))
+ {
+ currentState = dealingWithCreateDelete;
+ // will be expecting a chars message to give the
+ // contents
+
+ createDeletes.push_back(createDelete(localname));
+
+ LOGINFO_1(INFO,"CSBuilder: Processing a %s",(const char*)localname);
+ LOGEXIT(INFO,"CSBuilder:processStart Exit1");
+ return;
+ }
+ else
+ {
+ // we are starting a new change record here
+ currentState = dealingWithChange;
+
+ // we expect the entry to have an sdo:ref, and possibly
+ // some attributes for the changed single-values
+ SDOXMLString ref = attributes.getValue("ref");
+
+ if (ref.isNull())
+ {
+ LOGERROR(INFO,"CSBuilder:Problem with change reference");
+ ref = SDOXMLString("Unknown");
+ }
+
+ currentChange = change(localname, ref);
+
+ LOGINFO_2(INFO,"CSBuilder: Processing a change:%s:%s",
+ (const char*)localname,
+ (const char*)ref);
+
+ currentLocation.clear();
+
+ if (ref.equals("#/"))
+ {
+ ref = SDOXMLString("#");
+ }
+
+ currentLocation.push_back(ref);
+
+ // clear out the change state - if there was any.
+
+ changeIndex = 0;
+ previousChange = SDOXMLString("");
+
+ // now insert any remaining attributes of this change
+
+ for (i=0; i < attributes.size(); i++)
+ {
+ // push all the attributes into the change record.
+ SDOXMLString name = attributes[i].getName();
+ if (!name.equalsIgnoreCase("ref"))
+ {
+ SDOXMLString value = attributes[i].getValue();
+ currentChange.addAttribute(
+ changeAttribute(name,value));
+ }
+ }
+ }
+ LOGEXIT(INFO,"CSBuilder:processStart Exit2");
+ return;
+ }
+
+ // We are not in the base state - we could be in a change or a deletion
+ // We are now dropping into an element, which could be either a many-valued
+ // primitive type, or a placeholder in list of deletions, or a deletion
+ // record.
+
+ if (currentState == dealingWithChange)
+ {
+
+ if (!previousChange.equals(localname))
+ {
+ changeIndex = 0;
+ previousChange = localname;
+ }
+ else
+ {
+ changeIndex++;
+ }
+
+
+ sprintf(cbuf,"%d",changeIndex);
+ currentLocation.push_back(localname + "." + cbuf);
+
+ // build the current location...
+ SDOXMLString curr_loc = "";
+
+ if (currentLocation.size() > 0)
+ {
+ for (unsigned int pi = 0; pi < currentLocation.size()-1; pi++)
+ {
+ curr_loc = curr_loc + currentLocation[pi];
+ curr_loc = curr_loc + "/";
+ }
+ curr_loc = curr_loc + currentLocation[currentLocation.size()-1];
+ }
+
+ LOGINFO_1(INFO,"CSBuilder: Dropping into an element of a change:%s",
+ (const char*)localname);
+ LOGINFO_1(INFO,"CSBuilder:currentLocation:%s",
+ (const char*)curr_loc);
+
+ // First case - its a placeholder for an element in a list
+ // all we have to do is keep track of the list index.
+
+ if (attributes.size() == 1)
+ {
+ SDOXMLString name = attributes[0].getName();
+ if (name.equalsIgnoreCase("ref"))
+ {
+ currentState = dealingWithChangeElement;
+ currentChange.addElement(
+ changeElement(localname, curr_loc,
+ attributes[0].getValue(), true, false));
+
+ LOGEXIT(INFO,"CSBuilder:processStart Exit3");
+ return;
+ }
+ }
+
+ if (attributes.size() == 0)
+ {
+ // It could be a many-valued primitive, or
+ // a deletion with no attributes
+ // can we match the current path to a known deletion?
+
+ bool isDelete = false;
+
+ for (unsigned int i = 0; i < createDeletes.size(); i++)
+ {
+ if (createDeletes[i].type.equals("delete"))
+ {
+ if (curr_loc.equals(createDeletes[i].value))
+ {
+ LOGINFO(INFO,"CSBuilder: An existing delete was found");
+
+ isDelete = true;
+ break; // out of the for loop
+ }
+ }
+ }
+ if (!isDelete)
+ {
+ LOGINFO(INFO,"CSBuilder: Change with no atts and not deletion- an element");
+
+ // and will get picked up by the 'characters' method.
+ currentState = dealingWithChangeElement;
+ currentLocalName = SDOXMLString(localname);
+
+ LOGEXIT(INFO,"CSBuilder:processStart Exit4");
+ return;
+ }
+ }
+
+ currentChange.addElement(changeElement(localname, curr_loc, false, true));
+ currentDeletion = deletion(localname, curr_loc);
+
+ LOGINFO_2(INFO,"CSBuilder: Found a deletion:%s:%s",
+ (const char*)localname,
+ (const char*)curr_loc);
+
+
+ // clear out the change state - if there was any.
+ deletionLevel = 0;
+ deletionIndex = 0;
+ previousDeletion = SDOXMLString("");
+
+ currentState = dealingWithDeletion;
+
+ // Now add the attributes if there are any.
+
+ for (int i=0; i < attributes.size(); i++)
+ {
+ // push all the attributes into the deletion record.
+ SDOXMLString name = attributes[i].getName();
+ if (!name.equalsIgnoreCase("ref"))
+ {
+ SDOXMLString value = attributes[i].getValue();
+ currentDeletion.addAttribute(
+ deletionAttribute(name,value));
+ }
+ }
+
+ LOGEXIT(INFO,"CSBuilder:processStart Exit5");
+ return;
+ }
+ if (currentState == dealingWithDeletion)
+ {
+ // we are already in a deletion, and entering an element
+ if (!previousDeletion.equals(localname))
+ {
+ deletionIndex = 0;
+ previousDeletion = localname;
+ }
+ else
+ {
+ deletionIndex++;
+ }
+
+ sprintf(cbuf,"%d",deletionIndex);
+ currentLocation.push_back(localname + "." + cbuf);
+
+ // First case - its a placeholder for an element in a list
+ // all we have to do is keep track of the list index.
+
+ if (attributes.size() == 1)
+ {
+ SDOXMLString name = attributes[0].getName();
+ if (name.equalsIgnoreCase("ref"))
+ {
+ LOGINFO(INFO,"CSBuilder: The element is a reference to an existing entry in a list");
+
+ currentState = dealingWithDeletionElement;
+
+ LOGEXIT(INFO,"CSBuilder:processStart Exit6");
+ return;
+ }
+ }
+
+ SDOXMLString curr_loc = "";
+ if (currentLocation.size() > 0)
+ {
+ for (unsigned int pi = 0; pi < currentLocation.size()-1; pi++)
+ {
+ curr_loc = curr_loc + currentLocation[pi];
+ curr_loc = curr_loc + "/";
+ }
+ curr_loc = curr_loc + currentLocation[currentLocation.size()-1];
+ }
+
+ if (attributes.size() == 0)
+ {
+ // It could be a many-valued primitive, or
+ // a deletion with no attributes
+ // can we match the current path to a known deletion?
+ bool isDelete = false;
+
+ for (unsigned int i = 0; i < createDeletes.size(); i++)
+ {
+ if (createDeletes[i].type.equals("delete"))
+ {
+ if (curr_loc.equals(createDeletes[i].value))
+ {
+ LOGINFO(INFO,"CSBuilder: An existing delete was found - its a delete");
+
+ isDelete = true;
+ break; // out of the for loop
+ }
+ }
+ }
+ if (!isDelete)
+ {
+ LOGINFO(INFO,"CSBuilder: Found a change with no atts, and no deletion matches - its an element");
+
+ // and will get picked up by the 'characters' method.
+ currentState = dealingWithDeletionElement;
+
+ LOGEXIT(INFO,"CSBuilder:processStart Exit7");
+ return;
+ }
+ }
+
+
+ // We are starting a new deletion record
+
+ LOGINFO_2(INFO,"CSBuilder: Found a deletion within a deletion:%s:%s",
+ (const char*)localname, (const char*)curr_loc);
+
+ deletionList.push_back(deletionListElement(currentDeletion,deletionIndex,
+ previousDeletion));
+
+ currentDeletion = deletion(localname, curr_loc);
+
+ // we are in a nested delete - so record the level such that we can pop state
+ // from the deletionList on coming back out of this.
+
+ deletionLevel++;
+ //deletionIndex = 0;
+ previousDeletion = SDOXMLString("");
+
+ currentState = dealingWithDeletion;
+
+ // Now add the attributes if there are any.
+
+ for (int i=0; i < attributes.size(); i++)
+ {
+ // push all the attributes into the deletion record.
+ SDOXMLString name = attributes[i].getName();
+ if (!name.equalsIgnoreCase("ref"))
+ {
+ SDOXMLString value = attributes[i].getValue();
+ currentDeletion.addAttribute(
+ deletionAttribute(name,value));
+ }
+ }
+
+ LOGEXIT(INFO,"CSBuilder:processStart Exit8");
+ return;
+
+ }
+ }
+
+// ========================================================================
+// Parser ends an element
+// ========================================================================
+
+ void ChangeSummaryBuilder::processEnd(
+ const SDOXMLString& localname,
+ const SDOXMLString& prefix,
+ const SDOXMLString& URI)
+ {
+
+ LOGENTRY(INFO,"CSBuilder:processEnd");
+
+ if (currentState == dealingWithCreateDelete)
+ {
+ // its already been completed by the characters message
+ currentState = baseState;
+ LOGEXIT(INFO,"CSBuilder:processEnd Exit1");
+ return;
+ }
+ else if (currentState == dealingWithChangeElement)
+ {
+ // its already been completed by the characters message
+ currentState = dealingWithChange;
+ currentLocation.pop_back();
+ LOGEXIT(INFO,"CSBuilder:processEnd Exit2");
+ return;
+ }
+ else if (currentState == dealingWithDeletionElement)
+ {
+ // its already been completed by the characters message
+ currentState = dealingWithDeletion;
+ currentLocation.pop_back();
+ LOGEXIT(INFO,"CSBuilder:processEnd Exit3");
+ return;
+ }
+ else if (currentState == dealingWithChange)
+ {
+ // we should have finished, there are no nested changes
+ currentState = baseState;
+ changes.push_back(currentChange);
+ currentLocation.clear();
+ LOGEXIT(INFO,"CSBuilder:processEnd Exit4");
+ return;
+ }
+ else if (currentState == dealingWithDeletion)
+ {
+ currentLocation.pop_back();
+ deletions.push_back(currentDeletion);
+ if (deletionLevel > 0)
+ {
+ deletionLevel--;
+ if (deletionList.size() > 0)
+ {
+ int index = deletionIndex;
+ SDOXMLString path = currentDeletion.reference;
+ SDOXMLString name = currentDeletion.name;
+
+ deletionListElement dl = deletionList[deletionList.size()-1];
+ currentDeletion = dl.del;
+ deletionIndex = dl.index;
+ previousDeletion = dl.previous;
+ deletionList.pop_back();
+ // and insert the inside deletion in the outside one.
+ currentDeletion.insertElement(deletionElement(
+ name, path,index));
+ }
+
+ LOGEXIT(INFO,"CSBuilder:processEnd Exit5");
+ return;
+ }
+ else
+ {
+ currentState = dealingWithChange;
+
+ LOGEXIT(INFO,"CSBuilder:processEnd Exit6");
+ return;
+ }
+ }
+ }
+
+// ========================================================================
+// Parse characters
+// ========================================================================
+
+
+ void ChangeSummaryBuilder::processChars(
+ const SDOXMLString& chars)
+ {
+ LOGENTRY(INFO,"CSBuilder:processChars");
+
+ if (currentState == dealingWithCreateDelete)
+ {
+ // this is text within a create/delete indicating the
+ // value of the item deleted/created.
+ if (createDeletes.size() > 0)
+ {
+ createDeletes[createDeletes.size()-1].value = chars;
+ LOGINFO_1(INFO,"CSBuilder:characters create/delete:%s",
+ (const char*)chars);
+ }
+ LOGEXIT(INFO,"CSBuilder:processChars Exit1");
+ return;
+ }
+ else if (currentState == dealingWithChangeElement)
+ {
+ changeElement ce = changeElement(currentLocalName, previousChange, false, false);
+ ce.value = chars;
+ ce.index = changeIndex;
+ currentChange.addElement(ce);
+
+ LOGINFO_1(INFO,"CSBuilder: Characters in a change element:%s",
+ (const char *)chars);
+
+ LOGEXIT(INFO,"CSBuilder:processChars Exit2");
+ return;
+ }
+ else if (currentState == dealingWithDeletionElement)
+ {
+ deletionElement ce = deletionElement(previousDeletion);
+ ce.value = chars;
+ ce.index = deletionIndex;
+ currentDeletion.addElement(ce);
+
+ LOGINFO_1(INFO,"CSBuilder: Characters in a deletion element:%s",
+ (const char *)chars);
+
+ LOGEXIT(INFO,"CSBuilder:processChars Exit3");
+ return;
+ }
+
+ LOGINFO_1(INFO,"CSBuilder: Characters in nothing!!:%s",
+ (const char *)chars);
+ LOGEXIT(INFO,"CSBuilder:processChars Exit4");
+ }
+
+
+// ========================================================================
+// Classes holding temporary parsed information
+// ========================================================================
+
+
+ /////////////////////////////////////////////////
+ // An element in the list of creates/deletes
+ /////////////////////////////////////////////////
+
+ createDelete::createDelete()
+ {
+ }
+
+ createDelete::createDelete(SDOXMLString intype) :
+ type(intype)
+ {
+ indexshift = 0;
+ }
+
+ createDelete::~createDelete()
+ {
+ }
+
+ /////////////////////////////////////////////////
+ // An element in the list of changes
+ /////////////////////////////////////////////////
+
+ changeAttribute::changeAttribute()
+ {
+ }
+
+ changeAttribute::changeAttribute(SDOXMLString inname,
+ SDOXMLString invalue): name(inname), value(invalue)
+ {
+ }
+
+ changeAttribute::~changeAttribute()
+ {
+ }
+
+ changeElement::changeElement()
+ {
+ }
+
+ changeElement::changeElement(SDOXMLString inname,
+ SDOXMLString inpath, bool isRef, bool isDel)
+ : name(inname) , path(inpath)
+ {
+ isReference=isRef;
+ isDeletion= isDel;
+ }
+
+ changeElement::changeElement(SDOXMLString inname,
+ SDOXMLString inpath,
+ SDOXMLString invalue, bool isRef, bool isDel)
+ : name(inname), value(invalue), path(inpath)
+ {
+ isReference=isRef;
+ isDeletion= isDel;
+ }
+
+ changeElement::~changeElement()
+ {
+ }
+
+ change::change()
+ {
+ }
+
+ change::change(SDOXMLString inname, SDOXMLString ref):
+ name(inname), reference(ref)
+ {
+ }
+
+ void change::addAttribute(changeAttribute ca)
+ {
+ attributes.push_back(ca);
+ }
+
+ void change::addElement(changeElement ce)
+ {
+ elements.push_back(ce);
+ }
+
+ /////////////////////////////////////////////////
+ // An element in the list of deletions
+ /////////////////////////////////////////////////
+
+ deletionAttribute::deletionAttribute()
+ {
+ }
+
+ deletionAttribute::deletionAttribute(SDOXMLString inname,
+ SDOXMLString invalue): name(inname), value(invalue)
+ {
+ }
+
+ deletionAttribute::~deletionAttribute()
+ {
+ }
+
+ deletionElement::deletionElement()
+ {
+ }
+
+ deletionElement::deletionElement(SDOXMLString inname)
+ : name(inname)
+ {
+ isDeletion = false;
+ }
+
+ deletionElement::deletionElement(SDOXMLString inname,
+ SDOXMLString inpath, int inindex)
+ : name(inname), value(inpath), index(inindex)
+ {
+ isDeletion = true;
+ }
+
+ deletionElement::~deletionElement()
+ {
+ }
+
+ deletion::deletion()
+ {
+ }
+
+ deletion::deletion(SDOXMLString inname, SDOXMLString ref):
+ name(inname), reference(ref)
+ {
+ completedprocessing=false;
+ }
+
+ void deletion::addAttribute(deletionAttribute ca)
+ {
+ attributes.push_back(ca);
+ }
+
+ void deletion::addElement(deletionElement ce)
+ {
+ elements.push_back(ce);
+ }
+
+ void deletion::insertElement(deletionElement ce)
+ {
+ elements.insert(elements.begin(),ce);
+ }
+
+ deletionListElement::deletionListElement()
+ {
+ }
+
+ deletionListElement::deletionListElement(
+ deletion in_del,
+ int in_index,
+ SDOXMLString in_prev):
+ del(in_del), index(in_index), previous(in_prev)
+ {
+ }
+
+ } // End - namespace sdo
+} // End - namespace commonj
+
diff --git a/sdo-cpp/trunk/runtime/core/src/commonj/sdo/ChangeSummaryBuilder.h b/sdo-cpp/trunk/runtime/core/src/commonj/sdo/ChangeSummaryBuilder.h
new file mode 100644
index 0000000000..5a3564f0cb
--- /dev/null
+++ b/sdo-cpp/trunk/runtime/core/src/commonj/sdo/ChangeSummaryBuilder.h
@@ -0,0 +1,303 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you 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$ */
+
+
+#ifndef _CHANGESUMMARYBUILDER_H_
+#define _CHANGESUMMARYBUILDER_H_
+
+#include "commonj/sdo/disable_warn.h"
+
+#include "commonj/sdo/SAX2Parser.h"
+#include "commonj/sdo/DataFactory.h"
+#include "commonj/sdo/DataObject.h"
+#include "commonj/sdo/SAX2Namespaces.h"
+#include "commonj/sdo/PropertySetting.h"
+#include "commonj/sdo/ChangeSummaryImpl.h"
+
+
+#include <stack>
+
+namespace commonj
+{
+ namespace sdo
+ {
+
+/**
+ * createDelete is a class holding a creation or deletion in
+ * a change summary builder.
+ * When rebuilding a change summary from the serialized version
+ * creates and deletes are stored in these until they can be
+ * converted into a change summary.
+ */
+
+
+ class createDelete
+ {
+ public:
+ createDelete();
+ createDelete(SDOXMLString intype);
+ virtual ~createDelete();
+ SDOXMLString type;
+ SDOXMLString value;
+ int indexshift;
+ };
+
+/**
+ * changeAttribute is a class holding a changed attribute in a
+ * change summary builder.
+ * When rebuilding a change summary from the serialized version
+ * changes are stored in these until they can be
+ * converted into a change summary.
+ */
+
+ class changeAttribute
+ {
+ public:
+ changeAttribute();
+ changeAttribute(SDOXMLString inname,
+ SDOXMLString invalue);
+ virtual ~changeAttribute();
+ SDOXMLString name;
+ SDOXMLString value;
+ };
+
+/**
+ * changeElement is a class holding a changed element in a change summary builder.
+ * When rebuilding a change summary from the serialized version
+ * changes are stored in these until they can be
+ * converted into a change summary.
+ */
+ class changeElement
+ {
+ public:
+ changeElement();
+ changeElement(SDOXMLString inname,
+ SDOXMLString inpath, bool isRef, bool isDel);
+ changeElement(SDOXMLString inname,
+ SDOXMLString inpath,
+ SDOXMLString invalue, bool isRef, bool isDel);
+ virtual ~changeElement();
+ SDOXMLString name;
+ SDOXMLString value;
+ SDOXMLString path;
+ bool isReference;
+ bool isDeletion;
+ int index;
+ };
+
+/**
+ * change is a class holding a change in a change summary builder.
+ * When rebuilding a change summary from the serialized version
+ * changes are stored in these until they can be
+ * converted into a change summary.
+ * Changes consist of changeAttributes and changeElements
+ */
+
+
+ class change
+ {
+ public:
+ change();
+ change(SDOXMLString inname, SDOXMLString ref);
+ void addAttribute(changeAttribute ca);
+ void addElement(changeElement ce);
+ std::list<changeAttribute> attributes;
+ std::list<changeElement> elements;
+ SDOXMLString name;
+ SDOXMLString reference;
+ };
+
+/**
+ * deletionAttribute is a class holding a deletion attribute in a change summary builder.
+ * When rebuilding a change summary from the serialized version
+ * deletions are stored in these until they can be
+ * converted into a change summary.
+ * Changes consist of deletionAttributes and deletionElements
+ */
+ class deletionAttribute
+ {
+ public:
+ deletionAttribute();
+ deletionAttribute(SDOXMLString inname,
+ SDOXMLString invalue);
+ virtual ~deletionAttribute();
+ SDOXMLString name;
+ SDOXMLString value;
+ };
+
+/**
+ * deletionElement is a class holding a deletion element in a change summary builder.
+ * When rebuilding a change summary from the serialized version
+ * deletions are stored in these until they can be
+ * converted into a change summary.
+ * Changes consist of deletionAttributes and deletionElements
+ */
+ class deletionElement
+ {
+ public:
+ deletionElement();
+ deletionElement(SDOXMLString inname);
+ deletionElement(SDOXMLString inname,
+ SDOXMLString inpath, int inindex);
+ virtual ~deletionElement();
+ SDOXMLString name;
+ SDOXMLString value;
+ bool isDeletion;
+ int index;
+ };
+
+
+/**
+ * deletions is a class holding a deletion in a change summary builder.
+ * When rebuilding a change summary from the serialized version
+ * deletions are stored in these until they can be
+ * converted into a change summary.
+ * Changes consist of deletionAttributes and deletionElements
+ */
+
+ class deletion
+ {
+ public:
+ deletion();
+ deletion(SDOXMLString inname, SDOXMLString ref);
+ void addAttribute(deletionAttribute ca);
+ void addElement(deletionElement ce);
+ void insertElement(deletionElement ce);
+ SDOXMLString name;
+ SDOXMLString reference;
+ DataObjectPtr dob; /* the recreated one*/
+ std::list<deletionAttribute> attributes;
+ std::list<deletionElement> elements;
+ bool completedprocessing;
+ };
+
+ /** deletionListElement is an item in a list of deletions in a change summary builder.
+ *
+ * All the deletions are stored whilst rebuilding a change
+ * summary, then applied. These list elements hold them.
+ */
+
+ class deletionListElement
+ {
+ public:
+ deletionListElement();
+ deletionListElement(deletion in_del, int in_index, SDOXMLString in_prev);
+ SDOXMLString previous;
+ deletion del;
+ int index;
+ };
+
+/**
+ * The ChangeSummaryBuilder recreates a change summary from the
+ * XML representations of the changes, creations and deletions.
+ * It does this by populating a list of changes as though they had
+ * been applied to the current data graph.
+ */
+
+ class ChangeSummaryBuilder
+ {
+
+
+ public:
+
+ enum CsState
+ {
+ baseState,
+ dealingWithCreateDelete,
+ dealingWithChange,
+ dealingWithChangeElement,
+ dealingWithDeletion,
+ dealingWithDeletionElement
+ };
+
+
+ ChangeSummaryBuilder(
+ DataFactoryPtr df,
+ DataObjectPtr& rootDO);
+
+ virtual ~ChangeSummaryBuilder();
+
+
+ virtual void processStart(
+ const SDOXMLString& localname,
+ const SDOXMLString& prefix,
+ const SDOXMLString& URI,
+ const SAX2Namespaces& namespaces,
+ const SAX2Attributes& attributes);
+
+ virtual void processChars(
+ const SDOXMLString& chars);
+
+ virtual void processEnd(
+ const SDOXMLString& localname,
+ const SDOXMLString& prefix,
+ const SDOXMLString& URI);
+
+ virtual void buildChangeSummary(
+ DataObjectPtr changeSummaryDO);
+
+ virtual void populateDeletion(ChangeSummaryImplPtr csi, DataObjectPtr dob,
+ int index);
+
+ virtual void handleDeletion(
+ ChangeSummaryImplPtr csi,
+ int currentIndex,
+ DataObjectPtr cont,
+ SDOXMLString path,
+ SDOXMLString prop);
+
+ virtual void handleDeletion(ChangeSummaryImplPtr csi,
+ int index,
+ SDOXMLString path);
+
+ void shiftIndices(int index, int delta);
+
+ SDOXMLString shiftedIndex(int index);
+
+
+ private:
+ DataFactoryPtr dataFactory;
+ DataObjectPtr& rootDataObject;
+
+ CsState currentState;
+
+ std::vector<deletionListElement> deletionList;
+ std::vector<SDOXMLString> currentLocation;
+ std::vector<createDelete> createDeletes;
+
+ std::vector<change> changes;
+ change currentChange;
+ SDOXMLString previousChange;
+ SDOXMLString currentLocalName;
+ int changeIndex;
+
+ std::vector<deletion> deletions;
+ deletion currentDeletion;
+ SDOXMLString previousDeletion;
+ int deletionIndex;
+ int deletionLevel;
+
+
+ };
+ } // End - namespace sdo
+} // End - namespace commonj
+
+#endif //_CHANGESUMMARYBUILDER_H_
diff --git a/sdo-cpp/trunk/runtime/core/src/commonj/sdo/ChangeSummaryImpl.cpp b/sdo-cpp/trunk/runtime/core/src/commonj/sdo/ChangeSummaryImpl.cpp
new file mode 100644
index 0000000000..0465d3cbda
--- /dev/null
+++ b/sdo-cpp/trunk/runtime/core/src/commonj/sdo/ChangeSummaryImpl.cpp
@@ -0,0 +1,1598 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you 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$ */
+
+#include "commonj/sdo/ChangeSummaryImpl.h"
+
+#include "commonj/sdo/DataObjectImpl.h"
+
+#include "commonj/sdo/Property.h"
+#include "commonj/sdo/Type.h"
+#include "commonj/sdo/TypeList.h"
+#include "commonj/sdo/Sequence.h"
+#include "commonj/sdo/DataObject.h"
+#include "commonj/sdo/DataObjectList.h"
+#include "commonj/sdo/SDORuntimeException.h"
+#include "commonj/sdo/Logging.h"
+
+#include <stdlib.h>
+
+namespace commonj{
+namespace sdo{
+
+
+ // Initializes an empty change summary, so we know one is required
+ ChangeSummaryImpl::ChangeSummaryImpl()
+ {
+ logging = false;
+ }
+
+ ChangeSummaryImpl::~ChangeSummaryImpl()
+ {
+ //Force logging off or bad things will happen!
+ logging = false;
+
+ /**
+ * These remove the logitems, so cause the
+ * refcounts of the data objects to drop, and
+ * delete the settings lists.
+ */
+ deletedMap.clear();
+ createdMap.clear();
+ changedMap.clear();
+ changedDataObjects.clear();
+ }
+
+ SequencePtr ChangeSummaryImpl::getOldSequence(DataObjectPtr dob)
+ {
+ DELETELOG_MAP::iterator deleteLogIter;
+
+ DataObject* ob = getRawPointer(dob);
+ deleteLogIter = deletedMap.find((DataObjectImpl*)ob);
+
+ if (deleteLogIter != deletedMap.end())
+ {
+ return (deleteLogIter->second).getSequence();
+ }
+
+ CHANGELOG_MAP::iterator changeLogIter;
+
+ changeLogIter = changedMap.find((DataObjectImpl*)ob);
+
+ if (changeLogIter != changedMap.end())
+ {
+ return (changeLogIter->second).getSequence();
+ }
+ return NULL;
+
+ }
+
+ void ChangeSummaryImpl::removeFromChanges(DataObjectImpl* ob)
+ {
+ int i = changedDataObjects.size();
+
+ /**
+ * this is used to remove only the most recent change.
+ * A deletion has occurred, and there was a creation, so
+ * we remove the creation. There cannot be a change after the
+ * creation, so the last entry in changes is the creation.
+ * there could be a previous deletion of the same object, so
+ * we should not clear the whole list.
+ */
+ while (i > 0)
+ {
+ i--;
+
+
+ if (changedDataObjects.get(i) == ob)
+ {
+ changedDataObjects.remove(i);
+ return;
+ }
+ }
+ }
+
+ DataObjectPtr ChangeSummaryImpl::matchDeletedObject(SDOXMLString path)
+ {
+ DELETELOG_MAP::iterator deleteLogIter;
+
+ for (deleteLogIter = deletedMap.begin();
+ deleteLogIter != deletedMap.end(); ++deleteLogIter)
+ {
+ if (
+ path.equals(
+ SDOXMLString((deleteLogIter->second).getOldXpath())
+ )
+ )
+ {
+ return deleteLogIter->first;
+ }
+ }
+ return DataObjectPtr(0);
+ }
+
+
+
+ void ChangeSummaryImpl::logDeletion(DataObjectImpl* ob,
+ DataObjectImpl* container, const Property& prop,
+ const char* oldpath, bool loggingChildren)
+ {
+ LOGINFO_1(INFO,"ChangeSummary:LogDelete:%s",
+ ob->getType().getName());
+
+ /**
+ * The object is about to be deleted, so we need
+ * all its property Settings recorded in the list
+ * of changed data objects. We also need to know
+ * its old container, container property, and
+ * value.
+ */
+
+ // find any properties which are data objects, log their
+ // deletion first.
+
+ unsigned int i;
+
+ // Trace for change summaries
+
+ LOGINFO_2(INFO,"ChangeSummary logs a deletion of property %s type %s",
+ prop.getName(), prop.getType().getName());
+
+
+ CREATELOG_MAP::iterator createLogIter;
+ CHANGELOG_MAP::iterator changeLogIter;
+
+ createLogIter = createdMap.find(ob);
+ if (createLogIter != createdMap.end())
+ {
+ // would need to remove it from the created list.
+ LOGINFO(INFO,"ChangeSummary: The deletion was already created - just removing it");
+
+ removeFromChanges(ob);
+ createdMap.erase(ob);
+ // find the container in the change map.
+
+ changeLogIter = changedMap.find(container);
+ if (changeLogIter != changedMap.end())
+ {
+ // would hope there was an entry
+ unsigned int index;
+ if (prop.isMany())
+ {
+ DataObjectList& dl = container->getList(prop);
+ for (index=0;index<dl.size();index++)
+ {
+ if (dl[index] == ob)
+ {
+ break;
+ }
+ }
+ }
+ else
+ {
+ index = 0;
+ }
+
+ SettingList& slist = (changeLogIter->second).getSettings();
+
+ for (int j=0 ; j < slist.size();j++)
+ {
+ if (!strcmp(slist.get(j)->getProperty().getName(),
+ prop.getName())
+
+
+ && slist.get(j)->getIndex() ==
+ index)
+ {
+ // these are settings of the same prop/index, we
+ // need to remove this entry
+ slist.remove(j);
+ // and if this was the only change, then we
+ // need to remoe the container from the changes
+ if (slist.size() == 0)
+ {
+ changedMap.erase(container);
+ removeFromChanges(container);
+ }
+ break; // must not continue - size is now wrong
+ }
+ }
+ }
+ return;
+ }
+
+ DELETELOG_MAP::iterator deleteLogIter;
+
+ deleteLogIter = deletedMap.find(ob);
+
+ if (deleteLogIter != deletedMap.end())
+ {
+ LOGINFO(INFO,"ChangeSummary - delete an already deleted object");
+ return;
+ }
+
+ PropertyList pl = ob->getInstanceProperties();
+ DataObject* dob;
+
+ if (loggingChildren)
+ {
+ for (i=0; i < pl.size(); i++)
+ {
+ if (pl[i].getType().isDataObjectType())
+ {
+ if (pl[i].isMany()) {
+ DataObjectList& dl = ob->getList(pl[i]);
+ for (int j = dl.size() - 1; j>=0; j--)
+ {
+ dob = getRawPointer(dl[j]);
+ DataObjectImpl* dobImpl = (DataObjectImpl*)dob;
+ if (dob)logDeletion(dobImpl,ob,pl[i],
+ dobImpl->objectToXPath(), true);
+ }
+ }
+ else {
+ dob = getRawPointer(ob->getDataObject(pl[i]));
+ DataObjectImpl* dobImpl = (DataObjectImpl*)dob;
+ if (dob)logDeletion(dobImpl,ob,pl[i],
+ dobImpl->objectToXPath(), true);
+ }
+ }
+ }
+ }
+
+
+ // build a Setting list for the set properties
+
+ deletedMap.insert(std::make_pair(ob,deleteLogItem(
+ (DataObject*)ob, prop,ob->getSequence(),
+ oldpath,
+ container)));
+ deleteLogIter = deletedMap.find(ob);
+ SettingList& sl = (deleteLogIter->second).getSettings();
+
+ void* value;
+ unsigned int len;
+
+ for (i=0; i < pl.size(); i++)
+ {
+ //if (!pl[i].getType().isDataType()) continue;
+
+ if (!ob->isSet(pl[i]))
+ {
+ sl.append(new Setting(false,false, 0,0,pl[i],0));
+ continue;
+ }
+ if (pl[i].isMany())
+ {
+
+ DataObjectList& dol = ob->getList(pl[i]);
+ for (int j=dol.size()-1;j >= 0; j--)
+ {
+ // needs to be the data object in cases where...
+ if (pl[i].getType().isDataType()) {
+ setPropValue(&value,&len,ob,pl[j]);
+ sl.append(new Setting(true,false,value,len,pl[i],j));
+ }
+ else {
+ value = (void*)getRawPointer(dol[j]);
+ sl.append(new Setting(true,false,value,0,pl[i],j));
+ }
+ }
+ }
+ else
+ {
+ setPropValue(&value,&len,ob,pl[i]);
+ sl.append(new Setting(true,ob->isNull(pl[i]),value,len,pl[i],0));
+ }
+
+ }
+
+
+ changeLogIter = changedMap.find(ob);
+ if (changeLogIter != changedMap.end())
+ {
+ // we have already changed this object, so we need the old values
+ // from the change, and to remove the changed map entry
+ LOGINFO(INFO,"ChangeSummary found a deleted item in then changes");
+
+ (deleteLogIter->second).setSequence((changeLogIter->second).getSequence());
+
+ SettingList& slist = (changeLogIter->second).getSettings();
+
+ for (int j=0 ; j < slist.size();j++)
+ {
+ for (int i=0;i<sl.size();i++)
+ {
+ if (!strcmp(slist.get(j)->getProperty().getName(),
+ sl.get(i)->getProperty().getName())
+
+
+ && slist.get(j)->getIndex() ==
+ sl.get(i)->getIndex())
+ {
+ // these are settings of the same prop/index, we
+ // need the old value to get transferred.
+ sl.remove(i);
+ sl.insert(i,new Setting(*(slist.get(j))));
+
+ }
+ }
+ }
+ LOGINFO(INFO, "ChangeSummary: Erasing from changes");
+ changedMap.erase(ob);
+ }
+ // We append deleted objects to the changed list - this list gives
+ // those data objects which have been affected - we then look at their
+ // current and old property values to find out whether they have been
+ // deleted or created.
+ else
+ {
+ changedDataObjects.append(ob, ChangedDataObjectList::Delete);
+ }
+
+ LOGINFO(INFO,"ChangeSummary: Deletion being added to the list");
+
+ return;
+ }
+
+ void ChangeSummaryImpl::logCreation(DataObjectImpl* ob,
+ DataObjectImpl* container, const Property& prop)
+ {
+
+ LOGINFO_1(INFO,"ChangeSummary:LogCreate of type:%s",ob->getType().getName());
+
+ // These we just need to record the fact that they
+ // are present. We dont have an original value to
+ // store.
+ // log a change to the container of this object
+ //
+
+ DELETELOG_MAP::iterator deleteLogIter;
+
+ deleteLogIter = deletedMap.find(ob);
+ if (deleteLogIter != deletedMap.end())
+ {
+ // can happen - a delete is really a removal from the tree.
+ // Adding back an object which you held a pointer to is just
+ // a re-creation.
+ LOGINFO(INFO,"ChangeSummary: Adding in a pre-deleted object");
+ }
+
+ // we should check if this object has sub-objects, they will
+ // need to be created too
+
+ PropertyList pl = ob->getInstanceProperties();
+ for (unsigned int p=0;p<pl.size();p++)
+ {
+ Property& thisprop = pl[p];
+ if (!thisprop.getType().isDataType())
+ {
+ if (ob->isSet(thisprop))
+ {
+ DataObject* dp;
+
+ if (thisprop.isMany())
+ {
+ DataObjectList& dol = ob->getList(thisprop);
+ for (unsigned int ds = 0; ds < dol.size(); ds++)
+ {
+ dp = getRawPointer(dol[ds]);
+ if (!dp) continue;
+ logCreation((DataObjectImpl*)dp,ob,thisprop);
+ }
+ }
+ else
+ {
+ dp = getRawPointer(ob->getDataObject(thisprop));
+ if (dp)
+ {
+ logCreation((DataObjectImpl*)dp,ob,thisprop);
+ }
+ }
+ }
+ }
+ }
+
+ CREATELOG_MAP::iterator createLogIter;
+
+ createLogIter = createdMap.find(ob);
+ if (createLogIter != createdMap.end())
+ {
+ // this could be a reference - we dont add it twice.
+ LOGINFO(INFO,"ChangeSummary: No need to log creation twice");
+ return;
+ }
+
+ // We append created objects to the changed list - this list gives
+ // those data objects which have been affected - we then look at their
+ // current and old property values to find out whether they have been
+ // deleted or created.
+ changedDataObjects.append(ob, ChangedDataObjectList::Create);
+
+ createdMap.insert(std::make_pair(ob,createLogItem(ob->getType(),prop,container)));
+ return;
+ }
+
+
+ void ChangeSummaryImpl::setPropValue(void** value, unsigned int* len, DataObjectImpl* ob, const Property& prop)
+ {
+
+ *len = 0;
+ switch (prop.getTypeEnum())
+ {
+ case Type::BooleanType:
+ *value = new long;
+ if (!ob->isSet(prop) && !prop.isDefaulted())
+ {
+ *(long*)value = 0;
+ }
+ else
+ {
+ *(long*)*value = (long)ob->getBoolean(prop);
+ }
+ break;
+ case Type::ByteType:
+ *value = new long;
+ if (!ob->isSet(prop) && !prop.isDefaulted())
+ {
+ *(long*)value = 0;
+ }
+ else
+ {
+ *(long*)*value = (long)ob->getByte(prop);
+ }
+ break;
+ case Type::CharacterType:
+ *value = new long;
+ if (!ob->isSet(prop) && !prop.isDefaulted())
+ {
+ *(long*)value = 0;
+ }
+ else
+ {
+ *(long*)*value = (long)ob->getCharacter(prop);
+ }
+ break;
+ case Type::IntType:
+ *value = new long;
+ if (!ob->isSet(prop) && !prop.isDefaulted())
+ {
+ *(long*)value = 0;
+ }
+ else
+ {
+ *(long*)*value = (long)ob->getInt(prop);
+ }
+ break;
+ case Type::ShortType:
+ *value = new long;
+ if (!ob->isSet(prop) && !prop.isDefaulted())
+ {
+ *(long*)value = 0;
+ }
+ else
+ {
+ *(long*)*value = (long)ob->getShort(prop);
+ }
+ break;
+ case Type::DoubleType:
+ *value = new long double;
+ if (!ob->isSet(prop) && !prop.isDefaulted())
+ {
+ *(long double*)value = (long double)0;
+ }
+ else
+ {
+ *(long double*)*value = (long double)ob->getDouble(prop);
+ }
+ break;
+ case Type::FloatType:
+ *value = new float;
+ if (!ob->isSet(prop) && !prop.isDefaulted())
+ {
+ *(float*)value = (float)0;
+ }
+ else
+ {
+ *(float*)*value = (float)ob->getFloat(prop);
+ }
+ break;
+ case Type::LongType:
+ *value = new int64_t;
+ if (!ob->isSet(prop) && !prop.isDefaulted())
+ {
+ *(int64_t*)value = (int64_t)0;
+ }
+ else
+ {
+ *(int64_t*)*value = (int64_t)ob->getLong(prop);
+ }
+ break;
+ case Type::DateType:
+ *value = new long;
+ if (!ob->isSet(prop) && !prop.isDefaulted())
+ {
+ *(long*)value = (long)0;
+ }
+ else
+ {
+ *(long*)*value = (long)(ob->getDate(prop).getTime());
+ }
+ break;
+ case Type::BigDecimalType:
+ case Type::BigIntegerType:
+ case Type::StringType:
+ case Type::UriType:
+ if (!ob->isSet(prop) && !prop.isDefaulted())
+ {
+ *value = 0;
+ *len = 0;
+ }
+ else
+ {
+ unsigned int siz = ob->getLength(prop);
+ if (siz > 0) {
+ *value = new wchar_t[siz];
+ *len = ob->getString(prop,(wchar_t*)*value, siz);
+ }
+ else {
+ *value = 0;
+ *len = 0;
+ }
+ }
+ break;
+ case Type::BytesType:
+ if (!ob->isSet(prop) && !prop.isDefaulted())
+ {
+ *value = 0;
+ *len = 0;
+ }
+ else
+ {
+ unsigned int siz = ob->getLength(prop);
+ if (siz > 0) {
+ *value = new char[siz];
+ *len = ob->getBytes(prop,(char*)*value, siz);
+ }
+ else {
+ *value = 0;
+ *len = 0;
+ }
+ }
+ break;
+ case Type::OtherTypes:
+ case Type::DataObjectType:
+ case Type::ChangeSummaryType:
+ if (!ob->isSet(prop) && !prop.isDefaulted())
+ {
+ *value = 0;
+ }
+ else
+ {
+ *value = (void*)getRawPointer(ob->getDataObject(prop));
+ }
+ break;
+ default:
+ throw SDOUnsupportedOperationException(TUSCANY_SDO_EINFO,
+ "Type is not recognised and cannot be saved");
+ break;
+ }
+ }
+
+ void ChangeSummaryImpl::setManyPropValue(void** value, unsigned int *len, DataObjectImpl* ob,
+ DataObjectImpl* listob, const Property& prop)
+ {
+
+ *len = 0;
+ switch (prop.getTypeEnum())
+ {
+ case Type::BooleanType:
+ *value = new long;
+ if (!ob->isSet(prop) && !prop.isDefaulted())
+ {
+ *(long*)value = (long)0;
+ }
+ else
+ {
+ *(long*)*value = (long)listob->getBoolean();
+ }
+ break;
+ case Type::ByteType:
+ *value = new long;
+ if (!ob->isSet(prop) && !prop.isDefaulted())
+ {
+ *(long*)value = (long)0;
+ }
+ else
+ {
+ *(long*)*value = (long)listob->getByte();
+ }
+ break;
+ case Type::CharacterType:
+ *value = new long;
+ if (!ob->isSet(prop) && !prop.isDefaulted())
+ {
+ *(long*)value = (long)0;
+ }
+ else
+ {
+ *(long*)*value = (long)listob->getCharacter();
+ }
+ break;
+ case Type::IntType:
+ *value = new long;
+ if (!ob->isSet(prop) && !prop.isDefaulted())
+ {
+ *(long*)value = (long)0;
+ }
+ else
+ {
+ *(long*)*value = (long)listob->getInt();
+ }
+ break;
+ case Type::ShortType:
+ *value = new long;
+ if (!ob->isSet(prop) && !prop.isDefaulted())
+ {
+ *(long*)value = (long)0;
+ }
+ else
+ {
+ *(long*)*value = (long)listob->getShort();
+ }
+ break;
+ case Type::DoubleType:
+ *value = new long double;
+ if (!ob->isSet(prop) && !prop.isDefaulted())
+ {
+ *(long double*)value = (long double)0;
+ }
+ else
+ {
+ *(long double*)*value = (long double)listob->getDouble();
+ }
+ break;
+ case Type::FloatType:
+ *value = new float;
+ if (!ob->isSet(prop) && !prop.isDefaulted())
+ {
+ *(float*)value = (float)0;
+ }
+ else
+ {
+ *(float*)*value = (float)listob->getFloat();
+ }
+ break;
+ case Type::LongType:
+ *value = new int64_t;
+ if (!ob->isSet(prop) && !prop.isDefaulted())
+ {
+ *(int64_t*)value = (int64_t)0;
+ }
+ else
+ {
+ *(int64_t*)*value = (int64_t)listob->getLong();
+ }
+ break;
+ case Type::DateType:
+ *value = new long;
+ if (!ob->isSet(prop) && !prop.isDefaulted())
+ {
+ *(long*)value = (long)0;
+ }
+ else
+ {
+ *(long*)*value = (long)(listob->getDate().getTime());
+ }
+ break;
+ case Type::BigDecimalType:
+ case Type::BigIntegerType:
+ case Type::StringType:
+ case Type::UriType:
+ if (!ob->isSet(prop) && !prop.isDefaulted())
+ {
+ *value = 0;
+ *len = 0;
+ }
+ else
+ {
+ unsigned int siz = listob->getLength(prop);
+ if (siz > 0)
+ {
+ *value = new wchar_t[siz];
+ *len = listob->getString((wchar_t*)*value, siz);
+ }
+ }
+ break;
+ case Type::BytesType:
+ if (!ob->isSet(prop) && !prop.isDefaulted())
+ {
+ *value = 0;
+ *len = 0;
+ }
+ else
+ {
+ unsigned int siz = listob->getLength(prop);
+ if (siz > 0)
+ {
+ *value = new char[siz];
+ *len = listob->getBytes((char*)*value, siz);
+ }
+ }
+ break;
+
+ case Type::OtherTypes:
+ case Type::DataObjectType:
+ case Type::ChangeSummaryType:
+ throw SDOUnsupportedOperationException(TUSCANY_SDO_EINFO,
+ "A many prop data object value is being set");
+ break;
+ default:
+ throw SDOUnsupportedOperationException(TUSCANY_SDO_EINFO,
+ "Type is not recognised and cannot be saved");
+ break;
+ }
+ }
+
+ void ChangeSummaryImpl::logChange(DataObjectImpl* ob,
+ const Property& prop)
+ {
+ // need to record the old value, unless the object
+ // is in the created list, in which case we store
+ // nothing.
+
+ LOGINFO_1(INFO,"ChangeSummary:LogChange %s",prop.getName());
+
+ CREATELOG_MAP::iterator createLogIter;
+
+ unsigned int len;
+
+ createLogIter = createdMap.find(ob);
+ if (createLogIter != createdMap.end())
+ {
+ LOGINFO(INFO,"ChangeSummary: no need to log change");
+ return;
+ }
+
+ DELETELOG_MAP::iterator deleteLogIter;
+
+ deleteLogIter = deletedMap.find(ob);
+ if (deleteLogIter != deletedMap.end())
+ {
+ LOGINFO(INFO,"ChangeSummary: no need to log change - already deleted");
+ return;
+ }
+
+ CHANGELOG_MAP::iterator changeLogIter;
+
+ changeLogIter = changedMap.find(ob);
+ if (changeLogIter == changedMap.end())
+ {
+ LOGINFO(INFO,"ChangeSummary: A change to an object which was not previously changed");
+ changedMap.insert(std::make_pair(ob, changeLogItem(ob->getType(),prop,
+ ob->getSequence(), ob)));
+ changedDataObjects.append(ob, ChangedDataObjectList::Change);
+ }
+ else
+ {
+ LOGINFO(INFO,"ChangeSummary: A change to an object which has already been changed");
+ }
+
+ changeLogIter = changedMap.find(ob);
+ if (changeLogIter == changedMap.end())
+ {
+ LOGINFO(INFO,"ChangeSummary: Problem - no changes to append to");
+ return;
+ }
+
+ SettingList& slist = (changeLogIter->second).getSettings();
+
+ void* value;
+
+ for (int i=0;i<slist.size();i++)
+ {
+ if (!strcmp(slist.get(i)->getProperty().getName(),prop.getName()))
+ {
+ LOGINFO(INFO,"ChangeSummary: Change of a property which was already changed - ignore");
+ return;
+ }
+ }
+
+ // need to check if the property has already been set,
+ // There could be many Settings if the item was a list,
+ // but we dont care here about that.
+
+ if (!ob->isSet(prop))
+ {
+ slist.append(new Setting(false,false,0,0,prop,0));
+ return;
+ }
+
+ if (prop.isMany())
+ {
+ // We are appending, not modifying
+ // we need to store the list as it was.
+
+ LOGINFO(INFO,"ChangeSummary: logging a change to a many valued property");
+
+ DataObjectList& dol = ob->getList(prop);
+ if (dol.size() == 0)
+ {
+ slist.append(new Setting(false,false,0,0,prop,0));
+ return;
+ }
+ for (unsigned int i=0;i< dol.size(); i++)
+ {
+ DataObject* dob = getRawPointer(dol[i]);
+ if (prop.getType().isDataType()) {
+ setManyPropValue(&value, &len, (DataObjectImpl*)ob,
+ (DataObjectImpl*)dob, prop);
+ slist.append(new Setting(true,false,value,len,prop,i));
+ }
+ else{
+ value = (void*)dob;
+ slist.append(new Setting(true,false,value,0,prop,i));
+ }
+ }
+ }
+ else
+ {
+ setPropValue(&value,&len,ob,prop);
+ slist.append(new Setting(true,ob->isNull(prop),value,len,prop,0));
+ }
+
+ return;
+ }
+
+
+
+ void ChangeSummaryImpl::undoChanges()
+ {
+ // TODO
+ /* Plan for undoChanges:
+
+ There are three lists of information.
+ The created list is a list of data objects which were created during logging.
+ These data objects will have current state, and will represent the value of a
+ property of their containing object. As they had no state before they were
+ created, the undoChanges needs to unSet the property values for these first.
+
+ The deleted list contains a list of objects which were deleted. The objects
+ themselves are not valid, but can be used to obtain a list of settings
+ representing the values of the properties at the time the object was
+ deleted. Here are recursive create is needed to re-create an object
+ similar to the deleted one, and set its properties using the settings.
+ The deleted object may well contain other deleted objects as its
+ property values, so these too will have entries in the deleted list, and
+ need to be found and re-created.
+
+ The changed list holds a list of settings for properties of data objects
+ which have been changed. These objects may also be in the deleted list, so#
+ may not be valid. They will not be in the created list. First check that
+ the object is not in the deleted list. If it is, then the changes need to
+ be applied to the data object which we created when undoing the deleted list,
+ otherwise we just apply the change to a data object which exists.
+ */
+
+ /* what about items in many-valued properties? I guess we need to check and
+ search the values returned for the list to find the object to delete*/
+ LOGINFO(INFO,"ChangeSummary UndoChanges not implemented");
+ return;
+ }
+
+
+ void ChangeSummaryImpl::beginLogging()
+ {
+
+ // Clear down the lists and their contents, if there was already
+ // some activity.
+
+ if (logging) endLogging();
+ changedMap.clear();
+ deletedMap.clear();
+ createdMap.clear();
+ changedDataObjects.clear();
+
+ LOGINFO(INFO,"ChangeSummary: logging switched on");
+
+ logging = true;
+ return;
+ }
+
+ void ChangeSummaryImpl::endLogging()
+ {
+ logging = false;
+
+ LOGINFO(INFO,"ChangeSummary: logging switched off");
+
+ return;
+ }
+
+ bool ChangeSummaryImpl::isLogging()
+ {
+ return logging;
+ }
+
+///////////////////////////////////////////////////////////////////////////////////////
+ void ChangeSummaryImpl::debugPrint(){}
+// {
+// ChangedDataObjectList& dol = getChangedDataObjects();
+//
+// CREATELOG_MAP::iterator createLogIter;
+// DELETELOG_MAP::iterator deleteLogIter;
+// CHANGELOG_MAP::iterator changeLogIter;
+//
+// for (int i=0;i<dol.size(); i++)
+// {
+// DataObject* dob = dol[i];
+// createLogIter = createdMap.find((DataObjectImpl*)dob);
+// if (createLogIter != createdMap.end())
+// {
+// cout << "Found a created object " << dol[i] << endl;
+// return;
+// }
+// deleteLogIter = deletedMap.find((DataObjectImpl*)dob);
+// if (deleteLogIter != deletedMap.end())
+// {
+// cout << "Found a deleted object " << dol[i] << endl;
+// return;
+// }
+// changeLogIter = changedMap.find((DataObjectImpl*)dob);
+// if (changeLogIter != changedMap.end())
+// {
+// cout << "Found a modified object " << dol[i] << endl;
+// SettingList& sl = getOldValues(dob);
+// for (int j=0; j < sl.size(); j++)
+// {
+// cout << "Old Value of " << sl[j].getProperty().getName();
+// if (sl[j].getProperty().isMany())
+// {
+// cout << "[" << sl[j].getIndex() << "]" ;
+// }
+// cout << endl;
+// switch (sl[j].getProperty().getTypeEnum())
+// {
+// case Type::BooleanType:
+// cout << "Boolean:" << sl[j].getBooleanValue();
+// break;
+// case Type::ByteType:
+// cout << "Byte:" << sl[j].getByteValue();
+// break;
+// case Type::CharacterType:
+// cout << "Character:" << sl[j].getCharacterValue();
+// break;
+// case Type::IntType:
+// cout << "Integer:" << sl[j].getIntegerValue();
+// break;
+// case Type::ShortType:
+// cout << "Short:" << sl[j].getShortValue();
+// break;
+// case Type::DoubleType:
+// cout << "Double:" << sl[j].getDoubleValue();
+// break;
+// case Type::FloatType:
+// cout << "Float:" << sl[j].getFloatValue();
+// break;
+// case Type::LongType:
+// cout << "Int64: (cant print)"; // << (*sl)[j]->getLongValue();
+// break;
+// case Type::DateType:
+// cout << "Date:" << sl[j].getDateValue().getTime();
+// break;
+// case Type::BigDecimalType:
+// case Type::BigIntegerType:
+// case Type::StringType:
+// case Type::UriType:
+// {
+// unsigned int len = sl[j].getLength();
+// if (len > 0) {
+// wchar_t* buf = new wchar_t[len];
+// len = sl[j].getStringValue(buf,len);
+// cout <<"String type" ;
+// for (int i=0;i<len;i++)
+// {
+// cout << ":" << buf[i];
+// }
+// delete buf;
+// }
+// break;
+// }
+// case Type::BytesType:
+// {
+// unsigned int len = sl[j].getLength();
+// if (len > 0) {
+// char* buf = new char[len];
+// len = sl[j].getBytesValue(buf,len);
+// cout <<"Bytes type" ;
+// for (int i=0;i<len;i++)
+// {
+// cout << buf[i];
+// }
+// delete buf;
+// }
+// break;
+// }
+// case Type::OtherTypes:
+// case Type::DataObjectType:
+// case Type::ChangeSummaryType:
+// cout << "DataObject:" << sl[j].getDataObjectValue();
+// break;
+// default:
+// cout << "Unspecified type found in setting";
+// break;
+// }
+// cout << endl;
+// }
+// return;
+// }
+// cout << "Found an object which was not in the changes " << dol[i] << endl;
+//
+// }
+// }
+///////////////////////////////////////////////////////////////////////////////////////
+
+ ChangedDataObjectList& ChangeSummaryImpl::getChangedDataObjects()
+ {
+ // build a list of all the changes, in the same order
+ // as the actions occured,
+
+ return changedDataObjects;
+
+ }
+
+ bool ChangeSummaryImpl::isCreated(DataObjectPtr dol)
+ {
+ CREATELOG_MAP::iterator createLogIter;
+ DataObject* dob = getRawPointer(dol);
+ createLogIter = createdMap.find((DataObjectImpl*)dob);
+
+ if (createLogIter != createdMap.end())
+ return true;
+ return false;
+ }
+
+ bool ChangeSummaryImpl::isDeleted(DataObjectPtr dol)
+ {
+ DELETELOG_MAP::iterator deleteLogIter;
+ DataObject* dob = getRawPointer(dol);
+ deleteLogIter = deletedMap.find((DataObjectImpl*)dob);
+
+ if (deleteLogIter != deletedMap.end())
+ return true;
+ return false;
+ }
+
+ bool ChangeSummaryImpl::isModified(DataObjectPtr dol)
+ {
+ CHANGELOG_MAP::iterator changeLogIter;
+ DataObject* dob = getRawPointer(dol);
+ changeLogIter = changedMap.find((DataObjectImpl*)dob);
+
+ if (changeLogIter != changedMap.end())
+ return true;
+ return false;
+ }
+
+
+
+ SettingList& ChangeSummaryImpl::getOldValues(DataObjectPtr dol)
+ {
+ CHANGELOG_MAP::iterator changeLogIter;
+ DELETELOG_MAP::iterator deleteLogIter;
+ DataObject* dob = getRawPointer(dol);
+ // start with the deleted map...
+ deleteLogIter = deletedMap.find((DataObjectImpl*)dob);
+ if (deleteLogIter != deletedMap.end()){
+ return ((deleteLogIter->second).getSettings());
+ }
+ changeLogIter = changedMap.find((DataObjectImpl*)dob);
+ if (changeLogIter != changedMap.end()){
+ return ((changeLogIter->second).getSettings());
+ }
+ throw SDOIndexOutOfRangeException(TUSCANY_SDO_EINFO,
+ "Data object is not in the change summary");
+ }
+
+
+
+ const char* ChangeSummaryImpl::getOldXpath(RefCountingPointer<commonj::sdo::DataObject> dol)
+ {
+ DELETELOG_MAP::iterator deleteLogIter;
+ DataObject* dob = getRawPointer(dol);
+ deleteLogIter = deletedMap.find((DataObjectImpl*)dob);
+ if (deleteLogIter != deletedMap.end()){
+ return ((deleteLogIter->second).getOldXpath());
+ }
+ return 0;
+ }
+
+
+ const Setting& ChangeSummaryImpl::getOldValue(DataObjectPtr dol, const Property& property)
+ {
+ DELETELOG_MAP::iterator deleteLogIter;
+ CHANGELOG_MAP::iterator changeLogIter;
+ DataObject* dob = getRawPointer(dol);
+
+ deleteLogIter = deletedMap.find((DataObjectImpl*)dob);
+ if (deleteLogIter != deletedMap.end())
+ {
+ SettingList& sl = (deleteLogIter->second).getSettings();
+ for (int i=0;i < sl.size(); i++)
+ {
+ if (!strcmp(property.getName(),
+ sl.get(i)->getProperty().getName()))
+ return (*sl.get(i));
+ }
+ }
+
+ changeLogIter = changedMap.find((DataObjectImpl*)dob);
+ if (changeLogIter != changedMap.end())
+ {
+ SettingList& sl = (changeLogIter->second).getSettings();
+ for (int i=0;i < sl.size(); i++)
+ {
+ if (!strcmp(property.getName(),
+ sl.get(i)->getProperty().getName()))
+ return (*sl.get(i));
+ }
+ }
+
+ throw SDOIndexOutOfRangeException(TUSCANY_SDO_EINFO,
+ "Data object is not in the change summary");
+ }
+
+ DataObjectPtr ChangeSummaryImpl::getOldContainer(DataObjectPtr dol)
+ {
+ CHANGELOG_MAP::iterator changeLogIter;
+ DataObject* dob = getRawPointer(dol);
+ changeLogIter = changedMap.find((DataObjectImpl*)dob);
+
+ if (changeLogIter != changedMap.end())
+ {
+ return (changeLogIter->second).getOldContainer();
+ }
+ return 0;
+ }
+
+ const Property& ChangeSummaryImpl::getOldContainmentProperty(DataObjectPtr dol)
+ {
+ CHANGELOG_MAP::iterator changeLogIter;
+ DataObject* dob = getRawPointer(dol);
+ changeLogIter = changedMap.find((DataObjectImpl*)dob);
+
+ if (changeLogIter == changedMap.end())
+ {
+ throw SDOIndexOutOfRangeException(TUSCANY_SDO_EINFO,
+ "Data object is not in the change summary");
+ }
+ return (changeLogIter->second).getOldContainmentProperty();
+ }
+
+
+ //
+ // Creations and deletions can be just logged in the normal
+ // way. Changes have to be handled specially, because we
+ // need the old value, but the data object now contains the
+ // current value.
+ //
+
+ void ChangeSummaryImpl::appendToCreations(const Property& p,
+ DataObjectPtr dob, DataObjectPtr cont)
+ {
+ LOGINFO(INFO,"ChangeSummary: Appending to creations list");
+ DataObject* pdob = getRawPointer(dob);
+ DataObject* pcont = getRawPointer(cont);
+ logCreation((DataObjectImpl*)pdob,(DataObjectImpl*)pcont,p);
+ return;
+ }
+
+
+ void ChangeSummaryImpl::appendToDeletions(const Property& p,
+ DataObjectPtr dob, DataObjectPtr cont, const char* oldpath )
+ {
+ DELETELOG_MAP::iterator deleteLogIter;
+
+ LOGINFO_1(INFO,"ChangeSummary:Appending to deletions list %s",oldpath);
+
+ DataObject* pdob = getRawPointer(dob);
+ DataObject* pcont = getRawPointer(cont);
+ logDeletion((DataObjectImpl*)pdob,(DataObjectImpl*)pcont,p,
+ oldpath, false);
+ return;
+ }
+
+
+ unsigned int ChangeSummaryImpl::stringConvert(char** value, const char* c, const Property& p)
+ {
+ // code duplicated from typeimpl
+ switch (p.getTypeEnum())
+ {
+ case Type::BooleanType:
+ *value = new char[sizeof(long)];
+ if ((c == 0) || strcmp(c,"true"))
+ {
+ *(long*)*value = 0;
+ }
+ else
+ {
+ *(long*)*value = 1;
+ }
+ return sizeof(long);
+
+ case Type::ByteType:
+ case Type::CharacterType:
+ case Type::IntType:
+ case Type::ShortType:
+ *value = new char[sizeof(long)];
+ *(long*)*value = atoi(c);
+ return sizeof(long);
+
+ case Type::DoubleType:
+ *value = new char[sizeof(long double)];
+ // TODO - atof not suitable here
+ *(long double*)*value = (long double)atof(c);
+ return sizeof(long double);
+
+ case Type::FloatType:
+ *value = new char[sizeof(float)];
+ *(float*)*value = (float)atof(c);
+ return sizeof(float);
+
+ case Type::LongType:
+ *value = new char[sizeof(int64_t)];
+#if defined(WIN32) || defined (_WINDOWS)
+ *(int64_t*)*value = (int64_t)_atoi64(c);
+#else
+ *(int64_t*)*value = (int64_t)strtoll(c, NULL, 0);
+#endif
+ return sizeof(int64_t);
+
+ case Type::DateType:
+ *value = new char[sizeof(time_t)];
+ *(time_t*)*value = (time_t)atoi(c);
+ return sizeof(time_t);
+
+ case Type::BigDecimalType:
+ case Type::BigIntegerType:
+ case Type::StringType:
+ case Type::UriType:
+ {
+ char* vw = new char[(strlen(c)+1)*sizeof(wchar_t)];
+ wchar_t* pvw = (wchar_t*)vw;
+ for (unsigned int i=0;i< strlen(c);i++)
+ {
+ pvw[i] = (wchar_t)c[i];
+ }
+ pvw[strlen(c)] = 0;
+ *value = vw;
+ return strlen(c);
+ }
+ break;
+ case Type::BytesType:
+ {
+ char* vc = new char[strlen(c)+1];
+ for (unsigned int i=0;i< strlen(c);i++)
+ {
+ vc[i] = (char)c[i];
+ }
+ vc[strlen(c)] = 0;
+ *value = vc;
+ return strlen(c);
+ }
+ break;
+
+ case Type::OtherTypes:
+ case Type::DataObjectType:
+ case Type::ChangeSummaryType:
+ default:
+ {
+ std::string msg("Cannot set CString on object of type:");
+ msg += p.getType().getName();
+ throw SDOInvalidConversionException(TUSCANY_SDO_EINFO,
+ msg.c_str());
+ break;
+ }
+ }
+ return 0;
+ }
+
+ void ChangeSummaryImpl::appendToChanges(const Property& p,
+ DataObjectPtr dob , SDOXMLString value, int index)
+ {
+ CHANGELOG_MAP::iterator changeLogIter;
+
+ LOGINFO(INFO,"ChangeSummary Appending to changes list");
+
+ DataObject* pdob = getRawPointer(dob);
+
+
+ changeLogIter = changedMap.find((DataObjectImpl*)pdob);
+ if (changeLogIter == changedMap.end())
+ {
+
+ LOGINFO(INFO,"ChangeSummary: A change to an object which was not previously changed");
+
+ changedMap.insert(std::make_pair((DataObjectImpl*)pdob,
+ changeLogItem(dob->getType(),p,
+ dob->getSequence(), (DataObjectImpl*)pdob)));
+ changedDataObjects.append((DataObjectImpl*)pdob,
+ ChangedDataObjectList::Change);
+ }
+
+ changeLogIter = changedMap.find((DataObjectImpl*)pdob);
+ if (changeLogIter == changedMap.end())
+ {
+
+ LOGINFO(INFO,"ChangeSummary: no changes to append to");
+
+ return;
+ }
+
+ SettingList& slist = (changeLogIter->second).getSettings();
+
+ // simply need to insert a setting - no requirement to validate
+ // against existing settings
+
+ char* datavalue = 0;
+
+ unsigned int len = stringConvert(&datavalue, (const char*)value , p);
+
+ slist.append(new Setting(true,false,datavalue,len,p,index));
+
+ // The datavalue will be freed by the deletion of the setting later
+ }
+
+
+ void ChangeSummaryImpl::appendToChanges(const Property& p,
+ DataObjectPtr dob , DataObjectPtr indob, int index)
+ {
+ CHANGELOG_MAP::iterator changeLogIter;
+
+ LOGINFO(INFO,"ChangeSummary Appending to changes list (2)");
+
+ DataObject* pdob = getRawPointer(dob);
+
+ changeLogIter = changedMap.find((DataObjectImpl*)pdob);
+ if (changeLogIter == changedMap.end())
+ {
+ LOGINFO(INFO,"ChangeSummary: A change to an object which was not previously changed");
+
+ changedMap.insert(std::make_pair((DataObjectImpl*)pdob,
+ changeLogItem(dob->getType(),p,
+ dob->getSequence(), (DataObjectImpl*)pdob)));
+ changedDataObjects.append((DataObjectImpl*)pdob,
+ ChangedDataObjectList::Change);
+ }
+
+ changeLogIter = changedMap.find((DataObjectImpl*)pdob);
+ if (changeLogIter == changedMap.end())
+ {
+ LOGINFO(INFO,"ChangeSummary: Problem - no changes to append to");
+
+ return;
+ }
+
+ SettingList& slist = (changeLogIter->second).getSettings();
+
+ // simply need to insert a setting - no requirement to validate
+ // against existing settings
+
+
+ slist.append(new Setting(true,false,(void*)getRawPointer(indob),0,p,index));
+
+ }
+
+
+
+
+ /////////////////////////////////////////////////////////////
+ // log items are for all lists, but contain different things
+ // depending on whether they are deletions, additions...
+ /////////////////////////////////////////////////////////////
+
+ createLogItem::createLogItem(const Type& tp, const Property& prop,
+ DataObjectImpl* cont) :
+ theOldContainmentProperty(prop), theOldContainer(cont),
+ theType(tp)
+ {
+ }
+
+ DataObjectImpl* createLogItem::getOldContainer()
+ {
+ return theOldContainer;
+ }
+
+ const Type& createLogItem::getOldType()
+ {
+ return theType;
+ }
+
+ const Property& createLogItem::getOldContainmentProperty()
+ {
+ return theOldContainmentProperty;
+ }
+
+
+
+ changeLogItem::changeLogItem(const Type& tp,
+ const Property& prop,
+ SequencePtr seq,
+ DataObjectImpl* cont) :
+ theOldContainmentProperty(prop), theOldContainer(cont),
+ theType(tp)
+ {
+ if (seq)
+ {
+ theSequence = new SequenceImpl((SequenceImpl*)getRawPointer(seq));
+ }
+ else
+ {
+ theSequence = 0;
+ }
+ }
+
+ changeLogItem::changeLogItem(const changeLogItem& cin) :
+ theOldContainmentProperty(cin.theOldContainmentProperty),
+ theType(cin.theType)
+ {
+ if (cin.theSequence) {
+ theSequence = new SequenceImpl((SequenceImpl*)getRawPointer(cin.theSequence));
+ }
+ else {
+ theSequence = 0;
+ }
+ theOldContainer = cin.theOldContainer;
+ theSettings = cin.theSettings;
+
+ }
+
+ changeLogItem::~changeLogItem()
+ {
+ }
+
+ DataObjectImpl* changeLogItem::getOldContainer()
+ {
+ return theOldContainer;
+ }
+
+ const Type& changeLogItem::getOldType()
+ {
+ return theType;
+ }
+
+ const Property& changeLogItem::getOldContainmentProperty()
+ {
+ return theOldContainmentProperty;
+ }
+
+ SettingList& changeLogItem::getSettings()
+ {
+ return theSettings;
+ }
+
+ SequencePtr changeLogItem::getSequence()
+ {
+ return theSequence;
+ }
+
+
+ deleteLogItem::deleteLogItem(DataObject* dob,
+ const Property& prop, SequencePtr seq ,
+ const char* oldpath, DataObjectImpl* cont
+ ) :
+ theOldContainmentProperty(prop), theOldContainer(cont),
+ theActualObject(dob),
+ theType(dob->getType())
+ {
+ if (seq)
+ {
+ theSequence = new SequenceImpl((SequenceImpl*)getRawPointer(seq));
+ }
+ else
+ {
+ theSequence = 0;
+ }
+ if (oldpath !=0 && strlen(oldpath) != 0)
+ {
+ theOldXpath = new char[strlen(oldpath)+1];
+ strcpy(theOldXpath,oldpath);
+ }
+ else
+ {
+ theOldXpath = 0;
+ }
+ }
+
+ const char* deleteLogItem::getOldXpath()
+ {
+ return theOldXpath;
+ }
+
+ DataObjectImpl* deleteLogItem::getOldContainer()
+ {
+ return theOldContainer;
+ }
+
+ deleteLogItem::deleteLogItem(const deleteLogItem& cin):
+ theOldContainmentProperty(cin.theOldContainmentProperty),
+ theType(cin.theType), theActualObject(cin.theActualObject)
+ {
+ if (cin.theSequence) {
+ theSequence = new SequenceImpl((SequenceImpl*)getRawPointer(cin.theSequence));
+ }
+ else {
+ theSequence = 0;
+ }
+ theOldContainer = cin.theOldContainer;
+ theSettings = cin.theSettings;
+ if (cin.theOldXpath != 0)
+ {
+ theOldXpath = new char[strlen(cin.theOldXpath) + 1];
+ strcpy(theOldXpath, cin.theOldXpath);
+ }
+ else
+ {
+ theOldXpath = 0;
+ }
+ }
+
+ deleteLogItem::~deleteLogItem()
+ {
+ theActualObject = 0;
+ if (theOldXpath != 0)
+ {
+ delete[] theOldXpath;
+ }
+ }
+
+ const Type& deleteLogItem::getOldType()
+ {
+ return theType;
+ }
+
+ const Property& deleteLogItem::getOldContainmentProperty()
+ {
+ return theOldContainmentProperty;
+ }
+
+ SettingList& deleteLogItem::getSettings()
+ {
+ return theSettings;
+ }
+
+ SequencePtr deleteLogItem::getSequence()
+ {
+ return theSequence;
+ }
+
+ void deleteLogItem::setSequence(SequencePtr s)
+ {
+ if (s) {
+ theSequence = new SequenceImpl((SequenceImpl*)getRawPointer(s));
+ }
+ else {
+ theSequence = 0;
+ }
+ return;
+ }
+
+};
+};
+
diff --git a/sdo-cpp/trunk/runtime/core/src/commonj/sdo/ChangeSummaryImpl.h b/sdo-cpp/trunk/runtime/core/src/commonj/sdo/ChangeSummaryImpl.h
new file mode 100644
index 0000000000..6137532315
--- /dev/null
+++ b/sdo-cpp/trunk/runtime/core/src/commonj/sdo/ChangeSummaryImpl.h
@@ -0,0 +1,405 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you 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$ */
+
+#ifndef _CHANGESUMMARYIMPL_H_
+#define _CHANGESUMMARYIMPL_H_
+
+#include "commonj/sdo/disable_warn.h"
+
+
+#include "commonj/sdo/ChangedDataObjectListImpl.h"
+#include "commonj/sdo/SettingList.h"
+#include "commonj/sdo/ChangeSummary.h"
+#include "commonj/sdo/RefCountingPointer.h"
+#include "commonj/sdo/SDOXMLString.h"
+
+#include <map>
+
+namespace commonj{
+namespace sdo {
+
+
+ /**
+ * ChangeLogItem is a part of a change summary.
+ * The change summary consisists of change items,
+ * deletion items and creation items. They are held in three
+ * lists as they have slightly different contents.
+ * The change log items hold old values for all the changes to
+ * properties of the data object concerned.
+ */
+
+ class changeLogItem {
+
+ public:
+
+ changeLogItem(const Type& tp, const Property& prop,SequencePtr seq,
+ DataObjectImpl* cont = 0 );
+ changeLogItem(const changeLogItem& cin);
+ ~changeLogItem();
+ DataObjectImpl* getOldContainer();
+ const Property& getOldContainmentProperty();
+ const Type& getOldType();
+ SettingList& getSettings();
+ SequencePtr getSequence();
+
+ private:
+
+ const Property& theOldContainmentProperty;
+ DataObjectImpl* theOldContainer;
+ const Type& theType;
+ SettingList theSettings;
+ SequencePtr theSequence;
+ };
+
+ /**
+ * CreateLogItem is a part of a change summary.
+ * The change summary consisists of change items,
+ * deletion items and creation items. They are held in three
+ * lists as they have slightly different contents.
+ * The create log items hold the data object itself,
+ * and details of its container.
+ */
+
+
+ class createLogItem {
+
+ public:
+
+ createLogItem(const Type& tp, const Property& prop, DataObjectImpl* cont = 0);
+
+
+ DataObjectImpl* getOldContainer();
+ const Property& getOldContainmentProperty();
+ const Type& getOldType();
+
+ private:
+
+ const Property& theOldContainmentProperty;
+ DataObjectImpl* theOldContainer;
+ const Type& theType;
+ };
+
+ /**
+ * DeleteLogItem is a part of a change summary.
+ * The change summary consisists of change items,
+ * deletion items and creation items. They are held in three
+ * lists as they have slightly different contents.
+ * The delete log items hold the old data object , and
+ * details of the properties as they were before deletion
+ */
+
+ class deleteLogItem {
+
+ public:
+
+
+ deleteLogItem(DataObject* dob, const Property& prop,
+ SequencePtr seq,const char *oldpath,
+ DataObjectImpl* cont = 0);
+
+
+ deleteLogItem(const deleteLogItem& cin);
+ ~deleteLogItem();
+ DataObjectImpl* getOldContainer();
+ const Property& getOldContainmentProperty();
+ const Type& getOldType();
+ const char* getOldXpath();
+ SettingList& getSettings();
+ SequencePtr getSequence();
+ void setSequence(SequencePtr s);
+
+ private:
+
+ const Property& theOldContainmentProperty;
+ DataObjectImpl* theOldContainer;
+
+ /** theActualObject
+ * A counting pointer to the object is held, such that the
+ * object is not freed, even if deleted. This rcp will not
+ * be used to refer to the object, but makes sure that the
+ * object does not reuse a memory address of a previously
+ * deleted object until the change summary is destroyed.
+ */
+
+ RefCountingPointer<DataObject> theActualObject;
+ const Type& theType;
+ SettingList theSettings;
+ SequencePtr theSequence;
+ char * theOldXpath;
+ };
+
+
+ /** ChangeSummaryImpl implements the abstract class ChangeSummary.
+ * The change summary consisists of change items,
+ * deletion items and creation items. They are held in three
+ * lists as they have slightly different contents.
+ */
+
+ class ChangeSummaryImpl : public ChangeSummary
+ {
+ public:
+ ChangeSummaryImpl();
+
+ virtual ~ChangeSummaryImpl();
+
+ /**
+ * The new and modified objects in the list are references to objects that
+ * are associated with this change summary.
+ * The deleted objects in the list are references to copies of the objects
+ * as they appeared at the time that event logging was enabled;
+ * if the deleted objects have references to other objects,
+ * the references will also refer to copies of the target objects.
+ * Return a list of changed data objects.
+ */
+
+ virtual ChangedDataObjectList& getChangedDataObjects();
+
+
+ /** getOldSettings returns a list of settings.
+ * Returns a list of Settings
+ * that represent the property values of the given dataObject
+ * at the point when logging began.
+ * In the case of a deleted object,
+ * the list will include Settings for all the properties.
+ * An old value Setting indicates the value at the
+ * point logging begins. A setting is only produced for
+ * modified objects if either the old value differs from the current value or
+ * if the isSet differs from the current value.
+ * No Settings are produced for created objects.
+ * Param dataObject the object in question.
+ * Return a list of settings.
+ */
+ virtual SettingList& getOldValues(DataObjectPtr dataObject);
+
+ /** getOldXpath returns the old path before the setting.
+ *
+ * Returns a path where the object was located before the setting took place.
+ */
+ virtual const char* getOldXpath(RefCountingPointer<commonj::sdo::DataObject> dol);
+
+
+ /** beginLogging() sets the change summary in logging mode.
+ *
+ * The change summary is initially inactive. Setting it to logging mode
+ * starts the process of recording all the settings made.
+ */
+
+ virtual void beginLogging();
+
+ /** endLogging() stops logging.
+ *
+ * This method stops logging, but does not clear out the change summary.
+ * The changes are valid until the summary is next set to logging, at which time
+ * all old settings are lost.
+ */
+ virtual void endLogging();
+
+
+
+ /** isLogging() returns true if logging is enabled.
+ *
+ * Indicates whether change logging is on (true) or off (false).
+ */
+
+ virtual bool isLogging();
+
+
+
+ /** isCreated() returns true if the object was created during logging.
+ *
+ * Returns whether or not the specified data object was created while logging.
+ * Any object that was added to the data graph
+ * but was not in the data graph when logging began,
+ * will be considered created.
+ * Param dataObject the data object in question.
+ * Return true if the specified data object was created.
+ */
+ virtual bool isCreated(DataObjectPtr dataObject);
+
+ /** isDeleted() - true if the object was deleted during logging.
+ *
+ * Returns whether or not the specified data object was deleted while logging.
+ * Any object that is not contained by the data graph will be considered
+ * deleted.
+ * Param dataObject the data object in question.
+ * Return true if the specified data object was deleted.
+ */
+ virtual bool isDeleted(DataObjectPtr dataObject);
+
+
+ /** isModified() - true if the object was changed during logging.
+ *
+ * Returns whether or not the specified data object was updated while logging.
+ * An object that was contained in the data graph when logging began,
+ * and remains in the graph when logging ends will be considered for changes.
+ * An object considered modified must have at least one old value Setting.
+ * Param dataObject the data object in question.
+ * Return true if the specified data object was modified.
+ */
+ virtual bool isModified(DataObjectPtr dataObject);
+
+ /** getOldValue() gets the setting showing the old value.
+ *
+ * Returns a setting for the specified property
+ * representing the property value of the given dataObject
+ * at the point when logging began.
+ * Returns null if the property has not changed and
+ * has not been deleted.
+ * Param dataObject the object in question.
+ * Param property the property of the object.
+ * Return the Setting for the specified property.
+ */
+
+ virtual const Setting& getOldValue(DataObjectPtr dataObject, const Property& property);
+
+ /** getOldContainer() gets the container before the setting.
+ *
+ * Returns the value of the container data object
+ * at the point when logging began.
+ * Param dataObject the object in question.
+ * Return the old container data object.
+ */
+ virtual DataObjectPtr getOldContainer(DataObjectPtr dataObject);
+
+ /** getOldContainmentProperty() - gives the property before setting.
+ *
+ * Returns the value of the containment property data object property
+ * at the point when logging began.
+ * Param dataObject the object in question.
+ * Return the old containment property.
+ */
+ virtual const Property& getOldContainmentProperty(DataObjectPtr dataObject);
+
+ /** undoChanges() - Not Implemented.
+ *
+ * NOT IMPLEMENTED
+ *
+ * Undoes all changes in the log to restore the tree of
+ * DataObjects to its original state when logging began.
+ * isLogging() is unchanged. The log is cleared.
+ */
+ virtual void undoChanges();
+
+ /** getOldSequence() - Not Implemented.
+ *
+ * NOT IMPLEMENTED
+ *
+ * This method gives back the sequence of a data object as it
+ * appeared when logging was switched on. The data object may be
+ * a deleted data object or a changed data object. If the
+ * data object was not sequenced, this returns null.
+ */
+
+ virtual SDO_API SequencePtr getOldSequence(DataObjectPtr dataObject);
+
+ bool isInCreatedMap(DataObjectImpl* ob);
+
+ void logDeletion(DataObjectImpl* ob,
+ DataObjectImpl* cont, const Property& prop,
+ const char* oldpath,
+ bool loggingChildren = true
+ );
+
+ void logCreation(DataObjectImpl* ob,
+ DataObjectImpl* cont, const Property& prop
+ );
+
+ void logChange(DataObjectImpl* ob, const Property& prop
+ );
+
+
+ SDO_API void debugPrint();
+
+ void removeFromChanges(DataObjectImpl* ob);
+
+
+ /**
+ * appendToCreations is used by deserialization
+ * This method helps to rebuild a change summary by populating the
+ * lists without the changes actually being logged.
+ */
+
+ void appendToCreations(const Property& p,
+ DataObjectPtr dob,
+ DataObjectPtr cont);
+
+
+ /**
+ * appendToDeletions is used by deserialization
+ * This method helps to rebuild a change summary by populating the
+ * lists without the changes actually being logged.
+ */
+ void appendToDeletions(const Property& p,
+ DataObjectPtr dob,
+ DataObjectPtr cont,
+ const char* oldpath);
+
+
+ unsigned int stringConvert(
+ char** value,
+ const char* c,
+ const Property& p);
+
+ /**
+ * appendToChangesis used by deserialization
+ * This method helps to rebuild a change summary by populating the
+ * lists without the changes actually being logged.
+ */
+
+ void appendToChanges(const Property& p,
+ DataObjectPtr dob,
+ SDOXMLString value,
+ int index);
+
+ void appendToChanges(const Property& p,
+ DataObjectPtr dob,
+ DataObjectPtr pdob,
+ int index);
+
+ DataObjectPtr matchDeletedObject(SDOXMLString path);
+
+
+ private:
+
+
+ void setPropValue(void** value, unsigned int *len, DataObjectImpl* ob, const Property& prop);
+ void setManyPropValue(void** value, unsigned int *len, DataObjectImpl* ob,
+ DataObjectImpl* listob, const Property& prop);
+ bool logging;
+
+ typedef std::map<DataObjectImpl*, createLogItem> CREATELOG_MAP;
+ typedef std::map<DataObjectImpl*, deleteLogItem> DELETELOG_MAP;
+ typedef std::map<DataObjectImpl*, changeLogItem> CHANGELOG_MAP;
+
+ CHANGELOG_MAP changedMap;
+ CREATELOG_MAP createdMap;
+ DELETELOG_MAP deletedMap;
+
+ ChangedDataObjectListImpl changedDataObjects;
+
+
+
+
+
+};
+};
+};
+#endif //_CHANGESUMMARYIMPL_H_
diff --git a/sdo-cpp/trunk/runtime/core/src/commonj/sdo/ChangedDataObjectList.h b/sdo-cpp/trunk/runtime/core/src/commonj/sdo/ChangedDataObjectList.h
new file mode 100644
index 0000000000..ed4ee8e585
--- /dev/null
+++ b/sdo-cpp/trunk/runtime/core/src/commonj/sdo/ChangedDataObjectList.h
@@ -0,0 +1,93 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you 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$ */
+
+#ifndef _CHANGEDDATAOBJECTLIST_H_
+#define _CHANGEDDATAOBJECTLIST_H_
+
+
+#include "commonj/sdo/RefCountingPointer.h"
+
+#include <vector>
+
+/**
+ * namespace commonj is the root namespace for SDO
+ */
+
+namespace commonj{
+
+/**
+ * sdo is the namespace holding the SDO core
+ */
+
+namespace sdo{
+
+class DataObject;
+
+/**
+ *
+ * A list for holding a record of changes which have happened
+ * during logging in a change summary.
+ */
+
+class ChangedDataObjectList
+{
+
+public:
+
+/** \enum ChangeType
+ *
+ * An enum for create, change or delete types in a change record
+ */
+ enum ChangeType
+ {
+ Undefined,
+ Create,
+ Change,
+ Delete
+ };
+
+/** [] is the index operator.
+ *
+ * Gets the nth element of a list
+ */
+ virtual SDO_API DataObjectPtr operator[] (unsigned int pos) = 0;
+ virtual SDO_API const DataObjectPtr operator[] (unsigned int pos) const = 0;
+
+/** size() returns the number of list elements.
+ *
+ * Returns the number of list elements
+ */
+
+ virtual SDO_API unsigned int size () const = 0;
+
+/** getType() returns the type of a list element.
+ *
+ * The type of change is one of the enum ChangeType, being a
+ * creation, a deletion or an update.
+ */
+
+ virtual SDO_API ChangeType getType(unsigned int index) = 0;
+
+};
+};
+};
+#endif
+
diff --git a/sdo-cpp/trunk/runtime/core/src/commonj/sdo/ChangedDataObjectListImpl.cpp b/sdo-cpp/trunk/runtime/core/src/commonj/sdo/ChangedDataObjectListImpl.cpp
new file mode 100644
index 0000000000..eeed697623
--- /dev/null
+++ b/sdo-cpp/trunk/runtime/core/src/commonj/sdo/ChangedDataObjectListImpl.cpp
@@ -0,0 +1,247 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you 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$ */
+
+#include "commonj/sdo/ChangedDataObjectListImpl.h"
+
+
+#include <iostream>
+#include "commonj/sdo/Property.h"
+#include "commonj/sdo/Type.h"
+#include "commonj/sdo/DataObject.h"
+#include "commonj/sdo/Logger.h"
+#include "commonj/sdo/SDORuntimeException.h"
+#include "commonj/sdo/DataObjectImpl.h"
+
+
+namespace commonj{
+namespace sdo {
+
+ /** CDOListElement
+ *
+ * constructor
+ */
+
+ CDOListElement::CDOListElement()
+ {
+ theObject = 0;
+ theType = ChangedDataObjectList::Undefined;
+ }
+
+ /** CDOListElement
+ *
+ * constructor from a data object and a change
+ */
+
+ CDOListElement::CDOListElement(DataObject* in, ChangedDataObjectList::ChangeType type)
+ {
+ theObject = in;
+ theType = type;
+ }
+
+ /** ~CDOListElement()
+ *
+ * destructor
+ */
+
+ CDOListElement::~CDOListElement()
+ {
+ }
+
+ /** getObject()
+ *
+ * return the changed data object
+ */
+
+ DataObject* CDOListElement::getObject() const
+ {
+ return theObject;
+ }
+
+ /**
+ *
+ * return the type of change getType()
+ */
+
+ ChangedDataObjectList::ChangeType CDOListElement::getType() const
+ {
+ return theType;
+ }
+
+ /** ChangedDataObjectListImpl
+ *
+ * constructor
+ */
+
+ ChangedDataObjectListImpl::ChangedDataObjectListImpl(CHANGEDDATAOBJECT_VECTOR p) : plist (p)
+ {
+ }
+
+ /** ChangedDataObjectListImpl
+ *
+ * copy constructor
+ */
+
+ ChangedDataObjectListImpl::ChangedDataObjectListImpl(const ChangedDataObjectListImpl &pin)
+ {
+ plist = std::vector< CDOListElement >(pin.getVec());
+ }
+
+ /** ChangedDataObjectListImpl
+ *
+ * default constructor
+ */
+
+ ChangedDataObjectListImpl::ChangedDataObjectListImpl()
+ {
+ }
+
+
+ /** ~ChangedDataObjectListImpl
+ *
+ * destructor
+ */
+
+ ChangedDataObjectListImpl::~ChangedDataObjectListImpl()
+ {
+ }
+
+ /** [] index operator
+ *
+ *
+ */
+
+ RefCountingPointer<DataObject> ChangedDataObjectListImpl::operator[] (unsigned int pos)
+ {
+ validateIndex(pos);
+ return plist[pos].getObject();
+ }
+
+ /** [] index operator
+ *
+ *
+ */
+
+ const RefCountingPointer<DataObject> ChangedDataObjectListImpl::operator[] (unsigned int pos) const
+ {
+ validateIndex(pos);
+ return plist[pos].getObject();
+ }
+
+ /** get() gets an element at the index.
+ *
+ */
+
+ DataObject* ChangedDataObjectListImpl::get(unsigned int pos)
+ {
+ validateIndex(pos);
+ return plist[pos].getObject();
+ }
+
+ /** size() returns the length of the list.
+ *
+ *
+ */
+
+ unsigned int ChangedDataObjectListImpl::size () const
+ {
+ return plist.size();
+ }
+
+ /** getVec()
+ * gets the vector which actually stores the data objects.
+ */
+
+ CHANGEDDATAOBJECT_VECTOR ChangedDataObjectListImpl::getVec() const
+ {
+ return plist;
+ }
+
+ /** getType()
+ * returns the type of the change.
+ */
+
+ ChangedDataObjectList::ChangeType ChangedDataObjectListImpl::getType(unsigned int pos)
+ {
+ validateIndex(pos);
+ return plist[pos].getType();
+ }
+
+
+ /** insert()
+ * inserts an element into the list.
+ */
+
+ void ChangedDataObjectListImpl::insert (unsigned int index,
+ DataObject *d, ChangedDataObjectList::ChangeType type)
+ {
+ plist.insert(plist.begin()+index, CDOListElement((DataObject*)d,type));
+ }
+
+ /** append()
+ * appends to the end of the list.
+ */
+
+ void ChangedDataObjectListImpl::append (DataObject *d, ChangedDataObjectList::ChangeType type)
+ {
+ plist.push_back(CDOListElement((DataObject*)d, type));
+ }
+
+ /** clear()
+ * empties the list.
+ */
+
+ void ChangedDataObjectListImpl::clear ()
+ {
+ plist.clear();
+ }
+
+
+ /** remove()
+ * removes an item from the list.
+ */
+
+ void ChangedDataObjectListImpl::remove(unsigned int index)
+ {
+ validateIndex(index);
+ plist.erase(plist.begin() +index);
+ return ;
+ }
+
+ /** validateIndex()
+ * checks that the index is in range.
+ */
+
+ void ChangedDataObjectListImpl::validateIndex(unsigned int index) const
+ {
+ if ((index < 0) || (index >= size()))
+ {
+ std::string msg("Invalid index : ");
+ msg += index;
+ throw SDOIndexOutOfRangeException(TUSCANY_SDO_EINFO,
+ msg.c_str());
+
+ }
+ }
+
+
+} // end namespace sdo
+} // end namespace commonj
+
diff --git a/sdo-cpp/trunk/runtime/core/src/commonj/sdo/ChangedDataObjectListImpl.h b/sdo-cpp/trunk/runtime/core/src/commonj/sdo/ChangedDataObjectListImpl.h
new file mode 100644
index 0000000000..9baa6747e9
--- /dev/null
+++ b/sdo-cpp/trunk/runtime/core/src/commonj/sdo/ChangedDataObjectListImpl.h
@@ -0,0 +1,99 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you 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$ */
+
+#ifndef _ChangedDataObjectListImplIMPL_H_
+#define _ChangedDataObjectListImplIMPL_H_
+
+#include "commonj/sdo/disable_warn.h"
+
+
+#include <vector>
+
+#include "commonj/sdo/ChangedDataObjectList.h"
+namespace commonj{
+namespace sdo{
+
+class DataObjectImpl;
+class DataObject;
+
+/**
+ * CDOListElement is an element of the changed data object list
+ * in a change summary,it may be a delete, addition or change.
+ */
+
+class CDOListElement
+{
+public:
+ CDOListElement ();
+ CDOListElement (DataObject* in, ChangedDataObjectList::ChangeType type);
+ virtual ~CDOListElement();
+ virtual ChangedDataObjectList::ChangeType getType() const;
+ virtual DataObject* getObject() const;
+private:
+ DataObject* theObject;
+ ChangedDataObjectList::ChangeType theType;
+};
+
+typedef std::vector< CDOListElement > CHANGEDDATAOBJECT_VECTOR;
+
+
+/**
+ * ChangedDataObjectListImpl implements ChangedDataObjectList, part of a
+ * change summary.
+ * This is the list of objects which have been altered during
+ * logging of a change summary.
+ */
+
+class ChangedDataObjectListImpl : public ChangedDataObjectList
+{
+
+public:
+ ChangedDataObjectListImpl(CHANGEDDATAOBJECT_VECTOR p);
+ ChangedDataObjectListImpl(const ChangedDataObjectListImpl &pin);
+ ChangedDataObjectListImpl();
+
+ virtual ~ChangedDataObjectListImpl();
+ virtual DataObjectPtr operator[] (unsigned int pos);
+ virtual const DataObjectPtr operator[] (unsigned int pos) const;
+ virtual DataObject* get(unsigned int pos);
+ virtual ChangedDataObjectList::ChangeType getType(unsigned int pos);
+
+
+ virtual unsigned int size () const;
+
+ virtual void insert (unsigned int index, DataObject *d, ChangedDataObjectList::ChangeType type);
+
+ virtual void append (DataObject* d, ChangedDataObjectList::ChangeType type);
+
+ virtual void clear();
+
+ virtual void remove (unsigned int index);
+
+
+private:
+ CHANGEDDATAOBJECT_VECTOR plist;
+ CHANGEDDATAOBJECT_VECTOR getVec() const;
+
+ void validateIndex(unsigned int index) const;
+};
+};
+};
+#endif
diff --git a/sdo-cpp/trunk/runtime/core/src/commonj/sdo/CopyHelper.cpp b/sdo-cpp/trunk/runtime/core/src/commonj/sdo/CopyHelper.cpp
new file mode 100644
index 0000000000..304abbe54d
--- /dev/null
+++ b/sdo-cpp/trunk/runtime/core/src/commonj/sdo/CopyHelper.cpp
@@ -0,0 +1,598 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you 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$ */
+
+#include "commonj/sdo/Property.h"
+#include "commonj/sdo/Type.h"
+#include "commonj/sdo/TypeList.h"
+#include "commonj/sdo/Sequence.h"
+#include "commonj/sdo/RefCountingPointer.h"
+#include "commonj/sdo/DataObjectImpl.h"
+
+
+#include "commonj/sdo/CopyHelper.h"
+
+#include <iostream>
+using namespace std;
+namespace commonj{
+namespace sdo{
+
+ /** CopyHelper provides static copying helper functions.
+ *
+ * CopyHelper provides shallow and deep copy of data objects.
+ * copyShallow() copies the DataType members of the data object.
+ * copy() copies all the members and recurses downwards though
+ * the data graph
+ */
+
+ void CopyHelper::transferitem(DataObjectPtr to, DataObjectPtr from, const Property& p)
+ {
+ if (from->isNull(p)) {
+ to->setNull(p);
+ return;
+ }
+
+ switch (p.getTypeEnum())
+ {
+ case Type::BooleanType:
+ to->setBoolean( p, from->getBoolean(p));
+ break;
+ case Type::ByteType:
+ to->setByte( p, from->getByte(p));
+ break;
+ case Type::CharacterType:
+ to->setCharacter( p, from->getCharacter(p));
+ break;
+ case Type::IntType:
+ to->setInt( p, from->getInt(p));
+ break;
+ case Type::ShortType:
+ to->setShort( p,from->getShort(p));
+ break;
+ case Type::DoubleType:
+ to->setDouble( p, from->getDouble(p));
+ break;
+ case Type::FloatType:
+ to->setFloat( p, from->getFloat(p));
+ break;
+ case Type::LongType:
+ to->setLong( p, from->getLong(p));
+ break;
+ case Type::DateType:
+ to->setDate( p, from->getDate(p));
+ break;
+ case Type::BigDecimalType:
+ case Type::BigIntegerType:
+ case Type::UriType:
+ case Type::StringType:
+ {
+ unsigned int siz = from->getLength(p);
+ if (siz > 0)
+ {
+ wchar_t * buf = new wchar_t[siz];
+ from->getString(p,buf, siz);
+ to->setString(p, buf, siz);
+ delete[] buf;
+ }
+ else
+ {
+ // property is set to a NULL value
+ to->setString(p, (const wchar_t*)0, 0);
+ }
+ }
+ break;
+ case Type::BytesType:
+ {
+ unsigned int siz = from->getLength(p);
+ if (siz > 0)
+ {
+ char * buf = new char[siz];
+ from->getBytes(p,buf, siz);
+ to->setBytes(p, buf, siz);
+ delete buf;
+ }
+ else
+ {
+ // property is set to a NULL value
+ to->setBytes(p, (const char*)0, 0);
+ }
+ }
+ break;
+ default:
+ break;
+ } // switch
+ }
+
+ void CopyHelper::transferlist(DataObjectList& to, DataObjectList& from, Type::Types t)
+ {
+ for (unsigned int i=0;i< from.size(); i++)
+ {
+ switch (t)
+ {
+ case Type::BooleanType:
+ to.append(from.getBoolean(i));
+ break;
+ case Type::ByteType:
+ to.append(from.getByte(i));
+ break;
+ case Type::CharacterType:
+ to.append(from.getCharacter(i));
+ break;
+#if __WORDSIZE ==64
+ case Type::IntType:
+ to.append((int64_t)(from.getInteger(i)));
+ break;
+#else
+ case Type::IntType:
+ to.append(from.getInt(i));
+ break;
+#endif
+ case Type::ShortType:
+ to.append(from.getShort(i));
+ break;
+ case Type::DoubleType:
+ to.append(from.getDouble(i));
+ break;
+ case Type::FloatType:
+ to.append(from.getFloat(i));
+ break;
+ case Type::LongType:
+ to.append(from.getLong(i));
+ break;
+ case Type::DateType:
+ to.append(from.getDate(i));
+ break;
+ case Type::BigDecimalType:
+ case Type::BigIntegerType:
+ case Type::UriType:
+ case Type::StringType:
+ {
+ unsigned int siz = from.getLength(i);
+ if (siz > 0)
+ {
+ wchar_t * buf = new wchar_t[siz];
+ from.getString(i,buf,siz);
+ to.append(buf,siz);
+ delete buf;
+ }
+ else
+ {
+ // Property is set to a NULL value
+ to.append((const wchar_t*)0, 0);
+ }
+ }
+ break;
+
+ case Type::BytesType:
+ {
+ unsigned int siz = from.getLength(i);
+ if (siz > 0)
+ {
+ char * buf = new char[siz];
+ from.getBytes(i,buf,siz);
+ to.append(buf,siz);
+ delete buf;
+ }
+ else
+ {
+ // Property is set to a NULL value
+ to.append((const char*)0, 0);
+ }
+ }
+ break;
+
+ default:
+ break;
+ } // case
+ } // for
+ } // method
+
+
+
+ void CopyHelper::transfersequenceitem(SequencePtr to, SequencePtr from, const Property& p, int index)
+ {
+ switch (p.getTypeEnum())
+ {
+ case Type::BooleanType:
+ to->addBoolean( p, from->getBooleanValue(index));
+ break;
+ case Type::ByteType:
+ to->addByte( p, from->getByteValue(index));
+ break;
+ case Type::CharacterType:
+ to->addCharacter( p, from->getCharacterValue(index));
+ break;
+ case Type::IntType:
+ to->addInt( p, from->getIntValue(index));
+ break;
+ case Type::ShortType:
+ to->addShort( p,from->getShortValue(index));
+ break;
+ case Type::DoubleType:
+ to->addDouble( p, from->getDoubleValue(index));
+ break;
+ case Type::FloatType:
+ to->addFloat( p, from->getFloatValue(index));
+ break;
+ case Type::LongType:
+ to->addLong( p, from->getLongValue(index));
+ break;
+ case Type::DateType:
+ to->addDate( p, from->getDateValue(index));
+ break;
+ case Type::BigDecimalType:
+ case Type::BigIntegerType:
+ case Type::UriType:
+ case Type::StringType:
+ {
+ unsigned int siz = from->getLength(index);
+ if (siz > 0)
+ {
+ wchar_t * buf = new wchar_t[siz];
+ from->getStringValue(index, buf, siz);
+ to->addString(p, buf, siz);
+ delete[] buf;
+ }
+ else
+ {
+ // property is set to a NULL value
+ to->addString(p, 0, 0);
+ }
+ }
+ break;
+ case Type::BytesType:
+ {
+ unsigned int siz = from->getLength(index);
+ if (siz > 0)
+ {
+ char * buf = new char[siz];
+ from->getBytesValue(index, buf, siz);
+ to->addBytes(p, buf, siz);
+ delete buf;
+ }
+ else
+ {
+ // property is set to a NULL value
+ to->addBytes(p, 0, 0);
+ }
+ }
+ break;
+ default:
+ break;
+ } // switch
+ }
+
+ /** CopyHelper provides static copying helper functions.
+ *
+ * copyShallow() copies the DataType members of the data object.
+ * copy() copies all the members and recurses downwards though
+ * the data graph
+ */
+ DataObjectPtr CopyHelper::copyShallow(DataObjectPtr dataObject)
+ {
+ return internalCopy(dataObject, false);
+
+ }
+
+ /** CopyHelper provides static copying helper functions.
+ *
+ * copyShallow() copies the DataType members of the data object.
+ * copy() copies all the members and recurses downwards though
+ * the data graph
+ */
+ DataObjectPtr CopyHelper::copy(DataObjectPtr dataObject)
+ {
+ DataObjectPtr newob = internalCopy(dataObject, true);
+ resolveReferences(dataObject, newob);
+ return newob;
+ }
+
+ DataObjectPtr CopyHelper::internalCopy(DataObjectPtr dataObject,
+ bool fullCopy)
+ {
+
+ DataObject* theob = getRawPointer(dataObject);
+ if (!theob) return 0;
+
+ DataFactoryPtr fac = ((DataObjectImpl*)theob)->getDataFactory();
+ if (!fac) return 0;
+
+ const Type& t = dataObject->getType();
+ DataObjectPtr newob = fac->create(t);
+ if (!newob) return 0;
+
+ if ( dataObject->getType().isSequencedType() )
+ {
+ SequencePtr fromSequence = dataObject->getSequence();
+ int sequence_length = fromSequence->size();
+
+ SequencePtr toSequence = newob->getSequence();
+
+ for (int i=0;i < sequence_length; i++)
+ {
+ if ( fromSequence->isText(i) )
+ {
+ const char *text = fromSequence->getCStringValue(i);
+ toSequence->addText(i, text);
+ }
+ else
+ {
+ const Property& seqProperty = fromSequence->getProperty(i);
+ SDOXMLString seqPropertyName = seqProperty.getName();
+ const Type& seqPropertyType = seqProperty.getType();
+
+ if (seqPropertyType.isDataObjectType())
+ {
+ if (!fullCopy)
+ {
+ continue;
+ }
+ else
+ {
+ DataObjectPtr dob;
+
+ // retrieve the data object to be copied
+ if (seqProperty.isMany())
+ {
+ int index = fromSequence->getListIndex(i);
+ dob = dataObject->getList(seqProperty)[index];
+ }
+ else
+ {
+ dob = dataObject->getDataObject(seqProperty);
+ }
+
+ // do the copying of referencing
+ if (dob)
+ {
+ // Handle non-containment reference to DataObject
+ if (seqProperty.isReference())
+ {
+ // add just the reference into the sequence
+ // This will be resolved to a new reference later
+ // This is really bad but we need to add something to the
+ // sequence here to maintain the ordering
+ toSequence->addDataObject(seqProperty, 0);
+ }
+ else
+ {
+ // make a copy of the data object itself
+ // and add it to the sequence
+ toSequence->addDataObject(seqProperty,
+ internalCopy(dob,
+ true));
+ }
+ }
+ }
+ }
+ else
+ {
+ // Sequence member is a primitive
+ transfersequenceitem(toSequence,
+ fromSequence,
+ seqProperty,
+ i);
+
+ }
+ } // is it a text element
+ } // for all elements in sequence
+ }
+ else
+ {
+ PropertyList pl = dataObject->getInstanceProperties();
+ for (unsigned int i=0;i < pl.size(); i++)
+ {
+ if (dataObject->isSet(pl[i]))
+ {
+ // data objects are only copied in the deep copy case
+ if (pl[i].getType().isDataObjectType())
+ {
+ if (!fullCopy)
+ {
+ continue;
+ }
+ else
+ {
+ if (pl[i].isMany())
+ {
+ DataObjectList& dolold = dataObject->getList(pl[i]);
+ DataObjectList& dolnew = newob->getList(pl[i]);
+ for (unsigned int li=0;li< dolold.size(); li++)
+ {
+ // references are maintained to the old object if it
+ // is outside of the copy tree
+ if (pl[i].isReference())
+ {
+ // have to resolve references in a 2nd pass
+ }
+ else
+ {
+ dolnew.append(internalCopy(dolold[li],true));
+ }
+ }
+ }
+ else
+ {
+ if (dataObject->isNull(pl[i])) {
+ newob->setNull(pl[i]);
+ continue;
+ }
+
+ DataObjectPtr dob = dataObject->getDataObject(pl[i]);
+ if (pl[i].isReference())
+ {
+ // have to resolve references in a 2nd pass
+ }
+ else
+ {
+ newob->setDataObject(pl[i],internalCopy(dob,true));
+ }
+ }
+ }
+ }
+ else
+ {
+ if (pl[i].isMany())
+ {
+ DataObjectList& dolold = dataObject->getList(pl[i]);
+ DataObjectList& dolnew = newob->getList(pl[i]);
+ transferlist(dolnew,dolold, pl[i].getTypeEnum());
+ }
+ else
+ {
+ transferitem(newob,dataObject, pl[i]);
+ }
+ } // else
+ }
+ }
+ }
+
+ return newob;
+ }
+
+ void CopyHelper::resolveReferences(DataObjectPtr oldDO, DataObjectPtr newDO)
+ {
+ // Iterate through the properties to find references.
+ // If the reference is to a DataObject with the copied tree then we can
+ // set it to reference the DO in the new tree, otherwise it is left unset.
+
+ findReferences(oldDO, newDO, oldDO, newDO);
+
+ }
+
+ void CopyHelper::findReferences(DataObjectPtr oldDO, DataObjectPtr newDO,
+ DataObjectPtr obj, DataObjectPtr newObj)
+ {
+ if (!obj) return;
+
+ if ( obj->getType().isSequencedType() )
+ {
+ SequencePtr fromSequence = obj->getSequence();
+ int sequence_length = fromSequence->size();
+
+ SequencePtr toSequence = newObj->getSequence();
+
+ for (int i=0;i < sequence_length; i++)
+ {
+ if (!fromSequence->isText(i) )
+ {
+ const Property& seqProperty = fromSequence->getProperty(i);
+ SDOXMLString seqPropertyName = seqProperty.getName();
+ const Type& seqPropertyType = seqProperty.getType();
+
+ if (seqProperty.isReference())
+ {
+ DataObjectPtr ref = findReference(oldDO, newDO, fromSequence->getDataObjectValue(i));
+ if (ref)
+ {
+ if (seqProperty.isMany())
+ {
+ int index = fromSequence->getListIndex(i);
+ newObj->getList(seqProperty).setDataObject(index, ref);
+ }
+ else
+ {
+ toSequence->setDataObjectValue(i, ref);
+ }
+
+ }
+ }
+ else if (seqPropertyType.isDataObjectType())
+ {
+ findReferences(oldDO, newDO, fromSequence->getDataObjectValue(i), toSequence->getDataObjectValue(i));
+ }
+ }
+
+ } // for all elements in sequence
+
+ }
+ else
+ {
+ PropertyList pl = obj->getInstanceProperties();
+ for (unsigned int i=0;i < pl.size(); i++)
+ {
+ if (!obj->isSet(pl[i]))
+ continue;
+
+ if (!pl[i].getType().isDataObjectType())
+ continue;
+
+ if (pl[i].isMany())
+ {
+ DataObjectList& dolold = obj->getList(pl[i]);
+ DataObjectList& dolnew = newObj->getList(pl[i]);
+ for (unsigned int li=0;li< dolold.size(); li++)
+ {
+ if (pl[i].isReference())
+ {
+ DataObjectPtr ref = findReference(oldDO, newDO, dolold[li]);
+ if (ref)
+ {
+ dolnew.setDataObject(li, ref);
+ }
+ }
+ else
+ {
+ findReferences(oldDO, newDO, dolold[li], dolnew[li]);
+ }
+ }
+ }
+ else
+ {
+ if (pl[i].isReference())
+ {
+ DataObjectPtr ref = findReference(oldDO, newDO, obj->getDataObject(pl[i]));
+ if (ref)
+ {
+ newObj->setDataObject(pl[i], ref);
+ }
+ }
+ else
+ {
+ findReferences(oldDO, newDO, obj->getDataObject(pl[i]), newObj->getDataObject(pl[i]));
+ }
+ }
+ }
+ }
+ }
+
+ DataObjectPtr CopyHelper::findReference(DataObjectPtr oldDO, DataObjectPtr newDO, DataObjectPtr ref)
+ {
+ SDOString rootXPath = staticCast<DataObjectImplPtr>(oldDO)->objectToXPath();
+ SDOString refXPath = staticCast<DataObjectImplPtr>(ref)->objectToXPath();
+
+ DataObjectPtr newRef;
+ if (refXPath.find(refXPath) == 0)
+ {
+ SDOString relXPath = refXPath.substr(rootXPath.length());
+ if (relXPath == "")
+ newRef = newDO;
+ if (relXPath.find("/") == 0)
+ relXPath = relXPath.substr(1);
+ newRef = newDO->getDataObject(relXPath);
+ }
+
+ return newRef;
+ }
+
+
+}
+};
+
diff --git a/sdo-cpp/trunk/runtime/core/src/commonj/sdo/CopyHelper.h b/sdo-cpp/trunk/runtime/core/src/commonj/sdo/CopyHelper.h
new file mode 100644
index 0000000000..63ec54ab83
--- /dev/null
+++ b/sdo-cpp/trunk/runtime/core/src/commonj/sdo/CopyHelper.h
@@ -0,0 +1,76 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you 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$ */
+
+#ifndef _COPYHELPER_H_
+#define _COPYHELPER_H_
+
+
+#include "commonj/sdo/DataObject.h"
+#include "commonj/sdo/RefCountingPointer.h"
+
+namespace commonj{
+namespace sdo{
+
+ /** CopyHelper provides static copying helper functions.
+ *
+ * CopyHelper provides shallow and deep copy of data objects.
+ * copyShallow() copies the DataType members of the data object.
+ * copy() copies all the members and recurses downwards though
+ * the data graph
+ */
+
+class CopyHelper
+{
+ public:
+
+ /** CopyHelper provides static copying helper functions.
+ *
+ * CopyHelper provides shallow and deep copy of data objects.
+ * copyShallow() copies the DataType members of the data object.
+ * copy() copies all the members and recurses downwards though
+ * the data graph
+ */
+ static SDO_API DataObjectPtr copyShallow(DataObjectPtr dataObject);
+
+ /** CopyHelper provides static copying helper functions.
+ *
+ * CopyHelper provides shallow and deep copy of data objects.
+ * copyShallow() copies the DataType members of the data object.
+ * copy() copies all the members and recurses downwards though
+ * the data graph
+ */
+ static SDO_API DataObjectPtr copy(DataObjectPtr dataObject);
+
+ private:
+ static void transferlist(DataObjectList& to, DataObjectList& from, Type::Types t);
+ static void transferitem(DataObjectPtr to, DataObjectPtr from, const Property& p);
+ static void transfersequenceitem(SequencePtr to, SequencePtr from, const Property& p, int index);
+
+ static DataObjectPtr internalCopy(DataObjectPtr dataObject, bool fullCopy);
+ static void resolveReferences(DataObjectPtr oldDO, DataObjectPtr newDO);
+ static void findReferences(DataObjectPtr oldDO, DataObjectPtr newDO, DataObjectPtr obj, DataObjectPtr newObj);
+ static DataObjectPtr findReference(DataObjectPtr oldDO, DataObjectPtr newDO, DataObjectPtr ref);
+
+};
+};
+};
+
+#endif //_COPYHELPER_H_
diff --git a/sdo-cpp/trunk/runtime/core/src/commonj/sdo/DASProperty.cpp b/sdo-cpp/trunk/runtime/core/src/commonj/sdo/DASProperty.cpp
new file mode 100644
index 0000000000..15354d0d61
--- /dev/null
+++ b/sdo-cpp/trunk/runtime/core/src/commonj/sdo/DASProperty.cpp
@@ -0,0 +1,34 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you 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$ */
+
+#include "commonj/sdo/DASProperty.h"
+
+
+namespace commonj{
+namespace sdo{
+
+
+ DASProperty::~DASProperty()
+ {
+ }
+};
+};
+
diff --git a/sdo-cpp/trunk/runtime/core/src/commonj/sdo/DASProperty.h b/sdo-cpp/trunk/runtime/core/src/commonj/sdo/DASProperty.h
new file mode 100644
index 0000000000..6ebf241723
--- /dev/null
+++ b/sdo-cpp/trunk/runtime/core/src/commonj/sdo/DASProperty.h
@@ -0,0 +1,48 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you 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$ */
+
+#ifndef _DASPROPERTY_H_
+#define _DASPROPERTY_H_
+#include "commonj/sdo/Property.h"
+#include "commonj/sdo/DASValues.h"
+
+#include "commonj/sdo/disable_warn.h"
+
+namespace commonj{
+namespace sdo{
+
+/**
+ * DASProperty is a class to provide data access services
+ * with a more flexible Property
+ */
+
+ class DASProperty : public Property, public DASValues
+{
+ public:
+
+ virtual ~DASProperty();
+
+
+
+};
+};
+};
+#endif //_DMSDATAOBJECT_H_
diff --git a/sdo-cpp/trunk/runtime/core/src/commonj/sdo/DASType.cpp b/sdo-cpp/trunk/runtime/core/src/commonj/sdo/DASType.cpp
new file mode 100644
index 0000000000..2f44f220de
--- /dev/null
+++ b/sdo-cpp/trunk/runtime/core/src/commonj/sdo/DASType.cpp
@@ -0,0 +1,34 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you 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$ */
+
+#include "commonj/sdo/DASType.h"
+
+
+namespace commonj{
+namespace sdo{
+
+
+ DASType::~DASType()
+ {
+ }
+};
+};
+
diff --git a/sdo-cpp/trunk/runtime/core/src/commonj/sdo/DASType.h b/sdo-cpp/trunk/runtime/core/src/commonj/sdo/DASType.h
new file mode 100644
index 0000000000..62d924a4f1
--- /dev/null
+++ b/sdo-cpp/trunk/runtime/core/src/commonj/sdo/DASType.h
@@ -0,0 +1,55 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you 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$ */
+
+#ifndef _DASTYPE_H_
+#define _DASTYPE_H_
+
+#include "commonj/sdo/disable_warn.h"
+
+
+#include "commonj/sdo/Type.h"
+#include "commonj/sdo/DASValues.h"
+namespace commonj{
+namespace sdo{
+
+/**
+ * DASType is a class to provide data access services
+ * with a more flexible Type
+ */
+
+class DASType : public Type, public DASValues
+{
+ public:
+
+ virtual ~DASType();
+
+
+
+ virtual void setOpen(bool set) = 0;
+ virtual void setSequenced( bool set) = 0;
+ virtual void setBaseType( const Type* type, bool isRestriction=false) = 0;
+
+
+
+};
+};
+};
+#endif //_DASDATAOBJECT_H_
diff --git a/sdo-cpp/trunk/runtime/core/src/commonj/sdo/DASValue.cpp b/sdo-cpp/trunk/runtime/core/src/commonj/sdo/DASValue.cpp
new file mode 100644
index 0000000000..3275b6db7d
--- /dev/null
+++ b/sdo-cpp/trunk/runtime/core/src/commonj/sdo/DASValue.cpp
@@ -0,0 +1,59 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you 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$ */
+
+#include "commonj/sdo/DASValue.h"
+
+
+namespace commonj
+{
+ namespace sdo
+ {
+
+ DASValue::DASValue()
+ {
+ }
+
+ DASValue::DASValue(const char* val)
+ : value(val)
+ {
+ }
+
+ DASValue::DASValue(const SDOString& val)
+ : value(val)
+ {
+ }
+
+ DASValue::~DASValue()
+ {
+
+ }
+
+ const char* DASValue::getValue() const
+ {
+ return value.c_str();
+ }
+
+
+ }
+}
+// end - namespace sdo
+
+
diff --git a/sdo-cpp/trunk/runtime/core/src/commonj/sdo/DASValue.h b/sdo-cpp/trunk/runtime/core/src/commonj/sdo/DASValue.h
new file mode 100644
index 0000000000..d102961180
--- /dev/null
+++ b/sdo-cpp/trunk/runtime/core/src/commonj/sdo/DASValue.h
@@ -0,0 +1,56 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you 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$ */
+
+#ifndef _SDO_DASValue_H_
+#define _SDO_DASValue_H_
+
+
+#include "commonj/sdo/export.h"
+#include "commonj/sdo/SDOString.h"
+#include "string"
+
+
+namespace commonj
+{
+ namespace sdo
+ {
+
+/**
+ * DASValue is a class to hold information required by data
+ * access services but not required by the data factory.
+ */
+ class DASValue
+ {
+ public:
+ SDO_API DASValue();
+ SDO_API DASValue(const char* value);
+ SDO_API DASValue(const SDOString& value);
+ SDO_API virtual ~DASValue();
+ SDO_API const char* getValue() const;
+
+ private:
+ SDOString value;
+
+ };
+
+ }
+}
+#endif //_SDO_DASValue_H_
diff --git a/sdo-cpp/trunk/runtime/core/src/commonj/sdo/DASValues.cpp b/sdo-cpp/trunk/runtime/core/src/commonj/sdo/DASValues.cpp
new file mode 100644
index 0000000000..f94397cc87
--- /dev/null
+++ b/sdo-cpp/trunk/runtime/core/src/commonj/sdo/DASValues.cpp
@@ -0,0 +1,70 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you 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$ */
+
+#include "commonj/sdo/DASValues.h"
+
+using namespace std;
+namespace commonj
+{
+ namespace sdo
+ {
+
+/**
+ * DASValues is a class to hold list of information required by data
+ * access services but not required by the data factory.
+ */
+
+ DASValues::~DASValues()
+ {
+ DASValue_MAP::iterator propertyIter;
+ for (propertyIter = properties.begin() ; propertyIter != properties.end() ; ++propertyIter)
+ {
+ delete propertyIter->second;
+ }
+ }
+
+ void DASValues::setDASValue(const char* name, DASValue* property)
+ {
+ DASValue* prop = getDASValue(name);
+ if (prop != 0 && prop != property)
+ {
+ delete prop;
+ }
+ properties[name] = property;
+ }
+
+ DASValue* DASValues::getDASValue(const char* name)
+ {
+ DASValue_MAP::iterator propertyIter;
+ propertyIter = properties.find(name);
+ if(propertyIter != properties.end())
+ {
+ return propertyIter->second;
+ }
+ return NULL;
+
+ }
+
+ }
+}
+// end - namespace sdo
+
+
diff --git a/sdo-cpp/trunk/runtime/core/src/commonj/sdo/DASValues.h b/sdo-cpp/trunk/runtime/core/src/commonj/sdo/DASValues.h
new file mode 100644
index 0000000000..f5dec7fa41
--- /dev/null
+++ b/sdo-cpp/trunk/runtime/core/src/commonj/sdo/DASValues.h
@@ -0,0 +1,59 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you 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$ */
+
+#ifndef _SDO_DASValues_H_
+#define _SDO_DASValues_H_
+
+#include "commonj/sdo/disable_warn.h"
+
+#include "commonj/sdo/export.h"
+#include "commonj/sdo/DASValue.h"
+#include "map"
+#include "string"
+
+
+
+namespace commonj
+{
+ namespace sdo
+ {
+
+/**
+ * DASValues is a class to hold list of information required by data
+ * access services but not required by the data factory.
+ */
+
+ class DASValues
+ {
+ public:
+ SDO_API virtual ~DASValues();
+ SDO_API virtual void setDASValue(const char* name, DASValue* value);
+ SDO_API virtual DASValue* getDASValue(const char* name);
+ private:
+
+ typedef std::map<std::string, DASValue*> DASValue_MAP;
+ DASValue_MAP properties;
+
+ };
+
+ }
+}
+#endif //_SDO_DASValues_H_
diff --git a/sdo-cpp/trunk/runtime/core/src/commonj/sdo/DataFactory.cpp b/sdo-cpp/trunk/runtime/core/src/commonj/sdo/DataFactory.cpp
new file mode 100644
index 0000000000..a470fdc72e
--- /dev/null
+++ b/sdo-cpp/trunk/runtime/core/src/commonj/sdo/DataFactory.cpp
@@ -0,0 +1,46 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you 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$ */
+
+#include "commonj/sdo/DataFactory.h"
+#include "commonj/sdo/DataFactoryImpl.h"
+
+namespace commonj{
+namespace sdo{
+
+/**
+ * DataFactory holds metadata and creates DataObjects.
+ *
+ * The DataFactory holds properties and types loaded from XSD, or
+ * created using the DataFactory API.
+ */
+
+ DataFactory::~DataFactory()
+ {
+ }
+
+ RefCountingPointer<DataFactory> DataFactory::getDataFactory()
+ {
+ DataFactory* dob = (DataFactory*)(new DataFactoryImpl());
+ return RefCountingPointer<DataFactory> (dob);
+ }
+
+};
+};
diff --git a/sdo-cpp/trunk/runtime/core/src/commonj/sdo/DataFactory.h b/sdo-cpp/trunk/runtime/core/src/commonj/sdo/DataFactory.h
new file mode 100644
index 0000000000..60277ff2dc
--- /dev/null
+++ b/sdo-cpp/trunk/runtime/core/src/commonj/sdo/DataFactory.h
@@ -0,0 +1,784 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you 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$ */
+
+#ifndef _DATAFACTORY_H_
+#define _DATAFACTORY_H_
+
+#include "commonj/sdo/export.h"
+
+#include "commonj/sdo/TypeList.h"
+
+#include "commonj/sdo/RefCountingObject.h"
+#include "commonj/sdo/RefCountingPointer.h"
+#include "commonj/sdo/SDODate.h"
+#include "commonj/sdo/DASValue.h"
+#include "commonj/sdo/SDOString.h"
+
+
+namespace commonj{
+namespace sdo{
+
+class DataObject;
+class Type;
+
+/**
+ * DataFactory holds metadata and creates DataObjects.
+ *
+ * The DataFactory holds properties and types loaded from XSD, or
+ * created using the DataFactory API.
+ */
+
+class DataFactory : public RefCountingObject
+{
+ public:
+
+
+ /**
+ * getDataFactory is static and gets a data factory
+ *
+ * Static method to get a new data factory, with a set of base Types defined.
+ * With the data factory returned, either load Type definitions
+ * from XSD, or use the DataFactory APIs to define the types.
+ */
+
+ static SDO_API DataFactoryPtr getDataFactory();
+
+ virtual SDO_API ~DataFactory();
+
+
+ /**
+ * DataFactory::create creates a data object.
+ *
+ * Create a data object based on the type specified as a parameter
+ * Once a data object has been created by this factory, the metadata
+ * (types and properties) may no longer be altered.
+ */
+
+ SDO_API virtual DataObjectPtr create(const char* uri, const char* typeName) = 0;
+
+ SDO_API virtual DataObjectPtr create(const SDOString& uri, const SDOString& typeName) = 0;
+
+ SDO_API virtual DataObjectPtr create(const Type& type) = 0;
+
+ /**
+ * DataFactory::getType gets a type back from the factory.
+ *
+ * Get a type as specified in the data factory. Useful for creating
+ * data objects or querying properties.
+ */
+
+ virtual const Type& getType(const char* uri, const char* inTypeName) const = 0;
+
+ virtual const Type& getType(const SDOString& uri, const SDOString& inTypeName) const = 0;
+
+
+ /**
+ * DataFactory::getTypes gets a list of types back from the factory.
+ *
+ * Get all the types available within this data factory. Useful for
+ * validating whether a data object is of the correct type to be
+ * usable.
+ */
+
+ virtual TypeList getTypes() const = 0;
+
+ /**
+ * DataFactory::addType adds a type definition.
+ *
+ * Add a type defintion to the factory. (Properties may be added later).
+ * The type is defined by its uri and name.
+ * -# The type may be sequenced - and therefore work with a sequence API.
+ * -# The type may be open, indicating that it may have extra properties
+ * added at runtime.
+ * -# The type may be abstract, so the data factory will not permit creation
+ * of instances.
+ * -# The type may be a data type, indicating that is will not have properties.
+ * The Type may inherit from another type, but that is specified later with a
+ * call to setBaseType().
+ */
+
+
+ virtual SDO_API void addType(const char* uri, const char* inTypeName,
+ bool isSequenced = false,
+ bool isOpen = false,
+ bool isAbstract = false,
+ bool isDataType = false) = 0;
+
+ virtual SDO_API void addType(const SDOString& uri, const SDOString& inTypeName,
+ bool isSequenced = false,
+ bool isOpen = false,
+ bool isAbstract = false,
+ bool isDataType = false) = 0;
+
+
+ /**
+ * DataFactory::setBaseType allows inheritance
+ *
+ * The type specified second in the parameters becomes the basetype
+ * of the first parameter.
+ * The second type will have all the properties of its baser type, followed
+ * by any additional properties of its own. The property indices of the properties
+ * of the subclass will begin at one more than the total number of
+ * properties of the supertype
+ * This relationship is fixed when the first data object of any type is
+ * created by the factory. Up to that point the base type may be changed.
+ *
+ */
+
+ virtual SDO_API void setBaseType(
+ const Type& type,
+ const Type& base,
+ bool isRestriction = false) = 0;
+
+ virtual SDO_API void setBaseType(
+ const char* typeuri,
+ const char* typenam,
+ const char* baseuri,
+ const char* basename,
+ bool isRestriction = false) = 0;
+
+ virtual SDO_API void setBaseType(
+ const SDOString& typeuri,
+ const SDOString& typenam,
+ const SDOString& baseuri,
+ const SDOString& basename,
+ bool isRestriction = false) = 0;
+
+
+
+ /**
+ * DataFactory::setAlias sets an alternative name
+ *
+ * A Type may be known to the data factory by several different names.
+ * This method adds a new name for an existing property.
+ *
+ */
+
+ virtual SDO_API void setAlias(const char* typeuri,
+ const char* typenam,
+ const char* alias) = 0;
+
+ virtual SDO_API void setAlias(const SDOString& typeuri,
+ const SDOString& typenam,
+ const SDOString& alias) = 0;
+
+ /**
+ * DataFactory::addPropertyToType adds properties
+ *
+ * The various addPropertyToType methods add a property to an
+ * existing type in the factory, specifying the name of the new property,
+ * and the type of the new property - which must also be an existing type
+ * in this factory.
+ * -# The new property may be many-valued - so it will be a list of values.
+ * -# The property may be read-only , and may not be altered by user code -
+ * However the value may be changed by data access service code.
+ * -# The property may be containment.
+ * The type of a property may be DataType, or DataObjectType (see Types).
+ * If the property is a DataType, then the actual value of the property is held
+ * within the data object containing the property.
+ * If the property is a DataObjectType, it may be containment, or reference.
+ * Containment indicates that the value of the property is contained in the
+ * data object, whilst reference indicates that the property is only a pointer to
+ * a value somewhere else in the data graph.
+ *
+ */
+
+
+ virtual SDO_API void addPropertyToType(const char* uri,
+ const char* inTypeName,
+ const char* propname,
+ const char* propTypeUri,
+ const char* propTypeName,
+ bool isMany,
+ bool isReadOnly ,
+ bool isContainment ) = 0;
+
+ virtual SDO_API void addPropertyToType(const SDOString& uri,
+ const SDOString& inTypeName,
+ const SDOString& propname,
+ const SDOString& propTypeUri,
+ const SDOString& propTypeName,
+ bool isMany ,
+ bool isReadOnly ,
+ bool isContainment ) = 0;
+
+ virtual SDO_API void addPropertyToType(const char* uri,
+ const char* inTypeName,
+ const char* propname,
+ const Type& propType,
+ bool isMany ,
+ bool isReadOnly ,
+ bool isContainment ) = 0;
+
+ virtual SDO_API void addPropertyToType(const SDOString& uri,
+ const SDOString& inTypeName,
+ const SDOString& propname,
+ const Type& propType,
+ bool isMany ,
+ bool isReadOnly ,
+ bool isContainment ) = 0;
+
+ virtual SDO_API void addPropertyToType(const Type& type,
+ const char* propname,
+ const Type& propType,
+ bool isMany ,
+ bool isReadOnly ,
+ bool isContainment ) = 0;
+
+ virtual SDO_API void addPropertyToType(const Type& type,
+ const SDOString& propname,
+ const Type& propType,
+ bool isMany ,
+ bool isReadOnly ,
+ bool isContainment ) = 0;
+
+ virtual SDO_API void addPropertyToType(const Type& type,
+ const char* propname,
+ const char* propTypeUri,
+ const char* propTypeName,
+ bool isMany ,
+ bool isReadOnly ,
+ bool isContainment ) = 0;
+
+ virtual SDO_API void addPropertyToType(const Type& type,
+ const SDOString& propname,
+ const SDOString& propTypeUri,
+ const SDOString& propTypeName,
+ bool isMany ,
+ bool isReadOnly ,
+ bool isContainment ) = 0;
+
+ virtual SDO_API void addPropertyToType(const char* uri,
+ const char* inTypeName,
+ const char* propname,
+ const char* propTypeUri,
+ const char* propTypeName,
+ bool isMany = false) =0;
+
+ virtual SDO_API void addPropertyToType(const SDOString& uri,
+ const SDOString& inTypeName,
+ const SDOString& propname,
+ const SDOString& propTypeUri,
+ const SDOString& propTypeName,
+ bool isMany = false) =0;
+
+ virtual SDO_API void addPropertyToType(const char* uri,
+ const char* inTypeName,
+ const char* propname,
+ const Type& propType,
+ bool isMany = false) =0;
+
+ virtual SDO_API void addPropertyToType(const SDOString& uri,
+ const SDOString& inTypeName,
+ const SDOString& propname,
+ const Type& propType,
+ bool isMany = false) =0;
+
+ virtual SDO_API void addPropertyToType(const Type& type,
+ const char* propname,
+ const Type& propType,
+ bool isMany = false) =0;
+
+ virtual SDO_API void addPropertyToType(const Type& type,
+ const SDOString& propname,
+ const Type& propType,
+ bool isMany = false) =0;
+
+ virtual SDO_API void addPropertyToType(const Type& type,
+ const char* propname,
+ const char* propTypeUri,
+ const char* propTypeName,
+ bool isMany = false) =0;
+
+ virtual SDO_API void addPropertyToType(const Type& type,
+ const SDOString& propname,
+ const SDOString& propTypeUri,
+ const SDOString& propTypeName,
+ bool isMany = false) =0;
+
+ /**
+ * DataFactory::setOpposite sets an opposite name
+ *
+ * NOT IMPLEMENTED.
+ *
+ */
+
+ virtual SDO_API void setOpposite(
+ const Type& type,
+ const char* propName,
+ const Type& oppositetype,
+ const char* oppositePropName) = 0;
+
+ virtual SDO_API void setOpposite(
+ const Type& type,
+ const SDOString& propName,
+ const Type& oppositetype,
+ const SDOString& oppositePropName) = 0;
+
+ /**
+ * DataFactory::setAlias sets a property alias name
+ *
+ * A property, like a type, may be known to the factory by several
+ * names.
+ */
+
+ virtual SDO_API void setAlias(const char* typeuri,
+ const char* typname,
+ const char* propname,
+ const char* alias) = 0;
+
+ virtual SDO_API void setAlias(const SDOString& typeuri,
+ const SDOString& typname,
+ const SDOString& propname,
+ const SDOString& alias) = 0;
+
+ /**
+ * DataFactory::setPropertySubstitute sets a substitute for a property
+ *
+ * A property is of a specified type. However this method specifies another type
+ * which will be accepted by the data factory at runtime as a substitute for this
+ * property, and will be inserted into the parent data object as though it was
+ * a value for this property. The substitute name is then used for this property
+ * as a sort of alias.
+ * names.
+ */
+
+ virtual SDO_API void setPropertySubstitute(
+ const char* uri,
+ const char* inTypeName,
+ const char* propname,
+ const char* subname,
+ const char* subTypeUri,
+ const char* subTypeName) = 0;
+
+ virtual SDO_API void setPropertySubstitute(
+ const SDOString& uri,
+ const SDOString& inTypeName,
+ const SDOString& propname,
+ const SDOString& subname,
+ const SDOString& subTypeUri,
+ const SDOString& subTypeName) = 0;
+
+ virtual SDO_API void setPropertySubstitute(
+ const Type& containertype,
+ const char* propname,
+ const char* subname,
+ const Type& subtype) = 0;
+
+ virtual SDO_API void setPropertySubstitute(
+ const Type& containertype,
+ const SDOString& propname,
+ const SDOString& subname,
+ const Type& subtype) = 0;
+
+
+ /**
+ * DataFactory::setDefault sets a default value for a property
+ *
+ * When querying the value of a property of a data object, that property
+ * may be set - indicating that a value has been assigned, or unset - indicating that
+ * no value has yet been assigned.
+ * If there is no value assigned, then a default value may be returned for that
+ * property.
+ * This method allows the data factory to define that default value.
+ * There is no default value for a DataObjectType. There are overloads for
+ * each of the primitive DataTypes.
+ */
+
+ virtual SDO_API void setDefault(
+ const Type& t,
+ const char* propname,
+ bool b ) = 0;
+
+ virtual SDO_API void setDefault(
+ const Type& t,
+ const SDOString& propname,
+ bool b ) = 0;
+
+ virtual SDO_API void setDefault(
+ const Type& t,
+ const char* propname ,
+ char c) = 0;
+
+ virtual SDO_API void setDefault(
+ const Type& t,
+ const SDOString& propname ,
+ char c) = 0;
+
+ virtual SDO_API void setDefault(
+ const Type& t,
+ const char* propname ,
+ wchar_t c) = 0;
+
+ virtual SDO_API void setDefault(
+ const Type& t,
+ const SDOString& propname ,
+ wchar_t c) = 0;
+
+ virtual SDO_API void setDefault(
+ const Type& t,
+ const char* propname ,
+ char* c) = 0;
+
+ virtual SDO_API void setDefault(
+ const Type& t,
+ const SDOString& propname ,
+ SDOString& outstr) = 0;
+
+ virtual SDO_API void setDefault(
+ const Type& t,
+ const char* propname ,
+ short s) = 0;
+
+ virtual SDO_API void setDefault(
+ const Type& t,
+ const SDOString& propname ,
+ short s) = 0;
+
+
+#if __WORDSIZE !=64
+ virtual SDO_API void setDefault(
+ const Type& t,
+ const char* propname ,
+ long l) = 0;
+
+ virtual SDO_API void setDefault(
+ const Type& t,
+ const SDOString& propname ,
+ long l) = 0;
+#endif
+
+ virtual SDO_API void setDefault(
+ const Type& t,
+ const char* propname ,
+ int64_t i) = 0;
+
+ virtual SDO_API void setDefault(
+ const Type& t,
+ const SDOString& propname ,
+ int64_t i) = 0;
+
+ virtual SDO_API void setDefault(
+ const Type& t,
+ const char* propname ,
+ float f) = 0;
+
+ virtual SDO_API void setDefault(
+ const Type& t,
+ const SDOString& propname ,
+ float f) = 0;
+
+ virtual SDO_API void setDefault(
+ const Type& t,
+ const char* propname ,
+ long double d) = 0;
+
+ virtual SDO_API void setDefault(
+ const Type& t,
+ const SDOString& propname ,
+ long double d) = 0;
+
+ virtual SDO_API void setDefault(
+ const Type& t,
+ const char* propname ,
+ const wchar_t* c,
+ unsigned int len) = 0;
+
+ virtual SDO_API void setDefault(
+ const Type& t,
+ const SDOString& propname ,
+ const wchar_t* c,
+ unsigned int len) = 0;
+
+ virtual SDO_API void setDefault(
+ const Type& t,
+ const char* propname ,
+ const char* c,
+ unsigned int len) = 0;
+
+ virtual SDO_API void setDefault(
+ const Type& t,
+ const SDOString& propname ,
+ const SDOString& c,
+ unsigned int len) = 0;
+
+
+ virtual SDO_API void setDefault(
+ const Type& t,
+ const char* propname ,
+ const SDODate dat) = 0;
+
+ virtual SDO_API void setDefault(
+ const Type& t,
+ const SDOString& propname ,
+ const SDODate dat) = 0;
+
+ virtual SDO_API void setDefault(
+ const char* typuri,
+ const char* typnam,
+ const char* propname,
+ bool b ) = 0;
+
+ virtual SDO_API void setDefault(
+ const SDOString& typuri,
+ const SDOString& typnam,
+ const SDOString& propname,
+ bool b ) = 0;
+
+ virtual SDO_API void setDefault(
+ const char* typuri,
+ const char* typnam,
+ const char* propname ,
+ char c) = 0;
+
+ virtual SDO_API void setDefault(
+ const SDOString& typuri,
+ const SDOString& typnam,
+ const SDOString& propname ,
+ char c) = 0;
+
+ virtual SDO_API void setDefault(
+ const char* typuri,
+ const char* typnam,
+ const char* propname ,
+ wchar_t c) = 0;
+
+ virtual SDO_API void setDefault(
+ const SDOString& typuri,
+ const SDOString& typnam,
+ const SDOString& propname ,
+ wchar_t c) = 0;
+
+ virtual SDO_API void setDefault(
+ const char* typuri,
+ const char* typnam,
+ const char* propname ,
+ char* 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,
+ const char* typnam,
+ const char* propname ,
+ short s) = 0;
+
+ virtual SDO_API void setDefault(
+ const SDOString& typuri,
+ const SDOString& typnam,
+ const SDOString& propname ,
+ short s) = 0;
+
+
+#if __WORDSIZE !=64
+ virtual SDO_API void setDefault(
+ const char* typuri,
+ const char* typnam,
+ const char* propname ,
+ long l) = 0;
+
+ virtual SDO_API void setDefault(
+ const SDOString& typuri,
+ const SDOString& typnam,
+ const SDOString& propname ,
+ long l) = 0;
+
+#endif
+
+ virtual SDO_API void setDefault(
+ const char* typuri,
+ const char* typnam,
+ const char* propname ,
+ int64_t i) = 0;
+
+ virtual SDO_API void setDefault(
+ const SDOString& typuri,
+ const SDOString& typnam,
+ const SDOString& propname ,
+ int64_t i) = 0;
+
+ virtual SDO_API void setDefault(
+ const char* typuri,
+ const char* typnam,
+ const char* propname ,
+ float f) = 0;
+
+ virtual SDO_API void setDefault(
+ const SDOString& typuri,
+ const SDOString& typnam,
+ const SDOString& propname ,
+ float f) = 0;
+
+ virtual SDO_API void setDefault(
+ const char* typuri,
+ const char* typnam,
+ const char* propname ,
+ long double d) = 0;
+
+ virtual SDO_API void setDefault(
+ const SDOString& typuri,
+ const SDOString& typnam,
+ const SDOString& propname ,
+ long double d) = 0;
+
+ virtual SDO_API void setDefault(
+ const char* typuri,
+ const char* typnam,
+ const char* propname ,
+ const wchar_t* c,
+ unsigned int len) = 0;
+
+ virtual SDO_API void setDefault(
+ const SDOString& typuri,
+ const SDOString& typnam,
+ const SDOString& propname ,
+ const wchar_t* c,
+ unsigned int len) = 0;
+
+ virtual SDO_API void setDefault(
+ const char* typuri,
+ const char* typnam,
+ const char* propname ,
+ const char* c,
+ unsigned int len) = 0;
+
+ virtual SDO_API void setDefault(
+ const SDOString& typuri,
+ const SDOString& typnam,
+ const SDOString& propname ,
+ const SDOString& c,
+ unsigned int len) = 0;
+
+ virtual SDO_API void setDefault(
+ const char* typuri,
+ const char* typnam,
+ const char* propname ,
+ const SDODate dat) = 0;
+
+ virtual SDO_API void setDefault(
+ const SDOString& typuri,
+ const SDOString& typnam,
+ const SDOString& propname ,
+ const SDODate dat) = 0;
+
+
+ /**
+ * DAS values are used by a DAS implementation
+ */
+
+ virtual SDO_API void setDASValue(
+ const Type& type,
+ const char* name,
+ DASValue* value) = 0;
+
+ virtual SDO_API void setDASValue(
+ const Type& type,
+ const SDOString& name,
+ DASValue* value) = 0;
+
+ virtual SDO_API void setDASValue(
+ const char* typeuri,
+ const char* typenam,
+ const char* name,
+ DASValue* value) = 0;
+
+ virtual SDO_API void setDASValue(
+ const SDOString& typeuri,
+ const SDOString& typenam,
+ const SDOString& name,
+ DASValue* value) = 0;
+
+ virtual SDO_API DASValue* getDASValue(
+ const Type& type,
+ const char* name) const = 0;
+
+ virtual SDO_API DASValue* getDASValue(
+ const Type& type,
+ const SDOString& name) const = 0;
+
+ virtual SDO_API DASValue* getDASValue(
+ const char* typeuri,
+ const char* typenam,
+ const char* name) const = 0;
+
+ virtual SDO_API DASValue* getDASValue(
+ const SDOString& typeuri,
+ const SDOString& typenam,
+ const SDOString& name) const = 0;
+
+ virtual SDO_API void setDASValue(
+ const Type& type,
+ const char* propertyName,
+ const char* name,
+ DASValue* value) = 0;
+
+ virtual SDO_API void setDASValue(
+ const Type& type,
+ const SDOString& propertyName,
+ const SDOString& name,
+ DASValue* value) = 0;
+
+ virtual SDO_API void setDASValue(
+ const char* typeuri,
+ const char* typenam,
+ const char* propertyName,
+ const char* name,
+ DASValue* value) = 0;
+
+ virtual SDO_API void setDASValue(
+ const SDOString& typeuri,
+ const SDOString& typenam,
+ const SDOString& propertyName,
+ const SDOString& name,
+ DASValue* value) = 0;
+
+ virtual SDO_API DASValue* getDASValue(
+ const Type& type,
+ const char* propertyName,
+ const char* name) const = 0;
+
+ virtual SDO_API DASValue* getDASValue(
+ const Type& type,
+ const SDOString& propertyName,
+ const SDOString& name) const = 0;
+
+ virtual SDO_API DASValue* getDASValue(
+ const char* typeuri,
+ const char* typenam,
+ const char* propertyName,
+ const char* name) const = 0;
+
+ virtual SDO_API DASValue* getDASValue(
+ const SDOString& typeuri,
+ const SDOString& typenam,
+ const SDOString& propertyName,
+ const SDOString& name) const = 0;
+
+ virtual void resolve() = 0;
+
+ };
+};
+};
+#endif //_DATAFACTORY_H_
diff --git a/sdo-cpp/trunk/runtime/core/src/commonj/sdo/DataFactoryImpl.cpp b/sdo-cpp/trunk/runtime/core/src/commonj/sdo/DataFactoryImpl.cpp
new file mode 100644
index 0000000000..97151e3a11
--- /dev/null
+++ b/sdo-cpp/trunk/runtime/core/src/commonj/sdo/DataFactoryImpl.cpp
@@ -0,0 +1,1682 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you 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$ */
+
+//////////////////////////////////////////////////////////////////////
+// DataFactoryImpl.cpp: implementation of the DataFactory class.
+//
+//////////////////////////////////////////////////////////////////////
+#include "commonj/sdo/SDORuntimeException.h"
+
+#include "commonj/sdo/DataFactoryImpl.h"
+#include "commonj/sdo/DataObjectImpl.h"
+
+#include "commonj/sdo/Logger.h"
+
+#include "commonj/sdo/SDOUtils.h"
+
+#include "commonj/sdo/PropertyList.h"
+
+#include <iostream>
+#include <stdio.h>
+
+
+using namespace std;
+using namespace commonj::sdo;
+
+namespace commonj{
+namespace sdo {
+
+ using internal::SDOUtils;
+// ===================================================================
+// Constructor
+// ===================================================================
+DataFactoryImpl::DataFactoryImpl()
+{
+
+ /* add the primitives to every mdg - */
+
+ isResolved = false;
+ addType(SDOUtils::sdoURI,"Decimal");
+ addType(SDOUtils::sdoURI,"Integer");
+ addType(SDOUtils::sdoURI,"Boolean");
+
+ addType(SDOUtils::sdoURI,"Byte");
+ addType(SDOUtils::sdoURI,"Bytes");
+ addType(SDOUtils::sdoURI,"Character");
+
+ addType(SDOUtils::sdoURI,"String");
+ addType(SDOUtils::sdoURI,"DataObject", false, false, true, false);
+ addType(SDOUtils::sdoURI,"OpenDataObject", true, true, false, false);
+ addType(SDOUtils::sdoURI,"Date");
+ addType(SDOUtils::sdoURI,"Double");
+ addType(SDOUtils::sdoURI,"Float");
+ addType(SDOUtils::sdoURI,"Int");
+ addType(SDOUtils::sdoURI,"Long");
+ addType(SDOUtils::sdoURI,"Short");
+ addType(SDOUtils::sdoURI,"URI");
+
+ // abstract
+ addType(SDOUtils::sdoURI,"ChangeSummary");
+
+}
+
+// ===================================================================
+// Destructor
+// ===================================================================
+DataFactoryImpl::~DataFactoryImpl()
+{
+
+ resolvePending.clear();
+
+ TYPES_MAP::iterator typeIter;
+ for (typeIter = types.begin() ; typeIter != types.end() ; ++typeIter)
+ {
+ if (strncmp((typeIter->first).c_str(),"ALIAS::", 7))
+ {
+ delete typeIter->second;
+ }
+ }
+}
+
+// ===================================================================
+// copy constructor
+// ===================================================================
+DataFactoryImpl::DataFactoryImpl(const DataFactoryImpl& inmdg)
+{
+ isResolved = false;
+ copyTypes(inmdg);
+}
+
+// ===================================================================
+// Assignment operator
+// ===================================================================
+DataFactoryImpl& DataFactoryImpl::operator=(const DataFactoryImpl& inmdg)
+{
+ if (this != &inmdg)
+ {
+ copyTypes(inmdg);
+ }
+ return *this;
+}
+
+RefCountingPointer<DataFactory> DataFactoryImpl::clone()
+{
+ const DataFactoryImpl* df = (const DataFactoryImpl*)this;
+ DataFactory* dob = (DataFactory*)(new DataFactoryImpl(*df));
+ return RefCountingPointer<DataFactory> (dob);
+}
+
+// ===================================================================
+// copy Types to this DataFactory
+// ===================================================================
+void DataFactoryImpl::copyTypes(const DataFactoryImpl& inmdg)
+{
+
+
+ TYPES_MAP::const_iterator typeIter;
+ TYPES_MAP::iterator typeIter2;
+ SDOString fullTypeName;
+
+ for (typeIter = inmdg.types.begin() ; typeIter != inmdg.types.end() ; ++typeIter)
+ {
+ // add this type to this metadata
+ addType((typeIter->second)->getURI(), (typeIter->second)->getName());
+
+ // re-find the type we just added.
+ getFullTypeName(fullTypeName,
+ (typeIter->second)->getURI(),
+ (typeIter->second)->getName());
+ typeIter2 = types.find(fullTypeName);
+
+ // copy the aliases , if there are any.
+
+ if ((typeIter->second)->getAliasCount() > 0)
+ {
+ for (unsigned int j=0;j<(typeIter->second)->getAliasCount();j++)
+ {
+ (typeIter2->second)->setAlias(
+ (typeIter->second)->getAlias());
+ }
+ }
+
+
+ // Now add all the properties
+ std::vector<PropertyImplPtr> props = typeIter->second->getPropertyListReference();
+
+ for (std::vector<PropertyImplPtr>::const_iterator i = props.begin();
+ i != props.end();
+ i++)
+ {
+ // Ensure the properties type is added
+ const Type& propType = (*i)->getType();
+ addType(propType.getURI(), propType.getName());
+
+ // Now add the property
+ addPropertyToType((typeIter->second)->getURI(),
+ (typeIter->second)->getName(),
+ (*i)->getName(),
+ propType.getURI(),
+ propType.getName(),
+ (*i)->isMany(),
+ (*i)->isReadOnly(),
+ (*i)->isContainment());
+
+ // copy the aliases if there are any.
+ if ((*i)->getAliasCount() > 0)
+ {
+
+ PropertyImpl* p = (typeIter2->second)->
+ getPropertyImpl((*i)->getName());
+ if (p != 0)
+ {
+ for (unsigned int j=0;j<p->getAliasCount();j++)
+ {
+ p->setAlias((*i)->getAlias(j));
+ }
+ }
+
+ }
+
+ } // end - iterate over Properties
+ } // end - iterate over Types
+}
+
+// ===================================================================
+// addType - adds a new Type if it does not already exist
+// ===================================================================
+void DataFactoryImpl::addType(const char* uri, const char* inTypeName,
+ bool isSeq,
+ bool isOp,
+ bool isAbs,
+ bool isData)
+{
+ addType(uri,inTypeName,isSeq,isOp,isAbs,isData,false);
+}
+
+void DataFactoryImpl::addType(const SDOString& uri, const SDOString& inTypeName,
+ bool isSeq,
+ bool isOp,
+ bool isAbs,
+ bool isData)
+{
+ addType(uri.c_str(),inTypeName.c_str(),isSeq,isOp,isAbs,isData,false);
+}
+
+bool empty(const char* inTypeName)
+{
+ return inTypeName == 0 || strlen(inTypeName) == 0;
+}
+void assertTypeName(const char* inTypeName, const char* function)
+{
+ if (empty(inTypeName))
+ {
+ throw SDOIllegalArgumentException(TUSCANY_SDO_EINFO,
+ " Type has empty name");
+ }
+}
+
+void DataFactoryImpl::addType(const char* uri, const char* inTypeName,
+ bool isSeq,
+ bool isOp,
+ bool isAbs,
+ bool isData,
+ bool isFromList)
+{
+ assertTypeName(inTypeName, "DataFactory::addType");
+
+ SDOString typeUri;
+
+ if (uri)
+ typeUri = uri;
+ if (findType(typeUri, inTypeName) == 0)
+ {
+ SDOString fullTypeName;
+ getFullTypeName(fullTypeName, uri, inTypeName);
+ types[fullTypeName] = new TypeImpl(uri, inTypeName, isSeq, isOp, isAbs, isData, isFromList);
+ resolvePending[fullTypeName] = types[fullTypeName];
+ }
+}
+
+void DataFactoryImpl::addType(const SDOString& uri, const SDOString& inTypeName,
+ bool isSeq,
+ bool isOp,
+ bool isAbs,
+ bool isData,
+ bool isFromList)
+{
+ addType(uri.c_str(), inTypeName.c_str(), isSeq, isOp, isAbs, isData, isFromList);
+}
+
+// ===================================================================
+// Check whether a change summary would clash.
+// ===================================================================
+
+bool DataFactoryImpl::recursiveCheck(TypeImpl* cs, TypeImpl* t)
+{
+ if (cs->isDataType()) return false;
+
+ if (! strcmp(cs->getName(), t->getName()) &&
+ ! strcmp(cs->getURI() , t->getURI()) )
+ {
+ return true;
+ }
+
+ const std::vector<PropertyImplPtr> pl = cs->getPropertyListReference();
+
+ for (std::vector<PropertyImplPtr>::const_iterator j = pl.begin();
+ j != pl.end();
+ j++)
+ {
+ if (recursiveCheck((TypeImpl*)&((*j)->getType()), t)) return true;
+ }
+ return false;
+}
+
+// ===================================================================
+// Check whether a change summary would clash.
+// ===================================================================
+bool DataFactoryImpl::checkForValidChangeSummary(TypeImpl* t)
+{
+ // None of the containing types can have a cs already.
+ // None of the properties of this type can hold a type
+ // which has a change summary.
+
+ if (t->isResolved)
+ {
+ throw SDOUnsupportedOperationException(TUSCANY_SDO_EINFO,
+ "Adding Change Summary after type completed");
+ }
+
+ if (cstypes.size() > 0) {
+ for (unsigned int i = 0 ;i < cstypes.size(); i++)
+ {
+ if (recursiveCheck(cstypes[i], t))
+ {
+ return false;
+
+ }
+ }
+ }
+ cstypes.push_back(t);
+ return true;
+}
+
+void assertNames(const char* inTypeName, const char* propname)
+{
+ assertTypeName(inTypeName, "DataFactory::addPropertyToType");
+ if (empty(propname))
+ {
+ throw SDOIllegalArgumentException(TUSCANY_SDO_EINFO,
+ "Property has an empty name");
+ }
+}
+
+// ===================================================================
+// addPropertyToType - adds a Property to an existing Type
+// ===================================================================
+void DataFactoryImpl::addPropertyToType(const char* uri,
+ const char* inTypeName,
+ const char* propname,
+ const char* propTypeUri,
+ const char* propTypeName,
+ bool many)
+{
+ assertNames(inTypeName, propname);
+ SDOString fullPropTypeName;
+ getFullTypeName(fullPropTypeName, propTypeUri, propTypeName);
+
+ TYPES_MAP::iterator typeIter;
+ typeIter = types.find(fullPropTypeName);
+ if (typeIter != types.end())
+ {
+ addPropertyToType(uri,inTypeName,
+ propname,
+ propTypeUri,
+ propTypeName,
+ many,
+ false,
+ !(typeIter->second)->isDataType());
+ }
+}
+
+void DataFactoryImpl::addPropertyToType(const SDOString& uri,
+ const SDOString& inTypeName,
+ const SDOString& propname,
+ const SDOString& propTypeUri,
+ const SDOString& propTypeName,
+ bool many)
+{
+ addPropertyToType(uri.c_str(), inTypeName.c_str(), propname.c_str(), propTypeUri.c_str(), propTypeName.c_str(), many);
+}
+
+void DataFactoryImpl::addPropertyToType(const char* uri,
+ const char* inTypeName,
+ const char* propname,
+ const char* propTypeUri,
+ const char* propTypeName,
+ bool many,
+ bool rdonly,
+ bool cont)
+{
+ assertNames(inTypeName, propname);
+
+ TYPES_MAP::iterator typeIter, typeIter2;
+
+ //cout << "Adding property " << propname << "(" << propTypeUri << "#" << propTypeName
+ // << ") to type " << uri << "#" << inTypeName << endl;
+
+
+ SDOString fullTypeName;
+ getFullTypeName(fullTypeName, uri, inTypeName);
+ typeIter = types.find(fullTypeName);
+
+ if(typeIter == types.end())
+ {
+ string msg("Type not found: ");
+ if (uri != 0)msg += uri;
+ msg += " ";
+ if (inTypeName != 0)msg += inTypeName;
+ throw SDOTypeNotFoundException(TUSCANY_SDO_EINFO,
+ msg.c_str());
+
+ }
+
+ if ((typeIter->second)->isDataType())
+ {
+ string msg("Cannot add property ");
+ msg += propname;
+ msg += " of type ";
+ msg += propTypeUri;
+ msg += "#";
+ msg += propTypeName;
+ msg += " to this data type ";
+ msg += uri;
+ msg += "#";
+ msg += inTypeName;
+ throw SDOIllegalArgumentException(TUSCANY_SDO_EINFO,
+ msg.c_str());
+ }
+
+ getFullTypeName(fullTypeName, propTypeUri, propTypeName);
+ typeIter2 = types.find(fullTypeName);
+
+ if (typeIter2 == types.end())
+ {
+ string msg("Type not found: ");
+ if (propTypeUri != 0)msg += propTypeUri;
+ msg += " ";
+ if (propTypeName != 0)msg += propTypeName;
+ throw SDOTypeNotFoundException(TUSCANY_SDO_EINFO,
+ msg.c_str());
+ }
+
+ // Check if its a ChangeSummary
+ if (propTypeUri != 0 && !strcmp(propTypeUri,SDOUtils::sdoURI) &&
+ !strcmp(propTypeName,"ChangeSummary") )
+ {
+ if (checkForValidChangeSummary(typeIter->second))
+ {
+ // The change summary is allowable if we got to here - force the right params.
+ // we will not use this property - its just for compatibility.
+ // we have to use getChangeSummary to get the change summary,
+ // and isChangeSummaryType to see if this is a type which may have
+ // a change summary.
+ (typeIter->second)->addChangeSummary();
+ // dont even show the property - its not needed
+ //((typeIter->second)->addProperty(propname, *(typeIter2->second),false,true, false));
+
+ }
+ return;
+ }
+
+
+ if ((typeIter->second)->isDataType())
+ {
+ string msg("Cannot add property to a data type : ");
+ msg += (typeIter->second)->getName();
+ throw SDOIllegalArgumentException(TUSCANY_SDO_EINFO,
+ msg.c_str());
+ // cannot add a property to a primitive
+ }
+
+ // @PGR@ containment should be ignored for DataType
+/* if ((typeIter2->second)->isDataType() && cont == true)
+ {
+ string msg("Data types may not be containment : ");
+ msg += (typeIter2->second)->getName();
+ throw SDOIllegalArgumentException(TUSCANY_SDO_EINFO,
+ msg.c_str());
+ // cannot try to make a property containment on a data type
+ }
+*/
+
+ if ((typeIter->second)->isResolved)
+ {
+ throw SDOUnsupportedOperationException(TUSCANY_SDO_EINFO,
+ "Adding Properties after type completed");
+ }
+
+ ((typeIter->second)->addProperty(propname, *(typeIter2->second),many,rdonly, cont));
+ return;
+}
+
+void DataFactoryImpl::addPropertyToType(const SDOString& uri,
+ const SDOString& inTypeName,
+ const SDOString& propname,
+ const SDOString& propTypeUri,
+ const SDOString& propTypeName,
+ bool many,
+ bool rdonly,
+ bool cont)
+{
+ addPropertyToType(uri.c_str(),
+ inTypeName.c_str(),
+ propname.c_str(),
+ propTypeUri.c_str(),
+ propTypeName.c_str(),
+ many,
+ rdonly,
+ cont);
+}
+
+// ===================================================================
+// addPropertyToType - adds a Property to an existing Type
+// ===================================================================
+
+void DataFactoryImpl::addPropertyToType(const char* uri,
+ const char* inTypeName,
+ const char* propname,
+ const Type& tprop,
+ bool many)
+{
+ addPropertyToType(uri,
+ inTypeName,
+ propname,
+ tprop,
+ many,
+ false,
+ !tprop.isDataType());
+}
+
+void DataFactoryImpl::addPropertyToType(const SDOString& uri,
+ const SDOString& inTypeName,
+ const SDOString& propname,
+ const Type& tprop,
+ bool many)
+{
+ addPropertyToType(uri.c_str(),
+ inTypeName.c_str(),
+ propname.c_str(),
+ tprop,
+ many,
+ false,
+ !tprop.isDataType());
+}
+
+void DataFactoryImpl::addPropertyToType(const char* uri,
+ const char* inTypeName,
+ const char* propname,
+ const Type& tprop,
+ bool many,
+ bool rdonly,
+ bool cont)
+{
+ addPropertyToType(uri,
+ inTypeName,
+ propname,
+ tprop.getURI(),
+ tprop.getName(),
+ many,
+ rdonly, cont);
+}
+
+void DataFactoryImpl::addPropertyToType(const SDOString& uri,
+ const SDOString& inTypeName,
+ const SDOString& propname,
+ const Type& tprop,
+ bool many,
+ bool rdonly,
+ bool cont)
+{
+ addPropertyToType(uri.c_str(),
+ inTypeName.c_str(),
+ propname.c_str(),
+ tprop.getURI(),
+ tprop.getName(),
+ many,
+ rdonly,
+ cont);
+}
+
+// ===================================================================
+// addPropertyToType - adds a Property to an existing Type
+// ===================================================================
+void DataFactoryImpl::addPropertyToType(const Type& cont,
+ const char* propname,
+ const char* propTypeUri,
+ const char* propTypeName,
+ bool many)
+{
+ addPropertyToType(cont.getURI(),
+ cont.getName(),
+ propname,
+ propTypeUri,
+ propTypeName,
+ many);
+}
+
+void DataFactoryImpl::addPropertyToType(const Type& cont,
+ const SDOString& propname,
+ const SDOString& propTypeUri,
+ const SDOString& propTypeName,
+ bool many)
+{
+ addPropertyToType(cont.getURI(),
+ cont.getName(),
+ propname.c_str(),
+ propTypeUri.c_str(),
+ propTypeName.c_str(),
+ many);
+}
+
+void DataFactoryImpl::addPropertyToType(const Type& cont,
+ const char* propname,
+ const char* propTypeUri,
+ const char* propTypeName,
+ bool many,
+ bool rdonly,
+ bool contain)
+{
+ addPropertyToType(cont.getURI(),
+ cont.getName(),
+ propname,
+ propTypeUri,
+ propTypeName,
+ many,
+ rdonly,
+ contain);
+}
+
+void DataFactoryImpl::addPropertyToType(const Type& cont,
+ const SDOString& propname,
+ const SDOString& propTypeUri,
+ const SDOString& propTypeName,
+ bool many,
+ bool rdonly,
+ bool contain)
+{
+ addPropertyToType(cont.getURI(),
+ cont.getName(),
+ propname.c_str(),
+ propTypeUri.c_str(),
+ propTypeName.c_str(),
+ many,
+ rdonly,
+ contain);
+}
+
+// ===================================================================
+// addPropertyToType - adds a Property to an existing Type
+// ===================================================================
+void DataFactoryImpl::addPropertyToType(const Type& tp,
+ const char* propname,
+ const Type& tprop,
+ bool many)
+{
+ addPropertyToType(tp.getURI(),
+ tp.getName(),
+ propname,
+ tprop.getURI(),
+ tprop.getName(),
+ many);
+}
+
+void DataFactoryImpl::addPropertyToType(const Type& tp,
+ const SDOString& propname,
+ const Type& tprop,
+ bool many)
+{
+ addPropertyToType(tp.getURI(),
+ tp.getName(),
+ propname.c_str(),
+ tprop.getURI(),
+ tprop.getName(),
+ many);
+}
+
+void DataFactoryImpl::addPropertyToType(const Type& tp,
+ const char* propname,
+ const Type& tprop,
+ bool many,
+ bool rdonly,
+ bool cont)
+{
+ addPropertyToType(tp.getURI(),
+ tp.getName(),
+ propname,
+ tprop.getURI(),
+ tprop.getName(),
+ many,
+ rdonly,
+ cont);
+}
+
+void DataFactoryImpl::addPropertyToType(const Type& tp,
+ const SDOString& propname,
+ const Type& tprop,
+ bool many,
+ bool rdonly,
+ bool cont)
+{
+ addPropertyToType(tp.getURI(),
+ tp.getName(),
+ propname.c_str(),
+ tprop.getURI(),
+ tprop.getName(),
+ many,
+ rdonly,
+ cont);
+}
+
+// ===================================================================
+// getFullTypeName - return the name used as a key in the types map
+// ===================================================================
+SDOString& DataFactoryImpl::getFullTypeName(SDOString& stringBuffer, const SDOString& uri, const SDOString& inTypeName)
+{
+ stringBuffer = uri;
+ stringBuffer += "#";
+ stringBuffer += inTypeName;
+ return stringBuffer;
+}
+
+// ===================================================================
+// getAliasTypeName - return the name used as a key in the types map
+// ===================================================================
+SDOString& DataFactoryImpl::getAliasTypeName(SDOString& stringBuffer, const SDOString& uri, const SDOString& inTypeName)
+{
+ getFullTypeName(stringBuffer, uri, inTypeName);
+ stringBuffer.insert(0, "ALIAS::");
+ return stringBuffer;
+}
+
+// ===================================================================
+// getType - return a pointer to the required Type
+// ===================================================================
+const Type& DataFactoryImpl::getType(const char* uri, const char* inTypeName) const
+{
+
+ const Type* type = findType(uri, inTypeName);
+
+ if (type == 0)
+ {
+ string msg("Type not found :");
+ if (uri != 0) msg += uri;
+ msg += " ";
+ if (inTypeName != 0) msg += inTypeName;
+ throw SDOTypeNotFoundException(TUSCANY_SDO_EINFO,
+ msg.c_str());
+ }
+
+ return *type;
+}
+
+const Type& DataFactoryImpl::getType(const SDOString& uri, const SDOString& inTypeName) const
+{
+ return getType(uri.c_str(), inTypeName.c_str());
+}
+
+// ===================================================================
+// setBaseType - sets the type from which this type inherits properties
+// ===================================================================
+
+void DataFactoryImpl::setBaseType( const Type& type,
+ const Type& base, bool isRestriction)
+{
+ setBaseType(type.getURI(),type.getName(),base.getURI(), base.getName(),
+ isRestriction);
+}
+
+// ===================================================================
+// setBaseType - sets the type from which this type inherits properties
+// ===================================================================
+
+void DataFactoryImpl::setBaseType( const char* typeuri,
+ const char* typenam,
+ const char* baseuri,
+ const char* basename,
+ bool isRestriction )
+{
+ const TypeImpl* base = findTypeImpl(baseuri, basename);
+ if (base == 0)
+ {
+ string msg("Type not found :");
+ if (baseuri != 0) msg += baseuri;
+ msg += " ";
+ if (basename != 0) msg += basename;
+ throw SDOTypeNotFoundException(TUSCANY_SDO_EINFO,
+ msg.c_str());
+ }
+
+ TYPES_MAP::const_iterator typeIter;
+
+ SDOString fullTypeName;
+ getFullTypeName(fullTypeName, typeuri, typenam);
+ typeIter = types.find(fullTypeName);
+
+ if(typeIter == types.end())
+ {
+ string msg("Type not found :");
+ if (typeuri != 0) msg += typeuri;
+ msg += " ";
+ if (typenam != 0) msg += typenam;
+ throw SDOTypeNotFoundException(TUSCANY_SDO_EINFO,
+ msg.c_str());
+ }
+
+ (typeIter->second)->setBaseType(base, isRestriction);
+}
+
+void DataFactoryImpl::setBaseType(const SDOString& typeuri,
+ const SDOString& typenam,
+ const SDOString& baseuri,
+ const SDOString& basename,
+ bool isRestriction)
+{
+ setBaseType(typeuri.c_str(),
+ typenam.c_str(),
+ baseuri.c_str(),
+ basename.c_str(),
+ isRestriction);
+}
+
+
+// ===================================================================
+// setPropertySubstitute - additional type for a property
+// ===================================================================
+
+ void DataFactoryImpl::setPropertySubstitute(
+ const char* uri,
+ const char* inTypeName,
+ const char* propname,
+ const char* subname,
+ const char* subTypeUri,
+ const char* subTypeName)
+ {
+ const TypeImpl* cont = findTypeImpl(uri, inTypeName);
+ if (cont == 0)
+ {
+ string msg("Type not found :");
+ if (uri != 0) msg += uri;
+ msg += " ";
+ if (inTypeName != 0) msg += inTypeName;
+ throw SDOTypeNotFoundException(TUSCANY_SDO_EINFO,
+ msg.c_str());
+ }
+ PropertyImpl* pi = cont->getPropertyImpl(propname);
+ const Type& tsub = getType(subTypeUri,
+ subTypeName);
+ if (pi != 0)pi->setSubstitution(this,subname,tsub);
+ }
+
+ void DataFactoryImpl::setPropertySubstitute(
+ const SDOString& uri,
+ const SDOString& inTypeName,
+ const SDOString& propname,
+ const SDOString& subname,
+ const SDOString& subTypeUri,
+ const SDOString& subTypeName)
+ {
+ setPropertySubstitute(uri.c_str(),
+ inTypeName.c_str(),
+ propname.c_str(),
+ subname.c_str(),
+ subTypeUri.c_str(),
+ subTypeName.c_str());
+ }
+
+ void DataFactoryImpl::setPropertySubstitute(
+ const Type& containertype,
+ const char* propname,
+ const char* subname,
+ const Type& subtype)
+ {
+ setPropertySubstitute(
+ containertype.getURI(),
+ containertype.getName(),
+ propname,subname,
+ subtype.getURI(),subtype.getName());
+ }
+
+ void DataFactoryImpl::setPropertySubstitute(
+ const Type& containertype,
+ const SDOString& propname,
+ const SDOString& subname,
+ const Type& subtype)
+ {
+ setPropertySubstitute(containertype, propname.c_str(), subname.c_str(), subtype);
+ }
+// ===================================================================
+// setDefault - sets the default value for a property of a type
+// ===================================================================
+
+ void DataFactoryImpl::setDefault(
+ const Type& t, const char* propname, bool b )
+ {
+ setDefault(t.getURI(), t.getName(), propname, b);
+ }
+
+ void DataFactoryImpl::setDefault(
+ const Type& t, const SDOString& propname, bool b )
+ {
+ setDefault(t.getURI(), t.getName(), propname.c_str(), b);
+ }
+
+ void DataFactoryImpl::setDefault(
+ const Type& t, const char* propname , char c)
+
+ {
+ setDefault(t.getURI(), t.getName(), propname, c);
+ }
+
+ void DataFactoryImpl::setDefault(
+ const Type& t, const SDOString& propname , char c)
+
+ {
+ setDefault(t.getURI(), t.getName(), propname.c_str(), c);
+ }
+
+ void DataFactoryImpl::setDefault(
+ const Type& t, const char* propname , wchar_t c)
+ {
+ setDefault(t.getURI(), t.getName(), propname, c);
+ }
+
+ void DataFactoryImpl::setDefault(
+ const Type& t, const SDOString& propname , wchar_t c)
+ {
+ setDefault(t.getURI(), t.getName(), propname.c_str(), c);
+ }
+
+ void DataFactoryImpl::setDefault(
+ const Type& t, const char* propname , char* c)
+ {
+ setDefault(t.getURI(), t.getName(), propname, c);
+ }
+
+ 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)
+ {
+ setDefault(t.getURI(), t.getName(), propname, s);
+ }
+
+ void DataFactoryImpl::setDefault(
+ const Type& t, const SDOString& propname , short s)
+ {
+ setDefault(t.getURI(), t.getName(), propname.c_str(), s);
+ }
+
+#if __WORDSIZE !=64
+ void DataFactoryImpl::setDefault(
+ const Type& t, const char* propname , long l)
+ {
+ setDefault(t.getURI(), t.getName(), propname, l);
+ }
+
+ void DataFactoryImpl::setDefault(
+ const Type& t, const SDOString& propname , long l)
+ {
+ setDefault(t.getURI(), t.getName(), propname.c_str(), l);
+ }
+
+#endif
+
+ void DataFactoryImpl::setDefault(
+ const Type& t, const char* propname , int64_t i)
+ {
+ setDefault(t.getURI(), t.getName(), propname, i);
+ }
+
+ void DataFactoryImpl::setDefault(
+ const Type& t, const SDOString& propname , int64_t i)
+ {
+ setDefault(t.getURI(), t.getName(), propname.c_str(), i);
+ }
+
+ void DataFactoryImpl::setDefault(
+ const Type& t, const char* propname , float f)
+ {
+ setDefault(t.getURI(), t.getName(), propname, f);
+ }
+
+ void DataFactoryImpl::setDefault(
+ const Type& t, const SDOString& propname , float f)
+ {
+ setDefault(t.getURI(), t.getName(), propname.c_str(), f);
+ }
+
+ void DataFactoryImpl::setDefault(
+ const Type& t, const char* propname , long double d)
+ {
+ setDefault(t.getURI(), t.getName(), propname, d);
+ }
+
+ void DataFactoryImpl::setDefault(
+ const Type& t, const SDOString& propname , long double d)
+ {
+ setDefault(t.getURI(), t.getName(), propname.c_str(), d);
+ }
+
+ void DataFactoryImpl::setDefault(
+ const Type& t, const char* propname , const SDODate d)
+ {
+ setDefault(t.getURI(), t.getName(), propname, d);
+ }
+
+ void DataFactoryImpl::setDefault(
+ const Type& t, const SDOString& propname , const SDODate d)
+ {
+ setDefault(t.getURI(), t.getName(), propname.c_str(), d);
+ }
+
+ void DataFactoryImpl::setDefault(
+ const Type& t, const char* propname , const wchar_t* c, unsigned int len)
+ {
+ setDefault(t.getURI(), t.getName(), propname, c, len);
+ }
+
+ void DataFactoryImpl::setDefault(
+ const Type& t, const SDOString& propname , const wchar_t* c, unsigned int len)
+ {
+ setDefault(t.getURI(), t.getName(), propname.c_str(), c, len);
+ }
+
+ void DataFactoryImpl::setDefault(
+ const Type& t, const char* propname , const char* c, unsigned int len)
+ {
+ setDefault(t.getURI(), t.getName(), propname, c, len);
+ }
+
+ void DataFactoryImpl::setDefault(
+ const Type& t, const SDOString& propname , const SDOString& c, unsigned int len)
+ {
+ setDefault(t.getURI(), t.getName(), propname.c_str(), c.c_str(), len);
+ }
+
+ void DataFactoryImpl::setDefault(
+ const char* typuri, const char* typnam,
+ const char* propname, bool b )
+ {
+ const TypeImpl* ti = findTypeImpl(typuri,typnam);
+ PropertyImpl* pi = ti->getPropertyImpl(propname);
+ if (pi != 0)pi->setDefault(b);
+ }
+
+ void DataFactoryImpl::setDefault(
+ const SDOString& typuri, const SDOString& typnam,
+ const SDOString& propname, bool b )
+ {
+ setDefault(typuri.c_str(), typnam.c_str(), propname.c_str(), b);
+ }
+
+ void DataFactoryImpl::setDefault(
+ const char* typuri, const char* typnam,
+ const char* propname , char c)
+ {
+ const TypeImpl* ti = findTypeImpl(typuri,typnam);
+ PropertyImpl* pi = ti->getPropertyImpl(propname);
+ if (pi != 0)pi->setDefault(c);
+ }
+
+ void DataFactoryImpl::setDefault(
+ const SDOString& typuri, const SDOString& typnam,
+ const SDOString& propname , char c)
+ {
+ setDefault(typuri.c_str(), typnam.c_str(), propname.c_str(), c);
+ }
+
+ void DataFactoryImpl::setDefault(
+ const char* typuri, const char* typnam,
+ const char* propname , wchar_t c)
+ {
+ const TypeImpl* ti = findTypeImpl(typuri,typnam);
+ PropertyImpl* pi = ti->getPropertyImpl(propname);
+ if (pi != 0)pi->setDefault(c);
+ }
+
+ void DataFactoryImpl::setDefault(
+ const SDOString& typuri, const SDOString& typnam,
+ const SDOString& propname , wchar_t c)
+ {
+ setDefault(typuri.c_str(), typnam.c_str(), propname.c_str(), c);
+ }
+
+ void DataFactoryImpl::setDefault(
+ const char* typuri, const char* typnam,
+ const char* propname , char* c)
+ {
+ const TypeImpl* ti = findTypeImpl(typuri,typnam);
+ PropertyImpl* pi = ti->getPropertyImpl(propname);
+ if (pi != 0)pi->setDefault(c);
+ }
+
+ 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,
+ const char* propname , short s)
+ {
+ const TypeImpl* ti = findTypeImpl(typuri,typnam);
+ PropertyImpl* pi = ti->getPropertyImpl(propname);
+ if (pi != 0)pi->setDefault(s);
+ }
+
+ void DataFactoryImpl::setDefault(
+ const SDOString& typuri, const SDOString& typnam,
+ const SDOString& propname , short s)
+ {
+ setDefault(typuri.c_str(), typnam.c_str(), propname.c_str(), s);
+ }
+
+#if __WORDSIZE !=64
+ void DataFactoryImpl::setDefault(
+ const char* typuri, const char* typnam,
+ const char* propname , long l)
+ {
+ const TypeImpl* ti = findTypeImpl(typuri,typnam);
+ PropertyImpl* pi = ti->getPropertyImpl(propname);
+ if (pi != 0)pi->setDefault(l);
+ }
+
+ void DataFactoryImpl::setDefault(
+ const SDOString& typuri, const SDOString& typnam,
+ const SDOString& propname , long l)
+ {
+ setDefault(typuri.c_str(), typnam.c_str(), propname.c_str(), l);
+ }
+
+#endif
+
+ void DataFactoryImpl::setDefault(
+ const char* typuri, const char* typnam,
+ const char* propname , int64_t i)
+ {
+ const TypeImpl* ti = findTypeImpl(typuri,typnam);
+ PropertyImpl* pi = ti->getPropertyImpl(propname);
+ if (pi != 0)pi->setDefault(i);
+ }
+
+ void DataFactoryImpl::setDefault(
+ const SDOString& typuri, const SDOString& typnam,
+ const SDOString& propname , int64_t i)
+ {
+ setDefault(typuri.c_str(), typnam.c_str(), propname.c_str(), i);
+ }
+
+ void DataFactoryImpl::setDefault(
+ const char* typuri, const char* typnam,
+ const char* propname , float f)
+ {
+ const TypeImpl* ti = findTypeImpl(typuri,typnam);
+ PropertyImpl* pi = ti->getPropertyImpl(propname);
+ if (pi != 0)pi->setDefault(f);
+ }
+
+ void DataFactoryImpl::setDefault(
+ const SDOString& typuri, const SDOString& typnam,
+ const SDOString& propname , float f)
+ {
+ setDefault(typuri.c_str(), typnam.c_str(), propname.c_str(), f);
+ }
+
+ void DataFactoryImpl::setDefault(
+ const char* typuri, const char* typnam,
+ const char* propname , long double d)
+ {
+ const TypeImpl* ti = findTypeImpl(typuri,typnam);
+ PropertyImpl* pi = ti->getPropertyImpl(propname);
+ if (pi != 0)pi->setDefault(d);
+ }
+
+ void DataFactoryImpl::setDefault(
+ const SDOString& typuri, const SDOString& typnam,
+ const SDOString& propname , long double d)
+ {
+ setDefault(typuri.c_str(), typnam.c_str(), propname.c_str(), d);
+ }
+
+ void DataFactoryImpl::setDefault(
+ const char* typuri, const char* typnam,
+ const char* propname , const SDODate d)
+ {
+ const TypeImpl* ti = findTypeImpl(typuri,typnam);
+ PropertyImpl* pi = ti->getPropertyImpl(propname);
+ if (pi != 0)pi->setDefault(d);
+ }
+
+ void DataFactoryImpl::setDefault(
+ const SDOString& typuri, const SDOString& typnam,
+ const SDOString& propname , const SDODate d)
+ {
+ setDefault(typuri.c_str(), typnam.c_str(), propname.c_str(), d);
+ }
+
+ void DataFactoryImpl::setDefault(
+ const char* typuri, const char* typnam,
+ const char* propname , const wchar_t* c, unsigned int len)
+ {
+ const TypeImpl* ti = findTypeImpl(typuri,typnam);
+ PropertyImpl* pi = ti->getPropertyImpl(propname);
+ if (pi != 0)pi->setDefault(c,len);
+ }
+
+ void DataFactoryImpl::setDefault(
+ const SDOString& typuri, const SDOString& typnam,
+ const SDOString& propname , const wchar_t* c, unsigned int len)
+ {
+ setDefault(typuri.c_str(), typnam.c_str(), propname.c_str(), c, len);
+ }
+
+ void DataFactoryImpl::setDefault(
+ const char* typuri, const char* typnam,
+ const char* propname , const char* c, unsigned int len)
+ {
+ const TypeImpl* ti = findTypeImpl(typuri,typnam);
+ PropertyImpl* pi = ti->getPropertyImpl(propname);
+ if (pi != 0)pi->setDefault(c,len);
+ }
+
+ void DataFactoryImpl::setDefault(
+ const SDOString& typuri, const SDOString& typnam,
+ const SDOString& propname , const SDOString& c, unsigned int len)
+ {
+ setDefault(typuri.c_str(), typnam.c_str(), propname.c_str(), c.c_str(), len);
+ }
+
+ void DataFactoryImpl::setOpposite(
+ const Type& typ,
+ const char* propnam,
+ const Type& opptyp,
+ const char* opppropnam)
+ {
+ throw SDOUnsupportedOperationException(TUSCANY_SDO_EINFO,
+ "Not implemented");
+ }
+
+ void DataFactoryImpl::setOpposite(
+ const Type& typ,
+ const SDOString& propnam,
+ const Type& opptyp,
+ const SDOString& opppropnam)
+ {
+ setOpposite(typ, propnam.c_str(), opptyp, opppropnam.c_str());
+ }
+
+// ===================================================================
+// getTypeImpl - return a pointer to the required TypeImpl
+// ===================================================================
+const TypeImpl& DataFactoryImpl::getTypeImpl(const SDOString& uri, const SDOString& inTypeName) const
+{
+ const TypeImpl* type = findTypeImpl(uri, inTypeName);
+
+ if (type == 0)
+ {
+ string msg("Type not found :");
+ msg += uri + " " + inTypeName;
+ throw SDOTypeNotFoundException(TUSCANY_SDO_EINFO,
+ msg.c_str());
+ }
+
+ return *type;;
+}
+
+// ===================================================================
+// findType
+// ===================================================================
+const Type* DataFactoryImpl::findType(const SDOString uri, const SDOString inTypeName) const
+{
+ return (Type*) findTypeImpl(uri, inTypeName);
+}
+
+// ===================================================================
+// findTypeImpl
+// ===================================================================
+
+const TypeImpl* DataFactoryImpl::findTypeImpl(const SDOString& uri, const SDOString& inTypeName) const
+{
+ SDOString fullTypeName;
+ getFullTypeName(fullTypeName, uri, inTypeName);
+ TYPES_MAP::const_iterator typeIter;
+ typeIter = types.find(fullTypeName);
+ if(typeIter != types.end())
+ {
+ return typeIter->second;
+ }
+ else
+ {
+ // try alias names
+ getAliasTypeName(fullTypeName, uri, inTypeName);
+ typeIter = types.find(fullTypeName);
+ if(typeIter != types.end())
+ {
+ return typeIter->second;
+ }
+ }
+ return 0;
+}
+
+// ===================================================================
+// setAlias - sets a new alias for this type
+// ===================================================================
+
+void DataFactoryImpl::setAlias(const char* typeuri,
+ const char* typenam,
+ const char* alias)
+{
+
+ SDOString fullTypeName;
+ getFullTypeName(fullTypeName, typeuri, typenam);
+ TYPES_MAP::iterator typeIter;
+ typeIter = types.find(fullTypeName);
+ if(typeIter != types.end())
+ {
+ (typeIter->second)->setAlias(alias);
+ getAliasTypeName(fullTypeName, typeuri, alias);
+ types[fullTypeName] = typeIter->second;
+ }
+
+}
+
+void DataFactoryImpl::setAlias(const SDOString& typeuri,
+ const SDOString& typenam,
+ const SDOString& alias)
+{
+ setAlias(typeuri.c_str(), typenam.c_str(), alias.c_str());
+}
+
+// ===================================================================
+// setAlias - sets a new alias for this type
+// ===================================================================
+
+void DataFactoryImpl::setAlias(const char* typeuri,
+ const char* typenam,
+ const char* propname,
+ const char* alias)
+{
+ const TypeImpl& t = getTypeImpl(typeuri, typenam);
+ PropertyImpl* p = t.getPropertyImpl(propname);
+ if (p != 0)p->setAlias(alias);
+
+}
+
+void DataFactoryImpl::setAlias(const SDOString& typeuri,
+ const SDOString& typenam,
+ const SDOString& propname,
+ const SDOString& alias)
+{
+ setAlias(typeuri.c_str(), typenam.c_str(), propname.c_str(), alias.c_str());
+}
+
+// ===================================================================
+// getTypes - gets the full list of types for this factory
+// ===================================================================
+
+TypeList DataFactoryImpl::getTypes() const
+{
+ TYPES_MAP::const_iterator typeIter;
+
+
+ std::vector<const Type*> typeVector;
+
+ for (typeIter = types.begin() ; typeIter != types.end();
+ ++typeIter) {
+ if (strncmp((typeIter->first).c_str(),"ALIAS::", 7)) {
+ typeVector.insert(typeVector.end(),typeIter->second);
+ }
+ }
+
+
+ return typeVector;
+}
+
+
+// ===================================================================
+// resolve - resolves the type and includes all the properties from
+// the supertype. After this has been called, no further changes
+// to the type hierarchy are allowed.
+// ===================================================================
+
+void DataFactoryImpl::resolve()
+{
+
+ TYPES_MAP::iterator typeIter;
+ for (typeIter = resolvePending.begin() ; typeIter != resolvePending.end();
+ ++typeIter)
+ {
+ (typeIter->second)->initCompoundProperties();
+ (typeIter->second)->validateChangeSummary();
+ }
+ // Need to empty the resolvePending set.
+ resolvePending.clear();
+
+}
+
+// ===================================================================
+// create - creates a data object from the types available.
+// This first resolves the type hierarchy, and thus no further changes
+// to the type hierarchy are allowed.
+// ===================================================================
+
+
+RefCountingPointer<DataObject> DataFactoryImpl::create(const char* uri, const char* typeName)
+{
+
+// New types can always be added now, so if there are any that haven't been
+// resolved, do them now. The isResolved boolean is superseded by the
+// resolvePending set being non-empty.
+
+ if (!resolvePending.empty())
+ {
+ // Allow creation of types and properties before resolve.
+ if (uri != 0 && !strcmp(uri,SDOUtils::sdoURI)) {
+ if (!strcmp(typeName,"Type") || !strcmp(typeName,"Property"))
+ {
+ DataObject* dob = (DataObject*)(new DataObjectImpl(this, getTypeImpl(uri, typeName)));
+ return dob;
+ }
+ }
+ resolve();
+ }
+
+ const TypeImpl* ti = findTypeImpl(uri,typeName);
+ if (ti == 0)
+ {
+ string msg("Instantiation of unknown type :");
+ if (uri != 0) msg += uri;
+ msg += " ";
+ if (typeName != 0)msg += typeName;
+ throw SDOTypeNotFoundException(TUSCANY_SDO_EINFO,
+ msg.c_str());
+ }
+
+ if (ti->isAbstractType())
+ {
+ string msg("Instantiation of abstract type :");
+ if (uri != 0)msg += uri;
+ msg += " ";
+ if (typeName != 0)msg += typeName;
+ throw SDOUnsupportedOperationException(TUSCANY_SDO_EINFO,
+ msg.c_str());
+ }
+
+ DataObject* dob = (DataObject*)(new DataObjectImpl(this, getTypeImpl(uri, typeName)));
+ return dob;
+}
+
+// ===================================================================
+// create - creates a data object from the types available.
+// This first resolves the type hierarchy, and thus no further changes
+// to the type hierarchy are allowed.
+// ===================================================================
+
+
+RefCountingPointer<DataObject> DataFactoryImpl::create(const SDOString& uri, const SDOString& typeName)
+{
+ return create(uri.c_str(), typeName.c_str());
+}
+
+// ===================================================================
+// The openProperties map is a list of the curently present open
+// properties as used by this factory. It will cause the
+// open properties to be written out as attributes and elements
+// of the root data object when a graph is serialized.
+// ===================================================================
+ const propertyMap& DataFactoryImpl::getOpenProperties()
+ {
+ return openProperties;
+ }
+
+ void DataFactoryImpl::addOpenProperty(const PropertyImpl& prop)
+ {
+ propertyMap::iterator i;
+ while ((i = openProperties.find(prop.getName())) !=
+ openProperties.end())
+ {
+ openProperties.erase(i);
+ }
+ openProperties.insert(make_pair(prop.getName(),prop));
+ }
+
+ void DataFactoryImpl::removeOpenProperty(const SDOString& name)
+ {
+ propertyMap::iterator i =
+ openProperties.find(name.c_str());
+ if (i != openProperties.end())
+ {
+ openProperties.erase(i);
+ }
+ }
+
+
+// ===================================================================
+// create - creates a data object from the types available.
+// This first resolves the type hierarchy, and thus no further changes
+// to the type hierarchy are allowed.
+// ===================================================================
+
+RefCountingPointer<DataObject> DataFactoryImpl::create(const Type& type)
+{
+ return create( type.getURI(), type.getName());
+}
+
+
+// ===================================================================
+// setDASValue - Set a value on a Type
+// ===================================================================
+void DataFactoryImpl::setDASValue(const Type& type,
+ const char* name,
+ DASValue* value)
+{
+ setDASValue(type.getURI(), type.getName(), name, value);
+}
+
+void DataFactoryImpl::setDASValue(const Type& type,
+ const SDOString& name,
+ DASValue* value)
+{
+ setDASValue(type.getURI(), type.getName(), name.c_str(), value);
+}
+
+void DataFactoryImpl::setDASValue(const char* typeuri,
+ const char* typenam,
+ const char* name,
+ DASValue* value)
+{
+ TypeImpl* type = (TypeImpl*)findTypeImpl(typeuri, typenam);
+ if (type != NULL)
+ {
+ type->setDASValue(name, value);
+ }
+}
+
+void DataFactoryImpl::setDASValue(const SDOString& typeuri,
+ const SDOString& typenam,
+ const SDOString& name,
+ DASValue* value)
+{
+ setDASValue(typeuri.c_str(), typenam.c_str(), name.c_str(), value);
+}
+
+// ===================================================================
+// getDASValue - retrieve a value from a Type
+// ===================================================================
+
+DASValue* DataFactoryImpl::getDASValue(const Type& type,
+ const char* name) const
+{
+ return getDASValue(type.getURI(), type.getName(), name);
+}
+
+DASValue* DataFactoryImpl::getDASValue(const Type& type,
+ const SDOString& name) const
+{
+ return getDASValue(type.getURI(), type.getName(), name.c_str());
+}
+
+DASValue* DataFactoryImpl::getDASValue(const char* typeuri,
+ const char* typenam,
+ const char* name) const
+{
+ TypeImpl* type = (TypeImpl*)findTypeImpl(typeuri, typenam);
+ if (type != NULL)
+ {
+ return type->getDASValue(name);
+ }
+
+ return NULL;
+}
+
+DASValue* DataFactoryImpl::getDASValue(const SDOString& typeuri,
+ const SDOString& typenam,
+ const SDOString& name) const
+{
+ return getDASValue(typeuri.c_str(), typenam.c_str(), name.c_str());
+}
+
+// ===================================================================
+// setDASValue - Set a value on a Property
+// ===================================================================
+void DataFactoryImpl::setDASValue(
+ const Type& type,
+ const char* propertyName,
+ const char* name,
+ DASValue* value)
+{
+ setDASValue(type.getURI(), type.getName(), propertyName, name, value);
+}
+
+void DataFactoryImpl::setDASValue(
+ const Type& type,
+ const SDOString& propertyName,
+ const SDOString& name,
+ DASValue* value)
+{
+ setDASValue(type.getURI(), type.getName(), propertyName.c_str(), name.c_str(), value);
+}
+
+void DataFactoryImpl::setDASValue(
+ const char* typeuri,
+ const char* typenam,
+ const char* propertyName,
+ const char* name,
+ DASValue* value)
+{
+ const TypeImpl* type = findTypeImpl(typeuri, typenam);
+ if (type != NULL)
+ {
+ PropertyImpl* prop = type->getPropertyImplPure(propertyName);
+ if (prop != 0)prop->setDASValue(name, value);
+ }
+}
+
+void DataFactoryImpl::setDASValue(
+ const SDOString& typeuri,
+ const SDOString& typenam,
+ const SDOString& propertyName,
+ const SDOString& name,
+ DASValue* value)
+{
+ setDASValue(typeuri.c_str(), typenam.c_str(), propertyName.c_str(), name.c_str(), value);
+}
+
+// ===================================================================
+// getDASValue - retrieve a value from a Property
+// ===================================================================
+DASValue* DataFactoryImpl::getDASValue(
+ const Type& type,
+ const char* propertyName,
+ const char* name) const
+{
+ return getDASValue(type.getURI(), type.getName(), propertyName, name);
+}
+
+DASValue* DataFactoryImpl::getDASValue(
+ const Type& type,
+ const SDOString& propertyName,
+ const SDOString& name) const
+{
+ return getDASValue(type.getURI(), type.getName(), propertyName.c_str(), name.c_str());
+}
+
+DASValue* DataFactoryImpl::getDASValue(
+ const char* typeuri,
+ const char* typenam,
+ const char* propertyName,
+ const char* name) const
+{
+ const TypeImpl* type = findTypeImpl(typeuri, typenam);
+ if (type != NULL)
+ {
+ try
+ {
+ PropertyImpl* prop = type->getPropertyImpl(propertyName);
+ if (prop != 0)return prop->getDASValue(name);
+ }
+ catch (const SDOPropertyNotFoundException&)
+ {
+ // Ignore - return null
+ }
+ }
+
+ return NULL;
+}
+
+DASValue* DataFactoryImpl::getDASValue(
+ const SDOString& typeuri,
+ const SDOString& typenam,
+ const SDOString& propertyName,
+ const SDOString& name) const
+{
+ return getDASValue(typeuri.c_str(), typenam.c_str(), propertyName.c_str(), name.c_str());
+}
+
+
+ std::ostream& DataFactoryImpl::printSelf(std::ostream &os)
+ {
+ SDOUtils::printTypes(os, this);
+ return os;
+ }
+
+};
+};
+
diff --git a/sdo-cpp/trunk/runtime/core/src/commonj/sdo/DataFactoryImpl.h b/sdo-cpp/trunk/runtime/core/src/commonj/sdo/DataFactoryImpl.h
new file mode 100644
index 0000000000..a34f5482f8
--- /dev/null
+++ b/sdo-cpp/trunk/runtime/core/src/commonj/sdo/DataFactoryImpl.h
@@ -0,0 +1,704 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you 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$ */
+
+#ifndef _DataFactoryIMPL_H_
+#define _DataFactoryIMPL_H_
+
+#include "commonj/sdo/disable_warn.h"
+
+#include "commonj/sdo/DataFactory.h"
+#include "commonj/sdo/TypeImpl.h"
+#include "commonj/sdo/RefCountingPointer.h"
+#include "commonj/sdo/PropertyImpl.h"
+#include "commonj/sdo/SDOXMLString.h"
+
+
+#include <map>
+
+
+
+namespace commonj{
+namespace sdo{
+
+ typedef std::map<std::string, PropertyImpl> propertyMap;
+
+/**
+ * DataFactoryImpl implements the abstract class DataFactory.
+ * DataFactoryImpl holds metadata and creates DataObjects.
+ *
+ * The DataFactory holds properties and types loaded from XSD, or
+ * created using the DataFactory API.
+ */
+class DataFactoryImpl : public DataFactory
+{
+public:
+ DataFactoryImpl();
+ virtual ~DataFactoryImpl();
+
+ DataFactoryImpl(const DataFactoryImpl& inmdg);
+ DataFactoryImpl& operator=(const DataFactoryImpl& inmdg);
+
+ /**
+ * DataFactory::clone copies a data factory
+ *
+ * Copy the data factory, and return a new data factory which
+ * has the same properties and types, but is still able to have
+ * new types added to it.
+ */
+
+ SDO_API virtual DataFactoryPtr clone();
+
+ virtual void addType(const char* uri, const char* inTypeName,
+ bool isSeqenced = false,
+ bool isOpen = false,
+ bool isAbstract = false,
+ bool isDataType = false
+ );
+
+ virtual void addType(const SDOString& uri, const SDOString& inTypeName,
+ bool isSeqenced = false,
+ bool isOpen = false,
+ bool isAbstract = false,
+ bool isDataType = false
+ );
+
+ virtual void addType(const char* uri, const char* inTypeName,
+ bool isSeqenced ,
+ bool isOpen ,
+ bool isAbstract ,
+ bool isDataType ,
+ bool isFromList );
+
+ virtual void addType(const SDOString& uri, const SDOString& inTypeName,
+ bool isSeqenced ,
+ bool isOpen ,
+ bool isAbstract ,
+ bool isDataType ,
+ bool isFromList );
+
+ virtual void addPropertyToType(const char* uri,
+ const char* inTypeName,
+ const char* propname,
+ const char* propTypeUri,
+ const char* propTypeName,
+ bool isMany = false);
+
+ virtual void addPropertyToType(const SDOString& uri,
+ const SDOString& inTypeName,
+ const SDOString& propname,
+ const SDOString& propTypeUri,
+ const SDOString& propTypeName,
+ bool isMany = false);
+
+ virtual void addPropertyToType(const char* uri,
+ const char* inTypeName,
+ const char* propname,
+ const Type& propType,
+ bool isMany = false);
+
+ virtual void addPropertyToType(const SDOString& uri,
+ const SDOString& inTypeName,
+ const SDOString& propname,
+ const Type& propType,
+ bool isMany = false);
+
+ virtual void addPropertyToType(const Type& type,
+ const char* propname,
+ const Type& propType,
+ bool isMany = false);
+
+ virtual void addPropertyToType(const Type& type,
+ const SDOString& propname,
+ const Type& propType,
+ bool isMany = false);
+
+ virtual void addPropertyToType(const Type& type,
+ const char* propname,
+ const char* propTypeUri,
+ const char* propTypeName,
+ bool isMany = false);
+
+ virtual void addPropertyToType(const Type& type,
+ const SDOString& propname,
+ const SDOString& propTypeUri,
+ const SDOString& propTypeName,
+ bool isMany = false);
+
+ virtual void addPropertyToType(const char* uri,
+ const char* inTypeName,
+ const char* propname,
+ const char* propTypeUri,
+ const char* propTypeName,
+ bool isMany ,
+ bool isReadOnly,
+ bool isContainment);
+
+ virtual void addPropertyToType(const SDOString& uri,
+ const SDOString& inTypeName,
+ const SDOString& propname,
+ const SDOString& propTypeUri,
+ const SDOString& propTypeName,
+ bool isMany ,
+ bool isReadOnly,
+ bool isContainment);
+
+ virtual void addPropertyToType(const char* uri,
+ const char* inTypeName,
+ const char* propname,
+ const Type& propType,
+ bool isMany,
+ bool isReadOnly,
+ bool isContainment);
+
+ virtual void addPropertyToType(const SDOString& uri,
+ const SDOString& inTypeName,
+ const SDOString& propname,
+ const Type& propType,
+ bool isMany,
+ bool isReadOnly,
+ bool isContainment);
+
+ virtual void addPropertyToType(const Type& type,
+ const char* propname,
+ const Type& propType,
+ bool isMany,
+ bool isReadOnly,
+ bool isContainment);
+
+ virtual void addPropertyToType(const Type& type,
+ const SDOString& propname,
+ const Type& propType,
+ bool isMany,
+ bool isReadOnly,
+ bool isContainment);
+
+ virtual void addPropertyToType(const Type& type,
+ const char* propname,
+ const char* propTypeUri,
+ const char* propTypeName,
+ bool isMany,
+ bool isReadOnly,
+ bool isContainment);
+
+ virtual void addPropertyToType(const Type& type,
+ const SDOString& propname,
+ const SDOString& propTypeUri,
+ const SDOString& propTypeName,
+ bool isMany,
+ bool isReadOnly,
+ bool isContainment);
+
+
+ virtual void setBaseType( const Type& type,
+ const Type& base,
+ bool isRestriction = false);
+
+ virtual void setBaseType( const char* typeuri,
+ const char* typenam,
+ const char* baseuri,
+ const char* basename,
+ bool isRestriction = false);
+
+ virtual void setBaseType( const SDOString& typeuri,
+ const SDOString& typenam,
+ const SDOString& baseuri,
+ const SDOString& basename,
+ bool isRestriction = false);
+
+ virtual const Type& getType(const char* uri, const char* inTypeName) const;
+
+ virtual const Type& getType(const SDOString& uri, const SDOString& inTypeName) const;
+
+ virtual TypeList getTypes() const;
+
+ virtual DataObjectPtr create(const char* uri, const char* typeName) ;
+
+ virtual DataObjectPtr create(const SDOString& uri, const SDOString& typeName) ;
+
+ virtual DataObjectPtr create(const Type& type) ;
+
+ virtual void setAlias(const char* typeuri,
+ const char* typenam,
+ const char* alias) ;
+
+ virtual void setAlias(const SDOString& typeuri,
+ const SDOString& typenam,
+ const SDOString& alias) ;
+
+ virtual void setAlias(const char* typeuri,
+ const char* typname,
+ const char* propname,
+ const char* alias) ;
+
+ virtual void setAlias(const SDOString& typeuri,
+ const SDOString& typname,
+ const SDOString& propname,
+ const SDOString& alias) ;
+
+ virtual void setOpposite (const Type& type,
+ const char* propname,
+ const Type& opptype,
+ const char* opppropname) ;
+
+ virtual void setOpposite (const Type& type,
+ const SDOString& propname,
+ const Type& opptype,
+ const SDOString& opppropname) ;
+
+
+ virtual void setPropertySubstitute(
+ const char* uri,
+ const char* inTypeName,
+ const char* propname,
+ const char* subname,
+ const char* subTypeUri,
+ const char* subTypeName);
+
+ virtual void setPropertySubstitute(
+ const SDOString& uri,
+ const SDOString& inTypeName,
+ const SDOString& propname,
+ const SDOString& subname,
+ const SDOString& subTypeUri,
+ const SDOString& subTypeName);
+
+ virtual void setPropertySubstitute(
+ const Type& containertype,
+ const char* propname,
+ const char* subname,
+ const Type& subtype);
+
+ virtual void setPropertySubstitute(
+ const Type& containertype,
+ const SDOString& propname,
+ const SDOString& subname,
+ const Type& subtype);
+
+ ////////////////////////////////////////////////////////
+ virtual void setDefault(
+ const Type& t,
+ const char* propname,
+ bool b ) ;
+
+ virtual void setDefault(
+ const Type& t,
+ const SDOString& propname,
+ bool b ) ;
+
+ virtual void setDefault(
+ const Type& t,
+ const char* propname ,
+ char c) ;
+
+ virtual void setDefault(
+ const Type& t,
+ const SDOString& propname ,
+ char c) ;
+
+ virtual void setDefault(
+ const Type& t,
+ const char* propname ,
+ wchar_t c) ;
+
+ virtual void setDefault(
+ const Type& t,
+ const SDOString& propname ,
+ wchar_t c) ;
+
+ virtual void setDefault(
+ const Type& t,
+ const char* propname ,
+ char* c) ;
+
+ virtual void setDefault(
+ const Type& t,
+ const SDOString& propname ,
+ SDOString& outstr);
+
+ virtual void setDefault(
+ const Type& t,
+ const char* propname ,
+ short s) ;
+
+ virtual void setDefault(
+ const Type& t,
+ const SDOString& propname ,
+ short s) ;
+
+
+
+#if __WORDSIZE !=64
+ virtual void setDefault(
+ const Type& t,
+ const char* propname ,
+ long l) ;
+
+ virtual void setDefault(
+ const Type& t,
+ const SDOString& propname ,
+ long l) ;
+
+#endif
+
+ virtual void setDefault(
+ const Type& t,
+ const char* propname ,
+ int64_t i) ;
+
+ virtual void setDefault(
+ const Type& t,
+ const SDOString& propname ,
+ int64_t i) ;
+
+ virtual void setDefault(
+ const Type& t,
+ const char* propname ,
+ float f) ;
+
+ virtual void setDefault(
+ const Type& t,
+ const SDOString& propname ,
+ float f) ;
+
+ virtual void setDefault(
+ const Type& t,
+ const char* propname ,
+ long double d) ;
+
+ virtual void setDefault(
+ const Type& t,
+ const SDOString& propname ,
+ long double d) ;
+
+ virtual void setDefault(
+ const Type& t,
+ const char* propname ,
+ const SDODate d) ;
+
+ virtual void setDefault(
+ const Type& t,
+ const SDOString& propname ,
+ const SDODate d) ;
+
+ virtual void setDefault(
+ const Type& t,
+ const char* propname ,
+ const wchar_t* c,
+ unsigned int len) ;
+
+ virtual void setDefault(
+ const Type& t,
+ const SDOString& propname ,
+ const wchar_t* c,
+ unsigned int len) ;
+
+ virtual void setDefault(
+ const Type& t,
+ const char* propname ,
+ const char* c,
+ unsigned int len) ;
+
+ virtual void setDefault(
+ const Type& t,
+ const SDOString& propname ,
+ const SDOString& c,
+ unsigned int len) ;
+
+ virtual void setDefault(
+ const char* typuri,
+ const char* typnam,
+ const char* propname,
+ bool b ) ;
+
+ virtual void setDefault(
+ const SDOString& typuri,
+ const SDOString& typnam,
+ const SDOString& propname,
+ bool b ) ;
+
+ virtual void setDefault(
+ const char* typuri,
+ const char* typnam,
+ const char* propname ,
+ char c) ;
+
+ virtual void setDefault(
+ const SDOString& typuri,
+ const SDOString& typnam,
+ const SDOString& propname ,
+ char c) ;
+
+ virtual void setDefault(
+ const char* typuri,
+ const char* typnam,
+ const char* propname ,
+ wchar_t c) ;
+
+ virtual void setDefault(
+ const SDOString& typuri,
+ const SDOString& typnam,
+ const SDOString& propname ,
+ wchar_t c) ;
+
+ virtual void setDefault(
+ const char* typuri,
+ const char* typnam,
+ const char* propname ,
+ char* c) ;
+
+ virtual void setDefault(
+ const SDOString& typuri,
+ const SDOString& typnam,
+ const SDOString& propname ,
+ SDOString& c) ;
+
+ virtual void setDefault(
+ const char* typuri,
+ const char* typnam,
+ const char* propname ,
+ short s) ;
+
+ virtual void setDefault(
+ const SDOString& typuri,
+ const SDOString& typnam,
+ const SDOString& propname ,
+ short s) ;
+
+#if __WORDSIZE !=64
+ virtual void setDefault(
+ const char* typuri,
+ const char* typnam,
+ const char* propname ,
+ long l) ;
+
+ virtual void setDefault(
+ const SDOString& typuri,
+ const SDOString& typnam,
+ const SDOString& propname ,
+ long l) ;
+
+#endif
+
+ virtual void setDefault(
+ const char* typuri,
+ const char* typnam,
+ const char* propname ,
+ int64_t i) ;
+
+ virtual void setDefault(
+ const SDOString& typuri,
+ const SDOString& typnam,
+ const SDOString& propname ,
+ int64_t i) ;
+
+ virtual void setDefault(
+ const char* typuri,
+ const char* typnam,
+ const char* propname ,
+ float f) ;
+
+ virtual void setDefault(
+ const SDOString& typuri,
+ const SDOString& typnam,
+ const SDOString& propname ,
+ float f) ;
+
+ virtual void setDefault(
+ const char* typuri,
+ const char* typnam,
+ const char* propname ,
+ long double d) ;
+
+ virtual void setDefault(
+ const SDOString& typuri,
+ const SDOString& typnam,
+ const SDOString& propname ,
+ long double d) ;
+
+ virtual void setDefault(
+ const char* typuri,
+ const char* typnam,
+ const char* propname ,
+ const SDODate d) ;
+
+ virtual void setDefault(
+ const SDOString& typuri,
+ const SDOString& typnam,
+ const SDOString& propname ,
+ const SDODate d) ;
+
+ virtual void setDefault(
+ const char* typuri,
+ const char* typnam,
+ const char* propname ,
+ const wchar_t* c,
+ unsigned int len) ;
+
+ virtual void setDefault(
+ const SDOString& typuri,
+ const SDOString& typnam,
+ const SDOString& propname ,
+ const wchar_t* c,
+ unsigned int len) ;
+
+ virtual void setDefault(
+ const char* typuri,
+ const char* typnam,
+ const char* propname ,
+ const char* c,
+ unsigned int len) ;
+
+ virtual void setDefault(
+ const SDOString& typuri,
+ const SDOString& typnam,
+ const SDOString& propname ,
+ const SDOString& c,
+ unsigned int len) ;
+
+ virtual void setDASValue(
+ const Type& type,
+ const char* name,
+ DASValue* value);
+
+ virtual void setDASValue(
+ const Type& type,
+ const SDOString& name,
+ DASValue* value);
+
+ virtual void setDASValue(
+ const char* typeuri,
+ const char* typenam,
+ const char* name,
+ DASValue* value);
+
+ virtual void setDASValue(
+ const SDOString& typeuri,
+ const SDOString& typenam,
+ const SDOString& name,
+ DASValue* value);
+
+ virtual DASValue* getDASValue(
+ const Type& type,
+ const char* name) const;
+
+ virtual DASValue* getDASValue(
+ const Type& type,
+ const SDOString& name) const;
+
+ virtual DASValue* getDASValue(
+ const char* typeuri,
+ const char* typenam,
+ const char* name) const;
+
+ virtual DASValue* getDASValue(
+ const SDOString& typeuri,
+ const SDOString& typenam,
+ const SDOString& name) const;
+
+ virtual void setDASValue(
+ const Type& type,
+ const char* propertyName,
+ const char* name,
+ DASValue* value);
+
+ virtual void setDASValue(
+ const Type& type,
+ const SDOString& propertyName,
+ const SDOString& name,
+ DASValue* value);
+
+ virtual void setDASValue(
+ const char* typeuri,
+ const char* typenam,
+ const char* propertyName,
+ const char* name,
+ DASValue* value);
+
+ virtual void setDASValue(
+ const SDOString& typeuri,
+ const SDOString& typenam,
+ const SDOString& propertyName,
+ const SDOString& name,
+ DASValue* value);
+
+ virtual DASValue* getDASValue(
+ const Type& type,
+ const char* propertyName,
+ const char* name) const;
+
+ virtual DASValue* getDASValue(
+ const Type& type,
+ const SDOString& propertyName,
+ const SDOString& name) const;
+
+ virtual DASValue* getDASValue(
+ const char* typeuri,
+ const char* typenam,
+ const char* propertyName,
+ const char* name) const;
+
+ virtual DASValue* getDASValue(
+ const SDOString& typeuri,
+ const SDOString& typenam,
+ const SDOString& propertyName,
+ const SDOString& name) const;
+
+ virtual void resolve();
+
+ const Type* findType(const SDOString uri, const SDOString inTypeName) const;
+
+ const TypeImpl* findTypeImpl(const SDOString& uri, const SDOString& inTypeName) const;
+
+ void addOpenProperty(const PropertyImpl& prop);
+ void removeOpenProperty(const SDOString& name);
+ const propertyMap& getOpenProperties();
+ virtual const TypeImpl& getTypeImpl(const SDOString& uri, const SDOString& inTypeName) const;
+
+ virtual std::ostream& printSelf(std::ostream &os);
+
+private:
+ typedef std::map<std::string, TypeImpl*> TYPES_MAP;
+ TYPES_MAP types;
+ TYPES_MAP resolvePending; // Set of types that have not yet been resolved.
+
+ std::vector<DataFactory*> compatibleFactories;
+
+ propertyMap openProperties;
+
+ // Need to validate and 'lock' the data model for base types to
+ // work properly.
+
+ bool isResolved;
+
+ bool recursiveCheck(TypeImpl* cs, TypeImpl* t);
+ bool checkForValidChangeSummary(TypeImpl* t);
+
+ typedef std::vector<TypeImpl*> TYPES_VECTOR;
+ TYPES_VECTOR cstypes;
+
+ static SDOString& getFullTypeName(SDOString& stringBuffer, const SDOString& uri, const SDOString& inTypeName);
+ static SDOString& getAliasTypeName(SDOString& stringBuffer, const SDOString& uri, const SDOString& inTypeName);
+
+ void copyTypes(const DataFactoryImpl& inmdg);
+};
+};
+};
+#endif // _DataFactoryIMPL_H_
diff --git a/sdo-cpp/trunk/runtime/core/src/commonj/sdo/DataGraph.cpp b/sdo-cpp/trunk/runtime/core/src/commonj/sdo/DataGraph.cpp
new file mode 100644
index 0000000000..9f4fb02c6d
--- /dev/null
+++ b/sdo-cpp/trunk/runtime/core/src/commonj/sdo/DataGraph.cpp
@@ -0,0 +1,35 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you 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$ */
+
+#include "commonj/sdo/disable_warn.h"
+#include "commonj/sdo/DataGraph.h"
+#include "commonj/sdo/SDORuntimeException.h"
+
+namespace commonj{
+ namespace sdo {
+
+ DataGraph::~DataGraph()
+ {
+ }
+
+
+ };
+};
diff --git a/sdo-cpp/trunk/runtime/core/src/commonj/sdo/DataGraph.h b/sdo-cpp/trunk/runtime/core/src/commonj/sdo/DataGraph.h
new file mode 100644
index 0000000000..eef42e393d
--- /dev/null
+++ b/sdo-cpp/trunk/runtime/core/src/commonj/sdo/DataGraph.h
@@ -0,0 +1,105 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you 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$ */
+
+#ifndef _DATAGRAPH_H_
+#define _DATAGRAPH_H_
+
+#include "commonj/sdo/RefCountingObject.h"
+#include "commonj/sdo/Type.h"
+#include "commonj/sdo/export.h"
+#include "commonj/sdo/DataObject.h"
+
+
+namespace commonj{
+namespace sdo{
+
+/**
+ * DataGraph holds a whole graph of data objects, starting from
+ * a single root. This class is not currently used in the C++
+ * implementation, but will be required by DAS implementations.
+ */
+
+class DataGraph : public RefCountingObject
+{
+ public:
+ virtual ~DataGraph();
+
+ /**
+ *
+ * Gets the root data object of this graph.
+ */
+
+
+ virtual SDO_API DataObjectPtr getRootObject() = 0;
+
+ /**
+ *
+ * gets the name of the element from which the root
+ * object was loaded (The XML definition).
+ */
+ virtual SDO_API const char* getRootElementName() = 0;
+
+ /**
+ * Sets the Root data object.
+ *
+ */
+ virtual SDO_API void setRootObject(DataObjectPtr dob) = 0;
+
+ /**
+ * Creates a root data object - used by DAS implementations.
+ *
+ */
+
+ 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.
+ *
+ */
+
+ virtual SDO_API DataObjectPtr createRootObject(const Type& t) = 0;
+
+ /**
+ * Gets the change summary if there is one.
+ *
+ */
+
+ virtual SDO_API ChangeSummaryPtr getChangeSummary() = 0;
+
+ /**
+ * Gets a type from the data factory.
+ *
+ */
+
+ 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;
+
+
+};
+};
+};
+
+#endif //_DATAGRAPH_H_
diff --git a/sdo-cpp/trunk/runtime/core/src/commonj/sdo/DataGraphImpl.cpp b/sdo-cpp/trunk/runtime/core/src/commonj/sdo/DataGraphImpl.cpp
new file mode 100644
index 0000000000..cb1513c615
--- /dev/null
+++ b/sdo-cpp/trunk/runtime/core/src/commonj/sdo/DataGraphImpl.cpp
@@ -0,0 +1,147 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you 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$ */
+
+#include "commonj/sdo/DataGraphImpl.h"
+#include "commonj/sdo/DataObjectImpl.h"
+#include "commonj/sdo/SDORuntimeException.h"
+
+
+
+namespace commonj{
+ namespace sdo {
+
+/**
+ * DataGraphImpl implements DataGraph.
+ * DataGraph holds a whole graph of data objects, starting from
+ * a single root. This class is not currently used in the C++
+ * implementation, but will be required by DAS implementations.
+ */
+ DataGraphImpl::~DataGraphImpl()
+ {
+ }
+
+ DataGraphImpl::DataGraphImpl(DataFactoryPtr fac)
+ {
+ factory = fac;
+ root = 0;
+ }
+
+
+ DataObjectPtr DataGraphImpl::getRootObject()
+ {
+ return root;
+ }
+
+ const char* DataGraphImpl::getRootElementName()
+ {
+ if (root == 0) return 0;
+ return root->getInstanceProperties()[0].getName();
+ }
+
+ void DataGraphImpl::setRootObject(DataObjectPtr dob)
+ {
+ if (root != 0)
+ {
+ throw SDOUnsupportedOperationException(TUSCANY_SDO_EINFO,
+ "Root data object already exists");
+ }
+ root = dob;
+ }
+
+
+// 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())
+// {
+// throw SDOUnsupportedOperationException(TUSCANY_SDO_EINFO,
+// "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)
+ {
+ throw SDOUnsupportedOperationException(TUSCANY_SDO_EINFO,
+ "Root data object already exists");
+ }
+ root = factory->create(uri,name);
+ if (root->getInstanceProperties()[0].getType().isDataType())
+ {
+ throw SDOUnsupportedOperationException(TUSCANY_SDO_EINFO,
+ "Root data object cannot have a datatype property at element 0");
+ }
+ return root;
+ }
+
+
+ DataObjectPtr DataGraphImpl::createRootObject(const Type& t)
+ {
+ if (root != 0)
+ {
+ throw SDOUnsupportedOperationException(TUSCANY_SDO_EINFO,
+ "Root data object already exists");
+ }
+ root = factory->create(t);
+ if (root->getInstanceProperties()[0].getType().isDataType())
+ {
+ throw SDOUnsupportedOperationException(TUSCANY_SDO_EINFO,
+ "Root data object cannot have a datatype property at element 0");
+ }
+ return root;
+ }
+
+
+ ChangeSummaryPtr DataGraphImpl::getChangeSummary()
+ {
+ if (!root) return 0;
+ return root->getChangeSummary();
+ }
+
+
+ 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);
+ }
+
+ };
+};
diff --git a/sdo-cpp/trunk/runtime/core/src/commonj/sdo/DataGraphImpl.h b/sdo-cpp/trunk/runtime/core/src/commonj/sdo/DataGraphImpl.h
new file mode 100644
index 0000000000..6affa1cc46
--- /dev/null
+++ b/sdo-cpp/trunk/runtime/core/src/commonj/sdo/DataGraphImpl.h
@@ -0,0 +1,112 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you 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$ */
+
+#ifndef _DATAGRAPHIMPL_H_
+#define _DATAGRAPHIMPL_H_
+#include "commonj/sdo/export.h"
+#include "commonj/sdo/DataGraph.h"
+#include "commonj/sdo/disable_warn.h"
+
+
+namespace commonj{
+namespace sdo{
+
+/**
+ * DataGraphImpl implements the abstract class DataGraph.
+ * DataGraph holds a whole graph of data objects, starting from
+ * a single root. This class is not currently used in the C++
+ * implementation, but will be required by DAS implementations.
+ */
+
+class DataGraphImpl : public DataGraph
+{
+ public:
+ virtual ~DataGraphImpl();
+
+ SDO_API DataGraphImpl(DataFactoryPtr fac);
+
+ /**
+ * Sets the root data object.
+ *
+ */
+
+ virtual SDO_API void setRootObject(DataObjectPtr dob);
+
+ /**
+ * Gets the root data object.
+ *
+ */
+
+ virtual DataObjectPtr getRootObject();
+
+ /**
+ * Gets the name of the root data element (from the XML
+ * description).
+ *
+ */
+
+ virtual const char* getRootElementName();
+
+ /**
+ * Creates the root data object - for use by DAS implementations
+ *
+ */
+
+ 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
+ *
+ */
+
+
+ virtual DataObjectPtr createRootObject(const Type& t);
+
+ /**
+ *
+ * Gets the change summary if there is one.
+ */
+
+ virtual ChangeSummaryPtr getChangeSummary();
+
+ /**
+ *
+ * Gets a type from the data factory.
+ */
+
+ virtual const Type& getType(const char* uri,
+ const char* name);
+ virtual const Type& getType(const SDOString& uri,
+ const SDOString& name);
+
+ private:
+
+ DataFactoryPtr factory;
+ DataObjectPtr root;
+
+};
+};
+};
+
+#endif //_DATAGRAPHIMPL_H_
diff --git a/sdo-cpp/trunk/runtime/core/src/commonj/sdo/DataObject.cpp b/sdo-cpp/trunk/runtime/core/src/commonj/sdo/DataObject.cpp
new file mode 100644
index 0000000000..a9415bc5f1
--- /dev/null
+++ b/sdo-cpp/trunk/runtime/core/src/commonj/sdo/DataObject.cpp
@@ -0,0 +1,33 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you 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$ */
+
+#include "commonj/sdo/DataObject.h"
+
+namespace commonj{
+namespace sdo{
+
+
+ DataObject::~DataObject()
+ {
+ }
+};
+};
+
diff --git a/sdo-cpp/trunk/runtime/core/src/commonj/sdo/DataObject.h b/sdo-cpp/trunk/runtime/core/src/commonj/sdo/DataObject.h
new file mode 100644
index 0000000000..30c4f027a1
--- /dev/null
+++ b/sdo-cpp/trunk/runtime/core/src/commonj/sdo/DataObject.h
@@ -0,0 +1,561 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you 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$ */
+
+#ifndef _DATAOBJECT_H_
+#define _DATAOBJECT_H_
+#include "commonj/sdo/export.h"
+
+
+#include "commonj/sdo/Property.h"
+#include "commonj/sdo/Type.h"
+#include "commonj/sdo/DataFactory.h"
+#include "commonj/sdo/Sequence.h"
+#include "commonj/sdo/DataObjectList.h"
+#include "commonj/sdo/PropertyList.h"
+
+
+namespace commonj{
+namespace sdo{
+
+class DataGraph;
+class DataObjectList;
+class DataFactory;
+class ChangeSummary;
+
+
+ /**
+ * DataObjects are the non-primitive members of a Data graph.
+ *<p>
+ * A data object is a representation of some structured data.
+ * it is the fundamental component in the SDO (Service Data Objects) package.
+ * Data objects support reflection, path-based accesss, convenience creation
+ * and deletion methods,and the ability to be part of a data graph.
+ * Each data object holds its data as a series of properties.
+ * Properties can be accessed by name, property index, or using the property
+ * meta object itself.
+ * <p>
+ * A data object can also contain references to other data objects, through
+ * reference-type properties.
+ * <p>
+ * A data object has a series of convenience accessors for its properties.
+ * These methods either use a path (String), a property index,
+ * or the property's meta object itself, to identify the property.
+ * Some examples of the path-based accessors are as follows:
+ * <p>
+ * DataObjectPtr company = ...;<br>
+ * company->getString("name");<br>
+ * company->setString("name", "acme");<br>
+ * company->getString("department.0/name")<br>
+ * company->getString("department[1]/name")<br>
+ * (Note .n indexes from 0, whilst [] indexes from 1.<br>
+ * company->getDataObject("department[number=123]") returns the department where number=123<br>
+ * company->getDataObject("..") returns the containing data object<br>
+ * company->getDataObject("/") returns the root containing data object<br>
+ * There are specific accessors for the primitive types and commonly used
+ * data types like String.
+ */
+
+class DataObject : public RefCountingObject
+{
+ public:
+ virtual ~DataObject();
+
+ /**
+ *
+ * Introspection - properties and types
+ */
+
+ /** getPropertyIndex gets the unique index of a property
+ *
+ * A property of a data object has a unique index associated with it.
+ * This method gets a property index for this object from the property,
+ * or throw SDOPropertyNotFoundException if the property is not part
+ * of this data object.
+ */
+
+ virtual unsigned int SDO_API getPropertyIndex(const Property& p) = 0;
+
+
+ /** getInstanceProperties gets the props of the current object.
+ *
+ * Returns a read-only List of the Properties currently used in this DataObject.
+ * This list will contain all of the properties in getType().getProperties()
+ * and any properties where isSet(property) is true.
+ * For example, properties resulting from the use of
+ * open or mixed XML content are present if allowed by the Type.
+ * The list does not contain duplicates.
+ * The order of the properties in the list begins with getType().getProperties()
+ * and the order of the remaining properties is determined by the implementation.
+ * The same list will be returned unless the DataObject is updated so that
+ * the contents of the list change
+ * Returns the list of Properties currently used in this DataObject.
+ */
+
+ virtual SDO_API PropertyList getInstanceProperties() = 0;
+
+ /**
+ * These are just like getType().getProperty(), but may return
+ * values other than the property list for open types.
+ */
+
+ virtual const Property& getPropertyFromIndex(unsigned int index) = 0;
+
+ virtual PropertyPtr getInstanceProperty(const char* prop) = 0;
+ virtual PropertyPtr getInstanceProperty(const SDOString& prop) = 0;
+
+
+ /**
+ * return the data factory which created this object
+ */
+
+ virtual SDO_API DataFactoryPtr getDataFactory() = 0;
+
+ /** getContainer get the containing object
+ *
+ * Returns the containing data object
+ * or 0 if there is no container.
+ */
+
+ virtual SDO_API DataObjectPtr getContainer() = 0;
+
+ /** getContainmentProperty returns the property containing this object
+ *
+ * Return the Property of the data object containing this data object
+ * or throw an SDOPropertyNotFoundException if there is no container.
+ */
+
+ virtual SDO_API const Property& getContainmentProperty() = 0;
+
+ /** getType returns the data object's type.
+ *
+ * getType returns the data object's type.
+ * The type defines the properties available for reflective access.
+ */
+
+ virtual SDO_API const Type& getType() = 0;
+
+ /* getTypeEnum returns an enumerator for the type
+ *
+ * Returns an enumerator for the type for easy switching on basic types.
+ * The enumerator is part of the Type class
+ */
+
+ virtual SDO_API const Type::Types getTypeEnum() = 0;
+
+
+
+
+
+ /** getDataObject returns a data object by path, index or property
+ *
+ * Returns the value of a property of either this object or an object
+ * reachable from it, as identified by the specified path.
+ */
+
+ virtual SDO_API DataObjectPtr getDataObject(const SDOString& path) = 0;
+ virtual SDO_API DataObjectPtr getDataObject(const char* path) = 0;
+ virtual SDO_API DataObjectPtr getDataObject(unsigned int propertyIndex) = 0;
+ virtual SDO_API DataObjectPtr getDataObject(const Property& property) = 0;
+
+ /** setDataObject sets a value by path, index or property
+ *
+ * Sets a property of either this object or an object reachable from it,
+ * as identified by the specified path,
+ * to the specified value.
+ */
+
+
+ virtual SDO_API void setDataObject(const char* path, DataObjectPtr value) = 0;
+ virtual SDO_API void setDataObject(const char* path, DataObjectPtr value, bool updateSequence) = 0;
+ virtual SDO_API void setDataObject(const SDOString& path, DataObjectPtr value) = 0;
+ virtual SDO_API void setDataObject(const SDOString& path, DataObjectPtr value, bool updateSequence) = 0;
+ virtual SDO_API void setDataObject(unsigned int propertyIndex, DataObjectPtr value) = 0;
+ virtual SDO_API void setDataObject(unsigned int propertyIndex, DataObjectPtr value, bool updateSequence) = 0;
+ virtual SDO_API void setDataObject(const Property& property, DataObjectPtr value) = 0;
+
+ /** getBoolean returns a boolean by path, index or property
+ *
+ * Returns the value of a property of either this object or an object
+ * reachable from it, as identified by the specified path.
+ */
+
+ virtual SDO_API bool getBoolean(const char* path) = 0;
+ virtual SDO_API bool getBoolean(const SDOString& path) = 0;
+ virtual SDO_API bool getBoolean(unsigned int propindex) = 0;
+ virtual SDO_API bool getBoolean(const Property& p) = 0;
+
+ virtual SDO_API void setBoolean(const char* path, bool b) = 0;
+ virtual SDO_API void setBoolean(const SDOString& path, bool b) = 0;
+ virtual SDO_API void setBoolean(unsigned int propindex, bool b) = 0;
+ virtual SDO_API void setBoolean(const Property& p, bool b) = 0;
+
+ /** getByte returns a char by path, index or property
+ *
+ * Returns the value of a property of either this object or an object
+ * reachable from it, as identified by the specified path.
+ */
+
+ virtual SDO_API char getByte(const char* path) = 0;
+ virtual SDO_API char getByte(const SDOString& path) = 0;
+ virtual SDO_API char getByte(unsigned int propindex) = 0;
+ virtual SDO_API char getByte(const Property& p) = 0;
+
+ virtual SDO_API void setByte(const char* path, char c) = 0;
+ virtual SDO_API void setByte(const SDOString& path, char c) = 0;
+ virtual SDO_API void setByte(unsigned int propindex, char c) = 0;
+ virtual SDO_API void setByte(const Property& p, char c) = 0;
+
+ /** getCharacter returns a wchar_t by path, index or property
+ *
+ * Returns the value of a property of either this object or an object
+ * reachable from it, as identified by the specified path.
+ */
+
+ virtual SDO_API wchar_t getCharacter(const char* path) = 0;
+ virtual SDO_API wchar_t getCharacter(const SDOString& path) = 0;
+ virtual SDO_API wchar_t getCharacter(unsigned int propindex) = 0;
+ virtual SDO_API wchar_t getCharacter(const Property& p) = 0;
+
+ virtual SDO_API void setCharacter(const char* path, wchar_t c) = 0;
+ virtual SDO_API void setCharacter(const SDOString& path, wchar_t c) = 0;
+ virtual SDO_API void setCharacter(unsigned int propindex, wchar_t c) = 0;
+ virtual SDO_API void setCharacter(const Property& p, wchar_t c) = 0;
+
+
+ /** getlength returns the length of a string
+ *
+ * Specific to Bytes and Characters data objects. This returns the
+ * length of the buffer required to hold the contents of the object.
+ * len = do->getLength("name");
+ * buf = new char[len];
+ * reallen = do->getBytes("name",buf,len);
+ */
+ virtual SDO_API unsigned int getLength(const char* path) = 0;
+ virtual SDO_API unsigned int getLength(const SDOString& path) = 0;
+ virtual SDO_API unsigned int getLength(unsigned int propindex) = 0;
+ virtual SDO_API unsigned int getLength(const Property& p) = 0;
+ virtual SDO_API unsigned int getLength() = 0;
+
+
+ /** getBytes returns a byte buffer
+ *
+ * A DataObject of type Bytes holds an array of bytes as its value. These
+ * methods transfer the contents of that buffer into an array of chars allocated
+ * by the users program. The return value is the number of bytes actually
+ * copied.
+ * The byte array is not necessarily null terminated. If a null terminated
+ * C style string is required, then getCString is an alternative.
+ * The third paarameter is the length of the allocated buffer, which may be more
+ * than the length of the byte array. If the length specified is less than the
+ * length of the byte array, then only a portion of the
+ * byte array is returned.
+ */
+
+
+ virtual SDO_API unsigned int getBytes(const char* path, char* buf, unsigned int max) = 0;
+ virtual SDO_API unsigned int getBytes(const SDOString& path, char* buf, unsigned int max) = 0;
+ virtual SDO_API unsigned int getBytes(unsigned int propindex, char* buf, unsigned int max) = 0;
+ virtual SDO_API unsigned int getBytes(const Property& p, char* buf, unsigned int max) = 0;
+
+ virtual SDO_API void setBytes(const char* path, const char* c, unsigned int length) = 0;
+ virtual SDO_API void setBytes(const SDOString& path, const char* c, unsigned int length) = 0;
+ virtual SDO_API void setBytes(unsigned int propindex, const char* c, unsigned int length) = 0;
+ virtual SDO_API void setBytes(const Property& p, const char* c, unsigned int length) = 0;
+
+ /** getString returns a wide char buffer
+ *
+ * A DataObject of type String holds an array of wide characters as its value. These
+ * methods transfer the contents of that buffer into an array of wchar_t allocated
+ * by the users program. The return value is the number of wchar_t actually
+ * copied.
+ * The array is not necessarily null terminated.
+ * The third paarameter is the length of the allocated buffer, which may be more
+ * than the length of the array. If the length specified is less than the
+ * length of the array, then only a portion of the array is returned.
+ */
+
+ virtual SDO_API unsigned int getString(const SDOString& path , wchar_t* c, unsigned int max) = 0;
+ virtual SDO_API unsigned int getString(const char* path , wchar_t* c, unsigned int max) = 0;
+ virtual SDO_API unsigned int getString(unsigned int propindex, wchar_t* c, unsigned int max) = 0;
+ virtual SDO_API unsigned int getString(const Property& p, wchar_t* c, unsigned int max) = 0;
+
+ virtual SDO_API void setString(const char* path, const wchar_t* c, unsigned int length) = 0;
+ virtual SDO_API void setString(const SDOString& path, const wchar_t* c, unsigned int length) = 0;
+ virtual SDO_API void setString(unsigned int propindex, const wchar_t* c, unsigned int length) = 0;
+ virtual SDO_API void setString(const Property& p, const wchar_t* c, unsigned int length) = 0;
+
+ /** getDate returns an SDODate by path, index or property
+ *
+ * Returns the value of a property of either this object or an object
+ * reachable from it, as identified by the specified path.
+ */
+ virtual SDO_API const SDODate getDate(const char* path) = 0;
+ virtual SDO_API const SDODate getDate(const SDOString& path) = 0;
+ virtual SDO_API const SDODate getDate(unsigned int propindex) = 0;
+ virtual SDO_API const SDODate getDate(const Property& p) = 0;
+
+ virtual SDO_API void setDate(const char* path, const SDODate d) = 0;
+ virtual SDO_API void setDate(const SDOString& path, const SDODate d) = 0;
+ virtual SDO_API void setDate(unsigned int propindex, const SDODate d) = 0;
+ virtual SDO_API void setDate(const Property& p, const SDODate d) = 0;
+
+ /** getDouble returns a long double by path, index or property
+ *
+ * Returns the value of a property of either this object or an object
+ * reachable from it, as identified by the specified path.
+ */
+
+ virtual SDO_API long double getDouble(const SDOString& path) = 0;
+ virtual SDO_API long double getDouble(const char* path) = 0;
+ virtual SDO_API long double getDouble(unsigned int propindex) = 0;
+ virtual SDO_API long double getDouble(const Property& p) = 0;
+
+ virtual SDO_API void setDouble(const SDOString& path, long double d) = 0;
+ virtual SDO_API void setDouble(const char* path, long double d) = 0;
+ virtual SDO_API void setDouble(unsigned int propindex, long double d) = 0;
+ virtual SDO_API void setDouble(const Property& p, long double d) = 0;
+
+ /** getFloat returns a float by path, index or property
+ *
+ * Returns the value of a property of either this object or an object
+ * reachable from it, as identified by the specified path.
+ */
+
+ virtual SDO_API float getFloat(const SDOString& path) = 0;
+ virtual SDO_API float getFloat(const char* path) = 0;
+ virtual SDO_API float getFloat(unsigned int propindex) = 0;
+ virtual SDO_API float getFloat(const Property& p) = 0;
+
+ virtual SDO_API void setFloat(const SDOString& path, float f) = 0;
+ virtual SDO_API void setFloat(const char* path, float f) = 0;
+ virtual SDO_API void setFloat(unsigned int propindex, float f) = 0;
+ virtual SDO_API void setFloat(const Property& p, float f) = 0;
+
+ /** getInt returns a long by path, index or property
+ *
+ * Returns the value of a property of either this object or an object
+ * reachable from it, as identified by the specified path.
+ */
+
+ virtual SDO_API long getInt(const SDOString& path) = 0;
+ virtual SDO_API long getInt(const char* path) = 0;
+ virtual SDO_API long getInt(unsigned int propindex) = 0;
+ virtual SDO_API long getInt(const Property& p) = 0;
+
+ virtual SDO_API void setInt(const SDOString& path, long i) = 0;
+ virtual SDO_API void setInt(const char* path, long i) = 0;
+ virtual SDO_API void setInt(unsigned int propindex, long i) = 0;
+ virtual SDO_API void setInt(const Property& p, long i) = 0;
+
+ /** getLong returns a int64_t by path, index or property
+ *
+ * Returns the value of a property of either this object or an object
+ * reachable from it, as identified by the specified path.
+ */
+
+ virtual SDO_API int64_t getLong(const SDOString& path) = 0;
+ virtual SDO_API int64_t getLong(const char* path) = 0;
+ virtual SDO_API int64_t getLong(unsigned int propindex) = 0;
+ virtual SDO_API int64_t getLong(const Property& p) = 0;
+
+ virtual SDO_API void setLong(const SDOString& path, int64_t l) = 0;
+ virtual SDO_API void setLong(const char* path, int64_t l) = 0;
+ virtual SDO_API void setLong(unsigned int propindex, int64_t l) = 0;
+ virtual SDO_API void setLong(const Property& p, int64_t l) = 0;
+
+ /** getShort returns a short by path, index or property
+ *
+ * Returns the value of a property of either this object or an object
+ * reachable from it, as identified by the specified path.
+ */
+
+ virtual SDO_API short getShort(const SDOString& path) = 0;
+ virtual SDO_API short getShort(const char* path) = 0;
+ virtual SDO_API short getShort(unsigned int propindex) = 0;
+ virtual SDO_API short getShort(const Property& p) = 0;
+
+ virtual SDO_API void setShort(const SDOString& path, short s) = 0;
+ virtual SDO_API void setShort(const char* path, short s) = 0;
+ virtual SDO_API void setShort(unsigned int propindex, short s) = 0;
+ virtual SDO_API void setShort(const Property& p, short s) = 0;
+
+
+ /** getCString returns a null terminated string by path, index or property
+ *
+ * Returns the value of a property of either this object or an object
+ * reachable from it, as identified by the specified path.
+ */
+
+ virtual SDO_API const char* getCString(const char* path) = 0;
+ virtual SDO_API const char* getCString(const SDOString& path) = 0;
+ virtual SDO_API const char* getCString(unsigned int propertyIndex) = 0;
+ virtual SDO_API const char* getCString(const Property& prop) = 0;
+
+ virtual SDO_API void setCString(const char* path, const char* value) = 0;
+ virtual SDO_API void setCString(unsigned int propertyIndex, const char* value) = 0;
+ virtual SDO_API void setCString (const Property& prop, const char* value) = 0;
+
+ virtual SDO_API void setCString(const SDOString& path, const SDOString& value) = 0;
+ virtual SDO_API void setCString(unsigned int propertyIndex, const SDOString& value) = 0;
+ virtual SDO_API void setCString (const Property& prop, const SDOString& value) = 0;
+
+
+ /** setNull sets a data object value to null.
+ *
+ * A DataObjectType or DataType value may be set or unset. If it is set, then
+ * it may have a value, or it may be set to null. A distinction is drawn between
+ * being unset, having the default value, being set and being null.
+ * When the value of an integer (for example) is returned as zero, it could have
+ * been set to zero, or it could be null. Use isNull() to verify.
+ */
+
+ virtual SDO_API void setNull(const char* path) = 0;
+ virtual SDO_API void setNull(const SDOString& path) = 0;
+ virtual SDO_API void setNull(unsigned int propertyIndex) = 0;
+ virtual SDO_API void setNull(const Property& prop) = 0;
+
+ virtual SDO_API bool isNull(const char* path) = 0;
+ virtual SDO_API bool isNull(const SDOString& path) = 0;
+ virtual SDO_API bool isNull(unsigned int propertyIndex) = 0;
+ virtual SDO_API bool isNull(const Property& prop) = 0;
+
+ /** isSet test whether the value has been set
+ *
+ * Returns whether a property of either this object or an object reachable
+ * from it, as identified by the specified path,
+ * is considered to be set.
+ */
+
+ virtual SDO_API bool isSet(const char* path) = 0;
+ virtual SDO_API bool isSet(const SDOString& path) = 0;
+ virtual SDO_API bool isSet(unsigned int propertyIndex) = 0;
+ virtual SDO_API bool isSet(const Property& property) = 0;
+
+
+ /** isValid shows true if the value is set or defaulted.
+ *
+ * A property can be set, null, or have a default value - all
+ * of these are valid. It can also be unset, and have no default
+ * in which case this returns false.
+ */
+
+ virtual SDO_API bool isValid(const char* path) = 0;
+ virtual SDO_API bool isValid(const SDOString& path) = 0;
+ virtual SDO_API bool isValid(unsigned int propertyIndex) = 0;
+ virtual SDO_API bool isValid(const Property& property ) =0;
+
+ /** unset unsets a value previously set.
+ *
+ * unsets a property of either this object or an object reachable
+ * from it, as identified by the specified path.
+ */
+
+ virtual SDO_API void unset(const char* path) = 0;
+ virtual SDO_API void unset(const SDOString& path) = 0;
+ virtual SDO_API void unset(unsigned int propertyIndex) = 0;
+ virtual SDO_API void unset(const Property& property) = 0;
+
+ /** getSequence returns the sequence for a data object
+ *
+ * Returns the value of a Sequence property identified by
+ * the specified path. See Sequence.
+ */
+
+ virtual SDO_API SequencePtr getSequence() = 0;
+ virtual SDO_API SequencePtr getSequence(const char* path) = 0;
+ virtual SDO_API SequencePtr getSequence(const SDOString& path) = 0;
+ virtual SDO_API SequencePtr getSequence(unsigned int propertyIndex) = 0;
+ virtual SDO_API SequencePtr getSequence(const Property& property) = 0;
+
+
+
+ /** createDataObject creates a data object value
+ *
+ * Returns a new data object contained by this object using the
+ * specified property,which must be a containment property.
+ * The type of the created object is the declared type
+ * of the specified property.
+ * If the property is many valued, this method adds an element to the
+ * list, otherwise it sets the value, removing any old value.
+ */
+
+
+ virtual SDO_API DataObjectPtr createDataObject(const char* propertyName) = 0;
+ virtual SDO_API DataObjectPtr createDataObject(const SDOString& propertyName) = 0;
+ virtual SDO_API DataObjectPtr createDataObject(unsigned int propertyIndex) = 0;
+ virtual SDO_API DataObjectPtr createDataObject(const Property& property) = 0;
+
+
+
+ /** detach detaches an object from the graph
+ *
+ * This method removes the current data object from the graph, but does
+ * not destroy it. The DataObject can be re-attached to the graph later.
+ */
+
+ virtual SDO_API void detach() = 0;
+
+ /** clear unsets all the properties
+ *
+ * This method unsets all the properties, and deletes all the data object
+ * propertiy values from this data object.
+ */
+
+ virtual SDO_API void clear() = 0;
+
+
+ /** getList gets the value of a many-valued property
+ *
+ * Many valued properties are returned as lists of DataObjects.
+ * These lists may contain primitives or data objects, but they behave
+ * like data objects.
+ * Getting a many valued integer consists of getting the list, then
+ * using the DataObjectList API to getInt() for each list element.
+ */
+
+ virtual SDO_API DataObjectList& getList(const char* path) = 0;
+ virtual SDO_API DataObjectList& getList(const SDOString& path) = 0;
+ virtual SDO_API DataObjectList& getList(unsigned int propIndex) = 0;
+ virtual SDO_API DataObjectList& getList(const Property& p) = 0;
+ virtual DataObjectList& getList() = 0;
+
+
+ /** getChangeSummary get the applicable change summary
+ *
+ * This method gets the applicable change summary for a data object.
+ * The summary is not necessarily attached to the data object, it may be
+ * the summary for a parent data object. No object with a summary attached
+ * may be a child of another object with a summary attached.
+ * See the ChangeSummary API for details of using the change sumamry.
+ */
+
+ virtual SDO_SPI ChangeSummaryPtr getChangeSummary() = 0;
+ virtual SDO_SPI ChangeSummaryPtr getChangeSummary(const char* path) = 0;
+ virtual SDO_SPI ChangeSummaryPtr getChangeSummary(const SDOString& path) = 0;
+ virtual SDO_SPI ChangeSummaryPtr getChangeSummary(unsigned int propIndex) = 0;
+ virtual SDO_SPI ChangeSummaryPtr getChangeSummary(const Property& prop) = 0;
+
+
+};
+};
+};
+
+#endif //_DATAOBJECT_H_
diff --git a/sdo-cpp/trunk/runtime/core/src/commonj/sdo/DataObjectImpl.cpp b/sdo-cpp/trunk/runtime/core/src/commonj/sdo/DataObjectImpl.cpp
new file mode 100644
index 0000000000..f6b3e2f71b
--- /dev/null
+++ b/sdo-cpp/trunk/runtime/core/src/commonj/sdo/DataObjectImpl.cpp
@@ -0,0 +1,4826 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you 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$ */
+
+#include "commonj/sdo/disable_warn.h"
+#include "commonj/sdo/DataObjectImpl.h"
+
+#include "commonj/sdo/SDORuntimeException.h"
+
+#include "commonj/sdo/Property.h"
+#include "commonj/sdo/Type.h"
+#include "commonj/sdo/TypeList.h"
+#include "commonj/sdo/Sequence.h"
+#include "commonj/sdo/SequenceImpl.h"
+
+#include "commonj/sdo/PropertyList.h"
+
+#include "commonj/sdo/Logging.h"
+
+#include "commonj/sdo/TypeImpl.h"
+
+#include "commonj/sdo/ChangeSummaryImpl.h"
+#include "commonj/sdo/DataFactoryImpl.h"
+#include "commonj/sdo/SDOUtils.h"
+
+#include <string>
+#include <sstream>
+#include <stdio.h>
+#include <stdlib.h>
+using std::string;
+
+
+
+
+namespace commonj{
+namespace sdo {
+
+ using internal::SDOUtils;
+
+ void throwPropertyNotFound(const SDOExceptionInfo& info,
+ const SDOString& propertyName)
+ {
+ SDOString msg("Cannot find property: ");
+ msg += propertyName;
+ throw SDOPropertyNotFoundException(info,
+ msg.c_str());
+ }
+
+ /**
+ * RDO is an internal class holding a property value
+ */
+
+ rdo::rdo(unsigned int infirst, DataObjectImpl* insecond)
+ : first(infirst), second(insecond)
+ {
+ }
+
+ rdo::rdo()
+ {
+ first = 0;
+ second = 0;
+ }
+
+ rdo::rdo (const rdo& inrdo)
+ {
+ first = inrdo.first;
+ second = inrdo.second;
+ }
+
+ rdo::~rdo()
+ {
+ }
+
+#define ASSERT_SETTABLE(property,primval) ASSERT_WRITABLE(*property, set##primval)
+
+ /** DataObject
+ * DataObjects are the non-primitive members of a Data graph.
+ *
+ * A data object is a representation of some structured data.
+ * it is the fundamental component in the SDO (Service Data Objects) package.
+ * Data objects support reflection, path-based accesss, convenience creation
+ * and deletion methods,and the ability to be part of a data graph.
+ * Each data object holds its data as a series of properties.
+ * Properties can be accessed by name, property index, or using the property
+ * meta object itself.
+ * A data object can also contain references to other data objects, through
+ * reference-type properties.
+ * A data object has a series of convenience accessors for its properties.
+ * These methods either use a path (String), a property index,
+ * or the property's meta object itself, to identify the property.
+ * Some examples of the path-based accessors are as follows:
+ * DataObjectPtr company = ...;
+ * company->getString("name");
+ * company->setString("name", "acme");
+ * company->getString("department.0/name")
+ * .n indexes from 0.
+ * company->getString("department[1]/name") [] indexes from 1.
+ * company->getDataObject("department[number=123]") returns the department where number=123
+ * company->getDataObject("..") returns the containing data object
+ * company->getDataObject("/") returns the root containing data object
+ * There are specific accessors for the primitive types and commonly used
+ * data types like String.
+ */
+
+ unsigned int DataObjectImpl::getBytes(const char* path, char* valptr , unsigned int max)
+ {
+ const SDOString pathObject(path);
+ unsigned int result = getBytes(pathObject, valptr, max);
+ return result;
+ }
+
+ unsigned int DataObjectImpl::getString(const char* path, wchar_t* buf, unsigned int max)
+ {
+ return getString(SDOString(path), buf, max);
+ }
+
+ // Convenience methods for string/bytes length
+
+ unsigned int DataObjectImpl::getLength(const Property& p)
+ {
+ switch (p.getType().getTypeEnum()) {
+ case Type::BooleanType:
+ return BOOL_SIZE;
+ case Type::CharacterType:
+ case Type::ByteType:
+ return BYTE_SIZE;
+ case Type::ShortType:
+ case Type::IntType:
+ case Type::LongType:
+ return MAX_LONG_SIZE;
+ case Type::FloatType:
+ return MAX_FLOAT_SIZE;
+ case Type::DoubleType:
+ return MAX_DOUBLE_SIZE;
+ case Type::BigDecimalType:
+ case Type::BigIntegerType:
+ case Type::UriType:
+ case Type::StringType:
+ return getString(p,0,0);
+ case Type::BytesType:
+ return getBytes(p,0,0);
+ default:
+ return 0;
+ }
+ }
+
+ unsigned int DataObjectImpl::getLength()
+ {
+ switch (getType().getTypeEnum()) {
+ case Type::BooleanType:
+ return BOOL_SIZE;
+ case Type::CharacterType:
+ case Type::ByteType:
+ return BYTE_SIZE;
+ case Type::ShortType:
+ case Type::IntType:
+ case Type::LongType:
+ return MAX_LONG_SIZE;
+ case Type::FloatType:
+ return MAX_FLOAT_SIZE;
+ case Type::DoubleType:
+ return MAX_DOUBLE_SIZE;
+ case Type::BigDecimalType:
+ case Type::BigIntegerType:
+ case Type::UriType:
+ case Type::StringType:
+ return getString(0,0);
+ case Type::BytesType:
+ return getBytes(0,0);
+ default:
+ return 0;
+ }
+ }
+
+ unsigned int DataObjectImpl::getLength(const char* path)
+ {
+ return getLength(SDOString(path));
+ }
+
+ unsigned int DataObjectImpl::getLength(const SDOString& path)
+ {
+ DataObjectImpl* d;
+ SDOString spath;
+ DataObjectImpl::stripPath(path, spath);
+ SDOString prop = findPropertyContainer(spath, &d);
+ if (d != 0) {
+ if (prop.length() == 0) {
+ return 0;
+ }
+ else
+ {
+ PropertyPtr p = d->getInstanceProperty(prop);
+ if (!p) {
+ throwPropertyNotFound(TUSCANY_SDO_EINFO,
+ prop);
+ }
+ return getLength(*p);
+ }
+ }
+ else
+ {
+ if (prop.length())
+ {
+ PropertyPtr p = d->getInstanceProperty(prop);
+ if (!p) {
+ throwPropertyNotFound(TUSCANY_SDO_EINFO,
+ prop);
+ }
+ return getLength(*p);
+ }
+ else
+ {
+ return 0;
+ }
+ }
+ }
+
+ unsigned int DataObjectImpl::getLength(unsigned int index)
+ {
+ return getLength(getPropertyFromIndex(index));
+ }
+
+ // +++
+ // Provide implementations for the getXXX(const char* path) methods.
+ // These are implemented by delegating the call
+ // to the corresponding getXXX(const SDOString& path) method.
+
+ // getPrimitiveFromPath(Boolean,bool,false);
+ bool DataObjectImpl::getBoolean(const char* path)
+ {
+ return getBoolean(SDOString(path));
+ }
+
+ // getPrimitiveFromPath(Short,short,0);
+ short DataObjectImpl::getShort(const char* path)
+ {
+ return getShort(SDOString(path));
+ }
+
+ // getPrimitiveFromPath(Byte,char,0);
+ char DataObjectImpl::getByte(const char* path)
+ {
+ return getByte(SDOString(path));
+ }
+
+ // getPrimitiveFromPath(Character,wchar_t,0);
+ wchar_t DataObjectImpl::getCharacter(const char* path)
+ {
+ return getCharacter(SDOString(path));
+ }
+
+ // getPrimitiveFromPath(Date,const SDODate,0);
+ const SDODate DataObjectImpl::getDate(const char* path)
+ {
+ return getDate(SDOString(path));
+ }
+
+ // getPrimitiveFromPath(Double,long double,0.0);
+ long double DataObjectImpl::getDouble(const char* path)
+ {
+ return getDouble(SDOString(path));
+ }
+
+ // getPrimitiveFromPath(Float,float,0.0);
+ float DataObjectImpl::getFloat(const char* path)
+ {
+ return getFloat(SDOString(path));
+ }
+
+ // getPrimitiveFromPath(Int,long,0);
+ long DataObjectImpl::getInt(const char* path)
+ {
+ return getInt(SDOString(path));
+ }
+
+ // getPrimitiveFromPath(Long,int64_t,0L);
+ int64_t DataObjectImpl::getLong(const char* path)
+ {
+ return getLong(SDOString(path));
+ }
+
+ // End of implementations for the getXXX(const char* path) methods.
+ // ---
+
+
+ // +++
+ // Provide implementations for the setXXX(const char* path, XXX) methods.
+ // These are implemented by delegating the call
+ // to the corresponding setXXX(const SDOString& path, XXX) method.
+
+ void DataObjectImpl::setBoolean(const char* path, bool b)
+ {
+ setBoolean(SDOString(path), b);
+ }
+
+ void DataObjectImpl::setShort(const char* path, short s)
+ {
+ setShort(SDOString(path), s);
+ }
+
+ void DataObjectImpl::setByte(const char* path, char c)
+ {
+ setByte(SDOString(path), c);
+ }
+
+ void DataObjectImpl::setCharacter(const char* path, wchar_t c)
+ {
+ setCharacter(SDOString(path), c);
+ }
+
+ void DataObjectImpl::setDate(const char* path, const SDODate d)
+ {
+ setDate(SDOString(path), d);
+ }
+
+ void DataObjectImpl::setDouble(const char* path, long double d)
+ {
+ setDouble(SDOString(path), d);
+ }
+
+ void DataObjectImpl::setFloat(const char* path, float f)
+ {
+ setFloat(SDOString(path), f);
+ }
+
+ void DataObjectImpl::setInt(const char* path, long i)
+ {
+ setInt(SDOString(path), i);
+ }
+
+ // setPrimitiveFromPath(Long,int64_t, int64_t);
+ // setPrimitiveFromPath(Int,long, long);
+ // Depends on wordsize, see SDOString& variant below.
+ void DataObjectImpl::setLong(const char* path, /*long long*/ int64_t l)
+ {
+ setLong(SDOString(path), l);
+ }
+
+ // End of implementations for the setXXX(const char* path, XXX) methods.
+ // ---
+
+
+ // open type support
+
+ const PropertyImpl* DataObjectImpl::defineProperty(const SDOString& propname,
+ const Type& t)
+ {
+ PropertyImplPtr prop = new PropertyImpl(getType(),
+ propname,
+ (TypeImpl&)t,
+ false,
+ false,
+ true);
+ openProperties.push_back(prop);
+ factory->addOpenProperty(*prop);
+
+ return getPropertyImpl(propname);
+ }
+
+ void DataObjectImpl::undefineProperty(unsigned int index)
+ {
+ if (index < openBase) return;
+ unsigned int point = index - openBase;
+ if (point >= openProperties.size()) return;
+
+ // downgrade all the property settings above this one
+
+ PropertyValueMap::iterator pit;
+ for (pit = PropertyValues.begin(); pit != PropertyValues.end();++pit)
+ {
+ if ((*pit).first > index)
+ {
+ if (getPropertyImpl((*pit).first)->isMany())
+ {
+ DataObjectListImpl* dl = (*pit).second->getListImpl();
+ if (dl != 0) dl->decrementPindex();
+ }
+ (*pit).first-=1;
+ }
+ }
+
+ // then remove this property from the list
+
+ std::vector<PropertyImplPtr>::iterator it =
+ openProperties.begin();
+ for (unsigned int i=0;i<point;i++)++it; /* there must be a better way */
+
+ factory->removeOpenProperty((*it)->getName());
+
+ openProperties.erase(it);
+
+ return;
+ }
+
+ const PropertyImpl* DataObjectImpl::defineList(const char* propname)
+ {
+ const Type& t = factory->getType(SDOUtils::sdoURI, "OpenDataObject");
+ PropertyImplPtr prop = new PropertyImpl(getType(),propname,
+ (TypeImpl&)t, true, false, true);
+ openProperties.push_back(prop);
+ factory->addOpenProperty(*prop);
+
+ return getPropertyImpl(propname);
+ }
+
+ const PropertyImpl* DataObjectImpl::defineSDOValue(const SDOString& propname,
+ const SDOValue& sval)
+ {
+ const Type& t = factory->getType(SDOUtils::sdoURI,
+ sval.convertTypeEnumToString());
+ return defineProperty(propname, t);
+ }
+
+ const PropertyImpl* DataObjectImpl::defineBoolean(const SDOString& propname)
+ {
+ const Type& t = factory->getType(SDOUtils::sdoURI, "Boolean");
+ return defineProperty(propname,t);
+ }
+
+ const PropertyImpl* DataObjectImpl::defineByte(const SDOString& propname)
+ {
+ const Type& t = factory->getType(SDOUtils::sdoURI, "Byte");
+ return defineProperty(propname,t);
+ }
+
+ const PropertyImpl* DataObjectImpl::defineCharacter(const SDOString& propname)
+ {
+ const Type& t = factory->getType(SDOUtils::sdoURI, "Character");
+ return defineProperty(propname,t);
+ }
+
+ const PropertyImpl* DataObjectImpl::defineString(const SDOString& propname)
+ {
+ const Type& t = factory->getType(SDOUtils::sdoURI, "String");
+ return defineProperty(propname,t);
+ }
+
+ const PropertyImpl* DataObjectImpl::defineBytes(const SDOString& propname)
+ {
+ const Type& t = factory->getType(SDOUtils::sdoURI, "Bytes");
+ return defineProperty(propname,t);
+ }
+
+ const PropertyImpl* DataObjectImpl::defineShort(const SDOString& propname)
+ {
+ const Type& t = factory->getType(SDOUtils::sdoURI, "Short");
+ return defineProperty(propname,t);
+ }
+
+ const PropertyImpl* DataObjectImpl::defineInt(const SDOString& propname)
+ {
+ const Type& t = factory->getType(SDOUtils::sdoURI, "Int");
+ return defineProperty(propname,t);
+ }
+
+ const PropertyImpl* DataObjectImpl::defineLong(const SDOString& propname)
+ {
+ const Type& t = factory->getType(SDOUtils::sdoURI, "Long");
+ return defineProperty(propname,t);
+ }
+
+ const PropertyImpl* DataObjectImpl::defineFloat(const SDOString& propname)
+ {
+ const Type& t = factory->getType(SDOUtils::sdoURI, "Float");
+ return defineProperty(propname,t);
+ }
+
+ const PropertyImpl* DataObjectImpl::defineDouble(const SDOString& propname)
+ {
+ const Type& t = factory->getType(SDOUtils::sdoURI, "Double");
+ return defineProperty(propname,t);
+ }
+
+ const PropertyImpl* DataObjectImpl::defineDate(const SDOString& propname)
+ {
+ const Type& t = factory->getType(SDOUtils::sdoURI, "Date");
+ return defineProperty(propname,t);
+ }
+
+ const PropertyImpl* DataObjectImpl::defineCString(const SDOString& propname)
+ {
+ const Type& t = factory->getType(SDOUtils::sdoURI, "String");
+ return defineProperty(propname,t);
+ }
+
+ const PropertyImpl* DataObjectImpl::defineDataObject(const SDOString& propname,
+ const Type& t)
+ {
+ return defineProperty(propname,t);
+ }
+
+ const PropertyImpl* DataObjectImpl::defineDataObject(const char* propname,
+ const char* typeURI, const char* typeName)
+ {
+ const Type& t = factory->getType(typeURI, typeName);
+ return defineProperty(propname,t);
+ }
+
+ void DataObjectImpl::setCString (unsigned int propertyIndex, const char* value)
+ {
+ setCString(propertyIndex, SDOString(value));
+ }
+
+ const char* DataObjectImpl::getCString (const char* path)
+ {
+ return getCString(SDOString(path));
+ }
+
+ void DataObjectImpl::setCString(const char* path, const char* value)
+ {
+ setCString(SDOString(path), SDOString(value));
+ }
+
+ void DataObjectImpl::setCString(const Property& property, const char* value)
+ {
+ setCString(property, SDOString(value));
+ }
+
+ // null support
+
+ bool DataObjectImpl::isNull(const unsigned int propertyIndex)
+ {
+ validateIndex(propertyIndex);
+ if ((getPropertyFromIndex(propertyIndex).isMany()))
+ {
+ return false;
+ }
+
+ PropertyValueMap::iterator i;
+ for (i = PropertyValues.begin(); i != PropertyValues.end();++i)
+ {
+ if ((*i).first == propertyIndex)
+ {
+ return (*i).second->isNull();
+ }
+ }
+ return false;
+ }
+
+ bool DataObjectImpl::isNull(const Property& property)
+ {
+ return isNull(getPropertyIndex(property));
+ }
+
+ bool DataObjectImpl::isNull(const char* path)
+ {
+ return isNull(SDOString(path));
+ }
+
+ bool DataObjectImpl::isNull(const SDOString& path)
+ {
+ DataObjectImpl *d = 0;
+ SDOString spath;
+ SDOString prop;
+ // char* spath = 0;
+ // char* prop = 0;
+ DataObjectImpl::stripPath(path, spath);
+ prop = findPropertyContainer(spath, &d);
+ if (d != 0) {
+ if (prop.length() == 0) {
+ return d->isNull();
+ }
+ else {
+ PropertyPtr p = d->getInstanceProperty(prop);
+ if (!p) {
+ throwPropertyNotFound(TUSCANY_SDO_EINFO,
+ prop);
+ }
+ return d->isNull(*p);
+ }
+ }
+ return false;
+ }
+
+ void DataObjectImpl::setNull(const unsigned int propertyIndex)
+ {
+ validateIndex(propertyIndex);
+ const Property& property = getPropertyFromIndex(propertyIndex);
+ if (property.isMany())
+ {
+ string msg("Setting a list to null is not supported:");
+ msg += property.getName();
+ throw SDOUnsupportedOperationException(TUSCANY_SDO_EINFO, msg.c_str());
+ }
+
+ ASSERT_WRITABLE(property, setNull)
+
+ PropertyValueMap::iterator i;
+ for (i = PropertyValues.begin(); i != PropertyValues.end(); ++i)
+ {
+ if ((*i).first == propertyIndex)
+ {
+ logChange(propertyIndex);
+ (*i).second->setNull();
+ return;
+ }
+ }
+ // The property was not set yet...
+ logChange(propertyIndex);
+ DataObjectImpl* b =
+ new DataObjectImpl(factory, getPropertyFromIndex(propertyIndex).getType());
+ b->setContainer(this);
+ PropertyValues.push_back(rdo(propertyIndex,b));
+ b->setNull();
+ }
+
+ void DataObjectImpl::setNull(const Property& property)
+ {
+ setNull(getPropertyIndexInternal(property));
+ }
+
+ void DataObjectImpl::setNull(const char* path)
+ {
+ setNull(SDOString(path));
+ }
+
+ void DataObjectImpl::setNull(const SDOString& path)
+ {
+ DataObjectImpl *d = 0;
+ SDOString spath;
+ SDOString prop;
+ size_t pc;
+
+ DataObjectImpl::stripPath(path, spath);
+ prop = findPropertyContainer(spath, &d);
+ if (d != 0) {
+ if (prop.length() == 0) {
+ try {
+ DataObjectImpl* cont = d->getContainerImpl();
+ if (cont != 0)
+ {
+ pc = path.rfind('/'); // Find the last '/' in the path
+ if (pc != string::npos)
+ pc++; // pc is the index of the first character following the /
+ }
+ PropertyPtr pcont = cont->getInstanceProperty(path.substr(pc));
+ if (!pcont) {
+ throwPropertyNotFound(TUSCANY_SDO_EINFO,
+ path.substr(pc));
+ }
+ ASSERT_WRITABLE(*pcont, setNull)
+ cont->logChange(*pcont);
+ }
+ catch (SDORuntimeException&)
+ {
+ }
+ d->setNull();
+ }
+ else {
+ const PropertyImpl* p = d->getPropertyImpl(prop);
+ if (p == 0)
+ {
+ if(d->getType().isOpenType())
+ {
+ string msg("Cannot set unassigned open property to null:");
+ msg += prop;
+ throw SDOUnsupportedOperationException(TUSCANY_SDO_EINFO, msg.c_str());
+ }
+ else
+ {
+ string msg("Property Not Found:");
+ msg += prop;
+ throw SDOPropertyNotFoundException(TUSCANY_SDO_EINFO, msg.c_str());
+ }
+ }
+ ASSERT_SETTABLE(p, Null)
+ d->setNull((Property&)*p);
+ return;
+ }
+ }
+ return;
+ }
+
+ // getters and setters for a List data object
+
+ DataObjectList& DataObjectImpl::getList(const char* path)
+ {
+ // Can path really be a null pointer?
+ if (path == 0)
+ {
+ return(getList(SDOString()));
+ }
+ else
+ {
+ return(getList(SDOString(path)));
+ }
+ }
+
+ DataObjectList& DataObjectImpl::getList(const SDOString& path)
+ {
+ DataObjectImpl *d;
+ SDOString spath;
+
+ DataObjectImpl::stripPath(path, spath);
+ SDOString prop = findPropertyContainer(spath, &d);
+
+ if (d != 0) {
+ if (prop.length() == 0) {
+ return d->getList();
+ }
+ else {
+ const PropertyImpl* p = d->getPropertyImpl(prop);
+ if (p == 0 && d->getType().isOpenType())
+ {
+ p = d->defineList(prop.c_str());
+ }
+ if (p != 0)
+ {
+ return d->getList((Property&)*p);
+ }
+ }
+ }
+
+ string msg("Invalid path:");
+ msg += path;
+ throw SDOPathNotFoundException(TUSCANY_SDO_EINFO, msg.c_str());
+ }
+
+
+ DataObjectList& DataObjectImpl::getList(unsigned int propIndex)
+ {
+ return getList(getPropertyFromIndex(propIndex));
+ }
+
+ DataObjectList& DataObjectImpl::getList(const Property& p)
+ {
+ if (!p.isMany())
+ {
+ PropertyImpl* pi = (PropertyImpl*)&p;
+ if (!pi->getTypeImpl()->isFromList())
+ {
+ string msg("Get list not available on single valued property:");
+ msg += p.getName();
+ throw SDOUnsupportedOperationException(TUSCANY_SDO_EINFO, msg.c_str());
+ }
+ }
+
+ int propIndex = getPropertyIndexInternal(p);
+ DataObjectImpl* d = getDataObjectImpl(propIndex);
+ if (d == 0) {
+ // There is no list yet, so we need to create an
+ // empty data object to hold the list
+ d = new DataObjectImpl(factory, factory->getType(SDOUtils::sdoURI,"OpenDataObject"));
+ PropertyValues.push_back(rdo(propIndex, d));
+ d->setContainer(this);
+
+ DataObjectListImpl* list = new DataObjectListImpl(factory,this,
+ propIndex,p.getType().getURI(),p.getType().getName());
+ d->setList(list);
+
+ }
+ return d->getList();
+ }
+
+
+
+ DataObjectList& DataObjectImpl::getList()
+ {
+ if (getTypeImpl().isFromList())
+ {
+ return getList("values");
+ }
+ return *listValue;
+ }
+
+ DataObjectListImpl* DataObjectImpl::getListImpl()
+ {
+ if (getTypeImpl().isFromList())
+ {
+ DataObjectList& dl = getList("values");
+ return (DataObjectListImpl*)&dl;
+ }
+ return listValue;
+ }
+
+
+
+ /////////////////////////////////////////////////////////////////////////////
+ // Utilities
+ /////////////////////////////////////////////////////////////////////////////
+
+
+ // get an index, or throw if the prop is not part of this DO
+
+ unsigned int DataObjectImpl::getPropertyIndex(const Property& p)
+ {
+ const std::vector<PropertyImplPtr>& props = getTypeImpl().getPropertyListReference();
+
+ unsigned int i = 0;
+ for (std::vector<PropertyImplPtr>::const_iterator j = props.begin();
+ j != props.end();
+ j++, i++)
+ {
+ if (!strcmp((*j)->getName(), p.getName()))
+ {
+ return i;
+ }
+ }
+ if (getType().isOpenType())
+ {
+ std::vector<PropertyImplPtr>::iterator j;
+ int count = 0;
+ for (j = openProperties.begin() ;
+ j != openProperties.end() ; ++j)
+ {
+ if (!strcmp((*j)->getName(),p.getName()))
+ {
+ return count+openBase;
+ }
+ count++;
+ }
+ }
+ string msg("Cannot find property:");
+ msg += p.getName();
+ throw SDOPropertyNotFoundException(TUSCANY_SDO_EINFO, msg.c_str());
+ }
+
+ /**
+ * This method is used internally to find the index of a
+ * property. If differs from the public getPropertyIndex method
+ * in that if the type of the containing object is open a new
+ * index is created. In the public version and error is thrown
+ */
+ unsigned int DataObjectImpl::getPropertyIndexInternal(const Property& p)
+ {
+ unsigned int index;
+
+ try
+ {
+ index = getPropertyIndex(p);
+ }
+ catch ( SDOPropertyNotFoundException e )
+ {
+ // this could mean that this data object has an open
+ // type. getPropertyIndex fails in this case because it
+ // tries to access the index of the property
+ // and it doesn't exist because it hasn't been created yet.
+ // This new method is used where properties are being set
+ // based on existing property objects. This is likely to
+ // occur when a data object is being copied. In this case
+ // we want properties that are open to be copied also
+ // so we need to create the property and provide the index
+ if ( this->getType().isOpenType() )
+ {
+ const Property *prop = NULL;
+
+ // need to treat many valued properties specially
+ // because the property is a list rather than
+ // a single value
+ if ( p.isMany() )
+ {
+ prop = defineList(p.getName());
+ }
+ else
+ {
+ prop = defineProperty(p.getName(), p.getType());
+ }
+
+ index = getPropertyIndex(p);
+ }
+ else
+ {
+ throw e;
+ }
+ }
+
+ return index;
+ }
+
+
+ const Property& DataObjectImpl::getPropertyFromIndex(unsigned int index)
+ {
+ PropertyImpl* pi = getPropertyImpl(index);
+ if (pi == 0)
+ {
+ string msg("Index out of range");
+ throw SDOIndexOutOfRangeException(TUSCANY_SDO_EINFO,
+ msg.c_str());
+ }
+ return (Property&)*pi;
+ }
+
+ PropertyImpl* DataObjectImpl::getPropertyImpl(unsigned int index)
+ {
+ // Cannot use getPropertyListReference because we will return a
+ // writeable PropertyImpl.
+ PropertyList props = getType().getProperties();
+ if (index < props.size())
+ {
+ return (PropertyImpl*)&props[index];
+ }
+
+ if (getType().isOpenType())
+ {
+ if (index >= openBase && index - openBase < openProperties.size())
+ {
+ std::vector<PropertyImplPtr>::iterator j;
+ unsigned int val = 0;
+ j = openProperties.begin();
+ while (val < index-openBase && j != openProperties.end())
+ {
+ val++;
+ j++;
+ }
+ if (j != openProperties.end()) {
+ return getRawPointer(staticCast<PropertyImplPtr>(*j));
+ }
+ }
+ }
+ return 0;
+ }
+
+
+ //////////////////////////////////////////////////////////////////////
+ // TODO - this is rubbish, but gets us by until XPATH is done
+ // trip the path down to characters which I am going to
+ // recognise later (a-z, A-Z _ [ ] .)
+ //////////////////////////////////////////////////////////////////////
+
+ const char* DataObjectImpl::templateString =
+ " /abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ1234567890=[]._#";
+
+ char* DataObjectImpl::stripPath(const char* path)
+ {
+ int pos = 0;
+ char* s = 0;
+ if (path == 0) return s;
+
+ s = new char[strlen(path)+1];
+
+ for (unsigned int i=0;i < strlen(path); i++)
+ {
+ if (strchr(templateString,path[i]) != 0) {
+ s[pos++] = path[i];
+ }
+ }
+ s[pos++] = 0;
+ return s;
+ }
+
+ void DataObjectImpl::stripPath(const SDOString& path, SDOString& result)
+ {
+ result.erase();
+ result.reserve(path.length());
+
+ size_t start = 0;
+ size_t position = path.find_first_not_of(templateString);
+
+ while (position != string::npos)
+ {
+ result.append(path, start, (position - start));
+ start = ++position;
+ position = path.find_first_not_of(templateString, position);
+ }
+
+ result.append(path, start, string::npos);
+
+ return;
+ }
+
+ void DataObjectImpl::getPathToken(const SDOString& propStr, PathToken& pathToken)
+ {
+ // name , name[int], name[x=y] name.int
+ size_t beginbrace = propStr.find('[');
+ size_t dot = propStr.find('.');
+ size_t breaker = 0;
+
+ if (dot != string::npos)
+ {
+ if (beginbrace != string::npos)
+ {
+ breaker = (beginbrace < dot) ? beginbrace : dot;
+ }
+ else
+ {
+ breaker = dot;
+ }
+ }
+ else
+ {
+ breaker = beginbrace;
+ }
+
+ if (breaker == string::npos)
+ {
+ pathToken.index = -1;
+ pathToken.propertyName = propStr;
+ return;
+ }
+
+ pathToken.propertyName = propStr.substr(0, breaker);
+ breaker++;
+ size_t endbrace = propStr.find(']');
+ SDOString breakerStr = propStr.substr(breaker, (endbrace - breaker));
+
+ // Search for the first occurence of an = sign starting at the previously
+ // identified "breaker" character and ending at the endbrace just found. We
+ // need to make a new SDOString to contain that substring.
+
+ size_t eq = breakerStr.find('=');
+
+ if (eq == string::npos)
+ {
+ // There is no "=" sign
+ pathToken.index = atoi(breakerStr.c_str());
+ if (beginbrace != string::npos) --pathToken.index;
+ return;
+ }
+
+ // We did find an "=" sign.
+ pathToken.predicateName = breakerStr.substr(0, eq);
+ // breaker is now propname
+ eq++;
+ pathToken.predicateValue = breakerStr.substr(eq);
+ }
+
+ //////////////////////////////////////////////////////////////////////
+ // Find a data object or return 0 if not found
+ //////////////////////////////////////////////////////////////////////
+ DataObjectImpl* DataObjectImpl::findDataObject(const PathToken& pathToken)
+ {
+ PropertyPtr p = getInstanceProperty(pathToken.propertyName);
+ if (!p) {
+ throwPropertyNotFound(TUSCANY_SDO_EINFO,
+ pathToken.propertyName);
+ }
+ if (pathToken.index == -1 && !pathToken.predicateName.length())
+ {
+ if (p->isMany()) {
+ SDOString msg("Property '");
+ msg += pathToken.propertyName;
+ msg += "' is multi-valued and must have a xpath index.";
+ throw SDOUnsupportedOperationException(TUSCANY_SDO_EINFO,
+ msg.c_str());
+ }
+ return getDataObjectImpl(*p);
+ }
+
+ DataObjectList& list = getList(*p);
+ if (!pathToken.predicateName.length())
+ {
+ if (pathToken.index >=0 && (unsigned int)pathToken.index < list.size())
+ {
+ DataObject* dob = getRawPointer(list[pathToken.index]);
+ return (DataObjectImpl*)dob;
+ }
+ else {
+ std::stringstream msg;
+ msg << "Index out of range: property = '";
+ msg << pathToken.propertyName;
+ msg << "' index = '";
+ msg << pathToken.index;
+ msg << "'.";
+ throw SDOIndexOutOfRangeException(TUSCANY_SDO_EINFO,
+ msg.str().c_str());
+ }
+ }
+
+ for (unsigned int li = 0 ; li < list.size() ; ++li)
+ {
+ // TODO comparison for double not ok
+
+ const Type & t = list[li]->getType();
+ PropertyPtr p = list[li]->getInstanceProperty(pathToken.predicateName);
+ if (!p) {
+ throwPropertyNotFound(TUSCANY_SDO_EINFO,
+ pathToken.predicateName);
+ }
+ int ok = 0;
+
+ switch (p->getTypeEnum())
+ {
+ case Type::BooleanType:
+ {
+ // getCString will return "true" or "false"
+ if (!strcmp(pathToken.predicateValue.c_str(), list[li]->getCString(*p))) ok = 1;
+ }
+ break;
+
+ case Type::ByteType:
+ {
+ char cc = pathToken.predicateValue[0];
+ // getByte return a char
+ if (cc == list[li]->getByte(*p)) ok = 1;
+ }
+ break;
+
+ case Type::CharacterType:
+ {
+ wchar_t wc = *((wchar_t*) pathToken.predicateValue.c_str());
+ // wchar_t wc = (wchar_t)((wchar_t*)eq)[0];
+ // TODO - this is not a very accesible way of storing a wchar
+ if (wc == list[li]->getCharacter(*p)) ok = 1;
+ }
+ break;
+
+ case Type::IntType:
+ {
+ long ic = atol(pathToken.predicateValue.c_str());
+ if (ic == list[li]->getInt(*p)) ok = 1;
+ }
+ break;
+
+ case Type::DateType:
+ {
+ long dc = atol(pathToken.predicateValue.c_str());
+ if (dc == (long)(list[li]->getDate(*p).getTime())) ok = 1;
+ }
+ break;
+
+ case Type::DoubleType:
+ {
+ // TODO - double needs a bigger size than float
+ long double ldc = (long double)atof(pathToken.predicateValue.c_str());
+ if (ldc == list[li]->getDouble(*p)) ok = 1;
+ }
+ break;
+
+ case Type::FloatType:
+ {
+ float fc = atof(pathToken.predicateValue.c_str());
+ if (fc == list[li]->getFloat(*p)) ok = 1;
+ }
+ break;
+
+ case Type::LongType:
+ {
+#if defined(WIN32) || defined (_WINDOWS)
+ int64_t lic = (int64_t)_atoi64(pathToken.predicateValue.c_str());
+#else
+ int64_t lic = (int64_t)strtoll(pathToken.predicateValue.c_str(), NULL, 0);
+#endif
+
+ if (lic == list[li]->getLong(*p)) ok = 1;
+ }
+ break;
+
+ case Type::ShortType:
+ {
+ short sic = atoi(pathToken.predicateValue.c_str());
+ if (sic == list[li]->getShort(*p)) ok = 1;
+ }
+ break;
+
+ case Type::BytesType:
+ case Type::BigDecimalType:
+ case Type::BigIntegerType:
+ case Type::StringType:
+ case Type::UriType:
+ {
+
+ if (!strcmp(pathToken.predicateValue.c_str(), list[li]->getCString(*p))) ok = 1;
+ // try with quotes too
+ size_t firstquote = pathToken.predicateValue.find('"');
+ size_t firstsingle = pathToken.predicateValue.find('\'');
+
+ char searchchar = 0;
+
+ if (firstsingle == string::npos)
+ {
+ if (firstquote != string::npos)
+ {
+ searchchar = '"';
+ }
+ }
+ else
+ {
+ if (firstquote != string::npos && firstquote < firstsingle)
+ {
+ searchchar = '"';
+ }
+ else
+ {
+ searchchar = '\'';
+ firstquote = firstsingle;
+ }
+ }
+
+ if (searchchar != 0)
+ {
+ size_t ender = pathToken.predicateValue.find(searchchar, firstquote + 1);
+ if (ender != string::npos)
+ {
+ if (!strcmp(pathToken.predicateValue.substr(firstquote + 1, ender - (firstquote+1)).c_str(), list[li]->getCString(*p)))
+ ok = 1;
+ }
+ }
+ }
+ break;
+
+ case Type::DataObjectType:
+ break;
+
+ default:
+ break;
+ }
+
+ if (ok == 1)
+ {
+ DataObject* dob = getRawPointer(list[li]);
+ return (DataObjectImpl*)dob;
+ }
+ } // for
+ string msg("Invalid path: ");
+ msg += pathToken.propertyName;
+ msg += "[";
+ msg += pathToken.predicateName;
+ msg += "=";
+ msg += pathToken.predicateValue;
+ msg += "]";
+ throw SDOPathNotFoundException(TUSCANY_SDO_EINFO,
+ msg.c_str());
+ }
+
+
+ //////////////////////////////////////////////////////////////////////
+ // Find a data object and a property name within it.
+ //////////////////////////////////////////////////////////////////////
+ SDOString DataObjectImpl::findPropertyContainer(const SDOString& path, DataObjectImpl** din)
+ {
+ // initially check for "#/" which indicates that we need to find the root object first
+
+ if (path.length() <= 2)
+ {
+ if (path[0] == '#')
+ {
+ DataObjectImpl* root = this;
+ while (root->getContainerImpl() != 0)
+ {
+ root = root->getContainerImpl();
+ }
+ *din = root;
+ return SDOString();
+ }
+ }
+
+ if (path[0] == '#' && path[1] == '/')
+ {
+ DataObjectImpl* root = this;
+ while (root->getContainerImpl() != 0)
+ {
+ root = root->getContainerImpl();
+ }
+ return root->findPropertyContainer(SDOString(path, 2, string::npos), din);
+ }
+
+ DataObjectImpl* d;
+ size_t slashPos = path.find('/'); // i is the subscript of the found character
+ SDOString remaining;
+ SDOString token;
+
+ if (slashPos != string::npos) // If we found a slash character
+ {
+ if (slashPos > 0) // If there is something before the slash
+ {
+ token.assign(path, 0, slashPos);
+ }
+ if ((path.length() - slashPos) > 1) // If there is something after the slash
+ {
+ remaining.assign(path, slashPos + 1, string::npos);
+ }
+ }
+ else
+ {
+ remaining = path;
+ }
+
+ if (token.empty())
+ {
+ if (remaining == "..")
+ {
+ /* Its the container itself */
+ *din = getContainerImpl();
+ return SDOString();
+ }
+
+ /* Its this data object - property could be empty or
+ valid or invalid - user must check */
+ *din = this;
+ return remaining;
+ }
+
+ if (token == "..") {
+ /* Its derived from the container */
+ d = getContainerImpl();
+ /* carry on trying to find a property */
+ if (d != 0) {
+ return d->findPropertyContainer(remaining, din);
+ }
+ /* Give up - no container */
+ *din = 0;
+ return SDOString();
+ }
+
+ /* Try to find a property ....*/
+ PathToken pathToken;
+ getPathToken(token, pathToken);
+ d = findDataObject(pathToken);
+ if (d != 0) {
+ return d->findPropertyContainer(remaining, din);
+ }
+
+ /* Give up its not in the tree */
+ *din = 0;
+ return SDOString();
+ }
+
+
+
+
+ // Returns a read-only List of the Properties currently used in thIs DataObject.
+ // ThIs list will contain all of the properties in getType().getProperties()
+ // and any properties where isSet(property) is true.
+ // For example, properties resulting from the use of
+ // open or mixed XML content are present if allowed by the Type.
+ // The list does not contain duplicates.
+ // The order of the properties in the list begins with getType().getProperties()
+ // and the order of the remaining properties is determined by the implementation.
+ // The same list will be returned unless the DataObject is updated so that
+ // the contents of the list change
+ // @return the list of Properties currently used in thIs DataObject.
+
+ PropertyList /* Property */ DataObjectImpl::getInstanceProperties()
+ {
+ std::vector<PropertyImplPtr> theList;
+ const std::vector<PropertyImplPtr> propList = getTypeImpl().getPropertyListReference();
+
+ for (std::vector<PropertyImplPtr>::const_iterator i = propList.begin();
+ i != propList.end();
+ i++)
+ {
+ theList.push_back(*i);
+ }
+ std::vector<PropertyImplPtr>::iterator j;
+ for (j = openProperties.begin() ;
+ j != openProperties.end() ; ++j)
+ {
+ theList.push_back(*j);
+ }
+ return PropertyList(theList);
+ }
+
+ void DataObjectImpl::setInstancePropertyType(unsigned int index,
+ const Type* t)
+ {
+ if (index >= openBase && index - openBase < openProperties.size())
+ {
+ unsigned int modIndex = index - openBase;
+ PropertyImplPtr prop =
+ new PropertyImpl(getType(),
+ openProperties[modIndex]->getName(),
+ (TypeImpl&)*t,
+ openProperties[modIndex]->isMany(),
+ openProperties[modIndex]->isReadOnly(),
+ openProperties[modIndex]->isContainment());
+
+ openProperties[modIndex] = prop;
+ factory->addOpenProperty(*prop);
+ return;
+ }
+ return;
+ }
+
+ // Returns the Sequence for thIs DataObject.
+ // When Type.isSequencedType() == true,
+ // the Sequence of a DataObject corresponds to the
+ // XML elements representing the values of its properties.
+ // Updates through DataObject and the Lists or Sequences returned
+ // from DataObject operate on the same data.
+ // When Type.isSequencedType() == false, null is returned.
+ // @return the <code>Sequence</code> or null.
+
+ SequenceImplPtr DataObjectImpl::getSequenceImpl()
+ {
+
+ return sequence;
+ }
+
+ SequencePtr DataObjectImpl::getSequence()
+ {
+ return sequence;
+ }
+
+ SequencePtr DataObjectImpl::getSequence(const char* path)
+ {
+ return getSequence(SDOString(path));
+ }
+
+ SequencePtr DataObjectImpl::getSequence(const SDOString& path)
+ {
+ DataObject* d = getRawPointer(getDataObject(path));
+ if (d) return d->getSequence();
+ return 0;
+ }
+
+ SequencePtr DataObjectImpl::getSequence(unsigned int propertyIndex)
+ {
+ DataObject* d = getRawPointer(getDataObject(propertyIndex));
+ if (d) return d->getSequence();
+ return 0;
+ }
+
+ SequencePtr DataObjectImpl::getSequence(const Property& property)
+ {
+ DataObject* d = getRawPointer(getDataObject(property));
+ if (d) return d->getSequence();
+ return 0;
+ }
+
+
+
+ ChangeSummaryPtr DataObjectImpl::getChangeSummary(const char* path)
+ {
+ // Can path really be a null pointer?
+ if (path == 0)
+ {
+ return(getChangeSummary(SDOString()));
+ }
+ else
+ {
+ return(getChangeSummary(SDOString(path)));
+ }
+ }
+
+ ChangeSummaryPtr DataObjectImpl::getChangeSummary(const SDOString& path)
+ {
+ DataObjectImpl* d = getDataObjectImpl(path);
+ return d->getChangeSummary();
+ }
+
+ ChangeSummaryPtr DataObjectImpl::getChangeSummary(unsigned int propIndex)
+ {
+ DataObjectImpl* d = getDataObjectImpl(propIndex);
+ return d->getChangeSummary();
+ }
+
+ ChangeSummaryPtr DataObjectImpl::getChangeSummary(const Property& prop)
+ {
+ DataObjectImpl* d = getDataObjectImpl(prop);
+ return d->getChangeSummary();
+
+ }
+
+ ChangeSummaryPtr DataObjectImpl::getChangeSummary()
+ {
+ return getChangeSummaryImpl();
+ }
+
+ ChangeSummaryImplPtr DataObjectImpl::getChangeSummaryImpl()
+ {
+ if (getType().isChangeSummaryType())
+ {
+ return localCS;
+ }
+
+ DataObjectImpl* dob = getContainerImpl();
+ while (dob != 0)
+ {
+ if (dob->getType().isChangeSummaryType())
+ {
+ return dob->getSummary();
+ }
+ dob = dob->getContainerImpl();
+ }
+ return 0;
+ }
+
+ ChangeSummaryImplPtr DataObjectImpl::getSummary()
+ {
+ return localCS;
+ }
+
+ // sets a property of either this object or an object reachable from it,
+ // as identified by the specified path,
+ // to the specified value.
+ // @param path the path to a valid object and property.
+ // @param value the new value for the property.
+
+ void DataObjectImpl::setDataObject(const char* path, DataObjectPtr value)
+ {
+ setDataObject(SDOString(path), value, true);
+ }
+
+ void DataObjectImpl::setDataObject(const char* path, DataObjectPtr value, bool updateSequence)
+ {
+ setDataObject(SDOString(path), value, updateSequence);
+ }
+
+ void DataObjectImpl::setDataObject(const SDOString& path,
+ DataObjectPtr value)
+ {
+ setDataObject(path, value, false);
+ }
+
+ void DataObjectImpl::setDataObject(const SDOString& path,
+ DataObjectPtr value,
+ bool updateSequence)
+ {
+ DataObjectImpl* d;
+
+ SDOString prop = findPropertyContainer(path, &d);
+ if (d != 0)
+ {
+ if (!prop.empty()) {
+ const PropertyImpl* p = d->getPropertyImpl(prop);
+ if ((p == 0) && (d->getType().isOpenType()))
+ {
+ if (value != 0)
+ {
+ p = d->defineDataObject(prop, value->getType());
+ }
+ }
+ if (p != 0)
+ {
+ ASSERT_SETTABLE(p, DataObject);
+ if (p->isMany())
+ {
+ DataObjectList& dol = d->getList((Property&)*p);
+ PathToken pathToken;
+ getPathToken(prop, pathToken);
+ unsigned int index = (unsigned int) pathToken.index;
+ if (index >= 0)
+ {
+ if(index < dol.size())
+ {
+ dol.setDataObject(index, value);
+ }
+ else
+ {
+ dol.append(value);
+ }
+ return;
+ }
+ string msg("Set of data object on many valued item");
+ msg += path;
+ throw SDOUnsupportedOperationException(TUSCANY_SDO_EINFO,
+ msg.c_str());
+ }
+ else
+ {
+ d->setDataObject((Property&) *p, value, updateSequence);
+ return;
+ }
+ }
+ }
+ }
+
+ string msg("Path not valid:");
+ msg += path;
+ throw SDOPathNotFoundException(TUSCANY_SDO_EINFO,
+ msg.c_str());
+ }
+
+ void DataObjectImpl::validateIndex(unsigned int index)
+ {
+ const std::vector<PropertyImplPtr> pl = getTypeImpl().getPropertyListReference();
+
+ if (index >= pl.size()) {
+
+ // open type support
+ if (getType().isOpenType())
+ {
+ if (index < openBase + openProperties.size())
+ {
+ return;
+ }
+ }
+
+ string msg("Index of property out of range:");
+ msg += index;
+ throw SDOIndexOutOfRangeException(TUSCANY_SDO_EINFO,
+ msg.c_str());
+ }
+ }
+
+
+ void DataObjectImpl::checkFactory(DataObjectPtr dob,
+ unsigned int propertyIndex)
+ {
+
+ DataObjectImpl* d = (DataObjectImpl*)getRawPointer(dob);
+
+ if (d->getDataFactory() == getDataFactory()) return;
+
+ if (d->getContainer() != 0)
+ {
+ string msg("Insertion of object from another factory is only allowed if the parent is null: ");
+ const Type& t = d->getType();
+ msg += t.getURI();
+ msg += "#";
+ msg += t.getName();
+ msg += " into property ";
+ msg += getPropertyFromIndex(propertyIndex).getName();
+ msg += " of ";
+ msg += getType().getURI();
+ msg += "#";
+ msg += getType().getName();
+ throw SDOInvalidConversionException(TUSCANY_SDO_EINFO,
+ msg.c_str());
+ }
+
+ }
+
+
+ void DataObjectImpl::checkType( const Property& prop,
+ const Type& objectType)
+ {
+ const Type& propType = prop.getType();
+ if (propType.equals(objectType)) return;
+
+ const TypeImpl* ti = factory->findTypeImpl
+ (objectType.getURI(),objectType.getName());
+ if (ti != 0)
+ {
+ do
+ {
+ ti = (const TypeImpl*)ti->getBaseType();
+ if (ti == 0) break;
+ if (propType.equals(*ti)) return;
+ } while (ti != 0);
+
+ // allow types of any substitutes
+ const PropertyImpl* pi =
+ getPropertyImpl(getPropertyIndex(prop));
+ if (pi != 0)
+ {
+ unsigned int subcount = pi->getSubstitutionCount();
+ for (unsigned int i=0;i<subcount;i++)
+ {
+ const Type* tsub = pi->getSubstitutionType(i);
+ if (tsub != 0 && tsub->equals(objectType)) return;
+ }
+ }
+ }
+
+ // no match..
+ string msg("Insertion of object of incompatible type ");
+ msg += objectType.getURI();
+ msg += "#";
+ msg += objectType.getName();
+ msg += " into property of type ";
+ msg += propType.getURI();
+ msg += "#";
+ msg += propType.getName();
+ throw SDOInvalidConversionException(TUSCANY_SDO_EINFO,
+ msg.c_str());
+ }
+
+ void DataObjectImpl::setDataObject(unsigned int propertyIndex, DataObjectPtr value)
+ {
+ setDataObject(getPropertyFromIndex(propertyIndex), value, true);
+ }
+
+ void DataObjectImpl::setDataObject(unsigned int propertyIndex, DataObjectPtr value, bool updateSequence)
+ {
+ setDataObject(getPropertyFromIndex(propertyIndex), value, updateSequence);
+ }
+
+ void DataObjectImpl::setDataObject(const Property& prop, DataObjectPtr value)
+ {
+ setDataObject(prop, value, false);
+ }
+
+void DataObjectImpl::setDataObject(const Property& prop,
+ DataObjectPtr value,
+ bool updateSequence)
+{
+ unsigned int propertyIndex = getPropertyIndexInternal(prop);
+
+ if (value != 0)
+ {
+ checkFactory(value, propertyIndex);
+ checkType(prop, value->getType());
+ }
+
+ validateIndex(propertyIndex);
+
+ if (prop.isReference() && (value != 0))
+ {
+ // just need to make sure that the object is already part of our tree.
+ DataObjectImpl* r1 = this;
+ while (r1->getContainerImpl() != 0)
+ {
+ r1 = r1->getContainerImpl();
+ }
+ DataObjectImpl* r2 = (DataObjectImpl*)getRawPointer(value);
+ while (r2->getContainerImpl() != 0)
+ {
+ r2 = r2->getContainerImpl();
+ }
+ if (r1 != r2)
+ {
+ string msg("Set of a reference to an object outside the graph");
+ throw SDOUnsupportedOperationException(TUSCANY_SDO_EINFO,
+ msg.c_str());
+ }
+ }
+
+ if ((prop.isMany()))
+ {
+ string msg("Set operation on a many valued property:");
+ msg += prop.getName();
+ throw SDOUnsupportedOperationException(TUSCANY_SDO_EINFO,
+ msg.c_str());
+ }
+
+ ASSERT_WRITABLE(prop, setDataObject);
+
+ if (value == 0)
+ {
+ // The new data object value is actually a null pointer.
+ PropertyValueMap::iterator j;
+ // Scan the property value map looking for this property.
+ for (j = PropertyValues.begin(); j != PropertyValues.end(); ++j)
+ {
+ if ((*j).first == propertyIndex)
+ {
+ if (prop.isReference())
+ {
+ ((*j).second)->unsetReference(this, prop);
+ }
+ else
+ {
+ // log both deletion and change - change is not
+ // automatically recorded by deletion.
+ ((*j).second)->logDeletion();
+ }
+ logChange(prop);
+ (*j).second = DataObjectImplPtr(0);
+ // We have just changed the value of this property, therefore
+ // if this is a sequenced data object, then we must update the
+ // sequence so that the new setting appears at the end (and
+ // the existing entry is removed).
+ if ((getType().isSequencedType()) && updateSequence)
+ {
+ sequence->removeAll(prop);
+ sequence->push(prop, 0);
+ }
+
+ return;
+ }
+ }
+ // The property does not currently have a value.
+ logChange(prop);
+ PropertyValues.push_back(rdo(propertyIndex, (DataObjectImpl*) 0));
+ // If this is a sequenced data object then update the
+ // sequence. We already know that a) the property was not previously
+ // set so it can't be in the sequence currently and b) it is not a
+ // multi-valued property.
+ if ((getType().isSequencedType()) && updateSequence)
+ {
+ getSequenceImpl()->push(prop, 0);
+ }
+ return;
+ }
+
+ DataObject* dob = getRawPointer(value);
+ PropertyValueMap::iterator i;
+ for (i = PropertyValues.begin(); i != PropertyValues.end(); ++i)
+ {
+ if ((*i).first == propertyIndex)
+ {
+ if (prop.isReference())
+ {
+ ((*i).second)->unsetReference(this, prop);
+ }
+ else
+ {
+ // log both deletion and change - change is not
+ // automatically recorded by deletion.
+ ((*i).second)->logDeletion();
+ }
+ logChange(prop);
+
+ (*i).second = DataObjectImplPtr((DataObjectImpl*) dob);
+
+ if (prop.isReference())
+ {
+ ((DataObjectImpl*) dob)->setReference(this, prop);
+ }
+ else
+ {
+ logCreation(getRawPointer((*i).second), this, prop);
+ }
+ return;
+ }
+ }
+ if (prop.isReference())
+ {
+ ((DataObjectImpl*)dob)->setReference(this, prop);
+ }
+ else
+ {
+ ((DataObjectImpl*)dob)->setContainer(this);
+ // log creation before putting into property values.
+ // also log change - not done by logCreation
+ logCreation((DataObjectImpl*)dob, this, prop);
+ }
+
+ logChange(prop);
+
+ PropertyValues.push_back(rdo(propertyIndex, (DataObjectImpl*) dob));
+ // If this is a sequenced data object then update the
+ // sequence. We already know that a) the property is not
+ // in the sequence currently and b) it is not a
+ // multi-valued property.
+ if ((getType().isSequencedType()) && updateSequence)
+ {
+ getSequenceImpl()->push(prop, 0);
+ }
+
+ return;
+}
+
+ bool DataObjectImpl::isValid(const char* path)
+ {
+ // Can path really be a null pointer?
+ if (path == 0)
+ {
+ return(isValid(SDOString()));
+ }
+ else
+ {
+ return(isValid(SDOString(path)));
+ }
+
+ }
+
+ bool DataObjectImpl::isValid(const SDOString& path)
+ {
+ DataObjectImpl* d;
+ SDOString prop = findPropertyContainer(path, &d);
+ if (d != 0) {
+ if (!prop.empty()) {
+ PropertyPtr p = d->getInstanceProperty(prop);
+ if (!p) {
+ throwPropertyNotFound(TUSCANY_SDO_EINFO,
+ prop);
+ }
+ return d->isValid(*p);
+ }
+ }
+ string msg("Invalid path:");
+ msg += path;
+ throw SDOPathNotFoundException(TUSCANY_SDO_EINFO,
+ msg.c_str());
+ }
+
+ // Returns whether a property of either this object or an object reachable
+ // from it, as identified by the specified path,
+ // is considered to be set.
+ // @param path the path to a valid Object* and property.
+
+ bool DataObjectImpl::isSet(const char* path)
+ {
+ // Can path really be a null pointer?
+ if (path == 0)
+ {
+ return(isSet(SDOString()));
+ }
+ else
+ {
+ return(isSet(SDOString(path)));
+ }
+ }
+
+ bool DataObjectImpl::isSet(const SDOString& path)
+ {
+ DataObjectImpl* d;
+ SDOString prop = findPropertyContainer(path, &d);
+ if (d != 0) {
+ if (!prop.empty()) {
+ PropertyPtr p = d->getInstanceProperty(prop);
+ if (!p) {
+ throwPropertyNotFound(TUSCANY_SDO_EINFO,
+ prop);
+ }
+ return d->isSet(*p);
+ }
+ }
+ string msg("Invalid path:");
+ msg += path;
+ throw SDOPathNotFoundException(TUSCANY_SDO_EINFO,
+ msg.c_str());
+ }
+
+ bool DataObjectImpl::isValid(unsigned int propertyIndex)
+ {
+ return isValid(getPropertyFromIndex(propertyIndex));
+ }
+
+ bool DataObjectImpl::isValid(const Property& p)
+ {
+ if (p.isDefaulted()) return true;
+ if (isSet(p))return true;
+ return false;
+ }
+
+ bool DataObjectImpl::isSet(unsigned int propertyIndex)
+ {
+ return isSet(getPropertyFromIndex(propertyIndex), propertyIndex);
+ }
+
+ bool DataObjectImpl::isSet(const Property& property)
+ {
+ return isSet(property, getPropertyIndex(property));
+ }
+
+ bool DataObjectImpl::isSet(const Property& prop, unsigned int propertyIndex)
+ {
+ PropertyValueMap::iterator i;
+ for (i = PropertyValues.begin(); i != PropertyValues.end(); ++i)
+ {
+ if ((*i).first == propertyIndex) {
+ if (prop.isMany())
+ {
+ DataObjectImpl* dol = getRawPointer((*i).second);
+ if (dol != 0 && dol->getList().size() == 0)
+ {
+ return false;
+ }
+ }
+ return true;
+ }
+ }
+ return false;
+ }
+
+
+ // unSets a property of either this Object or an Object reachable from it,
+ // as identified by the specified path.
+ // @param path the path to a valid Object and property.
+ // @see #unSet(Property)
+
+ void DataObjectImpl::unset(const char* path)
+ {
+ // Can path really be a null pointer?
+ if (path == 0)
+ {
+ unset(SDOString());
+ }
+ else
+ {
+ unset(SDOString(path));
+ }
+ }
+
+ void DataObjectImpl::unset(const SDOString& path)
+ {
+ DataObjectImpl* d;
+ SDOString prop = findPropertyContainer(path, &d);
+ if (d != 0)
+ {
+ if (!prop.empty())
+ {
+ PropertyPtr p = d->getInstanceProperty(prop);
+ if (!p) {
+ throwPropertyNotFound(TUSCANY_SDO_EINFO,
+ prop);
+ }
+ ASSERT_WRITABLE(*p, unset);
+ if (p->isMany())
+ {
+ SDOString subscript;
+ size_t beginbrace = prop.find('[');
+ if (beginbrace != string::npos)
+ {
+ size_t endbrace = prop.find(']', ++beginbrace);
+ if (endbrace != string::npos) {
+ subscript =
+ prop.substr(beginbrace, (endbrace - beginbrace));
+ }
+ unsigned int i = atoi(subscript.c_str());
+ if (i > 0) {
+ i--;
+ DataObjectList& li = d->getList(*p);
+ li.remove(i);
+ }
+ return;
+ }
+ size_t firstdot = prop.find('.');
+ if (firstdot != string::npos) {
+ subscript = prop.substr(++firstdot);
+ unsigned int i = atoi(subscript.c_str());
+ DataObjectList& li = d->getList(*p);
+ li.remove(i);
+ return;
+ }
+ }
+ d->unset(*p);
+ return;
+ }
+ }
+
+ string msg("Invalid path:");
+ msg += path;
+ throw SDOPathNotFoundException(TUSCANY_SDO_EINFO,
+ msg.c_str());
+ }
+
+ void DataObjectImpl::unset(unsigned int propertyIndex)
+ {
+ unset(getPropertyFromIndex(propertyIndex));
+ }
+
+ void DataObjectImpl::unset(const Property& p)
+ {
+ ASSERT_WRITABLE(p, unset)
+
+ PropertyValueMap::iterator i;
+ unsigned int index = getPropertyIndex(p);
+
+ if (getType().isSequencedType())
+ {
+ sequence->removeAll(p);
+ }
+
+ for (i = PropertyValues.begin(); i != PropertyValues.end(); ++i)
+ {
+ if ((*i).first == index) {
+ DataObjectImplPtr dol = (*i).second;
+ if (p.getType().isDataType())
+ {
+ dol->clearReferences();
+ logChange(index);
+ if (p.isMany()) {
+ DataObjectList& dl = dol->getList();
+ while (dl.size() > 0)
+ {
+ RefCountingPointer<DataObject> dli = dl.remove(0);
+ }
+ }
+ else
+ {
+ PropertyValues.erase(i);
+ }
+ }
+ else {
+ // if its a reference, we dont want to delete anything
+ if (!p.isReference())
+ {
+ if (dol) {
+ dol->clearReferences();
+ if (p.isMany()) {
+ DataObjectList& dl = dol->getList();
+ while (dl.size() > 0)
+ {
+ if (p.getType().isDataObjectType())
+ {
+ DataObject* dob = getRawPointer(dl[0]);
+ ((DataObjectImpl*)dob)->logDeletion();
+ }
+ // the remove will record a change
+ // remove will also clear the container.
+ RefCountingPointer<DataObject> dli = dl.remove(0);
+ }
+ }
+ else
+ {
+ PropertyValues.erase(i);
+ dol->logDeletion();
+ logChange(index);
+ dol->setContainer(0);
+ }
+ }
+ else
+ {
+ logChange(index);
+ PropertyValues.erase(i);
+ }
+ }
+ else {
+ if (dol)
+ {
+ dol->unsetReference(this, p);
+ }
+ logChange(index);
+ PropertyValues.erase(i);
+ }
+ }
+ if (getType().isOpenType() && index >= openBase)
+ {
+ if (p.isMany())
+ {
+ PropertyValues.erase(i);
+ }
+ undefineProperty(index);
+ }
+ return;
+ }
+ }
+ return;
+ }
+
+
+
+ // Returns the value of a DataObject property identified by
+ // the specified path.
+ // @param path the path to a valid object and property.
+ // @return the DataObject value of the specified property.
+
+ RefCountingPointer<DataObject> DataObjectImpl::getDataObject(const char* path)
+ {
+ return getDataObject(SDOString(path));
+ }
+
+ RefCountingPointer<DataObject> DataObjectImpl::getDataObject(const SDOString& path)
+ {
+ DataObjectImpl* ptr = getDataObjectImpl(path);
+ return RefCountingPointer<DataObject> ((DataObject*)ptr);
+ }
+
+ DataObjectImpl* DataObjectImpl::getDataObjectImpl(const SDOString& path)
+ {
+
+ DataObjectImpl* d = 0;
+ SDOString prop = findPropertyContainer(path, &d);
+ if (d != 0)
+ {
+ if (!prop.empty())
+ {
+ PathToken pathToken;
+ d->getPathToken(prop, pathToken);
+ return d->findDataObject(pathToken);
+ }
+ else
+ {
+ return d;
+ }
+ }
+ string msg("Invalid path: ");
+ msg += path;
+ throw SDOPathNotFoundException(TUSCANY_SDO_EINFO,
+ msg.c_str());
+ }
+
+ RefCountingPointer<DataObject> DataObjectImpl::getDataObject(unsigned int propertyIndex)
+ {
+ if ((getPropertyFromIndex(propertyIndex).isMany()))
+ {
+ string msg("get operation on a many valued property:");
+ msg += getPropertyFromIndex(propertyIndex).getName();
+ throw SDOUnsupportedOperationException(TUSCANY_SDO_EINFO,
+ msg.c_str());
+ }
+ DataObjectImpl* ptr = getDataObjectImpl(propertyIndex);
+
+ return RefCountingPointer<DataObject>((DataObject*)ptr);
+ }
+
+ DataObjectImpl* DataObjectImpl::getDataObjectImpl(unsigned int propertyIndex)
+ {
+ PropertyValueMap::iterator i;
+ for (i = PropertyValues.begin(); i != PropertyValues.end(); ++i)
+ {
+ if ((*i).first == propertyIndex)
+ {
+ DataObject* dob = getRawPointer((*i).second);
+ if ((dob == 0) || ((DataObjectImpl*) dob)->isNull())
+ {
+ return 0;
+ }
+ return (DataObjectImpl*) dob;
+ }
+ }
+ return 0;
+ }
+
+
+ RefCountingPointer<DataObject> DataObjectImpl::getDataObject(const Property& property)
+ {
+ DataObjectImpl* ptr = getDataObjectImpl(property);
+ return RefCountingPointer<DataObject>((DataObject*) ptr);
+ }
+
+ DataObjectImpl* DataObjectImpl::getDataObjectImpl(const Property& property)
+ {
+ return getDataObjectImpl(getPropertyIndex(property));
+ }
+
+
+
+ // Returns a new DataObject contained by this Object using the specified property,
+ // which must be a containment property.
+ // The type of the created Object is the declared type of the specified property.
+
+ RefCountingPointer<DataObject> DataObjectImpl::createDataObject(const SDOString& propertyName)
+ {
+ // Throws runtime exception for type or property not found
+
+ PropertyPtr p = getInstanceProperty(propertyName);
+ if (!p) {
+ throwPropertyNotFound(TUSCANY_SDO_EINFO,
+ propertyName);
+ }
+ return createDataObject(*p);
+ }
+
+ // Returns a new DataObject contained by this Object using the specified property,
+ // which must be a containment property.
+ // The type of the created Object is the declared type of the specified property.
+
+ RefCountingPointer<DataObject> DataObjectImpl::createDataObject(const char* propertyName)
+ {
+ // Can propertyName really be a null pointer?
+ if (propertyName == 0)
+ {
+ return(createDataObject(SDOString()));
+ }
+ else
+ {
+ return(createDataObject(SDOString(propertyName)));
+ }
+ }
+
+ // Returns a new DataObject contained by this Object using the specified property,
+ // which must be a containment property.
+ // The type of the created Object is the declared type of the specified property.
+
+ RefCountingPointer<DataObject> DataObjectImpl::createDataObject(unsigned int propertyIndex)
+ {
+ const Property& p = getPropertyFromIndex(propertyIndex);
+ return createDataObject(p);
+ }
+
+ // Returns a new DataObject contained by this Object using the specified property,
+ // which must be a containment property.
+ // The type of the created Object is the declared type of the specified property.
+
+ RefCountingPointer<DataObject> DataObjectImpl::createDataObject(const Property& property)
+ {
+ const Type& tp = property.getType();
+ return createDataObject(property,tp.getURI(), tp.getName());
+ }
+
+
+ // Returns a new DataObject contained by this Object using the specified property,
+ // which must be a containment property.
+ // The type of the created Object is the declared type of the specified property.
+
+ RefCountingPointer<DataObject> DataObjectImpl::createDataObject(const Property& property, const char* namespaceURI,
+ const char* typeName)
+ {
+ if (!property.isContainment())
+ {
+ string msg("Create data object on non-containment property:");
+ msg += property.getName();
+ throw SDOUnsupportedOperationException(TUSCANY_SDO_EINFO,
+ msg.c_str());
+ }
+
+ if (property.isMany()) {
+ /* add to the list */
+ RefCountingPointer<DataObject> ptr = factory->create(namespaceURI, typeName);
+ DataObject* dob = getRawPointer(ptr);
+ ((DataObjectImpl*)dob)->setContainer(this);
+
+ // log creation before adding to list - the change must record the old state
+ // of the list
+ logCreation(((DataObjectImpl*)dob), this, property);
+ //logChange(property);
+
+ DataObjectImpl* theDO = getDataObjectImpl(property);
+ if ( theDO == 0) { /* No value set yet */
+ unsigned int ind = getPropertyIndex(property);
+ RefCountingPointer<DataObject> listptr =
+ factory->create(SDOUtils::sdoURI,"OpenDataObject");
+
+ DataObject* doptr = getRawPointer(listptr);
+
+ PropertyValues.push_back(rdo(ind, (DataObjectImpl*) doptr));
+
+ ((DataObjectImpl*)doptr)->setContainer(this);
+
+ DataObjectListImpl* list = new DataObjectListImpl(factory,
+ this, ind, namespaceURI,typeName);
+
+ ((DataObjectImpl*)doptr)->setList(list);
+ // the append will log a change to the property.
+ list->append(ptr);
+
+ // now done by list append
+ //if (getType().isSequencedType())
+ //{
+ // SequenceImpl* sq = getSequenceImpl();
+ // sq->push(property,0);
+ //}
+ }
+ else
+ {
+ DataObjectList& list = theDO->getList();
+ // the append will log a change to the property, and update the
+ // sequence
+ list.append(ptr);
+ //if (getType().isSequencedType())
+ //{
+ // SequenceImpl* sq = getSequenceImpl();
+ // sq->push(property,list.size()-1);
+ //}
+
+ }
+ return ptr;
+
+ }
+ else {
+ unset(property);
+ DataObjectImpl* ditem =
+ new DataObjectImpl(factory, factory->getType(namespaceURI, typeName));
+ ditem->setContainer(this);
+
+ // log both creation and change - creations no longer log
+ // changes automatically.
+
+ logCreation(ditem, this, property);
+ logChange(property);
+
+ PropertyValues.push_back(rdo(getPropertyIndex(property), ditem));
+
+ if (getType().isSequencedType())
+ {
+ sequence->push(property,0);
+ }
+ return RefCountingPointer<DataObject>((DataObject*)ditem);
+ }
+ return 0;
+ }
+
+ void DataObjectImpl::setList( DataObjectList* theList)
+ {
+ listValue = (DataObjectListImpl*)theList;
+ }
+
+
+ bool DataObjectImpl::remove(DataObjectImpl* indol)
+ {
+ PropertyValueMap::iterator i;
+ for (i = PropertyValues.begin(); i != PropertyValues.end(); ++i)
+ {
+ const Property& prop = getPropertyFromIndex((*i).first);
+ if (prop.isMany())
+ {
+ DataObjectList& dol = ((*i).second)->getList();
+ for (unsigned int j=0;j< dol.size(); j++)
+ {
+ if (dol[j] == indol)
+ {
+ indol->logDeletion();
+ logChange(prop);
+ indol->setContainer(0);
+ dol.remove(j);
+ return true;
+ }
+ }
+ }
+ DataObjectImpl* tmp = getRawPointer((*i).second);
+ if (tmp == indol) {
+ indol->logDeletion();
+ logChange(prop);
+ indol->setContainer(0);
+ PropertyValues.erase(i);
+ return true;
+ }
+ }
+ return false;
+ }
+
+ // remove this Object from its container and dont unSet all its properties.
+
+ void DataObjectImpl::detach()
+ {
+ // remove this data object from its tree
+ clearReferences();
+ if (container == 0) return;
+ container->remove(this);
+ return ;
+ }
+
+ void DataObjectImpl::clear()
+ {
+ // clear this objects state
+ PropertyValueMap::iterator i = PropertyValues.begin();
+
+ while (i != PropertyValues.end())
+ {
+ unset((*i).first);
+ i = PropertyValues.begin();
+ }
+ return ;
+ }
+
+ // Returns the containing Object
+ // or 0 if there is no container.
+
+ RefCountingPointer<DataObject> DataObjectImpl::getContainer()
+ {
+ DataObject* dob = (DataObject*)container;
+ return RefCountingPointer<DataObject> (dob);
+ }
+
+ DataObjectImpl* DataObjectImpl::getContainerImpl()
+ {
+ return container;
+ }
+
+ void DataObjectImpl::setContainer(DataObjectImpl* d)
+ {
+ container = d;
+ }
+
+ const Property* DataObjectImpl::findInProperties(DataObject* ob)
+ {
+ PropertyValueMap::iterator i;
+ for (i = PropertyValues.begin() ;i != PropertyValues.end() ; ++i)
+ {
+ const Property& p = getPropertyFromIndex((*i).first);
+ if (p.isReference()) continue;
+ if (p.isMany())
+ {
+ DataObjectList& dl = ((*i).second)->getList();
+ for (unsigned int j = 0 ; j < dl.size(); j++)
+ {
+ if (dl[j] == ob)
+ {
+ return &p;
+ }
+ }
+ }
+ else
+ {
+ if ((*i).second == ob)
+ {
+ return &p;
+ }
+ }
+ }
+ return 0; // this can happen if the object has been detached
+
+ //string msg("Object cannot find its containing property");
+ //throw SDOPropertyNotFoundException(TUSCANY_SDO_EINFO,
+ // msg.c_str());
+ }
+
+ // Return the Property of the data Object containing this data Object
+ // or 0 if there is no container.
+
+ const Property& DataObjectImpl::getContainmentProperty()
+ {
+ if (container != 0) {
+ const Property* p = container->findInProperties(this);
+ if (p != 0)return *p;
+ }
+ throw SDOPropertyNotFoundException(TUSCANY_SDO_EINFO,
+ "Object cannot find its containment property");
+ }
+
+
+ // Returns the data Object's type.
+ // The type defines the properties available for reflective access.
+
+ const Type& DataObjectImpl::getType()
+ {
+ return (const Type&)(*ObjectType);
+ }
+
+ const Type::Types DataObjectImpl::getTypeEnum()
+ {
+ return ObjectType->getTypeEnum();
+ }
+
+ const TypeImpl& DataObjectImpl::getTypeImpl()
+ {
+ return (const TypeImpl&)*ObjectType;
+ }
+
+
+ // open type support
+
+ PropertyPtr DataObjectImpl::getInstanceProperty(const char* prop)
+ {
+ return getInstanceProperty(SDOString(prop));
+ }
+
+ PropertyPtr DataObjectImpl::getInstanceProperty(const SDOString& prop)
+ {
+ return getPropertyImpl(prop);
+ }
+
+ PropertyImpl* DataObjectImpl::getPropertyImpl(const SDOString& prop)
+ {
+ PropertyImpl* pi = getTypeImpl().getPropertyImpl(prop);
+ if (pi != 0) return pi;
+
+ if (getType().isOpenType())
+ {
+ std::vector<PropertyImplPtr>::iterator j;
+ for (j=openProperties.begin();
+ j != openProperties.end(); ++j)
+ {
+ if (!strcmp((*j)->getName(), prop.c_str()))
+ {
+ return getRawPointer(staticCast<PropertyImplPtr>(*j));
+ }
+ }
+ }
+ return 0;
+ }
+
+ DataFactoryPtr DataObjectImpl::getDataFactory()
+ {
+ return factory;
+ }
+
+ void DataObjectImpl::setDataFactory(DataFactoryImplPtr df)
+ {
+ factory = df;
+ ObjectType = (TypeImpl*)&(factory->getType(ObjectType->getURI(),
+ ObjectType->getName()));
+ }
+
+ ///////////////////////////////////////////////////////////////////////////
+ // These finally are the setters/getters for primitives given
+ // that the data object is a primitive type.
+ ///////////////////////////////////////////////////////////////////////////
+
+
+ bool DataObjectImpl::getBoolean()
+ {
+ return getTypeImpl().convertToBoolean(sdoValue);
+ }
+
+ char DataObjectImpl::getByte()
+ {
+ return getTypeImpl().convertToByte(sdoValue);
+ }
+
+ wchar_t DataObjectImpl::getCharacter()
+ {
+ return getTypeImpl().convertToCharacter(sdoValue);
+ }
+
+ long DataObjectImpl::getInt()
+ {
+ return getTypeImpl().convertToInt(sdoValue);
+ }
+
+ long double DataObjectImpl::getDouble()
+ {
+ return getTypeImpl().convertToDouble(sdoValue);
+ }
+
+ float DataObjectImpl::getFloat()
+ {
+ return getTypeImpl().convertToFloat(sdoValue);
+ }
+
+ int64_t DataObjectImpl::getLong()
+ {
+ return getTypeImpl().convertToLong(sdoValue);
+ }
+
+ short DataObjectImpl::getShort()
+ {
+ return getTypeImpl().convertToShort(sdoValue);
+ }
+
+ unsigned int DataObjectImpl::getString(wchar_t* outptr, unsigned int max)
+ {
+ return getTypeImpl().convertToString(sdoValue, outptr, max);
+ }
+
+ unsigned int DataObjectImpl::getBytes( char* outptr, unsigned int max)
+ {
+ return getTypeImpl().convertToBytes(sdoValue, outptr, max);
+ }
+
+ const char* DataObjectImpl::getCString()
+ {
+ return getTypeImpl().convertToCString(sdoValue);
+ }
+
+ const SDODate DataObjectImpl::getDate()
+ {
+ return getTypeImpl().convertToDate(sdoValue);
+ }
+
+ DataObjectImpl* DataObjectImpl::getDataObject()
+ {
+ // If the sdoValue is unset, then there is no primitive value.
+ // If doValue is non-null then that is the data object value.
+ switch (getTypeImpl().getTypeEnum())
+ {
+ case Type::OtherTypes:
+ case Type::DataObjectType:
+ return doValue;
+
+ case Type::BooleanType:
+ case Type::ByteType:
+ case Type::CharacterType:
+ case Type::IntType:
+ case Type::ShortType:
+ case Type::DoubleType:
+ case Type::FloatType:
+ case Type::LongType:
+ case Type::DateType:
+ case Type::BigDecimalType:
+ case Type::BigIntegerType:
+ case Type::StringType:
+ case Type::BytesType:
+ case Type::UriType:
+ default:
+ {
+ string msg("Cannot get Data Object from object of type:");
+ msg += getTypeImpl().getName();
+ throw SDOInvalidConversionException(TUSCANY_SDO_EINFO,
+ msg.c_str());
+ break;
+ }
+ }
+ return 0;
+ }
+
+ void DataObjectImpl::setBoolean(bool invalue)
+ {
+ switch(getTypeEnum())
+ {
+
+ case Type::BooleanType:
+ case Type::ByteType:
+ case Type::CharacterType:
+ case Type::IntType:
+ case Type::ShortType:
+ case Type::LongType:
+ case Type::BigDecimalType:
+ case Type::BigIntegerType:
+ case Type::StringType:
+ case Type::UriType:
+ case Type::BytesType:
+ sdoValue = SDOValue(invalue);
+ break;
+
+ case Type::DoubleType:
+ case Type::FloatType:
+ case Type::DateType:
+ case Type::OtherTypes:
+ case Type::DataObjectType:
+ case Type::ChangeSummaryType:
+ default:
+ {
+ string msg("Cannot set Boolean on object of type:");
+ msg += getTypeImpl().getName();
+ throw SDOInvalidConversionException(TUSCANY_SDO_EINFO,
+ msg.c_str());
+ break;
+ }
+ }
+ return;
+ }
+
+
+ void DataObjectImpl::setByte(char invalue)
+ {
+ switch (getTypeEnum())
+ {
+ case Type::BooleanType:
+ case Type::ByteType:
+ case Type::CharacterType:
+ case Type::IntType:
+ case Type::ShortType:
+ case Type::DoubleType:
+ case Type::FloatType:
+ case Type::LongType:
+ case Type::DateType:
+ case Type::BigDecimalType:
+ case Type::BigIntegerType:
+ case Type::StringType:
+ case Type::UriType:
+ case Type::BytesType:
+ sdoValue = SDOValue(invalue);
+ break;
+
+ case Type::OtherTypes:
+ case Type::DataObjectType:
+ case Type::ChangeSummaryType:
+ default:
+ {
+ string msg("Cannot set Byte on object of type:");
+ msg += getTypeImpl().getName();
+ throw SDOInvalidConversionException(TUSCANY_SDO_EINFO,
+ msg.c_str());
+ break;
+ }
+ }
+ return;
+ }
+
+
+ void DataObjectImpl::setCharacter(wchar_t invalue)
+ {
+ switch (getTypeEnum())
+ {
+ case Type::BooleanType:
+ case Type::ByteType:
+ case Type::CharacterType:
+ case Type::IntType:
+ case Type::ShortType:
+ case Type::DoubleType:
+ case Type::FloatType:
+ case Type::LongType:
+ case Type::DateType:
+ case Type::BigDecimalType:
+ case Type::BigIntegerType:
+ case Type::StringType:
+ case Type::UriType:
+ case Type::BytesType:
+ sdoValue = SDOValue(invalue);
+ break;
+
+ case Type::OtherTypes:
+ case Type::DataObjectType:
+ case Type::ChangeSummaryType:
+ default:
+ {
+ string msg("Cannot set Character on object of type:");
+ msg += getTypeImpl().getName();
+ throw SDOInvalidConversionException(TUSCANY_SDO_EINFO,
+ msg.c_str());
+ break;
+ }
+ }
+ return;
+ }
+
+ void DataObjectImpl::setString(const wchar_t* invalue, unsigned int len)
+ {
+ switch (getTypeEnum())
+ {
+ case Type::BigDecimalType:
+ case Type::BigIntegerType:
+ case Type::UriType:
+ case Type::StringType:
+ case Type::BytesType:
+ case Type::BooleanType:
+ case Type::CharacterType:
+ case Type::ByteType:
+ case Type::ShortType:
+ case Type::IntType:
+ case Type::LongType:
+ sdoValue = SDOValue(invalue, len);
+ break;
+
+ case Type::DoubleType:
+ case Type::FloatType:
+ case Type::DateType:
+ case Type::OtherTypes:
+ case Type::DataObjectType:
+ case Type::ChangeSummaryType:
+ default:
+ {
+ string msg("Cannot set String on object of type:");
+ msg += getTypeImpl().getName();
+ throw SDOInvalidConversionException(TUSCANY_SDO_EINFO,
+ msg.c_str());
+ break;
+ }
+ }
+ return;
+ }
+
+ void DataObjectImpl::setBytes(const char* invalue, unsigned int len)
+ {
+ switch (getTypeEnum())
+ {
+ case Type::BytesType:
+ case Type::BigDecimalType:
+ case Type::BigIntegerType:
+ case Type::UriType:
+ case Type::StringType:
+ case Type::BooleanType:
+ case Type::ByteType:
+ case Type::CharacterType:
+ case Type::IntType:
+ case Type::ShortType:
+ case Type::LongType:
+ sdoValue = SDOValue(invalue, len);
+ break;
+
+ case Type::DoubleType:
+ case Type::FloatType:
+ case Type::DateType:
+ case Type::OtherTypes:
+ case Type::DataObjectType:
+ case Type::ChangeSummaryType:
+ default:
+ {
+ string msg("Cannot set Bytes on object of type:");
+ msg += getTypeImpl().getName();
+ throw SDOInvalidConversionException(TUSCANY_SDO_EINFO,
+ msg.c_str());
+ return;
+ }
+ }
+ return;
+ }
+
+ void DataObjectImpl::setInt(long invalue)
+ {
+ switch (getTypeEnum())
+ {
+ case Type::BooleanType:
+ case Type::ByteType:
+ case Type::CharacterType:
+ case Type::IntType:
+ case Type::ShortType:
+ case Type::DoubleType:
+ case Type::FloatType:
+ case Type::LongType:
+ case Type::DateType:
+ case Type::BigDecimalType:
+ case Type::BigIntegerType:
+ case Type::StringType:
+ case Type::UriType:
+ case Type::BytesType:
+ sdoValue = SDOValue(invalue);
+ break;
+
+ case Type::OtherTypes:
+ case Type::DataObjectType:
+ case Type::ChangeSummaryType:
+ default:
+ {
+ string msg("Cannot set LongLong on object of type:");
+ msg += getTypeImpl().getName();
+ throw SDOInvalidConversionException(TUSCANY_SDO_EINFO,
+ msg.c_str());
+ break;
+ }
+ }
+ return;
+ }
+
+
+ void DataObjectImpl::setDouble(long double invalue)
+ {
+ switch (getTypeEnum())
+ {
+ case Type::BooleanType:
+ case Type::ByteType:
+ case Type::CharacterType:
+ case Type::IntType:
+ case Type::ShortType:
+ case Type::DoubleType:
+ case Type::FloatType:
+ case Type::LongType:
+ case Type::DateType:
+ sdoValue = SDOValue(invalue);
+ break;
+
+ case Type::BigDecimalType:
+ case Type::BigIntegerType:
+ case Type::StringType:
+ case Type::UriType:
+ case Type::BytesType:
+ case Type::OtherTypes:
+ case Type::DataObjectType:
+ case Type::ChangeSummaryType:
+ default:
+ {
+ string msg("Cannot set Long Double on object of type:");
+ msg += getTypeImpl().getName();
+ throw SDOInvalidConversionException(TUSCANY_SDO_EINFO,
+ msg.c_str());
+ break;
+ }
+ }
+ return;
+ }
+
+ void DataObjectImpl::setFloat(float invalue)
+ {
+ switch (getTypeEnum())
+ {
+ case Type::BooleanType:
+ case Type::ByteType:
+ case Type::CharacterType:
+ case Type::IntType:
+ case Type::ShortType:
+ case Type::DoubleType:
+ case Type::FloatType:
+ case Type::LongType:
+ case Type::DateType:
+ sdoValue = SDOValue(invalue);
+ break;
+
+ case Type::BigDecimalType:
+ case Type::BigIntegerType:
+ case Type::StringType:
+ case Type::UriType:
+ case Type::BytesType:
+ case Type::OtherTypes:
+ case Type::DataObjectType:
+ case Type::ChangeSummaryType:
+ default:
+ {
+ string msg("Cannot set Float on object of type:");
+ msg += getTypeImpl().getName();
+ throw SDOInvalidConversionException(TUSCANY_SDO_EINFO,
+ msg.c_str());
+ break;
+ }
+ break;
+ }
+ return;
+ }
+
+
+ void DataObjectImpl::setLong(int64_t invalue)
+ {
+ switch (getTypeEnum())
+ {
+ case Type::BooleanType:
+ case Type::ByteType:
+ case Type::CharacterType:
+ case Type::IntType:
+ case Type::ShortType:
+ case Type::DoubleType:
+ case Type::FloatType:
+ case Type::LongType:
+ case Type::DateType:
+ case Type::BigDecimalType:
+ case Type::BigIntegerType:
+ case Type::StringType:
+ case Type::UriType:
+ case Type::BytesType:
+ sdoValue = SDOValue(invalue);
+ break;
+
+ case Type::OtherTypes:
+ case Type::DataObjectType:
+ case Type::ChangeSummaryType:
+ default:
+ {
+ string msg("Cannot set Long on object of type:");
+ msg += getTypeImpl().getName();
+ throw SDOInvalidConversionException(TUSCANY_SDO_EINFO,
+ msg.c_str());
+ break;
+ }
+ }
+ return;
+ }
+
+
+ void DataObjectImpl::setShort(short invalue)
+ {
+ switch (getTypeEnum())
+ {
+ case Type::BooleanType:
+ case Type::ByteType:
+ case Type::CharacterType:
+ case Type::IntType:
+ case Type::ShortType:
+ case Type::DoubleType:
+ case Type::FloatType:
+ case Type::LongType:
+ case Type::DateType:
+ case Type::BigDecimalType:
+ case Type::BigIntegerType:
+ case Type::StringType:
+ case Type::UriType:
+ case Type::BytesType:
+ sdoValue = SDOValue(invalue);
+ break;
+
+ case Type::OtherTypes:
+ case Type::DataObjectType:
+ case Type::ChangeSummaryType:
+ default:
+ {
+ string msg("Cannot set short on object of type:");
+ msg += getTypeImpl().getName();
+ throw SDOInvalidConversionException(TUSCANY_SDO_EINFO,
+ msg.c_str());
+ break;
+ }
+ }
+ return;
+ }
+
+ void DataObjectImpl::setCString(const char* invalue)
+ {
+ setCString(SDOString(invalue));
+ }
+
+ void DataObjectImpl::setCString(const SDOString& invalue)
+ {
+ switch (getTypeEnum())
+ {
+ case Type::BooleanType:
+ case Type::ByteType:
+ case Type::CharacterType:
+ case Type::IntType:
+ case Type::ShortType:
+ case Type::DoubleType:
+ case Type::FloatType:
+ case Type::LongType:
+ case Type::DateType:
+ case Type::BigDecimalType:
+ case Type::BigIntegerType:
+ case Type::StringType:
+ case Type::UriType:
+ case Type::BytesType:
+ sdoValue = SDOValue(invalue);
+ break;
+
+ case Type::OtherTypes:
+ case Type::DataObjectType:
+ case Type::ChangeSummaryType:
+ default:
+ {
+ string msg("Cannot set CString on object of type:");
+ msg += getTypeImpl().getName();
+ throw SDOInvalidConversionException(TUSCANY_SDO_EINFO,
+ msg.c_str());
+ break;
+ }
+ }
+ return;
+ }
+
+ void DataObjectImpl::setDate(const SDODate invalue)
+ {
+ switch (getTypeEnum())
+ {
+ case Type::ByteType:
+ case Type::CharacterType:
+ case Type::IntType:
+ case Type::ShortType:
+ case Type::DoubleType:
+ case Type::FloatType:
+ case Type::LongType:
+ case Type::DateType:
+ case Type::BigDecimalType:
+ case Type::BigIntegerType:
+ case Type::StringType:
+ case Type::UriType:
+ case Type::BytesType:
+ sdoValue = SDOValue(invalue);
+ break;
+
+ case Type::OtherTypes:
+ case Type::BooleanType:
+ case Type::DataObjectType:
+ case Type::ChangeSummaryType:
+ default:
+ {
+ string msg("Cannot set LongLong on object of type:");
+ msg += getTypeImpl().getName();
+ throw SDOInvalidConversionException(TUSCANY_SDO_EINFO,
+ msg.c_str());
+ break;
+ }
+ }
+ return;
+ }
+
+ void DataObjectImpl::setDataObject(DataObject* inValue)
+ {
+ // If the sdoValue is unset, then there is no primitive value.
+ // If doValue is non-null then that is the data object value.
+ switch (getTypeImpl().getTypeEnum())
+ {
+ case Type::OtherTypes:
+ case Type::DataObjectType:
+ doValue = (DataObjectImpl*) inValue;
+ break;
+
+ case Type::BooleanType:
+ case Type::ByteType:
+ case Type::CharacterType:
+ case Type::IntType:
+ case Type::ShortType:
+ case Type::DoubleType:
+ case Type::FloatType:
+ case Type::LongType:
+ case Type::DateType:
+ case Type::BigDecimalType:
+ case Type::BigIntegerType:
+ case Type::StringType:
+ case Type::BytesType:
+ case Type::UriType:
+ default:
+ {
+ string msg("Cannot set Data Object for object of type:");
+ msg += getTypeImpl().getName();
+ throw SDOInvalidConversionException(TUSCANY_SDO_EINFO,
+ msg.c_str());
+ break;
+ }
+ }
+ return;
+ }
+
+ void DataObjectImpl::setNull()
+ {
+ isnull = true;
+ }
+
+ bool DataObjectImpl::isNull()
+ {
+ return isnull;
+ }
+
+ void DataObjectImpl::unsetNull()
+ {
+ isnull = false;
+ }
+
+
+ DataObjectImpl::DataObjectImpl(const TypeImpl& t) :
+ ObjectType((TypeImpl*) &t),
+ container(0),
+ doValue(0),
+ isnull(false),
+ userdata((void*) 0xFFFFFFFF)
+ {
+ // open type support
+ openBase = t.getPropertiesSize() ;
+
+ if (t.isChangeSummaryType())
+ {
+ localCS = new ChangeSummaryImpl();
+ }
+ else
+ {
+ localCS = 0;
+ }
+
+ if (getType().isSequencedType())
+ {
+ sequence = new SequenceImpl(this);
+ }
+ else
+ {
+ sequence = 0;
+ }
+ }
+
+
+ DataObjectImpl::DataObjectImpl(DataFactoryImplPtr df, const Type& t) :
+ ObjectType((TypeImpl*) &t),
+ factory(df),
+ container(0),
+ isnull(false),
+ userdata((void*) 0xFFFFFFFF)
+ {
+ // open type support
+ openBase = ObjectType->getPropertiesSize() ;
+
+
+ if (ObjectType->isChangeSummaryType())
+ {
+ localCS = new ChangeSummaryImpl();
+ }
+ else
+ {
+ localCS = 0;
+ }
+
+ if (getType().isSequencedType())
+ {
+ sequence = new SequenceImpl(this);
+ }
+ else
+ {
+ sequence = 0;
+ }
+ }
+
+
+ DataObjectImpl::~DataObjectImpl()
+ {
+ // We do not want to log changes to our own deletion
+ // if this DO owns the ChangeSummary. Do not delete
+ // it here as contained DOs still have a reference to it.
+
+ if (getTypeImpl().isChangeSummaryType())
+ {
+ ChangeSummaryPtr c = getChangeSummary();
+ if (c) {
+ if (c->isLogging())
+ {
+ c->endLogging();
+ }
+ }
+ }
+
+
+ clearReferences();
+ PropertyValueMap::iterator i = PropertyValues.begin();
+ while (i != PropertyValues.end())
+ {
+ unsigned int pindx = (*i).first;
+ DataObjectImplPtr dol = (*i).second;
+
+ unset(pindx);
+ i = PropertyValues.begin();
+ if (i != PropertyValues.end() && (*i).first == pindx && (*i).second == dol)
+ {
+ // unset has not removed the item from the list - do it
+ // here instead
+ PropertyValues.erase(i);
+ i = PropertyValues.begin();
+ }
+ }
+
+ // Theory: A DO cant get here if its still attached to anything,
+ //so we dont need to detach....
+ //detach();
+
+ if (sdoValue.isSet())
+ {
+ sdoValue = SDOValue::unsetSDOValue;
+ }
+ }
+
+ void DataObjectImpl::logCreation(DataObjectImpl* dol, DataObjectImpl* cont,
+ const Property& theprop)
+ {
+ if (getChangeSummaryImpl() != 0 && getChangeSummaryImpl()->isLogging())
+ {
+ getChangeSummaryImpl()->logCreation(dol,cont,theprop);
+ }
+ }
+
+ void DataObjectImpl::logDeletion()
+ {
+ // Only log if ChangeSummary is inherited from container
+
+ if (getChangeSummaryImpl() != 0 && getChangeSummaryImpl()->isLogging() && !getType().isChangeSummaryType())
+ {
+ DataObjectImpl* cont = getContainerImpl();
+ if (cont != 0) // log if there is a container. If there is not, then
+ // this can only be the object with the CS, so logging
+ // would not make sense.
+ {
+ const Property* p = cont->findInProperties(this);
+ if ( p != 0) // if the object is not in the properties, then its been
+ // detached, and has already been logged as deleted
+ {
+ getChangeSummaryImpl()->logDeletion(this,cont,*p,
+ objectToXPath(), true);
+ }
+ }
+ }
+ }
+
+ void DataObjectImpl::logChange(const Property& prop)
+ {
+ if (getChangeSummaryImpl() != 0 && getChangeSummaryImpl()->isLogging())
+ {
+ getChangeSummaryImpl()->logChange(this,prop);
+ }
+ }
+
+ void DataObjectImpl::logChange(unsigned int propIndex)
+ {
+ if (getChangeSummaryImpl() != 0 && getChangeSummaryImpl()->isLogging())
+ {
+ getChangeSummaryImpl()->logChange(this,getPropertyFromIndex(propIndex));
+ }
+ }
+ // reference support
+
+ void DataObjectImpl::setReference(DataObject* dol, const Property& prop)
+ {
+ LOGINFO_1(INFO,"ChangeSummary:Setting a reference to %s",prop.getName());
+
+ refs.push_back(new Reference(dol,prop));
+ }
+ void DataObjectImpl::unsetReference(DataObject* dol, const Property& prop)
+ {
+ LOGINFO_1(INFO,"ChangeSummary:Unsetting a reference to %s",prop.getName());
+
+ for (unsigned int i=0;i< refs.size();i++)
+ {
+ if (refs[i]->getDataObject() == dol)
+ {
+ if (!strcmp(refs[i]->getProperty().getName(),
+ prop.getName()))
+ {
+ delete refs[i];
+ refs.erase(refs.begin() + i);
+ }
+ }
+ }
+ }
+
+
+ void DataObjectImpl::clearReferences()
+ {
+ for (unsigned int i=0;i<refs.size();i++)
+ {
+ // Note - no loop as the referer must be of type reference
+ refs[i]->getDataObject()->unset(refs[i]->getProperty());
+ }
+ // separate loop because the unsets may modify the refs
+ for (unsigned int j=0;j<refs.size();j++)
+ {
+ delete refs[j];
+ }
+ refs.clear();
+ }
+
+ const char* DataObjectImpl::objectToXPath()
+ {
+ asXPathBuffer = "";
+
+ DataObjectImpl* dob = getContainerImpl();
+ DataObject*thisob = this;
+ while (dob != 0){
+ const Property& p = thisob->getContainmentProperty();
+ if (asXPathBuffer != "")
+ {
+ asXPathBuffer = "/" + asXPathBuffer;
+ }
+
+ if (p.isMany()) {
+ DataObjectList& dol = dob->getList(p);
+ for (unsigned int i=0;i<dol.size();i++)
+ {
+ if (dol[i] == thisob)
+ {
+ char index[64];
+ sprintf(index,"%d",i);
+ asXPathBuffer = index + asXPathBuffer;
+ asXPathBuffer = "." + asXPathBuffer;
+ break;
+ }
+ }
+ }
+ asXPathBuffer = p.getName() + asXPathBuffer;
+
+ thisob = dob;
+ dob = dob->getContainerImpl();
+ }
+
+ asXPathBuffer = "#/" + asXPathBuffer;
+
+ return asXPathBuffer.c_str();
+/*
+ char* temp1;
+ char* temp2;
+
+ if (asXPathBuffer == 0)
+ {
+ asXPathBuffer = new char[2];
+ sprintf(asXPathBuffer,"#");
+ }
+
+ DataObjectImpl* dob = getContainerImpl();
+ DataObject*thisob = this;
+ while (dob != 0){
+ const Property& p = thisob->getContainmentProperty();
+ const char* name = p.getName();
+ temp1 = new char[strlen(name) + 34];
+ temp1[0] = 0;
+
+
+ if (p.isMany()) {
+ DataObjectList& dol = dob->getList(p);
+ for (int i=0;i<dol.size();i++)
+ {
+ if (dol[i] == thisob)
+ {
+ sprintf(temp1,"#/%s.%d",name,i);
+ break;
+ }
+ }
+ }
+ else {
+ sprintf(temp1,"#/%s",name);
+ }
+ if (asXPathBuffer != 0) {
+ temp2 = new char[strlen(asXPathBuffer) + strlen(temp1) + 1];
+ sprintf(temp2,"%s%s", temp1, asXPathBuffer+1 );
+ delete asXPathBuffer;
+ }
+ else {
+ temp2 = new char[strlen(temp1) + 1];
+ sprintf(temp2,"%s", temp1);
+ }
+ delete temp1;
+ asXPathBuffer = temp2;
+ thisob = dob;
+ dob = dob->getContainerImpl();
+ }
+ return asXPathBuffer; */
+ }
+
+ // user data support...
+ void* DataObjectImpl::getUserData(const char* path)
+ {
+ // Can path really be a null pointer?
+ if (path == 0)
+ {
+ return(getUserData(SDOString()));
+ }
+ else
+ {
+ return(getUserData(SDOString(path)));
+ }
+ }
+
+ void* DataObjectImpl::getUserData(const SDOString& path)
+ {
+ DataObjectImpl *d;
+ void* v = 0;
+ SDOString spath;
+ SDOString prop;
+ try {
+ DataObjectImpl::stripPath(path, spath);
+ prop = findPropertyContainer(spath, &d);
+ if (d != 0)
+ {
+ if (!prop.empty())
+ {
+ PropertyPtr p = d->getInstanceProperty(prop);
+ if (!p) {
+ throwPropertyNotFound(TUSCANY_SDO_EINFO,
+ prop);
+ }
+ if (p->getType().isDataType()) return 0;
+ if (p->isMany())
+ {
+ DataObjectImpl* d2 = d->getDataObjectImpl(prop);
+ if (d2) v = d2->getUserData();
+ return v;
+ }
+ v = d->getUserData(*p);
+ return v;
+ }
+ return d->getUserData();
+ }
+ return 0;
+ }
+ catch (SDORuntimeException e)
+ {
+ return 0;
+ }
+ }
+
+ void* DataObjectImpl::getUserData(unsigned int propertyIndex)
+ {
+ if ((getPropertyFromIndex(propertyIndex).isMany()))
+ {
+ return 0;
+ }
+ if ((getPropertyFromIndex(propertyIndex).getType().isDataType()))
+ {
+ return 0;
+ }
+ DataObjectImpl* ptr = getDataObjectImpl(propertyIndex);
+ if (ptr) return ptr->getUserData();
+ return 0;
+ }
+
+ void* DataObjectImpl::getUserData(const Property& property)
+ {
+ if (property.isMany())
+ {
+ return 0;
+ }
+ if (property.getType().isDataType())
+ {
+ return 0;
+ }
+ DataObjectImpl* ptr = getDataObjectImpl(property);
+ if (ptr) return ptr->getUserData();
+ return 0;
+ }
+
+ void* DataObjectImpl::getUserData()
+ {
+ return userdata;
+ }
+
+ void DataObjectImpl::setUserData(const char* path, void* value)
+ {
+ // Can path really be a null pointer?
+ if (path == 0)
+ {
+ setUserData(SDOString(), value);
+ }
+ else
+ {
+ setUserData(SDOString(path), value);
+ }
+ }
+
+ void DataObjectImpl::setUserData(const SDOString& path, void* value)
+ {
+ SDOString spath;
+ SDOString prop;
+ DataObjectImpl *d;
+ try {
+ DataObjectImpl::stripPath(path, spath);
+ prop = findPropertyContainer(spath, &d);
+ if (d != 0)
+ {
+ if (!prop.empty())
+ {
+ PropertyPtr p = d->getInstanceProperty(prop);
+ if (!p) {
+ throwPropertyNotFound(TUSCANY_SDO_EINFO,
+ prop);
+ }
+ if (p->getType().isDataType())
+ return;
+ if (p->isMany())
+ {
+ DataObjectImpl* d2 = d->getDataObjectImpl(prop);
+ if (d2) d2->setUserData(value);
+ return;
+ }
+ d->setUserData(*p, value);
+ return;
+ }
+ d->setUserData(value);
+ return;
+ }
+ }
+ catch (SDORuntimeException e)
+ {
+ return;
+ }
+
+ }
+
+ void DataObjectImpl::setUserData(unsigned int propertyIndex, void* value)
+ {
+ if ((getPropertyFromIndex(propertyIndex).isMany()))
+ {
+ return;
+ }
+ if ((getPropertyFromIndex(propertyIndex).getType().isDataType()))
+ {
+ return;
+ }
+ DataObjectImpl* ptr = getDataObjectImpl(propertyIndex);
+ if (ptr) ptr->setUserData(value);
+ return;
+ }
+
+ void DataObjectImpl::setUserData(const Property& property, void* value)
+ {
+ if (property.isMany())
+ {
+ return;
+ }
+ if (property.getType().isDataType())
+ {
+ return;
+ }
+ DataObjectImpl* ptr = getDataObjectImpl(property);
+ if (ptr) ptr->setUserData(value);
+ return;
+ }
+
+ void DataObjectImpl::setUserData(void* value)
+ {
+ userdata = value;
+ }
+
+ std::ostream& DataObjectImpl::printSelf(std::ostream &os)
+ {
+ SDOUtils::printDataObject(os, this);
+ return os;
+ }
+
+ // +++
+ // Extra methods to support SDOValue as an internal mechanism that
+ // simplifies dealing with the many interchangeable primitive data types.
+
+ // set methods.
+
+ void DataObjectImpl::setSDOValue(const SDOString& path,
+ const SDOValue& sval,
+ const SDOString& dataType)
+ {
+ DataObjectImpl *d = 0;
+
+ SDOString spath;
+ SDOString prop;
+ DataObjectImpl::stripPath(path, spath);
+ prop = findPropertyContainer(spath, &d);
+
+ if (d != 0)
+ {
+ if (prop.length() == 0)
+ {
+ d->setSDOValue(sval);
+ }
+ else
+ {
+ const PropertyImpl* p = d->getPropertyImpl(prop);
+ if ((p == 0) && (d->getType().isOpenType()))
+ {
+ // p = d->defineBytes(prop);
+ p = d->defineSDOValue(prop, sval);
+ }
+
+ if (p == 0)
+ {
+ string msg("DataObjectImpl::setSDOValue - path not found: ");
+ throw SDOPathNotFoundException(TUSCANY_SDO_EINFO,
+ msg.c_str());
+ }
+
+ if (p->isReadOnly())
+ {
+ SDOString stringBuffer = p->getName();
+ stringBuffer += " is read-only.";
+ throw SDOUnsupportedOperationException(TUSCANY_SDO_EINFO,
+ stringBuffer.c_str());
+ }
+
+ if ((p->isMany()) || (p->getTypeImpl()->isFromList()))
+ {
+ DataObjectList& dol = d->getList((Property&) *p);
+ PathToken pathToken;
+ getPathToken(prop, pathToken);
+ DataObjectImpl* doi = d->findDataObject(pathToken);
+ if (doi != 0)
+ {
+ doi->setSDOValue(sval);
+ }
+ else
+ {
+ dol.append(sval);
+ }
+ }
+ else
+ {
+ d->setSDOValue((Property&)*p, sval, dataType);
+ }
+ }
+ }
+ }
+
+ void DataObjectImpl::setSDOValue(unsigned int propertyIndex,
+ const SDOValue& sval,
+ const SDOString& dataType)
+ {
+ setSDOValue(propertyIndex, sval, dataType, false);
+ }
+
+ void DataObjectImpl::setSDOValue(unsigned int propertyIndex,
+ const SDOValue& sval,
+ const SDOString& dataType,
+ bool updateSequence)
+ {
+ validateIndex(propertyIndex);
+
+ PropertyImpl *const p = getPropertyImpl(propertyIndex);
+
+ if ((p->isMany()) || (p->getTypeImpl()->isFromList()))
+ {
+ string msg("Set value not available on many valued property: ");
+ msg += p->getName();
+ throw SDOUnsupportedOperationException(TUSCANY_SDO_EINFO,
+ msg.c_str());
+ }
+
+ if (p->isReadOnly())
+ {
+ SDOString stringBuffer = p->getName();
+ stringBuffer += "is read-only.";
+ throw SDOUnsupportedOperationException(TUSCANY_SDO_EINFO,
+ stringBuffer.c_str());
+ }
+
+ // PropertyValues is a std::list of rdo objects.
+ PropertyValueMap::iterator i;
+ for (i = PropertyValues.begin(); i != PropertyValues.end(); ++i)
+ {
+ if ((*i).first == propertyIndex)
+ {
+ logChange(propertyIndex);
+ (*i).second->unsetNull();
+ (*i).second->setSDOValue(sval);
+
+ // If this is a sequenced data object then update the sequence. We
+ // already know that a) the property is already set and b) it
+ // is not a multi-valued property.
+ if ((getType().isSequencedType()) && updateSequence)
+ {
+ sequence->removeAll(getPropertyFromIndex(propertyIndex));
+ sequence->push(getPropertyFromIndex(propertyIndex), 0);
+ }
+ return;
+ }
+ }
+
+ // No existing property has the given index.
+ // It is tempting to use the raw data type from the SDOValue object to
+ // set the type of the created DataObjectImpl but we can't because the
+ // SDOValue specifies a C++ type while we need an SDO type.
+ DataObjectImpl* b =
+ new DataObjectImpl(factory, factory->getType(SDOUtils::sdoURI, dataType.c_str()));
+ b->setContainer(this);
+ logChange(propertyIndex);
+ PropertyValues.push_back(rdo(propertyIndex, b));
+ b->setSDOValue(sval);
+
+ // If this is a sequenced data object then update the sequence. We
+ // already know that a) the property is not already set and b) it
+ // is not a multi-valued property.
+ if ((getType().isSequencedType()) && updateSequence)
+ {
+ sequence->removeAll(getPropertyFromIndex(propertyIndex));
+ sequence->push(getPropertyFromIndex(propertyIndex), 0);
+ }
+
+ return;
+ }
+
+ void DataObjectImpl::setSDOValue(const Property& property,
+ const SDOValue& sval,
+ const SDOString& dataType)
+ {
+ setSDOValue(getPropertyIndexInternal(property), sval, dataType);
+ }
+
+ void DataObjectImpl::setSDOValue(const Property& property,
+ const SDOValue& sval,
+ const SDOString& dataType,
+ bool updateSequence)
+ {
+ setSDOValue(getPropertyIndexInternal(property), sval, dataType, updateSequence);
+ }
+
+ void DataObjectImpl::setSDOValue(const SDOValue& invalue)
+ {
+ sdoValue = invalue;
+ return;
+ }
+
+ // get methods
+
+ const SDOValue& DataObjectImpl::getSDOValue(const SDOString& path,
+ PropertyImpl** propertyForDefault)
+ {
+ *propertyForDefault = 0;
+
+ DataObjectImpl* d = 0;
+ SDOString spath;
+ SDOString prop;
+ DataObjectImpl::stripPath(path, spath);
+ // It is possible for findPropertyContainer to return a 0 which caues an accvio.
+ prop = findPropertyContainer(spath, &d);
+ if (d != 0)
+ {
+ if (prop.length() == 0)
+ {
+ return d->getSDOValue(propertyForDefault);
+ }
+ else
+ {
+ PropertyImpl* p = d->getPropertyImpl(prop);
+ if (p != 0)
+ {
+ if ((p->isMany()) || p->getTypeImpl()->isFromList())
+ {
+ PathToken pathToken;
+ getPathToken(prop, pathToken);
+ DataObjectImpl* doi = d->findDataObject(pathToken);
+ if (doi != 0)
+ {
+ return doi->getSDOValue(propertyForDefault);
+ }
+ string msg("DataObjectImpl::getSDOValue - index out of range");
+ msg += path;
+ throw SDOIndexOutOfRangeException(TUSCANY_SDO_EINFO,
+ msg.c_str());
+ }
+ else
+ {
+ if (!d->isSet(*p))
+ {
+ *propertyForDefault = p;
+ return SDOValue::unsetSDOValue;
+ }
+ return d->getSDOValue(*p, propertyForDefault);
+ }
+ }
+ }
+ }
+ string msg("Object not found");
+ throw SDOPathNotFoundException(TUSCANY_SDO_EINFO,
+ msg.c_str());
+ }
+
+ const SDOValue& DataObjectImpl::getSDOValue(const unsigned int propertyIndex,
+ PropertyImpl** propertyForDefault)
+ {
+ *propertyForDefault = 0;
+
+ validateIndex(propertyIndex);
+
+ // Since validateIndex didn't throw an exception, the following call
+ // will not return a null pointer.
+ PropertyImpl* targetProperty = getPropertyImpl(propertyIndex);
+ if ((targetProperty->isMany()) ||
+ targetProperty->getTypeImpl()->isFromList())
+ {
+ string msg("Get value not available on many valued property:");
+ msg += targetProperty->getName();
+ throw SDOUnsupportedOperationException(TUSCANY_SDO_EINFO,
+ msg.c_str());
+ }
+
+ DataObjectImpl* d = getDataObjectImpl(propertyIndex);
+ if (d != 0)
+ {
+ if (!d->isNull())
+ {
+ return d->getSDOValue(propertyForDefault);
+ }
+ else
+ {
+ return SDOValue::nullSDOValue;
+ }
+ }
+
+ // To get here, the property does not have a value, but there are still 2
+ // cases to consider:
+ // 1. The property has never had a value. In this case, we return
+ // "unset" for the value of the property.
+ // 2. The property did have a value at one time but since then has
+ // been explicitly set to null, causing the value to be discarded. In
+ // that case return an explicit null.
+
+ if (isSet(propertyIndex))
+ {
+ return SDOValue::nullSDOValue;
+ }
+
+ *propertyForDefault = targetProperty;
+ return SDOValue::unsetSDOValue;
+
+ }
+
+ const SDOValue& DataObjectImpl::getSDOValue(const Property& property,
+ PropertyImpl** propertyForDefault)
+ {
+ return getSDOValue(getPropertyIndex(property), propertyForDefault);
+ }
+
+ const SDOValue& DataObjectImpl::getSDOValue(PropertyImpl** propertyForDefault)
+ {
+ if (sdoValue.isSet())
+ {
+ *propertyForDefault = 0;
+ }
+ else
+ {
+ *propertyForDefault = (PropertyImpl*) &(getContainmentProperty());
+ }
+ return sdoValue;
+ }
+
+ // End of SDOValue methods
+ // ---
+
+ // +++
+ // setBoolean using SDOValue methods
+
+ void DataObjectImpl::setBoolean(unsigned int propertyIndex,
+ bool value)
+ {
+ setSDOValue(propertyIndex, SDOValue(value), "Boolean");
+ }
+
+ void DataObjectImpl::setBoolean(const Property& property, bool value)
+ {
+ setBoolean(getPropertyIndexInternal(property), value);
+ }
+
+ void DataObjectImpl::setBoolean(const SDOString& path,
+ bool value)
+ {
+ setSDOValue(path, SDOValue(value), "Boolean");
+ }
+
+ // End of setBoolean using SDOValue methods
+ // ---
+
+ // +++
+ // getBoolean using SDOValue methods
+
+ bool DataObjectImpl::getBoolean(const Property& property)
+ {
+ return getBoolean(getPropertyIndex(property));
+ }
+
+ bool DataObjectImpl::getBoolean(unsigned int propertyIndex)
+ {
+
+ PropertyImpl* propertyForDefault = 0;
+ const SDOValue& result = getSDOValue(propertyIndex, &propertyForDefault);
+
+ if (!result.isSet())
+ {
+ return propertyForDefault->getBooleanDefault();
+ }
+ else
+ {
+ if (result.isNull())
+ {
+ return false;
+ }
+ else
+ {
+ return result.getBoolean();
+ }
+ }
+ }
+
+ bool DataObjectImpl::getBoolean(const SDOString& path)
+ {
+ PropertyImpl* propertyForDefault = 0;
+ const SDOValue& result = getSDOValue(path, &propertyForDefault);
+
+ if (!result.isSet())
+ {
+ return propertyForDefault->getBooleanDefault();
+ }
+ else
+ {
+ if (result.isNull())
+ {
+ return false;
+ }
+ else
+ {
+ return result.getBoolean();
+ }
+ }
+ }
+
+ // End of getBoolean using SDOValue methods
+ // ---
+
+ // +++
+ // setFloat using SDOValue methods
+
+ void DataObjectImpl::setFloat(unsigned int propertyIndex,
+ float value)
+ {
+ setSDOValue(propertyIndex, SDOValue(value), "Float");
+ }
+
+ void DataObjectImpl::setFloat(const Property& property, float value)
+ {
+ setFloat(getPropertyIndexInternal(property), value);
+ }
+
+ void DataObjectImpl::setFloat(const SDOString& path,
+ float value)
+ {
+ setSDOValue(path, SDOValue(value), "Float");
+ }
+
+ // End of setFloat using SDOValue methods
+ // ---
+
+ // +++
+ // getFloat using SDOValue methods
+
+ float DataObjectImpl::getFloat(const Property& property)
+ {
+ return getFloat(getPropertyIndex(property));
+ }
+
+ float DataObjectImpl::getFloat(unsigned int propertyIndex)
+ {
+
+ PropertyImpl* propertyForDefault = 0;
+ const SDOValue& result = getSDOValue(propertyIndex, &propertyForDefault);
+
+ if (!result.isSet())
+ {
+ return propertyForDefault->getFloatDefault();
+ }
+ else
+ {
+ if (result.isNull())
+ {
+ return 0.0F; // Default is 0 cast to return type
+ }
+ else
+ {
+ return result.getFloat();
+ }
+ }
+ }
+
+ float DataObjectImpl::getFloat(const SDOString& path)
+ {
+ PropertyImpl* propertyForDefault = 0;
+ const SDOValue& result = getSDOValue(path, &propertyForDefault);
+
+ if (!result.isSet())
+ {
+ return propertyForDefault->getFloatDefault();
+ }
+ else
+ {
+ if (result.isNull())
+ {
+ return 0.0F; // Default is 0 cast to return type
+ }
+ else
+ {
+ return result.getFloat();
+ }
+ }
+ }
+
+ // End of getFloat using SDOValue methods
+ // ---
+
+ // +++
+ // setDouble using SDOValue methods
+
+ void DataObjectImpl::setDouble(unsigned int propertyIndex,
+ long double value)
+ {
+ setSDOValue(propertyIndex, SDOValue(value), "Double");
+ }
+
+ void DataObjectImpl::setDouble(const Property& property, long double value)
+ {
+ setDouble(getPropertyIndexInternal(property), value);
+ }
+
+ void DataObjectImpl::setDouble(const SDOString& path,
+ long double value)
+ {
+ setSDOValue(path, SDOValue(value), "Double");
+ }
+
+ // End of setDouble using SDOValue methods
+ // ---
+
+ // +++
+ // getDouble using SDOValue methods
+
+ long double DataObjectImpl::getDouble(const Property& property)
+ {
+ return getDouble(getPropertyIndex(property));
+ }
+
+ long double DataObjectImpl::getDouble(unsigned int propertyIndex)
+ {
+
+ PropertyImpl* propertyForDefault = 0;
+ const SDOValue& result = getSDOValue(propertyIndex, &propertyForDefault);
+
+ if (!result.isSet())
+ {
+ return propertyForDefault->getDoubleDefault();
+ }
+ else
+ {
+ if (result.isNull())
+ {
+ return 0.0; // Default is 0 cast to return type
+ }
+ else
+ {
+ return result.getDouble();
+ }
+ }
+ }
+
+ long double DataObjectImpl::getDouble(const SDOString& path)
+ {
+ PropertyImpl* propertyForDefault = 0;
+ const SDOValue& result = getSDOValue(path, &propertyForDefault);
+
+ if (!result.isSet())
+ {
+ return propertyForDefault->getDoubleDefault();
+ }
+ else
+ {
+ if (result.isNull())
+ {
+ return 0.0; // Default is 0 cast to return type
+ }
+ else
+ {
+ return result.getDouble();
+ }
+ }
+ }
+
+ // End of getDouble using SDOValue methods
+ // ---
+
+ // +++
+ // setShort using SDOValue methods
+
+ void DataObjectImpl::setShort(unsigned int propertyIndex,
+ short value)
+ {
+ setSDOValue(propertyIndex, SDOValue(value), "Short");
+ }
+
+ void DataObjectImpl::setShort(const Property& property, short value)
+ {
+ setShort(getPropertyIndexInternal(property), value);
+ }
+
+ void DataObjectImpl::setShort(const SDOString& path,
+ short value)
+ {
+ setSDOValue(path, SDOValue(value), "Short");
+ }
+
+ // End of setShort using SDOValue methods
+ // ---
+
+ // +++
+ // getShort using SDOValue methods
+
+ short DataObjectImpl::getShort(const Property& property)
+ {
+ return getShort(getPropertyIndex(property));
+ }
+
+ short DataObjectImpl::getShort(unsigned int propertyIndex)
+ {
+
+ PropertyImpl* propertyForDefault = 0;
+ const SDOValue& result = getSDOValue(propertyIndex, &propertyForDefault);
+
+ if (!result.isSet())
+ {
+ return propertyForDefault->getShortDefault();
+ }
+ else
+ {
+ if (result.isNull())
+ {
+ return 0; // Default is 0 cast to return type
+ }
+ else
+ {
+ return result.getShort();
+ }
+ }
+ }
+
+ short DataObjectImpl::getShort(const SDOString& path)
+ {
+ PropertyImpl* propertyForDefault = 0;
+ const SDOValue& result = getSDOValue(path, &propertyForDefault);
+
+ if (!result.isSet())
+ {
+ return propertyForDefault->getShortDefault();
+ }
+ else
+ {
+ if (result.isNull())
+ {
+ return 0; // Default is 0 cast to return type
+ }
+ else
+ {
+ return result.getShort();
+ }
+ }
+ }
+
+ // End of getShort using SDOValue methods
+ // ---
+
+ // +++
+ // setByte using SDOValue methods
+
+ void DataObjectImpl::setByte(unsigned int propertyIndex,
+ char value)
+ {
+ setSDOValue(propertyIndex, SDOValue(value), "Byte");
+ }
+
+ void DataObjectImpl::setByte(const Property& property, char value)
+ {
+ setByte(getPropertyIndexInternal(property), value);
+ }
+
+ void DataObjectImpl::setByte(const SDOString& path,
+ char value)
+ {
+ setSDOValue(path, SDOValue(value), "Byte");
+ }
+
+ // End of setByte using SDOValue methods
+ // ---
+
+ // +++
+ // getByte using SDOValue methods
+
+ char DataObjectImpl::getByte(const Property& property)
+ {
+ return getByte(getPropertyIndex(property));
+ }
+
+ char DataObjectImpl::getByte(unsigned int propertyIndex)
+ {
+
+ PropertyImpl* propertyForDefault = 0;
+ const SDOValue& result = getSDOValue(propertyIndex, &propertyForDefault);
+
+ if (!result.isSet())
+ {
+ return propertyForDefault->getByteDefault();
+ }
+ else
+ {
+ if (result.isNull())
+ {
+ return 0; // Default is 0 cast to return type
+ }
+ else
+ {
+ return result.getByte();
+ }
+ }
+ }
+
+ char DataObjectImpl::getByte(const SDOString& path)
+ {
+ PropertyImpl* propertyForDefault = 0;
+ const SDOValue& result = getSDOValue(path, &propertyForDefault);
+
+ if (!result.isSet())
+ {
+ return propertyForDefault->getByteDefault();
+ }
+ else
+ {
+ if (result.isNull())
+ {
+ return 0; // Default is 0 cast to return type
+ }
+ else
+ {
+ return result.getByte();
+ }
+ }
+ }
+
+ // End of getByte using SDOValue methods
+ // ---
+
+ // +++
+ // setDate using SDOValue methods
+
+ void DataObjectImpl::setDate(unsigned int propertyIndex,
+ const SDODate value)
+ {
+ setSDOValue(propertyIndex, SDOValue(value), "Date");
+ }
+
+ void DataObjectImpl::setDate(const Property& property, const SDODate value)
+ {
+ setDate(getPropertyIndexInternal(property), value);
+ }
+
+ void DataObjectImpl::setDate(const SDOString& path,
+ const SDODate value)
+ {
+ setSDOValue(path, SDOValue(value), "Date");
+ }
+
+ // End of setDouble using SDOValue methods
+ // ---
+
+ // +++
+ // getDate using SDOValue methods
+
+ const SDODate DataObjectImpl::getDate(const Property& property)
+ {
+ return getDate(getPropertyIndex(property));
+ }
+
+ const SDODate DataObjectImpl::getDate(unsigned int propertyIndex)
+ {
+
+ PropertyImpl* propertyForDefault = 0;
+ const SDOValue& result = getSDOValue(propertyIndex, &propertyForDefault);
+
+ if (!result.isSet())
+ {
+ return propertyForDefault->getDateDefault();
+ }
+ else
+ {
+ if (result.isNull())
+ {
+ return SDODate(0); // Default is 0 cast to return type
+ }
+ else
+ {
+ return result.getDate();
+ }
+ }
+ }
+
+ const SDODate DataObjectImpl::getDate(const SDOString& path)
+ {
+ PropertyImpl* propertyForDefault = 0;
+ const SDOValue& result = getSDOValue(path, &propertyForDefault);
+
+ if (!result.isSet())
+ {
+ return propertyForDefault->getDateDefault();
+ }
+ else
+ {
+ if (result.isNull())
+ {
+ return SDODate(0); // Default is 0 cast to return type
+ }
+ else
+ {
+ return result.getDate();
+ }
+ }
+ }
+
+ // End of getDouble using SDOValue methods
+ // ---
+
+ // +++
+ // setInt using SDOValue methods
+
+ void DataObjectImpl::setInt(unsigned int propertyIndex,
+ long value)
+ {
+ setSDOValue(propertyIndex, SDOValue(value), "Int");
+ }
+
+ void DataObjectImpl::setInt(const Property& property, long value)
+ {
+ setInt(getPropertyIndexInternal(property), value);
+ }
+
+ void DataObjectImpl::setInt(const SDOString& path,
+ long value)
+ {
+ setSDOValue(path, SDOValue(value), "Int");
+ }
+
+ // End of setInt using SDOValue methods
+ // ---
+
+ // +++
+ // getInt using SDOValue methods
+
+ long DataObjectImpl::getInt(const Property& property)
+ {
+ return getInt(getPropertyIndex(property));
+ }
+
+ long DataObjectImpl::getInt(unsigned int propertyIndex)
+ {
+
+ PropertyImpl* propertyForDefault = 0;
+ const SDOValue& result = getSDOValue(propertyIndex, &propertyForDefault);
+
+ if (!result.isSet())
+ {
+ return propertyForDefault->getIntDefault();
+ }
+ else
+ {
+ if (result.isNull())
+ {
+ return 0; // Default is 0 cast to return type
+ }
+ else
+ {
+ return result.getInt();
+ }
+ }
+ }
+
+ long DataObjectImpl::getInt(const SDOString& path)
+ {
+ PropertyImpl* propertyForDefault = 0;
+ const SDOValue& result = getSDOValue(path, &propertyForDefault);
+
+ if (!result.isSet())
+ {
+ return propertyForDefault->getIntDefault();
+ }
+ else
+ {
+ if (result.isNull())
+ {
+ return 0; // Default is 0 cast to return type
+ }
+ else
+ {
+ return result.getInt();
+ }
+ }
+ }
+
+ // End of getInt using SDOValue methods
+ // ---
+
+ // +++
+ // setCString using SDOValue methods
+
+ void DataObjectImpl::setCString(unsigned int propertyIndex,
+ const SDOString& value)
+ {
+ setSDOValue(propertyIndex, SDOValue(value), "String");
+ }
+
+ void DataObjectImpl::setCString(const Property& property, const SDOString& value)
+ {
+ setCString(getPropertyIndexInternal(property), value);
+ }
+
+ void DataObjectImpl::setCString(const SDOString& path,
+ const SDOString& value)
+ {
+ setSDOValue(path, SDOValue(value), "String");
+ }
+
+ // End of setCString using SDOValue methods
+ // ---
+
+ // +++
+ // getCString using SDOValue methods
+
+ const char* DataObjectImpl::getCString(const Property& property)
+ {
+ return getCString(getPropertyIndex(property));
+ }
+
+ const char* DataObjectImpl::getCString(unsigned int propertyIndex)
+ {
+
+ PropertyImpl* propertyForDefault = 0;
+ const SDOValue& result = getSDOValue(propertyIndex, &propertyForDefault);
+
+ if (!result.isSet())
+ {
+ return propertyForDefault->getCStringDefault();
+ }
+ else
+ {
+ if (result.isNull())
+ {
+ return 0; // Default is 0 cast to return type
+ }
+ else
+ {
+ return result.getCString();
+ }
+ }
+ }
+
+ const char* DataObjectImpl::getCString(const SDOString& path)
+ {
+ PropertyImpl* propertyForDefault = 0;
+ const SDOValue& result = getSDOValue(path, &propertyForDefault);
+
+ if (!result.isSet())
+ {
+ return propertyForDefault->getCStringDefault();
+ }
+ else
+ {
+ if (result.isNull())
+ {
+ return 0; // Default is 0 cast to return type
+ }
+ else
+ {
+ return result.getCString();
+ }
+ }
+ }
+
+ // End of getCString using SDOValue methods
+ // ---
+
+ // +++
+ // setCharacter using SDOValue methods
+
+ void DataObjectImpl::setCharacter(unsigned int propertyIndex,
+ wchar_t value)
+ {
+ setSDOValue(propertyIndex, SDOValue(value), "Character");
+ }
+
+ void DataObjectImpl::setCharacter(const Property& property, wchar_t value)
+ {
+ setCharacter(getPropertyIndexInternal(property), value);
+ }
+
+ void DataObjectImpl::setCharacter(const SDOString& path,
+ wchar_t value)
+ {
+ setSDOValue(path, SDOValue(value), "Character");
+ }
+
+ // End of setByte using SDOValue methods
+ // ---
+
+ // +++
+ // getByte using SDOValue methods
+
+ wchar_t DataObjectImpl::getCharacter(const Property& property)
+ {
+ return getCharacter(getPropertyIndex(property));
+ }
+
+ wchar_t DataObjectImpl::getCharacter(unsigned int propertyIndex)
+ {
+
+ PropertyImpl* propertyForDefault = 0;
+ const SDOValue& result = getSDOValue(propertyIndex, &propertyForDefault);
+
+ if (!result.isSet())
+ {
+ return propertyForDefault->getCharacterDefault();
+ }
+ else
+ {
+ if (result.isNull())
+ {
+ return (wchar_t) 0; // Default is 0 cast to return type
+ }
+ else
+ {
+ return result.getCharacter();
+ }
+ }
+ }
+
+ wchar_t DataObjectImpl::getCharacter(const SDOString& path)
+ {
+ PropertyImpl* propertyForDefault = 0;
+ const SDOValue& result = getSDOValue(path, &propertyForDefault);
+
+ if (!result.isSet())
+ {
+ return propertyForDefault->getCharacterDefault();
+ }
+ else
+ {
+ if (result.isNull())
+ {
+ return (wchar_t) 0; // Default is 0 cast to return type
+ }
+ else
+ {
+ return result.getCharacter();
+ }
+ }
+ }
+
+ // End of getCharacter using SDOValue methods
+ // ---
+
+ // +++
+ // setLong using SDOValue methods
+
+ void DataObjectImpl::setLong(unsigned int propertyIndex,
+ int64_t value)
+ {
+ setSDOValue(propertyIndex, SDOValue(value), "Long");
+ }
+
+ void DataObjectImpl::setLong(const Property& property, int64_t value)
+ {
+ setLong(getPropertyIndexInternal(property), value);
+ }
+
+ void DataObjectImpl::setLong(const SDOString& path,
+ int64_t value)
+ {
+ setSDOValue(path, SDOValue(value), "Long");
+ }
+
+ // End of setLong using SDOValue methods
+ // ---
+
+ // +++
+ // getLong using SDOValue methods
+
+ int64_t DataObjectImpl::getLong(const Property& property)
+ {
+ return getLong(getPropertyIndex(property));
+ }
+
+ int64_t DataObjectImpl::getLong(unsigned int propertyIndex)
+ {
+
+ PropertyImpl* propertyForDefault = 0;
+ const SDOValue& result = getSDOValue(propertyIndex, &propertyForDefault);
+
+ if (!result.isSet())
+ {
+ return propertyForDefault->getLongDefault();
+ }
+ else
+ {
+ if (result.isNull())
+ {
+ return 0L; // Default is 0 cast to return type
+ }
+ else
+ {
+ return result.getLong();
+ }
+ }
+ }
+
+ int64_t DataObjectImpl::getLong(const SDOString& path)
+ {
+ PropertyImpl* propertyForDefault = 0;
+ const SDOValue& result = getSDOValue(path, &propertyForDefault);
+
+ if (!result.isSet())
+ {
+ return propertyForDefault->getLongDefault();
+ }
+ else
+ {
+ if (result.isNull())
+ {
+ return 0; // Default is 0 cast to return type
+ }
+ else
+ {
+ return result.getLong();
+ }
+ }
+ }
+
+ // End of getLong using SDOValue methods
+ // ---
+
+ // The input value is a non-null terminated sequence of bytes.
+ void DataObjectImpl::setBytes(unsigned int propertyIndex, const char* value, unsigned int len)
+ {
+ setSDOValue(propertyIndex, SDOValue(value, len), "Bytes");
+ }
+
+ void DataObjectImpl::setString(unsigned int propertyIndex, const wchar_t* value, unsigned int len)
+ {
+ setSDOValue(propertyIndex, SDOValue(value, len), "String");
+ }
+
+ unsigned int DataObjectImpl::getBytes(unsigned int propertyIndex, char* valptr , unsigned int max)
+ {
+
+ PropertyImpl* propertyForDefault = 0;
+ const SDOValue& result = getSDOValue(propertyIndex, &propertyForDefault);
+
+ if (!result.isSet())
+ {
+ return propertyForDefault->getBytesDefault(valptr, max);
+ }
+ else
+ {
+ if (result.isNull())
+ {
+ return 0;
+ }
+ else
+ {
+ return result.getBytes(valptr, max);
+ }
+ }
+ }
+
+ unsigned int DataObjectImpl::getString(unsigned int propertyIndex, wchar_t* valptr , unsigned int max)
+ {
+
+ PropertyImpl* propertyForDefault = 0;
+ const SDOValue& result = getSDOValue(propertyIndex, &propertyForDefault);
+
+ if (!result.isSet())
+ {
+ return propertyForDefault->getStringDefault(valptr, max);
+ }
+ else
+ {
+ if (result.isNull())
+ {
+ return 0;
+ }
+ else
+ {
+ return result.getString(valptr, max);
+ }
+ }
+ }
+
+ unsigned int DataObjectImpl::getString(const SDOString& path, wchar_t* valptr , unsigned int max)
+ {
+
+ PropertyImpl* propertyForDefault = 0;
+ const SDOValue& result = getSDOValue(path, &propertyForDefault);
+
+ if (!result.isSet())
+ {
+ return propertyForDefault->getStringDefault(valptr, max);
+ }
+ else
+ {
+ if (result.isNull())
+ {
+ return 0;
+ }
+ else
+ {
+ return result.getString(valptr, max);
+ }
+ }
+ }
+
+ unsigned int DataObjectImpl::getBytes(const SDOString& path, char* valptr , unsigned int max)
+ {
+ PropertyImpl* propertyForDefault = 0;
+ const SDOValue& result = getSDOValue(path, &propertyForDefault);
+
+ if (!result.isSet())
+ {
+ return propertyForDefault->getBytesDefault(valptr, max);
+ }
+ else
+ {
+ if (result.isNull())
+ {
+ return 0; // Default is 0 cast to return type
+ }
+ else
+ {
+ return result.getBytes(valptr, max);
+ }
+ }
+ }
+
+ void DataObjectImpl::setString(const char* path, const wchar_t* value, unsigned int len)
+ {
+ setString(SDOString(path), value, len);
+ }
+
+ void DataObjectImpl::setBytes(const char* path, const char* value, unsigned int len)
+ {
+ setBytes(SDOString(path), value, len);
+ }
+
+ void DataObjectImpl::setString(const SDOString& path, const wchar_t* value, unsigned int len)
+ {
+ setSDOValue(path, SDOValue(value, len), "String");
+ }
+
+
+ void DataObjectImpl::setBytes(const SDOString& path, const char* value, unsigned int len)
+ {
+ setSDOValue(path, SDOValue(value, len), "Bytes");
+ }
+
+ unsigned int DataObjectImpl::getString(const Property& property, wchar_t* val, unsigned int max)
+ {
+ return getString(getPropertyIndex(property), val, max);
+ }
+
+ unsigned int DataObjectImpl::getBytes(const Property& property, char* val, unsigned int max)
+ {
+ return getBytes(getPropertyIndex(property), val, max);
+ }
+
+ void DataObjectImpl::setString(const Property& property, const wchar_t* value, unsigned int len)
+ {
+ setString(getPropertyIndexInternal(property),value, len);
+ }
+
+ void DataObjectImpl::setBytes(const Property& property, const char* value, unsigned int len)
+ {
+ setBytes(getPropertyIndexInternal(property),value, len);
+ }
+
+};
+};
diff --git a/sdo-cpp/trunk/runtime/core/src/commonj/sdo/DataObjectImpl.h b/sdo-cpp/trunk/runtime/core/src/commonj/sdo/DataObjectImpl.h
new file mode 100644
index 0000000000..9f61a86129
--- /dev/null
+++ b/sdo-cpp/trunk/runtime/core/src/commonj/sdo/DataObjectImpl.h
@@ -0,0 +1,724 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you 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$ */
+
+#ifndef _DATAOBJECTIMPL_H_
+#define _DATAOBJECTIMPL_H_
+#include "commonj/sdo/DataObject.h"
+
+#include "commonj/sdo/disable_warn.h"
+
+#include <ctime>
+#include <list>
+#include <map>
+
+#include <string>
+
+
+#include "commonj/sdo/Property.h"
+#include "commonj/sdo/TypeImpl.h"
+#include "commonj/sdo/DataFactory.h"
+#include "commonj/sdo/SequenceImpl.h"
+#include "commonj/sdo/DataObjectListImpl.h"
+#include "commonj/sdo/PropertyList.h"
+
+#include "commonj/sdo/RefCountingPointer.h"
+#include "commonj/sdo/ChangeSummaryImpl.h"
+#include "commonj/sdo/SDODate.h"
+#include "commonj/sdo/SDOValue.h"
+
+namespace commonj{
+namespace sdo{
+
+class DataGraph;
+class DataObjectImpl;
+class DataObjectListImpl;
+class DataFactory;
+
+
+#define DataObjectImplPtr RefCountingPointer<DataObjectImpl>
+#define ChangeSummaryImplPtr RefCountingPointer<ChangeSummaryImpl>
+
+/**
+ * rdo is an internal class holding a property value in a data object.
+ */
+
+class rdo {
+public:
+ unsigned int first;
+ DataObjectImplPtr second;
+ rdo(unsigned int infirst, DataObjectImpl* insecond);
+ rdo();
+ rdo (const rdo& inrdo);
+ virtual ~rdo();
+};
+
+typedef std::list< rdo > PropertyValueMap;
+
+class PathToken {
+public:
+ PathToken() : index(-1) {}
+ long index;
+ SDOString propertyName;
+ SDOString predicateName;
+ SDOString predicateValue;
+};
+
+
+ /**
+ * DataObjectImpl implements the abstract class DataObject.
+ *
+ * A data object is a representation of some structured data.
+ * it is the fundamental component in the SDO (Service Data Objects) package.
+ * Data objects support reflection, path-based accesss, convenience creation
+ * and deletion methods,and the ability to be part of a data graph.
+ * Each data object holds its data as a series of properties.
+ * Properties can be accessed by name, property index, or using the property
+ * meta object itself.
+ * A data object can also contain references to other data objects, through
+ * reference-type properties.
+ * A data object has a series of convenience accessors for its properties.
+ * These methods either use a path (String), a property index,
+ * or the property's meta object itself, to identify the property.
+ * Some examples of the path-based accessors are as follows:
+ * DataObjectPtr company = ...;
+ * company->getString("name");
+ * company->setString("name", "acme");
+ * company->getString("department.0/name")
+ * .n indexes from 0.
+ * company->getString("department[1]/name") [] indexes from 1.
+ * company->getDataObject("department[number=123]") returns the department where number=123
+ * company->getDataObject("..") returns the containing data object
+ * company->getDataObject("/") returns the root containing data object
+ * There are specific accessors for the primitive types and commonly used
+ * data types like String.
+ */
+
+class DataObjectImpl : public DataObject
+{
+ public:
+
+ DataObjectImpl();
+ DataObjectImpl(const TypeImpl& t);
+ DataObjectImpl(DataFactoryImplPtr dataFactory, const Type& t);
+
+ // This one only needs the values, and the type/prop info. The rest
+ // is not copied and would be unsafe to do so. This is used to
+ // store the cloned info in a change summary.
+
+ DataObjectImpl(DataObjectImplPtr indo);
+
+ virtual ~DataObjectImpl();
+
+ /////////////////////////////////////////////////////////////////////////
+ // Introspection
+ /////////////////////////////////////////////////////////////////////////
+
+ /** getPropertyIndex gets the unique index of a property
+ *
+ * A property of a data object has a unique index associated with it.
+ * This method gets a property index for this object from the property,
+ * or throw SDOPropertyNotFoundException if the property is not part
+ * of this data object.
+ */
+
+ virtual unsigned int getPropertyIndex(const Property& p);
+
+ /**
+ * These are just like getType().getProperty(), but may return
+ * values other than the property list for open types.
+ */
+
+ virtual const Property& getPropertyFromIndex(unsigned int index);
+
+ virtual PropertyPtr getInstanceProperty(const char* prop);
+ virtual PropertyPtr getInstanceProperty(const SDOString& prop);
+
+ virtual PropertyImpl* getPropertyImpl(const SDOString& prop);
+
+ virtual PropertyImpl* getPropertyImpl(unsigned int index);
+
+ /** getInstanceProperties gets the props of the current object.
+ *
+ * Returns a read-only List of the Properties currently used in this DataObject.
+ * This list will contain all of the properties in getType().getProperties()
+ * and any properties where isSet(property) is true.
+ * For example, properties resulting from the use of
+ * open or mixed XML content are present if allowed by the Type.
+ * The list does not contain duplicates.
+ * The order of the properties in the list begins with getType().getProperties()
+ * and the order of the remaining properties is determined by the implementation.
+ * The same list will be returned unless the DataObject is updated so that
+ * the contents of the list change
+ * Returns the list of Properties currently used in this DataObject.
+ */
+
+ virtual PropertyList getInstanceProperties();
+
+ /** getContainer get the containing object
+ *
+ * Returns the containing data object
+ * or 0 if there is no container.
+ */
+
+ virtual DataObjectPtr getContainer();
+
+ /** getContainmentProperty returns the property containing this object
+ *
+ * Return the Property of the data object containing this data object
+ * or throw an SDOPropertyNotFoundException if there is no container.
+ */
+
+ virtual const Property& getContainmentProperty();
+
+ /** getType returns the data object's type.
+ *
+ * getType returns the data object's type.
+ * The type defines the properties available for reflective access.
+ */
+
+ virtual const Type& getType();
+
+ virtual const Type::Types getTypeEnum();
+
+
+
+ ///////////////////////////////////////////////////////////////////////////
+ // get/set
+ ///////////////////////////////////////////////////////////////////////////
+
+
+ /** getDataObject returns a data object by path, index or property
+ *
+ * Returns the value of a property of either this object or an object
+ * reachable from it, as identified by the specified path.
+ */
+
+ virtual DataObjectPtr getDataObject(const SDOString& path);
+ virtual DataObjectPtr getDataObject(const char* path);
+ virtual DataObjectPtr getDataObject(unsigned int propertyIndex);
+ virtual DataObjectPtr getDataObject(const Property& property);
+
+ /** setDataObject sets a value by path, index or property
+ *
+ * Sets a property of either this object or an object reachable from it,
+ * as identified by the specified path,
+ * to the specified value.
+ */
+
+ virtual void setDataObject(const char* path, DataObjectPtr value);
+ virtual void setDataObject(const char* path, DataObjectPtr value, bool updateSequence);
+ virtual void setDataObject(const SDOString& path, DataObjectPtr value);
+ virtual void setDataObject(const SDOString& path, DataObjectPtr value, bool updateSequence);
+ virtual void setDataObject(unsigned int propertyIndex, DataObjectPtr value);
+ virtual void setDataObject(unsigned int propertyIndex, DataObjectPtr value, bool updateSequence);
+ virtual void setDataObject(const Property& property, DataObjectPtr value);
+ virtual void setDataObject(const Property& property, DataObjectPtr value, bool updateSequence);
+
+ /** getBoolean returns a boolean by path, index or property
+ *
+ * Returns the value of a property of either this object or an object
+ * reachable from it, as identified by the specified path.
+ */
+
+ virtual bool getBoolean(const char* path);
+ virtual bool getBoolean(const SDOString& path);
+ virtual bool getBoolean(unsigned int propindex);
+ virtual bool getBoolean(const Property& p);
+
+ virtual void setBoolean(const char* path, bool b);
+ virtual void setBoolean(const SDOString& path, bool b);
+ virtual void setBoolean(unsigned int propindex, bool b);
+ virtual void setBoolean(const Property& p, bool b);
+
+ virtual char getByte(const char* path);
+ virtual char getByte(const SDOString& path);
+ virtual char getByte(unsigned int propindex);
+ virtual char getByte(const Property& p);
+
+ virtual void setByte(const char* path, char c);
+ virtual void setByte(const SDOString& path, char c);
+ virtual void setByte(unsigned int propindex, char c);
+ virtual void setByte(const Property& p, char c);
+
+ virtual wchar_t getCharacter(const char* path);
+ virtual wchar_t getCharacter(const SDOString& path);
+ virtual wchar_t getCharacter(unsigned int propindex);
+ virtual wchar_t getCharacter(const Property& p);
+
+ virtual void setCharacter(const char* path, wchar_t c);
+ virtual void setCharacter(const SDOString& path, wchar_t c);
+ virtual void setCharacter(unsigned int propindex, wchar_t c);
+ virtual void setCharacter(const Property& p, wchar_t c);
+
+ virtual unsigned int getLength(const SDOString& path) ;
+ virtual unsigned int getLength(const char* path) ;
+ virtual unsigned int getLength(unsigned int propindex) ;
+ virtual unsigned int getLength(const Property& p) ;
+ virtual unsigned int getLength() ;
+
+ virtual unsigned int getBytes(const char* path, char* buf, unsigned int max) ;
+ virtual unsigned int getBytes(const SDOString& path, char* buf, unsigned int max) ;
+ virtual unsigned int getBytes(unsigned int propindex, char* buf, unsigned int max) ;
+ virtual unsigned int getBytes(const Property& p, char* buf, unsigned int max) ;
+
+ virtual void setBytes(const char* path, const char* c, unsigned int len) ;
+ virtual void setBytes(const SDOString& path, const char* c, unsigned int len) ;
+ virtual void setBytes(unsigned int propindex, const char* c,unsigned int len) ;
+ virtual void setBytes(const Property& p, const char* c,unsigned int len) ;
+
+ virtual unsigned int getString(const SDOString& path, wchar_t* buf, unsigned int max);
+ virtual unsigned int getString(const char* path, wchar_t* buf, unsigned int max) ;
+ virtual unsigned int getString(unsigned int propindex,wchar_t* buf, unsigned int max) ;
+ virtual unsigned int getString(const Property& p,wchar_t* buf, unsigned int max) ;
+
+ virtual void setString(const SDOString& path, const wchar_t* c,unsigned int len);
+ virtual void setString(const char* path, const wchar_t* c,unsigned int len) ;
+ virtual void setString(unsigned int propindex, const wchar_t* c,unsigned int len) ;
+ virtual void setString(const Property& p, const wchar_t* c,unsigned int len) ;
+
+ virtual const SDODate getDate(const SDOString& path);
+ virtual const SDODate getDate(const char* path);
+ virtual const SDODate getDate(unsigned int propindex);
+ virtual const SDODate getDate(const Property& p);
+
+ virtual void setDate(const SDOString& path, const SDODate d);
+ virtual void setDate(const char* path, const SDODate d);
+ virtual void setDate(unsigned int propindex, const SDODate d);
+ virtual void setDate(const Property& p, const SDODate d);
+
+ virtual long double getDouble(const SDOString& path);
+ virtual long double getDouble(const char* path);
+ virtual long double getDouble(unsigned int propindex);
+ virtual long double getDouble(const Property& p);
+
+ virtual void setDouble(const SDOString& path, long double d);
+ virtual void setDouble(const char* path, long double d);
+ virtual void setDouble(unsigned int propindex, long double d);
+ virtual void setDouble(const Property& p, long double d);
+
+ virtual float getFloat(const SDOString& path);
+ virtual float getFloat(const char* path);
+ virtual float getFloat(unsigned int propindex);
+ virtual float getFloat(const Property& p);
+
+ virtual void setFloat(const SDOString& path, float f);
+ virtual void setFloat(const char* path, float f);
+ virtual void setFloat(unsigned int propindex, float f);
+ virtual void setFloat(const Property& p, float f);
+
+ virtual long getInt(const SDOString& path);
+ virtual long getInt(const char* path);
+ virtual long getInt(unsigned int propindex);
+ virtual long getInt(const Property& p);
+
+ virtual void setInt(const SDOString& path, long i);
+ virtual void setInt(const char* path, long i);
+ virtual void setInt(unsigned int propindex, long i);
+ virtual void setInt(const Property& p, long i);
+
+ virtual /*long long*/ int64_t getLong(const SDOString& path);
+ virtual /*long long*/ int64_t getLong(const char* path);
+ virtual /*long long*/ int64_t getLong(unsigned int propindex);
+ virtual /*long long*/ int64_t getLong(const Property& p);
+
+ virtual void setLong(const SDOString& path, /*long long*/ int64_t l);
+ virtual void setLong(const char* path, /*long long*/ int64_t l);
+ virtual void setLong(unsigned int propindex, /*long long*/ int64_t l);
+ virtual void setLong(const Property& p, /*long long*/ int64_t l);
+
+ virtual short getShort(const SDOString& path);
+ virtual short getShort(const char* path);
+ virtual short getShort(unsigned int propindex);
+ virtual short getShort(const Property& p);
+
+ virtual void setShort(const SDOString& path, short s);
+ virtual void setShort(const char* path, short s);
+ virtual void setShort(unsigned int propindex, short s);
+ virtual void setShort(const Property& p, short s);
+
+ virtual const char* getCString(const char* path);
+ virtual const char* getCString(const SDOString& path);
+ virtual const char* getCString(unsigned int propertyIndex);
+ virtual const char* getCString(const Property& prop);
+
+ virtual void setCString(const char* path, const char* value);
+ virtual void setCString(unsigned int propertyIndex, const char* value);
+ virtual void setCString (const Property& prop, const char* value);
+
+ virtual void setCString(const SDOString& path, const SDOString& value);
+ virtual void setCString(unsigned int propertyIndex, const SDOString& value);
+ virtual void setCString (const Property& prop, const SDOString& value);
+
+ /** setNull sets a data object value to null.
+ *
+ * A DataObjectType or DataType value may be set or unset. If it is set, then
+ * it may have a value, or it may be set to null. A distinction is drawn between
+ * being unset, having the default value, being set and being null.
+ * When the value of an integer (for example) is returned as zero, it could have
+ * been set to zero, or it could be null. Use isNull() to verify.
+ */
+
+ virtual void setNull(const SDOString& path);
+ virtual void setNull(const char* path);
+ virtual void setNull(unsigned int propertyIndex);
+ virtual void setNull(const Property& prop);
+
+ virtual bool isNull(const SDOString& path);
+ virtual bool isNull(const char* path);
+ virtual bool isNull(unsigned int propertyIndex);
+ virtual bool isNull(const Property& prop);
+
+ virtual bool isSet(const char* path);
+ virtual bool isSet(const SDOString& path);
+ virtual bool isSet(unsigned int propertyIndex);
+ virtual bool isSet(const Property& property);
+
+ virtual bool isValid(const SDOString& path);
+ virtual bool isValid(const char* path);
+ virtual bool isValid(unsigned int propertyIndex);
+ virtual bool isValid(const Property& property);
+
+ virtual void unset(const char* path);
+ virtual void unset(const SDOString& path);
+ virtual void unset(unsigned int propertyIndex);
+ virtual void unset(const Property& property);
+
+
+ ///////////////////////////////////////////////////////////////////////////
+ // Sequences
+ ///////////////////////////////////////////////////////////////////////////
+
+ /** getSequence returns the sequence for a data object
+ *
+ * Returns the value of a Sequence property identified by
+ * the specified path. See Sequence.
+ */
+
+ virtual SequenceImplPtr getSequenceImpl();
+ virtual SequencePtr getSequence();
+ virtual SequencePtr getSequence(const char* path);
+ virtual SequencePtr getSequence(const SDOString& path);
+ virtual SequencePtr getSequence(unsigned int propertyIndex);
+ virtual SequencePtr getSequence(const Property& property);
+
+
+ ///////////////////////////////////////////////////////////////////////////
+ // Creation of dataobjects
+ ///////////////////////////////////////////////////////////////////////////
+
+ /** createDataObject creates a data object value
+ *
+ * Returns a new data object contained by this object using the
+ * specified property,which must be a containment property.
+ * The type of the created object is the declared type
+ * of the specified property.
+ * If the property is many valued, this method adds an element to the
+ * list, otherwise it sets the value, removing any old value.
+ */
+
+ virtual DataObjectPtr createDataObject(const char* propertyName);
+ virtual DataObjectPtr createDataObject(const SDOString& propertyName);
+ virtual DataObjectPtr createDataObject(unsigned int propertyIndex);
+ virtual DataObjectPtr createDataObject(const Property& property);
+
+
+ virtual void detach();
+
+ virtual void clear();
+
+
+ ///////////////////////////////////////////////////////////////////////////
+ // Lists
+ ///////////////////////////////////////////////////////////////////////////
+
+ /** getList gets the value of a many-valued property
+ *
+ * Many valued properties are returned as lists of DataObjects.
+ * These lists may contain primitives or data objects, but they behave
+ * like data objects.
+ * Getting a many valued integer consists of getting the list, then
+ * using the DataObjectList API to getInt() for each list element.
+ */
+
+ virtual DataObjectList& getList(const char* path);
+ virtual DataObjectList& getList(const SDOString& path);
+ virtual DataObjectList& getList(unsigned int propIndex);
+ virtual DataObjectList& getList(const Property& p);
+ virtual DataObjectList& getList();
+ virtual DataObjectListImpl* getListImpl();
+
+ void setList( DataObjectList* theList);
+
+ ///////////////////////////////////////////////////////////////////////////
+ // Change Summary
+ ///////////////////////////////////////////////////////////////////////////
+
+ /** getChangeSummary get the applicable change summary
+ *
+ * This method gets the applicable change summary for a data object.
+ * The summary is not necessarily attached to the data object, it may be
+ * the summary for a parent data object. No object with a summary attached
+ * may be a child of another object with a summary attached.
+ * See the ChangeSummary API for details of using the change sumamry.
+ */
+
+ virtual SDO_API ChangeSummaryPtr getChangeSummary(const char* path);
+ virtual SDO_API ChangeSummaryPtr getChangeSummary(const SDOString& path);
+ virtual SDO_API ChangeSummaryPtr getChangeSummary(unsigned int propIndex);
+ virtual SDO_API ChangeSummaryPtr getChangeSummary(const Property& prop);
+ virtual SDO_API ChangeSummaryPtr getChangeSummary();
+
+
+ virtual bool getBoolean();
+ virtual void setBoolean(bool b);
+ virtual char getByte();
+ virtual void setByte(char c);
+ virtual wchar_t getCharacter();
+ virtual void setCharacter(wchar_t c);
+ virtual unsigned int getString(wchar_t* buf, unsigned int max);
+ virtual unsigned int getBytes(char* buf, unsigned int max);
+ virtual void setString(const wchar_t* buf, unsigned int len);
+ virtual void setBytes(const char* c, unsigned int len);
+ virtual short getShort();
+ virtual void setShort(short s);
+ virtual long getInt();
+ virtual void setInt(long s);
+ virtual /* long long*/ int64_t getLong();
+ virtual void setLong(/* long long */ int64_t i);
+ virtual float getFloat();
+ virtual void setFloat(float b);
+ virtual long double getDouble();
+ virtual void setDouble(long double d);
+ virtual const SDODate getDate();
+ virtual void setDate(const SDODate d);
+ virtual const char* getCString();
+ virtual void setCString(const char* s);
+ virtual void setCString(const SDOString& s);
+ virtual void setSDOValue(const SDOValue& s);
+ virtual DataObjectImpl* getDataObject();
+ virtual void setDataObject(DataObject* d);
+
+ // null support
+ virtual bool isNull();
+ virtual void setNull();
+ virtual void unsetNull();
+
+ // change logging is used by the dataobjectlistimpl
+ virtual void logChange(const Property& prop);
+ virtual void logChange(unsigned int propIndex);
+ virtual void logDeletion();
+ virtual void logCreation(DataObjectImpl* dol,
+ DataObjectImpl* cont, const Property& prop);
+
+ // reference support
+ virtual void setReference(DataObject* dob, const Property& prop);
+ virtual void unsetReference(DataObject* dob, const Property& prop);
+ virtual void clearReferences();
+
+ // user data support
+ virtual void setUserData(const char* path,void* value);
+ virtual void setUserData(const SDOString& path, void* value);
+ virtual void setUserData(unsigned int propertyIndex, void* value);
+ virtual void setUserData(const Property& property, void* value);
+ virtual void setUserData(void* value);
+ virtual void* getUserData(const char* path);
+ virtual void* getUserData(const SDOString& path);
+ virtual void* getUserData(unsigned int propertyIndex);
+ virtual void* getUserData(const Property& property);
+ virtual void* getUserData();
+
+ virtual void setContainer(DataObjectImpl* d);
+ DataObjectImpl* getContainerImpl();
+
+ // builds a temporary XPath for this object.
+ virtual const char* objectToXPath();
+
+ // The data factory can be used to create new data objects within
+ // the Type system of this data object
+ //
+
+ SDO_API DataFactoryPtr getDataFactory();
+
+ // open type support
+ virtual void setInstancePropertyType(unsigned int index,
+ const Type* t);
+
+ /**
+ * defineProperty is used by open type support.
+ * This method and its siblings define a new property on an
+ * open type when a setting is requested.
+ */
+ virtual const PropertyImpl* defineProperty(const SDOString& propname,
+ const Type& t);
+
+ virtual const PropertyImpl* defineSDOValue(const SDOString& propname,
+ const SDOValue& sval);
+ virtual const PropertyImpl* defineBoolean(const SDOString& propname);
+ virtual const PropertyImpl* defineByte(const SDOString& propname);
+ virtual const PropertyImpl* defineCharacter(const SDOString& propname);
+ virtual const PropertyImpl* defineString(const SDOString& propname);
+ virtual const PropertyImpl* defineBytes(const SDOString& propname);
+ virtual const PropertyImpl* defineShort(const SDOString& propname);
+ virtual const PropertyImpl* defineInt(const SDOString& propname);
+ virtual const PropertyImpl* defineLong(const SDOString& propname);
+ virtual const PropertyImpl* defineFloat(const SDOString& propname);
+ virtual const PropertyImpl* defineDouble(const SDOString& propname);
+ virtual const PropertyImpl* defineDate(const SDOString& propname);
+ virtual const PropertyImpl* defineCString(const SDOString& propname);
+ virtual const PropertyImpl* defineDataObject(const SDOString& propname,
+ const Type&t );
+ virtual const PropertyImpl* defineDataObject(const char* propname,
+ const char* typeURI, const char* typeName );
+ virtual const PropertyImpl* defineList(const char* propname);
+ virtual void undefineProperty(unsigned int index);
+ virtual const TypeImpl& getTypeImpl();
+ virtual void setDataFactory(DataFactoryImplPtr df);
+
+ virtual std::ostream& printSelf(std::ostream &os);
+
+ virtual const SDOValue& getSDOValue(PropertyImpl** propertyForDefault);
+ virtual const SDOValue& getSDOValue(const unsigned int propertyIndex,
+ PropertyImpl** propertyForDefault);
+ virtual const SDOValue& getSDOValue(const Property& property,
+ PropertyImpl** propertyForDefault);
+ virtual const SDOValue& getSDOValue(const SDOString& path,
+ PropertyImpl** propertyForDefault);
+ virtual void setSDOValue(const SDOString& path, const SDOValue& sval, const SDOString& dataType);
+ virtual void setSDOValue(unsigned int propindex, const SDOValue& sval, const SDOString& dataType);
+ virtual void setSDOValue(unsigned int propindex, const SDOValue& sval, const SDOString& dataType, bool updateSequence);
+ virtual void setSDOValue(const Property& p, const SDOValue& sval, const SDOString& dataType);
+ virtual void setSDOValue(const Property& p, const SDOValue& sval, const SDOString& dataType, bool updateSequence);
+
+
+
+private:
+ /**
+ * This method is used internally to find the index of a
+ * property. If differs from the public getPropertyIndex method
+ * in that if the type of the containing object is open a new
+ * index is created. In the public version and error is thrown
+ */
+ virtual unsigned int getPropertyIndexInternal(const Property& p);
+
+ virtual void validateIndex(unsigned int index);
+ virtual void checkFactory(DataObjectPtr dob, unsigned int propertyIndex);
+ virtual void checkType( const Property& prop,
+ const Type& objectType);
+
+ virtual bool remove(DataObjectImpl* indol);
+ virtual bool isSet(const Property& prop, unsigned int propertyIndex);
+
+
+ virtual DataObjectImpl* getDataObjectImpl(const SDOString& path);
+ virtual DataObjectImpl* getDataObjectImpl(unsigned int propertyIndex);
+ virtual DataObjectImpl* getDataObjectImpl(const Property& property);
+
+ virtual DataObjectPtr
+ createDataObject(const Property& property,
+ const char* namespaceURI,
+ const char* typeName);
+
+ void getPathToken(const SDOString& propStr, PathToken& pathToken);
+ DataObjectImpl* findDataObject(const PathToken& pathToken);
+ const Property* findInProperties(DataObject* ob);
+
+ SDOString findPropertyContainer(const SDOString& path, DataObjectImpl** din);
+
+ char* stripPath(const char* path);
+ void stripPath(const SDOString& path, SDOString& result);
+
+
+ // Does not keep a reference counted pointer to the container.
+ DataObjectImpl* container;
+
+ PropertyValueMap PropertyValues;
+
+ TypeImpl* ObjectType;
+
+ DataObjectListImpl* listValue;
+
+ // Holds the value as an SDOValue object, if the value is a primitive data type.
+ SDOValue sdoValue;
+
+ // If the value is a data object, it is recorded here.
+ DataObjectImpl* doValue;
+
+ // holds the Xpath to this object if requested.
+ std::string asXPathBuffer;
+
+ // The data object holds a counted reference to the data factory.
+ DataFactoryImplPtr factory;
+
+
+ // Support for open types
+ unsigned int openBase;
+ std::vector<PropertyImplPtr> openProperties;
+
+ static const char* templateString;
+
+ // Data may be set to null in any data object
+ bool isnull;
+
+ // user supplied 32 bit value.
+ void* userdata;
+
+ SequenceImplPtr sequence;
+
+ //
+ // The change summary if this is a summarised type
+
+ ChangeSummaryImplPtr getChangeSummaryImpl();
+ ChangeSummaryImplPtr getSummary();
+ ChangeSummaryImplPtr localCS;
+
+
+ // reference type support
+
+ class Reference
+ {
+ public:
+ DataObject* getDataObject()
+ {
+ return referer;
+ }
+ const Property& getProperty()
+ {
+ return refprop;
+ }
+ Reference(DataObject* d, const Property& p) : refprop(p), referer(d)
+ {
+ }
+ private:
+ DataObject* referer;
+ const Property& refprop;
+ };
+
+ typedef std::vector<Reference*> REFERENCE_LIST;
+
+ REFERENCE_LIST refs;
+
+
+
+};
+}
+}
+
+#endif //_DATAOBJECTIMPL_H_
diff --git a/sdo-cpp/trunk/runtime/core/src/commonj/sdo/DataObjectList.cpp b/sdo-cpp/trunk/runtime/core/src/commonj/sdo/DataObjectList.cpp
new file mode 100644
index 0000000000..0e60693c55
--- /dev/null
+++ b/sdo-cpp/trunk/runtime/core/src/commonj/sdo/DataObjectList.cpp
@@ -0,0 +1,43 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you 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$ */
+
+#include "commonj/sdo/DataObjectList.h"
+
+namespace commonj{
+namespace sdo {
+
+/**
+ *
+ * List for retrieving many valued property values.
+ *
+ * DataObjectList provides an API for getting and setting values in
+ * many valued properties. The list deals with both DataType and
+ * DataObjectType properties.
+ */
+
+DataObjectList::~DataObjectList()
+{
+
+}
+
+};
+};
+
diff --git a/sdo-cpp/trunk/runtime/core/src/commonj/sdo/DataObjectList.h b/sdo-cpp/trunk/runtime/core/src/commonj/sdo/DataObjectList.h
new file mode 100644
index 0000000000..ce039f9bb2
--- /dev/null
+++ b/sdo-cpp/trunk/runtime/core/src/commonj/sdo/DataObjectList.h
@@ -0,0 +1,202 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you 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$ */
+
+#ifndef _DATAOBJECTLIST_H_
+#define _DATAOBJECTLIST_H_
+
+
+#include "commonj/sdo/export.h"
+#include "commonj/sdo/RefCountingPointer.h"
+#include "commonj/sdo/DataObject.h"
+#include "commonj/sdo/SDODate.h"
+#include "commonj/sdo/SDOValue.h"
+#include <wchar.h>
+
+
+namespace commonj{
+namespace sdo{
+
+/**
+ *
+ * List for retrieving many valued property values, DataType or DataObjectType.
+ *
+ * DataObjectList provides an API for getting and setting values in
+ * many valued properties. The list deals with both DataType and
+ * DataObjectType properties.
+ */
+
+class DataObjectList
+{
+public:
+ virtual ~DataObjectList();
+
+ /** [] is a index operator, and returns a dataobject.
+ *
+ * The index operator returns a data object, even if the
+ * list is of a DataType. The data object can yield its true value using
+ * getInt() etc. Alternatively, list elements can be accessed
+ * with their correct type using the list getInt(index) api.
+ */
+
+ virtual SDO_API DataObjectPtr operator[] (unsigned int pos) = 0;
+ virtual SDO_API const DataObjectPtr operator[] (unsigned int pos) const = 0;
+
+ /** size returns the number of elements.
+ *
+ * The size method returns the number of elements in the list
+ */
+
+ virtual SDO_API unsigned int size () const = 0;
+
+ /** getBoolean returns a boolean at an index
+ *
+ * Each of the DataTypes has a corresponding getter and setter
+ * overload. getBoolean returns a bool, getByte returns a char
+ * etc
+ */
+
+ virtual SDO_API bool getBoolean(unsigned int index) const = 0;
+ virtual SDO_API char getByte(unsigned int index) const = 0;
+ virtual SDO_API wchar_t getCharacter(unsigned int index) const = 0;
+ virtual SDO_API unsigned int getString(unsigned int index, wchar_t* value,
+ unsigned int max) const = 0;
+ virtual SDO_API unsigned int getBytes(unsigned int index, char* value,
+ unsigned int max) const = 0;
+ virtual SDO_API short getShort(unsigned int index) const = 0;
+ virtual SDO_API long getInt(unsigned int index) const = 0;
+ virtual SDO_API int64_t getLong(unsigned int index) const = 0;
+ virtual SDO_API float getFloat(unsigned int index) const = 0;
+ virtual SDO_API long double getDouble(unsigned int index) const = 0;
+ virtual SDO_API const SDODate getDate(unsigned int index) const = 0;
+ virtual SDO_API const char* getCString(unsigned int index) const = 0;
+ virtual SDO_API DataObjectPtr getDataObject(unsigned int index) const = 0;
+
+ virtual SDO_API void setBoolean(unsigned int index, bool d) = 0;
+ virtual SDO_API void setByte(unsigned int index, char d) = 0;
+ virtual SDO_API void setCharacter(unsigned int index, wchar_t d) = 0;
+ virtual SDO_API void setString(unsigned int index, const wchar_t* d, unsigned int len) = 0;
+ virtual SDO_API void setBytes(unsigned int index, const char* d, unsigned int len) = 0;
+ virtual SDO_API void setShort(unsigned int index, short d) = 0;
+ virtual SDO_API void setInt(unsigned int index, long d) = 0;
+ virtual SDO_API void setLong(unsigned int index, int64_t d) = 0;
+ virtual SDO_API void setFloat(unsigned int index, float d) = 0;
+ 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
+ *
+ * getLength behaves like DataObject::getlength. It returns the length
+ * of a bytes or string buffer such that space can be allocated for the
+ * values from getBytes() and getString()
+ */
+
+ virtual SDO_API unsigned int getLength(unsigned int index) const = 0;
+
+ /** insert and append put items into the list
+ *
+ * insert and append have overrides for each of the DataTypes, and
+ * for DataObject. Insert inserts before the element number given. If the insertion
+ * point is off the end of the list, then an append is performed.
+ * Append puts the element on the end of the list.
+ */
+
+
+ virtual SDO_API void insert (unsigned int index, DataObjectPtr d) = 0;
+ virtual SDO_API void append (DataObjectPtr d) = 0;
+
+ virtual SDO_API void insert (unsigned int index, bool d) = 0;
+ virtual SDO_API void append (bool d) = 0;
+
+ virtual SDO_API void insert (unsigned int index, char d) = 0;
+ virtual SDO_API void append (char d) = 0;
+
+ virtual SDO_API void insert (unsigned int index, wchar_t d) = 0;
+ virtual SDO_API void append (wchar_t d) = 0;
+
+ virtual SDO_API void insert (unsigned int index, const wchar_t* d, unsigned int len) = 0;
+ virtual SDO_API void append (const wchar_t* d, unsigned int len) = 0;
+
+ virtual SDO_API void insert (unsigned int index, const char* d, unsigned int len) = 0;
+ 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;
+
+ virtual SDO_API void append (const SDOValue& sval) = 0;
+
+ virtual SDO_API void insert (unsigned int index, short d) = 0;
+ virtual SDO_API void append (short d) = 0;
+
+ virtual SDO_API void insert (unsigned int index, const SDODate d) = 0;
+ virtual SDO_API void append (const SDODate d) = 0;
+
+#if __WORDSIZE !=64
+ virtual SDO_API void insert (unsigned int index, long d) = 0;
+ virtual SDO_API void append (long d) = 0;
+#endif
+
+ virtual SDO_API void insert (unsigned int index, int64_t d) = 0;
+ virtual SDO_API void append (int64_t d) = 0;
+
+ virtual SDO_API void insert (unsigned int index, float d) = 0;
+ virtual SDO_API void append (float d) = 0;
+
+
+ virtual SDO_API void insert (unsigned int index, long double d) = 0;
+ virtual SDO_API void append (long double d) = 0;
+
+ /** remove removes an element from the list.
+ *
+ * Remove removes the element from the list, and passes out a
+ * DataObjectPtr to the old value. This can be attached to the list
+ * somewhere else, or discarded.
+ */
+
+ virtual SDO_API DataObjectPtr remove (unsigned int index) = 0;
+
+ /* getType returns type
+ *
+ * Returns the type.
+ * May throw SDOTYpeNotFoundException for unset open types
+ */
+
+
+ virtual SDO_API const Type& getType() = 0;
+
+ /* getTypeEnum returns an enumerator for the type
+ *
+ * Returns an enumerator for the type for easy switching on basic types.
+ * The enumerator is part of the Type class
+ * May throw SDOTypeNotFoundException for open types
+ */
+
+ virtual SDO_API const Type::Types getTypeEnum() = 0;
+
+};
+};
+};
+
+#endif
diff --git a/sdo-cpp/trunk/runtime/core/src/commonj/sdo/DataObjectListImpl.cpp b/sdo-cpp/trunk/runtime/core/src/commonj/sdo/DataObjectListImpl.cpp
new file mode 100644
index 0000000000..9b8766aa62
--- /dev/null
+++ b/sdo-cpp/trunk/runtime/core/src/commonj/sdo/DataObjectListImpl.cpp
@@ -0,0 +1,1126 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you 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$ */
+
+#include "commonj/sdo/DataObjectListImpl.h"
+
+
+#include <iostream>
+#include "commonj/sdo/Property.h"
+#include "commonj/sdo/Type.h"
+#include "commonj/sdo/DataObject.h"
+#include "commonj/sdo/Logger.h"
+#include "commonj/sdo/SDORuntimeException.h"
+#include "commonj/sdo/DataFactory.h"
+#include "commonj/sdo/DataObjectImpl.h"
+#include "commonj/sdo/DataFactoryImpl.h"
+#include "commonj/sdo/SDOUtils.h"
+
+#include <stdio.h>
+
+namespace commonj{
+namespace sdo {
+
+ using internal::SDOUtils;
+/**
+ * DataObjectListImpl implements DataObjectList.
+ * List for retrieving many valued property values.
+ *
+ * DataObjectList provides an API for getting and setting values in
+ * many valued properties. The list deals with both DataType and
+ * DataObjectType properties.
+ */
+DataObjectListImpl::DataObjectListImpl(DATAOBJECT_VECTOR p) : plist (p)
+{
+ theFactory = 0;
+ container = 0;
+ pindex = 0;
+ isReference = false;
+}
+
+DataObjectListImpl::DataObjectListImpl(const DataObjectListImpl &pin)
+{
+ plist = std::vector<RefCountingPointer<DataObjectImpl> >(pin.getVec());
+ theFactory = pin.theFactory;
+ container = pin.container;
+ pindex = pin.pindex;
+ typeUnset = pin.typeUnset;
+ isReference = pin.isReference;
+ if (pin.typeURI != 0) {
+ typeURI = new char[strlen(pin.typeURI) +1];
+ strcpy(typeURI, pin.typeURI);
+ }
+ if (pin.typeName != 0) {
+ typeName = new char[strlen(pin.typeName) +1];
+ strcpy(typeName, pin.typeName);
+ }
+}
+
+DataObjectListImpl::DataObjectListImpl()
+{
+ theFactory = 0;
+ typeURI = 0;
+ typeName = 0;
+ theFactory = 0;
+ container = 0;
+ pindex = 0;
+ typeUnset = false;
+ isReference = false;
+}
+
+DataObjectListImpl::DataObjectListImpl(DataFactoryImplPtr df,
+ DataObjectImpl* cont,
+ unsigned int inpindex,
+ const char* intypeURI,
+ const char* intypeName)
+{
+ container = cont;
+ pindex = inpindex;
+ theFactory = df;
+
+
+ isReference = false;
+ if (container->getPropertyFromIndex(pindex).isReference())
+ {
+ isReference = true;
+ }
+ typeUnset = false;
+
+ if (container->getType().isOpenType())
+ {
+ if (!strcmp(intypeURI, SDOUtils::sdoURI) &&
+ !strcmp(intypeName,"OpenDataObject"))
+ {
+ typeUnset = true;
+ }
+ }
+
+
+ if (intypeURI != 0) {
+ typeURI = new char[strlen(intypeURI) +1];
+ strcpy(typeURI, intypeURI);
+ }
+ else {
+ typeURI = 0;
+ }
+ if (intypeName != 0) {
+ typeName = new char[strlen(intypeName) +1];
+ strcpy(typeName, intypeName);
+ }
+ else {
+ typeName = 0;
+ theFactory = 0;
+ }
+}
+
+DataObjectListImpl::~DataObjectListImpl()
+{
+ if (typeURI != 0) {
+ delete[] typeURI;
+ typeURI = 0;
+ }
+ if (typeName != 0) {
+ delete[] typeName;
+ typeName = 0;
+ }
+}
+
+DataObjectPtr DataObjectListImpl::operator[] (unsigned int pos)
+{
+ validateIndex(pos);
+ return plist[pos];
+}
+
+const DataObjectPtr DataObjectListImpl::operator[] (unsigned int pos) const
+{
+ validateIndex(pos);
+ RefCountingPointer<DataObjectImpl> d = plist[pos];
+ DataObjectImpl* dob = getRawPointer(d);
+ return DataObjectPtr((DataObject*)dob);
+}
+
+
+unsigned int DataObjectListImpl::size () const
+{
+ return plist.size();
+}
+
+DATAOBJECT_VECTOR DataObjectListImpl::getVec() const
+{
+ return plist;
+}
+
+
+
+const Type& DataObjectListImpl::getType()
+{
+ if (typeUnset)
+ {
+ std::string msg("The list property is open, and the type of the contents has not bee determined yet.");
+ throw SDOTypeNotFoundException(TUSCANY_SDO_EINFO, msg.c_str());
+ }
+ return theFactory->getType(typeURI, typeName);
+}
+
+
+const Type::Types DataObjectListImpl::getTypeEnum()
+{
+ if (typeUnset)
+ {
+ return Type::DataObjectType;
+
+ }
+ return theFactory->getType(typeURI, typeName).getTypeEnum();
+}
+
+
+void DataObjectListImpl::insert (unsigned int index, DataObjectPtr d)
+{
+ if (typeUnset)setType(d->getType().getURI(),d->getType().getName());
+
+ checkFactory(d);
+
+ checkType(theFactory->getType(typeURI,typeName),
+ d->getType());
+
+ if (container != 0)
+ {
+ container->logChange(pindex);
+ }
+ for (unsigned int i=0;i < plist.size(); i++)
+ {
+ if (plist[i] == d)
+ {
+ std::string msg("Insertion of object which already exists in the list:");
+ msg += typeURI;
+ msg += " ";
+ msg += typeName;
+ throw SDOUnsupportedOperationException(TUSCANY_SDO_EINFO, msg.c_str());
+ }
+ }
+ if (strcmp(typeURI,d->getType().getURI())
+ ||
+ strcmp(typeName,d->getType().getName()))
+ {
+ std::string msg("Insertion of object of the wrong type to a list:");
+ msg += typeURI;
+ msg += " ";
+ msg += typeName;
+ msg += " not compatible with ";
+ msg += d->getType().getURI();
+ msg += " ";
+ msg += d->getType().getName();
+ throw SDOInvalidConversionException(TUSCANY_SDO_EINFO, msg.c_str());
+ }
+
+ const Property& property = container->getPropertyFromIndex(pindex);
+ ASSERT_WRITABLE(property,insert)
+
+ DataObject* dob = getRawPointer(d); // unwrap the data object ready for a downcasting hack.
+ DataObjectImpl* con = ((DataObjectImpl*)dob)->getContainerImpl();
+ if (!isReference)
+ {
+ if (con != 0)
+ {
+ if (con != container)
+ {
+ /* this data object is already contained somewhere else */
+ std::string msg("Insertion of object to list, object is already contained:");
+ msg += d->getType().getURI();
+ msg += " ";
+ msg += d->getType().getName();
+ throw SDOInvalidConversionException(TUSCANY_SDO_EINFO, msg.c_str());
+ }
+ }
+ else
+ {
+ ((DataObjectImpl*)dob)->setContainer(container);
+ ((DataObjectImpl*)dob)->logCreation((DataObjectImpl*)dob,
+ (DataObjectImpl*)container,
+ property);
+ }
+ }
+
+ plist.insert(plist.begin()+index, RefCountingPointer<DataObjectImpl>((DataObjectImpl*)dob));
+
+ if (container != 0)
+ {
+ if (container->getType().isSequencedType())
+ {
+ SequenceImplPtr sq = container->getSequenceImpl();
+ if (sq)sq->push(property,index);
+ }
+ }
+
+}
+
+
+
+ void DataObjectListImpl::checkFactory(DataObjectPtr dob)
+ {
+
+ DataObjectImpl* d = (DataObjectImpl*)getRawPointer(dob);
+
+ if (d->getDataFactory() == theFactory) return;
+
+ if (d->getContainer() != 0)
+ {
+ std::string msg("Insertion of object into list from another factory is only allowed if the parent is null: ");
+
+ const Type& t = d->getType();
+ msg += t.getURI();
+ msg += "#";
+ msg += t.getName();
+ msg += " into property ";
+ msg += container->getPropertyFromIndex(pindex).getName();
+ msg += " of type ";
+ msg += typeURI;
+ msg += "#";
+ msg += typeName;
+ throw SDOInvalidConversionException(TUSCANY_SDO_EINFO, msg.c_str());
+ }
+ }
+
+
+void DataObjectListImpl::checkType(const Type& listType, const Type& objectType)
+ {
+ if (listType.equals(objectType)) return;
+
+ const TypeImpl* ti = theFactory->findTypeImpl
+ (objectType.getURI(),objectType.getName());
+ if (ti != 0)
+ {
+ do
+ {
+ ti = (const TypeImpl*)ti->getBaseType();
+ if (ti == 0) break;
+ if (listType.equals(*ti)) return;
+ } while (ti != 0);
+
+ // allow types of any substitutes
+ if (container != 0)
+ {
+ PropertyImpl* pi =
+ container->getPropertyImpl(pindex);
+ if (pi != 0)
+ {
+ unsigned int subcount = pi->getSubstitutionCount();
+ for (unsigned int i=0;i<subcount;i++)
+ {
+ const Type* tsub = pi->getSubstitutionType(i);
+ if (tsub != 0 && tsub->equals(objectType)) return;
+ }
+ }
+ }
+ }
+
+ // no match..
+ std::string msg("Insertion of object of incompatible type ");
+ msg += objectType.getURI();
+ msg += "#";
+ msg += objectType.getName();
+ msg += " into list of type ";
+ msg += listType.getURI();
+ msg += "#";
+ msg += listType.getName();
+ throw SDOInvalidConversionException(TUSCANY_SDO_EINFO, msg.c_str());
+ }
+
+//TODO Modify parameters to SDOString
+void DataObjectListImpl::setType(const char* uri, const char* name)
+{
+ // need to check for an opentype list which has not been set up yet
+ if (name == 0) return;
+
+ const TypeImpl* t = theFactory->findTypeImpl(uri,name);
+ if (t == 0) return; // cannot set to a type which is not avilable
+
+ // need to modify the instance property of the container
+ container->setInstancePropertyType(pindex,t);
+
+ delete[] typeName;
+ typeName = new char[strlen(name)+1];
+ strcpy(typeName, name);
+ delete[] typeURI;
+ if (uri == 0)
+ {
+ typeURI = new char[1];
+ typeURI[0] = 0;
+ }
+ else
+ {
+ typeURI = new char[strlen(uri)+1];
+ strcpy(typeURI, uri);
+ }
+ typeUnset = false;
+}
+
+void DataObjectListImpl::setType(const SDOString& uri, const SDOString& name)
+{
+ // need to check for an opentype list which has not been set up yet
+ // if (name == 0) return;
+
+ const TypeImpl* t = theFactory->findTypeImpl(uri.c_str(), name.c_str());
+ if (t == 0) return; // cannot set to a type which is not avilable
+
+ // need to modify the instance property of the container
+ container->setInstancePropertyType(pindex,t);
+
+ delete[] typeName;
+ typeName = new char[name.length() + 1];
+ strcpy(typeName, name.c_str());
+
+ delete[] typeURI;
+ typeURI = new char[uri.length() + 1];
+ strcpy(typeURI, uri.c_str());
+
+ typeUnset = false;
+}
+
+void DataObjectListImpl::append (DataObjectPtr d)
+{
+
+ if (typeUnset)
+ {
+ setType(d->getType().getURI(), d->getType().getName());
+ }
+ if (container != 0)
+ {
+ container->logChange(pindex);
+ }
+
+ for (unsigned int i = 0; i < plist.size(); i++)
+ {
+ if (plist[i] == d)
+ {
+ std::string msg("Append of object which already exists in the list:");
+ msg += typeURI;
+ msg += " ";
+ msg += typeName;
+ throw SDOUnsupportedOperationException(TUSCANY_SDO_EINFO, msg.c_str());
+ }
+ }
+
+ checkFactory(d);
+
+ checkType(theFactory->getType(typeURI, typeName),
+ d->getType());
+
+ const Property& property = container->getPropertyFromIndex(pindex);
+ ASSERT_WRITABLE(property, append);
+
+ DataObject* dob = getRawPointer(d); // unwrap the data object ready for a downcasting hack.
+ DataObjectImpl* con = ((DataObjectImpl*) dob)->getContainerImpl();
+
+ if (!isReference)
+ {
+ if (con != 0)
+ {
+ if (con != container)
+ {
+ /* this data object is already contained somewhere else */
+ std::string msg("Append of object to list, object is already contained:");
+ msg += d->getType().getURI();
+ msg += " ";
+ msg += d->getType().getName();
+ throw SDOInvalidConversionException(TUSCANY_SDO_EINFO, msg.c_str());
+ }
+ }
+ else
+ {
+ ((DataObjectImpl*) dob)->setContainer(container);
+ if (!container->getPropertyFromIndex(pindex).getType().isDataType())
+ {
+ ((DataObjectImpl*) dob)->logCreation((DataObjectImpl*)dob,
+ container,
+ property);
+ }
+ }
+ }
+ plist.push_back(RefCountingPointer<DataObjectImpl>((DataObjectImpl*) dob));
+
+ if (container != 0) {
+ if (container->getType().isSequencedType())
+ {
+ SequenceImplPtr sq = container->getSequenceImpl();
+ if (sq)
+ {
+ sq->push(property, (plist.size() - 1));
+ }
+ }
+ }
+}
+
+void DataObjectListImpl::insert (unsigned int index, bool d)
+{
+ if (theFactory == 0) return;
+
+ if (typeUnset)setType(SDOUtils::sdoURI, BooleanLiteral);
+
+ DataObjectPtr dol = theFactory->create(typeURI, typeName);
+ DataObject* dob = getRawPointer(dol);
+ ((DataObjectImpl*)dob)->setBoolean(d);
+ insert(index, dol);
+}
+
+void DataObjectListImpl::append (bool d)
+{
+ if (theFactory == 0) return;
+
+ if (typeUnset)setType(SDOUtils::sdoURI, BooleanLiteral);
+
+ DataObjectPtr dol = theFactory->create(typeURI, typeName);
+ DataObject* dob = getRawPointer(dol);
+ ((DataObjectImpl*)dob)->setBoolean(d);
+ append( dol);
+}
+
+void DataObjectListImpl::insert (unsigned int index, char d)
+{
+ if (theFactory == 0) return;
+
+ if (typeUnset)setType(SDOUtils::sdoURI, ByteLiteral);
+
+ DataObjectPtr dol = theFactory->create(typeURI, typeName);
+ DataObject* dob = getRawPointer(dol);
+ ((DataObjectImpl*)dob)->setByte(d);
+ insert(index, dol);
+}
+
+void DataObjectListImpl::append (char d)
+{
+ if (theFactory == 0) return;
+
+ if (typeUnset)setType(SDOUtils::sdoURI, ByteLiteral);
+
+ DataObjectPtr dol = theFactory->create(typeURI, typeName);
+ DataObject* dob = getRawPointer(dol);
+ ((DataObjectImpl*)dob)->setByte(d);
+ append( dol);
+}
+
+void DataObjectListImpl::insert (unsigned int index, wchar_t d)
+{
+ if (theFactory == 0) return;
+
+ if (typeUnset)setType(SDOUtils::sdoURI, CharacterLiteral);
+
+ DataObjectPtr dol = theFactory->create(typeURI, typeName);
+ DataObject* dob = getRawPointer(dol);
+ ((DataObjectImpl*)dob)->setCharacter(d);
+ insert(index, dol);
+}
+
+void DataObjectListImpl::append (wchar_t d)
+{
+ if (theFactory == 0) return;
+
+ if (typeUnset)setType(SDOUtils::sdoURI, CharacterLiteral);
+
+ DataObjectPtr dol = theFactory->create(typeURI, typeName);
+ DataObject* dob = getRawPointer(dol);
+ ((DataObjectImpl*)dob)->setCharacter(d);
+ append( dol);
+}
+
+void DataObjectListImpl::insert (unsigned int index, const wchar_t* d, unsigned int length)
+{
+ if (theFactory == 0) return;
+
+ if (typeUnset)setType(SDOUtils::sdoURI, StringLiteral);
+
+ DataObjectPtr dol = theFactory->create(typeURI, typeName);
+ DataObject* dob = getRawPointer(dol);
+ ((DataObjectImpl*)dob)->setString(d, length);
+ insert(index, dol);
+}
+
+void DataObjectListImpl::append (const wchar_t* d, unsigned int length)
+{
+ if (theFactory == 0) return;
+
+ if (typeUnset)setType(SDOUtils::sdoURI, StringLiteral);
+
+ DataObjectPtr dol = theFactory->create(typeURI, typeName);
+ DataObject* dob = getRawPointer(dol);
+ ((DataObjectImpl*)dob)->setString(d, length);
+ append( dol);
+}
+void DataObjectListImpl::insert (unsigned int index, const char* d, unsigned int length)
+{
+ if (theFactory == 0) return;
+
+ if (typeUnset)setType(SDOUtils::sdoURI, BytesLiteral);
+
+ DataObjectPtr dol = theFactory->create(typeURI, typeName);
+ DataObject* dob = getRawPointer(dol);
+ ((DataObjectImpl*)dob)->setBytes(d, length);
+ insert(index, dol);
+}
+
+void DataObjectListImpl::append (const char* d, unsigned int length)
+{
+ if (theFactory == 0) return;
+
+ if (typeUnset)setType(SDOUtils::sdoURI, BytesLiteral);
+
+ DataObjectPtr dol = theFactory->create(typeURI, typeName);
+ DataObject* dob = getRawPointer(dol);
+ ((DataObjectImpl*)dob)->setBytes(d, length);
+ append( dol);
+}
+void DataObjectListImpl::insert (unsigned int index, const char* d)
+{
+ if (theFactory == 0) return;
+
+ if (typeUnset)setType(SDOUtils::sdoURI, StringLiteral);
+
+ DataObjectPtr dol = theFactory->create(typeURI, typeName);
+ DataObject* dob = getRawPointer(dol);
+ ((DataObjectImpl*)dob)->setCString(d);
+ insert(index, dol);
+}
+void DataObjectListImpl::insert (unsigned int index, const SDOString& d)
+{
+ if (theFactory == 0) return;
+
+ if (typeUnset)setType(SDOUtils::sdoURI, StringLiteral);
+
+ DataObjectPtr dol = theFactory->create(typeURI, typeName);
+ DataObject* dob = getRawPointer(dol);
+ ((DataObjectImpl*)dob)->setCString(d);
+ insert(index, dol);
+}
+
+void DataObjectListImpl::append (const char* d)
+{
+ if (theFactory == 0) return;
+
+ if (typeUnset)setType(SDOUtils::sdoURI, StringLiteral);
+
+ DataObjectPtr dol = theFactory->create(typeURI, typeName);
+ DataObject* dob = getRawPointer(dol);
+ ((DataObjectImpl*)dob)->setCString(d);
+ append( dol);
+}
+
+void DataObjectListImpl::append (const SDOString& d)
+{
+ if (theFactory == 0) return;
+
+ if (typeUnset)setType(SDOUtils::sdoURI, StringLiteral);
+
+ DataObjectPtr dol = theFactory->create(typeURI, typeName);
+ DataObject* dob = getRawPointer(dol);
+ ((DataObjectImpl*)dob)->setCString(d);
+ append( dol);
+}
+
+void DataObjectListImpl::append (const SDOValue& sval)
+{
+ if (theFactory == 0) return;
+
+ if (typeUnset)setType(SDOUtils::sdoURI, StringLiteral);
+
+ DataObjectPtr dol = theFactory->create(typeURI, typeName);
+ DataObject* dob = getRawPointer(dol);
+ ((DataObjectImpl*)dob)->setSDOValue(sval);
+ append(dol);
+}
+
+void DataObjectListImpl::insert (unsigned int index, short d)
+{
+ if (theFactory == 0) return;
+
+ if (typeUnset)setType(SDOUtils::sdoURI, ShortLiteral);
+
+ DataObjectPtr dol = theFactory->create(typeURI, typeName);
+ DataObject* dob = getRawPointer(dol);
+ ((DataObjectImpl*)dob)->setShort(d);
+ insert(index, dol);
+}
+
+void DataObjectListImpl::append (short d)
+{
+ if (theFactory == 0) return;
+
+ if (typeUnset)setType(SDOUtils::sdoURI, ShortLiteral);
+
+ DataObjectPtr dol = theFactory->create(typeURI, typeName);
+ DataObject* dob = getRawPointer(dol);
+ ((DataObjectImpl*)dob)->setShort(d);
+ append( dol);
+}
+
+
+#if __WORDSIZE !=64
+void DataObjectListImpl::insert (unsigned int index, long d)
+{
+ if (theFactory == 0) return;
+
+ if (typeUnset)setType(SDOUtils::sdoURI, IntLiteral);
+
+ DataObjectPtr dol = theFactory->create(typeURI, typeName);
+ DataObject* dob = getRawPointer(dol);
+ ((DataObjectImpl*)dob)->setInt(d);
+ insert(index, dol);
+}
+
+void DataObjectListImpl::append (long d)
+{
+ if (theFactory == 0) return;
+
+ if (typeUnset)setType(SDOUtils::sdoURI, IntLiteral);
+
+ DataObjectPtr dol = theFactory->create(typeURI, typeName);
+ DataObject* dob = getRawPointer(dol);
+ ((DataObjectImpl*)dob)->setInt(d);
+ append( dol);
+}
+#endif
+
+void DataObjectListImpl::insert (unsigned int index, const SDODate d)
+{
+ if (theFactory == 0) return;
+
+ if (typeUnset)setType(SDOUtils::sdoURI, DateLiteral);
+
+ DataObjectPtr dol = theFactory->create(typeURI, typeName);
+ DataObject* dob = getRawPointer(dol);
+ ((DataObjectImpl*)dob)->setDate(d);
+ insert(index, dol);
+}
+
+void DataObjectListImpl::append (const SDODate d)
+{
+ if (theFactory == 0) return;
+
+ if (typeUnset)setType(SDOUtils::sdoURI, DateLiteral);
+
+ DataObjectPtr dol = theFactory->create(typeURI, typeName);
+ DataObject* dob = getRawPointer(dol);
+ ((DataObjectImpl*)dob)->setDate(d);
+ append( dol);
+}
+
+void DataObjectListImpl::insert (unsigned int index, int64_t d)
+{
+ if (theFactory == 0) return;
+
+ if (typeUnset)setType(SDOUtils::sdoURI, LongLiteral);
+
+ DataObjectPtr dol = theFactory->create(typeURI, typeName);
+ DataObject* dob = getRawPointer(dol);
+ ((DataObjectImpl*)dob)->setLong(d);
+ insert(index, dol);
+}
+
+void DataObjectListImpl::append (int64_t d)
+{
+ if (theFactory == 0) return;
+
+ if (typeUnset)setType(SDOUtils::sdoURI, LongLiteral);
+
+ DataObjectPtr dol = theFactory->create(typeURI, typeName);
+ DataObject* dob = getRawPointer(dol);
+ ((DataObjectImpl*)dob)->setLong(d);
+ append( dol);
+}
+
+void DataObjectListImpl::insert (unsigned int index, float d)
+{
+ if (theFactory == 0) return;
+
+ if (typeUnset)setType(SDOUtils::sdoURI, FloatLiteral);
+
+ DataObjectPtr dol = theFactory->create(typeURI, typeName);
+ DataObject* dob = getRawPointer(dol);
+ ((DataObjectImpl*)dob)->setFloat(d);
+ insert(index, dol);
+}
+
+void DataObjectListImpl::append (float d)
+{
+ if (theFactory == 0) return;
+
+ if (typeUnset)setType(SDOUtils::sdoURI, FloatLiteral);
+
+ DataObjectPtr dol = theFactory->create(typeURI, typeName);
+ DataObject* dob = getRawPointer(dol);
+ ((DataObjectImpl*)dob)->setFloat(d);
+ append( dol);
+}
+
+void DataObjectListImpl::insert (unsigned int index, long double d)
+{
+ if (theFactory == 0) return;
+
+ if (typeUnset)setType(SDOUtils::sdoURI, DoubleLiteral);
+
+ DataObjectPtr dol = theFactory->create(typeURI, typeName);
+ DataObject* dob = getRawPointer(dol);
+ ((DataObjectImpl*)dob)->setDouble(d);
+ insert(index, dol);
+}
+
+void DataObjectListImpl::append (long double d)
+{
+ if (theFactory == 0) return;
+
+ if (typeUnset)setType(SDOUtils::sdoURI, DoubleLiteral);
+
+ DataObjectPtr dol = theFactory->create(typeURI, typeName);
+ DataObject* dob = getRawPointer(dol);
+ ((DataObjectImpl*)dob)->setDouble(d);
+ append( dol);
+}
+
+
+void DataObjectListImpl::decrementPindex()
+{
+ pindex--;
+}
+
+
+DataObjectPtr DataObjectListImpl::remove(unsigned int index)
+{
+ validateIndex(index);
+ if (container != 0)
+ {
+ container->logChange(pindex);
+ }
+ DataObjectPtr d = (*this)[index];
+ const Property& p = container->getPropertyFromIndex(pindex);
+
+ // log deletion only if the list is of data objects.
+ if (theFactory != 0)
+ {
+ const Type& t = theFactory->getType(typeURI,typeName);
+
+ if (!t.isDataType() && !p.isReference())
+ {
+ (getVec()[index])->logDeletion();
+ }
+ }
+
+ plist.erase(plist.begin()+index);
+ DataObject* dob = getRawPointer(d);
+
+ if (p.isContainment()) {
+ ((DataObjectImpl*)dob)->setContainer(0);
+ }
+
+ return d;
+
+}
+
+void DataObjectListImpl::validateIndex(unsigned int index) const
+{
+ if ((index < 0) || (index >= size()))
+ {
+ char val[32];
+ std::string msg("Index out of range:");
+ sprintf(val,"%d",index);
+ msg += val;
+ throw SDOIndexOutOfRangeException(TUSCANY_SDO_EINFO, msg.c_str());
+ }
+
+}
+
+bool DataObjectListImpl::getBoolean(unsigned int index) const
+{
+ validateIndex(index);
+ DataObjectPtr d = ((*this)[index]);
+ DataObject* dob = getRawPointer(d);
+ return ((DataObjectImpl*)dob)->getBoolean();
+}
+char DataObjectListImpl::getByte(unsigned int index) const
+{
+ validateIndex(index);
+ DataObjectPtr d = ((*this)[index]);
+ DataObject* dob = getRawPointer(d);
+ return ((DataObjectImpl*)dob)->getByte();
+}
+wchar_t DataObjectListImpl::getCharacter(unsigned int index) const
+{
+ validateIndex(index);
+ DataObjectPtr d = ((*this)[index]);
+ DataObject* dob = getRawPointer(d);
+ return ((DataObjectImpl*)dob)->getCharacter();
+}
+unsigned int DataObjectListImpl::getBytes(unsigned int index, char* value, unsigned int max) const
+{
+ validateIndex(index);
+ DataObjectPtr d = ((*this)[index]);
+ DataObject* dob = getRawPointer(d);
+ return ((DataObjectImpl*)dob)->getBytes(value, max);
+}
+unsigned int DataObjectListImpl::getString(unsigned int index, wchar_t* value, unsigned int max) const
+{
+ validateIndex(index);
+ DataObjectPtr d = ((*this)[index]);
+ DataObject* dob = getRawPointer(d);
+ return ((DataObjectImpl*)dob)->getString(value, max);
+}
+short DataObjectListImpl::getShort(unsigned int index) const
+{
+ validateIndex(index);
+ DataObjectPtr d = ((*this)[index]);
+ DataObject* dob = getRawPointer(d);
+ return ((DataObjectImpl*)dob)->getShort();
+}
+long DataObjectListImpl::getInt(unsigned int index) const
+{
+ validateIndex(index);
+ DataObjectPtr d = ((*this)[index]);
+ DataObject* dob = getRawPointer(d);
+ return ((DataObjectImpl*)dob)->getInt();
+}
+int64_t DataObjectListImpl::getLong(unsigned int index) const
+{
+ validateIndex(index);
+ DataObjectPtr d = ((*this)[index]);
+ DataObject* dob = getRawPointer(d);
+ return ((DataObjectImpl*)dob)->getLong();
+}
+float DataObjectListImpl::getFloat(unsigned int index) const
+{
+ validateIndex(index);
+ DataObjectPtr d = ((*this)[index]);
+ DataObject* dob = getRawPointer(d);
+ return ((DataObjectImpl*)dob)->getFloat();
+}
+long double DataObjectListImpl::getDouble(unsigned int index) const
+{
+ validateIndex(index);
+ DataObjectPtr d = ((*this)[index]);
+ DataObject* dob = getRawPointer(d);
+ return ((DataObjectImpl*)dob)->getDouble();
+}
+const SDODate DataObjectListImpl::getDate(unsigned int index) const
+{
+ validateIndex(index);
+ DataObjectPtr d = ((*this)[index]);
+ DataObject* dob = getRawPointer(d);
+ return ((DataObjectImpl*)dob)->getDate();
+}
+const char* DataObjectListImpl::getCString(unsigned int index) const
+{
+ validateIndex(index);
+ DataObjectPtr d = ((*this)[index]);
+ DataObject* dob = getRawPointer(d);
+ return ((DataObjectImpl*)dob)->getCString();
+}
+
+DataObjectPtr DataObjectListImpl::getDataObject(unsigned int index) const
+{
+ validateIndex(index);
+ return (*this)[index];
+}
+
+void DataObjectListImpl::setBoolean(unsigned int index, bool d)
+{
+ validateIndex(index);
+ if (container != 0)
+ {
+ container->logChange(pindex);
+ }
+ DataObjectPtr dd = ((*this)[index]);
+ DataObject* dob = getRawPointer(dd);
+ ((DataObjectImpl*)dob)->setBoolean(d);
+}
+void DataObjectListImpl::setByte(unsigned int index, char d)
+{
+ validateIndex(index);
+ if (container != 0)
+ {
+ container->logChange(pindex);
+ }
+ DataObjectPtr dd = ((*this)[index]);
+ DataObject* dob = getRawPointer(dd);
+ ((DataObjectImpl*)dob)->setByte(d);
+}
+void DataObjectListImpl::setCharacter(unsigned int index, wchar_t d)
+{
+ validateIndex(index);
+ if (container != 0)
+ {
+ container->logChange(pindex);
+ }
+ DataObjectPtr dd = ((*this)[index]);
+ DataObject* dob = getRawPointer(dd);
+ ((DataObjectImpl*)dob)->setCharacter(d);
+}
+
+void DataObjectListImpl::setString(unsigned int index, const wchar_t* d, unsigned int len)
+{
+ validateIndex(index);
+ if (container != 0)
+ {
+ container->logChange(pindex);
+ }
+ DataObjectPtr dd = ((*this)[index]);
+ DataObject* dob = getRawPointer(dd);
+ ((DataObjectImpl*)dob)->setString(d, len);
+}
+void DataObjectListImpl::setBytes(unsigned int index, const char* d, unsigned int len)
+{
+ validateIndex(index);
+ if (container != 0)
+ {
+ container->logChange(pindex);
+ }
+ DataObjectPtr dd = ((*this)[index]);
+ DataObject* dob = getRawPointer(dd);
+ ((DataObjectImpl*)dob)->setBytes(d, len);
+}
+
+void DataObjectListImpl::setShort(unsigned int index, short d)
+{
+ validateIndex(index);
+ if (container != 0)
+ {
+ container->logChange(pindex);
+ }
+ DataObjectPtr dd = ((*this)[index]);
+ DataObject* dob = getRawPointer(dd);
+ ((DataObjectImpl*)dob)->setShort(d);
+}
+void DataObjectListImpl::setInt(unsigned int index, long d)
+{
+ validateIndex(index);
+ if (container != 0)
+ {
+ container->logChange(pindex);
+ }
+ DataObjectPtr dd = ((*this)[index]);
+ DataObject* dob = getRawPointer(dd);
+ ((DataObjectImpl*)dob)->setInt(d);
+}
+void DataObjectListImpl::setLong(unsigned int index, int64_t d)
+{
+ validateIndex(index);
+ if (container != 0)
+ {
+ container->logChange(pindex);
+ }
+ DataObjectPtr dd = ((*this)[index]);
+ DataObject* dob = getRawPointer(dd);
+ ((DataObjectImpl*)dob)->setLong(d);
+}
+void DataObjectListImpl::setFloat(unsigned int index, float d)
+{
+ validateIndex(index);
+ if (container != 0)
+ {
+ container->logChange(pindex);
+ }
+ DataObjectPtr dd = ((*this)[index]);
+ DataObject* dob = getRawPointer(dd);
+ ((DataObjectImpl*)dob)->setFloat(d);
+}
+void DataObjectListImpl::setDouble(unsigned int index, long double d)
+{
+ validateIndex(index);
+ if (container != 0)
+ {
+ container->logChange(pindex);
+ }
+ DataObjectPtr dd = ((*this)[index]);
+ DataObject* dob = getRawPointer(dd);
+ ((DataObjectImpl*)dob)->setDouble(d);
+}
+void DataObjectListImpl::setDate(unsigned int index, const SDODate d)
+{
+ validateIndex(index);
+ if (container != 0)
+ {
+ container->logChange(pindex);
+ }
+ DataObjectPtr dd = ((*this)[index]);
+ DataObject* dob = getRawPointer(dd);
+ ((DataObjectImpl*)dob)->setDate(d);
+}
+void DataObjectListImpl::setCString(unsigned int index, char* d)
+{
+ validateIndex(index);
+ if (container != 0)
+ {
+ container->logChange(pindex);
+ }
+ DataObjectPtr dd = ((*this)[index]);
+ DataObject* dob = getRawPointer(dd);
+ ((DataObjectImpl*)dob)->setCString(d);
+}
+void DataObjectListImpl::setCString(unsigned int index, const SDOString& d)
+{
+ validateIndex(index);
+ if (container != 0)
+ {
+ container->logChange(pindex);
+ }
+ DataObjectPtr dd = ((*this)[index]);
+ DataObject* dob = getRawPointer(dd);
+ ((DataObjectImpl*)dob)->setCString(d);
+}
+
+void DataObjectListImpl::setDataObject(unsigned int index, DataObjectPtr dob)
+{
+
+ if (dob != 0)
+ {
+ checkFactory(dob);
+
+ checkType(theFactory->getType(typeURI,typeName),
+ dob->getType());
+ }
+
+ validateIndex(index);
+ if (container != 0)
+ {
+ container->logChange(pindex);
+ }
+
+ remove(index);
+ insert(index,dob);
+}
+
+unsigned int DataObjectListImpl::getLength(unsigned int index) const
+{
+ validateIndex(index);
+ DataObjectPtr dd = ((*this)[index]);
+ DataObject* dob = getRawPointer(dd);
+ return dob->getLength();
+}
+
+ const SDOString DataObjectListImpl::BooleanLiteral = "Boolean";
+ const SDOString DataObjectListImpl::ByteLiteral = "Byte";
+ const SDOString DataObjectListImpl::CharacterLiteral = "Character";
+ const SDOString DataObjectListImpl::BytesLiteral = "Bytes";
+ const SDOString DataObjectListImpl::StringLiteral = "String";
+ const SDOString DataObjectListImpl::IntLiteral = "Int";
+ const SDOString DataObjectListImpl::ShortLiteral = "Short";
+ const SDOString DataObjectListImpl::DateLiteral = "Date";
+ const SDOString DataObjectListImpl::LongLiteral = "Long";
+ const SDOString DataObjectListImpl::FloatLiteral = "Float";
+ const SDOString DataObjectListImpl::DoubleLiteral = "Double";
+
+};
+};
diff --git a/sdo-cpp/trunk/runtime/core/src/commonj/sdo/DataObjectListImpl.h b/sdo-cpp/trunk/runtime/core/src/commonj/sdo/DataObjectListImpl.h
new file mode 100644
index 0000000000..acddd7dfc3
--- /dev/null
+++ b/sdo-cpp/trunk/runtime/core/src/commonj/sdo/DataObjectListImpl.h
@@ -0,0 +1,221 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you 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$ */
+
+#ifndef _DATAOBJECTLISTIMPL_H_
+#define _DATAOBJECTLISTIMPL_H_
+
+#include "commonj/sdo/DataObjectList.h"
+#include "commonj/sdo/SDODate.h"
+#include "commonj/sdo/SDOValue.h"
+
+#include "commonj/sdo/disable_warn.h"
+
+#include <vector>
+
+
+namespace commonj{
+namespace sdo{
+
+typedef std::vector<DataObjectImplPtr> DATAOBJECT_VECTOR;
+
+/**
+ * DataObjectListImpl implements the abstract class DataObjectList.
+ * List for retrieving many valued property values.
+ *
+ * DataObjectList provides an API for getting and setting values in
+ * many valued properties. The list deals with both DataType and
+ * DataObjectType properties.
+ */
+
+class DataObjectListImpl : public DataObjectList
+{
+
+public:
+ DataObjectListImpl(DATAOBJECT_VECTOR p);
+ DataObjectListImpl(const DataObjectListImpl &pin);
+ DataObjectListImpl();
+ DataObjectListImpl(DataFactoryImplPtr df, DataObjectImpl* cont, unsigned int inpindex,
+ const char* tURI, const char* tName);
+
+ virtual ~DataObjectListImpl();
+
+ // open type support
+ virtual void decrementPindex();
+
+ virtual DataObjectPtr operator[] (unsigned int pos);
+ virtual const DataObjectPtr operator[] (unsigned int pos) const;
+
+ // set/get primitive values
+ virtual bool getBoolean(unsigned int index) const;
+ virtual char getByte(unsigned int index) const;
+ virtual wchar_t getCharacter(unsigned int index) const;
+ virtual unsigned int getString(unsigned int index, wchar_t* buf,
+ unsigned int max) const;
+ virtual unsigned int getBytes(unsigned int index, char* buf,
+ unsigned int max) const;
+ virtual short getShort(unsigned int index) const;
+ virtual long getInt(unsigned int index) const;
+ virtual int64_t getLong(unsigned int index) const;
+ virtual float getFloat(unsigned int index) const;
+ virtual long double getDouble(unsigned int index) const;
+ virtual const SDODate getDate(unsigned int index) const;
+ virtual const char* getCString(unsigned int index) const;
+ virtual DataObjectPtr getDataObject(unsigned int index) const;
+
+ virtual void setBoolean(unsigned int index, bool d);
+ virtual void setByte(unsigned int index, char d);
+ virtual void setCharacter(unsigned int index, wchar_t d);
+ virtual void setString(unsigned int index, const wchar_t* d, unsigned int len);
+ virtual void setBytes(unsigned int index, const char* d, unsigned int len);
+ virtual void setShort(unsigned int index, short d);
+ virtual void setInt(unsigned int index, long d);
+ virtual void setLong(unsigned int index, int64_t d);
+ virtual void setFloat(unsigned int index, float d);
+ 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;
+
+ virtual unsigned int size () const;
+
+ virtual void insert (unsigned int index, DataObjectPtr d);
+ virtual void append (DataObjectPtr d);
+
+ virtual void insert (unsigned int index, bool d) ;
+ virtual void append (bool d) ;
+
+ virtual void insert (unsigned int index, char d) ;
+ virtual void append (char d) ;
+
+ virtual void insert (unsigned int index, wchar_t d) ;
+ virtual void append (wchar_t d) ;
+
+ virtual void insert (unsigned int index, const wchar_t* d, unsigned int len) ;
+ virtual void append (const wchar_t* d, unsigned int len) ;
+
+ virtual void insert (unsigned int index, const char* d, unsigned int len) ;
+ 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) ;
+
+ virtual void append (const SDOValue& sval);
+
+ virtual void insert (unsigned int index, short d) ;
+ virtual void append (short d) ;
+
+ virtual void insert (unsigned int index, const SDODate d) ;
+ virtual void append (const SDODate d) ;
+
+#if __WORDSIZE !=64
+ virtual void insert (unsigned int index, long d) ;
+ virtual void append (long d) ;
+#endif
+
+ virtual void insert (unsigned int index, int64_t d) ;
+ virtual void append (int64_t d) ;
+
+ virtual void insert (unsigned int index, float d) ;
+ virtual void append (float d) ;
+
+ virtual void insert (unsigned int index, long double d) ;
+ virtual void append (long double d) ;
+
+
+ virtual DataObjectPtr remove (unsigned int index);
+
+ virtual void checkFactory(DataObjectPtr dob);
+ virtual void checkType(const Type& listType, const Type& objectType);
+ virtual void setType(const char* uri, const char* name);
+ virtual void setType(const SDOString& uri, const SDOString& name);
+
+ /* getType returns type
+ *
+ * Returns the type.
+ * May throw SDOTYpeNotFoundException for unset open types
+ */
+
+
+ virtual const Type& getType();
+
+ /* getTypeEnum returns an enumerator for the type
+ *
+ * Returns an enumerator for the type for easy switching on basic types.
+ * The enumerator is part of the Type class
+ * May throw SDOTypeNotFoundException for open types
+ */
+
+ virtual const Type::Types getTypeEnum();
+
+
+private:
+ DATAOBJECT_VECTOR plist;
+ DATAOBJECT_VECTOR getVec() const;
+
+ // For creation of items via the insert/append api.
+ char* typeURI;
+ char* typeName;
+
+ // for open types, the list may not have a type until the
+ // first item is entered
+
+ bool typeUnset;
+
+ DataFactoryImplPtr theFactory;
+
+ // For logging a change in the change summary when appending
+ DataObjectImpl* container;
+ unsigned int pindex;
+ bool isReference;
+
+ void validateIndex(unsigned int index) const;
+
+ static const SDOString BooleanLiteral;
+ static const SDOString ByteLiteral;
+ static const SDOString CharacterLiteral;
+ static const SDOString BytesLiteral;
+ static const SDOString StringLiteral;
+ static const SDOString IntLiteral;
+ static const SDOString ShortLiteral;
+ static const SDOString DateLiteral;
+ static const SDOString LongLiteral;
+ static const SDOString FloatLiteral;
+ static const SDOString DoubleLiteral;
+
+};
+};
+};
+
+#define ASSERT_WRITABLE(property,method)\
+ if ((property).isReadOnly())\
+ { \
+ SDOString stringBuffer = (property).getName(); \
+ stringBuffer += "is read-only."; \
+ throw SDOUnsupportedOperationException(TUSCANY_SDO_EINFO, \
+ stringBuffer.c_str()); \
+ }
+
+#endif
diff --git a/sdo-cpp/trunk/runtime/core/src/commonj/sdo/DataTypeInfo.cpp b/sdo-cpp/trunk/runtime/core/src/commonj/sdo/DataTypeInfo.cpp
new file mode 100644
index 0000000000..9d86a7dbc8
--- /dev/null
+++ b/sdo-cpp/trunk/runtime/core/src/commonj/sdo/DataTypeInfo.cpp
@@ -0,0 +1,73 @@
+/*
+*
+* Copyright 2007 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$ */
+
+#include "commonj/sdo/SDOString.h"
+#include "commonj/sdo/DataTypeInfo.h"
+
+namespace commonj
+{
+ namespace sdo
+ {
+
+ const char*
+ DataTypeInfo::convertTypeEnumToString(TrueDataType dataType)
+ {
+ switch(dataType) {
+ case TDTbool:
+ return "Boolean";
+ break;
+ case TDTchar:
+ return "Byte";
+ break;
+ case TDTwchar_t:
+ return "Character";
+ break;
+ case TDTshort:
+ return "Short";
+ break;
+ case TDTlong:
+ return "Int";
+ break;
+ case TDTint64_t:
+ return "Long";
+ break;
+ case TDTfloat:
+ return "Float";
+ break;
+ case TDTdouble:
+ return "Double";
+ break;
+ case TDTSDODate:
+ return "Date";
+ break;
+ case TDTCString:
+ return "String";
+ break;
+ case TDTByteArray:
+ return "Bytes";
+ break;
+ case TDTWideString:
+ return "String";
+ break;
+ };
+ return "No Such Type";
+ }
+
+ } // end namespace sdo
+} // end namespace commonj
diff --git a/sdo-cpp/trunk/runtime/core/src/commonj/sdo/DataTypeInfo.h b/sdo-cpp/trunk/runtime/core/src/commonj/sdo/DataTypeInfo.h
new file mode 100644
index 0000000000..49a6b7cbe3
--- /dev/null
+++ b/sdo-cpp/trunk/runtime/core/src/commonj/sdo/DataTypeInfo.h
@@ -0,0 +1,135 @@
+/*
+*
+* Copyright 2007 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$ */
+
+#ifndef _DATATYPEINFO_H_
+#define _DATATYPEINFO_H_
+
+#include "commonj/sdo/SDODate.h"
+#include "commonj/sdo/SDOString.h"
+
+namespace commonj
+{
+ namespace sdo
+ {
+
+ // The DataTypeInfo class provides types that encapsulate the various
+ // primitive data types that SDO uses to represent the user level data
+ // types defined in the specification. The central artifact is a union
+ // of all the C++ data types that are used to represent SDO data
+ // types. This is augmented by enumerations that provide a convenient
+ // way to label a particular type, plus a method to retrieve a text
+ // representation of each enumeration value.
+
+ // There are three different array-like primitive data types.
+ // 1. CString: An array of char, terminated by a 0 ie a C style string.
+ // 2. ByteArray: An array of bytes. Similar to 1. but without the null
+ // terminator.
+ // 3. String: An array of wchar_t, terminated by a 0. In the SDOValue
+ // class, the first two are stored in an SDOString (ie std::string),
+ // while the third is stored explicitly as a pointer to a buffer.
+
+ class DataTypeInfo
+ {
+ public:
+ // The values of TrueDataType are used as subscripts for an array
+ // so they must a) start at zero and b) be contiguous. Elsewhere,
+ // TDTWideString is used as the definition of the largest
+ // TrueDatatype value, so if any constants are added beyond it the
+ // code that depends on it will have to be changed.
+ enum TrueDataType
+ {
+ TDTbool = 0,
+ TDTchar = 1,
+ TDTwchar_t = 2,
+ TDTshort = 3,
+ TDTlong = 4,
+ TDTint64_t = 5,
+ TDTfloat = 6,
+ TDTdouble = 7,
+ TDTSDODate = 8,
+ TDTCString = 9,
+ TDTByteArray = 10,
+ TDTWideString = 11
+ };
+
+ enum PseudoDataType
+ {
+ PDTunset = -2,
+ PDTnull = -1
+ };
+
+ // This enum identifies what C++ datatype is present in the union.
+ // It does not necessarily say what the SDO type is. Since it is
+ // possible for a value to be either unset or null there are
+ // enumerations for those cases too. This enum is effectively a
+ // union of the two previous enums where TrueDataType includes
+ // just those data types that can actually have values, while
+ // PseudoDataType includes just null and unset. This allows for
+ // methods that have to be told which type to create and for which
+ // unset and null are inappropriate.
+ enum RawDataType
+ {
+ SDOunset = PDTunset,
+ SDOnull = PDTnull,
+ SDObool = TDTbool,
+ SDOchar = TDTchar,
+ SDOwchar_t = TDTwchar_t,
+ SDOshort = TDTshort,
+ SDOlong = TDTlong,
+ SDOint64_t = TDTint64_t,
+ SDOfloat = TDTfloat,
+ SDOdouble = TDTdouble,
+ SDOSDODate = TDTSDODate,
+ SDOCString = TDTCString,
+ SDOByteArray = TDTByteArray,
+ SDOWideString = TDTWideString,
+ };
+
+ // Entities with copy constructors/destructors are not allowed in a union,
+ // since in general, the compiler doesn't know what type is
+ // actually in there so it can't know which constructor/destructor
+ // to call, hence the use of pointers for dates and strings
+ union SDODataTypeUnion
+ {
+ bool Boolean;
+ char Character;
+ wchar_t WideChar;
+ short Short;
+ long Int;
+ int64_t Int64;
+ float Float;
+ long double Double;
+ SDODate* Date;
+ SDOString* TextString;
+ struct
+ {
+ wchar_t* data;
+ unsigned int length;
+ } WideString;
+ };
+
+ static const char* convertTypeEnumToString(TrueDataType dataType);
+
+ private:
+
+ };
+ } // End - namespace sdo
+} // End - namespace commonj
+
+#endif // _DATATYPEINFO_H_
diff --git a/sdo-cpp/trunk/runtime/core/src/commonj/sdo/DefaultLogWriter.cpp b/sdo-cpp/trunk/runtime/core/src/commonj/sdo/DefaultLogWriter.cpp
new file mode 100644
index 0000000000..cf9029afa9
--- /dev/null
+++ b/sdo-cpp/trunk/runtime/core/src/commonj/sdo/DefaultLogWriter.cpp
@@ -0,0 +1,55 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you 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$ */
+
+#include "commonj/sdo/disable_warn.h"
+#include "commonj/sdo/DefaultLogWriter.h"
+
+#include <iostream>
+using namespace std;
+
+namespace commonj
+{
+ namespace sdo
+ {
+
+ DefaultLogWriter::DefaultLogWriter()
+ {
+ formatindent = 0;
+ }
+
+ DefaultLogWriter::~DefaultLogWriter()
+ {
+ }
+
+ void DefaultLogWriter::log(int indent, int level, const char* msg)
+ {
+ if (indent < 0) formatindent += indent;
+ for (int i=0; i < formatindent; i++)
+ {
+ cout << " ";
+ }
+ cout << msg <<endl;
+ if (indent > 0) formatindent += indent;
+ }
+
+ } // End namespace sca
+} // End namespace commonj
+
diff --git a/sdo-cpp/trunk/runtime/core/src/commonj/sdo/DefaultLogWriter.h b/sdo-cpp/trunk/runtime/core/src/commonj/sdo/DefaultLogWriter.h
new file mode 100644
index 0000000000..deab314ef7
--- /dev/null
+++ b/sdo-cpp/trunk/runtime/core/src/commonj/sdo/DefaultLogWriter.h
@@ -0,0 +1,54 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you 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$ */
+
+#ifndef SDO_DefaultLOGWriter_H
+#define SDO_DefaultLOGWriter_H
+
+#include "commonj/sdo/LogWriter.h"
+
+
+
+namespace commonj
+{
+ namespace sdo
+ {
+
+/**
+ * DefaultLogWriter is a basic log writer, part of the logger.
+ * The logging API holds a log writer , and uses it to send
+ * output whereever it is needed. The application writer would
+ * hook their own LogWriter in place of this simple one.
+ */
+ class DefaultLogWriter : public LogWriter
+ {
+ public:
+
+ DefaultLogWriter();
+ virtual ~DefaultLogWriter();
+
+ virtual void log(int indent, int level, const char* msg);
+ private:
+ int formatindent;
+ };
+
+ } // End namespace sca
+} // End namespace commonj
+#endif // SDO_DefaultLOGWriter_H
diff --git a/sdo-cpp/trunk/runtime/core/src/commonj/sdo/EqualityHelper.cpp b/sdo-cpp/trunk/runtime/core/src/commonj/sdo/EqualityHelper.cpp
new file mode 100644
index 0000000000..03829622c0
--- /dev/null
+++ b/sdo-cpp/trunk/runtime/core/src/commonj/sdo/EqualityHelper.cpp
@@ -0,0 +1,372 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you 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$ */
+
+#include "commonj/sdo/Property.h"
+#include "commonj/sdo/Type.h"
+#include "commonj/sdo/TypeList.h"
+#include "commonj/sdo/Sequence.h"
+
+#include "commonj/sdo/DataObject.h"
+
+
+
+#include "commonj/sdo/EqualityHelper.h"
+
+namespace commonj{
+namespace sdo{
+
+ bool EqualityHelper::compareitem(DataObjectPtr to, DataObjectPtr from, const Property& p)
+ {
+ switch (p.getTypeEnum())
+ {
+ case Type::BooleanType:
+ return (to->getBoolean(p) == from->getBoolean(p));
+ case Type::ByteType:
+ return (to->getByte(p) == from->getByte(p));
+ case Type::CharacterType:
+ return (to->getCharacter(p) == from->getCharacter(p));
+ case Type::IntType:
+ return (to->getInt(p) == from->getInt(p));
+ case Type::ShortType:
+ return (to->getShort(p) == from->getShort(p));
+ case Type::DoubleType:
+ return (to->getDouble(p) == from->getDouble(p));
+ case Type::FloatType:
+ return (to->getFloat(p) == from->getFloat(p));
+ case Type::LongType:
+ return (to->getLong(p) == from->getLong(p));
+ case Type::DateType:
+ return (to->getDate(p).getTime() == from->getDate(p).getTime());
+ case Type::BigDecimalType:
+ case Type::BigIntegerType:
+ case Type::UriType:
+ case Type::StringType:
+ {
+ unsigned int siz = from->getLength(p);
+ if (siz != to->getLength(p)) return false;
+
+ if (siz > 0)
+ {
+ wchar_t * buff = new wchar_t[siz];
+ wchar_t * buft = new wchar_t[siz];
+ from->getString(p, buff, siz);
+ to->getString(p, buft, siz);
+ for (unsigned int i=0;i< siz; i++)
+ {
+ if (buff[i] != buft[i])
+ {
+ delete buff;
+ delete buft;
+ return false;
+ }
+ }
+ delete[] buff;
+ delete[] buft;
+ }
+ return true;
+ }
+ case Type::BytesType:
+ {
+ unsigned int siz = from->getLength(p);
+ if (siz != to->getLength(p)) return false;
+
+ if (siz > 0)
+ {
+ char * buff = new char[siz];
+ char * buft = new char[siz];
+ from->getBytes(p, buff, siz);
+ to->getBytes(p, buft, siz);
+ for (unsigned int i=0;i< siz; i++)
+ {
+ if (buff[i] != buft[i])
+ {
+ delete buff;
+ delete buft;
+ return false;
+ }
+ }
+ delete buff;
+ delete buft;
+ }
+ return true;
+ }
+ default:
+ return true;
+ } // switch
+ }
+
+ bool EqualityHelper::comparelist(DataObjectList& to, DataObjectList& from, Type::Types t)
+ {
+ switch (t)
+ {
+ case Type::BooleanType:
+ {
+ for (unsigned int i=0;i< from.size(); i++)
+ {
+ if (to.getBoolean(i) != from.getBoolean(i))
+ {
+ return false;
+ }
+ }
+ return true;
+ }
+
+ case Type::ByteType:
+ {
+ for (unsigned int i=0;i< from.size(); i++)
+ {
+ if (to.getByte(i) != from.getByte(i))
+ {
+ return false;
+ }
+ }
+ return true;
+ }
+
+ case Type::CharacterType:
+ {
+ for (unsigned int i=0;i< from.size(); i++)
+ {
+ if (to.getCharacter(i) != from.getCharacter(i))
+ {
+ return false;
+ }
+ }
+ return true;
+ }
+
+ case Type::IntType:
+ {
+ for (unsigned int i=0;i< from.size(); i++)
+ {
+ if (to.getInt(i) != from.getInt(i))
+ {
+ return false;
+ }
+ }
+ return true;
+ }
+
+ case Type::ShortType:
+ {
+ for (unsigned int i=0;i< from.size(); i++)
+ {
+ if (to.getShort(i) != from.getShort(i))
+ {
+ return false;
+ }
+ }
+ return true;
+ }
+ case Type::DoubleType:
+ {
+ for (unsigned int i=0;i< from.size(); i++)
+ {
+ if (to.getDouble(i) != from.getDouble(i))
+ {
+ return false;
+ }
+ }
+ return true;
+ }
+
+ case Type::FloatType:
+ {
+ for (unsigned int i=0;i< from.size(); i++)
+ {
+ if (to.getFloat(i) != from.getFloat(i))
+ {
+ return false;
+ }
+ }
+ return true;
+ }
+
+ case Type::LongType:
+ {
+ for (unsigned int i=0;i< from.size(); i++)
+ {
+ if (to.getLong(i) != from.getLong(i))
+ {
+ return false;
+ }
+ }
+ return true;
+ }
+
+ case Type::DateType:
+ {
+ for (unsigned int i=0;i< from.size(); i++)
+ {
+ if (to.getDate(i).getTime() != from.getDate(i).getTime())
+ {
+ return false;
+ }
+ }
+ return true;
+ }
+
+ case Type::BigDecimalType:
+ case Type::BigIntegerType:
+ case Type::UriType:
+ case Type::StringType:
+ {
+ for (unsigned int i=0;i< from.size(); i++)
+ {
+ unsigned int siz = from.getLength(i);
+ if (siz != to.getLength(i)) return false;
+
+ if (siz > 0)
+ {
+ wchar_t * buff = new wchar_t[siz];
+ wchar_t * buft = new wchar_t[siz];
+ from.getString(i,buff,siz);
+ to.getString(i,buft,siz);
+ for (unsigned int j=0;j<siz;j++)
+ {
+ if (buff[j] != buft[j])
+ {
+ delete buff;
+ delete buft;
+ return false;
+ }
+ }
+ delete buff;
+ delete buft;
+ }
+ }
+ return true;
+ }
+
+ case Type::BytesType:
+ {
+ for (unsigned int i=0;i< from.size(); i++)
+ {
+ unsigned int siz = from.getLength(i);
+ if (siz != to.getLength(i)) return false;
+
+ if (siz > 0)
+ {
+ char * buff = new char[siz];
+ char * buft = new char[siz];
+ from.getBytes(i,buff,siz);
+ to.getBytes(i,buft,siz);
+ for (unsigned int j=0;j<siz;j++)
+ {
+ if (buff[j] != buft[j])
+ {
+ delete buff;
+ delete buft;
+ return false;
+ }
+ }
+ delete buff;
+ delete buft;
+ }
+ }
+ return true;
+ }
+
+ default:
+ return true;
+
+ } // case
+ } // method
+
+ bool EqualityHelper::equalShallow(DataObjectPtr dataObject1, DataObjectPtr dataObject2)
+ {
+ return internalEqual(dataObject1, dataObject2, false);
+
+ }
+
+ bool EqualityHelper::equal(DataObjectPtr dataObject1, DataObjectPtr dataObject2)
+ {
+ return internalEqual(dataObject1, dataObject2, true);
+ }
+
+
+ bool EqualityHelper::internalEqual(DataObjectPtr dataObject1,
+ DataObjectPtr dataObject2,
+ bool fullEqual)
+ {
+
+
+ PropertyList pl = dataObject1->getInstanceProperties();
+ for (unsigned int i=0;i < pl.size(); i++)
+ {
+ // data objects are only compared the deep equality case
+ if (pl[i].getType().isDataObjectType())
+ {
+ if (!fullEqual)
+ {
+ continue;
+ }
+ else
+ {
+ if (pl[i].isMany())
+ {
+ DataObjectList& dolold = dataObject1->getList(pl[i]);
+ DataObjectList& dolnew = dataObject2->getList(pl[i]);
+ if (dolnew.size() != dolold.size()) return false;
+
+ for (unsigned int i=0;i< dolold.size(); i++)
+ {
+ if (!internalEqual(dolold[i], dolnew[i], true))
+ {
+ return false;
+ }
+ }
+ }
+ else
+ {
+ if (!internalEqual(
+ dataObject1->getDataObject(pl[i]),
+ dataObject2->getDataObject(pl[i]), true))
+ {
+ return false;
+ }
+ }
+ }
+ }
+ else
+ {
+ if (pl[i].isMany())
+ {
+ DataObjectList& dolold = dataObject1->getList(pl[i]);
+ DataObjectList& dolnew = dataObject2->getList(pl[i]);
+ if (dolold.size() != dolnew.size()) return false;
+ if (!comparelist(dolold, dolnew, pl[i].getTypeEnum())) return false;
+ }
+ else
+ {
+ if (!compareitem(dataObject1,dataObject2, pl[i]))
+ {
+ return false;
+ }
+ } // else
+ }
+ }
+ return true;
+ }
+
+}
+};
+
diff --git a/sdo-cpp/trunk/runtime/core/src/commonj/sdo/EqualityHelper.h b/sdo-cpp/trunk/runtime/core/src/commonj/sdo/EqualityHelper.h
new file mode 100644
index 0000000000..3058bd8f72
--- /dev/null
+++ b/sdo-cpp/trunk/runtime/core/src/commonj/sdo/EqualityHelper.h
@@ -0,0 +1,99 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you 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$ */
+
+#ifndef _EQUALITYHELPER_H_
+#define _EQUALITYHELPER_H_
+
+#include "commonj/sdo/RefCountingPointer.h"
+
+
+
+namespace commonj{
+namespace sdo{
+
+/**
+ * EqualityHelper provides static helper methods for equals.
+ * equalsShallow compares the DataType properties of the
+ * two data objects.
+ * equals performs a check on all the memebers and verifies that
+ * the same data objects are children.
+ */
+
+ class EqualityHelper
+{
+ public:
+
+ /**
+ * Shallow compare of DataObjects
+ *
+ * Compares two DataObjects for each property where
+ * property.getType().isDataObjectType() is false.
+ * Compares dataObject1.get(property).equals(dataObject2.get(property))
+ * Properties where property.getType().isDataObjectType() is true
+ * are not compared.
+ * DataObjects must have the same type
+ * dataObject1.getType() == dataObject2.getType()
+ * Returns true if all values of all compared properties are equal.
+ * @param dataObject1 DataObject to be compared
+ * @param dataObject2 DataObject to be compared
+ * @return true if equal
+ */
+ static SDO_API bool equalShallow(DataObjectPtr dataObject1, DataObjectPtr dataObject2);
+
+ /**
+ * Deep compare of DataObjects
+ * Compares dataObject1 and dataObject2 and all their contained
+ * DataObjects (property.isContainment() is true) recursively.
+ * Values of properties are comapred as in isEqualShallow,
+ * and values of properties where
+ * property.getType().isDataObjectType() is true
+ * are compared where each value copied must be a corresponding
+ * DataObject contained by the source dataObject.
+ * The dataObject trees must be closed.
+ * If any DataObject referenced in either tree is not part of the
+ * containment trees an IllegalArgumentException is thrown.
+ * If a ChangeSummary is part of the tree they must contain an
+ * identical summary for their respective trees.
+ *
+ * @param dataObject1 DataObject to be compared
+ * @param dataObject2 DataObject to be compared
+ * @return true if all compared aspects of all compared objects are equal
+ * @throws IllegalArgumentException if any referenced DataObject
+ * is not part of the containment trees.
+ */
+ static SDO_API bool equal(DataObjectPtr dataObject1, DataObjectPtr dataObject2);
+
+ private:
+
+ static bool internalEqual(DataObjectPtr dataObject1,
+ DataObjectPtr dataObject2,
+ bool fullEqual);
+
+ static bool comparelist(DataObjectList& to, DataObjectList& from, Type::Types t);
+
+ static bool compareitem(DataObjectPtr to, DataObjectPtr from, const Property& p);
+
+
+
+};
+};
+};
+#endif //_EQUALITYHELPER_H_
diff --git a/sdo-cpp/trunk/runtime/core/src/commonj/sdo/GroupDefinition.cpp b/sdo-cpp/trunk/runtime/core/src/commonj/sdo/GroupDefinition.cpp
new file mode 100644
index 0000000000..e0c275ede1
--- /dev/null
+++ b/sdo-cpp/trunk/runtime/core/src/commonj/sdo/GroupDefinition.cpp
@@ -0,0 +1,36 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you 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$ */
+
+#include "commonj/sdo/GroupDefinition.h"
+namespace commonj
+{
+ namespace sdo
+ {
+ GroupDefinition::GroupDefinition()
+ {
+ }
+
+ GroupDefinition::~GroupDefinition()
+ {
+ }
+
+ } // End - namespace sdo
+} // End - namespace commonj
diff --git a/sdo-cpp/trunk/runtime/core/src/commonj/sdo/GroupDefinition.h b/sdo-cpp/trunk/runtime/core/src/commonj/sdo/GroupDefinition.h
new file mode 100644
index 0000000000..de5e3bbb5d
--- /dev/null
+++ b/sdo-cpp/trunk/runtime/core/src/commonj/sdo/GroupDefinition.h
@@ -0,0 +1,59 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you 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$ */
+
+#ifndef _GROUPDEFINITION_H_
+#define _GROUPDEFINITION_H_
+
+#include "commonj/sdo/disable_warn.h"
+#include "commonj/sdo/GroupEvent.h"
+
+#include "list"
+
+
+namespace commonj
+{
+ namespace sdo
+ {
+
+
+/**
+ * TypeDefinition holds information gathered from parsing the
+ * XSD and used for creating Types
+ */
+ class GroupDefinition
+ {
+
+ public:
+ GroupDefinition();
+ virtual ~GroupDefinition();
+
+
+ SDOXMLString name;
+ SDOXMLString uri;
+ bool isAttributeGroup;
+ std::vector<GroupEvent> events;
+
+ };
+ } // End - namespace sdo
+} // End - namespace commonj
+
+
+#endif //_TYPEDEFINITION_H_
diff --git a/sdo-cpp/trunk/runtime/core/src/commonj/sdo/GroupEvent.cpp b/sdo-cpp/trunk/runtime/core/src/commonj/sdo/GroupEvent.cpp
new file mode 100644
index 0000000000..58c229ac0a
--- /dev/null
+++ b/sdo-cpp/trunk/runtime/core/src/commonj/sdo/GroupEvent.cpp
@@ -0,0 +1,65 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you 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$ */
+
+
+#include "commonj/sdo/GroupEvent.h"
+namespace commonj
+{
+ namespace sdo
+ {
+ GroupEvent::GroupEvent()
+ {
+ }
+
+ GroupEvent::GroupEvent(
+ const SDOXMLString& inlocalname,
+ const SDOXMLString& inprefix,
+ const SDOXMLString& inURI,
+ const SAX2Namespaces& innamespaces,
+ const SAX2Attributes& inattributes
+ )
+ {
+ localname = inlocalname;
+ prefix = inprefix;
+ URI = inURI;
+ namespaces = innamespaces;
+ attributes = inattributes;
+ isStartEvent = true;
+ }
+
+ GroupEvent::GroupEvent(
+ const SDOXMLString& inlocalname,
+ const SDOXMLString& inprefix,
+ const SDOXMLString& inURI
+ )
+ {
+ localname = inlocalname;
+ prefix = inprefix;
+ URI = inURI;
+ isStartEvent = false;
+ }
+
+ GroupEvent::~GroupEvent()
+ {
+ }
+
+ } // End - namespace sdo
+} // End - namespace commonj
diff --git a/sdo-cpp/trunk/runtime/core/src/commonj/sdo/GroupEvent.h b/sdo-cpp/trunk/runtime/core/src/commonj/sdo/GroupEvent.h
new file mode 100644
index 0000000000..f6495687ba
--- /dev/null
+++ b/sdo-cpp/trunk/runtime/core/src/commonj/sdo/GroupEvent.h
@@ -0,0 +1,70 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you 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$ */
+
+#ifndef _GROUPEVENT_H_
+#define _GROUPEVENT_H_
+
+#include "commonj/sdo/disable_warn.h"
+
+
+#include "commonj/sdo/SAX2Parser.h"
+
+namespace commonj
+{
+ namespace sdo
+ {
+
+
+ class GroupEvent
+ {
+
+ public:
+ GroupEvent();
+ GroupEvent(
+ const SDOXMLString& inlocalname,
+ const SDOXMLString& inprefix,
+ const SDOXMLString& inURI,
+ const SAX2Namespaces& innamespaces,
+ const SAX2Attributes& inattributes
+ );
+
+ GroupEvent(
+ const SDOXMLString& inlocalname,
+ const SDOXMLString& inprefix,
+ const SDOXMLString& inURI
+ );
+
+ virtual ~GroupEvent();
+
+ bool isStartEvent;
+ SDOXMLString localname;
+ SDOXMLString prefix;
+ SDOXMLString URI;
+ SAX2Namespaces namespaces;
+ SAX2Attributes attributes;
+
+
+ };
+ } // End - namespace sdo
+} // End - namespace commonj
+
+
+#endif //_TYPEDEFINITION_H_
diff --git a/sdo-cpp/trunk/runtime/core/src/commonj/sdo/HelperProvider.cpp b/sdo-cpp/trunk/runtime/core/src/commonj/sdo/HelperProvider.cpp
new file mode 100644
index 0000000000..ec17d97b02
--- /dev/null
+++ b/sdo-cpp/trunk/runtime/core/src/commonj/sdo/HelperProvider.cpp
@@ -0,0 +1,49 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you 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$ */
+
+#include "commonj/sdo/HelperProvider.h"
+#include "commonj/sdo/XSDHelperImpl.h"
+#include "commonj/sdo/XMLHelperImpl.h"
+#include "commonj/sdo/export.h"
+#include "commonj/sdo/DataFactory.h"
+
+namespace commonj
+{
+ namespace sdo
+ {
+
+ //////////////////////////////////////////////////////////////////////
+ // Create an XSDHelper
+ //////////////////////////////////////////////////////////////////////
+ XSDHelperPtr HelperProvider::getXSDHelper(DataFactoryPtr dataFactory)
+ {
+ return new XSDHelperImpl(dataFactory);
+ }
+ //////////////////////////////////////////////////////////////////////
+ // Create an XMLHelper
+ //////////////////////////////////////////////////////////////////////
+ XMLHelperPtr HelperProvider::getXMLHelper(DataFactoryPtr dataFactory)
+ {
+ return new XMLHelperImpl(dataFactory);
+ }
+
+ } // End - namespace sdo
+} // End - namespace commonj
diff --git a/sdo-cpp/trunk/runtime/core/src/commonj/sdo/HelperProvider.h b/sdo-cpp/trunk/runtime/core/src/commonj/sdo/HelperProvider.h
new file mode 100644
index 0000000000..426b069b56
--- /dev/null
+++ b/sdo-cpp/trunk/runtime/core/src/commonj/sdo/HelperProvider.h
@@ -0,0 +1,67 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you 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$ */
+
+#ifndef _HELPERPROVIDER_H_
+#define _HELPERPROVIDER_H_
+
+
+#include "commonj/sdo/XSDHelper.h"
+#include "commonj/sdo/XMLHelper.h"
+#include "commonj/sdo/DataFactory.h"
+#include "commonj/sdo/export.h"
+
+
+namespace commonj
+{
+ namespace sdo
+ {
+
+
+/**
+ * HelperProvider gives access to helpers (static methods).
+ *
+ * The helper provider gives back an XSD or XML helper associated
+ * with the given data factory
+ */
+ class HelperProvider
+ {
+ public:
+
+/**
+ *
+ * The helper provider gives back an XSD helper associated
+ * with the given data factory
+ */
+ SDO_API static XSDHelperPtr getXSDHelper(DataFactoryPtr dataFactory=0);
+
+/**
+ *
+ * The helper provider gives back an XML helper associated
+ * with the given data factory
+ */
+ SDO_API static XMLHelperPtr getXMLHelper(DataFactoryPtr dataFactory=0);
+
+ };
+
+ } // End - namespace sdo
+} // End - namespace commonj
+
+#endif // _HELPERPROVIDER_H_
diff --git a/sdo-cpp/trunk/runtime/core/src/commonj/sdo/LogWriter.cpp b/sdo-cpp/trunk/runtime/core/src/commonj/sdo/LogWriter.cpp
new file mode 100644
index 0000000000..d43b918a77
--- /dev/null
+++ b/sdo-cpp/trunk/runtime/core/src/commonj/sdo/LogWriter.cpp
@@ -0,0 +1,34 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you 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$ */
+
+#include "commonj/sdo/LogWriter.h"
+
+namespace commonj
+{
+ namespace sdo
+ {
+ LogWriter::~LogWriter()
+ {
+ }
+
+ } // End namespace sdo
+} // End namespace commonj
+
diff --git a/sdo-cpp/trunk/runtime/core/src/commonj/sdo/LogWriter.h b/sdo-cpp/trunk/runtime/core/src/commonj/sdo/LogWriter.h
new file mode 100644
index 0000000000..40954d9b25
--- /dev/null
+++ b/sdo-cpp/trunk/runtime/core/src/commonj/sdo/LogWriter.h
@@ -0,0 +1,46 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you 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$ */
+
+#ifndef SDO_LOGWriter_H
+#define SDO_LOGWriter_H
+
+#include "commonj/sdo/export.h"
+
+namespace commonj
+{
+ namespace sdo
+ {
+
+/**
+ * LogWriter is an abstract class for implementers to inherit from.
+ * see DefaultLogWriter.
+ */
+ class LogWriter
+ {
+ public:
+ virtual ~LogWriter();
+
+ SDO_API virtual void log(int indent, int level, const char* msg) = 0;
+ };
+
+ } // End namespace sdo
+} // End namespace commonj
+#endif // SDO_LOGWriter_H
diff --git a/sdo-cpp/trunk/runtime/core/src/commonj/sdo/Logger.cpp b/sdo-cpp/trunk/runtime/core/src/commonj/sdo/Logger.cpp
new file mode 100644
index 0000000000..47f7072c38
--- /dev/null
+++ b/sdo-cpp/trunk/runtime/core/src/commonj/sdo/Logger.cpp
@@ -0,0 +1,102 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you 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$ */
+
+#include "commonj/sdo/Logger.h"
+#include <iostream>
+#include <stdarg.h>
+#include "commonj/sdo/DefaultLogWriter.h"
+#include <stdio.h>
+#include <stdlib.h>
+using namespace std;
+
+namespace commonj
+{
+ namespace sdo
+ {
+ LogWriter* Logger::logWriter = getLogWriter();
+
+ LogWriter* Logger::getLogWriter()
+ {
+ if (logWriter == 0)
+ {
+ setLogWriter(0);
+ }
+ return logWriter;
+ }
+
+ void Logger::setLogWriter(LogWriter* writer)
+ {
+ if (logWriter != writer)
+ {
+ delete logWriter;
+ }
+
+ if (writer == 0)
+ {
+ logWriter = new DefaultLogWriter;
+ }
+ else
+ {
+ logWriter = writer;
+ }
+ }
+
+ int Logger::loggingLevel = setLogging();
+
+ int Logger::setLogging()
+ {
+ char* loggingVar = 0;
+ loggingVar = getenv("TUSCANY_SDOCPP_LOGGING");
+ if (loggingVar == 0)
+ return 0;
+ else
+ return atoi(loggingVar);
+ }
+
+ void Logger::setLogging(int level)
+ {
+ loggingLevel = level;
+ }
+
+ void Logger::log(int indent, int level, const char* msg)
+ {
+ if (level <= loggingLevel)
+ {
+ logWriter->log(indent, level, msg);
+ }
+ }
+
+ void Logger::logArgs(int indent, int level, const char* msg, ...)
+ {
+ if (level <= loggingLevel)
+ {
+ va_list variableArguments;
+ va_start(variableArguments, msg);
+ char messageBuffer[1024];
+ vsprintf(messageBuffer, msg, variableArguments);
+ logWriter->log(indent, level, messageBuffer);
+ va_end(variableArguments);
+ }
+ }
+
+ } // End namespace sdo
+} // End namespace commonj
+
diff --git a/sdo-cpp/trunk/runtime/core/src/commonj/sdo/Logger.h b/sdo-cpp/trunk/runtime/core/src/commonj/sdo/Logger.h
new file mode 100644
index 0000000000..556d503154
--- /dev/null
+++ b/sdo-cpp/trunk/runtime/core/src/commonj/sdo/Logger.h
@@ -0,0 +1,71 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you 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$ */
+
+#ifndef SDO_LOGGER_H
+#define SDO_LOGGER_H
+
+
+
+#include "commonj/sdo/export.h"
+#include "commonj/sdo/LogWriter.h"
+namespace commonj
+{
+ namespace sdo
+ {
+
+/**
+ * Logger is used for debug style logging such as method trace.
+ * The logger can log at different levels, and can log entry, exit
+ * and events. The log entries can take arguments or be just
+ * strings.
+ */
+ class Logger {
+
+ public:
+/**
+ * attach a log writer.
+ */
+ SDO_API static void setLogWriter(LogWriter* writer);
+/**
+ * switch logging to a level.
+ */
+ SDO_API static void setLogging(int level);
+
+/**
+ * log a message.
+ */
+ SDO_API static void log(int indent, int level, const char* msg);
+/**
+ * log a message with parameters.
+ */
+ SDO_API static void logArgs(int indent, int level, const char* msg, ...);
+
+ static int loggingLevel;
+
+ private:
+ static LogWriter* logWriter;
+ static LogWriter* getLogWriter();
+ static int setLogging();
+ };
+
+ } // End namespace sdo
+} // End namespace commonj
+#endif // SDO_LOGGER_H
diff --git a/sdo-cpp/trunk/runtime/core/src/commonj/sdo/Logging.h b/sdo-cpp/trunk/runtime/core/src/commonj/sdo/Logging.h
new file mode 100644
index 0000000000..2d72d6f42d
--- /dev/null
+++ b/sdo-cpp/trunk/runtime/core/src/commonj/sdo/Logging.h
@@ -0,0 +1,171 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you 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$ */
+
+#include "commonj/sdo/Logger.h"
+#include "commonj/sdo/SDORuntimeException.h"
+
+#ifndef SDO_LOGGING_H
+#define SDO_LOGGING_H
+
+/**
+ * logging level for stuff you rarely want to see, like
+ * memory allocations.
+ */
+
+#define HIGHVOLUME 40
+/**
+ * logging level for normal path information
+ */
+#define INFO 30
+
+ /**
+ * logging level for something which is unusual.
+ */
+
+#define WARNING 20
+/**
+ * logging level for a major problem
+ */
+
+#define ERROR 10
+
+#define INDENT 1
+#define OUTDENT -1
+#define NODENT 0
+
+
+/**
+ * Macro for simplifying addition of trace points
+ */
+
+#ifdef _DEBUG
+#define LOGENTRY(level, methodName) \
+if (Logger::loggingLevel >= level) \
+Logger::logArgs(INDENT, level, "Entering: %s", methodName);
+
+/**
+ * Macro for simplifying addition of trace points
+ */
+#define LOGEXIT(level, methodName) \
+if (Logger::loggingLevel >= level) \
+Logger::logArgs(OUTDENT, level, "Exiting: %s" ,methodName);
+
+/**
+ * Macro for simplifying addition of trace points
+ */
+#define LOGINFO(level, message) \
+if (Logger::loggingLevel >= level) \
+Logger::log(NODENT, level, message);
+
+/**
+ * Macro for simplifying addition of trace points
+ */
+#define LOGINFO_1(level, message, arg1) \
+if (Logger::loggingLevel >= level) \
+Logger::logArgs(NODENT,level, message, arg1);
+
+/**
+ * Macro for simplifying addition of trace points
+ */
+#define LOGINFO_2(level, message, arg1, arg2) \
+if (Logger::loggingLevel >= level) \
+Logger::logArgs(NODENT,level, message, arg1, arg2);
+
+/**
+ * Macro for simplifying addition of trace points
+ */
+#define LOGERROR(level, message) \
+if (Logger::loggingLevel >= level) \
+Logger::log(NODENT,level, message);
+
+/**
+ * Macro for simplifying addition of trace points
+ */
+#define LOGERROR_1(level, message, arg1) \
+if (Logger::loggingLevel >= level) \
+Logger::logArgs(NODENT,level, message, arg1);
+
+/**
+ * Macro for simplifying addition of trace points
+ */
+#define LOGERROR_2(level, message, arg1, arg2) \
+if (Logger::loggingLevel >= level) \
+Logger::logArgs(NODENT,level, message, arg1, arg2);
+
+/**
+ * Macro for simplifying addition of trace points
+ */
+#define LOGSDOEXCEPTION(level, message, arg1) \
+if (Logger::loggingLevel >= level) \
+Logger::log(NODENT,level, message);\
+Logger::logArgs(NODENT,level, "%s:%s\nIn %s\nAt %s line %ld\n",\
+ ((SDORuntimeException)arg1).getEClassName(),\
+ ((SDORuntimeException)arg1).getMessageText(),\
+ ((SDORuntimeException)arg1).getFunctionName(),\
+ ((SDORuntimeException)arg1).getFileName(),\
+ ((SDORuntimeException)arg1).getLineNumber());
+
+#else // Not DEBUG
+
+/**
+ * Macro for simplifying addition of trace points
+ */
+#define LOGSDOEXCEPTION(level, message, arg1)
+
+/**
+ * Macro for simplifying addition of trace points
+ */
+#define LOGENTRY(level, methodName)
+
+/**
+ * Macro for simplifying addition of trace points
+ */
+#define LOGEXIT(level, methodName)
+
+/**
+ * Macro for simplifying addition of trace points
+ */
+#define LOGINFO(level, message)
+
+/**
+ * Macro for simplifying addition of trace points
+ */
+#define LOGINFO_1(level, message, arg1)
+
+/**
+ * Macro for simplifying addition of trace points
+ */
+#define LOGINFO_2(level, message, arg1, arg2)
+/**
+ * Macro for simplifying addition of trace points
+ */
+#define LOGERROR(level, message)
+/**
+ * Macro for simplifying addition of trace points
+ */
+#define LOGERROR_1(level, message, arg1)
+/**
+ * Macro for simplifying addition of trace points
+ */
+#define LOGERROR_2(level, message, arg1, arg2)
+
+#endif
+#endif // SDO_LOGGING_H
diff --git a/sdo-cpp/trunk/runtime/core/src/commonj/sdo/Makefile.am b/sdo-cpp/trunk/runtime/core/src/commonj/sdo/Makefile.am
new file mode 100644
index 0000000000..bc5ecce789
--- /dev/null
+++ b/sdo-cpp/trunk/runtime/core/src/commonj/sdo/Makefile.am
@@ -0,0 +1,104 @@
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements. See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership. The ASF licenses this file
+# to you 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.
+
+lib_LTLIBRARIES = libtuscany_sdo.la
+
+libtuscany_sdo_la_SOURCES = \
+ ChangedDataObjectListImpl.cpp \
+ ChangeSummaryBuilder.cpp \
+ ChangeSummary.cpp \
+ ChangeSummaryImpl.cpp \
+ CopyHelper.cpp \
+ DASProperty.cpp \
+ DASType.cpp \
+ DASValue.cpp \
+ DASValues.cpp \
+ DataFactory.cpp \
+ DataFactoryImpl.cpp \
+ DataGraph.cpp \
+ DataGraphImpl.cpp \
+ DataObject.cpp \
+ DataObjectImpl.cpp \
+ DataObjectList.cpp \
+ DataObjectListImpl.cpp \
+ DataTypeInfo.cpp \
+ DefaultLogWriter.cpp \
+ EqualityHelper.cpp \
+ GroupDefinition.cpp \
+ GroupEvent.cpp \
+ HelperProvider.cpp \
+ Logger.cpp \
+ LogWriter.cpp \
+ ParserErrorSetter.cpp \
+ Property.cpp \
+ PropertyDefinition.cpp \
+ PropertyDefinitionImpl.cpp \
+ PropertyImpl.cpp \
+ PropertyList.cpp \
+ PropertySetting.cpp \
+ RefCountingObject.cpp \
+ RefCountingPointer.cpp \
+ SAX2Attribute.cpp \
+ SAX2Attributes.cpp \
+ SAX2Namespaces.cpp \
+ SAX2Parser.cpp \
+ SchemaInfo.cpp \
+ SdoCheck.cpp \
+ SDODataConverter.cpp \
+ SDODate.cpp \
+ SdoRuntime.cpp \
+ SDORuntimeException.cpp \
+ SDOSAX2Parser.cpp \
+ SDOSchemaSAX2Parser.cpp \
+ SDOUtils.cpp \
+ SDOValue.cpp \
+ SDOXMLBufferWriter.cpp \
+ SDOXMLFileWriter.cpp \
+ SDOXMLStreamWriter.cpp \
+ SDOXMLString.cpp \
+ SDOXMLWriter.cpp \
+ SDOXSDBufferWriter.cpp \
+ SDOXSDFileWriter.cpp \
+ SDOXSDStreamWriter.cpp \
+ SDOXSDWriter.cpp \
+ Sequence.cpp \
+ SequenceImpl.cpp \
+ Setting.cpp \
+ SettingList.cpp \
+ Type.cpp \
+ TypeDefinition.cpp \
+ TypeDefinitions.cpp \
+ TypeDefinitionImpl.cpp \
+ TypeDefinitionsImpl.cpp \
+ TypeImpl.cpp \
+ TypeList.cpp \
+ XMLDocument.cpp \
+ XMLDocumentImpl.cpp \
+ XMLHelper.cpp \
+ XMLHelperImpl.cpp \
+ XMLQName.cpp \
+ XpathHelper.cpp \
+ XSDHelper.cpp \
+ XSDHelperImpl.cpp \
+ XSDPropertyInfo.cpp \
+ XSDTypeInfo.cpp
+
+libtuscany_sdo_la_LIBADD = -L${LIBXML2_LIB} -lxml2
+
+INCLUDES = -I$(top_builddir)/runtime/core/src \
+ -I${LIBXML2_INCLUDE}
+
diff --git a/sdo-cpp/trunk/runtime/core/src/commonj/sdo/ParserErrorSetter.cpp b/sdo-cpp/trunk/runtime/core/src/commonj/sdo/ParserErrorSetter.cpp
new file mode 100644
index 0000000000..14d5d7aa1b
--- /dev/null
+++ b/sdo-cpp/trunk/runtime/core/src/commonj/sdo/ParserErrorSetter.cpp
@@ -0,0 +1,40 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you 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$ */
+
+// ParserErrorSetter.cpp: class allowing parser to push errors back.
+//
+//////////////////////////////////////////////////////////////////////
+#include "commonj/sdo/ParserErrorSetter.h"
+namespace commonj
+{
+ namespace sdo
+ {
+ //////////////////////////////////////////////////////////////////////
+ // Construction/Destruction
+ //////////////////////////////////////////////////////////////////////
+ ParserErrorSetter::~ParserErrorSetter()
+ {
+ }
+
+ } // End - namespace sdo
+} // End - namespace commonj
+
+
diff --git a/sdo-cpp/trunk/runtime/core/src/commonj/sdo/ParserErrorSetter.h b/sdo-cpp/trunk/runtime/core/src/commonj/sdo/ParserErrorSetter.h
new file mode 100644
index 0000000000..7156a3d297
--- /dev/null
+++ b/sdo-cpp/trunk/runtime/core/src/commonj/sdo/ParserErrorSetter.h
@@ -0,0 +1,51 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you 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$ */
+
+#ifndef _PARSER_ERROR_SETTER_H_
+#define _PARSER_ERROR_SETTER_H_
+
+#include "commonj/sdo/export.h"
+
+#include "commonj/sdo/disable_warn.h"
+
+namespace commonj{
+namespace sdo{
+
+/**
+ * The ParserErrorSetter builds a list of all the errors which
+ * occurred during a parse, so they can be displayed for the
+ * user of an XSDHelper or XMLHelper
+ */
+
+class ParserErrorSetter
+{
+public:
+ virtual ~ParserErrorSetter();
+ virtual void setError(const char* message) = 0;
+ virtual void clearErrors() = 0;
+
+protected:
+
+};
+};
+};
+
+#endif
diff --git a/sdo-cpp/trunk/runtime/core/src/commonj/sdo/Property.cpp b/sdo-cpp/trunk/runtime/core/src/commonj/sdo/Property.cpp
new file mode 100644
index 0000000000..8e4a13ad9b
--- /dev/null
+++ b/sdo-cpp/trunk/runtime/core/src/commonj/sdo/Property.cpp
@@ -0,0 +1,44 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you 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$ */
+
+#include <iostream>
+using namespace std;
+
+
+#ifndef SDO_EXPORTS
+#define SDO_EXPORTS
+#endif
+#include "commonj/sdo/export.h"
+
+#include "commonj/sdo/Sequence.h"
+#include "commonj/sdo/DataObject.h"
+#include "commonj/sdo/TypeList.h"
+
+#include "commonj/sdo/Type.h"
+#include "commonj/sdo/Property.h"
+namespace commonj{
+namespace sdo{
+
+ // All delegated to the impl.
+
+};
+};
+
diff --git a/sdo-cpp/trunk/runtime/core/src/commonj/sdo/Property.h b/sdo-cpp/trunk/runtime/core/src/commonj/sdo/Property.h
new file mode 100644
index 0000000000..7c7fc74981
--- /dev/null
+++ b/sdo-cpp/trunk/runtime/core/src/commonj/sdo/Property.h
@@ -0,0 +1,208 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you 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$ */
+
+#ifndef _PROPERTY_H_
+#define _PROPERTY_H_
+
+
+#include "commonj/sdo/export.h"
+
+#include "commonj/sdo/Type.h"
+#include "commonj/sdo/SDODate.h"
+#include "commonj/sdo/RefCountingObject.h"
+
+namespace commonj{
+namespace sdo{
+
+class Type;
+class TypeImpl;
+class DataObject;
+
+/**
+ *
+ * A representation of a property in the type of a data object.
+ */
+
+class Property : public RefCountingObject
+{
+ public:
+
+ /** getName gets the name of the property
+ *
+ * Returns the name of the property.
+ */
+
+ // TODO: We would like the returned value to be an SDOString but not until the internals are ready
+ virtual const SDO_API char* getName() const = 0;
+ // virtual const SDO_API SDOString& getName() const = 0;
+
+ /** getAlias returns the n'th alias
+ *
+ * This method returns a const char* corresponding to the
+ * alias at index n of the list of aliases. Use getAliasCount to
+ * discover the size of the list.
+ */
+
+ // TODO: We would lke to convert the returned value to an SDOString but that means a rename for the method.
+ virtual SDO_API const char* getAlias(unsigned int index = 0) const = 0;
+
+ // virtual SDO_API const SDOString& getAlias(unsigned int index = 0) const = 0;
+
+ /** getAliasCount returns the number of aliases
+ *
+ * This method returns the number of aliases for this type
+ */
+
+ virtual SDO_API unsigned int getAliasCount() const = 0;
+
+ /** getType returns the type of this property
+ *
+ * This method returns the type, which may be a DataType or a
+ * DataObjectType
+ */
+
+ virtual SDO_API const Type& getType() const = 0;
+
+ /** getTypeEnum gets the enum for this type.
+ *
+ * Each DataType has a defined value in the list of Types.
+ */
+
+ virtual SDO_API const Type::Types getTypeEnum() const = 0;
+
+ /** isMany is true if the property is a list
+ *
+ * IsMany returns true if this property represents a list of
+ * values, and should be accessed via the getList DataObjectAPI.
+ */
+
+ virtual bool SDO_API isMany() const = 0;
+
+ /** isContainment is true if the property value is contained
+ *
+ * IsContainment returns true if this property represents a DataObjectType,
+ * and that DataObjectType is contained. I.E the property value is not a pointer
+ * to a DataObject somewhere else in the graph, it is an actual value.
+ */
+
+ virtual bool SDO_API isContainment() const = 0;
+
+ /** isReference is true if the property value is not contained
+ *
+ * IsReference returns true if this property represents a DataObjectType,
+ * and that DataObjectType is not contained. I.E the property value is a pointer
+ * to a DataObject somewhere else in the graph not an actual value.
+ */
+
+ virtual bool SDO_API isReference() const = 0;
+
+ /** getContainingType give the type which holds this property.
+ *
+ * Although many types may have a property of the same name, any given
+ * instance of a property belongs to only one type.
+ * This method returns the type which holds this proeprty.
+ */
+
+ virtual SDO_API const Type& getContainingType() const = 0;
+
+
+
+ /** isReadOnly returns true if the property is unmodifiable.
+ *
+ * NOT IMPLEMENTED
+ * Returns true if values for this Property cannot be modified using the SDO APIs.
+ * When true, DataObject.set(Property property, Object value) throws an exception.
+ * Values may change due to other factors, such as services operating on DataObjects.
+ */
+
+ virtual bool SDO_API isReadOnly() const = 0;
+
+ /** getOpposite returns the opposite property or zero.
+ *
+ * NOT IMPLEMENTED
+ */
+
+ virtual SDO_API const Property* getOpposite() const = 0;
+
+ /** isDefaulted is true if a default has been set.
+ *
+ * A property value may be set or unset. If unset, requests to the
+ * data object for the value will return a default if there is one.
+ * If the property is not defaulted, an un specified value will be
+ * returned. (Thism value will probably be zero).
+ */
+
+ virtual SDO_API bool isDefaulted() const = 0 ;
+
+ /** setDefault sets the right sort of default.
+ *
+ * The many overrides of this method allow the setting
+ * of a default value for any DataType property.
+ */
+
+ virtual SDO_API void setDefault(bool b ) = 0;
+ virtual SDO_API void setDefault(char c) = 0;
+ virtual SDO_API void setDefault(wchar_t c) = 0;
+ virtual SDO_API void setDefault(char* c) = 0;
+ virtual SDO_API void setDefault(const SDOString& c) = 0;
+ virtual SDO_API void setDefault(short s) = 0;
+#if __WORDSIZE !=64
+ virtual SDO_API void setDefault(long l) = 0;
+#endif
+ virtual SDO_API void setDefault(int64_t i) = 0;
+ virtual SDO_API void setDefault(float f) = 0;
+ virtual SDO_API void setDefault(long double d) = 0;
+ virtual SDO_API void setDefault(const SDODate d) = 0;
+ virtual SDO_API void setDefault(const wchar_t* c, unsigned int len) = 0;
+ virtual SDO_API void setDefault(const char* c, unsigned int len) = 0;
+ virtual SDO_API void setDefault(const SDOString& c, unsigned int len) = 0;
+
+ /** getDefault gets the right sort of default.
+ *
+ * The many overrides of this method allow the getting
+ * of a default value for any DataType property.
+ */
+
+ virtual SDO_API unsigned int getStringDefault(wchar_t* val, unsigned int max) const = 0;
+ virtual SDO_API unsigned int getBytesDefault(char* val, unsigned int max) const = 0;
+ virtual SDO_API unsigned int getBytesDefault(SDOString& val, unsigned int max) const = 0;
+ virtual SDO_API bool getBooleanDefault() const = 0;
+ virtual SDO_API char getByteDefault() const = 0;
+ virtual SDO_API wchar_t getCharacterDefault() const = 0;
+ virtual SDO_API short getShortDefault() const = 0;
+ virtual SDO_API long getIntDefault() const = 0;
+ virtual SDO_API int64_t getLongDefault() const = 0;
+ virtual SDO_API float getFloatDefault() const = 0;
+ virtual SDO_API long double getDoubleDefault() const = 0;
+ virtual SDO_API const SDODate getDateDefault() const = 0;
+ virtual SDO_API const char* getCStringDefault() const = 0;
+ // TODO: Can't overload return types.
+ // virtual SDO_API const SDOString& getSDOStringDefault() const = 0;
+ virtual SDO_API unsigned int getDefaultLength() const = 0;
+
+
+};
+
+
+};
+};
+
+#endif //_PROPERTY_H_
diff --git a/sdo-cpp/trunk/runtime/core/src/commonj/sdo/PropertyDefinition.cpp b/sdo-cpp/trunk/runtime/core/src/commonj/sdo/PropertyDefinition.cpp
new file mode 100644
index 0000000000..17137d8654
--- /dev/null
+++ b/sdo-cpp/trunk/runtime/core/src/commonj/sdo/PropertyDefinition.cpp
@@ -0,0 +1,325 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you 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$ */
+
+#include "commonj/sdo/PropertyDefinition.h"
+#include "commonj/sdo/PropertyDefinitionImpl.h"
+
+namespace commonj
+{
+ namespace sdo
+ {
+ namespace internal
+ {
+
+ PropertyDefinition::PropertyDefinition()
+ {
+ propertydefinition = new PropertyDefinitionImpl();
+ }
+
+ PropertyDefinition::~PropertyDefinition()
+ {
+ if (propertydefinition) delete propertydefinition;
+ }
+
+ void PropertyDefinition::copy (const PropertyDefinition& pd)
+ {
+ if (propertydefinition != 0) delete propertydefinition;
+ propertydefinition = new PropertyDefinitionImpl(*(pd.propertydefinition));
+ }
+
+ PropertyDefinition::PropertyDefinition(const PropertyDefinition& pd)
+ {
+ copy(pd);
+ }
+
+ PropertyDefinition& PropertyDefinition::operator=(const PropertyDefinition& pd)
+ {
+ if (this != &pd)
+ {
+ copy(pd);
+ }
+ return *this;
+ }
+
+ PropertyDefinitionImpl* PropertyDefinition::getPropertyDefinition()
+ {
+ return propertydefinition;
+ }
+
+ // where this property is to be substituted for another
+ void PropertyDefinition::setSubstituteName(const char * name)
+ {
+ propertydefinition->substituteName = name;
+ }
+ void PropertyDefinition::setSubstituteName(const SDOString& name)
+ {
+ propertydefinition->substituteName = name.c_str();
+ }
+
+ const char* PropertyDefinition::getSubstituteName() const
+ {
+ return (const char *)propertydefinition->substituteName;
+ }
+
+ void PropertyDefinition::setSubstituteUri(const char* name)
+ {
+ propertydefinition->substituteUri = name;
+ }
+ void PropertyDefinition::setSubstituteUri(const SDOString& name)
+ {
+ propertydefinition->substituteUri = name.c_str();
+ }
+
+ const char* PropertyDefinition::getSubstituteUri() const
+ {
+ return (const char*)propertydefinition->substituteUri;
+ }
+
+ // where there are substitute names for this property.
+ void PropertyDefinition::addSubstitute(const SDOString& name,
+ const SDOString& localname)
+ {
+ propertydefinition->substituteNames.push_back(name.c_str());
+ propertydefinition->substituteLocalNames.push_back(localname.c_str());
+ }
+
+ int PropertyDefinition::getSubstituteCount() const
+ {
+ return propertydefinition->substituteNames.size();
+ }
+
+ const char* PropertyDefinition::getSubstituteNames(unsigned int index) const
+ {
+ if (index >= 0 && index < propertydefinition->substituteNames.size())
+ {
+ return propertydefinition->substituteNames[index];;
+ }
+ return 0;
+ }
+
+ const char* PropertyDefinition::getSubstituteLocalNames(unsigned int index) const
+ {
+ if (index >= 0 && index < propertydefinition->substituteLocalNames.size())
+ {
+ return propertydefinition->substituteLocalNames[index];;
+ }
+ return 0;
+ }
+
+
+ void PropertyDefinition::setAliases(const char* aliases)
+ {
+ propertydefinition->aliases = aliases;
+ }
+ void PropertyDefinition::setAliases(const SDOString& aliases)
+ {
+ propertydefinition->aliases = aliases.c_str();
+ }
+
+ const char* PropertyDefinition::getAliases() const
+ {
+ return (const char *)propertydefinition->aliases;
+ }
+
+ void PropertyDefinition::setName(const char* name)
+ {
+ propertydefinition->name = name;
+ }
+ void PropertyDefinition::setName(const SDOString& name)
+ {
+ propertydefinition->name = name.c_str();
+ }
+
+ const char* PropertyDefinition::getName() const
+ {
+ return (const char *)propertydefinition->name;
+ }
+
+ void PropertyDefinition::setLocalName(const char* name)
+ {
+ propertydefinition->localname = name;
+ }
+ void PropertyDefinition::setLocalName(const SDOString& name)
+ {
+ propertydefinition->localname = name.c_str();
+ }
+
+ const char* PropertyDefinition::getLocalName() const
+ {
+ return (const char*)propertydefinition->localname;
+ }
+
+ void PropertyDefinition::setType(const char* uri, const char* name)
+ {
+ propertydefinition->typeUri = uri;
+ propertydefinition->typeName = name;
+ propertydefinition->fullTypeName = uri;
+ 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
+ {
+ return propertydefinition->typeName;
+ }
+
+ const char * PropertyDefinition::getTypeUri() const
+ {
+ return propertydefinition->typeUri;
+ }
+
+ const char * PropertyDefinition::getTypeFullName() const
+ {
+ return propertydefinition->fullTypeName;
+ }
+
+ const char * PropertyDefinition::getTypeFullLocalName() const
+ {
+ return propertydefinition->fullLocalTypeName;
+ }
+
+ void PropertyDefinition::setTypeFullLocalName(const char* name)
+ {
+ 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
+ {
+ return propertydefinition->defaultValue;
+ }
+
+ bool PropertyDefinition::getIsMany() const
+ {
+ return propertydefinition->isMany;
+ }
+
+ bool PropertyDefinition::getIsContainment() const
+ {
+ return propertydefinition->isContainment;
+ }
+
+ bool PropertyDefinition::getIsReadOnly() const
+ {
+ return propertydefinition->isReadOnly;
+ }
+
+ bool PropertyDefinition::getIsID() const
+ {
+ return propertydefinition->isID;
+ }
+
+ bool PropertyDefinition::getIsIDREF() const
+ {
+ return propertydefinition->isIDREF;
+ }
+
+ bool PropertyDefinition::getIsReference() const
+ {
+ return propertydefinition->isReference;
+ }
+
+ bool PropertyDefinition::getIsElement() const
+ {
+ return propertydefinition->isElement;
+ }
+
+ bool PropertyDefinition::getIsQName() const
+ {
+ return propertydefinition->isQName;
+ }
+
+ bool PropertyDefinition::getIsSubstitute() const
+ {
+ return propertydefinition->isSubstitute;
+ }
+
+
+ void PropertyDefinition::setIsMany(bool value)
+ {
+ propertydefinition->isMany = value;
+ }
+
+ void PropertyDefinition::setIsContainment(bool value)
+ {
+ propertydefinition->isContainment = value;
+ }
+
+ void PropertyDefinition::setIsReadOnly(bool value)
+ {
+ propertydefinition->isReadOnly = value;
+ }
+
+ void PropertyDefinition::setIsID(bool value)
+ {
+ propertydefinition->isID = value;
+ }
+
+ void PropertyDefinition::setIsIDREF(bool value)
+ {
+ propertydefinition->isIDREF = value;
+ }
+
+ void PropertyDefinition::setIsReference(bool value)
+ {
+ propertydefinition->isReference = value;
+ }
+
+ void PropertyDefinition::setIsElement(bool value)
+ {
+ propertydefinition->isElement = value;
+ }
+
+ void PropertyDefinition::setIsQName(bool value)
+ {
+ propertydefinition->isQName = value;
+ }
+
+ void PropertyDefinition::setIsSubstitute(bool value)
+ {
+ propertydefinition->isSubstitute = value;
+ }
+
+
+ } // End - namespace internal
+ } // End - namespace sdo
+} // End - namespace commonj
diff --git a/sdo-cpp/trunk/runtime/core/src/commonj/sdo/PropertyDefinition.h b/sdo-cpp/trunk/runtime/core/src/commonj/sdo/PropertyDefinition.h
new file mode 100644
index 0000000000..d468c8f4f6
--- /dev/null
+++ b/sdo-cpp/trunk/runtime/core/src/commonj/sdo/PropertyDefinition.h
@@ -0,0 +1,139 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you 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$ */
+
+#ifndef _PROPERTYDefinition_H_
+#define _PROPERTYDefinition_H_
+
+#include "export.h"
+
+#include <vector>
+#include "commonj/sdo/SDOString.h"
+
+
+
+namespace commonj
+{
+ namespace sdo
+ {
+ namespace internal
+ {
+ class PropertyDefinitionImpl;
+
+/**
+ * Internal Helper Class
+ * PropertyDefinitionImpl holds a property as defined by an XSD.
+ * The XSD holds more information than does the SDO Property.
+ * This class holds the extra information found as the XSD is
+ * parsed.
+ */
+ class SDO_API PropertyDefinition
+ {
+
+ public:
+
+
+ PropertyDefinition();
+ PropertyDefinition(const PropertyDefinition& pd);
+ PropertyDefinition& operator=(const PropertyDefinition& pd);
+
+ virtual ~PropertyDefinition();
+
+ PropertyDefinitionImpl* getPropertyDefinition();
+
+
+
+ // where this property is to be substituted for another
+ void setSubstituteName(const char * name);
+ void setSubstituteName(const SDOString& name);
+ const char* getSubstituteName() const;
+
+ void setSubstituteUri(const char* name);
+ void setSubstituteUri(const SDOString& name);
+ const char* getSubstituteUri() const;
+
+ // where there are substitute names for this property.
+ void addSubstitute(const char* name,
+ const char* localname);
+ void addSubstitute(const SDOString& name,
+ const SDOString& localname);
+ int getSubstituteCount() const;
+ const char* getSubstituteNames(unsigned int index) const;
+ const char* getSubstituteLocalNames(unsigned int index) const;
+
+
+ void setAliases(const char* aliases);
+ void setAliases(const SDOString& aliases);
+ const char* getAliases() const;
+
+ void setName(const char* name);
+ void setName(const SDOString& name);
+ const char* getName() const;
+
+ void setLocalName(const char* name);
+ void setLocalName(const SDOString& name);
+ const char* getLocalName() const;
+
+ void setType(const char* uri, const char* name);
+ void setType(const SDOString& uri, const SDOString& name);
+ const char * getTypeName() const;
+ const char * getTypeUri() const;
+ const char * getTypeFullName() const;
+ const char * getTypeFullLocalName() const ;
+
+ void setTypeFullLocalName(const char* name);
+ void setTypeFullLocalName(const SDOString& name);
+
+ void setDefaultValue(const char* value);
+ void setDefaultValue(const SDOString& value);
+ const char* getDefaultValue() const;
+
+ bool getIsMany() const;
+ bool getIsContainment() const;
+ bool getIsReadOnly() const;
+ bool getIsID() const;
+ bool getIsIDREF() const;
+ bool getIsReference() const;
+ bool getIsElement() const;
+ bool getIsQName() const;
+ bool getIsSubstitute() const;
+
+ void setIsMany(bool value);
+ void setIsContainment(bool value);
+ void setIsReadOnly(bool value);
+ void setIsID(bool value);
+ void setIsIDREF(bool value);
+ void setIsReference(bool value);
+ void setIsElement(bool value);
+ void setIsQName(bool value);
+ void setIsSubstitute(bool value);
+
+
+ private:
+ PropertyDefinitionImpl* propertydefinition;
+ void copy(const PropertyDefinition& pd);
+ };
+
+ } // End - namespace internal
+ } // End - namespace sdo
+} // End - namespace commonj
+
+
+#endif //_PROPERTYDefinitionImpl_H_
diff --git a/sdo-cpp/trunk/runtime/core/src/commonj/sdo/PropertyDefinitionImpl.cpp b/sdo-cpp/trunk/runtime/core/src/commonj/sdo/PropertyDefinitionImpl.cpp
new file mode 100644
index 0000000000..07e5f1044a
--- /dev/null
+++ b/sdo-cpp/trunk/runtime/core/src/commonj/sdo/PropertyDefinitionImpl.cpp
@@ -0,0 +1,49 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you 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$ */
+
+#include "commonj/sdo/PropertyDefinitionImpl.h"
+namespace commonj
+{
+ namespace sdo
+ {
+ namespace internal
+ {
+ PropertyDefinitionImpl::PropertyDefinitionImpl()
+ : isMany(false),
+ isContainment(true),
+ isReadOnly(false),
+ isElement(false),
+ isReference(false),
+ isQName(false),
+ isID(false),
+ isIDREF(false),
+ isSubstitute(false)
+
+ {
+ }
+
+ PropertyDefinitionImpl::~PropertyDefinitionImpl()
+ {
+ }
+
+ } // End - namespace internal
+ } // End - namespace sdo
+} // End - namespace commonj
diff --git a/sdo-cpp/trunk/runtime/core/src/commonj/sdo/PropertyDefinitionImpl.h b/sdo-cpp/trunk/runtime/core/src/commonj/sdo/PropertyDefinitionImpl.h
new file mode 100644
index 0000000000..5a21767990
--- /dev/null
+++ b/sdo-cpp/trunk/runtime/core/src/commonj/sdo/PropertyDefinitionImpl.h
@@ -0,0 +1,93 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you 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$ */
+
+#ifndef _PROPERTYDefinitionImpl_H_
+#define _PROPERTYDefinitionImpl_H_
+
+#include "commonj/sdo/disable_warn.h"
+
+#include "commonj/sdo/SDOXMLString.h"
+#include <vector>
+
+
+
+namespace commonj
+{
+ namespace sdo
+ {
+ namespace internal
+ {
+
+/**
+ * Internal Helper Class
+ * PropertyDefinitionImpl holds a property as defined by an XSD.
+ * The XSD holds more information than does the SDO Property.
+ * This class holds the extra information found as the XSD is
+ * parsed.
+ */
+ class PropertyDefinitionImpl
+ {
+
+ public:
+ PropertyDefinitionImpl();
+ virtual ~PropertyDefinitionImpl();
+
+ // where this property is to be substituted for another
+ SDOXMLString substituteName;
+ SDOXMLString substituteUri;
+
+ // where there are substitute names for this property.
+ std::vector<SDOXMLString> substituteNames;
+ std::vector<SDOXMLString> substituteLocalNames;
+
+ SDOXMLString aliases;
+
+ SDOXMLString name;
+ SDOXMLString localname;
+ SDOXMLString namespaceURI;
+
+ SDOXMLString typeUri;
+ SDOXMLString typeName;
+ SDOXMLString fullTypeName;
+
+ SDOXMLString fullLocalTypeName;
+
+ SDOXMLString defaultValue;
+
+ bool isMany;
+ bool isContainment;
+ bool isReadOnly;
+
+ bool isID;
+ bool isIDREF;
+ bool isReference;
+ bool isElement;
+
+ bool isQName;
+
+ bool isSubstitute;
+ };
+ } // End - namespace internal
+ } // End - namespace sdo
+} // End - namespace commonj
+
+
+#endif //_PROPERTYDefinitionImpl_H_
diff --git a/sdo-cpp/trunk/runtime/core/src/commonj/sdo/PropertyImpl.cpp b/sdo-cpp/trunk/runtime/core/src/commonj/sdo/PropertyImpl.cpp
new file mode 100644
index 0000000000..07010675dd
--- /dev/null
+++ b/sdo-cpp/trunk/runtime/core/src/commonj/sdo/PropertyImpl.cpp
@@ -0,0 +1,594 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you 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$ */
+
+#include "commonj/sdo/export.h"
+
+#include <iostream>
+using namespace std;
+
+
+#include "commonj/sdo/Sequence.h"
+#include "commonj/sdo/DataObject.h"
+#include "commonj/sdo/TypeList.h"
+
+#include "commonj/sdo/Type.h"
+#include "commonj/sdo/TypeImpl.h"
+#include "commonj/sdo/Property.h"
+#include "commonj/sdo/PropertyImpl.h"
+#include "commonj/sdo/DataFactoryImpl.h"
+#include "commonj/sdo/SDORuntimeException.h"
+
+namespace commonj{
+ namespace sdo{
+
+
+ Substitution::Substitution() : name(), type(0)
+ {
+ }
+
+ // Standard Constructor
+ Substitution::Substitution(DataFactoryPtr mdg,
+ const SDOString& inname,
+ const Type& intype) : name(inname)
+ {
+ DataFactoryImplPtr f = staticCast<DataFactoryImplPtr>(mdg);
+
+ type = f->findType(intype.getURI(),intype.getName());
+ }
+
+ // Copy constructor
+ Substitution::Substitution(const Substitution& s) : name(s.name), type(s.type)
+ {
+ }
+
+ Substitution::~Substitution()
+ {
+ }
+
+
+ ///////////////////////////////////////////////////////////////////////////
+ // construction by DAS
+ ///////////////////////////////////////////////////////////////////////////
+
+ PropertyImpl::PropertyImpl(const Type& cont,
+ const char* inname,
+ const TypeImpl& intype,
+ bool many ,
+ bool ro ,
+ bool contain) :
+ containertype(cont),
+ type(intype),
+ defvalue(0),
+ defvaluelength(0),
+ opposite(0),
+ stringdef(0),
+ bisMany(many),
+ bisArray(false),
+ bisReadOnly(ro),
+ bisContainer(contain),
+ bDefaulted(false),
+ bisReference(false)
+ {
+ if (inname != 0)
+ {
+ name = inname;
+ }
+ else
+ {
+ name.erase();
+ }
+ if (contain == false && intype.isDataObjectType())
+ {
+ bisReference = true;
+ }
+ }
+
+ PropertyImpl::PropertyImpl(const Type& cont,
+ const SDOString& inname,
+ const TypeImpl& intype,
+ bool many,
+ bool ro,
+ bool contain) :
+ containertype(cont),
+ name(inname),
+ type(intype),
+ bisMany(many),
+ bisArray(false),
+ bisReadOnly(ro),
+ bisContainer(contain),
+ bDefaulted(false),
+ opposite(0),
+ stringdef(0),
+ defvalue(0),
+ defvaluelength(0),
+ bisReference(false)
+ {
+ if (contain == false && intype.isDataObjectType())
+ {
+ bisReference = true;
+ }
+ }
+
+ PropertyImpl::PropertyImpl(const PropertyImpl& p) :
+ type((*(p.getTypeImpl()))),
+ containertype(p.getContainingType()),
+ name(p.name),
+ bisMany(p.bisMany),
+ bisArray(false),
+ bisReadOnly(p.bisReadOnly),
+ bisContainer(p.bisContainer),
+ bDefaulted(false),
+ opposite(0),
+ defvalue(0),
+ defvaluelength(0),
+ stringdef(0),
+ bisReference(false)
+ {
+ if (bisContainer == false && type.isDataObjectType())
+ {
+ bisReference = true;
+ }
+ }
+
+ PropertyImpl::~PropertyImpl()
+ {
+ // If the default value is an array type then we must use delete[]
+ // otherwise delete
+ if (defvalue != 0)
+ {
+ if (bisArray)
+ {
+ delete[] defvalue;
+ }
+ else
+ {
+ delete defvalue;
+ }
+ }
+ if (stringdef != 0)
+ {
+ delete[] stringdef;
+ }
+ }
+
+ ///////////////////////////////////////////////////////////////////////////
+ // Setting of attributes by DAS
+ ///////////////////////////////////////////////////////////////////////////
+
+ void PropertyImpl::setMany(bool many)
+ {
+ bisMany = many;
+ }
+
+ void PropertyImpl::setReadOnly(bool readonly)
+ {
+ bisReadOnly = readonly;
+ }
+
+ void PropertyImpl::setContainment(bool contains)
+ {
+ if (contains == true && type.isDataType())
+ {
+ return;
+ }
+ bisContainer = contains;
+ if (bisContainer == false && type.isDataObjectType())
+ {
+ bisReference = true;
+ }
+ else
+ {
+ bisReference = false;
+ }
+ }
+
+
+ ///////////////////////////////////////////////////////////////////////////
+ // Setting of defaults by DAS
+ ///////////////////////////////////////////////////////////////////////////
+
+ void PropertyImpl::setDefault(bool b )
+ {
+ setDefaultBoolean(b);
+ }
+
+ void PropertyImpl::setDefault(char c )
+ {
+ setDefaultByte(c);
+ }
+
+ void PropertyImpl::setDefault(wchar_t c )
+ {
+ setDefaultCharacter(c);
+ }
+ void PropertyImpl::setDefault(char* c )
+ {
+ setDefaultCString(c);
+ }
+ void PropertyImpl::setDefault(const SDOString& c)
+ {
+ setDefaultCString(c);
+ }
+ void PropertyImpl::setDefault(short s )
+ {
+ setDefaultShort(s);
+ }
+#if __WORDSIZE !=64
+ void PropertyImpl::setDefault(long i )
+ {
+ setDefaultInt(i);
+ }
+#endif
+ void PropertyImpl::setDefault(int64_t i )
+ {
+ setDefaultLong(i);
+ }
+ void PropertyImpl::setDefault(float f )
+ {
+ setDefaultFloat(f);
+ }
+ void PropertyImpl::setDefault(long double d )
+ {
+ setDefaultDouble(d);
+ }
+ void PropertyImpl::setDefault(const SDODate d )
+ {
+ setDefaultDate(d);
+ }
+ void PropertyImpl::setDefault(const char* c , unsigned int len)
+ {
+ setDefaultBytes(c, len);
+ }
+ void PropertyImpl::setDefault(const SDOString& c , unsigned int len)
+ {
+ setDefaultBytes(c, len);
+ }
+
+ void PropertyImpl::setDefault(const wchar_t* c, unsigned int len )
+ {
+ setDefaultString(c, len);
+ }
+
+ ///////////////////////////////////////////////////////////////////////////
+ // Substitution groups.
+ ///////////////////////////////////////////////////////////////////////////
+ const Type* PropertyImpl::getSubstitutionType(const char* inname) const
+ {
+ for (unsigned int i=0;i<substitutions.size();i++)
+ {
+ if (!strcmp(inname, substitutions[i].name.c_str()))
+ {
+ return substitutions[i].type;
+ }
+ }
+ return 0;
+ }
+
+ const char * PropertyImpl::getSubstitutionName(unsigned int index) const
+ {
+ if (index < getSubstitutionCount())
+ {
+ return (substitutions[index].name.c_str());
+ }
+ throw SDOIndexOutOfRangeException(TUSCANY_SDO_EINFO,
+ "index out of range");
+ }
+
+ unsigned int PropertyImpl::getSubstitutionCount(void) const
+ {
+ return substitutions.size();
+ }
+
+ const Type* PropertyImpl::getSubstitutionType(unsigned int index) const
+ {
+ if (index < getSubstitutionCount())
+ {
+ return (substitutions[index].type);
+ }
+ return 0;
+ }
+
+ void PropertyImpl::setSubstitution(DataFactoryPtr mdg, const char* alias,
+ const Type& substype)
+ {
+ substitutions.push_back(Substitution(mdg,alias,substype));
+ }
+
+
+ ///////////////////////////////////////////////////////////////////////////
+ // Returns the name of the property.
+ ///////////////////////////////////////////////////////////////////////////
+ const char* PropertyImpl::getName() const
+ {
+ return name.c_str();
+ }
+
+// const SDOString& PropertyImpl::getName() const
+// {
+// return name;
+// }
+
+ void PropertyImpl::setAlias(const char* alias)
+ {
+ char* tmp = new char[strlen(alias)+1];
+ strcpy(tmp,alias);
+ aliases.push_back(tmp);
+ }
+
+ void PropertyImpl::setAlias(const SDOString& alias)
+ {
+ aliases.push_back(alias);
+ }
+
+ const char* PropertyImpl::getAlias(unsigned int index) const
+ {
+ if (index < aliases.size())
+ {
+ return aliases[index].c_str();
+ }
+ return name.c_str();
+ }
+
+ unsigned int PropertyImpl::getAliasCount() const
+ {
+ return aliases.size();
+ }
+
+
+ ///////////////////////////////////////////////////////////////////////////
+ // Returns the type of the property.
+ ///////////////////////////////////////////////////////////////////////////
+ const Type& PropertyImpl::getType() const
+ {
+ return (Type&)type;
+ }
+
+ const Type::Types PropertyImpl::getTypeEnum() const
+ {
+ return type.getTypeEnum();
+ }
+
+ ///////////////////////////////////////////////////////////////////////////
+ // Returns the type of the property.
+ ///////////////////////////////////////////////////////////////////////////
+ const TypeImpl* PropertyImpl::getTypeImpl() const
+ {
+ return &type;
+ }
+
+ ///////////////////////////////////////////////////////////////////////////
+ // Returns whether the property is many-valued.
+ ///////////////////////////////////////////////////////////////////////////
+ bool PropertyImpl::isMany() const
+ {
+ if(getTypeImpl()->isFromList())return true;
+ return bisMany;
+ }
+
+ ///////////////////////////////////////////////////////////////////////////
+ // Returns whether the property is containment.
+ ///////////////////////////////////////////////////////////////////////////
+ bool PropertyImpl::isContainment() const
+ {
+ return bisContainer;
+ }
+
+ ///////////////////////////////////////////////////////////////////////////
+ // Returns whether the property is containment.
+ ///////////////////////////////////////////////////////////////////////////
+ bool PropertyImpl::isReference() const
+ {
+ return bisReference;
+ }
+
+ ///////////////////////////////////////////////////////////////////////////
+ // Returns the containing type of this property.
+ ///////////////////////////////////////////////////////////////////////////
+ const Type& PropertyImpl::getContainingType() const
+ {
+ return containertype;
+ }
+
+ ///////////////////////////////////////////////////////////////////////////
+ // Returns the opposite.
+ ///////////////////////////////////////////////////////////////////////////
+ const Property* PropertyImpl::getOpposite() const
+ {
+ return opposite;
+ }
+
+ void PropertyImpl::setOpposite(const Property* opp)
+ {
+ opposite = opp;
+ }
+ ///////////////////////////////////////////////////////////////////////////
+ // Returns the default value this property will have in a
+ // data object where the property hasn't been set.
+ ///////////////////////////////////////////////////////////////////////////
+
+ // check whether the property has a default first
+ bool PropertyImpl::isDefaulted() const
+ {
+ return bDefaulted;
+ }
+
+ const char* PropertyImpl::getCStringDefault() const
+ {
+ PropertyImpl* p = (PropertyImpl*)this;
+ return getTypeImpl()->convertToCString(defvalue, &(p->stringdef), defvaluelength);
+ }
+ bool PropertyImpl::getBooleanDefault() const
+ {
+ return getTypeImpl()->convertToBoolean(defvalue,defvaluelength);
+ }
+ char PropertyImpl::getByteDefault() const
+ {
+ return getTypeImpl()->convertToByte(defvalue,defvaluelength);
+ }
+ wchar_t PropertyImpl::getCharacterDefault() const
+ {
+ return getTypeImpl()->convertToCharacter(defvalue,defvaluelength);
+ }
+ short PropertyImpl::getShortDefault() const
+ {
+ return getTypeImpl()->convertToShort(defvalue,defvaluelength);
+ }
+ long PropertyImpl::getIntDefault() const
+ {
+ return getTypeImpl()->convertToInt(defvalue,defvaluelength);
+ }
+ int64_t PropertyImpl::getLongDefault() const
+ {
+ return getTypeImpl()->convertToLong(defvalue,defvaluelength);
+ }
+ float PropertyImpl::getFloatDefault() const
+ {
+ return getTypeImpl()->convertToFloat(defvalue,defvaluelength);
+ }
+ long double PropertyImpl::getDoubleDefault() const
+ {
+ return getTypeImpl()->convertToDouble(defvalue,defvaluelength);
+ }
+ const SDODate PropertyImpl::getDateDefault() const
+ {
+ return getTypeImpl()->convertToDate(defvalue,defvaluelength);
+ }
+ unsigned int PropertyImpl::getStringDefault(wchar_t* val, unsigned int max) const
+ {
+ if (val == 0 || max == 0) return defvaluelength;
+ return getTypeImpl()->convertToString(defvalue, val, defvaluelength, max);
+
+ }
+ unsigned int PropertyImpl::getBytesDefault(char* val, unsigned int max) const
+ {
+ if (val == 0 || max == 0) return defvaluelength;
+ return getTypeImpl()->convertToBytes(defvalue, val, defvaluelength, max);
+ }
+
+ unsigned int PropertyImpl::getBytesDefault(SDOString& val, unsigned int max) const
+ {
+ if (max == 0) return defvaluelength;
+ return getTypeImpl()->convertToBytes(defvalue, val, defvaluelength, max);
+ }
+
+ unsigned int PropertyImpl::getDefaultLength() const
+ {
+ return defvaluelength;
+ }
+
+ ///////////////////////////////////////////////////////////////////////////
+ // sets the default value by type
+ ///////////////////////////////////////////////////////////////////////////
+
+ void PropertyImpl::setDefaultCString(const char* s)
+ {
+ bDefaulted=true;
+ bisArray = true;
+ defvaluelength = getTypeImpl()->convert(&defvalue,s);
+ }
+ void PropertyImpl::setDefaultCString(const SDOString& s)
+ {
+ bDefaulted=true;
+ bisArray = true;
+ defvaluelength = getTypeImpl()->convert(&defvalue, s);
+ }
+ void PropertyImpl::setDefaultString( const wchar_t* c , unsigned int len )
+ {
+ bDefaulted=true;
+ bisArray = true;
+ defvaluelength = getTypeImpl()->convert(&defvalue,c, len);
+ }
+ void PropertyImpl::setDefaultBytes( const char* c , unsigned int len )
+ {
+ bDefaulted=true;
+ bisArray = true;
+ defvaluelength = getTypeImpl()->convert(&defvalue,c, len);
+ }
+ void PropertyImpl::setDefaultBytes(const SDOString& c , unsigned int len)
+ {
+ bDefaulted=true;
+ bisArray = true;
+ defvaluelength = getTypeImpl()->convert(&defvalue,c, len);
+ }
+ void PropertyImpl::setDefaultBoolean( const bool b )
+ {
+ bDefaulted=true;
+ defvaluelength = getTypeImpl()->convert(&defvalue,b);
+ }
+ void PropertyImpl::setDefaultByte( const char c )
+ {
+ bDefaulted=true;
+ defvaluelength = getTypeImpl()->convert(&defvalue,c);
+ }
+ void PropertyImpl::setDefaultCharacter( const wchar_t c)
+ {
+ bDefaulted=true;
+ defvaluelength = getTypeImpl()->convert(&defvalue,c);
+ }
+ void PropertyImpl::setDefaultShort( const short s )
+ {
+ bDefaulted=true;
+ defvaluelength = getTypeImpl()->convert(&defvalue,s);
+ }
+ void PropertyImpl::setDefaultInt( const long i )
+ {
+ bDefaulted=true;
+#if __WORDSIZE ==64
+ defvaluelength = getTypeImpl()->convert(&defvalue,(int64_t)i);
+#else
+ defvaluelength = getTypeImpl()->convert(&defvalue,i);
+#endif
+ }
+ void PropertyImpl::setDefaultLong(const int64_t l)
+ {
+ bDefaulted=true;
+ defvaluelength = getTypeImpl()->convert(&defvalue,l);
+ }
+ void PropertyImpl::setDefaultFloat( const float f )
+ {
+ bDefaulted=true;
+ defvaluelength = getTypeImpl()->convert(&defvalue,f);
+ }
+ void PropertyImpl::setDefaultDouble( const long double d )
+ {
+ bDefaulted=true;
+ defvaluelength = getTypeImpl()->convert(&defvalue,d);
+ }
+ void PropertyImpl::setDefaultDate( const SDODate d )
+ {
+ bDefaulted=true;
+ defvaluelength = getTypeImpl()->convertDate(&defvalue,d);
+ }
+
+ ///////////////////////////////////////////////////////////////////////////
+ // Returns true if values for this Property cannot be modified using the SDO APIs.
+ // When true, DataObject.set(Property property, Object value) throws an exception.
+ // Values may change due to other factors, such as services operating on DataObjects.
+ ///////////////////////////////////////////////////////////////////////////
+ bool PropertyImpl::isReadOnly() const
+ {
+ return bisReadOnly;
+ }
+
+};
+};
+
+
diff --git a/sdo-cpp/trunk/runtime/core/src/commonj/sdo/PropertyImpl.h b/sdo-cpp/trunk/runtime/core/src/commonj/sdo/PropertyImpl.h
new file mode 100644
index 0000000000..418c0e7b27
--- /dev/null
+++ b/sdo-cpp/trunk/runtime/core/src/commonj/sdo/PropertyImpl.h
@@ -0,0 +1,294 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you 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$ */
+
+#ifndef _PROPERTYIMPL_H_
+#define _PROPERTYIMPL_H_
+
+#include "commonj/sdo/disable_warn.h"
+
+#include "commonj/sdo/DASProperty.h"
+#include "commonj/sdo/SDODate.h"
+#include "commonj/sdo/DataFactory.h"
+
+namespace commonj{
+namespace sdo{
+
+class Type;
+class TypeImpl;
+class DataObject;
+
+/**
+ * A substitution is a class which permits a property to be a substitute for
+ * another one.
+ * A substitution is a definition of a type which is allowed to be placed in the
+ * data object in place of a property of another type.
+ */
+
+class Substitution
+{
+public:
+ Substitution();
+ Substitution(DataFactoryPtr mdg, const SDOString& inname,
+ const Type& intype);
+ Substitution(const Substitution& s);
+ virtual ~Substitution();
+ const Type* type;
+ SDOString name;
+};
+
+
+
+/** PropertyImpl implements the abstract class Property.
+ *
+ * A representation of a property in the type of a data object.
+ */
+
+class PropertyImpl :public DASProperty
+{
+ public:
+
+
+ ///////////////////////////////////////////////////////////////////////////
+ // Construction for the DAS
+ ///////////////////////////////////////////////////////////////////////////
+
+ SDO_API PropertyImpl(
+ const Type& cont,
+ const char* name,
+ const TypeImpl& type,
+ bool many = false,
+ bool ro = false,
+ bool contain = false);
+
+ SDO_API PropertyImpl(const Type& cont,
+ const SDOString& name,
+ const TypeImpl& type,
+ bool many = false,
+ bool ro = false,
+ bool contain = false);
+
+
+
+ virtual SDO_API ~PropertyImpl();
+
+ /**
+ * A Data access service may set the features of this property instead of
+ * passing them as construction parameters.
+ */
+
+ virtual SDO_API void setMany(bool many );
+
+ /**
+ * A Data access service may set the features of this property instead of
+ * passing them as construction parameters.
+ */
+ virtual SDO_API void setReadOnly(bool rdonly);
+
+ /**
+ * A Data access service may set the features of this property instead of
+ * passing them as construction parameters.
+ */
+ virtual SDO_API void setContainment(bool contains);
+
+ /**
+ * A Data access service may set the features of this property instead of
+ * passing them as construction parameters.
+ */
+
+ virtual SDO_API bool isDefaulted() const;
+
+ /**
+ * A Data access service sets the default value.
+ */
+
+ virtual SDO_API void setDefault(bool b );
+ virtual SDO_API void setDefault(char c);
+ virtual SDO_API void setDefault(wchar_t c);
+ virtual SDO_API void setDefault(char* c);
+ virtual SDO_API void setDefault(const SDOString& c);
+ virtual SDO_API void setDefault(short s);
+#if __WORDSIZE !=64
+ virtual SDO_API void setDefault(long l);
+#endif
+ virtual SDO_API void setDefault(int64_t i);
+ virtual SDO_API void setDefault(float f);
+ virtual SDO_API void setDefault(long double d);
+ virtual SDO_API void setDefault(const SDODate d);
+ virtual SDO_API void setDefault(const wchar_t* c, unsigned int len);
+ virtual SDO_API void setDefault(const char* c, unsigned int len);
+ virtual SDO_API void setDefault(const SDOString& c, unsigned int len);
+
+
+
+
+
+ /**
+ * Returns the name of the property.
+ */
+
+ virtual const SDO_API char* getName() const;
+
+ /** getAlias returns the n'th alias
+ *
+ * This method returns a const char* corresponding to the
+ * alias at index n of the list of aliases. Use getAliasCount to
+ * discover the size of the list.
+ */
+
+ virtual const char* getAlias(unsigned int index = 0) const ;
+ virtual unsigned int getAliasCount() const ;
+ virtual void setAlias(const char* alias) ;
+ virtual void setAlias(const SDOString& alias) ;
+
+ /**
+ *
+ * SubstitutionGroup support.
+ */
+
+ virtual const Type* getSubstitutionType(const char* name) const ;
+ virtual unsigned int getSubstitutionCount(void) const ;
+ virtual const Type* getSubstitutionType(unsigned int index) const ;
+ virtual const char* getSubstitutionName(unsigned int index) const ;
+ virtual void setSubstitution(DataFactoryPtr mdg, const char* alias,
+ const Type& substype) ;
+
+
+ /** getType returns the type of this property
+ *
+ * This method returns the type, which may be a DataType or a
+ * DataObjectType
+ */
+
+ virtual SDO_API const Type& getType() const;
+
+ virtual SDO_API const Type::Types getTypeEnum() const;
+
+ virtual SDO_API const TypeImpl* getTypeImpl() const;
+
+ /**
+ * Returns whether the property is many-valued.
+ */
+ virtual bool SDO_API isMany() const;
+
+ /**
+ * Returns whether the property is containment.
+ */
+ virtual bool SDO_API isContainment() const;
+
+ /**
+ * Returns whether the property is a reference.
+ */
+ virtual bool SDO_API isReference() const;
+
+ /**
+ * Returns the containing type of this property.
+ */
+ virtual SDO_API const Type& getContainingType() const;
+
+ /**
+ * returns the opposite property, or zero if there is none
+ */
+ virtual SDO_API const Property* getOpposite() const;
+
+ virtual void setOpposite(const Property* opp);
+
+
+ /**
+ * setters for type primitive types and 'an object'
+ */
+
+ SDO_API void setDefaultCString( const char* s);
+ SDO_API void setDefaultCString(const SDOString& s);
+ SDO_API void setDefaultString( const wchar_t* c , unsigned int len );
+ SDO_API void setDefaultBytes( const char* c , unsigned int len );
+ SDO_API void setDefaultBytes(const SDOString& c , unsigned int len);
+ SDO_API void setDefaultBoolean( const bool b );
+ SDO_API void setDefaultByte( const char c );
+ SDO_API void setDefaultCharacter( const wchar_t c);
+ SDO_API void setDefaultShort( const short s );
+ SDO_API void setDefaultInt( const long i );
+ SDO_API void setDefaultLong(const int64_t l);
+ SDO_API void setDefaultFloat( const float f );
+ SDO_API void setDefaultDouble( const long double d );
+ SDO_API void setDefaultDate( const SDODate d );
+
+ SDO_API const char* getCStringDefault() const;
+ SDO_API unsigned int getStringDefault(wchar_t* val, unsigned int max) const;
+ SDO_API unsigned int getBytesDefault(char* val, unsigned int max) const;
+ SDO_API unsigned int getBytesDefault(SDOString& val, unsigned int max) const;
+ SDO_API bool getBooleanDefault() const;
+ SDO_API char getByteDefault() const;
+ SDO_API wchar_t getCharacterDefault() const;
+ SDO_API short getShortDefault() const;
+ SDO_API long getIntDefault() const;
+ SDO_API int64_t getLongDefault() const;
+ SDO_API float getFloatDefault() const;
+ SDO_API long double getDoubleDefault() const;
+ SDO_API const SDODate getDateDefault() const;
+ SDO_API unsigned int getDefaultLength() const;
+
+ /**
+ * Returns true if values for this Property cannot be modified using the SDO APIs.
+ * When true, DataObject.set(Property property, Object value) throws an exception.
+ * Values may change due to other factors, such as services operating on DataObjects.
+ */
+ virtual bool SDO_API isReadOnly() const;
+
+ SDO_API PropertyImpl(const PropertyImpl& p);
+
+ private:
+
+ // clear the default value
+ void deleteValue();
+
+ bool bisReadOnly;
+ bool bisContainer;
+ bool bisReference;
+ bool bisMany;
+ bool bisArray;
+
+ bool bDefaulted;
+
+ const TypeImpl& type;
+ const Type& containertype;
+ const Property* opposite;
+ SDOString name;
+ char* stringdef;
+
+ void* defvalue;
+ // in the event of a bytes and string, this holds the length
+ unsigned int defvaluelength;
+
+ // alias support
+ // std::vector<char*> aliases;
+ std::vector<SDOString> aliases;
+
+ std::vector<Substitution> substitutions;
+
+ typedef std::list<PropertyImpl*> REFEREE_LIST;
+ REFEREE_LIST references;
+
+
+};
+};
+};
+
+#endif //_PROPERTYIMPL_H_
diff --git a/sdo-cpp/trunk/runtime/core/src/commonj/sdo/PropertyList.cpp b/sdo-cpp/trunk/runtime/core/src/commonj/sdo/PropertyList.cpp
new file mode 100644
index 0000000000..a7c8d92be5
--- /dev/null
+++ b/sdo-cpp/trunk/runtime/core/src/commonj/sdo/PropertyList.cpp
@@ -0,0 +1,85 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you 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$ */
+
+#ifndef SDO_EXPORTS
+ #define SDO_EXPORTS
+#endif
+
+#include "commonj/sdo/export.h"
+#include <iostream>
+#include "commonj/sdo/Property.h"
+#include "commonj/sdo/PropertyImpl.h"
+#include "commonj/sdo/Type.h"
+#include "commonj/sdo/PropertyList.h"
+
+#include "commonj/sdo/Logger.h"
+
+namespace commonj{
+namespace sdo {
+
+class Property;
+
+SDO_API PropertyList::PropertyList(const std::vector<PropertyImplPtr>& p)
+{
+ std::vector<PropertyImplPtr>::const_iterator i;
+ for (i = p.begin(); i != p.end(); ++i)
+ {
+ plist.push_back(*i);
+ }
+}
+
+SDO_API PropertyList::PropertyList(const PropertyList& pin)
+{
+ plist = pin.plist;
+}
+
+SDO_API PropertyList::PropertyList()
+{
+}
+
+SDO_API PropertyList::~PropertyList()
+{
+}
+
+SDO_API Property& PropertyList::operator[] (int pos)
+{
+ return *(plist[pos]);
+}
+
+SDO_API const Property& PropertyList::operator[] (int pos) const
+{
+ return *(plist[pos]);
+}
+
+SDO_API unsigned int PropertyList::size ()
+{
+ return plist.size();
+}
+
+SDO_API void PropertyList::insert(const Property& p)
+{
+ PropertyImpl* pi = (PropertyImpl*) &p;
+ plist.push_back(new PropertyImpl(*pi));
+}
+
+} // end namespace sdo
+} // end namespace commonj
+
diff --git a/sdo-cpp/trunk/runtime/core/src/commonj/sdo/PropertyList.h b/sdo-cpp/trunk/runtime/core/src/commonj/sdo/PropertyList.h
new file mode 100644
index 0000000000..f9aee689c7
--- /dev/null
+++ b/sdo-cpp/trunk/runtime/core/src/commonj/sdo/PropertyList.h
@@ -0,0 +1,86 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you 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$ */
+
+#ifndef _PROPERTYLIST_H_
+#define _PROPERTYLIST_H_
+
+
+#include "commonj/sdo/export.h"
+#include "commonj/sdo/RefCountingPointer.h"
+
+#include <vector>
+#include <list>
+
+
+
+
+namespace commonj{
+namespace sdo{
+
+ class PropertyImpl;
+ class Property;
+
+/**
+ * This class provides for iteration over a collection of Properties
+ */
+
+class PropertyList
+{
+public:
+ SDO_API PropertyList(const std::vector<PropertyImplPtr>& p);
+ SDO_API PropertyList(const std::list<PropertyPtr>& p);
+ SDO_API PropertyList(const PropertyList& pin);
+ SDO_API PropertyList();
+ virtual SDO_API ~PropertyList();
+
+ /** []
+ *
+ * Operator to allow reference to an element of the list.
+ * There are separate versions for const and variable lists
+ */
+
+ SDO_API Property& operator[] (int pos);
+ SDO_API const Property& operator[] (int pos) const;
+
+ /** size gives the number of elements.
+ *
+ * size() returns the number of elements in the list.
+ */
+
+ SDO_API unsigned int size ();
+
+ /** insert adds an element to the list
+ *
+ * insert appends an item to the list. This is not
+ * of any use to a client application, as these lists
+ * are always supplied by the library, and are const.
+ */
+
+ SDO_API void insert (const Property& p);
+private:
+ std::vector<PropertyImplPtr> plist;
+};
+
+} // end namespace sdo
+} // end namespace commonj
+
+
+#endif
diff --git a/sdo-cpp/trunk/runtime/core/src/commonj/sdo/PropertySetting.cpp b/sdo-cpp/trunk/runtime/core/src/commonj/sdo/PropertySetting.cpp
new file mode 100644
index 0000000000..6ede2d3301
--- /dev/null
+++ b/sdo-cpp/trunk/runtime/core/src/commonj/sdo/PropertySetting.cpp
@@ -0,0 +1,69 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you 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$ */
+
+#include "commonj/sdo/PropertySetting.h"
+#include "SDOString.h"
+#include "SDOUtils.h"
+
+namespace commonj
+{
+ namespace sdo
+ {
+
+ using internal::SDOUtils;
+
+ PropertySetting::PropertySetting()
+ : dataObject(NULL), isNULL(false), isIDREF(false), pendingUnknownType(false)
+
+ {
+ }
+
+ PropertySetting::PropertySetting(DataObjectPtr dataObj, const SDOXMLString& propertyName,
+ bool isNull, bool IDREF)
+ : dataObject(dataObj), name(propertyName), isNULL(isNull),isIDREF(IDREF),pendingUnknownType(false)
+ {
+ }
+
+ PropertySetting::~PropertySetting()
+ {
+ }
+
+
+ /*
+ * The value that PropertySetting uses to hold values passing from
+ * an input XML stream to data object properties is currently an SDOXMLString
+ * SDOXMLString use libxml2 functions to do it's thing and in the process messes
+ * up CDATA markers. To avoid this we use our own version of CDATA makers and
+ * use this method to replace them with the real ones just before the PropertSetting
+ * gets committed to the SDO proper in SDOSAX2Parser
+ */
+ SDOString PropertySetting::getStringWithCDataMarkers()
+ {
+ SDOString valueString((const char*)value);
+
+ SDOString returnString = SDOUtils::replace(valueString, SDOUtils::CDataStartMarker, SDOUtils::XMLCDataStartMarker);
+ returnString = SDOUtils::replace(returnString, SDOUtils::CDataEndMarker, SDOUtils::XMLCDataEndMarker);
+
+ return returnString;
+ }
+
+ } // End - namespace sdo
+} // End - namespace commonj
diff --git a/sdo-cpp/trunk/runtime/core/src/commonj/sdo/PropertySetting.h b/sdo-cpp/trunk/runtime/core/src/commonj/sdo/PropertySetting.h
new file mode 100644
index 0000000000..3133c83c1e
--- /dev/null
+++ b/sdo-cpp/trunk/runtime/core/src/commonj/sdo/PropertySetting.h
@@ -0,0 +1,65 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you 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$ */
+
+#ifndef _PROPERTYSETTING_H_
+#define _PROPERTYSETTING_H_
+
+#include "commonj/sdo/disable_warn.h"
+
+#include "commonj/sdo/SDOXMLString.h"
+#include "commonj/sdo/DataObject.h"
+
+
+namespace commonj
+{
+ namespace sdo
+ {
+
+/**
+ * PropertySetting holds some information about properties as
+ * they are read by the parser, for subsequent creation
+ */
+ class PropertySetting
+ {
+
+ public:
+ PropertySetting();
+ PropertySetting(DataObjectPtr dataObj,
+ const SDOXMLString& propertyName,
+ bool isNull=false,
+ bool isIDREF=false);
+ virtual ~PropertySetting();
+
+ SDOString getStringWithCDataMarkers();
+
+ SDOXMLString name;
+ SDOXMLString value;
+ DataObjectPtr dataObject;
+ bool isIDREF;
+ bool isNULL;
+ bool pendingUnknownType;
+
+ };
+ } // End - namespace sdo
+} // End - namespace commonj
+
+
+#endif //_PROPERTYSETTING_H_
diff --git a/sdo-cpp/trunk/runtime/core/src/commonj/sdo/RefCountingObject.cpp b/sdo-cpp/trunk/runtime/core/src/commonj/sdo/RefCountingObject.cpp
new file mode 100644
index 0000000000..e125f58a85
--- /dev/null
+++ b/sdo-cpp/trunk/runtime/core/src/commonj/sdo/RefCountingObject.cpp
@@ -0,0 +1,83 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you 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$ */
+
+#include "commonj/sdo/RefCountingObject.h"
+#include "commonj/sdo/Logging.h"
+
+#include <iostream>
+using namespace std;
+
+namespace commonj{
+namespace sdo{
+
+long RefCountingObject::allObs = 0;
+
+RefCountingObject::RefCountingObject()
+: refCount(0)
+{
+ LOGINFO_2(HIGHVOLUME,"RCO:CREATE:%p Count:%ld",this, ++allObs);
+}
+
+RefCountingObject::RefCountingObject(const RefCountingObject& rc)
+: refCount(0)
+{
+ LOGINFO_2(HIGHVOLUME,"RCO:COPCON:%p Count:%ld",this,++allObs);
+}
+
+RefCountingObject& RefCountingObject::operator=(const RefCountingObject& rc)
+{
+ return *this;
+}
+
+RefCountingObject::~RefCountingObject()
+{
+ LOGINFO_2(HIGHVOLUME,"RCO:DELETE:%p Count:%ld",this, --allObs);
+ //
+ //if (allObs < 0)
+ // LOGINFO(HIGHVOLUME,"RCO:More objects deleted than created");
+ //if (allObs == 0)
+ // LOGINFO(HIGHVOLUME,"RCO: All data objects deleted");;
+}
+
+void RefCountingObject::addRef()
+
+{
+
+ ++refCount;
+ LOGINFO_2(HIGHVOLUME,"RCO:ADDREF:%p:%ld",this,refCount);
+}
+
+void RefCountingObject::releaseRef()
+{
+ LOGINFO_2(HIGHVOLUME,"RCO:DECREF:%p:%ld",this,refCount-1);
+ if (--refCount == 0) delete this;
+}
+
+
+SDO_API std::ostream& RefCountingObject::printSelf(std::ostream &os)
+{
+ os << "RefCountingObject: reference count = " << refCount <<endl;
+ return os;
+}
+
+
+};
+};
diff --git a/sdo-cpp/trunk/runtime/core/src/commonj/sdo/RefCountingObject.h b/sdo-cpp/trunk/runtime/core/src/commonj/sdo/RefCountingObject.h
new file mode 100644
index 0000000000..6e20ba49cb
--- /dev/null
+++ b/sdo-cpp/trunk/runtime/core/src/commonj/sdo/RefCountingObject.h
@@ -0,0 +1,67 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you 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$ */
+
+#ifndef _REFCOUNTINGOBJECT_H
+#define _REFCOUNTINGOBJECT_H
+
+
+#include "commonj/sdo/export.h"
+#include <iostream>
+
+namespace commonj {
+ namespace sdo {
+
+/**
+ * RefcountingObject is the base class for all objects in SDO
+ * These objects keep a count of references to themselves, then
+ * free themselves when they are unused.
+ */
+ class RefCountingObject
+ {
+ public:
+ SDO_API RefCountingObject();
+ SDO_API RefCountingObject(const RefCountingObject& rc);
+ SDO_API RefCountingObject& operator=(const RefCountingObject& rc);
+ SDO_API virtual ~RefCountingObject() = 0;
+/**
+ * Add to the reference count - a new pointer has been created.
+ */
+ SDO_API void addRef();
+/**
+ * Subtract from the the reference count - a reference has dropped.
+ */
+ SDO_API void releaseRef();
+
+/**
+ * Print contents to stream
+ */
+ SDO_API virtual std::ostream& printSelf(std::ostream &os);
+
+
+ private:
+ unsigned int refCount;
+ static long allObs;
+ };
+
+ };
+};
+
+#endif
diff --git a/sdo-cpp/trunk/runtime/core/src/commonj/sdo/RefCountingPointer.cpp b/sdo-cpp/trunk/runtime/core/src/commonj/sdo/RefCountingPointer.cpp
new file mode 100644
index 0000000000..ce3621596c
--- /dev/null
+++ b/sdo-cpp/trunk/runtime/core/src/commonj/sdo/RefCountingPointer.cpp
@@ -0,0 +1,155 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you 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$ */
+
+#include "commonj/sdo/RefCountingPointer.h"
+#include "commonj/sdo/DataFactory.h"
+#include "commonj/sdo/DataObject.h"
+#include "commonj/sdo/DataGraph.h"
+#include "commonj/sdo/ChangeSummary.h"
+#include "commonj/sdo/XMLDocument.h"
+#include "commonj/sdo/XSDHelper.h"
+#include "commonj/sdo/XMLHelper.h"
+
+namespace commonj{
+ namespace sdo{
+
+ // officially, there is nothing here- but if I dont use the overrides in
+ // the templates, then they dont get generated.
+ void Test ()
+ {
+
+#if defined(WIN32) || defined (_WINDOWS)
+ /* 1) construct */
+ DataFactoryPtr fptr = DataFactory::getDataFactory();
+
+ /* 2) use the & operator= */
+ fptr = DataFactory::getDataFactory();
+
+ /* 3) copy */
+ DataFactoryPtr fptr2 = fptr;
+
+ /* 4) use the == and ! */
+ if (fptr2 == fptr || !fptr){}
+
+ /* 5) Use the T* and * */
+ DataFactory* dmsf = getRawPointer(fptr);
+ DataFactory& dmsr = *fptr;
+
+ /* 1) construct */
+ DataFactoryPtr dfptr(fptr);
+
+ /* 3) copy */
+ DataFactoryPtr dfptr2 = dfptr;
+
+ /* 2) use the & operator= */
+ dfptr = dfptr2;
+
+ /* 4) use the == and ! */
+ if (dfptr2 == dfptr || !dfptr){}
+
+ /* 5) Use the T* and * */
+ DataFactory* ddmsf = getRawPointer(dfptr);
+ DataFactory& ddmsr = *dfptr;
+
+ /* 6) Use the -> */
+ DataObjectPtr dptr = dfptr->create("nothing","nowhere");
+
+ /* and agin to catch the = */
+ dptr = fptr->create("nothing","nowhere");
+
+ DataObjectPtr dptr2 = dptr;
+
+ /* Use the T* and * */
+ DataObject* dof = getRawPointer(dptr);
+ DataObject& dor = *dptr;
+
+ if (dptr2 == dptr || !dptr){}
+
+
+ ChangeSummaryPtr cptr = dptr->getChangeSummary();
+ cptr = dptr->getChangeSummary();
+ ChangeSummaryPtr cptr2 = cptr;
+
+ ChangeSummary* cof = getRawPointer(cptr);
+ ChangeSummary& cop = *cptr;
+
+
+ if (cptr2 == cptr || !cptr){}
+
+ cptr->endLogging();
+
+ SequencePtr sptr = dptr->getSequence();
+ sptr = dptr->getSequence();
+ SequencePtr sptr2 = sptr;
+
+ Sequence* sof = getRawPointer(sptr);
+ Sequence& sop = *sptr;
+
+
+ if (sptr2 == sptr || !sptr){}
+
+ sptr->getBooleanValue(0);
+
+
+ // Generate code for XMLDocumentPtr
+ XMLDocumentPtr xmldocptr1 = 0;
+ XMLDocumentPtr xmldocptr2 = xmldocptr1;
+ xmldocptr1 = xmldocptr2;
+ if (xmldocptr2 == xmldocptr1 || !xmldocptr1){}
+ XMLDocument* xmldocp = getRawPointer(xmldocptr1);
+ XMLDocument& xmldocref = *xmldocptr2;
+ xmldocptr1->getEncoding();
+
+ // Generate code for XSDHelperPtr
+ XSDHelperPtr xsdhptr1 = 0;
+ XSDHelperPtr xsdhptr2 = xsdhptr1;
+ xsdhptr1 = xsdhptr2;
+ if (xsdhptr2 == xsdhptr1 || !xsdhptr1){}
+ XSDHelper* xsdhp = getRawPointer(xsdhptr1);
+ XSDHelper& xsdhref = *xsdhptr2;
+ xsdhptr1->define("dummy");
+
+ // Generate code for XMLHelperPtr
+ XMLHelperPtr xmlhptr1 = 0;
+ XMLHelperPtr xmlhptr2 = xmlhptr1;
+ xmlhptr1 = xmlhptr2;
+ if (xmlhptr2 == xmlhptr1 || !xmlhptr1){}
+ XMLHelper* xmlhp = getRawPointer(xmlhptr1);
+ XMLHelper& xmlhref = *xmlhptr2;
+ xmlhptr1->load("dummy");
+
+ // Generate code for DataGraphPtr
+ DataGraphPtr dgptr1 = 0;
+ DataGraphPtr dgptr2 = dgptr1;
+ dgptr1 = dgptr2;
+ if (dgptr2 == dgptr1 || !dgptr1){}
+ DataGraph* dghp = getRawPointer(dgptr1);
+ DataGraph& dgref = *dgptr2;
+ dgptr1->getRootObject();
+
+#endif
+
+ }
+ };
+};
+
+
+
diff --git a/sdo-cpp/trunk/runtime/core/src/commonj/sdo/RefCountingPointer.h b/sdo-cpp/trunk/runtime/core/src/commonj/sdo/RefCountingPointer.h
new file mode 100644
index 0000000000..c4cbc41197
--- /dev/null
+++ b/sdo-cpp/trunk/runtime/core/src/commonj/sdo/RefCountingPointer.h
@@ -0,0 +1,283 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you 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$ */
+
+#ifndef _REFCOUNTINGPOINTER_H
+#define _REFCOUNTINGPOINTER_H
+
+
+#include "commonj/sdo/export.h"
+#include "commonj/sdo/SDORuntimeException.h"
+
+#include <iostream>
+
+namespace commonj{
+namespace sdo{
+
+/**
+ * RefcountingPointer is a template for all SDO pointers.
+ * The ref count increases with each use, and drops when one of these
+ * goes out of scope.
+ * Refcounting pointers are a lot like smart pointers, however in this
+ * implementation there is a cast method to a void*, so unlike real
+ * smart pointers, a user might call "delete mypointer", which would
+ * compile, but cause a crash.
+ * RefCountingPointers do not need to be deleted.
+ */
+
+template <class T>
+class RefCountingPointer {
+ // This private typedef is an offset pointer to a member function.
+ // It helps us with a trick for safe conversions to bool
+ typedef void (RefCountingPointer<T>::*UnspecifiedBoolType)() const;
+
+ public:
+ typedef T* PointerType;
+
+ /*SDO_API*/ RefCountingPointer(PointerType realPtr = 0);
+ /*SDO_API*/ RefCountingPointer(const RefCountingPointer& rhs);
+ template <typename otherType>
+ RefCountingPointer(const RefCountingPointer<otherType>& rhs)
+ : pointee(getRawPointer(rhs))
+ {
+ init();
+ }
+ /*SDO_API*/ ~RefCountingPointer();
+ /*SDO_API*/ RefCountingPointer& operator=(const RefCountingPointer& rhs);
+ /*SDO_API*/ T* operator->() const;
+ /*SDO_API*/ T& operator*() const;
+ /*SDO_API*/ bool operator!() const;
+
+ // Returns an unspecified boolean type to allow for testing if the
+ // associated pointer is null. The boolean type is not specified in order
+ // to avoid unintended implicit conversions.
+ operator typename RefCountingPointer<T>::UnspecifiedBoolType() const
+ {
+ if (pointee) {
+ return &RefCountingPointer<T>::UnspecifiedBoolHelper;
+ }
+ return 0;
+ }
+
+ template <class otherType>
+ operator RefCountingPointer<otherType>()
+ {
+ return RefCountingPointer<otherType>(pointee);
+ }
+
+ template <class otherType>
+ operator const RefCountingPointer<otherType>() const
+ {
+ return RefCountingPointer<otherType>(pointee);
+ }
+
+ friend std::ostream& operator<< (std::ostream &os, const RefCountingPointer<T>& ptr)
+ {
+ if (!ptr)
+ {
+ os << "RefCountingPointer is NULL" << std::endl;
+ }
+ else
+ {
+ ptr->printSelf(os);
+ }
+
+ return os;
+ }
+
+ // utility function for accessing the underlying raw pointer
+ template <class otherType>
+ friend otherType* getRawPointer(const RefCountingPointer<otherType>& pointer);
+
+ private:
+ // Defines a member function we can return the addresss to when
+ // evaluating whether the pointer is valid or not. This function
+ // serves no purpose beyond providing a non-zero value for use in
+ // boolean expressions.
+ void UnspecifiedBoolHelper() const {}
+
+ PointerType pointee;
+ void init();
+};
+
+
+
+template<class T>
+void RefCountingPointer<T>::init()
+{
+ if (pointee == 0) return;
+ pointee->addRef();
+}
+
+template<class T>
+/*SDO_API*/ RefCountingPointer<T>::RefCountingPointer(typename RefCountingPointer<T>::PointerType realPtr)
+:pointee(realPtr)
+{
+ init();
+}
+
+template<class T>
+/*SDO_API*/ RefCountingPointer<T>::RefCountingPointer(const RefCountingPointer& rhs)
+: pointee(rhs.pointee)
+{
+ init();
+}
+
+template<class T>
+/*SDO_API*/ RefCountingPointer<T>::~RefCountingPointer()
+{
+ if (pointee)pointee->releaseRef();
+}
+
+template<class T>
+/*SDO_API*/ RefCountingPointer<T>& RefCountingPointer<T>::operator=(const RefCountingPointer& rhs)
+{
+ if (pointee != rhs.pointee)
+ {
+ T *oldP = pointee;
+ pointee = rhs.pointee;
+ init();
+ if (oldP) oldP->releaseRef();
+ }
+ return *this;
+}
+
+template<class T>
+/*SDO_API*/ bool RefCountingPointer<T>::operator!() const
+{
+ return (pointee == 0);
+}
+
+template<class T>
+/*SDO_API*/ T* RefCountingPointer<T>::operator->() const
+{
+ if (pointee == 0)
+ throw SDONullPointerException(TUSCANY_SDO_EINFO,
+ "");
+ return pointee;
+}
+
+template<class T>
+/*SDO_API*/ T& RefCountingPointer<T>::operator*() const
+{
+ return *pointee;
+}
+
+template <class otherType>
+otherType* getRawPointer(const RefCountingPointer<otherType>& pointer)
+{
+ return pointer.pointee;
+}
+
+template <class T, class otherType>
+T dynamicCast(const RefCountingPointer<otherType>& pointer)
+{
+ return dynamic_cast<typename T::PointerType>(getRawPointer(pointer));
+}
+
+template <class T, class otherType>
+T staticCast(const RefCountingPointer<otherType>& pointer)
+{
+ return static_cast<typename T::PointerType>(getRawPointer(pointer));
+}
+
+template <class T, class otherType>
+bool operator==(const RefCountingPointer<T>& first, const RefCountingPointer<otherType>& second)
+{
+ return (getRawPointer(first) == getRawPointer(second));
+}
+
+template <class T, class otherType>
+bool operator==(const RefCountingPointer<T>& first, const otherType* second)
+{
+ return (getRawPointer(first) == second);
+}
+
+template <class T, class otherType>
+bool operator==(const T* first, const RefCountingPointer<otherType>& second)
+{
+ return (first == getRawPointer(second));
+}
+
+template <class T, class otherType>
+bool operator!=(const RefCountingPointer<T>& first, const RefCountingPointer<otherType>& second)
+{
+ return !(first == second);
+}
+
+template <class T, class otherType>
+bool operator!=(const RefCountingPointer<T>& first, const otherType* second)
+{
+ return !(first == second);
+}
+
+template <class T, class otherType>
+bool operator!=(const T* first, const RefCountingPointer<otherType>& second)
+{
+ return !(first == second);
+}
+
+template <class T, class otherType>
+bool operator<(const RefCountingPointer<T>& first, const RefCountingPointer<otherType>& second)
+{
+ return (getRawPointer(first) < getRawPointer(second));
+}
+
+template <class T, class otherType>
+bool operator>(const RefCountingPointer<T>& first, const RefCountingPointer<otherType>& second)
+{
+ return (second < first);
+}
+
+class DataObject;
+typedef RefCountingPointer<DataObject> DataObjectPtr;
+class DataObjectImpl;
+typedef RefCountingPointer<DataObjectImpl> DataObjectImplPtr;
+class Property;
+typedef RefCountingPointer<Property> PropertyPtr;
+class PropertyImpl;
+typedef RefCountingPointer<PropertyImpl> PropertyImplPtr;
+class DataGraph;
+typedef RefCountingPointer<DataGraph> DataGraphPtr;
+class DataFactory;
+typedef RefCountingPointer<DataFactory> DataFactoryPtr;
+class DataFactoryImpl;
+typedef RefCountingPointer<DataFactoryImpl> DataFactoryImplPtr;
+class Sequence;
+typedef RefCountingPointer<Sequence> SequencePtr;
+class SequenceImpl;
+typedef RefCountingPointer<SequenceImpl> SequenceImplPtr;
+class ChangeSummary;
+typedef RefCountingPointer<ChangeSummary> ChangeSummaryPtr;
+class ChangeSummaryImpl;
+typedef RefCountingPointer<ChangeSummaryImpl> ChangeSummaryImplPtr;
+class XMLDocument;
+typedef RefCountingPointer<XMLDocument> XMLDocumentPtr;
+class XSDHelper;
+typedef RefCountingPointer<XSDHelper> XSDHelperPtr;
+class XSDHelperImpl;
+typedef RefCountingPointer<XSDHelperImpl> XSDHelperImplPtr;
+class XMLHelper;
+typedef RefCountingPointer<XMLHelper> XMLHelperPtr;
+
+}
+}
+
+#endif
diff --git a/sdo-cpp/trunk/runtime/core/src/commonj/sdo/SAX2Attribute.cpp b/sdo-cpp/trunk/runtime/core/src/commonj/sdo/SAX2Attribute.cpp
new file mode 100644
index 0000000000..925ce3d372
--- /dev/null
+++ b/sdo-cpp/trunk/runtime/core/src/commonj/sdo/SAX2Attribute.cpp
@@ -0,0 +1,51 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you 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$ */
+
+#include "commonj/sdo/SAX2Attribute.h"
+
+
+namespace commonj
+{
+ namespace sdo
+ {
+
+/**
+ * SAX2Attribute holds an attribute supplied by the SAX2 parser.
+ */
+ SAX2Attribute::SAX2Attribute()
+ {
+ }
+
+ SAX2Attribute::SAX2Attribute(const xmlChar **attribute) // localname/prefix/URI/value/end
+ {
+ name = attribute[0];
+ prefix = attribute[1];
+ uri = attribute[2];
+ value = SDOXMLString(attribute[3],0, (int)(attribute[4] - attribute[3]));
+ }
+
+ SAX2Attribute::~SAX2Attribute()
+ {
+ }
+
+
+ } // End - namespace sdo
+} // End - namespace commonj
diff --git a/sdo-cpp/trunk/runtime/core/src/commonj/sdo/SAX2Attribute.h b/sdo-cpp/trunk/runtime/core/src/commonj/sdo/SAX2Attribute.h
new file mode 100644
index 0000000000..37a3469a94
--- /dev/null
+++ b/sdo-cpp/trunk/runtime/core/src/commonj/sdo/SAX2Attribute.h
@@ -0,0 +1,66 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you 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$ */
+
+#ifndef _SAX2ATTRIBUTE_H_
+#define _SAX2ATTRIBUTE_H_
+
+#include "commonj/sdo/disable_warn.h"
+
+#include "commonj/sdo/SDOXMLString.h"
+
+namespace commonj
+{
+ namespace sdo
+ {
+
+/**
+ * SAX2Attribute holds an attribute supplied by the SAX2 parser.
+ */
+
+ class SAX2Attribute
+ {
+
+ public:
+
+ SAX2Attribute();
+ SAX2Attribute(const xmlChar **attribute);
+
+ virtual ~SAX2Attribute();
+
+ const SDOXMLString& getName() const {return name;}
+ const SDOXMLString& getPrefix() const {return prefix;}
+ const SDOXMLString& getUri() const {return uri;}
+ const SDOXMLString& getValue() const {return value;}
+
+
+ private:
+ SDOXMLString name;
+ SDOXMLString prefix;
+ SDOXMLString uri;
+ SDOXMLString value;
+
+
+
+ };
+ } // End - namespace sdo
+} // End - namespace commonj
+
+#endif //_SAX2ATTRIBUTE_H_
diff --git a/sdo-cpp/trunk/runtime/core/src/commonj/sdo/SAX2Attributes.cpp b/sdo-cpp/trunk/runtime/core/src/commonj/sdo/SAX2Attributes.cpp
new file mode 100644
index 0000000000..3ae7dc061e
--- /dev/null
+++ b/sdo-cpp/trunk/runtime/core/src/commonj/sdo/SAX2Attributes.cpp
@@ -0,0 +1,129 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you 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$ */
+
+#include "commonj/sdo/SAX2Attributes.h"
+
+namespace commonj
+{
+ namespace sdo
+ {
+
+/**
+ * SAX2Attributes holds a list of attributes supplied by the SAX2 parser.
+ */
+ SAX2Attributes::SAX2Attributes(
+ int nb_attributes,
+ int nb_defaulted,
+ const xmlChar **attrs) // localname/prefix/URI/value/end
+ {
+ for (int i=0; i < nb_attributes*5; i+=5)
+ {
+ // attributes.insert(attributes.end(), SAX2Attribute(&attrs[i]));
+ attributes.push_back(SAX2Attribute(&attrs[i]));
+ }
+ }
+
+ SAX2Attributes::SAX2Attributes()
+ {
+ }
+
+ SAX2Attributes::~SAX2Attributes()
+ {
+ }
+
+ const SAX2Attribute& SAX2Attributes::operator[] (int pos) const
+ {
+ return attributes[pos];
+ }
+
+ int SAX2Attributes::size () const
+ {
+ return attributes.size();
+ }
+
+
+ const SAX2Attribute* SAX2Attributes::getAttribute(const SDOXMLString& attributeName) const
+ {
+ for (unsigned int i=0; i < attributes.size(); i++)
+ {
+ if (attributes[i].getName().equalsIgnoreCase(attributeName))
+ {
+ return &attributes[i];
+ }
+ }
+ return NULL;
+ }
+
+ void SAX2Attributes::addAttribute(const SAX2Attribute& attr)
+ {
+ for (unsigned int i=0; i < attributes.size(); i++)
+ {
+ if (attributes[i].getUri().equals(attr.getUri()))
+ {
+ if (attributes[i].getName().equals(attr.getName()))
+ {
+ // oeverwrite this attribute
+ attributes[i] = attr;
+ return;
+ }
+ }
+ }
+ attributes.push_back(attr);
+ }
+
+
+ const SDOXMLString SAX2Attributes::nullValue;
+
+ const SDOXMLString& SAX2Attributes::getValue(
+ const SDOXMLString& attributeUri,
+ const SDOXMLString& attributeName) const
+ {
+ for (unsigned int i=0; i < attributes.size(); i++)
+ {
+ if (attributes[i].getUri().equalsIgnoreCase(attributeUri))
+ {
+ if (attributes[i].getName().equalsIgnoreCase(attributeName))
+ {
+ return attributes[i].getValue();
+ }
+ }
+ }
+
+ return nullValue;
+ }
+
+ const SDOXMLString& SAX2Attributes::getValue(
+ const SDOXMLString& attributeName) const
+ {
+ for (unsigned int i=0; i < attributes.size(); i++)
+ {
+ if (attributes[i].getName().equalsIgnoreCase(attributeName))
+ {
+ return attributes[i].getValue();
+ }
+ }
+
+ return nullValue;
+ }
+
+
+ } // End - namespace sdo
+} // End - namespace commonj
diff --git a/sdo-cpp/trunk/runtime/core/src/commonj/sdo/SAX2Attributes.h b/sdo-cpp/trunk/runtime/core/src/commonj/sdo/SAX2Attributes.h
new file mode 100644
index 0000000000..7c832214e3
--- /dev/null
+++ b/sdo-cpp/trunk/runtime/core/src/commonj/sdo/SAX2Attributes.h
@@ -0,0 +1,80 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you 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$ */
+
+#ifndef _SAX2ATTRIBUTES_H_
+#define _SAX2ATTRIBUTES_H_
+
+#include "commonj/sdo/disable_warn.h"
+
+#include "commonj/sdo/SAX2Attribute.h"
+
+#include "vector"
+
+
+namespace commonj
+{
+ namespace sdo
+ {
+
+/**
+ * SAX2Attributes holds a list of attributes supplied by the SAX2 parser.
+ */
+ class SAX2Attributes
+ {
+
+ public:
+
+ SAX2Attributes();
+
+ SAX2Attributes(
+ int nb_attributes,
+ int nb_defaulted,
+ const xmlChar **attributes);
+
+ virtual ~SAX2Attributes();
+
+ const SAX2Attribute& operator[] (int pos) const;
+ int size() const;
+
+ const SDOXMLString& getValue(
+ const SDOXMLString& attributeUri,
+ const SDOXMLString& attributeName) const;
+
+ const SDOXMLString& getValue(
+ const SDOXMLString& attributeName) const;
+
+ const SAX2Attribute* getAttribute(
+ const SDOXMLString& attributeName) const;
+
+ void addAttribute(const SAX2Attribute& attr);
+ private:
+ typedef std::vector<SAX2Attribute> ATTRIBUTE_LIST;
+ ATTRIBUTE_LIST attributes;
+
+ static const SDOXMLString nullValue;
+
+
+
+ };
+ } // End - namespace sdo
+} // End - namespace commonj
+
+#endif //_SAX2ATTRIBUTES_H_
diff --git a/sdo-cpp/trunk/runtime/core/src/commonj/sdo/SAX2Namespaces.cpp b/sdo-cpp/trunk/runtime/core/src/commonj/sdo/SAX2Namespaces.cpp
new file mode 100644
index 0000000000..ab16b9cc5b
--- /dev/null
+++ b/sdo-cpp/trunk/runtime/core/src/commonj/sdo/SAX2Namespaces.cpp
@@ -0,0 +1,95 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you 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$ */
+
+#include "commonj/sdo/SAX2Namespaces.h"
+
+
+namespace commonj
+{
+ namespace sdo
+ {
+
+ SAX2Namespaces::SAX2Namespaces()
+ {
+ }
+
+ SAX2Namespaces::SAX2Namespaces(int nb_namespaces, const xmlChar** namespaces)
+ {
+ for (int i=0; i<nb_namespaces*2; i+=2)
+ {
+ namespaceMap[namespaces[i]] = namespaces[i+1];
+ }
+ }
+
+ SAX2Namespaces::~SAX2Namespaces()
+ {
+ }
+
+ const SDOXMLString* SAX2Namespaces::find(const SDOXMLString& prefix) const
+ {
+ NAMESPACE_MAP::const_iterator nsIter;
+ nsIter = namespaceMap.find(prefix);
+ if(nsIter == namespaceMap.end())
+ {
+ return 0;
+ }
+
+ return &(nsIter->second);
+
+ }
+
+ const SDOXMLString* SAX2Namespaces::findPrefix(const SDOXMLString& uri) const
+ {
+ NAMESPACE_MAP::const_iterator nsIter;
+ for (nsIter = namespaceMap.begin(); nsIter != namespaceMap.end(); nsIter++)
+ {
+ if (nsIter->second.equals(uri))
+ return &(nsIter->first);
+ }
+ return 0;
+ }
+
+ void SAX2Namespaces::merge(const SAX2Namespaces& inspaces)
+ {
+ NAMESPACE_MAP::const_iterator nsIter;
+ for (nsIter = inspaces.namespaceMap.begin();
+ nsIter != inspaces.namespaceMap.end(); nsIter++)
+ {
+ // add will not overwrite if it already exists
+ namespaceMap[nsIter->first] = nsIter->second;
+ }
+ return;
+ }
+
+
+
+ void SAX2Namespaces::add(const SDOXMLString& prefix, const SDOXMLString& uri)
+ {
+ namespaceMap[prefix] = uri;
+ }
+
+ void SAX2Namespaces::empty()
+ {
+ namespaceMap.clear();
+ }
+
+ } // End - namespace sdo
+} // End - namespace commonj
diff --git a/sdo-cpp/trunk/runtime/core/src/commonj/sdo/SAX2Namespaces.h b/sdo-cpp/trunk/runtime/core/src/commonj/sdo/SAX2Namespaces.h
new file mode 100644
index 0000000000..525ad73945
--- /dev/null
+++ b/sdo-cpp/trunk/runtime/core/src/commonj/sdo/SAX2Namespaces.h
@@ -0,0 +1,69 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you 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$ */
+
+#ifndef _SAX2NAMESPACES_H_
+#define _SAX2NAMESPACES_H_
+#include "commonj/sdo/disable_warn.h"
+
+#include "commonj/sdo/SDOXMLString.h"
+#include "map"
+
+
+namespace commonj
+{
+ namespace sdo
+ {
+
+/**
+ * SAX2Namespaces holds a list of namespaces supplied by the SAX2 parser.
+ */
+
+ class SAX2Namespaces
+ {
+
+ public:
+
+ SAX2Namespaces();
+
+ SAX2Namespaces(int nb_namespaces, const xmlChar** namespaces);
+
+ virtual ~SAX2Namespaces();
+
+ void add(const SDOXMLString& prefix, const SDOXMLString& uri);
+
+ void merge(const SAX2Namespaces& inspaces);
+
+ const SDOXMLString* find(const SDOXMLString& prefix) const;
+ const SDOXMLString* findPrefix(const SDOXMLString& uri) const;
+
+ void empty();
+
+ private:
+ typedef std::map<SDOXMLString, SDOXMLString> NAMESPACE_MAP;
+ NAMESPACE_MAP namespaceMap;
+
+
+
+ };
+ } // End - namespace sdo
+} // End - namespace commonj
+
+#endif //_SAX2NAMESPACES_H_
diff --git a/sdo-cpp/trunk/runtime/core/src/commonj/sdo/SAX2Parser.cpp b/sdo-cpp/trunk/runtime/core/src/commonj/sdo/SAX2Parser.cpp
new file mode 100644
index 0000000000..bd6ddf6d99
--- /dev/null
+++ b/sdo-cpp/trunk/runtime/core/src/commonj/sdo/SAX2Parser.cpp
@@ -0,0 +1,539 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you 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$ */
+
+#include "commonj/sdo/SAX2Parser.h"
+#include "libxml/SAX2.h"
+#include "commonj/sdo/SDORuntimeException.h"
+#include "commonj/sdo/SDOUtils.h"
+
+using namespace commonj::sdo;
+using internal::SDOUtils;
+
+/**
+ * SAX2Parser holds the methods which will be called back.
+ * The implementation uses libxml, which provides callbacks for
+ * errors, warnings , elements etc. These methods correspond to thos
+ * callbacks.
+ * Callbacks from libxml to these C methods are converted into calls
+ * to the C++ equivalent (with some parameter manipulation
+ * In the callback methods the void* ctx is a pointer to 'this' SAX2Parser
+ */
+
+
+
+int sdo_isStandalone(void *ctx)
+{
+ return 0;
+}
+
+
+int sdo_hasInternalSubset(void *ctx)
+{
+ return(0);
+}
+
+int sdo_hasExternalSubset(void *ctx)
+{
+ return(0);
+}
+
+void sdo_internalSubset(void *ctx, const xmlChar *name,
+ const xmlChar *ExternalID, const xmlChar *SystemID)
+{
+}
+
+
+void sdo_externalSubset(void *ctx, const xmlChar *name,
+ const xmlChar *ExternalID, const xmlChar *SystemID)
+{
+}
+
+xmlParserInputPtr sdo_resolveEntity(void *ctx, const xmlChar *publicId, const xmlChar *systemId)
+{
+ return(NULL);
+}
+
+
+xmlEntityPtr sdo_getEntity(void *ctx, const xmlChar *name)
+{
+ return(NULL);
+}
+
+
+xmlEntityPtr sdo_getParameterEntity(void *ctx, const xmlChar *name)
+{
+ return(NULL);
+}
+
+
+void sdo_entityDecl(void *ctx, const xmlChar *name, int type,
+ const xmlChar *publicId, const xmlChar *systemId, xmlChar *content)
+{
+}
+
+
+void sdo_attributeDecl(void *ctx, const xmlChar * elem,
+ const xmlChar * name, int type, int def,
+ const xmlChar * defaultValue, xmlEnumerationPtr tree)
+{
+}
+
+void sdo_elementDecl(void *ctx, const xmlChar *name, int type,
+ xmlElementContentPtr content)
+{
+}
+
+
+void sdo_notationDecl(void *ctx, const xmlChar *name,
+ const xmlChar *publicId, const xmlChar *systemId)
+{
+}
+
+void sdo_unparsedEntityDecl(void *ctx, const xmlChar *name,
+ const xmlChar *publicId, const xmlChar *systemId,
+ const xmlChar *notationName)
+{
+}
+
+
+void sdo_setDocumentLocator(void *ctx, xmlSAXLocatorPtr loc)
+{
+}
+
+
+void sdo_startDocument(void *ctx)
+{
+ if (!((SAX2Parser*)ctx)->parserError)
+ ((SAX2Parser*)ctx)->startDocument();
+}
+
+
+void sdo_endDocument(void *ctx)
+{
+ if (!((SAX2Parser*)ctx)->parserError)
+ ((SAX2Parser*)ctx)->endDocument();
+}
+
+
+void sdo_startElement(void *ctx, const xmlChar *name, const xmlChar **atts)
+{
+ // ((SAX2Parser*)ctx)->startElement(name, atts);
+}
+
+
+void sdo_endElement(void *ctx, const xmlChar *name)
+{
+ // ((SAX2Parser*)ctx)->endElement(name);
+}
+
+
+void sdo_characters(void *ctx, const xmlChar *ch, int len)
+{
+ if (!((SAX2Parser*)ctx)->parserError)
+ ((SAX2Parser*)ctx)->characters(SDOXMLString(ch, 0, len));
+}
+
+
+void sdo_reference(void *ctx, const xmlChar *name)
+{
+}
+
+
+void sdo_ignorableWhitespace(void *ctx, const xmlChar *ch, int len)
+{
+}
+
+
+void sdo_processingInstruction(void *ctx, const xmlChar *target,
+ const xmlChar *data)
+{
+}
+
+
+void sdo_cdataBlock(void *ctx, const xmlChar *value, int len)
+{
+ if (!((SAX2Parser*)ctx)->parserError)
+ {
+ SDOXMLString valueAsString(value, 0, len);
+
+ SDOXMLString cdata(SDOUtils::CDataStartMarker);
+ cdata = cdata + valueAsString;
+ cdata = cdata + SDOUtils::CDataEndMarker;
+
+ ((SAX2Parser*)ctx)->characters(cdata);
+ }
+}
+
+void sdo_comment(void *ctx, const xmlChar *value)
+{
+}
+
+
+void sdo_warning(void *ctx, const char *msg, ...)
+{
+ va_list args;
+ va_start(args, msg);
+ ((SAX2Parser*)ctx)->warning(msg, args);
+ va_end(args);
+}
+
+void sdo_error(void *ctx, const char *msg, ...)
+{
+ va_list args;
+ va_start(args, msg);
+ ((SAX2Parser*)ctx)->error(msg, args);
+ va_end(args);
+
+
+}
+
+void sdo_fatalError(void *ctx, const char *msg, ...)
+{
+ va_list args;
+ va_start(args, msg);
+ ((SAX2Parser*)ctx)->fatalError(msg, args);
+ va_end(args);
+}
+
+
+
+// ===============
+// SAX2 callbacks
+// ===============
+void sdo_startElementNs(void *ctx,
+ const xmlChar *localname,
+ const xmlChar *prefix,
+ const xmlChar *URI,
+ int nb_namespaces,
+ const xmlChar **namespaces,
+ int nb_attributes,
+ int nb_defaulted,
+ const xmlChar **attributes)
+{
+ if (!((SAX2Parser*)ctx)->parserError)
+ ((SAX2Parser*)ctx)->startElementNs(
+ localname,
+ prefix,
+ URI,
+ SAX2Namespaces(nb_namespaces, namespaces),
+ SAX2Attributes(nb_attributes, nb_defaulted, attributes));
+}
+
+
+void sdo_endElementNs(void *ctx,
+ const xmlChar *localname,
+ const xmlChar *prefix,
+ const xmlChar *URI)
+{
+ if (!((SAX2Parser*)ctx)->parserError)
+ ((SAX2Parser*)ctx)->endElementNs(localname, prefix, URI);
+}
+
+
+// The callback method structure
+xmlSAXHandler SDOSAX2HandlerStruct = {
+ sdo_internalSubset,
+ sdo_isStandalone,
+ sdo_hasInternalSubset,
+ sdo_hasExternalSubset,
+ sdo_resolveEntity,
+ sdo_getEntity,
+ sdo_entityDecl,
+ sdo_notationDecl,
+ sdo_attributeDecl,
+ sdo_elementDecl,
+ sdo_unparsedEntityDecl,
+ sdo_setDocumentLocator,
+ sdo_startDocument,
+ sdo_endDocument,
+ sdo_startElement,
+ sdo_endElement,
+ sdo_reference,
+ sdo_characters,
+ sdo_ignorableWhitespace,
+ sdo_processingInstruction,
+ sdo_comment,
+ sdo_warning,
+ sdo_error,
+ sdo_fatalError,
+ sdo_getParameterEntity,
+ sdo_cdataBlock,
+ sdo_externalSubset,
+ XML_SAX2_MAGIC,
+ NULL,
+ sdo_startElementNs,
+ sdo_endElementNs,
+ NULL
+};
+
+
+namespace commonj
+{
+ namespace sdo
+ {
+
+
+
+
+ SAX2Parser::SAX2Parser()
+ {
+ setter = 0;
+ parserError = false;
+ currentFile = 0;
+ }
+
+ SAX2Parser::SAX2Parser(ParserErrorSetter* insetter)
+ {
+ setter = insetter;
+ parserError = false;
+ currentFile = 0;
+ }
+
+ SAX2Parser::~SAX2Parser()
+ {
+ // xmlCleanupParser();
+ if (currentFile != 0)
+ {
+ delete[] currentFile;
+ }
+ }
+
+ const char* SAX2Parser::getCurrentFile() const
+ {
+ return currentFile;
+ }
+
+
+ void SAX2Parser::setCurrentFile(const char* filename)
+ {
+ if (currentFile != 0)
+ {
+ delete[] currentFile;
+ }
+ currentFile = new char[strlen(filename)+1];
+ strcpy(currentFile,filename);
+ }
+
+ int SAX2Parser::parse(const char* filename)
+ {
+
+ parserError = false;
+ xmlSAXHandlerPtr handler = &SDOSAX2HandlerStruct;
+
+ if (currentFile != 0)
+ {
+ delete[] currentFile;
+ }
+ currentFile = new char[strlen(filename)+1];
+ strcpy(currentFile,filename);
+
+
+ int rc = xmlSAXUserParseFile(handler, this, filename);
+ if (rc == -1)
+ {
+ sdo_error(this, "xmlSAXUserParseFile returned an error %d", rc);
+ throw SDOFileNotFoundException(TUSCANY_SDO_EINFO,
+ messageBuffer);
+ }
+ return rc;
+ }
+
+ void SAX2Parser::startDocument()
+ {
+ }
+
+ void SAX2Parser::endDocument()
+ {
+ }
+
+ void SAX2Parser::startElementNs(
+ const SDOXMLString& localname,
+ const SDOXMLString& prefix,
+ const SDOXMLString& URI,
+ const SAX2Namespaces& namespaces,
+ const SAX2Attributes& attributes)
+ {
+ }
+
+ void SAX2Parser::endElementNs(
+ const SDOXMLString& localname,
+ const SDOXMLString& prefix,
+ const SDOXMLString& URI)
+ {
+ }
+
+ void SAX2Parser::characters(const SDOXMLString& chars)
+ {
+ }
+
+
+ void SAX2Parser::warning(const char* msg, va_list args)
+ {
+ // warnings are perhaps too frequent
+ // vsprintf(messageBuffer, msg, args);
+ // if (setter != 0)setter->setError(messageBuffer);
+ }
+
+ void SAX2Parser::fatalError(const char* msg, va_list args)
+ {
+ parserError = true;
+ vsprintf(messageBuffer, msg, args);
+ if (setter != 0)setter->setError(messageBuffer);
+ }
+
+ void SAX2Parser::error(const char* msg, va_list args)
+ {
+ vsprintf(messageBuffer, msg, args);
+ if (setter != 0)setter->setError(messageBuffer);
+ }
+
+
+ void SAX2Parser::stream(std::istream& input)
+ {
+ char buffer[100];
+ xmlSAXHandlerPtr handler = &SDOSAX2HandlerStruct;
+ parserError = false;
+ xmlParserCtxtPtr ctxt;
+
+ input.read(buffer,4);
+ ctxt = xmlCreatePushParserCtxt(handler, this,
+ buffer, input.gcount(), NULL);
+
+ while (input.read(buffer,100))
+ {
+ xmlParseChunk(ctxt, buffer, input.gcount(), 0);
+
+ }
+
+ xmlParseChunk(ctxt, buffer, input.gcount(), 1);
+ xmlFreeParserCtxt(ctxt);
+
+ if (parserError)
+ {
+ throw SDOXMLParserException(TUSCANY_SDO_EINFO,
+ messageBuffer);
+ }
+
+ }
+
+ int SAX2Parser::parse_twice(const char* filename)
+ {
+ parserError = false;
+ xmlSAXHandlerPtr handler = &SDOSAX2HandlerStruct;
+
+ setCurrentFile(filename);
+
+ int rc = xmlSAXUserParseFile(handler, this, filename);
+ if (rc == -1)
+ {
+ sdo_error(this, "xmlSAXUserParseFile returned an error %d", rc);
+ throw SDOFileNotFoundException(TUSCANY_SDO_EINFO,
+ messageBuffer);
+ }
+
+ // parse twice - first was for groups
+
+ if (setter)setter->clearErrors();
+
+ rc = xmlSAXUserParseFile(handler, this, filename);
+ if (rc == -1)
+ {
+ sdo_error(this, "xmlSAXUserParseFile returned an error %d", rc);
+ throw SDOFileNotFoundException(TUSCANY_SDO_EINFO,
+ messageBuffer);
+ }
+ return rc;
+ }
+
+ void SAX2Parser::stream_twice(std::istream& input)
+ {
+
+ std::vector<parse_buf_element> buffer_vec;
+ int count = 0;
+ parserError = false;
+
+ xmlSAXHandlerPtr handler = &SDOSAX2HandlerStruct;
+ xmlParserCtxtPtr ctxt;
+
+ char bctx[5];
+ input.read(bctx,4);
+ int bcount = input.gcount();
+
+
+ ctxt = xmlCreatePushParserCtxt(handler, this,
+ bctx, bcount, NULL);
+
+ buffer_vec.push_back(parse_buf_element());
+
+ while (input.read(buffer_vec[count].buf,1000))
+ {
+ buffer_vec[count].len = input.gcount();
+ xmlParseChunk(ctxt, buffer_vec[count].buf,
+ buffer_vec[count].len, 0);
+ buffer_vec.push_back(parse_buf_element());
+ count++;
+
+ }
+
+ buffer_vec[count].len = input.gcount();
+ xmlParseChunk(ctxt, buffer_vec[count].buf,
+ buffer_vec[count].len, 1);
+ xmlFreeParserCtxt(ctxt);
+
+ if (parserError)
+ {
+ throw SDOXMLParserException(TUSCANY_SDO_EINFO,
+ messageBuffer);
+ }
+
+ if (setter)setter->clearErrors();
+
+ ctxt = xmlCreatePushParserCtxt(handler, this,
+ bctx, bcount, NULL);
+
+ for (unsigned int i=0;i<buffer_vec.size();i++)
+ {
+ if (buffer_vec[i].len > 0)
+ {
+ xmlParseChunk(ctxt, buffer_vec[i].buf,
+ buffer_vec[i].len, 0);
+ }
+ }
+
+ if (parserError)
+ {
+ throw SDOXMLParserException(TUSCANY_SDO_EINFO,
+ messageBuffer);
+ }
+
+ }
+
+
+ std::istream& operator>>(std::istream& input, SAX2Parser& parser)
+ {
+ parser.stream(input);
+ return input;
+ }
+
+
+ } // End - namespace sdo
+} // End - namespace commonj
+
diff --git a/sdo-cpp/trunk/runtime/core/src/commonj/sdo/SAX2Parser.h b/sdo-cpp/trunk/runtime/core/src/commonj/sdo/SAX2Parser.h
new file mode 100644
index 0000000000..fd11d98fde
--- /dev/null
+++ b/sdo-cpp/trunk/runtime/core/src/commonj/sdo/SAX2Parser.h
@@ -0,0 +1,117 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you 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$ */
+
+#ifndef _SAX2PARSER_H_
+#define _SAX2PARSER_H_
+
+#include "commonj/sdo/disable_warn.h"
+
+#include "commonj/sdo/SDOXMLString.h"
+#include "commonj/sdo/SAX2Namespaces.h"
+#include "commonj/sdo/SAX2Attributes.h"
+#include "commonj/sdo/ParserErrorSetter.h"
+
+
+
+#include "sstream"
+namespace commonj
+{
+ namespace sdo
+ {
+
+ class parse_buf_element
+ {
+
+ public:
+ char buf[1000];
+ int len;
+ };
+
+/**
+ * SAX2Parser holds the methods which will be called back.
+ * The implementation uses libxml, which provides callbacks for
+ * errors, warnings , elements etc. These methods correspond to thos
+ * callbacks.
+ * Callbacks from libxml to these C methods are converted into calls
+ * to the C++ equivalent (with some parameter manipulation
+ * In the callback methods the void* ctx is a pointer to 'this' SAX2Parser
+ */
+ class SAX2Parser
+ {
+
+ public:
+
+ SAX2Parser();
+
+ SAX2Parser(ParserErrorSetter* insetter);
+
+ virtual ~SAX2Parser();
+
+ virtual int parse (const char* filename);
+ virtual int parse_twice (const char* filename);
+
+ virtual void startDocument();
+ virtual void endDocument();
+
+ virtual void startElementNs(
+ const SDOXMLString& localname,
+ const SDOXMLString& prefix,
+ const SDOXMLString& URI,
+ const SAX2Namespaces& namespaces,
+ const SAX2Attributes& attributes);
+
+ virtual void endElementNs(
+ const SDOXMLString& localname,
+ const SDOXMLString& prefix,
+ const SDOXMLString& URI);
+
+ virtual void characters(const SDOXMLString& chars);
+
+ virtual void warning(const char* msg, va_list args);
+
+ virtual void fatalError(const char* msg, va_list args);
+
+ virtual void error(const char* msg, va_list args);
+
+ virtual void stream(std::istream& input);
+ virtual void stream_twice(std::istream& input);
+
+ friend std::istream& operator>>(std::istream& input, SAX2Parser& parser);
+
+ ParserErrorSetter* setter;
+ bool parserError;
+
+ char messageBuffer[1024];
+
+ virtual const char* getCurrentFile() const;
+ virtual void setCurrentFile(const char* filename);
+
+ private:
+
+ char* currentFile;
+
+
+ };
+ } // End - namespace sdo
+} // End - namespace commonj
+
+
+#endif //_SAX2PARSER_H_
diff --git a/sdo-cpp/trunk/runtime/core/src/commonj/sdo/SDO.h b/sdo-cpp/trunk/runtime/core/src/commonj/sdo/SDO.h
new file mode 100644
index 0000000000..5e6c6b0268
--- /dev/null
+++ b/sdo-cpp/trunk/runtime/core/src/commonj/sdo/SDO.h
@@ -0,0 +1,54 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you 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$ */
+
+#include "commonj/sdo/export.h"
+
+#include "commonj/sdo/Property.h"
+#include "commonj/sdo/Type.h"
+#include "commonj/sdo/SDORuntimeException.h"
+#include "commonj/sdo/PropertyList.h"
+#include "commonj/sdo/Sequence.h"
+#include "commonj/sdo/TypeList.h"
+#include "commonj/sdo/DataObject.h"
+#include "commonj/sdo/DataObjectList.h"
+#include "commonj/sdo/XSDHelper.h"
+#include "commonj/sdo/XMLHelper.h"
+#include "commonj/sdo/EqualityHelper.h"
+#include "commonj/sdo/CopyHelper.h"
+#include "commonj/sdo/SdoRuntime.h"
+#include "commonj/sdo/HelperProvider.h"
+#include "commonj/sdo/SDODate.h"
+#include "commonj/sdo/DataGraph.h"
+#include "commonj/sdo/ChangeSummary.h"
+#include "commonj/sdo/SDOUtils.h"
+#include "commonj/sdo/ChangedDataObjectList.h"
+#include "commonj/sdo/DataFactory.h"
+#include "commonj/sdo/RefCountingPointer.h"
+#include "commonj/sdo/RefCountingObject.h"
+#include "commonj/sdo/Setting.h"
+#include "commonj/sdo/SettingList.h"
+#include "commonj/sdo/XMLDocument.h"
+
+
+
+
+
+
diff --git a/sdo-cpp/trunk/runtime/core/src/commonj/sdo/SDODataConverter.cpp b/sdo-cpp/trunk/runtime/core/src/commonj/sdo/SDODataConverter.cpp
new file mode 100644
index 0000000000..1211400fe3
--- /dev/null
+++ b/sdo-cpp/trunk/runtime/core/src/commonj/sdo/SDODataConverter.cpp
@@ -0,0 +1,1117 @@
+/*
+ *
+ * Copyright 2007 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$ */
+
+#include <string.h>
+#include "commonj/sdo/SDODataConverter.h"
+#include "commonj/sdo/SDORuntimeException.h"
+#include "commonj/sdo/TypeImpl.h"
+
+
+// Data type conversion code is currently spread across this class and
+// TypeImpl. This is necessary while the widespread use of C macros is
+// eradicated, however, the long term aim should be to have all the conversion
+// code here and anything else that needs to perform conversions (eg TypeImpl)
+// should invoke these methods.
+
+
+namespace commonj
+{
+ namespace sdo
+ {
+
+ const int SDODataConverter::MAX_TRANSIENT_SIZE = 48;
+
+ const bool SDODataConverter::convertToBoolean(const DataTypeInfo::SDODataTypeUnion& sourceValue,
+ const DataTypeInfo::TrueDataType& dataType)
+ {
+ switch (dataType)
+ {
+ case DataTypeInfo::TDTbool:
+ return sourceValue.Boolean;
+
+ case DataTypeInfo::TDTchar:
+ return (sourceValue.Character != 0) ? true : false;
+
+ case DataTypeInfo::TDTwchar_t:
+ return (sourceValue.WideChar != 0) ? true : false;
+
+ case DataTypeInfo::TDTshort:
+ return (sourceValue.Short != 0) ? true : false;
+
+ case DataTypeInfo::TDTlong:
+ return (sourceValue.Int != 0) ? true : false;
+
+ case DataTypeInfo::TDTint64_t:
+ return (sourceValue.Int64 != 0) ? true : false;
+
+ case DataTypeInfo::TDTfloat:
+ return (sourceValue.Float != 0) ? true : false;
+
+ case DataTypeInfo::TDTdouble:
+ return (sourceValue.Double != 0) ? true : false;
+
+ case DataTypeInfo::TDTSDODate:
+ return ((sourceValue.Date)->getTime() != 0) ? true : false;
+
+ case DataTypeInfo::TDTCString:
+ case DataTypeInfo::TDTByteArray:
+ return (*(sourceValue.TextString) == "true") ? true : false;
+
+ case DataTypeInfo::TDTWideString:
+ if (sourceValue.WideString.length < 4)
+ {
+ return false;
+ }
+
+ if ((sourceValue.WideString.data[0] == (wchar_t) 't') &&
+ (sourceValue.WideString.data[1] == (wchar_t) 'r') &&
+ (sourceValue.WideString.data[2] == (wchar_t) 'u') &&
+ (sourceValue.WideString.data[3] == (wchar_t) 'e'))
+ {
+ return true;
+ }
+
+ return false;
+
+ default:
+ {
+ std::string msg("Invalid conversion to boolean from SDOValue of type: ");
+ msg += DataTypeInfo::convertTypeEnumToString(dataType);
+ throw SDOInvalidConversionException(TUSCANY_SDO_EINFO,
+ msg.c_str());
+ break;
+ }
+ }
+ }
+
+
+ const char SDODataConverter::convertToByte(const DataTypeInfo::SDODataTypeUnion& sourceValue,
+ const DataTypeInfo::TrueDataType& dataType)
+ {
+ switch (dataType)
+ {
+ case DataTypeInfo::TDTbool:
+ return (sourceValue.Boolean) ? 1 : 0;
+
+ case DataTypeInfo::TDTchar:
+ return sourceValue.Character;
+
+ case DataTypeInfo::TDTwchar_t:
+ return (char) sourceValue.WideChar;
+
+ case DataTypeInfo::TDTshort:
+ return (char) sourceValue.Short;
+
+ case DataTypeInfo::TDTlong:
+ return (char) sourceValue.Int;
+
+ case DataTypeInfo::TDTint64_t:
+ return (char) sourceValue.Int64;
+
+ case DataTypeInfo::TDTfloat:
+ return (char) sourceValue.Float;
+
+ case DataTypeInfo::TDTdouble:
+ return (char) sourceValue.Double;
+
+ case DataTypeInfo::TDTSDODate:
+ return (char) (sourceValue.Date)->getTime();
+
+ case DataTypeInfo::TDTCString:
+ case DataTypeInfo::TDTByteArray:
+ return (char) atoi((sourceValue.TextString)->c_str());
+
+ case DataTypeInfo::TDTWideString:
+ {
+ // char tmpstr[SDODataConverter::MAX_TRANSIENT_SIZE];
+ char* tmpstr = new char[sourceValue.WideString.length + 1];
+ for (unsigned int j = 0; j < sourceValue.WideString.length; j++)
+ {
+ tmpstr[j] = (char) sourceValue.WideString.data[j];
+ }
+ tmpstr[sourceValue.WideString.length] = 0;
+ char result = (char) atoi(tmpstr);
+ delete[] tmpstr;
+ return result;
+ }
+ default:
+ {
+ std::string msg("Invalid conversion to byte from SDOValue of type: ");
+ msg += DataTypeInfo::convertTypeEnumToString(dataType);
+ throw SDOInvalidConversionException(TUSCANY_SDO_EINFO,
+ msg.c_str());
+ break;
+ }
+ }
+ return 0;
+ }
+
+ const wchar_t SDODataConverter::convertToCharacter(const DataTypeInfo::SDODataTypeUnion& sourceValue,
+ const DataTypeInfo::TrueDataType& dataType)
+ {
+ switch (dataType)
+ {
+ case DataTypeInfo::TDTbool:
+ return (sourceValue.Boolean == false) ? (wchar_t) 0 : (wchar_t) 1;
+
+ case DataTypeInfo::TDTchar:
+ return (wchar_t) sourceValue.Character;
+
+ case DataTypeInfo::TDTwchar_t:
+ return sourceValue.WideChar;
+
+ case DataTypeInfo::TDTshort:
+ return (wchar_t) sourceValue.Short;
+
+ case DataTypeInfo::TDTlong:
+ return (wchar_t) sourceValue.Int;
+
+ case DataTypeInfo::TDTint64_t:
+ return (wchar_t) sourceValue.Int64;
+
+ case DataTypeInfo::TDTfloat:
+ return (wchar_t) sourceValue.Float;
+
+ case DataTypeInfo::TDTdouble:
+ return (wchar_t) sourceValue.Double;
+
+ case DataTypeInfo::TDTSDODate:
+ return (wchar_t) (sourceValue.Date)->getTime();
+
+ case DataTypeInfo::TDTCString:
+ case DataTypeInfo::TDTByteArray:
+ if ((sourceValue.TextString)->length() == 0)
+ {
+ return (wchar_t) 0;
+ }
+ return (wchar_t) (*sourceValue.TextString)[0];
+
+ case DataTypeInfo::TDTWideString:
+ if (sourceValue.WideString.length == 0)
+ {
+ return (wchar_t) 0;
+ }
+ return sourceValue.WideString.data[0];
+
+ default:
+ {
+ std::string msg("Invalid conversion to character from SDOValue of type: ");
+ msg += DataTypeInfo::convertTypeEnumToString(dataType);
+ throw SDOInvalidConversionException(TUSCANY_SDO_EINFO,
+ msg.c_str());
+ break;
+ }
+ }
+ return 0;
+ }
+
+ const short SDODataConverter::convertToShort(const DataTypeInfo::SDODataTypeUnion& sourceValue,
+ const DataTypeInfo::TrueDataType& dataType)
+ {
+ switch (dataType)
+ {
+ case DataTypeInfo::TDTbool:
+ return (sourceValue.Boolean == false) ? 0 : 1;
+
+ case DataTypeInfo::TDTchar:
+ return (short) sourceValue.Character;
+
+ case DataTypeInfo::TDTwchar_t:
+ return (short) sourceValue.WideChar;
+
+ case DataTypeInfo::TDTshort:
+ return sourceValue.Short;
+
+ case DataTypeInfo::TDTlong:
+ return (short) sourceValue.Int;
+
+ case DataTypeInfo::TDTint64_t:
+ return (short) sourceValue.Int64;
+
+ case DataTypeInfo::TDTfloat:
+ return (short) sourceValue.Float;
+
+ case DataTypeInfo::TDTdouble:
+ return (short) sourceValue.Double;
+
+ case DataTypeInfo::TDTSDODate:
+ return (short) (sourceValue.Date)->getTime();
+
+ case DataTypeInfo::TDTCString:
+ case DataTypeInfo::TDTByteArray:
+ return (short) atoi((sourceValue.TextString)->c_str());
+
+ case DataTypeInfo::TDTWideString:
+ {
+ char* tmpstr = new char[sourceValue.WideString.length + 1];
+ for (unsigned int j = 0; j < sourceValue.WideString.length; j++)
+ {
+ tmpstr[j] = (char) sourceValue.WideString.data[j];
+ }
+ tmpstr[sourceValue.WideString.length] = 0;
+ short result = (short) atoi(tmpstr);
+ delete[] tmpstr;
+ return result;
+ }
+
+ default:
+ {
+ std::string msg("Invalid conversion to short from SDOValue of type: ");
+ msg += DataTypeInfo::convertTypeEnumToString(dataType);
+ throw SDOInvalidConversionException(TUSCANY_SDO_EINFO,
+ msg.c_str());
+ break;
+ }
+ }
+ return 0;
+ }
+
+ const long SDODataConverter::convertToInt(const DataTypeInfo::SDODataTypeUnion& sourceValue,
+ const DataTypeInfo::TrueDataType& dataType)
+ {
+ switch (dataType)
+ {
+ case DataTypeInfo::TDTbool:
+ return (sourceValue.Boolean == false) ? 0 : 1;
+
+ case DataTypeInfo::TDTchar:
+ return (long) sourceValue.Character;
+
+ case DataTypeInfo::TDTwchar_t:
+ return (long) sourceValue.WideChar;
+
+ case DataTypeInfo::TDTshort:
+ return (long) sourceValue.Short;
+
+ case DataTypeInfo::TDTlong:
+ return sourceValue.Int;
+
+ case DataTypeInfo::TDTint64_t:
+ return (long) sourceValue.Int64;
+
+ case DataTypeInfo::TDTfloat:
+ return (long) sourceValue.Float;
+
+ case DataTypeInfo::TDTdouble:
+ return (long) sourceValue.Double;
+
+ case DataTypeInfo::TDTSDODate:
+ return (long) (sourceValue.Date)->getTime();
+
+ case DataTypeInfo::TDTCString:
+ case DataTypeInfo::TDTByteArray:
+ return (long) atoi((sourceValue.TextString)->c_str());
+
+ case DataTypeInfo::TDTWideString:
+ {
+ char* tmpstr = new char[sourceValue.WideString.length + 1];
+ for (unsigned int j = 0; j < sourceValue.WideString.length; j++)
+ {
+ tmpstr[j] = (char) sourceValue.WideString.data[j];
+ }
+ tmpstr[sourceValue.WideString.length] = 0;
+ long result = (long) atoi(tmpstr);
+ delete[] tmpstr;
+ return result;
+ }
+
+ default:
+ {
+ std::string msg("Invalid conversion to long from SDOValue of type: ");
+ msg += DataTypeInfo::convertTypeEnumToString(dataType);
+ throw SDOInvalidConversionException(TUSCANY_SDO_EINFO,
+ msg.c_str());
+ break;
+ }
+ }
+ return 0;
+ }
+
+
+ const int64_t SDODataConverter::convertToLong(const DataTypeInfo::SDODataTypeUnion& sourceValue,
+ const DataTypeInfo::TrueDataType& dataType)
+ {
+ switch (dataType)
+ {
+ case DataTypeInfo::TDTbool:
+ return (sourceValue.Boolean == false) ? 0 : 1;
+
+ case DataTypeInfo::TDTchar:
+ return (int64_t) sourceValue.Character;
+
+ case DataTypeInfo::TDTwchar_t:
+ return (int64_t) sourceValue.WideChar;
+
+ case DataTypeInfo::TDTshort:
+ return (int64_t) sourceValue.Short;
+
+ case DataTypeInfo::TDTlong:
+ return (int64_t) sourceValue.Int;
+
+ case DataTypeInfo::TDTint64_t:
+ return sourceValue.Int64;
+
+ case DataTypeInfo::TDTfloat:
+ return (int64_t) sourceValue.Float;
+
+ case DataTypeInfo::TDTdouble:
+ return (int64_t) sourceValue.Double;
+
+ case DataTypeInfo::TDTSDODate:
+ return (int64_t) (sourceValue.Date)->getTime();
+
+ case DataTypeInfo::TDTCString:
+ case DataTypeInfo::TDTByteArray:
+#if defined(WIN32) || defined (_WINDOWS)
+ return _atoi64((sourceValue.TextString)->c_str());
+#else
+ return strtoll((sourceValue.TextString)->c_str(), NULL, 0);
+#endif
+
+ case DataTypeInfo::TDTWideString:
+ {
+ char* tmpstr = new char[sourceValue.WideString.length + 1];
+ for (unsigned int j = 0; j < sourceValue.WideString.length; j++)
+ {
+ tmpstr[j] = (char) sourceValue.WideString.data[j];
+ }
+ tmpstr[sourceValue.WideString.length] = 0;
+#if defined(WIN32) || defined (_WINDOWS)
+ int64_t result = _atoi64(tmpstr);
+#else
+ int64_t result = strtoll(tmpstr, NULL, 0);
+#endif
+ delete[] tmpstr;
+ return result;
+ }
+
+ default:
+ {
+ std::string msg("Invalid conversion to int64_t from SDOValue of type: ");
+ msg += DataTypeInfo::convertTypeEnumToString(dataType);
+ throw SDOInvalidConversionException(TUSCANY_SDO_EINFO,
+ msg.c_str());
+ break;
+ }
+ }
+ return 0;
+ }
+
+
+ const float SDODataConverter::convertToFloat(const DataTypeInfo::SDODataTypeUnion& sourceValue,
+ const DataTypeInfo::TrueDataType& dataType)
+ {
+ switch (dataType)
+ {
+ case DataTypeInfo::TDTbool:
+ return (sourceValue.Boolean == false) ? (float) 0 : (float) 1;
+
+ case DataTypeInfo::TDTchar:
+ return (float) sourceValue.Character;
+
+ case DataTypeInfo::TDTwchar_t:
+ return (float) sourceValue.WideChar;
+
+ case DataTypeInfo::TDTshort:
+ return (float) sourceValue.Short;
+
+ case DataTypeInfo::TDTlong:
+ return (float) sourceValue.Int;
+
+ case DataTypeInfo::TDTint64_t:
+ return (float) sourceValue.Int64;
+
+ case DataTypeInfo::TDTfloat:
+ return sourceValue.Float;
+
+ case DataTypeInfo::TDTdouble:
+ return (float) sourceValue.Double;
+
+ case DataTypeInfo::TDTSDODate:
+ return (float) (sourceValue.Date)->getTime();
+
+ case DataTypeInfo::TDTCString:
+ case DataTypeInfo::TDTByteArray:
+ return (float) atof(sourceValue.TextString->c_str());
+
+ case DataTypeInfo::TDTWideString:
+ {
+ char* tmpstr = new char[sourceValue.WideString.length + 1];
+ for (unsigned int j = 0; j < sourceValue.WideString.length; j++)
+ {
+ tmpstr[j] = (char) sourceValue.WideString.data[j];
+ }
+ tmpstr[sourceValue.WideString.length] = 0;
+ float result = (float) atof(tmpstr);
+ delete[] tmpstr;
+ return result;
+ }
+
+ default:
+ {
+ std::string msg("Invalid conversion to float from SDOValue of type: ");
+ msg += DataTypeInfo::convertTypeEnumToString(dataType);
+ throw SDOInvalidConversionException(TUSCANY_SDO_EINFO,
+ msg.c_str());
+ break;
+ }
+ }
+ return 0;
+ }
+
+
+ const double SDODataConverter::convertToDouble(const DataTypeInfo::SDODataTypeUnion& sourceValue,
+ const DataTypeInfo::TrueDataType& dataType)
+ {
+ switch (dataType)
+ {
+ case DataTypeInfo::TDTbool:
+ return (sourceValue.Boolean == false) ? (double) 0 : (double) 1;
+
+ case DataTypeInfo::TDTchar:
+ return (double) sourceValue.Character;
+
+ case DataTypeInfo::TDTwchar_t:
+ return (double) sourceValue.WideChar;
+
+ case DataTypeInfo::TDTshort:
+ return (double) sourceValue.Short;
+
+ case DataTypeInfo::TDTlong:
+ return (double) sourceValue.Int;
+
+ case DataTypeInfo::TDTint64_t:
+ return (double) sourceValue.Int64;
+
+ case DataTypeInfo::TDTfloat:
+ return (double) sourceValue.Float;
+
+ case DataTypeInfo::TDTdouble:
+ return sourceValue.Double;
+
+ case DataTypeInfo::TDTSDODate:
+ return (double) (sourceValue.Date)->getTime();
+
+ case DataTypeInfo::TDTCString:
+ case DataTypeInfo::TDTByteArray:
+ return atof(sourceValue.TextString->c_str());
+
+ case DataTypeInfo::TDTWideString:
+ {
+ char* tmpstr = new char[sourceValue.WideString.length + 1];
+ for (unsigned int j = 0; j < sourceValue.WideString.length; j++)
+ {
+ tmpstr[j] = (char) sourceValue.WideString.data[j];
+ }
+ tmpstr[sourceValue.WideString.length] = 0;
+ double result = atof(tmpstr);
+ delete[] tmpstr;
+ return result;
+ }
+
+ default:
+ {
+ std::string msg("Invalid conversion to double from SDOValue of type: ");
+ msg += DataTypeInfo::convertTypeEnumToString(dataType);
+ throw SDOInvalidConversionException(TUSCANY_SDO_EINFO,
+ msg.c_str());
+ break;
+ }
+ }
+ return 0;
+ }
+
+
+ const SDODate SDODataConverter::convertToDate(const DataTypeInfo::SDODataTypeUnion& sourceValue,
+ const DataTypeInfo::TrueDataType& dataType)
+ {
+ switch (dataType)
+ {
+ case DataTypeInfo::TDTbool:
+ case DataTypeInfo::TDTCString:
+ case DataTypeInfo::TDTByteArray:
+ case DataTypeInfo::TDTWideString:
+ {
+ std::string msg("Cannot get Date from object of type:");
+ msg += DataTypeInfo::convertTypeEnumToString(dataType);
+ throw SDOInvalidConversionException(TUSCANY_SDO_EINFO,
+ msg.c_str());
+ break;
+ }
+ case DataTypeInfo::TDTchar:
+ return SDODate((time_t) sourceValue.Character);
+
+ case DataTypeInfo::TDTwchar_t:
+ return SDODate((time_t) sourceValue.WideChar);
+
+ case DataTypeInfo::TDTshort:
+ return SDODate((time_t) sourceValue.Short);
+
+ case DataTypeInfo::TDTlong:
+ return SDODate((time_t) sourceValue.Int);
+
+ case DataTypeInfo::TDTint64_t:
+ return SDODate((time_t) sourceValue.Int64);
+
+ case DataTypeInfo::TDTfloat:
+ return SDODate((time_t) sourceValue.Float);
+
+ case DataTypeInfo::TDTdouble:
+ return SDODate((time_t) sourceValue.Double);
+
+ case DataTypeInfo::TDTSDODate:
+ return *(sourceValue.Date);
+
+ default:
+ {
+ std::string msg("Invalid conversion to SDODate from SDOValue of type: ");
+ msg += DataTypeInfo::convertTypeEnumToString(dataType);
+ throw SDOInvalidConversionException(TUSCANY_SDO_EINFO,
+ msg.c_str());
+ break;
+ }
+ }
+ return 0;
+ }
+
+
+ SDOString* SDODataConverter::convertToSDOString(const DataTypeInfo::SDODataTypeUnion& sourceValue,
+ const DataTypeInfo::TrueDataType& dataType)
+ {
+ char buffer[SDODataConverter::MAX_TRANSIENT_SIZE];
+ buffer[0] = 0;
+
+ switch (dataType)
+ {
+ case DataTypeInfo::TDTbool:
+ if (sourceValue.Boolean == false)
+ {
+ return new SDOString("false");
+ }
+ return new SDOString("true");
+ case DataTypeInfo::TDTchar:
+ {
+ sprintf(buffer , "%ld", (long) sourceValue.Character);
+ break;
+ }
+ case DataTypeInfo::TDTwchar_t:
+ {
+ sprintf(buffer , "%ld", (long) sourceValue.WideChar);
+ break;
+ }
+ case DataTypeInfo::TDTshort:
+ {
+ sprintf(buffer , "%ld", (long) sourceValue.Short);
+ break;
+ }
+ case DataTypeInfo::TDTlong:
+ {
+ sprintf(buffer , "%ld", sourceValue.Int);
+ break;
+ }
+ case DataTypeInfo::TDTint64_t:
+ sprintf(buffer , "%lld", sourceValue.Int64);
+ break;
+
+ case DataTypeInfo::TDTfloat:
+ {
+ sprintf(buffer , "%.*g", SDODataConverter::precision, sourceValue.Float);
+ break;
+ }
+ case DataTypeInfo::TDTdouble:
+ {
+ sprintf(buffer , "%.*Lg", SDODataConverter::precision, sourceValue.Double);
+ break;
+ }
+ case DataTypeInfo::TDTSDODate:
+ {
+ sprintf(buffer , "%ld", (sourceValue.Date)->getTime());
+ break;
+ }
+ case DataTypeInfo::TDTByteArray:
+ case DataTypeInfo::TDTCString:
+ return new SDOString(*sourceValue.TextString);
+ case DataTypeInfo::TDTWideString:
+ {
+ char* tmpbuf = new char[sourceValue.WideString.length + 1];
+ for (unsigned int i = 0; i < sourceValue.WideString.length; i++)
+ {
+ tmpbuf[i] = (char) (sourceValue.WideString.data)[i];
+ }
+
+ tmpbuf[sourceValue.WideString.length] = 0;
+ SDOString* result = new SDOString(tmpbuf);
+ delete[] tmpbuf;
+ return result;
+ }
+
+ default:
+ {
+ std::string msg("Invalid conversion to String from SDOValue of type: ");
+ msg += DataTypeInfo::convertTypeEnumToString(dataType);
+ throw SDOInvalidConversionException(TUSCANY_SDO_EINFO,
+ msg.c_str());
+ break;
+ }
+ }
+ return new SDOString(buffer);
+ }
+
+
+ unsigned int SDODataConverter::convertToBytes(const DataTypeInfo::SDODataTypeUnion& sourceValue,
+ const DataTypeInfo::TrueDataType& dataType,
+ char* outptr,
+ unsigned int max_length)
+ {
+ // max_length and outptr are allowed to be zero for some data types,
+ // to request that the length required to hold this value be returned
+ // rather than the actual data. This is a now obselete alternative to
+ // the getLength method. It creates a confusing situation because
+ // some datatypes respond to this and some return 0.
+ // if ((outptr == 0) || (max_length == 0))
+
+ switch (dataType)
+ {
+ case DataTypeInfo::TDTbool:
+ if (outptr == 0)
+ {
+ return 0;
+ }
+
+ if (sourceValue.Boolean)
+ {
+ if (max_length < 4)
+ {
+ return 0;
+ }
+ else
+ {
+ outptr[0] = 't';
+ outptr[1] = 'r';
+ outptr[2] = 'u';
+ outptr[3] = 'e';
+ return 4;
+ }
+ }
+ else
+ {
+ if (max_length < 5)
+ {
+ return 0;
+ }
+ else
+ {
+ outptr[0] = 'f';
+ outptr[1] = 'a';
+ outptr[2] = 'l';
+ outptr[3] = 's';
+ outptr[4] = 'e';
+ return 5;
+ }
+ }
+
+ case DataTypeInfo::TDTchar:
+ if (outptr == 0)
+ {
+ return 0;
+ }
+ outptr[0] = sourceValue.Character;
+ return 1;
+
+ case DataTypeInfo::TDTwchar_t:
+ if (outptr == 0)
+ {
+ return 0;
+ }
+ outptr[0] = (char) sourceValue.WideChar;
+ return 1;
+
+ case DataTypeInfo::TDTshort:
+ {
+ char tmpstr[SDODataConverter::MAX_TRANSIENT_SIZE];
+ unsigned int j = 0;
+
+ sprintf(tmpstr, "%ld", sourceValue.Short);
+ size_t tmplen = strlen(tmpstr);
+ if ((tmplen > max_length) || (outptr == 0))
+ {
+ return 0;
+ }
+ for (j = 0; j < tmplen; j++)
+ {
+ outptr[j] = tmpstr[j];
+ }
+ return j;
+
+ }
+ case DataTypeInfo::TDTlong:
+ {
+ char tmpstr[SDODataConverter::MAX_TRANSIENT_SIZE];
+ unsigned int j = 0;
+
+ sprintf(tmpstr, "%ld", sourceValue.Int);
+ size_t tmplen = strlen(tmpstr);
+ if ((tmplen > max_length) || (outptr == 0))
+ {
+ return 0;
+ }
+ for (j = 0; j < tmplen; j++)
+ {
+ outptr[j] = tmpstr[j];
+ }
+ return j;
+
+ }
+ case DataTypeInfo::TDTint64_t:
+ {
+ char tmpstr[SDODataConverter::MAX_TRANSIENT_SIZE];
+ unsigned int j = 0;
+
+ sprintf(tmpstr, "%lld", sourceValue.Int64);
+ size_t tmplen = strlen(tmpstr);
+ if ((tmplen > max_length) || (outptr == 0))
+ {
+ return 0;
+ }
+ for (j = 0; j < tmplen; j++)
+ {
+ outptr[j] = tmpstr[j];
+ }
+ return j;
+
+ }
+ case DataTypeInfo::TDTfloat:
+ {
+ char tmpstr[SDODataConverter::MAX_TRANSIENT_SIZE];
+ unsigned int j = 0;
+
+ sprintf(tmpstr, "%.*g", SDODataConverter::precision, sourceValue.Float);
+ size_t tmplen = strlen(tmpstr);
+ if ((tmplen > max_length) || (outptr == 0))
+ {
+ return 0;
+ }
+ for (j = 0; j < tmplen; j++)
+ {
+ outptr[j] = tmpstr[j];
+ }
+ return j;
+
+ }
+ case DataTypeInfo::TDTdouble:
+ {
+ char tmpstr[SDODataConverter::MAX_TRANSIENT_SIZE];
+ unsigned int j = 0;
+
+ sprintf(tmpstr, "%.*Lg", SDODataConverter::precision, sourceValue.Double);
+ size_t tmplen = strlen(tmpstr);
+ if ((tmplen > max_length) || (outptr == 0))
+ {
+ return 0;
+ }
+ for (j = 0; j < tmplen; j++)
+ {
+ outptr[j] = tmpstr[j];
+ }
+ return j;
+
+ }
+ case DataTypeInfo::TDTSDODate:
+ {
+ std::string msg("Conversion to bytes not implemented from type: SDODate");
+ throw SDOInvalidConversionException(TUSCANY_SDO_EINFO,
+ msg.c_str());
+ break;
+ }
+
+ case DataTypeInfo::TDTByteArray:
+ case DataTypeInfo::TDTCString:
+ {
+ if (max_length == 0)
+ {
+ return (sourceValue.TextString)->length();
+ }
+ else
+ {
+ unsigned int copy_count = (sourceValue.TextString)->length();
+ if (max_length < copy_count)
+ {
+ copy_count = max_length;
+ }
+ for (unsigned int i = 0; (i < copy_count); i++)
+ {
+ outptr[i] = (*sourceValue.TextString)[i];
+ }
+ return copy_count;
+ }
+ }
+
+ case DataTypeInfo::TDTWideString:
+ {
+ if (max_length == 0)
+ {
+ return sourceValue.WideString.length;
+ }
+ else
+ {
+ unsigned int copy_count = sourceValue.WideString.length;
+ if (max_length < copy_count)
+ {
+ copy_count = max_length;
+ }
+ for (unsigned int i = 0; i < copy_count; i++)
+ {
+ outptr[i] = (char) (sourceValue.WideString.data)[i];
+ }
+ return copy_count;
+ }
+ }
+
+ default:
+ {
+ std::string msg("Invalid conversion to bytes from SDOValue of type: ");
+ msg += DataTypeInfo::convertTypeEnumToString(dataType);
+ throw SDOInvalidConversionException(TUSCANY_SDO_EINFO,
+ msg.c_str());
+ break;
+ }
+ }
+ }
+
+ unsigned int SDODataConverter::convertToString(const DataTypeInfo::SDODataTypeUnion& sourceValue,
+ const DataTypeInfo::TrueDataType& dataType,
+ wchar_t* outptr,
+ unsigned int max_length)
+ {
+ // max_length and outptr are allowed to be zero for some data types,
+ // to request that the length required to hold this value be returned
+ // rather than the actual data. This is a now obselete alternative to
+ // the getLength method. It creates a confusing situation because
+ // some datatypes respond to this and some return 0.
+ // if ((outptr == 0) || (max_length == 0))
+
+ switch (dataType)
+ {
+ case DataTypeInfo::TDTbool:
+ if (outptr == 0)
+ {
+ return 0;
+ }
+
+ if (sourceValue.Boolean)
+ {
+ if (max_length < 4)
+ {
+ return 0;
+ }
+ else
+ {
+ outptr[0] = (wchar_t) 't';
+ outptr[1] = (wchar_t) 'r';
+ outptr[2] = (wchar_t) 'u';
+ outptr[3] = (wchar_t) 'e';
+ return 4;
+ }
+ }
+ else
+ {
+ if (max_length < 5)
+ {
+ return 0;
+ }
+ else
+ {
+ outptr[0] = (wchar_t) 'f';
+ outptr[1] = (wchar_t) 'a';
+ outptr[2] = (wchar_t) 'l';
+ outptr[3] = (wchar_t) 's';
+ outptr[4] = (wchar_t) 'e';
+ return 5;
+ }
+ }
+ case DataTypeInfo::TDTchar:
+ if (outptr == 0)
+ {
+ return 0;
+ }
+ outptr[0] = (wchar_t) sourceValue.Character;
+ return 1;
+
+ case DataTypeInfo::TDTwchar_t:
+ if (outptr == 0)
+ {
+ return 0;
+ }
+ outptr[0] = sourceValue.WideChar;
+ return 1;
+
+ case DataTypeInfo::TDTshort:
+ {
+ char tmpstr[SDODataConverter::MAX_TRANSIENT_SIZE];
+ unsigned int j = 0;
+
+ sprintf(tmpstr, "%ld", sourceValue.Short);
+ size_t tmplen = strlen(tmpstr);
+ if ((tmplen > max_length) || (outptr == 0))
+ {
+ return 0;
+ }
+ for (j = 0; j < tmplen; j++)
+ {
+ outptr[j] = (wchar_t) tmpstr[j];
+ }
+ return j;
+ }
+
+ case DataTypeInfo::TDTlong:
+ {
+ char tmpstr[SDODataConverter::MAX_TRANSIENT_SIZE];
+ unsigned int j = 0;
+
+ sprintf(tmpstr, "%ld", sourceValue.Int);
+ size_t tmplen = strlen(tmpstr);
+ if ((tmplen > max_length) || (outptr == 0))
+ {
+ return 0;
+ }
+ for (j = 0; j < tmplen; j++)
+ {
+ outptr[j] = (wchar_t) tmpstr[j];
+ }
+ return j;
+ }
+
+ case DataTypeInfo::TDTint64_t:
+ {
+ char tmpstr[SDODataConverter::MAX_TRANSIENT_SIZE];
+ unsigned int j = 0;
+
+ sprintf(tmpstr, "%lld", sourceValue.Int);
+ size_t tmplen = strlen(tmpstr);
+ if ((tmplen > max_length) || (outptr == 0))
+ {
+ return 0;
+ }
+ for (j = 0; j < tmplen; j++)
+ {
+ outptr[j] = (wchar_t) tmpstr[j];
+ }
+ return j;
+ }
+
+ case DataTypeInfo::TDTfloat:
+ {
+ char tmpstr[SDODataConverter::MAX_TRANSIENT_SIZE];
+ unsigned int j = 0;
+
+ sprintf(tmpstr, "%.*g", SDODataConverter::precision, sourceValue.Float);
+ size_t tmplen = strlen(tmpstr);
+ if ((tmplen > max_length) || (outptr == 0))
+ {
+ return 0;
+ }
+ for (j = 0; j < tmplen; j++)
+ {
+ outptr[j] = (wchar_t) tmpstr[j];
+ }
+ return j;
+ }
+
+ case DataTypeInfo::TDTdouble:
+ {
+ char tmpstr[SDODataConverter::MAX_TRANSIENT_SIZE];
+ unsigned int j = 0;
+
+ sprintf(tmpstr, "%.*Lg", SDODataConverter::precision, sourceValue.Double);
+ size_t tmplen = strlen(tmpstr);
+ if ((tmplen > max_length) || (outptr == 0))
+ {
+ return 0;
+ }
+ for (j = 0; j < tmplen; j++)
+ {
+ outptr[j] = (wchar_t) tmpstr[j];
+ }
+ return j;
+ }
+
+ case DataTypeInfo::TDTSDODate:
+ {
+ std::string msg("Conversion to string not implemented from type: SDODate");
+ throw SDOInvalidConversionException(TUSCANY_SDO_EINFO,
+ msg.c_str());
+ break;
+ }
+
+ case DataTypeInfo::TDTByteArray:
+ case DataTypeInfo::TDTCString:
+ {
+ if (max_length == 0)
+ {
+ return (sourceValue.TextString)->length();
+ }
+ else
+ {
+ unsigned int copy_count = (sourceValue.TextString)->length();
+ if (max_length < copy_count)
+ {
+ copy_count = max_length;
+ }
+ for (unsigned int i = 0; (i < copy_count); i++)
+ {
+ outptr[i] = (wchar_t) (*sourceValue.TextString)[i];
+ }
+ return copy_count;
+ }
+ }
+
+ case DataTypeInfo::TDTWideString:
+ {
+ if (max_length == 0)
+ {
+ return sourceValue.WideString.length;
+ }
+ else
+ {
+ unsigned int copy_count = sourceValue.WideString.length;
+ if (max_length < copy_count)
+ {
+ copy_count = max_length;
+ }
+ for (unsigned int i = 0; i < copy_count; i++)
+ {
+ outptr[i] = (sourceValue.WideString.data)[i];
+ }
+ return copy_count;
+ }
+ }
+
+ default:
+ {
+ std::string msg("Invalid conversion to String from SDOValue of type: ");
+ msg += DataTypeInfo::convertTypeEnumToString(dataType);
+ throw SDOInvalidConversionException(TUSCANY_SDO_EINFO,
+ msg.c_str());
+ break;
+ }
+ }
+ }
+ unsigned int SDODataConverter::precision = 6;
+ }
+}
diff --git a/sdo-cpp/trunk/runtime/core/src/commonj/sdo/SDODataConverter.h b/sdo-cpp/trunk/runtime/core/src/commonj/sdo/SDODataConverter.h
new file mode 100644
index 0000000000..b4fd96d9fa
--- /dev/null
+++ b/sdo-cpp/trunk/runtime/core/src/commonj/sdo/SDODataConverter.h
@@ -0,0 +1,86 @@
+/*
+*
+* Copyright 2007 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$ */
+
+#ifndef _SDODATACONVERTER_H_
+#define _SDODATACONVERTER_H_
+
+#include "commonj/sdo/DataTypeInfo.h"
+#include "commonj/sdo/SDODate.h"
+
+namespace commonj
+{
+ namespace sdo
+ {
+ // The SDODataConverter class provides methods that convert between the
+ // many primitive data types that SDO must support. In general, the
+ // inputs to a method are a DataTypeInfo::SDODataTypeUnion that gives
+ // the source value that is to be converted and a
+ // DataTypeInfo::TrueDataType that says which member of the union is
+ // actually set. The target of the conversion is determined by the
+ // method name.
+
+ class SDODataConverter
+ {
+
+ public:
+ static const bool convertToBoolean(const DataTypeInfo::SDODataTypeUnion& sourceValue,
+ const DataTypeInfo::TrueDataType& dataType);
+ static const char convertToByte(const DataTypeInfo::SDODataTypeUnion& sourceValue,
+ const DataTypeInfo::TrueDataType& dataType);
+ static const wchar_t convertToCharacter(const DataTypeInfo::SDODataTypeUnion& sourceValue,
+ const DataTypeInfo::TrueDataType& dataType);
+ static const short convertToShort(const DataTypeInfo::SDODataTypeUnion& sourceValue,
+ const DataTypeInfo::TrueDataType& dataType);
+ static const long convertToInt(const DataTypeInfo::SDODataTypeUnion& sourceValue,
+ const DataTypeInfo::TrueDataType& dataType);
+ static const int64_t convertToLong(const DataTypeInfo::SDODataTypeUnion& sourceValue,
+ const DataTypeInfo::TrueDataType& dataType);
+ static const float convertToFloat(const DataTypeInfo::SDODataTypeUnion& sourceValue,
+ const DataTypeInfo::TrueDataType& dataType);
+ static const double convertToDouble(const DataTypeInfo::SDODataTypeUnion& sourceValue,
+ const DataTypeInfo::TrueDataType& dataType);
+ static const SDODate convertToDate(const DataTypeInfo::SDODataTypeUnion& sourceValue,
+ const DataTypeInfo::TrueDataType& dataType);
+
+ static SDOString* convertToSDOString(const DataTypeInfo::SDODataTypeUnion& sourceValue,
+ const DataTypeInfo::TrueDataType& dataType);
+
+ static unsigned int convertToBytes(const DataTypeInfo::SDODataTypeUnion& sourceValue,
+ const DataTypeInfo::TrueDataType& dataType,
+ char* outptr,
+ unsigned int max_length);
+ static unsigned int convertToString(const DataTypeInfo::SDODataTypeUnion& sourceValue,
+ const DataTypeInfo::TrueDataType& dataType,
+ wchar_t* outptr,
+ unsigned int max_length);
+
+ static unsigned int precision;
+
+ private:
+ // We sometimes need to convert primitive data types into an
+ // equivalent string representation and for that we need a
+ // temporary buffer. Rather than fret too much about how big each
+ // one can be we choose a size that should be adequate for any of them
+
+ static const int MAX_TRANSIENT_SIZE;
+ };
+ }
+}
+
+#endif // _SDODATACONVERTER_H
diff --git a/sdo-cpp/trunk/runtime/core/src/commonj/sdo/SDODate.cpp b/sdo-cpp/trunk/runtime/core/src/commonj/sdo/SDODate.cpp
new file mode 100644
index 0000000000..66c13d19d5
--- /dev/null
+++ b/sdo-cpp/trunk/runtime/core/src/commonj/sdo/SDODate.cpp
@@ -0,0 +1,80 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you 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$ */
+
+#include "commonj/sdo/SDODate.h"
+
+// According to Linux, localtime_r is defined as
+// struct tm *localtime_r(const time_t *timep, struct tm *result);
+// However, Windows doesn't have localtime_r, and actually varies what it does
+// have across dfferent versions. To accommodate this we use a macro that
+// resolves to the correct settings on linux and MS VC8. For other platforms
+// it will be necessary to modify this file or override the macro for which we
+// provide the SDOUserMacros.h file so that any required macro definition can
+// supply other includes if they are needed.
+
+#include "commonj/sdo/SDOUserMacros.h"
+#ifndef tuscany_localtime_r
+#if defined(WIN32) || defined (_WINDOWS)
+ #if _MSC_VER < 1400 // _MSC_VER: 1400 is msvc 8.0, so anything less is pre 8.0
+ #define tuscany_localtime_r(value, ignore) localtime(&value);
+ #else
+ #define tuscany_localtime_r(value, tmp_tm) localtime_s(&tmp_tm, &value);
+ #endif
+#else
+ #define tuscany_localtime_r(value, tmp_tm) localtime_r(&value, &tmp_tm);
+#endif
+#endif // tuscany_localtime_r
+
+namespace commonj{
+namespace sdo{
+
+
+ SDODate::~SDODate()
+ {
+ }
+
+ SDODate::SDODate(time_t inval)
+ {
+ value = inval;
+ }
+
+ ///////////////////////////////////////////////////////////////////////////
+ //
+ ///////////////////////////////////////////////////////////////////////////
+
+ const time_t SDODate::getTime(void) const
+ {
+ return value;
+ }
+
+ const char* SDODate::ascTime(void) const
+ {
+ struct tm tmp_tm;
+
+ tuscany_localtime_r(value, tmp_tm);
+
+ return asctime(&tmp_tm);
+ }
+
+};
+};
+// end - namespace sdo
+
diff --git a/sdo-cpp/trunk/runtime/core/src/commonj/sdo/SDODate.h b/sdo-cpp/trunk/runtime/core/src/commonj/sdo/SDODate.h
new file mode 100644
index 0000000000..59306462e5
--- /dev/null
+++ b/sdo-cpp/trunk/runtime/core/src/commonj/sdo/SDODate.h
@@ -0,0 +1,79 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you 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$ */
+
+#ifndef _SDO_SDODATE_H_
+#define _SDO_SDODATE_H_
+
+
+#include "commonj/sdo/export.h"
+#include "time.h"
+
+
+
+
+namespace commonj{
+namespace sdo{
+
+
+ ///////////////////////////////////////////////////////////////////////////
+ // A representation of the type of a date.
+ ///////////////////////////////////////////////////////////////////////////
+
+/**
+ * SDODate - a means of hiding the time_t.
+ * The SDO API in several places uses method overloads to allow the
+ * same method to set many types of data. As time_t and long are
+ * sometimes synonymous, it was not possible to have a time_t and a
+ * long method, so SDODate simply wraps the time_t.
+ * SDODate also allows modifcation of the implementation, as time_t is
+ * only a short-term solution - better date/time handling is required.
+ */
+
+class SDODate
+{
+
+public:
+
+
+ virtual SDO_API ~SDODate();
+
+ SDO_API SDODate(time_t inval);
+
+ /**
+ * Hand out the date as a time_t
+ */
+ virtual SDO_API const time_t getTime() const;
+
+ /**
+ * Format the date as a string
+ */
+
+ virtual const char* ascTime(void) const;
+
+
+private:
+ time_t value;
+};
+
+};
+};
+#endif //_SDO_SDODATE_H_
+
diff --git a/sdo-cpp/trunk/runtime/core/src/commonj/sdo/SDORuntimeException.cpp b/sdo-cpp/trunk/runtime/core/src/commonj/sdo/SDORuntimeException.cpp
new file mode 100644
index 0000000000..da49e1c143
--- /dev/null
+++ b/sdo-cpp/trunk/runtime/core/src/commonj/sdo/SDORuntimeException.cpp
@@ -0,0 +1,187 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you 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$ */
+
+
+#include "commonj/sdo/SDORuntimeException.h"
+
+#include <stdio.h>
+
+// Exception safe helper function
+char* makeCopy(const char* src)
+{
+
+ try {
+ char* tmp;
+ if (src != 0) {
+ int strSize = strlen(src);
+ tmp = new char[strSize + 1];
+ strncpy(tmp, src, strSize + 1);
+ }
+ else {
+ tmp = new char[1];
+ tmp[0] = '\0';
+ }
+
+ return tmp;
+ } catch (...) {
+ return (char*)"";
+ }
+}
+
+namespace commonj {
+
+namespace sdo {
+
+SDOExceptionInfo::SDOExceptionInfo(const char* fileNameIN,
+ unsigned long lineNumberIN,
+ const char* functionNameIN)
+ : lineNumber(lineNumberIN)
+ , fileName(0)
+ , functionName(0)
+{
+ fileName = makeCopy(fileNameIN);
+ functionName = makeCopy(functionNameIN);
+}
+
+SDOExceptionInfo::SDOExceptionInfo(const SDOExceptionInfo& second)
+ : lineNumber(second.lineNumber)
+ , fileName(0)
+ , functionName(0)
+{
+ fileName= makeCopy(second.fileName);
+ functionName = makeCopy(second.functionName);
+}
+
+SDOExceptionInfo&
+SDOExceptionInfo::operator=(const SDOExceptionInfo& second)
+{
+ if (fileName) {
+ delete [] fileName;
+ }
+ fileName = makeCopy(second.fileName);
+
+ if (functionName) {
+ delete [] functionName;
+ }
+ functionName = makeCopy(second.functionName);
+
+ lineNumber = second.lineNumber;
+ return *this;
+}
+
+SDOExceptionInfo::~SDOExceptionInfo()
+{
+ if (fileName) {
+ delete [] fileName;
+ }
+ if (functionName) {
+ delete [] functionName;
+ }
+}
+
+// ========================================================================
+// Constructor
+// ========================================================================
+SDORuntimeException::SDORuntimeException(const SDOExceptionInfo& einfo,
+ const char* msg_text,
+ const char* className)
+ : info(einfo), message_text(0), class_name(className)
+{
+ message_text = makeCopy(msg_text);
+} // end SDORuntimeException constuctor
+
+// ========================================================================
+// Copy constructor
+// ========================================================================
+SDORuntimeException::SDORuntimeException(const SDORuntimeException& c)
+ : info(c.info), message_text(0), class_name(c.class_name)
+{
+ message_text = makeCopy(c.message_text);
+}
+
+// ========================================================================
+// Destructor
+// ========================================================================
+SDORuntimeException::~SDORuntimeException()
+{
+ if (message_text)
+ {
+ delete[] message_text;
+ }
+} // end SDORuntimeException destructor
+
+// ========================================================================
+// Return class name of this exception
+// ========================================================================
+const char* SDORuntimeException::getEClassName() const
+{
+ return class_name;
+} // end getClassName()
+
+// ========================================================================
+// Return message text associated with exception
+// ========================================================================
+const char* SDORuntimeException::getMessageText() const
+{
+ return message_text;
+} // end getMessageText()
+
+// ========================================================================
+// Return file name where exception was raised
+// ========================================================================
+const char* SDORuntimeException::getFileName() const
+{
+ return info.fileName;
+} // end getFileName()
+
+// ========================================================================
+// Return line number where exception was raised
+// ========================================================================
+unsigned long SDORuntimeException :: getLineNumber() const
+{
+ return info.lineNumber;
+} // end getLineNumber()
+
+// ========================================================================
+// Return function name where exception was raised
+// ========================================================================
+const char* SDORuntimeException :: getFunctionName() const
+{
+ return info.functionName;
+} // end getFunctionName()
+
+} // end namespace sdo
+} // end namespace commonj
+
+// ========================================================================
+// ostream operator <<
+// ========================================================================
+SDO_API std::ostream& operator<<(std::ostream& os, const commonj::sdo::SDORuntimeException& except)
+{
+ os << "Exception object :" << std::endl;
+ os << " class: " << except.getEClassName() << std::endl;
+ os << " file name: " << except.getFileName() << std::endl;
+ os << " line number: " << except.getLineNumber() << std::endl;
+ os << " function: " << except.getFunctionName() << std::endl;
+ os << " description: " << except.getMessageText() << std::endl;
+ return os;
+} // end ostream operator <<
+
diff --git a/sdo-cpp/trunk/runtime/core/src/commonj/sdo/SDORuntimeException.h b/sdo-cpp/trunk/runtime/core/src/commonj/sdo/SDORuntimeException.h
new file mode 100644
index 0000000000..0c39d7dede
--- /dev/null
+++ b/sdo-cpp/trunk/runtime/core/src/commonj/sdo/SDORuntimeException.h
@@ -0,0 +1,363 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you 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$ */
+
+#if !defined SDO_EXCEPTIONS_H
+#define SDO_EXCEPTIONS_H
+
+#include "commonj/sdo/export.h"
+
+#include <string>
+#include <iostream>
+
+namespace commonj {
+
+ namespace sdo {
+
+/**
+ * Helper Class for SDORuntimeException constructor. Used with below macros
+ * to collect context information.
+ */
+class SDOExceptionInfo
+{
+public:
+ SDO_API SDOExceptionInfo(const char* fileName, unsigned long lineNumber, const char* functionName);
+ SDO_API SDOExceptionInfo(const SDOExceptionInfo& second);
+ SDO_API ~SDOExceptionInfo();
+ SDO_API SDOExceptionInfo& operator=(const SDOExceptionInfo& second);
+
+private:
+ unsigned long lineNumber;
+ const char* fileName;
+ const char* functionName;
+
+ friend class SDORuntimeException;
+};
+
+#ifdef _WIN32
+# define TUSCANY_SDO_EINFO \
+ commonj::sdo::SDOExceptionInfo(__FILE__, __LINE__, __FUNCSIG__)
+#elif linux
+# define TUSCANY_SDO_EINFO \
+ commonj::sdo::SDOExceptionInfo(__FILE__, __LINE__, __PRETTY_FUNCTION__)
+#elif defined(__SUNPRO_CC)
+# define TUSCANY_SDO_EINFO \
+ commonj::sdo::SDOExceptionInfo(__FILE__, __LINE__, 0)
+#elif defined(__HP_aCC)
+# define TUSCANY_SDO_EINFO \
+ commonj::sdo::SDOExceptionInfo(__FILE__, __LINE__, __PRETTY_FUNCTION__)
+#elif defined(__IBMCPP__)
+# define TUSCANY_SDO_EINFO \
+ commonj::sdo::SDOExceptionInfo(__FILE__, __LINE__, __func__)
+#else
+# define TUSCANY_SDO_EINFO \
+ commonj::sdo::SDOExceptionInfo(0, 0, 0)
+#endif
+
+
+/**
+ * SDORuntimeException - Exception base class.
+ *
+ */
+class SDORuntimeException
+{
+ public:
+ // Constructor
+ SDO_API SDORuntimeException(const SDOExceptionInfo& info,
+ const char* msg_text,
+ const char* name="SDORuntimeException");
+
+ SDO_API SDORuntimeException(const SDORuntimeException& c);
+
+ // Destructor
+ SDO_API virtual ~SDORuntimeException();
+
+ /** getEClassName() get the exception class
+ *
+ * returns the name of the exception class, which will be
+ * a subclass of SDORuntimeException
+ */
+
+ SDO_API const char* getEClassName() const;
+
+ /**
+ * Return message text associated with exception
+ */
+
+ SDO_API const char* getMessageText() const;
+
+ /** getFileName() the file where the exception occurred
+ *
+ * Return file name where exception was raised
+ */
+
+ SDO_API const char* getFileName() const;
+
+ /** getLineNumber gives the line where the exception occurred
+ *
+ * Return line number where exception was raised
+ */
+
+ SDO_API unsigned long getLineNumber() const;
+
+ /** getFunctionName give the name of the raising function
+ *
+ * Return function name where exception was raised
+ */
+
+ SDO_API const char* getFunctionName() const;
+
+ private:
+ const char* class_name;
+ char* message_text; // Description of exception
+ SDOExceptionInfo info;
+}; // End SDORuntimeException class definition
+
+/**
+ ***************************************************************************
+ *
+ * SDOOutOfMemoryException - Exception for no-storage
+ *
+ * ***************************************************************************
+ */
+
+class SDOOutOfMemoryException: public SDORuntimeException
+{
+ public:
+ SDOOutOfMemoryException(const SDOExceptionInfo& info,
+ const char* msg_text,
+ const char* name="SDOOutOfMemoryException")
+ : SDORuntimeException(info, msg_text, name)
+ {
+ }
+}; // End SDOOutOfMemory class definition
+
+/**
+ ***************************************************************************
+ *
+ * SDONullPointerException - Exception for no-storage
+ *
+ * ***************************************************************************
+ */
+
+class SDONullPointerException: public SDORuntimeException
+{
+ public:
+ SDONullPointerException(const SDOExceptionInfo& info,
+ const char* msg_text,
+ const char* name="SDONullPointerException")
+ : SDORuntimeException(info, msg_text, name)
+ {
+ }
+}; // End SDOOutOfMemory class definition
+
+/**
+ ***************************************************************************
+ *
+ * SDOPathNotFoundException - Exception for bad path
+ *
+ ****************************************************************************
+ */
+class SDOPathNotFoundException: public SDORuntimeException
+{
+ public:
+ SDOPathNotFoundException(const SDOExceptionInfo& info,
+ const char* msg_text,
+ const char* name="SDOPathNotFoundException")
+ : SDORuntimeException(info, msg_text, name)
+ {
+ }
+}; // End SDOPathNotFoundException class definition
+
+/**
+ ***************************************************************************
+ *
+ * SDOPropertyNotFoundException - Exception for property not found
+ *
+ ****************************************************************************
+ */
+
+class SDOPropertyNotFoundException: public SDORuntimeException
+{
+ public:
+ SDOPropertyNotFoundException(const SDOExceptionInfo& info,
+ const char* msg_text,
+ const char* name="SDOPropertyNotFoundException")
+ : SDORuntimeException(info, msg_text, name)
+ {
+ }
+}; // End SDOPropertyNotFoundException class definition
+
+/**
+ ***************************************************************************
+ *
+ * SDOTypeNotFoundException - Exception for type not found.
+ *
+ ****************************************************************************
+ */
+class SDOTypeNotFoundException: public SDORuntimeException
+{
+ public:
+ SDOTypeNotFoundException(const SDOExceptionInfo& info,
+ const char* msg_text,
+ const char* name="SDOTypeNotFoundException")
+ : SDORuntimeException(info, msg_text, name)
+ {
+ }
+}; // End SDOTypeNotFoundException class definition
+
+/**
+ ***************************************************************************
+ *
+ * SDOFileNotFoundException - Exception for file not found
+ *
+ ****************************************************************************
+ */
+
+class SDOFileNotFoundException: public SDORuntimeException
+{
+ public:
+ SDOFileNotFoundException(const SDOExceptionInfo& info,
+ const char* msg_text,
+ const char* name="SDOFileNotFoundException")
+ : SDORuntimeException(info, msg_text, name)
+ {
+ }
+ private:
+}; // End SDOFileNotFoundException class definition
+
+/**
+ ***************************************************************************
+ *
+ * SDOPropertyNotSetException - Exception for asking for the value of an
+ * unset/undefaulted prop
+ *
+ ****************************************************************************
+ */
+class SDOPropertyNotSetException: public SDORuntimeException
+{
+ public:
+ SDOPropertyNotSetException(const SDOExceptionInfo& info,
+ const char* msg_text,
+ const char* name="SDOPropertyNotSetException")
+ : SDORuntimeException(info, msg_text, name)
+ {
+ }
+}; // End SDOPropertyNotSetException class definition
+
+/**
+ ***************************************************************************
+ *
+ * SDOUnsupportedOperationException - Invalid action or unimplemented method.
+ *
+ ****************************************************************************
+ */
+class SDOUnsupportedOperationException: public SDORuntimeException
+{
+ public:
+ SDOUnsupportedOperationException(const SDOExceptionInfo& info,
+ const char* msg_text,
+ const char* name="SDOUnsupportedOperationException")
+ : SDORuntimeException(info, msg_text, name)
+ {
+ }
+}; // End SDOTypeNotFoundException class definition
+
+/**
+ ***************************************************************************
+ *
+ * SDOInvalidConversionException - Invalid conversion - cannot convert to type.
+ *
+ ****************************************************************************
+ */
+class SDOInvalidConversionException: public SDORuntimeException
+{
+ public:
+ SDOInvalidConversionException(const SDOExceptionInfo& info,
+ const char* msg_text,
+ const char* name="SDOInvalidConversionException")
+ : SDORuntimeException(info, msg_text, name)
+ {
+ }
+}; // End SDOTypeNotFoundException class definition
+
+/**
+ ***************************************************************************
+ *
+ * SDOIllegalArgumentException - Invalid argument passed (null name?).
+ *
+ ****************************************************************************
+ */
+class SDOIllegalArgumentException: public SDORuntimeException
+{
+ public:
+ SDOIllegalArgumentException(const SDOExceptionInfo& info,
+ const char* msg_text,
+ const char* name="SDOIllegalArgumentException")
+ : SDORuntimeException(info, msg_text, name)
+ {
+ }
+}; // End SDOTypeNotFoundException class definition
+
+/**
+ ****************************************************************************
+ *
+ * SDOIndexOutOfRangeException - element index not in a list.
+ *
+ ****************************************************************************
+ */
+class SDOIndexOutOfRangeException: public SDORuntimeException
+{
+ public:
+ SDOIndexOutOfRangeException(const SDOExceptionInfo& info,
+ const char* msg_text,
+ const char* name="SDOIndexOutOfRangeException")
+ : SDORuntimeException(info, msg_text, name)
+ {
+ }
+}; // End SDOTypeNotFoundException class definition
+
+/**
+ ***************************************************************************
+ *
+ * SDOXMLParserException - XMLParser error
+ *
+ ****************************************************************************
+ */
+class SDOXMLParserException: public SDORuntimeException
+{
+ public:
+ SDOXMLParserException(const SDOExceptionInfo& info,
+ const char* msg_text,
+ const char* name="SDOXMLParserException")
+ : SDORuntimeException(info, msg_text, name)
+ {
+ }
+}; // End SDOTypeNotFoundException class definition
+
+} // end namespace sdo
+} // end namespace commonj
+
+SDO_API std::ostream& operator<<(std::ostream& os,
+ const commonj::sdo::SDORuntimeException& except);
+
+#endif
+
+
diff --git a/sdo-cpp/trunk/runtime/core/src/commonj/sdo/SDOSAX2Parser.cpp b/sdo-cpp/trunk/runtime/core/src/commonj/sdo/SDOSAX2Parser.cpp
new file mode 100644
index 0000000000..8e85877aa3
--- /dev/null
+++ b/sdo-cpp/trunk/runtime/core/src/commonj/sdo/SDOSAX2Parser.cpp
@@ -0,0 +1,1561 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you 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$ */
+
+#include "commonj/sdo/SDOSAX2Parser.h"
+
+#include "commonj/sdo/SDORuntimeException.h"
+#include "commonj/sdo/ChangeSummary.h"
+#include "commonj/sdo/XSDPropertyInfo.h"
+#include "commonj/sdo/XMLQName.h"
+#include "commonj/sdo/DASProperty.h"
+#include "commonj/sdo/Logging.h"
+#include "commonj/sdo/DASType.h"
+#include "commonj/sdo/XSDTypeInfo.h"
+#include "commonj/sdo/TypeImpl.h"
+#include "commonj/sdo/DataObjectImpl.h"
+#include "commonj/sdo/DataFactoryImpl.h"
+#include "commonj/sdo/SDOUtils.h"
+#include <stdio.h>
+using namespace std;
+
+namespace commonj
+{
+ namespace sdo
+ {
+
+ using internal::XSDPropertyInfo;
+ using internal::PropertyDefinitionImpl;
+ using internal::XSDTypeInfo;
+ using internal::TypeDefinitionImpl;
+ using internal::SDOUtils;
+
+ SDOSAX2Parser::SDOSAX2Parser(
+ DataFactoryPtr df,
+ const SDOXMLString& targetNamespace,
+ DataObjectPtr& rootDO,
+ ParserErrorSetter* insetter
+ )
+
+ : dataFactory(staticCast<DataFactoryImplPtr>(df)),
+ targetNamespaceURI(targetNamespace),
+ rootDataObject(rootDO),
+ currentDataObject(0),
+ isDataGraph(false),
+ ignoreEvents(false),
+ dealingWithChangeSummary(false),
+ csbuilder(0),
+ SAX2Parser(insetter),
+ rootElementName(""),
+ rootElementURI("")
+
+
+ {
+ reset();
+ if (targetNamespace.isNull())
+ {
+ targetNamespaceURI = "";
+ }
+ rootDataObject = 0;
+ newSequence = true;
+ }
+
+ SDOSAX2Parser::~SDOSAX2Parser()
+ {
+ }
+
+ void SDOSAX2Parser::reset()
+ {
+ rootDataObject = 0;
+ currentDataObject = 0;
+ isDataGraph = false;
+ ignoreEvents = false;
+ changeSummary = false;
+ IDMap.empty();
+ IDRefs.empty();
+ rootElementURI = "";
+ rootElementName = "";
+ }
+
+ void SDOSAX2Parser::setRootElementName(const SDOXMLString& name)
+ {
+ rootElementName = name;
+ }
+
+ void SDOSAX2Parser::setRootElementURI(const SDOXMLString& uri)
+ {
+ rootElementURI = uri;
+ }
+
+ void SDOSAX2Parser::startDocument()
+ {
+ LOGINFO(INFO,"SDOSAX2Parser: startDocument");
+ setNamespaces = true;
+ reset();
+ }
+
+ void SDOSAX2Parser::endDocument()
+ {
+ LOGENTRY(INFO,"SDOSAX2Parser: endDocument");
+ // Iterate over IDREFs list and set references
+ ID_REFS::iterator refsIter;
+ for (refsIter = IDRefs.begin(); refsIter != IDRefs.end(); refsIter++)
+ {
+ try
+ {
+ const Type& type = refsIter->dataObject->getType();
+ PropertyPtr prop = refsIter->dataObject->getInstanceProperty((const char*)refsIter->property);
+ if (!prop) {
+ SDOString msg("Cannot find property: ");
+ msg += (const char*)refsIter->property;
+ throw SDOPropertyNotFoundException(TUSCANY_SDO_EINFO,
+ msg.c_str());
+ }
+ const Type& propType = ((TypeImpl&)type).getRealPropertyType(refsIter->property);
+
+ // Allowing referenes to DataObjects only
+ if (!propType.isDataType())
+ {
+ DataObjectPtr reffedDO;
+ ID_MAP::iterator idIter = IDMap.find(refsIter->value);
+ if (idIter != IDMap.end())
+ {
+ reffedDO = idIter->second;
+ }
+ else
+ {
+ // assume it is an XPath?
+
+ // Remove #/ from front of XPATH as getDataObject doeesnt
+ // support this yet - it does now
+ //SDOXMLString xpath(refsIter->value);
+ //if (xpath.firstIndexOf('#') == 0)
+ // xpath = xpath.substring(1);
+ //if (xpath.firstIndexOf('/') == 0)
+ // xpath = xpath.substring(1);
+
+ reffedDO = rootDataObject->getDataObject((const char*)refsIter->value);
+ }
+
+ if (!reffedDO)
+ {
+ continue;
+ }
+
+ if (prop->isMany())
+ {
+ DataObjectList& dol = refsIter->dataObject->getList(*prop);
+ dol.append(reffedDO);
+ }
+ else
+ {
+ refsIter->dataObject->setDataObject(*prop, reffedDO);
+ }
+ }
+
+ }
+ catch (const SDORuntimeException&)
+ {
+ }
+ }
+ try {
+ // Now rebuild the changeSummary
+ if (csbuilder != 0)
+ {
+ csbuilder->buildChangeSummary(changeSummaryDO);
+ delete csbuilder;
+ csbuilder = 0;
+ }
+ }
+ catch (SDORuntimeException&)
+ {
+ }
+
+ LOGEXIT(INFO,"SDOSAX2Parser: endDocument");
+ }
+
+
+ bool SDOSAX2Parser::setDO(DataObjectPtr newDO,
+ SDOXMLString& propertyName)
+ {
+ LOGENTRY(INFO,"SDOSAX2Parser: setDO");
+
+ if (currentDataObject)
+ {
+ const Type& type = currentDataObject->getType();
+ // go lower level so we can find open properties w/o exception
+ DataObject* dob = getRawPointer(currentDataObject);
+ const PropertyImpl* pprop = ((DataObjectImpl*)dob)->getPropertyImpl((const char*)propertyName);
+ if (pprop == 0)
+ {
+
+ LOGEXIT(INFO,"SDOSAX2Parser: setDO - exit1");
+ return false;
+ }
+
+ const Property& property = (Property&)*pprop;
+ //const Type& propertyType = ((TypeImpl&)type).getRealPropertyType(propertyName);
+ if (currentDataObject->getType().isSequencedType())
+ {
+ SequencePtr seq = currentDataObject->getSequence();
+ seq->addDataObject(property, newDO);
+ }
+ else
+ {
+ if (!property.isMany())
+ {
+ currentDataObject->setDataObject((const char*)propertyName, newDO);
+ }
+ else
+ {
+ DataObjectList& dol = currentDataObject->getList((const char*)propertyName);
+ dol.append(newDO);
+ }
+ }
+ }
+
+ setCurrentDataObject(newDO);
+
+ LOGEXIT(INFO,"SDOSAX2Parser: setDO - exit2");
+ return true;
+ }
+
+ void SDOSAX2Parser::handleOpenAttribute(
+ SDOXMLString& tns,
+ const SDOXMLString& propuri,
+ const SDOXMLString& propname,
+ const SDOXMLString& value)
+ {
+ // first, see if there is a global element or attribute corresponding...
+ try
+ {
+ const PropertyImpl* prop = 0;
+ const TypeImpl* ti =
+ dataFactory->findTypeImpl(propuri,"RootType");
+
+ if (ti != 0)
+ {
+ prop = (const PropertyImpl*)ti->getPropertyImpl(propname);
+ }
+ else
+ {
+ ti = dataFactory->findTypeImpl(tns,"RootType");
+ }
+
+ if (ti != 0)
+ {
+ prop = (const PropertyImpl*)ti->getPropertyImpl(propname);
+ }
+
+ if (prop == 0)
+ {
+ // need to use the sequence interface if it exists
+ if (currentDataObject->getType().isSequencedType())
+ {
+ SequencePtr seq = currentDataObject->getSequence();
+ seq->addCString(propname, value);
+ }
+ else
+ {
+ currentDataObject->setCString((const char*)propname,value);
+ }
+ return;
+ }
+
+ DataObject* dob = getRawPointer(currentDataObject);
+
+ switch (prop->getTypeEnum())
+ {
+ case Type::BooleanType:
+ ((DataObjectImpl*)dob)->defineBoolean(propname);
+ break;
+ case Type::ByteType:
+ ((DataObjectImpl*)dob)->defineByte(propname);
+ break;
+ case Type::CharacterType:
+ ((DataObjectImpl*)dob)->defineCharacter(propname);
+ break;
+ case Type::BytesType:
+ ((DataObjectImpl*)dob)->defineBytes(propname);
+ break;
+ case Type::StringType:
+ ((DataObjectImpl*)dob)->defineString(propname);
+ break;
+ case Type::ShortType:
+ ((DataObjectImpl*)dob)->defineShort(propname);
+ break;
+ case Type::IntType:
+ ((DataObjectImpl*)dob)->defineInt(propname);
+ break;
+ case Type::LongType:
+ ((DataObjectImpl*)dob)->defineLong(propname);
+ break;
+ case Type::DoubleType:
+ ((DataObjectImpl*)dob)->defineDouble(propname);
+ break;
+ case Type::FloatType:
+ ((DataObjectImpl*)dob)->defineFloat(propname);
+ break;
+ case Type::DateType:
+ ((DataObjectImpl*)dob)->defineDate(propname);
+ break;
+ } // switch
+
+ // regardless of what type the property now is, we can set CString , and the
+ // right conversion will happen
+
+ // need to use the sequence interface if it exists.
+ if (currentDataObject->getType().isSequencedType())
+ {
+ SequencePtr seq = currentDataObject->getSequence();
+ seq->addCString(propname, value);
+ }
+ else
+ {
+ currentDataObject->setCString((const char*)propname,value);
+ }
+ }
+ catch (SDORuntimeException)
+ {
+ }
+ return;
+ }
+
+
+ void SDOSAX2Parser::setAttributes(
+ SDOXMLString& tns,
+ const SAX2Namespaces& namespaces,
+ const SAX2Attributes& attributes)
+ {
+
+ LOGENTRY(INFO,"SDOSAX2Parser::setAttributes");
+
+ //////////////////////////////////////////////
+ // The attributes are properties on the new DO
+ // Handle attributes
+ //////////////////////////////////////////////
+ for (int i=0; i < attributes.size(); i++)
+ {
+ // Should ignore attributes like xsi:type
+ if (!(attributes[i].getUri().equalsIgnoreCase("http://www.w3.org/2001/XMLSchema-instance")))
+ {
+ try
+ {
+ const SDOXMLString& propertyName = getSDOName(*currentDataObjectType, attributes[i].getName());
+ DataObject* dob = getRawPointer(currentDataObject);
+ const PropertyImpl* pprop = ((DataObjectImpl*)dob)->getPropertyImpl(propertyName);
+ if (pprop == 0 )
+ {
+ if (currentDataObject->getType().isOpenType())
+ {
+ // if its an open type, then attributes will be allowed to have
+ // an invalid name, and setCString will create them all as bytes
+ handleOpenAttribute(tns, attributes[i].getUri(),
+ attributes[i].getName(),
+ attributes[i].getValue());
+
+ }
+ else
+ {
+ LOGERROR_1(WARNING,"SDOSAX2Parser: Property not found on closed type (ignored):%s",
+ (const char*)(attributes[i].getName()));
+ }
+ }
+ else
+ {
+ const Property& prop = (Property&)*pprop;
+ SDOXMLString propValue;
+
+ XSDPropertyInfo* pi = (XSDPropertyInfo*)((DASProperty*)&prop)->getDASValue("XMLDAS::PropertyInfo");
+ if (pi && pi->getPropertyDefinition().isElement)
+ {
+ // xml instance is trying to set an attribute when schema defines property as element
+ LOGERROR_1(WARNING,"SDOSAX2Parser: Attribute %s should be an element. Attribute ignored",
+ (const char*)(attributes[i].getName()));
+ continue;
+ }
+
+ if (pi && pi->getPropertyDefinition().isQName)
+ {
+ XMLQName qname(attributes[i].getValue(),
+ documentNamespaces, namespaces);
+ propValue = qname.getSDOName();
+ }
+ else
+ {
+ propValue = attributes[i].getValue();
+ }
+
+ if ((pi && pi->getPropertyDefinition().isIDREF)
+ || prop.isReference())
+ {
+ // remember this value to resolve later
+ IDRef ref(currentDataObject, attributes[i].getName(), propValue);
+ IDRefs.push_back(ref);
+ }
+ else
+ {
+ if (pi && pi->getPropertyDefinition().isID)
+ {
+ // add this ID to the map
+ IDMap[propValue] = currentDataObject;
+ }
+ // Always set the property as a String. SDO will do the conversion
+ currentDataObject->setCString((const char*)attributes[i].getName(), propValue);
+ }
+ }
+ }
+ catch (const SDOPropertyNotFoundException&)
+ {
+ LOGERROR_1(WARNING,"SDOSAX2Parser: Error processing attribute (ignored):%s",
+ (const char*)(attributes[i].getName()));
+ }
+ }
+ } // End iterate over attributes
+
+ LOGEXIT(INFO,"SDOSAX2Parser:setAttributes");
+
+ }
+
+
+ const PropertyImpl* SDOSAX2Parser::handleOpenType(
+ SDOXMLString& tns,
+ const SDOXMLString& localname,
+ DataObjectImpl* dob,
+ const SAX2Namespaces& namespaces,
+ const SAX2Attributes& attributes,
+ SDOXMLString& xsitypeURI,
+ SDOXMLString& xsitypeName,
+ bool bToBeNull)
+ {
+ // first, see if there is a global element or attribute corresponding...
+ const PropertyImpl* pprop;
+ DataObjectPtr newDO = 0;
+ try
+ {
+ const TypeImpl* ti = 0;
+ const PropertyImpl* prop = 0;
+ SDOXMLString propertyName;
+
+ ti = dataFactory->findTypeImpl(tns,"RootType");
+ if (ti != 0)
+ {
+ propertyName = getSDOName((Type&)*ti, localname);
+ prop = ti->getPropertyImpl(propertyName);
+ }
+ else
+ {
+ propertyName = localname;
+ }
+
+ if (prop != 0)
+ {
+ if (prop->isMany())
+ {
+ pprop = ((DataObjectImpl*)dob)->defineList(propertyName);
+
+ // the type of the list needs to be set, as chars sets a CString
+ try
+ {
+ DataObjectList& dl = ((DataObjectImpl*)dob)->getList((const char*)propertyName);
+ ((DataObjectListImpl*)&dl)->setType(prop->getType().getURI(),
+ prop->getType().getName());
+ }
+ catch (SDORuntimeException)
+ {
+ // let it pass - the type will be Bytes
+ }
+
+ if (prop->getType().isDataType())
+ {
+ currentPropertySetting = PropertySetting(currentDataObject, propertyName,
+ bToBeNull);
+ }
+ else
+ {
+ newDO = dataFactory->create(
+ prop->getType().getURI(),
+ prop->getType().getName());
+ // here we need to use the sequence interface if it exists.
+ if (dob->getType().isSequencedType())
+ {
+ SequencePtr seq = currentPropertySetting.dataObject->getSequence();
+ seq->addDataObject(propertyName,newDO);
+ }
+ else
+ {
+ DataObjectList& dol = dob->getList((const char*)propertyName);
+ dol.append(newDO);
+ }
+ setCurrentDataObject(newDO);
+ setAttributes(tns, namespaces,attributes);
+ }
+ return pprop;
+ }
+ else
+ {
+ switch (prop->getTypeEnum())
+ {
+ case Type::BooleanType:
+ pprop = ((DataObjectImpl*)dob)->defineBoolean((const char*)propertyName);
+ currentPropertySetting = PropertySetting(currentDataObject, propertyName,
+ bToBeNull);
+ break;
+ case Type::ByteType:
+ pprop = ((DataObjectImpl*)dob)->defineByte((const char*)propertyName);
+ currentPropertySetting = PropertySetting(currentDataObject, propertyName,
+ bToBeNull);
+ break;
+ case Type::CharacterType:
+ pprop = ((DataObjectImpl*)dob)->defineCharacter(propertyName);
+ currentPropertySetting = PropertySetting(currentDataObject, propertyName,
+ bToBeNull);
+ break;
+ case Type::BytesType:
+ pprop = ((DataObjectImpl*)dob)->defineBytes(propertyName);
+ currentPropertySetting = PropertySetting(currentDataObject, propertyName,
+ bToBeNull);
+ break;
+ case Type::StringType:
+ pprop = ((DataObjectImpl*)dob)->defineString(propertyName);
+ currentPropertySetting = PropertySetting(currentDataObject, propertyName,
+ bToBeNull);
+ break;
+ case Type::ShortType:
+ pprop = ((DataObjectImpl*)dob)->defineShort(propertyName);
+ currentPropertySetting = PropertySetting(currentDataObject, propertyName,
+ bToBeNull);
+ break;
+ case Type::IntType:
+ pprop = ((DataObjectImpl*)dob)->defineInt(propertyName);
+ currentPropertySetting = PropertySetting(currentDataObject, propertyName,
+ bToBeNull);
+ break;
+ case Type::LongType:
+ pprop = ((DataObjectImpl*)dob)->defineLong(propertyName);
+ currentPropertySetting = PropertySetting(currentDataObject, propertyName,
+ bToBeNull);
+ break;
+ case Type::DoubleType:
+ pprop = ((DataObjectImpl*)dob)->defineDouble(propertyName);
+ currentPropertySetting = PropertySetting(currentDataObject, propertyName,
+ bToBeNull);
+ break;
+ case Type::FloatType:
+ pprop = ((DataObjectImpl*)dob)->defineFloat(propertyName);
+ currentPropertySetting = PropertySetting(currentDataObject, propertyName,
+ bToBeNull);
+ break;
+ case Type::DateType:
+ pprop = ((DataObjectImpl*)dob)->defineDate(propertyName);
+ currentPropertySetting = PropertySetting(currentDataObject, propertyName,
+ bToBeNull);
+ break;
+ case Type::DataObjectType:
+ pprop = ((DataObjectImpl*)dob)->defineDataObject(propertyName,
+ prop->getType().getURI(), prop->getType().getName());
+ newDO = dataFactory->create(
+ prop->getType().getURI(),
+ prop->getType().getName());
+ // here we need to use the sequence interface if it exists.
+ if (dob->getType().isSequencedType())
+ {
+ SequencePtr seq = dob->getSequence();
+ seq->addDataObject(propertyName, newDO);
+ }
+ else
+ {
+ dob->setDataObject((const char*)propertyName, newDO);
+ }
+ setCurrentDataObject(newDO);
+ setAttributes(tns,namespaces,attributes);
+ break;
+ }
+ } // else
+ } // if prop != 0
+ else
+ {
+ // The type is open, and the property doesnt exist, so we are creating
+ // a property, and need to find out the type to create.
+ // As I cannot tell if its a single value or many valued, I create all
+ // as many valued
+ // could be data object or primitive. All primitives will appear
+ // as bytes.
+ // UPDATE: Spec says that all elements will appear as DataObjects which
+ // are sequenced - the text will come out as text elements in the sequence
+
+ if (!xsitypeName.isNull())
+ {
+ // it has a type from xsi:type
+ newDO = dataFactory->create((const char*)xsitypeURI, (const char*)xsitypeName);
+ }
+ else
+ {
+ newDO = dataFactory->create(SDOUtils::sdoURI, "OpenDataObject");
+ }
+ pprop = ((DataObjectImpl*)dob)->defineList(propertyName);
+ // here we need to use the sequence interface if it exists.
+ if (dob->getType().isSequencedType())
+ {
+ SequencePtr seq = dob->getSequence();
+ seq->addDataObject(propertyName, newDO);
+ }
+ else
+ {
+ DataObjectList& dol = dob->getList((const char*)propertyName);
+ dol.append(newDO);
+ }
+ setCurrentDataObject(newDO);
+ setAttributes(tns,namespaces,attributes);
+ }
+ return pprop;
+ }
+ catch (SDORuntimeException)
+ {
+ // fail to find the property or create a dummy
+ return 0;
+ }
+ }
+
+ void SDOSAX2Parser::startElementNs(
+ const SDOXMLString& localname,
+ const SDOXMLString& prefix,
+ const SDOXMLString& URI,
+ const SAX2Namespaces& namespaces,
+ const SAX2Attributes& attributes)
+
+ {
+ LOGENTRY(INFO,"SDOSAX2Parser: startElementNs");
+
+ LOGINFO_1(INFO,"SDOSAX2Parser: startElementNs:%s",
+ (const char*)localname);
+
+ newSequence = true;
+
+ bool bToBeNull = false;
+ // Save the namespace information from the first element
+ if (setNamespaces)
+ {
+ documentNamespaces = namespaces;
+ setNamespaces = false;
+ }
+ else
+ {
+ documentNamespaces.merge(namespaces);
+ }
+
+ if (ignoreEvents)
+ {
+ // Check for the tag we are waiting for
+ if ( (ignoreTag.localname.equals(localname))
+ && (ignoreTag.uri.equals(URI))
+ && (ignoreTag.prefix.equals(prefix)) )
+ {
+ ignoreTag.tagCount++;
+ }
+ LOGEXIT(INFO,"SDOSAX2Parser: startElementNs - exit1");
+ return;
+ }
+
+ if (URI.equalsIgnoreCase("http://www.w3.org/2001/XMLSchema"))
+ {
+ // ignore anything within a schema
+ LOGINFO_1(INFO,"SDOSAX2Parser ignores schema element:%s",
+ (const char *)localname);
+
+ // We need to ignore all events until the end tag for this element
+ ignoreEvents = true;
+ ignoreTag.localname = localname;
+ ignoreTag.uri = URI;
+ ignoreTag.prefix = prefix;
+ ignoreTag.tagCount = 0;
+ return;
+ }
+
+
+
+ if (dealingWithChangeSummary)
+ {
+ if (csbuilder == 0)
+ {
+ LOGERROR(ERROR,"SDOSAX2Parser:Parser builds summary with no builder");
+ LOGEXIT(INFO,"SDOSAX2Parser: startElementNs - exit2");
+ return;
+ }
+ csbuilder->processStart(
+ localname,
+ prefix,
+ URI,
+ namespaces,
+ attributes);
+ LOGEXIT(INFO,"SDOSAX2Parser: startElementNs - exit3");
+ return;
+ }
+
+
+ if (URI.equalsIgnoreCase(SDOUtils::sdoURI))
+ {
+ ///////////////////////////////////////////////////////////////////////
+ // Handle datagraph
+ ///////////////////////////////////////////////////////////////////////
+ if (localname.equalsIgnoreCase("datagraph"))
+ {
+ // Remember this is a datagraph. The root DO will be created
+ // later when we can have a better guess at the namespaceURI
+ isDataGraph = true;
+ } // end handling sdo:datagraph
+
+ ////////////////////////////////////
+ // Handle ChangeSummary on datagraph
+ ////////////////////////////////////
+ if (localname.equals("changeSummary"))
+ {
+ changeSummary = true;
+ changeSummaryDO = currentDataObject;
+
+ csbuilder = new ChangeSummaryBuilder(
+ dataFactory, rootDataObject );
+
+ changeSummaryLogging = true;
+
+
+ SDOXMLString logging = attributes.getValue("logging");
+ if (!logging.isNull())
+ {
+ if (logging.equals("false"))
+ {
+ changeSummaryLogging = false;
+ }
+ }
+
+ LOGINFO(INFO,"SDOSAX2Parser:Start change summary");
+ dealingWithChangeSummary = true;
+ LOGEXIT(INFO,"SDOSAX2Parser: startElementNs - exit4");
+ return;
+
+ }
+
+ }
+ else
+ {
+ ///////////////////////////////////////////////////////////////////////
+ // Each element is a DataObject or a Property on the current DO
+ ///////////////////////////////////////////////////////////////////////
+ DataObjectPtr newDO = 0;
+
+ SDOXMLString typeURI, typeName, propertyName;
+
+ ///////////////////////////////////////////////////////////////////////
+ // Determine the type. It is either specified by the xsi:type attribute
+ // or the localname is the name of a property on "RootType"
+ ///////////////////////////////////////////////////////////////////////
+ int i;
+ for (i=0; i < attributes.size(); i++)
+ {
+ if (attributes[i].getUri().equalsIgnoreCase("http://www.w3.org/2001/XMLSchema-instance"))
+ {
+ if (attributes[i].getName().equalsIgnoreCase("type"))
+ {
+ SDOXMLString fullTypeName = attributes[i].getValue();
+ SDOXMLString pref;
+
+ int index = fullTypeName.firstIndexOf(':');
+ if (index < 0)
+ {
+ typeName = fullTypeName;
+ }
+ else
+ {
+ // Is the namespace prefix defined?
+ typeName = fullTypeName.substring(index+1);
+ pref = fullTypeName.substring(0, index);
+ }
+
+ // Convert the prefix to a namespace URI
+ const SDOXMLString* namespaceURI = namespaces.find(pref);
+ if (namespaceURI == 0)
+ {
+ namespaceURI = documentNamespaces.find(pref);
+ }
+ if (namespaceURI != 0)
+ {
+ typeURI = *namespaceURI;
+ }
+ }
+ else if (attributes[i].getName().equalsIgnoreCase("nil"))
+ {
+ if (attributes[i].getValue().equalsIgnoreCase("true"))
+ {
+ // the current setting needs to be setNull
+ bToBeNull = true;
+ }
+ }
+ }
+ } // End - attribute loop
+
+ if (typeURI.isNull())
+ {
+ typeURI = "";
+ }
+
+ SDOXMLString tns = URI;
+
+ if (tns.isNull())
+ tns = "";
+
+ try
+ {
+ if (currentDataObject == 0)
+ {
+ // This element should become the root data object
+
+ // Target namespace will be:
+ // the targetNamespaceURI if specified
+ // or the URI of xsi:type if specified
+ // or the URI of this element
+ if (!typeURI.equals(""))
+ {
+ tns = typeURI;
+ }
+
+ if (!targetNamespaceURI.isNull() && !targetNamespaceURI.equals(""))
+ {
+ tns = targetNamespaceURI;
+ rootElementURI = tns;
+ }
+ else
+ {
+ rootElementURI = URI;
+ }
+
+ // Check for localname as a property of the RootType
+ // if we do not already know the type
+ if (typeName.isNull())
+ {
+ try {
+ const Type& rootType = dataFactory->getType(tns, "RootType");
+ propertyName = getSDOName(rootType, localname);
+ const Type& newType =
+ ((TypeImpl&)(rootType)).getRealPropertyType(propertyName);
+
+ typeURI = newType.getURI();
+ typeName = newType.getName();
+ }
+ catch (const SDOTypeNotFoundException&)
+ {
+ typeURI = SDOUtils::sdoURI;
+ typeName = "OpenDataObject";
+ }
+ }
+
+ // Create the root DataObject
+ if (isDataGraph)
+ {
+ DataObjectPtr rootdo = dataFactory->create(tns, "RootType");
+ setCurrentDataObject(rootdo);
+ changeSummaryDO = currentDataObject;
+ }
+ else
+ {
+ rootElementName = localname;
+ }
+
+ // NOTE: always creating DO doesn't cater for DataType as top element
+
+ const Type& tp = dataFactory->getType((const char*)typeURI,typeName);
+ if (tp.isDataType())
+ {
+ newDO = dataFactory->create(tns, "RootType");
+ currentPropertySetting = PropertySetting(newDO, localname,
+ bToBeNull);
+
+ // TODO - need instead to record the fact that its a primitive, not
+ // a real DO - and then present it as the root.
+ // newDO = dataFactory->create(tns, "RootType");
+ // const Type& tpr = dataFactory->getType(tns,"RootType");
+ // XSDTypeInfo* typeInfo = (XSDTypeInfo*)
+ // ((DASType*)&tpr)->getDASValue("XMLDAS::TypeInfo");
+ // if (typeInfo)
+ // {
+ // TypeDefinitionImpl* td;
+ // td = (TypeDefinitionImpl*)&(typeInfo->getTypeDefinition());
+ // if (td)td->isExtendedPrimitive = true;
+ // currentPropertySetting = PropertySetting(newDO, "value" /*localname*/,
+ // bToBeNull);
+
+ // }
+ // else
+ // {
+ // currentPropertySetting = PropertySetting(newDO, localname,
+ // bToBeNull);
+ // }
+
+ }
+ else
+ {
+
+ newDO = dataFactory->create((const char*)typeURI, (const char*)typeName);
+
+ // get the type definition, and see if its an extended primitive.
+
+ XSDTypeInfo* typeInfo = (XSDTypeInfo*)
+ ((DASType*)&tp)->getDASValue("XMLDAS::TypeInfo");
+ if (typeInfo)
+ {
+ const TypeDefinitionImpl& typeDefinition = typeInfo->getTypeDefinition();
+ if (typeDefinition.isExtendedPrimitive)
+ {
+ // The name of this element is the name of a property on the current DO
+ currentPropertySetting = PropertySetting(newDO, localname,
+ bToBeNull);
+ }
+ }
+ }
+
+ } // End - currentDataObject == 0
+
+ else
+ { // currentDataObject != 0
+
+ // Get the Property from the dataObject
+ propertyName = getSDOName(*currentDataObjectType, localname);
+ const Type& type = currentDataObject->getType();
+
+
+ // go lower level so we can find open properties w/o exception
+ DataObject* dob = getRawPointer(currentDataObject);
+ const PropertyImpl* pprop = ((DataObjectImpl*)dob)->getPropertyImpl(propertyName);
+ if (pprop == 0)
+ {
+ if (type.isOpenType())
+ {
+ pprop = handleOpenType(
+ tns,
+ localname,
+ (DataObjectImpl*)dob,
+ namespaces,
+ attributes,
+ typeURI,
+ typeName,
+ bToBeNull);
+ }
+ if (pprop == 0)
+ {
+ // this is an open property , we will need to create it
+ LOGERROR_1(WARNING,"SDOSAX2Parser Unknown element:%s",
+ (const char *)localname);
+
+ // We need to ignore all events until the end tag for this element
+ ignoreEvents = true;
+ ignoreTag.localname = localname;
+ ignoreTag.uri = URI;
+ ignoreTag.prefix = prefix;
+ ignoreTag.tagCount = 0;
+ if (setter != 0)
+ {
+ char *msg = new char[strlen((const char*)localname) + 32];
+ if (msg) {
+ sprintf(msg,"Parser found unknown element %s",
+ (const char*)localname);
+ setter->setError( msg );
+ delete[] msg;
+ }
+ }
+ }
+ LOGEXIT(INFO,"SDOSAX2Parser: startElementNs - exit5");
+ return;
+ }
+ else
+ {
+
+ const Property& prop = (Property&)*pprop;
+ const TypeImpl* propType = ((TypeImpl&)type).getRealPropertyTypeImpl(propertyName);
+ if (propType == 0)
+ {
+ // could be a previously created open type property
+ propType = (const TypeImpl*)pprop->getTypeImpl();
+ }
+ if (propType != 0)
+ {
+ XSDPropertyInfo* pi = (XSDPropertyInfo*)((DASProperty*)&prop)->getDASValue("XMLDAS::PropertyInfo");
+ if ((pi && pi->getPropertyDefinition().isIDREF)
+ || prop.isReference())
+ {
+ // The name of this element is the name of a property on the current DO
+ currentPropertySetting = PropertySetting(currentDataObject, propertyName, bToBeNull,
+ true);
+ }
+
+ // If it is a DataType then we need set the value
+ else if (propType->isDataType() )
+ {
+ // The name of this element is the name of a property on the current DO
+ currentPropertySetting = PropertySetting(currentDataObject, propertyName,
+ bToBeNull);
+ }
+ else
+ {
+
+ // If typeName is not set then create object of Type of Property
+ // otherwise use the typeURI and typeName specified by e.g. xsi:type
+ if (typeName.isNull())
+ {
+ newDO = dataFactory->create(propType->getURI(), propType->getName());
+ }
+ else
+ {
+ newDO = dataFactory->create((const char*)typeURI, (const char*)typeName);
+ }
+
+ XSDTypeInfo* typeInfo = (XSDTypeInfo*)
+ ((DASType*)propType)->getDASValue("XMLDAS::TypeInfo");
+ if (typeInfo && typeInfo->getTypeDefinition().isExtendedPrimitive)
+ {
+ // The name of this element is the name of a property on the current DO
+ currentPropertySetting = PropertySetting(newDO, "value", bToBeNull);
+ }
+
+ }
+ }
+ } // End // currentDataObject != 0
+ } // end prop != 0
+ if (newDO)
+ {
+ if (!setDO(newDO, propertyName))
+ {
+ LOGERROR_1(WARNING,"SDOSAX2Parser Unknown element:%s",
+ (const char *)localname);
+
+ // We need to ignore all events until the end tag for this element
+ ignoreEvents = true;
+ ignoreTag.localname = localname;
+ ignoreTag.uri = URI;
+ ignoreTag.prefix = prefix;
+ ignoreTag.tagCount = 0;
+ if (setter != 0)
+ {
+ char *msg = new char[strlen((const char*)localname) + 32];
+ if (msg) {
+ sprintf(msg,"Parser found unknown element %s",
+ (const char*)localname);
+ setter->setError( msg );
+ delete msg;
+ }
+ }
+ LOGEXIT(INFO,"SDOSAX2Parser: startElementNs - exit6");
+ return;
+ }
+ }
+ } // end try
+
+ catch (const SDOTypeNotFoundException& )
+ {
+
+ LOGERROR_1(WARNING,"SDOSAX2Parser Unknown element:%s",
+ (const char *)localname);
+
+ // We need to ignore all events until the end tag for this element
+ ignoreEvents = true;
+ ignoreTag.localname = localname;
+ ignoreTag.uri = URI;
+ ignoreTag.prefix = prefix;
+ ignoreTag.tagCount = 0;
+ if (setter != 0)
+ {
+ char *msg = new char[strlen((const char*)localname) + 32];
+ if (msg) {
+ sprintf(msg,"Parser found unknown element %s",
+ (const char*)localname);
+ setter->setError( msg );
+ delete[] msg;
+ }
+ }
+ LOGEXIT(INFO,"SDOSAX2Parser: startElementNs - exit7");
+ return;
+ }
+
+#ifdef _DEBUG
+ catch (const SDOPropertyNotFoundException& e )
+#else
+ catch (const SDOPropertyNotFoundException& )
+#endif
+ {
+ LOGERROR_1(WARNING,"SDOSAX2Parser Unknown element exception:%s",
+ (const char *)localname);
+ LOGSDOEXCEPTION(WARNING,"Exception:",e);
+
+ // We need to ignore all events until the end tag for this element
+ ignoreEvents = true;
+ ignoreTag.localname = localname;
+ ignoreTag.uri = URI;
+ ignoreTag.prefix = prefix;
+ ignoreTag.tagCount = 0;
+ if (setter != 0)
+ {
+ char *msg = new char[strlen((const char*)localname) + 32];
+ if (msg)
+ {
+ sprintf(msg,"Parser found unknown element %s",
+ (const char*)localname);
+ setter->setError( msg );
+ delete msg;
+ }
+ }
+ LOGEXIT(INFO,"SDOSAX2Parser: startElementNs - exit8");
+ return;
+ }
+
+ setAttributes(tns,namespaces, attributes);
+
+ }
+ LOGEXIT(INFO,"SDOSAX2Parser: startElementNs - exit9");
+ }
+
+
+ void SDOSAX2Parser::endElementNs(
+ const SDOXMLString& localname,
+ const SDOXMLString& prefix,
+ const SDOXMLString& URI)
+ {
+
+ LOGENTRY(INFO,"SDOSAX2Parser: endElementNs");
+
+ newSequence = true;
+
+ if (localname.equals("changeSummary"))
+ {
+ // end of change summary
+ dealingWithChangeSummary = false;
+ LOGINFO(INFO,"SDOSAX2Parser: Finished change summary");
+ LOGEXIT(INFO,"SDOSAX2Parser: endElementNs - exit1");
+ return;
+ }
+
+ if (dealingWithChangeSummary)
+
+ {
+ if (csbuilder == 0)
+ {
+ LOGERROR(WARNING,"SDOSAX2Parser: End change summary with no builder");
+ LOGEXIT(INFO,"SDOSAX2Parser: endElementNs - exit2");
+ return;
+ }
+ csbuilder->processEnd(localname,
+ prefix,
+ URI);
+ LOGEXIT(INFO,"SDOSAX2Parser: endElementNs - exit3");
+ return;
+ }
+
+
+ if (ignoreEvents)
+ {
+ // Check for the tag we are waiting for
+ if ( (ignoreTag.localname.equals(localname))
+ && (ignoreTag.uri.equals(URI))
+ && (ignoreTag.prefix.equals(prefix)) )
+ {
+ if (ignoreTag.tagCount == 0)
+ {
+ ignoreEvents = false;
+ }
+ ignoreTag.tagCount--;
+ }
+ LOGEXIT(INFO,"SDOSAX2Parser: endElementNs - exit4");
+ return;
+ }
+
+ // If currentPropertySetting is set (name is not null)
+ // then we need to set the property now
+ if (!currentPropertySetting.name.isNull())
+ {
+ if (currentPropertySetting.isNULL)
+ {
+
+ currentPropertySetting.dataObject->
+ setNull((const char*)currentPropertySetting.name);
+
+ }
+ else
+ {
+ if (currentPropertySetting.value.isNull())
+ {
+ currentPropertySetting.value = SDOXMLString("");
+ }
+ try
+ {
+ const Type& tp = currentPropertySetting.dataObject->getType();
+ XSDTypeInfo* typeInfo = (XSDTypeInfo*)
+ ((DASType*)&tp)->getDASValue("XMLDAS::TypeInfo");
+ if (typeInfo && typeInfo->getTypeDefinition().isExtendedPrimitive)
+ {
+ PropertyPtr p = currentPropertySetting.dataObject->getInstanceProperty(
+ "value");
+ if (!p) {
+ throw SDOPropertyNotFoundException(TUSCANY_SDO_EINFO,
+ "Cannot find property: value");
+ }
+ if (p->isMany())
+ {
+ // use the sequence interface if it exists.
+ if (currentPropertySetting.dataObject->getType().isSequencedType())
+ {
+ SequencePtr seq = currentPropertySetting.dataObject->getSequence();
+ seq->addCString("value", currentPropertySetting.getStringWithCDataMarkers().c_str());
+ }
+ else
+ {
+ DataObjectList& dl = currentPropertySetting.dataObject->
+ getList((const char*)"value");
+ dl.append((const char*)currentPropertySetting.getStringWithCDataMarkers().c_str());
+ }
+
+ }
+ else
+ {
+ // use the sequence interface if it exists
+ if (currentPropertySetting.dataObject->getType().isSequencedType())
+ {
+ SequencePtr seq = currentPropertySetting.dataObject->getSequence();
+ seq->addCString("value", currentPropertySetting.getStringWithCDataMarkers().c_str());
+ }
+ else
+ {
+ currentPropertySetting.dataObject->
+// setCString((const char*)"value", currentPropertySetting.value );
+ setCString((const char*)"value", currentPropertySetting.getStringWithCDataMarkers().c_str() );
+ }
+ }
+ if (dataObjectStack.size() == 0 || rootDataObject == dataObjectStack.top())
+ {
+ currentDataObject = 0;
+ currentDataObjectType = 0;
+ }
+ else
+ {
+ dataObjectStack.pop();
+ currentDataObject = dataObjectStack.top();
+ currentDataObjectType = &(currentDataObject->getType());
+ }
+
+ }
+ else
+ {
+ if (currentPropertySetting.isIDREF)
+ {
+ // remember this value to resolve later
+ IDRef ref(currentPropertySetting.dataObject,
+ currentPropertySetting.name,
+ currentPropertySetting.value );
+ IDRefs.push_back(ref);
+ }
+ else
+ {
+ if (currentPropertySetting.dataObject->getType().isSequencedType())
+ {
+ SequencePtr seq = currentPropertySetting.dataObject->getSequence();
+ seq->addCString(currentPropertySetting.name, currentPropertySetting.getStringWithCDataMarkers().c_str());
+ }
+ // Always set the property as a String. SDO will do the conversion
+
+ // It might be a single setting for a many-valued property.
+ // may throw SDOPropertyNotFoundException
+ else {
+ PropertyPtr p = currentPropertySetting.dataObject->getInstanceProperty(
+ (const char*)currentPropertySetting.name);
+ if (!p) {
+ SDOString msg("Cannot find property: ");
+ msg += (const char*)currentPropertySetting.name;
+ throw SDOPropertyNotFoundException(TUSCANY_SDO_EINFO,
+ msg.c_str());
+ }
+ if (p->isMany())
+ {
+ DataObjectList& dl = currentPropertySetting.dataObject->
+ getList(*p);
+ dl.append((const char*)currentPropertySetting.getStringWithCDataMarkers().c_str());
+ }
+ else
+ {
+ currentPropertySetting.dataObject->
+ setCString(*p, currentPropertySetting.getStringWithCDataMarkers().c_str() );
+ }
+ }
+ }
+ }
+ }
+#ifdef _DEBUG
+ catch (const SDOPropertyNotFoundException& e)
+#else
+ catch (const SDOPropertyNotFoundException&)
+#endif
+ {
+ LOGSDOEXCEPTION(WARNING,"SDOSAX2Parser error attribute (ignored)",e);
+ }
+ }
+ currentPropertySetting = PropertySetting();
+
+ }
+ else
+ {
+ if (changeSummary
+ && changeSummaryLogging
+ && changeSummaryDO == currentDataObject)
+ {
+ // Set logging on for this DO before it is popped from stack
+ ChangeSummaryPtr cs = currentDataObject->getChangeSummary();
+ if (cs)
+ {
+ cs->beginLogging();
+ }
+ changeSummary = false;
+ }
+
+ if (dataObjectStack.size() == 0 || rootDataObject == dataObjectStack.top())
+ {
+ currentDataObject = 0;
+ currentDataObjectType = 0;
+ }
+ else
+ {
+ dataObjectStack.pop();
+ currentDataObject = dataObjectStack.top();
+ currentDataObjectType = &(currentDataObject->getType());
+ }
+ }
+ LOGEXIT(INFO,"SDOSAX2Parser: endElementNs - exit4");
+ }
+
+
+
+ void SDOSAX2Parser::characters(const SDOXMLString& chars)
+ {
+ if (chars.isNull()) return;
+
+ if (!strcmp((const char*)chars,"\r") ||
+ !strcmp((const char*)chars,"\n"))
+ {
+ newSequence = true;
+ return;
+ }
+
+ if (dealingWithChangeSummary)
+ {
+ if (csbuilder == 0)
+ {
+ LOGERROR(WARNING,"SDOSAX2Parser: no builder");
+ return;
+ }
+ csbuilder->processChars(chars);
+ return;
+ }
+
+ if (ignoreEvents)
+ return;
+
+ if (!currentPropertySetting.name.isNull())
+ {
+ currentPropertySetting.value = currentPropertySetting.value + chars;
+ return;
+ }
+ DataObject* dob = getRawPointer(currentDataObject);
+ if ((dob != 0) && ((DataObjectImpl*)dob)->getTypeImpl().isFromList())
+ {
+ // this is a list,so we need to split it up
+ DataObjectList& dl = currentDataObject->getList(
+ (const char *)"values");
+
+ const char* str = (const char*)chars;
+
+ // Convert any synthetic CDATA markers back to the real thing
+ SDOString valueString(str);
+ SDOString tmpString = SDOUtils::replace(valueString, SDOUtils::CDataStartMarker, SDOUtils::XMLCDataStartMarker);
+ tmpString = SDOUtils::replace(tmpString, SDOUtils::CDataEndMarker, SDOUtils::XMLCDataEndMarker);
+ str = (const char*)tmpString.c_str();
+
+ char* buf = new char[strlen(str)+1];
+ if (!buf) return;
+
+ strcpy(buf,str);
+
+ int start_point = 0;
+ int end_point;
+ int final = strlen(buf);
+
+ do {
+ if (start_point >= final)break;
+ while (buf[start_point] == (char)0x20 || buf[start_point] == (char)0x09
+ || buf[start_point] == (char)0x0A || buf[start_point] == (char)0x0D )start_point++;
+ end_point = start_point;
+ while (buf[end_point] != (char)0x20 && buf[end_point] != (char)0x09 &&
+ buf[end_point] != (char)0x0A && buf[end_point] != (char)0x0D &&
+ buf[end_point] != 0x0)end_point++;
+ if (end_point == start_point)break;
+ *(buf+end_point) = 0;
+ dl.append((const char*)(buf+start_point));
+ start_point = end_point + 1;
+ } while(1);
+
+ delete[] buf;
+ return;
+ }
+
+
+ // If the current DataObject is a sequenced Type
+ // then add this as text to the sequence
+ if (currentDataObject && currentDataObjectType->isSequencedType())
+ {
+ // Convert any synthetic CDATA markers back to the real thing
+ const char* str = (const char*)chars;
+
+ SDOString valueString(str);
+ SDOString tmpString = SDOUtils::replace(valueString, SDOUtils::CDataStartMarker, SDOUtils::XMLCDataStartMarker);
+ tmpString = SDOUtils::replace(tmpString, SDOUtils::CDataEndMarker, SDOUtils::XMLCDataEndMarker);
+ str = tmpString.c_str();
+
+ SequencePtr seq = currentDataObject->getSequence();
+ if (seq)
+ {
+ if (newSequence == true)
+ {
+ seq->addText(str);
+ newSequence = false;
+ }
+ else
+ {
+ for (int k= (int)(seq->size())-1; k>=0 ; k --)
+ {
+ if (seq->isText(k))
+ {
+ const char * s = seq->getCStringValue(k);
+
+ if (s)
+ {
+ char *combi =
+ new char[strlen(s)+strlen(str) + 2];
+ strcpy(combi,s);
+ strcat(combi,str);
+ seq->setText(k,(const char*)combi);
+ delete[] combi;
+ }
+ else
+ {
+ seq->setText(k,str);
+ }
+ return;
+ }
+ }
+ seq->addText(str);
+ }
+ return;
+ }
+ }
+
+ }
+
+
+ void SDOSAX2Parser::setCurrentDataObject(DataObjectPtr currentDO)
+ {
+ currentDataObject = currentDO;
+ dataObjectStack.push(currentDataObject);
+ currentDataObjectType = &(currentDataObject->getType());
+ if (rootDataObject == 0)
+ {
+ rootDataObject = currentDataObject;
+ }
+ }
+
+ const SDOXMLString& SDOSAX2Parser::getSDOName(const Type& type, const SDOXMLString& localName)
+ {
+
+/* XSDTypeInfo* typeInfo = (XSDTypeInfo*)((DASType*)&type)->getDASValue("XMLDAS::TypeInfo");
+ if (typeInfo)
+ {
+ const TypeDefinitionImpl& typeDefinition = typeInfo->getTypeDefinition();
+ XmlDasPropertyDefs::const_iterator propsIter;
+ for (propsIter = typeDefinition.properties.begin(); propsIter != typeDefinition.properties.end(); propsIter++)
+ {
+ const PropertyDefinitionImpl& prop = *propsIter;
+ if (prop.localname.equals(localName))
+ {
+ return prop.name;
+ }
+ for (int i=0;i< prop.substituteNames.size();i++)
+ {
+ if (prop.substituteLocalNames[i].equals(localName))
+ {
+ return prop.substituteNames[i];
+ // possibly should be return prop.name;
+ }
+ }
+ }
+ }
+ */
+
+ const TypeImpl& typeImpl = dynamic_cast<const TypeImpl&>(type);
+ const std::vector<PropertyImplPtr> pl = typeImpl.getPropertyListReference();
+
+ for (std::vector<PropertyImplPtr>::const_iterator i = pl.begin();
+ i != pl.end();
+ i++)
+ {
+ XSDPropertyInfo* pi = (XSDPropertyInfo*)
+ ((DASProperty*) getRawPointer(*i))->getDASValue("XMLDAS::PropertyInfo");
+
+ if (pi)
+ {
+ const PropertyDefinitionImpl& propdef = pi->getPropertyDefinition();
+ if (localName .equals(propdef.localname))
+ return propdef.name;
+
+ for (unsigned int j=0;j< propdef.substituteNames.size();j++)
+ {
+ if (propdef.substituteLocalNames[j].equals(localName))
+ {
+ return propdef.substituteNames[j];
+ // possibly should be return propdef.name;
+ }
+ }
+ }
+ }
+
+
+
+ return localName;
+ }
+
+
+ std::istream& operator>>(std::istream& input, SDOSAX2Parser& parser)
+ {
+ parser.stream(input);
+
+ return input;
+ }
+
+ std::istringstream& operator>>(std::istringstream& input, SDOSAX2Parser& parser)
+ {
+ parser.stream(input);
+
+ return input;
+ }
+
+ } // End - namespace sdo
+} // End - namespace commonj
+
diff --git a/sdo-cpp/trunk/runtime/core/src/commonj/sdo/SDOSAX2Parser.h b/sdo-cpp/trunk/runtime/core/src/commonj/sdo/SDOSAX2Parser.h
new file mode 100644
index 0000000000..e447faff6e
--- /dev/null
+++ b/sdo-cpp/trunk/runtime/core/src/commonj/sdo/SDOSAX2Parser.h
@@ -0,0 +1,179 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you 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$ */
+
+#ifndef _SDOSAX2PARSER_H_
+#define _SDOSAX2PARSER_H_
+#include "commonj/sdo/disable_warn.h"
+
+#include "commonj/sdo/SAX2Parser.h"
+
+#include "commonj/sdo/DataFactory.h"
+#include "commonj/sdo/DataObject.h"
+#include "commonj/sdo/SAX2Namespaces.h"
+#include "commonj/sdo/PropertySetting.h"
+#include "commonj/sdo/ChangeSummaryImpl.h"
+#include "commonj/sdo/ChangeSummaryBuilder.h"
+
+
+#include <stack>
+
+namespace commonj
+{
+ namespace sdo
+ {
+
+
+/**
+ * SDOSAX2Parser implements SAX2Parser.
+ * This class gets called back by the libxml library, and
+ * deals with the creation of data objects from XML.
+ */
+
+ class SDOSAX2Parser : public SAX2Parser
+ {
+
+
+ public:
+
+
+ SDOSAX2Parser(
+ DataFactoryPtr df,
+ const SDOXMLString& targetNamespaceURI,
+ DataObjectPtr& rootDO,
+ ParserErrorSetter* insetter);
+
+ virtual ~SDOSAX2Parser();
+
+ virtual void startDocument();
+ virtual void endDocument();
+
+ virtual bool setDO(DataObjectPtr newDO,
+ SDOXMLString& propertyName);
+
+ virtual void setAttributes(
+ SDOXMLString& tns,
+ const SAX2Namespaces& namespaces,
+ const SAX2Attributes& attributes);
+
+ virtual void handleOpenAttribute(
+ SDOXMLString& tns,
+ const SDOXMLString& propuri,
+ const SDOXMLString& propname,
+ const SDOXMLString& value);
+
+ virtual const PropertyImpl* handleOpenType(
+ SDOXMLString& tns,
+ const SDOXMLString& localname,
+ DataObjectImpl* dob,
+ const SAX2Namespaces& namespaces,
+ const SAX2Attributes& attributes,
+ SDOXMLString& xsitypeURI,
+ SDOXMLString& xsitypeName,
+ bool bToBeNull);
+
+ virtual void startElementNs(
+ const SDOXMLString& localname,
+ const SDOXMLString& prefix,
+ const SDOXMLString& URI,
+ const SAX2Namespaces& namespaces,
+ const SAX2Attributes& attributes);
+
+ virtual void endElementNs(
+ const SDOXMLString& localname,
+ const SDOXMLString& prefix,
+ const SDOXMLString& URI);
+
+ virtual void characters(const SDOXMLString& chars);
+
+ friend std::istream& operator>>(std::istream& input, SDOSAX2Parser& parser);
+ friend std::istringstream& operator>>(std::istringstream& input, SDOSAX2Parser& parser);
+
+ void setRootElementName(const SDOXMLString& name);
+ const SDOXMLString& getRootElementName() const {return rootElementName;}
+ void setRootElementURI(const SDOXMLString& uri);
+ const SDOXMLString& getRootElementURI() const {return rootElementURI;}
+
+
+ private:
+ SDOXMLString targetNamespaceURI;
+ SDOXMLString rootElementName;
+ SDOXMLString rootElementURI;
+ DataFactoryImplPtr dataFactory;
+ DataObjectPtr& rootDataObject;
+
+
+ std::stack<DataObjectPtr> dataObjectStack;
+
+ DataObjectPtr currentDataObject;
+ bool isDataGraph;
+ bool newSequence;
+
+ void setCurrentDataObject(DataObjectPtr currentDO);
+ const Type* currentDataObjectType;
+ const SDOXMLString& getSDOName(const Type& type, const SDOXMLString& localName);
+
+ PropertySetting currentPropertySetting;
+
+ void reset();
+
+ bool setNamespaces;
+ SAX2Namespaces documentNamespaces;
+
+ bool changeSummary;
+ DataObjectPtr changeSummaryDO;
+ bool changeSummaryLogging;
+ bool dealingWithChangeSummary;
+ ChangeSummaryBuilder* csbuilder;
+
+ bool ignoreEvents;
+ struct ignoretag
+ {
+ SDOXMLString localname;
+ SDOXMLString uri;
+ SDOXMLString prefix;
+ int tagCount;
+ } ignoreTag;
+
+
+ typedef std::map<SDOXMLString, DataObjectPtr> ID_MAP;
+ ID_MAP IDMap;
+
+ class IDRef
+ {
+ public:
+ IDRef(DataObjectPtr dataobj,
+ const SDOXMLString& prop,
+ const SDOXMLString& val)
+ : dataObject(dataobj), property(prop), value(val)
+ {}
+
+ DataObjectPtr dataObject;
+ SDOXMLString property;
+ SDOXMLString value;
+ };
+
+ typedef std::list<IDRef> ID_REFS;
+ ID_REFS IDRefs;
+ };
+ } // End - namespace sdo
+} // End - namespace commonj
+
+#endif //_SDOSAX2PARSER_H_
diff --git a/sdo-cpp/trunk/runtime/core/src/commonj/sdo/SDOSPI.h b/sdo-cpp/trunk/runtime/core/src/commonj/sdo/SDOSPI.h
new file mode 100644
index 0000000000..011d112d2f
--- /dev/null
+++ b/sdo-cpp/trunk/runtime/core/src/commonj/sdo/SDOSPI.h
@@ -0,0 +1,27 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you 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$ */
+
+#include "commonj/sdo/DataFactory.h"
+#include "commonj/sdo/ChangeSummary.h"
+#include "commonj/sdo/DataObject.h"
+#include "commonj/sdo/SDO.h"
+
+#include "commonj/sdo/DASValues.h"
diff --git a/sdo-cpp/trunk/runtime/core/src/commonj/sdo/SDOSchemaSAX2Parser.cpp b/sdo-cpp/trunk/runtime/core/src/commonj/sdo/SDOSchemaSAX2Parser.cpp
new file mode 100644
index 0000000000..a36fffd1b9
--- /dev/null
+++ b/sdo-cpp/trunk/runtime/core/src/commonj/sdo/SDOSchemaSAX2Parser.cpp
@@ -0,0 +1,1434 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you 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$ */
+
+#include "libxml/uri.h"
+#include "commonj/sdo/SDOSchemaSAX2Parser.h"
+#include "commonj/sdo/XSDPropertyInfo.h"
+#include "commonj/sdo/XSDTypeInfo.h"
+#include "commonj/sdo/SDORuntimeException.h"
+#include "commonj/sdo/Logging.h"
+#include "commonj/sdo/SDOUtils.h"
+
+
+#include <stdio.h>
+
+extern "C" {
+ void sdo_error(void *ctx, const char *msg, ...);
+}
+
+namespace commonj
+{
+ namespace sdo
+ {
+
+ using internal::XSDTypeInfo;
+ using internal::TypeDefinitionsImpl;
+ using internal::TypeDefinitionImpl;
+ using internal::XSDPropertyInfo;
+ using internal::PropertyDefinitionImpl;
+ using internal::XMLDAS_TypeDefs;
+ using internal::SDOUtils;
+
+ SDOSchemaSAX2Parser::SDOSchemaSAX2Parser(SchemaInfo& schemaInf,
+ ParserErrorSetter* insetter,
+ PARSED_LOCATIONS& parsedLocs,
+ DEFINED_NAMESPACES& definedNSs)
+ : schemaInfo(schemaInf),
+ SAX2Parser(insetter),
+ parsedLocations(parsedLocs),
+ definedNamespaces(definedNSs)
+ {
+ bInSchema = false;
+ bInvalidElement = false;
+ bInInvalidContent = false;
+ bInvalidList = false;
+ inGroup = 0;
+ preParsing = true;
+ }
+
+ SDOSchemaSAX2Parser::~SDOSchemaSAX2Parser()
+ {
+ }
+
+
+ void SDOSchemaSAX2Parser::storeStartElementEvent(
+ const SDOXMLString& localname,
+ const SDOXMLString& prefix,
+ const SDOXMLString& URI,
+ const SAX2Namespaces& namespaces,
+ const SAX2Attributes& attributes)
+ {
+ // copy the event to as list for replay.
+ if (currentGroup)
+ {
+ currentGroup->events.push_back(GroupEvent(localname,
+ prefix,
+ URI,
+ namespaces,
+ attributes));
+ }
+
+ }
+
+ void SDOSchemaSAX2Parser::storeEndElementEvent(
+ const SDOXMLString& localname,
+ const SDOXMLString& prefix,
+ const SDOXMLString& URI)
+ {
+ // copy the event to as list for replay.
+ if (currentGroup)
+ {
+ currentGroup->events.push_back(GroupEvent(localname, prefix, URI));
+ }
+
+ }
+
+ void SDOSchemaSAX2Parser::replayEvents(
+ const SDOXMLString& uri,
+ const SDOXMLString& name,
+ bool isGroup,
+ const SAX2Attributes& groupAttributes)
+ {
+ for (unsigned int i=0;i< groupList.size(); i++)
+ {
+ if (groupList[i].isAttributeGroup != isGroup)
+ {
+ if (
+ (!name.isNull() && name.equals(groupList[i].name))
+ &&
+ (
+ (uri.isNull() && groupList[i].uri.isNull())
+ || uri.equals(groupList[i].uri))
+ )
+ {
+ // Determine the maxOccurs value from the <group ref=... definition
+ bool isMany = false;
+ const SAX2Attribute* groupMaxOccurrs = groupAttributes.getAttribute("maxOccurs");
+ if (groupMaxOccurrs != 0 &&
+ !groupMaxOccurrs->getValue().equalsIgnoreCase("1"))
+ {
+ isMany = true;
+ }
+
+ int level = 0;
+
+ for (unsigned int j=0;j< groupList[i].events.size();j++)
+ {
+ if (groupList[i].events[j].isStartEvent)
+ {
+ // For top level <choice> or <sequence> we need to add the maxOccurrs
+ // attribute from the group definition if it was "many"
+ if ((level == 0) && isMany)
+ {
+ if (groupList[i].events[j].localname.equalsIgnoreCase("choice")
+ || groupList[i].events[j].localname.equalsIgnoreCase("sequence"))
+ {
+ // Add maxOccurs attribute to list
+ groupList[i].events[j].attributes.addAttribute(*groupMaxOccurrs);
+ }
+ }
+
+ startElementNs(
+ (const SDOXMLString&)
+ groupList[i].events[j].localname,
+ (const SDOXMLString&)
+ groupList[i].events[j].prefix,
+ (const SDOXMLString&)
+ groupList[i].events[j].URI,
+ (const SAX2Namespaces&)
+ groupList[i].events[j].namespaces,
+ (const SAX2Attributes&)
+ groupList[i].events[j].attributes);
+
+ level++;
+ }
+ else
+ {
+ endElementNs(
+ (const SDOXMLString&)
+ groupList[i].events[j].localname,
+ (const SDOXMLString&)
+ groupList[i].events[j].prefix,
+ (const SDOXMLString&)
+ groupList[i].events[j].URI);
+
+ level--;
+ }
+ }
+ return;
+ }
+ }
+ }
+ // no group found
+ if (setter)
+ {
+ char *msg = new char[strlen((const char*)name) + 32];
+ if (msg)
+ {
+ sprintf(msg,"Use of undefined group %s",
+ (const char*)name);
+ setter->setError( msg );
+ delete[] msg;
+ }
+ }
+ }
+
+ // ============================================================================
+ // endDocument
+ // ============================================================================
+ void SDOSchemaSAX2Parser::endDocument()
+ {
+ preParsing=!preParsing;
+ schemaInfo.getSchemaNamespaces().empty();
+ }
+
+
+ // ============================================================================
+ // startElementNS
+ // ============================================================================
+ void SDOSchemaSAX2Parser::startElementNs(
+ const SDOXMLString& localname,
+ const SDOXMLString& prefix,
+ const SDOXMLString& URI,
+ const SAX2Namespaces& namespaces,
+ const SAX2Attributes& attributes)
+ {
+ LOGINFO_1( INFO,"SchemaParser:startElementNs:%s",(const char*)localname);
+
+ if (URI.equalsIgnoreCase("http://www.w3.org/2001/XMLSchema"))
+ {
+
+ ///////////////////////////////////////////////////////////////////////
+ // Handle schema
+ // Set the URI from the targetNamespace of the xsd:schema element
+ // Remember namespace mappings
+ // Create the root Type
+ ///////////////////////////////////////////////////////////////////////
+
+
+ if (localname.equalsIgnoreCase("schema"))
+ {
+ bInSchema = true;
+ // Handle namespace definitions
+
+
+ schemaInfo.getSchemaNamespaces().merge(namespaces);
+
+ // Handle attributes
+ for (int i=0; i < attributes.size(); i++)
+ {
+ if (attributes[i].getName().equalsIgnoreCase("targetNamespace"))
+ {
+ schemaInfo.setTargetNamespaceURI(attributes[i].getValue());
+ }
+
+ if (attributes[i].getName().equalsIgnoreCase("elementFormDefault"))
+ {
+ if (attributes[i].getValue().equals("qualified"))
+ {
+ schemaInfo.setElementFormDefaultQualified(true);
+ }
+ }
+ }
+
+ currentType.uri = schemaInfo.getTargetNamespaceURI();
+ currentType.name = "RootType";
+ currentType.localname="RootType";
+ definedNamespaces.push_back(currentType.uri);
+ return;
+
+ } // end schema handling
+ if (preParsing)
+ {
+ // we are now pre-parsing groups so that we can allow them to be
+ // defined after use.
+
+ if (inGroup > 0)
+ {
+ if ( localname.equalsIgnoreCase("group")
+ || localname.equalsIgnoreCase("attributeGroup"))
+ {
+ inGroup++;
+ }
+ // check for a group reference first
+ // we are inside a group....
+ storeStartElementEvent(
+ localname,
+ prefix,
+ URI,
+ namespaces,
+ attributes);
+ return;
+ }
+
+ if ( localname.equalsIgnoreCase("group")
+ || localname.equalsIgnoreCase("attributeGroup"))
+ {
+ inGroup++;
+ int i;
+ for (i=0; i < attributes.size(); i++)
+ {
+ if (attributes[i].getName().equalsIgnoreCase("ref"))
+ {
+ // dont store references.
+ return;
+ }
+ }
+
+ groupList.insert(groupList.begin(),GroupDefinition());
+ currentGroup = &groupList[0];
+
+ if (localname.equalsIgnoreCase("group"))
+ currentGroup->isAttributeGroup = false;
+ else currentGroup->isAttributeGroup = true;
+
+ for (i=0; i < attributes.size(); i++)
+ {
+ if (attributes[i].getName().equalsIgnoreCase("name"))
+ {
+ currentGroup->uri = schemaInfo.getTargetNamespaceURI();
+ currentGroup->name = attributes[i].getValue();
+ }
+ }
+ }
+ } // end of preParsing groups.
+ else
+ {
+ if (inGroup == 0)
+ {
+ // Handle <import> of other schema
+ if (localname.equalsIgnoreCase("import"))
+ {
+ // TODO - import and include treated equally for now - need to
+ // separate out the namespace info for import
+ startInclude(localname, prefix, URI, namespaces, attributes);
+ }
+
+ // Handle <include> of other schema
+ else if (localname.equalsIgnoreCase("include"))
+ {
+ startInclude(localname, prefix, URI, namespaces, attributes);
+ }
+
+ ///////////////////////////////////////////////////////////////////////
+ // Handle elements and attributes
+ // These become Properties of the current Type
+ // ?? Any special handling of global elements???
+ ///////////////////////////////////////////////////////////////////////
+ else if (localname.equalsIgnoreCase("element"))
+ {
+ if (!bInInvalidContent) startElement(localname, prefix, URI, namespaces, attributes);
+ }
+ else if (localname.equalsIgnoreCase("attribute"))
+ {
+ if (!bInInvalidContent) startAttribute(localname, prefix, URI, namespaces, attributes);
+ }
+ else if (localname.equalsIgnoreCase("any")
+ || localname.equalsIgnoreCase("anyAttribute"))
+ {
+ // the type containing this is to be created as open
+ if (!bInInvalidContent) currentType.isOpen = true;
+ }
+
+
+ ///////////////////////////////////////////////////////////////////////
+ // Handle complexType
+ // These become new types
+ ///////////////////////////////////////////////////////////////////////
+ else if (localname.equalsIgnoreCase("complexType"))
+ {
+ if (!bInInvalidContent) startComplexType(localname, prefix, URI, namespaces, attributes);
+ } // end complexType handling
+
+ else if (localname.equalsIgnoreCase("choice")
+ || localname.equalsIgnoreCase("sequence")
+ || localname.equalsIgnoreCase("all"))
+ {
+ if (!bInInvalidContent) startGroup(localname, prefix, URI, namespaces, attributes);
+ } // end Group handling
+
+ else if ( localname.equalsIgnoreCase("group")
+ || localname.equalsIgnoreCase("attributeGroup"))
+ {
+
+ int i;
+ for (i=0; i < attributes.size(); i++)
+ {
+ if (attributes[i].getName().equalsIgnoreCase("ref"))
+ {
+ XMLQName qname(attributes[i].getValue(),
+ schemaInfo.getSchemaNamespaces(),
+ namespaces);
+ if (qname.getURI().isNull())
+ {
+ replayEvents(schemaInfo.getTargetNamespaceURI(), qname.getLocalName(),
+ localname.equalsIgnoreCase("group"), attributes);
+ }
+ else
+ {
+ replayEvents(qname.getURI(), qname.getLocalName(),
+ localname.equalsIgnoreCase("group"), attributes);
+ }
+ }
+ }
+ inGroup++;
+ // if theres no 'ref' then its a group definition, and we
+ // already pre-parsed it.
+ }
+ else if (localname.equalsIgnoreCase("list"))
+ {
+ startList(
+ localname,
+ prefix,
+ URI,
+ namespaces,
+ attributes);
+ }
+
+ ///////////////////////////////////////////////////////////////////////
+ // Handle simpleType
+ // These become new types
+ ///////////////////////////////////////////////////////////////////////
+ else if (localname.equalsIgnoreCase("simpleType"))
+ {
+ if (!bInInvalidContent) startSimpleType(localname, prefix, URI, namespaces, attributes);
+ } // end complexType handling
+
+ else if (localname.equalsIgnoreCase("restriction"))
+ {
+ if (!bInInvalidContent) startRestriction(localname, prefix, URI, namespaces, attributes);
+ }
+
+ else if (localname.equalsIgnoreCase("extension"))
+ {
+ if (!bInInvalidContent) startExtension(localname, prefix, URI, namespaces, attributes);
+ }
+ // Handle <import> of other schema
+ else if (localname.equalsIgnoreCase("union"))
+ {
+ // TODO - unions not yet properly supported - for now, whatever the
+ // enclosing thing is, we will make it an extended primitive based on
+ // String.
+ bInInvalidContent = true;
+ //if (setter)
+ //{
+ // setter->setError("Schema contains a union which is not yet implemented");
+ //}
+
+ currentType.parentTypeUri = "commonj.sdo";
+ currentType.parentTypeName = "String";
+ currentType.isRestriction = true;
+
+ }
+ }
+ }
+ }
+ else // not in schema - check for any extra namespaces
+ {
+ schemaInfo.getSchemaNamespaces().merge(namespaces);
+ }
+
+ }
+
+
+ // ============================================================================
+ // endElementNs
+ // ============================================================================
+ void SDOSchemaSAX2Parser::endElementNs(
+ const SDOXMLString& localname,
+ const SDOXMLString& prefix,
+ const SDOXMLString& URI)
+ {
+ LOGINFO_1( INFO,"SchemaParser:endElementNs:%s",(const char*)localname);
+
+ if (URI.equalsIgnoreCase("http://www.w3.org/2001/XMLSchema"))
+ {
+ if (localname.equalsIgnoreCase("schema"))
+ {
+ bInSchema = false;
+ }
+
+ ///////////////////////////////////////////////////////////////////////
+ // Handle complexType
+ // Pop the Type off our stack
+ ///////////////////////////////////////////////////////////////////////
+
+ // We do not support unions, so all inside a union, plus the containing
+ // element are invalid for now.
+ //
+ if (!bInInvalidContent)
+ {
+ if (preParsing)
+ {
+ if (inGroup > 0)
+ {
+ if (localname.equalsIgnoreCase("group")
+ || localname.equalsIgnoreCase("attributeGroup"))
+ {
+ inGroup--;
+ if (inGroup < 0)inGroup = 0; // should never happen.
+ }
+ if (inGroup > 0) // still need to store end of group ref
+ {
+ storeEndElementEvent(
+ localname,
+ prefix,
+ URI);
+ }
+ }
+ }
+ else
+ {
+ if (localname.equalsIgnoreCase("group")
+ || localname.equalsIgnoreCase("attributeGroup"))
+ {
+ inGroup--;
+ if (inGroup < 0) inGroup = 0;
+ // outside of preparse, dont need to do anything.
+ }
+ else if (inGroup == 0)
+ {
+ if (localname.equalsIgnoreCase("complexType"))
+ {
+ if (!bInvalidElement) defineType();
+ } // end complexType handling
+ else if (localname.equalsIgnoreCase("simpleType"))
+ {
+ if (!bInvalidElement) defineType();
+ }
+ else if (localname.equalsIgnoreCase("schema"))
+ {
+ if (!bInvalidElement) defineType();
+ } // end complexType handling
+ else if (localname.equalsIgnoreCase("element")
+ || localname.equalsIgnoreCase("attribute"))
+ {
+ // PropertyDefinition should now be complete
+ if (!bInvalidElement) defineProperty();
+ }
+ else if (localname.equalsIgnoreCase("choice")
+ || localname.equalsIgnoreCase("sequence")
+ || localname.equalsIgnoreCase("all"))
+ {
+ if (!bInvalidElement) currentType.isMany = false;
+ }
+ else if (localname.equalsIgnoreCase("list"))
+ {
+ // PropertyDefinition should now be complete
+ if (!bInvalidList) defineProperty();
+ bInvalidList = false;
+ }
+ bInvalidElement = false;
+ }
+ }
+
+ } // bInUnsupportedContent
+ if (localname.equalsIgnoreCase("union"))
+ {
+ bInInvalidContent = false;
+ // the enclosing element is not useful
+ // TODO - Instead of making the union invalid, we make it an
+ // extended primitive based on string - so its no longer invalid.
+ //bInvalidElement = true;
+ }
+ }
+
+ }
+
+ int SDOSchemaSAX2Parser::parseURI(const SDOXMLString& location, const SDOXMLString& base)
+ {
+ xmlChar* absoluteUri = xmlBuildURI(location, base);
+ if (! absoluteUri)
+ {
+ throw SDOFileNotFoundException(TUSCANY_SDO_EINFO,
+ location);
+ }
+ SDOXMLString absUri(absoluteUri);
+ xmlFree(absoluteUri);
+
+ // Determine if this location has been parsed already
+ PARSED_LOCATIONS::iterator iter;
+ iter = parsedLocations.find(absUri);
+ if (iter != parsedLocations.end())
+ {
+ schemaInfo.setTargetNamespaceURI(iter->second);
+ return 0;
+ }
+
+
+ try
+ {
+ int rc = parse(absUri);
+ // add new location to map
+ parsedLocations[absUri] = schemaInfo.getTargetNamespaceURI();
+ return rc;
+ }
+ catch (SDORuntimeException) {}
+
+ return -1;
+ }
+
+ // ============================================================================
+ // startInclude
+ // ============================================================================
+ void SDOSchemaSAX2Parser::startInclude(
+ const SDOXMLString& localname,
+ const SDOXMLString& prefix,
+ const SDOXMLString& URI,
+ const SAX2Namespaces& namespaces,
+ const SAX2Attributes& attributes)
+ {
+ LOGINFO_1( INFO,"SchemaParser:startInclude:%s",(const char*)localname);
+
+ if (!bInSchema) return;
+
+
+ SDOXMLString importNamespace = attributes.getValue("namespace");
+ SDOXMLString schemaLocation = attributes.getValue("schemaLocation");
+
+ if (localname.equalsIgnoreCase("import")
+ && !importNamespace.isNull())
+ {
+ // Do not attempt to import namespaces alredy defined
+ for (unsigned int i = 0; i < definedNamespaces.size(); i++)
+ {
+ if (definedNamespaces[i].equals(importNamespace))
+ {
+ return;
+ }
+ }
+ }
+
+ SchemaInfo schemaInf;
+ SDOSchemaSAX2Parser schemaParser(schemaInf, setter, parsedLocations, definedNamespaces);
+
+ if (!schemaLocation.isNull())
+ {
+ if (0 != schemaParser.parseURI(schemaLocation, getCurrentFile()))
+ return;
+ }
+ else
+ {
+ // schemaLocation isn't present. Try loading namespace for import
+ if (localname.equalsIgnoreCase("import")
+ && !importNamespace.isNull())
+ {
+ if (0 != schemaParser.parseURI(importNamespace, SDOXMLString()))
+ return;
+ }
+ else
+ {
+ return;
+ }
+ }
+
+ // Add the parsed types to this parsers list
+ TypeDefinitionsImpl& typedefs = schemaParser.getTypeDefinitions();
+ XMLDAS_TypeDefs types = typedefs.types;
+ XMLDAS_TypeDefs::iterator iter;
+ for (iter=types.begin(); iter != types.end(); iter++)
+ {
+ if ((*iter).second.name.equals("RootType")
+ && currentType.name.equals("RootType")
+ && (*iter).second.uri.equals(currentType.uri))
+ {
+ // This must be true for an import/include to be
+ // legally positioned
+
+ XMLDAS_TypeDefs::iterator find = typeDefinitions.types.find(
+ (*iter).first);
+
+ std::list<PropertyDefinitionImpl>::iterator propit;
+ std::list<PropertyDefinitionImpl>::iterator currpropit;
+ bool found;
+
+ for (propit = (*iter).second.properties.begin() ;
+ propit != (*iter).second.properties.end(); ++ propit)
+ {
+ found = false;
+ // do not merge properties whose names clash
+ for ( currpropit = currentType.properties.begin();
+ currpropit != currentType.properties.end();
+ ++currpropit)
+ {
+ if ((*currpropit).name.equals((*propit).name))
+ {
+ found = true;
+ break;
+ }
+ }
+ if (!found)
+ {
+ currentType.properties.push_back(*propit);
+ }
+ }
+ }
+ else
+ {
+ typeDefinitions.types.insert(*iter);
+ }
+ }
+
+ }
+
+
+ // ============================================================================
+ // startList
+ // ============================================================================
+ void SDOSchemaSAX2Parser::startList(
+ const SDOXMLString& localname,
+ const SDOXMLString& prefix,
+ const SDOXMLString& URI,
+ const SAX2Namespaces& namespaces,
+ const SAX2Attributes& attributes)
+ {
+
+ LOGINFO_1( INFO,"SchemaParser:startList:%s",(const char*)localname);
+
+ if (!bInSchema) return;
+
+ // invent a property called "values" to hold the list
+
+ SDOXMLString typeName = attributes.getValue("itemType");
+
+ if (typeName.isNull())
+ {
+ // we do not support lists with no item type (yet).
+ if (setter)
+ {
+ setter->setError("Schema contains a list with no type - not supported");
+ }
+ bInvalidList = true;
+ return;
+ }
+
+ currentType.dataType = false;
+ currentType.isFromList = true;
+
+ // attribute to set the list type
+ // define an internal property to hold the list
+ PropertyDefinitionImpl thisProperty;
+ thisProperty.name = "values";
+ thisProperty.localname = "values";
+ thisProperty.isContainment = false;
+ thisProperty.isElement=true;
+ thisProperty.isMany = true;
+
+ XMLQName qname = resolveTypeName(
+ typeName,
+ namespaces,
+ thisProperty.typeUri,
+ thisProperty.typeName);
+ thisProperty.fullTypeName = typeName;
+
+ setCurrentProperty(thisProperty);
+
+ }
+
+ // ============================================================================
+ // startElement
+ // ============================================================================
+ void SDOSchemaSAX2Parser::startElement(
+ const SDOXMLString& localname,
+ const SDOXMLString& prefix,
+ const SDOXMLString& URI,
+ const SAX2Namespaces& namespaces,
+ const SAX2Attributes& attributes)
+ {
+
+ if (!bInSchema) return;
+
+ PropertyDefinitionImpl thisProperty;
+
+ LOGINFO_1( INFO,"SchemaParser:startElement:%s",(const char*)localname);
+
+ thisProperty.isElement = true;
+
+ setName(attributes,
+ thisProperty.name,
+ thisProperty.localname);
+
+ // Set the property's namespace if elementForm is "qualified"
+ bool elementFormQualified = schemaInfo.isElementFormDefaultQualified();
+ SDOXMLString elementForm = attributes.getValue("form");
+ if (!elementForm.isNull())
+ {
+ elementFormQualified = false;
+ if (elementForm.equals("qualified"))
+ {
+ elementFormQualified = true;
+ }
+ }
+
+ if (elementFormQualified
+ || currentType.name.equals("RootType"))
+ {
+ thisProperty.namespaceURI = schemaInfo.getTargetNamespaceURI();
+ }
+
+ setType(thisProperty, attributes, namespaces);
+
+ // Set isMany. currentType.isMany = true indicates we are in a
+ // group definition (sequence/choice) with maxOccurs>1
+ if (currentType.isMany)
+ {
+ thisProperty.isMany = true;
+ }
+ else
+ {
+ SDOXMLString maxOccurs = attributes.getValue("maxOccurs");
+ if (!maxOccurs.isNull())
+ {
+ if (!maxOccurs.equalsIgnoreCase("1"))
+ {
+ thisProperty.isMany = true;
+ }
+ }
+ }
+
+ // find aliases
+ thisProperty.aliases = attributes.getValue("aliasName");
+
+ // mark this as a substitution group.
+ // TODO - what about properties which have already been set into the tree,
+ // and might have a substitution?
+
+ SDOXMLString substituteName = attributes.getValue("substitutionGroup");
+ if (! substituteName.isNull())
+ {
+ XMLQName qname = resolveTypeName(
+ substituteName,
+ namespaces,
+ thisProperty.substituteUri,
+ thisProperty.substituteName);
+ thisProperty.isSubstitute=true;
+ }
+
+ // count the number of elements in the group
+ if (currentType.isMany)
+ {
+ currentType.groupElementCount++;
+ }
+
+ setCurrentProperty(thisProperty);
+
+ }
+
+ // ============================================================================
+ // startAttribute
+ // ============================================================================
+ void SDOSchemaSAX2Parser::startAttribute(
+ const SDOXMLString& localname,
+ const SDOXMLString& prefix,
+ const SDOXMLString& URI,
+ const SAX2Namespaces& namespaces,
+ const SAX2Attributes& attributes)
+ {
+
+ LOGINFO_1( INFO,"SchemaParser:startAttribute:%s",(const char*)localname);
+
+ if (!bInSchema) return;
+
+ PropertyDefinitionImpl thisProperty;
+
+ thisProperty.isElement = false;
+
+ setName(attributes,
+ thisProperty.name,
+ thisProperty.localname);
+
+ thisProperty.namespaceURI = schemaInfo.getTargetNamespaceURI();
+
+ setType(thisProperty, attributes, namespaces);
+
+ setCurrentProperty(thisProperty);
+ }
+
+ // ============================================================================
+ // startComplexType
+ // ============================================================================
+ void SDOSchemaSAX2Parser::startComplexType(
+ const SDOXMLString& localname,
+ const SDOXMLString& prefix,
+ const SDOXMLString& URI,
+ const SAX2Namespaces& namespaces,
+ const SAX2Attributes& attributes)
+ {
+ LOGINFO_1( INFO,"SchemaParser:startComplexType:%s",(const char*)localname);
+
+ if (!bInSchema) return;
+
+ TypeDefinitionImpl thisType; // set defaults
+ thisType.uri=schemaInfo.getTargetNamespaceURI();
+
+ setTypeName(thisType, attributes,namespaces);
+
+
+
+ for (int i=0; i < attributes.size(); i++)
+ {
+ // If sdo:sequence="true" or mixed="true" it is sequenced
+ if ( (attributes[i].getUri().equalsIgnoreCase("commonj.sdo/xml")
+ && attributes[i].getName().equalsIgnoreCase("sequence"))
+ || attributes[i].getName().equalsIgnoreCase("mixed"))
+ {
+ if (attributes[i].getValue().equals("true"))
+ {
+ thisType.isSequenced = true;
+ }
+ }
+ // If abstract="true" it is abstract
+ else if (attributes[i].getName().equalsIgnoreCase("abstract"))
+ {
+ if (attributes[i].getValue().equals("true"))
+ {
+ thisType.isAbstract = true;
+ }
+ }
+ else if (attributes[i].getName().equalsIgnoreCase("aliasName"))
+ {
+ thisType.aliases = attributes[i].getValue();
+ }
+ }
+
+ setCurrentType(thisType);
+ }
+
+ // ============================================================================
+ // startSimpleType
+ // ============================================================================
+ void SDOSchemaSAX2Parser::startSimpleType(
+ const SDOXMLString& localname,
+ const SDOXMLString& prefix,
+ const SDOXMLString& URI,
+ const SAX2Namespaces& namespaces,
+ const SAX2Attributes& attributes)
+ {
+ LOGINFO_1( INFO,"SchemaParser:startSimpleType:%s",(const char*)localname);
+
+ if (!bInSchema) return;
+
+ TypeDefinitionImpl thisType; // set defaults
+ thisType.uri=schemaInfo.getTargetNamespaceURI();
+ thisType.dataType = true;
+
+ for (int i=0; i < attributes.size(); i++)
+ {
+ // If abstract="true" it is abstract
+ if (attributes[i].getName().equalsIgnoreCase("abstract"))
+ {
+ if (attributes[i].getValue().equals("true"))
+ {
+ thisType.isAbstract = true;
+ }
+ }
+ else if (attributes[i].getName().equalsIgnoreCase("aliasName"))
+ {
+ thisType.aliases = attributes[i].getValue();
+ }
+ }
+ setTypeName(thisType, attributes,namespaces);
+
+ // see if the type is going to be abstract...
+
+
+ setCurrentType(thisType);
+ }
+
+ // ============================================================================
+ // startRestriction
+ // ============================================================================
+ void SDOSchemaSAX2Parser::startRestriction(
+ const SDOXMLString& localname,
+ const SDOXMLString& prefix,
+ const SDOXMLString& URI,
+ const SAX2Namespaces& namespaces,
+ const SAX2Attributes& attributes)
+ {
+ LOGINFO_1( INFO,"SchemaParser:startRestriction:%s",(const char*)localname);
+
+ if (!bInSchema) return;
+
+ SDOXMLString base = attributes.getValue("base");
+ if (!base.isNull())
+ {
+ // Resolve typename to uri:name
+ XMLQName qname = resolveTypeName(
+ base,
+ namespaces,
+ currentType.parentTypeUri,
+ currentType.parentTypeName);
+
+ currentType.isRestriction=true;
+
+
+ if(qname.getLocalName().equals("QName"))
+ {
+ currentType.isQName = true;
+ }
+ }
+ }
+
+ // ============================================================================
+ // startExtension
+ // ============================================================================
+ void SDOSchemaSAX2Parser::startExtension(
+ const SDOXMLString& localname,
+ const SDOXMLString& prefix,
+ const SDOXMLString& URI,
+ const SAX2Namespaces& namespaces,
+ const SAX2Attributes& attributes)
+ {
+ LOGINFO_1( INFO,"SchemaParser:startExtension:%s",(const char*)localname);
+
+ if (!bInSchema) return;
+
+ SDOXMLString base = attributes.getValue("base");
+ if (!base.isNull())
+ {
+ SDOXMLString typeUri;
+ SDOXMLString typeName;
+ // Resolve typename to uri:name
+ XMLQName qname = resolveTypeName(
+ base,
+ namespaces,
+ typeUri,
+ typeName);
+
+ // If extending a simple type (an SDO DataType) we create a
+ // Property named "value" of this type rather than set the
+ // simple type as a base
+ currentType.isRestriction=false;
+
+ // ?? Does this only apply within a <simpleContent> tag??
+ if (typeUri.equalsIgnoreCase(SDOUtils::sdoURI))
+ {
+ // here the type needs to be flagged so that
+ // we know to serialize this property as an element with
+ // just the contents <element>abc</element> rather than
+ // value=abc
+
+
+ PropertyDefinitionImpl thisProperty;
+ thisProperty.name = "value";
+ thisProperty.localname = "value";
+ thisProperty.typeUri = typeUri;
+ thisProperty.typeName = typeName;
+ thisProperty.fullTypeName = base;
+ thisProperty.isContainment = false;
+ thisProperty.isElement=true;
+
+ currentType.isExtendedPrimitive= true;
+
+ if(qname.getLocalName().equals("QName"))
+ {
+ thisProperty.isQName = true;
+ }
+
+ setCurrentProperty(thisProperty);
+ defineProperty();
+ }
+ else
+ {
+ currentType.parentTypeUri = typeUri;
+ currentType.parentTypeName = typeName;
+ }
+ }
+ }
+
+ // ============================================================================
+ // startGroup
+ // ============================================================================
+ void SDOSchemaSAX2Parser::startGroup(
+ const SDOXMLString& localname,
+ const SDOXMLString& prefix,
+ const SDOXMLString& URI,
+ const SAX2Namespaces& namespaces,
+ const SAX2Attributes& attributes)
+ {
+ LOGINFO_1( INFO,"SchemaParser:startGroup:%s",(const char*)localname);
+
+ if (!bInSchema) return;
+
+ SDOXMLString maxOccurs = attributes.getValue("maxOccurs");
+ if (!maxOccurs.isNull())
+ {
+ if (!maxOccurs.equalsIgnoreCase("1"))
+ {
+ currentType.isMany = true;
+ }
+ }
+ }
+
+ // ============================================================================
+ // setCurrentType
+ // ============================================================================
+ void SDOSchemaSAX2Parser::setCurrentType(const TypeDefinitionImpl& type)
+ {
+ typeStack.push(currentType);
+ currentType = type;
+ }
+
+ // ============================================================================
+ // defineType
+ // ============================================================================
+ void SDOSchemaSAX2Parser::defineType()
+ {
+ // Set this Type as sequenced of more than one element in a group definition
+ if (currentType.groupElementCount > 1)
+ {
+ currentType.isSequenced = true;
+ }
+
+ SDOXMLString typeQname = TypeDefinitionsImpl::getTypeQName(currentType.uri, currentType.localname);
+ typeDefinitions.types[typeQname] = currentType;
+
+ if (currentProperty.typeName.isNull())
+ {
+ // Set the type name to the name of this type
+ currentProperty.typeUri = currentType.uri;
+ currentProperty.typeName = currentType.localname;
+ }
+
+ if (typeStack.size() != 0)
+ {
+ currentType = typeStack.top();
+ typeStack.pop();
+ }
+ else
+ {
+ currentType = TypeDefinitionImpl();
+ }
+ }
+
+ // ============================================================================
+ // setCurrentProperty
+ // ============================================================================
+ void SDOSchemaSAX2Parser::setCurrentProperty(const PropertyDefinitionImpl& prop)
+ {
+ propertyStack.push(currentProperty);
+ currentProperty = prop;
+ }
+
+ // ============================================================================
+ // defineProperty
+ // ============================================================================
+ void SDOSchemaSAX2Parser::defineProperty()
+ {
+
+ if (currentProperty.typeName.isNull())
+ {
+ // Set the type of this property to default (sdo:String)
+ currentProperty.typeUri = SDOUtils::sdoURI;
+ currentProperty.typeName = "String";
+ }
+
+ if (currentProperty.localname.isNull())
+ currentProperty.localname = currentProperty.typeName;
+
+ // Set isMany if property isMany OR if containing type isMany
+ // NOTE: The above comment is as per the SDO2.0 spec however this does not
+ // work when serializing a sequence containing a single-valued property and
+ // then deserializing.
+ // currentProperty.isMany = currentProperty.isMany || currentType.isMany;
+
+ currentType.properties.push_back(currentProperty);
+ if (propertyStack.size() != 0)
+ {
+ currentProperty = propertyStack.top();
+ propertyStack.pop();
+ }
+ else
+ currentProperty = PropertyDefinitionImpl();
+
+ }
+
+ // ============================================================================
+ // setDefault
+ // ============================================================================
+ void SDOSchemaSAX2Parser::setDefault(
+ PropertyDefinitionImpl& thisProperty,
+ const SAX2Attributes& attributes)
+ {
+ thisProperty.defaultValue = attributes.getValue("fixed");
+ if (!thisProperty.defaultValue.isNull())
+ {
+ thisProperty.isReadOnly = true;
+ }
+ else
+ {
+ thisProperty.defaultValue = attributes.getValue("default");
+ }
+ }
+
+ // ============================================================================
+ // setName
+ // ============================================================================
+ void SDOSchemaSAX2Parser::setName(
+ const SAX2Attributes& attributes,
+ SDOXMLString& sdoname,
+ SDOXMLString& localname)
+ {
+ for (int i=0; i < attributes.size(); i++)
+ {
+ // Handle sdo: annotations
+ if (attributes[i].getUri().equalsIgnoreCase("commonj.sdo/xml"))
+ {
+ // sdo:name overrides the property name
+ if (attributes[i].getName().equalsIgnoreCase("name"))
+ {
+ sdoname = attributes[i].getValue();
+ }
+ }
+ else
+ {
+
+ if (attributes[i].getName().equalsIgnoreCase("name"))
+ {
+ localname = attributes[i].getValue();
+ // If name is already set it must have been an
+ // override using sdo:name
+ if (sdoname.isNull())
+ {
+ sdoname = localname;
+ }
+ }
+ }
+ }
+
+ }
+
+ // ============================================================================
+ // setType
+ // ============================================================================
+ void SDOSchemaSAX2Parser::setType(
+ PropertyDefinitionImpl& property,
+ const SAX2Attributes& attributes,
+ const SAX2Namespaces& namespaces)
+ {
+ property.fullLocalTypeName = attributes.getValue("type");
+ if (!property.fullLocalTypeName.isNull())
+ {
+ XMLQName qname(property.fullLocalTypeName,schemaInfo.getSchemaNamespaces(), namespaces);
+ if (qname.getLocalName().equals("IDREF")
+ || qname.getLocalName().equals("IDREFS"))
+ {
+ property.fullTypeName = attributes.getValue("commonj.sdo/xml","propertyType");
+
+ property.isIDREF = true;
+ property.isContainment = false;
+
+ if (qname.getLocalName().equals("IDREFS"))
+ {
+ property.isMany = true;
+ }
+ }
+ else if (qname.getLocalName().equals("anyURI"))
+ {
+ property.fullTypeName = attributes.getValue("commonj.sdo/xml","propertyType");
+ }
+ else if (qname.getLocalName().equals("ID"))
+ {
+ property.isID = true;
+ currentType.IDPropertyName = property.name;
+ }
+
+ else
+ {
+ property.fullTypeName = attributes.getValue("commonj.sdo/xml","dataType");
+ }
+ }
+
+ else
+ {
+ property.fullLocalTypeName = attributes.getValue("ref");
+ if (!property.fullLocalTypeName.isNull())
+ {
+ property.isReference = true;
+ }
+ }
+
+ if (property.fullTypeName.isNull())
+ {
+ property.fullTypeName = property.fullLocalTypeName;
+ }
+
+ if (!property.fullTypeName.isNull())
+ {
+ // Resolve typename to uri:name
+ XMLQName qname = resolveTypeName(
+ property.fullTypeName,
+ namespaces,
+ property.typeUri,
+ property.typeName);
+
+ if(qname.getLocalName().equals("QName"))
+ {
+ property.isQName = true;
+ }
+ }
+
+ }
+
+ // ============================================================================
+ // setTypeName
+ // ============================================================================
+ void SDOSchemaSAX2Parser::setTypeName(
+ TypeDefinitionImpl& type,
+ const SAX2Attributes& attributes,
+ const SAX2Namespaces& namespaces)
+ {
+ setName(attributes, type.name, type.localname);
+
+
+ // If localname is not set it is anonymous so use the enclosing element name
+ if (type.localname.isNull())
+ {
+ type.localname = currentProperty.name;
+
+ // ensure anonymous type name does not clash with existing type
+ for (int suffix = 1; ; suffix++)
+ {
+ SDOXMLString typeUri = TypeDefinitionsImpl::getTypeQName(type.uri, type.localname);
+ XMLDAS_TypeDefs::iterator it = typeDefinitions.types.find(typeUri);
+ if(it == typeDefinitions.types.end())
+ {
+ break;
+ }
+ char buff[32];
+ sprintf(buff, "%d", suffix);
+ type.localname += buff;
+ }
+ }
+ else
+ {
+ // check for an overriding url in the name
+ int i;
+ if ((i = type.localname.firstIndexOf(':')) > 0)
+ {
+ XMLQName qname(type.localname,
+ schemaInfo.getSchemaNamespaces(),
+ namespaces);
+ type.uri = qname.getURI();
+ type.localname = qname.getLocalName();
+ }
+ }
+
+ // Set SDO name if not specified
+ if (type.name .isNull())
+ {
+ type.name = type.localname ;
+ }
+ else
+ {
+ // check for an overriding url in the name
+ int i;
+ if ((i = type.name.firstIndexOf(':')) > 0)
+ {
+ XMLQName qname(type.name,
+ schemaInfo.getSchemaNamespaces(),
+ namespaces);
+ type.uri = qname.getURI();
+ type.name = qname.getLocalName();
+ }
+ }
+ }
+
+ std::istream& operator>>(std::istream& input, SDOSchemaSAX2Parser& parser)
+ {
+ parser.stream(input);
+
+ return input;
+ }
+
+ std::istringstream& operator>>(std::istringstream& input, SDOSchemaSAX2Parser& parser)
+ {
+ parser.stream(input);
+
+ return input;
+ }
+
+ void SDOSchemaSAX2Parser::stream(std::istream& input)
+ {
+ // override to parse twice for groups
+
+ stream_twice(input);
+ }
+
+
+ int SDOSchemaSAX2Parser::parse(const char* filename)
+ {
+ return parse_twice(filename);
+ }
+
+
+
+ // ============================================================================
+ // resolveTypeName
+ // ============================================================================
+ XMLQName SDOSchemaSAX2Parser::resolveTypeName(
+ const SDOXMLString& fullTypeName,
+ const SAX2Namespaces& namespaces,
+ SDOXMLString& uri,
+ SDOXMLString& name)
+ {
+ XMLQName qname(fullTypeName,
+ schemaInfo.getSchemaNamespaces(),
+ namespaces);
+
+ uri = qname.getURI();
+ name = qname.getLocalName();
+
+ ///////////////////////////////////////////////////////////////////////
+ // Map the xsd types to SDO Types
+ ///////////////////////////////////////////////////////////////////////
+ if (qname.getURI().equalsIgnoreCase("http://www.w3.org/2001/XMLSchema"))
+ {
+ uri = SDOUtils::sdoURI;
+ name = SDOUtils::XSDToSDO((const char*)(qname.getLocalName()));
+ if (name.isNull())
+ {
+ name = "String";
+ }
+
+ }
+
+ // Temporary hack: ChangeSummaryType is ChangeSummary in core
+ else if (qname.getURI().equalsIgnoreCase(SDOUtils::sdoURI))
+ {
+ if (qname.getLocalName().equalsIgnoreCase("ChangeSummaryType"))
+ {
+ name = "ChangeSummary";
+ }
+
+ }
+ else if (qname.getURI().isNull())
+ {
+ uri = schemaInfo.getTargetNamespaceURI();
+ }
+
+ return qname;
+ }
+
+ } // End - namespace sdo
+
+} // End - namespace commonj
+
diff --git a/sdo-cpp/trunk/runtime/core/src/commonj/sdo/SDOSchemaSAX2Parser.h b/sdo-cpp/trunk/runtime/core/src/commonj/sdo/SDOSchemaSAX2Parser.h
new file mode 100644
index 0000000000..422623d9d7
--- /dev/null
+++ b/sdo-cpp/trunk/runtime/core/src/commonj/sdo/SDOSchemaSAX2Parser.h
@@ -0,0 +1,236 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you 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$ */
+
+#ifndef _SDOSCHEMASAX2PARSER_H_
+#define _SDOSCHEMASAX2PARSER_H_
+
+#include "commonj/sdo/disable_warn.h"
+
+#include "commonj/sdo/SAX2Parser.h"
+#include "commonj/sdo/SchemaInfo.h"
+#include "stack"
+#include "commonj/sdo/TypeDefinitionsImpl.h"
+#include "commonj/sdo/GroupDefinition.h"
+#include "commonj/sdo/XMLQName.h"
+#include "commonj/sdo/ParserErrorSetter.h"
+
+namespace commonj
+{
+ namespace sdo
+ {
+
+/**
+ * SDOSAX2Parser implements SAX2Parser.
+ * This class gets called back by the libxml library, and
+ * deals with the creation of metadata objects from XSD.
+ */
+
+ class SDOSchemaSAX2Parser : public SAX2Parser
+ {
+
+ public:
+ typedef std::map<SDOXMLString, SDOXMLString> PARSED_LOCATIONS;
+ typedef std::vector<SDOXMLString> DEFINED_NAMESPACES;
+
+ SDOSchemaSAX2Parser(SchemaInfo& schemaInfo,
+ ParserErrorSetter* insetter,
+ PARSED_LOCATIONS& parsedLocations,
+ DEFINED_NAMESPACES& definedNamepaces);
+
+ virtual ~SDOSchemaSAX2Parser();
+
+
+ virtual void startElementNs(
+ const SDOXMLString& localname,
+ const SDOXMLString& prefix,
+ const SDOXMLString& URI,
+ const SAX2Namespaces& namespaces,
+ const SAX2Attributes& attributes);
+
+ virtual void endElementNs(
+ const SDOXMLString& localname,
+ const SDOXMLString& prefix,
+ const SDOXMLString& URI);
+
+
+ virtual void stream(std::istream& input);
+
+ virtual int parse(const char* filename);
+ virtual void endDocument();
+
+
+ const SDOXMLString& getTargetNamespaceURI() const {return schemaInfo.getTargetNamespaceURI();}
+
+ friend std::istream& operator>>(std::istream& input, SDOSchemaSAX2Parser& parser);
+ friend std::istringstream& operator>>(std::istringstream& input, SDOSchemaSAX2Parser& parser);
+
+
+ int parseURI(const SDOXMLString& location, const SDOXMLString& base);
+
+ private:
+
+ internal::TypeDefinitionsImpl& getTypeDefinitions() {return typeDefinitions;}
+
+ // group handling.
+
+ int inGroup;
+ bool preParsing;
+ GroupDefinition* currentGroup;
+ std::vector<GroupDefinition> groupList;
+
+ bool bInSchema; // only parse when within a schema
+ bool bInvalidElement; // where element content is not valid
+ bool bInInvalidContent; // actually inside invalid content.
+ bool bInvalidList; // a list with no type - not supported.
+
+ virtual void replayEvents(
+ const SDOXMLString& uri,
+ const SDOXMLString& name,
+ bool isGroup,
+ const SAX2Attributes& groupAttributes);
+
+ virtual void storeStartElementEvent(
+ const SDOXMLString& localname,
+ const SDOXMLString& prefix,
+ const SDOXMLString& URI,
+ const SAX2Namespaces& namespaces,
+ const SAX2Attributes& attributes);
+
+ virtual void storeEndElementEvent(
+ const SDOXMLString& localname,
+ const SDOXMLString& prefix,
+ const SDOXMLString& URI
+ );
+
+ virtual void startInclude(
+ const SDOXMLString& localname,
+ const SDOXMLString& prefix,
+ const SDOXMLString& URI,
+ const SAX2Namespaces& namespaces,
+ const SAX2Attributes& attributes);
+
+ virtual void startElement(
+ const SDOXMLString& localname,
+ const SDOXMLString& prefix,
+ const SDOXMLString& URI,
+ const SAX2Namespaces& namespaces,
+ const SAX2Attributes& attributes);
+
+ virtual void startAttribute(
+ const SDOXMLString& localname,
+ const SDOXMLString& prefix,
+ const SDOXMLString& URI,
+ const SAX2Namespaces& namespaces,
+ const SAX2Attributes& attributes);
+
+ virtual void startComplexType(
+ const SDOXMLString& localname,
+ const SDOXMLString& prefix,
+ const SDOXMLString& URI,
+ const SAX2Namespaces& namespaces,
+ const SAX2Attributes& attributes);
+
+ virtual void startSimpleType(
+ const SDOXMLString& localname,
+ const SDOXMLString& prefix,
+ const SDOXMLString& URI,
+ const SAX2Namespaces& namespaces,
+ const SAX2Attributes& attributes);
+
+ virtual void startRestriction(
+ const SDOXMLString& localname,
+ const SDOXMLString& prefix,
+ const SDOXMLString& URI,
+ const SAX2Namespaces& namespaces,
+ const SAX2Attributes& attributes);
+
+ virtual void startExtension(
+ const SDOXMLString& localname,
+ const SDOXMLString& prefix,
+ const SDOXMLString& URI,
+ const SAX2Namespaces& namespaces,
+ const SAX2Attributes& attributes);
+
+ virtual void startGroup(
+ const SDOXMLString& localname,
+ const SDOXMLString& prefix,
+ const SDOXMLString& URI,
+ const SAX2Namespaces& namespaces,
+ const SAX2Attributes& attributes);
+
+ virtual void startList(
+ const SDOXMLString& localname,
+ const SDOXMLString& prefix,
+ const SDOXMLString& URI,
+ const SAX2Namespaces& namespaces,
+ const SAX2Attributes& attributes);
+
+ XMLQName resolveTypeName(
+ const SDOXMLString& fullTypeName,
+ const SAX2Namespaces& namespaces,
+ SDOXMLString& uri,
+ SDOXMLString& name);
+
+ void setName(
+ const SAX2Attributes& attributes,
+ SDOXMLString& sdoname,
+ SDOXMLString& localname
+ );
+
+ void setType(
+ internal::PropertyDefinitionImpl& property,
+ const SAX2Attributes& attributes,
+ const SAX2Namespaces& namespaces);
+
+ void setTypeName(
+ internal::TypeDefinitionImpl& type,
+ const SAX2Attributes& attributes,
+ const SAX2Namespaces& namespaces);
+
+ void setDefault(
+ internal::PropertyDefinitionImpl& thisProperty,
+ const SAX2Attributes& attributes);
+
+
+ SchemaInfo& schemaInfo;
+
+ internal::PropertyDefinitionImpl currentProperty;
+ std::stack<internal::PropertyDefinitionImpl> propertyStack;
+ void setCurrentProperty(const internal::PropertyDefinitionImpl& property);
+ void defineProperty();
+
+ internal::TypeDefinitionImpl currentType;
+ std::stack<internal::TypeDefinitionImpl> typeStack;
+ void setCurrentType(const internal::TypeDefinitionImpl& type);
+ void defineType();
+
+ internal::TypeDefinitionsImpl typeDefinitions;
+
+ PARSED_LOCATIONS& parsedLocations;
+ DEFINED_NAMESPACES& definedNamespaces;
+
+ friend class XSDHelperImpl;
+ };
+
+
+ } // End - namespace sdo
+} // End - namespace commonj
+#endif //_SDOSCHEMASAX2PARSER_H_
diff --git a/sdo-cpp/trunk/runtime/core/src/commonj/sdo/SDOString.h b/sdo-cpp/trunk/runtime/core/src/commonj/sdo/SDOString.h
new file mode 100644
index 0000000000..9661bb6294
--- /dev/null
+++ b/sdo-cpp/trunk/runtime/core/src/commonj/sdo/SDOString.h
@@ -0,0 +1,31 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you 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$ */
+
+// #include "commonj/sdo/disable_warn.h"
+
+#ifndef _SDOString_H_
+#define _SDOString_H_
+#include "commonj/sdo/export.h"
+
+#include <string>
+typedef std::string SDOString;
+
+#endif // _SDOString_H_
diff --git a/sdo-cpp/trunk/runtime/core/src/commonj/sdo/SDOUserMacros.h b/sdo-cpp/trunk/runtime/core/src/commonj/sdo/SDOUserMacros.h
new file mode 100644
index 0000000000..50f8733606
--- /dev/null
+++ b/sdo-cpp/trunk/runtime/core/src/commonj/sdo/SDOUserMacros.h
@@ -0,0 +1,30 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you 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$ */
+
+#ifndef _SDO_SDOUSERMACROS_H_
+#define _SDO_SDOUSERMACROS_H_
+
+// This file is deliberately empty. It is included by SDO source files
+// that allow macros to be overridden by user definitions. See SDODate.h/.cpp
+// for an example of this.
+
+#endif //_SDO_SDODATE_H_
+
diff --git a/sdo-cpp/trunk/runtime/core/src/commonj/sdo/SDOUtils.cpp b/sdo-cpp/trunk/runtime/core/src/commonj/sdo/SDOUtils.cpp
new file mode 100644
index 0000000000..480af78482
--- /dev/null
+++ b/sdo-cpp/trunk/runtime/core/src/commonj/sdo/SDOUtils.cpp
@@ -0,0 +1,335 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you 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$ */
+
+#include "commonj/sdo/SDOUtils.h"
+#include "commonj/sdo/TypeImpl.h"
+#include "commonj/sdo/DataObjectImpl.h"
+
+#include <stdio.h>
+using namespace std;
+
+//
+// Utility methods to print a DataObject tree
+//
+
+namespace commonj {
+ namespace sdo {
+ namespace internal {
+ const char *SDOUtils::CDataStartMarker = "XXXCDATA@STARTXXX";
+ const char *SDOUtils::XMLCDataStartMarker = "<![CDATA[";
+ const char *SDOUtils::CDataEndMarker = "XXXCDATA@ENDX";
+ const char *SDOUtils::XMLCDataEndMarker = "]]>";
+
+ const char *SDOUtils::sdoURI = "commonj.sdo";
+
+//////////////////////////////////////////////////////////////////////////
+// Conversions
+//////////////////////////////////////////////////////////////////////////
+
+
+ std::map<std::string,std::string> SDOUtils::SdoToXsd;
+
+ std::map<std::string,std::string> SDOUtils::XsdToSdo;
+
+ bool SDOUtils::populated = false;
+
+ bool SDOUtils::populate()
+ {
+ SDOUtils::XsdToSdo["ID"] = "String";
+ SDOUtils::XsdToSdo["NCName"] = "String";
+ SDOUtils::XsdToSdo["string"] = "String";
+ SDOUtils::XsdToSdo["anyType"] = "OpenDataObject";
+ SDOUtils::XsdToSdo["int"] = "Int";
+ SDOUtils::XsdToSdo["integer"] = "Integer";
+ SDOUtils::XsdToSdo["negativeInteger"] = "Integer";
+ SDOUtils::XsdToSdo["nonNegativeInteger"] = "Integer";
+ SDOUtils::XsdToSdo["positiveInteger"] = "Integer";
+ SDOUtils::XsdToSdo["nonpositiveInteger"] = "Integer";
+ SDOUtils::XsdToSdo["unsignedShort"] = "Integer";
+ SDOUtils::XsdToSdo["unsignedInt"] = "Integer";
+ SDOUtils::XsdToSdo["unsignedLong"] = "Long";
+ SDOUtils::XsdToSdo["double"] = "Double";
+ SDOUtils::XsdToSdo["short"] = "Short";
+ SDOUtils::XsdToSdo["unsignedByte"] = "Short";
+ SDOUtils::XsdToSdo["float"] = "Float";
+ SDOUtils::XsdToSdo["boolean"] = "Boolean";
+ SDOUtils::XsdToSdo["byte"] = "Byte";
+ SDOUtils::XsdToSdo["base64Binary"] = "Bytes";
+ SDOUtils::XsdToSdo["hexBinary"] = "Bytes";
+ SDOUtils::XsdToSdo["anyURI"] = "URI";
+ SDOUtils::XsdToSdo["QName"] = "URI";
+
+ SDOUtils::SdoToXsd["String"] = "string";
+ SDOUtils::SdoToXsd["OpenDataObject"] = "anyType";
+ SDOUtils::SdoToXsd["Integer"] = "integer";
+ SDOUtils::SdoToXsd["Int"] = "int";
+ SDOUtils::SdoToXsd["Long"] = "unsignedLong";
+ SDOUtils::SdoToXsd["Double"] = "double";
+ SDOUtils::SdoToXsd["Short"] = "short";
+ SDOUtils::SdoToXsd["Float"] = "float";
+ SDOUtils::SdoToXsd["Boolean"] = "boolean";
+ SDOUtils::SdoToXsd["Byte"] = "byte";
+ SDOUtils::SdoToXsd["Bytes"] = "base64Binary";
+ SDOUtils::SdoToXsd["URI"] = "anyURI";
+
+ SDOUtils::populated = true;
+ return true;
+ }
+
+ const char* SDOUtils::SDOToXSD(const char* sdoname)
+ {
+ if (sdoname == 0)
+ {
+ return SDOUtils::SdoToXsd["String"].c_str();
+ }
+ if (!SDOUtils::populated) SDOUtils::populate();
+ string& s = SDOUtils::SdoToXsd[sdoname];
+ if (s.empty())
+ {
+ return SDOUtils::SdoToXsd["String"].c_str();
+ }
+ return s.c_str();
+ }
+
+
+ const char* SDOUtils::XSDToSDO(const char* xsdname)
+ {
+ if (xsdname == 0)
+ {
+ return SDOUtils::XsdToSdo["string"].c_str();
+ }
+ if (!SDOUtils::populated) SDOUtils::populate();
+ string& s = SDOUtils::XsdToSdo[xsdname];
+ if (s.empty())
+ return SDOUtils::XsdToSdo["string"].c_str();
+ return s.c_str();
+ }
+
+ //////////////////////////////////////////////////////////////////////////
+ // Print Tabs
+ //////////////////////////////////////////////////////////////////////////
+
+ void SDOUtils::printTabs(ostream& out, unsigned int incr)
+ {
+ for (unsigned int ind=0; ind < incr; ind++)
+ {
+ out << " ";
+ }
+ }
+
+ //////////////////////////////////////////////////////////////////////////
+ // Print a DatObject tree
+ //////////////////////////////////////////////////////////////////////////
+
+ void SDOUtils::printDataObject(ostream& out, DataObjectPtr dataObject)
+ {
+ printDataObject(out, dataObject,0);
+ }
+
+
+ void SDOUtils::printDataObject(ostream& out ,DataObjectPtr dataObject,
+ unsigned int incr)
+ {
+
+ out << ">>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>> start of DO"
+ << endl;
+
+ if (!dataObject)return;
+
+ const Type& dataObjectType = dataObject->getType();
+ printTabs(out, incr);
+ out << "DataObject type: "
+ << dataObjectType.getURI()
+ << "#" << dataObjectType.getName() << endl;
+
+ incr++;
+
+ //////////////////////////////////////////////////////////////
+ // Iterate over all the properties
+ //////////////////////////////////////////////////////////////
+ PropertyList pl = dataObject->getInstanceProperties();
+ for (unsigned int i = 0; i < pl.size(); i++)
+ {
+ printTabs(out, incr);
+ out << "Property: " << pl[i].getName() << endl;
+
+ const Type& propertyType = pl[i].getType();
+
+ printTabs(out, incr);
+
+ out << "Property Type: "
+ << propertyType.getURI()
+ << "#" << propertyType.getName() << endl;
+
+ if (dataObject->isSet(pl[i]))
+ {
+
+ ///////////////////////////////////////////////////////////
+ // For a many-valued property get the list of values
+ ///////////////////////////////////////////////////////////
+ if (pl[i].isMany())
+ {
+ incr++;
+ DataObjectList& dol = dataObject->getList(pl[i]);
+ char cc[20];
+ for (unsigned int j = 0; j <dol.size(); j++)
+ {
+ printTabs(out, incr);
+ // seems to be a bug in ostream? Will not print j
+ // as an integer.
+ out << "Value ";
+ sprintf(cc,"%d",j);
+ out << cc;
+ out << endl;
+ incr++;
+ if (pl[i].isReference())
+ {
+ printTabs(out, incr);
+ out << "Reference Value: "
+ << staticCast<DataObjectImplPtr>(dol[j])->objectToXPath()
+ << endl;
+ }
+ else
+ {
+ printDataObject(out, dol[j],incr);
+ }
+ incr--;
+ out << endl;
+ }
+ incr--;
+ } // end IsMany
+
+ //////////////////////////////////////////////////////////////////////
+ // For a primitive data type print the value
+ //////////////////////////////////////////////////////////////////////
+ else if (propertyType.isDataType())
+ {
+ printTabs(out, incr);
+ out<< "Property Value: "
+ << dataObject->getCString(pl[i]) <<endl ;
+ }
+
+ //////////////////////////////////////////////////////////////////////
+ // For a dataobject print the do
+ //////////////////////////////////////////////////////////////////////
+ else
+ {
+ incr++;
+ if (pl[i].isReference())
+ {
+ printTabs(out, incr);
+ out << "Reference Value: "
+ << staticCast<DataObjectImplPtr>(dataObject->getDataObject(pl[i]))->objectToXPath()
+ << endl;
+ }
+ else
+ {
+ printDataObject(out, dataObject->getDataObject(pl[i]),incr);
+ }
+ incr--;
+ }
+ }
+ else
+ {
+ printTabs(out, incr);
+ out << "Property Value: not set" <<endl ;
+ }
+
+ }
+ incr--;
+ out << "<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<< end of do" << endl;
+ }
+
+
+ void SDOUtils::printTypes(std::ostream& out, DataFactoryPtr df)
+ {
+ TypeList tl = df->getTypes();
+ for (unsigned int i = 0; i < tl.size(); i++)
+ {
+ const TypeImpl& type = dynamic_cast<const TypeImpl&>(tl[i]);
+ out << "Type: " << type.getURI()<< "#" << type.getName() <<
+ " isOpen: " << type.isOpenType()
+ << " isSequenced: " << type.isSequencedType() << endl;
+
+ const std::vector<PropertyImplPtr> pl = type.getPropertyListReference();
+
+ for (std::vector<PropertyImplPtr>::const_iterator j = pl.begin();
+ j != pl.end();
+ j++)
+ {
+ PropertyPtr current = staticCast<PropertyPtr>(*j);
+
+ out << "\tProperty: "
+ << current->getName()
+ << " type: "
+ << current->getType().getURI()
+ << "#"
+ << current->getType().getName()
+ << " isMany: "
+ << current->isMany()
+ << endl;
+ }
+ }
+
+ }
+
+ /*
+ * A local utility function that replaces one string with and another within a
+ * host string and adjusts the lenght of the host string accordingly.
+ */
+ SDOString SDOUtils::replace(SDOString hostString, const char *fromString, const char *toString)
+ {
+ SDOString returnString("");
+
+ // find and replace all occurances of fromString with toString. The start, end
+ // and length variables are used to indicate the start, end and length
+ // of the text sections to be copied from the host string to the return
+ // string. toString is appended in between these copied sections because the
+ // string is broken whenever fromString is found
+ std::string::size_type start = 0;
+ std::string::size_type end = hostString.find(fromString, 0);
+ std::string::size_type length = 0;
+
+ while ( end != std::string::npos )
+ {
+ // copy all the text up to the fromString
+ length = end - start;
+ returnString.append(hostString.substr(start, length));
+
+ // add in the toString
+ returnString.append(toString);
+
+ // find the next fromString
+ start = end + strlen(fromString);
+ end = hostString.find(fromString, start);
+ }
+
+ // copy any text left at the end of the host string
+ returnString.append(hostString.substr(start));
+
+ return returnString;
+ }
+
+
+ } // end namespace intenral
+ } // end namespace sdo
+} // end namespace commonj
+
diff --git a/sdo-cpp/trunk/runtime/core/src/commonj/sdo/SDOUtils.h b/sdo-cpp/trunk/runtime/core/src/commonj/sdo/SDOUtils.h
new file mode 100644
index 0000000000..5ec505b509
--- /dev/null
+++ b/sdo-cpp/trunk/runtime/core/src/commonj/sdo/SDOUtils.h
@@ -0,0 +1,82 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you 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$ */
+
+#ifndef _SDOUTILS_H_
+#define _SDOUTILS_H_
+
+#include "commonj/sdo/DataObject.h"
+#include <map>
+#include <string>
+
+namespace commonj
+{
+ namespace sdo
+ {
+
+
+ namespace internal {
+
+ /**
+ * SDOUtils will provide utility functions.
+ * The class currently holds a method to print data objects.
+ */
+
+ class SDOUtils
+ {
+
+ public:
+
+ static SDO_API void printDataObject(std::ostream& out, DataObjectPtr d);
+ static SDO_API const char* SDOToXSD(const char* sdoname);
+ static SDO_API const char* XSDToSDO(const char* xsdname);
+ static SDO_API void printTypes(std::ostream& out, DataFactoryPtr df);
+ static SDOString replace(SDOString hostString, const char *fromString, const char *toString);
+
+ /*
+ * Markers used to represent the start and end of CDATA sections in the
+ * settings value. The noew XML CDATA markers are not used here because the
+ * XML string processing URL encodes parts of the markers
+ */
+ static SDO_API const char *CDataStartMarker;
+ static SDO_API const char *XMLCDataStartMarker;
+ static SDO_API const char *CDataEndMarker;
+ static SDO_API const char *XMLCDataEndMarker;
+
+ static SDO_API const char *sdoURI;
+
+ private:
+
+ static bool populate();
+ static bool populated;
+
+ static void printDataObject(std::ostream& out, DataObjectPtr d, unsigned int incr);
+ static void printTabs(std::ostream& out, unsigned int incr);
+
+ static std::map<std::string,std::string> XsdToSdo;
+ static std::map<std::string,std::string> SdoToXsd;
+
+ };
+ } // End - namespace internal
+ } // End - namespace sdo
+} // End - namespace commonj
+
+
+#endif //_SDOUTILS_H_
diff --git a/sdo-cpp/trunk/runtime/core/src/commonj/sdo/SDOValue.cpp b/sdo-cpp/trunk/runtime/core/src/commonj/sdo/SDOValue.cpp
new file mode 100644
index 0000000000..a95f2d72e0
--- /dev/null
+++ b/sdo-cpp/trunk/runtime/core/src/commonj/sdo/SDOValue.cpp
@@ -0,0 +1,236 @@
+/*
+ *
+ * Copyright 2007 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$ */
+
+#include "commonj/sdo/SDOValue.h"
+
+namespace commonj
+{
+ namespace sdo
+ {
+
+ SDOValue::SDOValue(const char* inValue, unsigned int len) :
+ typeOfValue(DataTypeInfo::SDOByteArray), transient_buffer(0)
+ {
+ char* temp_buffer = new char[len + 1];
+
+ // We would like to use strncpy at this point, but it is
+ // deprecated and its preferred alternative, strncpy_s, does
+ // not copy nulls if they appear in the input stream so we'll
+ // do it by hand.
+ for (unsigned int i = 0; i < len; i++)
+ {
+ temp_buffer[i] = (char) inValue[i];
+ }
+ temp_buffer[len] = 0;
+
+ value.TextString = new SDOString(temp_buffer, len);
+
+ delete[] temp_buffer;
+ }
+
+ SDOValue::SDOValue(const wchar_t* inValue, unsigned int len) :
+ typeOfValue(DataTypeInfo::SDOWideString), transient_buffer(0)
+ {
+ value.WideString.data = new wchar_t[len + 1];
+
+ for (unsigned int i = 0; i < len; i++)
+ {
+ value.WideString.data[i] = (wchar_t) inValue[i];
+ }
+ value.WideString.data[len] = (wchar_t) 0;
+
+ value.WideString.length = len; // NOTE: length is the number of _real_
+ // characters in the WideString
+
+ }
+
+ // Copy constructor
+ SDOValue::SDOValue(const SDOValue& inValue) :
+ typeOfValue(inValue.typeOfValue), transient_buffer(0)
+ {
+ switch (inValue.typeOfValue)
+ {
+ case DataTypeInfo::SDObool:
+ value.Boolean = inValue.value.Boolean;
+ break;
+ case DataTypeInfo::SDOchar:
+ value.Character = inValue.value.Character;
+ break;
+ case DataTypeInfo::SDOwchar_t:
+ value.WideChar = inValue.value.WideChar;
+ break;
+ case DataTypeInfo::SDOshort:
+ value.Short = inValue.value.Short;
+ break;
+ case DataTypeInfo::SDOlong:
+ value.Int = inValue.value.Int;
+ break;
+ case DataTypeInfo::SDOfloat:
+ value.Float = inValue.value.Float;
+ break;
+ case DataTypeInfo::SDOdouble:
+ value.Double = inValue.value.Double;
+ break;
+ case DataTypeInfo::SDOSDODate:
+ value.Date = new SDODate((inValue.value.Date)->getTime());
+ break;
+ case DataTypeInfo::SDOCString:
+ case DataTypeInfo::SDOByteArray:
+ value.TextString = new SDOString(*(inValue.value.TextString));
+ break;
+ case DataTypeInfo::SDOWideString:
+ value.WideString.data = new wchar_t[inValue.value.WideString.length + 1];
+ // The loop copies the null terminator that was added to the end
+ // of the source data when _it_ was constructed.
+ for (unsigned int i = 0; i <= inValue.value.WideString.length; i++)
+ {
+ value.WideString.data[i] = inValue.value.WideString.data[i];
+ }
+ value.WideString.length = inValue.value.WideString.length;
+ break;
+ }
+ }
+ // End of copy constructor
+
+ // Copy assignment
+ SDOValue& SDOValue::operator=(const SDOValue& inValue)
+ {
+ if (this != &inValue) // sval = sval is a no-op.
+ {
+ // Clear out any allocated data in the target SDOValue.
+ switch (typeOfValue)
+ {
+ case DataTypeInfo::SDOSDODate:
+ delete value.Date;
+ value.Date = 0;
+ break;
+ case DataTypeInfo::SDOCString:
+ case DataTypeInfo::SDOByteArray:
+ delete value.TextString;
+ value.TextString = 0;
+ break;
+ case DataTypeInfo::SDOWideString:
+ delete[] value.WideString.data;
+ value.WideString.data = 0;
+ value.WideString.length = 0;
+ break;
+ default:
+ // Nothing to delete.
+ break;
+ }
+
+ if (transient_buffer != 0)
+ {
+ delete transient_buffer;
+ transient_buffer = 0;
+ }
+
+ // Copy the source data into the target
+ switch (inValue.typeOfValue)
+ {
+ case DataTypeInfo::SDObool:
+ value.Boolean = inValue.value.Boolean;
+ break;
+ case DataTypeInfo::SDOchar:
+ value.Character = inValue.value.Character;
+ break;
+ case DataTypeInfo::SDOwchar_t:
+ value.WideChar = inValue.value.WideChar;
+ break;
+ case DataTypeInfo::SDOshort:
+ value.Short = inValue.value.Short;
+ break;
+ case DataTypeInfo::SDOlong:
+ value.Int = inValue.value.Int;
+ break;
+ case DataTypeInfo::SDOint64_t:
+ value.Int64 = inValue.value.Int64;
+ break;
+ case DataTypeInfo::SDOfloat:
+ value.Float = inValue.value.Float;
+ break;
+ case DataTypeInfo::SDOdouble:
+ value.Double = inValue.value.Double;
+ break;
+ case DataTypeInfo::SDOSDODate:
+ value.Date = new SDODate((inValue.value.Date)->getTime());
+ break;
+ case DataTypeInfo::SDOCString:
+ case DataTypeInfo::SDOByteArray:
+ value.TextString = new SDOString(*(inValue.value.TextString));
+ break;
+ case DataTypeInfo::SDOWideString:
+ value.WideString.data = new wchar_t[inValue.value.WideString.length + 1];
+ // The loop copies the null terminator that was added to the end
+ // of the source data when _it_ was constructed.
+ for (unsigned int i = 0; i <= inValue.value.WideString.length; i++)
+ {
+ value.WideString.data[i] = inValue.value.WideString.data[i];
+ }
+ value.WideString.length = inValue.value.WideString.length;
+ break;
+ }
+ // Finally, set the new type.
+ typeOfValue = inValue.typeOfValue;
+ }
+ return *this;
+ }
+ // End of copy assignment
+
+ // Destructor
+ SDOValue::~SDOValue()
+ {
+
+ // Clear out any allocated data in the target SDOValue.
+ switch (typeOfValue)
+ {
+ case DataTypeInfo::SDOSDODate:
+ delete value.Date;
+ value.Date = 0;
+ break;
+ case DataTypeInfo::SDOCString:
+ case DataTypeInfo::SDOByteArray:
+ delete value.TextString;
+ value.TextString = 0;
+ break;
+ case DataTypeInfo::SDOWideString:
+ delete[] value.WideString.data;
+ value.WideString.data = 0;
+ value.WideString.length = 0;
+ break;
+ default:
+ // Nothing to delete.
+ break;
+ }
+
+ if (transient_buffer != 0)
+ {
+ delete transient_buffer;
+ transient_buffer = 0;
+ }
+
+ typeOfValue = DataTypeInfo::SDOunset;
+ }
+ // End of Destructor
+
+
+ const SDOValue SDOValue::nullSDOValue = SDOValue(DataTypeInfo::SDOnull);
+ const SDOValue SDOValue::unsetSDOValue = SDOValue(DataTypeInfo::SDOunset);
+ } // End - namespace sdo
+} // End - namespace commonj
diff --git a/sdo-cpp/trunk/runtime/core/src/commonj/sdo/SDOValue.h b/sdo-cpp/trunk/runtime/core/src/commonj/sdo/SDOValue.h
new file mode 100644
index 0000000000..27ca7f3b54
--- /dev/null
+++ b/sdo-cpp/trunk/runtime/core/src/commonj/sdo/SDOValue.h
@@ -0,0 +1,258 @@
+/*
+*
+* Copyright 2007 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$ */
+
+#ifndef _SDOValue_H_
+#define _SDOValue_H_
+
+#include "commonj/sdo/export.h"
+#include "commonj/sdo/SDODate.h"
+#include "commonj/sdo/SDOString.h"
+#include "commonj/sdo/SDODataConverter.h"
+#include "commonj/sdo/DataTypeInfo.h"
+
+#include <iostream>
+
+namespace commonj
+{
+ namespace sdo
+ {
+
+ // The SDOValue class provides a discriminated data type that wraps the
+ // many different primitive data types that SDO must use. This allows
+ // common treatment of SDO values by all methods except those that
+ // really must do different things for different types. The key point is
+ // that instances of the class combine a union with and enum that says
+ // which member of the union is actually present. The enum also allows
+ // for the possibility that the value is unset or has been explicitly
+ // set to null.
+
+ class SDOValue
+ {
+ private:
+ // Entities with copy constructors/destructors are not allowed in a union,
+ // since in general, the compiler doesn't know what type is
+ // actually in there so it can't know which constructor/destructor
+ // to call, hence the use of pointers for certain datatypes.
+ DataTypeInfo::SDODataTypeUnion value;
+
+ DataTypeInfo::RawDataType typeOfValue;
+
+ mutable SDOString* transient_buffer;
+
+ public:
+
+ // Constructors
+ SDO_API SDOValue(bool inValue) :
+ typeOfValue(DataTypeInfo::SDObool), transient_buffer(0)
+ {
+ value.Boolean = inValue;
+ }
+ SDO_API SDOValue(float inValue) :
+ typeOfValue(DataTypeInfo::SDOfloat), transient_buffer(0)
+ {
+ value.Float = inValue;
+ }
+ SDO_API SDOValue(long double inValue) :
+ typeOfValue(DataTypeInfo::SDOdouble), transient_buffer(0)
+ {
+ value.Double = inValue;
+ }
+ SDO_API SDOValue(short inValue) :
+ typeOfValue(DataTypeInfo::SDOshort), transient_buffer(0)
+ {
+ value.Short = inValue;
+ }
+#if __WORDSIZE != 64
+ SDO_API SDOValue(long inValue) :
+ typeOfValue(DataTypeInfo::SDOlong), transient_buffer(0)
+ {
+ value.Int = inValue;
+ }
+#endif
+ SDO_API SDOValue(int64_t inValue) :
+ typeOfValue(DataTypeInfo::SDOint64_t), transient_buffer(0)
+ {
+ value.Int64 = inValue;
+ }
+ SDO_API SDOValue(char inValue) :
+ typeOfValue(DataTypeInfo::SDOchar), transient_buffer(0)
+ {
+ value.Character = inValue;
+ }
+ SDO_API SDOValue(wchar_t inValue) :
+ typeOfValue(DataTypeInfo::SDOwchar_t), transient_buffer(0)
+ {
+ value.WideChar = inValue;
+ }
+ SDO_API SDOValue(const SDODate inValue) :
+ typeOfValue(DataTypeInfo::SDOSDODate), transient_buffer(0)
+ {
+ value.Date = new SDODate(inValue.getTime());
+ }
+ SDO_API SDOValue(const SDOString& inValue) :
+ typeOfValue(DataTypeInfo::SDOCString), transient_buffer(0)
+ {
+ value.TextString = new SDOString(inValue);
+ }
+
+ SDO_API SDOValue(const char* inValue) :
+ typeOfValue(DataTypeInfo::SDOCString), transient_buffer(0)
+ {
+ value.TextString = new SDOString(inValue);
+ }
+
+ SDO_API SDOValue(const char* inValue, unsigned int len);
+
+ SDO_API SDOValue(const wchar_t* inValue, unsigned int len);
+
+ SDO_API SDOValue() : typeOfValue(DataTypeInfo::SDOunset), transient_buffer(0)
+ {
+ }
+ //End of Constructors
+
+ // Copy constructor
+ SDO_API SDOValue(const SDOValue& inValue);
+
+ // Copy assignment
+ SDO_API SDOValue& operator=(const SDOValue& inValue);
+
+ // Destructor
+ SDO_API virtual ~SDOValue();
+
+ inline SDO_API bool isSet() const
+ {
+ return (typeOfValue != DataTypeInfo::SDOunset);
+ }
+ inline SDO_API bool isNull() const
+ {
+ return (typeOfValue == DataTypeInfo::SDOnull);
+ }
+
+ // Get methods to retrieve the stored value.
+ SDO_API bool getBoolean() const
+ {
+ return SDODataConverter::convertToBoolean(value,
+ (DataTypeInfo::TrueDataType) typeOfValue);
+ }
+
+ SDO_API float getFloat() const
+ {
+ return SDODataConverter::convertToFloat(value,
+ (DataTypeInfo::TrueDataType) typeOfValue);
+ }
+
+ SDO_API long double getDouble() const
+ {
+ return SDODataConverter::convertToDouble(value,
+ (DataTypeInfo::TrueDataType) typeOfValue);
+ }
+
+ SDO_API const SDODate getDate() const
+ {
+ return SDODataConverter::convertToDate(value,
+ (DataTypeInfo::TrueDataType) typeOfValue);
+ }
+
+ SDO_API short getShort() const
+ {
+ return SDODataConverter::convertToShort(value,
+ (DataTypeInfo::TrueDataType) typeOfValue);
+ }
+
+ SDO_API long getInt() const
+ {
+ return SDODataConverter::convertToInt(value,
+ (DataTypeInfo::TrueDataType) typeOfValue);
+ }
+
+ SDO_API char getByte() const
+ {
+ return SDODataConverter::convertToByte(value,
+ (DataTypeInfo::TrueDataType) typeOfValue);
+ }
+
+ SDO_API wchar_t getCharacter() const
+ {
+ return SDODataConverter::convertToCharacter(value,
+ (DataTypeInfo::TrueDataType) typeOfValue);
+ }
+
+ SDO_API int64_t getLong() const
+ {
+ return SDODataConverter::convertToLong(value,
+ (DataTypeInfo::TrueDataType) typeOfValue);
+ }
+
+ // The following method is regrettably necessary to provide the
+ // CString style interface for the V2.01 spec.
+ SDO_API const char* getCString() const
+ {
+ if (transient_buffer != 0)
+ {
+ delete transient_buffer;
+ }
+ transient_buffer =
+ SDODataConverter::convertToSDOString(value,
+ (DataTypeInfo::TrueDataType) typeOfValue);
+ return transient_buffer->c_str();
+ }
+
+ // This method is the preferred way to retrieve a string value
+ SDO_API SDOString getString() const
+ {
+ return *SDODataConverter::convertToSDOString(value,
+ (DataTypeInfo::TrueDataType) typeOfValue);
+ }
+
+ SDO_API unsigned int getString(wchar_t* outptr, const unsigned int max_length) const
+ {
+ return SDODataConverter::convertToString(value,
+ (DataTypeInfo::TrueDataType) typeOfValue,
+ outptr,
+ max_length);
+ }
+
+ SDO_API unsigned int getBytes(char* outptr, const unsigned int max_length) const
+ {
+ return SDODataConverter::convertToBytes(value,
+ (DataTypeInfo::TrueDataType) typeOfValue,
+ outptr,
+ max_length);
+ }
+
+ // Beware, the array does not contain values for all the
+ // enumeration values and it is the callers job to avoid
+ // triggering that.
+ SDO_API const char* convertTypeEnumToString() const
+ {
+ return DataTypeInfo::convertTypeEnumToString((DataTypeInfo::TrueDataType) typeOfValue);
+ }
+
+ static SDO_API const SDOValue nullSDOValue;
+ static SDO_API const SDOValue unsetSDOValue;
+ // static SDO_API const SDOString rawTypeNames[];
+
+ private:
+ SDO_API SDOValue(DataTypeInfo::RawDataType rdt) : typeOfValue(rdt), transient_buffer(0) {}
+
+ };
+ } // End - namespace sdo
+} // End - namespace commonj
+
+#endif // _SDOValue_H_
diff --git a/sdo-cpp/trunk/runtime/core/src/commonj/sdo/SDOXMLBufferWriter.cpp b/sdo-cpp/trunk/runtime/core/src/commonj/sdo/SDOXMLBufferWriter.cpp
new file mode 100644
index 0000000000..ae87c84832
--- /dev/null
+++ b/sdo-cpp/trunk/runtime/core/src/commonj/sdo/SDOXMLBufferWriter.cpp
@@ -0,0 +1,58 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you 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$ */
+
+#include "commonj/sdo/SDOXMLBufferWriter.h"
+#include "commonj/sdo/SDORuntimeException.h"
+
+namespace commonj
+{
+ namespace sdo
+ {
+
+
+
+
+ SDOXMLBufferWriter::SDOXMLBufferWriter(DataFactoryPtr dataFactory)
+ : SDOXMLWriter(dataFactory)
+ {
+ buf = xmlBufferCreate();
+ if (buf == NULL)
+ {
+ throw SDOXMLParserException(TUSCANY_SDO_EINFO,
+ "xmlBufferCreate failed");
+ }
+ setWriter(xmlNewTextWriterMemory(buf, 0));
+ }
+
+ SDOXMLBufferWriter::~SDOXMLBufferWriter()
+ {
+ freeWriter();
+ xmlBufferFree(buf);
+ }
+
+ SDOXMLString SDOXMLBufferWriter::getBuffer()
+ {
+ freeWriter();
+ return buf->content;
+ }
+ } // End - namespace sdo
+} // End - namespace commonj
+
diff --git a/sdo-cpp/trunk/runtime/core/src/commonj/sdo/SDOXMLBufferWriter.h b/sdo-cpp/trunk/runtime/core/src/commonj/sdo/SDOXMLBufferWriter.h
new file mode 100644
index 0000000000..bcfb226806
--- /dev/null
+++ b/sdo-cpp/trunk/runtime/core/src/commonj/sdo/SDOXMLBufferWriter.h
@@ -0,0 +1,53 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you 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$ */
+
+#ifndef _SDOXMLBUFFERWRITER_H_
+#define _SDOXMLBUFFERWRITER_H_
+
+#include "commonj/sdo/disable_warn.h"
+
+#include "commonj/sdo/SDOXMLWriter.h"
+
+namespace commonj
+{
+ namespace sdo
+ {
+
+/**
+ * SDOXMLBufferWriter extends SDOXMLWriter and writes a buffer.
+ */
+ class SDOXMLBufferWriter : public SDOXMLWriter
+ {
+
+ public:
+
+ SDOXMLBufferWriter(DataFactoryPtr dataFactory = NULL);
+ virtual ~SDOXMLBufferWriter();
+
+ SDOXMLString getBuffer();
+ private:
+ xmlBufferPtr buf;
+ };
+ } // End - namespace sdo
+} // End - namespace commonj
+
+
+#endif //_SDOXMLBUFFERWRITER_H_
diff --git a/sdo-cpp/trunk/runtime/core/src/commonj/sdo/SDOXMLFileWriter.cpp b/sdo-cpp/trunk/runtime/core/src/commonj/sdo/SDOXMLFileWriter.cpp
new file mode 100644
index 0000000000..6420af9a96
--- /dev/null
+++ b/sdo-cpp/trunk/runtime/core/src/commonj/sdo/SDOXMLFileWriter.cpp
@@ -0,0 +1,46 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you 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$ */
+
+#include "commonj/sdo/SDOXMLFileWriter.h"
+
+namespace commonj
+{
+ namespace sdo
+ {
+
+
+
+
+ SDOXMLFileWriter::SDOXMLFileWriter(const char* xmlFile, DataFactoryPtr dataFactory)
+ : SDOXMLWriter(dataFactory)
+ {
+ setWriter(xmlNewTextWriterFilename(xmlFile, 0));
+ }
+
+ SDOXMLFileWriter::~SDOXMLFileWriter()
+ {
+
+ }
+
+
+ } // End - namespace sdo
+} // End - namespace commonj
+
diff --git a/sdo-cpp/trunk/runtime/core/src/commonj/sdo/SDOXMLFileWriter.h b/sdo-cpp/trunk/runtime/core/src/commonj/sdo/SDOXMLFileWriter.h
new file mode 100644
index 0000000000..83e2aa5a2c
--- /dev/null
+++ b/sdo-cpp/trunk/runtime/core/src/commonj/sdo/SDOXMLFileWriter.h
@@ -0,0 +1,54 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you 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$ */
+
+#ifndef _SDOXMLFILEWRITER_H_
+#define _SDOXMLFILEWRITER_H_
+
+#include "commonj/sdo/disable_warn.h"
+
+#include "commonj/sdo/SDOXMLWriter.h"
+
+
+
+namespace commonj
+{
+ namespace sdo
+ {
+
+/**
+ * SDOXMLFileWriter extends SDOXMLWriter and writes a file.
+ */
+ class SDOXMLFileWriter : public SDOXMLWriter
+ {
+
+ public:
+
+ SDOXMLFileWriter(const char* xmlFile, DataFactoryPtr dataFactory = NULL);
+
+ virtual ~SDOXMLFileWriter();
+
+
+ };
+ } // End - namespace sdo
+} // End - namespace commonj
+
+
+#endif //_SDOXMLFILEWRITER_H_
diff --git a/sdo-cpp/trunk/runtime/core/src/commonj/sdo/SDOXMLStreamWriter.cpp b/sdo-cpp/trunk/runtime/core/src/commonj/sdo/SDOXMLStreamWriter.cpp
new file mode 100644
index 0000000000..12b1e59b9e
--- /dev/null
+++ b/sdo-cpp/trunk/runtime/core/src/commonj/sdo/SDOXMLStreamWriter.cpp
@@ -0,0 +1,52 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you 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$ */
+
+#include "commonj/sdo/SDOXMLStreamWriter.h"
+#include <sstream>
+
+namespace commonj
+{
+ namespace sdo
+ {
+
+
+
+
+ SDOXMLStreamWriter::SDOXMLStreamWriter(std::ostream& outXML, DataFactoryPtr dataFactory)
+ : SDOXMLBufferWriter(dataFactory), outXmlStream(outXML)
+ {
+ }
+
+ SDOXMLStreamWriter::~SDOXMLStreamWriter()
+ {
+ }
+
+ int SDOXMLStreamWriter::write(XMLDocumentPtr doc, int indent)
+ {
+ int rc = SDOXMLBufferWriter::write(doc, indent);
+
+ // Now stream the buffer
+ outXmlStream << getBuffer();
+ return rc;
+ }
+ } // End - namespace sdo
+} // End - namespace commonj
+
diff --git a/sdo-cpp/trunk/runtime/core/src/commonj/sdo/SDOXMLStreamWriter.h b/sdo-cpp/trunk/runtime/core/src/commonj/sdo/SDOXMLStreamWriter.h
new file mode 100644
index 0000000000..977ff63a63
--- /dev/null
+++ b/sdo-cpp/trunk/runtime/core/src/commonj/sdo/SDOXMLStreamWriter.h
@@ -0,0 +1,56 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you 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$ */
+
+#ifndef _SDOXMLSTREAMWRITER_H_
+#define _SDOXMLSTREAMWRITER_H_
+
+#include "commonj/sdo/disable_warn.h"
+
+#include "commonj/sdo/SDOXMLBufferWriter.h"
+#include <iostream>
+
+
+namespace commonj
+{
+ namespace sdo
+ {
+
+/**
+ * SDOXMLStreamWriter extends SDOXMLWriter and writes a stream.
+ */
+ class SDOXMLStreamWriter : public SDOXMLBufferWriter
+ {
+
+ public:
+
+ SDOXMLStreamWriter(std::ostream& outXML, DataFactoryPtr dataFactory = NULL);
+ virtual ~SDOXMLStreamWriter();
+
+ int write(XMLDocumentPtr doc, int indent = -1);
+ private:
+ std::ostream& outXmlStream;
+
+ };
+ } // End - namespace sdo
+} // End - namespace commonj
+
+
+#endif //_SDOXMLSTREAMWRITER_H_
diff --git a/sdo-cpp/trunk/runtime/core/src/commonj/sdo/SDOXMLString.cpp b/sdo-cpp/trunk/runtime/core/src/commonj/sdo/SDOXMLString.cpp
new file mode 100644
index 0000000000..51dacf291b
--- /dev/null
+++ b/sdo-cpp/trunk/runtime/core/src/commonj/sdo/SDOXMLString.cpp
@@ -0,0 +1,235 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you 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$ */
+
+#include "commonj/sdo/SDOXMLString.h"
+#include <iostream>
+#include <libxml/xmlstring.h>
+#include "libxml/globals.h"
+
+#include <ctype.h>
+
+namespace commonj
+{
+ namespace sdo
+ {
+
+ SDOXMLString::SDOXMLString()
+ : xmlForm(0)
+ {
+ }
+
+ SDOXMLString::SDOXMLString(const xmlChar* xmlString)
+ {
+ xmlForm = xmlStrdup(xmlString);
+ }
+
+ SDOXMLString::SDOXMLString(const char* localString)
+ {
+ xmlForm = xmlCharStrdup(localString);
+ }
+
+ SDOXMLString::SDOXMLString(const SDOXMLString& str)
+ {
+ xmlForm = xmlStrdup(str.xmlForm);
+ }
+
+ SDOXMLString::SDOXMLString(const xmlChar* str, int start, int len)
+ {
+ xmlForm = xmlStrsub(str, start, len);
+ }
+
+ SDOXMLString& SDOXMLString::operator=(const SDOXMLString& str)
+ {
+ if (this != &str)
+ {
+ release();
+ xmlForm = xmlStrdup(str.xmlForm);
+ }
+ return *this;
+ }
+
+ SDOXMLString::operator std::string() const
+ {
+ if (xmlForm)
+ {
+ return (const char *)xmlForm;
+ }
+ return "";
+ }
+
+ SDOXMLString SDOXMLString::operator+(const SDOXMLString& str) const
+ {
+ xmlChar* newString = xmlStrncatNew(xmlForm, str.xmlForm, xmlStrlen(str.xmlForm));
+ SDOXMLString retString(newString);
+ if (newString)
+ xmlFree(newString);
+ return retString;
+ }
+
+ SDOXMLString& SDOXMLString::operator+=(const SDOXMLString& str)
+ {
+ xmlForm = xmlStrncat(xmlForm, str.xmlForm, xmlStrlen(str.xmlForm));
+ return *this;
+ }
+
+ SDOXMLString::~SDOXMLString()
+ {
+ release();
+ }
+
+ void SDOXMLString::release()
+ {
+ if (xmlForm)
+ xmlFree((void*)xmlForm);
+ }
+
+ bool SDOXMLString::operator< (const SDOXMLString& str) const
+ {
+ if (xmlStrcmp(xmlForm, str.xmlForm) <0)
+ return true;
+ else
+ return false;
+ }
+
+ bool SDOXMLString::operator==(const SDOXMLString& str) const
+ {
+ if (xmlStrEqual(xmlForm, str.xmlForm))
+ return true;
+ else
+ return false;
+ }
+
+ bool SDOXMLString::equals(const SDOXMLString& str) const
+ {
+ return equals(str.xmlForm);
+ }
+
+ bool SDOXMLString::equals(const char* localString) const
+ {
+ return equals(SDOXMLString(localString));
+ }
+
+
+ bool SDOXMLString::equals(const xmlChar* xmlString) const
+ {
+ if (xmlStrEqual(xmlForm, xmlString))
+ return true;
+ else
+ return false;
+ }
+
+ bool SDOXMLString::equalsIgnoreCase(const SDOXMLString& str) const
+ {
+ return equalsIgnoreCase(str.xmlForm);
+ }
+
+ bool SDOXMLString::equalsIgnoreCase(const char* localString) const
+ {
+ return equalsIgnoreCase(SDOXMLString(localString));
+ }
+
+
+ bool SDOXMLString::equalsIgnoreCase(const xmlChar* xmlString) const
+ {
+ if (xmlStrcasecmp(xmlForm, xmlString) == 0)
+ return true;
+ else
+ return false;
+ }
+
+
+ std::ostream& operator<<(std::ostream& output, const SDOXMLString& str)
+ {
+ if (str.xmlForm)
+ output << str.xmlForm;
+ return output;
+ }
+
+ bool SDOXMLString::isNull() const
+ {
+ if (xmlForm)
+ return false;
+ else
+ return true;
+ }
+
+ SDOXMLString SDOXMLString::toLower(unsigned int start, unsigned int length)
+ {
+ char* newString = new char[strlen(*this)+1];
+ strcpy(newString, *this);
+ for (unsigned int i = start; (i<=(strlen(newString)) && i < length); i++)
+ {
+ newString[i] = tolower(newString[i]);
+ }
+ SDOXMLString retString(newString);
+ delete[] newString;
+ return retString;
+ }
+
+ int SDOXMLString::firstIndexOf(const char ch) const
+ {
+ const xmlChar* loc = xmlStrchr(xmlForm, ch);
+ if (loc == 0)
+ {
+ return -1;
+ }
+
+ return int(loc-xmlForm);
+ }
+
+ int SDOXMLString::lastIndexOf(const char ch) const
+ {
+ const xmlChar* index = 0;
+ const xmlChar* loc = xmlStrchr(xmlForm, ch);
+ while (loc !=0)
+ {
+ index = loc;
+ loc = xmlStrchr(loc+1, ch);
+ }
+
+ if (index == 0)
+ return -1;
+
+ return int(index-xmlForm);
+ }
+
+ SDOXMLString SDOXMLString::substring(int start, int length) const
+ {
+ if (length >0)
+ {
+ return SDOXMLString(xmlForm, start, length);
+ }
+ else
+ return SDOXMLString();
+ }
+
+ SDOXMLString SDOXMLString::substring(int start) const
+ {
+
+ return SDOXMLString(xmlForm, start, xmlStrlen(xmlForm) - start);
+ }
+
+
+ } // End - namespace sdo
+} // End - namespace commonj
+
+
+
diff --git a/sdo-cpp/trunk/runtime/core/src/commonj/sdo/SDOXMLString.h b/sdo-cpp/trunk/runtime/core/src/commonj/sdo/SDOXMLString.h
new file mode 100644
index 0000000000..5471e71169
--- /dev/null
+++ b/sdo-cpp/trunk/runtime/core/src/commonj/sdo/SDOXMLString.h
@@ -0,0 +1,96 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you 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$ */
+
+#include "commonj/sdo/disable_warn.h"
+
+#ifndef _SDOXMLString_H_
+#define _SDOXMLString_H_
+#include "commonj/sdo/export.h"
+
+#include <iostream>
+
+typedef unsigned char xmlChar;
+
+namespace commonj
+{
+ namespace sdo
+ {
+
+ /**
+ * SDOXMLString - utility class for string handling.
+ * Keeps the string handling local to one place, so we can
+ * replace it with a more NLS friendly version later.
+ * Many places within the core should use this too instead
+ * of allocated char* buffers. (DataObject etc...)
+ */
+
+ class SDOXMLString
+ {
+ public:
+ SDO_SPI SDOXMLString();
+ SDO_SPI SDOXMLString(const xmlChar* xmlString);
+ SDO_SPI SDOXMLString(const char* localString);
+ SDO_SPI SDOXMLString(const SDOXMLString& str);
+ SDO_SPI SDOXMLString(const xmlChar* str, int start, int len);
+ SDO_SPI virtual ~SDOXMLString();
+
+ SDO_SPI SDOXMLString& operator=(const SDOXMLString& str);
+ SDO_SPI SDOXMLString operator+(const SDOXMLString& str) const;
+ SDO_SPI SDOXMLString& operator+=(const SDOXMLString& str);
+
+
+ SDO_SPI bool operator== (const SDOXMLString& str) const;
+ SDO_SPI bool equals(const xmlChar* xmlString) const;
+ SDO_SPI bool equals(const char* localString) const;
+ SDO_SPI bool equals(const SDOXMLString& str) const;
+ SDO_SPI bool equalsIgnoreCase(const xmlChar* xmlString) const;
+ SDO_SPI bool equalsIgnoreCase(const char* localString) const;
+ SDO_SPI bool equalsIgnoreCase(const SDOXMLString& str) const;
+
+ SDO_SPI bool operator< (const SDOXMLString& str) const;
+
+ SDO_SPI operator std::string() const;
+ SDO_SPI operator const char*() const {return (const char*) xmlForm;}
+ SDO_SPI operator const xmlChar*() const {return xmlForm;}
+
+ SDO_SPI friend std::ostream& operator<<(std::ostream& output, const SDOXMLString& str);
+
+ SDO_SPI bool isNull() const;
+
+ SDO_SPI SDOXMLString toLower(
+ unsigned int start = 0,
+ unsigned int length = 0);
+
+
+ SDO_SPI int firstIndexOf(const char ch) const;
+ SDO_SPI int lastIndexOf(const char ch) const;
+ SDO_SPI SDOXMLString substring(int start, int length) const;
+ SDO_SPI SDOXMLString substring(int start) const;
+ private :
+ xmlChar* xmlForm;
+ void release();
+ };
+ } // End - namespace sdo
+} // End - namespace commonj
+
+
+
+#endif // _SDOXMLString_H_
diff --git a/sdo-cpp/trunk/runtime/core/src/commonj/sdo/SDOXMLWriter.cpp b/sdo-cpp/trunk/runtime/core/src/commonj/sdo/SDOXMLWriter.cpp
new file mode 100644
index 0000000000..e6330e1ba7
--- /dev/null
+++ b/sdo-cpp/trunk/runtime/core/src/commonj/sdo/SDOXMLWriter.cpp
@@ -0,0 +1,1419 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you 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$ */
+
+#include "commonj/sdo/SDOXMLWriter.h"
+#include "commonj/sdo/SDOXMLString.h"
+#include "commonj/sdo/SDOString.h"
+#include "iostream"
+using namespace::std;
+#include "commonj/sdo/DASProperty.h"
+#include "commonj/sdo/XSDPropertyInfo.h"
+#include "commonj/sdo/XSDTypeInfo.h"
+#include "commonj/sdo/ChangeSummary.h"
+#include "commonj/sdo/Sequence.h"
+#include "commonj/sdo/SDORuntimeException.h"
+#include "commonj/sdo/XMLQName.h"
+#include "commonj/sdo/DataObjectImpl.h"
+#include "commonj/sdo/DataFactoryImpl.h"
+#include "commonj/sdo/PropertySetting.h"
+#include "commonj/sdo/SDOUtils.h"
+
+namespace commonj
+{
+ namespace sdo
+ {
+
+ using internal::XSDPropertyInfo;
+ using internal::PropertyDefinitionImpl;
+ using internal::XSDTypeInfo;
+ using internal::TypeDefinitionImpl;
+ using internal::SDOUtils;
+
+ const SDOXMLString SDOXMLWriter::s_xsi("xsi");
+ const SDOXMLString SDOXMLWriter::s_type("type");
+ const SDOXMLString SDOXMLWriter::s_nil("nil");
+ const SDOXMLString SDOXMLWriter::s_true("true");
+ const SDOXMLString SDOXMLWriter::s_xsiNS("http://www.w3.org/2001/XMLSchema-instance");
+ const SDOXMLString SDOXMLWriter::s_xmlns("xmlns");
+ const SDOXMLString SDOXMLWriter::s_commonjsdo("commonj.sdo");
+ const SDOXMLString SDOXMLWriter::s_wsdluri("http://schemas.xmlsoap.org/wsdl/");
+ const SDOXMLString SDOXMLWriter::s_wsdl("wsdl");
+ const SDOXMLString SDOXMLWriter::s_soapuri("http://schemas.xmlsoap.org/wsdl/soap/");
+ const SDOXMLString SDOXMLWriter::s_soap("soap");
+ const SDOXMLString SDOXMLWriter::s_httpuri("http://schemas.xmlsoap.org/wsdl/http/");
+ const SDOXMLString SDOXMLWriter::s_http("http");
+
+
+ SDOXMLWriter::SDOXMLWriter(
+ DataFactoryPtr dataFact)
+ : dataFactory(dataFact)
+ {
+
+ }
+
+ SDOXMLWriter::~SDOXMLWriter()
+ {
+ freeWriter();
+ }
+
+ void SDOXMLWriter::setWriter(xmlTextWriterPtr textWriter)
+ {
+ writer = textWriter;
+ }
+
+ void SDOXMLWriter::freeWriter()
+ {
+ if (writer != NULL)
+ {
+ xmlFreeTextWriter(writer);
+ writer = NULL;
+ }
+ }
+
+ int SDOXMLWriter::write(XMLDocumentPtr doc, int indent)
+ {
+ if (!doc)
+ {
+ return 0;
+ }
+
+ if (writer == NULL)
+ {
+ // Throw exception
+ return -1;
+ }
+
+ int rc = 0;
+ namespaceMap.empty();
+
+ if (indent >= 0)
+ {
+ xmlTextWriterSetIndent(writer, 1);
+ if (indent > 0)
+ {
+ char * chars = new char[indent+1];
+ for (int i=0;i<indent;i++)chars[i] = ' ';
+ chars[indent] = 0;
+ xmlTextWriterSetIndentString(writer, SDOXMLString(chars));
+ delete[] chars;
+ }
+ else
+ {
+ xmlTextWriterSetIndentString(writer, SDOXMLString(""));
+ }
+ }
+
+ if (doc->getXMLDeclaration())
+ {
+ rc = xmlTextWriterStartDocument(writer, doc->getXMLVersion(), doc->getEncoding(), NULL);
+ if (rc < 0) {
+ throw SDOXMLParserException(TUSCANY_SDO_EINFO,
+ "xmlTextWriterStartDocument failed");
+ }
+ }
+
+ DataObjectPtr root = doc->getRootDataObject();
+ if (root)
+ {
+ const Type& rootType = root->getType();
+ SDOXMLString rootTypeURI = rootType.getURI();
+ SDOXMLString rootTypeName = rootType.getName();
+
+ // For the root DataObject we need to determine the element name
+ SDOXMLString elementURI = doc->getRootElementURI();
+ SDOXMLString elementName = doc->getRootElementName();
+ if (elementName.isNull() || elementName.equals(""))
+ {
+ elementName = rootTypeName;
+ elementName = elementName.toLower(0,1);
+ }
+
+ // If the element name is defined as a global element then we
+ // can supress the writing of xsi:type according to the spec
+ bool writeXSIType = true;
+
+ try
+ {
+ // Locate the RootType
+ const Type& rootTy = dataFactory->getType(elementURI, "RootType");
+ // Does a property exist with the given element name?
+ const Property& rootProp = rootTy.getProperty((const char*)elementName);
+ // Is this property of the correct Type?
+ const Type& rootPropType = rootProp.getType();
+ if (rootTypeURI == (SDOXMLString)rootPropType.getURI()
+ && rootTypeName == (SDOXMLString)rootPropType.getName())
+ {
+ writeXSIType = false;
+ }
+ }
+ catch(SDORuntimeException&)
+ {
+ }
+
+ // Supress the writing of xsi:type as well for DataObjects of type
+ // commonj.sdo#OpenDataObject
+ if (writeXSIType &&
+ rootTypeURI.equals("commonj.sdo") && rootTypeName.equals("OpenDataObject"))
+ {
+ writeXSIType = false;
+ }
+
+ writeDO(root, elementURI, elementName, writeXSIType, true);
+ }
+ rc = xmlTextWriterEndDocument(writer);
+ if (rc < 0) {
+ throw SDOXMLParserException(TUSCANY_SDO_EINFO,
+ "xmlTextWriterEndDocument failed");
+ return rc;
+ }
+
+ xmlTextWriterFlush(writer);
+ freeWriter();
+
+ return rc;
+ }
+
+ //////////////////////////////////////////////////////////////////////////
+ // Write Change Summary attributes
+ //////////////////////////////////////////////////////////////////////////
+
+ void SDOXMLWriter::handleChangeSummaryAttributes(
+ ChangeSummaryPtr cs,
+ DataObjectPtr dol)
+ {
+ int rc;
+
+ SettingList& sl = cs->getOldValues(dol);
+ if (sl.size() == 0)
+ {
+ // no attributes
+ return;
+ }
+ for (int j=0;j< sl.size(); j++)
+ {
+ try {
+
+ if (sl.get(j)->getProperty().isMany())
+ {
+ // manys are elements
+ continue;
+ }
+
+ if (sl.get(j)->getProperty().getType().isDataType())
+ {
+ // data types are OK
+ rc = xmlTextWriterWriteAttribute(writer,
+ SDOXMLString(sl.get(j)->getProperty().getName()),
+ SDOXMLString(sl.get(j)->getCStringValue()));
+ }
+ else
+ {
+ DataObjectPtr dob = sl.get(j)->getDataObjectValue();
+ if (dob)
+ {
+ if (cs->isDeleted(dob))
+ {
+ rc = xmlTextWriterWriteAttribute(writer,
+ SDOXMLString(sl.get(j)->getProperty().getName()),
+ SDOXMLString(cs->getOldXpath(dob)));
+ }
+ else
+ {
+ rc = xmlTextWriterWriteAttribute(writer,
+ SDOXMLString(sl.get(j)->getProperty().getName()),
+ SDOXMLString(staticCast<DataObjectImplPtr>(dob)->objectToXPath()));
+ }
+ }
+ else
+ {
+ rc = xmlTextWriterWriteAttribute(writer,
+ SDOXMLString(sl.get(j)->getProperty().getName()),
+ SDOXMLString(""));
+ }
+ }
+ }
+ catch (SDORuntimeException e)
+ {
+ // ignore this attribute
+ }
+ }
+ }
+
+ //////////////////////////////////////////////////////////////////////////
+ // Write Change Summary elements
+ //////////////////////////////////////////////////////////////////////////
+
+ void SDOXMLWriter::handleChangeSummaryElements(
+ ChangeSummaryPtr cs,
+ DataObjectPtr dob)
+ {
+ int rc;
+
+ SettingList& sl = cs->getOldValues(dob);
+
+ if (sl.size() == 0)
+ {
+ // there are no setting for this element.
+ return;
+ }
+
+ for (int j=0;j< sl.size(); j++)
+ {
+ try
+ {
+
+ // single values will have been covered by the attributes.
+ if (!sl.get(j)->getProperty().isMany()) continue;
+
+ if (sl.get(j)->getProperty().getType().isDataType())
+ {
+
+ rc = xmlTextWriterWriteElement(
+ writer,
+ SDOXMLString(sl.get(j)->getProperty().getName()),
+ SDOXMLString(sl.get(j)->getCStringValue()));
+
+ } // if datatype
+ else
+ {
+ DataObjectPtr dob2 = sl.get(j)->getDataObjectValue();
+ if (!dob2)
+ {
+ continue;
+ }
+ if (cs->isDeleted(dob2))
+ {
+ handleChangeSummaryDeletedObject(sl.get(j)->getProperty().getName(), cs,dob2);
+ }
+ else
+ {
+ rc = xmlTextWriterStartElement(
+ writer,
+ SDOXMLString(sl.get(j)->getProperty().getName()));
+ rc = xmlTextWriterWriteAttribute(
+ writer,
+ SDOXMLString("sdo:ref"),
+ SDOXMLString(staticCast<DataObjectImplPtr>(dob2)->objectToXPath()));
+ rc = xmlTextWriterEndElement(
+ writer);
+ }
+ }
+ }
+ catch (SDORuntimeException e)
+ {
+ // ignore this element
+ }
+ } // for
+ }
+
+
+ //////////////////////////////////////////////////////////////////////////
+ // Write a deleted object and all its props
+ //////////////////////////////////////////////////////////////////////////
+
+ void SDOXMLWriter::handleChangeSummaryDeletedObject(
+ const char* name,
+ ChangeSummaryPtr cs,
+ DataObjectPtr dob)
+ {
+
+ int rc, k; // TODO error handling
+
+ SettingList& sl = cs->getOldValues(dob);
+
+ rc = xmlTextWriterStartElement(
+ writer,
+ SDOXMLString(name));
+
+ if (sl.size() == 0)
+ {
+ rc = xmlTextWriterWriteAttribute(writer,
+ SDOXMLString("sdo:ref"),
+ SDOXMLString(cs->getOldXpath(dob)));
+ rc = xmlTextWriterEndElement(writer);
+ return;
+ }
+
+
+ try
+ {
+ // print single valued datatypes as attributes
+
+ for (int j=0;j< sl.size(); j++)
+ {
+ //if (!sl.get(j)->isSet())
+ //{
+ // // unset properties dont need recording - ah but they do!
+ //
+ // continue;
+ //}
+ if ( sl.get(j)->getProperty().isMany())
+ {
+ // manys are elements
+ continue;
+ }
+ if (!sl.get(j)->getProperty().getType().isDataType())
+ {
+ // data objects are element in a deleted data object.
+ continue;
+ }
+
+ rc = xmlTextWriterWriteAttribute(writer,
+ SDOXMLString(sl.get(j)->getProperty().getName()),
+ SDOXMLString(sl.get(j)->getCStringValue()));
+
+ } // for attributes
+
+
+ // now we are onto the many-values,
+ // and dataobject single values.
+ //
+ // handle deletions within deletions in reverse order, so they match the
+ // deletion records above.
+
+ for (k=sl.size()-1;k>=0; k--)
+ {
+
+ if ( !sl.get(k)->getProperty().getType().isDataType() &&
+ sl.get(k)->getProperty().isMany())
+ {
+ // its a dataobject type
+ DataObjectPtr dob2 = sl.get(k)->getDataObjectValue();
+ if (!dob2) continue;
+ if (!cs->isDeleted(dob2)) continue;
+ handleChangeSummaryDeletedObject(sl.get(k)->
+ getProperty().getName(),cs,dob2);
+ }
+ } // for attributes
+
+ for (k=0;k< sl.size(); k++)
+ {
+
+ if ( !sl.get(k)->getProperty().getType().isDataType())
+ {
+ if (sl.get(k)->getProperty().isMany()) continue;
+ // its a single valued dataobject type
+
+ DataObjectPtr dob2 = sl.get(k)->getDataObjectValue();
+ if (!dob2) continue;
+ if (!cs->isDeleted(dob2)) continue;
+ handleChangeSummaryDeletedObject(sl.get(k)->
+ getProperty().getName(),cs,dob2);
+
+ }
+ else
+ {
+ if ( !sl.get(k)->getProperty().isMany()) continue;
+
+ // could only be many valued data type
+
+ rc = xmlTextWriterWriteElement(writer,
+ SDOXMLString(sl.get(k)->getProperty().getName()),
+ SDOXMLString(sl.get(k)->getCStringValue()));
+ }
+ } // for attributes
+ }
+ catch (SDORuntimeException e)
+ {
+ // ignore - and write the end-element
+ }
+
+ rc = xmlTextWriterEndElement(writer);
+ }
+
+
+ //////////////////////////////////////////////////////////////////////////
+ // Write the list of elements of a change summary
+ //////////////////////////////////////////////////////////////////////////
+
+ void SDOXMLWriter::handleSummaryChange(
+ const SDOXMLString& elementName,
+ ChangeSummaryPtr cs,
+ DataObjectPtr dob)
+ {
+ int rc;
+ DataObject* temp = getRawPointer(dob);
+ const char* name;
+ try
+ {
+ name = temp->getContainmentProperty().getName();
+ }
+ catch (SDORuntimeException e)
+ {
+ // This could be a root, and have no name.
+ name = 0;
+ }
+
+ if (name == 0)
+ {
+ rc = xmlTextWriterStartElement(
+ writer,
+ elementName);
+ }
+ else
+ {
+ rc = xmlTextWriterStartElement(
+ writer,
+ SDOXMLString(name));
+ }
+
+ if (rc != 0)
+ {
+ // failed to write an element
+ return;
+ }
+
+ try
+ {
+ name = ((DataObjectImpl*)temp)->objectToXPath();
+ }
+ catch (SDORuntimeException e)
+ {
+ name = 0;
+ }
+
+ rc = xmlTextWriterWriteAttribute(writer,
+ SDOXMLString("sdo:ref"),
+ SDOXMLString(name));
+
+ handleChangeSummaryAttributes(cs, temp);
+
+ handleChangeSummaryElements(cs, temp);
+
+ rc = xmlTextWriterEndElement(writer);
+
+ }
+
+ //////////////////////////////////////////////////////////////////////////
+ // Write a Change Summary
+ //////////////////////////////////////////////////////////////////////////
+
+ void SDOXMLWriter::handleChangeSummary(
+ const SDOXMLString& elementName,
+ ChangeSummaryPtr cs)
+ {
+ unsigned int i;
+ int rc;
+
+ ChangedDataObjectList& changedDOs = cs->getChangedDataObjects();
+ rc = xmlTextWriterStartElementNS(writer,
+ SDOXMLString("sdo"), SDOXMLString("changeSummary"), SDOXMLString(SDOUtils::sdoURI));
+ if (rc != 0) return;
+ if (cs->isLogging())
+ {
+ rc = xmlTextWriterWriteAttribute(writer,
+ SDOXMLString("logging"),
+ SDOXMLString("true"));
+ }
+
+ if (changedDOs.size() > 0)
+ {
+
+ // write the creates/deletes in the order they
+ // happened, as elements.
+
+ for (i=0;i< changedDOs.size();i++)
+ {
+ if (cs->isCreated(changedDOs[i])
+ && changedDOs.getType(i) == ChangedDataObjectList::Create)
+ {
+ // TODO - should work out if theres a IDREF here
+ // TODO - can we have more than one create like this?
+ try
+ {
+ rc = xmlTextWriterWriteElement(writer,
+ SDOXMLString("create"),
+ SDOXMLString(staticCast<DataObjectImplPtr>(changedDOs[i])->objectToXPath()));
+ }
+ catch (SDORuntimeException e)
+ {
+ // The object was not in our tree - we ignore it.
+ }
+ }
+ if (cs->isDeleted(changedDOs[i])
+ && changedDOs.getType(i) == ChangedDataObjectList::Delete)
+ {
+ // TODO - should work out if theres a IDREF here
+ try
+ {
+ rc = xmlTextWriterWriteElement(writer,
+ SDOXMLString("delete"),
+ SDOXMLString(cs->getOldXpath(changedDOs[i])));
+ }
+ catch (SDORuntimeException e)
+ {
+ // The object was not in the deleted list - we ignore it.
+ }
+ }
+ }
+
+
+ for (i=0;i< changedDOs.size();i++)
+ {
+ if (cs->isModified(changedDOs[i]))
+ {
+ handleSummaryChange(elementName, cs, changedDOs[i]);
+ }
+ }
+
+ }
+ rc = xmlTextWriterEndElement(writer);
+ }
+
+ void SDOXMLWriter::addNamespace(const SDOXMLString& uri, bool tns)
+ {
+ std::map<SDOXMLString,SDOXMLString>::iterator it = namespaceMap.find(uri);
+ if (it == namespaceMap.end())
+ {
+ SDOXMLString prefix = "tns";
+ // Handle some common namespaces
+ if (uri.equals(s_wsdluri))
+ {
+ prefix = s_wsdl;
+ }
+ else if (uri.equals(s_soapuri))
+ {
+ prefix = s_soap;
+ }
+ else if (uri.equals(s_httpuri))
+ {
+ prefix = s_http;
+ }
+ else if (!tns)
+ {
+ char buf[20];
+ sprintf(buf,"%d", namespaceMap.size());
+ prefix += buf;
+ }
+ namespaceMap[uri] = prefix;
+ }
+
+ }
+ //////////////////////////////////////////////////////////////////////////
+ // Add to namespaces
+ //////////////////////////////////////////////////////////////////////////
+
+ void SDOXMLWriter::addToNamespaces(DataObjectImpl* dob)
+ {
+ std::map<SDOXMLString,SDOXMLString>::iterator it;
+ SDOXMLString uri = dob->getType().getURI();
+ SDOXMLString typeName = dob->getType().getName();
+ if (!(uri.equals("commonj.sdo") && typeName.equals("OpenDataObject")))
+ {
+ addNamespace(uri);
+ }
+
+ PropertyList pl = dob->getInstanceProperties();
+ for (unsigned int i = 0; i < pl.size(); i++)
+ {
+ if (!dob->isSet(pl[i]))continue;
+
+ if (pl[i].isMany())
+ {
+ if (!pl[i].getType().isDataType())
+ {
+ DataObjectList& dl = dob->getList(pl[i]);
+ for (unsigned int k=0;k< dl.size() ;k++)
+ {
+ DataObjectImpl* d = (DataObjectImpl*)getRawPointer(dl[k]);
+ if (d != 0)addToNamespaces(d);
+ }
+ }
+ }
+ else
+ {
+ if (!pl[i].getType().isDataType())
+ {
+ DataObjectImpl* d = (DataObjectImpl*)getRawPointer(dob->getDataObject(pl[i]));
+ if (d != 0)addToNamespaces(d);
+ }
+ else
+ {
+ XSDPropertyInfo* pi = getPropertyInfo(pl[i]);
+ if (pi)
+ {
+ PropertyDefinitionImpl propdef;
+ propdef = pi->getPropertyDefinition();
+ if (propdef.isElement)continue;
+ if (!propdef.isQName)continue;
+
+ SDOXMLString propertyValue = (dob->getCString(pl[i]));
+ XMLQName qname(propertyValue);
+
+ SDOXMLString qnameuri = qname.getURI();
+ if (qnameuri.equals("") || qnameuri.isNull() )
+ {
+ continue;
+ }
+
+ it = namespaceMap.find(qnameuri);
+ if (it == namespaceMap.end())
+ {
+ addNamespace(qnameuri);
+ }
+ }
+ }
+ }
+ }
+ }
+
+
+
+ /**
+ * WriteDO - write a DataObject tree
+ *
+ */
+
+ int SDOXMLWriter::writeDO(
+ DataObjectPtr dataObject,
+ const SDOXMLString& elementURI,
+ const SDOXMLString& elementName,
+ bool writeXSIType,
+ bool isRoot)
+ {
+
+ int rc;
+
+ if (dataObject == 0)
+ return 0;
+
+ const Type& dataObjectType = dataObject->getType();
+ SDOXMLString typeURI = dataObjectType.getURI();
+ SDOXMLString typeName = dataObjectType.getName();
+ bool isOpen = dataObjectType.isOpenType();
+ DataObjectImpl* dataObjectImpl = (DataObjectImpl*)getRawPointer(dataObject);
+ const TypeImpl& typeImpl = dataObjectImpl->getTypeImpl();
+
+
+ // ---------------------------------------
+ // First we need to write the startElement
+ if (isRoot)
+ {
+ // For the root element we will now gather all the namespace information
+ addNamespace(elementURI, true);
+
+ // We always add the xsi namespace. TODO we should omit if we can
+ namespaceMap[s_xsiNS] = s_xsi;
+
+ DataObjectImpl* d = (DataObjectImpl*)getRawPointer(dataObject);
+ addToNamespaces(d);
+
+ if (elementURI.equals(s_commonjsdo))
+ {
+ tnsURI = "";
+ }
+ else
+ {
+ tnsURI = elementURI;
+ }
+ }
+ // Write the startElement for non-root object
+ SDOXMLString theName=elementName;
+
+ // If an elementURI is specified then the elementForm is "qualified"
+ if (!elementURI.isNull()
+ && !elementURI.equals("")
+ && !elementURI.equals(s_commonjsdo)
+ //&& !elementURI.equals(tnsURI)
+ )
+ {
+ // Locate the namespace prefix
+ std::map<SDOXMLString,SDOXMLString>::iterator it = namespaceMap.find(elementURI);
+ if (it != namespaceMap.end())
+ {
+ theName = (*it).second;
+ theName += ":";
+ theName += elementName;
+ }
+ }
+
+ rc = xmlTextWriterStartElement(writer, theName);
+ if (rc < 0) {
+ throw SDOXMLParserException(TUSCANY_SDO_EINFO,
+ "xmlTextWriterStartElement failed");
+ }
+
+ // End - startElement is written
+ // -----------------------------
+
+
+ // -------------------------------------------
+ // For a primitive type - just write the value
+ if (dataObjectType.isDataType())
+ {
+ if (dataObject->isNull(""))
+ {
+ rc = xmlTextWriterWriteAttributeNS(writer, s_xsi, s_nil, NULL, s_true);
+ }
+ else
+ {
+ /* Use our wrapper function just in case the element has CDATA in it */
+ writeXMLElement(writer,
+ elementName,
+ dataObject->getCString(""));
+ }
+
+ // Write the end element and return
+ rc = xmlTextWriterEndElement(writer);
+ return 0;
+ }
+ // End - primitive value is written
+ // --------------------------------
+
+
+ //-------------------------------------------
+ // Write the xsi:type= attribute if necessary
+ if (writeXSIType)
+ {
+ // Supress the writing of xsi:type as well for DataObjects of type
+ // commonj.sdo#OpenDataObject
+ if (typeURI.equals("commonj.sdo") && typeName.equals("OpenDataObject"))
+ {
+ }
+ else
+ {
+ SDOXMLString theName=typeName;
+
+ if (!typeURI.isNull() && !typeURI.equals(""))
+ {
+ std::map<SDOXMLString,SDOXMLString>::iterator it = namespaceMap.find(typeURI);
+ if (it != namespaceMap.end())
+ {
+ theName = (*it).second;
+ theName += ":";
+ theName += typeName;
+ }
+ }
+
+ rc = xmlTextWriterWriteAttributeNS(writer,
+ s_xsi, s_type,
+ NULL,
+ theName);
+ }
+ }
+ // End - xsi:type= attribute is written
+ // ------------------------------------
+
+
+ // -------------------------------
+ // Write the namespace information
+ if (isRoot)
+ {
+ // Now write all the namespace information
+ for (std::map<SDOXMLString,SDOXMLString>::iterator it = namespaceMap.begin();
+ it != namespaceMap.end(); ++it)
+ {
+ if ((*it).first.equals("")) continue;
+ rc = xmlTextWriterWriteAttributeNS(writer, s_xmlns, (*it).second, NULL, (*it).first);
+ }
+ }
+ // End - namespace information is written
+ // --------------------------------------
+
+
+ // ---------------------
+ // write nil if required
+ if (dataObject->isNull(""))
+ {
+ rc = xmlTextWriterWriteAttributeNS(writer, s_xsi, s_nil, NULL, s_true);
+ }
+ // xsi:nil is written
+ // ------------------
+
+
+ // --------------------------------------------------
+ // Iterate over all the properties to find attributes
+ unsigned int i;
+ unsigned int j = 1;
+ PropertyList pl = dataObject->getInstanceProperties();
+ for (i = 0; i < pl.size(); i++)
+ {
+ if (dataObject->isSet(pl[i]))
+ {
+ SDOXMLString propertyName(pl[i].getName());
+ XSDPropertyInfo* pi = getPropertyInfo(pl[i]);
+ PropertyDefinitionImpl propdef;
+ if (pi)
+ {
+ propdef = pi->getPropertyDefinition();
+ propertyName = propdef.localname;
+ }
+
+ // Elements are written as <element>
+ if (propdef.isElement)
+ continue;
+
+ // Many-valued properties are written as <element>
+ if (pl[i].isMany())
+ continue;
+
+ // Non contained properties become attributes
+ const Type& propertyType = pl[i].getType();
+
+ if (propertyType.isDataType())
+ {
+ SDOXMLString propertyValue = (dataObject->getCString(pl[i]));
+ if (pi && pi->getPropertyDefinition().isQName)
+ {
+ XMLQName qname(propertyValue);
+
+ // TODO: this logic seems bad. We should already have the namespace in the map
+ std::map<SDOXMLString,SDOXMLString>::iterator it = namespaceMap.find(qname.getURI());
+ if (it != namespaceMap.end())
+ {
+ propertyValue = (*it).second + ":" + qname.getLocalName();
+ }
+ else
+ {
+ char buffer[20];
+ SDOXMLString pref = "tnss";
+ sprintf(buffer, "%d", j++);
+ pref += buffer;
+ rc = xmlTextWriterWriteAttributeNS(writer, s_xmlns, pref, NULL, qname.getURI());
+ propertyValue = pref + ":" + qname.getLocalName();
+ }
+
+ }
+ rc = xmlTextWriterWriteAttribute(writer,
+ propertyName, propertyValue);
+ }
+ else
+ {
+ // Handle non-containment reference to DataObject
+ if (pl[i].isReference())
+ {
+ writeReference(propertyName, dataObject, pl[i], false);
+ }
+ }
+ }
+ }
+ // End - attributes are written
+ // ----------------------------
+
+
+ // --------------------
+ // Handle ChangeSummary
+ if (dataObject->getType().isChangeSummaryType())
+ {
+ ChangeSummaryPtr changeSummary = dataObject->getChangeSummary();
+ if (changeSummary)
+ {
+ handleChangeSummary(elementName, changeSummary);
+ }
+ }
+ // End - ChangeSummary is written
+ // ------------------------------
+
+
+ // --------------------
+ // Write Sequenced Data
+ if (dataObjectType.isSequencedType())
+ {
+ SequencePtr sequence = dataObject->getSequence();
+ if (sequence)
+ {
+ for (i=0; i<sequence->size(); i++)
+ {
+ if (sequence->isText(i))
+ {
+ // This is a raw write rather than xmlTextWriterWriteString
+ // just in case the text has a CDATA section in it
+ rc = xmlTextWriterWriteRaw(
+ writer,
+ SDOXMLString(sequence->getCStringValue(i)));
+ continue;
+ } // end TextType
+
+ const Property& seqProp = sequence->getProperty(i);
+ const Type& seqPropType = seqProp.getType();
+ SDOXMLString seqPropName;
+ SDOXMLString seqPropURI;
+
+ // This call sets the property name and type URI and returns if xsi:type= is required
+ bool xsiTypeNeeded = determineNamespace(dataObject, seqProp, seqPropURI, seqPropName);
+
+ // Do not write attributes as members of the sequence
+ XSDPropertyInfo* pi = getPropertyInfo(seqProp);
+ PropertyDefinitionImpl propdef;
+ if (pi)
+ {
+ propdef = pi->getPropertyDefinition();
+ if (!(propdef.isElement))
+ {
+ continue;
+ }
+ }
+
+
+ if (seqPropType.isDataObjectType())
+ {
+ DataObjectPtr doValue = sequence->getDataObjectValue(i);
+
+ if (doValue)
+ {
+ // Handle non-containment reference to DataObject
+ if (seqProp.isReference())
+ {
+ writeReference(seqPropName, dataObject, seqProp, true, doValue);
+ }
+ else
+ {
+ // If property is an undeclared propery of an open type
+ // we write xsi:type
+ bool xsiTypeNeeded = false;
+ if (isOpen)
+ {
+ if (typeImpl.getPropertyImpl(seqPropName) == 0)
+ {
+ xsiTypeNeeded = true;
+ }
+ }
+
+ writeDO(doValue, seqPropURI, seqPropName, xsiTypeNeeded);
+ }
+ }
+ } // end DataObject
+
+ else
+ {
+ // Sequence member is a primitive
+ // Only write a primitive as an element if defined by the schema or if it's
+ // many-valued.
+ if (!pi && !seqProp.isMany()) continue;
+
+ // Write the startElement for non-root object
+ SDOXMLString theName=seqPropName;
+
+ if (!seqPropURI.isNull()
+ && !seqPropURI.equals("")
+ && !seqPropURI.equals(s_commonjsdo))
+ {
+ // Locate the namespace prefix
+ std::map<SDOXMLString,SDOXMLString>::iterator it = namespaceMap.find(seqPropURI);
+ if (it != namespaceMap.end())
+ {
+ theName = (*it).second;
+ theName += ":";
+ theName += seqPropName;
+ }
+ }
+ xmlTextWriterStartElement(writer, theName);
+
+ /* Use our wrapper function just in case the element has CDATA in it */
+ writeXMLElement(writer,
+ seqPropName,
+ sequence->getCStringValue(i));
+ xmlTextWriterEndElement(writer);
+
+ } // end DataType
+ } // end - iterate over sequence
+
+ }
+ }
+ // End = sequenced data is written
+ // -------------------------------
+
+
+ // ------------------------
+ // Non-sequenced DataObject
+ else
+ {
+ // Write elements for this DataObject
+
+ PropertyList definedProps = dataObjectType.getProperties();
+ unsigned int nDefinedProps = typeImpl.getPropertiesSize();
+ unsigned int nOpenProps = pl.size() - nDefinedProps;
+ unsigned int openPropIndex = nDefinedProps;
+
+ const TypeImpl* doTypeImpl = &typeImpl;
+ if (nOpenProps != 0)
+ {
+ while(doTypeImpl->isOpenTypeImplicitly())
+ {
+ doTypeImpl = doTypeImpl->getBaseTypeImpl();
+ }
+ openPropIndex = doTypeImpl->getPropertiesSize();
+ }
+
+ writeDOElements(dataObject, pl, 0, openPropIndex);
+ writeDOElements(dataObject, pl, nDefinedProps, nOpenProps );
+ writeDOElements(dataObject, pl, openPropIndex, nDefinedProps - openPropIndex);
+
+ }
+ // End - non-sequenced DO
+ // ----------------------
+
+ rc = xmlTextWriterEndElement(writer);
+ return rc;
+
+ } // End - writeDO
+
+ void SDOXMLWriter::writeDOElements(DataObjectPtr dataObject,
+ const PropertyList& pl,
+ unsigned int start,
+ unsigned int number)
+ {
+ for (unsigned int pi = 0; pi < number; pi++)
+ {
+ unsigned int i = start + pi;
+ if (dataObject->isSet(pl[i]))
+ {
+ SDOXMLString propertyName;
+ SDOXMLString propertyTypeURI;
+
+ // This call sets the property name and type URI and returns if xsi:type= is required
+ bool xsiTypeNeeded = determineNamespace(dataObject, pl[i], propertyTypeURI, propertyName);
+
+ const Type& propertyType = pl[i].getType();
+ XSDPropertyInfo* pi = getPropertyInfo(pl[i]);
+ PropertyDefinitionImpl propdef;
+ if (pi)
+ {
+ propdef = pi->getPropertyDefinition();
+ if (!(propdef.isElement))
+ {
+ continue;
+ }
+ }
+
+ // -------------------------------------------------
+ // For a many-valued property get the list of values
+ if (pl[i].isMany())
+ {
+ DataObjectList& dol = dataObject->getList(pl[i]);
+ for (unsigned int j = 0; j <dol.size(); j++)
+ {
+ // Handle non-containment reference to DataObject
+ if (pl[i].isReference() )
+ {
+ writeReference(propertyName, dataObject, pl[i], true, dol[j]);
+ }
+ else
+ {
+ writeDO(dol[j], propertyTypeURI, propertyName, xsiTypeNeeded);
+ }
+ }
+ }
+ // End - write many valued property
+ // --------------------------------
+
+
+ // -----------------------------
+ // For a dataobject write the do
+ else if (!propertyType.isDataType())
+ {
+ // Handle non-containment reference to DataObject
+ if (pl[i].isReference())
+ {
+ if (pi)
+ writeReference(propertyName, dataObject, pl[i], true);
+ }
+ else
+ {
+ DataObjectPtr propDO = dataObject->getDataObject(pl[i]);
+ writeDO(propDO, propertyTypeURI, propertyName, xsiTypeNeeded);
+ }
+ }
+ // End - write DataObject
+ // ----------------------
+
+
+ // ---------------
+ // For a primitive
+ else
+ {
+ // Only write a primitive as an element if defined by the XSD
+ if (pi)
+ {
+ const Type& tp = dataObject->getType();
+ XSDTypeInfo* typeInfo = (XSDTypeInfo*)
+ ((DASType*)&tp)->getDASValue("XMLDAS::TypeInfo");
+ if (typeInfo && typeInfo->getTypeDefinition().isExtendedPrimitive)
+ {
+ xmlTextWriterWriteRaw(
+ writer,
+ SDOXMLString(dataObject->getCString(pl[i])));
+ }
+ else
+ {
+ // Write the startElement for non-root object
+ SDOXMLString theName=propertyName;
+
+ if (!propertyTypeURI.isNull()
+ && !propertyTypeURI.equals("")
+ && !propertyTypeURI.equals(s_commonjsdo)
+ /* && !propertyTypeURI.equals(tnsURI) */)
+ {
+ // Locate the namespace prefix
+ std::map<SDOXMLString,SDOXMLString>::iterator it = namespaceMap.find(propertyTypeURI);
+ if (it != namespaceMap.end())
+ {
+ theName = (*it).second;
+ theName += ":";
+ theName += propertyName;
+ }
+ }
+
+ xmlTextWriterStartElement(writer, theName);
+
+ //xmlTextWriterStartElementNS(writer, NULL, propertyName, NULL);
+ if (dataObject->isNull(pl[i]))
+ {
+ xmlTextWriterWriteAttributeNS(writer, s_xsi, s_nil, NULL, s_true);
+ }
+ else
+ {
+ writeXMLElement(writer,
+ propertyName,
+ dataObject->getCString(pl[i]));
+ }
+ xmlTextWriterEndElement(writer);
+ }
+ }
+ }
+ // End - handle primitive
+ // ----------------------
+
+ } // end isSet
+ }
+ // End - elements are written
+ // --------------------------
+
+ }
+
+ XSDPropertyInfo* SDOXMLWriter::getPropertyInfo(const Property& property)
+ {
+ return (XSDPropertyInfo*)((DASProperty*)&property)->getDASValue("XMLDAS::PropertyInfo");
+ }
+
+
+ void SDOXMLWriter::writeReference(
+ const SDOXMLString& propertyName,
+ DataObjectPtr dataObject,
+ const Property& property,
+ bool isElement,
+ DataObjectPtr refferedToObject)
+ {
+ DataObjectPtr reffedObject = refferedToObject;
+ if (reffedObject == 0)
+ {
+ reffedObject = dataObject->getDataObject(property);
+ }
+
+ // Get ID from referred to DataObject or use XPath
+ SDOXMLString refValue;
+ XSDTypeInfo* ti = (XSDTypeInfo*)((DASType*)&reffedObject->getType())->
+ getDASValue("XMLDAS::TypeInfo");
+ if (ti)
+ {
+ TypeDefinitionImpl typeDef = ti->getTypeDefinition();
+ if (!typeDef.IDPropertyName.isNull())
+ {
+ refValue = reffedObject->getCString((const char*)typeDef.IDPropertyName);
+ }
+ }
+
+ if (refValue.isNull())
+ {
+ // need to get XPATH
+ refValue = ((DataObjectImpl*)getRawPointer(reffedObject))->objectToXPath();
+ }
+
+ if (!refValue.isNull())
+ {
+ if (isElement)
+ {
+ // Set the IDREF value
+ xmlTextWriterWriteElement(writer,
+ propertyName, refValue);
+ }
+ else
+ {
+ // Set the IDREF value
+ xmlTextWriterWriteAttribute(writer,
+ propertyName, refValue);
+ }
+ }
+ }
+
+
+
+ /**
+ * A wrapper for the libxml2 function xmlTextWriterWriteElement
+ * it detects CDATA sections before writing out element contents
+ */
+ int SDOXMLWriter::writeXMLElement(xmlTextWriterPtr writer,
+ const SDOXMLString& name,
+ const SDOXMLString& content)
+ {
+ int rc = 0;
+ rc = xmlTextWriterWriteRaw(writer, content);
+
+ /* A more complex version that doesn't work!
+ * I've left it here just in case we need to go back and separate out
+ * CDATA from text. This might provide a starting point
+ SDOString contentString(content);
+
+ // write the start of the element. we could write a mixture of
+ // text and CDATA before writing the end element
+ rc = xmlTextWriterStartElement(writer, name);
+
+ // Iterate along the string writing out text and CDATA sections
+ // separately using the appropriate libxml2 calls
+ std::string::size_type start = 0;
+ std::string::size_type end = contentString.find(PropertySetting::XMLCDataStartMarker, 0);
+ std::string::size_type length = 0;
+
+ // loop while we still find a CDATA section that needs writing
+ while ( end != std::string::npos )
+ {
+ // write out text from current pos to start of CDATA section
+ length = end - start;
+ rc = xmlTextWriterWriteString(writer,
+ SDOXMLString(contentString.substr(start, length).c_str()));
+
+ // find the end of the CDATA section
+ start = end;
+ end = contentString.find(PropertySetting::XMLCDataEndMarker, start);
+
+ if ( end != std::string::npos )
+ {
+ // we only nudge the start marker on to the end of the CDATA marker here
+ // so that if we fail to find the end CDATA marker the whole string gets
+ // printed out by virtue of the line that follows the while loop
+ start = start + strlen(PropertySetting::XMLCDataStartMarker);
+
+ // write our the text from the CDATA section
+ length = end - start;
+ rc = xmlTextWriterWriteCDATA(writer,
+ SDOXMLString(contentString.substr(start, length).c_str()));
+
+ // set current pos to end of CDATA section and
+ // start looking for the start marker again
+ start = end + strlen(PropertySetting::XMLCDataEndMarker);
+ end = contentString.find(PropertySetting::XMLCDataStartMarker, start);
+ }
+ }
+
+ // write out text following the last CDATA section
+ rc = xmlTextWriterWriteString(writer,
+ SDOXMLString(contentString.substr(start).c_str()));
+
+ // close off the element
+ rc = xmlTextWriterEndElement(writer);
+ */
+ return rc;
+ }
+
+ bool SDOXMLWriter::determineNamespace(DataObjectPtr dataObject, const Property& prop,
+ SDOXMLString& elementURI, SDOXMLString& elementName)
+ {
+ bool xsiTypeNeeded = false;
+
+ const Type& propertyType = prop.getType();
+
+ // If this is a defined property with property information
+ // we use the uri and name from the definition
+ XSDPropertyInfo* pi = getPropertyInfo(prop);
+ PropertyDefinitionImpl propdef;
+ if (pi)
+ {
+ propdef = pi->getPropertyDefinition();
+ elementName = propdef.localname;
+ elementURI = propdef.namespaceURI;
+ }
+ else
+ {
+ elementName = prop.getName();
+
+ SDOXMLString propTypeName = propertyType.getName();
+ SDOXMLString propTypeURI = propertyType.getURI();
+ DataObjectImpl* dataObjectImpl = (DataObjectImpl*)getRawPointer(dataObject);
+ const TypeImpl& typeImpl = dataObjectImpl->getTypeImpl();
+
+
+ // If property is an undeclared propery of an open type
+ if (typeImpl.getPropertyImpl(prop.getName()) == 0)
+ {
+ // we need to write xsi:type information
+ xsiTypeNeeded = true;
+
+ // Determine the namespace of the property
+ // First see if there is a matching property in the namespace
+ // of the Type of this property.
+ DataFactoryImplPtr df = staticCast<DataFactoryImplPtr>(dataObject->getDataFactory());
+ const TypeImpl* ti = df->findTypeImpl(propertyType.getURI(), "RootType");
+ if (ti)
+ {
+ PropertyImpl* propi = ti->getPropertyImpl(elementName);
+ if (propi)
+ {
+ SDOXMLString propiTypeName = propi->getType().getName();
+ SDOXMLString propiTypeURI = propi->getType().getURI();
+ if (propiTypeName.equals(propTypeName)
+ && propiTypeURI.equals(propTypeURI) )
+ {
+ // We have a match
+
+ // it's a global element so we do not need xsi:type
+ xsiTypeNeeded = false;
+
+ XSDPropertyInfo* ppi = getPropertyInfo(*propi);
+ PropertyDefinitionImpl propdef;
+ if (ppi)
+ {
+ propdef = ppi->getPropertyDefinition();
+ elementName = propdef.localname;
+ elementURI = propdef.namespaceURI;
+ }
+ }
+ }
+ }
+ else
+ {
+ // For now we will just set the elementURI to ""
+ // We need to check further here for the element defined in
+ // the namespace of the parent object etc. etc.
+ elementURI = "";
+ }
+ }
+ else
+ {
+ // The property has been defined programatically so we will
+ // assume elementForm is "unqualified"
+ elementURI = "";
+ }
+
+ }
+
+ if (propertyType.isAbstractType())
+ {
+ xsiTypeNeeded = true;
+ }
+
+ return xsiTypeNeeded;
+
+ }
+
+ } // End - namespace sdo
+} // End - namespace commonj
+
+
diff --git a/sdo-cpp/trunk/runtime/core/src/commonj/sdo/SDOXMLWriter.h b/sdo-cpp/trunk/runtime/core/src/commonj/sdo/SDOXMLWriter.h
new file mode 100644
index 0000000000..eaa0621d5b
--- /dev/null
+++ b/sdo-cpp/trunk/runtime/core/src/commonj/sdo/SDOXMLWriter.h
@@ -0,0 +1,147 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you 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$ */
+
+#ifndef _SDOXMLWRITER_H_
+#define _SDOXMLWRITER_H_
+
+#include "commonj/sdo/disable_warn.h"
+
+#include <libxml/xmlwriter.h>
+#include "commonj/sdo/XMLDocument.h"
+#include "commonj/sdo/SDOXMLString.h"
+#include "commonj/sdo/SchemaInfo.h"
+#include "commonj/sdo/DataFactory.h"
+#include "commonj/sdo/XSDPropertyInfo.h"
+#include <stack>
+#include "commonj/sdo/SAX2Namespaces.h"
+#include "commonj/sdo/DataObjectImpl.h"
+
+
+namespace commonj
+{
+ namespace sdo
+ {
+
+/**
+ * SDOXMLWriter writes a data object tree to XML
+ */
+ class SDOXMLWriter
+ {
+
+ public:
+
+ SDOXMLWriter(DataFactoryPtr dataFactory = NULL);
+
+ virtual ~SDOXMLWriter();
+
+ int write(XMLDocumentPtr doc, int indent=-1);
+
+ protected:
+ void setWriter(xmlTextWriterPtr textWriter);
+ void freeWriter();
+
+ private:
+ xmlTextWriterPtr writer;
+
+ void handleChangeSummaryAttributes(
+ ChangeSummaryPtr cs,
+ DataObjectPtr doB);
+
+ void handleChangeSummaryElements(
+ ChangeSummaryPtr cs,
+ DataObjectPtr dob);
+
+ void handleChangeSummaryDeletedObject(
+ const char* name,
+ ChangeSummaryPtr cs,
+ DataObjectPtr dob);
+
+ void handleSummaryChange(
+ const SDOXMLString& elementName,
+ ChangeSummaryPtr cs,
+ DataObjectPtr dob);
+
+ void handleChangeSummary(
+ const SDOXMLString& elementName,
+ ChangeSummaryPtr cs);
+
+ void addToNamespaces(DataObjectImpl* dob);
+
+ void addNamespace(const SDOXMLString& uri, bool tns=false);
+
+ int writeDO(
+ DataObjectPtr dataObject,
+ const SDOXMLString& elementURI,
+ const SDOXMLString& elementName,
+ bool writeXSIType = false,
+ bool isRoot = false);
+
+ void writeDOElements(DataObjectPtr dataObject,
+ const PropertyList& pl,
+ unsigned int start,
+ unsigned int number);
+
+ /**
+ * A wrapper for the libxml2 function xmlTextWriterWriteElement
+ * it detects CDATA sections before wrting out element contents
+ */
+ int writeXMLElement(xmlTextWriterPtr writer,
+ const SDOXMLString& name,
+ const SDOXMLString& content);
+
+ SchemaInfo* schemaInfo;
+ DataFactoryPtr dataFactory;
+
+ internal::XSDPropertyInfo* getPropertyInfo(const Property& property);
+
+ std::map<SDOXMLString,SDOXMLString> namespaceMap;
+ SDOXMLString tnsURI;
+
+ bool determineNamespace(DataObjectPtr dataObject, const Property& prop,
+ SDOXMLString& elementURI, SDOXMLString& elementName);
+
+ void writeReference(
+ const SDOXMLString& propertyName,
+ DataObjectPtr dataObject,
+ const Property& property,
+ bool isElement,
+ DataObjectPtr refferedToObject = 0);
+
+ static const SDOXMLString s_xsi;
+ static const SDOXMLString s_type;
+ static const SDOXMLString s_nil;
+ static const SDOXMLString s_true;
+ static const SDOXMLString s_xsiNS;
+ static const SDOXMLString s_xmlns;
+ static const SDOXMLString s_commonjsdo;
+ static const SDOXMLString s_wsdl;
+ static const SDOXMLString s_wsdluri;
+ static const SDOXMLString s_soap;
+ static const SDOXMLString s_soapuri;
+ static const SDOXMLString s_http;
+ static const SDOXMLString s_httpuri;
+
+ };
+ } // End - namespace sdo
+} // End - namespace commonj
+
+
+#endif //_SDOXMLWRITER_H_
diff --git a/sdo-cpp/trunk/runtime/core/src/commonj/sdo/SDOXSDBufferWriter.cpp b/sdo-cpp/trunk/runtime/core/src/commonj/sdo/SDOXSDBufferWriter.cpp
new file mode 100644
index 0000000000..2d5e97bc53
--- /dev/null
+++ b/sdo-cpp/trunk/runtime/core/src/commonj/sdo/SDOXSDBufferWriter.cpp
@@ -0,0 +1,56 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you 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$ */
+
+#include "commonj/sdo/SDOXSDBufferWriter.h"
+#include "commonj/sdo/SDORuntimeException.h"
+
+namespace commonj
+{
+ namespace sdo
+ {
+
+
+
+
+ SDOXSDBufferWriter::SDOXSDBufferWriter()
+ {
+ buf = xmlBufferCreate();
+ if (buf == NULL)
+ {
+ throw SDOXMLParserException(TUSCANY_SDO_EINFO,
+ "xmlBufferCreate failed");
+ }
+ setWriter(xmlNewTextWriterMemory(buf, 0));
+ }
+
+ SDOXSDBufferWriter::~SDOXSDBufferWriter()
+ {
+ freeWriter();
+ xmlBufferFree(buf);
+ }
+
+ SDOXMLString SDOXSDBufferWriter::getBuffer()
+ {
+ freeWriter();
+ return xmlBufferContent(buf);
+ }
+ } // End - namespace sdo
+} // End - namespace commonj
diff --git a/sdo-cpp/trunk/runtime/core/src/commonj/sdo/SDOXSDBufferWriter.h b/sdo-cpp/trunk/runtime/core/src/commonj/sdo/SDOXSDBufferWriter.h
new file mode 100644
index 0000000000..c9354a8916
--- /dev/null
+++ b/sdo-cpp/trunk/runtime/core/src/commonj/sdo/SDOXSDBufferWriter.h
@@ -0,0 +1,54 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you 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$ */
+
+#ifndef _SDOXSDBUFFERWRITER_H_
+#define _SDOXSDBUFFERWRITER_H_
+
+#include "commonj/sdo/disable_warn.h"
+
+#include "commonj/sdo/SDOXSDWriter.h"
+
+
+namespace commonj
+{
+ namespace sdo
+ {
+
+/**
+ * SDOXSDBufferWriter extends SDOXSDWriter and writes a buffer.
+ */
+ class SDOXSDBufferWriter : public SDOXSDWriter
+ {
+
+ public:
+
+ SDOXSDBufferWriter();
+ virtual ~SDOXSDBufferWriter();
+
+ SDOXMLString getBuffer();
+ private:
+ xmlBufferPtr buf;
+ };
+ } // End - namespace sdo
+} // End - namespace commonj
+
+
+#endif //_SDOXSDBUFFERWRITER_H_
diff --git a/sdo-cpp/trunk/runtime/core/src/commonj/sdo/SDOXSDFileWriter.cpp b/sdo-cpp/trunk/runtime/core/src/commonj/sdo/SDOXSDFileWriter.cpp
new file mode 100644
index 0000000000..2794026aa3
--- /dev/null
+++ b/sdo-cpp/trunk/runtime/core/src/commonj/sdo/SDOXSDFileWriter.cpp
@@ -0,0 +1,45 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you 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$ */
+
+#include "commonj/sdo/SDOXSDFileWriter.h"
+
+namespace commonj
+{
+ namespace sdo
+ {
+
+
+
+
+ SDOXSDFileWriter::SDOXSDFileWriter(const char* xsdFile)
+ {
+ setWriter(xmlNewTextWriterFilename(xsdFile, 0));
+ }
+
+ SDOXSDFileWriter::~SDOXSDFileWriter()
+ {
+
+ }
+
+
+ } // End - namespace sdo
+} // End - namespace commonj
+
diff --git a/sdo-cpp/trunk/runtime/core/src/commonj/sdo/SDOXSDFileWriter.h b/sdo-cpp/trunk/runtime/core/src/commonj/sdo/SDOXSDFileWriter.h
new file mode 100644
index 0000000000..a91becc15c
--- /dev/null
+++ b/sdo-cpp/trunk/runtime/core/src/commonj/sdo/SDOXSDFileWriter.h
@@ -0,0 +1,53 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you 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$ */
+
+#ifndef _SDOXSDFILEWRITER_H_
+#define _SDOXSDFILEWRITER_H_
+
+#include "commonj/sdo/disable_warn.h"
+
+#include "commonj/sdo/SDOXSDWriter.h"
+
+
+namespace commonj
+{
+ namespace sdo
+ {
+
+/**
+ * SDOXSDFileWriter extends SDOXSDWriter and writes a file.
+ */
+ class SDOXSDFileWriter : public SDOXSDWriter
+ {
+
+ public:
+
+ SDOXSDFileWriter(const char* xsdFile);
+
+ virtual ~SDOXSDFileWriter();
+
+
+ };
+ } // End - namespace sdo
+} // End - namespace commonj
+
+
+#endif //_SDOXSDFILEWRITER_H_
diff --git a/sdo-cpp/trunk/runtime/core/src/commonj/sdo/SDOXSDStreamWriter.cpp b/sdo-cpp/trunk/runtime/core/src/commonj/sdo/SDOXSDStreamWriter.cpp
new file mode 100644
index 0000000000..0da33a80c0
--- /dev/null
+++ b/sdo-cpp/trunk/runtime/core/src/commonj/sdo/SDOXSDStreamWriter.cpp
@@ -0,0 +1,53 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you 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$ */
+
+#include "commonj/sdo/SDOXSDStreamWriter.h"
+#include <sstream>
+
+namespace commonj
+{
+ namespace sdo
+ {
+
+
+
+
+ SDOXSDStreamWriter::SDOXSDStreamWriter(std::ostream& outXML)
+ : outXmlStream(outXML)
+ {
+ }
+
+ SDOXSDStreamWriter::~SDOXSDStreamWriter()
+ {
+ }
+
+ int SDOXSDStreamWriter::write(const TypeList& types, const SDOXMLString& targetNamespaceURI,
+ const propertyMap& openprops, int indent)
+ {
+ int rc = SDOXSDBufferWriter::write(types, targetNamespaceURI, openprops, indent);
+
+ // Now stream the buffer
+ outXmlStream << getBuffer();
+ return rc;
+ }
+ } // End - namespace sdo
+} // End - namespace commonj
+
diff --git a/sdo-cpp/trunk/runtime/core/src/commonj/sdo/SDOXSDStreamWriter.h b/sdo-cpp/trunk/runtime/core/src/commonj/sdo/SDOXSDStreamWriter.h
new file mode 100644
index 0000000000..18dade91ef
--- /dev/null
+++ b/sdo-cpp/trunk/runtime/core/src/commonj/sdo/SDOXSDStreamWriter.h
@@ -0,0 +1,57 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you 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$ */
+
+#ifndef _SDOXSDSTREAMWRITER_H_
+#define _SDOXSDSTREAMWRITER_H_
+
+#include "commonj/sdo/disable_warn.h"
+
+#include "commonj/sdo/SDOXSDBufferWriter.h"
+#include <iostream>
+
+
+namespace commonj
+{
+ namespace sdo
+ {
+
+/**
+ * SDOXSDStreamWriter extends SDOXSDWriter and writes a stream.
+ */
+ class SDOXSDStreamWriter : public SDOXSDBufferWriter
+ {
+
+ public:
+
+ SDOXSDStreamWriter(std::ostream& outXML);
+ virtual ~SDOXSDStreamWriter();
+
+ int write(const TypeList& types, const SDOXMLString& targetNamespaceURI,
+ const propertyMap& openprops, int indent = -1);
+ private:
+ std::ostream& outXmlStream;
+
+ };
+ } // End - namespace sdo
+} // End - namespace commonj
+
+
+#endif //_SDOXSDSTREAMWRITER_H_
diff --git a/sdo-cpp/trunk/runtime/core/src/commonj/sdo/SDOXSDWriter.cpp b/sdo-cpp/trunk/runtime/core/src/commonj/sdo/SDOXSDWriter.cpp
new file mode 100644
index 0000000000..3161c9ad44
--- /dev/null
+++ b/sdo-cpp/trunk/runtime/core/src/commonj/sdo/SDOXSDWriter.cpp
@@ -0,0 +1,849 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you 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$ */
+
+#include "commonj/sdo/SDOXSDWriter.h"
+#include "iostream"
+using namespace::std;
+#include "commonj/sdo/DASProperty.h"
+#include "commonj/sdo/XSDPropertyInfo.h"
+#include "commonj/sdo/SDORuntimeException.h"
+#include "commonj/sdo/DataFactoryImpl.h"
+#include "commonj/sdo/SDOUtils.h"
+
+namespace commonj
+{
+ namespace sdo
+ {
+
+ using internal::XSDPropertyInfo;
+ using internal::PropertyDefinitionImpl;
+ using internal::SDOUtils;
+
+ SDOXSDWriter::SDOXSDWriter(
+ DataFactoryPtr dataFact)
+ : dataFactory(dataFact)
+ {
+
+ }
+
+ SDOXSDWriter::~SDOXSDWriter()
+ {
+ freeWriter();
+ }
+
+ void SDOXSDWriter::setWriter(xmlTextWriterPtr textWriter)
+ {
+ writer = textWriter;
+ }
+
+ void SDOXSDWriter::freeWriter()
+ {
+ if (writer != NULL)
+ {
+ xmlFreeTextWriter(writer);
+ writer = NULL;
+ }
+ }
+
+
+ void SDOXSDWriter::writeProps( const propertyMap& pl, const SDOXMLString& targetNamespaceURI,
+ SDOXMLString& xsd)
+ {
+ int rc;
+
+ // -------------------------------------------------------
+ // Create <element> definitions
+ // -------------------------------------------------------
+
+ propertyMap::const_iterator j;
+ for (j = pl.begin(); j != pl.end(); ++j)
+ {
+ const PropertyImpl& prop = (*j).second;
+ const Type& propType = prop.getType();
+
+
+ SDOXMLString propTypeName = resolveName(propType.getURI(),
+ propType.getName(), targetNamespaceURI);
+
+
+ if (prop.isMany() || !prop.getType().isDataType())
+ {
+ // -----------------------------
+ // Write an <element> definition
+ // -----------------------------
+ rc = xmlTextWriterStartElementNS(writer, xsd, SDOXMLString("element"), NULL);
+
+ rc = xmlTextWriterWriteAttribute(writer,
+ SDOXMLString("name"),
+ SDOXMLString(prop.getName()));
+
+ if (!propType.isDataType() && !prop.isContainment())
+ {
+ rc = xmlTextWriterWriteAttribute(writer,
+ SDOXMLString("sdoxml:propertyType"),
+ propTypeName);
+ propTypeName = "xsd:anyURI";
+ }
+
+
+ rc = xmlTextWriterWriteAttribute(writer,
+ SDOXMLString("type"),
+ propTypeName);
+
+ rc = xmlTextWriterWriteAttribute(writer,
+ SDOXMLString("minOccurs"),
+ SDOXMLString("0"));
+
+ if (prop.isMany())
+ {
+ rc = xmlTextWriterWriteAttribute(writer,
+ SDOXMLString("maxOccurs"),
+ SDOXMLString("unbounded"));
+ }
+
+ // End element
+ rc = xmlTextWriterEndElement(writer);
+ }
+ else
+ {
+ // -------------------------------
+ // Write an <attribute> definition
+ // -------------------------------
+ rc = xmlTextWriterStartElementNS(writer, xsd, SDOXMLString("attribute"), NULL);
+
+ rc = xmlTextWriterWriteAttribute(writer,
+ SDOXMLString("name"),
+ SDOXMLString(prop.getName()));
+
+ if (!propType.isDataType())
+ {
+ rc = xmlTextWriterWriteAttribute(writer,
+ SDOXMLString("sdoxml:propertyType"),
+ propTypeName);
+ if (prop.isReference())
+ {
+ propTypeName = "xsd:IDREF";
+ }
+ else
+ {
+ propTypeName = "xsd:anyURI";
+ }
+ }
+
+ rc = xmlTextWriterWriteAttribute(writer,
+ SDOXMLString("type"),
+ propTypeName);
+
+ // End attribute
+ rc = xmlTextWriterEndElement(writer);
+
+ } // else
+ } // for
+ } // method
+
+
+ ////////////////////////////////////////
+
+ int SDOXSDWriter::write(const TypeList& types, const SDOXMLString& targetNamespaceURI,
+ const propertyMap& openprops, int indent)
+ {
+ unsigned int i;
+ if (writer == NULL)
+ {
+ // Throw exception
+ return -1;
+ }
+
+ int rc = 0;
+
+ if (indent >= 0)
+ {
+ xmlTextWriterSetIndent(writer, 1);
+ if (indent > 0)
+ {
+ char * chars = new char[indent+1];
+ for (int i=0;i<indent;i++)chars[i] = ' ';
+ chars[indent] = 0;
+ xmlTextWriterSetIndentString(writer, SDOXMLString(chars));
+ delete chars;
+ }
+ else
+ {
+ xmlTextWriterSetIndentString(writer, SDOXMLString(""));
+ }
+ }
+
+ // --------------------------------------------------------------
+ // Write the <schema> definition including namespace information
+ // --------------------------------------------------------------
+ SDOXMLString tns;
+ SDOXMLString xsd("xsd");
+
+ SDOXMLString schemaURI = "http://www.w3.org/2001/XMLSchema";
+ rc = xmlTextWriterStartElementNS(writer, xsd, SDOXMLString("schema"), schemaURI);
+ if (rc < 0) {
+ throw SDOXMLParserException(TUSCANY_SDO_EINFO,
+ "xmlTextWriterStartElementNS failed");
+ }
+
+
+ rc = xmlTextWriterWriteAttribute(writer,
+ SDOXMLString("xmlns:sdo"),
+ SDOXMLString(SDOUtils::sdoURI));
+
+ rc = xmlTextWriterWriteAttribute(writer,
+ SDOXMLString("xmlns:sdoxml"),
+ SDOXMLString(SDOUtils::sdoURI) + "/xml");
+
+ // --------------------------------------------------------------
+ // Add all namespaces found in type list
+ // --------------------------------------------------------------
+ int spacecount = 0;
+
+ std::map<SDOXMLString,SDOXMLString>::iterator it;
+
+ for (i = 0; i<types.size(); i++)
+ {
+ SDOXMLString uri = types[i].getURI();
+ if (uri.equals(SDOUtils::sdoURI)) continue;
+ std::map<SDOXMLString,SDOXMLString>::iterator it = namespaceMap.find(uri);
+ if (it == namespaceMap.end())
+ {
+ char buf[4];
+ if (!targetNamespaceURI.isNull()
+ && !targetNamespaceURI.equals(uri))
+ {
+ sprintf(buf,"%d",++spacecount);
+ SDOXMLString s = SDOXMLString("tns") + buf;
+ namespaceMap.insert(make_pair(uri,s));
+ }
+ }
+ }
+
+ for (it = namespaceMap.begin();it != namespaceMap.end(); ++it)
+ {
+ SDOXMLString space = SDOXMLString("xmlns:") + (*it).second;
+ rc = xmlTextWriterWriteAttribute(writer,
+ space, (*it).first);
+ }
+
+ // --------------------------------------------------------------
+ // Add targetNamespace if necessary
+ // --------------------------------------------------------------
+ if (!targetNamespaceURI.isNull() && !targetNamespaceURI.equals(""))
+ {
+ tns = "tns:";
+ rc = xmlTextWriterWriteAttribute(writer,
+ SDOXMLString("xmlns:tns"),
+ targetNamespaceURI);
+
+ rc = xmlTextWriterWriteAttribute(writer,
+ SDOXMLString("targetNamespace"),
+ targetNamespaceURI);
+ }
+
+
+ // --------------------------------------------------------------
+ // Now iterate through the Types creating elements as appropriate
+ // --------------------------------------------------------------
+ for (i = 0; i<types.size(); i++)
+ {
+ const TypeImpl& type = dynamic_cast<const TypeImpl&>(types[i]);
+ const Type* baseType = type.getBaseType();
+
+ // Do not define SDO DataTypes
+ SDOXMLString uri = type.getURI();
+ if (uri.equals(SDOUtils::sdoURI))
+ continue;
+
+ // Do not define the RootType
+ SDOXMLString name = type.getName();
+ if (uri.equals(targetNamespaceURI) && name.equals("RootType"))
+ continue;
+
+
+ // --------------------------------------------------------------
+ // DataTypes become simpleType definitions
+ // --------------------------------------------------------------
+ if (type.isDataType())
+ {
+ rc = xmlTextWriterStartElementNS(writer, xsd, SDOXMLString("simpleType"), NULL);
+ if (rc < 0) {
+ throw SDOXMLParserException(TUSCANY_SDO_EINFO,
+ "xmlTextWriterStartElementNS failed");
+ }
+
+ SDOXMLString typeName;
+ it = namespaceMap.find(type.getURI());
+ if (it != namespaceMap.end() &&
+ !targetNamespaceURI.equals((*it).first))
+ {
+ typeName = (*it).second + ":" + name;
+ }
+ else
+ {
+ typeName = name;
+ }
+ rc = xmlTextWriterWriteAttribute(writer,
+ SDOXMLString("name"),
+ typeName);
+ // --------------------------------------------------------------
+ // write any alias.
+ // --------------------------------------------------------------
+ if (type.getAliasCount() > 0)
+ {
+ unsigned int j = type.getAliasCount();
+ SDOXMLString value = "";
+ for (unsigned int i=0;i<j-1;i++)
+ {
+ value = value + type.getAlias(i);
+ value = value + " ";
+ }
+ value += type.getAlias(j-1);
+ rc = xmlTextWriterWriteAttribute(writer,
+ SDOXMLString("sdo:aliasName"),value);
+
+ }
+
+ if (baseType != 0)
+ {
+ rc = xmlTextWriterStartElementNS(writer, xsd, SDOXMLString("restriction"), NULL);
+
+ SDOXMLString baseName = resolveName(baseType->getURI(), baseType->getName(), targetNamespaceURI);
+ rc = xmlTextWriterWriteAttribute(writer,
+ SDOXMLString("base"),
+ baseName);
+
+
+ rc = xmlTextWriterEndElement(writer);
+ }
+ rc = xmlTextWriterEndElement(writer);
+
+ }
+ else
+ // ---------------------------------------------------------------------
+ // DataObject Types become ComplexType definitions with a global element
+ // ---------------------------------------------------------------------
+ {
+ rc = xmlTextWriterStartElementNS(writer,xsd, SDOXMLString("element"), NULL);
+ if (rc < 0) {
+ throw SDOXMLParserException(TUSCANY_SDO_EINFO,
+ "xmlTextWriterStartElementNS failed");
+ }
+
+ SDOXMLString typeName;
+ it = namespaceMap.find(type.getURI());
+ if (it != namespaceMap.end() &&
+ !targetNamespaceURI.equals((*it).first))
+ {
+ typeName = (*it).second + ":" + name;
+ }
+ else
+ {
+ typeName = name;
+ }
+
+ rc = xmlTextWriterWriteAttribute(writer,
+ SDOXMLString("name"),
+ name.toLower(0,1));
+
+ rc = xmlTextWriterWriteAttribute(writer,
+ SDOXMLString("type"),
+ typeName);
+
+ rc = xmlTextWriterEndElement(writer);
+
+ rc = xmlTextWriterStartElementNS(writer, xsd, SDOXMLString("complexType"), NULL);
+
+ rc = xmlTextWriterWriteAttribute(writer,
+ SDOXMLString("name"),
+ typeName);
+
+ // -----------------------------------------------------
+ // If there is an alias, write it
+ // -----------------------------------------------------
+ if (type.getAliasCount() > 0)
+ {
+ unsigned int j = type.getAliasCount();
+ SDOXMLString value = "";
+ for (unsigned int i=0;i<j-1;i++)
+ {
+ value = value + type.getAlias(i);
+ value = value + " ";
+ }
+ value += type.getAlias(j-1);
+ rc = xmlTextWriterWriteAttribute(writer,
+ SDOXMLString("sdo:aliasName"),value);
+
+ }
+
+ // -----------------------------------------------------
+ // If there is a base type then we need <complexContent>
+ // -----------------------------------------------------
+ if (baseType != 0)
+ {
+ rc = xmlTextWriterStartElementNS(writer, xsd, SDOXMLString("complexContent"), NULL);
+ rc = xmlTextWriterStartElementNS(writer, xsd, SDOXMLString("extension"), NULL);
+
+ SDOXMLString baseName = resolveName(baseType->getURI(), baseType->getName(), targetNamespaceURI);
+ rc = xmlTextWriterWriteAttribute(writer,
+ SDOXMLString("base"),
+ baseName);
+
+ // End extension
+ rc = xmlTextWriterEndElement(writer);
+ }
+
+ // ---------------------------
+ // Iterate over the properties
+ // ---------------------------
+ const std::vector<PropertyImplPtr> pl = type.getPropertyListReference();
+
+ if (pl.size() != 0)
+ {
+ bool inSequence = false;
+
+ // -------------------------------------------------------
+ // Create <element> definitions
+ // -------------------------------------------------------
+
+ for (std::vector<PropertyImplPtr>::const_iterator j = pl.begin();
+ j != pl.end();
+ j++)
+ {
+ const Property& prop = *(*j);
+ const Type& propType = prop.getType();
+
+ SDOXMLString propTypeName = resolveName(propType.getURI(),
+ propType.getName(), targetNamespaceURI);
+
+ bool isElement = false;
+ bool isQName = false;
+ XSDPropertyInfo* pi = (XSDPropertyInfo*)
+ ((DASProperty*)&prop)->getDASValue("XMLDAS::PropertyInfo");
+ if (pi)
+ {
+ PropertyDefinitionImpl propdef = pi->getPropertyDefinition();
+ if (propdef.isElement)
+ isElement=true;
+ if (propdef.isQName)
+ isQName=true;
+ }
+
+ if (prop.isMany()
+ || prop.isContainment()
+ || isElement)
+ {
+ // -------------------------------------------------
+ // Write <sequence> or <choice> before first element
+ // -------------------------------------------------
+ if (!inSequence)
+ {
+ if (type.isSequencedType())
+ {
+ rc = xmlTextWriterWriteAttribute(writer,
+ SDOXMLString("mixed"),
+ SDOXMLString("true"));
+
+ rc = xmlTextWriterStartElementNS(writer, xsd, SDOXMLString("choice"), NULL);
+ rc = xmlTextWriterWriteAttribute(writer,
+ SDOXMLString("maxOccurs"),
+ SDOXMLString("unbounded"));
+ }
+ else
+ {
+ rc = xmlTextWriterStartElementNS(writer, xsd, SDOXMLString("sequence"), NULL);
+ }
+ inSequence = true;
+ }
+ // -----------------------------
+ // Write an <element> definition
+ // -----------------------------
+ rc = xmlTextWriterStartElementNS(writer, xsd, SDOXMLString("element"), NULL);
+
+ rc = xmlTextWriterWriteAttribute(writer,
+ SDOXMLString("name"),
+ SDOXMLString(prop.getName()));
+
+ if (!propType.isDataType() && !prop.isContainment())
+ {
+ rc = xmlTextWriterWriteAttribute(writer,
+ SDOXMLString("sdoxml:propertyType"),
+ propTypeName);
+ propTypeName = "xsd:anyURI";
+ }
+
+ if (isQName)
+ {
+ propTypeName = "xsd:QName";
+ }
+
+ rc = xmlTextWriterWriteAttribute(writer,
+ SDOXMLString("type"),
+ propTypeName);
+
+ rc = xmlTextWriterWriteAttribute(writer,
+ SDOXMLString("minOccurs"),
+ SDOXMLString("0"));
+
+ if (prop.isMany())
+ {
+ rc = xmlTextWriterWriteAttribute(writer,
+ SDOXMLString("maxOccurs"),
+ SDOXMLString("unbounded"));
+ }
+
+ // -----------------------------------------------------
+ // If there is an alias...
+ // -----------------------------------------------------
+ if (prop.getAliasCount() > 0)
+ {
+ unsigned int j = prop.getAliasCount();
+ SDOXMLString value = "";
+ for (unsigned int i=0;i<j-1;i++)
+ {
+ value = value + prop.getAlias(i);
+ value = value + " ";
+ }
+ value += prop.getAlias(j-1);
+ rc = xmlTextWriterWriteAttribute(writer,
+ SDOXMLString("sdo:aliasName"),value);
+
+ }
+
+ // End element
+ rc = xmlTextWriterEndElement(writer);
+ }
+ }
+
+
+
+ // -----------------------------------------------------
+ // End <sequence> / <choice> if necessary
+ // -----------------------------------------------------
+ if (inSequence)
+ {
+ // End sequence
+ rc = xmlTextWriterEndElement(writer);
+ }
+
+ // ---------------------------------
+ // Add ChangeSummary if there is one
+ // ---------------------------------
+ if (type.isChangeSummaryType())
+ {
+ rc = xmlTextWriterStartElementNS(writer, xsd, SDOXMLString("element"), NULL);
+
+ rc = xmlTextWriterWriteAttribute(writer,
+ SDOXMLString("name"),
+ SDOXMLString("changeSummary"));
+
+
+ rc = xmlTextWriterWriteAttribute(writer,
+ SDOXMLString("type"),
+ SDOXMLString("sdo:ChangeSummaryType"));
+
+ rc = xmlTextWriterEndElement(writer);
+ }
+
+ // -------------------------------------------------------
+ // Create <element> definitions
+ // -------------------------------------------------------
+ for (std::vector<PropertyImplPtr>::const_iterator k = pl.begin();
+ k != pl.end();
+ k++)
+ {
+ const Property& prop = *(*k);
+ const Type& propType = prop.getType();
+
+
+ SDOXMLString propTypeName = resolveName(propType.getURI(),
+ propType.getName(), targetNamespaceURI);
+
+ bool isElement = false;
+ XSDPropertyInfo* pi = (XSDPropertyInfo*)
+ ((DASProperty*)&prop)->getDASValue("XMLDAS::PropertyInfo");
+ if (pi)
+ {
+ if (pi->getPropertyDefinition().isElement)
+ isElement=true;
+ }
+
+ if (!isElement
+ && !prop.isMany()
+ && !prop.isContainment())
+ {
+ // -------------------------------
+ // Write an <attribute> definition
+ // -------------------------------
+ rc = xmlTextWriterStartElementNS(writer, xsd, SDOXMLString("attribute"), NULL);
+
+ rc = xmlTextWriterWriteAttribute(writer,
+ SDOXMLString("name"),
+ SDOXMLString(prop.getName()));
+
+ if (!propType.isDataType())
+ {
+ rc = xmlTextWriterWriteAttribute(writer,
+ SDOXMLString("sdoxml:propertyType"),
+ propTypeName);
+ if (prop.isReference())
+ {
+ propTypeName = "xsd:IDREF";
+ }
+ else
+ {
+ propTypeName = "xsd:anyURI";
+ }
+ }
+
+ rc = xmlTextWriterWriteAttribute(writer,
+ SDOXMLString("type"),
+ propTypeName);
+
+ // End attribute
+ rc = xmlTextWriterEndElement(writer);
+
+ }
+
+ }
+
+ }
+
+ // -----------------------------------------------------
+ // Write open type information
+ // -----------------------------------------------------
+ if (type.isOpenType())
+ {
+ // <any namespace="##other" processContents="lax" minOccurs="0" maxOccurs="unbounded"/>
+
+ rc = xmlTextWriterStartElementNS(writer, xsd, SDOXMLString("any"), NULL);
+
+ rc = xmlTextWriterWriteAttribute(writer,
+ SDOXMLString("namespace"),
+ SDOXMLString("##other"));
+
+ rc = xmlTextWriterWriteAttribute(writer,
+ SDOXMLString("processContents"),
+ SDOXMLString("lax"));
+
+ rc = xmlTextWriterWriteAttribute(writer,
+ SDOXMLString("minOccurs"),
+ SDOXMLString("0"));
+
+ rc = xmlTextWriterWriteAttribute(writer,
+ SDOXMLString("maxOccurs"),
+ SDOXMLString("unbounded"));
+
+
+ // End element
+ rc = xmlTextWriterEndElement(writer);
+
+ // -----------------------------------------------------
+ // Write open type information 2
+ // -----------------------------------------------------
+ //<anyAttribute namespace="##any" processContents="lax"/>
+
+ rc = xmlTextWriterStartElementNS(writer, xsd, SDOXMLString("anyAttribute"), NULL);
+
+ rc = xmlTextWriterWriteAttribute(writer,
+ SDOXMLString("namespace"),
+ SDOXMLString("##any"));
+
+ rc = xmlTextWriterWriteAttribute(writer,
+ SDOXMLString("processContents"),
+ SDOXMLString("lax"));
+
+ // End element
+ rc = xmlTextWriterEndElement(writer);
+
+ }
+
+ // -----------------------------------------------------
+ // End <complexContent> if necessary
+ // -----------------------------------------------------
+ if (baseType != 0)
+ {
+ rc = xmlTextWriterEndElement(writer);
+ }
+
+
+ rc = xmlTextWriterEndElement(writer);
+ }
+ }
+
+
+ // -----------------------------------------------
+ // Write any open content from the factory
+ // -----------------------------------------------
+ if (openprops.size() != 0)
+ {
+ writeProps(openprops, targetNamespaceURI, xsd);
+ }
+ // End the <schema> definition
+ rc = xmlTextWriterEndElement(writer);
+ return rc;
+ }
+
+
+ // ========================================================================================
+ // resolveName - resolve a Type uri and name to xsd equivalent
+ // ========================================================================================
+ SDOXMLString SDOXSDWriter::resolveName(const SDOXMLString& uri, const SDOXMLString& name, const SDOXMLString& targetNamespaceURI)
+ {
+ SDOXMLString resolvedName = name;
+ if (uri.equals(SDOUtils::sdoURI))
+ {
+ resolvedName = "xsd:";
+ if (name.equalsIgnoreCase("Boolean"))
+ {
+ resolvedName += "boolean";
+ }
+ else if (name.equalsIgnoreCase("Byte"))
+ {
+ resolvedName += "byte";
+ }
+ else if (name.equalsIgnoreCase("Bytes"))
+ {
+ resolvedName += "hexBinary";
+ }
+ else if (name.equalsIgnoreCase("Character"))
+ {
+ resolvedName += "string";
+ }
+ else if (name.equalsIgnoreCase("OpenDataObject"))
+ {
+ resolvedName += "anyType";
+ }
+ else if (name.equalsIgnoreCase("Date"))
+ {
+ resolvedName += "dateTime";
+ }
+ else if (name.equalsIgnoreCase("DateTime"))
+ {
+ resolvedName += "dateTime";
+ }
+ else if (name.equalsIgnoreCase("Day"))
+ {
+ resolvedName += "gDay";
+ }
+ else if (name.equalsIgnoreCase("Decimal"))
+ {
+ resolvedName += "decimal";
+ }
+ else if (name.equalsIgnoreCase("Double"))
+ {
+ resolvedName += "double";
+ }
+ else if (name.equalsIgnoreCase("Duration"))
+ {
+ resolvedName += "duration";
+ }
+ else if (name.equalsIgnoreCase("Float"))
+ {
+ resolvedName += "float";
+ }
+ else if (name.equalsIgnoreCase("Int"))
+ {
+ resolvedName += "int";
+ }
+ else if (name.equalsIgnoreCase("Integer"))
+ {
+ resolvedName += "integer";
+ }
+ else if (name.equalsIgnoreCase("Long"))
+ {
+ resolvedName += "long";
+ }
+ else if (name.equalsIgnoreCase("Month"))
+ {
+ resolvedName += "gMonth";
+ }
+ else if (name.equalsIgnoreCase("MonthDay"))
+ {
+ resolvedName += "gMonthDay";
+ }
+ else if (name.equalsIgnoreCase("Object"))
+ {
+ resolvedName += "anySimpleType";
+ }
+ else if (name.equalsIgnoreCase("Short"))
+ {
+ resolvedName += "short";
+ }
+ else if (name.equals("String"))
+ {
+ resolvedName += "String";
+ }
+ else if (name.equalsIgnoreCase("Strings"))
+ {
+ resolvedName += "string";
+ }
+ else if (name.equalsIgnoreCase("Time"))
+ {
+ resolvedName += "time";
+ }
+ else if (name.equalsIgnoreCase("Year"))
+ {
+ resolvedName += "gYear";
+ }
+ else if (name.equalsIgnoreCase("YearMonth"))
+ {
+ resolvedName += "gYearMonth";
+ }
+ else if (name.equalsIgnoreCase("YearMonthDay"))
+ {
+ resolvedName += "date";
+ }
+ else if (name.equalsIgnoreCase("URI"))
+ {
+ resolvedName += "anyURI";
+ }
+ else
+ {
+ resolvedName += "String";
+ }
+ }
+ else if (!targetNamespaceURI.isNull() && uri.equals(targetNamespaceURI))
+ {
+ resolvedName = "tns:";
+ resolvedName += name;
+ }
+ else
+ {
+ SDOXMLString propTypeName;
+ std::map<SDOXMLString,SDOXMLString>::iterator it;
+ it = namespaceMap.find(uri);
+ if (it != namespaceMap.end() &&
+ !targetNamespaceURI.equals((*it).first))
+ {
+ resolvedName = (*it).second + ":" + name;
+ }
+ }
+
+ return resolvedName;
+ }
+
+
+
+ } // End - namespace sdo
+} // End - namespace commonj
+
diff --git a/sdo-cpp/trunk/runtime/core/src/commonj/sdo/SDOXSDWriter.h b/sdo-cpp/trunk/runtime/core/src/commonj/sdo/SDOXSDWriter.h
new file mode 100644
index 0000000000..7ba5b2421d
--- /dev/null
+++ b/sdo-cpp/trunk/runtime/core/src/commonj/sdo/SDOXSDWriter.h
@@ -0,0 +1,77 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you 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$ */
+
+#ifndef _SDOXSDWRITER_H_
+#define _SDOXSDWRITER_H_
+
+#include "commonj/sdo/disable_warn.h"
+
+#include <libxml/xmlwriter.h>
+#include "commonj/sdo/SDOXMLString.h"
+#include "commonj/sdo/DataObject.h"
+#include "commonj/sdo/DataFactoryImpl.h"
+
+
+namespace commonj
+{
+ namespace sdo
+ {
+
+/**
+ * SDOXSDWriter writes XSD from types and properties.
+ * The writer takes the contents of a data factory and writes an
+ * XSD which will be usable to serialize data from the graph.
+ */
+ class SDOXSDWriter
+ {
+
+ public:
+
+ SDOXSDWriter(DataFactoryPtr dataFactory = NULL);
+
+ virtual ~SDOXSDWriter();
+
+ int write(const TypeList& types, const SDOXMLString& targetNamespaceURI,
+ const propertyMap& openprops, int indent = -1);
+
+ protected:
+ void setWriter(xmlTextWriterPtr textWriter);
+ void freeWriter();
+
+ private:
+ xmlTextWriterPtr writer;
+
+ std::map<SDOXMLString,SDOXMLString> namespaceMap;
+
+ void writeProps( const propertyMap& pl, const SDOXMLString& targetNamespaceURI,
+ SDOXMLString& xsd);
+ int writeDO(DataObjectPtr dataObject, const SDOXMLString& elementName);
+
+ DataFactoryPtr dataFactory;
+
+ SDOXMLString resolveName(const SDOXMLString& uri, const SDOXMLString& name, const SDOXMLString& targetNamespaceURI);
+
+ };
+ } // End - namespace sdo
+} // End - namespace commonj
+
+
+#endif //_SDOXSDWRITER_H_
diff --git a/sdo-cpp/trunk/runtime/core/src/commonj/sdo/SchemaInfo.cpp b/sdo-cpp/trunk/runtime/core/src/commonj/sdo/SchemaInfo.cpp
new file mode 100644
index 0000000000..ce6097f248
--- /dev/null
+++ b/sdo-cpp/trunk/runtime/core/src/commonj/sdo/SchemaInfo.cpp
@@ -0,0 +1,39 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you 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$ */
+
+#include "commonj/sdo/SchemaInfo.h"
+namespace commonj
+{
+ namespace sdo
+ {
+
+ SchemaInfo::SchemaInfo()
+ : targetNamespaceURI(""),
+ elementFormDefaultQualified(false)
+ {
+ }
+
+ SchemaInfo::~SchemaInfo()
+ {
+ }
+
+ } // End - namespace sdo
+} // End - namespace commonj
diff --git a/sdo-cpp/trunk/runtime/core/src/commonj/sdo/SchemaInfo.h b/sdo-cpp/trunk/runtime/core/src/commonj/sdo/SchemaInfo.h
new file mode 100644
index 0000000000..b55e06efdb
--- /dev/null
+++ b/sdo-cpp/trunk/runtime/core/src/commonj/sdo/SchemaInfo.h
@@ -0,0 +1,64 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you 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$ */
+
+#ifndef _SCHEMAINFO_H_
+#define _SCHEMAINFO_H_
+
+#include "commonj/sdo/disable_warn.h"
+
+#include "commonj/sdo/SAX2Namespaces.h"
+#include "commonj/sdo/DataObject.h"
+
+namespace commonj
+{
+ namespace sdo
+ {
+
+/**
+ *
+ * SchemaInfo holds information supplied by the parser on the schema
+ * held in an XSD
+ */
+ class SchemaInfo
+ {
+
+ public:
+ SDO_SPI SchemaInfo();
+ SDO_SPI virtual ~SchemaInfo();
+
+ SDO_SPI SAX2Namespaces& getSchemaNamespaces() {return schemaNamespaces;}
+
+ SDO_SPI const SDOXMLString& getTargetNamespaceURI() const {return targetNamespaceURI;}
+ SDO_SPI void setTargetNamespaceURI(const SDOXMLString& URI) {targetNamespaceURI = URI;}
+
+ SDO_SPI bool isElementFormDefaultQualified() {return elementFormDefaultQualified;}
+ SDO_SPI void setElementFormDefaultQualified(bool qualified) {elementFormDefaultQualified = qualified;}
+ private:
+ SAX2Namespaces schemaNamespaces;
+ SDOXMLString targetNamespaceURI;
+ bool elementFormDefaultQualified;
+
+ };
+ } // End - namespace sdo
+} // End - namespace commonj
+
+
+#endif //_SCHEMAINFO_H_
diff --git a/sdo-cpp/trunk/runtime/core/src/commonj/sdo/SdoCheck.cpp b/sdo-cpp/trunk/runtime/core/src/commonj/sdo/SdoCheck.cpp
new file mode 100644
index 0000000000..fcf252ece1
--- /dev/null
+++ b/sdo-cpp/trunk/runtime/core/src/commonj/sdo/SdoCheck.cpp
@@ -0,0 +1,29 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you 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$ */
+
+#include "commonj/sdo/SdoCheck.h"
+
+extern "C" {
+ SDO_API int SDOCheck(void)
+ {
+ return 0;
+ }
+}
diff --git a/sdo-cpp/trunk/runtime/core/src/commonj/sdo/SdoCheck.h b/sdo-cpp/trunk/runtime/core/src/commonj/sdo/SdoCheck.h
new file mode 100644
index 0000000000..858009dee3
--- /dev/null
+++ b/sdo-cpp/trunk/runtime/core/src/commonj/sdo/SdoCheck.h
@@ -0,0 +1,35 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you 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$ */
+
+#include "commonj/sdo/export.h"
+
+
+/**
+ * SDOCheck is a simple C method which can be called to verify that
+ * this is an SDO library - this is used in building
+ */
+
+extern "C" {
+ SDO_API int SDOCheck(void);
+}
+
+
+
diff --git a/sdo-cpp/trunk/runtime/core/src/commonj/sdo/SdoRuntime.cpp b/sdo-cpp/trunk/runtime/core/src/commonj/sdo/SdoRuntime.cpp
new file mode 100644
index 0000000000..54fcc8c2fc
--- /dev/null
+++ b/sdo-cpp/trunk/runtime/core/src/commonj/sdo/SdoRuntime.cpp
@@ -0,0 +1,66 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you 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$ */
+
+#include "commonj/sdo/SdoRuntime.h"
+#include <iostream>
+#include <stdio.h>
+
+namespace commonj{
+namespace sdo{
+
+
+const unsigned int SdoRuntime::major = 0;
+const unsigned int SdoRuntime::minor = 9;
+const unsigned int SdoRuntime::fix =4;
+char* SdoRuntime::version = 0;
+
+
+
+const char* SdoRuntime::getVersion()
+{
+ if (SdoRuntime::version == 0)
+ {
+ SdoRuntime::version = new char[11];
+ sprintf(SdoRuntime::version,"%02d:%02d:%04d",
+ SdoRuntime::major, SdoRuntime::minor, SdoRuntime::fix);
+ }
+ return (const char *)SdoRuntime::version;
+
+}
+
+const unsigned int SdoRuntime::getMajor()
+{
+ return SdoRuntime::major;
+}
+
+const unsigned int SdoRuntime::getMinor()
+{
+ return SdoRuntime::minor;
+}
+
+const unsigned int SdoRuntime::getFix()
+{
+ return SdoRuntime::fix;
+}
+
+};
+};
+
diff --git a/sdo-cpp/trunk/runtime/core/src/commonj/sdo/SdoRuntime.h b/sdo-cpp/trunk/runtime/core/src/commonj/sdo/SdoRuntime.h
new file mode 100644
index 0000000000..3503307939
--- /dev/null
+++ b/sdo-cpp/trunk/runtime/core/src/commonj/sdo/SdoRuntime.h
@@ -0,0 +1,76 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you 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$ */
+
+#ifndef SDO_RUNTIME_H
+#define SDO_RUNTIME_H
+#include "commonj/sdo/export.h"
+
+namespace commonj{
+namespace sdo{
+
+/**
+ * SDORuntime gives information about the version of the library.
+ */
+
+class SdoRuntime
+{
+ public:
+
+ virtual ~SdoRuntime();
+
+ /**
+ * The version as a string major:minor:fix
+ */
+
+ static SDO_API const char* getVersion();
+
+ /**
+ * The major version as an integer.
+ */
+
+ static SDO_API const unsigned int getMajor();
+
+ /**
+ * The minor version as an integer.
+ */
+
+ static SDO_API const unsigned int getMinor();
+
+ /**
+ * The fix level as an integer.
+ */
+
+ static SDO_API const unsigned int getFix();
+
+
+ private:
+ static const unsigned int major;
+ static const unsigned int minor;
+ static const unsigned int fix;
+ static char* version;
+
+};
+};
+};
+
+
+#endif
+
diff --git a/sdo-cpp/trunk/runtime/core/src/commonj/sdo/Sequence.cpp b/sdo-cpp/trunk/runtime/core/src/commonj/sdo/Sequence.cpp
new file mode 100644
index 0000000000..489fb3f505
--- /dev/null
+++ b/sdo-cpp/trunk/runtime/core/src/commonj/sdo/Sequence.cpp
@@ -0,0 +1,39 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you 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$ */
+
+
+#include "commonj/sdo/Property.h"
+#include "commonj/sdo/Type.h"
+#include "commonj/sdo/TypeList.h"
+
+#include "commonj/sdo/Sequence.h"
+
+#include "commonj/sdo/DataObject.h"
+#include "commonj/sdo/SDORuntimeException.h"
+
+
+namespace commonj{
+namespace sdo{
+
+// all delegated to sequenceimpl
+};
+};
+
diff --git a/sdo-cpp/trunk/runtime/core/src/commonj/sdo/Sequence.h b/sdo-cpp/trunk/runtime/core/src/commonj/sdo/Sequence.h
new file mode 100644
index 0000000000..fca67a50b6
--- /dev/null
+++ b/sdo-cpp/trunk/runtime/core/src/commonj/sdo/Sequence.h
@@ -0,0 +1,319 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you 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$ */
+
+#ifndef _SEQUENCE_H_
+#define _SEQUENCE_H_
+
+
+#include "commonj/sdo/export.h"
+#include "commonj/sdo/RefCountingObject.h"
+#include "commonj/sdo/RefCountingPointer.h"
+#include "commonj/sdo/SDODate.h"
+#include "commonj/sdo/Type.h"
+#include "commonj/sdo/SDOValue.h"
+
+
+namespace commonj{
+namespace sdo{
+
+class Property; /* forward declaration */
+class DataObject;
+
+/**
+ * A sequence is a heterogeneous list of properties and corresponding values.
+ * It represents an ordered arbitrary mixture of data values from more
+ * than one property of a {@link DataObject data object}.
+ */
+
+class Sequence : public RefCountingObject
+{
+ public:
+ /** size() returns the number of elements
+ *
+ * Returns the number of entries in the sequence.
+ */
+
+ SDO_API virtual unsigned int size() = 0;
+
+ /**
+ *
+ * A Sequence element is either a free text item, or represents a property
+ * setting. If the element is a property setting, then the information
+ * held in the element consists of:
+ * -# The property which was set.
+ * -# The element of that property if it was many valued.
+ * -# The value which was set.
+ *
+ * If the sequence element is text, then there is no property, and only the
+ * methods for text retrieval will work. Use the isText() method to check
+ * before calling getProperty().
+ */
+
+ SDO_API virtual const Property& getProperty(unsigned int index) = 0;
+
+ /**
+ * Return the data object associated with this sequence
+ */
+
+ SDO_API virtual const DataObjectPtr getDataObject() = 0;
+
+ /**
+ *
+ * The element of that property if it was many valued. Zero if the
+ * property was single valued.
+ */
+
+ SDO_API virtual unsigned int getListIndex(unsigned int index) = 0;
+
+ /**
+ *
+ * The element contains the actual value set within the property. The
+ * method required to get that value will vary depending on the type
+ * of the property. This is shorthand for getProperty.getTypeEnum().
+ */
+
+ SDO_API virtual Type::Types getTypeEnum(unsigned int index) = 0;
+
+ /**
+ *
+ * This method searched the sequence for a setting which corresponds
+ * to the specified index of the specified property. Searches for single
+ * valued property settings may omit the pindex parameter.
+ */
+
+
+ SDO_API virtual unsigned int getIndex(const Property& p, unsigned int pindex=0) = 0;
+ SDO_API virtual unsigned int getIndex(const char* propName, unsigned int pindex=0) = 0;
+
+ /**
+ *
+ * These methods retrieve the setting according to the type of the
+ * property concerned. If a retrieval method is used which does not correspond to
+ * the correct type, a conversion will be performed, or an illegal conversion
+ * exception will be thrown.
+ */
+
+ SDO_API virtual const char* getCStringValue(unsigned int index) = 0;
+ SDO_API virtual bool getBooleanValue(unsigned int index) = 0;
+ SDO_API virtual char getByteValue(unsigned int index) = 0;
+ SDO_API virtual wchar_t getCharacterValue(unsigned int index) = 0;
+ SDO_API virtual unsigned int getStringValue(unsigned int index, wchar_t* val, unsigned int max) = 0;
+ SDO_API virtual unsigned int getBytesValue(unsigned int index, char* val, unsigned int max) = 0;
+ SDO_API virtual short getShortValue(unsigned int index) = 0;
+ SDO_API virtual long getIntValue(unsigned int index) = 0;
+ SDO_API virtual int64_t getLongValue(unsigned int index) = 0;
+ SDO_API virtual float getFloatValue(unsigned int index) = 0;
+ SDO_API virtual long double getDoubleValue(unsigned int index) = 0;
+ SDO_API virtual const SDODate getDateValue(unsigned int index) = 0;
+ SDO_API virtual DataObjectPtr getDataObjectValue(unsigned int index) = 0;
+ SDO_API virtual const SDOValue& getSDOValue(unsigned int index) = 0;
+
+ /**
+ *
+ * getlength applies to string and byte buffer types, and allows the
+ * client to allocate the correct size of buffer before retrieving the
+ * value.
+ */
+
+ SDO_API virtual unsigned int getLength(unsigned int index) = 0;
+
+
+ /**
+ *
+ * The setter methods use an element of the sequence to perform a
+ * property setting. The value in the sequence is updated, and so is the
+ * rel value of the property in the data object.
+ */
+
+ SDO_API virtual void setCStringValue( unsigned int index, const char* s ) = 0;
+ SDO_API virtual void setBooleanValue( unsigned int index, bool b ) = 0;
+ SDO_API virtual void setByteValue( unsigned int index, char c ) = 0;
+ SDO_API virtual void setCharacterValue( unsigned int index, wchar_t c ) = 0;
+ SDO_API virtual void setStringValue( unsigned int index, const wchar_t* s , unsigned int len) = 0;
+ SDO_API virtual void setBytesValue( unsigned int index, const char* s , unsigned int len) = 0;
+ SDO_API virtual void setShortValue( unsigned int index, short s ) = 0;
+ SDO_API virtual void setIntValue( unsigned int index, long i ) = 0;
+ SDO_API virtual void setLongValue( unsigned int index, int64_t l ) = 0;
+ SDO_API virtual void setFloatValue( unsigned int index, float f ) = 0;
+ SDO_API virtual void setDoubleValue(unsigned int index, long double d ) = 0;
+ SDO_API virtual void setDateValue(unsigned int index, const SDODate t ) = 0;
+ SDO_API virtual void setDataObjectValue(unsigned int index, DataObjectPtr d ) = 0;
+
+
+ /**
+ *
+ * Sequences may be added to by usign the addXXX methods. These provoke
+ * a setting of the real value of the property concerned, and also append
+ * an element to the sequence to reflect that setting.
+ * Additions may be performed based on property name, property index or
+ * the Property itself.
+ */
+
+ SDO_API virtual bool addCString( const char* propertyName,const char* s ) = 0;
+ SDO_API virtual bool addBoolean( const char* propertyName,bool b ) = 0;
+ SDO_API virtual bool addByte( const char* propertyName,char c ) = 0;
+ SDO_API virtual bool addCharacter( const char* propertyName,wchar_t c ) = 0;
+ SDO_API virtual bool addString( const char* propertyName,const wchar_t* s , unsigned int len) = 0;
+ SDO_API virtual bool addBytes ( const char* propertyName,const char* s , unsigned int len) = 0;
+ SDO_API virtual bool addShort( const char* propertyName,short s ) = 0;
+ SDO_API virtual bool addInt( const char* propertyName,long i ) = 0;
+ SDO_API virtual bool addLong( const char* propertyName,int64_t l ) = 0;
+ SDO_API virtual bool addFloat( const char* propertyName,float f ) = 0;
+ SDO_API virtual bool addDouble(const char* propertyName,long double d ) = 0;
+ SDO_API virtual bool addDate(const char* propertyName,const SDODate t ) = 0;
+ SDO_API virtual bool addDataObject(const char* propertyName,DataObjectPtr d ) = 0;
+ SDO_API virtual bool addSDOValue(const char* propertyName, const SDOValue& sval) = 0;
+
+
+ SDO_API virtual bool addCString( unsigned int propertyIndex,const char* s ) = 0;
+ SDO_API virtual bool addBoolean( unsigned int propertyIndex,bool b ) = 0;
+ SDO_API virtual bool addByte( unsigned int propertyIndex,char c ) = 0;
+ SDO_API virtual bool addCharacter( unsigned int propertyIndex,wchar_t c ) = 0;
+ SDO_API virtual bool addString( unsigned int propertyIndex,const wchar_t* s , unsigned int len) = 0;
+ SDO_API virtual bool addBytes( unsigned int propertyIndex,const char* s , unsigned int len) = 0;
+ SDO_API virtual bool addShort( unsigned int propertyIndex,short s ) = 0;
+ SDO_API virtual bool addInt( unsigned int propertyIndex,long i ) = 0;
+ SDO_API virtual bool addLong( unsigned int propertyIndex,int64_t l ) = 0;
+ SDO_API virtual bool addFloat( unsigned int propertyIndex,float f ) = 0;
+ SDO_API virtual bool addDouble(unsigned int propertyIndex,long double d ) = 0;
+ SDO_API virtual bool addDate(unsigned int propertyIndex,const SDODate t ) = 0;
+ SDO_API virtual bool addDataObject(unsigned int propertyIndex,DataObjectPtr d ) = 0;
+ SDO_API virtual bool addSDOValue(unsigned int propertyIndex, const SDOValue& sval) = 0;
+
+
+
+ SDO_API virtual bool addCString( const Property& property,const char* s ) = 0;
+ SDO_API virtual bool addBoolean( const Property& property,bool b ) = 0;
+ SDO_API virtual bool addByte( const Property& property,char c ) = 0;
+ SDO_API virtual bool addCharacter( const Property& property,wchar_t c ) = 0;
+ SDO_API virtual bool addString ( const Property& property,const wchar_t* s , unsigned int len) = 0;
+ SDO_API virtual bool addBytes( const Property& property,const char* s , unsigned int len) = 0;
+ SDO_API virtual bool addShort( const Property& property,short s ) = 0;
+ SDO_API virtual bool addInt( const Property& property,long i ) = 0;
+ SDO_API virtual bool addLong( const Property& property,int64_t l ) = 0;
+ SDO_API virtual bool addFloat( const Property& property,float f ) = 0;
+ SDO_API virtual bool addDouble(const Property& property,long double d ) = 0;
+ SDO_API virtual bool addDate(const Property& property,const SDODate t ) = 0;
+ SDO_API virtual bool addDataObject(const Property& property,DataObjectPtr d ) = 0;
+ SDO_API virtual bool addSDOValue(const Property& property, const SDOValue& sval) = 0;
+
+
+ /**
+ *
+ * Sequences may be added to by usign the addXXX methods. These provoke
+ * a setting of the real value of the property concerned, and also append
+ * an element to the sequence to reflect that setting.
+ * Additions may be performed based on property name, property index or
+ * the Property itself.
+ * The add method also has an override to allow insertion of a sequence element
+ * before any index.
+ */
+
+ SDO_API virtual bool addCString( unsigned int index,const char* propertyName,const char* s ) = 0;
+ SDO_API virtual bool addBoolean( unsigned int index,const char* propertyName,bool b ) = 0;
+ SDO_API virtual bool addByte( unsigned int index,const char* propertyName,char c ) = 0;
+ SDO_API virtual bool addCharacter( unsigned int index,const char* propertyName,wchar_t c ) = 0;
+ SDO_API virtual bool addString( unsigned int index,const char* propertyName,const wchar_t* s, unsigned int len ) = 0;
+ SDO_API virtual bool addBytes( unsigned int index,const char* propertyName,const char* s , unsigned int len) = 0;
+ SDO_API virtual bool addShort( unsigned int index,const char* propertyName,short s ) = 0;
+ SDO_API virtual bool addInt( unsigned int index,const char* propertyName,long i ) = 0;
+ SDO_API virtual bool addLong( unsigned int index,const char* propertyName,int64_t l ) = 0;
+ SDO_API virtual bool addFloat( unsigned int index,const char* propertyName,float f ) = 0;
+ SDO_API virtual bool addDouble(unsigned int index,const char* propertyName,long double d ) = 0;
+ SDO_API virtual bool addDate(unsigned int index,const char* propertyName,const SDODate t ) = 0;
+ SDO_API virtual bool addDataObject(unsigned int index,const char* propertyName,DataObjectPtr d ) = 0;
+ SDO_API virtual bool addSDOValue(unsigned int index, const char* propertyName, const SDOValue& sval) = 0;
+
+
+ SDO_API virtual bool addCString( unsigned int index,unsigned int propertyIndex,const char* s ) = 0;
+ SDO_API virtual bool addBoolean( unsigned int index,unsigned int propertyIndex,bool b ) = 0;
+ SDO_API virtual bool addByte( unsigned int index,unsigned int propertyIndex,char c ) = 0;
+ SDO_API virtual bool addCharacter( unsigned int index,unsigned int propertyIndex,wchar_t c ) = 0;
+ SDO_API virtual bool addString( unsigned int index,unsigned int propertyIndex,const wchar_t* s , unsigned int len) = 0;
+ SDO_API virtual bool addBytes( unsigned int index,unsigned int propertyIndex,const char* s , unsigned int len) = 0;
+ SDO_API virtual bool addShort( unsigned int index,unsigned int propertyIndex,short s ) = 0;
+ SDO_API virtual bool addInt( unsigned int index,unsigned int propertyIndex,long i ) = 0;
+ SDO_API virtual bool addLong( unsigned int index,unsigned int propertyIndex,int64_t l ) = 0;
+ SDO_API virtual bool addFloat( unsigned int index,unsigned int propertyIndex,float f ) = 0;
+ SDO_API virtual bool addDouble(unsigned int index,unsigned int propertyIndex,long double d ) = 0;
+ SDO_API virtual bool addDate(unsigned int index,unsigned int propertyIndex,const SDODate t ) = 0;
+ SDO_API virtual bool addDataObject(unsigned int index,unsigned int propertyIndex,DataObjectPtr d ) = 0;
+ SDO_API virtual bool addSDOValue(unsigned int index, unsigned int propertyIndex, const SDOValue& sval) = 0;
+
+
+ SDO_API virtual bool addCString( unsigned int index,const Property& property,const char* s ) = 0;
+ SDO_API virtual bool addBoolean( unsigned int index,const Property& property,bool b ) = 0;
+ SDO_API virtual bool addByte( unsigned int index,const Property& property,char c ) = 0;
+ SDO_API virtual bool addCharacter( unsigned int index,const Property& property,wchar_t c ) = 0;
+ SDO_API virtual bool addString( unsigned int index,const Property& property,const wchar_t* s , unsigned int len) = 0;
+ SDO_API virtual bool addBytes( unsigned int index,const Property& property,const char* s , unsigned int len) = 0;
+ SDO_API virtual bool addShort( unsigned int index,const Property& property,short s ) = 0;
+ SDO_API virtual bool addInt( unsigned int index,const Property& property,long i ) = 0;
+ SDO_API virtual bool addLong( unsigned int index,const Property& property,int64_t l ) = 0;
+ SDO_API virtual bool addFloat( unsigned int index,const Property& property,float f ) = 0;
+ SDO_API virtual bool addDouble(unsigned int index,const Property& property,long double d ) = 0;
+ SDO_API virtual bool addDate(unsigned int index,const Property& property,const SDODate t ) = 0;
+ SDO_API virtual bool addDataObject(unsigned int index,const Property& property,DataObjectPtr d ) = 0;
+ SDO_API virtual bool addSDOValue(unsigned int index, const Property& property, const SDOValue& sval) = 0;
+
+
+ /** remove() removes an item.
+ *
+ * Remove the item at the specified index in the sequence.
+ * This has no effect on the value of the property in the data object,
+ * but the setting is no longer recorded.
+ */
+ SDO_API virtual void remove(unsigned int index) = 0;
+ SDO_API virtual void removeAll(const Property& p) = 0;
+
+ /**
+ * Moves an entry in the sequence from one index to another. This
+ * makes the entry appear to have been set at a different point in
+ * the sequence, but does not alter the actual value set.
+ */
+
+ SDO_API virtual void move(unsigned int toIndex, unsigned int fromIndex) = 0;
+
+ /**
+ * The text setting APIs add an element to the sequence which
+ * is not a property setting.
+ * This is text which may be retieved in sequence with the settings.
+ */
+
+ SDO_API virtual bool addText(const char* text) = 0;
+ SDO_API virtual bool addText(unsigned int index, const char* text) = 0;
+ SDO_API virtual bool setText(unsigned int index, const char* text) = 0;
+
+ /**
+ * isText returns true if the element is not a property setting.
+ * This method should be used before getting the Property, to avoid an
+ * exception
+ */
+
+ SDO_API virtual bool isText(unsigned int index) = 0;
+
+};
+
+
+};
+};
+
+#endif //_SEQUENCE_H_
diff --git a/sdo-cpp/trunk/runtime/core/src/commonj/sdo/SequenceImpl.cpp b/sdo-cpp/trunk/runtime/core/src/commonj/sdo/SequenceImpl.cpp
new file mode 100644
index 0000000000..a3da701bae
--- /dev/null
+++ b/sdo-cpp/trunk/runtime/core/src/commonj/sdo/SequenceImpl.cpp
@@ -0,0 +1,1314 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you 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$ */
+
+#include "commonj/sdo/disable_warn.h"
+#include "commonj/sdo/Property.h"
+#include "commonj/sdo/Type.h"
+#include "commonj/sdo/TypeList.h"
+
+#include "commonj/sdo/SequenceImpl.h"
+
+#include "commonj/sdo/DataObject.h"
+#include "commonj/sdo/DataObjectImpl.h"
+#include "commonj/sdo/SDORuntimeException.h"
+using namespace std;
+
+
+#define CHECK_RANGE\
+ if (index >= the_list.size()){\
+ std::string msg("Index out of range:");\
+ msg += index;\
+ throw SDOIndexOutOfRangeException(TUSCANY_SDO_EINFO, \
+ msg.c_str()); \
+ }\
+ unsigned int j = 0;\
+ for (i = the_list.begin(); (j < index) && (i != the_list.end()); ++i)\
+ {\
+ j++;\
+ }
+
+
+namespace commonj
+{
+ namespace sdo
+ {
+
+ SequenceImpl::SequenceImpl()
+ {
+ throw SDORuntimeException(TUSCANY_SDO_EINFO,
+ "SequenceImpl::construction without a data object");
+ }
+
+ SequenceImpl::SequenceImpl(DataObject* indo)
+ {
+ the_do = (DataObjectImpl*) indo;
+ }
+
+ SequenceImpl::SequenceImpl(SequenceImpl* inseq)
+ {
+ // take a copy of the_list
+ the_list = inseq->the_list;
+ }
+
+ unsigned int SequenceImpl::size()
+ {
+ return the_list.size();
+ }
+
+ // Convert an index into the sequence into an iterator (pointer) to the
+ // list element identified by the index. If the index is invalid then
+ // throw an exception.
+ void SequenceImpl::checkRange(unsigned int index, SEQUENCE_ITEM_LIST::iterator& i)
+ {
+ if (index >= the_list.size())
+ {
+ std::string msg("Index out of range:");
+ msg += index;
+ throw SDOIndexOutOfRangeException(TUSCANY_SDO_EINFO,
+ msg.c_str());
+ }
+ unsigned int j = 0;
+ for (i = the_list.begin(); (j < index) && (i != the_list.end()); ++i)
+ {
+ j++;
+ }
+ return;
+ }
+
+ // Return the data object associated with this sequence
+ const DataObjectPtr SequenceImpl::getDataObject()
+ {
+ return the_do;
+ }
+
+ const Property& SequenceImpl::getProperty(unsigned int index)
+ {
+ SEQUENCE_ITEM_LIST::iterator i;
+
+ if (isText(index))
+ {
+ std::string msg("Cannot get property of a text item");
+ msg += index;
+ throw SDOUnsupportedOperationException(TUSCANY_SDO_EINFO,
+ msg.c_str());
+ }
+
+ checkRange(index, i);
+
+ if (i != the_list.end())
+ {
+ return *((*i).getProp());
+ }
+ std::string msg("Index out of range:");
+ msg += index;
+ throw SDOIndexOutOfRangeException(TUSCANY_SDO_EINFO,
+ msg.c_str());
+ }
+
+ Type::Types SequenceImpl::getTypeEnum(unsigned int index)
+ {
+ SEQUENCE_ITEM_LIST::iterator i;
+
+ checkRange(index, i);
+
+ if (i != the_list.end())
+ {
+ if ((*i).getProp() == 0)
+ {
+ // text type
+ return Type::TextType;
+ }
+ return (*i).getProp()->getTypeEnum();
+ }
+ std::string msg("Index out of range:");
+ msg += index;
+ throw SDOIndexOutOfRangeException(TUSCANY_SDO_EINFO,
+ msg.c_str());
+ }
+
+ unsigned int SequenceImpl::getListIndex(unsigned int index)
+ {
+ SEQUENCE_ITEM_LIST::iterator i;
+
+ checkRange(index, i);
+
+ if (i != the_list.end()) {
+ if ((*i).getProp() == 0)
+ {
+ std::string msg("Get list index on text property");
+ throw SDOUnsupportedOperationException(TUSCANY_SDO_EINFO,
+ msg.c_str());
+ }
+ if ((*i).getProp()->isMany())
+ {
+ return (*i).getIndex();
+ }
+ else
+ {
+ std::string msg("Get list index on text single valued property");
+ throw SDOUnsupportedOperationException(TUSCANY_SDO_EINFO,
+ msg.c_str());
+ }
+ }
+ std::string msg("Index out of range:");
+ msg += index;
+ throw SDOIndexOutOfRangeException(TUSCANY_SDO_EINFO,
+ msg.c_str());
+ }
+
+ unsigned int SequenceImpl::getIndex(const char* propName, unsigned int pindex)
+ {
+ SEQUENCE_ITEM_LIST::iterator i;
+ unsigned int j = 0;
+ for (i = the_list.begin(), j = 0; i != the_list.end(); ++i, ++j)
+ {
+ const Property* p = (*i).getProp();
+ if (p == 0)
+ {
+ continue; // avoid text
+ }
+
+ if (!strcmp(p->getName(), propName))
+ {
+ if (p->isMany())
+ {
+ if (pindex == (*i).getIndex())
+ {
+ return j;
+ }
+ }
+ else
+ {
+ return j;
+ }
+ }
+ }
+ throw SDOIndexOutOfRangeException(TUSCANY_SDO_EINFO,
+ "SequenceImpl::getIndex - property Setting not in sequence");
+ }
+
+ unsigned int SequenceImpl::getIndex(const Property& p, unsigned int pindex)
+ {
+ return getIndex(p.getName(), pindex);
+ }
+
+ // specific getters for prims and data objects
+
+ // It isn't obvious from the code here, however, this method also
+ // retrieves free text elements (see the spec) ie text items that can be
+ // added to the sequence even though they are not associated with a property.
+ const char* SequenceImpl::getCStringValue(unsigned int index)
+ {
+ const SDOValue& result = getSDOValue(index);
+
+ if (result.isSet())
+ {
+ return result.getCString();
+ }
+ else
+ {
+ return 0;
+ }
+ }
+
+ unsigned int SequenceImpl::getLength(unsigned int index)
+ {
+ SEQUENCE_ITEM_LIST::iterator i;
+ CHECK_RANGE;
+ const Property* p = (*i).getProp();
+ switch (p->getTypeEnum())
+ {
+ case Type::StringType:
+ return getStringValue(index,0,0);
+ case Type::BytesType:
+ return getBytesValue(index,0,0);
+ default:
+ return 0;
+ }
+ }
+
+ RefCountingPointer<DataObject> SequenceImpl::getDataObjectValue(unsigned int index)
+ {
+ SEQUENCE_ITEM_LIST::iterator i;
+ CHECK_RANGE;
+ const Property* p = (*i).getProp();
+ if (p == 0) {
+ return 0;
+ }
+ if (p->isMany())
+ {
+ DataObjectList& dol = the_do->getList(*p);
+ DataObject* list_do = getRawPointer(dol[(*i).getIndex()]);
+ if (list_do != 0)
+ {
+ return list_do;
+ }
+ return 0;
+ }
+ return the_do->getDataObject(*((*i).getProp()));
+ }
+
+ ///////////////////////////////////////////////////////////////////////////
+ // generic getter for those types which support it
+ ///////////////////////////////////////////////////////////////////////////
+
+ void SequenceImpl::setCStringValue( unsigned int index, const char* s )
+ {
+ SEQUENCE_ITEM_LIST::iterator i;
+ CHECK_RANGE;
+ if ((*i).getProp() == 0) {
+ (*i).setText(s);
+ return;
+ }
+ the_do->setCString(*((*i).getProp()),s);
+
+ }
+ void SequenceImpl::setBooleanValue( unsigned int index, bool b )
+ {
+ SEQUENCE_ITEM_LIST::iterator i;
+ CHECK_RANGE;
+ if ((*i).getProp() == 0) {
+ return;
+ }
+ the_do->setBoolean(*((*i).getProp()),b);
+ }
+
+ void SequenceImpl::setByteValue( unsigned int index, char c )
+ {
+ SEQUENCE_ITEM_LIST::iterator i;
+ CHECK_RANGE;
+ if ((*i).getProp() == 0) {
+ return;
+ }
+ the_do->setByte(*((*i).getProp()),c);
+ }
+
+ void SequenceImpl::setCharacterValue( unsigned int index, wchar_t c )
+ {
+ SEQUENCE_ITEM_LIST::iterator i;
+ CHECK_RANGE;
+ if ((*i).getProp() == 0) {
+ return;
+ }
+ the_do->setCharacter(*((*i).getProp()),c);
+ }
+ void SequenceImpl::setStringValue( unsigned int index, const wchar_t* s , unsigned int len)
+ {
+ SEQUENCE_ITEM_LIST::iterator i;
+ CHECK_RANGE;
+ if ((*i).getProp() == 0) {
+ return;
+ }
+ the_do->setString(*((*i).getProp()),s, len);
+ }
+ void SequenceImpl::setBytesValue( unsigned int index, const char* s , unsigned int len)
+ {
+ SEQUENCE_ITEM_LIST::iterator i;
+ CHECK_RANGE;
+ if ((*i).getProp() == 0) {
+ return;
+ }
+ the_do->setBytes(*((*i).getProp()),s, len);
+ }
+ void SequenceImpl::setShortValue( unsigned int index, short s )
+ {
+ SEQUENCE_ITEM_LIST::iterator i;
+ CHECK_RANGE;
+ if ((*i).getProp() == 0) {
+ return;
+ }
+ the_do->setShort(*((*i).getProp()),s);
+ }
+
+ void SequenceImpl::setIntValue( unsigned int index, long l)
+ {
+ SEQUENCE_ITEM_LIST::iterator i;
+ CHECK_RANGE;
+ if ((*i).getProp() == 0) {
+ return;
+ }
+ the_do->setInt(*((*i).getProp()),l);
+ }
+
+
+ void SequenceImpl::setLongValue( unsigned int index, int64_t l )
+ {
+ SEQUENCE_ITEM_LIST::iterator i;
+ CHECK_RANGE;
+ if ((*i).getProp() == 0) {
+ return;
+ }
+ the_do->setLong(*((*i).getProp()),l);
+ }
+
+ void SequenceImpl::setFloatValue( unsigned int index, float f )
+ {
+ SEQUENCE_ITEM_LIST::iterator i;
+ CHECK_RANGE;
+ if ((*i).getProp() == 0) {
+ return;
+ }
+ the_do->setFloat(*((*i).getProp()),f);
+ }
+
+
+ void SequenceImpl::setDoubleValue(unsigned int index, long double d )
+ {
+ SEQUENCE_ITEM_LIST::iterator i;
+ CHECK_RANGE;
+ if ((*i).getProp() == 0) {
+ return;
+ }
+ the_do->setDouble(*((*i).getProp()),d);
+ }
+
+ void SequenceImpl::setDateValue(unsigned int index, const SDODate t )
+ {
+ SEQUENCE_ITEM_LIST::iterator i;
+ CHECK_RANGE;
+ if ((*i).getProp() == 0) {
+ return;
+ }
+ the_do->setDate(*((*i).getProp()),t);
+ }
+
+ void SequenceImpl::setDataObjectValue(unsigned int index, DataObjectPtr d )
+ {
+ SEQUENCE_ITEM_LIST::iterator i;
+ CHECK_RANGE;
+ if ((*i).getProp() == 0) {
+ return;
+ }
+ the_do->setDataObject(*((*i).getProp()),d);
+ }
+
+
+bool SequenceImpl::addDataObject(const char* propertyName, RefCountingPointer<DataObject> v)
+{
+ const PropertyImpl* p = the_do->getPropertyImpl(propertyName);
+ if (p == 0)
+ {
+ if (the_do->getType().isOpenType())
+ {
+ p = the_do->defineDataObject(propertyName, v->getType());
+ }
+ if (p == 0)
+ {
+ std::string msg("Cannot find property:");
+ msg += propertyName;
+ throw SDOPropertyNotFoundException(TUSCANY_SDO_EINFO,
+ msg.c_str());
+ }
+ }
+ return addDataObject((const Property&)*p,v);
+}
+bool SequenceImpl::addDataObject(unsigned int propertyIndex, RefCountingPointer<DataObject> v)
+{
+ return addDataObject(the_do->getPropertyFromIndex(propertyIndex), v);
+}
+bool SequenceImpl::addDataObject(const Property& p, RefCountingPointer<DataObject> v)
+{
+ // If this is a many valued property.
+ if (p.isMany())
+ {
+ // Append the incoming data object value to the end of the list of
+ // values. The sequence is updated as part of the append operation.
+ DataObjectList& dol = the_do->getList(p);
+ dol.append((RefCountingPointer<DataObject>) v);
+ /* the_list.push_back(seq_item(&p,dol.size()-1));*/
+ return true;
+ }
+
+ SEQUENCE_ITEM_LIST::iterator i;
+
+ // Scan the sequence to check that this property has not been set already.
+ for (i= the_list.begin(); i != the_list.end(); ++i)
+ {
+ const Property* pp = (*i).getProp();
+ if (pp == 0)
+ {
+ continue; // This item is a free text entry.
+ }
+ if (!strcmp(pp->getName(), p.getName()))
+ {
+ throw SDOUnsupportedOperationException(TUSCANY_SDO_EINFO,
+ "Sequence::add of property which already exists in sequence");
+ }
+ }
+
+ the_do->setDataObject(p, v, true);
+ // the_list.push_back(seq_item(&p, 0));
+ return true;
+}
+
+
+bool SequenceImpl::addDataObject(unsigned int index, const char* propertyName, RefCountingPointer<DataObject> v)
+{
+ const PropertyImpl* p = the_do->getPropertyImpl(propertyName);
+ if (p == 0)
+ {
+ if (the_do->getType().isOpenType())
+ {
+ p = the_do->defineDataObject(propertyName, v->getType());
+ }
+ if (p == 0)
+ {
+ std::string msg("Cannot find property:");
+ msg += propertyName;
+ throw SDOPropertyNotFoundException(TUSCANY_SDO_EINFO,
+ msg.c_str());
+ }
+ }
+ return addDataObject(index,(const Property&)*p,v);
+}
+bool SequenceImpl::addDataObject(unsigned int index, unsigned int propertyIndex, RefCountingPointer<DataObject> v)
+{
+ return addDataObject(index,the_do->getPropertyFromIndex(propertyIndex), v);
+}
+bool SequenceImpl::addDataObject(unsigned int index, const Property& p, RefCountingPointer<DataObject> v)
+{
+ SEQUENCE_ITEM_LIST::iterator i;
+ SEQUENCE_ITEM_LIST::iterator i2 = the_list.end();
+ unsigned int j = 0;
+
+ if (index >= the_list.size())
+ {
+ return addDataObject(p, v);
+ }
+ if (p.isMany())
+ {
+ DataObjectList& dol = the_do->getList(p);
+ dol.append((RefCountingPointer<DataObject>)v);
+
+ checkRange(index, i);
+
+ /*the_list.insert(i,seq_item(&p,dol.size()-1));*/
+ return true;
+ }
+
+ for (i = the_list.begin(); i != the_list.end(); ++i)
+ {
+ const Property* pp = (*i).getProp();
+ if (pp == 0)
+ {
+ continue; // This item is a free text entry.
+ }
+ if (!strcmp(pp->getName(), p.getName()))
+ {
+ throw SDOUnsupportedOperationException(TUSCANY_SDO_EINFO,
+ "Sequence::insert of property which already exists in sequence");
+ }
+ if (j == index)
+ {
+ i2 = i;
+ }
+ j++;
+ }
+ // setDataObject can update the sequence but does not do so by an append
+ // so tell it to mind its own business and we will update the sequence here.
+ the_do->setDataObject(p, v, false);
+ the_list.insert(i2, seq_item(&p, 0));
+ return true;
+}
+
+ void SequenceImpl::push(const Property& p, unsigned int index)
+ {
+ the_list.push_back(seq_item(&p,index));
+ }
+
+ void SequenceImpl::remove(unsigned int index)
+ {
+ if (index >= the_list.size()) {
+ std::string msg("Index out of range:");
+ msg += index;
+ throw SDOIndexOutOfRangeException(TUSCANY_SDO_EINFO,
+ msg.c_str());
+ }
+ SEQUENCE_ITEM_LIST::iterator i;
+
+ checkRange(index, i);
+
+ the_list.erase(i);
+ return;
+ }
+
+ void SequenceImpl::removeAll(const Property& p)
+ {
+ int j = 0;
+ const Property* prop;
+ SEQUENCE_ITEM_LIST::iterator i = the_list.begin();
+
+ while (i != the_list.end())
+ {
+ prop = (*i).getProp();
+ if (prop != 0)
+ {
+ if (!strcmp(prop->getName(), p.getName()))
+ {
+ i = the_list.erase(i);
+ }
+ else
+ {
+ ++i;
+ }
+ }
+ else
+ {
+ ++i;
+ }
+
+ }
+
+ return;
+ }
+
+ void SequenceImpl::move(unsigned int toIndex, unsigned int fromIndex)
+ {
+ if (fromIndex >= the_list.size()) {
+ std::string msg("Index out of range:");
+ msg += fromIndex;
+ throw SDOIndexOutOfRangeException(TUSCANY_SDO_EINFO,
+ msg.c_str());
+ }
+
+ if (toIndex == fromIndex) return;
+
+ SEQUENCE_ITEM_LIST::iterator i1,
+ i2 = the_list.end(),
+ i3 = the_list.end();
+ unsigned int j = 0;
+ for (i3 = the_list.begin();
+ j < toIndex && j < fromIndex &&
+ i3 != the_list.end() ; ++i3);
+ {
+ if (j == toIndex) i1 = i3;
+ if (j == fromIndex) i2 = i3;
+ j++;
+ }
+
+ if (toIndex < fromIndex)
+ {
+ the_list.insert( i1, *i2);
+ the_list.erase(i2);
+ }
+ else
+ {
+ if (toIndex + 1 == the_list.size())
+ {
+ the_list.push_back(*i2);
+ }
+ else
+ {
+ the_list.insert(++i1,*i2);
+ }
+ the_list.erase(i2);
+ }
+ return;
+ }
+
+ bool SequenceImpl::addText(const char* text)
+ {
+ the_list.push_back(seq_item(text));
+ return true;
+ }
+
+ bool SequenceImpl::isText(unsigned int index)
+ {
+ if (index >= the_list.size()) {
+ return false;
+ }
+ SEQUENCE_ITEM_LIST::iterator i;
+
+ checkRange(index, i);
+
+ if ((*i).getProp() == 0)
+ {
+ return true;
+ }
+
+ return false;
+ }
+
+ bool SequenceImpl::addText(unsigned int index, const char* text)
+ {
+ if (index >= the_list.size()) {
+ return addText(text);
+ }
+
+ SEQUENCE_ITEM_LIST::iterator i;
+
+ checkRange(index, i);
+
+ the_list.insert(i,seq_item(text));
+ return true;
+ }
+
+ bool SequenceImpl::setText(unsigned int index, const char* text)
+ {
+ if (index >= the_list.size()) {
+ return false;
+ }
+
+ if (!isText(index))
+ {
+ return false;
+ }
+
+ SEQUENCE_ITEM_LIST::iterator i;
+
+ checkRange(index, i);
+
+ (*i).setText(text);
+ return true;
+ }
+
+const SDOValue& SequenceImpl::getSDOValue(unsigned int index)
+{
+ SEQUENCE_ITEM_LIST::iterator i;
+
+ checkRange(index, i);
+
+ const Property* p = (*i).getProp();
+ if (p == 0)
+ {
+ // There is no property. Either this is a free text element or we have a
+ // problem.
+ const SDOValue* freeText = (*i).getFreeText();
+ if (freeText != 0)
+ {
+ return *freeText;
+ }
+ else
+ {
+ return SDOValue::unsetSDOValue;
+ }
+ }
+ PropertyImpl* pProp = 0; // Not used. Just a place for getSDOValue to
+ // write the return value that we don't need.
+ if (p->isMany())
+ {
+ DataObjectList& dol = the_do->getList(*p);
+ DataObject* list_do = getRawPointer(dol[(*i).getIndex()]);
+ if (list_do != 0)
+ {
+ return ((DataObjectImpl*) list_do)->getSDOValue(&pProp);
+ }
+ return SDOValue::unsetSDOValue;
+ }
+ return the_do->getSDOValue(*((*i).getProp()), &pProp);
+}
+
+bool SequenceImpl::getBooleanValue(unsigned int index)
+{
+ const SDOValue& result = getSDOValue(index);
+
+ if (result.isSet())
+ {
+ return result.getBoolean();
+ }
+ else
+ {
+ return (bool) 0;
+ }
+}
+
+char SequenceImpl::getByteValue(unsigned int index)
+{
+ const SDOValue& result = getSDOValue(index);
+
+ if (result.isSet())
+ {
+ return result.getByte();
+ }
+ else
+ {
+ return (char) 0;
+ }
+}
+
+wchar_t SequenceImpl::getCharacterValue(unsigned int index)
+{
+ const SDOValue& result = getSDOValue(index);
+
+ if (result.isSet())
+ {
+ return result.getCharacter();
+ }
+ else
+ {
+ return (wchar_t) 0;
+ }
+}
+
+short SequenceImpl::getShortValue(unsigned int index)
+{
+ const SDOValue& result = getSDOValue(index);
+
+ if (result.isSet())
+ {
+ return result.getShort();
+ }
+ else
+ {
+ return (short) 0;
+ }
+}
+
+long SequenceImpl::getIntValue(unsigned int index)
+{
+ const SDOValue& result = getSDOValue(index);
+
+ if (result.isSet())
+ {
+ return result.getInt();
+ }
+ else
+ {
+ return (long) 0;
+ }
+}
+
+int64_t SequenceImpl::getLongValue(unsigned int index)
+{
+ const SDOValue& result = getSDOValue(index);
+
+ if (result.isSet())
+ {
+ return result.getLong();
+ }
+ else
+ {
+ return (int64_t) 0;
+ }
+}
+
+float SequenceImpl::getFloatValue(unsigned int index)
+{
+ const SDOValue& result = getSDOValue(index);
+
+ if (result.isSet())
+ {
+ return result.getFloat();
+ }
+ else
+ {
+ return (float) 0;
+ }
+}
+
+long double SequenceImpl::getDoubleValue(unsigned int index)
+{
+ const SDOValue& result = getSDOValue(index);
+
+ if (result.isSet())
+ {
+ return result.getDouble();
+ }
+ else
+ {
+ return (long double) 0;
+ }
+}
+
+const SDODate SequenceImpl::getDateValue(unsigned int index)
+{
+ const SDOValue& result = getSDOValue(index);
+
+ if (result.isSet())
+ {
+ return result.getDate();
+ }
+ else
+ {
+ return (SDODate) 0;
+ }
+}
+
+bool SequenceImpl::addCString(const char* propertyName, const char* v)
+{
+ return addSDOValue(propertyName, SDOValue(SDOString(v)));
+}
+bool SequenceImpl::addCString(const Property& p, const char* v)
+{
+ return addSDOValue(p, SDOValue(SDOString(v)));
+}
+bool SequenceImpl::addCString(unsigned int propertyIndex, const char* v)
+{
+ return addCString(the_do->getPropertyFromIndex(propertyIndex), v);
+}
+
+bool SequenceImpl::addByte(const char* propertyName, char v)
+{
+ return addSDOValue(propertyName, SDOValue(v));
+}
+bool SequenceImpl::addByte(const Property& p, char v)
+{
+ return addSDOValue(p, SDOValue(v));
+}
+bool SequenceImpl::addByte(unsigned int propertyIndex, char v)
+{
+ return addByte(the_do->getPropertyFromIndex(propertyIndex), v);
+}
+
+bool SequenceImpl::addCharacter(const char* propertyName, wchar_t v)
+{
+ return addSDOValue(propertyName, SDOValue(v));
+}
+bool SequenceImpl::addCharacter(const Property& p, wchar_t v)
+{
+ return addSDOValue(p, SDOValue(v));
+}
+bool SequenceImpl::addCharacter(unsigned int propertyIndex, wchar_t v)
+{
+ return addCharacter(the_do->getPropertyFromIndex(propertyIndex), v);
+}
+
+bool SequenceImpl::addShort(const char* propertyName, short v)
+{
+ return addSDOValue(propertyName, SDOValue(v));
+}
+bool SequenceImpl::addShort(const Property& p, short v)
+{
+ return addSDOValue(p, SDOValue(v));
+}
+bool SequenceImpl::addShort(unsigned int propertyIndex, short v)
+{
+ return addShort(the_do->getPropertyFromIndex(propertyIndex), v);
+}
+
+bool SequenceImpl::addFloat(const char* propertyName, float v)
+{
+ return addSDOValue(propertyName, SDOValue(v));
+}
+bool SequenceImpl::addFloat(const Property& p, float v)
+{
+ return addSDOValue(p, SDOValue(v));
+}
+bool SequenceImpl::addFloat(unsigned int propertyIndex, float v)
+{
+ return addFloat(the_do->getPropertyFromIndex(propertyIndex), v);
+}
+
+bool SequenceImpl::addDouble(const char* propertyName, long double v)
+{
+ return addSDOValue(propertyName, SDOValue(v));
+}
+bool SequenceImpl::addDouble(const Property& p, long double v)
+{
+ return addSDOValue(p, SDOValue(v));
+}
+bool SequenceImpl::addDouble(unsigned int propertyIndex, long double v)
+{
+ return addDouble(the_do->getPropertyFromIndex(propertyIndex), v);
+}
+
+bool SequenceImpl::addDate(const char* propertyName, const SDODate v)
+{
+ return addSDOValue(propertyName, SDOValue(v));
+}
+bool SequenceImpl::addDate(const Property& p, const SDODate v)
+{
+ return addSDOValue(p, SDOValue(v));
+}
+bool SequenceImpl::addDate(unsigned int propertyIndex, const SDODate v)
+{
+ return addDate(the_do->getPropertyFromIndex(propertyIndex), v);
+}
+
+bool SequenceImpl::addLong(const char* propertyName, int64_t v)
+{
+ return addSDOValue(propertyName, SDOValue(v));
+}
+bool SequenceImpl::addLong(const Property& p, int64_t v)
+{
+ return addSDOValue(p, SDOValue(v));
+}
+bool SequenceImpl::addLong(unsigned int propertyIndex, int64_t v)
+{
+ return addLong(the_do->getPropertyFromIndex(propertyIndex), v);
+}
+
+bool SequenceImpl::addInt(const char* propertyName, long v)
+{
+ return addSDOValue(propertyName, SDOValue(v));
+}
+bool SequenceImpl::addInt(const Property& p, long v)
+{
+ return addSDOValue(p, SDOValue(v));
+}
+bool SequenceImpl::addInt(unsigned int propertyIndex, long v)
+{
+ return addInt(the_do->getPropertyFromIndex(propertyIndex), v);
+}
+
+bool SequenceImpl::addBoolean(const char* propertyName, bool v)
+{
+ return addSDOValue(propertyName, SDOValue(v));
+}
+bool SequenceImpl::addBoolean(const Property& p, bool v)
+{
+ return addSDOValue(p, SDOValue(v));
+}
+
+bool SequenceImpl::addBoolean(unsigned int propertyIndex, bool v)
+{
+ return addBoolean(the_do->getPropertyFromIndex(propertyIndex), v);
+}
+
+// The return value is not spec compliant (which calls for void) it is a
+// yes/no as to whether the call succeeded.
+bool SequenceImpl::addSDOValue(const char* propertyName, const SDOValue& sval)
+{
+ const PropertyImpl* p = the_do->getPropertyImpl(propertyName);
+ if (p == 0)
+ {
+ if (the_do->getType().isOpenType())
+ {
+ p = the_do->defineSDOValue(propertyName, sval);
+ }
+ if (p == 0)
+ {
+ std::string msg("Cannot find property:");
+ msg += propertyName;
+ throw SDOPropertyNotFoundException(TUSCANY_SDO_EINFO,
+ msg.c_str());
+ }
+ }
+ return addSDOValue((const Property&) *p, sval);
+}
+bool SequenceImpl::addSDOValue(const Property& p, const SDOValue& sval)
+{
+ if (p.isMany())
+ {
+ DataObjectList& dol = the_do->getList(p);
+ dol.append(sval);
+ /* the_list.push_back(seq_item(&p,dol.size()-1));*/
+ return true;
+ }
+// std::cout << "Incoming property: " << p.getName() << std::endl << std::endl;
+ SEQUENCE_ITEM_LIST::iterator i;
+ for (i = the_list.begin(); i != the_list.end(); ++i)
+ {
+ const Property* pp = (*i).getProp();
+ if (pp == 0) continue;
+// std::cout << pp->getName() << std::endl;
+ if (!strcmp(pp->getName(), p.getName()))
+ {
+ throw SDOUnsupportedOperationException(TUSCANY_SDO_EINFO,
+ "Sequence::add of property which already exists in sequence");
+ }
+ }
+// std::cout << std::endl;
+ the_do->setSDOValue(p, sval, sval.convertTypeEnumToString(), true);
+ // the_list.push_back(seq_item(&p, 0));
+ return true;
+}
+bool SequenceImpl::addSDOValue(unsigned int propertyIndex, const SDOValue& sval)
+{
+ return addSDOValue(the_do->getPropertyFromIndex(propertyIndex), sval);
+}
+
+bool SequenceImpl::addString(const char* propertyName, const wchar_t* v, unsigned int len)
+{
+ return addSDOValue(propertyName, SDOValue(v, len));
+}
+bool SequenceImpl::addString(unsigned int propertyIndex, const wchar_t* v, unsigned int len)
+{
+ return addString(the_do->getPropertyFromIndex(propertyIndex), v, len);
+}
+bool SequenceImpl::addString(const Property& p, const wchar_t* v, unsigned int len)
+{
+ return addSDOValue(p, SDOValue(v, len));
+}
+
+bool SequenceImpl::addBytes(const char* propertyName, const char* v, unsigned int len)
+{
+ return addSDOValue(propertyName, SDOValue(v, len));
+}
+bool SequenceImpl::addBytes(unsigned int propertyIndex, const char* v, unsigned int len)
+{
+ return addBytes(the_do->getPropertyFromIndex(propertyIndex), v, len);
+}
+bool SequenceImpl::addBytes(const Property& p, const char* v, unsigned int len)
+{
+ return addSDOValue(p, SDOValue(v, len));
+}
+
+ bool SequenceImpl::addByte(unsigned int index, const char* propertyName, char v)
+ {
+ return addSDOValue(index, propertyName, SDOValue(v));
+ }
+ bool SequenceImpl::addByte(unsigned int index, unsigned int propertyIndex, char v)
+ {
+ return addByte(index, the_do->getPropertyFromIndex(propertyIndex), v);
+ }
+ bool SequenceImpl::addByte(unsigned int index, const Property& p, char v)
+ {
+ return addSDOValue(index, p, SDOValue(v));
+ }
+
+ bool SequenceImpl::addCharacter(unsigned int index, const char* propertyName, wchar_t v)
+ {
+ return addSDOValue(index, propertyName, SDOValue(v));
+ }
+ bool SequenceImpl::addCharacter(unsigned int index, unsigned int propertyIndex, wchar_t v)
+ {
+ return addCharacter(index, the_do->getPropertyFromIndex(propertyIndex), v);
+ }
+ bool SequenceImpl::addCharacter(unsigned int index, const Property& p, wchar_t v)
+ {
+ return addSDOValue(index, p, SDOValue(v));
+ }
+
+ bool SequenceImpl::addShort(unsigned int index, const char* propertyName, short v)
+ {
+ return addSDOValue(index, propertyName, SDOValue(v));
+ }
+ bool SequenceImpl::addShort(unsigned int index, unsigned int propertyIndex, short v)
+ {
+ return addShort(index, the_do->getPropertyFromIndex(propertyIndex), v);
+ }
+ bool SequenceImpl::addShort(unsigned int index, const Property& p, short v)
+ {
+ return addSDOValue(index, p, SDOValue(v));
+ }
+
+ bool SequenceImpl::addLong(unsigned int index, const char* propertyName, int64_t v)
+ {
+ return addSDOValue(index, propertyName, SDOValue(v));
+ }
+ bool SequenceImpl::addLong(unsigned int index, unsigned int propertyIndex, int64_t v)
+ {
+ return addLong(index, the_do->getPropertyFromIndex(propertyIndex), v);
+ }
+ bool SequenceImpl::addLong(unsigned int index, const Property& p, int64_t v)
+ {
+ return addSDOValue(index, p, SDOValue(v));
+ }
+
+ bool SequenceImpl::addFloat(unsigned int index, const char* propertyName, float v)
+ {
+ return addSDOValue(index, propertyName, SDOValue(v));
+ }
+ bool SequenceImpl::addFloat(unsigned int index, unsigned int propertyIndex, float v)
+ {
+ return addFloat(index, the_do->getPropertyFromIndex(propertyIndex), v);
+ }
+ bool SequenceImpl::addFloat(unsigned int index, const Property& p, float v)
+ {
+ return addSDOValue(index, p, SDOValue(v));
+ }
+
+ bool SequenceImpl::addDouble(unsigned int index, const char* propertyName, long double v)
+ {
+ return addSDOValue(index, propertyName, SDOValue(v));
+ }
+ bool SequenceImpl::addDouble(unsigned int index, unsigned int propertyIndex, long double v)
+ {
+ return addDouble(index, the_do->getPropertyFromIndex(propertyIndex), v);
+ }
+ bool SequenceImpl::addDouble(unsigned int index, const Property& p, long double v)
+ {
+ return addSDOValue(index, p, SDOValue(v));
+ }
+
+ bool SequenceImpl::addDate(unsigned int index, const char* propertyName, const SDODate v)
+ {
+ return addSDOValue(index, propertyName, SDOValue(v));
+ }
+ bool SequenceImpl::addDate(unsigned int index, unsigned int propertyIndex, const SDODate v)
+ {
+ return addDate(index, the_do->getPropertyFromIndex(propertyIndex), v);
+ }
+ bool SequenceImpl::addDate(unsigned int index, const Property& p, const SDODate v)
+ {
+ return addSDOValue(index, p, SDOValue(v));
+ }
+
+ bool SequenceImpl::addInt(unsigned int index, const char* propertyName, long v)
+ {
+ return addSDOValue(index, propertyName, SDOValue(v));
+ }
+ bool SequenceImpl::addInt(unsigned int index, unsigned int propertyIndex, long v)
+ {
+ return addInt(index, the_do->getPropertyFromIndex(propertyIndex), v);
+ }
+ bool SequenceImpl::addInt(unsigned int index, const Property& p, long v)
+ {
+ return addSDOValue(index, p, SDOValue(v));
+ }
+
+ bool SequenceImpl::addCString(unsigned int index, const char* propertyName, const char* v)
+ {
+ return addSDOValue(index, propertyName, SDOValue(SDOString(v)));
+ }
+ bool SequenceImpl::addCString(unsigned int index, unsigned int propertyIndex, const char* v)
+ {
+ return addCString(index, the_do->getPropertyFromIndex(propertyIndex), v);
+ }
+ bool SequenceImpl::addCString(unsigned int index, const Property& p, const char* v)
+ {
+ return addSDOValue(index, p, SDOValue(SDOString(v)));
+ }
+
+ bool SequenceImpl::addBoolean(unsigned int index, const char* propertyName, bool v)
+ {
+ return addSDOValue(index, propertyName, SDOValue(v));
+ }
+ bool SequenceImpl::addBoolean(unsigned int index, unsigned int propertyIndex, bool v)
+ {
+ return addBoolean(index, the_do->getPropertyFromIndex(propertyIndex), v);
+ }
+ bool SequenceImpl::addBoolean(unsigned int index, const Property& p, bool v)
+ {
+ return addSDOValue(index, p, SDOValue(v));
+ }
+
+ bool SequenceImpl::addSDOValue(unsigned int index, const char* propertyName, const SDOValue& sval)
+ {
+ const PropertyImpl* p = the_do->getPropertyImpl(propertyName);
+ if (p == 0)
+ {
+ if (the_do->getType().isOpenType())
+ {
+ p = the_do->defineSDOValue(propertyName, sval);
+ }
+ if (p == 0)
+ {
+ std::string msg("Cannot find property:");
+ msg += propertyName;
+ throw SDOPropertyNotFoundException(TUSCANY_SDO_EINFO,
+ msg.c_str());
+ }
+ }
+ return addSDOValue(index, (const Property&) *p, sval);
+ }
+ bool SequenceImpl::addSDOValue(unsigned int index, unsigned int propertyIndex, const SDOValue& sval)
+ {
+ return addSDOValue(index,the_do->getPropertyFromIndex(propertyIndex), sval);
+ }
+ bool SequenceImpl::addSDOValue(unsigned int index, const Property& p, const SDOValue& sval)
+ {
+ SEQUENCE_ITEM_LIST::iterator i;
+ SEQUENCE_ITEM_LIST::iterator i2 = the_list.end();
+ unsigned int j = 0;
+ if (index >= the_list.size()) {
+ return addSDOValue(p, sval);
+ }
+ if (p.isMany())
+ {
+ DataObjectList& dol = the_do->getList(p);
+ dol.append(sval);
+
+ checkRange(index, i);
+
+ /*the_list.insert(i,seq_item(&p,dol.size()-1));*/
+ return true;
+ }
+
+ for (i = the_list.begin(); i != the_list.end(); ++i)
+ {
+ const Property* pp = (*i).getProp();
+ if (pp == 0) continue;
+ if (!strcmp(pp->getName(), p.getName()))
+ {
+ throw SDOUnsupportedOperationException(
+ TUSCANY_SDO_EINFO,
+ "Sequence::insert of property which already exists in sequence");
+ }
+ if (j == index) {
+ i2 = i;
+ }
+ j++;
+ }
+
+ // setSDOValue can update the sequence but does not do so by an append so
+ // tell it to mind its own business and we will update the sequence here.
+ the_do->setSDOValue(p, sval, sval.convertTypeEnumToString(), false);
+ the_list.insert(i2, seq_item(&p, 0));
+ return true;
+ }
+
+bool SequenceImpl::addString(unsigned int index,
+ const char* propertyName,
+ const wchar_t* v,
+ unsigned int len)
+{
+ return addSDOValue(index, propertyName, SDOValue(v, len));
+}
+
+bool SequenceImpl::addString(unsigned int index, unsigned int propertyIndex, const wchar_t* v, unsigned int len)
+{
+ return addString(index,the_do->getPropertyFromIndex(propertyIndex), v, len);
+}
+bool SequenceImpl::addString(unsigned int index, const Property& p, const wchar_t* v, unsigned int len)
+{
+ return addSDOValue(index, p, SDOValue(v, len));
+}
+
+bool SequenceImpl::addBytes(unsigned int index,
+ const char* propertyName,
+ const char* v,
+ unsigned int len)
+{
+ return addSDOValue(index, propertyName, SDOValue(v, len));
+}
+
+bool SequenceImpl::addBytes(unsigned int index, unsigned int propertyIndex, const char* v, unsigned int len)
+{
+ return addBytes(index,the_do->getPropertyFromIndex(propertyIndex), v, len);
+}
+bool SequenceImpl::addBytes(unsigned int index, const Property& p, const char* v, unsigned int len)
+{
+ return addSDOValue(index, p, SDOValue(v, len));
+}
+
+unsigned int SequenceImpl::getBytesValue(unsigned int index, char* ptr, unsigned int max)
+{
+
+ const SDOValue& result = getSDOValue(index);
+
+ if (result.isSet())
+ {
+ return result.getBytes(ptr, max);
+ }
+ else
+ {
+ return 0;
+ }
+}
+unsigned int SequenceImpl::getStringValue(unsigned int index, wchar_t* ptr, unsigned int max)
+{
+
+ const SDOValue& result = getSDOValue(index);
+
+ if (result.isSet())
+ {
+ return result.getString(ptr, max);
+ }
+ else
+ {
+ return 0;
+ }
+}
+
+};
+};
diff --git a/sdo-cpp/trunk/runtime/core/src/commonj/sdo/SequenceImpl.h b/sdo-cpp/trunk/runtime/core/src/commonj/sdo/SequenceImpl.h
new file mode 100644
index 0000000000..a26a75c230
--- /dev/null
+++ b/sdo-cpp/trunk/runtime/core/src/commonj/sdo/SequenceImpl.h
@@ -0,0 +1,403 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you 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$ */
+
+#ifndef _SEQUENCEIMPL_H_
+#define _SEQUENCEIMPL_H_
+
+#include "commonj/sdo/disable_warn.h"
+
+#include <vector>
+
+
+#include "commonj/sdo/Sequence.h"
+#include "commonj/sdo/SDODate.h"
+
+namespace commonj{
+namespace sdo{
+
+class Property; /* forward declaration */
+class DataObjectImpl;
+
+/** SequenceImpl implements the abstract class Sequence.
+ *
+ * A sequence is a heterogeneous list of properties and corresponding values.
+ * It represents an ordered arbitrary mixture of data values from more
+ * than one property of a {@link DataObject data object}.
+ */
+
+class SequenceImpl : public Sequence
+{
+ public:
+ ///////////////////////////////////////////////////////////////////////////
+ // Returns the number of entries in the sequence.
+ // @return the number of entries.
+ ///////////////////////////////////////////////////////////////////////////
+ virtual unsigned int size();
+
+ ///////////////////////////////////////////////////////////////////////////
+ // Returns the property for the given entry index.
+ ///////////////////////////////////////////////////////////////////////////
+ virtual const Property& getProperty(unsigned int index);
+
+ /**
+ * Return the data object associated with this sequence
+ */
+
+ SDO_API virtual const DataObjectPtr getDataObject();
+
+ ///////////////////////////////////////////////////////////////////////////
+ // Returns the property for the given entry index.
+ ///////////////////////////////////////////////////////////////////////////
+ virtual unsigned int getIndex(const Property& p, unsigned int pindex=0);
+ virtual unsigned int getIndex(const char* propName, unsigned int pindex=0);
+
+ virtual unsigned int getListIndex(unsigned int index);
+
+ Type::Types getTypeEnum(unsigned int index);
+
+
+ ///////////////////////////////////////////////////////////////////////////
+ // Returns the property value for the given entry index.
+ // @param index the index of the entry.
+ // @return the value for the given entry index..
+ ///////////////////////////////////////////////////////////////////////////
+ virtual const char* getCStringValue(unsigned int index);
+ virtual bool getBooleanValue(unsigned int index);
+ virtual char getByteValue(unsigned int index);
+ virtual wchar_t getCharacterValue(unsigned int index);
+ virtual unsigned int getStringValue(unsigned int index, wchar_t* val, unsigned int max);
+ virtual unsigned int getBytesValue(unsigned int index, char* val, unsigned int max);
+ virtual short getShortValue(unsigned int index);
+ virtual long getIntValue(unsigned int index);
+ virtual int64_t getLongValue(unsigned int index);
+ virtual float getFloatValue(unsigned int index);
+ virtual long double getDoubleValue(unsigned int index);
+ virtual const SDODate getDateValue(unsigned int index);
+ virtual DataObjectPtr getDataObjectValue(unsigned int index);
+ virtual const SDOValue& getSDOValue(unsigned int index);
+
+ virtual unsigned int getLength(unsigned int index);
+
+ ///////////////////////////////////////////////////////////////////////////
+ // sets the entry at a specified index to the new value.
+ // @param index the index of the entry.
+ // @param value the new value for the entry.
+ ///////////////////////////////////////////////////////////////////////////
+
+ virtual void setCStringValue( unsigned int index, const char* s );
+ virtual void setBooleanValue( unsigned int index, bool b );
+ virtual void setByteValue( unsigned int index, char c );
+ virtual void setCharacterValue( unsigned int index, wchar_t c );
+ virtual void setBytesValue( unsigned int index, const char* s , unsigned int len);
+ virtual void setStringValue( unsigned int index, const wchar_t* s , unsigned int len);
+ virtual void setShortValue( unsigned int index, short s );
+ virtual void setIntValue( unsigned int index, long i );
+ virtual void setLongValue( unsigned int index, int64_t l );
+ virtual void setFloatValue( unsigned int index, float f );
+ virtual void setDoubleValue( unsigned int index, long double d );
+ virtual void setDateValue( unsigned int index, const SDODate t );
+ virtual void setDataObjectValue(unsigned int index, DataObjectPtr d );
+
+
+ ///////////////////////////////////////////////////////////////////////////
+ // adds a new entry with the specified property name and value
+ // to the end of the entries.
+ // @param propertyName the name of the entry's property.
+ // @param value the value for the entry.
+ ///////////////////////////////////////////////////////////////////////////
+ virtual bool addCString( const char* propertyName,const char* s );
+ virtual bool addBoolean( const char* propertyName,bool b );
+ virtual bool addByte( const char* propertyName,char c );
+ virtual bool addCharacter( const char* propertyName,wchar_t c );
+ virtual bool addString( const char* propertyName,const wchar_t* s , unsigned int len);
+ virtual bool addBytes( const char* propertyName,const char* s , unsigned int len);
+ virtual bool addShort( const char* propertyName,short s );
+ virtual bool addInt( const char* propertyName,long i );
+ virtual bool addLong( const char* propertyName,int64_t l );
+ virtual bool addFloat( const char* propertyName,float f );
+ virtual bool addDouble( const char* propertyName,long double d );
+ virtual bool addDate( const char* propertyName,const SDODate t );
+ virtual bool addDataObject(const char* propertyName,DataObjectPtr d );
+ virtual bool addSDOValue(const char* propertyName, const SDOValue& sval);
+
+
+ ///////////////////////////////////////////////////////////////////////////
+ // adds a new entry with the specified property index and value
+ // to the end of the entries.
+ // @param propertyIndex the index of the entry's property.
+ // @param value the value for the entry.
+ ///////////////////////////////////////////////////////////////////////////
+ virtual bool addCString( unsigned int propertyIndex,const char* s );
+ virtual bool addBoolean( unsigned int propertyIndex,bool b );
+ virtual bool addByte( unsigned int propertyIndex,char c );
+ virtual bool addCharacter( unsigned int propertyIndex,wchar_t c );
+ virtual bool addString( unsigned int propertyIndex,const wchar_t* s , unsigned int len);
+ virtual bool addBytes( unsigned int propertyIndex,const char* s , unsigned int len);
+ virtual bool addShort( unsigned int propertyIndex,short s );
+ virtual bool addInt( unsigned int propertyIndex,long i );
+ virtual bool addLong( unsigned int propertyIndex,int64_t l );
+ virtual bool addFloat( unsigned int propertyIndex,float f );
+ virtual bool addDouble( unsigned int propertyIndex,long double d );
+ virtual bool addDate( unsigned int propertyIndex,const SDODate t );
+ virtual bool addDataObject(unsigned int propertyIndex,DataObjectPtr d );
+ virtual bool addSDOValue(unsigned int propertyIndex, const SDOValue& sval);
+
+
+ ///////////////////////////////////////////////////////////////////////////
+ // adds a new entry with the specified property and value
+ // to the end of the entries.
+ // @param property the property of the entry.
+ // @param value the value for the entry.
+ ///////////////////////////////////////////////////////////////////////////
+
+ virtual bool addCString( const Property& property,const char* s );
+ virtual bool addBoolean( const Property& property,bool b );
+ virtual bool addByte( const Property& property,char c );
+ virtual bool addCharacter( const Property& property,wchar_t c );
+ virtual bool addString( const Property& property,const wchar_t* s , unsigned int len);
+ virtual bool addBytes( const Property& property,const char* s , unsigned int len);
+ virtual bool addShort( const Property& property,short s );
+ virtual bool addInt( const Property& property,long i );
+ virtual bool addLong( const Property& property,int64_t l );
+ virtual bool addFloat( const Property& property,float f );
+ virtual bool addDouble( const Property& property,long double d );
+ virtual bool addDate( const Property& property,const SDODate t );
+ virtual bool addDataObject(const Property& property,DataObjectPtr d );
+ virtual bool addSDOValue(const Property& property, const SDOValue& sval);
+
+
+ ///////////////////////////////////////////////////////////////////////////
+ // adds a new entry with the specified property name and value
+ // at the specified entry index.
+ // @param index the index at which to add the entry.
+ // @param propertyName the name of the entry's property.
+ // @param value the value for the entry.
+ ///////////////////////////////////////////////////////////////////////////
+ virtual bool addCString( unsigned int index,const char* propertyName,const char* s );
+ virtual bool addBoolean( unsigned int index,const char* propertyName,bool b );
+ virtual bool addByte( unsigned int index,const char* propertyName,char c );
+ virtual bool addCharacter( unsigned int index,const char* propertyName,wchar_t c );
+ virtual bool addString( unsigned int index,const char* propertyName,const wchar_t* s , unsigned int len);
+ virtual bool addBytes( unsigned int index,const char* propertyName,const char* s , unsigned int len);
+ virtual bool addShort( unsigned int index,const char* propertyName,short s );
+ virtual bool addInt( unsigned int index,const char* propertyName,long i );
+ virtual bool addLong( unsigned int index,const char* propertyName,int64_t l );
+ virtual bool addFloat( unsigned int index,const char* propertyName,float f );
+ virtual bool addDouble( unsigned int index,const char* propertyName,long double d );
+ virtual bool addDate( unsigned int index,const char* propertyName,const SDODate t );
+ virtual bool addDataObject(unsigned int index,const char* propertyName,DataObjectPtr d );
+ virtual bool addSDOValue(unsigned int index, const char* propertyName, const SDOValue& sval);
+
+ ///////////////////////////////////////////////////////////////////////////
+ // adds a new entry with the specified property index and value
+ // at the specified entry index.
+ // @param index the index at which to add the entry.
+ // @param propertyIndex the index of the entry's property.
+ // @param value the value for the entry.
+ ///////////////////////////////////////////////////////////////////////////
+ virtual bool addCString( unsigned int index,unsigned int propertyIndex,const char* s );
+ virtual bool addBoolean( unsigned int index,unsigned int propertyIndex,bool b );
+ virtual bool addByte( unsigned int index,unsigned int propertyIndex,char c );
+ virtual bool addCharacter( unsigned int index,unsigned int propertyIndex,wchar_t c );
+ virtual bool addString( unsigned int index,unsigned int propertyIndex,const wchar_t* s , unsigned int len);
+ virtual bool addBytes( unsigned int index,unsigned int propertyIndex,const char* s , unsigned int len);
+ virtual bool addShort( unsigned int index,unsigned int propertyIndex,short s );
+ virtual bool addInt( unsigned int index,unsigned int propertyIndex,long i );
+ virtual bool addLong( unsigned int index,unsigned int propertyIndex,int64_t l );
+ virtual bool addFloat( unsigned int index,unsigned int propertyIndex,float f );
+ virtual bool addDouble( unsigned int index,unsigned int propertyIndex,long double d );
+ virtual bool addDate( unsigned int index,unsigned int propertyIndex,const SDODate t );
+ virtual bool addDataObject(unsigned int index,unsigned int propertyIndex,DataObjectPtr d );
+ virtual bool addSDOValue(unsigned int index, unsigned int propertyIndex, const SDOValue& sval);
+
+ ///////////////////////////////////////////////////////////////////////////
+ // adds a new entry with the specified property and value
+ // at the specified entry index.
+ // @param index the index at which to add the entry.
+ // @param property the property of the entry.
+ // @param value the value for the entry.
+ ///////////////////////////////////////////////////////////////////////////
+ virtual bool addCString( unsigned int index,const Property& property,const char* s );
+ virtual bool addBoolean( unsigned int index,const Property& property,bool b );
+ virtual bool addByte( unsigned int index,const Property& property,char c );
+ virtual bool addCharacter( unsigned int index,const Property& property,wchar_t c );
+ virtual bool addString( unsigned int index,const Property& property,const wchar_t* s , unsigned int len);
+ virtual bool addBytes( unsigned int index,const Property& property,const char* s , unsigned int len);
+ virtual bool addShort( unsigned int index,const Property& property,short s );
+ virtual bool addInt( unsigned int index,const Property& property,long i );
+ virtual bool addLong( unsigned int index,const Property& property,int64_t l );
+ virtual bool addFloat( unsigned int index,const Property& property,float f );
+ virtual bool addDouble( unsigned int index,const Property& property,long double d );
+ virtual bool addDate( unsigned int index,const Property& property,const SDODate t );
+ virtual bool addDataObject(unsigned int index,const Property& property,DataObjectPtr d );
+ virtual bool addSDOValue(unsigned int index, const Property& property, const SDOValue& sval);
+
+ ///////////////////////////////////////////////////////////////////////////
+ // removes the entry at the given entry index.
+ // @param index the index of the entry
+ ///////////////////////////////////////////////////////////////////////////
+ virtual void remove(unsigned int index);
+ virtual void removeAll(const Property& p);
+
+ ///////////////////////////////////////////////////////////////////////////
+ // pushes a new entry without setting the property.
+ // @param index the index of the entry
+ ///////////////////////////////////////////////////////////////////////////
+ virtual void push(const Property& p, unsigned int index);
+
+ ///////////////////////////////////////////////////////////////////////////
+ // Moves the entry at <code>fromIndex</code> to <code>toIndex</code>.
+ // @param toIndex the index of the entry destination.
+ // @param fromIndex the index of the entry to move.
+ ///////////////////////////////////////////////////////////////////////////
+ virtual void move(unsigned int toIndex, unsigned int fromIndex);
+
+ ///////////////////////////////////////////////////////////////////////////
+ // adds a new Setting with the SDO text Property
+ // to the end of the Settings.
+ // @param text value of the Setting.
+ ///////////////////////////////////////////////////////////////////////////
+ virtual bool addText(const char* text);
+
+ ///////////////////////////////////////////////////////////////////////////
+ // adds a new Setting with the SDO text Property
+ // to the Settings.
+ // @param index the index at which to add the entry.
+ // @param text value of the Setting.
+ ///////////////////////////////////////////////////////////////////////////
+ virtual bool addText(unsigned int index, const char* text);
+
+ ///////////////////////////////////////////////////////////////////////////
+ // sets a text Property
+ // @param index the index at which to set the entry.
+ // @param text value of the Setting.
+ ///////////////////////////////////////////////////////////////////////////
+ bool setText(unsigned int index, const char* text);
+
+ ///////////////////////////////////////////////////////////////////////////
+ // Checks if an entry is text or a setting.
+ ///////////////////////////////////////////////////////////////////////////
+ virtual bool isText(unsigned int index);
+
+ SequenceImpl(DataObject* the_do);
+ SequenceImpl(SequenceImpl* s);
+
+ private:
+
+ SequenceImpl();
+
+ DataObjectImpl* the_do;
+
+ class seq_item {
+ public:
+ // Constructors
+ seq_item(const Property* p, unsigned int i):
+ the_prop(p), index(i), freeText(0)
+ {
+ }
+ seq_item(const char* t) :
+ the_prop(0)
+ {
+ freeText = new SDOValue(t);
+ }
+ // Copy constructor
+ seq_item(const seq_item& sin) :
+ index(sin.index), freeText(0), the_prop(sin.the_prop)
+ {
+ if (sin.freeText != 0)
+ {
+ freeText = new SDOValue(*sin.freeText);
+ }
+ }
+
+ // Copy assignment
+ seq_item& operator=(const seq_item& sin)
+ {
+ if (this != &sin)
+ {
+ if (freeText)
+ {
+ delete freeText;
+ }
+ if (sin.freeText != 0)
+ {
+ freeText = new SDOValue(*sin.freeText);
+ }
+ }
+ return *this;
+ }
+
+ // Destructor
+ ~seq_item()
+ {
+ if (freeText)
+ {
+ delete freeText;
+ }
+ }
+
+
+ const Property* getProp() {return the_prop;}
+ unsigned int getIndex() { return index;}
+
+ const char* getText()
+ {
+ return freeText->getCString();
+ }
+
+ const SDOValue* getFreeText()
+ {
+ return freeText;
+ }
+
+ void setProp(Property* p) { the_prop = p;}
+
+ void setText(const char* intext)
+ {
+ if (intext != 0)
+ {
+ if (freeText != 0)
+ {
+ delete freeText;
+ }
+ freeText = new SDOValue(intext);
+ }
+ }
+ void setIndex(unsigned int i)
+ {
+ index = i;
+ }
+ private:
+ const Property* the_prop;
+ unsigned int index;
+ SDOValue* freeText;
+ };
+
+ typedef std::list<seq_item> SEQUENCE_ITEM_LIST;
+ virtual void checkRange(unsigned int index, SEQUENCE_ITEM_LIST::iterator& i);
+
+ SEQUENCE_ITEM_LIST the_list;
+
+};
+};
+};
+
+#endif //_SEQUENCE_H_
diff --git a/sdo-cpp/trunk/runtime/core/src/commonj/sdo/Setting.cpp b/sdo-cpp/trunk/runtime/core/src/commonj/sdo/Setting.cpp
new file mode 100644
index 0000000000..777b9a5ad6
--- /dev/null
+++ b/sdo-cpp/trunk/runtime/core/src/commonj/sdo/Setting.cpp
@@ -0,0 +1,308 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you 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$ */
+
+#include "commonj/sdo/Setting.h"
+#include "commonj/sdo/TypeImpl.h"
+
+namespace commonj{
+namespace sdo {
+
+ Setting::Setting(bool set, bool nul, void* invalue, unsigned int len, const Property& p, unsigned int inindex)
+ : bisSet(set), bisNull(nul) , value(invalue),theProp(&p)
+ {
+ index = inindex;
+ length = len;
+ strbuf = 0;
+ }
+
+ void Setting::copy(const Setting& s)
+ {
+ bisSet = s.isSet();
+ bisNull = s.isNull();
+ index = s.getIndex();
+ length = s.getLength();
+ theProp = &(s.getProperty());
+ strbuf = 0;
+ switch (theProp->getTypeEnum())
+ {
+ case Type::BooleanType:
+ value = new long;
+ *(long*)value = (long)s.getBooleanValue();
+ break;
+ case Type::ByteType:
+ value = new long;
+ *(long*)value = (long)s.getByteValue();
+ break;
+ case Type::CharacterType:
+ value = new long;
+ *(long*)value = (long)s.getCharacterValue();
+ break;
+ case Type::IntType:
+ value = new long;
+ *(long*)value = (long)s.getIntValue();
+ break;
+ case Type::ShortType:
+ value = new long;
+ *(long*)value = (long)s.getShortValue();
+ break;
+ case Type::DoubleType:
+ value = new long double;
+ *(long double*)value = s.getDoubleValue();
+ break;
+ case Type::FloatType:
+ value = new float;
+ *(float*)value = s.getFloatValue();
+ break;
+ case Type::LongType:
+ value = new int64_t;
+ *(int64_t*)value = s.getLongValue();
+ break;
+ case Type::DateType:
+ value = new long;
+ *(long*)value = long(s.getDateValue().getTime());
+ break;
+ case Type::BigDecimalType:
+ case Type::BigIntegerType:
+ case Type::StringType:
+ case Type::UriType:
+ value = new wchar_t[length];
+ s.getStringValue((wchar_t*)value,length);
+ break;
+ case Type::BytesType:
+ value = new char[length];
+ s.getBytesValue((char*)value,length);
+ break;
+ case Type::OtherTypes:
+ case Type::DataObjectType:
+ case Type::ChangeSummaryType:
+ value = getRawPointer(s.getDataObjectValue());
+ default:
+ break;
+ }
+ }
+
+ Setting& Setting::operator=(const Setting& s)
+ {
+ if (this == &s) return *this;
+ copy(s);
+ return *this;
+ }
+
+ Setting::Setting(const Setting& s)
+ {
+ copy(s);
+ }
+
+ Setting::~Setting()
+ {
+ // The value has been allocated for everything except data objects
+
+ switch (theProp->getTypeEnum())
+ {
+ case Type::BooleanType:
+ case Type::ByteType:
+ case Type::CharacterType:
+ case Type::IntType:
+ case Type::ShortType:
+ delete (long*)value;
+ break;
+ case Type::DoubleType:
+ delete (long double*)value;
+ break;
+ case Type::FloatType:
+ delete (float*)value;
+ break;
+ case Type::LongType:
+ delete (int64_t*)value;
+ break;
+ case Type::DateType:
+ delete (long*)value;
+ break;
+ case Type::BigDecimalType:
+ case Type::BigIntegerType:
+ case Type::StringType:
+ case Type::UriType:
+ delete[] (wchar_t*) value;
+ break;
+ case Type::BytesType:
+ delete[] (char*) value;
+ break;
+ case Type::OtherTypes:
+ case Type::DataObjectType:
+ case Type::ChangeSummaryType:
+ default:
+ break;
+ }
+ if (strbuf != 0)
+ {
+ delete[] strbuf;
+ }
+ }
+
+ const Property& Setting::getProperty() const
+ {
+ return *theProp;
+ }
+
+ const Type& Setting::getType() const
+ {
+ return theProp->getType();
+ }
+
+ bool Setting::getBooleanValue() const
+ {
+ TypeImpl* t = (TypeImpl*)&(getType());
+ return t->convertToBoolean(value, length);
+ //if (value == 0) return false;
+ //if (*(long*)value != 0) {
+ // return true;
+ //}
+ //return false;
+ }
+
+ char Setting::getByteValue() const
+ {
+ TypeImpl* t = (TypeImpl*)&(getType());
+ return t->convertToByte(value, length);
+ //if (value == 0) return 0;
+ //return (char)*(long*)value;
+ }
+
+ wchar_t Setting::getCharacterValue() const
+ {
+ TypeImpl* t = (TypeImpl*)&(getType());
+ return t->convertToCharacter(value, length);
+ //if (value == 0) return 0;
+ //return (wchar_t)*(long*)value;
+ }
+
+ unsigned int Setting::getBytesValue(char* buffer, unsigned int max) const
+ {
+ if (buffer == 0 && max == 0) return length;
+
+ TypeImpl* t = (TypeImpl*)&(getType());
+ return t->convertToBytes(value, buffer,length, max);
+ //int i;
+ //char* c = (char*)value;
+ //for (i=0;i < max && i < length;i++)
+ //{
+ // buffer[i] = (char)*c;
+ // c++;
+ //}
+ //return i;
+ }
+
+ unsigned int Setting::getStringValue(wchar_t* buffer, unsigned int max) const
+ {
+ if (buffer == 0 && max == 0) return length;
+
+ TypeImpl* t = (TypeImpl*)&(getType());
+ return t->convertToString(value, buffer,length, max);
+ //int i;
+ //wchar_t* c = (wchar_t*)value;
+ //for (i=0;i < max && i < length;i++)
+ //{
+ // buffer[i] = (wchar_t)*c;
+ // c++;
+ //}
+ //return i;
+ }
+
+ short Setting::getShortValue() const
+ {
+ TypeImpl* t = (TypeImpl*)&(getType());
+ return t->convertToShort(value,length);
+ //return (short)*(long*)value;
+ }
+
+ long Setting::getIntValue() const
+ {
+ TypeImpl* t = (TypeImpl*)&(getType());
+ return t->convertToInt(value, length);
+ //return *(long*)value;
+ }
+
+
+ int64_t Setting::getLongValue() const
+ {
+ TypeImpl* t = (TypeImpl*)&(getType());
+ return t->convertToLong(value, length);
+ //return (int64_t)*(int64_t*)value;
+ }
+
+ float Setting::getFloatValue() const
+ {
+ TypeImpl* t = (TypeImpl*)&(getType());
+ return t->convertToFloat(value, length);
+ //return (float)*(float*)value;
+ }
+
+ const SDODate Setting::getDateValue() const
+ {
+ TypeImpl* t = (TypeImpl*)&(getType());
+ return t->convertToDate(value, length);
+ }
+
+
+ long double Setting::getDoubleValue() const
+ {
+ TypeImpl* t = (TypeImpl*)&(getType());
+ return t->convertToDouble(value, length);
+ //return (long double)*(long double*)value;
+ }
+
+ const char* Setting::getCStringValue()
+ {
+ TypeImpl* t = (TypeImpl*)&(getType());
+ return t->convertToCString(value, &strbuf, length);
+ //return (const char*)value;
+ }
+
+ RefCountingPointer<DataObject> Setting::getDataObjectValue() const
+ {
+ DataObject *dob = (DataObject*)value;
+ return RefCountingPointer<DataObject>(dob);
+ }
+
+
+ unsigned int Setting::getLength() const
+ {
+ return length;
+ }
+
+ unsigned int Setting::getIndex() const
+ {
+ return index;
+ }
+
+ bool Setting::isSet() const
+ {
+ return bisSet;
+ }
+
+ bool Setting::isNull() const
+ {
+ return bisNull;
+ }
+
+};
+};
+
diff --git a/sdo-cpp/trunk/runtime/core/src/commonj/sdo/Setting.h b/sdo-cpp/trunk/runtime/core/src/commonj/sdo/Setting.h
new file mode 100644
index 0000000000..9ba6074e3f
--- /dev/null
+++ b/sdo-cpp/trunk/runtime/core/src/commonj/sdo/Setting.h
@@ -0,0 +1,151 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you 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$ */
+
+#ifndef SETTING_H
+#define SETTING_H
+
+#include "commonj/sdo/export.h"
+
+#include "commonj/sdo/Type.h"
+#include "commonj/sdo/DataObject.h"
+#include "commonj/sdo/SDODate.h"
+
+namespace commonj{
+namespace sdo {
+
+ class Property;
+
+ /**
+ * A Setting encapsulates a property and a corresponding single value of
+ * the property's type.
+ */
+
+ class Setting
+ {
+ public:
+
+ Setting(bool set, bool nul, void* invalue, unsigned int len, const Property& p,
+ unsigned int inindex);
+
+ Setting(const Setting& s);
+
+ void copy(const Setting& s);
+
+ Setting& operator=(const Setting& s);
+
+
+ virtual ~Setting();
+
+
+ /** getProperty returns the property set.
+ *
+ * Returns the property of the Setting.
+ * @return the Setting property.
+ */
+
+ SDO_API const Property& getProperty() const;
+
+ /** getType returns the type of the property
+ *
+ * Returns the type of this property. This is the same as
+ * getProperty().getType()
+ */
+
+ SDO_API const Type& getType() const;
+
+ /** getTypeEnum returns the type enumerator
+ *
+ * Returns the enum for the type of this property
+ */
+
+ SDO_API Type::Types getTypeEnum() const;
+
+
+ /** get methods get the right type of value from the setting
+ *
+ *
+ * Returns the value of the Setting. This must be of the right type for
+ * Setting value.
+ */
+
+ SDO_API bool getBooleanValue() const;
+ SDO_API char getByteValue() const;
+ SDO_API wchar_t getCharacterValue() const;
+ SDO_API unsigned int getBytesValue(char* buffer, unsigned int max) const;
+ SDO_API unsigned int getStringValue(wchar_t* buffer, unsigned int max) const;
+ SDO_API short getShortValue() const;
+ SDO_API long getIntValue() const;
+ SDO_API int64_t getLongValue() const;
+ SDO_API float getFloatValue() const;
+ SDO_API long double getDoubleValue() const;
+ SDO_API const SDODate getDateValue() const;
+ SDO_API const char* getCStringValue() ;
+ SDO_API DataObjectPtr getDataObjectValue() const;
+
+
+
+ /** getIndex returns the index in a many-valued property
+ *
+ * Returns the index of the Setting, if this is many valued
+ */
+
+ SDO_API unsigned int getIndex() const;
+
+
+ /** getLength gives the length of a string or bytes
+ *
+ * Returns the length of the setting, if this is a String or
+ * Bytes type
+ */
+
+ SDO_API unsigned int getLength() const ;
+
+ /** isSet returns whether the property WAS set.
+ *
+ * Returns whether or not the property is set. This value comes from the
+ * setting, and tells us whether the property was set before the change
+ * occurred.
+ */
+
+ SDO_API bool isSet() const;
+
+ /** isNull is true if the property value WAS null
+ *
+ * Returns whether or not the property was null beforfe the setting
+ * happened.
+ */
+
+ SDO_API bool isNull() const;
+
+ private:
+
+ bool bisSet;
+ bool bisNull;
+ void* value;
+ const Property* theProp;
+ unsigned int length;
+ unsigned int index;
+ char* strbuf;
+ };
+};
+};
+
+#endif
diff --git a/sdo-cpp/trunk/runtime/core/src/commonj/sdo/SettingList.cpp b/sdo-cpp/trunk/runtime/core/src/commonj/sdo/SettingList.cpp
new file mode 100644
index 0000000000..efb1712472
--- /dev/null
+++ b/sdo-cpp/trunk/runtime/core/src/commonj/sdo/SettingList.cpp
@@ -0,0 +1,114 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you 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$ */
+
+#include "commonj/sdo/SDORuntimeException.h"
+
+#include "commonj/sdo/SettingList.h"
+#include "commonj/sdo/Logger.h"
+#include "commonj/sdo/Setting.h"
+
+namespace commonj{
+namespace sdo {
+
+
+//SettingList::SettingList(SETTING_VECTOR p) : slist (p)
+//{
+//}
+
+/*SettingList::SettingList(const SettingList &pin)
+{
+ Logger::log("SettingList copy constructor\n");
+ slist = std::vector<Setting>(pin.getVec());
+}
+*/
+
+SettingList::SettingList()
+{
+}
+
+SettingList::~SettingList()
+{
+ while (slist.size() > 0)
+ {
+ Setting* s = slist[0];
+ slist.erase(slist.begin());
+ delete s;
+ }
+
+}
+
+
+Setting& SettingList::operator[] (int pos) const
+{
+ validateIndex(pos);
+ return (*slist[pos]);
+}
+
+Setting* SettingList::get(int pos)
+{
+ validateIndex(pos);
+ return (slist[pos]);
+}
+
+int SettingList::size () const
+{
+ return slist.size();
+}
+
+//SETTING_VECTOR SettingList::getVec() const
+//{
+// return slist;
+//}
+
+void SettingList::insert (unsigned int index, Setting* d)
+{
+ slist.insert(slist.begin()+index, d);
+}
+
+void SettingList::append ( Setting* d)
+{
+ slist.push_back(d);
+}
+
+void SettingList::remove(unsigned int index)
+{
+ validateIndex(index);
+ const Setting* s = slist[index];
+ slist.erase(slist.begin()+index);
+ delete s;
+ return;
+}
+
+void SettingList::validateIndex(int index) const
+{
+ if ((index < 0) || (index > size()))
+ {
+ std::string msg("Index out of range:");
+ msg += index;
+ throw SDOIndexOutOfRangeException(TUSCANY_SDO_EINFO,
+ msg.c_str());
+ }
+
+}
+
+};
+};
+
diff --git a/sdo-cpp/trunk/runtime/core/src/commonj/sdo/SettingList.h b/sdo-cpp/trunk/runtime/core/src/commonj/sdo/SettingList.h
new file mode 100644
index 0000000000..1f34acea72
--- /dev/null
+++ b/sdo-cpp/trunk/runtime/core/src/commonj/sdo/SettingList.h
@@ -0,0 +1,77 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you 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$ */
+
+#ifndef SETTINGLIST_H
+#define SETTINGLIST_H
+
+
+
+#include <vector>
+#include "commonj/sdo/Setting.h"
+
+namespace commonj{
+namespace sdo{
+
+typedef std::vector< Setting*> SETTING_VECTOR;
+
+/** SettingList is a list of settings returned by a change summary
+ */
+
+class SettingList
+{
+
+public:
+ //SettingList(SETTING_VECTOR sl);
+ SettingList();
+
+ virtual ~SettingList();
+
+ /** [] is the index operator
+ *
+ * This gives access to elements of the list
+ */
+
+ SDO_API virtual Setting& operator[] (int pos) const;
+
+ /** size() returns the number of settings
+ *
+ * This method returns the size of the list os settings found.
+ * These may be creations, deletions or changes.
+ */
+
+ SDO_API virtual int size () const;
+
+ virtual void insert (unsigned int index, Setting* d);
+ virtual void append ( Setting* d);
+ virtual void remove (unsigned int index);
+ virtual Setting* get (int pos);
+
+
+private:
+ SETTING_VECTOR slist;
+
+ void validateIndex(int index) const;
+};
+
+};
+};
+
+#endif
diff --git a/sdo-cpp/trunk/runtime/core/src/commonj/sdo/Type.cpp b/sdo-cpp/trunk/runtime/core/src/commonj/sdo/Type.cpp
new file mode 100644
index 0000000000..74134032ef
--- /dev/null
+++ b/sdo-cpp/trunk/runtime/core/src/commonj/sdo/Type.cpp
@@ -0,0 +1,36 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you 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$ */
+
+#include "commonj/sdo/Type.h"
+
+namespace commonj{
+namespace sdo{
+
+
+ Type::~Type()
+ {
+ }
+
+};
+};
+// end - namespace sdo
+
+
diff --git a/sdo-cpp/trunk/runtime/core/src/commonj/sdo/Type.h b/sdo-cpp/trunk/runtime/core/src/commonj/sdo/Type.h
new file mode 100644
index 0000000000..87c6f2c3c4
--- /dev/null
+++ b/sdo-cpp/trunk/runtime/core/src/commonj/sdo/Type.h
@@ -0,0 +1,228 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you 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$ */
+
+#ifndef _SDO_TYPE_H_
+#define _SDO_TYPE_H_
+
+
+#include "commonj/sdo/export.h"
+
+#include "commonj/sdo/PropertyList.h"
+#include "commonj/sdo/SDOString.h"
+
+
+namespace commonj{
+namespace sdo{
+
+
+
+
+class Property;
+
+ /**
+ *
+ * Type is a representation of the type of a property of a data object.
+ */
+
+class Type
+{
+
+public:
+
+
+/** \enum Types
+ *
+ * This is the enumerator for all DataType types. All DataObjectType types
+ * appear as a Type::Types of DataObjectType.
+ * otherTypes, ChangeSumamryType and TextType are not used by client code.
+ */
+
+
+ SDO_API enum Types
+ {
+ // Zero is a value for 'unknown type; - all data objects'
+ OtherTypes = 0,
+ BigDecimalType,
+ BigIntegerType,
+ BooleanType,
+ ByteType,
+ BytesType,
+ CharacterType,
+ DateType,
+ DoubleType,
+ FloatType,
+ IntType,
+ LongType,
+ ShortType,
+ StringType,
+ UriType,
+ DataObjectType,
+ ChangeSummaryType,
+ TextType,
+ };
+
+ virtual SDO_API ~Type();
+
+ /** getName returns the name of the type
+ *
+ * This method returns a const char* name of the type.
+ */
+
+ virtual SDO_API const char* getName() const = 0;
+
+ /** getAlias returns the n'th alias
+ *
+ * This method returns a const char* corresponding to the
+ * alias at index n of the list of aliases. Use getAliasCount to
+ * discover the size of the list.
+ */
+
+ virtual SDO_API const char* getAlias(unsigned int index = 0) const = 0;
+
+ /** getAliasCount returns the number of aliases
+ *
+ * This method returns the number of aliases for this type
+ */
+
+ virtual SDO_API unsigned int getAliasCount() const = 0;
+
+ /** getBaseType returns the base if there is one
+ *
+ * This method returns a const Type* corresponding to the
+ * base Type for this type. The base type is the one which
+ * this type inherits from.
+ */
+
+ virtual SDO_API const Type* getBaseType() const = 0;
+
+ /** getURI returns the URI for this type
+ *
+ * This method returns the URI for this type. The URI may be
+ * null.
+ */
+
+ virtual SDO_API const char* getURI() const = 0;
+
+
+
+ /** getProperties returns a list of properties for this type
+ *
+ * This method returns the list of properties for this type.
+ * Instances of open types may have more properties than appear
+ * in this list.
+ * See the propertylist API.
+ */
+
+ virtual SDO_API PropertyList getProperties() const = 0;
+
+
+ /** getProperty returns a property for this type
+ *
+ * This method returns a property, by index or by name
+ */
+
+ virtual SDO_API const Property& getProperty(const char* propertyName) const = 0;
+ virtual SDO_API const Property& getProperty(const SDOString& propertyName) const = 0;
+ virtual SDO_API const Property& getProperty(unsigned int index) const = 0;
+
+ /** getPropertyIndex returns an index
+ *
+ * This method returns a property index for a named property
+ */
+
+ virtual SDO_API unsigned int getPropertyIndex(const char* propertyName) const = 0;
+ virtual SDO_API unsigned int getPropertyIndex(const SDOString& propertyName) const = 0;
+
+ /** isDataObjectType true if not a DataType
+ *
+ * This method returns true if the type is not a DataType, and is therefore
+ * a DataObjectType with properties.
+ */
+
+ virtual SDO_API bool isDataObjectType() const = 0;
+
+
+ /** isSequencedType true if the type is sequenced
+ *
+ * This method returns true if the type is sequenced, and is therefore
+ * objects of this type can be manipulate via their sequence interface.
+ */
+
+ virtual SDO_API bool isSequencedType() const = 0;
+
+
+ /** isOpenType true if the type is open
+ *
+ * Normal types have a predefined list of properties. Trying to set
+ * properties which do not exist will cause an exception to be thrown.
+ * Open types, on the other hand, may have properties added to their
+ * instances runtime. These properties get added silently when setting a
+ * property value for a property which does not exist.
+ * Different instances of these objects may have different lists of
+ * open properties.
+ */
+
+ virtual SDO_API bool isOpenType() const = 0;
+
+ /** isAbstractType true if the type is not instantiable.
+ *
+ * An abstract type may not be instantiated. It is useful only as
+ * a base type to some other non-abstract type.
+ */
+
+ virtual SDO_API bool isAbstractType() const = 0;
+
+ /** isDataType true if the type is not an object.
+ *
+ * A DataType is anything which is not a DataObjectType. This method
+ * is the opposite of isDataObjectType().
+ */
+
+ virtual SDO_API bool isDataType() const = 0;
+
+
+ /** isChangeSummaryType true if the type is a change summary.
+ *
+ * There is only one type called ChangeSummary. This method serves
+ * no purpose in the C++ implementation.
+ */
+
+ virtual SDO_API bool isChangeSummaryType() const = 0;
+
+ /** getTypeEnum gets the enum for this type.
+ *
+ * Each DataType has a defined value in the list of Types.
+ */
+
+ virtual SDO_API Type::Types getTypeEnum() const = 0;
+
+ /** equals compares uri and name.
+ *
+ * The types are equal if the URI and Name are equal.
+ */
+
+ virtual SDO_API bool equals(const Type& tother) const = 0;
+};
+
+};
+};
+#endif //_SDO_TYPE_H_
+
diff --git a/sdo-cpp/trunk/runtime/core/src/commonj/sdo/TypeDefinition.cpp b/sdo-cpp/trunk/runtime/core/src/commonj/sdo/TypeDefinition.cpp
new file mode 100644
index 0000000000..c481b075d3
--- /dev/null
+++ b/sdo-cpp/trunk/runtime/core/src/commonj/sdo/TypeDefinition.cpp
@@ -0,0 +1,259 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you 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$ */
+
+#include "commonj/sdo/TypeDefinition.h"
+#include "commonj/sdo/TypeDefinitionImpl.h"
+
+namespace commonj
+{
+ namespace sdo
+ {
+ namespace internal
+ {
+ TypeDefinition::TypeDefinition()
+ {
+ typedefinition = new TypeDefinitionImpl();
+ }
+
+ TypeDefinition::~TypeDefinition()
+ {
+ if (typedefinition != 0) delete typedefinition;
+ }
+
+ void TypeDefinition::copy (const TypeDefinition& td)
+ {
+ if (typedefinition != 0) delete typedefinition;
+ typedefinition = new TypeDefinitionImpl(*(td.typedefinition));
+ }
+
+ TypeDefinition::TypeDefinition(const TypeDefinition& td)
+ {
+ copy(td);
+ }
+
+ TypeDefinition& TypeDefinition::operator=(const TypeDefinition& td)
+ {
+ if (this != &td)
+ {
+ copy(td);
+ }
+ return *this;
+ }
+
+ TypeDefinitionImpl* TypeDefinition::getTypeDefinition()
+ {
+ return typedefinition;
+ }
+
+ void TypeDefinition::setUri(const char * inuri)
+ {
+ typedefinition->uri = inuri;
+ }
+ void TypeDefinition::setUri(const SDOString& inuri)
+ {
+ typedefinition->uri = inuri.c_str();
+ }
+
+ const char * TypeDefinition::getUri() const
+ {
+ return (const char *)typedefinition->uri;
+ }
+
+
+ void TypeDefinition::setName(const char * inname)
+ {
+ typedefinition->name = inname;
+ }
+ void TypeDefinition::setName(const SDOString& inname)
+ {
+ typedefinition->name = inname.c_str();
+ }
+
+ const char * TypeDefinition::getName() const
+ {
+ return (const char *)typedefinition->name;
+ }
+
+
+ void TypeDefinition::setLocalName(const char * inname)
+ {
+ typedefinition->localname = inname;
+ }
+ void TypeDefinition::setLocalName(const SDOString& inname)
+ {
+ typedefinition->localname = inname.c_str();
+ }
+
+ const char * TypeDefinition::getLocalName() const
+ {
+ return (const char *)typedefinition->localname;
+ }
+
+
+ void TypeDefinition::setAliases(const char * inaliases)
+ {
+ typedefinition->aliases = inaliases;
+ }
+ void TypeDefinition::setAliases(const SDOString& inaliases)
+ {
+ typedefinition->aliases = inaliases.c_str();
+ }
+
+ const char * TypeDefinition::getAliases() const
+ {
+ return (const char*)typedefinition->aliases;
+ }
+
+ void TypeDefinition::setParentType(const char* uri, const char* name,
+ bool isrestriction)
+ {
+ typedefinition->parentTypeUri = uri;
+ 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
+ {
+ return (const char *)typedefinition->parentTypeUri;
+ }
+
+ const char * TypeDefinition::getParentTypeName() const
+ {
+ return (const char *)typedefinition->parentTypeName;
+ }
+
+ 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
+ {
+ return (const char *)typedefinition->IDPropertyName;
+ }
+
+ void TypeDefinition::addPropertyDefinition(PropertyDefinition& p)
+ {
+ typedefinition->properties.push_back((PropertyDefinitionImpl&)(*(p.getPropertyDefinition())));
+ }
+
+ bool TypeDefinition::getIsDataType() const
+ {
+ return typedefinition->dataType;
+ }
+
+ bool TypeDefinition::getIsOpen() const
+ {
+ return typedefinition->isOpen;
+ }
+
+ bool TypeDefinition::getIsSequenced() const
+ {
+ return typedefinition->isSequenced;
+ }
+
+ bool TypeDefinition::getIsAbstract() const
+ {
+ return typedefinition->isAbstract;
+ }
+
+ bool TypeDefinition::getIsExtendedPrimitive() const
+ {
+ return typedefinition->isExtendedPrimitive;
+ }
+
+ bool TypeDefinition::getIsFromList() const
+ {
+ return typedefinition->isFromList;
+ }
+
+ bool TypeDefinition::getIsQName() const
+ {
+ return typedefinition->isQName;
+ }
+
+ bool TypeDefinition::getIsMany() const
+ {
+ return typedefinition->isMany;
+ }
+
+ void TypeDefinition::setIsDataType(bool value)
+ {
+ typedefinition->dataType = value;
+ }
+
+ void TypeDefinition::setIsOpen(bool value)
+ {
+ typedefinition->isOpen = value;
+ }
+
+ void TypeDefinition::setIsSequenced(bool value)
+ {
+ typedefinition->isSequenced = value;
+ }
+
+ void TypeDefinition::setIsAbstract(bool value)
+ {
+ typedefinition->isAbstract = value;
+ }
+
+ void TypeDefinition::setIsExtendedPrimitive(bool value)
+ {
+ typedefinition->isExtendedPrimitive = value;
+ }
+
+ void TypeDefinition::setIsFromList(bool value)
+ {
+ typedefinition->isFromList = value;
+ }
+
+ void TypeDefinition::setIsQName(bool value)
+ {
+ typedefinition->isQName = value;
+ }
+
+ void TypeDefinition::setIsMany(bool value)
+ {
+ typedefinition->isMany = value;
+ }
+
+
+ int TypeDefinition::getGroupElementCount() const
+ {
+ return typedefinition->groupElementCount;
+ }
+
+
+ } // End - namespace internal
+ } // End - namespace sdo
+} // End - namespace commonj
diff --git a/sdo-cpp/trunk/runtime/core/src/commonj/sdo/TypeDefinition.h b/sdo-cpp/trunk/runtime/core/src/commonj/sdo/TypeDefinition.h
new file mode 100644
index 0000000000..5dae6f7155
--- /dev/null
+++ b/sdo-cpp/trunk/runtime/core/src/commonj/sdo/TypeDefinition.h
@@ -0,0 +1,125 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you 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$ */
+
+#ifndef _TYPEDefinition_H_
+#define _TYPEDefinition_H_
+
+#include "export.h"
+
+
+#include "commonj/sdo/PropertyDefinition.h"
+#include "commonj/sdo/SDOString.h"
+#include "list"
+
+
+namespace commonj
+{
+ namespace sdo
+ {
+ namespace internal
+ {
+
+ class TypeDefinitionImpl;
+
+
+/**
+ * Internal Helper Class
+ * TypeDefinitionImpl holds information gathered from parsing the
+ * XSD and used for creating Types
+ */
+ class SDO_API TypeDefinition
+ {
+
+ public:
+
+
+ TypeDefinition();
+ TypeDefinition(const TypeDefinition& td);
+ TypeDefinition& operator=(const TypeDefinition& td);
+
+ virtual ~TypeDefinition();
+
+
+ TypeDefinitionImpl* getTypeDefinition();
+
+ void setUri(const char * inuri) ;
+ void setUri(const SDOString& inuri) ;
+
+ const char * getUri() const;
+
+ void setName(const char * inname) ;
+ void setName(const SDOString& inname) ;
+ const char * getName() const;
+
+ void setLocalName(const char * inname) ;
+ void setLocalName(const SDOString& inname) ;
+ const char * getLocalName() const;
+
+ void setAliases(const char * inaliases) ;
+ void setAliases(const SDOString& inaliases) ;
+ const char * getAliases() const;
+
+
+ void setParentType(const char* uri, const char* name,
+ bool isrestriction);
+ void setParentType(const SDOString& uri,
+ const SDOString& name,
+ bool isrestriction);
+ const char * getParentTypeUri() const;
+ const char * getParentTypeName() const;
+
+ void setIDPropertyName(const char * idpropname) ;
+ void setIDPropertyName(const SDOString& idpropname) ;
+ const char * getIDPropertyName() const;
+
+
+ void addPropertyDefinition(PropertyDefinition& p);
+
+ bool getIsDataType() const;
+ bool getIsOpen() const;
+ bool getIsSequenced() const;
+ bool getIsAbstract() const;
+ bool getIsExtendedPrimitive() const;
+ bool getIsFromList() const;
+ bool getIsQName() const;
+ bool getIsMany() const;
+
+ void setIsDataType(bool value);
+ void setIsOpen(bool value);
+ void setIsSequenced(bool value);
+ void setIsAbstract(bool value);
+ void setIsExtendedPrimitive(bool value);
+ void setIsFromList(bool value);
+ void setIsQName(bool value);
+ void setIsMany(bool value);
+
+ int getGroupElementCount() const;
+
+ private:
+ TypeDefinitionImpl *typedefinition;
+ void copy(const TypeDefinition& td);
+ };
+ } // End - namespace internal
+ } // End - namespace sdo
+} // End - namespace commonj
+
+
+#endif //_TYPEDefinition_H_
diff --git a/sdo-cpp/trunk/runtime/core/src/commonj/sdo/TypeDefinitionImpl.cpp b/sdo-cpp/trunk/runtime/core/src/commonj/sdo/TypeDefinitionImpl.cpp
new file mode 100644
index 0000000000..f581bc4a1f
--- /dev/null
+++ b/sdo-cpp/trunk/runtime/core/src/commonj/sdo/TypeDefinitionImpl.cpp
@@ -0,0 +1,50 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you 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$ */
+
+#include "commonj/sdo/TypeDefinitionImpl.h"
+namespace commonj
+{
+ namespace sdo
+ {
+ namespace internal
+ {
+ TypeDefinitionImpl::TypeDefinitionImpl()
+ : dataType(false),
+ isOpen(false),
+ isSequenced(false),
+ isMany(false),
+ isQName(false),
+ isAbstract(false),
+ groupElementCount(0),
+ isExtendedPrimitive(false),
+ isFromList(false)
+ {
+ }
+
+ TypeDefinitionImpl::~TypeDefinitionImpl()
+ {
+ }
+
+ } // End - namespace internal
+ } // End - namespace sdo
+} // End - namespace commonj
+
+
diff --git a/sdo-cpp/trunk/runtime/core/src/commonj/sdo/TypeDefinitionImpl.h b/sdo-cpp/trunk/runtime/core/src/commonj/sdo/TypeDefinitionImpl.h
new file mode 100644
index 0000000000..e660ed1a12
--- /dev/null
+++ b/sdo-cpp/trunk/runtime/core/src/commonj/sdo/TypeDefinitionImpl.h
@@ -0,0 +1,87 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you 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$ */
+
+#ifndef _TYPEDefinitionImpl_H_
+#define _TYPEDefinitionImpl_H_
+
+#include "commonj/sdo/disable_warn.h"
+
+#include "commonj/sdo/PropertyDefinitionImpl.h"
+#include "list"
+
+
+namespace commonj
+{
+ namespace sdo
+ {
+ namespace internal
+ {
+
+ typedef std::list<PropertyDefinitionImpl> XmlDasPropertyDefs;
+
+/**
+ * Internal Helper Class
+ * TypeDefinitionImpl holds information gathered from parsing the
+ * XSD and used for creating Types
+ */
+ class TypeDefinitionImpl
+ {
+
+ public:
+ TypeDefinitionImpl();
+ virtual ~TypeDefinitionImpl();
+
+
+ SDOXMLString uri;
+ SDOXMLString name;
+ SDOXMLString localname;
+
+ SDOXMLString aliases;
+
+ SDOXMLString parentTypeUri;
+ SDOXMLString parentTypeName;
+ bool isRestriction;
+
+ SDOXMLString IDPropertyName;
+
+ bool dataType;
+ XmlDasPropertyDefs properties;
+
+ bool isOpen;
+ bool isSequenced;
+ bool isAbstract;
+
+ bool isExtendedPrimitive;
+
+ bool isFromList;
+
+
+ bool isMany;
+ int groupElementCount;
+
+ bool isQName;
+ };
+ } // End - namespace internal
+ } // End - namespace sdo
+} // End - namespace commonj
+
+
+#endif //_TYPEDefinitionImpl_H_
diff --git a/sdo-cpp/trunk/runtime/core/src/commonj/sdo/TypeDefinitions.cpp b/sdo-cpp/trunk/runtime/core/src/commonj/sdo/TypeDefinitions.cpp
new file mode 100644
index 0000000000..45d45395ef
--- /dev/null
+++ b/sdo-cpp/trunk/runtime/core/src/commonj/sdo/TypeDefinitions.cpp
@@ -0,0 +1,89 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you 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$ */
+
+
+#include "commonj/sdo/TypeDefinitions.h"
+#include "commonj/sdo/TypeDefinitionsImpl.h"
+
+namespace commonj
+{
+ namespace sdo
+ {
+ namespace internal
+ {
+
+ TypeDefinitions::TypeDefinitions()
+ {
+ typedefinitions = new TypeDefinitionsImpl();
+ }
+
+ TypeDefinitions::~TypeDefinitions()
+ {
+ if (typedefinitions != 0) delete typedefinitions;
+ }
+
+ void TypeDefinitions::copy (const TypeDefinitions& tds)
+ {
+ if (typedefinitions != 0) delete typedefinitions;
+ typedefinitions = new TypeDefinitionsImpl(*(tds.typedefinitions));
+ }
+
+ TypeDefinitions::TypeDefinitions(const TypeDefinitions& tds)
+ {
+ copy(tds);
+ }
+
+ TypeDefinitions::TypeDefinitions(const TypeDefinitionsImpl& tds)
+ {
+ typedefinitions = new TypeDefinitionsImpl(tds);
+ }
+
+ void TypeDefinitions::addTypeDefinition(TypeDefinition& t)
+ {
+ if (typedefinitions == 0)
+ {
+ typedefinitions = new TypeDefinitionsImpl();
+ }
+
+ typedefinitions->types[
+ typedefinitions->getTypeQName(
+ t.getUri(),t.getName())] = (TypeDefinitionImpl&)(*t.getTypeDefinition());
+ }
+
+ TypeDefinitionsImpl& TypeDefinitions::getTypeDefinitions()
+ {
+ if (typedefinitions == 0)
+ {
+ typedefinitions = new TypeDefinitionsImpl();
+ }
+ return *typedefinitions;
+ }
+
+ unsigned int TypeDefinitions::size()
+ {
+ return typedefinitions->types.size();
+ }
+
+ } // End - namespace internal
+ } // End - namespace sdo
+} // End - namespace commonj
+
+
diff --git a/sdo-cpp/trunk/runtime/core/src/commonj/sdo/TypeDefinitions.h b/sdo-cpp/trunk/runtime/core/src/commonj/sdo/TypeDefinitions.h
new file mode 100644
index 0000000000..f64b14be01
--- /dev/null
+++ b/sdo-cpp/trunk/runtime/core/src/commonj/sdo/TypeDefinitions.h
@@ -0,0 +1,72 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you 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$ */
+
+#ifndef _TYPEDefinitions_H_
+#define _TYPEDefinitions_H_
+
+
+#include "commonj/sdo/TypeDefinition.h"
+
+namespace commonj
+{
+ namespace sdo
+ {
+ namespace internal
+ {
+
+ class TypeDefinitionsImpl;
+
+/**
+ * Internal Helper Class
+ * TypeDefinitionsImpl holds a list information gathered from parsing the
+ * XSD and used for creating Types
+ */
+ class SDO_API TypeDefinitions
+ {
+
+ public:
+ TypeDefinitions();
+ TypeDefinitions(const TypeDefinitions& tds);
+ TypeDefinitions& operator=(const TypeDefinitions& tds);
+
+ TypeDefinitions(const TypeDefinitionsImpl& tds);
+
+ virtual ~TypeDefinitions();
+
+ void addTypeDefinition(TypeDefinition& t);
+
+ TypeDefinitionsImpl& getTypeDefinitions();
+
+ unsigned int size();
+
+ protected:
+ TypeDefinitionsImpl* typedefinitions;
+ void copy(const TypeDefinitions& tds);
+
+ friend class XSDHelperImpl;
+
+ };
+ } // End - namespace internal
+ } // End - namespace sdo
+} // End - namespace commonj
+
+
+#endif //_TYPEDefinitions_H_
diff --git a/sdo-cpp/trunk/runtime/core/src/commonj/sdo/TypeDefinitionsImpl.cpp b/sdo-cpp/trunk/runtime/core/src/commonj/sdo/TypeDefinitionsImpl.cpp
new file mode 100644
index 0000000000..dccb77b3d0
--- /dev/null
+++ b/sdo-cpp/trunk/runtime/core/src/commonj/sdo/TypeDefinitionsImpl.cpp
@@ -0,0 +1,54 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you 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$ */
+
+#include "commonj/sdo/TypeDefinitionsImpl.h"
+namespace commonj
+{
+ namespace sdo
+ {
+ namespace internal
+ {
+ TypeDefinitionsImpl::TypeDefinitionsImpl()
+ {
+ }
+
+ TypeDefinitionsImpl::~TypeDefinitionsImpl()
+ {
+ }
+
+ void TypeDefinitionsImpl::addTypeDefinitions(const TypeDefinitionsImpl& typedefs)
+ {
+ XMLDAS_TypeDefs::const_iterator iter;
+ for (iter=typedefs.types.begin(); iter != typedefs.types.end(); iter++)
+ {
+ types.insert(*iter);
+ }
+
+ }
+
+ SDOXMLString TypeDefinitionsImpl::getTypeQName(const SDOXMLString& typeUri, const SDOXMLString& typeName)
+ {
+ return typeUri + "#" + typeName;
+ }
+
+ } // End - namespace internal
+ } // End - namespace sdo
+} // End - namespace commonj
diff --git a/sdo-cpp/trunk/runtime/core/src/commonj/sdo/TypeDefinitionsImpl.h b/sdo-cpp/trunk/runtime/core/src/commonj/sdo/TypeDefinitionsImpl.h
new file mode 100644
index 0000000000..e41cfa4898
--- /dev/null
+++ b/sdo-cpp/trunk/runtime/core/src/commonj/sdo/TypeDefinitionsImpl.h
@@ -0,0 +1,61 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you 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$ */
+
+#ifndef _TYPEDefinitionsImpl_H_
+#define _TYPEDefinitionsImpl_H_
+
+#include "commonj/sdo/disable_warn.h"
+
+#include "commonj/sdo/TypeDefinitionImpl.h"
+#include <map>
+
+namespace commonj
+{
+ namespace sdo
+ {
+ namespace internal
+ {
+ typedef std::map<SDOXMLString, TypeDefinitionImpl> XMLDAS_TypeDefs;
+
+/**
+ * Internal Helper Class
+ * TypeDefinitionsImpl holds a list information gathered from parsing the
+ * XSD and used for creating Types
+ */
+ class TypeDefinitionsImpl
+ {
+
+ public:
+ TypeDefinitionsImpl();
+ virtual ~TypeDefinitionsImpl();
+ void addTypeDefinitions(const TypeDefinitionsImpl& types);
+ static SDOXMLString getTypeQName(const SDOXMLString& typeUri, const SDOXMLString& typeName);
+
+
+ XMLDAS_TypeDefs types;
+
+ };
+ } // End - namespace internal
+ } // End - namespace sdo
+} // End - namespace commonj
+
+
+#endif //_TYPEDefinitionsImpl_H_
diff --git a/sdo-cpp/trunk/runtime/core/src/commonj/sdo/TypeImpl.cpp b/sdo-cpp/trunk/runtime/core/src/commonj/sdo/TypeImpl.cpp
new file mode 100644
index 0000000000..dc840a0d46
--- /dev/null
+++ b/sdo-cpp/trunk/runtime/core/src/commonj/sdo/TypeImpl.cpp
@@ -0,0 +1,4065 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you 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$ */
+
+#include "commonj/sdo/Logger.h"
+
+#include "commonj/sdo/PropertyImpl.h"
+#include "commonj/sdo/SDODataConverter.h"
+#include "commonj/sdo/TypeImpl.h"
+
+#include <iostream>
+#include <wchar.h>
+#include <stdio.h>
+#include <stdlib.h>
+using namespace std;
+
+#include <list>
+#include <vector>
+using namespace std;
+
+#include "commonj/sdo/SDORuntimeException.h"
+#include "commonj/sdo/SDOUtils.h"
+
+namespace commonj{
+namespace sdo{
+
+
+ using internal::SDOUtils;
+
+ Type::Types
+ toTypeEnum(const SDOString& typeName)
+ {
+ switch (typeName.size()) {
+ case 3:
+ if (typeName == "URI") return Type::UriType;
+ if (typeName == "Int") return Type::IntType;
+ break;
+ case 4:
+ if (typeName == "Byte") return Type::ByteType;
+ if (typeName == "Date") return Type::DateType;
+ if (typeName == "Long") return Type::LongType;
+ if (typeName == "Text") return Type::TextType;
+ break;
+ case 5:
+ if (typeName == "Bytes") return Type::BytesType;
+ if (typeName == "Float") return Type::FloatType;
+ if (typeName == "Short") return Type::ShortType;
+ break;
+ case 6:
+ if (typeName == "Double") return Type::DoubleType;
+ if (typeName == "String") return Type::StringType;
+ break;
+ case 7:
+ if (typeName == "Boolean") return Type::BooleanType;
+ if (typeName == "Decimal") return Type::BigDecimalType;
+ if (typeName == "Integer") return Type::BigIntegerType;
+ break;
+ case 9:
+ if (typeName == "Character") return Type::CharacterType;
+ break;
+ case 10:
+ if (typeName == "DataObject") return Type::DataObjectType;
+ break;
+ case 13:
+ if (typeName == "ChangeSummary") return Type::ChangeSummaryType;
+ break;
+ case 14:
+ if (typeName == "OpenDataObject") return Type::DataObjectType;
+ break;
+ };
+ return Type::OtherTypes;
+ }
+
+ bool
+ enumIsPrimitive(Type::Types enumValue)
+ {
+ switch (enumValue) {
+ case Type::ChangeSummaryType:
+ case Type::DataObjectType:
+ case Type::OtherTypes:
+ case Type::TextType:
+ return false;
+ };
+ return true;
+ }
+
+ ///////////////////////////////////////////////////////////////////////////
+ //
+ ///////////////////////////////////////////////////////////////////////////
+
+ void TypeImpl::addChangeSummary(void)
+ {
+ changeSummaryType = true;
+ }
+
+ bool TypeImpl::isChangeSummaryType() const
+ {
+ return changeSummaryType;
+ }
+
+
+ ///////////////////////////////////////////////////////////////////////////
+ //
+ ///////////////////////////////////////////////////////////////////////////
+
+ bool TypeImpl::isFromList() const
+ {
+ return bFromList;
+ }
+ ///////////////////////////////////////////////////////////////////////////
+ //
+ ///////////////////////////////////////////////////////////////////////////
+
+ bool TypeImpl::isDataType(void) const
+ {
+ return isPrimitive;
+ }
+
+ ///////////////////////////////////////////////////////////////////////////
+ //
+ ///////////////////////////////////////////////////////////////////////////
+
+ TypeImpl::TypeImpl(const TypeImpl& t)
+ {
+ isResolving = false;
+ isResolved = false;
+ brestriction = t.brestriction;
+ bFromList = t.bFromList;
+ }
+
+ TypeImpl::TypeImpl(const Type* base, const char* uri,
+ const char* inname,
+ bool isSeq,
+ bool isOp,
+ bool isAbs,
+ bool isData,
+ bool isRestriction)
+ {
+ init(uri,inname,isSeq,isOp, isAbs, isData);
+ setBaseType(base, isRestriction);
+ bFromList = false;
+ }
+
+ TypeImpl::TypeImpl(const char* uri, const char* inname,
+ bool isSeq,
+ bool isOp,
+ bool isAbs,
+ bool isData,
+ bool isFromList)
+
+ {
+ init(uri,inname,isSeq,isOp,isAbs, isData);
+ baseType = 0;
+ brestriction = false;
+ bFromList= false;
+ bFromList = isFromList;
+ }
+
+ void TypeImpl::init(const char* uri, const char* inname,
+ bool isSeq,
+ bool isOp,
+ bool isAbs,
+ bool isData)
+ {
+ isResolving = false;
+ isResolved = false;
+ localPropsSize = 0;
+ changeSummaryType = false;
+ isSequenced = isSeq;
+ isOpen = isOp;
+ isOpenImplicitly = false;
+ isAbstract = isAbs;
+ isPrimitive = isData;
+ name = new char[strlen(inname)+1];
+ strcpy(name,inname);
+
+ if (uri == 0)
+ {
+ typeURI = new char[1];
+ typeURI[0] = 0;
+ typeEnum = DataObjectType;
+ return;
+ }
+
+ typeURI = new char[strlen(uri)+1];
+ strcpy(typeURI,uri);
+
+ typeEnum = DataObjectType;
+ if (!strcmp(uri,SDOUtils::sdoURI)) {
+ typeEnum = toTypeEnum(inname);
+ }
+ isPrimitive = enumIsPrimitive(typeEnum);
+ }
+
+
+ ///////////////////////////////////////////////////////////////////////////
+ //
+ ///////////////////////////////////////////////////////////////////////////
+ TypeImpl::TypeImpl()
+ {
+ }
+
+ ///////////////////////////////////////////////////////////////////////////
+ //
+ ///////////////////////////////////////////////////////////////////////////
+
+ TypeImpl::~TypeImpl()
+ {
+ if (name != 0)
+ {
+ delete[] name;
+ }
+
+ if (typeURI != 0)
+ {
+ delete[] typeURI;
+ }
+ for (unsigned int j = 0; j < aliases.size();j++)
+ {
+ delete[] aliases[j];
+ }
+ }
+
+ ///////////////////////////////////////////////////////////////////////////
+ // Sets a data type as sequenced.
+ ///////////////////////////////////////////////////////////////////////////
+
+ void TypeImpl::setSequenced(bool set)
+ {
+ isSequenced = set;
+ }
+
+ ///////////////////////////////////////////////////////////////////////////
+ // Sets a data type as open.
+ ///////////////////////////////////////////////////////////////////////////
+
+ void TypeImpl::setOpen(bool set)
+ {
+ isOpen = set;
+ isOpenImplicitly = false; // explicitly set as open
+ }
+
+ bool TypeImpl::isBaseTypeOf(const Type* type) const
+ {
+ return type
+ && (this == type || isBaseTypeOf(type->getBaseType()));
+ }
+
+ ///////////////////////////////////////////////////////////////////////////
+ // Sets a data type as open.
+ ///////////////////////////////////////////////////////////////////////////
+
+ void TypeImpl::setBaseType(const Type* bt, bool isRestriction)
+ {
+ if (isBaseTypeOf(bt))
+ {
+ SDOString stringBuffer = getName();
+ stringBuffer += "\tis base type of\t";
+ stringBuffer += bt->getName();
+ throw SDOIllegalArgumentException(TUSCANY_SDO_EINFO,
+ stringBuffer.c_str());
+ }
+
+ baseType = (TypeImpl*)bt;
+ brestriction = isRestriction;
+
+ // DataType and Sequenced must be the same as the base Type
+ isPrimitive = baseType->isPrimitive;
+ if (isPrimitive)
+ {
+ typeEnum = baseType->typeEnum;
+ }
+
+ isSequenced = baseType->isSequenced;
+
+ // if the base is open then this type must be open too.
+ if (baseType->isOpenType() && !isOpen)
+ {
+ isOpen = true;
+ isOpenImplicitly = true;
+ }
+ }
+
+ bool TypeImpl::equals(const Type& tother) const
+ {
+ if (strcmp(typeURI,tother.getURI())) return false;
+ // TODO - aliases
+ if (strcmp(name, tother.getName())) return false;
+ return true;
+ }
+
+
+ const Type* TypeImpl::getBaseType() const
+ {
+ return (Type*)baseType;
+ }
+
+ const TypeImpl* TypeImpl::getBaseTypeImpl() const
+ {
+ return baseType;
+ }
+
+ ///////////////////////////////////////////////////////////////////////////
+ // Returns the name of the type.
+ ///////////////////////////////////////////////////////////////////////////
+
+ const char* TypeImpl::getName() const
+ {
+ return name;
+ }
+
+ void TypeImpl::setAlias(const char* alias)
+ {
+ char* tmp = new char[strlen(alias)+1];
+ strcpy(tmp,alias);
+ aliases.push_back(tmp);
+ }
+
+
+
+
+ const char* TypeImpl::getAlias(unsigned int index) const
+ {
+ if (index < aliases.size())
+ {
+ return aliases[index];
+ }
+ return name;
+ }
+
+ unsigned int TypeImpl::getAliasCount() const
+ {
+ return aliases.size();
+ }
+ ///////////////////////////////////////////////////////////////////////////
+ // Returns the namespace URI of the type.
+ ///////////////////////////////////////////////////////////////////////////
+ const char* TypeImpl::getURI() const
+ {
+ return typeURI;
+ }
+
+ void TypeImpl::throwIfNestedChangeSummary() const
+ {
+ std::vector<PropertyImplPtr>::const_iterator i;
+ for (i = props.begin(); i != props.end(); ++i)
+ {
+
+ const TypeImpl* type = (*i)->getTypeImpl();
+ if (type->isDataObjectType())
+ {
+ if (type->isChangeSummaryType())
+ {
+ string msg(" Nested change summary type:");
+ msg += type->getURI();
+ msg += " ";
+ msg += type->getName();
+ throw SDOUnsupportedOperationException(TUSCANY_SDO_EINFO,
+ msg.c_str());
+ }
+ type->throwIfNestedChangeSummary();
+ }
+ }
+ }
+
+ void TypeImpl::validateChangeSummary()
+ {
+ if (!isChangeSummaryType()) return;
+ throwIfNestedChangeSummary();
+ }
+
+ std::vector<PropertyImplPtr> TypeImpl::getCompoundProperties()
+ {
+ return props;
+ }
+
+ void TypeImpl::initCompoundProperties()
+ {
+ // We have already met this type in the resolution heirarchy
+ if (isResolving)
+ {
+ string msg(" circular type dependency on:");
+ msg += getURI();
+ msg += " ";
+ msg += getName();
+ throw SDOUnsupportedOperationException(TUSCANY_SDO_EINFO,
+ msg.c_str());
+ }
+
+ if (isResolved)
+ {
+ return;
+ }
+
+ isResolving = true;
+
+
+ if (baseType != 0)
+ {
+ baseType->initCompoundProperties();
+ std::vector<PropertyImplPtr> pl = baseType->getCompoundProperties();
+ localPropsSize = props.size();
+
+ // spec says the properties which are common are taken from
+ // the superclass. I imagine this will change , and only the
+ // ones taken from the subclass will be used.
+
+ if (brestriction)
+ {
+ // restrict the properties to only those which
+ // appear in the parent
+ std::vector<PropertyImplPtr>::iterator p1,p;
+ for (p=pl.begin();p!=pl.end();++p)
+ {
+ for (p1=props.begin();p1!=props.end();++p1)
+ {
+ if (!strcmp((*p1)->getName(),
+ (*p)->getName()))
+ {
+ props.erase(p1);
+ localPropsSize = props.size();
+ break;
+ }
+ }
+ }
+
+ }
+
+ props.insert(props.begin(),pl.begin(), pl.end());
+
+ isPrimitive = !(baseType->isDataObjectType());
+ }
+ if (isPrimitive && (props.size() > 0))
+ {
+ string msg("Add property to data type:");
+ msg += getURI();
+ msg += " ";
+ msg += getName();
+ throw SDOUnsupportedOperationException(TUSCANY_SDO_EINFO,
+ msg.c_str());
+ }
+ isResolved = true;
+ isResolving = false;
+ return;
+ }
+
+
+ ///////////////////////////////////////////////////////////////////////////
+ // Returns the list of the properties of this type.
+ ///////////////////////////////////////////////////////////////////////////
+ PropertyList TypeImpl::getProperties() const
+ {
+ return props;
+ }
+
+ const std::vector<PropertyImplPtr>& TypeImpl::getPropertyListReference() const
+ {
+ return props;
+ }
+
+ unsigned int TypeImpl::getPropertiesSize() const
+ {
+ return props.size();
+ }
+
+ ///////////////////////////////////////////////////////////////////////////
+ // Returns the property with the specified name.
+ ///////////////////////////////////////////////////////////////////////////
+ const Property& TypeImpl::getProperty(const char* propertyName) const
+ {
+ PropertyImpl* pi = getPropertyImpl(propertyName);
+ if (pi == 0)
+ {
+ string msg("Property not found:");
+ msg += propertyName;
+ throw SDOPropertyNotFoundException(TUSCANY_SDO_EINFO,
+ msg.c_str());
+ }
+ return (Property&)*pi;
+ }
+
+ const Property& TypeImpl::getProperty(const SDOString& propertyName) const
+ {
+ PropertyImpl* pi = getPropertyImpl(propertyName);
+ if (pi == 0)
+ {
+ string msg("Property not found:");
+ msg += propertyName;
+ throw SDOPropertyNotFoundException(TUSCANY_SDO_EINFO,
+ msg.c_str());
+ }
+ return (Property&)*pi;
+ }
+
+ ///////////////////////////////////////////////////////////////////////////
+ // Substitute Support - get the real underlying type
+ ///////////////////////////////////////////////////////////////////////////
+
+ const Type& TypeImpl::getRealPropertyType(const std::string& propertyName) const
+ {
+ const TypeImpl* ti = getRealPropertyTypeImpl(propertyName);
+ if (ti != 0)return (Type&)*ti;
+
+ string msg("Property not found:");
+ msg += propertyName;
+ throw SDOPropertyNotFoundException(TUSCANY_SDO_EINFO,
+ msg.c_str());
+
+ }
+
+
+ const TypeImpl* TypeImpl::getRealPropertyTypeImpl(const std::string& propertyName) const
+ {
+
+ std::vector<PropertyImplPtr>::const_iterator i;
+ for (i = props.begin(); i != props.end(); ++i)
+ {
+ if (propertyName == (*i)->getName())
+ {
+ return ((*i)->getTypeImpl());
+ }
+ for (unsigned int k=0;k < (*i)->getAliasCount(); k++)
+ {
+ if (propertyName == (*i)->getAlias(k))
+ {
+ return ((*i)->getTypeImpl());
+ }
+ }
+ for (unsigned int j=0;j < (*i)->getSubstitutionCount(); j++)
+ {
+ if (propertyName == (*i)->getSubstitutionName(j))
+ {
+ return (TypeImpl*)(*i)->getSubstitutionType(j);
+ }
+ }
+ }
+ return 0;
+ }
+
+ ///////////////////////////////////////////////////////////////////////////
+ // Returns the property with the specified name.
+ ///////////////////////////////////////////////////////////////////////////
+
+ PropertyImpl* TypeImpl::getPropertyImpl(const SDOString& propertyName) const
+ {
+
+ // Extension - find the property from an xpath
+ // you should not be able to have both "." and "[" before a "/" - this is assumed.
+
+ if (propertyName.length() == 0) return 0;
+
+ // strchr returns NULL if target not found
+ // find_first_of returns string::npos in that case
+ // find_first_of returns the subscript of the character found eg 0 if it is the first
+ size_t tokenend = propertyName.find_first_of('/');
+ size_t bracket = propertyName.find_first_of('[');
+ size_t dot = propertyName.find_first_of('.');
+ size_t dotOrBracketOrSlash = propertyName.find_first_of(".[/");
+ SDOString copy;
+ // char* copy;
+
+ int len = propertyName.length();
+ if (dotOrBracketOrSlash != string::npos)
+ {
+ len = dotOrBracketOrSlash;
+ }
+
+ if (len != 0)
+ {
+ copy.assign(propertyName, 0, len);
+ }
+ else
+ {
+ copy = propertyName;
+ }
+
+ std::vector<PropertyImplPtr>::const_iterator i;
+ for (i = props.begin(); i != props.end(); ++i)
+ {
+ if (!strcmp(copy.c_str(),(*i)->getName())) // ie the two strings are the same
+ {
+ // delete copy;
+ if ((tokenend != string::npos) && (propertyName.length() - tokenend) > 1)
+ {
+ // There is someting to the right of the "/"
+ const TypeImpl* ti = (*i)->getTypeImpl();
+ if (ti != 0)
+ {
+ PropertyImpl* p = ti->getPropertyImpl(SDOString(propertyName, tokenend + 1, string::npos));
+ return p;
+ }
+ else
+ {
+ return getRawPointer(*i);
+ }
+ }
+ else {
+ return getRawPointer(*i);
+ }
+ }
+
+ for (unsigned int j = 0; j < (*i)->getSubstitutionCount(); j++)
+ {
+ if (!strcmp(copy.c_str(), (*i)->getSubstitutionName(j))) // ie the two strings are the same
+ {
+ // delete copy;
+ if ((tokenend != string::npos) && (propertyName.length() - tokenend) > 1)
+ {
+ // There is someting to the right of the "/"
+ const TypeImpl* ti = (*i)->getTypeImpl();
+ if (ti != 0)
+ {
+ // PropertyImpl* p = ti->getPropertyImpl((const char *)(tokenend+1));
+ PropertyImpl* p = ti->getPropertyImpl(SDOString(propertyName, tokenend + 1, string::npos));
+ return p;
+ }
+ else
+ {
+ return getRawPointer(*i);
+ }
+ }
+ else {
+ return getRawPointer(*i);
+ }
+ }
+ }
+ for (unsigned int k = 0; k < (*i)->getAliasCount(); k++)
+ {
+ if (!strcmp(copy.c_str(), (*i)->getAlias(k))) // ie the two strings are the same
+ {
+ // delete copy;
+ if ((tokenend != string::npos) && (propertyName.length() - tokenend) > 1)
+ {
+ const TypeImpl* ti = (*i)->getTypeImpl();
+ if (ti != 0)
+ {
+ // PropertyImpl* p = ti->getPropertyImpl((const char *)(tokenend+1));
+ PropertyImpl* p = ti->getPropertyImpl(SDOString(propertyName, tokenend + 1, string::npos));
+ return p;
+ }
+ else
+ {
+ return getRawPointer(*i);
+ }
+ }
+ else {
+ return getRawPointer(*i);
+ }
+ }
+ }
+ }
+ return 0;
+ }
+
+ ///////////////////////////////////////////////////////////////////////////
+ // Returns the property with the specified name.
+ ///////////////////////////////////////////////////////////////////////////
+ PropertyImpl* TypeImpl::getPropertyImplPure(const char* propertyName) const
+ {
+
+
+ std::vector<PropertyImplPtr>::const_iterator i;
+ for (i = props.begin(); i != props.end(); ++i)
+ {
+ if (!strcmp(propertyName,(*i)->getName()))
+ {
+ return getRawPointer(*i);
+ }
+ for (unsigned int k=0;k < (*i)->getAliasCount(); k++)
+ {
+ if (!strcmp(propertyName,(*i)->getAlias(k)))
+ {
+ return getRawPointer(*i);
+ }
+ }
+ }
+ return 0;
+ }
+
+
+ ///////////////////////////////////////////////////////////////////////////
+ // Returns the property index with the specified name.
+ ///////////////////////////////////////////////////////////////////////////
+ unsigned int TypeImpl::getPropertyIndex(const char* propertyName) const
+ {
+ return getPropertyIndex(SDOString(propertyName));
+ }
+ unsigned int TypeImpl::getPropertyIndex(const SDOString& propertyName) const
+ {
+ std::vector<PropertyImplPtr>::const_iterator i;
+ int j = 0;
+ for (i = props.begin(); i != props.end(); ++i)
+ {
+ if (!strcmp(propertyName.c_str(), (*i)->getName()))
+ {
+ return j;
+ }
+ j++;
+ }
+ string msg("Property not found:");
+ msg += propertyName;
+ throw SDOPropertyNotFoundException(TUSCANY_SDO_EINFO,
+ msg.c_str());
+ }
+
+ ///////////////////////////////////////////////////////////////////////////
+ // Returns the property with the specified name.
+ ///////////////////////////////////////////////////////////////////////////
+ const Property& TypeImpl::getProperty(unsigned int index) const
+ {
+ PropertyImpl* pi = getPropertyImpl(index);
+ if (pi == 0)
+ {
+ string msg("Property not found for index:");
+ msg += index;
+ throw SDOPropertyNotFoundException(TUSCANY_SDO_EINFO,
+ msg.c_str());
+ }
+ return (Property&)*pi;
+ }
+
+ ///////////////////////////////////////////////////////////////////////////
+ // Returns the property with the specified index.
+ ///////////////////////////////////////////////////////////////////////////
+ PropertyImpl* TypeImpl::getPropertyImpl(unsigned int index) const
+ {
+ std::vector<PropertyImplPtr>::const_iterator i;
+ int count = 0;
+ for (i = props.begin() ; i != props.end() ; ++i)
+ {
+ if (count == index) {
+ return getRawPointer(*i);
+ }
+ count++;
+ }
+ return 0;
+ }
+
+
+ ///////////////////////////////////////////////////////////////////////////
+ // Returns the property with the specified name.
+ ///////////////////////////////////////////////////////////////////////////
+ void TypeImpl::addProperty(const char* propname,
+ const TypeImpl& t,
+ bool many, bool rdonly, bool cont)
+ {
+ // do not add duplicate properties
+ if (!getPropertyImplPure(propname))
+ {
+ props.push_back(new PropertyImpl(*this,
+ propname,
+ t,
+ many,
+ rdonly,
+ cont));
+ localPropsSize++;
+ }
+ }
+
+ ///////////////////////////////////////////////////////////////////////////
+ // Indicates if this Type specifies DataObjects..
+ ///////////////////////////////////////////////////////////////////////////
+ bool TypeImpl::isDataObjectType() const
+ {
+ return !isPrimitive;
+ }
+
+ ///////////////////////////////////////////////////////////////////////////
+ // Indicates if this Type specifies Sequenced DataObjects.
+ ///////////////////////////////////////////////////////////////////////////
+ bool TypeImpl::isSequencedType() const
+ {
+ return isSequenced;
+ }
+
+ ///////////////////////////////////////////////////////////////////////////
+ // Indicates if this Type allows any form of open content.
+ ///////////////////////////////////////////////////////////////////////////
+ bool TypeImpl::isOpenType() const
+ {
+ /* TODO - handle open types */
+ return isOpen;
+ }
+
+ bool TypeImpl::isOpenTypeImplicitly() const
+ {
+ return isOpenImplicitly;
+ }
+
+ ///////////////////////////////////////////////////////////////////////////
+ // Indicates if this type may not be instantiated.
+ ///////////////////////////////////////////////////////////////////////////
+ bool TypeImpl::isAbstractType() const
+ {
+ return isAbstract;
+ }
+
+ void TypeImpl::setAbstract(bool set)
+ {
+ isAbstract = set;
+ }
+
+ ///////////////////////////////////////////////////////////////////////////
+ // TODO - override ==.
+ ///////////////////////////////////////////////////////////////////////////
+ bool TypeImpl::equals(const Type& t)
+ {
+ return ( strcmp(getName(),t.getName()) == 0
+ && strcmp(getURI (),t.getURI ()) == 0 );
+ }
+
+ ///////////////////////////////////////////////////////////////////////////
+ // getTypeEnum.
+ ///////////////////////////////////////////////////////////////////////////
+ Type::Types TypeImpl::getTypeEnum(void) const
+ {
+ return typeEnum;
+ }
+
+
+ ///////////////////////////////////////////////////////////////////////////
+ // Conversions.
+ // convert is used in the process of setting a value. The input is the
+ // result of a setXXX, so in the first case setBoolean. The typeEnum is the
+ // type of the value being set and governs the expected final result in
+ // the value* buffer.
+ ///////////////////////////////////////////////////////////////////////////
+
+ unsigned int TypeImpl::convert(void** value,const bool b) const
+ {
+ switch (typeEnum)
+ {
+ case BooleanType:
+ case ByteType:
+ case CharacterType:
+ case IntType:
+ case ShortType:
+ if (*value != 0)delete (char*)(*value);
+ *value = new char[sizeof(long)];
+ *(long*)*value = (long)b;
+ return sizeof(long);
+
+ case LongType:
+ if (*value != 0)delete (char*)(*value);
+ *value = new char[sizeof(int64_t)];
+ *(int64_t*)*value = (int64_t)b;
+ return sizeof(int64_t);
+
+ case BigDecimalType:
+ case BigIntegerType:
+ case StringType:
+ case UriType:
+ if (*value != 0)delete (char*)(*value);
+ // spec change - types
+ *value = new wchar_t[6];
+ if (b)
+ {
+ ((wchar_t*)(*value))[0] = (wchar_t)'t';
+ ((wchar_t*)(*value))[1] = (wchar_t)'r';
+ ((wchar_t*)(*value))[2] = (wchar_t)'u';
+ ((wchar_t*)(*value))[3] = (wchar_t)'e';
+ ((wchar_t*)(*value))[4] = 0;
+ return 4;
+ }
+ else
+ {
+ ((wchar_t*)(*value))[0] = (wchar_t)'f';
+ ((wchar_t*)(*value))[1] = (wchar_t)'a';
+ ((wchar_t*)(*value))[2] = (wchar_t)'l';
+ ((wchar_t*)(*value))[3] = (wchar_t)'s';
+ ((wchar_t*)(*value))[4] = (wchar_t)'e';
+ ((wchar_t*)(*value))[5] = 0;
+ return 5;
+ }
+ break;
+
+
+ case BytesType:
+ {
+ if (*value != 0)delete (char*)(*value);
+ // spec change - types
+ *value = new char[6];
+ if (b)
+ {
+ strcpy((char*)*value, "true");
+ return 4;
+ }
+ else
+ {
+ strcpy((char*)*value, "false");
+ return 5;
+ }
+ break;
+
+ }
+
+ case DoubleType:
+ case FloatType:
+ case DateType:
+ case OtherTypes:
+ case DataObjectType:
+ case ChangeSummaryType:
+ default:
+ {
+ string msg("Cannot set Boolean on object of type:");
+ msg += getName();
+ throw SDOInvalidConversionException(TUSCANY_SDO_EINFO,
+ msg.c_str());
+ break;
+ }
+ }
+ return 0;
+ }
+
+ unsigned int TypeImpl::convert(void** value,const char c) const
+ {
+#if __WORDSIZE ==64
+ return convert(value,(int64_t)c);
+#else
+ return convert(value,(long)c);
+#endif
+ }
+
+ unsigned int TypeImpl::convert(void** value,const wchar_t c) const
+ {
+#if __WORDSIZE ==64
+ return convert(value,(int64_t)c);
+#else
+ return convert(value,(long)c);
+#endif
+ }
+
+ // This is set CString...
+ unsigned int TypeImpl::convert(void** value,const char* c) const
+ {
+
+ switch (typeEnum)
+ {
+ case BooleanType:
+ if (*value != 0)delete ((char*)*value);
+ *value = new char[sizeof(long)];
+ if ((c == 0) || strcmp(c,"true"))
+ {
+ *(long*)*value = 0;
+ }
+ else
+ {
+ *(long*)*value = 1;
+ }
+ return sizeof(long);
+
+ case ByteType:
+ case CharacterType:
+ case IntType:
+ case ShortType:
+ if (*value != 0) delete ((char*)*value);
+ *value = new char[sizeof(long)];
+ *(long*)*value = atoi(c);
+ return sizeof(long);
+
+ case DoubleType:
+ if (*value != 0) delete ((char*)*value);
+ *value = new char[sizeof(long double)];
+ // TODO - atof not suitable here
+ *(long double*)*value = (long double)atof(c);
+ return sizeof(long double);
+
+ case FloatType:
+ if (*value != 0) delete ((char*)*value);
+ *value = new char[sizeof(float)];
+ *(float*)*value = (float)atof(c);
+ return sizeof(float);
+
+ case LongType:
+ if (*value != 0) delete ((char*)*value);
+ *value = new char[sizeof(int64_t)];
+#if defined(WIN32) || defined (_WINDOWS)
+ *(int64_t*)*value = (int64_t)_atoi64(c);
+#else
+ *(int64_t*)*value = (int64_t)strtoll(c, NULL, 0);
+#endif
+ return sizeof(int64_t);
+
+ case DateType:
+ if (*value != 0) delete ((char*)*value);
+ *value = new char[sizeof(time_t)];
+ *(time_t*)*value = (time_t)atoi(c);
+ return sizeof(time_t);
+
+ case BigDecimalType:
+ case BigIntegerType:
+ case StringType:
+ case UriType:
+ {
+ if (*value != 0) delete ((wchar_t*)*value);
+ wchar_t* vw = new wchar_t[strlen(c)+1];
+ for (unsigned int i=0;i< strlen(c);i++)
+ {
+ vw[i] = (wchar_t)c[i];
+ }
+ vw[strlen(c)] = 0;
+ *value = (void*)vw;
+ return strlen(c);
+ }
+ break;
+ case BytesType:
+ {
+ if (*value != 0) delete ((char*)*value);
+ char* vc = new char[strlen(c)+1];
+ for (unsigned int i=0;i< strlen(c);i++)
+ {
+ vc[i] = (char)c[i];
+ }
+ vc[strlen(c)] = 0;
+ *value = (void*)vc;
+ return strlen(c);
+ }
+ break;
+
+ case OtherTypes:
+ case DataObjectType:
+ case ChangeSummaryType:
+ default:
+ {
+ string msg("Cannot set CString on object of type:");
+ msg += getName();
+ throw SDOInvalidConversionException(TUSCANY_SDO_EINFO,
+ msg.c_str());
+ break;
+ }
+ }
+ return 0;
+ }
+
+ // +++
+
+ // This is set CString...
+ // The value supplied in s is converted and written to value.
+ unsigned int TypeImpl::convert(void** value, const SDOString& c) const
+ {
+ switch (typeEnum)
+ {
+ case BooleanType:
+ if (*value != 0) delete ((char*) *value);
+ *value = new char[sizeof(long)];
+
+ if (c == "true")
+ {
+ *(long*)*value = 0;
+ }
+ else
+ {
+ *(long*)*value = 1;
+ }
+ return sizeof(long);
+
+ case ByteType:
+ case CharacterType:
+ case IntType:
+ case ShortType:
+ if (*value != 0) delete ((char*)*value);
+
+ *value = new char[sizeof(long)];
+ *(long*)*value = atoi(c.c_str());
+ return sizeof(long);
+
+ case DoubleType:
+ if (*value != 0) delete ((char*)*value);
+
+ *value = new char[sizeof(long double)];
+ // TODO - atof not suitable here
+ *(long double*)*value = (long double)atof(c.c_str());
+ return sizeof(long double);
+
+ case FloatType:
+ if (*value != 0) delete ((char*)*value);
+
+ *value = new char[sizeof(float)];
+ *(float*)*value = (float)atof(c.c_str());
+ return sizeof(float);
+
+ case LongType:
+ if (*value != 0) delete ((char*)*value);
+
+ *value = new char[sizeof(int64_t)];
+#if defined(WIN32) || defined (_WINDOWS)
+ *(int64_t*)*value = (int64_t)_atoi64(c.c_str());
+#else
+ *(int64_t*)*value = (int64_t)strtoll(c.c_str(), NULL, 0);
+#endif
+ return sizeof(int64_t);
+
+ case DateType:
+ if (*value != 0) delete ((char*)*value);
+ *value = new char[sizeof(time_t)];
+ *(time_t*)*value = (time_t)atoi(c.c_str());
+ return sizeof(time_t);
+
+ case BigDecimalType:
+ case BigIntegerType:
+ case StringType:
+ case UriType:
+ {
+ if (*value != 0) delete ((wchar_t*)*value);
+ wchar_t* vw = new wchar_t[c.length() + 1];
+ for (unsigned int i = 0; i < c.length(); i++)
+ {
+ vw[i] = (wchar_t)c[i];
+ }
+ vw[c.length()] = 0;
+ *value = (void*)vw;
+ return c.length();
+ }
+ break;
+ case BytesType:
+ {
+ if (*value != 0) delete ((char*)*value);
+ char* vc = new char[c.length() + 1];
+ for (unsigned int i = 0; i < c.length(); i++)
+ {
+ vc[i] = (char)c[i];
+ }
+ vc[c.length()] = 0;
+ *value = (void*)vc;
+ return c.length();
+ }
+ break;
+
+ case OtherTypes:
+ case DataObjectType:
+ case ChangeSummaryType:
+ default:
+ {
+ string msg("Cannot set CString on object of type:");
+ msg += getName();
+ throw SDOInvalidConversionException(TUSCANY_SDO_EINFO,
+ msg.c_str());
+ break;
+ }
+ }
+ return 0;
+ }
+
+
+ // ---
+
+ // setString
+ unsigned int TypeImpl::convert(void** value,const wchar_t* b, unsigned int len) const
+ {
+ unsigned int i;
+ switch (typeEnum)
+ {
+ case BigDecimalType:
+ case BigIntegerType:
+ case UriType:
+ case StringType:
+ {
+ if (*value != 0) delete ((wchar_t*)*value);
+ wchar_t* vw = new wchar_t[len+1];
+ for (i=0;i<len;i++)
+ {
+ vw[i] = b[i];
+ }
+ vw[len] = 0;
+ *value = (void*)vw;
+ return len;
+ }
+ break;
+
+ case BytesType:
+ {
+ if (*value != 0) delete ((char*)*value);
+ char* vc = new char[len+1];
+ for (i=0;i<len;i++)
+ {
+ vc[i] = (char)b[i];
+ }
+ vc[len] = 0;
+ *value = (void*)vc;
+ return len;
+ }
+ break;
+
+ case BooleanType:
+ if (*value != 0)delete ((char*)*value);
+ *value = new char[sizeof(long)];
+ if (len > 4)
+ {
+ *(long*)*value = 0;
+ }
+ else
+ {
+ if (b[0] == (wchar_t)'t' &&
+ b[1] == (wchar_t)'r' &&
+ b[2] == (wchar_t)'u' &&
+ b[3] == (wchar_t)'e' )
+ *(long*)*value = 1;
+ else *(long*)*value = 0;
+ }
+ return sizeof(long);
+
+ case CharacterType:
+ case ByteType:
+ if (*value != 0)delete ((char*)*value);
+ *value = new char[sizeof(long)];
+ if (len > 0)
+ {
+ *(long*)*value = (long)b[0];
+ }
+ else
+ {
+ *(long*)*value = (long)0;
+ }
+ return sizeof(long);
+
+ case ShortType:
+ case IntType:
+ {
+ if (*value != 0)delete ((char*)*value);
+ *value = new char[sizeof(long)];
+ int val = 0;
+ for (unsigned int j=0;j<len;j++)
+ {
+ val += (1+ (10*j)) * ((char)b[len-1-j] - (char)'0');
+ }
+ *(long*)*value = (long)val;
+ return sizeof(long);
+ }
+
+ case LongType:
+ {
+ if (*value != 0)delete ((char*)*value);
+ *value = new char[sizeof(int64_t)];
+ int64_t val = 0;
+ for (unsigned int j=0;j<len;j++)
+ {
+ val += (int64_t)(1+ (10*j)) * ((char)b[len-1-j] - (char)'0');
+ }
+ *(int64_t*)*value = (int64_t)val;
+ return sizeof(long);
+ }
+ case DoubleType:
+ case FloatType:
+ case DateType:
+ case OtherTypes:
+ case DataObjectType:
+ case ChangeSummaryType:
+ default:
+ {
+ string msg("Cannot set String on object of type:");
+ msg += getName();
+ throw SDOInvalidConversionException(TUSCANY_SDO_EINFO,
+ msg.c_str());
+ break;
+ }
+ }
+ return 0;
+ }
+
+ // setBytes
+ unsigned int TypeImpl::convert(void** value,const char* b, unsigned int len) const
+ {
+ unsigned int i;
+ switch (typeEnum)
+ {
+ case BytesType:
+ {
+ if (*value != 0) delete ((char*)*value);
+ char* vc = new char[len+1];
+ for (i=0;i<len;i++)
+ {
+ vc[i] = (char)b[i];
+ }
+ vc[len] = 0;
+ *value = (void*)vc;
+ return len;
+ }
+
+ case BigDecimalType:
+ case BigIntegerType:
+ case UriType:
+ case StringType:
+ {
+ if (*value != 0) delete ((wchar_t*)*value);
+ wchar_t* vw = new wchar_t[len+1];
+ for (i=0;i<len;i++)
+ {
+ vw[i] = b[i];
+ }
+ vw[len] = 0;
+ *value = (void*)vw;
+ return len;
+ }
+
+ case BooleanType:
+ if (*value != 0)delete ((char*)*value);
+ *value = new char[sizeof(long)];
+ if (len > 4)
+ {
+ *(long*)*value = 0;
+ }
+ else
+ {
+ if (b[0] == (char)'t' &&
+ b[1] == (char)'r' &&
+ b[2] == (char)'u' &&
+ b[3] == (char)'e' )
+ *(long*)*value = 1;
+ else *(long*)*value = 0;
+ }
+ return sizeof(long);
+
+ case ByteType:
+ case CharacterType:
+ if (*value != 0)delete ((char*)*value);
+ *value = new char[sizeof(long)];
+ if (len > 0)
+ {
+ *(long*)*value = (long)b[0];
+ }
+ else
+ {
+ *(long*)*value = (long)0;
+ }
+ return sizeof(long);
+
+ case IntType:
+ case ShortType:
+ {
+ if (*value != 0)delete ((char*)*value);
+ *value = new char[sizeof(long)];
+ int val = 0;
+ for (unsigned int j=0;j<len;j++)
+ {
+ val += (1+ (10*j)) * ((char)b[len-1-j] - (char)'0');
+ }
+ *(long*)*value = (long)val;
+ return sizeof(long);
+ }
+
+ case LongType:
+ {
+ if (*value != 0)delete ((char*)*value);
+ *value = new char[sizeof(int64_t)];
+ int64_t val = 0;
+ for (unsigned int j=0;j<len;j++)
+ {
+ val += (int64_t)(1+ (10*j)) * ((char)b[len-1-j] - (char)'0');
+ }
+ *(int64_t*)*value = (int64_t)val;
+ return sizeof(long);
+ }
+
+ case DoubleType:
+ case FloatType:
+ case DateType:
+ case OtherTypes:
+ case DataObjectType:
+ case ChangeSummaryType:
+ default:
+ {
+ string msg("Cannot set Bytes on object of type:");
+ msg += getName();
+ throw SDOInvalidConversionException(TUSCANY_SDO_EINFO,
+ msg.c_str());
+ return 0;
+ }
+ }
+ return 0;
+ }
+
+ // +++
+
+ unsigned int TypeImpl::convert(void** value, const SDOString& b, unsigned int len) const
+ {
+ unsigned int i;
+ switch (typeEnum)
+ {
+ case BytesType:
+ {
+ if (*value != 0) delete ((char*)*value);
+
+ char* vc = new char[len + 1];
+ b.copy(vc, len);
+ vc[len] = 0;
+
+ *value = (void*)vc;
+ return len;
+ }
+
+ case BigDecimalType:
+ case BigIntegerType:
+ case UriType:
+ case StringType:
+ {
+ if (*value != 0) delete ((wchar_t*)*value);
+
+ wchar_t* vw = new wchar_t[len+1];
+ // Can't use std::string.copy() because we are copying into wchar_t elements.
+ for (i=0;i<len;i++)
+ {
+ vw[i] = b[i];
+ }
+ vw[len] = 0;
+ *value = (void*)vw;
+ return len;
+ }
+
+ case BooleanType:
+ if (*value != 0)delete ((char*)*value);
+ *value = new char[sizeof(long)];
+ if (len > 4)
+ {
+ *(long*)*value = 0;
+ }
+ else
+ {
+ if (b == "true")
+ *(long*)*value = 1;
+ else *(long*)*value = 0;
+ }
+ return sizeof(long);
+
+ case ByteType:
+ case CharacterType:
+ if (*value != 0)delete ((char*)*value);
+ *value = new char[sizeof(long)];
+ if (len > 0)
+ {
+ *(long*)*value = (long)b[0];
+ }
+ else
+ {
+ *(long*)*value = (long)0;
+ }
+ return sizeof(long);
+
+ case IntType:
+ case ShortType:
+ {
+ if (*value != 0)delete ((char*)*value);
+ *value = new char[sizeof(long)];
+ int val = 0;
+ for (unsigned int j=0;j<len;j++)
+ {
+ val += (1+ (10*j)) * ((char)b[len-1-j] - (char)'0');
+ }
+ *(long*)*value = (long)val;
+ return sizeof(long);
+ }
+
+ case LongType:
+ {
+ if (*value != 0)delete ((char*)*value);
+ *value = new char[sizeof(int64_t)];
+ int64_t val = 0;
+ for (unsigned int j=0;j<len;j++)
+ {
+ val += (int64_t)(1+ (10*j)) * ((char)b[len-1-j] - (char)'0');
+ }
+ *(int64_t*)*value = (int64_t)val;
+ return sizeof(long);
+ }
+
+ case DoubleType:
+ case FloatType:
+ case DateType:
+ case OtherTypes:
+ case DataObjectType:
+ case ChangeSummaryType:
+ default:
+ {
+ string msg("Cannot set Bytes on object of type:");
+ msg += getName();
+ throw SDOInvalidConversionException(TUSCANY_SDO_EINFO,
+ msg.c_str());
+ return 0;
+ }
+ }
+ return 0;
+ }
+
+ // ---
+
+ unsigned int TypeImpl::convert(void** value,const short s) const
+ {
+#if __WORDSIZE ==64
+ return convert(value,(int64_t)s);
+#else
+ return convert(value,(long)s);
+#endif
+ }
+
+/* unsigned int TypeImpl::convert(void** value,const int i) const
+ {
+ return convert(value,(long)i);
+ }
+*/
+ unsigned int TypeImpl::convertDate(void** value, const SDODate i) const
+ {
+ switch (typeEnum)
+ {
+ case BooleanType:
+ {
+ string msg("Cannot set Date on object of type:");
+ msg += getName();
+ throw SDOInvalidConversionException(TUSCANY_SDO_EINFO,
+ msg.c_str());
+ break;
+ }
+ default:
+#if __WORDSIZE ==64
+ return convert(value, (int64_t)(i.getTime()));
+#else
+ return convert(value, (long)(i.getTime()));
+#endif
+ }
+ }
+
+#if __WORDSIZE !=64
+ // setInteger
+ unsigned int TypeImpl::convert(void** value,const long i) const
+ {
+#if ! defined(WIN32) && ! defined (_WINDOWS)
+ char *tmp = new char[MAX_LONG_SIZE];
+ int j = 0;
+#endif
+ switch (typeEnum)
+ {
+ case BooleanType:
+ case ByteType:
+ case CharacterType:
+ case IntType:
+ case ShortType:
+ if (*value != 0) delete ((char*)*value);
+ *value = new char[sizeof(long)];
+ *(long*)*value = (long)i;
+ return sizeof(long);
+
+ case DoubleType:
+ if (*value != 0) delete ((char*)*value);
+ *value = new char[sizeof(long double)];
+ *(long double*)*value = (long double)i;
+ return sizeof(long double);
+
+ case FloatType:
+ if (*value != 0) delete ((char*)*value);
+ *value = new char[sizeof(float)];
+ *(float*)*value = (float)i;
+ return sizeof(float);
+
+ case LongType:
+ if (*value != 0) delete ((char*)*value);
+ *value = new char[sizeof(int64_t)];
+ *(int64_t*)*value = (int64_t)i;
+ return sizeof(int64_t);
+
+ case DateType:
+ if (*value != 0) delete ((char*)*value);
+ *value = new char[sizeof(time_t)];
+ *(time_t*)*value = (time_t)i;
+ return sizeof(time_t);
+
+ case BigDecimalType:
+ case BigIntegerType:
+ case StringType:
+ case UriType:
+ {
+ if (*value != 0) delete ((wchar_t*)*value);
+ *value = new wchar_t[MAX_LONG_SIZE];
+ // TODO - whats the equivalent of _ltow on linux?
+#if defined(WIN32) || defined (_WINDOWS)
+ _ltow(i,(wchar_t*)*value,10);
+ return wcslen((wchar_t*)(*value));
+#else
+ sprintf(tmp,"%d", i);
+ for (j=0; j< strlen(tmp); j++)
+ {
+ ((wchar_t*)(*value))[j] = (wchar_t)tmp[j];
+ }
+ ((wchar_t*)(*value))[strlen(tmp)] = 0;
+ delete tmp;
+ return j;
+#endif
+
+ }
+
+ case BytesType:
+ {
+ if (*value != 0) delete ((wchar_t*)*value);
+ *value = new char[MAX_LONG_SIZE];
+ // TODO - whats the equivalent of _ltow on linux?
+ sprintf((char*)*value,"%d", i);
+ return strlen((char*)(*value));
+
+ }
+
+ case OtherTypes:
+ case DataObjectType:
+ case ChangeSummaryType:
+ default:
+ {
+ string msg("Cannot set Int on object of type:");
+ msg += getName();
+ throw SDOInvalidConversionException(TUSCANY_SDO_EINFO,
+ msg.c_str());
+ break;
+ }
+ }
+ }
+
+#endif
+
+ // setLongLong
+
+ unsigned int TypeImpl::convert(void** value,const int64_t l) const
+ {
+#if ! defined(WIN32) && ! defined (_WINDOWS)
+ char *tmp = new char[MAX_LONG_SIZE];
+ int j = 0;
+#endif
+ switch (typeEnum)
+ {
+ case BooleanType:
+ case ByteType:
+ case CharacterType:
+ case IntType:
+ case ShortType:
+ if (*value != 0) delete ((char*)*value);
+ *value = new char[sizeof(long)];
+ *(long*)*value = (long)l;
+ return sizeof(long);
+
+ case DoubleType:
+ if (*value != 0) delete ((char*)*value);
+ *value = new char[sizeof(long double)];
+ *(long double*)*value = (long double)l;
+ return sizeof(long double);
+
+ case FloatType:
+ if (*value != 0) delete ((char*)*value);
+ *value = new char[sizeof(float)];
+ *(float*)*value = (float)l;
+ return sizeof(float);
+
+ case LongType:
+ if (*value != 0) delete ((char*)*value);
+ *value = new char[sizeof(int64_t)];
+ *(int64_t*)*value = (int64_t)l;
+ return sizeof(int64_t);
+
+ case DateType:
+ if (*value != 0) delete ((char*)*value);
+ *value = new char[sizeof(time_t)];
+ *(time_t*)*value = (time_t)l;
+ return sizeof(time_t);
+
+ case BigDecimalType:
+ case BigIntegerType:
+ case StringType:
+ case UriType:
+ {
+ if (*value != 0) delete ((wchar_t*)*value);
+ *value = new wchar_t[MAX_LONG_SIZE];
+ // TODO - whats the equivalent of _ltow on linux?
+#if defined(WIN32) || defined (_WINDOWS)
+ _i64tow(l,(wchar_t*)*value,10);
+ return wcslen((wchar_t*)(*value));
+#else
+ sprintf(tmp, "%lld", l);
+ for (j=0; j< strlen(tmp); j++)
+ {
+ ((wchar_t*)(*value))[j] = (wchar_t)tmp[j];
+ }
+ ((wchar_t*)(*value))[strlen(tmp)] = 0;
+ delete tmp;
+ return j;
+#endif
+
+ }
+
+ case BytesType:
+ {
+ if (*value != 0) delete ((char*)*value);
+ *value = new char[MAX_LONG_SIZE];
+#if defined(WIN32) || defined (_WINDOWS)
+ _i64toa(l,(char*)*value,10);
+#else
+ sprintf((char*)*value, "%lld", l);
+#endif
+ return strlen((char*)(*value));
+
+ }
+
+ case OtherTypes:
+ case DataObjectType:
+ case ChangeSummaryType:
+ default:
+ {
+ string msg("Cannot set LongLong on object of type:");
+ msg += getName();
+ throw SDOInvalidConversionException(TUSCANY_SDO_EINFO,
+ msg.c_str());
+ break;
+ }
+ }
+ }
+
+ // setFloat
+ unsigned int TypeImpl::convert(void** value,const float f) const
+ {
+ switch (typeEnum)
+ {
+ case BooleanType:
+ case ByteType:
+ case CharacterType:
+ case IntType:
+ case ShortType:
+ if (*value != 0) delete ((char*)*value);
+ *value = new char[sizeof(long)];
+ *(long*)*value = (long)f;
+ return sizeof(long);
+
+ case DoubleType:
+ if (*value != 0) delete ((char*)*value);
+ *value = new char[sizeof(long double)];
+ *(long double*)*value = (long double)f;
+ return sizeof(long double);
+
+ case FloatType:
+ if (*value != 0) delete ((char*)*value);
+ *value = new char[sizeof(float)];
+ *(float*)*value = (float)f;
+ return sizeof(float);
+
+ case LongType:
+ if (*value != 0) delete ((char*)*value);
+ *value = new char[sizeof(int64_t)];
+ *(int64_t*)*value = (int64_t)f;
+ return sizeof(int64_t);
+
+ case DateType:
+ if (*value != 0) delete ((char*)*value);
+ *value = new char[sizeof(time_t)];
+ *(time_t*)*value = (time_t)f;
+ return sizeof(time_t);
+
+ case BigDecimalType:
+ case BigIntegerType:
+ case StringType:
+ case UriType:
+ case BytesType:
+ case OtherTypes:
+ case DataObjectType:
+ case ChangeSummaryType:
+ default:
+ {
+ string msg("Cannot set Float on object of type:");
+ msg += getName();
+ throw SDOInvalidConversionException(TUSCANY_SDO_EINFO,
+ msg.c_str());
+ break;
+ }
+ break;
+ }
+ }
+
+ // TODO - storing the double as a long double - perhaps I need
+ // a new type?
+/* unsigned int TypeImpl::convert(void** value,const double d) const
+ {
+ switch (typeEnum)
+ {
+ case BooleanType:
+ case ByteType:
+ case CharacterType:
+ case IntType:
+ case ShortType:
+ if (*value != 0) delete ((char*)*value);
+ *value = new char[sizeof(long)];
+ *(long*)*value = (long)d;
+ return sizeof(long);
+
+ case DoubleType:
+ if (*value != 0) delete ((char*)*value);
+ *value = new char[sizeof(long double)];
+ *(long double*)*value = (long double)d;
+ return sizeof(long double);
+
+ case FloatType:
+ if (*value != 0) delete ((char*)*value);
+ *value = new char[sizeof(float)];
+ *(float*)*value = (float)d;
+ return sizeof(float);
+
+ case LongType:
+ if (*value != 0) delete ((char*)*value);
+ *value = new char[sizeof(int64_t)];
+ *(int64_t*)*value = (int64_t)d;
+ return sizeof(int64_t);
+
+ case DateType:
+ if (*value != 0) delete ((char*)*value);
+ *value = new char[sizeof(time_t)];
+ *(time_t*)*value = (time_t)d;
+ return sizeof(time_t);
+
+ case BigDecimalType:
+ case BigIntegerType:
+ case StringType:
+ case UriType:
+ case BytesType:
+ case OtherTypes:
+ case DataObjectType:
+ case ChangeSummaryType:
+ default:
+ {
+ string msg("Cannot set Double on object of type:");
+ msg += getName();
+ throw SDOInvalidConversionException(TUSCANY_SDO_EINFO,
+ msg.c_str());
+ break;
+ }
+ }
+ }
+*/
+ unsigned int TypeImpl::convert(void** value,const long double d) const
+ {
+ switch (typeEnum)
+ {
+ case BooleanType:
+ case ByteType:
+ case CharacterType:
+ case IntType:
+ case ShortType:
+ if (*value != 0) delete ((char*)*value);
+ *value = new char[sizeof(long)];
+ *(long*)*value = (long)d;
+ return sizeof(long);
+
+ case DoubleType:
+ if (*value != 0) delete ((char*)*value);
+ *value = new char[sizeof(long double)];
+ *(long double*)*value = (long double)d;
+ return sizeof(long double);
+
+ case FloatType:
+ if (*value != 0) delete ((char*)*value);
+ *value = new char[sizeof(float)];
+ *(float*)*value = (float)d;
+ return sizeof(float);
+
+ case LongType:
+ if (*value != 0) delete ((char*)*value);
+ *value = new char[sizeof(int64_t)];
+ *(int64_t*)*value = (int64_t)d;
+ return sizeof(int64_t);
+
+ case DateType:
+ if (*value != 0) delete ((char*)*value);
+ *value = new char[sizeof(time_t)];
+ *(time_t*)*value = (time_t)d;
+ return sizeof(time_t);
+
+ case BigDecimalType:
+ case BigIntegerType:
+ case StringType:
+ case UriType:
+ case BytesType:
+ case OtherTypes:
+ case DataObjectType:
+ case ChangeSummaryType:
+ default:
+ {
+ string msg("Cannot set Long Double on object of type:");
+ msg += getName();
+ throw SDOInvalidConversionException(TUSCANY_SDO_EINFO,
+ msg.c_str());
+ break;
+ }
+ }
+ }
+
+ unsigned int TypeImpl::convert(void** value,DataObject* dob) const
+ {
+ switch (typeEnum)
+ {
+
+ case OtherTypes:
+ case DataObjectType:
+ *(DataObject**)value = dob;
+ return sizeof (void*);
+
+ case BooleanType:
+ case ByteType:
+ case CharacterType:
+ case IntType:
+ case ShortType:
+ case DoubleType:
+ case FloatType:
+ case LongType:
+ case DateType:
+ case BigDecimalType:
+ case BigIntegerType:
+ case StringType:
+ case BytesType:
+ case UriType:
+ default:
+ {
+ string msg("Cannot set Data Object on object of type:");
+ msg += getName();
+ throw SDOInvalidConversionException(TUSCANY_SDO_EINFO,
+ msg.c_str());
+ break;
+ }
+ }
+ return 0;
+ }
+
+ unsigned int TypeImpl::convertToString(void* value, wchar_t* outval, unsigned int len,
+ unsigned int max) const
+ {
+#if ! defined(WIN32) && ! defined (_WINDOWS)
+ char* tmpstr = new char[MAX_LONG_SIZE];
+ int j = 0;
+#endif
+ unsigned int i;
+ switch (typeEnum)
+ {
+
+ case BigDecimalType:
+ case BigIntegerType:
+ case UriType:
+ case StringType:
+ {
+ if (value == 0) return 0;
+ wchar_t* tmp = (wchar_t*)value;
+ for (i=0;(i < len) && (i < max);i++)
+ {
+ outval[i] = tmp[i];
+ }
+ return len>max?max:len;
+ }
+ case BytesType:
+ {
+ if (value == 0) return 0;
+ char* tmp = (char*)value;
+ for (i=0;(i < len) && (i < max);i++)
+ {
+ outval[i] = (wchar_t)(tmp[i]);
+ }
+ return len>max?max:len;
+ }
+
+ case BooleanType:
+ {
+ if (max < 4) return 0;
+ if (value == 0 || *(long*)value == 0) {
+ if (max < 5) return 0;
+ outval[0] = (wchar_t)'f';
+ outval[1] = (wchar_t)'a';
+ outval[2] = (wchar_t)'l';
+ outval[3] = (wchar_t)'s';
+ outval[4] = (wchar_t)'e';
+ return 5;
+ }
+ else
+ {
+ outval[0] = (wchar_t)'t';
+ outval[1] = (wchar_t)'r';
+ outval[2] = (wchar_t)'u';
+ outval[3] = (wchar_t)'e';
+ return 4;
+ }
+ }
+
+ case ByteType:
+ {
+ if (value == 0) return 0;
+ long tmp = *(long*)value;
+ outval[0] = (wchar_t)(tmp&0xFF);
+ return 1;
+ }
+
+ case CharacterType:
+ {
+ if (value == 0) return 0;
+ long tmp = *(long*)value;
+ outval[0] = (wchar_t)(tmp & 0xFFFF);
+ return 1;
+ }
+
+ case ShortType:
+ case IntType:
+ {
+ if (value == 0) return 0;
+ long tmp = *(long*)value;
+#if defined(WIN32) || defined (_WINDOWS)
+ wchar_t* tmpstr = new wchar_t[MAX_LONG_SIZE];
+ _ltow(tmp,tmpstr,10);
+ if (wcslen(tmpstr) > max) return 0;
+ _ltow(tmp,outval,10);
+ return wcslen(outval);
+#else
+ sprintf(tmpstr, "%ld", tmp);
+ if (strlen(tmpstr) > max) return 0;
+ for (j=0; j< strlen(tmpstr); j++)
+ {
+ outval[j] = (wchar_t)tmpstr[j];
+ }
+ delete tmpstr;
+ return j;
+#endif
+ }
+
+
+ case LongType:
+ {
+ if (value == 0) return 0;
+ int64_t tmp = *(int64_t*)value;
+#if defined(WIN32) || defined (_WINDOWS)
+ wchar_t* tmpstr = new wchar_t[MAX_LONG_SIZE];
+ _i64tow(tmp,tmpstr,10);
+ if (wcslen(tmpstr) > max)
+ {
+ delete tmpstr;
+ return 0;
+ }
+ _i64tow(tmp,outval,10);
+ return wcslen(outval);
+#else
+ sprintf(tmpstr, "%lld", tmp);
+ if (strlen(tmpstr) > max) return 0;
+ for (j=0; j< strlen(tmpstr); j++)
+ {
+ outval[j] = (wchar_t)tmpstr[j];
+ }
+ delete tmpstr;
+ return j;
+#endif
+ }
+
+ case DateType:
+ {
+
+ if (value == 0) return 0;
+ string msg("Conversion to string not implemented from type:");
+ msg += getName();
+ throw SDOInvalidConversionException(TUSCANY_SDO_EINFO,
+ msg.c_str());
+ break;
+ }
+
+ case DoubleType:
+ {
+ if (value == 0) return 0;
+ if (max < MAX_DOUBLE_SIZE) return 0;
+ wchar_t* fmt = new wchar_t[5];
+ fmt[0] = (wchar_t)'%';
+ fmt[1] = (wchar_t)'.';
+ fmt[2] = (wchar_t)'*';
+ fmt[3] = (wchar_t)'g';
+ fmt[4] = (wchar_t)0;
+#if defined(WIN32) || defined (_WINDOWS)
+ swprintf((wchar_t*)outval, fmt, SDODataConverter::precision, *(long double*)value);
+#else
+#if defined(NO_SWPRINTF)
+ {
+ int k;
+ char *tmpbuf = new char[50];
+ wchar_t *tmpw = (wchar_t*)outval;
+ sprintf(tmpbuf, "%.*Lg", SDODataConverter::precision, *(long double*)value);
+ for (k=0;k<strlen(tmpbuf);k++)
+ {
+ *(tmpw++) = (wchar_t)(tmpbuf[k]);
+ }
+ *tmpw = 0;
+ delete tmpbuf;
+ }
+
+#else
+ swprintf((wchar_t*)outval, wcslen((wchar_t*)outval), fmt, SDODataConverter::precision, *(long double*)value);
+#endif
+#endif
+ delete fmt;
+
+ return wcslen(outval);
+ }
+ case FloatType:
+ {
+ if (value == 0) return 0;
+ if (max < MAX_FLOAT_SIZE) return 0;
+ wchar_t* fmt = new wchar_t[5];
+ fmt[0] = (wchar_t)'%';
+ fmt[1] = (wchar_t)'.';
+ fmt[2] = (wchar_t)'*';
+ fmt[3] = (wchar_t)'g';
+ fmt[4] = (wchar_t)0;
+#if defined(WIN32) || defined (_WINDOWS)
+ swprintf(outval, fmt, SDODataConverter::precision, *(float*)value);
+#else
+#if defined(NO_SWPRINTF)
+ {
+ int k;
+ char *tmpbuf = new char[50];
+ wchar_t *tmpw = (wchar_t*)outval;
+ sprintf(tmpbuf, "%.*g", SDODataConverter::precision, *(float*)value);
+ for (k=0;k<strlen(tmpbuf);k++)
+ {
+ *(tmpw++) = (wchar_t)(tmpbuf[k]);
+ }
+ *tmpw = 0;
+ delete tmpbuf;
+ }
+#else
+ swprintf(outval, wcslen(outval), fmt, SDODataConverter::precision, *(float*)value);
+#endif
+#endif
+ delete fmt;
+
+ return wcslen(outval);
+ }
+
+ case OtherTypes:
+ case DataObjectType:
+ default:
+ {
+ string msg("Cannot get String from object of type:");
+ msg += getName();
+ throw SDOInvalidConversionException(TUSCANY_SDO_EINFO,
+ msg.c_str());
+ break;
+ }
+ }
+ return 0;
+ }
+
+unsigned int TypeImpl::convertToString(const SDOValue& sdoValue,
+ wchar_t* outval,
+ unsigned int max) const
+{
+ switch (typeEnum)
+ {
+ case BigDecimalType:
+ case BigIntegerType:
+ case UriType:
+ case StringType:
+ case BytesType:
+ case BooleanType:
+ case ByteType:
+ case CharacterType:
+ case ShortType:
+ case IntType:
+ case LongType:
+ case DateType:
+ case DoubleType:
+ case FloatType:
+ return sdoValue.getString(outval, max);
+
+ case OtherTypes:
+ case DataObjectType:
+ default:
+ {
+ string msg("Cannot get String from object of type:");
+ msg += getName();
+ throw SDOInvalidConversionException(TUSCANY_SDO_EINFO,
+ msg.c_str());
+ break;
+ }
+ }
+ return 0;
+}
+
+ unsigned int TypeImpl::convertToBytes(void* value, char* outval, unsigned int len,
+ unsigned int max) const
+ {
+ unsigned int i;
+ switch (typeEnum)
+ {
+ case BytesType:
+ {
+ if (value == 0) return 0;
+ char* tmp = (char*)value;
+ for (i=0;(i < max) && (i < len);i++)
+ {
+ outval[i] = tmp[i];
+ }
+ return len>max?max:len;
+ }
+
+ case BigDecimalType:
+ case BigIntegerType:
+ case UriType:
+ case StringType:
+ {
+ if (value == 0) return 0;
+ wchar_t* tmp = (wchar_t*)value;
+ for (i=0;(i < max) && (i < len);i++)
+ {
+ outval[i] = (char)(tmp[i]);
+ }
+ return len>max?max:len;
+ }
+
+ case BooleanType:
+ {
+ if (value == 0 || *(long*)value == 0) {
+ if (max < 5) return 0;
+ outval[0] = 'f';
+ outval[1] = 'a';
+ outval[2] = 'l';
+ outval[3] = 's';
+ outval[4] = 'e';
+ return 5;
+ }
+ else {
+ if (max < 4) return 0;
+ outval[0] = 't';
+ outval[1] = 'r';
+ outval[2] = 'u';
+ outval[3] = 'e';
+ return 4;
+ }
+ return 0;
+ }
+
+ case CharacterType:
+ case ByteType:
+ {
+ if (value == 0) return 0;
+ long tmp = *(long*)value;
+ outval[0] = (char)(tmp&0xFF);
+ return 1;
+ }
+
+ case ShortType:
+ case IntType:
+ {
+ if (value == 0) return 0;
+ long tmp = *(long*)value;
+ char* tmpstr = new char[MAX_LONG_SIZE];
+ sprintf(tmpstr, "%ld", tmp);
+ if (strlen(tmpstr) > max)
+ {
+ delete tmpstr;
+ return 0;
+ }
+ delete tmpstr;
+ sprintf(outval, "%ld", tmp);
+ return strlen(outval);
+ }
+
+
+ case LongType:
+ {
+ if (value == 0) return 0;
+ int64_t tmp = *(int64_t*)value;
+ char * tmpstr = new char[MAX_LONG_SIZE];
+ sprintf(tmpstr, "%lld", tmp);
+ if (strlen(tmpstr) > max)
+ {
+ delete tmpstr;
+ return 0;
+ }
+ delete tmpstr;
+ sprintf(outval, "%lld", tmp);
+ return strlen(outval);
+ }
+ case DateType:
+ {
+ if (value == 0) return 0;
+ string msg("Conversion to string not implemented from type:");
+ msg += getName();
+ throw SDOInvalidConversionException(TUSCANY_SDO_EINFO,
+ msg.c_str());
+ break;
+ }
+
+ case DoubleType:
+ if (value == 0) return 0;
+ if (max < MAX_DOUBLE_SIZE) return 0;
+ sprintf(outval, "%.*Lg", SDODataConverter::precision, *(long double*)value);
+ return strlen(outval);
+
+ case FloatType:
+ if (value == 0) return 0;
+ if (max < MAX_FLOAT_SIZE) return 0;
+ sprintf(outval, "%.*g", SDODataConverter::precision, *(float*)value);
+ return strlen(outval);
+
+ case OtherTypes:
+ case DataObjectType:
+ default:
+ {
+ if (max < 9) return 0;
+ sprintf(outval,"%08x",value);
+ //string msg("Cannot get Bytes from object of type:");
+ //msg += getName();
+ //throw SDOInvalidConversionException(TUSCANY_SDO_EINFO,
+ // msg.c_str());
+ return strlen(outval);
+ }
+ }
+ return 0;
+ }
+
+ unsigned int TypeImpl::convertToBytes(const SDOValue& sdoValue, char* outptr, unsigned int max) const
+ {
+ switch (typeEnum)
+ {
+ case BytesType:
+ case BigDecimalType:
+ case BigIntegerType:
+ case UriType:
+ case StringType:
+ case BooleanType:
+ case CharacterType:
+ case ByteType:
+ case ShortType:
+ case IntType:
+ case LongType:
+ case DateType:
+ case DoubleType:
+ case FloatType:
+ return sdoValue.getBytes(outptr, max);
+
+ case DataObjectType:
+ case OtherTypes:
+ default:
+ string msg("Cannot get Bytes from object of type:");
+ msg += getName();
+ throw SDOInvalidConversionException(TUSCANY_SDO_EINFO,
+ msg.c_str());
+ }
+ return 0;
+ }
+
+
+ // +++
+
+ // value is a pointer to the byte stream that is the value to convert
+ // outval is the resulting string representation of value
+ // len is the length of the input byte stream, it is used only when the length cannot be inferred from other information.
+ // max is the maximum size allowed for the output byte stream. (Not strictly needed when the output is an std::string but we maintain the behaviour from the earlier method.
+
+ // Questions
+ // 1. Why isn't value const?
+ //
+ unsigned int TypeImpl::convertToBytes(const void* value,
+ SDOString& outval,
+ unsigned int len,
+ unsigned int max) const
+ {
+ unsigned int i;
+ outval.erase();
+ switch (typeEnum)
+ {
+ case BytesType:
+ {
+ if (value == 0) return 0;
+
+ const char* tempPtr = (const char*) value;
+ unsigned int count = (len > max) ? max : len;
+ outval.assign(tempPtr, count);
+
+ return count;
+ }
+
+ case BigDecimalType:
+ case BigIntegerType:
+ case UriType:
+ case StringType:
+ {
+ if (value == 0) return 0;
+
+ const wchar_t* tempPtr = (const wchar_t*) value;
+ unsigned int count = (len > max) ? max : len;
+
+ // The following loop copies the low byte from each 2 byte wchar_t
+ // into one byte of the target array eg H_E_L_P -> HELP
+ for (i = 0; (i < count); i++)
+ {
+ outval += (char)(tempPtr[i]);
+ }
+ return count;
+ }
+
+ case BooleanType:
+ {
+ if (value == 0 || *(const long*)value == 0) {
+ if (max < 5) return 0;
+ outval = "false";
+ return 5;
+ }
+ else {
+ if (max < 4) return 0;
+ outval = "true";
+ return 4;
+ }
+ return 0;
+ }
+
+ case CharacterType:
+ case ByteType:
+ {
+ if (value == 0) return 0;
+
+ const long tmp = *(const long*)value;
+ outval += (char)(tmp&0xFF);
+ return 1;
+ }
+
+ case ShortType:
+ case IntType:
+ {
+ if (value == 0) return 0;
+
+ const long tmp = *(const long*) value;
+ char* tmpstr = new char[MAX_LONG_SIZE + 1];
+ sprintf(tmpstr, "%ld", tmp);
+ if (strlen(tmpstr) > max)
+ {
+ delete tmpstr;
+ return 0;
+ }
+ outval = tmpstr;
+ delete tmpstr;
+ return outval.length();
+ }
+
+ case LongType:
+ {
+ if (value == 0) return 0;
+
+ const int64_t tmp = *(const int64_t*)value;
+ char* tmpstr = new char[MAX_LONG_SIZE + 1];
+ sprintf(tmpstr, "%lld", tmp);
+ if (strlen(tmpstr) > max)
+ {
+ delete tmpstr;
+ return 0;
+ }
+ outval = tmpstr;
+ delete tmpstr;
+ return outval.length();
+ }
+ case DateType:
+ {
+ if (value == 0) return 0;
+
+ string msg("Conversion to string not implemented from type:");
+ msg += getName();
+ throw SDOInvalidConversionException(TUSCANY_SDO_EINFO,
+ msg.c_str());
+ break;
+ }
+
+ case DoubleType:
+ {
+ if (value == 0) return 0;
+
+ if (max < MAX_DOUBLE_SIZE) return 0;
+
+ char* tmpstr = new char[MAX_DOUBLE_SIZE + 1];
+ sprintf(tmpstr, "%.*Lg", SDODataConverter::precision, *(const long double*)value);
+ outval = tmpstr;
+ delete tmpstr;
+ return outval.length();
+ }
+
+ case FloatType:
+ {
+ if (value == 0) return 0;
+
+ if (max < MAX_FLOAT_SIZE) return 0;
+
+ char* tmpstr = new char[MAX_FLOAT_SIZE + 1];
+ sprintf(tmpstr, "%.*g", SDODataConverter::precision, *(const float*)value);
+ outval = tmpstr;
+ delete tmpstr;
+ return outval.length();
+ }
+
+ case OtherTypes:
+ case DataObjectType:
+ default:
+ {
+ if (max < 9) return 0;
+
+ char tmpstr[9];
+ sprintf(tmpstr, "%08x", value);
+ outval = tmpstr;
+ //string msg("Cannot get Bytes from object of type:");
+ //msg += getName();
+ //throw SDOInvalidConversionException(TUSCANY_SDO_EINFO,
+ // msg.c_str());
+ return outval.length();
+ }
+ }
+ return 0;
+ }
+
+ // ---
+
+ const char* TypeImpl::convertToCString(void* value, char** asstringbuf, unsigned int len) const
+ {
+ unsigned int i;
+
+ switch (typeEnum)
+ {
+ case BooleanType:
+ if (value == 0 || *(long*)value == 0) {
+ *asstringbuf = new char[6];
+ strcpy(*asstringbuf,"false");
+ }
+ else {
+ *asstringbuf = new char[5];
+ strcpy(*asstringbuf,"true");
+ }
+ return *asstringbuf;
+
+ case ByteType:
+ *asstringbuf = new char[MAX_LONG_SIZE];
+ if (value == 0){
+ sprintf(*asstringbuf,"%ld",0);
+ }
+ else {
+ sprintf(*asstringbuf,"%ld",*(long*)value);
+ }
+ return *asstringbuf;
+
+ case CharacterType:
+ *asstringbuf = new char[MAX_LONG_SIZE];
+ if (value == 0){
+ sprintf(*asstringbuf,"%ld",0);
+ }
+ else {
+ sprintf(*asstringbuf,"%ld", *(long*)value);
+ }
+ return *asstringbuf;
+
+ case IntType:
+ *asstringbuf = new char[MAX_LONG_SIZE];
+ if (value == 0){
+ sprintf(*asstringbuf,"%ld",0);
+ }
+ else {
+ sprintf(*asstringbuf,"%ld", *(long*)value);
+ }
+ return *asstringbuf;
+
+ case ShortType:
+ *asstringbuf = new char[MAX_LONG_SIZE];
+ if (value == 0){
+ sprintf(*asstringbuf,"%ld",0);
+ }
+ else {
+ sprintf(*asstringbuf,"%ld", *(long*)value);
+ }
+ return *asstringbuf;
+
+ case DoubleType:
+ *asstringbuf = new char[MAX_DOUBLE_SIZE];
+ if (value == 0)
+ {
+ // Conversions might set from a zero value, as they are used
+ // by the default Setting code as well
+ (*asstringbuf)[0] = 0;
+ return *asstringbuf;
+ }
+ sprintf(*asstringbuf, "%.*Lg", SDODataConverter::precision, *(long double*)value);
+ return *asstringbuf;
+
+ case FloatType:
+ *asstringbuf = new char[MAX_FLOAT_SIZE];
+ if (value == 0)
+ {
+ // Conversions might set from a zero value, as they are used
+ // by the default Setting code as well
+ (*asstringbuf)[0] = 0;
+ return *asstringbuf;
+ }
+ sprintf(*asstringbuf, "%.*g", SDODataConverter::precision, *(float*)value);
+ return *asstringbuf;
+
+ case LongType:
+ {
+ *asstringbuf = new char[MAX_LONG_SIZE];
+ if (value == 0)
+ {
+ // Conversions might set from a zero value, as they are used
+ // by the default Setting code as well
+ (*asstringbuf)[0] = 0;
+ return *asstringbuf;
+ }
+ int64_t temp = *(int64_t*)value;
+#if defined(WIN32) || defined (_WINDOWS)
+ sprintf(*asstringbuf,"%I64d", temp);
+#else
+ sprintf(*asstringbuf,"%lld", temp);
+#endif
+ return *asstringbuf;
+ }
+ case DateType:
+ *asstringbuf = new char[MAX_LONG_SIZE];
+ if (value == 0)
+ {
+ // Conversions might set from a zero value, as they are used
+ // by the default Setting code as well
+ (*asstringbuf)[0] = 0;
+ return *asstringbuf;
+ }
+ sprintf(*asstringbuf,"%ld", *(time_t*)value);
+ return *asstringbuf;
+
+ case BigDecimalType:
+ case BigIntegerType:
+ case StringType:
+ case UriType:
+ {
+ if (value == 0 || len == 0)
+ {
+ *asstringbuf = new char[1];
+ (*asstringbuf)[0] = 0;
+ return *asstringbuf;
+ }
+ *asstringbuf = new char[len + 1];
+ wchar_t* tmp = (wchar_t*)value;
+ for (i=0;i< len;i++)
+ {
+ (*asstringbuf)[i] = tmp[i] & 0xFF;
+ }
+ (*asstringbuf)[i] = 0;
+ return *asstringbuf;
+ }
+
+ case BytesType:
+ {
+ if (value == 0 || len == 0)
+ {
+ *asstringbuf = new char[1];
+ (*asstringbuf)[0] = 0;
+ return *asstringbuf;
+ }
+ *asstringbuf = new char[len + 1];
+ char* tmp = (char*)value;
+ for (i=0;i< len ;i++)
+ {
+ (*asstringbuf)[i] = (char)(tmp[i]);
+ }
+ (*asstringbuf)[i] = 0;
+ return *asstringbuf;
+ }
+
+
+ case OtherTypes:
+ case DataObjectType:
+ default:
+ {
+ *asstringbuf = new char[9];
+ sprintf(*asstringbuf,"%08x",value);
+ //string msg("Cannot get CString from object of type:");
+ //msg += getName();
+ //throw SDOInvalidConversionException(TUSCANY_SDO_EINFO,
+ // msg.c_str());
+ return *asstringbuf;
+ }
+ }
+ return 0;
+ }
+
+ const char* TypeImpl::convertToCString(const SDOValue& sdoValue) const
+ {
+
+ switch (typeEnum)
+ {
+ case BooleanType:
+ case ByteType:
+ case CharacterType:
+ case IntType:
+ case ShortType:
+ case DoubleType:
+ case FloatType:
+ case LongType:
+ case DateType:
+ case BigDecimalType:
+ case BigIntegerType:
+ case StringType:
+ case UriType:
+ case BytesType:
+ return sdoValue.getCString();
+
+ case OtherTypes:
+ case DataObjectType:
+ default:
+ {
+ string msg("Cannot get CString from object of type:");
+ msg += getName();
+ throw SDOInvalidConversionException(TUSCANY_SDO_EINFO,
+ msg.c_str());
+ }
+ return 0;
+ }
+ }
+
+
+ const bool TypeImpl::convertToBoolean(void* value, unsigned int len) const
+ {
+ switch (typeEnum)
+ {
+ case BooleanType:
+ case ByteType:
+ case CharacterType:
+ case IntType:
+ case ShortType:
+ if (value == 0) return false;
+ if (*(long*)value != 0) return true;
+ return false;
+
+ case DoubleType:
+ if (value == 0)
+ {
+ // Conversions might set from a zero value, as they are used
+ // by the default Setting code as well
+ return false;
+ }
+ if (*(long double*)value != 0.0) return true;
+ return false;
+
+ case FloatType:
+ if (value == 0)
+ {
+ // Conversions might set from a zero value, as they are used
+ // by the default Setting code as well
+ return false;
+ }
+ if (*(float*)value != 0.0) return true;
+ return false;
+
+ case LongType:
+ if (value == 0)
+ {
+ // Conversions might set from a zero value, as they are used
+ // by the default Setting code as well
+ return false;
+ }
+ if (*(int64_t*)value != 0)return true;
+ return false;
+
+ case DateType:
+ if (value == 0)
+ {
+ // Conversions might set from a zero value, as they are used
+ // by the default Setting code as well
+ return false;
+ }
+ if (*(time_t*)value != 0)return true;
+ return false;
+
+ case BigDecimalType:
+ case BigIntegerType:
+ case StringType:
+ case UriType:
+ if (value == 0 || len < 4)
+ {
+ // Conversions might set from a zero value, as they are used
+ // by the default Setting code as well
+ return false;
+ }
+ if ( ((wchar_t*)value)[0] == (wchar_t)'t' &&
+ ((wchar_t*)value)[1] == (wchar_t)'r' &&
+ ((wchar_t*)value)[2] == (wchar_t)'u' &&
+ ((wchar_t*)value)[3] == (wchar_t)'e' )
+ return true;
+
+ return false;
+
+ case BytesType:
+ if (value == 0 || len < 4)
+ {
+ // Conversions might set from a zero value, as they are used
+ // by the default Setting code as well
+ return false;
+ }
+ if (!strncmp((char*)value,"true", 4)) return true;
+ return false;
+
+ case OtherTypes:
+ case DataObjectType:
+ default:
+ {
+ string msg("Cannot get Boolean from object of type:");
+ msg += getName();
+ throw SDOInvalidConversionException(TUSCANY_SDO_EINFO,
+ msg.c_str());
+ break;
+ }
+ }
+
+ }
+
+ const bool TypeImpl::convertToBoolean(const SDOValue& sdoValue) const
+ {
+ switch (typeEnum)
+ {
+ case BooleanType:
+ case ByteType:
+ case CharacterType:
+ case IntType:
+ case ShortType:
+ case DoubleType:
+ case FloatType:
+ case LongType:
+ case DateType:
+ case BigDecimalType:
+ case BigIntegerType:
+ case StringType:
+ case UriType:
+ case BytesType:
+ return sdoValue.getBoolean();
+
+ case OtherTypes:
+ case DataObjectType:
+ default:
+ {
+ string msg("Cannot get Boolean from object of type:");
+ msg += getName();
+ throw SDOInvalidConversionException(TUSCANY_SDO_EINFO,
+ msg.c_str());
+ break;
+ }
+ }
+ }
+
+
+ const char TypeImpl::convertToByte(void* value , unsigned int len) const
+ {
+ switch (typeEnum)
+ {
+ case BooleanType:
+ case ByteType:
+ case CharacterType:
+ case IntType:
+ case ShortType:
+ if (value == 0) return 0;
+ return (char)(*(long*)value);
+
+ case DoubleType:
+ if (value == 0)
+ {
+ // Conversions might set from a zero value, as they are used
+ // by the default Setting code as well
+ return 0;
+ }
+ return (char)(*(long double*)value);
+
+ case FloatType:
+ if (value == 0)
+ {
+ // Conversions might set from a zero value, as they are used
+ // by the default Setting code as well
+ return 0;
+ }
+ return (char)(*(float*)value);
+
+ case LongType:
+ if (value == 0)
+ {
+ // Conversions might set from a zero value, as they are used
+ // by the default Setting code as well
+ return 0;
+ }
+ return (char)(*(int64_t*)value);
+
+ case DateType:
+ if (value == 0)
+ {
+ // Conversions might set from a zero value, as they are used
+ // by the default Setting code as well
+ return 0;
+ }
+
+ return (char)(*(time_t*)value);
+
+ case BigDecimalType:
+ case BigIntegerType:
+ case StringType:
+ case UriType:
+ {
+ if (value == 0) return 0;
+ // Assume the string is a number eg "123" and attempt to convert it.
+
+#if defined(WIN32) || defined(_WINDOWS)
+ return (char) _wtoi((wchar_t*) value);
+#else
+ char* tmpstr = new char[len + 1];
+ short s = 0;
+ wchar_t* srcptr = (wchar_t*) value;
+
+ for (int j = 0; j < len; j++)
+ {
+ tmpstr[j] = (char) srcptr[j];
+ }
+ tmpstr[len] = 0;
+ s = (char) atoi(tmpstr);
+ delete tmpstr;
+ return (char) s;
+#endif
+ }
+
+ case BytesType:
+ {
+ if (value == 0) return 0;
+ return (char)*(char*)value;
+ }
+
+
+ case OtherTypes:
+ case DataObjectType:
+ default:
+ {
+ string msg("Cannot get Byte from object of type:");
+ msg += getName();
+ throw SDOInvalidConversionException(TUSCANY_SDO_EINFO,
+ msg.c_str());
+ break;
+ }
+ }
+ }
+
+ const char TypeImpl::convertToByte(const SDOValue& sdoValue) const
+ {
+ switch (typeEnum)
+ {
+ case BooleanType:
+ case ByteType:
+ case CharacterType:
+ case IntType:
+ case ShortType:
+ case DoubleType:
+ case FloatType:
+ case LongType:
+ case DateType:
+ case BigDecimalType:
+ case BigIntegerType:
+ case StringType:
+ case UriType:
+ case BytesType:
+ return sdoValue.getByte();
+
+ case OtherTypes:
+ case DataObjectType:
+ default:
+ {
+ string msg("Cannot get Byte from object of type:");
+ msg += getName();
+ throw SDOInvalidConversionException(TUSCANY_SDO_EINFO,
+ msg.c_str());
+ break;
+ }
+ }
+ }
+
+
+ const wchar_t TypeImpl::convertToCharacter(void* value, unsigned int len) const
+ {
+ switch (typeEnum)
+ {
+ case BooleanType:
+ case ByteType:
+ case CharacterType:
+ case IntType:
+ case ShortType:
+ if (value == 0) return 0;
+ return (wchar_t)(*(long*)value);
+
+ case DoubleType:
+ if (value == 0)
+ {
+ // Conversions might set from a zero value, as they are used
+ // by the default Setting code as well
+ return 0;
+ }
+ return (wchar_t)(*(long double*)value);
+
+ case FloatType:
+ if (value == 0)
+ {
+ // Conversions might set from a zero value, as they are used
+ // by the default Setting code as well
+ return 0;
+ }
+ return (wchar_t)(*(float*)value);
+
+ case LongType:
+ if (value == 0)
+ {
+ // Conversions might set from a zero value, as they are used
+ // by the default Setting code as well
+ return 0;
+ }
+ return (wchar_t)(*(int64_t*)value);
+
+ case DateType:
+ if (value == 0)
+ {
+ // Conversions might set from a zero value, as they are used
+ // by the default Setting code as well
+ return 0;
+ }
+ return (wchar_t)(*(time_t*)value);
+
+ case BigDecimalType:
+ case BigIntegerType:
+ case StringType:
+ case UriType:
+ {
+ if (value == 0) return 0;
+ return *(wchar_t*)value;
+ }
+
+ case BytesType:
+ {
+ if (value == 0) return 0;
+ return (wchar_t)*(char*)value;
+ }
+
+ case OtherTypes:
+ case DataObjectType:
+ default:
+ {
+ string msg("Cannot get Character from object of type:");
+ msg += getName();
+ throw SDOInvalidConversionException(TUSCANY_SDO_EINFO,
+ msg.c_str());
+ break;
+ }
+ }
+ }
+
+
+ const wchar_t TypeImpl::convertToCharacter(const SDOValue& sdoValue) const
+ {
+ switch (typeEnum)
+ {
+ case BooleanType:
+ case ByteType:
+ case CharacterType:
+ case IntType:
+ case ShortType:
+ case DoubleType:
+ case FloatType:
+ case LongType:
+ case DateType:
+ case BigDecimalType:
+ case BigIntegerType:
+ case StringType:
+ case UriType:
+ case BytesType:
+ return sdoValue.getCharacter();
+
+ case OtherTypes:
+ case DataObjectType:
+ default:
+ {
+ string msg("Cannot get Character from object of type:");
+ msg += getName();
+ throw SDOInvalidConversionException(TUSCANY_SDO_EINFO,
+ msg.c_str());
+ break;
+ }
+ }
+ }
+
+
+
+ const short TypeImpl::convertToShort(void* value, unsigned int len) const
+ {
+#if ! defined(WIN32) && !defined (_WINDOWS)
+ char* tmpstr = new char[len+1];
+ short s = 0;
+#endif
+ switch (typeEnum)
+ {
+ case BooleanType:
+ case ByteType:
+ case CharacterType:
+ case IntType:
+ case ShortType:
+ if (value == 0) return 0;
+ return (short)(*(long*)value);
+
+ case DoubleType:
+ if (value == 0)
+ {
+ // Conversions might set from a zero value, as they are used
+ // by the default Setting code as well
+ return 0;
+ }
+ return (short)(*(long double*)value);
+
+ case FloatType:
+ if (value == 0)
+ {
+ // Conversions might set from a zero value, as they are used
+ // by the default Setting code as well
+ return 0;
+ }
+ return (short)(*(float*)value);
+
+ case LongType:
+ if (value == 0)
+ {
+ // Conversions might set from a zero value, as they are used
+ // by the default Setting code as well
+ return 0;
+ }
+ return (short)(*(int64_t*)value);
+
+ case DateType:
+ if (value == 0)
+ {
+ // Conversions might set from a zero value, as they are used
+ // by the default Setting code as well
+ return 0;
+ }
+ return (short)(*(time_t*)value);
+
+ case BigDecimalType:
+ case BigIntegerType:
+ case StringType:
+ case UriType:
+ if (value == 0 || len == 0)
+ {
+ // Conversions might set from a zero value, as they are used
+ // by the default Setting code as well
+ return 0;
+ }
+#if defined(WIN32) || defined (_WINDOWS)
+ return (short)_wtoi((wchar_t*)value);
+#else
+ for (int j=0;j< len;j++)
+ {
+ tmpstr[j] = (char)((char *)value)[j];
+ }
+ tmpstr[len] = 0;
+ s = (short) atoi(tmpstr);
+ delete tmpstr;
+ return s;
+#endif
+
+
+ case BytesType:
+ case OtherTypes:
+ case DataObjectType:
+ default:
+ {
+ string msg("Cannot get Short from object of type:");
+ msg += getName();
+ throw SDOInvalidConversionException(TUSCANY_SDO_EINFO,
+ msg.c_str());
+ break;
+ }
+ }
+ }
+
+ const short TypeImpl::convertToShort(const SDOValue& sdoValue) const
+ {
+ switch (typeEnum)
+ {
+ case BooleanType:
+ case ByteType:
+ case CharacterType:
+ case IntType:
+ case ShortType:
+ case DoubleType:
+ case FloatType:
+ case LongType:
+ case DateType:
+ case BigDecimalType:
+ case BigIntegerType:
+ case StringType:
+ case UriType:
+ case BytesType:
+ return sdoValue.getShort();
+
+ case OtherTypes:
+ case DataObjectType:
+ default:
+ {
+ string msg("Cannot get Short from object of type:");
+ msg += getName();
+ throw SDOInvalidConversionException(TUSCANY_SDO_EINFO,
+ msg.c_str());
+ break;
+ }
+ }
+ }
+
+
+/* const int TypeImpl::convertToInt(void* value, unsigned int len) const
+ {
+ switch (typeEnum)
+ {
+ case BooleanType:
+ case ByteType:
+ case CharacterType:
+ case IntType:
+ case ShortType:
+ if (value == 0) return 0;
+ return (int)(*(long*)value);
+
+ case DoubleType:
+ if (value == 0)
+ {
+ // Conversions might set from a zero value, as they are used
+ // by the default Setting code as well
+ return 0;
+ }
+ return (int)(*(long double*)value);
+
+ case FloatType:
+ if (value == 0)
+ {
+ // Conversions might set from a zero value, as they are used
+ // by the default Setting code as well
+ return 0;
+ }
+ return (int)(*(float*)value);
+
+ case LongType:
+ if (value == 0)
+ {
+ // Conversions might set from a zero value, as they are used
+ // by the default Setting code as well
+ return 0;
+ }
+ return (int)(*(int64_t*)value);
+
+ case DateType:
+ if (value == 0)
+ {
+ // Conversions might set from a zero value, as they are used
+ // by the default Setting code as well
+ return 0;
+ }
+ return (int)(*(time_t*)value);
+
+ case BigDecimalType:
+ case BigIntegerType:
+ case StringType:
+ case UriType:
+ if (value == 0)
+ {
+ // Conversions might set from a zero value, as they are used
+ // by the default Setting code as well
+ return 0;
+ }
+#if defined(WIN32) || defined (_WINDOWS)
+ return (int)_wtoi((wchar_t*)value);
+#else
+ char* tmp = new char[len+1];
+ int j = 0;;
+ for (j=0;j<len;j++)
+ {
+ tmp[j] = (char)(wchar_t*)value[j];
+ }
+ tmp[j] = 0;
+ j = atoi(tmp);
+ delete tmp;
+ return j;
+#endif
+
+ case BytesType:
+ if (value == 0)
+ {
+ // Conversions might set from a zero value, as they are used
+ // by the default Setting code as well
+ return 0;
+ }
+ return (int)atoi((char*)value);
+
+ case OtherTypes:
+ case DataObjectType:
+ default:
+ {
+ string msg("Cannot get Int from object of type:");
+ msg += getName();
+ throw SDOInvalidConversionException(TUSCANY_SDO_EINFO,
+ msg.c_str());
+ break;
+ }
+ }
+ }
+
+ */
+ const long TypeImpl::convertToInt(void* value, unsigned int len) const
+ {
+#if ! defined(WIN32) && ! defined (_WINDOWS)
+ char* tmp = new char[len+1];
+ int j = 0;
+ long l = 0;
+#endif
+ switch (typeEnum)
+ {
+ case BooleanType:
+ case ByteType:
+ case CharacterType:
+ case IntType:
+ case ShortType:
+ if (value == 0) return 0;
+ return (long)(*(long*)value);
+
+ case DoubleType:
+ if (value == 0)
+ {
+ // Conversions might set from a zero value, as they are used
+ // by the default Setting code as well
+ return 0;
+ }
+ return (long)(*(long double*)value);
+
+ case FloatType:
+ if (value == 0)
+ {
+ // Conversions might set from a zero value, as they are used
+ // by the default Setting code as well
+ return 0;
+ }
+ return (long)(*(float*)value);
+
+ case LongType:
+ if (value == 0)
+ {
+ // Conversions might set from a zero value, as they are used
+ // by the default Setting code as well
+ return 0;
+ }
+ return (long)(*(int64_t*)value);
+
+ case DateType:
+ if (value == 0)
+ {
+ // Conversions might set from a zero value, as they are used
+ // by the default Setting code as well
+ return 0;
+ }
+ return (long)(*(time_t*)value);
+
+ case BigDecimalType:
+ case BigIntegerType:
+ case StringType:
+ case UriType:
+ if (value == 0)
+ {
+ // Conversions might set from a zero value, as they are used
+ // by the default Setting code as well
+ return 0;
+ }
+#if defined(WIN32) || defined (_WINDOWS)
+ return (long)_wtol((wchar_t*)value);
+#else
+ for (j=0;j<len;j++)
+ {
+ tmp[j] = (char)((wchar_t*)value)[j];
+ }
+ tmp[j] = 0;
+ l = atol(tmp);
+ delete tmp;
+ return l;
+#endif
+
+ case BytesType:
+ if (value == 0)
+ {
+ // Conversions might set from a zero value, as they are used
+ // by the default Setting code as well
+ return 0;
+ }
+ return (int)atol((char*)value);
+
+ case OtherTypes:
+ case DataObjectType:
+ default:
+ {
+ string msg("Cannot get Long from object of type:");
+ msg += getName();
+ throw SDOInvalidConversionException(TUSCANY_SDO_EINFO,
+ msg.c_str());
+ break;
+ }
+ }
+ }
+
+ const long TypeImpl::convertToInt(const SDOValue& sdoValue) const
+ {
+ switch (typeEnum)
+ {
+ case BooleanType:
+ case ByteType:
+ case CharacterType:
+ case IntType:
+ case ShortType:
+ case DoubleType:
+ case FloatType:
+ case LongType:
+ case DateType:
+ case BigDecimalType:
+ case BigIntegerType:
+ case StringType:
+ case UriType:
+ case BytesType:
+ return sdoValue.getInt();
+
+ case OtherTypes:
+ case DataObjectType:
+ default:
+ {
+ string msg("Cannot get Long from object of type:");
+ msg += getName();
+ throw SDOInvalidConversionException(TUSCANY_SDO_EINFO,
+ msg.c_str());
+ break;
+ }
+ }
+ }
+
+
+ const int64_t TypeImpl::convertToLong(void* value, unsigned int len) const
+ {
+#if ! defined(WIN32) && ! defined (_WINDOWS)
+ char* tmp = new char[len+1];
+ int j = 0;
+ int64_t l = 0;
+#endif
+ switch (typeEnum)
+ {
+ case BooleanType:
+ case CharacterType:
+ case ByteType:
+ case IntType:
+ case ShortType:
+ if (value == 0) return 0;
+ return (int64_t)(*(long*)value);
+
+ case DoubleType:
+ if (value == 0)
+ {
+ // Conversions might set from a zero value, as they are used
+ // by the default Setting code as well
+ return 0;
+ }
+ return (int64_t)(*(long double*)value);
+
+ case FloatType:
+ if (value == 0)
+ {
+ // Conversions might set from a zero value, as they are used
+ // by the default Setting code as well
+ return 0;
+ }
+ return (int64_t)(*(float*)value);
+
+ case LongType:
+ if (value == 0)
+ {
+ // Conversions might set from a zero value, as they are used
+ // by the default Setting code as well
+ return 0;
+ }
+ return (int64_t)(*(int64_t*)value);
+
+ case DateType:
+ if (value == 0)
+ {
+ // Conversions might set from a zero value, as they are used
+ // by the default Setting code as well
+ return 0;
+ }
+ return (int64_t)(*(time_t*)value);
+
+ case BigDecimalType:
+ case BigIntegerType:
+ case StringType:
+ case UriType:
+ if (value == 0)
+ {
+ // Conversions might set from a zero value, as they are used
+ // by the default Setting code as well
+ return 0;
+ }
+#if defined(WIN32) || defined (_WINDOWS)
+ return (long)_wtol((wchar_t*)value);
+#else
+ for (j=0;j<len;j++)
+ {
+ tmp[j] = (char)((wchar_t*)value)[j];
+ }
+ tmp[j] = 0;
+ l = strtoll(tmp, NULL, 0);
+ delete tmp;
+ return l;
+#endif
+
+
+ case BytesType:
+ if (value == 0)
+ {
+ // Conversions might set from a zero value, as they are used
+ // by the default Setting code as well
+ return 0;
+ }
+#if defined(WIN32) || defined (_WINDOWS)
+ return _atoi64((char*)value);
+#else
+ return strtoll((char*)value, NULL, 0);
+#endif
+
+ case OtherTypes:
+ case DataObjectType:
+ default:
+ {
+ string msg("Cannot get Long Long from object of type:");
+ msg += getName();
+ throw SDOInvalidConversionException(TUSCANY_SDO_EINFO,
+ msg.c_str());
+ break;
+ }
+ }
+ }
+
+ const int64_t TypeImpl::convertToLong(const SDOValue& sdoValue) const
+ {
+ switch (typeEnum)
+ {
+ case BooleanType:
+ case CharacterType:
+ case ByteType:
+ case IntType:
+ case ShortType:
+ case DoubleType:
+ case FloatType:
+ case LongType:
+ case DateType:
+ case BigDecimalType:
+ case BigIntegerType:
+ case StringType:
+ case UriType:
+ case BytesType:
+ return sdoValue.getLong();
+
+ case OtherTypes:
+ case DataObjectType:
+ default:
+ {
+ string msg("Cannot get Long Long from object of type:");
+ msg += getName();
+ throw SDOInvalidConversionException(TUSCANY_SDO_EINFO,
+ msg.c_str());
+ break;
+ }
+ }
+ }
+
+
+ const float TypeImpl::convertToFloat(void* value, unsigned int len) const
+ {
+ switch (typeEnum)
+ {
+ case BooleanType:
+ case ByteType:
+ case CharacterType:
+ case IntType:
+ case ShortType:
+ if (value == 0) return 0;
+ return (float)(*(long*)value);
+
+ case DoubleType:
+ if (value == 0)
+ {
+ // Conversions might set from a zero value, as they are used
+ // by the default Setting code as well
+ return 0.0;
+ }
+ return (float)(*(long double*)value);
+
+ case FloatType:
+ if (value == 0)
+ {
+ // Conversions might set from a zero value, as they are used
+ // by the default Setting code as well
+ return 0.0;
+ }
+ return (float)(*(float*)value);
+
+ case LongType:
+ if (value == 0)
+ {
+ // Conversions might set from a zero value, as they are used
+ // by the default Setting code as well
+ return 0.0;
+ }
+ return (float)(*(int64_t*)value);
+
+ case DateType:
+ if (value == 0)
+ {
+ // Conversions might set from a zero value, as they are used
+ // by the default Setting code as well
+ return 0.0;
+ }
+ return (float)(*(time_t*)value);
+
+ case BigDecimalType:
+ case BigIntegerType:
+ case StringType:
+ case UriType:
+ {
+ if (value == 0)
+ {
+ // Conversions might set from a zero value, as they are used
+ // by the default Setting code as well
+ return 0.0;
+ }
+ char* tmp = new char[len+1];
+ for (unsigned int j=0;j<len;j++)
+ {
+ tmp[j] = (char)((wchar_t*)value)[j];
+ }
+ tmp[len] = 0;
+ float f = atof(tmp);
+ delete tmp;
+ return f;
+ }
+
+ case BytesType:
+ if (value == 0)
+ {
+ // Conversions might set from a zero value, as they are used
+ // by the default Setting code as well
+ return 0.0;
+ }
+ return (float)atof((char*)value);
+
+ case OtherTypes:
+ case DataObjectType:
+ default:
+ {
+ string msg("Cannot get Float from object of type:");
+ msg += getName();
+ throw SDOInvalidConversionException(TUSCANY_SDO_EINFO,
+ msg.c_str());
+ break;
+ }
+ }
+ }
+
+ /*const double TypeImpl::convertToDouble(void* value, unsigned int len) const
+ {
+ switch (typeEnum)
+ {
+ case BooleanType:
+ case ByteType:
+ case CharacterType:
+ case IntType:
+ case ShortType:
+ if (value == 0) return 0;
+ return (double)(*(long*)value);
+
+ case DoubleType:
+ if (value == 0)
+ {
+ // Conversions might set from a zero value, as they are used
+ // by the default Setting code as well
+ return 0.0;
+ }
+ return (double)(*(long double*)value);
+
+ case FloatType:
+ if (value == 0)
+ {
+ // Conversions might set from a zero value, as they are used
+ // by the default Setting code as well
+ return 0.0;
+ }
+ return (double)(*(float*)value);
+
+ case LongType:
+ if (value == 0)
+ {
+ // Conversions might set from a zero value, as they are used
+ // by the default Setting code as well
+ return 0.0;
+ }
+ return (double)(*(int64_t*)value);
+
+ case DateType:
+ if (value == 0)
+ {
+ // Conversions might set from a zero value, as they are used
+ // by the default Setting code as well
+ return 0.0;
+ }
+ return (double)(*(time_t*)value);
+
+ case BigDecimalType:
+ case BigIntegerType:
+ case StringType:
+ case UriType:
+ {
+ if (value == 0)
+ {
+ // Conversions might set from a zero value, as they are used
+ // by the default Setting code as well
+ return 0.0;
+ }
+ char* tmp = new char[len+1];
+ int j = 0;
+ for (j=0;j<len;j++)
+ {
+ tmp[j] = (char)((wchar_t*)value)[j];
+ }
+ tmp[len] = 0;
+ float f = atof(tmp);
+ delete tmp;
+ return (double)f;
+ }
+ case BytesType:
+ if (value == 0)
+ {
+ // Conversions might set from a zero value, as they are used
+ // by the default Setting code as well
+ return 0.0;
+ }
+ return (double)atof((char*)value);
+
+ case OtherTypes:
+ case DataObjectType:
+ default:
+ {
+ string msg("Cannot get LongDouble from object of type:");
+ msg += getName();
+ throw SDOInvalidConversionException(TUSCANY_SDO_EINFO,
+ msg.c_str());
+ break;
+ }
+ }
+ }
+*/
+ const long double TypeImpl::convertToDouble(void* value, unsigned int len) const
+ {
+ switch (typeEnum)
+ {
+ case BooleanType:
+ case ByteType:
+ case CharacterType:
+ case IntType:
+ case ShortType:
+ if (value == 0) return 0;
+ return (long double)(*(long*)value);
+
+ case DoubleType:
+ if (value == 0)
+ {
+ // Conversions might set from a zero value, as they are used
+ // by the default Setting code as well
+ return 0.0;
+ }
+ return (long double)(*(long double*)value);
+
+ case FloatType:
+ if (value == 0)
+ {
+ // Conversions might set from a zero value, as they are used
+ // by the default Setting code as well
+ return 0.0;
+ }
+ return (long double)(*(float*)value);
+
+ case LongType:
+ if (value == 0)
+ {
+ // Conversions might set from a zero value, as they are used
+ // by the default Setting code as well
+ return 0.0;
+ }
+ return (long double)(*(int64_t*)value);
+
+ case DateType:
+ if (value == 0)
+ {
+ // Conversions might set from a zero value, as they are used
+ // by the default Setting code as well
+ return 0.0;
+ }
+ return (long double)(*(time_t*)value);
+
+ case BigDecimalType:
+ case BigIntegerType:
+ case StringType:
+ case UriType:
+ {
+ if (value == 0)
+ {
+ // Conversions might set from a zero value, as they are used
+ // by the default Setting code as well
+ return 0.0;
+ }
+ char* tmp = new char[len+1];
+ for (unsigned int j=0;j<len;j++)
+ {
+ tmp[j] = (char)((wchar_t*)value)[j];
+ }
+ tmp[len] = 0;
+ float f = atof(tmp);
+ delete tmp;
+ return (long double)f;
+ }
+
+ case BytesType:
+ if (value == 0)
+ {
+ // Conversions might set from a zero value, as they are used
+ // by the default Setting code as well
+ return 0.0;
+ }
+ return (long double)atof((char*)value);
+
+ case OtherTypes:
+ case DataObjectType:
+ throw SDOInvalidConversionException(TUSCANY_SDO_EINFO,
+ "Not implemented on data object");
+ break;
+
+ default:
+ {
+ string msg("Cannot get LongDouble from object of type:");
+ msg += getName();
+ throw SDOInvalidConversionException(TUSCANY_SDO_EINFO,
+ msg.c_str());
+ break;
+ }
+ }
+ }
+
+ const long double TypeImpl::convertToDouble(const SDOValue& sdoValue) const
+ {
+ switch (typeEnum)
+ {
+ case BooleanType:
+ case ByteType:
+ case CharacterType:
+ case IntType:
+ case ShortType:
+ case DoubleType:
+ case FloatType:
+ case LongType:
+ case DateType:
+ case BigDecimalType:
+ case BigIntegerType:
+ case StringType:
+ case UriType:
+ case BytesType:
+ return sdoValue.getDouble();
+
+ case OtherTypes:
+ case DataObjectType:
+ default:
+ {
+ string msg("Cannot get double from object of type:");
+ msg += getName();
+ throw SDOInvalidConversionException(TUSCANY_SDO_EINFO,
+ msg.c_str());
+ break;
+ }
+ }
+ }
+
+ const float TypeImpl::convertToFloat(const SDOValue& sdoValue) const
+ {
+ switch (typeEnum)
+ {
+ case BooleanType:
+ case ByteType:
+ case CharacterType:
+ case IntType:
+ case ShortType:
+ case DoubleType:
+ case FloatType:
+ case LongType:
+ case DateType:
+ case BigDecimalType:
+ case BigIntegerType:
+ case StringType:
+ case UriType:
+ case BytesType:
+ return sdoValue.getFloat();
+
+ case OtherTypes:
+ case DataObjectType:
+ default:
+ {
+ string msg("Cannot get float from object of type:");
+ msg += getName();
+ throw SDOInvalidConversionException(TUSCANY_SDO_EINFO,
+ msg.c_str());
+ break;
+ }
+ }
+ }
+
+
+ const SDODate TypeImpl::convertToDate(void* value, unsigned int len) const
+ {
+ switch (typeEnum)
+ {
+ case ByteType:
+ case CharacterType:
+ case IntType:
+ case ShortType:
+ if (value == 0) return 0;
+ return (time_t)(*(long*)value);
+
+ case DoubleType:
+ if (value == 0)
+ {
+ // Conversions might set from a zero value, as they are used
+ // by the default Setting code as well
+ return 0;
+ }
+ return (time_t)(*(long double*)value);
+
+ case FloatType:
+ if (value == 0)
+ {
+ // Conversions might set from a zero value, as they are used
+ // by the default Setting code as well
+ return 0;
+ }
+ return (time_t)(*(float*)value);
+
+ case LongType:
+ if (value == 0)
+ {
+ // Conversions might set from a zero value, as they are used
+ // by the default Setting code as well
+ return 0;
+ }
+ return (time_t)(*(int64_t*)value);
+
+ case DateType:
+ if (value == 0)
+ {
+ // Conversions might set from a zero value, as they are used
+ // by the default Setting code as well
+ return 0;
+ }
+ return (time_t)(*(time_t*)value);
+
+ case BigDecimalType:
+ case BigIntegerType:
+ case StringType:
+ case UriType:
+ case BooleanType:
+ case BytesType:
+ case OtherTypes:
+ case DataObjectType:
+ default:
+ {
+ string msg("Cannot get Date from object of type:");
+ msg += getName();
+ throw SDOInvalidConversionException(TUSCANY_SDO_EINFO,
+ msg.c_str());
+ break;
+ }
+ }
+ }
+
+ const SDODate TypeImpl::convertToDate(const SDOValue& sdoValue) const
+ {
+ switch (typeEnum)
+ {
+ case ByteType:
+ case CharacterType:
+ case IntType:
+ case ShortType:
+ case DoubleType:
+ case FloatType:
+ case LongType:
+ case DateType:
+ case BooleanType:
+ case BytesType:
+ case StringType:
+ return sdoValue.getDate();
+
+ case BigDecimalType:
+ case BigIntegerType:
+ case UriType:
+ case OtherTypes:
+ case DataObjectType:
+ default:
+ {
+ string msg("Cannot get Date from object of type:");
+ msg += getName();
+ throw SDOInvalidConversionException(TUSCANY_SDO_EINFO,
+ msg.c_str());
+ break;
+ }
+ }
+ }
+
+
+
+ DataObject* TypeImpl::convertToDataObject(void* value, unsigned int len) const
+ {
+ switch (typeEnum)
+ {
+ case OtherTypes:
+ case DataObjectType:
+ return (DataObject*)value;
+
+ case BooleanType:
+ case ByteType:
+ case CharacterType:
+ case IntType:
+ case ShortType:
+ case DoubleType:
+ case FloatType:
+ case LongType:
+ case DateType:
+ case BigDecimalType:
+ case BigIntegerType:
+ case StringType:
+ case BytesType:
+ case UriType:
+ default:
+ {
+ string msg("Cannot get Data Object from object of type:");
+ msg += getName();
+ throw SDOInvalidConversionException(TUSCANY_SDO_EINFO,
+ msg.c_str());
+ break;
+ }
+ }
+ }
+};
+
+};
diff --git a/sdo-cpp/trunk/runtime/core/src/commonj/sdo/TypeImpl.h b/sdo-cpp/trunk/runtime/core/src/commonj/sdo/TypeImpl.h
new file mode 100644
index 0000000000..d30316ef99
--- /dev/null
+++ b/sdo-cpp/trunk/runtime/core/src/commonj/sdo/TypeImpl.h
@@ -0,0 +1,337 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you 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$ */
+
+#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/PropertyList.h"
+#include "commonj/sdo/SDODate.h"
+#include "commonj/sdo/SDOValue.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
+
+
+
+namespace commonj{
+namespace sdo{
+
+class DataObject;
+class PropertyList;
+class MetadataGraph;
+
+
+/**
+ * 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 SDOString& 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 SDOString& 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;
+#if __WORDSIZE !=64
+ unsigned int convert( void ** value,const long i) const;
+#endif
+ 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 char* convertToCString(const SDOValue& sdoValue) const;
+ const bool convertToBoolean( void* value, unsigned int len) const;
+ const bool convertToBoolean(const SDOValue& sdoValue) const;
+ const char convertToByte( void* value,unsigned int len ) const;
+ const char convertToByte(const SDOValue& sdoValue) const;
+ unsigned int convertToString( void* value , wchar_t* val, unsigned int len,
+ unsigned int max) const;
+ unsigned int convertToString(const SDOValue& sdoValue,
+ wchar_t* val,
+ unsigned int max) const;
+ unsigned int convertToBytes( void* value , char* val, unsigned int len,
+ unsigned int max) const;
+ unsigned int convertToBytes(const SDOValue& sdoValue , char* val, unsigned int max) const;
+ unsigned int convertToBytes( const void* value , SDOString& val, unsigned int len,
+ unsigned int max) const;
+ const wchar_t convertToCharacter( void* value ,unsigned int len) const;
+ const wchar_t convertToCharacter(const SDOValue& sdoValue) const;
+ const short convertToShort( void* value ,unsigned int len) const;
+ const short convertToShort(const SDOValue& sdoValue) const;
+ const long convertToInt( void* value ,unsigned int len) const;
+ const long convertToInt(const SDOValue& sdoValue) const;
+ const int64_t convertToLong( void* value ,unsigned int len) const;
+ const int64_t convertToLong(const SDOValue& sdoValue) const;
+ const float convertToFloat( void* value ,unsigned int len) const;
+ const float convertToFloat(const SDOValue& sdoValue) const;
+ const long double convertToDouble(void* value ,unsigned int len) const;
+ const long double convertToDouble(const SDOValue& sdoValue) const;
+ DataObject* convertToDataObject(void* value ,unsigned int len) const;
+ const SDODate convertToDate (void* value ,unsigned int len) const;
+ const SDODate convertToDate (const SDOValue& sdoValue) 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;
+ const std::vector<PropertyImplPtr>& getPropertyListReference() 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(const SDOString& propertyName) const ;
+ const Property& getProperty(unsigned int index) const ;
+
+ PropertyImpl* getPropertyImpl(const SDOString& 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 std::string& propertyName) const ;
+ const TypeImpl* getRealPropertyTypeImpl(const std::string& propertyName) const ;
+
+
+
+ unsigned int getPropertyIndex(const char* propertyName) const ;
+ unsigned int getPropertyIndex(const SDOString& 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);
+
+ // Returns true if Type is Open only because it's base Type is open
+ bool isOpenTypeImplicitly() const;
+
+ ///////////////////////////////////////////////////////////////////////////
+ // 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, bool isRestriction = false);
+ const Type* getBaseType() const;
+ const TypeImpl* getBaseTypeImpl() 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;
+
+ virtual bool isFromList() const;
+
+
+private:
+ friend class DataFactoryImpl;
+
+ bool changeSummaryType;
+
+ bool bFromList;
+
+ void* newValue(void* v, int size) const;
+
+ std::vector<PropertyImplPtr> getCompoundProperties();
+
+ void throwIfNestedChangeSummary() const;
+
+ TypeImpl(const char* uri,const char* name,
+ bool isSeq= false,
+ bool isOp = false,
+ bool isAbs = false,
+ bool isData = false,
+ bool isFromList = false);
+
+ TypeImpl(const Type* base, const char* uri,const char* name,
+ bool isSeq = false,
+ bool isOp = false,
+ bool isAbs = false,
+ bool isData = false,
+ bool isRest = false);
+
+ void init(const char* uri, const char* inname,
+ bool isSeq,
+ bool isOp,
+ bool isAbs,
+ bool isData);
+
+
+
+ TypeImpl();
+ TypeImpl(const TypeImpl& t);
+
+ bool isBaseTypeOf(const Type* type)const;
+
+ char* name;
+ char* typeURI;
+
+ bool isPrimitive;
+ bool isSequenced;
+ bool isOpen;
+ bool isOpenImplicitly;
+ bool isAbstract;
+
+ // baseType properties included
+ bool isResolved;
+ // check for circular dependency
+ bool isResolving;
+
+ Types typeEnum;
+
+ // alias support
+ std::vector<char*> aliases;
+
+ std::vector<PropertyImplPtr> props;
+
+ // type inheritance
+ TypeImpl* baseType;
+ bool brestriction; /* if this is a restriction of the base type
+ rather than an extension.*/
+ // says how many of the props are really in this data object type.
+ unsigned int localPropsSize;
+};
+
+};
+};
+
+#endif //_TYPEIMPL_H_
diff --git a/sdo-cpp/trunk/runtime/core/src/commonj/sdo/TypeList.cpp b/sdo-cpp/trunk/runtime/core/src/commonj/sdo/TypeList.cpp
new file mode 100644
index 0000000000..86821e1b51
--- /dev/null
+++ b/sdo-cpp/trunk/runtime/core/src/commonj/sdo/TypeList.cpp
@@ -0,0 +1,86 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you 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$ */
+
+#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[] (unsigned int pos) const
+{
+ return *plist[pos];
+}
+
+SDO_API unsigned 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.push_back(t);
+}
+
+};
+};
+
diff --git a/sdo-cpp/trunk/runtime/core/src/commonj/sdo/TypeList.h b/sdo-cpp/trunk/runtime/core/src/commonj/sdo/TypeList.h
new file mode 100644
index 0000000000..cd19d0bf3d
--- /dev/null
+++ b/sdo-cpp/trunk/runtime/core/src/commonj/sdo/TypeList.h
@@ -0,0 +1,58 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you 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$ */
+
+#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[] (unsigned int pos) const;
+ SDO_API unsigned int size () const;
+ SDO_API void insert (const Type* t);
+};
+};
+};
+
+#endif
diff --git a/sdo-cpp/trunk/runtime/core/src/commonj/sdo/XMLDocument.cpp b/sdo-cpp/trunk/runtime/core/src/commonj/sdo/XMLDocument.cpp
new file mode 100644
index 0000000000..d6dfd02c8e
--- /dev/null
+++ b/sdo-cpp/trunk/runtime/core/src/commonj/sdo/XMLDocument.cpp
@@ -0,0 +1,33 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you 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$ */
+
+#include "commonj/sdo/XMLDocument.h"
+namespace commonj
+{
+ namespace sdo
+ {
+
+ XMLDocument::~XMLDocument()
+ {
+ }
+
+ } // End - namespace sdo
+} // End - namespace commonj
diff --git a/sdo-cpp/trunk/runtime/core/src/commonj/sdo/XMLDocument.h b/sdo-cpp/trunk/runtime/core/src/commonj/sdo/XMLDocument.h
new file mode 100644
index 0000000000..757ba2113a
--- /dev/null
+++ b/sdo-cpp/trunk/runtime/core/src/commonj/sdo/XMLDocument.h
@@ -0,0 +1,151 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you 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$ */
+
+#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;
+ SDO_API virtual void setEncoding(const SDOString& 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;
+ SDO_API virtual void setXMLVersion(const SDOString& 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;
+ SDO_API virtual void setSchemaLocation(const SDOString& 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 virtual void setNoNamespaceSchemaLocation(const SDOString& noNamespaceSchemaLocation) = 0;
+
+ SDO_API friend std::istream& operator>>(std::istream& input, XMLDocument& doc);
+
+ };
+ } // End - namespace sdo
+} // End - namespace commonj
+
+
+#endif //_XMLDOCUMENT_H_
diff --git a/sdo-cpp/trunk/runtime/core/src/commonj/sdo/XMLDocumentImpl.cpp b/sdo-cpp/trunk/runtime/core/src/commonj/sdo/XMLDocumentImpl.cpp
new file mode 100644
index 0000000000..1a97f26765
--- /dev/null
+++ b/sdo-cpp/trunk/runtime/core/src/commonj/sdo/XMLDocumentImpl.cpp
@@ -0,0 +1,87 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you 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$ */
+
+#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::setEncoding(const SDOString& enc)
+ {
+ encoding = enc.c_str();
+ }
+
+ void XMLDocumentImpl::setXMLDeclaration(bool xmlDecl)
+ {
+ xmlDeclaration = xmlDecl;
+ }
+
+ void XMLDocumentImpl::setXMLVersion(const char* xmlVer)
+ {
+ 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
+} // End - namespace commonj
diff --git a/sdo-cpp/trunk/runtime/core/src/commonj/sdo/XMLDocumentImpl.h b/sdo-cpp/trunk/runtime/core/src/commonj/sdo/XMLDocumentImpl.h
new file mode 100644
index 0000000000..f7726a449c
--- /dev/null
+++ b/sdo-cpp/trunk/runtime/core/src/commonj/sdo/XMLDocumentImpl.h
@@ -0,0 +1,102 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you 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$ */
+
+#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"
+#include "commonj/sdo/SDOString.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 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);
+ 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_
diff --git a/sdo-cpp/trunk/runtime/core/src/commonj/sdo/XMLHelper.cpp b/sdo-cpp/trunk/runtime/core/src/commonj/sdo/XMLHelper.cpp
new file mode 100644
index 0000000000..0e1018ac99
--- /dev/null
+++ b/sdo-cpp/trunk/runtime/core/src/commonj/sdo/XMLHelper.cpp
@@ -0,0 +1,36 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you 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$ */
+
+
+#include "commonj/sdo/XMLHelper.h"
+namespace commonj
+{
+ namespace sdo
+ {
+ //////////////////////////////////////////////////////////////////////
+ // Construction/Destruction
+ //////////////////////////////////////////////////////////////////////
+ XMLHelper::~XMLHelper()
+ {
+ }
+
+ } // End - namespace sdo
+} // End - namespace commonj
diff --git a/sdo-cpp/trunk/runtime/core/src/commonj/sdo/XMLHelper.h b/sdo-cpp/trunk/runtime/core/src/commonj/sdo/XMLHelper.h
new file mode 100644
index 0000000000..79e821ebd1
--- /dev/null
+++ b/sdo-cpp/trunk/runtime/core/src/commonj/sdo/XMLHelper.h
@@ -0,0 +1,184 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you 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$ */
+
+#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 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 = "") = 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 = "") = 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 = "") = 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 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
+ */
+
+ 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
+ *
+ * save - Serializes the datagraph to a string
+ */
+
+ SDO_API virtual char* save(XMLDocumentPtr doc, int indent = -1) = 0;
+ SDO_API virtual char* save(
+ DataObjectPtr dataObject,
+ 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
+ *
+ * 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;
+ SDO_API virtual XMLDocumentPtr createDocument(
+ DataObjectPtr dataObject,
+ const SDOString& rootElementURI,
+ const SDOString& 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 unsigned 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(unsigned int errnum) const = 0;
+
+
+ };
+ } // End - namespace sdo
+} // End - namespace commonj
+
+#endif //_XMLHELPER_H_
diff --git a/sdo-cpp/trunk/runtime/core/src/commonj/sdo/XMLHelperImpl.cpp b/sdo-cpp/trunk/runtime/core/src/commonj/sdo/XMLHelperImpl.cpp
new file mode 100644
index 0000000000..3080b79e9f
--- /dev/null
+++ b/sdo-cpp/trunk/runtime/core/src/commonj/sdo/XMLHelperImpl.cpp
@@ -0,0 +1,397 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you 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$ */
+
+#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 = staticCast<DataFactoryImplPtr>(df);
+ if (!dataFactory)
+ {
+ dataFactory = staticCast<DataFactoryImplPtr>(DataFactory::getDataFactory());
+ }
+ }
+
+ XMLHelperImpl::~XMLHelperImpl()
+ {
+ clearErrors();
+ }
+
+ DataFactoryPtr XMLHelperImpl::getDataFactory()
+ {
+ if (!dataFactory)
+ {
+ dataFactory = staticCast<DataFactoryImplPtr>(DataFactory::getDataFactory());
+ }
+ return dataFactory;
+ }
+
+
+ const TypeImpl* XMLHelperImpl::findRoot(DataFactoryImplPtr df,
+ const SDOString& rootElementURI)
+ {
+
+ const TypeImpl* rootTypePtr = df->findTypeImpl(rootElementURI.c_str(),
+ "RootType");
+
+ if (rootTypePtr != 0)
+ {
+ return rootTypePtr;
+ }
+
+ const TypeList& tl = df->getTypes();
+ for (unsigned int i = 0; i < tl.size(); i++)
+ {
+ if (!strcmp("RootType", tl[i].getName()))
+ {
+ return df->findTypeImpl(tl[i].getURI(), "RootType");
+ }
+ }
+ return 0;
+ }
+
+ XMLDocumentPtr XMLHelperImpl::createDocument(const char* elementname,
+ const char* rootElementURI)
+ {
+ if (rootElementURI == 0)
+ {
+ if (elementname == 0)
+ {
+ return createDocument(SDOString(""), SDOString(""));
+ }
+ else
+ {
+ return createDocument(SDOString(elementname), SDOString(""));
+ }
+ }
+ else
+ {
+ if (elementname == 0)
+ {
+ return createDocument(SDOString(""), SDOString(rootElementURI));
+ }
+ else
+ {
+ return createDocument(SDOString(elementname), SDOString(rootElementURI));
+ }
+ }
+ }
+
+
+ XMLDocumentPtr XMLHelperImpl::createDocument(const SDOString& elementname,
+ const SDOString& rootElementURI)
+ {
+ const TypeImpl* rType = findRoot(dataFactory, rootElementURI);
+ if (rType == 0)
+ {
+ std::string msg("createDocument - cannot find element ");
+ msg += elementname;
+ throw SDOUnsupportedOperationException(TUSCANY_SDO_EINFO,
+ msg.c_str());
+ }
+
+ if (elementname.length() != 0)
+ {
+ PropertyImpl* pl = rType->getPropertyImpl(elementname);
+ if (pl == 0)
+ {
+ std::string msg("createDocument - cannot find element ");
+ msg += elementname;
+ throw SDOUnsupportedOperationException(TUSCANY_SDO_EINFO,
+ msg.c_str());
+ }
+
+ const Type& tp = pl->getType();
+ DataObjectPtr dob = dataFactory->create(tp);
+ return new XMLDocumentImpl(dob,
+ tp.getURI(),
+ elementname.c_str());
+ }
+ else
+ {
+ const Property& pl = rType->getProperty((unsigned int)0);
+ const Type& tp = pl.getType();
+ DataObjectPtr dob = dataFactory->create(tp);
+ return new XMLDocumentImpl(dob,
+ tp.getURI(), pl.getName());
+ }
+
+ std::string msg("createDocument - unable to find root type in namespace ");
+ msg += " NULL";
+ throw SDOUnsupportedOperationException(TUSCANY_SDO_EINFO,
+ msg.c_str());
+ }
+
+ XMLDocumentPtr XMLHelperImpl::createDocument(
+ DataObjectPtr dataObject,
+ const char* rootElementURI,
+ const char* rootElementName)
+ {
+ SDOString uri;
+ SDOString name;
+ if (0 == rootElementURI)
+ uri = "";
+ else
+ uri = rootElementURI;
+ if (0 == rootElementName)
+ name = "";
+ else
+ name = rootElementName;
+
+ return createDocument(dataObject, uri, name);
+ }
+ 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,
+ const char* targetNamespaceURI)
+ {
+ DataObjectPtr rootDataObject;
+ clearErrors();
+ SDOSAX2Parser sdoParser(getDataFactory(),
+ targetNamespaceURI,
+ rootDataObject,
+ this);
+ if (sdoParser.parse(xmlFile) == 0)
+ {
+ return createDocument(rootDataObject, (const char*)sdoParser.getRootElementURI(), sdoParser.getRootElementName());
+ }
+ 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, (const char*)sdoParser.getRootElementURI(), sdoParser.getRootElementName());
+ }
+ return 0;
+ }
+
+
+ XMLDocumentPtr XMLHelperImpl::load(
+ std::istream& inXml,
+ const char* targetNamespaceURI)
+ {
+ DataObjectPtr rootDataObject;
+ SDOSAX2Parser sdoParser(getDataFactory(),
+ targetNamespaceURI,
+ rootDataObject,
+ this);
+ clearErrors();
+ inXml>>sdoParser;
+ return createDocument(rootDataObject, (const char*)sdoParser.getRootElementURI(), sdoParser.getRootElementName());
+ }
+
+ 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, (const char*)sdoParser.getRootElementURI(), sdoParser.getRootElementName());
+ }
+
+ XMLDocumentPtr XMLHelperImpl::load(
+ const char* inXml,
+ const char* targetNamespaceURI)
+ {
+ 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,
+ const char* rootElementURI,
+ const char* rootElementName,
+ const char* xmlFile,
+ int indent)
+ {
+ 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
+ void XMLHelperImpl::save(XMLDocumentPtr doc, std::ostream& outXml,
+ int indent)
+ {
+ SDOXMLStreamWriter writer(outXml, dataFactory);
+ writer.write(doc, indent);
+ }
+
+ void XMLHelperImpl::save(
+ DataObjectPtr dataObject,
+ const char* rootElementURI,
+ const char* rootElementName,
+ std::ostream& outXml,
+ int indent )
+ {
+ 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,
+ int indent)
+ {
+ SDOXMLBufferWriter writer(dataFactory);
+ writer.write(doc, indent);
+ 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,
+ 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),
+ indent);
+ }
+
+ unsigned int XMLHelperImpl::getErrorCount() const
+ {
+ return parseErrors.size();
+ }
+
+
+ const char* XMLHelperImpl::getErrorMessage(unsigned 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
diff --git a/sdo-cpp/trunk/runtime/core/src/commonj/sdo/XMLHelperImpl.h b/sdo-cpp/trunk/runtime/core/src/commonj/sdo/XMLHelperImpl.h
new file mode 100644
index 0000000000..dc262c80c7
--- /dev/null
+++ b/sdo-cpp/trunk/runtime/core/src/commonj/sdo/XMLHelperImpl.h
@@ -0,0 +1,184 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you 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$ */
+
+#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/TypeDefinitionsImpl.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 unsigned int getErrorCount() const;
+ virtual const char* getErrorMessage(unsigned 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 createDocument(
+ 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 = "");
+
+ virtual XMLDocumentPtr load(
+ std::istream& inXml,
+ const char* targetNamespaceURI = 0);
+ virtual XMLDocumentPtr load(
+ std::istream& inXml,
+ const SDOString& targetNamespaceURI = "");
+
+ virtual XMLDocumentPtr load(
+ const char* inXml,
+ const char* targetNamespaceURI = 0);
+ virtual XMLDocumentPtr load(
+ const SDOString& inXml,
+ const SDOString& targetNamespaceURI = "");
+
+ 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 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
+ *
+ * save - Serializes the datagraph to a stream
+ */
+
+ void save(XMLDocumentPtr doc, std::ostream& outXml,
+ int indent = -1);
+ void save(
+ DataObjectPtr dataObject,
+ const char* rootElementURI,
+ 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
+ *
+ * save - Serializes the datagraph to a string
+ */
+ char* save(XMLDocumentPtr doc,int indent = -1);
+ char* save(
+ DataObjectPtr dataObject,
+ 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);
+ void clearErrors();
+
+ std::vector<char*> parseErrors;
+
+ // Instance variables
+ DataFactoryImplPtr dataFactory;
+ SDOXMLString targetNamespaceURI;
+
+ const TypeImpl* findRoot(DataFactoryImplPtr df,
+ const SDOString& rootElementURI);
+
+ DataFactoryPtr getDataFactory();
+ };
+
+ } // End - namespace sdo
+} // End - namespace commonj
+
+#endif // _XMLHELPERIMPL_H_
diff --git a/sdo-cpp/trunk/runtime/core/src/commonj/sdo/XMLQName.cpp b/sdo-cpp/trunk/runtime/core/src/commonj/sdo/XMLQName.cpp
new file mode 100644
index 0000000000..9f897a8525
--- /dev/null
+++ b/sdo-cpp/trunk/runtime/core/src/commonj/sdo/XMLQName.cpp
@@ -0,0 +1,86 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you 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$ */
+
+#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
diff --git a/sdo-cpp/trunk/runtime/core/src/commonj/sdo/XMLQName.h b/sdo-cpp/trunk/runtime/core/src/commonj/sdo/XMLQName.h
new file mode 100644
index 0000000000..4efeb15bc5
--- /dev/null
+++ b/sdo-cpp/trunk/runtime/core/src/commonj/sdo/XMLQName.h
@@ -0,0 +1,68 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you 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$ */
+
+#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_
diff --git a/sdo-cpp/trunk/runtime/core/src/commonj/sdo/XSDHelper.cpp b/sdo-cpp/trunk/runtime/core/src/commonj/sdo/XSDHelper.cpp
new file mode 100644
index 0000000000..310716cc8c
--- /dev/null
+++ b/sdo-cpp/trunk/runtime/core/src/commonj/sdo/XSDHelper.cpp
@@ -0,0 +1,37 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you 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$ */
+
+#include "commonj/sdo/XSDHelper.h"
+
+namespace commonj
+{
+ namespace sdo
+ {
+
+
+ XSDHelper::~XSDHelper()
+ {
+ }
+
+
+
+ } // End - namespace sdo
+} // End - namespace commonj
diff --git a/sdo-cpp/trunk/runtime/core/src/commonj/sdo/XSDHelper.h b/sdo-cpp/trunk/runtime/core/src/commonj/sdo/XSDHelper.h
new file mode 100644
index 0000000000..1d9ef01ba6
--- /dev/null
+++ b/sdo-cpp/trunk/runtime/core/src/commonj/sdo/XSDHelper.h
@@ -0,0 +1,139 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you 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$ */
+
+#ifndef _XSDHELPER_H_
+#define _XSDHELPER_H_
+
+
+#include "commonj/sdo/export.h"
+#include "commonj/sdo/RefCountingObject.h"
+#include "commonj/sdo/DataFactory.h"
+#include "commonj/sdo/TypeDefinitions.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* defineFile(const SDOString& schemaFile) = 0;
+ SDO_API virtual const char* define(std::istream& schema) = 0;
+ SDO_API virtual const char* define(const char* schema) = 0;
+ SDO_API virtual const char* define(const SDOString& 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 = "",
+ int indent = -1) = 0;
+ SDO_API virtual char* generate(
+ const TypeList& types,
+ const SDOString& targetNamespaceURI = "",
+ 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 = "",
+ 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 = "",
+ int indent = -1) = 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 unsigned 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(unsigned int errnum) const = 0;
+
+ };
+ }//End - namespace sdo
+} // End - namespace commonj
+
+#endif //_XSDHELPER_H_
diff --git a/sdo-cpp/trunk/runtime/core/src/commonj/sdo/XSDHelperImpl.cpp b/sdo-cpp/trunk/runtime/core/src/commonj/sdo/XSDHelperImpl.cpp
new file mode 100644
index 0000000000..ccd90aa7d6
--- /dev/null
+++ b/sdo-cpp/trunk/runtime/core/src/commonj/sdo/XSDHelperImpl.cpp
@@ -0,0 +1,602 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you 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$ */
+
+#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/SDOXSDFileWriter.h"
+#include "commonj/sdo/SDOXSDStreamWriter.h"
+#include "commonj/sdo/SDOXSDBufferWriter.h"
+#include "commonj/sdo/XSDHelperImpl.h"
+#include "commonj/sdo/XMLDocumentImpl.h"
+#include <iostream>
+#include <fstream>
+#include <sstream>
+#include <libxml/uri.h>
+#include "commonj/sdo/SDOSchemaSAX2Parser.h"
+#include "commonj/sdo/SDOSAX2Parser.h"
+#include "commonj/sdo/XSDPropertyInfo.h"
+#include "commonj/sdo/XSDTypeInfo.h"
+
+#include "commonj/sdo/SDORuntimeException.h"
+#include "commonj/sdo/DASProperty.h"
+#include "commonj/sdo/Logging.h"
+#include "commonj/sdo/Type.h"
+#include "commonj/sdo/SDOUtils.h"
+
+namespace commonj
+{
+ namespace sdo
+ {
+ using internal::XSDPropertyInfo;
+ using internal::PropertyDefinitionImpl;
+ using internal::TypeDefinitionImpl;
+ using internal::XSDTypeInfo;
+ using internal::TypeDefinitions;
+ using internal::TypeDefinitionsImpl;
+ using internal::XmlDasPropertyDefs;
+ using internal::XMLDAS_TypeDefs;
+ using internal::SDOUtils;
+
+ /** XSDHelperImpl
+ *
+ * XSDHelperImpl is the implementation of the abstract class
+ * XSDHelper.
+ * Provides the means of loading and saving XSD information
+ * from/to the metadata (Types and properties)
+ */
+
+ XSDHelperImpl::XSDHelperImpl(DataFactoryPtr df)
+ {
+ dataFactory = staticCast<DataFactoryImplPtr>(df);
+ if (!dataFactory)
+ {
+ dataFactory = staticCast<DataFactoryImplPtr>(DataFactory::getDataFactory());
+ }
+ }
+
+ XSDHelperImpl::~XSDHelperImpl()
+ {
+ clearErrors();
+ }
+
+ /** 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
+ *
+ */
+
+ const char* XSDHelperImpl::defineFile(const char* schema)
+ {
+ clearErrors();
+ SDOSchemaSAX2Parser schemaParser(schemaInfo, this, parsedLocations, definedNamespaces);
+
+ // Build URI allowing for Windows path
+ xmlChar* uri = xmlCanonicPath((xmlChar*)schema);
+ SDOXMLString schemaUri(uri);
+ if (uri)
+ {
+ xmlFree(uri);
+ }
+
+ if (0 != schemaParser.parseURI(schemaUri, SDOXMLString()))
+ return 0;
+ defineTypes(schemaParser.getTypeDefinitions());
+ return schemaInfo.getTargetNamespaceURI();
+ }
+
+ const char* XSDHelperImpl::defineFile(const SDOString& schema)
+ {
+ return defineFile(schema.c_str());
+ }
+
+ const char* XSDHelperImpl::define(std::istream& schema)
+ {
+ SDOSchemaSAX2Parser schemaParser(schemaInfo, this, parsedLocations, definedNamespaces);
+ clearErrors();
+ schema >> schemaParser;
+ defineTypes(schemaParser.getTypeDefinitions());
+ return schemaInfo.getTargetNamespaceURI();
+ }
+
+ const char* XSDHelperImpl::define(const char* schema)
+ {
+ std::istringstream str(schema);
+ SDOSchemaSAX2Parser schemaParser(schemaInfo, this, parsedLocations, definedNamespaces);
+ clearErrors();
+ str >> schemaParser;
+ defineTypes(schemaParser.getTypeDefinitions());
+ return schemaInfo.getTargetNamespaceURI();
+ return define(str);
+ }
+ const char* XSDHelperImpl::define(const SDOString& schema)
+ {
+ std::istringstream str(schema);
+ SDOSchemaSAX2Parser schemaParser(schemaInfo, this, parsedLocations, definedNamespaces);
+ clearErrors();
+ str >> schemaParser;
+ defineTypes(schemaParser.getTypeDefinitions());
+ return schemaInfo.getTargetNamespaceURI();
+ return define(str);
+ }
+
+ void XSDHelperImpl::newSubstitute(const char* entryName,
+ PropertyDefinitionImpl& prop)
+ {
+ try
+ {
+ const char* typeUri = prop.substituteUri.isNull() ?
+ prop.typeUri : prop.substituteUri;
+ const TypeImpl& rootType = dynamic_cast<const TypeImpl&>(dataFactory->getType(typeUri, entryName));
+ const std::vector<PropertyImplPtr>& pl = rootType.getPropertyListReference();
+
+ for (std::vector<PropertyImplPtr>::const_iterator j = pl.begin();
+ j != pl.end();
+ j++)
+ {
+ if (!(*j)->getType().isDataType()
+ && strcmp((*j)->getType().getURI(),SDOUtils::sdoURI))
+ {
+ // recurse the tree..
+ newSubstitute((*j)->getType().getName(), prop);
+
+ if (!strcmp((*j)->getName(), prop.substituteName))
+ {
+ dataFactory->setPropertySubstitute(rootType.getURI(),
+ rootType.getName(),
+ (*j)->getName(),
+ prop.name,
+ typeUri,
+ prop.typeName);
+ XSDPropertyInfo* pi = (XSDPropertyInfo*)
+ ((DASProperty*) getRawPointer(*j))->getDASValue("XMLDAS::PropertyInfo");
+
+ if (pi)
+ {
+ PropertyDefinitionImpl& propdef = (PropertyDefinitionImpl&)pi->getPropertyDefinition();
+ propdef.substituteNames.push_back(prop.name);
+ propdef.substituteLocalNames.push_back(prop.localname);
+ }
+ }
+ }
+ }
+ }
+ catch (const SDORuntimeException&)
+ {
+ }
+ }
+
+ void XSDHelperImpl::addSubstitutes(PropertyDefinitionImpl& prop,
+ TypeDefinitionImpl& ty)
+ {
+ try
+ {
+ const char* typeUri = prop.substituteUri.isNull() ?
+ ty.uri : prop.substituteUri;
+ const TypeImpl* rootType = dataFactory->findTypeImpl(typeUri,"RootType");
+ if (rootType == 0) return;
+
+ const std::vector<PropertyImplPtr>& pl = rootType->getPropertyListReference();
+
+ for (std::vector<PropertyImplPtr>::const_iterator j = pl.begin();
+ j != pl.end();
+ j++)
+ {
+ XSDPropertyInfo* pi = (XSDPropertyInfo*)
+ ((DASProperty*) getRawPointer(*j))->getDASValue("XMLDAS::PropertyInfo");
+
+ if (pi)
+ {
+ PropertyDefinitionImpl& propdef = (PropertyDefinitionImpl&)pi->getPropertyDefinition();
+ if (propdef.isSubstitute && propdef.substituteName.equals(prop.name))
+ {
+
+ LOGINFO_1(INFO,"XSDHelper adding substitute for property %s", (const char*)prop.name);
+
+ dataFactory->setPropertySubstitute(typeUri,ty.name,
+ prop.name, propdef.name,
+ (*j)->getType().getURI(),
+ (*j)->getType().getName());
+ prop.substituteNames.push_back(propdef.name);
+ prop.substituteLocalNames.push_back(propdef.localname);
+ }
+ }
+ }
+ }
+ catch (const SDORuntimeException&)
+ {
+ }
+ }
+
+
+ /** defineTypes
+ *
+ * This method works through all the data gathered during parsing
+ * and defines all the types using the data factory.
+ */
+
+ void XSDHelperImpl::defineTypes(TypeDefinitions& types)
+ {
+ defineTypes(types.getTypeDefinitions());
+ }
+
+
+ /** defineTypes
+ *
+ * This method works through all the data gathered during parsing
+ * and defines all the types using the data factory.
+ */
+
+ void XSDHelperImpl::defineTypes(TypeDefinitionsImpl& typedefs)
+ {
+ XMLDAS_TypeDefs::iterator iter;
+ for (iter=typedefs.types.begin(); iter != typedefs.types.end(); iter++)
+ {
+ TypeDefinitionImpl& ty = iter->second;
+
+ dataFactory->addType((const char*)ty.uri, (const char*)ty.name, ty.isSequenced,
+ ty.isOpen, ty.isAbstract, ty.dataType, ty.isFromList);
+ dataFactory->setDASValue(
+ (const char*)ty.uri, (const char*)ty.name,
+ "XMLDAS::TypeInfo",
+ new XSDTypeInfo(ty));
+
+ // add aliases
+ if (!ty.aliases.isNull())
+ {
+ SDOXMLString al = ty.aliases;
+ SDOXMLString al1 = "";
+ int index;
+ while (!al.isNull() && !al.equals(""))
+ {
+ index = al.lastIndexOf(' ');
+ if (index < 0)
+ {
+ al1 = al;
+ al = "";
+ }
+ else
+ {
+ al1 = al.substring(index + 1);
+ al = al.substring(0,index);
+ }
+ if (!al1.isNull() && !al1.equals(""))
+ {
+ dataFactory->setAlias(
+ ty.uri,
+ ty.name,
+ (const char*)al1);
+ }
+ }
+ }
+ }
+ for (iter=typedefs.types.begin(); iter != typedefs.types.end(); iter++)
+ {
+ TypeDefinitionImpl& ty = iter->second;
+ if (!ty.parentTypeName.isNull())
+ {
+ dataFactory->setBaseType(
+ (const char*)ty.uri,
+ (const char*)ty.name,
+ (const char*)ty.parentTypeUri,
+ (const char*)ty.parentTypeName,
+ ty.isRestriction);
+ }
+
+ XmlDasPropertyDefs::iterator propsIter;
+ for (propsIter = ty.properties.begin(); propsIter != ty.properties.end(); propsIter++)
+ {
+ PropertyDefinitionImpl& prop = *propsIter;
+
+ // For a refence we need to determine the type from the
+ // global element declaration
+ if(prop.isReference)
+ {
+
+ bool refFound = false;
+
+ if (prop.name.isNull())
+ prop.name = prop.typeName;
+
+
+ XMLDAS_TypeDefs::iterator refTypeIter =
+ typedefs.types.find(TypeDefinitionsImpl::getTypeQName(prop.typeUri, "RootType"));
+ if(refTypeIter != typedefs.types.end())
+ {
+
+ TypeDefinitionImpl& rootTy = refTypeIter->second;
+
+ // find the property on the root type
+ XmlDasPropertyDefs::iterator refPropsIter;
+ for (refPropsIter = rootTy.properties.begin(); refPropsIter != rootTy.properties.end(); refPropsIter++)
+ {
+
+ if (refPropsIter->localname.equals(prop.typeName))
+ {
+ prop.typeUri = refPropsIter->typeUri;
+ prop.typeName = refPropsIter->typeName;
+ refFound = true;
+ }
+ }
+ }
+ if (!refFound)
+ {
+
+ // Check if this type is already defined to the data factory
+ const TypeImpl* rootType = dataFactory->findTypeImpl(prop.typeUri, "RootType");
+
+ if (rootType) {
+ const std::vector<PropertyImplPtr> pl =
+ rootType->getPropertyListReference();
+
+ for (std::vector<PropertyImplPtr>::const_iterator j = pl.begin();
+ j != pl.end();
+ j++)
+ {
+
+ XSDPropertyInfo* pi = (XSDPropertyInfo*)
+ ((DASProperty*) getRawPointer(*j))->getDASValue("XMLDAS::PropertyInfo");
+
+ if (prop.typeName.equals((*j)->getName())
+ || (pi && prop.typeName.equals(pi->getPropertyDefinition().localname)))
+ {
+ prop.typeUri = (*j)->getType().getURI();
+ prop.typeName = (*j)->getType().getName();
+ refFound = true;
+ break;
+ }
+ }
+ }
+ }
+ // If we haven't been able to resolve this reference we should ignore it
+ if (!refFound)
+ {
+ LOGINFO_1(INFO,"XsdHelper:no matching reference for %s",
+ (const char *)prop.name);
+ continue;
+ }
+ }
+
+ if (prop.name.isNull())
+ {
+ continue;
+ }
+ XMLDAS_TypeDefs::iterator propTypeIter =
+ typedefs.types.find(TypeDefinitionsImpl::getTypeQName(prop.typeUri, prop.typeName));
+ if(propTypeIter != typedefs.types.end())
+ {
+ prop.typeName = propTypeIter->second.name;
+ }
+
+ dataFactory->addPropertyToType(
+ (const char*)ty.uri,
+ (const char*)ty.name,
+ (const char*)prop.name,
+ (const char*)prop.typeUri,
+ (const char*)prop.typeName,
+ prop.isMany,
+ prop.isReadOnly,
+ prop.isContainment);
+
+ LOGINFO_1(INFO,"XSDHelper adds property %s",(const char*)(prop.name));
+
+ if (!prop.aliases.isNull())
+ {
+ SDOXMLString al = prop.aliases;
+ SDOXMLString al1 = "";
+ int index;
+ while (!al.isNull() && !al.equals(""))
+ {
+ index = al.lastIndexOf(' ');
+ if (index < 0)
+ {
+ al1 = al;
+ al = "";
+ }
+ else
+ {
+ al1 = al.substring(index + 1);
+ al = al.substring(0,index);
+ }
+ if (!al1.isNull() && !al1.equals(""))
+ {
+ dataFactory->setAlias(
+ (const char*)ty.uri,
+ (const char*)ty.name,
+ (const char*)prop.name,
+ (const char*)al1);
+ }
+ }
+ }
+ if (prop.isSubstitute)
+ {
+ // we have a new substitute - so will check the existing graph for
+ // substitutions to insert
+
+ LOGINFO_1(INFO,"XSDHelper: Found new substitute %s",(const char*)(prop.name));
+
+ newSubstitute( "RootType",prop);
+ }
+ else
+ {
+ // subtitutes can only reference global types
+ if (ty.name.equals("RootType"))
+ {
+ addSubstitutes(prop,ty);
+ }
+ }
+
+ // Do not add DASValue to ChangeSummary
+ if (!(prop.typeUri.equals(SDOUtils::sdoURI)
+ && prop.typeName.equals("ChangeSummary")))
+ {
+ dataFactory->setDASValue(
+ ty.uri,
+ ty.name,
+ prop.name,
+ "XMLDAS::PropertyInfo",
+ new XSDPropertyInfo(prop));
+ }
+ } // for
+ } // for
+
+ // The addition of the new types was succesful so adding these
+ // types to the defined types should succeed (no duplicates)
+ definedTypes.getTypeDefinitions().addTypeDefinitions(typedefs);
+
+ } // End - defineTypes
+
+ /** getDataFactory returns the factory
+ *
+ */
+
+ DataFactoryPtr XSDHelperImpl::getDataFactory()
+ {
+ return dataFactory;
+ }
+
+
+ /** generate buildsXSD from types/properties
+ *
+ * generate/generateFile
+ *
+ * Saves the types/properties to an XSD stream or file
+ *
+ */
+
+ void XSDHelperImpl::generateFile(
+ const TypeList& types,
+ const char* fileName,
+ const char* targetNamespaceURI,
+ int indent
+ )
+ {
+ SDOXSDFileWriter writer(fileName);
+ writer.write(types, targetNamespaceURI,
+ dataFactory->getOpenProperties(), indent);
+ }
+ void XSDHelperImpl::generateFile(
+ const TypeList& types,
+ const SDOString& fileName,
+ const SDOString& targetNamespaceURI,
+ int indent
+ )
+ {
+ SDOXSDFileWriter writer(fileName.c_str());
+ writer.write(types, targetNamespaceURI.c_str(),
+ dataFactory->getOpenProperties(), indent);
+ }
+
+ void XSDHelperImpl::generate(
+ const TypeList& types,
+ std::ostream& outXml,
+ const char* targetNamespaceURI,
+ int indent
+ )
+ {
+ SDOXSDStreamWriter writer(outXml);
+ writer.write(types, targetNamespaceURI,
+ dataFactory->getOpenProperties(), indent);
+ }
+ void XSDHelperImpl::generate(
+ const TypeList& types,
+ std::ostream& outXml,
+ const SDOString& targetNamespaceURI,
+ int indent
+ )
+ {
+ SDOXSDStreamWriter writer(outXml);
+ writer.write(types, targetNamespaceURI.c_str(),
+ dataFactory->getOpenProperties(), indent);
+ }
+
+ char* XSDHelperImpl::generate(
+ const TypeList& types,
+ const char* targetNamespaceURI,
+ int indent
+ )
+ {
+ SDOXSDBufferWriter writer;
+ writer.write(types, targetNamespaceURI,
+ dataFactory->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;
+ writer.write(types, targetNamespaceURI.c_str(),
+ dataFactory->getOpenProperties(), indent);
+ SDOXMLString ret = writer.getBuffer();
+ char* retString = new char[strlen(ret) +1];
+ strcpy(retString, ret);
+ return retString;
+ }
+
+ unsigned int XSDHelperImpl::getErrorCount() const
+ {
+ return parseErrors.size();
+ }
+
+
+ const char* XSDHelperImpl::getErrorMessage(unsigned int errnum) const
+ {
+ if (errnum >= 0 && errnum < parseErrors.size())
+ {
+ return parseErrors[errnum];
+ }
+ return 0;
+ }
+
+ void XSDHelperImpl::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 XSDHelperImpl::clearErrors()
+ {
+ while (!parseErrors.empty())
+ {
+ if (*parseErrors.begin() != 0)
+ {
+ delete[] (char*)(*parseErrors.begin());
+ }
+ parseErrors.erase(parseErrors.begin());
+ }
+ }
+
+
+ } // End - namespace sdo
+} // End - namespace commonj
diff --git a/sdo-cpp/trunk/runtime/core/src/commonj/sdo/XSDHelperImpl.h b/sdo-cpp/trunk/runtime/core/src/commonj/sdo/XSDHelperImpl.h
new file mode 100644
index 0000000000..d8cd86a447
--- /dev/null
+++ b/sdo-cpp/trunk/runtime/core/src/commonj/sdo/XSDHelperImpl.h
@@ -0,0 +1,172 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you 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$ */
+
+#ifndef _XSDHELPERIMPL_H_
+#define _XSDHELPERIMPL_H_
+
+#include "commonj/sdo/disable_warn.h"
+
+#include "commonj/sdo/XSDHelper.h"
+#include "commonj/sdo/export.h"
+#include "commonj/sdo/SAX2Namespaces.h"
+#include "commonj/sdo/SchemaInfo.h"
+#include "commonj/sdo/TypeDefinitionsImpl.h"
+#include "commonj/sdo/ParserErrorSetter.h"
+#include "commonj/sdo/SDOSchemaSAX2Parser.h"
+
+namespace commonj
+{
+ namespace sdo
+ {
+
+ /**
+ *
+ * XSDHelperImpl is the implementation of the abstract class
+ * XSDHelper.
+ * Provides the means of loading and saving XSD information
+ * from/to the metadata (Types and properties)
+ */
+
+ class XSDHelperImpl : public XSDHelper, ParserErrorSetter
+ {
+ public:
+
+ // Constructor
+ XSDHelperImpl(DataFactoryPtr dataFactory);
+
+ // Destructor
+ virtual ~XSDHelperImpl();
+
+ /** 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
+ *
+ */
+ virtual const char* defineFile(const char* schemaFile);
+ virtual const char* defineFile(const SDOString& schemaFile);
+ virtual const char* define(std::istream& schema);
+ virtual const char* define(const char* schema);
+ virtual const char* define(const SDOString& schema);
+
+ /** 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 unsigned int getErrorCount() const;
+
+ /** 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(unsigned int errnum) const;
+ virtual void setError(const char* error);
+
+ /** generate buildsXSD from types/properties
+ *
+ * generate/generateFile
+ *
+ * Saves the types/properties to an XSD stream or file
+ *
+ */
+
+ virtual char* generate(
+ const TypeList& types,
+ const char* targetNamespaceURI = "",
+ int indent = -1
+ );
+ virtual char* generate(
+ const TypeList& types,
+ const SDOString& targetNamespaceURI = "",
+ 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 = "",
+ 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 = "",
+ int indent = -1);
+
+ virtual DataFactoryPtr getDataFactory();
+
+ // Return the URI for the root Type
+ virtual const char* getRootTypeURI()
+ {
+ return schemaInfo.getTargetNamespaceURI();
+ }
+
+ virtual void defineTypes(internal::TypeDefinitions& types);
+
+ virtual internal::TypeDefinitions& getDefinedTypes() {return definedTypes;}
+
+ private:
+
+ virtual void clearErrors();
+
+ void newSubstitute(const char* entryName,
+ internal::PropertyDefinitionImpl& prop);
+
+ void addSubstitutes(internal::PropertyDefinitionImpl& prop,
+ internal::TypeDefinitionImpl& ty);
+
+ void defineTypes(internal::TypeDefinitionsImpl& types);
+ int parse(const char* source);
+
+ // Instance variables
+ DataFactoryImplPtr dataFactory; // metadata
+ SchemaInfo schemaInfo;
+
+ std::vector<char*> parseErrors;
+
+ internal::TypeDefinitions definedTypes;
+ SDOSchemaSAX2Parser::PARSED_LOCATIONS parsedLocations;
+
+ SDOSchemaSAX2Parser::DEFINED_NAMESPACES definedNamespaces;
+ };
+
+ } // End - namespace sdo
+} // End - namespace commonj
+
+#endif // _XSDHELPERIMPL_H_
diff --git a/sdo-cpp/trunk/runtime/core/src/commonj/sdo/XSDPropertyInfo.cpp b/sdo-cpp/trunk/runtime/core/src/commonj/sdo/XSDPropertyInfo.cpp
new file mode 100644
index 0000000000..76b198890f
--- /dev/null
+++ b/sdo-cpp/trunk/runtime/core/src/commonj/sdo/XSDPropertyInfo.cpp
@@ -0,0 +1,56 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you 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$ */
+
+#include "commonj/sdo/XSDPropertyInfo.h"
+
+namespace commonj
+{
+ namespace sdo
+ {
+ namespace internal
+ {
+
+ /**
+ * Internal Helper Class
+ * This holds a property definition during the parsing process
+ * when all properties need to be read and stored prior to creation
+ * within the data facttory.
+ */
+
+ XSDPropertyInfo::XSDPropertyInfo()
+ {
+ }
+
+ XSDPropertyInfo::XSDPropertyInfo(const PropertyDefinitionImpl& prop)
+ : property(prop)
+ {
+ }
+
+ XSDPropertyInfo::~XSDPropertyInfo()
+ {
+ }
+
+
+ } // end namespace internal
+ } // end namespace sdo
+} // end namespace commonj
+
+
diff --git a/sdo-cpp/trunk/runtime/core/src/commonj/sdo/XSDPropertyInfo.h b/sdo-cpp/trunk/runtime/core/src/commonj/sdo/XSDPropertyInfo.h
new file mode 100644
index 0000000000..3425c085a4
--- /dev/null
+++ b/sdo-cpp/trunk/runtime/core/src/commonj/sdo/XSDPropertyInfo.h
@@ -0,0 +1,66 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you 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$ */
+
+#ifndef _XSDPropertyInfo_H_
+#define _XSDPropertyInfo_H_
+
+#include "commonj/sdo/disable_warn.h"
+
+#include "commonj/sdo/DASValue.h"
+#include "commonj/sdo/PropertyDefinitionImpl.h"
+#include "commonj/sdo/SDOXMLString.h"
+
+namespace commonj
+{
+ namespace sdo
+ {
+ namespace internal
+ {
+
+ /**
+ * Internal Helper Class
+ * This holds a property definition during the parsing process.
+ * This holds a property definition during the parsing process
+ * when all properties need to be read and stored prior to creation
+ * within the data facttory.
+ */
+
+ class XSDPropertyInfo : public DASValue
+ {
+ public:
+
+ XSDPropertyInfo();
+ XSDPropertyInfo(const PropertyDefinitionImpl& prop);
+
+ virtual ~XSDPropertyInfo();
+
+ const PropertyDefinitionImpl& getPropertyDefinition() {return property;}
+
+
+ private:
+ PropertyDefinitionImpl property;
+ };
+ } // end namespace internal
+ } // end namespace sdo
+} // end namespace commonj
+#endif //_XSDPropertyInfo_H_
+
+
diff --git a/sdo-cpp/trunk/runtime/core/src/commonj/sdo/XSDTypeInfo.cpp b/sdo-cpp/trunk/runtime/core/src/commonj/sdo/XSDTypeInfo.cpp
new file mode 100644
index 0000000000..aea1b7eaca
--- /dev/null
+++ b/sdo-cpp/trunk/runtime/core/src/commonj/sdo/XSDTypeInfo.cpp
@@ -0,0 +1,55 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you 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$ */
+
+#include "commonj/sdo/XSDTypeInfo.h"
+
+namespace commonj
+{
+ namespace sdo
+ {
+ namespace internal
+ {
+
+ /** XSDTypeInfo
+ *
+ * This holds a type definition during the parsing process
+ * when all types need to be read and stored prior to creation
+ * within the data facttory.
+ */
+
+ XSDTypeInfo::XSDTypeInfo()
+ {
+ }
+
+ XSDTypeInfo::XSDTypeInfo(const internal::TypeDefinitionImpl& typeDef)
+ : typeDefinition(typeDef)
+ {
+ }
+
+
+ XSDTypeInfo::~XSDTypeInfo()
+ {
+ }
+ } // end namespace internal
+ } // end namespace sdo
+} // end namespace commonj
+
+
diff --git a/sdo-cpp/trunk/runtime/core/src/commonj/sdo/XSDTypeInfo.h b/sdo-cpp/trunk/runtime/core/src/commonj/sdo/XSDTypeInfo.h
new file mode 100644
index 0000000000..49e795f2fa
--- /dev/null
+++ b/sdo-cpp/trunk/runtime/core/src/commonj/sdo/XSDTypeInfo.h
@@ -0,0 +1,59 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you 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$ */
+
+#ifndef _XSDTypeInfo_H_
+#define _XSDTypeInfo_H_
+
+#include "commonj/sdo/disable_warn.h"
+
+#include "commonj/sdo/DASValue.h"
+#include "commonj/sdo/TypeDefinitionImpl.h"
+
+namespace commonj
+{
+ namespace sdo
+ {
+ namespace internal
+ {
+ /**
+ * Internal Helper Class
+ * This holds a type definition during the parsing process
+ * when all types need to be read and stored prior to creation
+ * within the data factory.
+ */
+
+ class XSDTypeInfo : public DASValue
+ {
+ public:
+ XSDTypeInfo();
+ XSDTypeInfo(const TypeDefinitionImpl& typeDef);
+ virtual ~XSDTypeInfo();
+ const TypeDefinitionImpl& getTypeDefinition() {return typeDefinition;}
+
+ private:
+ TypeDefinitionImpl typeDefinition;
+ };
+ } // end namespace internal
+ } // end namespace sdo
+} // end namespace commonj
+#endif //_XSDTypeInfo_H_
+
+
diff --git a/sdo-cpp/trunk/runtime/core/src/commonj/sdo/XpathHelper.cpp b/sdo-cpp/trunk/runtime/core/src/commonj/sdo/XpathHelper.cpp
new file mode 100644
index 0000000000..de5aff341b
--- /dev/null
+++ b/sdo-cpp/trunk/runtime/core/src/commonj/sdo/XpathHelper.cpp
@@ -0,0 +1,88 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you 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$ */
+
+#include "commonj/sdo/XpathHelper.h"
+
+#include <string.h>
+using std::string;
+
+namespace commonj{
+namespace sdo{
+
+/**
+ *
+ * will provide utilities to help with xpath parsing
+ */
+
+/** isIndexed - true if [] or .
+ *
+ * Returns true if the path has an index, indicating a many valued
+ * property at the end of the path.
+ */
+
+
+const bool XpathHelper::isIndexed(const char* path)
+{
+ if (path == 0)
+ {
+ return false;
+ }
+ else
+ {
+ return isIndexed(SDOString(path));
+ }
+}
+
+const bool XpathHelper::isIndexed(const SDOString& path)
+{
+ size_t lastSlash = path.rfind('/');
+
+ if (lastSlash == string::npos)
+ {
+ // Search from start of path
+ if (path.find('[') != string::npos)
+ {
+ return true;
+ }
+ if (path.find('.') != string::npos)
+ {
+ return true;
+ }
+ }
+ else
+ {
+ // Search from lastSlash
+ if (path.find('[', lastSlash) != string::npos)
+ {
+ return true;
+ }
+ if (path.find('.', lastSlash) != string::npos)
+ {
+ return true;
+ }
+ }
+
+ return false;
+}
+
+};
+};
+
diff --git a/sdo-cpp/trunk/runtime/core/src/commonj/sdo/XpathHelper.h b/sdo-cpp/trunk/runtime/core/src/commonj/sdo/XpathHelper.h
new file mode 100644
index 0000000000..1e02ea1dd3
--- /dev/null
+++ b/sdo-cpp/trunk/runtime/core/src/commonj/sdo/XpathHelper.h
@@ -0,0 +1,57 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you 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$ */
+
+#ifndef XPATH_HELPER_H
+#define XPATH_HELPER_H
+
+#include "commonj/sdo/export.h"
+#include "commonj/sdo/SDOString.h"
+
+namespace commonj{
+namespace sdo{
+
+/**
+ *
+ * XpathHelper provides utilities to help with xpath parsing
+ */
+
+class XpathHelper
+{
+ public:
+
+ virtual ~XpathHelper();
+
+ /** isIndexed - true if [] or .
+ *
+ * Returns true if the path has an index, indicating a many valued
+ * property at the end of the path.
+ */
+
+ static SDO_API const bool isIndexed(const char * path);
+ static SDO_API const bool isIndexed(const SDOString& path);
+
+};
+};
+};
+
+
+#endif
+
diff --git a/sdo-cpp/trunk/runtime/core/src/commonj/sdo/disable_warn.h b/sdo-cpp/trunk/runtime/core/src/commonj/sdo/disable_warn.h
new file mode 100644
index 0000000000..b02bb5bd81
--- /dev/null
+++ b/sdo-cpp/trunk/runtime/core/src/commonj/sdo/disable_warn.h
@@ -0,0 +1,29 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you 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$ */
+
+#ifndef _DISABLE_WARN_H_
+#define _DISABLE_WARN_H_
+
+#if defined(WIN32) || defined (_WINDOWS)
+#pragma warning(disable: 4786)
+#endif
+
+#endif
diff --git a/sdo-cpp/trunk/runtime/core/src/commonj/sdo/export.h b/sdo-cpp/trunk/runtime/core/src/commonj/sdo/export.h
new file mode 100644
index 0000000000..6247e19847
--- /dev/null
+++ b/sdo-cpp/trunk/runtime/core/src/commonj/sdo/export.h
@@ -0,0 +1,51 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you 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$ */
+
+#define SDO4CPP_VERSION 20051202
+
+#if defined(WIN32) || defined (_WINDOWS)
+
+#ifndef int64_t
+ #define int64_t __int64
+#endif
+
+#ifdef SDO_EXPORTS
+#include "commonj/sdo/disable_warn.h"
+# define SDO_API __declspec(dllexport)
+# define SDO_SPI __declspec(dllexport)
+# define EXPIMP
+#else
+# define SDO_API __declspec(dllimport)
+# define SDO_SPI __declspec(dllimport)
+# define EXPIMP extern
+#endif
+
+#else
+#include <sys/time.h>
+#include <inttypes.h>
+#include <stdlib.h>
+#include <string.h>
+#include <wchar.h>
+# define SDO_API
+# define SDO_SPI
+# define EXPIMP
+#endif
+
diff --git a/sdo-cpp/trunk/runtime/core/src/deploy.bat b/sdo-cpp/trunk/runtime/core/src/deploy.bat
new file mode 100644
index 0000000000..5fce6399e5
--- /dev/null
+++ b/sdo-cpp/trunk/runtime/core/src/deploy.bat
@@ -0,0 +1,58 @@
+@echo off
+
+@REM Licensed to the Apache Software Foundation (ASF) under one
+@REM or more contributor license agreements. See the NOTICE file
+@REM distributed with this work for additional information
+@REM regarding copyright ownership. The ASF licenses this file
+@REM to you under the Apache License, Version 2.0 (the
+@REM "License"); you may not use this file except in compliance
+@REM with the License. You may obtain a copy of the License at
+@REM
+@REM http://www.apache.org/licenses/LICENSE-2.0
+@REM
+@REM Unless required by applicable law or agreed to in writing,
+@REM software distributed under the License is distributed on an
+@REM "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+@REM KIND, either express or implied. See the License for the
+@REM specific language governing permissions and limitations
+@REM under the License.
+
+
+setlocal
+
+if . == .%1 (
+echo sdo root not specified
+goto usage
+)
+set deploydir=%1\deploy
+set srcdir=%1\runtime\core\src
+
+if . == .%2 (
+echo input directory not specified
+goto usage
+)
+set inpath=%2
+echo %inpath%
+
+
+if not exist %deploydir% mkdir %deploydir%
+if not exist %deploydir%\bin mkdir %deploydir%\bin
+if not exist %deploydir%\lib mkdir %deploydir%\lib
+if not exist %deploydir%\include mkdir %deploydir%\include
+if not exist %deploydir%\include\commonj mkdir %deploydir%\include\commonj
+if not exist %deploydir%\include\commonj\sdo mkdir %deploydir%\include\commonj\sdo
+
+
+copy %srcdir%\commonj\sdo\*.h %deploydir%\include\commonj\sdo
+
+copy %inpath%\tuscany_sdo.lib %deploydir%\lib
+copy %inpath%\tuscany_sdo.dll %deploydir%\bin
+
+if exist %inpath%\tuscany_sdo.pdb copy %inpath%\tuscany_sdo.pdb %deploydir%\bin
+
+goto end
+:usage
+echo Usage: deploy <sdo-root> <build-output>
+:end
+
+endlocal
diff --git a/sdo-cpp/trunk/runtime/core/test/.cdtbuild b/sdo-cpp/trunk/runtime/core/test/.cdtbuild
new file mode 100644
index 0000000000..17ebd43324
--- /dev/null
+++ b/sdo-cpp/trunk/runtime/core/test/.cdtbuild
@@ -0,0 +1,59 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<?fileVersion 3.0.0?>
+
+<ManagedProjectBuildInfo>
+<project id="tuscany_sdo_test.cdt.managedbuild.target.gnu.exe.841259234" name="Executable (Gnu)" projectType="cdt.managedbuild.target.gnu.exe">
+<configuration artifactName="tuscany_sdo_test" cleanCommand="rm -rf" description="" errorParsers="org.eclipse.cdt.core.MakeErrorParser;org.eclipse.cdt.core.GCCErrorParser;org.eclipse.cdt.core.GLDErrorParser;org.eclipse.cdt.core.GASErrorParser" id="cdt.managedbuild.config.gnu.exe.debug.1698024418" name="Debug" parent="cdt.managedbuild.config.gnu.exe.debug">
+<toolChain id="cdt.managedbuild.toolchain.gnu.exe.debug.953243590" name="GCC Tool Chain" superClass="cdt.managedbuild.toolchain.gnu.exe.debug">
+<tool command="gcc" id="cdt.managedbuild.tool.gnu.c.compiler.exe.debug.907958268" name="GCC C Compiler" superClass="cdt.managedbuild.tool.gnu.c.compiler.exe.debug"/>
+<tool command="g++" id="cdt.managedbuild.tool.gnu.cpp.compiler.exe.debug.829396762" name="GCC C++ Compiler" superClass="cdt.managedbuild.tool.gnu.cpp.compiler.exe.debug">
+<option id="gnu.cpp.compiler.option.preprocessor.def.1484983546" superClass="gnu.cpp.compiler.option.preprocessor.def" valueType="definedSymbols">
+<listOptionValue builtIn="false" value="_DEBUG"/>
+</option>
+<option id="gnu.cpp.compiler.option.include.paths.1537573101" superClass="gnu.cpp.compiler.option.include.paths" valueType="includePath">
+<listOptionValue builtIn="false" value="${project_loc}"/>
+<listOptionValue builtIn="false" value="${project_loc}/../src"/>
+</option>
+</tool>
+<tool command="gcc" id="cdt.managedbuild.tool.gnu.c.linker.exe.debug.1017750405" name="GCC C Linker" superClass="cdt.managedbuild.tool.gnu.c.linker.exe.debug"/>
+<tool command="g++" id="cdt.managedbuild.tool.gnu.cpp.linker.exe.debug.655773583" name="GCC C++ Linker" superClass="cdt.managedbuild.tool.gnu.cpp.linker.exe.debug">
+<option id="gnu.cpp.link.option.libs.684950781" superClass="gnu.cpp.link.option.libs" valueType="libs">
+<listOptionValue builtIn="false" value="tuscany_sdo"/>
+<listOptionValue builtIn="false" value="xml2"/>
+</option>
+<option id="gnu.cpp.link.option.paths.507838253" superClass="gnu.cpp.link.option.paths" valueType="stringList">
+<listOptionValue builtIn="false" value="${project_loc}/../src/Debug"/>
+<listOptionValue builtIn="false" value="${LIBXML2_LIB}"/>
+</option>
+</tool>
+<tool command="as" id="cdt.managedbuild.tool.gnu.assembler.exe.debug.680127870" name="GCC Assembler" superClass="cdt.managedbuild.tool.gnu.assembler.exe.debug"/>
+<macros/>
+</toolChain>
+</configuration>
+<configuration artifactName="tuscany_sdo_test" cleanCommand="rm -rf" description="" errorParsers="org.eclipse.cdt.core.MakeErrorParser;org.eclipse.cdt.core.GCCErrorParser;org.eclipse.cdt.core.GLDErrorParser;org.eclipse.cdt.core.GASErrorParser" id="cdt.managedbuild.config.gnu.exe.release.1720042110" name="Release" parent="cdt.managedbuild.config.gnu.exe.release">
+<toolChain id="cdt.managedbuild.toolchain.gnu.exe.release.1008721532" name="GCC Tool Chain" superClass="cdt.managedbuild.toolchain.gnu.exe.release">
+<tool command="gcc" id="cdt.managedbuild.tool.gnu.c.compiler.exe.release.1386443308" name="GCC C Compiler" superClass="cdt.managedbuild.tool.gnu.c.compiler.exe.release"/>
+<tool command="g++" id="cdt.managedbuild.tool.gnu.cpp.compiler.exe.release.666703052" name="GCC C++ Compiler" superClass="cdt.managedbuild.tool.gnu.cpp.compiler.exe.release">
+<option id="gnu.cpp.compiler.option.include.paths.1488475926" superClass="gnu.cpp.compiler.option.include.paths" valueType="includePath">
+<listOptionValue builtIn="false" value="${project_loc}/../src"/>
+<listOptionValue builtIn="false" value="${project_loc}"/>
+</option>
+</tool>
+<tool command="gcc" id="cdt.managedbuild.tool.gnu.c.linker.exe.release.87016949" name="GCC C Linker" superClass="cdt.managedbuild.tool.gnu.c.linker.exe.release"/>
+<tool command="g++" id="cdt.managedbuild.tool.gnu.cpp.linker.exe.release.4247100" name="GCC C++ Linker" superClass="cdt.managedbuild.tool.gnu.cpp.linker.exe.release">
+<option id="gnu.cpp.link.option.libs.73989122" superClass="gnu.cpp.link.option.libs" valueType="libs">
+<listOptionValue builtIn="false" value="xml2"/>
+<listOptionValue builtIn="false" value="tuscany_sdo"/>
+</option>
+<option id="gnu.cpp.link.option.paths.984022714" superClass="gnu.cpp.link.option.paths" valueType="stringList">
+<listOptionValue builtIn="false" value="${project_loc}/../src/Debug"/>
+<listOptionValue builtIn="false" value="${LIBXML2_LIB}"/>
+</option>
+</tool>
+<tool command="as" id="cdt.managedbuild.tool.gnu.assembler.exe.release.937369355" name="GCC Assembler" superClass="cdt.managedbuild.tool.gnu.assembler.exe.release"/>
+<macros/>
+</toolChain>
+</configuration>
+<macros/>
+</project>
+</ManagedProjectBuildInfo>
diff --git a/sdo-cpp/trunk/runtime/core/test/.settings/org.eclipse.cdt.managedbuilder.core.prefs b/sdo-cpp/trunk/runtime/core/test/.settings/org.eclipse.cdt.managedbuilder.core.prefs
new file mode 100644
index 0000000000..0c77f0af0f
--- /dev/null
+++ b/sdo-cpp/trunk/runtime/core/test/.settings/org.eclipse.cdt.managedbuilder.core.prefs
@@ -0,0 +1,9 @@
+#Wed Feb 15 16:37:24 GMT 2006
+eclipse.preferences.version=1
+environment/buildEnvironmentInclude/cdt.managedbuild.config.gnu.exe.debug.1698024418=<?xml version\="1.0" encoding\="UTF-8"?>\n<environment>\n<variable name\="CPATH" operation\="remove"/>\n<variable name\="CPLUS_INCLUDE_PATH" operation\="remove"/>\n</environment>\n
+environment/buildEnvironmentInclude/cdt.managedbuild.config.gnu.exe.release.1720042110=<?xml version\="1.0" encoding\="UTF-8"?>\n<environment>\n<variable name\="CPATH" operation\="remove"/>\n<variable name\="CPLUS_INCLUDE_PATH" operation\="remove"/>\n</environment>\n
+environment/buildEnvironmentLibrary/cdt.managedbuild.config.gnu.exe.debug.1698024418=<?xml version\="1.0" encoding\="UTF-8"?>\n<environment>\n<variable name\="LIBRARY_PATH" operation\="remove"/>\n</environment>\n
+environment/buildEnvironmentLibrary/cdt.managedbuild.config.gnu.exe.release.1720042110=<?xml version\="1.0" encoding\="UTF-8"?>\n<environment>\n<variable name\="LIBRARY_PATH" operation\="remove"/>\n</environment>\n
+environment/project=<?xml version\="1.0" encoding\="UTF-8"?>\n<environment/>\n
+environment/project/cdt.managedbuild.config.gnu.exe.debug.1698024418=<?xml version\="1.0" encoding\="UTF-8"?>\n<environment>\n<variable delimiter\="" name\="LIBXML2_LIB" operation\="replace" value\="/usr/lib"/>\n</environment>\n
+environment/project/cdt.managedbuild.config.gnu.exe.release.1720042110=<?xml version\="1.0" encoding\="UTF-8"?>\n<environment>\n<variable delimiter\="" name\="LIBXML2_LIB" operation\="replace" value\="/usr/lib"/>\n</environment>\n
diff --git a/sdo-cpp/trunk/runtime/core/test/47293Catalog.xml b/sdo-cpp/trunk/runtime/core/test/47293Catalog.xml
new file mode 100644
index 0000000000..43f4e46e1b
--- /dev/null
+++ b/sdo-cpp/trunk/runtime/core/test/47293Catalog.xml
@@ -0,0 +1,22 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ Licensed to the Apache Software Foundation (ASF) under one
+ or more contributor license agreements. See the NOTICE file
+ distributed with this work for additional information
+ regarding copyright ownership. The ASF licenses this file
+ to you 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.
+-->
+
+
+<catalog xmlns="catalogNS" xsi:type="CatalogType" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"><item xmlns="orderNS"><itemId>1</itemId><description>A Partridge in a Pear Tree</description><price>1.99</price><quantity>0</quantity><warehouseId>1</warehouseId></item><item><itemId>2</itemId><description>Turtle Doves</description><price>2.99</price><quantity>0</quantity><warehouseId>1</warehouseId></item><item><itemId>3</itemId><description>French Hens</description><price>3.99</price><quantity>0</quantity><warehouseId>1</warehouseId></item><item><itemId>4</itemId><description>Calling Birds</description><price>4.99</price><quantity>0</quantity><warehouseId>1</warehouseId></item><item><itemId>5</itemId><description>Golden Rings</description><price>5.99</price><quantity>0</quantity><warehouseId>1</warehouseId></item><item><itemId>6</itemId><description>Geese a-laying</description><price>6.99</price><quantity>0</quantity><warehouseId>1</warehouseId></item><item><itemId>7</itemId><description>Swans a-swimming</description><price>7.99</price><quantity>0</quantity><warehouseId>1</warehouseId></item><item><itemId>8</itemId><description>Maids a-milking</description><price>8.99</price><quantity>0</quantity><warehouseId>1</warehouseId></item><item><itemId>9</itemId><description>Ladies dancing</description><price>9.99</price><quantity>0</quantity><warehouseId>1</warehouseId></item><item><itemId>10</itemId><description>Lords a-leaping</description><price>10.99</price><quantity>0</quantity><warehouseId>1</warehouseId></item><item><itemId>11</itemId><description>Pipers piping</description><price>11.99</price><quantity>0</quantity><warehouseId>1</warehouseId></item><item><itemId>12</itemId><description>Drummers drumming</description><price>12.99</price><quantity>0</quantity><warehouseId>1</warehouseId></item></catalog>
diff --git a/sdo-cpp/trunk/runtime/core/test/47293Catalog.xsd b/sdo-cpp/trunk/runtime/core/test/47293Catalog.xsd
new file mode 100644
index 0000000000..f8f1cb9d47
--- /dev/null
+++ b/sdo-cpp/trunk/runtime/core/test/47293Catalog.xsd
@@ -0,0 +1,35 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ Licensed to the Apache Software Foundation (ASF) under one
+ or more contributor license agreements. See the NOTICE file
+ distributed with this work for additional information
+ regarding copyright ownership. The ASF licenses this file
+ to you 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.
+-->
+
+
+<schema xmlns="http://www.w3.org/2001/XMLSchema"
+ xmlns:cat="catalogNS" xmlns:ord="orderNS" targetNamespace="catalogNS">
+
+ <include schemaLocation="Order.xsd"/>
+
+ <element name="catalog" type="cat:CatalogType"/>
+
+ <complexType name="CatalogType">
+ <sequence>
+ <element maxOccurs="unbounded" ref="ord:item"/>
+ </sequence>
+ </complexType>
+
+</schema>
diff --git a/sdo-cpp/trunk/runtime/core/test/47293Customer.xsd b/sdo-cpp/trunk/runtime/core/test/47293Customer.xsd
new file mode 100644
index 0000000000..948dd07e85
--- /dev/null
+++ b/sdo-cpp/trunk/runtime/core/test/47293Customer.xsd
@@ -0,0 +1,50 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ Licensed to the Apache Software Foundation (ASF) under one
+ or more contributor license agreements. See the NOTICE file
+ distributed with this work for additional information
+ regarding copyright ownership. The ASF licenses this file
+ to you 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.
+-->
+
+<schema xmlns="http://www.w3.org/2001/XMLSchema"
+ xmlns:cust="customerNS" targetNamespace="customerNS">
+ <element name="customer" type="cust:CustomerType">
+ <complexType name="CustomerType">
+ <sequence>
+ <element name="customerId" type="ID"/>
+ <element name="name" type="string"/>
+ <element name="shipping" type="cust:AddressType">
+ <complexType name="AddressType">
+ <element name="street" type="string"/>
+ <element name="city" type="string"/>
+ <element name="state" type="string"/>
+ <element name="zip" type="string"/>
+ </complexType>
+ </element>
+ <element name="payment" ref="cust:payment"/>
+ </sequence>
+ </complexType>
+ </element>
+
+ <element name="payment" type="cust:PaymentType">
+ <complexType name="PaymentType">
+ <element name="paymentId" type="ID"/>
+ <element name="accountNo" type="string"/>
+ <element name="bank" type="string"/>
+ <element name="securityCode" type="string"/>
+ <element name="amount" type="string"/>
+ </complexType>
+ </element>
+</schema>
diff --git a/sdo-cpp/trunk/runtime/core/test/47293Order.xsd b/sdo-cpp/trunk/runtime/core/test/47293Order.xsd
new file mode 100644
index 0000000000..b11fce2e60
--- /dev/null
+++ b/sdo-cpp/trunk/runtime/core/test/47293Order.xsd
@@ -0,0 +1,67 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ Licensed to the Apache Software Foundation (ASF) under one
+ or more contributor license agreements. See the NOTICE file
+ distributed with this work for additional information
+ regarding copyright ownership. The ASF licenses this file
+ to you 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.
+-->
+
+
+<schema xmlns="http://www.w3.org/2001/XMLSchema"
+xmlns:ord="orderNS" xmlns:cust="customerNS" targetNamespace="orderNS">
+
+ <include schemaLocation="./Customer.xsd"/>
+
+ <element name="orders" type="ord:OrdersType">
+ <complexType name="OrdersType">
+ <sequence>
+ <element name="order" maxOccurs="unbounded" type="ord:OrderType"/>
+ </sequence>
+ </complexType>
+ </element>
+
+ <element name="order" type="ord:OrderType">
+ <complexType name="OrderType">
+ <sequence>
+ <element name="orderId" type="ID"/>
+ <element name="status" type="ord:OrderStatus"/>
+ <element name="item" maxOccurs="unbounded" ref="ord:item"/>
+ <element ref="cust:customer"/>
+ </sequence>
+ </complexType>
+ </element>
+
+ <element name="item">
+ <complexType>
+ <element name="itemId" type="integer"/>
+ <element name="description" type="string"/>
+ <element name="price" type="string"/>
+ <element name="quantity" type="integer"/>
+ <element name="warehouseId" type="integer"/>
+ </complexType>
+ </element>
+
+ <simpleType name="OrderStatus">
+ <restriction base="string">
+ <enumeration value="NONE"/>
+ <enumeration value="RECEIVED"/>
+ <enumeration value="INVOICED"/>
+ <enumeration value="DISPATCHED"/>
+ <enumeration value="COMPLETED"/>
+ <enumeration value="CANCELLED"/>
+ </restriction>
+ </simpleType>
+
+</schema>
diff --git a/sdo-cpp/trunk/runtime/core/test/48601.xsd b/sdo-cpp/trunk/runtime/core/test/48601.xsd
new file mode 100644
index 0000000000..9e0b117520
--- /dev/null
+++ b/sdo-cpp/trunk/runtime/core/test/48601.xsd
@@ -0,0 +1,46 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ Licensed to the Apache Software Foundation (ASF) under one
+ or more contributor license agreements. See the NOTICE file
+ distributed with this work for additional information
+ regarding copyright ownership. The ASF licenses this file
+ to you 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.
+-->
+
+
+<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema">
+
+<xs:complexType name="product">
+ <xs:sequence>
+ <xs:element name="brand" type="xs:string"/>
+ <xs:element name="size" type="available_sizes"/>
+ </xs:sequence>
+</xs:complexType>
+
+<xs:simpleType name='available_sizes'>
+ <xs:union>
+ <xs:simpleType>
+ <xs:restriction base='nonNegativeInteger'/>
+ </xs:simpleType>
+ <xs:simpleType>
+ <xs:restriction base='string'>
+ <xs:enumeration value='large'/>
+ <xs:enumeration value='small'/>
+ </xs:restriction>
+ </xs:simpleType>
+ </xs:union>
+</xs:simpleType>
+
+</xs:schema>
+
diff --git a/sdo-cpp/trunk/runtime/core/test/48686.xml b/sdo-cpp/trunk/runtime/core/test/48686.xml
new file mode 100644
index 0000000000..0197503c98
--- /dev/null
+++ b/sdo-cpp/trunk/runtime/core/test/48686.xml
@@ -0,0 +1,31 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ Licensed to the Apache Software Foundation (ASF) under one
+ or more contributor license agreements. See the NOTICE file
+ distributed with this work for additional information
+ regarding copyright ownership. The ASF licenses this file
+ to you 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.
+-->
+
+
+<name
+ xmlns="http://www.wrox.com/name"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchem-Instance"
+ xsi:schemaLocation="http://www.wrox.com/name name.xsd">
+ <first>John</first>
+ <middle>Fitzgerald</middle>
+ <last>Doe</last>
+ <ages>1 2 3</ages>
+</name>
+
diff --git a/sdo-cpp/trunk/runtime/core/test/48686.xsd b/sdo-cpp/trunk/runtime/core/test/48686.xsd
new file mode 100644
index 0000000000..45678b9a30
--- /dev/null
+++ b/sdo-cpp/trunk/runtime/core/test/48686.xsd
@@ -0,0 +1,42 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ Licensed to the Apache Software Foundation (ASF) under one
+ or more contributor license agreements. See the NOTICE file
+ distributed with this work for additional information
+ regarding copyright ownership. The ASF licenses this file
+ to you 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.
+-->
+
+
+<schema xmlns="http://www.w3.org/2001/XMLSchema"
+ targetNamespace="http://www.wrox.com/name"
+ xmlns:tns="http://www.wrox.com/name">
+
+ <element name="name">
+ <complexType>
+ <sequence>
+ <element name="first" type="string"/>
+ <element name="middle" type="string"/>
+ <element name="last" type="string"/>
+ <element name="ages">
+ <simpleType>
+ <list itemType="positiveInteger"/>
+ </simpleType>
+ </element>
+ </sequence>
+ </complexType>
+ </element>
+
+
+</schema>
diff --git a/sdo-cpp/trunk/runtime/core/test/48736.xml b/sdo-cpp/trunk/runtime/core/test/48736.xml
new file mode 100644
index 0000000000..97ab07c448
--- /dev/null
+++ b/sdo-cpp/trunk/runtime/core/test/48736.xml
@@ -0,0 +1,30 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ Licensed to the Apache Software Foundation (ASF) under one
+ or more contributor license agreements. See the NOTICE file
+ distributed with this work for additional information
+ regarding copyright ownership. The ASF licenses this file
+ to you 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.
+-->
+
+<formalname
+ xmlns="TNS"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchem-Instance"
+ xsi:schemaLocation="http://www.wrox.com/name name.xsd"
+ title="Mr.">
+ <last>Doe</last>
+</formalname>
+
+
+
diff --git a/sdo-cpp/trunk/runtime/core/test/48736.xsd b/sdo-cpp/trunk/runtime/core/test/48736.xsd
new file mode 100644
index 0000000000..fa2bf9ef75
--- /dev/null
+++ b/sdo-cpp/trunk/runtime/core/test/48736.xsd
@@ -0,0 +1,49 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ Licensed to the Apache Software Foundation (ASF) under one
+ or more contributor license agreements. See the NOTICE file
+ distributed with this work for additional information
+ regarding copyright ownership. The ASF licenses this file
+ to you 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.
+-->
+
+<schema xmlns="http://www.w3.org/2001/XMLSchema"
+ targetNamespace="TNS"
+ xmlns:tns="TNS">
+
+ <complexType name="FormalNameType">
+ <complexContent>
+ <restriction base="tns:NameType">
+ <sequence>
+ <element ref="tns:last"/>
+ </sequence>
+ </restriction>
+ </complexContent>
+ </complexType>
+
+
+ <complexType name="NameType">
+ <sequence>
+ <element name="first" type="string"/>
+ <element name="middle" type="string"/>
+ <element name="last" type="string"/>
+ </sequence>
+ <attribute name="title" type="string"/>
+ </complexType>
+
+ <element name="formalname" type="tns:FormalNameType"/>
+ <element name="last" type="string"/>
+
+</schema>
+
diff --git a/sdo-cpp/trunk/runtime/core/test/48736_xml.txt b/sdo-cpp/trunk/runtime/core/test/48736_xml.txt
new file mode 100644
index 0000000000..479204717b
--- /dev/null
+++ b/sdo-cpp/trunk/runtime/core/test/48736_xml.txt
@@ -0,0 +1,42 @@
+***** TYPES AFTER RESOLVE*********************************
+Type:TNS#FormalNameType
+Property:first of type String
+Property:middle of type String
+Property:last of type String
+Property:title of type String
+Type:TNS#NameType
+Property:first of type String
+Property:middle of type String
+Property:last of type String
+Property:title of type String
+Type:TNS#RootType
+Property:formalname of type FormalNameType
+Property:last of type String
+Type:commonj.sdo#Boolean
+Type:commonj.sdo#Byte
+Type:commonj.sdo#Bytes
+Type:commonj.sdo#ChangeSummary
+Type:commonj.sdo#Character
+Type:commonj.sdo#DataObject
+Type:commonj.sdo#Date
+Type:commonj.sdo#Decimal
+Type:commonj.sdo#Double
+Type:commonj.sdo#Float
+Type:commonj.sdo#Int
+Type:commonj.sdo#Integer
+Type:commonj.sdo#Long
+Type:commonj.sdo#OpenDataObject
+Type:commonj.sdo#Short
+Type:commonj.sdo#String
+Type:commonj.sdo#URI
+*******************************END TYPES******************
+===== DataObject contents =====
+first:string:
+
+middle:string:
+
+last:string:Doe
+
+title:string:Mr.
+
+===== End DataObject =====
diff --git a/sdo-cpp/trunk/runtime/core/test/48736_xsd.txt b/sdo-cpp/trunk/runtime/core/test/48736_xsd.txt
new file mode 100644
index 0000000000..82d969aed9
--- /dev/null
+++ b/sdo-cpp/trunk/runtime/core/test/48736_xsd.txt
@@ -0,0 +1,29 @@
+***** TYPES BEFORE RESOLVE **********************************
+Type:TNS#FormalNameType
+Property:last of type String
+Type:TNS#NameType
+Property:first of type String
+Property:middle of type String
+Property:last of type String
+Property:title of type String
+Type:TNS#RootType
+Property:formalname of type FormalNameType
+Property:last of type String
+Type:commonj.sdo#Boolean
+Type:commonj.sdo#Byte
+Type:commonj.sdo#Bytes
+Type:commonj.sdo#ChangeSummary
+Type:commonj.sdo#Character
+Type:commonj.sdo#DataObject
+Type:commonj.sdo#Date
+Type:commonj.sdo#Decimal
+Type:commonj.sdo#Double
+Type:commonj.sdo#Float
+Type:commonj.sdo#Int
+Type:commonj.sdo#Integer
+Type:commonj.sdo#Long
+Type:commonj.sdo#OpenDataObject
+Type:commonj.sdo#Short
+Type:commonj.sdo#String
+Type:commonj.sdo#URI
+*******************************END TYPES******************
diff --git a/sdo-cpp/trunk/runtime/core/test/Atom1.0.xsd b/sdo-cpp/trunk/runtime/core/test/Atom1.0.xsd
new file mode 100644
index 0000000000..a421b56c69
--- /dev/null
+++ b/sdo-cpp/trunk/runtime/core/test/Atom1.0.xsd
@@ -0,0 +1,205 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ Licensed to the Apache Software Foundation (ASF) under one
+ or more contributor license agreements. See the NOTICE file
+ distributed with this work for additional information
+ regarding copyright ownership. The ASF licenses this file
+ to you 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.
+-->
+
+<xs:schema targetNamespace="http://www.w3.org/2005/Atom"
+ xmlns="http://www.w3.org/2005/Atom" xmlns:xs="http://www.w3.org/2001/XMLSchema">
+
+ <xs:import namespace="http://www.w3.org/XML/1998/namespace" schemaLocation="xml.xsd" />
+ <xs:import namespace="http://www.w3.org/1999/xhtml" schemaLocation="xhtml1.xsd" />
+
+ <xs:element name="feed" type="feedType"/>
+ <xs:element name="entry" type="entryType"/>
+
+ <xs:complexType name="feedType">
+ <xs:complexContent>
+ <xs:extension base="sourceType">
+ <xs:sequence>
+ <xs:element name="entry" type="entryType" minOccurs="0" maxOccurs="unbounded" />
+ </xs:sequence>
+ <xs:attributeGroup ref="commonAttributes" />
+ </xs:extension>
+ </xs:complexContent>
+ </xs:complexType>
+
+ <xs:complexType name="entryType">
+ <xs:choice maxOccurs="unbounded">
+ <xs:element name="author" type="personConstruct" minOccurs="0" maxOccurs="unbounded" />
+ <xs:element name="category" type="categoryType" minOccurs="0" maxOccurs="unbounded" />
+ <xs:element name="content" type="contentType" minOccurs="0" />
+ <xs:element name="contributor" type="personConstruct" minOccurs="0" maxOccurs="unbounded" />
+ <xs:element name="id" type="idType" />
+ <xs:element name="link" type="linkType" minOccurs="0" maxOccurs="unbounded" />
+ <xs:element name="published" type="dateConstruct" minOccurs="0" />
+ <xs:element name="rights" type="textConstruct" minOccurs="0" />
+ <xs:element name="source" type="sourceType" minOccurs="0" />
+ <xs:element name="summary" type="textConstruct" maxOccurs="0" />
+ <xs:element name="title" type="textConstruct" />
+ <xs:element name="updated" type="dateConstruct" />
+ <xs:element name="extension" type="extensionType" minOccurs="0" maxOccurs="unbounded" />
+ </xs:choice>
+ <xs:attributeGroup ref="commonAttributes"/>
+ </xs:complexType>
+
+ <xs:complexType name="sourceType">
+ <xs:choice maxOccurs="unbounded">
+ <xs:element name="author" type="personConstruct" minOccurs="0" maxOccurs="unbounded" />
+ <xs:element name="category" type="categoryType" minOccurs="0" maxOccurs="unbounded" />
+ <xs:element name="contributor" type="personConstruct" minOccurs="0" maxOccurs="unbounded" />
+ <xs:element name="generator" type="generatorType" minOccurs="0" />
+ <xs:element name="icon" type="iconType" minOccurs="0" />
+ <xs:element name="id" type="idType" />
+ <xs:element name="link" type="linkType" minOccurs="0" maxOccurs="unbounded" />
+ <xs:element name="logo" type="logoType" minOccurs="0" />
+ <xs:element name="rights" type="textConstruct" minOccurs="0" />
+ <xs:element name="subtitle" type="textConstruct" minOccurs="0" />
+ <xs:element name="title" type="textConstruct" />
+ <xs:element name="updated" type="dateConstruct" />
+ <xs:element name="extension" type="extensionType" minOccurs="0" maxOccurs="unbounded" />
+ </xs:choice>
+ </xs:complexType>
+
+ <xs:complexType name="personConstruct">
+ <xs:choice maxOccurs="unbounded">
+ <xs:element name="name" type="xs:string" />
+ <xs:element name="uri" type="uriType" minOccurs="0" />
+ <xs:element name="email" type="emailType" minOccurs="0" />
+ <xs:element name="extension" type="extensionType" minOccurs="0" maxOccurs="unbounded" />
+ </xs:choice>
+ </xs:complexType>
+
+ <xs:complexType name="categoryType">
+ <xs:simpleContent>
+ <xs:extension base="xs:string">
+ <xs:attribute name="term" type="xs:string" use="required" />
+ <xs:attribute name="scheme" type="uriType" />
+ <xs:attribute name="label" type="xs:string" />
+ <xs:attributeGroup ref="commonAttributes"/>
+ </xs:extension>
+ </xs:simpleContent>
+ <!-- TODO: undefinedContent - beyond string? -->
+ </xs:complexType>
+
+ <xs:complexType name="generatorType">
+ <xs:simpleContent>
+ <xs:extension base="xs:string">
+ <xs:attribute name="uri" type="uriType" />
+ <xs:attribute name="version" type="xs:string" />
+ <xs:attributeGroup ref="commonAttributes"/>
+ </xs:extension>
+ </xs:simpleContent>
+ </xs:complexType>
+
+ <xs:complexType name="iconType">
+ <xs:simpleContent>
+ <xs:extension base="xs:string">
+ <xs:attributeGroup ref="commonAttributes"/>
+ </xs:extension>
+ </xs:simpleContent>
+ </xs:complexType>
+
+ <xs:complexType name="idType">
+ <xs:simpleContent>
+ <xs:extension base="uriType">
+ <xs:attributeGroup ref="commonAttributes"/>
+ </xs:extension>
+ </xs:simpleContent>
+ </xs:complexType>
+
+ <xs:complexType name="logoType">
+ <xs:simpleContent>
+ <xs:extension base="uriType">
+ <xs:attributeGroup ref="commonAttributes"/>
+ </xs:extension>
+ </xs:simpleContent>
+ </xs:complexType>
+
+ <xs:complexType name="contentType" mixed="true">
+ <xs:sequence>
+ <xs:any namespace="##other" processContents="lax" minOccurs="0" maxOccurs="unbounded" />
+ </xs:sequence>
+ <xs:attribute name="type" type="xs:string" />
+ <xs:attribute name="src" type="uriType" minOccurs="0" />
+ <xs:attributeGroup ref="commonAttributes"/>
+ </xs:complexType>
+
+ <xs:complexType name="linkType">
+ <xs:simpleContent>
+ <xs:extension base="xs:string">
+ <xs:attribute name="href" type="uriType" use="required" />
+ <xs:attribute name="rel" type="uriType" /> <!-- { atomNCName | atomUri }? -->
+ <xs:attribute name="type" type="mediaType" />
+ <xs:attribute name="hreflang" type="languageTagType" />
+ <xs:attribute name="title" type="xs:string" />
+ <xs:attribute name="length" type="xs:string" />
+ <xs:attributeGroup ref="commonAttributes"/>
+ </xs:extension>
+ </xs:simpleContent>
+ </xs:complexType>
+
+ <xs:simpleType name="languageTagType">
+ <xs:restriction base="xs:string">
+ <xs:pattern value="[A-Za-z]{1,8}(-[A-Za-z0-9]{1,8})*" />
+ </xs:restriction>
+ </xs:simpleType>
+
+ <xs:simpleType name="mediaType">
+ <xs:restriction base="xs:string">
+ <xs:pattern value=".+/.+" />
+ </xs:restriction>
+ </xs:simpleType>
+
+ <xs:simpleType name="emailType">
+ <xs:restriction base="xs:string">
+ <xs:pattern value=".+@.+" />
+ </xs:restriction>
+ </xs:simpleType>
+
+ <xs:complexType name="textConstruct" mixed="true">
+ <xs:sequence>
+ <xs:any namespace="##other" processContents="lax" minOccurs="0" maxOccurs="unbounded" />
+ </xs:sequence>
+ <xs:attribute name="type" type="xs:string" />
+ <xs:attributeGroup ref="commonAttributes"/>
+ </xs:complexType>
+
+ <xs:complexType name="dateConstruct">
+ <xs:simpleContent>
+ <xs:extension base="xs:dateTime">
+ <xs:attributeGroup ref="commonAttributes"/>
+ </xs:extension>
+ </xs:simpleContent>
+ </xs:complexType>
+
+ <xs:simpleType name="uriType" type="xs:string" />
+
+ <xs:complexType name="extensionType" mixed="true">
+ <xs:sequence>
+ <xs:any namespace="##other" processContents="lax" minOccurs="0" maxOccurs="unbounded" />
+ </xs:sequence>
+ <xs:anyAttribute />
+ </xs:complexType>
+
+ <xs:attributeGroup name="commonAttributes">
+ <xs:attribute ref="xml:base" />
+ <xs:attribute ref="xml:lang" />
+ <xs:anyAttribute/>
+ </xs:attributeGroup>
+
+</xs:schema> \ No newline at end of file
diff --git a/sdo-cpp/trunk/runtime/core/test/BadElement.xml b/sdo-cpp/trunk/runtime/core/test/BadElement.xml
new file mode 100644
index 0000000000..180b050bf5
--- /dev/null
+++ b/sdo-cpp/trunk/runtime/core/test/BadElement.xml
@@ -0,0 +1,29 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ Licensed to the Apache Software Foundation (ASF) under one
+ or more contributor license agreements. See the NOTICE file
+ distributed with this work for additional information
+ regarding copyright ownership. The ASF licenses this file
+ to you 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.
+-->
+
+
+<Holiday xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:noNamespaceSchemaLocation="TravelBookingSchema.xsd">
+ <Flight flightNo="BA243">
+ <Departure>NCE</Departure>
+ <Arrival>PAR</Arrival>
+ <ThisJustAintPartOfTheSchema>DATA</ThisJustAintPartOfTheSchema>
+ </Flight>
+</Holiday>
diff --git a/sdo-cpp/trunk/runtime/core/test/BadElement.xsd b/sdo-cpp/trunk/runtime/core/test/BadElement.xsd
new file mode 100644
index 0000000000..dd1f296a3a
--- /dev/null
+++ b/sdo-cpp/trunk/runtime/core/test/BadElement.xsd
@@ -0,0 +1,102 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ Licensed to the Apache Software Foundation (ASF) under one
+ or more contributor license agreements. See the NOTICE file
+ distributed with this work for additional information
+ regarding copyright ownership. The ASF licenses this file
+ to you 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.
+-->
+
+<xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema">
+
+ <xsd:element name="Holiday">
+ <xsd:complexType>
+ <xsd:sequence>
+ <xsd:element ref="Flight" maxOccurs="unbounded" minOccurs="1"/>
+ <xsd:element ref="Hotel" maxOccurs="unbounded" minOccurs="1"/>
+ <xsd:element ref="Excursion"/>
+ <xsd:element ref="Client"/>
+ <xsd:element ref="Party"/>
+ </xsd:sequence>
+ </xsd:complexType>
+ </xsd:element>
+
+ <xsd:element name="Flight">
+ <xsd:complexType>
+ <xsd:sequence>
+ <xsd:element name="Departure" type="xsd:string"/>
+ <xsd:element name="Arrival" type="xsd:string"/>
+ </xsd:sequence>
+ <xsd:attribute name="flightNo" type="xsd:string" use="required"/>
+ </xsd:complexType>
+ </xsd:element>
+
+ <xsd:element name="Hotel">
+ <xsd:complexType>
+ <xsd:sequence>
+ <xsd:element ref="Name"/>
+ <xsd:element name="Phone" type="xsd:string"/>
+ <xsd:element ref="Room"/>
+ </xsd:sequence>
+ <xsd:attribute name="cardsAccepted" default="false" type="xsd:boolean"/>
+ </xsd:complexType>
+ </xsd:element>
+
+ <xsd:element name="Room">
+ <xsd:complexType>
+ <xsd:simpleContent>
+ <xsd:extension base="xsd:string">
+ <xsd:attribute name="booked" use="required" type="xsd:boolean"/>
+ </xsd:extension>
+ </xsd:simpleContent>
+ </xsd:complexType>
+ </xsd:element>
+
+ <xsd:element name="Party">
+ <xsd:complexType>
+ <xsd:sequence>
+ <xsd:element ref="Person" maxOccurs="unbounded" minOccurs="1"/>
+ </xsd:sequence>
+ </xsd:complexType>
+ </xsd:element>
+
+ <xsd:element name="Person">
+ <xsd:complexType>
+ <xsd:sequence>
+ <xsd:element ref="Name"/>
+ </xsd:sequence>
+ </xsd:complexType>
+ </xsd:element>
+
+ <xsd:element name="Client">
+ <xsd:complexType>
+ <xsd:sequence>
+ <xsd:element ref="Name"/>
+ <xsd:element name="Address" type="xsd:string"/>
+ <xsd:element name="CreditCard" type="xsd:string"/>
+ </xsd:sequence>
+ </xsd:complexType>
+ </xsd:element>
+
+ <xsd:element name="Excursion">
+ <xsd:complexType>
+ <xsd:sequence>
+ <xsd:element name="Title" type="xsd:string"/>
+ <xsd:element name="Cost" type="xsd:string"/>
+ </xsd:sequence>
+ </xsd:complexType>
+ </xsd:element>
+
+ <xsd:element name="Name" type="xsd:string"/>
+</xsd:schema>
diff --git a/sdo-cpp/trunk/runtime/core/test/Catalog.xsd b/sdo-cpp/trunk/runtime/core/test/Catalog.xsd
new file mode 100644
index 0000000000..2c3708285a
--- /dev/null
+++ b/sdo-cpp/trunk/runtime/core/test/Catalog.xsd
@@ -0,0 +1,34 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ Licensed to the Apache Software Foundation (ASF) under one
+ or more contributor license agreements. See the NOTICE file
+ distributed with this work for additional information
+ regarding copyright ownership. The ASF licenses this file
+ to you 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.
+-->
+
+<schema xmlns="http://www.w3.org/2001/XMLSchema"
+ xmlns:cat="catalogNS" targetNamespace="catalogNS">
+
+ <include schemaLocation="./Order.xsd"/>
+
+ <element name="catalog" type="cat:CatalogType"/>
+
+ <complexType name="CatalogType">
+ <sequence>
+ <element maxOccurs="unbounded" ref="ord:item"/>
+ </sequence>
+ </complexType>
+
+</schema>
diff --git a/sdo-cpp/trunk/runtime/core/test/Customer.xsd b/sdo-cpp/trunk/runtime/core/test/Customer.xsd
new file mode 100644
index 0000000000..1f21545592
--- /dev/null
+++ b/sdo-cpp/trunk/runtime/core/test/Customer.xsd
@@ -0,0 +1,47 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ Licensed to the Apache Software Foundation (ASF) under one
+ or more contributor license agreements. See the NOTICE file
+ distributed with this work for additional information
+ regarding copyright ownership. The ASF licenses this file
+ to you 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.
+-->
+
+<schema xmlns="http://www.w3.org/2001/XMLSchema"
+ xmlns:cust="customerNS" targetNamespace="customerNS">
+ <element name="customer" type="cust:CustomerType">
+ <complexType name="CustomerType">
+ <sequence>
+ <element name="customerId" type="ID"/>
+ <element name="name" type="string"/>
+ <element name="shipping" type="cust:AddressType">
+ <complexType name="AddressType">
+ <element name="street" type="string"/>
+ <element name="city" type="string"/>
+ <element name="state" type="string"/>
+ <element name="zip" type="string"/>
+ </complexType>
+ </element>
+ <element name="payment" type="cust:PaymentType">
+ <complexType name="PaymentType">
+ <element name="accountNo" type="string"/>
+ <element name="bank" type="string"/>
+ <element name="securityCode" type="string"/>
+ <element name="amount" type="float"/>
+ </complexType>
+ </element>
+ </sequence>
+ </complexType>
+ </element>
+</schema>
diff --git a/sdo-cpp/trunk/runtime/core/test/Makefile.am b/sdo-cpp/trunk/runtime/core/test/Makefile.am
new file mode 100644
index 0000000000..09994c5d5e
--- /dev/null
+++ b/sdo-cpp/trunk/runtime/core/test/Makefile.am
@@ -0,0 +1,32 @@
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements. See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership. The ASF licenses this file
+# to you 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.
+
+noinst_PROGRAMS = tuscany_sdo_test
+SUBDIRS =
+TESTS=tuscany_sdo_test
+tuscany_sdo_test_SOURCES = sdotest.cpp sdotest2.cpp utils.cpp main.cpp
+
+EXTRA_DIST = *.xsd *.xml *.txt *.wsdl test/*.* test2/*.* t2/*.* g/*.* bugs/1/*.*
+noinst_HEADERS=sdotest.h
+
+tuscany_sdo_test_LDADD = \
+ -L$(top_builddir)/runtime/core/src/commonj/sdo -ltuscany_sdo \
+ -L${LIBXML2_LIB} -lxml2
+
+
+INCLUDES = -I$(top_builddir)/runtime/core/test \
+ -I$(top_builddir)/runtime/core/src
diff --git a/sdo-cpp/trunk/runtime/core/test/OddChars.xml b/sdo-cpp/trunk/runtime/core/test/OddChars.xml
new file mode 100644
index 0000000000..d7b95510ad
--- /dev/null
+++ b/sdo-cpp/trunk/runtime/core/test/OddChars.xml
@@ -0,0 +1,27 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ Licensed to the Apache Software Foundation (ASF) under one
+ or more contributor license agreements. See the NOTICE file
+ distributed with this work for additional information
+ regarding copyright ownership. The ASF licenses this file
+ to you 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.
+-->
+
+<Holiday xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:noNamespaceSchemaLocation="TravelBookingSchema.xsd">
+ <Flight flightNo="BA243">
+ <Departure>ÇüéâäàåçêëèïîìÄÅÉæÆôöòûùÿÖÜø£Ø׃áíóúñѪº¿®¬½¼¡«»░▒▓│┤ÁÂÀ©╣║╗╝¢¥┐└┴┬├─┼ãÃ╚╔╔╩╦╠═╬¤ðÐÊËÈıÍÎÎÏ┘┌█▄¦Ì▀ÓßÔÒõÕµþÞÚÛÙýݯ´­±‗¾¶§÷¸°¨·¹³²■ </Departure>
+ <Arrival>Pound:£ Dollar:$ Euro:Ç or █</Arrival>
+ </Flight>
+</Holiday>
diff --git a/sdo-cpp/trunk/runtime/core/test/OddChars.xsd b/sdo-cpp/trunk/runtime/core/test/OddChars.xsd
new file mode 100644
index 0000000000..2f2d53c5a8
--- /dev/null
+++ b/sdo-cpp/trunk/runtime/core/test/OddChars.xsd
@@ -0,0 +1,103 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ Licensed to the Apache Software Foundation (ASF) under one
+ or more contributor license agreements. See the NOTICE file
+ distributed with this work for additional information
+ regarding copyright ownership. The ASF licenses this file
+ to you 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.
+-->
+
+
+<xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema">
+
+ <xsd:element name="Holiday">
+ <xsd:complexType>
+ <xsd:sequence>
+ <xsd:element ref="Flight" maxOccurs="unbounded" minOccurs="1"/>
+ <xsd:element ref="Hotel" maxOccurs="unbounded" minOccurs="1"/>
+ <xsd:element ref="Excursion"/>
+ <xsd:element ref="Client"/>
+ <xsd:element ref="Party"/>
+ </xsd:sequence>
+ </xsd:complexType>
+ </xsd:element>
+
+ <xsd:element name="Flight">
+ <xsd:complexType>
+ <xsd:sequence>
+ <xsd:element name="Departure" type="xsd:string"/>
+ <xsd:element name="Arrival" type="xsd:string"/>
+ </xsd:sequence>
+ <xsd:attribute name="flightNo" type="xsd:string" use="required"/>
+ </xsd:complexType>
+ </xsd:element>
+
+ <xsd:element name="Hotel">
+ <xsd:complexType>
+ <xsd:sequence>
+ <xsd:element ref="Name"/>
+ <xsd:element name="Phone" type="xsd:string"/>
+ <xsd:element ref="Room"/>
+ </xsd:sequence>
+ <xsd:attribute name="cardsAccepted" default="false" type="xsd:boolean"/>
+ </xsd:complexType>
+ </xsd:element>
+
+ <xsd:element name="Room">
+ <xsd:complexType>
+ <xsd:simpleContent>
+ <xsd:extension base="xsd:string">
+ <xsd:attribute name="booked" use="required" type="xsd:boolean"/>
+ </xsd:extension>
+ </xsd:simpleContent>
+ </xsd:complexType>
+ </xsd:element>
+
+ <xsd:element name="Party">
+ <xsd:complexType>
+ <xsd:sequence>
+ <xsd:element ref="Person" maxOccurs="unbounded" minOccurs="1"/>
+ </xsd:sequence>
+ </xsd:complexType>
+ </xsd:element>
+
+ <xsd:element name="Person">
+ <xsd:complexType>
+ <xsd:sequence>
+ <xsd:element ref="Name"/>
+ </xsd:sequence>
+ </xsd:complexType>
+ </xsd:element>
+
+ <xsd:element name="Client">
+ <xsd:complexType>
+ <xsd:sequence>
+ <xsd:element ref="Name"/>
+ <xsd:element name="Address" type="xsd:string"/>
+ <xsd:element name="CreditCard" type="xsd:string"/>
+ </xsd:sequence>
+ </xsd:complexType>
+ </xsd:element>
+
+ <xsd:element name="Excursion">
+ <xsd:complexType>
+ <xsd:sequence>
+ <xsd:element name="Title" type="xsd:string"/>
+ <xsd:element name="Cost" type="xsd:string"/>
+ </xsd:sequence>
+ </xsd:complexType>
+ </xsd:element>
+
+ <xsd:element name="Name" type="xsd:string"/>
+</xsd:schema>
diff --git a/sdo-cpp/trunk/runtime/core/test/Order.xsd b/sdo-cpp/trunk/runtime/core/test/Order.xsd
new file mode 100644
index 0000000000..d87f690236
--- /dev/null
+++ b/sdo-cpp/trunk/runtime/core/test/Order.xsd
@@ -0,0 +1,59 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ Licensed to the Apache Software Foundation (ASF) under one
+ or more contributor license agreements. See the NOTICE file
+ distributed with this work for additional information
+ regarding copyright ownership. The ASF licenses this file
+ to you 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.
+-->
+
+
+<schema xmlns="http://www.w3.org/2001/XMLSchema"
+xmlns:ord="orderNS" xmlns:cust="customerNS" targetNamespace="orderNS">
+
+<include schemaLocation="./Customer.xsd"/>
+
+<element name="order" type="ord:OrderType">
+ <complexType name="OrderType">
+ <sequence>
+ <element name="orderId" type="ID"/>
+ <element name="status" type="ord:OrderStatus"/>
+ <element name="item" maxOccurs="unbounded" ref="ord:item"/>
+ <element ref="cust:customer"/>
+ </sequence>
+ </complexType>
+ </element>
+
+ <element name="item">
+ <complexType>
+ <element name="itemId" type="integer"/>
+ <element name="description" type="string"/>
+ <element name="price" type="string"/>
+ <element name="quantity" type="integer"/>
+ <element name="warehouseId" type="integer"/>
+ </complexType>
+ </element>
+
+ <simpleType name="OrderStatus">
+ <restriction base="string">
+ <enumeration value="NONE"/>
+ <enumeration value="RECEIVED"/>
+ <enumeration value="INVOICED"/>
+ <enumeration value="DISPATCHED"/>
+ <enumeration value="COMPLETED"/>
+ <enumeration value="CANCELLED"/>
+ </restriction>
+ </simpleType>
+
+</schema>
diff --git a/sdo-cpp/trunk/runtime/core/test/Readme.txt b/sdo-cpp/trunk/runtime/core/test/Readme.txt
new file mode 100644
index 0000000000..326131a78c
--- /dev/null
+++ b/sdo-cpp/trunk/runtime/core/test/Readme.txt
@@ -0,0 +1,108 @@
+ Licensed to the Apache Software Foundation (ASF) under one
+ or more contributor license agreements. See the NOTICE file
+ distributed with this work for additional information
+ regarding copyright ownership. The ASF licenses this file
+ to you 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.48736_xml.txt
+
+===============================================================
+
+The following files are licensed as above. They do not contain the
+licence header text as they are to used to test generated output
+and are therefore classed as binary files:
+
+
+48736_xsd.txt
+b46633.txt
+b46634_out.txt
+b47137.txt
+b47137b.txt
+b47293.txt
+b48633_xml.txt
+b48633b_xsd.txt
+b48636_xml.txt
+b48636_xsd.txt
+b48686_xml.txt
+b48686_xsd.txt
+badelement.txt
+bothgroups_xsd.txt
+bothgroupssamename_xsd.txt
+bug2.txt
+bug45933-output.txt
+bug48300_xml.txt
+bug48300_xsd.txt
+bunique-out.txt
+bunique-out.xsd_safe.txt
+bunique-outxml.txt
+buniqueread-out.txt
+carotest3.txt
+csload-output.txt
+csload2-output.txt
+csload3-output.txt
+cssave-output.txt
+cssave2-output.txt
+datetest.txt
+defaults.txt
+doctest.txt
+emptycs1.txt
+emptycs2.txt
+emptycs3.txt
+getproptest.txt
+groupingroup_xsd.txt
+grouprefingroup_xsd.txt
+grouptoolate_xsd.txt
+groupwithprefix_xsd.txt
+inc1.txt
+inc2.txt
+jira490.txt
+jira705_out.txt
+list1_xml.txt
+list1_xsd.txt
+loadload-output.txt
+maintest.txt
+matttest1.txt
+merle1.txt
+notns.txt
+nulltest.txt
+oddchars.txt
+openloadNSout.txt
+openseq.txt
+order1.txt
+order2.txt
+querytest.txt
+saveopen-output.txt
+scenario1.txt
+scenario2.txt
+scenario3.txt
+scenario4.txt
+scenario5.txt
+sequence.txt
+setmany.txt
+setnull.txt
+showdefault1.txt
+showdefault2.txt
+simple.txt
+stock_wsdl.txt
+stock_xml.txt
+testabstract.txt
+testerrors.txt
+testinc2.txt
+testopen.txt
+testorder.txt
+teststyles.txt
+testsubsload.txt
+testutils.txt
+testwsdl.txt
+travel.txt
+userdata.txt
+xhtml_out.txt
diff --git a/sdo-cpp/trunk/runtime/core/test/SdoGenerate.cpp b/sdo-cpp/trunk/runtime/core/test/SdoGenerate.cpp
new file mode 100644
index 0000000000..00eae02671
--- /dev/null
+++ b/sdo-cpp/trunk/runtime/core/test/SdoGenerate.cpp
@@ -0,0 +1,169 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you 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$ */
+
+/* work in progress on generation of structures from sdos*/
+
+#include <stdio.h>
+#include <stdlib.h>
+
+#pragma warning(disable:4786)
+
+#include <iostream>
+using namespace std;
+
+
+
+#include "sdotest.h"
+
+
+
+using namespace commonj::sdo;
+
+
+char* sdotest::convert(const char* uri)
+{
+ char* newval = (char*)malloc(strlen(uri) + 1);
+ strcpy(newval,uri);
+
+ char* c;
+ while ((c = strchr(newval,'.')) != 0)
+ {
+ char * tmp = (char*)malloc(strlen(newval) + 5);
+ strncpy(tmp,newval, c - newval);
+ tmp[c-newval] = 0;
+ strcat(tmp,"<dot>");
+ strcat(tmp,c+1);
+ free(newval);
+ newval = tmp;
+ }
+ return newval;
+}
+
+
+void sdotest::generate(DataFactoryPtr fac)
+{
+ try {
+
+ TypeList tl = fac->getTypes();
+
+
+ cout << "// Generated structures " << endl;
+
+ for (unsigned int i=0;i<tl.size();i++)
+ {
+
+ if (!strcmp(tl[i].getURI(),"commonj.sdo")) continue;
+
+ char *uri = convert(tl[i].getURI());
+
+ cout << "typedef struct _";
+ if (uri) cout << uri << "_";
+ cout << tl[i].getName();
+
+ cout << "{" << endl;
+
+
+ PropertyList pl = tl[i].getProperties();
+ for (unsigned int j=0;j<pl.size();j++)
+ {
+ if (pl[j].isMany())
+ {
+ cout << "struct _";
+ char *v = convert(pl[j].getType().getURI());
+ if (v) cout << v << "_";
+ cout << pl[j].getType().getName();
+ cout << "List *" << pl[j].getName() << ";" << endl;
+ if (v) free(v);
+ }
+ else
+ {
+ if (pl[j].getType().isDataType())
+ {
+ switch (pl[j].getTypeEnum())
+ {
+ case Type::BooleanType:
+
+ cout << "bool " << pl[j].getName() << ";" << endl;
+ break;
+ case Type::ByteType:
+ cout << "char " << pl[j].getName() << ";" << endl;
+ break;
+ case Type::BytesType:
+ cout << "char* " << pl[j].getName() << ";" << endl;
+ break;
+ case Type::CharacterType:
+ cout << "wchar " << pl[j].getName() << ";" << endl;
+ break;
+ case Type::DateType:
+ cout << "time_t " << pl[j].getName() << ";" << endl;
+ break;
+ case Type::DoubleType:
+ cout << "long double " << pl[j].getName() << ";" << endl;
+ break;
+ case Type::FloatType:
+ cout << "float " << pl[j].getName() << ";" << endl;
+ break;
+ case Type::IntType:
+ cout << "long " << pl[j].getName() << ";" << endl;
+ break;
+ case Type::LongType:
+ cout << "int64_t " << pl[j].getName() << ";" << endl;
+ break;
+ case Type::ShortType:
+ cout << "short " << pl[j].getName() << ";" << endl;
+ break;
+ case Type::StringType:
+ case Type::UriType:
+ cout << "wchar_t* " << pl[j].getName() << ";" << endl;
+ break;
+ default:
+ cout << "// unknown primitive: " << pl[j].getName() << endl;
+ break;
+ }
+ }
+ else
+ {
+ cout << "struct _";
+ char *v = convert(pl[j].getType().getURI());
+ if (v) cout << v << "_";
+ cout << pl[j].getType().getName();
+ cout << " *" << pl[j].getName() << ";" << endl;
+ if (v) free(v);
+ }
+ }
+ }
+
+ cout << "} ";
+ if (uri) cout << uri << "_";
+ cout << tl[i].getName() << ";" << endl;
+ if (uri) free(uri);
+
+ }
+
+ cout << "// generated Accessors" << endl;
+ }
+ catch (SDORuntimeException e)
+ {
+ cout << "Exception in Generation" << endl;
+ cout << e << endl;
+ }
+}
+
diff --git a/sdo-cpp/trunk/runtime/core/test/StockQuoteService.wsdl b/sdo-cpp/trunk/runtime/core/test/StockQuoteService.wsdl
new file mode 100644
index 0000000000..1ecdea337e
--- /dev/null
+++ b/sdo-cpp/trunk/runtime/core/test/StockQuoteService.wsdl
@@ -0,0 +1,176 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ Licensed to the Apache Software Foundation (ASF) under one
+ or more contributor license agreements. See the NOTICE file
+ distributed with this work for additional information
+ regarding copyright ownership. The ASF licenses this file
+ to you 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.
+-->
+
+<definitions xmlns:http="http://schemas.xmlsoap.org/wsdl/http/"
+ xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/"
+ xmlns:s="http://www.w3.org/2001/XMLSchema"
+ xmlns:s0="http://swanandmokashi.com"
+ xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/"
+ xmlns:tm="http://microsoft.com/wsdl/mime/textMatching/"
+ xmlns:mime="http://schemas.xmlsoap.org/wsdl/mime/"
+ targetNamespace="http://swanandmokashi.com"
+ xmlns="http://schemas.xmlsoap.org/wsdl/">
+ <types>
+ <s:schema elementFormDefault="qualified"
+ targetNamespace="http://swanandmokashi.com"
+ xmlns:s="http://www.w3.org/2001/XMLSchema">
+ <s:element name="GetQuotes">
+ <s:complexType>
+ <s:sequence>
+ <s:element minOccurs="0" maxOccurs="1"
+ name="QuoteTicker" type="s:string" />
+ </s:sequence>
+ </s:complexType>
+ </s:element>
+ <s:element name="GetQuotesResponse">
+ <s:complexType>
+ <s:sequence>
+ <s:element minOccurs="0" maxOccurs="1"
+ name="GetQuotesResult" type="s0:ArrayOfQuote" />
+ </s:sequence>
+ </s:complexType>
+ </s:element>
+ <s:complexType name="ArrayOfQuote">
+ <s:sequence>
+ <s:element minOccurs="0" maxOccurs="unbounded"
+ name="Quote" type="s0:Quote" />
+ </s:sequence>
+ </s:complexType>
+ <s:complexType name="Quote">
+ <s:sequence>
+ <s:element minOccurs="0" maxOccurs="1"
+ name="CompanyName" type="s:string" />
+ <s:element minOccurs="0" maxOccurs="1"
+ name="StockTicker" type="s:string" />
+ <s:element minOccurs="0" maxOccurs="1"
+ name="StockQuote" type="s:string" />
+ <s:element minOccurs="0" maxOccurs="1"
+ name="LastUpdated" type="s:string" />
+ <s:element minOccurs="0" maxOccurs="1" name="Change"
+ type="s:string" />
+ <s:element minOccurs="0" maxOccurs="1"
+ name="OpenPrice" type="s:string" />
+ <s:element minOccurs="0" maxOccurs="1"
+ name="DayHighPrice" type="s:string" />
+ <s:element minOccurs="0" maxOccurs="1"
+ name="DayLowPrice" type="s:string" />
+ <s:element minOccurs="0" maxOccurs="1" name="Volume"
+ type="s:string" />
+ <s:element minOccurs="0" maxOccurs="1"
+ name="MarketCap" type="s:string" />
+ <s:element minOccurs="0" maxOccurs="1"
+ name="YearRange" type="s:string" />
+ </s:sequence>
+ </s:complexType>
+ <s:element name="ArrayOfQuote" nillable="true"
+ type="s0:ArrayOfQuote" />
+ </s:schema>
+ </types>
+ <message name="GetQuotesSoapIn">
+ <part name="parameters" element="s0:GetQuotes" />
+ </message>
+ <message name="GetQuotesSoapOut">
+ <part name="parameters" element="s0:GetQuotesResponse" />
+ </message>
+ <message name="GetQuotesHttpGetIn">
+ <part name="QuoteTicker" type="s:string" />
+ </message>
+ <message name="GetQuotesHttpGetOut">
+ <part name="Body" element="s0:ArrayOfQuote" />
+ </message>
+ <message name="GetQuotesHttpPostIn">
+ <part name="QuoteTicker" type="s:string" />
+ </message>
+ <message name="GetQuotesHttpPostOut">
+ <part name="Body" element="s0:ArrayOfQuote" />
+ </message>
+ <portType name="StockQuotesSoap">
+ <operation name="GetStockQuotes">
+ <input name="GetQuotes" message="s0:GetQuotesSoapIn" />
+ <output name="GetQuotes" message="s0:GetQuotesSoapOut" />
+ </operation>
+ </portType>
+ <portType name="StockQuotesHttpGet">
+ <operation name="GetStockQuotes">
+ <input name="GetQuotes" message="s0:GetQuotesHttpGetIn" />
+ <output name="GetQuotes" message="s0:GetQuotesHttpGetOut" />
+ </operation>
+ </portType>
+ <portType name="StockQuotesHttpPost">
+ <operation name="GetStockQuotes">
+ <input name="GetQuotes" message="s0:GetQuotesHttpPostIn" />
+ <output name="GetQuotes" message="s0:GetQuotesHttpPostOut" />
+ </operation>
+ </portType>
+ <binding name="StockQuotesSoap" type="s0:StockQuotesSoap">
+ <soap:binding transport="http://schemas.xmlsoap.org/soap/http"
+ style="document" />
+ <operation name="GetStockQuotes">
+ <soap:operation
+ soapAction="http://swanandmokashi.com/GetQuotes" style="document" />
+ <input name="GetQuotes">
+ <soap:body use="literal" />
+ </input>
+ <output name="GetQuotes">
+ <soap:body use="literal" />
+ </output>
+ </operation>
+ </binding>
+ <binding name="StockQuotesHttpGet" type="s0:StockQuotesHttpGet">
+ <http:binding verb="GET" />
+ <operation name="GetStockQuotes">
+ <http:operation location="/GetQuotes" />
+ <input name="GetQuotes">
+ <http:urlEncoded />
+ </input>
+ <output name="GetQuotes">
+ <mime:mimeXml part="Body" />
+ </output>
+ </operation>
+ </binding>
+ <binding name="StockQuotesHttpPost" type="s0:StockQuotesHttpPost">
+ <http:binding verb="POST" />
+ <operation name="GetStockQuotes">
+ <http:operation location="/GetQuotes" />
+ <input name="GetQuotes">
+ <mime:content type="application/x-www-form-urlencoded" />
+ </input>
+ <output name="GetQuotes">
+ <mime:mimeXml part="Body" />
+ </output>
+ </operation>
+ </binding>
+ <service name="StockQuotes">
+ <port name="StockQuotesSoap" binding="s0:StockQuotesSoap">
+ <soap:address
+ location="http://www.swanandmokashi.com/HomePage/WebServices/StockQuotes.asmx" />
+ </port>
+ <port name="StockQuotesHttpGet"
+ binding="s0:StockQuotesHttpGet">
+ <http:address
+ location="http://www.swanandmokashi.com/HomePage/WebServices/StockQuotes.asmx" />
+ </port>
+ <port name="StockQuotesHttpPost"
+ binding="s0:StockQuotesHttpPost">
+ <http:address
+ location="http://www.swanandmokashi.com/HomePage/WebServices/StockQuotes.asmx" />
+ </port>
+ </service>
+</definitions>
diff --git a/sdo-cpp/trunk/runtime/core/test/Style1.xsd b/sdo-cpp/trunk/runtime/core/test/Style1.xsd
new file mode 100644
index 0000000000..25d800a02c
--- /dev/null
+++ b/sdo-cpp/trunk/runtime/core/test/Style1.xsd
@@ -0,0 +1,72 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ Licensed to the Apache Software Foundation (ASF) under one
+ or more contributor license agreements. See the NOTICE file
+ distributed with this work for additional information
+ regarding copyright ownership. The ASF licenses this file
+ to you 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.
+-->
+
+<schema xmlns="http://www.w3.org/2001/XMLSchema"
+xmlns:lib="libraryNS" targetNamespace="libraryNS">
+
+ <element name="character">
+ <complexType>
+ <element name="name" type="string"/>
+ </complexType>
+ </element>
+
+ <element name="author">
+ <complexType>
+ <element name="name" type="string"/>
+ </complexType>
+ </element>
+
+ <element name="isbn">
+ <complexType>
+ <element name="value" type="string"/>
+ </complexType>
+ </element>
+
+ <element name="title">
+ <complexType>
+ <element name="value" type="string"/>
+ </complexType>
+ </element>
+
+ <element name="available">
+ <complexType>
+ <element name="isInPrint" type="boolean"/>
+ </complexType>
+ </element>
+
+<element name="library">
+ <complexType >
+ <sequence>
+ <element name="book" maxOccurs="unbounded">
+ <complexType>
+ <sequence>
+ <element ref="isbn"/>
+ <element ref="title"/>
+ <element ref="author" minOccurs="0" maxOccurs="unbounded"/>
+ <element ref="character" minOccurs="0" maxOccurs="unbounded"/>
+ </sequence>
+ <attribute ref="id"/>
+ <attribute ref="available"/>
+ </complexType>
+ </element>
+ </sequence>
+ </complexType>
+ </element>
+ </schema>
diff --git a/sdo-cpp/trunk/runtime/core/test/Style2.xsd b/sdo-cpp/trunk/runtime/core/test/Style2.xsd
new file mode 100644
index 0000000000..a6aaf51013
--- /dev/null
+++ b/sdo-cpp/trunk/runtime/core/test/Style2.xsd
@@ -0,0 +1,74 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ Licensed to the Apache Software Foundation (ASF) under one
+ or more contributor license agreements. See the NOTICE file
+ distributed with this work for additional information
+ regarding copyright ownership. The ASF licenses this file
+ to you 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.
+-->
+
+<schema xmlns="http://www.w3.org/2001/XMLSchema"
+xmlns:lib="libraryNS" targetNamespace="libraryNS">
+
+ <element name="character">
+ <complexType>
+ <element name="name" type="string"/>
+ </complexType>
+ </element>
+
+ <element name="author">
+ <complexType>
+ <element name="name" type="string"/>
+ </complexType>
+ </element>
+
+ <element name="isbn">
+ <complexType>
+ <element name="value" type="string"/>
+ </complexType>
+ </element>
+
+ <element name="title">
+ <complexType>
+ <element name="value" type="string"/>
+ </complexType>
+ </element>
+
+ <element name="available">
+ <complexType>
+ <element name="isInPrint" type="boolean"/>
+ </complexType>
+ </element>
+
+<element name="book">
+ <complexType>
+ <sequence>
+ <element ref="isbn"/>
+ <element ref="title"/>
+ <element ref="author" minOccurs="0" maxOccurs="unbounded"/>
+ <element ref="character" minOccurs="0" maxOccurs="unbounded"/>
+ </sequence>
+ <attribute ref="id"/>
+ <attribute ref="available"/>
+ </complexType>
+</element>
+
+ <element name="library">
+ <complexType >
+ <sequence>
+ <element name="book" maxOccurs="unbounded"/>
+ </sequence>
+ </complexType>
+ </element>
+</schema>
diff --git a/sdo-cpp/trunk/runtime/core/test/Style3.xsd b/sdo-cpp/trunk/runtime/core/test/Style3.xsd
new file mode 100644
index 0000000000..62db1fa13e
--- /dev/null
+++ b/sdo-cpp/trunk/runtime/core/test/Style3.xsd
@@ -0,0 +1,74 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ Licensed to the Apache Software Foundation (ASF) under one
+ or more contributor license agreements. See the NOTICE file
+ distributed with this work for additional information
+ regarding copyright ownership. The ASF licenses this file
+ to you 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.
+-->
+
+<schema xmlns="http://www.w3.org/2001/XMLSchema"
+xmlns:lib="libraryNS" targetNamespace="libraryNS">
+
+
+ <element name="character">
+ <complexType>
+ <element name="name" type="string"/>
+ </complexType>
+ </element>
+
+ <element name="author">
+ <complexType>
+ <element name="name" type="string"/>
+ </complexType>
+ </element>
+
+ <element name="isbn">
+ <complexType>
+ <element name="value" type="string"/>
+ </complexType>
+ </element>
+
+ <element name="title">
+ <complexType>
+ <element name="value" type="string"/>
+ </complexType>
+ </element>
+
+ <element name="available">
+ <complexType>
+ <element name="isInPrint" type="boolean"/>
+ </complexType>
+ </element>
+
+ <complexType name="bookType" >
+ <sequence>
+ <element ref="isbn"/>
+ <element ref="title"/>
+ <element ref="author" minOccurs="0" maxOccurs="unbounded"/>
+ <element ref="character" minOccurs="0" maxOccurs="unbounded"/>
+ </sequence>
+ <attribute ref="id"/>
+ <attribute ref="available"/>
+ </complexType>
+
+
+ <element name="library">
+ <complexType >
+ <sequence>
+ <element name="book" type="lib:bookType" maxOccurs="unbounded"/>
+ </sequence>
+ </complexType>
+ </element>
+</schema>
diff --git a/sdo-cpp/trunk/runtime/core/test/Style4.xsd b/sdo-cpp/trunk/runtime/core/test/Style4.xsd
new file mode 100644
index 0000000000..ab4bd6ef46
--- /dev/null
+++ b/sdo-cpp/trunk/runtime/core/test/Style4.xsd
@@ -0,0 +1,80 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ Licensed to the Apache Software Foundation (ASF) under one
+ or more contributor license agreements. See the NOTICE file
+ distributed with this work for additional information
+ regarding copyright ownership. The ASF licenses this file
+ to you 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.
+-->
+
+
+<schema xmlns="http://www.w3.org/2001/XMLSchema"
+xmlns:lib="libraryNS" targetNamespace="libraryNS">
+
+ <group name="bookGroup">
+ <sequence>
+ <element name="book">
+ <complexType >
+ <sequence>
+ <element ref="isbn"/>
+ <element ref="title"/>
+ <element ref="author" minOccurs="0" maxOccurs="unbounded"/>
+ <element ref="character" minOccurs="0" maxOccurs="unbounded"/>
+ </sequence>
+ <attribute ref="id"/>
+ <attribute ref="available"/>
+ </complexType>
+ </element>
+ </sequence>
+ </group>
+
+
+ <element name="character">
+ <complexType>
+ <element name="name" type="string"/>
+ </complexType>
+ </element>
+
+ <element name="author">
+ <complexType>
+ <element name="name" type="string"/>
+ </complexType>
+ </element>
+
+ <element name="isbn">
+ <complexType>
+ <element name="value" type="string"/>
+ </complexType>
+ </element>
+
+ <element name="title">
+ <complexType>
+ <element name="value" type="string"/>
+ </complexType>
+ </element>
+
+ <element name="available">
+ <complexType>
+ <element name="isInPrint" type="boolean"/>
+ </complexType>
+ </element>
+
+ <element name="library">
+ <complexType >
+ <sequence>
+ <group ref="lib:bookGroup" maxOccurs="unbounded"/>
+ </sequence>
+ </complexType>
+ </element>
+</schema>
diff --git a/sdo-cpp/trunk/runtime/core/test/TravelBookingSchema.xsd b/sdo-cpp/trunk/runtime/core/test/TravelBookingSchema.xsd
new file mode 100644
index 0000000000..2f2d53c5a8
--- /dev/null
+++ b/sdo-cpp/trunk/runtime/core/test/TravelBookingSchema.xsd
@@ -0,0 +1,103 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ Licensed to the Apache Software Foundation (ASF) under one
+ or more contributor license agreements. See the NOTICE file
+ distributed with this work for additional information
+ regarding copyright ownership. The ASF licenses this file
+ to you 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.
+-->
+
+
+<xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema">
+
+ <xsd:element name="Holiday">
+ <xsd:complexType>
+ <xsd:sequence>
+ <xsd:element ref="Flight" maxOccurs="unbounded" minOccurs="1"/>
+ <xsd:element ref="Hotel" maxOccurs="unbounded" minOccurs="1"/>
+ <xsd:element ref="Excursion"/>
+ <xsd:element ref="Client"/>
+ <xsd:element ref="Party"/>
+ </xsd:sequence>
+ </xsd:complexType>
+ </xsd:element>
+
+ <xsd:element name="Flight">
+ <xsd:complexType>
+ <xsd:sequence>
+ <xsd:element name="Departure" type="xsd:string"/>
+ <xsd:element name="Arrival" type="xsd:string"/>
+ </xsd:sequence>
+ <xsd:attribute name="flightNo" type="xsd:string" use="required"/>
+ </xsd:complexType>
+ </xsd:element>
+
+ <xsd:element name="Hotel">
+ <xsd:complexType>
+ <xsd:sequence>
+ <xsd:element ref="Name"/>
+ <xsd:element name="Phone" type="xsd:string"/>
+ <xsd:element ref="Room"/>
+ </xsd:sequence>
+ <xsd:attribute name="cardsAccepted" default="false" type="xsd:boolean"/>
+ </xsd:complexType>
+ </xsd:element>
+
+ <xsd:element name="Room">
+ <xsd:complexType>
+ <xsd:simpleContent>
+ <xsd:extension base="xsd:string">
+ <xsd:attribute name="booked" use="required" type="xsd:boolean"/>
+ </xsd:extension>
+ </xsd:simpleContent>
+ </xsd:complexType>
+ </xsd:element>
+
+ <xsd:element name="Party">
+ <xsd:complexType>
+ <xsd:sequence>
+ <xsd:element ref="Person" maxOccurs="unbounded" minOccurs="1"/>
+ </xsd:sequence>
+ </xsd:complexType>
+ </xsd:element>
+
+ <xsd:element name="Person">
+ <xsd:complexType>
+ <xsd:sequence>
+ <xsd:element ref="Name"/>
+ </xsd:sequence>
+ </xsd:complexType>
+ </xsd:element>
+
+ <xsd:element name="Client">
+ <xsd:complexType>
+ <xsd:sequence>
+ <xsd:element ref="Name"/>
+ <xsd:element name="Address" type="xsd:string"/>
+ <xsd:element name="CreditCard" type="xsd:string"/>
+ </xsd:sequence>
+ </xsd:complexType>
+ </xsd:element>
+
+ <xsd:element name="Excursion">
+ <xsd:complexType>
+ <xsd:sequence>
+ <xsd:element name="Title" type="xsd:string"/>
+ <xsd:element name="Cost" type="xsd:string"/>
+ </xsd:sequence>
+ </xsd:complexType>
+ </xsd:element>
+
+ <xsd:element name="Name" type="xsd:string"/>
+</xsd:schema>
diff --git a/sdo-cpp/trunk/runtime/core/test/TravelBookingUsingSchema.xml b/sdo-cpp/trunk/runtime/core/test/TravelBookingUsingSchema.xml
new file mode 100644
index 0000000000..d4a292083d
--- /dev/null
+++ b/sdo-cpp/trunk/runtime/core/test/TravelBookingUsingSchema.xml
@@ -0,0 +1,67 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ Licensed to the Apache Software Foundation (ASF) under one
+ or more contributor license agreements. See the NOTICE file
+ distributed with this work for additional information
+ regarding copyright ownership. The ASF licenses this file
+ to you 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.
+-->
+
+<Holiday xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:noNamespaceSchemaLocation="TravelBookingSchema.xsd">
+ <Flight flightNo="BA243">
+ <Departure>LHR</Departure>
+ <Arrival>SNG</Arrival>
+ </Flight>
+ <Flight flightNo="SG561">
+ <Departure>SNG</Departure>
+ <Arrival>LHR</Arrival>
+ </Flight>
+ <Hotel cardsAccepted="true">
+ <Name>Excelsior</Name>
+ <Phone>222-3333</Phone>
+ <Room booked="true">303</Room>
+ </Hotel>
+ <Hotel>
+ <Name>Seedy Lodge</Name>
+ <Phone>888-9999</Phone>
+ <Room booked="true">14</Room>
+ </Hotel>
+ <Hotel cardsAccepted="true">
+ <Name>Hilton</Name>
+ <Phone>444-5555</Phone>
+ <Room booked="false">456</Room>
+ <foo>foo</foo>
+ </Hotel>
+ <Excursion>
+ <Title>Bird Baths of Singapore</Title>
+ <Cost>50</Cost>
+ </Excursion>
+ <Client>
+ <Name>Steve</Name>
+ <Address>134 Shirley Road</Address>
+ <CreditCard>1234-8908-6543-900</CreditCard>
+ </Client>
+ <Party>
+ <Person>
+ <Name>John</Name>
+ </Person>
+ <Person>
+ <Name>Jane</Name>
+ </Person>
+ <Person>
+ <Name>Bill</Name>
+ </Person>
+ </Party>
+</Holiday>
diff --git a/sdo-cpp/trunk/runtime/core/test/axis.xsd b/sdo-cpp/trunk/runtime/core/test/axis.xsd
new file mode 100644
index 0000000000..8832ae1afd
--- /dev/null
+++ b/sdo-cpp/trunk/runtime/core/test/axis.xsd
@@ -0,0 +1,40 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ Licensed to the Apache Software Foundation (ASF) under one
+ or more contributor license agreements. See the NOTICE file
+ distributed with this work for additional information
+ regarding copyright ownership. The ASF licenses this file
+ to you 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.
+-->
+
+ <xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:sdo="commonj.sdo" xmlns:sdoxml="commonj.sdo/xml" xmlns:tns="axis" targetNamespace="axis">
+<xsd:element name="ItemSearch" >
+ <xsd:complexType >
+ <xsd:sequence>
+<xsd:element name="SubscriptionId" type="xsd:string" minOccurs="0" />
+<xsd:element name="AssociateTag" type="xsd:string" minOccurs="0" />
+<xsd:element name="XMLEscaping" type="xsd:string" minOccurs="0" />
+<xsd:element name="Validate" type="xsd:string" minOccurs="0" />
+<xsd:element name="Shared" type="tns:ItemSearchRequest" minOccurs="0" />
+<xsd:element name="Request" type="tns:ItemSearchRequest" minOccurs="0" maxOccurs="unbounded" />
+</xsd:sequence>
+</xsd:complexType>
+</xsd:element>
+ <xsd:complexType name="ItemSearchRequest">
+ <xsd:sequence>
+<xsd:element name="Keywords" type="xsd:string" minOccurs="0" />
+<xsd:element name="SearchIndex" type="xsd:string" minOccurs="0" />
+</xsd:sequence>
+</xsd:complexType>
+</xsd:schema>
diff --git a/sdo-cpp/trunk/runtime/core/test/b46617b.xml b/sdo-cpp/trunk/runtime/core/test/b46617b.xml
new file mode 100644
index 0000000000..5d6d2d7336
--- /dev/null
+++ b/sdo-cpp/trunk/runtime/core/test/b46617b.xml
@@ -0,0 +1,27 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ Licensed to the Apache Software Foundation (ASF) under one
+ or more contributor license agreements. See the NOTICE file
+ distributed with this work for additional information
+ regarding copyright ownership. The ASF licenses this file
+ to you 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.
+-->
+
+<companyType xmlns="companyNS" xsi:type="CompanyType"
+xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" name="MegaCorp" employeeOfTheMonth="#/CEO">
+<departments name="Shoe">
+<employees name="Sarah Jones"/>
+</departments>
+<CEO name="Fred Smith"/>
+</companyType>
diff --git a/sdo-cpp/trunk/runtime/core/test/b46617b.xsd b/sdo-cpp/trunk/runtime/core/test/b46617b.xsd
new file mode 100644
index 0000000000..263f8bae30
--- /dev/null
+++ b/sdo-cpp/trunk/runtime/core/test/b46617b.xsd
@@ -0,0 +1,79 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ Licensed to the Apache Software Foundation (ASF) under one
+ or more contributor license agreements. See the NOTICE file
+ distributed with this work for additional information
+ regarding copyright ownership. The ASF licenses this file
+ to you 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.
+-->
+
+<xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema"
+xmlns:sdo="commonj.sdo" xmlns:sdoxml="commonj.sdo/xml"
+xmlns:tns="companyNS" targetNamespace="companyNS">
+
+<xsd:element name="employeeType" type="tns:EmployeeType"/>
+<xsd:complexType name="EmployeeType">
+<xsd:sequence>
+<xsd:element name="SN" type="xsd:String" minOccurs="0"/>
+<xsd:element name="manager" type="xsd:boolean" minOccurs="0"/>
+</xsd:sequence>
+<xsd:attribute name="name" type="xsd:String"/>
+</xsd:complexType>
+
+<xsd:element name="departmentType" type="tns:DepartmentType"/>
+<xsd:complexType name="DepartmentType">
+<xsd:sequence>
+<xsd:element name="location" type="xsd:String" minOccurs="0"/>
+<xsd:element name="number" type="xsd:integer" minOccurs="0"/>
+<xsd:element name="employees" type="tns:EmployeeType" minOccurs="0" maxOccurs="unbounded"/>
+</xsd:sequence>
+<xsd:attribute name="name" type="xsd:String"/>
+</xsd:complexType>
+
+<xsd:element name="companyType" type="tns:CompanyType"/>
+<xsd:complexType name="CompanyType" mixed="true">
+<xsd:choice maxOccurs="unbounded">
+<xsd:element name="departments" type="tns:DepartmentType" minOccurs="0" maxOccurs="unbounded"/>
+<xsd:element name="string" type="xsd:String" minOccurs="0"/>
+<xsd:element name="bool" type="xsd:boolean" minOccurs="0"/>
+<xsd:element name="byte" type="xsd:byte" minOccurs="0"/>
+<xsd:element name="bytes" type="xsd:hexBinary" minOccurs="0"/>
+<xsd:element name="char" type="xsd:string" minOccurs="0"/>
+<xsd:element name="date" type="xsd:dateTime" minOccurs="0"/>
+<xsd:element name="double" type="xsd:double" minOccurs="0"/>
+<xsd:element name="float" type="xsd:float" minOccurs="0"/>
+<xsd:element name="int" type="xsd:integer" minOccurs="0"/>
+<xsd:element name="long" type="xsd:long" minOccurs="0"/>
+<xsd:element name="short" type="xsd:short" minOccurs="0"/>
+<xsd:element name="uri" type="xsd:anyURI" minOccurs="0"/>
+<xsd:element name="Mstring" type="xsd:String" minOccurs="0" maxOccurs="unbounded"/>
+<xsd:element name="Mbool" type="xsd:boolean" minOccurs="0" maxOccurs="unbounded"/>
+<xsd:element name="Mbyte" type="xsd:byte" minOccurs="0" maxOccurs="unbounded"/>
+<xsd:element name="Mbytes" type="xsd:hexBinary" minOccurs="0" maxOccurs="unbounded"/>
+<xsd:element name="Mchar" type="xsd:string" minOccurs="0" maxOccurs="unbounded"/>
+<xsd:element name="Mdate" type="xsd:dateTime" minOccurs="0" maxOccurs="unbounded"/>
+<xsd:element name="Mdouble" type="xsd:double" minOccurs="0" maxOccurs="unbounded"/>
+<xsd:element name="Mfloat" type="xsd:float" minOccurs="0" maxOccurs="unbounded"/>
+<xsd:element name="Mint" type="xsd:integer" minOccurs="0" maxOccurs="unbounded"/>
+<xsd:element name="Mlong" type="xsd:long" minOccurs="0" maxOccurs="unbounded"/>
+<xsd:element name="Mshort" type="xsd:short" minOccurs="0" maxOccurs="unbounded"/>
+<xsd:element name="Muri" type="xsd:anyURI" minOccurs="0" maxOccurs="unbounded"/>
+</xsd:choice>
+
+<xsd:element name="CEO" type="tns:EmployeeType" minOccurs="0"/>
+<xsd:element name="changeSummary" type="sdo:ChangeSummaryType"/>
+<xsd:attribute name="name" type="xsd:String"/>
+<xsd:attribute name="employeeOfTheMonth" sdoxml:propertyType="tns:EmployeeType" type="xsd:IDREF"/>
+</xsd:complexType>
+</xsd:schema> \ No newline at end of file
diff --git a/sdo-cpp/trunk/runtime/core/test/b46633.txt b/sdo-cpp/trunk/runtime/core/test/b46633.txt
new file mode 100644
index 0000000000..da34a5196e
--- /dev/null
+++ b/sdo-cpp/trunk/runtime/core/test/b46633.txt
@@ -0,0 +1,8 @@
+A modified of type myspace#Department
+Property employees[(null)] was unset before the change
+Property ints[(null)] was unset before the change
+Property bool was unset before the change
+A modified of type myspace#Department
+Property employees[(null)] was unset before the change
+Property ints[(null)] was unset before the change
+Property bool was unset before the change
diff --git a/sdo-cpp/trunk/runtime/core/test/b46634_out.txt b/sdo-cpp/trunk/runtime/core/test/b46634_out.txt
new file mode 100644
index 0000000000..5e6b6dd560
--- /dev/null
+++ b/sdo-cpp/trunk/runtime/core/test/b46634_out.txt
@@ -0,0 +1,2 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<company xsi:type="tns2:CompanyType" xmlns:tns2="companyNS" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" name="MegaCorp"><departments name="Advanced Technologies" location="NY" number="123"><employees><name>Jane Doe</name><SN xsi:nil="true"/></employees></departments></company>
diff --git a/sdo-cpp/trunk/runtime/core/test/b46693.xsd b/sdo-cpp/trunk/runtime/core/test/b46693.xsd
new file mode 100644
index 0000000000..deb00d0473
--- /dev/null
+++ b/sdo-cpp/trunk/runtime/core/test/b46693.xsd
@@ -0,0 +1,176 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ Licensed to the Apache Software Foundation (ASF) under one
+ or more contributor license agreements. See the NOTICE file
+ distributed with this work for additional information
+ regarding copyright ownership. The ASF licenses this file
+ to you 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.
+-->
+
+<definitions xmlns:http="http://schemas.xmlsoap.org/wsdl/http/"
+ xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/"
+ xmlns:s="http://www.w3.org/2001/XMLSchema"
+ xmlns:s0="http://swanandmokashi.com"
+ xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/"
+ xmlns:tm="http://microsoft.com/wsdl/mime/textMatching/"
+ xmlns:mime="http://schemas.xmlsoap.org/wsdl/mime/"
+ targetNamespace="http://swanandmokashi.com"
+ xmlns="http://schemas.xmlsoap.org/wsdl/">
+ <types>
+ <s:schema elementFormDefault="qualified"
+ targetNamespace="http://swanandmokashi.com">
+ <s:element name="GetQuotes">
+ <s:complexType>
+ <s:sequence>
+ <s:element minOccurs="0" maxOccurs="1"
+ name="QuoteTicker" type="s:string" />
+ </s:sequence>
+ </s:complexType>
+ </s:element>
+ <s:element name="GetQuotesResponse">
+ <s:complexType>
+ <s:sequence>
+ <s:element minOccurs="0" maxOccurs="1"
+ name="GetQuotesResult" type="s0:ArrayOfQuote" />
+ </s:sequence>
+ </s:complexType>
+ </s:element>
+ <s:complexType name="ArrayOfQuote">
+ <s:sequence>
+ <s:element minOccurs="0" maxOccurs="unbounded"
+ name="Quote" type="s0:Quote" />
+ </s:sequence>
+ </s:complexType>
+ <s:complexType name="Quote">
+ <s:sequence>
+ <s:element minOccurs="0" maxOccurs="1"
+ name="CompanyName" type="s:string" />
+ <s:element minOccurs="0" maxOccurs="1"
+ name="StockTicker" type="s:string" />
+ <s:element minOccurs="0" maxOccurs="1"
+ name="StockQuote" type="s:string" />
+ <s:element minOccurs="0" maxOccurs="1"
+ name="LastUpdated" type="s:string" />
+ <s:element minOccurs="0" maxOccurs="1" name="Change"
+ type="s:string" />
+ <s:element minOccurs="0" maxOccurs="1"
+ name="OpenPrice" type="s:string" />
+ <s:element minOccurs="0" maxOccurs="1"
+ name="DayHighPrice" type="s:string" />
+ <s:element minOccurs="0" maxOccurs="1"
+ name="DayLowPrice" type="s:string" />
+ <s:element minOccurs="0" maxOccurs="1" name="Volume"
+ type="s:string" />
+ <s:element minOccurs="0" maxOccurs="1"
+ name="MarketCap" type="s:string" />
+ <s:element minOccurs="0" maxOccurs="1"
+ name="YearRange" type="s:string" />
+ </s:sequence>
+ </s:complexType>
+ <s:element name="ArrayOfQuote" nillable="true"
+ type="s0:ArrayOfQuote" />
+ </s:schema>
+ </types>
+ <message name="GetQuotesSoapIn">
+ <part name="parameters" element="s0:GetQuotes" />
+ </message>
+ <message name="GetQuotesSoapOut">
+ <part name="parameters" element="s0:GetQuotesResponse" />
+ </message>
+ <message name="GetQuotesHttpGetIn">
+ <part name="QuoteTicker" type="s:string" />
+ </message>
+ <message name="GetQuotesHttpGetOut">
+ <part name="Body" element="s0:ArrayOfQuote" />
+ </message>
+ <message name="GetQuotesHttpPostIn">
+ <part name="QuoteTicker" type="s:string" />
+ </message>
+ <message name="GetQuotesHttpPostOut">
+ <part name="Body" element="s0:ArrayOfQuote" />
+ </message>
+ <portType name="StockQuotesSoap">
+ <operation name="GetStockQuotes">
+ <input name="GetQuotes" message="s0:GetQuotesSoapIn" />
+ <output name="GetQuotes" message="s0:GetQuotesSoapOut" />
+ </operation>
+ </portType>
+ <portType name="StockQuotesHttpGet">
+ <operation name="GetStockQuotes">
+ <input name="GetQuotes" message="s0:GetQuotesHttpGetIn" />
+ <output name="GetQuotes" message="s0:GetQuotesHttpGetOut" />
+ </operation>
+ </portType>
+ <portType name="StockQuotesHttpPost">
+ <operation name="GetStockQuotes">
+ <input name="GetQuotes" message="s0:GetQuotesHttpPostIn" />
+ <output name="GetQuotes" message="s0:GetQuotesHttpPostOut" />
+ </operation>
+ </portType>
+ <binding name="StockQuotesSoap" type="s0:StockQuotesSoap">
+ <soap:binding transport="http://schemas.xmlsoap.org/soap/http"
+ style="document" />
+ <operation name="GetStockQuotes">
+ <soap:operation
+ soapAction="http://swanandmokashi.com/GetQuotes" style="document" />
+ <input name="GetQuotes">
+ <soap:body use="literal" />
+ </input>
+ <output name="GetQuotes">
+ <soap:body use="literal" />
+ </output>
+ </operation>
+ </binding>
+ <binding name="StockQuotesHttpGet" type="s0:StockQuotesHttpGet">
+ <http:binding verb="GET" />
+ <operation name="GetStockQuotes">
+ <http:operation location="/GetQuotes" />
+ <input name="GetQuotes">
+ <http:urlEncoded />
+ </input>
+ <output name="GetQuotes">
+ <mime:mimeXml part="Body" />
+ </output>
+ </operation>
+ </binding>
+ <binding name="StockQuotesHttpPost" type="s0:StockQuotesHttpPost">
+ <http:binding verb="POST" />
+ <operation name="GetStockQuotes">
+ <http:operation location="/GetQuotes" />
+ <input name="GetQuotes">
+ <mime:content type="application/x-www-form-urlencoded" />
+ </input>
+ <output name="GetQuotes">
+ <mime:mimeXml part="Body" />
+ </output>
+ </operation>
+ </binding>
+ <service name="StockQuotes">
+ <port name="StockQuotesSoap" binding="s0:StockQuotesSoap">
+ <soap:address
+ location="http://www.swanandmokashi.com/HomePage/WebServices/StockQuotes.asmx" />
+ </port>
+ <port name="StockQuotesHttpGet"
+ binding="s0:StockQuotesHttpGet">
+ <http:address
+ location="http://www.swanandmokashi.com/HomePage/WebServices/StockQuotes.asmx" />
+ </port>
+ <port name="StockQuotesHttpPost"
+ binding="s0:StockQuotesHttpPost">
+ <http:address
+ location="http://www.swanandmokashi.com/HomePage/WebServices/StockQuotes.asmx" />
+ </port>
+ </service>
+</definitions>
+
diff --git a/sdo-cpp/trunk/runtime/core/test/b47137.txt b/sdo-cpp/trunk/runtime/core/test/b47137.txt
new file mode 100644
index 0000000000..d525bd7776
--- /dev/null
+++ b/sdo-cpp/trunk/runtime/core/test/b47137.txt
@@ -0,0 +1,6 @@
+Property:value
+Property:isPermaLink
+Property:value
+Value:Hello
+Property:isPermaLink
+Value:true
diff --git a/sdo-cpp/trunk/runtime/core/test/b47137.xsd b/sdo-cpp/trunk/runtime/core/test/b47137.xsd
new file mode 100644
index 0000000000..dbeba3fd22
--- /dev/null
+++ b/sdo-cpp/trunk/runtime/core/test/b47137.xsd
@@ -0,0 +1,32 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ Licensed to the Apache Software Foundation (ASF) under one
+ or more contributor license agreements. See the NOTICE file
+ distributed with this work for additional information
+ regarding copyright ownership. The ASF licenses this file
+ to you 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.
+-->
+
+<xs:schema version="1.1.0"
+ xmlns:xs="http://www.w3.org/2001/XMLSchema">
+
+ <xs:element name="guid" minOccurs="0" maxOccurs="1">
+ <xs:complexType>
+ <xs:extension base="xs:string">
+ <xs:attribute name="isPermaLink" use="optional" type="xs:boolean">
+ </xs:attribute>
+ </xs:extension>
+ </xs:complexType>
+ </xs:element>
+</xs:schema> \ No newline at end of file
diff --git a/sdo-cpp/trunk/runtime/core/test/b47137b.txt b/sdo-cpp/trunk/runtime/core/test/b47137b.txt
new file mode 100644
index 0000000000..8413df7566
--- /dev/null
+++ b/sdo-cpp/trunk/runtime/core/test/b47137b.txt
@@ -0,0 +1,31 @@
+Type:commonj.sdo#Boolean
+Type:commonj.sdo#Byte
+Type:commonj.sdo#Bytes
+Type:commonj.sdo#ChangeSummary
+Type:commonj.sdo#Character
+Type:commonj.sdo#DataObject
+Type:commonj.sdo#Date
+Type:commonj.sdo#Decimal
+Type:commonj.sdo#Double
+Type:commonj.sdo#Float
+Type:commonj.sdo#Int
+Type:commonj.sdo#Integer
+Type:commonj.sdo#Long
+Type:commonj.sdo#OpenDataObject
+Type:commonj.sdo#Short
+Type:commonj.sdo#String
+Type:commonj.sdo#URI
+Type:companyNS#CompanyType
+Type:companyNS#DepartmentType
+Type:companyNS#EmployeeType
+Type:companyNS#RootType
+Type:companyNS#guid
+Property:departments
+Property:guid
+Property:name
+Property:employeeOfTheMonth
+Property:departments
+Property:guid
+guid Value:Wilbur
+guid isPermaLink:Property:name
+Property:employeeOfTheMonth
diff --git a/sdo-cpp/trunk/runtime/core/test/b47137b.xsd b/sdo-cpp/trunk/runtime/core/test/b47137b.xsd
new file mode 100644
index 0000000000..f78ce703f3
--- /dev/null
+++ b/sdo-cpp/trunk/runtime/core/test/b47137b.xsd
@@ -0,0 +1,59 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ Licensed to the Apache Software Foundation (ASF) under one
+ or more contributor license agreements. See the NOTICE file
+ distributed with this work for additional information
+ regarding copyright ownership. The ASF licenses this file
+ to you 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.
+-->
+
+ <xsd:schema
+ xmlns:xsd="http://www.w3.org/2001/XMLSchema"
+ xmlns:sdo="commonj.sdo"
+ xmlns:sdoxml="commonj.sdo/xml"
+ xmlns:company="companyNS"
+ targetNamespace="companyNS">
+
+ <xsd:element name="company" type="company:CompanyType"/>
+ <xsd:complexType name="CompanyType">
+ <xsd:sequence>
+ <xsd:element name="departments" type="company:DepartmentType" maxOccurs="unbounded"/>
+ </xsd:sequence>
+ <xsd:element name="guid" minOccurs="0" maxOccurs="1">
+ <xsd:complexType>
+ <xsd:extension base="xsd:string">
+ <xsd:attribute name="isPermaLink" use="optional" type="xsd:boolean">
+ </xsd:attribute>
+ </xsd:extension>
+ </xsd:complexType>
+ </xsd:element>
+ <xsd:attribute name="name" type="xsd:string"/>
+ <xsd:attribute name="cs" type="sdo:ChangeSummaryType"/>
+ <xsd:attribute name="employeeOfTheMonth" type="xsd:IDREF" sdoxml:propertyType="company:EmployeeType"/>
+ </xsd:complexType>
+ <xsd:complexType name="DepartmentType">
+ <xsd:sequence>
+ <xsd:element name="employees" type="company:EmployeeType" maxOccurs="unbounded"/>
+ </xsd:sequence>
+ <xsd:attribute name="name" type="xsd:string"/>
+ <xsd:attribute name="location" type="xsd:string"/>
+ <xsd:attribute name="number" type="xsd:int"/>
+ </xsd:complexType>
+ <xsd:complexType name="EmployeeType">
+ <xsd:attribute name="name" type="xsd:string"/>
+ <xsd:attribute name="SN" type="xsd:ID"/>
+ <xsd:attribute name="manager" type="xsd:boolean"/>
+ </xsd:complexType>
+ </xsd:schema>
+
diff --git a/sdo-cpp/trunk/runtime/core/test/b47293.txt b/sdo-cpp/trunk/runtime/core/test/b47293.txt
new file mode 100644
index 0000000000..16304cde6c
--- /dev/null
+++ b/sdo-cpp/trunk/runtime/core/test/b47293.txt
@@ -0,0 +1,27 @@
+Type:catalogNS#CatalogTypeType:catalogNS#RootTypeType:commonj.sdo#BooleanType:commonj.sdo#ByteType:commonj.sdo#BytesType:commonj.sdo#ChangeSummaryType:commonj.sdo#CharacterType:commonj.sdo#DataObjectType:commonj.sdo#DateType:commonj.sdo#DecimalType:commonj.sdo#DoubleType:commonj.sdo#FloatType:commonj.sdo#IntType:commonj.sdo#IntegerType:commonj.sdo#LongType:commonj.sdo#OpenDataObjectType:commonj.sdo#ShortType:commonj.sdo#StringType:commonj.sdo#URIType:customerNS#AddressTypeType:customerNS#CustomerTypeType:customerNS#PaymentTypeType:customerNS#RootTypeType:orderNS#OrderStatusType:orderNS#OrderTypeType:orderNS#RootTypeType:orderNS#itemType:catalogNS#CatalogType
+Type:catalogNS#RootType
+Type:commonj.sdo#Boolean
+Type:commonj.sdo#Byte
+Type:commonj.sdo#Bytes
+Type:commonj.sdo#ChangeSummary
+Type:commonj.sdo#Character
+Type:commonj.sdo#DataObject
+Type:commonj.sdo#Date
+Type:commonj.sdo#Decimal
+Type:commonj.sdo#Double
+Type:commonj.sdo#Float
+Type:commonj.sdo#Int
+Type:commonj.sdo#Integer
+Type:commonj.sdo#Long
+Type:commonj.sdo#OpenDataObject
+Type:commonj.sdo#Short
+Type:commonj.sdo#String
+Type:commonj.sdo#URI
+Type:customerNS#AddressType
+Type:customerNS#CustomerType
+Type:customerNS#PaymentType
+Type:customerNS#RootType
+Type:orderNS#OrderStatus
+Type:orderNS#OrderType
+Type:orderNS#RootType
+Type:orderNS#item
diff --git a/sdo-cpp/trunk/runtime/core/test/b48602.xsd b/sdo-cpp/trunk/runtime/core/test/b48602.xsd
new file mode 100644
index 0000000000..859068d11d
--- /dev/null
+++ b/sdo-cpp/trunk/runtime/core/test/b48602.xsd
@@ -0,0 +1,29 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ Licensed to the Apache Software Foundation (ASF) under one
+ or more contributor license agreements. See the NOTICE file
+ distributed with this work for additional information
+ regarding copyright ownership. The ASF licenses this file
+ to you 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.
+-->
+
+<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema" >
+ <xs:element name="address" type="Address"/>
+<xs:complexType name="Address">
+ <xs:sequence>
+<xs:element name="name" type="string"/>
+</xs:sequence>
+</xs:complexType >
+</xs:schema>
+
diff --git a/sdo-cpp/trunk/runtime/core/test/b48633.xml b/sdo-cpp/trunk/runtime/core/test/b48633.xml
new file mode 100644
index 0000000000..201b90fcc1
--- /dev/null
+++ b/sdo-cpp/trunk/runtime/core/test/b48633.xml
@@ -0,0 +1,29 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ Licensed to the Apache Software Foundation (ASF) under one
+ or more contributor license agreements. See the NOTICE file
+ distributed with this work for additional information
+ regarding copyright ownership. The ASF licenses this file
+ to you 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.
+-->
+
+<name
+ xmlns="http://www.wrox.com/name"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-Instance"
+ xsi:schemaLocation="http://www.wrox.com/name name.xsd"
+ title="Mr.">
+ <first>John</first>
+ <middle>Fitzgerald</middle>
+ <last>Doe</last>
+</name>
diff --git a/sdo-cpp/trunk/runtime/core/test/b48633.xsd b/sdo-cpp/trunk/runtime/core/test/b48633.xsd
new file mode 100644
index 0000000000..ad3b1acb92
--- /dev/null
+++ b/sdo-cpp/trunk/runtime/core/test/b48633.xsd
@@ -0,0 +1,41 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ Licensed to the Apache Software Foundation (ASF) under one
+ or more contributor license agreements. See the NOTICE file
+ distributed with this work for additional information
+ regarding copyright ownership. The ASF licenses this file
+ to you 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.
+-->
+
+<schema xmlns="http://www.w3.org/2001/XMLSchema"
+ targetNamespace="http://www.wrox.com/name"
+ xmlns:tns="http://www.wrox.com/name"
+ elementFormDefault="qualified">
+
+ <element name="first" type="string"/>
+ <element name="middle" type="string"/>
+ <element name="last" type="string"/>
+
+ <complexType name="NameType">
+ <sequence>
+ <element ref="tns:first"/>
+ <element ref="tns:middle"/>
+ <element ref="tns:last"/>
+ </sequence>
+ <attribute name="title" type="string"/>
+ </complexType>
+
+ <element name="name" type="tns:NameType"/>
+</schema>
+
diff --git a/sdo-cpp/trunk/runtime/core/test/b48633_xml.txt b/sdo-cpp/trunk/runtime/core/test/b48633_xml.txt
new file mode 100644
index 0000000000..7c0425d298
--- /dev/null
+++ b/sdo-cpp/trunk/runtime/core/test/b48633_xml.txt
@@ -0,0 +1,10 @@
+===== DataObject contents =====
+first:string:John
+
+middle:string:Fitzgerald
+
+last:string:Doe
+
+title:string:Mr.
+
+===== End DataObject =====
diff --git a/sdo-cpp/trunk/runtime/core/test/b48633b.xsd b/sdo-cpp/trunk/runtime/core/test/b48633b.xsd
new file mode 100644
index 0000000000..f2ddbca89f
--- /dev/null
+++ b/sdo-cpp/trunk/runtime/core/test/b48633b.xsd
@@ -0,0 +1,26 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ Licensed to the Apache Software Foundation (ASF) under one
+ or more contributor license agreements. See the NOTICE file
+ distributed with this work for additional information
+ regarding copyright ownership. The ASF licenses this file
+ to you 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.
+-->
+
+<schema xmlns="http://www.w3.org/2001/XMLSchema"
+ targetNamespace="TNS"
+ xmlns:v="TNS">
+<element name="version" type="string"/>
+</schema>
+
diff --git a/sdo-cpp/trunk/runtime/core/test/b48633b_xsd.txt b/sdo-cpp/trunk/runtime/core/test/b48633b_xsd.txt
new file mode 100644
index 0000000000..fabf6dec09
--- /dev/null
+++ b/sdo-cpp/trunk/runtime/core/test/b48633b_xsd.txt
@@ -0,0 +1,31 @@
+***** TESTANY ******************************************
+Type:TNS#RootType
+Property:version of type String
+Type:commonj.sdo#Boolean
+Type:commonj.sdo#Byte
+Type:commonj.sdo#Bytes
+Type:commonj.sdo#ChangeSummary
+Type:commonj.sdo#Character
+Type:commonj.sdo#DataObject
+Type:commonj.sdo#Date
+Type:commonj.sdo#Decimal
+Type:commonj.sdo#Double
+Type:commonj.sdo#Float
+Type:commonj.sdo#Int
+Type:commonj.sdo#Integer
+Type:commonj.sdo#Long
+Type:commonj.sdo#OpenDataObject
+Type:commonj.sdo#Short
+Type:commonj.sdo#String
+Type:commonj.sdo#URI
+Type:http://www.wrox.com/name#NameType
+Property:first of type String
+Property:middle of type String
+Property:last of type String
+Property:title of type String
+Type:http://www.wrox.com/name#RootType
+Property:first of type String
+Property:middle of type String
+Property:last of type String
+Property:name of type NameType
+*******************************END TYPES******************
diff --git a/sdo-cpp/trunk/runtime/core/test/b48636.xml b/sdo-cpp/trunk/runtime/core/test/b48636.xml
new file mode 100644
index 0000000000..50e4d9c017
--- /dev/null
+++ b/sdo-cpp/trunk/runtime/core/test/b48636.xml
@@ -0,0 +1,29 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ Licensed to the Apache Software Foundation (ASF) under one
+ or more contributor license agreements. See the NOTICE file
+ distributed with this work for additional information
+ regarding copyright ownership. The ASF licenses this file
+ to you 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.
+-->
+
+<name
+ xmlns="http://www.wrox.com/name"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://www.wrox.com/name name8.xsd"
+ title="Mr.">
+ <first>John</first>
+ <middle>Fitzgerald</middle>
+ <last>Doe</last>
+</name>
diff --git a/sdo-cpp/trunk/runtime/core/test/b48636.xsd b/sdo-cpp/trunk/runtime/core/test/b48636.xsd
new file mode 100644
index 0000000000..b14da69279
--- /dev/null
+++ b/sdo-cpp/trunk/runtime/core/test/b48636.xsd
@@ -0,0 +1,36 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ Licensed to the Apache Software Foundation (ASF) under one
+ or more contributor license agreements. See the NOTICE file
+ distributed with this work for additional information
+ regarding copyright ownership. The ASF licenses this file
+ to you 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.
+-->
+
+<schema xmlns="http://www.w3.org/2001/XMLSchema" targetNamespace="http://www.wrox.com/name"
+xmlns:target="http://www.wrox.com/name" elementFormDefault="qualified">
+ <group name="NameGroup">
+ <sequence>
+ <element name="first" type="string"/>
+ <element name="middle" type="string"/>
+ <element name="last" type="string"/>
+ </sequence>
+ </group>
+ <element name="name">
+ <complexType>
+ <group ref="target:NameGroup"/>
+ <attribute name="title" type="string"/>
+ </complexType>
+ </element>
+</schema>
diff --git a/sdo-cpp/trunk/runtime/core/test/b48636_xml.txt b/sdo-cpp/trunk/runtime/core/test/b48636_xml.txt
new file mode 100644
index 0000000000..6bc24e1bba
--- /dev/null
+++ b/sdo-cpp/trunk/runtime/core/test/b48636_xml.txt
@@ -0,0 +1,36 @@
+***** TYPES AFTER RESOLVE*********************************
+Type:commonj.sdo#Boolean
+Type:commonj.sdo#Byte
+Type:commonj.sdo#Bytes
+Type:commonj.sdo#ChangeSummary
+Type:commonj.sdo#Character
+Type:commonj.sdo#DataObject
+Type:commonj.sdo#Date
+Type:commonj.sdo#Decimal
+Type:commonj.sdo#Double
+Type:commonj.sdo#Float
+Type:commonj.sdo#Int
+Type:commonj.sdo#Integer
+Type:commonj.sdo#Long
+Type:commonj.sdo#OpenDataObject
+Type:commonj.sdo#Short
+Type:commonj.sdo#String
+Type:commonj.sdo#URI
+Type:http://www.wrox.com/name#RootType
+Property:name of type name
+Type:http://www.wrox.com/name#name
+Property:first of type String
+Property:middle of type String
+Property:last of type String
+Property:title of type String
+*******************************END TYPES******************
+===== DataObject contents =====
+first:string:John
+
+middle:string:Fitzgerald
+
+last:string:Doe
+
+title:string:Mr.
+
+===== End DataObject =====
diff --git a/sdo-cpp/trunk/runtime/core/test/b48636_xsd.txt b/sdo-cpp/trunk/runtime/core/test/b48636_xsd.txt
new file mode 100644
index 0000000000..cea8efd41a
--- /dev/null
+++ b/sdo-cpp/trunk/runtime/core/test/b48636_xsd.txt
@@ -0,0 +1,26 @@
+***** TYPES BEFORE RESOLVE **********************************
+Type:commonj.sdo#Boolean
+Type:commonj.sdo#Byte
+Type:commonj.sdo#Bytes
+Type:commonj.sdo#ChangeSummary
+Type:commonj.sdo#Character
+Type:commonj.sdo#DataObject
+Type:commonj.sdo#Date
+Type:commonj.sdo#Decimal
+Type:commonj.sdo#Double
+Type:commonj.sdo#Float
+Type:commonj.sdo#Int
+Type:commonj.sdo#Integer
+Type:commonj.sdo#Long
+Type:commonj.sdo#OpenDataObject
+Type:commonj.sdo#Short
+Type:commonj.sdo#String
+Type:commonj.sdo#URI
+Type:http://www.wrox.com/name#RootType
+Property:name of type name
+Type:http://www.wrox.com/name#name
+Property:first of type String
+Property:middle of type String
+Property:last of type String
+Property:title of type String
+*******************************END TYPES******************
diff --git a/sdo-cpp/trunk/runtime/core/test/b48686.xml b/sdo-cpp/trunk/runtime/core/test/b48686.xml
new file mode 100644
index 0000000000..d4dc9e1852
--- /dev/null
+++ b/sdo-cpp/trunk/runtime/core/test/b48686.xml
@@ -0,0 +1,30 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ Licensed to the Apache Software Foundation (ASF) under one
+ or more contributor license agreements. See the NOTICE file
+ distributed with this work for additional information
+ regarding copyright ownership. The ASF licenses this file
+ to you 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.
+-->
+
+<name
+ xmlns="http://www.wrox.com/name"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchem-Instance"
+ xsi:schemaLocation="http://www.wrox.com/name name.xsd">
+ <first>John</first>
+ <middle>Fitzgerald</middle>
+ <last>Doe</last>
+ <ages>1 2 3</ages>
+</name>
+
diff --git a/sdo-cpp/trunk/runtime/core/test/b48686.xsd b/sdo-cpp/trunk/runtime/core/test/b48686.xsd
new file mode 100644
index 0000000000..3845d69471
--- /dev/null
+++ b/sdo-cpp/trunk/runtime/core/test/b48686.xsd
@@ -0,0 +1,41 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ Licensed to the Apache Software Foundation (ASF) under one
+ or more contributor license agreements. See the NOTICE file
+ distributed with this work for additional information
+ regarding copyright ownership. The ASF licenses this file
+ to you 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.
+-->
+
+<schema xmlns="http://www.w3.org/2001/XMLSchema"
+ targetNamespace="http://www.wrox.com/name"
+ xmlns:tns="http://www.wrox.com/name">
+
+ <element name="name">
+ <complexType>
+ <sequence>
+ <element name="first" type="string"/>
+ <element name="middle" type="string"/>
+ <element name="last" type="string"/>
+ <element name="ages">
+ <simpleType>
+ <list itemType="positiveInteger"/>
+ </simpleType>
+ </element>
+ </sequence>
+ </complexType>
+ </element>
+
+
+</schema>
diff --git a/sdo-cpp/trunk/runtime/core/test/b48686_xml.txt b/sdo-cpp/trunk/runtime/core/test/b48686_xml.txt
new file mode 100644
index 0000000000..5787ddb69c
--- /dev/null
+++ b/sdo-cpp/trunk/runtime/core/test/b48686_xml.txt
@@ -0,0 +1,46 @@
+***** TYPES AFTER RESOLVE*********************************
+Type:commonj.sdo#Boolean
+Type:commonj.sdo#Byte
+Type:commonj.sdo#Bytes
+Type:commonj.sdo#ChangeSummary
+Type:commonj.sdo#Character
+Type:commonj.sdo#DataObject
+Type:commonj.sdo#Date
+Type:commonj.sdo#Decimal
+Type:commonj.sdo#Double
+Type:commonj.sdo#Float
+Type:commonj.sdo#Int
+Type:commonj.sdo#Integer
+Type:commonj.sdo#Long
+Type:commonj.sdo#OpenDataObject
+Type:commonj.sdo#Short
+Type:commonj.sdo#String
+Type:commonj.sdo#URI
+Type:http://www.wrox.com/name#RootType
+Property:name of type name
+Type:http://www.wrox.com/name#ages
+Property:values (many) of type Integer
+Type:http://www.wrox.com/name#name
+Property:first of type String
+Property:middle of type String
+Property:last of type String
+Property:ages (many) of type ages
+*******************************END TYPES******************
+===== DataObject contents =====
+first:string:John
+
+middle:string:Fitzgerald
+
+last:string:Doe
+
+ages: list dataObject[0]=
+===== DataObject contents =====
+values: list string[0]=1
+
+string[1]=2
+
+string[2]=3
+
+===== End DataObject =====
+
+===== End DataObject =====
diff --git a/sdo-cpp/trunk/runtime/core/test/b48686_xsd.txt b/sdo-cpp/trunk/runtime/core/test/b48686_xsd.txt
new file mode 100644
index 0000000000..4fb99bfaae
--- /dev/null
+++ b/sdo-cpp/trunk/runtime/core/test/b48686_xsd.txt
@@ -0,0 +1,28 @@
+***** TYPES BEFORE RESOLVE **********************************
+Type:commonj.sdo#Boolean
+Type:commonj.sdo#Byte
+Type:commonj.sdo#Bytes
+Type:commonj.sdo#ChangeSummary
+Type:commonj.sdo#Character
+Type:commonj.sdo#DataObject
+Type:commonj.sdo#Date
+Type:commonj.sdo#Decimal
+Type:commonj.sdo#Double
+Type:commonj.sdo#Float
+Type:commonj.sdo#Int
+Type:commonj.sdo#Integer
+Type:commonj.sdo#Long
+Type:commonj.sdo#OpenDataObject
+Type:commonj.sdo#Short
+Type:commonj.sdo#String
+Type:commonj.sdo#URI
+Type:http://www.wrox.com/name#RootType
+Property:name of type name
+Type:http://www.wrox.com/name#ages
+Property:values (many) of type Integer
+Type:http://www.wrox.com/name#name
+Property:first of type String
+Property:middle of type String
+Property:last of type String
+Property:ages (many) of type ages
+*******************************END TYPES******************
diff --git a/sdo-cpp/trunk/runtime/core/test/badelement.txt b/sdo-cpp/trunk/runtime/core/test/badelement.txt
new file mode 100644
index 0000000000..f9ddc1e3b1
--- /dev/null
+++ b/sdo-cpp/trunk/runtime/core/test/badelement.txt
@@ -0,0 +1,2 @@
+BADELEMENT correctly found errors:
+Parser found unknown element ThisJustAintPartOfTheSchema
diff --git a/sdo-cpp/trunk/runtime/core/test/bothgroups.xsd b/sdo-cpp/trunk/runtime/core/test/bothgroups.xsd
new file mode 100644
index 0000000000..36d1b8f047
--- /dev/null
+++ b/sdo-cpp/trunk/runtime/core/test/bothgroups.xsd
@@ -0,0 +1,44 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ Licensed to the Apache Software Foundation (ASF) under one
+ or more contributor license agreements. See the NOTICE file
+ distributed with this work for additional information
+ regarding copyright ownership. The ASF licenses this file
+ to you 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.
+-->
+
+
+<schema xmlns="http://www.w3.org/2001/XMLSchema" targetNamespace="http://www.wrox.com/name"
+xmlns:target="http://www.wrox.com/name" elementFormDefault="qualified">
+ <group name="NameGroup">
+ <sequence>
+ <element name="first" type="string"/>
+ <element name="middle" type="string"/>
+ <element name="last" type="string"/>
+ </sequence>
+ </group>
+ <attributeGroup name="NameAttributeGroup">
+ <attribute name="firstattribute" type="string"/>
+ <attribute name="secondattribute" type="string"/>
+ <attribute name="thirdattribute" type="string"/>
+ </attributeGroup>
+ <element name="name">
+ <complexType>
+ <group ref="target:NameGroup"/>
+ <attribute name="title" type="string"/>
+ <attributeGroup ref="target:NameAttributeGroup"/>
+ </complexType>
+ </element>
+
+</schema>
diff --git a/sdo-cpp/trunk/runtime/core/test/bothgroups_xsd.txt b/sdo-cpp/trunk/runtime/core/test/bothgroups_xsd.txt
new file mode 100644
index 0000000000..a6c6d2f078
--- /dev/null
+++ b/sdo-cpp/trunk/runtime/core/test/bothgroups_xsd.txt
@@ -0,0 +1,29 @@
+***** TYPES BEFORE RESOLVE **********************************
+Type:commonj.sdo#Boolean
+Type:commonj.sdo#Byte
+Type:commonj.sdo#Bytes
+Type:commonj.sdo#ChangeSummary
+Type:commonj.sdo#Character
+Type:commonj.sdo#DataObject
+Type:commonj.sdo#Date
+Type:commonj.sdo#Decimal
+Type:commonj.sdo#Double
+Type:commonj.sdo#Float
+Type:commonj.sdo#Int
+Type:commonj.sdo#Integer
+Type:commonj.sdo#Long
+Type:commonj.sdo#OpenDataObject
+Type:commonj.sdo#Short
+Type:commonj.sdo#String
+Type:commonj.sdo#URI
+Type:http://www.wrox.com/name#RootType
+Property:name of type name
+Type:http://www.wrox.com/name#name
+Property:first of type String
+Property:middle of type String
+Property:last of type String
+Property:title of type String
+Property:firstattribute of type String
+Property:secondattribute of type String
+Property:thirdattribute of type String
+*******************************END TYPES******************
diff --git a/sdo-cpp/trunk/runtime/core/test/bothgroupssamename.xsd b/sdo-cpp/trunk/runtime/core/test/bothgroupssamename.xsd
new file mode 100644
index 0000000000..0ccdf615f0
--- /dev/null
+++ b/sdo-cpp/trunk/runtime/core/test/bothgroupssamename.xsd
@@ -0,0 +1,44 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ Licensed to the Apache Software Foundation (ASF) under one
+ or more contributor license agreements. See the NOTICE file
+ distributed with this work for additional information
+ regarding copyright ownership. The ASF licenses this file
+ to you 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.
+-->
+
+
+<schema xmlns="http://www.w3.org/2001/XMLSchema" targetNamespace="http://www.wrox.com/name"
+xmlns:target="http://www.wrox.com/name" elementFormDefault="qualified">
+ <group name="NameGroup">
+ <sequence>
+ <element name="first" type="string"/>
+ <element name="middle" type="string"/>
+ <element name="last" type="string"/>
+ </sequence>
+ </group>
+ <attributeGroup name="NameGroup">
+ <attribute name="firstattribute" type="string"/>
+ <attribute name="secondattribute" type="string"/>
+ <attribute name="thirdattribute" type="string"/>
+ </attributeGroup>
+ <element name="name">
+ <complexType>
+ <group ref="target:NameGroup"/>
+ <attribute name="title" type="string"/>
+ <attributeGroup ref="target:NameGroup"/>
+ </complexType>
+ </element>
+
+</schema>
diff --git a/sdo-cpp/trunk/runtime/core/test/bothgroupssamename_xsd.txt b/sdo-cpp/trunk/runtime/core/test/bothgroupssamename_xsd.txt
new file mode 100644
index 0000000000..a6c6d2f078
--- /dev/null
+++ b/sdo-cpp/trunk/runtime/core/test/bothgroupssamename_xsd.txt
@@ -0,0 +1,29 @@
+***** TYPES BEFORE RESOLVE **********************************
+Type:commonj.sdo#Boolean
+Type:commonj.sdo#Byte
+Type:commonj.sdo#Bytes
+Type:commonj.sdo#ChangeSummary
+Type:commonj.sdo#Character
+Type:commonj.sdo#DataObject
+Type:commonj.sdo#Date
+Type:commonj.sdo#Decimal
+Type:commonj.sdo#Double
+Type:commonj.sdo#Float
+Type:commonj.sdo#Int
+Type:commonj.sdo#Integer
+Type:commonj.sdo#Long
+Type:commonj.sdo#OpenDataObject
+Type:commonj.sdo#Short
+Type:commonj.sdo#String
+Type:commonj.sdo#URI
+Type:http://www.wrox.com/name#RootType
+Property:name of type name
+Type:http://www.wrox.com/name#name
+Property:first of type String
+Property:middle of type String
+Property:last of type String
+Property:title of type String
+Property:firstattribute of type String
+Property:secondattribute of type String
+Property:thirdattribute of type String
+*******************************END TYPES******************
diff --git a/sdo-cpp/trunk/runtime/core/test/bug2.txt b/sdo-cpp/trunk/runtime/core/test/bug2.txt
new file mode 100644
index 0000000000..aae01a0c9c
--- /dev/null
+++ b/sdo-cpp/trunk/runtime/core/test/bug2.txt
@@ -0,0 +1,9 @@
+MObject Property companies
+Property:name:Acme
+End of MObject Property companies
+MObject Property companies
+End of MObject Property companies
+Change summary should have no entries...
+MObject Property companies
+End of MObject Property companies
+Change summary should have no entries...
diff --git a/sdo-cpp/trunk/runtime/core/test/bug45933-output.txt b/sdo-cpp/trunk/runtime/core/test/bug45933-output.txt
new file mode 100644
index 0000000000..d1ad084eea
--- /dev/null
+++ b/sdo-cpp/trunk/runtime/core/test/bug45933-output.txt
@@ -0,0 +1,2 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<tns:company xsi:type="tns:CompanyType" xmlns:tns="companyNS" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" name="Bug45933"><sdo:changeSummary xmlns:sdo="commonj.sdo"><company sdo:ref="#/"><bools>false</bools></company></sdo:changeSummary></tns:company>
diff --git a/sdo-cpp/trunk/runtime/core/test/bug48300.xml b/sdo-cpp/trunk/runtime/core/test/bug48300.xml
new file mode 100644
index 0000000000..e4b79cdf2f
--- /dev/null
+++ b/sdo-cpp/trunk/runtime/core/test/bug48300.xml
@@ -0,0 +1,174 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ Licensed to the Apache Software Foundation (ASF) under one
+ or more contributor license agreements. See the NOTICE file
+ distributed with this work for additional information
+ regarding copyright ownership. The ASF licenses this file
+ to you 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.
+-->
+
+
+<template:template xmlns:template="http://www.ibm.com/xmlns/prod/ct/ctdl-template/v1.0.0/" name="CTShop" version="1.0.0">
+ <description>This is my online shop</description>
+ <displayName>The CT Shop</displayName>
+ <templateType>php</templateType>
+ <verifiers/>
+ <globalHelperArguments>
+ </globalHelperArguments>
+ <unboundTemplateParameters name="name" expert="false" multiplicity="1..1">
+ <description>
+ <description>Name for the shop</description>
+ <displayName>Shop Name</displayName>
+ </description>
+ <verifiers>
+ </verifiers>
+ <constraints>
+ </constraints>
+ <defaults>
+ <description></description>
+ <displayName>CT Shop</displayName>
+ <data>CT Shop</data>
+ </defaults>
+ </unboundTemplateParameters>
+ <unboundTemplateParameters name="branding" expert="false" multiplicity="1..1">
+ <description>
+ <description>Colour of background for Shop</description>
+ <displayName>Branding</displayName>
+ </description>
+ <verifiers>
+ </verifiers>
+ <constraints>
+ <description></description>
+ <displayName>Olive</displayName>
+ <data>Olive</data>
+ </constraints>
+ <constraints>
+ <description></description>
+ <displayName>Lime</displayName>
+ <data>Lime</data>
+ </constraints>
+ <constraints>
+ <description></description>
+ <displayName>Gray</displayName>
+ <data>Gray</data>
+ </constraints>
+ <constraints>
+ <description></description>
+ <displayName>Teal</displayName>
+ <data>Teal</data>
+ </constraints>
+ <constraints>
+ <description></description>
+ <displayName>Silver</displayName>
+ <data>Silver</data>
+ </constraints>
+ <constraints>
+ <description></description>
+ <displayName>White</displayName>
+ <data>White</data>
+ </constraints>
+ <defaults>
+ <description></description>
+ <displayName>Olive</displayName>
+ <data>Olive</data>
+ </defaults>
+ </unboundTemplateParameters>
+ <unboundTemplateParameters name="catalog" expert="false" multiplicity="1..1">
+ <description>
+ <description>Product Catalog for the shop</description>
+ <displayName>Product Catalog</displayName>
+ </description>
+ <verifiers>
+ </verifiers>
+ <constraints>
+ </constraints>
+ <factory kind="php" name="CatalogFactory">
+ </factory>
+ <defaults>
+ <description></description>
+ <displayName>Catalog</displayName>
+ <data>Catalog</data>
+ </defaults>
+ </unboundTemplateParameters>
+ <unboundTemplateParameters name="cart" expert="false" multiplicity="1..1">
+ <description>
+ <description>Shopping cart for the shop</description>
+ <displayName>Shopping Cart</displayName>
+ </description>
+ <verifiers>
+ </verifiers>
+ <constraints>
+ <description></description>
+ <displayName>Cart</displayName>
+ <data>Cart</data>
+ </constraints>
+ <constraints>
+ <description></description>
+ <displayName>GCCart</displayName>
+ <data>GCCart</data>
+ </constraints>
+ <constraints>
+ <description></description>
+ <displayName>MyCart</displayName>
+ <data>MyCart</data>
+ </constraints>
+ <factory kind="php" name="CartFactory">
+ </factory>
+ <defaults>
+ <description></description>
+ <displayName>Cart</displayName>
+ <data>Cart</data>
+ </defaults>
+ </unboundTemplateParameters>
+ <unboundTemplateParameters name="payment" expert="false" multiplicity="1..1">
+ <description>
+ <description>Payment Modules for the shop</description>
+ <displayName>Payment Module</displayName>
+ </description>
+ <verifiers>
+ </verifiers>
+ <constraints>
+ <description></description>
+ <displayName>MyPayPal</displayName>
+ <data>MyPayPal</data>
+ </constraints>
+ <constraints>
+ <description></description>
+ <displayName>PayPal</displayName>
+ <data>PayPal</data>
+ </constraints>
+ <constraints>
+ <description></description>
+ <displayName>USPayPal</displayName>
+ <data>USPayPal</data>
+ </constraints>
+ <constraints>
+ <description></description>
+ <displayName>MyStormPay</displayName>
+ <data>MyStormPay</data>
+ </constraints>
+ <constraints>
+ <description></description>
+ <displayName>StormPay</displayName>
+ <data>StormPay</data>
+ </constraints>
+ <factory kind="php" name="PaymentFactory">
+ </factory>
+ <defaults>
+ <description></description>
+ <displayName>PayPal</displayName>
+ <data>PayPal</data>
+ </defaults>
+ </unboundTemplateParameters>
+ </template:template> \ No newline at end of file
diff --git a/sdo-cpp/trunk/runtime/core/test/bug48300.xsd b/sdo-cpp/trunk/runtime/core/test/bug48300.xsd
new file mode 100644
index 0000000000..e0e69eebf1
--- /dev/null
+++ b/sdo-cpp/trunk/runtime/core/test/bug48300.xsd
@@ -0,0 +1,84 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ Licensed to the Apache Software Foundation (ASF) under one
+ or more contributor license agreements. See the NOTICE file
+ distributed with this work for additional information
+ regarding copyright ownership. The ASF licenses this file
+ to you 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.
+-->
+
+
+<schema xmlns="http://www.w3.org/2001/XMLSchema"
+ xmlns:template="http://www.ibm.com/xmlns/prod/ct/ctdl-template/v1.0.0/"
+ targetNamespace="http://www.ibm.com/xmlns/prod/ct/ctdl-template/v1.0.0/">
+
+ <element name="template" type="template:TemplateType">
+ <complexType name="TemplateType">
+ <sequence>
+ <element name="displayName" type="string"/>
+ <element name="templateType" type="string"/>
+ <element name="description" type="string"/>
+ <element name="expert" type="string"/>
+ <element name="icon" type="string"/>
+ <element name="verifiers" minOccurs="0" maxOccurs="unbounded" type="string"/>
+ <element name="globalHelperArguments" minOccurs="0" maxOccurs="unbounded" type="string"/>
+ <element name="unboundTemplateParameters" minOccurs="0" maxOccurs="unbounded" ref="template:unboundTemplateParameter"/>
+ <attribute name="name" type="string"/>
+ <attribute name="version" type="string"/>
+ </sequence>
+ </complexType>
+ </element>
+
+ <element name="unboundTemplateParameter">
+ <complexType>
+ <element name="description" minOccurs="0" maxOccurs="1" ref="template:description"/>
+ <element name="verifiers" minOccurs="0" maxOccurs="unbounded" type="string"/>
+ <element name="constraints" minOccurs="0" maxOccurs="unbounded" ref="template:value"/>
+ <element name="factory" minOccurs="0" maxOccurs="1" ref="template:factory"/>
+ <element name="defaults" minOccurs="0" maxOccurs="unbounded" ref="template:value"/>
+ <attribute name="name" type="string"/>
+ <attribute name="expert" type="string"/>
+ <attribute name="multiplicity" type="string"/>
+ </complexType>
+ </element>
+
+ <element name="description">
+ <complexType>
+ <element name="description" type="string"/>
+ <element name="displayName" type="string"/>
+ </complexType>
+ </element>
+
+ <element name="factory">
+ <complexType>
+ <attribute name="kind" type="string"/>
+ <attribute name="name" type="string"/>
+ </complexType>
+ </element>
+
+ <element name="valueprovider">
+ <complexType>
+ <element name="values" minOccurs="0" maxOccurs="unbounded" ref="template:value"/>
+ </complexType>
+ </element>
+
+ <element name="value">
+ <complexType>
+ <element name="description" type="string"/>
+ <element name="displayName" type="string"/>
+ <element name="data" type="string"/>
+ </complexType>
+ </element>
+
+</schema>
diff --git a/sdo-cpp/trunk/runtime/core/test/bug48300_xml.txt b/sdo-cpp/trunk/runtime/core/test/bug48300_xml.txt
new file mode 100644
index 0000000000..10e80c19e6
--- /dev/null
+++ b/sdo-cpp/trunk/runtime/core/test/bug48300_xml.txt
@@ -0,0 +1,424 @@
+***** TYPES AFTER RESOLVE*********************************
+Type:commonj.sdo#Boolean
+Type:commonj.sdo#Byte
+Type:commonj.sdo#Bytes
+Type:commonj.sdo#ChangeSummary
+Type:commonj.sdo#Character
+Type:commonj.sdo#DataObject
+Type:commonj.sdo#Date
+Type:commonj.sdo#Decimal
+Type:commonj.sdo#Double
+Type:commonj.sdo#Float
+Type:commonj.sdo#Int
+Type:commonj.sdo#Integer
+Type:commonj.sdo#Long
+Type:commonj.sdo#OpenDataObject
+Type:commonj.sdo#Short
+Type:commonj.sdo#String
+Type:commonj.sdo#URI
+Type:http://www.ibm.com/xmlns/prod/ct/ctdl-template/v1.0.0/#RootType
+Property:template of type TemplateType
+Property:unboundTemplateParameter of type unboundTemplateParameter
+Property:description of type description
+Property:factory of type factory
+Property:valueprovider of type valueprovider
+Property:value of type value
+Type:http://www.ibm.com/xmlns/prod/ct/ctdl-template/v1.0.0/#TemplateType
+Property:displayName of type String
+Property:templateType of type String
+Property:description of type String
+Property:expert of type String
+Property:icon of type String
+Property:verifiers (many) of type String
+Property:globalHelperArguments (many) of type String
+Property:unboundTemplateParameters (many) of type unboundTemplateParameter
+Property:name of type String
+Property:version of type String
+Type:http://www.ibm.com/xmlns/prod/ct/ctdl-template/v1.0.0/#description
+Property:description of type String
+Property:displayName of type String
+Type:http://www.ibm.com/xmlns/prod/ct/ctdl-template/v1.0.0/#factory
+Property:kind of type String
+Property:name of type String
+Type:http://www.ibm.com/xmlns/prod/ct/ctdl-template/v1.0.0/#unboundTemplateParameter
+Property:description of type description
+Property:verifiers (many) of type String
+Property:constraints (many) of type value
+Property:factory of type factory
+Property:defaults (many) of type value
+Property:name of type String
+Property:expert of type String
+Property:multiplicity of type String
+Type:http://www.ibm.com/xmlns/prod/ct/ctdl-template/v1.0.0/#value
+Property:description of type String
+Property:displayName of type String
+Property:data of type String
+Type:http://www.ibm.com/xmlns/prod/ct/ctdl-template/v1.0.0/#valueprovider
+Property:values (many) of type value
+*******************************END TYPES******************
+===== DataObject contents =====
+displayName:string:The CT Shop
+
+templateType:string:php
+
+description:string:This is my online shop
+
+expert:string:
+
+icon:string:
+
+verifiers: list string[0]=
+
+globalHelperArguments: list string[0]=
+
+
+unboundTemplateParameters: list dataObject[0]=
+===== DataObject contents =====
+description:dataObject
+===== DataObject contents =====
+description:string:Name for the shop
+
+displayName:string:Shop Name
+
+===== End DataObject =====
+
+verifiers: list string[0]=
+
+
+constraints: list dataObject[0]=
+===== DataObject contents =====
+description:string:
+
+displayName:string:
+
+data:string:
+
+===== End DataObject =====
+
+factory:dataObject
+ - null or unset
+
+defaults: list dataObject[0]=
+===== DataObject contents =====
+description:string:
+
+displayName:string:CT Shop
+
+data:string:CT Shop
+
+===== End DataObject =====
+
+name:string:name
+
+expert:string:false
+
+multiplicity:string:1..1
+
+===== End DataObject =====
+
+dataObject[1]=
+===== DataObject contents =====
+description:dataObject
+===== DataObject contents =====
+description:string:Colour of background for Shop
+
+displayName:string:Branding
+
+===== End DataObject =====
+
+verifiers: list string[0]=
+
+
+constraints: list dataObject[0]=
+===== DataObject contents =====
+description:string:
+
+displayName:string:Olive
+
+data:string:Olive
+
+===== End DataObject =====
+
+dataObject[1]=
+===== DataObject contents =====
+description:string:
+
+displayName:string:Lime
+
+data:string:Lime
+
+===== End DataObject =====
+
+dataObject[2]=
+===== DataObject contents =====
+description:string:
+
+displayName:string:Gray
+
+data:string:Gray
+
+===== End DataObject =====
+
+dataObject[3]=
+===== DataObject contents =====
+description:string:
+
+displayName:string:Teal
+
+data:string:Teal
+
+===== End DataObject =====
+
+dataObject[4]=
+===== DataObject contents =====
+description:string:
+
+displayName:string:Silver
+
+data:string:Silver
+
+===== End DataObject =====
+
+dataObject[5]=
+===== DataObject contents =====
+description:string:
+
+displayName:string:White
+
+data:string:White
+
+===== End DataObject =====
+
+factory:dataObject
+ - null or unset
+
+defaults: list dataObject[0]=
+===== DataObject contents =====
+description:string:
+
+displayName:string:Olive
+
+data:string:Olive
+
+===== End DataObject =====
+
+name:string:branding
+
+expert:string:false
+
+multiplicity:string:1..1
+
+===== End DataObject =====
+
+dataObject[2]=
+===== DataObject contents =====
+description:dataObject
+===== DataObject contents =====
+description:string:Product Catalog for the shop
+
+displayName:string:Product Catalog
+
+===== End DataObject =====
+
+verifiers: list string[0]=
+
+
+constraints: list dataObject[0]=
+===== DataObject contents =====
+description:string:
+
+displayName:string:
+
+data:string:
+
+===== End DataObject =====
+
+factory:dataObject
+===== DataObject contents =====
+kind:string:php
+
+name:string:CatalogFactory
+
+===== End DataObject =====
+
+defaults: list dataObject[0]=
+===== DataObject contents =====
+description:string:
+
+displayName:string:Catalog
+
+data:string:Catalog
+
+===== End DataObject =====
+
+name:string:catalog
+
+expert:string:false
+
+multiplicity:string:1..1
+
+===== End DataObject =====
+
+dataObject[3]=
+===== DataObject contents =====
+description:dataObject
+===== DataObject contents =====
+description:string:Shopping cart for the shop
+
+displayName:string:Shopping Cart
+
+===== End DataObject =====
+
+verifiers: list string[0]=
+
+
+constraints: list dataObject[0]=
+===== DataObject contents =====
+description:string:
+
+displayName:string:Cart
+
+data:string:Cart
+
+===== End DataObject =====
+
+dataObject[1]=
+===== DataObject contents =====
+description:string:
+
+displayName:string:GCCart
+
+data:string:GCCart
+
+===== End DataObject =====
+
+dataObject[2]=
+===== DataObject contents =====
+description:string:
+
+displayName:string:MyCart
+
+data:string:MyCart
+
+===== End DataObject =====
+
+factory:dataObject
+===== DataObject contents =====
+kind:string:php
+
+name:string:CartFactory
+
+===== End DataObject =====
+
+defaults: list dataObject[0]=
+===== DataObject contents =====
+description:string:
+
+displayName:string:Cart
+
+data:string:Cart
+
+===== End DataObject =====
+
+name:string:cart
+
+expert:string:false
+
+multiplicity:string:1..1
+
+===== End DataObject =====
+
+dataObject[4]=
+===== DataObject contents =====
+description:dataObject
+===== DataObject contents =====
+description:string:Payment Modules for the shop
+
+displayName:string:Payment Module
+
+===== End DataObject =====
+
+verifiers: list string[0]=
+
+
+constraints: list dataObject[0]=
+===== DataObject contents =====
+description:string:
+
+displayName:string:MyPayPal
+
+data:string:MyPayPal
+
+===== End DataObject =====
+
+dataObject[1]=
+===== DataObject contents =====
+description:string:
+
+displayName:string:PayPal
+
+data:string:PayPal
+
+===== End DataObject =====
+
+dataObject[2]=
+===== DataObject contents =====
+description:string:
+
+displayName:string:USPayPal
+
+data:string:USPayPal
+
+===== End DataObject =====
+
+dataObject[3]=
+===== DataObject contents =====
+description:string:
+
+displayName:string:MyStormPay
+
+data:string:MyStormPay
+
+===== End DataObject =====
+
+dataObject[4]=
+===== DataObject contents =====
+description:string:
+
+displayName:string:StormPay
+
+data:string:StormPay
+
+===== End DataObject =====
+
+factory:dataObject
+===== DataObject contents =====
+kind:string:php
+
+name:string:PaymentFactory
+
+===== End DataObject =====
+
+defaults: list dataObject[0]=
+===== DataObject contents =====
+description:string:
+
+displayName:string:PayPal
+
+data:string:PayPal
+
+===== End DataObject =====
+
+name:string:payment
+
+expert:string:false
+
+multiplicity:string:1..1
+
+===== End DataObject =====
+
+name:string:CTShop
+
+version:string:1.0.0
+
+===== End DataObject =====
diff --git a/sdo-cpp/trunk/runtime/core/test/bug48300_xsd.txt b/sdo-cpp/trunk/runtime/core/test/bug48300_xsd.txt
new file mode 100644
index 0000000000..3c3589519f
--- /dev/null
+++ b/sdo-cpp/trunk/runtime/core/test/bug48300_xsd.txt
@@ -0,0 +1,58 @@
+***** TYPES BEFORE RESOLVE **********************************
+Type:commonj.sdo#Boolean
+Type:commonj.sdo#Byte
+Type:commonj.sdo#Bytes
+Type:commonj.sdo#ChangeSummary
+Type:commonj.sdo#Character
+Type:commonj.sdo#DataObject
+Type:commonj.sdo#Date
+Type:commonj.sdo#Decimal
+Type:commonj.sdo#Double
+Type:commonj.sdo#Float
+Type:commonj.sdo#Int
+Type:commonj.sdo#Integer
+Type:commonj.sdo#Long
+Type:commonj.sdo#OpenDataObject
+Type:commonj.sdo#Short
+Type:commonj.sdo#String
+Type:commonj.sdo#URI
+Type:http://www.ibm.com/xmlns/prod/ct/ctdl-template/v1.0.0/#RootType
+Property:template of type TemplateType
+Property:unboundTemplateParameter of type unboundTemplateParameter
+Property:description of type description
+Property:factory of type factory
+Property:valueprovider of type valueprovider
+Property:value of type value
+Type:http://www.ibm.com/xmlns/prod/ct/ctdl-template/v1.0.0/#TemplateType
+Property:displayName of type String
+Property:templateType of type String
+Property:description of type String
+Property:expert of type String
+Property:icon of type String
+Property:verifiers (many) of type String
+Property:globalHelperArguments (many) of type String
+Property:unboundTemplateParameters (many) of type unboundTemplateParameter
+Property:name of type String
+Property:version of type String
+Type:http://www.ibm.com/xmlns/prod/ct/ctdl-template/v1.0.0/#description
+Property:description of type String
+Property:displayName of type String
+Type:http://www.ibm.com/xmlns/prod/ct/ctdl-template/v1.0.0/#factory
+Property:kind of type String
+Property:name of type String
+Type:http://www.ibm.com/xmlns/prod/ct/ctdl-template/v1.0.0/#unboundTemplateParameter
+Property:description of type description
+Property:verifiers (many) of type String
+Property:constraints (many) of type value
+Property:factory of type factory
+Property:defaults (many) of type value
+Property:name of type String
+Property:expert of type String
+Property:multiplicity of type String
+Type:http://www.ibm.com/xmlns/prod/ct/ctdl-template/v1.0.0/#value
+Property:description of type String
+Property:displayName of type String
+Property:data of type String
+Type:http://www.ibm.com/xmlns/prod/ct/ctdl-template/v1.0.0/#valueprovider
+Property:values (many) of type value
+*******************************END TYPES******************
diff --git a/sdo-cpp/trunk/runtime/core/test/bugs/1/company.xml b/sdo-cpp/trunk/runtime/core/test/bugs/1/company.xml
new file mode 100644
index 0000000000..7fd3b119e6
--- /dev/null
+++ b/sdo-cpp/trunk/runtime/core/test/bugs/1/company.xml
@@ -0,0 +1,41 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ Licensed to the Apache Software Foundation (ASF) under one
+ or more contributor license agreements. See the NOTICE file
+ distributed with this work for additional information
+ regarding copyright ownership. The ASF licenses this file
+ to you 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.
+-->
+
+
+<mci:company xmlns:mci="http://www.mycompanyinc.com"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://www.mycompanyinc.com company.xsd"
+ version="0.0.1">
+ <mci:employees>
+ <mci:employee>
+ <mci:id>1</mci:id>
+ <mci:name>Mary Kay</mci:name>
+ </mci:employee>
+ </mci:employees>
+ <mci:departments>
+ <mci:department>
+ <mci:id>3</mci:id>
+ <mci:name>Sales</mci:name>
+ <mci:employeesList>
+ <mci:ids>1</mci:ids>
+ </mci:employeesList>
+ </mci:department>
+ </mci:departments>
+</mci:company> \ No newline at end of file
diff --git a/sdo-cpp/trunk/runtime/core/test/bugs/1/company.xsd b/sdo-cpp/trunk/runtime/core/test/bugs/1/company.xsd
new file mode 100644
index 0000000000..f5fd88a424
--- /dev/null
+++ b/sdo-cpp/trunk/runtime/core/test/bugs/1/company.xsd
@@ -0,0 +1,64 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ Licensed to the Apache Software Foundation (ASF) under one
+ or more contributor license agreements. See the NOTICE file
+ distributed with this work for additional information
+ regarding copyright ownership. The ASF licenses this file
+ to you 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.
+-->
+
+
+<xsd:schema targetNamespace="http://www.mycompanyinc.com"
+ xmlns:xsd="http://www.w3.org/2001/XMLSchema"
+ xmlns:mci="http://www.mycompanyinc.com" elementFormDefault="qualified"
+ version="0.0.1">
+ <xsd:complexType name="employeesListType">
+ <xsd:sequence>
+ <xsd:element name="ids" type="xsd:string" minOccurs="0"
+ maxOccurs="unbounded" />
+ </xsd:sequence>
+ </xsd:complexType>
+ <xsd:complexType name="employeeType">
+ <xsd:sequence>
+ <xsd:element name="id" type="xsd:string" />
+ <xsd:element name="name" type="xsd:string" />
+ </xsd:sequence>
+ </xsd:complexType>
+ <xsd:complexType name="departmentType">
+ <xsd:sequence>
+ <xsd:element name="id" type="xsd:string" />
+ <xsd:element name="name" type="xsd:string" />
+ <xsd:element name="employeesList" type="mci:employeesListType" />
+ </xsd:sequence>
+ </xsd:complexType>
+ <xsd:complexType name="employeesType">
+ <xsd:sequence>
+ <xsd:element name="employee" type="mci:employeeType" maxOccurs="unbounded" />
+ </xsd:sequence>
+ </xsd:complexType>
+ <xsd:complexType name="departmentsType">
+ <xsd:sequence>
+ <xsd:element name="department" type="mci:departmentType" minOccurs="0"
+ maxOccurs="unbounded" />
+ </xsd:sequence>
+ </xsd:complexType>
+ <xsd:complexType name="companyType">
+ <xsd:sequence>
+ <xsd:element name="employees" type="mci:employeesType" />
+ <xsd:element name="departments" type="mci:departmentsType" />
+ </xsd:sequence>
+ <xsd:attribute name="version" type="xsd:string" use="required" />
+ </xsd:complexType>
+ <xsd:element name="company" type="mci:companyType" />
+</xsd:schema> \ No newline at end of file
diff --git a/sdo-cpp/trunk/runtime/core/test/bugs/1/include.xsd b/sdo-cpp/trunk/runtime/core/test/bugs/1/include.xsd
new file mode 100644
index 0000000000..16089cecae
--- /dev/null
+++ b/sdo-cpp/trunk/runtime/core/test/bugs/1/include.xsd
@@ -0,0 +1,69 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ Licensed to the Apache Software Foundation (ASF) under one
+ or more contributor license agreements. See the NOTICE file
+ distributed with this work for additional information
+ regarding copyright ownership. The ASF licenses this file
+ to you 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.
+-->
+
+
+<xsd:schema targetNamespace="http://www.mycompanyinc.com"
+ xmlns:xsd="http://www.w3.org/2001/XMLSchema"
+ xmlns:mci="http://www.mycompanyinc.com" elementFormDefault="qualified"
+ version="0.0.1">
+
+ <xsd:include schemaLocation="c:/absolute-drivel/ok1.xsd" />
+ <xsd:include schemaLocation="ok2.xsd" />
+ <xsd:include schemaLocation="c:\\absolute-tosh\\ok3.xsd" />
+
+ <xsd:complexType name="employeesListType">
+ <xsd:sequence>
+ <xsd:element name="ids" type="xsd:string" minOccurs="0"
+ maxOccurs="unbounded" />
+ </xsd:sequence>
+ </xsd:complexType>
+ <xsd:complexType name="employeeType">
+ <xsd:sequence>
+ <xsd:element name="id" type="xsd:string" />
+ <xsd:element name="name" type="xsd:string" />
+ </xsd:sequence>
+ </xsd:complexType>
+ <xsd:complexType name="departmentType">
+ <xsd:sequence>
+ <xsd:element name="id" type="xsd:string" />
+ <xsd:element name="name" type="xsd:string" />
+ <xsd:element name="employeesList" type="mci:employeesListType" />
+ </xsd:sequence>
+ </xsd:complexType>
+ <xsd:complexType name="employeesType">
+ <xsd:sequence>
+ <xsd:element name="employee" type="mci:employeeType" maxOccurs="unbounded" />
+ </xsd:sequence>
+ </xsd:complexType>
+ <xsd:complexType name="departmentsType">
+ <xsd:sequence>
+ <xsd:element name="department" type="mci:departmentType" minOccurs="0"
+ maxOccurs="unbounded" />
+ </xsd:sequence>
+ </xsd:complexType>
+ <xsd:complexType name="companyType">
+ <xsd:sequence>
+ <xsd:element name="employees" type="mci:employeesType" />
+ <xsd:element name="departments" type="mci:departmentsType" />
+ </xsd:sequence>
+ <xsd:attribute name="version" type="xsd:string" use="required" />
+ </xsd:complexType>
+ <xsd:element name="company" type="mci:companyType" />
+</xsd:schema> \ No newline at end of file
diff --git a/sdo-cpp/trunk/runtime/core/test/bugs/1/ok1.xsd b/sdo-cpp/trunk/runtime/core/test/bugs/1/ok1.xsd
new file mode 100644
index 0000000000..d24e5c39e7
--- /dev/null
+++ b/sdo-cpp/trunk/runtime/core/test/bugs/1/ok1.xsd
@@ -0,0 +1,34 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ Licensed to the Apache Software Foundation (ASF) under one
+ or more contributor license agreements. See the NOTICE file
+ distributed with this work for additional information
+ regarding copyright ownership. The ASF licenses this file
+ to you 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.
+-->
+
+
+
+<xsd:schema targetNamespace="http://www.mycompanyinc.com"
+ xmlns:xsd="http://www.w3.org/2001/XMLSchema"
+ xmlns:mci="http://www.mycompanyinc.com" elementFormDefault="qualified"
+ version="0.0.1">
+
+ <xsd:complexType name="ok1">
+ <xsd:sequence>
+ <xsd:element name="id" type="xsd:string" />
+ <xsd:element name="name" type="xsd:string" />
+ </xsd:sequence>
+ </xsd:complexType>
+</xsd:schema> \ No newline at end of file
diff --git a/sdo-cpp/trunk/runtime/core/test/bugs/1/ok2.xsd b/sdo-cpp/trunk/runtime/core/test/bugs/1/ok2.xsd
new file mode 100644
index 0000000000..3d90cbdec3
--- /dev/null
+++ b/sdo-cpp/trunk/runtime/core/test/bugs/1/ok2.xsd
@@ -0,0 +1,33 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ Licensed to the Apache Software Foundation (ASF) under one
+ or more contributor license agreements. See the NOTICE file
+ distributed with this work for additional information
+ regarding copyright ownership. The ASF licenses this file
+ to you 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.
+-->
+
+
+<xsd:schema targetNamespace="http://www.mycompanyinc.com"
+ xmlns:xsd="http://www.w3.org/2001/XMLSchema"
+ xmlns:mci="http://www.mycompanyinc.com" elementFormDefault="qualified"
+ version="0.0.1">
+
+ <xsd:complexType name="ok2">
+ <xsd:sequence>
+ <xsd:element name="id" type="xsd:string" />
+ <xsd:element name="name" type="xsd:string" />
+ </xsd:sequence>
+ </xsd:complexType>
+</xsd:schema> \ No newline at end of file
diff --git a/sdo-cpp/trunk/runtime/core/test/bugs/1/ok3.xsd b/sdo-cpp/trunk/runtime/core/test/bugs/1/ok3.xsd
new file mode 100644
index 0000000000..45d5db2ed4
--- /dev/null
+++ b/sdo-cpp/trunk/runtime/core/test/bugs/1/ok3.xsd
@@ -0,0 +1,32 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ Licensed to the Apache Software Foundation (ASF) under one
+ or more contributor license agreements. See the NOTICE file
+ distributed with this work for additional information
+ regarding copyright ownership. The ASF licenses this file
+ to you 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.
+-->
+
+<xsd:schema targetNamespace="http://www.mycompanyinc.com"
+ xmlns:xsd="http://www.w3.org/2001/XMLSchema"
+ xmlns:mci="http://www.mycompanyinc.com" elementFormDefault="qualified"
+ version="0.0.1">
+
+ <xsd:complexType name="ok3">
+ <xsd:sequence>
+ <xsd:element name="id" type="xsd:string" />
+ <xsd:element name="name" type="xsd:string" />
+ </xsd:sequence>
+ </xsd:complexType>
+</xsd:schema> \ No newline at end of file
diff --git a/sdo-cpp/trunk/runtime/core/test/build.xml b/sdo-cpp/trunk/runtime/core/test/build.xml
new file mode 100644
index 0000000000..51ad6d3453
--- /dev/null
+++ b/sdo-cpp/trunk/runtime/core/test/build.xml
@@ -0,0 +1,71 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ Licensed to the Apache Software Foundation (ASF) under one
+ or more contributor license agreements. See the NOTICE file
+ distributed with this work for additional information
+ regarding copyright ownership. The ASF licenses this file
+ to you 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.
+-->
+<project name="TuscanySdoNative_test" default="all" basedir="../../..">
+
+ <import file="${basedir}/antscripts/system.xml"/>
+ <import file="${basedir}/antscripts/compile-targets.xml"/>
+
+ <!--
+ Notice that the basedir for this project is set to the TuscanySDO root dir
+ This makes path setting in system.xml much simpler, but we'll just have to
+ set a property here to this directory.
+ -->
+ <property name="this.dir" location="${basedir}/runtime/core/test"/>
+ <property name="sdo.test.src.dir" location="${this.dir}"/>
+ <property name="sdo.test.build.dir" location="${this.dir}/build"/>
+ <property name="sdo.test.app" value="sdo_test"/>
+
+ <!--
+ Public targets
+ -->
+ <target name="all" description="compile, link, and run TuscanySdoNative test suite">
+ <antcall target="build"/>
+ <antcall target="run"/>
+ </target>
+
+ <target name="build" description="compile and link TuscanySdoNative test suite">
+ <cpp-build
+ srcdir="${sdo.test.src.dir}"
+ infiles="*.cpp"
+ outdir="${sdo.test.build.dir}"
+ outfile="${sdo.test.app}"
+ outtype="executable">
+ <custom-build-elements>
+ <includepath path="${sdo.impl.include.path}"/>
+ <defineset if="windows" define="_MBCS"/>
+ <libset dir="${sdo.impl.library.path}" libs="${sdo.impl.library.name}"/>
+ </custom-build-elements>
+ </cpp-build>
+
+ <cpp-install-file
+ srcfile="${sdo.test.app}${exe.ext}"
+ srcdir="${sdo.test.build.dir}"
+ destdir="${this.dir}"/>
+ </target>
+
+ <target name="run" depends="build" description="Run TuscanySdoNative test suite">
+ <exec executable="${this.dir}/${sdo.test.app}${exe.ext}" dir="${this.dir}"/>
+ </target>
+
+ <target name="clean" description="Clean TuscanySdoNative test suite">
+ <delete dir="${sdo.test.build.dir}" quiet="@{quiet}"/>
+ </target>
+
+</project>
diff --git a/sdo-cpp/trunk/runtime/core/test/bunique-out.txt b/sdo-cpp/trunk/runtime/core/test/bunique-out.txt
new file mode 100644
index 0000000000..0f156ad819
--- /dev/null
+++ b/sdo-cpp/trunk/runtime/core/test/bunique-out.txt
@@ -0,0 +1 @@
+<xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:sdo="commonj.sdo" xmlns:sdoxml="commonj.sdo/xml" xmlns:tns1="nottest" xmlns:tns="test" targetNamespace="test"><xsd:element name="duplicate" type="tns1:Duplicate"/><xsd:complexType name="tns1:Duplicate"><xsd:sequence><xsd:element name="ob" type="tns:Object" minOccurs="0"/></xsd:sequence><xsd:attribute name="id" type="xsd:int"/></xsd:complexType><xsd:element name="duplicate" type="Duplicate"/><xsd:complexType name="Duplicate"><xsd:sequence><xsd:element name="ob" type="tns:Object" minOccurs="0"/></xsd:sequence><xsd:attribute name="id" type="xsd:int"/></xsd:complexType><xsd:element name="object" type="Object"/><xsd:complexType name="Object"/><xsd:element name="root" type="Root"/><xsd:complexType name="Root"><xsd:sequence><xsd:element name="duplicate" type="tns:Duplicate" minOccurs="0"/><xsd:element name="duplicate2" type="tns1:Duplicate" minOccurs="0"/><xsd:element name="unique" type="tns:Unique" minOccurs="0"/><xsd:element name="duplicatelist" type="tns:Duplicate" minOccurs="0" maxOccurs="unbounded"/><xsd:element name="duplicatelist2" type="tns1:Duplicate" minOccurs="0" maxOccurs="unbounded"/><xsd:element name="uniquelist" type="tns:Unique" minOccurs="0" maxOccurs="unbounded"/></xsd:sequence></xsd:complexType><xsd:element name="unique" type="Unique"/><xsd:complexType name="Unique"><xsd:sequence><xsd:element name="ob" type="tns:Object" minOccurs="0"/></xsd:sequence><xsd:attribute name="id" type="xsd:int"/></xsd:complexType></xsd:schema> \ No newline at end of file
diff --git a/sdo-cpp/trunk/runtime/core/test/bunique-out.xsd_safe.txt b/sdo-cpp/trunk/runtime/core/test/bunique-out.xsd_safe.txt
new file mode 100644
index 0000000000..1b4c6bb7da
--- /dev/null
+++ b/sdo-cpp/trunk/runtime/core/test/bunique-out.xsd_safe.txt
@@ -0,0 +1,53 @@
+<xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:sdo="commonj.sdo" xmlns:sdoxml="commonj.sdo/xml"
+xmlns:tns1="nottest" xmlns:tns="test" targetNamespace="test">
+
+<xsd:element name="duplicate" type="tns1:Duplicate"/>
+
+<xsd:complexType name="tns1:Duplicate">
+
+<xsd:sequence>
+<xsd:element name="ob" type="tns:Object" minOccurs="0"/>
+</xsd:sequence>
+
+<xsd:attribute name="id" type="xsd:integer"/>
+
+</xsd:complexType>
+
+<xsd:element name="duplicate" type="Duplicate"/>
+
+<xsd:complexType name="Duplicate">
+<xsd:sequence>
+<xsd:element name="ob" type="tns:Object" minOccurs="0"/>
+</xsd:sequence>
+
+<xsd:attribute name="id" type="xsd:integer"/>
+
+</xsd:complexType>
+
+<xsd:element name="object" type="Object"/>
+
+<xsd:complexType name="Object"/>
+
+<xsd:element name="root" type="Root"/>
+
+<xsd:complexType name="Root">
+<xsd:sequence>
+<xsd:element name="duplicate" type="tns:Duplicate" minOccurs="0"/>
+<xsd:element name="duplicate2" type="tns1:Duplicate" minOccurs="0"/>
+<xsd:element name="unique" type="tns:Unique" minOccurs="0"/>
+<xsd:element name="duplicatelist" type="tns:Duplicate" minOccurs="0" maxOccurs="unbounded"/>
+<xsd:element name="duplicatelist2" type="tns1:Duplicate" minOccurs="0" maxOccurs="unbounded"/>
+<xsd:element name="uniquelist" type="tns:Unique" minOccurs="0" maxOccurs="unbounded"/>
+</xsd:sequence>
+</xsd:complexType>
+
+<xsd:element name="unique" type="Unique"/>
+
+<xsd:complexType name="Unique">
+<xsd:sequence>
+<xsd:element name="ob" type="tns:Object" minOccurs="0"/>
+</xsd:sequence>
+<xsd:attribute name="id" type="xsd:integer"/>
+</xsd:complexType>
+
+</xsd:schema> \ No newline at end of file
diff --git a/sdo-cpp/trunk/runtime/core/test/bunique-outxml.txt b/sdo-cpp/trunk/runtime/core/test/bunique-outxml.txt
new file mode 100644
index 0000000000..a4cd4f3705
--- /dev/null
+++ b/sdo-cpp/trunk/runtime/core/test/bunique-outxml.txt
@@ -0,0 +1,2 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<rooty xsi:type="tns2:Root" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:tns3="nottest" xmlns:tns2="test"><duplicate id="1"><ob/></duplicate><duplicate2 id="3"/><unique id="5"><ob/></unique><duplicatelist id="2"><ob/></duplicatelist><duplicatelist2 id="4"/><uniquelist id="6"/></rooty>
diff --git a/sdo-cpp/trunk/runtime/core/test/buniqueread-out.txt b/sdo-cpp/trunk/runtime/core/test/buniqueread-out.txt
new file mode 100644
index 0000000000..a4cd4f3705
--- /dev/null
+++ b/sdo-cpp/trunk/runtime/core/test/buniqueread-out.txt
@@ -0,0 +1,2 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<rooty xsi:type="tns2:Root" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:tns3="nottest" xmlns:tns2="test"><duplicate id="1"><ob/></duplicate><duplicate2 id="3"/><unique id="5"><ob/></unique><duplicatelist id="2"><ob/></duplicatelist><duplicatelist2 id="4"/><uniquelist id="6"/></rooty>
diff --git a/sdo-cpp/trunk/runtime/core/test/calculator.xsd b/sdo-cpp/trunk/runtime/core/test/calculator.xsd
new file mode 100644
index 0000000000..a5a26de117
--- /dev/null
+++ b/sdo-cpp/trunk/runtime/core/test/calculator.xsd
@@ -0,0 +1,32 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ Licensed to the Apache Software Foundation (ASF) under one
+ or more contributor license agreements. See the NOTICE file
+ distributed with this work for additional information
+ regarding copyright ownership. The ASF licenses this file
+ to you 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.
+-->
+
+
+ <xsd:schema
+ xmlns:xsd="http://www.w3.org/2001/XMLSchema"
+ xmlns:calc="http://example.org/CalculatorTypes"
+ targetNamespace="http://example.org/CalculatorTypes">
+ <xsd:complexType name="AddArguments">
+ <xsd:sequence>
+ <xsd:element name="a" type="xsd:float"/>
+ <xsd:element name="b" type="xsd:float"/>
+ </xsd:sequence>
+ </xsd:complexType>
+ </xsd:schema>
diff --git a/sdo-cpp/trunk/runtime/core/test/calculator2.wsdl b/sdo-cpp/trunk/runtime/core/test/calculator2.wsdl
new file mode 100644
index 0000000000..88b5b80b3d
--- /dev/null
+++ b/sdo-cpp/trunk/runtime/core/test/calculator2.wsdl
@@ -0,0 +1,90 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ Licensed to the Apache Software Foundation (ASF) under one
+ or more contributor license agreements. See the NOTICE file
+ distributed with this work for additional information
+ regarding copyright ownership. The ASF licenses this file
+ to you 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.
+-->
+
+
+<definitions name="Calculator"
+ targetNamespace="http://example.org/Calculator"
+ xmlns:calc="http://example.org/CalculatorTypes"
+ xmlns:tns="http://example.org/Calculator"
+ xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/"
+ xmlns:xsd="http://www.w3.org/2001/XMLSchema"
+ xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/"
+ xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/"
+ xmlns="http://schemas.xmlsoap.org/wsdl/">
+
+<!-- This is how it's done with an import -->
+<types>
+ <xsd:schema targetNamespace="http://example.org/Calculator">
+ <xsd:import namespace="http://example.org/CalculatorTypes" schemaLocation="calculator.xsd"/>
+ </xsd:schema>
+</types>
+
+
+<!-- This is how it's done without an import
+<types>
+ <xsd:schema attributeFormDefault="qualified" elementFormDefault="qualified"
+ xmlns:xsd="http://www.w3.org/2001/XMLSchema"
+ targetNamespace="http://example.org/Calculator">
+ <xsd:complexType name="AddArguments">
+ <xsd:sequence>
+ <xsd:element name="a" type="xsd:float"/>
+ <xsd:element name="b" type="xsd:float"/>
+ </xsd:sequence>
+ </xsd:complexType>
+ </xsd:schema>
+</types>
+-->
+
+<message name="getCalculatorRequest">
+ <part name="arguments" type="calc:AddArguments"/>
+</message>
+<message name="getCalculatorResponse">
+ <part name="result" type="xsd:float"/>
+</message>
+
+<portType name="CalculatorPortType">
+ <operation name="add2">
+ <input message="tns:getCalculatorRequest"/>
+ <output message="tns:getCalculatorResponse"/>
+ </operation>
+</portType>
+
+<binding name="CalculatorBinding" type="tns:CalculatorPortType">
+ <soap:binding style="rpc"
+ transport="http://schemas.xmlsoap.org/soap/http"/>
+ <operation name="add2">
+ <soap:operation soapAction="urn:example-org-calculator#add2"/>
+ <input>
+ <soap:body use="encoded" namespace="urn:example-org-calculator"
+ encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"/>
+ </input>
+ <output>
+ <soap:body use="encoded" namespace="urn:example-org-calculator"
+ encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"/>
+ </output>
+ </operation>
+</binding>
+
+<service name="CalculatorService">
+ <port name="CalculatorPort" binding="CalculatorBinding">
+ <soap:address location="http://localhost/PHP%20Playground/SoapExtension/ComplexCalculator/calculator_server.php"/>
+ </port>
+</service>
+</definitions> \ No newline at end of file
diff --git a/sdo-cpp/trunk/runtime/core/test/calculator2a.wsdl b/sdo-cpp/trunk/runtime/core/test/calculator2a.wsdl
new file mode 100644
index 0000000000..f2f008bf6e
--- /dev/null
+++ b/sdo-cpp/trunk/runtime/core/test/calculator2a.wsdl
@@ -0,0 +1,88 @@
+<?xml version ="1.0" encoding ="UTF-8" ?>
+<!--
+ Licensed to the Apache Software Foundation (ASF) under one
+ or more contributor license agreements. See the NOTICE file
+ distributed with this work for additional information
+ regarding copyright ownership. The ASF licenses this file
+ to you 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.
+-->
+
+<definitions name="Calculator"
+ targetNamespace="http://example.org/Calculator"
+ xmlns:calc="http://example.org/CalculatorTypes"
+ xmlns:tns="http://example.org/Calculator"
+ xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/"
+ xmlns:xsd="http://www.w3.org/2001/XMLSchema"
+ xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/"
+ xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/"
+ xmlns="http://schemas.xmlsoap.org/wsdl/">
+
+<!-- This is how it's done with an import
+<types>
+ <xsd:schema targetNamespace="http://example.org/Calculator">
+ <import namespace="http://example.org/CalculatorTypes" schemaLocation="calculator.xsd"/>
+ </xsd:schema>
+</types>
+-->
+
+<!-- This is how it's done without an import -->
+<types>
+ <xsd:schema attributeFormDefault="qualified" elementFormDefault="qualified"
+ xmlns:xsd="http://www.w3.org/2001/XMLSchema"
+ targetNamespace="http://example.org/Calculator">
+ <xsd:complexType name="AddArguments">
+ <xsd:sequence>
+ <xsd:element name="a" type="xsd:float"/>
+ <xsd:element name="b" type="xsd:float"/>
+ </xsd:sequence>
+ </xsd:complexType>
+ </xsd:schema>
+</types>
+
+<message name="getCalculatorRequest">
+ <part name="arguments" type="calc:AddArguments"/>
+</message>
+<message name="getCalculatorResponse">
+ <part name="result" type="xsd:float"/>
+</message>
+
+<portType name="CalculatorPortType">
+ <operation name="add2">
+ <input message="tns:getCalculatorRequest"/>
+ <output message="tns:getCalculatorResponse"/>
+ </operation>
+</portType>
+
+<binding name="CalculatorBinding" type="tns:CalculatorPortType">
+ <soap:binding style="rpc"
+ transport="http://schemas.xmlsoap.org/soap/http"/>
+ <operation name="add2">
+ <soap:operation soapAction="urn:example-org-calculator#add2"/>
+ <input>
+ <soap:body use="encoded" namespace="urn:example-org-calculator"
+ encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"/>
+ </input>
+ <output>
+ <soap:body use="encoded" namespace="urn:example-org-calculator"
+ encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"/>
+ </output>
+ </operation>
+</binding>
+
+<service name="CalculatorService">
+ <port name="CalculatorPort" binding="CalculatorBinding">
+ <soap:address location="http://localhost/PHP%20Playground/SoapExtension/ComplexCalculator/calculator_server.php"/>
+ </port>
+</service>
+</definitions> \ No newline at end of file
diff --git a/sdo-cpp/trunk/runtime/core/test/carotest3.txt b/sdo-cpp/trunk/runtime/core/test/carotest3.txt
new file mode 100644
index 0000000000..cb5e4ed9b3
--- /dev/null
+++ b/sdo-cpp/trunk/runtime/core/test/carotest3.txt
@@ -0,0 +1,36 @@
+======================================
+======================================
+======================================
+I am Item 1 of string
+======================================
+======================================
+I am Item 1 of string
+I am the first free text
+======================================
+======================================
+I am Item 1 of string
+I am the first free text
+I am Item 2 of string
+======================================
+======================================
+I am Item 1 of string
+I am free text which has been modified
+I am Item 2 of string
+======================================
+======================================
+I am Item 1 of string
+I am free text which has been modified
+I am Item 2 of string
+
+======================================
+======================================
+I am Item 1 of string
+I am free text which has been modified
+I am Item 2 of string
+department1
+======================================
+Element zero, length 1: 1
+Element one, length 2: 2
+Element two, length 3: 3
+Element three,length 4: 4
+Element four, length 5: 5
diff --git a/sdo-cpp/trunk/runtime/core/test/cdata-in.xml b/sdo-cpp/trunk/runtime/core/test/cdata-in.xml
new file mode 100644
index 0000000000..1a749ecafe
--- /dev/null
+++ b/sdo-cpp/trunk/runtime/core/test/cdata-in.xml
@@ -0,0 +1,29 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ Licensed to the Apache Software Foundation (ASF) under one
+ or more contributor license agreements. See the NOTICE file
+ distributed with this work for additional information
+ regarding copyright ownership. The ASF licenses this file
+ to you 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.
+-->
+<tns:test xmlns:tns="http://www.example.org/test"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
+ <entry1>
+ <data>xxx<![CDATA[<?xml version="1.0"encoding="UTF-8"?><MOREXML>....</MOREXML>]]>aaaa<![CDATA[>>>>>>>>>]]></data>
+ <fred>abcdefg</fred>
+ <fred><![CDATA[>>>>>>>>>]]></fred>
+ <fred>xxx<![CDATA[<?xml version="1.0"encoding="UTF-8"?><MOREXML>....</MOREXML>]]>aaaa<![CDATA[>>>>>>>>>]]></fred>
+ <jim>xxx<![CDATA[<?xml version="1.0"encoding="UTF-8"?><MOREXML>....</MOREXML>]]>aaaa<![CDATA[>>>>>>>>>]]></jim>
+ </entry1>
+</tns:test>
diff --git a/sdo-cpp/trunk/runtime/core/test/cdata-out.xml b/sdo-cpp/trunk/runtime/core/test/cdata-out.xml
new file mode 100644
index 0000000000..e6db2fbda0
--- /dev/null
+++ b/sdo-cpp/trunk/runtime/core/test/cdata-out.xml
@@ -0,0 +1,2 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<tns:test xmlns:tns="http://www.example.org/test" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"><entry1><data>xxx<![CDATA[<?xml version="1.0"encoding="UTF-8"?><MOREXML>....</MOREXML>]]>aaaa<![CDATA[>>>>>>>>>]]></data><fred>abcdefg</fred><fred><![CDATA[>>>>>>>>>]]></fred><fred>xxx<![CDATA[<?xml version="1.0"encoding="UTF-8"?><MOREXML>....</MOREXML>]]>aaaa<![CDATA[>>>>>>>>>]]></fred><jim>xxx<![CDATA[<?xml version="1.0"encoding="UTF-8"?><MOREXML>....</MOREXML>]]>aaaa<![CDATA[>>>>>>>>>]]></jim></entry1></tns:test>
diff --git a/sdo-cpp/trunk/runtime/core/test/cdata.xsd b/sdo-cpp/trunk/runtime/core/test/cdata.xsd
new file mode 100644
index 0000000000..5a7ff60c63
--- /dev/null
+++ b/sdo-cpp/trunk/runtime/core/test/cdata.xsd
@@ -0,0 +1,39 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ Licensed to the Apache Software Foundation (ASF) under one
+ or more contributor license agreements. See the NOTICE file
+ distributed with this work for additional information
+ regarding copyright ownership. The ASF licenses this file
+ to you 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.
+-->
+<schema xmlns="http://www.w3.org/2001/XMLSchema"
+ targetNamespace="http://www.example.org/test"
+ xmlns:tns="http://www.example.org/test">
+
+ <complexType name="TestType">
+ <sequence>
+ <element name="entry1">
+ <complexType>
+ <sequence>
+ <element name="data" type="string"/>
+ <element name="fred" type="string" maxOccurs="unbounded"/>
+ <any namespace="##any" processContents="lax"/>
+ </sequence>
+ </complexType>
+ </element>
+ </sequence>
+ </complexType>
+
+ <element name="test" type="tns:TestType"/>
+</schema>
diff --git a/sdo-cpp/trunk/runtime/core/test/clone-in.xml b/sdo-cpp/trunk/runtime/core/test/clone-in.xml
new file mode 100644
index 0000000000..192c26d15e
--- /dev/null
+++ b/sdo-cpp/trunk/runtime/core/test/clone-in.xml
@@ -0,0 +1,29 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ Licensed to the Apache Software Foundation (ASF) under one
+ or more contributor license agreements. See the NOTICE file
+ distributed with this work for additional information
+ regarding copyright ownership. The ASF licenses this file
+ to you 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.
+-->
+<Clone xmlns="http://www.example.org/test"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://www.example.org/test clone.xsd ">
+ abc
+ <test>test</test>
+ def
+ <tests>test</tests>
+ <tests>tests again</tests>
+ ghi
+</Clone>
diff --git a/sdo-cpp/trunk/runtime/core/test/clone-out-win.xml b/sdo-cpp/trunk/runtime/core/test/clone-out-win.xml
new file mode 100644
index 0000000000..ee538bc438
--- /dev/null
+++ b/sdo-cpp/trunk/runtime/core/test/clone-out-win.xml
@@ -0,0 +1,8 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<tns:Clone xmlns:tns="http://www.example.org/test" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
+ abc
+ <test>test</test>
+ def
+ <tests>test</tests>
+ <tests>tests again</tests>
+ ghi</tns:Clone>
diff --git a/sdo-cpp/trunk/runtime/core/test/clone-out.xml b/sdo-cpp/trunk/runtime/core/test/clone-out.xml
new file mode 100644
index 0000000000..5f711e11f5
--- /dev/null
+++ b/sdo-cpp/trunk/runtime/core/test/clone-out.xml
@@ -0,0 +1,9 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<tns:Clone xmlns:tns="http://www.example.org/test" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
+ abc
+ <test>test</test>
+ def
+ <tests>test</tests>
+ <tests>tests again</tests>
+ ghi
+</tns:Clone>
diff --git a/sdo-cpp/trunk/runtime/core/test/clone.xsd b/sdo-cpp/trunk/runtime/core/test/clone.xsd
new file mode 100644
index 0000000000..72c7110cb3
--- /dev/null
+++ b/sdo-cpp/trunk/runtime/core/test/clone.xsd
@@ -0,0 +1,33 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ Licensed to the Apache Software Foundation (ASF) under one
+ or more contributor license agreements. See the NOTICE file
+ distributed with this work for additional information
+ regarding copyright ownership. The ASF licenses this file
+ to you 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.
+-->
+<schema xmlns="http://www.w3.org/2001/XMLSchema"
+xmlns:tns="http://www.example.org/test"
+targetNamespace="http://www.example.org/test">
+
+<complexType name="CloneType" mixed="true">
+ <sequence>
+ <element name="test" type="string"/>
+ <any namespace="##any"/>
+ </sequence>
+</complexType>
+
+<element name="Clone" type="tns:CloneType"/>
+
+</schema>
diff --git a/sdo-cpp/trunk/runtime/core/test/company.xsd b/sdo-cpp/trunk/runtime/core/test/company.xsd
new file mode 100644
index 0000000000..d165367196
--- /dev/null
+++ b/sdo-cpp/trunk/runtime/core/test/company.xsd
@@ -0,0 +1,50 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ Licensed to the Apache Software Foundation (ASF) under one
+ or more contributor license agreements. See the NOTICE file
+ distributed with this work for additional information
+ regarding copyright ownership. The ASF licenses this file
+ to you 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.
+-->
+
+ <xsd:schema
+ xmlns:xsd="http://www.w3.org/2001/XMLSchema"
+ xmlns:sdo="commonj.sdo"
+ xmlns:sdoxml="commonj.sdo/xml"
+ xmlns:company="companyNS"
+ targetNamespace="companyNS">
+ <xsd:element name="company" type="company:CompanyType"/>
+ <xsd:complexType name="CompanyType">
+ <xsd:sequence>
+ <xsd:element name="departments" type="company:DepartmentType" maxOccurs="unbounded"/>
+ </xsd:sequence>
+ <xsd:attribute name="name" type="xsd:string"/>
+ <xsd:attribute name="cs" type="sdo:ChangeSummaryType"/>
+ <xsd:attribute name="employeeOfTheMonth" type="xsd:IDREF" sdoxml:propertyType="company:EmployeeType"/>
+ </xsd:complexType>
+ <xsd:complexType name="DepartmentType">
+ <xsd:sequence>
+ <xsd:element name="employees" type="company:EmployeeType" maxOccurs="unbounded"/>
+ </xsd:sequence>
+ <xsd:attribute name="name" type="xsd:string"/>
+ <xsd:attribute name="location" type="xsd:string"/>
+ <xsd:attribute name="number" type="xsd:int"/>
+ </xsd:complexType>
+ <xsd:complexType name="EmployeeType">
+ <xsd:attribute name="name" type="xsd:string"/>
+ <xsd:attribute name="SN" type="xsd:ID"/>
+ <xsd:attribute name="manager" type="xsd:boolean"/>
+ </xsd:complexType>
+ </xsd:schema>
+
diff --git a/sdo-cpp/trunk/runtime/core/test/company_with_nillable_SN.xml b/sdo-cpp/trunk/runtime/core/test/company_with_nillable_SN.xml
new file mode 100644
index 0000000000..3680df3ccf
--- /dev/null
+++ b/sdo-cpp/trunk/runtime/core/test/company_with_nillable_SN.xml
@@ -0,0 +1,30 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ Licensed to the Apache Software Foundation (ASF) under one
+ or more contributor license agreements. See the NOTICE file
+ distributed with this work for additional information
+ regarding copyright ownership. The ASF licenses this file
+ to you 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.
+-->
+
+ <!-- This XML has an employee with an SN of nil, which should appear in the SDO as NULL
+ -->
+ <company xmlns="companyNS" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" name="MegaCorp" employeeOfTheMonth="#/departments.0/employees.1">
+<departments name="Advanced Technologies" location="NY" number="123">
+<employees>
+<name>Jane Doe</name>
+<SN xsi:nil="true" />
+</employees>
+</departments>
+</company> \ No newline at end of file
diff --git a/sdo-cpp/trunk/runtime/core/test/company_with_nillable_SN.xsd b/sdo-cpp/trunk/runtime/core/test/company_with_nillable_SN.xsd
new file mode 100644
index 0000000000..9af4d3e721
--- /dev/null
+++ b/sdo-cpp/trunk/runtime/core/test/company_with_nillable_SN.xsd
@@ -0,0 +1,49 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ Licensed to the Apache Software Foundation (ASF) under one
+ or more contributor license agreements. See the NOTICE file
+ distributed with this work for additional information
+ regarding copyright ownership. The ASF licenses this file
+ to you 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.
+-->
+
+<!-- This XSD recasts the properties of employee to elements in order to allow the SN property to be nillable -->
+<xsd:schema
+ xmlns:xsd="http://www.w3.org/2001/XMLSchema"
+ xmlns:sdo="commonj.sdo"
+ xmlns:sdoxml="commonj.sdo/xml"
+ xmlns:company="companyNS"
+ targetNamespace="companyNS">
+ <xsd:element name="company" type="company:CompanyType"/>
+ <xsd:complexType name="CompanyType">
+ <xsd:sequence>
+ <xsd:element name="departments" type="company:DepartmentType" maxOccurs="unbounded"/>
+ </xsd:sequence>
+ <xsd:attribute name="name" type="xsd:string"/>
+ <xsd:attribute name="employeeOfTheMonth" type="xsd:IDREF"
+sdoxml:propertyType="company:EmployeeType"/> </xsd:complexType>
+ <xsd:complexType name="DepartmentType">
+ <xsd:sequence>
+ <xsd:element name="employees" type="company:EmployeeType" maxOccurs="unbounded"/>
+ </xsd:sequence>
+ <xsd:attribute name="name" type="xsd:string"/>
+ <xsd:attribute name="location" type="xsd:string"/>
+ <xsd:attribute name="number" type="xsd:int"/>
+ </xsd:complexType>
+ <xsd:complexType name="EmployeeType">
+ <xsd:element name="name" type="xsd:string"/>
+ <xsd:element name="SN" type="xsd:ID" nillable="true"/>
+ <xsd:element name="manager" type="xsd:boolean"/>
+ </xsd:complexType>
+</xsd:schema>
diff --git a/sdo-cpp/trunk/runtime/core/test/companyabs.xsd b/sdo-cpp/trunk/runtime/core/test/companyabs.xsd
new file mode 100644
index 0000000000..d9fa48be8c
--- /dev/null
+++ b/sdo-cpp/trunk/runtime/core/test/companyabs.xsd
@@ -0,0 +1,65 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ Licensed to the Apache Software Foundation (ASF) under one
+ or more contributor license agreements. See the NOTICE file
+ distributed with this work for additional information
+ regarding copyright ownership. The ASF licenses this file
+ to you 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.
+-->
+
+ <xsd:schema
+ xmlns:xsd="http://www.w3.org/2001/XMLSchema"
+ xmlns:sdo="commonj.sdo"
+ xmlns:sdoxml="commonj.sdo/xml"
+ xmlns:company="companyNS"
+ targetNamespace="companyNS">
+ <xsd:element name="company" type="company:CompanyType"/>
+ <xsd:element name="Publication" type="company:PublicationType" abstract="true"/>
+ <xsd:complexType name="CompanyType">
+ <xsd:sequence>
+ <xsd:element name="departments" type="company:DepartmentType" maxOccurs="unbounded"/>
+ <xsd:element ref="company:Publication" maxOccurs="1"/>
+ </xsd:sequence>
+ <xsd:attribute name="name" type="xsd:string"/>
+ <xsd:attribute name="cs" type="sdo:ChangeSummaryType"/>
+ <xsd:attribute name="employeeOfTheMonth" type="xsd:IDREF" sdoxml:propertyType="company:EmployeeType"/>
+ </xsd:complexType>
+ <xsd:complexType name="DepartmentType">
+ <xsd:sequence>
+ <xsd:element name="employees" type="company:EmployeeType" maxOccurs="unbounded"/>
+ </xsd:sequence>
+ <xsd:attribute name="name" type="xsd:string"/>
+ <xsd:attribute name="location" type="xsd:string"/>
+ <xsd:attribute name="number" type="xsd:int"/>
+ </xsd:complexType>
+ <xsd:complexType name="EmployeeType">
+ <xsd:attribute name="name" type="xsd:string"/>
+ <xsd:attribute name="SN" type="xsd:ID"/>
+ <xsd:attribute name="manager" type="xsd:boolean"/>
+ </xsd:complexType>
+ <xsd:complexType name="BookType">
+ <xsd:restriction base="company:PublicationType" />
+ <xsd:element name="author" type="xsd:string" maxOccurs="1"/>
+ </xsd:complexType>
+ <xsd:complexType name="MagazineType">
+ <xsd:restriction base="company:PublicationType" />
+ <xsd:element name="editor" type="xsd:string" maxOccurs="1"/>
+ </xsd:complexType>
+ <xsd:complexType name="PublicationType" abstract="true" >
+ <xsd:element name="title" type="xsd:string" maxOccurs="1"/>
+ </xsd:complexType>
+ <xsd:element name="Book" type="company:BookType" substitutionGroup="company:Publication" />
+ <xsd:element name="Magazine" type="company:MagazineType" substitutionGroup="company:Publication" />
+ </xsd:schema>
+
diff --git a/sdo-cpp/trunk/runtime/core/test/companyref.xsd b/sdo-cpp/trunk/runtime/core/test/companyref.xsd
new file mode 100644
index 0000000000..1f706fca8f
--- /dev/null
+++ b/sdo-cpp/trunk/runtime/core/test/companyref.xsd
@@ -0,0 +1,67 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ Licensed to the Apache Software Foundation (ASF) under one
+ or more contributor license agreements. See the NOTICE file
+ distributed with this work for additional information
+ regarding copyright ownership. The ASF licenses this file
+ to you 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.
+-->
+
+
+<schema xmlns="http://www.w3.org/2001/XMLSchema"
+ xmlns:sca="http://www.commonj.org/xmlns/sca/v0.0.1/"
+ xmlns:sdo="commonj.sdo/XML"
+ xmlns:company="companyNS"
+ targetNamespace="companyNS">
+ elementFormDefault="qualified">
+
+ <xsd:element name="company" type="company:CompanyType"/>
+ <xsd:complexType name="CompanyType">
+ <xsd:sequence>
+ <xsd:element name="departments" type="company:DepartmentType" maxOccurs="unbounded"/>
+ <xsd:element name="my.Publication" ref="publication" sdo:name="MyPublication" maxOccurs="1"/>
+ </xsd:sequence>
+ <xsd:attribute name="name" type="xsd:string"/>
+ <xsd:attribute name="cs" type="sdo:ChangeSummaryType"/>
+ <xsd:attribute name="employeeOfTheMonth" type="xsd:IDREF" sdoxml:propertyType="company:EmployeeType"/>
+ </xsd:complexType>
+ <xsd:complexType name="DepartmentType">
+ <xsd:sequence>
+ <xsd:element name="employees" type="company:EmployeeType" maxOccurs="unbounded"/>
+ </xsd:sequence>
+ <xsd:attribute name="name" type="xsd:string"/>
+ <xsd:attribute name="location" type="xsd:string"/>
+ <xsd:attribute name="number" type="xsd:int"/>
+ </xsd:complexType>
+ <xsd:complexType name="EmployeeType">
+ <xsd:attribute name="name" type="xsd:string"/>
+ <xsd:attribute name="SN" type="xsd:ID"/>
+ <xsd:attribute name="manager" type="xsd:boolean"/>
+ </xsd:complexType>
+ <xsd:complexType name="BookType">
+ <xsd:restriction base="company:PublicationType" />
+ <xsd:element name="author" type="xsd:string" maxOccurs="1"/>
+ </xsd:complexType>
+ <xsd:complexType name="MagazineType">
+ <xsd:restriction base="company:PublicationType" />
+ <xsd:element name="editor" type="xsd:string" maxOccurs="1"/>
+ </xsd:complexType>
+ <xsd:complexType name="PublicationType">
+ <xsd:element name="title" type="xsd:string" maxOccurs="1"/>
+ </xsd:complexType>
+ <xsd:element name="my.book" sdo:name="MyBook" type="company:BookType" substitutionGroup="Publication" />
+ <xsd:element name="my.magazine" sdo:name="MyMagazine" type="company:MagazineType" substitutionGroup="company:Publication" />
+ <xsd:element name="my.publication" sdo:name="MyPublication" type="company:PublicationType"/>
+ </xsd:schema>
+
diff --git a/sdo-cpp/trunk/runtime/core/test/companysubs.xsd b/sdo-cpp/trunk/runtime/core/test/companysubs.xsd
new file mode 100644
index 0000000000..3e16090350
--- /dev/null
+++ b/sdo-cpp/trunk/runtime/core/test/companysubs.xsd
@@ -0,0 +1,64 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ Licensed to the Apache Software Foundation (ASF) under one
+ or more contributor license agreements. See the NOTICE file
+ distributed with this work for additional information
+ regarding copyright ownership. The ASF licenses this file
+ to you 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.
+-->
+
+ <xsd:schema
+ xmlns:xsd="http://www.w3.org/2001/XMLSchema"
+ xmlns:sdo="commonj.sdo"
+ xmlns:sdoxml="commonj.sdo/xml"
+ xmlns:company="companyNS"
+ targetNamespace="companyNS">
+ <xsd:element name="company" type="company:CompanyType"/>
+ <xsd:complexType name="CompanyType">
+ <xsd:sequence>
+ <xsd:element name="departments" type="company:DepartmentType" maxOccurs="unbounded"/>
+ <xsd:element name="Publication" type="company:PublicationType" maxOccurs="1"/>
+ </xsd:sequence>
+ <xsd:attribute name="name" type="xsd:string"/>
+ <xsd:attribute name="cs" type="sdo:ChangeSummaryType"/>
+ <xsd:attribute name="employeeOfTheMonth" type="xsd:IDREF" sdoxml:propertyType="company:EmployeeType"/>
+ </xsd:complexType>
+ <xsd:complexType name="DepartmentType">
+ <xsd:sequence>
+ <xsd:element name="employees" type="company:EmployeeType" maxOccurs="unbounded"/>
+ </xsd:sequence>
+ <xsd:attribute name="name" type="xsd:string"/>
+ <xsd:attribute name="location" type="xsd:string"/>
+ <xsd:attribute name="number" type="xsd:int"/>
+ </xsd:complexType>
+ <xsd:complexType name="EmployeeType">
+ <xsd:attribute name="name" type="xsd:string"/>
+ <xsd:attribute name="SN" type="xsd:ID"/>
+ <xsd:attribute name="manager" type="xsd:boolean"/>
+ </xsd:complexType>
+ <xsd:complexType name="BookType">
+ <xsd:restriction base="company:PublicationType" />
+ <xsd:element name="author" type="xsd:string" maxOccurs="1"/>
+ </xsd:complexType>
+ <xsd:complexType name="MagazineType">
+ <xsd:restriction base="company:PublicationType" />
+ <xsd:element name="editor" type="xsd:string" maxOccurs="1"/>
+ </xsd:complexType>
+ <xsd:complexType name="PublicationType">
+ <xsd:element name="title" type="xsd:string" maxOccurs="1"/>
+ </xsd:complexType>
+ <xsd:element name="Book" type="company:BookType" substitutionGroup="Publication" />
+ <xsd:element name="Magazine" type="company:MagazineType" substitutionGroup="company:Publication" />
+ </xsd:schema>
+
diff --git a/sdo-cpp/trunk/runtime/core/test/csload-output.txt b/sdo-cpp/trunk/runtime/core/test/csload-output.txt
new file mode 100644
index 0000000000..bdd05c0a32
--- /dev/null
+++ b/sdo-cpp/trunk/runtime/core/test/csload-output.txt
@@ -0,0 +1,2 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<company xsi:type="tns2:CompanyType" xmlns:tns2="companyNS" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" name="MegaCorp" employeeOfTheMonth="E0004"><sdo:changeSummary xmlns:sdo="commonj.sdo" logging="true"><create>#/departments.0/employees.2</create><delete>#/departments.0/employees.1</delete><create>#/departments.0/employees.3</create><create>#/departments.0/employees.4</create><company sdo:ref="#/" employeeOfTheMonth="" name="ACME" employeeOfTheMonth="#/departments.0/employees.1"/><departments sdo:ref="#/departments.0"><employees sdo:ref="#/departments.0/employees.0"/><employees name="Mary Smith" SN="E0002" manager="true"/><employees sdo:ref="#/departments.0/employees.1"/></departments></sdo:changeSummary><departments name="Advanced Technologies" location="NY" number="123"><employees name="John Jones" SN="E0001"/><employees name="Jane Doe" SN="E0003"/><employees name="Al Smith" SN="E0004" manager="true"/><employees name="Bill Withers" SN="E0005"/><employees name="Mary Smith" SN="E0002" manager="true"/></departments></company>
diff --git a/sdo-cpp/trunk/runtime/core/test/csload2-output.txt b/sdo-cpp/trunk/runtime/core/test/csload2-output.txt
new file mode 100644
index 0000000000..1094229a7f
--- /dev/null
+++ b/sdo-cpp/trunk/runtime/core/test/csload2-output.txt
@@ -0,0 +1,2 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<company xsi:type="tns2:CompanyType" xmlns:tns2="companyNS" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" name="MegaCorp" employeeOfTheMonth="E0005"><sdo:changeSummary xmlns:sdo="commonj.sdo" logging="true"><delete>#/departments.0/employees.1</delete><delete>#/departments.0/employees.1</delete><delete>#/departments.0/employees.1</delete><delete>#/departments.1/employees.4</delete><delete>#/departments.1/employees.3</delete><delete>#/departments.1/employees.2</delete><delete>#/departments.1/employees.1</delete><delete>#/departments.1/employees.0</delete><delete>#/departments.1</delete><create>#/departments.0/employees.2</create><company sdo:ref="#/" employeeOfTheMonth="" name="Eastleigh Borough Council"><departments sdo:ref="#/departments.0"/><departments name="Tax Collection" location="Winchester" number="666"><employees name="Arch Meanie" SN="D0001" manager="false"/><employees name="Boris the Spider" SN="D0002" manager="true"/><employees name="Cash Hoarder" SN="D0003" manager="false"/><employees name="Dean Giyatoss" SN="D0004" manager="false"/><employees name="Ebenezer Scrooge" SN="D0005" manager="false"/></departments></company><departments sdo:ref="#/departments.0"><employees sdo:ref="#/departments.0/employees.0"/><employees name="Bridget Jones" SN="E0002" manager="true"/><employees name="Colin Thorne" SN="E0003" manager="false"/><employees name="Donald Trump" SN="E0004" manager="false"/><employees sdo:ref="#/departments.0/employees.1"/></departments></sdo:changeSummary><departments name="Waste Disposal" location="Botley" number="123"><employees name="Alphonse Dodet" SN="E0001"/><employees name="Eddy the eagle" SN="E0005"/><employees name="Colin Thorne" SN="E0003"/></departments></company>
diff --git a/sdo-cpp/trunk/runtime/core/test/csload3-output.txt b/sdo-cpp/trunk/runtime/core/test/csload3-output.txt
new file mode 100644
index 0000000000..1094229a7f
--- /dev/null
+++ b/sdo-cpp/trunk/runtime/core/test/csload3-output.txt
@@ -0,0 +1,2 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<company xsi:type="tns2:CompanyType" xmlns:tns2="companyNS" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" name="MegaCorp" employeeOfTheMonth="E0005"><sdo:changeSummary xmlns:sdo="commonj.sdo" logging="true"><delete>#/departments.0/employees.1</delete><delete>#/departments.0/employees.1</delete><delete>#/departments.0/employees.1</delete><delete>#/departments.1/employees.4</delete><delete>#/departments.1/employees.3</delete><delete>#/departments.1/employees.2</delete><delete>#/departments.1/employees.1</delete><delete>#/departments.1/employees.0</delete><delete>#/departments.1</delete><create>#/departments.0/employees.2</create><company sdo:ref="#/" employeeOfTheMonth="" name="Eastleigh Borough Council"><departments sdo:ref="#/departments.0"/><departments name="Tax Collection" location="Winchester" number="666"><employees name="Arch Meanie" SN="D0001" manager="false"/><employees name="Boris the Spider" SN="D0002" manager="true"/><employees name="Cash Hoarder" SN="D0003" manager="false"/><employees name="Dean Giyatoss" SN="D0004" manager="false"/><employees name="Ebenezer Scrooge" SN="D0005" manager="false"/></departments></company><departments sdo:ref="#/departments.0"><employees sdo:ref="#/departments.0/employees.0"/><employees name="Bridget Jones" SN="E0002" manager="true"/><employees name="Colin Thorne" SN="E0003" manager="false"/><employees name="Donald Trump" SN="E0004" manager="false"/><employees sdo:ref="#/departments.0/employees.1"/></departments></sdo:changeSummary><departments name="Waste Disposal" location="Botley" number="123"><employees name="Alphonse Dodet" SN="E0001"/><employees name="Eddy the eagle" SN="E0005"/><employees name="Colin Thorne" SN="E0003"/></departments></company>
diff --git a/sdo-cpp/trunk/runtime/core/test/cssave-output.txt b/sdo-cpp/trunk/runtime/core/test/cssave-output.txt
new file mode 100644
index 0000000000..7e6f5789c3
--- /dev/null
+++ b/sdo-cpp/trunk/runtime/core/test/cssave-output.txt
@@ -0,0 +1,2 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<tns:company xmlns:tns="companyNS" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" name="MegaCorp" employeeOfTheMonth="E0004"><sdo:changeSummary xmlns:sdo="commonj.sdo"><create>#/departments.0/employees.2</create><delete>#/departments.0/employees.1</delete><create>#/departments.0/employees.3</create><create>#/departments.0/employees.4</create><departments sdo:ref="#/departments.0"><employees sdo:ref="#/departments.0/employees.0"/><employees name="Mary Smith" SN="E0002" manager="true"/><employees sdo:ref="#/departments.0/employees.1"/></departments><company sdo:ref="#/" name="ACME" employeeOfTheMonth="#/departments.0/employees.1"/></sdo:changeSummary><departments name="Advanced Technologies" location="NY" number="123"><employees name="John Jones" SN="E0001"/><employees name="Jane Doe" SN="E0003"/><employees name="Al Smith" SN="E0004" manager="true"/><employees name="Bill Withers" SN="E0005"/><employees name="Mary Smith" SN="E0002" manager="true"/></departments></tns:company>
diff --git a/sdo-cpp/trunk/runtime/core/test/cssave2-output.txt b/sdo-cpp/trunk/runtime/core/test/cssave2-output.txt
new file mode 100644
index 0000000000..5549be0a44
--- /dev/null
+++ b/sdo-cpp/trunk/runtime/core/test/cssave2-output.txt
@@ -0,0 +1,2 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<tns:company xmlns:tns="companyNS" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" name="MegaCorp" employeeOfTheMonth="E0005"><sdo:changeSummary xmlns:sdo="commonj.sdo"><delete>#/departments.0/employees.1</delete><delete>#/departments.0/employees.1</delete><delete>#/departments.0/employees.1</delete><delete>#/departments.1/employees.4</delete><delete>#/departments.1/employees.3</delete><delete>#/departments.1/employees.2</delete><delete>#/departments.1/employees.1</delete><delete>#/departments.1/employees.0</delete><delete>#/departments.1</delete><create>#/departments.0/employees.2</create><departments sdo:ref="#/departments.0"><employees sdo:ref="#/departments.0/employees.0"/><employees name="Bridget Jones" SN="E0002" manager="true"/><employees name="Colin Thorne" SN="E0003" manager="false"/><employees name="Donald Trump" SN="E0004" manager="false"/><employees sdo:ref="#/departments.0/employees.1"/></departments><company sdo:ref="#/" name="Eastleigh Borough Council" employeeOfTheMonth=""><departments sdo:ref="#/departments.0"/><departments name="Tax Collection" location="Winchester" number="666"><employees name="Arch Meanie" SN="D0001" manager="false"/><employees name="Boris the Spider" SN="D0002" manager="true"/><employees name="Cash Hoarder" SN="D0003" manager="false"/><employees name="Dean Giyatoss" SN="D0004" manager="false"/><employees name="Ebenezer Scrooge" SN="D0005" manager="false"/></departments></company></sdo:changeSummary><departments name="Waste Disposal" location="Botley" number="123"><employees name="Alphonse Dodet" SN="E0001"/><employees name="Eddy the eagle" SN="E0005"/><employees name="Colin Thorne" SN="E0003"/></departments></tns:company>
diff --git a/sdo-cpp/trunk/runtime/core/test/datetest.txt b/sdo-cpp/trunk/runtime/core/test/datetest.txt
new file mode 100644
index 0000000000..3da923ea55
--- /dev/null
+++ b/sdo-cpp/trunk/runtime/core/test/datetest.txt
@@ -0,0 +1,4 @@
+Name of the company is DateTest
+Set start of the company is 1000
+Review number:0 was:2000
+Review number:1 was:4000
diff --git a/sdo-cpp/trunk/runtime/core/test/defaults.txt b/sdo-cpp/trunk/runtime/core/test/defaults.txt
new file mode 100644
index 0000000000..1cdba8ea05
--- /dev/null
+++ b/sdo-cpp/trunk/runtime/core/test/defaults.txt
@@ -0,0 +1,10 @@
+Boolean default is true: 1
+Byte default is d: 100
+Character default is e: 101
+Short default is 300: 300
+Long default is 400: 400
+Expected index out of range OK
+Float default is 600: 600.000
+LongDouble default is 700: 700.000
+String default is HELP: HELP
+Bytes default is HELP: HELP
diff --git a/sdo-cpp/trunk/runtime/core/test/doctest.txt b/sdo-cpp/trunk/runtime/core/test/doctest.txt
new file mode 100644
index 0000000000..b08b52a605
--- /dev/null
+++ b/sdo-cpp/trunk/runtime/core/test/doctest.txt
@@ -0,0 +1,2 @@
+RootURI=companyNS
+RootName=company
diff --git a/sdo-cpp/trunk/runtime/core/test/doctest.xml b/sdo-cpp/trunk/runtime/core/test/doctest.xml
new file mode 100644
index 0000000000..0e1a4e1a7e
--- /dev/null
+++ b/sdo-cpp/trunk/runtime/core/test/doctest.xml
@@ -0,0 +1,27 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ Licensed to the Apache Software Foundation (ASF) under one
+ or more contributor license agreements. See the NOTICE file
+ distributed with this work for additional information
+ regarding copyright ownership. The ASF licenses this file
+ to you 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.
+-->
+
+<company xmlns="companyNS" name="MegaCorp" employeeOfTheMonth="#/departments.0/employees.1">
+<departments name="Advanced Technologies" location="NY" number="123">
+<employees name="John Jones" SN="E0001" />
+<employees name="Jane Doe" SN="E0003" />
+<employees name="Al Smith" SN="E0004" manager="true" />
+</departments>
+</company> \ No newline at end of file
diff --git a/sdo-cpp/trunk/runtime/core/test/doctest.xsd b/sdo-cpp/trunk/runtime/core/test/doctest.xsd
new file mode 100644
index 0000000000..0c953a6348
--- /dev/null
+++ b/sdo-cpp/trunk/runtime/core/test/doctest.xsd
@@ -0,0 +1,48 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ Licensed to the Apache Software Foundation (ASF) under one
+ or more contributor license agreements. See the NOTICE file
+ distributed with this work for additional information
+ regarding copyright ownership. The ASF licenses this file
+ to you 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.
+-->
+
+<xsd:schema
+ xmlns:xsd="http://www.w3.org/2001/XMLSchema"
+ xmlns:sdo="commonj.sdo"
+ xmlns:sdoxml="commonj.sdo/xml"
+ xmlns:company="companyNS"
+ targetNamespace="companyNS">
+ <xsd:element name="company" type="company:CompanyType"/>
+ <xsd:complexType name="CompanyType">
+ <xsd:sequence>
+ <xsd:element name="departments" type="company:DepartmentType" maxOccurs="unbounded"/>
+ </xsd:sequence>
+ <xsd:attribute name="name" type="xsd:string"/>
+ <xsd:attribute name="employeeOfTheMonth" type="xsd:IDREF"
+sdoxml:propertyType="company:EmployeeType"/> </xsd:complexType>
+ <xsd:complexType name="DepartmentType">
+ <xsd:sequence>
+ <xsd:element name="employees" type="company:EmployeeType" maxOccurs="unbounded"/>
+ </xsd:sequence>
+ <xsd:attribute name="name" type="xsd:string"/>
+ <xsd:attribute name="location" type="xsd:string"/>
+ <xsd:attribute name="number" type="xsd:int"/>
+ </xsd:complexType>
+ <xsd:complexType name="EmployeeType">
+ <xsd:attribute name="name" type="xsd:string"/>
+ <xsd:attribute name="SN" type="xsd:ID"/>
+ <xsd:attribute name="manager" type="xsd:boolean"/>
+ </xsd:complexType>
+</xsd:schema>
diff --git a/sdo-cpp/trunk/runtime/core/test/elementFormDefaultQualifiedSeq.xsd b/sdo-cpp/trunk/runtime/core/test/elementFormDefaultQualifiedSeq.xsd
new file mode 100644
index 0000000000..11fcdd956e
--- /dev/null
+++ b/sdo-cpp/trunk/runtime/core/test/elementFormDefaultQualifiedSeq.xsd
@@ -0,0 +1,40 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ Licensed to the Apache Software Foundation (ASF) under one
+ or more contributor license agreements. See the NOTICE file
+ distributed with this work for additional information
+ regarding copyright ownership. The ASF licenses this file
+ to you 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.
+-->
+
+<xs:schema targetNamespace="test"
+ xmlns="test" xmlns:xs="http://www.w3.org/2001/XMLSchema" elementFormDefault="qualified">
+
+ <xs:element name="x" type="xT"/>
+
+ <xs:complexType name="xT">
+ <xs:choice maxOccurs="unbounded">
+ <xs:element name="a" type="aT" minOccurs="0" maxOccurs="unbounded" />
+ <xs:element name="b" type="xs:string" />
+ </xs:choice>
+ </xs:complexType>
+
+ <xs:complexType name="aT">
+ <xs:choice maxOccurs="unbounded">
+ <xs:element name="a1" type="xs:string" minOccurs="0" maxOccurs="unbounded" />
+ <xs:element name="a2" type="xs:string" minOccurs="0" maxOccurs="unbounded" />
+ </xs:choice>
+ </xs:complexType>
+
+</xs:schema> \ No newline at end of file
diff --git a/sdo-cpp/trunk/runtime/core/test/elementFormDefaultQualifiedSeq_expected.xml b/sdo-cpp/trunk/runtime/core/test/elementFormDefaultQualifiedSeq_expected.xml
new file mode 100644
index 0000000000..bb44dd330f
--- /dev/null
+++ b/sdo-cpp/trunk/runtime/core/test/elementFormDefaultQualifiedSeq_expected.xml
@@ -0,0 +1,4 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<a xsi:type="tns2:aT" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:tns2="test">
+ <tns2:a1>test data</tns2:a1>
+</a>
diff --git a/sdo-cpp/trunk/runtime/core/test/employee.xsd b/sdo-cpp/trunk/runtime/core/test/employee.xsd
new file mode 100644
index 0000000000..e2eec63eea
--- /dev/null
+++ b/sdo-cpp/trunk/runtime/core/test/employee.xsd
@@ -0,0 +1,45 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ Licensed to the Apache Software Foundation (ASF) under one
+ or more contributor license agreements. See the NOTICE file
+ distributed with this work for additional information
+ regarding copyright ownership. The ASF licenses this file
+ to you 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.
+-->
+
+
+<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema">
+
+<xs:element name="employee" type="fullpersoninfo"/>
+
+<xs:complexType name="personinfo">
+ <xs:sequence>
+ <xs:element name="firstname" type="xs:string"/>
+ <xs:element name="lastname" type="xs:string"/>
+ </xs:sequence>
+</xs:complexType>
+
+<xs:complexType name="fullpersoninfo">
+ <xs:complexContent>
+ <xs:extension base="personinfo">
+ <xs:sequence>
+ <xs:element name="address" type="xs:string"/>
+ <xs:element name="city" type="xs:string"/>
+ <xs:element name="country" type="xs:string"/>
+ </xs:sequence>
+ </xs:extension>
+ </xs:complexContent>
+</xs:complexType>
+
+</xs:schema> \ No newline at end of file
diff --git a/sdo-cpp/trunk/runtime/core/test/emptycs1.txt b/sdo-cpp/trunk/runtime/core/test/emptycs1.txt
new file mode 100644
index 0000000000..7ab37e28a5
--- /dev/null
+++ b/sdo-cpp/trunk/runtime/core/test/emptycs1.txt
@@ -0,0 +1,2 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<tns:company xmlns:tns="companyNS" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" name="ACME" employeeOfTheMonth="E0002"><sdo:changeSummary xmlns:sdo="commonj.sdo"/><departments name="Advanced Technologies" location="NY" number="123"><employees name="John Jones" SN="E0001"/><employees name="Mary Smith" SN="E0002" manager="true"/><employees name="Jane Doe" SN="E0003"/></departments></tns:company>
diff --git a/sdo-cpp/trunk/runtime/core/test/emptycs2.txt b/sdo-cpp/trunk/runtime/core/test/emptycs2.txt
new file mode 100644
index 0000000000..8e4fe720e5
--- /dev/null
+++ b/sdo-cpp/trunk/runtime/core/test/emptycs2.txt
@@ -0,0 +1,2 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<tns:company xmlns:tns="companyNS" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" name="ACME" employeeOfTheMonth="E0002"><sdo:changeSummary xmlns:sdo="commonj.sdo" logging="true"/><departments name="Advanced Technologies" location="NY" number="123"><employees name="John Jones" SN="E0001"/><employees name="Mary Smith" SN="E0002" manager="true"/><employees name="Jane Doe" SN="E0003"/></departments></tns:company>
diff --git a/sdo-cpp/trunk/runtime/core/test/emptycs3.txt b/sdo-cpp/trunk/runtime/core/test/emptycs3.txt
new file mode 100644
index 0000000000..4195c4aeb8
--- /dev/null
+++ b/sdo-cpp/trunk/runtime/core/test/emptycs3.txt
@@ -0,0 +1,2 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<tns:company xmlns:tns="companyNS" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" name="ACME" employeeOfTheMonth="E0002"><sdo:changeSummary xmlns:sdo="commonj.sdo"><create>#/departments.0/employees.3</create><departments sdo:ref="#/departments.0"><employees sdo:ref="#/departments.0/employees.0"/><employees sdo:ref="#/departments.0/employees.1"/><employees sdo:ref="#/departments.0/employees.2"/></departments></sdo:changeSummary><departments name="Advanced Technologies" location="NY" number="123"><employees name="John Jones" SN="E0001"/><employees name="Mary Smith" SN="E0002" manager="true"/><employees name="Jane Doe" SN="E0003"/><employees name="Al Smith" SN="E0004" manager="true"/></departments></tns:company>
diff --git a/sdo-cpp/trunk/runtime/core/test/error1.xml b/sdo-cpp/trunk/runtime/core/test/error1.xml
new file mode 100644
index 0000000000..3680df3ccf
--- /dev/null
+++ b/sdo-cpp/trunk/runtime/core/test/error1.xml
@@ -0,0 +1,30 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ Licensed to the Apache Software Foundation (ASF) under one
+ or more contributor license agreements. See the NOTICE file
+ distributed with this work for additional information
+ regarding copyright ownership. The ASF licenses this file
+ to you 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.
+-->
+
+ <!-- This XML has an employee with an SN of nil, which should appear in the SDO as NULL
+ -->
+ <company xmlns="companyNS" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" name="MegaCorp" employeeOfTheMonth="#/departments.0/employees.1">
+<departments name="Advanced Technologies" location="NY" number="123">
+<employees>
+<name>Jane Doe</name>
+<SN xsi:nil="true" />
+</employees>
+</departments>
+</company> \ No newline at end of file
diff --git a/sdo-cpp/trunk/runtime/core/test/error1.xsd b/sdo-cpp/trunk/runtime/core/test/error1.xsd
new file mode 100644
index 0000000000..6246be5efa
--- /dev/null
+++ b/sdo-cpp/trunk/runtime/core/test/error1.xsd
@@ -0,0 +1,49 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ Licensed to the Apache Software Foundation (ASF) under one
+ or more contributor license agreements. See the NOTICE file
+ distributed with this work for additional information
+ regarding copyright ownership. The ASF licenses this file
+ to you 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.
+-->
+
+<!-- This XSD recasts the properties of employee to elements in order to allow the SN property to be nillable -->
+<xsd:schema
+ xmlns:xsd="http://www.w3.org/2001/XMLSchema"
+ xmlns:sdo="commonj.sdo"
+ xmlns:sdoxml="commonj.sdo/xml"
+ xmlns:company="companyNS"
+ targetNamespace="companyNS">
+ <xsd:element name="company" type="company:CompanyType"/>
+ <xsd:complexType name="CompanyType">
+ <xsd:sequence>
+ <xsd:element name="departments" type="company:DepartmentType" maxOccurs="unbounded"/>
+ </xsd:sequence>
+ <xsd:attribute name="name" type="xsd:string"/>
+ <xsd:attribute name="employeeOfTheMonth" type="xsd:IDREF"
+sdoxml:propertyType="company:EmployeeType"/> </xsd:complexType>
+ <xsd:complexType name="DepartmentType">
+ <xsd:sequence>
+ <xsd:element name="employees" type="company:EmployeeType" maxOccurs="unbounded"/>
+ </xsd:sequence>
+ <xsd:attribute name="name" type="xsd:string"/>
+ <xsd:attribute name="location" type="xsd:string"/>
+ <xsd:attribute name="number" type="xsd:int"/>
+ </xsd:complexType>
+ <xsd:complexType name="EmployeeType">
+ <xsd:element name="name" type="xsd:string"/>
+ <xsd:element name="SN" type="xsd:ID" nillable="true"/>
+ <xsd:element name="manager" type="xsd:boolean"/>
+
+</xsd:schema>
diff --git a/sdo-cpp/trunk/runtime/core/test/extension.xsd b/sdo-cpp/trunk/runtime/core/test/extension.xsd
new file mode 100644
index 0000000000..7e6b336516
--- /dev/null
+++ b/sdo-cpp/trunk/runtime/core/test/extension.xsd
@@ -0,0 +1,58 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ Licensed to the Apache Software Foundation (ASF) under one
+ or more contributor license agreements. See the NOTICE file
+ distributed with this work for additional information
+ regarding copyright ownership. The ASF licenses this file
+ to you 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.
+-->
+
+<!--
+ This example simplified version of W3C XML schema primer
+ with added UK postcode
+ http://www.w3.org/TR/xmlschema-0/#DerivExt
+ -->
+
+
+<schema xmlns="http://www.w3.org/2001/XMLSchema" targetNamespace="" >
+
+ <complexType name="Address">
+ <sequence>
+ <element name="name" type="string"/>
+ <element name="street" type="string"/>
+ <element name="city" type="string"/>
+ </sequence>
+ </complexType>
+
+ <complexType name="USAddress">
+ <complexContent>
+ <extension base="Address">
+ <sequence>
+ <element name="zip" type="positiveInteger"/>
+ </sequence>
+ </extension>
+ </complexContent>
+ </complexType>
+
+ <complexType name="UKAddress">
+ <complexContent>
+ <extension base="Address">
+ <sequence>
+ <element name="postcode" type="string"/>
+ </sequence>
+ </extension>
+ </complexContent>
+ </complexType>
+
+</schema> \ No newline at end of file
diff --git a/sdo-cpp/trunk/runtime/core/test/fidelity.xml b/sdo-cpp/trunk/runtime/core/test/fidelity.xml
new file mode 100644
index 0000000000..6abc3787ae
--- /dev/null
+++ b/sdo-cpp/trunk/runtime/core/test/fidelity.xml
@@ -0,0 +1,49 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ Licensed to the Apache Software Foundation (ASF) under one
+ or more contributor license agreements. See the NOTICE file
+ distributed with this work for additional information
+ regarding copyright ownership. The ASF licenses this file
+ to you 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.
+-->
+<!--447-->
+<RootElement33 xmlns="http://www.apache.org/tuscany/interop"
+ xmlns:tns="http://www.apache.org/tuscany/interop"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://www.apache.org/tuscany/interop fidelity.xsd">
+
+ <ComplexTypeAttributesTest Attribute="Attribute"
+ AttributeWithDefaultValue="AttributeWithDefaultValueDefaultValue"
+ AttributeWithFixedValue="AttributeWithFixedValueFixedValue"
+ AttributeWithSDOAliasName="AttributeWithSDOAliasName"
+ AttributeWithSDODataType="AttributeWithSDODataType"
+ AttributeWithSDOName="AttributeWithSDODataType"
+ AttributeWithSDOPropertySDOOppositePropertyType="idvalue0"
+ AttributeWithSDOPropertyType="idvalue0"
+ AttributeWithSDOString="AttributeWithSDOString"
+ AttributeReference="AttributeReference"/>
+
+ <!--450-->
+ <ElementOfSimpleTypeWithSDOPropertyType>idvalue0</ElementOfSimpleTypeWithSDOPropertyType>
+ <ElementOfSimpleTypeWithSDOOppositePropertyType>idvalue0</ElementOfSimpleTypeWithSDOOppositePropertyType>
+
+ <!--445-->
+ <ComplexTypeOpenContent>
+ <tns:ElementSubstitutionGroupExtends>
+ <ElementInSubstitutionGroupBase>ElementInSubstitutionGroupBase</ElementInSubstitutionGroupBase>
+ <ElementInSubstitutionGroupExtends>ElementInSubstitutionGroupExtends</ElementInSubstitutionGroupExtends>
+ </tns:ElementSubstitutionGroupExtends>
+ </ComplexTypeOpenContent>
+
+</RootElement33> \ No newline at end of file
diff --git a/sdo-cpp/trunk/runtime/core/test/fidelity.xsd b/sdo-cpp/trunk/runtime/core/test/fidelity.xsd
new file mode 100644
index 0000000000..e57ba569d3
--- /dev/null
+++ b/sdo-cpp/trunk/runtime/core/test/fidelity.xsd
@@ -0,0 +1,92 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ Licensed to the Apache Software Foundation (ASF) under one
+ or more contributor license agreements. See the NOTICE file
+ distributed with this work for additional information
+ regarding copyright ownership. The ASF licenses this file
+ to you 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.
+-->
+<!--447-->
+<schema xmlns="http://www.w3.org/2001/XMLSchema"
+ targetNamespace="http://www.apache.org/tuscany/interop"
+ xmlns:tns="http://www.apache.org/tuscany/interop"
+ xmlns:sdo="commonj.sdo">
+
+ <!--488-->
+ <simpleType name="SimpleTypeWithNameType">
+ <restriction base="string"/>
+ </simpleType>
+ <element name="RootElement6" type="tns:SimpleTypeWithNameType"/>
+
+ <!--445-->
+ <complexType name="ComplexTypeOpenContentType">
+ <sequence>
+ <any namespace="##any"/>
+ </sequence>
+ </complexType>
+
+ <attribute name="AttributeReference" type="string"/>
+
+ <complexType name="ComplexTypeAttributesTestType">
+ <sequence>
+ </sequence>
+ <attribute name="Attribute" type="string"/>
+ <attribute name="AttributeWithSDOName" sdo:name="AttributeWithSDONameSDOName" type="string"/>
+ <attribute name="AttributeWithSDOAliasName" sdo:aliasName="AttributeWithSDOAliasNameSDOAliasName" type="string"/>
+ <attribute name="AttributeWithDefaultValue" type="string" default="AttributeWithDefaultValueDefaultValue"/>
+ <attribute name="AttributeWithFixedValue" type="string" fixed="AttributeWithFixedValueFixedValue"/>
+ <attribute ref="tns:AttributeReference"/>
+ <attribute name="AttributeWithSDOString" type="string" sdo:string="true"/>
+ <attribute name="AttributeWithSDOPropertyType" type="IDREF" sdo:propertyType="tns:SimpleTypeWithNameType"/>
+ <attribute name="AttributeWithSDOPropertySDOOppositePropertyType" type="IDREF" sdo:propertyType="tns:SimpleTypeWithNameType" sdo:oppositeProperty="tns:AttributeWithSDOPropertyType"/>
+ <attribute name="AttributeWithSDODataType" sdo:dataType="string" type="string"/>
+ </complexType>
+
+ <element name="RootElement33">
+ <complexType>
+ <sequence>
+ <element name="ComplexTypeAttributesTest" type="tns:ComplexTypeAttributesTestType"/>
+
+ <!--450-->
+ <element name="ElementOfSimpleTypeWithSDOPropertyType" type="IDREF" sdo:propertyType="tns:SimpleTypeWithNameType"/>
+ <element name="ElementOfSimpleTypeWithSDOOppositePropertyType" type="IDREF" sdo:propertyType="tns:SimpleTypeWithNameType" sdo:oppositeProperty="tns:ElementOfSimpleTypeWithSDOPropertyType"/>
+
+ <!--445-->
+ <element name="ComplexTypeOpenContent" type="tns:ComplexTypeOpenContentType"/>
+
+ </sequence>
+ </complexType>
+ </element>
+
+ <!--449-->
+
+ <complexType name="ComplexTypeSubstitutionGroupBaseType">
+ <sequence>
+ <element name="ElementInSubstitutionGroupBase" type="string"/>
+ </sequence>
+ </complexType>
+ <element name="ElementSubstitutionGroupBase" type="tns:ComplexTypeSubstitutionGroupBaseType"/>
+
+ <complexType name="ComplexTypeSubstitutionGroupExtendsType">
+ <complexContent>
+ <extension base="tns:ComplexTypeSubstitutionGroupBaseType">
+ <sequence>
+ <element name="ElementInSubstitutionGroupExtends" type="string"/>
+ </sequence>
+ </extension>
+ </complexContent>
+ </complexType>
+ <element name="ElementSubstitutionGroupExtends" type="tns:ComplexTypeSubstitutionGroupExtendsType" substitutionGroup="tns:ElementSubstitutionGroupBase"/>
+
+</schema> \ No newline at end of file
diff --git a/sdo-cpp/trunk/runtime/core/test/g/gCustomer.xsd b/sdo-cpp/trunk/runtime/core/test/g/gCustomer.xsd
new file mode 100644
index 0000000000..055d758ca4
--- /dev/null
+++ b/sdo-cpp/trunk/runtime/core/test/g/gCustomer.xsd
@@ -0,0 +1,50 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ Licensed to the Apache Software Foundation (ASF) under one
+ or more contributor license agreements. See the NOTICE file
+ distributed with this work for additional information
+ regarding copyright ownership. The ASF licenses this file
+ to you 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.
+-->
+
+<schema xmlns="http://www.w3.org/2001/XMLSchema"
+ xmlns:cust="customerNS" targetNamespace="customerNS">
+ <element name="customer" type="cust:CustomerType">
+ <complexType name="CustomerType">
+ <sequence>
+ <element name="customerId" type="ID"/>
+ <element name="name" type="string"/>
+ <element name="shipping" type="cust:AddressType">
+ <complexType name="AddressType">
+ <element name="street" type="string"/>
+ <element name="city" type="string"/>
+ <element name="state" type="string"/>
+ <element name="zip" type="string"/>
+ </complexType>
+ </element>
+ <element name="payment" ref="cust:payment"/>
+ </sequence>
+ </complexType>
+ </element>
+
+ <element name="payment" type="cust:PaymentType">
+ <complexType name="PaymentType">
+ <element name="paymentId" type="ID"/>
+ <element name="accountNo" type="string"/>
+ <element name="bank" type="string"/>
+ <element name="securityCode" type="string"/>
+ <element name="amount" type="float"/>
+ </complexType>
+ </element>
+</schema>
diff --git a/sdo-cpp/trunk/runtime/core/test/g/gOrder.xml b/sdo-cpp/trunk/runtime/core/test/g/gOrder.xml
new file mode 100644
index 0000000000..91a31c45f2
--- /dev/null
+++ b/sdo-cpp/trunk/runtime/core/test/g/gOrder.xml
@@ -0,0 +1,21 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ Licensed to the Apache Software Foundation (ASF) under one
+ or more contributor license agreements. See the NOTICE file
+ distributed with this work for additional information
+ regarding copyright ownership. The ASF licenses this file
+ to you 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.
+-->
+
+<order xmlns="orderNS" xsi:type="OrderType" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"><orderId>1132323800</orderId><status>NONE</status><item><itemId>12</itemId><description>Drummers drumming</description><price>12.99</price><quantity>1</quantity><warehouseId>1</warehouseId></item><item><itemId>3</itemId><description>French Hens</description><price>3.99</price><quantity>2</quantity><warehouseId>1</warehouseId></item><customer xmlns="customerNS"><customerId>1</customerId><name>Graham Charters</name><shipping><street>24 Big Street</street><city>Big City</city><state>Big State</state><zip>Up Your Coat</zip></shipping><payment><accountNo>234234234243</accountNo><bank>Big</bank><securityCode>234</securityCode><amount>2.097e+001</amount></payment></customer></order>
diff --git a/sdo-cpp/trunk/runtime/core/test/g/gOrder.xsd b/sdo-cpp/trunk/runtime/core/test/g/gOrder.xsd
new file mode 100644
index 0000000000..33683b1c62
--- /dev/null
+++ b/sdo-cpp/trunk/runtime/core/test/g/gOrder.xsd
@@ -0,0 +1,58 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ Licensed to the Apache Software Foundation (ASF) under one
+ or more contributor license agreements. See the NOTICE file
+ distributed with this work for additional information
+ regarding copyright ownership. The ASF licenses this file
+ to you 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.
+-->
+
+<schema xmlns="http://www.w3.org/2001/XMLSchema"
+xmlns:ord="orderNS" xmlns:cust="customerNS" targetNamespace="orderNS">
+
+ <include schemaLocation="./Customer.xsd"/>
+
+ <element name="order" type="ord:OrderType">
+ <complexType name="OrderType">
+ <sequence>
+ <element name="orderId" type="ID"/>
+ <element name="status" type="ord:OrderStatus"/>
+ <element name="item" maxOccurs="unbounded" ref="ord:item"/>
+ <element ref="cust:customer"/>
+ </sequence>
+ </complexType>
+ </element>
+
+ <element name="item">
+ <complexType>
+ <element name="itemId" type="integer"/>
+ <element name="description" type="string"/>
+ <element name="price" type="string"/>
+ <element name="quantity" type="integer"/>
+ <element name="warehouseId" type="integer"/>
+ </complexType>
+ </element>
+
+ <simpleType name="OrderStatus">
+ <restriction base="string">
+ <enumeration value="NONE"/>
+ <enumeration value="RECEIVED"/>
+ <enumeration value="INVOICED"/>
+ <enumeration value="DISPATCHED"/>
+ <enumeration value="COMPLETED"/>
+ <enumeration value="CANCELLED"/>
+ </restriction>
+ </simpleType>
+
+</schema>
diff --git a/sdo-cpp/trunk/runtime/core/test/g3.xsd b/sdo-cpp/trunk/runtime/core/test/g3.xsd
new file mode 100644
index 0000000000..4ed8b44fc2
--- /dev/null
+++ b/sdo-cpp/trunk/runtime/core/test/g3.xsd
@@ -0,0 +1,41 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ Licensed to the Apache Software Foundation (ASF) under one
+ or more contributor license agreements. See the NOTICE file
+ distributed with this work for additional information
+ regarding copyright ownership. The ASF licenses this file
+ to you 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.
+-->
+
+
+<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema" elementFormDefault="qualified">
+ <xs:element name="quotes">
+ <xs:complexType>
+ <xs:sequence>
+ <xs:element maxOccurs="unbounded" ref="quote"/>
+ </xs:sequence>
+ </xs:complexType>
+ </xs:element>
+ <xs:element name="quote">
+ <xs:complexType>
+ <xs:sequence>
+ <xs:element ref="phrase"/>
+ <xs:element ref="author"/>
+ </xs:sequence>
+ <xs:attribute name="year" use="required" type="xs:integer"/>
+ </xs:complexType>
+ </xs:element>
+ <xs:element name="phrase" type="xs:string"/>
+ <xs:element name="author" type="xs:string"/>
+</xs:schema> \ No newline at end of file
diff --git a/sdo-cpp/trunk/runtime/core/test/getproptest.txt b/sdo-cpp/trunk/runtime/core/test/getproptest.txt
new file mode 100644
index 0000000000..f6bea1325d
--- /dev/null
+++ b/sdo-cpp/trunk/runtime/core/test/getproptest.txt
@@ -0,0 +1,8 @@
+Companys name property is: name
+Companys dept property is:departments
+Departments empl property is:employees
+Departments empl property is:employees
+Employees name property is:name
+Normal exception caught
+Normal exception caught
+Normal exception caught
diff --git a/sdo-cpp/trunk/runtime/core/test/graham1.xsd b/sdo-cpp/trunk/runtime/core/test/graham1.xsd
new file mode 100644
index 0000000000..9c07e4b75d
--- /dev/null
+++ b/sdo-cpp/trunk/runtime/core/test/graham1.xsd
@@ -0,0 +1,40 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ Licensed to the Apache Software Foundation (ASF) under one
+ or more contributor license agreements. See the NOTICE file
+ distributed with this work for additional information
+ regarding copyright ownership. The ASF licenses this file
+ to you 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.
+-->
+
+<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema" elementFormDefault="qualified">
+ <xs:element name="quotes">
+ <xs:complexType>
+ <xs:sequence>
+ <xs:element maxOccurs="unbounded" ref="quote"/>
+ </xs:sequence>
+ </xs:complexType>
+ </xs:element>
+ <xs:element name="quote">
+ <xs:complexType>
+ <xs:sequence>
+ <xs:element ref="phrase"/>
+ <xs:element ref="author"/>
+ </xs:sequence>
+ <xs:attribute name="year" use="required" type="xs:integer"/>
+ </xs:complexType>
+ </xs:element>
+ <xs:element name="phrase" type="xs:string"/>
+ <xs:element name="author" type="xs:string"/>
+</xs:schema>
diff --git a/sdo-cpp/trunk/runtime/core/test/graham2.xsd b/sdo-cpp/trunk/runtime/core/test/graham2.xsd
new file mode 100644
index 0000000000..0148a42e41
--- /dev/null
+++ b/sdo-cpp/trunk/runtime/core/test/graham2.xsd
@@ -0,0 +1,39 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ Licensed to the Apache Software Foundation (ASF) under one
+ or more contributor license agreements. See the NOTICE file
+ distributed with this work for additional information
+ regarding copyright ownership. The ASF licenses this file
+ to you 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.
+-->
+
+<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema" elementFormDefault="qualified"
+xmlns:quotes="quotesNS" targetNamespace="quotesNS">
+<xs:element name="quotes">
+ <xs:complexType>
+ <xs:sequence>
+ <xs:element maxOccurs="unbounded" ref="quote"/>
+ </xs:sequence>
+ </xs:complexType>
+ </xs:element>
+ <xs:element name="quote" >
+ <xs:complexType>
+ <xs:sequence>
+ <xs:element name="phrase" type="xs:string"/>
+ <xs:element name="author" type="xs:string"/>
+ </xs:sequence>
+ <xs:attribute name="year" use="required" type="xs:integer"/>
+ </xs:complexType>
+ </xs:element>
+</xs:schema> \ No newline at end of file
diff --git a/sdo-cpp/trunk/runtime/core/test/graham3.xsd b/sdo-cpp/trunk/runtime/core/test/graham3.xsd
new file mode 100644
index 0000000000..969a6f8eb0
--- /dev/null
+++ b/sdo-cpp/trunk/runtime/core/test/graham3.xsd
@@ -0,0 +1,41 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ Licensed to the Apache Software Foundation (ASF) under one
+ or more contributor license agreements. See the NOTICE file
+ distributed with this work for additional information
+ regarding copyright ownership. The ASF licenses this file
+ to you 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.
+-->
+
+<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema" elementFormDefault="qualified"
+>
+<!--
+xmlns:quotes="quotesNS" targetNamespace="quotesNS"
+-->
+<xs:element name="quotes">
+ <xs:complexType>
+ <xs:sequence>
+ <xs:element name="quote" maxOccurs="unbounded">
+ <xs:complexType>
+ <xs:sequence>
+ <xs:element name="phrase" type="xs:string"/>
+ <xs:element name="author" type="xs:string"/>
+ </xs:sequence>
+ <xs:attribute name="year" use="required" type="xs:integer"/>
+ </xs:complexType>
+ </xs:element>
+ </xs:sequence>
+ </xs:complexType>
+ </xs:element>
+</xs:schema>
diff --git a/sdo-cpp/trunk/runtime/core/test/groupingroup.xsd b/sdo-cpp/trunk/runtime/core/test/groupingroup.xsd
new file mode 100644
index 0000000000..3e4a1a7d3a
--- /dev/null
+++ b/sdo-cpp/trunk/runtime/core/test/groupingroup.xsd
@@ -0,0 +1,45 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ Licensed to the Apache Software Foundation (ASF) under one
+ or more contributor license agreements. See the NOTICE file
+ distributed with this work for additional information
+ regarding copyright ownership. The ASF licenses this file
+ to you 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.
+-->
+
+<schema xmlns="http://www.w3.org/2001/XMLSchema" targetNamespace="http://www.wrox.com/name"
+xmlns:target="http://www.wrox.com/name" elementFormDefault="qualified">
+ <group name="NameGroup">
+ <sequence>
+ <element name="first" type="string"/>
+ <element name="middle" type="string"/>
+ <element name="last" type="string"/>
+ <group name="NameGroup2">
+ <sequence>
+ <element name="first2" type="string"/>
+ <element name="middle2" type="string"/>
+ <element name="last2" type="string"/>
+ </sequence>
+ </group>
+ </sequence>
+ </group>
+ <element name="name">
+ <complexType>
+ <group ref="NameGroup"/>
+ <group ref="NameGroup2"/>
+ <attribute name="title" type="string"/>
+ </complexType>
+ </element>
+
+</schema>
diff --git a/sdo-cpp/trunk/runtime/core/test/groupingroup_xsd.txt b/sdo-cpp/trunk/runtime/core/test/groupingroup_xsd.txt
new file mode 100644
index 0000000000..7eba22a274
--- /dev/null
+++ b/sdo-cpp/trunk/runtime/core/test/groupingroup_xsd.txt
@@ -0,0 +1,25 @@
+***** TYPES BEFORE RESOLVE **********************************
+Type:commonj.sdo#BigDecimal
+Type:commonj.sdo#BigInteger
+Type:commonj.sdo#Boolean
+Type:commonj.sdo#Byte
+Type:commonj.sdo#Bytes
+Type:commonj.sdo#ChangeSummary
+Type:commonj.sdo#Character
+Type:commonj.sdo#DataObject
+Type:commonj.sdo#Date
+Type:commonj.sdo#Double
+Type:commonj.sdo#Float
+Type:commonj.sdo#Integer
+Type:commonj.sdo#Long
+Type:commonj.sdo#Short
+Type:commonj.sdo#String
+Type:commonj.sdo#URI
+Type:http://www.wrox.com/name#RootType
+Property:name of type name
+Type:http://www.wrox.com/name#name
+Property:first of type String
+Property:middle of type String
+Property:last of type String
+Property:title of type String
+*******************************END TYPES******************
diff --git a/sdo-cpp/trunk/runtime/core/test/grouprefingroup.xsd b/sdo-cpp/trunk/runtime/core/test/grouprefingroup.xsd
new file mode 100644
index 0000000000..8e8a7aded6
--- /dev/null
+++ b/sdo-cpp/trunk/runtime/core/test/grouprefingroup.xsd
@@ -0,0 +1,45 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ Licensed to the Apache Software Foundation (ASF) under one
+ or more contributor license agreements. See the NOTICE file
+ distributed with this work for additional information
+ regarding copyright ownership. The ASF licenses this file
+ to you 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.
+-->
+
+<schema xmlns="http://www.w3.org/2001/XMLSchema" targetNamespace="http://www.wrox.com/name"
+xmlns:target="http://www.wrox.com/name" elementFormDefault="qualified">
+ <group name="NameGroup2">
+ <sequence>
+ <element name="first2" type="string"/>
+ <element name="middle2" type="string"/>
+ <element name="last2" type="string"/>
+ </sequence>
+ </group>
+ <group name="NameGroup">
+ <sequence>
+ <element name="first" type="string"/>
+ <element name="middle" type="string"/>
+ <element name="last" type="string"/>
+ <group ref="target:NameGroup2"/>
+ </sequence>
+ </group>
+ <element name="name">
+ <complexType>
+ <group ref="target:NameGroup"/>
+ <attribute name="title" type="string"/>
+ </complexType>
+ </element>
+
+</schema>
diff --git a/sdo-cpp/trunk/runtime/core/test/grouprefingroup_xsd.txt b/sdo-cpp/trunk/runtime/core/test/grouprefingroup_xsd.txt
new file mode 100644
index 0000000000..517d796e9f
--- /dev/null
+++ b/sdo-cpp/trunk/runtime/core/test/grouprefingroup_xsd.txt
@@ -0,0 +1,29 @@
+***** TYPES BEFORE RESOLVE **********************************
+Type:commonj.sdo#Boolean
+Type:commonj.sdo#Byte
+Type:commonj.sdo#Bytes
+Type:commonj.sdo#ChangeSummary
+Type:commonj.sdo#Character
+Type:commonj.sdo#DataObject
+Type:commonj.sdo#Date
+Type:commonj.sdo#Decimal
+Type:commonj.sdo#Double
+Type:commonj.sdo#Float
+Type:commonj.sdo#Int
+Type:commonj.sdo#Integer
+Type:commonj.sdo#Long
+Type:commonj.sdo#OpenDataObject
+Type:commonj.sdo#Short
+Type:commonj.sdo#String
+Type:commonj.sdo#URI
+Type:http://www.wrox.com/name#RootType
+Property:name of type name
+Type:http://www.wrox.com/name#name
+Property:first of type String
+Property:middle of type String
+Property:last of type String
+Property:first2 of type String
+Property:middle2 of type String
+Property:last2 of type String
+Property:title of type String
+*******************************END TYPES******************
diff --git a/sdo-cpp/trunk/runtime/core/test/grouptoolate.xsd b/sdo-cpp/trunk/runtime/core/test/grouptoolate.xsd
new file mode 100644
index 0000000000..1e1b5c5678
--- /dev/null
+++ b/sdo-cpp/trunk/runtime/core/test/grouptoolate.xsd
@@ -0,0 +1,37 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ Licensed to the Apache Software Foundation (ASF) under one
+ or more contributor license agreements. See the NOTICE file
+ distributed with this work for additional information
+ regarding copyright ownership. The ASF licenses this file
+ to you 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.
+-->
+
+<schema xmlns="http://www.w3.org/2001/XMLSchema" targetNamespace="http://www.wrox.com/name"
+xmlns:target="http://www.wrox.com/name" elementFormDefault="qualified">
+ <element name="name">
+ <complexType>
+ <group ref="target:NameGroup"/>
+ <attribute name="title" type="string"/>
+ </complexType>
+ </element>
+ <group name="NameGroup">
+ <sequence>
+ <element name="first" type="string"/>
+ <element name="middle" type="string"/>
+ <element name="last" type="string"/>
+ </sequence>
+ </group>
+
+</schema>
diff --git a/sdo-cpp/trunk/runtime/core/test/grouptoolate_xsd.txt b/sdo-cpp/trunk/runtime/core/test/grouptoolate_xsd.txt
new file mode 100644
index 0000000000..cea8efd41a
--- /dev/null
+++ b/sdo-cpp/trunk/runtime/core/test/grouptoolate_xsd.txt
@@ -0,0 +1,26 @@
+***** TYPES BEFORE RESOLVE **********************************
+Type:commonj.sdo#Boolean
+Type:commonj.sdo#Byte
+Type:commonj.sdo#Bytes
+Type:commonj.sdo#ChangeSummary
+Type:commonj.sdo#Character
+Type:commonj.sdo#DataObject
+Type:commonj.sdo#Date
+Type:commonj.sdo#Decimal
+Type:commonj.sdo#Double
+Type:commonj.sdo#Float
+Type:commonj.sdo#Int
+Type:commonj.sdo#Integer
+Type:commonj.sdo#Long
+Type:commonj.sdo#OpenDataObject
+Type:commonj.sdo#Short
+Type:commonj.sdo#String
+Type:commonj.sdo#URI
+Type:http://www.wrox.com/name#RootType
+Property:name of type name
+Type:http://www.wrox.com/name#name
+Property:first of type String
+Property:middle of type String
+Property:last of type String
+Property:title of type String
+*******************************END TYPES******************
diff --git a/sdo-cpp/trunk/runtime/core/test/groupwithprefix.xsd b/sdo-cpp/trunk/runtime/core/test/groupwithprefix.xsd
new file mode 100644
index 0000000000..fc61269d42
--- /dev/null
+++ b/sdo-cpp/trunk/runtime/core/test/groupwithprefix.xsd
@@ -0,0 +1,37 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ Licensed to the Apache Software Foundation (ASF) under one
+ or more contributor license agreements. See the NOTICE file
+ distributed with this work for additional information
+ regarding copyright ownership. The ASF licenses this file
+ to you 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.
+-->
+
+<schema xmlns="http://www.w3.org/2001/XMLSchema" targetNamespace="http://www.wrox.com/name"
+xmlns:target="http://www.wrox.com/name" elementFormDefault="qualified">
+ <group name="NameGroup">
+ <sequence>
+ <element name="first" type="string"/>
+ <element name="middle" type="string"/>
+ <element name="last" type="string"/>
+ </sequence>
+ </group>
+ <element name="name">
+ <complexType>
+ <group ref="target:NameGroup"/>
+ <attribute name="title" type="string"/>
+ </complexType>
+ </element>
+
+</schema>
diff --git a/sdo-cpp/trunk/runtime/core/test/groupwithprefix_xsd.txt b/sdo-cpp/trunk/runtime/core/test/groupwithprefix_xsd.txt
new file mode 100644
index 0000000000..cea8efd41a
--- /dev/null
+++ b/sdo-cpp/trunk/runtime/core/test/groupwithprefix_xsd.txt
@@ -0,0 +1,26 @@
+***** TYPES BEFORE RESOLVE **********************************
+Type:commonj.sdo#Boolean
+Type:commonj.sdo#Byte
+Type:commonj.sdo#Bytes
+Type:commonj.sdo#ChangeSummary
+Type:commonj.sdo#Character
+Type:commonj.sdo#DataObject
+Type:commonj.sdo#Date
+Type:commonj.sdo#Decimal
+Type:commonj.sdo#Double
+Type:commonj.sdo#Float
+Type:commonj.sdo#Int
+Type:commonj.sdo#Integer
+Type:commonj.sdo#Long
+Type:commonj.sdo#OpenDataObject
+Type:commonj.sdo#Short
+Type:commonj.sdo#String
+Type:commonj.sdo#URI
+Type:http://www.wrox.com/name#RootType
+Property:name of type name
+Type:http://www.wrox.com/name#name
+Property:first of type String
+Property:middle of type String
+Property:last of type String
+Property:title of type String
+*******************************END TYPES******************
diff --git a/sdo-cpp/trunk/runtime/core/test/groupwrongname.xsd b/sdo-cpp/trunk/runtime/core/test/groupwrongname.xsd
new file mode 100644
index 0000000000..8905af53d8
--- /dev/null
+++ b/sdo-cpp/trunk/runtime/core/test/groupwrongname.xsd
@@ -0,0 +1,38 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ Licensed to the Apache Software Foundation (ASF) under one
+ or more contributor license agreements. See the NOTICE file
+ distributed with this work for additional information
+ regarding copyright ownership. The ASF licenses this file
+ to you 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.
+-->
+
+
+<schema xmlns="http://www.w3.org/2001/XMLSchema" targetNamespace="http://www.wrox.com/name"
+xmlns:target="http://www.wrox.com/name" elementFormDefault="qualified">
+ <group name="NoNameGroup">
+ <sequence>
+ <element name="first" type="string"/>
+ <element name="middle" type="string"/>
+ <element name="last" type="string"/>
+ </sequence>
+ </group>
+ <element name="name">
+ <complexType>
+ <group ref="target:NameGroup"/>
+ <attribute name="title" type="string"/>
+ </complexType>
+ </element>
+
+</schema>
diff --git a/sdo-cpp/trunk/runtime/core/test/inc1.txt b/sdo-cpp/trunk/runtime/core/test/inc1.txt
new file mode 100644
index 0000000000..cef7597241
--- /dev/null
+++ b/sdo-cpp/trunk/runtime/core/test/inc1.txt
@@ -0,0 +1,22 @@
+Type:commonj.sdo#Boolean
+Type:commonj.sdo#Byte
+Type:commonj.sdo#Bytes
+Type:commonj.sdo#ChangeSummary
+Type:commonj.sdo#Character
+Type:commonj.sdo#DataObject
+Type:commonj.sdo#Date
+Type:commonj.sdo#Decimal
+Type:commonj.sdo#Double
+Type:commonj.sdo#Float
+Type:commonj.sdo#Int
+Type:commonj.sdo#Integer
+Type:commonj.sdo#Long
+Type:commonj.sdo#OpenDataObject
+Type:commonj.sdo#Short
+Type:commonj.sdo#String
+Type:commonj.sdo#URI
+Type:http://example.org/Calculator#RootType
+Type:http://example.org/CalculatorTypes#AddArguments
+Property:a
+Property:b
+Type:http://example.org/CalculatorTypes#RootType
diff --git a/sdo-cpp/trunk/runtime/core/test/inc2.txt b/sdo-cpp/trunk/runtime/core/test/inc2.txt
new file mode 100644
index 0000000000..e05462dd04
--- /dev/null
+++ b/sdo-cpp/trunk/runtime/core/test/inc2.txt
@@ -0,0 +1,21 @@
+Type:commonj.sdo#Boolean
+Type:commonj.sdo#Byte
+Type:commonj.sdo#Bytes
+Type:commonj.sdo#ChangeSummary
+Type:commonj.sdo#Character
+Type:commonj.sdo#DataObject
+Type:commonj.sdo#Date
+Type:commonj.sdo#Decimal
+Type:commonj.sdo#Double
+Type:commonj.sdo#Float
+Type:commonj.sdo#Int
+Type:commonj.sdo#Integer
+Type:commonj.sdo#Long
+Type:commonj.sdo#OpenDataObject
+Type:commonj.sdo#Short
+Type:commonj.sdo#String
+Type:commonj.sdo#URI
+Type:http://example.org/Calculator#AddArguments
+Property:a
+Property:b
+Type:http://example.org/Calculator#RootType
diff --git a/sdo-cpp/trunk/runtime/core/test/include.xsd b/sdo-cpp/trunk/runtime/core/test/include.xsd
new file mode 100644
index 0000000000..904ec8e1fd
--- /dev/null
+++ b/sdo-cpp/trunk/runtime/core/test/include.xsd
@@ -0,0 +1,34 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ Licensed to the Apache Software Foundation (ASF) under one
+ or more contributor license agreements. See the NOTICE file
+ distributed with this work for additional information
+ regarding copyright ownership. The ASF licenses this file
+ to you 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.
+-->
+
+ <xsd:schema
+ xmlns:xsd="http://www.w3.org/2001/XMLSchema"
+ xmlns:sdo="commonj.sdo"
+ xmlns:sdoxml="commonj.sdo/xml"
+ xmlns:company="companyNS"
+ targetNamespace="companyNS">
+
+ <xsd:include schemaLocation = "include1.xsd"/>
+ <xsd:include schemaLocation = "./include2.xsd"/>
+ <xsd:include schemaLocation = "../test/test/include3.xsd"/>
+
+
+ </xsd:schema>
+
diff --git a/sdo-cpp/trunk/runtime/core/test/include1.xsd b/sdo-cpp/trunk/runtime/core/test/include1.xsd
new file mode 100644
index 0000000000..8c4187077c
--- /dev/null
+++ b/sdo-cpp/trunk/runtime/core/test/include1.xsd
@@ -0,0 +1,38 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ Licensed to the Apache Software Foundation (ASF) under one
+ or more contributor license agreements. See the NOTICE file
+ distributed with this work for additional information
+ regarding copyright ownership. The ASF licenses this file
+ to you 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.
+-->
+
+ <xsd:schema
+ xmlns:xsd="http://www.w3.org/2001/XMLSchema"
+ xmlns:sdo="commonj.sdo"
+ xmlns:sdoxml="commonj.sdo/xml"
+ xmlns:company="companyNS"
+ targetNamespace="companyNS">
+
+ <xsd:element name="company" type="company:CompanyType"/>
+ <xsd:complexType name="CompanyType">
+ <xsd:sequence>
+ <xsd:element name="departments" type="company:DepartmentType" maxOccurs="unbounded"/>
+ </xsd:sequence>
+ <xsd:attribute name="name" type="xsd:string"/>
+ <xsd:attribute name="cs" type="sdo:ChangeSummaryType"/>
+ <xsd:attribute name="employeeOfTheMonth" type="xsd:IDREF" sdoxml:propertyType="company:EmployeeType"/>
+ </xsd:complexType>
+ </xsd:schema>
+
diff --git a/sdo-cpp/trunk/runtime/core/test/include2.xsd b/sdo-cpp/trunk/runtime/core/test/include2.xsd
new file mode 100644
index 0000000000..5c05afdf36
--- /dev/null
+++ b/sdo-cpp/trunk/runtime/core/test/include2.xsd
@@ -0,0 +1,37 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ Licensed to the Apache Software Foundation (ASF) under one
+ or more contributor license agreements. See the NOTICE file
+ distributed with this work for additional information
+ regarding copyright ownership. The ASF licenses this file
+ to you 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.
+-->
+
+ <xsd:schema
+ xmlns:xsd="http://www.w3.org/2001/XMLSchema"
+ xmlns:sdo="commonj.sdo"
+ xmlns:sdoxml="commonj.sdo/xml"
+ xmlns:company="companyNS"
+ targetNamespace="companyNS">
+
+ <xsd:complexType name="DepartmentType">
+ <xsd:sequence>
+ <xsd:element name="employees" type="company:EmployeeType" maxOccurs="unbounded"/>
+ </xsd:sequence>
+ <xsd:attribute name="name" type="xsd:string"/>
+ <xsd:attribute name="location" type="xsd:string"/>
+ <xsd:attribute name="number" type="xsd:int"/>
+ </xsd:complexType>
+ </xsd:schema>
+
diff --git a/sdo-cpp/trunk/runtime/core/test/includeother3.xsd b/sdo-cpp/trunk/runtime/core/test/includeother3.xsd
new file mode 100644
index 0000000000..c661f6871e
--- /dev/null
+++ b/sdo-cpp/trunk/runtime/core/test/includeother3.xsd
@@ -0,0 +1,34 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ Licensed to the Apache Software Foundation (ASF) under one
+ or more contributor license agreements. See the NOTICE file
+ distributed with this work for additional information
+ regarding copyright ownership. The ASF licenses this file
+ to you 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.
+-->
+
+ <xsd:schema
+ xmlns:xsd="http://www.w3.org/2001/XMLSchema"
+ xmlns:sdo="commonj.sdo"
+ xmlns:sdoxml="commonj.sdo/xml"
+ xmlns:company="companyNS"
+ targetNamespace="companyNS">
+
+ <xsd:complexType name="EmployeeType">
+ <xsd:attribute name="name" type="xsd:string"/>
+ <xsd:attribute name="SN" type="xsd:ID"/>
+ <xsd:attribute name="manager" type="xsd:boolean"/>
+ </xsd:complexType>
+ </xsd:schema>
+
diff --git a/sdo-cpp/trunk/runtime/core/test/jira1112expected.xml b/sdo-cpp/trunk/runtime/core/test/jira1112expected.xml
new file mode 100644
index 0000000000..afbfc26c23
--- /dev/null
+++ b/sdo-cpp/trunk/runtime/core/test/jira1112expected.xml
@@ -0,0 +1,9 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<BOGUS xsi:type="tns2:add" xmlns:tns2="http://Component" xmlns:tns3="http://www.test.com/info" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
+ <person>
+ <name>
+ <first>Will</first>
+ <last>Shakespeare</last>
+ </name>
+ </person>
+</BOGUS>
diff --git a/sdo-cpp/trunk/runtime/core/test/jira490.txt b/sdo-cpp/trunk/runtime/core/test/jira490.txt
new file mode 100644
index 0000000000..34c22dfda3
--- /dev/null
+++ b/sdo-cpp/trunk/runtime/core/test/jira490.txt
@@ -0,0 +1,53 @@
+Test Program starting to create types ...
+
+Before Resolution
+
+Printing Types
+Type Boolean
+Type Byte
+Type Bytes
+Type ChangeSummary
+Type Character
+Type DataObject
+Type Date
+Type Decimal
+Type Double
+Type Float
+Type Int
+Type Integer
+Type Long
+Type OpenDataObject
+Type Short
+Type String
+Type URI
+Type Employee
+Has Property name of type String
+Has Property officeNumber of type String
+
+After Resolution
+
+Printing Types
+Type Boolean
+Type Byte
+Type Bytes
+Type ChangeSummary
+Type Character
+Type DataObject
+Type Date
+Type Decimal
+Type Double
+Type Float
+Type Int
+Type Integer
+Type Long
+Type OpenDataObject
+Type Short
+Type String
+Type URI
+Type Employee
+Has Property name of type String
+Has Property officeNumber of type String
+Mr A Trader
+123
+123
+{
diff --git a/sdo-cpp/trunk/runtime/core/test/jira705.xsd b/sdo-cpp/trunk/runtime/core/test/jira705.xsd
new file mode 100644
index 0000000000..0001371677
--- /dev/null
+++ b/sdo-cpp/trunk/runtime/core/test/jira705.xsd
@@ -0,0 +1,31 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ Licensed to the Apache Software Foundation (ASF) under one
+ or more contributor license agreements. See the NOTICE file
+ distributed with this work for additional information
+ regarding copyright ownership. The ASF licenses this file
+ to you 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.
+-->
+
+<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema"
+ targetNamespace="http://ConvertedStockQuote">
+ <xs:element name="getQuote">
+ <xs:complexType>
+ <xs:sequence>
+ <xs:element name="ticker1" type="xs:string" nillable="true"/>
+ <xs:element name="ticker2" type="xs:string" nillable="true"/>
+ </xs:sequence>
+ </xs:complexType>
+ </xs:element>
+</xs:schema>
diff --git a/sdo-cpp/trunk/runtime/core/test/jira705_out.txt b/sdo-cpp/trunk/runtime/core/test/jira705_out.txt
new file mode 100644
index 0000000000..8411d1e07c
--- /dev/null
+++ b/sdo-cpp/trunk/runtime/core/test/jira705_out.txt
@@ -0,0 +1,5 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<getQuote xsi:type="tns2:getQuote" xmlns:tns2="http://ConvertedStockQuote" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
+ <ticker1>IBM</ticker1>
+ <ticker2 xsi:nil="true"/>
+</getQuote>
diff --git a/sdo-cpp/trunk/runtime/core/test/jira980_animaltypes.xsd b/sdo-cpp/trunk/runtime/core/test/jira980_animaltypes.xsd
new file mode 100644
index 0000000000..bdac34da46
--- /dev/null
+++ b/sdo-cpp/trunk/runtime/core/test/jira980_animaltypes.xsd
@@ -0,0 +1,39 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ Licensed to the Apache Software Foundation (ASF) under one
+ or more contributor license agreements. See the NOTICE file
+ distributed with this work for additional information
+ regarding copyright ownership. The ASF licenses this file
+ to you 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.
+-->
+<schema xmlns="http://www.w3.org/2001/XMLSchema">
+ <complexType name="snakeType">
+ <sequence>
+ <element name= "name" type="string"/>
+ <element name= "length" type="positiveInteger" />
+ </sequence>
+ </complexType>
+ <complexType name="bearType">
+ <sequence>
+ <element name= "name" type="string"/>
+ <element name= "weight" type="positiveInteger" />
+ </sequence>
+ </complexType>
+ <complexType name="pantherType">
+ <sequence>
+ <element name= "name" type="string"/>
+ <element name= "colour" type="string" />
+ </sequence>
+ </complexType>
+</schema>
diff --git a/sdo-cpp/trunk/runtime/core/test/jira980_jungle.xsd b/sdo-cpp/trunk/runtime/core/test/jira980_jungle.xsd
new file mode 100644
index 0000000000..abe6132f08
--- /dev/null
+++ b/sdo-cpp/trunk/runtime/core/test/jira980_jungle.xsd
@@ -0,0 +1,28 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ Licensed to the Apache Software Foundation (ASF) under one
+ or more contributor license agreements. See the NOTICE file
+ distributed with this work for additional information
+ regarding copyright ownership. The ASF licenses this file
+ to you 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.
+-->
+<schema xmlns="http://www.w3.org/2001/XMLSchema">
+ <element name="jungle">
+ <complexType>
+ <sequence>
+ <any minOccurs="0" maxOccurs="unbounded"/>
+ </sequence>
+ </complexType>
+ </element>
+</schema>
diff --git a/sdo-cpp/trunk/runtime/core/test/jira980_jungle_out.txt b/sdo-cpp/trunk/runtime/core/test/jira980_jungle_out.txt
new file mode 100644
index 0000000000..708fd26963
--- /dev/null
+++ b/sdo-cpp/trunk/runtime/core/test/jira980_jungle_out.txt
@@ -0,0 +1,2 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<jungle xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"><bear xsi:type="bearType"><name>Mummy bear</name><weight>700</weight></bear><panther xsi:type="pantherType"><name>Bagheera</name><colour>inky black</colour></panther><snake xsi:type="snakeType"><name>Kaa</name><length>25</length></snake></jungle>
diff --git a/sdo-cpp/trunk/runtime/core/test/jira980_mixedJungle.xsd b/sdo-cpp/trunk/runtime/core/test/jira980_mixedJungle.xsd
new file mode 100644
index 0000000000..95697e1788
--- /dev/null
+++ b/sdo-cpp/trunk/runtime/core/test/jira980_mixedJungle.xsd
@@ -0,0 +1,28 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ Licensed to the Apache Software Foundation (ASF) under one
+ or more contributor license agreements. See the NOTICE file
+ distributed with this work for additional information
+ regarding copyright ownership. The ASF licenses this file
+ to you 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.
+-->
+<schema xmlns="http://www.w3.org/2001/XMLSchema">
+ <element name="mixedJungle">
+ <complexType mixed="true">
+ <sequence>
+ <any minOccurs="0" maxOccurs="unbounded"/>
+ </sequence>
+ </complexType>
+ </element>
+</schema>
diff --git a/sdo-cpp/trunk/runtime/core/test/jira980_mixedJungle_out.txt b/sdo-cpp/trunk/runtime/core/test/jira980_mixedJungle_out.txt
new file mode 100644
index 0000000000..63b4e85c26
--- /dev/null
+++ b/sdo-cpp/trunk/runtime/core/test/jira980_mixedJungle_out.txt
@@ -0,0 +1,2 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<mixedJungle xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"><bear xsi:type="bearType"><name>Mummy bear</name><weight>700</weight></bear><panther xsi:type="pantherType"><name>Bagheera</name><colour>inky black</colour></panther><snake xsi:type="snakeType"><name>Kaa</name><length>25</length></snake></mixedJungle>
diff --git a/sdo-cpp/trunk/runtime/core/test/jira980_splitJungle_out.txt b/sdo-cpp/trunk/runtime/core/test/jira980_splitJungle_out.txt
new file mode 100644
index 0000000000..708fd26963
--- /dev/null
+++ b/sdo-cpp/trunk/runtime/core/test/jira980_splitJungle_out.txt
@@ -0,0 +1,2 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<jungle xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"><bear xsi:type="bearType"><name>Mummy bear</name><weight>700</weight></bear><panther xsi:type="pantherType"><name>Bagheera</name><colour>inky black</colour></panther><snake xsi:type="snakeType"><name>Kaa</name><length>25</length></snake></jungle>
diff --git a/sdo-cpp/trunk/runtime/core/test/list1.xml b/sdo-cpp/trunk/runtime/core/test/list1.xml
new file mode 100644
index 0000000000..a40accebc2
--- /dev/null
+++ b/sdo-cpp/trunk/runtime/core/test/list1.xml
@@ -0,0 +1,32 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ Licensed to the Apache Software Foundation (ASF) under one
+ or more contributor license agreements. See the NOTICE file
+ distributed with this work for additional information
+ regarding copyright ownership. The ASF licenses this file
+ to you 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.
+-->
+
+<listtest
+ xmlns="http://www.wrox.com/name"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-Instance"
+ xsi:schemaLocation="http://www.wrox.com/name name.xsd">
+ <integers>1 2 3 4 5 6 7 8 9</integers>
+ <strings>
+ This
+is a strange
+ set of strings
+ </strings>
+</listtest>
+
diff --git a/sdo-cpp/trunk/runtime/core/test/list1.xsd b/sdo-cpp/trunk/runtime/core/test/list1.xsd
new file mode 100644
index 0000000000..d178693ae7
--- /dev/null
+++ b/sdo-cpp/trunk/runtime/core/test/list1.xsd
@@ -0,0 +1,44 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ Licensed to the Apache Software Foundation (ASF) under one
+ or more contributor license agreements. See the NOTICE file
+ distributed with this work for additional information
+ regarding copyright ownership. The ASF licenses this file
+ to you 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.
+-->
+
+
+<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema"
+ targetNamespace="http://www.wrox.com/name"
+ xmlns:tns="http://www.wrox.com/name">
+
+<xs:element name="listtest" type="listTestType"/>
+<xs:complexType name="listTestType">
+ <xs:element name="integers" type="intListType"/>
+ <xs:element name="strings" type="stringListType"/>
+</xs:complexType>
+
+<xs:simpleType name="intListType">
+ <xs:list itemType="xs:int"/>
+</xs:simpleType>
+
+<xs:simpleType name="stringListType">
+ <xs:list itemType="xs:string"/>
+</xs:simpleType>
+
+</xs:schema>
+
+
+
+
diff --git a/sdo-cpp/trunk/runtime/core/test/list1_xml.txt b/sdo-cpp/trunk/runtime/core/test/list1_xml.txt
new file mode 100644
index 0000000000..c0afcd0b11
--- /dev/null
+++ b/sdo-cpp/trunk/runtime/core/test/list1_xml.txt
@@ -0,0 +1,70 @@
+***** TYPES AFTER RESOLVE*********************************
+Type:commonj.sdo#Boolean
+Type:commonj.sdo#Byte
+Type:commonj.sdo#Bytes
+Type:commonj.sdo#ChangeSummary
+Type:commonj.sdo#Character
+Type:commonj.sdo#DataObject
+Type:commonj.sdo#Date
+Type:commonj.sdo#Decimal
+Type:commonj.sdo#Double
+Type:commonj.sdo#Float
+Type:commonj.sdo#Int
+Type:commonj.sdo#Integer
+Type:commonj.sdo#Long
+Type:commonj.sdo#OpenDataObject
+Type:commonj.sdo#Short
+Type:commonj.sdo#String
+Type:commonj.sdo#URI
+Type:http://www.wrox.com/name#RootType
+Property:listtest of type listTestType
+Type:http://www.wrox.com/name#intListType
+Property:values (many) of type Int
+Type:http://www.wrox.com/name#listTestType
+Property:integers (many) of type intListType
+Property:strings (many) of type stringListType
+Type:http://www.wrox.com/name#stringListType
+Property:values (many) of type String
+*******************************END TYPES******************
+===== DataObject contents =====
+integers: list dataObject[0]=
+===== DataObject contents =====
+values: list int[0]=1
+
+int[1]=2
+
+int[2]=3
+
+int[3]=4
+
+int[4]=5
+
+int[5]=6
+
+int[6]=7
+
+int[7]=8
+
+int[8]=9
+
+===== End DataObject =====
+
+strings: list dataObject[0]=
+===== DataObject contents =====
+values: list string[0]=This
+
+string[1]=is
+
+string[2]=a
+
+string[3]=strange
+
+string[4]=set
+
+string[5]=of
+
+string[6]=strings
+
+===== End DataObject =====
+
+===== End DataObject =====
diff --git a/sdo-cpp/trunk/runtime/core/test/list1_xsd.txt b/sdo-cpp/trunk/runtime/core/test/list1_xsd.txt
new file mode 100644
index 0000000000..a05cc9671a
--- /dev/null
+++ b/sdo-cpp/trunk/runtime/core/test/list1_xsd.txt
@@ -0,0 +1,28 @@
+***** TYPES BEFORE RESOLVE **********************************
+Type:commonj.sdo#Boolean
+Type:commonj.sdo#Byte
+Type:commonj.sdo#Bytes
+Type:commonj.sdo#ChangeSummary
+Type:commonj.sdo#Character
+Type:commonj.sdo#DataObject
+Type:commonj.sdo#Date
+Type:commonj.sdo#Decimal
+Type:commonj.sdo#Double
+Type:commonj.sdo#Float
+Type:commonj.sdo#Int
+Type:commonj.sdo#Integer
+Type:commonj.sdo#Long
+Type:commonj.sdo#OpenDataObject
+Type:commonj.sdo#Short
+Type:commonj.sdo#String
+Type:commonj.sdo#URI
+Type:http://www.wrox.com/name#RootType
+Property:listtest of type listTestType
+Type:http://www.wrox.com/name#intListType
+Property:values (many) of type Int
+Type:http://www.wrox.com/name#listTestType
+Property:integers (many) of type intListType
+Property:strings (many) of type stringListType
+Type:http://www.wrox.com/name#stringListType
+Property:values (many) of type String
+*******************************END TYPES******************
diff --git a/sdo-cpp/trunk/runtime/core/test/loadload-output.txt b/sdo-cpp/trunk/runtime/core/test/loadload-output.txt
new file mode 100644
index 0000000000..67f8c2d7eb
--- /dev/null
+++ b/sdo-cpp/trunk/runtime/core/test/loadload-output.txt
@@ -0,0 +1,2 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<company xsi:type="tns2:CompanyType" xmlns:tns2="companyNS" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" name="ACME"><sdo:changeSummary xmlns:sdo="commonj.sdo" logging="true"><create>#/departments.0/employees.0/opendataobjectlist.0</create><create>#/departments.0/employees.0/opendataobject</create><create>#/departments.0/employees.0</create></sdo:changeSummary><departments name="Advanced Technologies" location="NY" number="123"><employees name="Albert" SN="E0001" openstring="Value Of Open String" openboolean="true"><openintlist>45</openintlist><tns2:opendataobjectlist name="MyOpenName"/><tns2:opendataobject name="MyOpenName"/></employees><employees name="Boris" SN="E0002" manager="true"/><employees name="Carl" SN="E0003"/></departments></company>
diff --git a/sdo-cpp/trunk/runtime/core/test/main.cpp b/sdo-cpp/trunk/runtime/core/test/main.cpp
new file mode 100644
index 0000000000..677abbabea
--- /dev/null
+++ b/sdo-cpp/trunk/runtime/core/test/main.cpp
@@ -0,0 +1,220 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you 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$ */
+
+#include <stdio.h>
+
+#pragma warning(disable:4786)
+
+#include <iostream>
+using namespace std;
+
+#include "sdotest.h"
+
+extern "C"{
+
+#define TEST(testname) \
+ ++totaltests; \
+ try { \
+ value = testname; \
+ cout << "Test " << totaltests << ": " << #testname << " ..... "; \
+ if (value) { \
+ cout << "OK" << endl; \
+ ++testspassed; \
+ } \
+ else { \
+ cout << "FAILED" << endl; \
+ } \
+ } \
+ catch(const SDORuntimeException&) { \
+ cout << "Test " << totaltests << ": " << #testname << " ..... "; \
+ cout << "FAILED (unexpected SDO exception)" << endl; \
+ } \
+ catch(...) { \
+ cout << "Test " << totaltests << ": " << #testname << " ..... "; \
+ cout << "FAILED (unexpected unknown exception)" << endl; \
+ }
+
+int main (int argc, char** argv)
+{
+ //Logger::setLogging(20);
+
+ int testspassed=0;
+ int totaltests=0;
+ int value = 0;
+ try {
+ //TEST ( sdotest::eBayTest() );
+ // TEST ( sdotest::xhtml1() );
+ TEST ( sdotest::scopetest() );
+ TEST ( sdotest::xsdtosdo() );
+ TEST ( sdotest::jira980() );
+
+ /* groups now supported*/
+ TEST ( sdotest::testany("list1.xsd",0,"list1.xml", 0) );
+ TEST ( sdotest::testany("b48636.xsd",0,"b48636.xml", 0) );
+ TEST ( sdotest::testany("groupwithprefix.xsd", 0, 0, 0) );
+ TEST ( sdotest::testany("groupwrongname.xsd","Use of undefined group NameGroup", 0, 0) );
+
+ // late definition of group now supported
+ TEST ( sdotest::testany("grouptoolate.xsd",0 , 0, 0) );
+
+ // group definition within group now ignored
+
+ TEST ( sdotest::testany("groupingroup.xsd","Use of undefined group NameGroup2",0, 0) );
+ TEST ( sdotest::testany("grouprefingroup.xsd",0,0, 0) );
+ TEST ( sdotest::testany("bothgroups.xsd",0,0, 0) );
+ TEST ( sdotest::testany("bothgroupssamename.xsd",0,0, 0) );
+
+ /* general tests */
+ TEST ( sdotest::pete() );
+ TEST ( sdotest::stocktest() );
+ TEST ( sdotest::definetest() );
+ TEST ( sdotest::emptycs() );
+ TEST ( sdotest::openseq() );
+ TEST ( sdotest::testanytwo("b48633b.xsd","b48633.xsd","b48633.xml") );
+ TEST ( sdotest::testany("b48686.xsd",0, "b48686.xml", 0) );
+ TEST ( sdotest::testany("b48636.xsd","Use of undefined group NameGroup","b48636.xml", 0) );
+ TEST ( sdotest::b48602() );
+ TEST ( sdotest::compatiblefactory() );
+ TEST ( sdotest::simple() );
+ TEST ( sdotest::testOrder("employee.xsd","extension.xsd","order1.dat","order1.txt") );
+ TEST ( sdotest::testOrder("extension.xsd","employee.xsd","order2.dat","order2.txt") );
+ TEST ( sdotest::testOpen() );
+ TEST ( sdotest::testinc2("calculator2.wsdl","inc1.dat","inc1.txt") );
+ TEST ( sdotest::testinc2("calculator2a.wsdl","inc2.dat","inc2.txt") );
+ TEST ( sdotest::teststyles() );
+ TEST ( sdotest::badelement() );
+ TEST ( sdotest::oddchars() );
+ TEST ( sdotest::notns() );
+ TEST ( sdotest::unsetlist() );
+ TEST ( sdotest::travel() );
+ /*TEST ( sdotest::testwsdl() );*/
+ TEST ( sdotest::bunique() );
+ TEST ( sdotest::buniqueread() );
+ TEST ( sdotest::propdefaulttest() );
+ TEST ( sdotest::graham5() );
+ TEST ( sdotest::graham4() );
+ TEST ( sdotest::detachtest() );
+ TEST ( sdotest::includetest() );
+ TEST ( sdotest::testLoad() );
+ TEST ( sdotest::leak() );
+ TEST ( sdotest::twolists() );
+ TEST ( sdotest::testUtil() );
+ TEST ( sdotest::clonetest() );
+ TEST ( sdotest::notfound() );
+ TEST ( sdotest::testErrors() );
+ TEST ( sdotest::loadManyOpen() );
+ TEST ( sdotest::doctest() );
+ TEST ( sdotest::graham3() );
+ TEST ( sdotest::graham1() );
+ TEST ( sdotest::graham2() );
+ TEST ( sdotest::merle1() );
+ TEST ( sdotest::loadOpenNS() );
+ TEST ( sdotest::saveOpen() );
+ TEST ( sdotest::loadOpen() );
+ TEST ( sdotest::testui() );
+ TEST ( sdotest::testSCA() );
+ TEST ( sdotest::testabstract() );
+ TEST ( sdotest::testsubsload() );
+ TEST ( sdotest::testsubs() );
+ TEST ( sdotest::setnull() );
+ TEST ( sdotest::bug2() );
+ TEST ( sdotest::cssave2() );
+ TEST ( sdotest::csload2() );
+ TEST ( sdotest::cssave() );
+ TEST ( sdotest::csload() );
+ TEST ( sdotest::bug1() );
+ TEST ( sdotest::eqhelpertest() );
+ TEST ( sdotest::cohelpertest() );
+ TEST ( sdotest::datetest() );
+ TEST ( sdotest::carotest3() );
+ TEST ( sdotest::matttest1() );
+ TEST ( sdotest::adddeletetest() );
+ TEST ( sdotest::carotest2() );
+ TEST ( sdotest::carotest() );
+ TEST ( sdotest::setmany() );
+ TEST ( sdotest::noncontest() );
+ TEST ( sdotest::versiontest() );
+ TEST ( sdotest::defaulttest() );
+ TEST ( sdotest::defaulttest_strobj() );
+ TEST ( sdotest::nulltest() );
+ TEST ( sdotest::usertest() );
+ TEST ( sdotest::querytest() );
+ TEST ( sdotest::getproptest() );
+ TEST ( sdotest::rcptest() );
+ TEST ( sdotest::seqtest() );
+ TEST ( sdotest::changesummarytest() );
+ TEST ( sdotest::conversiontest() );
+ TEST ( sdotest::boolbug() );
+ TEST ( sdotest::scope1() );
+ TEST ( sdotest::scope2() );
+ TEST ( sdotest::scope3() );
+ TEST ( sdotest::maintest() );
+
+ /* regression tests */
+ TEST ( sdotest::b48736() );
+ /*TEST ( sdotest::b48601() );*/
+ TEST ( sdotest::b47293() );
+ TEST ( sdotest::b48300() );
+ TEST ( sdotest::b47663() );
+ TEST ( sdotest::b47802() );
+ TEST ( sdotest::b47137() );
+ TEST ( sdotest::b47137b() );
+ TEST ( sdotest::b46633() );
+ TEST ( sdotest::b46693() );
+ TEST ( sdotest::b46734() );
+ TEST ( sdotest::b46634() );
+ TEST ( sdotest::b46617b() );
+ TEST ( sdotest::b46617() );
+ TEST ( sdotest::b46613() );
+ TEST ( sdotest::b45933() );
+ TEST ( sdotest::jira490() );
+ TEST ( sdotest::jira705() );
+ TEST ( sdotest::jira546() );
+ TEST ( sdotest::jira945() );
+ TEST ( sdotest::testXPath() );
+
+ TEST ( sdotest::cdatatest() );
+ TEST ( sdotest::cloneopentest() );
+ TEST ( sdotest::tuscany963() );
+ TEST ( sdotest::tuscany562() );
+ TEST ( sdotest::typedefinitionstest() );
+
+ TEST ( sdotest::jira1174() );
+ TEST ( sdotest::jira1238() );
+ TEST ( sdotest::loadWithoutSchema() );
+ //TEST ( sdotest::jira445() );
+ TEST ( sdotest::jira1112() );
+ TEST ( sdotest::elementFormDefaultQualified() );
+ TEST ( sdotest::elementFormDefaultQualifiedSequence() );
+ TEST ( sdotest::xsiTypeAbstract() );
+ TEST ( sdotest::refCount() );
+ TEST ( sdotest::jira1548() );
+ TEST ( sdotest::jira1837() );
+
+ } catch(...)
+ {
+ cout << "unexpected exception caught" << endl;
+ }
+
+ cout << "Total tests:" << totaltests << " Tests passed:" << testspassed << endl;
+ return testspassed - totaltests;
+}
+}
diff --git a/sdo-cpp/trunk/runtime/core/test/maintest.txt b/sdo-cpp/trunk/runtime/core/test/maintest.txt
new file mode 100644
index 0000000000..b6fbcaa378
--- /dev/null
+++ b/sdo-cpp/trunk/runtime/core/test/maintest.txt
@@ -0,0 +1,188 @@
+Test Program starting to create types ...
+Manager is sequenced?1
+Manager is sequenced?1
+Manager is sequenced?1
+Manager is sequenced?1
+Manager is sequenced?1
+Manager is sequenced?1
+Manager is sequenced?1
+Should be Company :Company
+Should be 3: 3
+Alias: TheFirm
+Alias: TheBigFirm
+Alias: TheLittleFirm
+Manager is sequenced?1
+BEFORE RESOLUTION
+Printing Types
+Type Boolean
+Type Byte
+Type Bytes
+Type ChangeSummary
+Type Character
+Type DataObject
+Type Date
+Type Decimal
+Type Double
+Type Float
+Type Int
+Type Integer
+Type Long
+Type OpenDataObject
+Type Short
+Type String
+Type URI
+Type Company
+Has Property name of type String
+Has Property address of type String
+Has Property departments of type Department
+Has Property employee of the month of type Employee
+Has Property floatlist of type Float
+Has Property pdg of type Manager
+Has Property shareholder of type Person
+Has Property substring of type DerivedString
+Has Property subdepartments of type SubDepartment
+Type Department
+Has Property name of type String
+Has Property id of type Int
+Has Property manager of type Manager
+Has Property employees of type Employee
+Type DerivedString
+Type Employee
+Has Property name of type String
+Has Property cubelocation of type String
+Type Manager
+Has Property name of type String
+Has Property officeid of type String
+Has Property str of type String
+Has Property boolean of type Boolean
+Has Property byte of type Byte
+Has Property character of type Character
+Has Property short of type Short
+Has Property long of type Int
+Has Property longlong of type Long
+Has Property float of type Float
+Has Property longdouble of type Double
+Has Property date of type Date
+Has Property string of type String
+Has Property bytes of type Bytes
+Type Person
+Has Property haircolour of type String
+Has Property name of type String
+Type SubDepartment
+Has Property subname of type String
+AFTER RESOLUTION
+Printing Types
+Type Boolean
+Type Byte
+Type Bytes
+Type ChangeSummary
+Type Character
+Type DataObject
+Type Date
+Type Decimal
+Type Double
+Type Float
+Type Int
+Type Integer
+Type Long
+Type OpenDataObject
+Type Short
+Type String
+Type URI
+Type Company
+Has Property name of type String
+Has Property address of type String
+Has Property departments of type Department
+Has Property employee of the month of type Employee
+Has Property floatlist of type Float
+Has Property pdg of type Manager
+Has Property shareholder of type Person
+Has Property substring of type DerivedString
+Has Property subdepartments of type SubDepartment
+Type Department
+Has Property name of type String
+Has Property id of type Int
+Has Property manager of type Manager
+Has Property employees of type Employee
+Type DerivedString
+Type Employee
+Has Property haircolour of type String
+Has Property name of type String
+Has Property name of type String
+Has Property cubelocation of type String
+Type Manager
+Has Property haircolour of type String
+Has Property name of type String
+Has Property name of type String
+Has Property officeid of type String
+Has Property str of type String
+Has Property boolean of type Boolean
+Has Property byte of type Byte
+Has Property character of type Character
+Has Property short of type Short
+Has Property long of type Int
+Has Property longlong of type Long
+Has Property float of type Float
+Has Property longdouble of type Double
+Has Property date of type Date
+Has Property string of type String
+Has Property bytes of type Bytes
+Type Person
+Has Property haircolour of type String
+Has Property name of type String
+Type SubDepartment
+Has Property name of type String
+Has Property id of type Int
+Has Property manager of type Manager
+Has Property employees of type Employee
+Has Property subname of type String
+Manager is sequenced?1
+This is the sub string - its primitive, but not a string
+acmecorp
+acmecorp
+Expected default boolean (false) : false
+Expected boolean (true) : true
+Expected default string (0) : Now able to set
+ - should say now able to set
+
+ Name from deleted item: Now able to set
+0xffffffffffffffff = : -1
+0x7fffffffffffffff = 9223372036854775807
+0x7fffffff = 2147483647
+0x80000000 = 2147483648
+ Expected Wide - got : Wide
+ Expected Thin - got : Thin
+Expecting string, got Wide
+Expected bool true, got 1
+Expected char 23, got 23
+expected wchar 45, got 45Expected short 34, got 34
+Expected long 56 , got 56
+Expected long long 78, got 78
+Expected long double 89, got 89.000
+Expected float 90, got 90.000
+Expected time_t 200, got 200
+Wide[0]=87
+Wide[1]=105
+Wide[2]=100
+Wide[3]=101
+Thin[0]=84
+Thin[1]=104
+Thin[2]=105
+Thin[3]=110
+1.400567.700Should be Bill:Bill
+Should be Bill:Bill
+The employee of the month is Bill
+Now able to set
+pdg correctly identified
+Now able to set
+size of list 5
+Research And Development
+Research And Development
+Department: Research And Development
+Department: Marketing
+Department: Architecture
+Department: Pyrotechnics
+Department: Accounts
+Normal expected exception
+Normal Invalid path exception
+Normal SDOPropertyNotFound exception
diff --git a/sdo-cpp/trunk/runtime/core/test/many.xml b/sdo-cpp/trunk/runtime/core/test/many.xml
new file mode 100644
index 0000000000..fe78c6198b
--- /dev/null
+++ b/sdo-cpp/trunk/runtime/core/test/many.xml
@@ -0,0 +1,33 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ Licensed to the Apache Software Foundation (ASF) under one
+ or more contributor license agreements. See the NOTICE file
+ distributed with this work for additional information
+ regarding copyright ownership. The ASF licenses this file
+ to you 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.
+-->
+
+<company xmlns="companyNS" xsi:type="CompanyType" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" name="ACME">
+<sdo:changeSummary xmlns:sdo="commonj.sdo">
+<create>#/departments.0/employees.0</create>
+</sdo:changeSummary>
+<departments name="Advanced Technologies" location="NY" number="123">
+<employees name="Albert" SN="E0001" >
+<openlist>Three member</openlist>
+<openlist>Open bytes</openlist>
+<openlist>List is complete</openlist>
+</employees><employees name="Boris" SN="E0002" manager="true"/>
+<employees name="Carl" SN="E0003"/>
+</departments>
+</company>
diff --git a/sdo-cpp/trunk/runtime/core/test/many.xsd b/sdo-cpp/trunk/runtime/core/test/many.xsd
new file mode 100644
index 0000000000..7d49ca3258
--- /dev/null
+++ b/sdo-cpp/trunk/runtime/core/test/many.xsd
@@ -0,0 +1,21 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ Licensed to the Apache Software Foundation (ASF) under one
+ or more contributor license agreements. See the NOTICE file
+ distributed with this work for additional information
+ regarding copyright ownership. The ASF licenses this file
+ to you 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.
+-->
+
+<xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:sdo="commonj.sdo" xmlns:sdoxml="commonj.sdo/xml" xmlns:tns="companyNS" targetNamespace="companyNS"><xsd:element name="companyType" type="tns:CompanyType"/><xsd:complexType name="CompanyType" sdo:aliasName="TheFirm TheBigFirm"><xsd:sequence><xsd:element name="departments" type="tns:DepartmentType" minOccurs="0" maxOccurs="unbounded" sdo:aliasName="TheDepartments MYDepartments"/></xsd:sequence><xsd:element name="changeSummary" type="sdo:ChangeSummaryType"/><xsd:attribute name="name" type="xsd:String"/><xsd:attribute name="employeeOfTheMonth" sdoxml:propertyType="tns:EmployeeType" type="xsd:anyURI"/></xsd:complexType><xsd:element name="departmentType" type="tns:DepartmentType"/><xsd:complexType name="DepartmentType"><xsd:sequence><xsd:element name="employees" type="tns:EmployeeType" minOccurs="0" maxOccurs="unbounded"/></xsd:sequence><xsd:attribute name="name" type="xsd:String"/><xsd:attribute name="location" type="xsd:String"/><xsd:attribute name="number" type="xsd:String"/></xsd:complexType><xsd:element name="employeeType" type="tns:EmployeeType"/><xsd:complexType name="EmployeeType"><xsd:attribute name="name" type="xsd:String"/><xsd:attribute name="SN" type="xsd:String"/><xsd:attribute name="manager" type="xsd:boolean"/><xsd:any namespace="##other" processContents="lax" minOccurs="0" maxOccurs="unbounded"/><xsd:anyAttribute namespace="##any" processContents="lax"/></xsd:complexType><xsd:element name="openType" type="tns:OpenType"/><xsd:complexType name="OpenType"><xsd:attribute name="name" type="xsd:String"/></xsd:complexType></xsd:schema> \ No newline at end of file
diff --git a/sdo-cpp/trunk/runtime/core/test/matttest1.txt b/sdo-cpp/trunk/runtime/core/test/matttest1.txt
new file mode 100644
index 0000000000..5c5200ff22
--- /dev/null
+++ b/sdo-cpp/trunk/runtime/core/test/matttest1.txt
@@ -0,0 +1,2 @@
+Container of Billy should be dept1, and is :Shoe
+Container of Billy should be dept2, and is :IT
diff --git a/sdo-cpp/trunk/runtime/core/test/merle1.txt b/sdo-cpp/trunk/runtime/core/test/merle1.txt
new file mode 100644
index 0000000000..4e15696ac8
--- /dev/null
+++ b/sdo-cpp/trunk/runtime/core/test/merle1.txt
@@ -0,0 +1,10 @@
+<SubscriptionId>I am the subscription ID string</SubscriptionId>
+<AssociateTag>I am the associate Tag string</AssociateTag>
+<XMLEscaping>I am the XML escaping string</XMLEscaping>
+<Validate>I am the Validate string</Validate>
+DataObject "Shared" as XML:
+<tns:Shared xsi:type="tns:ItemSearchRequest" xmlns:tns="axis" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"><Keywords>SharedKeywordsString</Keywords><SearchIndex>SearchIndexString</SearchIndex></tns:Shared>
+
+DataObject "Request" as XML:
+<tns:Request xsi:type="tns:ItemSearchRequest" xmlns:tns="axis" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"><Keywords>RequestKeywords</Keywords><SearchIndex>RequestSearchIndex</SearchIndex></tns:Request>
+
diff --git a/sdo-cpp/trunk/runtime/core/test/my-core.xsd b/sdo-cpp/trunk/runtime/core/test/my-core.xsd
new file mode 100644
index 0000000000..acfc5c9f13
--- /dev/null
+++ b/sdo-cpp/trunk/runtime/core/test/my-core.xsd
@@ -0,0 +1,40 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ Licensed to the Apache Software Foundation (ASF) under one
+ or more contributor license agreements. See the NOTICE file
+ distributed with this work for additional information
+ regarding copyright ownership. The ASF licenses this file
+ to you 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.
+-->
+
+<schema xmlns="http://www.w3.org/2001/XMLSchema"
+ targetNamespace="http://www.commonj.org/xmlns/sca/v0.0.1/"
+ xmlns:sca="http://www.commonj.org/xmlns/sca/v0.0.1/"
+ xmlns:sdo="commonj.sdo/XML"
+ elementFormDefault="qualified">
+
+
+
+ <complexType name="Component">
+ <sequence>
+ <element minOccurs="1" maxOccurs="1" ref="sca:implementation"/>
+ </sequence>
+ </complexType>
+
+ <element name="implementation" type="sca:Implementation"/>
+ <complexType name="Implementation"/>
+
+
+
+</schema>
diff --git a/sdo-cpp/trunk/runtime/core/test/my-implementation-local-java.xsd b/sdo-cpp/trunk/runtime/core/test/my-implementation-local-java.xsd
new file mode 100644
index 0000000000..a7ef0f6ecd
--- /dev/null
+++ b/sdo-cpp/trunk/runtime/core/test/my-implementation-local-java.xsd
@@ -0,0 +1,43 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ Licensed to the Apache Software Foundation (ASF) under one
+ or more contributor license agreements. See the NOTICE file
+ distributed with this work for additional information
+ regarding copyright ownership. The ASF licenses this file
+ to you 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.
+-->
+
+<schema xmlns="http://www.w3.org/2001/XMLSchema"
+ targetNamespace="http://www.commonj.org/xmlns/sca/v0.0.1/"
+ xmlns:sca="http://www.commonj.org/xmlns/sca/v0.0.1/"
+ xmlns:sdo="commonj.sdo/XML"
+ elementFormDefault="qualified">
+
+ <include schemaLocation="my-core.xsd"/>
+
+ <element name="implementation.local.java" type="sca:LocalJavaImplementation" substitutionGroup="sca:implementation" sdo:name="implementationLocalJava"/>
+ <complexType name="LocalJavaImplementation">
+ <complexContent>
+ <extension base="sca:Implementation">
+ <sequence>
+ <any namespace="##other" processContents="lax" minOccurs="0" maxOccurs="unbounded"/>
+ </sequence>
+ <attribute name="class" type="NCName" use="required"/>
+ <attribute name="scope" type="sca:Scope" use="optional"/>
+ <anyAttribute namespace="##any" processContents="lax"/>
+ </extension>
+ </complexContent>
+ </complexType>
+
+</schema> \ No newline at end of file
diff --git a/sdo-cpp/trunk/runtime/core/test/my.xsd b/sdo-cpp/trunk/runtime/core/test/my.xsd
new file mode 100644
index 0000000000..e910a7db44
--- /dev/null
+++ b/sdo-cpp/trunk/runtime/core/test/my.xsd
@@ -0,0 +1,31 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ Licensed to the Apache Software Foundation (ASF) under one
+ or more contributor license agreements. See the NOTICE file
+ distributed with this work for additional information
+ regarding copyright ownership. The ASF licenses this file
+ to you 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.
+-->
+
+
+<schema xmlns="http://www.w3.org/2001/XMLSchema"
+ targetNamespace="http://www.commonj.org/xmlns/sca/v0.0.1/"
+ xmlns:sca="http://www.commonj.org/xmlns/sca/v0.0.1/">
+
+ <include schemaLocation="my-core.xsd"/>
+
+ <include schemaLocation="my-implementation-local-java.xsd"/>
+
+
+</schema> \ No newline at end of file
diff --git a/sdo-cpp/trunk/runtime/core/test/noschema.xml b/sdo-cpp/trunk/runtime/core/test/noschema.xml
new file mode 100644
index 0000000000..05a8697c51
--- /dev/null
+++ b/sdo-cpp/trunk/runtime/core/test/noschema.xml
@@ -0,0 +1,2 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<StockQuotes xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"><Stock fred="joe"><Symbol>IBM</Symbol><Last>79.78</Last><Date>5/24/2006</Date><Time>4:01pm</Time><Change>0.00</Change><Open>N/A</Open><High>N/A</High><Low>N/A</Low><Volume>900</Volume><MktCap>123.7B</MktCap><PreviousClose>79.78</PreviousClose><PercentageChange>0.00</PercentageChange><AnnRange>73.45 - 89.94</AnnRange><Earns>5.121</Earns><P-E>15.58</P-E><Name>INTL BUSINESS MAC</Name></Stock></StockQuotes>
diff --git a/sdo-cpp/trunk/runtime/core/test/notns.txt b/sdo-cpp/trunk/runtime/core/test/notns.txt
new file mode 100644
index 0000000000..a6f2bc0411
--- /dev/null
+++ b/sdo-cpp/trunk/runtime/core/test/notns.txt
@@ -0,0 +1,2 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<root xsi:type="Root" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"><list/><list/><list/></root>
diff --git a/sdo-cpp/trunk/runtime/core/test/nulltest.txt b/sdo-cpp/trunk/runtime/core/test/nulltest.txt
new file mode 100644
index 0000000000..01442ec949
--- /dev/null
+++ b/sdo-cpp/trunk/runtime/core/test/nulltest.txt
@@ -0,0 +1,91 @@
+Initially - all properties unset, and default values...
+boolean set:0 value false
+byte set:0 value 0
+character set:0 value 0
+short set:0 value 0
+long set:0 value 0
+longlong set:0 value
+float set:0 value
+longdouble set:0 value
+date set:0 value
+string set:0 value
+bytes set:0 value
+object set: 0 value: is empty
+Should now have all properties set, and zero values...
+boolean set:1 value:false
+byte set:1 value:0
+character set:1 value:0
+short set:1 value:0
+long set:1 value:0
+longlong set:1 value:0
+float set:1 value:0.000e+000
+longdouble set:1 value:0.000e+000
+date set:1 value:0
+string set:1 value:
+bytes set:1 value:
+object set:1 dataobject
+Should be back to having properties unset, and default values...
+boolean set:0 value:false
+byte set:0 value:0
+character set:0 value:0
+short set:0 value:0
+long set:0 value:0
+longlong set:0 value:
+float set:0 value:
+longdouble set:0 value:
+date set:0 value:
+string set:0 value:
+bytes set:0 value:
+object set: 0 dataobject is empty
+boolean set:1 value:false
+byte set:1 value:0
+character set:1 value:0
+short set:1 value:0
+long set:1 value:0
+longlong set:1 value:0
+float set:1 value:0.000e+000
+longdouble set:1 value:0.000e+000
+date set:0 value:
+string set:1 value:
+bytes set:1 value:
+object set:1 dataobject is empty
+Modified dataobject
+Should all be null, and default values...
+boolean isNull:1 set:1 value:
+byte isNull:1 set:1 value:
+character isNull:1 set:1 value:
+short isNull:1 set:1 value:
+long isNull:1 set:1 value:
+longlong isNull:1 set:1 value:
+float isNull:1 set:1 value:
+longdouble isNull:1 set:1 value:
+date isNull:1 set:1 value:
+string isNull:1 set:1 value:
+bytes isNull:1 set:1 value:
+object isNull:1 set:1 value empty
+Should all have values, and not be null..
+boolean isNull:0 set:1 value:true
+byte isNull:0 set:1 value:1
+character isNull:0 set:1 value:1
+short isNull:0 set:1 value:1
+long isNull:0 set:1 value:1
+longlong isNull:0 set:1 value:1
+float isNull:0 set:1 value:1.000e+000
+longdouble isNull:0 set:1 value:1.000e+000
+date isNull:1 set:1 value:
+string isNull:0 set:1 value:hello
+bytes isNull:0 set:1 value:hello
+object isNull0 set:1 value: dataobject
+Should all be null, and default values...
+boolean isNull:1 set:1 value:
+byte isNull:1 set:1 value:
+character isNull:1 set:1 value:
+short isNull:1 set:1 value:
+long isNull:1 set:1 value:
+longlong isNull:1 set:1 value:
+float isNull:1 set:1 value:
+longdouble isNull:1 set:1 value:
+date isNull:1 set:1 value:
+string isNull:1 set:1 value:
+bytes isNull:1 set:1 value:
+object isNull;1 set:1 value: empty
diff --git a/sdo-cpp/trunk/runtime/core/test/oddchars.txt b/sdo-cpp/trunk/runtime/core/test/oddchars.txt
new file mode 100644
index 0000000000..b9ed9643b3
--- /dev/null
+++ b/sdo-cpp/trunk/runtime/core/test/oddchars.txt
@@ -0,0 +1,22 @@
+===== DataObject contents =====
+Flight: list dataObject[0]=
+===== DataObject contents =====
+Departure:string:ÇüéâäàåçêëèïîìÄÅÉæÆôöòûùÿÖÜø£Ø׃áíóúñѪº¿®¬½¼¡«»░▒▓│┤ÁÂÀ©╣║╗╝¢¥┐└┴┬├─┼ãÃ╚╔╔╩╦╠═╬¤ðÐÊËÈıÍÎÎÏ┘┌█▄¦Ì▀ÓßÔÒõÕµþÞÚÛÙýݯ´­±‗¾¶§÷¸°¨·¹³²■ 
+
+Arrival:string:Pound:£ Dollar:$ Euro:Ç or █
+
+flightNo:string:BA243
+
+===== End DataObject =====
+
+Hotel: list (empty)
+Excursion:dataObject
+ - null or unset
+
+Client:dataObject
+ - null or unset
+
+Party:dataObject
+ - null or unset
+
+===== End DataObject =====
diff --git a/sdo-cpp/trunk/runtime/core/test/openloadNS.xml b/sdo-cpp/trunk/runtime/core/test/openloadNS.xml
new file mode 100644
index 0000000000..1b5d7e1b6a
--- /dev/null
+++ b/sdo-cpp/trunk/runtime/core/test/openloadNS.xml
@@ -0,0 +1,32 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ Licensed to the Apache Software Foundation (ASF) under one
+ or more contributor license agreements. See the NOTICE file
+ distributed with this work for additional information
+ regarding copyright ownership. The ASF licenses this file
+ to you 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.
+-->
+
+<company xmlns="companyNS" xsi:type="CompanyType" xmlns:tp="teapot" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" name="ACME">
+<sdo:changeSummary xmlns:sdo="commonj.sdo">
+<create>#/departments.0/employees.0</create>
+</sdo:changeSummary>
+<departments name="Advanced Technologies" location="NY" number="123">
+<employees name="Albert" SN="E0001" tp:openstring="Value Of Open String" tp:openboolean="true">
+<tp:openintlist>45</tp:openintlist>
+</employees>
+<employees name="Boris" SN="E0002" manager="true"/>
+<employees name="Carl" SN="E0003"/>
+</departments>
+</company>
diff --git a/sdo-cpp/trunk/runtime/core/test/openloadNS.xsd b/sdo-cpp/trunk/runtime/core/test/openloadNS.xsd
new file mode 100644
index 0000000000..336f40def7
--- /dev/null
+++ b/sdo-cpp/trunk/runtime/core/test/openloadNS.xsd
@@ -0,0 +1,53 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ Licensed to the Apache Software Foundation (ASF) under one
+ or more contributor license agreements. See the NOTICE file
+ distributed with this work for additional information
+ regarding copyright ownership. The ASF licenses this file
+ to you 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.
+-->
+
+<xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema"
+xmlns:sdo="commonj.sdo" xmlns:sdoxml="commonj.sdo/xml"
+xmlns:tns="companyNS" targetNamespace="companyNS">
+<xsd:element name="companyType" type="tns:CompanyType"/>
+<xsd:complexType name="CompanyType" sdo:aliasName="TheFirm TheBigFirm">
+<xsd:sequence>
+<xsd:element name="departments" type="tns:DepartmentType" minOccurs="0" maxOccurs="unbounded" sdo:aliasName="TheDepartments MYDepartments"/>
+</xsd:sequence>
+<xsd:element name="changeSummary" type="sdo:ChangeSummaryType"/>
+<xsd:attribute name="name" type="xsd:String"/>
+<xsd:attribute name="employeeOfTheMonth" sdoxml:propertyType="tns:EmployeeType" type="xsd:anyURI"/>
+</xsd:complexType><xsd:element name="departmentType" type="tns:DepartmentType"/>
+<xsd:complexType name="DepartmentType">
+<xsd:sequence>
+<xsd:element name="employees" type="tns:EmployeeType" minOccurs="0" maxOccurs="unbounded"/>
+</xsd:sequence>
+<xsd:attribute name="name" type="xsd:String"/>
+<xsd:attribute name="location" type="xsd:String"/>
+<xsd:attribute name="number" type="xsd:String"/>
+</xsd:complexType>
+<xsd:element name="employeeType" type="tns:EmployeeType"/>
+<xsd:complexType name="EmployeeType">
+<xsd:attribute name="name" type="xsd:String"/>
+<xsd:attribute name="SN" type="xsd:String"/>
+<xsd:attribute name="manager" type="xsd:boolean"/>
+<xsd:any namespace="##other" processContents="lax" minOccurs="0" maxOccurs="unbounded"/>
+<xsd:anyAttribute namespace="##any" processContents="lax"/>
+</xsd:complexType>
+<xsd:element name="openType" type="tns:OpenType"/>
+<xsd:complexType name="OpenType">
+<xsd:attribute name="name" type="xsd:String"/>
+</xsd:complexType>
+</xsd:schema>
diff --git a/sdo-cpp/trunk/runtime/core/test/openloadNS2.xml b/sdo-cpp/trunk/runtime/core/test/openloadNS2.xml
new file mode 100644
index 0000000000..ff2b31c610
--- /dev/null
+++ b/sdo-cpp/trunk/runtime/core/test/openloadNS2.xml
@@ -0,0 +1,32 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ Licensed to the Apache Software Foundation (ASF) under one
+ or more contributor license agreements. See the NOTICE file
+ distributed with this work for additional information
+ regarding copyright ownership. The ASF licenses this file
+ to you 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.
+-->
+
+<company xmlns="companyNS" xsi:type="CompanyType" xmlns:tp="twilbur" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" name="ACME">
+<sdo:changeSummary xmlns:sdo="commonj.sdo">
+<create>#/departments.0/employees.0</create>
+</sdo:changeSummary>
+<departments name="Advanced Technologies" location="NY" number="123">
+<employees name="Albert" SN="E0001" tp:openstring="Value Of Open String" tp:openboolean="true">
+<tp:openintlist>45</tp:openintlist>
+</employees>
+<employees name="Boris" SN="E0002" manager="true"/>
+<employees name="Carl" SN="E0003"/>
+</departments>
+</company>
diff --git a/sdo-cpp/trunk/runtime/core/test/openloadNS2.xsd b/sdo-cpp/trunk/runtime/core/test/openloadNS2.xsd
new file mode 100644
index 0000000000..e1498578cf
--- /dev/null
+++ b/sdo-cpp/trunk/runtime/core/test/openloadNS2.xsd
@@ -0,0 +1,28 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ Licensed to the Apache Software Foundation (ASF) under one
+ or more contributor license agreements. See the NOTICE file
+ distributed with this work for additional information
+ regarding copyright ownership. The ASF licenses this file
+ to you 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.
+-->
+
+<xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema"
+xmlns:sdo="commonj.sdo" xmlns:sdoxml="commonj.sdo/xml"
+xmlns:tns="teapot" targetNamespace="teapot">
+<xsd:attribute name="openboolean" type="xsd:boolean"/>
+<xsd:element name="openintlist" type="xsd:short" minOccurs="0" maxOccurs="unbounded"/>
+<xsd:attribute name="openstring" type="xsd:hexBinary"/>
+</xsd:schema>
+
diff --git a/sdo-cpp/trunk/runtime/core/test/openloadNSout.txt b/sdo-cpp/trunk/runtime/core/test/openloadNSout.txt
new file mode 100644
index 0000000000..21e6df8d9e
--- /dev/null
+++ b/sdo-cpp/trunk/runtime/core/test/openloadNSout.txt
@@ -0,0 +1,2 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<company xsi:type="tns2:CompanyType" xmlns:tns2="companyNS" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" name="ACME"><sdo:changeSummary xmlns:sdo="commonj.sdo" logging="true"><create>#/departments.0/employees.0</create></sdo:changeSummary><departments name="Advanced Technologies" location="NY" number="123"><employees name="Albert" SN="E0001" openstring="Value Of Open String" openboolean="true"><openintlist>45</openintlist></employees><employees name="Boris" SN="E0002" manager="true"/><employees name="Carl" SN="E0003"/></departments></company>
diff --git a/sdo-cpp/trunk/runtime/core/test/openseq.txt b/sdo-cpp/trunk/runtime/core/test/openseq.txt
new file mode 100644
index 0000000000..44091f2608
--- /dev/null
+++ b/sdo-cpp/trunk/runtime/core/test/openseq.txt
@@ -0,0 +1,3 @@
+Open Type string value: Value Of Open String
+Open Sequenced string value: Value of sequenced string
+Open Sequenced string value from seq: Value of sequenced string
diff --git a/sdo-cpp/trunk/runtime/core/test/order1.txt b/sdo-cpp/trunk/runtime/core/test/order1.txt
new file mode 100644
index 0000000000..4f46cbfecf
--- /dev/null
+++ b/sdo-cpp/trunk/runtime/core/test/order1.txt
@@ -0,0 +1,19 @@
+Type:#Address
+Property:name
+Property:street
+Property:city
+Type:#RootType
+Property:employee
+Type:#UKAddress
+Property:value
+Property:postcode
+Type:#USAddress
+Property:value
+Property:zip
+Type:#fullpersoninfo
+Property:address
+Property:city
+Property:country
+Type:#personinfo
+Property:firstname
+Property:lastname
diff --git a/sdo-cpp/trunk/runtime/core/test/order2.txt b/sdo-cpp/trunk/runtime/core/test/order2.txt
new file mode 100644
index 0000000000..4f46cbfecf
--- /dev/null
+++ b/sdo-cpp/trunk/runtime/core/test/order2.txt
@@ -0,0 +1,19 @@
+Type:#Address
+Property:name
+Property:street
+Property:city
+Type:#RootType
+Property:employee
+Type:#UKAddress
+Property:value
+Property:postcode
+Type:#USAddress
+Property:value
+Property:zip
+Type:#fullpersoninfo
+Property:address
+Property:city
+Property:country
+Type:#personinfo
+Property:firstname
+Property:lastname
diff --git a/sdo-cpp/trunk/runtime/core/test/overlappingtypes.xsd b/sdo-cpp/trunk/runtime/core/test/overlappingtypes.xsd
new file mode 100644
index 0000000000..a388cff528
--- /dev/null
+++ b/sdo-cpp/trunk/runtime/core/test/overlappingtypes.xsd
@@ -0,0 +1,57 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ Licensed to the Apache Software Foundation (ASF) under one
+ or more contributor license agreements. See the NOTICE file
+ distributed with this work for additional information
+ regarding copyright ownership. The ASF licenses this file
+ to you 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.
+-->
+<schema xmlns="http://www.w3.org/2001/XMLSchema"
+ targetNamespace="http://www.example.org/AnnonTypes"
+ xmlns:tns="http://www.example.org/AnnonTypes"
+elementFormDefault="qualified">
+
+ <element name="Top">
+ <complexType>
+ <sequence>
+ <element name="ElementA">
+ <complexType>
+ <sequence>
+ <element name="Overlapping">
+ <complexType>
+ <sequence>
+ <element name="ValueA" type="string"/>
+ </sequence>
+ </complexType>
+ </element>
+ </sequence>
+ </complexType>
+ </element>
+ <element name="ElementB">
+ <complexType>
+ <sequence>
+ <element name="Overlapping">
+ <complexType>
+ <sequence>
+ <element name="ValueB" type="string"/>
+ </sequence>
+ </complexType>
+ </element>
+ </sequence>
+ </complexType>
+ </element>
+ </sequence>
+ </complexType>
+ </element>
+</schema>
diff --git a/sdo-cpp/trunk/runtime/core/test/partial.xml b/sdo-cpp/trunk/runtime/core/test/partial.xml
new file mode 100644
index 0000000000..11acb1b806
--- /dev/null
+++ b/sdo-cpp/trunk/runtime/core/test/partial.xml
@@ -0,0 +1,33 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ Licensed to the Apache Software Foundation (ASF) under one
+ or more contributor license agreements. See the NOTICE file
+ distributed with this work for additional information
+ regarding copyright ownership. The ASF licenses this file
+ to you 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.
+-->
+
+<company xmlns="companyNS" xsi:type="CompanyType" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" name="ACME">
+<sdo:changeSummary xmlns:sdo="commonj.sdo">
+<create>#/departments.0/employees.0</create>
+</sdo:changeSummary>
+<departments name="Advanced Technologies" location="NY" number="123">
+<employees name="Albert" SN="E0001" openstring="Value Of Open String" openboolean="true">
+<openintlist>45</openintlist>
+<opendataobjectlist xmlns="companyNS" xsi:type="OpenType" name="MyOpenName"/>
+<opendataobject xsi:type="OpenType" name="MyOpenName"/>
+</employees><employees name="Boris" SN="E0002" manager="true"/>
+<employees name="Carl" SN="E0003"/>
+</departments>
+</company>
diff --git a/sdo-cpp/trunk/runtime/core/test/person.xsd b/sdo-cpp/trunk/runtime/core/test/person.xsd
new file mode 100644
index 0000000000..d2d1842ecc
--- /dev/null
+++ b/sdo-cpp/trunk/runtime/core/test/person.xsd
@@ -0,0 +1,34 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ Licensed to the Apache Software Foundation (ASF) under one
+ or more contributor license agreements. See the NOTICE file
+ distributed with this work for additional information
+ regarding copyright ownership. The ASF licenses this file
+ to you 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.
+-->
+<schema xmlns="http://www.w3.org/2001/XMLSchema"
+ targetNamespace="http://www.test.com/info"
+ xmlns:info="http://www.test.com/info">
+ <complexType name="nameType">
+ <sequence>
+ <element name="first" type="string"></element>
+ <element name="last" type="string"></element>
+ </sequence>
+ </complexType>
+ <complexType name="personType">
+ <sequence>
+ <element name="name" type="info:nameType"></element>
+ </sequence>
+ </complexType>
+</schema>
diff --git a/sdo-cpp/trunk/runtime/core/test/pete.xml b/sdo-cpp/trunk/runtime/core/test/pete.xml
new file mode 100644
index 0000000000..21c4d71914
--- /dev/null
+++ b/sdo-cpp/trunk/runtime/core/test/pete.xml
@@ -0,0 +1,40 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ Licensed to the Apache Software Foundation (ASF) under one
+ or more contributor license agreements. See the NOTICE file
+ distributed with this work for additional information
+ regarding copyright ownership. The ASF licenses this file
+ to you 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.
+-->
+
+<StockQuotes>
+<Stock fred="joe">
+<Symbol>IBM</Symbol>
+<Last>79.78</Last>
+<Date>5/24/2006</Date>
+<Time>4:01pm</Time>
+<Change>0.00</Change>
+<Open>N/A</Open>
+<High>N/A</High>
+<Low>N/A</Low>
+<Volume>900</Volume>
+<MktCap>123.7B</MktCap>
+<PreviousClose>79.78</PreviousClose>
+<PercentageChange>0.00</PercentageChange>
+<AnnRange>73.45 - 89.94</AnnRange>
+<Earns>5.121</Earns>
+<P-E>15.58</P-E>
+<Name>INTL BUSINESS MAC</Name>
+</Stock>
+</StockQuotes>
diff --git a/sdo-cpp/trunk/runtime/core/test/pete.xsd b/sdo-cpp/trunk/runtime/core/test/pete.xsd
new file mode 100644
index 0000000000..f61d50a942
--- /dev/null
+++ b/sdo-cpp/trunk/runtime/core/test/pete.xsd
@@ -0,0 +1,42 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ Licensed to the Apache Software Foundation (ASF) under one
+ or more contributor license agreements. See the NOTICE file
+ distributed with this work for additional information
+ regarding copyright ownership. The ASF licenses this file
+ to you 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.
+-->
+
+<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema">
+
+ <xs:element name="StockQuotes">
+ <xs:complexType >
+ <xs:sequence>
+ <xs:element name="Stock" minOccurs="0" maxOccurs="unbounded">
+ <xs:complexType>
+ <xs:sequence>
+ <xs:element minOccurs="0" maxOccurs="1" name="Symbol" type="xs:string"/>
+ <xs:element minOccurs="0" maxOccurs="1" name="Last" type="xs:float"/>
+ <xs:any namespace="##other" processContents="lax" minOccurs="0" maxOccurs="unbounded"/>
+ </xs:sequence>
+ <anyAttribute namespace="##any" processContents="lax"/>
+ </xs:complexType>
+</xs:element>
+ <xs:any namespace="##other" processContents="lax" minOccurs="0" maxOccurs="unbounded"/>
+ </xs:sequence>
+ <xs:anyAttribute namespace="##any" processContents="lax"/>
+ </xs:complexType>
+ </xs:element>
+
+</xs:schema>
diff --git a/sdo-cpp/trunk/runtime/core/test/qualified.xml b/sdo-cpp/trunk/runtime/core/test/qualified.xml
new file mode 100644
index 0000000000..4b26cb274c
--- /dev/null
+++ b/sdo-cpp/trunk/runtime/core/test/qualified.xml
@@ -0,0 +1,2 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<tns:GetQuotes xmlns:tns="http://swanandmokashi.com" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"><tns:QuoteTicker>IBM</tns:QuoteTicker></tns:GetQuotes>
diff --git a/sdo-cpp/trunk/runtime/core/test/querytest.txt b/sdo-cpp/trunk/runtime/core/test/querytest.txt
new file mode 100644
index 0000000000..9b895282a0
--- /dev/null
+++ b/sdo-cpp/trunk/runtime/core/test/querytest.txt
@@ -0,0 +1,17 @@
+Expected employee3: got Employee3
+Expected employee1: got Employee1
+Expected employee2: got Employee2
+Expected employee1: got Employee1
+Expected employee1: got Employee1
+Expected employee1: got Employee1
+Expected employee1: got Employee1
+Expected employee3: got Employee3
+Expected employee2: got Employee2
+Expected employee2: got Employee2
+Expected employee2: got Employee2
+Expected employee2: got Employee2
+Normal exception caught
+Normal exception caught
+Normal exception caught
+Normal exception caught
+Normal exception caught
diff --git a/sdo-cpp/trunk/runtime/core/test/saveopen-output.txt b/sdo-cpp/trunk/runtime/core/test/saveopen-output.txt
new file mode 100644
index 0000000000..cae11d2320
--- /dev/null
+++ b/sdo-cpp/trunk/runtime/core/test/saveopen-output.txt
@@ -0,0 +1,2 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<tns:company xsi:type="tns:CompanyType" xmlns:tns="companyNS" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" name="ACME"><sdo:changeSummary xmlns:sdo="commonj.sdo"><create>#/departments.0/employees.0</create><create>#/departments.0/employees.1</create><create>#/departments.0/employees.2</create><create>#/departments.0/employees.0/opendataobjectlist.0</create><departments sdo:ref="#/departments.0" name="" location="" number=""/></sdo:changeSummary><departments name="Advanced Technologies" location="NY" number="123"><employees name="Albert" SN="E0001" openstring="Value Of Open String" openboolean="true"><openintlist>45</openintlist><opendataobjectlist xsi:type="tns:OpenType" name="MyOpenName"/><opendataobject xsi:type="tns:OpenType" name="MyOpenName"/></employees><employees name="Boris" SN="E0002" manager="true"/><employees name="Carl" SN="E0003"/></departments></tns:company>
diff --git a/sdo-cpp/trunk/runtime/core/test/sca-binding-sca.xsd b/sdo-cpp/trunk/runtime/core/test/sca-binding-sca.xsd
new file mode 100644
index 0000000000..d0adc9bda0
--- /dev/null
+++ b/sdo-cpp/trunk/runtime/core/test/sca-binding-sca.xsd
@@ -0,0 +1,41 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ Licensed to the Apache Software Foundation (ASF) under one
+ or more contributor license agreements. See the NOTICE file
+ distributed with this work for additional information
+ regarding copyright ownership. The ASF licenses this file
+ to you 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.
+-->
+
+<schema xmlns="http://www.w3.org/2001/XMLSchema"
+ targetNamespace="http://www.commonj.org/xmlns/sca/v0.0.1/"
+ xmlns:sca="http://www.commonj.org/xmlns/sca/v0.0.1/"
+ xmlns:sdo="commonj.sdo/XML"
+ elementFormDefault="qualified">
+
+ <include schemaLocation="sca-core.xsd"/>
+
+ <element name="binding.sca" type="sca:SCARemoteBinding" substitutionGroup="sca:binding" sdo:name="bindingSca"/>
+ <complexType name="SCARemoteBinding">
+ <complexContent>
+ <extension base="sca:Binding">
+ <sequence>
+ <any namespace="##other" processContents="lax" minOccurs="0" maxOccurs="unbounded"/>
+ </sequence>
+ <attribute name="target" type="anyURI" use="optional"/>
+ <anyAttribute namespace="##any" processContents="lax"/>
+ </extension>
+ </complexContent>
+ </complexType>
+</schema> \ No newline at end of file
diff --git a/sdo-cpp/trunk/runtime/core/test/sca-binding-webservice.xsd b/sdo-cpp/trunk/runtime/core/test/sca-binding-webservice.xsd
new file mode 100644
index 0000000000..60c642fbfe
--- /dev/null
+++ b/sdo-cpp/trunk/runtime/core/test/sca-binding-webservice.xsd
@@ -0,0 +1,40 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ Licensed to the Apache Software Foundation (ASF) under one
+ or more contributor license agreements. See the NOTICE file
+ distributed with this work for additional information
+ regarding copyright ownership. The ASF licenses this file
+ to you 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.
+-->
+
+<schema xmlns="http://www.w3.org/2001/XMLSchema"
+ targetNamespace="http://www.commonj.org/xmlns/sca/v0.0.1/"
+ xmlns:sca="http://www.commonj.org/xmlns/sca/v0.0.1/"
+ elementFormDefault="qualified">
+
+ <include schemaLocation="sca-core.xsd"/>
+
+ <element name="binding.ws" type="sca:WebServiceBinding" substitutionGroup="sca:binding"/>
+ <complexType name="WebServiceBinding">
+ <complexContent>
+ <extension base="sca:Binding">
+ <sequence>
+ <any namespace="##other" processContents="lax" minOccurs="0" maxOccurs="unbounded"/>
+ </sequence>
+ <attribute name="port" type="anyURI" use="required"/>
+ <anyAttribute namespace="##any" processContents="lax"/>
+ </extension>
+ </complexContent>
+ </complexType>
+</schema> \ No newline at end of file
diff --git a/sdo-cpp/trunk/runtime/core/test/sca-binding-ws.xsd b/sdo-cpp/trunk/runtime/core/test/sca-binding-ws.xsd
new file mode 100644
index 0000000000..5ee7500578
--- /dev/null
+++ b/sdo-cpp/trunk/runtime/core/test/sca-binding-ws.xsd
@@ -0,0 +1,41 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ Licensed to the Apache Software Foundation (ASF) under one
+ or more contributor license agreements. See the NOTICE file
+ distributed with this work for additional information
+ regarding copyright ownership. The ASF licenses this file
+ to you 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.
+-->
+
+<schema xmlns="http://www.w3.org/2001/XMLSchema"
+ targetNamespace="http://www.commonj.org/xmlns/sca/v0.0.1/"
+ xmlns:sca="http://www.commonj.org/xmlns/sca/v0.0.1/"
+ xmlns:sdo="commonj.sdo/XML"
+ elementFormDefault="qualified">
+
+ <include schemaLocation="sca-core.xsd"/>
+
+ <element name="binding.ws" type="sca:WebServiceBinding" substitutionGroup="sca:binding" sdo:name="bindingWs"/>
+ <complexType name="WebServiceBinding">
+ <complexContent>
+ <extension base="sca:Binding">
+ <sequence>
+ <any namespace="##other" processContents="lax" minOccurs="0" maxOccurs="unbounded"/>
+ </sequence>
+ <attribute name="port" type="anyURI" use="required"/>
+ <anyAttribute namespace="##any" processContents="lax"/>
+ </extension>
+ </complexContent>
+ </complexType>
+</schema>
diff --git a/sdo-cpp/trunk/runtime/core/test/sca-core.xsd b/sdo-cpp/trunk/runtime/core/test/sca-core.xsd
new file mode 100644
index 0000000000..cfe9d8d884
--- /dev/null
+++ b/sdo-cpp/trunk/runtime/core/test/sca-core.xsd
@@ -0,0 +1,233 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ Licensed to the Apache Software Foundation (ASF) under one
+ or more contributor license agreements. See the NOTICE file
+ distributed with this work for additional information
+ regarding copyright ownership. The ASF licenses this file
+ to you 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.
+-->
+
+<schema xmlns="http://www.w3.org/2001/XMLSchema"
+ targetNamespace="http://www.commonj.org/xmlns/sca/v0.0.1/"
+ xmlns:sca="http://www.commonj.org/xmlns/sca/v0.0.1/"
+ xmlns:sdo="commonj.sdo/XML"
+ elementFormDefault="qualified">
+
+ <include schemaLocation="sca-policy.xsd" />
+
+ <element name="componentType" type="sca:ComponentType"/>
+ <complexType name="ComponentType">
+ <sequence>
+ <element minOccurs="0" maxOccurs="unbounded" name="service" type="sca:Service"/>
+ <element minOccurs="0" maxOccurs="unbounded" name="reference" type="sca:Reference"/>
+ <element minOccurs="0" maxOccurs="unbounded" ref="sca:property"/>
+ <any namespace="##other" processContents="lax" minOccurs="0" maxOccurs="unbounded"/>
+ </sequence>
+ <anyAttribute namespace="##any" processContents="lax"/>
+ </complexType>
+
+ <complexType name="Service">
+ <sequence>
+ <element minOccurs="1" maxOccurs="1" ref="sca:interface"/>
+ <any namespace="##other" processContents="lax" minOccurs="0" maxOccurs="unbounded"/>
+ </sequence>
+ <attribute name="name" type="NCName" use="required"/>
+ <anyAttribute namespace="##any" processContents="lax"/>
+ </complexType>
+
+ <element name="interface" type="sca:Interface"/>
+ <complexType name="Interface"/>
+
+ <complexType name="Reference">
+ <sequence>
+ <element minOccurs="1" maxOccurs="1" ref="sca:interface"/>
+ <any namespace="##other" processContents="lax" minOccurs="0" maxOccurs="unbounded"/>
+ </sequence>
+ <attribute name="name" type="NCName" use="required"/>
+ <attribute name="multiplicity" type="sca:Multiplicity" use="optional" default="1..1"/>
+ <anyAttribute namespace="##any" processContents="lax"/>
+ </complexType>
+
+ <element name="property" type="sca:Property"/>
+ <complexType name="Property" abstract="true">
+ <attribute name="name" type="NCName" use="required"/>
+ <attribute name="many" type="boolean" default="false" use="optional"/>
+ <attribute name="default" type="string" use="optional"/>
+ </complexType>
+
+
+ <element name="moduleFragment" type="sca:ModuleFragment"/>
+ <complexType name="ModuleFragment">
+ <sequence>
+ <element minOccurs="0" maxOccurs="unbounded" name="entryPoint" type="sca:EntryPoint"/>
+ <element minOccurs="0" maxOccurs="unbounded" name="component" type="sca:Component"/>
+ <element minOccurs="0" maxOccurs="unbounded" name="externalService" type="sca:ExternalService"/>
+ <element minOccurs="0" maxOccurs="unbounded" name="wire" type="sca:ModuleWire"/>
+ <any namespace="##other" processContents="lax" minOccurs="0" maxOccurs="unbounded"/>
+ </sequence>
+ <attribute name="name" type="NCName" use="required"/>
+ <anyAttribute namespace="##any" processContents="lax"/>
+ </complexType>
+
+ <element name="module" type="sca:ModuleFragment"/>
+
+
+ <complexType name="EntryPoint">
+ <sequence>
+ <element minOccurs="1" maxOccurs="1" ref="sca:interface"/>
+ <element minOccurs="1" maxOccurs="1" ref="sca:binding"/>
+ <element minOccurs="1" maxOccurs="1" name="reference" type="anyType"/>
+ <any namespace="##other" processContents="lax" minOccurs="0" maxOccurs="unbounded"/>
+ </sequence>
+ <attribute name="name" type="NCName" use="required"/>
+ <attribute name="overridable" type="boolean" default="true" use="optional"/>
+ <attribute name="multiplicity" type="sca:Multiplicity" use="optional" default="1..1"/>
+ <anyAttribute namespace="##any" processContents="lax"/>
+ </complexType>
+ <!-- a multiplicity 1..1 sample
+ <reference>StockQuoteComponent</reference> - type must be URI
+ a multiplicity 0..n sample
+ <reference>
+ <value>StockQuoteComponent1</value> - type must be URI
+ <value>StockQuoteComponent2</value>
+ </reference>
+ -->
+
+ <element name="binding" type="sca:Binding"/>
+ <complexType name="Binding"/>
+
+
+ <complexType name="Component">
+ <sequence>
+ <element minOccurs="1" maxOccurs="1" ref="sca:implementation"/>
+ <element minOccurs="0" maxOccurs="1" name="properties" type="sca:PropertyValues"/>
+ <element minOccurs="0" maxOccurs="1" name="references" type="sca:ReferenceValues"/>
+ <any namespace="##other" processContents="lax" minOccurs="0" maxOccurs="unbounded"/>
+ </sequence>
+ <attribute name="name" type="NCName" use="required"/>
+ <anyAttribute namespace="##any" processContents="lax"/>
+ </complexType>
+ <!-- a multiplicity 1..1 sample
+ <references>
+ <v:stockQuote>StockQuoteComponent</v:stockquote> - type must be URI
+ </references>
+ a multiplicity 0..n sample
+ <references>
+ <v:stockQuote>
+ <value>StockQuoteComponent1</value> - type must be URI
+ <value>StockQuoteComponent2</value>
+ </v:stockquote>
+ </references>
+ -->
+
+ <element name="implementation" type="sca:Implementation"/>
+ <complexType name="Implementation"/>
+
+ <complexType name="PropertyValues">
+ <sequence>
+ <any namespace="##other" processContents="lax" minOccurs="0" maxOccurs="unbounded"/>
+ </sequence>
+ </complexType>
+
+ <complexType name="ReferenceValues">
+ <sequence>
+ <any namespace="##other" processContents="lax" minOccurs="0" maxOccurs="unbounded"/>
+ </sequence>
+ </complexType>
+
+
+ <complexType name="ExternalService">
+ <sequence>
+ <element minOccurs="1" maxOccurs="1" ref="sca:interface"/>
+ <element minOccurs="1" maxOccurs="1" ref="sca:binding"/>
+ <any namespace="##other" processContents="lax" minOccurs="0" maxOccurs="unbounded"/>
+ </sequence>
+ <attribute name="name" type="NCName" use="required"/>
+ <attribute name="overridable" type="boolean" default="true" use="optional"/>
+ <anyAttribute namespace="##any" processContents="lax"/>
+ </complexType>
+
+
+
+ <complexType name="ModuleWire">
+ <sequence>
+ <element minOccurs="1" maxOccurs="1" ref="sca:source.uri" sdo:name="sourceUri"/>
+ <element minOccurs="1" maxOccurs="1" ref="sca:target.uri" sdo:name="targetUri"/>
+ <any namespace="##other" processContents="lax" minOccurs="0" maxOccurs="unbounded"/>
+ </sequence>
+ <anyAttribute namespace="##any" processContents="lax"/>
+ </complexType>
+
+ <element name="source.uri" type="anyURI" substitutionGroup="sca:source" sdo:name="sourceUri"/>
+ <element name="target.uri" type="anyURI" substitutionGroup="sca:target" sdo:name="targetUri"/>
+
+
+ <element name="subsystem" type="sca:Subsystem"/>
+ <complexType name="Subsystem">
+ <sequence>
+ <element minOccurs="0" maxOccurs="unbounded" name="entryPoint" type="sca:EntryPoint"/>
+ <element minOccurs="0" maxOccurs="unbounded" name="moduleComponent" type="sca:ModuleComponent"/>
+ <element minOccurs="0" maxOccurs="unbounded" name="externalService" type="sca:ExternalService"/>
+ <element minOccurs="0" maxOccurs="unbounded" name="wire" type="sca:SystemWire"/>
+ <any namespace="##other" processContents="lax" minOccurs="0" maxOccurs="unbounded"/>
+ </sequence>
+ <attribute name="name" type="NCName" use="required"/>
+ <anyAttribute namespace="##any" processContents="lax"/>
+ </complexType>
+
+
+ <complexType name="ModuleComponent">
+ <sequence>
+ <element minOccurs="0" maxOccurs="1" name="references" type="sca:ReferenceValues"/>
+ <any namespace="##other" processContents="lax" minOccurs="0" maxOccurs="unbounded"/>
+ </sequence>
+ <attribute name="name" type="NCName" use="required"/>
+ <attribute name="module" type="NCName" use="required"/>
+ <anyAttribute namespace="##any" processContents="lax"/>
+ </complexType>
+
+ <complexType name="SystemWire">
+ <sequence>
+ <element minOccurs="1" maxOccurs="1" ref="sca:source.uri" sdo:name="sourceUri"/>
+ <element minOccurs="1" maxOccurs="1" ref="sca:target.uri" sdo:name="targetUri" />
+ <any namespace="##other" processContents="lax" minOccurs="0" maxOccurs="unbounded"/>
+ </sequence>
+ </complexType>
+
+ <element name="source" type="anyType"/>
+ <element name="source.epr" type="anyType" substitutionGroup="sca:source" sdo:name="sourceEpr"/>
+
+ <element name="target" type="anyType"/>
+ <element name="target.epr" type="anyType" substitutionGroup="sca:target" sdo:name="targetEpr"/>
+
+
+ <simpleType name="Multiplicity">
+ <restriction base="string">
+ <enumeration value="0..1"/>
+ <enumeration value="1..1"/>
+ <enumeration value="0..n"/>
+ <enumeration value="1..n"/>
+ </restriction>
+ </simpleType>
+
+ <simpleType name="Scope">
+ <restriction base="string">
+ <enumeration value="instance"/>
+ <enumeration value="request"/>
+ <enumeration value="session"/>
+ <enumeration value="module"/>
+ </restriction>
+ </simpleType>
+
+</schema>
diff --git a/sdo-cpp/trunk/runtime/core/test/sca-implementation-dll.xsd b/sdo-cpp/trunk/runtime/core/test/sca-implementation-dll.xsd
new file mode 100644
index 0000000000..6e1ec1d6eb
--- /dev/null
+++ b/sdo-cpp/trunk/runtime/core/test/sca-implementation-dll.xsd
@@ -0,0 +1,41 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ Licensed to the Apache Software Foundation (ASF) under one
+ or more contributor license agreements. See the NOTICE file
+ distributed with this work for additional information
+ regarding copyright ownership. The ASF licenses this file
+ to you 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.
+-->
+
+<schema xmlns="http://www.w3.org/2001/XMLSchema"
+ targetNamespace="http://www.commonj.org/xmlns/sca/v0.0.1/"
+ xmlns:sca="http://www.commonj.org/xmlns/sca/v0.0.1/"
+ xmlns:sdo="commonj.sdo/XML"
+ elementFormDefault="qualified">
+
+ <include schemaLocation="sca-core.xsd"/>
+
+ <element name="implementation.dll" type="sca:DLLImplementation" substitutionGroup="sca:implementation" sdo:name="implementationDll"/>
+ <complexType name="DLLImplementation">
+ <complexContent>
+ <extension base="sca:Implementation">
+ <sequence>
+ <any namespace="##other" processContents="lax" minOccurs="0" maxOccurs="unbounded"/>
+ </sequence>
+ <attribute name="dll" type="NCName" use="required"/>
+ <anyAttribute namespace="##any" processContents="lax"/>
+ </extension>
+ </complexContent>
+ </complexType>
+</schema> \ No newline at end of file
diff --git a/sdo-cpp/trunk/runtime/core/test/sca-implementation-java.xsd b/sdo-cpp/trunk/runtime/core/test/sca-implementation-java.xsd
new file mode 100644
index 0000000000..3f54089755
--- /dev/null
+++ b/sdo-cpp/trunk/runtime/core/test/sca-implementation-java.xsd
@@ -0,0 +1,41 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ Licensed to the Apache Software Foundation (ASF) under one
+ or more contributor license agreements. See the NOTICE file
+ distributed with this work for additional information
+ regarding copyright ownership. The ASF licenses this file
+ to you 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.
+-->
+
+<schema xmlns="http://www.w3.org/2001/XMLSchema"
+ targetNamespace="http://www.commonj.org/xmlns/sca/v0.0.1/"
+ xmlns:sca="http://www.commonj.org/xmlns/sca/v0.0.1/"
+ xmlns:sdo="commonj.sdo/XML"
+ elementFormDefault="qualified">
+
+ <include schemaLocation="sca-core.xsd"/>
+
+ <element name="implementation.java" type="sca:JavaImplementation" substitutionGroup="sca:implementation" sdo:name="implementationJava"/>
+ <complexType name="JavaImplementation">
+ <complexContent>
+ <extension base="sca:Implementation">
+ <sequence>
+ <any namespace="##other" processContents="lax" minOccurs="0" maxOccurs="unbounded"/>
+ </sequence>
+ <attribute name="class" type="NCName" use="required"/>
+ <anyAttribute namespace="##any" processContents="lax"/>
+ </extension>
+ </complexContent>
+ </complexType>
+</schema> \ No newline at end of file
diff --git a/sdo-cpp/trunk/runtime/core/test/sca-implementation-local-java.xsd b/sdo-cpp/trunk/runtime/core/test/sca-implementation-local-java.xsd
new file mode 100644
index 0000000000..ce4f529f3e
--- /dev/null
+++ b/sdo-cpp/trunk/runtime/core/test/sca-implementation-local-java.xsd
@@ -0,0 +1,43 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ Licensed to the Apache Software Foundation (ASF) under one
+ or more contributor license agreements. See the NOTICE file
+ distributed with this work for additional information
+ regarding copyright ownership. The ASF licenses this file
+ to you 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.
+-->
+
+<schema xmlns="http://www.w3.org/2001/XMLSchema"
+ targetNamespace="http://www.commonj.org/xmlns/sca/v0.0.1/"
+ xmlns:sca="http://www.commonj.org/xmlns/sca/v0.0.1/"
+ xmlns:sdo="commonj.sdo/XML"
+ elementFormDefault="qualified">
+
+ <include schemaLocation="sca-core.xsd"/>
+
+ <element name="implementation.local.java" type="sca:LocalJavaImplementation" substitutionGroup="sca:implementation" sdo:name="implementationLocalJava"/>
+ <complexType name="LocalJavaImplementation">
+ <complexContent>
+ <extension base="sca:Implementation">
+ <sequence>
+ <any namespace="##other" processContents="lax" minOccurs="0" maxOccurs="unbounded"/>
+ </sequence>
+ <attribute name="class" type="NCName" use="required"/>
+ <attribute name="scope" type="sca:Scope" use="optional"/>
+ <anyAttribute namespace="##any" processContents="lax"/>
+ </extension>
+ </complexContent>
+ </complexType>
+
+</schema> \ No newline at end of file
diff --git a/sdo-cpp/trunk/runtime/core/test/sca-interface-cpp.xsd b/sdo-cpp/trunk/runtime/core/test/sca-interface-cpp.xsd
new file mode 100644
index 0000000000..ddbfe540b7
--- /dev/null
+++ b/sdo-cpp/trunk/runtime/core/test/sca-interface-cpp.xsd
@@ -0,0 +1,68 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ Licensed to the Apache Software Foundation (ASF) under one
+ or more contributor license agreements. See the NOTICE file
+ distributed with this work for additional information
+ regarding copyright ownership. The ASF licenses this file
+ to you 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.
+-->
+
+<schema xmlns="http://www.w3.org/2001/XMLSchema"
+ targetNamespace="http://www.commonj.org/xmlns/sca/v0.0.1/"
+ xmlns:sca="http://www.commonj.org/xmlns/sca/v0.0.1/"
+ xmlns:sdo="commonj.sdo/XML"
+ elementFormDefault="qualified">
+
+ <include schemaLocation="sca-core.xsd"/>
+
+ <element name="interface.cpp" type="sca:CPPInterface" substitutionGroup="sca:interface"
+ sdo:name="interfaceCpp"/>
+ <complexType name="CPPInterface">
+ <complexContent>
+ <extension base="sca:Interface">
+ <sequence>
+ <element minOccurs="1" name="operation" type="sca:Operation"/>
+ </sequence>
+ <anyAttribute namespace="##any" processContents="lax"/>
+ </extension>
+ </complexContent>
+ </complexType>
+
+ <!-- C++ operation declaration -->
+ <complexType name="Operation">
+ <complexContent>
+ <sequence>
+ <element minOccurs="1" maxOccurs="1" name="return" type="sca:ReturnType"/>
+ <element minOccurs="0" name="parameter" type="sca:ParameterType"/>
+ </sequence>
+ <attribute name="name" type="string" use="required"/>
+ </complexContent>
+ </complexType>
+
+ <simpleType name="ReturnType">
+ <restriction base="string">
+ <enumeration value="float"/>
+ <enumeration value="void"/>
+ </restriction>
+ </simpleType>
+
+ <simpleType name="ParameterType">
+ <restriction base="string">
+ <enumeration value="float"/>
+ <enumeration value="const char *"/>
+ </restriction>
+ </simpleType>
+
+
+</schema> \ No newline at end of file
diff --git a/sdo-cpp/trunk/runtime/core/test/sca-interface-java.xsd b/sdo-cpp/trunk/runtime/core/test/sca-interface-java.xsd
new file mode 100644
index 0000000000..579f9483df
--- /dev/null
+++ b/sdo-cpp/trunk/runtime/core/test/sca-interface-java.xsd
@@ -0,0 +1,44 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ Licensed to the Apache Software Foundation (ASF) under one
+ or more contributor license agreements. See the NOTICE file
+ distributed with this work for additional information
+ regarding copyright ownership. The ASF licenses this file
+ to you 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.
+-->
+
+
+<schema xmlns="http://www.w3.org/2001/XMLSchema"
+ targetNamespace="http://www.commonj.org/xmlns/sca/v0.0.1/"
+ xmlns:sca="http://www.commonj.org/xmlns/sca/v0.0.1/"
+ xmlns:sdo="commonj.sdo/XML"
+ elementFormDefault="qualified">
+
+ <include schemaLocation="sca-core.xsd"/>
+
+ <element name="interface.java" type="sca:JavaInterface" substitutionGroup="sca:interface" sdo:name="interfaceJava"/>
+ <complexType name="JavaInterface">
+ <complexContent>
+ <extension base="sca:Interface">
+ <sequence>
+ <any namespace="##other" processContents="lax" minOccurs="0" maxOccurs="unbounded"/>
+ </sequence>
+ <attribute name="interface" type="NCName" use="required"/>
+ <attribute name="callbackInterface" type="NCName" use="optional"/>
+ <anyAttribute namespace="##any" processContents="lax"/>
+ </extension>
+ </complexContent>
+ </complexType>
+</schema>
+
diff --git a/sdo-cpp/trunk/runtime/core/test/sca-interface-wsdl.xsd b/sdo-cpp/trunk/runtime/core/test/sca-interface-wsdl.xsd
new file mode 100644
index 0000000000..9c15d87485
--- /dev/null
+++ b/sdo-cpp/trunk/runtime/core/test/sca-interface-wsdl.xsd
@@ -0,0 +1,43 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ Licensed to the Apache Software Foundation (ASF) under one
+ or more contributor license agreements. See the NOTICE file
+ distributed with this work for additional information
+ regarding copyright ownership. The ASF licenses this file
+ to you 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.
+-->
+
+
+<schema xmlns="http://www.w3.org/2001/XMLSchema"
+ targetNamespace="http://www.commonj.org/xmlns/sca/v0.0.1/"
+ xmlns:sca="http://www.commonj.org/xmlns/sca/v0.0.1/"
+ xmlns:sdo="commonj.sdo/XML"
+ elementFormDefault="qualified">
+
+ <include schemaLocation="sca-core.xsd"/>
+
+ <element name="interface.wsdl" type="sca:WSDLPortType" substitutionGroup="sca:interface" sdo:name="interfaceWsdl"/>
+ <complexType name="WSDLPortType">
+ <complexContent>
+ <extension base="sca:Interface">
+ <sequence>
+ <any namespace="##other" processContents="lax" minOccurs="0" maxOccurs="unbounded"/>
+ </sequence>
+ <attribute name="interface" type="anyURI" use="required"/>
+ <attribute name="callbackInterface" type="anyURI" use="optional"/>
+ <anyAttribute namespace="##any" processContents="lax"/>
+ </extension>
+ </complexContent>
+ </complexType>
+</schema>
diff --git a/sdo-cpp/trunk/runtime/core/test/sca-property-java.xsd b/sdo-cpp/trunk/runtime/core/test/sca-property-java.xsd
new file mode 100644
index 0000000000..77a6df6772
--- /dev/null
+++ b/sdo-cpp/trunk/runtime/core/test/sca-property-java.xsd
@@ -0,0 +1,43 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ Licensed to the Apache Software Foundation (ASF) under one
+ or more contributor license agreements. See the NOTICE file
+ distributed with this work for additional information
+ regarding copyright ownership. The ASF licenses this file
+ to you 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.
+-->
+
+
+<schema xmlns="http://www.w3.org/2001/XMLSchema"
+ targetNamespace="http://www.commonj.org/xmlns/sca/v0.0.1/"
+ xmlns:sdo="commonj.sdo/XML"
+ xmlns:sca="http://www.commonj.org/xmlns/sca/v0.0.1/"
+ elementFormDefault="qualified">
+
+ <include schemaLocation="sca-core.xsd"/>
+
+ <element name="property.java" type="sca:JavaProperty" substitutionGroup="sca:property" sdo:name="propertyJava"/>
+ <complexType name="JavaProperty">
+ <complexContent>
+ <extension base="sca:Property">
+ <sequence>
+ <any namespace="##other" processContents="lax" minOccurs="0" maxOccurs="unbounded"/>
+ </sequence>
+ <attribute name="class" type="NCName" use="required"/>
+ <anyAttribute namespace="##any" processContents="lax"/>
+ </extension>
+ </complexContent>
+ </complexType>
+</schema>
+
diff --git a/sdo-cpp/trunk/runtime/core/test/sca-property-xsd.xsd b/sdo-cpp/trunk/runtime/core/test/sca-property-xsd.xsd
new file mode 100644
index 0000000000..2820bd3dd6
--- /dev/null
+++ b/sdo-cpp/trunk/runtime/core/test/sca-property-xsd.xsd
@@ -0,0 +1,41 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ Licensed to the Apache Software Foundation (ASF) under one
+ or more contributor license agreements. See the NOTICE file
+ distributed with this work for additional information
+ regarding copyright ownership. The ASF licenses this file
+ to you 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.
+-->
+
+<schema xmlns="http://www.w3.org/2001/XMLSchema"
+ targetNamespace="http://www.commonj.org/xmlns/sca/v0.0.1/"
+ xmlns:sdo="commonj.sdo/XML"
+ xmlns:sca="http://www.commonj.org/xmlns/sca/v0.0.1/"
+ elementFormDefault="qualified">
+
+ <include schemaLocation="sca-core.xsd"/>
+
+ <element name="property.xsd" type="sca:XSDProperty" substitutionGroup="sca:property" sdo:name="propertyXsd"/>
+ <complexType name="XSDProperty">
+ <complexContent>
+ <extension base="sca:Property">
+ <sequence>
+ <any namespace="##other" processContents="lax" minOccurs="0" maxOccurs="unbounded"/>
+ </sequence>
+ <attribute name="type" type="anyURI" use="required"/>
+ <anyAttribute namespace="##any" processContents="lax"/>
+ </extension>
+ </complexContent>
+ </complexType>
+</schema> \ No newline at end of file
diff --git a/sdo-cpp/trunk/runtime/core/test/sca.xsd b/sdo-cpp/trunk/runtime/core/test/sca.xsd
new file mode 100644
index 0000000000..72cc5f497b
--- /dev/null
+++ b/sdo-cpp/trunk/runtime/core/test/sca.xsd
@@ -0,0 +1,41 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ Licensed to the Apache Software Foundation (ASF) under one
+ or more contributor license agreements. See the NOTICE file
+ distributed with this work for additional information
+ regarding copyright ownership. The ASF licenses this file
+ to you 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.
+-->
+
+<schema xmlns="http://www.w3.org/2001/XMLSchema"
+ targetNamespace="http://www.commonj.org/xmlns/sca/v0.0.1/"
+ xmlns:sca="http://www.commonj.org/xmlns/sca/v0.0.1/">
+
+ <include schemaLocation="sca-core.xsd"/>
+
+ <include schemaLocation="sca-interface-wsdl.xsd"/>
+ <include schemaLocation="sca-interface-cpp.xsd"/>
+ <include schemaLocation="sca-interface-java.xsd"/>
+
+ <include schemaLocation="sca-property-xsd.xsd"/>
+
+ <include schemaLocation="sca-implementation-dll.xsd"/>
+
+ <include schemaLocation="sca-implementation-java.xsd"/>
+ <include schemaLocation="sca-implementation-local-java.xsd"/>
+
+ <include schemaLocation="sca-binding-ws.xsd"/>
+
+
+</schema> \ No newline at end of file
diff --git a/sdo-cpp/trunk/runtime/core/test/scenario1.txt b/sdo-cpp/trunk/runtime/core/test/scenario1.txt
new file mode 100644
index 0000000000..a0a3c7a203
--- /dev/null
+++ b/sdo-cpp/trunk/runtime/core/test/scenario1.txt
@@ -0,0 +1,10 @@
+Created object in changed list
+The object is myspace#Company
+===== Modified Object Starts
+Xpath:#/
+The modified objects type is myspace#Root
+===== Old Property Values Begin
+Property companies[0](UNSET) of type DataObject - object null or unset
+
+===== Old Property Values End
+=====Modified Object Ends
diff --git a/sdo-cpp/trunk/runtime/core/test/scenario2.txt b/sdo-cpp/trunk/runtime/core/test/scenario2.txt
new file mode 100644
index 0000000000..9728bd6f0a
--- /dev/null
+++ b/sdo-cpp/trunk/runtime/core/test/scenario2.txt
@@ -0,0 +1,8 @@
+===== Modified Object Starts
+Xpath:#/companies.0
+The modified objects type is myspace#Company
+===== Old Property Values Begin
+Property name of type String:acme
+
+===== Old Property Values End
+=====Modified Object Ends
diff --git a/sdo-cpp/trunk/runtime/core/test/scenario3.txt b/sdo-cpp/trunk/runtime/core/test/scenario3.txt
new file mode 100644
index 0000000000..e174f62538
--- /dev/null
+++ b/sdo-cpp/trunk/runtime/core/test/scenario3.txt
@@ -0,0 +1,22 @@
+=====Deleted Object Starts
+===== Old Property Values Begin
+Property name of type String:acme
+
+Property id of type String:123
+
+===== Old Property Values End
+=====Deleted Object Ends
+===== Modified Object Starts
+Xpath:#/
+The modified objects type is myspace#Root
+===== Old Property Values Begin
+Property companies[0] of type DataObject - object deleted
+===== Old Property Values Begin
+Property name of type String:acme
+
+Property id of type String:123
+
+===== Old Property Values End
+
+===== Old Property Values End
+=====Modified Object Ends
diff --git a/sdo-cpp/trunk/runtime/core/test/scenario4.txt b/sdo-cpp/trunk/runtime/core/test/scenario4.txt
new file mode 100644
index 0000000000..f678499e15
--- /dev/null
+++ b/sdo-cpp/trunk/runtime/core/test/scenario4.txt
@@ -0,0 +1,108 @@
+Created object in changed list
+The object is myspace#Employee
+===== Modified Object Starts
+Xpath:#/companies.0/departments.0
+The modified objects type is myspace#Department
+===== Old Property Values Begin
+Property employees[0] of type DataObject object still exists
+
+Property employees[1] of type DataObject object still exists
+
+===== Old Property Values End
+=====Modified Object Ends
+===== Modified Object Starts
+Xpath:#/companies.0/departments.1
+The modified objects type is myspace#Department
+===== Old Property Values Begin
+Property employees[0] of type DataObject - object deleted
+===== Old Property Values Begin
+Property name of type String:Ed Memoire
+
+Property id of type String:1
+
+===== Old Property Values End
+
+Property employees[1] of type DataObject object still exists
+
+===== Old Property Values End
+=====Modified Object Ends
+=====Deleted Object Starts
+===== Old Property Values Begin
+Property name of type String:Ed Memoire
+
+Property id of type String:1
+
+===== Old Property Values End
+=====Deleted Object Ends
+=====Deleted Object Starts
+===== Old Property Values Begin
+Property name of type String:Ivor Payne
+
+Property id of type String:1
+
+===== Old Property Values End
+=====Deleted Object Ends
+=====Deleted Object Starts
+===== Old Property Values Begin
+Property name of type String:Colin Poisson
+
+Property id of type String:2
+
+===== Old Property Values End
+=====Deleted Object Ends
+=====Deleted Object Starts
+===== Old Property Values Begin
+Property name of type String:windows
+
+Property id of type String:1
+
+Property employees[1] of type DataObject - object deleted
+===== Old Property Values Begin
+Property name of type String:Colin Poisson
+
+Property id of type String:2
+
+===== Old Property Values End
+
+Property employees[0] of type DataObject - object deleted
+===== Old Property Values Begin
+Property name of type String:Ivor Payne
+
+Property id of type String:1
+
+===== Old Property Values End
+
+===== Old Property Values End
+=====Deleted Object Ends
+===== Modified Object Starts
+Xpath:#/companies.1
+The modified objects type is myspace#Company
+===== Old Property Values Begin
+Property departments[0] of type DataObject - object deleted
+===== Old Property Values Begin
+Property name of type String:windows
+
+Property id of type String:1
+
+Property employees[1] of type DataObject - object deleted
+===== Old Property Values Begin
+Property name of type String:Colin Poisson
+
+Property id of type String:2
+
+===== Old Property Values End
+
+Property employees[0] of type DataObject - object deleted
+===== Old Property Values Begin
+Property name of type String:Ivor Payne
+
+Property id of type String:1
+
+===== Old Property Values End
+
+===== Old Property Values End
+
+Property departments[1] of type DataObject object still exists
+
+===== Old Property Values End
+=====Modified Object Ends
diff --git a/sdo-cpp/trunk/runtime/core/test/scenario5.txt b/sdo-cpp/trunk/runtime/core/test/scenario5.txt
new file mode 100644
index 0000000000..af5bf47102
--- /dev/null
+++ b/sdo-cpp/trunk/runtime/core/test/scenario5.txt
@@ -0,0 +1,8 @@
+===== Modified Object Starts
+Xpath:#/companies.0
+The modified objects type is myspace#Company
+===== Old Property Values Begin
+Property eotm of type DataObject object still exists
+
+===== Old Property Values End
+=====Modified Object Ends
diff --git a/sdo-cpp/trunk/runtime/core/test/sdotest.cpp b/sdo-cpp/trunk/runtime/core/test/sdotest.cpp
new file mode 100644
index 0000000000..be667b57b0
--- /dev/null
+++ b/sdo-cpp/trunk/runtime/core/test/sdotest.cpp
@@ -0,0 +1,9466 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you 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$ */
+
+#include <stdio.h>
+#include <stdlib.h>
+
+#pragma warning(disable:4786)
+
+#include <iostream>
+#include <fstream>
+using namespace std;
+
+
+
+#include "sdotest.h"
+#include "commonj/sdo/XpathHelper.h"
+#include "commonj/sdo/DataObjectImpl.h"
+#include "commonj/sdo/DataFactoryImpl.h"
+
+
+using namespace commonj::sdo;
+using namespace commonj::sdo::internal;
+
+
+
+/* USED IN RCPTEST */
+
+typedef struct {
+ //zend_object zo; /* The standard zend_object */
+ DataObjectPtr dop; /* The Hydra DataObject */
+ //zend_object *df; /* The Data Factory */
+} sdo_doimpl_object;
+
+
+int sdotest::rcptest()
+{
+
+ try {
+ DataFactoryPtr mdg;
+ sdo_doimpl_object* ptr;
+
+ mdg = DataFactory::getDataFactory();
+ mdg = 0;
+ mdg = DataFactory::getDataFactory();
+ mdg = NULL;
+ mdg = DataFactory::getDataFactory();
+
+ mdg->addType("myspace","Root");
+
+ mdg->addType("myspace","Company");
+
+ mdg->addPropertyToType("myspace","Company","name",
+ "commonj.sdo","String", false, false, false);
+
+ mdg->addPropertyToType("myspace","Company","id",
+ "commonj.sdo","String", false, false, false);
+
+ mdg->addPropertyToType("myspace","Root","companies",
+ "myspace","Company", true, false, true);
+
+ const Type& tcc = mdg->getType("myspace","Root");
+
+
+ ptr = new sdo_doimpl_object;
+
+ ptr->dop = mdg->create((Type&)tcc);
+
+ ptr->dop = 0; // null ;
+ return 1;
+ }
+ catch (SDORuntimeException e)
+ {
+ if (!silent) cout << "RefCountingPointer test failed" << endl;
+ return 0;
+ }
+}
+
+// JIRA 546 relaxes the restriction that when the data factory creates its
+// first data object then the type structure known to that data factory is
+// resolved and becomes read only. So, now we can add types after the first
+// data object is created. We must also show that when data objects are copied
+// from one data factory to another, the correct tests are performed to ensure
+// that the destination factory contains the types required by the incoming
+// data object and if not the copy is rejected.
+int sdotest::jira546()
+{
+
+ try {
+ DataFactoryPtr mdg;
+
+ mdg = DataFactory::getDataFactory();
+
+ mdg->addType("myspace","Root1");
+
+ mdg->addType("myspace","Company1");
+
+ mdg->addPropertyToType("myspace","Company1","name1",
+ "commonj.sdo","String", false, false, false);
+
+ mdg->addPropertyToType("myspace","Company1","id1",
+ "commonj.sdo","String", false, false, false);
+
+ mdg->addPropertyToType("myspace","Root1","companies1",
+ "myspace","Company1", true, false, true);
+
+ const Type& tcc1 = mdg->getType("myspace","Root1");
+
+
+ DataObjectPtr dop1 = mdg->create((Type&)tcc1);
+
+ // The preceding data object creation forced a resolve of the type
+ // system. Can we still extend it?
+
+ mdg->addType("myspace","Root2");
+
+ mdg->addType("myspace","Company2");
+
+ mdg->addPropertyToType("myspace","Company2","name2",
+ "commonj.sdo","String", false, false, false);
+
+ mdg->addPropertyToType("myspace","Company2","id2",
+ "commonj.sdo","String", false, false, false);
+
+ mdg->addPropertyToType("myspace","Root2","companies2",
+ "myspace","Company2", true, false, true);
+
+ const Type& tcc2 = mdg->getType("myspace","Root2");
+
+ DataObjectPtr dop2 = mdg->create((Type&)tcc2);
+
+ }
+ catch (SDORuntimeException e)
+ {
+ if (!silent) cout << "JIRA-546 test (part 1) failed." << endl;
+ return 0;
+ }
+
+ try {
+ DataFactoryPtr dfp_left = DataFactory::getDataFactory();
+ DataFactoryPtr dfp_right = DataFactory::getDataFactory();
+
+ populateFactory(dfp_left);
+ populateFactory(dfp_right);
+
+ // Extend each data factories with an additional type, the two types
+ // being different. Prior to TUSCANY-546 this would have made them
+ // incompatible.
+
+ dfp_left->addType("Namespace", "LeftType");
+ dfp_left->addPropertyToType("Namespace",
+ "LeftType",
+ "leftProperty",
+ "commonj.sdo",
+ "String",
+ false,
+ false,
+ false);
+
+ dfp_right->addType("Namespace", "RightType");
+ dfp_right->addPropertyToType("Namespace",
+ "RightType",
+ "rightProperty",
+ "commonj.sdo",
+ "String",
+ false,
+ false,
+ false);
+
+ // Create a data object in the left factory
+ DataObjectPtr root = dfp_left->create("Namespace", "Root");
+ DataObjectPtr project = root->createDataObject("project");
+ project->setCString("id", "The TTP Project");
+ DataObjectPtr str = project->createDataObject("string");
+ str->setDataObject("proj", project);
+ str->setCString("value", "The Recursive Acronym Project");
+ DataObjectPtr wp1 = project->createDataObject("packages");
+ DataObjectPtr wp2 = project->createDataObject("packages");
+ wp1->setCString("name", "Work Package 1");
+ wp2->setCString("name", "Work Package 2");
+ project->setDataObject("wp", wp2);
+ DataObjectPtr li1 = wp1->createDataObject("lineitems");
+ DataObjectPtr li2 = wp1->createDataObject("lineitems");
+ DataObjectPtr li3 = wp2->createDataObject("lineitems");
+ DataObjectPtr li4 = wp2->createDataObject("lineitems");
+ li1->setCString("itemname", "LineItem 1");
+ li2->setCString("itemname", "LineItem 2");
+ li3->setCString("itemname", "LineItem 3");
+ li4->setCString("itemname", "LineItem 4");
+ DataObjectPtr str1 = li1->createDataObject("string");
+ DataObjectPtr str2 = li2->createDataObject("string");
+ DataObjectPtr str3 = li3->createDataObject("string");
+ DataObjectPtr str4 = li4->createDataObject("string");
+ str1->setCString("value", "String1");
+ str2->setCString("value", "String2");
+ str3->setCString("value", "String3");
+ str4->setCString("value", "String4");
+
+ if (!transferto(root, dfp_right, false)) return 0;
+ return 1;
+ }
+ catch (SDORuntimeException e)
+ {
+ if (!silent) cout << "JIRA-546 test (part 2) failed." << endl;
+ return 0;
+ }
+}
+
+int sdotest::changesummarytest()
+{
+ if (scenario5() == 0) return 0;
+ if (scenario1() == 0) return 0;
+ if (scenario2() == 0) return 0;
+ if (scenario3() == 0) return 0;
+ if (scenario4() == 0) return 0;
+ return 1;
+}
+
+
+int sdotest::scenario1()
+{
+ // scenario 1
+ // create root type - root has cs
+ // create a company type. and containment ref from root, many valued.
+ // props on comp id, name both strings single v.
+ // create root object
+ // begin logging
+ // create a company obj. name=acme id=123
+
+ DataFactoryPtr mdg = DataFactory::getDataFactory();
+
+ mdg->addType("myspace","Root");
+ mdg->addPropertyToType("myspace","Root","whatever",
+ "commonj.sdo","ChangeSummary", false, false, false);
+
+ mdg->addType("myspace","Company");
+
+ mdg->addPropertyToType("myspace","Company","name",
+ "commonj.sdo","String", false, false, false);
+
+ mdg->addPropertyToType("myspace","Company","id",
+ "commonj.sdo","String", false, false, false);
+
+ mdg->addPropertyToType("myspace","Root","companies",
+ "myspace","Company", true, false, true);
+
+ const Type& tcc = mdg->getType("myspace","Root");
+ DataObjectPtr dor = mdg->create((Type&)tcc);
+
+ ChangeSummaryPtr cs = dor->getChangeSummary();
+ cs->beginLogging();
+
+ DataObjectPtr com = dor->createDataObject("companies");
+ com->setCString("name","acme");
+ com->setCString("id","123");
+
+ FILE *f = fopen("scenario1.dat","w+");
+ if (f == 0)
+ {
+ if (!silent) cout << "Unable to open secnario1.dat" << endl;
+ return 0;
+ }
+
+ dumpchangesummary(f, cs);
+
+ fclose(f);
+
+ cs->endLogging();
+
+ //expect cdo:
+ //root - isChanged
+ //comp - isCreated
+
+ return comparefiles("scenario1.dat","scenario1.txt");
+}
+
+
+int sdotest::testui()
+{
+
+ try {
+ DataFactoryPtr mdg = DataFactory::getDataFactory();
+
+ mdg->addType("companyNS","MainType");
+
+
+ /* Now add the properties to the types...*/
+
+
+ const Type& tmain = mdg->getType("companyNS","MainType");
+ const Type& tshort = mdg->getType("commonj.sdo","Short");
+ const Type& tint = mdg->getType("commonj.sdo","Int");
+
+
+ mdg->addPropertyToType(tmain,"short",tshort,true);
+ mdg->addPropertyToType(tmain,"int",tint, true);
+
+ DataObjectPtr main = mdg->create((Type&)tmain);
+
+ DataObjectList& dol1 = main->getList("short");
+ DataObjectList& dol2 = main->getList("int");
+ DataObjectList& dol3 = main->getList((unsigned int)0);
+ DataObjectList& dol4 = main->getList(1);
+
+ return 1;
+ }
+
+ catch (SDORuntimeException e)
+ {
+ if (!silent) cout << "Unsigned int test failed" << endl << e << endl;
+ return 0;
+ }
+
+}
+
+
+
+int sdotest::scenario5()
+{
+ // scenario 5
+ // create root type - root has cs
+ // create a company type. and containment ref from root, many valued.
+ // props on comp id, name both strings single v.
+ // create root object
+ // begin logging
+ // create a company obj. name=acme id=123
+
+ DataFactoryPtr mdg = DataFactory::getDataFactory();
+
+ mdg->addType("myspace","Root");
+ mdg->addPropertyToType("myspace","Root","whatever",
+ "commonj.sdo","ChangeSummary", false, false, false);
+
+ mdg->addType("myspace","Company");
+ mdg->addType("myspace","Employee");
+ mdg->addPropertyToType("myspace","Employee","name",
+ "commonj.sdo","String", false, false, false);
+
+
+ mdg->addPropertyToType("myspace","Company","name",
+ "commonj.sdo","String", false, false, false);
+
+ mdg->addPropertyToType("myspace","Company","id",
+ "commonj.sdo","String", false, false, false);
+
+ mdg->addPropertyToType("myspace","Company","eotm",
+ "myspace","Employee", false, false, false);
+
+ mdg->addPropertyToType("myspace","Company","employees",
+ "myspace","Employee", true, false, true);
+
+ mdg->addPropertyToType("myspace","Root","companies",
+ "myspace","Company", true, false, true);
+
+ const Type& tcc = mdg->getType("myspace","Root");
+ DataObjectPtr dor = mdg->create((Type&)tcc);
+
+ ChangeSummaryPtr cs = dor->getChangeSummary();
+
+ DataObjectPtr com = dor->createDataObject("companies");
+ com->setCString("name","acme");
+ com->setCString("id","123");
+
+ const Type& te = mdg->getType("myspace","Employee");
+
+ DataObjectPtr emp = mdg->create(te);
+ emp->setCString("name", "Mr Expendible");
+
+ DataObjectList& emps = com->getList("employees");
+
+ emps.append(emp);
+
+ com->setDataObject("eotm",emp);
+
+ cs->beginLogging();
+
+ com->unset("eotm");
+
+ FILE *f = fopen("scenario5.dat","w+");
+ if (f == 0)
+ {
+ if (!silent) cout << "Unable to open scenario5.dat" << endl;
+ return 0;
+ }
+
+ dumpchangesummary(f, cs);
+
+ fclose(f);
+
+ cs->endLogging();
+
+ return comparefiles("scenario5.dat","scenario5.txt");
+
+ //expect com to have change record, nothing for eotm:
+
+}
+
+int sdotest::scenario2()
+{
+ // create root type - root has cs
+ // create a company type. and containment ref from root, many valued.
+ // 2 props on comp id, name both strings single v.
+ // create root object
+ // create a company obj. name=acme id=123
+ // begin logging()
+ // name="megacorp"
+
+ DataFactoryPtr mdg = DataFactory::getDataFactory();
+
+ mdg->addType("myspace","Root");
+ mdg->addPropertyToType("myspace","Root","whatever",
+ "commonj.sdo","ChangeSummary", false, false, false);
+
+ mdg->addType("myspace","Company");
+
+ mdg->addPropertyToType("myspace","Company","name",
+ "commonj.sdo","String", false, false, false);
+
+ mdg->addPropertyToType("myspace","Company","id",
+ "commonj.sdo","String", false, false, false);
+
+ mdg->addPropertyToType("myspace","Root","companies",
+ "myspace","Company", true, false, true);
+
+ const Type& tcc = mdg->getType("myspace","Root");
+ DataObjectPtr dor = mdg->create((Type&)tcc);
+
+ DataObjectPtr com = dor->createDataObject("companies");
+ com->setCString("name","acme");
+ com->setCString("id","123");
+
+ ChangeSummaryPtr cs = dor->getChangeSummary();
+ cs->beginLogging();
+
+ com->setCString("name","megacorp");
+
+ FILE *f = fopen("scenario2.dat","w+");
+ if (f == 0)
+ {
+ if (!silent) cout << "Unable to open scenario2.dat" << endl;
+ return 0;
+ }
+
+ dumpchangesummary(f, cs);
+
+ fclose(f);
+
+ cs->endLogging();
+
+ //expect cdo:
+ //root- nothing
+ // company- isChanged
+ //setting prop=name, value="acme"
+
+ return comparefiles("scenario2.dat","scenario2.txt");
+
+}
+
+int sdotest::scenario3()
+{
+
+ //create root type - root has cs
+ //create a company type. and containment ref from root, many valued.
+ //2 props on comp id, name both strings single v.
+ //create root object
+ //create a company obj. name=acme id=123
+ //begin logging()
+ //delete company
+
+ DataFactoryPtr mdg = DataFactory::getDataFactory();
+
+ mdg->addType("myspace","Root");
+ mdg->addPropertyToType("myspace","Root","whatever",
+ "commonj.sdo","ChangeSummary", false, false, false);
+
+ mdg->addType("myspace","Company");
+
+ mdg->addPropertyToType("myspace","Company","name",
+ "commonj.sdo","String", false, false, false);
+
+ mdg->addPropertyToType("myspace","Company","id",
+ "commonj.sdo","String", false, false, false);
+
+ mdg->addPropertyToType("myspace","Root","companies",
+ "myspace","Company", true, false, true);
+
+ const Type& tcc = mdg->getType("myspace","Root");
+ DataObjectPtr dor = mdg->create((Type&)tcc);
+
+ DataObjectPtr com = dor->createDataObject("companies");
+ com->setCString("name","acme");
+ com->setCString("id","123");
+
+ ChangeSummaryPtr cs = dor->getChangeSummary();
+ cs->beginLogging();
+
+ com->detach();
+
+ FILE *f = fopen("scenario3.dat","w+");
+ if (f == 0)
+ {
+ if (!silent) cout << "Unable to open scenario3.dat" << endl;
+ return 0;
+ }
+
+ dumpchangesummary(f, cs);
+
+ cs->endLogging();
+
+ fclose(f);
+
+ // expect cdo
+ // root - changed
+ // company - deleted
+
+ return comparefiles("scenario3.dat","scenario3.txt");
+
+}
+
+int sdotest::scenario4()
+{
+ //create root type - root has cs
+ //create a company type. and containment ref from root, many valued.
+ //create a dept type. and containment ref from comp, many valued.
+ //create a emp type. and containment ref from dept, many valued.
+ // give name and id properties to comp,dept, emp
+
+ //create root object
+ //create a company obj. name=acme id=123
+ //create a company obj. name=megacorp id=124
+ // give each company 2 depts
+ // give each dept 2 employees
+
+ // begin logging()
+ // add new employee to first dept of acme
+ // delete employee from second dept of acme
+
+ // change name of first employee of first dept megacorp.
+ // delete first dept of megacorp.
+
+ DataFactoryPtr mdg = DataFactory::getDataFactory();
+
+ mdg->addType("myspace","Root");
+ mdg->addPropertyToType("myspace","Root","whatever",
+ "commonj.sdo","ChangeSummary", false, false, false);
+
+ mdg->addType("myspace","Company");
+ mdg->addPropertyToType("myspace","Company","name",
+ "commonj.sdo","String", false, false, false);
+
+ mdg->addPropertyToType("myspace","Company","id",
+ "commonj.sdo","String", false, false, false);
+
+ mdg->addType("myspace","Department");
+ mdg->addPropertyToType("myspace","Department","name",
+ "commonj.sdo","String", false, false, false);
+
+ mdg->addPropertyToType("myspace","Department","id",
+ "commonj.sdo","String", false, false, false);
+
+ mdg->addType("myspace","Employee");
+ mdg->addPropertyToType("myspace","Employee","name",
+ "commonj.sdo","String", false, false, false);
+
+ mdg->addPropertyToType("myspace","Employee","id",
+ "commonj.sdo","String", false, false, false);
+
+ mdg->addPropertyToType("myspace","Root","companies",
+ "myspace","Company", true, false, true);
+
+ mdg->addPropertyToType("myspace","Company","departments",
+ "myspace","Department", true, false, true);
+
+ mdg->addPropertyToType("myspace","Department","employees",
+ "myspace","Employee", true, false, true);
+
+ const Type& tcc = mdg->getType("myspace","Root");
+ DataObjectPtr dor = mdg->create((Type&)tcc);
+
+ DataObjectPtr com = dor->createDataObject("companies");
+ com->setCString("name","acme");
+ com->setCString("id","123");
+
+ DataObjectPtr dep = com->createDataObject("departments");
+ dep->setCString("name","widgets");
+ dep->setCString("id","1");
+
+ DataObjectPtr emp = dep->createDataObject("employees");
+ emp->setCString("name","John O'Watt");
+ emp->setCString("id","1");
+
+ emp = dep->createDataObject("employees");
+ emp->setCString("name","Ida Know");
+ emp->setCString("id","2");
+
+
+ dep = com->createDataObject("departments");
+ dep->setCString("name","gadgets");
+ dep->setCString("id","2");
+
+ emp = dep->createDataObject("employees");
+ emp->setCString("name","Ed Memoire");
+ emp->setCString("id","1");
+
+ emp = dep->createDataObject("employees");
+ emp->setCString("name","Phyllis Tyne");
+ emp->setCString("id","2");
+
+
+ DataObjectPtr com2 = dor->createDataObject("companies");
+ com2->setCString("name","megacorp");
+ com2->setCString("id","124");
+
+ dep = com2->createDataObject("departments");
+ dep->setCString("name","windows");
+ dep->setCString("id","1");
+
+ emp = dep->createDataObject("employees");
+ emp->setCString("name","Ivor Payne");
+ emp->setCString("id","1");
+
+ emp = dep->createDataObject("employees");
+ emp->setCString("name","Colin Poisson");
+ emp->setCString("id","2");
+
+ dep = com2->createDataObject("departments");
+ dep->setCString("name","portholes");
+ dep->setCString("id","2");
+
+ emp = dep->createDataObject("employees");
+ emp->setCString("name","Graham Angreeneggs");
+ emp->setCString("id","1");
+
+ emp = dep->createDataObject("employees");
+ emp->setCString("name","Helen Highwater");
+ emp->setCString("id","2");
+
+ DataObjectList& deps = com->getList("departments");
+ DataObjectList& emps = deps[0]->getList("employees");
+ DataObjectList& emps2 = deps[1]->getList("employees");
+ DataObjectList& deps2 = com2->getList("departments");
+ DataObjectList& emps3 = deps2[0]->getList("employees");
+ DataObjectList& emps4 = deps2[1]->getList("employees");
+
+ // should be able to get the change summary property, but it
+ // should be zero.
+ // should be able to find out if the type is a change summary type
+
+ if (! dor->getType().isChangeSummaryType())
+ {
+ if (!silent) cout << "The root object DOESNT HAVE a change summary !!!" << endl;
+ return 0;
+ }
+
+ try {
+ DataObjectPtr csptr = dor->getDataObject("whatever");
+
+ if (!csptr) {
+ if (!silent) cout << "CS property was zero - should be invisible!!!!" << endl;
+ return 0;
+ }
+ else {
+ if (!silent) cout << "CS property was NOT zero !!" << endl;
+ return 0;
+ }
+ }
+ catch (SDOPropertyNotFoundException e)
+ {
+ // cout << "No property shows - this is correct" << endl;
+ }
+
+
+ if (com->getType().isChangeSummaryType())
+ {
+ if (!silent) cout << "The company object has a change summary !!!!" << endl;
+ return 0;
+ }
+
+ ChangeSummaryPtr cs = dor->getChangeSummary();
+ cs->beginLogging();
+
+ DataObjectList& depsout = com->getList("departments");
+
+ emp = depsout[0]->createDataObject("employees");
+ emp->setCString("name","Irma Newby");
+ emp->setCString("id","3");
+
+ DataObjectList& empsout = depsout[1]->getList("employees");
+ empsout.remove(0);
+
+ DataObjectList& depsout2 = com2->getList("departments");
+ DataObjectList& empsout2 = depsout2[0]->getList("employees");
+ empsout2[0]->setCString("name","Ive had my name changed");
+
+ depsout2[0]->detach();
+
+ FILE *f = fopen("scenario4.dat","w+");
+ if (f == 0)
+ {
+ if (!silent) cout << "Unable to open secnario4.dat" << endl;
+ return 0;
+ }
+
+ dumpchangesummary(f, cs);
+
+ cs->endLogging();
+
+ fclose(f);
+
+ // expect:
+ // company acme, department widgets changed.
+ // employee 3 of dept widgets of acme (Irma Newby) created.
+ // employee 1 of dept gadgets or acme deleted
+ // no change record for employee 1 of company megacorp, dept windows
+ // deletion for dept windows of megacorp
+ // deletion for emp 1 of windows - showing original value for name (Ivor Payne)
+ // deletion for emp 2 of windows.
+
+ return comparefiles("scenario4.dat","scenario4.txt");
+
+
+}
+
+int sdotest::seqtest()
+{
+ DataFactoryPtr mdg = DataFactory::getDataFactory();
+ // company is sequenced.
+ mdg->addType("myspace","Company",true,false);
+
+ mdg->addType("myspace","Department",true,false);
+ // string is many
+
+ mdg->addPropertyToType("myspace","Company","string","commonj.sdo","String",
+ true);
+
+ mdg->addPropertyToType("myspace","Company","departments","myspace","Department",
+ true);
+
+ mdg->addPropertyToType("myspace","Department","name","commonj.sdo","String");
+
+
+ const Type& tcc = mdg->getType("myspace","Company");
+
+ DataObjectPtr dor = mdg->create(tcc);
+ const Property& sprop = dor->getType().getProperty("string");
+ SequencePtr sptr = dor->getSequence();
+
+ FILE *f = fopen("sequence.dat","w+");
+ if (f == 0)
+ {
+ if (!silent) cout << "Cannot open sequence.dat" << endl;
+ return 0;
+ }
+
+ printseq(f, sptr);
+
+ sptr->addCString(sprop,"I am Item 1 of string");
+
+ printseq(f, sptr);
+
+ sptr->addText("I am the first free text");
+
+ printseq(f, sptr);
+
+ sptr->addCString(sprop,"I am Item 2 of string");
+
+ printseq(f, sptr);
+
+ sptr->setCStringValue(1,"I am free text which has been modified");
+
+ DataObjectPtr dep1 = dor->createDataObject("departments");
+
+ printseq(f, sptr);
+
+ dep1->setCString("name","department1");
+
+ printseq(f, sptr);
+
+ DataObjectList& dol = dor->getList("departments");
+
+ const Type& tcd = mdg->getType("myspace","Department");
+ DataObjectPtr dep2 = mdg->create(tcd);
+
+ printseq(f, sptr);
+
+ dep2->setCString("name","department2");
+
+ printseq(f, sptr);
+
+ dol.append(dep2);
+
+ printseq(f, sptr);
+
+ fclose(f);
+
+ return comparefiles("sequence.dat","sequence.txt");
+
+
+}
+
+
+int sdotest::boolbug()
+{
+ DataFactoryPtr mdg = DataFactory::getDataFactory();
+ mdg->addType("myspace","Company");
+ mdg->addPropertyToType("myspace","Company","bool","commonj.sdo","Boolean");
+ const Type& tcc = mdg->getType("myspace","Company");
+ DataObjectPtr dor = mdg->create((Type&)tcc);
+ try {
+ bool b = dor->getBoolean("bool");
+ return 1;
+ }
+ catch (SDOPropertyNotSetException)
+ {
+ if (!silent) cout << "WRONG not set exception" << endl;
+ return 0;
+ }
+}
+
+int sdotest::scope1()
+{
+ try
+ {
+ DataFactoryPtr mdg = DataFactory::getDataFactory();
+ return 1;
+ }
+ catch(SDORuntimeException e)
+ {
+ return 0;
+ }
+}
+
+int sdotest::scope2()
+{
+ try {
+ DataFactoryPtr mdg = DataFactory::getDataFactory();
+ mdg->addType("myspace","Company");
+ mdg->addPropertyToType("myspace","Company","csumm","commonj.sdo","ChangeSummary");
+ const Type& tcc = mdg->getType("myspace","Company");
+ DataObjectPtr dor = mdg->create((Type&)tcc);
+ return 1;
+ }
+ catch (SDORuntimeException e)
+ {
+ return 0;
+ }
+}
+
+int sdotest::scope3()
+{
+ try {
+ DataFactoryPtr mdg = DataFactory::getDataFactory();
+ mdg->addType("myspace","Main");
+ mdg->addType("myspace","Subs");
+ mdg->addPropertyToType("myspace","Main","name","commonj.sdo","String");
+ mdg->addPropertyToType("myspace","Main","subs","myspace","Subs", true);
+ mdg->addPropertyToType("myspace","Subs","name","commonj.sdo","String");
+
+ const Type& tcc = mdg->getType("myspace","Main");
+ DataObjectPtr dor = mdg->create((Type&)tcc);
+
+ DataObjectPtr sub = dor->createDataObject("subs");
+ sub->setCString("name", "sub1");
+
+ sub = dor->createDataObject("subs");
+ sub->setCString("name", "sub2");
+ return 1;
+ }
+ catch (SDORuntimeException e)
+ {
+ return 0;
+ }
+
+}
+
+int sdotest::testGetters(DataObjectPtr dor)
+{
+ if (!testGetter(dor,"boolean")) return 0;
+ if (!testGetter(dor,"byte")) return 0;
+ if (!testGetter(dor,"character")) return 0;
+ if (!testGetter(dor,"short")) return 0;
+ if (!testGetter(dor,"int")) return 0;
+ if (!testGetter(dor,"long")) return 0;
+ if (!testGetter(dor,"double")) return 0;
+ if (!testGetter(dor,"float")) return 0;
+ if (!testGetter(dor,"date")) return 0;
+ if (!testGetter(dor,"string")) return 0;
+ if (!testGetter(dor,"bytes")) return 0;
+ if (!testGetter(dor,"dataobject")) return 0;
+ return 1;
+}
+
+int sdotest::testGetter(DataObjectPtr dor, char* str)
+{
+ try
+ {
+ bool b = dor->getBoolean(str);
+ }
+ catch (SDOPropertyNotSetException pe)
+ {
+ if (!silent)
+ {
+ cout << "WRONG unset and undefaulted" << endl;
+ }
+ return 0;
+ }
+ catch (SDOInvalidConversionException ec)
+ {
+ if (!strcmp(str,"dataobject"))
+ {
+ return 1;
+ }
+ return 0;
+ }
+ catch (SDORuntimeException e)
+ {
+ if (!silent) cout << e.getEClassName() << endl;
+ return 0;
+ }
+
+ try {
+ char by = dor->getByte(str);
+ }
+ catch (SDOPropertyNotSetException pe)
+ {
+ if (!silent) cout << "WRONG unset and undefaulted" << endl;
+ return 0;
+ }
+ catch (SDOInvalidConversionException ec)
+ {
+ if (!strcmp(str,"dataobject")) return 1;
+ return 0;
+
+ }
+ catch (SDORuntimeException e)
+ {
+ if (!silent) cout << e.getEClassName() << endl;
+ return 0;
+ }
+
+ try {
+ wchar_t cy = dor->getCharacter(str);
+ }
+ catch (SDOPropertyNotSetException pe)
+ {
+ if (!silent) cout << "WRONG unset and undefaulted" << endl;
+ return 0;
+ }
+ catch (SDOInvalidConversionException ec)
+ {
+ if (!strcmp(str,"dataobject")) return 1;
+ return 0;
+
+ }
+ catch (SDORuntimeException e)
+ {
+ if (!silent) cout << e.getEClassName() << endl;
+ return 0;
+ }
+
+ try {
+ short s = dor->getShort(str);
+ }
+ catch (SDOInvalidConversionException ec)
+ {
+ if (!strcmp(str,"dataobject")) return 1;
+ if (!strcmp(str,"bytes")) return 1;
+ return 0;
+
+ }
+ catch (SDOPropertyNotSetException pe)
+ {
+ if (!silent) cout << "WRONG unset and undefaulted" << endl;
+ return 0;
+ }
+ catch (SDORuntimeException e)
+ {
+ if (!silent) cout << e.getEClassName() << endl;
+ return 0;
+ }
+
+ try {
+ int i = dor->getInt(str);
+ }
+ catch (SDOPropertyNotSetException pe)
+ {
+ if (!silent) cout << "WRONG unset and undefaulted" << endl;
+ return 0;
+ }
+ catch (SDOInvalidConversionException ec)
+ {
+ if (!strcmp(str,"dataobject")) return 1;
+ return 0;
+
+ }
+ catch (SDORuntimeException e)
+ {
+ if (!silent) cout << e.getEClassName() << endl;
+ return 0;
+ }
+
+ try {
+ long l = dor->getLong(str);
+ }
+ catch (SDOPropertyNotSetException pe)
+ {
+ if (!silent) cout << "WRONG unset and undefaulted" << endl;
+ return 0;
+ }
+ catch (SDOInvalidConversionException ec)
+ {
+ if (!strcmp(str,"dataobject")) return 1;
+ return 0;
+
+ }
+ catch (SDORuntimeException e)
+ {
+ if (!silent) cout << e.getEClassName() << endl;
+ return 0;
+ }
+
+ try {
+ int64_t ll = dor->getLong(str);
+ }
+ catch (SDOPropertyNotSetException pe)
+ {
+ if (!silent) cout << "WRONG unset and undefaulted" << endl;
+ return 0;
+ }
+ catch (SDOInvalidConversionException ec)
+ {
+ if (!strcmp(str,"dataobject")) return 1;
+ return 0;
+
+ }
+ catch (SDORuntimeException e)
+ {
+ if (!silent) cout << e.getEClassName() << endl;
+ return 0;
+ }
+
+ try {
+ float f = dor->getFloat(str);
+ }
+ catch (SDOPropertyNotSetException pe)
+ {
+ if (!silent) cout << "WRONG unset and undefaulted" << endl;
+ return 0;
+ }
+ catch (SDOInvalidConversionException ec)
+ {
+ if (!strcmp(str,"dataobject")) return 1;
+ return 0;
+
+ }
+ catch (SDORuntimeException e)
+ {
+ if (!silent) cout << e.getEClassName() << endl;
+ return 0;
+ }
+
+ try {
+ long double d = dor->getDouble(str);
+ }
+ catch (SDOPropertyNotSetException pe)
+ {
+ if (!silent) cout << "WRONG unset and undefaulted" << endl;
+ return 0;
+ }
+ catch (SDOInvalidConversionException ec)
+ {
+ if (!strcmp(str,"dataobject")) return 1;
+ return 0;
+
+ }
+ catch (SDORuntimeException e)
+ {
+ if (!silent) cout << e.getEClassName() << endl;
+ return 0;
+ }
+
+ unsigned int len;
+
+ try {
+ len = dor->getLength(str);
+ }
+ catch (SDOPropertyNotSetException pe)
+ {
+ if (!silent)
+ {
+ cout << "WRONG unset and undefaulted" << endl;
+ }
+ cout << pe << endl;
+ return 0;
+ }
+ catch (SDOInvalidConversionException ec)
+ {
+ if (!strcmp(str,"dataobject"))
+ {
+ return 1;
+ }
+ return 0;
+
+ }
+ catch (SDORuntimeException e)
+ {
+ if (!silent) cout << e.getEClassName() << endl;
+ return 0;
+ }
+
+ if (len > 0) {
+ try {
+ wchar_t * buf = new wchar_t[len];
+ unsigned int gotlen = dor->getString(str,buf,len);
+ }
+ catch (SDOPropertyNotSetException pe)
+ {
+ if (!silent) cout << "WRONG unset and undefaulted" << endl;
+ return 0;
+ }
+ catch (SDOInvalidConversionException ec)
+ {
+ if (!strcmp(str,"dataobject")) return 1;
+ return 0;
+
+ }
+ catch (SDORuntimeException e)
+ {
+ if (!silent) cout << e.getEClassName() << endl;
+ return 0;
+ }
+ try {
+ char * cbuf = new char[len];
+ unsigned int gotlen = dor->getBytes(str,cbuf,len);
+ }
+ catch (SDOPropertyNotSetException pe)
+ {
+ if (!silent) cout << "WRONG unset and undefaulted" << endl;
+ return 0;
+ }
+ catch (SDOInvalidConversionException ec)
+ {
+ if (!strcmp(str,"dataobject")) return 1;
+ return 0;
+
+ }
+ catch (SDORuntimeException e)
+ {
+ if (!silent) cout << e.getEClassName() << endl;
+ return 0;
+ }
+ }
+
+ try {
+ SDODate t = dor->getDate(str);
+ }
+ catch (SDOPropertyNotSetException pe)
+ {
+ if (!silent) cout << " WRONG unset and undefaulted" << endl;
+ return 0;
+ }
+
+ // The following catch block returns to the caller, regardless of whether
+ // the getDate call succeeded or failed. This has the effect of aborting
+ // further tests in this method. Similar remarks apply to many of the catch
+ // blocks here. They should be cleaned up so that as many tests as possible
+ // are run, certainly when predecessors succeed and preferably even if they fail.
+ catch (SDOInvalidConversionException ec)
+ {
+ if (!strcmp(str,"bytes")) return 1;
+ if (!strcmp(str,"boolean")) return 1;
+ if (!strcmp(str,"string")) return 1;
+ if (!strcmp(str,"dataobject")) return 1;
+ return 0;
+
+ }
+ catch (SDORuntimeException e)
+ {
+ if (!silent) cout << e.getEClassName() << endl;
+ return 0;
+ }
+
+ try {
+ const char * string = dor->getCString(str);
+ }
+ catch (SDOPropertyNotSetException pe)
+ {
+ if (!silent) cout << "WRONG - unset and undefaulted" << endl;
+ return 0;
+ }
+ catch (SDOInvalidConversionException ec)
+ {
+ if (!strcmp(str,"dataobject")) return 1;
+ if (!strcmp(str,"date")) return 1;
+ return 0;
+
+ }
+ catch (SDORuntimeException e)
+ {
+ if (!silent) cout << e.getEClassName() << endl;
+ return 0;
+ }
+
+ try {
+ DataObjectPtr dob = dor->getDataObject(str);
+ }
+ catch (SDOPropertyNotSetException pe)
+ {
+ if (!silent) cout << "WRONG unset and undefaulted" << endl;
+ return 0;
+ }
+
+ catch (SDOInvalidConversionException ec)
+ {
+ if (!strcmp(str,"dataobject")) return 0;
+ return 1;
+
+ }
+ catch (SDORuntimeException e)
+ {
+ if (!silent) cout << e.getEClassName() << endl;
+ return 0;
+ }
+ return 1;
+
+}
+
+int sdotest::conversiontest()
+{
+
+ if (!silent)
+ {
+ cout << "Conversion tests" << endl;
+ }
+
+ DataFactoryPtr mdg = DataFactory::getDataFactory();
+ mdg->addType("myspace","Container");
+ mdg->addType("myspace","Contained");
+ mdg->addPropertyToType("myspace","Container","boolean","commonj.sdo","Boolean");
+ mdg->addPropertyToType("myspace","Container","byte","commonj.sdo","Byte");
+ mdg->addPropertyToType("myspace","Container","character","commonj.sdo","Character");
+ mdg->addPropertyToType("myspace","Container","short","commonj.sdo","Short");
+ mdg->addPropertyToType("myspace","Container","int","commonj.sdo","Int");
+ mdg->addPropertyToType("myspace","Container","long","commonj.sdo","Long");
+ mdg->addPropertyToType("myspace","Container","float","commonj.sdo","Float");
+ mdg->addPropertyToType("myspace","Container","double","commonj.sdo","Double");
+ mdg->addPropertyToType("myspace","Container","string","commonj.sdo","String");
+ mdg->addPropertyToType("myspace","Container","bytes","commonj.sdo","Bytes");
+ mdg->addPropertyToType("myspace","Container","dataobject","myspace","Contained");
+ mdg->addPropertyToType("myspace","Container","date","commonj.sdo","Date");
+ mdg->addPropertyToType("myspace","Container","bigint","commonj.sdo","BigInteger");
+ mdg->addPropertyToType("myspace","Container","bigdec","commonj.sdo","BigDecimal");
+
+ const Type& tcc = mdg->getType("myspace","Container");
+ DataObjectPtr dor = mdg->create((Type&)tcc);
+
+ if (!silent)
+ {
+ cout << "+++++++++++++++PROPERTY VALUES UNSET ++++++++++++++++++" << endl;
+ }
+
+ if (!testGetters(dor))
+ {
+ return 0;
+ }
+
+ if (!silent)
+ {
+ cout << "+++++++++++++++PROPERTY VALUES SET ++++++++++++++++++++" << endl;
+ }
+
+ // RHEL 4 has problems processing 64 bit integer constants, so we'll do it
+ // the hard way. This is overkill but gives the option to vary the value a
+ // bit.
+
+ int64_t largeInt = 0xFFFF;
+ for (int j = 0; j < 2; j++)
+ {
+ largeInt <<= 16;
+ largeInt += 0xFFFF;
+ }
+
+ DataObjectPtr sub = dor->createDataObject("dataobject");
+ dor->setBoolean("boolean", true);
+ dor->setByte("byte",20);
+ dor->setCharacter("character", 1000);
+ dor->setShort("short", (short)12345678);
+ dor->setInt("int", 87654321);
+ dor->setLong("long", largeInt);
+ dor->setFloat("float", (float)12345.678);
+ dor->setDouble("double", 1234567.891);
+ dor->setDate("date", 37575);
+ wchar_t* chars = new wchar_t[50];
+ for (int i=0;i<50;i++) {chars[i] = 0x7F20 + i ;}
+ dor->setString("string",chars, 50);
+
+ char* tchars = new char[50];
+ for (int ii=0;ii<50;ii++) {tchars[ii] = ii + 32;}
+ dor->setBytes("bytes",tchars, 50);
+
+ if (!testGetters(dor))
+ {
+ return 0;
+ }
+
+ if (!silent)
+ {
+ cout << "+++++++++++++++END OF TEST ++++++++++++++++++++++++++++" << endl;
+ }
+
+ return 1;
+}
+
+
+int sdotest::usertest()
+{
+ try {
+ DataFactoryPtr mdg = DataFactory::getDataFactory();
+
+ mdg->addType("myspace","Root");
+ mdg->addType("myspace","UserTest");
+ mdg->addType("myspace","AnObject");
+
+ const Type& tr = mdg->getType("myspace", "Root");
+ const Type& tm = mdg->getType("myspace", "UserTest");
+ const Type& to = mdg->getType("myspace", "AnObject");
+
+ mdg->addPropertyToType(tm,"boolean", "commonj.sdo","Boolean");
+ mdg->addPropertyToType(tm,"unsetboolean", "commonj.sdo","Boolean");
+ mdg->addPropertyToType(tm,"object", "myspace","AnObject");
+ mdg->addPropertyToType(tm,"unsetobject","myspace","AnObject");
+
+ // many valued...
+ mdg->addPropertyToType(tm,"longs", "commonj.sdo","Int", true);
+ mdg->addPropertyToType(tm,"objects", "myspace","AnObject", true);
+
+ mdg->addPropertyToType(tr,"usertest", "myspace","UserTest");
+
+ DataObjectImplPtr root = staticCast<DataObjectImplPtr>(mdg->create((Type&)tr));
+ DataObjectImplPtr test = staticCast<DataObjectImplPtr>(root->createDataObject("usertest"));
+ DataObjectImplPtr do1 = staticCast<DataObjectImplPtr>(test->createDataObject("object"));
+ DataObjectImplPtr do2 = staticCast<DataObjectImplPtr>(test->createDataObject("objects"));
+ DataObjectImplPtr do3 = staticCast<DataObjectImplPtr>(test->createDataObject("objects"));
+
+ test->setBoolean("boolean", true);
+
+
+ void* value = (void*)0xF1F1F1F1;
+
+ test->setUserData(value);
+
+ if (test->getUserData() != (void*)0xf1f1f1f1) return 0;
+
+ root->setUserData("usertest",value);
+
+ if (root->getUserData("usertest") != (void*)0xf1f1f1f1) return 0;
+
+ root->setUserData((unsigned int)0,(void*)0x20);
+
+ if (root->getUserData((unsigned int)0) != (void*)0x20) return 0;
+
+ const Property& prop = root->getType().getProperty("usertest");
+
+ root->setUserData(prop,(void*)0x40020);
+
+ if (root->getUserData(prop) != (void*)0x40020) return 0;;
+
+ test->setUserData("boolean", (void*)0x120);
+
+
+ if (test->getUserData("boolean") != (void*)0) return 0;
+
+ test->setUserData("unsetboolean", (void*)0x340);
+
+ if (test->getUserData("unsetboolean") != (void*)0) return 0;
+
+ test->setUserData("object", (void*)0x120);
+
+ if (test->getUserData("object") != (void*)0x120) return 0;
+
+ test->setUserData("unsetobject", (void*)0x540);
+
+ if (test->getUserData("unsetobject") != (void*)0) return 0;
+
+ test->setUserData("objects.0", (void*)0x640);
+
+ if (test->getUserData("objects.0") != (void*)0x640) return 0;
+
+ test->setUserData("objects[1]", (void*)0x740);
+
+ if (test->getUserData("objects[1]") != (void*)0x740) return 0;
+
+ return 1;
+
+ }
+ catch (SDORuntimeException e)
+ {
+ if (!silent) cout << "Exception in user test - unexpected" << endl;
+ return 0;
+ }
+}
+
+int sdotest::versiontest()
+{
+ if (!silent) cout << "The SDO version is :" << SdoRuntime::getVersion() << endl;
+ if (!silent) cout << "The Major version is: " << SdoRuntime::getMajor() << endl;
+ if (!silent) cout << "The Minor version is: " << SdoRuntime::getMinor() << endl;
+ if (!silent) cout << "The Fix level is: " << SdoRuntime::getFix() << endl;
+ return 1;
+}
+
+int sdotest::noncontest()
+{
+
+ try {
+ DataFactoryPtr mdg = DataFactory::getDataFactory();
+
+ mdg->addType("myspace","Company");
+ mdg->addType("myspace","Department");
+ mdg->addType("myspace","Employee");
+
+ const Type& tr = mdg->getType("myspace", "Company");
+ const Type& tm = mdg->getType("myspace", "Department");
+ const Type& to = mdg->getType("myspace", "Employee");
+
+ // many...
+ mdg->addPropertyToType(tr,"departments","myspace", "Department",
+ true);
+
+ //mdg->addPropertyToType(to,"name","commonj.sdo", "String");
+
+ mdg->addPropertyToType(tm,"employees","myspace", "Employee", true);
+
+ // single, non containment
+ mdg->addPropertyToType(tr,"eom", "myspace","Employee", false
+ , false, false);
+
+ DataObjectPtr comp = mdg->create((Type&)tr);
+
+ {
+ DataObjectPtr dept = comp->createDataObject("departments");
+ DataObjectPtr emp1 = dept->createDataObject("employees");
+ //emp1->setCString("name", "Will");
+ DataObjectPtr emp2 = dept->createDataObject("employees");
+ //emp1->setCString("name", "Bill");
+ DataObjectPtr emp3 = dept->createDataObject("employees");
+ //emp1->setCString("name", "Gill");
+ comp->setDataObject("eom", emp3);
+ }
+ return 1;
+ }
+ catch (SDORuntimeException e)
+ {
+ if (!silent) cout << "Failed in containment" << e << endl;
+ return 0;
+ }
+}
+
+
+int sdotest::defaulttest()
+{
+ try{
+
+ DataFactoryPtr mdg = DataFactory::getDataFactory();
+
+ mdg->addType("myspace","DefaultTest");
+ mdg->addType("myspace","AnObject");
+
+ const Type& tm = mdg->getType("myspace", "DefaultTest");
+ const Type& to = mdg->getType("myspace", "AnObject");
+
+ mdg->addPropertyToType(tm,"boolean", "commonj.sdo","Boolean");
+
+ mdg->setDefault("myspace","DefaultTest","boolean", true);
+
+ mdg->addPropertyToType(tm,"byte", "commonj.sdo","Byte");
+
+ mdg->setDefault("myspace","DefaultTest","byte", (char)'d');
+
+ mdg->addPropertyToType(tm,"character", "commonj.sdo","Character");
+
+ mdg->setDefault("myspace","DefaultTest","character", (wchar_t)'e');
+
+ mdg->addPropertyToType(tm,"short", "commonj.sdo","Short");
+
+ mdg->setDefault("myspace","DefaultTest","short", (short)300);
+
+ mdg->addPropertyToType(tm,"long", "commonj.sdo","Int");
+
+ mdg->setDefault("myspace","DefaultTest","long", (long)400);
+
+ mdg->addPropertyToType(tm,"longs", "commonj.sdo","Int", true);
+
+ mdg->setDefault("myspace","DefaultTest","longs", (long)800);
+
+ mdg->addPropertyToType(tm,"longlong", "commonj.sdo","Long");
+
+ mdg->setDefault("myspace","DefaultTest","longlong", (int64_t)500);
+
+ mdg->addPropertyToType(tm,"float", "commonj.sdo","Float");
+
+ mdg->setDefault("myspace","DefaultTest","float", (float)600.0);
+
+ mdg->addPropertyToType(tm,"longdouble", "commonj.sdo","Double");
+
+ mdg->setDefault("myspace","DefaultTest","longdouble", (long double)700.0);
+
+ mdg->addPropertyToType(tm,"date", "commonj.sdo","Date");
+
+ mdg->setDefault("myspace","DefaultTest","date", (long)900);
+
+ mdg->addPropertyToType(tm,"string", "commonj.sdo","String");
+
+ wchar_t* help = new wchar_t[4];
+ help[0] = 'H';
+ help[1] = 'E';
+ help[2] = 'L';
+ help[3] = 'P';
+
+ mdg->setDefault("myspace","DefaultTest","string", help, 4);
+
+ delete[] help;
+
+ char* help2 = new char[4];
+ help2[0] = 'H';
+ help2[1] = 'E';
+ help2[2] = 'L';
+ help2[3] = 'P';
+
+ mdg->addPropertyToType(tm,"bytes", "commonj.sdo","Bytes");
+
+ mdg->setDefault("myspace","DefaultTest","bytes", help2, 4);
+
+ delete[] help2;
+
+ mdg->addPropertyToType(tm,"object", "myspace","AnObject");
+
+ DataObjectPtr test = mdg->create((Type&)tm);
+
+ FILE *f = fopen("defaults.dat","w+");
+ if (f == 0)
+ {
+ if (!silent) cout << "Unable to open file defaults.dat" << endl;
+ return 0;
+ }
+
+
+ fprintf(f, "Boolean default is true: %d\n",test->getBoolean("boolean"));
+
+ fprintf(f, "Byte default is d: %d\n",test->getByte("byte"));
+
+ fprintf(f, "Character default is e: %d\n",test->getCharacter("character"));
+
+ fprintf(f, "Short default is 300: %d\n",test->getShort("short"));
+
+ fprintf(f, "Long default is 400: %d\n",test->getInt("long"));
+
+ try {
+ fprintf(f, "Longs default is 800: %d\n" ,test->getInt("longs[1]"));
+ }
+ catch (SDOIndexOutOfRangeException ex)
+ {
+ fprintf(f,"Expected index out of range OK\n");
+ }
+
+ fprintf(f,"Float default is 600: %.3f\n",test->getFloat("float"));
+
+ fprintf(f, "LongDouble default is 700: %.3f\n",(float)test->getDouble("longdouble"));
+
+ fprintf(f, "String default is HELP: ");
+ unsigned int lenw = test->getLength("string");
+ if (lenw > 0) {
+ char* tw = new char[lenw];
+ test->getBytes("string",tw,lenw);
+ for (unsigned int i=0;i<lenw;i++)
+ {
+ fprintf(f,"%c",tw[i]);
+ }
+ fprintf(f,"\n");
+ }
+
+ fprintf(f,"Bytes default is HELP: ");
+ unsigned int len = test->getLength("bytes");
+ if (len > 0) {
+ char* tc = new char[len];
+ test->getBytes("bytes",tc,len);
+ for (unsigned int i=0;i<len;i++)
+ {
+ fprintf(f,"%c", tc[i]);
+ }
+ fprintf(f,"\n");
+ }
+ fclose (f);
+ return comparefiles("defaults.dat","defaults.txt");
+
+ }
+ catch (SDORuntimeException e)
+ {
+ if (!silent)cout << e.getEClassName() << " in ";
+ if (!silent)cout << e.getFileName() << " at line ";
+ if (!silent)cout << e.getLineNumber() << endl;
+ if (!silent)cout << e.getFunctionName() << " ";
+ if (!silent)cout << e.getMessageText() << endl;
+ return 0;
+ }
+}
+
+// Re-write of defaulttest to use methods taking SDOString parameters
+int sdotest::defaulttest_strobj()
+{
+
+ SDOString ns1("myspace");
+ SDOString testName("DefaultTest");
+ SDOString objectName("AnObject");
+ SDOString propName("commonj.sdo");
+
+ try{
+
+ DataFactoryPtr mdg = DataFactory::getDataFactory();
+
+ mdg->addType(ns1, testName);
+ mdg->addType(ns1, objectName);
+
+ const Type& tm = mdg->getType(ns1, testName);
+ const Type& to = mdg->getType(ns1, objectName);
+
+ mdg->addPropertyToType(tm, "boolean", propName, "Boolean");
+
+ mdg->setDefault(ns1, testName, "boolean", true);
+
+ mdg->addPropertyToType(tm, "byte", propName, "Byte");
+
+ mdg->setDefault(ns1, testName, "byte", (char)'d');
+
+ mdg->addPropertyToType(tm, "character", propName, "Character");
+
+ mdg->setDefault(ns1, testName, "character", (wchar_t)'e');
+
+ mdg->addPropertyToType(tm, "short", propName, "Short");
+
+ mdg->setDefault(ns1, testName, "short", (short)300);
+
+ mdg->addPropertyToType(tm, "long", propName, "Int");
+
+ mdg->setDefault(ns1, testName, "long", (long)400);
+
+ mdg->addPropertyToType(tm, "longs", propName, "Int", true);
+
+ mdg->setDefault(ns1, testName, "longs", (long)800);
+
+ mdg->addPropertyToType(tm, "longlong", propName, "Long");
+
+ mdg->setDefault(ns1, testName, "longlong", (int64_t)500);
+
+ mdg->addPropertyToType(tm, "float", propName, "Float");
+
+ mdg->setDefault(ns1, testName, "float", (float)600.0);
+
+ mdg->addPropertyToType(tm, "longdouble", propName, "Double");
+
+ mdg->setDefault(ns1, testName, "longdouble", (long double)700.0);
+
+ mdg->addPropertyToType(tm, "date", propName, "Date");
+
+ mdg->setDefault(ns1, testName, "date", (long)900);
+
+ mdg->addPropertyToType(tm, "string", propName, "String");
+
+ wchar_t* help = new wchar_t[4];
+ help[0] = 'H';
+ help[1] = 'E';
+ help[2] = 'L';
+ help[3] = 'P';
+
+ mdg->setDefault(ns1, testName, "string", help, 4);
+
+ delete[] help;
+
+ char* help2 = new char[4];
+ help2[0] = 'H';
+ help2[1] = 'E';
+ help2[2] = 'L';
+ help2[3] = 'P';
+
+ mdg->addPropertyToType(tm, "bytes", propName, "Bytes");
+
+ mdg->setDefault(ns1, testName, "bytes", help2, 4);
+
+ delete[] help2;
+
+ mdg->addPropertyToType(tm, "object", ns1, objectName);
+
+ DataObjectPtr test = mdg->create((Type&)tm);
+
+ FILE *f = fopen("defaults.dat","w+");
+ if (f == 0)
+ {
+ if (!silent) cout << "Unable to open file defaults.dat" << endl;
+ return 0;
+ }
+
+
+ fprintf(f, "Boolean default is true: %d\n",test->getBoolean("boolean"));
+
+ fprintf(f, "Byte default is d: %d\n",test->getByte("byte"));
+
+ fprintf(f, "Character default is e: %d\n",test->getCharacter("character"));
+
+ fprintf(f, "Short default is 300: %d\n",test->getShort("short"));
+
+ fprintf(f, "Long default is 400: %d\n",test->getInt("long"));
+
+ try {
+ fprintf(f, "Longs default is 800: %d\n" ,test->getInt("longs[1]"));
+ }
+ catch (SDOIndexOutOfRangeException ex)
+ {
+ fprintf(f,"Expected index out of range OK\n");
+ }
+
+ fprintf(f,"Float default is 600: %.3f\n",test->getFloat("float"));
+
+ fprintf(f, "LongDouble default is 700: %.3f\n",(float)test->getDouble("longdouble"));
+
+ fprintf(f, "String default is HELP: ");
+ unsigned int lenw = test->getLength("string");
+ if (lenw > 0) {
+ char* tw = new char[lenw];
+ test->getBytes("string",tw,lenw);
+ for (unsigned int i=0;i<lenw;i++)
+ {
+ fprintf(f,"%c",tw[i]);
+ }
+ fprintf(f,"\n");
+ }
+
+ fprintf(f,"Bytes default is HELP: ");
+ unsigned int len = test->getLength("bytes");
+ if (len > 0) {
+ char* tc = new char[len];
+ test->getBytes("bytes",tc,len);
+ for (unsigned int i=0;i<len;i++)
+ {
+ fprintf(f,"%c", tc[i]);
+ }
+ fprintf(f,"\n");
+ }
+ fclose (f);
+ return comparefiles("defaults.dat","defaults.txt");
+
+ }
+ catch (SDORuntimeException e)
+ {
+ if (!silent)cout << e.getEClassName() << " in ";
+ if (!silent)cout << e.getFileName() << " at line ";
+ if (!silent)cout << e.getLineNumber() << endl;
+ if (!silent)cout << e.getFunctionName() << " ";
+ if (!silent)cout << e.getMessageText() << endl;
+ return 0;
+ }
+}
+
+
+int sdotest::showdefault(FILE *f, const Type& tm)
+{
+ const Property& pboolean = tm.getProperty("boolean");
+ const Property& pbyte = tm.getProperty("byte");
+ const Property& pcharacter = tm.getProperty("character");
+ const Property& pshort = tm.getProperty("short");
+ const Property& plong = tm.getProperty("long");
+ const Property& plongs = tm.getProperty("longs");
+ const Property& plonglong = tm.getProperty("longlong");
+ const Property& pfloat = tm.getProperty("float");
+ const Property& plongdouble = tm.getProperty("longdouble");
+ const Property& pdate = tm.getProperty("date");
+ const Property& pstring = tm.getProperty("string");
+ const Property& pbytes = tm.getProperty("bytes");
+ const Property& pobject = tm.getProperty("object");
+
+ // first see what we get for the default when there is none
+
+ bool bb = pboolean.getBooleanDefault();
+ const char* bs = pboolean.getCStringDefault();
+
+ fprintf(f, "Boolean default is : %d\n",bb);
+ fprintf(f, "Boolean default as a string is %s\n",bs);
+
+ char cc = pbyte.getByteDefault();
+ const char* cs = pbyte.getCStringDefault();
+ fprintf(f, "Byte default is : %d\n",cc);
+ fprintf(f, "Byte default as a string is %s\n",cs);
+
+ wchar_t wc = pcharacter.getCharacterDefault();
+ const char* ws = pcharacter.getCStringDefault();
+ fprintf(f, "Character default is : %d\n",wc);
+ fprintf(f, "Character default as a string is %s\n",ws);
+
+ short ss = pshort.getShortDefault();
+ fprintf(f, "Short default is : %d\n",ss);
+
+ long ll = plong.getIntDefault();
+ fprintf(f, "Int default is : %d\n",ll);
+ long ll2 = plongs.getLongDefault();
+ fprintf(f, "Int many default is : %d\n",ll2);
+
+ int64_t llll = plonglong.getLongDefault();
+ fprintf(f, "Long default is : %ld\n",(long)llll);
+
+ float ff = pfloat.getFloatDefault();
+ fprintf(f, "Float default is : %.3f\n",ff);
+
+ long double dd = plongdouble.getDoubleDefault();
+ fprintf(f, "Double default is : %.3f\n",(float)dd);
+
+ const SDODate& sd = pdate.getDateDefault();
+ fprintf(f, "Date default is : %d\n",sd.getTime());
+
+ unsigned int l = pstring.getDefaultLength();
+ if (l > 0)
+ {
+ wchar_t * buf = new wchar_t[l+1];
+ l = pstring.getStringDefault(buf,l);
+ fprintf(f, "String default length is %d\n", l);
+ for (unsigned int i=0;i<l;i++)
+ {
+ fprintf(f, "%c",buf[i]);
+ }
+ fprintf(f, "\n");
+ delete[] buf;
+ const char* wws = pstring.getCStringDefault();
+ fprintf(f, "String default as a string is %s\n", wws);
+
+ }
+ else
+ {
+ fprintf(f, "String default is zero length\n");
+ }
+
+ l = pbytes.getDefaultLength();
+ if (l > 0)
+ {
+ char * buf = new char[l+1];
+ l = pbytes.getBytesDefault(buf,l);
+ fprintf(f, "Bytes default length is %d\n",l);
+ for (unsigned int i=0;i<l;i++)
+ {
+ fprintf(f, "%c", buf[i]);
+ }
+ fprintf(f, "\n");
+ delete[] buf;
+ }
+ else
+ {
+ fprintf(f, "Bytes default is zero length\n");
+ }
+ return 1;
+}
+
+
+int sdotest::propdefaulttest()
+{
+ try{
+
+ DataFactoryPtr mdg = DataFactory::getDataFactory();
+
+ mdg->addType("myspace","DefaultTest");
+ mdg->addType("myspace","AnObject");
+
+ const Type& tm = mdg->getType("myspace", "DefaultTest");
+ const Type& to = mdg->getType("myspace", "AnObject");
+
+ mdg->addPropertyToType(tm,"boolean", "commonj.sdo","Boolean");
+ mdg->addPropertyToType(tm,"byte", "commonj.sdo","Byte");
+ mdg->addPropertyToType(tm,"character", "commonj.sdo","Character");
+ mdg->addPropertyToType(tm,"short", "commonj.sdo","Short");
+ mdg->addPropertyToType(tm,"long", "commonj.sdo","Int");
+ mdg->addPropertyToType(tm,"longs", "commonj.sdo","Int", true);
+ mdg->addPropertyToType(tm,"longlong", "commonj.sdo","Long");
+ mdg->addPropertyToType(tm,"float", "commonj.sdo","Float");
+ mdg->addPropertyToType(tm,"longdouble", "commonj.sdo","Double");
+ mdg->addPropertyToType(tm,"date", "commonj.sdo","Date");
+ mdg->addPropertyToType(tm,"string", "commonj.sdo","String");
+ mdg->addPropertyToType(tm,"bytes", "commonj.sdo","Bytes");
+ mdg->addPropertyToType(tm,"object" , "myspace","AnObject");
+
+ //cout << "Testing unset defaults....." << endl;
+
+ FILE *f;
+
+ f = fopen("showdefault1.dat","w+");
+ if (f == 0)
+ {
+ if (!silent)cout << "Unable to open showdefault1.dat" << endl;
+ return 0;
+ }
+ showdefault(f, tm);
+
+ fclose (f);
+ if (!comparefiles("showdefault1.dat","showdefault1.txt"))
+ {
+ return 0;
+ }
+
+ //now set all the defaults....
+
+ mdg->setDefault("myspace","DefaultTest","boolean", true);
+ mdg->setDefault("myspace","DefaultTest","byte", (char)'d');
+ mdg->setDefault("myspace","DefaultTest","character", (wchar_t)'e');
+ mdg->setDefault("myspace","DefaultTest","short", (short)300);
+ mdg->setDefault("myspace","DefaultTest","long", (long)400);
+ mdg->setDefault("myspace","DefaultTest","longs", (long)800);
+ mdg->setDefault("myspace","DefaultTest","longlong", (int64_t)500);
+ mdg->setDefault("myspace","DefaultTest","float", (float)600.0);
+ mdg->setDefault("myspace","DefaultTest","longdouble", (long double)700.0);
+ mdg->setDefault("myspace","DefaultTest","date", (long)900);
+
+
+ wchar_t* help = new wchar_t[4];
+ help[0] = 'H';
+ help[1] = 'E';
+ help[2] = 'L';
+ help[3] = 'P';
+
+ mdg->setDefault("myspace","DefaultTest","string", help, 4);
+
+ delete[] help;
+
+ char* help2 = new char[4];
+ help2[0] = 'H';
+ help2[1] = 'E';
+ help2[2] = 'L';
+ help2[3] = 'P';
+
+
+ mdg->setDefault("myspace","DefaultTest","bytes", help2, 4);
+
+ delete[] help2;
+
+ // and have another go at getting them....
+
+ f = fopen("showdefault2.dat","w+");
+ if (f == 0)
+ {
+ if (!silent)cout << "Unable to open showdefault2.dat" << endl;
+ return 0;
+ }
+ showdefault(f, tm);
+
+ fclose (f);
+ if (!comparefiles("showdefault2.dat","showdefault2.txt"))
+ {
+ return 0;
+ }
+
+ return 1;
+ }
+ catch (SDORuntimeException e)
+ {
+ if (!silent)cout << e.getEClassName() << " in ";
+ if (!silent)cout << e.getFileName() << " at line ";
+ if (!silent)cout << e.getLineNumber() << endl;
+ if (!silent)cout << e.getFunctionName() << " ";
+ if (!silent)cout << e.getMessageText() << endl;
+ return 0;
+ }
+
+}
+
+int sdotest::nulltest()
+{
+
+ FILE *f = 0;
+
+ try {
+
+ unsigned int i;
+ DataFactoryPtr mdg = DataFactory::getDataFactory();
+
+ mdg->addType("myspace","NullTest",true, false); // sequenced
+ mdg->addType("myspace","AnObject");
+
+ try
+ {
+ mdg->addType("myspace", 0);
+ if (!silent) cout << "WRONG - SDOIllegalArgumentException should have been thrown for null Type name" << endl;
+ return 0;
+ }
+ catch (SDOIllegalArgumentException e)
+ {}
+
+ const Type& tm = mdg->getType("myspace", "NullTest");
+ const Type& to = mdg->getType("myspace", "AnObject");
+
+ mdg->addPropertyToType(tm,"boolean", "commonj.sdo","Boolean");
+ mdg->addPropertyToType(tm,"byte", "commonj.sdo","Byte");
+ mdg->addPropertyToType(tm,"character", "commonj.sdo","Character");
+ mdg->addPropertyToType(tm,"short", "commonj.sdo","Short");
+ mdg->addPropertyToType(tm,"long", "commonj.sdo","Int");
+ mdg->addPropertyToType(tm,"longlong", "commonj.sdo","Long");
+ mdg->addPropertyToType(tm,"float", "commonj.sdo","Float");
+ mdg->addPropertyToType(tm,"longdouble", "commonj.sdo","Double");
+ mdg->addPropertyToType(tm,"date", "commonj.sdo","Date");
+ mdg->addPropertyToType(tm,"string", "commonj.sdo","String");
+ mdg->addPropertyToType(tm,"bytes", "commonj.sdo","Bytes");
+ mdg->addPropertyToType(tm,"object", "myspace","AnObject");
+
+ try
+ {
+ mdg->addPropertyToType(tm, 0, "myspace", "AnObject");
+ if (!silent) cout << "WRONG - SDOIllegalArgumentException should have been thrown for null Property name" << endl;
+ return 0;
+ }
+ catch (SDOIllegalArgumentException e)
+ {}
+
+
+ mdg->addPropertyToType(tm,"cs", "commonj.sdo","ChangeSummary");
+
+ DataObjectPtr test = mdg->create((Type&)tm);
+ DataObjectPtr ob = mdg->create((Type&)to);
+ DataObjectPtr ob2 = mdg->create((Type&)to);
+ DataObjectPtr ob3 = mdg->create((Type&)to);
+
+
+ f = fopen("nulltest.dat","w+");
+ if (f == 0)
+ {
+ if (!silent)cout << "Unable to open file nulltest.dat" << endl;
+ return 0;
+ }
+
+ // first check all props are unset
+
+ ChangeSummaryPtr cs = test->getChangeSummary();
+
+ cs->beginLogging();
+
+ PropertyList pl = test->getInstanceProperties();
+
+ fprintf(f, "Initially - all properties unset, and default values...\n");
+ for (i=0;i<pl.size(); i++)
+ {
+ if (pl[i].isMany())continue;
+ try {
+ if (pl[i].getType().isDataType()) {
+ fprintf(f, "%s set:%d value ",pl[i].getName(),test->isSet(pl[i]));
+ const char *xx = test->getCString(pl[i]);
+ if (xx != 0)
+ {
+ fprintf(f, "%s\n",xx);
+ }
+ else
+ {
+ fprintf(f, " is empty \n");
+ }
+ }
+ else {
+ fprintf(f,"%s set: %d value:", pl[i].getName(),test->isSet(pl[i]));
+ DataObjectPtr xy = test->getDataObject(pl[i]);
+ if (xy != 0)
+ {
+ fprintf(f, " is not empty\n");
+ }
+ else
+ {
+ fprintf(f, " is empty \n");
+ }
+ }
+ }
+ catch (SDOPropertyNotSetException)
+ {
+ if (!silent) cout << " WRONG - got not set exception" << endl;
+ return 0;
+ }
+ }
+ test->setBoolean("boolean", false);
+ test->setByte("byte",0);
+ test->setCharacter("character",0);
+ test->setShort("short",0);
+ test->setInt("long",0);
+ test->setLong("longlong",0 );
+ test->setFloat("float",0);
+ test->setDouble("longdouble",0 );
+ test->setDate("date",0 );
+ test->setString("string",0,0);
+ test->setBytes("bytes","",0) ;
+ test->setDataObject("object",0) ;
+
+
+
+ fprintf(f, "Should now have all properties set, and zero values...\n");
+ for (i=0;i<pl.size(); i++)
+ {
+ if (pl[i].isMany())continue;
+ if (pl[i].getType().isDataType()) {
+ fprintf(f, "%s set:%d value:%s\n", pl[i].getName(),test->isSet(pl[i]),test->getCString(pl[i]));
+ }
+ else {
+ fprintf(f,"%s set:%d dataobject\n", pl[i].getName(),test->isSet(pl[i]));
+ }
+
+ }
+
+ for (i=0;i<pl.size(); i++)
+ {
+ test->unset(pl[i]);
+ }
+ fprintf(f, "Should be back to having properties unset, and default values...\n");
+ for (i=0;i<pl.size(); i++)
+ {
+
+ try {
+ if (pl[i].isMany())continue;
+ if (pl[i].getType().isDataType()) {
+ fprintf(f, "%s set:%d value:",pl[i].getName(),test->isSet(pl[i]));
+ const char *xx = test->getCString(pl[i]);
+ if (xx != 0)
+ {
+ fprintf(f, "%s\n", xx);
+ }
+ else
+ {
+ fprintf(f, " is empty \n");
+ }
+ }
+ else {
+ fprintf(f, "%s set: %d dataobject", pl[i].getName(),test->isSet(pl[i]));
+ DataObjectPtr dp = test->getDataObject(pl[i]);
+ if (dp != 0)
+ {
+ fprintf(f, " is not empty\n");
+ }
+ else
+ {
+ fprintf(f, " is empty \n");
+ }
+ }
+ }
+ catch (SDOPropertyNotSetException)
+ {
+ if (!silent) cout << "WRONG - not set exception" << endl;
+ return 0;
+ }
+ }
+
+ SequencePtr s = test->getSequence();
+
+ s->addBoolean(test->getType().getProperty("boolean")/*"boolean"*/, false);
+ s->addByte(1/*"byte"*/,0);
+ s->addCharacter(2/*"character"*/,0);
+ s->addShort(3/*"short"*/,0);
+ s->addInt(4/*"long"*/,0);
+ s->addLong(5/*"longlong"*/,0 );
+ s->addFloat(6/*"float"*/,0);
+ s->addDouble(7/*"longdouble"*/,0 );
+ // bug ...s->setDate(8/*"date"*/,0 );
+ s->addString(9/*"string"*/,0,0);
+ s->addBytes(10/*"bytes"*/,"",0) ;
+ s->addDataObject(11/*"object"*/,0) ;
+
+ for (i=0;i<pl.size(); i++)
+ {
+ try {
+ if (pl[i].isMany())continue;
+ if (pl[i].getType().isDataType()) {
+ fprintf(f, "%s set:%d value:", pl[i].getName(),test->isSet(pl[i]));
+ const char* xx = test->getCString(pl[i]);
+ if ( xx != 0)
+ {
+ fprintf(f, "%s\n", xx);
+ }
+ else
+ {
+ fprintf(f, " is empty \n");
+ }
+ }
+ else {
+ fprintf(f, "%s set:%d dataobject", pl[i].getName(),test->isSet(pl[i]));
+ DataObjectPtr db = test->getDataObject(pl[i]);
+ if (db != 0)
+ {
+ fprintf(f, "\n");
+ }
+ else
+ {
+ fprintf(f, " is empty \n");
+ }
+ }
+ }
+ catch (SDOPropertyNotSetException)
+ {
+ if (!silent) cout << "WRONG - not set exception " << endl;
+ return 0;
+ }
+ }
+ ChangedDataObjectList& cl = cs->getChangedDataObjects();
+ for ( i =0; i< cl.size() ; i++)
+ {
+ if (cs->isCreated(cl[i])) {
+ fprintf(f, "Created dataobject\n");
+ }
+ if (cs->isDeleted(cl[i])) {
+ fprintf(f, "Deleted dataobject\n");
+ }
+ if (cs->isModified(cl[i])) {
+ fprintf(f, "Modified dataobject\n");
+ }
+ }
+
+ // now unset all the properties...
+ for (i=0;i<pl.size(); i++)
+ {
+ test->unset(pl[i]);
+ }
+
+ for (i=0;i<pl.size(); i++)
+ {
+ if (!pl[i].isMany() )
+ {
+ test->setNull(i);
+ }
+ }
+
+ fprintf(f, "Should all be null, and default values...\n");
+ for (i=0;i<pl.size(); i++)
+ {
+ if (pl[i].isMany())continue;
+ if (pl[i].getType().isDataType()) {
+ // check for a null first!!
+ fprintf(f, "%s isNull:%d set:%d value:",pl[i].getName(),
+ test->isNull(i),test->isSet(pl[i]));
+ if (test->getCString(pl[i]) == 0) fprintf(f, "\n");
+ else fprintf(f, "%s\n", test->getCString(pl[i]));
+ }
+ else {
+ fprintf(f, "%s isNull:%d set:%d value",pl[i].getName(),
+ test->isNull(i),test->isSet(pl[i]));
+ if (test->getDataObject(pl[i]) == 0) fprintf(f, " empty\n");
+ else fprintf(f, " dataobject\n");
+ }
+ }
+
+ s->addBoolean(test->getType().getProperty("boolean")/*"boolean"*/, true);
+ s->addByte(1/*"byte"*/,1);
+ s->addCharacter(2/*"character"*/,1);
+ s->addShort(3/*"short"*/,1);
+ s->addInt(4/*"long"*/,1);
+ s->addLong(5/*"longlong"*/,1 );
+ s->addFloat(6/*"float"*/,1.0);
+ s->addDouble(7/*"longdouble"*/,1.0 );
+ // bug ...s->setDate(8/*"date"*/,0 );
+ wchar_t* chs = new wchar_t[5];
+ chs[0] = 'h';
+ chs[1] = 'e';
+ chs[2] = 'l';
+ chs[3] = 'l';
+ chs[4] = 'o';
+ s->addString(9/*"string"*/,chs,5);
+ delete[] chs;
+ s->addBytes(10/*"bytes"*/,"hello",5) ;
+ s->addDataObject(11/*"object"*/,ob) ;
+
+ fprintf(f, "Should all have values, and not be null..\n");
+ for (i=0;i<pl.size(); i++)
+ {
+
+ if (pl[i].isMany())continue;
+ if (pl[i].getType().isDataType()) {
+ fprintf(f, "%s isNull:%d set:%d value:",pl[i].getName(),
+ test->isNull(i),test->isSet(pl[i]));
+ if (test->getCString(pl[i]) == 0) fprintf(f, "\n");
+ else fprintf(f, "%s\n", test->getCString(pl[i]));
+
+ }
+ else {
+ fprintf(f, "%s isNull%d set:%d value:", pl[i].getName(),
+ test->isNull(i),test->isSet(pl[i]));
+ if (test->getDataObject(pl[i]) == 0) fprintf(f, " empty\n");
+ else fprintf(f, " dataobject\n");
+ }
+ }
+
+ for (i=0;i<pl.size(); i++)
+ {
+ if (!pl[i].isMany() )
+ {
+ test->setNull(pl[i]);
+ }
+ }
+
+ fprintf(f, "Should all be null, and default values...\n");
+ for (i=0;i<pl.size(); i++)
+ {
+
+ try {
+ if (pl[i].isMany())continue;
+ if (pl[i].getType().isDataType()) {
+ fprintf(f, "%s isNull:%d set:%d value:",pl[i].getName(),
+ test->isNull(i),test->isSet(pl[i]));
+ if (test->getCString(pl[i]) == 0) fprintf(f, "\n");
+ else fprintf(f, "%s\n",test->getCString(pl[i]));
+
+ }
+ else {
+ fprintf(f, "%s isNull;%d set:%d value:", pl[i].getName(),
+ test->isNull(i),test->isSet(pl[i]));
+ if (test->getDataObject(pl[i]) == 0) fprintf(f," empty\n");
+ else fprintf(f, " dataobject\n");
+ }
+ }
+ catch (SDOPropertyNotSetException)
+ {
+ if (!silent) cout << " WRONG - not set exception" << endl;
+ return 0;
+ }
+ }
+
+ cs->endLogging();
+ fclose(f);
+
+ int rr = comparefiles("nulltest.dat","nulltest.txt");
+
+ if (rr == 0)
+ {
+ if (!silent) cout << "Nulltest compare failed - probably because of differences is formats for doubles/floats" << endl;
+ // accept the test.
+ return 1;
+
+ }
+
+ return 1;
+
+ }
+ catch (SDORuntimeException e)
+ {
+ if (!silent) cout << "Nulltest failed " << e << endl;
+ if (f) fclose(f);
+ return 0;
+ }
+}
+
+int sdotest::maintest()
+{
+
+ unsigned int i;
+
+ FILE *f;
+
+ try{
+
+ f = fopen("maintest.dat","w+");
+ if (f == 0)
+ {
+ if (!silent) cout << "Failed to open maintest.dat" << endl;
+ }
+
+ fprintf(f,"Test Program starting to create types ...\n");
+
+ /* First create a DataFactory , then add some types and props...*/
+
+ /* This is dms creation of metadata */
+
+
+
+ DataFactoryPtr mdg = DataFactory::getDataFactory();
+
+ mdg->addType("myspace","Company");
+ mdg->addType("myspace","Department");
+ // manager is a sequenced type...
+ mdg->addType("myspace","Manager", true, false);
+
+ mdg->addType("myspace","Employee");
+
+ // tests of base types
+
+ // note - base type of a seq type must be seq...
+ mdg->addType("myspace","Person", true, false);
+
+ mdg->addType("myspace","DerivedString");
+ mdg->addType("myspace","SubDepartment");
+
+ /* Now add the properties to the types...*/
+
+ const Type& tc = mdg->getType("myspace","Company");
+ const Type& ts = mdg->getType("commonj.sdo","String");
+ const Type& ti = mdg->getType("commonj.sdo","Int");
+ const Type& tf = mdg->getType("commonj.sdo","Float");
+ const Type& tm = mdg->getType("myspace","Manager");
+
+ fprintf(f, "Manager is sequenced?%d\n",tm.isSequencedType());
+
+ const Type& td = mdg->getType("myspace","Department");
+ const Type& te = mdg->getType("myspace","Employee");
+ const Type& tp = mdg->getType("myspace","Person");
+ const Type& tds= mdg->getType("myspace","DerivedString");
+ const Type& tsd= mdg->getType("myspace","SubDepartment");
+
+ fprintf(f, "Manager is sequenced?%d\n",tm.isSequencedType());
+
+
+
+
+
+ /* By type, with a type */
+ mdg->addPropertyToType(tc,"name",ts);
+
+ /* by name/uri with a type */
+ mdg->addPropertyToType("myspace","Company","address",ts);
+
+ /* by type with name/uri */
+ mdg->addPropertyToType(tc,"departments", "myspace","Department",
+ true);
+
+
+ // add a reference to employee of the month
+ mdg->addPropertyToType(tc,"employee of the month", "myspace","Employee",
+ false, false, false);
+
+
+
+ /* A list of floats */
+
+ mdg->addPropertyToType(tc,"floatlist", tf,true);
+
+ mdg->addPropertyToType(tc,"pdg", tm);
+
+ fprintf(f, "Manager is sequenced?%d\n",tm.isSequencedType());
+
+ mdg->addPropertyToType(td,"name", ts);
+
+ mdg->addPropertyToType(td,"id", ti, false, true, false);
+
+ mdg->addPropertyToType(td,"manager", tm);
+
+ mdg->addPropertyToType(tm,"name", ts);
+
+
+ mdg->addPropertyToType(te,"name",ts);
+ mdg->addPropertyToType(td,"employees",te,true,false,true);
+
+
+
+ // emps and managers are both people (in theory).
+ mdg->setBaseType(te,tp);
+ fprintf(f, "Manager is sequenced?%d\n",tm.isSequencedType());
+ mdg->setBaseType(tm,tp);
+ fprintf(f, "Manager is sequenced?%d\n",tm.isSequencedType());
+ mdg->addPropertyToType(tp,"haircolour", ts);
+ mdg->addPropertyToType(tp,"name", ts);
+ mdg->addPropertyToType(tm,"officeid", ts);
+ mdg->addPropertyToType(te,"cubelocation", ts);
+
+ mdg->addPropertyToType(tc,"shareholder", tp);
+
+ //derived string - derived from string - cannot have properties!!!
+ mdg->setBaseType(tds,ts);
+
+ // subdept derived from dept
+ mdg->setBaseType(tsd,td);
+ mdg->addPropertyToType(tsd,"subname",ts);
+
+ mdg->addPropertyToType(tc, "substring",tds);
+
+ /* by type with name/uri */
+ mdg->addPropertyToType(tc,"subdepartments", "myspace","SubDepartment",
+ true);
+
+ /* This is the data structure */
+
+
+
+ /* company
+ ----shareholder (Person)
+ ----substring (DerivedString)
+ * ----name (String)
+ * ----pdg (Manager)
+ (inherits haircolour from person,
+ has name as duplicate property - should use person.name
+ has officeid)
+ * ----name(String)
+ ----haircolour(String)
+ ----officeid(String)
+ *
+ * ----depts[] (Department)
+ * ----name (String)
+ * ----id (Int)
+ * ----manager (Manager).
+ * ----name(String)
+ ----haircolour(String) from Person
+ * ----employees[] (Employee)
+ * ----name(String)
+ ----haircolour(String) - from Person
+ ----cubelocation(String)
+ --subdepartments[] (SubDepartment)
+ ----name (String) from Department
+ ----id (String) from Department
+ ----manager (Manager) from Department
+ ----employees (from department)
+ */
+
+ /* Now add a primitive type test to the manager */
+ mdg->addPropertyToType(tm,"str",ts);
+
+ fprintf(f, "Manager is sequenced?%d\n",tm.isSequencedType());
+
+ mdg->addPropertyToType(tm,"boolean", "commonj.sdo","Boolean");
+ mdg->addPropertyToType(tm,"byte", "commonj.sdo","Byte");
+ mdg->addPropertyToType(tm,"character", "commonj.sdo","Character");
+ mdg->addPropertyToType(tm,"short", "commonj.sdo","Short");
+ mdg->addPropertyToType(tm,"long", "commonj.sdo","Int");
+ mdg->addPropertyToType(tm,"longlong", "commonj.sdo","Long");
+ mdg->addPropertyToType(tm,"float", "commonj.sdo","Float");
+ mdg->addPropertyToType(tm,"longdouble", "commonj.sdo","Double");
+ mdg->addPropertyToType(tm,"date", "commonj.sdo","Date");
+ // dead mdg->addPropertyToType(tm,"charptr", "commonj.sdo","Bytes");
+ mdg->addPropertyToType(tm,"string", "commonj.sdo","String");
+ mdg->addPropertyToType(tm,"bytes", "commonj.sdo","Bytes");
+
+
+ fprintf(f, "Manager is sequenced?%d\n",tm.isSequencedType());
+
+ // create a few aliases
+
+ mdg->setAlias("myspace","Company","TheFirm");
+ mdg->setAlias("myspace","Company","departments","TheDepartments");
+ mdg->setAlias("myspace","Company","TheBigFirm");
+ mdg->setAlias("myspace","Company","TheLittleFirm");
+
+ const Type& tlf = mdg->getType("myspace","TheBigFirm");
+
+ fprintf(f, "Should be Company :%s\n", tlf.getName());
+
+ fprintf(f, "Should be 3: %d\n", tlf.getAliasCount());
+
+ for (unsigned int ai = 0; ai < tlf.getAliasCount(); ai++)
+ {
+ fprintf(f, "Alias: %s\n",tlf.getAlias(ai));
+ }
+
+
+ // Change summary test begins
+ mdg->addPropertyToType(tc,"csumm","commonj.sdo","ChangeSummary");
+ // should log an error - but not fail
+ mdg->addPropertyToType(td,"csumm","commonj.sdo","ChangeSummary");
+
+ fprintf(f, "Manager is sequenced?%d\n",tm.isSequencedType());
+
+ fprintf(f, "BEFORE RESOLUTION\n");
+ printDataStructure(f, mdg);
+
+ /* Now create some objects in the dg */
+
+// DataObjectPtr dor;
+
+ const Type& tcc = mdg->getType("myspace","Company");
+ DataObjectPtr dor = mdg->create((Type&)tcc);
+
+ fprintf(f, "AFTER RESOLUTION\n");
+ printDataStructure(f, mdg);
+
+ fprintf(f, "Manager is sequenced?%d\n",tm.isSequencedType());
+
+ dor->setCString("substring","This is the sub string - its primitive, but not a string");
+
+ const char* subby = dor->getCString("substring");
+
+ fprintf(f, "%s\n", subby);
+
+ dor->setCString("name","acmecorp");
+ const char* chnam = dor->getCString("name");
+ fprintf(f, "%s\n", chnam);
+
+ dor->unset("name");
+
+ dor->setCString("name","acmecorp");
+
+ // Set up the two departments before logging starts
+
+ DataObjectPtr dep1 = dor->createDataObject("departments");
+ dep1->setCString("name","Developement");
+
+ try
+ {
+ dep1->setInt("id", 1);
+ if (!silent)cout << "WRONG read-only Property shouldn't have allowed setting" << endl;
+ fclose(f);
+ return 0;
+ }
+ catch (SDOUnsupportedOperationException e)
+ {}
+
+ DataObjectPtr dep2= dor->createDataObject("departments");
+ dep2->setCString("name","Marketing");
+
+ // add a couple of floats to the floatlist
+ DataObjectList& dolist = dor->getList("floatlist");
+ dolist.append((float)1.4);
+ dolist.append((float)1.5);
+
+ //TODO - change summaries should live on the DataObject
+ // interface - can this be done?
+
+ ChangeSummaryPtr cs = dor->getChangeSummary();
+ cs->beginLogging();
+
+ const char* sname = dor->getCString("name");
+
+ fprintf(f, "%s\n", sname);
+
+ // This should put a created entry in the cs.
+
+ // This should be equivalent to the alternative below.........
+ const Type& tcd = mdg->getType("myspace","Manager");
+ DataObjectPtr pdg = mdg->create((Type&)tcd);
+
+ // This set should put the entry into the change summary.
+ // both in the creations and in the changes.
+ dor->setDataObject("pdg",pdg);
+
+
+ // try getting the boolean as a string - should be defaulted to false:
+ const char *bol;
+ try{
+ bol = pdg->getCString("boolean");
+ if (bol != 0)
+ {
+ fprintf(f, "Expected default boolean (false) : %s\n",bol);
+ }
+ else
+ {
+ fprintf(f, " is empty \n");
+ }
+ }
+ catch (SDOPropertyNotSetException)
+ {
+ if (!silent)cout << "WRONG handled notset exception " << endl;
+ fclose(f);
+ return 0;
+ }
+
+ pdg->setBoolean("boolean", true);
+ bol = pdg->getCString("boolean");
+ fprintf(f, "Expected boolean (true) : %s\n",bol);
+
+ // and the widechars?
+ const char* wdc;
+ try {
+ wdc = pdg->getCString("string");
+ if (wdc != 0)
+ {
+ fprintf(f, "Expected default string (0) : ",wdc);
+ }
+ else
+ {
+ fprintf(f, " is empty \n");
+ }
+ }
+ catch (SDOPropertyNotSetException)
+ {
+ if (!silent) cout << "WRONG handled notset exception" <<endl;
+ fclose (f);
+ return 0;
+ }
+
+
+ // this should get a valid sequence..
+
+ SequencePtr sq = pdg->getSequence();
+
+
+ // The alternative.............................................
+ // Here the create should put the entry into the change summary
+ //DataObject* pdg = dor->createDataObject("pdg");
+
+ // This should do nothing to the cs, as its in a created object
+ pdg->setCString("name","Jacques LePlace");
+
+ // This should modify the property, and add an item to the sequence.
+ sq->addCString("name", "Jacques LePlagne");
+
+
+ // The creation entry should be removed from the change summary
+ // The entry should no longer exist and the pointer is invalid
+ pdg->detach();
+
+ pdg = dor->getDataObject("pdg");
+
+ if (pdg != 0)
+ {
+ fprintf(f, " A deleted data object should be zero and was not\n");
+ }
+
+ pdg = mdg->create((Type&)tcd);
+
+ // A new creation in the change summary
+ dor->setDataObject("pdg",pdg);
+
+ // No modification as the object is created
+ pdg->setCString("name", "Mr Horace Walker");
+
+ sq = pdg->getSequence();
+
+ try {
+ // element 0 is the first setting - which we just deleted!
+ sq->setCStringValue(0,"Unable to set");
+ }
+ catch (SDOIndexOutOfRangeException)
+ {
+ // thats OK
+ sq->addCString("name","Now able to set");
+ }
+
+
+ sq->addText(" - should say now able to set\n");
+
+ for (unsigned int ii=0;ii<sq->size();ii++)
+ {
+ fprintf(f, "%s\n", sq->getCStringValue(ii));
+ }
+
+ try {
+ const char* n = pdg->getCString("name");
+ fprintf(f, " Name from deleted item: %s\n",n);
+ }
+ catch (SDOPropertyNotFoundException e)
+ {
+ // thats ok
+ fprintf(f, "Correctly caught prop not found\n");
+ }
+
+
+ // This should put a change in the cs.
+ dor->setCString("name","mega-new-acmecorp");
+
+
+ // At this point, we should know that pdg was empty and is now
+ // a created object. And that the old string for company name
+ // was "acmecorp"
+
+ // cs->DebugPrint();
+
+
+ /* Now set up the primitive type test on PDG */
+
+ pdg->setCString("string","Hello I am a string");
+ pdg->setBoolean("boolean",true);
+ pdg->setByte("byte",23);
+ pdg->setCharacter("character",45);
+ pdg->setShort("short",34);
+ pdg->setLong("long", 56);
+ pdg->setDouble("longdouble",89.0);
+ pdg->setFloat("float",90.0);
+ pdg->setDate("date",(time_t)200);
+
+ // RHEL 4 has problems processing 64 bit int constants, so we'll do it the hard way
+ // This is overkill but gives the option to vary the value a bit.
+
+ int64_t largeInt1 = 0xFFFF;
+ int64_t largeInt2 = 0x7FFF;
+ for (int j = 0; j < 3; j++)
+ {
+ largeInt1 <<= 16;
+ largeInt1 += 0xFFFF;
+ largeInt2 <<= 16;
+ largeInt2 += 0xFFFF;
+ }
+
+ pdg->setLong("longlong", largeInt1);
+
+ // try reading the longlong as a string
+ const char *lls = pdg->getCString("longlong");
+ fprintf(f, "0xffffffffffffffff = : %s\n", lls);
+
+ pdg->setLong("longlong", largeInt2);
+
+ lls = pdg->getCString("longlong");
+ fprintf(f, "0x7fffffffffffffff = %s\n",lls);
+
+ pdg->setLong("longlong",0x7FFFFFFF);
+ lls = pdg->getCString("longlong");
+ fprintf(f, "0x7fffffff = %s\n",lls);
+
+ pdg->setLong("longlong",0x80000000);
+ lls = pdg->getCString("longlong");
+ fprintf(f, "0x80000000 = %s\n",lls);
+
+ pdg->setLong("longlong",78);
+
+
+ wchar_t* wide = new wchar_t[4];
+ wide[0] = 'W';
+ wide[1] = 'i';
+ wide[2] = 'd';
+ wide[3] = 'e';
+
+ pdg->setString("string",wide,4);
+
+ // and as a string?
+ wdc = pdg->getCString("string");
+ fprintf(f, " Expected Wide - got : %s\n",wdc);
+
+ delete[] wide;
+
+ char* thin = new char[4];
+ thin[0] = 'T';
+ thin[1] = 'h';
+ thin[2] = 'i';
+ thin[3] = 'n';
+
+ pdg->setBytes("bytes",thin,4);
+
+ const char* dc = pdg->getCString("bytes");
+ fprintf(f, " Expected Thin - got : %s\n",dc);
+
+ delete[] thin;
+
+ const char* ps = pdg->getCString("string");
+ fprintf(f, "Expecting string, got %s\n", ps);
+
+ bool pb = pdg->getBoolean("boolean");
+ fprintf(f, "Expected bool true, got %d\n",pb);
+
+ char pc = pdg->getByte("byte");
+ fprintf(f, "Expected char 23, got %d\n",pc);
+
+ wchar_t pw = pdg->getCharacter("character");
+ fprintf(f, "expected wchar 45, got %d",pw);
+
+ short pss = pdg->getShort("short");
+ fprintf(f, "Expected short 34, got %d\n",pss);
+
+ long pl = pdg->getLong("long");
+ fprintf(f, "Expected long 56 , got %ld\n",pl);
+
+ int64_t pi = pdg->getLong("longlong");
+ fprintf(f, "Expected long long 78, got %ld\n",(long)pi);
+
+ long double ld = pdg->getDouble("longdouble");
+ fprintf(f, "Expected long double 89, got %.3f\n",(float)ld);
+
+ float pf = pdg->getFloat("float");
+ fprintf(f, "Expected float 90, got %.3f\n",pf);
+
+ SDODate pt = pdg->getDate("date");
+ fprintf(f, "Expected time_t 200, got %d\n",pt.getTime());
+
+
+ wchar_t* result;
+ // get the length to allocate:
+ unsigned int widelen = pdg->getString("string",0,0);
+ if (widelen > 0) {
+ result = new wchar_t[widelen];
+ widelen = pdg->getString("string",result,widelen);
+ for ( i=0;i<widelen;i++)
+ {
+ fprintf(f, "Wide[%d]=%d\n",i,result[i]);
+ }
+ delete[] result;
+ }
+
+
+ char* thinresult;
+
+ unsigned int thinlen = pdg->getBytes("bytes",0,0);
+ if (thinlen > 0) {
+ thinresult = new char[thinlen];
+ thinlen = pdg->getBytes("bytes",thinresult,thinlen);
+ for ( i=0;i<thinlen;i++)
+ {
+ fprintf(f, "Thin[%d]=%d\n",i,thinresult[i]);
+ }
+ delete[] thinresult;
+ }
+
+
+ // add two more departments - the first should provoke the
+ // saving of a list in a change summary
+
+ DataObjectPtr dep3 = dor->createDataObject("departments");
+ dep3->setCString("name","Architecture");
+
+ // The second should do no logging in the change summary
+
+ DataObjectPtr dep4= dor->createDataObject("departments");
+ dep4->setCString("name","Pyrotechnics");
+
+
+ // create another one using tha alias
+ DataObjectPtr dep5= dor->createDataObject("TheDepartments");
+ dep5->setCString("name","Accounts");
+
+ DataObjectPtr emp1 = dep1->createDataObject("employees");
+ emp1->setCString("name","Eric");
+
+
+ DataObjectPtr emp2 = dep1->createDataObject("employees");
+ emp2->setCString("name","Bill");
+
+ // now lets make eric employee of the month
+ dor->setDataObject("employee of the month",emp1);
+
+ // no - actually it was bill
+ dor->setDataObject("employee of the month",emp2);
+
+
+
+ // Now add to the list of floats, hopefully the two old
+ // values will get change summarised.
+
+ dolist = dor->getList("floatlist");
+ float f1 = dolist.getFloat(0);
+
+ fprintf(f, "%.3f",f1);
+
+ dolist.setFloat(0,(float)567.7);
+
+ f1 = dolist.getFloat(0);
+
+ fprintf(f, "%.3f",f1);
+
+ dolist.insert(0,(float)34.56);
+
+
+ DataObjectPtr ddd = dor->getDataObject("departments[1]/employees[2]");
+
+ const char* ch = ddd->getCString("name");
+
+ fprintf(f, "Should be Bill:%s\n",ch);
+
+
+ DataObjectPtr ddd2 = dor->getDataObject("TheDepartments[1]/employees[2]");
+
+ const char* ch2 = ddd2->getCString("name");
+
+ fprintf(f, "Should be Bill:%s\n",ch2);
+
+
+ DataObjectPtr dempofm = dor->getDataObject("employee of the month");
+
+ const char* chh = dempofm->getCString("name");
+
+ fprintf(f, "The employee of the month is %s\n",chh);
+
+ // Suppose we delete bill
+
+ DataObjectList& dlo = dor->getList("departments[1]/employees");
+ DataObjectPtr fred = dlo.remove(1);
+
+ const char* chh2 = fred->getCString("name");
+
+ dempofm = dor->getDataObject("employee of the month");
+
+ // uncertain bahaviour - should the reference be zeroed
+ // becuase the item is removed from a list or not?
+ // Right now it doesnt get done, as the assumption is that
+ // the object will be put somewhere else, or dropped.
+ // fprintf(f, "Emp of month is now zero : %p",dempofm);
+
+
+ /* "The client would create a data mediator and get graph which
+ would return the root data object " */
+
+ const char* boss = dor->getCString("pdg/name");
+
+ fprintf(f, "%s\n", boss);
+
+ DataObjectPtr mypdg = dor->getDataObject("pdg");
+
+ Type::Types t = mypdg->getTypeEnum();
+
+ if (t != Type::OtherTypes) {
+ fprintf(f, "pdg correctly identified\n");
+ }
+
+ const char* boss2 = mypdg->getCString("name");
+
+ fprintf(f, "%s\n", boss2);
+
+ /* getPrimitiveArrayListVectorThingy() */
+
+ DataObjectList& deps = dor->getList("departments");
+
+ fprintf(f, "size of list %d\n",deps.size());
+
+ DataObjectPtr dout = deps[0];
+
+ dout->setCString("name","Research And Development");
+
+ const char* snew = dout->getCString("name");
+
+ fprintf(f, "%s\n", snew);
+
+ string snew2 = dor->getCString("departments[1 ] /name");
+
+ fprintf(f, "%s\n", snew2.c_str());
+
+ for (unsigned int lx = 0; lx < deps.size(); lx++)
+ {
+ fprintf(f, "Department: %s\n",deps[lx]->getCString("name"));
+ }
+
+ cs->endLogging();
+
+
+ try {
+ // should fail - if localtype not set
+ dor->setCString("departments","department label");
+ const char* slabel = dor->getCString("departments");
+ fprintf(f, "String in list type:%s\n", slabel);
+ // SDOValue change. Setting values usually works now, so no
+ //exception expected (the error is thrown on the get)
+ //return 0;
+ }
+ catch (SDORuntimeException e)
+ {
+ fprintf(f, "Normal expected exception\n");
+ }
+
+ try
+ {
+ const char* snew3 = dor->getCString(" ]awep50wi4,0qw9q]45]# q2345 -t -v3lt6o -56o 56=-o7nl ewv/;sdl f[vxddglh]px dfju/ g#k./jh#.k./");
+ fprintf(f, "%s\n", snew3);
+ return 0;
+ }
+ catch (SDOPropertyNotFoundException e)
+ {
+ fprintf(f, "Normal Invalid path exception\n");
+ }
+
+ try
+ {
+
+ // catch a and a property not found
+ const Property& pp = dor->getType().getProperty("notaproperty");
+ return 0;
+ }
+ catch (SDOPropertyNotFoundException e)
+ {
+ fprintf(f, "Normal SDOPropertyNotFound exception\n");
+ }
+ fclose(f);
+ return comparefiles("maintest.dat","maintest.txt");
+
+ }
+
+ catch (SDORuntimeException e)
+ {
+ if (!silent) cout << e.getEClassName() << " in ";
+ if (!silent) cout << e.getFileName() << " at line ";
+ if (!silent) cout << e.getLineNumber() << endl;
+ if (!silent) cout << e.getFunctionName() << " ";
+ if (!silent) cout << e.getMessageText() << endl;
+ return 0;
+ }
+}
+
+int sdotest::jira705()
+{
+
+ char* retval = NULL;
+
+ try
+ {
+ DataFactoryPtr dataFactoryPtr = DataFactory::getDataFactory();
+ XSDHelperPtr xsdHelperPtr = HelperProvider::getXSDHelper(dataFactoryPtr);
+ XMLHelperPtr xmlHelperPtr = HelperProvider::getXMLHelper(dataFactoryPtr);
+ xsdHelperPtr->defineFile("jira705.xsd");
+
+ DataObjectPtr dataObjectPtr = dataFactoryPtr->create("http://ConvertedStockQuote",
+ "getQuote");
+
+ dataObjectPtr->setCString("ticker1", "IBM");
+ dataObjectPtr->setNull("ticker2");
+
+ XMLDocumentPtr xmlDocumentPtr = xmlHelperPtr->createDocument(dataObjectPtr, 0, "getQuote");
+
+ retval = xmlHelperPtr->save(xmlDocumentPtr, 2);
+ }
+ catch (SDORuntimeException e)
+ {
+ if (!silent) cout << "jira705 test failed" << endl;
+ if (retval != NULL)
+ {
+ delete[] retval;
+ }
+
+ return 0;
+ }
+
+ FILE *outfile = fopen("jira705_out.xml", "w+");
+ if (outfile == 0)
+ {
+ if (!silent) cout << "Unable to open jira705_out.xml" << endl;
+ if (retval != NULL)
+ {
+ delete[] retval;
+ }
+ return 0;
+ }
+
+ fprintf(outfile, "%s", retval);
+
+ fclose(outfile);
+ if (retval != NULL)
+ {
+ delete[] retval;
+ }
+
+ return comparefiles("jira705_out.xml", "jira705_out.txt");
+
+}
+
+int sdotest::jira490()
+{
+
+ FILE *f;
+
+ f = fopen("jira490.dat", "w+");
+ if (f == 0)
+ {
+ if (!silent) cout << "Failed to open jira490.dat" << endl;
+ }
+
+ fprintf(f,"Test Program starting to create types ...\n");
+
+ DataFactoryPtr mdg = DataFactory::getDataFactory();
+
+ mdg->addType("myspace","Employee");
+
+ const Type& ts = mdg->getType("commonj.sdo","String");
+ const Type& te = mdg->getType("myspace","Employee");
+
+ mdg->addPropertyToType(te,"name",ts);
+ mdg->addPropertyToType(te,"officeNumber",ts);
+
+ fprintf(f, "\nBefore Resolution\n\n");
+ printDataStructure(f, mdg);
+
+ /* Now create some objects in the dg */
+
+ DataObjectPtr dor = mdg->create((Type&) te);
+
+ fprintf(f, "\nAfter Resolution\n\n");
+ printDataStructure(f, mdg);
+
+ dor->setCString("name", "Mr A Trader");
+ dor->setCString("officeNumber", "123");
+
+ const char* chnam = dor->getCString("name");
+ fprintf(f, "%s\n", chnam);
+
+ const char* offnum = dor->getCString("officeNumber");
+ fprintf(f, "%s\n", offnum);
+
+ char c = dor->getByte("officeNumber");
+ fprintf(f, "%d\n", c);
+ fprintf(f, "%c\n", c);
+
+ fclose(f);
+
+ return comparefiles("jira490.dat", "jira490.txt");
+
+}
+
+int sdotest::getproptest()
+{
+ // should be able to get a property by xpath...
+
+ FILE *f;
+
+ f = fopen("getproptest.dat","w+");
+ if (f == 0)
+ {
+ if (!silent)cout << "Unable to open getproptest.dat" << endl;
+ return 0;
+ }
+
+ DataFactoryPtr mdg = DataFactory::getDataFactory();
+
+ mdg->addType("myspace","Company");
+ mdg->addType("myspace","Department");
+ // manager is a sequenced type...
+ mdg->addType("myspace","Manager", true, false);
+ mdg->addType("myspace","Employee");
+
+
+ /* Now add the properties to the types...*/
+
+ const Type& tc = mdg->getType("myspace","Company");
+ const Type& ts = mdg->getType("commonj.sdo","String");
+ const Type& ti = mdg->getType("commonj.sdo","Int");
+ const Type& tf = mdg->getType("commonj.sdo","Float");
+ const Type& tm = mdg->getType("myspace","Manager");
+ const Type& td = mdg->getType("myspace","Department");
+ const Type& te = mdg->getType("myspace","Employee");
+
+ mdg->addPropertyToType(tc,"name",ts);
+
+ mdg->addPropertyToType(tc,"address",ts);
+
+ mdg->addPropertyToType(tc,"departments", td,true);
+
+ // add a reference to employee of the month
+ mdg->addPropertyToType(tc,"employee of the month", te, false, false, false);
+
+ /* A list of floats */
+ mdg->addPropertyToType(tc,"floatlist", tf,true);
+ mdg->addPropertyToType(tc,"director", tm);
+
+ mdg->addPropertyToType(td,"name", ts);
+ mdg->addPropertyToType(td,"id", ti);
+
+ mdg->addPropertyToType(td,"manager", tm);
+ mdg->addPropertyToType(tm,"name", ts);
+
+ mdg->addPropertyToType(te,"name",ts);
+ mdg->addPropertyToType(td,"employees",te,true,false,true);
+
+ //company/departments/employees.
+ // company - name, address, floatlist
+ // department name, id, manager
+ // employee name
+
+
+ const Type& tcc = mdg->getType("myspace","Company");
+ DataObjectPtr dor = mdg->create((Type&)tcc);
+
+
+ const Property& p = dor->getType().getProperty("name");
+ fprintf(f, "Companys name property is: %s\n",p.getName());
+
+ const Property& p1 = dor->getType().getProperty("departments");
+ fprintf(f, "Companys dept property is:%s\n",p1.getName());
+
+ // now try some xpaths...
+
+ try {
+
+ const Property& p2 = dor->getType().getProperty("departments/employees");
+ fprintf(f,"Departments empl property is:%s\n",p2.getName());
+
+ const Property& p3 = dor->getType().getProperty("departments[456]/employees[123]");
+ fprintf(f,"Departments empl property is:%s\n", p3.getName());
+
+ const Property& p4 = dor->getType().getProperty("departments.34/employees.123/name");
+ fprintf(f,"Employees name property is:%s\n", p4.getName());
+
+ }
+ catch (SDORuntimeException e)
+ {
+ if (!silent) cout <<"Exceptions - xpath didnt work" << endl;
+ return 0;
+ }
+ try {
+ const Property& p5 = dor->getType().getProperty("departments.34/[]/name");
+ fprintf(f,"Employees name property is:%s\n",p5.getName());
+ return 0;
+ }
+ catch (SDORuntimeException e)
+ {
+ fprintf(f,"Normal exception caught\n");
+ }
+
+ try {
+ const Property& p6 = dor->getType().getProperty("deptartments");
+ fprintf(f,"Deptartments property is:%s\n",p6.getName());
+ return 0;
+ }
+ catch (SDORuntimeException e)
+ {
+ fprintf(f,"Normal exception caught\n");
+ }
+
+ try {
+ const Property& p7 = dor->getType().getProperty("../company");
+ fprintf(f,"Company property is:%s\n",p7.getName());
+ return 0;
+ }
+ catch (SDORuntimeException e)
+ {
+ fprintf(f,"Normal exception caught\n");
+ }
+ fclose (f);
+ return comparefiles("getproptest.dat","getproptest.txt");
+
+}
+
+int sdotest::querytest()
+{
+ DataFactoryPtr mdg = DataFactory::getDataFactory();
+
+ FILE *f = fopen("querytest.dat","w+");
+ if (f == 0)
+ {
+ if (!silent) cout << "Unable to open querytest.dat" << endl;
+ return 0;
+ }
+
+ mdg->addType("myspace","Company");
+ mdg->addType("myspace","Department");
+ // manager is a sequenced type...
+ mdg->addType("myspace","Manager", true, false);
+ mdg->addType("myspace","Employee");
+
+
+ /* Now add the properties to the types...*/
+
+
+ const Type& tstring = mdg->getType("commonj.sdo","String");
+ const Type& tbool= mdg->getType("commonj.sdo","Boolean");
+ const Type& tbyte= mdg->getType("commonj.sdo","Byte");
+ const Type& tchar= mdg->getType("commonj.sdo","Character");
+ const Type& tint= mdg->getType("commonj.sdo","Int");
+ const Type& tlong= mdg->getType("commonj.sdo","Long");
+ const Type& tfloat= mdg->getType("commonj.sdo","Float");
+ const Type& tbytes = mdg->getType("commonj.sdo","Bytes");
+ const Type& tdouble= mdg->getType("commonj.sdo","Double");
+
+ const Type& tc = mdg->getType("myspace","Company");
+ const Type& tm = mdg->getType("myspace","Manager");
+ const Type& td = mdg->getType("myspace","Department");
+ const Type& te = mdg->getType("myspace","Employee");
+
+ mdg->addPropertyToType(tc,"name",tstring);
+
+ mdg->addPropertyToType(tc,"departments", td,true);
+
+ // add a reference to employee of the month
+ mdg->addPropertyToType(tc,"employee of the month", te, false, false, false);
+
+ mdg->addPropertyToType(tc,"director", tm);
+
+ mdg->addPropertyToType(td,"name", tstring);
+
+ mdg->addPropertyToType(td,"manager", tm);
+
+ mdg->addPropertyToType(tm,"name", tstring);
+
+
+ mdg->addPropertyToType(td,"employees",te,true,false,true);
+
+ mdg->addPropertyToType(te,"bool",tbool);
+ mdg->addPropertyToType(te,"byte",tbyte);
+ mdg->addPropertyToType(te,"char",tchar);
+ mdg->addPropertyToType(te,"int",tint);
+ mdg->addPropertyToType(te,"float",tfloat);
+ mdg->addPropertyToType(te,"long",tlong);
+ mdg->addPropertyToType(te,"double",tdouble);
+ mdg->addPropertyToType(te,"bytes",tbytes);
+ mdg->addPropertyToType(te,"string",tstring);
+ mdg->addPropertyToType(te,"name",tstring);
+
+ //company/departments/employees.
+ // company - name, address, floatlist
+ // department name, id, manager
+ // employee name
+
+ const Type& tcc = mdg->getType("myspace","Company");
+ DataObjectPtr dor = mdg->create((Type&)tcc);
+
+ DataObjectPtr dept = dor->createDataObject("departments");
+
+ DataObjectPtr emp1 = dept->createDataObject("employees");
+ DataObjectPtr emp2 = dept->createDataObject("employees");
+ DataObjectPtr emp3 = dept->createDataObject("employees");
+
+ emp1->setCString("name","Employee1");
+ emp2->setCString("name","Employee2");
+ emp3->setCString("name","Employee3");
+
+
+ emp1->setBoolean("bool",true);
+ emp1->setByte("byte",'1');
+ emp1->setCharacter("char",'1');
+ emp1->setInt("int",1);
+ emp1->setFloat("float",1.0);
+ emp1->setLong("long",1);
+ emp1->setDouble("double",1.0);
+
+ char* bytes = new char[6];
+ bytes[0] = 'h';
+ bytes[1] = 'e';
+ bytes[2] = 'l';
+ bytes[3] = 'l';
+ bytes[4] = 'o';
+
+ emp1->setBytes("bytes",bytes,5);
+
+ wchar_t* mbytes = new wchar_t[6];
+ mbytes[0] = 'h';
+ mbytes[1] = 'e';
+ mbytes[2] = 'l';
+ mbytes[3] = 'l';
+ mbytes[4] = 'o';
+
+ emp1->setString("string",mbytes,5);
+
+
+ emp2->setBoolean("bool",true);
+ emp2->setByte("byte",'2');
+ emp2->setCharacter("char",'2');
+ emp2->setInt("int",200);
+ emp2->setFloat("float",200.0);
+ emp2->setLong("long",200);
+ emp2->setDouble("double",200.0);
+
+ char* bytes2 = new char[6];
+ bytes2[0] = 'h';
+ bytes2[1] = 'e';
+ bytes2[2] = 'l';
+ bytes2[3] = 'p';
+ bytes2[4] = '!';
+
+ emp2->setBytes("bytes",bytes2,5);
+
+ wchar_t* mbytes2 = new wchar_t[6];
+ mbytes2[0] = 'h';
+ mbytes2[1] = 'e';
+ mbytes2[2] = 'l';
+ mbytes2[3] = 'p';
+ mbytes2[4] = '!';
+
+ emp2->setString("string",mbytes2,5);
+
+ emp3->setBoolean("bool",false);
+ emp3->setByte("byte",'4');
+ emp3->setCharacter("char",'4');
+ emp3->setInt("int",400);
+ emp3->setFloat("float",400.0);
+ emp3->setLong("long",400);
+ emp3->setDouble("double",400.0);
+
+ char* bytes3 = new char[6];
+ bytes3[0] = 'w';
+ bytes3[1] = 'o';
+ bytes3[2] = 'm';
+ bytes3[3] = 'p';
+ bytes3[4] = '!';
+
+ emp3->setBytes("bytes",bytes3,5);
+
+ wchar_t* mbytes3 = new wchar_t[6];
+ mbytes3[0] = 'w';
+ mbytes3[1] = 'o';
+ mbytes3[2] = 'm';
+ mbytes3[3] = 'p';
+ mbytes3[4] = '!';
+
+ emp3->setString("string",mbytes3,5);
+
+
+
+ try {
+ DataObjectPtr dob1 = dor->getDataObject("departments[1]/employees[bool=false]");
+ fprintf(f, "Expected employee3: got %s\n",dob1->getCString("name"));
+
+ DataObjectPtr dob2 = dor->getDataObject("departments[1]/employees[bool=true]");
+ fprintf(f, "Expected employee1: got %s\n",dob2->getCString("name"));
+
+ DataObjectPtr dob3 = dor->getDataObject("departments[1]/employees[byte=2]");
+ fprintf(f, "Expected employee2: got %s\n",dob3->getCString("name"));
+
+ DataObjectPtr dob4 = dor->getDataObject("departments[1]/employees[byte=1]");
+ fprintf(f, "Expected employee1: got %s\n",dob4->getCString("name"));
+
+ DataObjectPtr dob5 = dor->getDataObject("departments[1]/employees[bytes=hello]");
+ fprintf(f, "Expected employee1: got %s\n",dob5->getCString("name"));
+
+ DataObjectPtr dob5a = dor->getDataObject("departments[1]/employees[bytes=\"hello\"]");
+ fprintf(f, "Expected employee1: got %s\n",dob5a->getCString("name"));
+
+ DataObjectPtr dob5b = dor->getDataObject("departments[1]/employees[bytes='hello']");
+ fprintf(f, "Expected employee1: got %s\n",dob5b->getCString("name"));
+
+ DataObjectPtr dob6 = dor->getDataObject("departments[1]/employees[bytes=womp!]");
+ fprintf(f, "Expected employee3: got %s\n",dob6->getCString("name"));
+
+ DataObjectPtr dob7 = dor->getDataObject("departments[1]/employees[double=200.0]");
+ fprintf(f, "Expected employee2: got %s\n",dob7->getCString("name"));
+
+ DataObjectPtr dob8 = dor->getDataObject("departments[1]/employees[string=help!]");
+ fprintf(f, "Expected employee2: got %s\n",dob8->getCString("name"));
+
+ DataObjectPtr dob8a = dor->getDataObject("departments[1]/employees[string=\"help!\"]");
+ fprintf(f, "Expected employee2: got %s\n",dob8a->getCString("name"));
+
+ DataObjectPtr dob8b = dor->getDataObject("departments[1]/employees[string= 'help!']");
+ fprintf(f, "Expected employee2: got %s\n",dob8b->getCString("name"));
+ }
+ catch (SDORuntimeException e)
+ {
+ if (!silent)cout << e.getEClassName() << " in ";
+ if (!silent)cout << e.getFileName() << " at line ";
+ if (!silent)cout << e.getLineNumber() << endl;
+ if (!silent)cout << e.getFunctionName() << " ";
+ if (!silent)cout << e.getMessageText() << endl;
+ return 0;
+ }
+ try {
+ DataObjectPtr dob1 = dor->getDataObject("departments[1]/employees[bool=doughnut]");
+ return 0;
+ }
+ catch (SDORuntimeException e)
+ {
+ fprintf(f, "Normal exception caught\n");
+ }
+
+ try {
+ DataObjectPtr dob1 = dor->getDataObject("departments[4]/employees[bool=true]");
+ return 0;
+ }
+ catch (SDORuntimeException e)
+ {
+ fprintf(f, "Normal exception caught\n");
+ }
+
+ try {
+ DataObjectPtr dob1 = dor->getDataObject("departments[1]/employees[bytes=whoomp!]");
+ return 0;
+ }
+ catch (SDORuntimeException e)
+ {
+ fprintf(f, "Normal exception caught\n");
+ }
+
+ try {
+ DataObjectPtr dob1 = dor->getDataObject("departments[1]/blmployees[bool=true]");
+ return 0;
+ }
+ catch (SDORuntimeException e)
+ {
+ fprintf(f, "Normal exception caught\n");
+ }
+
+ try {
+ DataObjectPtr dob1 = dor->getDataObject("departments[teapot]/employees[bool=true]");
+ return 0;
+ }
+
+ catch (SDORuntimeException e)
+ {
+ fprintf(f, "Normal exception caught\n");
+ }
+
+ delete[] bytes;
+ delete[] bytes2;
+ delete[] bytes3;
+ delete[] mbytes;
+ delete[] mbytes2;
+ delete[] mbytes3;
+
+ fclose (f);
+ return comparefiles("querytest.dat","querytest.txt");
+}
+
+int sdotest::setmany()
+{
+
+ FILE *f;
+ f = fopen("setmany.dat","w+");
+ if (f == 0)
+ {
+ if (!silent) cout << "Unable to open setmany.dat" << endl;
+ }
+
+ DataFactoryPtr mdg = DataFactory::getDataFactory();
+
+ mdg->addType("myspace","School");
+ mdg->addType("myspace","Class");
+ mdg->addType("myspace","Teacher");
+ mdg->addType("myspace","Child");
+ mdg->addType("myspace","Address");
+
+ /* Now add the properties to the types...*/
+
+
+ const Type& tstring = mdg->getType("commonj.sdo","String");
+ const Type& tint = mdg->getType("commonj.sdo","Int");
+ const Type& ts = mdg->getType("myspace","School");
+ const Type& tc = mdg->getType("myspace","Class");
+ const Type& tch = mdg->getType("myspace","Child");
+ const Type& tt = mdg->getType("myspace","Teacher");
+ const Type& ta = mdg->getType("myspace","Address");
+
+ mdg->addPropertyToType(tc,"name",tstring);
+ mdg->addPropertyToType(ts,"name",tstring);
+ mdg->addPropertyToType(tch,"name",tstring);
+ mdg->addPropertyToType(tt,"name",tstring);
+
+ mdg->addPropertyToType(tc,"number",tint);
+ mdg->addPropertyToType(ts,"number",tint);
+ mdg->addPropertyToType(tch,"number",tint);
+ mdg->addPropertyToType(tt,"number",tint);
+
+ mdg->addPropertyToType(ts,"classes", tc,true);
+ mdg->addPropertyToType(tc,"children", tch,true);
+ mdg->addPropertyToType(tc,"teacher", tt);
+
+ mdg->addPropertyToType(tch,"address", ta);
+ mdg->addPropertyToType(ts,"address", ta);
+ mdg->addPropertyToType(tt,"address", ta);
+
+ mdg->addPropertyToType(ta,"lines", tstring, true);
+
+ DataObjectPtr school = mdg->create((Type&)ts);
+
+ DataObjectPtr class1 = school->createDataObject("classes");
+ DataObjectPtr class2 = school->createDataObject("classes");
+
+ DataObjectPtr teach1 = class1->createDataObject("teacher");
+
+ DataObjectPtr kid1 = class1->createDataObject("children");
+ DataObjectPtr kid2 = class1->createDataObject("children");
+ DataObjectPtr kid3 = class1->createDataObject("children");
+
+ DataObjectPtr teach2 = class2->createDataObject("teacher");
+
+ DataObjectPtr kid4 = class2->createDataObject("children");
+ DataObjectPtr kid5 = class2->createDataObject("children");
+ DataObjectPtr kid6 = class2->createDataObject("children");
+
+ school->setCString("name","King Norberts");
+ school->createDataObject("address");
+ DataObjectList& lines = school->getList("address/lines");
+ lines.append("The Place");
+ lines.append("1 The Avenue");
+ lines.append("Murchester");
+ lines.append("England");
+
+ class1->setCString("name","Primary");
+ class2->setCString("name","Secondary");
+
+ class1->setCString("teacher/name","Mr Philbert Chloroform");
+ class2->setCString("teacher/name","Mr Brian Onasis");
+
+ kid1->setCString("name", "Witherspoon Jnr");
+ kid2->setCString("name", "Snape");
+ kid3->setCString("name", "Thannet");
+ kid4->setCString("name", "Grimbling");
+ kid5->setCString("name", "Snagget Minor");
+ kid6->setCString("name", "Van Den Bograt");
+
+ kid1->setInt("number", 1);
+ kid2->setInt("number", 2);
+ kid3->setInt("number", 3);
+ kid4->setInt("number", 4);
+ kid5->setInt("number", 5);
+ kid6->setInt("number", 6);
+
+ fprintf(f," School :%s\n", school->getCString("name"));
+
+ fprintf(f," Address1:%s\n",school->getCString("address/lines.0"));
+ fprintf(f," Address2:%s\n",school->getCString("address/lines.1"));
+ fprintf(f," Address3:%s\n",school->getCString("address/lines.2"));
+ fprintf(f," Address4:%s\n",school->getCString("address/lines.3"));
+
+ fprintf(f," Class :%s\n",class1->getCString("name"));
+ fprintf(f," Teacher :%s\n",class1->getCString("teacher/name"));
+ fprintf(f," Pupil1 :%s\n",class1->getCString("children.0/name"));
+ fprintf(f," Pupil2 :%s\n",class1->getCString("children[number=2]/name"));
+ fprintf(f," Pupil3 :%s\n",class1->getCString("children[3]/name"));
+
+ fprintf(f," Class :%s\n",class2->getCString("name"));
+ fprintf(f," Teacher :%s\n",class2->getCString("teacher/name"));
+ fprintf(f," Pupil1 :%s\n",class2->getCString("children[1]/name"));
+ fprintf(f," Pupil2 :%s\n",class2->getCString("children.1/name"));
+ fprintf(f," Pupil3 :%s\n",class2->getCString("children[number=6]/name"));
+
+ try {
+ fprintf(f," Pupil3 :%s\n",class2->getCString("children[4]/name"));
+ return 0;
+ }
+ catch (const SDOIndexOutOfRangeException&)
+ {
+ fprintf(f,"Expected path not found exception caught\n");
+ }
+ if (XpathHelper::isIndexed("abc[2]")) {
+ fprintf(f, "Indexed as expected\n");
+ }
+ else {
+ fprintf(f, "Bad - not indexed\n");
+ }
+
+ if (XpathHelper::isIndexed("wibble/[2]")) {
+ fprintf(f, "Indexed as expected\n");
+ }
+ else {
+ fprintf(f, "Bad - not indexed\n");
+ }
+
+ if (XpathHelper::isIndexed("wibble/wobble[2]")) {
+ fprintf(f, "Indexed as expected\n");
+ }
+ else {
+ fprintf(f, "Bad - not indexed\n");
+ }
+
+ if (XpathHelper::isIndexed("wibble/wobble.2")) {
+ fprintf(f, "Indexed as expected\n");
+ }
+ else {
+ fprintf(f, "Bad - not indexed\n");
+ }
+
+ if (XpathHelper::isIndexed("wibble/wobble.2")) {
+ fprintf(f, "Indexed as expected\n");
+ }
+ else {
+ fprintf(f, "Bad - not indexed\n");
+ }
+
+ try {
+ fprintf(f," Address5 :%s\n",school->getCString("address/lines[5]"));
+ return 0;
+ }
+ catch (SDOIndexOutOfRangeException e)
+ {
+ fprintf(f,"Normal index out of range caught\n");
+ }
+
+ try {
+ school->getList("address/lines").append("PostCode");
+ fprintf(f," Address4 :%s\n",school->getCString("address/lines[5]"));
+ }
+ catch (SDORuntimeException e)
+ {
+ if (!silent)cout <<"Unexpected exception"<< endl;
+ return 0;
+ }
+
+ fclose(f);
+ return comparefiles("setmany.dat","setmany.txt");
+}
+
+int sdotest::carotest2()
+{
+ try {
+ DataFactoryPtr mdg = DataFactory::getDataFactory();
+
+ mdg->addType("myspace","root");
+
+ mdg->addPropertyToType("myspace","root","cs",
+ "commonj.sdo","ChangeSummary", false, false, false);
+
+ const Type& troot = mdg->getType("myspace","root");
+
+ DataObjectPtr root = mdg->create((Type&)troot);
+ return 1;
+ }
+ catch (SDORuntimeException e)
+ {
+ return 0;
+ }
+}
+
+int sdotest::adddeletetest()
+{
+ try {
+ DataFactoryPtr mdg = DataFactory::getDataFactory();
+
+ mdg->addType("myspace","root");
+ mdg->addType("myspace","bill");
+
+ mdg->addPropertyToType("myspace","root","cs",
+ "commonj.sdo","ChangeSummary", false, false, false);
+
+ mdg->addPropertyToType("myspace","root","bill",
+ "myspace","bill");
+
+ const Type& troot = mdg->getType("myspace","root");
+
+ DataObjectPtr root = mdg->create((Type&)troot);
+
+ ChangeSummaryPtr cs = root->getChangeSummary();
+ cs->beginLogging();
+ DataObjectPtr dob = root->createDataObject("bill");
+ root->unset("bill");
+ return 1;
+ }
+ catch (SDORuntimeException e)
+ {
+ return 0;
+ }
+}
+
+int sdotest::carotest()
+{
+
+ DataFactoryPtr mdg = DataFactory::getDataFactory();
+
+ mdg->addType("myspace","root");
+ mdg->addType("myspace","company");
+ mdg->addType("myspace","department");
+ mdg->addType("myspace","employee");
+
+ mdg->addPropertyToType("myspace","root","cs",
+ "commonj.sdo","ChangeSummary", false, false, false);
+
+ mdg->addPropertyToType("myspace","company","name",
+ "commonj.sdo","String", false, false, false);
+
+
+ mdg->addPropertyToType("myspace","department","name",
+ "commonj.sdo","String", false, false, false);
+
+ mdg->addPropertyToType("myspace","employee","name",
+ "commonj.sdo","String", false, false, false);
+
+
+ mdg->addPropertyToType("myspace","root","companies",
+ "myspace","company", true, false, true);
+
+ mdg->addPropertyToType("myspace","company","departments",
+ "myspace","department", true, false, true);
+
+ mdg->addPropertyToType("myspace","company","eotm",
+ "myspace","employee", false, false, false);
+
+ mdg->addPropertyToType("myspace","department","employees",
+ "myspace","employee", true, false, true);
+
+ const Type& troot = mdg->getType("myspace","root");
+
+
+ DataObjectPtr root = mdg->create((Type&)troot);
+ ChangeSummaryPtr cs = root->getChangeSummary();
+
+ cs->beginLogging();
+
+ DataObjectPtr comp = root->createDataObject("companies");
+
+ comp->setCString("name","Acme");
+
+ //cout << "name of the company is " << comp->getCString("name") << endl;
+ try {
+ root->unset("companies[0]");
+ return 1;
+ }
+ catch (SDOUnsupportedOperationException e)
+ {
+ if (!silent)cout << "Abnormal unsupported operation for unset of many valued item" << endl;
+ return 0;
+ }
+}
+
+
+int sdotest::bug2()
+{
+
+ FILE *f;
+
+ f = fopen("bug2.dat","w+");
+ if (f == 0)
+ {
+ if (!silent)cout << "Unable to open bug2.dat" << endl;
+ return 0;
+ }
+
+ try {
+ DataFactoryPtr mdg = DataFactory::getDataFactory();
+
+ mdg->addType("myspace","root");
+ mdg->addType("myspace","company");
+
+ mdg->addPropertyToType("myspace","root","cs",
+ "commonj.sdo","ChangeSummary", false, false, false);
+
+ mdg->addPropertyToType("myspace","company","name",
+ "commonj.sdo","String", false, false, false);
+
+
+ mdg->addPropertyToType("myspace","root","companies",
+ "myspace","company", true, false, true);
+
+
+ const Type& troot = mdg->getType("myspace","root");
+
+
+ DataObjectPtr root = mdg->create((Type&)troot);
+
+ ChangeSummaryPtr cs = root->getChangeSummary();
+
+ cs->beginLogging();
+
+ DataObjectPtr comp = root->createDataObject("companies");
+
+ comp->setCString("name","Acme");
+
+ dumpproperties(f,root);
+
+ DataObjectList& dl = root->getList("companies");
+ dl.remove(0);
+
+ dumpproperties(f,root);
+
+
+ fprintf(f, "Change summary should have no entries...\n");
+
+ dumpchangesummary(f,cs);
+
+ dumpproperties(f,root);
+
+ fprintf(f, "Change summary should have no entries...\n");
+
+ dumpchangesummary(f,cs);
+
+ fclose(f);
+ return comparefiles("bug2.dat","bug2.txt");
+
+ }
+ catch (SDORuntimeException e)
+ {
+ if (!silent) cout << e.getEClassName() << " in ";
+ if (!silent) cout << e.getFileName() << " at line ";
+ if (!silent) cout << e.getLineNumber() << endl;
+ if (!silent) cout << e.getFunctionName() << " ";
+ if (!silent) cout << e.getMessageText() << endl;
+ return 0;
+ }
+}
+
+
+int sdotest::dumpproperties(FILE *f, DataObjectPtr root)
+{
+ PropertyList pl = root->getInstanceProperties();
+ for (unsigned int i=0;i<pl.size();i++)
+ {
+ if (pl[i].isMany())
+ {
+ DataObjectList& dl = root->getList(pl[i]);
+ if (pl[i].getType().isDataType())
+ {
+ char buf[10];
+ for (unsigned int j=0;j<dl.size();j++)
+ {
+
+ sprintf(buf,"%02d",j);
+ fprintf(f,"MProperty:%s[%s]:%s\n",
+ pl[i].getName(),buf,dl.getCString(j));
+ }
+ }
+ else
+ {
+ fprintf(f,"MObject Property %s\n",pl[i].getName());
+ for (unsigned int j=0;j<dl.size();j++)
+ {
+ if (dl[j] != 0)
+ {
+ dumpproperties(f, dl[j]);
+ }
+ }
+ fprintf(f,"End of MObject Property %s\n",pl[i].getName());
+ }
+ }
+
+ else
+ {
+ if (pl[i].getType().isDataType())
+ {
+ fprintf(f,"Property:%s:%s\n",pl[i].getName(),root->getCString(pl[i]));
+ }
+ else
+ {
+ fprintf(f,"Object Property%s\n:",pl[i].getName());
+ DataObjectPtr d = root->getDataObject(pl[i]);
+ if (d != 0)
+ {
+ dumpproperties(f, d);
+ }
+ else
+ {
+ fprintf(f," Value was not set or null\n");
+ }
+ fprintf(f,"End of Object Property %s\n",pl[i].getName());
+ }
+ }
+ }
+ return 1;
+}
+
+
+int sdotest::datetest()
+{
+
+ try {
+
+ FILE *f = fopen("datetest.dat","w+");
+ if (f == 0)
+ {
+ if (!silent)cout << "Unable to open datetest.dat" << endl;
+ return 0;
+ }
+
+ DataFactoryPtr mdg = DataFactory::getDataFactory();
+
+ mdg->addType("myspace","root");
+ mdg->addType("myspace","company");
+
+ mdg->addPropertyToType("myspace","root","cs",
+ "commonj.sdo","ChangeSummary", false, false, false);
+
+ mdg->addPropertyToType("myspace","company","name",
+ "commonj.sdo","String", false, false, false);
+
+ mdg->addPropertyToType("myspace","company","startupdate",
+ "commonj.sdo","Date", false, false, false);
+
+ mdg->addPropertyToType("myspace","company","reviewdates",
+ "commonj.sdo","Date", true, false, false);
+
+
+ mdg->addPropertyToType("myspace","root","company",
+ "myspace","company", false, false, true);
+
+
+
+ const Type& troot = mdg->getType("myspace","root");
+
+
+ DataObjectPtr root = mdg->create((Type&)troot);
+ ChangeSummaryPtr cs = root->getChangeSummary();
+
+ cs->beginLogging();
+
+ DataObjectPtr comp = root->createDataObject("company");
+
+
+ comp->setCString("name","DateTest");
+
+ fprintf(f,"Name of the company is %s\n",comp->getCString("name"));
+
+ comp->setDate("startupdate",SDODate( 1000 ));
+
+ fprintf(f,"Set start of the company is %d\n",comp->getDate("startupdate").getTime());
+
+ DataObjectList& dol = comp->getList("reviewdates");
+
+ dol.append(SDODate(2000));
+ dol.append(SDODate(4000));
+
+ for (unsigned int i=0;i < dol.size(); i++)
+ {
+ fprintf(f,"Review number:%d was:%d\n", i,dol.getDate(i).getTime());
+
+ // ascTime gives different values on windows and linux,
+ // so comparison of the output is not a valid test.
+
+ //fprintf(f,"Formatted:%d was:%s\n",i,dol.getDate(i).ascTime());
+ }
+
+ cs->endLogging();
+
+ fclose(f);
+
+ return comparefiles("datetest.dat","datetest.txt");
+ }
+
+ catch (SDORuntimeException e)
+ {
+ if (!silent)cout << e.getEClassName() << " in ";
+ if (!silent)cout << e.getFileName() << " at line ";
+ if (!silent)cout << e.getLineNumber() << endl;
+ if (!silent)cout << e.getFunctionName() << " ";
+ if (!silent)cout << e.getMessageText() << endl;
+ return 0;
+ }
+
+}
+
+int sdotest::matttest1()
+{
+
+ try {
+ FILE *f = fopen("matttest1.dat","w+");
+ if (f == 0)
+ {
+ if (!silent)cout << "Unable to open matttest1.dat" << endl;
+ return 0;
+ }
+
+ DataFactoryPtr mdg = DataFactory::getDataFactory();
+
+ mdg->addType("myspace","root");
+ mdg->addType("myspace","company");
+ mdg->addType("myspace","department");
+ mdg->addType("myspace","employee");
+
+ mdg->addPropertyToType("myspace","root","cs",
+ "commonj.sdo","ChangeSummary", false, false, false);
+
+ mdg->addPropertyToType("myspace","company","name",
+ "commonj.sdo","String", false, false, false);
+
+
+ mdg->addPropertyToType("myspace","department","name",
+ "commonj.sdo","String", false, false, false);
+
+ mdg->addPropertyToType("myspace","employee","name",
+ "commonj.sdo","String", false, false, false);
+
+
+ mdg->addPropertyToType("myspace","root","companies",
+ "myspace","company", true, false, true);
+
+ mdg->addPropertyToType("myspace","company","departments",
+ "myspace","department", true, false, true);
+
+ mdg->addPropertyToType("myspace","company","eotm",
+ "myspace","employee", false, false, false);
+
+ mdg->addPropertyToType("myspace","department","employees",
+ "myspace","employee", true, false, true);
+
+ const Type& troot = mdg->getType("myspace","root");
+
+
+ DataObjectPtr root = mdg->create((Type&)troot);
+
+ DataObjectPtr comp = root->createDataObject("companies");
+
+ comp->setCString("name","Acme");
+
+ DataObjectPtr dept1 = comp->createDataObject("departments");
+
+ dept1->setCString("name","Shoe");
+
+ DataObjectPtr dept2 = comp->createDataObject("departments");
+
+ dept2->setCString("name","IT");
+
+ DataObjectPtr sue = dept1->createDataObject("employees");
+
+ sue->setCString("name","Sue");
+
+ DataObjectPtr billy = dept2->createDataObject("employees");
+
+ billy->setCString("name","Billy");
+
+ // Want to swap Sue and Billy so, while holding them in variables, should be
+ //able to unset from department then reinsert
+
+ // method 1 - clear the lists...
+ dept1->unset("employees");
+ dept2->unset("employees");
+
+ DataObjectPtr cont = billy->getContainer();
+
+ if (cont != 0)
+ {
+ if (!silent)cout << "Container of Billy should be zero, but is :" << cont->getCString("name") << endl;
+ return 0;
+ }
+
+ DataObjectList& li1 = dept1->getList("employees");
+ DataObjectList& li2 = dept2->getList("employees");
+ li1.append(billy);
+ li2.append(sue);
+
+ DataObjectPtr cont2 = billy->getContainer();
+
+ if (cont2 != 0)
+ {
+ fprintf(f,"Container of Billy should be dept1, and is :%s\n", cont2->getCString("name"));
+ }
+ else {
+ if (!silent)cout << "Problem - Billy is not contained." << endl;
+ return 0;
+ }
+
+ li1.remove(0);
+ li2.remove(0);
+
+ DataObjectPtr cont3 = billy->getContainer();
+
+ if (cont3 != 0)
+ {
+ if (!silent)cout << "Container of Billy should be zero, but is :" << cont3->getCString("name") << endl;
+ return 0;
+ }
+
+ li1.append(sue);
+ li2.append(billy);
+
+ DataObjectPtr cont4 = billy->getContainer();
+
+ if (cont4 != 0)
+ {
+ fprintf(f,"Container of Billy should be dept2, and is :%s\n", cont4->getCString("name"));
+ }
+ else {
+ if (!silent)cout << "Problem - Billy is not contained." << endl;
+ return 0;
+ }
+
+ fclose(f);
+
+ return comparefiles("matttest1.dat","matttest1.txt");
+
+ }
+ catch (SDORuntimeException e)
+ {
+ if (!silent)cout << e.getEClassName() << " in ";
+ if (!silent)cout << e.getFileName() << " at line ";
+ if (!silent)cout << e.getLineNumber() << endl;
+ if (!silent)cout << e.getFunctionName() << " ";
+ if (!silent)cout << e.getMessageText() << endl;
+ return 0;
+ }
+}
+
+int sdotest::carotest3()
+{
+ // sequence new APIs
+ // data object list, new getLength(unsigned int)
+
+
+ FILE *f = fopen("carotest3.dat","w+");
+ if (f == 0)
+ {
+ if (!silent)cout << "Unable to open carotest3.dat" << endl;
+ return 0;
+ }
+ DataFactoryPtr mdg = DataFactory::getDataFactory();
+ // company is sequenced.
+ mdg->addType("myspace","Company",true,false);
+
+ mdg->addType("myspace","Department",true,false);
+ // string is many
+
+ mdg->addPropertyToType("myspace","Company","string","commonj.sdo","String",
+ true);
+
+ mdg->addPropertyToType("myspace","Company","departments","myspace","Department",
+ true);
+
+ mdg->addPropertyToType("myspace","Company","strings","commonj.sdo","String",
+ true);
+
+ mdg->addPropertyToType("myspace","Company","ints","commonj.sdo","Int",
+ true);
+
+
+ mdg->addPropertyToType("myspace","Department","name","commonj.sdo","String");
+
+
+ const Type& tcc = mdg->getType("myspace","Company");
+
+ DataObjectPtr dor = mdg->create(tcc);
+ const Property& sprop = dor->getType().getProperty("string");
+
+ SequencePtr sptr = dor->getSequence();
+
+ printseq(f,sptr);
+
+ sptr->addCString(sprop,"I am Item 1 of string");
+
+ printseq(f,sptr);
+
+ sptr->addText("I am the first free text");
+
+ printseq(f,sptr);
+
+ sptr->addCString(sprop,"I am Item 2 of string");
+
+ printseq(f,sptr);
+
+ sptr->setText(1,"I am free text which has been modified");
+
+ printseq(f,sptr);
+
+ DataObjectPtr dep1 = dor->createDataObject("departments");
+
+ printseq(f,sptr);
+
+ dep1->setCString("name","department1");
+
+ printseq(f,sptr);
+
+ DataObjectList& dol = dor->getList("departments");
+
+ unsigned int ii = dol.getLength(0);
+
+ if (ii != 0)
+ {
+ if (!silent)cout << "Length of a data object should be zero:" << ii << endl;
+ return 0;
+ }
+
+ DataObjectList& strl = dor->getList("strings");
+
+ wchar_t * buf = new wchar_t[5];
+ buf[0] = 'a';
+ buf[1] = 'b';
+ buf[2] = 'c';
+ buf[3] = 'd';
+ buf[4] = 'e';
+
+ strl.append(buf,1);
+ strl.append(buf,2);
+ strl.append(buf,3);
+ strl.append(buf,4);
+ strl.append(buf,5);
+
+ fprintf(f,"Element zero, length 1: %d\n",strl.getLength(0));
+ fprintf(f,"Element one, length 2: %d\n",strl.getLength(1));
+ fprintf(f,"Element two, length 3: %d\n",strl.getLength(2));
+ fprintf(f,"Element three,length 4: %d\n",strl.getLength(3));
+ fprintf(f,"Element four, length 5: %d\n",strl.getLength(4));
+
+ try {
+ int xx = strl.getLength(5);
+ if (!silent)cout << "problem - element 5 should not exist" << endl;
+ return 0;
+ }
+ catch (SDOIndexOutOfRangeException e)
+ {
+ if (!silent)cout << "Normal out of range exception in test" << endl;
+ }
+
+ DataObjectList& numl = dor->getList("ints");
+
+ try {
+ int xx2 = numl.getLength(0);
+ if (!silent)cout << "problem - element 0 should not exist" << endl;
+ return 0;
+ }
+ catch (SDOIndexOutOfRangeException e)
+ {
+ if (!silent)cout << "Normal out of range exception in test" << endl;
+ }
+ fclose(f);
+ return comparefiles("carotest3.dat","carotest3.txt");
+}
+
+
+int sdotest::eqhelpertest()
+{
+
+ // copy and equality helpers
+
+ DataFactoryPtr mdg = DataFactory::getDataFactory();
+
+ mdg->addType("myspace","Assembly");
+ mdg->addType("myspace","SubAssembly");
+ mdg->addType("myspace","Part");
+
+ /* Now add the properties to the types...*/
+
+
+ const Type& tstring = mdg->getType("commonj.sdo","String");
+ const Type& tint = mdg->getType("commonj.sdo","Int");
+ const Type& tassy = mdg->getType("myspace","Assembly");
+ const Type& tsubassy = mdg->getType("myspace","SubAssembly");
+ const Type& tpart = mdg->getType("myspace","Part");
+
+
+ mdg->addPropertyToType(tassy,"name",tstring);
+ mdg->addPropertyToType(tsubassy,"name",tstring);
+ mdg->addPropertyToType(tpart,"name",tstring);
+
+ mdg->addPropertyToType(tassy,"number",tint);
+ mdg->addPropertyToType(tsubassy,"number",tint);
+ mdg->addPropertyToType(tpart,"number",tint);
+
+ mdg->addPropertyToType(tassy,"subassemblies", tsubassy,true);
+ mdg->addPropertyToType(tsubassy,"parts", tpart,true);
+
+
+ // assy 1
+
+ DataObjectPtr assy1 = mdg->create((Type&)tassy);
+
+ DataObjectPtr subassy1 = assy1->createDataObject("subassemblies");
+ DataObjectPtr subassy2 = assy1->createDataObject("subassemblies");
+
+ DataObjectPtr part1 = subassy1->createDataObject("parts");
+ DataObjectPtr part2 = subassy1->createDataObject("parts");
+ DataObjectPtr part3 = subassy1->createDataObject("parts");
+
+ DataObjectPtr part4 = subassy2->createDataObject("parts");
+ DataObjectPtr part5 = subassy2->createDataObject("parts");
+ DataObjectPtr part6 = subassy2->createDataObject("parts");
+
+
+ assy1->setCString("name","MicroFrame");
+ assy1->setInt("number",32768);
+
+ subassy1->setCString("name","Legs");
+ subassy2->setCString("name","Body");
+ subassy1->setInt("number",1);
+ subassy2->setInt("number",2);
+
+ part1->setCString("name","Leg1");
+ part2->setCString("name","Leg2");
+ part3->setCString("name","Leg3");
+ part1->setInt("number",10001);
+ part2->setInt("number",10002);
+ part3->setInt("number",10003);
+
+
+ part4->setCString("name","MainStrut");
+ part5->setCString("name","Brace1");
+ part6->setCString("name","Brace2");
+ part4->setInt("number",20001);
+ part5->setInt("number",20002);
+ part6->setInt("number",20003);
+
+ // assy2 - shallow equal to assy, but not deep equal
+
+ DataObjectPtr assy2 = mdg->create((Type&)tassy);
+
+ DataObjectPtr subassy3 = assy2->createDataObject("subassemblies");
+ DataObjectPtr subassy4 = assy2->createDataObject("subassemblies");
+
+ DataObjectPtr part7 = subassy3->createDataObject("parts");
+ DataObjectPtr part8 = subassy3->createDataObject("parts");
+ DataObjectPtr part9 = subassy3->createDataObject("parts");
+
+ DataObjectPtr part10 = subassy4->createDataObject("parts");
+ DataObjectPtr part11 = subassy4->createDataObject("parts");
+ DataObjectPtr part12 = subassy4->createDataObject("parts");
+
+
+ assy2->setCString("name","MicroFrame");
+ assy2->setInt("number",32768);
+
+ subassy3->setCString("name","Legs");
+ subassy4->setCString("name","Body");
+ subassy3->setInt("number",1);
+ subassy4->setInt("number",2);
+
+ part7->setCString("name","Leg1");
+ part8->setCString("name","Leg2");
+ part9->setCString("name","Leg3");
+ part7->setInt("number",10001);
+ part8->setInt("number",10002);
+ part9->setInt("number",10003);
+
+
+ part10->setCString("name","MainStrut");
+ part11->setCString("name","Brace1");
+ part12->setCString("name","OddBrace2");
+ part10->setInt("number",20001);
+ part11->setInt("number",20002);
+ part12->setInt("number",20003);
+
+ if (!EqualityHelper::equalShallow(assy1, assy2))
+ {
+ if (!silent) cout << "EQUALITY HELPER TEST - failure at first test" << endl;
+ return 0;
+ }
+ if (EqualityHelper::equal(assy1, assy2))
+ {
+ if (!silent)cout << "EQUALITY HELPER TEST - failure at second test" << endl;
+ return 0;
+ }
+
+ // Now alter assy2 to be deep equal...
+
+
+ part12->setCString("name","Brace2");
+
+ if (!EqualityHelper::equalShallow(assy1, assy2))
+ {
+ if (!silent)cout << "EQUALITY HELPER TEST - failure at third test" << endl;
+ return 0;
+ }
+ if (!EqualityHelper::equal(assy1, assy2))
+ {
+ if (!silent)cout << "EQUALITY HELPER TEST - failure at fourth test" << endl;
+ return 0;
+ }
+
+ // now add a part, so its not deep equal again
+ DataObjectPtr part13 = subassy4->createDataObject("parts");
+
+ if (!EqualityHelper::equalShallow(assy1, assy2))
+ {
+ if (!silent)cout << "EQUALITY HELPER TEST - failure at fifth test" << endl;
+ return 0;
+ }
+ if (EqualityHelper::equal(assy1, assy2))
+ {
+ if (!silent)cout << "EQUALITY HELPER TEST - failure at sixth test" << endl;
+ return 0;
+ }
+
+ // now remove that part again...
+ DataObjectList& dl = subassy4->getList("parts");
+ dl.remove(3);
+
+ // should be deep equal again...
+
+ if (!EqualityHelper::equalShallow(assy1, assy2))
+ {
+ if (!silent)cout << "EQUALITY HELPER TEST - failure at seventh test" << endl;
+ return 0;
+ }
+ if (!EqualityHelper::equal(assy1, assy2))
+ {
+ if (!silent)cout << "EQUALITY HELPER TEST - failure at eighth test" << endl;
+ return 0;
+ }
+ // now make them not shallow equal
+ assy2->setInt("number",32767);
+
+ if (EqualityHelper::equalShallow(assy1, assy2))
+ {
+ if (!silent)cout << "EQUALITY HELPER TEST - failure at nineth test" << endl;
+ return 0;
+ }
+ if (EqualityHelper::equal(assy1, assy2))
+ {
+ if (!silent)cout << "EQUALITY HELPER TEST - failure at tenth test" << endl;
+ return 0;
+ }
+ return 1;
+}
+
+int sdotest::cohelpertest()
+{
+
+ // copy and equality helpers
+
+ DataFactoryPtr mdg = DataFactory::getDataFactory();
+
+ mdg->addType("myspace","Assembly");
+ mdg->addType("myspace","SubAssembly");
+ mdg->addType("myspace","Part");
+
+ /* Now add the properties to the types...*/
+
+
+ const Type& tstring = mdg->getType("commonj.sdo","String");
+ const Type& tint = mdg->getType("commonj.sdo","Int");
+ const Type& tassy = mdg->getType("myspace","Assembly");
+ const Type& tsubassy = mdg->getType("myspace","SubAssembly");
+ const Type& tpart = mdg->getType("myspace","Part");
+
+
+ mdg->addPropertyToType(tassy,"name",tstring);
+ mdg->addPropertyToType(tsubassy,"name",tstring);
+ mdg->addPropertyToType(tpart,"name",tstring);
+
+ mdg->addPropertyToType(tassy,"number",tint);
+ mdg->addPropertyToType(tsubassy,"number",tint);
+ mdg->addPropertyToType(tpart,"number",tint);
+
+ mdg->addPropertyToType(tassy,"subassemblies", tsubassy,true);
+ mdg->addPropertyToType(tsubassy,"parts", tpart,true);
+
+
+ // assy 1
+
+ DataObjectPtr assy1 = mdg->create((Type&)tassy);
+
+ DataObjectPtr subassy1 = assy1->createDataObject("subassemblies");
+ DataObjectPtr subassy2 = assy1->createDataObject("subassemblies");
+
+ DataObjectPtr part1 = subassy1->createDataObject("parts");
+ DataObjectPtr part2 = subassy1->createDataObject("parts");
+ DataObjectPtr part3 = subassy1->createDataObject("parts");
+
+ DataObjectPtr part4 = subassy2->createDataObject("parts");
+ DataObjectPtr part5 = subassy2->createDataObject("parts");
+ DataObjectPtr part6 = subassy2->createDataObject("parts");
+
+
+ assy1->setCString("name","MicroFrame");
+ assy1->setInt("number",32768);
+
+ subassy1->setCString("name","Legs");
+ subassy2->setCString("name","Body");
+ subassy1->setInt("number",1);
+ subassy2->setInt("number",2);
+
+ part1->setCString("name","Leg1");
+ part2->setCString("name","Leg2");
+ part3->setCString("name","Leg3");
+ part1->setInt("number",10001);
+ part2->setInt("number",10002);
+ part3->setInt("number",10003);
+
+
+ part4->setCString("name","MainStrut");
+ part5->setCString("name","Brace1");
+ part6->setCString("name","Brace2");
+ part4->setInt("number",20001);
+ part5->setInt("number",20002);
+ part6->setInt("number",20003);
+
+ // first lets shallow copy assy1:
+
+ DataObjectPtr assy2 = CopyHelper::copyShallow(assy1);
+
+ if (strcmp(assy2->getCString("name"),"MicroFrame"))
+ {
+ if (!silent)cout << "COPYHELPER shallow copy failed(1)" << endl;
+ return 0;
+ }
+ else if (assy2->getInt("number") != 32768)
+ {
+ if (!silent)cout << "COPYHELPER shallow copy 1 failed(2)" << endl;
+ return 0;
+ }
+ else if (assy2->getList("subassemblies").size() != 0)
+ {
+ if (!silent)cout << "COPYHELPER shallow copy 1 failed(3)" << endl;
+ return 0;
+ }
+ else if (assy2->getContainer() != 0)
+ {
+ if (!silent)cout << "COPYHELPER shallow copy failed(4)" << endl;
+ return 0;
+ }
+
+ // now deep copy it
+
+ DataObjectPtr assy3 = CopyHelper::copy(assy1);
+
+ if (!EqualityHelper::equal(assy1, assy3))
+ {
+ if (!silent)cout << "COPYHELPER deep copy failed(1)" << endl;
+ return 0;
+ }
+ else if (assy3->getContainer() != 0)
+ {
+ if (!silent)cout << "COPYHELPER deep copy failed(2)" << endl;
+ return 0;
+ }
+ return 1;
+}
+
+
+int sdotest::cssave()
+{
+
+ try {
+
+
+ DataFactoryPtr mdg = DataFactory::getDataFactory();
+
+ XSDHelperPtr xsh = HelperProvider::getXSDHelper(mdg);
+ xsh->defineFile("company.xsd");
+
+ //mdg->addType("companyNS","CompanyType");
+ //mdg->addType("companyNS","EmployeeType");
+ //mdg->addType("companyNS","DepartmentType");
+
+ /* Now add the properties to the types...*/
+
+
+ const Type& tstring = mdg->getType("commonj.sdo","String");
+ const Type& tbool = mdg->getType("commonj.sdo","Boolean");
+ const Type& tcs = mdg->getType("commonj.sdo","ChangeSummary");
+ const Type& tcomp = mdg->getType("companyNS","CompanyType");
+ const Type& tdept = mdg->getType("companyNS","DepartmentType");
+ const Type& temp = mdg->getType("companyNS","EmployeeType");
+
+
+ //mdg->addPropertyToType(tcomp,"name",tstring);
+ // not containment...
+ //mdg->addPropertyToType(tcomp,"employeeOfTheMonth",temp, false,false,false);
+ //mdg->addPropertyToType(tcomp,"departments",tdept, true);
+ //mdg->addPropertyToType(tcomp,"cs",tcs);
+
+ //mdg->addPropertyToType(tdept,"name",tstring);
+ //mdg->addPropertyToType(tdept,"location",tstring);
+ //mdg->addPropertyToType(tdept,"number",tstring);
+ //mdg->addPropertyToType(tdept,"employees",temp,true);
+
+ //mdg->addPropertyToType(temp, "name",tstring);
+ //mdg->addPropertyToType(temp, "SN", tstring);
+ //mdg->addPropertyToType(temp, "manager", tbool);
+
+
+ // create a graph, then save it
+
+ DataObjectPtr comp = mdg->create((Type&)tcomp);
+ comp->setCString("name","ACME");
+
+ DataObjectPtr dept = mdg->create((Type&)tdept);
+ DataObjectList& dol = comp->getList("departments");
+ dol.append(dept);
+
+ dept->setCString("name","Advanced Technologies");
+ dept->setCString("location","NY");
+ dept->setCString("number","123");
+
+ DataObjectPtr emp1 = mdg->create(temp);
+ DataObjectPtr emp2 = mdg->create(temp);
+ DataObjectPtr emp3 = mdg->create(temp);
+
+ emp1->setCString("name","John Jones");
+ emp1->setCString("SN","E0001");
+
+ emp2->setCString("name","Mary Smith");
+ emp2->setCString("SN","E0002");
+ emp2->setBoolean("manager",true);
+
+ emp3->setCString("name","Jane Doe");
+ emp3->setCString("SN","E0003");
+
+ DataObjectList& dol2 = dept->getList("employees");
+ dol2.append(emp1);
+ dol2.append(emp2);
+ dol2.append(emp3);
+
+ comp->setDataObject("employeeOfTheMonth",emp2);
+
+ ChangeSummaryPtr cs = comp->getChangeSummary();
+
+ cs->beginLogging();
+
+ DataObjectPtr emp4 = mdg->create(temp);
+ emp4->setCString("name","Al Smith");
+ emp4->setCString("SN","E0004");
+ emp4->setBoolean("manager",true);
+
+ // first change - create employee 4
+ dol2.append(emp4);
+
+ dol2.remove(1); // element 1 is Mary
+
+ DataObjectPtr emp5 = mdg->create(temp);
+ emp5->setCString("name","Bill Withers");
+ emp5->setCString("SN","E0005");
+
+ dol2.append(emp5);
+
+
+ comp->setCString("name","MegaCorp");
+ comp->setDataObject("employeeOfTheMonth",emp4);
+
+ // silly test - add mary back again
+ dol2.append(emp2);
+
+
+
+
+ cs->endLogging();
+
+
+ XMLHelperPtr xmh = HelperProvider::getXMLHelper(mdg);
+ XMLDocumentPtr doc = xmh->createDocument(comp,"companyNS","company");
+ xmh->save(doc,"cssave-output.xml");
+ return comparefiles("cssave-output.xml","cssave-output.txt");
+
+
+ }
+ catch (SDORuntimeException e)
+ {
+ if (!silent)cout << "CSSAVE FAILED" << e << endl;
+ return 0;
+ }
+}
+
+int sdotest::cssave2()
+{
+
+ try {
+ DataFactoryPtr mdg = DataFactory::getDataFactory();
+
+ XSDHelperPtr xsh = HelperProvider::getXSDHelper(mdg);
+ xsh->defineFile("company.xsd");
+
+
+ const Type& tstring = mdg->getType("commonj.sdo","String");
+ const Type& tbool = mdg->getType("commonj.sdo","Boolean");
+ const Type& tcs = mdg->getType("commonj.sdo","ChangeSummary");
+ const Type& tcomp = mdg->getType("companyNS","CompanyType");
+ const Type& tdept = mdg->getType("companyNS","DepartmentType");
+ const Type& temp = mdg->getType("companyNS","EmployeeType");
+
+
+ // create a graph, then save it
+
+ DataObjectPtr comp = mdg->create((Type&)tcomp);
+ comp->setCString("name","Eastleigh Borough Council");
+
+ DataObjectPtr dept = mdg->create((Type&)tdept);
+ DataObjectList& dol = comp->getList("departments");
+ dol.append(dept);
+
+ dept->setCString("name","Waste Disposal");
+ dept->setCString("location","Botley");
+ dept->setCString("number","123");
+
+ DataObjectPtr emp1 = mdg->create(temp);
+ DataObjectPtr emp2 = mdg->create(temp);
+ DataObjectPtr emp3 = mdg->create(temp);
+ DataObjectPtr emp4 = mdg->create(temp);
+ DataObjectPtr emp5 = mdg->create(temp);
+
+ emp1->setCString("name","Alphonse Dodet");
+ emp1->setCString("SN","E0001");
+
+ emp2->setCString("name","Bridget Jones");
+ emp2->setCString("SN","E0002");
+ emp2->setBoolean("manager",true);
+
+ emp3->setCString("name","Colin Thorne");
+ emp3->setCString("SN","E0003");
+
+ emp4->setCString("name","Donald Trump");
+ emp4->setCString("SN","E0004");
+
+ emp5->setCString("name","Eddy the eagle");
+ emp5->setCString("SN","E0005");
+
+ DataObjectList& dol2 = dept->getList("employees");
+ dol2.append(emp1);
+ dol2.append(emp2);
+ dol2.append(emp3);
+ dol2.append(emp4);
+ dol2.append(emp5);
+
+ //comp->setDataObject("employeeOfTheMonth",emp2);
+
+ DataObjectPtr dept2 = mdg->create((Type&)tdept);
+ dol.append(dept2);
+
+ dept2->setCString("name","Tax Collection");
+ dept2->setCString("location","Winchester");
+ dept2->setCString("number","666");
+
+ DataObjectPtr empb1 = mdg->create(temp);
+ DataObjectPtr empb2 = mdg->create(temp);
+ DataObjectPtr empb3 = mdg->create(temp);
+ DataObjectPtr empb4 = mdg->create(temp);
+ DataObjectPtr empb5 = mdg->create(temp);
+
+ empb1->setCString("name","Arch Meanie");
+ empb1->setCString("SN","D0001");
+
+ empb2->setCString("name","Boris the Spider");
+ empb2->setCString("SN","D0002");
+ empb2->setBoolean("manager",true);
+
+ empb3->setCString("name","Cash Hoarder");
+ empb3->setCString("SN","D0003");
+
+ empb4->setCString("name","Dean Giyatoss");
+ empb4->setCString("SN","D0004");
+
+ empb5->setCString("name","Ebenezer Scrooge");
+ empb5->setCString("SN","D0005");
+
+ DataObjectList& dol3 = dept2->getList("employees");
+ dol3.append(empb1);
+ dol3.append(empb2);
+ dol3.append(empb3);
+ dol3.append(empb4);
+ dol3.append(empb5);
+
+ ChangeSummaryPtr cs = comp->getChangeSummary();
+
+ cs->beginLogging();
+
+ // start by deleting a few employees from dept 1
+
+ dol2.remove(1); // B
+ dol2.remove(1); // C
+ dol2.remove(1); // D
+
+ // Now delete the tax collectors as a whole
+
+ dol.remove(1);
+
+ // now perhaps add back one of the employees
+
+ dol2.append(emp3); // C
+
+ comp->setCString("name","MegaCorp");
+
+ try {
+ comp->setDataObject("employeeOfTheMonth",emp4);
+ if (!silent)cout << "emp4 was not in the tree" << endl;
+ return 0;
+ }
+ catch (SDORuntimeException e)
+ {
+ }
+
+ comp->setDataObject("employeeOfTheMonth",emp5);
+
+ cs->endLogging();
+
+
+ XMLHelperPtr xmh = HelperProvider::getXMLHelper(mdg);
+ XMLDocumentPtr doc = xmh->createDocument(comp,"companyNS","company");
+ xmh->save(doc,"cssave2-output.xml");
+ return comparefiles("cssave2-output.xml","cssave2-output.txt");
+ }
+ catch (SDORuntimeException e)
+ {
+ if (!silent)cout << "CSSAVE FAILED" << e << endl;
+ return 0;
+ }
+}
+
+
+
+
+
+int sdotest::b45933()
+{
+
+ try {
+ DataFactoryPtr mdg = DataFactory::getDataFactory();
+
+
+ mdg->addType("companyNS","CompanyType");
+ mdg->addType("companyNS","WombatType");
+
+ /* Now add the properties to the types...*/
+
+
+ const Type& tstring = mdg->getType("commonj.sdo","String");
+ const Type& tbool = mdg->getType("commonj.sdo","Boolean");
+ const Type& tcs = mdg->getType("commonj.sdo","ChangeSummary");
+ const Type& tcomp = mdg->getType("companyNS","CompanyType");
+ const Type& twom = mdg->getType("companyNS","WombatType");
+
+
+ mdg->addPropertyToType(tcomp,"name",tstring);
+ mdg->addPropertyToType(tcomp,"bools",tbool, true);
+ mdg->addPropertyToType(tcomp,"woms",twom, true);
+ mdg->addPropertyToType(tcomp,"cs",tcs);
+
+
+ // create a graph, then save it
+
+ DataObjectPtr comp = mdg->create((Type&)tcomp);
+ comp->setCString("name","Bug45933");
+
+ ChangeSummaryPtr cs = comp->getChangeSummary();
+
+ cs->beginLogging();
+
+ DataObjectList& dol = comp->getList("bools");
+ dol.append(false);
+ dol.remove(0);
+ DataObjectPtr awom = mdg->create((Type&)twom);
+ DataObjectList& dol2 = comp->getList("woms");
+ dol2.append(awom);
+ dol2.remove(0);
+
+ cs->endLogging();
+
+ //dumpchangesummary(cs);
+
+ XMLHelperPtr xmh = HelperProvider::getXMLHelper(mdg);
+ XMLDocumentPtr doc = xmh->createDocument(comp,"companyNS","company");
+ xmh->save(doc,"bug45933-output.xml");
+ return comparefiles("bug45933-output.xml","bug45933-output.txt");
+ }
+ catch (SDORuntimeException e)
+ {
+ if (!silent)cout << "BUG45933 FAILED" << endl << e << endl;
+ return 0;
+ }
+}
+
+int sdotest::b46617()
+{
+
+ try {
+ DataFactoryPtr mdg = DataFactory::getDataFactory();
+
+ //XSDHelperPtr xsh = HelperProvider::getXSDHelper(mdg);
+ //xsh->defineFile("b46617.xsd");
+ mdg->addType("companyNS","CompanyType");
+ mdg->addType("companyNS","DepartmentType");
+ mdg->addType("companyNS","EmployeeType");
+
+
+
+ const Type& tstring = mdg->getType("commonj.sdo","String");
+ const Type& tbool = mdg->getType("commonj.sdo","Boolean");
+ const Type& tcs = mdg->getType("commonj.sdo","ChangeSummary");
+ const Type& tcomp = mdg->getType("companyNS","CompanyType");
+ const Type& tdept = mdg->getType("companyNS","DepartmentType");
+ const Type& temp = mdg->getType("companyNS","EmployeeType");
+
+ mdg->addPropertyToType(tcomp,"name",tstring);
+ mdg->addPropertyToType(tcomp,"departments",tdept,true,false,true);
+ mdg->addPropertyToType(tcomp,"employeeOfTheMonth",temp,false,false,false);
+ mdg->addPropertyToType(tcomp,"CEO",temp,false,false,true);
+
+ mdg->addPropertyToType(tdept,"employees",temp,true,false,true);
+ mdg->addPropertyToType(tdept,"name",tstring,false,false,true);
+ mdg->addPropertyToType(tdept,"location",tstring,false,false,true);
+ mdg->addPropertyToType(tdept,"number",tstring,false,false,true);
+
+ mdg->addPropertyToType(temp,"name",tstring,false,false,true);
+ mdg->addPropertyToType(temp,"SN",tstring,false,false,true);
+ mdg->addPropertyToType(temp,"manager",tbool,false,false,true);
+
+ // create a graph, then save it
+
+ DataObjectPtr comp = mdg->create((Type&)tcomp);
+ comp->setCString("name","Eastleigh Borough Council");
+
+ DataObjectPtr dept = mdg->create((Type&)tdept);
+ DataObjectList& dol = comp->getList("departments");
+ dol.append(dept);
+
+ dept->setCString("name","Waste Disposal");
+ dept->setCString("location","Botley");
+ dept->setCString("number","123");
+
+ DataObjectPtr emp1 = mdg->create(temp);
+ DataObjectPtr emp2 = mdg->create(temp);
+ DataObjectPtr emp3 = mdg->create(temp);
+
+ emp1->setCString("name","Alphonse Dodet");
+ emp1->setCString("SN","E0001");
+
+ emp2->setCString("name","Bridget Jones");
+ emp2->setCString("SN","E0002");
+ emp2->setBoolean("manager",true);
+
+ emp3->setCString("name","Carl Marx");
+ emp3->setCString("SN","E0003");
+
+ comp->setDataObject("CEO",emp2);
+
+ DataObjectList& dol2 = dept->getList("employees");
+ dol2.append(emp1);
+ //dol2.append(emp2);
+ dol2.append(emp3);
+
+ comp->setDataObject("employeeOfTheMonth",emp2);
+
+ XSDHelperPtr xmd = HelperProvider::getXSDHelper(mdg);
+ xmd->generateFile(mdg->getTypes(),
+ "b46617.xsd","companyNS");
+
+
+ XMLHelperPtr xmh = HelperProvider::getXMLHelper(mdg);
+ XMLDocumentPtr doc = xmh->createDocument(comp,"companyNS","company");
+ xmh->save(doc,"b46617.xml");
+
+ // now try loading the xml, using the same schema, and see if we get the
+ // same answer
+
+ XMLHelperPtr myXMLHelper = HelperProvider::getXMLHelper(mdg);
+ XMLDocumentPtr myXMLDocument = myXMLHelper->loadFile("b46617.xml", "companyNS");
+ DataObjectPtr newdob = myXMLDocument->getRootDataObject();
+
+
+ if (strcmp(newdob->getDataObject("employeeOfTheMonth")->getCString("name"),
+ "Bridget Jones"))
+ {
+ if (!silent)cout << "Employee of the month name has changed" << endl;
+ return 0;
+ }
+
+ return 1;
+
+ }
+ catch (SDORuntimeException e)
+ {
+ if (!silent)cout << "b46617 failed" << e << endl;
+ return 0;
+ }
+}
+
+int sdotest::b46617b()
+{
+
+ try {
+ DataFactoryPtr mdg = DataFactory::getDataFactory();
+
+ XSDHelperPtr xsh = HelperProvider::getXSDHelper(mdg);
+ xsh->defineFile("b46617b.xsd");
+
+ XMLHelperPtr myXMLHelper = HelperProvider::getXMLHelper(mdg);
+ XMLDocumentPtr myXMLDocument = myXMLHelper->loadFile("b46617b.xml", "companyNS");
+ DataObjectPtr newdob = myXMLDocument->getRootDataObject();
+
+ if (strcmp(newdob->getDataObject("employeeOfTheMonth")->getCString("name"),
+ "Fred Smith"))
+ {
+ if (!silent)cout << "Employee of the month name has changed" << endl;
+ return 0;
+ }
+
+ return 1;
+
+ }
+ catch (SDORuntimeException e)
+ {
+ if (!silent)cout << "b46617b failed" << e << endl;
+ return 0;
+ }
+}
+
+int sdotest::notfound()
+{
+
+ DataFactoryPtr mdg = DataFactory::getDataFactory();
+ try {
+
+ XSDHelperPtr xsh = HelperProvider::getXSDHelper(mdg);
+ xsh->defineFile("not_present.xsd");
+ }
+ catch (SDOFileNotFoundException e)
+ {
+ //cout << "NotFound threw correct exception " << endl;
+ }
+
+ catch (SDORuntimeException e)
+ {
+ if (!silent)cout << "NOTFOUND THREW THE WRONG EXCEPTION" << e << endl;
+ return 0;
+ }
+
+ try {
+ XMLHelperPtr myXMLHelper = HelperProvider::getXMLHelper(mdg);
+ XMLDocumentPtr myXMLDocument = myXMLHelper->loadFile("not-present.xml", "companyNS");
+
+ }
+ catch (SDOFileNotFoundException ee)
+ {
+ //cout << "NotFound threw the correct exception" << endl;
+ }
+
+ catch (SDORuntimeException e)
+ {
+ if (!silent)cout << "NOTFOUND THREW THE WRONG EXCEPTION" << e << endl;
+ return 0;
+ }
+ return 1;
+}
+
+int sdotest::csload()
+{
+ try
+ {
+
+ DataFactoryPtr mdg = DataFactory::getDataFactory();
+ XSDHelperPtr xsh = HelperProvider::getXSDHelper(mdg);
+ xsh->defineFile("company.xsd");
+
+ //cout << "TYPES LOADED FROM COMPANY XSD" << endl;
+
+ //TypeList tl = mdg->getTypes();
+ //for (int i=0;i< tl.size(); i++)
+ //{
+ // cout << tl[i].getURI() << ":" << tl[i].getName() << endl;
+ //}
+
+ XMLHelperPtr myXMLHelper = HelperProvider::getXMLHelper(mdg);
+ XMLDocumentPtr myXMLDocument = myXMLHelper->loadFile("cssave-output.xml", "companyNS");
+ //myXMLDocument->setRootElementName("company");
+ //myXMLHelper->save(myXMLDocument,"csload-output.xml");
+ myXMLHelper->save(myXMLDocument->getRootDataObject(),
+ 0, "company", "csload-output.xml");
+
+ return comparefiles("csload-output.xml","csload-output.txt");
+
+ }
+ catch (SDORuntimeException e)
+ {
+ if (!silent)cout << "CSLOAD FAILED" << e << endl;
+ return 0;
+ }
+
+}
+
+int sdotest::testsubsload()
+{
+ try
+ {
+ FILE *f = fopen("testsubsload.dat","w+");
+ if (f == 0)
+ {
+ if (!silent)cout << "Unable to open testsubsload.dat" << endl;
+ return 0;
+ }
+
+ fprintf(f,"TEST: TestSubsLoad ==========================================\n");
+ DataFactoryPtr mdg = DataFactory::getDataFactory();
+ XSDHelperPtr xsh = HelperProvider::getXSDHelper(mdg);
+ xsh->defineFile("companysubs.xsd");
+
+ //cout << "TYPES LOADED FROM COMPANYSUBS XSD" << endl;
+
+ //TypeList tl = mdg->getTypes();
+ //for (int i=0;i< tl.size(); i++)
+ //{
+ // cout << tl[i].getURI() << ":" << tl[i].getName() << endl;
+ //}
+
+ // so now we should be able to put book or a magazine into
+ // the publication under company...
+
+ const Type& tstring = mdg->getType("commonj.sdo","String");
+ const Type& tcomp = mdg->getType("companyNS","CompanyType");
+ const Type& book = mdg->getType("companyNS","BookType");
+ const Type& mag = mdg->getType("companyNS","MagazineType");
+ const Type& pub = mdg->getType("companyNS","PublicationType");
+
+
+ // create a graph, then save it
+
+ DataObjectPtr comp = mdg->create((Type&)tcomp);
+ comp->setCString("name","Puflet Publishing");
+
+
+ DataObjectPtr book1 = mdg->create(book);
+ book1->setCString("author","Mr P B Writer");
+ // inherted from publication
+ book1->setCString("title","Nowhere Man");
+
+ DataObjectPtr mag1 = mdg->create(mag);
+ mag1->setCString("editor","Mr B Picky");
+ // inherited from publication
+ mag1->setCString("title","Bionicle Weekly");
+
+ DataObjectPtr pub1 = mdg->create(pub);
+ pub1->setCString("title","Noddy In Toyland");
+
+
+ // publication should accept any of them...
+
+ comp->setDataObject("Publication",pub1);
+ const Type& tpub1 = comp->getDataObject("Publication")->getType();
+ fprintf(f,"Publication is of type %s\n",tpub1.getName());
+
+ comp->setDataObject("Publication",book1);
+ const Type& tpub2 = comp->getDataObject("Publication")->getType();
+ fprintf(f,"Publication is of type %s\n",tpub2.getName());
+
+ comp->setDataObject("Publication",mag1);
+ const Type& tpub3 = comp->getDataObject("Publication")->getType();
+ fprintf(f,"Publication is of type %s\n",tpub3.getName());
+
+ // should be able to address publication as book or magazine
+
+ comp->setDataObject("Book",book1);
+ const Type& tpub4 = comp->getDataObject("Book")->getType();
+ fprintf(f, "Book is of type %s\n",tpub4.getName());
+
+ comp->setDataObject("Magazine",mag1);
+ const Type& tpub5 = comp->getDataObject("Magazine")->getType();
+ fprintf(f,"Magazine is of type %s\n",tpub5.getName());
+ fprintf(f,"END TEST: TestSubsLoad ======================================\n");
+ fclose(f);
+ return comparefiles("testsubsload.dat","testsubsload.txt");
+
+ }
+ catch (SDORuntimeException e)
+ {
+ if (!silent)cout << "ERROR in TeseSubsLoad" << e << endl;
+ return 0;
+ }
+}
+
+int sdotest::testSCA()
+{
+ try
+ {
+
+ DataFactoryPtr mdg = DataFactory::getDataFactory();
+ XSDHelperPtr xsh = HelperProvider::getXSDHelper(mdg);
+ xsh->defineFile("sca.xsd");
+ return 1;
+
+ }
+ catch (SDORuntimeException e)
+ {
+ if (!silent)cout << "ERROR in TeseSCA" << e << endl;
+ return 0;
+ }
+}
+
+int sdotest::testabstract()
+{
+ try
+ {
+
+ FILE *f = fopen("testabstract.dat","w+");
+ if (f == 0)
+ {
+ if (!silent)cout << "Unable to open testabstract.dat" << endl;
+ return 0;
+ }
+
+ DataFactoryPtr mdg = DataFactory::getDataFactory();
+ XSDHelperPtr xsh = HelperProvider::getXSDHelper(mdg);
+ xsh->defineFile("companyabs.xsd");
+
+ //cout << "TYPES LOADED FROM COMPANYABS XSD" << endl;
+
+ //TypeList tl = mdg->getTypes();
+ //for (int i=0;i< tl.size(); i++)
+ //{
+ // cout << tl[i].getURI() << ":" << tl[i].getName() << endl;
+ //}
+
+ // so now we should be able to put book or a magazine into
+ // the publication under company...
+
+ const Type& tstring = mdg->getType("commonj.sdo","String");
+ const Type& tcomp = mdg->getType("companyNS","CompanyType");
+ const Type& book = mdg->getType("companyNS","BookType");
+ const Type& mag = mdg->getType("companyNS","MagazineType");
+ const Type& pub = mdg->getType("companyNS","PublicationType");
+
+
+ // create a graph, then save it
+
+ DataObjectPtr comp = mdg->create((Type&)tcomp);
+ comp->setCString("name","Puflet Publishing");
+
+ // should be allowed...
+ DataObjectPtr book1 = mdg->create(book);
+ book1->setCString("author","Mr P B Writer");
+ // inherted from publication
+ book1->setCString("title","Nowhere Man");
+
+ DataObjectPtr mag1 = mdg->create(mag);
+ mag1->setCString("editor","Mr B Picky");
+ // inherited from publication
+ mag1->setCString("title","Bionicle Weekly");
+
+ try {
+ DataObjectPtr pub1 = mdg->create(pub);
+ pub1->setCString("title","Noddy In Toyland");
+ }
+ catch (SDOUnsupportedOperationException e)
+ {
+ fprintf(f,"Normal unsupportedoperation for creation of abstract type\n");
+ }
+
+
+ // publication should accept books and magazines...
+
+ comp->setDataObject("Publication",book1);
+ const Type& tpub2 = comp->getDataObject("Publication")->getType();
+ fprintf(f,"Publication is of type %s\n",tpub2.getName());
+
+ comp->setDataObject("Publication",mag1);
+ const Type& tpub3 = comp->getDataObject("Publication")->getType();
+ fprintf(f,"Publication is of type %s\n",tpub3.getName());
+
+ // should be able to address publication as book or magazine
+
+ comp->setDataObject("Book",book1);
+ const Type& tpub4 = comp->getDataObject("Book")->getType();
+ fprintf(f,"Book is of type %s\n",tpub4.getName());
+
+ comp->setDataObject("Magazine",mag1);
+ const Type& tpub5 = comp->getDataObject("Magazine")->getType();
+ fprintf(f,"Magazine is of type %s\n",tpub5.getName());
+
+ fclose(f);
+ return comparefiles("testabstract.dat","testabstract.txt");
+
+ }
+ catch (SDORuntimeException e)
+ {
+ if (!silent)cout << "ERROR in TestAbstract" << e << endl;
+ return 0;
+ }
+}
+
+int sdotest::testOpen()
+{
+ try
+ {
+
+ FILE *f = fopen("testopen.dat","w+");
+ if (f == 0)
+ {
+ if (!silent)cout << "Unable to open testopen.dat" << endl;
+ return 0;
+ }
+
+ DataFactoryPtr mdg = DataFactory::getDataFactory();
+
+
+ mdg->addType("companyNS","CompanyType");
+ // employee will be an open type...
+ mdg->addType("companyNS","EmployeeType", /*seq*/false,
+ /*open*/true,
+ /*abs */ false,
+ /*data*/ false);
+
+ mdg->addType("companyNS","DepartmentType");
+
+ /* Now add the properties to the types...*/
+
+
+ const Type& tstring = mdg->getType("commonj.sdo","String");
+ const Type& tbool = mdg->getType("commonj.sdo","Boolean");
+ const Type& tcs = mdg->getType("commonj.sdo","ChangeSummary");
+ const Type& tcomp = mdg->getType("companyNS","CompanyType");
+ const Type& tdept = mdg->getType("companyNS","DepartmentType");
+ const Type& temp = mdg->getType("companyNS","EmployeeType");
+
+
+ mdg->addPropertyToType(tcomp,"name",tstring);
+ // not containment...
+ mdg->addPropertyToType(tcomp,"employeeOfTheMonth",temp, false,false,false);
+ mdg->addPropertyToType(tcomp,"departments",tdept, true);
+ mdg->addPropertyToType(tcomp,"cs",tcs);
+
+ mdg->addPropertyToType(tdept,"name",tstring);
+ mdg->addPropertyToType(tdept,"location",tstring);
+ mdg->addPropertyToType(tdept,"number",tstring);
+ mdg->addPropertyToType(tdept,"employees",temp,true);
+
+ mdg->addPropertyToType(temp, "name",tstring);
+ mdg->addPropertyToType(temp, "SN", tstring);
+ mdg->addPropertyToType(temp, "manager", tbool);
+
+
+
+ DataObjectPtr comp = mdg->create((Type&)tcomp);
+ comp->setCString("name","ACME");
+
+ DataObjectPtr dept = mdg->create((Type&)tdept);
+ DataObjectList& dol = comp->getList("departments");
+ dol.append(dept);
+
+ dept->setCString("name","Advanced Technologies");
+ dept->setCString("location","NY");
+ dept->setCString("number","123");
+
+ DataObjectPtr emp1 = mdg->create(temp);
+ DataObjectPtr emp2 = mdg->create(temp);
+ DataObjectPtr emp3 = mdg->create(temp);
+
+ emp1->setCString("name","Albert");
+ emp1->setCString("SN","E0001");
+
+ emp2->setCString("name","Boris");
+ emp2->setCString("SN","E0002");
+ emp2->setBoolean("manager",true);
+
+ emp3->setCString("name","Carl");
+ emp3->setCString("SN","E0003");
+
+ // now we should be able to add extra properties to employees,
+ // and get them back again...
+
+ try {
+ emp1->setNull("openstring");
+ return 0;
+ }
+ catch (SDOUnsupportedOperationException e)
+ {
+ fprintf(f,"Normal exception for setting null on undefined prop\n");
+ }
+
+ emp1->setCString("openstring","Value Of Open String");
+ emp1->setBoolean("openboolean",true);
+
+ const char* c = emp1->getCString("openstring");
+
+ fprintf(f,"Open Type string value: %s\n",c);
+
+ bool b = emp1->getBoolean("openboolean");
+
+ fprintf(f,"Open Type boolean value: %d\n", b);
+
+ // unknown list type at present..
+ DataObjectList& dl = emp1->getList("opentypelist");
+
+ unsigned int i = 45;
+ dl.append((short)i); // now the list must be primitive
+
+ // we should now have instance properties
+ PropertyList pl = emp1->getType().getProperties();
+
+ for (i=0;i<pl.size();i++)
+ {
+ fprintf(f,"EMP1 type property: %s ( many? %d) of type %s\n" ,pl[i].getName()
+ , pl[i].isMany(),
+ pl[i].getType().getName());
+ }
+
+ PropertyList pli = emp1->getInstanceProperties();
+
+ for (i=0;i<pli.size();i++)
+ {
+ fprintf(f, "EMP1 inst property: %s (many? %d) of type %s\n",
+ pli[i].getName(), pli[i].isMany(), pli[i].getType().getName());
+ }
+
+
+ // now we try to set the string to null..
+
+ emp1->setNull("openstring");
+
+ emp1->setCString("openstring","New Value Of Open String");
+
+
+ // now unset them and see them disappear - what happens to the indices?
+
+ emp1->unset("openstring");
+
+ PropertyList plk = emp1->getInstanceProperties();
+
+ for (i=0;i<plk.size();i++)
+ {
+ fprintf(f,"EMP1 inst property: %s (many? %d) of type %s\n",
+ plk[i].getName(), plk[i].isMany(), plk[i].getType().getName());
+ }
+
+ emp1->unset("openboolean");
+
+ dl.remove(0); // so is this list gone, or empty - I vote for still there.
+
+ PropertyList pll = emp1->getInstanceProperties();
+ for (i=0;i<pll.size();i++)
+ {
+ fprintf(f,"EMP1 inst property: %s (many? %d) of type %s\n",
+ pll[i].getName(), pll[i].isMany(),pll[i].getType().getName());
+ }
+
+ emp1->unset("opentypelist");
+
+ // now I vote for gone...
+
+ PropertyList plm = emp1->getInstanceProperties();
+ for (i=0;i<plm.size();i++)
+ {
+ fprintf(f,"EMP1 inst property: %s (many? %d) of type %s\n", plm[i].getName()
+ , plm[i].isMany() , plm[i].getType().getName());
+ }
+
+ fclose(f);
+ return comparefiles("testopen.dat","testopen.txt");
+
+ }
+ catch (SDORuntimeException e)
+ {
+ if (!silent)cout << "ERROR in TestOpen" << e << endl;
+ return 0;
+ }
+}
+
+int sdotest::saveOpen()
+{
+ try
+ {
+
+ DataFactoryPtr mdg = DataFactory::getDataFactory();
+
+
+ mdg->addType("companyNS","CompanyType");
+ // employee will be an open type...
+ mdg->addType("companyNS","EmployeeType", /*seq*/false,
+ /*open*/true,
+ /*abs */ false,
+ /*data*/ false);
+
+ mdg->addType("companyNS","DepartmentType");
+
+ mdg->addType("companyNS","OpenType");
+
+ /* Now add the properties to the types...*/
+
+
+ const Type& tstring = mdg->getType("commonj.sdo","String");
+ const Type& tbool = mdg->getType("commonj.sdo","Boolean");
+ const Type& tcs = mdg->getType("commonj.sdo","ChangeSummary");
+ const Type& tcomp = mdg->getType("companyNS","CompanyType");
+ const Type& tdept = mdg->getType("companyNS","DepartmentType");
+ const Type& temp = mdg->getType("companyNS","EmployeeType");
+ const Type& topen = mdg->getType("companyNS","OpenType");
+
+
+ mdg->addPropertyToType(tcomp,"name",tstring);
+ // not containment...
+ mdg->addPropertyToType(tcomp,"employeeOfTheMonth",temp, false,false,false);
+ mdg->addPropertyToType(tcomp,"departments",tdept, true);
+ mdg->addPropertyToType(tcomp,"cs",tcs);
+
+ mdg->addPropertyToType(tdept,"name",tstring);
+ mdg->addPropertyToType(tdept,"location",tstring);
+ mdg->addPropertyToType(tdept,"number",tstring);
+ mdg->addPropertyToType(tdept,"employees",temp,true);
+
+ mdg->addPropertyToType(temp, "name",tstring);
+ mdg->addPropertyToType(temp, "SN", tstring);
+ mdg->addPropertyToType(temp, "manager", tbool);
+
+ mdg->setAlias("companyNS","CompanyType","TheFirm");
+ mdg->setAlias("companyNS","CompanyType","departments","TheDepartments");
+ mdg->setAlias("companyNS","CompanyType","departments","MYDepartments");
+ mdg->setAlias("companyNS","CompanyType","TheBigFirm");
+
+ mdg->addPropertyToType(topen,"name",tstring);
+
+ DataObjectPtr comp = mdg->create((Type&)tcomp);
+ comp->setCString("name","ACME");
+
+ DataObjectPtr dept = mdg->create((Type&)tdept);
+ DataObjectList& dol = comp->getList("departments");
+ dol.append(dept);
+
+ ChangeSummaryPtr cs = comp->getChangeSummary();
+
+ cs->beginLogging();
+
+ dept->setCString("name","Advanced Technologies");
+ dept->setCString("location","NY");
+ dept->setCString("number","123");
+
+ DataObjectList& emps = dept->getList("employees");
+
+ DataObjectPtr emp1 = mdg->create(temp);
+ DataObjectPtr emp2 = mdg->create(temp);
+ DataObjectPtr emp3 = mdg->create(temp);
+
+ emps.append(emp1);
+ emps.append(emp2);
+ emps.append(emp3);
+
+ emp1->setCString("name","Albert");
+ emp1->setCString("SN","E0001");
+
+ emp2->setCString("name","Boris");
+ emp2->setCString("SN","E0002");
+ emp2->setBoolean("manager",true);
+
+ emp3->setCString("name","Carl");
+ emp3->setCString("SN","E0003");
+
+ // now we should be able to add extra properties to employees,
+ // and get them back again...
+
+
+ emp1->setCString("openstring","Value Of Open String");
+ emp1->setBoolean("openboolean",true);
+
+ const char* c = emp1->getCString("openstring");
+
+ //cout << "Open Type string value: " << c << endl;
+
+ bool b = emp1->getBoolean("openboolean");
+
+ //cout << "Open Type boolean value: " << b << endl;
+
+ // unknown list type at present..
+ DataObjectList& dl = emp1->getList("openintlist");
+
+ int i = 45;
+ dl.append((short)i); // now the list must be primitive and short!!
+
+ // unknown list type at present..
+ DataObjectList& dl2 = emp1->getList("opendataobjectlist");
+
+ DataObjectPtr myopen = mdg->create("companyNS","OpenType");
+ myopen->setCString("name","MyOpenName");
+ dl2.append(myopen); // now the list must be of data objects
+
+
+ // now a single valued data object - should have an xsi:type
+ emp1->setDataObject("opendataobject", myopen);
+
+
+ cs->endLogging();
+
+ //dumpchangesummary(cs);
+
+ XSDHelperPtr xdh = HelperProvider::getXSDHelper(mdg);
+
+ xdh->generateFile(mdg->getTypes(),
+ "saveopen-output.xsd","companyNS");
+
+ XMLHelperPtr xmh = HelperProvider::getXMLHelper(mdg);
+ XMLDocumentPtr doc = xmh->createDocument(comp,"companyNS","company");
+ xmh->save(doc,"saveopen-output.xml");
+
+ return comparefiles("saveopen-output.xml","saveopen-output.txt");
+
+ }
+ catch (SDORuntimeException e)
+ {
+ if (!silent)cout << "ERROR in SaveOpen" << e << endl;
+ return 0;
+ }
+}
+
+int sdotest::loadOpen()
+{
+ try
+ {
+
+ DataFactoryPtr mdg = DataFactory::getDataFactory();
+ XSDHelperPtr xsh = HelperProvider::getXSDHelper(mdg);
+ xsh->defineFile("saveopen-output.xsd");
+
+
+ //cout << "TYPES LOADED FROM COMPANY XSD" << endl;
+ //int i;
+ //TypeList tl = mdg->getTypes();
+ //for (i=0;i< tl.size(); i++)
+ //{
+ // cout << tl[i].getURI() << ":" << tl[i].getName() << endl;
+ //}
+
+ XMLHelperPtr myXMLHelper = HelperProvider::getXMLHelper(mdg);
+
+
+ XMLDocumentPtr myXMLDocument = myXMLHelper->loadFile("partial.xml", "companyNS");
+
+
+
+ // so, we now expect that the openboolean and openstring props will
+ // be of type boolean and String, and the openlist will be a list of ints.
+ // The dataobjectlist an dataobject will be of the correct OpenType
+
+ // we need a test for data objects, and that we are writing out xsi:type
+ // correctly.
+ DataObjectPtr comp = myXMLDocument->getRootDataObject();
+ DataObjectList& dl = comp->getList("departments");
+ DataObjectPtr dept = dl[0];
+ DataObjectList& dl2 = dept->getList("employees");
+ DataObjectPtr emp = dl2[0];
+
+ if (strcmp(emp->getInstanceProperty("openboolean")->getType().getName(),
+ "Boolean"))
+ {
+ if (!silent)cout << "OpenLoad failure - bool property not boolean" << endl;
+ return 0;
+
+ }
+ if (emp->getBoolean("openboolean") != true)
+ {
+ if (!silent)cout << "OpenLoad failure - bool property not true" << endl;
+ return 0;
+ }
+
+ if (strcmp(emp->getInstanceProperty("openstring")->getType().getName(),
+ "String"))
+ {
+ if (!silent)cout << "OpenLoad failure - bytes property not String" << endl;
+ return 0;
+
+ }
+ if (strcmp(emp->getCString("openstring"),"Value Of Open String"))
+ {
+ if (!silent)cout << "OpenLoad failure - string value is" <<
+ emp->getCString("openstring") << endl;
+ return 0;
+ }
+
+
+ DataObjectList& dl3 = emp->getList("openintlist");
+
+ if (strcmp(emp->getInstanceProperty("openintlist")->getType().getName(),
+ "Short"))
+ {
+ if (!silent)cout << "OpenLoad failure - IntList not Short " <<
+ emp->getInstanceProperty("openintlist")->getType().getName() << endl;
+ return 0;
+ }
+
+ if (dl3.getInt(0) != 45)
+ {
+ if (!silent)cout << "OpenLoad failure - Int value is" <<
+ dl.getInt(0) << endl;
+ return 0;
+ }
+
+ if (strcmp(emp->getInstanceProperty("opendataobjectlist")->getType().getName(),
+ "OpenType"))
+ {
+ if (!silent)cout << "OpenLoad failure - OpenTypeList not OpenType" << endl;
+ return 0;
+ }
+
+ DataObjectList& dl4 = emp->getList("opendataobjectlist");
+
+ if (strcmp(dl4[0]->getCString("name"),"MyOpenName"))
+ {
+ if (!silent)cout << "OpenLoad failure - list element name is " <<
+ dl4[0]->getCString("name") << endl;
+ return 0;
+ }
+
+ if (strcmp(emp->getInstanceProperty("opendataobject")->getType().getName(),
+ "OpenType"))
+ {
+ if (!silent)cout << "OpenLoad failure - OpenType not OpenType" << endl;
+ return 0;
+ }
+
+ DataObjectPtr dob2 = emp->getDataObject("opendataobject");
+
+ if (strcmp(dob2->getCString("name"),"MyOpenName"))
+ {
+ if (!silent)cout << "OpenLoad failure - open value name is " <<
+ dob2->getCString("name") << endl;
+ return 0;
+ }
+
+
+ myXMLHelper->save(myXMLDocument->getRootDataObject(),
+ 0, "company", "loadload-output.xml");
+ return comparefiles("loadload-output.xml","loadload-output.txt");
+
+
+ }
+ catch (SDORuntimeException e)
+ {
+ if (!silent)cout << "LoadOpen FAILED" << e << endl;
+ return 0;
+ }
+
+}
+
+int sdotest::loadOpenNS()
+{
+ try
+ {
+
+ DataFactoryPtr mdg = DataFactory::getDataFactory();
+ XSDHelperPtr xsh = HelperProvider::getXSDHelper(mdg);
+ xsh->defineFile("openloadNS.xsd");
+ xsh->defineFile("openloadNS2.xsd");
+
+
+ //cout << "TYPES LOADED FROM COMPANY XSD" << endl;
+ //int i;
+ //TypeList tl = mdg->getTypes();
+ //for (i=0;i< tl.size(); i++)
+ //{
+ // cout << tl[i].getURI() << ":" << tl[i].getName() << endl;
+ //}
+
+ XMLHelperPtr myXMLHelper = HelperProvider::getXMLHelper(mdg);
+
+
+ XMLDocumentPtr myXMLDocument = myXMLHelper->loadFile("openloadNS.xml", "companyNS");
+
+
+
+ // so, we now expect that the openboolean and openstring props will
+ // be of type boolean and Bytes, and the openlist will be a list of ints.
+ // The dataobjectlist an dataobject will be of the correct OpenType
+
+ // we need a test for data objects, and that we are writing out xsi:type
+ // correctly.
+ DataObjectPtr comp = myXMLDocument->getRootDataObject();
+ DataObjectList& dl = comp->getList("departments");
+ DataObjectPtr dept = dl[0];
+ DataObjectList& dl2 = dept->getList("employees");
+ DataObjectPtr emp = dl2[0];
+
+ if (strcmp(emp->getInstanceProperty("openboolean")->getType().getName(),
+ "Boolean"))
+ {
+ if (!silent)cout << "OpenLoadNS failure - bool property not boolean" << endl;
+ return 0;
+
+ }
+ if (emp->getBoolean("openboolean") != true)
+ {
+ if (!silent)cout << "OpenLoadNS failure - bool property not true" << endl;
+ return 0;
+ }
+
+ if (strcmp(emp->getInstanceProperty("openstring")->getType().getName(),
+ "Bytes"))
+ {
+ if (!silent)cout << "OpenLoadNS failure - bytes property not bytes" << endl;
+ return 0;
+
+ }
+ if (strcmp(emp->getCString("openstring"),"Value Of Open String"))
+ {
+ if (!silent)cout << "OpenLoadNS failure - string value is" <<
+ emp->getCString("openstring") << endl;
+ return 0;
+ }
+
+
+ DataObjectList& dl3 = emp->getList("openintlist");
+
+ if (strcmp(emp->getInstanceProperty("openintlist")->getType().getName(),
+ "Short"))
+ {
+ if (!silent)cout << "OpenLoadNS failure - IntList not Short " <<
+ emp->getInstanceProperty("openintlist")->getType().getName() << endl;
+ return 0;
+ }
+
+ if (dl3.getInt(0) != 45)
+ {
+ if (!silent)cout << "OpenLoadNS failure - Int value is" <<
+ dl.getInt(0) << endl;
+ return 0;
+ }
+
+
+
+ myXMLHelper->save(myXMLDocument->getRootDataObject(),
+ 0, "company", "openloadNSout.xml");
+
+ if (!comparefiles("openloadNSout.xml","openloadNSout.txt"))return 0;
+
+
+ // now try exactly the same, but with NS which doesnt exist
+ XMLDocumentPtr myXMLDocument2 = myXMLHelper->loadFile("openloadNS2.xml", "companyNS");
+
+
+
+ // so, we now expect that the openboolean and openstring props will
+ // be of type boolean and String, and the openlist will be a list of ints.
+ // The dataobjectlist an dataobject will be of the correct OpenType
+
+ // we need a test for data objects, and that we are writing out xsi:type
+ // correctly.
+ DataObjectPtr comp2 = myXMLDocument2->getRootDataObject();
+ DataObjectList& dld = comp2->getList("departments");
+ DataObjectPtr dept2 = dld[0];
+ DataObjectList& dl22 = dept2->getList("employees");
+ DataObjectPtr emp2 = dl22[0];
+
+ if (strcmp(emp2->getInstanceProperty("openboolean")->getType().getName(),
+ "String"))
+ {
+ if (!silent)cout << "OpenLoadNS2 failure - bool property not String" << endl;
+ return 0;
+
+ }
+ if (emp2->getBoolean("openboolean") != true)
+ {
+ if (!silent)cout << "OpenLoadNS2 failure - bool property not true" << endl;
+ return 0;
+ }
+
+ if (strcmp(emp2->getInstanceProperty("openstring")->getType().getName(),
+ "String"))
+ {
+ if (!silent)cout << "OpenLoadNS2 failure - bytes property not String" << endl;
+ return 0;
+
+ }
+ if (strcmp(emp2->getCString("openstring"),"Value Of Open String"))
+ {
+ if (!silent)cout << "OpenLoadNS failure - string value is" <<
+ emp2->getCString("openstring") << endl;
+ return 0;
+ }
+
+
+ DataObjectList& dl32 = emp2->getList("openintlist");
+
+ if (strcmp(emp2->getInstanceProperty("openintlist")->getType().getName(),
+ "OpenDataObject"))
+ {
+ if (!silent)cout << "OpenLoadNS2 failure - IntList not OpenDataObject " <<
+ emp2->getInstanceProperty("openintlist")->getType().getName() << endl;
+ return 0;
+ }
+
+ if (atoi(dl32.getDataObject(0)->getSequence()->getCStringValue(0)) != 45)
+ {
+ if (!silent)cout << "OpenLoadNS2 failure - Int value is" <<
+ dl32.getInt(0) << endl;
+ return 0;
+ }
+ return 1;
+ }
+ catch (SDORuntimeException e)
+ {
+ if (!silent)cout << "LoadOpenNS FAILED" << e << endl;
+ return 0;
+ }
+
+}
+
+int sdotest::loadManyOpen()
+{
+ try
+ {
+
+ DataFactoryPtr mdg = DataFactory::getDataFactory();
+ XSDHelperPtr xsh = HelperProvider::getXSDHelper(mdg);
+ xsh->defineFile("many.xsd");
+
+
+ //cout << "TYPES LOADED FROM COMPANY XSD" << endl;
+ //int i;
+ //TypeList tl = mdg->getTypes();
+ //for (i=0;i< tl.size(); i++)
+ //{
+ // cout << tl[i].getURI() << ":" << tl[i].getName() << endl;
+ //}
+
+ XMLHelperPtr myXMLHelper = HelperProvider::getXMLHelper(mdg);
+
+
+ XMLDocumentPtr myXMLDocument = myXMLHelper->loadFile("many.xml", "companyNS");
+
+
+
+ // so, we now expect that the openboolean and openstring props will
+ // be of type boolean and Bytes, and the openlist will be a list of ints.
+ // The dataobjectlist an dataobject will be of the correct OpenType
+
+ // we need a test for data objects, and that we are writing out xsi:type
+ // correctly.
+ DataObjectPtr comp = myXMLDocument->getRootDataObject();
+ DataObjectList& dl = comp->getList("departments");
+ DataObjectPtr dept = dl[0];
+ DataObjectList& dl2 = dept->getList("employees");
+ DataObjectPtr emp = dl2[0];
+
+
+ DataObjectList& dl3 = emp->getList("openlist");
+
+ // change to match spec - now an open data object
+ // the list should contain a single data object with a sequence of three text elements
+
+ if (strcmp(emp->getInstanceProperty("openlist")->getType().getName(),
+ "OpenDataObject"))
+ {
+ if (!silent)cout << "OpenManyLoad failure - BytesList not OpenDataObject " <<
+ emp->getInstanceProperty("openlist")->getType().getName() << endl;
+ return 0;
+ }
+
+ if (dl3.size() != 3)
+ {
+ if (!silent)cout << "OpenManyLoad failure - size is " <<
+ dl3.size() << endl;
+ return 0;
+ }
+
+ SequencePtr sq = dl3[0]->getSequence();
+ if (strcmp(sq->getCStringValue(0),"Three member")) return 0;
+
+ SequencePtr sq2 = dl3[1]->getSequence();
+ if (strcmp(sq2->getCStringValue(0),"Open bytes")) return 0;
+
+ SequencePtr sq3 = dl3[2]->getSequence();
+ if (strcmp(sq3->getCStringValue(0),"List is complete")) return 0;
+
+ return 1;
+ }
+ catch (SDORuntimeException e)
+ {
+ if (!silent)cout << "LoadOpen FAILED" << e << endl;
+ return 0;
+ }
+
+}
+
+int sdotest::csload2()
+{
+ //cout << "TEST: CSLoad2 ===============================================" << endl;
+ try
+ {
+
+ DataFactoryPtr mdg = DataFactory::getDataFactory();
+ XSDHelperPtr xsh = HelperProvider::getXSDHelper(mdg);
+ xsh->defineFile("company.xsd");
+
+ //cout << "TYPES LOADED FROM COMPANY XSD" << endl;
+
+ //TypeList tl = mdg->getTypes();
+ //for (int i=0;i< tl.size(); i++)
+ //{
+ // cout << tl[i].getURI() << ":" << tl[i].getName() << endl;
+ //}
+
+ XMLHelperPtr myXMLHelper = HelperProvider::getXMLHelper(mdg);
+ XMLDocumentPtr myXMLDocument = myXMLHelper->loadFile("cssave2-output.xml", "companyNS");
+ myXMLHelper->save(myXMLDocument->getRootDataObject(),
+ 0, "company", "csload2-output.xml");
+
+ if (!comparefiles("csload2-output.xml","csload2-output.txt")) return 0;
+
+ XMLDocumentPtr myXMLDocument2 = myXMLHelper->loadFile("csload2-output.xml", "companyNS");
+ myXMLHelper->save(myXMLDocument2->getRootDataObject(),
+ 0, "company", "csload3-output.xml");
+
+ return comparefiles("csload3-output.xml","csload3-output.txt");
+
+ }
+ catch (SDORuntimeException e)
+ {
+ if (!silent)cout << "ERROR in CsLoad2" << e << endl;
+ return 0;
+ }
+}
+
+int sdotest::bug1()
+{
+
+ DataFactoryPtr mdg = DataFactory::getDataFactory();
+ try {
+ XSDHelperPtr xsh = HelperProvider::getXSDHelper(mdg);
+ xsh->defineFile("bugs/1/company.xsd");
+
+ //TypeList tl = mdg->getTypes();
+ //for (int i=0;i< tl.size(); i++)
+ //{
+ // cout << tl[i].getURI() << ":" << tl[i].getName() << endl;
+ //}
+
+
+ XMLHelperPtr myXMLHelper = HelperProvider::getXMLHelper(mdg);
+ XMLDocumentPtr myXMLDocument = myXMLHelper->loadFile("bugs/1/company.xml",
+ "http://www.mycompanyinc.com");
+ }
+ catch (SDORuntimeException e)
+ {
+ if (!silent)cout << "ERROR in Bug1" << e << endl;
+ return 0;
+ }
+ return 1;
+}
+
+int sdotest::setnull()
+{
+
+ try {
+ DataFactoryPtr mdg = DataFactory::getDataFactory();
+
+ mdg->addType("NullNS","NullMainType");
+ mdg->addType("NullNS","NullSubType");
+
+ /* Now add the properties to the types...*/
+
+ const Type& tstring = mdg->getType("commonj.sdo","String");
+ const Type& tint = mdg->getType("commonj.sdo","Int");
+ const Type& tbool = mdg->getType("commonj.sdo","Boolean");
+ const Type& tcs = mdg->getType("commonj.sdo","ChangeSummary");
+ const Type& tmain = mdg->getType("NullNS","NullMainType");
+ const Type& tsub = mdg->getType("NullNS","NullSubType");
+
+
+ mdg->addPropertyToType(tmain,"name",tstring);
+ mdg->addPropertyToType(tmain,"subs",tsub, true); // many
+ mdg->addPropertyToType(tmain,"asub",tsub, false); // single
+ mdg->addPropertyToType(tmain,"bsub",tsub, false); // single
+
+ mdg->addPropertyToType(tmain,"cs",tcs); // change summary
+
+ mdg->addPropertyToType(tsub,"name",tstring);
+ mdg->addPropertyToType(tsub,"number",tint);
+ mdg->addPropertyToType(tsub,"bool",tbool);
+
+
+ // create a graph, then save it
+
+ DataObjectPtr main1 = mdg->create((Type&)tmain);
+ main1->setCString("name","MainObject");
+
+ // asub is initially set
+ DataObjectPtr sub0 = main1->createDataObject("asub");
+ // bsub is not set.
+
+ DataObjectPtr sub1 = mdg->create((Type&)tsub);
+ DataObjectPtr sub2 = mdg->create((Type&)tsub);
+ DataObjectPtr sub3 = mdg->create((Type&)tsub);
+
+ DataObjectList& dol = main1->getList("subs");
+
+ dol.append(sub1);
+ dol.append(sub2);
+ dol.append(sub3);
+
+ // sub1 has all values set initially
+
+ sub1->setCString("name","All Initially set");
+ sub1->setInt("number",100);
+ sub1->setBoolean("bool",false);
+
+ // sub2 has no values set at all
+
+
+ // sub3 has all values set to null
+ sub3->setNull("name");
+ sub3->setNull("number");
+ sub3->setNull("bool");
+
+
+ // report
+
+ if (main1->isNull("asub")) return 0;
+
+ if (!main1->isSet("asub")) return 0;
+
+ if (main1->isNull("bsub")) return 0;
+
+ if (main1->isSet("bsub")) return 0;
+
+// dol0 is set, not null
+
+ if (dol[0]->isNull("name")) return 0;
+
+ if (dol[0]->isNull("number")) return 0;
+
+ if (dol[0]->isNull("bool")) return 0;
+
+ if (!dol[0]->isSet("name")) return 0;
+
+ if (!dol[0]->isSet("number")) return 0;
+
+ if (!dol[0]->isSet("bool")) return 0;
+
+// dol1 is all unset , so no nulls
+
+ if (dol[1]->isNull("name")) return 0;
+
+ if (dol[1]->isNull("number")) return 0;
+
+ if (dol[1]->isNull("bool")) return 0;
+
+ if (dol[1]->isSet("name")) return 0;
+
+ if (dol[1]->isSet("number")) return 0;
+
+ if (dol[1]->isSet("bool")) return 0;
+
+// dol2 is all nulls, so all set
+
+ if (!dol[2]->isNull("name")) return 0;
+
+ if (!dol[2]->isNull("number")) return 0;
+
+ if (!dol[2]->isNull("bool")) return 0;
+
+ if (!dol[2]->isSet("name")) return 0;
+
+ if (!dol[2]->isSet("number")) return 0;
+
+ if (!dol[2]->isSet("bool")) return 0;
+
+ ChangeSummaryPtr cs = main1->getChangeSummary();
+
+ cs->beginLogging();
+
+ main1->setNull("asub");
+ main1->setNull("bsub");
+
+ dol[0]->setNull("name");
+ dol[0]->setNull("number");
+ dol[0]->setNull("bool");
+
+ dol[1]->setNull("bool");
+
+ dol[2]->setCString("name","NewName");
+ dol[2]->setInt("number",100);
+ dol[2]->setBoolean("bool",true);
+
+
+ cs->endLogging();
+
+ // what would we expect from the change summary?
+
+ //cout << "==============Expected in Change Summary=================" << endl;
+ //cout << "change to main1 - object asub set to null, oldvalue asub (set)" << endl;
+ //cout << "change to main1 - object bsub set to null, oldvalue null (unset)" << endl;
+ //cout << "change to sub1 - name asub set to null, oldvalue \"All Initially Set\" (set)" << endl;
+ //cout << "change to sub1 - number asub set to null, oldvalue 100 (set)" << endl;
+ //cout << "change to sub1 - bool asub set to null, oldvalue false (set)" << endl;
+ //cout << "change to sub2 - bool asub set to null, oldvalue false (unset)" << endl;
+ //cout << "change to sub3 - name asub set to \"NewName\", oldvalue null, set" << endl;
+ //cout << "change to sub3 - number asub set to 100, oldvalue null, set" << endl;
+ //cout << "change to sub3 - bool asub set to true, oldvalue null, set" << endl;
+ //cout << "==============End Expected in Change Summary=============" << endl;
+
+ FILE* f = fopen("setnull.dat","w+");
+ if (f == 0)
+ {
+ if (!silent) cout << "Unable to open setnull.dat" << endl;
+ return 0;
+ }
+
+ dumpchangesummary(f, cs);
+
+ fclose(f);
+
+ if (!comparefiles("setnull.dat","setnull.txt")) return 0;
+
+ // report
+
+ if (!main1->isNull("asub")) return 0;
+
+ if (!main1->isSet("asub")) return 0;
+
+ if (!main1->isNull("bsub")) return 0;
+
+ if (!main1->isSet("bsub")) return 0;
+
+// dol0 is set to null
+
+ if (!dol[0]->isNull("name")) return 0;
+
+ if (!dol[0]->isNull("number")) return 0;
+
+ if (!dol[0]->isNull("bool")) return 0;
+
+ if (!dol[0]->isSet("name")) return 0;
+
+ if (!dol[0]->isSet("number")) return 0;
+
+ if (!dol[0]->isSet("bool")) return 0;
+
+// dol1 is all unset except bool which is null
+
+ if (dol[1]->isNull("name")) return 0;
+
+ if (dol[1]->isNull("number")) return 0;
+
+ if (!dol[1]->isNull("bool")) return 0;
+
+ if (dol[1]->isSet("name")) return 0;
+
+ if (dol[1]->isSet("number")) return 0;
+
+ if (!dol[1]->isSet("bool")) return 0;
+
+// dol2 is all set non-null, so all set
+
+ if (dol[2]->isNull("name")) return 0;
+
+ if (dol[2]->isNull("number")) return 0;
+
+ if (dol[2]->isNull("bool")) return 0;
+
+ if (!dol[2]->isSet("name")) return 0;
+
+ if (!dol[2]->isSet("number")) return 0;
+
+ if (!dol[2]->isSet("bool")) return 0;
+
+
+ return 1;
+ }
+ catch (SDORuntimeException e)
+ {
+ if (!silent)cout << "Exception in setnull" << e << endl;
+ return 0;
+ }
+}
+
+
+int sdotest::testsubs()
+{
+
+ try {
+ DataFactoryPtr mdg = DataFactory::getDataFactory();
+
+ mdg->addType("companyNS","MainType");
+
+ mdg->addType("companyNS","SubType");
+ mdg->addType("companyNS","SuperType");
+ mdg->addType("companyNS","SubstituteType");
+ mdg->addType("companyNS","UnrelatedType");
+
+ /* Now add the properties to the types...*/
+
+
+ const Type& tstring = mdg->getType("commonj.sdo","String");
+ const Type& tbool = mdg->getType("commonj.sdo","Boolean");
+ const Type& tcs = mdg->getType("commonj.sdo","ChangeSummary");
+ const Type& tmain = mdg->getType("companyNS","MainType");
+ const Type& sub = mdg->getType("companyNS","SubType");
+ const Type& super = mdg->getType("companyNS","SuperType");
+ const Type& subst = mdg->getType("companyNS","SubstituteType");
+ const Type& unrel = mdg->getType("companyNS","UnrelatedType");
+
+
+ mdg->addPropertyToType(tmain,"name",tstring);
+ mdg->addPropertyToType(tmain,"sub",super, false);
+ mdg->addPropertyToType(tmain,"subs",super, true);
+
+
+ mdg->setPropertySubstitute(tmain, "sub","wilbur", subst);
+ mdg->setPropertySubstitute(tmain, "subs","wilburs", subst);
+
+ mdg->setBaseType(sub,super);
+
+ //now sub and subs should accept all the three types
+
+ DataObjectPtr main = mdg->create((Type&)tmain);
+ main->setCString("name","SubstituteTest");
+
+ DataObjectList& dol = main->getList("subs");
+
+ DataObjectPtr sub1 = mdg->create(sub);
+ DataObjectPtr super1 = mdg->create(super);
+ DataObjectPtr subst1 = mdg->create(subst);
+ DataObjectPtr unrel1 = mdg->create(unrel);
+
+ dol.append(sub1);
+ dol.append(super1);
+ dol.append(subst1);
+ try
+ {
+ dol.append(unrel1);
+ return 0;
+ }
+ catch (SDOInvalidConversionException e)
+ {
+ //cout << "Normal failure to append wrong type" << endl;
+ }
+
+ dol.remove(0);
+ dol.remove(0);
+ dol.remove(0);
+
+ DataObjectList& dol2 = main->getList("wilburs");
+
+ dol2.append(sub1);
+ dol2.append(super1);
+ dol2.append(subst1);
+ try
+ {
+ dol2.append(unrel1);
+ return 0;
+ }
+ catch (SDOInvalidConversionException e)
+ {
+ //cout << "Normal failure to append wrong type" << endl;
+ }
+
+ main->setDataObject("sub",sub1);
+ main->setDataObject("sub",super1);
+ main->setDataObject("sub",subst1);
+
+ main->setDataObject("wilbur",sub1);
+ main->setDataObject("wilbur",super1);
+ main->setDataObject("wilbur",subst1);
+
+ try
+ {
+ main->setDataObject("sub", unrel1);
+ return 0;
+ }
+ catch (SDOInvalidConversionException e)
+ {
+ //cout << "Normal failure to set wrong type" << endl;
+ }
+ return 1;
+ }
+
+ catch (SDORuntimeException e)
+ {
+ if (!silent)cout << "Substitute test failed" << endl << e << endl;
+ return 0;
+ }
+}
+
+
+int sdotest::merle1()
+{
+
+ try {
+
+ // Dynamic setup of the metadata
+
+ FILE *f = fopen("merle1.dat","w+");
+ if (f == 0)
+ {
+ if (!silent)cout << "Unable to open merle1.dat" << endl;
+ return 0;
+ }
+
+
+ DataFactoryPtr mdg = DataFactory::getDataFactory();
+
+ XSDHelperPtr xsh = HelperProvider::getXSDHelper(mdg);
+ xsh->defineFile("axis.xsd");
+
+ // or dynamically create, but that would get attributes for the strings, not elements
+ //mdg->addType("axis","ItemSearch",true); // sequenced
+ //mdg->addType("axis","ItemSearchRequest",true); // sequenced
+
+ const Type& tstring = mdg->getType("commonj.sdo","String");
+ const Type& tsearch = mdg->getType("axis","ItemSearch");
+ const Type& treq = mdg->getType("axis","ItemSearchRequest");
+
+ //mdg->addPropertyToType(tsearch,"SubscriptionId",tstring);
+ //mdg->addPropertyToType(tsearch,"AssociateTag",tstring);
+ //mdg->addPropertyToType(tsearch,"XMLEscaping",tstring);
+ //mdg->addPropertyToType(tsearch,"Validate",tstring);
+ //mdg->addPropertyToType(tsearch,"Shared",treq, false, false, true);
+ //mdg->addPropertyToType(tsearch,"Request",treq, true, false, true);
+
+ //mdg->addPropertyToType(treq,"Keywords",tstring);
+ //mdg->addPropertyToType(treq,"SearchIndex",tstring);
+
+ // dynamic creation of the data
+
+ DataObjectPtr search = mdg->create((Type&)tsearch);
+
+ search->setCString("SubscriptionId","I am the subscription ID string");
+ search->setCString("AssociateTag","I am the associate Tag string");
+ search->setCString("XMLEscaping","I am the XML escaping string");
+ search->setCString("Validate","I am the Validate string");
+
+ DataObjectPtr shared = search->createDataObject("Shared");
+ shared->setCString("Keywords","SharedKeywordsString");
+ shared->setCString("SearchIndex","SearchIndexString");
+
+ DataObjectList& requests = search->getList("Request");
+ DataObjectPtr request1 = mdg->create(treq);
+ requests.append(request1);
+ request1->setCString("Keywords","RequestKeywords");
+ request1->setCString("SearchIndex","RequestSearchIndex");
+
+ // Read the data and put it into XML:
+
+ PropertyList properties = search->getInstanceProperties();
+
+ XMLHelperPtr myXMLHelper = HelperProvider::getXMLHelper(mdg);
+
+ for (unsigned int i=0;i<properties.size();i++)
+ {
+ Property& prop = properties[i];
+ switch (prop.getTypeEnum())
+ {
+
+ case Type::StringType:
+ fprintf(f,"<%s>%s</%s>\n",prop.getName(), search->getCString(prop),
+ prop.getName());
+ break;
+
+ case Type::DataObjectType:
+ if (prop.isMany())
+ {
+ // many valued property, such as Requests , so get the list
+ DataObjectList& rq = search->getList(prop);
+ for (unsigned int j=0;j<rq.size();j++)
+ {
+ DataObjectPtr dob = rq[j];
+ if (dob != 0)
+ {
+ XMLDocumentPtr doc = myXMLHelper->createDocument(dob,
+ "axis", prop.getName());
+ doc->setXMLDeclaration(false);
+ char* dobXML = myXMLHelper->save(doc);
+ fprintf(f,"DataObject \"%s\" as XML:\n",prop.getName());
+ fprintf(f,"%s\n", dobXML);
+ } // if dob
+ } // for
+ } // if many
+ else
+ {
+ DataObjectPtr dob = search->getDataObject(prop);
+ if (dob != 0)
+ {
+ XMLDocumentPtr doc = myXMLHelper->createDocument(dob,
+ "axis", prop.getName());
+ doc->setXMLDeclaration(false);
+ char* dobXML = myXMLHelper->save(doc);
+ fprintf(f,"DataObject \"%s\" as XML:\n",prop.getName());
+ fprintf(f, "%s\n", dobXML);
+ } // if
+ } // else
+ break;
+
+ default:
+ break;
+
+ } // switch
+ } // for
+ fclose(f);
+ return comparefiles("merle1.dat","merle1.txt");
+ } // try
+ catch (SDORuntimeException e)
+ {
+ if (!silent)cout << "Merle 1 failed" << endl << e << endl;
+ return 0;
+ }
+}
+
+
+int sdotest::graham3()
+{
+ try {
+
+ // Dynamic setup of the metadata
+
+ DataFactoryPtr mdg = DataFactory::getDataFactory();
+
+ XSDHelperPtr xsh = HelperProvider::getXSDHelper(mdg);
+ xsh->defineFile("graham3.xsd");
+ return 1;
+ }
+ catch (SDORuntimeException e)
+ {
+ if (!silent)cout << "Graham1 failed " << e << endl;
+ return 0;
+ }
+}
+
+int sdotest::graham1()
+{
+ try {
+
+ // Dynamic setup of the metadata
+
+ DataFactoryPtr mdg = DataFactory::getDataFactory();
+
+ XSDHelperPtr xsh = HelperProvider::getXSDHelper(mdg);
+ xsh->defineFile("graham1.xsd");
+ return 1;
+ }
+ catch (SDORuntimeException e)
+ {
+ if (!silent)cout << "Graham1 failed " << e << endl;
+ return 0;
+ }
+}
+int sdotest::graham2()
+{
+ try {
+
+ // Dynamic setup of the metadata
+
+ DataFactoryPtr mdg = DataFactory::getDataFactory();
+
+ XSDHelperPtr xsh = HelperProvider::getXSDHelper(mdg);
+ xsh->defineFile("graham2.xsd");
+ return 1;
+ }
+ catch (SDORuntimeException e)
+ {
+ if (!silent)cout << "Graham2 failed " << e << endl;
+ return 0;
+ }
+}
+
+
+int sdotest::b46613()
+{
+ try {
+
+ // Dynamic setup of the metadata
+
+ DataFactoryPtr mdg = DataFactory::getDataFactory();
+
+ mdg->create("rubbish","MyObject");
+
+ return 0;
+
+ }
+ catch (SDOTypeNotFoundException e)
+ {
+ //cout << "b46613 gave the correct exception" << endl;
+ return 1;
+ }
+}
+
+int sdotest::doctest()
+{
+ try {
+
+ FILE *f = fopen("doctest.dat","w+");
+ if (f == 0)
+ {
+ if (!silent)cout << "Unable to open doctest.dat" << endl;
+ return 0;
+ }
+
+ DataFactoryPtr mdg = DataFactory::getDataFactory();
+
+ XSDHelperPtr xsh = HelperProvider::getXSDHelper(mdg);
+ xsh->defineFile("doctest.xsd");
+ XMLHelperPtr myXMLHelper = HelperProvider::getXMLHelper(mdg);
+ XMLDocumentPtr myXMLDocument = myXMLHelper->loadFile("doctest.xml",
+ "companyNS");
+ fprintf(f,"RootURI=%s\n",myXMLDocument->getRootElementURI());
+ fprintf(f,"RootName=%s\n",myXMLDocument->getRootElementName());
+ fclose(f);
+ return comparefiles("doctest.dat","doctest.txt");
+ }
+ catch (SDOTypeNotFoundException e)
+ {
+ if (!silent)cout << "doctest failed" << endl;
+ return 0;
+ }
+
+}
+
+
+int sdotest::b46634()
+{
+ try {
+
+ DataFactoryPtr mdg = DataFactory::getDataFactory();
+
+ XSDHelperPtr xsh = HelperProvider::getXSDHelper(mdg);
+ xsh->defineFile("company_with_nillable_SN.xsd");
+ XMLHelperPtr myXMLHelper = HelperProvider::getXMLHelper(mdg);
+ XMLDocumentPtr myXMLDocument = myXMLHelper->loadFile("company_with_nillable_SN.xml",
+ "companyNS");
+
+ DataObjectPtr dob = myXMLDocument->getRootDataObject();
+ DataObjectList& dol = dob->getList("departments");
+ DataObjectPtr dept = dol[0];
+ DataObjectList& dol2 = dept->getList("employees");
+ DataObjectPtr emp = dol2[0];
+
+ if (!emp->isSet("SN"))
+ {
+ if (!silent)cout << "B46634 WRONG - isSet should be true" << endl;
+ return 0;
+ }
+ if (!emp->isNull("SN"))
+ {
+ if (!silent)cout << "B46634 WRONG - isNull should be true" << endl;
+ return 0;
+ }
+
+ // now write out the nill value and check its still nil
+ myXMLHelper->save(myXMLDocument->getRootDataObject(),
+ 0, "company", "b46634_out.xml");
+ return comparefiles("b46634_out.xml","b46634_out.txt");
+
+ }
+ catch (SDORuntimeException e)
+ {
+ if (!silent)cout << "b46634 failed" << endl;
+ return 0;
+ }
+
+}
+
+int sdotest::testErrors()
+{
+ try {
+
+ unsigned int i,j;
+
+ FILE *f = fopen("testerrors.dat","w+");
+ if (f == 0)
+ {
+ if (!silent)cout << "Unable to open testerrors.dat" << endl;
+ return 0;
+ }
+
+ DataFactoryPtr mdg = DataFactory::getDataFactory();
+
+ XSDHelperPtr xsh = HelperProvider::getXSDHelper(mdg);
+ xsh->defineFile("error1.xsd");
+ if ((i = xsh->getErrorCount()) > 0)
+ {
+ fprintf(f,"XSD reported some errors:\n");
+ for (j=0;j<i;j++)
+ {
+ const char* m = xsh->getErrorMessage(j);
+ if (m != 0) fprintf(f,"%s\n", m);
+ }
+ }
+ XMLHelperPtr myXMLHelper = HelperProvider::getXMLHelper(mdg);
+ XMLDocumentPtr myXMLDocument = myXMLHelper->loadFile("error1.xml",
+ "companyNS");
+
+ if ((i = myXMLHelper->getErrorCount()) > 0)
+ {
+ fprintf(f,"XML reported some errors:\n");
+ for (j=0;j<i;j++)
+ {
+ const char *m = myXMLHelper->getErrorMessage(j);
+ if (m != 0) fprintf(f,"%s\n",m);
+ }
+ }
+
+ fclose(f);
+ return comparefiles("testerrors.dat","testerrors.txt");
+
+ }
+ catch (SDORuntimeException e)
+ {
+ if (!silent)cout << "testErrors failed" << endl << e << endl;
+ return 0;
+ }
+
+}
+
+int sdotest::b46734()
+{
+ try {
+
+ unsigned int i,j;
+
+ DataFactoryPtr mdg = DataFactory::getDataFactory();
+
+ XSDHelperPtr xsh = HelperProvider::getXSDHelper(mdg);
+
+ xsh->defineFile("http://schemas.xmlsoap.org/wsdl/");
+ if ((i = xsh->getErrorCount()) > 0)
+ {
+ if (true)
+ {
+ cout << "WSDL XSD reported some errors:" << endl;
+ for (j=0;j<i;j++)
+ {
+ const char *m = xsh->getErrorMessage(j);
+ if (m != 0) cout << m;
+ cout << endl;
+ }
+ }
+ return 0;
+ }
+ xsh->defineFile("http://schemas.xmlsoap.org/wsdl/soap/");
+ if ((i = xsh->getErrorCount()) > 0)
+ {
+ if (true)
+ {
+ cout << "WSDL SOAP XSD reported some errors:" << endl;
+ for (j=0;j<i;j++)
+ {
+ const char* m = xsh->getErrorMessage(j);
+ if (m != 0) cout << m;
+ cout << endl;
+ }
+ }
+ return 0;
+ }
+ xsh->defineFile("http://schemas.xmlsoap.org/wsdl/http/");
+ if ((i = xsh->getErrorCount()) > 0)
+ {
+ if (true)
+ {
+ cout << "WSDL HTTP XSD reported some errors:" << endl;
+ for (j=0;j<i;j++)
+ {
+ const char* m = xsh->getErrorMessage(j);
+ if (m != 0) cout << m;
+ cout << endl;
+ }
+ }
+ return 0;
+ }
+ XMLHelperPtr myXMLHelper = HelperProvider::getXMLHelper(mdg);
+ XMLDocumentPtr myXMLDocument = myXMLHelper->loadFile("StockQuoteService.wsdl"
+ );
+
+ if ((i = myXMLHelper->getErrorCount()) > 0)
+ {
+ if (true)
+ {
+ cout << "XML reported some errors:" << endl;
+ for (j=0;j<i;j++)
+ {
+ const char * m = myXMLHelper->getErrorMessage(j);
+ if (m != 0)cout << m;
+ cout << endl;
+ }
+ }
+ return 0;
+ }
+ return 1;
+
+ }
+ catch (SDORuntimeException e)
+ {
+ if (true)cout << "b46734 failed" << endl << e << endl;
+ return 0;
+ }
+
+}
+
+int sdotest::b46693()
+{
+ try {
+
+ unsigned int i,j;
+
+ DataFactoryPtr mdg = DataFactory::getDataFactory();
+
+ XSDHelperPtr xsh = HelperProvider::getXSDHelper(mdg);
+
+ xsh->defineFile("b46693.xsd");
+ if ((i = xsh->getErrorCount()) > 0)
+ {
+ if (!silent)
+ {
+ cout << "b46693 XSD reported some errors:" << endl;
+ for (j=0;j<i;j++)
+ {
+ const char* m = xsh->getErrorMessage(j);
+ if (m != 0)cout << m;
+ cout << endl;
+ }
+ }
+ return 0;
+ }
+
+ // XMLHelperPtr myXMLHelper = HelperProvider::getXMLHelper(mdg);
+ // XMLDocumentPtr myXMLDocument = myXMLHelper->loadFile("b46693.xsd"
+ // );
+
+ // if ((i = myXMLHelper->getErrorCount()) > 0)
+ // {
+ // cout << "b46693 reported some errors:" << endl;
+ // for (j=0;j<i;j++)
+ // {
+ // const char* m = myXMLHelper->getErrorMessage(j);
+ // if (m != 0)cout << m;
+ // cout << endl;
+ // }
+ // }
+ return 1;
+
+ }
+ catch (SDORuntimeException e)
+ {
+ if (!silent)cout << "b46693 failed" << endl << e << endl;
+ return 0;
+ }
+
+}
+
+int sdotest::clonetest()
+{
+ try {
+ DataFactoryPtr mdg = DataFactory::getDataFactory();
+
+ mdg->addType("companyNS","CompanyType");
+ mdg->addType("companyNS","DepartmentType");
+ mdg->addType("companyNS","EmployeeType");
+
+
+ const Type& tstring = mdg->getType("commonj.sdo","String");
+ const Type& tbool = mdg->getType("commonj.sdo","Boolean");
+ const Type& tcs = mdg->getType("commonj.sdo","ChangeSummary");
+ const Type& tcomp = mdg->getType("companyNS","CompanyType");
+ const Type& tdept = mdg->getType("companyNS","DepartmentType");
+ const Type& temp = mdg->getType("companyNS","EmployeeType");
+
+ mdg->addPropertyToType(tcomp,"name",tstring);
+ mdg->addPropertyToType(tcomp,"departments",tdept,true,false,true);
+ mdg->addPropertyToType(tcomp,"employeeOfTheMonth",temp,false,false,false);
+ mdg->addPropertyToType(tcomp,"CEO",temp,false,false,true);
+
+ mdg->addPropertyToType(tdept,"employees",temp,true,false,true);
+ mdg->addPropertyToType(tdept,"name",tstring,false,false,true);
+ mdg->addPropertyToType(tdept,"location",tstring,false,false,true);
+ mdg->addPropertyToType(tdept,"number",tstring,false,false,true);
+
+ mdg->addPropertyToType(temp,"name",tstring,false,false,true);
+ mdg->addPropertyToType(temp,"SN",tstring,false,false,true);
+ mdg->addPropertyToType(temp,"manager",tbool,false,false,true);
+
+
+ DataObjectPtr comp = mdg->create((Type&)tcomp);
+ comp->setCString("name","The Company");
+
+ DataObjectPtr dept = mdg->create((Type&)tdept);
+
+ DataObjectList& dol = comp->getList("departments");
+ dol.append(dept);
+
+ dept->setCString("name","The Department");
+ dept->setCString("location","Botley");
+ dept->setCString("number","123");
+
+
+ // now clone the data factory, and add more types
+
+ DataFactoryPtr df2 = staticCast<DataFactoryImplPtr>(mdg)->clone();
+
+ df2->addType("otherNS","DataSet");
+
+ df2->addPropertyToType("companyNS","DepartmentType","dataset",
+ "otherNS","DataSet", false, false, true);
+
+ const Type& tstring2 = df2->getType("commonj.sdo","String");
+ const Type& tbool2 = df2->getType("commonj.sdo","Boolean");
+ const Type& tcs2 = df2->getType("commonj.sdo","ChangeSummary");
+ const Type& tcomp2 = df2->getType("companyNS","CompanyType");
+ const Type& tdept2 = df2->getType("companyNS","DepartmentType");
+ const Type& temp2 = df2->getType("companyNS","EmployeeType");
+
+ DataObjectPtr comp2 = df2->create((Type&)tcomp2);
+ comp->setCString("name","The Company");
+
+ DataObjectPtr dept2 = df2->create((Type&)tdept2);
+
+ DataObjectList& dol2 = comp2->getList("departments");
+ dol2.append(dept2);
+
+ dept2->setCString("name","The Other Department");
+ dept2->setCString("location","Not Botley");
+ dept2->setCString("number","321");
+
+ return 1;
+ }
+ catch (SDORuntimeException e)
+ {
+ if (!silent)cout << "clone failed " << e << endl;
+ return 0;
+ }
+
+
+}
+
+int sdotest::testUtil()
+{
+ try {
+
+
+ DataFactoryPtr mdg = DataFactory::getDataFactory();
+
+
+ mdg->addType("companyNS","CompanyType");
+ // employee will be an open type...
+ mdg->addType("companyNS","EmployeeType", /*seq*/false,
+ /*open*/true,
+ /*abs */ false,
+ /*data*/ false);
+
+ mdg->addType("companyNS","DepartmentType");
+
+ mdg->addType("companyNS","OpenType");
+
+ /* Now add the properties to the types...*/
+
+
+ const Type& tstring = mdg->getType("commonj.sdo","String");
+ const Type& tbool = mdg->getType("commonj.sdo","Boolean");
+ const Type& tcs = mdg->getType("commonj.sdo","ChangeSummary");
+ const Type& tcomp = mdg->getType("companyNS","CompanyType");
+ const Type& tdept = mdg->getType("companyNS","DepartmentType");
+ const Type& temp = mdg->getType("companyNS","EmployeeType");
+ const Type& topen = mdg->getType("companyNS","OpenType");
+
+
+ mdg->addPropertyToType(tcomp,"name",tstring);
+ // not containment...
+ mdg->addPropertyToType(tcomp,"employeeOfTheMonth",temp, false,false,false);
+ mdg->addPropertyToType(tcomp,"departments",tdept, true);
+ mdg->addPropertyToType(tcomp,"cs",tcs);
+
+ mdg->addPropertyToType(tdept,"name",tstring);
+ mdg->addPropertyToType(tdept,"location",tstring);
+ mdg->addPropertyToType(tdept,"number",tstring);
+ mdg->addPropertyToType(tdept,"employees",temp,true);
+
+ mdg->addPropertyToType(temp, "name",tstring);
+ mdg->addPropertyToType(temp, "SN", tstring);
+ mdg->addPropertyToType(temp, "manager", tbool);
+
+ mdg->addPropertyToType(topen,"name",tstring);
+
+ DataObjectPtr comp = mdg->create((Type&)tcomp);
+ comp->setCString("name","ACME");
+
+ DataObjectPtr dept = mdg->create((Type&)tdept);
+ DataObjectList& dol = comp->getList("departments");
+ dol.append(dept);
+
+ dept->setCString("name","Advanced Technologies");
+ dept->setCString("location","NY");
+ dept->setCString("number","123");
+
+ DataObjectList& emps = dept->getList("employees");
+
+ DataObjectPtr emp1 = mdg->create(temp);
+ DataObjectPtr emp2 = mdg->create(temp);
+ DataObjectPtr emp3 = mdg->create(temp);
+
+ emps.append(emp1);
+ emps.append(emp2);
+ emps.append(emp3);
+
+ emp1->setCString("name","Albert");
+ emp1->setCString("SN","E0001");
+
+ emp2->setCString("name","Boris");
+ emp2->setCString("SN","E0002");
+ emp2->setBoolean("manager",true);
+
+ emp3->setCString("name","Carl");
+ emp3->setCString("SN","E0003");
+
+ emp1->setCString("openstring","Value Of Open String");
+ emp1->setBoolean("openboolean",true);
+
+ const char* c = emp1->getCString("openstring");
+
+ bool b = emp1->getBoolean("openboolean");
+
+ // unknown list type at present..
+ DataObjectList& dl = emp1->getList("openintlist");
+
+ int i = 45;
+ dl.append((short)i); // now the list must be primitive and short!!
+
+ // unknown list type at present..
+ DataObjectList& dl2 = emp1->getList("opendataobjectlist");
+
+ DataObjectPtr myopen = mdg->create("companyNS","OpenType");
+ myopen->setCString("name","MyOpenName");
+ dl2.append(myopen); // now the list must be of data objects
+
+ emp1->setDataObject("opendataobject", myopen);
+
+ filebuf fb;
+ fb.open ("testutils.dat",ios::out);
+ ostream os(&fb);
+ SDOUtils::printDataObject(os, comp);
+ fb.close();
+ return comparefiles("testutils.dat","testutils.txt");
+
+
+ }
+ catch (SDORuntimeException e)
+ {
+ if (!silent)cout << "ERROR in UTILS test" << e << endl;
+ return 0;
+ }
+
+}
+
+int sdotest::printset(FILE *f, ChangeSummaryPtr cs)
+{
+ ChangedDataObjectList& cdl = cs->getChangedDataObjects();
+
+ // here there should be a creation of Ed, and a change to dept, which has a
+ // bool previously unset, and a int list previuously unset and an employees list
+ // previously unset
+
+ for (unsigned int i=0;i< cdl.size();i++)
+ {
+ if (cs->isModified(cdl[i]))
+ {
+
+ fprintf(f,"A modified of type %s#%s\n",cdl[i]->getType().getURI()
+ ,cdl[i]->getType().getName());
+
+ SettingList& sl = cs->getOldValues(cdl[i]);
+ if (sl.size() == 0)
+ {
+ fprintf(f,"No Settings found\n");
+ }
+ else
+ {
+ for (int j=0;j< sl.size(); j++)
+ {
+ fprintf(f,"Property %s",sl[j].getProperty().getName());
+ // this could be a many-valued property, and could be one which is
+ // a data object or a data type...
+ if (sl[j].getProperty().isMany())
+ {
+ fprintf(f,"[%s]",sl[j].getIndex());
+ }
+ if (!sl[j].isSet())
+ {
+ fprintf(f," was unset before the change\n");
+ }
+ else
+ {
+ fprintf(f," was set before the change !!\n");
+ }
+ }
+ }
+ }
+ }
+ return 1;
+}
+
+
+int sdotest::b46633()
+{
+ try {
+
+ FILE *f = fopen("b46633.dat","w+");
+ if (f == 0)
+ {
+ if (!silent)cout << "Unable to open b46633.dat" << endl;
+ return 0;
+ }
+
+ DataFactoryPtr mdg = DataFactory::getDataFactory();
+
+ mdg->addType("myspace","Root");
+ mdg->addPropertyToType("myspace","Root","cs",
+ "commonj.sdo","ChangeSummary", false, false, false);
+
+ mdg->addType("myspace","Company");
+ mdg->addType("myspace","Department");
+ mdg->addType("myspace","Manager");
+ mdg->addType("myspace","Employee");
+
+
+ mdg->addPropertyToType("myspace","Company","name",
+ "commonj.sdo","String", false, false, false);
+
+
+ mdg->addPropertyToType("myspace","Root","company",
+ "myspace","Company", false, false, true);
+
+ mdg->addPropertyToType("myspace","Company","departments",
+ "myspace","Department", true, false, true);
+
+
+ mdg->addPropertyToType("myspace","Department","name",
+ "commonj.sdo","String", false, false, false);
+
+ mdg->addPropertyToType("myspace","Department","ints",
+ "commonj.sdo","Int", true, false, false);
+
+
+ mdg->addPropertyToType("myspace","Department","bool",
+ "commonj.sdo","Boolean", false, false, false);
+
+ mdg->addPropertyToType("myspace","Department","manager",
+ "myspace","Manager", false, false, true);
+
+ mdg->addPropertyToType("myspace","Department","employees",
+ "myspace","Employee", true, false, true);
+
+ mdg->addPropertyToType("myspace","Manager","name",
+ "commonj.sdo","String", false, false, false);
+
+ mdg->addPropertyToType("myspace","Employee","name",
+ "commonj.sdo","String", false, false, false);
+
+ const Type& tcc = mdg->getType("myspace","Root");
+
+ DataObjectPtr dor = mdg->create((Type&)tcc);
+
+ ChangeSummaryPtr cs = dor->getChangeSummary();
+
+ DataObjectPtr com = dor->createDataObject("company");
+ com->setCString("name","IBM");
+
+ DataObjectPtr dept = com->createDataObject("departments");
+ dept->setCString("name","JTC");
+
+ // employees initally unset
+
+ cs->beginLogging();
+
+ DataObjectPtr emp = dept->createDataObject("employees");
+ emp->setCString("name","Ed");
+
+
+
+ DataObjectList& dl = dept->getList("ints");
+ dl.append((long)400);
+
+ dept->setBoolean("bool", true);
+
+ printset(f,cs);
+
+ cs->endLogging();
+
+ // unset them all , restart logging, and get the same results
+
+ dept->unset("bool");
+ dept->unset("ints");
+ dept->unset("employees");
+
+ cs->beginLogging();
+
+ DataObjectPtr emp2 = dept->createDataObject("employees");
+ emp2->setCString("name","Ed2");
+
+ dl.append((long)600);
+
+ dept->setBoolean("bool", true);
+
+ printset(f, cs);
+
+ cs->endLogging();
+
+ fclose(f);
+
+ return comparefiles("b46633.dat","b46633.txt");
+
+ }
+ catch (SDORuntimeException e)
+ {
+ if (!silent)cout << "b46633 failed " << e << endl;
+ return 0;
+ }
+
+}
+
+
+
+int sdotest::testLoad()
+{
+ try
+ {
+ unsigned int i,j;
+ DataFactoryPtr mdg = DataFactory::getDataFactory();
+ FILE* f = fopen("company_with_nillable_SN.xsd","r+");
+ char* buffer = new char[4000];
+ j = 0;
+ while ((i = fgetc(f)) != EOF)
+ {
+ buffer[j++] = (char)i;
+ }
+ buffer[j] = 0;
+ XSDHelperPtr xsh = HelperProvider::getXSDHelper(mdg);
+ xsh->define(buffer);
+
+ if ((i = xsh->getErrorCount()) > 0)
+ {
+ if (!silent) {
+ cout << "XSD reported some errors:" << endl;
+ for (j=0;j<i;j++)
+ {
+ const char *m = xsh->getErrorMessage(j);
+ if (m != 0) cout << m;
+ cout << endl;
+ }
+ }
+ return 0;
+ }
+
+ FILE* f2 = fopen("company_with_nillable_SN.xml","r+");
+ j = 0;
+ while ((i = fgetc(f2)) != EOF)
+ {
+ buffer[j++] = (char)i;
+ }
+ buffer[j] = 0;
+
+ XMLHelperPtr myXMLHelper = HelperProvider::getXMLHelper(mdg);
+ XMLDocumentPtr myXMLDocument = myXMLHelper->load(buffer);
+ return 1;
+
+ }
+ catch (SDORuntimeException e)
+ {
+ if (!silent)cout << "Exception in testDAS " << e << endl;
+ return 0;
+ }
+}
+
+int sdotest::includetest()
+{
+ try
+ {
+ unsigned int i,j;
+ DataFactoryPtr mdg = DataFactory::getDataFactory();
+
+ XSDHelperPtr xsh = HelperProvider::getXSDHelper(mdg);
+
+ xsh->defineFile("include.xsd");
+ if ((i = xsh->getErrorCount()) > 0)
+ {
+ if (!silent)
+ {
+ cout << "INCLUDE XSD reported some errors:" << endl;
+ for (j=0;j<i;j++)
+ {
+ const char *m = xsh->getErrorMessage(j);
+ if (m != 0) cout << m;
+ cout << endl;
+ }
+ }
+ return 0;
+ }
+
+ xsh->defineFile("../test/test/includeother.xsd");
+ if ((i = xsh->getErrorCount()) > 0)
+ {
+ if (!silent)
+ {
+ cout << "INCLUDE XSD reported some errors:" << endl;
+ for (j=0;j<i;j++)
+ {
+ const char *m = xsh->getErrorMessage(j);
+ if (m != 0) cout << m;
+ cout << endl;
+ }
+ }
+ return 0;
+ }
+ return 1;
+ }
+ catch (SDORuntimeException e)
+ {
+ if (!silent)cout << "Exception in include test" << e << endl;
+ return 0;
+ }
+}
+
+int sdotest::detachtest()
+{
+ try {
+ DataFactoryPtr mdg = DataFactory::getDataFactory();
+
+ mdg->addType("myspace","Root");
+
+ mdg->addType("myspace","Company");
+ mdg->addType("myspace","Department");
+ mdg->addType("myspace","Manager");
+ mdg->addType("myspace","Employee");
+
+
+ mdg->addPropertyToType("myspace","Company","name",
+ "commonj.sdo","String", false, false, false);
+
+
+ mdg->addPropertyToType("myspace","Root","company",
+ "myspace","Company", false, false, true);
+
+ mdg->addPropertyToType("myspace","Company","departments",
+ "myspace","Department", true, false, true);
+
+
+ mdg->addPropertyToType("myspace","Department","name",
+ "commonj.sdo","String", false, false, false);
+
+
+ mdg->addPropertyToType("myspace","Department","manager",
+ "myspace","Manager", false, false, true);
+
+ mdg->addPropertyToType("myspace","Department","employees",
+ "myspace","Employee", true, false, true);
+
+ mdg->addPropertyToType("myspace","Manager","name",
+ "commonj.sdo","String", false, false, false);
+
+ mdg->addPropertyToType("myspace","Employee","name",
+ "commonj.sdo","String", false, false, false);
+
+ const Type& tcc = mdg->getType("myspace","Root");
+
+ DataObjectPtr dor = mdg->create((Type&)tcc);
+
+ DataObjectPtr com = dor->createDataObject("company");
+ com->setCString("name","IBM");
+
+ DataObjectPtr dept = com->createDataObject("departments");
+
+ dept->setCString("name","JTC");
+
+
+ DataObjectPtr emp = dept->createDataObject("employees");
+ emp->setCString("name","Ed");
+
+ DataObjectPtr emp2 = dept->createDataObject("employees");
+ emp2->setCString("name","Tom");
+
+ DataObjectList& dol = dept->getList("employees");
+
+ DataObjectPtr e = dol[0];
+ e->detach();
+
+ DataObjectPtr cont = emp->getContainer();
+
+ if (cont != 0)
+ {
+ if (!silent)cout << "EMP STILL ATTACHED - problem" << endl;
+ return 0;
+ }
+
+ DataObjectPtr cont2 = dol[0]->getContainer();
+
+ if (cont2 == 0)
+ {
+ if (!silent)cout << "SECOND DETACHED - problem" << endl;
+ return 0;
+ }
+
+ return 1;
+
+ }
+ catch (SDORuntimeException e)
+ {
+ if (!silent)cout << "detach failed " << e << endl;
+ return 0;
+ }
+
+}
+
+
+int sdotest::leak()
+{
+ try {
+ DataFactoryPtr mdg = DataFactory::getDataFactory();
+
+ mdg->addType("myspace","Root");
+
+
+ mdg->addPropertyToType("myspace","Root","ints",
+ "commonj.sdo","Int", true, false, false);
+
+
+ const Type& tcc = mdg->getType("myspace","Root");
+
+ DataObjectPtr dor = mdg->create((Type&)tcc);
+
+
+ if (dor->isSet("ints")) return 0;
+
+ DataObjectList& dl = dor->getList("ints");
+
+ if (dor->isSet("ints")) return 0;
+
+ dl.append((long)400);
+
+ if (!dor->isSet("ints")) return 0;
+
+ dl.remove(0);
+
+ if (dor->isSet("ints")) return 0;
+
+ dl.append((long)400);
+
+ if (!dor->isSet("ints")) return 0;
+
+ dor->unset("ints");
+
+ if (dor->isSet("ints")) return 0;
+
+ dl.append((long)600);
+
+ if (!dor->isSet("ints")) return 0;
+
+ return 1;
+
+
+ }
+ catch (SDORuntimeException e)
+ {
+ if (!silent)cout << "leak failed " << e << endl;
+ return 0;
+ }
+
+}
+
+int sdotest::twolists()
+{
+ try {
+ DataFactoryPtr mdg = DataFactory::getDataFactory();
+
+ mdg->addType("myspace","Root");
+
+ mdg->addPropertyToType("myspace","Root","ints",
+ "commonj.sdo","Int", true, false, false);
+
+ mdg->addPropertyToType("myspace","Root","ints2",
+ "commonj.sdo","Int", true, false, false);
+
+
+ const Type& tcc = mdg->getType("myspace","Root");
+
+ DataObjectPtr dor = mdg->create((Type&)tcc);
+
+ DataObjectList& dl2 = dor->getList("ints2");
+ dl2.append((long)400);
+
+
+ DataObjectList& dl = dor->getList("ints");
+ dl.append((long)400);
+ return 1;
+
+
+ }
+ catch (SDORuntimeException e)
+ {
+ if (!silent)cout << "twolists failed " << e << endl;
+ return 0;
+ }
+
+}
+
+
+int sdotest::graham4()
+{
+ try {
+ DataFactoryPtr mdg = DataFactory::getDataFactory();
+
+ mdg->addType("myspace","Root");
+ mdg->addType("myspace","ListItem");
+
+
+ mdg->addPropertyToType("myspace","ListItem","name",
+ "commonj.sdo","String", false, false, false);
+
+
+ mdg->addPropertyToType("myspace","Root","ints",
+ "commonj.sdo","Int", true, false, false);
+
+ mdg->addPropertyToType("myspace","Root","items",
+ "myspace","ListItem", true, false, true);
+
+
+ const Type& tcc = mdg->getType("myspace","Root");
+
+ DataObjectPtr dor = mdg->create((Type&)tcc);
+
+
+ // first try with no elements in lists
+
+ try {
+ DataObjectPtr pitem = dor->getDataObject("items[name=\"hello\"]");
+ return 0;
+ }
+ catch (const SDOPathNotFoundException&)
+ {
+ //cout << "Normal exception in Graham4" << endl;
+ }
+
+ try {
+ int inty = dor->getInt("ints[1]");
+ return 0;
+ }
+ catch (const SDOIndexOutOfRangeException&)
+ {
+ //cout << "Normal exception in Graham4" << endl;
+ }
+
+ // now populate them
+
+ DataObjectPtr myitem = dor->createDataObject("items");
+ myitem->setCString("name","not hello");
+
+ try {
+ DataObjectPtr pitem2 = dor->getDataObject("items[name=\"hello\"]");
+ return 0;
+ }
+ catch (const SDOPathNotFoundException&)
+ {
+ //cout << "Normal exception in Graham4" << endl;
+ }
+
+ DataObjectList& dl = dor->getList("ints");
+ dl.append((long)100);
+
+ try {
+ int inty2 = dor->getInt("ints[2]");
+ return 0;
+ }
+ catch (const SDOIndexOutOfRangeException&)
+ {
+ //cout << "Normal exception in Graham4" << endl;
+ }
+
+ try
+ {
+ DataObjectPtr pitem2 = dor->getDataObject("items[name=\"not hello\"]");
+ }
+ catch (SDORuntimeException e)
+ {
+ if (!silent)cout << "ABNORMAL exception in Graham4" << endl;
+ return 0;
+ }
+
+ try {
+ int inty2 = dor->getInt("ints[1]");
+ //cout << "Int is " << inty2 << endl;
+ return 1;
+ }
+ catch (SDOIndexOutOfRangeException e)
+ {
+
+ if (!silent)cout << "ABNORMAL exception in Graham4" << endl;
+ return 0;
+ }
+
+ }
+ catch (SDORuntimeException e)
+ {
+ if (!silent)cout << "twolists failed " << e << endl;
+ return 0;
+ }
+
+}
+
+
+int sdotest::graham5()
+{
+ try
+ {
+ unsigned int i,j;
+ DataFactoryPtr mdg = DataFactory::getDataFactory();
+
+ XSDHelperPtr xsh = HelperProvider::getXSDHelper(mdg);
+
+ xsh->defineFile("Order.xsd");
+ if ((i = xsh->getErrorCount()) > 0)
+ {
+ if (!silent)
+ {
+ cout << "INCLUDE XSD reported some errors:" << endl;
+ for (j=0;j<i;j++)
+ {
+ const char *m = xsh->getErrorMessage(j);
+ if (m != 0) cout << m;
+ cout << endl;
+ }
+ }
+ return 0;
+ }
+ return 1;
+ }
+ catch (SDORuntimeException r)
+ {
+ if (!silent)cout << "Graham5 failed " << r << endl;
+ return 0;
+ }
+}
+
+int sdotest::graham6()
+{
+ try
+ {
+ unsigned int i,j;
+ DataFactoryPtr mdg = DataFactory::getDataFactory();
+
+ XSDHelperPtr xsh = HelperProvider::getXSDHelper(mdg);
+
+ xsh->defineFile("g/Order.xsd");
+ if ((i = xsh->getErrorCount()) > 0)
+ {
+ if (!silent)
+ {
+ cout << "INCLUDE XSD reported some errors:" << endl;
+ for (j=0;j<i;j++)
+ {
+ const char *m = xsh->getErrorMessage(j);
+ if (m != 0) cout << m;
+ cout << endl;
+ }
+ }
+ return 0;
+ }
+
+ XMLHelperPtr xmh = HelperProvider::getXMLHelper(mdg);
+ XMLDocumentPtr doc = xmh->loadFile("g/order.xml", "orderNS");
+
+ char* str = xmh->save(doc);
+ FILE* f = fopen("g/string-output.xml","w+");
+ if (f != 0)
+ {
+ fputs(str,f);
+ fclose(f);
+ }
+
+ xmh->save(doc,"g/graham6-output.xml");
+
+ // now get the root and try that
+ DataObjectPtr dob = doc->getRootDataObject();
+ char* str2 = xmh->save(dob,"orderNS","order");
+ FILE* f2 = fopen("g/string-output-2.xml","w+");
+ if (f2 != 0)
+ {
+ fputs(str2,f2);
+ fclose(f2);
+ }
+
+ xmh->save(dob,"orderNS","order", "g/graham6-output-2.xml");
+
+ if (!comparefiles("g/string-output.xml","g/string-output.txt"))return 0;
+ if (!comparefiles("g/graham6-output.xml","g/graham6-output.txt")) return 0;
+ if (!comparefiles("g/string-output-2.xml","g/string-output-2.txt")) return 0;
+ return 1;
+
+ }
+ catch (SDORuntimeException r)
+ {
+ if (!silent)cout << "Graham6 failed " << r << endl;
+ return 0;
+ }
+}
+
+int sdotest::b47137()
+{
+
+ try
+ {
+ FILE *f = fopen("b47137.dat","w+");
+ if (f == 0)
+ {
+ if (!silent)cout << "Unable to open b47137.dat" << endl;
+ }
+
+ DataFactoryPtr mdg = DataFactory::getDataFactory();
+
+ XSDHelperPtr xsh = HelperProvider::getXSDHelper(mdg);
+
+ xsh->defineFile("b47137.xsd");
+
+ DataObjectPtr dob = mdg->create("","guid");
+
+ const Type& t = dob->getType();
+
+ PropertyList pl = t.getProperties();
+
+ for (unsigned int i=0;i<pl.size();i++)
+ {
+ fprintf(f,"Property:%s\n", pl[i].getName());
+ }
+
+ dob->setCString("value","Hello");
+ dob->setBoolean("isPermaLink",true);
+
+ XMLHelperPtr xmh = HelperProvider::getXMLHelper(mdg);
+
+ xmh->save(dob,"","fluid","b47137_out.xml");
+
+ // now try to read back the file ..
+
+ XMLDocumentPtr doc = xmh->loadFile("b47137_out.xml", "");
+
+ DataObjectPtr dob2 = doc->getRootDataObject();
+
+ const Type& t2 = dob2->getType();
+
+ PropertyList pl2 = t2.getProperties();
+
+ for (unsigned int j=0;j<pl2.size();j++)
+ {
+ fprintf(f,"Property:%s\n",pl2[j].getName());
+ fprintf(f, "Value:%s\n", dob2->getCString(pl2[j]));
+ }
+
+ fclose(f);
+ return comparefiles("b47137.dat","b47137.txt");
+ }
+ catch (SDORuntimeException e)
+ {
+ if (!silent)cout << "B47137 failed " << e << endl;
+ return 0;
+ }
+}
+
+int sdotest::b47137b()
+{
+ unsigned int i,j;
+ try
+ {
+
+ FILE *f = fopen("b47137b.dat","w+");
+ if (f == 0)
+ {
+ if (!silent) cout << "Unable to open b47137b.dat" << endl;
+ return 0;
+ }
+
+ DataFactoryPtr mdg = DataFactory::getDataFactory();
+
+ XSDHelperPtr xsh = HelperProvider::getXSDHelper(mdg);
+
+ xsh->defineFile("b47137b.xsd");
+
+ if ((i = xsh->getErrorCount()) > 0)
+ {
+ if (!silent)
+ {
+ cout << "INCLUDE XSD reported some errors:" << endl;
+ for (j=0;j<i;j++)
+ {
+ const char *m = xsh->getErrorMessage(j);
+ if (m != 0) cout << m;
+ cout << endl;
+ }
+ }
+ return 0;
+ }
+
+ TypeList tl = mdg->getTypes();
+ for (unsigned int k=0;k<tl.size();k++)
+ {
+ fprintf(f,"Type:%s#%s\n",tl[k].getURI(),tl[k].getName());
+ }
+
+ DataObjectPtr dob = mdg->create("companyNS","CompanyType");
+
+ const Type& t = dob->getType();
+
+ PropertyList pl = t.getProperties();
+
+ for (unsigned int i=0;i<pl.size();i++)
+ {
+ fprintf(f, "Property:%s\n",pl[i].getName());
+ }
+
+ DataObjectPtr dobguid = dob->createDataObject("guid");
+
+ dobguid->setCString("value","Wilbur");
+ dobguid->setBoolean("isPermaLink",true);
+
+ XMLHelperPtr xmh = HelperProvider::getXMLHelper(mdg);
+
+ xmh->save(dob,"","company","b47137b_out.xml");
+
+ // now try to read back the file ..
+
+ XMLDocumentPtr doc = xmh->loadFile("b47137b_out.xml", "");
+
+ DataObjectPtr dob2 = doc->getRootDataObject();
+
+ const Type& t2 = dob2->getType();
+
+ PropertyList pl2 = t2.getProperties();
+
+ for (unsigned int j=0;j<pl2.size();j++)
+ {
+
+ fprintf(f,"Property:%s\n",pl2[j].getName());
+ if (!strcmp(pl2[j].getName(),"guid"))
+ {
+ DataObjectPtr dobguid2 = dob2->getDataObject("guid");
+ if (dobguid2 != 0)
+ {
+ fprintf(f,"guid Value:%s\n",dobguid2->getCString("value"));
+ fprintf(f,"guid isPermaLink:",dobguid2->getCString("isPermaLink"));
+ }
+ else
+ {
+ fprintf(f,"GUID is empty\n");
+ }
+ }
+ }
+ fclose(f);
+ return comparefiles("b47137b.dat","b47137b.txt");
+
+ }
+ catch (SDORuntimeException e)
+ {
+ if (!silent)cout << "B47137b failed " << e << endl;
+ return 0;
+ }
+}
+
+int sdotest::b47293()
+{
+ unsigned int i,j,k;
+ try
+ {
+ FILE *f = fopen("b47293.dat","w+");
+ if (f == 0)
+ {
+ if (!silent)cout << "Unable to open b47293.dat" << endl;
+ return 0;
+ }
+
+ DataFactoryPtr mdg = DataFactory::getDataFactory();
+
+ XSDHelperPtr xsh = HelperProvider::getXSDHelper(mdg);
+
+ xsh->defineFile("47293Catalog.xsd");
+
+ if ((i = xsh->getErrorCount()) > 0)
+ {
+ if (!silent)
+ {
+ cout << "47293 XSD reported some errors:" << endl;
+ for (j=0;j<i;j++)
+ {
+ const char *m = xsh->getErrorMessage(j);
+ if (m != 0) cout << m;
+ cout << endl;
+ }
+ }
+ return 0;
+ }
+
+ TypeList tl = mdg->getTypes();
+ for ( k=0;k<tl.size();k++)
+ {
+ fprintf(f,"Type:%s#%s",tl[k].getURI(),tl[k].getName());
+ }
+
+ xsh->generateFile(tl,"47293Catalog-out.xsd","catalogNS",0);
+
+ DataFactoryPtr mdg2 = DataFactory::getDataFactory();
+
+ XSDHelperPtr xsh2 = HelperProvider::getXSDHelper(mdg2);
+
+ xsh2->defineFile("47293Catalog-out.xsd");
+
+ if ((i = xsh2->getErrorCount()) > 0)
+ {
+ if (!silent)
+ {
+ cout << "47293-out XSD reported some errors:" << endl;
+ for (j=0;j<i;j++)
+ {
+ const char *m = xsh2->getErrorMessage(j);
+ if (m != 0) cout << m;
+ cout << endl;
+ }
+ }
+ return 0;
+ }
+
+ TypeList tl2 = mdg2->getTypes();
+ for (k=0;k<tl2.size();k++)
+ {
+ fprintf(f,"Type:%s#%s\n",tl2[k].getURI(),tl2[k].getName());
+ }
+ fclose(f);
+ return comparefiles("b47293.dat","b47293.txt");
+ }
+ catch (SDORuntimeException e)
+ {
+ if (!silent)cout << "B47137b failed " << e << endl;
+ return 0;
+ }
+}
+
+
+int sdotest::b47802()
+{
+ try {
+ DataFactoryPtr mdg = DataFactory::getDataFactory();
+
+ mdg->addType("myspace","Root");
+ mdg->addType("myspace","ListItem");
+
+ mdg->addPropertyToType("myspace","Root","ints",
+ "commonj.sdo","Int", true, false, false);
+
+ mdg->addPropertyToType("myspace","Root","items",
+ "myspace","ListItem", true, false, true);
+
+
+ const Type& tcc = mdg->getType("myspace","Root");
+ const Type& tcl = mdg->getType("myspace","ListItem");
+
+ DataObjectPtr dor = mdg->create((Type&)tcc);
+
+ DataObjectList& dol1 = dor->getList("ints");
+
+ DataObjectList& dol2 = dor->getList("items");
+
+
+ dol1.append((long)34);
+ dol1.append((long)56);
+
+ DataObjectPtr li1 = mdg->create(tcl);
+ DataObjectPtr li2 = mdg->create(tcl);
+
+ dol2.append(li1);
+ dol2.append(li2);
+
+ dor->unset("ints[1]"); // should work
+ dor->unset("items.0"); // should work
+
+ try {
+
+ dor->unset("ints[2]"); // should not work
+ return 0;
+ }
+ catch (SDOIndexOutOfRangeException e)
+ {
+ //cout << "Normal index oor in 47802" << endl;
+ }
+
+ try {
+ dor->unset("items.1"); // should not work
+ return 0;
+ }
+ catch (SDOIndexOutOfRangeException e)
+ {
+ // cout << "Normal index oor in 47802" << endl;
+ }
+ return 1;
+ }
+ catch (SDORuntimeException e)
+ {
+ if (!silent)cout << "Problem in b47802" << e << endl;
+ return 0;
+ }
+}
+
+
+int sdotest::b47663()
+{
+ try {
+ DataFactoryPtr mdg = DataFactory::getDataFactory();
+ DataFactoryPtr mdg2 = DataFactory::getDataFactory();
+
+ mdg->addType("myspace","Root");
+ mdg->addType("myspace","ListItem");
+ mdg->addType("myspace","Item");
+
+ mdg->addPropertyToType("myspace","Root","itemref",
+ "myspace","Item", false, false, false);
+
+ mdg->addPropertyToType("myspace","Root","itemcont",
+ "myspace","Item", false, false, true);
+
+ mdg->addPropertyToType("myspace","Root","items",
+ "myspace","ListItem", true, false, true);
+
+ mdg2->addType("myspace","Root");
+ mdg2->addType("myspace","ListItem");
+ mdg2->addType("myspace","Item");
+
+ mdg2->addPropertyToType("myspace","Root","itemref",
+ "myspace","Item", false, false, false);
+
+ mdg2->addPropertyToType("myspace","Root","itemcont",
+ "myspace","Item", false, false, true);
+
+ mdg2->addPropertyToType("myspace","Root","items",
+ "myspace","ListItem", true, false, true);
+
+
+
+ const Type& tcc = mdg->getType("myspace","Root");
+ const Type& tcl = mdg->getType("myspace","ListItem");
+ const Type& tci = mdg->getType("myspace","Item");
+
+ DataObjectPtr dor = mdg->create((Type&)tcc);
+ DataObjectPtr it1 = mdg->create((Type&)tci);
+ DataObjectList& dol1 = dor->getList("items");
+ DataObjectPtr li11 = mdg->create(tcl);
+ DataObjectPtr li12 = mdg->create(tcl);
+
+
+ const Type& tcc2 = mdg2->getType("myspace","Root");
+ const Type& tcl2 = mdg2->getType("myspace","ListItem");
+ const Type& tci2 = mdg2->getType("myspace","Item");
+ DataObjectPtr dor2 = mdg2->create((Type&)tcc2);
+ DataObjectPtr it2 = mdg2->create((Type&)tci2);
+ DataObjectList& dol2 = dor2->getList("items");
+ DataObjectPtr li21 = mdg2->create(tcl2);
+ DataObjectPtr li22 = mdg2->create(tcl2);
+
+
+ try
+ {
+ // append from wrong factory to list
+ dol1.append(li21);
+ //cout << "ERROR - 47764 should not append from wrong factory" << endl;
+ //cout << "Updated test case: Correctly used data object from compatible factory" <<
+ // endl;
+ }
+ catch (SDOInvalidConversionException e)
+ {
+ if (!silent)cout << "ERROR: Incorrect invalid conversion exception" << e << endl;
+ return 0;
+ }
+
+ try
+ {
+ // add object from wrong factory to reference.
+ dor2->setDataObject("itemref",it1);
+ return 0;
+ }
+ catch (SDOUnsupportedOperationException e)
+ {
+ // expected ,as a reference cannot be outside the graph
+ }
+
+ try
+ {
+ // add object from wrong factory to reference.
+ dor2->setDataObject("itemcont",it1);
+ }
+ catch (SDORuntimeException e)
+ {
+ if (!silent)cout << "Add contained object from second factory not OK" << endl;
+ return 0;
+ }
+
+
+ dol2.append(li22); // OK
+
+ try
+ {
+ dol2.insert(0,li11);
+ //cout << "Updated test case: Correctly used data object from compatible factory" <<
+ // endl;
+ //cout << "ERROR - 47764 should not insert from wrong factory" << endl;
+ }
+ catch (SDOInvalidConversionException e)
+ {
+ if (!silent)cout << "Incorrect invalid conversion exception" << e << endl;
+ return 0;
+ }
+
+ try
+ {
+ dol2.setDataObject(0,li12);
+ //cout << "Updated test case: Correctly used data object from compatible factory" <<
+ // endl;
+ // cout << "ERROR - 47764 should not set in list from wrong factory" << endl;
+ }
+ catch (SDOInvalidConversionException e)
+ {
+ if (!silent)cout << "Incorrect invalid conversion exception" << e << endl;
+ return 0;
+ }
+ return 1;
+
+ }
+ catch (SDORuntimeException e)
+ {
+ if (!silent)cout << "Problem in b47663" << e << endl;
+ return 0;
+ }
+}
+
+
+int sdotest::bunique()
+{
+ try {
+ DataFactoryPtr mdg = DataFactory::getDataFactory();
+
+ mdg->addType("test","Root");
+ mdg->addType("test","Duplicate");
+ mdg->addType("nottest","Duplicate");
+ mdg->addType("test","Unique");
+ mdg->addType("test","Object");
+
+ mdg->addPropertyToType("test","Root","duplicate",
+ "test","Duplicate", false, false, true);
+
+ mdg->addPropertyToType("test","Root","duplicate2",
+ "nottest","Duplicate", false, false, true);
+
+ mdg->addPropertyToType("test","Root","unique",
+ "test","Unique", false, false, true);
+
+ mdg->addPropertyToType("test","Root","duplicatelist",
+ "test","Duplicate", true, false, true);
+
+ mdg->addPropertyToType("test","Root","duplicatelist2",
+ "nottest","Duplicate", true, false, true);
+
+ mdg->addPropertyToType("test","Root","uniquelist",
+ "test","Unique", true, false, true);
+
+ mdg->addPropertyToType("test","Duplicate","id",
+ "commonj.sdo","Int", false, false, false);
+
+ mdg->addPropertyToType("nottest","Duplicate","id",
+ "commonj.sdo","Int", false, false, false);
+
+ mdg->addPropertyToType("test","Unique","id",
+ "commonj.sdo","Int", false, false, false);
+
+ mdg->addPropertyToType("test","Duplicate","ob",
+ "test","Object", false, false, true);
+
+ mdg->addPropertyToType("nottest","Duplicate","ob",
+ "test","Object", false, false, true);
+
+ mdg->addPropertyToType("test","Unique","ob",
+ "test","Object", false, false, true);
+
+ const Type& troot = mdg->getType("test","Root");
+ const Type& tdup1 = mdg->getType("test","Duplicate");
+ const Type& tdup2 = mdg->getType("nottest","Duplicate");
+ const Type& tuniq = mdg->getType("test","Unique");
+ const Type& tob = mdg->getType("test","Object");
+
+ DataObjectPtr rooty = mdg->create(troot);
+
+ DataObjectPtr dup1 = mdg->create(tdup1);
+ dup1->setInt("id",1);
+ DataObjectPtr dup2 = mdg->create(tdup1);
+ dup2->setInt("id",2);
+ DataObjectPtr dup3 = mdg->create(tdup2);
+ dup3->setInt("id",3);
+ DataObjectPtr dup4 = mdg->create(tdup2);
+ dup4->setInt("id",4);
+ DataObjectPtr uni1 = mdg->create(tuniq);
+ uni1->setInt("id",5);
+ DataObjectPtr uni2 = mdg->create(tuniq);
+ uni2->setInt("id",6);
+
+ DataObjectPtr ob1 = mdg->create(tob);
+ dup1->setDataObject("ob",ob1);
+ DataObjectPtr ob2 = mdg->create(tob);
+ dup2->setDataObject("ob",ob2);
+ DataObjectPtr ob3 = mdg->create(tob);
+ uni1->setDataObject("ob",ob3);
+
+ DataObjectList& dl1 = rooty->getList("duplicatelist");
+ DataObjectList& dl2 = rooty->getList("duplicatelist2");
+ DataObjectList& dl3 = rooty->getList("uniquelist");
+
+ rooty->setDataObject("duplicate",dup1);
+ dl1.append(dup2);
+
+ rooty->setDataObject("duplicate2",dup3);
+ dl2.append(dup4);
+
+ rooty->setDataObject("unique",uni1);
+
+ dl3.append(uni2);
+
+ XSDHelperPtr xsh = HelperProvider::getXSDHelper(mdg);
+
+ TypeList tl = mdg->getTypes();
+
+ xsh->generateFile(tl,"bunique-out.xsd","test");
+
+ XMLHelperPtr xmh = HelperProvider::getXMLHelper(mdg);
+
+ xmh->save(rooty,"","rooty","bunique-out.xml");
+
+ if (!comparefiles("bunique-out.xsd","bunique-out.txt")) return 0;
+ if (!comparefiles("bunique-out.xml","bunique-outxml.txt")) return 0;
+ return 1;
+ }
+ catch (SDORuntimeException e)
+ {
+ if (!silent)cout << "Problem in bunique" << e << endl;
+ return 0;
+ }
+}
+
+int sdotest::buniqueread()
+{
+ try {
+
+ unsigned int i,j,k;
+
+ DataFactoryPtr mdg = DataFactory::getDataFactory();
+
+ XSDHelperPtr xsh = HelperProvider::getXSDHelper(mdg);
+
+ xsh->defineFile("bunique-out.xsd");
+
+ if ((i = xsh->getErrorCount()) > 0)
+ {
+ if (!silent)
+ {
+ cout << "47293 XSD reported some errors:" << endl;
+ for (j=0;j<i;j++)
+ {
+ const char *m = xsh->getErrorMessage(j);
+ if (m != 0) cout << m;
+ cout << endl;
+ }
+ return 0;
+ }
+ }
+
+ TypeList tl = mdg->getTypes();
+ for ( k=0;k<tl.size();k++)
+ {
+ //cout << "Type:" << tl[k].getURI() << "#" << tl[k].getName() << endl;
+ }
+
+
+ XMLHelperPtr xmh = HelperProvider::getXMLHelper(mdg);
+
+ XMLDocumentPtr doc = xmh->loadFile("bunique-out.xml", "rooty");
+
+ DataObjectPtr rooty = doc->getRootDataObject();
+
+ xsh->generateFile(tl,"buniqueread-out.xsd","test");
+
+ xmh->save(rooty,"","rooty","buniqueread-out.xml");
+
+ return comparefiles("buniqueread-out.xml","buniqueread-out.txt");
+
+ }
+ catch (SDORuntimeException e)
+ {
+ if (!silent)cout << "Problem in buniqueread" << e << endl;
+ return 0;
+ }
+}
+
+
+int sdotest::testwsdl()
+{
+ try {
+
+ unsigned int i,j;
+
+ DataFactoryPtr mdg = DataFactory::getDataFactory();
+
+ XSDHelperPtr xsh = HelperProvider::getXSDHelper(mdg);
+
+ xsh->defineFile("wsdl.xsd");
+ if ((i = xsh->getErrorCount()) > 0)
+ {
+ if (!silent)
+ {
+ cout << "WSDL XSD reported some errors:" << endl;
+ for (j=0;j<i;j++)
+ {
+ const char *m = xsh->getErrorMessage(j);
+ if (m != 0) cout << m;
+ cout << endl;
+ }
+
+ }
+ return 0;
+ }
+ xsh->defineFile("wsdl-soap.xsd");
+ if ((i = xsh->getErrorCount()) > 0)
+ {
+ if (!silent)
+ {
+ cout << "WSDL SOAP XSD reported some errors:" << endl;
+ for (j=0;j<i;j++)
+ {
+ const char* m = xsh->getErrorMessage(j);
+ if (m != 0) cout << m;
+ cout << endl;
+ }
+
+ }
+ return 0;
+ }
+ xsh->defineFile("wsdl-http.xsd");
+ if ((i = xsh->getErrorCount()) > 0)
+ {
+ if (!silent)
+ {
+ cout << "WSDL HTTP XSD reported some errors:" << endl;
+ for (j=0;j<i;j++)
+ {
+ const char* m = xsh->getErrorMessage(j);
+ if (m != 0) cout << m;
+ cout << endl;
+ }
+ }
+ return 0;
+ }
+
+ TypeList tl = mdg->getTypes();
+
+ for (i=0;i<tl.size();i++)
+ {
+ //cout << "TYPE:" << tl[i].getURI() << "#" << tl[i].getName() << endl;
+ }
+
+ DataObjectPtr root = mdg->create("http://schemas.xmlsoap.org/wsdl/","tDefinitions");
+
+
+ DataObjectPtr mess = mdg->create("http://schemas.xmlsoap.org/wsdl/","tMessage");
+ mess->setCString("name","testRequest");
+
+ DataObjectPtr part = mdg->create("http://schemas.xmlsoap.org/wsdl/","tPart");
+ part->setCString("name","name");
+ part->setCString("type","http://www.w3.org/2001/XMLSchema-instance#string");
+
+ DataObjectPtr part2 = mdg->create("http://schemas.xmlsoap.org/wsdl/","tPart");
+ part2->setCString("name","name");
+ part2->setCString("type","http://I want/this/added/to/the/urls#string");
+
+
+ DataObjectList& dol = root->getList("message");
+
+ dol.append(mess);
+
+ DataObjectList& dol2 = mess->getList("part");
+
+ dol2.append(part);
+ dol2.append(part2);
+
+ XMLHelperPtr xmh = HelperProvider::getXMLHelper(mdg);
+
+ xmh->save(root,"","definitions","testwsdl.xml");
+
+ return comparefiles("testwsdl.xml","testwsdl.txt");
+
+ }
+ catch (SDORuntimeException e)
+ {
+ if (!silent)cout << "testwsdl failed" << endl << e << endl;
+ return 0;
+ }
+
+}
+
+
+
+int sdotest::travel()
+{
+ try {
+
+ unsigned int i,j;
+
+ FILE *f = fopen("travel.dat","w+");
+ if (f == 0)
+ {
+ if (!silent)cout << "Unable to open travel.dat" << endl;
+ return 0;
+ }
+
+ DataFactoryPtr mdg = DataFactory::getDataFactory();
+
+ XSDHelperPtr xsh = HelperProvider::getXSDHelper(mdg);
+
+ xsh->defineFile("TravelBookingSchema.xsd");
+ if ((i = xsh->getErrorCount()) > 0)
+ {
+ if (!silent)
+ {
+ cout << "WSDL XSD reported some errors:" << endl;
+ for (j=0;j<i;j++)
+ {
+ const char *m = xsh->getErrorMessage(j);
+ if (m != 0) cout << m;
+ cout << endl;
+ }
+ }
+ return 0;
+ }
+
+ TypeList tl = mdg->getTypes();
+
+ fprintf(f, "*******************************TYPES**********************\n");
+
+ for (i=0;i<tl.size();i++)
+ {
+ fprintf(f,"TYPE:%s#%s\n",tl[i].getURI(),tl[i].getName());
+ }
+ fprintf(f, "*******************************END TYPES******************\n");
+
+
+ XMLHelperPtr xmh = HelperProvider::getXMLHelper(mdg);
+
+ XMLDocumentPtr doc = xmh->loadFile("TravelBookingUsingSchema.xml");
+
+ DataObjectPtr rooty = doc->getRootDataObject();
+
+ fprintf(f, "*******************************DATA**********************\n");
+ printDataObject(f, rooty);
+ fprintf(f,"***************************END DATA**********************\n");
+
+ fclose(f);
+ return comparefiles("travel.dat","travel.txt");
+
+
+ }
+ catch (SDORuntimeException e)
+ {
+ if (!silent)cout << "travel failed" << endl << e << endl;
+ return 0;
+ }
+
+}
+
+
+int sdotest::oddchars()
+{
+ try {
+
+ unsigned int i,j;
+
+ DataFactoryPtr mdg = DataFactory::getDataFactory();
+
+ XSDHelperPtr xsh = HelperProvider::getXSDHelper(mdg);
+
+ xsh->defineFile("OddChars.xsd");
+ if ((i = xsh->getErrorCount()) > 0)
+ {
+ if (!silent)
+ {
+ cout << "ODDCHARS XSD reported some errors:" << endl;
+ for (j=0;j<i;j++)
+ {
+ const char *m = xsh->getErrorMessage(j);
+ if (m != 0) cout << m;
+ cout << endl;
+ }
+ }
+ return 0;
+ }
+
+
+ XMLHelperPtr xmh = HelperProvider::getXMLHelper(mdg);
+
+ XMLDocumentPtr doc = xmh->loadFile("OddChars.xml");
+
+ if ((i = xmh->getErrorCount()) > 0)
+ {
+ if (!silent)
+ {
+ cout << "OddChars reported some errors:" << endl;
+ for (j=0;j<i;j++)
+ {
+ const char *m = xmh->getErrorMessage(j);
+ if (m != 0) cout << m;
+ cout << endl;
+ }
+ }
+ return 0;
+ }
+
+ DataObjectPtr rooty = doc->getRootDataObject();
+
+ FILE *f = fopen ("oddchars.dat","w+");
+ if (f == 0)
+ {
+ if (!silent)cout << "Unable to open oddchars.dat" << endl;
+ return 0;
+ }
+ printDataObject(f, rooty);
+
+ fclose(f);
+ return comparefiles("oddchars.dat","oddchars.txt");
+
+ }
+ catch (SDORuntimeException e)
+ {
+ if (!silent)cout << "oddchars failed" << endl << e << endl;
+ return 0;
+ }
+
+}
+
+int sdotest::unsetlist()
+{
+ try {
+ DataFactoryPtr mdg = DataFactory::getDataFactory();
+
+ mdg->addType("test","Root");
+ mdg->addType("test","ListItem");
+
+ mdg->addPropertyToType("test","Root","list",
+ "test","ListItem", true, false, true);
+
+ const Type& troot = mdg->getType("test","Root");
+ const Type& tlist = mdg->getType("test","ListItem");
+
+ DataObjectPtr rooty = mdg->create(troot);
+
+ DataObjectList& dl = rooty->getList("list");
+
+
+ DataObjectPtr li1 = mdg->create(tlist);
+ DataObjectPtr li2 = mdg->create(tlist);
+ DataObjectPtr li3 = mdg->create(tlist);
+
+
+ dl.append(li1);
+ dl.append(li2);
+ dl.append(li3);
+
+ rooty->unset("list[3]");
+
+ dl.append(li3);
+
+ rooty->unset("list.2");
+
+ return 1;
+
+ }
+ catch (SDORuntimeException e)
+ {
+ if (!silent)cout << "Problem in unsetlist" << e << endl;
+ return 0;
+ }
+}
+
+
+int sdotest::notns()
+{
+ try {
+
+
+ DataFactoryPtr mdg = DataFactory::getDataFactory();
+
+
+ mdg->addType("","Root");
+ mdg->addType("","ListItem");
+
+ mdg->addPropertyToType("","Root","list",
+ "","ListItem", true, false, true);
+
+ const Type& troot = mdg->getType("","Root");
+ const Type& tlist = mdg->getType("","ListItem");
+
+ DataObjectPtr rooty = mdg->create(troot);
+
+ DataObjectList& dl = rooty->getList("list");
+
+
+ DataObjectPtr li1 = mdg->create(tlist);
+ DataObjectPtr li2 = mdg->create(tlist);
+ DataObjectPtr li3 = mdg->create(tlist);
+
+
+ dl.append(li1);
+ dl.append(li2);
+ dl.append(li3);
+
+
+ XMLHelperPtr xmh = HelperProvider::getXMLHelper(mdg);
+
+ xmh->save(rooty,"","root","notns.xml");
+
+ return comparefiles("notns.xml","notns.txt");
+
+
+ }
+ catch (SDORuntimeException e)
+ {
+ if (!silent)cout << "notns" << endl << e << endl;
+ return 0;
+ }
+
+}
+
+int sdotest::badelement()
+{
+ try {
+
+ unsigned int i,j;
+ DataFactoryPtr mdg = DataFactory::getDataFactory();
+
+ XSDHelperPtr xsh = HelperProvider::getXSDHelper(mdg);
+
+ xsh->defineFile("BadElement.xsd");
+ if ((i = xsh->getErrorCount()) > 0)
+ {
+ if (!silent)
+ {
+ cout << "PROBLEM: BADELEMENT XSD reported some errors:" << endl;
+ for (j=0;j<i;j++)
+ {
+ const char *m = xsh->getErrorMessage(j);
+ if (m != 0) cout << m;
+ cout << endl;
+ }
+ }
+ return 0;
+ }
+
+ XMLHelperPtr xmh = HelperProvider::getXMLHelper(mdg);
+
+ XMLDocumentPtr doc = xmh->loadFile("BadElement.xml");
+
+ if ((i = xmh->getErrorCount()) > 0)
+ {
+ FILE *f = fopen("badelement.dat","w+");
+ if (f == 0)
+ {
+ if (!silent)cout << "Unable to open badelement.dat" << endl;
+ return 0;
+ }
+ fprintf(f,"BADELEMENT correctly found errors:\n");
+ for (j=0;j<i;j++)
+ {
+ const char *m = xmh->getErrorMessage(j);
+ if (m != 0) fprintf(f,"%s\n", m);
+ }
+ fclose (f);
+ return comparefiles("badelement.dat","badelement.txt");
+ }
+ else
+ {
+ if (!silent)cout << "Expected errors, got none" << endl;
+ return 0;
+ }
+
+ }
+ catch (SDORuntimeException e)
+ {
+ if (!silent)cout << "badelement" << endl << e << endl;
+ return 0;
+ }
+
+}
+
+
+int sdotest::testastyle(FILE *f, const char* style)
+{
+
+ unsigned int i,j;
+
+
+ DataFactoryPtr mdg = DataFactory::getDataFactory();
+
+ XSDHelperPtr xsh = HelperProvider::getXSDHelper(mdg);
+
+ xsh->defineFile(style);
+
+ if ((i = xsh->getErrorCount()) > 0)
+ {
+ if (!silent)
+ {
+ cout << "PROBLEM: TESTSTYLES XSD reported some errors:" << endl;
+ for (j=0;j<i;j++)
+ {
+ const char *m = xsh->getErrorMessage(j);
+ if (m != 0) cout << m;
+ cout << endl;
+ }
+ }
+ return 0;
+ }
+
+ TypeList tl = mdg->getTypes();
+
+ fprintf(f,"*****STYLE %s\n",style);
+
+ for (i=0;i<tl.size();i++)
+ {
+ fprintf(f,"Type: %s#%s\n", tl[i].getURI(),tl[i].getName());
+ if (!strcmp(tl[i].getName(),"library"))
+ {
+ PropertyList pl = tl[i].getProperties();
+ for (unsigned int j=0;j<pl.size();j++)
+ {
+ fprintf(f,"Property:%s\n",pl[j].getName());
+ }
+ }
+ }
+
+ fprintf(f, "*************\n");
+
+ // now try creating elements...
+
+ XMLHelperPtr xmh = HelperProvider::getXMLHelper(mdg);
+
+ XMLDocumentPtr doc = xmh->createDocument(); // with no name, URI - uses first in schema
+
+ DataObjectPtr root = doc->getRootDataObject();
+
+ fprintf(f,"Root is:%s#%s\n",root->getType().getURI(),
+ root->getType().getName());
+
+
+ XMLDocumentPtr doc1 = xmh->createDocument("library"); // with no URI - uses first in schema
+
+ DataObjectPtr root1 = doc1->getRootDataObject();
+
+ fprintf(f,"Root is:%s#%s\n",root1->getType().getURI(),
+ root1->getType().getName());
+
+ XMLDocumentPtr doc2 = xmh->createDocument("library","libraryNS"); // with URI
+
+ DataObjectPtr root2 = doc2->getRootDataObject();
+
+ fprintf(f, "Root is:%s#%s\n",root2->getType().getURI(),
+ root2->getType().getName());
+ return 1;
+
+
+}
+
+int sdotest::teststyles()
+{
+ try
+ {
+
+ FILE *f = fopen("teststyles.dat","w+");
+ if (f == 0)
+ {
+ if (!silent)cout << "Unable to open teststyles.dat" << endl;
+ return 0;
+ }
+ testastyle(f,"Style1.xsd");
+ testastyle(f,"Style2.xsd");
+ testastyle(f,"Style3.xsd");
+ //testastyle("Style4.xsd"); = groups not supported yet.
+ fclose(f);
+ return comparefiles("teststyles.dat","teststyles.txt");
+ }
+ catch (SDORuntimeException e)
+ {
+ if (!silent)cout << "teststyles" << endl << e << endl;
+ return 0;
+ }
+
+}
+
+
+int sdotest::testinc2(const char* inc, const char* name1, const char* name2)
+{
+
+
+ unsigned int i,j;
+
+ try {
+
+ FILE *f = fopen(name1,"w+");
+ if (f == 0)
+ {
+ if (!silent)cout << "Unable to open " << name1 << endl;
+ return 0;
+ }
+
+ DataFactoryPtr mdg = DataFactory::getDataFactory();
+
+ XSDHelperPtr xsh = HelperProvider::getXSDHelper(mdg);
+
+ xsh->defineFile(inc);
+
+ if ((i = xsh->getErrorCount()) > 0)
+ {
+ if (!silent)
+ {
+ cout << "PROBLEM: TestInc2 XSD reported some errors:" << endl;
+ for (j=0;j<i;j++)
+ {
+ const char *m = xsh->getErrorMessage(j);
+ if (m != 0) cout << m;
+ cout << endl;
+ }
+ }
+ return 0;
+ }
+
+ TypeList tl = mdg->getTypes();
+
+ //cout << "***** CALCULATOR ***************************************" << endl;
+
+ for (i=0;i<tl.size();i++)
+ {
+ fprintf(f, "Type:%s#%s\n", tl[i].getURI(),tl[i].getName());
+ PropertyList pl = tl[i].getProperties();
+ for (unsigned int j=0;j<pl.size();j++)
+ {
+ fprintf(f,"Property:%s\n",pl[j].getName());
+ }
+ }
+
+ //cout << "*******************************END TYPES******************" << endl;
+ fclose(f);
+ return comparefiles((char*)name1, (char*)name2);
+
+ }
+ catch (SDORuntimeException e)
+ {
+ if (!silent)cout << "Exception in testinc2" << endl;
+ return 0;
+ }
+
+}
+
+
+
+int sdotest::b48300()
+{
+ return testany("bug48300.xsd",0,"bug48300.xml",0);
+}
+
+
+int sdotest::testOrder(const char* x1, const char* x2, const char* name1,
+ const char* name2)
+{
+
+ unsigned int i,j;
+
+ try {
+
+ FILE *f = fopen(name1,"w+");
+ if (f == 0)
+ {
+ if (!silent)cout << "Unable to open " << name1 << endl;
+ return 0;
+ }
+
+ DataFactoryPtr mdg = DataFactory::getDataFactory();
+
+ XSDHelperPtr xsh = HelperProvider::getXSDHelper(mdg);
+
+ xsh->defineFile(x1);
+
+ if ((i = xsh->getErrorCount()) > 0)
+ {
+ if (!silent)
+ {
+ cout << "PROBLEM: Order XSD1 reported some errors:" << endl;
+ for (j=0;j<i;j++)
+ {
+ const char *m = xsh->getErrorMessage(j);
+ if (m != 0) cout << m;
+ cout << endl;
+ }
+ }
+ fclose(f);
+ return 0;
+ }
+
+ xsh->defineFile(x2);
+
+ if ((i = xsh->getErrorCount()) > 0)
+ {
+ if (!silent)
+ {
+ cout << "PROBLEM: Order XSD2 reported some errors:" << endl;
+ for (j=0;j<i;j++)
+ {
+ const char *m = xsh->getErrorMessage(j);
+ if (m != 0) cout << m;
+ cout << endl;
+ }
+ }
+ fclose(f);
+ return 0;
+ }
+
+ TypeList tl = mdg->getTypes();
+
+ //cout << "***** TESTORDER ****************************************" << endl;
+
+ for (i=0;i<tl.size();i++)
+ {
+ if (!strcmp(tl[i].getURI(),"commonj.sdo")) continue;
+ fprintf(f,"Type:%s#%s\n",tl[i].getURI(),tl[i].getName());
+ PropertyList pl = tl[i].getProperties();
+ for (unsigned int j=0;j<pl.size();j++)
+ {
+ fprintf(f,"Property:%s\n", pl[j].getName());
+ }
+ }
+
+ //cout << "*******************************END TYPES******************" << endl;
+
+ fclose(f);
+ return comparefiles((char*)name1, (char*)name2);
+
+ }
+ catch (SDORuntimeException e)
+ {
+ if (!silent)cout << "Exception in TestOrder" << e << endl;
+ return 0;
+ }
+}
+
+int sdotest::simple()
+{
+
+
+ unsigned int i,j;
+
+ try {
+
+ FILE *f = fopen("simple.dat","w+");
+ if (f == 0)
+ {
+ if (!silent)cout << "Unable to open simple.dat" << endl;
+ return 0;
+ }
+
+ DataFactoryPtr mdg = DataFactory::getDataFactory();
+
+ XSDHelperPtr xsh = HelperProvider::getXSDHelper(mdg);
+
+ xsh->defineFile("simple.xsd");
+
+ if ((i = xsh->getErrorCount()) > 0)
+ {
+ if (!silent)
+ {
+ cout << "PROBLEM: Order simple.xsd reported some errors:" << endl;
+ for (j=0;j<i;j++)
+ {
+ const char *m = xsh->getErrorMessage(j);
+ if (m != 0) cout << m;
+ cout << endl;
+ }
+ }
+ return 0;
+ }
+
+
+ TypeList tl = mdg->getTypes();
+
+ //cout << "***** SIMPLE ****************************************" << endl;
+
+ for (i=0;i<tl.size();i++)
+ {
+ if (!strcmp(tl[i].getURI(),"commonj.sdo")) continue;
+ fprintf(f, "Type:%s#%s\n",tl[i].getURI(),tl[i].getName());
+ PropertyList pl = tl[i].getProperties();
+ for (unsigned int j=0;j<pl.size();j++)
+ {
+ fprintf(f,"Property:%s\n",pl[j].getName());
+ fprintf(f, "Type of property:%s\n",pl[j].getType().getName());
+ fprintf(f, "IsMany?%d\n",pl[j].isMany());
+ }
+ }
+
+ //cout << "*******************************SIMPLE******************" << endl;
+
+ XMLHelperPtr xmh = HelperProvider::getXMLHelper(mdg);
+
+ XMLDocumentPtr doc = xmh->loadFile("simple.xml");
+
+ if ((i = xmh->getErrorCount()) > 0)
+ {
+ if (!silent)
+ {
+ cout << "Simple found errors:" << endl;
+ for (j=0;j<i;j++)
+ {
+ const char *m = xmh->getErrorMessage(j);
+ if (m != 0) cout << m;
+ cout << endl;
+ }
+ }
+ return 0;
+ }
+
+ DataObjectPtr dob = doc->getRootDataObject();
+
+ printDataObject(f, dob);
+
+ fclose(f);
+ return comparefiles("simple.dat","simple.txt");
+
+ }
+ catch (SDORuntimeException e)
+ {
+ if (!silent)cout << "Exception in TestAny" << e << endl;
+ return 0;
+ }
+}
+
+int sdotest::cdatatest()
+{
+ try
+ {
+ DataFactoryPtr mdg = DataFactory::getDataFactory();
+
+ /**
+ * Get an XSD helper to load XSD information into the
+ * data factory
+ */
+ XSDHelperPtr myXSDHelper = HelperProvider::getXSDHelper(mdg);
+ myXSDHelper->defineFile("cdata.xsd");
+
+ /**
+ * Check if there were any errors. The parse may still
+ * succeed, but errors indicate some elements were not
+ * understood
+ */
+ unsigned int i = 0;
+ unsigned int j = 0;
+ if ((i = myXSDHelper->getErrorCount()) > 0)
+ {
+ cout << "XSD Loading reported some errors:" << endl;
+ for (j=0;j<i;j++)
+ {
+ const char *m = myXSDHelper->getErrorMessage(j);
+ if (m != 0) cout << m;
+ cout << endl;
+ return 0;
+ }
+ }
+
+ /**
+ * Use the same data factory to load XML corresponding to
+ * data objects adhering to the previously loaded schema
+ */
+ XMLHelperPtr myXMLHelper = HelperProvider::getXMLHelper(mdg);
+ XMLDocumentPtr myXMLDocument = myXMLHelper->loadFile("cdata-in.xml", "http://www.example.org/test");
+
+ /**
+ * Check if there were any errors. The parse may still
+ * succeed, but errors indicate some elements did not match
+ * the schema, or were malformed.
+ *
+ */
+ if ((i = myXMLHelper->getErrorCount()) > 0)
+ {
+ cout << "XML Loading reported some errors:" << endl;
+ for (j=0;j<i;j++)
+ {
+ const char *m = myXMLHelper->getErrorMessage(j);
+ if (m != 0) cout << m;
+ cout << endl;
+ return 0;
+ }
+ }
+
+ // write the XML element back out to a file
+ myXMLHelper->save(myXMLDocument, "cdata-testout.xml");
+
+ return comparefiles("cdata-out.xml","cdata-testout.xml");
+
+ }
+ catch (SDORuntimeException e)
+ {
+ cout << "Exception in cdata test" << endl;
+ cout << e.getMessageText();
+ return 0;
+ }
+}
+
+int sdotest::cloneopentest()
+{
+ try
+ {
+ DataFactoryPtr mdg = DataFactory::getDataFactory();
+
+ /**
+ * Get an XSD helper to load XSD information into the
+ * data factory
+ */
+ XSDHelperPtr myXSDHelper = HelperProvider::getXSDHelper(mdg);
+ myXSDHelper->defineFile("clone.xsd");
+
+ /**
+ * Check if there were any errors. The parse may still
+ * succeed, but errors indicate some elements were not
+ * understood
+ */
+ unsigned int i = 0;
+ unsigned int j = 0;
+ if ((i = myXSDHelper->getErrorCount()) > 0)
+ {
+ cout << "XSD Loading reported some errors:" << endl;
+ for (j=0;j<i;j++)
+ {
+ const char *m = myXSDHelper->getErrorMessage(j);
+ if (m != 0) cout << m;
+ cout << endl;
+ return 0;
+ }
+ }
+
+ /**
+ * Use the same data factory to load XML corresponding to
+ * data objects adhering to the previously loaded schema
+ */
+ XMLHelperPtr myXMLHelper = HelperProvider::getXMLHelper(mdg);
+ XMLDocumentPtr myXMLDocument = myXMLHelper->loadFile("clone-in.xml", "http://www.example.org/test");
+
+ /**
+ * Check if there were any errors. The parse may still
+ * succeed, but errors indicate some elements did not match
+ * the schema, or were malformed.
+ *
+ */
+ if ((i = myXMLHelper->getErrorCount()) > 0)
+ {
+ cout << "XML Loading reported some errors:" << endl;
+ for (j=0;j<i;j++)
+ {
+ const char *m = myXMLHelper->getErrorMessage(j);
+ if (m != 0) cout << m;
+ cout << endl;
+ return 0;
+ }
+ }
+
+ DataObjectPtr original = myXMLDocument->getRootDataObject();
+
+ // copy the data object we just read in
+ DataObjectPtr clone = CopyHelper::copy(original);
+
+ // create a new document based on this cloned data object
+ XMLDocumentPtr myNewXMLDocument = myXMLHelper->createDocument(clone,
+ "http://www.example.org/test",
+ "Clone");
+
+ // write the cloned document out to a file
+ myXMLHelper->save(myNewXMLDocument, "clone-testout.xml");
+
+#if defined(WIN32) || defined (_WINDOWS)
+
+ return comparefiles("clone-out-win.xml","clone-testout.xml");
+#else
+ return comparefiles("clone-out.xml","clone-testout.xml");
+#endif
+
+ }
+ catch (SDORuntimeException e)
+ {
+ cout << "Exception in clone test" << endl;
+ cout << e.getMessageText();
+ return 0;
+ }
+}
+
+class RefCountBase : public RefCountingObject
+{
+public:
+ RefCountBase(int& dtorCount) : dtorCount_(dtorCount) {}
+ ~RefCountBase() { ++dtorCount_; }
+protected:
+ int& dtorCount_;
+};
+
+class RefCountDerived : public RefCountBase
+{
+public:
+ RefCountDerived(int& dtorCount) : RefCountBase(dtorCount) {}
+ ~RefCountDerived() { ++dtorCount_; }
+};
+
+class RefCountOther : public RefCountingObject
+{
+public:
+ RefCountOther(int& dtorCount) : dtorCount_(dtorCount) {}
+ ~RefCountOther() { ++dtorCount_; }
+protected:
+ int& dtorCount_;
+};
+
+typedef RefCountingPointer<RefCountBase> RefCountBasePtr;
+typedef RefCountingPointer<RefCountDerived> RefCountDerivedPtr;
+typedef RefCountingPointer<RefCountOther> RefCountOtherPtr;
+
+int sdotest::refCount()
+{
+ int failures = 0;
+ try {
+ {
+ RefCountBasePtr ptr;
+ if (ptr) ++failures;
+ if (!ptr) {} else { ++failures; }
+ RefCountBasePtr ptr2(ptr);
+ if (ptr2) ++failures;
+ if (ptr == ptr2) {} else { ++failures; }
+ if (ptr != ptr2) ++ failures;
+ }
+ {
+ int dtorCount = 0;
+ {
+ RefCountBasePtr ptr(new RefCountBase(dtorCount));
+ if (ptr) {} else { ++failures; }
+ if (!ptr) ++failures;
+ RefCountBasePtr ptr2(ptr);
+ if (!ptr2) ++failures;
+ if (ptr == ptr2) {} else { ++failures; }
+ if (ptr != ptr2) ++failures;
+ if (ptr == ptr2.operator->()) {} else { ++failures; }
+ if (ptr != ptr2.operator->()) ++failures;
+ if (&(*ptr) == &(*ptr2)) {} else { ++failures; }
+ RefCountBasePtr ptr3;
+ ptr3 = ptr;
+ if (!ptr3) ++failures;
+ if (ptr == ptr3) {} else { ++failures; }
+ if (ptr != ptr3) ++failures;
+ }
+ if (dtorCount != 1) ++failures;
+ }
+ {
+ int dtorCount = 0;
+ {
+ RefCountDerived* tmp = new RefCountDerived(dtorCount);
+ RefCountBasePtr ptr(tmp);
+ RefCountDerivedPtr dPtr = staticCast<RefCountDerivedPtr>(ptr);
+ if (dPtr == tmp) {} else { ++failures; }
+ if (tmp == dPtr) {} else { ++failures; }
+ }
+ if (dtorCount != 2) ++failures;
+ }
+ {
+ int dtorCount = 0;
+ {
+ RefCountDerived* tmp = new RefCountDerived(dtorCount);
+ RefCountBasePtr ptr(tmp);
+ RefCountDerivedPtr dPtr = dynamicCast<RefCountDerivedPtr>(ptr);
+ if (dPtr == tmp) {} else { ++failures; }
+ if (tmp == dPtr) {} else { ++failures; }
+ if (dPtr != tmp) ++failures;
+ if (tmp != dPtr) ++failures;
+ }
+ if (dtorCount != 2) ++failures;
+ }
+ {
+ int dtorCount = 0;
+ {
+ RefCountOtherPtr ptr(new RefCountOther(dtorCount));
+ RefCountDerivedPtr dPtr = dynamicCast<RefCountDerivedPtr>(ptr);
+ if (dPtr == 0) {} else { ++failures; }
+ if (0 == dPtr) {} else { ++failures; }
+ if (dPtr != 0) ++failures;
+ if (0 != dPtr) ++failures;
+ }
+ if (dtorCount != 1) ++failures;
+ }
+ {
+ int dtorCount = 0;
+ {
+ RefCountBasePtr ptr(0);
+ RefCountBasePtr ptr2(new RefCountBase(dtorCount));
+ if (ptr < ptr2) {} else { ++failures; }
+ if (ptr2 > ptr) {} else { ++failures; }
+ if (ptr2 < ptr) ++failures;
+ if (ptr > ptr2) ++failures;
+ }
+ if (dtorCount != 1) ++failures;
+ }
+ {
+ int dtorCount = 0;
+ int dtorCount2 = 0;
+ {
+ RefCountBasePtr ptr1(new RefCountBase(dtorCount));
+ {
+ RefCountBasePtr ptr2(ptr1);
+ {
+ RefCountBasePtr ptr3(new RefCountBase(dtorCount2));
+ ptr1 = ptr3;
+ if (dtorCount != 0) ++failures;
+ if (dtorCount2 != 0) ++failures;
+ }
+ if (dtorCount != 0) ++failures;
+ if (dtorCount2 != 0) ++failures;
+ }
+ if (dtorCount != 1) ++failures;
+ if (dtorCount2 != 0) ++failures;
+ }
+ if (dtorCount != 1) ++failures;
+ if (dtorCount2 != 1) ++failures;
+ }
+ if (failures) return 0;
+ return 1;
+ }
+ catch (SDORuntimeException e)
+ {
+ if (!silent) cout << "RefCountingPointer test failed" << endl;
+ return 0;
+ }
+}
+
+int sdotest::elementFormDefaultQualified()
+{
+ try {
+ DataFactoryPtr mdg = DataFactory::getDataFactory();
+ XSDHelperPtr xsh = HelperProvider::getXSDHelper(mdg);
+ xsh->defineFile("StockQuoteService.wsdl");
+
+ DataObjectPtr doObj = mdg->create("http://swanandmokashi.com",
+ "GetQuotes");
+
+ doObj->setCString("QuoteTicker", "IBM");
+ XMLHelperPtr xmlHelper = HelperProvider::getXMLHelper(mdg);
+
+
+ XMLDocumentPtr doc =
+ xmlHelper->createDocument(doObj,
+ "http://swanandmokashi.com",
+ "GetQuotes");
+
+ xmlHelper->save(doc, "qualified-testout.xml");
+
+ return comparefiles("qualified.xml", "qualified-testout.xml");
+ }
+ catch (SDORuntimeException e) {
+ cout << "sdotest::elementFormDefaultQualified() failed" << endl << e << endl;
+ return 0;
+ }
+ return 0;
+}
+
+
+
diff --git a/sdo-cpp/trunk/runtime/core/test/sdotest.h b/sdo-cpp/trunk/runtime/core/test/sdotest.h
new file mode 100644
index 0000000000..ea5e4db3ac
--- /dev/null
+++ b/sdo-cpp/trunk/runtime/core/test/sdotest.h
@@ -0,0 +1,220 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you 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$ */
+
+#include "commonj/sdo/SDO.h"
+using namespace commonj::sdo;
+
+
+// test
+
+class sdotest {
+ public:
+
+ static bool silent;
+ static bool ramping;
+
+ /* utilities */
+
+ static int printseq(FILE *f, SequencePtr sptr);
+ static void printDataStructure(FILE *f,DataFactoryPtr dd);
+ static void printDataObject(FILE *f, DataObjectPtr dol);
+ static void printValue(FILE *f, DataObjectPtr dob, const Property& prop);
+ static void printList(FILE *f, DataObjectPtr dob, const Property& prop);
+ static void printOldValues(FILE *f, ChangeSummaryPtr cs, DataObjectPtr dob);
+ static void dumpchangesummary(FILE *f, ChangeSummaryPtr cs);
+ static int comparefiles(char* fn1, char*fn2);
+ static int dumpproperties(FILE *f, DataObjectPtr root);
+ static int printset(FILE *f, ChangeSummaryPtr cs);
+ static void populateFactory(DataFactoryPtr dfp);
+
+
+ static int xsdtosdo();
+
+ static void changeSummaryHeader(ChangeSummaryPtr cs);
+ static void changeSummaryFooter();
+ static void changeSummaryChange(int level, ChangeSummaryPtr cs, DataObjectPtr dob);
+ static void changeSummaryDeletedObject(int indent, const char* name, ChangeSummaryPtr cs, DataObjectPtr dob);
+ static void changeSummaryElements(int indent, ChangeSummaryPtr cs, DataObjectPtr dob);
+ static void changeSummarySetting(Setting& s);
+ static bool changeSummaryAttributes(ChangeSummaryPtr cs, DataObjectPtr dol);
+ static char* convert(const char* uri);
+
+ /* work in progress - generation of structures */
+
+ static void generate(DataFactoryPtr fac);
+
+ /* tests */
+ static int xhtml1();
+ static int definetest();
+ static int stocktest();
+
+ static int scopetest();
+ static DataObjectPtr scopetest2();
+
+
+ static int pete();
+ static int emptycs();
+ static int compatiblefactory();
+ static int transferto(DataObjectPtr d, DataFactoryPtr f, bool expecterror);
+ static int openseq();
+ static int testanytwo(const char* xsd,
+ const char* xsd2, const char* xml);
+ static int testany(const char* xsd,
+ const char* acceptedxsderror,
+ const char* xml,
+ const char* acceptedxmlerror);
+ static int testOrder(const char* x1, const char* x2,
+ const char* name1, const char* name2);
+ static int simple();
+ static int testinc2(const char* inc, const char* name1,
+ const char* name2);
+ static int testastyle(FILE *f, const char* style);
+ static int teststyles();
+ static int badelement();
+ static int oddchars();
+ static int notns();
+ static int unsetlist();
+ static int travel();
+ static int testwsdl();
+ static int bunique();
+ static int buniqueread();
+ static int propdefaulttest();
+ static int showdefault(FILE *f, const Type& tm);
+ static int graham6();
+ static int graham5();
+ static int graham4();
+ static int leak();
+ static int twolists();
+ static int detachtest();
+ static int includetest();
+ static int testLoad();
+ static int clonetest();
+ static int testUtil();
+ static int testErrors();
+ static int doctest();
+ static int notfound();
+ static int serializeChangeSummary(ChangeSummaryPtr cs);
+ static int cssave();
+ static int csload();
+ static int cssave2();
+ static int csload2();
+ static int bug1();
+ static int bug2();
+ static int setnull();
+ static int testsubsload();
+ static int testabstract();
+ static int testsubs();
+ static int testSCA();
+ static int testOpen();
+ static int saveOpen();
+ static int loadOpen();
+ static int testui();
+ static int merle1();
+ static int graham1();
+ static int graham2();
+ static int graham3();
+ static int loadManyOpen();
+ static int loadOpenNS();
+
+
+ static int eqhelpertest();
+ static int cohelpertest();
+ static int datetest();
+ static int matttest1();
+ static int adddeletetest();
+ static int carotest3();
+ static int carotest2();
+ static int carotest();
+ static int setmany();
+ static int noncontest();
+ static int versiontest();
+ static int defaulttest();
+ static int defaulttest_strobj();
+ static int querytest();
+ static int getproptest();
+ static int nulltest();
+ static int usertest();
+ static int rcptest();
+ static int boolbug();
+ static int scope1();
+ static int scope2();
+ static int scope3();
+ static int conversiontest();
+ static int changesummarytest();
+ static int scenario1();
+ static int scenario2();
+ static int scenario3();
+ static int scenario4();
+ static int scenario5();
+ static int seqtest();
+ static int printDataObject(DataObjectPtr dol);
+ static int printValue(DataObjectPtr dob, const Property& prop);
+ static int printList(DataObjectPtr dob, const Property& prop);
+ static int printOldValues(ChangeSummaryPtr cs, DataObjectPtr dob);
+ static int testGetters(DataObjectPtr dor);
+ static int testGetter(DataObjectPtr dor, char* str);
+ static int maintest();
+ static int jira490();
+ static int jira705();
+ static int jira546();
+ static int jira945();
+ static int jira980();
+
+
+ static int b48602();
+ static int b48736();
+ static int b48686();
+ static int b48601();
+ static int b48300();
+ static int b47663();
+ static int b47764();
+ static int b47802();
+ static int b47293();
+ static int b47137();
+ static int b47137b();
+ static int b46633();
+ static int b46734();
+ static int b46693();
+ static int b46634();
+ static int b46613();
+ static int b46617();
+ static int b46617b();
+ static int b45933();
+ static int testXPath();
+ static int cdatatest();
+ static int cloneopentest();
+ static int tuscany963();
+ static int tuscany562();
+ static int upandatom();
+ static int typedefinitionstest();
+ static int eBayTest();
+ static int jira1174();
+ static int jira1238();
+ static int loadWithoutSchema();
+ static int jira445();
+ static int jira1112();
+ static int refCount();
+ static int elementFormDefaultQualified();
+ static int elementFormDefaultQualifiedSequence();
+ static int xsiTypeAbstract();
+ static int jira1548();
+ static int jira1837();
+};
diff --git a/sdo-cpp/trunk/runtime/core/test/sdotest2.cpp b/sdo-cpp/trunk/runtime/core/test/sdotest2.cpp
new file mode 100644
index 0000000000..e88062ea45
--- /dev/null
+++ b/sdo-cpp/trunk/runtime/core/test/sdotest2.cpp
@@ -0,0 +1,2226 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you 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$ */
+
+#include <stdio.h>
+
+#pragma warning(disable:4786)
+
+#include <iostream>
+#include <fstream>
+using namespace std;
+
+
+
+#include "sdotest.h"
+#include <commonj/sdo/XSDHelperImpl.h>
+
+
+using namespace commonj::sdo;
+using namespace commonj::sdo::internal;
+
+DataObjectPtr sdotest::scopetest2()
+{
+
+ DataFactoryPtr mdg = DataFactory::getDataFactory();
+
+ mdg->addType("myspace","Root");
+
+ mdg->addType("myspace","Company");
+
+ mdg->addPropertyToType("myspace","Company","name",
+ "commonj.sdo","String", false, false, false);
+
+ mdg->addPropertyToType("myspace","Company","id",
+ "commonj.sdo","String", false, false, false);
+
+ mdg->addPropertyToType("myspace","Root","company",
+ "myspace","Company", false, false, true);
+
+ const Type& tcc = mdg->getType("myspace","Root");
+
+ DataObjectPtr dop = mdg->create((Type&)tcc);
+
+ DataObjectPtr co = dop->createDataObject("company");
+
+ return dop;
+}
+
+int sdotest::scopetest()
+{
+ DataObjectPtr dob;
+ dob = scopetest2();
+
+ // fails on close?
+ return 1;
+}
+
+int sdotest::xsdtosdo()
+{
+const char* value;
+
+value = SDOUtils::XSDToSDO("string");
+if (!silent)cout << "XSDToSDO(string)=" << value << endl;
+if (strcmp(value,"String")) return 0;
+
+value = SDOUtils::XSDToSDO("int");
+if (!silent)cout << "XSDToSDO(int)="<< value << endl;
+if (strcmp(value,"Int")) return 0;
+
+value = SDOUtils::XSDToSDO("integer");
+if (!silent)cout << "XSDToSDO(integer)="<< value << endl;
+if (strcmp(value,"Integer")) return 0;
+
+value = SDOUtils::XSDToSDO("notinlist");
+if (!silent)cout << "XSDToSDO(notinlist)="<< value << endl;
+if (strcmp(value,"String")) return 0;
+
+value = SDOUtils::XSDToSDO("");
+if (!silent)cout << "XSDToSDO(\"\")="<< value << endl;
+if (strcmp(value,"String")) return 0;
+
+value = SDOUtils::XSDToSDO(0);
+if (!silent)cout << "XSDToSDO(0)="<< value << endl;
+if (strcmp(value,"String")) return 0;
+
+value = SDOUtils::SDOToXSD("String");
+if (!silent)cout << "SDOToXSD(String)="<< value << endl;
+if (strcmp(value,"string")) return 0;
+
+value = SDOUtils::SDOToXSD("Long");
+if (!silent)cout << "SDOToXSD(Long)="<< value << endl;
+if (strcmp(value,"unsignedLong")) return 0;
+
+value = SDOUtils::SDOToXSD("notinlist");
+if (!silent)cout << "SDOToXSD(notinlist)="<< value << endl;
+if (strcmp(value,"string")) return 0;
+
+value = SDOUtils::SDOToXSD("");
+if (!silent)cout << "SDOToXSD(\"\")="<< value << endl;
+if (strcmp(value,"string")) return 0;
+
+value = SDOUtils::SDOToXSD(0);
+if (!silent)cout << "SDOToXSD(0)="<< value << endl;
+if (strcmp(value,"string")) return 0;
+
+return 1;
+
+}
+
+// The compatibleFactory() test creates a series of factories that are either
+// identical or very similar so we need a function that populates a data
+// factory with the common part.
+
+void sdotest::populateFactory(DataFactoryPtr dfp)
+{
+
+ dfp->addType("Namespace", "Project");
+ dfp->addType("Namespace", "WorkPackage");
+ dfp->addType("Namespace", "LineItem");
+ dfp->addType("Namespace", "StringHolder");
+
+ dfp->addType("Namespace", "Root");
+ dfp->addPropertyToType("Namespace","Root","project",
+ "Namespace","Project", false, false, true);
+ dfp->addPropertyToType("Namespace","Project","wp",
+ "Namespace","WorkPackage", false, false, false);
+
+ dfp->addPropertyToType("Namespace","StringHolder","value",
+ "commonj.sdo","String", false, false, false);
+
+ dfp->addPropertyToType("Namespace","StringHolder","proj",
+ "Namespace","Project", false, false, false);
+
+ dfp->addPropertyToType("Namespace","Project","id",
+ "commonj.sdo","String", false, false, false);
+
+ dfp->addPropertyToType("Namespace","Project","string",
+ "Namespace","StringHolder", false, false, true);
+
+ dfp->addPropertyToType("Namespace","WorkPackage","name",
+ "commonj.sdo","String", false, false, false);
+
+
+ dfp->addPropertyToType("Namespace","WorkPackage","string",
+ "Namespace","StringHolder", false, false, true);
+
+ dfp->addPropertyToType("Namespace","LineItem","itemname",
+ "commonj.sdo","String", false, false, false);
+
+ dfp->addPropertyToType("Namespace","LineItem","string",
+ "Namespace","StringHolder", false, false, true);
+
+ dfp->addPropertyToType("Namespace","Project","packages",
+ "Namespace","WorkPackage", true, false, true);
+
+ dfp->addPropertyToType("Namespace","WorkPackage","lineitems",
+ "Namespace","LineItem", true, false, true);
+
+}
+
+int sdotest::compatiblefactory()
+{
+ DataFactoryPtr f1 = DataFactory::getDataFactory();
+ populateFactory(f1);
+
+ // project
+ // id (string)
+ // string (StringHolder)
+ // workpackages (WorkPackage)
+
+ // workpackage
+ // name (string)
+ // string (StringHolder)
+ // lineitems (LineItem)
+
+ // lineitem
+ // itemname (string)
+
+
+ // factories 1 and 2 are compatible
+
+ DataFactoryPtr f2 = DataFactory::getDataFactory();
+ populateFactory(f2);
+
+ // factory 3 has no project type
+
+ DataFactoryPtr f3 = DataFactory::getDataFactory();
+
+ f3->addType("Namespace","WorkPackage");
+ f3->addType("Namespace","LineItem");
+ f3->addType("Namespace","StringHolder");
+
+ f3->addType("Namespace","Root");
+ f3->addPropertyToType("Namespace","Root","project",
+ "Namespace","WorkPackage", false, false, true);
+
+
+ f3->addPropertyToType("Namespace","StringHolder","value",
+ "commonj.sdo","String", false, false, false);
+
+ f3->addPropertyToType("Namespace","WorkPackage","name",
+ "commonj.sdo","String", false, false, false);
+
+
+ f3->addPropertyToType("Namespace","WorkPackage","string",
+ "Namespace","StringHolder", false, false, true);
+
+ f3->addPropertyToType("Namespace","LineItem","itemname",
+ "commonj.sdo","String", false, false, false);
+
+ f3->addPropertyToType("Namespace","LineItem","string",
+ "Namespace","StringHolder", false, false, true);
+
+
+ f3->addPropertyToType("Namespace","WorkPackage","lineitems",
+ "Namespace","LineItem", true, false, true);
+
+
+ // factory 4 looks compatible - but stringholder is missing
+
+ DataFactoryPtr f4 = DataFactory::getDataFactory();
+
+ f4->addType("Namespace","Project");
+ f4->addType("Namespace","WorkPackage");
+ f4->addType("Namespace","LineItem");
+
+ f4->addType("Namespace","Root");
+ f4->addPropertyToType("Namespace","Root","project",
+ "Namespace","Project", false, false, true);
+
+
+ f4->addPropertyToType("Namespace","Project","id",
+ "commonj.sdo","String", false, false, false);
+
+
+ f4->addPropertyToType("Namespace","WorkPackage","name",
+ "commonj.sdo","String", false, false, false);
+
+
+ f4->addPropertyToType("Namespace","LineItem","itemname",
+ "commonj.sdo","String", false, false, false);
+
+ f4->addPropertyToType("Namespace","Project","packages",
+ "Namespace","WorkPackage", true, false, true);
+
+ f4->addPropertyToType("Namespace","WorkPackage","lineitems",
+ "Namespace","LineItem", true, false, true);
+
+
+ // factory 5 looks compatible, but the lists are not lists
+
+ DataFactoryPtr f5 = DataFactory::getDataFactory();
+
+ f5->addType("Namespace","Project");
+ f5->addType("Namespace","WorkPackage");
+ f5->addType("Namespace","LineItem");
+ f5->addType("Namespace","StringHolder");
+
+ f5->addType("Namespace","Root");
+ f5->addPropertyToType("Namespace","Root","project",
+ "Namespace","Project", false, false, true);
+
+
+ f5->addPropertyToType("Namespace","StringHolder","value",
+ "commonj.sdo","String", false, false, false);
+
+ f5->addPropertyToType("Namespace","Project","id",
+ "commonj.sdo","String", false, false, false);
+
+ f5->addPropertyToType("Namespace","Project","string",
+ "Namespace","StringHolder", false, false, true);
+
+ f5->addPropertyToType("Namespace","WorkPackage","name",
+ "commonj.sdo","String", false, false, false);
+
+
+ f5->addPropertyToType("Namespace","WorkPackage","string",
+ "Namespace","StringHolder", false, false, true);
+
+ f5->addPropertyToType("Namespace","LineItem","itemname",
+ "commonj.sdo","String", false, false, false);
+
+ f5->addPropertyToType("Namespace","LineItem","string",
+ "Namespace","StringHolder", false, false, true);
+
+ f5->addPropertyToType("Namespace","Project","packages",
+ "Namespace","WorkPackage", false, false, true);
+
+ f5->addPropertyToType("Namespace","WorkPackage","lineitems",
+ "Namespace","LineItem", false, false, true);
+
+ // factory 6 looks OK, but the lineitems have no itemname field
+
+ DataFactoryPtr f6 = DataFactory::getDataFactory();
+
+ f6->addType("Namespace","Project");
+ f6->addType("Namespace","WorkPackage");
+ f6->addType("Namespace","LineItem");
+ f6->addType("Namespace","StringHolder");
+
+ f6->addType("Namespace","Root");
+ f6->addPropertyToType("Namespace","Root","project",
+ "Namespace","Project", false, false, true);
+
+
+ f6->addPropertyToType("Namespace","StringHolder","value",
+ "commonj.sdo","String", false, false, false);
+
+ f6->addPropertyToType("Namespace","Project","id",
+ "commonj.sdo","String", false, false, false);
+
+ f6->addPropertyToType("Namespace","Project","string",
+ "Namespace","StringHolder", false, false, true);
+
+ f6->addPropertyToType("Namespace","WorkPackage","name",
+ "commonj.sdo","String", false, false, false);
+
+
+ f6->addPropertyToType("Namespace","WorkPackage","string",
+ "Namespace","StringHolder", false, false, true);
+
+ f6->addPropertyToType("Namespace","LineItem","string",
+ "Namespace","StringHolder", false, false, true);
+
+ f6->addPropertyToType("Namespace","Project","packages",
+ "Namespace","WorkPackage", true, false, true);
+
+ f6->addPropertyToType("Namespace","WorkPackage","lineitems",
+ "Namespace","LineItem", true, false, true);
+
+
+ // factory 7 looks OK, but the identifiers are ints
+
+
+ DataFactoryPtr f7 = DataFactory::getDataFactory();
+
+ f7->addType("Namespace","Project");
+ f7->addType("Namespace","WorkPackage");
+ f7->addType("Namespace","LineItem");
+ f7->addType("Namespace","StringHolder");
+
+ f7->addType("Namespace","Root");
+ f7->addPropertyToType("Namespace","Root","project",
+ "Namespace","Project", false, false, true);
+
+ f7->addPropertyToType("Namespace","StringHolder","value",
+ "commonj.sdo","String", false, false, true);
+
+ f7->addPropertyToType("Namespace","Project","id",
+ "commonj.sdo","Int", false, false, false);
+
+ f7->addPropertyToType("Namespace","Project","string",
+ "Namespace","StringHolder", false, false, true);
+
+ f7->addPropertyToType("Namespace","WorkPackage","name",
+ "commonj.sdo","String", false, false, false);
+
+
+ f7->addPropertyToType("Namespace","WorkPackage","string",
+ "Namespace","StringHolder", false, false, true);
+
+ f7->addPropertyToType("Namespace","LineItem","itemname",
+ "commonj.sdo","Int", false, false, false);
+
+ f7->addPropertyToType("Namespace","LineItem","string",
+ "Namespace","StringHolder", false, false, true);
+
+ f7->addPropertyToType("Namespace","Project","packages",
+ "Namespace","WorkPackage", true, false, true);
+
+ f7->addPropertyToType("Namespace","WorkPackage","lineitems",
+ "Namespace","LineItem", true, false, true);
+
+
+ // create a tree from Root in factory 1
+
+ DataObjectPtr root = f1->create("Namespace","Root");
+ DataObjectPtr project = root->createDataObject("project");
+ project->setCString("id","The TTP Project");
+ DataObjectPtr str = project->createDataObject("string");
+ str->setCString("value","The Recursive Acronym Project");
+ DataObjectPtr wp1 = project->createDataObject("packages");
+ DataObjectPtr wp2 = project->createDataObject("packages");
+ wp1->setCString("name","Work Package 1");
+ wp2->setCString("name","Work Package 2");
+ DataObjectPtr li1 = wp1->createDataObject("lineitems");
+ DataObjectPtr li2 = wp1->createDataObject("lineitems");
+ DataObjectPtr li3 = wp2->createDataObject("lineitems");
+ DataObjectPtr li4 = wp2->createDataObject("lineitems");
+ li1->setCString("itemname","LineItem 1");
+ li2->setCString("itemname","LineItem 2");
+ li3->setCString("itemname","LineItem 3");
+ li4->setCString("itemname","LineItem 4");
+ DataObjectPtr str1 = li1->createDataObject("string");
+ DataObjectPtr str2 = li2->createDataObject("string");
+ DataObjectPtr str3 = li3->createDataObject("string");
+ DataObjectPtr str4 = li4->createDataObject("string");
+ str1->setCString("value","String1");
+ str2->setCString("value","String2");
+ str3->setCString("value","String3");
+ str4->setCString("value","String4");
+
+
+// cout << "DATA OBJECTS FROM FACTORY 1" << endl;
+// printDataObject(root);
+
+ if (!transferto(root,f2, false)) return 0;
+ if (!transferto(root,f3, true)) return 0;
+ // Following 4 tests do not now cause an error
+ if (!transferto(root,f4, false)) return 0;
+ if (!transferto(root,f5, false)) return 0;
+ if (!transferto(root,f6, false)) return 0;
+ if (!transferto(root,f7, false)) return 0;
+
+ // finally, lets move one which has a parent and cant be moved.
+
+ try {
+ DataObjectPtr project = root->getDataObject("project");
+
+ DataObjectPtr root2 = f2->create("Namespace","Root");
+
+ root2->setDataObject("project", project);
+ return 0;
+ }
+ catch (SDORuntimeException e)
+ {
+ //cout << "Compatibility test correctly returned an error :" ;
+ //cout << e.getMessageText() << endl;
+ return 1;
+ }
+
+}
+
+int sdotest::transferto(DataObjectPtr root, DataFactoryPtr f2, bool expecterror)
+{
+ try {
+
+ // transfer the tree to factory 2...
+ DataObjectPtr rproject = root->getDataObject("project");
+
+ DataObjectPtr project = CopyHelper::copy(rproject);
+
+ DataObjectPtr root2 = f2->create("Namespace","Root");
+
+ root2->setDataObject("project", project);
+
+ //cout << "DATA OBJECTS TRANSFERRED" << endl;
+
+ //printDataObject(root2);
+
+ if (expecterror)
+ {
+ return 0;
+ }
+ return 1;
+ }
+ catch (SDORuntimeException e)
+ {
+ if (expecterror){
+ //cout << "Compatibility test correctly returned an error :" ;
+ //cout << e.getMessageText() << endl;
+ return 1;
+ }
+ else
+ {
+ if (!silent)cout << "Compatibility test failed whilst transferring " << e << endl;
+ return 0;
+ }
+ }
+}
+
+
+int sdotest::b48602()
+{
+
+
+ int i,j;
+
+ try {
+
+
+ DataFactoryPtr mdg = DataFactory::getDataFactory();
+
+ XSDHelperPtr xsh = HelperProvider::getXSDHelper(mdg);
+
+ xsh->defineFile("b48602.xsd");
+
+ if ((i = xsh->getErrorCount()) > 0)
+ {
+ if (!silent)
+ {
+ cout << "PROBLEM: b48602 XSD reported some errors:" << endl;
+ for (j=0;j<i;j++)
+ {
+ const char *m = xsh->getErrorMessage(j);
+ if (m != 0) cout << m;
+ cout << endl;
+ }
+ }
+ return 0;
+ }
+ return 0;
+ }
+ catch (SDOTypeNotFoundException e)
+ {
+ return 1;
+ }
+ catch (SDORuntimeException e)
+ {
+ return 1;
+ }
+
+}
+
+int sdotest::testany(const char* xsd,
+ const char* acceptedxsderror,
+ const char* xml,
+ const char* acceptedxmlerror)
+{
+
+
+ unsigned int i,j;
+ int rc;
+
+ try {
+
+ char *c;
+
+
+
+ DataFactoryPtr mdg = DataFactory::getDataFactory();
+
+ XSDHelperPtr xsh = HelperProvider::getXSDHelper(mdg);
+
+ if (xsd)
+ {
+ char * name1 = new char[strlen(xsd)+5];
+ char * name3 = new char[strlen(xsd)+5];
+ strcpy(name1,xsd);
+ while ((c = strchr(name1,'.')) != 0)*c = '_';
+ strcpy(name3,name1);
+ strcat(name1,".dat");
+ strcat(name3,".txt");
+
+
+ FILE *f1 = fopen(name1,"w+");
+ if (f1 == 0)
+ {
+ if (!silent)cout << "Unable to open " << name1 << endl;
+ delete[] name1;
+ delete[] name3;
+ return 0;
+ }
+
+ xsh->defineFile(xsd);
+
+ if ((i = xsh->getErrorCount()) > 0)
+ {
+ if (acceptedxsderror != 0)
+ {
+ for (j=0;j<i;j++)
+ {
+ if (!strcmp(acceptedxsderror,xsh->getErrorMessage(j)))
+ {
+ fclose(f1);
+ delete[] name1;
+ delete[] name3;
+ return 1;
+ }
+ }
+ }
+ if (!silent)
+ {
+ cout << "PROBLEM: Testany XSD reported some errors:" << endl;
+ for (j=0;j<i;j++)
+ {
+ const char *m = xsh->getErrorMessage(j);
+ if (m != 0) cout << m;
+ cout << endl;
+ }
+ }
+ fclose(f1);
+ delete[] name1;
+ delete[] name3;
+ return 0;
+ }
+
+
+ TypeList tl = mdg->getTypes();
+
+ fprintf(f1, "***** TYPES BEFORE RESOLVE **********************************\n");
+
+ for (i=0;i<tl.size();i++)
+ {
+ fprintf(f1,"Type:%s#%s\n",tl[i].getURI(),tl[i].getName());
+ PropertyList pl = tl[i].getProperties();
+ for (unsigned int j=0;j<pl.size();j++)
+ {
+ fprintf(f1,"Property:%s ",pl[j].getName());
+ if (pl[j].isMany())
+ fprintf(f1, "(many) ");
+ fprintf(f1, " of type %s\n",pl[j].getType().getName());
+ }
+ }
+
+ fprintf(f1, "*******************************END TYPES******************\n");
+
+ fclose(f1);
+
+
+ rc = comparefiles(name1,name3);
+
+ delete[] name1;
+ delete[] name3;
+
+ if (rc == 0)return rc;
+
+ }
+
+ if (xml == 0 || strlen(xml) == 0) return 1;
+
+ char * name2 = new char[strlen(xml)+5];
+ char * name4 = new char[strlen(xml)+5];
+ strcpy(name2,xml);
+ while ((c = strchr(name2,'.')) != 0)*c = '_';
+ strcpy(name4,name2);
+
+ strcat(name2,".dat");
+ strcat(name4,".txt");
+
+ FILE *f2 = fopen(name2,"w+");
+ if (f2 == 0)
+ {
+ if (!silent)cout << "Unable to open " << name2 << endl;
+ delete[] name2;
+ delete[] name4;
+ return 0;
+ }
+
+ XMLHelperPtr xmh = HelperProvider::getXMLHelper(mdg);
+
+ XMLDocumentPtr doc = xmh->loadFile(xml);
+
+ if ((i = xmh->getErrorCount()) > 0)
+ {
+ if (acceptedxmlerror != 0)
+ {
+ for (j=0;j<i;j++)
+ {
+ if (!strcmp(acceptedxmlerror,xmh->getErrorMessage(j)))
+ {
+ fclose(f2);
+ delete[] name2;
+ delete[] name4;
+ return 1;
+ }
+ }
+ }
+ if (!silent)
+ {
+ cout << "TestAny XML found errors:" << endl;
+ for (j=0;j<i;j++)
+ {
+ const char *m = xmh->getErrorMessage(j);
+ if (m != 0) cout << m;
+ cout << endl;
+ }
+ }
+ fclose(f2);
+ delete[] name2;
+ delete[] name4;
+ return 0;
+ }
+
+ else {
+ TypeList tl = mdg->getTypes();
+
+ fprintf(f2, "***** TYPES AFTER RESOLVE*********************************\n");
+
+ for (i=0;i<tl.size();i++)
+ {
+ fprintf(f2,"Type:%s#%s\n",tl[i].getURI(),tl[i].getName());
+ PropertyList pl = tl[i].getProperties();
+ for (unsigned int j=0;j<pl.size();j++)
+ {
+ fprintf(f2, "Property:%s ",pl[j].getName());
+ if (pl[j].isMany())
+ fprintf(f2, "(many) ");
+ fprintf(f2, " of type %s\n",pl[j].getType().getName());
+ }
+ }
+
+ fprintf(f2, "*******************************END TYPES******************\n");
+
+
+ DataObjectPtr dob = doc->getRootDataObject();
+ printDataObject(f2, dob);
+
+ fclose(f2);
+
+ rc = comparefiles(name2,name4);
+
+ delete[] name2;
+ delete[] name4;
+
+ return rc;
+ }
+
+ }
+ catch (SDORuntimeException e)
+ {
+ if (!silent)cout << "Exception in TestAny" << e << endl;
+ return 0;
+ }
+}
+
+
+
+int sdotest::testanytwo(const char* xsd, const char* xsd2,
+ const char* xml)
+{
+ unsigned int i, j;
+
+ try
+ {
+ char * name1 = new char[strlen(xsd)+5];
+ char * name2 = new char[strlen(xml)+5];
+ char * name3 = new char[strlen(xsd)+5];
+ char * name4 = new char[strlen(xml)+5];
+
+ strcpy(name1,xsd);
+ strcpy(name2,xml);
+
+ char *c;
+
+ while ((c = strchr(name1,'.')) != 0)*c = '_';
+ while ((c = strchr(name2,'.')) != 0)*c = '_';
+
+ strcpy(name3,name1);
+ strcpy(name4,name2);
+
+ strcat(name1,".dat");
+ strcat(name2,".dat");
+ strcat(name3,".txt");
+ strcat(name4,".txt");
+
+ DataFactoryPtr mdg = DataFactory::getDataFactory();
+
+ XSDHelperPtr xsh = HelperProvider::getXSDHelper(mdg);
+
+ if (xsd)
+ {
+ xsh->defineFile(xsd);
+
+ if ((i = xsh->getErrorCount()) > 0)
+ {
+ if (!silent)
+ {
+ cout << "PROBLEM: Testany XSD reported some errors:" << endl;
+ for (j=0;j<i;j++)
+ {
+ const char *m = xsh->getErrorMessage(j);
+ if (m != 0) cout << m;
+ cout << endl;
+ }
+ }
+ delete[] name1;
+ delete[] name2;
+ delete[] name3;
+ delete[] name4;
+
+ return 0;
+ }
+
+ }
+
+ if (xsd2)
+ {
+ xsh->defineFile(xsd2);
+
+ if ((i = xsh->getErrorCount()) > 0)
+ {
+ if (!silent)
+ {
+ cout << "PROBLEM: Testany XSD2 reported some errors:" << endl;
+ for (j=0;j<i;j++)
+ {
+ const char *m = xsh->getErrorMessage(j);
+ if (m != 0) cout << m;
+ cout << endl;
+ }
+ }
+
+ delete[] name1;
+ delete[] name2;
+ delete[] name3;
+ delete[] name4;
+
+ return 0;
+ }
+ }
+
+ if (xsd)
+ {
+
+
+ FILE *f1 = fopen(name1,"w+");
+ if (f1 == 0)
+ {
+ if (!silent)cout << "Unable to open " << name1 << endl;
+
+ delete[] name1;
+ delete[] name2;
+ delete[] name3;
+ delete[] name4;
+
+ return 0;
+ }
+
+ TypeList tl = mdg->getTypes();
+
+ fprintf(f1,"***** TESTANY ******************************************\n");
+
+ for (i=0;i<tl.size();i++)
+ {
+ fprintf(f1,"Type:%s#%s\n",tl[i].getURI(),tl[i].getName());
+ PropertyList pl = tl[i].getProperties();
+ for (unsigned int j=0;j<pl.size();j++)
+ {
+ fprintf(f1,"Property:%s ",pl[j].getName());
+ if (pl[j].isMany())
+ fprintf(f1, "(many) ");
+ fprintf(f1, " of type %s\n",pl[j].getType().getName());
+ }
+ }
+
+ fprintf(f1,"*******************************END TYPES******************\n");
+
+ fclose(f1);
+
+ if (!comparefiles(name1,name3))
+ {
+ delete[] name1;
+ delete[] name2;
+ delete[] name3;
+ delete[] name4;
+
+ return 0;
+ }
+ }
+
+
+ if (xml == 0 || strlen(xml) == 0)
+ {
+ delete[] name1;
+ delete[] name2;
+ delete[] name3;
+ delete[] name4;
+
+ return 1;
+ }
+
+ FILE *f2 = fopen(name2,"w+");
+ if (f2 == 0)
+ {
+ if (!silent)cout << "Unable to open " << name2 << endl;
+ delete[] name1;
+ delete[] name2;
+ delete[] name3;
+ delete[] name4;
+
+ return 0;
+ }
+
+ XMLHelperPtr xmh = HelperProvider::getXMLHelper(mdg);
+
+ XMLDocumentPtr doc = xmh->loadFile(xml);
+
+ if ((i = xmh->getErrorCount()) > 0)
+ {
+ if (!silent)
+ {
+ cout << "TestAny XML found errors:" << endl;
+ for (j=0;j<i;j++)
+ {
+ const char *m = xmh->getErrorMessage(j);
+ if (m != 0) cout << m;
+ cout << endl;
+ }
+ }
+ delete[] name1;
+ delete[] name2;
+ delete[] name3;
+ delete[] name4;
+
+ return 0;
+ }
+ else
+ {
+ DataObjectPtr dob = doc->getRootDataObject();
+ printDataObject(f2, dob);
+ }
+
+ fclose(f2);
+ int result = comparefiles(name2,name4);
+
+ delete[] name1;
+ delete[] name2;
+ delete[] name3;
+ delete[] name4;
+
+ return result;
+
+
+ }
+ catch (SDORuntimeException e)
+ {
+ if (!silent)cout << "Exception in TestAnyTwo" << e << endl;
+
+ return 0;
+ }
+}
+
+int sdotest::openseq()
+
+{
+
+ DataFactoryPtr mdg = DataFactory::getDataFactory();
+
+ FILE *f = fopen("openseq.dat","w+");
+ if (f == 0)
+ {
+ if (!silent)cout << "Unable to open openseq.dat" << endl;
+ return 0;
+ }
+
+
+ mdg->addType("companyNS","CompanyType");
+ // employee will be an open sequenced type...
+ mdg->addType("companyNS","EmployeeType", /*seq*/true,
+ /*open*/true,
+ /*abs */ false,
+ /*data*/ false);
+
+
+ /* Now add the properties to the types...*/
+
+
+ const Type& tstring = mdg->getType("commonj.sdo","String");
+ const Type& tcomp = mdg->getType("companyNS","CompanyType");
+ const Type& temp = mdg->getType("companyNS","EmployeeType");
+
+
+ mdg->addPropertyToType(tcomp,"name",tstring);
+
+ mdg->addPropertyToType(tcomp,"employees",temp,true);
+
+ mdg->addPropertyToType(temp, "name",tstring);
+
+ DataObjectPtr comp = mdg->create((Type&)tcomp);
+ comp->setCString("name","ACME");
+
+ DataObjectPtr emp = mdg->create(temp);
+
+ emp->setCString("name","Albert");
+
+ emp->setCString("openstring","Value Of Open String");
+
+ /* now do the same with the employee seq...*/
+
+ SequencePtr seq = emp->getSequence();
+
+ seq->addCString("opensequencedstring","Value of sequenced string");
+
+ const char* c = emp->getCString("openstring");
+
+ fprintf(f, "Open Type string value: %s\n",c);
+
+ c = emp->getCString("opensequencedstring");
+
+ fprintf(f, "Open Sequenced string value: %s\n",c);
+
+ c = seq->getCStringValue(0);
+
+ fprintf(f, "Open Sequenced string value from seq: %s\n",c);
+
+ //cout << "END TEST: OpenSeq ======================================" << endl;
+ fclose(f);
+ return comparefiles("openseq.dat","openseq.txt");
+}
+
+int sdotest::b48601()
+{
+ return testany("48601.xsd",
+ "Schema contains a union which is not yet implemented",0,0);
+}
+
+int sdotest::b48686()
+{
+ return testany("48686.xsd",0,"48686.xml",0);
+}
+
+int sdotest::b48736()
+{
+ return testany("48736.xsd",0,"48736.xml",0);
+}
+
+
+int sdotest::emptycs()
+{
+try {
+ DataFactoryPtr mdg = DataFactory::getDataFactory();
+
+ XSDHelperPtr xsh = HelperProvider::getXSDHelper(mdg);
+ xsh->defineFile("company.xsd");
+
+
+ const Type& tstring = mdg->getType("commonj.sdo","String");
+ const Type& tbool = mdg->getType("commonj.sdo","Boolean");
+ const Type& tcs = mdg->getType("commonj.sdo","ChangeSummary");
+ const Type& tcomp = mdg->getType("companyNS","CompanyType");
+ const Type& tdept = mdg->getType("companyNS","DepartmentType");
+ const Type& temp = mdg->getType("companyNS","EmployeeType");
+
+
+ // create a graph, then save it
+
+ DataObjectPtr comp = mdg->create((Type&)tcomp);
+ comp->setCString("name","ACME");
+
+ DataObjectPtr dept = mdg->create((Type&)tdept);
+ DataObjectList& dol = comp->getList("departments");
+ dol.append(dept);
+
+ dept->setCString("name","Advanced Technologies");
+ dept->setCString("location","NY");
+ dept->setCString("number","123");
+
+ DataObjectPtr emp1 = mdg->create(temp);
+ DataObjectPtr emp2 = mdg->create(temp);
+ DataObjectPtr emp3 = mdg->create(temp);
+
+ emp1->setCString("name","John Jones");
+ emp1->setCString("SN","E0001");
+
+ emp2->setCString("name","Mary Smith");
+ emp2->setCString("SN","E0002");
+ emp2->setBoolean("manager",true);
+
+ emp3->setCString("name","Jane Doe");
+ emp3->setCString("SN","E0003");
+
+ DataObjectList& dol2 = dept->getList("employees");
+ dol2.append(emp1);
+ dol2.append(emp2);
+ dol2.append(emp3);
+
+ comp->setDataObject("employeeOfTheMonth",emp2);
+
+ // right now, there is no change summary, and logging is
+ // off - we expect an empty change summary element
+
+ XMLHelperPtr xmh = HelperProvider::getXMLHelper(mdg);
+ XMLDocumentPtr doc = xmh->createDocument(comp,"companyNS","company");
+
+ xmh->save(doc,"emptycs1.xml");
+
+ if (!comparefiles("emptycs1.xml","emptycs1.txt"))return 0;
+
+ ChangeSummaryPtr cs = comp->getChangeSummary();
+
+ cs->beginLogging();
+
+ xmh->save(doc,"emptycs2.xml");
+
+ if (!comparefiles("emptycs2.xml","emptycs2.txt"))return 0;
+
+ // now we expect and empty change summary with logging true
+
+ DataObjectPtr emp4 = mdg->create(temp);
+ emp4->setCString("name","Al Smith");
+ emp4->setCString("SN","E0004");
+ emp4->setBoolean("manager",true);
+
+ // first change - create employee 4
+ dol2.append(emp4);
+
+ cs->endLogging();
+
+ //serializeChangeSummary(cs);
+
+ xmh->save(doc,"emptycs3.xml");
+
+ if (!comparefiles("emptycs3.xml","emptycs3.txt"))return 0;
+
+ return 1;
+
+ }
+ catch (SDORuntimeException e)
+ {
+ if (!silent)cout << "empty change summary save failed" << e << endl;
+ return 0;
+ }
+}
+
+
+int sdotest::definetest()
+{
+ try {
+
+ DataFactoryPtr mdg = DataFactory::getDataFactory();
+
+ XSDHelperImplPtr xsh = staticCast<XSDHelperImplPtr>(HelperProvider::getXSDHelper(mdg));
+
+ TypeDefinitions* ts = new TypeDefinitions();
+ if (ts) delete ts;
+ ts = new TypeDefinitions();
+
+
+ TypeDefinition* td = new TypeDefinition();
+
+ td->setName("MySmallObject");
+ td->setUri("MyNameSpace");
+ td->setIsDataType(false);
+
+ TypeDefinition* td2 = new TypeDefinition();
+ td2->setName("MyOtherObject");
+ td2->setUri("MyNameSpace");
+ td2->setIsDataType(false);
+
+
+ PropertyDefinition* pd = new PropertyDefinition();
+ pd->setName("MyIntProperty");
+ pd->setType("commonj.sdo","Int");
+
+ PropertyDefinition* pd2 = new PropertyDefinition();
+ pd2->setName("MyObjectProperty");
+ pd2->setType("MyNameSpace","MyOtherObject");
+ pd2->setIsMany(true);
+
+ td->addPropertyDefinition(*pd);
+
+ td->addPropertyDefinition(*pd2);
+
+ ts->addTypeDefinition(*td);
+ ts->addTypeDefinition(*td2);
+
+ // should have an object of type MySmallObject, containing
+ // a single integer called MyIntProperty, and a list of
+ // objects called MyObjectProperty - of type MyOtherObject
+
+ xsh->defineTypes(*ts);
+
+ delete td;
+ delete td2;
+ delete ts;
+ delete pd;
+ delete pd2;
+
+ DataObjectPtr dob = mdg->create("MyNameSpace","MySmallObject");
+ dob->setInt("MyIntProperty",43);
+
+ dob->createDataObject("MyObjectProperty");
+ dob->createDataObject("MyObjectProperty");
+ DataObjectList& dl = dob->getList("MyObjectProperty");
+
+ if (dl.size() != 2)
+ {
+ if (!silent) cout << "Define test list size is wrong" << endl;
+ return 0;
+ }
+ int value = dob->getInt("MyIntProperty");
+ if (value != 43)
+ {
+ if (!silent) cout << "Define test integer value is wrong" << endl;
+ return 0;
+ }
+
+ return 1;
+ }
+ catch (SDORuntimeException e)
+ {
+ if (!silent)cout << "define test failed" << endl << e << endl;
+ return 0;
+ }
+
+}
+
+
+int sdotest::stocktest()
+{
+ return sdotest::testany("stock.wsdl",0,"stock.xml",0);
+}
+
+
+/******************************************************
+int sdotest::stocktest()
+{
+ int i,j;
+
+ try {
+
+ DataFactoryPtr mdg = DataFactory::getDataFactory();
+
+ XSDHelperPtr xsh = HelperProvider::getXSDHelper(mdg);
+
+ xsh->defineFile("stock.wsdl");
+
+ if ((i = xsh->getErrorCount()) > 0)
+ {
+ cout << "PROBLEM: Testany XSD reported some errors:" << endl;
+ for (j=0;j<i;j++)
+ {
+ const char *m = xsh->getErrorMessage(j);
+ if (m != 0) cout << m;
+ cout << endl;
+ }
+ }
+
+ TypeList tl = mdg->getTypes();
+
+ printf("***** TYPES BEFORE RESOLVE **********************************\n");
+
+ for (i=0;i<tl.size();i++)
+ {
+ printf("Type:%s#%s\n",tl[i].getURI(),tl[i].getName());
+ PropertyList pl = tl[i].getProperties();
+ for (int j=0;j<pl.size();j++)
+ {
+ printf("Property:%s ",pl[j].getName());
+ if (pl[j].isMany())
+ printf("(many) ");
+ printf(" of type %s\n",pl[j].getType().getName());
+ }
+ }
+
+ printf("*******************************END TYPES******************\n");
+
+
+
+ XMLHelperPtr xmh = HelperProvider::getXMLHelper(mdg);
+
+ XMLDocumentPtr doc = xmh->loadFile("stock.xml");
+
+ if ((i = xmh->getErrorCount()) > 0)
+ {
+ cout << "TestAny XML found errors:" << endl;
+ for (j=0;j<i;j++)
+ {
+ const char *m = xmh->getErrorMessage(j);
+ if (m != 0) cout << m;
+ cout << endl;
+ }
+ }
+
+
+ DataObjectPtr dob = doc->getRootDataObject();
+ printDataObject(stdout, dob);
+
+ return 1;
+
+ }
+ catch (SDORuntimeException e)
+ {
+ if (!silent)cout << "Exception in TestAny" << e << endl;
+ return 0;
+ }
+}
+**************************************************/
+
+
+int sdotest::pete()
+{
+
+
+ unsigned int i,j;
+
+ try {
+
+
+ DataFactoryPtr mdg = DataFactory::getDataFactory();
+
+ XSDHelperPtr xsh = HelperProvider::getXSDHelper(mdg);
+
+ xsh->defineFile("pete.xsd");
+
+ if ((i = xsh->getErrorCount()) > 0)
+ {
+ for (j=0;j<i;j++)
+ {
+ const char *m = xsh->getErrorMessage(j);
+ if (m != 0) cout << m;
+ cout << endl;
+ }
+ return 0;
+ }
+
+
+
+ XMLHelperPtr xmh = HelperProvider::getXMLHelper(mdg);
+
+ XMLDocumentPtr doc = xmh->loadFile("pete.xml");
+
+ if ((i = xmh->getErrorCount()) > 0)
+ {
+ for (j=0;j<i;j++)
+ {
+ const char *m = xmh->getErrorMessage(j);
+ if (m != 0) cout << m;
+ cout << endl;
+ }
+ return 0;
+ }
+
+ TypeList tl = mdg->getTypes();
+
+ //printf("***** TYPES **********************************************\n");
+
+ for (i=0;i<tl.size();i++)
+ {
+ //printf("Type:%s#%s\n",tl[i].getURI(),tl[i].getName());
+ PropertyList pl = tl[i].getProperties();
+ for (unsigned int j=0;j<pl.size();j++)
+ {
+ //printf("Property:%s ",pl[j].getName());
+ //if (pl[j].isMany())
+ //printf( "(many) ");
+ //printf( " of type %s\n",pl[j].getType().getName());
+ }
+ }
+
+ //printf( "*******************************END TYPES******************\n");
+
+
+ DataObjectPtr dob = doc->getRootDataObject();
+ float f = dob->getFloat("Stock[1]/Last");
+ //printf("Float is %2.3f \r\n",f);
+ return 1;
+
+ }
+ catch (SDORuntimeException e)
+ {
+ cout << "Exception in Pete" << e << endl;
+ return 0;
+ }
+}
+
+int sdotest::xhtml1()
+{
+
+
+ int i,j;
+
+ try {
+
+
+ DataFactoryPtr mdg = DataFactory::getDataFactory();
+
+ XSDHelperPtr xsh = HelperProvider::getXSDHelper(mdg);
+
+ xsh->defineFile("Atom1.0.xsd");
+ // SDOUtils::printTypes(cout, xsh->getDataFactory());
+
+ if ((i = xsh->getErrorCount()) > 0)
+ {
+ for (j=0;j<i;j++)
+ {
+ const char *m = xsh->getErrorMessage(j);
+ if (m != 0) cout << m;
+ cout << endl;
+ }
+ return 0;
+ }
+
+ XMLHelperPtr xmh = HelperProvider::getXMLHelper(mdg);
+
+ XMLDocumentPtr doc = xmh->loadFile("xhtml_in.xml");
+
+ if ((i = xmh->getErrorCount()) > 0)
+ {
+ for (j=0;j<i;j++)
+ {
+ const char *m = xmh->getErrorMessage(j);
+ if (m != 0) cout << m;
+ cout << endl;
+ }
+ return 0;
+ }
+
+
+ //DataObjectPtr dob = doc->getRootDataObject();
+
+ //ofstream myout("myfile");
+
+ //if (dob)SDOUtils::printDataObject(myout , dob);
+
+ xmh->save(doc,"xhtml_out.xml");
+
+ return comparefiles("xhtml_out.xml" ,"xhtml_out.txt");
+
+
+ }
+ catch (SDORuntimeException e)
+ {
+ cout << "Exception in xhtml1" << e << endl;
+ return 0;
+ }
+}
+
+int sdotest::testXPath()
+{
+
+
+ try {
+ DataFactoryPtr mdg = DataFactory::getDataFactory();
+
+ XSDHelperPtr xsh = HelperProvider::getXSDHelper(mdg);
+ xsh->defineFile("company.xsd");
+ XMLHelperPtr myXMLHelper = HelperProvider::getXMLHelper(mdg);
+ XMLDocumentPtr myXMLDocument = myXMLHelper->loadFile("b46617b.xml", "companyNS");
+ DataObjectPtr newdob = myXMLDocument->getRootDataObject();
+
+ DataObjectPtr dop = newdob->getDataObject("departments[name='Shoe']/employees[name='Sarah Jones']");
+ string x = "departments[name='Shoe']/employees[name='Sarah Jones']";
+ dop = newdob->getDataObject(x);
+
+ return 1;
+
+ }
+ catch (SDORuntimeException e)
+ {
+ cout << "Exception in testXPath" << e << endl;
+ return 0;
+ }
+}
+
+int sdotest::jira945()
+{
+ try {
+ DataFactoryPtr mdg = DataFactory::getDataFactory();
+
+ mdg->addType("myspace","Company");
+ mdg->addType("myspace","Employee");
+ mdg->addPropertyToType("myspace","Employee","name",
+ "commonj.sdo","String", false, false, false);
+
+ mdg->addPropertyToType("myspace","Company","name",
+ "commonj.sdo","String", false, false, false);
+
+ mdg->addPropertyToType("myspace","Company","employees",
+ "myspace","Employee", true, false, true);
+
+ const Type& tc = mdg->getType("myspace","Company");
+
+ DataObjectPtr com = mdg->create((Type&)tc);
+ com->setCString("name","acme");
+
+ const Type& te = mdg->getType("myspace","Employee");
+ DataObjectPtr emp = mdg->create(te);
+ emp->setCString("name", "Mr Expendible");
+
+ const int propIndex = tc.getPropertyIndex("employees");
+
+ // This fails with Jira945
+ DataObjectList& emps = com->getList(propIndex);
+
+ emps.append(emp);
+
+ return 1;
+
+ }
+ catch (SDORuntimeException e)
+ {
+ cout << "Exception in test jira945" << e << endl;
+ return 0;
+ }
+}
+int sdotest::tuscany963()
+{
+
+
+ try {
+ DataFactoryPtr mdg = DataFactory::getDataFactory();
+
+ XSDHelperPtr xsh = HelperProvider::getXSDHelper(mdg);
+ xsh->defineFile("tuscany963.xsd");
+ XMLHelperPtr myXMLHelper = HelperProvider::getXMLHelper(mdg);
+ XMLDocumentPtr myXMLDocument = myXMLHelper->loadFile("tuscany963.xml");
+ myXMLHelper->save(myXMLDocument, "tuscany963.out.xml");
+
+
+ return comparefiles("tuscany963.out.xml" ,"tuscany963.out.xml.txt");
+
+
+ }
+ catch (SDORuntimeException e)
+ {
+ cout << "Exception in tuscany963" << e << endl;
+ return 0;
+ }
+}
+
+int sdotest::tuscany562()
+{
+ DataFactoryPtr mdg = DataFactory::getDataFactory();
+ mdg->addType("myspace", "Base");
+ mdg->addType("myspace", "Extended");
+ const Type &base = mdg->getType("myspace", "Base"),
+ &extended = mdg->getType("myspace", "Extended");
+ mdg->setBaseType(extended, base);
+ try
+ {
+ mdg->setBaseType(extended, extended);
+ cout << "Exception should have been thrown in tuscany562 (1)" << endl;
+ return 0;
+ }
+ catch (SDOIllegalArgumentException e)
+ {}
+ try
+ {
+ mdg->setBaseType(base, extended);
+ cout << "Exception should have been thrown in tuscany562 (2)" << endl;
+ return 0;
+ }
+ catch (SDOIllegalArgumentException e)
+ {}
+ return 1;
+}
+
+int sdotest::upandatom()
+{
+
+
+ try {
+ DataFactoryPtr mdg = DataFactory::getDataFactory();
+ DataFactoryPtr df = DataFactory::getDataFactory();
+
+ XSDHelperPtr xsh = HelperProvider::getXSDHelper(mdg);
+ xsh->defineFile("Atom/Atom1.0.xsd");
+
+ XSDHelperPtr xh = HelperProvider::getXSDHelper(df);
+ xh->defineFile("Atom/Atom1.0.xsd");
+
+ DataObjectPtr block = mdg->create("http://www.w3.org/1999/xhtml", "Block");
+ DataObjectPtr div = df->create("http://www.w3.org/1999/xhtml", "div");
+
+ block->setDataObject("div", div);
+ return 1;
+
+ }
+ catch (SDORuntimeException e)
+ {
+ cout << "Exception in upandatom" << e << endl;
+ return 0;
+ }
+}
+
+int sdotest::jira980()
+{
+
+ // Load both schema files into a single data factory and create content
+ // within an open type root element.
+ try
+ {
+ // Data factory to load both schema files.
+ DataFactoryPtr df_both = DataFactory::getDataFactory();
+ XSDHelperPtr xsh_both = HelperProvider::getXSDHelper(df_both);
+
+ // Load a root element definition, then the three animal types.
+ xsh_both->defineFile("jira980_jungle.xsd");
+ xsh_both->defineFile("jira980_animaltypes.xsd");
+
+ // Create three animals based on the preceding types.
+ DataObjectPtr baloo = df_both->create("", "bearType");
+ baloo->setCString("name", "Mummy bear");
+ baloo->setInt("weight", 700);
+
+ DataObjectPtr bagheera = df_both->create("", "pantherType");
+ bagheera->setCString("name", "Bagheera");
+ bagheera->setCString("colour", "inky black");
+
+ DataObjectPtr kaa = df_both->create("", "snakeType");
+ kaa->setCString("name", "Kaa");
+ kaa->setInt("length", 25);
+
+ // Create an output document
+ XMLHelperPtr xmh_both = HelperProvider::getXMLHelper(df_both);
+ XMLDocumentPtr document_both = xmh_both->createDocument();
+
+ DataObjectPtr jungle = document_both->getRootDataObject();
+
+ // Add the three animals as children of the document root. In this test
+ // that root will be a "jungle" element.
+ jungle->setDataObject("bear", baloo);
+ jungle->setDataObject("panther", bagheera);
+ jungle->setDataObject("snake", kaa);
+
+ xmh_both->save(document_both, "jira980_jungle_out.xml");
+ if (!comparefiles("jira980_jungle_out.txt" ,"jira980_jungle_out.xml"))
+ {
+ return 0;
+ }
+ }
+ catch (SDORuntimeException e)
+ {
+ cout << "Exception in jira980" << e << endl;
+ return 0;
+ }
+
+
+ // Load the schema files into two different data factories and then create
+ // content within an open type root element.
+ try
+ {
+ // Load the schema files into two different data factories.
+ DataFactoryPtr df_1 = DataFactory::getDataFactory();
+ DataFactoryPtr df_2 = DataFactory::getDataFactory();
+
+ XSDHelperPtr xsh_1 = HelperProvider::getXSDHelper(df_1);
+ XSDHelperPtr xsh_2 = HelperProvider::getXSDHelper(df_2);
+
+ xsh_1->defineFile("jira980_jungle.xsd");
+ xsh_2->defineFile("jira980_animaltypes.xsd");
+
+ // Create three animals based on the preceding types.
+ DataObjectPtr baloo = df_2->create("", "bearType");
+ baloo->setCString("name", "Mummy bear");
+ baloo->setInt("weight", 700);
+
+ DataObjectPtr bagheera = df_2->create("", "pantherType");
+ bagheera->setCString("name", "Bagheera");
+ bagheera->setCString("colour", "inky black");
+
+ DataObjectPtr kaa = df_2->create("", "snakeType");
+ kaa->setCString("name", "Kaa");
+ kaa->setInt("length", 25);
+
+ // Create an output document
+ XMLHelperPtr xmh_1 = HelperProvider::getXMLHelper(df_1);
+ XMLDocumentPtr document_1 = xmh_1->createDocument();
+
+ DataObjectPtr jungle = document_1->getRootDataObject();
+
+ // Add the three animals as children of the document root. In this test
+ // that root will be a "jungle" element.
+ jungle->setDataObject("bear", baloo);
+ jungle->setDataObject("panther", bagheera);
+ jungle->setDataObject("snake", kaa);
+
+ xmh_1->save(document_1, "jira980_splitJungle_out.xml");
+ if (!comparefiles("jira980_splitJungle_out.txt" ,"jira980_splitJungle_out.xml"))
+ {
+ return 0;
+ }
+ }
+ catch (SDORuntimeException e)
+ {
+ cout << "Exception in jira980" << e << endl;
+ return 0;
+ }
+
+ // Load both schema files into a single data factory and create content
+ // within an open type root element with mixed ie sequenced) content.
+ try
+ {
+ // Data factory to load both schema files.
+ DataFactoryPtr df_both = DataFactory::getDataFactory();
+ XSDHelperPtr xsh_both = HelperProvider::getXSDHelper(df_both);
+
+ // Load a root element definition, then the three animal types.
+ xsh_both->defineFile("jira980_mixedJungle.xsd");
+ xsh_both->defineFile("jira980_animaltypes.xsd");
+
+ // Create three animals based on the preceding types.
+ DataObjectPtr baloo = df_both->create("", "bearType");
+ baloo->setCString("name", "Mummy bear");
+ baloo->setInt("weight", 700);
+
+ DataObjectPtr bagheera = df_both->create("", "pantherType");
+ bagheera->setCString("name", "Bagheera");
+ bagheera->setCString("colour", "inky black");
+
+ DataObjectPtr kaa = df_both->create("", "snakeType");
+ kaa->setCString("name", "Kaa");
+ kaa->setInt("length", 25);
+
+ // Create an output document
+ XMLHelperPtr xmh_both = HelperProvider::getXMLHelper(df_both);
+ XMLDocumentPtr document_both = xmh_both->createDocument();
+
+ DataObjectPtr mixedJungle = document_both->getRootDataObject();
+
+ // Add the three animals as children of the document root. In this test
+ // that root will be a "mixedJungle" element.
+ mixedJungle->setDataObject("bear", baloo);
+ mixedJungle->setDataObject("panther", bagheera);
+ mixedJungle->setDataObject("snake", kaa);
+
+ xmh_both->save(document_both, "jira980_mixedJungle_out.xml");
+ return comparefiles("jira980_mixedJungle_out.txt" ,"jira980_mixedJungle_out.xml");
+
+ }
+
+ catch (SDORuntimeException e)
+ {
+ cout << "Exception in jira980" << e << endl;
+ return 0;
+ }
+
+}
+
+int sdotest::typedefinitionstest()
+{
+
+ // We re-use the parsed types from the company schema
+
+
+ try {
+
+
+ DataFactoryPtr mdg = DataFactory::getDataFactory();
+
+ XSDHelperImplPtr xsh = staticCast<XSDHelperImplPtr>(HelperProvider::getXSDHelper(mdg));
+
+ xsh->defineFile("company.xsd");
+
+ XSDHelperImplPtr clonedHelper = staticCast<XSDHelperImplPtr>(HelperProvider::getXSDHelper());
+ clonedHelper->defineTypes(xsh->getDefinedTypes());
+
+ xsh->generateFile(mdg->getTypes(),"typedefs.xsd", "companyNS", 0);
+ xsh->generateFile(clonedHelper->getDataFactory()->getTypes(),"typedefs_cloned.xsd", "companyNS", 0);
+
+ return comparefiles("typedefs_cloned.xsd" ,"typedefs.xsd");
+
+
+ }
+ catch (SDORuntimeException e)
+ {
+ cout << "Exception in typedefinitionstest" << e << endl;
+ return 0;
+ }
+}
+
+
+int sdotest::eBayTest()
+{
+
+ try {
+
+
+ DataFactoryPtr mdg = DataFactory::getDataFactory();
+
+ XSDHelperImplPtr xsh = staticCast<XSDHelperImplPtr>(HelperProvider::getXSDHelper(mdg));
+
+ cout << "parsing" <<endl;
+ xsh->defineFile("eBaySvc.wsdl");
+ cout << "parsed" <<endl;
+
+ cout<< "number of types = " << xsh->getDefinedTypes().size() <<endl;
+ XSDHelperImplPtr clonedHelper = staticCast<XSDHelperImplPtr>(HelperProvider::getXSDHelper());
+ cout << "cloning" <<endl;
+ clonedHelper->defineTypes(xsh->getDefinedTypes());
+ cout << "cloned" <<endl;
+ cout<< "number of types = " << clonedHelper->getDefinedTypes().size() <<endl;
+
+
+ }
+ catch (SDORuntimeException e)
+ {
+ cout << "Exception in eBayTest" << e << endl;
+ return 0;
+ }
+ return 1;
+}
+
+int sdotest::jira1174()
+{
+
+ try {
+
+
+ DataFactoryPtr mdg = DataFactory::getDataFactory();
+
+ XSDHelperPtr xsh = HelperProvider::getXSDHelper(mdg);
+
+ xsh->defineFile("company.xsd");
+
+
+ DataObjectPtr comp = mdg->create("companyNS", "CompanyType");
+ DataObjectPtr dept = comp->createDataObject("departments");
+ DataObjectPtr ron = dept->createDataObject("employees");
+ ron->setCString("name", "Ron");
+ comp->setDataObject("employeeOfTheMonth", ron);
+ comp = NULL;
+ return 1;
+ }
+ catch (SDORuntimeException e)
+ {
+ cout << "Exception in jira1174" << e << endl;
+ return 0;
+ }
+}
+
+int sdotest::jira1238()
+{
+
+ try {
+
+
+ DataFactoryPtr mdg = DataFactory::getDataFactory();
+
+ XSDHelperPtr xsh = HelperProvider::getXSDHelper(mdg);
+
+ xsh->defineFile("overlappingtypes.xsd");
+
+ mdg->getType("http://www.example.org/AnnonTypes", "Overlapping");
+ mdg->getType("http://www.example.org/AnnonTypes", "Overlapping1");
+ return 1;
+ }
+ catch (SDORuntimeException e)
+ {
+ cout << "Exception in jira1238" << e << endl;
+ return 0;
+ }
+}
+
+int sdotest::loadWithoutSchema()
+{
+
+ try {
+ XMLHelperPtr xmh = HelperProvider::getXMLHelper();
+
+ XMLDocumentPtr doc = xmh->loadFile("pete.xml");
+ xmh->save(doc, "noschemaout.xml");
+ return comparefiles("noschemaout.xml" ,"noschema.xml");
+
+ }
+ catch (SDORuntimeException e)
+ {
+ cout << "Exception in loadWithoutSchema" << e << endl;
+ return 0;
+ }
+}
+
+int sdotest::jira445()
+{
+
+ try {
+ XSDHelperPtr xsh = HelperProvider::getXSDHelper();
+ XMLHelperPtr xmh = HelperProvider::getXMLHelper(xsh->getDataFactory());
+ xsh->defineFile("fidelity.xsd");
+ XMLDocumentPtr doc = xmh->loadFile("fidelity.xml");
+ xmh->save(doc, "jira445out.xml");
+ return comparefiles("jira445out.xml" ,"jira445expected.xml");
+
+ }
+ catch (SDORuntimeException e)
+ {
+ cout << "Exception in jira445" << e << endl;
+ return 0;
+ }
+}
+
+int sdotest::jira1112()
+{
+
+ try {
+ XSDHelperPtr xsh = HelperProvider::getXSDHelper();
+ XMLHelperPtr xmh = HelperProvider::getXMLHelper(xsh->getDataFactory());
+ xsh->defineFile("types.xsd");
+ unsigned int i,j;
+ if ((i = xsh->getErrorCount()) > 0)
+ {
+ cout << "types.xsd reported some errors: " <<endl;
+ for (j=0;j<i;j++)
+ {
+ cout << xsh->getErrorMessage(j) <<endl;
+ }
+ }
+
+ DataObjectPtr person = xsh->getDataFactory()->create("http://www.test.com/info","personType");
+ DataObjectPtr name = person->createDataObject("name");
+ name->setCString("first", "Will");
+ name->setCString("last", "Shakespeare");
+
+ DataObjectPtr add = xsh->getDataFactory()->create("http://Component" , "add");
+ add->setDataObject("person", person);
+
+ XMLDocumentPtr doc = xmh->createDocument(add, "", "BOGUS");
+ xmh->save(doc, "jira1112out.xml", 2);
+ return comparefiles("jira1112out.xml" ,"jira1112expected.xml");
+
+ }
+ catch (SDORuntimeException e)
+ {
+ cout << "Exception in jira1112" << e << endl;
+ return 0;
+ }
+}
+
+int sdotest::elementFormDefaultQualifiedSequence()
+{
+
+ try {
+ XSDHelperPtr xsh = HelperProvider::getXSDHelper();
+ XMLHelperPtr xmh = HelperProvider::getXMLHelper(xsh->getDataFactory());
+ xsh->defineFile("elementFormDefaultQualifiedSeq.xsd");
+ unsigned int i,j;
+ if ((i = xsh->getErrorCount()) > 0)
+ {
+ cout << "elementFormDefaultQualifiedSeq.xsd reported some errors: " <<endl;
+ for (j=0;j<i;j++)
+ {
+ cout << xsh->getErrorMessage(j) <<endl;
+ }
+ }
+
+
+ DataObjectPtr x = xsh->getDataFactory()->create("test","xT");
+ DataObjectPtr a = x->createDataObject("a");
+ a->getList("a1").append("test data");
+
+ XMLDocumentPtr doc = xmh->createDocument(a, "", "a");
+ xmh->save(doc, "elementFormDefaultQualifiedSeq_out.xml", 2);
+ return comparefiles("elementFormDefaultQualifiedSeq_out.xml" ,"elementFormDefaultQualifiedSeq_expected.xml");
+ }
+ catch (SDORuntimeException e)
+ {
+ cout << "Exception in elementFormDefaultQualifiedSequence: " << e << endl;
+ return 0;
+ }
+}
+
+int sdotest::xsiTypeAbstract()
+{
+
+ try {
+ XSDHelperPtr xsh = HelperProvider::getXSDHelper();
+ XMLHelperPtr xmh = HelperProvider::getXMLHelper(xsh->getDataFactory());
+ xsh->defineFile("xsiTypeAbstract.xsd");
+ unsigned int i,j;
+ if ((i = xsh->getErrorCount()) > 0)
+ {
+ cout << "xsiTypeAbstract.xsd reported some errors: " <<endl;
+ for (j=0;j<i;j++)
+ {
+ cout << xsh->getErrorMessage(j) <<endl;
+ }
+ }
+
+
+ DataObjectPtr x = xsh->getDataFactory()->create("","X");
+ DataObjectPtr concrete = xsh->getDataFactory()->create("","concreteType");
+ x->setDataObject("abstract", concrete);
+
+ XMLDocumentPtr doc = xmh->createDocument(x, "", "X");
+ xmh->save(doc, "xsiTypeAbstract_out.xml", 2);
+ return comparefiles("xsiTypeAbstract_out.xml" ,"xsiTypeAbstract_expected.xml");
+ }
+ catch (SDORuntimeException e)
+ {
+ cout << "Exception in xsiTypeAbstract: " << e << endl;
+ return 0;
+ }
+}
+
+int sdotest::jira1548()
+{
+
+ try {
+
+ DataFactoryPtr mdg = DataFactory::getDataFactory();
+
+ mdg->addType("jira1548", "MyType");
+ mdg->addPropertyToType("jira1548","MyType",
+ "stringProp",
+ "commonj.sdo","String",
+ true, // isMany
+ false, // readOnly
+ false); // containment
+
+ mdg->addType("jira1548", "MyParentType");
+
+ mdg->addPropertyToType("jira1548","MyParentType",
+ "dobProp",
+ "jira1548","MyType",
+ true, // isMany
+ false, // readOnly
+ true); // containment
+
+ DataObjectPtr myTypeObj = mdg->create("jira1548", "MyType");
+ DataObjectList& stringPropList = myTypeObj->getList("stringProp");
+ stringPropList.append("stringPropValue1");
+
+ int success = 1;
+
+ SDOString expectedClass("SDOUnsupportedOperationException");
+ SDOString messageSubStr("must have a xpath index");
+ // should throw an exception, as accessing a multi-valued property with
+ // xpath, requires an index
+ try {
+ myTypeObj->getCString("stringProp");
+ success = 0;
+ }
+ catch(const SDORuntimeException& e) {
+ int correct = 1;
+ if (expectedClass != e.getEClassName()) correct = 0;
+ SDOString msg(e.getMessageText());
+ if (msg.find(messageSubStr) == std::string::npos) correct = 0;
+ if (!correct) {
+ cout << "Unexpected Exception in jira1548" << e << endl;
+ success = 0;
+ }
+ }
+
+ DataObjectPtr myParentTypeObj = mdg->create("jira1548", "MyParentType");
+ DataObjectList& dobPropList = myParentTypeObj->getList("dobProp");
+ dobPropList.append(myTypeObj);
+
+ // should throw an exception, as accessing a multi-valued property with
+ // xpath, requires an index
+ try {
+ myParentTypeObj->getDataObject("dobProp");
+ success = 0;
+ }
+ catch(const SDORuntimeException& e) {
+ int correct = 1;
+ if (expectedClass != e.getEClassName()) correct = 0;
+ SDOString msg(e.getMessageText());
+ if (msg.find(messageSubStr) == std::string::npos) correct = 0;
+ if (!correct) {
+ cout << "Unexpected Exception in jira1548" << e << endl;
+ success = 0;
+ }
+ }
+
+ // should throw an exception, as accessing a multi-valued property with
+ // xpath, requires an index (this test for an intermediate step)
+ try {
+ myParentTypeObj->getCString("dobProp/stringProp.0");
+ success = 0;
+ }
+ catch(const SDORuntimeException& e) {
+ int correct = 1;
+ if (expectedClass != e.getEClassName()) correct = 0;
+ SDOString msg(e.getMessageText());
+ if (msg.find(messageSubStr) == std::string::npos) correct = 0;
+ if (!correct) {
+ cout << "Unexpected Exception in jira1548" << e << endl;
+ success = 0;
+ }
+ }
+
+ return success;
+ }
+ catch (SDORuntimeException e)
+ {
+ cout << "Exception in jira1548" << e << endl;
+ return 0;
+ }
+}
+
+int sdotest::jira1837()
+{
+
+ try {
+
+ DataFactoryPtr mdg = DataFactory::getDataFactory();
+
+ mdg->addType("apache.tuscany.jira1837", "Root");
+ mdg->addType("apache.tuscany.jira1837", "company");
+ mdg->addType("apache.tuscany.jira1837", "department");
+ mdg->addType("apache.tuscany.jira1837", "employee");
+
+ const Type& rootType = mdg->getType("apache.tuscany.jira1837", "Root");
+ const Type& companyType = mdg->getType("apache.tuscany.jira1837", "company");
+ const Type& departmentType = mdg->getType("apache.tuscany.jira1837", "department");
+ const Type& employeeType = mdg->getType("apache.tuscany.jira1837", "employee");
+
+ mdg->addPropertyToType("apache.tuscany.jira1837", "Root", "ChangeSummary", "commonj.sdo", "ChangeSummary", false, false, true);
+ mdg->addPropertyToType("apache.tuscany.jira1837", "Root", "company", "apache.tuscany.jira1837", "company", true, false, true);
+ mdg->addPropertyToType("apache.tuscany.jira1837", "Root", "employee", "apache.tuscany.jira1837", "employee", true, false, true);
+ mdg->addPropertyToType("apache.tuscany.jira1837", "Root", "department", "apache.tuscany.jira1837", "department", true, false, true);
+
+ mdg->addPropertyToType("apache.tuscany.jira1837", "company", "id", "commonj.sdo", "Integer", false, false, true);
+ mdg->addPropertyToType("apache.tuscany.jira1837", "company", "name", "commonj.sdo", "String", false, false, true);
+ mdg->addPropertyToType("apache.tuscany.jira1837", "company", "department", "apache.tuscany.jira1837", "department", true, false, false);
+
+ mdg->addPropertyToType("apache.tuscany.jira1837", "department", "id", "commonj.sdo", "Integer", false, false, true);
+ mdg->addPropertyToType("apache.tuscany.jira1837", "department", "name", "commonj.sdo", "String", false, false, true);
+ mdg->addPropertyToType("apache.tuscany.jira1837", "department", "employee", "apache.tuscany.jira1837", "employee", true, false, false);
+
+ mdg->addPropertyToType("apache.tuscany.jira1837", "employee", "id", "commonj.sdo", "Integer", false, false, true);
+ mdg->addPropertyToType("apache.tuscany.jira1837", "employee", "name", "commonj.sdo", "String", false, false, true);
+
+ std::wstring waux;
+ DataObjectPtr root = mdg->create(rootType);
+
+ DataObjectPtr company1 = root->createDataObject("company");
+ company1->setInt("id", 1);
+ waux = L"apache";
+ company1->setString("name", waux.c_str(), waux.length());
+
+ DataObjectPtr company2 = root->createDataObject("company");
+ company2->setInt("id", 2);
+ waux = L"acme";
+ company2->setString("name", waux.c_str(), waux.length());
+
+ DataObjectPtr company3 = root->createDataObject("company");
+ company3->setInt("id", 3);
+ waux = L"google";
+ company3->setString("name", waux.c_str(), waux.length());
+
+ DataObjectPtr company4 = root->createDataObject("company");
+ company1->setInt("id", 4);
+ waux = L"ibm";
+ company4->setString("name", waux.c_str(), waux.length());
+
+ DataObjectPtr company5 = root->createDataObject("company");
+ company5->setInt("id", 5);
+ waux = L"yahoo";
+ company5->setString("name", waux.c_str(), waux.length());
+
+ DataObjectPtr depart1 = root->createDataObject("department");
+ depart1->setInt("id", 1);
+ waux = L"department1";
+ depart1->setString("name", waux.c_str(), waux.length());
+
+ DataObjectPtr depart2 = root->createDataObject("department");
+ depart2->setInt("id", 2);
+ waux = L"department1";
+ depart2->setString("name", waux.c_str(), waux.length());
+
+ DataObjectPtr depart3 = root->createDataObject("department");
+ depart3->setInt("id", 3);
+ waux = L"department2";
+ depart3->setString("name", waux.c_str(), waux.length());
+
+ DataObjectPtr depart4 = root->createDataObject("department");
+ depart4->setInt("id", 4);
+ waux = L"department5";
+ depart4->setString("name", waux.c_str(), waux.length());
+
+ DataObjectPtr depart5 = root->createDataObject("department");
+ depart5->setInt("id", 5);
+ waux = L"department3";
+ depart5->setString("name", waux.c_str(), waux.length());
+
+ DataObjectPtr depart6 = root->createDataObject("department");
+ depart6->setInt("id", 6);
+ waux = L"department6";
+ depart6->setString("name", waux.c_str(), waux.length());
+
+ DataObjectPtr employee1 = root->createDataObject("employee");
+ employee1->setInt("id", 1);
+ waux = L"adriano";
+ employee1->setString("name", waux.c_str(), waux.length());
+
+ DataObjectPtr employee2 = root->createDataObject("employee");
+ employee2->setInt("id", 2);
+ waux = L"paul";
+ employee2->setString("name", waux.c_str(), waux.length());
+
+ DataObjectPtr employee3 = root->createDataObject("employee");
+ employee3->setInt("id", 3);
+ waux = L"richard";
+ employee3->setString("name", waux.c_str(), waux.length());
+
+ DataObjectPtr employee4 = root->createDataObject("employee");
+ employee4->setInt("id", 4);
+ waux = L"ema";
+ employee4->setString("name", waux.c_str(), waux.length());
+
+ DataObjectPtr employee5 = root->createDataObject("employee");
+ employee5->setInt("id", 5);
+ waux = L"james";
+ employee5->setString("name", waux.c_str(), waux.length());
+
+ company1->getList("department").append(depart1);
+ company1->getList("department").append(depart2);
+
+ company2->getList("department").append(depart3);
+ company2->getList("department").append(depart4);
+
+ company3->getList("department").append(depart5);
+ company3->getList("department").append(depart6);
+
+ depart1->getList("employee").append(employee1);
+ depart1->getList("employee").append(employee2);
+ depart1->getList("employee").append(employee3);
+
+ root->getChangeSummary()->beginLogging();
+
+ DataObjectPtr removedDepartment = company1->getList("department").remove(0);
+
+ if (removedDepartment->getContainer() == 0) {
+ return 0;
+ }
+
+ return 1;
+
+ }
+ catch (SDORuntimeException e)
+ {
+ cout << "Exception in test jira1837" << e << endl;
+ return 0;
+ }
+}
+
diff --git a/sdo-cpp/trunk/runtime/core/test/sequence.txt b/sdo-cpp/trunk/runtime/core/test/sequence.txt
new file mode 100644
index 0000000000..1a616a3d16
--- /dev/null
+++ b/sdo-cpp/trunk/runtime/core/test/sequence.txt
@@ -0,0 +1,45 @@
+======================================
+======================================
+======================================
+I am Item 1 of string
+======================================
+======================================
+I am Item 1 of string
+I am the first free text
+======================================
+======================================
+I am Item 1 of string
+I am the first free text
+I am Item 2 of string
+======================================
+======================================
+I am Item 1 of string
+I am free text which has been modified
+I am Item 2 of string
+
+======================================
+======================================
+I am Item 1 of string
+I am free text which has been modified
+I am Item 2 of string
+department1
+======================================
+======================================
+I am Item 1 of string
+I am free text which has been modified
+I am Item 2 of string
+department1
+======================================
+======================================
+I am Item 1 of string
+I am free text which has been modified
+I am Item 2 of string
+department1
+======================================
+======================================
+I am Item 1 of string
+I am free text which has been modified
+I am Item 2 of string
+department1
+department2
+======================================
diff --git a/sdo-cpp/trunk/runtime/core/test/setmany.txt b/sdo-cpp/trunk/runtime/core/test/setmany.txt
new file mode 100644
index 0000000000..1d38a974d5
--- /dev/null
+++ b/sdo-cpp/trunk/runtime/core/test/setmany.txt
@@ -0,0 +1,23 @@
+ School :King Norberts
+ Address1:The Place
+ Address2:1 The Avenue
+ Address3:Murchester
+ Address4:England
+ Class :Primary
+ Teacher :Mr Philbert Chloroform
+ Pupil1 :Witherspoon Jnr
+ Pupil2 :Snape
+ Pupil3 :Thannet
+ Class :Secondary
+ Teacher :Mr Brian Onasis
+ Pupil1 :Grimbling
+ Pupil2 :Snagget Minor
+ Pupil3 :Van Den Bograt
+Expected path not found exception caught
+Indexed as expected
+Indexed as expected
+Indexed as expected
+Indexed as expected
+Indexed as expected
+Normal index out of range caught
+ Address4 :PostCode
diff --git a/sdo-cpp/trunk/runtime/core/test/setnull.txt b/sdo-cpp/trunk/runtime/core/test/setnull.txt
new file mode 100644
index 0000000000..5353d42b69
--- /dev/null
+++ b/sdo-cpp/trunk/runtime/core/test/setnull.txt
@@ -0,0 +1,42 @@
+===== Modified Object Starts
+Xpath:#/
+The modified objects type is NullNS#NullMainType
+===== Old Property Values Begin
+Property asub of type DataObject object still exists
+
+Property bsub(UNSET) of type DataObject - object null or unset
+
+===== Old Property Values End
+=====Modified Object Ends
+===== Modified Object Starts
+Xpath:#/subs.0
+The modified objects type is NullNS#NullSubType
+===== Old Property Values Begin
+Property name of type String:All Initially set
+
+Property number of type Int:100
+
+Property bool of type Boolean:0
+
+===== Old Property Values End
+=====Modified Object Ends
+===== Modified Object Starts
+Xpath:#/subs.1
+The modified objects type is NullNS#NullSubType
+===== Old Property Values Begin
+Property bool(UNSET) of type Boolean:0
+
+===== Old Property Values End
+=====Modified Object Ends
+===== Modified Object Starts
+Xpath:#/subs.2
+The modified objects type is NullNS#NullSubType
+===== Old Property Values Begin
+Property name(ISNULL) of type String:
+
+Property number(ISNULL) of type Int:0
+
+Property bool(ISNULL) of type Boolean:0
+
+===== Old Property Values End
+=====Modified Object Ends
diff --git a/sdo-cpp/trunk/runtime/core/test/showdefault1.txt b/sdo-cpp/trunk/runtime/core/test/showdefault1.txt
new file mode 100644
index 0000000000..3b27c55114
--- /dev/null
+++ b/sdo-cpp/trunk/runtime/core/test/showdefault1.txt
@@ -0,0 +1,15 @@
+Boolean default is : 0
+Boolean default as a string is false
+Byte default is : 0
+Byte default as a string is 0
+Character default is : 0
+Character default as a string is 0
+Short default is : 0
+Int default is : 0
+Int many default is : 0
+Long default is : 0
+Float default is : 0.000
+Double default is : 0.000
+Date default is : 0
+String default is zero length
+Bytes default is zero length
diff --git a/sdo-cpp/trunk/runtime/core/test/showdefault2.txt b/sdo-cpp/trunk/runtime/core/test/showdefault2.txt
new file mode 100644
index 0000000000..aed38385b0
--- /dev/null
+++ b/sdo-cpp/trunk/runtime/core/test/showdefault2.txt
@@ -0,0 +1,18 @@
+Boolean default is : 1
+Boolean default as a string is true
+Byte default is : 100
+Byte default as a string is 100
+Character default is : 101
+Character default as a string is 101
+Short default is : 300
+Int default is : 400
+Int many default is : 800
+Long default is : 500
+Float default is : 600.000
+Double default is : 700.000
+Date default is : 900
+String default length is 4
+HELP
+String default as a string is HELP
+Bytes default length is 4
+HELP
diff --git a/sdo-cpp/trunk/runtime/core/test/simple.txt b/sdo-cpp/trunk/runtime/core/test/simple.txt
new file mode 100644
index 0000000000..0b143e19a9
--- /dev/null
+++ b/sdo-cpp/trunk/runtime/core/test/simple.txt
@@ -0,0 +1,8 @@
+Type:#RootType
+Property:person
+Type of property:String
+IsMany?0
+===== DataObject contents =====
+person:string:someone
+
+===== End DataObject =====
diff --git a/sdo-cpp/trunk/runtime/core/test/simple.xml b/sdo-cpp/trunk/runtime/core/test/simple.xml
new file mode 100644
index 0000000000..4896d30619
--- /dev/null
+++ b/sdo-cpp/trunk/runtime/core/test/simple.xml
@@ -0,0 +1,21 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ Licensed to the Apache Software Foundation (ASF) under one
+ or more contributor license agreements. See the NOTICE file
+ distributed with this work for additional information
+ regarding copyright ownership. The ASF licenses this file
+ to you 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.
+-->
+
+<person>someone</person>
diff --git a/sdo-cpp/trunk/runtime/core/test/simple.xsd b/sdo-cpp/trunk/runtime/core/test/simple.xsd
new file mode 100644
index 0000000000..f31d6e21d2
--- /dev/null
+++ b/sdo-cpp/trunk/runtime/core/test/simple.xsd
@@ -0,0 +1,23 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ Licensed to the Apache Software Foundation (ASF) under one
+ or more contributor license agreements. See the NOTICE file
+ distributed with this work for additional information
+ regarding copyright ownership. The ASF licenses this file
+ to you 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.
+-->
+
+<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema">
+<xs:element name="person" type="xs:string"/>
+</xs:schema>
diff --git a/sdo-cpp/trunk/runtime/core/test/stock.wsdl b/sdo-cpp/trunk/runtime/core/test/stock.wsdl
new file mode 100644
index 0000000000..d465f1beb2
--- /dev/null
+++ b/sdo-cpp/trunk/runtime/core/test/stock.wsdl
@@ -0,0 +1,407 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ Licensed to the Apache Software Foundation (ASF) under one
+ or more contributor license agreements. See the NOTICE file
+ distributed with this work for additional information
+ regarding copyright ownership. The ASF licenses this file
+ to you 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.
+-->
+
+
+<wsdl:definitions xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/" xmlns:tm="http://microsoft.com/wsdl/mime/textMatching/" xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/" xmlns:mime="http://schemas.xmlsoap.org/wsdl/mime/" xmlns:tns="http://ws.invesbot.com/" xmlns:s="http://www.w3.org/2001/XMLSchema" xmlns:soap12="http://schemas.xmlsoap.org/wsdl/soap12/" xmlns:http="http://schemas.xmlsoap.org/wsdl/http/" targetNamespace="http://ws.invesbot.com/" xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/">
+ <wsdl:types>
+ <s:schema elementFormDefault="qualified" targetNamespace="http://ws.invesbot.com/">
+ <s:element name="GetQuotes">
+ <s:complexType>
+ <s:sequence>
+ <s:element minOccurs="0" maxOccurs="1" name="symbols" type="s:string" />
+ </s:sequence>
+ </s:complexType>
+ </s:element>
+ <s:element name="GetQuotesResponse">
+ <s:complexType>
+ <s:sequence>
+ <s:element minOccurs="0" maxOccurs="1" name="GetQuotesResult">
+ <s:complexType mixed="true">
+ <s:sequence>
+ <s:any />
+ </s:sequence>
+ </s:complexType>
+ </s:element>
+ </s:sequence>
+ </s:complexType>
+ </s:element>
+ <s:element name="GetQuote">
+ <s:complexType>
+ <s:sequence>
+ <s:element minOccurs="0" maxOccurs="1" name="symbol" type="s:string" />
+ </s:sequence>
+ </s:complexType>
+ </s:element>
+ <s:element name="GetQuoteResponse">
+ <s:complexType>
+ <s:sequence>
+ <s:element minOccurs="0" maxOccurs="1" name="GetQuoteResult">
+ <s:complexType mixed="true">
+ <s:sequence>
+ <s:any />
+ </s:sequence>
+ </s:complexType>
+ </s:element>
+ </s:sequence>
+ </s:complexType>
+ </s:element>
+ <s:element name="GetMarketIndex">
+ <s:complexType />
+ </s:element>
+ <s:element name="GetMarketIndexResponse">
+ <s:complexType>
+ <s:sequence>
+ <s:element minOccurs="0" maxOccurs="1" name="GetMarketIndexResult">
+ <s:complexType mixed="true">
+ <s:sequence>
+ <s:any />
+ </s:sequence>
+ </s:complexType>
+ </s:element>
+ </s:sequence>
+ </s:complexType>
+ </s:element>
+ <s:element name="GetECNQuotes">
+ <s:complexType>
+ <s:sequence>
+ <s:element minOccurs="0" maxOccurs="1" name="symbols" type="s:string" />
+ </s:sequence>
+ </s:complexType>
+ </s:element>
+ <s:element name="GetECNQuotesResponse">
+ <s:complexType>
+ <s:sequence>
+ <s:element minOccurs="0" maxOccurs="1" name="GetECNQuotesResult">
+ <s:complexType mixed="true">
+ <s:sequence>
+ <s:any />
+ </s:sequence>
+ </s:complexType>
+ </s:element>
+ </s:sequence>
+ </s:complexType>
+ </s:element>
+ </s:schema>
+ </wsdl:types>
+ <wsdl:message name="GetQuotesSoapIn">
+ <wsdl:part name="parameters" element="tns:GetQuotes" />
+ </wsdl:message>
+ <wsdl:message name="GetQuotesSoapOut">
+ <wsdl:part name="parameters" element="tns:GetQuotesResponse" />
+ </wsdl:message>
+ <wsdl:message name="GetQuoteSoapIn">
+ <wsdl:part name="parameters" element="tns:GetQuote" />
+ </wsdl:message>
+ <wsdl:message name="GetQuoteSoapOut">
+ <wsdl:part name="parameters" element="tns:GetQuoteResponse" />
+ </wsdl:message>
+ <wsdl:message name="GetMarketIndexSoapIn">
+ <wsdl:part name="parameters" element="tns:GetMarketIndex" />
+ </wsdl:message>
+ <wsdl:message name="GetMarketIndexSoapOut">
+ <wsdl:part name="parameters" element="tns:GetMarketIndexResponse" />
+ </wsdl:message>
+ <wsdl:message name="GetECNQuotesSoapIn">
+ <wsdl:part name="parameters" element="tns:GetECNQuotes" />
+ </wsdl:message>
+ <wsdl:message name="GetECNQuotesSoapOut">
+ <wsdl:part name="parameters" element="tns:GetECNQuotesResponse" />
+ </wsdl:message>
+ <wsdl:message name="GetQuotesHttpGetIn">
+ <wsdl:part name="symbols" type="s:string" />
+ </wsdl:message>
+ <wsdl:message name="GetQuotesHttpGetOut">
+ <wsdl:part name="Body" />
+ </wsdl:message>
+ <wsdl:message name="GetQuoteHttpGetIn">
+ <wsdl:part name="symbol" type="s:string" />
+ </wsdl:message>
+ <wsdl:message name="GetQuoteHttpGetOut">
+ <wsdl:part name="Body" />
+ </wsdl:message>
+ <wsdl:message name="GetMarketIndexHttpGetIn" />
+ <wsdl:message name="GetMarketIndexHttpGetOut">
+ <wsdl:part name="Body" />
+ </wsdl:message>
+ <wsdl:message name="GetECNQuotesHttpGetIn">
+ <wsdl:part name="symbols" type="s:string" />
+ </wsdl:message>
+ <wsdl:message name="GetECNQuotesHttpGetOut">
+ <wsdl:part name="Body" />
+ </wsdl:message>
+ <wsdl:message name="GetQuotesHttpPostIn">
+ <wsdl:part name="symbols" type="s:string" />
+ </wsdl:message>
+ <wsdl:message name="GetQuotesHttpPostOut">
+ <wsdl:part name="Body" />
+ </wsdl:message>
+ <wsdl:message name="GetQuoteHttpPostIn">
+ <wsdl:part name="symbol" type="s:string" />
+ </wsdl:message>
+ <wsdl:message name="GetQuoteHttpPostOut">
+ <wsdl:part name="Body" />
+ </wsdl:message>
+ <wsdl:message name="GetMarketIndexHttpPostIn" />
+ <wsdl:message name="GetMarketIndexHttpPostOut">
+ <wsdl:part name="Body" />
+ </wsdl:message>
+ <wsdl:message name="GetECNQuotesHttpPostIn">
+ <wsdl:part name="symbols" type="s:string" />
+ </wsdl:message>
+ <wsdl:message name="GetECNQuotesHttpPostOut">
+ <wsdl:part name="Body" />
+ </wsdl:message>
+ <wsdl:portType name="StockQuotesSoap">
+ <wsdl:operation name="GetQuotes">
+ <wsdl:documentation xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/">Enter symbols, seperated by space, Quotes delayed in 20 minutes.</wsdl:documentation>
+ <wsdl:input message="tns:GetQuotesSoapIn" />
+ <wsdl:output message="tns:GetQuotesSoapOut" />
+ </wsdl:operation>
+ <wsdl:operation name="GetQuote">
+ <wsdl:documentation xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/">Enter one symbol, quote delayed in 20 minutes.</wsdl:documentation>
+ <wsdl:input message="tns:GetQuoteSoapIn" />
+ <wsdl:output message="tns:GetQuoteSoapOut" />
+ </wsdl:operation>
+ <wsdl:operation name="GetMarketIndex">
+ <wsdl:documentation xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/">Get Dow, Nasdaq, S&amp;P500 index.</wsdl:documentation>
+ <wsdl:input message="tns:GetMarketIndexSoapIn" />
+ <wsdl:output message="tns:GetMarketIndexSoapOut" />
+ </wsdl:operation>
+ <wsdl:operation name="GetECNQuotes">
+ <wsdl:documentation xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/">Enter symbols, seperated by space, Real-Time ECN quote.</wsdl:documentation>
+ <wsdl:input message="tns:GetECNQuotesSoapIn" />
+ <wsdl:output message="tns:GetECNQuotesSoapOut" />
+ </wsdl:operation>
+ </wsdl:portType>
+ <wsdl:portType name="StockQuotesHttpGet">
+ <wsdl:operation name="GetQuotes">
+ <wsdl:documentation xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/">Enter symbols, seperated by space, Quotes delayed in 20 minutes.</wsdl:documentation>
+ <wsdl:input message="tns:GetQuotesHttpGetIn" />
+ <wsdl:output message="tns:GetQuotesHttpGetOut" />
+ </wsdl:operation>
+ <wsdl:operation name="GetQuote">
+ <wsdl:documentation xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/">Enter one symbol, quote delayed in 20 minutes.</wsdl:documentation>
+ <wsdl:input message="tns:GetQuoteHttpGetIn" />
+ <wsdl:output message="tns:GetQuoteHttpGetOut" />
+ </wsdl:operation>
+ <wsdl:operation name="GetMarketIndex">
+ <wsdl:documentation xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/">Get Dow, Nasdaq, S&amp;P500 index.</wsdl:documentation>
+ <wsdl:input message="tns:GetMarketIndexHttpGetIn" />
+ <wsdl:output message="tns:GetMarketIndexHttpGetOut" />
+ </wsdl:operation>
+ <wsdl:operation name="GetECNQuotes">
+ <wsdl:documentation xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/">Enter symbols, seperated by space, Real-Time ECN quote.</wsdl:documentation>
+ <wsdl:input message="tns:GetECNQuotesHttpGetIn" />
+ <wsdl:output message="tns:GetECNQuotesHttpGetOut" />
+ </wsdl:operation>
+ </wsdl:portType>
+ <wsdl:portType name="StockQuotesHttpPost">
+ <wsdl:operation name="GetQuotes">
+ <wsdl:documentation xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/">Enter symbols, seperated by space, Quotes delayed in 20 minutes.</wsdl:documentation>
+ <wsdl:input message="tns:GetQuotesHttpPostIn" />
+ <wsdl:output message="tns:GetQuotesHttpPostOut" />
+ </wsdl:operation>
+ <wsdl:operation name="GetQuote">
+ <wsdl:documentation xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/">Enter one symbol, quote delayed in 20 minutes.</wsdl:documentation>
+ <wsdl:input message="tns:GetQuoteHttpPostIn" />
+ <wsdl:output message="tns:GetQuoteHttpPostOut" />
+ </wsdl:operation>
+ <wsdl:operation name="GetMarketIndex">
+ <wsdl:documentation xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/">Get Dow, Nasdaq, S&amp;P500 index.</wsdl:documentation>
+ <wsdl:input message="tns:GetMarketIndexHttpPostIn" />
+ <wsdl:output message="tns:GetMarketIndexHttpPostOut" />
+ </wsdl:operation>
+ <wsdl:operation name="GetECNQuotes">
+ <wsdl:documentation xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/">Enter symbols, seperated by space, Real-Time ECN quote.</wsdl:documentation>
+ <wsdl:input message="tns:GetECNQuotesHttpPostIn" />
+ <wsdl:output message="tns:GetECNQuotesHttpPostOut" />
+ </wsdl:operation>
+ </wsdl:portType>
+ <wsdl:binding name="StockQuotesSoap" type="tns:StockQuotesSoap">
+ <soap:binding transport="http://schemas.xmlsoap.org/soap/http" />
+ <wsdl:operation name="GetQuotes">
+ <soap:operation soapAction="http://ws.invesbot.com/GetQuotes" style="document" />
+ <wsdl:input>
+ <soap:body use="literal" />
+ </wsdl:input>
+ <wsdl:output>
+ <soap:body use="literal" />
+ </wsdl:output>
+ </wsdl:operation>
+ <wsdl:operation name="GetQuote">
+ <soap:operation soapAction="http://ws.invesbot.com/GetQuote" style="document" />
+ <wsdl:input>
+ <soap:body use="literal" />
+ </wsdl:input>
+ <wsdl:output>
+ <soap:body use="literal" />
+ </wsdl:output>
+ </wsdl:operation>
+ <wsdl:operation name="GetMarketIndex">
+ <soap:operation soapAction="http://ws.invesbot.com/GetMarketIndex" style="document" />
+ <wsdl:input>
+ <soap:body use="literal" />
+ </wsdl:input>
+ <wsdl:output>
+ <soap:body use="literal" />
+ </wsdl:output>
+ </wsdl:operation>
+ <wsdl:operation name="GetECNQuotes">
+ <soap:operation soapAction="http://ws.invesbot.com/GetECNQuotes" style="document" />
+ <wsdl:input>
+ <soap:body use="literal" />
+ </wsdl:input>
+ <wsdl:output>
+ <soap:body use="literal" />
+ </wsdl:output>
+ </wsdl:operation>
+ </wsdl:binding>
+ <wsdl:binding name="StockQuotesSoap12" type="tns:StockQuotesSoap">
+ <soap12:binding transport="http://schemas.xmlsoap.org/soap/http" />
+ <wsdl:operation name="GetQuotes">
+ <soap12:operation soapAction="http://ws.invesbot.com/GetQuotes" style="document" />
+ <wsdl:input>
+ <soap12:body use="literal" />
+ </wsdl:input>
+ <wsdl:output>
+ <soap12:body use="literal" />
+ </wsdl:output>
+ </wsdl:operation>
+ <wsdl:operation name="GetQuote">
+ <soap12:operation soapAction="http://ws.invesbot.com/GetQuote" style="document" />
+ <wsdl:input>
+ <soap12:body use="literal" />
+ </wsdl:input>
+ <wsdl:output>
+ <soap12:body use="literal" />
+ </wsdl:output>
+ </wsdl:operation>
+ <wsdl:operation name="GetMarketIndex">
+ <soap12:operation soapAction="http://ws.invesbot.com/GetMarketIndex" style="document" />
+ <wsdl:input>
+ <soap12:body use="literal" />
+ </wsdl:input>
+ <wsdl:output>
+ <soap12:body use="literal" />
+ </wsdl:output>
+ </wsdl:operation>
+ <wsdl:operation name="GetECNQuotes">
+ <soap12:operation soapAction="http://ws.invesbot.com/GetECNQuotes" style="document" />
+ <wsdl:input>
+ <soap12:body use="literal" />
+ </wsdl:input>
+ <wsdl:output>
+ <soap12:body use="literal" />
+ </wsdl:output>
+ </wsdl:operation>
+ </wsdl:binding>
+ <wsdl:binding name="StockQuotesHttpGet" type="tns:StockQuotesHttpGet">
+ <http:binding verb="GET" />
+ <wsdl:operation name="GetQuotes">
+ <http:operation location="/GetQuotes" />
+ <wsdl:input>
+ <http:urlEncoded />
+ </wsdl:input>
+ <wsdl:output>
+ <mime:content part="Body" type="text/xml" />
+ </wsdl:output>
+ </wsdl:operation>
+ <wsdl:operation name="GetQuote">
+ <http:operation location="/GetQuote" />
+ <wsdl:input>
+ <http:urlEncoded />
+ </wsdl:input>
+ <wsdl:output>
+ <mime:content part="Body" type="text/xml" />
+ </wsdl:output>
+ </wsdl:operation>
+ <wsdl:operation name="GetMarketIndex">
+ <http:operation location="/GetMarketIndex" />
+ <wsdl:input>
+ <http:urlEncoded />
+ </wsdl:input>
+ <wsdl:output>
+ <mime:content part="Body" type="text/xml" />
+ </wsdl:output>
+ </wsdl:operation>
+ <wsdl:operation name="GetECNQuotes">
+ <http:operation location="/GetECNQuotes" />
+ <wsdl:input>
+ <http:urlEncoded />
+ </wsdl:input>
+ <wsdl:output>
+ <mime:content part="Body" type="text/xml" />
+ </wsdl:output>
+ </wsdl:operation>
+ </wsdl:binding>
+ <wsdl:binding name="StockQuotesHttpPost" type="tns:StockQuotesHttpPost">
+ <http:binding verb="POST" />
+ <wsdl:operation name="GetQuotes">
+ <http:operation location="/GetQuotes" />
+ <wsdl:input>
+ <mime:content type="application/x-www-form-urlencoded" />
+ </wsdl:input>
+ <wsdl:output>
+ <mime:content part="Body" type="text/xml" />
+ </wsdl:output>
+ </wsdl:operation>
+ <wsdl:operation name="GetQuote">
+ <http:operation location="/GetQuote" />
+ <wsdl:input>
+ <mime:content type="application/x-www-form-urlencoded" />
+ </wsdl:input>
+ <wsdl:output>
+ <mime:content part="Body" type="text/xml" />
+ </wsdl:output>
+ </wsdl:operation>
+ <wsdl:operation name="GetMarketIndex">
+ <http:operation location="/GetMarketIndex" />
+ <wsdl:input>
+ <mime:content type="application/x-www-form-urlencoded" />
+ </wsdl:input>
+ <wsdl:output>
+ <mime:content part="Body" type="text/xml" />
+ </wsdl:output>
+ </wsdl:operation>
+ <wsdl:operation name="GetECNQuotes">
+ <http:operation location="/GetECNQuotes" />
+ <wsdl:input>
+ <mime:content type="application/x-www-form-urlencoded" />
+ </wsdl:input>
+ <wsdl:output>
+ <mime:content part="Body" type="text/xml" />
+ </wsdl:output>
+ </wsdl:operation>
+ </wsdl:binding>
+ <wsdl:service name="StockQuotes">
+ <wsdl:port name="StockQuotesSoap" binding="tns:StockQuotesSoap">
+ <soap:address location="http://ws.invesbot.com/stockquotes.asmx" />
+ </wsdl:port>
+ <wsdl:port name="StockQuotesSoap12" binding="tns:StockQuotesSoap12">
+ <soap12:address location="http://ws.invesbot.com/stockquotes.asmx" />
+ </wsdl:port>
+ <wsdl:port name="StockQuotesHttpGet" binding="tns:StockQuotesHttpGet">
+ <http:address location="http://ws.invesbot.com/stockquotes.asmx" />
+ </wsdl:port>
+ <wsdl:port name="StockQuotesHttpPost" binding="tns:StockQuotesHttpPost">
+ <http:address location="http://ws.invesbot.com/stockquotes.asmx" />
+ </wsdl:port>
+ </wsdl:service>
+</wsdl:definitions> \ No newline at end of file
diff --git a/sdo-cpp/trunk/runtime/core/test/stock.xml b/sdo-cpp/trunk/runtime/core/test/stock.xml
new file mode 100644
index 0000000000..435fc549ad
--- /dev/null
+++ b/sdo-cpp/trunk/runtime/core/test/stock.xml
@@ -0,0 +1,45 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ Licensed to the Apache Software Foundation (ASF) under one
+ or more contributor license agreements. See the NOTICE file
+ distributed with this work for additional information
+ regarding copyright ownership. The ASF licenses this file
+ to you 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.
+-->
+
+<GetQuotesResponse xmlns="http://ws.invesbot.com/">
+<GetQuotesResult>
+<StockQuotes>
+<StockQuote>
+<Symbol>IBM</Symbol>
+<Price>&lt;big&gt;&lt;b&gt;82.72&lt;/b&gt;&lt;/big&gt;</Price>
+<Time>11:41AM ET</Time>
+<Change>&lt;img width=&quot;10&quot; height=&quot;14&quot; border=&quot;0&quot; src=&quot;http://us.i1.yimg.com/us.yimg.com/i/us/fi/03rd/down_r.gif&quot; alt=&quot;Down&quot;&gt;&amp;nbsp;&lt;b style=&quot;color:#cc0000;&quot;&gt;0.17 (0.21%)&lt;/b&gt;</Change>
+<PrevClose>82.89</PrevClose>
+<Open>82.49</Open>
+<Bid>N/A</Bid>
+<Ask>N/A</Ask>
+<YearTarget>95.94</YearTarget>
+<DayRange>82.40 - 82.80</DayRange>
+<YearRange>72.50 - 89.94</YearRange>
+<Volume>1,568,200</Volume>
+<AvgVol>5,301,380</AvgVol>
+<MarketCap>128.25B</MarketCap>
+<PE>16.15</PE>
+<EPS>5.12</EPS>
+<DivYield>1.20 (1.40%)</DivYield>
+</StockQuote>
+</StockQuotes>
+</GetQuotesResult>
+</GetQuotesResponse>
diff --git a/sdo-cpp/trunk/runtime/core/test/stock_wsdl.txt b/sdo-cpp/trunk/runtime/core/test/stock_wsdl.txt
new file mode 100644
index 0000000000..aacf89de06
--- /dev/null
+++ b/sdo-cpp/trunk/runtime/core/test/stock_wsdl.txt
@@ -0,0 +1,47 @@
+***** TYPES BEFORE RESOLVE **********************************
+Type:commonj.sdo#Boolean
+Type:commonj.sdo#Byte
+Type:commonj.sdo#Bytes
+Type:commonj.sdo#ChangeSummary
+Type:commonj.sdo#Character
+Type:commonj.sdo#DataObject
+Type:commonj.sdo#Date
+Type:commonj.sdo#Decimal
+Type:commonj.sdo#Double
+Type:commonj.sdo#Float
+Type:commonj.sdo#Int
+Type:commonj.sdo#Integer
+Type:commonj.sdo#Long
+Type:commonj.sdo#OpenDataObject
+Type:commonj.sdo#Short
+Type:commonj.sdo#String
+Type:commonj.sdo#URI
+Type:http://ws.invesbot.com/#GetECNQuotes
+Property:symbols of type String
+Type:http://ws.invesbot.com/#GetECNQuotesResponse
+Property:GetECNQuotesResult of type GetECNQuotesResult
+Type:http://ws.invesbot.com/#GetECNQuotesResult
+Type:http://ws.invesbot.com/#GetMarketIndex
+Type:http://ws.invesbot.com/#GetMarketIndexResponse
+Property:GetMarketIndexResult of type GetMarketIndexResult
+Type:http://ws.invesbot.com/#GetMarketIndexResult
+Type:http://ws.invesbot.com/#GetQuote
+Property:symbol of type String
+Type:http://ws.invesbot.com/#GetQuoteResponse
+Property:GetQuoteResult of type GetQuoteResult
+Type:http://ws.invesbot.com/#GetQuoteResult
+Type:http://ws.invesbot.com/#GetQuotes
+Property:symbols of type String
+Type:http://ws.invesbot.com/#GetQuotesResponse
+Property:GetQuotesResult of type GetQuotesResult
+Type:http://ws.invesbot.com/#GetQuotesResult
+Type:http://ws.invesbot.com/#RootType
+Property:GetQuotes of type GetQuotes
+Property:GetQuotesResponse of type GetQuotesResponse
+Property:GetQuote of type GetQuote
+Property:GetQuoteResponse of type GetQuoteResponse
+Property:GetMarketIndex of type GetMarketIndex
+Property:GetMarketIndexResponse of type GetMarketIndexResponse
+Property:GetECNQuotes of type GetECNQuotes
+Property:GetECNQuotesResponse of type GetECNQuotesResponse
+*******************************END TYPES******************
diff --git a/sdo-cpp/trunk/runtime/core/test/stock_xml.txt b/sdo-cpp/trunk/runtime/core/test/stock_xml.txt
new file mode 100644
index 0000000000..48361b655f
--- /dev/null
+++ b/sdo-cpp/trunk/runtime/core/test/stock_xml.txt
@@ -0,0 +1,127 @@
+***** TYPES AFTER RESOLVE*********************************
+Type:commonj.sdo#Boolean
+Type:commonj.sdo#Byte
+Type:commonj.sdo#Bytes
+Type:commonj.sdo#ChangeSummary
+Type:commonj.sdo#Character
+Type:commonj.sdo#DataObject
+Type:commonj.sdo#Date
+Type:commonj.sdo#Decimal
+Type:commonj.sdo#Double
+Type:commonj.sdo#Float
+Type:commonj.sdo#Int
+Type:commonj.sdo#Integer
+Type:commonj.sdo#Long
+Type:commonj.sdo#OpenDataObject
+Type:commonj.sdo#Short
+Type:commonj.sdo#String
+Type:commonj.sdo#URI
+Type:http://ws.invesbot.com/#GetECNQuotes
+Property:symbols of type String
+Type:http://ws.invesbot.com/#GetECNQuotesResponse
+Property:GetECNQuotesResult of type GetECNQuotesResult
+Type:http://ws.invesbot.com/#GetECNQuotesResult
+Type:http://ws.invesbot.com/#GetMarketIndex
+Type:http://ws.invesbot.com/#GetMarketIndexResponse
+Property:GetMarketIndexResult of type GetMarketIndexResult
+Type:http://ws.invesbot.com/#GetMarketIndexResult
+Type:http://ws.invesbot.com/#GetQuote
+Property:symbol of type String
+Type:http://ws.invesbot.com/#GetQuoteResponse
+Property:GetQuoteResult of type GetQuoteResult
+Type:http://ws.invesbot.com/#GetQuoteResult
+Type:http://ws.invesbot.com/#GetQuotes
+Property:symbols of type String
+Type:http://ws.invesbot.com/#GetQuotesResponse
+Property:GetQuotesResult of type GetQuotesResult
+Type:http://ws.invesbot.com/#GetQuotesResult
+Type:http://ws.invesbot.com/#RootType
+Property:GetQuotes of type GetQuotes
+Property:GetQuotesResponse of type GetQuotesResponse
+Property:GetQuote of type GetQuote
+Property:GetQuoteResponse of type GetQuoteResponse
+Property:GetMarketIndex of type GetMarketIndex
+Property:GetMarketIndexResponse of type GetMarketIndexResponse
+Property:GetECNQuotes of type GetECNQuotes
+Property:GetECNQuotesResponse of type GetECNQuotesResponse
+*******************************END TYPES******************
+===== DataObject contents =====
+GetQuotesResult:dataObject
+===== Sequenced DataObject contents =====
+Setting of DO property StockQuotes[0]=
+===== Sequenced DataObject contents =====
+Setting of DO property StockQuote[0]=
+===== Sequenced DataObject contents =====
+Setting of DO property Symbol[0]=
+===== Sequenced DataObject contents =====
+TEXT ELEMENT:IBM
+===== End Sequenced DataObject contents =
+Setting of DO property Price[0]=
+===== Sequenced DataObject contents =====
+TEXT ELEMENT:<big><b>82.72</b></big>
+===== End Sequenced DataObject contents =
+Setting of DO property Time[0]=
+===== Sequenced DataObject contents =====
+TEXT ELEMENT:11:41AM ET
+===== End Sequenced DataObject contents =
+Setting of DO property Change[0]=
+===== Sequenced DataObject contents =====
+TEXT ELEMENT:<img width="10" height="14" border="0" src="http://us.i1.yimg.com/us.yimg.com/i/us/fi/03rd/down_r.gif" alt="Down">&nbsp;<b style="color:#cc0000;">0.17 (0.21%)</b>
+===== End Sequenced DataObject contents =
+Setting of DO property PrevClose[0]=
+===== Sequenced DataObject contents =====
+TEXT ELEMENT:82.89
+===== End Sequenced DataObject contents =
+Setting of DO property Open[0]=
+===== Sequenced DataObject contents =====
+TEXT ELEMENT:82.49
+===== End Sequenced DataObject contents =
+Setting of DO property Bid[0]=
+===== Sequenced DataObject contents =====
+TEXT ELEMENT:N/A
+===== End Sequenced DataObject contents =
+Setting of DO property Ask[0]=
+===== Sequenced DataObject contents =====
+TEXT ELEMENT:N/A
+===== End Sequenced DataObject contents =
+Setting of DO property YearTarget[0]=
+===== Sequenced DataObject contents =====
+TEXT ELEMENT:95.94
+===== End Sequenced DataObject contents =
+Setting of DO property DayRange[0]=
+===== Sequenced DataObject contents =====
+TEXT ELEMENT:82.40 - 82.80
+===== End Sequenced DataObject contents =
+Setting of DO property YearRange[0]=
+===== Sequenced DataObject contents =====
+TEXT ELEMENT:72.50 - 89.94
+===== End Sequenced DataObject contents =
+Setting of DO property Volume[0]=
+===== Sequenced DataObject contents =====
+TEXT ELEMENT:1,568,200
+===== End Sequenced DataObject contents =
+Setting of DO property AvgVol[0]=
+===== Sequenced DataObject contents =====
+TEXT ELEMENT:5,301,380
+===== End Sequenced DataObject contents =
+Setting of DO property MarketCap[0]=
+===== Sequenced DataObject contents =====
+TEXT ELEMENT:128.25B
+===== End Sequenced DataObject contents =
+Setting of DO property PE[0]=
+===== Sequenced DataObject contents =====
+TEXT ELEMENT:16.15
+===== End Sequenced DataObject contents =
+Setting of DO property EPS[0]=
+===== Sequenced DataObject contents =====
+TEXT ELEMENT:5.12
+===== End Sequenced DataObject contents =
+Setting of DO property DivYield[0]=
+===== Sequenced DataObject contents =====
+TEXT ELEMENT:1.20 (1.40%)
+===== End Sequenced DataObject contents =
+===== End Sequenced DataObject contents =
+===== End Sequenced DataObject contents =
+===== End Sequenced DataObject contents =
+
+===== End DataObject =====
diff --git a/sdo-cpp/trunk/runtime/core/test/t2/include3.xsd b/sdo-cpp/trunk/runtime/core/test/t2/include3.xsd
new file mode 100644
index 0000000000..c661f6871e
--- /dev/null
+++ b/sdo-cpp/trunk/runtime/core/test/t2/include3.xsd
@@ -0,0 +1,34 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ Licensed to the Apache Software Foundation (ASF) under one
+ or more contributor license agreements. See the NOTICE file
+ distributed with this work for additional information
+ regarding copyright ownership. The ASF licenses this file
+ to you 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.
+-->
+
+ <xsd:schema
+ xmlns:xsd="http://www.w3.org/2001/XMLSchema"
+ xmlns:sdo="commonj.sdo"
+ xmlns:sdoxml="commonj.sdo/xml"
+ xmlns:company="companyNS"
+ targetNamespace="companyNS">
+
+ <xsd:complexType name="EmployeeType">
+ <xsd:attribute name="name" type="xsd:string"/>
+ <xsd:attribute name="SN" type="xsd:ID"/>
+ <xsd:attribute name="manager" type="xsd:boolean"/>
+ </xsd:complexType>
+ </xsd:schema>
+
diff --git a/sdo-cpp/trunk/runtime/core/test/t2/includeother.xsd b/sdo-cpp/trunk/runtime/core/test/t2/includeother.xsd
new file mode 100644
index 0000000000..3332ed6b53
--- /dev/null
+++ b/sdo-cpp/trunk/runtime/core/test/t2/includeother.xsd
@@ -0,0 +1,34 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ Licensed to the Apache Software Foundation (ASF) under one
+ or more contributor license agreements. See the NOTICE file
+ distributed with this work for additional information
+ regarding copyright ownership. The ASF licenses this file
+ to you 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.
+-->
+
+ <xsd:schema
+ xmlns:xsd="http://www.w3.org/2001/XMLSchema"
+ xmlns:sdo="commonj.sdo"
+ xmlns:sdoxml="commonj.sdo/xml"
+ xmlns:company="companyNS"
+ targetNamespace="companyNS">
+
+ <xsd:include schemaLocation = "includeother1.xsd"/>
+ <xsd:include schemaLocation = "./includeother2.xsd"/>
+ <xsd:include schemaLocation = "../Debug/includeother3.xsd"/>
+
+
+ </xsd:schema>
+
diff --git a/sdo-cpp/trunk/runtime/core/test/t2/includeother1.xsd b/sdo-cpp/trunk/runtime/core/test/t2/includeother1.xsd
new file mode 100644
index 0000000000..3023ffaca5
--- /dev/null
+++ b/sdo-cpp/trunk/runtime/core/test/t2/includeother1.xsd
@@ -0,0 +1,38 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ Licensed to the Apache Software Foundation (ASF) under one
+ or more contributor license agreements. See the NOTICE file
+ distributed with this work for additional information
+ regarding copyright ownership. The ASF licenses this file
+ to you 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.
+-->
+
+ <xsd:schema
+ xmlns:xsd="http://www.w3.org/2001/XMLSchema"
+ xmlns:sdo="commonj.sdo"
+ xmlns:sdoxml="commonj.sdo/xml"
+ xmlns:company="companyNS"
+ targetNamespace="companyNS">
+
+ <xsd:element name="company" type="company:CompanyType"/>
+ <xsd:complexType name="CompanyType">
+ <xsd:sequence>
+ <xsd:element name="departments" type="company:DepartmentType" maxOccurs="unbounded"/>
+ </xsd:sequence>
+ <xsd:attribute name="name" type="xsd:string"/>
+ <xsd:attribute name="cs" type="sdo:ChangeSummaryType"/>
+ <xsd:attribute name="employeeOfTheMonth" type="xsd:IDREF" sdoxml:propertyType="company:EmployeeType"/>
+ </xsd:complexType>
+ </xsd:schema>
+
diff --git a/sdo-cpp/trunk/runtime/core/test/t2/includeother2.xsd b/sdo-cpp/trunk/runtime/core/test/t2/includeother2.xsd
new file mode 100644
index 0000000000..5c05afdf36
--- /dev/null
+++ b/sdo-cpp/trunk/runtime/core/test/t2/includeother2.xsd
@@ -0,0 +1,37 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ Licensed to the Apache Software Foundation (ASF) under one
+ or more contributor license agreements. See the NOTICE file
+ distributed with this work for additional information
+ regarding copyright ownership. The ASF licenses this file
+ to you 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.
+-->
+
+ <xsd:schema
+ xmlns:xsd="http://www.w3.org/2001/XMLSchema"
+ xmlns:sdo="commonj.sdo"
+ xmlns:sdoxml="commonj.sdo/xml"
+ xmlns:company="companyNS"
+ targetNamespace="companyNS">
+
+ <xsd:complexType name="DepartmentType">
+ <xsd:sequence>
+ <xsd:element name="employees" type="company:EmployeeType" maxOccurs="unbounded"/>
+ </xsd:sequence>
+ <xsd:attribute name="name" type="xsd:string"/>
+ <xsd:attribute name="location" type="xsd:string"/>
+ <xsd:attribute name="number" type="xsd:int"/>
+ </xsd:complexType>
+ </xsd:schema>
+
diff --git a/sdo-cpp/trunk/runtime/core/test/test/include3.xsd b/sdo-cpp/trunk/runtime/core/test/test/include3.xsd
new file mode 100644
index 0000000000..8b7ca5822b
--- /dev/null
+++ b/sdo-cpp/trunk/runtime/core/test/test/include3.xsd
@@ -0,0 +1,35 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ Licensed to the Apache Software Foundation (ASF) under one
+ or more contributor license agreements. See the NOTICE file
+ distributed with this work for additional information
+ regarding copyright ownership. The ASF licenses this file
+ to you 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.
+-->
+
+
+ <xsd:schema
+ xmlns:xsd="http://www.w3.org/2001/XMLSchema"
+ xmlns:sdo="commonj.sdo"
+ xmlns:sdoxml="commonj.sdo/xml"
+ xmlns:company="companyNS"
+ targetNamespace="companyNS">
+
+ <xsd:complexType name="EmployeeType">
+ <xsd:attribute name="name" type="xsd:string"/>
+ <xsd:attribute name="SN" type="xsd:ID"/>
+ <xsd:attribute name="manager" type="xsd:boolean"/>
+ </xsd:complexType>
+ </xsd:schema>
+
diff --git a/sdo-cpp/trunk/runtime/core/test/test/includeother.xsd b/sdo-cpp/trunk/runtime/core/test/test/includeother.xsd
new file mode 100644
index 0000000000..21f3ff25cb
--- /dev/null
+++ b/sdo-cpp/trunk/runtime/core/test/test/includeother.xsd
@@ -0,0 +1,34 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ Licensed to the Apache Software Foundation (ASF) under one
+ or more contributor license agreements. See the NOTICE file
+ distributed with this work for additional information
+ regarding copyright ownership. The ASF licenses this file
+ to you 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.
+-->
+
+ <xsd:schema
+ xmlns:xsd="http://www.w3.org/2001/XMLSchema"
+ xmlns:sdo="commonj.sdo"
+ xmlns:sdoxml="commonj.sdo/xml"
+ xmlns:company="companyNS"
+ targetNamespace="companyNS">
+
+ <xsd:include schemaLocation = "includeother1.xsd"/>
+ <xsd:include schemaLocation = "./includeother2.xsd"/>
+ <xsd:include schemaLocation = "../test2/includeother3.xsd"/>
+
+
+ </xsd:schema>
+
diff --git a/sdo-cpp/trunk/runtime/core/test/test/includeother1.xsd b/sdo-cpp/trunk/runtime/core/test/test/includeother1.xsd
new file mode 100644
index 0000000000..3023ffaca5
--- /dev/null
+++ b/sdo-cpp/trunk/runtime/core/test/test/includeother1.xsd
@@ -0,0 +1,38 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ Licensed to the Apache Software Foundation (ASF) under one
+ or more contributor license agreements. See the NOTICE file
+ distributed with this work for additional information
+ regarding copyright ownership. The ASF licenses this file
+ to you 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.
+-->
+
+ <xsd:schema
+ xmlns:xsd="http://www.w3.org/2001/XMLSchema"
+ xmlns:sdo="commonj.sdo"
+ xmlns:sdoxml="commonj.sdo/xml"
+ xmlns:company="companyNS"
+ targetNamespace="companyNS">
+
+ <xsd:element name="company" type="company:CompanyType"/>
+ <xsd:complexType name="CompanyType">
+ <xsd:sequence>
+ <xsd:element name="departments" type="company:DepartmentType" maxOccurs="unbounded"/>
+ </xsd:sequence>
+ <xsd:attribute name="name" type="xsd:string"/>
+ <xsd:attribute name="cs" type="sdo:ChangeSummaryType"/>
+ <xsd:attribute name="employeeOfTheMonth" type="xsd:IDREF" sdoxml:propertyType="company:EmployeeType"/>
+ </xsd:complexType>
+ </xsd:schema>
+
diff --git a/sdo-cpp/trunk/runtime/core/test/test/includeother2.xsd b/sdo-cpp/trunk/runtime/core/test/test/includeother2.xsd
new file mode 100644
index 0000000000..5c05afdf36
--- /dev/null
+++ b/sdo-cpp/trunk/runtime/core/test/test/includeother2.xsd
@@ -0,0 +1,37 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ Licensed to the Apache Software Foundation (ASF) under one
+ or more contributor license agreements. See the NOTICE file
+ distributed with this work for additional information
+ regarding copyright ownership. The ASF licenses this file
+ to you 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.
+-->
+
+ <xsd:schema
+ xmlns:xsd="http://www.w3.org/2001/XMLSchema"
+ xmlns:sdo="commonj.sdo"
+ xmlns:sdoxml="commonj.sdo/xml"
+ xmlns:company="companyNS"
+ targetNamespace="companyNS">
+
+ <xsd:complexType name="DepartmentType">
+ <xsd:sequence>
+ <xsd:element name="employees" type="company:EmployeeType" maxOccurs="unbounded"/>
+ </xsd:sequence>
+ <xsd:attribute name="name" type="xsd:string"/>
+ <xsd:attribute name="location" type="xsd:string"/>
+ <xsd:attribute name="number" type="xsd:int"/>
+ </xsd:complexType>
+ </xsd:schema>
+
diff --git a/sdo-cpp/trunk/runtime/core/test/test2/includeother3.xsd b/sdo-cpp/trunk/runtime/core/test/test2/includeother3.xsd
new file mode 100644
index 0000000000..8b7ca5822b
--- /dev/null
+++ b/sdo-cpp/trunk/runtime/core/test/test2/includeother3.xsd
@@ -0,0 +1,35 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ Licensed to the Apache Software Foundation (ASF) under one
+ or more contributor license agreements. See the NOTICE file
+ distributed with this work for additional information
+ regarding copyright ownership. The ASF licenses this file
+ to you 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.
+-->
+
+
+ <xsd:schema
+ xmlns:xsd="http://www.w3.org/2001/XMLSchema"
+ xmlns:sdo="commonj.sdo"
+ xmlns:sdoxml="commonj.sdo/xml"
+ xmlns:company="companyNS"
+ targetNamespace="companyNS">
+
+ <xsd:complexType name="EmployeeType">
+ <xsd:attribute name="name" type="xsd:string"/>
+ <xsd:attribute name="SN" type="xsd:ID"/>
+ <xsd:attribute name="manager" type="xsd:boolean"/>
+ </xsd:complexType>
+ </xsd:schema>
+
diff --git a/sdo-cpp/trunk/runtime/core/test/testabstract.txt b/sdo-cpp/trunk/runtime/core/test/testabstract.txt
new file mode 100644
index 0000000000..80c1d03afe
--- /dev/null
+++ b/sdo-cpp/trunk/runtime/core/test/testabstract.txt
@@ -0,0 +1,5 @@
+Normal unsupportedoperation for creation of abstract type
+Publication is of type BookType
+Publication is of type MagazineType
+Book is of type BookType
+Magazine is of type MagazineType
diff --git a/sdo-cpp/trunk/runtime/core/test/testerrors.txt b/sdo-cpp/trunk/runtime/core/test/testerrors.txt
new file mode 100644
index 0000000000..fcecdf5bde
--- /dev/null
+++ b/sdo-cpp/trunk/runtime/core/test/testerrors.txt
@@ -0,0 +1,5 @@
+XSD reported some errors:
+Opening and ending tag mismatch: complexType line 44 and schema
+
+Premature end of data in tag schema line 22
+
diff --git a/sdo-cpp/trunk/runtime/core/test/testinc2.txt b/sdo-cpp/trunk/runtime/core/test/testinc2.txt
new file mode 100644
index 0000000000..837559562e
--- /dev/null
+++ b/sdo-cpp/trunk/runtime/core/test/testinc2.txt
@@ -0,0 +1,21 @@
+Type:commonj.sdo#BigDecimal
+Type:commonj.sdo#BigInteger
+Type:commonj.sdo#Boolean
+Type:commonj.sdo#Byte
+Type:commonj.sdo#Bytes
+Type:commonj.sdo#ChangeSummary
+Type:commonj.sdo#Character
+Type:commonj.sdo#DataObject
+Type:commonj.sdo#Date
+Type:commonj.sdo#Double
+Type:commonj.sdo#Float
+Type:commonj.sdo#Integer
+Type:commonj.sdo#Long
+Type:commonj.sdo#Short
+Type:commonj.sdo#String
+Type:commonj.sdo#URI
+Type:http://example.org/Calculator#RootType
+Type:http://example.org/CalculatorTypes#AddArguments
+Property:a
+Property:b
+Type:http://example.org/CalculatorTypes#RootType
diff --git a/sdo-cpp/trunk/runtime/core/test/testopen.txt b/sdo-cpp/trunk/runtime/core/test/testopen.txt
new file mode 100644
index 0000000000..f1eef1ab5e
--- /dev/null
+++ b/sdo-cpp/trunk/runtime/core/test/testopen.txt
@@ -0,0 +1,24 @@
+Normal exception for setting null on undefined prop
+Open Type string value: Value Of Open String
+Open Type boolean value: 1
+EMP1 type property: name ( many? 0) of type String
+EMP1 type property: SN ( many? 0) of type String
+EMP1 type property: manager ( many? 0) of type Boolean
+EMP1 inst property: name (many? 0) of type String
+EMP1 inst property: SN (many? 0) of type String
+EMP1 inst property: manager (many? 0) of type Boolean
+EMP1 inst property: openstring (many? 0) of type String
+EMP1 inst property: openboolean (many? 0) of type Boolean
+EMP1 inst property: opentypelist (many? 1) of type Short
+EMP1 inst property: name (many? 0) of type String
+EMP1 inst property: SN (many? 0) of type String
+EMP1 inst property: manager (many? 0) of type Boolean
+EMP1 inst property: openboolean (many? 0) of type Boolean
+EMP1 inst property: opentypelist (many? 1) of type Short
+EMP1 inst property: name (many? 0) of type String
+EMP1 inst property: SN (many? 0) of type String
+EMP1 inst property: manager (many? 0) of type Boolean
+EMP1 inst property: opentypelist (many? 1) of type Short
+EMP1 inst property: name (many? 0) of type String
+EMP1 inst property: SN (many? 0) of type String
+EMP1 inst property: manager (many? 0) of type Boolean
diff --git a/sdo-cpp/trunk/runtime/core/test/testopen3.xml b/sdo-cpp/trunk/runtime/core/test/testopen3.xml
new file mode 100644
index 0000000000..b16a75802e
--- /dev/null
+++ b/sdo-cpp/trunk/runtime/core/test/testopen3.xml
@@ -0,0 +1,21 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ Licensed to the Apache Software Foundation (ASF) under one
+ or more contributor license agreements. See the NOTICE file
+ distributed with this work for additional information
+ regarding copyright ownership. The ASF licenses this file
+ to you 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.
+-->
+
+<xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:sdo="commonj.sdo" xmlns:sdoxml="commonj.sdo/xml" xmlns:tns="companyNS" targetNamespace="companyNS"><xsd:element name="companyType" type="tns:CompanyType"/><xsd:complexType name="CompanyType" sdo:aliasName="TheFirm TheBigFirm"><xsd:sequence><xsd:element name="departments" type="tns:DepartmentType" minOccurs="0" maxOccurs="unbounded" sdo:aliasName="TheDepartments MYDepartments"/></xsd:sequence><xsd:element name="changeSummary" type="sdo:ChangeSummaryType"/><xsd:attribute name="name" type="xsd:String"/><xsd:attribute name="employeeOfTheMonth" sdoxml:propertyType="tns:EmployeeType" type="xsd:anyURI"/></xsd:complexType><xsd:element name="departmentType" type="tns:DepartmentType"/><xsd:complexType name="DepartmentType"><xsd:sequence><xsd:element name="employees" type="tns:EmployeeType" minOccurs="0" maxOccurs="unbounded"/></xsd:sequence><xsd:attribute name="name" type="xsd:String"/><xsd:attribute name="location" type="xsd:String"/><xsd:attribute name="number" type="xsd:String"/></xsd:complexType><xsd:element name="employeeType" type="tns:EmployeeType"/><xsd:complexType name="EmployeeType"><xsd:attribute name="name" type="xsd:String"/><xsd:attribute name="SN" type="xsd:String"/><xsd:attribute name="manager" type="xsd:boolean"/><xsd:any namespace="##other" processContents="lax" minOccurs="0" maxOccurs="unbounded"/><xsd:anyAttribute namespace="##any" processContents="lax"/></xsd:complexType><xsd:element name="openType" type="tns:OpenType"/><xsd:complexType name="OpenType"><xsd:attribute name="name" type="xsd:String"/></xsd:complexType><xsd:attribute name="openboolean" type="xsd:boolean"/><xsd:element name="opendataobject" type="tns:OpenType" minOccurs="0"/><xsd:element name="opendataobjectlist" type="tns:OpenType" minOccurs="0" maxOccurs="unbounded"/><xsd:element name="openintlist" type="xsd:short" minOccurs="0" maxOccurs="unbounded"/><xsd:attribute name="openstring" type="xsd:hexBinary"/></xsd:schema> \ No newline at end of file
diff --git a/sdo-cpp/trunk/runtime/core/test/testorder.txt b/sdo-cpp/trunk/runtime/core/test/testorder.txt
new file mode 100644
index 0000000000..4f46cbfecf
--- /dev/null
+++ b/sdo-cpp/trunk/runtime/core/test/testorder.txt
@@ -0,0 +1,19 @@
+Type:#Address
+Property:name
+Property:street
+Property:city
+Type:#RootType
+Property:employee
+Type:#UKAddress
+Property:value
+Property:postcode
+Type:#USAddress
+Property:value
+Property:zip
+Type:#fullpersoninfo
+Property:address
+Property:city
+Property:country
+Type:#personinfo
+Property:firstname
+Property:lastname
diff --git a/sdo-cpp/trunk/runtime/core/test/teststyles.txt b/sdo-cpp/trunk/runtime/core/test/teststyles.txt
new file mode 100644
index 0000000000..d1434a2cb0
--- /dev/null
+++ b/sdo-cpp/trunk/runtime/core/test/teststyles.txt
@@ -0,0 +1,93 @@
+*****STYLE Style1.xsd
+Type: commonj.sdo#Boolean
+Type: commonj.sdo#Byte
+Type: commonj.sdo#Bytes
+Type: commonj.sdo#ChangeSummary
+Type: commonj.sdo#Character
+Type: commonj.sdo#DataObject
+Type: commonj.sdo#Date
+Type: commonj.sdo#Decimal
+Type: commonj.sdo#Double
+Type: commonj.sdo#Float
+Type: commonj.sdo#Int
+Type: commonj.sdo#Integer
+Type: commonj.sdo#Long
+Type: commonj.sdo#OpenDataObject
+Type: commonj.sdo#Short
+Type: commonj.sdo#String
+Type: commonj.sdo#URI
+Type: libraryNS#RootType
+Type: libraryNS#author
+Type: libraryNS#available
+Type: libraryNS#book
+Type: libraryNS#character
+Type: libraryNS#isbn
+Type: libraryNS#library
+Property:book
+Type: libraryNS#title
+*************
+Root is:libraryNS#character
+Root is:libraryNS#library
+Root is:libraryNS#library
+*****STYLE Style2.xsd
+Type: commonj.sdo#Boolean
+Type: commonj.sdo#Byte
+Type: commonj.sdo#Bytes
+Type: commonj.sdo#ChangeSummary
+Type: commonj.sdo#Character
+Type: commonj.sdo#DataObject
+Type: commonj.sdo#Date
+Type: commonj.sdo#Decimal
+Type: commonj.sdo#Double
+Type: commonj.sdo#Float
+Type: commonj.sdo#Int
+Type: commonj.sdo#Integer
+Type: commonj.sdo#Long
+Type: commonj.sdo#OpenDataObject
+Type: commonj.sdo#Short
+Type: commonj.sdo#String
+Type: commonj.sdo#URI
+Type: libraryNS#RootType
+Type: libraryNS#author
+Type: libraryNS#available
+Type: libraryNS#book
+Type: libraryNS#character
+Type: libraryNS#isbn
+Type: libraryNS#library
+Property:book
+Type: libraryNS#title
+*************
+Root is:libraryNS#character
+Root is:libraryNS#library
+Root is:libraryNS#library
+*****STYLE Style3.xsd
+Type: commonj.sdo#Boolean
+Type: commonj.sdo#Byte
+Type: commonj.sdo#Bytes
+Type: commonj.sdo#ChangeSummary
+Type: commonj.sdo#Character
+Type: commonj.sdo#DataObject
+Type: commonj.sdo#Date
+Type: commonj.sdo#Decimal
+Type: commonj.sdo#Double
+Type: commonj.sdo#Float
+Type: commonj.sdo#Int
+Type: commonj.sdo#Integer
+Type: commonj.sdo#Long
+Type: commonj.sdo#OpenDataObject
+Type: commonj.sdo#Short
+Type: commonj.sdo#String
+Type: commonj.sdo#URI
+Type: libraryNS#RootType
+Type: libraryNS#author
+Type: libraryNS#available
+Type: libraryNS#bookType
+Type: libraryNS#character
+Type: libraryNS#isbn
+Type: libraryNS#library
+Property:book
+Type: libraryNS#title
+*************
+Root is:libraryNS#character
+Root is:libraryNS#library
+Root is:libraryNS#library
diff --git a/sdo-cpp/trunk/runtime/core/test/testsubsload.txt b/sdo-cpp/trunk/runtime/core/test/testsubsload.txt
new file mode 100644
index 0000000000..43c16114c3
--- /dev/null
+++ b/sdo-cpp/trunk/runtime/core/test/testsubsload.txt
@@ -0,0 +1,7 @@
+TEST: TestSubsLoad ==========================================
+Publication is of type PublicationType
+Publication is of type BookType
+Publication is of type MagazineType
+Book is of type BookType
+Magazine is of type MagazineType
+END TEST: TestSubsLoad ======================================
diff --git a/sdo-cpp/trunk/runtime/core/test/testutils.txt b/sdo-cpp/trunk/runtime/core/test/testutils.txt
new file mode 100644
index 0000000000..909f91bda8
--- /dev/null
+++ b/sdo-cpp/trunk/runtime/core/test/testutils.txt
@@ -0,0 +1,100 @@
+>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>> start of DO
+DataObject type: companyNS#CompanyType
+ Property: name
+ Property Type: commonj.sdo#String
+ Property Value: ACME
+ Property: employeeOfTheMonth
+ Property Type: companyNS#EmployeeType
+ Property Value: not set
+ Property: departments
+ Property Type: companyNS#DepartmentType
+ Value 0
+>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>> start of DO
+ DataObject type: companyNS#DepartmentType
+ Property: name
+ Property Type: commonj.sdo#String
+ Property Value: Advanced Technologies
+ Property: location
+ Property Type: commonj.sdo#String
+ Property Value: NY
+ Property: number
+ Property Type: commonj.sdo#String
+ Property Value: 123
+ Property: employees
+ Property Type: companyNS#EmployeeType
+ Value 0
+>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>> start of DO
+ DataObject type: companyNS#EmployeeType
+ Property: name
+ Property Type: commonj.sdo#String
+ Property Value: Albert
+ Property: SN
+ Property Type: commonj.sdo#String
+ Property Value: E0001
+ Property: manager
+ Property Type: commonj.sdo#Boolean
+ Property Value: not set
+ Property: openstring
+ Property Type: commonj.sdo#String
+ Property Value: Value Of Open String
+ Property: openboolean
+ Property Type: commonj.sdo#Boolean
+ Property Value: true
+ Property: openintlist
+ Property Type: commonj.sdo#Short
+ Value 0
+>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>> start of DO
+ DataObject type: commonj.sdo#Short
+<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<< end of do
+
+ Property: opendataobjectlist
+ Property Type: companyNS#OpenType
+ Value 0
+>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>> start of DO
+ DataObject type: companyNS#OpenType
+ Property: name
+ Property Type: commonj.sdo#String
+ Property Value: MyOpenName
+<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<< end of do
+
+ Property: opendataobject
+ Property Type: companyNS#OpenType
+>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>> start of DO
+ DataObject type: companyNS#OpenType
+ Property: name
+ Property Type: commonj.sdo#String
+ Property Value: MyOpenName
+<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<< end of do
+<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<< end of do
+
+ Value 1
+>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>> start of DO
+ DataObject type: companyNS#EmployeeType
+ Property: name
+ Property Type: commonj.sdo#String
+ Property Value: Boris
+ Property: SN
+ Property Type: commonj.sdo#String
+ Property Value: E0002
+ Property: manager
+ Property Type: commonj.sdo#Boolean
+ Property Value: true
+<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<< end of do
+
+ Value 2
+>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>> start of DO
+ DataObject type: companyNS#EmployeeType
+ Property: name
+ Property Type: commonj.sdo#String
+ Property Value: Carl
+ Property: SN
+ Property Type: commonj.sdo#String
+ Property Value: E0003
+ Property: manager
+ Property Type: commonj.sdo#Boolean
+ Property Value: not set
+<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<< end of do
+
+<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<< end of do
+
+<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<< end of do
diff --git a/sdo-cpp/trunk/runtime/core/test/testwsdl.txt b/sdo-cpp/trunk/runtime/core/test/testwsdl.txt
new file mode 100644
index 0000000000..025b797d96
--- /dev/null
+++ b/sdo-cpp/trunk/runtime/core/test/testwsdl.txt
@@ -0,0 +1,2 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<definitions xmlns="http://schemas.xmlsoap.org/wsdl/" xsi:type="tDefinitions" xmlns:tns2="http://I want/this/added/to/the/urls" xmlns:tns="http://schemas.xmlsoap.org/wsdl/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"><message name="testRequest"><part name="name" type="xsi:string"/><part name="name" type="tns2:string"/></message></definitions>
diff --git a/sdo-cpp/trunk/runtime/core/test/testwsdl.xml b/sdo-cpp/trunk/runtime/core/test/testwsdl.xml
new file mode 100644
index 0000000000..47f983d51e
--- /dev/null
+++ b/sdo-cpp/trunk/runtime/core/test/testwsdl.xml
@@ -0,0 +1,22 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ Licensed to the Apache Software Foundation (ASF) under one
+ or more contributor license agreements. See the NOTICE file
+ distributed with this work for additional information
+ regarding copyright ownership. The ASF licenses this file
+ to you 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.
+-->
+
+
+<definitions xmlns="http://schemas.xmlsoap.org/wsdl/" xsi:type="tDefinitions" xmlns:tns2="http://I want/this/added/to/the/urls" xmlns:tns="http://schemas.xmlsoap.org/wsdl/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"><message name="testRequest"><part name="name" type="xsi:string"/><part name="name" type="tns2:string"/></message></definitions>
diff --git a/sdo-cpp/trunk/runtime/core/test/travel.txt b/sdo-cpp/trunk/runtime/core/test/travel.txt
new file mode 100644
index 0000000000..a26f770bc9
--- /dev/null
+++ b/sdo-cpp/trunk/runtime/core/test/travel.txt
@@ -0,0 +1,146 @@
+*******************************TYPES**********************
+TYPE:#Client
+TYPE:#Excursion
+TYPE:#Flight
+TYPE:#Holiday
+TYPE:#Hotel
+TYPE:#Party
+TYPE:#Person
+TYPE:#Room
+TYPE:#RootType
+TYPE:commonj.sdo#Boolean
+TYPE:commonj.sdo#Byte
+TYPE:commonj.sdo#Bytes
+TYPE:commonj.sdo#ChangeSummary
+TYPE:commonj.sdo#Character
+TYPE:commonj.sdo#DataObject
+TYPE:commonj.sdo#Date
+TYPE:commonj.sdo#Decimal
+TYPE:commonj.sdo#Double
+TYPE:commonj.sdo#Float
+TYPE:commonj.sdo#Int
+TYPE:commonj.sdo#Integer
+TYPE:commonj.sdo#Long
+TYPE:commonj.sdo#OpenDataObject
+TYPE:commonj.sdo#Short
+TYPE:commonj.sdo#String
+TYPE:commonj.sdo#URI
+*******************************END TYPES******************
+*******************************DATA**********************
+===== DataObject contents =====
+Flight: list dataObject[0]=
+===== DataObject contents =====
+Departure:string:LHR
+
+Arrival:string:SNG
+
+flightNo:string:BA243
+
+===== End DataObject =====
+
+dataObject[1]=
+===== DataObject contents =====
+Departure:string:SNG
+
+Arrival:string:LHR
+
+flightNo:string:SG561
+
+===== End DataObject =====
+
+Hotel: list dataObject[0]=
+===== DataObject contents =====
+Name:string:Excelsior
+
+Phone:string:222-3333
+
+Room:dataObject
+===== DataObject contents =====
+value:string:303
+
+booked:boolean:1
+
+===== End DataObject =====
+
+cardsAccepted:boolean:1
+
+===== End DataObject =====
+
+dataObject[1]=
+===== DataObject contents =====
+Name:string:Seedy Lodge
+
+Phone:string:888-9999
+
+Room:dataObject
+===== DataObject contents =====
+value:string:14
+
+booked:boolean:1
+
+===== End DataObject =====
+
+cardsAccepted:boolean:0
+
+===== End DataObject =====
+
+dataObject[2]=
+===== DataObject contents =====
+Name:string:Hilton
+
+Phone:string:444-5555
+
+Room:dataObject
+===== DataObject contents =====
+value:string:456
+
+booked:boolean:0
+
+===== End DataObject =====
+
+cardsAccepted:boolean:1
+
+===== End DataObject =====
+
+Excursion:dataObject
+===== DataObject contents =====
+Title:string:Bird Baths of Singapore
+
+Cost:string:50
+
+===== End DataObject =====
+
+Client:dataObject
+===== DataObject contents =====
+Name:string:Steve
+
+Address:string:134 Shirley Road
+
+CreditCard:string:1234-8908-6543-900
+
+===== End DataObject =====
+
+Party:dataObject
+===== DataObject contents =====
+Person: list dataObject[0]=
+===== DataObject contents =====
+Name:string:John
+
+===== End DataObject =====
+
+dataObject[1]=
+===== DataObject contents =====
+Name:string:Jane
+
+===== End DataObject =====
+
+dataObject[2]=
+===== DataObject contents =====
+Name:string:Bill
+
+===== End DataObject =====
+
+===== End DataObject =====
+
+===== End DataObject =====
+***************************END DATA**********************
diff --git a/sdo-cpp/trunk/runtime/core/test/tuscany963.out.xml.txt b/sdo-cpp/trunk/runtime/core/test/tuscany963.out.xml.txt
new file mode 100644
index 0000000000..55bad5b09a
--- /dev/null
+++ b/sdo-cpp/trunk/runtime/core/test/tuscany963.out.xml.txt
@@ -0,0 +1,2 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<tns:content xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:tns="http://www.w3.org/2005/Atom" base="blah" lang="blah2"/>
diff --git a/sdo-cpp/trunk/runtime/core/test/tuscany963.xml b/sdo-cpp/trunk/runtime/core/test/tuscany963.xml
new file mode 100644
index 0000000000..10b9ecd966
--- /dev/null
+++ b/sdo-cpp/trunk/runtime/core/test/tuscany963.xml
@@ -0,0 +1,21 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ Licensed to the Apache Software Foundation (ASF) under one
+ or more contributor license agreements. See the NOTICE file
+ distributed with this work for additional information
+ regarding copyright ownership. The ASF licenses this file
+ to you 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.
+-->
+<content xmlns="http://www.w3.org/2005/Atom" xmlns:tns="http://www.w3.org/2005/Atom"
+xml:base="blah" xml:lang="blah2" />
diff --git a/sdo-cpp/trunk/runtime/core/test/tuscany963.xsd b/sdo-cpp/trunk/runtime/core/test/tuscany963.xsd
new file mode 100644
index 0000000000..0cb28ca207
--- /dev/null
+++ b/sdo-cpp/trunk/runtime/core/test/tuscany963.xsd
@@ -0,0 +1,44 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ Licensed to the Apache Software Foundation (ASF) under one
+ or more contributor license agreements. See the NOTICE file
+ distributed with this work for additional information
+ regarding copyright ownership. The ASF licenses this file
+ to you 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.
+-->
+
+<xs:schema targetNamespace="http://www.w3.org/2005/Atom"
+xmlns="http://www.w3.org/2005/Atom" xmlns:xs="http://www.w3.org/2001/XMLSchema">
+
+<xs:import namespace="http://www.w3.org/XML/1998/namespace" schemaLocation="xml.xsd" />
+<xs:import namespace="http://www.w3.org/1999/xhtml" schemaLocation="xhtml1-strict.xsd" />
+
+<xs:element name="content" type="contentType" minOccurs="0" />
+
+<xs:complexType name="contentType" mixed="true" >
+<xs:sequence>
+<xs:any namespace="##other" processContents="lax" minOccurs="0" maxOccurs="unbounded" />
+</xs:sequence>
+<xs:attribute name="type" type="xs:string" default="text" />
+<xs:attribute name="src" type="xs:string" /> <!-- uriType -->
+<xs:attributeGroup ref="commonAttributes"/>
+</xs:complexType>
+
+<xs:attributeGroup name="commonAttributes">
+<xs:attribute ref="xml:base" />
+<xs:attribute ref="xml:lang" />
+<xs:anyAttribute/>
+</xs:attributeGroup>
+
+</xs:schema> \ No newline at end of file
diff --git a/sdo-cpp/trunk/runtime/core/test/types.xsd b/sdo-cpp/trunk/runtime/core/test/types.xsd
new file mode 100644
index 0000000000..efcfab7b06
--- /dev/null
+++ b/sdo-cpp/trunk/runtime/core/test/types.xsd
@@ -0,0 +1,34 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ Licensed to the Apache Software Foundation (ASF) under one
+ or more contributor license agreements. See the NOTICE file
+ distributed with this work for additional information
+ regarding copyright ownership. The ASF licenses this file
+ to you 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.
+-->
+<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema"
+ xmlns:ns0="http://www.test.com/info"
+ targetNamespace="http://Component">
+ <xs:import schemaLocation="person.xsd"
+namespace="http://www.test.com/info"/>
+ <xs:element name="add">
+ <xs:complexType>
+ <xs:sequence>
+ <xs:element name="person" type="ns0:personType"
+ nillable="true"/>
+ </xs:sequence>
+ </xs:complexType>
+ </xs:element>
+</xs:schema>
+
diff --git a/sdo-cpp/trunk/runtime/core/test/userdata.txt b/sdo-cpp/trunk/runtime/core/test/userdata.txt
new file mode 100644
index 0000000000..e24caba194
--- /dev/null
+++ b/sdo-cpp/trunk/runtime/core/test/userdata.txt
@@ -0,0 +1,10 @@
+Expected 0xF1F1F1F1 F1F1F1F1
+Expected 0xF1F1F1F1 F1F1F1F1
+Expected 0x20 00000020
+Expected 0x40020 00040020
+Expected 0 00000000
+Expected 0 00000000
+Expected 120 00000120
+Expected 0 00000000
+Expected 640 00000640
+Expected 0x740 00000740
diff --git a/sdo-cpp/trunk/runtime/core/test/utils.cpp b/sdo-cpp/trunk/runtime/core/test/utils.cpp
new file mode 100644
index 0000000000..e171d389f3
--- /dev/null
+++ b/sdo-cpp/trunk/runtime/core/test/utils.cpp
@@ -0,0 +1,551 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you 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$ */
+
+#include <stdio.h>
+
+#pragma warning(disable:4786)
+
+#include <iostream>
+using namespace std;
+
+#include "sdotest.h"
+#include "commonj/sdo/DataObjectImpl.h"
+
+bool sdotest::silent = true;
+bool sdotest::ramping = false;
+
+void sdotest::printOldValues(FILE *f, ChangeSummaryPtr cs, DataObjectPtr dol)
+{
+ fprintf(f,"===== Old Property Values Begin\n");
+ SettingList& sl = cs->getOldValues(dol);
+ if (sl.size() == 0)
+ {
+ fprintf(f,"No Settings found\n");
+ }
+ else
+ {
+ for (int j=0;j< sl.size(); j++)
+ {
+ fprintf(f,"Property %s",sl[j].getProperty().getName());
+ // this could be a many-valued property, and could be one which is
+ // a data object or a data type...
+ if (sl[j].getProperty().isMany())
+ {
+ fprintf(f,"[%d]",sl[j].getIndex());
+ }
+ if (!sl[j].isSet())
+ {
+ fprintf(f,"(UNSET)");
+ }
+ if (sl[j].isNull())
+ {
+ fprintf(f,"(ISNULL)");
+ }
+
+ fprintf(f," of type ");
+ switch (sl[j].getProperty().getTypeEnum())
+ {
+ case Type::BooleanType:
+ fprintf(f,"Boolean:%d\n",sl[j].getBooleanValue());
+ break;
+ case Type::ByteType:
+ fprintf(f,"Byte:%d\n",sl[j].getByteValue());
+ break;
+ case Type::CharacterType:
+ fprintf(f,"Character:%d\n",sl[j].getCharacterValue());
+ break;
+ case Type::IntType:
+ fprintf(f,"Int:%d\n",sl[j].getIntValue());
+ break;
+ case Type::ShortType:
+ fprintf(f,"Short:%d\n",sl[j].getShortValue());
+ break;
+ case Type::DoubleType:
+ fprintf(f,"Double:%.3f\n",(float)sl[j].getDoubleValue());
+ break;
+ case Type::FloatType:
+ fprintf(f,"Float:%.3f\n",sl[j].getFloatValue());
+ break;
+ case Type::LongType:
+ fprintf(f,"Long:%ld\n",sl[j].getIntValue());
+ break;
+ case Type::DateType:
+ fprintf(f,"Date:%d\n",sl[j].getDateValue().getTime());
+ break;
+ case Type::BigDecimalType:
+ case Type::BigIntegerType:
+ case Type::StringType:
+ case Type::UriType:
+ fprintf(f,"String:%s\n",sl[j].getCStringValue());
+ break;
+ case Type::BytesType:
+ fprintf(f,"Bytes:%s\n",sl[j].getCStringValue());
+ break;
+ case Type::OtherTypes:
+ case Type::DataObjectType:
+ case Type::ChangeSummaryType:
+ {
+ fprintf(f,"DataObject ");
+ DataObjectPtr dob = sl[j].getDataObjectValue();
+ if (!dob)
+ {
+ fprintf(f," - object null or unset\n");
+ }
+ else
+ {
+ DataObjectPtr mydo = sl[j].getDataObjectValue();
+ if (cs->isDeleted(mydo))
+ {
+ fprintf(f," - object deleted \n");
+ printOldValues(f, cs,mydo);
+ }
+ else
+ {
+ fprintf(f," object still exists \n");
+ }
+ }
+ }
+ break;
+ default:
+ {
+ fprintf(f,"Unknown object type\n");
+ }
+ break;
+ }
+ fprintf(f,"\n");
+ }
+ }
+ fprintf(f,"===== Old Property Values End \n");
+ return;
+}
+
+
+void sdotest::printDataStructure(FILE *f , DataFactoryPtr dd)
+{
+ TypeList tt = dd->getTypes();
+ fprintf(f,"Printing Types\n");
+ for (unsigned int i = 0; i < tt.size(); ++i)
+ {
+ fprintf(f,"Type %s\n",tt[i].getName());
+ PropertyList pl = tt[i].getProperties();
+ for (unsigned int j = 0; j < pl.size() ; j++)
+ {
+ fprintf(f,"Has Property %s of type %s\n",
+ pl[j].getName(),pl[j].getType().getName());
+ }
+ }
+}
+
+
+void sdotest::printValue(FILE *f, DataObjectPtr dp, const Property& p)
+{
+ switch (p.getTypeEnum())
+ {
+ case Type::BooleanType:
+ fprintf(f,"boolean:%d\n",dp->getBoolean(p));
+ break;
+ case Type::ByteType:
+ fprintf(f,"Byte:%d\n",dp->getByte(p));
+ break;
+ case Type::CharacterType:
+ fprintf(f,"character:%d\n",dp->getCharacter(p));
+ break;
+ case Type::IntType:
+ fprintf(f,"int:%d\n",dp->getInt(p));
+ break;
+ case Type::ShortType:
+ fprintf(f,"short:%d\n",dp->getShort(p));
+ break;
+ case Type::DoubleType:
+ fprintf(f,"double:%.3f\n",(float)dp->getDouble(p));
+ break;
+ case Type::FloatType:
+ fprintf(f,"float:%.3f\n", dp->getFloat(p));
+ break;
+ case Type::LongType:
+ fprintf(f,"long:%ld\n",dp->getInt(p));
+ break;
+ case Type::DateType:
+ fprintf(f,"date:%d\n",dp->getDate(p).getTime());
+ break;
+ case Type::BigDecimalType:
+ case Type::BigIntegerType:
+ case Type::StringType:
+ case Type::UriType:
+ fprintf(f,"string:%s\n", dp->getCString(p));
+ break;
+ case Type::BytesType:
+ fprintf(f,"bytes:%s\n",dp->getCString(p));
+ break;
+ case Type::DataObjectType:
+ {
+ fprintf(f,"dataObject\n" );
+ DataObjectPtr dob = dp->getDataObject(p);
+ if (!dob)
+ {
+ fprintf(f," - null or unset\n");
+ }
+ else
+ {
+ printDataObject(f, dob);
+ }
+ }
+ break;
+ case Type::OtherTypes:
+ case Type::ChangeSummaryType:
+ default:
+ {
+ fprintf(f,"Unknown object type");
+ }
+ break;
+ }
+ fprintf(f,"\n");
+}
+
+void sdotest::printList(FILE *f, DataObjectPtr dp, const Property& p)
+{
+ DataObjectList& dobl = dp->getList(p);
+ fprintf(f," list ");
+
+ if (dobl.size() ==0) {
+ fprintf(f,"(empty)\n");
+ return;
+ }
+
+ for (unsigned int i=0;i<dobl.size();i++) {
+
+ switch (p.getTypeEnum())
+ {
+ case Type::BooleanType:
+ fprintf(f,"boolean[%d]=%d\n",i,dobl.getBoolean(i));
+ break;
+ case Type::ByteType:
+ fprintf(f,"byte[%d]=%d\n",i,dobl.getByte(i));
+ break;
+ case Type::CharacterType:
+ fprintf(f,"character[%d]=%d\n",i,dobl.getCharacter(i));
+ break;
+ case Type::IntType:
+ fprintf(f,"int[%d]=%d\n",i,dobl.getInt(i));
+ break;
+ case Type::ShortType:
+ fprintf(f,"short[%d]=%d",i, dobl.getShort(i));
+ break;
+ case Type::DoubleType:
+ fprintf(f,"double[%d]=%.3f\n",i,(float)dobl.getDouble(i));
+ break;
+ case Type::FloatType:
+ fprintf(f,"float[%d]=%.3f\n",i,dobl.getFloat(i));
+ break;
+ case Type::LongType:
+ fprintf(f,"long[%d]=%ld\n",i,dobl.getInt(i));
+ break;
+ case Type::DateType:
+ fprintf(f,"date[%d]=%d\n",i,dobl.getDate(i).getTime());
+ break;
+ case Type::BigDecimalType:
+ case Type::BigIntegerType:
+ case Type::StringType:
+ case Type::UriType:
+ fprintf(f,"string[%d]=%s\n",i,dobl.getCString(i));
+ break;
+ case Type::BytesType:
+ fprintf(f,"bytes[%d]=%s\n",i,dobl.getCString(i));
+ break;
+ case Type::DataObjectType:
+ {
+ fprintf(f,"dataObject[%d]=\n",i);
+ DataObjectPtr dob = dobl[i];
+ if (!dob)
+ {
+ fprintf(f," null or unset\n");
+ }
+ else
+ {
+ printDataObject(f, dob);
+ }
+ }
+ break;
+ case Type::OtherTypes:
+ case Type::ChangeSummaryType:
+ default:
+ {
+ fprintf(f,"Unknown object type\n");;
+ }
+ break;
+ }
+ fprintf(f,"\n");
+ }
+}
+
+void sdotest::printDataObject(FILE *f, DataObjectPtr dol)
+{
+ if (dol == 0) return;
+
+ if (dol->getType().isSequencedType())
+ {
+ fprintf(f,"===== Sequenced DataObject contents =====\n");
+ SequencePtr sq = dol->getSequence();
+ if (sq != 0)
+ {
+ for (unsigned int k=0;k<sq->size();k++)
+ {
+ if (sq->isText(k))
+ {
+ fprintf(f,"TEXT ELEMENT:%s\n",sq->getCStringValue(k));
+ }
+ else
+ {
+ const Property& p = sq->getProperty(k);
+ if (p.isMany())
+ {
+ unsigned int index = sq->getListIndex(k);
+ DataObjectList& dl = dol->getList(p);
+ if (p.getType().isDataType())
+ {
+ fprintf(f,"Setting of property %s[%d]=%s\n",
+ p.getName(),index,dl.getCString(index));
+ }
+ else
+ {
+ fprintf(f,"Setting of DO property %s[%d]=\n",
+ p.getName(),index);
+ printDataObject(f,dl.getDataObject(index));
+ }
+ }
+ else
+ {
+ if (p.getType().isDataType())
+ {
+ fprintf(f,"Setting of property %s=%s\n",
+ p.getName(),dol->getCString(p));
+ }
+ else
+ {
+ fprintf(f,"Setting of DO property %s=\n",
+ p.getName());
+ printDataObject(f,dol->getDataObject(p));
+ }
+ }
+ }
+ }
+ }
+ fprintf(f,"===== End Sequenced DataObject contents =\n");
+ }
+ else
+ {
+ fprintf(f,"===== DataObject contents =====\n");
+ PropertyList pl = dol->getInstanceProperties();
+
+ for (unsigned int j=0;j< pl.size(); j++)
+ {
+ fprintf(f,"%s:",pl[j].getName());
+ // this could be a many-valued property, and could be one which is
+ // a data object or a data type...
+ if (pl[j].isMany())
+ {
+ printList(f, dol,pl[j]);
+ }
+ else {
+ printValue(f, dol,pl[j]);
+ }
+ }
+ fprintf(f,"===== End DataObject =====\n");
+ }
+}
+
+
+
+void sdotest::dumpchangesummary(FILE *f, ChangeSummaryPtr cs)
+{
+
+ ChangedDataObjectList& cdol = cs->getChangedDataObjects();
+
+ // the changed data object list contains only the objects whose properties have
+ // been changed.
+ // a changed and subsequently deleted object will not appear, but necessarily its
+ // container will appear, so we can rebuild it.
+
+ for (unsigned int i=0;i< cdol.size();i++)
+ {
+ if (cs->isCreated(cdol[i]))
+ {
+ fprintf(f,"Created object in changed list\n");
+ // So its in the created list, it must exist in the tree...
+ fprintf(f,"The object is %s#%s\n",
+ cdol[i]->getType().getURI(),
+ cdol[i]->getType().getName());
+ }
+ if (cs->isModified(cdol[i]))
+ {
+ fprintf(f,"===== Modified Object Starts\n");
+ // get to a DAS data object...
+ fprintf(f,"Xpath:%s\n",staticCast<DataObjectImplPtr>(cdol[i])->objectToXPath());
+
+ if (cs->isDeleted(cdol[i]))
+ {
+ fprintf(f,"PROBLEM: DELETED OBJECT IN CHANGED LIST: \n");
+ // As the item is in the deleted list - its still present..
+ fprintf(f,"The type is %s#%s\n",
+ cdol[i]->getType().getURI(),
+ cdol[i]->getType().getName());
+ }
+ else {
+ fprintf(f,"The modified objects type is %s#%s\n",
+ cdol[i]->getType().getURI(),
+ cdol[i]->getType().getName());
+
+ printOldValues(f, cs, cdol[i]);
+ }
+ fprintf(f,"=====Modified Object Ends \n");
+ }
+ if (cs->isDeleted(cdol[i]))
+ {
+ fprintf(f,"=====Deleted Object Starts \n");
+ printOldValues(f, cs, cdol[i]);
+ fprintf(f,"=====Deleted Object Ends \n");
+ }
+ }
+}
+
+
+int sdotest::comparefiles(char* fn1, char*fn2)
+{
+ FILE *f1, *f2;
+ f1 = fopen(fn1,"r+");
+ if (f1 == 0)
+ {
+ if (!silent) cout << "Cannot open file:" << fn1 << endl;
+ return 0;
+ }
+ f2 = fopen(fn2,"r+");
+ if (f2 == 0)
+ {
+ if (!silent) cout << "Cannot open file:" << fn2 << endl;
+ if (ramping)
+ {
+ cout << "Creating it" << endl;
+ f2 = fopen(fn2,"w+");
+ if (f2 == 0)
+ {
+ cout << "Cannot ramp up - failed on " << fn2 << endl;
+ return 0;
+ }
+ int c;
+ do
+ {
+ c = fgetc(f1);
+ if (!feof(f1)) fputc(c,f2);
+ else break;
+ } while (1);
+ fclose(f1);
+ fclose(f2);
+ return 1;
+ }
+ else
+ {
+ fclose(f1);
+ return 0;
+ }
+ }
+
+ while (!feof(f1))
+ {
+ if (fgetc(f1) != fgetc(f2))
+ {
+ fclose(f1);
+ fclose(f2);
+ return 0;
+ }
+ }
+ fclose (f1);
+
+ if (!feof(f2))
+ {
+ fclose(f2);
+ return 0;
+ }
+
+ fclose(f2);
+ return 1;
+}
+
+
+int sdotest::printseq(FILE *f, SequencePtr sptr)
+{
+ fprintf(f, "======================================\n");
+ for (unsigned int i=0;i< sptr->size();i++)
+ {
+ try {
+ if (!sptr->isText(i))
+ {
+ const Property& prp = sptr->getProperty(i);
+ if (!strcmp(prp.getType().getName(),"Department"))
+ {
+ DataObjectPtr pdep = sptr->getDataObjectValue(i);
+ if (pdep != 0)
+ {
+ const char * cs = pdep->getCString("name");
+ if (cs != 0)
+ {
+ fprintf(f, "%s\n",cs);
+ }
+ else
+ {
+ fprintf(f," is empty \n");
+ }
+ }
+ }
+ else
+ {
+ const char* stx = sptr->getCStringValue(i);
+ if (stx != 0)
+ {
+ fprintf(f,"%s\n",stx);
+ }
+ else
+ {
+ fprintf(f," is empty \n");
+ }
+ }
+ }
+ else
+ {
+ const char* st = sptr->getCStringValue(i);
+ if (st != 0)
+ {
+ fprintf(f,"%s\n", st);
+ }
+ else
+ {
+ fprintf(f," is empty \n");
+ }
+ }
+ }
+ catch (SDOPropertyNotSetException)
+ {
+ if (!silent) cout << "WRONG - got a property not set exception!!!" << endl;
+ return 0;
+ }
+ }
+ fprintf(f, "======================================\n");
+ return 1;
+}
diff --git a/sdo-cpp/trunk/runtime/core/test/xhtml_in.xml b/sdo-cpp/trunk/runtime/core/test/xhtml_in.xml
new file mode 100644
index 0000000000..e897ece9c1
--- /dev/null
+++ b/sdo-cpp/trunk/runtime/core/test/xhtml_in.xml
@@ -0,0 +1,60 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ Licensed to the Apache Software Foundation (ASF) under one
+ or more contributor license agreements. See the NOTICE file
+ distributed with this work for additional information
+ regarding copyright ownership. The ASF licenses this file
+ to you 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.
+-->
+
+ <feed xmlns="http://www.w3.org/2005/Atom">
+ <title type="text">dive into mark</title>
+ <subtitle type="html">
+ A &lt;em&gt;lot&lt;/em&gt; of effort
+ went into making this effortless
+ </subtitle>
+ <updated>2005-07-31T12:29:29Z</updated>
+ <id>tag:example.org,2003:3</id>
+ <link rel="alternate" type="text/html" hreflang="en" href="http://example.org/"/>
+ <link rel="self" type="application/atom+xml" href="http://example.org/feed.atom"/>
+ <rights>Copyright (c) 2003, Mark Pilgrim</rights>
+ <generator uri="http://www.example.com/" version="1.0">
+ Example Toolkit
+ </generator>
+ <entry>
+ <title>Atom draft-07 snapshot</title>
+ <link rel="alternate" type="text/html" href="http://example.org/2005/04/02/atom"/>
+ <link rel="enclosure" type="audio/mpeg" length="1337" href="http://example.org/audio/ph34r_my_podcast.mp3"/>
+ <id>tag:example.org,2003:3.2397</id>
+ <updated>2005-07-31T12:29:29Z</updated>
+ <published>2003-12-13T08:29:29-04:00</published>
+ <author>
+ <name>Mark Pilgrim</name>
+ <uri>http://example.org/</uri>
+ <email>f8dy@example.com</email>
+ </author>
+ <contributor>
+ <name>Sam Ruby</name>
+ </contributor>
+ <contributor>
+ <name>Joe Gregorio</name>
+ </contributor>
+ <content type="xhtml" xml:lang="en" xml:base="http://diveintomark.org/">
+ <div xmlns="http://www.w3.org/1999/xhtml">
+ <p><i>[Update: The Atom draft is finished.]</i></p>
+ <div class="myclass"><p>Hello</p></div>
+ </div>
+ </content>
+ </entry>
+ </feed> \ No newline at end of file
diff --git a/sdo-cpp/trunk/runtime/core/test/xhtml_out.txt b/sdo-cpp/trunk/runtime/core/test/xhtml_out.txt
new file mode 100644
index 0000000000..05f82bc258
--- /dev/null
+++ b/sdo-cpp/trunk/runtime/core/test/xhtml_out.txt
@@ -0,0 +1,41 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<feed xmlns="http://www.w3.org/2005/Atom" xmlns:tns2="http://www.w3.org/1999/xhtml" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:tns="http://www.w3.org/2005/Atom">
+ <title type="text">dive into mark</title>
+ <subtitle type="html">
+ A <em>lot</em> of effort
+ went into making this effortless
+ </subtitle>
+ <updated>2005-07-31T12:29:29Z</updated>
+ <id>tag:example.org,2003:3</id>
+ <link href="http://example.org/" rel="alternate" type="text/html" hreflang="en"></link>
+ <link href="http://example.org/feed.atom" rel="self" type="application/atom+xml"></link>
+ <rights>Copyright (c) 2003, Mark Pilgrim</rights>
+ <generator uri="http://www.example.com/" version="1.0">
+ Example Toolkit
+ </generator>
+ <entry>
+ <title>Atom draft-07 snapshot</title>
+ <link href="http://example.org/2005/04/02/atom" rel="alternate" type="text/html"></link>
+ <link href="http://example.org/audio/ph34r_my_podcast.mp3" rel="enclosure" type="audio/mpeg" length="1337"></link>
+ <id>tag:example.org,2003:3.2397</id>
+ <updated>2005-07-31T12:29:29Z</updated>
+ <published>2003-12-13T08:29:29-04:00</published>
+ <author>
+ <name>Mark Pilgrim</name>
+ <uri>http://example.org/</uri>
+ <email>f8dy@example.com</email>
+ </author>
+ <contributor>
+ <name>Sam Ruby</name>
+ </contributor>
+ <contributor>
+ <name>Joe Gregorio</name>
+ </contributor>
+ <content type="xhtml" lang="en" base="http://diveintomark.org/">
+ <tns2:div xsi:type="tns2:div">
+ <tns2:p><tns2:i>[Update: The Atom draft is finished.]</tns2:i></tns2:p>
+ <tns2:div class="myclass"><tns2:p>Hello</tns2:p></tns2:div>
+ </tns2:div>
+ </content>
+ </entry>
+ </feed>
diff --git a/sdo-cpp/trunk/runtime/core/test/xsiTypeAbstract.xsd b/sdo-cpp/trunk/runtime/core/test/xsiTypeAbstract.xsd
new file mode 100644
index 0000000000..51e11baf49
--- /dev/null
+++ b/sdo-cpp/trunk/runtime/core/test/xsiTypeAbstract.xsd
@@ -0,0 +1,44 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ Licensed to the Apache Software Foundation (ASF) under one
+ or more contributor license agreements. See the NOTICE file
+ distributed with this work for additional information
+ regarding copyright ownership. The ASF licenses this file
+ to you 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.
+-->
+
+
+<xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema">
+ <xsd:element name="abstract" type="abstractType"/>
+
+ <xsd:complexType name="abstractType" abstract="true"/>
+
+ <xsd:complexType name="concreteType">
+ <xsd:complexContent>
+ <xsd:extension base="abstractType">
+ <xsd:sequence minOccurs="0" maxOccurs="unbounded">
+ <xsd:element name="prop1" type="xsd:string"/>
+ </xsd:sequence>
+ </xsd:extension>
+ </xsd:complexContent>
+ </xsd:complexType>
+
+ <xsd:element name="X">
+ <xsd:complexType>
+ <xsd:sequence>
+ <xsd:element ref="abstract"/>
+ </xsd:sequence>
+ </xsd:complexType>
+ </xsd:element>
+</xsd:schema> \ No newline at end of file
diff --git a/sdo-cpp/trunk/runtime/core/test/xsiTypeAbstract_expected.xml b/sdo-cpp/trunk/runtime/core/test/xsiTypeAbstract_expected.xml
new file mode 100644
index 0000000000..5bb847dcc3
--- /dev/null
+++ b/sdo-cpp/trunk/runtime/core/test/xsiTypeAbstract_expected.xml
@@ -0,0 +1,4 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<X xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
+ <abstract xsi:type="concreteType"/>
+</X>
diff --git a/sdo-cpp/trunk/samples/AUTHORS b/sdo-cpp/trunk/samples/AUTHORS
new file mode 100644
index 0000000000..e69de29bb2
--- /dev/null
+++ b/sdo-cpp/trunk/samples/AUTHORS
diff --git a/sdo-cpp/trunk/samples/COPYING b/sdo-cpp/trunk/samples/COPYING
new file mode 100755
index 0000000000..6b0b1270ff
--- /dev/null
+++ b/sdo-cpp/trunk/samples/COPYING
@@ -0,0 +1,203 @@
+
+ Apache License
+ Version 2.0, January 2004
+ http://www.apache.org/licenses/
+
+ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
+
+ 1. Definitions.
+
+ "License" shall mean the terms and conditions for use, reproduction,
+ and distribution as defined by Sections 1 through 9 of this document.
+
+ "Licensor" shall mean the copyright owner or entity authorized by
+ the copyright owner that is granting the License.
+
+ "Legal Entity" shall mean the union of the acting entity and all
+ other entities that control, are controlled by, or are under common
+ control with that entity. For the purposes of this definition,
+ "control" means (i) the power, direct or indirect, to cause the
+ direction or management of such entity, whether by contract or
+ otherwise, or (ii) ownership of fifty percent (50%) or more of the
+ outstanding shares, or (iii) beneficial ownership of such entity.
+
+ "You" (or "Your") shall mean an individual or Legal Entity
+ exercising permissions granted by this License.
+
+ "Source" form shall mean the preferred form for making modifications,
+ including but not limited to software source code, documentation
+ source, and configuration files.
+
+ "Object" form shall mean any form resulting from mechanical
+ transformation or translation of a Source form, including but
+ not limited to compiled object code, generated documentation,
+ and conversions to other media types.
+
+ "Work" shall mean the work of authorship, whether in Source or
+ Object form, made available under the License, as indicated by a
+ copyright notice that is included in or attached to the work
+ (an example is provided in the Appendix below).
+
+ "Derivative Works" shall mean any work, whether in Source or Object
+ form, that is based on (or derived from) the Work and for which the
+ editorial revisions, annotations, elaborations, or other modifications
+ represent, as a whole, an original work of authorship. For the purposes
+ of this License, Derivative Works shall not include works that remain
+ separable from, or merely link (or bind by name) to the interfaces of,
+ the Work and Derivative Works thereof.
+
+ "Contribution" shall mean any work of authorship, including
+ the original version of the Work and any modifications or additions
+ to that Work or Derivative Works thereof, that is intentionally
+ submitted to Licensor for inclusion in the Work by the copyright owner
+ or by an individual or Legal Entity authorized to submit on behalf of
+ the copyright owner. For the purposes of this definition, "submitted"
+ means any form of electronic, verbal, or written communication sent
+ to the Licensor or its representatives, including but not limited to
+ communication on electronic mailing lists, source code control systems,
+ and issue tracking systems that are managed by, or on behalf of, the
+ Licensor for the purpose of discussing and improving the Work, but
+ excluding communication that is conspicuously marked or otherwise
+ designated in writing by the copyright owner as "Not a Contribution."
+
+ "Contributor" shall mean Licensor and any individual or Legal Entity
+ on behalf of whom a Contribution has been received by Licensor and
+ subsequently incorporated within the Work.
+
+ 2. Grant of Copyright License. Subject to the terms and conditions of
+ this License, each Contributor hereby grants to You a perpetual,
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
+ copyright license to reproduce, prepare Derivative Works of,
+ publicly display, publicly perform, sublicense, and distribute the
+ Work and such Derivative Works in Source or Object form.
+
+ 3. Grant of Patent License. Subject to the terms and conditions of
+ this License, each Contributor hereby grants to You a perpetual,
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
+ (except as stated in this section) patent license to make, have made,
+ use, offer to sell, sell, import, and otherwise transfer the Work,
+ where such license applies only to those patent claims licensable
+ by such Contributor that are necessarily infringed by their
+ Contribution(s) alone or by combination of their Contribution(s)
+ with the Work to which such Contribution(s) was submitted. If You
+ institute patent litigation against any entity (including a
+ cross-claim or counterclaim in a lawsuit) alleging that the Work
+ or a Contribution incorporated within the Work constitutes direct
+ or contributory patent infringement, then any patent licenses
+ granted to You under this License for that Work shall terminate
+ as of the date such litigation is filed.
+
+ 4. Redistribution. You may reproduce and distribute copies of the
+ Work or Derivative Works thereof in any medium, with or without
+ modifications, and in Source or Object form, provided that You
+ meet the following conditions:
+
+ (a) You must give any other recipients of the Work or
+ Derivative Works a copy of this License; and
+
+ (b) You must cause any modified files to carry prominent notices
+ stating that You changed the files; and
+
+ (c) You must retain, in the Source form of any Derivative Works
+ that You distribute, all copyright, patent, trademark, and
+ attribution notices from the Source form of the Work,
+ excluding those notices that do not pertain to any part of
+ the Derivative Works; and
+
+ (d) If the Work includes a "NOTICE" text file as part of its
+ distribution, then any Derivative Works that You distribute must
+ include a readable copy of the attribution notices contained
+ within such NOTICE file, excluding those notices that do not
+ pertain to any part of the Derivative Works, in at least one
+ of the following places: within a NOTICE text file distributed
+ as part of the Derivative Works; within the Source form or
+ documentation, if provided along with the Derivative Works; or,
+ within a display generated by the Derivative Works, if and
+ wherever such third-party notices normally appear. The contents
+ of the NOTICE file are for informational purposes only and
+ do not modify the License. You may add Your own attribution
+ notices within Derivative Works that You distribute, alongside
+ or as an addendum to the NOTICE text from the Work, provided
+ that such additional attribution notices cannot be construed
+ as modifying the License.
+
+ You may add Your own copyright statement to Your modifications and
+ may provide additional or different license terms and conditions
+ for use, reproduction, or distribution of Your modifications, or
+ for any such Derivative Works as a whole, provided Your use,
+ reproduction, and distribution of the Work otherwise complies with
+ the conditions stated in this License.
+
+ 5. Submission of Contributions. Unless You explicitly state otherwise,
+ any Contribution intentionally submitted for inclusion in the Work
+ by You to the Licensor shall be under the terms and conditions of
+ this License, without any additional terms or conditions.
+ Notwithstanding the above, nothing herein shall supersede or modify
+ the terms of any separate license agreement you may have executed
+ with Licensor regarding such Contributions.
+
+ 6. Trademarks. This License does not grant permission to use the trade
+ names, trademarks, service marks, or product names of the Licensor,
+ except as required for reasonable and customary use in describing the
+ origin of the Work and reproducing the content of the NOTICE file.
+
+ 7. Disclaimer of Warranty. Unless required by applicable law or
+ agreed to in writing, Licensor provides the Work (and each
+ Contributor provides its Contributions) on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
+ implied, including, without limitation, any warranties or conditions
+ of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
+ PARTICULAR PURPOSE. You are solely responsible for determining the
+ appropriateness of using or redistributing the Work and assume any
+ risks associated with Your exercise of permissions under this License.
+
+ 8. Limitation of Liability. In no event and under no legal theory,
+ whether in tort (including negligence), contract, or otherwise,
+ unless required by applicable law (such as deliberate and grossly
+ negligent acts) or agreed to in writing, shall any Contributor be
+ liable to You for damages, including any direct, indirect, special,
+ incidental, or consequential damages of any character arising as a
+ result of this License or out of the use or inability to use the
+ Work (including but not limited to damages for loss of goodwill,
+ work stoppage, computer failure or malfunction, or any and all
+ other commercial damages or losses), even if such Contributor
+ has been advised of the possibility of such damages.
+
+ 9. Accepting Warranty or Additional Liability. While redistributing
+ the Work or Derivative Works thereof, You may choose to offer,
+ and charge a fee for, acceptance of support, warranty, indemnity,
+ or other liability obligations and/or rights consistent with this
+ License. However, in accepting such obligations, You may act only
+ on Your own behalf and on Your sole responsibility, not on behalf
+ of any other Contributor, and only if You agree to indemnify,
+ defend, and hold each Contributor harmless for any liability
+ incurred by, or claims asserted against, such Contributor by reason
+ of your accepting any such warranty or additional liability.
+
+ END OF TERMS AND CONDITIONS
+
+ APPENDIX: How to apply the Apache License to your work.
+
+ To apply the Apache License to your work, attach the following
+ boilerplate notice, with the fields enclosed by brackets "[]"
+ replaced with your own identifying information. (Don't include
+ the brackets!) The text should be enclosed in the appropriate
+ comment syntax for the file format. We also recommend that a
+ file or class name and description of purpose be included on the
+ same "printed page" as the copyright notice for easier
+ identification within third-party archives.
+
+ Copyright [yyyy] [name of copyright owner]
+
+ 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.
+
diff --git a/sdo-cpp/trunk/samples/ChangeLog b/sdo-cpp/trunk/samples/ChangeLog
new file mode 100644
index 0000000000..e69de29bb2
--- /dev/null
+++ b/sdo-cpp/trunk/samples/ChangeLog
diff --git a/sdo-cpp/trunk/samples/GettingStarted.html b/sdo-cpp/trunk/samples/GettingStarted.html
new file mode 100644
index 0000000000..0223e05c7d
--- /dev/null
+++ b/sdo-cpp/trunk/samples/GettingStarted.html
@@ -0,0 +1,236 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
+<!--
+ Licensed to the Apache Software Foundation (ASF) under one
+ or more contributor license agreements. See the NOTICE file
+ distributed with this work for additional information
+ regarding copyright ownership. The ASF licenses this file
+ to you 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.
+-->
+
+<HTML>
+<HEAD>
+ <META CONTENT="text/html; charset=iso-8859-1" HTTP-EQUIV="Content-Type">
+ <META CONTENT="text/css" HTTP-EQUIV="Content-Style-Type">
+ <STYLE MEDIA="all" TYPE="text/css">
+@import url("../doc/css/maven-base.css");
+@import url("../doc/css/maven-theme.css");
+ </STYLE>
+
+ <LINK HREF="../doc/css/maven-theme.css" MEDIA="print" REL="stylesheet"
+ TYPE="text/css">
+ <TITLE>Tuscany SDO C++ Samples - Getting Started</TITLE>
+</HEAD>
+
+<BODY>
+<DIV ID="bodyColumn">
+ <DIV ID="contentBox">
+ <DIV CLASS="section">
+ <H1>Tuscany Samples - Getting Started - SDO C++ Milestone release 3</H1>
+
+ <P>Tuscany SDO C++ includes some simple technology samples that demonstrate some of the basic sceanrios for C++ SDO.
+ This page describes the samples and what is needed to install and run them.
+ </P>
+ <UL>
+ <LI>The ObjectCreation sample demonstrates building the metadata programmatically, followed by use
+ of the metadata to instantiate objects in a graph.
+ </LI>
+ <LI>The XSDLoading sample shows how to load metadata from an XSD, and how to check for errors during
+ parsing. The parser gathers all non-fatal errors into one list, so all errors can be checked at one
+ time after parsing. Elements which contained errors will have been omitted from the resulting metadata.
+ </LI>
+ <LI>The ChangeSummarySave sample modifies a data graph of employees, and saves the modified graph with
+ its change summary. The output in ChangeSummarySave-output.xml shows the summary and its relationship
+ by references to the data graph.
+ </LI>
+ <LI>The Substitutes sample shows how to use substitites in XSD to achieve a property which will accept a
+ range of types.
+ </LI>
+ <LI>The Query sample shows how to use XPath to navigate within a graph to the required element. Note
+ that exceptions such as "path not found" may well be thrown if the XPath specified does not lead to
+ a real object in the graph.
+ </LI>
+ </UL>
+ <P>The SDO samples are built together into a single executable called sdo_misc.exe on Windows and sdo_misc on Linux
+ </P>
+ </DIV>
+
+ <DIV CLASS="section">
+ <H2>Contents</H2>
+ <OL>
+ <LI><A HREF="#linuxbld">Building the samples on Linux or Mac OS X</A></LI>
+ <!--LI><A HREF="#linuxbldstdcxx">Building the samples on Linux with Apache STDCXX</A></LI-->
+ <LI><A HREF="#linuxrun">Running the samples on Linux or Mac OS X</A></LI>
+ <LI><A HREF="#winbld">Building the samples on Windows</A></LI>
+ <LI><A HREF="#winbldstdcxx">Building the samples on Windows with Apache STDCXX</A></LI>
+ <LI><A HREF="#winrun">Running the samples on Windows</A></LI>
+ </OL>
+ </DIV>
+
+
+ <DIV CLASS="section">
+ <A NAME="linuxbld"><H2>Building the samples on Linux or Mac OS X</H2></A>
+ <OL>
+ <LI>The following environment variables are required:
+ <UL>
+ <LI>TUSCANY_SDOCPP=&lt;path to installed Tuscany SDO&gt;</LI>
+ </UL></LI>
+ </LI>
+ <LI>Build the source with the following command sequence:
+ <UL>
+ <LI>cd &lt;tuscany_sdo_install_dir&gt;/samples</LI>
+ <LI>./configure --prefix=&lt;tuscany_sdo_install_dir&gt;/deploy --enable-static=no</LI>
+ <LI>make</LI>
+ <LI>make install</LI>
+ </UL>
+ NOTE: If you don't provide a --prefix configure option, it will by default install into
+ /usr/local/tuscany/sdo/samples/misc</LI>
+ </OL>
+ <p>
+ A script, <b>build.sh</b>, is provided that will build and deploy the SDO for C++ samples to $TUSCANY_SCACPP/samples.
+
+ </DIV>
+
+ <!--DIV CLASS="section">
+ <A NAME="linuxbldstdcxx"><H2>Building the samples on Linux with Apache STDCXX</H2></A>
+ <OL>
+ <LI>The following environment variables are required:
+ <UL>
+ <LI>TUSCANY_SDOCPP=&lt;path to installed Tuscany SDO&gt;
+ <LI>AXIS2C_HOME=&lt;path to axis2c version 0.94&gt;</LI>
+ </UL></LI>
+ </LI>
+ <LI>Build the source with the following command sequence:
+ <UL>
+ <LI>cd &lt;tuscany_sdo_install_dir&gt;/samples</LI>
+ <LI>./configure</LI>
+ <LI>make</LI>
+ <LI>make install</LI>
+ </UL>
+ NOTE: If you don't provide a --prefix configure option, it will by default install into
+ /usr/local/tuscany/sdo/samples/misc</LI>
+ </OL>
+ </DIV-->
+
+ <DIV CLASS="section">
+ <A NAME="linuxrun"><H2>Running the samples on Linux or Mac OS X</H2></A>
+ <OL>
+ <LI>Ensure that &lt;tuscany_sdo_install_dir&gt;/lib is included in the LD_LIBRARY_PATH environment variable
+ </LI>
+ <LI>Run the sample with the following commands:
+ <UL>
+ <LI>cd &lt;tuscany_sdo_install_dir&gt;/samples/misc/deploy</LI>
+ <LI>./bin/sdo_misc</LI>
+ </UL>
+ </LI>
+ </OL>
+ </DIV>
+
+ <DIV CLASS="section">
+ <A NAME="winbld"><H2>Building the samples on Windows</H2></A>
+ <P>If using the binary distribution the samples are built and installed in
+ &lt;tuscany_sdo_install_dir&gt;/samples - go directly to <A HREF="#winrun">Running the samples on Windows</A>.</P>
+ <OL>
+ <LI>The following environment variables are required:
+ <UL>
+ <LI>TUSCANY_SDOCPP=&lt;path to installed Tuscany SDO&gt;</LI>
+ </UL></LI>
+ </LI>
+ <LI>You must have set up the environment for Microsoft Visual Studio Express C++ tools.
+ The build command will call vcvars32 to set the environment. Ensure the
+ directory containing this is on your path. This will be where you
+ installed the compiler.
+ </LI>
+ <LI>Build the source, either via the Visual Studio Express projects under
+ &lt;tuscany_sdo_install_dir&gt;\samples\misc\VSExpress or via the command-line build file
+ found at &lt;tuscany_sdo_install_dir&gt;\samples\misc\build.bat
+ which will build and deploy the sample.
+ </LI>
+ </OL>
+ </DIV>
+
+ <DIV CLASS="section">
+ <A NAME="winbldstdcxx"><H2>Building the samples on Windows with Apache STDCXX</H2></A>
+ <P>STDCXX is an implementation of the C++ Standard Library provided by Apache.
+ The website is at <A HREF="http://incubator.apache.org/stdcxx/">http://incubator.apache.org/stdcxx/</A>.
+ </P>
+ <P>You must begin by downloading and building STDCXX as described <A HREF="../doc/BuildingSTDCXX.html">here</A>
+ </P>
+ <P>STDCXX is supported only when used with Microsoft Visual Studio C++ V7.1. Launch the
+ MSVC++ 7.1 studio by opening the file
+ &lt;tuscany_sdo_install_dir&gt;samples\ides\devstudio7\projects\misc\misc.sln
+ </P>
+ <P>The sdo_misc project includes build configurations that
+ use STDCXX. There are several ways to access the build configurations, and all
+ are equally effective. As an example, open the Property pages for sdo_misc by
+ right clicking on sdo_misc in the Solution Explorer pane and selecting
+ Properties. The Configuration property in the top left corner of the pane is a
+ drop down box offering four options: Debug, Release, stdcxx-Debug,
+ stdcxx-Release. Choose the one you want and then launch the build.
+ </P>
+ <P>All components that are linked (by the linker) must all use the same C++
+ Standard library. Therefore, if either sdo_misc or sdo_runtime are built with
+ STDCXX then both must be.
+ </P>
+ </DIV>
+
+ <DIV CLASS="section">
+ <A NAME="winrun"><H2>Running the samples on Windows</H2></A>
+ <OL>
+ <LI>Ensure that &lt;tuscany_sdo_install_dir&gt;\bin is included in the PATH environment variable
+ </LI>
+ <LI>Run the sample with the following commands:
+ <UL>
+ <LI>cd &lt;tuscany_sdo_install_dir&gt;/samples/misc/deploy</LI>
+ <LI>bin\sdo_misc</LI>
+ </UL>
+ </LI>
+ </OL>
+ </DIV>
+
+
+ <DIV CLASS="section">
+ <A NAME="help"><H2>Getting Help</H2></A>
+
+ <P>First place to look is at the Tuscany FAQ at
+ <A HREF="http://cwiki.apache.org/TUSCANY/tuscany-sdo-faq.html"
+ TARGET="_blank">http://cwiki.apache.org/TUSCANY/tuscany-sdo-faq.html</A> </P>
+
+ <P>Any problem with this release can be reported to the Tuscany
+ <A HREF="http://cwiki.apache.org/TUSCANY/mailing-lists.html"
+ TARGET="_blank">mailing lists</A> or create a JIRA issue at&nbsp;<A HREF="http://issues.apache.org/jira/browse/Tuscany"
+ TARGET="_blank">http://issues.apache.org/jira/browse/Tuscany</A>.</P>
+
+
+ <P>&nbsp;</P>
+
+ <P>&nbsp;</P>
+
+ <P>&nbsp;</P>
+ <TABLE CLASS="bodyTable">
+ <TBODY>
+ <TR CLASS="a">
+ <TD>
+
+ <P>Thank you for your interest in Tuscany.</P> <STRONG><EM>-The
+ Tuscany Development Team</EM></STRONG>
+ </TD>
+ </TR>
+ </TBODY>
+ </TABLE>
+ </DIV>
+ </DIV>
+</DIV>
+</BODY>
+
+</HTML>
diff --git a/sdo-cpp/trunk/samples/INSTALL b/sdo-cpp/trunk/samples/INSTALL
new file mode 100644
index 0000000000..f3710f30e4
--- /dev/null
+++ b/sdo-cpp/trunk/samples/INSTALL
@@ -0,0 +1,2 @@
+Please read the GettingStarted.html document for information on
+building, installing and running Tuscany SDO for C++ Samples \ No newline at end of file
diff --git a/sdo-cpp/trunk/samples/LICENSE b/sdo-cpp/trunk/samples/LICENSE
new file mode 100755
index 0000000000..f433b1a53f
--- /dev/null
+++ b/sdo-cpp/trunk/samples/LICENSE
@@ -0,0 +1,177 @@
+
+ Apache License
+ Version 2.0, January 2004
+ http://www.apache.org/licenses/
+
+ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
+
+ 1. Definitions.
+
+ "License" shall mean the terms and conditions for use, reproduction,
+ and distribution as defined by Sections 1 through 9 of this document.
+
+ "Licensor" shall mean the copyright owner or entity authorized by
+ the copyright owner that is granting the License.
+
+ "Legal Entity" shall mean the union of the acting entity and all
+ other entities that control, are controlled by, or are under common
+ control with that entity. For the purposes of this definition,
+ "control" means (i) the power, direct or indirect, to cause the
+ direction or management of such entity, whether by contract or
+ otherwise, or (ii) ownership of fifty percent (50%) or more of the
+ outstanding shares, or (iii) beneficial ownership of such entity.
+
+ "You" (or "Your") shall mean an individual or Legal Entity
+ exercising permissions granted by this License.
+
+ "Source" form shall mean the preferred form for making modifications,
+ including but not limited to software source code, documentation
+ source, and configuration files.
+
+ "Object" form shall mean any form resulting from mechanical
+ transformation or translation of a Source form, including but
+ not limited to compiled object code, generated documentation,
+ and conversions to other media types.
+
+ "Work" shall mean the work of authorship, whether in Source or
+ Object form, made available under the License, as indicated by a
+ copyright notice that is included in or attached to the work
+ (an example is provided in the Appendix below).
+
+ "Derivative Works" shall mean any work, whether in Source or Object
+ form, that is based on (or derived from) the Work and for which the
+ editorial revisions, annotations, elaborations, or other modifications
+ represent, as a whole, an original work of authorship. For the purposes
+ of this License, Derivative Works shall not include works that remain
+ separable from, or merely link (or bind by name) to the interfaces of,
+ the Work and Derivative Works thereof.
+
+ "Contribution" shall mean any work of authorship, including
+ the original version of the Work and any modifications or additions
+ to that Work or Derivative Works thereof, that is intentionally
+ submitted to Licensor for inclusion in the Work by the copyright owner
+ or by an individual or Legal Entity authorized to submit on behalf of
+ the copyright owner. For the purposes of this definition, "submitted"
+ means any form of electronic, verbal, or written communication sent
+ to the Licensor or its representatives, including but not limited to
+ communication on electronic mailing lists, source code control systems,
+ and issue tracking systems that are managed by, or on behalf of, the
+ Licensor for the purpose of discussing and improving the Work, but
+ excluding communication that is conspicuously marked or otherwise
+ designated in writing by the copyright owner as "Not a Contribution."
+
+ "Contributor" shall mean Licensor and any individual or Legal Entity
+ on behalf of whom a Contribution has been received by Licensor and
+ subsequently incorporated within the Work.
+
+ 2. Grant of Copyright License. Subject to the terms and conditions of
+ this License, each Contributor hereby grants to You a perpetual,
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
+ copyright license to reproduce, prepare Derivative Works of,
+ publicly display, publicly perform, sublicense, and distribute the
+ Work and such Derivative Works in Source or Object form.
+
+ 3. Grant of Patent License. Subject to the terms and conditions of
+ this License, each Contributor hereby grants to You a perpetual,
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
+ (except as stated in this section) patent license to make, have made,
+ use, offer to sell, sell, import, and otherwise transfer the Work,
+ where such license applies only to those patent claims licensable
+ by such Contributor that are necessarily infringed by their
+ Contribution(s) alone or by combination of their Contribution(s)
+ with the Work to which such Contribution(s) was submitted. If You
+ institute patent litigation against any entity (including a
+ cross-claim or counterclaim in a lawsuit) alleging that the Work
+ or a Contribution incorporated within the Work constitutes direct
+ or contributory patent infringement, then any patent licenses
+ granted to You under this License for that Work shall terminate
+ as of the date such litigation is filed.
+
+ 4. Redistribution. You may reproduce and distribute copies of the
+ Work or Derivative Works thereof in any medium, with or without
+ modifications, and in Source or Object form, provided that You
+ meet the following conditions:
+
+ (a) You must give any other recipients of the Work or
+ Derivative Works a copy of this License; and
+
+ (b) You must cause any modified files to carry prominent notices
+ stating that You changed the files; and
+
+ (c) You must retain, in the Source form of any Derivative Works
+ that You distribute, all copyright, patent, trademark, and
+ attribution notices from the Source form of the Work,
+ excluding those notices that do not pertain to any part of
+ the Derivative Works; and
+
+ (d) If the Work includes a "NOTICE" text file as part of its
+ distribution, then any Derivative Works that You distribute must
+ include a readable copy of the attribution notices contained
+ within such NOTICE file, excluding those notices that do not
+ pertain to any part of the Derivative Works, in at least one
+ of the following places: within a NOTICE text file distributed
+ as part of the Derivative Works; within the Source form or
+ documentation, if provided along with the Derivative Works; or,
+ within a display generated by the Derivative Works, if and
+ wherever such third-party notices normally appear. The contents
+ of the NOTICE file are for informational purposes only and
+ do not modify the License. You may add Your own attribution
+ notices within Derivative Works that You distribute, alongside
+ or as an addendum to the NOTICE text from the Work, provided
+ that such additional attribution notices cannot be construed
+ as modifying the License.
+
+ You may add Your own copyright statement to Your modifications and
+ may provide additional or different license terms and conditions
+ for use, reproduction, or distribution of Your modifications, or
+ for any such Derivative Works as a whole, provided Your use,
+ reproduction, and distribution of the Work otherwise complies with
+ the conditions stated in this License.
+
+ 5. Submission of Contributions. Unless You explicitly state otherwise,
+ any Contribution intentionally submitted for inclusion in the Work
+ by You to the Licensor shall be under the terms and conditions of
+ this License, without any additional terms or conditions.
+ Notwithstanding the above, nothing herein shall supersede or modify
+ the terms of any separate license agreement you may have executed
+ with Licensor regarding such Contributions.
+
+ 6. Trademarks. This License does not grant permission to use the trade
+ names, trademarks, service marks, or product names of the Licensor,
+ except as required for reasonable and customary use in describing the
+ origin of the Work and reproducing the content of the NOTICE file.
+
+ 7. Disclaimer of Warranty. Unless required by applicable law or
+ agreed to in writing, Licensor provides the Work (and each
+ Contributor provides its Contributions) on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
+ implied, including, without limitation, any warranties or conditions
+ of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
+ PARTICULAR PURPOSE. You are solely responsible for determining the
+ appropriateness of using or redistributing the Work and assume any
+ risks associated with Your exercise of permissions under this License.
+
+ 8. Limitation of Liability. In no event and under no legal theory,
+ whether in tort (including negligence), contract, or otherwise,
+ unless required by applicable law (such as deliberate and grossly
+ negligent acts) or agreed to in writing, shall any Contributor be
+ liable to You for damages, including any direct, indirect, special,
+ incidental, or consequential damages of any character arising as a
+ result of this License or out of the use or inability to use the
+ Work (including but not limited to damages for loss of goodwill,
+ work stoppage, computer failure or malfunction, or any and all
+ other commercial damages or losses), even if such Contributor
+ has been advised of the possibility of such damages.
+
+ 9. Accepting Warranty or Additional Liability. While redistributing
+ the Work or Derivative Works thereof, You may choose to offer,
+ and charge a fee for, acceptance of support, warranty, indemnity,
+ or other liability obligations and/or rights consistent with this
+ License. However, in accepting such obligations, You may act only
+ on Your own behalf and on Your sole responsibility, not on behalf
+ of any other Contributor, and only if You agree to indemnify,
+ defend, and hold each Contributor harmless for any liability
+ incurred by, or claims asserted against, such Contributor by reason
+ of your accepting any such warranty or additional liability.
+
+ END OF TERMS AND CONDITIONS
diff --git a/sdo-cpp/trunk/samples/Makefile.am b/sdo-cpp/trunk/samples/Makefile.am
new file mode 100644
index 0000000000..9f15dcdb1d
--- /dev/null
+++ b/sdo-cpp/trunk/samples/Makefile.am
@@ -0,0 +1,20 @@
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements. See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership. The ASF licenses this file
+# to you 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.
+
+SUBDIRS = misc
+
+EXTRA_DIST = autogen.sh build.sh GettingStarted.html
diff --git a/sdo-cpp/trunk/samples/NEWS b/sdo-cpp/trunk/samples/NEWS
new file mode 100644
index 0000000000..e69de29bb2
--- /dev/null
+++ b/sdo-cpp/trunk/samples/NEWS
diff --git a/sdo-cpp/trunk/samples/NOTICE b/sdo-cpp/trunk/samples/NOTICE
new file mode 100644
index 0000000000..4a1e01a59e
--- /dev/null
+++ b/sdo-cpp/trunk/samples/NOTICE
@@ -0,0 +1,5 @@
+Apache Tuscany SDO for C++
+Copyright 2005, 2007 The Apache Software Foundation
+
+This product includes software developed by
+The Apache Software Foundation (http://www.apache.org/) \ No newline at end of file
diff --git a/sdo-cpp/trunk/samples/README b/sdo-cpp/trunk/samples/README
new file mode 100644
index 0000000000..f3710f30e4
--- /dev/null
+++ b/sdo-cpp/trunk/samples/README
@@ -0,0 +1,2 @@
+Please read the GettingStarted.html document for information on
+building, installing and running Tuscany SDO for C++ Samples \ No newline at end of file
diff --git a/sdo-cpp/trunk/samples/autogen.sh b/sdo-cpp/trunk/samples/autogen.sh
new file mode 100755
index 0000000000..af38864985
--- /dev/null
+++ b/sdo-cpp/trunk/samples/autogen.sh
@@ -0,0 +1,31 @@
+#!/bin/bash
+
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements. See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership. The ASF licenses this file
+# to you 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.
+
+for i in "libtoolize --force" aclocal autoconf autoheader
+do
+ echo -n "Running $i..."
+ $i || exit 1
+ echo 'done.'
+done
+
+echo -n 'Running automake...'
+automake --add-missing
+echo 'done.'
+exit 0
+
diff --git a/sdo-cpp/trunk/samples/build.sh b/sdo-cpp/trunk/samples/build.sh
new file mode 100755
index 0000000000..c306d2a20d
--- /dev/null
+++ b/sdo-cpp/trunk/samples/build.sh
@@ -0,0 +1,22 @@
+#!/bin/sh
+
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements. See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership. The ASF licenses this file
+# to you 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.
+
+./configure.sh
+make install
+
diff --git a/sdo-cpp/trunk/samples/build.xml b/sdo-cpp/trunk/samples/build.xml
new file mode 100644
index 0000000000..3fff723b52
--- /dev/null
+++ b/sdo-cpp/trunk/samples/build.xml
@@ -0,0 +1,68 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ Licensed to the Apache Software Foundation (ASF) under one
+ or more contributor license agreements. See the NOTICE file
+ distributed with this work for additional information
+ regarding copyright ownership. The ASF licenses this file
+ to you 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.
+-->
+
+<project name="TuscanySDONative_samples" default="all" basedir="..">
+
+ <!--
+ This is the root level ant build.xml file for TuscanySDO Native samples
+ Nothing is actually performed here, it just delegates to subdirectory
+ build.xml files.
+ -->
+
+ <import file="${basedir}/antscripts/system.xml"/>
+ <import file="${basedir}/antscripts/compile-targets.xml"/>
+
+
+ <!--
+ Notice that the basedir for this project is set to the TuscanySDO root dir
+ This makes path setting in system.xml much simpler, but we'll just have to
+ set a property here to this directory.
+ -->
+ <property name="this.dir" location="${basedir}/samples"/>
+
+ <property name="misc.dir" location="${this.dir}/misc"/>
+
+ <!--
+ Public targets
+ -->
+
+ <target name="all" description="Build and install all TuscanySDONative samples">
+ <antcall target="misc.sample"/>
+ </target>
+
+ <!--
+ Using antfile and inheritAll="false" to maintain the subdir build.xml basedir settings
+ -->
+
+ <target name="misc.sample" description="Build and install the misc sample">
+ <ant target="all" antfile="${misc.dir}/build.xml" inheritAll="false"/>
+ </target>
+
+ <!-- clean -->
+
+ <target name="clean" description="Clean all TuscanySDONative samples">
+ <ant target="clean" antfile="${misc.dir}/build.xml" inheritAll="false"/>
+ </target>
+
+ <target name="distribution" description="Generate the necessary distribution files of all samples and copy it to the distribution dir">
+ <ant target="distribution" antfile="${misc.dir}/build.xml"/>
+ </target>
+
+</project>
diff --git a/sdo-cpp/trunk/samples/configure.ac b/sdo-cpp/trunk/samples/configure.ac
new file mode 100644
index 0000000000..a2b0b9ef87
--- /dev/null
+++ b/sdo-cpp/trunk/samples/configure.ac
@@ -0,0 +1,73 @@
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements. See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership. The ASF licenses this file
+# to you 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.
+
+dnl run autogen.sh to generate the configure script.
+
+AC_PREREQ(2.59)
+AC_INIT(tuscany-sdo-samples, 1.0-M3)
+AC_CANONICAL_SYSTEM
+AM_CONFIG_HEADER(config.h)
+AM_INIT_AUTOMAKE(AC_PACKAGE_NAME, AC_PACKAGE_VERSION)
+AC_PREFIX_DEFAULT(/usr/local/tuscany/sdo/samples)
+
+# Checks for programs.
+AC_PROG_CXX
+AC_PROG_CC
+AC_PROG_CPP
+AC_PROG_INSTALL
+AC_PROG_LN_S
+AC_PROG_MAKE_SET
+AC_PROG_LIBTOOL
+
+# Check for running on Darwin
+AC_MSG_CHECKING([Checking if running on Darwin])
+UNAME=`uname -s`
+if test "x$UNAME" = "xDarwin"; then
+ AC_DEFINE([IS_DARWIN], [1], [Set to 1 when running on Darwin - Mac OSX])
+ AC_MSG_RESULT(yes)
+ AC_SUBST([libsuffix],[".dylib"])
+ is_darwin=true
+else
+ AC_MSG_RESULT(no)
+ AC_SUBST([libsuffix],[".so"])
+ is_darwin=false
+fi
+AM_CONDITIONAL([DARWIN], [test x$is_darmin = xtrue])
+
+# Configure TUSCANY_SDOCPP
+TUSCANY_SDOCPP=`echo "$TUSCANY_SDOCPP"`
+if test "x$TUSCANY_SDOCPP" = "x"; then
+ SDOPWD=`pwd`
+ AC_SUBST([TUSCANY_SDOCPP], ["$SDOPWD/.."])
+fi
+
+# Configure LIBXML2_INCLUDE and LIBXML2_LIB
+LIBXML2_INCLUDE=`echo "$LIBXML2_INCLUDE"`
+if test "x$LIBXML2_INCLUDE" = "x"; then
+ AC_SUBST([LIBXML2_INCLUDE], ["/usr/include/libxml2"])
+fi
+
+LIBXML2_LIB=`echo "$LIBXML2_LIB"`
+if test "x$LIBXML2_LIB" = "x"; then
+ AC_SUBST([LIBXML2_LIB], ["/usr/lib"])
+fi
+
+AC_CONFIG_FILES([Makefile
+ misc/Makefile
+ ])
+AC_OUTPUT
+
diff --git a/sdo-cpp/trunk/samples/misc/ChangeSummarySave.cpp b/sdo-cpp/trunk/samples/misc/ChangeSummarySave.cpp
new file mode 100644
index 0000000000..5a27683807
--- /dev/null
+++ b/sdo-cpp/trunk/samples/misc/ChangeSummarySave.cpp
@@ -0,0 +1,188 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you 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$ */
+
+#include "samples.h"
+using namespace std;
+
+void ChangeSummarySave::sample()
+{
+ cout << " ********** ChangeSummarySave sample********" << endl;
+
+ try {
+
+ DataFactoryPtr mdg = DataFactory::getDataFactory();
+
+ XSDHelperPtr xsh = HelperProvider::getXSDHelper(mdg);
+ xsh->defineFile("ChangeSummarySave.xsd");
+
+ /**
+ * Load the schema from ChangeSummarySave.xsd
+ */
+
+ const Type& tstring = mdg->getType("commonj.sdo","String");
+ const Type& tbool = mdg->getType("commonj.sdo","Boolean");
+ const Type& tcs = mdg->getType("commonj.sdo","ChangeSummary");
+ const Type& tcomp = mdg->getType("companyNS","CompanyType");
+ const Type& tdept = mdg->getType("companyNS","DepartmentType");
+ const Type& temp = mdg->getType("companyNS","EmployeeType");
+
+
+ /**
+ * create a graph, set the change summary logging, modify the
+ * data, then save it to a file
+ */
+
+ DataObjectPtr comp = mdg->create((Type&)tcomp);
+ comp->setCString("name","ACME");
+
+ DataObjectPtr dept = mdg->create((Type&)tdept);
+ DataObjectList& dol = comp->getList("departments");
+ dol.append(dept);
+
+ dept->setCString("name","Advanced Technologies");
+ dept->setCString("location","NY");
+ dept->setCString("number","123");
+
+ DataObjectPtr emp1 = mdg->create(temp);
+ DataObjectPtr emp2 = mdg->create(temp);
+ DataObjectPtr emp3 = mdg->create(temp);
+
+ emp1->setCString("name","John Jones");
+ emp1->setCString("SN","E0001");
+
+ emp2->setCString("name","Mary Smith");
+ emp2->setCString("SN","E0002");
+ emp2->setBoolean("manager",true);
+
+ emp3->setCString("name","Jane Doe");
+ emp3->setCString("SN","E0003");
+
+ DataObjectList& dol2 = dept->getList("employees");
+ dol2.append(emp1);
+ dol2.append(emp2);
+ dol2.append(emp3);
+
+
+ /**
+ * Set the employee of the month - which is a reference, not
+ * a containment value
+ */
+
+ comp->setDataObject("employeeOfTheMonth",emp2);
+
+ /**
+ * The XSD defined the company type as having a change summary,
+ * so we can get it...
+ */
+
+ ChangeSummaryPtr cs = comp->getChangeSummary();
+
+ /**
+ * And ask it to start logging...
+ */
+
+ cs->beginLogging();
+
+ /**
+ * With logging on, create a new employee
+ */
+
+ DataObjectPtr emp4 = mdg->create(temp);
+ emp4->setCString("name","Al Smith");
+ emp4->setCString("SN","E0004");
+ emp4->setBoolean("manager",true);
+
+ /**
+ * The first recorded change happens now, as the employee is
+ * added into the data graph. Emp4 (Al Smith) will appear in the
+ * change summary as a creation. There will also be a change
+ * record for the list "employees" of this department, holding the
+ * values before Al was added.
+ */
+ dol2.append(emp4);
+
+ /**
+ * The second change is to remove element 1 from the
+ * same list - Thats Mary Smith.
+ * Mary will appear as a deletion, but there will be no extra
+ * change record for "employees", as its already been changed.
+ * Mary was employee of the month, so that reference gets
+ * emptied, and a change record is set up for it, recording
+ * Mary as the old value.
+ */
+
+ dol2.remove(1); // element 1 is Mary
+
+ DataObjectPtr emp5 = mdg->create(temp);
+ emp5->setCString("name","Bill Withers");
+ emp5->setCString("SN","E0005");
+
+
+ /**
+ * The third change is to append Bill to the same list.
+ * Bill appears as a creation, but there is no change recorded to
+ * the employees list.
+ */
+
+ dol2.append(emp5);
+
+
+ /**
+ * The company name is changed. A change record is set up for
+ * the property "name" of this company. It stores the old value
+ * "ACME"
+ */
+
+ comp->setCString("name","MegaCorp");
+
+ /**
+ * The company employee of the month is changed. The old
+ * value has already been changed from Mary to NULL, so no change
+ * record is created here at all
+ */
+
+ comp->setDataObject("employeeOfTheMonth",emp4);
+
+
+ /**
+ * Stop logging changes
+ */
+
+ cs->endLogging();
+
+
+ XMLHelperPtr xmh = HelperProvider::getXMLHelper(mdg);
+ XMLDocumentPtr doc = xmh->createDocument(comp,"companyNS","company");
+ xmh->save(doc,"ChangeSummarySave-output.xml");
+
+ /**
+ * Have a look in the file and see if you can recognise the changes
+ * above
+ */
+
+ }
+ catch (SDORuntimeException e)
+ {
+ cout << "Exception in ChangeSummarySave" << endl;
+ cout << e;
+ }
+ cout << " ********** Sample ends ********************" << endl;
+}
diff --git a/sdo-cpp/trunk/samples/misc/ChangeSummarySave.xsd b/sdo-cpp/trunk/samples/misc/ChangeSummarySave.xsd
new file mode 100644
index 0000000000..b626d6a45b
--- /dev/null
+++ b/sdo-cpp/trunk/samples/misc/ChangeSummarySave.xsd
@@ -0,0 +1,49 @@
+<!--
+ Licensed to the Apache Software Foundation (ASF) under one
+ or more contributor license agreements. See the NOTICE file
+ distributed with this work for additional information
+ regarding copyright ownership. The ASF licenses this file
+ to you 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.
+-->
+
+ <xsd:schema
+ xmlns:xsd="http://www.w3.org/2001/XMLSchema"
+ xmlns:sdo="commonj.sdo"
+ xmlns:sdoxml="commonj.sdo/xml"
+ xmlns:company="companyNS"
+ targetNamespace="companyNS">
+ <xsd:element name="company" type="company:CompanyType"/>
+ <xsd:complexType name="CompanyType">
+ <xsd:sequence>
+ <xsd:element name="departments" type="company:DepartmentType" maxOccurs="unbounded"/>
+ </xsd:sequence>
+ <xsd:attribute name="name" type="xsd:string"/>
+ <xsd:attribute name="cs" type="sdo:ChangeSummaryType"/>
+ <xsd:attribute name="employeeOfTheMonth" type="xsd:IDREF" sdoxml:propertyType="company:EmployeeType"/>
+ </xsd:complexType>
+ <xsd:complexType name="DepartmentType">
+ <xsd:sequence>
+ <xsd:element name="employees" type="company:EmployeeType" maxOccurs="unbounded"/>
+ </xsd:sequence>
+ <xsd:attribute name="name" type="xsd:string"/>
+ <xsd:attribute name="location" type="xsd:string"/>
+ <xsd:attribute name="number" type="xsd:int"/>
+ </xsd:complexType>
+ <xsd:complexType name="EmployeeType">
+ <xsd:attribute name="name" type="xsd:string"/>
+ <xsd:attribute name="SN" type="xsd:ID"/>
+ <xsd:attribute name="manager" type="xsd:boolean"/>
+ </xsd:complexType>
+ </xsd:schema>
+
diff --git a/sdo-cpp/trunk/samples/misc/Makefile.am b/sdo-cpp/trunk/samples/misc/Makefile.am
new file mode 100644
index 0000000000..c1cd5cde65
--- /dev/null
+++ b/sdo-cpp/trunk/samples/misc/Makefile.am
@@ -0,0 +1,40 @@
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements. See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership. The ASF licenses this file
+# to you 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.
+
+deploydir=$(prefix)/misc/deploy/
+prgbindir=$(deploydir)/bin
+
+prgbin_PROGRAMS = sdo_misc
+prgbin_SCRIPTS =
+EXTRA_DIST = *.xsd *.xml
+deploy_DATA = *.xsd *.xml
+
+sdo_misc_SOURCES = samples.cpp \
+ChangeSummarySave.cpp \
+ObjectCreation.cpp \
+Query.cpp \
+Substitutes.cpp \
+XSDLoading.cpp
+
+
+noinst_HEADERS = *.h
+
+sdo_misc_LDADD = -L${TUSCANY_SDOCPP}/lib -ltuscany_sdo -lxml2
+
+
+INCLUDES = -I$(top_builddir)/misc \
+ -I${TUSCANY_SDOCPP}/include
diff --git a/sdo-cpp/trunk/samples/misc/ObjectCreation.cpp b/sdo-cpp/trunk/samples/misc/ObjectCreation.cpp
new file mode 100644
index 0000000000..94ff64e904
--- /dev/null
+++ b/sdo-cpp/trunk/samples/misc/ObjectCreation.cpp
@@ -0,0 +1,251 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you 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$ */
+
+#include "samples.h"
+using namespace std;
+
+void ObjectCreation::sample()
+{
+
+
+ cout << " ********** Sample ObjectCreation **********" << endl;
+
+ try {
+
+
+ /**
+ * Get a data factory. With it we can either create metadata
+ * or load it from an XSD.
+ */
+
+ DataFactoryPtr mdg = DataFactory::getDataFactory();
+
+ /**
+ * Add some Types to the data factory..
+ * The booleans at on addType are:
+ * "isSequenced", "isOpen" "isAbstract" and "isDataType"
+ */
+
+ mdg->addType("myspace","Company");
+
+ mdg->addType("myspace","Department");
+
+ /**
+ * Manager is going to be a sequenced type...
+ */
+
+ mdg->addType("myspace","Manager", true, false);
+
+ mdg->addType("myspace","Employee");
+
+
+ /**
+ * We will make employee and manager sub-types of 'person'
+ */
+
+ mdg->addType("myspace","Person", true, false);
+
+
+ /**
+ * having all the types defined, we can now define the tree
+ * by giving properties to the types.
+ */
+
+ /**
+ * We could use the API passing in name and URI for each
+ * Type , or get the Types back and use them directly.
+ * Here we get back the types to use...
+ */
+
+ const Type& tc = mdg->getType("myspace","Company");
+ const Type& ts = mdg->getType("commonj.sdo","String");
+ const Type& ti = mdg->getType("commonj.sdo","Integer");
+ const Type& tm = mdg->getType("myspace","Manager");
+ const Type& td = mdg->getType("myspace","Department");
+ const Type& te = mdg->getType("myspace","Employee");
+ const Type& tp = mdg->getType("myspace","Person");
+
+
+ /**
+ * Example 1 - add a property of type String to type company
+ */
+
+ mdg->addPropertyToType(tc,"name",ts);
+
+ /**
+ * Example 2 - add using the name of the company instead of the
+ * type...
+ */
+
+ mdg->addPropertyToType("myspace","Company","address",ts);
+
+ /**
+ * Example 3 - add a many valued property
+ */
+
+ mdg->addPropertyToType(tc,"departments", "myspace","Department",
+ true);
+
+
+ /**
+ * Example 4 - add a reference property
+ */
+
+ mdg->addPropertyToType(tc,"employee of the month", "myspace",
+ "Employee",false, false, false);
+
+
+ /**
+ * Add other department properties...
+ */
+
+ mdg->addPropertyToType(td,"name", ts);
+ mdg->addPropertyToType(td,"id", ti);
+ mdg->addPropertyToType(td,"manager", tm);
+ mdg->addPropertyToType(td,"employees",te,true,false,true);
+
+ /**
+ * Add a name to the person
+ */
+
+ mdg->addPropertyToType(tp,"name", ts);
+
+
+
+ /**
+ * Make employees and mamagers both substypes of person
+ */
+
+ mdg->setBaseType(te,tp);
+ mdg->setBaseType(tm,tp);
+
+ /**
+ * And give them different properties of their own.
+ */
+
+ mdg->addPropertyToType(tm,"officeid", ts);
+ mdg->addPropertyToType(te,"cubelocation", ts);
+
+
+
+ /**
+ * The data structure looks like this:
+
+ * Company
+ * ----name (String)
+ * ----address *String)
+ * ----departments (Department, many valued)
+ * ----employee of the month ( Employee - reference)
+
+ * Person
+ * ----name (String)
+
+ * Employee
+ * ----name (String - inherited from Person)
+ * ----cubelocation (String)
+
+ * Manager
+ * ----name (String - inherited from Person)
+ * ----officeid (String)
+
+ * Department
+ * ----name (String)
+ * ----id (Integer)
+ * ---- manager (Manager)
+ * ---- employees (Employee - many valued)
+
+
+ /**
+ * create an object of type Company using the DataFactory
+ */
+
+ DataObjectPtr dor = mdg->create((Type&)tc);
+
+ /**
+ * Set the company name to Acme
+ */
+
+ dor->setCString("name","Acme");
+
+ /**
+ * Set up the two departments - using the
+ * DataObject createDataObject API
+ */
+
+ DataObjectPtr dep1 = dor->createDataObject("departments");
+ dep1->setCString("name","Development");
+ dep1->setInt("id",100);
+
+ DataObjectPtr man1 = dep1->createDataObject("manager");
+ man1->setCString("name","Herve Jones");
+
+ DataObjectPtr dep2= dor->createDataObject("departments");
+ dep2->setCString("name","Marketing");
+ dep2->setInt("id",200);
+
+ DataObjectPtr man2 = dep2->createDataObject("manager");
+ man1->setCString("name","August Phan");
+
+ /**
+ * Give the departments some employees
+ */
+
+ DataObjectPtr emp1 = dep1->createDataObject("employees");
+ emp1->setCString("name","Fred Appleby");
+ emp1->setCString("cubelocation","100-A");
+
+ DataObjectPtr emp2 = dep1->createDataObject("employees");
+ emp2->setCString("name","Jane Bloggs");
+ emp2->setCString("cubelocation","100-B");
+
+ DataObjectPtr emp3 = dep2->createDataObject("employees");
+ emp3->setCString("name","Robin Corbet");
+ emp3->setCString("cubelocation","200-A");
+
+ DataObjectPtr emp4 = dep2->createDataObject("employees");
+ emp4->setCString("name","Martha Denby");
+ emp4->setCString("cubelocation","200-B");
+
+ cout << "Company Name:" << dor->getCString("name") << endl;
+
+ DataObjectList& depts = dor->getList("departments");
+ for (int i=0;i<depts.size();i++)
+ {
+ cout << " Department Name:" << depts[i]->getCString("name") << endl;
+
+ DataObjectList& emps = depts[i]->getList("employees");
+
+ for (int j=0;j<emps.size();j++)
+ {
+ cout << " Employee Name:" << emps[j]->getCString("name") << endl;
+ }
+ }
+ }
+ catch (SDORuntimeException e)
+ {
+ cout << "Exception in ObjectCreation" <<endl;
+ cout << e;
+ }
+ cout << " ********** Sample ends ********************" << endl;
+ return;
+}
+
+
diff --git a/sdo-cpp/trunk/samples/misc/Query.cpp b/sdo-cpp/trunk/samples/misc/Query.cpp
new file mode 100644
index 0000000000..65638aa7d2
--- /dev/null
+++ b/sdo-cpp/trunk/samples/misc/Query.cpp
@@ -0,0 +1,178 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you 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$ */
+
+#include "samples.h"
+using namespace std;
+
+void Query::sample()
+{
+ cout << " ********** Query sample *******************" << endl;
+
+ DataFactoryPtr mdg = DataFactory::getDataFactory();
+
+ /**
+ * Create some types
+ */
+
+ mdg->addType("myspace","Company");
+ mdg->addType("myspace","Department");
+ mdg->addType("myspace","Employee");
+
+
+ /* Now add the properties to the types...*/
+
+
+ const Type& tstring = mdg->getType("commonj.sdo","String");
+ const Type& tbool= mdg->getType("commonj.sdo","Boolean");
+ const Type& tint= mdg->getType("commonj.sdo","Integer");
+
+ const Type& tc = mdg->getType("myspace","Company");
+ const Type& td = mdg->getType("myspace","Department");
+ const Type& te = mdg->getType("myspace","Employee");
+
+ /**
+ * The company
+ */
+
+ mdg->addPropertyToType(tc,"name",tstring); // single string name
+ mdg->addPropertyToType(tc,"departments",
+ td,true); // many departments
+ mdg->addPropertyToType(tc,"employee of the month"
+ , te, false, false, false); // reference to employee
+
+ /**
+ * The department
+ */
+
+ mdg->addPropertyToType(td,"name", tstring); // single string name
+ mdg->addPropertyToType(td,"employees",te,
+ true,false,true); // many employees
+
+
+ /**
+ * The employee
+ */
+
+ mdg->addPropertyToType(te,"isFullTime",tbool);
+ mdg->addPropertyToType(te,"employeeNumber",tint);
+ mdg->addPropertyToType(te,"name",tstring);
+
+
+ const Type& tcc = mdg->getType("myspace","Company");
+
+ DataObjectPtr dor = mdg->create((Type&)tcc);
+
+ // The departments
+
+ DataObjectPtr dept = dor->createDataObject("departments");
+ dept->setCString("name","Shipping");
+
+ DataObjectPtr dept2 = dor->createDataObject("departments");
+ dept2->setCString("name","Buying");
+
+ // The employees
+
+ DataObjectPtr emp1 = dept->createDataObject("employees");
+ DataObjectPtr emp2 = dept->createDataObject("employees");
+ DataObjectPtr emp3 = dept->createDataObject("employees");
+ DataObjectPtr emp4 = dept2->createDataObject("employees");
+
+
+ emp1->setBoolean("isFullTime",true);
+ emp1->setInt("employeeNumber",65443);
+ emp1->setCString("name","Norman");
+
+
+ emp2->setBoolean("isFullTime",false);
+ emp2->setInt("employeeNumber",64778);
+ emp2->setCString("name","Carl");
+
+ emp3->setBoolean("isFullTime",true);
+ emp3->setInt("employeeNumber",61990);
+ emp3->setCString("name","Amanda");
+
+ emp4->setBoolean("isFullTime",true);
+ emp4->setInt("employeeNumber",56789);
+ emp4->setCString("name","Donna");
+
+ dor->setDataObject("employee of the month",emp4); // Donna is referenced.
+
+
+ try {
+
+ // access the first employee of the first department who is not full time
+
+ DataObjectPtr dob1 = dor->getDataObject("departments[1]/employees[isFullTime=false]");
+ cout << "Carl should be the first part timer: " << dob1->getCString("name") << " is." <<endl;
+
+ // get the same employee by index
+
+ DataObjectPtr dob2 = dor->getDataObject("departments[1]/employees[2]");
+ cout << "Carl should be employees[2]:" << dob2->getCString("name") << " is." << endl;
+
+ // use the dot notation to get the same employee
+
+ DataObjectPtr dob3 = dor->getDataObject("departments.0/employees.1");
+ cout << "Carl should be employees.1:" << dob3->getCString("name") << " is." << endl;
+
+ // get the reference...
+
+ DataObjectPtr dob4 = dor->getDataObject("employee of the month");
+ cout << "Donna should be employee of the month:" << dob4->getCString("name") << " is." << endl;
+
+ // And by employee number...
+
+ DataObjectPtr dob5 = dor->getDataObject("departments[2]/employees[employeeNumber=56789]");
+ cout << "Donna should be employee 56789:" << dob5->getCString("name") << " is." << endl;
+
+ // If the query yields no value because the element doesnt exist...
+
+ try
+ {
+ DataObjectPtr dob6 = dor->getDataObject("departments[1]/employees[employeeNumber=56789]");
+ cout << "Did not get the expected exception" << endl;
+ }
+ catch (SDORuntimeException e)
+ {
+ cout << "Expected an IndexOutOfRangeException and got " << e.getEClassName() << endl;
+ }
+
+ // If the query yields no value because the path is invalid...
+
+
+ try
+ {
+ DataObjectPtr dob7 = dor->getDataObject("departments[fish]/employees[0]");
+ cout << "Did not get the expected exception" << endl;
+ }
+ catch (SDORuntimeException e)
+ {
+ cout << "Expected an PathNotFoundException and got " << e.getEClassName() << endl;
+ }
+ }
+ catch (SDORuntimeException e)
+ {
+ cout << "Unexpected error in Query " << e << endl;
+ }
+
+
+ cout << " ********** End Query Sample **************" << endl;
+}
diff --git a/sdo-cpp/trunk/samples/misc/Substitutes.cpp b/sdo-cpp/trunk/samples/misc/Substitutes.cpp
new file mode 100644
index 0000000000..816caee2d5
--- /dev/null
+++ b/sdo-cpp/trunk/samples/misc/Substitutes.cpp
@@ -0,0 +1,121 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you 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$ */
+
+#include "samples.h"
+using namespace std;
+
+void Substitutes::sample()
+{
+ cout << " ********** Substitutes sample *************" << endl;
+ try
+ {
+
+ DataFactoryPtr mdg = DataFactory::getDataFactory();
+ XSDHelperPtr xsh = HelperProvider::getXSDHelper(mdg);
+ xsh->defineFile("companysubs.xsd");
+
+ /**
+ * The companysubs xsd defines some types including a
+ * type which allows substitutions. The PublicationType is
+ * the base of BookType and MagazineType, and the substitutions
+ * are enabled so that properties can be either.
+ */
+
+ const Type& tstring = mdg->getType("commonj.sdo","String");
+ const Type& tcomp = mdg->getType("companyNS","CompanyType");
+ const Type& book = mdg->getType("companyNS","BookType");
+ const Type& mag = mdg->getType("companyNS","MagazineType");
+ const Type& pub = mdg->getType("companyNS","PublicationType");
+
+
+ /**
+ * Create some data to work with
+ */
+
+ DataObjectPtr comp = mdg->create((Type&)tcomp);
+ comp->setCString("name","Puflet Publishing");
+
+
+ DataObjectPtr book1 = mdg->create(book);
+ book1->setCString("author","Mr P B Writer");
+
+ /**
+ * book has a title property because it inherits from Publication
+ */
+ book1->setCString("title","Nowhere Man");
+
+
+ DataObjectPtr mag1 = mdg->create(mag);
+
+ /**
+ * Magazine has an eidtor, and a title inherited from publication
+ */
+
+ mag1->setCString("editor","Mr B Picky");
+ // inherited from publication
+ mag1->setCString("title","Bionicle Weekly");
+
+
+ DataObjectPtr pub1 = mdg->create(pub);
+ pub1->setCString("title","Noddy In Toyland");
+
+
+ /**
+ * The property "Publication" is defined as substitutable, so
+ * any of the book, magazine or publication should be
+ * acceptable values. When the type is queried, the type
+ * returned should correspond to the current type of the
+ * property...
+ */
+
+ comp->setDataObject("Publication",pub1);
+ const Type& tpub1 = comp->getDataObject("Publication")->getType();
+ cout << "Publication is now of type " << tpub1.getName() << endl;
+
+ comp->setDataObject("Publication",book1);
+ const Type& tpub2 = comp->getDataObject("Publication")->getType();
+ cout << "Publication now is of type " << tpub2.getName() << endl;
+
+ comp->setDataObject("Publication",mag1);
+ const Type& tpub3 = comp->getDataObject("Publication")->getType();
+ cout << "Publication now is of type " << tpub3.getName() << endl;
+
+ /**
+ * As the substitutes have names, they act as a sort of
+ * alias, so we can address Publication as Book or Magazine too
+ */
+
+ comp->setDataObject("Book",book1);
+ const Type& tpub4 = comp->getDataObject("Book")->getType();
+ cout << "Book is of type " << tpub4.getName() << endl;
+
+ comp->setDataObject("Magazine",mag1);
+ const Type& tpub5 = comp->getDataObject("Magazine")->getType();
+ cout << "Magazine is of type " << tpub5.getName() << endl;
+
+ }
+ catch (SDORuntimeException e)
+ {
+ cout << "Exception in Substitutes"<< endl;
+ cout<< e;
+ }
+ cout << " ********** Sample ends ********************" << endl;
+}
diff --git a/sdo-cpp/trunk/samples/misc/VSExpress/misc.sln b/sdo-cpp/trunk/samples/misc/VSExpress/misc.sln
new file mode 100644
index 0000000000..a88518bbbd
--- /dev/null
+++ b/sdo-cpp/trunk/samples/misc/VSExpress/misc.sln
@@ -0,0 +1,20 @@
+
+Microsoft Visual Studio Solution File, Format Version 9.00
+# Visual C++ Express 2005
+Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "sdo_misc", "sdo_misc\sdo_misc.vcproj", "{1625B649-C6E1-4A4D-9DDA-EB7CBC3B8AC6}"
+EndProject
+Global
+ GlobalSection(SolutionConfigurationPlatforms) = preSolution
+ Debug|Win32 = Debug|Win32
+ Release|Win32 = Release|Win32
+ EndGlobalSection
+ GlobalSection(ProjectConfigurationPlatforms) = postSolution
+ {1625B649-C6E1-4A4D-9DDA-EB7CBC3B8AC6}.Debug|Win32.ActiveCfg = Debug|Win32
+ {1625B649-C6E1-4A4D-9DDA-EB7CBC3B8AC6}.Debug|Win32.Build.0 = Debug|Win32
+ {1625B649-C6E1-4A4D-9DDA-EB7CBC3B8AC6}.Release|Win32.ActiveCfg = Release|Win32
+ {1625B649-C6E1-4A4D-9DDA-EB7CBC3B8AC6}.Release|Win32.Build.0 = Release|Win32
+ EndGlobalSection
+ GlobalSection(SolutionProperties) = preSolution
+ HideSolutionNode = FALSE
+ EndGlobalSection
+EndGlobal
diff --git a/sdo-cpp/trunk/samples/misc/VSExpress/sdo_misc/sdo_misc.vcproj b/sdo-cpp/trunk/samples/misc/VSExpress/sdo_misc/sdo_misc.vcproj
new file mode 100644
index 0000000000..159d609f95
--- /dev/null
+++ b/sdo-cpp/trunk/samples/misc/VSExpress/sdo_misc/sdo_misc.vcproj
@@ -0,0 +1,245 @@
+<?xml version="1.0" encoding="Windows-1252"?>
+<VisualStudioProject
+ ProjectType="Visual C++"
+ Version="8.00"
+ Name="sdo_misc"
+ ProjectGUID="{1625B649-C6E1-4A4D-9DDA-EB7CBC3B8AC6}"
+ >
+ <Platforms>
+ <Platform
+ Name="Win32"
+ />
+ </Platforms>
+ <ToolFiles>
+ </ToolFiles>
+ <Configurations>
+ <Configuration
+ Name="Debug|Win32"
+ OutputDirectory=".\Debug"
+ IntermediateDirectory=".\Debug"
+ ConfigurationType="1"
+ InheritedPropertySheets="$(VCInstallDir)VCProjectDefaults\UpgradeFromVC60.vsprops"
+ UseOfMFC="0"
+ ATLMinimizesCRunTimeLibraryUsage="false"
+ CharacterSet="2"
+ >
+ <Tool
+ Name="VCPreBuildEventTool"
+ />
+ <Tool
+ Name="VCCustomBuildTool"
+ />
+ <Tool
+ Name="VCXMLDataGeneratorTool"
+ />
+ <Tool
+ Name="VCWebServiceProxyGeneratorTool"
+ />
+ <Tool
+ Name="VCMIDLTool"
+ TypeLibraryName=".\Debug/sdo_misc.tlb"
+ HeaderFileName=""
+ />
+ <Tool
+ Name="VCCLCompilerTool"
+ Optimization="0"
+ AdditionalIncludeDirectories="$(TUSCANY_SDOCPP)\include"
+ PreprocessorDefinitions="WIN32;_DEBUG;_CONSOLE"
+ MinimalRebuild="true"
+ BasicRuntimeChecks="3"
+ RuntimeLibrary="3"
+ PrecompiledHeaderFile=".\Debug/sdo_misc.pch"
+ AssemblerListingLocation=".\Debug/"
+ ObjectFile=".\Debug/"
+ ProgramDataBaseFileName=".\Debug/"
+ WarningLevel="3"
+ SuppressStartupBanner="true"
+ DebugInformationFormat="4"
+ />
+ <Tool
+ Name="VCManagedResourceCompilerTool"
+ />
+ <Tool
+ Name="VCResourceCompilerTool"
+ PreprocessorDefinitions="_DEBUG"
+ Culture="2057"
+ />
+ <Tool
+ Name="VCPreLinkEventTool"
+ />
+ <Tool
+ Name="VCLinkerTool"
+ AdditionalDependencies="tuscany_sdo.lib $(NOINHERIT)"
+ OutputFile=".\Debug/sdo_misc.exe"
+ LinkIncremental="2"
+ SuppressStartupBanner="true"
+ AdditionalLibraryDirectories="$(TUSCANY_SDOCPP)\lib"
+ GenerateDebugInformation="true"
+ ProgramDatabaseFile=".\Debug/sdo_misc.pdb"
+ SubSystem="1"
+ TargetMachine="1"
+ />
+ <Tool
+ Name="VCALinkTool"
+ />
+ <Tool
+ Name="VCManifestTool"
+ />
+ <Tool
+ Name="VCXDCMakeTool"
+ />
+ <Tool
+ Name="VCBscMakeTool"
+ SuppressStartupBanner="true"
+ OutputFile=".\Debug/sdo_misc.bsc"
+ />
+ <Tool
+ Name="VCFxCopTool"
+ />
+ <Tool
+ Name="VCAppVerifierTool"
+ />
+ <Tool
+ Name="VCWebDeploymentTool"
+ />
+ <Tool
+ Name="VCPostBuildEventTool"
+ CommandLine="..\..\deploy.bat ..\..\ Debug"
+ />
+ </Configuration>
+ <Configuration
+ Name="Release|Win32"
+ OutputDirectory=".\Release"
+ IntermediateDirectory=".\Release"
+ ConfigurationType="1"
+ InheritedPropertySheets="$(VCInstallDir)VCProjectDefaults\UpgradeFromVC60.vsprops"
+ UseOfMFC="0"
+ ATLMinimizesCRunTimeLibraryUsage="false"
+ CharacterSet="2"
+ >
+ <Tool
+ Name="VCPreBuildEventTool"
+ />
+ <Tool
+ Name="VCCustomBuildTool"
+ />
+ <Tool
+ Name="VCXMLDataGeneratorTool"
+ />
+ <Tool
+ Name="VCWebServiceProxyGeneratorTool"
+ />
+ <Tool
+ Name="VCMIDLTool"
+ TypeLibraryName=".\Release/sdo_misc.tlb"
+ HeaderFileName=""
+ />
+ <Tool
+ Name="VCCLCompilerTool"
+ Optimization="4"
+ AdditionalIncludeDirectories="$(TUSCANY_SDOCPP)\include"
+ PreprocessorDefinitions="WIN32;NDEBUG;_CONSOLE"
+ RuntimeLibrary="2"
+ PrecompiledHeaderFile=".\Release/sdo_misc.pch"
+ AssemblerListingLocation=".\Release/"
+ ObjectFile=".\Release/"
+ ProgramDataBaseFileName=".\Release/"
+ WarningLevel="3"
+ SuppressStartupBanner="true"
+ />
+ <Tool
+ Name="VCManagedResourceCompilerTool"
+ />
+ <Tool
+ Name="VCResourceCompilerTool"
+ PreprocessorDefinitions="NDEBUG"
+ Culture="2057"
+ />
+ <Tool
+ Name="VCPreLinkEventTool"
+ />
+ <Tool
+ Name="VCLinkerTool"
+ AdditionalDependencies="tuscany_sdo.lib $(NOINHERIT)"
+ OutputFile=".\Release/sdo_misc.exe"
+ LinkIncremental="1"
+ SuppressStartupBanner="true"
+ AdditionalLibraryDirectories="$(TUSCANY_SDOCPP)\lib"
+ ProgramDatabaseFile=".\Release/sdo_misc.pdb"
+ SubSystem="1"
+ TargetMachine="1"
+ />
+ <Tool
+ Name="VCALinkTool"
+ />
+ <Tool
+ Name="VCManifestTool"
+ />
+ <Tool
+ Name="VCXDCMakeTool"
+ />
+ <Tool
+ Name="VCBscMakeTool"
+ SuppressStartupBanner="true"
+ OutputFile=".\Release/sdo_misc.bsc"
+ />
+ <Tool
+ Name="VCFxCopTool"
+ />
+ <Tool
+ Name="VCAppVerifierTool"
+ />
+ <Tool
+ Name="VCWebDeploymentTool"
+ />
+ <Tool
+ Name="VCPostBuildEventTool"
+ CommandLine="..\..\deploy.bat ..\..\ Release"
+ />
+ </Configuration>
+ </Configurations>
+ <References>
+ </References>
+ <Files>
+ <Filter
+ Name="Source Files"
+ Filter="cpp;c;cxx;rc;def;r;odl;idl;hpj;bat"
+ >
+ <File
+ RelativePath="..\..\ChangeSummarySave.cpp"
+ >
+ </File>
+ <File
+ RelativePath="..\..\ObjectCreation.cpp"
+ >
+ </File>
+ <File
+ RelativePath="..\..\Query.cpp"
+ >
+ </File>
+ <File
+ RelativePath="..\..\samples.cpp"
+ >
+ </File>
+ <File
+ RelativePath="..\..\Substitutes.cpp"
+ >
+ </File>
+ <File
+ RelativePath="..\..\XSDLoading.cpp"
+ >
+ </File>
+ </Filter>
+ <Filter
+ Name="Header Files"
+ Filter="h;hpp;hxx;hm;inl"
+ >
+ <File
+ RelativePath="..\..\samples.h"
+ >
+ </File>
+ </Filter>
+ </Files>
+ <Globals>
+ </Globals>
+</VisualStudioProject>
diff --git a/sdo-cpp/trunk/samples/misc/VSExpress/sdo_misc/sdo_misc.vcproj.user b/sdo-cpp/trunk/samples/misc/VSExpress/sdo_misc/sdo_misc.vcproj.user
new file mode 100644
index 0000000000..5b786f64e5
--- /dev/null
+++ b/sdo-cpp/trunk/samples/misc/VSExpress/sdo_misc/sdo_misc.vcproj.user
@@ -0,0 +1,65 @@
+<?xml version="1.0" encoding="Windows-1252"?>
+<VisualStudioUserFile
+ ProjectType="Visual C++"
+ Version="8.00"
+ ShowAllFiles="false"
+ >
+ <Configurations>
+ <Configuration
+ Name="Debug|Win32"
+ >
+ <DebugSettings
+ Command="$(TUSCANY_SDOCPP)\samples\misc\deploy\bin\sdo_misc.exe"
+ WorkingDirectory="$(TUSCANY_SDOCPP)\samples\misc\deploy"
+ CommandArguments=""
+ Attach="false"
+ DebuggerType="3"
+ Remote="1"
+ RemoteMachine=""
+ RemoteCommand=""
+ HttpUrl=""
+ PDBPath=""
+ SQLDebugging=""
+ Environment="PATH=$(TUSCANY_SDOCPP)\bin;%PATH%"
+ EnvironmentMerge="true"
+ DebuggerFlavor="0"
+ MPIRunCommand=""
+ MPIRunArguments=""
+ MPIRunWorkingDirectory=""
+ ApplicationCommand=""
+ ApplicationArguments=""
+ ShimCommand=""
+ MPIAcceptMode=""
+ MPIAcceptFilter=""
+ />
+ </Configuration>
+ <Configuration
+ Name="Release|Win32"
+ >
+ <DebugSettings
+ Command="$(TUSCANY_SDOCPP)\samples\misc\deploy\bin\sdo_misc.exe"
+ WorkingDirectory="$(TUSCANY_SDOCPP)\samples\misc\deploy"
+ CommandArguments=""
+ Attach="false"
+ DebuggerType="3"
+ Remote="1"
+ RemoteMachine=""
+ RemoteCommand=""
+ HttpUrl=""
+ PDBPath=""
+ SQLDebugging=""
+ Environment="PATH=$(TUSCANY_SDOCPP)\bin;%PATH%"
+ EnvironmentMerge="true"
+ DebuggerFlavor="0"
+ MPIRunCommand=""
+ MPIRunArguments=""
+ MPIRunWorkingDirectory=""
+ ApplicationCommand=""
+ ApplicationArguments=""
+ ShimCommand=""
+ MPIAcceptMode=""
+ MPIAcceptFilter=""
+ />
+ </Configuration>
+ </Configurations>
+</VisualStudioUserFile>
diff --git a/sdo-cpp/trunk/samples/misc/XSDLoading.cpp b/sdo-cpp/trunk/samples/misc/XSDLoading.cpp
new file mode 100644
index 0000000000..8462f80f21
--- /dev/null
+++ b/sdo-cpp/trunk/samples/misc/XSDLoading.cpp
@@ -0,0 +1,110 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you 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$ */
+
+#include "samples.h"
+using namespace std;
+
+void XSDLoading::sample()
+{
+ int i,j;
+
+ cout << " ********** XSDLoading Sample **************" << endl;
+ try
+ {
+ DataFactoryPtr mdg = DataFactory::getDataFactory();
+
+ /**
+ * Get an XSD helper to load XSD information into the
+ * data factory
+ */
+
+ XSDHelperPtr myXSDHelper = HelperProvider::getXSDHelper(mdg);
+ myXSDHelper->defineFile("XSDLoading.xsd");
+
+ /**
+ * Check if there were any errors. The parse may still
+ * succeed, but errors indicate some elements were not
+ * understood
+ */
+
+ if ((i = myXSDHelper->getErrorCount()) > 0)
+ {
+ cout << "XSD Loading reported some errors:" << endl;
+ for (j=0;j<i;j++)
+ {
+ const char *m = myXSDHelper->getErrorMessage(j);
+ if (m != 0) cout << m;
+ cout << endl;
+ }
+ }
+
+ /**
+ * Use the same data factory to load XML corresponding to
+ * data objects adhering to the previously loaded schema
+ */
+
+ XMLHelperPtr myXMLHelper = HelperProvider::getXMLHelper(mdg);
+
+ XMLDocumentPtr myXMLDocument = myXMLHelper->loadFile("XSDLoading.xml", "companyNS");
+
+ /**
+ * Check if there were any errors. The parse may still
+ * succeed, but errors indicate some elements did not match
+ * the schema, or were malformed.
+ *
+ */
+
+ if ((i = myXMLHelper->getErrorCount()) > 0)
+ {
+ cout << "XML Loading reported some errors:" << endl;
+ for (j=0;j<i;j++)
+ {
+ const char *m = myXMLHelper->getErrorMessage(j);
+ if (m != 0) cout << m;
+ cout << endl;
+ }
+ }
+
+ DataObjectPtr newdob = myXMLDocument->getRootDataObject();
+
+ cout << "Company Name:" << newdob->getCString("name") << endl;
+
+ DataObjectList& depts = newdob->getList("departments");
+ for (int i=0;i<depts.size();i++)
+ {
+ cout << " Department Name:" << depts[i]->getCString("name") << endl;
+
+ DataObjectList& emps = depts[i]->getList("employees");
+
+ for (int j=0;j<emps.size();j++)
+ {
+ cout << " Employee Name:" << emps[j]->getCString("name") << endl;
+ }
+ }
+
+ }
+ catch (SDORuntimeException e)
+ {
+ cout << "Exception in XSD Loading test" << endl;
+ cout << e;
+ }
+ cout << " ********** Sample ends ********************" << endl;
+}
diff --git a/sdo-cpp/trunk/samples/misc/XSDLoading.xml b/sdo-cpp/trunk/samples/misc/XSDLoading.xml
new file mode 100644
index 0000000000..29ac158654
--- /dev/null
+++ b/sdo-cpp/trunk/samples/misc/XSDLoading.xml
@@ -0,0 +1,30 @@
+<?xml version="1.0" encoding="UTF-8" ?>
+<!--
+ Licensed to the Apache Software Foundation (ASF) under one
+ or more contributor license agreements. See the NOTICE file
+ distributed with this work for additional information
+ regarding copyright ownership. The ASF licenses this file
+ to you 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.
+-->
+
+ <!-- This XML has an employee with an SN of nil, which should appear in the SDO as NULL
+ -->
+ <company xmlns="companyNS" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" name="MegaCorp" employeeOfTheMonth="#/departments.0/employees.1">
+<departments name="Advanced Technologies" location="NY" number="123">
+<employees>
+<name>Jane Doe</name>
+<SN xsi:nil="true" />
+</employees>
+</departments>
+</company> \ No newline at end of file
diff --git a/sdo-cpp/trunk/samples/misc/XSDLoading.xsd b/sdo-cpp/trunk/samples/misc/XSDLoading.xsd
new file mode 100644
index 0000000000..4b7270354c
--- /dev/null
+++ b/sdo-cpp/trunk/samples/misc/XSDLoading.xsd
@@ -0,0 +1,48 @@
+<!--
+ Licensed to the Apache Software Foundation (ASF) under one
+ or more contributor license agreements. See the NOTICE file
+ distributed with this work for additional information
+ regarding copyright ownership. The ASF licenses this file
+ to you 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.
+-->
+
+<!-- This XSD recasts the properties of employee to elements in order to allow the SN property to be nillable -->
+<xsd:schema
+ xmlns:xsd="http://www.w3.org/2001/XMLSchema"
+ xmlns:sdo="commonj.sdo"
+ xmlns:sdoxml="commonj.sdo/xml"
+ xmlns:company="companyNS"
+ targetNamespace="companyNS">
+ <xsd:element name="company" type="company:CompanyType"/>
+ <xsd:complexType name="CompanyType">
+ <xsd:sequence>
+ <xsd:element name="departments" type="company:DepartmentType" maxOccurs="unbounded"/>
+ </xsd:sequence>
+ <xsd:attribute name="name" type="xsd:string"/>
+ <xsd:attribute name="employeeOfTheMonth" type="xsd:IDREF"
+sdoxml:propertyType="company:EmployeeType"/> </xsd:complexType>
+ <xsd:complexType name="DepartmentType">
+ <xsd:sequence>
+ <xsd:element name="employees" type="company:EmployeeType" maxOccurs="unbounded"/>
+ </xsd:sequence>
+ <xsd:attribute name="name" type="xsd:string"/>
+ <xsd:attribute name="location" type="xsd:string"/>
+ <xsd:attribute name="number" type="xsd:int"/>
+ </xsd:complexType>
+ <xsd:complexType name="EmployeeType">
+ <xsd:element name="name" type="xsd:string"/>
+ <xsd:element name="SN" type="xsd:ID" nillable="true"/>
+ <xsd:element name="manager" type="xsd:boolean"/>
+ </xsd:complexType>
+</xsd:schema>
diff --git a/sdo-cpp/trunk/samples/misc/build.bat b/sdo-cpp/trunk/samples/misc/build.bat
new file mode 100644
index 0000000000..c061d8329d
--- /dev/null
+++ b/sdo-cpp/trunk/samples/misc/build.bat
@@ -0,0 +1,40 @@
+@echo off
+@REM Licensed to the Apache Software Foundation (ASF) under one
+@REM or more contributor license agreements. See the NOTICE file
+@REM distributed with this work for additional information
+@REM regarding copyright ownership. The ASF licenses this file
+@REM to you under the Apache License, Version 2.0 (the
+@REM "License"); you may not use this file except in compliance
+@REM with the License. You may obtain a copy of the License at
+@REM
+@REM http://www.apache.org/licenses/LICENSE-2.0
+@REM
+@REM Unless required by applicable law or agreed to in writing,
+@REM software distributed under the License is distributed on an
+@REM "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+@REM KIND, either express or implied. See the License for the
+@REM specific language governing permissions and limitations
+@REM under the License.
+
+setlocal
+
+set config=Release
+if .Debug == .%1 (
+echo Building Debug version
+set config=Debug
+)
+
+if "%TUSCANY_SDOCPP%" == "" (
+echo "TUSCANY_SDOCPP not set"
+goto end
+)
+
+echo using Tuscany SDOCPP: %TUSCANY_SDOCPP%
+
+call vcvars32
+
+call vcbuild VSExpress\misc.sln "%config%|Win32"
+
+
+:end
+endlocal
diff --git a/sdo-cpp/trunk/samples/misc/build.xml b/sdo-cpp/trunk/samples/misc/build.xml
new file mode 100644
index 0000000000..d4720fdb57
--- /dev/null
+++ b/sdo-cpp/trunk/samples/misc/build.xml
@@ -0,0 +1,133 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ Licensed to the Apache Software Foundation (ASF) under one
+ or more contributor license agreements. See the NOTICE file
+ distributed with this work for additional information
+ regarding copyright ownership. The ASF licenses this file
+ to you 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.
+-->
+<project name="TuscanySDONative_Sample_misc" default="all" basedir="../..">
+
+ <import file="${basedir}/antscripts/system.xml"/>
+ <import file="${basedir}/antscripts/compile-targets.xml"/>
+
+ <!--
+ Notice that the basedir for this project is set to the TuscanySDO root dir
+ This makes path setting in system.xml much simpler, but we'll just have to
+ set a property here to this directory.
+ -->
+
+ <target name="init">
+ <tstamp/>
+ <property name="this.dir" location="${basedir}/samples/misc"/>
+ <property name="sample.misc.dir" location="${this.dir}/build"/>
+ <property name="sample.misc.src.dir" location="${this.dir}"/>
+ <property name="sample.misc.build.dir" location="${sample.misc.dir}/build"/>
+ <property name="misc.install.dir"
+ location="${tuscanySDO.install.dir}/samples/misc/bin"/>
+
+
+ </target>
+
+ <!--
+ Public targets
+ -->
+ <target name="all"
+ description="build and install the TuscanySDONative misc sample">
+ <antcall target="build"/>
+ <antcall target="install"/>
+ </target>
+
+ <target name="build"
+ description="build the TuscanySDONative misc sample">
+ <antcall target="build.sample.misc"/>
+ </target>
+
+ <target name="install"
+ description="Install the TuscanySDONative misc sample">
+ <antcall target="install.sample.misc"/>
+ </target>
+
+ <target name="clean"
+ description="Clean the TuscanySDONative misc sample">
+ <antcall target="clean.sample.misc"/>
+
+ </target>
+
+ <target name="distribution" description="Generate the necessary distribution files of misc sample and copy it to the distribution dir">
+ <antcall target="sample.misc.distribution"/>
+ </target>
+
+ <!--
+ Internal targets
+ They can still be called, they're just not described, so wont show up in "ant -p"
+ -->
+
+ <!-- build -->
+
+ <target name="build.sample.misc" depends="init,check.ws">
+ <mkdir dir="${sample.misc.build.dir}"/>
+
+ <copy todir="${sample.misc.build.dir}">
+ <fileset dir="${sample.misc.dir}" includes="*.h"/>
+ <fileset dir="${sample.misc.dir}" includes="*.cpp"/>
+ </copy>
+ <!-- build the library -->
+ <cpp-build
+ srcdir="${sample.misc.src.dir}"
+ infiles="*.cpp"
+ outdir="${sample.misc.build.dir}/.libs"
+ outtype="executable"
+ outfile="misc">
+ <custom-build-elements>
+ <includepath path="${tuscanySDO.install.dir}/include"/>
+ <includepath path="${libxml2.include.dir}"/>
+ <includepath if="windows" path="${iconv.home.dir}/include"/>
+ <libset if="windows" dir="${libxml2.lib.dir}" libs="libxml2"/>
+ <libset unless="windows" dir="${libxml2.lib.dir}" libs="xml2"/>
+
+<libset dir="${tuscanySDO.install.dir}/lib" libs="tuscany_sdo"/>
+ </custom-build-elements>
+ </cpp-build>
+ </target>
+
+
+ <!-- install -->
+
+ <target name="install.sample.misc" depends="init">
+ <cpp-install-files
+ files="*.exe*"
+ srcdir="${sample.misc.dir}/build/.libs/"
+ destdir="${misc.install.dir}"/>
+ <copy todir="${misc.install.dir}" overwrite="true">
+ <fileset dir="${this.dir}" includes="*.xsd, *.xml" excludes="build.xml"/>
+ </copy>
+
+ </target>
+
+ <!-- clean -->
+
+ <target name="clean.sample.misc" depends="init">
+ <delete dir="${sample.misc.dir}" quiet="true"/>
+ </target>
+
+ <target name="sample.misc.distribution">
+ <copy todir="${distribution.bin.dir}/samples/misc" overwrite="true">
+ <fileset dir="${this.dir}/misc" excludes="build/ rsc/ VSExpress/"/>
+ </copy>
+
+
+ </target>
+
+</project>
diff --git a/sdo-cpp/trunk/samples/misc/companysubs.xsd b/sdo-cpp/trunk/samples/misc/companysubs.xsd
new file mode 100644
index 0000000000..5b7e52ed9e
--- /dev/null
+++ b/sdo-cpp/trunk/samples/misc/companysubs.xsd
@@ -0,0 +1,63 @@
+<!--
+ Licensed to the Apache Software Foundation (ASF) under one
+ or more contributor license agreements. See the NOTICE file
+ distributed with this work for additional information
+ regarding copyright ownership. The ASF licenses this file
+ to you 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.
+-->
+
+ <xsd:schema
+ xmlns:xsd="http://www.w3.org/2001/XMLSchema"
+ xmlns:sdo="commonj.sdo"
+ xmlns:sdoxml="commonj.sdo/xml"
+ xmlns:company="companyNS"
+ targetNamespace="companyNS">
+ <xsd:element name="company" type="company:CompanyType"/>
+ <xsd:complexType name="CompanyType">
+ <xsd:sequence>
+ <xsd:element name="departments" type="company:DepartmentType" maxOccurs="unbounded"/>
+ <xsd:element name="Publication" type="company:PublicationType" maxOccurs="1"/>
+ </xsd:sequence>
+ <xsd:attribute name="name" type="xsd:string"/>
+ <xsd:attribute name="cs" type="sdo:ChangeSummaryType"/>
+ <xsd:attribute name="employeeOfTheMonth" type="xsd:IDREF" sdoxml:propertyType="company:EmployeeType"/>
+ </xsd:complexType>
+ <xsd:complexType name="DepartmentType">
+ <xsd:sequence>
+ <xsd:element name="employees" type="company:EmployeeType" maxOccurs="unbounded"/>
+ </xsd:sequence>
+ <xsd:attribute name="name" type="xsd:string"/>
+ <xsd:attribute name="location" type="xsd:string"/>
+ <xsd:attribute name="number" type="xsd:int"/>
+ </xsd:complexType>
+ <xsd:complexType name="EmployeeType">
+ <xsd:attribute name="name" type="xsd:string"/>
+ <xsd:attribute name="SN" type="xsd:ID"/>
+ <xsd:attribute name="manager" type="xsd:boolean"/>
+ </xsd:complexType>
+ <xsd:complexType name="BookType">
+ <xsd:restriction base="company:PublicationType" />
+ <xsd:element name="author" type="xsd:string" maxOccurs="1"/>
+ </xsd:complexType>
+ <xsd:complexType name="MagazineType">
+ <xsd:restriction base="company:PublicationType" />
+ <xsd:element name="editor" type="xsd:string" maxOccurs="1"/>
+ </xsd:complexType>
+ <xsd:complexType name="PublicationType">
+ <xsd:element name="title" type="xsd:string" maxOccurs="1"/>
+ </xsd:complexType>
+ <xsd:element name="Book" type="company:BookType" substitutionGroup="Publication" />
+ <xsd:element name="Magazine" type="company:MagazineType" substitutionGroup="company:Publication" />
+ </xsd:schema>
+
diff --git a/sdo-cpp/trunk/samples/misc/deploy.bat b/sdo-cpp/trunk/samples/misc/deploy.bat
new file mode 100644
index 0000000000..fb2bec5a1f
--- /dev/null
+++ b/sdo-cpp/trunk/samples/misc/deploy.bat
@@ -0,0 +1,52 @@
+@echo off
+
+@REM Licensed to the Apache Software Foundation (ASF) under one
+@REM or more contributor license agreements. See the NOTICE file
+@REM distributed with this work for additional information
+@REM regarding copyright ownership. The ASF licenses this file
+@REM to you under the Apache License, Version 2.0 (the
+@REM "License"); you may not use this file except in compliance
+@REM with the License. You may obtain a copy of the License at
+@REM
+@REM http://www.apache.org/licenses/LICENSE-2.0
+@REM
+@REM Unless required by applicable law or agreed to in writing,
+@REM software distributed under the License is distributed on an
+@REM "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+@REM KIND, either express or implied. See the License for the
+@REM specific language governing permissions and limitations
+@REM under the License.
+
+
+setlocal
+
+if . == .%1 (
+echo sample root not specified
+goto usage
+)
+set deploydir=%TUSCANY_SDOCPP%\samples\misc\deploy
+set srcdir=%1
+
+if . == .%2 (
+echo input directory not specified
+goto usage
+)
+set inpath=%2
+echo %inpath%
+
+if not exist %TUSCANY_SDOCPP%\samples mkdir %TUSCANY_SDOCPP%\samples
+if not exist %TUSCANY_SDOCPP%\samples\misc mkdir %TUSCANY_SDOCPP%\samples\misc
+if not exist %TUSCANY_SDOCPP%\samples\misc\deploy mkdir %TUSCANY_SDOCPP%\samples\misc\deploy
+if not exist %TUSCANY_SDOCPP%\samples\misc\deploy\bin mkdir %TUSCANY_SDOCPP%\samples\misc\deploy\bin
+copy %srcdir%\*.xsd %deploydir%
+copy %srcdir%\*.xml %deploydir%
+
+copy %inpath%\sdo_misc.exe %deploydir%\bin
+if exist %inpath%\sdo_misc.pdb copy %inpath%\sdo_misc.pdb %deploydir%\bin
+
+goto end
+:usage
+echo Usage: deploy <sample-root> <build-output>
+:end
+
+endlocal
diff --git a/sdo-cpp/trunk/samples/misc/samples.cpp b/sdo-cpp/trunk/samples/misc/samples.cpp
new file mode 100644
index 0000000000..4d1ee57c61
--- /dev/null
+++ b/sdo-cpp/trunk/samples/misc/samples.cpp
@@ -0,0 +1,36 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you 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$ */
+
+#include "samples.h"
+
+/**
+ * C main to run the sample
+ */
+
+int main (int argc, char** argv)
+{
+ ObjectCreation::sample();
+ XSDLoading::sample();
+ ChangeSummarySave::sample();
+ Substitutes::sample();
+ Query::sample();
+ return 0;
+}
diff --git a/sdo-cpp/trunk/samples/misc/samples.h b/sdo-cpp/trunk/samples/misc/samples.h
new file mode 100644
index 0000000000..f39cc910f7
--- /dev/null
+++ b/sdo-cpp/trunk/samples/misc/samples.h
@@ -0,0 +1,54 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you 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$ */
+
+#pragma warning(disable:4786)
+
+#include "commonj/sdo/SDO.h"
+
+
+using namespace commonj::sdo;
+
+
+
+class ObjectCreation {
+ public:
+ static void sample();
+};
+
+class XSDLoading {
+ public:
+ static void sample();
+};
+
+class ChangeSummarySave {
+ public:
+ static void sample();
+};
+
+class Substitutes {
+ public:
+ static void sample();
+};
+
+class Query {
+ public:
+ static void sample();
+}; \ No newline at end of file
diff --git a/sdo-cpp/trunk/sdotest.bat b/sdo-cpp/trunk/sdotest.bat
new file mode 100644
index 0000000000..37408c77fe
--- /dev/null
+++ b/sdo-cpp/trunk/sdotest.bat
@@ -0,0 +1,37 @@
+@echo off
+@REM Licensed to the Apache Software Foundation (ASF) under one
+@REM or more contributor license agreements. See the NOTICE file
+@REM distributed with this work for additional information
+@REM regarding copyright ownership. The ASF licenses this file
+@REM to you under the Apache License, Version 2.0 (the
+@REM "License"); you may not use this file except in compliance
+@REM with the License. You may obtain a copy of the License at
+@REM
+@REM http://www.apache.org/licenses/LICENSE-2.0
+@REM
+@REM Unless required by applicable law or agreed to in writing,
+@REM software distributed under the License is distributed on an
+@REM "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+@REM KIND, either express or implied. See the License for the
+@REM specific language governing permissions and limitations
+@REM under the License.
+
+@setlocal
+
+set buildtype=Release
+if .%1 == .Debug (
+ set buildtype=Debug
+)
+
+set TUSCANY_SDOCPP=%cd%\deploy
+
+echo using TUSCANY_SDOCPP: %TUSCANY_SDOCPP%
+
+set PATH=%TUSCANY_SDOCPP%\bin;%PATH%
+
+set SDOTESTPATH=%cd%\vsexpress\tuscany_sdo\sdo_test\%buildtype%
+cd runtime\core\test
+"%SDOTESTPATH%\sdo_test"
+
+:end
+@endlocal
diff --git a/sdo-cpp/trunk/sdotest.sh b/sdo-cpp/trunk/sdotest.sh
new file mode 100755
index 0000000000..e55a02395d
--- /dev/null
+++ b/sdo-cpp/trunk/sdotest.sh
@@ -0,0 +1,35 @@
+#!/bin/sh
+
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements. See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership. The ASF licenses this file
+# to you 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.
+
+APFULLDIR=`pwd`
+export SDO4CPP_HOME="$APFULLDIR"
+if [ x$TUSCANY_SDOCPP = x ]; then
+export TUSCANY_SDOCPP="$SDO4CPP_HOME"
+fi
+
+echo "Using SDO installed at $TUSCANY_SDOCPP"
+
+if [ `uname -s` = Darwin ]
+then
+ export DYLD_LIBRARY_PATH=$TUSCANY_SDOCPP/lib:$DYLD_LIBRARY_PATH
+else
+ export LD_LIBRARY_PATH=$TUSCANY_SDOCPP/lib:$LD_LIBRARY_PATH
+fi
+cd runtime/core/test
+./tuscany_sdo_test