Skip to main content
summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--plugins/org.eclipse.emf.cdo.common/.classpath7
-rw-r--r--plugins/org.eclipse.emf.cdo.common/.cvsignore2
-rw-r--r--plugins/org.eclipse.emf.cdo.common/.options12
-rw-r--r--plugins/org.eclipse.emf.cdo.common/.project28
-rw-r--r--plugins/org.eclipse.emf.cdo.common/.settings/org.eclipse.jdt.core.prefs271
-rw-r--r--plugins/org.eclipse.emf.cdo.common/.settings/org.eclipse.jdt.ui.prefs65
-rw-r--r--plugins/org.eclipse.emf.cdo.common/.settings/org.eclipse.mylyn.tasks.ui.prefs4
-rw-r--r--plugins/org.eclipse.emf.cdo.common/.settings/org.eclipse.mylyn.team.ui.prefs3
-rw-r--r--plugins/org.eclipse.emf.cdo.common/META-INF/MANIFEST.MF31
-rw-r--r--plugins/org.eclipse.emf.cdo.common/about.html28
-rw-r--r--plugins/org.eclipse.emf.cdo.common/build.properties21
-rw-r--r--plugins/org.eclipse.emf.cdo.common/copyright.txt8
-rw-r--r--plugins/org.eclipse.emf.cdo.common/epl-v10.html319
-rw-r--r--plugins/org.eclipse.emf.cdo.common/license.html319
-rw-r--r--plugins/org.eclipse.emf.cdo.common/plugin.properties25
-rw-r--r--plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/common/CDOProtocol.java21
-rw-r--r--plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/common/CDOProtocolConstants.java59
-rw-r--r--plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/common/CDOProtocolSession.java27
-rw-r--r--plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/common/CDOProtocolView.java31
-rw-r--r--plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/common/analyzer/CDOFetchRule.java89
-rw-r--r--plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/common/id/CDOID.java49
-rw-r--r--plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/common/id/CDOIDLibraryDescriptor.java27
-rw-r--r--plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/common/id/CDOIDLibraryProvider.java24
-rw-r--r--plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/common/id/CDOIDMeta.java19
-rw-r--r--plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/common/id/CDOIDMetaRange.java39
-rw-r--r--plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/common/id/CDOIDObject.java23
-rw-r--r--plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/common/id/CDOIDObjectFactory.java27
-rw-r--r--plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/common/id/CDOIDProvider.java19
-rw-r--r--plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/common/id/CDOIDTemp.java19
-rw-r--r--plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/common/id/CDOIDUtil.java260
-rw-r--r--plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/common/model/CDOClass.java55
-rw-r--r--plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/common/model/CDOClassProxy.java100
-rw-r--r--plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/common/model/CDOClassRef.java23
-rw-r--r--plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/common/model/CDOFeature.java35
-rw-r--r--plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/common/model/CDOModelElement.java25
-rw-r--r--plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/common/model/CDOModelUtil.java151
-rw-r--r--plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/common/model/CDOPackage.java51
-rw-r--r--plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/common/model/CDOPackageInfo.java57
-rw-r--r--plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/common/model/CDOPackageManager.java35
-rw-r--r--plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/common/model/CDOType.java80
-rw-r--r--plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/common/model/core/CDOCorePackage.java25
-rw-r--r--plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/common/model/core/CDOObjectClass.java23
-rw-r--r--plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/common/model/resource/CDOContentsFeature.java23
-rw-r--r--plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/common/model/resource/CDOPathFeature.java23
-rw-r--r--plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/common/model/resource/CDOResourceClass.java27
-rw-r--r--plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/common/model/resource/CDOResourcePackage.java26
-rw-r--r--plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/common/revision/CDOReferenceProxy.java28
-rw-r--r--plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/common/revision/CDORevision.java59
-rw-r--r--plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/common/revision/CDORevisionData.java48
-rw-r--r--plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/common/revision/CDORevisionResolver.java64
-rw-r--r--plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/common/revision/CDORevisionUtil.java71
-rw-r--r--plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/common/revision/delta/CDOAddFeatureDelta.java22
-rw-r--r--plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/common/revision/delta/CDOClearFeatureDelta.java19
-rw-r--r--plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/common/revision/delta/CDOContainerFeatureDelta.java24
-rw-r--r--plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/common/revision/delta/CDOFeatureDelta.java37
-rw-r--r--plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/common/revision/delta/CDOFeatureDeltaHandler.java19
-rw-r--r--plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/common/revision/delta/CDOFeatureDeltaVisitor.java34
-rw-r--r--plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/common/revision/delta/CDOListFeatureDelta.java22
-rw-r--r--plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/common/revision/delta/CDOMoveFeatureDelta.java22
-rw-r--r--plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/common/revision/delta/CDORemoveFeatureDelta.java20
-rw-r--r--plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/common/revision/delta/CDORevisionDelta.java41
-rw-r--r--plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/common/revision/delta/CDORevisionDeltaUtil.java44
-rw-r--r--plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/common/revision/delta/CDOSetFeatureDelta.java22
-rw-r--r--plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/common/revision/delta/CDOUnsetFeatureDelta.java19
-rw-r--r--plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/common/util/CDOException.java38
-rw-r--r--plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/common/util/CDOGZIPStreamWrapperInjector.java26
-rw-r--r--plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/common/util/CDOXORStreamWrapperInjector.java28
-rw-r--r--plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/common/util/TransportException.java38
-rw-r--r--plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/internal/common/CDOProtocolImpl.java37
-rw-r--r--plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/internal/common/bundle/OM.java60
-rw-r--r--plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/internal/common/id/CDOIDMetaImpl.java38
-rw-r--r--plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/internal/common/id/CDOIDMetaRangeImpl.java118
-rw-r--r--plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/internal/common/id/CDOIDNullImpl.java89
-rw-r--r--plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/internal/common/id/CDOIDTempMetaImpl.java38
-rw-r--r--plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/internal/common/id/CDOIDTempObjectImpl.java38
-rw-r--r--plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/internal/common/model/CDOClassImpl.java455
-rw-r--r--plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/internal/common/model/CDOClassRefImpl.java86
-rw-r--r--plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/internal/common/model/CDOFeatureImpl.java275
-rw-r--r--plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/internal/common/model/CDOModelElementImpl.java114
-rw-r--r--plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/internal/common/model/CDOPackageImpl.java395
-rw-r--r--plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/internal/common/model/CDOPackageManagerImpl.java144
-rw-r--r--plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/internal/common/model/CDOTypeImpl.java472
-rw-r--r--plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/internal/common/model/core/CDOCorePackageImpl.java46
-rw-r--r--plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/internal/common/model/core/CDOObjectClassImpl.java32
-rw-r--r--plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/internal/common/model/resource/CDOContentsFeatureImpl.java29
-rw-r--r--plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/internal/common/model/resource/CDOPathFeatureImpl.java27
-rw-r--r--plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/internal/common/model/resource/CDOResourceClassImpl.java49
-rw-r--r--plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/internal/common/model/resource/CDOResourcePackageImpl.java46
-rw-r--r--plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/internal/common/revision/CDOReferenceProxyImpl.java65
-rw-r--r--plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/internal/common/revision/CDORevisionImpl.java814
-rw-r--r--plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/internal/common/revision/CDORevisionResolverImpl.java528
-rw-r--r--plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/internal/common/revision/DLRevisionHolder.java56
-rw-r--r--plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/internal/common/revision/DLRevisionList.java222
-rw-r--r--plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/internal/common/revision/LRURevisionHolder.java63
-rw-r--r--plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/internal/common/revision/LRURevisionList.java66
-rw-r--r--plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/internal/common/revision/RevisionHolder.java142
-rw-r--r--plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/internal/common/revision/delta/CDOAddFeatureDeltaImpl.java72
-rw-r--r--plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/internal/common/revision/delta/CDOClearFeatureDeltaImpl.java63
-rw-r--r--plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/internal/common/revision/delta/CDOContainerFeatureDeltaImpl.java197
-rw-r--r--plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/internal/common/revision/delta/CDOFeatureDeltaImpl.java87
-rw-r--r--plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/internal/common/revision/delta/CDOFeatureDeltaVisitorImpl.java69
-rw-r--r--plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/internal/common/revision/delta/CDOListFeatureDeltaImpl.java126
-rw-r--r--plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/internal/common/revision/delta/CDOMoveFeatureDeltaImpl.java123
-rw-r--r--plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/internal/common/revision/delta/CDORemoveFeatureDeltaImpl.java103
-rw-r--r--plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/internal/common/revision/delta/CDORevisionDeltaImpl.java261
-rw-r--r--plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/internal/common/revision/delta/CDORevisionMerger.java84
-rw-r--r--plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/internal/common/revision/delta/CDOSetFeatureDeltaImpl.java55
-rw-r--r--plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/internal/common/revision/delta/CDOSingleValueFeatureDeltaImpl.java82
-rw-r--r--plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/internal/common/revision/delta/CDOUnsetFeatureDeltaImpl.java63
-rw-r--r--plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/internal/common/revision/delta/IListIndexAffecting.java22
-rw-r--r--plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/internal/common/revision/delta/IListTargetAdding.java19
-rw-r--r--plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/spi/common/AbstractCDOID.java94
-rw-r--r--plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/spi/common/AbstractCDOIDInteger.java99
-rw-r--r--plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/spi/common/AbstractCDOIDLong.java100
-rw-r--r--plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/spi/common/CDOIDLibraryDescriptorImpl.java123
-rw-r--r--plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/spi/common/CDOIDLibraryProviderImpl.java95
-rw-r--r--plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/spi/common/CDOIDLongFactoryImpl.java63
-rw-r--r--plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/spi/common/CDOIDLongImpl.java106
-rw-r--r--plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/spi/common/InternalCDOClass.java35
-rw-r--r--plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/spi/common/InternalCDOFeature.java33
-rw-r--r--plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/spi/common/InternalCDOModelElement.java36
-rw-r--r--plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/spi/common/InternalCDOPackage.java36
-rw-r--r--plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/spi/common/InternalCDORevision.java72
-rw-r--r--plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/spi/common/InternalCDORevisionDelta.java28
-rw-r--r--plugins/org.eclipse.emf.cdo.server.db/META-INF/MANIFEST.MF17
-rw-r--r--plugins/org.eclipse.emf.cdo.server.db/plugin.properties25
-rw-r--r--plugins/org.eclipse.emf.cdo.server.db/src/org/eclipse/emf/cdo/server/db/IAttributeMapping.java29
-rw-r--r--plugins/org.eclipse.emf.cdo.server.db/src/org/eclipse/emf/cdo/server/db/IClassMapping.java50
-rw-r--r--plugins/org.eclipse.emf.cdo.server.db/src/org/eclipse/emf/cdo/server/db/IDBStoreReader.java22
-rw-r--r--plugins/org.eclipse.emf.cdo.server.db/src/org/eclipse/emf/cdo/server/db/IFeatureMapping.java23
-rw-r--r--plugins/org.eclipse.emf.cdo.server.db/src/org/eclipse/emf/cdo/server/db/IMappingStrategy.java51
-rw-r--r--plugins/org.eclipse.emf.cdo.server.db/src/org/eclipse/emf/cdo/server/db/IObjectTypeCache.java25
-rw-r--r--plugins/org.eclipse.emf.cdo.server.db/src/org/eclipse/emf/cdo/server/db/IReferenceMapping.java32
-rw-r--r--plugins/org.eclipse.emf.cdo.server.db/src/org/eclipse/emf/cdo/server/internal/db/AttributeMapping.java275
-rw-r--r--plugins/org.eclipse.emf.cdo.server.db/src/org/eclipse/emf/cdo/server/internal/db/CDODBSchema.java205
-rw-r--r--plugins/org.eclipse.emf.cdo.server.db/src/org/eclipse/emf/cdo/server/internal/db/ClassMapping.java615
-rw-r--r--plugins/org.eclipse.emf.cdo.server.db/src/org/eclipse/emf/cdo/server/internal/db/ClassServerInfo.java79
-rw-r--r--plugins/org.eclipse.emf.cdo.server.db/src/org/eclipse/emf/cdo/server/internal/db/DBStore.java400
-rw-r--r--plugins/org.eclipse.emf.cdo.server.db/src/org/eclipse/emf/cdo/server/internal/db/DBStoreAccessor.java170
-rw-r--r--plugins/org.eclipse.emf.cdo.server.db/src/org/eclipse/emf/cdo/server/internal/db/DBStoreChunkReader.java75
-rw-r--r--plugins/org.eclipse.emf.cdo.server.db/src/org/eclipse/emf/cdo/server/internal/db/DBStoreReader.java293
-rw-r--r--plugins/org.eclipse.emf.cdo.server.db/src/org/eclipse/emf/cdo/server/internal/db/DBStoreWriter.java203
-rw-r--r--plugins/org.eclipse.emf.cdo.server.db/src/org/eclipse/emf/cdo/server/internal/db/FeatureMapping.java46
-rw-r--r--plugins/org.eclipse.emf.cdo.server.db/src/org/eclipse/emf/cdo/server/internal/db/FeatureServerInfo.java32
-rw-r--r--plugins/org.eclipse.emf.cdo.server.db/src/org/eclipse/emf/cdo/server/internal/db/HorizontalClassMapping.java51
-rw-r--r--plugins/org.eclipse.emf.cdo.server.db/src/org/eclipse/emf/cdo/server/internal/db/HorizontalMappingStrategy.java166
-rw-r--r--plugins/org.eclipse.emf.cdo.server.db/src/org/eclipse/emf/cdo/server/internal/db/MappingStrategy.java377
-rw-r--r--plugins/org.eclipse.emf.cdo.server.db/src/org/eclipse/emf/cdo/server/internal/db/NoClassMapping.java95
-rw-r--r--plugins/org.eclipse.emf.cdo.server.db/src/org/eclipse/emf/cdo/server/internal/db/ObjectIDIterator.java123
-rw-r--r--plugins/org.eclipse.emf.cdo.server.db/src/org/eclipse/emf/cdo/server/internal/db/ObjectTypeCache.java167
-rw-r--r--plugins/org.eclipse.emf.cdo.server.db/src/org/eclipse/emf/cdo/server/internal/db/PackageServerInfo.java46
-rw-r--r--plugins/org.eclipse.emf.cdo.server.db/src/org/eclipse/emf/cdo/server/internal/db/ReferenceMapping.java297
-rw-r--r--plugins/org.eclipse.emf.cdo.server.db/src/org/eclipse/emf/cdo/server/internal/db/RootClassMapping.java42
-rw-r--r--plugins/org.eclipse.emf.cdo.server.db/src/org/eclipse/emf/cdo/server/internal/db/ServerInfo.java37
-rw-r--r--plugins/org.eclipse.emf.cdo.server.db/src/org/eclipse/emf/cdo/server/internal/db/ToOneReferenceMapping.java34
-rw-r--r--plugins/org.eclipse.emf.cdo.server.db/src/org/eclipse/emf/cdo/server/internal/db/VerticalClassMapping.java75
-rw-r--r--plugins/org.eclipse.emf.cdo.server.db/src/org/eclipse/emf/cdo/server/internal/db/VerticalMappingStrategy.java65
-rw-r--r--plugins/org.eclipse.emf.cdo.tests.mango/META-INF/MANIFEST.MF16
-rw-r--r--plugins/org.eclipse.emf.cdo.tests.mango/plugin.properties25
-rw-r--r--plugins/org.eclipse.emf.cdo.tests.mango/src/org/eclipse/emf/cdo/tests/mango/MangoPackage.java239
-rw-r--r--plugins/org.eclipse.emf.cdo.tests.mango/src/org/eclipse/emf/cdo/tests/mango/Value.java53
-rw-r--r--plugins/org.eclipse.emf.cdo.tests.mango/src/org/eclipse/emf/cdo/tests/mango/ValueList.java72
-rw-r--r--plugins/org.eclipse.emf.cdo.tests.mango/src/org/eclipse/emf/cdo/tests/mango/impl/MangoPackageImpl.java239
-rw-r--r--plugins/org.eclipse.emf.cdo.tests.mango/src/org/eclipse/emf/cdo/tests/mango/impl/ValueListImpl.java95
-rw-r--r--plugins/org.eclipse.emf.cdo.tests.mango/src/org/eclipse/emf/cdo/tests/mango/util/MangoAdapterFactory.java149
-rw-r--r--plugins/org.eclipse.emf.cdo.tests.mango/src/org/eclipse/emf/cdo/tests/mango/util/MangoSwitch.java157
-rw-r--r--plugins/org.eclipse.emf.cdo.tests.model1/META-INF/MANIFEST.MF14
-rw-r--r--plugins/org.eclipse.emf.cdo.tests.model1/plugin.properties25
-rw-r--r--plugins/org.eclipse.emf.cdo.tests.model1/src/org/eclipse/emf/cdo/tests/model1/Address.java107
-rw-r--r--plugins/org.eclipse.emf.cdo.tests.model1/src/org/eclipse/emf/cdo/tests/model1/Category.java89
-rw-r--r--plugins/org.eclipse.emf.cdo.tests.model1/src/org/eclipse/emf/cdo/tests/model1/Company.java110
-rw-r--r--plugins/org.eclipse.emf.cdo.tests.model1/src/org/eclipse/emf/cdo/tests/model1/Customer.java44
-rw-r--r--plugins/org.eclipse.emf.cdo.tests.model1/src/org/eclipse/emf/cdo/tests/model1/Model1Package.java1402
-rw-r--r--plugins/org.eclipse.emf.cdo.tests.model1/src/org/eclipse/emf/cdo/tests/model1/Order.java47
-rw-r--r--plugins/org.eclipse.emf.cdo.tests.model1/src/org/eclipse/emf/cdo/tests/model1/OrderAddress.java51
-rw-r--r--plugins/org.eclipse.emf.cdo.tests.model1/src/org/eclipse/emf/cdo/tests/model1/OrderDetail.java113
-rw-r--r--plugins/org.eclipse.emf.cdo.tests.model1/src/org/eclipse/emf/cdo/tests/model1/Product.java104
-rw-r--r--plugins/org.eclipse.emf.cdo.tests.model1/src/org/eclipse/emf/cdo/tests/model1/PurchaseOrder.java83
-rw-r--r--plugins/org.eclipse.emf.cdo.tests.model1/src/org/eclipse/emf/cdo/tests/model1/SalesOrder.java80
-rw-r--r--plugins/org.eclipse.emf.cdo.tests.model1/src/org/eclipse/emf/cdo/tests/model1/Supplier.java73
-rw-r--r--plugins/org.eclipse.emf.cdo.tests.model1/src/org/eclipse/emf/cdo/tests/model1/VAT.java243
-rw-r--r--plugins/org.eclipse.emf.cdo.tests.model1/src/org/eclipse/emf/cdo/tests/model1/impl/Model1PackageImpl.java790
-rw-r--r--plugins/org.eclipse.emf.cdo.tests.model1/src/org/eclipse/emf/cdo/tests/model1/impl/OrderAddressImpl.java217
-rw-r--r--plugins/org.eclipse.emf.cdo.tests.model1/src/org/eclipse/emf/cdo/tests/model1/impl/OrderDetailImpl.java125
-rw-r--r--plugins/org.eclipse.emf.cdo.tests.model1/src/org/eclipse/emf/cdo/tests/model1/impl/PurchaseOrderImpl.java92
-rw-r--r--plugins/org.eclipse.emf.cdo.tests.model1/src/org/eclipse/emf/cdo/tests/model1/impl/SalesOrderImpl.java90
-rw-r--r--plugins/org.eclipse.emf.cdo.tests.model1/src/org/eclipse/emf/cdo/tests/model1/util/Model1AdapterFactory.java338
-rw-r--r--plugins/org.eclipse.emf.cdo.tests.model1/src/org/eclipse/emf/cdo/tests/model1/util/Model1Switch.java372
-rw-r--r--plugins/org.eclipse.emf.cdo.tests.model1/src/org/eclipse/emf/cdo/tests/model1/validation/OrderValidator.java24
-rw-r--r--plugins/org.eclipse.emf.cdo.tests.model2/META-INF/MANIFEST.MF16
-rw-r--r--plugins/org.eclipse.emf.cdo.tests.model2/plugin.properties20
-rw-r--r--plugins/org.eclipse.emf.cdo.tests.model2/src/org/eclipse/emf/cdo/tests/model2/Model2Package.java205
-rw-r--r--plugins/org.eclipse.emf.cdo.tests.model2/src/org/eclipse/emf/cdo/tests/model2/SpecialPurchaseOrder.java83
-rw-r--r--plugins/org.eclipse.emf.cdo.tests.model2/src/org/eclipse/emf/cdo/tests/model2/impl/Model2PackageImpl.java214
-rw-r--r--plugins/org.eclipse.emf.cdo.tests.model2/src/org/eclipse/emf/cdo/tests/model2/impl/SpecialPurchaseOrderImpl.java93
-rw-r--r--plugins/org.eclipse.emf.cdo.tests.model2/src/org/eclipse/emf/cdo/tests/model2/util/Model2AdapterFactory.java171
-rw-r--r--plugins/org.eclipse.emf.cdo.tests.model2/src/org/eclipse/emf/cdo/tests/model2/util/Model2Switch.java169
-rw-r--r--plugins/org.eclipse.emf.cdo.tests.model3/META-INF/MANIFEST.MF19
-rw-r--r--plugins/org.eclipse.emf.cdo.tests.model3/plugin.properties25
-rw-r--r--plugins/org.eclipse.emf.cdo.tests.model3/src/org/eclipse/emf/cdo/tests/model3/Class1.java48
-rw-r--r--plugins/org.eclipse.emf.cdo.tests.model3/src/org/eclipse/emf/cdo/tests/model3/Model3Package.java146
-rw-r--r--plugins/org.eclipse.emf.cdo.tests.model3/src/org/eclipse/emf/cdo/tests/model3/impl/Model3PackageImpl.java206
-rw-r--r--plugins/org.eclipse.emf.cdo.tests.model3/src/org/eclipse/emf/cdo/tests/model3/subpackage/Class2.java48
-rw-r--r--plugins/org.eclipse.emf.cdo.tests.model3/src/org/eclipse/emf/cdo/tests/model3/subpackage/SubpackagePackage.java147
-rw-r--r--plugins/org.eclipse.emf.cdo.tests.model3/src/org/eclipse/emf/cdo/tests/model3/subpackage/impl/SubpackagePackageImpl.java199
-rw-r--r--plugins/org.eclipse.emf.cdo.tests.model3/src/org/eclipse/emf/cdo/tests/model3/subpackage/util/SubpackageAdapterFactory.java128
-rw-r--r--plugins/org.eclipse.emf.cdo.tests.model3/src/org/eclipse/emf/cdo/tests/model3/subpackage/util/SubpackageSwitch.java134
-rw-r--r--plugins/org.eclipse.emf.cdo.tests.model3/src/org/eclipse/emf/cdo/tests/model3/util/Model3Switch.java134
208 files changed, 22395 insertions, 0 deletions
diff --git a/plugins/org.eclipse.emf.cdo.common/.classpath b/plugins/org.eclipse.emf.cdo.common/.classpath
new file mode 100644
index 0000000000..64c5e31b7a
--- /dev/null
+++ b/plugins/org.eclipse.emf.cdo.common/.classpath
@@ -0,0 +1,7 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<classpath>
+ <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/J2SE-1.5"/>
+ <classpathentry kind="con" path="org.eclipse.pde.core.requiredPlugins"/>
+ <classpathentry kind="src" path="src"/>
+ <classpathentry kind="output" path="bin"/>
+</classpath>
diff --git a/plugins/org.eclipse.emf.cdo.common/.cvsignore b/plugins/org.eclipse.emf.cdo.common/.cvsignore
new file mode 100644
index 0000000000..693869726d
--- /dev/null
+++ b/plugins/org.eclipse.emf.cdo.common/.cvsignore
@@ -0,0 +1,2 @@
+bin
+doc
diff --git a/plugins/org.eclipse.emf.cdo.common/.options b/plugins/org.eclipse.emf.cdo.common/.options
new file mode 100644
index 0000000000..aa9a2fe4f7
--- /dev/null
+++ b/plugins/org.eclipse.emf.cdo.common/.options
@@ -0,0 +1,12 @@
+# Debugging and tracing options
+
+org.eclipse.emf.cdo.common/debug = true
+org.eclipse.emf.cdo.common/debug.protocol = true
+org.eclipse.emf.cdo.common/debug.id = true
+org.eclipse.emf.cdo.common/debug.model = true
+org.eclipse.emf.cdo.common/debug.revision= true
+
+org.eclipse.emf.cdo.common/perf = false
+org.eclipse.emf.cdo.common/perf.revision = false
+org.eclipse.emf.cdo.common/perf.revision.reading = false
+org.eclipse.emf.cdo.common/perf.revision.writing = false
diff --git a/plugins/org.eclipse.emf.cdo.common/.project b/plugins/org.eclipse.emf.cdo.common/.project
new file mode 100644
index 0000000000..0a3ede0bd0
--- /dev/null
+++ b/plugins/org.eclipse.emf.cdo.common/.project
@@ -0,0 +1,28 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<projectDescription>
+ <name>org.eclipse.emf.cdo.common</name>
+ <comment></comment>
+ <projects>
+ </projects>
+ <buildSpec>
+ <buildCommand>
+ <name>org.eclipse.jdt.core.javabuilder</name>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ <buildCommand>
+ <name>org.eclipse.pde.ManifestBuilder</name>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ <buildCommand>
+ <name>org.eclipse.pde.SchemaBuilder</name>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ </buildSpec>
+ <natures>
+ <nature>org.eclipse.pde.PluginNature</nature>
+ <nature>org.eclipse.jdt.core.javanature</nature>
+ </natures>
+</projectDescription>
diff --git a/plugins/org.eclipse.emf.cdo.common/.settings/org.eclipse.jdt.core.prefs b/plugins/org.eclipse.emf.cdo.common/.settings/org.eclipse.jdt.core.prefs
new file mode 100644
index 0000000000..37f8e9c2be
--- /dev/null
+++ b/plugins/org.eclipse.emf.cdo.common/.settings/org.eclipse.jdt.core.prefs
@@ -0,0 +1,271 @@
+#Mon Mar 03 16:35:09 CET 2008
+eclipse.preferences.version=1
+org.eclipse.jdt.core.codeComplete.argumentPrefixes=
+org.eclipse.jdt.core.codeComplete.argumentSuffixes=
+org.eclipse.jdt.core.codeComplete.fieldPrefixes=
+org.eclipse.jdt.core.codeComplete.fieldSuffixes=
+org.eclipse.jdt.core.codeComplete.localPrefixes=
+org.eclipse.jdt.core.codeComplete.localSuffixes=
+org.eclipse.jdt.core.codeComplete.staticFieldPrefixes=
+org.eclipse.jdt.core.codeComplete.staticFieldSuffixes=
+org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.5
+org.eclipse.jdt.core.compiler.compliance=1.5
+org.eclipse.jdt.core.compiler.problem.assertIdentifier=error
+org.eclipse.jdt.core.compiler.problem.enumIdentifier=error
+org.eclipse.jdt.core.compiler.source=1.5
+org.eclipse.jdt.core.formatter.align_type_members_on_columns=false
+org.eclipse.jdt.core.formatter.alignment_for_arguments_in_allocation_expression=16
+org.eclipse.jdt.core.formatter.alignment_for_arguments_in_enum_constant=16
+org.eclipse.jdt.core.formatter.alignment_for_arguments_in_explicit_constructor_call=16
+org.eclipse.jdt.core.formatter.alignment_for_arguments_in_method_invocation=16
+org.eclipse.jdt.core.formatter.alignment_for_arguments_in_qualified_allocation_expression=16
+org.eclipse.jdt.core.formatter.alignment_for_assignment=0
+org.eclipse.jdt.core.formatter.alignment_for_binary_expression=16
+org.eclipse.jdt.core.formatter.alignment_for_compact_if=16
+org.eclipse.jdt.core.formatter.alignment_for_conditional_expression=80
+org.eclipse.jdt.core.formatter.alignment_for_enum_constants=0
+org.eclipse.jdt.core.formatter.alignment_for_expressions_in_array_initializer=16
+org.eclipse.jdt.core.formatter.alignment_for_multiple_fields=16
+org.eclipse.jdt.core.formatter.alignment_for_parameters_in_constructor_declaration=16
+org.eclipse.jdt.core.formatter.alignment_for_parameters_in_method_declaration=16
+org.eclipse.jdt.core.formatter.alignment_for_selector_in_method_invocation=16
+org.eclipse.jdt.core.formatter.alignment_for_superclass_in_type_declaration=16
+org.eclipse.jdt.core.formatter.alignment_for_superinterfaces_in_enum_declaration=16
+org.eclipse.jdt.core.formatter.alignment_for_superinterfaces_in_type_declaration=16
+org.eclipse.jdt.core.formatter.alignment_for_throws_clause_in_constructor_declaration=16
+org.eclipse.jdt.core.formatter.alignment_for_throws_clause_in_method_declaration=16
+org.eclipse.jdt.core.formatter.blank_lines_after_imports=1
+org.eclipse.jdt.core.formatter.blank_lines_after_package=1
+org.eclipse.jdt.core.formatter.blank_lines_before_field=1
+org.eclipse.jdt.core.formatter.blank_lines_before_first_class_body_declaration=0
+org.eclipse.jdt.core.formatter.blank_lines_before_imports=1
+org.eclipse.jdt.core.formatter.blank_lines_before_member_type=1
+org.eclipse.jdt.core.formatter.blank_lines_before_method=1
+org.eclipse.jdt.core.formatter.blank_lines_before_new_chunk=1
+org.eclipse.jdt.core.formatter.blank_lines_before_package=0
+org.eclipse.jdt.core.formatter.blank_lines_between_import_groups=1
+org.eclipse.jdt.core.formatter.blank_lines_between_type_declarations=1
+org.eclipse.jdt.core.formatter.brace_position_for_annotation_type_declaration=next_line
+org.eclipse.jdt.core.formatter.brace_position_for_anonymous_type_declaration=next_line
+org.eclipse.jdt.core.formatter.brace_position_for_array_initializer=end_of_line
+org.eclipse.jdt.core.formatter.brace_position_for_block=next_line
+org.eclipse.jdt.core.formatter.brace_position_for_block_in_case=next_line
+org.eclipse.jdt.core.formatter.brace_position_for_constructor_declaration=next_line
+org.eclipse.jdt.core.formatter.brace_position_for_enum_constant=next_line
+org.eclipse.jdt.core.formatter.brace_position_for_enum_declaration=next_line
+org.eclipse.jdt.core.formatter.brace_position_for_method_declaration=next_line
+org.eclipse.jdt.core.formatter.brace_position_for_switch=next_line
+org.eclipse.jdt.core.formatter.brace_position_for_type_declaration=next_line
+org.eclipse.jdt.core.formatter.comment.clear_blank_lines_in_block_comment=true
+org.eclipse.jdt.core.formatter.comment.clear_blank_lines_in_javadoc_comment=true
+org.eclipse.jdt.core.formatter.comment.format_block_comments=true
+org.eclipse.jdt.core.formatter.comment.format_header=false
+org.eclipse.jdt.core.formatter.comment.format_html=true
+org.eclipse.jdt.core.formatter.comment.format_javadoc_comments=true
+org.eclipse.jdt.core.formatter.comment.format_line_comments=true
+org.eclipse.jdt.core.formatter.comment.format_source_code=true
+org.eclipse.jdt.core.formatter.comment.indent_parameter_description=true
+org.eclipse.jdt.core.formatter.comment.indent_root_tags=true
+org.eclipse.jdt.core.formatter.comment.insert_new_line_before_root_tags=insert
+org.eclipse.jdt.core.formatter.comment.insert_new_line_for_parameter=insert
+org.eclipse.jdt.core.formatter.comment.line_length=120
+org.eclipse.jdt.core.formatter.compact_else_if=true
+org.eclipse.jdt.core.formatter.continuation_indentation=2
+org.eclipse.jdt.core.formatter.continuation_indentation_for_array_initializer=2
+org.eclipse.jdt.core.formatter.format_guardian_clause_on_one_line=false
+org.eclipse.jdt.core.formatter.indent_body_declarations_compare_to_annotation_declaration_header=true
+org.eclipse.jdt.core.formatter.indent_body_declarations_compare_to_enum_constant_header=true
+org.eclipse.jdt.core.formatter.indent_body_declarations_compare_to_enum_declaration_header=true
+org.eclipse.jdt.core.formatter.indent_body_declarations_compare_to_type_header=true
+org.eclipse.jdt.core.formatter.indent_breaks_compare_to_cases=true
+org.eclipse.jdt.core.formatter.indent_empty_lines=false
+org.eclipse.jdt.core.formatter.indent_statements_compare_to_block=true
+org.eclipse.jdt.core.formatter.indent_statements_compare_to_body=true
+org.eclipse.jdt.core.formatter.indent_switchstatements_compare_to_cases=true
+org.eclipse.jdt.core.formatter.indent_switchstatements_compare_to_switch=false
+org.eclipse.jdt.core.formatter.indentation.size=2
+org.eclipse.jdt.core.formatter.insert_new_line_after_annotation_on_local_variable=insert
+org.eclipse.jdt.core.formatter.insert_new_line_after_annotation_on_member=insert
+org.eclipse.jdt.core.formatter.insert_new_line_after_annotation_on_parameter=do not insert
+org.eclipse.jdt.core.formatter.insert_new_line_after_opening_brace_in_array_initializer=do not insert
+org.eclipse.jdt.core.formatter.insert_new_line_at_end_of_file_if_missing=insert
+org.eclipse.jdt.core.formatter.insert_new_line_before_catch_in_try_statement=insert
+org.eclipse.jdt.core.formatter.insert_new_line_before_closing_brace_in_array_initializer=do not insert
+org.eclipse.jdt.core.formatter.insert_new_line_before_else_in_if_statement=insert
+org.eclipse.jdt.core.formatter.insert_new_line_before_finally_in_try_statement=insert
+org.eclipse.jdt.core.formatter.insert_new_line_before_while_in_do_statement=do not insert
+org.eclipse.jdt.core.formatter.insert_new_line_in_empty_annotation_declaration=insert
+org.eclipse.jdt.core.formatter.insert_new_line_in_empty_anonymous_type_declaration=insert
+org.eclipse.jdt.core.formatter.insert_new_line_in_empty_block=insert
+org.eclipse.jdt.core.formatter.insert_new_line_in_empty_enum_constant=insert
+org.eclipse.jdt.core.formatter.insert_new_line_in_empty_enum_declaration=insert
+org.eclipse.jdt.core.formatter.insert_new_line_in_empty_method_body=insert
+org.eclipse.jdt.core.formatter.insert_new_line_in_empty_type_declaration=insert
+org.eclipse.jdt.core.formatter.insert_space_after_and_in_type_parameter=insert
+org.eclipse.jdt.core.formatter.insert_space_after_assignment_operator=insert
+org.eclipse.jdt.core.formatter.insert_space_after_at_in_annotation=do not insert
+org.eclipse.jdt.core.formatter.insert_space_after_at_in_annotation_type_declaration=do not insert
+org.eclipse.jdt.core.formatter.insert_space_after_binary_operator=insert
+org.eclipse.jdt.core.formatter.insert_space_after_closing_angle_bracket_in_type_arguments=insert
+org.eclipse.jdt.core.formatter.insert_space_after_closing_angle_bracket_in_type_parameters=insert
+org.eclipse.jdt.core.formatter.insert_space_after_closing_brace_in_block=insert
+org.eclipse.jdt.core.formatter.insert_space_after_closing_paren_in_cast=do not insert
+org.eclipse.jdt.core.formatter.insert_space_after_colon_in_assert=insert
+org.eclipse.jdt.core.formatter.insert_space_after_colon_in_case=insert
+org.eclipse.jdt.core.formatter.insert_space_after_colon_in_conditional=insert
+org.eclipse.jdt.core.formatter.insert_space_after_colon_in_for=insert
+org.eclipse.jdt.core.formatter.insert_space_after_colon_in_labeled_statement=insert
+org.eclipse.jdt.core.formatter.insert_space_after_comma_in_allocation_expression=insert
+org.eclipse.jdt.core.formatter.insert_space_after_comma_in_annotation=insert
+org.eclipse.jdt.core.formatter.insert_space_after_comma_in_array_initializer=insert
+org.eclipse.jdt.core.formatter.insert_space_after_comma_in_constructor_declaration_parameters=insert
+org.eclipse.jdt.core.formatter.insert_space_after_comma_in_constructor_declaration_throws=insert
+org.eclipse.jdt.core.formatter.insert_space_after_comma_in_enum_constant_arguments=insert
+org.eclipse.jdt.core.formatter.insert_space_after_comma_in_enum_declarations=insert
+org.eclipse.jdt.core.formatter.insert_space_after_comma_in_explicitconstructorcall_arguments=insert
+org.eclipse.jdt.core.formatter.insert_space_after_comma_in_for_increments=insert
+org.eclipse.jdt.core.formatter.insert_space_after_comma_in_for_inits=insert
+org.eclipse.jdt.core.formatter.insert_space_after_comma_in_method_declaration_parameters=insert
+org.eclipse.jdt.core.formatter.insert_space_after_comma_in_method_declaration_throws=insert
+org.eclipse.jdt.core.formatter.insert_space_after_comma_in_method_invocation_arguments=insert
+org.eclipse.jdt.core.formatter.insert_space_after_comma_in_multiple_field_declarations=insert
+org.eclipse.jdt.core.formatter.insert_space_after_comma_in_multiple_local_declarations=insert
+org.eclipse.jdt.core.formatter.insert_space_after_comma_in_parameterized_type_reference=insert
+org.eclipse.jdt.core.formatter.insert_space_after_comma_in_superinterfaces=insert
+org.eclipse.jdt.core.formatter.insert_space_after_comma_in_type_arguments=insert
+org.eclipse.jdt.core.formatter.insert_space_after_comma_in_type_parameters=insert
+org.eclipse.jdt.core.formatter.insert_space_after_ellipsis=insert
+org.eclipse.jdt.core.formatter.insert_space_after_opening_angle_bracket_in_parameterized_type_reference=do not insert
+org.eclipse.jdt.core.formatter.insert_space_after_opening_angle_bracket_in_type_arguments=do not insert
+org.eclipse.jdt.core.formatter.insert_space_after_opening_angle_bracket_in_type_parameters=do not insert
+org.eclipse.jdt.core.formatter.insert_space_after_opening_brace_in_array_initializer=insert
+org.eclipse.jdt.core.formatter.insert_space_after_opening_bracket_in_array_allocation_expression=do not insert
+org.eclipse.jdt.core.formatter.insert_space_after_opening_bracket_in_array_reference=do not insert
+org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_annotation=do not insert
+org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_cast=do not insert
+org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_catch=do not insert
+org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_constructor_declaration=do not insert
+org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_enum_constant=do not insert
+org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_for=do not insert
+org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_if=do not insert
+org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_method_declaration=do not insert
+org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_method_invocation=do not insert
+org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_parenthesized_expression=do not insert
+org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_switch=do not insert
+org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_synchronized=do not insert
+org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_while=do not insert
+org.eclipse.jdt.core.formatter.insert_space_after_postfix_operator=do not insert
+org.eclipse.jdt.core.formatter.insert_space_after_prefix_operator=do not insert
+org.eclipse.jdt.core.formatter.insert_space_after_question_in_conditional=insert
+org.eclipse.jdt.core.formatter.insert_space_after_question_in_wildcard=do not insert
+org.eclipse.jdt.core.formatter.insert_space_after_semicolon_in_for=insert
+org.eclipse.jdt.core.formatter.insert_space_after_unary_operator=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_and_in_type_parameter=insert
+org.eclipse.jdt.core.formatter.insert_space_before_assignment_operator=insert
+org.eclipse.jdt.core.formatter.insert_space_before_at_in_annotation_type_declaration=insert
+org.eclipse.jdt.core.formatter.insert_space_before_binary_operator=insert
+org.eclipse.jdt.core.formatter.insert_space_before_closing_angle_bracket_in_parameterized_type_reference=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_closing_angle_bracket_in_type_arguments=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_closing_angle_bracket_in_type_parameters=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_closing_brace_in_array_initializer=insert
+org.eclipse.jdt.core.formatter.insert_space_before_closing_bracket_in_array_allocation_expression=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_closing_bracket_in_array_reference=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_annotation=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_cast=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_catch=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_constructor_declaration=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_enum_constant=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_for=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_if=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_method_declaration=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_method_invocation=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_parenthesized_expression=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_switch=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_synchronized=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_while=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_colon_in_assert=insert
+org.eclipse.jdt.core.formatter.insert_space_before_colon_in_case=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_colon_in_conditional=insert
+org.eclipse.jdt.core.formatter.insert_space_before_colon_in_default=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_colon_in_for=insert
+org.eclipse.jdt.core.formatter.insert_space_before_colon_in_labeled_statement=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_comma_in_allocation_expression=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_comma_in_annotation=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_comma_in_array_initializer=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_comma_in_constructor_declaration_parameters=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_comma_in_constructor_declaration_throws=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_comma_in_enum_constant_arguments=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_comma_in_enum_declarations=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_comma_in_explicitconstructorcall_arguments=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_comma_in_for_increments=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_comma_in_for_inits=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_comma_in_method_declaration_parameters=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_comma_in_method_declaration_throws=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_comma_in_method_invocation_arguments=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_comma_in_multiple_field_declarations=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_comma_in_multiple_local_declarations=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_comma_in_parameterized_type_reference=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_comma_in_superinterfaces=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_comma_in_type_arguments=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_comma_in_type_parameters=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_ellipsis=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_angle_bracket_in_parameterized_type_reference=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_angle_bracket_in_type_arguments=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_angle_bracket_in_type_parameters=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_annotation_type_declaration=insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_anonymous_type_declaration=insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_array_initializer=insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_block=insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_constructor_declaration=insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_enum_constant=insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_enum_declaration=insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_method_declaration=insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_switch=insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_type_declaration=insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_bracket_in_array_allocation_expression=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_bracket_in_array_reference=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_bracket_in_array_type_reference=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_annotation=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_annotation_type_member_declaration=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_catch=insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_constructor_declaration=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_enum_constant=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_for=insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_if=insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_method_declaration=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_method_invocation=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_parenthesized_expression=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_switch=insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_synchronized=insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_while=insert
+org.eclipse.jdt.core.formatter.insert_space_before_parenthesized_expression_in_return=insert
+org.eclipse.jdt.core.formatter.insert_space_before_parenthesized_expression_in_throw=insert
+org.eclipse.jdt.core.formatter.insert_space_before_postfix_operator=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_prefix_operator=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_question_in_conditional=insert
+org.eclipse.jdt.core.formatter.insert_space_before_question_in_wildcard=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_semicolon=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_semicolon_in_for=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_unary_operator=do not insert
+org.eclipse.jdt.core.formatter.insert_space_between_brackets_in_array_type_reference=do not insert
+org.eclipse.jdt.core.formatter.insert_space_between_empty_braces_in_array_initializer=do not insert
+org.eclipse.jdt.core.formatter.insert_space_between_empty_brackets_in_array_allocation_expression=do not insert
+org.eclipse.jdt.core.formatter.insert_space_between_empty_parens_in_annotation_type_member_declaration=do not insert
+org.eclipse.jdt.core.formatter.insert_space_between_empty_parens_in_constructor_declaration=do not insert
+org.eclipse.jdt.core.formatter.insert_space_between_empty_parens_in_enum_constant=do not insert
+org.eclipse.jdt.core.formatter.insert_space_between_empty_parens_in_method_declaration=do not insert
+org.eclipse.jdt.core.formatter.insert_space_between_empty_parens_in_method_invocation=do not insert
+org.eclipse.jdt.core.formatter.keep_else_statement_on_same_line=false
+org.eclipse.jdt.core.formatter.keep_empty_array_initializer_on_one_line=false
+org.eclipse.jdt.core.formatter.keep_imple_if_on_one_line=true
+org.eclipse.jdt.core.formatter.keep_then_statement_on_same_line=false
+org.eclipse.jdt.core.formatter.lineSplit=120
+org.eclipse.jdt.core.formatter.never_indent_block_comments_on_first_column=false
+org.eclipse.jdt.core.formatter.never_indent_line_comments_on_first_column=false
+org.eclipse.jdt.core.formatter.number_of_blank_lines_at_beginning_of_method_body=0
+org.eclipse.jdt.core.formatter.number_of_empty_lines_to_preserve=1
+org.eclipse.jdt.core.formatter.put_empty_statement_on_new_line=true
+org.eclipse.jdt.core.formatter.tabulation.char=space
+org.eclipse.jdt.core.formatter.tabulation.size=2
+org.eclipse.jdt.core.formatter.use_tabs_only_for_leading_indentations=false
+org.eclipse.jdt.core.formatter.wrap_before_binary_operator=true
diff --git a/plugins/org.eclipse.emf.cdo.common/.settings/org.eclipse.jdt.ui.prefs b/plugins/org.eclipse.emf.cdo.common/.settings/org.eclipse.jdt.ui.prefs
new file mode 100644
index 0000000000..6c777bd10a
--- /dev/null
+++ b/plugins/org.eclipse.emf.cdo.common/.settings/org.eclipse.jdt.ui.prefs
@@ -0,0 +1,65 @@
+#Sat Feb 23 10:46:43 CET 2008
+cleanup.add_default_serial_version_id=true
+cleanup.add_generated_serial_version_id=false
+cleanup.add_missing_annotations=true
+cleanup.add_missing_deprecated_annotations=true
+cleanup.add_missing_methods=false
+cleanup.add_missing_nls_tags=false
+cleanup.add_missing_override_annotations=true
+cleanup.add_serial_version_id=true
+cleanup.always_use_blocks=true
+cleanup.always_use_parentheses_in_expressions=false
+cleanup.always_use_this_for_non_static_field_access=false
+cleanup.always_use_this_for_non_static_method_access=false
+cleanup.convert_to_enhanced_for_loop=false
+cleanup.correct_indentation=true
+cleanup.format_source_code=true
+cleanup.format_source_code_changes_only=false
+cleanup.make_local_variable_final=true
+cleanup.make_parameters_final=false
+cleanup.make_private_fields_final=true
+cleanup.make_variable_declarations_final=false
+cleanup.never_use_blocks=false
+cleanup.never_use_parentheses_in_expressions=true
+cleanup.organize_imports=true
+cleanup.qualify_static_field_accesses_with_declaring_class=false
+cleanup.qualify_static_member_accesses_through_instances_with_declaring_class=true
+cleanup.qualify_static_member_accesses_through_subtypes_with_declaring_class=true
+cleanup.qualify_static_member_accesses_with_declaring_class=false
+cleanup.qualify_static_method_accesses_with_declaring_class=false
+cleanup.remove_private_constructors=true
+cleanup.remove_trailing_whitespaces=true
+cleanup.remove_trailing_whitespaces_all=true
+cleanup.remove_trailing_whitespaces_ignore_empty=false
+cleanup.remove_unnecessary_casts=true
+cleanup.remove_unnecessary_nls_tags=true
+cleanup.remove_unused_imports=true
+cleanup.remove_unused_local_variables=false
+cleanup.remove_unused_private_fields=true
+cleanup.remove_unused_private_members=false
+cleanup.remove_unused_private_methods=true
+cleanup.remove_unused_private_types=true
+cleanup.sort_members=false
+cleanup.sort_members_all=false
+cleanup.use_blocks=true
+cleanup.use_blocks_only_for_return_and_throw=false
+cleanup.use_parentheses_in_expressions=true
+cleanup.use_this_for_non_static_field_access=true
+cleanup.use_this_for_non_static_field_access_only_if_necessary=true
+cleanup.use_this_for_non_static_method_access=true
+cleanup.use_this_for_non_static_method_access_only_if_necessary=true
+cleanup_profile=_EMFT
+cleanup_settings_version=2
+eclipse.preferences.version=1
+formatter_profile=_EMFT
+formatter_settings_version=11
+org.eclipse.jdt.ui.exception.name=ex
+org.eclipse.jdt.ui.gettersetter.use.is=true
+org.eclipse.jdt.ui.ignorelowercasenames=true
+org.eclipse.jdt.ui.importorder=org.eclipse.emf.cdo;org.eclipse.emf.internal.cdo;org.eclipse.net4j;org.eclipse.internal.net4j;org.eclipse.emf;org.eclipse;com;org;javax;java;
+org.eclipse.jdt.ui.javadoc=true
+org.eclipse.jdt.ui.keywordthis=false
+org.eclipse.jdt.ui.ondemandthreshold=99
+org.eclipse.jdt.ui.overrideannotation=true
+org.eclipse.jdt.ui.staticondemandthreshold=99
+org.eclipse.jdt.ui.text.custom_code_templates=<?xml version\="1.0" encoding\="UTF-8" standalone\="no"?><templates><template autoinsert\="false" context\="gettercomment_context" deleted\="false" description\="Comment for getter method" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.gettercomment" name\="gettercomment"/><template autoinsert\="false" context\="settercomment_context" deleted\="false" description\="Comment for setter method" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.settercomment" name\="settercomment"/><template autoinsert\="false" context\="constructorcomment_context" deleted\="false" description\="Comment for created constructors" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.constructorcomment" name\="constructorcomment"/><template autoinsert\="false" context\="filecomment_context" deleted\="false" description\="Comment for created Java files" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.filecomment" name\="filecomment">/***************************************************************************\r\n * Copyright (c) 2004 - 2008 Eike Stepper, Germany.\r\n * All rights reserved. This program and the accompanying materials\r\n * are made available under the terms of the Eclipse Public License v1.0\r\n * which accompanies this distribution, and is available at\r\n * http\://www.eclipse.org/legal/epl-v10.html\r\n * \r\n * Contributors\:\r\n * Eike Stepper - initial API and implementation\r\n **************************************************************************/</template><template autoinsert\="false" context\="typecomment_context" deleted\="false" description\="Comment for created types" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.typecomment" name\="typecomment">/**\r\n * @author Eike Stepper\r\n */</template><template autoinsert\="false" context\="fieldcomment_context" deleted\="false" description\="Comment for fields" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.fieldcomment" name\="fieldcomment"/><template autoinsert\="false" context\="methodcomment_context" deleted\="false" description\="Comment for non-overriding methods" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.methodcomment" name\="methodcomment"/><template autoinsert\="false" context\="overridecomment_context" deleted\="false" description\="Comment for overriding methods" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.overridecomment" name\="overridecomment"/><template autoinsert\="false" context\="delegatecomment_context" deleted\="false" description\="Comment for delegate methods" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.delegatecomment" name\="delegatecomment"/><template autoinsert\="true" context\="newtype_context" deleted\="false" description\="Newly created files" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.newtype" name\="newtype">${filecomment}\r\n${package_declaration}\r\n\r\n${typecomment}\r\n${type_declaration}</template><template autoinsert\="true" context\="classbody_context" deleted\="false" description\="Code in new class type bodies" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.classbody" name\="classbody">\r\n</template><template autoinsert\="true" context\="interfacebody_context" deleted\="false" description\="Code in new interface type bodies" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.interfacebody" name\="interfacebody">\r\n</template><template autoinsert\="true" context\="enumbody_context" deleted\="false" description\="Code in new enum type bodies" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.enumbody" name\="enumbody">\r\n</template><template autoinsert\="true" context\="annotationbody_context" deleted\="false" description\="Code in new annotation type bodies" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.annotationbody" name\="annotationbody">\r\n</template><template autoinsert\="false" context\="catchblock_context" deleted\="false" description\="Code in new catch blocks" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.catchblock" name\="catchblock">${exception_var}.printStackTrace();</template><template autoinsert\="false" context\="methodbody_context" deleted\="false" description\="Code in created method stubs" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.methodbody" name\="methodbody">${body_statement}</template><template autoinsert\="false" context\="constructorbody_context" deleted\="false" description\="Code in created constructor stubs" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.constructorbody" name\="constructorbody">${body_statement}</template><template autoinsert\="true" context\="getterbody_context" deleted\="false" description\="Code in created getters" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.getterbody" name\="getterbody">return ${field};</template><template autoinsert\="true" context\="setterbody_context" deleted\="false" description\="Code in created setters" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.setterbody" name\="setterbody">${field} \= ${param};</template></templates>
diff --git a/plugins/org.eclipse.emf.cdo.common/.settings/org.eclipse.mylyn.tasks.ui.prefs b/plugins/org.eclipse.emf.cdo.common/.settings/org.eclipse.mylyn.tasks.ui.prefs
new file mode 100644
index 0000000000..2e5351b740
--- /dev/null
+++ b/plugins/org.eclipse.emf.cdo.common/.settings/org.eclipse.mylyn.tasks.ui.prefs
@@ -0,0 +1,4 @@
+#Sun Mar 09 19:10:00 CET 2008
+eclipse.preferences.version=1
+project.repository.kind=bugzilla
+project.repository.url=https\://bugs.eclipse.org/bugs
diff --git a/plugins/org.eclipse.emf.cdo.common/.settings/org.eclipse.mylyn.team.ui.prefs b/plugins/org.eclipse.emf.cdo.common/.settings/org.eclipse.mylyn.team.ui.prefs
new file mode 100644
index 0000000000..fe4457ab48
--- /dev/null
+++ b/plugins/org.eclipse.emf.cdo.common/.settings/org.eclipse.mylyn.team.ui.prefs
@@ -0,0 +1,3 @@
+#Sun Mar 09 19:10:00 CET 2008
+commit.comment.template=[${task.id}] ${task.description} \r\n${task.url}
+eclipse.preferences.version=1
diff --git a/plugins/org.eclipse.emf.cdo.common/META-INF/MANIFEST.MF b/plugins/org.eclipse.emf.cdo.common/META-INF/MANIFEST.MF
new file mode 100644
index 0000000000..8027e18644
--- /dev/null
+++ b/plugins/org.eclipse.emf.cdo.common/META-INF/MANIFEST.MF
@@ -0,0 +1,31 @@
+Manifest-Version: 1.0
+Bundle-ManifestVersion: 2
+Bundle-SymbolicName: org.eclipse.emf.cdo.common
+Bundle-Version: 1.0.0.qualifier
+Bundle-Name: %pluginName
+Bundle-Vendor: %providerName
+Bundle-Localization: plugin
+Bundle-ActivationPolicy: lazy
+Bundle-Activator: org.eclipse.emf.cdo.internal.common.bundle.OM$Activator
+Bundle-RequiredExecutionEnvironment: J2SE-1.5
+Bundle-ClassPath: .
+Require-Bundle: org.eclipse.net4j;bundle-version="[1.0.0,2.0.0)";visibility:=reexport
+Import-Package: org.osgi.framework;version="1.3.0";resolution:=optional
+Export-Package: org.eclipse.emf.cdo.common;version="1.0.0",
+ org.eclipse.emf.cdo.common.analyzer;version="1.0.0",
+ org.eclipse.emf.cdo.common.id;version="1.0.0",
+ org.eclipse.emf.cdo.common.model;version="1.0.0",
+ org.eclipse.emf.cdo.common.model.core;version="1.0.0",
+ org.eclipse.emf.cdo.common.model.resource;version="1.0.0",
+ org.eclipse.emf.cdo.common.revision;version="1.0.0",
+ org.eclipse.emf.cdo.common.revision.delta;version="1.0.0",
+ org.eclipse.emf.cdo.common.util;version="1.0.0",
+ org.eclipse.emf.cdo.internal.common;version="1.0.0";x-friends:="org.eclipse.emf.cdo.tests,org.eclipse.emf.cdo,org.eclipse.emf.cdo.server",
+ org.eclipse.emf.cdo.internal.common.bundle;version="1.0.0";x-internal:=true,
+ org.eclipse.emf.cdo.internal.common.id;version="1.0.0";x-friends:="org.eclipse.emf.cdo.tests,org.eclipse.emf.cdo,org.eclipse.emf.cdo.server",
+ org.eclipse.emf.cdo.internal.common.model;version="1.0.0";x-friends:="org.eclipse.emf.cdo.tests,org.eclipse.emf.cdo,org.eclipse.emf.cdo.server",
+ org.eclipse.emf.cdo.internal.common.model.core;version="1.0.0";x-friends:="org.eclipse.emf.cdo.tests,org.eclipse.emf.cdo,org.eclipse.emf.cdo.server",
+ org.eclipse.emf.cdo.internal.common.model.resource;version="1.0.0";x-friends:="org.eclipse.emf.cdo.tests,org.eclipse.emf.cdo,org.eclipse.emf.cdo.server",
+ org.eclipse.emf.cdo.internal.common.revision;version="1.0.0";x-friends:="org.eclipse.emf.cdo.tests,org.eclipse.emf.cdo,org.eclipse.emf.cdo.server",
+ org.eclipse.emf.cdo.internal.common.revision.delta;version="1.0.0";x-friends:="org.eclipse.emf.cdo.tests,org.eclipse.emf.cdo,org.eclipse.emf.cdo.server",
+ org.eclipse.emf.cdo.spi.common;version="1.0.0"
diff --git a/plugins/org.eclipse.emf.cdo.common/about.html b/plugins/org.eclipse.emf.cdo.common/about.html
new file mode 100644
index 0000000000..d35d5aed64
--- /dev/null
+++ b/plugins/org.eclipse.emf.cdo.common/about.html
@@ -0,0 +1,28 @@
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
+ "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
+<html xmlns="http://www.w3.org/1999/xhtml">
+<head>
+<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1"/>
+<title>About</title>
+</head>
+<body lang="EN-US">
+<h2>About This Content</h2>
+
+<p>June 5, 2007</p>
+<h3>License</h3>
+
+<p>The Eclipse Foundation makes available all content in this plug-in (&quot;Content&quot;). Unless otherwise
+indicated below, the Content is provided to you under the terms and conditions of the
+Eclipse Public License Version 1.0 (&quot;EPL&quot;). A copy of the EPL is available
+at <a href="http://www.eclipse.org/legal/epl-v10.html">http://www.eclipse.org/legal/epl-v10.html</a>.
+For purposes of the EPL, &quot;Program&quot; will mean the Content.</p>
+
+<p>If you did not receive this Content directly from the Eclipse Foundation, the Content is
+being redistributed by another party (&quot;Redistributor&quot;) and different terms and conditions may
+apply to your use of any object code in the Content. Check the Redistributor's license that was
+provided with the Content. If no such license exists, contact the Redistributor. Unless otherwise
+indicated below, the terms and conditions of the EPL still apply to any source code in the Content
+and such source code may be obtained at <a href="http://www.eclipse.org/">http://www.eclipse.org</a>.</p>
+
+</body>
+</html>
diff --git a/plugins/org.eclipse.emf.cdo.common/build.properties b/plugins/org.eclipse.emf.cdo.common/build.properties
new file mode 100644
index 0000000000..eb76b6604c
--- /dev/null
+++ b/plugins/org.eclipse.emf.cdo.common/build.properties
@@ -0,0 +1,21 @@
+# Copyright (c) 2004 - 2008 Eike Stepper, Germany.
+# All rights reserved. This program and the accompanying materials
+# are made available under the terms of the Eclipse Public License v1.0
+# which accompanies this distribution, and is available at
+# http://www.eclipse.org/legal/epl-v10.html
+#
+# Contributors:
+# Eike Stepper - initial API and implementation
+
+# NLS_MESSAGEFORMAT_VAR
+
+source.. = src/
+output.. = bin/
+bin.includes = META-INF/,\
+ .,\
+ about.html,\
+ copyright.txt,\
+ epl-v10.html,\
+ license.html,\
+ plugin.properties,\
+ .options
diff --git a/plugins/org.eclipse.emf.cdo.common/copyright.txt b/plugins/org.eclipse.emf.cdo.common/copyright.txt
new file mode 100644
index 0000000000..529118d99e
--- /dev/null
+++ b/plugins/org.eclipse.emf.cdo.common/copyright.txt
@@ -0,0 +1,8 @@
+Copyright (c) 2004 - 2008 Eike Stepper, Germany.
+All rights reserved. This program and the accompanying materials
+are made available under the terms of the Eclipse Public License v1.0
+which accompanies this distribution, and is available at
+http://www.eclipse.org/legal/epl-v10.html
+
+Contributors:
+ Eike Stepper - initial API and implementation \ No newline at end of file
diff --git a/plugins/org.eclipse.emf.cdo.common/epl-v10.html b/plugins/org.eclipse.emf.cdo.common/epl-v10.html
new file mode 100644
index 0000000000..d7b88e9416
--- /dev/null
+++ b/plugins/org.eclipse.emf.cdo.common/epl-v10.html
@@ -0,0 +1,319 @@
+<html xmlns:o="urn:schemas-microsoft-com:office:office" xmlns:w="urn:schemas-microsoft-com:office:word" xmlns="http://www.w3.org/TR/REC-html40"><head>
+<meta http-equiv="Content-Type" content="text/html; charset=windows-1252">
+<meta name="ProgId" content="Word.Document">
+<meta name="Generator" content="Microsoft Word 9">
+<meta name="Originator" content="Microsoft Word 9">
+<link rel="File-List" href="http://www.eclipse.org/org/documents/Eclipse%20EPL%202003_11_10%20Final_files/filelist.xml"><title>Eclipse Public License - Version 1.0</title><!--[if gte mso 9]><xml>
+ <o:DocumentProperties>
+ <o:Revision>2</o:Revision>
+ <o:TotalTime>3</o:TotalTime>
+ <o:Created>2004-03-05T23:03:00Z</o:Created>
+ <o:LastSaved>2004-03-05T23:03:00Z</o:LastSaved>
+ <o:Pages>4</o:Pages>
+ <o:Words>1626</o:Words>
+ <o:Characters>9270</o:Characters>
+ <o:Lines>77</o:Lines>
+ <o:Paragraphs>18</o:Paragraphs>
+ <o:CharactersWithSpaces>11384</o:CharactersWithSpaces>
+ <o:Version>9.4402</o:Version>
+ </o:DocumentProperties>
+</xml><![endif]--><!--[if gte mso 9]><xml>
+ <w:WordDocument>
+ <w:TrackRevisions/>
+ </w:WordDocument>
+</xml><![endif]-->
+
+
+<style>
+<!--
+ /* Font Definitions */
+@font-face
+ {font-family:Tahoma;
+ panose-1:2 11 6 4 3 5 4 4 2 4;
+ mso-font-charset:0;
+ mso-generic-font-family:swiss;
+ mso-font-pitch:variable;
+ mso-font-signature:553679495 -2147483648 8 0 66047 0;}
+ /* Style Definitions */
+p.MsoNormal, li.MsoNormal, div.MsoNormal
+ {mso-style-parent:"";
+ margin:0in;
+ margin-bottom:.0001pt;
+ mso-pagination:widow-orphan;
+ font-size:12.0pt;
+ font-family:"Times New Roman";
+ mso-fareast-font-family:"Times New Roman";}
+p
+ {margin-right:0in;
+ mso-margin-top-alt:auto;
+ mso-margin-bottom-alt:auto;
+ margin-left:0in;
+ mso-pagination:widow-orphan;
+ font-size:12.0pt;
+ font-family:"Times New Roman";
+ mso-fareast-font-family:"Times New Roman";}
+p.BalloonText, li.BalloonText, div.BalloonText
+ {mso-style-name:"Balloon Text";
+ margin:0in;
+ margin-bottom:.0001pt;
+ mso-pagination:widow-orphan;
+ font-size:8.0pt;
+ font-family:Tahoma;
+ mso-fareast-font-family:"Times New Roman";}
+@page Section1
+ {size:8.5in 11.0in;
+ margin:1.0in 1.25in 1.0in 1.25in;
+ mso-header-margin:.5in;
+ mso-footer-margin:.5in;
+ mso-paper-source:0;}
+div.Section1
+ {page:Section1;}
+-->
+</style></head>
+
+<body style="" lang="EN-US">
+
+<div class="Section1">
+
+<p style="text-align: center;" align="center"><b>Eclipse Public License - v 1.0</b>
+</p>
+
+<p><span style="font-size: 10pt;">THE ACCOMPANYING PROGRAM IS PROVIDED UNDER
+THE TERMS OF THIS ECLIPSE PUBLIC LICENSE ("AGREEMENT"). ANY USE,
+REPRODUCTION OR DISTRIBUTION OF THE PROGRAM CONSTITUTES RECIPIENT'S ACCEPTANCE
+OF THIS AGREEMENT.</span> </p>
+
+<p><b><span style="font-size: 10pt;">1. DEFINITIONS</span></b> </p>
+
+<p><span style="font-size: 10pt;">"Contribution" means:</span> </p>
+
+<p class="MsoNormal" style="margin-left: 0.5in;"><span style="font-size: 10pt;">a)
+in the case of the initial Contributor, the initial code and documentation
+distributed under this Agreement, and<br clear="left">
+b) in the case of each subsequent Contributor:</span></p>
+
+<p class="MsoNormal" style="margin-left: 0.5in;"><span style="font-size: 10pt;">i)
+changes to the Program, and</span></p>
+
+<p class="MsoNormal" style="margin-left: 0.5in;"><span style="font-size: 10pt;">ii)
+additions to the Program;</span></p>
+
+<p class="MsoNormal" style="margin-left: 0.5in;"><span style="font-size: 10pt;">where
+such changes and/or additions to the Program originate from and are distributed
+by that particular Contributor. A Contribution 'originates' from a Contributor
+if it was added to the Program by such Contributor itself or anyone acting on
+such Contributor's behalf. Contributions do not include additions to the
+Program which: (i) are separate modules of software distributed in conjunction
+with the Program under their own license agreement, and (ii) are not derivative
+works of the Program. </span></p>
+
+<p><span style="font-size: 10pt;">"Contributor" means any person or
+entity that distributes the Program.</span> </p>
+
+<p><span style="font-size: 10pt;">"Licensed Patents " mean patent
+claims licensable by a Contributor which are necessarily infringed by the use
+or sale of its Contribution alone or when combined with the Program. </span></p>
+
+<p><span style="font-size: 10pt;">"Program" means the Contributions
+distributed in accordance with this Agreement.</span> </p>
+
+<p><span style="font-size: 10pt;">"Recipient" means anyone who
+receives the Program under this Agreement, including all Contributors.</span> </p>
+
+<p><b><span style="font-size: 10pt;">2. GRANT OF RIGHTS</span></b> </p>
+
+<p class="MsoNormal" style="margin-left: 0.5in;"><span style="font-size: 10pt;">a)
+Subject to the terms of this Agreement, each Contributor hereby grants Recipient
+a non-exclusive, worldwide, royalty-free copyright license to<span style="color: red;"> </span>reproduce, prepare derivative works of, publicly
+display, publicly perform, distribute and sublicense the Contribution of such
+Contributor, if any, and such derivative works, in source code and object code
+form.</span></p>
+
+<p class="MsoNormal" style="margin-left: 0.5in;"><span style="font-size: 10pt;">b)
+Subject to the terms of this Agreement, each Contributor hereby grants
+Recipient a non-exclusive, worldwide,<span style="color: green;"> </span>royalty-free
+patent license under Licensed Patents to make, use, sell, offer to sell, import
+and otherwise transfer the Contribution of such Contributor, if any, in source
+code and object code form. This patent license shall apply to the combination
+of the Contribution and the Program if, at the time the Contribution is added
+by the Contributor, such addition of the Contribution causes such combination
+to be covered by the Licensed Patents. The patent license shall not apply to
+any other combinations which include the Contribution. No hardware per se is
+licensed hereunder. </span></p>
+
+<p class="MsoNormal" style="margin-left: 0.5in;"><span style="font-size: 10pt;">c)
+Recipient understands that although each Contributor grants the licenses to its
+Contributions set forth herein, no assurances are provided by any Contributor
+that the Program does not infringe the patent or other intellectual property
+rights of any other entity. Each Contributor disclaims any liability to Recipient
+for claims brought by any other entity based on infringement of intellectual
+property rights or otherwise. As a condition to exercising the rights and
+licenses granted hereunder, each Recipient hereby assumes sole responsibility
+to secure any other intellectual property rights needed, if any. For example,
+if a third party patent license is required to allow Recipient to distribute
+the Program, it is Recipient's responsibility to acquire that license before
+distributing the Program.</span></p>
+
+<p class="MsoNormal" style="margin-left: 0.5in;"><span style="font-size: 10pt;">d)
+Each Contributor represents that to its knowledge it has sufficient copyright
+rights in its Contribution, if any, to grant the copyright license set forth in
+this Agreement. </span></p>
+
+<p><b><span style="font-size: 10pt;">3. REQUIREMENTS</span></b> </p>
+
+<p><span style="font-size: 10pt;">A Contributor may choose to distribute the
+Program in object code form under its own license agreement, provided that:</span>
+</p>
+
+<p class="MsoNormal" style="margin-left: 0.5in;"><span style="font-size: 10pt;">a)
+it complies with the terms and conditions of this Agreement; and</span></p>
+
+<p class="MsoNormal" style="margin-left: 0.5in;"><span style="font-size: 10pt;">b)
+its license agreement:</span></p>
+
+<p class="MsoNormal" style="margin-left: 0.5in;"><span style="font-size: 10pt;">i)
+effectively disclaims on behalf of all Contributors all warranties and
+conditions, express and implied, including warranties or conditions of title
+and non-infringement, and implied warranties or conditions of merchantability
+and fitness for a particular purpose; </span></p>
+
+<p class="MsoNormal" style="margin-left: 0.5in;"><span style="font-size: 10pt;">ii)
+effectively excludes on behalf of all Contributors all liability for damages,
+including direct, indirect, special, incidental and consequential damages, such
+as lost profits; </span></p>
+
+<p class="MsoNormal" style="margin-left: 0.5in;"><span style="font-size: 10pt;">iii)
+states that any provisions which differ from this Agreement are offered by that
+Contributor alone and not by any other party; and</span></p>
+
+<p class="MsoNormal" style="margin-left: 0.5in;"><span style="font-size: 10pt;">iv)
+states that source code for the Program is available from such Contributor, and
+informs licensees how to obtain it in a reasonable manner on or through a
+medium customarily used for software exchange.<span style="color: blue;"> </span></span></p>
+
+<p><span style="font-size: 10pt;">When the Program is made available in source
+code form:</span> </p>
+
+<p class="MsoNormal" style="margin-left: 0.5in;"><span style="font-size: 10pt;">a)
+it must be made available under this Agreement; and </span></p>
+
+<p class="MsoNormal" style="margin-left: 0.5in;"><span style="font-size: 10pt;">b) a
+copy of this Agreement must be included with each copy of the Program. </span></p>
+
+<p><span style="font-size: 10pt;">Contributors may not remove or alter any
+copyright notices contained within the Program. </span></p>
+
+<p><span style="font-size: 10pt;">Each Contributor must identify itself as the
+originator of its Contribution, if any, in a manner that reasonably allows
+subsequent Recipients to identify the originator of the Contribution. </span></p>
+
+<p><b><span style="font-size: 10pt;">4. COMMERCIAL DISTRIBUTION</span></b> </p>
+
+<p><span style="font-size: 10pt;">Commercial distributors of software may
+accept certain responsibilities with respect to end users, business partners
+and the like. While this license is intended to facilitate the commercial use
+of the Program, the Contributor who includes the Program in a commercial
+product offering should do so in a manner which does not create potential
+liability for other Contributors. Therefore, if a Contributor includes the
+Program in a commercial product offering, such Contributor ("Commercial
+Contributor") hereby agrees to defend and indemnify every other
+Contributor ("Indemnified Contributor") against any losses, damages and
+costs (collectively "Losses") arising from claims, lawsuits and other
+legal actions brought by a third party against the Indemnified Contributor to
+the extent caused by the acts or omissions of such Commercial Contributor in
+connection with its distribution of the Program in a commercial product
+offering. The obligations in this section do not apply to any claims or Losses
+relating to any actual or alleged intellectual property infringement. In order
+to qualify, an Indemnified Contributor must: a) promptly notify the Commercial
+Contributor in writing of such claim, and b) allow the Commercial Contributor
+to control, and cooperate with the Commercial Contributor in, the defense and
+any related settlement negotiations. The Indemnified Contributor may participate
+in any such claim at its own expense.</span> </p>
+
+<p><span style="font-size: 10pt;">For example, a Contributor might include the
+Program in a commercial product offering, Product X. That Contributor is then a
+Commercial Contributor. If that Commercial Contributor then makes performance
+claims, or offers warranties related to Product X, those performance claims and
+warranties are such Commercial Contributor's responsibility alone. Under this
+section, the Commercial Contributor would have to defend claims against the
+other Contributors related to those performance claims and warranties, and if a
+court requires any other Contributor to pay any damages as a result, the
+Commercial Contributor must pay those damages.</span> </p>
+
+<p><b><span style="font-size: 10pt;">5. NO WARRANTY</span></b> </p>
+
+<p><span style="font-size: 10pt;">EXCEPT AS EXPRESSLY SET FORTH IN THIS
+AGREEMENT, THE PROGRAM IS PROVIDED 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. Each Recipient is solely
+responsible for determining the appropriateness of using and distributing the
+Program and assumes all risks associated with its exercise of rights under this
+Agreement , including but not limited to the risks and costs of program errors,
+compliance with applicable laws, damage to or loss of data, programs or
+equipment, and unavailability or interruption of operations. </span></p>
+
+<p><b><span style="font-size: 10pt;">6. DISCLAIMER OF LIABILITY</span></b> </p>
+
+<p><span style="font-size: 10pt;">EXCEPT AS EXPRESSLY SET FORTH IN THIS
+AGREEMENT, NEITHER RECIPIENT NOR ANY CONTRIBUTORS SHALL HAVE ANY LIABILITY FOR
+ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+(INCLUDING WITHOUT LIMITATION LOST PROFITS), HOWEVER CAUSED AND ON ANY THEORY
+OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
+NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OR DISTRIBUTION OF
+THE PROGRAM OR THE EXERCISE OF ANY RIGHTS GRANTED HEREUNDER, EVEN IF ADVISED OF
+THE POSSIBILITY OF SUCH DAMAGES.</span> </p>
+
+<p><b><span style="font-size: 10pt;">7. GENERAL</span></b> </p>
+
+<p><span style="font-size: 10pt;">If any provision of this Agreement is invalid
+or unenforceable under applicable law, it shall not affect the validity or
+enforceability of the remainder of the terms of this Agreement, and without
+further action by the parties hereto, such provision shall be reformed to the
+minimum extent necessary to make such provision valid and enforceable.</span> </p>
+
+<p><span style="font-size: 10pt;">If Recipient institutes patent litigation
+against any entity (including a cross-claim or counterclaim in a lawsuit)
+alleging that the Program itself (excluding combinations of the Program with
+other software or hardware) infringes such Recipient's patent(s), then such
+Recipient's rights granted under Section 2(b) shall terminate as of the date
+such litigation is filed. </span></p>
+
+<p><span style="font-size: 10pt;">All Recipient's rights under this Agreement
+shall terminate if it fails to comply with any of the material terms or
+conditions of this Agreement and does not cure such failure in a reasonable
+period of time after becoming aware of such noncompliance. If all Recipient's
+rights under this Agreement terminate, Recipient agrees to cease use and
+distribution of the Program as soon as reasonably practicable. However,
+Recipient's obligations under this Agreement and any licenses granted by
+Recipient relating to the Program shall continue and survive. </span></p>
+
+<p><span style="font-size: 10pt;">Everyone is permitted to copy and distribute
+copies of this Agreement, but in order to avoid inconsistency the Agreement is
+copyrighted and may only be modified in the following manner. The Agreement
+Steward reserves the right to publish new versions (including revisions) of
+this Agreement from time to time. No one other than the Agreement Steward has
+the right to modify this Agreement. The Eclipse Foundation is the initial
+Agreement Steward. The Eclipse Foundation may assign the responsibility to
+serve as the Agreement Steward to a suitable separate entity. Each new version
+of the Agreement will be given a distinguishing version number. The Program
+(including Contributions) may always be distributed subject to the version of
+the Agreement under which it was received. In addition, after a new version of
+the Agreement is published, Contributor may elect to distribute the Program
+(including its Contributions) under the new version. Except as expressly stated
+in Sections 2(a) and 2(b) above, Recipient receives no rights or licenses to
+the intellectual property of any Contributor under this Agreement, whether
+expressly, by implication, estoppel or otherwise. All rights in the Program not
+expressly granted under this Agreement are reserved.</span> </p>
+
+<p><span style="font-size: 10pt;">This Agreement is governed by the laws of the
+State of New York and the intellectual property laws of the United States of
+America. No party to this Agreement will bring a legal action under this
+Agreement more than one year after the cause of action arose. Each party waives
+its rights to a jury trial in any resulting litigation.</span> </p>
+
+<p class="MsoNormal"><!--[if !supportEmptyParas]-->&nbsp;<!--[endif]--><o:p></o:p></p>
+
+</div>
+
+</body></html> \ No newline at end of file
diff --git a/plugins/org.eclipse.emf.cdo.common/license.html b/plugins/org.eclipse.emf.cdo.common/license.html
new file mode 100644
index 0000000000..d7b88e9416
--- /dev/null
+++ b/plugins/org.eclipse.emf.cdo.common/license.html
@@ -0,0 +1,319 @@
+<html xmlns:o="urn:schemas-microsoft-com:office:office" xmlns:w="urn:schemas-microsoft-com:office:word" xmlns="http://www.w3.org/TR/REC-html40"><head>
+<meta http-equiv="Content-Type" content="text/html; charset=windows-1252">
+<meta name="ProgId" content="Word.Document">
+<meta name="Generator" content="Microsoft Word 9">
+<meta name="Originator" content="Microsoft Word 9">
+<link rel="File-List" href="http://www.eclipse.org/org/documents/Eclipse%20EPL%202003_11_10%20Final_files/filelist.xml"><title>Eclipse Public License - Version 1.0</title><!--[if gte mso 9]><xml>
+ <o:DocumentProperties>
+ <o:Revision>2</o:Revision>
+ <o:TotalTime>3</o:TotalTime>
+ <o:Created>2004-03-05T23:03:00Z</o:Created>
+ <o:LastSaved>2004-03-05T23:03:00Z</o:LastSaved>
+ <o:Pages>4</o:Pages>
+ <o:Words>1626</o:Words>
+ <o:Characters>9270</o:Characters>
+ <o:Lines>77</o:Lines>
+ <o:Paragraphs>18</o:Paragraphs>
+ <o:CharactersWithSpaces>11384</o:CharactersWithSpaces>
+ <o:Version>9.4402</o:Version>
+ </o:DocumentProperties>
+</xml><![endif]--><!--[if gte mso 9]><xml>
+ <w:WordDocument>
+ <w:TrackRevisions/>
+ </w:WordDocument>
+</xml><![endif]-->
+
+
+<style>
+<!--
+ /* Font Definitions */
+@font-face
+ {font-family:Tahoma;
+ panose-1:2 11 6 4 3 5 4 4 2 4;
+ mso-font-charset:0;
+ mso-generic-font-family:swiss;
+ mso-font-pitch:variable;
+ mso-font-signature:553679495 -2147483648 8 0 66047 0;}
+ /* Style Definitions */
+p.MsoNormal, li.MsoNormal, div.MsoNormal
+ {mso-style-parent:"";
+ margin:0in;
+ margin-bottom:.0001pt;
+ mso-pagination:widow-orphan;
+ font-size:12.0pt;
+ font-family:"Times New Roman";
+ mso-fareast-font-family:"Times New Roman";}
+p
+ {margin-right:0in;
+ mso-margin-top-alt:auto;
+ mso-margin-bottom-alt:auto;
+ margin-left:0in;
+ mso-pagination:widow-orphan;
+ font-size:12.0pt;
+ font-family:"Times New Roman";
+ mso-fareast-font-family:"Times New Roman";}
+p.BalloonText, li.BalloonText, div.BalloonText
+ {mso-style-name:"Balloon Text";
+ margin:0in;
+ margin-bottom:.0001pt;
+ mso-pagination:widow-orphan;
+ font-size:8.0pt;
+ font-family:Tahoma;
+ mso-fareast-font-family:"Times New Roman";}
+@page Section1
+ {size:8.5in 11.0in;
+ margin:1.0in 1.25in 1.0in 1.25in;
+ mso-header-margin:.5in;
+ mso-footer-margin:.5in;
+ mso-paper-source:0;}
+div.Section1
+ {page:Section1;}
+-->
+</style></head>
+
+<body style="" lang="EN-US">
+
+<div class="Section1">
+
+<p style="text-align: center;" align="center"><b>Eclipse Public License - v 1.0</b>
+</p>
+
+<p><span style="font-size: 10pt;">THE ACCOMPANYING PROGRAM IS PROVIDED UNDER
+THE TERMS OF THIS ECLIPSE PUBLIC LICENSE ("AGREEMENT"). ANY USE,
+REPRODUCTION OR DISTRIBUTION OF THE PROGRAM CONSTITUTES RECIPIENT'S ACCEPTANCE
+OF THIS AGREEMENT.</span> </p>
+
+<p><b><span style="font-size: 10pt;">1. DEFINITIONS</span></b> </p>
+
+<p><span style="font-size: 10pt;">"Contribution" means:</span> </p>
+
+<p class="MsoNormal" style="margin-left: 0.5in;"><span style="font-size: 10pt;">a)
+in the case of the initial Contributor, the initial code and documentation
+distributed under this Agreement, and<br clear="left">
+b) in the case of each subsequent Contributor:</span></p>
+
+<p class="MsoNormal" style="margin-left: 0.5in;"><span style="font-size: 10pt;">i)
+changes to the Program, and</span></p>
+
+<p class="MsoNormal" style="margin-left: 0.5in;"><span style="font-size: 10pt;">ii)
+additions to the Program;</span></p>
+
+<p class="MsoNormal" style="margin-left: 0.5in;"><span style="font-size: 10pt;">where
+such changes and/or additions to the Program originate from and are distributed
+by that particular Contributor. A Contribution 'originates' from a Contributor
+if it was added to the Program by such Contributor itself or anyone acting on
+such Contributor's behalf. Contributions do not include additions to the
+Program which: (i) are separate modules of software distributed in conjunction
+with the Program under their own license agreement, and (ii) are not derivative
+works of the Program. </span></p>
+
+<p><span style="font-size: 10pt;">"Contributor" means any person or
+entity that distributes the Program.</span> </p>
+
+<p><span style="font-size: 10pt;">"Licensed Patents " mean patent
+claims licensable by a Contributor which are necessarily infringed by the use
+or sale of its Contribution alone or when combined with the Program. </span></p>
+
+<p><span style="font-size: 10pt;">"Program" means the Contributions
+distributed in accordance with this Agreement.</span> </p>
+
+<p><span style="font-size: 10pt;">"Recipient" means anyone who
+receives the Program under this Agreement, including all Contributors.</span> </p>
+
+<p><b><span style="font-size: 10pt;">2. GRANT OF RIGHTS</span></b> </p>
+
+<p class="MsoNormal" style="margin-left: 0.5in;"><span style="font-size: 10pt;">a)
+Subject to the terms of this Agreement, each Contributor hereby grants Recipient
+a non-exclusive, worldwide, royalty-free copyright license to<span style="color: red;"> </span>reproduce, prepare derivative works of, publicly
+display, publicly perform, distribute and sublicense the Contribution of such
+Contributor, if any, and such derivative works, in source code and object code
+form.</span></p>
+
+<p class="MsoNormal" style="margin-left: 0.5in;"><span style="font-size: 10pt;">b)
+Subject to the terms of this Agreement, each Contributor hereby grants
+Recipient a non-exclusive, worldwide,<span style="color: green;"> </span>royalty-free
+patent license under Licensed Patents to make, use, sell, offer to sell, import
+and otherwise transfer the Contribution of such Contributor, if any, in source
+code and object code form. This patent license shall apply to the combination
+of the Contribution and the Program if, at the time the Contribution is added
+by the Contributor, such addition of the Contribution causes such combination
+to be covered by the Licensed Patents. The patent license shall not apply to
+any other combinations which include the Contribution. No hardware per se is
+licensed hereunder. </span></p>
+
+<p class="MsoNormal" style="margin-left: 0.5in;"><span style="font-size: 10pt;">c)
+Recipient understands that although each Contributor grants the licenses to its
+Contributions set forth herein, no assurances are provided by any Contributor
+that the Program does not infringe the patent or other intellectual property
+rights of any other entity. Each Contributor disclaims any liability to Recipient
+for claims brought by any other entity based on infringement of intellectual
+property rights or otherwise. As a condition to exercising the rights and
+licenses granted hereunder, each Recipient hereby assumes sole responsibility
+to secure any other intellectual property rights needed, if any. For example,
+if a third party patent license is required to allow Recipient to distribute
+the Program, it is Recipient's responsibility to acquire that license before
+distributing the Program.</span></p>
+
+<p class="MsoNormal" style="margin-left: 0.5in;"><span style="font-size: 10pt;">d)
+Each Contributor represents that to its knowledge it has sufficient copyright
+rights in its Contribution, if any, to grant the copyright license set forth in
+this Agreement. </span></p>
+
+<p><b><span style="font-size: 10pt;">3. REQUIREMENTS</span></b> </p>
+
+<p><span style="font-size: 10pt;">A Contributor may choose to distribute the
+Program in object code form under its own license agreement, provided that:</span>
+</p>
+
+<p class="MsoNormal" style="margin-left: 0.5in;"><span style="font-size: 10pt;">a)
+it complies with the terms and conditions of this Agreement; and</span></p>
+
+<p class="MsoNormal" style="margin-left: 0.5in;"><span style="font-size: 10pt;">b)
+its license agreement:</span></p>
+
+<p class="MsoNormal" style="margin-left: 0.5in;"><span style="font-size: 10pt;">i)
+effectively disclaims on behalf of all Contributors all warranties and
+conditions, express and implied, including warranties or conditions of title
+and non-infringement, and implied warranties or conditions of merchantability
+and fitness for a particular purpose; </span></p>
+
+<p class="MsoNormal" style="margin-left: 0.5in;"><span style="font-size: 10pt;">ii)
+effectively excludes on behalf of all Contributors all liability for damages,
+including direct, indirect, special, incidental and consequential damages, such
+as lost profits; </span></p>
+
+<p class="MsoNormal" style="margin-left: 0.5in;"><span style="font-size: 10pt;">iii)
+states that any provisions which differ from this Agreement are offered by that
+Contributor alone and not by any other party; and</span></p>
+
+<p class="MsoNormal" style="margin-left: 0.5in;"><span style="font-size: 10pt;">iv)
+states that source code for the Program is available from such Contributor, and
+informs licensees how to obtain it in a reasonable manner on or through a
+medium customarily used for software exchange.<span style="color: blue;"> </span></span></p>
+
+<p><span style="font-size: 10pt;">When the Program is made available in source
+code form:</span> </p>
+
+<p class="MsoNormal" style="margin-left: 0.5in;"><span style="font-size: 10pt;">a)
+it must be made available under this Agreement; and </span></p>
+
+<p class="MsoNormal" style="margin-left: 0.5in;"><span style="font-size: 10pt;">b) a
+copy of this Agreement must be included with each copy of the Program. </span></p>
+
+<p><span style="font-size: 10pt;">Contributors may not remove or alter any
+copyright notices contained within the Program. </span></p>
+
+<p><span style="font-size: 10pt;">Each Contributor must identify itself as the
+originator of its Contribution, if any, in a manner that reasonably allows
+subsequent Recipients to identify the originator of the Contribution. </span></p>
+
+<p><b><span style="font-size: 10pt;">4. COMMERCIAL DISTRIBUTION</span></b> </p>
+
+<p><span style="font-size: 10pt;">Commercial distributors of software may
+accept certain responsibilities with respect to end users, business partners
+and the like. While this license is intended to facilitate the commercial use
+of the Program, the Contributor who includes the Program in a commercial
+product offering should do so in a manner which does not create potential
+liability for other Contributors. Therefore, if a Contributor includes the
+Program in a commercial product offering, such Contributor ("Commercial
+Contributor") hereby agrees to defend and indemnify every other
+Contributor ("Indemnified Contributor") against any losses, damages and
+costs (collectively "Losses") arising from claims, lawsuits and other
+legal actions brought by a third party against the Indemnified Contributor to
+the extent caused by the acts or omissions of such Commercial Contributor in
+connection with its distribution of the Program in a commercial product
+offering. The obligations in this section do not apply to any claims or Losses
+relating to any actual or alleged intellectual property infringement. In order
+to qualify, an Indemnified Contributor must: a) promptly notify the Commercial
+Contributor in writing of such claim, and b) allow the Commercial Contributor
+to control, and cooperate with the Commercial Contributor in, the defense and
+any related settlement negotiations. The Indemnified Contributor may participate
+in any such claim at its own expense.</span> </p>
+
+<p><span style="font-size: 10pt;">For example, a Contributor might include the
+Program in a commercial product offering, Product X. That Contributor is then a
+Commercial Contributor. If that Commercial Contributor then makes performance
+claims, or offers warranties related to Product X, those performance claims and
+warranties are such Commercial Contributor's responsibility alone. Under this
+section, the Commercial Contributor would have to defend claims against the
+other Contributors related to those performance claims and warranties, and if a
+court requires any other Contributor to pay any damages as a result, the
+Commercial Contributor must pay those damages.</span> </p>
+
+<p><b><span style="font-size: 10pt;">5. NO WARRANTY</span></b> </p>
+
+<p><span style="font-size: 10pt;">EXCEPT AS EXPRESSLY SET FORTH IN THIS
+AGREEMENT, THE PROGRAM IS PROVIDED 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. Each Recipient is solely
+responsible for determining the appropriateness of using and distributing the
+Program and assumes all risks associated with its exercise of rights under this
+Agreement , including but not limited to the risks and costs of program errors,
+compliance with applicable laws, damage to or loss of data, programs or
+equipment, and unavailability or interruption of operations. </span></p>
+
+<p><b><span style="font-size: 10pt;">6. DISCLAIMER OF LIABILITY</span></b> </p>
+
+<p><span style="font-size: 10pt;">EXCEPT AS EXPRESSLY SET FORTH IN THIS
+AGREEMENT, NEITHER RECIPIENT NOR ANY CONTRIBUTORS SHALL HAVE ANY LIABILITY FOR
+ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+(INCLUDING WITHOUT LIMITATION LOST PROFITS), HOWEVER CAUSED AND ON ANY THEORY
+OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
+NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OR DISTRIBUTION OF
+THE PROGRAM OR THE EXERCISE OF ANY RIGHTS GRANTED HEREUNDER, EVEN IF ADVISED OF
+THE POSSIBILITY OF SUCH DAMAGES.</span> </p>
+
+<p><b><span style="font-size: 10pt;">7. GENERAL</span></b> </p>
+
+<p><span style="font-size: 10pt;">If any provision of this Agreement is invalid
+or unenforceable under applicable law, it shall not affect the validity or
+enforceability of the remainder of the terms of this Agreement, and without
+further action by the parties hereto, such provision shall be reformed to the
+minimum extent necessary to make such provision valid and enforceable.</span> </p>
+
+<p><span style="font-size: 10pt;">If Recipient institutes patent litigation
+against any entity (including a cross-claim or counterclaim in a lawsuit)
+alleging that the Program itself (excluding combinations of the Program with
+other software or hardware) infringes such Recipient's patent(s), then such
+Recipient's rights granted under Section 2(b) shall terminate as of the date
+such litigation is filed. </span></p>
+
+<p><span style="font-size: 10pt;">All Recipient's rights under this Agreement
+shall terminate if it fails to comply with any of the material terms or
+conditions of this Agreement and does not cure such failure in a reasonable
+period of time after becoming aware of such noncompliance. If all Recipient's
+rights under this Agreement terminate, Recipient agrees to cease use and
+distribution of the Program as soon as reasonably practicable. However,
+Recipient's obligations under this Agreement and any licenses granted by
+Recipient relating to the Program shall continue and survive. </span></p>
+
+<p><span style="font-size: 10pt;">Everyone is permitted to copy and distribute
+copies of this Agreement, but in order to avoid inconsistency the Agreement is
+copyrighted and may only be modified in the following manner. The Agreement
+Steward reserves the right to publish new versions (including revisions) of
+this Agreement from time to time. No one other than the Agreement Steward has
+the right to modify this Agreement. The Eclipse Foundation is the initial
+Agreement Steward. The Eclipse Foundation may assign the responsibility to
+serve as the Agreement Steward to a suitable separate entity. Each new version
+of the Agreement will be given a distinguishing version number. The Program
+(including Contributions) may always be distributed subject to the version of
+the Agreement under which it was received. In addition, after a new version of
+the Agreement is published, Contributor may elect to distribute the Program
+(including its Contributions) under the new version. Except as expressly stated
+in Sections 2(a) and 2(b) above, Recipient receives no rights or licenses to
+the intellectual property of any Contributor under this Agreement, whether
+expressly, by implication, estoppel or otherwise. All rights in the Program not
+expressly granted under this Agreement are reserved.</span> </p>
+
+<p><span style="font-size: 10pt;">This Agreement is governed by the laws of the
+State of New York and the intellectual property laws of the United States of
+America. No party to this Agreement will bring a legal action under this
+Agreement more than one year after the cause of action arose. Each party waives
+its rights to a jury trial in any resulting litigation.</span> </p>
+
+<p class="MsoNormal"><!--[if !supportEmptyParas]-->&nbsp;<!--[endif]--><o:p></o:p></p>
+
+</div>
+
+</body></html> \ No newline at end of file
diff --git a/plugins/org.eclipse.emf.cdo.common/plugin.properties b/plugins/org.eclipse.emf.cdo.common/plugin.properties
new file mode 100644
index 0000000000..96d8db8f13
--- /dev/null
+++ b/plugins/org.eclipse.emf.cdo.common/plugin.properties
@@ -0,0 +1,25 @@
+# Copyright (c) 2004 - 2008 Eike Stepper, Germany.
+# All rights reserved. This program and the accompanying materials
+# are made available under the terms of the Eclipse Public License v1.0
+# which accompanies this distribution, and is available at
+# http://www.eclipse.org/legal/epl-v10.html
+#
+# Contributors:
+# Eike Stepper - initial API and implementation
+
+# NLS_MESSAGEFORMAT_VAR
+
+# ==============================================================================
+# Do not change the properties between this line and the last line containing:
+# %%% END OF TRANSLATED PROPERTIES %%%
+# Instead, either redefine an existing property, or create a new property,
+# append it to the end of the file, and change the code to use the new name.
+# ==============================================================================
+
+pluginName = CDO Common
+providerName = Eclipse.org
+
+# ==============================================================================
+# %%% END OF TRANSLATED PROPERTIES %%%
+# The above properties have been shipped for translation.
+# ==============================================================================
diff --git a/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/common/CDOProtocol.java b/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/common/CDOProtocol.java
new file mode 100644
index 0000000000..7dccf792b3
--- /dev/null
+++ b/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/common/CDOProtocol.java
@@ -0,0 +1,21 @@
+/***************************************************************************
+ * Copyright (c) 2004 - 2008 Eike Stepper, Germany.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Eike Stepper - initial API and implementation
+ **************************************************************************/
+package org.eclipse.emf.cdo.common;
+
+import org.eclipse.net4j.protocol.IProtocol;
+
+/**
+ * @author Eike Stepper
+ */
+public interface CDOProtocol extends IProtocol
+{
+ public CDOProtocolSession getSession();
+}
diff --git a/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/common/CDOProtocolConstants.java b/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/common/CDOProtocolConstants.java
new file mode 100644
index 0000000000..f849caf4d5
--- /dev/null
+++ b/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/common/CDOProtocolConstants.java
@@ -0,0 +1,59 @@
+/***************************************************************************
+ * Copyright (c) 2004 - 2008 Eike Stepper, Germany.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Eike Stepper - initial API and implementation
+ **************************************************************************/
+package org.eclipse.emf.cdo.common;
+
+/**
+ * @author Eike Stepper
+ */
+public interface CDOProtocolConstants
+{
+ public static final String PROTOCOL_NAME = "cdo";
+
+ public static final short SIGNAL_OPEN_SESSION = 1;
+
+ public static final short SIGNAL_LOAD_LIBRARIES = 2;
+
+ public static final short SIGNAL_VIEWS_CHANGED = 3;
+
+ public static final short SIGNAL_RESOURCE_ID = 4;
+
+ public static final short SIGNAL_RESOURCE_PATH = 5;
+
+ public static final short SIGNAL_LOAD_PACKAGE = 6;
+
+ public static final short SIGNAL_LOAD_REVISION = 7;
+
+ public static final short SIGNAL_LOAD_REVISION_BY_TIME = 8;
+
+ public static final short SIGNAL_LOAD_REVISION_BY_VERSION = 9;
+
+ public static final short SIGNAL_LOAD_CHUNK = 10;
+
+ public static final short SIGNAL_VERIFY_REVISION = 11;
+
+ public static final short SIGNAL_QUERY_OBJECT_TYPES = 12;
+
+ public static final short SIGNAL_COMMIT_TRANSACTION = 13;
+
+ public static final short SIGNAL_INVALIDATION = 14;
+
+ public static final int ERROR_REPOSITORY_NOT_FOUND = -1;
+
+ public static final int ERROR_NO_SESSION = -2;
+
+ public static final byte VIEW_TRANSACTION = 1;
+
+ public static final byte VIEW_AUDIT = 2;
+
+ public static final byte VIEW_READONLY = 3;
+
+ public static final byte VIEW_CLOSED = 4;
+}
diff --git a/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/common/CDOProtocolSession.java b/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/common/CDOProtocolSession.java
new file mode 100644
index 0000000000..6c378a606b
--- /dev/null
+++ b/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/common/CDOProtocolSession.java
@@ -0,0 +1,27 @@
+/***************************************************************************
+ * Copyright (c) 2004 - 2008 Eike Stepper, Germany.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Eike Stepper - initial API and implementation
+ **************************************************************************/
+package org.eclipse.emf.cdo.common;
+
+/**
+ * @author Eike Stepper
+ */
+public interface CDOProtocolSession
+{
+ public int getSessionID();
+
+ public CDOProtocol getProtocol();
+
+ public CDOProtocolView[] getViews();
+
+ public CDOProtocolView getView(int viewID);
+
+ public boolean isLegacySupportEnabled();
+}
diff --git a/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/common/CDOProtocolView.java b/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/common/CDOProtocolView.java
new file mode 100644
index 0000000000..7099da4884
--- /dev/null
+++ b/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/common/CDOProtocolView.java
@@ -0,0 +1,31 @@
+/***************************************************************************
+ * Copyright (c) 2004 - 2008 Eike Stepper, Germany.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Eike Stepper - initial API and implementation
+ **************************************************************************/
+package org.eclipse.emf.cdo.common;
+
+/**
+ * @author Eike Stepper
+ */
+public interface CDOProtocolView
+{
+ public int getViewID();
+
+ public Type getViewType();
+
+ public CDOProtocolSession getSession();
+
+ /**
+ * @author Eike Stepper
+ */
+ public enum Type
+ {
+ TRANSACTION, READONLY, AUDIT
+ }
+}
diff --git a/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/common/analyzer/CDOFetchRule.java b/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/common/analyzer/CDOFetchRule.java
new file mode 100644
index 0000000000..eba01412fb
--- /dev/null
+++ b/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/common/analyzer/CDOFetchRule.java
@@ -0,0 +1,89 @@
+/***************************************************************************
+ * Copyright (c) 2004 - 2008 Eike Stepper, Germany.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Simon McDuff - initial API and implementation
+ * Eike Stepper - maintenance
+ **************************************************************************/
+package org.eclipse.emf.cdo.common.analyzer;
+
+import org.eclipse.emf.cdo.common.model.CDOClass;
+import org.eclipse.emf.cdo.common.model.CDOClassRef;
+import org.eclipse.emf.cdo.common.model.CDOFeature;
+import org.eclipse.emf.cdo.common.model.CDOModelUtil;
+import org.eclipse.emf.cdo.common.model.CDOPackageManager;
+
+import org.eclipse.net4j.util.io.ExtendedDataInput;
+import org.eclipse.net4j.util.io.ExtendedDataOutput;
+
+import java.io.IOException;
+import java.util.ArrayList;
+import java.util.List;
+
+/**
+ * @author Simon McDuff
+ */
+public final class CDOFetchRule
+{
+ private CDOClass cdoClass;
+
+ private List<CDOFeature> features = new ArrayList<CDOFeature>(0);
+
+ public CDOFetchRule(CDOClass cdoClass)
+ {
+ this.cdoClass = cdoClass;
+ }
+
+ public CDOFetchRule(ExtendedDataInput in, CDOPackageManager packageManager) throws IOException
+ {
+ CDOClassRef classRef = CDOModelUtil.readClassRef(in);
+ cdoClass = classRef.resolve(packageManager);
+ int size = in.readInt();
+ for (int i = 0; i < size; i++)
+ {
+ int featureID = in.readInt();
+ CDOFeature feature = cdoClass.lookupFeature(featureID);
+ features.add(feature);
+ }
+ }
+
+ public void write(ExtendedDataOutput out) throws IOException
+ {
+ CDOModelUtil.writeClassRef(out, cdoClass.createClassRef());
+ out.writeInt(features.size());
+ for (CDOFeature feature : features)
+ {
+ out.writeInt(feature.getFeatureID());
+ }
+ }
+
+ public CDOClass getCDOClass()
+ {
+ return cdoClass;
+ }
+
+ public List<CDOFeature> getFeatures()
+ {
+ return features;
+ }
+
+ public void addFeature(CDOFeature feature)
+ {
+ features.add(feature);
+ }
+
+ public void removeFeature(CDOFeature feature)
+ {
+ features.remove(feature);
+
+ }
+
+ public boolean isEmpty()
+ {
+ return features.isEmpty();
+ }
+}
diff --git a/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/common/id/CDOID.java b/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/common/id/CDOID.java
new file mode 100644
index 0000000000..fb4b0d11bc
--- /dev/null
+++ b/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/common/id/CDOID.java
@@ -0,0 +1,49 @@
+/***************************************************************************
+ * Copyright (c) 2004 - 2008 Eike Stepper, Germany.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Eike Stepper - initial API and implementation
+ **************************************************************************/
+package org.eclipse.emf.cdo.common.id;
+
+import org.eclipse.net4j.util.io.ExtendedDataInput;
+import org.eclipse.net4j.util.io.ExtendedDataOutput;
+
+import java.io.IOException;
+import java.io.Serializable;
+
+/**
+ * @author Eike Stepper
+ */
+public interface CDOID extends Serializable
+{
+ public static final CDOID NULL = org.eclipse.emf.cdo.internal.common.id.CDOIDNullImpl.INSTANCE;
+
+ public Type getType();
+
+ public boolean isNull();
+
+ public boolean isObject();
+
+ public boolean isLegacy();
+
+ public boolean isMeta();
+
+ public boolean isTemporary();
+
+ public void read(ExtendedDataInput in) throws IOException;
+
+ public void write(ExtendedDataOutput out) throws IOException;
+
+ /**
+ * @author Eike Stepper
+ */
+ public enum Type
+ {
+ NULL, OBJECT, LEGACY_OBJECT, TEMP_OBJECT, META, TEMP_META
+ }
+}
diff --git a/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/common/id/CDOIDLibraryDescriptor.java b/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/common/id/CDOIDLibraryDescriptor.java
new file mode 100644
index 0000000000..2a1a4f8e9b
--- /dev/null
+++ b/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/common/id/CDOIDLibraryDescriptor.java
@@ -0,0 +1,27 @@
+/***************************************************************************
+ * Copyright (c) 2004 - 2008 Eike Stepper, Germany.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Eike Stepper - initial API and implementation
+ **************************************************************************/
+package org.eclipse.emf.cdo.common.id;
+
+import org.eclipse.net4j.util.io.ExtendedDataOutput;
+
+import java.io.IOException;
+
+/**
+ * @author Eike Stepper
+ */
+public interface CDOIDLibraryDescriptor
+{
+ public String getFactoryName();
+
+ public String[] getLibraryNames();
+
+ public void write(ExtendedDataOutput out) throws IOException;
+}
diff --git a/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/common/id/CDOIDLibraryProvider.java b/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/common/id/CDOIDLibraryProvider.java
new file mode 100644
index 0000000000..d3325dbaea
--- /dev/null
+++ b/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/common/id/CDOIDLibraryProvider.java
@@ -0,0 +1,24 @@
+/***************************************************************************
+ * Copyright (c) 2004 - 2008 Eike Stepper, Germany.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Eike Stepper - initial API and implementation
+ **************************************************************************/
+package org.eclipse.emf.cdo.common.id;
+
+import java.io.IOException;
+import java.io.InputStream;
+
+/**
+ * @author Eike Stepper
+ */
+public interface CDOIDLibraryProvider
+{
+ public int getSize(String libraryName);
+
+ public InputStream getContents(String libraryName) throws IOException;
+}
diff --git a/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/common/id/CDOIDMeta.java b/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/common/id/CDOIDMeta.java
new file mode 100644
index 0000000000..691e09ac73
--- /dev/null
+++ b/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/common/id/CDOIDMeta.java
@@ -0,0 +1,19 @@
+/***************************************************************************
+ * Copyright (c) 2004 - 2008 Eike Stepper, Germany.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Eike Stepper - initial API and implementation
+ **************************************************************************/
+package org.eclipse.emf.cdo.common.id;
+
+/**
+ * @author Eike Stepper
+ */
+public interface CDOIDMeta extends CDOID
+{
+ public long getLongValue();
+}
diff --git a/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/common/id/CDOIDMetaRange.java b/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/common/id/CDOIDMetaRange.java
new file mode 100644
index 0000000000..71fd9bd461
--- /dev/null
+++ b/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/common/id/CDOIDMetaRange.java
@@ -0,0 +1,39 @@
+/***************************************************************************
+ * Copyright (c) 2004 - 2008 Eike Stepper, Germany.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Eike Stepper - initial API and implementation
+ **************************************************************************/
+package org.eclipse.emf.cdo.common.id;
+
+import org.eclipse.emf.cdo.common.id.CDOID.Type;
+
+import java.io.Serializable;
+
+/**
+ * @author Eike Stepper
+ */
+public interface CDOIDMetaRange extends Serializable
+{
+ public CDOID getLowerBound();
+
+ public CDOID getUpperBound();
+
+ public CDOID get(int index);
+
+ public int size();
+
+ public boolean isEmpty();
+
+ public boolean contains(CDOID id);
+
+ public CDOIDMetaRange increase();
+
+ public Type getType();
+
+ public boolean isTemporary();
+}
diff --git a/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/common/id/CDOIDObject.java b/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/common/id/CDOIDObject.java
new file mode 100644
index 0000000000..1f1ff18b3d
--- /dev/null
+++ b/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/common/id/CDOIDObject.java
@@ -0,0 +1,23 @@
+/***************************************************************************
+ * Copyright (c) 2004 - 2008 Eike Stepper, Germany.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Eike Stepper - initial API and implementation
+ **************************************************************************/
+package org.eclipse.emf.cdo.common.id;
+
+import org.eclipse.emf.cdo.common.model.CDOClassRef;
+
+/**
+ * @author Eike Stepper
+ */
+public interface CDOIDObject extends CDOID
+{
+ public CDOClassRef getClassRef();
+
+ public CDOIDObject asLegacy(CDOClassRef classRef);
+}
diff --git a/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/common/id/CDOIDObjectFactory.java b/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/common/id/CDOIDObjectFactory.java
new file mode 100644
index 0000000000..65574730e2
--- /dev/null
+++ b/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/common/id/CDOIDObjectFactory.java
@@ -0,0 +1,27 @@
+/***************************************************************************
+ * Copyright (c) 2004 - 2008 Eike Stepper, Germany.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Eike Stepper - initial API and implementation
+ **************************************************************************/
+package org.eclipse.emf.cdo.common.id;
+
+import org.eclipse.net4j.util.io.ExtendedDataInput;
+
+/**
+ * @author Eike Stepper
+ */
+public interface CDOIDObjectFactory
+{
+ /**
+ * Returns a new instance of CDOIDObject. The implementor of this method may use (read from) the given data input to
+ * determine which class to instantiate. The data input must not be used to fill the state of the new instance, this
+ * has to be done in the implementation of the {@link CDOID#read(ExtendedDataInput) read()} method of the new
+ * instance.
+ */
+ public CDOIDObject createCDOIDObject(ExtendedDataInput in);
+}
diff --git a/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/common/id/CDOIDProvider.java b/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/common/id/CDOIDProvider.java
new file mode 100644
index 0000000000..cf92f30b74
--- /dev/null
+++ b/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/common/id/CDOIDProvider.java
@@ -0,0 +1,19 @@
+/***************************************************************************
+ * Copyright (c) 2004 - 2008 Eike Stepper, Germany.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Eike Stepper - initial API and implementation
+ **************************************************************************/
+package org.eclipse.emf.cdo.common.id;
+
+/**
+ * @author Eike Stepper
+ */
+public interface CDOIDProvider
+{
+ public CDOID provideCDOID(Object idOrObject);
+}
diff --git a/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/common/id/CDOIDTemp.java b/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/common/id/CDOIDTemp.java
new file mode 100644
index 0000000000..ca9281d6b6
--- /dev/null
+++ b/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/common/id/CDOIDTemp.java
@@ -0,0 +1,19 @@
+/***************************************************************************
+ * Copyright (c) 2004 - 2008 Eike Stepper, Germany.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Eike Stepper - initial API and implementation
+ **************************************************************************/
+package org.eclipse.emf.cdo.common.id;
+
+/**
+ * @author Eike Stepper
+ */
+public interface CDOIDTemp extends CDOID
+{
+ public int getIntValue();
+}
diff --git a/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/common/id/CDOIDUtil.java b/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/common/id/CDOIDUtil.java
new file mode 100644
index 0000000000..85829635c6
--- /dev/null
+++ b/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/common/id/CDOIDUtil.java
@@ -0,0 +1,260 @@
+/***************************************************************************
+ * Copyright (c) 2004 - 2008 Eike Stepper, Germany.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Eike Stepper - initial API and implementation
+ **************************************************************************/
+package org.eclipse.emf.cdo.common.id;
+
+import org.eclipse.emf.cdo.common.id.CDOID.Type;
+import org.eclipse.emf.cdo.common.model.CDOClassRef;
+import org.eclipse.emf.cdo.common.model.CDOModelUtil;
+import org.eclipse.emf.cdo.internal.common.bundle.OM;
+import org.eclipse.emf.cdo.internal.common.id.CDOIDMetaImpl;
+import org.eclipse.emf.cdo.internal.common.id.CDOIDMetaRangeImpl;
+import org.eclipse.emf.cdo.internal.common.id.CDOIDTempMetaImpl;
+import org.eclipse.emf.cdo.internal.common.id.CDOIDTempObjectImpl;
+import org.eclipse.emf.cdo.spi.common.CDOIDLibraryDescriptorImpl;
+import org.eclipse.emf.cdo.spi.common.CDOIDLongImpl;
+
+import org.eclipse.net4j.util.ImplementationError;
+import org.eclipse.net4j.util.io.ExtendedDataInput;
+import org.eclipse.net4j.util.io.ExtendedDataOutput;
+import org.eclipse.net4j.util.om.trace.ContextTracer;
+
+import java.io.IOException;
+
+/**
+ * @author Eike Stepper
+ */
+public final class CDOIDUtil
+{
+ private static final ContextTracer TRACER = new ContextTracer(OM.DEBUG_MODEL, CDOIDUtil.class);
+
+ private CDOIDUtil()
+ {
+ }
+
+ public static long getLong(CDOID id)
+ {
+ if (id == null)
+ {
+ return 0L;
+ }
+
+ switch (id.getType())
+ {
+ case NULL:
+ return 0L;
+ case OBJECT:
+ case LEGACY_OBJECT:
+ if (id instanceof CDOIDLongImpl)
+ {
+ return ((CDOIDLongImpl)id).getLongValue();
+ }
+
+ throw new IllegalArgumentException("Unknown CDOIDObject implementation: " + id.getClass().getName());
+
+ case META:
+ return ((CDOIDMeta)id).getLongValue();
+ case TEMP_META:
+ case TEMP_OBJECT:
+ throw new IllegalArgumentException("id instanceof CDOIDTemp");
+ default:
+ throw new ImplementationError();
+ }
+ }
+
+ public static CDOIDTemp createTempMeta(int value)
+ {
+ return new CDOIDTempMetaImpl(value);
+ }
+
+ public static CDOIDTemp createTempObject(int value)
+ {
+ return new CDOIDTempObjectImpl(value);
+ }
+
+ public static CDOID createLong(long value)
+ {
+ if (value == 0L)
+ {
+ return CDOID.NULL;
+ }
+
+ return new CDOIDLongImpl(value);
+ }
+
+ public static CDOID read(ExtendedDataInput in, CDOIDObjectFactory factory) throws IOException
+ {
+ return read(in, factory, false);
+ }
+
+ public static CDOID read(ExtendedDataInput in, CDOIDObjectFactory factory, boolean asLegacy) throws IOException
+ {
+ byte ordinal = in.readByte();
+ if (TRACER.isEnabled())
+ {
+ String type;
+ try
+ {
+ type = Type.values()[ordinal].toString();
+ }
+ catch (RuntimeException ex)
+ {
+ type = ex.getMessage();
+ }
+
+ TRACER.format("Reading CDOID of type {0} ({1})", ordinal, type);
+ }
+
+ Type type = Type.values()[ordinal];
+ if (asLegacy)
+ {
+ switch (type)
+ {
+ case NULL:
+ case TEMP_OBJECT:
+ case TEMP_META:
+ case META:
+ case OBJECT:
+ throw new IllegalStateException("Missing classRef");
+
+ case LEGACY_OBJECT:
+ {
+ CDOIDObject id = factory.createCDOIDObject(in);
+ id.read(in);
+ CDOClassRef classRef = CDOModelUtil.readClassRef(in);
+ return id.asLegacy(classRef);
+ }
+
+ default:
+ throw new ImplementationError();
+ }
+ }
+
+ // Not asLegacy
+ switch (type)
+ {
+ case NULL:
+ return CDOID.NULL;
+
+ case TEMP_OBJECT:
+ return new CDOIDTempObjectImpl(in.readInt());
+
+ case TEMP_META:
+ return new CDOIDTempMetaImpl(in.readInt());
+
+ case META:
+ return new CDOIDMetaImpl(in.readLong());
+
+ case OBJECT:
+ {
+ CDOIDObject id = factory.createCDOIDObject(in);
+ id.read(in);
+ return id;// new CDOIDLongImpl(in.readLong());
+ }
+
+ case LEGACY_OBJECT:
+ {
+ CDOIDObject id = factory.createCDOIDObject(in);
+ id.read(in);
+ CDOModelUtil.readClassRef(in); // Discard classRef from stream
+ return id;
+ }
+
+ default:
+ throw new ImplementationError();
+ }
+ }
+
+ public static void write(ExtendedDataOutput out, CDOID id) throws IOException
+ {
+ write(out, id, false);
+ }
+
+ public static void write(ExtendedDataOutput out, CDOID id, boolean asLegacy) throws IOException
+ {
+ if (id == null)
+ {
+ id = CDOID.NULL;
+ }
+
+ Type type = id.getType();
+ int ordinal = type.ordinal();
+ if (TRACER.isEnabled())
+ {
+ TRACER.format("Writing CDOID of type {0} ({1})", ordinal, type);
+ }
+
+ out.writeByte(ordinal);
+ if (asLegacy)
+ {
+ switch (type)
+ {
+ case NULL:
+ case TEMP_OBJECT:
+ case TEMP_META:
+ case META:
+ case OBJECT:
+ throw new IllegalStateException("Missing classRef");
+
+ case LEGACY_OBJECT:
+ CDOIDObject legacy = (CDOIDObject)id;
+ legacy.write(out);
+ CDOModelUtil.writeClassRef(out, legacy.getClassRef());
+ return;
+
+ default:
+ throw new ImplementationError();
+ }
+ }
+
+ // Not asLegacy
+ id.write(out);
+ }
+
+ public static CDOIDMeta createMeta(long value)
+ {
+ return new CDOIDMetaImpl(value);
+ }
+
+ public static CDOIDMetaRange createMetaRange(CDOID lowerBound, int count)
+ {
+ return new CDOIDMetaRangeImpl(lowerBound, count);
+ }
+
+ public static CDOIDMetaRange readMetaRange(ExtendedDataInput in) throws IOException
+ {
+ boolean exist = in.readBoolean();
+ if (exist)
+ {
+ return new CDOIDMetaRangeImpl(read(in, null), in.readInt());
+ }
+
+ return null;
+ }
+
+ public static void writeMetaRange(ExtendedDataOutput out, CDOIDMetaRange idRange) throws IOException
+ {
+ if (idRange == null)
+ {
+ out.writeBoolean(false);
+ }
+ else
+ {
+ out.writeBoolean(true);
+ write(out, idRange.getLowerBound());
+ out.writeInt(idRange.size());
+ }
+ }
+
+ public static CDOIDLibraryDescriptor readLibraryDescriptor(ExtendedDataInput in) throws IOException
+ {
+ return new CDOIDLibraryDescriptorImpl(in);
+ }
+}
diff --git a/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/common/model/CDOClass.java b/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/common/model/CDOClass.java
new file mode 100644
index 0000000000..ec4823b98d
--- /dev/null
+++ b/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/common/model/CDOClass.java
@@ -0,0 +1,55 @@
+/***************************************************************************
+ * Copyright (c) 2004 - 2008 Eike Stepper, Germany.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Eike Stepper - initial API and implementation
+ **************************************************************************/
+package org.eclipse.emf.cdo.common.model;
+
+/**
+ * @author Eike Stepper
+ */
+public interface CDOClass extends CDOModelElement, Comparable<CDOClass>
+{
+ public int getClassifierID();
+
+ public boolean isAbstract();
+
+ public boolean isResource();
+
+ public boolean isRoot();
+
+ public int getSuperTypeCount();
+
+ public CDOClass getSuperType(int index);
+
+ public CDOClass[] getSuperTypes();
+
+ /**
+ * @return An array of all super types. The array is not a copy and must not be modified!
+ */
+ public CDOClass[] getAllSuperTypes();
+
+ public int getFeatureCount();
+
+ public CDOFeature lookupFeature(int featureID);
+
+ public CDOFeature lookupFeature(String name);
+
+ public CDOFeature[] getFeatures();
+
+ public int getFeatureID(CDOFeature feature);
+
+ /**
+ * @return An array of all features. The array is not a copy and must not be modified!
+ */
+ public CDOFeature[] getAllFeatures();
+
+ public CDOClassRef createClassRef();
+
+ public CDOPackage getContainingPackage();
+}
diff --git a/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/common/model/CDOClassProxy.java b/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/common/model/CDOClassProxy.java
new file mode 100644
index 0000000000..5d887735af
--- /dev/null
+++ b/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/common/model/CDOClassProxy.java
@@ -0,0 +1,100 @@
+/***************************************************************************
+ * Copyright (c) 2004 - 2008 Eike Stepper, Germany.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Eike Stepper - initial API and implementation
+ **************************************************************************/
+package org.eclipse.emf.cdo.common.model;
+
+/**
+ * @author Eike Stepper
+ */
+public final class CDOClassProxy
+{
+ private CDOPackageManager packageManager;
+
+ private CDOClassRef classRef;
+
+ private CDOClass cdoClass;
+
+ public CDOClassProxy()
+ {
+ }
+
+ public CDOClassProxy(CDOClassRef classRef, CDOPackageManager packageManager)
+ {
+ this.classRef = classRef;
+ this.packageManager = packageManager;
+ }
+
+ public CDOClassProxy(CDOClass cdoClass)
+ {
+ this.cdoClass = cdoClass;
+ }
+
+ public String getPackageURI()
+ {
+ if (cdoClass == null)
+ {
+ return classRef.getPackageURI();
+ }
+
+ return cdoClass.getContainingPackage().getPackageURI();
+ }
+
+ public int getClassifierID()
+ {
+ if (cdoClass == null)
+ {
+ return classRef.getClassifierID();
+ }
+
+ return cdoClass.getClassifierID();
+ }
+
+ // TODO Clarify camel case
+ public CDOClass getCdoClass()
+ {
+ if (cdoClass == null)
+ {
+ cdoClass = classRef.resolve(packageManager);
+ if (cdoClass == null)
+ {
+ throw new IllegalStateException("Unable to resolve class ref: " + classRef);
+ }
+ }
+
+ return cdoClass;
+ }
+
+ // TODO Clarify camel case
+ public void setCdoClass(CDOClass cdoClass)
+ {
+ this.cdoClass = cdoClass;
+ }
+
+ public CDOClassRef getClassRef()
+ {
+ if (classRef == null)
+ {
+ classRef = cdoClass.createClassRef();
+ }
+
+ return classRef;
+ }
+
+ @Override
+ public String toString()
+ {
+ if (cdoClass != null)
+ {
+ return cdoClass.toString();
+ }
+
+ return classRef.toString();
+ }
+}
diff --git a/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/common/model/CDOClassRef.java b/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/common/model/CDOClassRef.java
new file mode 100644
index 0000000000..832f792862
--- /dev/null
+++ b/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/common/model/CDOClassRef.java
@@ -0,0 +1,23 @@
+/***************************************************************************
+ * Copyright (c) 2004 - 2008 Eike Stepper, Germany.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Eike Stepper - initial API and implementation
+ **************************************************************************/
+package org.eclipse.emf.cdo.common.model;
+
+/**
+ * @author Eike Stepper
+ */
+public interface CDOClassRef
+{
+ public String getPackageURI();
+
+ public int getClassifierID();
+
+ public CDOClass resolve(CDOPackageManager packageManager);
+}
diff --git a/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/common/model/CDOFeature.java b/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/common/model/CDOFeature.java
new file mode 100644
index 0000000000..35c1cfa9c0
--- /dev/null
+++ b/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/common/model/CDOFeature.java
@@ -0,0 +1,35 @@
+/***************************************************************************
+ * Copyright (c) 2004 - 2008 Eike Stepper, Germany.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Eike Stepper - initial API and implementation
+ **************************************************************************/
+package org.eclipse.emf.cdo.common.model;
+
+/**
+ * @author Eike Stepper
+ */
+public interface CDOFeature extends CDOModelElement
+{
+ public int getFeatureID();
+
+ public int getFeatureIndex();
+
+ public CDOType getType();
+
+ public boolean isMany();
+
+ public boolean isReference();
+
+ public boolean isContainment();
+
+ public CDOClass getReferenceType();
+
+ public CDOClass getContainingClass();
+
+ public CDOPackage getContainingPackage();
+}
diff --git a/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/common/model/CDOModelElement.java b/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/common/model/CDOModelElement.java
new file mode 100644
index 0000000000..daf5ea6fde
--- /dev/null
+++ b/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/common/model/CDOModelElement.java
@@ -0,0 +1,25 @@
+/***************************************************************************
+ * Copyright (c) 2004 - 2008 Eike Stepper, Germany.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Eike Stepper - initial API and implementation
+ **************************************************************************/
+package org.eclipse.emf.cdo.common.model;
+
+/**
+ * @author Eike Stepper
+ */
+public interface CDOModelElement
+{
+ public CDOPackageManager getPackageManager();
+
+ public String getName();
+
+ public Object getClientInfo();
+
+ public Object getServerInfo();
+}
diff --git a/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/common/model/CDOModelUtil.java b/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/common/model/CDOModelUtil.java
new file mode 100644
index 0000000000..ec62a70885
--- /dev/null
+++ b/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/common/model/CDOModelUtil.java
@@ -0,0 +1,151 @@
+/***************************************************************************
+ * Copyright (c) 2004 - 2008 Eike Stepper, Germany.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Eike Stepper - initial API and implementation
+ **************************************************************************/
+package org.eclipse.emf.cdo.common.model;
+
+import org.eclipse.emf.cdo.common.id.CDOIDMetaRange;
+import org.eclipse.emf.cdo.internal.common.model.CDOClassImpl;
+import org.eclipse.emf.cdo.internal.common.model.CDOClassRefImpl;
+import org.eclipse.emf.cdo.internal.common.model.CDOFeatureImpl;
+import org.eclipse.emf.cdo.internal.common.model.CDOPackageImpl;
+import org.eclipse.emf.cdo.internal.common.model.CDOTypeImpl;
+import org.eclipse.emf.cdo.spi.common.InternalCDOClass;
+import org.eclipse.emf.cdo.spi.common.InternalCDOFeature;
+
+import org.eclipse.net4j.util.io.ExtendedDataInput;
+import org.eclipse.net4j.util.io.ExtendedDataOutput;
+
+import java.io.IOException;
+
+/**
+ * @author Eike Stepper
+ */
+public final class CDOModelUtil
+{
+ private CDOModelUtil()
+ {
+ }
+
+ // ///////////////////////////////////////////////
+
+ public static CDOType getType(int typeID)
+ {
+ CDOTypeImpl type = CDOTypeImpl.ids.get(typeID);
+ if (type == null)
+ {
+ throw new IllegalStateException("No type for id " + typeID);
+ }
+
+ return type;
+ }
+
+ public static CDOType readType(ExtendedDataInput in) throws IOException
+ {
+ int typeID = in.readInt();
+ return getType(typeID);
+ }
+
+ public static void writeType(ExtendedDataOutput out, CDOType type) throws IOException
+ {
+ ((CDOTypeImpl)type).write(out);
+ }
+
+ // ///////////////////////////////////////////////
+
+ public static CDOPackage createPackage(CDOPackageManager packageManager, String packageURI, String name,
+ String ecore, boolean dynamic, CDOIDMetaRange metaIDRange, String parentURI)
+ {
+ return new CDOPackageImpl(packageManager, packageURI, name, ecore, dynamic, metaIDRange, parentURI);
+ }
+
+ public static CDOPackage createProxyPackage(CDOPackageManager packageManager, String packageURI, boolean dynamic,
+ CDOIDMetaRange metaIDRange, String parentURI)
+ {
+ return new CDOPackageImpl(packageManager, packageURI, dynamic, metaIDRange, parentURI);
+ }
+
+ public static CDOPackage readPackage(CDOPackageManager packageManager, ExtendedDataInput in) throws IOException
+ {
+ return new CDOPackageImpl(packageManager, in);
+ }
+
+ public static void writePackage(ExtendedDataOutput out, CDOPackage cdoPackage) throws IOException
+ {
+ ((CDOPackageImpl)cdoPackage).write(out);
+ }
+
+ // ///////////////////////////////////////////////
+
+ public static CDOClass createClass(CDOPackage containingPackage, int classifierID, String name, boolean isAbstract)
+ {
+ return new CDOClassImpl(containingPackage, classifierID, name, isAbstract);
+ }
+
+ public static CDOClass readClass(CDOPackage containingPackage, ExtendedDataInput in) throws IOException
+ {
+ return new CDOClassImpl(containingPackage, in);
+ }
+
+ public static void writeClass(ExtendedDataOutput out, CDOClass cdoClass) throws IOException
+ {
+ ((InternalCDOClass)cdoClass).write(out);
+ }
+
+ // ///////////////////////////////////////////////
+
+ public static CDOFeature createAttribute(CDOClass containingClass, int featureID, String name, CDOType type,
+ boolean many)
+ {
+ return new CDOFeatureImpl(containingClass, featureID, name, type, many);
+ }
+
+ public static CDOFeature createReference(CDOClass containingClass, int featureID, String name,
+ CDOClassProxy referenceType, boolean many, boolean containment)
+ {
+ return new CDOFeatureImpl(containingClass, featureID, name, referenceType, many, containment);
+ }
+
+ public static CDOFeature readFeature(CDOClass containingClass, ExtendedDataInput in) throws IOException
+ {
+ return new CDOFeatureImpl(containingClass, in);
+ }
+
+ public static void writeFeature(ExtendedDataOutput out, CDOFeature cdoFeature) throws IOException
+ {
+ ((InternalCDOFeature)cdoFeature).write(out);
+ }
+
+ // ///////////////////////////////////////////////
+
+ public static CDOClassRef createClassRef(String packageURI, int classifierID)
+ {
+ return new CDOClassRefImpl(packageURI, classifierID);
+ }
+
+ public static CDOClassRef readClassRef(ExtendedDataInput in, String defaultURI) throws IOException
+ {
+ return new CDOClassRefImpl(in, defaultURI);
+ }
+
+ public static CDOClassRef readClassRef(ExtendedDataInput in) throws IOException
+ {
+ return readClassRef(in, null);
+ }
+
+ public static void writeClassRef(ExtendedDataOutput out, CDOClassRef classRef, String defaultURI) throws IOException
+ {
+ ((CDOClassRefImpl)classRef).write(out, defaultURI);
+ }
+
+ public static void writeClassRef(ExtendedDataOutput out, CDOClassRef classRef) throws IOException
+ {
+ writeClassRef(out, classRef, null);
+ }
+}
diff --git a/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/common/model/CDOPackage.java b/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/common/model/CDOPackage.java
new file mode 100644
index 0000000000..a2716512c3
--- /dev/null
+++ b/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/common/model/CDOPackage.java
@@ -0,0 +1,51 @@
+/***************************************************************************
+ * Copyright (c) 2004 - 2008 Eike Stepper, Germany.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Eike Stepper - initial API and implementation
+ **************************************************************************/
+package org.eclipse.emf.cdo.common.model;
+
+import org.eclipse.emf.cdo.common.id.CDOIDMetaRange;
+
+/**
+ * @author Eike Stepper
+ */
+public interface CDOPackage extends CDOModelElement, Comparable<CDOPackage>
+{
+ public CDOPackageManager getPackageManager();
+
+ public String getPackageURI();
+
+ public int getClassCount();
+
+ public CDOClass[] getClasses();
+
+ public CDOClass[] getConcreteClasses();
+
+ public CDOClass lookupClass(int classifierID);
+
+ public String getEcore();
+
+ public boolean isSystem();
+
+ public boolean isDynamic();
+
+ public boolean isProxy();
+
+ public boolean isPersistent();
+
+ public CDOIDMetaRange getMetaIDRange();
+
+ public String getParentURI();
+
+ public CDOPackage getParentPackage();
+
+ public CDOPackage getTopLevelPackage();
+
+ public CDOPackage[] getSubPackages(boolean recursive);
+}
diff --git a/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/common/model/CDOPackageInfo.java b/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/common/model/CDOPackageInfo.java
new file mode 100644
index 0000000000..b03b2aecba
--- /dev/null
+++ b/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/common/model/CDOPackageInfo.java
@@ -0,0 +1,57 @@
+/***************************************************************************
+ * Copyright (c) 2004 - 2008 Eike Stepper, Germany.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Eike Stepper - initial API and implementation
+ **************************************************************************/
+package org.eclipse.emf.cdo.common.model;
+
+import org.eclipse.emf.cdo.common.id.CDOIDMetaRange;
+
+/**
+ * TODO Add read(), write(), ...
+ *
+ * @author Eike Stepper
+ */
+public final class CDOPackageInfo
+{
+ private String packageURI;
+
+ private boolean dynamic;
+
+ private CDOIDMetaRange metaIDRange;
+
+ private String parentURI;
+
+ public CDOPackageInfo(String packageURI, boolean dynamic, CDOIDMetaRange metaIDRange, String parentURI)
+ {
+ this.packageURI = packageURI;
+ this.dynamic = dynamic;
+ this.metaIDRange = metaIDRange;
+ this.parentURI = parentURI;
+ }
+
+ public String getPackageURI()
+ {
+ return packageURI;
+ }
+
+ public boolean isDynamic()
+ {
+ return dynamic;
+ }
+
+ public CDOIDMetaRange getMetaIDRange()
+ {
+ return metaIDRange;
+ }
+
+ public String getParentURI()
+ {
+ return parentURI;
+ }
+}
diff --git a/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/common/model/CDOPackageManager.java b/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/common/model/CDOPackageManager.java
new file mode 100644
index 0000000000..bd6d7e3a6b
--- /dev/null
+++ b/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/common/model/CDOPackageManager.java
@@ -0,0 +1,35 @@
+/***************************************************************************
+ * Copyright (c) 2004 - 2008 Eike Stepper, Germany.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Eike Stepper - initial API and implementation
+ **************************************************************************/
+package org.eclipse.emf.cdo.common.model;
+
+import org.eclipse.emf.cdo.common.id.CDOIDObjectFactory;
+import org.eclipse.emf.cdo.common.model.core.CDOCorePackage;
+import org.eclipse.emf.cdo.common.model.resource.CDOResourcePackage;
+
+import org.eclipse.net4j.util.container.IContainer;
+
+/**
+ * @author Eike Stepper
+ */
+public interface CDOPackageManager extends IContainer<CDOPackage>
+{
+ public CDOIDObjectFactory getCDOIDObjectFactory();
+
+ public int getPackageCount();
+
+ public CDOPackage[] getPackages();
+
+ public CDOPackage lookupPackage(String packageURI);
+
+ public CDOCorePackage getCDOCorePackage();
+
+ public CDOResourcePackage getCDOResourcePackage();
+}
diff --git a/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/common/model/CDOType.java b/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/common/model/CDOType.java
new file mode 100644
index 0000000000..558ba8253a
--- /dev/null
+++ b/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/common/model/CDOType.java
@@ -0,0 +1,80 @@
+/***************************************************************************
+ * Copyright (c) 2004 - 2008 Eike Stepper, Germany.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Eike Stepper - initial API and implementation
+ **************************************************************************/
+package org.eclipse.emf.cdo.common.model;
+
+import org.eclipse.emf.cdo.common.id.CDOIDObjectFactory;
+
+import org.eclipse.net4j.util.io.ExtendedDataInput;
+import org.eclipse.net4j.util.io.ExtendedDataOutput;
+
+import java.io.IOException;
+
+/**
+ * @author Eike Stepper
+ */
+public interface CDOType
+{
+ public static final CDOType OBJECT = org.eclipse.emf.cdo.internal.common.model.CDOTypeImpl.OBJECT;
+
+ public static final CDOType BOOLEAN = org.eclipse.emf.cdo.internal.common.model.CDOTypeImpl.BOOLEAN;
+
+ public static final CDOType BOOLEAN_OBJECT = org.eclipse.emf.cdo.internal.common.model.CDOTypeImpl.BOOLEAN_OBJECT;
+
+ public static final CDOType BYTE = org.eclipse.emf.cdo.internal.common.model.CDOTypeImpl.BYTE;
+
+ public static final CDOType BYTE_OBJECT = org.eclipse.emf.cdo.internal.common.model.CDOTypeImpl.BYTE_OBJECT;
+
+ public static final CDOType CHAR = org.eclipse.emf.cdo.internal.common.model.CDOTypeImpl.CHAR;
+
+ public static final CDOType CHARACTER_OBJECT = org.eclipse.emf.cdo.internal.common.model.CDOTypeImpl.CHARACTER_OBJECT;
+
+ public static final CDOType DATE = org.eclipse.emf.cdo.internal.common.model.CDOTypeImpl.DATE;
+
+ public static final CDOType DOUBLE = org.eclipse.emf.cdo.internal.common.model.CDOTypeImpl.DOUBLE;
+
+ public static final CDOType DOUBLE_OBJECT = org.eclipse.emf.cdo.internal.common.model.CDOTypeImpl.DOUBLE_OBJECT;
+
+ public static final CDOType FLOAT = org.eclipse.emf.cdo.internal.common.model.CDOTypeImpl.FLOAT;
+
+ public static final CDOType FLOAT_OBJECT = org.eclipse.emf.cdo.internal.common.model.CDOTypeImpl.FLOAT_OBJECT;
+
+ public static final CDOType INT = org.eclipse.emf.cdo.internal.common.model.CDOTypeImpl.INT;
+
+ public static final CDOType INTEGER_OBJECT = org.eclipse.emf.cdo.internal.common.model.CDOTypeImpl.INTEGER_OBJECT;
+
+ public static final CDOType LONG = org.eclipse.emf.cdo.internal.common.model.CDOTypeImpl.LONG;
+
+ public static final CDOType LONG_OBJECT = org.eclipse.emf.cdo.internal.common.model.CDOTypeImpl.LONG_OBJECT;
+
+ public static final CDOType SHORT = org.eclipse.emf.cdo.internal.common.model.CDOTypeImpl.SHORT;
+
+ public static final CDOType SHORT_OBJECT = org.eclipse.emf.cdo.internal.common.model.CDOTypeImpl.SHORT_OBJECT;
+
+ public static final CDOType STRING = org.eclipse.emf.cdo.internal.common.model.CDOTypeImpl.STRING;
+
+ public static final CDOType BYTE_ARRAY = org.eclipse.emf.cdo.internal.common.model.CDOTypeImpl.BYTE_ARRAY;
+
+ public static final CDOType CUSTOM = org.eclipse.emf.cdo.internal.common.model.CDOTypeImpl.CUSTOM;
+
+ public String getName();
+
+ public int getTypeID();
+
+ public boolean canBeNull();
+
+ public Object getDefaultValue();
+
+ public Object copyValue(Object value);
+
+ public Object readValue(ExtendedDataInput in, CDOIDObjectFactory factory) throws IOException;
+
+ public void writeValue(ExtendedDataOutput out, Object value) throws IOException;
+}
diff --git a/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/common/model/core/CDOCorePackage.java b/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/common/model/core/CDOCorePackage.java
new file mode 100644
index 0000000000..908af68f9b
--- /dev/null
+++ b/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/common/model/core/CDOCorePackage.java
@@ -0,0 +1,25 @@
+/***************************************************************************
+ * Copyright (c) 2004 - 2008 Eike Stepper, Germany.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Eike Stepper - initial API and implementation
+ **************************************************************************/
+package org.eclipse.emf.cdo.common.model.core;
+
+import org.eclipse.emf.cdo.common.model.CDOPackage;
+
+/**
+ * @author Eike Stepper
+ */
+public interface CDOCorePackage extends CDOPackage
+{
+ public static final String PACKAGE_URI = "http://www.eclipse.org/emf/CDO/core/1.0.0";
+
+ public static final String NAME = "cdocore";
+
+ public CDOObjectClass getCDOObjectClass();
+}
diff --git a/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/common/model/core/CDOObjectClass.java b/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/common/model/core/CDOObjectClass.java
new file mode 100644
index 0000000000..ffb3f161bc
--- /dev/null
+++ b/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/common/model/core/CDOObjectClass.java
@@ -0,0 +1,23 @@
+/***************************************************************************
+ * Copyright (c) 2004 - 2008 Eike Stepper, Germany.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Eike Stepper - initial API and implementation
+ **************************************************************************/
+package org.eclipse.emf.cdo.common.model.core;
+
+import org.eclipse.emf.cdo.common.model.CDOClass;
+
+/**
+ * @author Eike Stepper
+ */
+public interface CDOObjectClass extends CDOClass
+{
+ public static final int CLASSIFIER_ID = 0;
+
+ public static final String NAME = "CDOObject";
+}
diff --git a/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/common/model/resource/CDOContentsFeature.java b/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/common/model/resource/CDOContentsFeature.java
new file mode 100644
index 0000000000..d8bfeebdc4
--- /dev/null
+++ b/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/common/model/resource/CDOContentsFeature.java
@@ -0,0 +1,23 @@
+/***************************************************************************
+ * Copyright (c) 2004 - 2008 Eike Stepper, Germany.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Eike Stepper - initial API and implementation
+ **************************************************************************/
+package org.eclipse.emf.cdo.common.model.resource;
+
+import org.eclipse.emf.cdo.common.model.CDOFeature;
+
+/**
+ * @author Eike Stepper
+ */
+public interface CDOContentsFeature extends CDOFeature
+{
+ public static final int FEATURE_ID = 2;
+
+ public static final String NAME = "contents";
+}
diff --git a/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/common/model/resource/CDOPathFeature.java b/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/common/model/resource/CDOPathFeature.java
new file mode 100644
index 0000000000..1438fb1f57
--- /dev/null
+++ b/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/common/model/resource/CDOPathFeature.java
@@ -0,0 +1,23 @@
+/***************************************************************************
+ * Copyright (c) 2004 - 2008 Eike Stepper, Germany.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Eike Stepper - initial API and implementation
+ **************************************************************************/
+package org.eclipse.emf.cdo.common.model.resource;
+
+import org.eclipse.emf.cdo.common.model.CDOFeature;
+
+/**
+ * @author Eike Stepper
+ */
+public interface CDOPathFeature extends CDOFeature
+{
+ public static final int FEATURE_ID = 9;
+
+ public static final String NAME = "path";
+}
diff --git a/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/common/model/resource/CDOResourceClass.java b/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/common/model/resource/CDOResourceClass.java
new file mode 100644
index 0000000000..dde37970b2
--- /dev/null
+++ b/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/common/model/resource/CDOResourceClass.java
@@ -0,0 +1,27 @@
+/***************************************************************************
+ * Copyright (c) 2004 - 2008 Eike Stepper, Germany.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Eike Stepper - initial API and implementation
+ **************************************************************************/
+package org.eclipse.emf.cdo.common.model.resource;
+
+import org.eclipse.emf.cdo.common.model.CDOClass;
+
+/**
+ * @author Eike Stepper
+ */
+public interface CDOResourceClass extends CDOClass
+{
+ public static final int CLASSIFIER_ID = 0;
+
+ public static final String NAME = "CDOResource";
+
+ public CDOPathFeature getCDOPathFeature();
+
+ public CDOContentsFeature getCDOContentsFeature();
+}
diff --git a/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/common/model/resource/CDOResourcePackage.java b/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/common/model/resource/CDOResourcePackage.java
new file mode 100644
index 0000000000..309040391c
--- /dev/null
+++ b/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/common/model/resource/CDOResourcePackage.java
@@ -0,0 +1,26 @@
+/***************************************************************************
+ * Copyright (c) 2004 - 2008 Eike Stepper, Germany.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Eike Stepper - initial API and implementation
+ **************************************************************************/
+package org.eclipse.emf.cdo.common.model.resource;
+
+import org.eclipse.emf.cdo.common.model.CDOPackage;
+
+/**
+ * @author Eike Stepper
+ */
+public interface CDOResourcePackage extends CDOPackage
+{
+ public static final String PACKAGE_URI = "http://www.eclipse.org/emf/CDO/resource/1.0.0";
+
+ public static final String NAME = "cdoresource";
+
+ public CDOResourceClass getCDOResourceClass();
+
+}
diff --git a/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/common/revision/CDOReferenceProxy.java b/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/common/revision/CDOReferenceProxy.java
new file mode 100644
index 0000000000..d7c466de6e
--- /dev/null
+++ b/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/common/revision/CDOReferenceProxy.java
@@ -0,0 +1,28 @@
+/***************************************************************************
+ * Copyright (c) 2004 - 2008 Eike Stepper, Germany.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Eike Stepper - initial API and implementation
+ **************************************************************************/
+package org.eclipse.emf.cdo.common.revision;
+
+import org.eclipse.emf.cdo.common.id.CDOID;
+import org.eclipse.emf.cdo.common.model.CDOFeature;
+
+/**
+ * @author Eike Stepper
+ */
+public interface CDOReferenceProxy
+{
+ public CDORevision getRevision();
+
+ public CDOFeature getFeature();
+
+ public int getIndex();
+
+ public CDOID resolve();
+}
diff --git a/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/common/revision/CDORevision.java b/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/common/revision/CDORevision.java
new file mode 100644
index 0000000000..a38fabb631
--- /dev/null
+++ b/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/common/revision/CDORevision.java
@@ -0,0 +1,59 @@
+/***************************************************************************
+ * Copyright (c) 2004 - 2008 Eike Stepper, Germany.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Eike Stepper - initial API and implementation
+ * Simon McDuff - delta support
+ **************************************************************************/
+package org.eclipse.emf.cdo.common.revision;
+
+import org.eclipse.emf.cdo.common.id.CDOID;
+import org.eclipse.emf.cdo.common.id.CDOIDProvider;
+import org.eclipse.emf.cdo.common.model.CDOClass;
+import org.eclipse.emf.cdo.common.revision.delta.CDORevisionDelta;
+
+import org.eclipse.net4j.util.io.ExtendedDataOutput;
+
+import java.io.IOException;
+
+/**
+ * @author Eike Stepper
+ */
+public interface CDORevision
+{
+ public static final long UNSPECIFIED_DATE = 0;
+
+ public static final int UNCHUNKED = -1;
+
+ public CDORevisionResolver getRevisionResolver();
+
+ public CDOClass getCDOClass();
+
+ public CDOID getID();
+
+ public int getVersion();
+
+ public long getCreated();
+
+ public long getRevised();
+
+ public boolean isCurrent();
+
+ public boolean isValid(long timeStamp);
+
+ public boolean isTransactional();
+
+ public boolean isResource();
+
+ public CDORevisionData getData();
+
+ public CDORevisionDelta compare(CDORevision origin);
+
+ public void merge(CDORevisionDelta delta);
+
+ public void write(ExtendedDataOutput out, CDOIDProvider idProvider, int referenceChunk) throws IOException;
+}
diff --git a/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/common/revision/CDORevisionData.java b/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/common/revision/CDORevisionData.java
new file mode 100644
index 0000000000..06bf2b8384
--- /dev/null
+++ b/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/common/revision/CDORevisionData.java
@@ -0,0 +1,48 @@
+/***************************************************************************
+ * Copyright (c) 2004 - 2008 Eike Stepper, Germany.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Eike Stepper - initial API and implementation
+ **************************************************************************/
+package org.eclipse.emf.cdo.common.revision;
+
+import org.eclipse.emf.cdo.common.id.CDOID;
+import org.eclipse.emf.cdo.common.model.CDOFeature;
+
+/**
+ * @author Eike Stepper
+ */
+public interface CDORevisionData
+{
+ public CDORevision getRevision();
+
+ public CDOID getResourceID();
+
+ public CDOID getContainerID();
+
+ public int getContainingFeatureID();
+
+ public Object get(CDOFeature feature, int index);
+
+ public int size(CDOFeature feature);
+
+ public boolean isEmpty(CDOFeature feature);
+
+ public boolean contains(CDOFeature feature, Object value);
+
+ public int indexOf(CDOFeature feature, Object value);
+
+ public int lastIndexOf(CDOFeature feature, Object value);
+
+ public boolean isSet(CDOFeature feature);
+
+ public <T> T[] toArray(CDOFeature feature, T[] array);
+
+ public Object[] toArray(CDOFeature feature);
+
+ public int hashCode(CDOFeature feature);
+}
diff --git a/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/common/revision/CDORevisionResolver.java b/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/common/revision/CDORevisionResolver.java
new file mode 100644
index 0000000000..76bf815920
--- /dev/null
+++ b/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/common/revision/CDORevisionResolver.java
@@ -0,0 +1,64 @@
+/***************************************************************************
+ * Copyright (c) 2004 - 2008 Eike Stepper, Germany.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Eike Stepper - initial API and implementation
+ **************************************************************************/
+package org.eclipse.emf.cdo.common.revision;
+
+import org.eclipse.emf.cdo.common.id.CDOID;
+import org.eclipse.emf.cdo.common.id.CDOIDObjectFactory;
+import org.eclipse.emf.cdo.common.model.CDOClass;
+
+import java.util.Collection;
+import java.util.List;
+
+/**
+ * @author Eike Stepper
+ */
+public interface CDORevisionResolver
+{
+ public CDOIDObjectFactory getCDOIDObjectFactory();
+
+ /**
+ * @return The type of an object if a revision for that object is in the revision cache, <code>null</code> otherwise.
+ */
+ public CDOClass getObjectType(CDOID id);
+
+ public boolean containsRevision(CDOID id);
+
+ public boolean containsRevisionByTime(CDOID id, long timeStamp);
+
+ public boolean containsRevisionByVersion(CDOID id, int version);
+
+ public CDORevision getRevision(CDOID id, int referenceChunk);
+
+ public CDORevision getRevisionByTime(CDOID id, int referenceChunk, long timeStamp);
+
+ public CDORevision getRevisionByVersion(CDOID id, int referenceChunk, int version);
+
+ public CDORevision getRevisionByVersion(CDOID id, int referenceChunk, int version, boolean loadOnDemand);
+
+ public List<CDORevision> getRevisions(Collection<CDOID> ids, int referenceChunk);
+
+ public List<CDORevision> getRevisionsByTime(Collection<CDOID> ids, int referenceChunk, long timeStamp);
+
+ public CDOID resolveReferenceProxy(CDOReferenceProxy referenceProxy);
+
+ /**
+ * Analyzing a list of values with respect to consecutive sequences of {@link CDOReferenceProxy} instances. A sequence
+ * of reference proxies is considered consecutive if and only if the {@link CDOReferenceProxy#getIndex() ids} of each
+ * proxy is the ids of its predecessor increased by one.
+ * <p>
+ * Implementation note: The implementation of this method should try to determine and deliver the longest possible
+ * consecutive sequences.
+ *
+ * @return An integer list of the range <b>sizes</b>. A positive integer denotes a range of non-proxies. A negative
+ * integer denotes a range of proxies. Ranges of zero size are not possible by definition.
+ */
+ public List<Integer> analyzeReferenceRanges(List<Object> list);
+}
diff --git a/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/common/revision/CDORevisionUtil.java b/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/common/revision/CDORevisionUtil.java
new file mode 100644
index 0000000000..a7828ed1ed
--- /dev/null
+++ b/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/common/revision/CDORevisionUtil.java
@@ -0,0 +1,71 @@
+/***************************************************************************
+ * Copyright (c) 2004 - 2008 Eike Stepper, Germany.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Eike Stepper - initial API and implementation
+ **************************************************************************/
+package org.eclipse.emf.cdo.common.revision;
+
+import org.eclipse.emf.cdo.common.id.CDOID;
+import org.eclipse.emf.cdo.common.id.CDOIDTemp;
+import org.eclipse.emf.cdo.common.model.CDOClass;
+import org.eclipse.emf.cdo.common.model.CDOPackageManager;
+import org.eclipse.emf.cdo.internal.common.revision.CDORevisionImpl;
+
+import org.eclipse.net4j.util.io.ExtendedDataInput;
+
+import java.io.IOException;
+import java.util.Map;
+
+/**
+ * @author Eike Stepper
+ */
+public final class CDORevisionUtil
+{
+ public static final Object UNINITIALIZED = new Uninitialized();
+
+ private CDORevisionUtil()
+ {
+ }
+
+ public static CDORevision create(CDORevisionResolver revisionResolver, CDOClass cdoClass, CDOID id)
+ {
+ return new CDORevisionImpl(revisionResolver, cdoClass, id);
+ }
+
+ public static CDORevision copy(CDORevision source)
+ {
+ return new CDORevisionImpl((CDORevisionImpl)source);
+ }
+
+ public static CDORevision read(ExtendedDataInput in, CDORevisionResolver revisionResolver,
+ CDOPackageManager packageManager) throws IOException
+ {
+ return new CDORevisionImpl(in, revisionResolver, packageManager);
+ }
+
+ public static Object remapID(Object value, Map<CDOIDTemp, CDOID> idMappings)
+ {
+ return CDORevisionImpl.remapID(value, idMappings);
+ }
+
+ /**
+ * @author Eike Stepper
+ */
+ private static final class Uninitialized
+ {
+ public Uninitialized()
+ {
+ }
+
+ @Override
+ public String toString()
+ {
+ return "UNINITIALIZED";
+ }
+ }
+}
diff --git a/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/common/revision/delta/CDOAddFeatureDelta.java b/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/common/revision/delta/CDOAddFeatureDelta.java
new file mode 100644
index 0000000000..a3617c70fe
--- /dev/null
+++ b/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/common/revision/delta/CDOAddFeatureDelta.java
@@ -0,0 +1,22 @@
+/***************************************************************************
+ * Copyright (c) 2004 - 2008 Eike Stepper, Germany.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Simon McDuff - initial API and implementation
+ * Eike Stepper - maintenance
+ **************************************************************************/
+package org.eclipse.emf.cdo.common.revision.delta;
+
+/**
+ * @author Simon McDuff
+ */
+public interface CDOAddFeatureDelta extends CDOFeatureDelta
+{
+ public int getIndex();
+
+ public Object getValue();
+}
diff --git a/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/common/revision/delta/CDOClearFeatureDelta.java b/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/common/revision/delta/CDOClearFeatureDelta.java
new file mode 100644
index 0000000000..61f22a3d03
--- /dev/null
+++ b/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/common/revision/delta/CDOClearFeatureDelta.java
@@ -0,0 +1,19 @@
+/***************************************************************************
+ * Copyright (c) 2004 - 2008 Eike Stepper, Germany.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Simon McDuff - initial API and implementation
+ * Eike Stepper - maintenance
+ **************************************************************************/
+package org.eclipse.emf.cdo.common.revision.delta;
+
+/**
+ * @author Simon McDuff
+ */
+public interface CDOClearFeatureDelta extends CDOFeatureDelta
+{
+}
diff --git a/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/common/revision/delta/CDOContainerFeatureDelta.java b/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/common/revision/delta/CDOContainerFeatureDelta.java
new file mode 100644
index 0000000000..bfcecf7a91
--- /dev/null
+++ b/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/common/revision/delta/CDOContainerFeatureDelta.java
@@ -0,0 +1,24 @@
+/***************************************************************************
+ * Copyright (c) 2004 - 2008 Eike Stepper, Germany.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Simon McDuff - initial API and implementation
+ * Eike Stepper - maintenance
+ **************************************************************************/
+package org.eclipse.emf.cdo.common.revision.delta;
+
+import org.eclipse.emf.cdo.common.id.CDOID;
+
+/**
+ * @author Simon McDuff
+ */
+public interface CDOContainerFeatureDelta extends CDOFeatureDelta
+{
+ public CDOID getContainerID();
+
+ public int getContainerFeatureID();
+}
diff --git a/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/common/revision/delta/CDOFeatureDelta.java b/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/common/revision/delta/CDOFeatureDelta.java
new file mode 100644
index 0000000000..b6abd5cd21
--- /dev/null
+++ b/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/common/revision/delta/CDOFeatureDelta.java
@@ -0,0 +1,37 @@
+/***************************************************************************
+ * Copyright (c) 2004 - 2008 Eike Stepper, Germany.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Simon McDuff - initial API and implementation
+ * Eike Stepper - maintenance
+ **************************************************************************/
+package org.eclipse.emf.cdo.common.revision.delta;
+
+import org.eclipse.emf.cdo.common.model.CDOFeature;
+import org.eclipse.emf.cdo.common.revision.CDORevision;
+
+/**
+ * @author Simon McDuff
+ */
+public interface CDOFeatureDelta
+{
+ public Type getType();
+
+ public CDOFeature getFeature();
+
+ public void apply(CDORevision revision);
+
+ public void accept(CDOFeatureDeltaVisitor visitor);
+
+ /**
+ * @author Simon McDuff
+ */
+ public enum Type
+ {
+ ADD, REMOVE, CLEAR, MOVE, SET, UNSET, LIST, CONTAINER
+ }
+}
diff --git a/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/common/revision/delta/CDOFeatureDeltaHandler.java b/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/common/revision/delta/CDOFeatureDeltaHandler.java
new file mode 100644
index 0000000000..fe9597452a
--- /dev/null
+++ b/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/common/revision/delta/CDOFeatureDeltaHandler.java
@@ -0,0 +1,19 @@
+/***************************************************************************
+ * Copyright (c) 2004 - 2008 Eike Stepper, Germany.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Eike Stepper - initial API and implementation
+ **************************************************************************/
+package org.eclipse.emf.cdo.common.revision.delta;
+
+/**
+ * @author Eike Stepper
+ */
+public interface CDOFeatureDeltaHandler
+{
+ public void handleFeatureDelta(CDOFeatureDelta featureDelta);
+}
diff --git a/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/common/revision/delta/CDOFeatureDeltaVisitor.java b/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/common/revision/delta/CDOFeatureDeltaVisitor.java
new file mode 100644
index 0000000000..17e4b2e980
--- /dev/null
+++ b/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/common/revision/delta/CDOFeatureDeltaVisitor.java
@@ -0,0 +1,34 @@
+/***************************************************************************
+ * Copyright (c) 2004 - 2008 Eike Stepper, Germany.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Simon McDuff - initial API and implementation
+ * Eike Stepper - maintenance
+ **************************************************************************/
+package org.eclipse.emf.cdo.common.revision.delta;
+
+/**
+ * @author Simon McDuff
+ */
+public interface CDOFeatureDeltaVisitor
+{
+ public void visit(CDOMoveFeatureDelta delta);
+
+ public void visit(CDOAddFeatureDelta delta);
+
+ public void visit(CDORemoveFeatureDelta delta);
+
+ public void visit(CDOSetFeatureDelta delta);
+
+ public void visit(CDOUnsetFeatureDelta delta);
+
+ public void visit(CDOListFeatureDelta delta);
+
+ public void visit(CDOClearFeatureDelta delta);
+
+ public void visit(CDOContainerFeatureDelta delta);
+}
diff --git a/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/common/revision/delta/CDOListFeatureDelta.java b/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/common/revision/delta/CDOListFeatureDelta.java
new file mode 100644
index 0000000000..8b2eb714d1
--- /dev/null
+++ b/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/common/revision/delta/CDOListFeatureDelta.java
@@ -0,0 +1,22 @@
+/***************************************************************************
+ * Copyright (c) 2004 - 2008 Eike Stepper, Germany.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Simon McDuff - initial API and implementation
+ * Eike Stepper - maintenance
+ **************************************************************************/
+package org.eclipse.emf.cdo.common.revision.delta;
+
+import java.util.List;
+
+/**
+ * @author Simon McDuff
+ */
+public interface CDOListFeatureDelta extends CDOFeatureDelta
+{
+ public List<CDOFeatureDelta> getListChanges();
+}
diff --git a/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/common/revision/delta/CDOMoveFeatureDelta.java b/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/common/revision/delta/CDOMoveFeatureDelta.java
new file mode 100644
index 0000000000..0b76002436
--- /dev/null
+++ b/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/common/revision/delta/CDOMoveFeatureDelta.java
@@ -0,0 +1,22 @@
+/***************************************************************************
+ * Copyright (c) 2004 - 2008 Eike Stepper, Germany.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Simon McDuff - initial API and implementation
+ * Eike Stepper - maintenance
+ **************************************************************************/
+package org.eclipse.emf.cdo.common.revision.delta;
+
+/**
+ * @author Simon McDuff
+ */
+public interface CDOMoveFeatureDelta extends CDOFeatureDelta
+{
+ public int getOldPosition();
+
+ public int getNewPosition();
+}
diff --git a/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/common/revision/delta/CDORemoveFeatureDelta.java b/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/common/revision/delta/CDORemoveFeatureDelta.java
new file mode 100644
index 0000000000..6458bd5ce6
--- /dev/null
+++ b/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/common/revision/delta/CDORemoveFeatureDelta.java
@@ -0,0 +1,20 @@
+/***************************************************************************
+ * Copyright (c) 2004 - 2008 Eike Stepper, Germany.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Simon McDuff - initial API and implementation
+ * Eike Stepper - maintenance
+ **************************************************************************/
+package org.eclipse.emf.cdo.common.revision.delta;
+
+/**
+ * @author Simon McDuff
+ */
+public interface CDORemoveFeatureDelta extends CDOFeatureDelta
+{
+ public int getIndex();
+}
diff --git a/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/common/revision/delta/CDORevisionDelta.java b/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/common/revision/delta/CDORevisionDelta.java
new file mode 100644
index 0000000000..cf543f68fd
--- /dev/null
+++ b/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/common/revision/delta/CDORevisionDelta.java
@@ -0,0 +1,41 @@
+/***************************************************************************
+ * Copyright (c) 2004 - 2008 Eike Stepper, Germany.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Eike Stepper - initial API and implementation
+ * Simon McDuff - https://bugs.eclipse.org/bugs/show_bug.cgi?id=201266
+ **************************************************************************/
+package org.eclipse.emf.cdo.common.revision.delta;
+
+import org.eclipse.emf.cdo.common.id.CDOID;
+import org.eclipse.emf.cdo.common.id.CDOIDProvider;
+import org.eclipse.emf.cdo.common.revision.CDORevision;
+
+import org.eclipse.net4j.util.io.ExtendedDataOutput;
+
+import java.io.IOException;
+import java.util.List;
+
+/**
+ * @author Eike Stepper
+ */
+public interface CDORevisionDelta
+{
+ public CDOID getID();
+
+ public int getOriginVersion();
+
+ public int getDirtyVersion();
+
+ public List<CDOFeatureDelta> getFeatureDeltas();
+
+ public void apply(CDORevision revision);
+
+ public void accept(CDOFeatureDeltaVisitor visitor);
+
+ public void write(ExtendedDataOutput out, CDOIDProvider idProvider) throws IOException;
+}
diff --git a/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/common/revision/delta/CDORevisionDeltaUtil.java b/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/common/revision/delta/CDORevisionDeltaUtil.java
new file mode 100644
index 0000000000..09b99d01aa
--- /dev/null
+++ b/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/common/revision/delta/CDORevisionDeltaUtil.java
@@ -0,0 +1,44 @@
+/***************************************************************************
+ * Copyright (c) 2004 - 2008 Eike Stepper, Germany.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Eike Stepper - initial API and implementation
+ **************************************************************************/
+package org.eclipse.emf.cdo.common.revision.delta;
+
+import org.eclipse.emf.cdo.common.model.CDOPackageManager;
+import org.eclipse.emf.cdo.common.revision.CDORevision;
+import org.eclipse.emf.cdo.internal.common.revision.delta.CDORevisionDeltaImpl;
+
+import org.eclipse.net4j.util.io.ExtendedDataInput;
+
+import java.io.IOException;
+
+/**
+ * @author Eike Stepper
+ */
+public final class CDORevisionDeltaUtil
+{
+ private CDORevisionDeltaUtil()
+ {
+ }
+
+ public static CDORevisionDelta create(CDORevision revision)
+ {
+ return new CDORevisionDeltaImpl(revision);
+ }
+
+ public static CDORevisionDelta create(CDORevision originRevision, CDORevision dirtyRevision)
+ {
+ return new CDORevisionDeltaImpl(originRevision, dirtyRevision);
+ }
+
+ public static CDORevisionDelta read(ExtendedDataInput in, CDOPackageManager packageManager) throws IOException
+ {
+ return new CDORevisionDeltaImpl(in, packageManager);
+ }
+}
diff --git a/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/common/revision/delta/CDOSetFeatureDelta.java b/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/common/revision/delta/CDOSetFeatureDelta.java
new file mode 100644
index 0000000000..6d9bff9ca8
--- /dev/null
+++ b/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/common/revision/delta/CDOSetFeatureDelta.java
@@ -0,0 +1,22 @@
+/***************************************************************************
+ * Copyright (c) 2004 - 2008 Eike Stepper, Germany.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Simon McDuff - initial API and implementation
+ * Eike Stepper - maintenance
+ **************************************************************************/
+package org.eclipse.emf.cdo.common.revision.delta;
+
+/**
+ * @author Simon McDuff
+ */
+public interface CDOSetFeatureDelta extends CDOFeatureDelta
+{
+ public int getIndex();
+
+ public Object getValue();
+}
diff --git a/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/common/revision/delta/CDOUnsetFeatureDelta.java b/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/common/revision/delta/CDOUnsetFeatureDelta.java
new file mode 100644
index 0000000000..eb095cd9ec
--- /dev/null
+++ b/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/common/revision/delta/CDOUnsetFeatureDelta.java
@@ -0,0 +1,19 @@
+/***************************************************************************
+ * Copyright (c) 2004 - 2008 Eike Stepper, Germany.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Simon McDuff - initial API and implementation
+ * Eike Stepper - maintenance
+ **************************************************************************/
+package org.eclipse.emf.cdo.common.revision.delta;
+
+/**
+ * @author Simon McDuff
+ */
+public interface CDOUnsetFeatureDelta extends CDOFeatureDelta
+{
+}
diff --git a/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/common/util/CDOException.java b/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/common/util/CDOException.java
new file mode 100644
index 0000000000..cc62eb638c
--- /dev/null
+++ b/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/common/util/CDOException.java
@@ -0,0 +1,38 @@
+/***************************************************************************
+ * Copyright (c) 2004 - 2008 Eike Stepper, Germany.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Eike Stepper - initial API and implementation
+ **************************************************************************/
+package org.eclipse.emf.cdo.common.util;
+
+/**
+ * @author Eike Stepper
+ */
+public class CDOException extends RuntimeException
+{
+ private static final long serialVersionUID = 1L;
+
+ public CDOException()
+ {
+ }
+
+ public CDOException(String message)
+ {
+ super(message);
+ }
+
+ public CDOException(Throwable cause)
+ {
+ super(cause);
+ }
+
+ public CDOException(String message, Throwable cause)
+ {
+ super(message, cause);
+ }
+}
diff --git a/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/common/util/CDOGZIPStreamWrapperInjector.java b/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/common/util/CDOGZIPStreamWrapperInjector.java
new file mode 100644
index 0000000000..22f6bad1b0
--- /dev/null
+++ b/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/common/util/CDOGZIPStreamWrapperInjector.java
@@ -0,0 +1,26 @@
+/***************************************************************************
+ * Copyright (c) 2004 - 2008 Eike Stepper, Germany.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Eike Stepper - initial API and implementation
+ **************************************************************************/
+package org.eclipse.emf.cdo.common.util;
+
+import org.eclipse.emf.cdo.common.CDOProtocolConstants;
+
+import org.eclipse.net4j.signal.wrapping.GZIPStreamWrapperInjector;
+
+/**
+ * @author Eike Stepper
+ */
+public class CDOGZIPStreamWrapperInjector extends GZIPStreamWrapperInjector
+{
+ public CDOGZIPStreamWrapperInjector()
+ {
+ super(CDOProtocolConstants.PROTOCOL_NAME);
+ }
+}
diff --git a/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/common/util/CDOXORStreamWrapperInjector.java b/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/common/util/CDOXORStreamWrapperInjector.java
new file mode 100644
index 0000000000..b0a7ebe86c
--- /dev/null
+++ b/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/common/util/CDOXORStreamWrapperInjector.java
@@ -0,0 +1,28 @@
+/***************************************************************************
+ * Copyright (c) 2004 - 2008 Eike Stepper, Germany.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Eike Stepper - initial API and implementation
+ **************************************************************************/
+package org.eclipse.emf.cdo.common.util;
+
+import org.eclipse.emf.cdo.common.CDOProtocolConstants;
+
+import org.eclipse.net4j.signal.wrapping.XORStreamWrapperInjector;
+
+/**
+ * @author Eike Stepper
+ */
+public class CDOXORStreamWrapperInjector extends XORStreamWrapperInjector
+{
+ private static final int[] key = { 0xAA, 0x55, 0xAA, 0x55 };
+
+ public CDOXORStreamWrapperInjector()
+ {
+ super(CDOProtocolConstants.PROTOCOL_NAME, key);
+ }
+}
diff --git a/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/common/util/TransportException.java b/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/common/util/TransportException.java
new file mode 100644
index 0000000000..9d55f61812
--- /dev/null
+++ b/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/common/util/TransportException.java
@@ -0,0 +1,38 @@
+/***************************************************************************
+ * Copyright (c) 2004 - 2008 Eike Stepper, Germany.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Eike Stepper - initial API and implementation
+ **************************************************************************/
+package org.eclipse.emf.cdo.common.util;
+
+/**
+ * @author Eike Stepper
+ */
+public class TransportException extends CDOException
+{
+ private static final long serialVersionUID = 1L;
+
+ public TransportException()
+ {
+ }
+
+ public TransportException(String message)
+ {
+ super(message);
+ }
+
+ public TransportException(String message, Throwable cause)
+ {
+ super(message, cause);
+ }
+
+ public TransportException(Throwable cause)
+ {
+ super(cause);
+ }
+}
diff --git a/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/internal/common/CDOProtocolImpl.java b/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/internal/common/CDOProtocolImpl.java
new file mode 100644
index 0000000000..fb7b6affca
--- /dev/null
+++ b/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/internal/common/CDOProtocolImpl.java
@@ -0,0 +1,37 @@
+/***************************************************************************
+ * Copyright (c) 2004 - 2008 Eike Stepper, Germany.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Eike Stepper - initial API and implementation
+ **************************************************************************/
+package org.eclipse.emf.cdo.internal.common;
+
+import org.eclipse.emf.cdo.common.CDOProtocol;
+import org.eclipse.emf.cdo.common.CDOProtocolConstants;
+import org.eclipse.emf.cdo.common.CDOProtocolSession;
+
+import org.eclipse.net4j.signal.SignalProtocol;
+
+/**
+ * @author Eike Stepper
+ */
+public abstract class CDOProtocolImpl extends SignalProtocol implements CDOProtocol
+{
+ public CDOProtocolImpl()
+ {
+ }
+
+ public String getType()
+ {
+ return CDOProtocolConstants.PROTOCOL_NAME;
+ }
+
+ public CDOProtocolSession getSession()
+ {
+ return (CDOProtocolSession)getInfraStructure();
+ }
+}
diff --git a/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/internal/common/bundle/OM.java b/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/internal/common/bundle/OM.java
new file mode 100644
index 0000000000..7556f5b29f
--- /dev/null
+++ b/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/internal/common/bundle/OM.java
@@ -0,0 +1,60 @@
+/***************************************************************************
+ * Copyright (c) 2004 - 2008 Eike Stepper, Germany.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Eike Stepper - initial API and implementation
+ **************************************************************************/
+package org.eclipse.emf.cdo.internal.common.bundle;
+
+import org.eclipse.net4j.util.om.OMBundle;
+import org.eclipse.net4j.util.om.OMPlatform;
+import org.eclipse.net4j.util.om.OSGiActivator;
+import org.eclipse.net4j.util.om.log.OMLogger;
+import org.eclipse.net4j.util.om.trace.OMTracer;
+
+/**
+ * The <em>Operations & Maintenance</em> class of this bundle.
+ *
+ * @author Eike Stepper
+ */
+public abstract class OM
+{
+ public static final String BUNDLE_ID = "org.eclipse.emf.cdo.common"; //$NON-NLS-1$
+
+ public static final OMBundle BUNDLE = OMPlatform.INSTANCE.bundle(BUNDLE_ID, OM.class);
+
+ public static final OMTracer DEBUG = BUNDLE.tracer("debug"); //$NON-NLS-1$
+
+ public static final OMTracer DEBUG_PROTOCOL = DEBUG.tracer("protocol"); //$NON-NLS-1$
+
+ public static final OMTracer DEBUG_ID = DEBUG.tracer("id"); //$NON-NLS-1$
+
+ public static final OMTracer DEBUG_MODEL = DEBUG.tracer("model"); //$NON-NLS-1$
+
+ public static final OMTracer DEBUG_REVISION = DEBUG.tracer("revision"); //$NON-NLS-1$
+
+ public static final OMTracer PERF = BUNDLE.tracer("perf"); //$NON-NLS-1$
+
+ public static final OMTracer PERF_REVISION = PERF.tracer("revision"); //$NON-NLS-1$
+
+ public static final OMTracer PERF_REVISION_READING = PERF_REVISION.tracer("reading"); //$NON-NLS-1$
+
+ public static final OMTracer PERF_REVISION_WRITING = PERF_REVISION.tracer("writing"); //$NON-NLS-1$
+
+ public static final OMLogger LOG = BUNDLE.logger();
+
+ /**
+ * @author Eike Stepper
+ */
+ public static final class Activator extends OSGiActivator
+ {
+ public Activator()
+ {
+ super(BUNDLE);
+ }
+ }
+}
diff --git a/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/internal/common/id/CDOIDMetaImpl.java b/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/internal/common/id/CDOIDMetaImpl.java
new file mode 100644
index 0000000000..12f7e56ba3
--- /dev/null
+++ b/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/internal/common/id/CDOIDMetaImpl.java
@@ -0,0 +1,38 @@
+/***************************************************************************
+ * Copyright (c) 2004 - 2008 Eike Stepper, Germany.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Eike Stepper - initial API and implementation
+ **************************************************************************/
+package org.eclipse.emf.cdo.internal.common.id;
+
+import org.eclipse.emf.cdo.common.id.CDOIDMeta;
+import org.eclipse.emf.cdo.spi.common.AbstractCDOIDLong;
+
+/**
+ * @author Eike Stepper
+ */
+public class CDOIDMetaImpl extends AbstractCDOIDLong implements CDOIDMeta
+{
+ private static final long serialVersionUID = 1L;
+
+ public CDOIDMetaImpl(long value)
+ {
+ super(value);
+ }
+
+ public Type getType()
+ {
+ return Type.META;
+ }
+
+ @Override
+ public String toString()
+ {
+ return "MID" + getLongValue();
+ }
+}
diff --git a/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/internal/common/id/CDOIDMetaRangeImpl.java b/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/internal/common/id/CDOIDMetaRangeImpl.java
new file mode 100644
index 0000000000..ea727a67aa
--- /dev/null
+++ b/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/internal/common/id/CDOIDMetaRangeImpl.java
@@ -0,0 +1,118 @@
+/***************************************************************************
+ * Copyright (c) 2004 - 2008 Eike Stepper, Germany.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Eike Stepper - initial API and implementation
+ **************************************************************************/
+package org.eclipse.emf.cdo.internal.common.id;
+
+import org.eclipse.emf.cdo.common.id.CDOID;
+import org.eclipse.emf.cdo.common.id.CDOIDMetaRange;
+import org.eclipse.emf.cdo.common.id.CDOID.Type;
+
+import java.text.MessageFormat;
+
+/**
+ * @author Eike Stepper
+ */
+public final class CDOIDMetaRangeImpl implements CDOIDMetaRange
+{
+ private static final long serialVersionUID = 1L;
+
+ private CDOID lowerBound;
+
+ private int size;
+
+ public CDOIDMetaRangeImpl(CDOID lowerBound, int size)
+ {
+ if (size < 0)
+ {
+ throw new IllegalArgumentException("size < 0");
+ }
+
+ this.lowerBound = lowerBound;
+ this.size = size;
+ }
+
+ public CDOID getLowerBound()
+ {
+ return lowerBound;
+ }
+
+ public CDOID getUpperBound()
+ {
+ return size > 0 ? get(size - 1) : null;
+ }
+
+ public CDOID get(int index)
+ {
+ if (index < 0 || index >= size)
+ {
+ throw new IllegalArgumentException("ids < 0 || ids >= size");
+ }
+
+ if (isTemporary())
+ {
+ return new CDOIDTempMetaImpl(((CDOIDTempMetaImpl)lowerBound).getIntValue() + index);
+ }
+
+ return new CDOIDMetaImpl(((CDOIDMetaImpl)lowerBound).getLongValue() + index);
+ }
+
+ public int size()
+ {
+ return size;
+ }
+
+ public boolean isEmpty()
+ {
+ return size == 0;
+ }
+
+ public boolean contains(CDOID id)
+ {
+ if (isTemporary())
+ {
+ if (id.getType() != Type.TEMP_META)
+ {
+ throw new IllegalArgumentException("id.getType() != Type.TEMP_META");
+ }
+
+ int index = ((CDOIDTempMetaImpl)id).getIntValue() - ((CDOIDTempMetaImpl)lowerBound).getIntValue();
+ return 0 <= index && index < size;
+ }
+
+ if (id.getType() != Type.META)
+ {
+ throw new IllegalArgumentException("id.getType() != Type.META");
+ }
+
+ long index = ((CDOIDMetaImpl)id).getLongValue() - ((CDOIDMetaImpl)lowerBound).getLongValue();
+ return 0L <= index && index < size;
+ }
+
+ public CDOIDMetaRange increase()
+ {
+ return new CDOIDMetaRangeImpl(lowerBound, size + 1);
+ }
+
+ public Type getType()
+ {
+ return lowerBound.getType();
+ }
+
+ public boolean isTemporary()
+ {
+ return lowerBound.isTemporary();
+ }
+
+ @Override
+ public String toString()
+ {
+ return MessageFormat.format("[{0}:{1}]", lowerBound, getUpperBound());
+ }
+}
diff --git a/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/internal/common/id/CDOIDNullImpl.java b/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/internal/common/id/CDOIDNullImpl.java
new file mode 100644
index 0000000000..dd959a4baa
--- /dev/null
+++ b/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/internal/common/id/CDOIDNullImpl.java
@@ -0,0 +1,89 @@
+/***************************************************************************
+ * Copyright (c) 2004 - 2008 Eike Stepper, Germany.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Eike Stepper - initial API and implementation
+ **************************************************************************/
+package org.eclipse.emf.cdo.internal.common.id;
+
+import org.eclipse.emf.cdo.common.id.CDOIDMeta;
+import org.eclipse.emf.cdo.common.id.CDOIDObject;
+import org.eclipse.emf.cdo.common.id.CDOIDTemp;
+import org.eclipse.emf.cdo.common.model.CDOClassRef;
+import org.eclipse.emf.cdo.spi.common.AbstractCDOID;
+
+import org.eclipse.net4j.util.io.ExtendedDataInput;
+import org.eclipse.net4j.util.io.ExtendedDataOutput;
+
+import java.io.IOException;
+
+/**
+ * @author Eike Stepper
+ */
+public final class CDOIDNullImpl extends AbstractCDOID implements CDOIDMeta, CDOIDTemp, CDOIDObject
+{
+ public static final CDOIDNullImpl INSTANCE = new CDOIDNullImpl();
+
+ private static final long serialVersionUID = 1L;
+
+ private CDOIDNullImpl()
+ {
+ }
+
+ public Type getType()
+ {
+ return Type.NULL;
+ }
+
+ public int getIntValue()
+ {
+ return 0;
+ }
+
+ public long getLongValue()
+ {
+ return 0L;
+ }
+
+ public CDOIDObject asLegacy(CDOClassRef classRef)
+ {
+ return this;
+ }
+
+ public CDOClassRef getClassRef()
+ {
+ return null;
+ }
+
+ public void read(ExtendedDataInput in) throws IOException
+ {
+ // Do nothing
+ }
+
+ public void write(ExtendedDataOutput out) throws IOException
+ {
+ // Do nothing
+ }
+
+ @Override
+ public boolean equals(Object obj)
+ {
+ return obj == INSTANCE;
+ }
+
+ @Override
+ public int hashCode()
+ {
+ return 0;
+ }
+
+ @Override
+ public String toString()
+ {
+ return "NULL";
+ }
+}
diff --git a/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/internal/common/id/CDOIDTempMetaImpl.java b/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/internal/common/id/CDOIDTempMetaImpl.java
new file mode 100644
index 0000000000..0d5b94a6fd
--- /dev/null
+++ b/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/internal/common/id/CDOIDTempMetaImpl.java
@@ -0,0 +1,38 @@
+/***************************************************************************
+ * Copyright (c) 2004 - 2008 Eike Stepper, Germany.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Eike Stepper - initial API and implementation
+ **************************************************************************/
+package org.eclipse.emf.cdo.internal.common.id;
+
+import org.eclipse.emf.cdo.common.id.CDOIDTemp;
+import org.eclipse.emf.cdo.spi.common.AbstractCDOIDInteger;
+
+/**
+ * @author Eike Stepper
+ */
+public class CDOIDTempMetaImpl extends AbstractCDOIDInteger implements CDOIDTemp
+{
+ private static final long serialVersionUID = 1L;
+
+ public CDOIDTempMetaImpl(int value)
+ {
+ super(value);
+ }
+
+ public Type getType()
+ {
+ return Type.TEMP_META;
+ }
+
+ @Override
+ public String toString()
+ {
+ return "mid" + getIntValue();
+ }
+}
diff --git a/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/internal/common/id/CDOIDTempObjectImpl.java b/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/internal/common/id/CDOIDTempObjectImpl.java
new file mode 100644
index 0000000000..09ba5432be
--- /dev/null
+++ b/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/internal/common/id/CDOIDTempObjectImpl.java
@@ -0,0 +1,38 @@
+/***************************************************************************
+ * Copyright (c) 2004 - 2008 Eike Stepper, Germany.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Eike Stepper - initial API and implementation
+ **************************************************************************/
+package org.eclipse.emf.cdo.internal.common.id;
+
+import org.eclipse.emf.cdo.common.id.CDOIDTemp;
+import org.eclipse.emf.cdo.spi.common.AbstractCDOIDInteger;
+
+/**
+ * @author Eike Stepper
+ */
+public class CDOIDTempObjectImpl extends AbstractCDOIDInteger implements CDOIDTemp
+{
+ private static final long serialVersionUID = 1L;
+
+ public CDOIDTempObjectImpl(int value)
+ {
+ super(value);
+ }
+
+ public Type getType()
+ {
+ return Type.TEMP_OBJECT;
+ }
+
+ @Override
+ public String toString()
+ {
+ return "oid" + getIntValue();
+ }
+}
diff --git a/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/internal/common/model/CDOClassImpl.java b/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/internal/common/model/CDOClassImpl.java
new file mode 100644
index 0000000000..44d3608cfb
--- /dev/null
+++ b/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/internal/common/model/CDOClassImpl.java
@@ -0,0 +1,455 @@
+/***************************************************************************
+ * Copyright (c) 2004 - 2008 Eike Stepper, Germany.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Eike Stepper - initial API and implementation
+ **************************************************************************/
+package org.eclipse.emf.cdo.internal.common.model;
+
+import org.eclipse.emf.cdo.common.model.CDOClass;
+import org.eclipse.emf.cdo.common.model.CDOClassProxy;
+import org.eclipse.emf.cdo.common.model.CDOClassRef;
+import org.eclipse.emf.cdo.common.model.CDOFeature;
+import org.eclipse.emf.cdo.common.model.CDOModelUtil;
+import org.eclipse.emf.cdo.common.model.CDOPackage;
+import org.eclipse.emf.cdo.common.model.CDOPackageManager;
+import org.eclipse.emf.cdo.internal.common.bundle.OM;
+import org.eclipse.emf.cdo.spi.common.InternalCDOClass;
+import org.eclipse.emf.cdo.spi.common.InternalCDOFeature;
+
+import org.eclipse.net4j.util.ObjectUtil;
+import org.eclipse.net4j.util.io.ExtendedDataInput;
+import org.eclipse.net4j.util.io.ExtendedDataOutput;
+import org.eclipse.net4j.util.om.trace.ContextTracer;
+
+import java.io.IOException;
+import java.text.MessageFormat;
+import java.util.ArrayList;
+import java.util.Collections;
+import java.util.List;
+
+/**
+ * @author Eike Stepper
+ */
+public class CDOClassImpl extends CDOModelElementImpl implements InternalCDOClass
+{
+ private static final ContextTracer MODEL = new ContextTracer(OM.DEBUG_MODEL, CDOClassImpl.class);
+
+ private static final ContextTracer PROTOCOL = new ContextTracer(OM.DEBUG_PROTOCOL, CDOClassImpl.class);
+
+ private CDOPackage containingPackage;
+
+ private int classifierID;
+
+ private boolean isAbstract;
+
+ private List<CDOClassProxy> superTypes = new ArrayList<CDOClassProxy>(0);
+
+ private List<CDOFeature> features = new ArrayList<CDOFeature>(0);
+
+ private transient List<Integer> indices;
+
+ private transient CDOClass[] allSuperTypes;
+
+ private transient CDOFeature[] allFeatures;
+
+ public CDOClassImpl()
+ {
+ }
+
+ public CDOClassImpl(CDOPackage containingPackage, int classifierID, String name, boolean isAbstract)
+ {
+ super(name);
+ this.containingPackage = containingPackage;
+ this.classifierID = classifierID;
+ this.isAbstract = isAbstract;
+ if (MODEL.isEnabled())
+ {
+ MODEL.format("Created {0}", this);
+ }
+ }
+
+ public CDOClassImpl(CDOPackage containingPackage, ExtendedDataInput in) throws IOException
+ {
+ this.containingPackage = containingPackage;
+ read(in);
+ }
+
+ @Override
+ public void read(ExtendedDataInput in) throws IOException
+ {
+ super.read(in);
+ classifierID = in.readInt();
+ isAbstract = in.readBoolean();
+ readSuperTypes(in);
+ readFeatures(in);
+
+ if (PROTOCOL.isEnabled())
+ {
+ PROTOCOL.format("Read class: ID={0}, name={1}, abstract={2}", classifierID, getName(), isAbstract);
+ }
+ }
+
+ @Override
+ public void write(ExtendedDataOutput out) throws IOException
+ {
+ if (PROTOCOL.isEnabled())
+ {
+ PROTOCOL.format("Writing class: ID={0}, name={1}, abstract={2}", classifierID, getName(), isAbstract);
+ }
+
+ super.write(out);
+ out.writeInt(classifierID);
+ out.writeBoolean(isAbstract);
+ writeSuperTypes(out);
+ writeFeatures(out);
+ }
+
+ public int getFeatureID(CDOFeature feature)
+ {
+ int index = feature.getFeatureIndex();
+ if (index != -1)
+ {
+ CDOFeature[] features = getAllFeatures();
+ while (index < features.length)
+ {
+ if (features[index] == feature)
+ {
+ return index;
+ }
+
+ ++index;
+ }
+ }
+
+ return -1;
+ }
+
+ public CDOPackageManager getPackageManager()
+ {
+ return containingPackage.getPackageManager();
+ }
+
+ public CDOPackage getContainingPackage()
+ {
+ return containingPackage;
+ }
+
+ public void setContainingPackage(CDOPackage containingPackage)
+ {
+ this.containingPackage = containingPackage;
+ }
+
+ public int getClassifierID()
+ {
+ return classifierID;
+ }
+
+ public void setClassifierID(int classifierID)
+ {
+ this.classifierID = classifierID;
+ }
+
+ public boolean isAbstract()
+ {
+ return isAbstract;
+ }
+
+ public void setAbstract(boolean isAbstract)
+ {
+ this.isAbstract = isAbstract;
+ }
+
+ public boolean isResource()
+ {
+ return false;
+ }
+
+ public boolean isRoot()
+ {
+ return false;
+ }
+
+ public int getSuperTypeCount()
+ {
+ return superTypes.size();
+ }
+
+ public CDOClass[] getSuperTypes()
+ {
+ int size = superTypes.size();
+ CDOClass[] result = new CDOClass[size];
+ for (int i = 0; i < size; i++)
+ {
+ result[i] = getSuperType(i);
+ }
+
+ return result;
+ }
+
+ public void setSuperTypes(List<CDOClass> superTypes)
+ {
+ this.superTypes = new ArrayList<CDOClassProxy>(superTypes.size());
+ for (CDOClass cdoClass : superTypes)
+ {
+ this.superTypes.add(new CDOClassProxy(cdoClass));
+ }
+ }
+
+ public CDOClass getSuperType(int index)
+ {
+ return superTypes.get(index).getCdoClass();
+ }
+
+ public List<CDOClassProxy> getSuperTypeProxies()
+ {
+ return Collections.unmodifiableList(superTypes);
+ }
+
+ public int getFeatureCount()
+ {
+ return features.size();
+ }
+
+ public CDOFeature[] getFeatures()
+ {
+ return features.toArray(new CDOFeature[features.size()]);
+ }
+
+ public void setFeatures(List<CDOFeature> features)
+ {
+ this.features = features;
+ for (CDOFeature feature : features)
+ {
+ ((InternalCDOFeature)feature).setContainingClass(this);
+ }
+ }
+
+ public CDOFeature lookupFeature(int featureID)
+ {
+ int i = getFeatureIndex(featureID);
+ return getAllFeatures()[i];
+ }
+
+ public CDOFeature lookupFeature(String name)
+ {
+ for (CDOFeature feature : getAllFeatures())
+ {
+ if (ObjectUtil.equals(feature.getName(), name))
+ {
+ return feature;
+ }
+ }
+
+ return null;
+ }
+
+ public CDOClassRef createClassRef()
+ {
+ return CDOModelUtil.createClassRef(containingPackage.getPackageURI(), classifierID);
+ }
+
+ public CDOClass[] getAllSuperTypes()
+ {
+ if (allSuperTypes == null)
+ {
+ List<CDOClass> result = new ArrayList<CDOClass>(0);
+ for (CDOClass superType : getSuperTypes())
+ {
+ CDOClass[] higherSupers = superType.getAllSuperTypes();
+ for (CDOClass higherSuper : higherSupers)
+ {
+ addUnique(higherSuper, result);
+ }
+
+ addUnique(superType, result);
+ }
+
+ allSuperTypes = result.toArray(new CDOClass[result.size()]);
+ }
+
+ return allSuperTypes;
+ }
+
+ public int getFeatureIndex(int featureID)
+ {
+ if (indices == null)
+ {
+ CDOFeature[] features = getAllFeatures();
+ indices = new ArrayList<Integer>(features.length);
+ int index = 0;
+ for (CDOFeature feature : features)
+ {
+ if (feature.getContainingClass() == this)
+ {
+ ((InternalCDOFeature)feature).setFeatureIndex(index);
+ }
+
+ setIndex(feature.getFeatureID(), index);
+ index++;
+ }
+ }
+
+ return indices.get(featureID);
+ }
+
+ public CDOFeature[] getAllFeatures()
+ {
+ if (allFeatures == null)
+ {
+ List<CDOFeature> result = new ArrayList<CDOFeature>(0);
+ for (CDOClass superType : getSuperTypes())
+ {
+ CDOFeature[] features = superType.getAllFeatures();
+ addAllFeatures(features, result);
+ }
+
+ addAllFeatures(getFeatures(), result);
+ allFeatures = result.toArray(new CDOFeature[result.size()]);
+ }
+
+ return allFeatures;
+ }
+
+ public void addSuperType(CDOClassRef classRef)
+ {
+ if (MODEL.isEnabled())
+ {
+ MODEL.format("Adding super type: {0}", classRef);
+ }
+
+ superTypes.add(new CDOClassProxy(classRef, containingPackage.getPackageManager()));
+ }
+
+ public void addFeature(CDOFeature cdoFeature)
+ {
+ if (MODEL.isEnabled())
+ {
+ MODEL.format("Adding feature: {0}", cdoFeature);
+ }
+
+ features.add(cdoFeature);
+ }
+
+ public int compareTo(CDOClass that)
+ {
+ return getName().compareTo(that.getName());
+ }
+
+ @Override
+ public String toString()
+ {
+ return MessageFormat.format("CDOClass(ID={0}, name={1})", classifierID, getName());
+ }
+
+ @Override
+ protected void onInitialize()
+ {
+ for (CDOFeature cdoFeature : features)
+ {
+ ((InternalCDOFeature)cdoFeature).initialize();
+ }
+ }
+
+ private void setIndex(int featureID, int index)
+ {
+ while (indices.size() <= featureID)
+ {
+ indices.add(null);
+ }
+
+ indices.set(featureID, index);
+ }
+
+ private void readSuperTypes(ExtendedDataInput in) throws IOException
+ {
+ int size = in.readInt();
+ if (PROTOCOL.isEnabled())
+ {
+ PROTOCOL.format("Reading {0} super types", size);
+ }
+
+ for (int i = 0; i < size; i++)
+ {
+ CDOClassRef classRef = CDOModelUtil.readClassRef(in, containingPackage.getPackageURI());
+ if (PROTOCOL.isEnabled())
+ {
+ PROTOCOL.format("Read super type: classRef={0}", classRef, classifierID);
+ }
+
+ superTypes.add(new CDOClassProxy(classRef, containingPackage.getPackageManager()));
+ }
+ }
+
+ private void readFeatures(ExtendedDataInput in) throws IOException
+ {
+ int size = in.readInt();
+ if (PROTOCOL.isEnabled())
+ {
+ PROTOCOL.format("Reading {0} features", size);
+ }
+
+ for (int i = 0; i < size; i++)
+ {
+ CDOFeature cdoFeature = CDOModelUtil.readFeature(this, in);
+ addFeature(cdoFeature);
+ }
+ }
+
+ private void writeSuperTypes(ExtendedDataOutput out) throws IOException
+ {
+ int size = superTypes.size();
+ if (PROTOCOL.isEnabled())
+ {
+ PROTOCOL.format("Writing {0} super types", size);
+ }
+
+ out.writeInt(size);
+ for (CDOClassProxy proxy : superTypes)
+ {
+ CDOClassRef classRef = proxy.getClassRef();
+ if (PROTOCOL.isEnabled())
+ {
+ PROTOCOL.format("Writing super type: classRef={0}", classRef);
+ }
+
+ CDOModelUtil.writeClassRef(out, classRef, containingPackage.getPackageURI());
+ }
+ }
+
+ private void writeFeatures(ExtendedDataOutput out) throws IOException
+ {
+ int size = features.size();
+ if (PROTOCOL.isEnabled())
+ {
+ PROTOCOL.format("Writing {0} features", size);
+ }
+
+ out.writeInt(size);
+ for (CDOFeature cdoFeature : features)
+ {
+ CDOModelUtil.writeFeature(out, cdoFeature);
+ }
+ }
+
+ private static void addAllFeatures(CDOFeature[] features, List<CDOFeature> result)
+ {
+ for (CDOFeature feature : features)
+ {
+ addUnique(feature, result);
+ }
+ }
+
+ @SuppressWarnings("unchecked")
+ private static void addUnique(Object object, List result)
+ {
+ if (!result.contains(object))
+ {
+ result.add(object);
+ }
+ }
+}
diff --git a/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/internal/common/model/CDOClassRefImpl.java b/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/internal/common/model/CDOClassRefImpl.java
new file mode 100644
index 0000000000..6ce58cbf04
--- /dev/null
+++ b/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/internal/common/model/CDOClassRefImpl.java
@@ -0,0 +1,86 @@
+/***************************************************************************
+ * Copyright (c) 2004 - 2008 Eike Stepper, Germany.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Eike Stepper - initial API and implementation
+ **************************************************************************/
+package org.eclipse.emf.cdo.internal.common.model;
+
+import org.eclipse.emf.cdo.common.model.CDOClass;
+import org.eclipse.emf.cdo.common.model.CDOClassRef;
+import org.eclipse.emf.cdo.common.model.CDOPackage;
+import org.eclipse.emf.cdo.common.model.CDOPackageManager;
+
+import org.eclipse.net4j.util.io.ExtendedDataInput;
+import org.eclipse.net4j.util.io.ExtendedDataOutput;
+
+import java.io.IOException;
+import java.text.MessageFormat;
+
+/**
+ * TODO Optimize transfer of CDOClassRef instances
+ *
+ * @author Eike Stepper
+ */
+public final class CDOClassRefImpl implements CDOClassRef
+{
+ private String packageURI;
+
+ private int classifierID;
+
+ public CDOClassRefImpl(String packageURI, int classifierID)
+ {
+ this.packageURI = packageURI;
+ this.classifierID = classifierID;
+ }
+
+ public CDOClassRefImpl(ExtendedDataInput in, String defaultURI) throws IOException
+ {
+ // TODO Optimize transfer of URIs
+ packageURI = in.readString();
+ if (packageURI == null)
+ {
+ packageURI = defaultURI;
+ }
+
+ classifierID = in.readInt();
+ }
+
+ public void write(ExtendedDataOutput out, String defaultURI) throws IOException
+ {
+ // TODO Optimize transfer of URIs
+ out.writeString(packageURI.equals(defaultURI) ? null : packageURI);
+ out.writeInt(classifierID);
+ }
+
+ public String getPackageURI()
+ {
+ return packageURI;
+ }
+
+ public int getClassifierID()
+ {
+ return classifierID;
+ }
+
+ public CDOClass resolve(CDOPackageManager packageManager)
+ {
+ CDOPackage cdoPackage = packageManager.lookupPackage(packageURI);
+ if (cdoPackage != null)
+ {
+ return cdoPackage.lookupClass(classifierID);
+ }
+
+ return null;
+ }
+
+ @Override
+ public String toString()
+ {
+ return MessageFormat.format("CDOClassRef({0}, {1})", packageURI, classifierID);
+ }
+}
diff --git a/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/internal/common/model/CDOFeatureImpl.java b/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/internal/common/model/CDOFeatureImpl.java
new file mode 100644
index 0000000000..1c05546d44
--- /dev/null
+++ b/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/internal/common/model/CDOFeatureImpl.java
@@ -0,0 +1,275 @@
+/***************************************************************************
+ * Copyright (c) 2004 - 2008 Eike Stepper, Germany.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Eike Stepper - initial API and implementation
+ **************************************************************************/
+package org.eclipse.emf.cdo.internal.common.model;
+
+import org.eclipse.emf.cdo.common.model.CDOClass;
+import org.eclipse.emf.cdo.common.model.CDOClassProxy;
+import org.eclipse.emf.cdo.common.model.CDOClassRef;
+import org.eclipse.emf.cdo.common.model.CDOModelUtil;
+import org.eclipse.emf.cdo.common.model.CDOPackage;
+import org.eclipse.emf.cdo.common.model.CDOPackageManager;
+import org.eclipse.emf.cdo.common.model.CDOType;
+import org.eclipse.emf.cdo.internal.common.bundle.OM;
+import org.eclipse.emf.cdo.spi.common.InternalCDOClass;
+import org.eclipse.emf.cdo.spi.common.InternalCDOFeature;
+
+import org.eclipse.net4j.util.io.ExtendedDataInput;
+import org.eclipse.net4j.util.io.ExtendedDataOutput;
+import org.eclipse.net4j.util.om.trace.ContextTracer;
+
+import java.io.IOException;
+import java.text.MessageFormat;
+
+/**
+ * @author Eike Stepper
+ */
+public class CDOFeatureImpl extends CDOModelElementImpl implements InternalCDOFeature
+{
+ private static final int UNKNOWN_FEATURE_INDEX = Integer.MIN_VALUE;
+
+ private static final ContextTracer MODEL = new ContextTracer(OM.DEBUG_MODEL, CDOFeatureImpl.class);
+
+ private static final ContextTracer PROTOCOL = new ContextTracer(OM.DEBUG_PROTOCOL, CDOFeatureImpl.class);
+
+ private CDOClass containingClass;
+
+ private int featureID;
+
+ private int featureIndex = UNKNOWN_FEATURE_INDEX;
+
+ private CDOType type;
+
+ private boolean many;
+
+ private boolean containment;
+
+ private CDOClassProxy referenceTypeProxy;
+
+ public CDOFeatureImpl()
+ {
+ }
+
+ public CDOFeatureImpl(CDOClass containingClass, int featureID, String name, CDOType type, boolean many)
+ {
+ super(name);
+ if (type == CDOType.OBJECT)
+ {
+ throw new IllegalArgumentException("type == OBJECT");
+ }
+
+ this.containingClass = containingClass;
+ this.featureID = featureID;
+ this.type = type;
+ this.many = many;
+ if (MODEL.isEnabled())
+ {
+ MODEL.format("Created {0}", this);
+ }
+ }
+
+ public CDOFeatureImpl(CDOClass containingClass, int featureID, String name, CDOClassProxy referenceTypeProxy,
+ boolean many, boolean containment)
+ {
+ super(name);
+ if (referenceTypeProxy == null)
+ {
+ throw new IllegalArgumentException("referenceTypeProxy == null");
+ }
+
+ this.containingClass = containingClass;
+ this.featureID = featureID;
+ type = CDOType.OBJECT;
+ this.many = many;
+ this.containment = containment;
+ this.referenceTypeProxy = referenceTypeProxy;
+ if (MODEL.isEnabled())
+ {
+ MODEL.format("Created {0}", this);
+ }
+ }
+
+ public CDOFeatureImpl(CDOClass containingClass, ExtendedDataInput in) throws IOException
+ {
+ this.containingClass = containingClass;
+ read(in);
+ }
+
+ @Override
+ public void read(ExtendedDataInput in) throws IOException
+ {
+ super.read(in);
+ featureID = in.readInt();
+ type = CDOModelUtil.readType(in);
+ many = in.readBoolean();
+ containment = in.readBoolean();
+ if (PROTOCOL.isEnabled())
+ {
+ PROTOCOL.format("Read feature: ID={0}, name={1}, type={2}, many={3}, containment={4}", featureID, getName(),
+ type, many, containment);
+ }
+
+ if (isReference())
+ {
+ String defaultURI = containingClass.getContainingPackage().getPackageURI();
+ CDOClassRef classRef = CDOModelUtil.readClassRef(in, defaultURI);
+ if (PROTOCOL.isEnabled())
+ {
+ PROTOCOL.format("Read reference type: classRef={0}", classRef);
+ }
+
+ referenceTypeProxy = new CDOClassProxy(classRef, containingClass.getContainingPackage().getPackageManager());
+ }
+ }
+
+ @Override
+ public void write(ExtendedDataOutput out) throws IOException
+ {
+ if (PROTOCOL.isEnabled())
+ {
+ PROTOCOL.format("Writing feature: ID={0}, name={1}, type={2}, many={3}, containment={4}", featureID, getName(),
+ type, many, containment);
+ }
+
+ super.write(out);
+ out.writeInt(featureID);
+ CDOModelUtil.writeType(out, type);
+ out.writeBoolean(many);
+ out.writeBoolean(containment);
+
+ if (isReference())
+ {
+ CDOClassRef classRef = referenceTypeProxy.getClassRef();
+ if (PROTOCOL.isEnabled())
+ {
+ PROTOCOL.format("Writing reference type: classRef={0}", classRef);
+ }
+
+ CDOModelUtil.writeClassRef(out, classRef, getContainingPackage().getPackageURI());
+ }
+ }
+
+ public CDOPackageManager getPackageManager()
+ {
+ return getContainingPackage().getPackageManager();
+ }
+
+ public CDOPackage getContainingPackage()
+ {
+ return containingClass.getContainingPackage();
+ }
+
+ public CDOClass getContainingClass()
+ {
+ return containingClass;
+ }
+
+ public void setContainingClass(CDOClass containingClass)
+ {
+ this.containingClass = containingClass;
+ }
+
+ public int getFeatureID()
+ {
+ return featureID;
+ }
+
+ public void setFeatureID(int featureID)
+ {
+ this.featureID = featureID;
+ }
+
+ public int getFeatureIndex()
+ {
+ if (featureIndex == UNKNOWN_FEATURE_INDEX)
+ {
+ featureIndex = ((InternalCDOClass)containingClass).getFeatureIndex(featureID);
+ }
+
+ return featureIndex;
+ }
+
+ public void setFeatureIndex(int featureIndex)
+ {
+ this.featureIndex = featureIndex;
+ }
+
+ public CDOType getType()
+ {
+ return type;
+ }
+
+ public void setType(CDOType type)
+ {
+ this.type = type;
+ }
+
+ public boolean isMany()
+ {
+ return many;
+ }
+
+ public void setMany(boolean many)
+ {
+ this.many = many;
+ }
+
+ public boolean isReference()
+ {
+ return type == CDOType.OBJECT;
+ }
+
+ public boolean isContainment()
+ {
+ return containment;
+ }
+
+ public void setContainment(boolean containment)
+ {
+ this.containment = containment;
+ }
+
+ public CDOClass getReferenceType()
+ {
+ if (referenceTypeProxy == null)
+ {
+ return null;
+ }
+
+ return referenceTypeProxy.getCdoClass();
+ }
+
+ public void setReferenceType(CDOClassRef cdoClassRef)
+ {
+ referenceTypeProxy = new CDOClassProxy(cdoClassRef, getPackageManager());
+ }
+
+ public void setReferenceType(CDOClass cdoClass)
+ {
+ referenceTypeProxy = new CDOClassProxy(cdoClass);
+ }
+
+ public CDOClassProxy getReferenceTypeProxy()
+ {
+ return referenceTypeProxy;
+ }
+
+ @Override
+ public String toString()
+ {
+ return MessageFormat.format("CDOFeature(ID={0}, name={1}, type={2}, referenceTypeProxy={3})", featureID, getName(),
+ getType(), getReferenceTypeProxy());
+ }
+
+ @Override
+ protected void onInitialize()
+ {
+ }
+}
diff --git a/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/internal/common/model/CDOModelElementImpl.java b/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/internal/common/model/CDOModelElementImpl.java
new file mode 100644
index 0000000000..4eb233e5a2
--- /dev/null
+++ b/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/internal/common/model/CDOModelElementImpl.java
@@ -0,0 +1,114 @@
+/***************************************************************************
+ * Copyright (c) 2004 - 2008 Eike Stepper, Germany.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Eike Stepper - initial API and implementation
+ **************************************************************************/
+package org.eclipse.emf.cdo.internal.common.model;
+
+import org.eclipse.emf.cdo.internal.common.bundle.OM;
+import org.eclipse.emf.cdo.spi.common.InternalCDOModelElement;
+
+import org.eclipse.net4j.util.ImplementationError;
+import org.eclipse.net4j.util.io.ExtendedDataInput;
+import org.eclipse.net4j.util.io.ExtendedDataOutput;
+import org.eclipse.net4j.util.om.trace.ContextTracer;
+
+import java.io.IOException;
+
+/**
+ * @author Eike Stepper
+ */
+public abstract class CDOModelElementImpl implements InternalCDOModelElement
+{
+ private static final ContextTracer MODEL = new ContextTracer(OM.DEBUG_MODEL, CDOModelElementImpl.class);
+
+ private String name;
+
+ private Object clientInfo;
+
+ private Object serverInfo;
+
+ private boolean initialized;
+
+ protected CDOModelElementImpl(String name)
+ {
+ this.name = name;
+ }
+
+ protected CDOModelElementImpl()
+ {
+ }
+
+ public void read(ExtendedDataInput in) throws IOException
+ {
+ name = in.readString();
+ }
+
+ public void write(ExtendedDataOutput out) throws IOException
+ {
+ out.writeString(name);
+ }
+
+ public String getName()
+ {
+ return name;
+ }
+
+ public void setName(String name)
+ {
+ this.name = name;
+ }
+
+ public Object getClientInfo()
+ {
+ return clientInfo;
+ }
+
+ public void setClientInfo(Object clientInfo)
+ {
+ if (MODEL.isEnabled())
+ {
+ MODEL.format("Setting client info: {0} --> {1}", this, clientInfo);
+ }
+
+ this.clientInfo = clientInfo;
+ }
+
+ public Object getServerInfo()
+ {
+ return serverInfo;
+ }
+
+ public void setServerInfo(Object serverInfo)
+ {
+ if (MODEL.isEnabled())
+ {
+ MODEL.format("Setting server info: {0} --> {1}", this, serverInfo);
+ }
+
+ this.serverInfo = serverInfo;
+ }
+
+ public boolean isInitialized()
+ {
+ return initialized;
+ }
+
+ public final void initialize()
+ {
+ if (initialized)
+ {
+ throw new ImplementationError("Duplicate initialization");
+ }
+
+ initialized = true;
+ onInitialize();
+ }
+
+ protected abstract void onInitialize();
+}
diff --git a/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/internal/common/model/CDOPackageImpl.java b/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/internal/common/model/CDOPackageImpl.java
new file mode 100644
index 0000000000..ad1928e633
--- /dev/null
+++ b/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/internal/common/model/CDOPackageImpl.java
@@ -0,0 +1,395 @@
+/***************************************************************************
+ * Copyright (c) 2004 - 2008 Eike Stepper, Germany.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Eike Stepper - initial API and implementation
+ **************************************************************************/
+package org.eclipse.emf.cdo.internal.common.model;
+
+import org.eclipse.emf.cdo.common.id.CDOIDMetaRange;
+import org.eclipse.emf.cdo.common.id.CDOIDUtil;
+import org.eclipse.emf.cdo.common.model.CDOClass;
+import org.eclipse.emf.cdo.common.model.CDOModelUtil;
+import org.eclipse.emf.cdo.common.model.CDOPackage;
+import org.eclipse.emf.cdo.common.model.CDOPackageManager;
+import org.eclipse.emf.cdo.internal.common.bundle.OM;
+import org.eclipse.emf.cdo.spi.common.InternalCDOClass;
+import org.eclipse.emf.cdo.spi.common.InternalCDOPackage;
+
+import org.eclipse.net4j.util.ObjectUtil;
+import org.eclipse.net4j.util.io.ExtendedDataInput;
+import org.eclipse.net4j.util.io.ExtendedDataOutput;
+import org.eclipse.net4j.util.om.trace.ContextTracer;
+
+import java.io.IOException;
+import java.text.MessageFormat;
+import java.util.ArrayList;
+import java.util.List;
+
+/**
+ * @author Eike Stepper
+ */
+public class CDOPackageImpl extends CDOModelElementImpl implements InternalCDOPackage
+{
+ private static final ContextTracer MODEL = new ContextTracer(OM.DEBUG_MODEL, CDOPackageImpl.class);
+
+ private static final ContextTracer PROTOCOL = new ContextTracer(OM.DEBUG_PROTOCOL, CDOPackageImpl.class);
+
+ private CDOPackageManager packageManager;
+
+ private String packageURI;
+
+ private List<CDOClass> classes;
+
+ private List<CDOClass> index;
+
+ private String ecore;
+
+ private boolean dynamic;
+
+ private CDOIDMetaRange metaIDRange;
+
+ private String parentURI;
+
+ /**
+ * TODO If this is only needed by the client then put it into server info
+ */
+ private transient boolean persistent = true;
+
+ public CDOPackageImpl()
+ {
+ }
+
+ public CDOPackageImpl(CDOPackageManager packageManager, String packageURI, String name, String ecore,
+ boolean dynamic, CDOIDMetaRange metaIDRange, String parentURI)
+ {
+ super(name);
+ this.packageManager = packageManager;
+ this.packageURI = packageURI;
+ this.ecore = ecore;
+ this.dynamic = dynamic;
+ this.metaIDRange = metaIDRange;
+ this.parentURI = parentURI;
+ if (MODEL.isEnabled())
+ {
+ MODEL.format("Created {0}", this);
+ }
+
+ createLists();
+ }
+
+ public CDOPackageImpl(CDOPackageManager packageManager, ExtendedDataInput in) throws IOException
+ {
+ this.packageManager = packageManager;
+ createLists();
+ read(in);
+ }
+
+ /**
+ * Creates a proxy CDO package
+ */
+ public CDOPackageImpl(CDOPackageManager packageManager, String packageURI, boolean dynamic,
+ CDOIDMetaRange metaIDRange, String parentURI)
+ {
+ this.packageManager = packageManager;
+ this.packageURI = packageURI;
+ this.dynamic = dynamic;
+ this.metaIDRange = metaIDRange;
+ this.parentURI = parentURI;
+ if (MODEL.isEnabled())
+ {
+ MODEL.format("Created proxy package {0}, dynamic={1}, metaIDRange={2}, parentURI={3}", packageURI, dynamic,
+ metaIDRange, packageURI);
+ }
+ }
+
+ @Override
+ public void read(ExtendedDataInput in) throws IOException
+ {
+ super.read(in);
+ packageURI = in.readString();
+ dynamic = in.readBoolean();
+ ecore = in.readString();
+ metaIDRange = CDOIDUtil.readMetaRange(in);
+ parentURI = in.readString();
+ if (PROTOCOL.isEnabled())
+ {
+ PROTOCOL.format("Read package: URI={0}, name={1}, dynamic={2}, metaIDRange={3}, parentURI={4}", packageURI,
+ getName(), dynamic, metaIDRange, parentURI);
+ }
+
+ int size = in.readInt();
+ if (PROTOCOL.isEnabled())
+ {
+ PROTOCOL.format("Reading {0} classes", size);
+ }
+
+ for (int i = 0; i < size; i++)
+ {
+ CDOClass cdoClass = CDOModelUtil.readClass(this, in);
+ addClass(cdoClass);
+ }
+ }
+
+ @Override
+ public void write(ExtendedDataOutput out) throws IOException
+ {
+ resolve();
+ if (PROTOCOL.isEnabled())
+ {
+ PROTOCOL.format("Writing package: URI={0}, name={1}, dynamic={2}, metaIDRange={3}, parentURI={4}", packageURI,
+ getName(), dynamic, metaIDRange, parentURI);
+ }
+
+ super.write(out);
+ out.writeString(packageURI);
+ out.writeBoolean(dynamic);
+ out.writeString(ecore);
+ CDOIDUtil.writeMetaRange(out, metaIDRange);
+ out.writeString(parentURI);
+
+ int size = classes.size();
+ if (PROTOCOL.isEnabled())
+ {
+ PROTOCOL.format("Writing {0} classes", size);
+ }
+
+ out.writeInt(size);
+ for (CDOClass cdoClass : classes)
+ {
+ CDOModelUtil.writeClass(out, cdoClass);
+ }
+ }
+
+ public void setPackageManager(CDOPackageManager packageManager)
+ {
+ this.packageManager = packageManager;
+ }
+
+ public CDOPackageManager getPackageManager()
+ {
+ return packageManager;
+ }
+
+ public String getParentURI()
+ {
+ return parentURI;
+ }
+
+ public void setParentURI(String parentURI)
+ {
+ this.parentURI = parentURI;
+ }
+
+ public CDOPackage getTopLevelPackage()
+ {
+ CDOPackage parentPackage = getParentPackage();
+ return parentPackage == null ? this : parentPackage.getTopLevelPackage();
+ }
+
+ public CDOPackage getParentPackage()
+ {
+ return packageManager.lookupPackage(parentURI);
+ }
+
+ public CDOPackage[] getSubPackages(boolean recursive)
+ {
+ List<CDOPackage> result = new ArrayList<CDOPackage>();
+ CDOPackage[] allPackages = packageManager.getPackages();
+ getSubPackages(this, allPackages, result, recursive);
+ return result.toArray(new CDOPackage[result.size()]);
+ }
+
+ private void getSubPackages(CDOPackage parentPackage, CDOPackage[] allPackages, List<CDOPackage> result,
+ boolean recursive)
+ {
+ for (CDOPackage cdoPackage : allPackages)
+ {
+ if (ObjectUtil.equals(cdoPackage.getParentURI(), parentPackage.getPackageURI()))
+ {
+ result.add(cdoPackage);
+ if (recursive)
+ {
+ getSubPackages(cdoPackage, allPackages, result, true);
+ }
+ }
+ }
+ }
+
+ public String getPackageURI()
+ {
+ return packageURI;
+ }
+
+ public void setPackageURI(String packageURI)
+ {
+ this.packageURI = packageURI;
+ }
+
+ public int getClassCount()
+ {
+ resolve();
+ return classes.size();
+ }
+
+ public CDOClass[] getClasses()
+ {
+ resolve();
+ return classes.toArray(new CDOClass[classes.size()]);
+ }
+
+ public void setClasses(List<CDOClass> classes)
+ {
+ this.classes = classes;
+ for (CDOClass cdoClass : classes)
+ {
+ ((InternalCDOClass)cdoClass).setContainingPackage(this);
+ setIndex(cdoClass.getClassifierID(), cdoClass);
+ }
+ }
+
+ /**
+ * @return All classes with <code>isAbstract() == false</code> and <code>isSystem() == false</code>.
+ */
+ public CDOClass[] getConcreteClasses()
+ {
+ resolve();
+ List<CDOClass> result = new ArrayList<CDOClass>(0);
+ for (CDOClass cdoClass : classes)
+ {
+ if (!cdoClass.isAbstract())
+ {
+ result.add(cdoClass);
+ }
+ }
+
+ return result.toArray(new CDOClass[result.size()]);
+ }
+
+ public CDOClass lookupClass(int classifierID)
+ {
+ resolve();
+ return index.get(classifierID);
+ }
+
+ public String getEcore()
+ {
+ if (ecore == null && packageManager instanceof CDOPackageManagerImpl && parentURI == null)
+ {
+ // TODO Can ecore be null?
+ ecore = ((CDOPackageManagerImpl)packageManager).provideEcore(this);
+ }
+
+ return ecore;
+ }
+
+ /**
+ * TODO Add IStore API to demand read dynamic ecore string
+ */
+ public void setEcore(String ecore)
+ {
+ this.ecore = ecore;
+ }
+
+ public CDOIDMetaRange getMetaIDRange()
+ {
+ return metaIDRange;
+ }
+
+ public void setMetaIDRange(CDOIDMetaRange metaIDRange)
+ {
+ this.metaIDRange = metaIDRange;
+ }
+
+ public boolean isDynamic()
+ {
+ return dynamic;
+ }
+
+ public void setDynamic(boolean dynamic)
+ {
+ this.dynamic = dynamic;
+ }
+
+ public boolean isSystem()
+ {
+ return false;
+ }
+
+ public boolean isProxy()
+ {
+ return classes == null;
+ }
+
+ public boolean isPersistent()
+ {
+ return persistent;
+ }
+
+ public void setPersistent(boolean persistent)
+ {
+ this.persistent = persistent;
+ }
+
+ public void addClass(CDOClass cdoClass)
+ {
+ int classifierID = cdoClass.getClassifierID();
+ if (MODEL.isEnabled())
+ {
+ MODEL.format("Adding class: {0}", cdoClass);
+ }
+
+ setIndex(classifierID, cdoClass);
+ classes.add(cdoClass);
+ }
+
+ public int compareTo(CDOPackage that)
+ {
+ return getPackageURI().compareTo(that.getPackageURI());
+ }
+
+ @Override
+ public String toString()
+ {
+ return MessageFormat.format("CDOPackage(URI={0}, name={1}, dynamic={2}, metaIDRange={3}, parentURI={4})",
+ packageURI, getName(), dynamic, metaIDRange, parentURI);
+ }
+
+ @Override
+ protected void onInitialize()
+ {
+ for (CDOClass cdoClass : classes)
+ {
+ ((InternalCDOClass)cdoClass).initialize();
+ }
+ }
+
+ private void setIndex(int classifierID, CDOClass cdoClass)
+ {
+ while (classifierID >= index.size())
+ {
+ index.add(null);
+ }
+
+ index.set(classifierID, cdoClass);
+ }
+
+ private void resolve()
+ {
+ if (classes == null && packageManager instanceof CDOPackageManagerImpl)
+ {
+ createLists();
+ ((CDOPackageManagerImpl)packageManager).resolve(this);
+ }
+ }
+
+ private void createLists()
+ {
+ classes = new ArrayList<CDOClass>(0);
+ index = new ArrayList<CDOClass>(0);
+ }
+}
diff --git a/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/internal/common/model/CDOPackageManagerImpl.java b/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/internal/common/model/CDOPackageManagerImpl.java
new file mode 100644
index 0000000000..b8c9c21f93
--- /dev/null
+++ b/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/internal/common/model/CDOPackageManagerImpl.java
@@ -0,0 +1,144 @@
+/***************************************************************************
+ * Copyright (c) 2004 - 2008 Eike Stepper, Germany.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Eike Stepper - initial API and implementation
+ **************************************************************************/
+package org.eclipse.emf.cdo.internal.common.model;
+
+import org.eclipse.emf.cdo.common.model.CDOPackage;
+import org.eclipse.emf.cdo.common.model.CDOPackageManager;
+import org.eclipse.emf.cdo.common.model.core.CDOCorePackage;
+import org.eclipse.emf.cdo.common.model.resource.CDOResourcePackage;
+import org.eclipse.emf.cdo.internal.common.bundle.OM;
+import org.eclipse.emf.cdo.internal.common.model.core.CDOCorePackageImpl;
+import org.eclipse.emf.cdo.internal.common.model.resource.CDOResourcePackageImpl;
+
+import org.eclipse.net4j.util.container.Container;
+import org.eclipse.net4j.util.om.trace.ContextTracer;
+
+import java.util.ArrayList;
+import java.util.List;
+import java.util.concurrent.ConcurrentHashMap;
+import java.util.concurrent.ConcurrentMap;
+
+/**
+ * @author Eike Stepper
+ */
+public abstract class CDOPackageManagerImpl extends Container<CDOPackage> implements CDOPackageManager
+{
+ private static final ContextTracer TRACER = new ContextTracer(OM.DEBUG_MODEL, CDOPackageManagerImpl.class);
+
+ private ConcurrentMap<String, CDOPackage> packages = new ConcurrentHashMap<String, CDOPackage>();
+
+ private CDOCorePackage cdoCorePackage;
+
+ private CDOResourcePackage cdoResourcePackage;
+
+ public CDOPackageManagerImpl()
+ {
+ addPackage(cdoCorePackage = new CDOCorePackageImpl(this));
+ addPackage(cdoResourcePackage = new CDOResourcePackageImpl(this));
+ }
+
+ public CDOPackage lookupPackage(String uri)
+ {
+ if (uri == null)
+ {
+ return null;
+ }
+
+ return packages.get(uri);
+ }
+
+ public int getPackageCount()
+ {
+ return packages.size();
+ }
+
+ public CDOPackage[] getPackages()
+ {
+ return packages.values().toArray(new CDOPackage[packages.size()]);
+ }
+
+ public CDOPackage[] getElements()
+ {
+ return getPackages();
+ }
+
+ @Override
+ public boolean isEmpty()
+ {
+ return packages.isEmpty();
+ }
+
+ public CDOCorePackage getCDOCorePackage()
+ {
+ return cdoCorePackage;
+ }
+
+ public CDOResourcePackage getCDOResourcePackage()
+ {
+ return cdoResourcePackage;
+ }
+
+ public List<CDOPackage> getTransientPackages()
+ {
+ List<CDOPackage> result = new ArrayList<CDOPackage>();
+ for (CDOPackage cdoPackage : packages.values())
+ {
+ if (!cdoPackage.isPersistent())
+ {
+ result.add(cdoPackage);
+ }
+ }
+
+ return result;
+ }
+
+ public void addPackage(CDOPackage cdoPackage)
+ {
+ String uri = cdoPackage.getPackageURI();
+ if (uri == null)
+ {
+ throw new IllegalArgumentException("uri == null");
+ }
+
+ CDOPackage existing = packages.putIfAbsent(uri, cdoPackage);
+ if (existing == null)
+ {
+ if (TRACER.isEnabled())
+ {
+ TRACER.format("Added package: {0}", cdoPackage);
+ }
+
+ fireElementAddedEvent(cdoPackage);
+ }
+ else
+ {
+ throw new IllegalStateException("Duplicate package: " + cdoPackage);
+ }
+ }
+
+ public void removePackage(CDOPackage cdoPackage)
+ {
+ packages.remove(cdoPackage.getPackageURI());
+ fireElementRemovedEvent(cdoPackage);
+ }
+
+ /**
+ * @param cdoPackage
+ * is a proxy CDO package. The implementer of this method must only use the package URI of the cdoPackage
+ * passed in.
+ */
+ protected abstract void resolve(CDOPackage cdoPackage);
+
+ /**
+ * Only called on clients for generated models
+ */
+ protected abstract String provideEcore(CDOPackage cdoPackage);
+}
diff --git a/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/internal/common/model/CDOTypeImpl.java b/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/internal/common/model/CDOTypeImpl.java
new file mode 100644
index 0000000000..a07448bf3a
--- /dev/null
+++ b/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/internal/common/model/CDOTypeImpl.java
@@ -0,0 +1,472 @@
+/***************************************************************************
+ * Copyright (c) 2004 - 2008 Eike Stepper, Germany.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Eike Stepper - initial API and implementation
+ **************************************************************************/
+package org.eclipse.emf.cdo.internal.common.model;
+
+import org.eclipse.emf.cdo.common.id.CDOID;
+import org.eclipse.emf.cdo.common.id.CDOIDObjectFactory;
+import org.eclipse.emf.cdo.common.id.CDOIDUtil;
+import org.eclipse.emf.cdo.common.model.CDOType;
+
+import org.eclipse.net4j.util.io.ExtendedDataInput;
+import org.eclipse.net4j.util.io.ExtendedDataOutput;
+
+import java.io.IOException;
+import java.util.Date;
+import java.util.HashMap;
+import java.util.Map;
+
+/**
+ * @author Eike Stepper
+ */
+public abstract class CDOTypeImpl implements CDOType
+{
+ public static Map<Integer, CDOTypeImpl> ids = new HashMap<Integer, CDOTypeImpl>();
+
+ private static final byte BOOLEAN_DEFAULT_PRIMITIVE = 0;
+
+ private static final char CHARACTER_DEFAULT_PRIMITIVE = 0;
+
+ private static final short SHORT_DEFAULT_PRIMITIVE = 0;
+
+ public static final Boolean BOOLEAN_DEFAULT = new Boolean(false);
+
+ public static final Byte BYTE_DEFAULT = new Byte(BOOLEAN_DEFAULT_PRIMITIVE);
+
+ public static final Character CHARACTER_DEFAULT = new Character(CHARACTER_DEFAULT_PRIMITIVE);
+
+ public static final Double DOUBLE_DEFAULT = new Double(0.0);
+
+ public static final Float FLOAT_DEFAULT = new Float(0.0);
+
+ public static final Integer INTEGER_DEFAULT = new Integer(0);
+
+ public static final Long LONG_DEFAULT = new Long(0L);
+
+ public static final Short SHORT_DEFAULT = new Short(SHORT_DEFAULT_PRIMITIVE);
+
+ public static final CDOType BOOLEAN = new CDOTypeImpl("BOOLEAN", 22, false, BOOLEAN_DEFAULT)
+ {
+ public void writeValue(ExtendedDataOutput out, Object value) throws IOException
+ {
+ boolean v = (Boolean)(value == null ? getDefaultValue() : value);
+ out.writeBoolean(v);
+ }
+
+ public Object readValue(ExtendedDataInput in, CDOIDObjectFactory factory) throws IOException
+ {
+ boolean v = in.readBoolean();
+ return new Boolean(v);
+ }
+ };
+
+ public static final CDOType BYTE = new CDOTypeImpl("BYTE", 24, false, BYTE_DEFAULT)
+ {
+ public void writeValue(ExtendedDataOutput out, Object value) throws IOException
+ {
+ out.writeByte((Byte)(value == null ? getDefaultValue() : value));
+ }
+
+ public Object readValue(ExtendedDataInput in, CDOIDObjectFactory factory) throws IOException
+ {
+ return new Byte(in.readByte());
+ }
+ };
+
+ public static final CDOType CHAR = new CDOTypeImpl("CHAR", 27, false, CHARACTER_DEFAULT)
+ {
+ public void writeValue(ExtendedDataOutput out, Object value) throws IOException
+ {
+ out.writeChar(((Character)(value == null ? getDefaultValue() : value)).charValue());
+ }
+
+ public Object readValue(ExtendedDataInput in, CDOIDObjectFactory factory) throws IOException
+ {
+ return new Character(in.readChar());
+ }
+ };
+
+ public static final CDOType DOUBLE = new CDOTypeImpl("DOUBLE", 31, false, DOUBLE_DEFAULT)
+ {
+ public void writeValue(ExtendedDataOutput out, Object value) throws IOException
+ {
+ out.writeDouble((Double)(value == null ? getDefaultValue() : value));
+ }
+
+ public Object readValue(ExtendedDataInput in, CDOIDObjectFactory factory) throws IOException
+ {
+ return new Double(in.readDouble());
+ }
+ };
+
+ public static final CDOType FLOAT = new CDOTypeImpl("FLOAT", 37, false, FLOAT_DEFAULT)
+ {
+ public void writeValue(ExtendedDataOutput out, Object value) throws IOException
+ {
+ out.writeFloat((Float)(value == null ? getDefaultValue() : value));
+ }
+
+ public Object readValue(ExtendedDataInput in, CDOIDObjectFactory factory) throws IOException
+ {
+ return new Float(in.readFloat());
+ }
+ };
+
+ public static final CDOType INT = new CDOTypeImpl("INT", 39, false, INTEGER_DEFAULT)
+ {
+ public void writeValue(ExtendedDataOutput out, Object value) throws IOException
+ {
+ out.writeInt((Integer)(value == null ? getDefaultValue() : value));
+ }
+
+ public Object readValue(ExtendedDataInput in, CDOIDObjectFactory factory) throws IOException
+ {
+ return new Integer(in.readInt());
+ }
+ };
+
+ public static final CDOType LONG = new CDOTypeImpl("LONG", 43, false, LONG_DEFAULT)
+ {
+ public void writeValue(ExtendedDataOutput out, Object value) throws IOException
+ {
+ out.writeLong((Long)(value == null ? getDefaultValue() : value));
+ }
+
+ public Object readValue(ExtendedDataInput in, CDOIDObjectFactory factory) throws IOException
+ {
+ return new Long(in.readLong());
+ }
+ };
+
+ public static final CDOType SHORT = new CDOTypeImpl("SHORT", 48, false, SHORT_DEFAULT)
+ {
+ public void writeValue(ExtendedDataOutput out, Object value) throws IOException
+ {
+ out.writeShort((Short)(value == null ? getDefaultValue() : value));
+ }
+
+ public Object readValue(ExtendedDataInput in, CDOIDObjectFactory factory) throws IOException
+ {
+ return new Short(in.readShort());
+ }
+ };
+
+ public static final CDOType OBJECT = new CDOTypeImpl("OBJECT", 10, true, CDOID.NULL)
+ {
+ public void writeValue(ExtendedDataOutput out, Object value) throws IOException
+ {
+ CDOIDUtil.write(out, (CDOID)value);
+ }
+
+ public Object readValue(ExtendedDataInput in, CDOIDObjectFactory factory) throws IOException
+ {
+ return CDOIDUtil.read(in, factory);
+ }
+ };
+
+ public static final CDOType BOOLEAN_OBJECT = new ObjectType("BOOLEAN_OBJECT", 23)
+ {
+ @Override
+ protected void doWriteValue(ExtendedDataOutput out, Object value) throws IOException
+ {
+ out.writeBoolean((Boolean)value);
+ }
+
+ @Override
+ protected Object doReadValue(ExtendedDataInput in) throws IOException
+ {
+ return in.readBoolean();
+ }
+ };
+
+ public static final CDOType BYTE_OBJECT = new ObjectType("BYTE_OBJECT", 26)
+ {
+ @Override
+ protected void doWriteValue(ExtendedDataOutput out, Object value) throws IOException
+ {
+ out.writeByte((Byte)value);
+ }
+
+ @Override
+ protected Object doReadValue(ExtendedDataInput in) throws IOException
+ {
+ return in.readByte();
+ }
+ };
+
+ public static final CDOType CHARACTER_OBJECT = new ObjectType("CHARACTER_OBJECT", 28)
+ {
+ @Override
+ protected void doWriteValue(ExtendedDataOutput out, Object value) throws IOException
+ {
+ out.writeChar((Character)value);
+ }
+
+ @Override
+ protected Object doReadValue(ExtendedDataInput in) throws IOException
+ {
+ return in.readChar();
+ }
+ };
+
+ public static final CDOType DATE = new ObjectType("DATE", 29)
+ {
+ @Override
+ protected void doWriteValue(ExtendedDataOutput out, Object value) throws IOException
+ {
+ out.writeLong(((Date)value).getTime());
+ }
+
+ @Override
+ protected Object doReadValue(ExtendedDataInput in) throws IOException
+ {
+ return new Date(in.readLong());
+ }
+ };
+
+ public static final CDOType DOUBLE_OBJECT = new ObjectType("DOUBLE_OBJECT", 32)
+ {
+ @Override
+ protected void doWriteValue(ExtendedDataOutput out, Object value) throws IOException
+ {
+ out.writeDouble((Double)value);
+ }
+
+ @Override
+ protected Object doReadValue(ExtendedDataInput in) throws IOException
+ {
+ return in.readDouble();
+ }
+ };
+
+ public static final CDOType FLOAT_OBJECT = new ObjectType("FLOAT_OBJECT", 38)
+ {
+ @Override
+ protected void doWriteValue(ExtendedDataOutput out, Object value) throws IOException
+ {
+ out.writeFloat((Float)value);
+ }
+
+ @Override
+ protected Object doReadValue(ExtendedDataInput in) throws IOException
+ {
+ return in.readFloat();
+ }
+ };
+
+ public static final CDOType INTEGER_OBJECT = new ObjectType("INTEGER_OBJECT", 40)
+ {
+ @Override
+ protected void doWriteValue(ExtendedDataOutput out, Object value) throws IOException
+ {
+ out.writeInt((Integer)value);
+ }
+
+ @Override
+ protected Object doReadValue(ExtendedDataInput in) throws IOException
+ {
+ return in.readInt();
+ }
+ };
+
+ public static final CDOType LONG_OBJECT = new ObjectType("LONG_OBJECT", 44)
+ {
+ @Override
+ protected void doWriteValue(ExtendedDataOutput out, Object value) throws IOException
+ {
+ out.writeLong((Long)value);
+ }
+
+ @Override
+ protected Object doReadValue(ExtendedDataInput in) throws IOException
+ {
+ return in.readLong();
+ }
+ };
+
+ public static final CDOType SHORT_OBJECT = new ObjectType("SHORT_OBJECT", 49)
+ {
+ @Override
+ protected void doWriteValue(ExtendedDataOutput out, Object value) throws IOException
+ {
+ out.writeShort((Short)value);
+ }
+
+ @Override
+ protected Object doReadValue(ExtendedDataInput in) throws IOException
+ {
+ return in.readShort();
+ }
+ };
+
+ public static final CDOType STRING = new CDOTypeImpl("STRING", 50, true)
+ {
+ @SuppressWarnings("cast")
+ @Override
+ public Object copyValue(Object value)
+ {
+ return (String)value;
+ }
+
+ public void writeValue(ExtendedDataOutput out, Object value) throws IOException
+ {
+ out.writeString((String)value);
+ }
+
+ public Object readValue(ExtendedDataInput in, CDOIDObjectFactory factory) throws IOException
+ {
+ return in.readString();
+ }
+ };
+
+ public static final CDOType BYTE_ARRAY = new CDOTypeImpl("BYTE_ARRAY", 25, true)
+ {
+ @Override
+ public Object copyValue(Object value)
+ {
+ if (value == null)
+ {
+ return null;
+ }
+
+ byte[] array = (byte[])value;
+ byte[] result = new byte[array.length];
+ System.arraycopy(value, 0, result, 0, array.length);
+ return result;
+ }
+
+ public void writeValue(ExtendedDataOutput out, Object value) throws IOException
+ {
+ out.writeByteArray((byte[])value);
+ }
+
+ public Object readValue(ExtendedDataInput in, CDOIDObjectFactory factory) throws IOException
+ {
+ return in.readByteArray();
+ }
+ };
+
+ public static final CDOType CUSTOM = new CDOTypeImpl("CUSTOM", 999, true)
+ {
+ @SuppressWarnings("cast")
+ @Override
+ public Object copyValue(Object value)
+ {
+ return (String)value;
+ }
+
+ public void writeValue(ExtendedDataOutput out, Object value) throws IOException
+ {
+ out.writeString((String)value);
+ }
+
+ public Object readValue(ExtendedDataInput in, CDOIDObjectFactory factory) throws IOException
+ {
+ return in.readString();
+ }
+ };
+
+ private String name;
+
+ private int typeID;
+
+ private boolean canBeNull;
+
+ private Object defaultValue;
+
+ private CDOTypeImpl(String name, int typeID, boolean canBeNull, Object defaultValue)
+ {
+ this.name = name;
+ this.typeID = typeID;
+ this.canBeNull = canBeNull;
+ this.defaultValue = defaultValue;
+ ids.put(typeID, this);
+ }
+
+ private CDOTypeImpl(String name, int typeID, boolean canBeNull)
+ {
+ this(name, typeID, canBeNull, null);
+ }
+
+ public String getName()
+ {
+ return name;
+ }
+
+ public int getTypeID()
+ {
+ return typeID;
+ }
+
+ public boolean canBeNull()
+ {
+ return canBeNull;
+ }
+
+ public Object getDefaultValue()
+ {
+ return defaultValue;
+ }
+
+ @Override
+ public String toString()
+ {
+ return name;
+ }
+
+ public Object copyValue(Object value)
+ {
+ return value == null ? getDefaultValue() : value;
+ }
+
+ public void write(ExtendedDataOutput out) throws IOException
+ {
+ out.writeInt(typeID);
+ }
+
+ /**
+ * @author Eike Stepper
+ */
+ private static abstract class ObjectType extends CDOTypeImpl
+ {
+ public ObjectType(String name, int typeID)
+ {
+ super(name, typeID, true);
+ }
+
+ public final void writeValue(ExtendedDataOutput out, Object value) throws IOException
+ {
+ if (value == null)
+ {
+ out.writeBoolean(false);
+ }
+ else
+ {
+ out.writeBoolean(true);
+ doWriteValue(out, value);
+ }
+ }
+
+ protected abstract void doWriteValue(ExtendedDataOutput out, Object value) throws IOException;
+
+ public final Object readValue(ExtendedDataInput in, CDOIDObjectFactory factory) throws IOException
+ {
+ boolean notNull = in.readBoolean();
+ if (notNull)
+ {
+ return doReadValue(in);
+ }
+
+ return null;
+ }
+
+ protected abstract Object doReadValue(ExtendedDataInput in) throws IOException;
+ }
+}
diff --git a/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/internal/common/model/core/CDOCorePackageImpl.java b/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/internal/common/model/core/CDOCorePackageImpl.java
new file mode 100644
index 0000000000..62c54dd0bf
--- /dev/null
+++ b/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/internal/common/model/core/CDOCorePackageImpl.java
@@ -0,0 +1,46 @@
+/***************************************************************************
+ * Copyright (c) 2004 - 2008 Eike Stepper, Germany.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Eike Stepper - initial API and implementation
+ **************************************************************************/
+package org.eclipse.emf.cdo.internal.common.model.core;
+
+import org.eclipse.emf.cdo.common.model.core.CDOCorePackage;
+import org.eclipse.emf.cdo.internal.common.model.CDOPackageImpl;
+import org.eclipse.emf.cdo.internal.common.model.CDOPackageManagerImpl;
+
+/**
+ * @author Eike Stepper
+ */
+public final class CDOCorePackageImpl extends CDOPackageImpl implements CDOCorePackage
+{
+ private CDOObjectClassImpl cdoObjectClass;
+
+ public CDOCorePackageImpl(CDOPackageManagerImpl packageManager)
+ {
+ super(packageManager, PACKAGE_URI, NAME, null, false, null, null);
+ addClass(cdoObjectClass = new CDOObjectClassImpl(this));
+ }
+
+ public CDOObjectClassImpl getCDOObjectClass()
+ {
+ return cdoObjectClass;
+ }
+
+ @Override
+ public String getEcore()
+ {
+ return null;
+ }
+
+ @Override
+ public boolean isSystem()
+ {
+ return true;
+ }
+}
diff --git a/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/internal/common/model/core/CDOObjectClassImpl.java b/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/internal/common/model/core/CDOObjectClassImpl.java
new file mode 100644
index 0000000000..812a9f48f8
--- /dev/null
+++ b/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/internal/common/model/core/CDOObjectClassImpl.java
@@ -0,0 +1,32 @@
+/***************************************************************************
+ * Copyright (c) 2004 - 2008 Eike Stepper, Germany.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Eike Stepper - initial API and implementation
+ **************************************************************************/
+package org.eclipse.emf.cdo.internal.common.model.core;
+
+import org.eclipse.emf.cdo.common.model.CDOPackage;
+import org.eclipse.emf.cdo.common.model.core.CDOObjectClass;
+import org.eclipse.emf.cdo.internal.common.model.CDOClassImpl;
+
+/**
+ * @author Eike Stepper
+ */
+public class CDOObjectClassImpl extends CDOClassImpl implements CDOObjectClass
+{
+ public CDOObjectClassImpl(CDOPackage containingPackage)
+ {
+ super(containingPackage, CLASSIFIER_ID, NAME, false);
+ }
+
+ @Override
+ public boolean isRoot()
+ {
+ return true;
+ }
+}
diff --git a/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/internal/common/model/resource/CDOContentsFeatureImpl.java b/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/internal/common/model/resource/CDOContentsFeatureImpl.java
new file mode 100644
index 0000000000..f8eed25188
--- /dev/null
+++ b/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/internal/common/model/resource/CDOContentsFeatureImpl.java
@@ -0,0 +1,29 @@
+/***************************************************************************
+ * Copyright (c) 2004 - 2008 Eike Stepper, Germany.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Eike Stepper - initial API and implementation
+ **************************************************************************/
+package org.eclipse.emf.cdo.internal.common.model.resource;
+
+import org.eclipse.emf.cdo.common.model.CDOClass;
+import org.eclipse.emf.cdo.common.model.CDOClassProxy;
+import org.eclipse.emf.cdo.common.model.CDOPackageManager;
+import org.eclipse.emf.cdo.common.model.resource.CDOContentsFeature;
+import org.eclipse.emf.cdo.internal.common.model.CDOFeatureImpl;
+
+/**
+ * @author Eike Stepper
+ */
+public class CDOContentsFeatureImpl extends CDOFeatureImpl implements CDOContentsFeature
+{
+ public CDOContentsFeatureImpl(CDOClass containingClass, CDOPackageManager packageManager)
+ {
+ super(containingClass, FEATURE_ID, NAME, new CDOClassProxy(packageManager.getCDOCorePackage().getCDOObjectClass()),
+ true, true);
+ }
+}
diff --git a/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/internal/common/model/resource/CDOPathFeatureImpl.java b/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/internal/common/model/resource/CDOPathFeatureImpl.java
new file mode 100644
index 0000000000..f42709edb5
--- /dev/null
+++ b/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/internal/common/model/resource/CDOPathFeatureImpl.java
@@ -0,0 +1,27 @@
+/***************************************************************************
+ * Copyright (c) 2004 - 2008 Eike Stepper, Germany.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Eike Stepper - initial API and implementation
+ **************************************************************************/
+package org.eclipse.emf.cdo.internal.common.model.resource;
+
+import org.eclipse.emf.cdo.common.model.CDOClass;
+import org.eclipse.emf.cdo.common.model.resource.CDOPathFeature;
+import org.eclipse.emf.cdo.internal.common.model.CDOFeatureImpl;
+import org.eclipse.emf.cdo.internal.common.model.CDOTypeImpl;
+
+/**
+ * @author Eike Stepper
+ */
+public class CDOPathFeatureImpl extends CDOFeatureImpl implements CDOPathFeature
+{
+ public CDOPathFeatureImpl(CDOClass containingClass)
+ {
+ super(containingClass, FEATURE_ID, NAME, CDOTypeImpl.STRING, false);
+ }
+}
diff --git a/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/internal/common/model/resource/CDOResourceClassImpl.java b/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/internal/common/model/resource/CDOResourceClassImpl.java
new file mode 100644
index 0000000000..ec747c5195
--- /dev/null
+++ b/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/internal/common/model/resource/CDOResourceClassImpl.java
@@ -0,0 +1,49 @@
+/***************************************************************************
+ * Copyright (c) 2004 - 2008 Eike Stepper, Germany.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Eike Stepper - initial API and implementation
+ **************************************************************************/
+package org.eclipse.emf.cdo.internal.common.model.resource;
+
+import org.eclipse.emf.cdo.common.model.CDOPackage;
+import org.eclipse.emf.cdo.common.model.CDOPackageManager;
+import org.eclipse.emf.cdo.common.model.resource.CDOResourceClass;
+import org.eclipse.emf.cdo.internal.common.model.CDOClassImpl;
+
+/**
+ * @author Eike Stepper
+ */
+public class CDOResourceClassImpl extends CDOClassImpl implements CDOResourceClass
+{
+ private CDOPathFeatureImpl cdoPathFeature;
+
+ private CDOContentsFeatureImpl cdoContentsFeature;
+
+ public CDOResourceClassImpl(CDOPackage containingPackage, CDOPackageManager packageManager)
+ {
+ super(containingPackage, CLASSIFIER_ID, NAME, false);
+ addFeature(cdoPathFeature = new CDOPathFeatureImpl(this));
+ addFeature(cdoContentsFeature = new CDOContentsFeatureImpl(this, packageManager));
+ }
+
+ @Override
+ public boolean isResource()
+ {
+ return true;
+ }
+
+ public CDOPathFeatureImpl getCDOPathFeature()
+ {
+ return cdoPathFeature;
+ }
+
+ public CDOContentsFeatureImpl getCDOContentsFeature()
+ {
+ return cdoContentsFeature;
+ }
+}
diff --git a/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/internal/common/model/resource/CDOResourcePackageImpl.java b/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/internal/common/model/resource/CDOResourcePackageImpl.java
new file mode 100644
index 0000000000..f1ac7bf14c
--- /dev/null
+++ b/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/internal/common/model/resource/CDOResourcePackageImpl.java
@@ -0,0 +1,46 @@
+/***************************************************************************
+ * Copyright (c) 2004 - 2008 Eike Stepper, Germany.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Eike Stepper - initial API and implementation
+ **************************************************************************/
+package org.eclipse.emf.cdo.internal.common.model.resource;
+
+import org.eclipse.emf.cdo.common.model.resource.CDOResourcePackage;
+import org.eclipse.emf.cdo.internal.common.model.CDOPackageImpl;
+import org.eclipse.emf.cdo.internal.common.model.CDOPackageManagerImpl;
+
+/**
+ * @author Eike Stepper
+ */
+public final class CDOResourcePackageImpl extends CDOPackageImpl implements CDOResourcePackage
+{
+ private CDOResourceClassImpl cdoResourceClass;
+
+ public CDOResourcePackageImpl(CDOPackageManagerImpl packageManager)
+ {
+ super(packageManager, PACKAGE_URI, NAME, null, false, null, null);
+ addClass(cdoResourceClass = new CDOResourceClassImpl(this, packageManager));
+ }
+
+ public CDOResourceClassImpl getCDOResourceClass()
+ {
+ return cdoResourceClass;
+ }
+
+ @Override
+ public String getEcore()
+ {
+ return null;
+ }
+
+ @Override
+ public boolean isSystem()
+ {
+ return true;
+ }
+}
diff --git a/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/internal/common/revision/CDOReferenceProxyImpl.java b/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/internal/common/revision/CDOReferenceProxyImpl.java
new file mode 100644
index 0000000000..88a3b96de4
--- /dev/null
+++ b/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/internal/common/revision/CDOReferenceProxyImpl.java
@@ -0,0 +1,65 @@
+/***************************************************************************
+ * Copyright (c) 2004 - 2008 Eike Stepper, Germany.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Eike Stepper - initial API and implementation
+ **************************************************************************/
+package org.eclipse.emf.cdo.internal.common.revision;
+
+import org.eclipse.emf.cdo.common.id.CDOID;
+import org.eclipse.emf.cdo.common.model.CDOFeature;
+import org.eclipse.emf.cdo.common.revision.CDOReferenceProxy;
+import org.eclipse.emf.cdo.common.revision.CDORevision;
+import org.eclipse.emf.cdo.common.revision.CDORevisionResolver;
+
+import java.text.MessageFormat;
+
+/**
+ * @author Eike Stepper
+ */
+public class CDOReferenceProxyImpl implements CDOReferenceProxy
+{
+ private CDORevision revision;
+
+ private CDOFeature feature;
+
+ private int index;
+
+ public CDOReferenceProxyImpl(CDORevision revision, CDOFeature feature, int index)
+ {
+ this.revision = revision;
+ this.feature = feature;
+ this.index = index;
+ }
+
+ public CDORevision getRevision()
+ {
+ return revision;
+ }
+
+ public CDOFeature getFeature()
+ {
+ return feature;
+ }
+
+ public int getIndex()
+ {
+ return index;
+ }
+
+ public CDOID resolve()
+ {
+ CDORevisionResolver revisionResolver = revision.getRevisionResolver();
+ return revisionResolver.resolveReferenceProxy(this);
+ }
+
+ @Override
+ public String toString()
+ {
+ return MessageFormat.format("CDOReferenceProxy[{0}, {1}, {2}", revision, feature, index);
+ }
+}
diff --git a/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/internal/common/revision/CDORevisionImpl.java b/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/internal/common/revision/CDORevisionImpl.java
new file mode 100644
index 0000000000..736b16755d
--- /dev/null
+++ b/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/internal/common/revision/CDORevisionImpl.java
@@ -0,0 +1,814 @@
+/***************************************************************************
+ * Copyright (c) 2004 - 2008 Eike Stepper, Germany.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Eike Stepper - initial API and implementation
+ * Simon McDuff - https://bugs.eclipse.org/bugs/show_bug.cgi?id=201266
+ * Simon McDuff - https://bugs.eclipse.org/bugs/show_bug.cgi?id=212958
+ **************************************************************************/
+package org.eclipse.emf.cdo.internal.common.revision;
+
+import org.eclipse.emf.cdo.common.id.CDOID;
+import org.eclipse.emf.cdo.common.id.CDOIDProvider;
+import org.eclipse.emf.cdo.common.id.CDOIDTemp;
+import org.eclipse.emf.cdo.common.id.CDOIDUtil;
+import org.eclipse.emf.cdo.common.model.CDOClass;
+import org.eclipse.emf.cdo.common.model.CDOClassRef;
+import org.eclipse.emf.cdo.common.model.CDOFeature;
+import org.eclipse.emf.cdo.common.model.CDOModelUtil;
+import org.eclipse.emf.cdo.common.model.CDOPackageManager;
+import org.eclipse.emf.cdo.common.model.CDOType;
+import org.eclipse.emf.cdo.common.revision.CDOReferenceProxy;
+import org.eclipse.emf.cdo.common.revision.CDORevision;
+import org.eclipse.emf.cdo.common.revision.CDORevisionData;
+import org.eclipse.emf.cdo.common.revision.CDORevisionResolver;
+import org.eclipse.emf.cdo.common.revision.delta.CDORevisionDelta;
+import org.eclipse.emf.cdo.common.revision.delta.CDORevisionDeltaUtil;
+import org.eclipse.emf.cdo.internal.common.bundle.OM;
+import org.eclipse.emf.cdo.internal.common.revision.delta.CDORevisionMerger;
+import org.eclipse.emf.cdo.spi.common.InternalCDORevision;
+import org.eclipse.emf.cdo.spi.common.InternalCDORevisionDelta;
+
+import org.eclipse.net4j.util.ImplementationError;
+import org.eclipse.net4j.util.collection.MoveableArrayList;
+import org.eclipse.net4j.util.collection.MoveableList;
+import org.eclipse.net4j.util.io.ExtendedDataInput;
+import org.eclipse.net4j.util.io.ExtendedDataOutput;
+import org.eclipse.net4j.util.om.trace.ContextTracer;
+import org.eclipse.net4j.util.om.trace.PerfTracer;
+
+import java.io.IOException;
+import java.util.List;
+import java.util.Map;
+
+/**
+ * @author Eike Stepper
+ */
+public class CDORevisionImpl implements InternalCDORevision
+{
+ private static final ContextTracer TRACER = new ContextTracer(OM.DEBUG_REVISION, CDORevisionImpl.class);
+
+ private static final PerfTracer READING = new PerfTracer(OM.PERF_REVISION_READING, CDORevisionImpl.class);
+
+ private static final PerfTracer WRITING = new PerfTracer(OM.PERF_REVISION_WRITING, CDORevisionImpl.class);
+
+ private CDORevisionResolver revisionResolver;
+
+ private CDOClass cdoClass;
+
+ private CDOID id;
+
+ private int version;
+
+ private long created;
+
+ private long revised;
+
+ private CDOID resourceID;
+
+ private CDOID containerID;
+
+ private int containingFeatureID;
+
+ private Object[] values;
+
+ public CDORevisionImpl(CDORevisionResolver revisionResolver, CDOClass cdoClass, CDOID id)
+ {
+ this.revisionResolver = revisionResolver;
+ this.cdoClass = cdoClass;
+ this.id = id;
+ version = 0;
+ created = UNSPECIFIED_DATE;
+ revised = UNSPECIFIED_DATE;
+ resourceID = CDOID.NULL;
+ containerID = CDOID.NULL;
+ containingFeatureID = 0;
+ values = new Object[cdoClass.getAllFeatures().length];
+ }
+
+ public CDORevisionImpl(CDORevisionImpl source)
+ {
+ revisionResolver = source.revisionResolver;
+ cdoClass = source.cdoClass;
+ id = source.id;
+ version = source.version;
+ created = source.created;
+ revised = source.revised; // == UNSPECIFIED
+ resourceID = source.resourceID;
+ containerID = source.containerID;
+ containingFeatureID = source.containingFeatureID;
+ copyValues(source.values);
+ }
+
+ public CDORevisionImpl(ExtendedDataInput in, CDORevisionResolver revisionResolver, CDOPackageManager packageManager)
+ throws IOException
+ {
+ this.revisionResolver = revisionResolver;
+
+ READING.start(this);
+ CDOClassRef classRef = CDOModelUtil.readClassRef(in);
+ cdoClass = classRef.resolve(packageManager);
+ if (cdoClass == null)
+ {
+ throw new IllegalStateException("ClassRef unresolveable: " + classRef);
+ }
+
+ id = CDOIDUtil.read(in, revisionResolver.getCDOIDObjectFactory());
+ version = in.readInt();
+ created = in.readLong();
+ revised = in.readLong();
+ resourceID = CDOIDUtil.read(in, revisionResolver.getCDOIDObjectFactory());
+ containerID = CDOIDUtil.read(in, revisionResolver.getCDOIDObjectFactory());
+ containingFeatureID = in.readInt();
+ if (TRACER.isEnabled())
+ {
+ TRACER
+ .format(
+ "Reading revision: ID={0}, classRef={1}, className={2}, version={3}, created={4}, revised={5}, resource={6}, container={7}, feature={8}",
+ id, classRef, cdoClass.getName(), version, created, revised, resourceID, containerID, containingFeatureID);
+ }
+
+ readValues(in);
+ READING.stop(this);
+ }
+
+ public void write(ExtendedDataOutput out, CDOIDProvider idProvider, int referenceChunk) throws IOException
+ {
+ CDOClassRef classRef = cdoClass.createClassRef();
+ if (TRACER.isEnabled())
+ {
+ TRACER
+ .format(
+ "Writing revision: ID={0}, classRef={1}, className={2}, version={3}, created={4}, revised={5}, resource={6}, container={7}, feature={8}",
+ id, classRef, cdoClass.getName(), getVersion(), created, revised, resourceID, containerID,
+ containingFeatureID);
+ }
+
+ WRITING.start(this);
+ CDOModelUtil.writeClassRef(out, classRef);
+ CDOIDUtil.write(out, id);
+ out.writeInt(getVersion());
+ out.writeLong(created);
+ out.writeLong(revised);
+ CDOIDUtil.write(out, resourceID);
+ CDOIDUtil.write(out, containerID);
+ out.writeInt(containingFeatureID);
+ writeValues(out, idProvider, referenceChunk);
+ WRITING.stop(this);
+ }
+
+ public CDORevisionResolver getRevisionResolver()
+ {
+ return revisionResolver;
+ }
+
+ public CDOClass getCDOClass()
+ {
+ return cdoClass;
+ }
+
+ public CDOID getID()
+ {
+ return id;
+ }
+
+ public void setID(CDOID id)
+ {
+ if (TRACER.isEnabled())
+ {
+ TRACER.format("Setting ID: {0}", id);
+ }
+
+ this.id = id;
+ }
+
+ public int getVersion()
+ {
+ return version < 0 ? -version : version;
+ }
+
+ public void setVersion(int version)
+ {
+ if (TRACER.isEnabled())
+ {
+ TRACER.format("Setting version for {0}: v{1}", this, version);
+ }
+
+ this.version = version;
+ }
+
+ public boolean isTransactional()
+ {
+ return version < 0;
+ }
+
+ public int setTransactional()
+ {
+ if (TRACER.isEnabled())
+ {
+ TRACER.format("Setting transactional {0}: v{1}", this, -(version + 1));
+ }
+
+ version = -(version + 1);
+ return version;
+ }
+
+ public void setUntransactional()
+ {
+ if (TRACER.isEnabled())
+ {
+ TRACER.format("Setting untransactional {0}: v{1}", this, Math.abs(version));
+ }
+
+ version = Math.abs(version);
+ }
+
+ public long getCreated()
+ {
+ return created;
+ }
+
+ public void setCreated(long created)
+ {
+ if (TRACER.isEnabled())
+ {
+ TRACER.format("Setting created {0}: {1,date} {1,time}", this, created);
+ }
+
+ this.created = created;
+ }
+
+ public long getRevised()
+ {
+ return revised;
+ }
+
+ public void setRevised(long revised)
+ {
+ if (TRACER.isEnabled())
+ {
+ TRACER.format("Setting revised {0}: {1,date} {1,time}", this, revised);
+ }
+
+ this.revised = revised;
+ }
+
+ public boolean isCurrent()
+ {
+ return revised == UNSPECIFIED_DATE;
+ }
+
+ public boolean isValid(long timeStamp)
+ {
+ return (revised == UNSPECIFIED_DATE || revised >= timeStamp) && timeStamp >= created;
+ }
+
+ public boolean isResource()
+ {
+ return cdoClass.isResource();
+ }
+
+ public CDORevisionData getData()
+ {
+ return this;
+ }
+
+ public CDORevision getRevision()
+ {
+ return this;
+ }
+
+ public InternalCDORevisionDelta compare(CDORevision origin)
+ {
+ return (InternalCDORevisionDelta)CDORevisionDeltaUtil.create(origin, this);
+ }
+
+ public void merge(CDORevisionDelta delta)
+ {
+ CDORevisionMerger applier = new CDORevisionMerger();
+ applier.merge(this, delta);
+ }
+
+ public CDOID getResourceID()
+ {
+ return resourceID;
+ }
+
+ public void setResourceID(CDOID resourceID)
+ {
+ if (TRACER.isEnabled())
+ {
+ TRACER.format("Setting resourceID {0}: {1}", this, resourceID);
+ }
+
+ this.resourceID = resourceID;
+ }
+
+ public CDOID getContainerID()
+ {
+ return containerID;
+ }
+
+ public void setContainerID(CDOID containerID)
+ {
+ if (TRACER.isEnabled())
+ {
+ TRACER.format("Setting containerID {0}: {1}", this, containerID);
+ }
+
+ this.containerID = containerID;
+ }
+
+ public int getContainingFeatureID()
+ {
+ return containingFeatureID;
+ }
+
+ public void setContainingFeatureID(int containingFeatureID)
+ {
+ if (TRACER.isEnabled())
+ {
+ TRACER.format("Setting containingFeatureID {0}: {1}", this, containingFeatureID);
+ }
+
+ this.containingFeatureID = containingFeatureID;
+ }
+
+ public int hashCode(CDOFeature feature)
+ {
+ return getValue(feature).hashCode();
+ }
+
+ public Object get(CDOFeature feature, int index)
+ {
+ if (feature.isMany())
+ {
+ return getList(feature).get(index);
+ }
+
+ return getValue(feature);
+ }
+
+ public boolean contains(CDOFeature feature, Object value)
+ {
+ return getList(feature).contains(value);
+ }
+
+ public int indexOf(CDOFeature feature, Object value)
+ {
+ return getList(feature).indexOf(value);
+ }
+
+ public boolean isEmpty(CDOFeature feature)
+ {
+ return getList(feature).isEmpty();
+ }
+
+ public boolean isSet(CDOFeature feature)
+ {
+ return getValue(feature) != null;
+ }
+
+ public int lastIndexOf(CDOFeature feature, Object value)
+ {
+ return getList(feature).lastIndexOf(value);
+ }
+
+ public int size(CDOFeature feature)
+ {
+ return getList(feature).size();
+ }
+
+ public Object[] toArray(CDOFeature feature)
+ {
+ if (!feature.isMany())
+ {
+ throw new IllegalStateException("!feature.isMany()");
+ }
+
+ return getList(feature).toArray();
+ }
+
+ public <T> T[] toArray(CDOFeature feature, T[] array)
+ {
+ if (!feature.isMany())
+ {
+ throw new IllegalStateException("!feature.isMany()");
+ }
+
+ return getList(feature).toArray(array);
+ }
+
+ public void add(CDOFeature feature, int index, Object value)
+ {
+ getList(feature).add(index, value);
+ }
+
+ public void clear(CDOFeature feature)
+ {
+ setValue(feature, null);
+ }
+
+ public Object move(CDOFeature feature, int targetIndex, int sourceIndex)
+ {
+ return getList(feature).move(targetIndex, sourceIndex);
+ }
+
+ public Object remove(CDOFeature feature, int index)
+ {
+ return getList(feature).remove(index);
+ }
+
+ public Object set(CDOFeature feature, int index, Object value)
+ {
+ if (feature.isMany())
+ {
+ return getList(feature).set(index, value);
+ }
+
+ return setValue(feature, value);
+ }
+
+ public void unset(CDOFeature feature)
+ {
+ setValue(feature, null);
+ }
+
+ public void adjustReferences(Map<CDOIDTemp, CDOID> idMappings)
+ {
+ if (TRACER.isEnabled())
+ {
+ TRACER.format("Adjusting references for revision {0}", this);
+ }
+
+ resourceID = (CDOID)remapID(resourceID, idMappings);
+ containerID = (CDOID)remapID(containerID, idMappings);
+
+ CDOFeature[] features = cdoClass.getAllFeatures();
+ for (int i = 0; i < features.length; i++)
+ {
+ CDOFeature feature = features[i];
+ if (feature.isReference())
+ {
+ if (feature.isMany())
+ {
+ List<Object> list = getValueAsList(i);
+ int size = list == null ? 0 : list.size();
+ for (int j = 0; j < size; j++)
+ {
+ Object oldID = list.get(j);
+ Object newID = remapID(oldID, idMappings);
+ if (newID != oldID)
+ {
+ list.set(j, newID);
+ }
+ }
+ }
+ else
+ {
+ values[i] = remapID(values[i], idMappings);
+ }
+ }
+ }
+ }
+
+ @SuppressWarnings("unchecked")
+ private List<Object> getValueAsList(int i)
+ {
+ return (List<Object>)values[i];
+ }
+
+ @Override
+ public String toString()
+ {
+ return cdoClass.getName() + "@" + id + "v" + version;
+ }
+
+ public Object getValue(CDOFeature feature)
+ {
+ int i = cdoClass.getFeatureID(feature);
+ return values[i];
+ }
+
+ public Object setValue(CDOFeature feature, Object value)
+ {
+ int i = cdoClass.getFeatureID(feature);
+ Object old = values[i];
+ values[i] = value;
+ return old;
+ }
+
+ public MoveableList<Object> getList(CDOFeature feature)
+ {
+ return getList(feature, 0);
+ }
+
+ @SuppressWarnings("unchecked")
+ public MoveableList<Object> getList(CDOFeature feature, int size)
+ {
+ int i = cdoClass.getFeatureID(feature);
+ MoveableList<Object> list = (MoveableList<Object>)values[i];
+ if (list == null)
+ {
+ list = new MoveableArrayList<Object>(size);
+ values[i] = list;
+ }
+
+ return list;
+ }
+
+ public void setListSize(CDOFeature feature, int size)
+ {
+ MoveableList<Object> list = getList(feature, size);
+ for (int j = list.size(); j < size; j++)
+ {
+ list.add(InternalCDORevision.UNINITIALIZED);
+ }
+ }
+
+ @SuppressWarnings("unchecked")
+ private void copyValues(Object[] sourceValues)
+ {
+ CDOFeature[] features = cdoClass.getAllFeatures();
+ values = new Object[features.length];
+ for (int i = 0; i < features.length; i++)
+ {
+ CDOFeature feature = features[i];
+ CDOType type = feature.getType();
+ if (feature.isMany())
+ {
+ MoveableList<Object> sourceList = (MoveableList<Object>)sourceValues[i];
+ if (sourceList != null)
+ {
+ int size = sourceList.size();
+ MoveableList<Object> list = new MoveableArrayList<Object>(size);
+ for (int j = 0; j < size; j++)
+ {
+ Object value = sourceList.get(j);
+ if (value instanceof CDOReferenceProxy)
+ {
+ list.add(new CDOReferenceProxyImpl(this, feature, ((CDOReferenceProxy)value).getIndex()));
+ }
+ else
+ {
+ list.add(type.copyValue(value));
+ }
+ }
+
+ values[i] = list;
+ }
+ }
+ else
+ {
+ values[i] = type.copyValue(sourceValues[i]);
+ }
+ }
+ }
+
+ private void readValues(ExtendedDataInput in) throws IOException
+ {
+ CDOFeature[] features = cdoClass.getAllFeatures();
+ values = new Object[features.length];
+ for (int i = 0; i < features.length; i++)
+ {
+ CDOFeature feature = features[i];
+ CDOType type = feature.getType();
+ if (feature.isMany())
+ {
+ int referenceChunk;
+ int size = in.readInt();
+ if (size < 0)
+ {
+ size = -size;
+ referenceChunk = in.readInt();
+ if (TRACER.isEnabled())
+ {
+ TRACER.format("Read feature {0}: size={1}, referenceChunk={2}", feature, size, referenceChunk);
+ }
+ }
+ else
+ {
+ referenceChunk = size;
+ if (TRACER.isEnabled())
+ {
+ TRACER.format("Read feature {0}: size={1}", feature, size);
+ }
+ }
+
+ if (size != 0)
+ {
+ CDORevisionImpl baseRevision = null;
+ MoveableList<Object> list = new MoveableArrayList<Object>(size);
+ values[i] = list;
+ int ranges = in.readInt();
+ if (ranges != 0)
+ {
+ // This happens only on server side
+ while (ranges-- > 0)
+ {
+ int range = in.readInt();
+ if (range > 0)
+ {
+ while (range-- > 0)
+ {
+ Object value = type.readValue(in, revisionResolver.getCDOIDObjectFactory());
+ list.add(value);
+ if (TRACER.isEnabled())
+ {
+ TRACER.trace(" " + value);
+ }
+ }
+ }
+ else
+ {
+ if (baseRevision == null)
+ {
+ baseRevision = (CDORevisionImpl)revisionResolver.getRevisionByVersion(id, CDORevision.UNCHUNKED,
+ getVersion() - 1);
+ }
+
+ MoveableList<Object> baseList = baseRevision.getList(feature);
+ int index = in.readInt();
+ while (range++ < 0)
+ {
+ Object value = baseList.get(index++);
+ list.add(value);
+ if (TRACER.isEnabled())
+ {
+ TRACER.trace(" " + value);
+ }
+ }
+ }
+ }
+ }
+ else
+ {
+ for (int j = 0; j < referenceChunk; j++)
+ {
+ Object value = type.readValue(in, revisionResolver.getCDOIDObjectFactory());
+ list.add(value);
+ if (TRACER.isEnabled())
+ {
+ TRACER.trace(" " + value);
+ }
+ }
+
+ for (int j = referenceChunk; j < size; j++)
+ {
+ list.add(new CDOReferenceProxyImpl(this, feature, j));
+ }
+ }
+ }
+ }
+ else
+ {
+ values[i] = type.readValue(in, revisionResolver.getCDOIDObjectFactory());
+ if (TRACER.isEnabled())
+ {
+ TRACER.format("Read feature {0}: {1}", feature, values[i]);
+ }
+ }
+ }
+ }
+
+ private void writeValues(ExtendedDataOutput out, CDOIDProvider idProvider, int referenceChunk) throws IOException
+ {
+ CDOFeature[] features = cdoClass.getAllFeatures();
+ for (int i = 0; i < features.length; i++)
+ {
+ CDOFeature feature = features[i];
+ if (feature.isMany())
+ {
+ List<Object> list = getValueAsList(i);
+ int size = list == null ? 0 : list.size();
+ if (referenceChunk != CDORevision.UNCHUNKED && referenceChunk < size)
+ {
+ // This happens only on server-side
+ if (TRACER.isEnabled())
+ {
+ TRACER.format("Writing feature {0}: size={1}, referenceChunk={2}", feature, size, referenceChunk);
+ }
+
+ out.writeInt(-size);
+ out.writeInt(referenceChunk);
+ size = referenceChunk;
+ }
+ else
+ {
+ if (TRACER.isEnabled())
+ {
+ TRACER.format("Writing feature {0}: size={1}", feature, size);
+ }
+
+ out.writeInt(size);
+ }
+
+ if (size != 0)
+ {
+ List<Integer> ranges = revisionResolver.analyzeReferenceRanges(list);
+ if (ranges != null)
+ {
+ // This happens only on client-side
+ out.writeInt(ranges.size());
+ int j = 0;
+ for (int range : ranges)
+ {
+ out.writeInt(range);
+ if (range > 0)
+ {
+ // This is an id range
+ while (range-- > 0)
+ {
+ Object value = list.get(j);
+ if (value != null && feature.isReference())
+ {
+ value = idProvider.provideCDOID(value);
+ list.set(j, value);
+ }
+
+ if (TRACER.isEnabled())
+ {
+ TRACER.trace(" " + value);
+ }
+
+ feature.getType().writeValue(out, value);
+ ++j;
+ }
+ }
+ else
+ {
+ // This is a proxy range
+ CDOReferenceProxy proxy = (CDOReferenceProxy)list.get(j);
+ out.writeInt(proxy.getIndex());
+ j -= range; // Increase j to next range start
+ }
+ }
+ }
+ else
+ {
+ out.writeInt(0); // No ranges -> no ref proxies
+ for (int j = 0; j < size; j++)
+ {
+ Object value = list.get(j);
+ if (value != null && feature.isReference())
+ {
+ value = idProvider.provideCDOID(value);
+ list.set(j, value);
+ }
+
+ if (TRACER.isEnabled())
+ {
+ TRACER.trace(" " + value);
+ }
+
+ feature.getType().writeValue(out, value);
+ }
+ }
+ }
+ }
+ else
+ {
+ if (values[i] != null && feature.isReference())
+ {
+ values[i] = idProvider.provideCDOID(values[i]);
+ }
+
+ if (TRACER.isEnabled())
+ {
+ TRACER.format("Writing feature {0}: {1}", feature, values[i]);
+ }
+
+ feature.getType().writeValue(out, values[i]);
+ }
+ }
+ }
+
+ public static Object remapID(Object value, Map<CDOIDTemp, CDOID> idMappings)
+ {
+ if (value instanceof CDOIDTemp)
+ {
+ CDOIDTemp oldID = (CDOIDTemp)value;
+ if (!oldID.isNull())
+ {
+ CDOID newID = idMappings.get(oldID);
+ if (newID == null)
+ {
+ throw new ImplementationError("Missing ID mapping for " + oldID);
+ }
+
+ if (TRACER.isEnabled())
+ {
+ TRACER.format("Adjusting ID: {0} --> {1}", oldID, newID);
+ }
+
+ return newID;
+ }
+ }
+
+ return value;
+ }
+}
diff --git a/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/internal/common/revision/CDORevisionResolverImpl.java b/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/internal/common/revision/CDORevisionResolverImpl.java
new file mode 100644
index 0000000000..63b3f3d708
--- /dev/null
+++ b/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/internal/common/revision/CDORevisionResolverImpl.java
@@ -0,0 +1,528 @@
+/***************************************************************************
+ * Copyright (c) 2004 - 2008 Eike Stepper, Germany.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Eike Stepper - initial API and implementation
+ * Simon McDuff - https://bugs.eclipse.org/bugs/show_bug.cgi?id=201266
+ **************************************************************************/
+package org.eclipse.emf.cdo.internal.common.revision;
+
+import org.eclipse.emf.cdo.common.id.CDOID;
+import org.eclipse.emf.cdo.common.model.CDOClass;
+import org.eclipse.emf.cdo.common.revision.CDORevision;
+import org.eclipse.emf.cdo.common.revision.CDORevisionResolver;
+import org.eclipse.emf.cdo.internal.common.bundle.OM;
+import org.eclipse.emf.cdo.spi.common.InternalCDORevision;
+
+import org.eclipse.net4j.util.lifecycle.Lifecycle;
+import org.eclipse.net4j.util.om.trace.ContextTracer;
+
+import java.text.MessageFormat;
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.HashMap;
+import java.util.Iterator;
+import java.util.List;
+import java.util.Map;
+
+/**
+ * @author Eike Stepper
+ */
+public abstract class CDORevisionResolverImpl extends Lifecycle implements CDORevisionResolver
+{
+ private static final ContextTracer TRACER = new ContextTracer(OM.DEBUG_REVISION, CDORevisionResolverImpl.class);
+
+ private Map<CDOID, RevisionHolder> revisions = new HashMap<CDOID, RevisionHolder>();
+
+ // {
+ // private static final long serialVersionUID = 1L;
+ //
+ // @Override
+ // public String toString()
+ // {
+ // List<Entry<CDOID, RevisionHolder>> entries = new ArrayList<Entry<CDOID, RevisionHolder>>(entrySet());
+ // Collections.sort(entries, new Comparator<Entry<CDOID, RevisionHolder>>()
+ // {
+ // public int compare(Entry<CDOID, RevisionHolder> o1, Entry<CDOID, RevisionHolder> o2)
+ // {
+ // return o1.getKey().compareTo(o2.getKey());
+ // }
+ // });
+ //
+ // StringBuilder builder = new StringBuilder();
+ // for (Entry<CDOID, RevisionHolder> entry : entries)
+ // {
+ // builder.append(entry.getKey());
+ // builder.append(" -->");
+ // RevisionHolder holder = entry.getValue();
+ // while (holder != null)
+ // {
+ // builder.append(" ");
+ // builder.append(holder.getRevision(false));
+ // holder = holder.getNext();
+ // }
+ //
+ // builder.append("\n");
+ // }
+ //
+ // return builder.toString();
+ // }
+ // };
+
+ private int currentLRUCapacity;
+
+ private int revisedLRUCapacity;
+
+ private LRU currentLRU;
+
+ private LRU revisedLRU;
+
+ public CDORevisionResolverImpl()
+ {
+ }
+
+ public int getCurrentLRUCapacity()
+ {
+ return currentLRUCapacity;
+ }
+
+ public void setCurrentLRUCapacity(int capacity)
+ {
+ currentLRUCapacity = capacity;
+ if (currentLRU != null)
+ {
+ currentLRU.capacity(capacity);
+ }
+ }
+
+ public int getRevisedLRUCapacity()
+ {
+ return revisedLRUCapacity;
+ }
+
+ public void setRevisedLRUCapacity(int capacity)
+ {
+ revisedLRUCapacity = capacity;
+ if (revisedLRU != null)
+ {
+ revisedLRU.capacity(capacity);
+ }
+ }
+
+ public CDOClass getObjectType(CDOID id)
+ {
+ RevisionHolder holder = revisions.get(id);
+ if (holder == null)
+ {
+ return null;
+ }
+
+ InternalCDORevision revision = (InternalCDORevision)holder.getRevision(true);
+ return revision.getCDOClass();
+ }
+
+ public boolean containsRevision(CDOID id)
+ {
+ return revisions.containsKey(id);
+ }
+
+ public boolean containsRevisionByTime(CDOID id, long timeStamp)
+ {
+ return getRevisionByTime(id, 0, timeStamp, false) != null;
+ }
+
+ public boolean containsRevisionByVersion(CDOID id, int version)
+ {
+ return getRevisionByVersion(id, 0, version, false) != null;
+ }
+
+ public InternalCDORevision getRevision(CDOID id, int referenceChunk)
+ {
+ return getRevision(id, referenceChunk, true);
+ }
+
+ public List<CDORevision> getRevisions(Collection<CDOID> ids, int referenceChunk)
+ {
+ List<CDOID> missingIDs = new ArrayList<CDOID>(0);
+ List<CDORevision> revisions = new ArrayList<CDORevision>(ids.size());
+ for (CDOID id : ids)
+ {
+ InternalCDORevision revision = getRevision(id, referenceChunk, false);
+ revisions.add(revision);
+ if (revision == null)
+ {
+ missingIDs.add(id);
+ }
+ }
+
+ if (!missingIDs.isEmpty())
+ {
+ List<InternalCDORevision> missingRevisions = loadRevisions(missingIDs, referenceChunk);
+ handleMissingRevisions(revisions, missingRevisions);
+ }
+
+ return revisions;
+ }
+
+ public InternalCDORevision getRevisionByTime(CDOID id, int referenceChunk, long timeStamp)
+ {
+ return getRevisionByTime(id, referenceChunk, timeStamp, true);
+ }
+
+ public List<CDORevision> getRevisionsByTime(Collection<CDOID> ids, int referenceChunk, long timeStamp)
+ {
+ List<CDOID> missingIDs = new ArrayList<CDOID>(0);
+ List<CDORevision> revisions = new ArrayList<CDORevision>(ids.size());
+ for (CDOID id : ids)
+ {
+ InternalCDORevision revision = getRevisionByTime(id, referenceChunk, timeStamp, false);
+ revisions.add(revision);
+ if (revision == null)
+ {
+ missingIDs.add(id);
+ }
+ }
+
+ if (!missingIDs.isEmpty())
+ {
+ List<InternalCDORevision> missingRevisions = loadRevisions(missingIDs, referenceChunk);
+ handleMissingRevisions(revisions, missingRevisions);
+ }
+
+ return revisions;
+ }
+
+ public synchronized InternalCDORevision getRevisionByVersion(CDOID id, int referenceChunk, int version)
+ {
+ return getRevisionByVersion(id, referenceChunk, version, true);
+ }
+
+ public synchronized InternalCDORevision getRevisionByVersion(CDOID id, int referenceChunk, int version,
+ boolean loadOnDemand)
+ {
+ RevisionHolder holder = revisions.get(id);
+ while (holder != null)
+ {
+ int holderVersion = holder.getVersion();
+ if (holderVersion > version)
+ {
+ holder = holder.getNext();
+ }
+ else if (holderVersion == version)
+ {
+ return (InternalCDORevision)holder.getRevision(true);
+ }
+ else
+ {
+ break;
+ }
+ }
+
+ if (loadOnDemand)
+ {
+ InternalCDORevision revision = loadRevisionByVersion(id, referenceChunk, version);
+ if (revision != null)
+ {
+ addRevision(revision);
+ return revision;
+ }
+ }
+
+ return null;
+ }
+
+ public boolean addRevision(InternalCDORevision revision)
+ {
+ if (TRACER.isEnabled())
+ {
+ TRACER.format("Adding revision: {0}, created={1,date} {1,time}, revised={2,date} {2,time}, current={3}",
+ revision, revision.getCreated(), revision.getRevised(), revision.isCurrent());
+ }
+
+ RevisionHolder newHolder = createHolder(revision);
+ LRU list = revision.isCurrent() ? currentLRU : revisedLRU;
+ list.add((DLRevisionHolder)newHolder);
+
+ int version = revision.getVersion();
+ RevisionHolder lastHolder = null;
+ RevisionHolder holder = revisions.get(revision.getID());
+ while (holder != null)
+ {
+ int holderVersion = holder.getVersion();
+ if (holderVersion > version)
+ {
+ lastHolder = holder;
+ holder = holder.getNext();
+ }
+ else if (holderVersion == version)
+ {
+ return false;
+ }
+ else
+ {
+ break;
+ }
+ }
+
+ adjustHolder(revision, newHolder, lastHolder, holder);
+ return true;
+ }
+
+ protected InternalCDORevision getRevision(CDOID id, int referenceChunk, boolean loadOnDemand)
+ {
+ RevisionHolder holder = revisions.get(id);
+ InternalCDORevision revision = holder == null ? null : (InternalCDORevision)holder.getRevision(true);
+ if (revision == null || !revision.isCurrent())
+ {
+ if (loadOnDemand)
+ {
+ revision = loadRevision(id, referenceChunk);
+ if (revision == null)
+ {
+ throw new IllegalStateException("Could not load revision for " + id);
+ }
+
+ addRevision(revision);
+ }
+ else
+ {
+ revision = null;
+ }
+ }
+ else
+ {
+ InternalCDORevision oldRevision = revision;
+ revision = verifyRevision(oldRevision, referenceChunk);
+ if (revision != oldRevision)
+ {
+ addRevision(revision);
+ }
+ }
+
+ return revision;
+ }
+
+ protected synchronized InternalCDORevision getRevisionByTime(CDOID id, int referenceChunk, long timeStamp,
+ boolean loadOnDemand)
+ {
+ RevisionHolder holder = revisions.get(id);
+ while (holder != null)
+ {
+ int indicator = holder.compareTo(timeStamp);
+ if (indicator == 1)
+ {
+ // timeStamp is after holder timeSpan
+ holder = holder.getNext();
+ }
+ else if (indicator == 0)
+ {
+ // timeStamp is within holder timeSpan
+ InternalCDORevision oldRevision = (InternalCDORevision)holder.getRevision(true);
+ InternalCDORevision revision = verifyRevision(oldRevision, referenceChunk);
+ if (revision != oldRevision)
+ {
+ addRevision(revision);
+ }
+
+ return revision;
+ }
+ else
+ {
+ // timeStamp is before holder timeSpan
+ break;
+ }
+ }
+
+ if (loadOnDemand)
+ {
+ InternalCDORevision revision = loadRevisionByTime(id, referenceChunk, timeStamp);
+ if (revision != null)
+ {
+ addRevision(revision);
+ return revision;
+ }
+ }
+
+ return null;
+ }
+
+ protected abstract InternalCDORevision loadRevision(CDOID id, int referenceChunk);
+
+ protected abstract InternalCDORevision loadRevisionByTime(CDOID id, int referenceChunk, long timeStamp);
+
+ protected abstract InternalCDORevision loadRevisionByVersion(CDOID id, int referenceChunk, int version);
+
+ protected abstract List<InternalCDORevision> loadRevisions(Collection<CDOID> ids, int referenceChunk);
+
+ protected abstract List<InternalCDORevision> loadRevisionsByTime(Collection<CDOID> ids, int referenceChunk,
+ long timeStamp);
+
+ protected void handleMissingRevisions(List<CDORevision> revisions, List<InternalCDORevision> missingRevisions)
+ {
+ Iterator<InternalCDORevision> it = missingRevisions.iterator();
+ for (int i = 0; i < revisions.size(); i++)
+ {
+ CDORevision revision = revisions.get(i);
+ if (revision == null)
+ {
+ InternalCDORevision missingRevision = it.next();
+ revisions.set(i, missingRevision);
+ addRevision(missingRevision);
+ }
+ }
+ }
+
+ protected synchronized void removeRevision(CDOID id, int version)
+ {
+ RevisionHolder holder = revisions.get(id);
+ while (holder != null)
+ {
+ int holderVersion = holder.getVersion();
+ if (holderVersion > version)
+ {
+ holder = holder.getNext();
+ }
+ else
+ {
+ if (holderVersion == version)
+ {
+ removeHolder(holder);
+ }
+
+ holder = null;
+ }
+ }
+ }
+
+ protected InternalCDORevision verifyRevision(InternalCDORevision revision, int referenceChunk)
+ {
+ return revision;
+ }
+
+ @Override
+ protected void doActivate() throws Exception
+ {
+ super.doActivate();
+ currentLRU = new LRU(currentLRUCapacity);
+ revisedLRU = new LRU(revisedLRUCapacity);
+ }
+
+ @Override
+ protected void doDeactivate() throws Exception
+ {
+ currentLRU = null;
+ revisedLRU = null;
+ super.doDeactivate();
+ }
+
+ private void adjustHolder(InternalCDORevision revision, RevisionHolder holder, RevisionHolder prevHolder,
+ RevisionHolder nextHolder)
+ {
+ if (prevHolder != null)
+ {
+ if (nextHolder == null)
+ {
+ nextHolder = prevHolder.getNext();
+ }
+
+ holder.setPrev(prevHolder);
+ holder.setNext(nextHolder);
+ prevHolder.setNext(holder);
+ }
+ else
+ {
+ holder.setNext(nextHolder);
+ revisions.put(revision.getID(), holder);
+ }
+
+ reviseHolder(holder, nextHolder);
+ }
+
+ private void reviseHolder(RevisionHolder holder, RevisionHolder nextHolder)
+ {
+ if (nextHolder != null)
+ {
+ nextHolder.setPrev(holder);
+ if (holder.isCurrent() && nextHolder.isCurrent())
+ {
+ currentLRU.remove((DLRevisionHolder)nextHolder);
+ revisedLRU.add((DLRevisionHolder)nextHolder);
+
+ InternalCDORevision oldRevision = (InternalCDORevision)nextHolder.getRevision(false);
+ if (oldRevision != null)
+ {
+ oldRevision.setRevised(holder.getCreated() - 1);
+ }
+ }
+ }
+ }
+
+ private synchronized void removeHolder(RevisionHolder holder)
+ {
+ CDOID id = holder.getID();
+ RevisionHolder prev = holder.getPrev();
+ RevisionHolder next = holder.getNext();
+ if (next != null)
+ {
+ next.setPrev(prev);
+ }
+
+ if (prev != null)
+ {
+ prev.setNext(next);
+ }
+ else
+ {
+ if (next != null)
+ {
+ revisions.put(id, next);
+ }
+ else
+ {
+ revisions.remove(id);
+ }
+ }
+
+ holder.setPrev(null);
+ holder.setNext(null);
+ }
+
+ private RevisionHolder createHolder(InternalCDORevision revision)
+ {
+ LRURevisionList list = revision.isCurrent() ? currentLRU : revisedLRU;
+ return new LRURevisionHolder(list, revision);
+ }
+
+ /**
+ * @author Eike Stepper
+ */
+ private final class LRU extends LRURevisionList
+ {
+ public LRU(int capacity)
+ {
+ super(capacity);
+ }
+
+ @Override
+ public String toString()
+ {
+ return MessageFormat.format("LRU[size={0}, capacity={1}]", size(), capacity());
+ }
+
+ @Override
+ protected void evict(LRURevisionHolder holder)
+ {
+ if (TRACER.isEnabled())
+ {
+ TRACER.format("Evicting revision {0}v{1}", holder.getID(), holder.getVersion());
+ }
+
+ super.evict(holder);
+ removeHolder(holder);
+ }
+ }
+}
diff --git a/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/internal/common/revision/DLRevisionHolder.java b/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/internal/common/revision/DLRevisionHolder.java
new file mode 100644
index 0000000000..86f94cb422
--- /dev/null
+++ b/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/internal/common/revision/DLRevisionHolder.java
@@ -0,0 +1,56 @@
+/***************************************************************************
+ * Copyright (c) 2004 - 2008 Eike Stepper, Germany.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Eike Stepper - initial API and implementation
+ **************************************************************************/
+package org.eclipse.emf.cdo.internal.common.revision;
+
+import org.eclipse.emf.cdo.common.revision.CDORevision;
+
+/**
+ * @author Eike Stepper
+ */
+public class DLRevisionHolder extends RevisionHolder
+{
+ private DLRevisionList dlList;
+
+ private DLRevisionHolder dlPrev;
+
+ private DLRevisionHolder dlNext;
+
+ public DLRevisionHolder(DLRevisionList list, CDORevision revision)
+ {
+ super(revision);
+ dlList = list;
+ }
+
+ public DLRevisionList getDLList()
+ {
+ return dlList;
+ }
+
+ public DLRevisionHolder getDLPrev()
+ {
+ return dlPrev;
+ }
+
+ public void setDLPrev(DLRevisionHolder prev)
+ {
+ dlPrev = prev;
+ }
+
+ public DLRevisionHolder getDLNext()
+ {
+ return dlNext;
+ }
+
+ public void setDLNext(DLRevisionHolder next)
+ {
+ dlNext = next;
+ }
+}
diff --git a/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/internal/common/revision/DLRevisionList.java b/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/internal/common/revision/DLRevisionList.java
new file mode 100644
index 0000000000..f8ba7b7432
--- /dev/null
+++ b/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/internal/common/revision/DLRevisionList.java
@@ -0,0 +1,222 @@
+/***************************************************************************
+ * Copyright (c) 2004 - 2008 Eike Stepper, Germany.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Eike Stepper - initial API and implementation
+ **************************************************************************/
+package org.eclipse.emf.cdo.internal.common.revision;
+
+import org.eclipse.emf.cdo.common.id.CDOID;
+import org.eclipse.emf.cdo.common.revision.CDORevision;
+import org.eclipse.emf.cdo.spi.common.InternalCDORevision;
+
+import java.text.MessageFormat;
+
+/**
+ * @author Eike Stepper
+ */
+public class DLRevisionList extends DLRevisionHolder
+{
+ private int size;
+
+ public DLRevisionList()
+ {
+ super(null, null);
+ setDLHead(this);
+ setDLTail(this);
+ }
+
+ public int size()
+ {
+ return size;
+ }
+
+ public DLRevisionHolder getDLHead()
+ {
+ return getDLNext();
+ }
+
+ public void setDLHead(DLRevisionHolder head)
+ {
+ setDLNext(head);
+ }
+
+ public DLRevisionHolder getDLTail()
+ {
+ return getDLPrev();
+ }
+
+ public void setDLTail(DLRevisionHolder tail)
+ {
+ setDLPrev(tail);
+ }
+
+ public DLRevisionHolder get(int index)
+ {
+ if (index < 0 || index >= size)
+ {
+ throw new IndexOutOfBoundsException("Index: " + index + ", Size: " + size);
+ }
+
+ DLRevisionHolder holder = this;
+ if (index < size >> 1)
+ {
+ for (int i = 0; i <= index; i++)
+ {
+ holder = holder.getDLNext();
+ }
+ }
+ else
+ {
+ for (int i = size; i > index; i--)
+ {
+ holder = holder.getDLPrev();
+ }
+ }
+
+ return holder;
+ }
+
+ public void add(DLRevisionHolder holder)
+ {
+ addTail(holder);
+ }
+
+ public synchronized void addHead(DLRevisionHolder holder)
+ {
+ ++size;
+ DLRevisionHolder head = getDLHead();
+ head.setDLPrev(holder);
+ holder.setDLNext(head);
+ holder.setDLPrev(this);
+ setDLHead(holder);
+ }
+
+ public synchronized void addTail(DLRevisionHolder holder)
+ {
+ ++size;
+ DLRevisionHolder tail = getDLTail();
+ tail.setDLNext(holder);
+ holder.setDLPrev(tail);
+ holder.setDLNext(this);
+ setDLTail(holder);
+ }
+
+ public synchronized void remove(DLRevisionHolder holder)
+ {
+ --size;
+ DLRevisionHolder prev = holder.getDLPrev();
+ DLRevisionHolder next = holder.getDLNext();
+
+ prev.setDLNext(next);
+ holder.setDLPrev(null);
+ holder.setDLNext(null);
+ next.setDLPrev(prev);
+ }
+
+ @Override
+ public String toString()
+ {
+ return MessageFormat.format("DLRevisionList[size={0}]", size);
+ }
+
+ @Override
+ public int compareTo(long timeStamp)
+ {
+ throw new UnsupportedOperationException();
+ }
+
+ @Override
+ public long getCreated()
+ {
+ throw new UnsupportedOperationException();
+ }
+
+ @Override
+ public DLRevisionList getDLList()
+ {
+ throw new UnsupportedOperationException();
+ }
+
+ @Override
+ public CDOID getID()
+ {
+ throw new UnsupportedOperationException();
+ }
+
+ @Override
+ public RevisionHolder getNext()
+ {
+ throw new UnsupportedOperationException();
+ }
+
+ @Override
+ public RevisionHolder getPrev()
+ {
+ throw new UnsupportedOperationException();
+ }
+
+ @Override
+ public long getRevised()
+ {
+ throw new UnsupportedOperationException();
+ }
+
+ @Override
+ public CDORevision getRevision(boolean loadOnDemand)
+ {
+ throw new UnsupportedOperationException();
+ }
+
+ @Override
+ public int getVersion()
+ {
+ throw new UnsupportedOperationException();
+ }
+
+ @Override
+ public boolean isCurrent()
+ {
+ throw new UnsupportedOperationException();
+ }
+
+ @Override
+ public boolean isLoaded()
+ {
+ throw new UnsupportedOperationException();
+ }
+
+ @Override
+ public boolean isValid(long timeStamp)
+ {
+ throw new UnsupportedOperationException();
+ }
+
+ @Override
+ protected InternalCDORevision loadRevision()
+ {
+ throw new UnsupportedOperationException();
+ }
+
+ @Override
+ public void setNext(RevisionHolder next)
+ {
+ throw new UnsupportedOperationException();
+ }
+
+ @Override
+ public void setPrev(RevisionHolder prev)
+ {
+ throw new UnsupportedOperationException();
+ }
+
+ @Override
+ public void setRevision(CDORevision revision)
+ {
+ // Ignore
+ }
+}
diff --git a/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/internal/common/revision/LRURevisionHolder.java b/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/internal/common/revision/LRURevisionHolder.java
new file mode 100644
index 0000000000..4eb20d9a25
--- /dev/null
+++ b/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/internal/common/revision/LRURevisionHolder.java
@@ -0,0 +1,63 @@
+/***************************************************************************
+ * Copyright (c) 2004 - 2008 Eike Stepper, Germany.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Eike Stepper - initial API and implementation
+ **************************************************************************/
+package org.eclipse.emf.cdo.internal.common.revision;
+
+import org.eclipse.emf.cdo.common.revision.CDORevision;
+
+/**
+ * @author Eike Stepper
+ */
+public class LRURevisionHolder extends DLRevisionHolder
+{
+ private long usedStamp;
+
+ public LRURevisionHolder(LRURevisionList list, CDORevision revision)
+ {
+ super(list, revision);
+ usedStamp = System.currentTimeMillis();
+ }
+
+ @Override
+ public LRURevisionList getDLList()
+ {
+ return (LRURevisionList)super.getDLList();
+ }
+
+ public long getUsedStamp()
+ {
+ return usedStamp;
+ }
+
+ @Override
+ public CDORevision getRevision(boolean loadOnDemand)
+ {
+ if (loadOnDemand)
+ {
+ stamp();
+ }
+
+ return super.getRevision(loadOnDemand);
+ }
+
+ protected void stamp()
+ {
+ usedStamp = System.currentTimeMillis();
+ LRURevisionList list = getDLList();
+ if (list != null)
+ {
+ synchronized (list)
+ {
+ list.remove(this);
+ list.addHead(this);
+ }
+ }
+ }
+}
diff --git a/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/internal/common/revision/LRURevisionList.java b/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/internal/common/revision/LRURevisionList.java
new file mode 100644
index 0000000000..26525a7ac9
--- /dev/null
+++ b/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/internal/common/revision/LRURevisionList.java
@@ -0,0 +1,66 @@
+/***************************************************************************
+ * Copyright (c) 2004 - 2008 Eike Stepper, Germany.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Eike Stepper - initial API and implementation
+ **************************************************************************/
+package org.eclipse.emf.cdo.internal.common.revision;
+
+import java.text.MessageFormat;
+
+/**
+ * @author Eike Stepper
+ */
+public class LRURevisionList extends DLRevisionList
+{
+ private int capacity;
+
+ public LRURevisionList(int capacity)
+ {
+ this.capacity = capacity;
+ }
+
+ public int capacity()
+ {
+ return capacity;
+ }
+
+ public synchronized void capacity(int capacity)
+ {
+ this.capacity = capacity;
+ eviction();
+ }
+
+ @Override
+ public synchronized void add(DLRevisionHolder holder)
+ {
+ addHead(holder);
+ eviction();
+ }
+
+ @Override
+ public String toString()
+ {
+ return MessageFormat.format("LRURevisionList[size={0}, capacity={1}]", size(), capacity);
+ }
+
+ protected void eviction()
+ {
+ if (capacity != 0)
+ {
+ while (size() > capacity)
+ {
+ evict((LRURevisionHolder)getDLTail());
+ }
+ }
+ }
+
+ protected void evict(LRURevisionHolder holder)
+ {
+ remove(holder);
+ }
+}
diff --git a/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/internal/common/revision/RevisionHolder.java b/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/internal/common/revision/RevisionHolder.java
new file mode 100644
index 0000000000..c58a1a3009
--- /dev/null
+++ b/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/internal/common/revision/RevisionHolder.java
@@ -0,0 +1,142 @@
+/***************************************************************************
+ * Copyright (c) 2004 - 2008 Eike Stepper, Germany.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Eike Stepper - initial API and implementation
+ **************************************************************************/
+package org.eclipse.emf.cdo.internal.common.revision;
+
+import org.eclipse.emf.cdo.common.id.CDOID;
+import org.eclipse.emf.cdo.common.revision.CDORevision;
+import org.eclipse.emf.cdo.spi.common.InternalCDORevision;
+
+import java.text.MessageFormat;
+
+/**
+ * @author Eike Stepper
+ */
+public class RevisionHolder
+{
+ // private CDOID id;
+ //
+ // private int version;
+ //
+ // private long created;
+ //
+ // private long revised;
+
+ private RevisionHolder prev;
+
+ private RevisionHolder next;
+
+ private CDORevision revision;
+
+ public RevisionHolder(CDORevision revision)
+ {
+ setRevision(revision);
+ }
+
+ public CDOID getID()
+ {
+ return revision.getID();
+ }
+
+ public int getVersion()
+ {
+ return revision.getVersion();
+ }
+
+ public long getCreated()
+ {
+ return revision.getCreated();
+ }
+
+ public long getRevised()
+ {
+ return revision.getRevised();
+ }
+
+ public boolean isCurrent()
+ {
+ return getRevised() == CDORevision.UNSPECIFIED_DATE;
+ }
+
+ public boolean isValid(long timeStamp)
+ {
+ return (getRevised() == CDORevision.UNSPECIFIED_DATE || getRevised() >= timeStamp) && timeStamp >= getCreated();
+ }
+
+ public int compareTo(long timeStamp)
+ {
+ if (timeStamp < getCreated())
+ {
+ return -1;
+ }
+
+ if (getRevised() != CDORevision.UNSPECIFIED_DATE && timeStamp > getRevised())
+ {
+ return 1;
+ }
+
+ return 0;
+ }
+
+ public RevisionHolder getPrev()
+ {
+ return prev;
+ }
+
+ public void setPrev(RevisionHolder prev)
+ {
+ this.prev = prev;
+ }
+
+ public RevisionHolder getNext()
+ {
+ return next;
+ }
+
+ public void setNext(RevisionHolder next)
+ {
+ this.next = next;
+ }
+
+ public boolean isLoaded()
+ {
+ return revision != null;
+ }
+
+ public CDORevision getRevision(boolean loadOnDemand)
+ {
+ if (revision == null && loadOnDemand)
+ {
+ revision = loadRevision();
+ }
+
+ return revision;
+ }
+
+ public void setRevision(CDORevision revision)
+ {
+ this.revision = revision;
+ // id = revision.getID();
+ // version = revision.getVersion();
+ // created = revision.getCreated();
+ // revised = revision.getRevised();
+ }
+
+ @Override
+ public String toString()
+ {
+ return MessageFormat.format("RevisionHolder[{0}]", revision);
+ }
+
+ protected InternalCDORevision loadRevision()
+ {
+ throw new UnsupportedOperationException();
+ }
+}
diff --git a/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/internal/common/revision/delta/CDOAddFeatureDeltaImpl.java b/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/internal/common/revision/delta/CDOAddFeatureDeltaImpl.java
new file mode 100644
index 0000000000..c7de939da6
--- /dev/null
+++ b/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/internal/common/revision/delta/CDOAddFeatureDeltaImpl.java
@@ -0,0 +1,72 @@
+/***************************************************************************
+ * Copyright (c) 2004 - 2008 Eike Stepper, Germany.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Simon McDuff - initial API and implementation
+ * Eike Stepper - maintenance
+ **************************************************************************/
+package org.eclipse.emf.cdo.internal.common.revision.delta;
+
+import org.eclipse.emf.cdo.common.model.CDOClass;
+import org.eclipse.emf.cdo.common.model.CDOFeature;
+import org.eclipse.emf.cdo.common.revision.CDORevision;
+import org.eclipse.emf.cdo.common.revision.delta.CDOAddFeatureDelta;
+import org.eclipse.emf.cdo.common.revision.delta.CDOFeatureDeltaVisitor;
+import org.eclipse.emf.cdo.spi.common.InternalCDORevision;
+
+import org.eclipse.net4j.util.io.ExtendedDataInput;
+
+import java.io.IOException;
+
+/**
+ * @author Simon McDuff
+ */
+public class CDOAddFeatureDeltaImpl extends CDOSingleValueFeatureDeltaImpl implements CDOAddFeatureDelta,
+ IListIndexAffecting, IListTargetAdding
+{
+ public CDOAddFeatureDeltaImpl(CDOFeature feature, int index, Object value)
+ {
+ super(feature, index, value);
+ }
+
+ public CDOAddFeatureDeltaImpl(ExtendedDataInput in, CDOClass cdoClass) throws IOException
+ {
+ super(in, cdoClass);
+ }
+
+ public Type getType()
+ {
+ return Type.ADD;
+ }
+
+ public void apply(CDORevision revision)
+ {
+ ((InternalCDORevision)revision).getList(getFeature()).add(getIndex(), getValue());
+ }
+
+ public void accept(CDOFeatureDeltaVisitor visitor)
+ {
+ visitor.visit(this);
+ }
+
+ public void affectIndices(int[] indices)
+ {
+ int index = getIndex();
+ if (index == NO_INDEX)
+ {
+ return;
+ }
+
+ for (int i = 1; i <= indices[0]; i++)
+ {
+ if (indices[i] >= index)
+ {
+ ++indices[i];
+ }
+ }
+ }
+}
diff --git a/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/internal/common/revision/delta/CDOClearFeatureDeltaImpl.java b/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/internal/common/revision/delta/CDOClearFeatureDeltaImpl.java
new file mode 100644
index 0000000000..ba98c6e565
--- /dev/null
+++ b/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/internal/common/revision/delta/CDOClearFeatureDeltaImpl.java
@@ -0,0 +1,63 @@
+/***************************************************************************
+ * Copyright (c) 2004 - 2008 Eike Stepper, Germany.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Simon McDuff - initial API and implementation
+ * Eike Stepper - maintenance
+ **************************************************************************/
+package org.eclipse.emf.cdo.internal.common.revision.delta;
+
+import org.eclipse.emf.cdo.common.id.CDOID;
+import org.eclipse.emf.cdo.common.id.CDOIDTemp;
+import org.eclipse.emf.cdo.common.model.CDOClass;
+import org.eclipse.emf.cdo.common.model.CDOFeature;
+import org.eclipse.emf.cdo.common.revision.CDORevision;
+import org.eclipse.emf.cdo.common.revision.delta.CDOClearFeatureDelta;
+import org.eclipse.emf.cdo.common.revision.delta.CDOFeatureDeltaVisitor;
+import org.eclipse.emf.cdo.spi.common.InternalCDORevision;
+
+import org.eclipse.net4j.util.io.ExtendedDataInput;
+
+import java.io.IOException;
+import java.util.Map;
+
+/**
+ * @author Simon McDuff
+ */
+public class CDOClearFeatureDeltaImpl extends CDOFeatureDeltaImpl implements CDOClearFeatureDelta
+{
+ public CDOClearFeatureDeltaImpl(CDOFeature feature)
+ {
+ super(feature);
+ }
+
+ public CDOClearFeatureDeltaImpl(ExtendedDataInput in, CDOClass cdoClass) throws IOException
+ {
+ super(in, cdoClass);
+ }
+
+ public Type getType()
+ {
+ return Type.CLEAR;
+ }
+
+ public void apply(CDORevision revision)
+ {
+ ((InternalCDORevision)revision).clear(getFeature());
+ }
+
+ public void accept(CDOFeatureDeltaVisitor visitor)
+ {
+ visitor.visit(this);
+ }
+
+ @Override
+ public void adjustReferences(Map<CDOIDTemp, CDOID> idMappings)
+ {
+ // Do nothing
+ }
+}
diff --git a/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/internal/common/revision/delta/CDOContainerFeatureDeltaImpl.java b/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/internal/common/revision/delta/CDOContainerFeatureDeltaImpl.java
new file mode 100644
index 0000000000..6763434c40
--- /dev/null
+++ b/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/internal/common/revision/delta/CDOContainerFeatureDeltaImpl.java
@@ -0,0 +1,197 @@
+/***************************************************************************
+ * Copyright (c) 2004 - 2008 Eike Stepper, Germany.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Simon McDuff - initial API and implementation
+ * Eike Stepper - maintenance
+ **************************************************************************/
+package org.eclipse.emf.cdo.internal.common.revision.delta;
+
+import org.eclipse.emf.cdo.common.id.CDOID;
+import org.eclipse.emf.cdo.common.id.CDOIDProvider;
+import org.eclipse.emf.cdo.common.id.CDOIDTemp;
+import org.eclipse.emf.cdo.common.id.CDOIDUtil;
+import org.eclipse.emf.cdo.common.model.CDOClass;
+import org.eclipse.emf.cdo.common.model.CDOClassProxy;
+import org.eclipse.emf.cdo.common.model.CDOFeature;
+import org.eclipse.emf.cdo.common.model.CDOPackage;
+import org.eclipse.emf.cdo.common.model.CDOPackageManager;
+import org.eclipse.emf.cdo.common.model.CDOType;
+import org.eclipse.emf.cdo.common.revision.CDORevision;
+import org.eclipse.emf.cdo.common.revision.CDORevisionUtil;
+import org.eclipse.emf.cdo.common.revision.delta.CDOContainerFeatureDelta;
+import org.eclipse.emf.cdo.common.revision.delta.CDOFeatureDeltaVisitor;
+import org.eclipse.emf.cdo.spi.common.InternalCDORevision;
+
+import org.eclipse.net4j.util.io.ExtendedDataInput;
+import org.eclipse.net4j.util.io.ExtendedDataOutput;
+
+import java.io.IOException;
+import java.util.Map;
+
+/**
+ * @author Simon McDuff
+ */
+public class CDOContainerFeatureDeltaImpl extends CDOFeatureDeltaImpl implements CDOContainerFeatureDelta
+{
+ /**
+ * TODO Move to CDOObjectContainerFeature
+ */
+ private static CDOFeature CONTAINER_FEATURE = new ContainerFeature();
+
+ private CDOID newContainerID;
+
+ private int newContainerFeatureID;
+
+ public CDOContainerFeatureDeltaImpl(CDOID newContainerID, int newContainerFeatureID)
+ {
+ super(CONTAINER_FEATURE);
+ this.newContainerID = newContainerID;
+ this.newContainerFeatureID = newContainerFeatureID;
+ }
+
+ public CDOContainerFeatureDeltaImpl(ExtendedDataInput in, CDOClass cdoClass) throws IOException
+ {
+ super(CONTAINER_FEATURE);
+ newContainerFeatureID = in.readInt();
+ newContainerID = CDOIDUtil.read(in, cdoClass.getPackageManager().getCDOIDObjectFactory());
+ }
+
+ public int getContainerFeatureID()
+ {
+ return newContainerFeatureID;
+ }
+
+ public CDOID getContainerID()
+ {
+ return newContainerID;
+ }
+
+ public Type getType()
+ {
+ return Type.CONTAINER;
+ }
+
+ public void apply(CDORevision revision)
+ {
+ ((InternalCDORevision)revision).setContainerID(newContainerID);
+ ((InternalCDORevision)revision).setContainingFeatureID(newContainerFeatureID);
+ }
+
+ @Override
+ public void adjustReferences(Map<CDOIDTemp, CDOID> idMappings)
+ {
+ newContainerID = (CDOID)CDORevisionUtil.remapID(newContainerID, idMappings);
+ }
+
+ @Override
+ public void write(ExtendedDataOutput out, CDOClass cdoClass, CDOIDProvider idProvider) throws IOException
+ {
+ out.writeInt(getType().ordinal());
+ out.writeInt(newContainerFeatureID);
+ CDOIDUtil.write(out, newContainerID);
+ }
+
+ public void accept(CDOFeatureDeltaVisitor visitor)
+ {
+ visitor.visit(this);
+ }
+
+ /**
+ * @author Simon McDuff
+ */
+ private static final class ContainerFeature implements CDOFeature
+ {
+ public CDOClass getContainingClass()
+ {
+ return null;
+ }
+
+ public void setContainingClass(CDOClass cdoClass)
+ {
+ }
+
+ public CDOPackage getContainingPackage()
+ {
+ return null;
+ }
+
+ public int getFeatureID()
+ {
+ return 0;
+ }
+
+ public int getFeatureIndex()
+ {
+ return 0;
+ }
+
+ public CDOClass getReferenceType()
+ {
+ return null;
+ }
+
+ public CDOClassProxy getReferenceTypeProxy()
+ {
+ return null;
+ }
+
+ public CDOType getType()
+ {
+ return null;
+ }
+
+ public boolean isContainment()
+ {
+ return false;
+ }
+
+ public boolean isMany()
+ {
+ return false;
+ }
+
+ public boolean isReference()
+ {
+ return false;
+ }
+
+ public Object getClientInfo()
+ {
+ return null;
+ }
+
+ public String getName()
+ {
+ return null;
+ }
+
+ public CDOPackageManager getPackageManager()
+ {
+ return null;
+ }
+
+ public Object getServerInfo()
+ {
+ return null;
+ }
+
+ public void setClientInfo(Object clientInfo)
+ {
+ }
+
+ public void setServerInfo(Object serverInfo)
+ {
+ }
+
+ @Override
+ public String toString()
+ {
+ return "CONTAINER_FEATURE";
+ }
+ }
+}
diff --git a/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/internal/common/revision/delta/CDOFeatureDeltaImpl.java b/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/internal/common/revision/delta/CDOFeatureDeltaImpl.java
new file mode 100644
index 0000000000..cf02d045b9
--- /dev/null
+++ b/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/internal/common/revision/delta/CDOFeatureDeltaImpl.java
@@ -0,0 +1,87 @@
+/***************************************************************************
+ * Copyright (c) 2004 - 2008 Eike Stepper, Germany.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Simon McDuff - initial API and implementation
+ * Eike Stepper - maintenance
+ **************************************************************************/
+package org.eclipse.emf.cdo.internal.common.revision.delta;
+
+import org.eclipse.emf.cdo.common.id.CDOID;
+import org.eclipse.emf.cdo.common.id.CDOIDProvider;
+import org.eclipse.emf.cdo.common.id.CDOIDTemp;
+import org.eclipse.emf.cdo.common.model.CDOClass;
+import org.eclipse.emf.cdo.common.model.CDOFeature;
+import org.eclipse.emf.cdo.common.revision.delta.CDOFeatureDelta;
+
+import org.eclipse.net4j.util.io.ExtendedDataInput;
+import org.eclipse.net4j.util.io.ExtendedDataOutput;
+
+import java.io.IOException;
+import java.util.Map;
+
+/**
+ * @author Simon McDuff
+ */
+public abstract class CDOFeatureDeltaImpl implements CDOFeatureDelta
+{
+ public static final int NO_INDEX = -1;
+
+ private CDOFeature feature;
+
+ protected CDOFeatureDeltaImpl(CDOFeature feature)
+ {
+ this.feature = feature;
+ }
+
+ public CDOFeatureDeltaImpl(ExtendedDataInput in, CDOClass cdoClass) throws IOException
+ {
+ int featureID = in.readInt();
+ feature = cdoClass.getAllFeatures()[featureID];
+ }
+
+ public CDOFeature getFeature()
+ {
+ return feature;
+ }
+
+ public abstract void adjustReferences(Map<CDOIDTemp, CDOID> idMappings);
+
+ public void write(ExtendedDataOutput out, CDOClass cdoClass, CDOIDProvider idProvider) throws IOException
+ {
+ out.writeInt(getType().ordinal());
+ out.writeInt(cdoClass.getFeatureID(feature));
+ }
+
+ public static CDOFeatureDeltaImpl read(ExtendedDataInput in, CDOClass cdoClass) throws IOException
+ {
+ int typeOrdinal = in.readInt();
+ Type type = Type.values()[typeOrdinal];
+ switch (type)
+ {
+ case ADD:
+ return new CDOAddFeatureDeltaImpl(in, cdoClass);
+ case SET:
+ return new CDOSetFeatureDeltaImpl(in, cdoClass);
+ case LIST:
+ return new CDOListFeatureDeltaImpl(in, cdoClass);
+ case MOVE:
+ return new CDOMoveFeatureDeltaImpl(in, cdoClass);
+ case CLEAR:
+ return new CDOClearFeatureDeltaImpl(in, cdoClass);
+ case REMOVE:
+ return new CDORemoveFeatureDeltaImpl(in, cdoClass);
+ case CONTAINER:
+ return new CDOContainerFeatureDeltaImpl(in, cdoClass);
+ case UNSET:
+ return new CDOUnsetFeatureDeltaImpl(in, cdoClass);
+ default:
+ // TODO Find better exception for signalling errors
+ throw new UnsupportedOperationException("Invalid type " + typeOrdinal);
+ }
+ }
+}
diff --git a/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/internal/common/revision/delta/CDOFeatureDeltaVisitorImpl.java b/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/internal/common/revision/delta/CDOFeatureDeltaVisitorImpl.java
new file mode 100644
index 0000000000..3317bad23b
--- /dev/null
+++ b/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/internal/common/revision/delta/CDOFeatureDeltaVisitorImpl.java
@@ -0,0 +1,69 @@
+/***************************************************************************
+ * Copyright (c) 2004 - 2008 Eike Stepper, Germany.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Simon McDuff - initial API and implementation
+ * Eike Stepper - maintenance
+ **************************************************************************/
+package org.eclipse.emf.cdo.internal.common.revision.delta;
+
+import org.eclipse.emf.cdo.common.revision.delta.CDOAddFeatureDelta;
+import org.eclipse.emf.cdo.common.revision.delta.CDOClearFeatureDelta;
+import org.eclipse.emf.cdo.common.revision.delta.CDOContainerFeatureDelta;
+import org.eclipse.emf.cdo.common.revision.delta.CDOFeatureDelta;
+import org.eclipse.emf.cdo.common.revision.delta.CDOFeatureDeltaVisitor;
+import org.eclipse.emf.cdo.common.revision.delta.CDOListFeatureDelta;
+import org.eclipse.emf.cdo.common.revision.delta.CDOMoveFeatureDelta;
+import org.eclipse.emf.cdo.common.revision.delta.CDORemoveFeatureDelta;
+import org.eclipse.emf.cdo.common.revision.delta.CDOSetFeatureDelta;
+import org.eclipse.emf.cdo.common.revision.delta.CDOUnsetFeatureDelta;
+
+/**
+ * @author Simon McDuff
+ */
+public class CDOFeatureDeltaVisitorImpl implements CDOFeatureDeltaVisitor
+{
+ public CDOFeatureDeltaVisitorImpl()
+ {
+ }
+
+ public void visit(CDOAddFeatureDelta delta)
+ {
+ }
+
+ public void visit(CDOClearFeatureDelta delta)
+ {
+ }
+
+ public void visit(CDOContainerFeatureDelta delta)
+ {
+ }
+
+ public void visit(CDOListFeatureDelta deltas)
+ {
+ for (CDOFeatureDelta delta : deltas.getListChanges())
+ {
+ delta.accept(this);
+ }
+ }
+
+ public void visit(CDOMoveFeatureDelta delta)
+ {
+ }
+
+ public void visit(CDORemoveFeatureDelta delta)
+ {
+ }
+
+ public void visit(CDOSetFeatureDelta delta)
+ {
+ }
+
+ public void visit(CDOUnsetFeatureDelta delta)
+ {
+ }
+}
diff --git a/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/internal/common/revision/delta/CDOListFeatureDeltaImpl.java b/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/internal/common/revision/delta/CDOListFeatureDeltaImpl.java
new file mode 100644
index 0000000000..35cedd3690
--- /dev/null
+++ b/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/internal/common/revision/delta/CDOListFeatureDeltaImpl.java
@@ -0,0 +1,126 @@
+/***************************************************************************
+ * Copyright (c) 2004 - 2008 Eike Stepper, Germany.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Simon McDuff - initial API and implementation
+ * Eike Stepper - maintenance
+ **************************************************************************/
+package org.eclipse.emf.cdo.internal.common.revision.delta;
+
+import org.eclipse.emf.cdo.common.id.CDOID;
+import org.eclipse.emf.cdo.common.id.CDOIDProvider;
+import org.eclipse.emf.cdo.common.id.CDOIDTemp;
+import org.eclipse.emf.cdo.common.model.CDOClass;
+import org.eclipse.emf.cdo.common.model.CDOFeature;
+import org.eclipse.emf.cdo.common.revision.CDORevision;
+import org.eclipse.emf.cdo.common.revision.delta.CDOFeatureDelta;
+import org.eclipse.emf.cdo.common.revision.delta.CDOFeatureDeltaVisitor;
+import org.eclipse.emf.cdo.common.revision.delta.CDOListFeatureDelta;
+
+import org.eclipse.net4j.util.io.ExtendedDataInput;
+import org.eclipse.net4j.util.io.ExtendedDataOutput;
+
+import java.io.IOException;
+import java.util.ArrayList;
+import java.util.List;
+import java.util.Map;
+
+/**
+ * @author Simon McDuff
+ */
+public class CDOListFeatureDeltaImpl extends CDOFeatureDeltaImpl implements CDOListFeatureDelta
+{
+ private List<CDOFeatureDelta> featureDeltas = new ArrayList<CDOFeatureDelta>();
+
+ public CDOListFeatureDeltaImpl(CDOFeature feature)
+ {
+ super(feature);
+ }
+
+ public CDOListFeatureDeltaImpl(ExtendedDataInput in, CDOClass cdoClass) throws IOException
+ {
+ super(in, cdoClass);
+ int size = in.readInt();
+ for (int i = 0; i < size; i++)
+ {
+ featureDeltas.add(CDOFeatureDeltaImpl.read(in, cdoClass));
+ }
+ }
+
+ public Type getType()
+ {
+ return Type.LIST;
+ }
+
+ public List<CDOFeatureDelta> getListChanges()
+ {
+ return featureDeltas;
+ }
+
+ @Override
+ public void write(final ExtendedDataOutput out, CDOClass cdoClass, final CDOIDProvider idProvider) throws IOException
+ {
+ super.write(out, cdoClass, idProvider);
+ out.writeInt(featureDeltas.size());
+ for (CDOFeatureDelta featureDelta : featureDeltas)
+ {
+ ((CDOFeatureDeltaImpl)featureDelta).write(out, cdoClass, idProvider);
+ }
+ }
+
+ /**
+ * Returns the number of indices as the first element of the array.
+ *
+ * @return never <code>null</code>.
+ */
+ public int[] reconstructAddedIndices()
+ {
+ int[] indices = new int[1 + featureDeltas.size()];
+ for (CDOFeatureDelta featureDelta : featureDeltas)
+ {
+ if (featureDelta instanceof IListIndexAffecting)
+ {
+ IListIndexAffecting affecting = (IListIndexAffecting)featureDelta;
+ affecting.affectIndices(indices);
+ }
+
+ if (featureDelta instanceof IListTargetAdding)
+ {
+ indices[++indices[0]] = ((IListTargetAdding)featureDelta).getIndex();
+ }
+ }
+
+ return indices;
+ }
+
+ public void add(CDOFeatureDelta featureDelta)
+ {
+ featureDeltas.add(featureDelta);
+ }
+
+ public void apply(CDORevision revision)
+ {
+ for (CDOFeatureDelta featureDelta : featureDeltas)
+ {
+ ((CDOFeatureDeltaImpl)featureDelta).apply(revision);
+ }
+ }
+
+ @Override
+ public void adjustReferences(Map<CDOIDTemp, CDOID> idMappings)
+ {
+ for (CDOFeatureDelta featureDelta : featureDeltas)
+ {
+ ((CDOFeatureDeltaImpl)featureDelta).adjustReferences(idMappings);
+ }
+ }
+
+ public void accept(CDOFeatureDeltaVisitor visitor)
+ {
+ visitor.visit(this);
+ }
+}
diff --git a/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/internal/common/revision/delta/CDOMoveFeatureDeltaImpl.java b/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/internal/common/revision/delta/CDOMoveFeatureDeltaImpl.java
new file mode 100644
index 0000000000..850249b32c
--- /dev/null
+++ b/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/internal/common/revision/delta/CDOMoveFeatureDeltaImpl.java
@@ -0,0 +1,123 @@
+/***************************************************************************
+ * Copyright (c) 2004 - 2008 Eike Stepper, Germany.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Simon McDuff - initial API and implementation
+ * Eike Stepper - maintenance
+ **************************************************************************/
+package org.eclipse.emf.cdo.internal.common.revision.delta;
+
+import org.eclipse.emf.cdo.common.id.CDOID;
+import org.eclipse.emf.cdo.common.id.CDOIDProvider;
+import org.eclipse.emf.cdo.common.id.CDOIDTemp;
+import org.eclipse.emf.cdo.common.model.CDOClass;
+import org.eclipse.emf.cdo.common.model.CDOFeature;
+import org.eclipse.emf.cdo.common.revision.CDORevision;
+import org.eclipse.emf.cdo.common.revision.delta.CDOFeatureDeltaVisitor;
+import org.eclipse.emf.cdo.common.revision.delta.CDOMoveFeatureDelta;
+import org.eclipse.emf.cdo.spi.common.InternalCDORevision;
+
+import org.eclipse.net4j.util.io.ExtendedDataInput;
+import org.eclipse.net4j.util.io.ExtendedDataOutput;
+
+import java.io.IOException;
+import java.util.Map;
+
+/**
+ * @author Simon McDuff
+ */
+public class CDOMoveFeatureDeltaImpl extends CDOFeatureDeltaImpl implements CDOMoveFeatureDelta, IListIndexAffecting
+{
+ private int oldPosition;
+
+ private int newPosition;
+
+ public CDOMoveFeatureDeltaImpl(CDOFeature feature, int newPosition, int oldPosition)
+ {
+ super(feature);
+ this.newPosition = newPosition;
+ this.oldPosition = oldPosition;
+ }
+
+ public CDOMoveFeatureDeltaImpl(ExtendedDataInput in, CDOClass cdoClass) throws IOException
+ {
+ super(in, cdoClass);
+ newPosition = in.readInt();
+ oldPosition = in.readInt();
+ }
+
+ public int getNewPosition()
+ {
+ return newPosition;
+ }
+
+ public int getOldPosition()
+ {
+ return oldPosition;
+ }
+
+ public Type getType()
+ {
+ return Type.MOVE;
+ }
+
+ public void apply(CDORevision revision)
+ {
+ ((InternalCDORevision)revision).getList(getFeature()).move(newPosition, oldPosition);
+ }
+
+ @Override
+ public void write(ExtendedDataOutput out, CDOClass cdoClass, CDOIDProvider idProvider) throws IOException
+ {
+ super.write(out, cdoClass, idProvider);
+ out.writeInt(newPosition);
+ out.writeInt(oldPosition);
+ }
+
+ public void affectIndices(int[] indices)
+ {
+ if (oldPosition < newPosition)
+ {
+ for (int i = 1; i <= indices[0]; i++)
+ {
+ if (oldPosition < indices[i] && indices[i] <= newPosition)
+ {
+ --indices[i];
+ }
+ else if (indices[i] == oldPosition)
+ {
+ indices[i] = newPosition;
+ }
+ }
+ }
+ else if (newPosition < oldPosition)
+ {
+ for (int i = 1; i <= indices[0]; i++)
+ {
+ if (newPosition <= indices[i] && indices[i] < oldPosition)
+ {
+ ++indices[i];
+ }
+ else if (indices[i] == oldPosition)
+ {
+ indices[i] = newPosition;
+ }
+ }
+ }
+ }
+
+ public void accept(CDOFeatureDeltaVisitor visitor)
+ {
+ visitor.visit(this);
+ }
+
+ @Override
+ public void adjustReferences(Map<CDOIDTemp, CDOID> idMappings)
+ {
+ // Do nothing
+ }
+}
diff --git a/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/internal/common/revision/delta/CDORemoveFeatureDeltaImpl.java b/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/internal/common/revision/delta/CDORemoveFeatureDeltaImpl.java
new file mode 100644
index 0000000000..4e6babfe2c
--- /dev/null
+++ b/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/internal/common/revision/delta/CDORemoveFeatureDeltaImpl.java
@@ -0,0 +1,103 @@
+/***************************************************************************
+ * Copyright (c) 2004 - 2008 Eike Stepper, Germany.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Simon McDuff - initial API and implementation
+ * Eike Stepper - maintenance
+ **************************************************************************/
+package org.eclipse.emf.cdo.internal.common.revision.delta;
+
+import org.eclipse.emf.cdo.common.id.CDOID;
+import org.eclipse.emf.cdo.common.id.CDOIDProvider;
+import org.eclipse.emf.cdo.common.id.CDOIDTemp;
+import org.eclipse.emf.cdo.common.model.CDOClass;
+import org.eclipse.emf.cdo.common.model.CDOFeature;
+import org.eclipse.emf.cdo.common.revision.CDORevision;
+import org.eclipse.emf.cdo.common.revision.delta.CDOFeatureDeltaVisitor;
+import org.eclipse.emf.cdo.common.revision.delta.CDORemoveFeatureDelta;
+import org.eclipse.emf.cdo.spi.common.InternalCDORevision;
+
+import org.eclipse.net4j.util.io.ExtendedDataInput;
+import org.eclipse.net4j.util.io.ExtendedDataOutput;
+
+import java.io.IOException;
+import java.util.Map;
+
+/**
+ * @author Simon McDuff
+ */
+public class CDORemoveFeatureDeltaImpl extends CDOFeatureDeltaImpl implements CDORemoveFeatureDelta,
+ IListIndexAffecting
+{
+ private int index;
+
+ public CDORemoveFeatureDeltaImpl(CDOFeature feature, int index)
+ {
+ super(feature);
+ this.index = index;
+ }
+
+ public CDORemoveFeatureDeltaImpl(ExtendedDataInput in, CDOClass cdoClass) throws IOException
+ {
+ super(in, cdoClass);
+ index = in.readInt();
+ }
+
+ public int getIndex()
+ {
+ return index;
+ }
+
+ public Type getType()
+ {
+ return Type.REMOVE;
+ }
+
+ public void apply(CDORevision revision)
+ {
+ ((InternalCDORevision)revision).getList(getFeature()).remove(index);
+ }
+
+ public void accept(CDOFeatureDeltaVisitor visitor)
+ {
+ visitor.visit(this);
+ }
+
+ @Override
+ public void write(ExtendedDataOutput out, CDOClass cdoClass, CDOIDProvider idProvider) throws IOException
+ {
+ super.write(out, cdoClass, idProvider);
+ out.writeInt(index);
+ }
+
+ public void affectIndices(int[] indices)
+ {
+ int index = getIndex();
+ for (int i = 1; i <= indices[0]; i++)
+ {
+ if (indices[i] > index)
+ {
+ --indices[i];
+ }
+ else if (indices[i] == index)
+ {
+ int rest = indices[0]-- - i;
+ if (rest > 0)
+ {
+ System.arraycopy(indices, i + 1, indices, i, rest);
+ --i;
+ }
+ }
+ }
+ }
+
+ @Override
+ public void adjustReferences(Map<CDOIDTemp, CDOID> idMappings)
+ {
+ // do Nothing
+ }
+}
diff --git a/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/internal/common/revision/delta/CDORevisionDeltaImpl.java b/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/internal/common/revision/delta/CDORevisionDeltaImpl.java
new file mode 100644
index 0000000000..6eb47605a4
--- /dev/null
+++ b/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/internal/common/revision/delta/CDORevisionDeltaImpl.java
@@ -0,0 +1,261 @@
+/***************************************************************************
+ * Copyright (c) 2004 - 2008 Eike Stepper, Germany.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Eike Stepper - initial API and implementation
+ * Simon McDuff - https://bugs.eclipse.org/bugs/show_bug.cgi?id=201266
+ **************************************************************************/
+package org.eclipse.emf.cdo.internal.common.revision.delta;
+
+import org.eclipse.emf.cdo.common.id.CDOID;
+import org.eclipse.emf.cdo.common.id.CDOIDProvider;
+import org.eclipse.emf.cdo.common.id.CDOIDTemp;
+import org.eclipse.emf.cdo.common.id.CDOIDUtil;
+import org.eclipse.emf.cdo.common.model.CDOClass;
+import org.eclipse.emf.cdo.common.model.CDOClassRef;
+import org.eclipse.emf.cdo.common.model.CDOFeature;
+import org.eclipse.emf.cdo.common.model.CDOModelUtil;
+import org.eclipse.emf.cdo.common.model.CDOPackageManager;
+import org.eclipse.emf.cdo.common.revision.CDORevision;
+import org.eclipse.emf.cdo.common.revision.CDORevisionData;
+import org.eclipse.emf.cdo.common.revision.delta.CDOClearFeatureDelta;
+import org.eclipse.emf.cdo.common.revision.delta.CDOFeatureDelta;
+import org.eclipse.emf.cdo.common.revision.delta.CDOFeatureDeltaVisitor;
+import org.eclipse.emf.cdo.spi.common.InternalCDORevision;
+import org.eclipse.emf.cdo.spi.common.InternalCDORevisionDelta;
+
+import org.eclipse.net4j.util.io.ExtendedDataInput;
+import org.eclipse.net4j.util.io.ExtendedDataOutput;
+
+import java.io.IOException;
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+
+/**
+ * @author Eike Stepper
+ */
+public class CDORevisionDeltaImpl implements InternalCDORevisionDelta
+{
+ private CDOID cdoID;
+
+ private CDOClass cdoClass;
+
+ private int dirtyVersion;
+
+ private int originVersion;
+
+ private Map<CDOFeature, CDOFeatureDelta> featureDeltas = new HashMap<CDOFeature, CDOFeatureDelta>();
+
+ public CDORevisionDeltaImpl(CDORevision revision)
+ {
+ cdoID = revision.getID();
+ cdoClass = revision.getCDOClass();
+ dirtyVersion = revision.getVersion();
+ originVersion = dirtyVersion - 1;
+ }
+
+ public CDORevisionDeltaImpl(CDORevision originRevision, CDORevision dirtyRevision)
+ {
+ if (originRevision.getCDOClass() != dirtyRevision.getCDOClass())
+ {
+ throw new IllegalArgumentException();
+ }
+
+ cdoID = originRevision.getID();
+ cdoClass = originRevision.getCDOClass();
+ dirtyVersion = dirtyRevision.getVersion();
+ originVersion = originRevision.getVersion();
+
+ compare(originRevision, dirtyRevision);
+
+ CDORevisionData originData = originRevision.getData();
+ CDORevisionData dirtyData = dirtyRevision.getData();
+ if (!compare(originData.getContainerID(), dirtyData.getContainerID())
+ || !compare(originData.getContainingFeatureID(), dirtyData.getContainingFeatureID()))
+ {
+ addFeatureDelta(new CDOContainerFeatureDeltaImpl(dirtyData.getContainerID(), dirtyData.getContainingFeatureID()));
+ }
+
+ }
+
+ public CDORevisionDeltaImpl(ExtendedDataInput in, CDOPackageManager packageManager) throws IOException
+ {
+ CDOClassRef classRef = CDOModelUtil.readClassRef(in);
+ cdoClass = classRef.resolve(packageManager);
+ cdoID = CDOIDUtil.read(in, packageManager.getCDOIDObjectFactory());
+ originVersion = in.readInt();
+ dirtyVersion = in.readInt();
+ int size = in.readInt();
+ for (int i = 0; i < size; i++)
+ {
+ CDOFeatureDelta featureDelta = CDOFeatureDeltaImpl.read(in, cdoClass);
+ featureDeltas.put(featureDelta.getFeature(), featureDelta);
+ }
+ }
+
+ public void write(ExtendedDataOutput out, CDOIDProvider idProvider) throws IOException
+ {
+ CDOClassRef classRef = cdoClass.createClassRef();
+ CDOModelUtil.writeClassRef(out, classRef);
+ CDOIDUtil.write(out, cdoID);
+ out.writeInt(originVersion);
+ out.writeInt(dirtyVersion);
+ out.writeInt(featureDeltas.size());
+ for (CDOFeatureDelta featureDelta : featureDeltas.values())
+ {
+ ((CDOFeatureDeltaImpl)featureDelta).write(out, cdoClass, idProvider);
+ }
+ }
+
+ public CDOID getID()
+ {
+ return cdoID;
+ }
+
+ public int getOriginVersion()
+ {
+ return originVersion;
+ }
+
+ public int getDirtyVersion()
+ {
+ return dirtyVersion;
+ }
+
+ public List<CDOFeatureDelta> getFeatureDeltas()
+ {
+ return new ArrayList<CDOFeatureDelta>(featureDeltas.values());
+ }
+
+ public void apply(CDORevision revision)
+ {
+ ((InternalCDORevision)revision).setVersion(dirtyVersion);
+ for (CDOFeatureDelta featureDelta : featureDeltas.values())
+ {
+ ((CDOFeatureDeltaImpl)featureDelta).apply(revision);
+ }
+ }
+
+ public void addFeatureDelta(CDOFeatureDelta delta)
+ {
+ CDOFeature feature = delta.getFeature();
+ if (feature.isMany())
+ {
+ CDOListFeatureDeltaImpl lookupDelta = (CDOListFeatureDeltaImpl)featureDeltas.get(feature);
+ if (lookupDelta == null)
+ {
+ lookupDelta = new CDOListFeatureDeltaImpl(feature);
+ featureDeltas.put(lookupDelta.getFeature(), lookupDelta);
+ }
+
+ // Remove all previous changes
+ if (delta instanceof CDOClearFeatureDelta)
+ {
+ lookupDelta.getListChanges().clear();
+ }
+ lookupDelta.add(delta);
+ }
+ else
+ {
+ featureDeltas.put(feature, delta);
+ }
+ }
+
+ public void adjustReferences(Map<CDOIDTemp, CDOID> idMappings)
+ {
+ for (CDOFeatureDelta featureDelta : featureDeltas.values())
+ {
+ ((CDOFeatureDeltaImpl)featureDelta).adjustReferences(idMappings);
+ }
+ }
+
+ public void accept(CDOFeatureDeltaVisitor visitor)
+ {
+ for (CDOFeatureDelta featureDelta : featureDeltas.values())
+ {
+ ((CDOFeatureDeltaImpl)featureDelta).accept(visitor);
+ }
+ }
+
+ private void compare(CDORevision originRevision, CDORevision dirtyRevision)
+ {
+ CDOFeature features[] = cdoClass.getAllFeatures();
+ int count = cdoClass.getFeatureCount();
+ for (int i = 0; i < count; i++)
+ {
+ CDOFeature feature = features[i];
+ if (feature.isMany())
+ {
+ int originSize = originRevision.getData().size(feature);
+ int dirtySize = dirtyRevision.getData().size(feature);
+ if (dirtySize == 0 && originSize > 0)
+ {
+ addFeatureDelta(new CDOClearFeatureDeltaImpl(feature));
+ }
+ else
+ {
+ int originIndex = 0;
+ int dirtyIndex = 0;
+ if (originSize == dirtySize)
+ {
+ for (; originIndex < originSize && dirtyIndex < dirtySize; dirtyIndex++, originIndex++)
+ {
+ Object originValue = originRevision.getData().get(feature, originIndex);
+ Object dirtyValue = dirtyRevision.getData().get(feature, dirtyIndex);
+
+ if (!compare(originValue, dirtyValue))
+ {
+ dirtyIndex = 0;
+ break;
+ }
+ }
+ }
+
+ if (originIndex != originSize || dirtyIndex != dirtySize)
+ {
+ // Not identical
+ // Be very stupid and do the simplest thing.
+ // Clear and add all value;
+ if (originSize > 0)
+ {
+ addFeatureDelta(new CDOClearFeatureDeltaImpl(feature));
+ }
+
+ for (int k = 0; k < dirtySize; k++)
+ {
+ Object dirtyValue = dirtyRevision.getData().get(feature, k);
+ addFeatureDelta(new CDOAddFeatureDeltaImpl(feature, k, dirtyValue));
+ }
+ }
+ }
+ }
+ else
+ {
+ Object originValue = originRevision.getData().get(feature, 0);
+ Object dirtyValue = dirtyRevision.getData().get(feature, 0);
+ if (!compare(originValue, dirtyValue))
+ {
+ if (dirtyValue == null)
+ {
+ addFeatureDelta(new CDOUnsetFeatureDeltaImpl(feature));
+ }
+ else
+ {
+ addFeatureDelta(new CDOSetFeatureDeltaImpl(feature, 0, dirtyValue));
+ }
+ }
+ }
+ }
+ }
+
+ private boolean compare(Object originValue, Object dirtyValue)
+ {
+ return originValue == dirtyValue || originValue != null && dirtyValue != null && originValue.equals(dirtyValue);
+ }
+}
diff --git a/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/internal/common/revision/delta/CDORevisionMerger.java b/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/internal/common/revision/delta/CDORevisionMerger.java
new file mode 100644
index 0000000000..d1300ae653
--- /dev/null
+++ b/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/internal/common/revision/delta/CDORevisionMerger.java
@@ -0,0 +1,84 @@
+/***************************************************************************
+ * Copyright (c) 2004 - 2008 Eike Stepper, Germany.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Simon McDuff - initial API and implementation
+ * Eike Stepper - maintenance
+ **************************************************************************/
+package org.eclipse.emf.cdo.internal.common.revision.delta;
+
+import org.eclipse.emf.cdo.common.revision.delta.CDOAddFeatureDelta;
+import org.eclipse.emf.cdo.common.revision.delta.CDOClearFeatureDelta;
+import org.eclipse.emf.cdo.common.revision.delta.CDOContainerFeatureDelta;
+import org.eclipse.emf.cdo.common.revision.delta.CDOMoveFeatureDelta;
+import org.eclipse.emf.cdo.common.revision.delta.CDORemoveFeatureDelta;
+import org.eclipse.emf.cdo.common.revision.delta.CDORevisionDelta;
+import org.eclipse.emf.cdo.common.revision.delta.CDOSetFeatureDelta;
+import org.eclipse.emf.cdo.common.revision.delta.CDOUnsetFeatureDelta;
+import org.eclipse.emf.cdo.spi.common.InternalCDORevision;
+
+/**
+ * @author Simon McDuff
+ */
+public class CDORevisionMerger extends CDOFeatureDeltaVisitorImpl
+{
+ private InternalCDORevision revision;
+
+ public CDORevisionMerger()
+ {
+ }
+
+ public void merge(InternalCDORevision revision, CDORevisionDelta delta)
+ {
+ this.revision = revision;
+ delta.accept(this);
+ revision = null;
+ }
+
+ @Override
+ public void visit(CDOMoveFeatureDelta delta)
+ {
+ revision.move(delta.getFeature(), delta.getOldPosition(), delta.getNewPosition());
+ }
+
+ @Override
+ public void visit(CDOAddFeatureDelta delta)
+ {
+ revision.add(delta.getFeature(), delta.getIndex(), delta.getValue());
+ }
+
+ @Override
+ public void visit(CDORemoveFeatureDelta delta)
+ {
+ revision.remove(delta.getFeature(), delta.getIndex());
+ }
+
+ @Override
+ public void visit(CDOSetFeatureDelta delta)
+ {
+ revision.set(delta.getFeature(), delta.getIndex(), delta.getValue());
+ }
+
+ @Override
+ public void visit(CDOUnsetFeatureDelta delta)
+ {
+ revision.unset(delta.getFeature());
+ }
+
+ @Override
+ public void visit(CDOClearFeatureDelta delta)
+ {
+ revision.clear(delta.getFeature());
+ }
+
+ @Override
+ public void visit(CDOContainerFeatureDelta delta)
+ {
+ revision.setContainerID(delta.getContainerID());
+ revision.setContainingFeatureID(delta.getContainerFeatureID());
+ }
+}
diff --git a/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/internal/common/revision/delta/CDOSetFeatureDeltaImpl.java b/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/internal/common/revision/delta/CDOSetFeatureDeltaImpl.java
new file mode 100644
index 0000000000..44fdfe6b9c
--- /dev/null
+++ b/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/internal/common/revision/delta/CDOSetFeatureDeltaImpl.java
@@ -0,0 +1,55 @@
+/***************************************************************************
+ * Copyright (c) 2004 - 2008 Eike Stepper, Germany.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Simon McDuff - initial API and implementation
+ * Eike Stepper - maintenance
+ **************************************************************************/
+package org.eclipse.emf.cdo.internal.common.revision.delta;
+
+import org.eclipse.emf.cdo.common.model.CDOClass;
+import org.eclipse.emf.cdo.common.model.CDOFeature;
+import org.eclipse.emf.cdo.common.revision.CDORevision;
+import org.eclipse.emf.cdo.common.revision.delta.CDOFeatureDeltaVisitor;
+import org.eclipse.emf.cdo.common.revision.delta.CDOSetFeatureDelta;
+import org.eclipse.emf.cdo.spi.common.InternalCDORevision;
+
+import org.eclipse.net4j.util.io.ExtendedDataInput;
+
+import java.io.IOException;
+
+/**
+ * @author Simon McDuff
+ */
+public class CDOSetFeatureDeltaImpl extends CDOSingleValueFeatureDeltaImpl implements CDOSetFeatureDelta,
+ IListTargetAdding
+{
+ public CDOSetFeatureDeltaImpl(CDOFeature feature, int index, Object value)
+ {
+ super(feature, index, value);
+ }
+
+ public CDOSetFeatureDeltaImpl(ExtendedDataInput in, CDOClass cdoClass) throws IOException
+ {
+ super(in, cdoClass);
+ }
+
+ public Type getType()
+ {
+ return Type.SET;
+ }
+
+ public void apply(CDORevision revision)
+ {
+ ((InternalCDORevision)revision).set(getFeature(), getIndex(), getValue());
+ }
+
+ public void accept(CDOFeatureDeltaVisitor visitor)
+ {
+ visitor.visit(this);
+ }
+}
diff --git a/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/internal/common/revision/delta/CDOSingleValueFeatureDeltaImpl.java b/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/internal/common/revision/delta/CDOSingleValueFeatureDeltaImpl.java
new file mode 100644
index 0000000000..741d76b8e6
--- /dev/null
+++ b/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/internal/common/revision/delta/CDOSingleValueFeatureDeltaImpl.java
@@ -0,0 +1,82 @@
+/***************************************************************************
+ * Copyright (c) 2004 - 2008 Eike Stepper, Germany.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Simon McDuff - initial API and implementation
+ * Eike Stepper - maintenance
+ **************************************************************************/
+package org.eclipse.emf.cdo.internal.common.revision.delta;
+
+import org.eclipse.emf.cdo.common.id.CDOID;
+import org.eclipse.emf.cdo.common.id.CDOIDProvider;
+import org.eclipse.emf.cdo.common.id.CDOIDTemp;
+import org.eclipse.emf.cdo.common.model.CDOClass;
+import org.eclipse.emf.cdo.common.model.CDOFeature;
+import org.eclipse.emf.cdo.common.revision.CDORevisionUtil;
+import org.eclipse.emf.cdo.common.revision.delta.CDOFeatureDelta;
+
+import org.eclipse.net4j.util.io.ExtendedDataInput;
+import org.eclipse.net4j.util.io.ExtendedDataOutput;
+
+import java.io.IOException;
+import java.util.Map;
+
+/**
+ * @author Simon McDuff
+ */
+public abstract class CDOSingleValueFeatureDeltaImpl extends CDOFeatureDeltaImpl implements CDOFeatureDelta
+{
+ private int index;
+
+ private Object newValue;
+
+ public CDOSingleValueFeatureDeltaImpl(CDOFeature feature, int index, Object value)
+ {
+ super(feature);
+ this.index = index;
+ newValue = value;
+ }
+
+ public CDOSingleValueFeatureDeltaImpl(ExtendedDataInput in, CDOClass cdoClass) throws IOException
+ {
+ super(in, cdoClass);
+ index = in.readInt();
+ newValue = getFeature().getType().readValue(in, cdoClass.getPackageManager().getCDOIDObjectFactory());
+ }
+
+ public int getIndex()
+ {
+ return index;
+ }
+
+ public Object getValue()
+ {
+ return newValue;
+ }
+
+ @Override
+ public void write(ExtendedDataOutput out, CDOClass cdoClass, CDOIDProvider idProvider) throws IOException
+ {
+ super.write(out, cdoClass, idProvider);
+ out.writeInt(index);
+ if (newValue != null && getFeature().isReference())
+ {
+ newValue = idProvider.provideCDOID(newValue);
+ }
+
+ getFeature().getType().writeValue(out, newValue);
+ }
+
+ @Override
+ public void adjustReferences(Map<CDOIDTemp, CDOID> idMappings)
+ {
+ if (newValue instanceof CDOID)
+ {
+ newValue = CDORevisionUtil.remapID(newValue, idMappings);
+ }
+ }
+}
diff --git a/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/internal/common/revision/delta/CDOUnsetFeatureDeltaImpl.java b/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/internal/common/revision/delta/CDOUnsetFeatureDeltaImpl.java
new file mode 100644
index 0000000000..235c999c96
--- /dev/null
+++ b/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/internal/common/revision/delta/CDOUnsetFeatureDeltaImpl.java
@@ -0,0 +1,63 @@
+/***************************************************************************
+ * Copyright (c) 2004 - 2008 Eike Stepper, Germany.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Simon McDuff - initial API and implementation
+ * Eike Stepper - maintenance
+ **************************************************************************/
+package org.eclipse.emf.cdo.internal.common.revision.delta;
+
+import org.eclipse.emf.cdo.common.id.CDOID;
+import org.eclipse.emf.cdo.common.id.CDOIDTemp;
+import org.eclipse.emf.cdo.common.model.CDOClass;
+import org.eclipse.emf.cdo.common.model.CDOFeature;
+import org.eclipse.emf.cdo.common.revision.CDORevision;
+import org.eclipse.emf.cdo.common.revision.delta.CDOFeatureDeltaVisitor;
+import org.eclipse.emf.cdo.common.revision.delta.CDOUnsetFeatureDelta;
+import org.eclipse.emf.cdo.spi.common.InternalCDORevision;
+
+import org.eclipse.net4j.util.io.ExtendedDataInput;
+
+import java.io.IOException;
+import java.util.Map;
+
+/**
+ * @author Simon McDuff
+ */
+public class CDOUnsetFeatureDeltaImpl extends CDOFeatureDeltaImpl implements CDOUnsetFeatureDelta
+{
+ public CDOUnsetFeatureDeltaImpl(CDOFeature feature)
+ {
+ super(feature);
+ }
+
+ public CDOUnsetFeatureDeltaImpl(ExtendedDataInput in, CDOClass cdoClass) throws IOException
+ {
+ super(in, cdoClass);
+ }
+
+ public Type getType()
+ {
+ return Type.UNSET;
+ }
+
+ public void apply(CDORevision revision)
+ {
+ ((InternalCDORevision)revision).unset(getFeature());
+ }
+
+ public void accept(CDOFeatureDeltaVisitor visitor)
+ {
+ visitor.visit(this);
+ }
+
+ @Override
+ public void adjustReferences(Map<CDOIDTemp, CDOID> idMappings)
+ {
+ // Do nothing
+ }
+}
diff --git a/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/internal/common/revision/delta/IListIndexAffecting.java b/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/internal/common/revision/delta/IListIndexAffecting.java
new file mode 100644
index 0000000000..9ccaeeeb41
--- /dev/null
+++ b/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/internal/common/revision/delta/IListIndexAffecting.java
@@ -0,0 +1,22 @@
+/***************************************************************************
+ * Copyright (c) 2004 - 2008 Eike Stepper, Germany.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Eike Stepper - initial API and implementation
+ **************************************************************************/
+package org.eclipse.emf.cdo.internal.common.revision.delta;
+
+/**
+ * @author Eike Stepper
+ */
+public interface IListIndexAffecting
+{
+ /**
+ * Expects the number of indices in the first element of the indices array.
+ */
+ public void affectIndices(int[] indices);
+}
diff --git a/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/internal/common/revision/delta/IListTargetAdding.java b/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/internal/common/revision/delta/IListTargetAdding.java
new file mode 100644
index 0000000000..7fa52d0cd5
--- /dev/null
+++ b/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/internal/common/revision/delta/IListTargetAdding.java
@@ -0,0 +1,19 @@
+/***************************************************************************
+ * Copyright (c) 2004 - 2008 Eike Stepper, Germany.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Eike Stepper - initial API and implementation
+ **************************************************************************/
+package org.eclipse.emf.cdo.internal.common.revision.delta;
+
+/**
+ * @author Eike Stepper
+ */
+public interface IListTargetAdding
+{
+ public int getIndex();
+}
diff --git a/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/spi/common/AbstractCDOID.java b/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/spi/common/AbstractCDOID.java
new file mode 100644
index 0000000000..b4d9a5594e
--- /dev/null
+++ b/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/spi/common/AbstractCDOID.java
@@ -0,0 +1,94 @@
+/***************************************************************************
+ * Copyright (c) 2004 - 2008 Eike Stepper, Germany.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Eike Stepper - initial API and implementation
+ **************************************************************************/
+package org.eclipse.emf.cdo.spi.common;
+
+import org.eclipse.emf.cdo.common.id.CDOID;
+
+/**
+ * @author Eike Stepper
+ */
+public abstract class AbstractCDOID implements CDOID
+{
+ private static final long serialVersionUID = 1L;
+
+ public AbstractCDOID()
+ {
+ }
+
+ public boolean isNull()
+ {
+ switch (getType())
+ {
+ case NULL:
+ return true;
+ default:
+ return false;
+ }
+ }
+
+ public boolean isObject()
+ {
+ switch (getType())
+ {
+ case OBJECT:
+ case LEGACY_OBJECT:
+ case TEMP_OBJECT:
+ return true;
+ default:
+ return false;
+ }
+ }
+
+ public boolean isLegacy()
+ {
+ switch (getType())
+ {
+ case LEGACY_OBJECT:
+ return true;
+ default:
+ return false;
+ }
+ }
+
+ public boolean isMeta()
+ {
+ switch (getType())
+ {
+ case META:
+ case TEMP_META:
+ return true;
+ default:
+ return false;
+ }
+ }
+
+ public boolean isTemporary()
+ {
+ switch (getType())
+ {
+ case TEMP_OBJECT:
+ case TEMP_META:
+ return true;
+ default:
+ return false;
+ }
+ }
+
+ // public CDOClassRef getClassRef()
+ // {
+ // return null;
+ // }
+ //
+ // public CDOID asLegacy(CDOClassRef classRef)
+ // {
+ // throw new UnsupportedOperationException();
+ // }
+}
diff --git a/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/spi/common/AbstractCDOIDInteger.java b/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/spi/common/AbstractCDOIDInteger.java
new file mode 100644
index 0000000000..e06304e8d2
--- /dev/null
+++ b/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/spi/common/AbstractCDOIDInteger.java
@@ -0,0 +1,99 @@
+/***************************************************************************
+ * Copyright (c) 2004 - 2008 Eike Stepper, Germany.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Eike Stepper - initial API and implementation
+ **************************************************************************/
+package org.eclipse.emf.cdo.spi.common;
+
+import org.eclipse.net4j.util.io.ExtendedDataInput;
+import org.eclipse.net4j.util.io.ExtendedDataOutput;
+
+import java.io.IOException;
+
+/**
+ * @author Eike Stepper
+ */
+public abstract class AbstractCDOIDInteger extends AbstractCDOID implements Comparable<AbstractCDOIDInteger>
+{
+ private static final long serialVersionUID = 1L;
+
+ private int value;
+
+ public AbstractCDOIDInteger()
+ {
+ }
+
+ public AbstractCDOIDInteger(int value)
+ {
+ if (value == 0)
+ {
+ throw new IllegalArgumentException("value == 0");
+ }
+
+ this.value = value;
+ }
+
+ public int getIntValue()
+ {
+ return value;
+ }
+
+ public void read(ExtendedDataInput in) throws IOException
+ {
+ value = in.readInt();
+ }
+
+ public void write(ExtendedDataOutput out) throws IOException
+ {
+ out.writeInt(value);
+ }
+
+ public int compareTo(AbstractCDOIDInteger that)
+ {
+ if (value < that.value)
+ {
+ return -1;
+ }
+
+ if (value > that.value)
+ {
+ return 1;
+ }
+
+ return 0;
+ }
+
+ @Override
+ public boolean equals(Object obj)
+ {
+ if (obj == this)
+ {
+ return true;
+ }
+
+ if (obj != null && obj.getClass() == getClass())
+ {
+ AbstractCDOIDInteger that = (AbstractCDOIDInteger)obj;
+ return value == that.value;
+ }
+
+ return false;
+ }
+
+ @Override
+ public int hashCode()
+ {
+ return getClass().hashCode() ^ value;
+ }
+
+ @Override
+ public String toString()
+ {
+ return String.valueOf(value);
+ }
+}
diff --git a/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/spi/common/AbstractCDOIDLong.java b/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/spi/common/AbstractCDOIDLong.java
new file mode 100644
index 0000000000..1b452fbef4
--- /dev/null
+++ b/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/spi/common/AbstractCDOIDLong.java
@@ -0,0 +1,100 @@
+/***************************************************************************
+ * Copyright (c) 2004 - 2008 Eike Stepper, Germany.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Eike Stepper - initial API and implementation
+ **************************************************************************/
+package org.eclipse.emf.cdo.spi.common;
+
+import org.eclipse.net4j.util.ObjectUtil;
+import org.eclipse.net4j.util.io.ExtendedDataInput;
+import org.eclipse.net4j.util.io.ExtendedDataOutput;
+
+import java.io.IOException;
+
+/**
+ * @author Eike Stepper
+ */
+public abstract class AbstractCDOIDLong extends AbstractCDOID implements Comparable<AbstractCDOIDLong>
+{
+ private static final long serialVersionUID = 1L;
+
+ private long value;
+
+ public AbstractCDOIDLong()
+ {
+ }
+
+ public AbstractCDOIDLong(long value)
+ {
+ if (value == 0L)
+ {
+ throw new IllegalArgumentException("value == 0L");
+ }
+
+ this.value = value;
+ }
+
+ public long getLongValue()
+ {
+ return value;
+ }
+
+ public void read(ExtendedDataInput in) throws IOException
+ {
+ value = in.readLong();
+ }
+
+ public void write(ExtendedDataOutput out) throws IOException
+ {
+ out.writeLong(value);
+ }
+
+ public int compareTo(AbstractCDOIDLong that)
+ {
+ if (value < that.value)
+ {
+ return -1;
+ }
+
+ if (value > that.value)
+ {
+ return 1;
+ }
+
+ return 0;
+ }
+
+ @Override
+ public boolean equals(Object obj)
+ {
+ if (obj == this)
+ {
+ return true;
+ }
+
+ if (obj != null && obj.getClass() == getClass())
+ {
+ AbstractCDOIDLong that = (AbstractCDOIDLong)obj;
+ return value == that.value;
+ }
+
+ return false;
+ }
+
+ @Override
+ public int hashCode()
+ {
+ return getClass().hashCode() ^ ObjectUtil.hashCode(value);
+ }
+
+ @Override
+ public String toString()
+ {
+ return String.valueOf(value);
+ }
+}
diff --git a/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/spi/common/CDOIDLibraryDescriptorImpl.java b/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/spi/common/CDOIDLibraryDescriptorImpl.java
new file mode 100644
index 0000000000..7c73f792b9
--- /dev/null
+++ b/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/spi/common/CDOIDLibraryDescriptorImpl.java
@@ -0,0 +1,123 @@
+/***************************************************************************
+ * Copyright (c) 2004 - 2008 Eike Stepper, Germany.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Eike Stepper - initial API and implementation
+ **************************************************************************/
+package org.eclipse.emf.cdo.spi.common;
+
+import org.eclipse.emf.cdo.common.id.CDOIDLibraryDescriptor;
+import org.eclipse.emf.cdo.internal.common.bundle.OM;
+
+import org.eclipse.net4j.util.io.ExtendedDataInput;
+import org.eclipse.net4j.util.io.ExtendedDataOutput;
+import org.eclipse.net4j.util.om.trace.ContextTracer;
+
+import java.io.IOException;
+
+/**
+ * @author Eike Stepper
+ */
+public class CDOIDLibraryDescriptorImpl implements CDOIDLibraryDescriptor
+{
+ private static final ContextTracer PROTOCOL = new ContextTracer(OM.DEBUG_PROTOCOL, CDOIDLibraryDescriptorImpl.class);
+
+ private String factoryName;
+
+ private String[] libraryNames;
+
+ public CDOIDLibraryDescriptorImpl(String factoryName, String[] libraryNames)
+ {
+ this.factoryName = factoryName;
+ this.libraryNames = libraryNames == null ? new String[0] : libraryNames;
+ }
+
+ public CDOIDLibraryDescriptorImpl(ExtendedDataInput in) throws IOException
+ {
+ factoryName = in.readString();
+ if (PROTOCOL.isEnabled())
+ {
+ PROTOCOL.format("Read factory name: {0}", factoryName);
+ }
+
+ int size = in.readInt();
+ if (PROTOCOL.isEnabled())
+ {
+ PROTOCOL.format("Reading {0} library names", size);
+ }
+
+ libraryNames = new String[size];
+ for (int i = 0; i < size; i++)
+ {
+ libraryNames[i] = in.readString();
+ if (PROTOCOL.isEnabled())
+ {
+ PROTOCOL.format("Read library name: {0}", libraryNames[i]);
+ }
+ }
+ }
+
+ public String getFactoryName()
+ {
+ return factoryName;
+ }
+
+ public String[] getLibraryNames()
+ {
+ return libraryNames;
+ }
+
+ public void write(ExtendedDataOutput out) throws IOException
+ {
+ if (PROTOCOL.isEnabled())
+ {
+ PROTOCOL.format("Writing factory name: {0}", factoryName);
+ }
+
+ out.writeString(factoryName);
+ if (PROTOCOL.isEnabled())
+ {
+ PROTOCOL.format("Writing {0} library names", libraryNames.length);
+ }
+
+ out.writeInt(libraryNames.length);
+ for (String libraryName : libraryNames)
+ {
+ if (PROTOCOL.isEnabled())
+ {
+ PROTOCOL.format("Writing library name: {0}", libraryName);
+ }
+
+ out.writeString(libraryName);
+ }
+ }
+
+ @Override
+ public String toString()
+ {
+ StringBuilder builder = new StringBuilder();
+ builder.append(getClass().getSimpleName());
+ builder.append("[");
+ builder.append(factoryName);
+ if (libraryNames.length != 0)
+ {
+ builder.append(" -> ");
+ for (int i = 0; i < libraryNames.length; i++)
+ {
+ if (i != 0)
+ {
+ builder.append(", ");
+ }
+
+ builder.append(libraryNames[i]);
+ }
+ }
+
+ builder.append("]");
+ return builder.toString();
+ }
+}
diff --git a/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/spi/common/CDOIDLibraryProviderImpl.java b/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/spi/common/CDOIDLibraryProviderImpl.java
new file mode 100644
index 0000000000..1e5ac72318
--- /dev/null
+++ b/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/spi/common/CDOIDLibraryProviderImpl.java
@@ -0,0 +1,95 @@
+package org.eclipse.emf.cdo.spi.common;
+
+import org.eclipse.emf.cdo.common.id.CDOIDLibraryDescriptor;
+import org.eclipse.emf.cdo.common.id.CDOIDLibraryProvider;
+
+import org.eclipse.net4j.util.io.ExtendedDataInput;
+import org.eclipse.net4j.util.io.IOUtil;
+import org.eclipse.net4j.util.om.OMBundle;
+
+import java.io.File;
+import java.io.IOException;
+import java.io.InputStream;
+import java.net.URL;
+import java.util.HashMap;
+import java.util.Map;
+import java.util.Set;
+
+/**
+ * @author Eike Stepper
+ */
+public class CDOIDLibraryProviderImpl implements CDOIDLibraryProvider
+{
+ private Map<String, OMBundle> bundles = new HashMap<String, OMBundle>();
+
+ public CDOIDLibraryProviderImpl()
+ {
+ }
+
+ public void addLibrary(String libraryName, OMBundle bundle)
+ {
+ bundles.put(libraryName, bundle);
+ }
+
+ public String[] getLibraryNames()
+ {
+ Set<String> libraryNames = bundles.keySet();
+ return libraryNames.toArray(new String[libraryNames.size()]);
+ }
+
+ public CDOIDLibraryDescriptor createDescriptor(String factoryName)
+ {
+ return new Descriptor(factoryName);
+ }
+
+ public InputStream getContents(String libraryName) throws IOException
+ {
+ File library = getLibrary(libraryName);
+ return IOUtil.openInputStream(library);
+ }
+
+ public int getSize(String libraryName)
+ {
+ File library = getLibrary(libraryName);
+ return (int)library.length();
+ }
+
+ private File getLibrary(String libraryName)
+ {
+ OMBundle bundle = bundles.get(libraryName);
+ if (bundle == null)
+ {
+ throw new IllegalStateException("Unknown library: " + libraryName);
+ }
+
+ URL url = bundle.getBaseURL();
+ File file = new File(url.getFile());
+ if (file.exists() && file.isDirectory())
+ {
+ file = new File(file, libraryName);
+ }
+
+ if (file.exists() && file.isFile() && file.getName().endsWith(".jar"))
+ {
+ return file;
+ }
+
+ throw new IllegalStateException("Not a JAR: " + file.getAbsolutePath());
+ }
+
+ /**
+ * @author Eike Stepper
+ */
+ private final class Descriptor extends CDOIDLibraryDescriptorImpl
+ {
+ public Descriptor(String factoryName)
+ {
+ super(factoryName, CDOIDLibraryProviderImpl.this.getLibraryNames());
+ }
+
+ public Descriptor(ExtendedDataInput in) throws IOException
+ {
+ super(in);
+ }
+ }
+}
diff --git a/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/spi/common/CDOIDLongFactoryImpl.java b/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/spi/common/CDOIDLongFactoryImpl.java
new file mode 100644
index 0000000000..216bba9c59
--- /dev/null
+++ b/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/spi/common/CDOIDLongFactoryImpl.java
@@ -0,0 +1,63 @@
+/***************************************************************************
+ * Copyright (c) 2004 - 2008 Eike Stepper, Germany.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Eike Stepper - initial API and implementation
+ **************************************************************************/
+package org.eclipse.emf.cdo.spi.common;
+
+import org.eclipse.emf.cdo.common.id.CDOIDLibraryProvider;
+import org.eclipse.emf.cdo.common.id.CDOIDObject;
+import org.eclipse.emf.cdo.common.id.CDOIDObjectFactory;
+
+import org.eclipse.net4j.util.io.ExtendedDataInput;
+
+import java.io.IOException;
+import java.io.InputStream;
+
+/**
+ * @author Eike Stepper
+ */
+public class CDOIDLongFactoryImpl implements CDOIDObjectFactory
+{
+ private LibraryHandler LIBRARY_HANDLER = new LibraryHandler();
+
+ public CDOIDLongFactoryImpl()
+ {
+ }
+
+ public CDOIDObject createCDOIDObject(ExtendedDataInput in)
+ {
+ return new CDOIDLongImpl();
+ }
+
+ public LibraryHandler getLibraryHandler()
+ {
+ return LIBRARY_HANDLER;
+ }
+
+ /**
+ * @author Eike Stepper
+ */
+ public static final class LibraryHandler extends CDOIDLibraryDescriptorImpl implements CDOIDLibraryProvider
+ {
+ private LibraryHandler()
+ {
+ super(CDOIDLongFactoryImpl.class.getName(), null);
+ }
+
+ public int getSize(String libraryName)
+ {
+ throw new UnsupportedOperationException();
+ }
+
+ public InputStream getContents(String libraryName) throws IOException
+ {
+ throw new UnsupportedOperationException();
+ }
+ }
+}
diff --git a/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/spi/common/CDOIDLongImpl.java b/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/spi/common/CDOIDLongImpl.java
new file mode 100644
index 0000000000..f8bd460685
--- /dev/null
+++ b/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/spi/common/CDOIDLongImpl.java
@@ -0,0 +1,106 @@
+/***************************************************************************
+ * Copyright (c) 2004 - 2008 Eike Stepper, Germany.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Eike Stepper - initial API and implementation
+ **************************************************************************/
+package org.eclipse.emf.cdo.spi.common;
+
+import org.eclipse.emf.cdo.common.id.CDOIDObject;
+import org.eclipse.emf.cdo.common.model.CDOClassRef;
+
+/**
+ * @author Eike Stepper
+ */
+public class CDOIDLongImpl extends AbstractCDOIDLong implements CDOIDObject
+{
+ private static final long serialVersionUID = 1L;
+
+ public CDOIDLongImpl()
+ {
+ }
+
+ public CDOIDLongImpl(long value)
+ {
+ super(value);
+ }
+
+ public Type getType()
+ {
+ return Type.OBJECT;
+ }
+
+ public CDOClassRef getClassRef()
+ {
+ return null;
+ }
+
+ public Legacy asLegacy(CDOClassRef classRef)
+ {
+ return new Legacy(getLongValue(), classRef);
+ }
+
+ @Override
+ public String toString()
+ {
+ return "OID" + getLongValue();
+ }
+
+ /**
+ * @author Eike Stepper
+ */
+ public static final class Legacy extends CDOIDLongImpl
+ {
+ private static final long serialVersionUID = 1L;
+
+ private CDOClassRef classRef;
+
+ public Legacy()
+ {
+ }
+
+ public Legacy(long value, CDOClassRef classRef)
+ {
+ super(value);
+ if (classRef == null)
+ {
+ throw new IllegalArgumentException("classRef == null");
+ }
+
+ this.classRef = classRef;
+ }
+
+ @Override
+ public Type getType()
+ {
+ return Type.LEGACY_OBJECT;
+ }
+
+ @Override
+ public CDOClassRef getClassRef()
+ {
+ return classRef;
+ }
+
+ public void setClassRef(CDOClassRef classRef)
+ {
+ this.classRef = classRef;
+ }
+
+ @Override
+ public Legacy asLegacy(CDOClassRef classRef)
+ {
+ return this;
+ }
+
+ @Override
+ public String toString()
+ {
+ return super.toString() + "(" + classRef + ")";
+ }
+ }
+}
diff --git a/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/spi/common/InternalCDOClass.java b/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/spi/common/InternalCDOClass.java
new file mode 100644
index 0000000000..b564a5262d
--- /dev/null
+++ b/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/spi/common/InternalCDOClass.java
@@ -0,0 +1,35 @@
+/***************************************************************************
+ * Copyright (c) 2004 - 2008 Eike Stepper, Germany.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Eike Stepper - initial API and implementation
+ **************************************************************************/
+package org.eclipse.emf.cdo.spi.common;
+
+import org.eclipse.emf.cdo.common.model.CDOClass;
+import org.eclipse.emf.cdo.common.model.CDOClassProxy;
+import org.eclipse.emf.cdo.common.model.CDOClassRef;
+import org.eclipse.emf.cdo.common.model.CDOFeature;
+import org.eclipse.emf.cdo.common.model.CDOPackage;
+
+import java.util.List;
+
+/**
+ * @author Eike Stepper
+ */
+public interface InternalCDOClass extends CDOClass, InternalCDOModelElement
+{
+ public void setContainingPackage(CDOPackage containingPackage);
+
+ public void addSuperType(CDOClassRef classRef);
+
+ public void addFeature(CDOFeature cdoFeature);
+
+ public int getFeatureIndex(int featureID);
+
+ public List<CDOClassProxy> getSuperTypeProxies();
+}
diff --git a/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/spi/common/InternalCDOFeature.java b/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/spi/common/InternalCDOFeature.java
new file mode 100644
index 0000000000..ba48483614
--- /dev/null
+++ b/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/spi/common/InternalCDOFeature.java
@@ -0,0 +1,33 @@
+/***************************************************************************
+ * Copyright (c) 2004 - 2008 Eike Stepper, Germany.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Eike Stepper - initial API and implementation
+ **************************************************************************/
+package org.eclipse.emf.cdo.spi.common;
+
+import org.eclipse.emf.cdo.common.model.CDOClass;
+import org.eclipse.emf.cdo.common.model.CDOClassProxy;
+import org.eclipse.emf.cdo.common.model.CDOClassRef;
+import org.eclipse.emf.cdo.common.model.CDOFeature;
+
+/**
+ * @author Eike Stepper
+ */
+public interface InternalCDOFeature extends CDOFeature, InternalCDOModelElement
+{
+ public CDOClassProxy getReferenceTypeProxy();
+
+ public void setContainingClass(CDOClass containingClass);
+
+ public void setFeatureIndex(int featureIndex);
+
+ public void setReferenceType(CDOClassRef cdoClassRef);
+
+ @Deprecated
+ public void setReferenceType(CDOClass cdoClass);
+}
diff --git a/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/spi/common/InternalCDOModelElement.java b/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/spi/common/InternalCDOModelElement.java
new file mode 100644
index 0000000000..3e2ddced61
--- /dev/null
+++ b/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/spi/common/InternalCDOModelElement.java
@@ -0,0 +1,36 @@
+/***************************************************************************
+ * Copyright (c) 2004 - 2008 Eike Stepper, Germany.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Eike Stepper - initial API and implementation
+ **************************************************************************/
+package org.eclipse.emf.cdo.spi.common;
+
+import org.eclipse.emf.cdo.common.model.CDOModelElement;
+
+import org.eclipse.net4j.util.io.ExtendedDataInput;
+import org.eclipse.net4j.util.io.ExtendedDataOutput;
+
+import java.io.IOException;
+
+/**
+ * @author Eike Stepper
+ */
+public interface InternalCDOModelElement extends CDOModelElement
+{
+ public void setName(String name);
+
+ public void setClientInfo(Object clientInfo);
+
+ public void setServerInfo(Object serverInfo);
+
+ public void initialize();
+
+ public void read(ExtendedDataInput in) throws IOException;
+
+ public void write(ExtendedDataOutput out) throws IOException;
+}
diff --git a/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/spi/common/InternalCDOPackage.java b/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/spi/common/InternalCDOPackage.java
new file mode 100644
index 0000000000..d7b8402f67
--- /dev/null
+++ b/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/spi/common/InternalCDOPackage.java
@@ -0,0 +1,36 @@
+/***************************************************************************
+ * Copyright (c) 2004 - 2008 Eike Stepper, Germany.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Eike Stepper - initial API and implementation
+ **************************************************************************/
+package org.eclipse.emf.cdo.spi.common;
+
+import org.eclipse.emf.cdo.common.id.CDOIDMetaRange;
+import org.eclipse.emf.cdo.common.model.CDOClass;
+import org.eclipse.emf.cdo.common.model.CDOPackage;
+import org.eclipse.emf.cdo.common.model.CDOPackageManager;
+
+import java.util.List;
+
+/**
+ * @author Eike Stepper
+ */
+public interface InternalCDOPackage extends CDOPackage, InternalCDOModelElement
+{
+ public void setPackageManager(CDOPackageManager packageManager);
+
+ public void setPersistent(boolean persistent);
+
+ public void setMetaIDRange(CDOIDMetaRange metaIDRange);
+
+ public void setEcore(String ecore);
+
+ public void addClass(CDOClass cdoClass);
+
+ public void setClasses(List<CDOClass> classes);
+}
diff --git a/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/spi/common/InternalCDORevision.java b/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/spi/common/InternalCDORevision.java
new file mode 100644
index 0000000000..0c128acee1
--- /dev/null
+++ b/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/spi/common/InternalCDORevision.java
@@ -0,0 +1,72 @@
+/***************************************************************************
+ * Copyright (c) 2004 - 2008 Eike Stepper, Germany.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Eike Stepper - initial API and implementation
+ **************************************************************************/
+package org.eclipse.emf.cdo.spi.common;
+
+import org.eclipse.emf.cdo.common.id.CDOID;
+import org.eclipse.emf.cdo.common.id.CDOIDTemp;
+import org.eclipse.emf.cdo.common.model.CDOFeature;
+import org.eclipse.emf.cdo.common.revision.CDORevision;
+import org.eclipse.emf.cdo.common.revision.CDORevisionData;
+import org.eclipse.emf.cdo.common.revision.CDORevisionUtil;
+
+import org.eclipse.net4j.util.collection.MoveableList;
+
+import java.util.Map;
+
+/**
+ * @author Eike Stepper
+ */
+public interface InternalCDORevision extends CDORevision, CDORevisionData
+{
+ public static final Object UNINITIALIZED = CDORevisionUtil.UNINITIALIZED;
+
+ public void setID(CDOID id);
+
+ public void setVersion(int version);
+
+ public int setTransactional();
+
+ public void setUntransactional();
+
+ public void setCreated(long created);
+
+ public void setRevised(long revised);
+
+ public void setResourceID(CDOID resourceID);
+
+ public void setContainerID(CDOID containerID);
+
+ public void setContainingFeatureID(int containingFeatureID);
+
+ public void add(CDOFeature feature, int index, Object value);
+
+ public void clear(CDOFeature feature);
+
+ public Object move(CDOFeature feature, int targetIndex, int sourceIndex);
+
+ public Object remove(CDOFeature feature, int index);
+
+ public Object set(CDOFeature feature, int index, Object value);
+
+ public void unset(CDOFeature feature);
+
+ public void adjustReferences(Map<CDOIDTemp, CDOID> idMappings);
+
+ public Object getValue(CDOFeature feature);
+
+ public Object setValue(CDOFeature feature, Object value);
+
+ public MoveableList<Object> getList(CDOFeature feature);
+
+ public MoveableList<Object> getList(CDOFeature feature, int size);
+
+ public void setListSize(CDOFeature feature, int size);
+}
diff --git a/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/spi/common/InternalCDORevisionDelta.java b/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/spi/common/InternalCDORevisionDelta.java
new file mode 100644
index 0000000000..85081674a1
--- /dev/null
+++ b/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/spi/common/InternalCDORevisionDelta.java
@@ -0,0 +1,28 @@
+/***************************************************************************
+ * Copyright (c) 2004 - 2008 Eike Stepper, Germany.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Eike Stepper - initial API and implementation
+ **************************************************************************/
+package org.eclipse.emf.cdo.spi.common;
+
+import org.eclipse.emf.cdo.common.id.CDOID;
+import org.eclipse.emf.cdo.common.id.CDOIDTemp;
+import org.eclipse.emf.cdo.common.revision.delta.CDOFeatureDelta;
+import org.eclipse.emf.cdo.common.revision.delta.CDORevisionDelta;
+
+import java.util.Map;
+
+/**
+ * @author Eike Stepper
+ */
+public interface InternalCDORevisionDelta extends CDORevisionDelta
+{
+ public void addFeatureDelta(CDOFeatureDelta delta);
+
+ public void adjustReferences(Map<CDOIDTemp, CDOID> idMappings);
+}
diff --git a/plugins/org.eclipse.emf.cdo.server.db/META-INF/MANIFEST.MF b/plugins/org.eclipse.emf.cdo.server.db/META-INF/MANIFEST.MF
new file mode 100644
index 0000000000..eb6bc44722
--- /dev/null
+++ b/plugins/org.eclipse.emf.cdo.server.db/META-INF/MANIFEST.MF
@@ -0,0 +1,17 @@
+Manifest-Version: 1.0
+Bundle-ManifestVersion: 2
+Bundle-SymbolicName: org.eclipse.emf.cdo.server.db;singleton:=true
+Bundle-Version: 1.0.0.qualifier
+Bundle-Name: %pluginName
+Bundle-Vendor: %providerName
+Bundle-Localization: plugin
+Bundle-ActivationPolicy: lazy
+Bundle-Activator: org.eclipse.emf.cdo.server.internal.db.bundle.OM$Activator
+Bundle-RequiredExecutionEnvironment: J2SE-1.5
+Bundle-ClassPath: .
+Require-Bundle: org.eclipse.core.runtime;bundle-version="[3.4.0,4.0.0)",
+ org.eclipse.net4j.db;bundle-version="[1.0.0,2.0.0)";visibility:=reexport,
+ org.eclipse.emf.cdo.server;bundle-version="[1.0.0,2.0.0)";visibility:=reexport
+Export-Package: org.eclipse.emf.cdo.server.db;version="1.0.0",
+ org.eclipse.emf.cdo.server.internal.db;version="1.0.0";x-friends:="org.eclipse.emf.cdo.tests",
+ org.eclipse.emf.cdo.server.internal.db.bundle;version="1.0.0";x-internal:=true
diff --git a/plugins/org.eclipse.emf.cdo.server.db/plugin.properties b/plugins/org.eclipse.emf.cdo.server.db/plugin.properties
new file mode 100644
index 0000000000..ec3177a8ac
--- /dev/null
+++ b/plugins/org.eclipse.emf.cdo.server.db/plugin.properties
@@ -0,0 +1,25 @@
+# Copyright (c) 2004 - 2008 Eike Stepper, Germany.
+# All rights reserved. This program and the accompanying materials
+# are made available under the terms of the Eclipse Public License v1.0
+# which accompanies this distribution, and is available at
+# http://www.eclipse.org/legal/epl-v10.html
+#
+# Contributors:
+# Eike Stepper - initial API and implementation
+
+# NLS_MESSAGEFORMAT_VAR
+
+# ==============================================================================
+# Do not change the properties between this line and the last line containing:
+# %%% END OF TRANSLATED PROPERTIES %%%
+# Instead, either redefine an existing property, or create a new property,
+# append it to the end of the file, and change the code to use the new name.
+# ==============================================================================
+
+pluginName = CDO Server DB
+providerName = Eclipse.org
+
+# ==============================================================================
+# %%% END OF TRANSLATED PROPERTIES %%%
+# The above properties have been shipped for translation.
+# ==============================================================================
diff --git a/plugins/org.eclipse.emf.cdo.server.db/src/org/eclipse/emf/cdo/server/db/IAttributeMapping.java b/plugins/org.eclipse.emf.cdo.server.db/src/org/eclipse/emf/cdo/server/db/IAttributeMapping.java
new file mode 100644
index 0000000000..6a2f98fccb
--- /dev/null
+++ b/plugins/org.eclipse.emf.cdo.server.db/src/org/eclipse/emf/cdo/server/db/IAttributeMapping.java
@@ -0,0 +1,29 @@
+/***************************************************************************
+ * Copyright (c) 2004 - 2008 Eike Stepper, Germany.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Eike Stepper - initial API and implementation
+ **************************************************************************/
+package org.eclipse.emf.cdo.server.db;
+
+import org.eclipse.emf.cdo.spi.common.InternalCDORevision;
+
+import org.eclipse.net4j.db.ddl.IDBField;
+
+import java.sql.ResultSet;
+
+/**
+ * @author Eike Stepper
+ */
+public interface IAttributeMapping extends IFeatureMapping
+{
+ public IDBField getField();
+
+ public void appendValue(StringBuilder builder, InternalCDORevision revision);
+
+ public void extractValue(ResultSet resultSet, int column, InternalCDORevision revision);
+}
diff --git a/plugins/org.eclipse.emf.cdo.server.db/src/org/eclipse/emf/cdo/server/db/IClassMapping.java b/plugins/org.eclipse.emf.cdo.server.db/src/org/eclipse/emf/cdo/server/db/IClassMapping.java
new file mode 100644
index 0000000000..508811011a
--- /dev/null
+++ b/plugins/org.eclipse.emf.cdo.server.db/src/org/eclipse/emf/cdo/server/db/IClassMapping.java
@@ -0,0 +1,50 @@
+/***************************************************************************
+ * Copyright (c) 2004 - 2008 Eike Stepper, Germany.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Eike Stepper - initial API and implementation
+ **************************************************************************/
+package org.eclipse.emf.cdo.server.db;
+
+import org.eclipse.emf.cdo.common.model.CDOClass;
+import org.eclipse.emf.cdo.common.model.CDOFeature;
+import org.eclipse.emf.cdo.common.revision.CDORevision;
+
+import org.eclipse.net4j.db.ddl.IDBTable;
+
+import java.util.List;
+import java.util.Set;
+
+/**
+ * @author Eike Stepper
+ */
+public interface IClassMapping
+{
+ public IMappingStrategy getMappingStrategy();
+
+ public CDOClass getCDOClass();
+
+ public IDBTable getTable();
+
+ public Set<IDBTable> getAffectedTables();
+
+ public List<IAttributeMapping> getAttributeMappings();
+
+ public List<IReferenceMapping> getReferenceMappings();
+
+ public IAttributeMapping getAttributeMapping(CDOFeature feature);
+
+ public IReferenceMapping getReferenceMapping(CDOFeature feature);
+
+ public void writeRevision(IDBStoreWriter storeWriter, CDORevision revision);
+
+ public void readRevision(IDBStoreReader storeReader, CDORevision revision, int referenceChunk);
+
+ public void readRevisionByTime(IDBStoreReader storeReader, CDORevision revision, long timeStamp, int referenceChunk);
+
+ public void readRevisionByVersion(IDBStoreReader storeReader, CDORevision revision, int version, int referenceChunk);
+}
diff --git a/plugins/org.eclipse.emf.cdo.server.db/src/org/eclipse/emf/cdo/server/db/IDBStoreReader.java b/plugins/org.eclipse.emf.cdo.server.db/src/org/eclipse/emf/cdo/server/db/IDBStoreReader.java
new file mode 100644
index 0000000000..b2bdf5c0c3
--- /dev/null
+++ b/plugins/org.eclipse.emf.cdo.server.db/src/org/eclipse/emf/cdo/server/db/IDBStoreReader.java
@@ -0,0 +1,22 @@
+/***************************************************************************
+ * Copyright (c) 2004 - 2008 Eike Stepper, Germany.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Eike Stepper - initial API and implementation
+ **************************************************************************/
+package org.eclipse.emf.cdo.server.db;
+
+import org.eclipse.emf.cdo.common.model.CDOClassRef;
+import org.eclipse.emf.cdo.server.IStoreReader;
+
+/**
+ * @author Eike Stepper
+ */
+public interface IDBStoreReader extends IDBStoreAccessor, IStoreReader
+{
+ public CDOClassRef readClassRef(int classID);
+}
diff --git a/plugins/org.eclipse.emf.cdo.server.db/src/org/eclipse/emf/cdo/server/db/IFeatureMapping.java b/plugins/org.eclipse.emf.cdo.server.db/src/org/eclipse/emf/cdo/server/db/IFeatureMapping.java
new file mode 100644
index 0000000000..611a42a3d3
--- /dev/null
+++ b/plugins/org.eclipse.emf.cdo.server.db/src/org/eclipse/emf/cdo/server/db/IFeatureMapping.java
@@ -0,0 +1,23 @@
+/***************************************************************************
+ * Copyright (c) 2004 - 2008 Eike Stepper, Germany.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Eike Stepper - initial API and implementation
+ **************************************************************************/
+package org.eclipse.emf.cdo.server.db;
+
+import org.eclipse.emf.cdo.common.model.CDOFeature;
+
+/**
+ * @author Eike Stepper
+ */
+public interface IFeatureMapping
+{
+ public IClassMapping getClassMapping();
+
+ public CDOFeature getFeature();
+}
diff --git a/plugins/org.eclipse.emf.cdo.server.db/src/org/eclipse/emf/cdo/server/db/IMappingStrategy.java b/plugins/org.eclipse.emf.cdo.server.db/src/org/eclipse/emf/cdo/server/db/IMappingStrategy.java
new file mode 100644
index 0000000000..689a4847bd
--- /dev/null
+++ b/plugins/org.eclipse.emf.cdo.server.db/src/org/eclipse/emf/cdo/server/db/IMappingStrategy.java
@@ -0,0 +1,51 @@
+/***************************************************************************
+ * Copyright (c) 2004 - 2008 Eike Stepper, Germany.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Eike Stepper - initial API and implementation
+ **************************************************************************/
+package org.eclipse.emf.cdo.server.db;
+
+import org.eclipse.emf.cdo.common.id.CDOID;
+import org.eclipse.emf.cdo.common.model.CDOClass;
+import org.eclipse.emf.cdo.common.model.CDOClassRef;
+
+import org.eclipse.net4j.util.collection.CloseableIterator;
+
+import java.sql.Connection;
+import java.util.Map;
+
+/**
+ * @author Eike Stepper
+ */
+public interface IMappingStrategy
+{
+ public String getType();
+
+ public IDBStore getStore();
+
+ public void setStore(IDBStore store);
+
+ public Map<String, String> getProperties();
+
+ public void setProperties(Map<String, String> properties);
+
+ public IClassMapping getClassMapping(CDOClass cdoClass);
+
+ public CloseableIterator<CDOID> readObjectIDs(IDBStoreReader storeReader, boolean withTypes);
+
+ public CDOClassRef readObjectType(IDBStoreReader storeReader, CDOID id);
+
+ public CDOID readResourceID(IDBStoreReader storeReader, String path);
+
+ public String readResourcePath(IDBStoreReader storeReader, CDOID id);
+
+ /**
+ * Must return the maximum CDOID value .
+ */
+ public long repairAfterCrash(Connection connection);
+}
diff --git a/plugins/org.eclipse.emf.cdo.server.db/src/org/eclipse/emf/cdo/server/db/IObjectTypeCache.java b/plugins/org.eclipse.emf.cdo.server.db/src/org/eclipse/emf/cdo/server/db/IObjectTypeCache.java
new file mode 100644
index 0000000000..c10215f343
--- /dev/null
+++ b/plugins/org.eclipse.emf.cdo.server.db/src/org/eclipse/emf/cdo/server/db/IObjectTypeCache.java
@@ -0,0 +1,25 @@
+/***************************************************************************
+ * Copyright (c) 2004 - 2008 Eike Stepper, Germany.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Eike Stepper - initial API and implementation
+ **************************************************************************/
+package org.eclipse.emf.cdo.server.db;
+
+import org.eclipse.emf.cdo.common.id.CDOID;
+import org.eclipse.emf.cdo.common.model.CDOClass;
+import org.eclipse.emf.cdo.common.model.CDOClassRef;
+
+/**
+ * @author Eike Stepper
+ */
+public interface IObjectTypeCache
+{
+ public CDOClassRef getObjectType(IDBStoreReader storeReader, CDOID id);
+
+ public void putObjectType(IDBStoreWriter storeWriter, CDOID id, CDOClass type);
+}
diff --git a/plugins/org.eclipse.emf.cdo.server.db/src/org/eclipse/emf/cdo/server/db/IReferenceMapping.java b/plugins/org.eclipse.emf.cdo.server.db/src/org/eclipse/emf/cdo/server/db/IReferenceMapping.java
new file mode 100644
index 0000000000..533a9ef570
--- /dev/null
+++ b/plugins/org.eclipse.emf.cdo.server.db/src/org/eclipse/emf/cdo/server/db/IReferenceMapping.java
@@ -0,0 +1,32 @@
+/***************************************************************************
+ * Copyright (c) 2004 - 2008 Eike Stepper, Germany.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Eike Stepper - initial API and implementation
+ **************************************************************************/
+package org.eclipse.emf.cdo.server.db;
+
+import org.eclipse.emf.cdo.common.revision.CDORevision;
+import org.eclipse.emf.cdo.server.IStoreChunkReader.Chunk;
+
+import org.eclipse.net4j.db.ddl.IDBTable;
+
+import java.util.List;
+
+/**
+ * @author Eike Stepper
+ */
+public interface IReferenceMapping extends IFeatureMapping
+{
+ public IDBTable getTable();
+
+ public void writeReference(IDBStoreWriter storeWriter, CDORevision revision);
+
+ public void readReference(IDBStoreReader storeReader, CDORevision revision, int referenceChunk);
+
+ public void readChunks(IDBStoreChunkReader chunkReader, List<Chunk> chunks, String string);
+}
diff --git a/plugins/org.eclipse.emf.cdo.server.db/src/org/eclipse/emf/cdo/server/internal/db/AttributeMapping.java b/plugins/org.eclipse.emf.cdo.server.db/src/org/eclipse/emf/cdo/server/internal/db/AttributeMapping.java
new file mode 100644
index 0000000000..fb5271ff62
--- /dev/null
+++ b/plugins/org.eclipse.emf.cdo.server.db/src/org/eclipse/emf/cdo/server/internal/db/AttributeMapping.java
@@ -0,0 +1,275 @@
+/***************************************************************************
+ * Copyright (c) 2004 - 2008 Eike Stepper, Germany.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Eike Stepper - initial API and implementation
+ **************************************************************************/
+package org.eclipse.emf.cdo.server.internal.db;
+
+import org.eclipse.emf.cdo.common.id.CDOIDUtil;
+import org.eclipse.emf.cdo.common.model.CDOFeature;
+import org.eclipse.emf.cdo.server.db.IAttributeMapping;
+import org.eclipse.emf.cdo.spi.common.InternalCDORevision;
+
+import org.eclipse.net4j.db.DBException;
+import org.eclipse.net4j.db.IDBAdapter;
+import org.eclipse.net4j.db.ddl.IDBField;
+
+import java.sql.ResultSet;
+import java.sql.SQLException;
+
+/**
+ * @author Eike Stepper
+ */
+public abstract class AttributeMapping extends FeatureMapping implements IAttributeMapping
+{
+ private IDBField field;
+
+ public AttributeMapping(ClassMapping classMapping, CDOFeature feature)
+ {
+ super(classMapping, feature);
+ field = classMapping.addField(feature, classMapping.getTable());
+ }
+
+ public IDBField getField()
+ {
+ return field;
+ }
+
+ public void appendValue(StringBuilder builder, InternalCDORevision revision)
+ {
+ IDBAdapter dbAdapter = getDBAdapter();
+ Object value = getRevisionValue(revision);
+ dbAdapter.appendValue(builder, field, value);
+ }
+
+ protected Object getRevisionValue(InternalCDORevision revision)
+ {
+ CDOFeature feature = getFeature();
+ return revision.getValue(feature);
+ }
+
+ public void extractValue(ResultSet resultSet, int column, InternalCDORevision revision)
+ {
+ try
+ {
+ Object value = getResultSetValue(resultSet, column);
+ if (resultSet.wasNull())
+ {
+ value = null;
+ }
+
+ revision.setValue(getFeature(), value);
+ }
+ catch (SQLException ex)
+ {
+ throw new DBException(ex);
+ }
+ }
+
+ protected abstract Object getResultSetValue(ResultSet resultSet, int column) throws SQLException;
+
+ /**
+ * @author Eike Stepper
+ */
+ public static class AMString extends AttributeMapping
+ {
+ public AMString(ClassMapping classMapping, CDOFeature feature)
+ {
+ super(classMapping, feature);
+ }
+
+ @Override
+ protected Object getResultSetValue(ResultSet resultSet, int column) throws SQLException
+ {
+ return resultSet.getString(column);
+ }
+ }
+
+ /**
+ * @author Eike Stepper
+ */
+ public static class AMShort extends AttributeMapping
+ {
+ public AMShort(ClassMapping classMapping, CDOFeature feature)
+ {
+ super(classMapping, feature);
+ }
+
+ @Override
+ protected Object getResultSetValue(ResultSet resultSet, int column) throws SQLException
+ {
+ return resultSet.getShort(column);
+ }
+ }
+
+ /**
+ * @author Eike Stepper
+ */
+ public static class AMObject extends AttributeMapping
+ {
+ public AMObject(ClassMapping classMapping, CDOFeature feature)
+ {
+ super(classMapping, feature);
+ }
+
+ @Override
+ protected Object getResultSetValue(ResultSet resultSet, int column) throws SQLException
+ {
+ long id = resultSet.getLong(column);
+ if (resultSet.wasNull())
+ {
+ return null;
+ }
+
+ return CDOIDUtil.createLong(id);
+ }
+ }
+
+ /**
+ * @author Eike Stepper
+ */
+ public static class AMLong extends AttributeMapping
+ {
+ public AMLong(ClassMapping classMapping, CDOFeature feature)
+ {
+ super(classMapping, feature);
+ }
+
+ @Override
+ protected Object getResultSetValue(ResultSet resultSet, int column) throws SQLException
+ {
+ return resultSet.getLong(column);
+ }
+ }
+
+ /**
+ * @author Eike Stepper
+ */
+ public static class AMInteger extends AttributeMapping
+ {
+ public AMInteger(ClassMapping classMapping, CDOFeature feature)
+ {
+ super(classMapping, feature);
+ }
+
+ @Override
+ protected Object getResultSetValue(ResultSet resultSet, int column) throws SQLException
+ {
+ return resultSet.getInt(column);
+ }
+ }
+
+ /**
+ * @author Eike Stepper
+ */
+ public static class AMFloat extends AttributeMapping
+ {
+ public AMFloat(ClassMapping classMapping, CDOFeature feature)
+ {
+ super(classMapping, feature);
+ }
+
+ @Override
+ protected Object getResultSetValue(ResultSet resultSet, int column) throws SQLException
+ {
+ return resultSet.getFloat(column);
+ }
+ }
+
+ /**
+ * @author Eike Stepper
+ */
+ public static class AMDouble extends AttributeMapping
+ {
+ public AMDouble(ClassMapping classMapping, CDOFeature feature)
+ {
+ super(classMapping, feature);
+ }
+
+ @Override
+ protected Object getResultSetValue(ResultSet resultSet, int column) throws SQLException
+ {
+ return resultSet.getDouble(column);
+ }
+ }
+
+ /**
+ * @author Eike Stepper
+ */
+ public static class AMDate extends AttributeMapping
+ {
+ public AMDate(ClassMapping classMapping, CDOFeature feature)
+ {
+ super(classMapping, feature);
+ }
+
+ @Override
+ protected Object getResultSetValue(ResultSet resultSet, int column) throws SQLException
+ {
+ // TODO Is getDate() correct?
+ return resultSet.getDate(column);
+ }
+ }
+
+ /**
+ * @author Eike Stepper
+ */
+ public static class AMCharacter extends AttributeMapping
+ {
+ public AMCharacter(ClassMapping classMapping, CDOFeature feature)
+ {
+ super(classMapping, feature);
+ }
+
+ @Override
+ protected Object getResultSetValue(ResultSet resultSet, int column) throws SQLException
+ {
+ String str = resultSet.getString(column);
+ if (resultSet.wasNull())
+ {
+ return null;
+ }
+
+ return str.charAt(0);
+ }
+ }
+
+ /**
+ * @author Eike Stepper
+ */
+ public static class AMByte extends AttributeMapping
+ {
+ public AMByte(ClassMapping classMapping, CDOFeature feature)
+ {
+ super(classMapping, feature);
+ }
+
+ @Override
+ protected Object getResultSetValue(ResultSet resultSet, int column) throws SQLException
+ {
+ return resultSet.getByte(column);
+ }
+ }
+
+ /**
+ * @author Eike Stepper
+ */
+ public static class AMBoolean extends AttributeMapping
+ {
+ public AMBoolean(ClassMapping classMapping, CDOFeature feature)
+ {
+ super(classMapping, feature);
+ }
+
+ @Override
+ protected Object getResultSetValue(ResultSet resultSet, int column) throws SQLException
+ {
+ return resultSet.getBoolean(column);
+ }
+ }
+}
diff --git a/plugins/org.eclipse.emf.cdo.server.db/src/org/eclipse/emf/cdo/server/internal/db/CDODBSchema.java b/plugins/org.eclipse.emf.cdo.server.db/src/org/eclipse/emf/cdo/server/internal/db/CDODBSchema.java
new file mode 100644
index 0000000000..0d3652bfc4
--- /dev/null
+++ b/plugins/org.eclipse.emf.cdo.server.db/src/org/eclipse/emf/cdo/server/internal/db/CDODBSchema.java
@@ -0,0 +1,205 @@
+/***************************************************************************
+ * Copyright (c) 2004 - 2008 Eike Stepper, Germany.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Eike Stepper - initial API and implementation
+ **************************************************************************/
+package org.eclipse.emf.cdo.server.internal.db;
+
+import org.eclipse.net4j.db.DBType;
+import org.eclipse.net4j.db.ddl.IDBField;
+import org.eclipse.net4j.db.ddl.IDBIndex;
+import org.eclipse.net4j.db.ddl.IDBTable;
+import org.eclipse.net4j.spi.db.DBSchema;
+
+/**
+ * @author Eike Stepper
+ */
+public class CDODBSchema extends DBSchema
+{
+ public static final CDODBSchema INSTANCE = new CDODBSchema();
+
+ /**
+ * DBTable cdo_repository
+ */
+ public static final IDBTable REPOSITORY = INSTANCE.addTable("cdo_repository");
+
+ public static final IDBField REPOSITORY_STARTS = //
+ REPOSITORY.addField("starts", DBType.BIGINT);
+
+ public static final IDBField REPOSITORY_STARTED = //
+ REPOSITORY.addField("started", DBType.BIGINT);
+
+ public static final IDBField REPOSITORY_STOPPED = //
+ REPOSITORY.addField("stopped", DBType.BIGINT);
+
+ public static final IDBField REPOSITORY_NEXT_CDOID = //
+ REPOSITORY.addField("next_cdoid", DBType.BIGINT);
+
+ public static final IDBField REPOSITORY_NEXT_METAID = //
+ REPOSITORY.addField("next_metaid", DBType.BIGINT);
+
+ /**
+ * DBTable cdo_packages
+ */
+ public static final IDBTable PACKAGES = INSTANCE.addTable("cdo_packages");
+
+ public static final IDBField PACKAGES_ID = //
+ PACKAGES.addField("id", DBType.INTEGER);
+
+ public static final IDBField PACKAGES_URI = //
+ PACKAGES.addField("uri", DBType.VARCHAR, 255);
+
+ public static final IDBField PACKAGES_NAME = //
+ PACKAGES.addField("name", DBType.VARCHAR, 255);
+
+ public static final IDBField PACKAGES_ECORE = //
+ PACKAGES.addField("ecore", DBType.CLOB);
+
+ public static final IDBField PACKAGES_DYNAMIC = //
+ PACKAGES.addField("dynamic", DBType.BOOLEAN);
+
+ public static final IDBField PACKAGES_RANGE_LB = //
+ PACKAGES.addField("range_lb", DBType.BIGINT);
+
+ public static final IDBField PACKAGES_RANGE_UB = //
+ PACKAGES.addField("range_ub", DBType.BIGINT);
+
+ public static final IDBField PACKAGES_PARENT = //
+ PACKAGES.addField("parent", DBType.VARCHAR, 255);
+
+ public static final IDBIndex INDEX_PACKAGES_PK = //
+ PACKAGES.addIndex(IDBIndex.Type.PRIMARY_KEY, PACKAGES_ID);
+
+ public static final IDBIndex INDEX_PACKAGES_URI = //
+ PACKAGES.addIndex(IDBIndex.Type.UNIQUE, PACKAGES_URI);
+
+ /**
+ * DBTable cdo_classes
+ */
+ public static final IDBTable CLASSES = INSTANCE.addTable("cdo_classes");
+
+ public static final IDBField CLASSES_ID = //
+ CLASSES.addField("id", DBType.INTEGER);
+
+ public static final IDBField CLASSES_PACKAGE = //
+ CLASSES.addField("package", DBType.INTEGER);
+
+ public static final IDBField CLASSES_CLASSIFIER = //
+ CLASSES.addField("classifier", DBType.INTEGER);
+
+ public static final IDBField CLASSES_NAME = //
+ CLASSES.addField("name", DBType.VARCHAR, 255);
+
+ public static final IDBField CLASSES_ABSTRACT = //
+ CLASSES.addField("abstract", DBType.BOOLEAN);
+
+ public static final IDBIndex INDEX_CLASSES_PK = //
+ CLASSES.addIndex(IDBIndex.Type.PRIMARY_KEY, CLASSES_ID);
+
+ /**
+ * DBTable cdo_supertypes
+ */
+ public static final IDBTable SUPERTYPES = INSTANCE.addTable("cdo_supertypes");
+
+ public static final IDBField SUPERTYPES_TYPE = //
+ SUPERTYPES.addField("type_id", DBType.INTEGER);
+
+ public static final IDBField SUPERTYPES_SUPERTYPE_PACKAGE = //
+ SUPERTYPES.addField("supertype_package", DBType.VARCHAR, 255);
+
+ public static final IDBField SUPERTYPES_SUPERTYPE_CLASSIFIER = //
+ SUPERTYPES.addField("supertype_classifier", DBType.INTEGER);
+
+ public static final IDBIndex INDEX_SUPERTYPES_PK = //
+ SUPERTYPES.addIndex(IDBIndex.Type.PRIMARY_KEY, SUPERTYPES_TYPE);
+
+ /**
+ * DBTable cdo_features
+ */
+ public static final IDBTable FEATURES = INSTANCE.addTable("cdo_features");
+
+ public static final IDBField FEATURES_ID = //
+ FEATURES.addField("id", DBType.INTEGER);
+
+ public static final IDBField FEATURES_CLASS = //
+ FEATURES.addField("class", DBType.INTEGER);
+
+ public static final IDBField FEATURES_FEATURE = //
+ FEATURES.addField("feature", DBType.INTEGER);
+
+ public static final IDBField FEATURES_NAME = //
+ FEATURES.addField("name", DBType.VARCHAR, 255);
+
+ public static final IDBField FEATURES_TYPE = //
+ FEATURES.addField("type", DBType.INTEGER);
+
+ public static final IDBField FEATURES_REFERENCE_PACKAGE = //
+ FEATURES.addField("reference_package", DBType.VARCHAR, 255);
+
+ public static final IDBField FEATURES_REFERENCE_CLASSIFIER = //
+ FEATURES.addField("reference_classifier", DBType.INTEGER);
+
+ public static final IDBField FEATURES_MANY = //
+ FEATURES.addField("many", DBType.BOOLEAN);
+
+ public static final IDBField FEATURES_CONTAINMENT = //
+ FEATURES.addField("containment", DBType.BOOLEAN);
+
+ public static final IDBField FEATURES_INDEX = //
+ FEATURES.addField("idx", DBType.INTEGER);
+
+ public static final IDBIndex INDEX_FEATURES_PK = //
+ FEATURES.addIndex(IDBIndex.Type.PRIMARY_KEY, FEATURES_ID);
+
+ /**
+ * Name of object table
+ */
+ public static final String CDO_OBJECTS = "cdo_objects";
+
+ /**
+ * Field names of attribute tables
+ */
+ public static final String ATTRIBUTES_ID = "cdo_id";
+
+ public static final String ATTRIBUTES_VERSION = "cdo_version";
+
+ public static final String ATTRIBUTES_CLASS = "cdo_class";
+
+ public static final String ATTRIBUTES_CREATED = "cdo_created";
+
+ public static final String ATTRIBUTES_REVISED = "cdo_revised";
+
+ public static final String ATTRIBUTES_RESOURCE = "cdo_resource";
+
+ public static final String ATTRIBUTES_CONTAINER = "cdo_container";
+
+ public static final String ATTRIBUTES_FEATURE = "cdo_feature";
+
+ /**
+ * Field names of reference tables
+ */
+ public static final String REFERENCES_FEATURE = "cdo_feature";
+
+ public static final String REFERENCES_SOURCE = "cdo_source";
+
+ public static final String REFERENCES_VERSION = "cdo_version";
+
+ public static final String REFERENCES_IDX = "cdo_idx";
+
+ public static final String REFERENCES_TARGET = "cdo_target";
+
+ private CDODBSchema()
+ {
+ super("CDO");
+ }
+
+ static
+ {
+ INSTANCE.lock();
+ }
+}
diff --git a/plugins/org.eclipse.emf.cdo.server.db/src/org/eclipse/emf/cdo/server/internal/db/ClassMapping.java b/plugins/org.eclipse.emf.cdo.server.db/src/org/eclipse/emf/cdo/server/internal/db/ClassMapping.java
new file mode 100644
index 0000000000..68334b411d
--- /dev/null
+++ b/plugins/org.eclipse.emf.cdo.server.db/src/org/eclipse/emf/cdo/server/internal/db/ClassMapping.java
@@ -0,0 +1,615 @@
+/***************************************************************************
+ * Copyright (c) 2004 - 2008 Eike Stepper, Germany.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Eike Stepper - initial API and implementation
+ **************************************************************************/
+package org.eclipse.emf.cdo.server.internal.db;
+
+import org.eclipse.emf.cdo.common.id.CDOIDUtil;
+import org.eclipse.emf.cdo.common.model.CDOClass;
+import org.eclipse.emf.cdo.common.model.CDOFeature;
+import org.eclipse.emf.cdo.common.model.CDOType;
+import org.eclipse.emf.cdo.common.model.resource.CDOResourceClass;
+import org.eclipse.emf.cdo.common.revision.CDORevision;
+import org.eclipse.emf.cdo.server.db.IAttributeMapping;
+import org.eclipse.emf.cdo.server.db.IClassMapping;
+import org.eclipse.emf.cdo.server.db.IDBStore;
+import org.eclipse.emf.cdo.server.db.IDBStoreReader;
+import org.eclipse.emf.cdo.server.db.IDBStoreWriter;
+import org.eclipse.emf.cdo.server.db.IReferenceMapping;
+import org.eclipse.emf.cdo.server.internal.db.bundle.OM;
+import org.eclipse.emf.cdo.spi.common.InternalCDORevision;
+
+import org.eclipse.net4j.db.DBException;
+import org.eclipse.net4j.db.DBType;
+import org.eclipse.net4j.db.DBUtil;
+import org.eclipse.net4j.db.IDBAdapter;
+import org.eclipse.net4j.db.ddl.IDBField;
+import org.eclipse.net4j.db.ddl.IDBIndex;
+import org.eclipse.net4j.db.ddl.IDBTable;
+import org.eclipse.net4j.util.ImplementationError;
+import org.eclipse.net4j.util.om.trace.ContextTracer;
+
+import java.sql.ResultSet;
+import java.sql.SQLException;
+import java.sql.Statement;
+import java.util.ArrayList;
+import java.util.HashSet;
+import java.util.List;
+import java.util.Set;
+
+/**
+ * @author Eike Stepper
+ */
+public abstract class ClassMapping implements IClassMapping
+{
+ private static final ContextTracer TRACER = new ContextTracer(OM.DEBUG, ClassMapping.class);
+
+ private MappingStrategy mappingStrategy;
+
+ private CDOClass cdoClass;
+
+ private IDBTable table;
+
+ private Set<IDBTable> affectedTables = new HashSet<IDBTable>();
+
+ private List<IAttributeMapping> attributeMappings;
+
+ private List<IReferenceMapping> referenceMappings;
+
+ private String selectPrefix;
+
+ private String selectPrefixWithVersion;
+
+ public ClassMapping(MappingStrategy mappingStrategy, CDOClass cdoClass, CDOFeature[] features)
+ {
+ this.mappingStrategy = mappingStrategy;
+ this.cdoClass = cdoClass;
+
+ table = addTable(cdoClass.getName());
+ initTable(table, hasFullRevisionInfo());
+ if (features != null)
+ {
+ attributeMappings = createAttributeMappings(features);
+ referenceMappings = createReferenceMappings(features);
+
+ // Special handling of CDOResource table
+ CDOResourceClass resourceClass = cdoClass.getPackageManager().getCDOResourcePackage().getCDOResourceClass();
+ if (cdoClass == resourceClass)
+ {
+ // Create a unique ids to prevent duplicate resource paths
+ for (IAttributeMapping attributeMapping : attributeMappings)
+ {
+ if (attributeMapping.getFeature() == resourceClass.getCDOPathFeature())
+ {
+ IDBField versionField = table.getField(CDODBSchema.ATTRIBUTES_VERSION);
+ IDBField pathField = attributeMapping.getField();
+ pathField.setPrecision(760);// MYSQL key limitation 767
+ pathField.setNotNull(true);
+
+ // Create a unique ids to prevent duplicate resource paths
+ table.addIndex(IDBIndex.Type.UNIQUE, versionField, pathField);
+ break;
+ }
+ }
+ }
+ }
+
+ selectPrefix = createSelectPrefix(false);
+ selectPrefixWithVersion = createSelectPrefix(true);
+ }
+
+ public MappingStrategy getMappingStrategy()
+ {
+ return mappingStrategy;
+ }
+
+ public CDOClass getCDOClass()
+ {
+ return cdoClass;
+ }
+
+ public IDBTable getTable()
+ {
+ return table;
+ }
+
+ public Set<IDBTable> getAffectedTables()
+ {
+ return affectedTables;
+ }
+
+ protected void initTable(IDBTable table, boolean full)
+ {
+ table.addField(CDODBSchema.ATTRIBUTES_ID, DBType.BIGINT, true);
+ table.addField(CDODBSchema.ATTRIBUTES_VERSION, DBType.INTEGER, true);
+ if (full)
+ {
+ table.addField(CDODBSchema.ATTRIBUTES_CLASS, DBType.INTEGER, true);
+ table.addField(CDODBSchema.ATTRIBUTES_CREATED, DBType.BIGINT, true);
+ table.addField(CDODBSchema.ATTRIBUTES_REVISED, DBType.BIGINT, true);
+ table.addField(CDODBSchema.ATTRIBUTES_RESOURCE, DBType.BIGINT, true);
+ table.addField(CDODBSchema.ATTRIBUTES_CONTAINER, DBType.BIGINT, true);
+ table.addField(CDODBSchema.ATTRIBUTES_FEATURE, DBType.INTEGER, true);
+ }
+ }
+
+ protected void appendRevisionInfos(StringBuilder builder, InternalCDORevision revision, boolean full)
+ {
+ builder.append(CDOIDUtil.getLong(revision.getID()));
+ builder.append(", ");
+ builder.append(revision.getVersion());
+ if (full)
+ {
+ builder.append(", ");
+ builder.append(ServerInfo.getDBID(revision.getCDOClass()));
+ builder.append(", ");
+ builder.append(revision.getCreated());
+ builder.append(", ");
+ builder.append(revision.getRevised());
+ builder.append(", ");
+ builder.append(CDOIDUtil.getLong(revision.getResourceID()));
+ builder.append(", ");
+ builder.append(CDOIDUtil.getLong(revision.getContainerID()));
+ builder.append(", ");
+ builder.append(revision.getContainingFeatureID());
+ }
+ }
+
+ protected int sqlUpdate(IDBStoreWriter storeWriter, String sql) throws DBException
+ {
+ if (TRACER.isEnabled())
+ {
+ TRACER.trace(sql);
+ }
+
+ try
+ {
+ Statement statement = storeWriter.getStatement();
+ return statement.executeUpdate(sql);
+ }
+ catch (SQLException ex)
+ {
+ throw new DBException(ex);
+ }
+ }
+
+ protected String mangleTableName(String name, int attempt)
+ {
+ return getDBAdapter().mangleTableName(name, attempt);
+ }
+
+ protected String mangleFieldName(String name, int attempt)
+ {
+ return getDBAdapter().mangleFieldName(name, attempt);
+ }
+
+ protected IDBTable addTable(String name)
+ {
+ for (int attempt = 0;; ++attempt)
+ {
+ String tableName = mangleTableName(name, attempt);
+
+ try
+ {
+ IDBTable table = mappingStrategy.getStore().getDBSchema().addTable(tableName);
+ affectedTables.add(table);
+ return table;
+ }
+ catch (DBException ex)
+ {
+ if (TRACER.isEnabled())
+ {
+ TRACER.format("{0}. attempt to add table: {1} ({2})", attempt + 1, tableName, ex.getMessage());
+ }
+ }
+ }
+ }
+
+ protected IDBField addField(CDOFeature cdoFeature, IDBTable table) throws DBException
+ {
+ DBType fieldType = getDBType(cdoFeature);
+ int fieldLength = getDBLength(cdoFeature);
+ for (int attempt = 0;; ++attempt)
+ {
+ String fieldName = mangleFieldName(cdoFeature.getName(), attempt);
+
+ try
+ {
+ IDBField field = table.addField(fieldName, fieldType, fieldLength);
+ affectedTables.add(table);
+ return field;
+ }
+ catch (DBException ex)
+ {
+ if (TRACER.isEnabled())
+ {
+ TRACER.format("{0}. attempt to add field: {1} ({2})", attempt + 1, fieldName, ex.getMessage());
+ }
+ }
+ }
+ }
+
+ protected DBType getDBType(CDOFeature cdoFeature)
+ {
+ return DBStore.getDBType(cdoFeature.getType());
+ }
+
+ protected int getDBLength(CDOFeature cdoFeature)
+ {
+ // Derby: The maximum length for a VARCHAR string is 32,672 characters.
+ CDOType type = cdoFeature.getType();
+ return type == CDOType.STRING || type == CDOType.CUSTOM ? 32672 : IDBField.DEFAULT;
+ }
+
+ protected IDBAdapter getDBAdapter()
+ {
+ IDBStore store = mappingStrategy.getStore();
+ return store.getDBAdapter();
+ }
+
+ protected String createSelectPrefix(boolean readVersion)
+ {
+ StringBuilder builder = new StringBuilder();
+ builder.append("SELECT ");
+
+ if (hasFullRevisionInfo())
+ {
+ if (readVersion)
+ {
+ builder.append(CDODBSchema.ATTRIBUTES_VERSION);
+ builder.append(", ");
+ }
+
+ builder.append(CDODBSchema.ATTRIBUTES_CREATED);
+ builder.append(", ");
+ builder.append(CDODBSchema.ATTRIBUTES_REVISED);
+ builder.append(", ");
+ builder.append(CDODBSchema.ATTRIBUTES_RESOURCE);
+ builder.append(", ");
+ builder.append(CDODBSchema.ATTRIBUTES_CONTAINER);
+ builder.append(", ");
+ builder.append(CDODBSchema.ATTRIBUTES_FEATURE);
+ }
+ else
+ {
+ if (attributeMappings == null)
+ {
+ // Only references
+ return null;
+ }
+ }
+
+ if (attributeMappings != null)
+ {
+ for (IAttributeMapping attributeMapping : attributeMappings)
+ {
+ builder.append(", ");
+ builder.append(attributeMapping.getField());
+ }
+ }
+
+ builder.append(" FROM ");
+ builder.append(table);
+ builder.append(" WHERE ");
+ builder.append(CDODBSchema.ATTRIBUTES_ID);
+ builder.append("=");
+ return builder.toString();
+ }
+
+ public List<IAttributeMapping> getAttributeMappings()
+ {
+ return attributeMappings;
+ }
+
+ public List<IReferenceMapping> getReferenceMappings()
+ {
+ return referenceMappings;
+ }
+
+ public IReferenceMapping getReferenceMapping(CDOFeature feature)
+ {
+ // TODO Optimize this?
+ for (IReferenceMapping referenceMapping : referenceMappings)
+ {
+ if (referenceMapping.getFeature() == feature)
+ {
+ return referenceMapping;
+ }
+ }
+
+ return null;
+ }
+
+ public IAttributeMapping getAttributeMapping(CDOFeature feature)
+ {
+ // TODO Optimize this?
+ for (IAttributeMapping attributeMapping : attributeMappings)
+ {
+ if (attributeMapping.getFeature() == feature)
+ {
+ return attributeMapping;
+ }
+ }
+
+ return null;
+ }
+
+ protected List<IAttributeMapping> createAttributeMappings(CDOFeature[] features)
+ {
+ List<IAttributeMapping> attributeMappings = new ArrayList<IAttributeMapping>();
+ for (CDOFeature feature : features)
+ {
+ if (feature.isReference())
+ {
+ if (!feature.isMany())
+ {
+ attributeMappings.add(createToOneReferenceMapping(feature));
+ }
+ }
+ else
+ {
+ attributeMappings.add(createAttributeMapping(feature));
+ }
+ }
+
+ return attributeMappings.isEmpty() ? null : attributeMappings;
+ }
+
+ protected List<IReferenceMapping> createReferenceMappings(CDOFeature[] features)
+ {
+ List<IReferenceMapping> referenceMappings = new ArrayList<IReferenceMapping>();
+ for (CDOFeature feature : features)
+ {
+ if (feature.isReference() && feature.isMany())
+ {
+ referenceMappings.add(createReferenceMapping(feature));
+ }
+ }
+
+ return referenceMappings.isEmpty() ? null : referenceMappings;
+ }
+
+ protected AttributeMapping createAttributeMapping(CDOFeature feature)
+ {
+ CDOType type = feature.getType();
+ if (type == CDOType.BOOLEAN || type == CDOType.BOOLEAN_OBJECT)
+ {
+ return new AttributeMapping.AMBoolean(this, feature);
+ }
+ else if (type == CDOType.BYTE || type == CDOType.BYTE_OBJECT)
+ {
+ return new AttributeMapping.AMByte(this, feature);
+ }
+ else if (type == CDOType.CHAR || type == CDOType.CHARACTER_OBJECT)
+ {
+ return new AttributeMapping.AMCharacter(this, feature);
+ }
+ else if (type == CDOType.DATE)
+ {
+ return new AttributeMapping.AMDate(this, feature);
+ }
+ else if (type == CDOType.DOUBLE || type == CDOType.DOUBLE_OBJECT)
+ {
+ return new AttributeMapping.AMDouble(this, feature);
+ }
+ else if (type == CDOType.FLOAT || type == CDOType.FLOAT_OBJECT)
+ {
+ return new AttributeMapping.AMFloat(this, feature);
+ }
+ else if (type == CDOType.INT || type == CDOType.INTEGER_OBJECT)
+ {
+ return new AttributeMapping.AMInteger(this, feature);
+ }
+ else if (type == CDOType.LONG || type == CDOType.LONG_OBJECT)
+ {
+ return new AttributeMapping.AMLong(this, feature);
+ }
+ else if (type == CDOType.OBJECT)
+ {
+ return new AttributeMapping.AMObject(this, feature);
+ }
+ else if (type == CDOType.SHORT || type == CDOType.SHORT_OBJECT)
+ {
+ return new AttributeMapping.AMShort(this, feature);
+ }
+ else if (type == CDOType.STRING || type == CDOType.CUSTOM)
+ {
+ return new AttributeMapping.AMString(this, feature);
+ }
+
+ throw new ImplementationError("Unrecognized CDOType: " + type);
+ }
+
+ protected ToOneReferenceMapping createToOneReferenceMapping(CDOFeature feature)
+ {
+ return new ToOneReferenceMapping(this, feature);
+ }
+
+ protected ReferenceMapping createReferenceMapping(CDOFeature feature)
+ {
+ return new ReferenceMapping(this, feature, ToMany.PER_REFERENCE);
+ }
+
+ protected abstract boolean hasFullRevisionInfo();
+
+ public void writeRevision(IDBStoreWriter storeWriter, CDORevision revision)
+ {
+ if (revision.getVersion() >= 2 && hasFullRevisionInfo())
+ {
+ writeRevisedRow(storeWriter, (InternalCDORevision)revision);
+ }
+
+ if (attributeMappings != null)
+ {
+ writeAttributes(storeWriter, (InternalCDORevision)revision);
+ }
+
+ if (referenceMappings != null)
+ {
+ writeReferences(storeWriter, (InternalCDORevision)revision);
+ }
+ }
+
+ protected void writeRevisedRow(IDBStoreWriter storeWriter, InternalCDORevision revision)
+ {
+ StringBuilder builder = new StringBuilder();
+ builder.append("UPDATE ");
+ builder.append(table);
+ builder.append(" SET ");
+ builder.append(CDODBSchema.ATTRIBUTES_REVISED);
+ builder.append("=");
+ builder.append(revision.getCreated() - 1);
+ builder.append(" WHERE ");
+ builder.append(CDODBSchema.ATTRIBUTES_ID);
+ builder.append("=");
+ builder.append(CDOIDUtil.getLong(revision.getID()));
+ builder.append(" AND ");
+ builder.append(CDODBSchema.ATTRIBUTES_VERSION);
+ builder.append("=");
+ builder.append(revision.getVersion() - 1);
+ sqlUpdate(storeWriter, builder.toString());
+ }
+
+ protected void writeAttributes(IDBStoreWriter storeWriter, InternalCDORevision revision)
+ {
+ StringBuilder builder = new StringBuilder();
+ builder.append("INSERT INTO ");
+ builder.append(table);
+ builder.append(" VALUES (");
+ appendRevisionInfos(builder, revision, hasFullRevisionInfo());
+
+ for (IAttributeMapping attributeMapping : attributeMappings)
+ {
+ builder.append(", ");
+ attributeMapping.appendValue(builder, revision);
+ }
+
+ builder.append(")");
+ sqlUpdate(storeWriter, builder.toString());
+ }
+
+ protected void writeReferences(IDBStoreWriter storeWriter, InternalCDORevision revision)
+ {
+ for (IReferenceMapping referenceMapping : referenceMappings)
+ {
+ referenceMapping.writeReference(storeWriter, revision);
+ }
+ }
+
+ public void readRevision(IDBStoreReader storeReader, CDORevision revision, int referenceChunk)
+ {
+ String where = CDODBSchema.ATTRIBUTES_REVISED + "=0";
+ readRevision(storeReader, (InternalCDORevision)revision, where, true, referenceChunk);
+ }
+
+ public void readRevisionByTime(IDBStoreReader storeReader, CDORevision revision, long timeStamp, int referenceChunk)
+ {
+ StringBuilder where = new StringBuilder();
+ where.append("(");
+ where.append(CDODBSchema.ATTRIBUTES_REVISED);
+ where.append("=0 OR ");
+ where.append(CDODBSchema.ATTRIBUTES_REVISED);
+ where.append(">=");
+ where.append(timeStamp);
+ where.append(") AND ");
+ where.append(timeStamp);
+ where.append(">=");
+ where.append(CDODBSchema.ATTRIBUTES_CREATED);
+ readRevision(storeReader, (InternalCDORevision)revision, where.toString(), true, referenceChunk);
+ }
+
+ public void readRevisionByVersion(IDBStoreReader storeReader, CDORevision revision, int version, int referenceChunk)
+ {
+ String where = CDODBSchema.ATTRIBUTES_VERSION + "=" + version;
+ readRevision(storeReader, (InternalCDORevision)revision, where, false, referenceChunk);
+ }
+
+ protected void readRevision(IDBStoreReader storeReader, InternalCDORevision revision, String where,
+ boolean readVersion, int referenceChunk)
+ {
+ if (attributeMappings != null)
+ {
+ readAttributes(storeReader, revision, where, readVersion);
+ }
+
+ if (referenceMappings != null)
+ {
+ readReferences(storeReader, revision, referenceChunk);
+ }
+ }
+
+ protected void readAttributes(IDBStoreReader storeReader, InternalCDORevision revision, String where,
+ boolean readVersion)
+ {
+ long id = CDOIDUtil.getLong(revision.getID());
+ StringBuilder builder = new StringBuilder(readVersion ? selectPrefixWithVersion : selectPrefix);
+ builder.append(id);
+ if (where != null)
+ {
+ builder.append(" AND ");
+ builder.append(where);
+ }
+
+ String sql = builder.toString();
+ if (TRACER.isEnabled())
+ {
+ TRACER.trace(sql);
+ }
+
+ ResultSet resultSet = null;
+
+ try
+ {
+ resultSet = storeReader.getStatement().executeQuery(sql);
+ if (!resultSet.next())
+ {
+ throw new IllegalStateException("Revision not found: " + id);
+ }
+
+ int i = 1;
+ if (hasFullRevisionInfo())
+ {
+ if (readVersion)
+ {
+ revision.setVersion(resultSet.getInt(i++));
+ }
+
+ revision.setCreated(resultSet.getLong(i++));
+ revision.setRevised(resultSet.getLong(i++));
+ revision.setResourceID(CDOIDUtil.createLong(resultSet.getLong(i++)));
+ revision.setContainerID(CDOIDUtil.createLong(resultSet.getLong(i++)));
+ revision.setContainingFeatureID(resultSet.getInt(i++));
+ }
+
+ if (attributeMappings != null)
+ {
+ for (IAttributeMapping attributeMapping : attributeMappings)
+ {
+ attributeMapping.extractValue(resultSet, i++, revision);
+ }
+ }
+ }
+ catch (SQLException ex)
+ {
+ throw new DBException(ex);
+ }
+ finally
+ {
+ DBUtil.close(resultSet);
+ }
+ }
+
+ protected void readReferences(IDBStoreReader storeReader, InternalCDORevision revision, int referenceChunk)
+ {
+ for (IReferenceMapping referenceMapping : referenceMappings)
+ {
+ referenceMapping.readReference(storeReader, revision, referenceChunk);
+ }
+ }
+}
diff --git a/plugins/org.eclipse.emf.cdo.server.db/src/org/eclipse/emf/cdo/server/internal/db/ClassServerInfo.java b/plugins/org.eclipse.emf.cdo.server.db/src/org/eclipse/emf/cdo/server/internal/db/ClassServerInfo.java
new file mode 100644
index 0000000000..cdf76c7770
--- /dev/null
+++ b/plugins/org.eclipse.emf.cdo.server.db/src/org/eclipse/emf/cdo/server/internal/db/ClassServerInfo.java
@@ -0,0 +1,79 @@
+/***************************************************************************
+ * Copyright (c) 2004 - 2008 Eike Stepper, Germany.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Eike Stepper - initial API and implementation
+ **************************************************************************/
+package org.eclipse.emf.cdo.server.internal.db;
+
+import org.eclipse.emf.cdo.common.model.CDOClass;
+import org.eclipse.emf.cdo.server.db.IClassMapping;
+import org.eclipse.emf.cdo.spi.common.InternalCDOClass;
+
+import org.eclipse.net4j.util.ImplementationError;
+
+/**
+ * @author Eike Stepper
+ */
+public final class ClassServerInfo extends ServerInfo
+{
+ public static final int CDO_OBJECT_CLASS_DBID = -1;
+
+ public static final int CDO_RESOURCE_CLASS_DBID = -2;
+
+ private IClassMapping classMapping;
+
+ private ClassServerInfo(int id)
+ {
+ super(id);
+ }
+
+ public static ClassServerInfo setDBID(CDOClass cdoClass, int id)
+ {
+ ClassServerInfo serverInfo = new ClassServerInfo(id);
+ ((InternalCDOClass)cdoClass).setServerInfo(serverInfo);
+ return serverInfo;
+ }
+
+ /**
+ * Should only be called from {@link MappingStrategy#getClassMapping(CDOClass)}.
+ */
+ public static IClassMapping getClassMapping(CDOClass cdoClass)
+ {
+ ClassServerInfo serverInfo = getServerInfo(cdoClass);
+ return serverInfo == null ? null : serverInfo.classMapping;
+ }
+
+ public static void setClassMapping(CDOClass cdoClass, IClassMapping classMapping)
+ {
+ ClassServerInfo serverInfo = getServerInfo(cdoClass);
+ if (serverInfo == null)
+ {
+ throw new ImplementationError("No serverInfo for class " + cdoClass);
+ }
+
+ serverInfo.classMapping = classMapping;
+ }
+
+ protected static ClassServerInfo getServerInfo(CDOClass cdoClass)
+ {
+ ClassServerInfo serverInfo = (ClassServerInfo)cdoClass.getServerInfo();
+ if (serverInfo == null)
+ {
+ if (cdoClass.isRoot())
+ {
+ serverInfo = setDBID(cdoClass, CDO_OBJECT_CLASS_DBID);
+ }
+ else if (cdoClass.isResource())
+ {
+ serverInfo = setDBID(cdoClass, CDO_RESOURCE_CLASS_DBID);
+ }
+ }
+
+ return serverInfo;
+ }
+}
diff --git a/plugins/org.eclipse.emf.cdo.server.db/src/org/eclipse/emf/cdo/server/internal/db/DBStore.java b/plugins/org.eclipse.emf.cdo.server.db/src/org/eclipse/emf/cdo/server/internal/db/DBStore.java
new file mode 100644
index 0000000000..43ff0b5188
--- /dev/null
+++ b/plugins/org.eclipse.emf.cdo.server.db/src/org/eclipse/emf/cdo/server/internal/db/DBStore.java
@@ -0,0 +1,400 @@
+/***************************************************************************
+ * Copyright (c) 2004 - 2008 Eike Stepper, Germany.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Eike Stepper - initial API and implementation
+ **************************************************************************/
+package org.eclipse.emf.cdo.server.internal.db;
+
+import org.eclipse.emf.cdo.common.model.CDOType;
+import org.eclipse.emf.cdo.internal.server.LongIDStore;
+import org.eclipse.emf.cdo.server.ISession;
+import org.eclipse.emf.cdo.server.IView;
+import org.eclipse.emf.cdo.server.StoreUtil;
+import org.eclipse.emf.cdo.server.db.IClassMapping;
+import org.eclipse.emf.cdo.server.db.IDBStore;
+import org.eclipse.emf.cdo.server.db.IMappingStrategy;
+import org.eclipse.emf.cdo.server.internal.db.bundle.OM;
+
+import org.eclipse.net4j.db.DBException;
+import org.eclipse.net4j.db.DBType;
+import org.eclipse.net4j.db.DBUtil;
+import org.eclipse.net4j.db.IDBAdapter;
+import org.eclipse.net4j.db.IDBConnectionProvider;
+import org.eclipse.net4j.db.ddl.IDBSchema;
+import org.eclipse.net4j.db.ddl.IDBTable;
+import org.eclipse.net4j.spi.db.DBSchema;
+import org.eclipse.net4j.util.ImplementationError;
+import org.eclipse.net4j.util.lifecycle.LifecycleUtil;
+
+import javax.sql.DataSource;
+
+import java.sql.Connection;
+import java.text.MessageFormat;
+import java.util.Set;
+
+/**
+ * @author Eike Stepper
+ */
+public class DBStore extends LongIDStore implements IDBStore
+{
+ public static final String TYPE = "db";
+
+ private IMappingStrategy mappingStrategy;
+
+ private IDBSchema dbSchema;
+
+ private IDBAdapter dbAdapter;
+
+ private IDBConnectionProvider dbConnectionProvider;
+
+ private int nextPackageID;
+
+ private int nextClassID;
+
+ private int nextFeatureID;
+
+ public DBStore()
+ {
+ super(TYPE);
+ }
+
+ public IMappingStrategy getMappingStrategy()
+ {
+ return mappingStrategy;
+ }
+
+ public void setMappingStrategy(IMappingStrategy mappingStrategy)
+ {
+ this.mappingStrategy = mappingStrategy;
+ mappingStrategy.setStore(this);
+ }
+
+ public IDBAdapter getDBAdapter()
+ {
+ return dbAdapter;
+ }
+
+ public void setDbAdapter(IDBAdapter dbAdapter)
+ {
+ this.dbAdapter = dbAdapter;
+ }
+
+ public IDBConnectionProvider getDBConnectionProvider()
+ {
+ return dbConnectionProvider;
+ }
+
+ public void setDbConnectionProvider(IDBConnectionProvider dbConnectionProvider)
+ {
+ this.dbConnectionProvider = dbConnectionProvider;
+ }
+
+ public void setDataSource(DataSource dataSource)
+ {
+ dbConnectionProvider = DBUtil.createConnectionProvider(dataSource);
+ }
+
+ public synchronized IDBSchema getDBSchema()
+ {
+ // TODO Better synchronization or eager init
+ if (dbSchema == null)
+ {
+ dbSchema = createSchema();
+ }
+
+ return dbSchema;
+ }
+
+ @Override
+ public boolean hasAuditingSupport()
+ {
+ return true;
+ }
+
+ @Override
+ public boolean hasBranchingSupport()
+ {
+ return false;
+ }
+
+ @Override
+ public boolean hasWriteDeltaSupport()
+ {
+ return false;
+ }
+
+ @Override
+ public DBStoreReader getReader(ISession session)
+ {
+ return (DBStoreReader)super.getReader(session);
+ }
+
+ @Override
+ public DBStoreReader createReader(ISession session) throws DBException
+ {
+ return new DBStoreReader(this, session);
+ }
+
+ @Override
+ public DBStoreWriter getWriter(IView view)
+ {
+ return (DBStoreWriter)super.getWriter(view);
+ }
+
+ @Override
+ public DBStoreWriter createWriter(IView view) throws DBException
+ {
+ return new DBStoreWriter(this, view);
+ }
+
+ public synchronized int getNextPackageID()
+ {
+ // TODO Better synchronization
+ return nextPackageID++;
+ }
+
+ public synchronized int getNextClassID()
+ {
+ // TODO Better synchronization
+ return nextClassID++;
+ }
+
+ public synchronized int getNextFeatureID()
+ {
+ // TODO Better synchronization
+ return nextFeatureID++;
+ }
+
+ public Connection getConnection()
+ {
+ Connection connection = dbConnectionProvider.getConnection();
+ if (connection == null)
+ {
+ throw new DBException("No connection from connection provider: " + dbConnectionProvider);
+ }
+
+ return connection;
+ }
+
+ @Override
+ protected void doBeforeActivate() throws Exception
+ {
+ super.doBeforeActivate();
+ checkNull(mappingStrategy, "mappingStrategy is null");
+ checkNull(dbAdapter, "dbAdapter is null");
+ checkNull(dbConnectionProvider, "dbConnectionProvider is null");
+ }
+
+ @Override
+ protected void doActivate() throws Exception
+ {
+ super.doActivate();
+ Connection connection = null;
+
+ try
+ {
+ connection = getConnection();
+ Set<IDBTable> createdTables = CDODBSchema.INSTANCE.create(dbAdapter, dbConnectionProvider);
+ if (createdTables.contains(CDODBSchema.REPOSITORY))
+ {
+ // First start
+ DBUtil.insertRow(connection, dbAdapter, CDODBSchema.REPOSITORY, 1, getStartupTime(), 0, CRASHED, CRASHED);
+
+ MappingStrategy mappingStrategy = (MappingStrategy)getMappingStrategy();
+
+ IClassMapping resourceClassMapping = mappingStrategy.getResourceClassMapping();
+ Set<IDBTable> tables = resourceClassMapping.getAffectedTables();
+ if (dbAdapter.createTables(tables, connection).size() != tables.size())
+ {
+ throw new DBException("CDOResource tables not completely created");
+ }
+ }
+ else
+ {
+ // Restart
+ long lastObjectID = DBUtil.selectMaximumLong(connection, CDODBSchema.REPOSITORY_NEXT_CDOID);
+ setLastMetaID(DBUtil.selectMaximumLong(connection, CDODBSchema.REPOSITORY_NEXT_METAID));
+ if (lastObjectID == CRASHED || getLastMetaID() == CRASHED)
+ {
+ OM.LOG.warn("Detected restart after crash");
+ }
+
+ setLastObjectID(lastObjectID);
+
+ StringBuilder builder = new StringBuilder();
+ builder.append("UPDATE ");
+ builder.append(CDODBSchema.REPOSITORY);
+ builder.append(" SET ");
+ builder.append(CDODBSchema.REPOSITORY_STARTS);
+ builder.append("=");
+ builder.append(CDODBSchema.REPOSITORY_STARTS);
+ builder.append("+1, ");
+ builder.append(CDODBSchema.REPOSITORY_STARTED);
+ builder.append("=");
+ builder.append(getStartupTime());
+ builder.append(", ");
+ builder.append(CDODBSchema.REPOSITORY_STOPPED);
+ builder.append("=0, ");
+ builder.append(CDODBSchema.REPOSITORY_NEXT_CDOID);
+ builder.append("=");
+ builder.append(CRASHED);
+ builder.append(", ");
+ builder.append(CDODBSchema.REPOSITORY_NEXT_METAID);
+ builder.append("=");
+ builder.append(CRASHED);
+
+ String sql = builder.toString();
+ int count = DBUtil.update(connection, sql);
+ if (count == 0)
+ {
+ throw new DBException("No row updated in table " + CDODBSchema.REPOSITORY);
+ }
+ }
+
+ nextPackageID = DBUtil.selectMaximumInt(connection, CDODBSchema.PACKAGES_ID) + 1;
+ nextClassID = DBUtil.selectMaximumInt(connection, CDODBSchema.CLASSES_ID) + 1;
+ nextFeatureID = DBUtil.selectMaximumInt(connection, CDODBSchema.FEATURES_ID) + 1;
+ LifecycleUtil.activate(mappingStrategy);
+ }
+ finally
+ {
+ DBUtil.close(connection);
+ }
+ }
+
+ @Override
+ protected void doDeactivate() throws Exception
+ {
+ Connection connection = null;
+
+ try
+ {
+ connection = getConnection();
+
+ LifecycleUtil.deactivate(mappingStrategy);
+
+ StringBuilder builder = new StringBuilder();
+ builder.append("UPDATE ");
+ builder.append(CDODBSchema.REPOSITORY);
+ builder.append(" SET ");
+ builder.append(CDODBSchema.REPOSITORY_STOPPED);
+ builder.append("=");
+ builder.append(getShutdownTime());
+ builder.append(", ");
+ builder.append(CDODBSchema.REPOSITORY_NEXT_CDOID);
+ builder.append("=");
+ builder.append(getLastObjectID());
+ builder.append(", ");
+ builder.append(CDODBSchema.REPOSITORY_NEXT_METAID);
+ builder.append("=");
+ builder.append(getRepository().getLastMetaID());
+
+ String sql = builder.toString();
+ int count = DBUtil.update(connection, sql);
+ if (count == 0)
+ {
+ throw new DBException("No row updated in table " + CDODBSchema.REPOSITORY);
+ }
+ }
+ finally
+ {
+ DBUtil.close(connection);
+ }
+
+ super.doDeactivate();
+ }
+
+ @Override
+ public void repairAfterCrash()
+ {
+ DBStoreReader storeReader = getReader(null);
+ StoreUtil.setReader(storeReader);
+
+ try
+ {
+ Connection connection = storeReader.getConnection();
+ long maxObjectID = mappingStrategy.repairAfterCrash(connection);
+ setLastMetaID(DBUtil.selectMaximumLong(connection, CDODBSchema.PACKAGES_RANGE_UB));
+
+ OM.LOG.info(MessageFormat.format("Repaired after crash: maxObjectID={0}, maxMetaID={1}", maxObjectID,
+ getLastMetaID()));
+ setLastObjectID(maxObjectID);
+ }
+ finally
+ {
+ storeReader.release();
+ StoreUtil.setReader(null);
+ }
+ }
+
+ protected IDBSchema createSchema()
+ {
+ String name = getRepository().getName();
+ return new DBSchema(name);
+ }
+
+ protected long getStartupTime()
+ {
+ return System.currentTimeMillis();
+ }
+
+ protected long getShutdownTime()
+ {
+ return System.currentTimeMillis();
+ }
+
+ public static DBType getDBType(CDOType type)
+ {
+ if (type == CDOType.BOOLEAN || type == CDOType.BOOLEAN_OBJECT)
+ {
+ return DBType.BOOLEAN;
+ }
+ else if (type == CDOType.BYTE || type == CDOType.BYTE_OBJECT)
+ {
+ return DBType.SMALLINT;
+ }
+ else if (type == CDOType.CHAR || type == CDOType.CHARACTER_OBJECT)
+ {
+ return DBType.CHAR;
+ }
+ else if (type == CDOType.DATE)
+ {
+ return DBType.DATE;
+ }
+ else if (type == CDOType.DOUBLE || type == CDOType.DOUBLE_OBJECT)
+ {
+ return DBType.DOUBLE;
+ }
+ else if (type == CDOType.FLOAT || type == CDOType.FLOAT_OBJECT)
+ {
+ return DBType.FLOAT;
+ }
+ else if (type == CDOType.INT || type == CDOType.INTEGER_OBJECT)
+ {
+ return DBType.INTEGER;
+ }
+ else if (type == CDOType.LONG || type == CDOType.LONG_OBJECT)
+ {
+ return DBType.BIGINT;
+ }
+ else if (type == CDOType.OBJECT)
+ {
+ return DBType.BIGINT;
+ }
+ else if (type == CDOType.SHORT || type == CDOType.SHORT_OBJECT)
+ {
+ return DBType.SMALLINT;
+ }
+ else if (type == CDOType.STRING || type == CDOType.CUSTOM)
+ {
+ return DBType.VARCHAR;
+ }
+
+ throw new ImplementationError("Unrecognized CDOType: " + type);
+ }
+}
diff --git a/plugins/org.eclipse.emf.cdo.server.db/src/org/eclipse/emf/cdo/server/internal/db/DBStoreAccessor.java b/plugins/org.eclipse.emf.cdo.server.db/src/org/eclipse/emf/cdo/server/internal/db/DBStoreAccessor.java
new file mode 100644
index 0000000000..2bb89d1416
--- /dev/null
+++ b/plugins/org.eclipse.emf.cdo.server.db/src/org/eclipse/emf/cdo/server/internal/db/DBStoreAccessor.java
@@ -0,0 +1,170 @@
+/***************************************************************************
+ * Copyright (c) 2004 - 2008 Eike Stepper, Germany.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Eike Stepper - initial API and implementation
+ **************************************************************************/
+package org.eclipse.emf.cdo.server.internal.db;
+
+import org.eclipse.emf.cdo.common.model.CDOClass;
+import org.eclipse.emf.cdo.common.model.CDOPackage;
+import org.eclipse.emf.cdo.internal.server.StoreAccessor;
+import org.eclipse.emf.cdo.server.ISession;
+import org.eclipse.emf.cdo.server.IView;
+import org.eclipse.emf.cdo.server.db.IClassMapping;
+import org.eclipse.emf.cdo.server.db.IDBStoreAccessor;
+import org.eclipse.emf.cdo.server.db.IMappingStrategy;
+
+import org.eclipse.net4j.db.DBException;
+import org.eclipse.net4j.db.DBUtil;
+import org.eclipse.net4j.db.ddl.IDBTable;
+
+import java.sql.Connection;
+import java.sql.PreparedStatement;
+import java.sql.SQLException;
+import java.sql.Statement;
+import java.util.HashSet;
+import java.util.Set;
+
+/**
+ * @author Eike Stepper
+ */
+public class DBStoreAccessor extends StoreAccessor implements IDBStoreAccessor
+{
+ private Connection connection;
+
+ private Statement statement;
+
+ protected DBStoreAccessor(DBStore store, ISession session) throws DBException
+ {
+ super(store, session);
+ initConnection();
+ }
+
+ protected DBStoreAccessor(DBStore store, IView view) throws DBException
+ {
+ super(store, view);
+ initConnection();
+ }
+
+ protected void initConnection()
+ {
+ try
+ {
+ connection = getStore().getDBConnectionProvider().getConnection();
+ connection.setAutoCommit(isReader());
+ }
+ catch (SQLException ex)
+ {
+ throw new DBException(ex);
+ }
+ }
+
+ @Override
+ protected void doRelease() throws DBException
+ {
+ DBUtil.close(statement);
+ DBUtil.close(connection);
+ }
+
+ @Override
+ public DBStore getStore()
+ {
+ return (DBStore)super.getStore();
+ }
+
+ public Connection getConnection()
+ {
+ return connection;
+ }
+
+ public Statement getStatement()
+ {
+ if (statement == null)
+ {
+ try
+ {
+ statement = getConnection().createStatement();
+ }
+ catch (SQLException ex)
+ {
+ throw new DBException(ex);
+ }
+ }
+
+ return statement;
+ }
+
+ public PreparedStatement prepareStatement(String sql)
+ {
+ try
+ {
+ return getConnection().prepareStatement(sql);
+ }
+ catch (SQLException ex)
+ {
+ throw new DBException(ex);
+ }
+ }
+
+ /**
+ * TODO Move this somehow to DBAdapter
+ */
+ protected Boolean getBoolean(Object value)
+ {
+ if (value == null)
+ {
+ return null;
+ }
+
+ if (value instanceof Boolean)
+ {
+ return (Boolean)value;
+ }
+
+ if (value instanceof Number)
+ {
+ return ((Number)value).intValue() != 0;
+ }
+
+ throw new IllegalArgumentException("Not a boolean value: " + value);
+ }
+
+ protected Set<IDBTable> mapPackages(CDOPackage... cdoPackages)
+ {
+ Set<IDBTable> affectedTables = new HashSet<IDBTable>();
+ if (cdoPackages != null && cdoPackages.length != 0)
+ {
+ for (CDOPackage cdoPackage : cdoPackages)
+ {
+ Set<IDBTable> tables = mapClasses(cdoPackage.getClasses());
+ affectedTables.addAll(tables);
+ }
+ }
+
+ return affectedTables;
+ }
+
+ protected Set<IDBTable> mapClasses(CDOClass... cdoClasses)
+ {
+ Set<IDBTable> affectedTables = new HashSet<IDBTable>();
+ if (cdoClasses != null && cdoClasses.length != 0)
+ {
+ IMappingStrategy mappingStrategy = getStore().getMappingStrategy();
+ for (CDOClass cdoClass : cdoClasses)
+ {
+ IClassMapping mapping = mappingStrategy.getClassMapping(cdoClass);
+ if (mapping != null)
+ {
+ affectedTables.addAll(mapping.getAffectedTables());
+ }
+ }
+ }
+
+ return affectedTables;
+ }
+}
diff --git a/plugins/org.eclipse.emf.cdo.server.db/src/org/eclipse/emf/cdo/server/internal/db/DBStoreChunkReader.java b/plugins/org.eclipse.emf.cdo.server.db/src/org/eclipse/emf/cdo/server/internal/db/DBStoreChunkReader.java
new file mode 100644
index 0000000000..ede2e74da0
--- /dev/null
+++ b/plugins/org.eclipse.emf.cdo.server.db/src/org/eclipse/emf/cdo/server/internal/db/DBStoreChunkReader.java
@@ -0,0 +1,75 @@
+/***************************************************************************
+ * Copyright (c) 2004 - 2008 Eike Stepper, Germany.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Eike Stepper - initial API and implementation
+ **************************************************************************/
+package org.eclipse.emf.cdo.server.internal.db;
+
+import org.eclipse.emf.cdo.common.model.CDOFeature;
+import org.eclipse.emf.cdo.common.revision.CDORevision;
+import org.eclipse.emf.cdo.internal.server.StoreChunkReader;
+import org.eclipse.emf.cdo.server.db.IClassMapping;
+import org.eclipse.emf.cdo.server.db.IDBStoreChunkReader;
+import org.eclipse.emf.cdo.server.db.IDBStoreReader;
+import org.eclipse.emf.cdo.server.db.IMappingStrategy;
+import org.eclipse.emf.cdo.server.db.IReferenceMapping;
+
+import java.util.List;
+
+/**
+ * @author Eike Stepper
+ */
+public class DBStoreChunkReader extends StoreChunkReader implements IDBStoreChunkReader
+{
+ private IReferenceMapping referenceMapping;
+
+ private StringBuilder builder = new StringBuilder();
+
+ public DBStoreChunkReader(IDBStoreReader storeReader, CDORevision revision, CDOFeature feature)
+ {
+ super(storeReader, revision, feature);
+ IMappingStrategy mappingStrategy = storeReader.getStore().getMappingStrategy();
+ IClassMapping mapping = mappingStrategy.getClassMapping(revision.getCDOClass());
+ referenceMapping = mapping.getReferenceMapping(feature);
+ }
+
+ @Override
+ public DBStoreReader getStoreReader()
+ {
+ return (DBStoreReader)super.getStoreReader();
+ }
+
+ @Override
+ public void addSimpleChunk(int index)
+ {
+ super.addSimpleChunk(index);
+ builder.append(" AND ");
+ builder.append(CDODBSchema.REFERENCES_IDX);
+ builder.append("=");
+ builder.append(index);
+ }
+
+ @Override
+ public void addRangedChunk(int fromIndex, int toIndex)
+ {
+ super.addRangedChunk(fromIndex, toIndex);
+ builder.append(" AND ");
+ builder.append(CDODBSchema.REFERENCES_IDX);
+ builder.append(" BETWEEN ");
+ builder.append(fromIndex);
+ builder.append(" AND ");
+ builder.append(toIndex);
+ }
+
+ public List<Chunk> executeRead()
+ {
+ List<Chunk> chunks = getChunks();
+ referenceMapping.readChunks(this, chunks, builder.toString());
+ return chunks;
+ }
+}
diff --git a/plugins/org.eclipse.emf.cdo.server.db/src/org/eclipse/emf/cdo/server/internal/db/DBStoreReader.java b/plugins/org.eclipse.emf.cdo.server.db/src/org/eclipse/emf/cdo/server/internal/db/DBStoreReader.java
new file mode 100644
index 0000000000..892b4327ee
--- /dev/null
+++ b/plugins/org.eclipse.emf.cdo.server.db/src/org/eclipse/emf/cdo/server/internal/db/DBStoreReader.java
@@ -0,0 +1,293 @@
+/***************************************************************************
+ * Copyright (c) 2004 - 2008 Eike Stepper, Germany.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Eike Stepper - initial API and implementation
+ **************************************************************************/
+package org.eclipse.emf.cdo.server.internal.db;
+
+import org.eclipse.emf.cdo.common.id.CDOID;
+import org.eclipse.emf.cdo.common.id.CDOIDMetaRange;
+import org.eclipse.emf.cdo.common.id.CDOIDUtil;
+import org.eclipse.emf.cdo.common.model.CDOClass;
+import org.eclipse.emf.cdo.common.model.CDOClassProxy;
+import org.eclipse.emf.cdo.common.model.CDOClassRef;
+import org.eclipse.emf.cdo.common.model.CDOFeature;
+import org.eclipse.emf.cdo.common.model.CDOModelUtil;
+import org.eclipse.emf.cdo.common.model.CDOPackage;
+import org.eclipse.emf.cdo.common.model.CDOPackageInfo;
+import org.eclipse.emf.cdo.common.model.CDOType;
+import org.eclipse.emf.cdo.common.revision.CDORevision;
+import org.eclipse.emf.cdo.common.revision.CDORevisionUtil;
+import org.eclipse.emf.cdo.server.IPackageManager;
+import org.eclipse.emf.cdo.server.IRepository;
+import org.eclipse.emf.cdo.server.IRevisionManager;
+import org.eclipse.emf.cdo.server.ISession;
+import org.eclipse.emf.cdo.server.IView;
+import org.eclipse.emf.cdo.server.db.IClassMapping;
+import org.eclipse.emf.cdo.server.db.IDBStoreReader;
+import org.eclipse.emf.cdo.server.db.IMappingStrategy;
+import org.eclipse.emf.cdo.server.internal.db.bundle.OM;
+import org.eclipse.emf.cdo.spi.common.InternalCDOClass;
+import org.eclipse.emf.cdo.spi.common.InternalCDOPackage;
+import org.eclipse.emf.cdo.spi.common.InternalCDORevision;
+
+import org.eclipse.net4j.db.DBException;
+import org.eclipse.net4j.db.DBUtil;
+import org.eclipse.net4j.db.IDBRowHandler;
+import org.eclipse.net4j.util.collection.CloseableIterator;
+import org.eclipse.net4j.util.om.trace.ContextTracer;
+
+import java.util.ArrayList;
+import java.util.Collection;
+
+/**
+ * @author Eike Stepper
+ */
+public class DBStoreReader extends DBStoreAccessor implements IDBStoreReader
+{
+ private static final ContextTracer TRACER = new ContextTracer(OM.DEBUG, DBStoreReader.class);
+
+ public DBStoreReader(DBStore store, ISession session) throws DBException
+ {
+ super(store, session);
+ }
+
+ protected DBStoreReader(DBStore store, IView view) throws DBException
+ {
+ super(store, view);
+ }
+
+ public DBStoreChunkReader createChunkReader(CDORevision revision, CDOFeature feature)
+ {
+ return new DBStoreChunkReader(this, revision, feature);
+ }
+
+ public Collection<CDOPackageInfo> readPackageInfos()
+ {
+ final Collection<CDOPackageInfo> result = new ArrayList<CDOPackageInfo>(0);
+ IDBRowHandler rowHandler = new IDBRowHandler()
+ {
+ public boolean handle(int row, final Object... values)
+ {
+ String packageURI = (String)values[0];
+ boolean dynamic = getBoolean(values[1]);
+ long lowerBound = (Long)values[2];
+ long upperBound = (Long)values[3];
+ CDOIDMetaRange metaIDRange = lowerBound == 0 ? null : CDOIDUtil.createMetaRange(CDOIDUtil
+ .createMeta(lowerBound), (int)(upperBound - lowerBound) + 1);
+ String parentURI = (String)values[4];
+
+ result.add(new CDOPackageInfo(packageURI, dynamic, metaIDRange, parentURI));
+ return true;
+ }
+ };
+
+ DBUtil.select(getConnection(), rowHandler, CDODBSchema.PACKAGES_URI, CDODBSchema.PACKAGES_DYNAMIC,
+ CDODBSchema.PACKAGES_RANGE_LB, CDODBSchema.PACKAGES_RANGE_UB, CDODBSchema.PACKAGES_PARENT);
+ return result;
+ }
+
+ public void readPackage(CDOPackage cdoPackage)
+ {
+ String where = CDODBSchema.PACKAGES_URI.getName() + " = '" + cdoPackage.getPackageURI() + "'";
+ Object[] values = DBUtil.select(getConnection(), where, CDODBSchema.PACKAGES_ID, CDODBSchema.PACKAGES_NAME,
+ CDODBSchema.PACKAGES_ECORE);
+ PackageServerInfo.setDBID(cdoPackage, (Integer)values[0]);
+ ((InternalCDOPackage)cdoPackage).setName((String)values[1]);
+ ((InternalCDOPackage)cdoPackage).setEcore((String)values[2]);
+ readClasses(cdoPackage);
+ mapPackages(cdoPackage);
+ }
+
+ protected void readClasses(final CDOPackage cdoPackage)
+ {
+ IDBRowHandler rowHandler = new IDBRowHandler()
+ {
+ public boolean handle(int row, Object... values)
+ {
+ int classID = (Integer)values[0];
+ int classifierID = (Integer)values[1];
+ String name = (String)values[2];
+ boolean isAbstract = getBoolean(values[3]);
+ CDOClass cdoClass = CDOModelUtil.createClass(cdoPackage, classifierID, name, isAbstract);
+ ClassServerInfo.setDBID(cdoClass, classID);
+ ((InternalCDOPackage)cdoPackage).addClass(cdoClass);
+ readSuperTypes(cdoClass, classID);
+ readFeatures(cdoClass, classID);
+ return true;
+ }
+ };
+
+ String where = CDODBSchema.CLASSES_PACKAGE.getName() + "=" + ServerInfo.getDBID(cdoPackage);
+ DBUtil.select(getConnection(), rowHandler, where, CDODBSchema.CLASSES_ID, CDODBSchema.CLASSES_CLASSIFIER,
+ CDODBSchema.CLASSES_NAME, CDODBSchema.CLASSES_ABSTRACT);
+ }
+
+ protected void readSuperTypes(final CDOClass cdoClass, int classID)
+ {
+ IDBRowHandler rowHandler = new IDBRowHandler()
+ {
+ public boolean handle(int row, Object... values)
+ {
+ String packageURI = (String)values[0];
+ int classifierID = (Integer)values[1];
+ ((InternalCDOClass)cdoClass).addSuperType(CDOModelUtil.createClassRef(packageURI, classifierID));
+ return true;
+ }
+ };
+
+ String where = CDODBSchema.SUPERTYPES_TYPE.getName() + "=" + classID;
+ DBUtil.select(getConnection(), rowHandler, where, CDODBSchema.SUPERTYPES_SUPERTYPE_PACKAGE,
+ CDODBSchema.SUPERTYPES_SUPERTYPE_CLASSIFIER);
+ }
+
+ protected void readFeatures(final CDOClass cdoClass, int classID)
+ {
+ IDBRowHandler rowHandler = new IDBRowHandler()
+ {
+ public boolean handle(int row, Object... values)
+ {
+ int featureID = (Integer)values[1];
+ String name = (String)values[2];
+ CDOType type = CDOModelUtil.getType((Integer)values[3]);
+ boolean many = getBoolean(values[6]);
+
+ CDOFeature feature;
+ if (type == CDOType.OBJECT)
+ {
+ String packageURI = (String)values[4];
+ int classifierID = (Integer)values[5];
+ boolean containment = getBoolean(values[7]);
+ CDOClassRef classRef = CDOModelUtil.createClassRef(packageURI, classifierID);
+ CDOClassProxy referenceType = new CDOClassProxy(classRef, cdoClass.getPackageManager());
+ feature = CDOModelUtil.createReference(cdoClass, featureID, name, referenceType, many, containment);
+ }
+ else
+ {
+ feature = CDOModelUtil.createAttribute(cdoClass, featureID, name, type, many);
+ }
+
+ FeatureServerInfo.setDBID(feature, (Integer)values[0]);
+ ((InternalCDOClass)cdoClass).addFeature(feature);
+ return true;
+ }
+ };
+
+ String where = CDODBSchema.FEATURES_CLASS.getName() + "=" + classID;
+ DBUtil.select(getConnection(), rowHandler, where, CDODBSchema.FEATURES_ID, CDODBSchema.FEATURES_FEATURE,
+ CDODBSchema.FEATURES_NAME, CDODBSchema.FEATURES_TYPE, CDODBSchema.FEATURES_REFERENCE_PACKAGE,
+ CDODBSchema.FEATURES_REFERENCE_CLASSIFIER, CDODBSchema.FEATURES_MANY, CDODBSchema.FEATURES_CONTAINMENT);
+ }
+
+ public String readPackageURI(int packageID)
+ {
+ String where = CDODBSchema.PACKAGES_ID.getName() + "=" + packageID;
+ Object[] uri = DBUtil.select(getConnection(), where, CDODBSchema.PACKAGES_URI);
+ return (String)uri[0];
+ }
+
+ public CloseableIterator<CDOID> readObjectIDs(boolean withTypes)
+ {
+ if (TRACER.isEnabled())
+ {
+ TRACER.trace("Selecting object IDs");
+ }
+
+ return getStore().getMappingStrategy().readObjectIDs(this, withTypes);
+ }
+
+ public CDOClassRef readObjectType(CDOID id)
+ {
+ if (TRACER.isEnabled())
+ {
+ TRACER.format("Selecting object type: {0}", id);
+ }
+
+ return getStore().getMappingStrategy().readObjectType(this, id);
+ }
+
+ public CDOClassRef readClassRef(int classID)
+ {
+ String where = CDODBSchema.CLASSES_ID.getName() + "=" + classID;
+ Object[] res = DBUtil.select(getConnection(), where, CDODBSchema.CLASSES_CLASSIFIER, CDODBSchema.CLASSES_PACKAGE);
+ int classifierID = (Integer)res[0];
+ String packageURI = readPackageURI((Integer)res[1]);
+ return CDOModelUtil.createClassRef(packageURI, classifierID);
+ }
+
+ public CDORevision readRevision(CDOID id, int referenceChunk)
+ {
+ if (TRACER.isEnabled())
+ {
+ TRACER.format("Selecting revision: {0}", id);
+ }
+
+ IRevisionManager revisionManager = getStore().getRepository().getRevisionManager();
+ CDOClass cdoClass = getObjectType(id);
+ InternalCDORevision revision = (InternalCDORevision)CDORevisionUtil.create(revisionManager, cdoClass, id);
+
+ IMappingStrategy mappingStrategy = getStore().getMappingStrategy();
+ IClassMapping mapping = mappingStrategy.getClassMapping(cdoClass);
+ mapping.readRevision(this, revision, referenceChunk);
+ return revision;
+ }
+
+ public CDORevision readRevisionByTime(CDOID id, int referenceChunk, long timeStamp)
+ {
+ if (TRACER.isEnabled())
+ {
+ TRACER.format("Selecting revision: {0}, timestamp={1,date} {1,time}", id, timeStamp);
+ }
+
+ IRevisionManager revisionManager = getStore().getRepository().getRevisionManager();
+ CDOClass cdoClass = getObjectType(id);
+ InternalCDORevision revision = (InternalCDORevision)CDORevisionUtil.create(revisionManager, cdoClass, id);
+
+ IMappingStrategy mappingStrategy = getStore().getMappingStrategy();
+ IClassMapping mapping = mappingStrategy.getClassMapping(cdoClass);
+ mapping.readRevisionByTime(this, revision, timeStamp, referenceChunk);
+ return revision;
+ }
+
+ public CDORevision readRevisionByVersion(CDOID id, int referenceChunk, int version)
+ {
+ if (TRACER.isEnabled())
+ {
+ TRACER.format("Selecting revision: {0}, version={1}", id, version);
+ }
+
+ IRevisionManager revisionManager = getStore().getRepository().getRevisionManager();
+ CDOClass cdoClass = getObjectType(id);
+ InternalCDORevision revision = (InternalCDORevision)CDORevisionUtil.create(revisionManager, cdoClass, id);
+
+ IMappingStrategy mappingStrategy = getStore().getMappingStrategy();
+ IClassMapping mapping = mappingStrategy.getClassMapping(cdoClass);
+ mapping.readRevisionByVersion(this, revision, version, referenceChunk);
+ return revision;
+ }
+
+ public CDOID readResourceID(String path)
+ {
+ IMappingStrategy mappingStrategy = getStore().getMappingStrategy();
+ return mappingStrategy.readResourceID(this, path);
+ }
+
+ public String readResourcePath(CDOID id)
+ {
+ IMappingStrategy mappingStrategy = getStore().getMappingStrategy();
+ return mappingStrategy.readResourcePath(this, id);
+ }
+
+ protected CDOClass getObjectType(CDOID id)
+ {
+ IRepository repository = getStore().getRepository();
+ IPackageManager packageManager = repository.getPackageManager();
+ CDOClassRef type = readObjectType(id);
+ return type.resolve(packageManager);
+ }
+}
diff --git a/plugins/org.eclipse.emf.cdo.server.db/src/org/eclipse/emf/cdo/server/internal/db/DBStoreWriter.java b/plugins/org.eclipse.emf.cdo.server.db/src/org/eclipse/emf/cdo/server/internal/db/DBStoreWriter.java
new file mode 100644
index 0000000000..df8ed692ec
--- /dev/null
+++ b/plugins/org.eclipse.emf.cdo.server.db/src/org/eclipse/emf/cdo/server/internal/db/DBStoreWriter.java
@@ -0,0 +1,203 @@
+/***************************************************************************
+ * Copyright (c) 2004 - 2008 Eike Stepper, Germany.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Eike Stepper - initial API and implementation
+ **************************************************************************/
+package org.eclipse.emf.cdo.server.internal.db;
+
+import org.eclipse.emf.cdo.common.id.CDOIDMeta;
+import org.eclipse.emf.cdo.common.id.CDOIDMetaRange;
+import org.eclipse.emf.cdo.common.model.CDOClass;
+import org.eclipse.emf.cdo.common.model.CDOClassProxy;
+import org.eclipse.emf.cdo.common.model.CDOFeature;
+import org.eclipse.emf.cdo.common.model.CDOPackage;
+import org.eclipse.emf.cdo.common.revision.CDORevision;
+import org.eclipse.emf.cdo.server.IView;
+import org.eclipse.emf.cdo.server.db.IClassMapping;
+import org.eclipse.emf.cdo.server.db.IDBStoreWriter;
+import org.eclipse.emf.cdo.server.db.IMappingStrategy;
+import org.eclipse.emf.cdo.server.internal.db.bundle.OM;
+import org.eclipse.emf.cdo.spi.common.InternalCDOClass;
+import org.eclipse.emf.cdo.spi.common.InternalCDOFeature;
+
+import org.eclipse.net4j.db.DBException;
+import org.eclipse.net4j.db.DBUtil;
+import org.eclipse.net4j.db.ddl.IDBTable;
+import org.eclipse.net4j.util.om.trace.ContextTracer;
+
+import java.sql.PreparedStatement;
+import java.sql.SQLException;
+import java.util.Set;
+
+/**
+ * @author Eike Stepper
+ */
+public class DBStoreWriter extends DBStoreReader implements IDBStoreWriter
+{
+ private static final ContextTracer TRACER = new ContextTracer(OM.DEBUG, DBStoreWriter.class);
+
+ public DBStoreWriter(DBStore store, IView view) throws DBException
+ {
+ super(store, view);
+ }
+
+ @Override
+ public void commit(CommitContext context)
+ {
+ super.commit(context);
+
+ try
+ {
+ getConnection().commit();
+ }
+ catch (SQLException ex)
+ {
+ throw new DBException(ex);
+ }
+ }
+
+ @Override
+ public void rollback(CommitContext context)
+ {
+ super.rollback(context);
+
+ try
+ {
+ getConnection().rollback();
+ }
+ catch (SQLException ex)
+ {
+ throw new DBException(ex);
+ }
+ }
+
+ @Override
+ protected void writePackages(CDOPackage... cdoPackages)
+ {
+ super.writePackages(cdoPackages);
+ Set<IDBTable> affectedTables = mapPackages(cdoPackages);
+ getStore().getDBAdapter().createTables(affectedTables, getConnection());
+ }
+
+ @Override
+ protected void writePackage(CDOPackage cdoPackage)
+ {
+ int id = getStore().getNextPackageID();
+ PackageServerInfo.setDBID(cdoPackage, id);
+ if (TRACER.isEnabled())
+ {
+ TRACER.format("Writing package: {0} --> {1}", cdoPackage, id);
+ }
+
+ String packageURI = cdoPackage.getPackageURI();
+ String name = cdoPackage.getName();
+ String ecore = cdoPackage.getEcore();
+ boolean dynamic = cdoPackage.isDynamic();
+ CDOIDMetaRange metaIDRange = cdoPackage.getMetaIDRange();
+ long lowerBound = metaIDRange == null ? 0L : ((CDOIDMeta)metaIDRange.getLowerBound()).getLongValue();
+ long upperBound = metaIDRange == null ? 0L : ((CDOIDMeta)metaIDRange.getUpperBound()).getLongValue();
+ String parentURI = cdoPackage.getParentURI();
+
+ String sql = "INSERT INTO " + CDODBSchema.PACKAGES + " VALUES (?, ?, ?, ?, ?, ?, ?, ?)";
+ DBUtil.trace(sql);
+ PreparedStatement pstmt = null;
+
+ try
+ {
+ pstmt = getConnection().prepareStatement(sql);
+ pstmt.setInt(1, id);
+ pstmt.setString(2, packageURI);
+ pstmt.setString(3, name);
+ pstmt.setString(4, ecore);
+ pstmt.setBoolean(5, dynamic);
+ pstmt.setLong(6, lowerBound);
+ pstmt.setLong(7, upperBound);
+ pstmt.setString(8, parentURI);
+
+ if (pstmt.execute())
+ {
+ throw new DBException("No result set expected");
+ }
+
+ if (pstmt.getUpdateCount() == 0)
+ {
+ throw new DBException("No row inserted into table " + CDODBSchema.PACKAGES);
+ }
+ }
+ catch (SQLException ex)
+ {
+ throw new DBException(ex);
+ }
+ finally
+ {
+ DBUtil.close(pstmt);
+ }
+
+ super.writePackage(cdoPackage);
+ }
+
+ @Override
+ protected void writeClass(InternalCDOClass cdoClass)
+ {
+ int id = getStore().getNextClassID();
+ ClassServerInfo.setDBID(cdoClass, id);
+
+ CDOPackage cdoPackage = cdoClass.getContainingPackage();
+ int packageID = ServerInfo.getDBID(cdoPackage);
+ int classifierID = cdoClass.getClassifierID();
+ String name = cdoClass.getName();
+ boolean isAbstract = cdoClass.isAbstract();
+ DBUtil.insertRow(getConnection(), getStore().getDBAdapter(), CDODBSchema.CLASSES, id, packageID, classifierID,
+ name, isAbstract);
+
+ super.writeClass(cdoClass);
+ }
+
+ @Override
+ protected void writeSuperType(InternalCDOClass type, CDOClassProxy superType)
+ {
+ int id = ClassServerInfo.getDBID(type);
+ String packageURI = superType.getPackageURI();
+ int classifierID = superType.getClassifierID();
+ DBUtil.insertRow(getConnection(), getStore().getDBAdapter(), CDODBSchema.SUPERTYPES, id, packageURI, classifierID);
+ }
+
+ @Override
+ protected void writeFeature(CDOFeature feature)
+ {
+ int id = getStore().getNextFeatureID();
+ FeatureServerInfo.setDBID(feature, id);
+
+ int classID = ServerInfo.getDBID(feature.getContainingClass());
+ String name = feature.getName();
+ int featureID = feature.getFeatureID();
+ int type = feature.getType().getTypeID();
+ CDOClassProxy reference = ((InternalCDOFeature)feature).getReferenceTypeProxy();
+ String packageURI = reference == null ? null : reference.getPackageURI();
+ int classifierID = reference == null ? 0 : reference.getClassifierID();
+ boolean many = feature.isMany();
+ boolean containment = feature.isContainment();
+ int idx = feature.getFeatureIndex();
+ DBUtil.insertRow(getConnection(), getStore().getDBAdapter(), CDODBSchema.FEATURES, id, classID, featureID, name,
+ type, packageURI, classifierID, many, containment, idx);
+ }
+
+ @Override
+ protected void writeRevision(CDORevision revision)
+ {
+ if (TRACER.isEnabled())
+ {
+ TRACER.format("Writing revision: {0}", revision);
+ }
+
+ CDOClass cdoClass = revision.getCDOClass();
+ IMappingStrategy mappingStrategy = getStore().getMappingStrategy();
+ IClassMapping mapping = mappingStrategy.getClassMapping(cdoClass);
+ mapping.writeRevision(this, revision);
+ }
+}
diff --git a/plugins/org.eclipse.emf.cdo.server.db/src/org/eclipse/emf/cdo/server/internal/db/FeatureMapping.java b/plugins/org.eclipse.emf.cdo.server.db/src/org/eclipse/emf/cdo/server/internal/db/FeatureMapping.java
new file mode 100644
index 0000000000..d71f14d6ad
--- /dev/null
+++ b/plugins/org.eclipse.emf.cdo.server.db/src/org/eclipse/emf/cdo/server/internal/db/FeatureMapping.java
@@ -0,0 +1,46 @@
+/***************************************************************************
+ * Copyright (c) 2004 - 2008 Eike Stepper, Germany.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Eike Stepper - initial API and implementation
+ **************************************************************************/
+package org.eclipse.emf.cdo.server.internal.db;
+
+import org.eclipse.emf.cdo.common.model.CDOFeature;
+
+import org.eclipse.net4j.db.IDBAdapter;
+
+/**
+ * @author Eike Stepper
+ */
+public class FeatureMapping
+{
+ private ClassMapping classMapping;
+
+ private CDOFeature feature;
+
+ public FeatureMapping(ClassMapping classMapping, CDOFeature feature)
+ {
+ this.classMapping = classMapping;
+ this.feature = feature;
+ }
+
+ public ClassMapping getClassMapping()
+ {
+ return classMapping;
+ }
+
+ public CDOFeature getFeature()
+ {
+ return feature;
+ }
+
+ protected IDBAdapter getDBAdapter()
+ {
+ return getClassMapping().getMappingStrategy().getStore().getDBAdapter();
+ }
+}
diff --git a/plugins/org.eclipse.emf.cdo.server.db/src/org/eclipse/emf/cdo/server/internal/db/FeatureServerInfo.java b/plugins/org.eclipse.emf.cdo.server.db/src/org/eclipse/emf/cdo/server/internal/db/FeatureServerInfo.java
new file mode 100644
index 0000000000..03e9ab9682
--- /dev/null
+++ b/plugins/org.eclipse.emf.cdo.server.db/src/org/eclipse/emf/cdo/server/internal/db/FeatureServerInfo.java
@@ -0,0 +1,32 @@
+/***************************************************************************
+ * Copyright (c) 2004 - 2008 Eike Stepper, Germany.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Eike Stepper - initial API and implementation
+ **************************************************************************/
+package org.eclipse.emf.cdo.server.internal.db;
+
+import org.eclipse.emf.cdo.common.model.CDOFeature;
+import org.eclipse.emf.cdo.spi.common.InternalCDOFeature;
+
+/**
+ * @author Eike Stepper
+ */
+public final class FeatureServerInfo extends ServerInfo
+{
+ private FeatureServerInfo(int id)
+ {
+ super(id);
+ }
+
+ public static FeatureServerInfo setDBID(CDOFeature cdoFeature, int id)
+ {
+ FeatureServerInfo serverInfo = new FeatureServerInfo(id);
+ ((InternalCDOFeature)cdoFeature).setServerInfo(serverInfo);
+ return serverInfo;
+ }
+}
diff --git a/plugins/org.eclipse.emf.cdo.server.db/src/org/eclipse/emf/cdo/server/internal/db/HorizontalClassMapping.java b/plugins/org.eclipse.emf.cdo.server.db/src/org/eclipse/emf/cdo/server/internal/db/HorizontalClassMapping.java
new file mode 100644
index 0000000000..cc79018bbc
--- /dev/null
+++ b/plugins/org.eclipse.emf.cdo.server.db/src/org/eclipse/emf/cdo/server/internal/db/HorizontalClassMapping.java
@@ -0,0 +1,51 @@
+/***************************************************************************
+ * Copyright (c) 2004 - 2008 Eike Stepper, Germany.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Eike Stepper - initial API and implementation
+ **************************************************************************/
+package org.eclipse.emf.cdo.server.internal.db;
+
+import org.eclipse.emf.cdo.common.id.CDOID;
+import org.eclipse.emf.cdo.common.model.CDOClass;
+import org.eclipse.emf.cdo.common.revision.CDORevision;
+import org.eclipse.emf.cdo.server.db.IDBStoreWriter;
+
+/**
+ * @author Eike Stepper
+ */
+public class HorizontalClassMapping extends ClassMapping
+{
+ public HorizontalClassMapping(HorizontalMappingStrategy mappingStrategy, CDOClass cdoClass)
+ {
+ super(mappingStrategy, cdoClass, cdoClass.getAllFeatures());
+ }
+
+ @Override
+ public HorizontalMappingStrategy getMappingStrategy()
+ {
+ return (HorizontalMappingStrategy)super.getMappingStrategy();
+ }
+
+ @Override
+ public void writeRevision(IDBStoreWriter storeWriter, CDORevision revision)
+ {
+ super.writeRevision(storeWriter, revision);
+ if (revision.getVersion() == 1)
+ {
+ CDOID id = revision.getID();
+ CDOClass type = revision.getCDOClass();
+ getMappingStrategy().getObjectTypeCache().putObjectType(storeWriter, id, type);
+ }
+ }
+
+ @Override
+ protected boolean hasFullRevisionInfo()
+ {
+ return true;
+ }
+}
diff --git a/plugins/org.eclipse.emf.cdo.server.db/src/org/eclipse/emf/cdo/server/internal/db/HorizontalMappingStrategy.java b/plugins/org.eclipse.emf.cdo.server.db/src/org/eclipse/emf/cdo/server/internal/db/HorizontalMappingStrategy.java
new file mode 100644
index 0000000000..045632678c
--- /dev/null
+++ b/plugins/org.eclipse.emf.cdo.server.db/src/org/eclipse/emf/cdo/server/internal/db/HorizontalMappingStrategy.java
@@ -0,0 +1,166 @@
+/***************************************************************************
+ * Copyright (c) 2004 - 2008 Eike Stepper, Germany.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Eike Stepper - initial API and implementation
+ **************************************************************************/
+package org.eclipse.emf.cdo.server.internal.db;
+
+import org.eclipse.emf.cdo.common.id.CDOID;
+import org.eclipse.emf.cdo.common.model.CDOClass;
+import org.eclipse.emf.cdo.common.model.CDOClassRef;
+import org.eclipse.emf.cdo.common.model.CDOPackage;
+import org.eclipse.emf.cdo.server.IPackageManager;
+import org.eclipse.emf.cdo.server.db.IClassMapping;
+import org.eclipse.emf.cdo.server.db.IDBStore;
+import org.eclipse.emf.cdo.server.db.IDBStoreReader;
+import org.eclipse.emf.cdo.server.db.IObjectTypeCache;
+import org.eclipse.emf.cdo.server.internal.db.bundle.OM;
+
+import org.eclipse.net4j.db.DBException;
+import org.eclipse.net4j.db.DBUtil;
+import org.eclipse.net4j.db.ddl.IDBTable;
+import org.eclipse.net4j.util.lifecycle.LifecycleUtil;
+import org.eclipse.net4j.util.om.trace.ContextTracer;
+
+import java.sql.ResultSet;
+import java.sql.SQLException;
+import java.util.ArrayList;
+import java.util.List;
+
+/**
+ * @author Eike Stepper
+ */
+public class HorizontalMappingStrategy extends MappingStrategy
+{
+ private static final ContextTracer TRACER = new ContextTracer(OM.DEBUG, HorizontalMappingStrategy.class);
+
+ private IObjectTypeCache objectTypeCache;
+
+ public HorizontalMappingStrategy()
+ {
+ }
+
+ public String getType()
+ {
+ return "horizontal";
+ }
+
+ public IObjectTypeCache getObjectTypeCache()
+ {
+ return objectTypeCache;
+ }
+
+ public void setObjectTypeCache(IObjectTypeCache objectTypeCache)
+ {
+ this.objectTypeCache = objectTypeCache;
+ }
+
+ public CDOClassRef readObjectType(IDBStoreReader storeReader, CDOID id)
+ {
+ return objectTypeCache.getObjectType(storeReader, id);
+ }
+
+ protected CDOClassRef readObjectTypeFromClassesWithObjectInfo(IDBStoreReader storeReader, CDOID id)
+ {
+ String prefix = "SELECT DISTINCT " + CDODBSchema.ATTRIBUTES_CLASS + " FROM ";
+ String suffix = " WHERE " + CDODBSchema.ATTRIBUTES_ID + "=" + id;
+ for (CDOClass cdoClass : getClassesWithObjectInfo())
+ {
+ IClassMapping mapping = getClassMapping(cdoClass);
+ if (mapping != null)
+ {
+ IDBTable table = mapping.getTable();
+ if (table != null)
+ {
+ String sql = prefix + table + suffix;
+ if (TRACER.isEnabled())
+ {
+ TRACER.trace(sql);
+ }
+ ResultSet resultSet = null;
+
+ try
+ {
+ resultSet = storeReader.getStatement().executeQuery(sql);
+ if (resultSet.next())
+ {
+ int classID = resultSet.getInt(1);
+ return getClassRef(storeReader, classID);
+ }
+ }
+ catch (SQLException ex)
+ {
+ throw new DBException(ex);
+ }
+ finally
+ {
+ DBUtil.close(resultSet);
+ }
+ }
+ }
+ }
+
+ throw new DBException("No object with id " + id);
+ }
+
+ @Override
+ protected IClassMapping createClassMapping(CDOClass cdoClass)
+ {
+ if (cdoClass.isAbstract())
+ {
+ return null;
+ }
+
+ return new HorizontalClassMapping(this, cdoClass);
+ }
+
+ @Override
+ protected List<CDOClass> getClassesWithObjectInfo()
+ {
+ List<CDOClass> result = new ArrayList<CDOClass>();
+ IPackageManager packageManager = getStore().getRepository().getPackageManager();
+ for (CDOPackage cdoPackage : packageManager.getPackages())
+ {
+ for (CDOClass cdoClass : cdoPackage.getConcreteClasses())
+ {
+ if (!cdoClass.isRoot())
+ {
+ result.add(cdoClass);
+ }
+ }
+ }
+
+ return result;
+ }
+
+ @Override
+ protected void doActivate() throws Exception
+ {
+ super.doActivate();
+ if (objectTypeCache == null)
+ {
+ objectTypeCache = createObjectTypeCache(getStore());
+ LifecycleUtil.activate(objectTypeCache);
+ }
+ }
+
+ @Override
+ protected void doDeactivate() throws Exception
+ {
+ LifecycleUtil.deactivate(objectTypeCache);
+ objectTypeCache = null;
+ super.doDeactivate();
+ }
+
+ protected IObjectTypeCache createObjectTypeCache(IDBStore store)
+ {
+ ObjectTypeCache cache = new ObjectTypeCache();
+ cache.setMappingStrategy(this);
+ return cache;
+ }
+}
diff --git a/plugins/org.eclipse.emf.cdo.server.db/src/org/eclipse/emf/cdo/server/internal/db/MappingStrategy.java b/plugins/org.eclipse.emf.cdo.server.db/src/org/eclipse/emf/cdo/server/internal/db/MappingStrategy.java
new file mode 100644
index 0000000000..fedc46aadf
--- /dev/null
+++ b/plugins/org.eclipse.emf.cdo.server.db/src/org/eclipse/emf/cdo/server/internal/db/MappingStrategy.java
@@ -0,0 +1,377 @@
+/***************************************************************************
+ * Copyright (c) 2004 - 2008 Eike Stepper, Germany.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Eike Stepper - initial API and implementation
+ **************************************************************************/
+package org.eclipse.emf.cdo.server.internal.db;
+
+import org.eclipse.emf.cdo.common.id.CDOID;
+import org.eclipse.emf.cdo.common.id.CDOIDUtil;
+import org.eclipse.emf.cdo.common.model.CDOClass;
+import org.eclipse.emf.cdo.common.model.CDOClassRef;
+import org.eclipse.emf.cdo.common.model.resource.CDOPathFeature;
+import org.eclipse.emf.cdo.common.model.resource.CDOResourceClass;
+import org.eclipse.emf.cdo.server.IPackageManager;
+import org.eclipse.emf.cdo.server.db.IAttributeMapping;
+import org.eclipse.emf.cdo.server.db.IClassMapping;
+import org.eclipse.emf.cdo.server.db.IDBStore;
+import org.eclipse.emf.cdo.server.db.IDBStoreReader;
+import org.eclipse.emf.cdo.server.db.IMappingStrategy;
+import org.eclipse.emf.cdo.server.internal.db.bundle.OM;
+
+import org.eclipse.net4j.db.DBException;
+import org.eclipse.net4j.db.DBUtil;
+import org.eclipse.net4j.db.ddl.IDBField;
+import org.eclipse.net4j.db.ddl.IDBTable;
+import org.eclipse.net4j.util.collection.CloseableIterator;
+import org.eclipse.net4j.util.lifecycle.Lifecycle;
+import org.eclipse.net4j.util.om.trace.ContextTracer;
+
+import java.sql.Connection;
+import java.sql.ResultSet;
+import java.sql.SQLException;
+import java.sql.Statement;
+import java.util.HashMap;
+import java.util.Iterator;
+import java.util.List;
+import java.util.Map;
+
+/**
+ * @author Eike Stepper
+ */
+public abstract class MappingStrategy extends Lifecycle implements IMappingStrategy
+{
+ private static final ContextTracer TRACER = new ContextTracer(OM.DEBUG, MappingStrategy.class);
+
+ public static final String PROP_TO_MANY_REFERENCE_MAPPING = "toManyReferenceMapping";
+
+ public static final String PROP_TO_ONE_REFERENCE_MAPPING = "toOneReferenceMapping";
+
+ private IDBStore store;
+
+ private Map<String, String> properties;
+
+ private Map<Object, IDBTable> referenceTables = new HashMap<Object, IDBTable>();
+
+ private Map<Integer, CDOClassRef> classRefs = new HashMap<Integer, CDOClassRef>();
+
+ private IClassMapping resourceClassMapping;
+
+ private IAttributeMapping resourcePathMapping;
+
+ private IDBTable resourceTable;
+
+ private IDBField resourceIDField;
+
+ private IDBField resourcePathField;
+
+ public MappingStrategy()
+ {
+ }
+
+ public IDBStore getStore()
+ {
+ return store;
+ }
+
+ public void setStore(IDBStore store)
+ {
+ this.store = store;
+ }
+
+ public synchronized Map<String, String> getProperties()
+ {
+ if (properties == null)
+ {
+ properties = new HashMap<String, String>();
+ }
+
+ return properties;
+ }
+
+ public synchronized void setProperties(Map<String, String> properties)
+ {
+ this.properties = properties;
+ }
+
+ public ToMany getToMany()
+ {
+ String value = getProperties().get(PROP_TO_MANY_REFERENCE_MAPPING);
+ return value == null ? ToMany.PER_REFERENCE : ToMany.valueOf(value);
+ }
+
+ public ToOne getToOne()
+ {
+ String value = getProperties().get(PROP_TO_ONE_REFERENCE_MAPPING);
+ return value == null ? ToOne.LIKE_ATTRIBUTES : ToOne.valueOf(value);
+ }
+
+ public Map<Object, IDBTable> getReferenceTables()
+ {
+ return referenceTables;
+ }
+
+ public CDOClassRef getClassRef(IDBStoreReader storeReader, int classID)
+ {
+ CDOClassRef classRef = classRefs.get(classID);
+ if (classRef == null)
+ {
+ if (classID == ClassServerInfo.CDO_RESOURCE_CLASS_DBID)
+ {
+ IPackageManager packageManager = getStore().getRepository().getPackageManager();
+ CDOResourceClass resourceClass = packageManager.getCDOResourcePackage().getCDOResourceClass();
+ classRef = resourceClass.createClassRef();
+ }
+ else
+ {
+ classRef = storeReader.readClassRef(classID);
+ }
+
+ classRefs.put(classID, classRef);
+ }
+
+ return classRef;
+ }
+
+ public IClassMapping getClassMapping(CDOClass cdoClass)
+ {
+ IClassMapping mapping = ClassServerInfo.getClassMapping(cdoClass);
+ if (mapping == NoClassMapping.INSTANCE)
+ {
+ return null;
+ }
+
+ if (mapping == null)
+ {
+ mapping = createClassMapping(cdoClass);
+ ClassServerInfo.setClassMapping(cdoClass, mapping == null ? NoClassMapping.INSTANCE : mapping);
+ }
+
+ return mapping;
+ }
+
+ public IClassMapping getResourceClassMapping()
+ {
+ if (resourceClassMapping == null)
+ {
+ initResourceInfos();
+ }
+
+ return resourceClassMapping;
+ }
+
+ public IAttributeMapping getResourcePathMapping()
+ {
+ if (resourcePathMapping == null)
+ {
+ initResourceInfos();
+ }
+
+ return resourcePathMapping;
+ }
+
+ public IDBTable getResourceTable()
+ {
+ if (resourceTable == null)
+ {
+ initResourceInfos();
+ }
+
+ return resourceTable;
+ }
+
+ public IDBField getResourceIDField()
+ {
+ if (resourceIDField == null)
+ {
+ initResourceInfos();
+ }
+
+ return resourceIDField;
+ }
+
+ public IDBField getResourcePathField()
+ {
+ if (resourcePathField == null)
+ {
+ initResourceInfos();
+ }
+
+ return resourcePathField;
+ }
+
+ protected void initResourceInfos()
+ {
+ IPackageManager packageManager = getStore().getRepository().getPackageManager();
+ CDOResourceClass resourceClass = packageManager.getCDOResourcePackage().getCDOResourceClass();
+ CDOPathFeature pathFeature = packageManager.getCDOResourcePackage().getCDOResourceClass().getCDOPathFeature();
+
+ resourceClassMapping = getClassMapping(resourceClass);
+ resourcePathMapping = resourceClassMapping.getAttributeMapping(pathFeature);
+
+ resourceTable = resourceClassMapping.getTable();
+ resourceIDField = resourceTable.getField(CDODBSchema.ATTRIBUTES_ID);
+ resourcePathField = resourcePathMapping.getField();
+ }
+
+ public CloseableIterator<CDOID> readObjectIDs(final IDBStoreReader storeReader, final boolean withTypes)
+ {
+ List<CDOClass> classes = getClassesWithObjectInfo();
+ final Iterator<CDOClass> classIt = classes.iterator();
+ return new ObjectIDIterator(this, storeReader, withTypes)
+ {
+ @Override
+ protected ResultSet getNextResultSet()
+ {
+ while (classIt.hasNext())
+ {
+ CDOClass cdoClass = classIt.next();
+ IClassMapping mapping = getClassMapping(cdoClass);
+ if (mapping != null)
+ {
+ IDBTable table = mapping.getTable();
+ if (table != null)
+ {
+ StringBuilder builder = new StringBuilder();
+ builder.append("SELECT DISTINCT ");
+ builder.append(CDODBSchema.ATTRIBUTES_ID);
+ if (withTypes)
+ {
+ builder.append(", ");
+ builder.append(CDODBSchema.ATTRIBUTES_CLASS);
+ }
+
+ builder.append(" FROM ");
+ builder.append(table);
+ String sql = builder.toString();
+
+ try
+ {
+ return storeReader.getStatement().executeQuery(sql);
+ }
+ catch (SQLException ex)
+ {
+ throw new DBException(ex);
+ }
+ }
+ }
+ }
+
+ return null;
+ }
+ };
+ }
+
+ public CDOID readResourceID(IDBStoreReader storeReader, String path)
+ {
+ IDBTable resourceTable = getResourceTable();
+ IDBField selectField = getResourceIDField();
+ IDBField whereField = getResourcePathField();
+ return (CDOID)readResourceInfo(storeReader, resourceTable, selectField, whereField, path);
+ }
+
+ public String readResourcePath(IDBStoreReader storeReader, CDOID id)
+ {
+ IDBTable resourceTable = getResourceTable();
+ IDBField selectField = getResourcePathField();
+ IDBField whereField = getResourceIDField();
+ Object whereValue = CDOIDUtil.getLong(id);
+ return (String)readResourceInfo(storeReader, resourceTable, selectField, whereField, whereValue);
+ }
+
+ protected Object readResourceInfo(IDBStoreReader storeReader, IDBTable resourceTable, IDBField selectField,
+ IDBField whereField, Object whereValue)
+ {
+ StringBuilder builder = new StringBuilder();
+ builder.append("SELECT ");
+ builder.append(selectField);
+ builder.append(" FROM ");
+ builder.append(resourceTable);
+ builder.append(" WHERE ");
+ builder.append(whereField);
+ builder.append("=");
+ getStore().getDBAdapter().appendValue(builder, whereField, whereValue);
+
+ String sql = builder.toString();
+ if (TRACER.isEnabled())
+ {
+ TRACER.trace(sql);
+ }
+
+ ResultSet resultSet = null;
+
+ try
+ {
+ Statement statement = storeReader.getStatement();
+ statement.setMaxRows(1); // Reset by DBUtil.close(resultSet)
+
+ resultSet = statement.executeQuery(sql);
+ if (!resultSet.next())
+ {
+ return null;
+ }
+
+ if (whereValue instanceof CDOID)
+ {
+ String path = resultSet.getString(1);
+ return path;
+ }
+
+ long id = resultSet.getLong(1);
+ return CDOIDUtil.createLong(id);
+ }
+ catch (SQLException ex)
+ {
+ throw new DBException(ex);
+ }
+ finally
+ {
+ DBUtil.close(resultSet);
+ }
+ }
+
+ public long repairAfterCrash(Connection connection)
+ {
+ long maxCDOID = 0L;
+ for (CDOClass idClass : getClassesWithObjectInfo())
+ {
+ IClassMapping classMapping = getClassMapping(idClass);
+ IDBTable table = classMapping.getTable();
+ IDBField idField = table.getField(CDODBSchema.ATTRIBUTES_ID);
+ long classMaxCDOID = DBUtil.selectMaximumLong(connection, idField);
+ if (TRACER.isEnabled())
+ {
+ TRACER.format("Max CDOID of table {0}: {1}", table, classMaxCDOID);
+ }
+
+ maxCDOID = Math.max(maxCDOID, classMaxCDOID);
+ }
+
+ return maxCDOID + 2L;
+ }
+
+ @Override
+ public String toString()
+ {
+ return getType();
+ }
+
+ /**
+ * The implementation of this method must take care of creating a unique ids to prevent duplicate resource paths.
+ */
+ protected abstract IClassMapping createClassMapping(CDOClass cdoClass);
+
+ protected abstract List<CDOClass> getClassesWithObjectInfo();
+
+ @Override
+ protected void doBeforeActivate() throws Exception
+ {
+ super.doBeforeActivate();
+ checkState(store, "store");
+ }
+}
diff --git a/plugins/org.eclipse.emf.cdo.server.db/src/org/eclipse/emf/cdo/server/internal/db/NoClassMapping.java b/plugins/org.eclipse.emf.cdo.server.db/src/org/eclipse/emf/cdo/server/internal/db/NoClassMapping.java
new file mode 100644
index 0000000000..ce70f8171d
--- /dev/null
+++ b/plugins/org.eclipse.emf.cdo.server.db/src/org/eclipse/emf/cdo/server/internal/db/NoClassMapping.java
@@ -0,0 +1,95 @@
+/***************************************************************************
+ * Copyright (c) 2004 - 2008 Eike Stepper, Germany.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Eike Stepper - initial API and implementation
+ **************************************************************************/
+package org.eclipse.emf.cdo.server.internal.db;
+
+import org.eclipse.emf.cdo.common.model.CDOClass;
+import org.eclipse.emf.cdo.common.model.CDOFeature;
+import org.eclipse.emf.cdo.common.revision.CDORevision;
+import org.eclipse.emf.cdo.server.db.IAttributeMapping;
+import org.eclipse.emf.cdo.server.db.IClassMapping;
+import org.eclipse.emf.cdo.server.db.IDBStoreReader;
+import org.eclipse.emf.cdo.server.db.IDBStoreWriter;
+import org.eclipse.emf.cdo.server.db.IMappingStrategy;
+import org.eclipse.emf.cdo.server.db.IReferenceMapping;
+
+import org.eclipse.net4j.db.ddl.IDBTable;
+
+import java.util.Collections;
+import java.util.List;
+import java.util.Set;
+
+/**
+ * @author Eike Stepper
+ */
+public class NoClassMapping implements IClassMapping
+{
+ public static final IClassMapping INSTANCE = new NoClassMapping();
+
+ private NoClassMapping()
+ {
+ }
+
+ public IMappingStrategy getMappingStrategy()
+ {
+ return null;
+ }
+
+ public CDOClass getCDOClass()
+ {
+ return null;
+ }
+
+ public IDBTable getTable()
+ {
+ return null;
+ }
+
+ public Set<IDBTable> getAffectedTables()
+ {
+ return Collections.emptySet();
+ }
+
+ public List<IAttributeMapping> getAttributeMappings()
+ {
+ return null;
+ }
+
+ public List<IReferenceMapping> getReferenceMappings()
+ {
+ return null;
+ }
+
+ public IAttributeMapping getAttributeMapping(CDOFeature feature)
+ {
+ return null;
+ }
+
+ public IReferenceMapping getReferenceMapping(CDOFeature feature)
+ {
+ return null;
+ }
+
+ public void writeRevision(IDBStoreWriter storeWriter, CDORevision revision)
+ {
+ }
+
+ public void readRevision(IDBStoreReader storeReader, CDORevision revision, int referenceChunk)
+ {
+ }
+
+ public void readRevisionByTime(IDBStoreReader storeReader, CDORevision revision, long timeStamp, int referenceChunk)
+ {
+ }
+
+ public void readRevisionByVersion(IDBStoreReader storeReader, CDORevision revision, int version, int referenceChunk)
+ {
+ }
+}
diff --git a/plugins/org.eclipse.emf.cdo.server.db/src/org/eclipse/emf/cdo/server/internal/db/ObjectIDIterator.java b/plugins/org.eclipse.emf.cdo.server.db/src/org/eclipse/emf/cdo/server/internal/db/ObjectIDIterator.java
new file mode 100644
index 0000000000..a24819cb6e
--- /dev/null
+++ b/plugins/org.eclipse.emf.cdo.server.db/src/org/eclipse/emf/cdo/server/internal/db/ObjectIDIterator.java
@@ -0,0 +1,123 @@
+/***************************************************************************
+ * Copyright (c) 2004 - 2008 Eike Stepper, Germany.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Eike Stepper - initial API and implementation
+ **************************************************************************/
+package org.eclipse.emf.cdo.server.internal.db;
+
+import org.eclipse.emf.cdo.common.id.CDOID;
+import org.eclipse.emf.cdo.common.id.CDOIDObject;
+import org.eclipse.emf.cdo.common.id.CDOIDUtil;
+import org.eclipse.emf.cdo.common.model.CDOClassRef;
+import org.eclipse.emf.cdo.server.db.IDBStoreReader;
+
+import org.eclipse.net4j.db.DBException;
+import org.eclipse.net4j.db.DBUtil;
+import org.eclipse.net4j.util.collection.CloseableIterator;
+
+import java.sql.ResultSet;
+import java.sql.SQLException;
+
+/**
+ * @author Eike Stepper
+ */
+public abstract class ObjectIDIterator implements CloseableIterator<CDOID>
+{
+ private MappingStrategy mappingStrategy;
+
+ private IDBStoreReader storeReader;
+
+ private boolean withTypes;
+
+ private ResultSet currentResultSet;
+
+ private CDOID nextID;
+
+ /**
+ * Creates an iterator over all objects in a store. It is important to {@link #dispose()} of this iterator after usage
+ * to properly close internal result sets.
+ */
+ public ObjectIDIterator(MappingStrategy mappingStrategy, IDBStoreReader storeReader, boolean withTypes)
+ {
+ this.mappingStrategy = mappingStrategy;
+ this.storeReader = storeReader;
+ this.withTypes = withTypes;
+ }
+
+ public void close()
+ {
+ DBUtil.close(currentResultSet);
+ }
+
+ public MappingStrategy getMappingStrategy()
+ {
+ return mappingStrategy;
+ }
+
+ public IDBStoreReader getStoreReader()
+ {
+ return storeReader;
+ }
+
+ public boolean isWithTypes()
+ {
+ return withTypes;
+ }
+
+ public boolean hasNext()
+ {
+ nextID = null;
+ for (;;)
+ {
+ if (currentResultSet == null)
+ {
+ currentResultSet = getNextResultSet();
+ if (currentResultSet == null)
+ {
+ return false;
+ }
+ }
+
+ try
+ {
+ if (currentResultSet.next())
+ {
+ long id = currentResultSet.getLong(1);
+ nextID = CDOIDUtil.createLong(id);
+ if (withTypes && nextID instanceof CDOIDObject)
+ {
+ int classID = currentResultSet.getInt(2);
+ CDOClassRef classRef = mappingStrategy.getClassRef(storeReader, classID);
+ nextID = ((CDOIDObject)nextID).asLegacy(classRef);
+ }
+
+ return true;
+ }
+
+ DBUtil.close(currentResultSet);
+ currentResultSet = null;
+ }
+ catch (SQLException ex)
+ {
+ throw new DBException(ex);
+ }
+ }
+ }
+
+ public CDOID next()
+ {
+ return nextID;
+ }
+
+ public void remove()
+ {
+ throw new UnsupportedOperationException();
+ }
+
+ protected abstract ResultSet getNextResultSet();
+}
diff --git a/plugins/org.eclipse.emf.cdo.server.db/src/org/eclipse/emf/cdo/server/internal/db/ObjectTypeCache.java b/plugins/org.eclipse.emf.cdo.server.db/src/org/eclipse/emf/cdo/server/internal/db/ObjectTypeCache.java
new file mode 100644
index 0000000000..71cfe61e8a
--- /dev/null
+++ b/plugins/org.eclipse.emf.cdo.server.db/src/org/eclipse/emf/cdo/server/internal/db/ObjectTypeCache.java
@@ -0,0 +1,167 @@
+/***************************************************************************
+ * Copyright (c) 2004 - 2008 Eike Stepper, Germany.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Eike Stepper - initial API and implementation
+ **************************************************************************/
+package org.eclipse.emf.cdo.server.internal.db;
+
+import org.eclipse.emf.cdo.common.id.CDOID;
+import org.eclipse.emf.cdo.common.id.CDOIDUtil;
+import org.eclipse.emf.cdo.common.model.CDOClass;
+import org.eclipse.emf.cdo.common.model.CDOClassRef;
+import org.eclipse.emf.cdo.server.db.IDBStoreReader;
+import org.eclipse.emf.cdo.server.db.IDBStoreWriter;
+import org.eclipse.emf.cdo.server.db.IObjectTypeCache;
+
+import org.eclipse.net4j.db.DBException;
+import org.eclipse.net4j.db.DBType;
+import org.eclipse.net4j.db.DBUtil;
+import org.eclipse.net4j.db.IDBAdapter;
+import org.eclipse.net4j.db.ddl.IDBField;
+import org.eclipse.net4j.db.ddl.IDBIndex;
+import org.eclipse.net4j.db.ddl.IDBSchema;
+import org.eclipse.net4j.db.ddl.IDBTable;
+import org.eclipse.net4j.util.lifecycle.Lifecycle;
+
+import java.sql.ResultSet;
+import java.sql.SQLException;
+import java.sql.Statement;
+
+/**
+ * @author Eike Stepper
+ */
+public class ObjectTypeCache extends Lifecycle implements IObjectTypeCache
+{
+ private MappingStrategy mappingStrategy;
+
+ private IDBTable table;
+
+ private IDBField idField;
+
+ private IDBField typeField;
+
+ private transient Object initializeLock = new Object();
+
+ public ObjectTypeCache()
+ {
+ }
+
+ public MappingStrategy getMappingStrategy()
+ {
+ return mappingStrategy;
+ }
+
+ public void setMappingStrategy(MappingStrategy mappingStrategy)
+ {
+ this.mappingStrategy = mappingStrategy;
+ }
+
+ public CDOClassRef getObjectType(IDBStoreReader storeReader, CDOID id)
+ {
+ Statement statement = storeReader.getStatement();
+ initialize(statement);
+
+ StringBuilder builder = new StringBuilder();
+ builder.append("SELECT ");
+ builder.append(typeField);
+ builder.append(" FROM ");
+ builder.append(table);
+ builder.append(" WHERE ");
+ builder.append(idField);
+ builder.append("=");
+ builder.append(CDOIDUtil.getLong(id));
+ String sql = builder.toString();
+ DBUtil.trace(sql);
+
+ ResultSet resultSet = null;
+
+ try
+ {
+ resultSet = statement.executeQuery(sql);
+ if (!resultSet.next())
+ {
+ throw new DBException("ClassID for CDOID " + id + " not found");
+ }
+
+ int classID = resultSet.getInt(1);
+ return mappingStrategy.getClassRef(storeReader, classID);
+ }
+ catch (SQLException ex)
+ {
+ throw new DBException(ex);
+ }
+ finally
+ {
+ DBUtil.close(resultSet);
+ }
+ }
+
+ public void putObjectType(IDBStoreWriter storeWriter, CDOID id, CDOClass type)
+ {
+ Statement statement = storeWriter.getStatement();
+ initialize(statement);
+
+ StringBuilder builder = new StringBuilder();
+ builder.append("INSERT INTO ");
+ builder.append(table);
+ builder.append(" VALUES (");
+ builder.append(CDOIDUtil.getLong(id));
+ builder.append(", ");
+ builder.append(ClassServerInfo.getDBID(type));
+ builder.append(")");
+ String sql = builder.toString();
+ DBUtil.trace(sql);
+
+ try
+ {
+ statement.execute(sql);
+ if (statement.getUpdateCount() != 1)
+ {
+ throw new DBException("Object type not inserted: " + id + " -> " + type);
+ }
+ }
+ catch (SQLException ex)
+ {
+ throw new DBException(ex);
+ }
+ }
+
+ private void initialize(Statement statement)
+ {
+ synchronized (initializeLock)
+ {
+ if (table == null)
+ {
+ IDBSchema schema = mappingStrategy.getStore().getDBSchema();
+ table = schema.addTable(CDODBSchema.CDO_OBJECTS);
+ idField = table.addField(CDODBSchema.ATTRIBUTES_ID, DBType.BIGINT);
+ typeField = table.addField(CDODBSchema.ATTRIBUTES_CLASS, DBType.INTEGER);
+ table.addIndex(IDBIndex.Type.PRIMARY_KEY, idField);
+
+ IDBAdapter dbAdapter = mappingStrategy.getStore().getDBAdapter();
+ dbAdapter.createTable(table, statement);
+ }
+ }
+ }
+
+ @Override
+ protected void doBeforeActivate() throws Exception
+ {
+ super.doBeforeActivate();
+ checkState(mappingStrategy, "mappingStrategy");
+ }
+
+ @Override
+ protected void doDeactivate() throws Exception
+ {
+ table = null;
+ idField = null;
+ typeField = null;
+ super.doDeactivate();
+ }
+}
diff --git a/plugins/org.eclipse.emf.cdo.server.db/src/org/eclipse/emf/cdo/server/internal/db/PackageServerInfo.java b/plugins/org.eclipse.emf.cdo.server.db/src/org/eclipse/emf/cdo/server/internal/db/PackageServerInfo.java
new file mode 100644
index 0000000000..a368e46e93
--- /dev/null
+++ b/plugins/org.eclipse.emf.cdo.server.db/src/org/eclipse/emf/cdo/server/internal/db/PackageServerInfo.java
@@ -0,0 +1,46 @@
+/***************************************************************************
+ * Copyright (c) 2004 - 2008 Eike Stepper, Germany.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Eike Stepper - initial API and implementation
+ **************************************************************************/
+package org.eclipse.emf.cdo.server.internal.db;
+
+import org.eclipse.emf.cdo.common.model.CDOPackage;
+import org.eclipse.emf.cdo.spi.common.InternalCDOPackage;
+
+import org.eclipse.net4j.db.ddl.IDBSchema;
+
+/**
+ * @author Eike Stepper
+ */
+public final class PackageServerInfo extends ServerInfo
+{
+ private IDBSchema schema;
+
+ private PackageServerInfo(int id)
+ {
+ super(id);
+ }
+
+ public static PackageServerInfo setDBID(CDOPackage cdoPackage, int id)
+ {
+ PackageServerInfo serverInfo = new PackageServerInfo(id);
+ ((InternalCDOPackage)cdoPackage).setServerInfo(serverInfo);
+ return serverInfo;
+ }
+
+ public static IDBSchema getSchema(CDOPackage cdoPackage)
+ {
+ return ((PackageServerInfo)cdoPackage.getServerInfo()).schema;
+ }
+
+ public static void setSchema(CDOPackage cdoPackage, IDBSchema schema)
+ {
+ ((PackageServerInfo)cdoPackage.getServerInfo()).schema = schema;
+ }
+}
diff --git a/plugins/org.eclipse.emf.cdo.server.db/src/org/eclipse/emf/cdo/server/internal/db/ReferenceMapping.java b/plugins/org.eclipse.emf.cdo.server.db/src/org/eclipse/emf/cdo/server/internal/db/ReferenceMapping.java
new file mode 100644
index 0000000000..4bbcf1cac6
--- /dev/null
+++ b/plugins/org.eclipse.emf.cdo.server.db/src/org/eclipse/emf/cdo/server/internal/db/ReferenceMapping.java
@@ -0,0 +1,297 @@
+/***************************************************************************
+ * Copyright (c) 2004 - 2008 Eike Stepper, Germany.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Eike Stepper - initial API and implementation
+ **************************************************************************/
+package org.eclipse.emf.cdo.server.internal.db;
+
+import org.eclipse.emf.cdo.common.id.CDOID;
+import org.eclipse.emf.cdo.common.id.CDOIDUtil;
+import org.eclipse.emf.cdo.common.model.CDOClass;
+import org.eclipse.emf.cdo.common.model.CDOFeature;
+import org.eclipse.emf.cdo.common.model.CDOPackage;
+import org.eclipse.emf.cdo.common.revision.CDORevision;
+import org.eclipse.emf.cdo.server.IRepository;
+import org.eclipse.emf.cdo.server.IStoreChunkReader.Chunk;
+import org.eclipse.emf.cdo.server.db.IDBStoreAccessor;
+import org.eclipse.emf.cdo.server.db.IDBStoreChunkReader;
+import org.eclipse.emf.cdo.server.db.IDBStoreReader;
+import org.eclipse.emf.cdo.server.db.IDBStoreWriter;
+import org.eclipse.emf.cdo.server.db.IReferenceMapping;
+import org.eclipse.emf.cdo.server.internal.db.bundle.OM;
+import org.eclipse.emf.cdo.spi.common.InternalCDORevision;
+
+import org.eclipse.net4j.db.DBException;
+import org.eclipse.net4j.db.DBType;
+import org.eclipse.net4j.db.DBUtil;
+import org.eclipse.net4j.db.ddl.IDBTable;
+import org.eclipse.net4j.util.collection.MoveableList;
+import org.eclipse.net4j.util.om.trace.ContextTracer;
+
+import java.sql.ResultSet;
+import java.sql.SQLException;
+import java.util.List;
+import java.util.Map;
+
+/**
+ * @author Eike Stepper
+ */
+public class ReferenceMapping extends FeatureMapping implements IReferenceMapping
+{
+ private static final ContextTracer TRACER = new ContextTracer(OM.DEBUG, ReferenceMapping.class);
+
+ private static final String SELECT_SUFFIX = " ORDER BY " + CDODBSchema.REFERENCES_IDX;
+
+ private IDBTable table;
+
+ private ToMany toMany;
+
+ private boolean withFeature;
+
+ private String insertPrefix;
+
+ private String selectPrefix;
+
+ public ReferenceMapping(ClassMapping classMapping, CDOFeature feature, ToMany toMany)
+ {
+ super(classMapping, feature);
+ this.toMany = toMany;
+ mapReference(classMapping.getCDOClass(), feature);
+
+ int dbFeatureID = withFeature ? FeatureServerInfo.getDBID(getFeature()) : 0;
+ insertPrefix = createInsertPrefix(dbFeatureID);
+ selectPrefix = createSelectPrefix(dbFeatureID);
+ }
+
+ public IDBTable getTable()
+ {
+ return table;
+ }
+
+ public void writeReference(IDBStoreWriter storeWriter, CDORevision revision)
+ {
+ long source = CDOIDUtil.getLong(revision.getID());
+ int version = revision.getVersion();
+
+ int idx = 0;
+ for (Object element : ((InternalCDORevision)revision).getList(getFeature()))
+ {
+ long target = CDOIDUtil.getLong((CDOID)element);
+ StringBuilder builder = new StringBuilder(insertPrefix);
+ builder.append(source);
+ builder.append(", ");
+ builder.append(version);
+ builder.append(", ");
+ builder.append(idx++);
+ builder.append(", ");
+ builder.append(target);
+ builder.append(")");
+ String sql = builder.toString();
+ getClassMapping().sqlUpdate(storeWriter, sql);
+ }
+ }
+
+ public void readReference(IDBStoreReader storeReader, CDORevision revision, int referenceChunk)
+ {
+ MoveableList<Object> list = ((InternalCDORevision)revision).getList(getFeature());
+ CDOID source = revision.getID();
+ int version = revision.getVersion();
+
+ String sql = createSelect(source, version, null);
+ if (TRACER.isEnabled())
+ {
+ TRACER.trace(sql);
+ }
+ ResultSet resultSet = null;
+
+ try
+ {
+ resultSet = storeReader.getStatement().executeQuery(sql);
+ while (resultSet.next() && (referenceChunk == CDORevision.UNCHUNKED || --referenceChunk >= 0))
+ {
+ long target = resultSet.getLong(1);
+ list.add(CDOIDUtil.createLong(target));
+ }
+
+ // TODO Optimize this?
+ while (resultSet.next())
+ {
+ list.add(InternalCDORevision.UNINITIALIZED);
+ }
+ }
+ catch (SQLException ex)
+ {
+ throw new DBException(ex);
+ }
+ finally
+ {
+ DBUtil.close(resultSet);
+ }
+ }
+
+ public void readChunks(IDBStoreChunkReader chunkReader, List<Chunk> chunks, String where)
+ {
+ IDBStoreAccessor storeAccessor = chunkReader.getStoreReader();
+ CDOID source = chunkReader.getRevision().getID();
+ int version = chunkReader.getRevision().getVersion();
+
+ String sql = createSelect(source, version, where);
+ if (TRACER.isEnabled())
+ {
+ TRACER.trace(sql);
+ }
+ ResultSet resultSet = null;
+
+ try
+ {
+ Chunk chunk = null;
+ int chunkSize = 0;
+ int chunkIndex = 0;
+ int indexInChunk = 0;
+
+ resultSet = storeAccessor.getStatement().executeQuery(sql);
+ while (resultSet.next())
+ {
+ long target = resultSet.getLong(1);
+ if (chunk == null)
+ {
+ chunk = chunks.get(chunkIndex++);
+ chunkSize = chunk.size();
+ }
+
+ chunk.addID(indexInChunk++, CDOIDUtil.createLong(target));
+ if (indexInChunk == chunkSize)
+ {
+ chunk = null;
+ indexInChunk = 0;
+ }
+ }
+ }
+ catch (SQLException ex)
+ {
+ throw new DBException(ex);
+ }
+ finally
+ {
+ DBUtil.close(resultSet);
+ }
+ }
+
+ protected String createInsertPrefix(int dbFeatureID)
+ {
+ StringBuilder builder = new StringBuilder();
+ builder.append("INSERT INTO ");
+ builder.append(table);
+ builder.append(" VALUES (");
+ if (dbFeatureID != 0)
+ {
+ builder.append(FeatureServerInfo.getDBID(getFeature()));
+ builder.append(", ");
+ }
+
+ return builder.toString();
+ }
+
+ protected String createSelectPrefix(int dbFeatureID)
+ {
+ StringBuilder builder = new StringBuilder();
+ builder.append("SELECT ");
+ builder.append(CDODBSchema.REFERENCES_TARGET);
+ builder.append(" FROM ");
+ builder.append(table);
+ builder.append(" WHERE ");
+ if (dbFeatureID != 0)
+ {
+ builder.append(CDODBSchema.REFERENCES_FEATURE);
+ builder.append("=");
+ builder.append(dbFeatureID);
+ builder.append(" AND ");
+ }
+
+ builder.append(CDODBSchema.REFERENCES_SOURCE);
+ builder.append("=");
+ return builder.toString();
+ }
+
+ protected String createSelect(CDOID source, int version, String where)
+ {
+ StringBuilder builder = new StringBuilder(selectPrefix);
+ builder.append(CDOIDUtil.getLong(source));
+ builder.append(" AND ");
+ builder.append(CDODBSchema.REFERENCES_VERSION);
+ builder.append("=");
+ builder.append(version);
+ if (where != null)
+ {
+ builder.append(where);
+ }
+
+ builder.append(SELECT_SUFFIX);
+ return builder.toString();
+ }
+
+ protected void mapReference(CDOClass cdoClass, CDOFeature cdoFeature)
+ {
+ switch (toMany)
+ {
+ case PER_REFERENCE:
+ withFeature = false;
+ table = mapReferenceTable(cdoFeature, cdoClass.getName() + "_" + cdoFeature.getName() + "_refs");
+ break;
+
+ case PER_CLASS:
+ withFeature = true;
+ table = mapReferenceTable(cdoClass, cdoClass.getName() + "_refs");
+ break;
+
+ case PER_PACKAGE:
+ withFeature = true;
+ CDOPackage cdoPackage = cdoClass.getContainingPackage();
+ table = mapReferenceTable(cdoPackage, cdoPackage.getName() + "_refs");
+ break;
+
+ case PER_REPOSITORY:
+ withFeature = true;
+ IRepository repository = getClassMapping().getMappingStrategy().getStore().getRepository();
+ table = mapReferenceTable(repository, repository.getName() + "_refs");
+ break;
+
+ default:
+ throw new IllegalArgumentException("Invalid mapping: " + toMany);
+ }
+ }
+
+ protected IDBTable mapReferenceTable(Object key, String tableName)
+ {
+ Map<Object, IDBTable> referenceTables = getClassMapping().getMappingStrategy().getReferenceTables();
+ IDBTable table = referenceTables.get(key);
+ if (table == null)
+ {
+ table = addReferenceTable(tableName);
+ referenceTables.put(key, table);
+ }
+
+ return table;
+ }
+
+ protected IDBTable addReferenceTable(String tableName)
+ {
+ IDBTable table = getClassMapping().addTable(tableName);
+ if (withFeature)
+ {
+ table.addField(CDODBSchema.REFERENCES_FEATURE, DBType.INTEGER);
+ }
+
+ table.addField(CDODBSchema.REFERENCES_SOURCE, DBType.BIGINT);
+ table.addField(CDODBSchema.REFERENCES_VERSION, DBType.INTEGER);
+ table.addField(CDODBSchema.REFERENCES_IDX, DBType.INTEGER);
+ table.addField(CDODBSchema.REFERENCES_TARGET, DBType.BIGINT);
+ return table;
+ }
+
+}
diff --git a/plugins/org.eclipse.emf.cdo.server.db/src/org/eclipse/emf/cdo/server/internal/db/RootClassMapping.java b/plugins/org.eclipse.emf.cdo.server.db/src/org/eclipse/emf/cdo/server/internal/db/RootClassMapping.java
new file mode 100644
index 0000000000..ca00ed9715
--- /dev/null
+++ b/plugins/org.eclipse.emf.cdo.server.db/src/org/eclipse/emf/cdo/server/internal/db/RootClassMapping.java
@@ -0,0 +1,42 @@
+/***************************************************************************
+ * Copyright (c) 2004 - 2008 Eike Stepper, Germany.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Eike Stepper - initial API and implementation
+ **************************************************************************/
+package org.eclipse.emf.cdo.server.internal.db;
+
+import org.eclipse.emf.cdo.common.model.core.CDOObjectClass;
+
+/**
+ * @author Eike Stepper
+ */
+public class RootClassMapping extends ClassMapping
+{
+ public RootClassMapping(VerticalMappingStrategy mappingStrategy)
+ {
+ super(mappingStrategy, getRootClass(mappingStrategy), null);
+ initTable(getTable(), true);
+ }
+
+ @Override
+ public VerticalMappingStrategy getMappingStrategy()
+ {
+ return (VerticalMappingStrategy)super.getMappingStrategy();
+ }
+
+ @Override
+ protected boolean hasFullRevisionInfo()
+ {
+ return true;
+ }
+
+ private static CDOObjectClass getRootClass(VerticalMappingStrategy mappingStrategy)
+ {
+ return mappingStrategy.getStore().getRepository().getPackageManager().getCDOCorePackage().getCDOObjectClass();
+ }
+}
diff --git a/plugins/org.eclipse.emf.cdo.server.db/src/org/eclipse/emf/cdo/server/internal/db/ServerInfo.java b/plugins/org.eclipse.emf.cdo.server.db/src/org/eclipse/emf/cdo/server/internal/db/ServerInfo.java
new file mode 100644
index 0000000000..fcef688c9b
--- /dev/null
+++ b/plugins/org.eclipse.emf.cdo.server.db/src/org/eclipse/emf/cdo/server/internal/db/ServerInfo.java
@@ -0,0 +1,37 @@
+/***************************************************************************
+ * Copyright (c) 2004 - 2008 Eike Stepper, Germany.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Eike Stepper - initial API and implementation
+ **************************************************************************/
+package org.eclipse.emf.cdo.server.internal.db;
+
+import org.eclipse.emf.cdo.common.model.CDOModelElement;
+
+/**
+ * @author Eike Stepper
+ */
+public abstract class ServerInfo
+{
+ private int dbID;
+
+ protected ServerInfo(int dbID)
+ {
+ this.dbID = dbID;
+ }
+
+ @Override
+ public String toString()
+ {
+ return String.valueOf(dbID);
+ }
+
+ public static int getDBID(CDOModelElement modelElement)
+ {
+ return ((ServerInfo)modelElement.getServerInfo()).dbID;
+ }
+}
diff --git a/plugins/org.eclipse.emf.cdo.server.db/src/org/eclipse/emf/cdo/server/internal/db/ToOneReferenceMapping.java b/plugins/org.eclipse.emf.cdo.server.db/src/org/eclipse/emf/cdo/server/internal/db/ToOneReferenceMapping.java
new file mode 100644
index 0000000000..3d88d33fad
--- /dev/null
+++ b/plugins/org.eclipse.emf.cdo.server.db/src/org/eclipse/emf/cdo/server/internal/db/ToOneReferenceMapping.java
@@ -0,0 +1,34 @@
+/***************************************************************************
+ * Copyright (c) 2004 - 2008 Eike Stepper, Germany.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Eike Stepper - initial API and implementation
+ **************************************************************************/
+package org.eclipse.emf.cdo.server.internal.db;
+
+import org.eclipse.emf.cdo.common.id.CDOID;
+import org.eclipse.emf.cdo.common.id.CDOIDUtil;
+import org.eclipse.emf.cdo.common.model.CDOFeature;
+import org.eclipse.emf.cdo.spi.common.InternalCDORevision;
+
+/**
+ * @author Eike Stepper
+ */
+public class ToOneReferenceMapping extends AttributeMapping.AMObject
+{
+ public ToOneReferenceMapping(ClassMapping classMapping, CDOFeature feature)
+ {
+ super(classMapping, feature);
+ }
+
+ @Override
+ protected Long getRevisionValue(InternalCDORevision revision)
+ {
+ CDOID id = (CDOID)super.getRevisionValue(revision);
+ return CDOIDUtil.getLong(id);
+ }
+}
diff --git a/plugins/org.eclipse.emf.cdo.server.db/src/org/eclipse/emf/cdo/server/internal/db/VerticalClassMapping.java b/plugins/org.eclipse.emf.cdo.server.db/src/org/eclipse/emf/cdo/server/internal/db/VerticalClassMapping.java
new file mode 100644
index 0000000000..d1749026c9
--- /dev/null
+++ b/plugins/org.eclipse.emf.cdo.server.db/src/org/eclipse/emf/cdo/server/internal/db/VerticalClassMapping.java
@@ -0,0 +1,75 @@
+/***************************************************************************
+ * Copyright (c) 2004 - 2008 Eike Stepper, Germany.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Eike Stepper - initial API and implementation
+ **************************************************************************/
+package org.eclipse.emf.cdo.server.internal.db;
+
+import org.eclipse.emf.cdo.common.model.CDOClass;
+import org.eclipse.emf.cdo.common.revision.CDORevision;
+import org.eclipse.emf.cdo.server.db.IClassMapping;
+import org.eclipse.emf.cdo.server.db.IDBStoreWriter;
+
+import java.util.ArrayList;
+import java.util.List;
+
+/**
+ * @author Eike Stepper
+ */
+public class VerticalClassMapping extends ClassMapping
+{
+ private List<IClassMapping> superMappings;
+
+ public VerticalClassMapping(VerticalMappingStrategy mappingStrategy, CDOClass cdoClass)
+ {
+ super(mappingStrategy, cdoClass, cdoClass.getFeatures());
+ for (CDOClass superType : cdoClass.getSuperTypes())
+ {
+ IClassMapping superMapping = mappingStrategy.getClassMapping(superType);
+ if (superMapping != null)
+ {
+ if (superMappings == null)
+ {
+ superMappings = new ArrayList<IClassMapping>(0);
+ }
+
+ superMappings.add(superMapping);
+ }
+ }
+ }
+
+ @Override
+ public VerticalMappingStrategy getMappingStrategy()
+ {
+ return (VerticalMappingStrategy)super.getMappingStrategy();
+ }
+
+ @Override
+ protected boolean hasFullRevisionInfo()
+ {
+ return false;
+ }
+
+ public List<IClassMapping> getSuperMappings()
+ {
+ return superMappings;
+ }
+
+ @Override
+ public void writeRevision(IDBStoreWriter storeWriter, CDORevision revision)
+ {
+ super.writeRevision(storeWriter, revision);
+ if (superMappings != null)
+ {
+ for (IClassMapping superMapping : superMappings)
+ {
+ superMapping.writeRevision(storeWriter, revision);
+ }
+ }
+ }
+}
diff --git a/plugins/org.eclipse.emf.cdo.server.db/src/org/eclipse/emf/cdo/server/internal/db/VerticalMappingStrategy.java b/plugins/org.eclipse.emf.cdo.server.db/src/org/eclipse/emf/cdo/server/internal/db/VerticalMappingStrategy.java
new file mode 100644
index 0000000000..cba25e8dfb
--- /dev/null
+++ b/plugins/org.eclipse.emf.cdo.server.db/src/org/eclipse/emf/cdo/server/internal/db/VerticalMappingStrategy.java
@@ -0,0 +1,65 @@
+/***************************************************************************
+ * Copyright (c) 2004 - 2008 Eike Stepper, Germany.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Eike Stepper - initial API and implementation
+ **************************************************************************/
+package org.eclipse.emf.cdo.server.internal.db;
+
+import org.eclipse.emf.cdo.common.id.CDOID;
+import org.eclipse.emf.cdo.common.model.CDOClass;
+import org.eclipse.emf.cdo.common.model.CDOClassRef;
+import org.eclipse.emf.cdo.server.db.IClassMapping;
+import org.eclipse.emf.cdo.server.db.IDBStoreReader;
+
+import java.util.Collections;
+import java.util.List;
+
+/**
+ * @author Eike Stepper
+ */
+public class VerticalMappingStrategy extends MappingStrategy
+{
+ private RootClassMapping rootClassMapping;
+
+ public VerticalMappingStrategy()
+ {
+ throw new UnsupportedOperationException();
+ }
+
+ public String getType()
+ {
+ return "vertical";
+ }
+
+ public RootClassMapping getRootClassMapping()
+ {
+ if (rootClassMapping == null)
+ {
+ rootClassMapping = new RootClassMapping(this);
+ }
+
+ return rootClassMapping;
+ }
+
+ public CDOClassRef readObjectType(IDBStoreReader storeReader, CDOID id)
+ {
+ throw new UnsupportedOperationException();
+ }
+
+ @Override
+ protected IClassMapping createClassMapping(CDOClass cdoClass)
+ {
+ return new VerticalClassMapping(this, cdoClass);
+ }
+
+ @Override
+ protected List<CDOClass> getClassesWithObjectInfo()
+ {
+ return Collections.singletonList(rootClassMapping.getCDOClass());
+ }
+}
diff --git a/plugins/org.eclipse.emf.cdo.tests.mango/META-INF/MANIFEST.MF b/plugins/org.eclipse.emf.cdo.tests.mango/META-INF/MANIFEST.MF
new file mode 100644
index 0000000000..3944f40d9d
--- /dev/null
+++ b/plugins/org.eclipse.emf.cdo.tests.mango/META-INF/MANIFEST.MF
@@ -0,0 +1,16 @@
+Manifest-Version: 1.0
+Bundle-ManifestVersion: 2
+Bundle-SymbolicName: org.eclipse.emf.cdo.tests.mango; singleton:=true
+Bundle-Version: 1.0.0.qualifier
+Bundle-Name: %pluginName
+Bundle-Vendor: %providerName
+Bundle-Localization: plugin
+Bundle-RequiredExecutionEnvironment: J2SE-1.5
+Bundle-ClassPath: .
+Require-Bundle: org.eclipse.core.runtime;bundle-version="[3.4.0,4.0.0)",
+ org.eclipse.emf.ecore;bundle-version="[2.4.0,3.0.0)";visibility:=reexport,
+ org.eclipse.emf.cdo;bundle-version="[1.0.0,2.0.0)";visibility:=reexport
+Export-Package: org.eclipse.emf.cdo.tests.mango;version="1.0.0",
+ org.eclipse.emf.cdo.tests.mango.impl;version="1.0.0",
+ org.eclipse.emf.cdo.tests.mango.util;version="1.0.0"
+
diff --git a/plugins/org.eclipse.emf.cdo.tests.mango/plugin.properties b/plugins/org.eclipse.emf.cdo.tests.mango/plugin.properties
new file mode 100644
index 0000000000..a437c627ef
--- /dev/null
+++ b/plugins/org.eclipse.emf.cdo.tests.mango/plugin.properties
@@ -0,0 +1,25 @@
+# Copyright (c) 2004 - 2008 Eike Stepper, Germany.
+# All rights reserved. This program and the accompanying materials
+# are made available under the terms of the Eclipse Public License v1.0
+# which accompanies this distribution, and is available at
+# http://www.eclipse.org/legal/epl-v10.html
+#
+# Contributors:
+# Eike Stepper - initial API and implementation
+
+# NLS_MESSAGEFORMAT_VAR
+
+# ==============================================================================
+# Do not change the properties between this line and the last line containing:
+# %%% END OF TRANSLATED PROPERTIES %%%
+# Instead, either redefine an existing property, or create a new property,
+# append it to the end of the file, and change the code to use the new name.
+# ==============================================================================
+
+pluginName = CDO Tests Mango
+providerName = Eclipse.org
+
+# ==============================================================================
+# %%% END OF TRANSLATED PROPERTIES %%%
+# The above properties have been shipped for translation.
+# ==============================================================================
diff --git a/plugins/org.eclipse.emf.cdo.tests.mango/src/org/eclipse/emf/cdo/tests/mango/MangoPackage.java b/plugins/org.eclipse.emf.cdo.tests.mango/src/org/eclipse/emf/cdo/tests/mango/MangoPackage.java
new file mode 100644
index 0000000000..406750744c
--- /dev/null
+++ b/plugins/org.eclipse.emf.cdo.tests.mango/src/org/eclipse/emf/cdo/tests/mango/MangoPackage.java
@@ -0,0 +1,239 @@
+/**
+ * <copyright>
+ * </copyright>
+ *
+ * $Id: MangoPackage.java,v 1.4 2008-06-03 06:41:27 estepper Exp $
+ */
+package org.eclipse.emf.cdo.tests.mango;
+
+import org.eclipse.emf.ecore.EAttribute;
+import org.eclipse.emf.ecore.EClass;
+import org.eclipse.emf.ecore.EPackage;
+import org.eclipse.emf.ecore.EReference;
+
+/**
+ * <!-- begin-user-doc --> The <b>Package</b> for the model. It contains accessors for the meta objects to represent
+ * <ul>
+ * <li>each class,</li>
+ * <li>each feature of each class,</li>
+ * <li>each enum,</li>
+ * <li>and each data type</li>
+ * </ul>
+ * <!-- end-user-doc -->
+ *
+ * @see org.eclipse.emf.cdo.tests.mango.MangoFactory
+ * @model kind="package"
+ * @generated
+ */
+public interface MangoPackage extends EPackage
+{
+ /**
+ * The package name. <!-- begin-user-doc --> <!-- end-user-doc -->
+ *
+ * @generated
+ */
+ String eNAME = "mango";
+
+ /**
+ * The package namespace URI. <!-- begin-user-doc --> <!-- end-user-doc -->
+ *
+ * @generated
+ */
+ String eNS_URI = "http://www.eclipse.org/emf/CDO/tests/mango";
+
+ /**
+ * The package namespace name. <!-- begin-user-doc --> <!-- end-user-doc -->
+ *
+ * @generated
+ */
+ String eNS_PREFIX = "mango";
+
+ /**
+ * The singleton instance of the package. <!-- begin-user-doc --> <!-- end-user-doc -->
+ *
+ * @generated
+ */
+ MangoPackage eINSTANCE = org.eclipse.emf.cdo.tests.mango.impl.MangoPackageImpl.init();
+
+ /**
+ * The meta object id for the '{@link org.eclipse.emf.cdo.tests.mango.impl.ValueListImpl <em>Value List</em>}' class.
+ * <!-- begin-user-doc --> <!-- end-user-doc -->
+ *
+ * @see org.eclipse.emf.cdo.tests.mango.impl.ValueListImpl
+ * @see org.eclipse.emf.cdo.tests.mango.impl.MangoPackageImpl#getValueList()
+ * @generated
+ */
+ int VALUE_LIST = 0;
+
+ /**
+ * The feature id for the '<em><b>Name</b></em>' attribute. <!-- begin-user-doc --> <!-- end-user-doc -->
+ *
+ * @generated
+ * @ordered
+ */
+ int VALUE_LIST__NAME = 0;
+
+ /**
+ * The feature id for the '<em><b>Values</b></em>' reference list. <!-- begin-user-doc --> <!-- end-user-doc -->
+ *
+ * @generated
+ * @ordered
+ */
+ int VALUE_LIST__VALUES = 1;
+
+ /**
+ * The number of structural features of the '<em>Value List</em>' class. <!-- begin-user-doc --> <!-- end-user-doc -->
+ *
+ * @generated
+ * @ordered
+ */
+ int VALUE_LIST_FEATURE_COUNT = 2;
+
+ /**
+ * The meta object id for the '{@link org.eclipse.emf.cdo.tests.mango.impl.ValueImpl <em>Value</em>}' class. <!--
+ * begin-user-doc --> <!-- end-user-doc -->
+ *
+ * @see org.eclipse.emf.cdo.tests.mango.impl.ValueImpl
+ * @see org.eclipse.emf.cdo.tests.mango.impl.MangoPackageImpl#getValue()
+ * @generated
+ */
+ int VALUE = 1;
+
+ /**
+ * The feature id for the '<em><b>Name</b></em>' attribute. <!-- begin-user-doc --> <!-- end-user-doc -->
+ *
+ * @generated
+ * @ordered
+ */
+ int VALUE__NAME = 0;
+
+ /**
+ * The number of structural features of the '<em>Value</em>' class. <!-- begin-user-doc --> <!-- end-user-doc -->
+ *
+ * @generated
+ * @ordered
+ */
+ int VALUE_FEATURE_COUNT = 1;
+
+ /**
+ * Returns the meta object for class '{@link org.eclipse.emf.cdo.tests.mango.ValueList <em>Value List</em>}'. <!--
+ * begin-user-doc --> <!-- end-user-doc -->
+ *
+ * @return the meta object for class '<em>Value List</em>'.
+ * @see org.eclipse.emf.cdo.tests.mango.ValueList
+ * @generated
+ */
+ EClass getValueList();
+
+ /**
+ * Returns the meta object for the attribute '{@link org.eclipse.emf.cdo.tests.mango.ValueList#getName <em>Name</em>}
+ * '. <!-- begin-user-doc --> <!-- end-user-doc -->
+ *
+ * @return the meta object for the attribute '<em>Name</em>'.
+ * @see org.eclipse.emf.cdo.tests.mango.ValueList#getName()
+ * @see #getValueList()
+ * @generated
+ */
+ EAttribute getValueList_Name();
+
+ /**
+ * Returns the meta object for the reference list '{@link org.eclipse.emf.cdo.tests.mango.ValueList#getValues
+ * <em>Values</em>}'. <!-- begin-user-doc --> <!-- end-user-doc -->
+ *
+ * @return the meta object for the reference list '<em>Values</em>'.
+ * @see org.eclipse.emf.cdo.tests.mango.ValueList#getValues()
+ * @see #getValueList()
+ * @generated
+ */
+ EReference getValueList_Values();
+
+ /**
+ * Returns the meta object for class '{@link org.eclipse.emf.cdo.tests.mango.Value <em>Value</em>}'. <!--
+ * begin-user-doc --> <!-- end-user-doc -->
+ *
+ * @return the meta object for class '<em>Value</em>'.
+ * @see org.eclipse.emf.cdo.tests.mango.Value
+ * @generated
+ */
+ EClass getValue();
+
+ /**
+ * Returns the meta object for the attribute '{@link org.eclipse.emf.cdo.tests.mango.Value#getName <em>Name</em>}'.
+ * <!-- begin-user-doc --> <!-- end-user-doc -->
+ *
+ * @return the meta object for the attribute '<em>Name</em>'.
+ * @see org.eclipse.emf.cdo.tests.mango.Value#getName()
+ * @see #getValue()
+ * @generated
+ */
+ EAttribute getValue_Name();
+
+ /**
+ * Returns the factory that creates the instances of the model. <!-- begin-user-doc --> <!-- end-user-doc -->
+ *
+ * @return the factory that creates the instances of the model.
+ * @generated
+ */
+ MangoFactory getMangoFactory();
+
+ /**
+ * <!-- begin-user-doc --> Defines literals for the meta objects that represent
+ * <ul>
+ * <li>each class,</li>
+ * <li>each feature of each class,</li>
+ * <li>each enum,</li>
+ * <li>and each data type</li>
+ * </ul>
+ * <!-- end-user-doc -->
+ *
+ * @generated
+ */
+ interface Literals
+ {
+ /**
+ * The meta object literal for the '{@link org.eclipse.emf.cdo.tests.mango.impl.ValueListImpl <em>Value List</em>}'
+ * class. <!-- begin-user-doc --> <!-- end-user-doc -->
+ *
+ * @see org.eclipse.emf.cdo.tests.mango.impl.ValueListImpl
+ * @see org.eclipse.emf.cdo.tests.mango.impl.MangoPackageImpl#getValueList()
+ * @generated
+ */
+ EClass VALUE_LIST = eINSTANCE.getValueList();
+
+ /**
+ * The meta object literal for the '<em><b>Name</b></em>' attribute feature. <!-- begin-user-doc --> <!--
+ * end-user-doc -->
+ *
+ * @generated
+ */
+ EAttribute VALUE_LIST__NAME = eINSTANCE.getValueList_Name();
+
+ /**
+ * The meta object literal for the '<em><b>Values</b></em>' reference list feature. <!-- begin-user-doc --> <!--
+ * end-user-doc -->
+ *
+ * @generated
+ */
+ EReference VALUE_LIST__VALUES = eINSTANCE.getValueList_Values();
+
+ /**
+ * The meta object literal for the '{@link org.eclipse.emf.cdo.tests.mango.impl.ValueImpl <em>Value</em>}' class.
+ * <!-- begin-user-doc --> <!-- end-user-doc -->
+ *
+ * @see org.eclipse.emf.cdo.tests.mango.impl.ValueImpl
+ * @see org.eclipse.emf.cdo.tests.mango.impl.MangoPackageImpl#getValue()
+ * @generated
+ */
+ EClass VALUE = eINSTANCE.getValue();
+
+ /**
+ * The meta object literal for the '<em><b>Name</b></em>' attribute feature. <!-- begin-user-doc --> <!--
+ * end-user-doc -->
+ *
+ * @generated
+ */
+ EAttribute VALUE__NAME = eINSTANCE.getValue_Name();
+
+ }
+
+} // MangoPackage
diff --git a/plugins/org.eclipse.emf.cdo.tests.mango/src/org/eclipse/emf/cdo/tests/mango/Value.java b/plugins/org.eclipse.emf.cdo.tests.mango/src/org/eclipse/emf/cdo/tests/mango/Value.java
new file mode 100644
index 0000000000..8691722532
--- /dev/null
+++ b/plugins/org.eclipse.emf.cdo.tests.mango/src/org/eclipse/emf/cdo/tests/mango/Value.java
@@ -0,0 +1,53 @@
+/**
+ * <copyright>
+ * </copyright>
+ *
+ * $Id: Value.java,v 1.3 2008-06-03 06:41:27 estepper Exp $
+ */
+package org.eclipse.emf.cdo.tests.mango;
+
+import org.eclipse.emf.cdo.CDOObject;
+
+/**
+ * <!-- begin-user-doc --> A representation of the model object '<em><b>Value</b></em>'. <!-- end-user-doc -->
+ * <p>
+ * The following features are supported:
+ * <ul>
+ * <li>{@link org.eclipse.emf.cdo.tests.mango.Value#getName <em>Name</em>}</li>
+ * </ul>
+ * </p>
+ *
+ * @see org.eclipse.emf.cdo.tests.mango.MangoPackage#getValue()
+ * @model
+ * @extends CDOObject
+ * @generated
+ */
+public interface Value extends CDOObject
+{
+ /**
+ * Returns the value of the '<em><b>Name</b></em>' attribute. <!-- begin-user-doc -->
+ * <p>
+ * If the meaning of the '<em>Name</em>' attribute isn't clear, there really should be more of a description here...
+ * </p>
+ * <!-- end-user-doc -->
+ *
+ * @return the value of the '<em>Name</em>' attribute.
+ * @see #setName(String)
+ * @see org.eclipse.emf.cdo.tests.mango.MangoPackage#getValue_Name()
+ * @model
+ * @generated
+ */
+ String getName();
+
+ /**
+ * Sets the value of the '{@link org.eclipse.emf.cdo.tests.mango.Value#getName <em>Name</em>}' attribute. <!--
+ * begin-user-doc --> <!-- end-user-doc -->
+ *
+ * @param value
+ * the new value of the '<em>Name</em>' attribute.
+ * @see #getName()
+ * @generated
+ */
+ void setName(String value);
+
+} // Value
diff --git a/plugins/org.eclipse.emf.cdo.tests.mango/src/org/eclipse/emf/cdo/tests/mango/ValueList.java b/plugins/org.eclipse.emf.cdo.tests.mango/src/org/eclipse/emf/cdo/tests/mango/ValueList.java
new file mode 100644
index 0000000000..cfc6566a56
--- /dev/null
+++ b/plugins/org.eclipse.emf.cdo.tests.mango/src/org/eclipse/emf/cdo/tests/mango/ValueList.java
@@ -0,0 +1,72 @@
+/**
+ * <copyright>
+ * </copyright>
+ *
+ * $Id: ValueList.java,v 1.3 2008-06-03 06:41:26 estepper Exp $
+ */
+package org.eclipse.emf.cdo.tests.mango;
+
+import org.eclipse.emf.cdo.CDOObject;
+
+import org.eclipse.emf.common.util.EList;
+
+/**
+ * <!-- begin-user-doc --> A representation of the model object '<em><b>Value List</b></em>'. <!-- end-user-doc -->
+ * <p>
+ * The following features are supported:
+ * <ul>
+ * <li>{@link org.eclipse.emf.cdo.tests.mango.ValueList#getName <em>Name</em>}</li>
+ * <li>{@link org.eclipse.emf.cdo.tests.mango.ValueList#getValues <em>Values</em>}</li>
+ * </ul>
+ * </p>
+ *
+ * @see org.eclipse.emf.cdo.tests.mango.MangoPackage#getValueList()
+ * @model
+ * @extends CDOObject
+ * @generated
+ */
+public interface ValueList extends CDOObject
+{
+ /**
+ * Returns the value of the '<em><b>Name</b></em>' attribute. <!-- begin-user-doc -->
+ * <p>
+ * If the meaning of the '<em>Name</em>' attribute isn't clear, there really should be more of a description here...
+ * </p>
+ * <!-- end-user-doc -->
+ *
+ * @return the value of the '<em>Name</em>' attribute.
+ * @see #setName(String)
+ * @see org.eclipse.emf.cdo.tests.mango.MangoPackage#getValueList_Name()
+ * @model
+ * @generated
+ */
+ String getName();
+
+ /**
+ * Sets the value of the '{@link org.eclipse.emf.cdo.tests.mango.ValueList#getName <em>Name</em>}' attribute. <!--
+ * begin-user-doc --> <!-- end-user-doc -->
+ *
+ * @param value
+ * the new value of the '<em>Name</em>' attribute.
+ * @see #getName()
+ * @generated
+ */
+ void setName(String value);
+
+ /**
+ * Returns the value of the '<em><b>Values</b></em>' reference list. The list contents are of type
+ * {@link org.eclipse.emf.cdo.tests.mango.Value}. <!-- begin-user-doc -->
+ * <p>
+ * If the meaning of the '<em>Values</em>' reference list isn't clear, there really should be more of a description
+ * here...
+ * </p>
+ * <!-- end-user-doc -->
+ *
+ * @return the value of the '<em>Values</em>' reference list.
+ * @see org.eclipse.emf.cdo.tests.mango.MangoPackage#getValueList_Values()
+ * @model
+ * @generated
+ */
+ EList<Value> getValues();
+
+} // ValueList
diff --git a/plugins/org.eclipse.emf.cdo.tests.mango/src/org/eclipse/emf/cdo/tests/mango/impl/MangoPackageImpl.java b/plugins/org.eclipse.emf.cdo.tests.mango/src/org/eclipse/emf/cdo/tests/mango/impl/MangoPackageImpl.java
new file mode 100644
index 0000000000..c23d4976d5
--- /dev/null
+++ b/plugins/org.eclipse.emf.cdo.tests.mango/src/org/eclipse/emf/cdo/tests/mango/impl/MangoPackageImpl.java
@@ -0,0 +1,239 @@
+/**
+ * <copyright>
+ * </copyright>
+ *
+ * $Id: MangoPackageImpl.java,v 1.3 2008-06-03 06:41:27 estepper Exp $
+ */
+package org.eclipse.emf.cdo.tests.mango.impl;
+
+import org.eclipse.emf.cdo.tests.mango.MangoFactory;
+import org.eclipse.emf.cdo.tests.mango.MangoPackage;
+import org.eclipse.emf.cdo.tests.mango.Value;
+import org.eclipse.emf.cdo.tests.mango.ValueList;
+
+import org.eclipse.emf.ecore.EAttribute;
+import org.eclipse.emf.ecore.EClass;
+import org.eclipse.emf.ecore.EPackage;
+import org.eclipse.emf.ecore.EReference;
+import org.eclipse.emf.ecore.impl.EPackageImpl;
+
+/**
+ * <!-- begin-user-doc --> An implementation of the model <b>Package</b>. <!-- end-user-doc -->
+ *
+ * @generated
+ */
+public class MangoPackageImpl extends EPackageImpl implements MangoPackage
+{
+ /**
+ * <!-- begin-user-doc --> <!-- end-user-doc -->
+ *
+ * @generated
+ */
+ private EClass valueListEClass = null;
+
+ /**
+ * <!-- begin-user-doc --> <!-- end-user-doc -->
+ *
+ * @generated
+ */
+ private EClass valueEClass = null;
+
+ /**
+ * Creates an instance of the model <b>Package</b>, registered with {@link org.eclipse.emf.ecore.EPackage.Registry
+ * EPackage.Registry} by the package package URI value.
+ * <p>
+ * Note: the correct way to create the package is via the static factory method {@link #init init()}, which also
+ * performs initialization of the package, or returns the registered package, if one already exists. <!--
+ * begin-user-doc --> <!-- end-user-doc -->
+ *
+ * @see org.eclipse.emf.ecore.EPackage.Registry
+ * @see org.eclipse.emf.cdo.tests.mango.MangoPackage#eNS_URI
+ * @see #init()
+ * @generated
+ */
+ private MangoPackageImpl()
+ {
+ super(eNS_URI, MangoFactory.eINSTANCE);
+ }
+
+ /**
+ * <!-- begin-user-doc --> <!-- end-user-doc -->
+ *
+ * @generated
+ */
+ private static boolean isInited = false;
+
+ /**
+ * Creates, registers, and initializes the <b>Package</b> for this model, and for any others upon which it depends.
+ * Simple dependencies are satisfied by calling this method on all dependent packages before doing anything else. This
+ * method drives initialization for interdependent packages directly, in parallel with this package, itself.
+ * <p>
+ * Of this package and its interdependencies, all packages which have not yet been registered by their URI values are
+ * first created and registered. The packages are then initialized in two steps: meta-model objects for all of the
+ * packages are created before any are initialized, since one package's meta-model objects may refer to those of
+ * another.
+ * <p>
+ * Invocation of this method will not affect any packages that have already been initialized. <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ *
+ * @see #eNS_URI
+ * @see #createPackageContents()
+ * @see #initializePackageContents()
+ * @generated
+ */
+ public static MangoPackage init()
+ {
+ if (isInited) return (MangoPackage)EPackage.Registry.INSTANCE.getEPackage(MangoPackage.eNS_URI);
+
+ // Obtain or create and register package
+ MangoPackageImpl theMangoPackage = (MangoPackageImpl)(EPackage.Registry.INSTANCE.getEPackage(eNS_URI) instanceof MangoPackageImpl ? EPackage.Registry.INSTANCE
+ .getEPackage(eNS_URI)
+ : new MangoPackageImpl());
+
+ isInited = true;
+
+ // Create package meta-data objects
+ theMangoPackage.createPackageContents();
+
+ // Initialize created meta-data
+ theMangoPackage.initializePackageContents();
+
+ // Mark meta-data to indicate it can't be changed
+ theMangoPackage.freeze();
+
+ return theMangoPackage;
+ }
+
+ /**
+ * <!-- begin-user-doc --> <!-- end-user-doc -->
+ *
+ * @generated
+ */
+ public EClass getValueList()
+ {
+ return valueListEClass;
+ }
+
+ /**
+ * <!-- begin-user-doc --> <!-- end-user-doc -->
+ *
+ * @generated
+ */
+ public EAttribute getValueList_Name()
+ {
+ return (EAttribute)valueListEClass.getEStructuralFeatures().get(0);
+ }
+
+ /**
+ * <!-- begin-user-doc --> <!-- end-user-doc -->
+ *
+ * @generated
+ */
+ public EReference getValueList_Values()
+ {
+ return (EReference)valueListEClass.getEStructuralFeatures().get(1);
+ }
+
+ /**
+ * <!-- begin-user-doc --> <!-- end-user-doc -->
+ *
+ * @generated
+ */
+ public EClass getValue()
+ {
+ return valueEClass;
+ }
+
+ /**
+ * <!-- begin-user-doc --> <!-- end-user-doc -->
+ *
+ * @generated
+ */
+ public EAttribute getValue_Name()
+ {
+ return (EAttribute)valueEClass.getEStructuralFeatures().get(0);
+ }
+
+ /**
+ * <!-- begin-user-doc --> <!-- end-user-doc -->
+ *
+ * @generated
+ */
+ public MangoFactory getMangoFactory()
+ {
+ return (MangoFactory)getEFactoryInstance();
+ }
+
+ /**
+ * <!-- begin-user-doc --> <!-- end-user-doc -->
+ *
+ * @generated
+ */
+ private boolean isCreated = false;
+
+ /**
+ * Creates the meta-model objects for the package. This method is guarded to have no affect on any invocation but its
+ * first. <!-- begin-user-doc --> <!-- end-user-doc -->
+ *
+ * @generated
+ */
+ public void createPackageContents()
+ {
+ if (isCreated) return;
+ isCreated = true;
+
+ // Create classes and their features
+ valueListEClass = createEClass(VALUE_LIST);
+ createEAttribute(valueListEClass, VALUE_LIST__NAME);
+ createEReference(valueListEClass, VALUE_LIST__VALUES);
+
+ valueEClass = createEClass(VALUE);
+ createEAttribute(valueEClass, VALUE__NAME);
+ }
+
+ /**
+ * <!-- begin-user-doc --> <!-- end-user-doc -->
+ *
+ * @generated
+ */
+ private boolean isInitialized = false;
+
+ /**
+ * Complete the initialization of the package and its meta-model. This method is guarded to have no affect on any
+ * invocation but its first. <!-- begin-user-doc --> <!-- end-user-doc -->
+ *
+ * @generated
+ */
+ public void initializePackageContents()
+ {
+ if (isInitialized) return;
+ isInitialized = true;
+
+ // Initialize package
+ setName(eNAME);
+ setNsPrefix(eNS_PREFIX);
+ setNsURI(eNS_URI);
+
+ // Create type parameters
+
+ // Set bounds for type parameters
+
+ // Add supertypes to classes
+
+ // Initialize classes and features; add operations and parameters
+ initEClass(valueListEClass, ValueList.class, "ValueList", !IS_ABSTRACT, !IS_INTERFACE, IS_GENERATED_INSTANCE_CLASS);
+ initEAttribute(getValueList_Name(), ecorePackage.getEString(), "name", null, 0, 1, ValueList.class, !IS_TRANSIENT,
+ !IS_VOLATILE, IS_CHANGEABLE, !IS_UNSETTABLE, !IS_ID, IS_UNIQUE, !IS_DERIVED, IS_ORDERED);
+ initEReference(getValueList_Values(), this.getValue(), null, "values", null, 0, -1, ValueList.class, !IS_TRANSIENT,
+ !IS_VOLATILE, IS_CHANGEABLE, !IS_COMPOSITE, IS_RESOLVE_PROXIES, !IS_UNSETTABLE, IS_UNIQUE, !IS_DERIVED,
+ IS_ORDERED);
+
+ initEClass(valueEClass, Value.class, "Value", !IS_ABSTRACT, !IS_INTERFACE, IS_GENERATED_INSTANCE_CLASS);
+ initEAttribute(getValue_Name(), ecorePackage.getEString(), "name", null, 0, 1, Value.class, !IS_TRANSIENT,
+ !IS_VOLATILE, IS_CHANGEABLE, !IS_UNSETTABLE, !IS_ID, IS_UNIQUE, !IS_DERIVED, IS_ORDERED);
+
+ // Create resource
+ createResource(eNS_URI);
+ }
+
+} // MangoPackageImpl
diff --git a/plugins/org.eclipse.emf.cdo.tests.mango/src/org/eclipse/emf/cdo/tests/mango/impl/ValueListImpl.java b/plugins/org.eclipse.emf.cdo.tests.mango/src/org/eclipse/emf/cdo/tests/mango/impl/ValueListImpl.java
new file mode 100644
index 0000000000..840d81ba3c
--- /dev/null
+++ b/plugins/org.eclipse.emf.cdo.tests.mango/src/org/eclipse/emf/cdo/tests/mango/impl/ValueListImpl.java
@@ -0,0 +1,95 @@
+/**
+ * <copyright>
+ * </copyright>
+ *
+ * $Id: ValueListImpl.java,v 1.3 2008-06-03 06:41:27 estepper Exp $
+ */
+package org.eclipse.emf.cdo.tests.mango.impl;
+
+import org.eclipse.emf.cdo.tests.mango.MangoPackage;
+import org.eclipse.emf.cdo.tests.mango.Value;
+import org.eclipse.emf.cdo.tests.mango.ValueList;
+
+import org.eclipse.emf.internal.cdo.CDOObjectImpl;
+
+import org.eclipse.emf.common.util.EList;
+import org.eclipse.emf.ecore.EClass;
+
+/**
+ * <!-- begin-user-doc --> An implementation of the model object '<em><b>Value List</b></em>'. <!-- end-user-doc -->
+ * <p>
+ * The following features are implemented:
+ * <ul>
+ * <li>{@link org.eclipse.emf.cdo.tests.mango.impl.ValueListImpl#getName <em>Name</em>}</li>
+ * <li>{@link org.eclipse.emf.cdo.tests.mango.impl.ValueListImpl#getValues <em>Values</em>}</li>
+ * </ul>
+ * </p>
+ *
+ * @generated
+ */
+public class ValueListImpl extends CDOObjectImpl implements ValueList
+{
+ /**
+ * <!-- begin-user-doc --> <!-- end-user-doc -->
+ *
+ * @generated
+ */
+ protected ValueListImpl()
+ {
+ super();
+ }
+
+ /**
+ * <!-- begin-user-doc --> <!-- end-user-doc -->
+ *
+ * @generated
+ */
+ @Override
+ protected EClass eStaticClass()
+ {
+ return MangoPackage.Literals.VALUE_LIST;
+ }
+
+ /**
+ * <!-- begin-user-doc --> <!-- end-user-doc -->
+ *
+ * @generated
+ */
+ @Override
+ protected int eStaticFeatureCount()
+ {
+ return 0;
+ }
+
+ /**
+ * <!-- begin-user-doc --> <!-- end-user-doc -->
+ *
+ * @generated
+ */
+ public String getName()
+ {
+ return (String)eGet(MangoPackage.Literals.VALUE_LIST__NAME, true);
+ }
+
+ /**
+ * <!-- begin-user-doc --> <!-- end-user-doc -->
+ *
+ * @generated
+ */
+ public void setName(String newName)
+ {
+ eSet(MangoPackage.Literals.VALUE_LIST__NAME, newName);
+ }
+
+ /**
+ * <!-- begin-user-doc --> <!-- end-user-doc -->
+ *
+ * @generated
+ */
+ @SuppressWarnings("unchecked")
+ public EList<Value> getValues()
+ {
+ return (EList<Value>)eGet(MangoPackage.Literals.VALUE_LIST__VALUES, true);
+ }
+
+} // ValueListImpl
diff --git a/plugins/org.eclipse.emf.cdo.tests.mango/src/org/eclipse/emf/cdo/tests/mango/util/MangoAdapterFactory.java b/plugins/org.eclipse.emf.cdo.tests.mango/src/org/eclipse/emf/cdo/tests/mango/util/MangoAdapterFactory.java
new file mode 100644
index 0000000000..ff73d3ec51
--- /dev/null
+++ b/plugins/org.eclipse.emf.cdo.tests.mango/src/org/eclipse/emf/cdo/tests/mango/util/MangoAdapterFactory.java
@@ -0,0 +1,149 @@
+/**
+ * <copyright>
+ * </copyright>
+ *
+ * $Id: MangoAdapterFactory.java,v 1.3 2008-06-03 06:41:27 estepper Exp $
+ */
+package org.eclipse.emf.cdo.tests.mango.util;
+
+import org.eclipse.emf.cdo.tests.mango.MangoPackage;
+import org.eclipse.emf.cdo.tests.mango.Value;
+import org.eclipse.emf.cdo.tests.mango.ValueList;
+
+import org.eclipse.emf.common.notify.Adapter;
+import org.eclipse.emf.common.notify.Notifier;
+import org.eclipse.emf.common.notify.impl.AdapterFactoryImpl;
+import org.eclipse.emf.ecore.EObject;
+
+/**
+ * <!-- begin-user-doc --> The <b>Adapter Factory</b> for the model. It provides an adapter <code>createXXX</code>
+ * method for each class of the model. <!-- end-user-doc -->
+ *
+ * @see org.eclipse.emf.cdo.tests.mango.MangoPackage
+ * @generated
+ */
+public class MangoAdapterFactory extends AdapterFactoryImpl
+{
+ /**
+ * The cached model package. <!-- begin-user-doc --> <!-- end-user-doc -->
+ *
+ * @generated
+ */
+ protected static MangoPackage modelPackage;
+
+ /**
+ * Creates an instance of the adapter factory. <!-- begin-user-doc --> <!-- end-user-doc -->
+ *
+ * @generated
+ */
+ public MangoAdapterFactory()
+ {
+ if (modelPackage == null)
+ {
+ modelPackage = MangoPackage.eINSTANCE;
+ }
+ }
+
+ /**
+ * Returns whether this factory is applicable for the type of the object. <!-- begin-user-doc --> This implementation
+ * returns <code>true</code> if the object is either the model's package or is an instance object of the model. <!--
+ * end-user-doc -->
+ *
+ * @return whether this factory is applicable for the type of the object.
+ * @generated
+ */
+ @Override
+ public boolean isFactoryForType(Object object)
+ {
+ if (object == modelPackage)
+ {
+ return true;
+ }
+ if (object instanceof EObject)
+ {
+ return ((EObject)object).eClass().getEPackage() == modelPackage;
+ }
+ return false;
+ }
+
+ /**
+ * The switch that delegates to the <code>createXXX</code> methods. <!-- begin-user-doc --> <!-- end-user-doc -->
+ *
+ * @generated
+ */
+ protected MangoSwitch<Adapter> modelSwitch = new MangoSwitch<Adapter>()
+ {
+ @Override
+ public Adapter caseValueList(ValueList object)
+ {
+ return createValueListAdapter();
+ }
+
+ @Override
+ public Adapter caseValue(Value object)
+ {
+ return createValueAdapter();
+ }
+
+ @Override
+ public Adapter defaultCase(EObject object)
+ {
+ return createEObjectAdapter();
+ }
+ };
+
+ /**
+ * Creates an adapter for the <code>target</code>. <!-- begin-user-doc --> <!-- end-user-doc -->
+ *
+ * @param target
+ * the object to adapt.
+ * @return the adapter for the <code>target</code>.
+ * @generated
+ */
+ @Override
+ public Adapter createAdapter(Notifier target)
+ {
+ return modelSwitch.doSwitch((EObject)target);
+ }
+
+ /**
+ * Creates a new adapter for an object of class '{@link org.eclipse.emf.cdo.tests.mango.ValueList <em>Value List</em>}
+ * '. <!-- begin-user-doc --> This default implementation returns null so that we can easily ignore cases; it's useful
+ * to ignore a case when inheritance will catch all the cases anyway. <!-- end-user-doc -->
+ *
+ * @return the new adapter.
+ * @see org.eclipse.emf.cdo.tests.mango.ValueList
+ * @generated
+ */
+ public Adapter createValueListAdapter()
+ {
+ return null;
+ }
+
+ /**
+ * Creates a new adapter for an object of class '{@link org.eclipse.emf.cdo.tests.mango.Value <em>Value</em>}'. <!--
+ * begin-user-doc --> This default implementation returns null so that we can easily ignore cases; it's useful to
+ * ignore a case when inheritance will catch all the cases anyway. <!-- end-user-doc -->
+ *
+ * @return the new adapter.
+ * @see org.eclipse.emf.cdo.tests.mango.Value
+ * @generated
+ */
+ public Adapter createValueAdapter()
+ {
+ return null;
+ }
+
+ /**
+ * Creates a new adapter for the default case. <!-- begin-user-doc --> This default implementation returns null. <!--
+ * end-user-doc -->
+ *
+ * @return the new adapter.
+ * @generated
+ */
+ public Adapter createEObjectAdapter()
+ {
+ return null;
+ }
+
+} // MangoAdapterFactory
diff --git a/plugins/org.eclipse.emf.cdo.tests.mango/src/org/eclipse/emf/cdo/tests/mango/util/MangoSwitch.java b/plugins/org.eclipse.emf.cdo.tests.mango/src/org/eclipse/emf/cdo/tests/mango/util/MangoSwitch.java
new file mode 100644
index 0000000000..207a0df8cb
--- /dev/null
+++ b/plugins/org.eclipse.emf.cdo.tests.mango/src/org/eclipse/emf/cdo/tests/mango/util/MangoSwitch.java
@@ -0,0 +1,157 @@
+/**
+ * <copyright>
+ * </copyright>
+ *
+ * $Id: MangoSwitch.java,v 1.3 2008-06-03 06:41:27 estepper Exp $
+ */
+package org.eclipse.emf.cdo.tests.mango.util;
+
+import org.eclipse.emf.cdo.tests.mango.MangoPackage;
+import org.eclipse.emf.cdo.tests.mango.Value;
+import org.eclipse.emf.cdo.tests.mango.ValueList;
+
+import org.eclipse.emf.ecore.EClass;
+import org.eclipse.emf.ecore.EObject;
+
+import java.util.List;
+
+/**
+ * <!-- begin-user-doc --> The <b>Switch</b> for the model's inheritance hierarchy. It supports the call
+ * {@link #doSwitch(EObject) doSwitch(object)} to invoke the <code>caseXXX</code> method for each class of the model,
+ * starting with the actual class of the object and proceeding up the inheritance hierarchy until a non-null result is
+ * returned, which is the result of the switch. <!-- end-user-doc -->
+ *
+ * @see org.eclipse.emf.cdo.tests.mango.MangoPackage
+ * @generated
+ */
+public class MangoSwitch<T>
+{
+ /**
+ * The cached model package <!-- begin-user-doc --> <!-- end-user-doc -->
+ *
+ * @generated
+ */
+ protected static MangoPackage modelPackage;
+
+ /**
+ * Creates an instance of the switch. <!-- begin-user-doc --> <!-- end-user-doc -->
+ *
+ * @generated
+ */
+ public MangoSwitch()
+ {
+ if (modelPackage == null)
+ {
+ modelPackage = MangoPackage.eINSTANCE;
+ }
+ }
+
+ /**
+ * Calls <code>caseXXX</code> for each class of the model until one returns a non null result; it yields that result.
+ * <!-- begin-user-doc --> <!-- end-user-doc -->
+ *
+ * @return the first non-null result returned by a <code>caseXXX</code> call.
+ * @generated
+ */
+ public T doSwitch(EObject theEObject)
+ {
+ return doSwitch(theEObject.eClass(), theEObject);
+ }
+
+ /**
+ * Calls <code>caseXXX</code> for each class of the model until one returns a non null result; it yields that result.
+ * <!-- begin-user-doc --> <!-- end-user-doc -->
+ *
+ * @return the first non-null result returned by a <code>caseXXX</code> call.
+ * @generated
+ */
+ protected T doSwitch(EClass theEClass, EObject theEObject)
+ {
+ if (theEClass.eContainer() == modelPackage)
+ {
+ return doSwitch(theEClass.getClassifierID(), theEObject);
+ }
+ else
+ {
+ List<EClass> eSuperTypes = theEClass.getESuperTypes();
+ return eSuperTypes.isEmpty() ? defaultCase(theEObject) : doSwitch(eSuperTypes.get(0), theEObject);
+ }
+ }
+
+ /**
+ * Calls <code>caseXXX</code> for each class of the model until one returns a non null result; it yields that result.
+ * <!-- begin-user-doc --> <!-- end-user-doc -->
+ *
+ * @return the first non-null result returned by a <code>caseXXX</code> call.
+ * @generated
+ */
+ protected T doSwitch(int classifierID, EObject theEObject)
+ {
+ switch (classifierID)
+ {
+ case MangoPackage.VALUE_LIST:
+ {
+ ValueList valueList = (ValueList)theEObject;
+ T result = caseValueList(valueList);
+ if (result == null) result = defaultCase(theEObject);
+ return result;
+ }
+ case MangoPackage.VALUE:
+ {
+ Value value = (Value)theEObject;
+ T result = caseValue(value);
+ if (result == null) result = defaultCase(theEObject);
+ return result;
+ }
+ default:
+ return defaultCase(theEObject);
+ }
+ }
+
+ /**
+ * Returns the result of interpreting the object as an instance of '<em>Value List</em>'. <!-- begin-user-doc --> This
+ * implementation returns null; returning a non-null result will terminate the switch. <!-- end-user-doc -->
+ *
+ * @param object
+ * the target of the switch.
+ * @return the result of interpreting the object as an instance of '<em>Value List</em>'.
+ * @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject)
+ * @generated
+ */
+ public T caseValueList(ValueList object)
+ {
+ return null;
+ }
+
+ /**
+ * Returns the result of interpreting the object as an instance of '<em>Value</em>'. <!-- begin-user-doc --> This
+ * implementation returns null; returning a non-null result will terminate the switch. <!-- end-user-doc -->
+ *
+ * @param object
+ * the target of the switch.
+ * @return the result of interpreting the object as an instance of '<em>Value</em>'.
+ * @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject)
+ * @generated
+ */
+ public T caseValue(Value object)
+ {
+ return null;
+ }
+
+ /**
+ * Returns the result of interpreting the object as an instance of '<em>EObject</em>'. <!-- begin-user-doc --> This
+ * implementation returns null; returning a non-null result will terminate the switch, but this is the last case
+ * anyway. <!-- end-user-doc -->
+ *
+ * @param object
+ * the target of the switch.
+ * @return the result of interpreting the object as an instance of '<em>EObject</em>'.
+ * @see #doSwitch(org.eclipse.emf.ecore.EObject)
+ * @generated
+ */
+ public T defaultCase(EObject object)
+ {
+ return null;
+ }
+
+} // MangoSwitch
diff --git a/plugins/org.eclipse.emf.cdo.tests.model1/META-INF/MANIFEST.MF b/plugins/org.eclipse.emf.cdo.tests.model1/META-INF/MANIFEST.MF
new file mode 100644
index 0000000000..664e5a7c2a
--- /dev/null
+++ b/plugins/org.eclipse.emf.cdo.tests.model1/META-INF/MANIFEST.MF
@@ -0,0 +1,14 @@
+Manifest-Version: 1.0
+Bundle-ManifestVersion: 2
+Bundle-SymbolicName: org.eclipse.emf.cdo.tests.model1; singleton:=true
+Bundle-Version: 1.0.0.qualifier
+Bundle-Name: %pluginName
+Bundle-Vendor: %providerName
+Bundle-Localization: plugin
+Bundle-RequiredExecutionEnvironment: J2SE-1.5
+Bundle-ClassPath: .
+Require-Bundle: org.eclipse.core.runtime;bundle-version="[3.4.0,4.0.0)",
+ org.eclipse.emf.cdo;bundle-version="[1.0.0,2.0.0)";visibility:=reexport
+Export-Package: org.eclipse.emf.cdo.tests.model1;version="1.0.0",
+ org.eclipse.emf.cdo.tests.model1.impl;version="1.0.0",
+ org.eclipse.emf.cdo.tests.model1.util;version="1.0.0"
diff --git a/plugins/org.eclipse.emf.cdo.tests.model1/plugin.properties b/plugins/org.eclipse.emf.cdo.tests.model1/plugin.properties
new file mode 100644
index 0000000000..2a930826e7
--- /dev/null
+++ b/plugins/org.eclipse.emf.cdo.tests.model1/plugin.properties
@@ -0,0 +1,25 @@
+# Copyright (c) 2004 - 2008 Eike Stepper, Germany.
+# All rights reserved. This program and the accompanying materials
+# are made available under the terms of the Eclipse Public License v1.0
+# which accompanies this distribution, and is available at
+# http://www.eclipse.org/legal/epl-v10.html
+#
+# Contributors:
+# Eike Stepper - initial API and implementation
+
+# NLS_MESSAGEFORMAT_VAR
+
+# ==============================================================================
+# Do not change the properties between this line and the last line containing:
+# %%% END OF TRANSLATED PROPERTIES %%%
+# Instead, either redefine an existing property, or create a new property,
+# append it to the end of the file, and change the code to use the new name.
+# ==============================================================================
+
+pluginName = CDO Tests Model1
+providerName = Eclipse.org
+
+# ==============================================================================
+# %%% END OF TRANSLATED PROPERTIES %%%
+# The above properties have been shipped for translation.
+# ==============================================================================
diff --git a/plugins/org.eclipse.emf.cdo.tests.model1/src/org/eclipse/emf/cdo/tests/model1/Address.java b/plugins/org.eclipse.emf.cdo.tests.model1/src/org/eclipse/emf/cdo/tests/model1/Address.java
new file mode 100644
index 0000000000..11e5918dea
--- /dev/null
+++ b/plugins/org.eclipse.emf.cdo.tests.model1/src/org/eclipse/emf/cdo/tests/model1/Address.java
@@ -0,0 +1,107 @@
+/**
+ * <copyright>
+ * </copyright>
+ *
+ * $Id$
+ */
+package org.eclipse.emf.cdo.tests.model1;
+
+import org.eclipse.emf.cdo.CDOObject;
+
+/**
+ * <!-- begin-user-doc --> A representation of the model object '<em><b>Address</b></em>'. <!-- end-user-doc -->
+ * <p>
+ * The following features are supported:
+ * <ul>
+ * <li>{@link org.eclipse.emf.cdo.tests.model1.Address#getName <em>Name</em>}</li>
+ * <li>{@link org.eclipse.emf.cdo.tests.model1.Address#getStreet <em>Street</em>}</li>
+ * <li>{@link org.eclipse.emf.cdo.tests.model1.Address#getCity <em>City</em>}</li>
+ * </ul>
+ * </p>
+ *
+ * @see org.eclipse.emf.cdo.tests.model1.Model1Package#getAddress()
+ * @model
+ * @extends CDOObject
+ * @generated
+ */
+public interface Address extends CDOObject
+{
+ /**
+ * Returns the value of the '<em><b>Name</b></em>' attribute. <!-- begin-user-doc -->
+ * <p>
+ * If the meaning of the '<em>Name</em>' attribute isn't clear, there really should be more of a description here...
+ * </p>
+ * <!-- end-user-doc -->
+ *
+ * @return the value of the '<em>Name</em>' attribute.
+ * @see #setName(String)
+ * @see org.eclipse.emf.cdo.tests.model1.Model1Package#getAddress_Name()
+ * @model
+ * @generated
+ */
+ String getName();
+
+ /**
+ * Sets the value of the '{@link org.eclipse.emf.cdo.tests.model1.Address#getName <em>Name</em>}' attribute. <!--
+ * begin-user-doc --> <!-- end-user-doc -->
+ *
+ * @param value
+ * the new value of the '<em>Name</em>' attribute.
+ * @see #getName()
+ * @generated
+ */
+ void setName(String value);
+
+ /**
+ * Returns the value of the '<em><b>Street</b></em>' attribute. <!-- begin-user-doc -->
+ * <p>
+ * If the meaning of the '<em>Street</em>' attribute isn't clear, there really should be more of a description here...
+ * </p>
+ * <!-- end-user-doc -->
+ *
+ * @return the value of the '<em>Street</em>' attribute.
+ * @see #setStreet(String)
+ * @see org.eclipse.emf.cdo.tests.model1.Model1Package#getAddress_Street()
+ * @model
+ * @generated
+ */
+ String getStreet();
+
+ /**
+ * Sets the value of the '{@link org.eclipse.emf.cdo.tests.model1.Address#getStreet <em>Street</em>}' attribute. <!--
+ * begin-user-doc --> <!-- end-user-doc -->
+ *
+ * @param value
+ * the new value of the '<em>Street</em>' attribute.
+ * @see #getStreet()
+ * @generated
+ */
+ void setStreet(String value);
+
+ /**
+ * Returns the value of the '<em><b>City</b></em>' attribute. <!-- begin-user-doc -->
+ * <p>
+ * If the meaning of the '<em>City</em>' attribute isn't clear, there really should be more of a description here...
+ * </p>
+ * <!-- end-user-doc -->
+ *
+ * @return the value of the '<em>City</em>' attribute.
+ * @see #setCity(String)
+ * @see org.eclipse.emf.cdo.tests.model1.Model1Package#getAddress_City()
+ * @model
+ * @generated
+ */
+ String getCity();
+
+ /**
+ * Sets the value of the '{@link org.eclipse.emf.cdo.tests.model1.Address#getCity <em>City</em>}' attribute. <!--
+ * begin-user-doc --> <!-- end-user-doc -->
+ *
+ * @param value
+ * the new value of the '<em>City</em>' attribute.
+ * @see #getCity()
+ * @generated
+ */
+ void setCity(String value);
+
+} // Address
diff --git a/plugins/org.eclipse.emf.cdo.tests.model1/src/org/eclipse/emf/cdo/tests/model1/Category.java b/plugins/org.eclipse.emf.cdo.tests.model1/src/org/eclipse/emf/cdo/tests/model1/Category.java
new file mode 100644
index 0000000000..97389dd16a
--- /dev/null
+++ b/plugins/org.eclipse.emf.cdo.tests.model1/src/org/eclipse/emf/cdo/tests/model1/Category.java
@@ -0,0 +1,89 @@
+/**
+ * <copyright>
+ * </copyright>
+ *
+ * $Id$
+ */
+package org.eclipse.emf.cdo.tests.model1;
+
+import org.eclipse.emf.cdo.CDOObject;
+
+import org.eclipse.emf.common.util.EList;
+
+/**
+ * <!-- begin-user-doc --> A representation of the model object '<em><b>Category</b></em>'. <!-- end-user-doc -->
+ * <p>
+ * The following features are supported:
+ * <ul>
+ * <li>{@link org.eclipse.emf.cdo.tests.model1.Category#getName <em>Name</em>}</li>
+ * <li>{@link org.eclipse.emf.cdo.tests.model1.Category#getCategories <em>Categories</em>}</li>
+ * <li>{@link org.eclipse.emf.cdo.tests.model1.Category#getProducts <em>Products</em>}</li>
+ * </ul>
+ * </p>
+ *
+ * @see org.eclipse.emf.cdo.tests.model1.Model1Package#getCategory()
+ * @model
+ * @extends CDOObject
+ * @generated
+ */
+public interface Category extends CDOObject
+{
+ /**
+ * Returns the value of the '<em><b>Name</b></em>' attribute. <!-- begin-user-doc -->
+ * <p>
+ * If the meaning of the '<em>Name</em>' attribute isn't clear, there really should be more of a description here...
+ * </p>
+ * <!-- end-user-doc -->
+ *
+ * @return the value of the '<em>Name</em>' attribute.
+ * @see #setName(String)
+ * @see org.eclipse.emf.cdo.tests.model1.Model1Package#getCategory_Name()
+ * @model
+ * @generated
+ */
+ String getName();
+
+ /**
+ * Sets the value of the '{@link org.eclipse.emf.cdo.tests.model1.Category#getName <em>Name</em>}' attribute. <!--
+ * begin-user-doc --> <!-- end-user-doc -->
+ *
+ * @param value
+ * the new value of the '<em>Name</em>' attribute.
+ * @see #getName()
+ * @generated
+ */
+ void setName(String value);
+
+ /**
+ * Returns the value of the '<em><b>Categories</b></em>' containment reference list. The list contents are of type
+ * {@link org.eclipse.emf.cdo.tests.model1.Category}. <!-- begin-user-doc -->
+ * <p>
+ * If the meaning of the '<em>Categories</em>' containment reference list isn't clear, there really should be more of
+ * a description here...
+ * </p>
+ * <!-- end-user-doc -->
+ *
+ * @return the value of the '<em>Categories</em>' containment reference list.
+ * @see org.eclipse.emf.cdo.tests.model1.Model1Package#getCategory_Categories()
+ * @model containment="true"
+ * @generated
+ */
+ EList<Category> getCategories();
+
+ /**
+ * Returns the value of the '<em><b>Products</b></em>' containment reference list. The list contents are of type
+ * {@link org.eclipse.emf.cdo.tests.model1.Product}. <!-- begin-user-doc -->
+ * <p>
+ * If the meaning of the '<em>Products</em>' containment reference list isn't clear, there really should be more of a
+ * description here...
+ * </p>
+ * <!-- end-user-doc -->
+ *
+ * @return the value of the '<em>Products</em>' containment reference list.
+ * @see org.eclipse.emf.cdo.tests.model1.Model1Package#getCategory_Products()
+ * @model containment="true"
+ * @generated
+ */
+ EList<Product> getProducts();
+
+} // Category
diff --git a/plugins/org.eclipse.emf.cdo.tests.model1/src/org/eclipse/emf/cdo/tests/model1/Company.java b/plugins/org.eclipse.emf.cdo.tests.model1/src/org/eclipse/emf/cdo/tests/model1/Company.java
new file mode 100644
index 0000000000..0e0ece350f
--- /dev/null
+++ b/plugins/org.eclipse.emf.cdo.tests.model1/src/org/eclipse/emf/cdo/tests/model1/Company.java
@@ -0,0 +1,110 @@
+/**
+ * <copyright>
+ * </copyright>
+ *
+ * $Id$
+ */
+package org.eclipse.emf.cdo.tests.model1;
+
+import org.eclipse.emf.common.util.EList;
+
+/**
+ * <!-- begin-user-doc --> A representation of the model object '<em><b>Company</b></em>'. <!-- end-user-doc -->
+ * <p>
+ * The following features are supported:
+ * <ul>
+ * <li>{@link org.eclipse.emf.cdo.tests.model1.Company#getCategories <em>Categories</em>}</li>
+ * <li>{@link org.eclipse.emf.cdo.tests.model1.Company#getSuppliers <em>Suppliers</em>}</li>
+ * <li>{@link org.eclipse.emf.cdo.tests.model1.Company#getCustomers <em>Customers</em>}</li>
+ * <li>{@link org.eclipse.emf.cdo.tests.model1.Company#getPurchaseOrders <em>Purchase Orders</em>}</li>
+ * <li>{@link org.eclipse.emf.cdo.tests.model1.Company#getSalesOrders <em>Sales Orders</em>}</li>
+ * </ul>
+ * </p>
+ *
+ * @see org.eclipse.emf.cdo.tests.model1.Model1Package#getCompany()
+ * @model
+ * @generated
+ */
+public interface Company extends Address
+{
+ /**
+ * Returns the value of the '<em><b>Categories</b></em>' containment reference list. The list contents are of type
+ * {@link org.eclipse.emf.cdo.tests.model1.Category}. <!-- begin-user-doc -->
+ * <p>
+ * If the meaning of the '<em>Categories</em>' containment reference list isn't clear, there really should be more of
+ * a description here...
+ * </p>
+ * <!-- end-user-doc -->
+ *
+ * @return the value of the '<em>Categories</em>' containment reference list.
+ * @see org.eclipse.emf.cdo.tests.model1.Model1Package#getCompany_Categories()
+ * @model containment="true"
+ * @generated
+ */
+ EList<Category> getCategories();
+
+ /**
+ * Returns the value of the '<em><b>Suppliers</b></em>' containment reference list. The list contents are of type
+ * {@link org.eclipse.emf.cdo.tests.model1.Supplier}. <!-- begin-user-doc -->
+ * <p>
+ * If the meaning of the '<em>Suppliers</em>' containment reference list isn't clear, there really should be more of a
+ * description here...
+ * </p>
+ * <!-- end-user-doc -->
+ *
+ * @return the value of the '<em>Suppliers</em>' containment reference list.
+ * @see org.eclipse.emf.cdo.tests.model1.Model1Package#getCompany_Suppliers()
+ * @model containment="true"
+ * @generated
+ */
+ EList<Supplier> getSuppliers();
+
+ /**
+ * Returns the value of the '<em><b>Purchase Orders</b></em>' containment reference list. The list contents are of
+ * type {@link org.eclipse.emf.cdo.tests.model1.PurchaseOrder}. <!-- begin-user-doc -->
+ * <p>
+ * If the meaning of the '<em>Purchase Orders</em>' containment reference list isn't clear, there really should be
+ * more of a description here...
+ * </p>
+ * <!-- end-user-doc -->
+ *
+ * @return the value of the '<em>Purchase Orders</em>' containment reference list.
+ * @see org.eclipse.emf.cdo.tests.model1.Model1Package#getCompany_PurchaseOrders()
+ * @model containment="true"
+ * @generated
+ */
+ EList<PurchaseOrder> getPurchaseOrders();
+
+ /**
+ * Returns the value of the '<em><b>Customers</b></em>' containment reference list. The list contents are of type
+ * {@link org.eclipse.emf.cdo.tests.model1.Customer}. <!-- begin-user-doc -->
+ * <p>
+ * If the meaning of the '<em>Customers</em>' containment reference list isn't clear, there really should be more of a
+ * description here...
+ * </p>
+ * <!-- end-user-doc -->
+ *
+ * @return the value of the '<em>Customers</em>' containment reference list.
+ * @see org.eclipse.emf.cdo.tests.model1.Model1Package#getCompany_Customers()
+ * @model containment="true"
+ * @generated
+ */
+ EList<Customer> getCustomers();
+
+ /**
+ * Returns the value of the '<em><b>Sales Orders</b></em>' containment reference list. The list contents are of type
+ * {@link org.eclipse.emf.cdo.tests.model1.SalesOrder}. <!-- begin-user-doc -->
+ * <p>
+ * If the meaning of the '<em>Sales Orders</em>' containment reference list isn't clear, there really should be more
+ * of a description here...
+ * </p>
+ * <!-- end-user-doc -->
+ *
+ * @return the value of the '<em>Sales Orders</em>' containment reference list.
+ * @see org.eclipse.emf.cdo.tests.model1.Model1Package#getCompany_SalesOrders()
+ * @model containment="true"
+ * @generated
+ */
+ EList<SalesOrder> getSalesOrders();
+
+} // Company
diff --git a/plugins/org.eclipse.emf.cdo.tests.model1/src/org/eclipse/emf/cdo/tests/model1/Customer.java b/plugins/org.eclipse.emf.cdo.tests.model1/src/org/eclipse/emf/cdo/tests/model1/Customer.java
new file mode 100644
index 0000000000..c9c901d7f0
--- /dev/null
+++ b/plugins/org.eclipse.emf.cdo.tests.model1/src/org/eclipse/emf/cdo/tests/model1/Customer.java
@@ -0,0 +1,44 @@
+/**
+ * <copyright>
+ * </copyright>
+ *
+ * $Id$
+ */
+package org.eclipse.emf.cdo.tests.model1;
+
+import org.eclipse.emf.common.util.EList;
+
+/**
+ * <!-- begin-user-doc --> A representation of the model object '<em><b>Customer</b></em>'. <!-- end-user-doc -->
+ * <p>
+ * The following features are supported:
+ * <ul>
+ * <li>{@link org.eclipse.emf.cdo.tests.model1.Customer#getSalesOrders <em>Sales Orders</em>}</li>
+ * </ul>
+ * </p>
+ *
+ * @see org.eclipse.emf.cdo.tests.model1.Model1Package#getCustomer()
+ * @model
+ * @generated
+ */
+public interface Customer extends Address
+{
+ /**
+ * Returns the value of the '<em><b>Sales Orders</b></em>' reference list. The list contents are of type
+ * {@link org.eclipse.emf.cdo.tests.model1.SalesOrder}. It is bidirectional and its opposite is '
+ * {@link org.eclipse.emf.cdo.tests.model1.SalesOrder#getCustomer <em>Customer</em>}'. <!-- begin-user-doc -->
+ * <p>
+ * If the meaning of the '<em>Sales Orders</em>' reference list isn't clear, there really should be more of a
+ * description here...
+ * </p>
+ * <!-- end-user-doc -->
+ *
+ * @return the value of the '<em>Sales Orders</em>' reference list.
+ * @see org.eclipse.emf.cdo.tests.model1.Model1Package#getCustomer_SalesOrders()
+ * @see org.eclipse.emf.cdo.tests.model1.SalesOrder#getCustomer
+ * @model opposite="customer"
+ * @generated
+ */
+ EList<SalesOrder> getSalesOrders();
+
+} // Customer
diff --git a/plugins/org.eclipse.emf.cdo.tests.model1/src/org/eclipse/emf/cdo/tests/model1/Model1Package.java b/plugins/org.eclipse.emf.cdo.tests.model1/src/org/eclipse/emf/cdo/tests/model1/Model1Package.java
new file mode 100644
index 0000000000..17f0f7c306
--- /dev/null
+++ b/plugins/org.eclipse.emf.cdo.tests.model1/src/org/eclipse/emf/cdo/tests/model1/Model1Package.java
@@ -0,0 +1,1402 @@
+/**
+ * <copyright>
+ * </copyright>
+ *
+ * $Id$
+ */
+package org.eclipse.emf.cdo.tests.model1;
+
+import org.eclipse.emf.ecore.EAttribute;
+import org.eclipse.emf.ecore.EClass;
+import org.eclipse.emf.ecore.EEnum;
+import org.eclipse.emf.ecore.EPackage;
+import org.eclipse.emf.ecore.EReference;
+
+/**
+ * <!-- begin-user-doc --> The <b>Package</b> for the model. It contains accessors for the meta objects to represent
+ * <ul>
+ * <li>each class,</li>
+ * <li>each feature of each class,</li>
+ * <li>each enum,</li>
+ * <li>and each data type</li>
+ * </ul>
+ * <!-- end-user-doc -->
+ *
+ * @see org.eclipse.emf.cdo.tests.model1.Model1Factory
+ * @model kind="package"
+ * @generated
+ */
+public interface Model1Package extends EPackage
+{
+ /**
+ * The package name. <!-- begin-user-doc --> <!-- end-user-doc -->
+ *
+ * @generated
+ */
+ String eNAME = "model1";
+
+ /**
+ * The package namespace URI. <!-- begin-user-doc --> <!-- end-user-doc -->
+ *
+ * @generated
+ */
+ String eNS_URI = "http://www.eclipse.org/emf/CDO/tests/model1/1.0.0";
+
+ /**
+ * The package namespace name. <!-- begin-user-doc --> <!-- end-user-doc -->
+ *
+ * @generated
+ */
+ String eNS_PREFIX = "model1";
+
+ /**
+ * The singleton instance of the package. <!-- begin-user-doc --> <!-- end-user-doc -->
+ *
+ * @generated
+ */
+ Model1Package eINSTANCE = org.eclipse.emf.cdo.tests.model1.impl.Model1PackageImpl.init();
+
+ /**
+ * The meta object id for the '{@link org.eclipse.emf.cdo.tests.model1.impl.AddressImpl <em>Address</em>}' class. <!--
+ * begin-user-doc --> <!-- end-user-doc -->
+ *
+ * @see org.eclipse.emf.cdo.tests.model1.impl.AddressImpl
+ * @see org.eclipse.emf.cdo.tests.model1.impl.Model1PackageImpl#getAddress()
+ * @generated
+ */
+ int ADDRESS = 0;
+
+ /**
+ * The feature id for the '<em><b>Name</b></em>' attribute. <!-- begin-user-doc --> <!-- end-user-doc -->
+ *
+ * @generated
+ * @ordered
+ */
+ int ADDRESS__NAME = 0;
+
+ /**
+ * The feature id for the '<em><b>Street</b></em>' attribute. <!-- begin-user-doc --> <!-- end-user-doc -->
+ *
+ * @generated
+ * @ordered
+ */
+ int ADDRESS__STREET = 1;
+
+ /**
+ * The feature id for the '<em><b>City</b></em>' attribute. <!-- begin-user-doc --> <!-- end-user-doc -->
+ *
+ * @generated
+ * @ordered
+ */
+ int ADDRESS__CITY = 2;
+
+ /**
+ * The number of structural features of the '<em>Address</em>' class. <!-- begin-user-doc --> <!-- end-user-doc -->
+ *
+ * @generated
+ * @ordered
+ */
+ int ADDRESS_FEATURE_COUNT = 3;
+
+ /**
+ * The meta object id for the '{@link org.eclipse.emf.cdo.tests.model1.impl.SupplierImpl <em>Supplier</em>}' class.
+ * <!-- begin-user-doc --> <!-- end-user-doc -->
+ *
+ * @see org.eclipse.emf.cdo.tests.model1.impl.SupplierImpl
+ * @see org.eclipse.emf.cdo.tests.model1.impl.Model1PackageImpl#getSupplier()
+ * @generated
+ */
+ int SUPPLIER = 2;
+
+ /**
+ * The meta object id for the '{@link org.eclipse.emf.cdo.tests.model1.impl.PurchaseOrderImpl <em>Purchase Order</em>}
+ * ' class. <!-- begin-user-doc --> <!-- end-user-doc -->
+ *
+ * @see org.eclipse.emf.cdo.tests.model1.impl.PurchaseOrderImpl
+ * @see org.eclipse.emf.cdo.tests.model1.impl.Model1PackageImpl#getPurchaseOrder()
+ * @generated
+ */
+ int PURCHASE_ORDER = 6;
+
+ /**
+ * The meta object id for the '{@link org.eclipse.emf.cdo.tests.model1.impl.OrderDetailImpl <em>Order Detail</em>}'
+ * class. <!-- begin-user-doc --> <!-- end-user-doc -->
+ *
+ * @see org.eclipse.emf.cdo.tests.model1.impl.OrderDetailImpl
+ * @see org.eclipse.emf.cdo.tests.model1.impl.Model1PackageImpl#getOrderDetail()
+ * @generated
+ */
+ int ORDER_DETAIL = 5;
+
+ /**
+ * The meta object id for the '{@link org.eclipse.emf.cdo.tests.model1.impl.ProductImpl <em>Product</em>}' class. <!--
+ * begin-user-doc --> <!-- end-user-doc -->
+ *
+ * @see org.eclipse.emf.cdo.tests.model1.impl.ProductImpl
+ * @see org.eclipse.emf.cdo.tests.model1.impl.Model1PackageImpl#getProduct()
+ * @generated
+ */
+ int PRODUCT = 9;
+
+ /**
+ * Returns the meta object for class '{@link org.eclipse.emf.cdo.tests.model1.Address <em>Address</em>}'. <!--
+ * begin-user-doc --> <!-- end-user-doc -->
+ *
+ * @return the meta object for class '<em>Address</em>'.
+ * @see org.eclipse.emf.cdo.tests.model1.Address
+ * @generated
+ */
+ EClass getAddress();
+
+ /**
+ * Returns the meta object for the attribute '{@link org.eclipse.emf.cdo.tests.model1.Address#getName <em>Name</em>}'.
+ * <!-- begin-user-doc --> <!-- end-user-doc -->
+ *
+ * @return the meta object for the attribute '<em>Name</em>'.
+ * @see org.eclipse.emf.cdo.tests.model1.Address#getName()
+ * @see #getAddress()
+ * @generated
+ */
+ EAttribute getAddress_Name();
+
+ /**
+ * Returns the meta object for the attribute '{@link org.eclipse.emf.cdo.tests.model1.Address#getStreet
+ * <em>Street</em>}'. <!-- begin-user-doc --> <!-- end-user-doc -->
+ *
+ * @return the meta object for the attribute '<em>Street</em>'.
+ * @see org.eclipse.emf.cdo.tests.model1.Address#getStreet()
+ * @see #getAddress()
+ * @generated
+ */
+ EAttribute getAddress_Street();
+
+ /**
+ * Returns the meta object for the attribute '{@link org.eclipse.emf.cdo.tests.model1.Address#getCity <em>City</em>}'.
+ * <!-- begin-user-doc --> <!-- end-user-doc -->
+ *
+ * @return the meta object for the attribute '<em>City</em>'.
+ * @see org.eclipse.emf.cdo.tests.model1.Address#getCity()
+ * @see #getAddress()
+ * @generated
+ */
+ EAttribute getAddress_City();
+
+ /**
+ * The meta object id for the '{@link org.eclipse.emf.cdo.tests.model1.impl.CategoryImpl <em>Category</em>}' class.
+ * <!-- begin-user-doc --> <!-- end-user-doc -->
+ *
+ * @see org.eclipse.emf.cdo.tests.model1.impl.CategoryImpl
+ * @see org.eclipse.emf.cdo.tests.model1.impl.Model1PackageImpl#getCategory()
+ * @generated
+ */
+ int CATEGORY = 8;
+
+ /**
+ * The meta object id for the '{@link org.eclipse.emf.cdo.tests.model1.impl.CompanyImpl <em>Company</em>}' class. <!--
+ * begin-user-doc --> <!-- end-user-doc -->
+ *
+ * @see org.eclipse.emf.cdo.tests.model1.impl.CompanyImpl
+ * @see org.eclipse.emf.cdo.tests.model1.impl.Model1PackageImpl#getCompany()
+ * @generated
+ */
+ int COMPANY = 1;
+
+ /**
+ * The feature id for the '<em><b>Name</b></em>' attribute. <!-- begin-user-doc --> <!-- end-user-doc -->
+ *
+ * @generated
+ * @ordered
+ */
+ int COMPANY__NAME = ADDRESS__NAME;
+
+ /**
+ * The feature id for the '<em><b>Street</b></em>' attribute. <!-- begin-user-doc --> <!-- end-user-doc -->
+ *
+ * @generated
+ * @ordered
+ */
+ int COMPANY__STREET = ADDRESS__STREET;
+
+ /**
+ * The feature id for the '<em><b>City</b></em>' attribute. <!-- begin-user-doc --> <!-- end-user-doc -->
+ *
+ * @generated
+ * @ordered
+ */
+ int COMPANY__CITY = ADDRESS__CITY;
+
+ /**
+ * The feature id for the '<em><b>Categories</b></em>' containment reference list. <!-- begin-user-doc --> <!--
+ * end-user-doc -->
+ *
+ * @generated
+ * @ordered
+ */
+ int COMPANY__CATEGORIES = ADDRESS_FEATURE_COUNT + 0;
+
+ /**
+ * The feature id for the '<em><b>Suppliers</b></em>' containment reference list. <!-- begin-user-doc --> <!--
+ * end-user-doc -->
+ *
+ * @generated
+ * @ordered
+ */
+ int COMPANY__SUPPLIERS = ADDRESS_FEATURE_COUNT + 1;
+
+ /**
+ * The feature id for the '<em><b>Customers</b></em>' containment reference list. <!-- begin-user-doc --> <!--
+ * end-user-doc -->
+ *
+ * @generated
+ * @ordered
+ */
+ int COMPANY__CUSTOMERS = ADDRESS_FEATURE_COUNT + 2;
+
+ /**
+ * The feature id for the '<em><b>Purchase Orders</b></em>' containment reference list. <!-- begin-user-doc --> <!--
+ * end-user-doc -->
+ *
+ * @generated
+ * @ordered
+ */
+ int COMPANY__PURCHASE_ORDERS = ADDRESS_FEATURE_COUNT + 3;
+
+ /**
+ * The feature id for the '<em><b>Sales Orders</b></em>' containment reference list. <!-- begin-user-doc --> <!--
+ * end-user-doc -->
+ *
+ * @generated
+ * @ordered
+ */
+ int COMPANY__SALES_ORDERS = ADDRESS_FEATURE_COUNT + 4;
+
+ /**
+ * The number of structural features of the '<em>Company</em>' class. <!-- begin-user-doc --> <!-- end-user-doc -->
+ *
+ * @generated
+ * @ordered
+ */
+ int COMPANY_FEATURE_COUNT = ADDRESS_FEATURE_COUNT + 5;
+
+ /**
+ * The feature id for the '<em><b>Name</b></em>' attribute. <!-- begin-user-doc --> <!-- end-user-doc -->
+ *
+ * @generated
+ * @ordered
+ */
+ int SUPPLIER__NAME = ADDRESS__NAME;
+
+ /**
+ * The feature id for the '<em><b>Street</b></em>' attribute. <!-- begin-user-doc --> <!-- end-user-doc -->
+ *
+ * @generated
+ * @ordered
+ */
+ int SUPPLIER__STREET = ADDRESS__STREET;
+
+ /**
+ * The feature id for the '<em><b>City</b></em>' attribute. <!-- begin-user-doc --> <!-- end-user-doc -->
+ *
+ * @generated
+ * @ordered
+ */
+ int SUPPLIER__CITY = ADDRESS__CITY;
+
+ /**
+ * The feature id for the '<em><b>Purchase Orders</b></em>' reference list. <!-- begin-user-doc --> <!-- end-user-doc
+ * -->
+ *
+ * @generated
+ * @ordered
+ */
+ int SUPPLIER__PURCHASE_ORDERS = ADDRESS_FEATURE_COUNT + 0;
+
+ /**
+ * The feature id for the '<em><b>Preferred</b></em>' attribute. <!-- begin-user-doc --> <!-- end-user-doc -->
+ *
+ * @generated
+ * @ordered
+ */
+ int SUPPLIER__PREFERRED = ADDRESS_FEATURE_COUNT + 1;
+
+ /**
+ * The number of structural features of the '<em>Supplier</em>' class. <!-- begin-user-doc --> <!-- end-user-doc -->
+ *
+ * @generated
+ * @ordered
+ */
+ int SUPPLIER_FEATURE_COUNT = ADDRESS_FEATURE_COUNT + 2;
+
+ /**
+ * The meta object id for the '{@link org.eclipse.emf.cdo.tests.model1.impl.CustomerImpl <em>Customer</em>}' class.
+ * <!-- begin-user-doc --> <!-- end-user-doc -->
+ *
+ * @see org.eclipse.emf.cdo.tests.model1.impl.CustomerImpl
+ * @see org.eclipse.emf.cdo.tests.model1.impl.Model1PackageImpl#getCustomer()
+ * @generated
+ */
+ int CUSTOMER = 3;
+
+ /**
+ * The feature id for the '<em><b>Name</b></em>' attribute. <!-- begin-user-doc --> <!-- end-user-doc -->
+ *
+ * @generated
+ * @ordered
+ */
+ int CUSTOMER__NAME = ADDRESS__NAME;
+
+ /**
+ * The feature id for the '<em><b>Street</b></em>' attribute. <!-- begin-user-doc --> <!-- end-user-doc -->
+ *
+ * @generated
+ * @ordered
+ */
+ int CUSTOMER__STREET = ADDRESS__STREET;
+
+ /**
+ * The feature id for the '<em><b>City</b></em>' attribute. <!-- begin-user-doc --> <!-- end-user-doc -->
+ *
+ * @generated
+ * @ordered
+ */
+ int CUSTOMER__CITY = ADDRESS__CITY;
+
+ /**
+ * The feature id for the '<em><b>Sales Orders</b></em>' reference list. <!-- begin-user-doc --> <!-- end-user-doc -->
+ *
+ * @generated
+ * @ordered
+ */
+ int CUSTOMER__SALES_ORDERS = ADDRESS_FEATURE_COUNT + 0;
+
+ /**
+ * The number of structural features of the '<em>Customer</em>' class. <!-- begin-user-doc --> <!-- end-user-doc -->
+ *
+ * @generated
+ * @ordered
+ */
+ int CUSTOMER_FEATURE_COUNT = ADDRESS_FEATURE_COUNT + 1;
+
+ /**
+ * The meta object id for the '{@link org.eclipse.emf.cdo.tests.model1.impl.OrderImpl <em>Order</em>}' class. <!--
+ * begin-user-doc --> <!-- end-user-doc -->
+ *
+ * @see org.eclipse.emf.cdo.tests.model1.impl.OrderImpl
+ * @see org.eclipse.emf.cdo.tests.model1.impl.Model1PackageImpl#getOrder()
+ * @generated
+ */
+ int ORDER = 4;
+
+ /**
+ * The feature id for the '<em><b>Order Details</b></em>' containment reference list. <!-- begin-user-doc --> <!--
+ * end-user-doc -->
+ *
+ * @generated
+ * @ordered
+ */
+ int ORDER__ORDER_DETAILS = 0;
+
+ /**
+ * The number of structural features of the '<em>Order</em>' class. <!-- begin-user-doc --> <!-- end-user-doc -->
+ *
+ * @generated
+ * @ordered
+ */
+ int ORDER_FEATURE_COUNT = 1;
+
+ /**
+ * The feature id for the '<em><b>Order</b></em>' container reference. <!-- begin-user-doc --> <!-- end-user-doc -->
+ *
+ * @generated
+ * @ordered
+ */
+ int ORDER_DETAIL__ORDER = 0;
+
+ /**
+ * The feature id for the '<em><b>Product</b></em>' reference. <!-- begin-user-doc --> <!-- end-user-doc -->
+ *
+ * @generated
+ * @ordered
+ */
+ int ORDER_DETAIL__PRODUCT = 1;
+
+ /**
+ * The feature id for the '<em><b>Price</b></em>' attribute. <!-- begin-user-doc --> <!-- end-user-doc -->
+ *
+ * @generated
+ * @ordered
+ */
+ int ORDER_DETAIL__PRICE = 2;
+
+ /**
+ * The number of structural features of the '<em>Order Detail</em>' class. <!-- begin-user-doc --> <!-- end-user-doc
+ * -->
+ *
+ * @generated
+ * @ordered
+ */
+ int ORDER_DETAIL_FEATURE_COUNT = 3;
+
+ /**
+ * The feature id for the '<em><b>Order Details</b></em>' containment reference list. <!-- begin-user-doc --> <!--
+ * end-user-doc -->
+ *
+ * @generated
+ * @ordered
+ */
+ int PURCHASE_ORDER__ORDER_DETAILS = ORDER__ORDER_DETAILS;
+
+ /**
+ * The feature id for the '<em><b>Date</b></em>' attribute. <!-- begin-user-doc --> <!-- end-user-doc -->
+ *
+ * @generated
+ * @ordered
+ */
+ int PURCHASE_ORDER__DATE = ORDER_FEATURE_COUNT + 0;
+
+ /**
+ * The feature id for the '<em><b>Supplier</b></em>' reference. <!-- begin-user-doc --> <!-- end-user-doc -->
+ *
+ * @generated
+ * @ordered
+ */
+ int PURCHASE_ORDER__SUPPLIER = ORDER_FEATURE_COUNT + 1;
+
+ /**
+ * The number of structural features of the '<em>Purchase Order</em>' class. <!-- begin-user-doc --> <!-- end-user-doc
+ * -->
+ *
+ * @generated
+ * @ordered
+ */
+ int PURCHASE_ORDER_FEATURE_COUNT = ORDER_FEATURE_COUNT + 2;
+
+ /**
+ * The meta object id for the '{@link org.eclipse.emf.cdo.tests.model1.impl.SalesOrderImpl <em>Sales Order</em>}'
+ * class. <!-- begin-user-doc --> <!-- end-user-doc -->
+ *
+ * @see org.eclipse.emf.cdo.tests.model1.impl.SalesOrderImpl
+ * @see org.eclipse.emf.cdo.tests.model1.impl.Model1PackageImpl#getSalesOrder()
+ * @generated
+ */
+ int SALES_ORDER = 7;
+
+ /**
+ * The feature id for the '<em><b>Order Details</b></em>' containment reference list. <!-- begin-user-doc --> <!--
+ * end-user-doc -->
+ *
+ * @generated
+ * @ordered
+ */
+ int SALES_ORDER__ORDER_DETAILS = ORDER__ORDER_DETAILS;
+
+ /**
+ * The feature id for the '<em><b>Id</b></em>' attribute. <!-- begin-user-doc --> <!-- end-user-doc -->
+ *
+ * @generated
+ * @ordered
+ */
+ int SALES_ORDER__ID = ORDER_FEATURE_COUNT + 0;
+
+ /**
+ * The feature id for the '<em><b>Customer</b></em>' reference. <!-- begin-user-doc --> <!-- end-user-doc -->
+ *
+ * @generated
+ * @ordered
+ */
+ int SALES_ORDER__CUSTOMER = ORDER_FEATURE_COUNT + 1;
+
+ /**
+ * The number of structural features of the '<em>Sales Order</em>' class. <!-- begin-user-doc --> <!-- end-user-doc
+ * -->
+ *
+ * @generated
+ * @ordered
+ */
+ int SALES_ORDER_FEATURE_COUNT = ORDER_FEATURE_COUNT + 2;
+
+ /**
+ * The feature id for the '<em><b>Name</b></em>' attribute. <!-- begin-user-doc --> <!-- end-user-doc -->
+ *
+ * @generated
+ * @ordered
+ */
+ int CATEGORY__NAME = 0;
+
+ /**
+ * The feature id for the '<em><b>Categories</b></em>' containment reference list. <!-- begin-user-doc --> <!--
+ * end-user-doc -->
+ *
+ * @generated
+ * @ordered
+ */
+ int CATEGORY__CATEGORIES = 1;
+
+ /**
+ * The feature id for the '<em><b>Products</b></em>' containment reference list. <!-- begin-user-doc --> <!--
+ * end-user-doc -->
+ *
+ * @generated
+ * @ordered
+ */
+ int CATEGORY__PRODUCTS = 2;
+
+ /**
+ * The number of structural features of the '<em>Category</em>' class. <!-- begin-user-doc --> <!-- end-user-doc -->
+ *
+ * @generated
+ * @ordered
+ */
+ int CATEGORY_FEATURE_COUNT = 3;
+
+ /**
+ * The feature id for the '<em><b>Name</b></em>' attribute. <!-- begin-user-doc --> <!-- end-user-doc -->
+ *
+ * @generated
+ * @ordered
+ */
+ int PRODUCT__NAME = 0;
+
+ /**
+ * The feature id for the '<em><b>Order Details</b></em>' reference list. <!-- begin-user-doc --> <!-- end-user-doc
+ * -->
+ *
+ * @generated
+ * @ordered
+ */
+ int PRODUCT__ORDER_DETAILS = 1;
+
+ /**
+ * The feature id for the '<em><b>Vat</b></em>' attribute. <!-- begin-user-doc --> <!-- end-user-doc -->
+ *
+ * @generated
+ * @ordered
+ */
+ int PRODUCT__VAT = 2;
+
+ /**
+ * The number of structural features of the '<em>Product</em>' class. <!-- begin-user-doc --> <!-- end-user-doc -->
+ *
+ * @generated
+ * @ordered
+ */
+ int PRODUCT_FEATURE_COUNT = 3;
+
+ /**
+ * The meta object id for the '{@link org.eclipse.emf.cdo.tests.model1.impl.OrderAddressImpl <em>Order Address</em>}'
+ * class. <!-- begin-user-doc --> <!-- end-user-doc -->
+ *
+ * @see org.eclipse.emf.cdo.tests.model1.impl.OrderAddressImpl
+ * @see org.eclipse.emf.cdo.tests.model1.impl.Model1PackageImpl#getOrderAddress()
+ * @generated
+ */
+ int ORDER_ADDRESS = 10;
+
+ /**
+ * The feature id for the '<em><b>Name</b></em>' attribute. <!-- begin-user-doc --> <!-- end-user-doc -->
+ *
+ * @generated
+ * @ordered
+ */
+ int ORDER_ADDRESS__NAME = ADDRESS__NAME;
+
+ /**
+ * The feature id for the '<em><b>Street</b></em>' attribute. <!-- begin-user-doc --> <!-- end-user-doc -->
+ *
+ * @generated
+ * @ordered
+ */
+ int ORDER_ADDRESS__STREET = ADDRESS__STREET;
+
+ /**
+ * The feature id for the '<em><b>City</b></em>' attribute. <!-- begin-user-doc --> <!-- end-user-doc -->
+ *
+ * @generated
+ * @ordered
+ */
+ int ORDER_ADDRESS__CITY = ADDRESS__CITY;
+
+ /**
+ * The feature id for the '<em><b>Order Details</b></em>' containment reference list. <!-- begin-user-doc --> <!--
+ * end-user-doc -->
+ *
+ * @generated
+ * @ordered
+ */
+ int ORDER_ADDRESS__ORDER_DETAILS = ADDRESS_FEATURE_COUNT + 0;
+
+ /**
+ * The feature id for the '<em><b>Order</b></em>' container reference. <!-- begin-user-doc --> <!-- end-user-doc -->
+ *
+ * @generated
+ * @ordered
+ */
+ int ORDER_ADDRESS__ORDER = ADDRESS_FEATURE_COUNT + 1;
+
+ /**
+ * The feature id for the '<em><b>Product</b></em>' reference. <!-- begin-user-doc --> <!-- end-user-doc -->
+ *
+ * @generated
+ * @ordered
+ */
+ int ORDER_ADDRESS__PRODUCT = ADDRESS_FEATURE_COUNT + 2;
+
+ /**
+ * The feature id for the '<em><b>Price</b></em>' attribute. <!-- begin-user-doc --> <!-- end-user-doc -->
+ *
+ * @generated
+ * @ordered
+ */
+ int ORDER_ADDRESS__PRICE = ADDRESS_FEATURE_COUNT + 3;
+
+ /**
+ * The feature id for the '<em><b>Test Attribute</b></em>' attribute. <!-- begin-user-doc --> <!-- end-user-doc -->
+ *
+ * @generated
+ * @ordered
+ */
+ int ORDER_ADDRESS__TEST_ATTRIBUTE = ADDRESS_FEATURE_COUNT + 4;
+
+ /**
+ * The number of structural features of the '<em>Order Address</em>' class. <!-- begin-user-doc --> <!-- end-user-doc
+ * -->
+ *
+ * @generated
+ * @ordered
+ */
+ int ORDER_ADDRESS_FEATURE_COUNT = ADDRESS_FEATURE_COUNT + 5;
+
+ /**
+ * The meta object id for the '{@link org.eclipse.emf.cdo.tests.model1.VAT <em>VAT</em>}' enum. <!-- begin-user-doc
+ * --> <!-- end-user-doc -->
+ *
+ * @see org.eclipse.emf.cdo.tests.model1.VAT
+ * @see org.eclipse.emf.cdo.tests.model1.impl.Model1PackageImpl#getVAT()
+ * @generated
+ */
+ int VAT = 11;
+
+ /**
+ * Returns the meta object for class '{@link org.eclipse.emf.cdo.tests.model1.Supplier <em>Supplier</em>}'. <!--
+ * begin-user-doc --> <!-- end-user-doc -->
+ *
+ * @return the meta object for class '<em>Supplier</em>'.
+ * @see org.eclipse.emf.cdo.tests.model1.Supplier
+ * @generated
+ */
+ EClass getSupplier();
+
+ /**
+ * Returns the meta object for the reference list '{@link org.eclipse.emf.cdo.tests.model1.Supplier#getPurchaseOrders
+ * <em>Purchase Orders</em>}'. <!-- begin-user-doc --> <!-- end-user-doc -->
+ *
+ * @return the meta object for the reference list '<em>Purchase Orders</em>'.
+ * @see org.eclipse.emf.cdo.tests.model1.Supplier#getPurchaseOrders()
+ * @see #getSupplier()
+ * @generated
+ */
+ EReference getSupplier_PurchaseOrders();
+
+ /**
+ * Returns the meta object for the attribute '{@link org.eclipse.emf.cdo.tests.model1.Supplier#isPreferred
+ * <em>Preferred</em>}'. <!-- begin-user-doc --> <!-- end-user-doc -->
+ *
+ * @return the meta object for the attribute '<em>Preferred</em>'.
+ * @see org.eclipse.emf.cdo.tests.model1.Supplier#isPreferred()
+ * @see #getSupplier()
+ * @generated
+ */
+ EAttribute getSupplier_Preferred();
+
+ /**
+ * Returns the meta object for class '{@link org.eclipse.emf.cdo.tests.model1.PurchaseOrder <em>Purchase Order</em>}'.
+ * <!-- begin-user-doc --> <!-- end-user-doc -->
+ *
+ * @return the meta object for class '<em>Purchase Order</em>'.
+ * @see org.eclipse.emf.cdo.tests.model1.PurchaseOrder
+ * @generated
+ */
+ EClass getPurchaseOrder();
+
+ /**
+ * Returns the meta object for the attribute '{@link org.eclipse.emf.cdo.tests.model1.PurchaseOrder#getDate
+ * <em>Date</em>}'. <!-- begin-user-doc --> <!-- end-user-doc -->
+ *
+ * @return the meta object for the attribute '<em>Date</em>'.
+ * @see org.eclipse.emf.cdo.tests.model1.PurchaseOrder#getDate()
+ * @see #getPurchaseOrder()
+ * @generated
+ */
+ EAttribute getPurchaseOrder_Date();
+
+ /**
+ * Returns the meta object for the reference '{@link org.eclipse.emf.cdo.tests.model1.PurchaseOrder#getSupplier
+ * <em>Supplier</em>}'. <!-- begin-user-doc --> <!-- end-user-doc -->
+ *
+ * @return the meta object for the reference '<em>Supplier</em>'.
+ * @see org.eclipse.emf.cdo.tests.model1.PurchaseOrder#getSupplier()
+ * @see #getPurchaseOrder()
+ * @generated
+ */
+ EReference getPurchaseOrder_Supplier();
+
+ /**
+ * Returns the meta object for class '{@link org.eclipse.emf.cdo.tests.model1.OrderDetail <em>Order Detail</em>}'.
+ * <!-- begin-user-doc --> <!-- end-user-doc -->
+ *
+ * @return the meta object for class '<em>Order Detail</em>'.
+ * @see org.eclipse.emf.cdo.tests.model1.OrderDetail
+ * @generated
+ */
+ EClass getOrderDetail();
+
+ /**
+ * Returns the meta object for the container reference '{@link org.eclipse.emf.cdo.tests.model1.OrderDetail#getOrder
+ * <em>Order</em>}'. <!-- begin-user-doc --> <!-- end-user-doc -->
+ *
+ * @return the meta object for the container reference '<em>Order</em>'.
+ * @see org.eclipse.emf.cdo.tests.model1.OrderDetail#getOrder()
+ * @see #getOrderDetail()
+ * @generated
+ */
+ EReference getOrderDetail_Order();
+
+ /**
+ * Returns the meta object for the reference '{@link org.eclipse.emf.cdo.tests.model1.OrderDetail#getProduct
+ * <em>Product</em>}'. <!-- begin-user-doc --> <!-- end-user-doc -->
+ *
+ * @return the meta object for the reference '<em>Product</em>'.
+ * @see org.eclipse.emf.cdo.tests.model1.OrderDetail#getProduct()
+ * @see #getOrderDetail()
+ * @generated
+ */
+ EReference getOrderDetail_Product();
+
+ /**
+ * Returns the meta object for the attribute '{@link org.eclipse.emf.cdo.tests.model1.OrderDetail#getPrice
+ * <em>Price</em>}'. <!-- begin-user-doc --> <!-- end-user-doc -->
+ *
+ * @return the meta object for the attribute '<em>Price</em>'.
+ * @see org.eclipse.emf.cdo.tests.model1.OrderDetail#getPrice()
+ * @see #getOrderDetail()
+ * @generated
+ */
+ EAttribute getOrderDetail_Price();
+
+ /**
+ * Returns the meta object for class '{@link org.eclipse.emf.cdo.tests.model1.Product <em>Product</em>}'. <!--
+ * begin-user-doc --> <!-- end-user-doc -->
+ *
+ * @return the meta object for class '<em>Product</em>'.
+ * @see org.eclipse.emf.cdo.tests.model1.Product
+ * @generated
+ */
+ EClass getProduct();
+
+ /**
+ * Returns the meta object for the attribute '{@link org.eclipse.emf.cdo.tests.model1.Product#getName <em>Name</em>}'.
+ * <!-- begin-user-doc --> <!-- end-user-doc -->
+ *
+ * @return the meta object for the attribute '<em>Name</em>'.
+ * @see org.eclipse.emf.cdo.tests.model1.Product#getName()
+ * @see #getProduct()
+ * @generated
+ */
+ EAttribute getProduct_Name();
+
+ /**
+ * Returns the meta object for the reference list '{@link org.eclipse.emf.cdo.tests.model1.Product#getOrderDetails
+ * <em>Order Details</em>}'. <!-- begin-user-doc --> <!-- end-user-doc -->
+ *
+ * @return the meta object for the reference list '<em>Order Details</em>'.
+ * @see org.eclipse.emf.cdo.tests.model1.Product#getOrderDetails()
+ * @see #getProduct()
+ * @generated
+ */
+ EReference getProduct_OrderDetails();
+
+ /**
+ * Returns the meta object for the attribute '{@link org.eclipse.emf.cdo.tests.model1.Product#getVat <em>Vat</em>}'.
+ * <!-- begin-user-doc --> <!-- end-user-doc -->
+ *
+ * @return the meta object for the attribute '<em>Vat</em>'.
+ * @see org.eclipse.emf.cdo.tests.model1.Product#getVat()
+ * @see #getProduct()
+ * @generated
+ */
+ EAttribute getProduct_Vat();
+
+ /**
+ * Returns the meta object for class '{@link org.eclipse.emf.cdo.tests.model1.OrderAddress <em>Order Address</em>}'.
+ * <!-- begin-user-doc --> <!-- end-user-doc -->
+ *
+ * @return the meta object for class '<em>Order Address</em>'.
+ * @see org.eclipse.emf.cdo.tests.model1.OrderAddress
+ * @generated
+ */
+ EClass getOrderAddress();
+
+ /**
+ * Returns the meta object for the attribute '{@link org.eclipse.emf.cdo.tests.model1.OrderAddress#isTestAttribute
+ * <em>Test Attribute</em>}'. <!-- begin-user-doc --> <!-- end-user-doc -->
+ *
+ * @return the meta object for the attribute '<em>Test Attribute</em>'.
+ * @see org.eclipse.emf.cdo.tests.model1.OrderAddress#isTestAttribute()
+ * @see #getOrderAddress()
+ * @generated
+ */
+ EAttribute getOrderAddress_TestAttribute();
+
+ /**
+ * Returns the meta object for enum '{@link org.eclipse.emf.cdo.tests.model1.VAT <em>VAT</em>}'. <!-- begin-user-doc
+ * --> <!-- end-user-doc -->
+ *
+ * @return the meta object for enum '<em>VAT</em>'.
+ * @see org.eclipse.emf.cdo.tests.model1.VAT
+ * @generated
+ */
+ EEnum getVAT();
+
+ /**
+ * Returns the meta object for class '{@link org.eclipse.emf.cdo.tests.model1.Category <em>Category</em>}'. <!--
+ * begin-user-doc --> <!-- end-user-doc -->
+ *
+ * @return the meta object for class '<em>Category</em>'.
+ * @see org.eclipse.emf.cdo.tests.model1.Category
+ * @generated
+ */
+ EClass getCategory();
+
+ /**
+ * Returns the meta object for the attribute '{@link org.eclipse.emf.cdo.tests.model1.Category#getName <em>Name</em>}
+ * '. <!-- begin-user-doc --> <!-- end-user-doc -->
+ *
+ * @return the meta object for the attribute '<em>Name</em>'.
+ * @see org.eclipse.emf.cdo.tests.model1.Category#getName()
+ * @see #getCategory()
+ * @generated
+ */
+ EAttribute getCategory_Name();
+
+ /**
+ * Returns the meta object for the containment reference list '
+ * {@link org.eclipse.emf.cdo.tests.model1.Category#getCategories <em>Categories</em>}'. <!-- begin-user-doc --> <!--
+ * end-user-doc -->
+ *
+ * @return the meta object for the containment reference list '<em>Categories</em>'.
+ * @see org.eclipse.emf.cdo.tests.model1.Category#getCategories()
+ * @see #getCategory()
+ * @generated
+ */
+ EReference getCategory_Categories();
+
+ /**
+ * Returns the meta object for the containment reference list '
+ * {@link org.eclipse.emf.cdo.tests.model1.Category#getProducts <em>Products</em>}'. <!-- begin-user-doc --> <!--
+ * end-user-doc -->
+ *
+ * @return the meta object for the containment reference list '<em>Products</em>'.
+ * @see org.eclipse.emf.cdo.tests.model1.Category#getProducts()
+ * @see #getCategory()
+ * @generated
+ */
+ EReference getCategory_Products();
+
+ /**
+ * Returns the meta object for class '{@link org.eclipse.emf.cdo.tests.model1.Company <em>Company</em>}'. <!--
+ * begin-user-doc --> <!-- end-user-doc -->
+ *
+ * @return the meta object for class '<em>Company</em>'.
+ * @see org.eclipse.emf.cdo.tests.model1.Company
+ * @generated
+ */
+ EClass getCompany();
+
+ /**
+ * Returns the meta object for the containment reference list '
+ * {@link org.eclipse.emf.cdo.tests.model1.Company#getCategories <em>Categories</em>}'. <!-- begin-user-doc --> <!--
+ * end-user-doc -->
+ *
+ * @return the meta object for the containment reference list '<em>Categories</em>'.
+ * @see org.eclipse.emf.cdo.tests.model1.Company#getCategories()
+ * @see #getCompany()
+ * @generated
+ */
+ EReference getCompany_Categories();
+
+ /**
+ * Returns the meta object for the containment reference list '
+ * {@link org.eclipse.emf.cdo.tests.model1.Company#getSuppliers <em>Suppliers</em>}'. <!-- begin-user-doc --> <!--
+ * end-user-doc -->
+ *
+ * @return the meta object for the containment reference list '<em>Suppliers</em>'.
+ * @see org.eclipse.emf.cdo.tests.model1.Company#getSuppliers()
+ * @see #getCompany()
+ * @generated
+ */
+ EReference getCompany_Suppliers();
+
+ /**
+ * Returns the meta object for the containment reference list '
+ * {@link org.eclipse.emf.cdo.tests.model1.Company#getPurchaseOrders <em>Purchase Orders</em>}'. <!-- begin-user-doc
+ * --> <!-- end-user-doc -->
+ *
+ * @return the meta object for the containment reference list '<em>Purchase Orders</em>'.
+ * @see org.eclipse.emf.cdo.tests.model1.Company#getPurchaseOrders()
+ * @see #getCompany()
+ * @generated
+ */
+ EReference getCompany_PurchaseOrders();
+
+ /**
+ * Returns the meta object for the containment reference list '
+ * {@link org.eclipse.emf.cdo.tests.model1.Company#getCustomers <em>Customers</em>}'. <!-- begin-user-doc --> <!--
+ * end-user-doc -->
+ *
+ * @return the meta object for the containment reference list '<em>Customers</em>'.
+ * @see org.eclipse.emf.cdo.tests.model1.Company#getCustomers()
+ * @see #getCompany()
+ * @generated
+ */
+ EReference getCompany_Customers();
+
+ /**
+ * Returns the meta object for the containment reference list '
+ * {@link org.eclipse.emf.cdo.tests.model1.Company#getSalesOrders <em>Sales Orders</em>}'. <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ *
+ * @return the meta object for the containment reference list '<em>Sales Orders</em>'.
+ * @see org.eclipse.emf.cdo.tests.model1.Company#getSalesOrders()
+ * @see #getCompany()
+ * @generated
+ */
+ EReference getCompany_SalesOrders();
+
+ /**
+ * Returns the meta object for class '{@link org.eclipse.emf.cdo.tests.model1.Customer <em>Customer</em>}'. <!--
+ * begin-user-doc --> <!-- end-user-doc -->
+ *
+ * @return the meta object for class '<em>Customer</em>'.
+ * @see org.eclipse.emf.cdo.tests.model1.Customer
+ * @generated
+ */
+ EClass getCustomer();
+
+ /**
+ * Returns the meta object for the reference list '{@link org.eclipse.emf.cdo.tests.model1.Customer#getSalesOrders
+ * <em>Sales Orders</em>}'. <!-- begin-user-doc --> <!-- end-user-doc -->
+ *
+ * @return the meta object for the reference list '<em>Sales Orders</em>'.
+ * @see org.eclipse.emf.cdo.tests.model1.Customer#getSalesOrders()
+ * @see #getCustomer()
+ * @generated
+ */
+ EReference getCustomer_SalesOrders();
+
+ /**
+ * Returns the meta object for class '{@link org.eclipse.emf.cdo.tests.model1.Order <em>Order</em>}'. <!--
+ * begin-user-doc --> <!-- end-user-doc -->
+ *
+ * @return the meta object for class '<em>Order</em>'.
+ * @see org.eclipse.emf.cdo.tests.model1.Order
+ * @generated
+ */
+ EClass getOrder();
+
+ /**
+ * Returns the meta object for the containment reference list '
+ * {@link org.eclipse.emf.cdo.tests.model1.Order#getOrderDetails <em>Order Details</em>}'. <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ *
+ * @return the meta object for the containment reference list '<em>Order Details</em>'.
+ * @see org.eclipse.emf.cdo.tests.model1.Order#getOrderDetails()
+ * @see #getOrder()
+ * @generated
+ */
+ EReference getOrder_OrderDetails();
+
+ /**
+ * Returns the meta object for class '{@link org.eclipse.emf.cdo.tests.model1.SalesOrder <em>Sales Order</em>}'. <!--
+ * begin-user-doc --> <!-- end-user-doc -->
+ *
+ * @return the meta object for class '<em>Sales Order</em>'.
+ * @see org.eclipse.emf.cdo.tests.model1.SalesOrder
+ * @generated
+ */
+ EClass getSalesOrder();
+
+ /**
+ * Returns the meta object for the attribute '{@link org.eclipse.emf.cdo.tests.model1.SalesOrder#getId <em>Id</em>}'.
+ * <!-- begin-user-doc --> <!-- end-user-doc -->
+ *
+ * @return the meta object for the attribute '<em>Id</em>'.
+ * @see org.eclipse.emf.cdo.tests.model1.SalesOrder#getId()
+ * @see #getSalesOrder()
+ * @generated
+ */
+ EAttribute getSalesOrder_Id();
+
+ /**
+ * Returns the meta object for the reference '{@link org.eclipse.emf.cdo.tests.model1.SalesOrder#getCustomer
+ * <em>Customer</em>}'. <!-- begin-user-doc --> <!-- end-user-doc -->
+ *
+ * @return the meta object for the reference '<em>Customer</em>'.
+ * @see org.eclipse.emf.cdo.tests.model1.SalesOrder#getCustomer()
+ * @see #getSalesOrder()
+ * @generated
+ */
+ EReference getSalesOrder_Customer();
+
+ /**
+ * Returns the factory that creates the instances of the model. <!-- begin-user-doc --> <!-- end-user-doc -->
+ *
+ * @return the factory that creates the instances of the model.
+ * @generated
+ */
+ Model1Factory getModel1Factory();
+
+ /**
+ * <!-- begin-user-doc --> Defines literals for the meta objects that represent
+ * <ul>
+ * <li>each class,</li>
+ * <li>each feature of each class,</li>
+ * <li>each enum,</li>
+ * <li>and each data type</li>
+ * </ul>
+ * <!-- end-user-doc -->
+ *
+ * @generated
+ */
+ interface Literals
+ {
+ /**
+ * The meta object literal for the '{@link org.eclipse.emf.cdo.tests.model1.impl.AddressImpl <em>Address</em>}'
+ * class. <!-- begin-user-doc --> <!-- end-user-doc -->
+ *
+ * @see org.eclipse.emf.cdo.tests.model1.impl.AddressImpl
+ * @see org.eclipse.emf.cdo.tests.model1.impl.Model1PackageImpl#getAddress()
+ * @generated
+ */
+ EClass ADDRESS = eINSTANCE.getAddress();
+
+ /**
+ * The meta object literal for the '<em><b>Name</b></em>' attribute feature. <!-- begin-user-doc --> <!--
+ * end-user-doc -->
+ *
+ * @generated
+ */
+ EAttribute ADDRESS__NAME = eINSTANCE.getAddress_Name();
+
+ /**
+ * The meta object literal for the '<em><b>Street</b></em>' attribute feature. <!-- begin-user-doc --> <!--
+ * end-user-doc -->
+ *
+ * @generated
+ */
+ EAttribute ADDRESS__STREET = eINSTANCE.getAddress_Street();
+
+ /**
+ * The meta object literal for the '<em><b>City</b></em>' attribute feature. <!-- begin-user-doc --> <!--
+ * end-user-doc -->
+ *
+ * @generated
+ */
+ EAttribute ADDRESS__CITY = eINSTANCE.getAddress_City();
+
+ /**
+ * The meta object literal for the '{@link org.eclipse.emf.cdo.tests.model1.impl.SupplierImpl <em>Supplier</em>}'
+ * class. <!-- begin-user-doc --> <!-- end-user-doc -->
+ *
+ * @see org.eclipse.emf.cdo.tests.model1.impl.SupplierImpl
+ * @see org.eclipse.emf.cdo.tests.model1.impl.Model1PackageImpl#getSupplier()
+ * @generated
+ */
+ EClass SUPPLIER = eINSTANCE.getSupplier();
+
+ /**
+ * The meta object literal for the '<em><b>Purchase Orders</b></em>' reference list feature. <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ *
+ * @generated
+ */
+ EReference SUPPLIER__PURCHASE_ORDERS = eINSTANCE.getSupplier_PurchaseOrders();
+
+ /**
+ * The meta object literal for the '<em><b>Preferred</b></em>' attribute feature. <!-- begin-user-doc --> <!--
+ * end-user-doc -->
+ *
+ * @generated
+ */
+ EAttribute SUPPLIER__PREFERRED = eINSTANCE.getSupplier_Preferred();
+
+ /**
+ * The meta object literal for the '{@link org.eclipse.emf.cdo.tests.model1.impl.PurchaseOrderImpl
+ * <em>Purchase Order</em>}' class. <!-- begin-user-doc --> <!-- end-user-doc -->
+ *
+ * @see org.eclipse.emf.cdo.tests.model1.impl.PurchaseOrderImpl
+ * @see org.eclipse.emf.cdo.tests.model1.impl.Model1PackageImpl#getPurchaseOrder()
+ * @generated
+ */
+ EClass PURCHASE_ORDER = eINSTANCE.getPurchaseOrder();
+
+ /**
+ * The meta object literal for the '<em><b>Date</b></em>' attribute feature. <!-- begin-user-doc --> <!--
+ * end-user-doc -->
+ *
+ * @generated
+ */
+ EAttribute PURCHASE_ORDER__DATE = eINSTANCE.getPurchaseOrder_Date();
+
+ /**
+ * The meta object literal for the '<em><b>Supplier</b></em>' reference feature. <!-- begin-user-doc --> <!--
+ * end-user-doc -->
+ *
+ * @generated
+ */
+ EReference PURCHASE_ORDER__SUPPLIER = eINSTANCE.getPurchaseOrder_Supplier();
+
+ /**
+ * The meta object literal for the '{@link org.eclipse.emf.cdo.tests.model1.impl.OrderDetailImpl
+ * <em>Order Detail</em>}' class. <!-- begin-user-doc --> <!-- end-user-doc -->
+ *
+ * @see org.eclipse.emf.cdo.tests.model1.impl.OrderDetailImpl
+ * @see org.eclipse.emf.cdo.tests.model1.impl.Model1PackageImpl#getOrderDetail()
+ * @generated
+ */
+ EClass ORDER_DETAIL = eINSTANCE.getOrderDetail();
+
+ /**
+ * The meta object literal for the '<em><b>Order</b></em>' container reference feature. <!-- begin-user-doc --> <!--
+ * end-user-doc -->
+ *
+ * @generated
+ */
+ EReference ORDER_DETAIL__ORDER = eINSTANCE.getOrderDetail_Order();
+
+ /**
+ * The meta object literal for the '<em><b>Product</b></em>' reference feature. <!-- begin-user-doc --> <!--
+ * end-user-doc -->
+ *
+ * @generated
+ */
+ EReference ORDER_DETAIL__PRODUCT = eINSTANCE.getOrderDetail_Product();
+
+ /**
+ * The meta object literal for the '<em><b>Price</b></em>' attribute feature. <!-- begin-user-doc --> <!--
+ * end-user-doc -->
+ *
+ * @generated
+ */
+ EAttribute ORDER_DETAIL__PRICE = eINSTANCE.getOrderDetail_Price();
+
+ /**
+ * The meta object literal for the '{@link org.eclipse.emf.cdo.tests.model1.impl.ProductImpl <em>Product</em>}'
+ * class. <!-- begin-user-doc --> <!-- end-user-doc -->
+ *
+ * @see org.eclipse.emf.cdo.tests.model1.impl.ProductImpl
+ * @see org.eclipse.emf.cdo.tests.model1.impl.Model1PackageImpl#getProduct()
+ * @generated
+ */
+ EClass PRODUCT = eINSTANCE.getProduct();
+
+ /**
+ * The meta object literal for the '<em><b>Name</b></em>' attribute feature. <!-- begin-user-doc --> <!--
+ * end-user-doc -->
+ *
+ * @generated
+ */
+ EAttribute PRODUCT__NAME = eINSTANCE.getProduct_Name();
+
+ /**
+ * The meta object literal for the '<em><b>Order Details</b></em>' reference list feature. <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ *
+ * @generated
+ */
+ EReference PRODUCT__ORDER_DETAILS = eINSTANCE.getProduct_OrderDetails();
+
+ /**
+ * The meta object literal for the '<em><b>Vat</b></em>' attribute feature. <!-- begin-user-doc --> <!--
+ * end-user-doc -->
+ *
+ * @generated
+ */
+ EAttribute PRODUCT__VAT = eINSTANCE.getProduct_Vat();
+
+ /**
+ * The meta object literal for the '{@link org.eclipse.emf.cdo.tests.model1.impl.OrderAddressImpl
+ * <em>Order Address</em>}' class. <!-- begin-user-doc --> <!-- end-user-doc -->
+ *
+ * @see org.eclipse.emf.cdo.tests.model1.impl.OrderAddressImpl
+ * @see org.eclipse.emf.cdo.tests.model1.impl.Model1PackageImpl#getOrderAddress()
+ * @generated
+ */
+ EClass ORDER_ADDRESS = eINSTANCE.getOrderAddress();
+
+ /**
+ * The meta object literal for the '<em><b>Test Attribute</b></em>' attribute feature. <!-- begin-user-doc --> <!--
+ * end-user-doc -->
+ *
+ * @generated
+ */
+ EAttribute ORDER_ADDRESS__TEST_ATTRIBUTE = eINSTANCE.getOrderAddress_TestAttribute();
+
+ /**
+ * The meta object literal for the '{@link org.eclipse.emf.cdo.tests.model1.VAT <em>VAT</em>}' enum. <!--
+ * begin-user-doc --> <!-- end-user-doc -->
+ *
+ * @see org.eclipse.emf.cdo.tests.model1.VAT
+ * @see org.eclipse.emf.cdo.tests.model1.impl.Model1PackageImpl#getVAT()
+ * @generated
+ */
+ EEnum VAT = eINSTANCE.getVAT();
+
+ /**
+ * The meta object literal for the '{@link org.eclipse.emf.cdo.tests.model1.impl.CategoryImpl <em>Category</em>}'
+ * class. <!-- begin-user-doc --> <!-- end-user-doc -->
+ *
+ * @see org.eclipse.emf.cdo.tests.model1.impl.CategoryImpl
+ * @see org.eclipse.emf.cdo.tests.model1.impl.Model1PackageImpl#getCategory()
+ * @generated
+ */
+ EClass CATEGORY = eINSTANCE.getCategory();
+
+ /**
+ * The meta object literal for the '<em><b>Name</b></em>' attribute feature. <!-- begin-user-doc --> <!--
+ * end-user-doc -->
+ *
+ * @generated
+ */
+ EAttribute CATEGORY__NAME = eINSTANCE.getCategory_Name();
+
+ /**
+ * The meta object literal for the '<em><b>Categories</b></em>' containment reference list feature. <!--
+ * begin-user-doc --> <!-- end-user-doc -->
+ *
+ * @generated
+ */
+ EReference CATEGORY__CATEGORIES = eINSTANCE.getCategory_Categories();
+
+ /**
+ * The meta object literal for the '<em><b>Products</b></em>' containment reference list feature. <!--
+ * begin-user-doc --> <!-- end-user-doc -->
+ *
+ * @generated
+ */
+ EReference CATEGORY__PRODUCTS = eINSTANCE.getCategory_Products();
+
+ /**
+ * The meta object literal for the '{@link org.eclipse.emf.cdo.tests.model1.impl.CompanyImpl <em>Company</em>}'
+ * class. <!-- begin-user-doc --> <!-- end-user-doc -->
+ *
+ * @see org.eclipse.emf.cdo.tests.model1.impl.CompanyImpl
+ * @see org.eclipse.emf.cdo.tests.model1.impl.Model1PackageImpl#getCompany()
+ * @generated
+ */
+ EClass COMPANY = eINSTANCE.getCompany();
+
+ /**
+ * The meta object literal for the '<em><b>Categories</b></em>' containment reference list feature. <!--
+ * begin-user-doc --> <!-- end-user-doc -->
+ *
+ * @generated
+ */
+ EReference COMPANY__CATEGORIES = eINSTANCE.getCompany_Categories();
+
+ /**
+ * The meta object literal for the '<em><b>Suppliers</b></em>' containment reference list feature. <!--
+ * begin-user-doc --> <!-- end-user-doc -->
+ *
+ * @generated
+ */
+ EReference COMPANY__SUPPLIERS = eINSTANCE.getCompany_Suppliers();
+
+ /**
+ * The meta object literal for the '<em><b>Purchase Orders</b></em>' containment reference list feature. <!--
+ * begin-user-doc --> <!-- end-user-doc -->
+ *
+ * @generated
+ */
+ EReference COMPANY__PURCHASE_ORDERS = eINSTANCE.getCompany_PurchaseOrders();
+
+ /**
+ * The meta object literal for the '<em><b>Customers</b></em>' containment reference list feature. <!--
+ * begin-user-doc --> <!-- end-user-doc -->
+ *
+ * @generated
+ */
+ EReference COMPANY__CUSTOMERS = eINSTANCE.getCompany_Customers();
+
+ /**
+ * The meta object literal for the '<em><b>Sales Orders</b></em>' containment reference list feature. <!--
+ * begin-user-doc --> <!-- end-user-doc -->
+ *
+ * @generated
+ */
+ EReference COMPANY__SALES_ORDERS = eINSTANCE.getCompany_SalesOrders();
+
+ /**
+ * The meta object literal for the '{@link org.eclipse.emf.cdo.tests.model1.impl.CustomerImpl <em>Customer</em>}'
+ * class. <!-- begin-user-doc --> <!-- end-user-doc -->
+ *
+ * @see org.eclipse.emf.cdo.tests.model1.impl.CustomerImpl
+ * @see org.eclipse.emf.cdo.tests.model1.impl.Model1PackageImpl#getCustomer()
+ * @generated
+ */
+ EClass CUSTOMER = eINSTANCE.getCustomer();
+
+ /**
+ * The meta object literal for the '<em><b>Sales Orders</b></em>' reference list feature. <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ *
+ * @generated
+ */
+ EReference CUSTOMER__SALES_ORDERS = eINSTANCE.getCustomer_SalesOrders();
+
+ /**
+ * The meta object literal for the '{@link org.eclipse.emf.cdo.tests.model1.impl.OrderImpl <em>Order</em>}' class.
+ * <!-- begin-user-doc --> <!-- end-user-doc -->
+ *
+ * @see org.eclipse.emf.cdo.tests.model1.impl.OrderImpl
+ * @see org.eclipse.emf.cdo.tests.model1.impl.Model1PackageImpl#getOrder()
+ * @generated
+ */
+ EClass ORDER = eINSTANCE.getOrder();
+
+ /**
+ * The meta object literal for the '<em><b>Order Details</b></em>' containment reference list feature. <!--
+ * begin-user-doc --> <!-- end-user-doc -->
+ *
+ * @generated
+ */
+ EReference ORDER__ORDER_DETAILS = eINSTANCE.getOrder_OrderDetails();
+
+ /**
+ * The meta object literal for the '{@link org.eclipse.emf.cdo.tests.model1.impl.SalesOrderImpl
+ * <em>Sales Order</em>}' class. <!-- begin-user-doc --> <!-- end-user-doc -->
+ *
+ * @see org.eclipse.emf.cdo.tests.model1.impl.SalesOrderImpl
+ * @see org.eclipse.emf.cdo.tests.model1.impl.Model1PackageImpl#getSalesOrder()
+ * @generated
+ */
+ EClass SALES_ORDER = eINSTANCE.getSalesOrder();
+
+ /**
+ * The meta object literal for the '<em><b>Id</b></em>' attribute feature. <!-- begin-user-doc --> <!-- end-user-doc
+ * -->
+ *
+ * @generated
+ */
+ EAttribute SALES_ORDER__ID = eINSTANCE.getSalesOrder_Id();
+
+ /**
+ * The meta object literal for the '<em><b>Customer</b></em>' reference feature. <!-- begin-user-doc --> <!--
+ * end-user-doc -->
+ *
+ * @generated
+ */
+ EReference SALES_ORDER__CUSTOMER = eINSTANCE.getSalesOrder_Customer();
+
+ }
+
+} // Model1Package
diff --git a/plugins/org.eclipse.emf.cdo.tests.model1/src/org/eclipse/emf/cdo/tests/model1/Order.java b/plugins/org.eclipse.emf.cdo.tests.model1/src/org/eclipse/emf/cdo/tests/model1/Order.java
new file mode 100644
index 0000000000..63177f8772
--- /dev/null
+++ b/plugins/org.eclipse.emf.cdo.tests.model1/src/org/eclipse/emf/cdo/tests/model1/Order.java
@@ -0,0 +1,47 @@
+/**
+ * <copyright>
+ * </copyright>
+ *
+ * $Id$
+ */
+package org.eclipse.emf.cdo.tests.model1;
+
+import org.eclipse.emf.cdo.CDOObject;
+
+import org.eclipse.emf.common.util.EList;
+
+/**
+ * <!-- begin-user-doc --> A representation of the model object '<em><b>Order</b></em>'. <!-- end-user-doc -->
+ * <p>
+ * The following features are supported:
+ * <ul>
+ * <li>{@link org.eclipse.emf.cdo.tests.model1.Order#getOrderDetails <em>Order Details</em>}</li>
+ * </ul>
+ * </p>
+ *
+ * @see org.eclipse.emf.cdo.tests.model1.Model1Package#getOrder()
+ * @model
+ * @extends CDOObject
+ * @generated
+ */
+public interface Order extends CDOObject
+{
+ /**
+ * Returns the value of the '<em><b>Order Details</b></em>' containment reference list. The list contents are of type
+ * {@link org.eclipse.emf.cdo.tests.model1.OrderDetail}. It is bidirectional and its opposite is '
+ * {@link org.eclipse.emf.cdo.tests.model1.OrderDetail#getOrder <em>Order</em>}'. <!-- begin-user-doc -->
+ * <p>
+ * If the meaning of the '<em>Order Details</em>' containment reference list isn't clear, there really should be more
+ * of a description here...
+ * </p>
+ * <!-- end-user-doc -->
+ *
+ * @return the value of the '<em>Order Details</em>' containment reference list.
+ * @see org.eclipse.emf.cdo.tests.model1.Model1Package#getOrder_OrderDetails()
+ * @see org.eclipse.emf.cdo.tests.model1.OrderDetail#getOrder
+ * @model opposite="order" containment="true"
+ * @generated
+ */
+ EList<OrderDetail> getOrderDetails();
+
+} // Order
diff --git a/plugins/org.eclipse.emf.cdo.tests.model1/src/org/eclipse/emf/cdo/tests/model1/OrderAddress.java b/plugins/org.eclipse.emf.cdo.tests.model1/src/org/eclipse/emf/cdo/tests/model1/OrderAddress.java
new file mode 100644
index 0000000000..61116b7aa2
--- /dev/null
+++ b/plugins/org.eclipse.emf.cdo.tests.model1/src/org/eclipse/emf/cdo/tests/model1/OrderAddress.java
@@ -0,0 +1,51 @@
+/**
+ * <copyright>
+ * </copyright>
+ *
+ * $Id: OrderAddress.java,v 1.2 2008-06-03 06:41:31 estepper Exp $
+ */
+package org.eclipse.emf.cdo.tests.model1;
+
+/**
+ * <!-- begin-user-doc --> A representation of the model object '<em><b>Order Address</b></em>'. <!-- end-user-doc -->
+ * <p>
+ * The following features are supported:
+ * <ul>
+ * <li>{@link org.eclipse.emf.cdo.tests.model1.OrderAddress#isTestAttribute <em>Test Attribute</em>}</li>
+ * </ul>
+ * </p>
+ *
+ * @see org.eclipse.emf.cdo.tests.model1.Model1Package#getOrderAddress()
+ * @model
+ * @generated
+ */
+public interface OrderAddress extends Address, Order, OrderDetail
+{
+ /**
+ * Returns the value of the '<em><b>Test Attribute</b></em>' attribute. <!-- begin-user-doc -->
+ * <p>
+ * If the meaning of the '<em>Test Attribute</em>' attribute isn't clear, there really should be more of a description
+ * here...
+ * </p>
+ * <!-- end-user-doc -->
+ *
+ * @return the value of the '<em>Test Attribute</em>' attribute.
+ * @see #setTestAttribute(boolean)
+ * @see org.eclipse.emf.cdo.tests.model1.Model1Package#getOrderAddress_TestAttribute()
+ * @model
+ * @generated
+ */
+ boolean isTestAttribute();
+
+ /**
+ * Sets the value of the '{@link org.eclipse.emf.cdo.tests.model1.OrderAddress#isTestAttribute
+ * <em>Test Attribute</em>}' attribute. <!-- begin-user-doc --> <!-- end-user-doc -->
+ *
+ * @param value
+ * the new value of the '<em>Test Attribute</em>' attribute.
+ * @see #isTestAttribute()
+ * @generated
+ */
+ void setTestAttribute(boolean value);
+
+} // OrderAddress
diff --git a/plugins/org.eclipse.emf.cdo.tests.model1/src/org/eclipse/emf/cdo/tests/model1/OrderDetail.java b/plugins/org.eclipse.emf.cdo.tests.model1/src/org/eclipse/emf/cdo/tests/model1/OrderDetail.java
new file mode 100644
index 0000000000..83f4513385
--- /dev/null
+++ b/plugins/org.eclipse.emf.cdo.tests.model1/src/org/eclipse/emf/cdo/tests/model1/OrderDetail.java
@@ -0,0 +1,113 @@
+/**
+ * <copyright>
+ * </copyright>
+ *
+ * $Id$
+ */
+package org.eclipse.emf.cdo.tests.model1;
+
+import org.eclipse.emf.cdo.CDOObject;
+
+/**
+ * <!-- begin-user-doc --> A representation of the model object '<em><b>Order Detail</b></em>'. <!-- end-user-doc -->
+ * <p>
+ * The following features are supported:
+ * <ul>
+ * <li>{@link org.eclipse.emf.cdo.tests.model1.OrderDetail#getOrder <em>Order</em>}</li>
+ * <li>{@link org.eclipse.emf.cdo.tests.model1.OrderDetail#getProduct <em>Product</em>}</li>
+ * <li>{@link org.eclipse.emf.cdo.tests.model1.OrderDetail#getPrice <em>Price</em>}</li>
+ * </ul>
+ * </p>
+ *
+ * @see org.eclipse.emf.cdo.tests.model1.Model1Package#getOrderDetail()
+ * @model
+ * @extends CDOObject
+ * @generated
+ */
+public interface OrderDetail extends CDOObject
+{
+ /**
+ * Returns the value of the '<em><b>Order</b></em>' container reference. It is bidirectional and its opposite is '
+ * {@link org.eclipse.emf.cdo.tests.model1.Order#getOrderDetails <em>Order Details</em>}'. <!-- begin-user-doc -->
+ * <p>
+ * If the meaning of the '<em>Order</em>' container reference isn't clear, there really should be more of a
+ * description here...
+ * </p>
+ * <!-- end-user-doc -->
+ *
+ * @return the value of the '<em>Order</em>' container reference.
+ * @see #setOrder(Order)
+ * @see org.eclipse.emf.cdo.tests.model1.Model1Package#getOrderDetail_Order()
+ * @see org.eclipse.emf.cdo.tests.model1.Order#getOrderDetails
+ * @model opposite="orderDetails" required="true" transient="false"
+ * @generated
+ */
+ Order getOrder();
+
+ /**
+ * Sets the value of the '{@link org.eclipse.emf.cdo.tests.model1.OrderDetail#getOrder <em>Order</em>}' container
+ * reference. <!-- begin-user-doc --> <!-- end-user-doc -->
+ *
+ * @param value
+ * the new value of the '<em>Order</em>' container reference.
+ * @see #getOrder()
+ * @generated
+ */
+ void setOrder(Order value);
+
+ /**
+ * Returns the value of the '<em><b>Product</b></em>' reference. It is bidirectional and its opposite is '
+ * {@link org.eclipse.emf.cdo.tests.model1.Product#getOrderDetails <em>Order Details</em>}'. <!-- begin-user-doc -->
+ * <p>
+ * If the meaning of the '<em>Product</em>' reference isn't clear, there really should be more of a description
+ * here...
+ * </p>
+ * <!-- end-user-doc -->
+ *
+ * @return the value of the '<em>Product</em>' reference.
+ * @see #setProduct(Product)
+ * @see org.eclipse.emf.cdo.tests.model1.Model1Package#getOrderDetail_Product()
+ * @see org.eclipse.emf.cdo.tests.model1.Product#getOrderDetails
+ * @model opposite="orderDetails"
+ * @generated
+ */
+ Product getProduct();
+
+ /**
+ * Sets the value of the '{@link org.eclipse.emf.cdo.tests.model1.OrderDetail#getProduct <em>Product</em>}' reference.
+ * <!-- begin-user-doc --> <!-- end-user-doc -->
+ *
+ * @param value
+ * the new value of the '<em>Product</em>' reference.
+ * @see #getProduct()
+ * @generated
+ */
+ void setProduct(Product value);
+
+ /**
+ * Returns the value of the '<em><b>Price</b></em>' attribute. <!-- begin-user-doc -->
+ * <p>
+ * If the meaning of the '<em>Price</em>' attribute isn't clear, there really should be more of a description here...
+ * </p>
+ * <!-- end-user-doc -->
+ *
+ * @return the value of the '<em>Price</em>' attribute.
+ * @see #setPrice(float)
+ * @see org.eclipse.emf.cdo.tests.model1.Model1Package#getOrderDetail_Price()
+ * @model
+ * @generated
+ */
+ float getPrice();
+
+ /**
+ * Sets the value of the '{@link org.eclipse.emf.cdo.tests.model1.OrderDetail#getPrice <em>Price</em>}' attribute.
+ * <!-- begin-user-doc --> <!-- end-user-doc -->
+ *
+ * @param value
+ * the new value of the '<em>Price</em>' attribute.
+ * @see #getPrice()
+ * @generated
+ */
+ void setPrice(float value);
+
+} // OrderDetail
diff --git a/plugins/org.eclipse.emf.cdo.tests.model1/src/org/eclipse/emf/cdo/tests/model1/Product.java b/plugins/org.eclipse.emf.cdo.tests.model1/src/org/eclipse/emf/cdo/tests/model1/Product.java
new file mode 100644
index 0000000000..1edc88a9f0
--- /dev/null
+++ b/plugins/org.eclipse.emf.cdo.tests.model1/src/org/eclipse/emf/cdo/tests/model1/Product.java
@@ -0,0 +1,104 @@
+/**
+ * <copyright>
+ * </copyright>
+ *
+ * $Id$
+ */
+package org.eclipse.emf.cdo.tests.model1;
+
+import org.eclipse.emf.cdo.CDOObject;
+
+import org.eclipse.emf.common.util.EList;
+
+/**
+ * <!-- begin-user-doc --> A representation of the model object '<em><b>Product</b></em>'. <!-- end-user-doc -->
+ * <p>
+ * The following features are supported:
+ * <ul>
+ * <li>{@link org.eclipse.emf.cdo.tests.model1.Product#getName <em>Name</em>}</li>
+ * <li>{@link org.eclipse.emf.cdo.tests.model1.Product#getOrderDetails <em>Order Details</em>}</li>
+ * <li>{@link org.eclipse.emf.cdo.tests.model1.Product#getVat <em>Vat</em>}</li>
+ * </ul>
+ * </p>
+ *
+ * @see org.eclipse.emf.cdo.tests.model1.Model1Package#getProduct()
+ * @model
+ * @extends CDOObject
+ * @generated
+ */
+public interface Product extends CDOObject
+{
+ /**
+ * Returns the value of the '<em><b>Name</b></em>' attribute. <!-- begin-user-doc -->
+ * <p>
+ * If the meaning of the '<em>Name</em>' attribute isn't clear, there really should be more of a description here...
+ * </p>
+ * <!-- end-user-doc -->
+ *
+ * @return the value of the '<em>Name</em>' attribute.
+ * @see #setName(String)
+ * @see org.eclipse.emf.cdo.tests.model1.Model1Package#getProduct_Name()
+ * @model
+ * @generated
+ */
+ String getName();
+
+ /**
+ * Sets the value of the '{@link org.eclipse.emf.cdo.tests.model1.Product#getName <em>Name</em>}' attribute. <!--
+ * begin-user-doc --> <!-- end-user-doc -->
+ *
+ * @param value
+ * the new value of the '<em>Name</em>' attribute.
+ * @see #getName()
+ * @generated
+ */
+ void setName(String value);
+
+ /**
+ * Returns the value of the '<em><b>Order Details</b></em>' reference list. The list contents are of type
+ * {@link org.eclipse.emf.cdo.tests.model1.OrderDetail}. It is bidirectional and its opposite is '
+ * {@link org.eclipse.emf.cdo.tests.model1.OrderDetail#getProduct <em>Product</em>}'. <!-- begin-user-doc -->
+ * <p>
+ * If the meaning of the '<em>Order Details</em>' reference list isn't clear, there really should be more of a
+ * description here...
+ * </p>
+ * <!-- end-user-doc -->
+ *
+ * @return the value of the '<em>Order Details</em>' reference list.
+ * @see org.eclipse.emf.cdo.tests.model1.Model1Package#getProduct_OrderDetails()
+ * @see org.eclipse.emf.cdo.tests.model1.OrderDetail#getProduct
+ * @model opposite="product"
+ * @generated
+ */
+ EList<OrderDetail> getOrderDetails();
+
+ /**
+ * Returns the value of the '<em><b>Vat</b></em>' attribute. The default value is <code>"vat15"</code>. The literals
+ * are from the enumeration {@link org.eclipse.emf.cdo.tests.model1.VAT}. <!-- begin-user-doc -->
+ * <p>
+ * If the meaning of the '<em>Vat</em>' attribute isn't clear, there really should be more of a description here...
+ * </p>
+ * <!-- end-user-doc -->
+ *
+ * @return the value of the '<em>Vat</em>' attribute.
+ * @see org.eclipse.emf.cdo.tests.model1.VAT
+ * @see #setVat(VAT)
+ * @see org.eclipse.emf.cdo.tests.model1.Model1Package#getProduct_Vat()
+ * @model default="vat15"
+ * @generated
+ */
+ VAT getVat();
+
+ /**
+ * Sets the value of the '{@link org.eclipse.emf.cdo.tests.model1.Product#getVat <em>Vat</em>}' attribute. <!--
+ * begin-user-doc --> <!-- end-user-doc -->
+ *
+ * @param value
+ * the new value of the '<em>Vat</em>' attribute.
+ * @see org.eclipse.emf.cdo.tests.model1.VAT
+ * @see #getVat()
+ * @generated
+ */
+ void setVat(VAT value);
+
+} // Product
diff --git a/plugins/org.eclipse.emf.cdo.tests.model1/src/org/eclipse/emf/cdo/tests/model1/PurchaseOrder.java b/plugins/org.eclipse.emf.cdo.tests.model1/src/org/eclipse/emf/cdo/tests/model1/PurchaseOrder.java
new file mode 100644
index 0000000000..93b7212671
--- /dev/null
+++ b/plugins/org.eclipse.emf.cdo.tests.model1/src/org/eclipse/emf/cdo/tests/model1/PurchaseOrder.java
@@ -0,0 +1,83 @@
+/**
+ * <copyright>
+ * </copyright>
+ *
+ * $Id$
+ */
+package org.eclipse.emf.cdo.tests.model1;
+
+import java.util.Date;
+
+/**
+ * <!-- begin-user-doc --> A representation of the model object '<em><b>Purchase Order</b></em>'. <!-- end-user-doc -->
+ * <p>
+ * The following features are supported:
+ * <ul>
+ * <li>{@link org.eclipse.emf.cdo.tests.model1.PurchaseOrder#getDate <em>Date</em>}</li>
+ * <li>{@link org.eclipse.emf.cdo.tests.model1.PurchaseOrder#getSupplier <em>Supplier</em>}</li>
+ * </ul>
+ * </p>
+ *
+ * @see org.eclipse.emf.cdo.tests.model1.Model1Package#getPurchaseOrder()
+ * @model
+ * @generated
+ */
+public interface PurchaseOrder extends Order
+{
+ /**
+ * Returns the value of the '<em><b>Date</b></em>' attribute. <!-- begin-user-doc -->
+ * <p>
+ * If the meaning of the '<em>Date</em>' attribute isn't clear, there really should be more of a description here...
+ * </p>
+ * <!-- end-user-doc -->
+ *
+ * @return the value of the '<em>Date</em>' attribute.
+ * @see #setDate(Date)
+ * @see org.eclipse.emf.cdo.tests.model1.Model1Package#getPurchaseOrder_Date()
+ * @model
+ * @generated
+ */
+ Date getDate();
+
+ /**
+ * Sets the value of the '{@link org.eclipse.emf.cdo.tests.model1.PurchaseOrder#getDate <em>Date</em>}' attribute.
+ * <!-- begin-user-doc --> <!-- end-user-doc -->
+ *
+ * @param value
+ * the new value of the '<em>Date</em>' attribute.
+ * @see #getDate()
+ * @generated
+ */
+ void setDate(Date value);
+
+ /**
+ * Returns the value of the '<em><b>Supplier</b></em>' reference. It is bidirectional and its opposite is '
+ * {@link org.eclipse.emf.cdo.tests.model1.Supplier#getPurchaseOrders <em>Purchase Orders</em>}'. <!-- begin-user-doc
+ * -->
+ * <p>
+ * If the meaning of the '<em>Supplier</em>' reference isn't clear, there really should be more of a description
+ * here...
+ * </p>
+ * <!-- end-user-doc -->
+ *
+ * @return the value of the '<em>Supplier</em>' reference.
+ * @see #setSupplier(Supplier)
+ * @see org.eclipse.emf.cdo.tests.model1.Model1Package#getPurchaseOrder_Supplier()
+ * @see org.eclipse.emf.cdo.tests.model1.Supplier#getPurchaseOrders
+ * @model opposite="purchaseOrders" required="true"
+ * @generated
+ */
+ Supplier getSupplier();
+
+ /**
+ * Sets the value of the '{@link org.eclipse.emf.cdo.tests.model1.PurchaseOrder#getSupplier <em>Supplier</em>}'
+ * reference. <!-- begin-user-doc --> <!-- end-user-doc -->
+ *
+ * @param value
+ * the new value of the '<em>Supplier</em>' reference.
+ * @see #getSupplier()
+ * @generated
+ */
+ void setSupplier(Supplier value);
+
+} // PurchaseOrder
diff --git a/plugins/org.eclipse.emf.cdo.tests.model1/src/org/eclipse/emf/cdo/tests/model1/SalesOrder.java b/plugins/org.eclipse.emf.cdo.tests.model1/src/org/eclipse/emf/cdo/tests/model1/SalesOrder.java
new file mode 100644
index 0000000000..f95a82b49d
--- /dev/null
+++ b/plugins/org.eclipse.emf.cdo.tests.model1/src/org/eclipse/emf/cdo/tests/model1/SalesOrder.java
@@ -0,0 +1,80 @@
+/**
+ * <copyright>
+ * </copyright>
+ *
+ * $Id$
+ */
+package org.eclipse.emf.cdo.tests.model1;
+
+/**
+ * <!-- begin-user-doc --> A representation of the model object '<em><b>Sales Order</b></em>'. <!-- end-user-doc -->
+ * <p>
+ * The following features are supported:
+ * <ul>
+ * <li>{@link org.eclipse.emf.cdo.tests.model1.SalesOrder#getId <em>Id</em>}</li>
+ * <li>{@link org.eclipse.emf.cdo.tests.model1.SalesOrder#getCustomer <em>Customer</em>}</li>
+ * </ul>
+ * </p>
+ *
+ * @see org.eclipse.emf.cdo.tests.model1.Model1Package#getSalesOrder()
+ * @model
+ * @generated
+ */
+public interface SalesOrder extends Order
+{
+ /**
+ * Returns the value of the '<em><b>Id</b></em>' attribute. <!-- begin-user-doc -->
+ * <p>
+ * If the meaning of the '<em>Id</em>' attribute isn't clear, there really should be more of a description here...
+ * </p>
+ * <!-- end-user-doc -->
+ *
+ * @return the value of the '<em>Id</em>' attribute.
+ * @see #setId(int)
+ * @see org.eclipse.emf.cdo.tests.model1.Model1Package#getSalesOrder_Id()
+ * @model
+ * @generated
+ */
+ int getId();
+
+ /**
+ * Sets the value of the '{@link org.eclipse.emf.cdo.tests.model1.SalesOrder#getId <em>Id</em>}' attribute. <!--
+ * begin-user-doc --> <!-- end-user-doc -->
+ *
+ * @param value
+ * the new value of the '<em>Id</em>' attribute.
+ * @see #getId()
+ * @generated
+ */
+ void setId(int value);
+
+ /**
+ * Returns the value of the '<em><b>Customer</b></em>' reference. It is bidirectional and its opposite is '
+ * {@link org.eclipse.emf.cdo.tests.model1.Customer#getSalesOrders <em>Sales Orders</em>}'. <!-- begin-user-doc -->
+ * <p>
+ * If the meaning of the '<em>Customer</em>' reference isn't clear, there really should be more of a description
+ * here...
+ * </p>
+ * <!-- end-user-doc -->
+ *
+ * @return the value of the '<em>Customer</em>' reference.
+ * @see #setCustomer(Customer)
+ * @see org.eclipse.emf.cdo.tests.model1.Model1Package#getSalesOrder_Customer()
+ * @see org.eclipse.emf.cdo.tests.model1.Customer#getSalesOrders
+ * @model opposite="salesOrders" required="true"
+ * @generated
+ */
+ Customer getCustomer();
+
+ /**
+ * Sets the value of the '{@link org.eclipse.emf.cdo.tests.model1.SalesOrder#getCustomer <em>Customer</em>}'
+ * reference. <!-- begin-user-doc --> <!-- end-user-doc -->
+ *
+ * @param value
+ * the new value of the '<em>Customer</em>' reference.
+ * @see #getCustomer()
+ * @generated
+ */
+ void setCustomer(Customer value);
+
+} // SalesOrder
diff --git a/plugins/org.eclipse.emf.cdo.tests.model1/src/org/eclipse/emf/cdo/tests/model1/Supplier.java b/plugins/org.eclipse.emf.cdo.tests.model1/src/org/eclipse/emf/cdo/tests/model1/Supplier.java
new file mode 100644
index 0000000000..e4c2256b9e
--- /dev/null
+++ b/plugins/org.eclipse.emf.cdo.tests.model1/src/org/eclipse/emf/cdo/tests/model1/Supplier.java
@@ -0,0 +1,73 @@
+/**
+ * <copyright>
+ * </copyright>
+ *
+ * $Id$
+ */
+package org.eclipse.emf.cdo.tests.model1;
+
+import org.eclipse.emf.common.util.EList;
+
+/**
+ * <!-- begin-user-doc --> A representation of the model object '<em><b>Supplier</b></em>'. <!-- end-user-doc -->
+ * <p>
+ * The following features are supported:
+ * <ul>
+ * <li>{@link org.eclipse.emf.cdo.tests.model1.Supplier#getPurchaseOrders <em>Purchase Orders</em>}</li>
+ * <li>{@link org.eclipse.emf.cdo.tests.model1.Supplier#isPreferred <em>Preferred</em>}</li>
+ * </ul>
+ * </p>
+ *
+ * @see org.eclipse.emf.cdo.tests.model1.Model1Package#getSupplier()
+ * @model
+ * @generated
+ */
+public interface Supplier extends Address
+{
+ /**
+ * Returns the value of the '<em><b>Purchase Orders</b></em>' reference list. The list contents are of type
+ * {@link org.eclipse.emf.cdo.tests.model1.PurchaseOrder}. It is bidirectional and its opposite is '
+ * {@link org.eclipse.emf.cdo.tests.model1.PurchaseOrder#getSupplier <em>Supplier</em>}'. <!-- begin-user-doc -->
+ * <p>
+ * If the meaning of the '<em>Purchase Orders</em>' reference list isn't clear, there really should be more of a
+ * description here...
+ * </p>
+ * <!-- end-user-doc -->
+ *
+ * @return the value of the '<em>Purchase Orders</em>' reference list.
+ * @see org.eclipse.emf.cdo.tests.model1.Model1Package#getSupplier_PurchaseOrders()
+ * @see org.eclipse.emf.cdo.tests.model1.PurchaseOrder#getSupplier
+ * @model opposite="supplier"
+ * @generated
+ */
+ EList<PurchaseOrder> getPurchaseOrders();
+
+ /**
+ * Returns the value of the '<em><b>Preferred</b></em>' attribute. The default value is <code>"true"</code>. <!--
+ * begin-user-doc -->
+ * <p>
+ * If the meaning of the '<em>Preferred</em>' attribute isn't clear, there really should be more of a description
+ * here...
+ * </p>
+ * <!-- end-user-doc -->
+ *
+ * @return the value of the '<em>Preferred</em>' attribute.
+ * @see #setPreferred(boolean)
+ * @see org.eclipse.emf.cdo.tests.model1.Model1Package#getSupplier_Preferred()
+ * @model default="true"
+ * @generated
+ */
+ boolean isPreferred();
+
+ /**
+ * Sets the value of the '{@link org.eclipse.emf.cdo.tests.model1.Supplier#isPreferred <em>Preferred</em>}' attribute.
+ * <!-- begin-user-doc --> <!-- end-user-doc -->
+ *
+ * @param value
+ * the new value of the '<em>Preferred</em>' attribute.
+ * @see #isPreferred()
+ * @generated
+ */
+ void setPreferred(boolean value);
+
+} // Supplier
diff --git a/plugins/org.eclipse.emf.cdo.tests.model1/src/org/eclipse/emf/cdo/tests/model1/VAT.java b/plugins/org.eclipse.emf.cdo.tests.model1/src/org/eclipse/emf/cdo/tests/model1/VAT.java
new file mode 100644
index 0000000000..7f352d77dc
--- /dev/null
+++ b/plugins/org.eclipse.emf.cdo.tests.model1/src/org/eclipse/emf/cdo/tests/model1/VAT.java
@@ -0,0 +1,243 @@
+/**
+ * <copyright>
+ * </copyright>
+ *
+ * $Id: VAT.java,v 1.3 2008-06-03 06:41:31 estepper Exp $
+ */
+package org.eclipse.emf.cdo.tests.model1;
+
+import org.eclipse.emf.common.util.Enumerator;
+
+import java.util.Arrays;
+import java.util.Collections;
+import java.util.List;
+
+/**
+ * <!-- begin-user-doc --> A representation of the literals of the enumeration '<em><b>VAT</b></em>', and utility
+ * methods for working with them. <!-- end-user-doc -->
+ *
+ * @see org.eclipse.emf.cdo.tests.model1.Model1Package#getVAT()
+ * @model
+ * @generated
+ */
+public enum VAT implements Enumerator
+{
+ /**
+ * The '<em><b>Vat0</b></em>' literal object. <!-- begin-user-doc --> <!-- end-user-doc -->
+ *
+ * @see #VAT0_VALUE
+ * @generated
+ * @ordered
+ */
+ VAT0(0, "vat0", "vat0"),
+
+ /**
+ * The '<em><b>Vat7</b></em>' literal object. <!-- begin-user-doc --> <!-- end-user-doc -->
+ *
+ * @see #VAT7_VALUE
+ * @generated
+ * @ordered
+ */
+ VAT7(7, "vat7", "vat7"),
+
+ /**
+ * The '<em><b>Vat15</b></em>' literal object. <!-- begin-user-doc --> <!-- end-user-doc -->
+ *
+ * @see #VAT15_VALUE
+ * @generated
+ * @ordered
+ */
+ VAT15(15, "vat15", "vat15");
+
+ /**
+ * The '<em><b>Vat0</b></em>' literal value. <!-- begin-user-doc -->
+ * <p>
+ * If the meaning of '<em><b>Vat0</b></em>' literal object isn't clear, there really should be more of a description
+ * here...
+ * </p>
+ * <!-- end-user-doc -->
+ *
+ * @see #VAT0
+ * @model name="vat0"
+ * @generated
+ * @ordered
+ */
+ public static final int VAT0_VALUE = 0;
+
+ /**
+ * The '<em><b>Vat7</b></em>' literal value. <!-- begin-user-doc -->
+ * <p>
+ * If the meaning of '<em><b>Vat7</b></em>' literal object isn't clear, there really should be more of a description
+ * here...
+ * </p>
+ * <!-- end-user-doc -->
+ *
+ * @see #VAT7
+ * @model name="vat7"
+ * @generated
+ * @ordered
+ */
+ public static final int VAT7_VALUE = 7;
+
+ /**
+ * The '<em><b>Vat15</b></em>' literal value. <!-- begin-user-doc -->
+ * <p>
+ * If the meaning of '<em><b>Vat15</b></em>' literal object isn't clear, there really should be more of a description
+ * here...
+ * </p>
+ * <!-- end-user-doc -->
+ *
+ * @see #VAT15
+ * @model name="vat15"
+ * @generated
+ * @ordered
+ */
+ public static final int VAT15_VALUE = 15;
+
+ /**
+ * An array of all the '<em><b>VAT</b></em>' enumerators. <!-- begin-user-doc --> <!-- end-user-doc -->
+ *
+ * @generated
+ */
+ private static final VAT[] VALUES_ARRAY = new VAT[] { VAT0, VAT7, VAT15, };
+
+ /**
+ * A public read-only list of all the '<em><b>VAT</b></em>' enumerators. <!-- begin-user-doc --> <!-- end-user-doc -->
+ *
+ * @generated
+ */
+ public static final List<VAT> VALUES = Collections.unmodifiableList(Arrays.asList(VALUES_ARRAY));
+
+ /**
+ * Returns the '<em><b>VAT</b></em>' literal with the specified literal value. <!-- begin-user-doc --> <!--
+ * end-user-doc -->
+ *
+ * @generated
+ */
+ public static VAT get(String literal)
+ {
+ for (int i = 0; i < VALUES_ARRAY.length; ++i)
+ {
+ VAT result = VALUES_ARRAY[i];
+ if (result.toString().equals(literal))
+ {
+ return result;
+ }
+ }
+ return null;
+ }
+
+ /**
+ * Returns the '<em><b>VAT</b></em>' literal with the specified name. <!-- begin-user-doc --> <!-- end-user-doc -->
+ *
+ * @generated
+ */
+ public static VAT getByName(String name)
+ {
+ for (int i = 0; i < VALUES_ARRAY.length; ++i)
+ {
+ VAT result = VALUES_ARRAY[i];
+ if (result.getName().equals(name))
+ {
+ return result;
+ }
+ }
+ return null;
+ }
+
+ /**
+ * Returns the '<em><b>VAT</b></em>' literal with the specified integer value. <!-- begin-user-doc --> <!--
+ * end-user-doc -->
+ *
+ * @generated
+ */
+ public static VAT get(int value)
+ {
+ switch (value)
+ {
+ case VAT0_VALUE:
+ return VAT0;
+ case VAT7_VALUE:
+ return VAT7;
+ case VAT15_VALUE:
+ return VAT15;
+ }
+ return null;
+ }
+
+ /**
+ * <!-- begin-user-doc --> <!-- end-user-doc -->
+ *
+ * @generated
+ */
+ private final int value;
+
+ /**
+ * <!-- begin-user-doc --> <!-- end-user-doc -->
+ *
+ * @generated
+ */
+ private final String name;
+
+ /**
+ * <!-- begin-user-doc --> <!-- end-user-doc -->
+ *
+ * @generated
+ */
+ private final String literal;
+
+ /**
+ * Only this class can construct instances. <!-- begin-user-doc --> <!-- end-user-doc -->
+ *
+ * @generated
+ */
+ private VAT(int value, String name, String literal)
+ {
+ this.value = value;
+ this.name = name;
+ this.literal = literal;
+ }
+
+ /**
+ * <!-- begin-user-doc --> <!-- end-user-doc -->
+ *
+ * @generated
+ */
+ public int getValue()
+ {
+ return value;
+ }
+
+ /**
+ * <!-- begin-user-doc --> <!-- end-user-doc -->
+ *
+ * @generated
+ */
+ public String getName()
+ {
+ return name;
+ }
+
+ /**
+ * <!-- begin-user-doc --> <!-- end-user-doc -->
+ *
+ * @generated
+ */
+ public String getLiteral()
+ {
+ return literal;
+ }
+
+ /**
+ * Returns the literal value of the enumerator, which is its string representation. <!-- begin-user-doc --> <!--
+ * end-user-doc -->
+ *
+ * @generated
+ */
+ @Override
+ public String toString()
+ {
+ return literal;
+ }
+
+} // VAT
diff --git a/plugins/org.eclipse.emf.cdo.tests.model1/src/org/eclipse/emf/cdo/tests/model1/impl/Model1PackageImpl.java b/plugins/org.eclipse.emf.cdo.tests.model1/src/org/eclipse/emf/cdo/tests/model1/impl/Model1PackageImpl.java
new file mode 100644
index 0000000000..f15ed03ee4
--- /dev/null
+++ b/plugins/org.eclipse.emf.cdo.tests.model1/src/org/eclipse/emf/cdo/tests/model1/impl/Model1PackageImpl.java
@@ -0,0 +1,790 @@
+/**
+ * <copyright>
+ * </copyright>
+ *
+ * $Id$
+ */
+package org.eclipse.emf.cdo.tests.model1.impl;
+
+import org.eclipse.emf.cdo.tests.model1.Address;
+import org.eclipse.emf.cdo.tests.model1.Category;
+import org.eclipse.emf.cdo.tests.model1.Company;
+import org.eclipse.emf.cdo.tests.model1.Customer;
+import org.eclipse.emf.cdo.tests.model1.Model1Factory;
+import org.eclipse.emf.cdo.tests.model1.Model1Package;
+import org.eclipse.emf.cdo.tests.model1.Order;
+import org.eclipse.emf.cdo.tests.model1.OrderAddress;
+import org.eclipse.emf.cdo.tests.model1.OrderDetail;
+import org.eclipse.emf.cdo.tests.model1.Product;
+import org.eclipse.emf.cdo.tests.model1.PurchaseOrder;
+import org.eclipse.emf.cdo.tests.model1.SalesOrder;
+import org.eclipse.emf.cdo.tests.model1.Supplier;
+
+import org.eclipse.emf.ecore.EAttribute;
+import org.eclipse.emf.ecore.EClass;
+import org.eclipse.emf.ecore.EEnum;
+import org.eclipse.emf.ecore.EPackage;
+import org.eclipse.emf.ecore.EReference;
+import org.eclipse.emf.ecore.impl.EPackageImpl;
+
+/**
+ * <!-- begin-user-doc --> An implementation of the model <b>Package</b>. <!-- end-user-doc -->
+ *
+ * @generated
+ */
+public class Model1PackageImpl extends EPackageImpl implements Model1Package
+{
+ /**
+ * <!-- begin-user-doc --> <!-- end-user-doc -->
+ *
+ * @generated
+ */
+ private EClass addressEClass = null;
+
+ /**
+ * <!-- begin-user-doc --> <!-- end-user-doc -->
+ *
+ * @generated
+ */
+ private EClass supplierEClass = null;
+
+ /**
+ * <!-- begin-user-doc --> <!-- end-user-doc -->
+ *
+ * @generated
+ */
+ private EClass purchaseOrderEClass = null;
+
+ /**
+ * <!-- begin-user-doc --> <!-- end-user-doc -->
+ *
+ * @generated
+ */
+ private EClass orderDetailEClass = null;
+
+ /**
+ * <!-- begin-user-doc --> <!-- end-user-doc -->
+ *
+ * @generated
+ */
+ private EClass productEClass = null;
+
+ /**
+ * <!-- begin-user-doc --> <!-- end-user-doc -->
+ *
+ * @generated
+ */
+ private EClass orderAddressEClass = null;
+
+ /**
+ * <!-- begin-user-doc --> <!-- end-user-doc -->
+ *
+ * @generated
+ */
+ private EEnum vatEEnum = null;
+
+ /**
+ * <!-- begin-user-doc --> <!-- end-user-doc -->
+ *
+ * @generated
+ */
+ private EClass categoryEClass = null;
+
+ /**
+ * <!-- begin-user-doc --> <!-- end-user-doc -->
+ *
+ * @generated
+ */
+ private EClass companyEClass = null;
+
+ /**
+ * <!-- begin-user-doc --> <!-- end-user-doc -->
+ *
+ * @generated
+ */
+ private EClass customerEClass = null;
+
+ /**
+ * <!-- begin-user-doc --> <!-- end-user-doc -->
+ *
+ * @generated
+ */
+ private EClass orderEClass = null;
+
+ /**
+ * <!-- begin-user-doc --> <!-- end-user-doc -->
+ *
+ * @generated
+ */
+ private EClass salesOrderEClass = null;
+
+ /**
+ * Creates an instance of the model <b>Package</b>, registered with {@link org.eclipse.emf.ecore.EPackage.Registry
+ * EPackage.Registry} by the package package URI value.
+ * <p>
+ * Note: the correct way to create the package is via the static factory method {@link #init init()}, which also
+ * performs initialization of the package, or returns the registered package, if one already exists. <!--
+ * begin-user-doc --> <!-- end-user-doc -->
+ *
+ * @see org.eclipse.emf.ecore.EPackage.Registry
+ * @see org.eclipse.emf.cdo.tests.model1.Model1Package#eNS_URI
+ * @see #init()
+ * @generated
+ */
+ private Model1PackageImpl()
+ {
+ super(eNS_URI, Model1Factory.eINSTANCE);
+ }
+
+ /**
+ * <!-- begin-user-doc --> <!-- end-user-doc -->
+ *
+ * @generated
+ */
+ private static boolean isInited = false;
+
+ /**
+ * Creates, registers, and initializes the <b>Package</b> for this model, and for any others upon which it depends.
+ * Simple dependencies are satisfied by calling this method on all dependent packages before doing anything else. This
+ * method drives initialization for interdependent packages directly, in parallel with this package, itself.
+ * <p>
+ * Of this package and its interdependencies, all packages which have not yet been registered by their URI values are
+ * first created and registered. The packages are then initialized in two steps: meta-model objects for all of the
+ * packages are created before any are initialized, since one package's meta-model objects may refer to those of
+ * another.
+ * <p>
+ * Invocation of this method will not affect any packages that have already been initialized. <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ *
+ * @see #eNS_URI
+ * @see #createPackageContents()
+ * @see #initializePackageContents()
+ * @generated
+ */
+ public static Model1Package init()
+ {
+ if (isInited) return (Model1Package)EPackage.Registry.INSTANCE.getEPackage(Model1Package.eNS_URI);
+
+ // Obtain or create and register package
+ Model1PackageImpl theModel1Package = (Model1PackageImpl)(EPackage.Registry.INSTANCE.getEPackage(eNS_URI) instanceof Model1PackageImpl ? EPackage.Registry.INSTANCE
+ .getEPackage(eNS_URI)
+ : new Model1PackageImpl());
+
+ isInited = true;
+
+ // Create package meta-data objects
+ theModel1Package.createPackageContents();
+
+ // Initialize created meta-data
+ theModel1Package.initializePackageContents();
+
+ // Mark meta-data to indicate it can't be changed
+ theModel1Package.freeze();
+
+ return theModel1Package;
+ }
+
+ /**
+ * <!-- begin-user-doc --> <!-- end-user-doc -->
+ *
+ * @generated
+ */
+ public EClass getAddress()
+ {
+ return addressEClass;
+ }
+
+ /**
+ * <!-- begin-user-doc --> <!-- end-user-doc -->
+ *
+ * @generated
+ */
+ public EAttribute getAddress_Name()
+ {
+ return (EAttribute)addressEClass.getEStructuralFeatures().get(0);
+ }
+
+ /**
+ * <!-- begin-user-doc --> <!-- end-user-doc -->
+ *
+ * @generated
+ */
+ public EAttribute getAddress_Street()
+ {
+ return (EAttribute)addressEClass.getEStructuralFeatures().get(1);
+ }
+
+ /**
+ * <!-- begin-user-doc --> <!-- end-user-doc -->
+ *
+ * @generated
+ */
+ public EAttribute getAddress_City()
+ {
+ return (EAttribute)addressEClass.getEStructuralFeatures().get(2);
+ }
+
+ /**
+ * <!-- begin-user-doc --> <!-- end-user-doc -->
+ *
+ * @generated
+ */
+ public EClass getSupplier()
+ {
+ return supplierEClass;
+ }
+
+ /**
+ * <!-- begin-user-doc --> <!-- end-user-doc -->
+ *
+ * @generated
+ */
+ public EReference getSupplier_PurchaseOrders()
+ {
+ return (EReference)supplierEClass.getEStructuralFeatures().get(0);
+ }
+
+ /**
+ * <!-- begin-user-doc --> <!-- end-user-doc -->
+ *
+ * @generated
+ */
+ public EAttribute getSupplier_Preferred()
+ {
+ return (EAttribute)supplierEClass.getEStructuralFeatures().get(1);
+ }
+
+ /**
+ * <!-- begin-user-doc --> <!-- end-user-doc -->
+ *
+ * @generated
+ */
+ public EClass getPurchaseOrder()
+ {
+ return purchaseOrderEClass;
+ }
+
+ /**
+ * <!-- begin-user-doc --> <!-- end-user-doc -->
+ *
+ * @generated
+ */
+ public EAttribute getPurchaseOrder_Date()
+ {
+ return (EAttribute)purchaseOrderEClass.getEStructuralFeatures().get(0);
+ }
+
+ /**
+ * <!-- begin-user-doc --> <!-- end-user-doc -->
+ *
+ * @generated
+ */
+ public EReference getPurchaseOrder_Supplier()
+ {
+ return (EReference)purchaseOrderEClass.getEStructuralFeatures().get(1);
+ }
+
+ /**
+ * <!-- begin-user-doc --> <!-- end-user-doc -->
+ *
+ * @generated
+ */
+ public EClass getOrderDetail()
+ {
+ return orderDetailEClass;
+ }
+
+ /**
+ * <!-- begin-user-doc --> <!-- end-user-doc -->
+ *
+ * @generated
+ */
+ public EReference getOrderDetail_Order()
+ {
+ return (EReference)orderDetailEClass.getEStructuralFeatures().get(0);
+ }
+
+ /**
+ * <!-- begin-user-doc --> <!-- end-user-doc -->
+ *
+ * @generated
+ */
+ public EReference getOrderDetail_Product()
+ {
+ return (EReference)orderDetailEClass.getEStructuralFeatures().get(1);
+ }
+
+ /**
+ * <!-- begin-user-doc --> <!-- end-user-doc -->
+ *
+ * @generated
+ */
+ public EAttribute getOrderDetail_Price()
+ {
+ return (EAttribute)orderDetailEClass.getEStructuralFeatures().get(2);
+ }
+
+ /**
+ * <!-- begin-user-doc --> <!-- end-user-doc -->
+ *
+ * @generated
+ */
+ public EClass getProduct()
+ {
+ return productEClass;
+ }
+
+ /**
+ * <!-- begin-user-doc --> <!-- end-user-doc -->
+ *
+ * @generated
+ */
+ public EAttribute getProduct_Name()
+ {
+ return (EAttribute)productEClass.getEStructuralFeatures().get(0);
+ }
+
+ /**
+ * <!-- begin-user-doc --> <!-- end-user-doc -->
+ *
+ * @generated
+ */
+ public EReference getProduct_OrderDetails()
+ {
+ return (EReference)productEClass.getEStructuralFeatures().get(1);
+ }
+
+ /**
+ * <!-- begin-user-doc --> <!-- end-user-doc -->
+ *
+ * @generated
+ */
+ public EAttribute getProduct_Vat()
+ {
+ return (EAttribute)productEClass.getEStructuralFeatures().get(2);
+ }
+
+ /**
+ * <!-- begin-user-doc --> <!-- end-user-doc -->
+ *
+ * @generated
+ */
+ public EClass getOrderAddress()
+ {
+ return orderAddressEClass;
+ }
+
+ /**
+ * <!-- begin-user-doc --> <!-- end-user-doc -->
+ *
+ * @generated
+ */
+ public EAttribute getOrderAddress_TestAttribute()
+ {
+ return (EAttribute)orderAddressEClass.getEStructuralFeatures().get(0);
+ }
+
+ /**
+ * <!-- begin-user-doc --> <!-- end-user-doc -->
+ *
+ * @generated
+ */
+ public EEnum getVAT()
+ {
+ return vatEEnum;
+ }
+
+ /**
+ * <!-- begin-user-doc --> <!-- end-user-doc -->
+ *
+ * @generated
+ */
+ public EClass getCategory()
+ {
+ return categoryEClass;
+ }
+
+ /**
+ * <!-- begin-user-doc --> <!-- end-user-doc -->
+ *
+ * @generated
+ */
+ public EAttribute getCategory_Name()
+ {
+ return (EAttribute)categoryEClass.getEStructuralFeatures().get(0);
+ }
+
+ /**
+ * <!-- begin-user-doc --> <!-- end-user-doc -->
+ *
+ * @generated
+ */
+ public EReference getCategory_Categories()
+ {
+ return (EReference)categoryEClass.getEStructuralFeatures().get(1);
+ }
+
+ /**
+ * <!-- begin-user-doc --> <!-- end-user-doc -->
+ *
+ * @generated
+ */
+ public EReference getCategory_Products()
+ {
+ return (EReference)categoryEClass.getEStructuralFeatures().get(2);
+ }
+
+ /**
+ * <!-- begin-user-doc --> <!-- end-user-doc -->
+ *
+ * @generated
+ */
+ public EClass getCompany()
+ {
+ return companyEClass;
+ }
+
+ /**
+ * <!-- begin-user-doc --> <!-- end-user-doc -->
+ *
+ * @generated
+ */
+ public EReference getCompany_Categories()
+ {
+ return (EReference)companyEClass.getEStructuralFeatures().get(0);
+ }
+
+ /**
+ * <!-- begin-user-doc --> <!-- end-user-doc -->
+ *
+ * @generated
+ */
+ public EReference getCompany_Suppliers()
+ {
+ return (EReference)companyEClass.getEStructuralFeatures().get(1);
+ }
+
+ /**
+ * <!-- begin-user-doc --> <!-- end-user-doc -->
+ *
+ * @generated
+ */
+ public EReference getCompany_PurchaseOrders()
+ {
+ return (EReference)companyEClass.getEStructuralFeatures().get(3);
+ }
+
+ /**
+ * <!-- begin-user-doc --> <!-- end-user-doc -->
+ *
+ * @generated
+ */
+ public EReference getCompany_Customers()
+ {
+ return (EReference)companyEClass.getEStructuralFeatures().get(2);
+ }
+
+ /**
+ * <!-- begin-user-doc --> <!-- end-user-doc -->
+ *
+ * @generated
+ */
+ public EReference getCompany_SalesOrders()
+ {
+ return (EReference)companyEClass.getEStructuralFeatures().get(4);
+ }
+
+ /**
+ * <!-- begin-user-doc --> <!-- end-user-doc -->
+ *
+ * @generated
+ */
+ public EClass getCustomer()
+ {
+ return customerEClass;
+ }
+
+ /**
+ * <!-- begin-user-doc --> <!-- end-user-doc -->
+ *
+ * @generated
+ */
+ public EReference getCustomer_SalesOrders()
+ {
+ return (EReference)customerEClass.getEStructuralFeatures().get(0);
+ }
+
+ /**
+ * <!-- begin-user-doc --> <!-- end-user-doc -->
+ *
+ * @generated
+ */
+ public EClass getOrder()
+ {
+ return orderEClass;
+ }
+
+ /**
+ * <!-- begin-user-doc --> <!-- end-user-doc -->
+ *
+ * @generated
+ */
+ public EReference getOrder_OrderDetails()
+ {
+ return (EReference)orderEClass.getEStructuralFeatures().get(0);
+ }
+
+ /**
+ * <!-- begin-user-doc --> <!-- end-user-doc -->
+ *
+ * @generated
+ */
+ public EClass getSalesOrder()
+ {
+ return salesOrderEClass;
+ }
+
+ /**
+ * <!-- begin-user-doc --> <!-- end-user-doc -->
+ *
+ * @generated
+ */
+ public EAttribute getSalesOrder_Id()
+ {
+ return (EAttribute)salesOrderEClass.getEStructuralFeatures().get(0);
+ }
+
+ /**
+ * <!-- begin-user-doc --> <!-- end-user-doc -->
+ *
+ * @generated
+ */
+ public EReference getSalesOrder_Customer()
+ {
+ return (EReference)salesOrderEClass.getEStructuralFeatures().get(1);
+ }
+
+ /**
+ * <!-- begin-user-doc --> <!-- end-user-doc -->
+ *
+ * @generated
+ */
+ public Model1Factory getModel1Factory()
+ {
+ return (Model1Factory)getEFactoryInstance();
+ }
+
+ /**
+ * <!-- begin-user-doc --> <!-- end-user-doc -->
+ *
+ * @generated
+ */
+ private boolean isCreated = false;
+
+ /**
+ * Creates the meta-model objects for the package. This method is guarded to have no affect on any invocation but its
+ * first. <!-- begin-user-doc --> <!-- end-user-doc -->
+ *
+ * @generated
+ */
+ public void createPackageContents()
+ {
+ if (isCreated) return;
+ isCreated = true;
+
+ // Create classes and their features
+ addressEClass = createEClass(ADDRESS);
+ createEAttribute(addressEClass, ADDRESS__NAME);
+ createEAttribute(addressEClass, ADDRESS__STREET);
+ createEAttribute(addressEClass, ADDRESS__CITY);
+
+ companyEClass = createEClass(COMPANY);
+ createEReference(companyEClass, COMPANY__CATEGORIES);
+ createEReference(companyEClass, COMPANY__SUPPLIERS);
+ createEReference(companyEClass, COMPANY__CUSTOMERS);
+ createEReference(companyEClass, COMPANY__PURCHASE_ORDERS);
+ createEReference(companyEClass, COMPANY__SALES_ORDERS);
+
+ supplierEClass = createEClass(SUPPLIER);
+ createEReference(supplierEClass, SUPPLIER__PURCHASE_ORDERS);
+ createEAttribute(supplierEClass, SUPPLIER__PREFERRED);
+
+ customerEClass = createEClass(CUSTOMER);
+ createEReference(customerEClass, CUSTOMER__SALES_ORDERS);
+
+ orderEClass = createEClass(ORDER);
+ createEReference(orderEClass, ORDER__ORDER_DETAILS);
+
+ orderDetailEClass = createEClass(ORDER_DETAIL);
+ createEReference(orderDetailEClass, ORDER_DETAIL__ORDER);
+ createEReference(orderDetailEClass, ORDER_DETAIL__PRODUCT);
+ createEAttribute(orderDetailEClass, ORDER_DETAIL__PRICE);
+
+ purchaseOrderEClass = createEClass(PURCHASE_ORDER);
+ createEAttribute(purchaseOrderEClass, PURCHASE_ORDER__DATE);
+ createEReference(purchaseOrderEClass, PURCHASE_ORDER__SUPPLIER);
+
+ salesOrderEClass = createEClass(SALES_ORDER);
+ createEAttribute(salesOrderEClass, SALES_ORDER__ID);
+ createEReference(salesOrderEClass, SALES_ORDER__CUSTOMER);
+
+ categoryEClass = createEClass(CATEGORY);
+ createEAttribute(categoryEClass, CATEGORY__NAME);
+ createEReference(categoryEClass, CATEGORY__CATEGORIES);
+ createEReference(categoryEClass, CATEGORY__PRODUCTS);
+
+ productEClass = createEClass(PRODUCT);
+ createEAttribute(productEClass, PRODUCT__NAME);
+ createEReference(productEClass, PRODUCT__ORDER_DETAILS);
+ createEAttribute(productEClass, PRODUCT__VAT);
+
+ orderAddressEClass = createEClass(ORDER_ADDRESS);
+ createEAttribute(orderAddressEClass, ORDER_ADDRESS__TEST_ATTRIBUTE);
+
+ // Create enums
+ vatEEnum = createEEnum(VAT);
+ }
+
+ /**
+ * <!-- begin-user-doc --> <!-- end-user-doc -->
+ *
+ * @generated
+ */
+ private boolean isInitialized = false;
+
+ /**
+ * Complete the initialization of the package and its meta-model. This method is guarded to have no affect on any
+ * invocation but its first. <!-- begin-user-doc --> <!-- end-user-doc -->
+ *
+ * @generated
+ */
+ public void initializePackageContents()
+ {
+ if (isInitialized) return;
+ isInitialized = true;
+
+ // Initialize package
+ setName(eNAME);
+ setNsPrefix(eNS_PREFIX);
+ setNsURI(eNS_URI);
+
+ // Create type parameters
+
+ // Set bounds for type parameters
+
+ // Add supertypes to classes
+ companyEClass.getESuperTypes().add(this.getAddress());
+ supplierEClass.getESuperTypes().add(this.getAddress());
+ customerEClass.getESuperTypes().add(this.getAddress());
+ purchaseOrderEClass.getESuperTypes().add(this.getOrder());
+ salesOrderEClass.getESuperTypes().add(this.getOrder());
+ orderAddressEClass.getESuperTypes().add(this.getAddress());
+ orderAddressEClass.getESuperTypes().add(this.getOrder());
+ orderAddressEClass.getESuperTypes().add(this.getOrderDetail());
+
+ // Initialize classes and features; add operations and parameters
+ initEClass(addressEClass, Address.class, "Address", !IS_ABSTRACT, !IS_INTERFACE, IS_GENERATED_INSTANCE_CLASS);
+ initEAttribute(getAddress_Name(), ecorePackage.getEString(), "name", null, 0, 1, Address.class, !IS_TRANSIENT,
+ !IS_VOLATILE, IS_CHANGEABLE, !IS_UNSETTABLE, !IS_ID, IS_UNIQUE, !IS_DERIVED, IS_ORDERED);
+ initEAttribute(getAddress_Street(), ecorePackage.getEString(), "street", null, 0, 1, Address.class, !IS_TRANSIENT,
+ !IS_VOLATILE, IS_CHANGEABLE, !IS_UNSETTABLE, !IS_ID, IS_UNIQUE, !IS_DERIVED, IS_ORDERED);
+ initEAttribute(getAddress_City(), ecorePackage.getEString(), "city", null, 0, 1, Address.class, !IS_TRANSIENT,
+ !IS_VOLATILE, IS_CHANGEABLE, !IS_UNSETTABLE, !IS_ID, IS_UNIQUE, !IS_DERIVED, IS_ORDERED);
+
+ initEClass(companyEClass, Company.class, "Company", !IS_ABSTRACT, !IS_INTERFACE, IS_GENERATED_INSTANCE_CLASS);
+ initEReference(getCompany_Categories(), this.getCategory(), null, "categories", null, 0, -1, Company.class,
+ !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, IS_COMPOSITE, !IS_RESOLVE_PROXIES, !IS_UNSETTABLE, IS_UNIQUE,
+ !IS_DERIVED, IS_ORDERED);
+ initEReference(getCompany_Suppliers(), this.getSupplier(), null, "suppliers", null, 0, -1, Company.class,
+ !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, IS_COMPOSITE, !IS_RESOLVE_PROXIES, !IS_UNSETTABLE, IS_UNIQUE,
+ !IS_DERIVED, IS_ORDERED);
+ initEReference(getCompany_Customers(), this.getCustomer(), null, "customers", null, 0, -1, Company.class,
+ !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, IS_COMPOSITE, !IS_RESOLVE_PROXIES, !IS_UNSETTABLE, IS_UNIQUE,
+ !IS_DERIVED, IS_ORDERED);
+ initEReference(getCompany_PurchaseOrders(), this.getPurchaseOrder(), null, "purchaseOrders", null, 0, -1,
+ Company.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, IS_COMPOSITE, !IS_RESOLVE_PROXIES, !IS_UNSETTABLE,
+ IS_UNIQUE, !IS_DERIVED, IS_ORDERED);
+ initEReference(getCompany_SalesOrders(), this.getSalesOrder(), null, "salesOrders", null, 0, -1, Company.class,
+ !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, IS_COMPOSITE, !IS_RESOLVE_PROXIES, !IS_UNSETTABLE, IS_UNIQUE,
+ !IS_DERIVED, IS_ORDERED);
+
+ initEClass(supplierEClass, Supplier.class, "Supplier", !IS_ABSTRACT, !IS_INTERFACE, IS_GENERATED_INSTANCE_CLASS);
+ initEReference(getSupplier_PurchaseOrders(), this.getPurchaseOrder(), this.getPurchaseOrder_Supplier(),
+ "purchaseOrders", null, 0, -1, Supplier.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, !IS_COMPOSITE,
+ IS_RESOLVE_PROXIES, !IS_UNSETTABLE, IS_UNIQUE, !IS_DERIVED, IS_ORDERED);
+ initEAttribute(getSupplier_Preferred(), ecorePackage.getEBoolean(), "preferred", "true", 0, 1, Supplier.class,
+ !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, !IS_UNSETTABLE, !IS_ID, IS_UNIQUE, !IS_DERIVED, IS_ORDERED);
+
+ initEClass(customerEClass, Customer.class, "Customer", !IS_ABSTRACT, !IS_INTERFACE, IS_GENERATED_INSTANCE_CLASS);
+ initEReference(getCustomer_SalesOrders(), this.getSalesOrder(), this.getSalesOrder_Customer(), "salesOrders", null,
+ 0, -1, Customer.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, !IS_COMPOSITE, IS_RESOLVE_PROXIES,
+ !IS_UNSETTABLE, !IS_UNIQUE, !IS_DERIVED, IS_ORDERED);
+
+ initEClass(orderEClass, Order.class, "Order", !IS_ABSTRACT, !IS_INTERFACE, IS_GENERATED_INSTANCE_CLASS);
+ initEReference(getOrder_OrderDetails(), this.getOrderDetail(), this.getOrderDetail_Order(), "orderDetails", null,
+ 0, -1, Order.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, IS_COMPOSITE, !IS_RESOLVE_PROXIES,
+ !IS_UNSETTABLE, IS_UNIQUE, !IS_DERIVED, IS_ORDERED);
+
+ initEClass(orderDetailEClass, OrderDetail.class, "OrderDetail", !IS_ABSTRACT, !IS_INTERFACE,
+ IS_GENERATED_INSTANCE_CLASS);
+ initEReference(getOrderDetail_Order(), this.getOrder(), this.getOrder_OrderDetails(), "order", null, 1, 1,
+ OrderDetail.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, !IS_COMPOSITE, !IS_RESOLVE_PROXIES,
+ !IS_UNSETTABLE, IS_UNIQUE, !IS_DERIVED, IS_ORDERED);
+ initEReference(getOrderDetail_Product(), this.getProduct(), this.getProduct_OrderDetails(), "product", null, 0, 1,
+ OrderDetail.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, !IS_COMPOSITE, IS_RESOLVE_PROXIES,
+ !IS_UNSETTABLE, IS_UNIQUE, !IS_DERIVED, IS_ORDERED);
+ initEAttribute(getOrderDetail_Price(), ecorePackage.getEFloat(), "price", null, 0, 1, OrderDetail.class,
+ !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, !IS_UNSETTABLE, !IS_ID, IS_UNIQUE, !IS_DERIVED, IS_ORDERED);
+
+ initEClass(purchaseOrderEClass, PurchaseOrder.class, "PurchaseOrder", !IS_ABSTRACT, !IS_INTERFACE,
+ IS_GENERATED_INSTANCE_CLASS);
+ initEAttribute(getPurchaseOrder_Date(), ecorePackage.getEDate(), "date", null, 0, 1, PurchaseOrder.class,
+ !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, !IS_UNSETTABLE, !IS_ID, IS_UNIQUE, !IS_DERIVED, IS_ORDERED);
+ initEReference(getPurchaseOrder_Supplier(), this.getSupplier(), this.getSupplier_PurchaseOrders(), "supplier",
+ null, 1, 1, PurchaseOrder.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, !IS_COMPOSITE, IS_RESOLVE_PROXIES,
+ !IS_UNSETTABLE, IS_UNIQUE, !IS_DERIVED, IS_ORDERED);
+
+ initEClass(salesOrderEClass, SalesOrder.class, "SalesOrder", !IS_ABSTRACT, !IS_INTERFACE,
+ IS_GENERATED_INSTANCE_CLASS);
+ initEAttribute(getSalesOrder_Id(), ecorePackage.getEInt(), "id", null, 0, 1, SalesOrder.class, !IS_TRANSIENT,
+ !IS_VOLATILE, IS_CHANGEABLE, !IS_UNSETTABLE, !IS_ID, IS_UNIQUE, !IS_DERIVED, IS_ORDERED);
+ initEReference(getSalesOrder_Customer(), this.getCustomer(), this.getCustomer_SalesOrders(), "customer", null, 1,
+ 1, SalesOrder.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, !IS_COMPOSITE, IS_RESOLVE_PROXIES,
+ !IS_UNSETTABLE, IS_UNIQUE, !IS_DERIVED, IS_ORDERED);
+
+ initEClass(categoryEClass, Category.class, "Category", !IS_ABSTRACT, !IS_INTERFACE, IS_GENERATED_INSTANCE_CLASS);
+ initEAttribute(getCategory_Name(), ecorePackage.getEString(), "name", null, 0, 1, Category.class, !IS_TRANSIENT,
+ !IS_VOLATILE, IS_CHANGEABLE, !IS_UNSETTABLE, !IS_ID, IS_UNIQUE, !IS_DERIVED, IS_ORDERED);
+ initEReference(getCategory_Categories(), this.getCategory(), null, "categories", null, 0, -1, Category.class,
+ !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, IS_COMPOSITE, !IS_RESOLVE_PROXIES, !IS_UNSETTABLE, IS_UNIQUE,
+ !IS_DERIVED, IS_ORDERED);
+ initEReference(getCategory_Products(), this.getProduct(), null, "products", null, 0, -1, Category.class,
+ !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, IS_COMPOSITE, !IS_RESOLVE_PROXIES, !IS_UNSETTABLE, IS_UNIQUE,
+ !IS_DERIVED, IS_ORDERED);
+
+ initEClass(productEClass, Product.class, "Product", !IS_ABSTRACT, !IS_INTERFACE, IS_GENERATED_INSTANCE_CLASS);
+ initEAttribute(getProduct_Name(), ecorePackage.getEString(), "name", null, 0, 1, Product.class, !IS_TRANSIENT,
+ !IS_VOLATILE, IS_CHANGEABLE, !IS_UNSETTABLE, !IS_ID, IS_UNIQUE, !IS_DERIVED, IS_ORDERED);
+ initEReference(getProduct_OrderDetails(), this.getOrderDetail(), this.getOrderDetail_Product(), "orderDetails",
+ null, 0, -1, Product.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, !IS_COMPOSITE, IS_RESOLVE_PROXIES,
+ !IS_UNSETTABLE, IS_UNIQUE, !IS_DERIVED, IS_ORDERED);
+ initEAttribute(getProduct_Vat(), this.getVAT(), "vat", "vat15", 0, 1, Product.class, !IS_TRANSIENT, !IS_VOLATILE,
+ IS_CHANGEABLE, !IS_UNSETTABLE, !IS_ID, IS_UNIQUE, !IS_DERIVED, IS_ORDERED);
+
+ initEClass(orderAddressEClass, OrderAddress.class, "OrderAddress", !IS_ABSTRACT, !IS_INTERFACE,
+ IS_GENERATED_INSTANCE_CLASS);
+ initEAttribute(getOrderAddress_TestAttribute(), ecorePackage.getEBoolean(), "testAttribute", null, 0, 1,
+ OrderAddress.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, !IS_UNSETTABLE, !IS_ID, IS_UNIQUE, !IS_DERIVED,
+ IS_ORDERED);
+
+ // Initialize enums and add enum literals
+ initEEnum(vatEEnum, org.eclipse.emf.cdo.tests.model1.VAT.class, "VAT");
+ addEEnumLiteral(vatEEnum, org.eclipse.emf.cdo.tests.model1.VAT.VAT0);
+ addEEnumLiteral(vatEEnum, org.eclipse.emf.cdo.tests.model1.VAT.VAT7);
+ addEEnumLiteral(vatEEnum, org.eclipse.emf.cdo.tests.model1.VAT.VAT15);
+
+ // Create resource
+ createResource(eNS_URI);
+ }
+
+} // Model1PackageImpl
diff --git a/plugins/org.eclipse.emf.cdo.tests.model1/src/org/eclipse/emf/cdo/tests/model1/impl/OrderAddressImpl.java b/plugins/org.eclipse.emf.cdo.tests.model1/src/org/eclipse/emf/cdo/tests/model1/impl/OrderAddressImpl.java
new file mode 100644
index 0000000000..5df9ca035e
--- /dev/null
+++ b/plugins/org.eclipse.emf.cdo.tests.model1/src/org/eclipse/emf/cdo/tests/model1/impl/OrderAddressImpl.java
@@ -0,0 +1,217 @@
+/**
+ * <copyright>
+ * </copyright>
+ *
+ * $Id: OrderAddressImpl.java,v 1.2 2008-06-03 06:41:31 estepper Exp $
+ */
+package org.eclipse.emf.cdo.tests.model1.impl;
+
+import org.eclipse.emf.cdo.tests.model1.Model1Package;
+import org.eclipse.emf.cdo.tests.model1.Order;
+import org.eclipse.emf.cdo.tests.model1.OrderAddress;
+import org.eclipse.emf.cdo.tests.model1.OrderDetail;
+import org.eclipse.emf.cdo.tests.model1.Product;
+
+import org.eclipse.emf.common.util.EList;
+import org.eclipse.emf.ecore.EClass;
+
+/**
+ * <!-- begin-user-doc --> An implementation of the model object '<em><b>Order Address</b></em>'. <!-- end-user-doc -->
+ * <p>
+ * The following features are implemented:
+ * <ul>
+ * <li>{@link org.eclipse.emf.cdo.tests.model1.impl.OrderAddressImpl#getOrderDetails <em>Order Details</em>}</li>
+ * <li>{@link org.eclipse.emf.cdo.tests.model1.impl.OrderAddressImpl#getOrder <em>Order</em>}</li>
+ * <li>{@link org.eclipse.emf.cdo.tests.model1.impl.OrderAddressImpl#getProduct <em>Product</em>}</li>
+ * <li>{@link org.eclipse.emf.cdo.tests.model1.impl.OrderAddressImpl#getPrice <em>Price</em>}</li>
+ * <li>{@link org.eclipse.emf.cdo.tests.model1.impl.OrderAddressImpl#isTestAttribute <em>Test Attribute</em>}</li>
+ * </ul>
+ * </p>
+ *
+ * @generated
+ */
+public class OrderAddressImpl extends AddressImpl implements OrderAddress
+{
+ /**
+ * <!-- begin-user-doc --> <!-- end-user-doc -->
+ *
+ * @generated
+ */
+ protected OrderAddressImpl()
+ {
+ super();
+ }
+
+ /**
+ * <!-- begin-user-doc --> <!-- end-user-doc -->
+ *
+ * @generated
+ */
+ @Override
+ protected EClass eStaticClass()
+ {
+ return Model1Package.Literals.ORDER_ADDRESS;
+ }
+
+ /**
+ * <!-- begin-user-doc --> <!-- end-user-doc -->
+ *
+ * @generated
+ */
+ @SuppressWarnings("unchecked")
+ public EList<OrderDetail> getOrderDetails()
+ {
+ return (EList<OrderDetail>)eGet(Model1Package.Literals.ORDER__ORDER_DETAILS, true);
+ }
+
+ /**
+ * <!-- begin-user-doc --> <!-- end-user-doc -->
+ *
+ * @generated
+ */
+ public Order getOrder()
+ {
+ return (Order)eGet(Model1Package.Literals.ORDER_DETAIL__ORDER, true);
+ }
+
+ /**
+ * <!-- begin-user-doc --> <!-- end-user-doc -->
+ *
+ * @generated
+ */
+ public void setOrder(Order newOrder)
+ {
+ eSet(Model1Package.Literals.ORDER_DETAIL__ORDER, newOrder);
+ }
+
+ /**
+ * <!-- begin-user-doc --> <!-- end-user-doc -->
+ *
+ * @generated
+ */
+ public Product getProduct()
+ {
+ return (Product)eGet(Model1Package.Literals.ORDER_DETAIL__PRODUCT, true);
+ }
+
+ /**
+ * <!-- begin-user-doc --> <!-- end-user-doc -->
+ *
+ * @generated
+ */
+ public void setProduct(Product newProduct)
+ {
+ eSet(Model1Package.Literals.ORDER_DETAIL__PRODUCT, newProduct);
+ }
+
+ /**
+ * <!-- begin-user-doc --> <!-- end-user-doc -->
+ *
+ * @generated
+ */
+ public float getPrice()
+ {
+ return ((Float)eGet(Model1Package.Literals.ORDER_DETAIL__PRICE, true)).floatValue();
+ }
+
+ /**
+ * <!-- begin-user-doc --> <!-- end-user-doc -->
+ *
+ * @generated
+ */
+ public void setPrice(float newPrice)
+ {
+ eSet(Model1Package.Literals.ORDER_DETAIL__PRICE, new Float(newPrice));
+ }
+
+ /**
+ * <!-- begin-user-doc --> <!-- end-user-doc -->
+ *
+ * @generated
+ */
+ public boolean isTestAttribute()
+ {
+ return ((Boolean)eGet(Model1Package.Literals.ORDER_ADDRESS__TEST_ATTRIBUTE, true)).booleanValue();
+ }
+
+ /**
+ * <!-- begin-user-doc --> <!-- end-user-doc -->
+ *
+ * @generated
+ */
+ public void setTestAttribute(boolean newTestAttribute)
+ {
+ eSet(Model1Package.Literals.ORDER_ADDRESS__TEST_ATTRIBUTE, new Boolean(newTestAttribute));
+ }
+
+ /**
+ * <!-- begin-user-doc --> <!-- end-user-doc -->
+ *
+ * @generated
+ */
+ @Override
+ public int eBaseStructuralFeatureID(int derivedFeatureID, Class<?> baseClass)
+ {
+ if (baseClass == Order.class)
+ {
+ switch (derivedFeatureID)
+ {
+ case Model1Package.ORDER_ADDRESS__ORDER_DETAILS:
+ return Model1Package.ORDER__ORDER_DETAILS;
+ default:
+ return -1;
+ }
+ }
+ if (baseClass == OrderDetail.class)
+ {
+ switch (derivedFeatureID)
+ {
+ case Model1Package.ORDER_ADDRESS__ORDER:
+ return Model1Package.ORDER_DETAIL__ORDER;
+ case Model1Package.ORDER_ADDRESS__PRODUCT:
+ return Model1Package.ORDER_DETAIL__PRODUCT;
+ case Model1Package.ORDER_ADDRESS__PRICE:
+ return Model1Package.ORDER_DETAIL__PRICE;
+ default:
+ return -1;
+ }
+ }
+ return super.eBaseStructuralFeatureID(derivedFeatureID, baseClass);
+ }
+
+ /**
+ * <!-- begin-user-doc --> <!-- end-user-doc -->
+ *
+ * @generated
+ */
+ @Override
+ public int eDerivedStructuralFeatureID(int baseFeatureID, Class<?> baseClass)
+ {
+ if (baseClass == Order.class)
+ {
+ switch (baseFeatureID)
+ {
+ case Model1Package.ORDER__ORDER_DETAILS:
+ return Model1Package.ORDER_ADDRESS__ORDER_DETAILS;
+ default:
+ return -1;
+ }
+ }
+ if (baseClass == OrderDetail.class)
+ {
+ switch (baseFeatureID)
+ {
+ case Model1Package.ORDER_DETAIL__ORDER:
+ return Model1Package.ORDER_ADDRESS__ORDER;
+ case Model1Package.ORDER_DETAIL__PRODUCT:
+ return Model1Package.ORDER_ADDRESS__PRODUCT;
+ case Model1Package.ORDER_DETAIL__PRICE:
+ return Model1Package.ORDER_ADDRESS__PRICE;
+ default:
+ return -1;
+ }
+ }
+ return super.eDerivedStructuralFeatureID(baseFeatureID, baseClass);
+ }
+
+} // OrderAddressImpl
diff --git a/plugins/org.eclipse.emf.cdo.tests.model1/src/org/eclipse/emf/cdo/tests/model1/impl/OrderDetailImpl.java b/plugins/org.eclipse.emf.cdo.tests.model1/src/org/eclipse/emf/cdo/tests/model1/impl/OrderDetailImpl.java
new file mode 100644
index 0000000000..a613c4c883
--- /dev/null
+++ b/plugins/org.eclipse.emf.cdo.tests.model1/src/org/eclipse/emf/cdo/tests/model1/impl/OrderDetailImpl.java
@@ -0,0 +1,125 @@
+/**
+ * <copyright>
+ * </copyright>
+ *
+ * $Id$
+ */
+package org.eclipse.emf.cdo.tests.model1.impl;
+
+import org.eclipse.emf.cdo.tests.model1.Model1Package;
+import org.eclipse.emf.cdo.tests.model1.Order;
+import org.eclipse.emf.cdo.tests.model1.OrderDetail;
+import org.eclipse.emf.cdo.tests.model1.Product;
+
+import org.eclipse.emf.internal.cdo.CDOObjectImpl;
+
+import org.eclipse.emf.ecore.EClass;
+
+/**
+ * <!-- begin-user-doc --> An implementation of the model object '<em><b>Order Detail</b></em>'. <!-- end-user-doc -->
+ * <p>
+ * The following features are implemented:
+ * <ul>
+ * <li>{@link org.eclipse.emf.cdo.tests.model1.impl.OrderDetailImpl#getOrder <em>Order</em>}</li>
+ * <li>{@link org.eclipse.emf.cdo.tests.model1.impl.OrderDetailImpl#getProduct <em>Product</em>}</li>
+ * <li>{@link org.eclipse.emf.cdo.tests.model1.impl.OrderDetailImpl#getPrice <em>Price</em>}</li>
+ * </ul>
+ * </p>
+ *
+ * @generated
+ */
+public class OrderDetailImpl extends CDOObjectImpl implements OrderDetail
+{
+ /**
+ * <!-- begin-user-doc --> <!-- end-user-doc -->
+ *
+ * @generated
+ */
+ protected OrderDetailImpl()
+ {
+ super();
+ }
+
+ /**
+ * <!-- begin-user-doc --> <!-- end-user-doc -->
+ *
+ * @generated
+ */
+ @Override
+ protected EClass eStaticClass()
+ {
+ return Model1Package.Literals.ORDER_DETAIL;
+ }
+
+ /**
+ * <!-- begin-user-doc --> <!-- end-user-doc -->
+ *
+ * @generated
+ */
+ @Override
+ protected int eStaticFeatureCount()
+ {
+ return 0;
+ }
+
+ /**
+ * <!-- begin-user-doc --> <!-- end-user-doc -->
+ *
+ * @generated
+ */
+ public Order getOrder()
+ {
+ return (Order)eGet(Model1Package.Literals.ORDER_DETAIL__ORDER, true);
+ }
+
+ /**
+ * <!-- begin-user-doc --> <!-- end-user-doc -->
+ *
+ * @generated
+ */
+ public void setOrder(Order newOrder)
+ {
+ eSet(Model1Package.Literals.ORDER_DETAIL__ORDER, newOrder);
+ }
+
+ /**
+ * <!-- begin-user-doc --> <!-- end-user-doc -->
+ *
+ * @generated
+ */
+ public Product getProduct()
+ {
+ return (Product)eGet(Model1Package.Literals.ORDER_DETAIL__PRODUCT, true);
+ }
+
+ /**
+ * <!-- begin-user-doc --> <!-- end-user-doc -->
+ *
+ * @generated
+ */
+ public void setProduct(Product newProduct)
+ {
+ eSet(Model1Package.Literals.ORDER_DETAIL__PRODUCT, newProduct);
+ }
+
+ /**
+ * <!-- begin-user-doc --> <!-- end-user-doc -->
+ *
+ * @generated
+ */
+ public float getPrice()
+ {
+ return ((Float)eGet(Model1Package.Literals.ORDER_DETAIL__PRICE, true)).floatValue();
+ }
+
+ /**
+ * <!-- begin-user-doc --> <!-- end-user-doc -->
+ *
+ * @generated
+ */
+ public void setPrice(float newPrice)
+ {
+ eSet(Model1Package.Literals.ORDER_DETAIL__PRICE, new Float(newPrice));
+ }
+
+} // OrderDetailImpl
diff --git a/plugins/org.eclipse.emf.cdo.tests.model1/src/org/eclipse/emf/cdo/tests/model1/impl/PurchaseOrderImpl.java b/plugins/org.eclipse.emf.cdo.tests.model1/src/org/eclipse/emf/cdo/tests/model1/impl/PurchaseOrderImpl.java
new file mode 100644
index 0000000000..5660889ed2
--- /dev/null
+++ b/plugins/org.eclipse.emf.cdo.tests.model1/src/org/eclipse/emf/cdo/tests/model1/impl/PurchaseOrderImpl.java
@@ -0,0 +1,92 @@
+/**
+ * <copyright>
+ * </copyright>
+ *
+ * $Id$
+ */
+package org.eclipse.emf.cdo.tests.model1.impl;
+
+import org.eclipse.emf.cdo.tests.model1.Model1Package;
+import org.eclipse.emf.cdo.tests.model1.PurchaseOrder;
+import org.eclipse.emf.cdo.tests.model1.Supplier;
+
+import org.eclipse.emf.ecore.EClass;
+
+import java.util.Date;
+
+/**
+ * <!-- begin-user-doc --> An implementation of the model object '<em><b>Purchase Order</b></em>'. <!-- end-user-doc -->
+ * <p>
+ * The following features are implemented:
+ * <ul>
+ * <li>{@link org.eclipse.emf.cdo.tests.model1.impl.PurchaseOrderImpl#getDate <em>Date</em>}</li>
+ * <li>{@link org.eclipse.emf.cdo.tests.model1.impl.PurchaseOrderImpl#getSupplier <em>Supplier</em>}</li>
+ * </ul>
+ * </p>
+ *
+ * @generated
+ */
+public class PurchaseOrderImpl extends OrderImpl implements PurchaseOrder
+{
+ /**
+ * <!-- begin-user-doc --> <!-- end-user-doc -->
+ *
+ * @generated
+ */
+ protected PurchaseOrderImpl()
+ {
+ super();
+ }
+
+ /**
+ * <!-- begin-user-doc --> <!-- end-user-doc -->
+ *
+ * @generated
+ */
+ @Override
+ protected EClass eStaticClass()
+ {
+ return Model1Package.Literals.PURCHASE_ORDER;
+ }
+
+ /**
+ * <!-- begin-user-doc --> <!-- end-user-doc -->
+ *
+ * @generated
+ */
+ public Date getDate()
+ {
+ return (Date)eGet(Model1Package.Literals.PURCHASE_ORDER__DATE, true);
+ }
+
+ /**
+ * <!-- begin-user-doc --> <!-- end-user-doc -->
+ *
+ * @generated
+ */
+ public void setDate(Date newDate)
+ {
+ eSet(Model1Package.Literals.PURCHASE_ORDER__DATE, newDate);
+ }
+
+ /**
+ * <!-- begin-user-doc --> <!-- end-user-doc -->
+ *
+ * @generated
+ */
+ public Supplier getSupplier()
+ {
+ return (Supplier)eGet(Model1Package.Literals.PURCHASE_ORDER__SUPPLIER, true);
+ }
+
+ /**
+ * <!-- begin-user-doc --> <!-- end-user-doc -->
+ *
+ * @generated
+ */
+ public void setSupplier(Supplier newSupplier)
+ {
+ eSet(Model1Package.Literals.PURCHASE_ORDER__SUPPLIER, newSupplier);
+ }
+
+} // PurchaseOrderImpl
diff --git a/plugins/org.eclipse.emf.cdo.tests.model1/src/org/eclipse/emf/cdo/tests/model1/impl/SalesOrderImpl.java b/plugins/org.eclipse.emf.cdo.tests.model1/src/org/eclipse/emf/cdo/tests/model1/impl/SalesOrderImpl.java
new file mode 100644
index 0000000000..a89c6df5c4
--- /dev/null
+++ b/plugins/org.eclipse.emf.cdo.tests.model1/src/org/eclipse/emf/cdo/tests/model1/impl/SalesOrderImpl.java
@@ -0,0 +1,90 @@
+/**
+ * <copyright>
+ * </copyright>
+ *
+ * $Id$
+ */
+package org.eclipse.emf.cdo.tests.model1.impl;
+
+import org.eclipse.emf.cdo.tests.model1.Customer;
+import org.eclipse.emf.cdo.tests.model1.Model1Package;
+import org.eclipse.emf.cdo.tests.model1.SalesOrder;
+
+import org.eclipse.emf.ecore.EClass;
+
+/**
+ * <!-- begin-user-doc --> An implementation of the model object '<em><b>Sales Order</b></em>'. <!-- end-user-doc -->
+ * <p>
+ * The following features are implemented:
+ * <ul>
+ * <li>{@link org.eclipse.emf.cdo.tests.model1.impl.SalesOrderImpl#getId <em>Id</em>}</li>
+ * <li>{@link org.eclipse.emf.cdo.tests.model1.impl.SalesOrderImpl#getCustomer <em>Customer</em>}</li>
+ * </ul>
+ * </p>
+ *
+ * @generated
+ */
+public class SalesOrderImpl extends OrderImpl implements SalesOrder
+{
+ /**
+ * <!-- begin-user-doc --> <!-- end-user-doc -->
+ *
+ * @generated
+ */
+ protected SalesOrderImpl()
+ {
+ super();
+ }
+
+ /**
+ * <!-- begin-user-doc --> <!-- end-user-doc -->
+ *
+ * @generated
+ */
+ @Override
+ protected EClass eStaticClass()
+ {
+ return Model1Package.Literals.SALES_ORDER;
+ }
+
+ /**
+ * <!-- begin-user-doc --> <!-- end-user-doc -->
+ *
+ * @generated
+ */
+ public int getId()
+ {
+ return ((Integer)eGet(Model1Package.Literals.SALES_ORDER__ID, true)).intValue();
+ }
+
+ /**
+ * <!-- begin-user-doc --> <!-- end-user-doc -->
+ *
+ * @generated
+ */
+ public void setId(int newId)
+ {
+ eSet(Model1Package.Literals.SALES_ORDER__ID, new Integer(newId));
+ }
+
+ /**
+ * <!-- begin-user-doc --> <!-- end-user-doc -->
+ *
+ * @generated
+ */
+ public Customer getCustomer()
+ {
+ return (Customer)eGet(Model1Package.Literals.SALES_ORDER__CUSTOMER, true);
+ }
+
+ /**
+ * <!-- begin-user-doc --> <!-- end-user-doc -->
+ *
+ * @generated
+ */
+ public void setCustomer(Customer newCustomer)
+ {
+ eSet(Model1Package.Literals.SALES_ORDER__CUSTOMER, newCustomer);
+ }
+
+} // SalesOrderImpl
diff --git a/plugins/org.eclipse.emf.cdo.tests.model1/src/org/eclipse/emf/cdo/tests/model1/util/Model1AdapterFactory.java b/plugins/org.eclipse.emf.cdo.tests.model1/src/org/eclipse/emf/cdo/tests/model1/util/Model1AdapterFactory.java
new file mode 100644
index 0000000000..81f477d4ed
--- /dev/null
+++ b/plugins/org.eclipse.emf.cdo.tests.model1/src/org/eclipse/emf/cdo/tests/model1/util/Model1AdapterFactory.java
@@ -0,0 +1,338 @@
+/**
+ * <copyright>
+ * </copyright>
+ *
+ * $Id$
+ */
+package org.eclipse.emf.cdo.tests.model1.util;
+
+import org.eclipse.emf.cdo.tests.model1.Address;
+import org.eclipse.emf.cdo.tests.model1.Category;
+import org.eclipse.emf.cdo.tests.model1.Company;
+import org.eclipse.emf.cdo.tests.model1.Customer;
+import org.eclipse.emf.cdo.tests.model1.Model1Package;
+import org.eclipse.emf.cdo.tests.model1.Order;
+import org.eclipse.emf.cdo.tests.model1.OrderAddress;
+import org.eclipse.emf.cdo.tests.model1.OrderDetail;
+import org.eclipse.emf.cdo.tests.model1.Product;
+import org.eclipse.emf.cdo.tests.model1.PurchaseOrder;
+import org.eclipse.emf.cdo.tests.model1.SalesOrder;
+import org.eclipse.emf.cdo.tests.model1.Supplier;
+
+import org.eclipse.emf.common.notify.Adapter;
+import org.eclipse.emf.common.notify.Notifier;
+import org.eclipse.emf.common.notify.impl.AdapterFactoryImpl;
+import org.eclipse.emf.ecore.EObject;
+
+/**
+ * <!-- begin-user-doc --> The <b>Adapter Factory</b> for the model. It provides an adapter <code>createXXX</code>
+ * method for each class of the model. <!-- end-user-doc -->
+ *
+ * @see org.eclipse.emf.cdo.tests.model1.Model1Package
+ * @generated
+ */
+public class Model1AdapterFactory extends AdapterFactoryImpl
+{
+ /**
+ * The cached model package. <!-- begin-user-doc --> <!-- end-user-doc -->
+ *
+ * @generated
+ */
+ protected static Model1Package modelPackage;
+
+ /**
+ * Creates an instance of the adapter factory. <!-- begin-user-doc --> <!-- end-user-doc -->
+ *
+ * @generated
+ */
+ public Model1AdapterFactory()
+ {
+ if (modelPackage == null)
+ {
+ modelPackage = Model1Package.eINSTANCE;
+ }
+ }
+
+ /**
+ * Returns whether this factory is applicable for the type of the object. <!-- begin-user-doc --> This implementation
+ * returns <code>true</code> if the object is either the model's package or is an instance object of the model. <!--
+ * end-user-doc -->
+ *
+ * @return whether this factory is applicable for the type of the object.
+ * @generated
+ */
+ @Override
+ public boolean isFactoryForType(Object object)
+ {
+ if (object == modelPackage)
+ {
+ return true;
+ }
+ if (object instanceof EObject)
+ {
+ return ((EObject)object).eClass().getEPackage() == modelPackage;
+ }
+ return false;
+ }
+
+ /**
+ * The switch that delegates to the <code>createXXX</code> methods. <!-- begin-user-doc --> <!-- end-user-doc -->
+ *
+ * @generated
+ */
+ protected Model1Switch<Adapter> modelSwitch = new Model1Switch<Adapter>()
+ {
+ @Override
+ public Adapter caseAddress(Address object)
+ {
+ return createAddressAdapter();
+ }
+
+ @Override
+ public Adapter caseCompany(Company object)
+ {
+ return createCompanyAdapter();
+ }
+
+ @Override
+ public Adapter caseSupplier(Supplier object)
+ {
+ return createSupplierAdapter();
+ }
+
+ @Override
+ public Adapter caseCustomer(Customer object)
+ {
+ return createCustomerAdapter();
+ }
+
+ @Override
+ public Adapter caseOrder(Order object)
+ {
+ return createOrderAdapter();
+ }
+
+ @Override
+ public Adapter caseOrderDetail(OrderDetail object)
+ {
+ return createOrderDetailAdapter();
+ }
+
+ @Override
+ public Adapter casePurchaseOrder(PurchaseOrder object)
+ {
+ return createPurchaseOrderAdapter();
+ }
+
+ @Override
+ public Adapter caseSalesOrder(SalesOrder object)
+ {
+ return createSalesOrderAdapter();
+ }
+
+ @Override
+ public Adapter caseCategory(Category object)
+ {
+ return createCategoryAdapter();
+ }
+
+ @Override
+ public Adapter caseProduct(Product object)
+ {
+ return createProductAdapter();
+ }
+
+ @Override
+ public Adapter caseOrderAddress(OrderAddress object)
+ {
+ return createOrderAddressAdapter();
+ }
+
+ @Override
+ public Adapter defaultCase(EObject object)
+ {
+ return createEObjectAdapter();
+ }
+ };
+
+ /**
+ * Creates an adapter for the <code>target</code>. <!-- begin-user-doc --> <!-- end-user-doc -->
+ *
+ * @param target
+ * the object to adapt.
+ * @return the adapter for the <code>target</code>.
+ * @generated
+ */
+ @Override
+ public Adapter createAdapter(Notifier target)
+ {
+ return modelSwitch.doSwitch((EObject)target);
+ }
+
+ /**
+ * Creates a new adapter for an object of class '{@link org.eclipse.emf.cdo.tests.model1.Address <em>Address</em>}'.
+ * <!-- begin-user-doc --> This default implementation returns null so that we can easily ignore cases; it's useful to
+ * ignore a case when inheritance will catch all the cases anyway. <!-- end-user-doc -->
+ *
+ * @return the new adapter.
+ * @see org.eclipse.emf.cdo.tests.model1.Address
+ * @generated
+ */
+ public Adapter createAddressAdapter()
+ {
+ return null;
+ }
+
+ /**
+ * Creates a new adapter for an object of class '{@link org.eclipse.emf.cdo.tests.model1.Supplier <em>Supplier</em>}'.
+ * <!-- begin-user-doc --> This default implementation returns null so that we can easily ignore cases; it's useful to
+ * ignore a case when inheritance will catch all the cases anyway. <!-- end-user-doc -->
+ *
+ * @return the new adapter.
+ * @see org.eclipse.emf.cdo.tests.model1.Supplier
+ * @generated
+ */
+ public Adapter createSupplierAdapter()
+ {
+ return null;
+ }
+
+ /**
+ * Creates a new adapter for an object of class '{@link org.eclipse.emf.cdo.tests.model1.PurchaseOrder
+ * <em>Purchase Order</em>}'. <!-- begin-user-doc --> This default implementation returns null so that we can easily
+ * ignore cases; it's useful to ignore a case when inheritance will catch all the cases anyway. <!-- end-user-doc -->
+ *
+ * @return the new adapter.
+ * @see org.eclipse.emf.cdo.tests.model1.PurchaseOrder
+ * @generated
+ */
+ public Adapter createPurchaseOrderAdapter()
+ {
+ return null;
+ }
+
+ /**
+ * Creates a new adapter for an object of class '{@link org.eclipse.emf.cdo.tests.model1.OrderDetail
+ * <em>Order Detail</em>}'. <!-- begin-user-doc --> This default implementation returns null so that we can easily
+ * ignore cases; it's useful to ignore a case when inheritance will catch all the cases anyway. <!-- end-user-doc -->
+ *
+ * @return the new adapter.
+ * @see org.eclipse.emf.cdo.tests.model1.OrderDetail
+ * @generated
+ */
+ public Adapter createOrderDetailAdapter()
+ {
+ return null;
+ }
+
+ /**
+ * Creates a new adapter for an object of class '{@link org.eclipse.emf.cdo.tests.model1.Product <em>Product</em>}'.
+ * <!-- begin-user-doc --> This default implementation returns null so that we can easily ignore cases; it's useful to
+ * ignore a case when inheritance will catch all the cases anyway. <!-- end-user-doc -->
+ *
+ * @return the new adapter.
+ * @see org.eclipse.emf.cdo.tests.model1.Product
+ * @generated
+ */
+ public Adapter createProductAdapter()
+ {
+ return null;
+ }
+
+ /**
+ * Creates a new adapter for an object of class '{@link org.eclipse.emf.cdo.tests.model1.OrderAddress
+ * <em>Order Address</em>}'. <!-- begin-user-doc --> This default implementation returns null so that we can easily
+ * ignore cases; it's useful to ignore a case when inheritance will catch all the cases anyway. <!-- end-user-doc -->
+ *
+ * @return the new adapter.
+ * @see org.eclipse.emf.cdo.tests.model1.OrderAddress
+ * @generated
+ */
+ public Adapter createOrderAddressAdapter()
+ {
+ return null;
+ }
+
+ /**
+ * Creates a new adapter for an object of class '{@link org.eclipse.emf.cdo.tests.model1.Category <em>Category</em>}'.
+ * <!-- begin-user-doc --> This default implementation returns null so that we can easily ignore cases; it's useful to
+ * ignore a case when inheritance will catch all the cases anyway. <!-- end-user-doc -->
+ *
+ * @return the new adapter.
+ * @see org.eclipse.emf.cdo.tests.model1.Category
+ * @generated
+ */
+ public Adapter createCategoryAdapter()
+ {
+ return null;
+ }
+
+ /**
+ * Creates a new adapter for an object of class '{@link org.eclipse.emf.cdo.tests.model1.Company <em>Company</em>}'.
+ * <!-- begin-user-doc --> This default implementation returns null so that we can easily ignore cases; it's useful to
+ * ignore a case when inheritance will catch all the cases anyway. <!-- end-user-doc -->
+ *
+ * @return the new adapter.
+ * @see org.eclipse.emf.cdo.tests.model1.Company
+ * @generated
+ */
+ public Adapter createCompanyAdapter()
+ {
+ return null;
+ }
+
+ /**
+ * Creates a new adapter for an object of class '{@link org.eclipse.emf.cdo.tests.model1.Customer <em>Customer</em>}'.
+ * <!-- begin-user-doc --> This default implementation returns null so that we can easily ignore cases; it's useful to
+ * ignore a case when inheritance will catch all the cases anyway. <!-- end-user-doc -->
+ *
+ * @return the new adapter.
+ * @see org.eclipse.emf.cdo.tests.model1.Customer
+ * @generated
+ */
+ public Adapter createCustomerAdapter()
+ {
+ return null;
+ }
+
+ /**
+ * Creates a new adapter for an object of class '{@link org.eclipse.emf.cdo.tests.model1.Order <em>Order</em>}'. <!--
+ * begin-user-doc --> This default implementation returns null so that we can easily ignore cases; it's useful to
+ * ignore a case when inheritance will catch all the cases anyway. <!-- end-user-doc -->
+ *
+ * @return the new adapter.
+ * @see org.eclipse.emf.cdo.tests.model1.Order
+ * @generated
+ */
+ public Adapter createOrderAdapter()
+ {
+ return null;
+ }
+
+ /**
+ * Creates a new adapter for an object of class '{@link org.eclipse.emf.cdo.tests.model1.SalesOrder
+ * <em>Sales Order</em>}'. <!-- begin-user-doc --> This default implementation returns null so that we can easily
+ * ignore cases; it's useful to ignore a case when inheritance will catch all the cases anyway. <!-- end-user-doc -->
+ *
+ * @return the new adapter.
+ * @see org.eclipse.emf.cdo.tests.model1.SalesOrder
+ * @generated
+ */
+ public Adapter createSalesOrderAdapter()
+ {
+ return null;
+ }
+
+ /**
+ * Creates a new adapter for the default case. <!-- begin-user-doc --> This default implementation returns null. <!--
+ * end-user-doc -->
+ *
+ * @return the new adapter.
+ * @generated
+ */
+ public Adapter createEObjectAdapter()
+ {
+ return null;
+ }
+
+} // Model1AdapterFactory
diff --git a/plugins/org.eclipse.emf.cdo.tests.model1/src/org/eclipse/emf/cdo/tests/model1/util/Model1Switch.java b/plugins/org.eclipse.emf.cdo.tests.model1/src/org/eclipse/emf/cdo/tests/model1/util/Model1Switch.java
new file mode 100644
index 0000000000..440e046010
--- /dev/null
+++ b/plugins/org.eclipse.emf.cdo.tests.model1/src/org/eclipse/emf/cdo/tests/model1/util/Model1Switch.java
@@ -0,0 +1,372 @@
+/**
+ * <copyright>
+ * </copyright>
+ *
+ * $Id$
+ */
+package org.eclipse.emf.cdo.tests.model1.util;
+
+import org.eclipse.emf.cdo.tests.model1.Address;
+import org.eclipse.emf.cdo.tests.model1.Category;
+import org.eclipse.emf.cdo.tests.model1.Company;
+import org.eclipse.emf.cdo.tests.model1.Customer;
+import org.eclipse.emf.cdo.tests.model1.Model1Package;
+import org.eclipse.emf.cdo.tests.model1.Order;
+import org.eclipse.emf.cdo.tests.model1.OrderAddress;
+import org.eclipse.emf.cdo.tests.model1.OrderDetail;
+import org.eclipse.emf.cdo.tests.model1.Product;
+import org.eclipse.emf.cdo.tests.model1.PurchaseOrder;
+import org.eclipse.emf.cdo.tests.model1.SalesOrder;
+import org.eclipse.emf.cdo.tests.model1.Supplier;
+
+import org.eclipse.emf.ecore.EClass;
+import org.eclipse.emf.ecore.EObject;
+
+import java.util.List;
+
+/**
+ * <!-- begin-user-doc --> The <b>Switch</b> for the model's inheritance hierarchy. It supports the call
+ * {@link #doSwitch(EObject) doSwitch(object)} to invoke the <code>caseXXX</code> method for each class of the model,
+ * starting with the actual class of the object and proceeding up the inheritance hierarchy until a non-null result is
+ * returned, which is the result of the switch. <!-- end-user-doc -->
+ *
+ * @see org.eclipse.emf.cdo.tests.model1.Model1Package
+ * @generated
+ */
+public class Model1Switch<T>
+{
+ /**
+ * The cached model package <!-- begin-user-doc --> <!-- end-user-doc -->
+ *
+ * @generated
+ */
+ protected static Model1Package modelPackage;
+
+ /**
+ * Creates an instance of the switch. <!-- begin-user-doc --> <!-- end-user-doc -->
+ *
+ * @generated
+ */
+ public Model1Switch()
+ {
+ if (modelPackage == null)
+ {
+ modelPackage = Model1Package.eINSTANCE;
+ }
+ }
+
+ /**
+ * Calls <code>caseXXX</code> for each class of the model until one returns a non null result; it yields that result.
+ * <!-- begin-user-doc --> <!-- end-user-doc -->
+ *
+ * @return the first non-null result returned by a <code>caseXXX</code> call.
+ * @generated
+ */
+ public T doSwitch(EObject theEObject)
+ {
+ return doSwitch(theEObject.eClass(), theEObject);
+ }
+
+ /**
+ * Calls <code>caseXXX</code> for each class of the model until one returns a non null result; it yields that result.
+ * <!-- begin-user-doc --> <!-- end-user-doc -->
+ *
+ * @return the first non-null result returned by a <code>caseXXX</code> call.
+ * @generated
+ */
+ protected T doSwitch(EClass theEClass, EObject theEObject)
+ {
+ if (theEClass.eContainer() == modelPackage)
+ {
+ return doSwitch(theEClass.getClassifierID(), theEObject);
+ }
+ else
+ {
+ List<EClass> eSuperTypes = theEClass.getESuperTypes();
+ return eSuperTypes.isEmpty() ? defaultCase(theEObject) : doSwitch(eSuperTypes.get(0), theEObject);
+ }
+ }
+
+ /**
+ * Calls <code>caseXXX</code> for each class of the model until one returns a non null result; it yields that result.
+ * <!-- begin-user-doc --> <!-- end-user-doc -->
+ *
+ * @return the first non-null result returned by a <code>caseXXX</code> call.
+ * @generated
+ */
+ protected T doSwitch(int classifierID, EObject theEObject)
+ {
+ switch (classifierID)
+ {
+ case Model1Package.ADDRESS:
+ {
+ Address address = (Address)theEObject;
+ T result = caseAddress(address);
+ if (result == null) result = defaultCase(theEObject);
+ return result;
+ }
+ case Model1Package.COMPANY:
+ {
+ Company company = (Company)theEObject;
+ T result = caseCompany(company);
+ if (result == null) result = caseAddress(company);
+ if (result == null) result = defaultCase(theEObject);
+ return result;
+ }
+ case Model1Package.SUPPLIER:
+ {
+ Supplier supplier = (Supplier)theEObject;
+ T result = caseSupplier(supplier);
+ if (result == null) result = caseAddress(supplier);
+ if (result == null) result = defaultCase(theEObject);
+ return result;
+ }
+ case Model1Package.CUSTOMER:
+ {
+ Customer customer = (Customer)theEObject;
+ T result = caseCustomer(customer);
+ if (result == null) result = caseAddress(customer);
+ if (result == null) result = defaultCase(theEObject);
+ return result;
+ }
+ case Model1Package.ORDER:
+ {
+ Order order = (Order)theEObject;
+ T result = caseOrder(order);
+ if (result == null) result = defaultCase(theEObject);
+ return result;
+ }
+ case Model1Package.ORDER_DETAIL:
+ {
+ OrderDetail orderDetail = (OrderDetail)theEObject;
+ T result = caseOrderDetail(orderDetail);
+ if (result == null) result = defaultCase(theEObject);
+ return result;
+ }
+ case Model1Package.PURCHASE_ORDER:
+ {
+ PurchaseOrder purchaseOrder = (PurchaseOrder)theEObject;
+ T result = casePurchaseOrder(purchaseOrder);
+ if (result == null) result = caseOrder(purchaseOrder);
+ if (result == null) result = defaultCase(theEObject);
+ return result;
+ }
+ case Model1Package.SALES_ORDER:
+ {
+ SalesOrder salesOrder = (SalesOrder)theEObject;
+ T result = caseSalesOrder(salesOrder);
+ if (result == null) result = caseOrder(salesOrder);
+ if (result == null) result = defaultCase(theEObject);
+ return result;
+ }
+ case Model1Package.CATEGORY:
+ {
+ Category category = (Category)theEObject;
+ T result = caseCategory(category);
+ if (result == null) result = defaultCase(theEObject);
+ return result;
+ }
+ case Model1Package.PRODUCT:
+ {
+ Product product = (Product)theEObject;
+ T result = caseProduct(product);
+ if (result == null) result = defaultCase(theEObject);
+ return result;
+ }
+ case Model1Package.ORDER_ADDRESS:
+ {
+ OrderAddress orderAddress = (OrderAddress)theEObject;
+ T result = caseOrderAddress(orderAddress);
+ if (result == null) result = caseAddress(orderAddress);
+ if (result == null) result = caseOrder(orderAddress);
+ if (result == null) result = caseOrderDetail(orderAddress);
+ if (result == null) result = defaultCase(theEObject);
+ return result;
+ }
+ default:
+ return defaultCase(theEObject);
+ }
+ }
+
+ /**
+ * Returns the result of interpreting the object as an instance of '<em>Address</em>'. <!-- begin-user-doc --> This
+ * implementation returns null; returning a non-null result will terminate the switch. <!-- end-user-doc -->
+ *
+ * @param object
+ * the target of the switch.
+ * @return the result of interpreting the object as an instance of '<em>Address</em>'.
+ * @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject)
+ * @generated
+ */
+ public T caseAddress(Address object)
+ {
+ return null;
+ }
+
+ /**
+ * Returns the result of interpreting the object as an instance of '<em>Supplier</em>'. <!-- begin-user-doc --> This
+ * implementation returns null; returning a non-null result will terminate the switch. <!-- end-user-doc -->
+ *
+ * @param object
+ * the target of the switch.
+ * @return the result of interpreting the object as an instance of '<em>Supplier</em>'.
+ * @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject)
+ * @generated
+ */
+ public T caseSupplier(Supplier object)
+ {
+ return null;
+ }
+
+ /**
+ * Returns the result of interpreting the object as an instance of '<em>Purchase Order</em>'. <!-- begin-user-doc -->
+ * This implementation returns null; returning a non-null result will terminate the switch. <!-- end-user-doc -->
+ *
+ * @param object
+ * the target of the switch.
+ * @return the result of interpreting the object as an instance of '<em>Purchase Order</em>'.
+ * @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject)
+ * @generated
+ */
+ public T casePurchaseOrder(PurchaseOrder object)
+ {
+ return null;
+ }
+
+ /**
+ * Returns the result of interpreting the object as an instance of '<em>Order Detail</em>'. <!-- begin-user-doc -->
+ * This implementation returns null; returning a non-null result will terminate the switch. <!-- end-user-doc -->
+ *
+ * @param object
+ * the target of the switch.
+ * @return the result of interpreting the object as an instance of '<em>Order Detail</em>'.
+ * @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject)
+ * @generated
+ */
+ public T caseOrderDetail(OrderDetail object)
+ {
+ return null;
+ }
+
+ /**
+ * Returns the result of interpreting the object as an instance of '<em>Product</em>'. <!-- begin-user-doc --> This
+ * implementation returns null; returning a non-null result will terminate the switch. <!-- end-user-doc -->
+ *
+ * @param object
+ * the target of the switch.
+ * @return the result of interpreting the object as an instance of '<em>Product</em>'.
+ * @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject)
+ * @generated
+ */
+ public T caseProduct(Product object)
+ {
+ return null;
+ }
+
+ /**
+ * Returns the result of interpreting the object as an instance of '<em>Order Address</em>'. <!-- begin-user-doc -->
+ * This implementation returns null; returning a non-null result will terminate the switch. <!-- end-user-doc -->
+ *
+ * @param object
+ * the target of the switch.
+ * @return the result of interpreting the object as an instance of '<em>Order Address</em>'.
+ * @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject)
+ * @generated
+ */
+ public T caseOrderAddress(OrderAddress object)
+ {
+ return null;
+ }
+
+ /**
+ * Returns the result of interpreting the object as an instance of '<em>Category</em>'. <!-- begin-user-doc --> This
+ * implementation returns null; returning a non-null result will terminate the switch. <!-- end-user-doc -->
+ *
+ * @param object
+ * the target of the switch.
+ * @return the result of interpreting the object as an instance of '<em>Category</em>'.
+ * @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject)
+ * @generated
+ */
+ public T caseCategory(Category object)
+ {
+ return null;
+ }
+
+ /**
+ * Returns the result of interpreting the object as an instance of '<em>Company</em>'. <!-- begin-user-doc --> This
+ * implementation returns null; returning a non-null result will terminate the switch. <!-- end-user-doc -->
+ *
+ * @param object
+ * the target of the switch.
+ * @return the result of interpreting the object as an instance of '<em>Company</em>'.
+ * @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject)
+ * @generated
+ */
+ public T caseCompany(Company object)
+ {
+ return null;
+ }
+
+ /**
+ * Returns the result of interpreting the object as an instance of '<em>Customer</em>'. <!-- begin-user-doc --> This
+ * implementation returns null; returning a non-null result will terminate the switch. <!-- end-user-doc -->
+ *
+ * @param object
+ * the target of the switch.
+ * @return the result of interpreting the object as an instance of '<em>Customer</em>'.
+ * @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject)
+ * @generated
+ */
+ public T caseCustomer(Customer object)
+ {
+ return null;
+ }
+
+ /**
+ * Returns the result of interpreting the object as an instance of '<em>Order</em>'. <!-- begin-user-doc --> This
+ * implementation returns null; returning a non-null result will terminate the switch. <!-- end-user-doc -->
+ *
+ * @param object
+ * the target of the switch.
+ * @return the result of interpreting the object as an instance of '<em>Order</em>'.
+ * @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject)
+ * @generated
+ */
+ public T caseOrder(Order object)
+ {
+ return null;
+ }
+
+ /**
+ * Returns the result of interpreting the object as an instance of '<em>Sales Order</em>'. <!-- begin-user-doc -->
+ * This implementation returns null; returning a non-null result will terminate the switch. <!-- end-user-doc -->
+ *
+ * @param object
+ * the target of the switch.
+ * @return the result of interpreting the object as an instance of '<em>Sales Order</em>'.
+ * @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject)
+ * @generated
+ */
+ public T caseSalesOrder(SalesOrder object)
+ {
+ return null;
+ }
+
+ /**
+ * Returns the result of interpreting the object as an instance of '<em>EObject</em>'. <!-- begin-user-doc --> This
+ * implementation returns null; returning a non-null result will terminate the switch, but this is the last case
+ * anyway. <!-- end-user-doc -->
+ *
+ * @param object
+ * the target of the switch.
+ * @return the result of interpreting the object as an instance of '<em>EObject</em>'.
+ * @see #doSwitch(org.eclipse.emf.ecore.EObject)
+ * @generated
+ */
+ public T defaultCase(EObject object)
+ {
+ return null;
+ }
+
+} // Model1Switch
diff --git a/plugins/org.eclipse.emf.cdo.tests.model1/src/org/eclipse/emf/cdo/tests/model1/validation/OrderValidator.java b/plugins/org.eclipse.emf.cdo.tests.model1/src/org/eclipse/emf/cdo/tests/model1/validation/OrderValidator.java
new file mode 100644
index 0000000000..894d386cf2
--- /dev/null
+++ b/plugins/org.eclipse.emf.cdo.tests.model1/src/org/eclipse/emf/cdo/tests/model1/validation/OrderValidator.java
@@ -0,0 +1,24 @@
+/**
+ * <copyright>
+ * </copyright>
+ *
+ * $Id$
+ */
+package org.eclipse.emf.cdo.tests.model1.validation;
+
+import org.eclipse.emf.cdo.tests.model1.OrderDetail;
+
+import org.eclipse.emf.common.util.EList;
+
+/**
+ * A sample validator interface for {@link org.eclipse.emf.cdo.tests.model1.Order}. This doesn't really do anything, and
+ * it's not a real EMF artifact. It was generated by the org.eclipse.emf.examples.generator.validator plug-in to
+ * illustrate how EMF's code generator can be extended. This can be disabled with -vmargs
+ * -Dorg.eclipse.emf.examples.generator.validator=false.
+ */
+public interface OrderValidator
+{
+ boolean validate();
+
+ boolean validateOrderDetails(EList<OrderDetail> value);
+}
diff --git a/plugins/org.eclipse.emf.cdo.tests.model2/META-INF/MANIFEST.MF b/plugins/org.eclipse.emf.cdo.tests.model2/META-INF/MANIFEST.MF
new file mode 100644
index 0000000000..441bd42478
--- /dev/null
+++ b/plugins/org.eclipse.emf.cdo.tests.model2/META-INF/MANIFEST.MF
@@ -0,0 +1,16 @@
+Manifest-Version: 1.0
+Bundle-ManifestVersion: 2
+Bundle-SymbolicName: org.eclipse.emf.cdo.tests.model2; singleton:=true
+Bundle-Version: 1.0.0.qualifier
+Bundle-Name: %pluginName
+Bundle-Vendor: %providerName
+Bundle-Localization: plugin
+Bundle-RequiredExecutionEnvironment: J2SE-1.5
+Bundle-ClassPath: .
+Require-Bundle: org.eclipse.core.runtime;bundle-version="[3.4.0,4.0.0)",
+ org.eclipse.emf.ecore;bundle-version="[2.4.0,3.0.0)";visibility:=reexport,
+ org.eclipse.emf.cdo;bundle-version="[1.0.0,2.0.0)";visibility:=reexport,
+ org.eclipse.emf.cdo.tests.model1;bundle-version="[1.0.0,2.0.0)";visibility:=reexport
+Export-Package: org.eclipse.emf.cdo.tests.model2;version="1.0.0",
+ org.eclipse.emf.cdo.tests.model2.impl;version="1.0.0",
+ org.eclipse.emf.cdo.tests.model2.util;version="1.0.0"
diff --git a/plugins/org.eclipse.emf.cdo.tests.model2/plugin.properties b/plugins/org.eclipse.emf.cdo.tests.model2/plugin.properties
new file mode 100644
index 0000000000..ac3a87da53
--- /dev/null
+++ b/plugins/org.eclipse.emf.cdo.tests.model2/plugin.properties
@@ -0,0 +1,20 @@
+
+# <copyright>
+# </copyright>
+#
+# $Id: plugin.properties,v 1.2 2008-05-27 05:44:45 estepper Exp $
+
+# ====================================================================
+# To code developer:
+# Do NOT change the properties between this line and the
+# "%%% END OF TRANSLATED PROPERTIES %%%" line.
+# Make a new property name, append to the end of the file and change
+# the code to use the new property.
+# ====================================================================
+
+# ====================================================================
+# %%% END OF TRANSLATED PROPERTIES %%%
+# ====================================================================
+
+pluginName = CDO Tests Model2
+providerName = Eclipse.org
diff --git a/plugins/org.eclipse.emf.cdo.tests.model2/src/org/eclipse/emf/cdo/tests/model2/Model2Package.java b/plugins/org.eclipse.emf.cdo.tests.model2/src/org/eclipse/emf/cdo/tests/model2/Model2Package.java
new file mode 100644
index 0000000000..a82621d8ef
--- /dev/null
+++ b/plugins/org.eclipse.emf.cdo.tests.model2/src/org/eclipse/emf/cdo/tests/model2/Model2Package.java
@@ -0,0 +1,205 @@
+/**
+ * <copyright>
+ * </copyright>
+ *
+ * $Id: Model2Package.java,v 1.4 2008-06-03 06:41:28 estepper Exp $
+ */
+package org.eclipse.emf.cdo.tests.model2;
+
+import org.eclipse.emf.cdo.tests.model1.Model1Package;
+
+import org.eclipse.emf.ecore.EAttribute;
+import org.eclipse.emf.ecore.EClass;
+import org.eclipse.emf.ecore.EPackage;
+import org.eclipse.emf.ecore.EReference;
+
+/**
+ * <!-- begin-user-doc --> The <b>Package</b> for the model. It contains accessors for the meta objects to represent
+ * <ul>
+ * <li>each class,</li>
+ * <li>each feature of each class,</li>
+ * <li>each enum,</li>
+ * <li>and each data type</li>
+ * </ul>
+ * <!-- end-user-doc -->
+ *
+ * @see org.eclipse.emf.cdo.tests.model2.Model2Factory
+ * @model kind="package"
+ * @generated
+ */
+public interface Model2Package extends EPackage
+{
+ /**
+ * The package name. <!-- begin-user-doc --> <!-- end-user-doc -->
+ *
+ * @generated
+ */
+ String eNAME = "model2";
+
+ /**
+ * The package namespace URI. <!-- begin-user-doc --> <!-- end-user-doc -->
+ *
+ * @generated
+ */
+ String eNS_URI = "http://www.eclipse.org/emf/CDO/tests/model2/1.0.0";
+
+ /**
+ * The package namespace name. <!-- begin-user-doc --> <!-- end-user-doc -->
+ *
+ * @generated
+ */
+ String eNS_PREFIX = "model2";
+
+ /**
+ * The singleton instance of the package. <!-- begin-user-doc --> <!-- end-user-doc -->
+ *
+ * @generated
+ */
+ Model2Package eINSTANCE = org.eclipse.emf.cdo.tests.model2.impl.Model2PackageImpl.init();
+
+ /**
+ * The meta object id for the '{@link org.eclipse.emf.cdo.tests.model2.impl.SpecialPurchaseOrderImpl
+ * <em>Special Purchase Order</em>}' class. <!-- begin-user-doc --> <!-- end-user-doc -->
+ *
+ * @see org.eclipse.emf.cdo.tests.model2.impl.SpecialPurchaseOrderImpl
+ * @see org.eclipse.emf.cdo.tests.model2.impl.Model2PackageImpl#getSpecialPurchaseOrder()
+ * @generated
+ */
+ int SPECIAL_PURCHASE_ORDER = 0;
+
+ /**
+ * The feature id for the '<em><b>Order Details</b></em>' containment reference list. <!-- begin-user-doc --> <!--
+ * end-user-doc -->
+ *
+ * @generated
+ * @ordered
+ */
+ int SPECIAL_PURCHASE_ORDER__ORDER_DETAILS = Model1Package.PURCHASE_ORDER__ORDER_DETAILS;
+
+ /**
+ * The feature id for the '<em><b>Date</b></em>' attribute. <!-- begin-user-doc --> <!-- end-user-doc -->
+ *
+ * @generated
+ * @ordered
+ */
+ int SPECIAL_PURCHASE_ORDER__DATE = Model1Package.PURCHASE_ORDER__DATE;
+
+ /**
+ * The feature id for the '<em><b>Supplier</b></em>' reference. <!-- begin-user-doc --> <!-- end-user-doc -->
+ *
+ * @generated
+ * @ordered
+ */
+ int SPECIAL_PURCHASE_ORDER__SUPPLIER = Model1Package.PURCHASE_ORDER__SUPPLIER;
+
+ /**
+ * The feature id for the '<em><b>Discount Code</b></em>' attribute. <!-- begin-user-doc --> <!-- end-user-doc -->
+ *
+ * @generated
+ * @ordered
+ */
+ int SPECIAL_PURCHASE_ORDER__DISCOUNT_CODE = Model1Package.PURCHASE_ORDER_FEATURE_COUNT + 0;
+
+ /**
+ * The feature id for the '<em><b>Shipping Address</b></em>' containment reference. <!-- begin-user-doc --> <!--
+ * end-user-doc -->
+ *
+ * @generated
+ * @ordered
+ */
+ int SPECIAL_PURCHASE_ORDER__SHIPPING_ADDRESS = Model1Package.PURCHASE_ORDER_FEATURE_COUNT + 1;
+
+ /**
+ * The number of structural features of the '<em>Special Purchase Order</em>' class. <!-- begin-user-doc --> <!--
+ * end-user-doc -->
+ *
+ * @generated
+ * @ordered
+ */
+ int SPECIAL_PURCHASE_ORDER_FEATURE_COUNT = Model1Package.PURCHASE_ORDER_FEATURE_COUNT + 2;
+
+ /**
+ * Returns the meta object for class '{@link org.eclipse.emf.cdo.tests.model2.SpecialPurchaseOrder
+ * <em>Special Purchase Order</em>}'. <!-- begin-user-doc --> <!-- end-user-doc -->
+ *
+ * @return the meta object for class '<em>Special Purchase Order</em>'.
+ * @see org.eclipse.emf.cdo.tests.model2.SpecialPurchaseOrder
+ * @generated
+ */
+ EClass getSpecialPurchaseOrder();
+
+ /**
+ * Returns the meta object for the attribute '
+ * {@link org.eclipse.emf.cdo.tests.model2.SpecialPurchaseOrder#getDiscountCode <em>Discount Code</em>}'. <!--
+ * begin-user-doc --> <!-- end-user-doc -->
+ *
+ * @return the meta object for the attribute '<em>Discount Code</em>'.
+ * @see org.eclipse.emf.cdo.tests.model2.SpecialPurchaseOrder#getDiscountCode()
+ * @see #getSpecialPurchaseOrder()
+ * @generated
+ */
+ EAttribute getSpecialPurchaseOrder_DiscountCode();
+
+ /**
+ * Returns the meta object for the containment reference '
+ * {@link org.eclipse.emf.cdo.tests.model2.SpecialPurchaseOrder#getShippingAddress <em>Shipping Address</em>}'. <!--
+ * begin-user-doc --> <!-- end-user-doc -->
+ *
+ * @return the meta object for the containment reference '<em>Shipping Address</em>'.
+ * @see org.eclipse.emf.cdo.tests.model2.SpecialPurchaseOrder#getShippingAddress()
+ * @see #getSpecialPurchaseOrder()
+ * @generated
+ */
+ EReference getSpecialPurchaseOrder_ShippingAddress();
+
+ /**
+ * Returns the factory that creates the instances of the model. <!-- begin-user-doc --> <!-- end-user-doc -->
+ *
+ * @return the factory that creates the instances of the model.
+ * @generated
+ */
+ Model2Factory getModel2Factory();
+
+ /**
+ * <!-- begin-user-doc --> Defines literals for the meta objects that represent
+ * <ul>
+ * <li>each class,</li>
+ * <li>each feature of each class,</li>
+ * <li>each enum,</li>
+ * <li>and each data type</li>
+ * </ul>
+ * <!-- end-user-doc -->
+ *
+ * @generated
+ */
+ interface Literals
+ {
+ /**
+ * The meta object literal for the '{@link org.eclipse.emf.cdo.tests.model2.impl.SpecialPurchaseOrderImpl
+ * <em>Special Purchase Order</em>}' class. <!-- begin-user-doc --> <!-- end-user-doc -->
+ *
+ * @see org.eclipse.emf.cdo.tests.model2.impl.SpecialPurchaseOrderImpl
+ * @see org.eclipse.emf.cdo.tests.model2.impl.Model2PackageImpl#getSpecialPurchaseOrder()
+ * @generated
+ */
+ EClass SPECIAL_PURCHASE_ORDER = eINSTANCE.getSpecialPurchaseOrder();
+
+ /**
+ * The meta object literal for the '<em><b>Discount Code</b></em>' attribute feature. <!-- begin-user-doc --> <!--
+ * end-user-doc -->
+ *
+ * @generated
+ */
+ EAttribute SPECIAL_PURCHASE_ORDER__DISCOUNT_CODE = eINSTANCE.getSpecialPurchaseOrder_DiscountCode();
+
+ /**
+ * The meta object literal for the '<em><b>Shipping Address</b></em>' containment reference feature. <!--
+ * begin-user-doc --> <!-- end-user-doc -->
+ *
+ * @generated
+ */
+ EReference SPECIAL_PURCHASE_ORDER__SHIPPING_ADDRESS = eINSTANCE.getSpecialPurchaseOrder_ShippingAddress();
+
+ }
+
+} // Model2Package
diff --git a/plugins/org.eclipse.emf.cdo.tests.model2/src/org/eclipse/emf/cdo/tests/model2/SpecialPurchaseOrder.java b/plugins/org.eclipse.emf.cdo.tests.model2/src/org/eclipse/emf/cdo/tests/model2/SpecialPurchaseOrder.java
new file mode 100644
index 0000000000..f340527135
--- /dev/null
+++ b/plugins/org.eclipse.emf.cdo.tests.model2/src/org/eclipse/emf/cdo/tests/model2/SpecialPurchaseOrder.java
@@ -0,0 +1,83 @@
+/**
+ * <copyright>
+ * </copyright>
+ *
+ * $Id: SpecialPurchaseOrder.java,v 1.4 2008-06-03 06:41:28 estepper Exp $
+ */
+package org.eclipse.emf.cdo.tests.model2;
+
+import org.eclipse.emf.cdo.tests.model1.Address;
+import org.eclipse.emf.cdo.tests.model1.PurchaseOrder;
+
+/**
+ * <!-- begin-user-doc --> A representation of the model object '<em><b>Special Purchase Order</b></em>'. <!--
+ * end-user-doc -->
+ * <p>
+ * The following features are supported:
+ * <ul>
+ * <li>{@link org.eclipse.emf.cdo.tests.model2.SpecialPurchaseOrder#getDiscountCode <em>Discount Code</em>}</li>
+ * <li>{@link org.eclipse.emf.cdo.tests.model2.SpecialPurchaseOrder#getShippingAddress <em>Shipping Address</em>}</li>
+ * </ul>
+ * </p>
+ *
+ * @see org.eclipse.emf.cdo.tests.model2.Model2Package#getSpecialPurchaseOrder()
+ * @model
+ * @generated
+ */
+public interface SpecialPurchaseOrder extends PurchaseOrder
+{
+ /**
+ * Returns the value of the '<em><b>Discount Code</b></em>' attribute. <!-- begin-user-doc -->
+ * <p>
+ * If the meaning of the '<em>Discount Code</em>' attribute isn't clear, there really should be more of a description
+ * here...
+ * </p>
+ * <!-- end-user-doc -->
+ *
+ * @return the value of the '<em>Discount Code</em>' attribute.
+ * @see #setDiscountCode(String)
+ * @see org.eclipse.emf.cdo.tests.model2.Model2Package#getSpecialPurchaseOrder_DiscountCode()
+ * @model
+ * @generated
+ */
+ String getDiscountCode();
+
+ /**
+ * Sets the value of the '{@link org.eclipse.emf.cdo.tests.model2.SpecialPurchaseOrder#getDiscountCode
+ * <em>Discount Code</em>}' attribute. <!-- begin-user-doc --> <!-- end-user-doc -->
+ *
+ * @param value
+ * the new value of the '<em>Discount Code</em>' attribute.
+ * @see #getDiscountCode()
+ * @generated
+ */
+ void setDiscountCode(String value);
+
+ /**
+ * Returns the value of the '<em><b>Shipping Address</b></em>' containment reference. <!-- begin-user-doc -->
+ * <p>
+ * If the meaning of the '<em>Shipping Address</em>' containment reference isn't clear, there really should be more of
+ * a description here...
+ * </p>
+ * <!-- end-user-doc -->
+ *
+ * @return the value of the '<em>Shipping Address</em>' containment reference.
+ * @see #setShippingAddress(Address)
+ * @see org.eclipse.emf.cdo.tests.model2.Model2Package#getSpecialPurchaseOrder_ShippingAddress()
+ * @model containment="true"
+ * @generated
+ */
+ Address getShippingAddress();
+
+ /**
+ * Sets the value of the '{@link org.eclipse.emf.cdo.tests.model2.SpecialPurchaseOrder#getShippingAddress
+ * <em>Shipping Address</em>}' containment reference. <!-- begin-user-doc --> <!-- end-user-doc -->
+ *
+ * @param value
+ * the new value of the '<em>Shipping Address</em>' containment reference.
+ * @see #getShippingAddress()
+ * @generated
+ */
+ void setShippingAddress(Address value);
+
+} // SpecialPurchaseOrder
diff --git a/plugins/org.eclipse.emf.cdo.tests.model2/src/org/eclipse/emf/cdo/tests/model2/impl/Model2PackageImpl.java b/plugins/org.eclipse.emf.cdo.tests.model2/src/org/eclipse/emf/cdo/tests/model2/impl/Model2PackageImpl.java
new file mode 100644
index 0000000000..a915fbcfa9
--- /dev/null
+++ b/plugins/org.eclipse.emf.cdo.tests.model2/src/org/eclipse/emf/cdo/tests/model2/impl/Model2PackageImpl.java
@@ -0,0 +1,214 @@
+/**
+ * <copyright>
+ * </copyright>
+ *
+ * $Id: Model2PackageImpl.java,v 1.4 2008-06-03 06:41:28 estepper Exp $
+ */
+package org.eclipse.emf.cdo.tests.model2.impl;
+
+import org.eclipse.emf.cdo.tests.model1.Model1Package;
+import org.eclipse.emf.cdo.tests.model2.Model2Factory;
+import org.eclipse.emf.cdo.tests.model2.Model2Package;
+import org.eclipse.emf.cdo.tests.model2.SpecialPurchaseOrder;
+
+import org.eclipse.emf.ecore.EAttribute;
+import org.eclipse.emf.ecore.EClass;
+import org.eclipse.emf.ecore.EPackage;
+import org.eclipse.emf.ecore.EReference;
+import org.eclipse.emf.ecore.impl.EPackageImpl;
+
+/**
+ * <!-- begin-user-doc --> An implementation of the model <b>Package</b>. <!-- end-user-doc -->
+ *
+ * @generated
+ */
+public class Model2PackageImpl extends EPackageImpl implements Model2Package
+{
+ /**
+ * <!-- begin-user-doc --> <!-- end-user-doc -->
+ *
+ * @generated
+ */
+ private EClass specialPurchaseOrderEClass = null;
+
+ /**
+ * Creates an instance of the model <b>Package</b>, registered with {@link org.eclipse.emf.ecore.EPackage.Registry
+ * EPackage.Registry} by the package package URI value.
+ * <p>
+ * Note: the correct way to create the package is via the static factory method {@link #init init()}, which also
+ * performs initialization of the package, or returns the registered package, if one already exists. <!--
+ * begin-user-doc --> <!-- end-user-doc -->
+ *
+ * @see org.eclipse.emf.ecore.EPackage.Registry
+ * @see org.eclipse.emf.cdo.tests.model2.Model2Package#eNS_URI
+ * @see #init()
+ * @generated
+ */
+ private Model2PackageImpl()
+ {
+ super(eNS_URI, Model2Factory.eINSTANCE);
+ }
+
+ /**
+ * <!-- begin-user-doc --> <!-- end-user-doc -->
+ *
+ * @generated
+ */
+ private static boolean isInited = false;
+
+ /**
+ * Creates, registers, and initializes the <b>Package</b> for this model, and for any others upon which it depends.
+ * Simple dependencies are satisfied by calling this method on all dependent packages before doing anything else. This
+ * method drives initialization for interdependent packages directly, in parallel with this package, itself.
+ * <p>
+ * Of this package and its interdependencies, all packages which have not yet been registered by their URI values are
+ * first created and registered. The packages are then initialized in two steps: meta-model objects for all of the
+ * packages are created before any are initialized, since one package's meta-model objects may refer to those of
+ * another.
+ * <p>
+ * Invocation of this method will not affect any packages that have already been initialized. <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ *
+ * @see #eNS_URI
+ * @see #createPackageContents()
+ * @see #initializePackageContents()
+ * @generated
+ */
+ public static Model2Package init()
+ {
+ if (isInited) return (Model2Package)EPackage.Registry.INSTANCE.getEPackage(Model2Package.eNS_URI);
+
+ // Obtain or create and register package
+ Model2PackageImpl theModel2Package = (Model2PackageImpl)(EPackage.Registry.INSTANCE.getEPackage(eNS_URI) instanceof Model2PackageImpl ? EPackage.Registry.INSTANCE
+ .getEPackage(eNS_URI)
+ : new Model2PackageImpl());
+
+ isInited = true;
+
+ // Initialize simple dependencies
+ Model1Package.eINSTANCE.eClass();
+
+ // Create package meta-data objects
+ theModel2Package.createPackageContents();
+
+ // Initialize created meta-data
+ theModel2Package.initializePackageContents();
+
+ // Mark meta-data to indicate it can't be changed
+ theModel2Package.freeze();
+
+ return theModel2Package;
+ }
+
+ /**
+ * <!-- begin-user-doc --> <!-- end-user-doc -->
+ *
+ * @generated
+ */
+ public EClass getSpecialPurchaseOrder()
+ {
+ return specialPurchaseOrderEClass;
+ }
+
+ /**
+ * <!-- begin-user-doc --> <!-- end-user-doc -->
+ *
+ * @generated
+ */
+ public EAttribute getSpecialPurchaseOrder_DiscountCode()
+ {
+ return (EAttribute)specialPurchaseOrderEClass.getEStructuralFeatures().get(0);
+ }
+
+ /**
+ * <!-- begin-user-doc --> <!-- end-user-doc -->
+ *
+ * @generated
+ */
+ public EReference getSpecialPurchaseOrder_ShippingAddress()
+ {
+ return (EReference)specialPurchaseOrderEClass.getEStructuralFeatures().get(1);
+ }
+
+ /**
+ * <!-- begin-user-doc --> <!-- end-user-doc -->
+ *
+ * @generated
+ */
+ public Model2Factory getModel2Factory()
+ {
+ return (Model2Factory)getEFactoryInstance();
+ }
+
+ /**
+ * <!-- begin-user-doc --> <!-- end-user-doc -->
+ *
+ * @generated
+ */
+ private boolean isCreated = false;
+
+ /**
+ * Creates the meta-model objects for the package. This method is guarded to have no affect on any invocation but its
+ * first. <!-- begin-user-doc --> <!-- end-user-doc -->
+ *
+ * @generated
+ */
+ public void createPackageContents()
+ {
+ if (isCreated) return;
+ isCreated = true;
+
+ // Create classes and their features
+ specialPurchaseOrderEClass = createEClass(SPECIAL_PURCHASE_ORDER);
+ createEAttribute(specialPurchaseOrderEClass, SPECIAL_PURCHASE_ORDER__DISCOUNT_CODE);
+ createEReference(specialPurchaseOrderEClass, SPECIAL_PURCHASE_ORDER__SHIPPING_ADDRESS);
+ }
+
+ /**
+ * <!-- begin-user-doc --> <!-- end-user-doc -->
+ *
+ * @generated
+ */
+ private boolean isInitialized = false;
+
+ /**
+ * Complete the initialization of the package and its meta-model. This method is guarded to have no affect on any
+ * invocation but its first. <!-- begin-user-doc --> <!-- end-user-doc -->
+ *
+ * @generated
+ */
+ public void initializePackageContents()
+ {
+ if (isInitialized) return;
+ isInitialized = true;
+
+ // Initialize package
+ setName(eNAME);
+ setNsPrefix(eNS_PREFIX);
+ setNsURI(eNS_URI);
+
+ // Obtain other dependent packages
+ Model1Package theModel1Package = (Model1Package)EPackage.Registry.INSTANCE.getEPackage(Model1Package.eNS_URI);
+
+ // Create type parameters
+
+ // Set bounds for type parameters
+
+ // Add supertypes to classes
+ specialPurchaseOrderEClass.getESuperTypes().add(theModel1Package.getPurchaseOrder());
+
+ // Initialize classes and features; add operations and parameters
+ initEClass(specialPurchaseOrderEClass, SpecialPurchaseOrder.class, "SpecialPurchaseOrder", !IS_ABSTRACT,
+ !IS_INTERFACE, IS_GENERATED_INSTANCE_CLASS);
+ initEAttribute(getSpecialPurchaseOrder_DiscountCode(), ecorePackage.getEString(), "discountCode", null, 0, 1,
+ SpecialPurchaseOrder.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, !IS_UNSETTABLE, !IS_ID, IS_UNIQUE,
+ !IS_DERIVED, IS_ORDERED);
+ initEReference(getSpecialPurchaseOrder_ShippingAddress(), theModel1Package.getAddress(), null, "shippingAddress",
+ null, 0, 1, SpecialPurchaseOrder.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, IS_COMPOSITE,
+ !IS_RESOLVE_PROXIES, !IS_UNSETTABLE, IS_UNIQUE, !IS_DERIVED, IS_ORDERED);
+
+ // Create resource
+ createResource(eNS_URI);
+ }
+
+} // Model2PackageImpl
diff --git a/plugins/org.eclipse.emf.cdo.tests.model2/src/org/eclipse/emf/cdo/tests/model2/impl/SpecialPurchaseOrderImpl.java b/plugins/org.eclipse.emf.cdo.tests.model2/src/org/eclipse/emf/cdo/tests/model2/impl/SpecialPurchaseOrderImpl.java
new file mode 100644
index 0000000000..4f1c0d6a87
--- /dev/null
+++ b/plugins/org.eclipse.emf.cdo.tests.model2/src/org/eclipse/emf/cdo/tests/model2/impl/SpecialPurchaseOrderImpl.java
@@ -0,0 +1,93 @@
+/**
+ * <copyright>
+ * </copyright>
+ *
+ * $Id: SpecialPurchaseOrderImpl.java,v 1.4 2008-06-03 06:41:28 estepper Exp $
+ */
+package org.eclipse.emf.cdo.tests.model2.impl;
+
+import org.eclipse.emf.cdo.tests.model1.Address;
+import org.eclipse.emf.cdo.tests.model1.impl.PurchaseOrderImpl;
+import org.eclipse.emf.cdo.tests.model2.Model2Package;
+import org.eclipse.emf.cdo.tests.model2.SpecialPurchaseOrder;
+
+import org.eclipse.emf.ecore.EClass;
+
+/**
+ * <!-- begin-user-doc --> An implementation of the model object '<em><b>Special Purchase Order</b></em>'. <!--
+ * end-user-doc -->
+ * <p>
+ * The following features are implemented:
+ * <ul>
+ * <li>{@link org.eclipse.emf.cdo.tests.model2.impl.SpecialPurchaseOrderImpl#getDiscountCode <em>Discount Code</em>}</li>
+ * <li>{@link org.eclipse.emf.cdo.tests.model2.impl.SpecialPurchaseOrderImpl#getShippingAddress <em>Shipping Address
+ * </em>}</li>
+ * </ul>
+ * </p>
+ *
+ * @generated
+ */
+public class SpecialPurchaseOrderImpl extends PurchaseOrderImpl implements SpecialPurchaseOrder
+{
+ /**
+ * <!-- begin-user-doc --> <!-- end-user-doc -->
+ *
+ * @generated
+ */
+ protected SpecialPurchaseOrderImpl()
+ {
+ super();
+ }
+
+ /**
+ * <!-- begin-user-doc --> <!-- end-user-doc -->
+ *
+ * @generated
+ */
+ @Override
+ protected EClass eStaticClass()
+ {
+ return Model2Package.Literals.SPECIAL_PURCHASE_ORDER;
+ }
+
+ /**
+ * <!-- begin-user-doc --> <!-- end-user-doc -->
+ *
+ * @generated
+ */
+ public String getDiscountCode()
+ {
+ return (String)eGet(Model2Package.Literals.SPECIAL_PURCHASE_ORDER__DISCOUNT_CODE, true);
+ }
+
+ /**
+ * <!-- begin-user-doc --> <!-- end-user-doc -->
+ *
+ * @generated
+ */
+ public void setDiscountCode(String newDiscountCode)
+ {
+ eSet(Model2Package.Literals.SPECIAL_PURCHASE_ORDER__DISCOUNT_CODE, newDiscountCode);
+ }
+
+ /**
+ * <!-- begin-user-doc --> <!-- end-user-doc -->
+ *
+ * @generated
+ */
+ public Address getShippingAddress()
+ {
+ return (Address)eGet(Model2Package.Literals.SPECIAL_PURCHASE_ORDER__SHIPPING_ADDRESS, true);
+ }
+
+ /**
+ * <!-- begin-user-doc --> <!-- end-user-doc -->
+ *
+ * @generated
+ */
+ public void setShippingAddress(Address newShippingAddress)
+ {
+ eSet(Model2Package.Literals.SPECIAL_PURCHASE_ORDER__SHIPPING_ADDRESS, newShippingAddress);
+ }
+
+} // SpecialPurchaseOrderImpl
diff --git a/plugins/org.eclipse.emf.cdo.tests.model2/src/org/eclipse/emf/cdo/tests/model2/util/Model2AdapterFactory.java b/plugins/org.eclipse.emf.cdo.tests.model2/src/org/eclipse/emf/cdo/tests/model2/util/Model2AdapterFactory.java
new file mode 100644
index 0000000000..871f90141f
--- /dev/null
+++ b/plugins/org.eclipse.emf.cdo.tests.model2/src/org/eclipse/emf/cdo/tests/model2/util/Model2AdapterFactory.java
@@ -0,0 +1,171 @@
+/**
+ * <copyright>
+ * </copyright>
+ *
+ * $Id: Model2AdapterFactory.java,v 1.3 2008-06-03 06:41:28 estepper Exp $
+ */
+package org.eclipse.emf.cdo.tests.model2.util;
+
+import org.eclipse.emf.cdo.tests.model1.Order;
+import org.eclipse.emf.cdo.tests.model1.PurchaseOrder;
+import org.eclipse.emf.cdo.tests.model2.Model2Package;
+import org.eclipse.emf.cdo.tests.model2.SpecialPurchaseOrder;
+
+import org.eclipse.emf.common.notify.Adapter;
+import org.eclipse.emf.common.notify.Notifier;
+import org.eclipse.emf.common.notify.impl.AdapterFactoryImpl;
+import org.eclipse.emf.ecore.EObject;
+
+/**
+ * <!-- begin-user-doc --> The <b>Adapter Factory</b> for the model. It provides an adapter <code>createXXX</code>
+ * method for each class of the model. <!-- end-user-doc -->
+ *
+ * @see org.eclipse.emf.cdo.tests.model2.Model2Package
+ * @generated
+ */
+public class Model2AdapterFactory extends AdapterFactoryImpl
+{
+ /**
+ * The cached model package. <!-- begin-user-doc --> <!-- end-user-doc -->
+ *
+ * @generated
+ */
+ protected static Model2Package modelPackage;
+
+ /**
+ * Creates an instance of the adapter factory. <!-- begin-user-doc --> <!-- end-user-doc -->
+ *
+ * @generated
+ */
+ public Model2AdapterFactory()
+ {
+ if (modelPackage == null)
+ {
+ modelPackage = Model2Package.eINSTANCE;
+ }
+ }
+
+ /**
+ * Returns whether this factory is applicable for the type of the object. <!-- begin-user-doc --> This implementation
+ * returns <code>true</code> if the object is either the model's package or is an instance object of the model. <!--
+ * end-user-doc -->
+ *
+ * @return whether this factory is applicable for the type of the object.
+ * @generated
+ */
+ @Override
+ public boolean isFactoryForType(Object object)
+ {
+ if (object == modelPackage)
+ {
+ return true;
+ }
+ if (object instanceof EObject)
+ {
+ return ((EObject)object).eClass().getEPackage() == modelPackage;
+ }
+ return false;
+ }
+
+ /**
+ * The switch that delegates to the <code>createXXX</code> methods. <!-- begin-user-doc --> <!-- end-user-doc -->
+ *
+ * @generated
+ */
+ protected Model2Switch<Adapter> modelSwitch = new Model2Switch<Adapter>()
+ {
+ @Override
+ public Adapter caseSpecialPurchaseOrder(SpecialPurchaseOrder object)
+ {
+ return createSpecialPurchaseOrderAdapter();
+ }
+
+ @Override
+ public Adapter caseOrder(Order object)
+ {
+ return createOrderAdapter();
+ }
+
+ @Override
+ public Adapter casePurchaseOrder(PurchaseOrder object)
+ {
+ return createPurchaseOrderAdapter();
+ }
+
+ @Override
+ public Adapter defaultCase(EObject object)
+ {
+ return createEObjectAdapter();
+ }
+ };
+
+ /**
+ * Creates an adapter for the <code>target</code>. <!-- begin-user-doc --> <!-- end-user-doc -->
+ *
+ * @param target
+ * the object to adapt.
+ * @return the adapter for the <code>target</code>.
+ * @generated
+ */
+ @Override
+ public Adapter createAdapter(Notifier target)
+ {
+ return modelSwitch.doSwitch((EObject)target);
+ }
+
+ /**
+ * Creates a new adapter for an object of class '{@link org.eclipse.emf.cdo.tests.model2.SpecialPurchaseOrder
+ * <em>Special Purchase Order</em>}'. <!-- begin-user-doc --> This default implementation returns null so that we can
+ * easily ignore cases; it's useful to ignore a case when inheritance will catch all the cases anyway. <!--
+ * end-user-doc -->
+ *
+ * @return the new adapter.
+ * @see org.eclipse.emf.cdo.tests.model2.SpecialPurchaseOrder
+ * @generated
+ */
+ public Adapter createSpecialPurchaseOrderAdapter()
+ {
+ return null;
+ }
+
+ /**
+ * Creates a new adapter for an object of class '{@link org.eclipse.emf.cdo.tests.model1.Order <em>Order</em>}'. <!--
+ * begin-user-doc --> This default implementation returns null so that we can easily ignore cases; it's useful to
+ * ignore a case when inheritance will catch all the cases anyway. <!-- end-user-doc -->
+ *
+ * @return the new adapter.
+ * @see org.eclipse.emf.cdo.tests.model1.Order
+ * @generated
+ */
+ public Adapter createOrderAdapter()
+ {
+ return null;
+ }
+
+ /**
+ * Creates a new adapter for an object of class '{@link org.eclipse.emf.cdo.tests.model1.PurchaseOrder
+ * <em>Purchase Order</em>}'. <!-- begin-user-doc --> This default implementation returns null so that we can easily
+ * ignore cases; it's useful to ignore a case when inheritance will catch all the cases anyway. <!-- end-user-doc -->
+ *
+ * @return the new adapter.
+ * @see org.eclipse.emf.cdo.tests.model1.PurchaseOrder
+ * @generated
+ */
+ public Adapter createPurchaseOrderAdapter()
+ {
+ return null;
+ }
+
+ /**
+ * Creates a new adapter for the default case. <!-- begin-user-doc --> This default implementation returns null. <!--
+ * end-user-doc -->
+ *
+ * @return the new adapter.
+ * @generated
+ */
+ public Adapter createEObjectAdapter()
+ {
+ return null;
+ }
+
+} // Model2AdapterFactory
diff --git a/plugins/org.eclipse.emf.cdo.tests.model2/src/org/eclipse/emf/cdo/tests/model2/util/Model2Switch.java b/plugins/org.eclipse.emf.cdo.tests.model2/src/org/eclipse/emf/cdo/tests/model2/util/Model2Switch.java
new file mode 100644
index 0000000000..5b6849f11e
--- /dev/null
+++ b/plugins/org.eclipse.emf.cdo.tests.model2/src/org/eclipse/emf/cdo/tests/model2/util/Model2Switch.java
@@ -0,0 +1,169 @@
+/**
+ * <copyright>
+ * </copyright>
+ *
+ * $Id: Model2Switch.java,v 1.3 2008-06-03 06:41:28 estepper Exp $
+ */
+package org.eclipse.emf.cdo.tests.model2.util;
+
+import org.eclipse.emf.cdo.tests.model1.Order;
+import org.eclipse.emf.cdo.tests.model1.PurchaseOrder;
+import org.eclipse.emf.cdo.tests.model2.Model2Package;
+import org.eclipse.emf.cdo.tests.model2.SpecialPurchaseOrder;
+
+import org.eclipse.emf.ecore.EClass;
+import org.eclipse.emf.ecore.EObject;
+
+import java.util.List;
+
+/**
+ * <!-- begin-user-doc --> The <b>Switch</b> for the model's inheritance hierarchy. It supports the call
+ * {@link #doSwitch(EObject) doSwitch(object)} to invoke the <code>caseXXX</code> method for each class of the model,
+ * starting with the actual class of the object and proceeding up the inheritance hierarchy until a non-null result is
+ * returned, which is the result of the switch. <!-- end-user-doc -->
+ *
+ * @see org.eclipse.emf.cdo.tests.model2.Model2Package
+ * @generated
+ */
+public class Model2Switch<T>
+{
+ /**
+ * The cached model package <!-- begin-user-doc --> <!-- end-user-doc -->
+ *
+ * @generated
+ */
+ protected static Model2Package modelPackage;
+
+ /**
+ * Creates an instance of the switch. <!-- begin-user-doc --> <!-- end-user-doc -->
+ *
+ * @generated
+ */
+ public Model2Switch()
+ {
+ if (modelPackage == null)
+ {
+ modelPackage = Model2Package.eINSTANCE;
+ }
+ }
+
+ /**
+ * Calls <code>caseXXX</code> for each class of the model until one returns a non null result; it yields that result.
+ * <!-- begin-user-doc --> <!-- end-user-doc -->
+ *
+ * @return the first non-null result returned by a <code>caseXXX</code> call.
+ * @generated
+ */
+ public T doSwitch(EObject theEObject)
+ {
+ return doSwitch(theEObject.eClass(), theEObject);
+ }
+
+ /**
+ * Calls <code>caseXXX</code> for each class of the model until one returns a non null result; it yields that result.
+ * <!-- begin-user-doc --> <!-- end-user-doc -->
+ *
+ * @return the first non-null result returned by a <code>caseXXX</code> call.
+ * @generated
+ */
+ protected T doSwitch(EClass theEClass, EObject theEObject)
+ {
+ if (theEClass.eContainer() == modelPackage)
+ {
+ return doSwitch(theEClass.getClassifierID(), theEObject);
+ }
+ else
+ {
+ List<EClass> eSuperTypes = theEClass.getESuperTypes();
+ return eSuperTypes.isEmpty() ? defaultCase(theEObject) : doSwitch(eSuperTypes.get(0), theEObject);
+ }
+ }
+
+ /**
+ * Calls <code>caseXXX</code> for each class of the model until one returns a non null result; it yields that result.
+ * <!-- begin-user-doc --> <!-- end-user-doc -->
+ *
+ * @return the first non-null result returned by a <code>caseXXX</code> call.
+ * @generated
+ */
+ protected T doSwitch(int classifierID, EObject theEObject)
+ {
+ switch (classifierID)
+ {
+ case Model2Package.SPECIAL_PURCHASE_ORDER:
+ {
+ SpecialPurchaseOrder specialPurchaseOrder = (SpecialPurchaseOrder)theEObject;
+ T result = caseSpecialPurchaseOrder(specialPurchaseOrder);
+ if (result == null) result = casePurchaseOrder(specialPurchaseOrder);
+ if (result == null) result = caseOrder(specialPurchaseOrder);
+ if (result == null) result = defaultCase(theEObject);
+ return result;
+ }
+ default:
+ return defaultCase(theEObject);
+ }
+ }
+
+ /**
+ * Returns the result of interpreting the object as an instance of '<em>Special Purchase Order</em>'. <!--
+ * begin-user-doc --> This implementation returns null; returning a non-null result will terminate the switch. <!--
+ * end-user-doc -->
+ *
+ * @param object
+ * the target of the switch.
+ * @return the result of interpreting the object as an instance of '<em>Special Purchase Order</em>'.
+ * @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject)
+ * @generated
+ */
+ public T caseSpecialPurchaseOrder(SpecialPurchaseOrder object)
+ {
+ return null;
+ }
+
+ /**
+ * Returns the result of interpreting the object as an instance of '<em>Order</em>'. <!-- begin-user-doc --> This
+ * implementation returns null; returning a non-null result will terminate the switch. <!-- end-user-doc -->
+ *
+ * @param object
+ * the target of the switch.
+ * @return the result of interpreting the object as an instance of '<em>Order</em>'.
+ * @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject)
+ * @generated
+ */
+ public T caseOrder(Order object)
+ {
+ return null;
+ }
+
+ /**
+ * Returns the result of interpreting the object as an instance of '<em>Purchase Order</em>'. <!-- begin-user-doc -->
+ * This implementation returns null; returning a non-null result will terminate the switch. <!-- end-user-doc -->
+ *
+ * @param object
+ * the target of the switch.
+ * @return the result of interpreting the object as an instance of '<em>Purchase Order</em>'.
+ * @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject)
+ * @generated
+ */
+ public T casePurchaseOrder(PurchaseOrder object)
+ {
+ return null;
+ }
+
+ /**
+ * Returns the result of interpreting the object as an instance of '<em>EObject</em>'. <!-- begin-user-doc --> This
+ * implementation returns null; returning a non-null result will terminate the switch, but this is the last case
+ * anyway. <!-- end-user-doc -->
+ *
+ * @param object
+ * the target of the switch.
+ * @return the result of interpreting the object as an instance of '<em>EObject</em>'.
+ * @see #doSwitch(org.eclipse.emf.ecore.EObject)
+ * @generated
+ */
+ public T defaultCase(EObject object)
+ {
+ return null;
+ }
+
+} // Model2Switch
diff --git a/plugins/org.eclipse.emf.cdo.tests.model3/META-INF/MANIFEST.MF b/plugins/org.eclipse.emf.cdo.tests.model3/META-INF/MANIFEST.MF
new file mode 100644
index 0000000000..5501ef67a5
--- /dev/null
+++ b/plugins/org.eclipse.emf.cdo.tests.model3/META-INF/MANIFEST.MF
@@ -0,0 +1,19 @@
+Manifest-Version: 1.0
+Bundle-ManifestVersion: 2
+Bundle-Name: %pluginName
+Bundle-SymbolicName: org.eclipse.emf.cdo.tests.model3; singleton:=true
+Bundle-Version: 1.0.0.qualifier
+Bundle-ClassPath: .
+Bundle-Vendor: %providerName
+Bundle-Localization: plugin
+Bundle-RequiredExecutionEnvironment: J2SE-1.5
+Export-Package: org.eclipse.emf.cdo.tests.model3;version="1.0.0",
+ org.eclipse.emf.cdo.tests.model3.impl;version="1.0.0",
+ org.eclipse.emf.cdo.tests.model3.subpackage;version="1.0.0",
+ org.eclipse.emf.cdo.tests.model3.subpackage.impl;version="1.0.0",
+ org.eclipse.emf.cdo.tests.model3.subpackage.util;version="1.0.0",
+ org.eclipse.emf.cdo.tests.model3.util;version="1.0.0"
+Require-Bundle: org.eclipse.core.runtime;bundle-version="[3.4.0,4.0.0)",
+ org.eclipse.emf.ecore;bundle-version="[2.4.0,3.0.0)";visibility:=reexport,
+ org.eclipse.emf.cdo;bundle-version="[1.0.0,2.0.0)";visibility:=reexport
+Bundle-ActivationPolicy: lazy
diff --git a/plugins/org.eclipse.emf.cdo.tests.model3/plugin.properties b/plugins/org.eclipse.emf.cdo.tests.model3/plugin.properties
new file mode 100644
index 0000000000..91a4ccda63
--- /dev/null
+++ b/plugins/org.eclipse.emf.cdo.tests.model3/plugin.properties
@@ -0,0 +1,25 @@
+# Copyright (c) 2004 - 2008 Eike Stepper, Germany.
+# All rights reserved. This program and the accompanying materials
+# are made available under the terms of the Eclipse Public License v1.0
+# which accompanies this distribution, and is available at
+# http://www.eclipse.org/legal/epl-v10.html
+#
+# Contributors:
+# Eike Stepper - initial API and implementation
+
+# NLS_MESSAGEFORMAT_VAR
+
+# ==============================================================================
+# Do not change the properties between this line and the last line containing:
+# %%% END OF TRANSLATED PROPERTIES %%%
+# Instead, either redefine an existing property, or create a new property,
+# append it to the end of the file, and change the code to use the new name.
+# ==============================================================================
+
+pluginName = CDO Tests Model3
+providerName = Eclipse.org
+
+# ==============================================================================
+# %%% END OF TRANSLATED PROPERTIES %%%
+# The above properties have been shipped for translation.
+# ==============================================================================
diff --git a/plugins/org.eclipse.emf.cdo.tests.model3/src/org/eclipse/emf/cdo/tests/model3/Class1.java b/plugins/org.eclipse.emf.cdo.tests.model3/src/org/eclipse/emf/cdo/tests/model3/Class1.java
new file mode 100644
index 0000000000..40a37611bd
--- /dev/null
+++ b/plugins/org.eclipse.emf.cdo.tests.model3/src/org/eclipse/emf/cdo/tests/model3/Class1.java
@@ -0,0 +1,48 @@
+/**
+ * <copyright>
+ * </copyright>
+ *
+ * $Id: Class1.java,v 1.2 2008-06-03 06:41:22 estepper Exp $
+ */
+package org.eclipse.emf.cdo.tests.model3;
+
+import org.eclipse.emf.cdo.CDOObject;
+import org.eclipse.emf.cdo.tests.model3.subpackage.Class2;
+
+import org.eclipse.emf.common.util.EList;
+
+/**
+ * <!-- begin-user-doc --> A representation of the model object '<em><b>Class1</b></em>'. <!-- end-user-doc -->
+ * <p>
+ * The following features are supported:
+ * <ul>
+ * <li>{@link org.eclipse.emf.cdo.tests.model3.Class1#getClass2 <em>Class2</em>}</li>
+ * </ul>
+ * </p>
+ *
+ * @see org.eclipse.emf.cdo.tests.model3.Model3Package#getClass1()
+ * @model
+ * @extends CDOObject
+ * @generated
+ */
+public interface Class1 extends CDOObject
+{
+ /**
+ * Returns the value of the '<em><b>Class2</b></em>' reference list. The list contents are of type
+ * {@link org.eclipse.emf.cdo.tests.model3.subpackage.Class2}. It is bidirectional and its opposite is '
+ * {@link org.eclipse.emf.cdo.tests.model3.subpackage.Class2#getClass1 <em>Class1</em>}'. <!-- begin-user-doc -->
+ * <p>
+ * If the meaning of the '<em>Class2</em>' reference list isn't clear, there really should be more of a description
+ * here...
+ * </p>
+ * <!-- end-user-doc -->
+ *
+ * @return the value of the '<em>Class2</em>' reference list.
+ * @see org.eclipse.emf.cdo.tests.model3.Model3Package#getClass1_Class2()
+ * @see org.eclipse.emf.cdo.tests.model3.subpackage.Class2#getClass1
+ * @model opposite="class1"
+ * @generated
+ */
+ EList<Class2> getClass2();
+
+} // Class1
diff --git a/plugins/org.eclipse.emf.cdo.tests.model3/src/org/eclipse/emf/cdo/tests/model3/Model3Package.java b/plugins/org.eclipse.emf.cdo.tests.model3/src/org/eclipse/emf/cdo/tests/model3/Model3Package.java
new file mode 100644
index 0000000000..d520ec5614
--- /dev/null
+++ b/plugins/org.eclipse.emf.cdo.tests.model3/src/org/eclipse/emf/cdo/tests/model3/Model3Package.java
@@ -0,0 +1,146 @@
+/**
+ * <copyright>
+ * </copyright>
+ *
+ * $Id: Model3Package.java,v 1.2 2008-06-03 06:41:22 estepper Exp $
+ */
+package org.eclipse.emf.cdo.tests.model3;
+
+import org.eclipse.emf.ecore.EClass;
+import org.eclipse.emf.ecore.EPackage;
+import org.eclipse.emf.ecore.EReference;
+
+/**
+ * <!-- begin-user-doc --> The <b>Package</b> for the model. It contains accessors for the meta objects to represent
+ * <ul>
+ * <li>each class,</li>
+ * <li>each feature of each class,</li>
+ * <li>each enum,</li>
+ * <li>and each data type</li>
+ * </ul>
+ * <!-- end-user-doc -->
+ *
+ * @see org.eclipse.emf.cdo.tests.model3.Model3Factory
+ * @model kind="package"
+ * @generated
+ */
+public interface Model3Package extends EPackage
+{
+ /**
+ * The package name. <!-- begin-user-doc --> <!-- end-user-doc -->
+ *
+ * @generated
+ */
+ String eNAME = "model3";
+
+ /**
+ * The package namespace URI. <!-- begin-user-doc --> <!-- end-user-doc -->
+ *
+ * @generated
+ */
+ String eNS_URI = "http://www.eclipse.org/emf/CDO/tests/model3/1.0.0";
+
+ /**
+ * The package namespace name. <!-- begin-user-doc --> <!-- end-user-doc -->
+ *
+ * @generated
+ */
+ String eNS_PREFIX = "model3";
+
+ /**
+ * The singleton instance of the package. <!-- begin-user-doc --> <!-- end-user-doc -->
+ *
+ * @generated
+ */
+ Model3Package eINSTANCE = org.eclipse.emf.cdo.tests.model3.impl.Model3PackageImpl.init();
+
+ /**
+ * The meta object id for the '{@link org.eclipse.emf.cdo.tests.model3.impl.Class1Impl <em>Class1</em>}' class. <!--
+ * begin-user-doc --> <!-- end-user-doc -->
+ *
+ * @see org.eclipse.emf.cdo.tests.model3.impl.Class1Impl
+ * @see org.eclipse.emf.cdo.tests.model3.impl.Model3PackageImpl#getClass1()
+ * @generated
+ */
+ int CLASS1 = 0;
+
+ /**
+ * The feature id for the '<em><b>Class2</b></em>' reference list. <!-- begin-user-doc --> <!-- end-user-doc -->
+ *
+ * @generated
+ * @ordered
+ */
+ int CLASS1__CLASS2 = 0;
+
+ /**
+ * The number of structural features of the '<em>Class1</em>' class. <!-- begin-user-doc --> <!-- end-user-doc -->
+ *
+ * @generated
+ * @ordered
+ */
+ int CLASS1_FEATURE_COUNT = 1;
+
+ /**
+ * Returns the meta object for class '{@link org.eclipse.emf.cdo.tests.model3.Class1 <em>Class1</em>}'. <!--
+ * begin-user-doc --> <!-- end-user-doc -->
+ *
+ * @return the meta object for class '<em>Class1</em>'.
+ * @see org.eclipse.emf.cdo.tests.model3.Class1
+ * @generated
+ */
+ EClass getClass1();
+
+ /**
+ * Returns the meta object for the reference list '{@link org.eclipse.emf.cdo.tests.model3.Class1#getClass2
+ * <em>Class2</em>}'. <!-- begin-user-doc --> <!-- end-user-doc -->
+ *
+ * @return the meta object for the reference list '<em>Class2</em>'.
+ * @see org.eclipse.emf.cdo.tests.model3.Class1#getClass2()
+ * @see #getClass1()
+ * @generated
+ */
+ EReference getClass1_Class2();
+
+ /**
+ * Returns the factory that creates the instances of the model. <!-- begin-user-doc --> <!-- end-user-doc -->
+ *
+ * @return the factory that creates the instances of the model.
+ * @generated
+ */
+ Model3Factory getModel3Factory();
+
+ /**
+ * <!-- begin-user-doc --> Defines literals for the meta objects that represent
+ * <ul>
+ * <li>each class,</li>
+ * <li>each feature of each class,</li>
+ * <li>each enum,</li>
+ * <li>and each data type</li>
+ * </ul>
+ * <!-- end-user-doc -->
+ *
+ * @generated
+ */
+ interface Literals
+ {
+ /**
+ * The meta object literal for the '{@link org.eclipse.emf.cdo.tests.model3.impl.Class1Impl <em>Class1</em>}' class.
+ * <!-- begin-user-doc --> <!-- end-user-doc -->
+ *
+ * @see org.eclipse.emf.cdo.tests.model3.impl.Class1Impl
+ * @see org.eclipse.emf.cdo.tests.model3.impl.Model3PackageImpl#getClass1()
+ * @generated
+ */
+ EClass CLASS1 = eINSTANCE.getClass1();
+
+ /**
+ * The meta object literal for the '<em><b>Class2</b></em>' reference list feature. <!-- begin-user-doc --> <!--
+ * end-user-doc -->
+ *
+ * @generated
+ */
+ EReference CLASS1__CLASS2 = eINSTANCE.getClass1_Class2();
+
+ }
+
+} // Model3Package
diff --git a/plugins/org.eclipse.emf.cdo.tests.model3/src/org/eclipse/emf/cdo/tests/model3/impl/Model3PackageImpl.java b/plugins/org.eclipse.emf.cdo.tests.model3/src/org/eclipse/emf/cdo/tests/model3/impl/Model3PackageImpl.java
new file mode 100644
index 0000000000..7f51dd4e14
--- /dev/null
+++ b/plugins/org.eclipse.emf.cdo.tests.model3/src/org/eclipse/emf/cdo/tests/model3/impl/Model3PackageImpl.java
@@ -0,0 +1,206 @@
+/**
+ * <copyright>
+ * </copyright>
+ *
+ * $Id: Model3PackageImpl.java,v 1.2 2008-06-03 06:41:22 estepper Exp $
+ */
+package org.eclipse.emf.cdo.tests.model3.impl;
+
+import org.eclipse.emf.cdo.tests.model3.Class1;
+import org.eclipse.emf.cdo.tests.model3.Model3Factory;
+import org.eclipse.emf.cdo.tests.model3.Model3Package;
+import org.eclipse.emf.cdo.tests.model3.subpackage.SubpackagePackage;
+import org.eclipse.emf.cdo.tests.model3.subpackage.impl.SubpackagePackageImpl;
+
+import org.eclipse.emf.ecore.EClass;
+import org.eclipse.emf.ecore.EPackage;
+import org.eclipse.emf.ecore.EReference;
+import org.eclipse.emf.ecore.impl.EPackageImpl;
+
+/**
+ * <!-- begin-user-doc --> An implementation of the model <b>Package</b>. <!-- end-user-doc -->
+ *
+ * @generated
+ */
+public class Model3PackageImpl extends EPackageImpl implements Model3Package
+{
+ /**
+ * <!-- begin-user-doc --> <!-- end-user-doc -->
+ *
+ * @generated
+ */
+ private EClass class1EClass = null;
+
+ /**
+ * Creates an instance of the model <b>Package</b>, registered with {@link org.eclipse.emf.ecore.EPackage.Registry
+ * EPackage.Registry} by the package package URI value.
+ * <p>
+ * Note: the correct way to create the package is via the static factory method {@link #init init()}, which also
+ * performs initialization of the package, or returns the registered package, if one already exists. <!--
+ * begin-user-doc --> <!-- end-user-doc -->
+ *
+ * @see org.eclipse.emf.ecore.EPackage.Registry
+ * @see org.eclipse.emf.cdo.tests.model3.Model3Package#eNS_URI
+ * @see #init()
+ * @generated
+ */
+ private Model3PackageImpl()
+ {
+ super(eNS_URI, Model3Factory.eINSTANCE);
+ }
+
+ /**
+ * <!-- begin-user-doc --> <!-- end-user-doc -->
+ *
+ * @generated
+ */
+ private static boolean isInited = false;
+
+ /**
+ * Creates, registers, and initializes the <b>Package</b> for this model, and for any others upon which it depends.
+ * Simple dependencies are satisfied by calling this method on all dependent packages before doing anything else. This
+ * method drives initialization for interdependent packages directly, in parallel with this package, itself.
+ * <p>
+ * Of this package and its interdependencies, all packages which have not yet been registered by their URI values are
+ * first created and registered. The packages are then initialized in two steps: meta-model objects for all of the
+ * packages are created before any are initialized, since one package's meta-model objects may refer to those of
+ * another.
+ * <p>
+ * Invocation of this method will not affect any packages that have already been initialized. <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ *
+ * @see #eNS_URI
+ * @see #createPackageContents()
+ * @see #initializePackageContents()
+ * @generated
+ */
+ public static Model3Package init()
+ {
+ if (isInited) return (Model3Package)EPackage.Registry.INSTANCE.getEPackage(Model3Package.eNS_URI);
+
+ // Obtain or create and register package
+ Model3PackageImpl theModel3Package = (Model3PackageImpl)(EPackage.Registry.INSTANCE.getEPackage(eNS_URI) instanceof Model3PackageImpl ? EPackage.Registry.INSTANCE
+ .getEPackage(eNS_URI)
+ : new Model3PackageImpl());
+
+ isInited = true;
+
+ // Obtain or create and register interdependencies
+ SubpackagePackageImpl theSubpackagePackage = (SubpackagePackageImpl)(EPackage.Registry.INSTANCE
+ .getEPackage(SubpackagePackage.eNS_URI) instanceof SubpackagePackageImpl ? EPackage.Registry.INSTANCE
+ .getEPackage(SubpackagePackage.eNS_URI) : SubpackagePackage.eINSTANCE);
+
+ // Create package meta-data objects
+ theModel3Package.createPackageContents();
+ theSubpackagePackage.createPackageContents();
+
+ // Initialize created meta-data
+ theModel3Package.initializePackageContents();
+ theSubpackagePackage.initializePackageContents();
+
+ // Mark meta-data to indicate it can't be changed
+ theModel3Package.freeze();
+
+ return theModel3Package;
+ }
+
+ /**
+ * <!-- begin-user-doc --> <!-- end-user-doc -->
+ *
+ * @generated
+ */
+ public EClass getClass1()
+ {
+ return class1EClass;
+ }
+
+ /**
+ * <!-- begin-user-doc --> <!-- end-user-doc -->
+ *
+ * @generated
+ */
+ public EReference getClass1_Class2()
+ {
+ return (EReference)class1EClass.getEStructuralFeatures().get(0);
+ }
+
+ /**
+ * <!-- begin-user-doc --> <!-- end-user-doc -->
+ *
+ * @generated
+ */
+ public Model3Factory getModel3Factory()
+ {
+ return (Model3Factory)getEFactoryInstance();
+ }
+
+ /**
+ * <!-- begin-user-doc --> <!-- end-user-doc -->
+ *
+ * @generated
+ */
+ private boolean isCreated = false;
+
+ /**
+ * Creates the meta-model objects for the package. This method is guarded to have no affect on any invocation but its
+ * first. <!-- begin-user-doc --> <!-- end-user-doc -->
+ *
+ * @generated
+ */
+ public void createPackageContents()
+ {
+ if (isCreated) return;
+ isCreated = true;
+
+ // Create classes and their features
+ class1EClass = createEClass(CLASS1);
+ createEReference(class1EClass, CLASS1__CLASS2);
+ }
+
+ /**
+ * <!-- begin-user-doc --> <!-- end-user-doc -->
+ *
+ * @generated
+ */
+ private boolean isInitialized = false;
+
+ /**
+ * Complete the initialization of the package and its meta-model. This method is guarded to have no affect on any
+ * invocation but its first. <!-- begin-user-doc --> <!-- end-user-doc -->
+ *
+ * @generated
+ */
+ public void initializePackageContents()
+ {
+ if (isInitialized) return;
+ isInitialized = true;
+
+ // Initialize package
+ setName(eNAME);
+ setNsPrefix(eNS_PREFIX);
+ setNsURI(eNS_URI);
+
+ // Obtain other dependent packages
+ SubpackagePackage theSubpackagePackage = (SubpackagePackage)EPackage.Registry.INSTANCE
+ .getEPackage(SubpackagePackage.eNS_URI);
+
+ // Add subpackages
+ getESubpackages().add(theSubpackagePackage);
+
+ // Create type parameters
+
+ // Set bounds for type parameters
+
+ // Add supertypes to classes
+
+ // Initialize classes and features; add operations and parameters
+ initEClass(class1EClass, Class1.class, "Class1", !IS_ABSTRACT, !IS_INTERFACE, IS_GENERATED_INSTANCE_CLASS);
+ initEReference(getClass1_Class2(), theSubpackagePackage.getClass2(), theSubpackagePackage.getClass2_Class1(),
+ "class2", null, 0, -1, Class1.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, !IS_COMPOSITE,
+ IS_RESOLVE_PROXIES, !IS_UNSETTABLE, IS_UNIQUE, !IS_DERIVED, IS_ORDERED);
+
+ // Create resource
+ createResource(eNS_URI);
+ }
+
+} // Model3PackageImpl
diff --git a/plugins/org.eclipse.emf.cdo.tests.model3/src/org/eclipse/emf/cdo/tests/model3/subpackage/Class2.java b/plugins/org.eclipse.emf.cdo.tests.model3/src/org/eclipse/emf/cdo/tests/model3/subpackage/Class2.java
new file mode 100644
index 0000000000..ecba0be86e
--- /dev/null
+++ b/plugins/org.eclipse.emf.cdo.tests.model3/src/org/eclipse/emf/cdo/tests/model3/subpackage/Class2.java
@@ -0,0 +1,48 @@
+/**
+ * <copyright>
+ * </copyright>
+ *
+ * $Id: Class2.java,v 1.2 2008-06-03 06:41:22 estepper Exp $
+ */
+package org.eclipse.emf.cdo.tests.model3.subpackage;
+
+import org.eclipse.emf.cdo.CDOObject;
+import org.eclipse.emf.cdo.tests.model3.Class1;
+
+import org.eclipse.emf.common.util.EList;
+
+/**
+ * <!-- begin-user-doc --> A representation of the model object '<em><b>Class2</b></em>'. <!-- end-user-doc -->
+ * <p>
+ * The following features are supported:
+ * <ul>
+ * <li>{@link org.eclipse.emf.cdo.tests.model3.subpackage.Class2#getClass1 <em>Class1</em>}</li>
+ * </ul>
+ * </p>
+ *
+ * @see org.eclipse.emf.cdo.tests.model3.subpackage.SubpackagePackage#getClass2()
+ * @model
+ * @extends CDOObject
+ * @generated
+ */
+public interface Class2 extends CDOObject
+{
+ /**
+ * Returns the value of the '<em><b>Class1</b></em>' reference list. The list contents are of type
+ * {@link org.eclipse.emf.cdo.tests.model3.Class1}. It is bidirectional and its opposite is '
+ * {@link org.eclipse.emf.cdo.tests.model3.Class1#getClass2 <em>Class2</em>}'. <!-- begin-user-doc -->
+ * <p>
+ * If the meaning of the '<em>Class1</em>' reference list isn't clear, there really should be more of a description
+ * here...
+ * </p>
+ * <!-- end-user-doc -->
+ *
+ * @return the value of the '<em>Class1</em>' reference list.
+ * @see org.eclipse.emf.cdo.tests.model3.subpackage.SubpackagePackage#getClass2_Class1()
+ * @see org.eclipse.emf.cdo.tests.model3.Class1#getClass2
+ * @model opposite="class2"
+ * @generated
+ */
+ EList<Class1> getClass1();
+
+} // Class2
diff --git a/plugins/org.eclipse.emf.cdo.tests.model3/src/org/eclipse/emf/cdo/tests/model3/subpackage/SubpackagePackage.java b/plugins/org.eclipse.emf.cdo.tests.model3/src/org/eclipse/emf/cdo/tests/model3/subpackage/SubpackagePackage.java
new file mode 100644
index 0000000000..5a508f4ce5
--- /dev/null
+++ b/plugins/org.eclipse.emf.cdo.tests.model3/src/org/eclipse/emf/cdo/tests/model3/subpackage/SubpackagePackage.java
@@ -0,0 +1,147 @@
+/**
+ * <copyright>
+ * </copyright>
+ *
+ * $Id: SubpackagePackage.java,v 1.2 2008-06-03 06:41:22 estepper Exp $
+ */
+package org.eclipse.emf.cdo.tests.model3.subpackage;
+
+import org.eclipse.emf.ecore.EClass;
+import org.eclipse.emf.ecore.EPackage;
+import org.eclipse.emf.ecore.EReference;
+
+/**
+ * <!-- begin-user-doc --> The <b>Package</b> for the model. It contains accessors for the meta objects to represent
+ * <ul>
+ * <li>each class,</li>
+ * <li>each feature of each class,</li>
+ * <li>each enum,</li>
+ * <li>and each data type</li>
+ * </ul>
+ * <!-- end-user-doc -->
+ *
+ * @see org.eclipse.emf.cdo.tests.model3.subpackage.SubpackageFactory
+ * @model kind="package"
+ * @generated
+ */
+public interface SubpackagePackage extends EPackage
+{
+ /**
+ * The package name. <!-- begin-user-doc --> <!-- end-user-doc -->
+ *
+ * @generated
+ */
+ String eNAME = "subpackage";
+
+ /**
+ * The package namespace URI. <!-- begin-user-doc --> <!-- end-user-doc -->
+ *
+ * @generated
+ */
+ String eNS_URI = "http://www.eclipse.org/emf/CDO/tests/subpackage/1.0.0";
+
+ /**
+ * The package namespace name. <!-- begin-user-doc --> <!-- end-user-doc -->
+ *
+ * @generated
+ */
+ String eNS_PREFIX = "subpackage";
+
+ /**
+ * The singleton instance of the package. <!-- begin-user-doc --> <!-- end-user-doc -->
+ *
+ * @generated
+ */
+ SubpackagePackage eINSTANCE = org.eclipse.emf.cdo.tests.model3.subpackage.impl.SubpackagePackageImpl.init();
+
+ /**
+ * The meta object id for the '{@link org.eclipse.emf.cdo.tests.model3.subpackage.impl.Class2Impl <em>Class2</em>}'
+ * class. <!-- begin-user-doc --> <!-- end-user-doc -->
+ *
+ * @see org.eclipse.emf.cdo.tests.model3.subpackage.impl.Class2Impl
+ * @see org.eclipse.emf.cdo.tests.model3.subpackage.impl.SubpackagePackageImpl#getClass2()
+ * @generated
+ */
+ int CLASS2 = 0;
+
+ /**
+ * The feature id for the '<em><b>Class1</b></em>' reference list. <!-- begin-user-doc --> <!-- end-user-doc -->
+ *
+ * @generated
+ * @ordered
+ */
+ int CLASS2__CLASS1 = 0;
+
+ /**
+ * The number of structural features of the '<em>Class2</em>' class. <!-- begin-user-doc --> <!-- end-user-doc -->
+ *
+ * @generated
+ * @ordered
+ */
+ int CLASS2_FEATURE_COUNT = 1;
+
+ /**
+ * Returns the meta object for class '{@link org.eclipse.emf.cdo.tests.model3.subpackage.Class2 <em>Class2</em>}'.
+ * <!-- begin-user-doc --> <!-- end-user-doc -->
+ *
+ * @return the meta object for class '<em>Class2</em>'.
+ * @see org.eclipse.emf.cdo.tests.model3.subpackage.Class2
+ * @generated
+ */
+ EClass getClass2();
+
+ /**
+ * Returns the meta object for the reference list '
+ * {@link org.eclipse.emf.cdo.tests.model3.subpackage.Class2#getClass1 <em>Class1</em>}'. <!-- begin-user-doc --> <!--
+ * end-user-doc -->
+ *
+ * @return the meta object for the reference list '<em>Class1</em>'.
+ * @see org.eclipse.emf.cdo.tests.model3.subpackage.Class2#getClass1()
+ * @see #getClass2()
+ * @generated
+ */
+ EReference getClass2_Class1();
+
+ /**
+ * Returns the factory that creates the instances of the model. <!-- begin-user-doc --> <!-- end-user-doc -->
+ *
+ * @return the factory that creates the instances of the model.
+ * @generated
+ */
+ SubpackageFactory getSubpackageFactory();
+
+ /**
+ * <!-- begin-user-doc --> Defines literals for the meta objects that represent
+ * <ul>
+ * <li>each class,</li>
+ * <li>each feature of each class,</li>
+ * <li>each enum,</li>
+ * <li>and each data type</li>
+ * </ul>
+ * <!-- end-user-doc -->
+ *
+ * @generated
+ */
+ interface Literals
+ {
+ /**
+ * The meta object literal for the '{@link org.eclipse.emf.cdo.tests.model3.subpackage.impl.Class2Impl
+ * <em>Class2</em>}' class. <!-- begin-user-doc --> <!-- end-user-doc -->
+ *
+ * @see org.eclipse.emf.cdo.tests.model3.subpackage.impl.Class2Impl
+ * @see org.eclipse.emf.cdo.tests.model3.subpackage.impl.SubpackagePackageImpl#getClass2()
+ * @generated
+ */
+ EClass CLASS2 = eINSTANCE.getClass2();
+
+ /**
+ * The meta object literal for the '<em><b>Class1</b></em>' reference list feature. <!-- begin-user-doc --> <!--
+ * end-user-doc -->
+ *
+ * @generated
+ */
+ EReference CLASS2__CLASS1 = eINSTANCE.getClass2_Class1();
+
+ }
+
+} // SubpackagePackage
diff --git a/plugins/org.eclipse.emf.cdo.tests.model3/src/org/eclipse/emf/cdo/tests/model3/subpackage/impl/SubpackagePackageImpl.java b/plugins/org.eclipse.emf.cdo.tests.model3/src/org/eclipse/emf/cdo/tests/model3/subpackage/impl/SubpackagePackageImpl.java
new file mode 100644
index 0000000000..05ae555740
--- /dev/null
+++ b/plugins/org.eclipse.emf.cdo.tests.model3/src/org/eclipse/emf/cdo/tests/model3/subpackage/impl/SubpackagePackageImpl.java
@@ -0,0 +1,199 @@
+/**
+ * <copyright>
+ * </copyright>
+ *
+ * $Id: SubpackagePackageImpl.java,v 1.2 2008-06-03 06:41:22 estepper Exp $
+ */
+package org.eclipse.emf.cdo.tests.model3.subpackage.impl;
+
+import org.eclipse.emf.cdo.tests.model3.Model3Package;
+import org.eclipse.emf.cdo.tests.model3.impl.Model3PackageImpl;
+import org.eclipse.emf.cdo.tests.model3.subpackage.Class2;
+import org.eclipse.emf.cdo.tests.model3.subpackage.SubpackageFactory;
+import org.eclipse.emf.cdo.tests.model3.subpackage.SubpackagePackage;
+
+import org.eclipse.emf.ecore.EClass;
+import org.eclipse.emf.ecore.EPackage;
+import org.eclipse.emf.ecore.EReference;
+import org.eclipse.emf.ecore.impl.EPackageImpl;
+
+/**
+ * <!-- begin-user-doc --> An implementation of the model <b>Package</b>. <!-- end-user-doc -->
+ *
+ * @generated
+ */
+public class SubpackagePackageImpl extends EPackageImpl implements SubpackagePackage
+{
+ /**
+ * <!-- begin-user-doc --> <!-- end-user-doc -->
+ *
+ * @generated
+ */
+ private EClass class2EClass = null;
+
+ /**
+ * Creates an instance of the model <b>Package</b>, registered with {@link org.eclipse.emf.ecore.EPackage.Registry
+ * EPackage.Registry} by the package package URI value.
+ * <p>
+ * Note: the correct way to create the package is via the static factory method {@link #init init()}, which also
+ * performs initialization of the package, or returns the registered package, if one already exists. <!--
+ * begin-user-doc --> <!-- end-user-doc -->
+ *
+ * @see org.eclipse.emf.ecore.EPackage.Registry
+ * @see org.eclipse.emf.cdo.tests.model3.subpackage.SubpackagePackage#eNS_URI
+ * @see #init()
+ * @generated
+ */
+ private SubpackagePackageImpl()
+ {
+ super(eNS_URI, SubpackageFactory.eINSTANCE);
+ }
+
+ /**
+ * <!-- begin-user-doc --> <!-- end-user-doc -->
+ *
+ * @generated
+ */
+ private static boolean isInited = false;
+
+ /**
+ * Creates, registers, and initializes the <b>Package</b> for this model, and for any others upon which it depends.
+ * Simple dependencies are satisfied by calling this method on all dependent packages before doing anything else. This
+ * method drives initialization for interdependent packages directly, in parallel with this package, itself.
+ * <p>
+ * Of this package and its interdependencies, all packages which have not yet been registered by their URI values are
+ * first created and registered. The packages are then initialized in two steps: meta-model objects for all of the
+ * packages are created before any are initialized, since one package's meta-model objects may refer to those of
+ * another.
+ * <p>
+ * Invocation of this method will not affect any packages that have already been initialized. <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ *
+ * @see #eNS_URI
+ * @see #createPackageContents()
+ * @see #initializePackageContents()
+ * @generated
+ */
+ public static SubpackagePackage init()
+ {
+ if (isInited) return (SubpackagePackage)EPackage.Registry.INSTANCE.getEPackage(SubpackagePackage.eNS_URI);
+
+ // Obtain or create and register package
+ SubpackagePackageImpl theSubpackagePackage = (SubpackagePackageImpl)(EPackage.Registry.INSTANCE
+ .getEPackage(eNS_URI) instanceof SubpackagePackageImpl ? EPackage.Registry.INSTANCE.getEPackage(eNS_URI)
+ : new SubpackagePackageImpl());
+
+ isInited = true;
+
+ // Obtain or create and register interdependencies
+ Model3PackageImpl theModel3Package = (Model3PackageImpl)(EPackage.Registry.INSTANCE
+ .getEPackage(Model3Package.eNS_URI) instanceof Model3PackageImpl ? EPackage.Registry.INSTANCE
+ .getEPackage(Model3Package.eNS_URI) : Model3Package.eINSTANCE);
+
+ // Create package meta-data objects
+ theSubpackagePackage.createPackageContents();
+ theModel3Package.createPackageContents();
+
+ // Initialize created meta-data
+ theSubpackagePackage.initializePackageContents();
+ theModel3Package.initializePackageContents();
+
+ // Mark meta-data to indicate it can't be changed
+ theSubpackagePackage.freeze();
+
+ return theSubpackagePackage;
+ }
+
+ /**
+ * <!-- begin-user-doc --> <!-- end-user-doc -->
+ *
+ * @generated
+ */
+ public EClass getClass2()
+ {
+ return class2EClass;
+ }
+
+ /**
+ * <!-- begin-user-doc --> <!-- end-user-doc -->
+ *
+ * @generated
+ */
+ public EReference getClass2_Class1()
+ {
+ return (EReference)class2EClass.getEStructuralFeatures().get(0);
+ }
+
+ /**
+ * <!-- begin-user-doc --> <!-- end-user-doc -->
+ *
+ * @generated
+ */
+ public SubpackageFactory getSubpackageFactory()
+ {
+ return (SubpackageFactory)getEFactoryInstance();
+ }
+
+ /**
+ * <!-- begin-user-doc --> <!-- end-user-doc -->
+ *
+ * @generated
+ */
+ private boolean isCreated = false;
+
+ /**
+ * Creates the meta-model objects for the package. This method is guarded to have no affect on any invocation but its
+ * first. <!-- begin-user-doc --> <!-- end-user-doc -->
+ *
+ * @generated
+ */
+ public void createPackageContents()
+ {
+ if (isCreated) return;
+ isCreated = true;
+
+ // Create classes and their features
+ class2EClass = createEClass(CLASS2);
+ createEReference(class2EClass, CLASS2__CLASS1);
+ }
+
+ /**
+ * <!-- begin-user-doc --> <!-- end-user-doc -->
+ *
+ * @generated
+ */
+ private boolean isInitialized = false;
+
+ /**
+ * Complete the initialization of the package and its meta-model. This method is guarded to have no affect on any
+ * invocation but its first. <!-- begin-user-doc --> <!-- end-user-doc -->
+ *
+ * @generated
+ */
+ public void initializePackageContents()
+ {
+ if (isInitialized) return;
+ isInitialized = true;
+
+ // Initialize package
+ setName(eNAME);
+ setNsPrefix(eNS_PREFIX);
+ setNsURI(eNS_URI);
+
+ // Obtain other dependent packages
+ Model3Package theModel3Package = (Model3Package)EPackage.Registry.INSTANCE.getEPackage(Model3Package.eNS_URI);
+
+ // Create type parameters
+
+ // Set bounds for type parameters
+
+ // Add supertypes to classes
+
+ // Initialize classes and features; add operations and parameters
+ initEClass(class2EClass, Class2.class, "Class2", !IS_ABSTRACT, !IS_INTERFACE, IS_GENERATED_INSTANCE_CLASS);
+ initEReference(getClass2_Class1(), theModel3Package.getClass1(), theModel3Package.getClass1_Class2(), "class1",
+ null, 0, -1, Class2.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, !IS_COMPOSITE, IS_RESOLVE_PROXIES,
+ !IS_UNSETTABLE, IS_UNIQUE, !IS_DERIVED, IS_ORDERED);
+ }
+
+} // SubpackagePackageImpl
diff --git a/plugins/org.eclipse.emf.cdo.tests.model3/src/org/eclipse/emf/cdo/tests/model3/subpackage/util/SubpackageAdapterFactory.java b/plugins/org.eclipse.emf.cdo.tests.model3/src/org/eclipse/emf/cdo/tests/model3/subpackage/util/SubpackageAdapterFactory.java
new file mode 100644
index 0000000000..d36b01ed0f
--- /dev/null
+++ b/plugins/org.eclipse.emf.cdo.tests.model3/src/org/eclipse/emf/cdo/tests/model3/subpackage/util/SubpackageAdapterFactory.java
@@ -0,0 +1,128 @@
+/**
+ * <copyright>
+ * </copyright>
+ *
+ * $Id: SubpackageAdapterFactory.java,v 1.2 2008-06-03 06:41:22 estepper Exp $
+ */
+package org.eclipse.emf.cdo.tests.model3.subpackage.util;
+
+import org.eclipse.emf.cdo.tests.model3.subpackage.Class2;
+import org.eclipse.emf.cdo.tests.model3.subpackage.SubpackagePackage;
+
+import org.eclipse.emf.common.notify.Adapter;
+import org.eclipse.emf.common.notify.Notifier;
+import org.eclipse.emf.common.notify.impl.AdapterFactoryImpl;
+import org.eclipse.emf.ecore.EObject;
+
+/**
+ * <!-- begin-user-doc --> The <b>Adapter Factory</b> for the model. It provides an adapter <code>createXXX</code>
+ * method for each class of the model. <!-- end-user-doc -->
+ *
+ * @see org.eclipse.emf.cdo.tests.model3.subpackage.SubpackagePackage
+ * @generated
+ */
+public class SubpackageAdapterFactory extends AdapterFactoryImpl
+{
+ /**
+ * The cached model package. <!-- begin-user-doc --> <!-- end-user-doc -->
+ *
+ * @generated
+ */
+ protected static SubpackagePackage modelPackage;
+
+ /**
+ * Creates an instance of the adapter factory. <!-- begin-user-doc --> <!-- end-user-doc -->
+ *
+ * @generated
+ */
+ public SubpackageAdapterFactory()
+ {
+ if (modelPackage == null)
+ {
+ modelPackage = SubpackagePackage.eINSTANCE;
+ }
+ }
+
+ /**
+ * Returns whether this factory is applicable for the type of the object. <!-- begin-user-doc --> This implementation
+ * returns <code>true</code> if the object is either the model's package or is an instance object of the model. <!--
+ * end-user-doc -->
+ *
+ * @return whether this factory is applicable for the type of the object.
+ * @generated
+ */
+ @Override
+ public boolean isFactoryForType(Object object)
+ {
+ if (object == modelPackage)
+ {
+ return true;
+ }
+ if (object instanceof EObject)
+ {
+ return ((EObject)object).eClass().getEPackage() == modelPackage;
+ }
+ return false;
+ }
+
+ /**
+ * The switch that delegates to the <code>createXXX</code> methods. <!-- begin-user-doc --> <!-- end-user-doc -->
+ *
+ * @generated
+ */
+ protected SubpackageSwitch<Adapter> modelSwitch = new SubpackageSwitch<Adapter>()
+ {
+ @Override
+ public Adapter caseClass2(Class2 object)
+ {
+ return createClass2Adapter();
+ }
+
+ @Override
+ public Adapter defaultCase(EObject object)
+ {
+ return createEObjectAdapter();
+ }
+ };
+
+ /**
+ * Creates an adapter for the <code>target</code>. <!-- begin-user-doc --> <!-- end-user-doc -->
+ *
+ * @param target
+ * the object to adapt.
+ * @return the adapter for the <code>target</code>.
+ * @generated
+ */
+ @Override
+ public Adapter createAdapter(Notifier target)
+ {
+ return modelSwitch.doSwitch((EObject)target);
+ }
+
+ /**
+ * Creates a new adapter for an object of class '{@link org.eclipse.emf.cdo.tests.model3.subpackage.Class2
+ * <em>Class2</em>}'. <!-- begin-user-doc --> This default implementation returns null so that we can easily ignore
+ * cases; it's useful to ignore a case when inheritance will catch all the cases anyway. <!-- end-user-doc -->
+ *
+ * @return the new adapter.
+ * @see org.eclipse.emf.cdo.tests.model3.subpackage.Class2
+ * @generated
+ */
+ public Adapter createClass2Adapter()
+ {
+ return null;
+ }
+
+ /**
+ * Creates a new adapter for the default case. <!-- begin-user-doc --> This default implementation returns null. <!--
+ * end-user-doc -->
+ *
+ * @return the new adapter.
+ * @generated
+ */
+ public Adapter createEObjectAdapter()
+ {
+ return null;
+ }
+
+} // SubpackageAdapterFactory
diff --git a/plugins/org.eclipse.emf.cdo.tests.model3/src/org/eclipse/emf/cdo/tests/model3/subpackage/util/SubpackageSwitch.java b/plugins/org.eclipse.emf.cdo.tests.model3/src/org/eclipse/emf/cdo/tests/model3/subpackage/util/SubpackageSwitch.java
new file mode 100644
index 0000000000..edb7e65d7e
--- /dev/null
+++ b/plugins/org.eclipse.emf.cdo.tests.model3/src/org/eclipse/emf/cdo/tests/model3/subpackage/util/SubpackageSwitch.java
@@ -0,0 +1,134 @@
+/**
+ * <copyright>
+ * </copyright>
+ *
+ * $Id: SubpackageSwitch.java,v 1.2 2008-06-03 06:41:22 estepper Exp $
+ */
+package org.eclipse.emf.cdo.tests.model3.subpackage.util;
+
+import org.eclipse.emf.cdo.tests.model3.subpackage.Class2;
+import org.eclipse.emf.cdo.tests.model3.subpackage.SubpackagePackage;
+
+import org.eclipse.emf.ecore.EClass;
+import org.eclipse.emf.ecore.EObject;
+
+import java.util.List;
+
+/**
+ * <!-- begin-user-doc --> The <b>Switch</b> for the model's inheritance hierarchy. It supports the call
+ * {@link #doSwitch(EObject) doSwitch(object)} to invoke the <code>caseXXX</code> method for each class of the model,
+ * starting with the actual class of the object and proceeding up the inheritance hierarchy until a non-null result is
+ * returned, which is the result of the switch. <!-- end-user-doc -->
+ *
+ * @see org.eclipse.emf.cdo.tests.model3.subpackage.SubpackagePackage
+ * @generated
+ */
+public class SubpackageSwitch<T>
+{
+ /**
+ * The cached model package <!-- begin-user-doc --> <!-- end-user-doc -->
+ *
+ * @generated
+ */
+ protected static SubpackagePackage modelPackage;
+
+ /**
+ * Creates an instance of the switch. <!-- begin-user-doc --> <!-- end-user-doc -->
+ *
+ * @generated
+ */
+ public SubpackageSwitch()
+ {
+ if (modelPackage == null)
+ {
+ modelPackage = SubpackagePackage.eINSTANCE;
+ }
+ }
+
+ /**
+ * Calls <code>caseXXX</code> for each class of the model until one returns a non null result; it yields that result.
+ * <!-- begin-user-doc --> <!-- end-user-doc -->
+ *
+ * @return the first non-null result returned by a <code>caseXXX</code> call.
+ * @generated
+ */
+ public T doSwitch(EObject theEObject)
+ {
+ return doSwitch(theEObject.eClass(), theEObject);
+ }
+
+ /**
+ * Calls <code>caseXXX</code> for each class of the model until one returns a non null result; it yields that result.
+ * <!-- begin-user-doc --> <!-- end-user-doc -->
+ *
+ * @return the first non-null result returned by a <code>caseXXX</code> call.
+ * @generated
+ */
+ protected T doSwitch(EClass theEClass, EObject theEObject)
+ {
+ if (theEClass.eContainer() == modelPackage)
+ {
+ return doSwitch(theEClass.getClassifierID(), theEObject);
+ }
+ else
+ {
+ List<EClass> eSuperTypes = theEClass.getESuperTypes();
+ return eSuperTypes.isEmpty() ? defaultCase(theEObject) : doSwitch(eSuperTypes.get(0), theEObject);
+ }
+ }
+
+ /**
+ * Calls <code>caseXXX</code> for each class of the model until one returns a non null result; it yields that result.
+ * <!-- begin-user-doc --> <!-- end-user-doc -->
+ *
+ * @return the first non-null result returned by a <code>caseXXX</code> call.
+ * @generated
+ */
+ protected T doSwitch(int classifierID, EObject theEObject)
+ {
+ switch (classifierID)
+ {
+ case SubpackagePackage.CLASS2:
+ {
+ Class2 class2 = (Class2)theEObject;
+ T result = caseClass2(class2);
+ if (result == null) result = defaultCase(theEObject);
+ return result;
+ }
+ default:
+ return defaultCase(theEObject);
+ }
+ }
+
+ /**
+ * Returns the result of interpreting the object as an instance of '<em>Class2</em>'. <!-- begin-user-doc --> This
+ * implementation returns null; returning a non-null result will terminate the switch. <!-- end-user-doc -->
+ *
+ * @param object
+ * the target of the switch.
+ * @return the result of interpreting the object as an instance of '<em>Class2</em>'.
+ * @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject)
+ * @generated
+ */
+ public T caseClass2(Class2 object)
+ {
+ return null;
+ }
+
+ /**
+ * Returns the result of interpreting the object as an instance of '<em>EObject</em>'. <!-- begin-user-doc --> This
+ * implementation returns null; returning a non-null result will terminate the switch, but this is the last case
+ * anyway. <!-- end-user-doc -->
+ *
+ * @param object
+ * the target of the switch.
+ * @return the result of interpreting the object as an instance of '<em>EObject</em>'.
+ * @see #doSwitch(org.eclipse.emf.ecore.EObject)
+ * @generated
+ */
+ public T defaultCase(EObject object)
+ {
+ return null;
+ }
+
+} // SubpackageSwitch
diff --git a/plugins/org.eclipse.emf.cdo.tests.model3/src/org/eclipse/emf/cdo/tests/model3/util/Model3Switch.java b/plugins/org.eclipse.emf.cdo.tests.model3/src/org/eclipse/emf/cdo/tests/model3/util/Model3Switch.java
new file mode 100644
index 0000000000..9c2d364bc9
--- /dev/null
+++ b/plugins/org.eclipse.emf.cdo.tests.model3/src/org/eclipse/emf/cdo/tests/model3/util/Model3Switch.java
@@ -0,0 +1,134 @@
+/**
+ * <copyright>
+ * </copyright>
+ *
+ * $Id: Model3Switch.java,v 1.2 2008-06-03 06:41:22 estepper Exp $
+ */
+package org.eclipse.emf.cdo.tests.model3.util;
+
+import org.eclipse.emf.cdo.tests.model3.Class1;
+import org.eclipse.emf.cdo.tests.model3.Model3Package;
+
+import org.eclipse.emf.ecore.EClass;
+import org.eclipse.emf.ecore.EObject;
+
+import java.util.List;
+
+/**
+ * <!-- begin-user-doc --> The <b>Switch</b> for the model's inheritance hierarchy. It supports the call
+ * {@link #doSwitch(EObject) doSwitch(object)} to invoke the <code>caseXXX</code> method for each class of the model,
+ * starting with the actual class of the object and proceeding up the inheritance hierarchy until a non-null result is
+ * returned, which is the result of the switch. <!-- end-user-doc -->
+ *
+ * @see org.eclipse.emf.cdo.tests.model3.Model3Package
+ * @generated
+ */
+public class Model3Switch<T>
+{
+ /**
+ * The cached model package <!-- begin-user-doc --> <!-- end-user-doc -->
+ *
+ * @generated
+ */
+ protected static Model3Package modelPackage;
+
+ /**
+ * Creates an instance of the switch. <!-- begin-user-doc --> <!-- end-user-doc -->
+ *
+ * @generated
+ */
+ public Model3Switch()
+ {
+ if (modelPackage == null)
+ {
+ modelPackage = Model3Package.eINSTANCE;
+ }
+ }
+
+ /**
+ * Calls <code>caseXXX</code> for each class of the model until one returns a non null result; it yields that result.
+ * <!-- begin-user-doc --> <!-- end-user-doc -->
+ *
+ * @return the first non-null result returned by a <code>caseXXX</code> call.
+ * @generated
+ */
+ public T doSwitch(EObject theEObject)
+ {
+ return doSwitch(theEObject.eClass(), theEObject);
+ }
+
+ /**
+ * Calls <code>caseXXX</code> for each class of the model until one returns a non null result; it yields that result.
+ * <!-- begin-user-doc --> <!-- end-user-doc -->
+ *
+ * @return the first non-null result returned by a <code>caseXXX</code> call.
+ * @generated
+ */
+ protected T doSwitch(EClass theEClass, EObject theEObject)
+ {
+ if (theEClass.eContainer() == modelPackage)
+ {
+ return doSwitch(theEClass.getClassifierID(), theEObject);
+ }
+ else
+ {
+ List<EClass> eSuperTypes = theEClass.getESuperTypes();
+ return eSuperTypes.isEmpty() ? defaultCase(theEObject) : doSwitch(eSuperTypes.get(0), theEObject);
+ }
+ }
+
+ /**
+ * Calls <code>caseXXX</code> for each class of the model until one returns a non null result; it yields that result.
+ * <!-- begin-user-doc --> <!-- end-user-doc -->
+ *
+ * @return the first non-null result returned by a <code>caseXXX</code> call.
+ * @generated
+ */
+ protected T doSwitch(int classifierID, EObject theEObject)
+ {
+ switch (classifierID)
+ {
+ case Model3Package.CLASS1:
+ {
+ Class1 class1 = (Class1)theEObject;
+ T result = caseClass1(class1);
+ if (result == null) result = defaultCase(theEObject);
+ return result;
+ }
+ default:
+ return defaultCase(theEObject);
+ }
+ }
+
+ /**
+ * Returns the result of interpreting the object as an instance of '<em>Class1</em>'. <!-- begin-user-doc --> This
+ * implementation returns null; returning a non-null result will terminate the switch. <!-- end-user-doc -->
+ *
+ * @param object
+ * the target of the switch.
+ * @return the result of interpreting the object as an instance of '<em>Class1</em>'.
+ * @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject)
+ * @generated
+ */
+ public T caseClass1(Class1 object)
+ {
+ return null;
+ }
+
+ /**
+ * Returns the result of interpreting the object as an instance of '<em>EObject</em>'. <!-- begin-user-doc --> This
+ * implementation returns null; returning a non-null result will terminate the switch, but this is the last case
+ * anyway. <!-- end-user-doc -->
+ *
+ * @param object
+ * the target of the switch.
+ * @return the result of interpreting the object as an instance of '<em>EObject</em>'.
+ * @see #doSwitch(org.eclipse.emf.ecore.EObject)
+ * @generated
+ */
+ public T defaultCase(EObject object)
+ {
+ return null;
+ }
+
+} // Model3Switch

Back to the top