Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--plugins/org.eclipse.emf.cdo.common/.classpath2
-rw-r--r--plugins/org.eclipse.emf.cdo.common/META-INF/MANIFEST.MF9
-rw-r--r--plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/common/CDOCommonSession.java1
-rw-r--r--plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/common/CDOCommonView.java1
-rw-r--r--plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/common/CDOFetchRule.java35
-rw-r--r--plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/common/id/CDOID.java2
-rw-r--r--plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/common/id/CDOIDProvider.java1
-rw-r--r--plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/common/io/CDODataInput.java38
-rw-r--r--plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/common/io/CDODataOutput.java37
-rw-r--r--plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/common/model/CDOClass.java66
-rw-r--r--plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/common/model/CDOClassInfo.java (renamed from plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/common/model/CDOModelElement.java)24
-rw-r--r--plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/common/model/CDOClassProxy.java105
-rw-r--r--plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/common/model/CDOClassifierRef.java (renamed from plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/internal/common/model/CDOClassRefImpl.java)36
-rw-r--r--plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/common/model/CDOFeature.java41
-rw-r--r--plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/common/model/CDOModelConstants.java (renamed from plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/common/model/CDOClassRef.java)8
-rw-r--r--plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/common/model/CDOModelUtil.java264
-rw-r--r--plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/common/model/CDOPackage.java52
-rw-r--r--plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/common/model/CDOPackageInfo.java42
-rw-r--r--plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/common/model/CDOPackageManager.java36
-rw-r--r--plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/common/model/CDOPackageRegistry.java40
-rw-r--r--plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/common/model/CDOPackageRegistryPopulator.java139
-rw-r--r--plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/common/model/CDOPackageTypeRegistry.java219
-rw-r--r--plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/common/model/CDOPackageURICompressor.java46
-rw-r--r--plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/common/model/CDOPackageUnit.java71
-rw-r--r--plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/common/model/CDOType.java6
-rw-r--r--plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/common/model/EMFUtil.java (renamed from plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/cdo/util/EMFUtil.java)236
-rw-r--r--plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/common/model/core/CDOCorePackage.java26
-rw-r--r--plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/common/model/core/CDOFeatureMapEntryDataType.java24
-rw-r--r--plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/common/model/core/CDOObjectClass.java24
-rw-r--r--plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/common/model/resource/CDOContentsFeature.java24
-rw-r--r--plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/common/model/resource/CDOFolderFeature.java25
-rw-r--r--plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/common/model/resource/CDONameFeature.java25
-rw-r--r--plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/common/model/resource/CDONodesFeature.java25
-rw-r--r--plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/common/model/resource/CDOResourceClass.java26
-rw-r--r--plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/common/model/resource/CDOResourceFolderClass.java27
-rw-r--r--plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/common/model/resource/CDOResourceNodeClass.java29
-rw-r--r--plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/common/model/resource/CDOResourcePackage.java36
-rw-r--r--plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/common/protocol/CDOProtocolConstants.java2
-rw-r--r--plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/common/revision/CDORevision.java5
-rw-r--r--plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/common/revision/CDORevisionData.java21
-rw-r--r--plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/common/revision/CDORevisionFactory.java5
-rw-r--r--plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/common/revision/CDORevisionResolver.java5
-rw-r--r--plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/common/revision/CDORevisionUtil.java17
-rw-r--r--plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/common/revision/cache/CDORevisionCache.java10
-rw-r--r--plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/common/revision/delta/CDOContainerFeatureDelta.java5
-rw-r--r--plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/common/revision/delta/CDOFeatureDelta.java5
-rw-r--r--plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/common/revision/delta/CDOFeatureDeltaVisitor.java1
-rw-r--r--plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/internal/common/CDOQueryInfoImpl.java4
-rw-r--r--plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/internal/common/id/CDOIDExternalImpl.java6
-rw-r--r--plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/internal/common/id/CDOIDMetaImpl.java7
-rw-r--r--plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/internal/common/id/CDOIDNullImpl.java8
-rw-r--r--plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/internal/common/id/CDOIDTempMetaImpl.java7
-rw-r--r--plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/internal/common/id/CDOIDTempObjectImpl.java7
-rw-r--r--plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/internal/common/io/CDODataInputImpl.java252
-rw-r--r--plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/internal/common/io/CDODataOutputImpl.java238
-rw-r--r--plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/internal/common/model/CDOClassImpl.java461
-rw-r--r--plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/internal/common/model/CDOClassInfoImpl.java109
-rw-r--r--plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/internal/common/model/CDOFeatureImpl.java360
-rw-r--r--plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/internal/common/model/CDOModelElementImpl.java93
-rw-r--r--plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/internal/common/model/CDOPackageImpl.java404
-rw-r--r--plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/internal/common/model/CDOPackageInfoImpl.java166
-rw-r--r--plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/internal/common/model/CDOPackageManagerImpl.java132
-rw-r--r--plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/internal/common/model/CDOPackageRegistryImpl.java650
-rw-r--r--plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/internal/common/model/CDOPackageUnitImpl.java362
-rw-r--r--plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/internal/common/model/CDOTypeImpl.java67
-rw-r--r--plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/internal/common/model/GenUtil.java (renamed from plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/internal/cdo/util/GenUtil.java)2
-rw-r--r--plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/internal/common/model/TestTransfer.java148
-rw-r--r--plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/internal/common/model/core/CDOCorePackageImpl.java47
-rw-r--r--plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/internal/common/model/core/CDOFeatureMapEntryDataTypeImpl.java47
-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.java32
-rw-r--r--plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/internal/common/model/resource/CDOFolderFeatureImpl.java32
-rw-r--r--plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/internal/common/model/resource/CDONameFeatureImpl.java27
-rw-r--r--plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/internal/common/model/resource/CDONodesFeatureImpl.java32
-rw-r--r--plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/internal/common/model/resource/CDOResourceClassImpl.java69
-rw-r--r--plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/internal/common/model/resource/CDOResourceFolderClassImpl.java57
-rw-r--r--plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/internal/common/model/resource/CDOResourceNodeClassImpl.java61
-rw-r--r--plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/internal/common/model/resource/CDOResourcePackageImpl.java63
-rw-r--r--plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/internal/common/revision/CDOListImpl.java10
-rw-r--r--plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/internal/common/revision/CDORevisionImpl.java34
-rw-r--r--plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/internal/common/revision/CDORevisionResolverImpl.java9
-rw-r--r--plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/internal/common/revision/cache/lru/LRURevisionCache.java35
-rw-r--r--plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/internal/common/revision/cache/mem/MEMRevisionCache.java33
-rw-r--r--plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/internal/common/revision/cache/two/TwoLevelRevisionCache.java37
-rw-r--r--plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/internal/common/revision/delta/CDOAddFeatureDeltaImpl.java11
-rw-r--r--plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/internal/common/revision/delta/CDOClearFeatureDeltaImpl.java11
-rw-r--r--plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/internal/common/revision/delta/CDOContainerFeatureDeltaImpl.java105
-rw-r--r--plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/internal/common/revision/delta/CDOFeatureDeltaImpl.java19
-rw-r--r--plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/internal/common/revision/delta/CDOListFeatureDeltaImpl.java24
-rw-r--r--plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/internal/common/revision/delta/CDOMoveFeatureDeltaImpl.java15
-rw-r--r--plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/internal/common/revision/delta/CDORemoveFeatureDeltaImpl.java15
-rw-r--r--plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/internal/common/revision/delta/CDORevisionDeltaImpl.java34
-rw-r--r--plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/internal/common/revision/delta/CDOSetFeatureDeltaImpl.java11
-rw-r--r--plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/internal/common/revision/delta/CDOSingleValueFeatureDeltaImpl.java24
-rw-r--r--plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/internal/common/revision/delta/CDOUnsetFeatureDeltaImpl.java11
-rw-r--r--plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/spi/common/id/AbstractCDOID.java14
-rw-r--r--plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/spi/common/id/AbstractCDOIDInteger.java2
-rw-r--r--plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/spi/common/id/AbstractCDOIDLong.java17
-rw-r--r--plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/spi/common/id/CDOIDLibraryDescriptorImpl.java27
-rw-r--r--plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/spi/common/id/CDOIDLongImpl.java7
-rw-r--r--plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/spi/common/model/InternalCDOClass.java37
-rw-r--r--plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/spi/common/model/InternalCDOFeature.java42
-rw-r--r--plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/spi/common/model/InternalCDOPackage.java40
-rw-r--r--plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/spi/common/model/InternalCDOPackageInfo.java (renamed from plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/spi/common/model/InternalCDOModelElement.java)21
-rw-r--r--plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/spi/common/model/InternalCDOPackageManager.java33
-rw-r--r--plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/spi/common/model/InternalCDOPackageRegistry.java91
-rw-r--r--plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/spi/common/model/InternalCDOPackageUnit.java43
-rw-r--r--plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/spi/common/revision/AbstractCDORevision.java182
-rw-r--r--plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/spi/common/revision/CDORevisionMerger.java (renamed from plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/internal/common/revision/delta/CDORevisionMerger.java)4
-rw-r--r--plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/spi/common/revision/InternalCDOList.java8
-rw-r--r--plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/spi/common/revision/InternalCDORevision.java31
-rw-r--r--plugins/org.eclipse.emf.cdo.defs/src/org/eclipse/emf/cdo/defs/EDynamicPackageDef.java2
-rw-r--r--plugins/org.eclipse.emf.cdo.defs/src/org/eclipse/emf/cdo/defs/EGlobalPackageDef.java2
-rw-r--r--plugins/org.eclipse.emf.cdo.defs/src/org/eclipse/emf/cdo/defs/EPackageDef.java2
-rw-r--r--plugins/org.eclipse.emf.cdo.defs/src/org/eclipse/emf/cdo/defs/impl/CDODefsFactoryImpl.java4
-rw-r--r--plugins/org.eclipse.emf.cdo.defs/src/org/eclipse/emf/cdo/defs/impl/CDODefsPackageImpl.java16
-rw-r--r--plugins/org.eclipse.emf.cdo.defs/src/org/eclipse/emf/cdo/defs/impl/CDOEagerPackageRegistryDefImpl.java7
-rw-r--r--plugins/org.eclipse.emf.cdo.defs/src/org/eclipse/emf/cdo/defs/impl/CDOLazyPackageRegistryDefImpl.java7
-rw-r--r--plugins/org.eclipse.emf.cdo.defs/src/org/eclipse/emf/cdo/defs/impl/CDOPackageRegistryDefImpl.java5
-rw-r--r--plugins/org.eclipse.emf.cdo.defs/src/org/eclipse/emf/cdo/defs/impl/CDOSessionDefImpl.java26
-rw-r--r--plugins/org.eclipse.emf.cdo.defs/src/org/eclipse/emf/cdo/defs/impl/EDynamicPackageDefImpl.java2
-rw-r--r--plugins/org.eclipse.emf.cdo.defs/src/org/eclipse/emf/cdo/defs/impl/EPackageDefImpl.java2
-rw-r--r--plugins/org.eclipse.emf.cdo.defs/src/org/eclipse/emf/cdo/defs/util/CDODefsSwitch.java6
-rw-r--r--plugins/org.eclipse.emf.cdo.defs/src/org/eclipse/emf/cdo/defs/util/CDODefsUtil.java16
-rw-r--r--plugins/org.eclipse.emf.cdo.edit/.settings/.api_filters15
-rw-r--r--plugins/org.eclipse.emf.cdo.edit/plugin.xml2
-rw-r--r--plugins/org.eclipse.emf.cdo.edit/src/org/eclipse/emf/cdo/eresource/provider/CDOResourceFolderItemProvider.java7
-rw-r--r--plugins/org.eclipse.emf.cdo.edit/src/org/eclipse/emf/cdo/eresource/provider/CDOResourceItemProvider.java7
-rw-r--r--plugins/org.eclipse.emf.cdo.edit/src/org/eclipse/emf/cdo/eresource/provider/CDOResourceNodeItemProvider.java7
-rw-r--r--plugins/org.eclipse.emf.cdo.edit/src/org/eclipse/emf/cdo/eresource/provider/EresourceEditPlugin.java7
-rw-r--r--plugins/org.eclipse.emf.cdo.edit/src/org/eclipse/emf/cdo/eresource/provider/EresourceItemProviderAdapterFactory.java13
-rw-r--r--plugins/org.eclipse.emf.cdo.server.db/META-INF/MANIFEST.MF4
-rw-r--r--plugins/org.eclipse.emf.cdo.server.db/plugin.xml4
-rw-r--r--plugins/org.eclipse.emf.cdo.server.db/src/org/eclipse/emf/cdo/server/db/CDODBUtil.java3
-rw-r--r--plugins/org.eclipse.emf.cdo.server.db/src/org/eclipse/emf/cdo/server/db/IDBStore.java13
-rw-r--r--plugins/org.eclipse.emf.cdo.server.db/src/org/eclipse/emf/cdo/server/db/IDBStoreAccessor.java6
-rw-r--r--plugins/org.eclipse.emf.cdo.server.db/src/org/eclipse/emf/cdo/server/db/IJDBCDelegate.java131
-rw-r--r--plugins/org.eclipse.emf.cdo.server.db/src/org/eclipse/emf/cdo/server/db/IObjectTypeCache.java9
-rw-r--r--plugins/org.eclipse.emf.cdo.server.db/src/org/eclipse/emf/cdo/server/db/IReferenceMapping.java49
-rw-r--r--plugins/org.eclipse.emf.cdo.server.db/src/org/eclipse/emf/cdo/server/db/mapping/IAttributeMapping.java (renamed from plugins/org.eclipse.emf.cdo.server.db/src/org/eclipse/emf/cdo/server/db/IAttributeMapping.java)16
-rw-r--r--plugins/org.eclipse.emf.cdo.server.db/src/org/eclipse/emf/cdo/server/db/mapping/IClassMapping.java (renamed from plugins/org.eclipse.emf.cdo.server.db/src/org/eclipse/emf/cdo/server/db/IClassMapping.java)36
-rw-r--r--plugins/org.eclipse.emf.cdo.server.db/src/org/eclipse/emf/cdo/server/db/mapping/IFeatureMapping.java (renamed from plugins/org.eclipse.emf.cdo.server.db/src/org/eclipse/emf/cdo/server/db/IFeatureMapping.java)6
-rw-r--r--plugins/org.eclipse.emf.cdo.server.db/src/org/eclipse/emf/cdo/server/db/mapping/IMappingStrategy.java (renamed from plugins/org.eclipse.emf.cdo.server.db/src/org/eclipse/emf/cdo/server/db/IMappingStrategy.java)27
-rw-r--r--plugins/org.eclipse.emf.cdo.server.db/src/org/eclipse/emf/cdo/server/db/mapping/IReferenceMapping.java99
-rw-r--r--plugins/org.eclipse.emf.cdo.server.db/src/org/eclipse/emf/cdo/server/internal/db/CDODBSchema.java133
-rw-r--r--plugins/org.eclipse.emf.cdo.server.db/src/org/eclipse/emf/cdo/server/internal/db/ClassServerInfo.java91
-rw-r--r--plugins/org.eclipse.emf.cdo.server.db/src/org/eclipse/emf/cdo/server/internal/db/DBStore.java314
-rw-r--r--plugins/org.eclipse.emf.cdo.server.db/src/org/eclipse/emf/cdo/server/internal/db/DBStoreAccessor.java587
-rw-r--r--plugins/org.eclipse.emf.cdo.server.db/src/org/eclipse/emf/cdo/server/internal/db/DBStoreChunkReader.java15
-rw-r--r--plugins/org.eclipse.emf.cdo.server.db/src/org/eclipse/emf/cdo/server/internal/db/DBStoreFactory.java2
-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/ObjectIDIterator.java2
-rw-r--r--plugins/org.eclipse.emf.cdo.server.db/src/org/eclipse/emf/cdo/server/internal/db/ObjectTypeCache.java24
-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/Precedence.java19
-rw-r--r--plugins/org.eclipse.emf.cdo.server.db/src/org/eclipse/emf/cdo/server/internal/db/ServerInfo.java58
-rw-r--r--plugins/org.eclipse.emf.cdo.server.db/src/org/eclipse/emf/cdo/server/internal/db/jdbc/AbstractJDBCDelegate.java291
-rw-r--r--plugins/org.eclipse.emf.cdo.server.db/src/org/eclipse/emf/cdo/server/internal/db/jdbc/JDBCPerformanceReporter.java89
-rw-r--r--plugins/org.eclipse.emf.cdo.server.db/src/org/eclipse/emf/cdo/server/internal/db/jdbc/PreparedStatementJDBCDelegate.java1128
-rw-r--r--plugins/org.eclipse.emf.cdo.server.db/src/org/eclipse/emf/cdo/server/internal/db/jdbc/StatementJDBCDelegate.java377
-rw-r--r--plugins/org.eclipse.emf.cdo.server.db/src/org/eclipse/emf/cdo/server/internal/db/mapping/AttributeMapping.java (renamed from plugins/org.eclipse.emf.cdo.server.db/src/org/eclipse/emf/cdo/server/internal/db/AttributeMapping.java)64
-rw-r--r--plugins/org.eclipse.emf.cdo.server.db/src/org/eclipse/emf/cdo/server/internal/db/mapping/ClassMapping.java (renamed from plugins/org.eclipse.emf.cdo.server.db/src/org/eclipse/emf/cdo/server/internal/db/ClassMapping.java)286
-rw-r--r--plugins/org.eclipse.emf.cdo.server.db/src/org/eclipse/emf/cdo/server/internal/db/mapping/FeatureMapping.java (renamed from plugins/org.eclipse.emf.cdo.server.db/src/org/eclipse/emf/cdo/server/internal/db/FeatureMapping.java)12
-rw-r--r--plugins/org.eclipse.emf.cdo.server.db/src/org/eclipse/emf/cdo/server/internal/db/mapping/HorizontalClassMapping.java (renamed from plugins/org.eclipse.emf.cdo.server.db/src/org/eclipse/emf/cdo/server/internal/db/HorizontalClassMapping.java)32
-rw-r--r--plugins/org.eclipse.emf.cdo.server.db/src/org/eclipse/emf/cdo/server/internal/db/mapping/HorizontalMappingStrategy.java (renamed from plugins/org.eclipse.emf.cdo.server.db/src/org/eclipse/emf/cdo/server/internal/db/HorizontalMappingStrategy.java)148
-rw-r--r--plugins/org.eclipse.emf.cdo.server.db/src/org/eclipse/emf/cdo/server/internal/db/mapping/MappingStrategy.java (renamed from plugins/org.eclipse.emf.cdo.server.db/src/org/eclipse/emf/cdo/server/internal/db/MappingStrategy.java)180
-rw-r--r--plugins/org.eclipse.emf.cdo.server.db/src/org/eclipse/emf/cdo/server/internal/db/mapping/NoClassMapping.java (renamed from plugins/org.eclipse.emf.cdo.server.db/src/org/eclipse/emf/cdo/server/internal/db/NoClassMapping.java)44
-rw-r--r--plugins/org.eclipse.emf.cdo.server.db/src/org/eclipse/emf/cdo/server/internal/db/mapping/ReferenceMapping.java (renamed from plugins/org.eclipse.emf.cdo.server.db/src/org/eclipse/emf/cdo/server/internal/db/ReferenceMapping.java)117
-rw-r--r--plugins/org.eclipse.emf.cdo.server.db/src/org/eclipse/emf/cdo/server/internal/db/mapping/RootClassMapping.java (renamed from plugins/org.eclipse.emf.cdo.server.db/src/org/eclipse/emf/cdo/server/internal/db/RootClassMapping.java)13
-rw-r--r--plugins/org.eclipse.emf.cdo.server.db/src/org/eclipse/emf/cdo/server/internal/db/mapping/ToOneReferenceMapping.java (renamed from plugins/org.eclipse.emf.cdo.server.db/src/org/eclipse/emf/cdo/server/internal/db/ToOneReferenceMapping.java)11
-rw-r--r--plugins/org.eclipse.emf.cdo.server.db/src/org/eclipse/emf/cdo/server/internal/db/mapping/VerticalClassMapping.java (renamed from plugins/org.eclipse.emf.cdo.server.db/src/org/eclipse/emf/cdo/server/internal/db/VerticalClassMapping.java)17
-rw-r--r--plugins/org.eclipse.emf.cdo.server.db/src/org/eclipse/emf/cdo/server/internal/db/mapping/VerticalMappingStrategy.java (renamed from plugins/org.eclipse.emf.cdo.server.db/src/org/eclipse/emf/cdo/server/internal/db/VerticalMappingStrategy.java)20
-rw-r--r--plugins/org.eclipse.emf.cdo.server.hibernate.teneo/src/org/eclipse/emf/cdo/server/hibernate/internal/teneo/TeneoHibernateMappingProvider.java11
-rw-r--r--plugins/org.eclipse.emf.cdo.server.hibernate/mappings/resource.hbm.xml6
-rw-r--r--plugins/org.eclipse.emf.cdo.server.hibernate/src/org/eclipse/emf/cdo/server/hibernate/IHibernateStoreAccessor.java7
-rw-r--r--plugins/org.eclipse.emf.cdo.server.hibernate/src/org/eclipse/emf/cdo/server/internal/hibernate/HibernateCommitContext.java25
-rw-r--r--plugins/org.eclipse.emf.cdo.server.hibernate/src/org/eclipse/emf/cdo/server/internal/hibernate/HibernatePackageHandler.java210
-rw-r--r--plugins/org.eclipse.emf.cdo.server.hibernate/src/org/eclipse/emf/cdo/server/internal/hibernate/HibernateStore.java14
-rw-r--r--plugins/org.eclipse.emf.cdo.server.hibernate/src/org/eclipse/emf/cdo/server/internal/hibernate/HibernateStoreAccessor.java91
-rw-r--r--plugins/org.eclipse.emf.cdo.server.hibernate/src/org/eclipse/emf/cdo/server/internal/hibernate/HibernateStoreChunkReader.java7
-rw-r--r--plugins/org.eclipse.emf.cdo.server.hibernate/src/org/eclipse/emf/cdo/server/internal/hibernate/HibernateUtil.java18
-rw-r--r--plugins/org.eclipse.emf.cdo.server.hibernate/src/org/eclipse/emf/cdo/server/internal/hibernate/tuplizer/CDOIDPropertySetter.java4
-rw-r--r--plugins/org.eclipse.emf.cdo.server.hibernate/src/org/eclipse/emf/cdo/server/internal/hibernate/tuplizer/CDOInterceptor.java2
-rw-r--r--plugins/org.eclipse.emf.cdo.server.hibernate/src/org/eclipse/emf/cdo/server/internal/hibernate/tuplizer/CDOManyReferenceGetter.java5
-rw-r--r--plugins/org.eclipse.emf.cdo.server.hibernate/src/org/eclipse/emf/cdo/server/internal/hibernate/tuplizer/CDOManyReferenceSetter.java4
-rw-r--r--plugins/org.eclipse.emf.cdo.server.hibernate/src/org/eclipse/emf/cdo/server/internal/hibernate/tuplizer/CDOPropertyGetter.java2
-rw-r--r--plugins/org.eclipse.emf.cdo.server.hibernate/src/org/eclipse/emf/cdo/server/internal/hibernate/tuplizer/CDOPropertyHandler.java15
-rw-r--r--plugins/org.eclipse.emf.cdo.server.hibernate/src/org/eclipse/emf/cdo/server/internal/hibernate/tuplizer/CDOPropertySetter.java2
-rw-r--r--plugins/org.eclipse.emf.cdo.server.hibernate/src/org/eclipse/emf/cdo/server/internal/hibernate/tuplizer/CDORevisionInstantiator.java10
-rw-r--r--plugins/org.eclipse.emf.cdo.server.hibernate/src/org/eclipse/emf/cdo/server/internal/hibernate/tuplizer/CDORevisionPropertyAccessor.java17
-rw-r--r--plugins/org.eclipse.emf.cdo.server.hibernate/src/org/eclipse/emf/cdo/server/internal/hibernate/tuplizer/CDORevisionProxy.java55
-rw-r--r--plugins/org.eclipse.emf.cdo.server.hibernate/src/org/eclipse/emf/cdo/server/internal/hibernate/tuplizer/CDORevisionTuplizer.java79
-rw-r--r--plugins/org.eclipse.emf.cdo.server.hibernate/src/org/eclipse/emf/cdo/server/internal/hibernate/tuplizer/CDOSyntheticIdPropertyHandler.java6
-rw-r--r--plugins/org.eclipse.emf.cdo.server.hibernate/src/org/eclipse/emf/cdo/server/internal/hibernate/tuplizer/PersistableListHolder.java27
-rw-r--r--plugins/org.eclipse.emf.cdo.server.hibernate/src/org/eclipse/emf/cdo/server/internal/hibernate/tuplizer/WrappedHibernateList.java11
-rw-r--r--plugins/org.eclipse.emf.cdo.server/.settings/.api_filters118
-rw-r--r--plugins/org.eclipse.emf.cdo.server/.settings/org.eclipse.jdt.core.prefs3
-rw-r--r--plugins/org.eclipse.emf.cdo.server/CDOServer.launch4
-rw-r--r--plugins/org.eclipse.emf.cdo.server/META-INF/MANIFEST.MF9
-rw-r--r--plugins/org.eclipse.emf.cdo.server/plugin.xml2
-rw-r--r--plugins/org.eclipse.emf.cdo.server/src/org/eclipse/emf/cdo/internal/server/CommitManager.java3
-rw-r--r--plugins/org.eclipse.emf.cdo.server/src/org/eclipse/emf/cdo/internal/server/LockManager.java3
-rw-r--r--plugins/org.eclipse.emf.cdo.server/src/org/eclipse/emf/cdo/internal/server/NotificationManager.java6
-rw-r--r--plugins/org.eclipse.emf.cdo.server/src/org/eclipse/emf/cdo/internal/server/PackageManager.java102
-rw-r--r--plugins/org.eclipse.emf.cdo.server/src/org/eclipse/emf/cdo/internal/server/QueryManager.java4
-rw-r--r--plugins/org.eclipse.emf.cdo.server/src/org/eclipse/emf/cdo/internal/server/Repository.java177
-rw-r--r--plugins/org.eclipse.emf.cdo.server/src/org/eclipse/emf/cdo/internal/server/RevisionManager.java32
-rw-r--r--plugins/org.eclipse.emf.cdo.server/src/org/eclipse/emf/cdo/internal/server/Session.java54
-rw-r--r--plugins/org.eclipse.emf.cdo.server/src/org/eclipse/emf/cdo/internal/server/SessionManager.java7
-rw-r--r--plugins/org.eclipse.emf.cdo.server/src/org/eclipse/emf/cdo/internal/server/StoreAccessor.java368
-rw-r--r--plugins/org.eclipse.emf.cdo.server/src/org/eclipse/emf/cdo/internal/server/Transaction.java18
-rw-r--r--plugins/org.eclipse.emf.cdo.server/src/org/eclipse/emf/cdo/internal/server/TransactionCommitContextImpl.java277
-rw-r--r--plugins/org.eclipse.emf.cdo.server/src/org/eclipse/emf/cdo/internal/server/mem/MEMStore.java (renamed from plugins/org.eclipse.emf.cdo.server/src/org/eclipse/emf/cdo/internal/server/MEMStore.java)95
-rw-r--r--plugins/org.eclipse.emf.cdo.server/src/org/eclipse/emf/cdo/internal/server/mem/MEMStoreAccessor.java (renamed from plugins/org.eclipse.emf.cdo.server/src/org/eclipse/emf/cdo/internal/server/MEMStoreAccessor.java)86
-rw-r--r--plugins/org.eclipse.emf.cdo.server/src/org/eclipse/emf/cdo/internal/server/mem/MEMStoreChunkReader.java (renamed from plugins/org.eclipse.emf.cdo.server/src/org/eclipse/emf/cdo/internal/server/MEMStoreChunkReader.java)8
-rw-r--r--plugins/org.eclipse.emf.cdo.server/src/org/eclipse/emf/cdo/internal/server/mem/MEMStoreFactory.java (renamed from plugins/org.eclipse.emf.cdo.server/src/org/eclipse/emf/cdo/internal/server/MEMStoreFactory.java)2
-rw-r--r--plugins/org.eclipse.emf.cdo.server/src/org/eclipse/emf/cdo/internal/server/protocol/CDOServerIndication.java60
-rw-r--r--plugins/org.eclipse.emf.cdo.server/src/org/eclipse/emf/cdo/internal/server/protocol/CDOServerProtocol.java14
-rw-r--r--plugins/org.eclipse.emf.cdo.server/src/org/eclipse/emf/cdo/internal/server/protocol/CDOServerRequest.java68
-rw-r--r--plugins/org.eclipse.emf.cdo.server/src/org/eclipse/emf/cdo/internal/server/protocol/ChangeSubscriptionIndication.java7
-rw-r--r--plugins/org.eclipse.emf.cdo.server/src/org/eclipse/emf/cdo/internal/server/protocol/CommitNotificationRequest.java25
-rw-r--r--plugins/org.eclipse.emf.cdo.server/src/org/eclipse/emf/cdo/internal/server/protocol/CommitTransactionCancelIndication.java4
-rw-r--r--plugins/org.eclipse.emf.cdo.server/src/org/eclipse/emf/cdo/internal/server/protocol/CommitTransactionIndication.java135
-rw-r--r--plugins/org.eclipse.emf.cdo.server/src/org/eclipse/emf/cdo/internal/server/protocol/CommitTransactionPhase1Indication.java2
-rw-r--r--plugins/org.eclipse.emf.cdo.server/src/org/eclipse/emf/cdo/internal/server/protocol/CommitTransactionPhase2Indication.java4
-rw-r--r--plugins/org.eclipse.emf.cdo.server/src/org/eclipse/emf/cdo/internal/server/protocol/CommitTransactionPhase3Indication.java4
-rw-r--r--plugins/org.eclipse.emf.cdo.server/src/org/eclipse/emf/cdo/internal/server/protocol/GetRemoteSessionsIndication.java9
-rw-r--r--plugins/org.eclipse.emf.cdo.server/src/org/eclipse/emf/cdo/internal/server/protocol/LoadChunkIndication.java42
-rw-r--r--plugins/org.eclipse.emf.cdo.server/src/org/eclipse/emf/cdo/internal/server/protocol/LoadLibrariesIndication.java15
-rw-r--r--plugins/org.eclipse.emf.cdo.server/src/org/eclipse/emf/cdo/internal/server/protocol/LoadPackageIndication.java84
-rw-r--r--plugins/org.eclipse.emf.cdo.server/src/org/eclipse/emf/cdo/internal/server/protocol/LoadPackagesIndication.java62
-rw-r--r--plugins/org.eclipse.emf.cdo.server/src/org/eclipse/emf/cdo/internal/server/protocol/LoadRevisionByTimeIndication.java9
-rw-r--r--plugins/org.eclipse.emf.cdo.server/src/org/eclipse/emf/cdo/internal/server/protocol/LoadRevisionByVersionIndication.java8
-rw-r--r--plugins/org.eclipse.emf.cdo.server/src/org/eclipse/emf/cdo/internal/server/protocol/LoadRevisionIndication.java51
-rw-r--r--plugins/org.eclipse.emf.cdo.server/src/org/eclipse/emf/cdo/internal/server/protocol/OpenSessionIndication.java56
-rw-r--r--plugins/org.eclipse.emf.cdo.server/src/org/eclipse/emf/cdo/internal/server/protocol/QueryIndication.java2
-rw-r--r--plugins/org.eclipse.emf.cdo.server/src/org/eclipse/emf/cdo/internal/server/protocol/RepositoryTimeIndication.java11
-rw-r--r--plugins/org.eclipse.emf.cdo.server/src/org/eclipse/emf/cdo/internal/server/protocol/ResourceIDIndication.java14
-rw-r--r--plugins/org.eclipse.emf.cdo.server/src/org/eclipse/emf/cdo/internal/server/protocol/SetAuditIndication.java26
-rw-r--r--plugins/org.eclipse.emf.cdo.server/src/org/eclipse/emf/cdo/internal/server/protocol/SetPassiveUpdateIndication.java7
-rw-r--r--plugins/org.eclipse.emf.cdo.server/src/org/eclipse/emf/cdo/internal/server/protocol/SyncRevisionsIndication.java15
-rw-r--r--plugins/org.eclipse.emf.cdo.server/src/org/eclipse/emf/cdo/internal/server/protocol/UnsubscribeRemoteSessionsIndication.java27
-rw-r--r--plugins/org.eclipse.emf.cdo.server/src/org/eclipse/emf/cdo/internal/server/protocol/VerifyRevisionIndication.java13
-rw-r--r--plugins/org.eclipse.emf.cdo.server/src/org/eclipse/emf/cdo/internal/server/protocol/ViewsChangedIndication.java3
-rw-r--r--plugins/org.eclipse.emf.cdo.server/src/org/eclipse/emf/cdo/server/INotificationManager.java16
-rw-r--r--plugins/org.eclipse.emf.cdo.server/src/org/eclipse/emf/cdo/server/IRepository.java19
-rw-r--r--plugins/org.eclipse.emf.cdo.server/src/org/eclipse/emf/cdo/server/IRepositoryElement.java27
-rw-r--r--plugins/org.eclipse.emf.cdo.server/src/org/eclipse/emf/cdo/server/IRevisionManager.java10
-rw-r--r--plugins/org.eclipse.emf.cdo.server/src/org/eclipse/emf/cdo/server/ISession.java1
-rw-r--r--plugins/org.eclipse.emf.cdo.server/src/org/eclipse/emf/cdo/server/ISessionManager.java11
-rw-r--r--plugins/org.eclipse.emf.cdo.server/src/org/eclipse/emf/cdo/server/IStore.java25
-rw-r--r--plugins/org.eclipse.emf.cdo.server/src/org/eclipse/emf/cdo/server/IStoreAccessor.java63
-rw-r--r--plugins/org.eclipse.emf.cdo.server/src/org/eclipse/emf/cdo/server/IStoreChunkReader.java5
-rw-r--r--plugins/org.eclipse.emf.cdo.server/src/org/eclipse/emf/cdo/server/IView.java1
-rw-r--r--plugins/org.eclipse.emf.cdo.server/src/org/eclipse/emf/cdo/server/StoreThreadLocal.java21
-rw-r--r--plugins/org.eclipse.emf.cdo.server/src/org/eclipse/emf/cdo/server/StoreUtil.java80
-rw-r--r--plugins/org.eclipse.emf.cdo.server/src/org/eclipse/emf/cdo/server/mem/MEMStoreUtil.java (renamed from plugins/org.eclipse.emf.cdo.server/src/org/eclipse/emf/cdo/server/IPackageManager.java)17
-rw-r--r--plugins/org.eclipse.emf.cdo.server/src/org/eclipse/emf/cdo/spi/server/LongIDStore.java (renamed from plugins/org.eclipse.emf.cdo.server/src/org/eclipse/emf/cdo/internal/server/LongIDStore.java)29
-rw-r--r--plugins/org.eclipse.emf.cdo.server/src/org/eclipse/emf/cdo/spi/server/LongIDStoreAccessor.java66
-rw-r--r--plugins/org.eclipse.emf.cdo.server/src/org/eclipse/emf/cdo/spi/server/Store.java (renamed from plugins/org.eclipse.emf.cdo.server/src/org/eclipse/emf/cdo/internal/server/Store.java)82
-rw-r--r--plugins/org.eclipse.emf.cdo.server/src/org/eclipse/emf/cdo/spi/server/StoreAccessor.java249
-rw-r--r--plugins/org.eclipse.emf.cdo.server/src/org/eclipse/emf/cdo/spi/server/StoreAccessorPool.java (renamed from plugins/org.eclipse.emf.cdo.server/src/org/eclipse/emf/cdo/internal/server/StoreAccessorPool.java)2
-rw-r--r--plugins/org.eclipse.emf.cdo.server/src/org/eclipse/emf/cdo/spi/server/StoreChunkReader.java (renamed from plugins/org.eclipse.emf.cdo.server/src/org/eclipse/emf/cdo/internal/server/StoreChunkReader.java)11
-rw-r--r--plugins/org.eclipse.emf.cdo.tests.hibernate/src/org/eclipse/emf/cdo/tests/hibernate/HbCDOAutomaticPackageRefTest.java8
-rw-r--r--plugins/org.eclipse.emf.cdo.tests.hibernate/src/org/eclipse/emf/cdo/tests/hibernate/HbCDOPackageRefTest.java2
-rw-r--r--plugins/org.eclipse.emf.cdo.tests/.classpath2
-rw-r--r--plugins/org.eclipse.emf.cdo.tests/CDO AllTests (DB Hsqldb - nonaudit).launch20
-rw-r--r--plugins/org.eclipse.emf.cdo.tests/CDO AllTests (DB HsqldbPrepStmt - nonaudit).launch20
-rw-r--r--plugins/org.eclipse.emf.cdo.tests/CDO AllTests.launch1
-rw-r--r--plugins/org.eclipse.emf.cdo.tests/META-INF/MANIFEST.MF7
-rw-r--r--plugins/org.eclipse.emf.cdo.tests/src/TestClient.java81
-rw-r--r--plugins/org.eclipse.emf.cdo.tests/src/TestClient2.java73
-rw-r--r--plugins/org.eclipse.emf.cdo.tests/src/TestServer.java95
-rw-r--r--plugins/org.eclipse.emf.cdo.tests/src/org/eclipse/emf/cdo/tests/AbstractCDOTest.java7
-rw-r--r--plugins/org.eclipse.emf.cdo.tests/src/org/eclipse/emf/cdo/tests/AllTestsDBHsqldbNonAudit.java53
-rw-r--r--plugins/org.eclipse.emf.cdo.tests/src/org/eclipse/emf/cdo/tests/AllTestsDBHsqldbPrepStmtNonAudit.java51
-rw-r--r--plugins/org.eclipse.emf.cdo.tests/src/org/eclipse/emf/cdo/tests/AttributeTest.java7
-rw-r--r--plugins/org.eclipse.emf.cdo.tests/src/org/eclipse/emf/cdo/tests/AuditTest.java32
-rw-r--r--plugins/org.eclipse.emf.cdo.tests/src/org/eclipse/emf/cdo/tests/ChunkingTest.java11
-rw-r--r--plugins/org.eclipse.emf.cdo.tests/src/org/eclipse/emf/cdo/tests/ComplexTest.java10
-rw-r--r--plugins/org.eclipse.emf.cdo.tests/src/org/eclipse/emf/cdo/tests/ContainmentTest.java2
-rw-r--r--plugins/org.eclipse.emf.cdo.tests/src/org/eclipse/emf/cdo/tests/DymamicUmlTest.java4
-rw-r--r--plugins/org.eclipse.emf.cdo.tests/src/org/eclipse/emf/cdo/tests/EMFTest.java2
-rw-r--r--plugins/org.eclipse.emf.cdo.tests/src/org/eclipse/emf/cdo/tests/ExternalReferenceTest.java41
-rw-r--r--plugins/org.eclipse.emf.cdo.tests/src/org/eclipse/emf/cdo/tests/FetchRuleAnalyzerTest.java5
-rw-r--r--plugins/org.eclipse.emf.cdo.tests/src/org/eclipse/emf/cdo/tests/GeneratedEcoreTest.java2
-rw-r--r--plugins/org.eclipse.emf.cdo.tests/src/org/eclipse/emf/cdo/tests/ImportXML.java4
-rw-r--r--plugins/org.eclipse.emf.cdo.tests/src/org/eclipse/emf/cdo/tests/IndexReconstructionTest.java12
-rw-r--r--plugins/org.eclipse.emf.cdo.tests/src/org/eclipse/emf/cdo/tests/PackageRegistryTest.java110
-rw-r--r--plugins/org.eclipse.emf.cdo.tests/src/org/eclipse/emf/cdo/tests/RepositoryTest.java22
-rw-r--r--plugins/org.eclipse.emf.cdo.tests/src/org/eclipse/emf/cdo/tests/RevisionDeltaTest.java4
-rw-r--r--plugins/org.eclipse.emf.cdo.tests/src/org/eclipse/emf/cdo/tests/RevisionHolderTest.java55
-rw-r--r--plugins/org.eclipse.emf.cdo.tests/src/org/eclipse/emf/cdo/tests/RollbackTest.java9
-rw-r--r--plugins/org.eclipse.emf.cdo.tests/src/org/eclipse/emf/cdo/tests/StoreRepositoryProvider.java4
-rw-r--r--plugins/org.eclipse.emf.cdo.tests/src/org/eclipse/emf/cdo/tests/ViewTest.java10
-rw-r--r--plugins/org.eclipse.emf.cdo.tests/src/org/eclipse/emf/cdo/tests/XATransactionTest.java24
-rw-r--r--plugins/org.eclipse.emf.cdo.tests/src/org/eclipse/emf/cdo/tests/bugzilla/Bugzilla_246442_Test.java58
-rw-r--r--plugins/org.eclipse.emf.cdo.tests/src/org/eclipse/emf/cdo/tests/bugzilla/Bugzilla_246622_Test.java12
-rw-r--r--plugins/org.eclipse.emf.cdo.tests/src/org/eclipse/emf/cdo/tests/bugzilla/Bugzilla_251752_Test.java14
-rw-r--r--plugins/org.eclipse.emf.cdo.tests/src/org/eclipse/emf/cdo/tests/bugzilla/Bugzilla_256141_Test.java2
-rw-r--r--plugins/org.eclipse.emf.cdo.tests/src/org/eclipse/emf/cdo/tests/bugzilla/Bugzilla_258933_Test.java29
-rw-r--r--plugins/org.eclipse.emf.cdo.tests/src/org/eclipse/emf/cdo/tests/bugzilla/Bugzilla_260764_Test.java9
-rw-r--r--plugins/org.eclipse.emf.cdo.tests/src/org/eclipse/emf/cdo/tests/bugzilla/Bugzilla_261218_Test.java7
-rw-r--r--plugins/org.eclipse.emf.cdo.tests/src/org/eclipse/emf/cdo/tests/config/IConstants.java4
-rw-r--r--plugins/org.eclipse.emf.cdo.tests/src/org/eclipse/emf/cdo/tests/config/ISessionConfig.java4
-rw-r--r--plugins/org.eclipse.emf.cdo.tests/src/org/eclipse/emf/cdo/tests/config/impl/ConfigTest.java16
-rw-r--r--plugins/org.eclipse.emf.cdo.tests/src/org/eclipse/emf/cdo/tests/config/impl/RepositoryConfig.java101
-rw-r--r--plugins/org.eclipse.emf.cdo.tests/src/org/eclipse/emf/cdo/tests/config/impl/SessionConfig.java58
-rw-r--r--plugins/org.eclipse.emf.cdo.tests/src/org/eclipse/emf/cdo/tests/store/logic/TestLogic.java48
-rw-r--r--plugins/org.eclipse.emf.cdo.tests/src/org/eclipse/emf/cdo/tests/store/verifier/AbstractDBStoreVerifier.java24
-rw-r--r--plugins/org.eclipse.emf.cdo.tests/src/org/eclipse/emf/cdo/tests/store/verifier/AuditDBStoreIntegrityVerifier.java6
-rw-r--r--plugins/org.eclipse.emf.cdo.tests/src/org/eclipse/emf/cdo/tests/store/verifier/NonAuditDBStoreIntegrityVerifier.java6
-rw-r--r--plugins/org.eclipse.emf.cdo.ui.ide/src/org/eclipse/emf/cdo/ui/ide/Node.java2
-rw-r--r--plugins/org.eclipse.emf.cdo.ui/CDOClient1.launch102
-rw-r--r--plugins/org.eclipse.emf.cdo.ui/icons/full/obj16/EPackageDynamic.gifbin0 -> 364 bytes
-rw-r--r--plugins/org.eclipse.emf.cdo.ui/icons/full/obj16/EPackageLegacy.gifbin207 -> 207 bytes
-rw-r--r--plugins/org.eclipse.emf.cdo.ui/icons/full/obj16/EPackageUnknown.gifbin0 -> 207 bytes
-rw-r--r--plugins/org.eclipse.emf.cdo.ui/src/org/eclipse/emf/cdo/internal/ui/SharedIcons.java4
-rw-r--r--plugins/org.eclipse.emf.cdo.ui/src/org/eclipse/emf/cdo/internal/ui/actions/ExportResourceAction.java2
-rw-r--r--plugins/org.eclipse.emf.cdo.ui/src/org/eclipse/emf/cdo/internal/ui/actions/ImportRootsAction.java2
-rw-r--r--plugins/org.eclipse.emf.cdo.ui/src/org/eclipse/emf/cdo/internal/ui/actions/ManagePackagesAction.java8
-rw-r--r--plugins/org.eclipse.emf.cdo.ui/src/org/eclipse/emf/cdo/internal/ui/actions/OpenSessionAction.java12
-rw-r--r--plugins/org.eclipse.emf.cdo.ui/src/org/eclipse/emf/cdo/internal/ui/actions/RegisterFilesystemPackagesAction.java2
-rw-r--r--plugins/org.eclipse.emf.cdo.ui/src/org/eclipse/emf/cdo/internal/ui/actions/RegisterGeneratedPackagesAction.java1
-rw-r--r--plugins/org.eclipse.emf.cdo.ui/src/org/eclipse/emf/cdo/internal/ui/actions/RegisterPackagesAction.java2
-rw-r--r--plugins/org.eclipse.emf.cdo.ui/src/org/eclipse/emf/cdo/internal/ui/actions/RegisterSinglePackageAction.java20
-rw-r--r--plugins/org.eclipse.emf.cdo.ui/src/org/eclipse/emf/cdo/internal/ui/actions/RegisterWorkspacePackagesAction.java2
-rw-r--r--plugins/org.eclipse.emf.cdo.ui/src/org/eclipse/emf/cdo/internal/ui/actions/RemoveAllContainerItemAction.java2
-rw-r--r--plugins/org.eclipse.emf.cdo.ui/src/org/eclipse/emf/cdo/internal/ui/dialogs/PackageRegistryDialog.java (renamed from plugins/org.eclipse.emf.cdo.ui/src/org/eclipse/emf/cdo/internal/ui/dialogs/PackageManagerDialog.java)296
-rw-r--r--plugins/org.eclipse.emf.cdo.ui/src/org/eclipse/emf/cdo/internal/ui/dialogs/SelectPackageDialog.java20
-rw-r--r--plugins/org.eclipse.emf.cdo.ui/src/org/eclipse/emf/cdo/internal/ui/dnd/CDOObjectDropAdapter.java2
-rw-r--r--plugins/org.eclipse.emf.cdo.ui/src/org/eclipse/emf/cdo/internal/ui/editor/CDOEditor.java123
-rw-r--r--plugins/org.eclipse.emf.cdo.ui/src/org/eclipse/emf/cdo/ui/CDOEditorInput.java2
-rw-r--r--plugins/org.eclipse.emf.cdo.ui/src/org/eclipse/emf/cdo/ui/CDOItemProvider.java45
-rw-r--r--plugins/org.eclipse.emf.cdo.ui/src/org/eclipse/emf/cdo/ui/widgets/SessionComposite.java5
-rw-r--r--plugins/org.eclipse.emf.cdo/.classpath2
-rw-r--r--plugins/org.eclipse.emf.cdo/.settings/.api_filters83
-rw-r--r--plugins/org.eclipse.emf.cdo/about.ini2
-rw-r--r--plugins/org.eclipse.emf.cdo/model/eresource.ecore2
-rw-r--r--plugins/org.eclipse.emf.cdo/model/eresource.genmodel (renamed from plugins/org.eclipse.emf.cdo/model/resource.genmodel)0
-rw-r--r--plugins/org.eclipse.emf.cdo/plugin.xml2
-rw-r--r--plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/cdo/CDOObject.java9
-rw-r--r--plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/cdo/eresource/CDOResource.java7
-rw-r--r--plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/cdo/eresource/CDOResourceFolder.java7
-rw-r--r--plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/cdo/eresource/CDOResourceNode.java7
-rw-r--r--plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/cdo/eresource/EresourceFactory.java7
-rw-r--r--plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/cdo/eresource/EresourcePackage.java9
-rw-r--r--plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/cdo/eresource/impl/CDOResourceFolderImpl.java7
-rw-r--r--plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/cdo/eresource/impl/CDOResourceImpl.java11
-rw-r--r--plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/cdo/eresource/impl/CDOResourceNodeImpl.java7
-rw-r--r--plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/cdo/eresource/impl/EresourceFactoryImpl.java13
-rw-r--r--plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/cdo/eresource/impl/EresourcePackageImpl.java41
-rw-r--r--plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/cdo/eresource/util/EresourceAdapterFactory.java7
-rw-r--r--plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/cdo/eresource/util/EresourceSwitch.java17
-rw-r--r--plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/cdo/session/CDOCollectionLoadingPolicy.java11
-rw-r--r--plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/cdo/session/CDOPackageRegistry.java39
-rw-r--r--plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/cdo/session/CDOPackageType.java33
-rw-r--r--plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/cdo/session/CDOPackageTypeRegistry.java33
-rw-r--r--plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/cdo/session/CDORevisionManager.java5
-rw-r--r--plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/cdo/session/CDOSession.java46
-rw-r--r--plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/cdo/session/CDOSessionConfiguration.java15
-rw-r--r--plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/cdo/session/CDOSessionPackageManager.java67
-rw-r--r--plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/cdo/transaction/CDOCommitContext.java6
-rw-r--r--plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/cdo/transaction/CDOTransaction.java6
-rw-r--r--plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/cdo/util/CDOUtil.java18
-rw-r--r--plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/cdo/util/ModelUtil.java58
-rw-r--r--plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/cdo/view/CDOFeatureAnalyzer.java7
-rw-r--r--plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/internal/cdo/CDOFactoryImpl.java19
-rw-r--r--plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/internal/cdo/CDOLegacyWrapper.java63
-rw-r--r--plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/internal/cdo/CDOMetaWrapper.java4
-rw-r--r--plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/internal/cdo/CDONotificationBuilder.java12
-rw-r--r--plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/internal/cdo/CDOObjectImpl.java32
-rw-r--r--plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/internal/cdo/CDOObjectMerger.java2
-rw-r--r--plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/internal/cdo/CDOStateMachine.java8
-rw-r--r--plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/internal/cdo/CDOStore.java292
-rw-r--r--plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/internal/cdo/analyzer/CDOAbstractFeatureRuleAnalyzer.java17
-rw-r--r--plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/internal/cdo/analyzer/CDOAnalyzerFeatureInfo.java49
-rw-r--r--plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/internal/cdo/analyzer/CDOClusterOfFetchRule.java12
-rw-r--r--plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/internal/cdo/analyzer/CDOFeatureAnalyzerModelBased.java11
-rw-r--r--plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/internal/cdo/analyzer/CDOFeatureAnalyzerUI.java36
-rw-r--r--plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/internal/cdo/analyzer/CDOFetchFeatureInfo.java26
-rw-r--r--plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/internal/cdo/analyzer/NOOPFeatureAnalyzer.java7
-rw-r--r--plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/internal/cdo/analyzer/NOOPFetchRuleManager.java6
-rw-r--r--plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/internal/cdo/bundle/Activator.java3
-rw-r--r--plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/internal/cdo/bundle/OM.java8
-rw-r--r--plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/internal/cdo/net4j/CDONet4jSessionFactory.java9
-rw-r--r--plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/internal/cdo/net4j/protocol/CDOClientIndication.java56
-rw-r--r--plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/internal/cdo/net4j/protocol/CDOClientProtocol.java21
-rw-r--r--plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/internal/cdo/net4j/protocol/CDOClientRequest.java63
-rw-r--r--plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/internal/cdo/net4j/protocol/CDOTimeRequest.java18
-rw-r--r--plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/internal/cdo/net4j/protocol/ChangeSubscriptionRequest.java7
-rw-r--r--plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/internal/cdo/net4j/protocol/CommitNotificationIndication.java33
-rw-r--r--plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/internal/cdo/net4j/protocol/CommitTransactionRequest.java112
-rw-r--r--plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/internal/cdo/net4j/protocol/GetRemoteSessionsRequest.java7
-rw-r--r--plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/internal/cdo/net4j/protocol/LoadChunkRequest.java38
-rw-r--r--plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/internal/cdo/net4j/protocol/LoadLibrariesRequest.java14
-rw-r--r--plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/internal/cdo/net4j/protocol/LoadPackageRequest.java59
-rw-r--r--plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/internal/cdo/net4j/protocol/LoadPackagesRequest.java61
-rw-r--r--plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/internal/cdo/net4j/protocol/LoadRevisionByTimeRequest.java7
-rw-r--r--plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/internal/cdo/net4j/protocol/LoadRevisionByVersionRequest.java7
-rw-r--r--plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/internal/cdo/net4j/protocol/LoadRevisionRequest.java26
-rw-r--r--plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/internal/cdo/net4j/protocol/LockObjectsRequest.java10
-rw-r--r--plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/internal/cdo/net4j/protocol/ObjectLockedRequest.java6
-rw-r--r--plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/internal/cdo/net4j/protocol/OpenSessionRequest.java94
-rw-r--r--plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/internal/cdo/net4j/protocol/QueryCancelRequest.java6
-rw-r--r--plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/internal/cdo/net4j/protocol/QueryRequest.java6
-rw-r--r--plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/internal/cdo/net4j/protocol/ResourceIDRequest.java14
-rw-r--r--plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/internal/cdo/net4j/protocol/SetAuditRequest.java26
-rw-r--r--plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/internal/cdo/net4j/protocol/SetPassiveUpdateRequest.java7
-rw-r--r--plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/internal/cdo/net4j/protocol/SyncRevisionsRequest.java12
-rw-r--r--plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/internal/cdo/net4j/protocol/UnlockObjectsRequest.java16
-rw-r--r--plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/internal/cdo/net4j/protocol/UnsubscribeRemoteSessionsRequest.java6
-rw-r--r--plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/internal/cdo/net4j/protocol/VerifyRevisionRequest.java18
-rw-r--r--plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/internal/cdo/query/CDOQueryImpl.java10
-rw-r--r--plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/internal/cdo/revision/CDOElementProxyImpl.java4
-rw-r--r--plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/internal/cdo/revision/CDOListWithElementProxiesImpl.java5
-rw-r--r--plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/internal/cdo/session/CDOCollectionLoadingPolicyImpl.java6
-rw-r--r--plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/internal/cdo/session/CDOPackageRegistryImpl.java446
-rw-r--r--plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/internal/cdo/session/CDOPackageTypeRegistryImpl.java269
-rw-r--r--plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/internal/cdo/session/CDORevisionManagerImpl.java16
-rw-r--r--plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/internal/cdo/session/CDOSessionConfigurationImpl.java19
-rw-r--r--plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/internal/cdo/session/CDOSessionImpl.java591
-rw-r--r--plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/internal/cdo/session/CDOSessionPackageManagerImpl.java171
-rw-r--r--plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/internal/cdo/session/SessionUtil.java57
-rw-r--r--plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/internal/cdo/transaction/CDOTransactionImpl.java84
-rw-r--r--plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/internal/cdo/transaction/CDOXACommitContextImpl.java6
-rw-r--r--plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/internal/cdo/util/FSMUtil.java12
-rw-r--r--plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/internal/cdo/util/ModelUtil.java438
-rw-r--r--plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/internal/cdo/util/RevisionAdjuster.java11
-rw-r--r--plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/internal/cdo/view/CDOViewImpl.java54
-rw-r--r--plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/internal/cdo/view/CDOViewSetImpl.java29
-rw-r--r--plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/spi/cdo/AbstractObjectConflictResolver.java8
-rw-r--r--plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/spi/cdo/CDOElementProxy.java5
-rw-r--r--plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/spi/cdo/CDOSessionProtocol.java52
-rw-r--r--plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/spi/cdo/InternalCDOObject.java3
-rw-r--r--plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/spi/cdo/InternalCDORemoteSessionManager.java4
-rw-r--r--plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/spi/cdo/InternalCDOSession.java22
437 files changed, 10094 insertions, 11191 deletions
diff --git a/plugins/org.eclipse.emf.cdo.common/.classpath b/plugins/org.eclipse.emf.cdo.common/.classpath
index 64c5e31b7a..722f3e931a 100644
--- a/plugins/org.eclipse.emf.cdo.common/.classpath
+++ b/plugins/org.eclipse.emf.cdo.common/.classpath
@@ -2,6 +2,6 @@
<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 excluding="org/eclipse/emf/cdo/common/model.old/" kind="src" path="src"/>
<classpathentry kind="output" path="bin"/>
</classpath>
diff --git a/plugins/org.eclipse.emf.cdo.common/META-INF/MANIFEST.MF b/plugins/org.eclipse.emf.cdo.common/META-INF/MANIFEST.MF
index c12249c73a..390c8819dc 100644
--- a/plugins/org.eclipse.emf.cdo.common/META-INF/MANIFEST.MF
+++ b/plugins/org.eclipse.emf.cdo.common/META-INF/MANIFEST.MF
@@ -9,14 +9,15 @@ 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="[2.0.0,3.0.0)";visibility:=reexport
+Require-Bundle: org.eclipse.core.runtime;bundle-version="[3.4.0,4.0.0)";resolution:=optional,
+ org.eclipse.emf.ecore.xmi;bundle-version="[2.4.0,3.0.0)";resolution:=optional,
+ org.eclipse.emf.ecore;bundle-version="[2.4.0,3.0.0)";visibility:=reexport,
+ org.eclipse.net4j;bundle-version="[2.0.0,3.0.0)";visibility:=reexport
Import-Package: org.osgi.framework;version="1.3.0";resolution:=optional
Export-Package: org.eclipse.emf.cdo.common;version="2.0.0",
org.eclipse.emf.cdo.common.id;version="2.0.0",
org.eclipse.emf.cdo.common.io;version="2.0.0",
org.eclipse.emf.cdo.common.model;version="2.0.0",
- org.eclipse.emf.cdo.common.model.core;version="2.0.0",
- org.eclipse.emf.cdo.common.model.resource;version="2.0.0",
org.eclipse.emf.cdo.common.protocol;version="2.0.0",
org.eclipse.emf.cdo.common.revision;version="2.0.0",
org.eclipse.emf.cdo.common.revision.cache;version="2.0.0",
@@ -27,8 +28,6 @@ Export-Package: org.eclipse.emf.cdo.common;version="2.0.0",
org.eclipse.emf.cdo.internal.common.id;version="2.0.0";x-friends:="org.eclipse.emf.cdo.tests,org.eclipse.emf.cdo,org.eclipse.emf.cdo.server",
org.eclipse.emf.cdo.internal.common.io;version="2.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="2.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="2.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="2.0.0";x-friends:="org.eclipse.emf.cdo.tests,org.eclipse.emf.cdo,org.eclipse.emf.cdo.server",
org.eclipse.emf.cdo.internal.common.protocol;version="2.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="2.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.cache;version="2.0.0";x-friends:="org.eclipse.emf.cdo,org.eclipse.emf.cdo.server,org.eclipse.emf.cdo.tests",
diff --git a/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/common/CDOCommonSession.java b/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/common/CDOCommonSession.java
index ef98c5ba2f..19d0bd9925 100644
--- a/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/common/CDOCommonSession.java
+++ b/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/common/CDOCommonSession.java
@@ -17,7 +17,6 @@ import org.eclipse.net4j.util.security.IUserAware;
/**
* @author Eike Stepper
- * @noimplement This interface is not intended to be implemented by clients.
* @since 2.0
*/
public interface CDOCommonSession extends IUserAware, IOptionsContainer, Closeable
diff --git a/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/common/CDOCommonView.java b/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/common/CDOCommonView.java
index 74e05992df..02a9028f2f 100644
--- a/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/common/CDOCommonView.java
+++ b/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/common/CDOCommonView.java
@@ -16,7 +16,6 @@ import org.eclipse.net4j.util.collection.Closeable;
/**
* @author Eike Stepper
- * @noimplement This interface is not intended to be implemented by clients.
* @since 2.0
*/
public interface CDOCommonView extends Closeable
diff --git a/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/common/CDOFetchRule.java b/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/common/CDOFetchRule.java
index 1855f26882..720fe262db 100644
--- a/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/common/CDOFetchRule.java
+++ b/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/common/CDOFetchRule.java
@@ -13,9 +13,10 @@ package org.eclipse.emf.cdo.common;
import org.eclipse.emf.cdo.common.io.CDODataInput;
import org.eclipse.emf.cdo.common.io.CDODataOutput;
-import org.eclipse.emf.cdo.common.model.CDOClass;
-import org.eclipse.emf.cdo.common.model.CDOFeature;
-import org.eclipse.emf.cdo.common.model.CDOPackageManager;
+import org.eclipse.emf.cdo.common.model.CDOPackageRegistry;
+
+import org.eclipse.emf.ecore.EClass;
+import org.eclipse.emf.ecore.EStructuralFeature;
import java.io.IOException;
import java.util.ArrayList;
@@ -27,53 +28,53 @@ import java.util.List;
*/
public final class CDOFetchRule
{
- private CDOClass cdoClass;
+ private EClass eClass;
- private List<CDOFeature> features = new ArrayList<CDOFeature>(0);
+ private List<EStructuralFeature> features = new ArrayList<EStructuralFeature>(0);
- public CDOFetchRule(CDOClass cdoClass)
+ public CDOFetchRule(EClass eClass)
{
- this.cdoClass = cdoClass;
+ this.eClass = eClass;
}
- public CDOFetchRule(CDODataInput in, CDOPackageManager packageManager) throws IOException
+ public CDOFetchRule(CDODataInput in, CDOPackageRegistry packageManager) throws IOException
{
- cdoClass = in.readCDOClassRefAndResolve();
+ eClass = (EClass)in.readCDOClassifierRefAndResolve();
int size = in.readInt();
for (int i = 0; i < size; i++)
{
int featureID = in.readInt();
- CDOFeature feature = cdoClass.lookupFeature(featureID);
+ EStructuralFeature feature = eClass.getEStructuralFeature(featureID);
features.add(feature);
}
}
public void write(CDODataOutput out) throws IOException
{
- out.writeCDOClassRef(cdoClass);
+ out.writeCDOClassifierRef(eClass);
out.writeInt(features.size());
- for (CDOFeature feature : features)
+ for (EStructuralFeature feature : features)
{
out.writeInt(feature.getFeatureID());
}
}
- public CDOClass getCDOClass()
+ public EClass getEClass()
{
- return cdoClass;
+ return eClass;
}
- public List<CDOFeature> getFeatures()
+ public List<EStructuralFeature> getFeatures()
{
return features;
}
- public void addFeature(CDOFeature feature)
+ public void addFeature(EStructuralFeature feature)
{
features.add(feature);
}
- public void removeFeature(CDOFeature feature)
+ public void removeFeature(EStructuralFeature feature)
{
features.remove(feature);
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
index a29d8647fe..4da0608cf0 100644
--- 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
@@ -18,7 +18,7 @@ import java.io.Serializable;
* @author Eike Stepper
* @noimplement This interface is not intended to be implemented by clients.
*/
-public interface CDOID extends Serializable
+public interface CDOID extends Serializable, Comparable<CDOID>
{
public static final CDOID NULL = org.eclipse.emf.cdo.internal.common.id.CDOIDNullImpl.INSTANCE;
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
index 9fb3ad164d..ac5ef48d5f 100644
--- 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
@@ -12,7 +12,6 @@ package org.eclipse.emf.cdo.common.id;
/**
* @author Eike Stepper
- * @noimplement This interface is not intended to be implemented by clients.
*/
public interface CDOIDProvider
{
diff --git a/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/common/io/CDODataInput.java b/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/common/io/CDODataInput.java
index 2ded51250c..b44c15d2ae 100644
--- a/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/common/io/CDODataInput.java
+++ b/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/common/io/CDODataInput.java
@@ -14,10 +14,10 @@ package org.eclipse.emf.cdo.common.io;
import org.eclipse.emf.cdo.common.id.CDOID;
import org.eclipse.emf.cdo.common.id.CDOIDAndVersion;
import org.eclipse.emf.cdo.common.id.CDOIDMetaRange;
-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.CDOPackage;
+import org.eclipse.emf.cdo.common.model.CDOClassifierRef;
+import org.eclipse.emf.cdo.common.model.CDOPackageInfo;
+import org.eclipse.emf.cdo.common.model.CDOPackageRegistry;
+import org.eclipse.emf.cdo.common.model.CDOPackageUnit;
import org.eclipse.emf.cdo.common.model.CDOType;
import org.eclipse.emf.cdo.common.revision.CDOList;
import org.eclipse.emf.cdo.common.revision.CDORevision;
@@ -27,6 +27,10 @@ import org.eclipse.emf.cdo.common.revision.delta.CDORevisionDelta;
import org.eclipse.net4j.util.concurrent.RWLockManager;
import org.eclipse.net4j.util.io.ExtendedDataInput;
+import org.eclipse.emf.ecore.EClass;
+import org.eclipse.emf.ecore.EClassifier;
+import org.eclipse.emf.ecore.EStructuralFeature;
+
import java.io.IOException;
/**
@@ -37,21 +41,21 @@ public interface CDODataInput extends ExtendedDataInput
{
// /////////////////////////////////////////////////////////////////////////////////////////////////
- public String readCDOPackageURI() throws IOException;
+ public CDOPackageUnit readCDOPackageUnit(CDOPackageRegistry packageRegistry) throws IOException;
- public CDOType readCDOType() throws IOException;
+ public CDOPackageUnit[] readCDOPackageUnits(CDOPackageRegistry packageRegistry) throws IOException;
- public CDOClassRef readCDOClassRef() throws IOException;
+ public CDOPackageUnit.Type readCDOPackageUnitType() throws IOException;
- public CDOClass readCDOClassRefAndResolve() throws IOException;
+ public CDOPackageInfo readCDOPackageInfo() throws IOException;
- public void readCDOPackage(CDOPackage cdoPackage) throws IOException;
+ public CDOClassifierRef readCDOClassifierRef() throws IOException;
- public CDOPackage readCDOPackage() throws IOException;
+ public EClassifier readCDOClassifierRefAndResolve() throws IOException;
- public CDOClass readCDOClass(CDOPackage containingPackage) throws IOException;
+ public String readCDOPackageURI() throws IOException;
- public CDOFeature readCDOFeature(CDOClass containingClass) throws IOException;
+ public CDOType readCDOType() throws IOException;
// /////////////////////////////////////////////////////////////////////////////////////////////////
@@ -65,11 +69,13 @@ public interface CDODataInput extends ExtendedDataInput
public CDORevision readCDORevision() throws IOException;
- public CDOList readCDOList(CDORevision revision, CDOFeature feature) throws IOException;
+ public CDOList readCDOList(CDORevision revision, EStructuralFeature feature) throws IOException;
+
+ public Object readCDOFeatureValue(EStructuralFeature feature) throws IOException;
public CDORevisionDelta readCDORevisionDelta() throws IOException;
- public CDOFeatureDelta readCDOFeatureDelta(CDOClass cdoClass) throws IOException;
+ public CDOFeatureDelta readCDOFeatureDelta(EClass eClass) throws IOException;
/**
* Read either a CDORevision or a primitive value.
@@ -77,9 +83,9 @@ public interface CDODataInput extends ExtendedDataInput
public Object readCDORevisionOrPrimitive() throws IOException;
/**
- * Read either a CDORevision, a primitive value or a CDOClass.
+ * Read either a CDORevision, a primitive value or a EClass.
*/
- public Object readCDORevisionOrPrimitiveOrClass() throws IOException;
+ public Object readCDORevisionOrPrimitiveOrClassifier() throws IOException;
// /////////////////////////////////////////////////////////////////////////////////////////////////
diff --git a/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/common/io/CDODataOutput.java b/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/common/io/CDODataOutput.java
index 2deb575a74..a379284f9f 100644
--- a/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/common/io/CDODataOutput.java
+++ b/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/common/io/CDODataOutput.java
@@ -15,10 +15,9 @@ import org.eclipse.emf.cdo.common.id.CDOID;
import org.eclipse.emf.cdo.common.id.CDOIDAndVersion;
import org.eclipse.emf.cdo.common.id.CDOIDMetaRange;
import org.eclipse.emf.cdo.common.id.CDOIDProvider;
-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.CDOPackage;
+import org.eclipse.emf.cdo.common.model.CDOClassifierRef;
+import org.eclipse.emf.cdo.common.model.CDOPackageInfo;
+import org.eclipse.emf.cdo.common.model.CDOPackageUnit;
import org.eclipse.emf.cdo.common.model.CDOType;
import org.eclipse.emf.cdo.common.revision.CDOList;
import org.eclipse.emf.cdo.common.revision.CDORevision;
@@ -28,6 +27,10 @@ import org.eclipse.emf.cdo.common.revision.delta.CDORevisionDelta;
import org.eclipse.net4j.util.concurrent.RWLockManager;
import org.eclipse.net4j.util.io.ExtendedDataOutput;
+import org.eclipse.emf.ecore.EClass;
+import org.eclipse.emf.ecore.EClassifier;
+import org.eclipse.emf.ecore.EStructuralFeature;
+
import java.io.IOException;
/**
@@ -40,19 +43,21 @@ public interface CDODataOutput extends ExtendedDataOutput
// /////////////////////////////////////////////////////////////////////////////////////////////////
- public void writeCDOPackageURI(String uri) throws IOException;
+ public void writeCDOPackageUnit(CDOPackageUnit packageUnit, boolean withPackages) throws IOException;
- public void writeCDOType(CDOType cdoType) throws IOException;
+ public void writeCDOPackageUnits(CDOPackageUnit... packageUnit) throws IOException;
- public void writeCDOClassRef(CDOClassRef cdoClassRef) throws IOException;
+ public void writeCDOPackageUnitType(CDOPackageUnit.Type type) throws IOException;
- public void writeCDOClassRef(CDOClass cdoClass) throws IOException;
+ public void writeCDOPackageInfo(CDOPackageInfo packageInfo) throws IOException;
- public void writeCDOPackage(CDOPackage cdoPackage) throws IOException;
+ public void writeCDOClassifierRef(CDOClassifierRef eClassifierRef) throws IOException;
- public void writeCDOClass(CDOClass cdoClass) throws IOException;
+ public void writeCDOClassifierRef(EClassifier eClassifier) throws IOException;
- public void writeCDOFeature(CDOFeature cdoFeature) throws IOException;
+ public void writeCDOPackageURI(String uri) throws IOException;
+
+ public void writeCDOType(CDOType cdoType) throws IOException;
// /////////////////////////////////////////////////////////////////////////////////////////////////
@@ -66,11 +71,13 @@ public interface CDODataOutput extends ExtendedDataOutput
public void writeCDORevision(CDORevision revision, int referenceChunk) throws IOException;
- public void writeCDOList(CDOList list, CDOFeature feature, int referenceChunk) throws IOException;
+ public void writeCDOList(CDOList list, EStructuralFeature feature, int referenceChunk) throws IOException;
+
+ public void writeCDOFeatureValue(Object value, EStructuralFeature feature) throws IOException;
public void writeCDORevisionDelta(CDORevisionDelta revisionDelta) throws IOException;
- public void writeCDOFeatureDelta(CDOFeatureDelta featureDelta, CDOClass cdoClass) throws IOException;
+ public void writeCDOFeatureDelta(CDOFeatureDelta featureDelta, EClass eClass) throws IOException;
/**
* Write either a CDORevision or a primitive value.
@@ -78,9 +85,9 @@ public interface CDODataOutput extends ExtendedDataOutput
public void writeCDORevisionOrPrimitive(Object value) throws IOException;
/**
- * Write either a CDORevision, a primitive value or a CDOClass.
+ * Write either a CDORevision, a primitive value or a EClass.
*/
- public void writeCDORevisionOrPrimitiveOrClass(Object value) throws IOException;
+ public void writeCDORevisionOrPrimitiveOrClassifier(Object value) throws IOException;
// /////////////////////////////////////////////////////////////////////////////////////////////////
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
deleted file mode 100644
index a2ef610881..0000000000
--- a/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/common/model/CDOClass.java
+++ /dev/null
@@ -1,66 +0,0 @@
-/**
- * Copyright (c) 2004 - 2009 Eike Stepper (Berlin, Germany) and others.
- * 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
- * @noimplement This interface is not intended to be implemented by clients.
- */
-public interface CDOClass extends CDOModelElement, Comparable<CDOClass>
-{
- public int getClassifierID();
-
- public boolean isAbstract();
-
- /**
- * @since 2.0
- */
- public boolean isResourceNode();
-
- /**
- * @since 2.0
- */
- public boolean isResourceFolder();
-
- 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/CDOModelElement.java b/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/common/model/CDOClassInfo.java
index 6310b46df1..baa07ca478 100644
--- 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/CDOClassInfo.java
@@ -10,22 +10,26 @@
*/
package org.eclipse.emf.cdo.common.model;
+import org.eclipse.emf.common.notify.Adapter;
+import org.eclipse.emf.ecore.EClass;
+import org.eclipse.emf.ecore.EStructuralFeature;
+
/**
* @author Eike Stepper
- * @noimplement This interface is not intended to be implemented by clients.
*/
-public interface CDOModelElement
+public interface CDOClassInfo extends Adapter
{
- public CDOPackageManager getPackageManager();
+ public EClass getEClass();
+
+ public boolean isResourceNode();
+
+ public boolean isResourceFolder();
- public String getName();
+ public boolean isResource();
- /**
- * @since 2.0
- */
- public String getQualifiedName();
+ public EStructuralFeature[] getAllPersistentFeatures();
- public Object getClientInfo();
+ public int getFeatureIndex(EStructuralFeature feature);
- public Object getServerInfo();
+ public int getFeatureIndex(int featureID);
}
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
deleted file mode 100644
index d874fd69a9..0000000000
--- a/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/common/model/CDOClassProxy.java
+++ /dev/null
@@ -1,105 +0,0 @@
-/**
- * Copyright (c) 2004 - 2009 Eike Stepper (Berlin, Germany) and others.
- * 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();
- }
-
- public void setCDOPackageManager(CDOPackageManager packageManager)
- {
- this.packageManager = packageManager;
- }
-
- // 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/internal/common/model/CDOClassRefImpl.java b/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/common/model/CDOClassifierRef.java
index 483d947de9..922eb9e098 100644
--- 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/common/model/CDOClassifierRef.java
@@ -8,40 +8,44 @@
* Contributors:
* Eike Stepper - initial API and implementation
*/
-package org.eclipse.emf.cdo.internal.common.model;
+package org.eclipse.emf.cdo.common.model;
import org.eclipse.emf.cdo.common.io.CDODataInput;
import org.eclipse.emf.cdo.common.io.CDODataOutput;
-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.emf.ecore.EClassifier;
+import org.eclipse.emf.ecore.EPackage;
import java.io.IOException;
import java.text.MessageFormat;
/**
- * TODO Optimize transfer of CDOClassRef instances
+ * TODO Optimize transfer of EClassRef instances
*
* @author Eike Stepper
*/
-public final class CDOClassRefImpl implements CDOClassRef
+public final class CDOClassifierRef
{
private String packageURI;
private int classifierID;
- public CDOClassRefImpl()
+ public CDOClassifierRef()
+ {
+ }
+
+ public CDOClassifierRef(EClassifier classifier)
{
+ this(classifier.getEPackage().getNsURI(), classifier.getClassifierID());
}
- public CDOClassRefImpl(String packageURI, int classifierID)
+ public CDOClassifierRef(String packageURI, int classifierID)
{
this.packageURI = packageURI;
this.classifierID = classifierID;
}
- public CDOClassRefImpl(CDODataInput in) throws IOException
+ public CDOClassifierRef(CDODataInput in) throws IOException
{
packageURI = in.readCDOPackageURI();
classifierID = in.readInt();
@@ -63,20 +67,20 @@ public final class CDOClassRefImpl implements CDOClassRef
return classifierID;
}
- public CDOClass resolve(CDOPackageManager packageManager)
+ public EClassifier resolve(EPackage.Registry packageRegistry)
{
- CDOPackage cdoPackage = packageManager.lookupPackage(packageURI);
- if (cdoPackage != null)
+ EPackage ePackage = packageRegistry.getEPackage(packageURI);
+ if (ePackage == null)
{
- return cdoPackage.lookupClass(classifierID);
+ throw new IllegalStateException("Package not found: " + packageURI);
}
- return null;
+ return EMFUtil.getClassifier(ePackage, classifierID);
}
@Override
public String toString()
{
- return MessageFormat.format("CDOClassRef({0}, {1})", packageURI, classifierID);
+ return MessageFormat.format("EClassRef({0}, {1})", packageURI, classifierID);
}
}
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
deleted file mode 100644
index adfdd20feb..0000000000
--- a/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/common/model/CDOFeature.java
+++ /dev/null
@@ -1,41 +0,0 @@
-/**
- * Copyright (c) 2004 - 2009 Eike Stepper (Berlin, Germany) and others.
- * 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
- * @noimplement This interface is not intended to be implemented by clients.
- */
-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();
-
- /**
- * @since 2.0
- */
- public Object getDefaultValue();
-
- public CDOClass getContainingClass();
-
- public CDOPackage getContainingPackage();
-}
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/CDOModelConstants.java
index c4352de1d1..ced2f65a80 100644
--- 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/CDOModelConstants.java
@@ -13,12 +13,10 @@ package org.eclipse.emf.cdo.common.model;
/**
* @author Eike Stepper
* @noimplement This interface is not intended to be implemented by clients.
+ * @since 2.0
*/
-public interface CDOClassRef
+public interface CDOModelConstants
{
- public String getPackageURI();
- public int getClassifierID();
-
- public CDOClass resolve(CDOPackageManager packageManager);
+ public static final String RESOURCE_NODE_NAME_ATTRIBUTE = "name";
}
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
index aa801384f2..870501968b 100644
--- 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
@@ -10,23 +10,131 @@
*/
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.CDOClassInfoImpl;
+import org.eclipse.emf.cdo.internal.common.model.CDOPackageInfoImpl;
+import org.eclipse.emf.cdo.internal.common.model.CDOPackageUnitImpl;
import org.eclipse.emf.cdo.internal.common.model.CDOTypeImpl;
+import org.eclipse.net4j.util.io.ExtendedDataInput;
+import org.eclipse.net4j.util.io.ExtendedDataOutput;
+
+import org.eclipse.emf.common.notify.Adapter;
+import org.eclipse.emf.common.util.EList;
+import org.eclipse.emf.ecore.EClass;
+import org.eclipse.emf.ecore.EClassifier;
+import org.eclipse.emf.ecore.EDataType;
+import org.eclipse.emf.ecore.EPackage;
+import org.eclipse.emf.ecore.EStructuralFeature;
+import org.eclipse.emf.ecore.EcorePackage;
+import org.eclipse.emf.ecore.util.EcoreUtil;
+
+import java.io.IOException;
+import java.util.ArrayList;
+import java.util.Date;
+import java.util.List;
+
/**
+ * @since 2.0
* @author Eike Stepper
*/
public final class CDOModelUtil
{
+ public static final String CORE_PACKAGE_URI = "http://www.eclipse.org/emf/2002/Ecore";
+
+ public static final String RESOURCE_PACKAGE_URI = "http://www.eclipse.org/emf/CDO/Eresource/2.0.0";
+
+ public static final String RESOURCE_NODE_CLASS_NAME = "CDOResourceNode";
+
+ public static final String RESOURCE_FOLDER_CLASS_NAME = "CDOResourceFolder";
+
+ public static final String RESOURCE_CLASS_NAME = "CDOResource";
+
+ public static final String ROOT_CLASS_NAME = "EObject";
+
+ private static CDOType[] coreTypes;
+
+ static
+ {
+ List<CDOType> types = new ArrayList<CDOType>();
+ registerCoreType(types, EcorePackage.eINSTANCE.getEBigDecimal(), null);
+ registerCoreType(types, EcorePackage.eINSTANCE.getEBigInteger(), null);
+ registerCoreType(types, EcorePackage.eINSTANCE.getEBooleanObject(), CDOType.BOOLEAN_OBJECT);
+ registerCoreType(types, EcorePackage.eINSTANCE.getEBoolean(), CDOType.BOOLEAN);
+ registerCoreType(types, EcorePackage.eINSTANCE.getEByteArray(), CDOType.BYTE_ARRAY);
+ registerCoreType(types, EcorePackage.eINSTANCE.getEByteObject(), CDOType.BYTE_OBJECT);
+ registerCoreType(types, EcorePackage.eINSTANCE.getEByte(), CDOType.BYTE);
+ registerCoreType(types, EcorePackage.eINSTANCE.getECharacterObject(), CDOType.CHARACTER_OBJECT);
+ registerCoreType(types, EcorePackage.eINSTANCE.getEChar(), CDOType.CHAR);
+ registerCoreType(types, EcorePackage.eINSTANCE.getEDate(), CDOType.DATE);
+ registerCoreType(types, EcorePackage.eINSTANCE.getEDoubleObject(), CDOType.DOUBLE_OBJECT);
+ registerCoreType(types, EcorePackage.eINSTANCE.getEDouble(), CDOType.DOUBLE);
+ registerCoreType(types, EcorePackage.eINSTANCE.getEFloatObject(), CDOType.FLOAT_OBJECT);
+ registerCoreType(types, EcorePackage.eINSTANCE.getEFloat(), CDOType.FLOAT);
+ registerCoreType(types, EcorePackage.eINSTANCE.getEIntegerObject(), CDOType.INTEGER_OBJECT);
+ registerCoreType(types, EcorePackage.eINSTANCE.getEInt(), CDOType.INT);
+ registerCoreType(types, EcorePackage.eINSTANCE.getEJavaClass(), null);
+ registerCoreType(types, EcorePackage.eINSTANCE.getEJavaObject(), null);
+ registerCoreType(types, EcorePackage.eINSTANCE.getELongObject(), CDOType.LONG_OBJECT);
+ registerCoreType(types, EcorePackage.eINSTANCE.getELong(), CDOType.LONG);
+ registerCoreType(types, EcorePackage.eINSTANCE.getEShortObject(), CDOType.SHORT_OBJECT);
+ registerCoreType(types, EcorePackage.eINSTANCE.getEShort(), CDOType.SHORT);
+ registerCoreType(types, EcorePackage.eINSTANCE.getEString(), CDOType.STRING);
+ registerCoreType(types, EcorePackage.eINSTANCE.getEEnum(), CDOType.ENUM);
+
+ coreTypes = types.toArray(new CDOType[types.size()]);
+ }
+
+ private static void registerCoreType(List<CDOType> types, EClassifier classifier, CDOType type)
+ {
+ int index = classifier.getClassifierID();
+ while (index >= types.size())
+ {
+ types.add(null);
+ }
+
+ types.set(index, type);
+ }
+
private CDOModelUtil()
{
}
- // ///////////////////////////////////////////////
+ public static boolean isCorePackage(EPackage ePackage)
+ {
+ return CORE_PACKAGE_URI.equals(ePackage.getNsURI());
+ }
+
+ public static boolean isResourcePackage(EPackage ePackage)
+ {
+ return RESOURCE_PACKAGE_URI.equals(ePackage.getNsURI());
+ }
+
+ public static boolean isSystemPackage(EPackage ePackage)
+ {
+ return isCorePackage(ePackage) || isResourcePackage(ePackage);
+ }
+
+ public static boolean isResource(EClass eClass)
+ {
+ return isResourcePackage(eClass.getEPackage()) && RESOURCE_CLASS_NAME.equals(eClass.getName());
+ }
+
+ public static boolean isResourceFolder(EClass eClass)
+ {
+ return isResourcePackage(eClass.getEPackage()) && RESOURCE_FOLDER_CLASS_NAME.equals(eClass.getName());
+ }
+
+ public static boolean isResourceNode(EClass eClass)
+ {
+ return isResourcePackage(eClass.getEPackage())
+ && (RESOURCE_NODE_CLASS_NAME.equals(eClass.getName()) || RESOURCE_CLASS_NAME.equals(eClass.getName()) || RESOURCE_FOLDER_CLASS_NAME
+ .equals(eClass.getName()));
+ }
+
+ public static boolean isRoot(EClass eClass)
+ {
+ return isCorePackage(eClass.getEPackage()) && ROOT_CLASS_NAME.equals(eClass.getName());
+ }
public static CDOType getType(int typeID)
{
@@ -39,40 +147,146 @@ public final class CDOModelUtil
return type;
}
- public static CDOPackage createPackage(CDOPackageManager packageManager, String packageURI, String name,
- String ecore, boolean dynamic, CDOIDMetaRange metaIDRange, String parentURI)
+ public static CDOType getType(EClassifier classifier)
+ {
+ if (classifier instanceof EClass)
+ {
+ return CDOType.OBJECT;
+ }
+
+ if (isCorePackage(classifier.getEPackage()))
+ {
+ EDataType eDataType = (EDataType)classifier;
+ return getCoreType(eDataType);
+ }
+
+ return CDOType.CUSTOM;
+ }
+
+ /**
+ * Core types includes also complex data like EAnnotation, and EEnum
+ */
+ public static CDOType getCoreType(EClassifier eDataType)
{
- return new CDOPackageImpl(packageManager, packageURI, name, ecore, dynamic, metaIDRange, parentURI);
+ int index = eDataType.getClassifierID();
+ return coreTypes[index];
}
- public static CDOPackage createProxyPackage(CDOPackageManager packageManager, String packageURI, boolean dynamic,
- CDOIDMetaRange metaIDRange, String parentURI)
+ public static CDOType getPrimitiveType(Class<? extends Object> primitiveType)
{
- return new CDOPackageImpl(packageManager, packageURI, dynamic, metaIDRange, parentURI);
+ if (primitiveType == String.class)
+ {
+ return CDOType.STRING;
+ }
+
+ if (primitiveType == Boolean.class)
+ {
+ return CDOType.BOOLEAN;
+ }
+
+ if (primitiveType == Integer.class)
+ {
+ return CDOType.INT;
+ }
+
+ if (primitiveType == Double.class)
+ {
+ return CDOType.DOUBLE;
+ }
+
+ if (primitiveType == Float.class)
+ {
+ return CDOType.FLOAT;
+ }
+
+ if (primitiveType == Long.class)
+ {
+ return CDOType.LONG;
+ }
+
+ if (primitiveType == Date.class)
+ {
+ return CDOType.DATE;
+ }
+
+ if (primitiveType == Byte.class)
+ {
+ return CDOType.BYTE;
+ }
+
+ if (primitiveType == Character.class)
+ {
+ return CDOType.CHAR;
+ }
+
+ throw new IllegalArgumentException("Not a primitive type nor String nor Date: " + primitiveType);
}
- public static CDOClass createClass(CDOPackage containingPackage, int classifierID, String name, boolean isAbstract)
+ public static CDOPackageInfo getPackageInfo(Object value, CDOPackageRegistry packageRegistry)
{
- return new CDOClassImpl(containingPackage, classifierID, name, isAbstract);
+ if (value instanceof EPackage)
+ {
+ return packageRegistry.getPackageInfo((EPackage)value);
+ }
+
+ if (value instanceof CDOPackageInfo)
+ {
+ CDOPackageInfo packageInfo = (CDOPackageInfo)value;
+ if (packageInfo.getPackageUnit().getPackageRegistry() == packageRegistry)
+ {
+ return packageInfo;
+ }
+ }
+
+ return null;
}
- /**
- * @since 2.0
- */
- public static CDOFeature createAttribute(CDOClass containingClass, int featureID, String name, CDOType type,
- Object defaultValue, boolean many)
+ public static CDOClassInfo getClassInfo(EClass eClass)
+ {
+ synchronized (eClass)
+ {
+ EList<Adapter> adapters = eClass.eAdapters();
+ CDOClassInfo classInfo = (CDOClassInfo)EcoreUtil.getAdapter(adapters, CDOClassInfo.class);
+ if (classInfo == null)
+ {
+ classInfo = new CDOClassInfoImpl();
+ adapters.add(classInfo);
+ }
+
+ return classInfo;
+ }
+ }
+
+ public static EStructuralFeature[] getAllPersistentFeatures(EClass eClass)
+ {
+ CDOClassInfo classInfo = getClassInfo(eClass);
+ return classInfo.getAllPersistentFeatures();
+ }
+
+ public static CDOPackageUnit createPackageUnit()
+ {
+ return new CDOPackageUnitImpl();
+ }
+
+ public static CDOPackageInfo createPackageInfo()
{
- return new CDOFeatureImpl(containingClass, featureID, name, type, defaultValue, many);
+ return new CDOPackageInfoImpl();
}
- public static CDOFeature createReference(CDOClass containingClass, int featureID, String name,
- CDOClassProxy referenceType, boolean many, boolean containment)
+ public static void writePackage(ExtendedDataOutput out, EPackage ePackage, boolean zipped,
+ EPackage.Registry packageRegistry) throws IOException
{
- return new CDOFeatureImpl(containingClass, featureID, name, referenceType, many, containment);
+ byte[] bytes = EMFUtil.getEPackageBytes(ePackage, zipped, packageRegistry);
+ out.writeString(ePackage.getNsURI());
+ out.writeBoolean(zipped);
+ out.writeByteArray(bytes);
}
- public static CDOClassRef createClassRef(String packageURI, int classifierID)
+ public static EPackage readPackage(ExtendedDataInput in, EPackage.Registry packageRegistry) throws IOException
{
- return new CDOClassRefImpl(packageURI, classifierID);
+ String uri = in.readString();
+ boolean zipped = in.readBoolean();
+ byte[] bytes = in.readByteArray();
+ return EMFUtil.createEPackage(uri, bytes, zipped, packageRegistry);
}
}
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
deleted file mode 100644
index 6e6935b239..0000000000
--- a/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/common/model/CDOPackage.java
+++ /dev/null
@@ -1,52 +0,0 @@
-/**
- * Copyright (c) 2004 - 2009 Eike Stepper (Berlin, Germany) and others.
- * 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
- * @noimplement This interface is not intended to be implemented by clients.
- */
-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
index 86b229b34c..6a23482ca1 100644
--- 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
@@ -12,48 +12,28 @@ package org.eclipse.emf.cdo.common.model;
import org.eclipse.emf.cdo.common.id.CDOIDMetaRange;
-/*
- * TODO Add read(), write(), ...
- */
+import org.eclipse.emf.common.notify.Adapter;
+import org.eclipse.emf.ecore.EPackage;
/**
* @author Eike Stepper
*/
-public final class CDOPackageInfo
+public interface CDOPackageInfo extends Adapter, EPackage.Descriptor, Comparable<CDOPackageInfo>
{
- private String packageURI;
+ public CDOPackageUnit getPackageUnit();
- private boolean dynamic;
+ public String getPackageURI();
- private CDOIDMetaRange metaIDRange;
+ public String getParentURI();
- private String parentURI;
+ public CDOIDMetaRange getMetaIDRange();
- public CDOPackageInfo(String packageURI, boolean dynamic, CDOIDMetaRange metaIDRange, String parentURI)
- {
- this.packageURI = packageURI;
- this.dynamic = dynamic;
- this.metaIDRange = metaIDRange;
- this.parentURI = parentURI;
- }
+ public EPackage getEPackage(boolean loadOnDemand);
- public String getPackageURI()
- {
- return packageURI;
- }
+ public boolean isCorePackage();
- public boolean isDynamic()
- {
- return dynamic;
- }
+ public boolean isResourcePackage();
- public CDOIDMetaRange getMetaIDRange()
- {
- return metaIDRange;
- }
+ public boolean isSystemPackage();
- 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
deleted file mode 100644
index 6322be5089..0000000000
--- a/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/common/model/CDOPackageManager.java
+++ /dev/null
@@ -1,36 +0,0 @@
-/**
- * Copyright (c) 2004 - 2009 Eike Stepper (Berlin, Germany) and others.
- * 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
- * @noimplement This interface is not intended to be implemented by clients.
- */
-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/CDOPackageRegistry.java b/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/common/model/CDOPackageRegistry.java
new file mode 100644
index 0000000000..e9bee51d3f
--- /dev/null
+++ b/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/common/model/CDOPackageRegistry.java
@@ -0,0 +1,40 @@
+/**
+ * Copyright (c) 2004 - 2009 Eike Stepper (Berlin, Germany) and others.
+ * 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.ecore.EPackage;
+
+/**
+ * @author Eike Stepper
+ */
+public interface CDOPackageRegistry extends EPackage.Registry
+{
+ public boolean isReplacingDescriptors();
+
+ /**
+ * Registers an {@link EPackage} with this package registry.
+ */
+ public Object putEPackage(EPackage ePackage);
+
+ public CDOPackageUnit getPackageUnit(EPackage ePackage);
+
+ /**
+ * Returns all package units that are registered in this package registry.
+ */
+ public CDOPackageUnit[] getPackageUnits();
+
+ public CDOPackageInfo getPackageInfo(EPackage ePackage);
+
+ /**
+ * Returns all package infos that are registered in this package registry.
+ */
+ public CDOPackageInfo[] getPackageInfos();
+}
diff --git a/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/common/model/CDOPackageRegistryPopulator.java b/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/common/model/CDOPackageRegistryPopulator.java
new file mode 100644
index 0000000000..5fe885ef30
--- /dev/null
+++ b/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/common/model/CDOPackageRegistryPopulator.java
@@ -0,0 +1,139 @@
+package org.eclipse.emf.cdo.common.model;
+
+import org.eclipse.net4j.util.concurrent.Worker;
+
+import org.eclipse.emf.ecore.EFactory;
+import org.eclipse.emf.ecore.EPackage;
+
+import java.util.Map.Entry;
+
+/**
+ * @author Eike Stepper
+ */
+public class CDOPackageRegistryPopulator extends Worker
+{
+ public static final int DEFAULT_SOURCE_POLL_INTERVAL = 5000;
+
+ private long sourcePollInterval = DEFAULT_SOURCE_POLL_INTERVAL;
+
+ private EPackage.Registry source;
+
+ private CDOPackageRegistry target;
+
+ public CDOPackageRegistryPopulator(CDOPackageRegistry target)
+ {
+ this(EPackage.Registry.INSTANCE, target);
+ }
+
+ public CDOPackageRegistryPopulator(EPackage.Registry source, CDOPackageRegistry target)
+ {
+ this.source = source;
+ this.target = target;
+ }
+
+ public EPackage.Registry getSource()
+ {
+ return source;
+ }
+
+ public CDOPackageRegistry getTarget()
+ {
+ return target;
+ }
+
+ public long getSourcePollInterval()
+ {
+ return sourcePollInterval;
+ }
+
+ public void setSourcePollInterval(long sourcePollInterval)
+ {
+ this.sourcePollInterval = sourcePollInterval;
+ }
+
+ @Override
+ protected void work(WorkContext context) throws Exception
+ {
+ doWork();
+ context.nextWork(getSourcePollInterval());
+ }
+
+ protected void doWork()
+ {
+ populate(getSource(), getTarget());
+ }
+
+ @Override
+ protected void doActivate() throws Exception
+ {
+ doWork();
+ super.doActivate();
+ }
+
+ public static boolean populate(CDOPackageRegistry target)
+ {
+ return populate(EPackage.Registry.INSTANCE, target);
+ }
+
+ public static boolean populate(EPackage.Registry source, CDOPackageRegistry target)
+ {
+ boolean populated = false;
+ while (populateFirstMatch(source, target))
+ {
+ populated = true;
+ }
+
+ return populated;
+ }
+
+ private static boolean populateFirstMatch(EPackage.Registry source, CDOPackageRegistry target)
+ {
+ for (Entry<String, Object> entry : source.entrySet())
+ {
+ String nsURI = entry.getKey();
+ if (!target.containsKey(nsURI))
+ {
+ target.put(nsURI, new Descriptor(source, nsURI));
+ return true;
+ }
+ }
+
+ return false;
+ }
+
+ /**
+ * @author Eike Stepper
+ */
+ public static class Descriptor implements EPackage.Descriptor
+ {
+ private EPackage.Registry source;
+
+ private String nsURI;
+
+ public Descriptor(EPackage.Registry source, String nsURI)
+ {
+ this.source = source;
+ this.nsURI = nsURI;
+ }
+
+ public EPackage.Registry getSource()
+ {
+ return source;
+ }
+
+ public String getNsURI()
+ {
+ return nsURI;
+ }
+
+ public EFactory getEFactory()
+ {
+ return source.getEFactory(nsURI);
+ }
+
+ public EPackage getEPackage()
+ {
+ return source.getEPackage(nsURI);
+ }
+ }
+}
diff --git a/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/common/model/CDOPackageTypeRegistry.java b/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/common/model/CDOPackageTypeRegistry.java
new file mode 100644
index 0000000000..f333ce7794
--- /dev/null
+++ b/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/common/model/CDOPackageTypeRegistry.java
@@ -0,0 +1,219 @@
+/**
+ * Copyright (c) 2004 - 2009 Eike Stepper (Berlin, Germany) and others.
+ * 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.net4j.util.ObjectUtil;
+import org.eclipse.net4j.util.om.OMPlatform;
+
+import org.eclipse.emf.ecore.EClass;
+import org.eclipse.emf.ecore.EClassifier;
+import org.eclipse.emf.ecore.EObject;
+import org.eclipse.emf.ecore.EPackage;
+import org.eclipse.emf.ecore.impl.EPackageImpl;
+import org.eclipse.emf.ecore.plugin.EcorePlugin;
+import org.eclipse.emf.ecore.util.EcoreUtil;
+
+import java.util.HashMap;
+import java.util.Map;
+
+/**
+ * @author Eike Stepper
+ */
+public final class CDOPackageTypeRegistry
+{
+ public static final CDOPackageTypeRegistry INSTANCE = new CDOPackageTypeRegistry();
+
+ private static final String ECORE_ID = "org.eclipse.emf.ecore";
+
+ private static final String PPID = EcorePlugin.GENERATED_PACKAGE_PPID;
+
+ private static final String MARKER_FILE = "META-INF/CDO.MF";
+
+ private Map<String, CDOPackageUnit.Type> types = new HashMap<String, CDOPackageUnit.Type>();
+
+ private Map<String, CDOPackageUnit.Type> bundles = new HashMap<String, CDOPackageUnit.Type>();
+
+ private CDOPackageTypeRegistry()
+ {
+ }
+
+ public synchronized CDOPackageUnit.Type register(EPackage ePackage)
+ {
+ CDOPackageUnit.Type type = getPackageType(ePackage);
+ types.put(ePackage.getNsURI(), type);
+ return type;
+ }
+
+ public synchronized void registerNative(String packageURI)
+ {
+ types.put(packageURI, CDOPackageUnit.Type.NATIVE);
+ }
+
+ public synchronized void registerLegacy(String packageURI)
+ {
+ types.put(packageURI, CDOPackageUnit.Type.LEGACY);
+ }
+
+ public synchronized void registerDynamic(String packageURI)
+ {
+ types.put(packageURI, CDOPackageUnit.Type.DYNAMIC);
+ }
+
+ public synchronized CDOPackageUnit.Type deregister(String packageURI)
+ {
+ return types.remove(packageURI);
+ }
+
+ public synchronized CDOPackageUnit.Type lookup(String packageURI)
+ {
+ CDOPackageUnit.Type type = types.get(packageURI);
+ if (type == null)
+ {
+ Object value = EPackage.Registry.INSTANCE.get(packageURI);
+ if (value instanceof EPackage)
+ {
+ EPackage ePackage = (EPackage)value;
+ type = register(ePackage);
+ }
+
+ if (type == null && OMPlatform.INSTANCE.isExtensionRegistryAvailable())
+ {
+ type = getTypeFromBundle(packageURI);
+ types.put(packageURI, type);
+ }
+ }
+
+ return type;
+ }
+
+ public synchronized CDOPackageUnit.Type lookup(EPackage ePackage)
+ {
+ String packageURI = ePackage.getNsURI();
+ CDOPackageUnit.Type type = types.get(packageURI);
+ if (type == null)
+ {
+ type = register(ePackage);
+ types.put(packageURI, type);
+ }
+
+ return type;
+ }
+
+ public synchronized void reset()
+ {
+ types.clear();
+ bundles.clear();
+ }
+
+ private CDOPackageUnit.Type getTypeFromBundle(String packageURI)
+ {
+ String bundleID = getBundleID(packageURI);
+ if (bundleID == null)
+ {
+ return CDOPackageUnit.Type.UNKNOWN;
+ }
+
+ CDOPackageUnit.Type type = bundles.get(bundleID);
+ if (type == null)
+ {
+ org.osgi.framework.Bundle bundle = org.eclipse.core.runtime.Platform.getBundle(bundleID);
+ if (bundle == null)
+ {
+ type = CDOPackageUnit.Type.UNKNOWN;
+ }
+ else if (bundle.getEntry(MARKER_FILE) != null)
+ {
+ type = CDOPackageUnit.Type.NATIVE;
+ }
+ else
+ {
+ type = CDOPackageUnit.Type.LEGACY;
+ }
+
+ bundles.put(bundleID, type);
+ }
+
+ return type;
+ }
+
+ private static String getBundleID(String packageURI)
+ {
+ org.eclipse.core.runtime.IExtensionRegistry registry = org.eclipse.core.runtime.Platform.getExtensionRegistry();
+ for (org.eclipse.core.runtime.IConfigurationElement element : registry.getConfigurationElementsFor(ECORE_ID, PPID))
+ {
+ String uri = element.getAttribute("uri");
+ if (ObjectUtil.equals(uri, packageURI))
+ {
+ return element.getContributor().getName();
+ }
+ }
+
+ return null;
+ }
+
+ private static CDOPackageUnit.Type getPackageType(EPackage ePackage)
+ {
+ if (ePackage.getClass() == EPackageImpl.class)
+ {
+ return CDOPackageUnit.Type.DYNAMIC;
+ }
+
+ EPackage topLevelPackage = EMFUtil.getTopLevelPackage(ePackage);
+ EClass eClass = getAnyConcreteEClass(topLevelPackage);
+ if (eClass != null)
+ {
+ EObject testObject = EcoreUtil.create(eClass);
+ if (testObject instanceof CDOObjectMarker)
+ {
+ return CDOPackageUnit.Type.NATIVE;
+ }
+
+ return CDOPackageUnit.Type.LEGACY;
+ }
+
+ return null;
+ }
+
+ private static EClass getAnyConcreteEClass(EPackage ePackage)
+ {
+ for (EClassifier classifier : ePackage.getEClassifiers())
+ {
+ if (classifier instanceof EClass)
+ {
+ EClass eClass = (EClass)classifier;
+ if (!(eClass.isAbstract() || eClass.isInterface()))
+ {
+ return eClass;
+ }
+ }
+ }
+
+ for (EPackage subpackage : ePackage.getESubpackages())
+ {
+ EClass eClass = getAnyConcreteEClass(subpackage);
+ if (eClass != null)
+ {
+ return eClass;
+ }
+ }
+
+ return null;
+ }
+
+ /**
+ * TODO Remove me when client and common are unified!
+ *
+ * @author Eike Stepper
+ */
+ public static interface CDOObjectMarker
+ {
+ }
+}
diff --git a/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/common/model/CDOPackageURICompressor.java b/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/common/model/CDOPackageURICompressor.java
deleted file mode 100644
index f1d18c46b4..0000000000
--- a/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/common/model/CDOPackageURICompressor.java
+++ /dev/null
@@ -1,46 +0,0 @@
-/**
- * Copyright (c) 2004 - 2009 Eike Stepper (Berlin, Germany) and others.
- * 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.net4j.util.io.ExtendedDataInput;
-import org.eclipse.net4j.util.io.ExtendedDataOutput;
-
-import java.io.IOException;
-
-/**
- * @author Eike Stepper
- * @since 2.0
- */
-public interface CDOPackageURICompressor
-{
- public static final CDOPackageURICompressor UNCOMPRESSED = new CDOPackageURICompressor()
- {
- public String readPackageURI(ExtendedDataInput in) throws IOException
- {
- return in.readString();
- }
-
- public void writePackageURI(ExtendedDataOutput out, String uri) throws IOException
- {
- out.writeString(uri);
- }
-
- @Override
- public String toString()
- {
- return "UNCOMPRESSED";
- }
- };
-
- public void writePackageURI(ExtendedDataOutput out, String uri) throws IOException;
-
- public String readPackageURI(ExtendedDataInput in) throws IOException;
-}
diff --git a/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/common/model/CDOPackageUnit.java b/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/common/model/CDOPackageUnit.java
new file mode 100644
index 0000000000..36443d6224
--- /dev/null
+++ b/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/common/model/CDOPackageUnit.java
@@ -0,0 +1,71 @@
+/**
+ * Copyright (c) 2004 - 2009 Eike Stepper (Berlin, Germany) and others.
+ * 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.ecore.EPackage;
+
+/**
+ * @author Eike Stepper
+ */
+public interface CDOPackageUnit extends Comparable<CDOPackageUnit>
+{
+ public CDOPackageRegistry getPackageRegistry();
+
+ public String getID();
+
+ public State getState();
+
+ public Type getType();
+
+ public Type getOriginalType();
+
+ public long getTimeStamp();
+
+ public CDOPackageInfo getTopLevelPackageInfo();
+
+ public CDOPackageInfo getPackageInfo(String packageURI);
+
+ public CDOPackageInfo[] getPackageInfos();
+
+ public EPackage[] getEPackages(boolean loadOnDemand);
+
+ public boolean isSystem();
+
+ /**
+ * @author Eike Stepper
+ */
+ public enum State
+ {
+ NEW, LOADED, PROXY, DISPOSED
+ }
+
+ /**
+ * @author Eike Stepper
+ */
+ public enum Type
+ {
+ NATIVE, LEGACY, DYNAMIC, UNKNOWN;
+
+ public boolean isGenerated()
+ {
+ checkNotUnknown();
+ return this == NATIVE || this == LEGACY;
+ }
+
+ public void checkNotUnknown()
+ {
+ if (this == UNKNOWN)
+ {
+ throw new IllegalStateException("Package unit type is unknown");
+ }
+ }
+ }
+}
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
index 28c668ee30..cb3f5e4be9 100644
--- 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
@@ -62,13 +62,15 @@ public interface CDOType
public static final CDOType BYTE_ARRAY = org.eclipse.emf.cdo.internal.common.model.CDOTypeImpl.BYTE_ARRAY;
+ public static final CDOType ENUM = org.eclipse.emf.cdo.internal.common.model.CDOTypeImpl.ENUM;
+
+ public static final CDOType CUSTOM = org.eclipse.emf.cdo.internal.common.model.CDOTypeImpl.CUSTOM;
+
/**
* @since 2.0
*/
public static final CDOType FEATURE_MAP_ENTRY = org.eclipse.emf.cdo.internal.common.model.CDOTypeImpl.FEATURE_MAP_ENTRY;
- public static final CDOType CUSTOM = org.eclipse.emf.cdo.internal.common.model.CDOTypeImpl.CUSTOM;
-
public String getName();
public int getTypeID();
diff --git a/plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/cdo/util/EMFUtil.java b/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/common/model/EMFUtil.java
index 4b0c3f82e1..5d68c398fb 100644
--- a/plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/cdo/util/EMFUtil.java
+++ b/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/common/model/EMFUtil.java
@@ -10,12 +10,13 @@
* Victor Roldan Betancort - http://bugs.eclipse.org/244801
* Simon McDuff - maintenance
*/
-package org.eclipse.emf.cdo.util;
-
-import org.eclipse.emf.internal.cdo.CDOFactoryImpl;
+package org.eclipse.emf.cdo.common.model;
+import org.eclipse.net4j.util.WrappedException;
import org.eclipse.net4j.util.io.IORuntimeException;
+import org.eclipse.emf.common.notify.Adapter;
+import org.eclipse.emf.common.notify.Notifier;
import org.eclipse.emf.common.util.EList;
import org.eclipse.emf.common.util.TreeIterator;
import org.eclipse.emf.common.util.URI;
@@ -34,17 +35,21 @@ import org.eclipse.emf.ecore.resource.Resource;
import org.eclipse.emf.ecore.resource.ResourceSet;
import org.eclipse.emf.ecore.resource.impl.ResourceSetImpl;
import org.eclipse.emf.ecore.util.EcoreUtil;
-import org.eclipse.emf.ecore.xmi.XMIResource;
import org.eclipse.emf.ecore.xmi.impl.EcoreResourceFactoryImpl;
import org.eclipse.emf.ecore.xmi.impl.XMIResourceFactoryImpl;
-import org.eclipse.emf.ecore.xmi.impl.XMIResourceImpl;
import java.io.ByteArrayInputStream;
import java.io.ByteArrayOutputStream;
import java.io.IOException;
import java.util.ArrayList;
+import java.util.Arrays;
import java.util.Collections;
+import java.util.Comparator;
+import java.util.HashMap;
import java.util.List;
+import java.util.Map;
+import java.util.Set;
+import java.util.Map.Entry;
/**
* @author Eike Stepper
@@ -52,12 +57,68 @@ import java.util.List;
*/
public final class EMFUtil
{
- private static final String ECORE_ENCODING = "ASCII";
-
private EMFUtil()
{
}
+ public static Map.Entry<String, Object>[] getSortedRegistryEntries(EPackage.Registry packageRegistry)
+ {
+ Set<Map.Entry<String, Object>> entries = packageRegistry.entrySet();
+ @SuppressWarnings("unchecked")
+ Map.Entry<String, Object>[] array = entries.toArray(new Entry[entries.size()]);
+ Arrays.sort(array, new Comparator<Map.Entry<String, Object>>()
+ {
+ public int compare(Map.Entry<String, Object> o1, Map.Entry<String, Object> o2)
+ {
+ return o1.getKey().compareTo(o2.getKey());
+ }
+ });
+
+ return array;
+ }
+
+ public static void registerPackage(EPackage ePackage, EPackage.Registry... packageRegistries)
+ {
+ ePackage.getClass(); // Initialize package in standalone mode
+ if (packageRegistries == null || packageRegistries.length == 0)
+ {
+ EPackage.Registry[] globalRegistry = { EPackage.Registry.INSTANCE };
+ packageRegistries = globalRegistry;
+ }
+
+ for (EPackage.Registry packageRegistry : packageRegistries)
+ {
+ packageRegistry.put(ePackage.getNsURI(), ePackage);
+ }
+ }
+
+ public static EClassifier getClassifier(EPackage ePackage, int classifierID)
+ {
+ EList<EClassifier> classifiers = ePackage.getEClassifiers();
+ for (EClassifier classifier : classifiers)
+ {
+ if (classifier.getClassifierID() == classifierID)
+ {
+ return classifier;
+ }
+ }
+
+ return null;
+ }
+
+ public static String getParentURI(EPackage ePackage)
+ {
+ EPackage superPackage = ePackage.getESuperPackage();
+ String parentURI = superPackage == null ? null : superPackage.getNsURI();
+ return parentURI;
+ }
+
+ public static EPackage getTopLevelPackage(EPackage ePackage)
+ {
+ EPackage superPackage = ePackage.getESuperPackage();
+ return superPackage == null ? ePackage : getTopLevelPackage(superPackage);
+ }
+
/**
* @since 2.0
*/
@@ -224,7 +285,25 @@ public final class EMFUtil
return count;
}
- public static List<EClass> getPersistentClasses(EPackage ePackage)
+ public static EClass[] getConcreteClasses(EPackage ePackage)
+ {
+ List<EClass> result = new ArrayList<EClass>(0);
+ for (EClassifier classifier : ePackage.getEClassifiers())
+ {
+ if (classifier instanceof EClass)
+ {
+ EClass eClass = (EClass)classifier;
+ if (!eClass.isAbstract() && !eClass.isInterface())
+ {
+ result.add(eClass);
+ }
+ }
+ }
+
+ return result.toArray(new EClass[result.size()]);
+ }
+
+ public static EClass[] getPersistentClasses(EPackage ePackage)
{
List<EClass> result = new ArrayList<EClass>();
for (EClassifier classifier : ePackage.getEClassifiers())
@@ -235,7 +314,7 @@ public final class EMFUtil
}
}
- return result;
+ return result.toArray(new EClass[result.size()]);
}
public static List<EStructuralFeature> getPersistentFeatures(EList<EStructuralFeature> eFeatures)
@@ -281,20 +360,6 @@ public final class EMFUtil
return value.getClass() == EPackageImpl.class;
}
- /**
- * @since 2.0
- */
- public static boolean prepareDynamicEPackage(EPackage ePackage)
- {
- if (isDynamicEPackage(ePackage))
- {
- ePackage.setEFactoryInstance(new CDOFactoryImpl(ePackage));
- return true;
- }
-
- return false;
- }
-
public static boolean isMany(EStructuralFeature eFeature)
{
return eFeature.isMany();
@@ -316,63 +381,120 @@ public final class EMFUtil
return false;
}
- public static EPackage ePackageFromString(String ecore)
+ public static byte[] getEPackageBytes(EPackage ePackage, boolean zipped, EPackage.Registry packageRegistry)
{
try
{
- ByteArrayInputStream stream = new ByteArrayInputStream(ecore.getBytes(ECORE_ENCODING));
- XMIResource resource = new XMIResourceImpl();
- resource.load(stream, null);
- return (EPackage)resource.getContents().get(0);
- }
- catch (RuntimeException ex)
- {
- throw ex;
+ Resource resource = ePackage.eResource();
+ if (resource == null)
+ {
+ resource = createEcoreResource(ePackage.getNsURI(), packageRegistry);
+ resource.getContents().add(ePackage);
+ }
+
+ ByteArrayOutputStream baos = new ByteArrayOutputStream();
+ resource.save(baos, createResourceOptions(zipped));
+ return baos.toByteArray();
}
- catch (IOException ex)
+ catch (Exception ex)
{
- throw new IORuntimeException(ex);
+ throw WrappedException.wrap(ex);
}
}
- public static String ePackageToString(EPackage ePackage, EPackage.Registry packageRegistry)
+ public static EPackage createEPackage(String uri, byte[] bytes, boolean zipped, EPackage.Registry packageRegistry)
{
- synchronized (EMFUtil.class)
+ try
{
- ePackage = (EPackage)EcoreUtil.copy(ePackage);
+ ByteArrayInputStream bais = new ByteArrayInputStream(bytes);
+ Resource resource = createEcoreResource(uri, packageRegistry);
+ resource.load(bais, createResourceOptions(zipped));
+
+ EList<EObject> contents = resource.getContents();
+ return (EPackage)contents.get(0);
+ }
+ catch (Exception ex)
+ {
+ throw WrappedException.wrap(ex);
}
+ }
- Resource.Factory resourceFactory = new XMIResourceFactoryImpl();
- ResourceSetImpl resourceSet = new ResourceSetImpl();
+ private static Resource createEcoreResource(String uri, EPackage.Registry packageRegistry)
+ {
+ ResourceSet resourceSet = new ResourceSetImpl();
+ resourceSet.setPackageRegistry(packageRegistry);
- Resource.Factory.Registry registry = resourceSet.getResourceFactoryRegistry();
- registry.getExtensionToFactoryMap().put("*", resourceFactory);
- registry.getProtocolToFactoryMap().put("*", resourceFactory);
+ Resource.Factory resourceFactory = new EcoreResourceFactoryImpl();
+ resourceSet.getResourceFactoryRegistry().getExtensionToFactoryMap().put("*", resourceFactory);
+ resourceSet.getResourceFactoryRegistry().getProtocolToFactoryMap().put("*", resourceFactory);
- Resource packageResource = createPackageResource(resourceSet, ePackage);
- ByteArrayOutputStream stream = new ByteArrayOutputStream();
+ return resourceSet.createResource(URI.createURI(uri));
+ }
- try
+ private static Map<String, Object> createResourceOptions(boolean zipped)
+ {
+ Map<String, Object> options = new HashMap<String, Object>();
+ if (zipped)
{
- packageResource.save(stream, null);
- String string = stream.toString(ECORE_ENCODING);
- return string;
+ options.put(Resource.OPTION_ZIP, true);
}
- catch (RuntimeException ex)
+
+ return options;
+ }
+
+ public static void addAdapter(Notifier notifier, Adapter adapter)
+ {
+ synchronized (notifier)
{
- throw ex;
+ EList<Adapter> adapters = notifier.eAdapters();
+ if (!adapters.contains(adapter))
+ {
+ adapters.add(adapter);
+ }
}
- catch (IOException ex)
+ }
+
+ public static EPackage[] getAllPackages(EPackage ePackage)
+ {
+ List<EPackage> result = new ArrayList<EPackage>();
+ getAllPackages(ePackage, result);
+ return result.toArray(new EPackage[result.size()]);
+ }
+
+ private static void getAllPackages(EPackage ePackage, List<EPackage> result)
+ {
+ result.add(ePackage);
+ for (EPackage subPackage : ePackage.getESubpackages())
{
- throw new IORuntimeException(ex);
+ getAllPackages(subPackage, result);
}
}
- private static Resource createPackageResource(ResourceSetImpl resourceSet, EPackage ePackage)
+ public static String getQualifiedName(EPackage ePackage, String separator)
{
- URI uri = URI.createURI(ePackage.getNsURI());
- Resource resource = resourceSet.createResource(uri);
- resource.getContents().add(ePackage);
- return resource;
+ StringBuilder builder = new StringBuilder();
+ EPackage eSuperPackage = ePackage.getESuperPackage();
+ if (eSuperPackage != null)
+ {
+ builder.append(getQualifiedName(eSuperPackage, separator));
+ builder.append(separator);
+ }
+
+ builder.append(ePackage.getName());
+ return builder.toString();
+ }
+
+ public static String getQualifiedName(EClassifier classifier, String separator)
+ {
+ StringBuilder builder = new StringBuilder();
+ EPackage ePackage = classifier.getEPackage();
+ if (ePackage != null)
+ {
+ builder.append(getQualifiedName(ePackage, separator));
+ builder.append(separator);
+ }
+
+ builder.append(classifier.getName());
+ return builder.toString();
}
}
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
deleted file mode 100644
index d80e05a854..0000000000
--- a/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/common/model/core/CDOCorePackage.java
+++ /dev/null
@@ -1,26 +0,0 @@
-/**
- * Copyright (c) 2004 - 2009 Eike Stepper (Berlin, Germany) and others.
- * 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
- * @noimplement This interface is not intended to be implemented by clients.
- */
-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/CDOFeatureMapEntryDataType.java b/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/common/model/core/CDOFeatureMapEntryDataType.java
deleted file mode 100644
index bf172fa84e..0000000000
--- a/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/common/model/core/CDOFeatureMapEntryDataType.java
+++ /dev/null
@@ -1,24 +0,0 @@
-/**
- * Copyright (c) 2004 - 2009 Eike Stepper (Berlin, Germany) and others.
- * 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.model.core;
-
-/**
- * @author Simon McDuff
- * @noimplement This interface is not intended to be implemented by clients.
- * @since 2.0
- */
-public interface CDOFeatureMapEntryDataType
-{
- public String getURI();
-
- public Object getObject();
-}
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
deleted file mode 100644
index a3bfd43b08..0000000000
--- a/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/common/model/core/CDOObjectClass.java
+++ /dev/null
@@ -1,24 +0,0 @@
-/**
- * Copyright (c) 2004 - 2009 Eike Stepper (Berlin, Germany) and others.
- * 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
- * @noimplement This interface is not intended to be implemented by clients.
- */
-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
deleted file mode 100644
index 6839b433d5..0000000000
--- a/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/common/model/resource/CDOContentsFeature.java
+++ /dev/null
@@ -1,24 +0,0 @@
-/**
- * Copyright (c) 2004 - 2009 Eike Stepper (Berlin, Germany) and others.
- * 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
- * @noimplement This interface is not intended to be implemented by clients.
- */
-public interface CDOContentsFeature extends CDOFeature
-{
- public static final int FEATURE_ID = 6;
-
- public static final String NAME = "contents";
-}
diff --git a/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/common/model/resource/CDOFolderFeature.java b/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/common/model/resource/CDOFolderFeature.java
deleted file mode 100644
index 3b5bdf4dc3..0000000000
--- a/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/common/model/resource/CDOFolderFeature.java
+++ /dev/null
@@ -1,25 +0,0 @@
-/**
- * Copyright (c) 2004 - 2009 Eike Stepper (Berlin, Germany) and others.
- * 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
- * @noimplement This interface is not intended to be implemented by clients.
- * @since 2.0
- */
-public interface CDOFolderFeature extends CDOFeature
-{
- public static final int FEATURE_ID = 0;
-
- public static final String NAME = "folder";
-}
diff --git a/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/common/model/resource/CDONameFeature.java b/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/common/model/resource/CDONameFeature.java
deleted file mode 100644
index 58703d595d..0000000000
--- a/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/common/model/resource/CDONameFeature.java
+++ /dev/null
@@ -1,25 +0,0 @@
-/**
- * Copyright (c) 2004 - 2009 Eike Stepper (Berlin, Germany) and others.
- * 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
- * @noimplement This interface is not intended to be implemented by clients.
- * @since 2.0
- */
-public interface CDONameFeature extends CDOFeature
-{
- public static final int FEATURE_ID = 1;
-
- public static final String NAME = "name";
-}
diff --git a/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/common/model/resource/CDONodesFeature.java b/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/common/model/resource/CDONodesFeature.java
deleted file mode 100644
index a052eb3cba..0000000000
--- a/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/common/model/resource/CDONodesFeature.java
+++ /dev/null
@@ -1,25 +0,0 @@
-/**
- * Copyright (c) 2004 - 2009 Eike Stepper (Berlin, Germany) and others.
- * 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
- * @noimplement This interface is not intended to be implemented by clients.
- * @since 2.0
- */
-public interface CDONodesFeature extends CDOFeature
-{
- public static final int FEATURE_ID = 3;
-
- public static final String NAME = "nodes";
-}
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
deleted file mode 100644
index fa0ee1f005..0000000000
--- a/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/common/model/resource/CDOResourceClass.java
+++ /dev/null
@@ -1,26 +0,0 @@
-/**
- * Copyright (c) 2004 - 2009 Eike Stepper (Berlin, Germany) and others.
- * 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
- * @noimplement This interface is not intended to be implemented by clients.
- */
-public interface CDOResourceClass extends CDOClass
-{
- public static final int CLASSIFIER_ID = 2;
-
- public static final String NAME = "CDOResource";
-
- public CDOContentsFeature getCDOContentsFeature();
-}
diff --git a/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/common/model/resource/CDOResourceFolderClass.java b/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/common/model/resource/CDOResourceFolderClass.java
deleted file mode 100644
index 1f338e970a..0000000000
--- a/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/common/model/resource/CDOResourceFolderClass.java
+++ /dev/null
@@ -1,27 +0,0 @@
-/**
- * Copyright (c) 2004 - 2009 Eike Stepper (Berlin, Germany) and others.
- * 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
- * @noimplement This interface is not intended to be implemented by clients.
- * @since 2.0
- */
-public interface CDOResourceFolderClass extends CDOClass
-{
- public static final int CLASSIFIER_ID = 1;
-
- public static final String NAME = "CDOResourceFolder";
-
- public CDONodesFeature getCDONodesFeature();
-}
diff --git a/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/common/model/resource/CDOResourceNodeClass.java b/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/common/model/resource/CDOResourceNodeClass.java
deleted file mode 100644
index e5190d6b4c..0000000000
--- a/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/common/model/resource/CDOResourceNodeClass.java
+++ /dev/null
@@ -1,29 +0,0 @@
-/**
- * Copyright (c) 2004 - 2009 Eike Stepper (Berlin, Germany) and others.
- * 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
- * @noimplement This interface is not intended to be implemented by clients.
- * @since 2.0
- */
-public interface CDOResourceNodeClass extends CDOClass
-{
- public static final int CLASSIFIER_ID = 0;
-
- public static final String NAME = "CDOResourceNode";
-
- public CDOFolderFeature getCDOFolderFeature();
-
- public CDONameFeature getCDONameFeature();
-}
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
deleted file mode 100644
index 07c03350c7..0000000000
--- a/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/common/model/resource/CDOResourcePackage.java
+++ /dev/null
@@ -1,36 +0,0 @@
-/**
- * Copyright (c) 2004 - 2009 Eike Stepper (Berlin, Germany) and others.
- * 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
- * @noimplement This interface is not intended to be implemented by clients.
- */
-public interface CDOResourcePackage extends CDOPackage
-{
- public static final String PACKAGE_URI = "http://www.eclipse.org/emf/CDO/resource/2.0.0";
-
- public static final String NAME = "cdoresource";
-
- /**
- * @since 2.0
- */
- public CDOResourceNodeClass getCDOResourceNodeClass();
-
- /**
- * @since 2.0
- */
- public CDOResourceFolderClass getCDOResourceFolderClass();
-
- public CDOResourceClass getCDOResourceClass();
-}
diff --git a/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/common/protocol/CDOProtocolConstants.java b/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/common/protocol/CDOProtocolConstants.java
index 1eede47451..7a83b607f0 100644
--- a/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/common/protocol/CDOProtocolConstants.java
+++ b/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/common/protocol/CDOProtocolConstants.java
@@ -33,7 +33,7 @@ public interface CDOProtocolConstants
public static final short SIGNAL_RESOURCE_ID = 4;
- public static final short SIGNAL_LOAD_PACKAGE = 6;
+ public static final short SIGNAL_LOAD_PACKAGES = 6;
public static final short SIGNAL_LOAD_REVISION = 7;
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
index 37cfcfc2c0..21e44f2179 100644
--- 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
@@ -12,9 +12,10 @@
package org.eclipse.emf.cdo.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.delta.CDORevisionDelta;
+import org.eclipse.emf.ecore.EClass;
+
/**
* @author Eike Stepper
* @noimplement This interface is not intended to be implemented by clients.
@@ -30,7 +31,7 @@ public interface CDORevision
public static final int UNCHUNKED = -1;
- public CDOClass getCDOClass();
+ public EClass getEClass();
public CDOID getID();
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
index eb4dfa518c..c1a7d08c8e 100644
--- 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
@@ -11,7 +11,8 @@
package org.eclipse.emf.cdo.common.revision;
import org.eclipse.emf.cdo.common.id.CDOID;
-import org.eclipse.emf.cdo.common.model.CDOFeature;
+
+import org.eclipse.emf.ecore.EStructuralFeature;
/**
* @author Eike Stepper
@@ -33,21 +34,21 @@ public interface CDORevisionData
public int getContainingFeatureID();
- public Object get(CDOFeature feature, int index);
+ public Object get(EStructuralFeature feature, int index);
- public int size(CDOFeature feature);
+ public int size(EStructuralFeature feature);
- public boolean isEmpty(CDOFeature feature);
+ public boolean isEmpty(EStructuralFeature feature);
- public boolean contains(CDOFeature feature, Object value);
+ public boolean contains(EStructuralFeature feature, Object value);
- public int indexOf(CDOFeature feature, Object value);
+ public int indexOf(EStructuralFeature feature, Object value);
- public int lastIndexOf(CDOFeature feature, Object value);
+ public int lastIndexOf(EStructuralFeature feature, Object value);
- public <T> T[] toArray(CDOFeature feature, T[] array);
+ public <T> T[] toArray(EStructuralFeature feature, T[] array);
- public Object[] toArray(CDOFeature feature);
+ public Object[] toArray(EStructuralFeature feature);
- public int hashCode(CDOFeature feature);
+ public int hashCode(EStructuralFeature feature);
}
diff --git a/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/common/revision/CDORevisionFactory.java b/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/common/revision/CDORevisionFactory.java
index 440070fd21..b5964e5676 100644
--- a/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/common/revision/CDORevisionFactory.java
+++ b/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/common/revision/CDORevisionFactory.java
@@ -12,7 +12,8 @@ package org.eclipse.emf.cdo.common.revision;
import org.eclipse.emf.cdo.common.id.CDOID;
import org.eclipse.emf.cdo.common.io.CDODataInput;
-import org.eclipse.emf.cdo.common.model.CDOClass;
+
+import org.eclipse.emf.ecore.EClass;
import java.io.IOException;
@@ -22,7 +23,7 @@ import java.io.IOException;
*/
public interface CDORevisionFactory
{
- public CDORevision createRevision(CDOClass cdoClass, CDOID id);
+ public CDORevision createRevision(EClass eClass, CDOID id);
public CDORevision createRevision(CDODataInput in) throws IOException;
}
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
index 2820a298bf..f8eb763e34 100644
--- 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
@@ -12,9 +12,10 @@ 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 org.eclipse.emf.cdo.common.revision.cache.CDORevisionCache;
+import org.eclipse.emf.ecore.EClass;
+
import java.util.Collection;
import java.util.List;
@@ -29,7 +30,7 @@ public interface CDORevisionResolver
/**
* @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 EClass getObjectType(CDOID id);
public boolean containsRevision(CDOID id);
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
index a47ab5330a..7a8d2d725e 100644
--- 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
@@ -13,11 +13,10 @@ 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.io.CDODataInput;
-import org.eclipse.emf.cdo.common.model.CDOClass;
-import org.eclipse.emf.cdo.common.model.core.CDOFeatureMapEntryDataType;
-import org.eclipse.emf.cdo.internal.common.model.core.CDOFeatureMapEntryDataTypeImpl;
import org.eclipse.emf.cdo.internal.common.revision.CDORevisionImpl;
+import org.eclipse.emf.ecore.EClass;
+
import java.io.IOException;
import java.util.Map;
@@ -35,9 +34,9 @@ public final class CDORevisionUtil
/**
* @since 2.0
*/
- public static CDORevision create(CDOClass cdoClass, CDOID id)
+ public static CDORevision create(EClass eClass, CDOID id)
{
- return new CDORevisionImpl(cdoClass, id);
+ return new CDORevisionImpl(eClass, id);
}
/**
@@ -48,14 +47,6 @@ public final class CDORevisionUtil
return new CDORevisionImpl(in);
}
- /**
- * @since 2.0
- */
- public static CDOFeatureMapEntryDataType createFeatureMapEntry(String uri, Object value)
- {
- return new CDOFeatureMapEntryDataTypeImpl(uri, value);
- }
-
public static Object remapID(Object value, Map<CDOIDTemp, CDOID> idMappings)
{
return CDORevisionImpl.remapID(value, idMappings);
diff --git a/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/common/revision/cache/CDORevisionCache.java b/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/common/revision/cache/CDORevisionCache.java
index 0c6a47c1cf..5aafc3499b 100644
--- a/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/common/revision/cache/CDORevisionCache.java
+++ b/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/common/revision/cache/CDORevisionCache.java
@@ -11,14 +11,14 @@
package org.eclipse.emf.cdo.common.revision.cache;
import org.eclipse.emf.cdo.common.id.CDOID;
-import org.eclipse.emf.cdo.common.model.CDOClass;
-import org.eclipse.emf.cdo.common.model.CDOPackageManager;
import org.eclipse.emf.cdo.common.revision.CDORevision;
import org.eclipse.emf.cdo.spi.common.revision.InternalCDORevision;
import org.eclipse.net4j.util.event.IEvent;
import org.eclipse.net4j.util.event.INotifier;
+import org.eclipse.emf.ecore.EClass;
+
import java.util.List;
/**
@@ -28,7 +28,7 @@ import java.util.List;
*/
public interface CDORevisionCache extends INotifier.Introspection
{
- public CDOClass getObjectType(CDOID id);
+ public EClass getObjectType(CDOID id);
public InternalCDORevision getRevision(CDOID id);
@@ -47,10 +47,6 @@ public interface CDORevisionCache extends INotifier.Introspection
public CDOID getResourceID(CDOID folderID, String name, long timeStamp);
- public CDOPackageManager getPackageManager();
-
- public void setPackageManager(CDOPackageManager packageManager);
-
public void clear();
/**
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
index e0679b784b..e826308445 100644
--- 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
@@ -13,7 +13,8 @@
package org.eclipse.emf.cdo.common.revision.delta;
import org.eclipse.emf.cdo.common.id.CDOID;
-import org.eclipse.emf.cdo.common.model.CDOFeature;
+
+import org.eclipse.emf.ecore.EStructuralFeature;
/**
* @author Simon McDuff
@@ -24,7 +25,7 @@ public interface CDOContainerFeatureDelta extends CDOFeatureDelta
/**
* @since 2.0
*/
- public static final CDOFeature CONTAINER_FEATURE = new org.eclipse.emf.cdo.internal.common.revision.delta.CDOContainerFeatureDeltaImpl.ContainerFeature();
+ public static final EStructuralFeature CONTAINER_FEATURE = new org.eclipse.emf.cdo.internal.common.revision.delta.CDOContainerFeatureDeltaImpl.ContainerFeature();
/**
* @since 2.0
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
index d40a5ce774..31c2ec95dd 100644
--- 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
@@ -11,9 +11,10 @@
*/
package org.eclipse.emf.cdo.common.revision.delta;
-import org.eclipse.emf.cdo.common.model.CDOFeature;
import org.eclipse.emf.cdo.common.revision.CDORevision;
+import org.eclipse.emf.ecore.EStructuralFeature;
+
/**
* @author Simon McDuff
* @noimplement This interface is not intended to be implemented by clients.
@@ -22,7 +23,7 @@ public interface CDOFeatureDelta
{
public Type getType();
- public CDOFeature getFeature();
+ public EStructuralFeature getFeature();
public void apply(CDORevision revision);
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
index 3c9f138653..aa956755af 100644
--- 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
@@ -13,7 +13,6 @@ package org.eclipse.emf.cdo.common.revision.delta;
/**
* @author Simon McDuff
- * @noimplement This interface is not intended to be implemented by clients.
*/
public interface CDOFeatureDeltaVisitor
{
diff --git a/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/internal/common/CDOQueryInfoImpl.java b/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/internal/common/CDOQueryInfoImpl.java
index 8ac6d7d434..27a9e9c5df 100644
--- a/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/internal/common/CDOQueryInfoImpl.java
+++ b/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/internal/common/CDOQueryInfoImpl.java
@@ -50,7 +50,7 @@ public class CDOQueryInfoImpl implements CDOQueryInfo
for (int i = 0; i < size; i++)
{
String key = in.readString();
- Object object = in.readCDORevisionOrPrimitiveOrClass();
+ Object object = in.readCDORevisionOrPrimitiveOrClassifier();
parameters.put(key, object);
}
}
@@ -65,7 +65,7 @@ public class CDOQueryInfoImpl implements CDOQueryInfo
for (Entry<String, Object> entry : parameters.entrySet())
{
out.writeString(entry.getKey());
- out.writeCDORevisionOrPrimitiveOrClass(entry.getValue());
+ out.writeCDORevisionOrPrimitiveOrClassifier(entry.getValue());
}
}
diff --git a/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/internal/common/id/CDOIDExternalImpl.java b/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/internal/common/id/CDOIDExternalImpl.java
index 57d39a71a8..6af6bfe84a 100644
--- a/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/internal/common/id/CDOIDExternalImpl.java
+++ b/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/internal/common/id/CDOIDExternalImpl.java
@@ -11,6 +11,7 @@
*/
package org.eclipse.emf.cdo.internal.common.id;
+import org.eclipse.emf.cdo.common.id.CDOID;
import org.eclipse.emf.cdo.common.id.CDOIDExternal;
import org.eclipse.emf.cdo.spi.common.id.AbstractCDOID;
@@ -96,4 +97,9 @@ public class CDOIDExternalImpl extends AbstractCDOID implements CDOIDExternal
return getClass().hashCode() ^ uri.hashCode();
}
+ @Override
+ protected int doCompareTo(CDOID o) throws ClassCastException
+ {
+ return getURI().compareTo(((CDOIDExternalImpl)o).getURI());
+ }
}
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
index 55c55f893e..a100939aad 100644
--- 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
@@ -10,6 +10,7 @@
*/
package org.eclipse.emf.cdo.internal.common.id;
+import org.eclipse.emf.cdo.common.id.CDOID;
import org.eclipse.emf.cdo.common.id.CDOIDMeta;
import org.eclipse.emf.cdo.spi.common.id.AbstractCDOIDLong;
@@ -35,4 +36,10 @@ public class CDOIDMetaImpl extends AbstractCDOIDLong implements CDOIDMeta
{
return "MID" + getLongValue();
}
+
+ @Override
+ protected int doCompareTo(CDOID o) throws ClassCastException
+ {
+ return new Long(getLongValue()).compareTo(((CDOIDMetaImpl)o).getLongValue());
+ }
}
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
index f181074d48..7858c98303 100644
--- 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
@@ -12,6 +12,7 @@
*/
package org.eclipse.emf.cdo.internal.common.id;
+import org.eclipse.emf.cdo.common.id.CDOID;
import org.eclipse.emf.cdo.common.id.CDOIDMeta;
import org.eclipse.emf.cdo.common.id.CDOIDObject;
import org.eclipse.emf.cdo.common.id.CDOIDTemp;
@@ -90,4 +91,11 @@ public final class CDOIDNullImpl extends AbstractCDOID implements CDOIDMeta, CDO
{
return "NULL";
}
+
+ @Override
+ protected int doCompareTo(CDOID o) throws ClassCastException
+ {
+ ((CDOIDNullImpl)o).getIntValue(); // Possibly throw ClassCastException
+ return 0; // NULL == 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
index 49d8030fa6..bf1840095e 100644
--- 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
@@ -11,6 +11,7 @@
*/
package org.eclipse.emf.cdo.internal.common.id;
+import org.eclipse.emf.cdo.common.id.CDOID;
import org.eclipse.emf.cdo.common.id.CDOIDTempMeta;
import org.eclipse.emf.cdo.spi.common.id.AbstractCDOIDInteger;
@@ -36,4 +37,10 @@ public class CDOIDTempMetaImpl extends AbstractCDOIDInteger implements CDOIDTemp
{
return "mid" + getIntValue();
}
+
+ @Override
+ protected int doCompareTo(CDOID o) throws ClassCastException
+ {
+ return new Integer(getIntValue()).compareTo(((CDOIDTempMetaImpl)o).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
index 1922036771..e1397f207f 100644
--- 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
@@ -10,6 +10,7 @@
*/
package org.eclipse.emf.cdo.internal.common.id;
+import org.eclipse.emf.cdo.common.id.CDOID;
import org.eclipse.emf.cdo.common.id.CDOIDTemp;
import org.eclipse.emf.cdo.spi.common.id.AbstractCDOIDInteger;
@@ -35,4 +36,10 @@ public class CDOIDTempObjectImpl extends AbstractCDOIDInteger implements CDOIDTe
{
return "oid" + getIntValue();
}
+
+ @Override
+ protected int doCompareTo(CDOID o) throws ClassCastException
+ {
+ return new Integer(getIntValue()).compareTo(((CDOIDTempObjectImpl)o).getIntValue());
+ }
}
diff --git a/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/internal/common/io/CDODataInputImpl.java b/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/internal/common/io/CDODataInputImpl.java
index 0fa04aac62..63bab7c3db 100644
--- a/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/internal/common/io/CDODataInputImpl.java
+++ b/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/internal/common/io/CDODataInputImpl.java
@@ -18,13 +18,11 @@ import org.eclipse.emf.cdo.common.id.CDOIDObject;
import org.eclipse.emf.cdo.common.id.CDOIDObjectFactory;
import org.eclipse.emf.cdo.common.id.CDOID.Type;
import org.eclipse.emf.cdo.common.io.CDODataInput;
-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.CDOClassifierRef;
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.CDOPackageURICompressor;
+import org.eclipse.emf.cdo.common.model.CDOPackageInfo;
+import org.eclipse.emf.cdo.common.model.CDOPackageRegistry;
+import org.eclipse.emf.cdo.common.model.CDOPackageUnit;
import org.eclipse.emf.cdo.common.model.CDOType;
import org.eclipse.emf.cdo.common.revision.CDOList;
import org.eclipse.emf.cdo.common.revision.CDOListFactory;
@@ -41,10 +39,6 @@ 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.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.revision.delta.CDOAddFeatureDeltaImpl;
import org.eclipse.emf.cdo.internal.common.revision.delta.CDOClearFeatureDeltaImpl;
import org.eclipse.emf.cdo.internal.common.revision.delta.CDOContainerFeatureDeltaImpl;
@@ -55,185 +49,95 @@ import org.eclipse.emf.cdo.internal.common.revision.delta.CDORevisionDeltaImpl;
import org.eclipse.emf.cdo.internal.common.revision.delta.CDOSetFeatureDeltaImpl;
import org.eclipse.emf.cdo.internal.common.revision.delta.CDOUnsetFeatureDeltaImpl;
import org.eclipse.emf.cdo.spi.common.id.AbstractCDOID;
-import org.eclipse.emf.cdo.spi.common.model.InternalCDOPackage;
+import org.eclipse.emf.cdo.spi.common.model.InternalCDOPackageInfo;
+import org.eclipse.emf.cdo.spi.common.model.InternalCDOPackageRegistry;
+import org.eclipse.emf.cdo.spi.common.model.InternalCDOPackageUnit;
import org.eclipse.emf.cdo.spi.common.revision.InternalCDOList;
+import org.eclipse.emf.cdo.spi.common.revision.InternalCDORevision;
import org.eclipse.net4j.util.ImplementationError;
import org.eclipse.net4j.util.concurrent.RWLockManager;
import org.eclipse.net4j.util.io.ExtendedDataInput;
-import org.eclipse.net4j.util.io.ExtendedIOUtil.ClassResolver;
+import org.eclipse.net4j.util.io.StringIO;
import org.eclipse.net4j.util.om.trace.ContextTracer;
+import org.eclipse.emf.ecore.EClass;
+import org.eclipse.emf.ecore.EClassifier;
+import org.eclipse.emf.ecore.EStructuralFeature;
+
import java.io.IOException;
/**
* @author Eike Stepper
*/
-public abstract class CDODataInputImpl implements CDODataInput
+public abstract class CDODataInputImpl extends ExtendedDataInput.Delegating implements CDODataInput
{
private static final ContextTracer TRACER = new ContextTracer(OM.DEBUG_PROTOCOL, CDODataInputImpl.class);
- private ExtendedDataInput in;
-
- public CDODataInputImpl(ExtendedDataInput in)
- {
- this.in = in;
- }
-
- public ExtendedDataInput getDelegate()
- {
- return in;
- }
-
- public boolean readBoolean() throws IOException
- {
- return in.readBoolean();
- }
-
- public byte readByte() throws IOException
- {
- return in.readByte();
- }
-
- public byte[] readByteArray() throws IOException
- {
- return in.readByteArray();
- }
-
- public char readChar() throws IOException
- {
- return in.readChar();
- }
-
- public double readDouble() throws IOException
- {
- return in.readDouble();
- }
-
- public float readFloat() throws IOException
- {
- return in.readFloat();
- }
-
- public void readFully(byte[] b, int off, int len) throws IOException
- {
- in.readFully(b, off, len);
- }
-
- public void readFully(byte[] b) throws IOException
- {
- in.readFully(b);
- }
-
- public int readInt() throws IOException
+ public CDODataInputImpl(ExtendedDataInput delegate)
{
- return in.readInt();
+ super(delegate);
}
- public String readLine() throws IOException
+ public CDOPackageUnit readCDOPackageUnit(CDOPackageRegistry packageRegistry) throws IOException
{
- return in.readLine();
+ InternalCDOPackageUnit packageUnit = (InternalCDOPackageUnit)CDOModelUtil.createPackageUnit();
+ packageUnit.read(this, (InternalCDOPackageRegistry)packageRegistry);
+ return packageUnit;
}
- public long readLong() throws IOException
+ public CDOPackageUnit[] readCDOPackageUnits(CDOPackageRegistry packageRegistry) throws IOException
{
- return in.readLong();
- }
-
- public Object readObject() throws IOException
- {
- return in.readObject();
- }
-
- public Object readObject(ClassLoader classLoader) throws IOException
- {
- return in.readObject(classLoader);
- }
+ int size = readInt();
+ if (TRACER.isEnabled())
+ {
+ TRACER.format("Reading {0} package units", size);
+ }
- public Object readObject(ClassResolver classResolver) throws IOException
- {
- return in.readObject(classResolver);
- }
+ CDOPackageUnit[] packageUnits = new CDOPackageUnit[size];
+ for (int i = 0; i < size; i++)
+ {
+ packageUnits[i] = readCDOPackageUnit(packageRegistry);
+ }
- public short readShort() throws IOException
- {
- return in.readShort();
+ return packageUnits;
}
- public String readString() throws IOException
+ public CDOPackageUnit.Type readCDOPackageUnitType() throws IOException
{
- return in.readString();
+ return CDOPackageUnit.Type.values()[readByte()];
}
- public int readUnsignedByte() throws IOException
+ public CDOPackageInfo readCDOPackageInfo() throws IOException
{
- return in.readUnsignedByte();
+ InternalCDOPackageInfo packageInfo = (InternalCDOPackageInfo)CDOModelUtil.createPackageInfo();
+ packageInfo.read(this);
+ return packageInfo;
}
- public int readUnsignedShort() throws IOException
+ public String readCDOPackageURI() throws IOException
{
- return in.readUnsignedShort();
+ return getPackageURICompressor().read(this);
}
- public String readUTF() throws IOException
+ public CDOClassifierRef readCDOClassifierRef() throws IOException
{
- return in.readUTF();
+ return new CDOClassifierRef(this);
}
- public int skipBytes(int n) throws IOException
+ public EClassifier readCDOClassifierRefAndResolve() throws IOException
{
- return in.skipBytes(n);
+ CDOClassifierRef classRef = readCDOClassifierRef();
+ return classRef.resolve(getPackageRegistry());
}
public CDOType readCDOType() throws IOException
{
+ // TODO Use byte IDs
int typeID = readInt();
return CDOModelUtil.getType(typeID);
}
- public String readCDOPackageURI() throws IOException
- {
- return getPackageURICompressor().readPackageURI(this);
- }
-
- public void readCDOPackage(CDOPackage cdoPackage) throws IOException
- {
- ((InternalCDOPackage)cdoPackage).read(this);
- }
-
- public CDOPackage readCDOPackage() throws IOException
- {
- return new CDOPackageImpl(getPackageManager(), this);
- }
-
- public CDOClassRef readCDOClassRef() throws IOException
- {
- return new CDOClassRefImpl(this);
- }
-
- public CDOClass readCDOClassRefAndResolve() throws IOException
- {
- CDOClassRef classRef = readCDOClassRef();
- CDOPackageManager packageManager = getPackageManager();
- CDOClass cdoClass = classRef.resolve(packageManager);
- if (cdoClass == null)
- {
- throw new IllegalStateException("ClassRef unresolveable: " + classRef);
- }
-
- return cdoClass;
- }
-
- public CDOClass readCDOClass(CDOPackage containingPackage) throws IOException
- {
- return new CDOClassImpl(containingPackage, this);
- }
-
- public CDOFeature readCDOFeature(CDOClass containingClass) throws IOException
- {
- return new CDOFeatureImpl(containingClass, this);
- }
-
public CDOID readCDOID() throws IOException
{
byte ordinal = readByte();
@@ -306,26 +210,23 @@ public abstract class CDODataInputImpl implements CDODataInput
boolean notNull = readBoolean();
if (notNull)
{
- return readCDORevisionData();
+ return CDORevisionUtil.read(this);
}
return null;
}
- public CDOList readCDOList(CDORevision revision, CDOFeature feature) throws IOException
+ public CDOList readCDOList(CDORevision revision, EStructuralFeature feature) throws IOException
{
- // TODO Simon: Could most of this stuff be moved into the list?
- // (only if protected methods of this class don't need to become public)
- CDOType type = feature.getType();
int referenceChunk;
- int size = in.readInt();
+ int size = readInt();
if (size < 0)
{
size = -size;
- referenceChunk = in.readInt();
+ referenceChunk = readInt();
if (TRACER.isEnabled())
{
- TRACER.format("Read feature {0}: size={1}, referenceChunk={2}", feature, size, referenceChunk);
+ TRACER.format("Read feature {0}: size={1}, referenceChunk={2}", feature.getName(), size, referenceChunk);
}
}
else
@@ -333,10 +234,11 @@ public abstract class CDODataInputImpl implements CDODataInput
referenceChunk = size;
if (TRACER.isEnabled())
{
- TRACER.format("Read feature {0}: size={1}", feature, size);
+ TRACER.format("Read feature {0}: size={1}", feature.getName(), size);
}
}
+ CDOType type = CDOModelUtil.getType(feature.getEType());
InternalCDOList list = (InternalCDOList)getListFactory().createList(size, size, referenceChunk);
for (int j = 0; j < referenceChunk; j++)
{
@@ -351,40 +253,54 @@ public abstract class CDODataInputImpl implements CDODataInput
return list;
}
+ public Object readCDOFeatureValue(EStructuralFeature feature) throws IOException
+ {
+ CDOType type = CDOModelUtil.getType(feature.getEType());
+ if (type.canBeNull() && !feature.isMany())
+ {
+ if (readBoolean())
+ {
+ return InternalCDORevision.NIL;
+ }
+ }
+
+ return type.readValue(this);
+ }
+
public CDORevisionDelta readCDORevisionDelta() throws IOException
{
return new CDORevisionDeltaImpl(this);
}
- public CDOFeatureDelta readCDOFeatureDelta(CDOClass cdoClass) throws IOException
+ public CDOFeatureDelta readCDOFeatureDelta(EClass eClass) throws IOException
{
int typeOrdinal = readInt();
CDOFeatureDelta.Type type = CDOFeatureDelta.Type.values()[typeOrdinal];
switch (type)
{
case ADD:
- return new CDOAddFeatureDeltaImpl(this, cdoClass);
+ return new CDOAddFeatureDeltaImpl(this, eClass);
case SET:
- return new CDOSetFeatureDeltaImpl(this, cdoClass);
+ return new CDOSetFeatureDeltaImpl(this, eClass);
case LIST:
- return new CDOListFeatureDeltaImpl(this, cdoClass);
+ return new CDOListFeatureDeltaImpl(this, eClass);
case MOVE:
- return new CDOMoveFeatureDeltaImpl(this, cdoClass);
+ return new CDOMoveFeatureDeltaImpl(this, eClass);
case CLEAR:
- return new CDOClearFeatureDeltaImpl(this, cdoClass);
+ return new CDOClearFeatureDeltaImpl(this, eClass);
case REMOVE:
- return new CDORemoveFeatureDeltaImpl(this, cdoClass);
+ return new CDORemoveFeatureDeltaImpl(this, eClass);
case CONTAINER:
- return new CDOContainerFeatureDeltaImpl(this, cdoClass);
+ return new CDOContainerFeatureDeltaImpl(this, eClass);
case UNSET:
- return new CDOUnsetFeatureDeltaImpl(this, cdoClass);
+ return new CDOUnsetFeatureDeltaImpl(this, eClass);
default:
throw new IOException("Invalid type " + typeOrdinal);
@@ -397,12 +313,12 @@ public abstract class CDODataInputImpl implements CDODataInput
return type.readValue(this);
}
- public Object readCDORevisionOrPrimitiveOrClass() throws IOException
+ public Object readCDORevisionOrPrimitiveOrClassifier() throws IOException
{
- boolean isClass = readBoolean();
- if (isClass)
+ boolean isClassifier = readBoolean();
+ if (isClassifier)
{
- return readCDOClassRefAndResolve();
+ return readCDOClassifierRefAndResolve();
}
return readCDORevisionOrPrimitive();
@@ -413,14 +329,12 @@ public abstract class CDODataInputImpl implements CDODataInput
return readBoolean() ? RWLockManager.LockType.WRITE : RWLockManager.LockType.READ;
}
- protected CDORevision readCDORevisionData() throws IOException
+ protected StringIO getPackageURICompressor()
{
- return CDORevisionUtil.read(this);
+ return StringIO.DIRECT;
}
- protected abstract CDOPackageManager getPackageManager();
-
- protected abstract CDOPackageURICompressor getPackageURICompressor();
+ protected abstract CDOPackageRegistry getPackageRegistry();
protected abstract CDORevisionResolver getRevisionResolver();
diff --git a/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/internal/common/io/CDODataOutputImpl.java b/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/internal/common/io/CDODataOutputImpl.java
index ef41c83add..00da894be8 100644
--- a/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/internal/common/io/CDODataOutputImpl.java
+++ b/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/internal/common/io/CDODataOutputImpl.java
@@ -15,11 +15,10 @@ import org.eclipse.emf.cdo.common.id.CDOIDAndVersion;
import org.eclipse.emf.cdo.common.id.CDOIDMetaRange;
import org.eclipse.emf.cdo.common.id.CDOID.Type;
import org.eclipse.emf.cdo.common.io.CDODataOutput;
-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.CDOPackage;
-import org.eclipse.emf.cdo.common.model.CDOPackageURICompressor;
+import org.eclipse.emf.cdo.common.model.CDOClassifierRef;
+import org.eclipse.emf.cdo.common.model.CDOModelUtil;
+import org.eclipse.emf.cdo.common.model.CDOPackageInfo;
+import org.eclipse.emf.cdo.common.model.CDOPackageUnit;
import org.eclipse.emf.cdo.common.model.CDOType;
import org.eclipse.emf.cdo.common.revision.CDOList;
import org.eclipse.emf.cdo.common.revision.CDORevision;
@@ -28,142 +27,81 @@ import org.eclipse.emf.cdo.common.revision.delta.CDOFeatureDelta;
import org.eclipse.emf.cdo.common.revision.delta.CDORevisionDelta;
import org.eclipse.emf.cdo.internal.common.bundle.OM;
import org.eclipse.emf.cdo.internal.common.id.CDOIDAndVersionImpl;
-import org.eclipse.emf.cdo.internal.common.model.CDOClassRefImpl;
import org.eclipse.emf.cdo.internal.common.model.CDOTypeImpl;
import org.eclipse.emf.cdo.internal.common.revision.delta.CDOFeatureDeltaImpl;
import org.eclipse.emf.cdo.internal.common.revision.delta.CDORevisionDeltaImpl;
import org.eclipse.emf.cdo.spi.common.id.AbstractCDOID;
-import org.eclipse.emf.cdo.spi.common.model.InternalCDOClass;
-import org.eclipse.emf.cdo.spi.common.model.InternalCDOFeature;
-import org.eclipse.emf.cdo.spi.common.model.InternalCDOPackage;
+import org.eclipse.emf.cdo.spi.common.model.InternalCDOPackageInfo;
+import org.eclipse.emf.cdo.spi.common.model.InternalCDOPackageUnit;
import org.eclipse.emf.cdo.spi.common.revision.InternalCDORevision;
import org.eclipse.net4j.util.concurrent.RWLockManager;
import org.eclipse.net4j.util.io.ExtendedDataOutput;
+import org.eclipse.net4j.util.io.StringIO;
import org.eclipse.net4j.util.om.trace.ContextTracer;
+import org.eclipse.emf.ecore.EClass;
+import org.eclipse.emf.ecore.EClassifier;
+import org.eclipse.emf.ecore.EReference;
+import org.eclipse.emf.ecore.EStructuralFeature;
+
import java.io.IOException;
-import java.util.Date;
-import java.util.HashMap;
-import java.util.Map;
/**
* @author Eike Stepper
*/
-public abstract class CDODataOutputImpl implements CDODataOutput
+public abstract class CDODataOutputImpl extends ExtendedDataOutput.Delegating implements CDODataOutput
{
private static final ContextTracer TRACER = new ContextTracer(OM.DEBUG_PROTOCOL, CDODataOutputImpl.class);
- private static final Map<Class<?>, CDOType> idTypes = new HashMap<Class<?>, CDOType>();
-
- private ExtendedDataOutput out;
-
- static
- {
- idTypes.put(String.class, CDOType.STRING);
- idTypes.put(Boolean.class, CDOType.BOOLEAN);
- idTypes.put(Date.class, CDOType.DATE);
- idTypes.put(Long.class, CDOType.LONG);
- idTypes.put(Integer.class, CDOType.INT);
- idTypes.put(Double.class, CDOType.DOUBLE);
- idTypes.put(Byte.class, CDOType.BYTE);
- idTypes.put(Character.class, CDOType.CHAR);
- idTypes.put(Float.class, CDOType.FLOAT);
- }
-
- public CDODataOutputImpl(ExtendedDataOutput out)
- {
- this.out = out;
- }
-
- public ExtendedDataOutput getDelegate()
- {
- return out;
- }
-
- public void write(byte[] b, int off, int len) throws IOException
- {
- out.write(b, off, len);
- }
-
- public void write(byte[] b) throws IOException
- {
- out.write(b);
- }
-
- public void write(int b) throws IOException
- {
- out.write(b);
- }
-
- public void writeBoolean(boolean v) throws IOException
+ public CDODataOutputImpl(ExtendedDataOutput delegate)
{
- out.writeBoolean(v);
+ super(delegate);
}
- public void writeByte(int v) throws IOException
+ public void writeCDOPackageUnit(CDOPackageUnit packageUnit, boolean withPackages) throws IOException
{
- out.writeByte(v);
+ ((InternalCDOPackageUnit)packageUnit).write(this, withPackages);
}
- public void writeByteArray(byte[] b) throws IOException
+ public void writeCDOPackageUnits(CDOPackageUnit... packageUnits) throws IOException
{
- out.writeByteArray(b);
- }
-
- public void writeBytes(String s) throws IOException
- {
- out.writeBytes(s);
- }
-
- public void writeChar(int v) throws IOException
- {
- out.writeChar(v);
- }
-
- public void writeChars(String s) throws IOException
- {
- out.writeChars(s);
- }
-
- public void writeDouble(double v) throws IOException
- {
- out.writeDouble(v);
- }
-
- public void writeFloat(float v) throws IOException
- {
- out.writeFloat(v);
- }
+ int size = packageUnits.length;
+ writeInt(size);
+ if (TRACER.isEnabled())
+ {
+ TRACER.format("Writing {0} package units", size);
+ }
- public void writeInt(int v) throws IOException
- {
- out.writeInt(v);
+ for (CDOPackageUnit packageUnit : packageUnits)
+ {
+ writeCDOPackageUnit(packageUnit, false);
+ }
}
- public void writeLong(long v) throws IOException
+ public void writeCDOPackageUnitType(CDOPackageUnit.Type type) throws IOException
{
- out.writeLong(v);
+ writeByte(type.ordinal());
}
- public void writeObject(Object object) throws IOException
+ public void writeCDOPackageInfo(CDOPackageInfo packageInfo) throws IOException
{
- out.writeObject(object);
+ ((InternalCDOPackageInfo)packageInfo).write(this);
}
- public void writeShort(int v) throws IOException
+ public void writeCDOClassifierRef(CDOClassifierRef eClassifierRef) throws IOException
{
- out.writeShort(v);
+ eClassifierRef.write(this);
}
- public void writeString(String str) throws IOException
+ public void writeCDOClassifierRef(EClassifier eClassifier) throws IOException
{
- out.writeString(str);
+ writeCDOClassifierRef(new CDOClassifierRef(eClassifier));
}
- public void writeUTF(String str) throws IOException
+ public void writeCDOPackageURI(String uri) throws IOException
{
- out.writeUTF(str);
+ getPackageURICompressor().write(this, uri);
}
public void writeCDOType(CDOType cdoType) throws IOException
@@ -171,36 +109,6 @@ public abstract class CDODataOutputImpl implements CDODataOutput
((CDOTypeImpl)cdoType).write(this);
}
- public void writeCDOPackageURI(String uri) throws IOException
- {
- getPackageURICompressor().writePackageURI(this, uri);
- }
-
- public void writeCDOClassRef(CDOClassRef cdoClassRef) throws IOException
- {
- ((CDOClassRefImpl)cdoClassRef).write(this);
- }
-
- public void writeCDOClassRef(CDOClass cdoClass) throws IOException
- {
- writeCDOClassRef(cdoClass.createClassRef());
- }
-
- public void writeCDOPackage(CDOPackage cdoPackage) throws IOException
- {
- ((InternalCDOPackage)cdoPackage).write(this);
- }
-
- public void writeCDOClass(CDOClass cdoClass) throws IOException
- {
- ((InternalCDOClass)cdoClass).write(this);
- }
-
- public void writeCDOFeature(CDOFeature cdoFeature) throws IOException
- {
- ((InternalCDOFeature)cdoFeature).write(this);
- }
-
public void writeCDOID(CDOID id) throws IOException
{
if (id == null)
@@ -251,7 +159,7 @@ public abstract class CDODataOutputImpl implements CDODataOutput
}
}
- public void writeCDOList(CDOList list, CDOFeature feature, int referenceChunk) throws IOException
+ public void writeCDOList(CDOList list, EStructuralFeature feature, int referenceChunk) throws IOException
{
// TODO Simon: Could most of this stuff be moved into the list?
// (only if protected methods of this class don't need to become public)
@@ -277,27 +185,27 @@ public abstract class CDODataOutputImpl implements CDODataOutput
// This happens only on server-side
if (TRACER.isEnabled())
{
- TRACER.format("Writing feature {0}: size={1}, referenceChunk={2}", feature, size, referenceChunk);
+ TRACER.format("Writing feature {0}: size={1}, referenceChunk={2}", feature.getName(), size, referenceChunk);
}
- out.writeInt(-size);
- out.writeInt(referenceChunk);
+ writeInt(-size);
+ writeInt(referenceChunk);
size = referenceChunk;
}
else
{
if (TRACER.isEnabled())
{
- TRACER.format("Writing feature {0}: size={1}", feature, size);
+ TRACER.format("Writing feature {0}: size={1}", feature.getName(), size);
}
- out.writeInt(size);
+ writeInt(size);
}
for (int j = 0; j < size; j++)
{
Object value = list.get(j, false);
- if (value != null && feature.isReference())
+ if (value != null && feature instanceof EReference)
{
value = getIDProvider().provideCDOID(value);
}
@@ -307,18 +215,50 @@ public abstract class CDODataOutputImpl implements CDODataOutput
TRACER.trace(" " + value);
}
- feature.getType().writeValue(this, value);
+ writeCDOFeatureValue(value, feature);
}
}
+ public void writeCDOFeatureValue(Object value, EStructuralFeature feature) throws IOException
+ {
+ // TODO We could certainly optimized this: When a feature is a reference, NIL is only possible in the case where
+ // unsettable == true. (TO be verified)
+
+ CDOType type = CDOModelUtil.getType(feature.getEType());
+ if (type.canBeNull())
+ {
+ if (!feature.isMany())
+ {
+ if (value == InternalCDORevision.NIL)
+ {
+ writeBoolean(true);
+ return;
+ }
+ else
+ {
+ writeBoolean(false);
+ }
+ }
+ }
+ else
+ {
+ if (value == null)
+ {
+ value = feature.getDefaultValue();
+ }
+ }
+
+ type.writeValue(this, value);
+ }
+
public void writeCDORevisionDelta(CDORevisionDelta revisionDelta) throws IOException
{
((CDORevisionDeltaImpl)revisionDelta).write(this);
}
- public void writeCDOFeatureDelta(CDOFeatureDelta featureDelta, CDOClass cdoClass) throws IOException
+ public void writeCDOFeatureDelta(CDOFeatureDelta featureDelta, EClass eClass) throws IOException
{
- ((CDOFeatureDeltaImpl)featureDelta).write(this, cdoClass);
+ ((CDOFeatureDeltaImpl)featureDelta).write(this, eClass);
}
public void writeCDORevisionOrPrimitive(Object value) throws IOException
@@ -335,7 +275,8 @@ public abstract class CDODataOutputImpl implements CDODataOutput
CDOType type = null;
if (value instanceof CDOID)
{
- if (((CDOID)value).isTemporary())
+ CDOID id = (CDOID)value;
+ if (id.isTemporary())
{
throw new IllegalArgumentException("Temporary ID not supported: " + value);
}
@@ -344,10 +285,10 @@ public abstract class CDODataOutputImpl implements CDODataOutput
}
else
{
- type = idTypes.get(value.getClass());
+ type = CDOModelUtil.getPrimitiveType(value.getClass());
if (type == null)
{
- throw new IllegalArgumentException("No type for object " + value.getClass());
+ throw new IllegalArgumentException("No type for object of class " + value.getClass());
}
}
@@ -355,12 +296,12 @@ public abstract class CDODataOutputImpl implements CDODataOutput
type.writeValue(this, value);
}
- public void writeCDORevisionOrPrimitiveOrClass(Object value) throws IOException
+ public void writeCDORevisionOrPrimitiveOrClassifier(Object value) throws IOException
{
- if (value instanceof CDOClass)
+ if (value instanceof EClassifier)
{
writeBoolean(true);
- writeCDOClassRef(((CDOClass)value).createClassRef());
+ writeCDOClassifierRef((EClass)value);
}
else
{
@@ -374,5 +315,8 @@ public abstract class CDODataOutputImpl implements CDODataOutput
writeBoolean(lockType == RWLockManager.LockType.WRITE ? true : false);
}
- protected abstract CDOPackageURICompressor getPackageURICompressor();
+ protected StringIO getPackageURICompressor()
+ {
+ return StringIO.DIRECT;
+ }
}
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
deleted file mode 100644
index 6d1ec98866..0000000000
--- a/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/internal/common/model/CDOClassImpl.java
+++ /dev/null
@@ -1,461 +0,0 @@
-/**
- * Copyright (c) 2004 - 2009 Eike Stepper (Berlin, Germany) and others.
- * 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.io.CDODataInput;
-import org.eclipse.emf.cdo.common.io.CDODataOutput;
-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.model.InternalCDOClass;
-import org.eclipse.emf.cdo.spi.common.model.InternalCDOFeature;
-
-import org.eclipse.net4j.util.ObjectUtil;
-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_TRACER = new ContextTracer(OM.DEBUG_MODEL, CDOClassImpl.class);
-
- private static final ContextTracer PROTOCOL_TRACER = 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_TRACER.isEnabled())
- {
- MODEL_TRACER.format("Created {0}", this);
- }
- }
-
- public CDOClassImpl(CDOPackage containingPackage, CDODataInput in) throws IOException
- {
- this.containingPackage = containingPackage;
- read(in);
- }
-
- @Override
- public void read(CDODataInput in) throws IOException
- {
- super.read(in);
- classifierID = in.readInt();
- isAbstract = in.readBoolean();
- readSuperTypes(in);
- readFeatures(in);
-
- if (PROTOCOL_TRACER.isEnabled())
- {
- PROTOCOL_TRACER.format("Read class: ID={0}, name={1}, abstract={2}", classifierID, getName(), isAbstract);
- }
- }
-
- @Override
- public void write(CDODataOutput out) throws IOException
- {
- if (PROTOCOL_TRACER.isEnabled())
- {
- PROTOCOL_TRACER.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 String getQualifiedName()
- {
- return getContainingPackage().getQualifiedName() + "." + getName();
- }
-
- public boolean isAbstract()
- {
- return isAbstract;
- }
-
- public void setAbstract(boolean isAbstract)
- {
- this.isAbstract = isAbstract;
- }
-
- public boolean isResourceNode()
- {
- return false;
- }
-
- public boolean isResourceFolder()
- {
- return false;
- }
-
- 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_TRACER.isEnabled())
- {
- MODEL_TRACER.format("Adding super type: {0}", classRef);
- }
-
- superTypes.add(new CDOClassProxy(classRef, containingPackage.getPackageManager()));
- }
-
- public void addFeature(CDOFeature cdoFeature)
- {
- if (MODEL_TRACER.isEnabled())
- {
- MODEL_TRACER.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());
- }
-
- private void setIndex(int featureID, int index)
- {
- while (indices.size() <= featureID)
- {
- indices.add(null);
- }
-
- indices.set(featureID, index);
- }
-
- private void readSuperTypes(CDODataInput in) throws IOException
- {
- int size = in.readInt();
- if (PROTOCOL_TRACER.isEnabled())
- {
- PROTOCOL_TRACER.format("Reading {0} super types", size);
- }
-
- for (int i = 0; i < size; i++)
- {
- CDOClassRef classRef = in.readCDOClassRef();
- if (PROTOCOL_TRACER.isEnabled())
- {
- PROTOCOL_TRACER.format("Read super type: classRef={0}", classRef, classifierID);
- }
-
- superTypes.add(new CDOClassProxy(classRef, containingPackage.getPackageManager()));
- }
- }
-
- private void readFeatures(CDODataInput in) throws IOException
- {
- int size = in.readInt();
- if (PROTOCOL_TRACER.isEnabled())
- {
- PROTOCOL_TRACER.format("Reading {0} features", size);
- }
-
- for (int i = 0; i < size; i++)
- {
- CDOFeature cdoFeature = in.readCDOFeature(this);
- addFeature(cdoFeature);
- }
- }
-
- private void writeSuperTypes(CDODataOutput out) throws IOException
- {
- int size = superTypes.size();
- if (PROTOCOL_TRACER.isEnabled())
- {
- PROTOCOL_TRACER.format("Writing {0} super types", size);
- }
-
- out.writeInt(size);
- for (CDOClassProxy proxy : superTypes)
- {
- CDOClassRef classRef = proxy.getClassRef();
- if (PROTOCOL_TRACER.isEnabled())
- {
- PROTOCOL_TRACER.format("Writing super type: classRef={0}", classRef);
- }
-
- out.writeCDOClassRef(classRef);
- }
- }
-
- private void writeFeatures(CDODataOutput out) throws IOException
- {
- int size = features.size();
- if (PROTOCOL_TRACER.isEnabled())
- {
- PROTOCOL_TRACER.format("Writing {0} features", size);
- }
-
- out.writeInt(size);
- for (CDOFeature cdoFeature : features)
- {
- out.writeCDOFeature(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/CDOClassInfoImpl.java b/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/internal/common/model/CDOClassInfoImpl.java
new file mode 100644
index 0000000000..64f94ea7d1
--- /dev/null
+++ b/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/internal/common/model/CDOClassInfoImpl.java
@@ -0,0 +1,109 @@
+/**
+ * Copyright (c) 2004 - 2009 Eike Stepper (Berlin, Germany) and others.
+ * 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.CDOClassInfo;
+import org.eclipse.emf.cdo.common.model.CDOModelUtil;
+
+import org.eclipse.emf.common.notify.Notifier;
+import org.eclipse.emf.common.notify.impl.AdapterImpl;
+import org.eclipse.emf.ecore.EClass;
+import org.eclipse.emf.ecore.EStructuralFeature;
+
+import java.util.ArrayList;
+import java.util.List;
+
+/**
+ * @author Eike Stepper
+ */
+public class CDOClassInfoImpl extends AdapterImpl implements CDOClassInfo
+{
+ private EStructuralFeature[] allPersistentFeatures;
+
+ private int[] featureIDMappings;
+
+ public CDOClassInfoImpl()
+ {
+ }
+
+ @Override
+ public boolean isAdapterForType(Object type)
+ {
+ return type == CDOClassInfo.class;
+ }
+
+ @Override
+ public void setTarget(Notifier newTarget)
+ {
+ init((EClass)newTarget);
+ super.setTarget(newTarget);
+ }
+
+ public EClass getEClass()
+ {
+ return (EClass)getTarget();
+ }
+
+ public boolean isResource()
+ {
+ return CDOModelUtil.isResource(getEClass());
+ }
+
+ public boolean isResourceFolder()
+ {
+ return CDOModelUtil.isResourceFolder(getEClass());
+ }
+
+ public boolean isResourceNode()
+ {
+ return CDOModelUtil.isResourceNode(getEClass());
+ }
+
+ public EStructuralFeature[] getAllPersistentFeatures()
+ {
+ return allPersistentFeatures;
+ }
+
+ public int getFeatureIndex(EStructuralFeature feature)
+ {
+ int featureID = getEClass().getFeatureID(feature);
+ return getFeatureIndex(featureID);
+ }
+
+ public int getFeatureIndex(int featureID)
+ {
+ return featureIDMappings[featureID];
+ }
+
+ private void init(EClass eClass)
+ {
+ int maxID = 0;
+ List<EStructuralFeature> features = new ArrayList<EStructuralFeature>();
+ for (EStructuralFeature feature : eClass.getEAllStructuralFeatures())
+ {
+ if (!feature.isTransient())
+ {
+ features.add(feature);
+ int featureID = eClass.getFeatureID(feature);
+ maxID = Math.max(maxID, featureID);
+ }
+ }
+
+ allPersistentFeatures = features.toArray(new EStructuralFeature[features.size()]);
+ featureIDMappings = new int[maxID + 1];
+ for (int i = 0; i < allPersistentFeatures.length; i++)
+ {
+ EStructuralFeature feature = allPersistentFeatures[i];
+ int featureID = eClass.getFeatureID(feature);
+ featureIDMappings[featureID] = i;
+ }
+ }
+}
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
deleted file mode 100644
index 8c4ef037e1..0000000000
--- a/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/internal/common/model/CDOFeatureImpl.java
+++ /dev/null
@@ -1,360 +0,0 @@
-/**
- * Copyright (c) 2004 - 2009 Eike Stepper (Berlin, Germany) and others.
- * 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.io.CDODataInput;
-import org.eclipse.emf.cdo.common.io.CDODataOutput;
-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.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.model.InternalCDOClass;
-import org.eclipse.emf.cdo.spi.common.model.InternalCDOFeature;
-import org.eclipse.emf.cdo.spi.common.revision.InternalCDORevision;
-
-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_TRACER = new ContextTracer(OM.DEBUG_MODEL, CDOFeatureImpl.class);
-
- private static final ContextTracer PROTOCOL_TRACER = 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;
-
- private Object defaultValue;
-
- /**
- * Creates an uninitialized instance.
- */
- public CDOFeatureImpl()
- {
- }
-
- /**
- * Creates an attribute feature.
- */
- public CDOFeatureImpl(CDOClass containingClass, int featureID, String name, CDOType type, Object defaultValue,
- boolean many)
- {
- super(name);
- if (type == CDOType.OBJECT)
- {
- throw new IllegalArgumentException("type == OBJECT");
- }
-
- this.containingClass = containingClass;
- this.featureID = featureID;
- this.type = type;
- this.defaultValue = defaultValue;
- this.many = many;
- if (MODEL_TRACER.isEnabled())
- {
- MODEL_TRACER.format("Created {0}", this);
- }
- }
-
- /**
- * Creates a reference feature.
- */
- 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_TRACER.isEnabled())
- {
- MODEL_TRACER.format("Created {0}", this);
- }
- }
-
- /**
- * Reads a feature from a stream.
- */
- public CDOFeatureImpl(CDOClass containingClass, CDODataInput in) throws IOException
- {
- this.containingClass = containingClass;
- read(in);
- }
-
- @Override
- public void read(CDODataInput in) throws IOException
- {
- super.read(in);
- featureID = in.readInt();
- type = in.readCDOType();
- if (in.readBoolean())
- {
- defaultValue = type.readValue(in);
- }
-
- many = in.readBoolean();
- containment = in.readBoolean();
- if (PROTOCOL_TRACER.isEnabled())
- {
- PROTOCOL_TRACER.format("Read feature: ID={0}, name={1}, type={2}, many={3}, containment={4}", featureID,
- getName(), type, many, containment);
- }
-
- if (isReference())
- {
- CDOClassRef classRef = in.readCDOClassRef();
- if (PROTOCOL_TRACER.isEnabled())
- {
- PROTOCOL_TRACER.format("Read reference type: classRef={0}", classRef);
- }
-
- referenceTypeProxy = new CDOClassProxy(classRef, containingClass.getContainingPackage().getPackageManager());
- }
- }
-
- @Override
- public void write(CDODataOutput out) throws IOException
- {
- if (PROTOCOL_TRACER.isEnabled())
- {
- PROTOCOL_TRACER.format("Writing feature: ID={0}, name={1}, type={2}, many={3}, containment={4}", featureID,
- getName(), type, many, containment);
- }
-
- super.write(out);
- out.writeInt(featureID);
- out.writeCDOType(type);
- if (defaultValue != null)
- {
- out.writeBoolean(true);
- type.writeValue(out, defaultValue);
- }
- else
- {
- out.writeBoolean(false);
- }
-
- out.writeBoolean(many);
- out.writeBoolean(containment);
-
- if (isReference())
- {
- CDOClassRef classRef = referenceTypeProxy.getClassRef();
- if (PROTOCOL_TRACER.isEnabled())
- {
- PROTOCOL_TRACER.format("Writing reference type: classRef={0}", classRef);
- }
-
- out.writeCDOClassRef(classRef);
- }
- }
-
- 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 String getQualifiedName()
- {
- return getContainingClass().getQualifiedName() + "." + getName();
- }
-
- public CDOType getType()
- {
- return type;
- }
-
- public void setType(CDOType type)
- {
- this.type = type;
- }
-
- public boolean isMany()
- {
- return many;
- }
-
- public Object getDefaultValue()
- {
- return defaultValue;
- }
-
- public void setDefaultValue(Object defaultValue)
- {
- this.defaultValue = defaultValue;
- }
-
- 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 CDOClassProxy getReferenceTypeProxy()
- {
- return referenceTypeProxy;
- }
-
- @Override
- public String toString()
- {
- if (type == CDOType.OBJECT)
- {
- return MessageFormat.format("CDOFeature(ID={0}, name={1}, type={2})", featureID, getName(), referenceTypeProxy);
- }
- else
- {
- return MessageFormat.format("CDOFeature(ID={0}, name={1}, type={2})", featureID, getName(), type);
- }
- }
-
- public Object readValue(CDODataInput in) throws IOException
- {
- CDOType type = getType();
- if (type.canBeNull() && !isMany())
- {
- if (in.readBoolean())
- {
- return InternalCDORevision.NIL;
- }
- }
-
- return type.readValue(in);
- }
-
- public void writeValue(CDODataOutput out, Object value) throws IOException
- {
- // TODO We could certainly optimized this: When a feature is a reference, NIL is only possible in the case where
- // unsettable == true. (TO be verified)
- if (type.canBeNull())
- {
- if (!isMany())
- {
- if (value == InternalCDORevision.NIL)
- {
- out.writeBoolean(true);
- return;
- }
- else
- {
- out.writeBoolean(false);
- }
- }
- }
- else
- {
- if (value == null)
- {
- value = getDefaultValue();
- }
- }
-
- type.writeValue(out, value);
- }
-}
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
deleted file mode 100644
index d79cf77d27..0000000000
--- a/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/internal/common/model/CDOModelElementImpl.java
+++ /dev/null
@@ -1,93 +0,0 @@
-/**
- * Copyright (c) 2004 - 2009 Eike Stepper (Berlin, Germany) and others.
- * 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.io.CDODataInput;
-import org.eclipse.emf.cdo.common.io.CDODataOutput;
-import org.eclipse.emf.cdo.internal.common.bundle.OM;
-import org.eclipse.emf.cdo.spi.common.model.InternalCDOModelElement;
-
-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_TRACER = new ContextTracer(OM.DEBUG_MODEL, CDOModelElementImpl.class);
-
- private String name;
-
- private Object clientInfo;
-
- private Object serverInfo;
-
- protected CDOModelElementImpl(String name)
- {
- this.name = name;
- }
-
- protected CDOModelElementImpl()
- {
- }
-
- public void read(CDODataInput in) throws IOException
- {
- name = in.readString();
- }
-
- public void write(CDODataOutput 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_TRACER.isEnabled())
- {
- MODEL_TRACER.format("Setting client info: {0} --> {1}", this, clientInfo);
- }
-
- this.clientInfo = clientInfo;
- }
-
- public Object getServerInfo()
- {
- return serverInfo;
- }
-
- public void setServerInfo(Object serverInfo)
- {
- if (MODEL_TRACER.isEnabled())
- {
- MODEL_TRACER.format("Setting server info: {0} --> {1}", this, serverInfo);
- }
-
- this.serverInfo = serverInfo;
- }
-}
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
deleted file mode 100644
index cb46adfbec..0000000000
--- a/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/internal/common/model/CDOPackageImpl.java
+++ /dev/null
@@ -1,404 +0,0 @@
-/**
- * Copyright (c) 2004 - 2009 Eike Stepper (Berlin, Germany) and others.
- * 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 - http://bugs.eclipse.org/246442
- */
-package org.eclipse.emf.cdo.internal.common.model;
-
-import org.eclipse.emf.cdo.common.id.CDOIDMetaRange;
-import org.eclipse.emf.cdo.common.io.CDODataInput;
-import org.eclipse.emf.cdo.common.io.CDODataOutput;
-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 org.eclipse.emf.cdo.internal.common.bundle.OM;
-import org.eclipse.emf.cdo.spi.common.model.InternalCDOClass;
-import org.eclipse.emf.cdo.spi.common.model.InternalCDOPackage;
-import org.eclipse.emf.cdo.spi.common.model.InternalCDOPackageManager;
-
-import org.eclipse.net4j.util.ObjectUtil;
-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_TRACER = new ContextTracer(OM.DEBUG_MODEL, CDOPackageImpl.class);
-
- private static final ContextTracer PROTOCOL_TRACER = 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 ecoreLoaded;
-
- private boolean dynamic;
-
- private CDOIDMetaRange metaIDRange;
-
- private String parentURI;
-
- 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.dynamic = dynamic;
- this.metaIDRange = metaIDRange;
- this.parentURI = parentURI;
- if (MODEL_TRACER.isEnabled())
- {
- MODEL_TRACER.format("Created {0}", this);
- }
-
- setEcore(ecore);
- createLists();
- }
-
- public CDOPackageImpl(CDOPackageManager packageManager, CDODataInput 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_TRACER.isEnabled())
- {
- MODEL_TRACER.format("Created proxy package {0}, dynamic={1}, metaIDRange={2}, parentURI={3}", packageURI,
- dynamic, metaIDRange, packageURI);
- }
- }
-
- @Override
- public void read(CDODataInput in) throws IOException
- {
- super.read(in);
- packageURI = in.readCDOPackageURI();
- dynamic = in.readBoolean();
- metaIDRange = in.readCDOIDMetaRange();
- parentURI = in.readString();
- if (PROTOCOL_TRACER.isEnabled())
- {
- PROTOCOL_TRACER.format("Read package: URI={0}, name={1}, dynamic={2}, metaIDRange={3}, parentURI={4}",
- packageURI, getName(), dynamic, metaIDRange, parentURI);
- }
-
- int size = in.readInt();
- if (PROTOCOL_TRACER.isEnabled())
- {
- PROTOCOL_TRACER.format("Reading {0} classes", size);
- }
-
- for (int i = 0; i < size; i++)
- {
- CDOClass cdoClass = in.readCDOClass(this);
- addClass(cdoClass);
- }
- }
-
- @Override
- public void write(CDODataOutput out) throws IOException
- {
- load();
- if (PROTOCOL_TRACER.isEnabled())
- {
- PROTOCOL_TRACER.format("Writing package: URI={0}, name={1}, dynamic={2}, metaIDRange={3}, parentURI={4}",
- packageURI, getName(), dynamic, metaIDRange, parentURI);
- }
-
- super.write(out);
- out.writeCDOPackageURI(packageURI);
- out.writeBoolean(dynamic);
- out.writeCDOIDMetaRange(metaIDRange);
- out.writeString(parentURI);
-
- int size = classes.size();
- if (PROTOCOL_TRACER.isEnabled())
- {
- PROTOCOL_TRACER.format("Writing {0} classes", size);
- }
-
- out.writeInt(size);
- for (CDOClass cdoClass : classes)
- {
- out.writeCDOClass(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()
- {
- if (parentURI == null)
- {
- return null;
- }
-
- 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 String getQualifiedName()
- {
- CDOPackage parentPackage = getParentPackage();
- if (parentPackage != null)
- {
- return parentPackage.getQualifiedName() + "." + getName();
- }
-
- return getName();
- }
-
- public int getClassCount()
- {
- load();
- return classes.size();
- }
-
- public CDOClass[] getClasses()
- {
- load();
- 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()
- {
- load();
- 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)
- {
- load();
- return index.get(classifierID);
- }
-
- public synchronized String basicGetEcore()
- {
- return ecore;
- }
-
- public synchronized String getEcore()
- {
- if (!ecoreLoaded)
- {
- if (parentURI == null && !isSystem())
- {
- ((InternalCDOPackageManager)packageManager).loadPackageEcore(this);
- }
- }
-
- return ecore;
- }
-
- public synchronized void setEcore(String ecore)
- {
- this.ecore = ecore;
- ecoreLoaded = true;
- }
-
- 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_TRACER.isEnabled())
- {
- MODEL_TRACER.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);
- }
-
- private void setIndex(int classifierID, CDOClass cdoClass)
- {
- while (classifierID >= index.size())
- {
- index.add(null);
- }
-
- index.set(classifierID, cdoClass);
- }
-
- private void createLists()
- {
- classes = new ArrayList<CDOClass>(0);
- index = new ArrayList<CDOClass>(0);
- }
-
- private synchronized void load()
- {
- if (classes == null)
- {
- createLists();
- ((InternalCDOPackageManager)packageManager).loadPackage(this);
- }
- }
-}
diff --git a/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/internal/common/model/CDOPackageInfoImpl.java b/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/internal/common/model/CDOPackageInfoImpl.java
new file mode 100644
index 0000000000..5f18e61c3f
--- /dev/null
+++ b/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/internal/common/model/CDOPackageInfoImpl.java
@@ -0,0 +1,166 @@
+/**
+ * Copyright (c) 2004 - 2009 Eike Stepper (Berlin, Germany) and others.
+ * 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.io.CDODataInput;
+import org.eclipse.emf.cdo.common.io.CDODataOutput;
+import org.eclipse.emf.cdo.common.model.CDOModelUtil;
+import org.eclipse.emf.cdo.common.model.CDOPackageInfo;
+import org.eclipse.emf.cdo.internal.common.bundle.OM;
+import org.eclipse.emf.cdo.spi.common.model.InternalCDOPackageInfo;
+import org.eclipse.emf.cdo.spi.common.model.InternalCDOPackageUnit;
+
+import org.eclipse.net4j.util.om.trace.ContextTracer;
+
+import org.eclipse.emf.common.notify.impl.AdapterImpl;
+import org.eclipse.emf.ecore.EFactory;
+import org.eclipse.emf.ecore.EPackage;
+
+import java.io.IOException;
+import java.text.MessageFormat;
+
+/**
+ * @author Eike Stepper
+ */
+public class CDOPackageInfoImpl extends AdapterImpl implements InternalCDOPackageInfo
+{
+ private static final ContextTracer TRACER = new ContextTracer(OM.DEBUG, CDOPackageInfoImpl.class);
+
+ private InternalCDOPackageUnit packageUnit;
+
+ private String packageURI;
+
+ private String parentURI;
+
+ private CDOIDMetaRange metaIDRange;
+
+ public CDOPackageInfoImpl()
+ {
+ }
+
+ public InternalCDOPackageUnit getPackageUnit()
+ {
+ return packageUnit;
+ }
+
+ public void setPackageUnit(InternalCDOPackageUnit packageUnit)
+ {
+ this.packageUnit = packageUnit;
+ }
+
+ public String getPackageURI()
+ {
+ return packageURI;
+ }
+
+ public void setPackageURI(String packageURI)
+ {
+ this.packageURI = packageURI;
+ }
+
+ public String getParentURI()
+ {
+ return parentURI;
+ }
+
+ public void setParentURI(String parentURI)
+ {
+ this.parentURI = parentURI;
+ }
+
+ public CDOIDMetaRange getMetaIDRange()
+ {
+ return metaIDRange;
+ }
+
+ public void setMetaIDRange(CDOIDMetaRange metaIDRange)
+ {
+ this.metaIDRange = metaIDRange;
+ }
+
+ public void write(CDODataOutput out) throws IOException
+ {
+ if (TRACER.isEnabled())
+ {
+ TRACER.format("Writing {0}", this);
+ }
+
+ out.writeCDOPackageURI(packageURI);
+ out.writeCDOPackageURI(parentURI);
+ out.writeCDOIDMetaRange(getMetaIDRange());
+ }
+
+ public void read(CDODataInput in) throws IOException
+ {
+ packageURI = in.readCDOPackageURI();
+ parentURI = in.readCDOPackageURI();
+ metaIDRange = in.readCDOIDMetaRange();
+ if (TRACER.isEnabled())
+ {
+ TRACER.format("Read {0}", this);
+ }
+ }
+
+ public EFactory getEFactory()
+ {
+ return getEPackage().getEFactoryInstance();
+ }
+
+ public EPackage getEPackage()
+ {
+ return getEPackage(true);
+ }
+
+ public EPackage getEPackage(boolean loadOnDemand)
+ {
+ EPackage ePackage = (EPackage)getTarget();
+ if (ePackage != null)
+ {
+ return ePackage;
+ }
+
+ if (loadOnDemand)
+ {
+ packageUnit.load();
+ return (EPackage)getTarget();
+ }
+
+ return null;
+ }
+
+ public boolean isCorePackage()
+ {
+ return CDOModelUtil.isCorePackage(getEPackage());
+ }
+
+ public boolean isResourcePackage()
+ {
+ return CDOModelUtil.isResourcePackage(getEPackage());
+ }
+
+ public boolean isSystemPackage()
+ {
+ return CDOModelUtil.isSystemPackage(getEPackage());
+ }
+
+ public int compareTo(CDOPackageInfo o)
+ {
+ return getPackageURI().compareTo(o.getPackageURI());
+ }
+
+ @Override
+ public String toString()
+ {
+ return MessageFormat.format("CDOPackageInfo[packageURI={0}, parentURI={1}, metaIDRange={2}]", packageURI,
+ parentURI, metaIDRange);
+ }
+}
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
deleted file mode 100644
index c44638878c..0000000000
--- a/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/internal/common/model/CDOPackageManagerImpl.java
+++ /dev/null
@@ -1,132 +0,0 @@
-/**
- * Copyright (c) 2004 - 2009 Eike Stepper (Berlin, Germany) and others.
- * 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.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.emf.cdo.spi.common.model.InternalCDOPackageManager;
-
-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 InternalCDOPackageManager
-{
- 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);
- }
-}
diff --git a/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/internal/common/model/CDOPackageRegistryImpl.java b/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/internal/common/model/CDOPackageRegistryImpl.java
new file mode 100644
index 0000000000..aa1db75528
--- /dev/null
+++ b/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/internal/common/model/CDOPackageRegistryImpl.java
@@ -0,0 +1,650 @@
+/**
+ * Copyright (c) 2004 - 2009 Eike Stepper (Berlin, Germany) and others.
+ * 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.CDOIDMetaRange;
+import org.eclipse.emf.cdo.common.id.CDOIDTemp;
+import org.eclipse.emf.cdo.common.id.CDOIDTempMeta;
+import org.eclipse.emf.cdo.common.id.CDOIDUtil;
+import org.eclipse.emf.cdo.common.model.CDOModelUtil;
+import org.eclipse.emf.cdo.common.model.CDOPackageInfo;
+import org.eclipse.emf.cdo.common.model.CDOPackageUnit;
+import org.eclipse.emf.cdo.common.model.EMFUtil;
+import org.eclipse.emf.cdo.internal.common.bundle.OM;
+import org.eclipse.emf.cdo.spi.common.model.InternalCDOPackageInfo;
+import org.eclipse.emf.cdo.spi.common.model.InternalCDOPackageRegistry;
+import org.eclipse.emf.cdo.spi.common.model.InternalCDOPackageUnit;
+
+import org.eclipse.net4j.util.CheckUtil;
+import org.eclipse.net4j.util.ReflectUtil.ExcludeFromDump;
+import org.eclipse.net4j.util.lifecycle.ILifecycleState;
+import org.eclipse.net4j.util.lifecycle.LifecycleException;
+import org.eclipse.net4j.util.lifecycle.LifecycleUtil;
+import org.eclipse.net4j.util.om.trace.ContextTracer;
+
+import org.eclipse.emf.common.notify.Adapter;
+import org.eclipse.emf.common.util.EList;
+import org.eclipse.emf.ecore.EObject;
+import org.eclipse.emf.ecore.EPackage;
+import org.eclipse.emf.ecore.InternalEObject;
+import org.eclipse.emf.ecore.impl.EPackageRegistryImpl;
+
+import java.io.ByteArrayOutputStream;
+import java.io.PrintStream;
+import java.text.MessageFormat;
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.Collections;
+import java.util.Comparator;
+import java.util.HashMap;
+import java.util.HashSet;
+import java.util.List;
+import java.util.Map;
+import java.util.Set;
+
+/**
+ * @author Eike Stepper
+ */
+public class CDOPackageRegistryImpl extends EPackageRegistryImpl implements InternalCDOPackageRegistry
+{
+ private static final long serialVersionUID = 1L;
+
+ private static final ContextTracer TRACER = new ContextTracer(OM.DEBUG, CDOPackageRegistryImpl.class);
+
+ private static final boolean eagerInternalCaches = false;
+
+ private MetaInstanceMapperImpl metaInstanceMapper = new MetaInstanceMapperImpl();
+
+ private boolean replacingDescriptors;
+
+ private PackageProcessor packageProcessor;
+
+ private PackageLoader packageLoader;
+
+ private transient boolean active;
+
+ @ExcludeFromDump
+ private transient InternalCDOPackageInfo[] packageInfos;
+
+ @ExcludeFromDump
+ private transient InternalCDOPackageUnit[] packageUnits;
+
+ public CDOPackageRegistryImpl()
+ {
+ }
+
+ public MetaInstanceMapper getMetaInstanceMapper()
+ {
+ return metaInstanceMapper;
+ }
+
+ public boolean isReplacingDescriptors()
+ {
+ return replacingDescriptors;
+ }
+
+ public void setReplacingDescriptors(boolean replacingDescriptors)
+ {
+ this.replacingDescriptors = replacingDescriptors;
+ }
+
+ public PackageProcessor getPackageProcessor()
+ {
+ return packageProcessor;
+ }
+
+ public void setPackageProcessor(PackageProcessor packageProcessor)
+ {
+ this.packageProcessor = packageProcessor;
+ }
+
+ public PackageLoader getPackageLoader()
+ {
+ return packageLoader;
+ }
+
+ public void setPackageLoader(PackageLoader packageLoader)
+ {
+ LifecycleUtil.checkInactive(this);
+ this.packageLoader = packageLoader;
+ }
+
+ @Override
+ public Object get(Object key)
+ {
+ LifecycleUtil.checkActive(this);
+ return super.get(key);
+ }
+
+ public Object basicPut(String nsURI, Object value)
+ {
+ LifecycleUtil.checkActive(this);
+ if (TRACER.isEnabled())
+ {
+ TRACER.format("Registering {0} --> {1}", nsURI, value);
+ }
+
+ if (packageProcessor != null)
+ {
+ value = packageProcessor.processPackage(value);
+ }
+
+ Object oldValue = get(nsURI);
+ if (oldValue instanceof InternalCDOPackageInfo && value instanceof EPackage)
+ {
+ InternalCDOPackageInfo oldPackageInfo = (InternalCDOPackageInfo)oldValue;
+ EPackage newValue = (EPackage)value;
+ if (oldPackageInfo.getEPackage(false) == null)
+ {
+ EMFUtil.addAdapter(newValue, oldPackageInfo);
+ oldPackageInfo.getPackageUnit().setState(CDOPackageUnit.State.LOADED);
+ }
+ }
+
+ return super.put(nsURI, value);
+ }
+
+ @Override
+ public synchronized Object put(String nsURI, Object value)
+ {
+ LifecycleUtil.checkActive(this);
+ if (replacingDescriptors && value instanceof EPackage.Descriptor)
+ {
+ EPackage.Descriptor descriptor = (EPackage.Descriptor)value;
+ value = descriptor.getEPackage();
+ }
+
+ if (value instanceof EPackage)
+ {
+ EPackage ePackage = (EPackage)value;
+ InternalCDOPackageInfo packageInfo = getPackageInfo(ePackage);
+ if (packageInfo == null)
+ {
+ initPackageUnit(ePackage);
+ return null;
+ }
+ }
+
+ return basicPut(nsURI, value);
+ }
+
+ public synchronized Object putEPackage(EPackage ePackage)
+ {
+ return put(ePackage.getNsURI(), ePackage);
+ }
+
+ public synchronized void putPackageUnit(InternalCDOPackageUnit packageUnit)
+ {
+ LifecycleUtil.checkActive(this);
+ packageUnit.setPackageRegistry(this);
+ for (InternalCDOPackageInfo packageInfo : packageUnit.getPackageInfos())
+ {
+ EPackage ePackage = packageInfo.getEPackage(false);
+ if (ePackage != null)
+ {
+ EMFUtil.addAdapter(ePackage, packageInfo);
+ basicPut(ePackage.getNsURI(), ePackage);
+ }
+ else
+ {
+ basicPut(packageInfo.getPackageURI(), packageInfo);
+ }
+ }
+
+ resetInternalCaches();
+ }
+
+ public synchronized InternalCDOPackageInfo getPackageInfo(EPackage ePackage)
+ {
+ LifecycleUtil.checkActive(this);
+ // Looks in the registry
+ Object object = get(ePackage.getNsURI());
+ if (object instanceof InternalCDOPackageInfo)
+ {
+ InternalCDOPackageInfo packageInfo = (InternalCDOPackageInfo)object;
+ if (packageInfo.getPackageUnit().getPackageRegistry() == this)
+ {
+ return packageInfo;
+ }
+ }
+
+ // Looks in the adapters
+ synchronized (ePackage)
+ {
+ EList<Adapter> adapters = ePackage.eAdapters();
+ for (int i = 0, size = adapters.size(); i < size; ++i)
+ {
+ Adapter adapter = adapters.get(i);
+ if (adapter instanceof InternalCDOPackageInfo)
+ {
+ InternalCDOPackageInfo packageInfo = (InternalCDOPackageInfo)adapter;
+ if (packageInfo.getPackageUnit().getPackageRegistry() == this)
+ {
+ return packageInfo;
+ }
+ }
+ }
+ }
+
+ return null;
+ }
+
+ public synchronized InternalCDOPackageInfo[] getPackageInfos()
+ {
+ LifecycleUtil.checkActive(this);
+ if (packageInfos == null)
+ {
+ List<InternalCDOPackageInfo> result = new ArrayList<InternalCDOPackageInfo>();
+ for (Object value : values())
+ {
+ if (value instanceof InternalCDOPackageInfo)
+ {
+ result.add((InternalCDOPackageInfo)value);
+ }
+ else if (value instanceof EPackage)
+ {
+ InternalCDOPackageInfo packageInfo = getPackageInfo((EPackage)value);
+ if (packageInfo != null)
+ {
+ result.add(packageInfo);
+ }
+ }
+ }
+
+ packageInfos = result.toArray(new InternalCDOPackageInfo[result.size()]);
+ Arrays.sort(packageInfos);
+ }
+
+ return packageInfos;
+ }
+
+ public InternalCDOPackageUnit getPackageUnit(EPackage ePackage)
+ {
+ CDOPackageInfo packageInfo = getPackageInfo(ePackage);
+ if (packageInfo != null)
+ {
+ return (InternalCDOPackageUnit)packageInfo.getPackageUnit();
+ }
+
+ return null;
+ }
+
+ public synchronized InternalCDOPackageUnit[] getPackageUnits()
+ {
+ LifecycleUtil.checkActive(this);
+ if (packageUnits == null)
+ {
+ Set<InternalCDOPackageUnit> result = new HashSet<InternalCDOPackageUnit>();
+ for (Object value : values())
+ {
+ if (value instanceof InternalCDOPackageInfo)
+ {
+ result.add(((InternalCDOPackageInfo)value).getPackageUnit());
+ }
+ else if (value instanceof EPackage)
+ {
+ InternalCDOPackageInfo packageInfo = getPackageInfo((EPackage)value);
+ if (packageInfo != null)
+ {
+ InternalCDOPackageUnit packageUnit = packageInfo.getPackageUnit();
+ result.add(packageUnit);
+ }
+ }
+ }
+
+ packageUnits = result.toArray(new InternalCDOPackageUnit[result.size()]);
+ Arrays.sort(packageUnits);
+ }
+
+ return packageUnits;
+ }
+
+ public synchronized EPackage[] getEPackages()
+ {
+ LifecycleUtil.checkActive(this);
+ List<EPackage> result = new ArrayList<EPackage>();
+ for (String packageURI : keySet())
+ {
+ EPackage ePackage = getEPackage(packageURI);
+ if (ePackage != null)
+ {
+ result.add(ePackage);
+ }
+ }
+
+ return result.toArray(new EPackage[result.size()]);
+ }
+
+ @Override
+ public String toString()
+ {
+ return MessageFormat.format("{0}[packageLoader={1}]", getClass().getSimpleName(), getPackageLoader());
+ }
+
+ public synchronized boolean isActive()
+ {
+ return active;
+ }
+
+ public synchronized ILifecycleState getLifecycleState()
+ {
+ return active ? ILifecycleState.ACTIVE : ILifecycleState.INACTIVE;
+ }
+
+ public synchronized void activate() throws LifecycleException
+ {
+ if (!active)
+ {
+ CheckUtil.checkState(packageLoader, "packageLoader");
+ active = true;
+ }
+ }
+
+ public synchronized Exception deactivate()
+ {
+ if (active)
+ {
+ try
+ {
+ disposePackageUnits();
+ metaInstanceMapper.clear();
+ metaInstanceMapper = null;
+
+ clear();
+ active = false;
+ }
+ catch (RuntimeException ex)
+ {
+ return ex;
+ }
+ }
+
+ return null;
+ }
+
+ protected void disposePackageUnits()
+ {
+ for (InternalCDOPackageUnit packageUnit : getPackageUnits())
+ {
+ packageUnit.dispose();
+ }
+
+ packageInfos = null;
+ packageUnits = null;
+ }
+
+ protected void initPackageUnit(EPackage ePackage)
+ {
+ InternalCDOPackageUnit packageUnit = createPackageUnit();
+ packageUnit.setPackageRegistry(this);
+ packageUnit.init(ePackage);
+ resetInternalCaches();
+ }
+
+ protected void resetInternalCaches()
+ {
+ packageInfos = null;
+ packageUnits = null;
+ if (eagerInternalCaches)
+ {
+ getPackageInfos();
+ getPackageUnits();
+ }
+ }
+
+ protected InternalCDOPackageUnit createPackageUnit()
+ {
+ return (InternalCDOPackageUnit)CDOModelUtil.createPackageUnit();
+ }
+
+ /**
+ * @author Eike Stepper
+ */
+ public class MetaInstanceMapperImpl implements MetaInstanceMapper
+ {
+ private Map<CDOID, InternalEObject> idToMetaInstanceMap = new HashMap<CDOID, InternalEObject>();
+
+ private Map<InternalEObject, CDOID> metaInstanceToIDMap = new HashMap<InternalEObject, CDOID>();
+
+ @ExcludeFromDump
+ private transient int lastTempMetaID;
+
+ public MetaInstanceMapperImpl()
+ {
+ }
+
+ public synchronized InternalEObject lookupMetaInstance(CDOID id)
+ {
+ LifecycleUtil.checkActive(CDOPackageRegistryImpl.this);
+ InternalEObject metaInstance = idToMetaInstanceMap.get(id);
+ if (metaInstance != null)
+ {
+ return metaInstance;
+ }
+
+ if (delegateRegistry instanceof InternalCDOPackageRegistry)
+ {
+ try
+ {
+ InternalCDOPackageRegistry delegate = (InternalCDOPackageRegistry)delegateRegistry;
+ return delegate.getMetaInstanceMapper().lookupMetaInstance(id);
+ }
+ catch (RuntimeException ex)
+ {
+ // Fall-through
+ }
+ }
+
+ for (InternalCDOPackageInfo packageInfo : getPackageInfos())
+ {
+ CDOIDMetaRange metaIDRange = packageInfo.getMetaIDRange();
+ if (metaIDRange != null && metaIDRange.contains(id))
+ {
+ EPackage ePackage = packageInfo.getEPackage();
+ mapMetaInstances(ePackage, packageInfo.getMetaIDRange());
+ metaInstance = idToMetaInstanceMap.get(id);
+ if (metaInstance != null)
+ {
+ return metaInstance;
+ }
+
+ break;
+ }
+ }
+
+ throw new IllegalStateException("No meta instance mapped for " + id + "\n" + dump());
+ }
+
+ public synchronized CDOID lookupMetaInstanceID(InternalEObject metaInstance)
+ {
+ LifecycleUtil.checkActive(CDOPackageRegistryImpl.this);
+ CDOID metaID = metaInstanceToIDMap.get(metaInstance);
+ if (metaID != null)
+ {
+ return metaID;
+ }
+
+ if (delegateRegistry instanceof InternalCDOPackageRegistry)
+ {
+ try
+ {
+ InternalCDOPackageRegistry delegate = (InternalCDOPackageRegistry)delegateRegistry;
+ return delegate.getMetaInstanceMapper().lookupMetaInstanceID(metaInstance);
+ }
+ catch (RuntimeException ex)
+ {
+ // Fall-through
+ }
+ }
+
+ EPackage ePackage = getContainingPackage(metaInstance);
+ if (ePackage != null)
+ {
+ InternalCDOPackageInfo packageInfo = getPackageInfo(ePackage);
+ if (packageInfo != null)
+ {
+ mapMetaInstances(ePackage, packageInfo.getMetaIDRange());
+ metaID = metaInstanceToIDMap.get(metaInstance);
+ if (metaID != null)
+ {
+ return metaID;
+ }
+ }
+ }
+
+ throw new IllegalStateException("No meta ID mapped for " + metaInstance + "\nContaining package: " + ePackage
+ + "\n" + dump());
+ }
+
+ private EPackage getContainingPackage(InternalEObject metaInstance)
+ {
+ EObject object = metaInstance;
+ while ((object = object.eContainer()) != null)
+ {
+ if (object instanceof EPackage)
+ {
+ return (EPackage)object;
+ }
+ }
+
+ return null;
+ }
+
+ public synchronized CDOIDMetaRange mapMetaInstances(EPackage ePackage)
+ {
+ LifecycleUtil.checkActive(CDOPackageRegistryImpl.this);
+ CDOIDMetaRange range = map(ePackage, lastTempMetaID + 1);
+ lastTempMetaID = ((CDOIDTempMeta)range.getUpperBound()).getIntValue();
+ return range;
+ }
+
+ public synchronized void mapMetaInstances(EPackage ePackage, CDOIDMetaRange metaIDRange)
+ {
+ LifecycleUtil.checkActive(CDOPackageRegistryImpl.this);
+ CDOIDMetaRange range = CDOIDUtil.createMetaRange(metaIDRange.getLowerBound(), 0);
+ range = map((InternalEObject)ePackage, range);
+ if (range.size() != metaIDRange.size())
+ {
+ throw new IllegalStateException("range.size() != metaIDRange.size()");
+ }
+ }
+
+ public void mapMetaInstances(MetaInstanceMapper source)
+ {
+ for (Map.Entry<CDOID, InternalEObject> entry : source.getEntrySet())
+ {
+ map(entry.getKey(), entry.getValue());
+ }
+ }
+
+ public Set<Map.Entry<CDOID, InternalEObject>> getEntrySet()
+ {
+ return idToMetaInstanceMap.entrySet();
+ }
+
+ public synchronized void remapMetaInstanceID(CDOID oldID, CDOID newID)
+ {
+ LifecycleUtil.checkActive(CDOPackageRegistryImpl.this);
+ InternalEObject metaInstance = idToMetaInstanceMap.remove(oldID);
+ if (metaInstance == null)
+ {
+ throw new IllegalArgumentException("Unknown meta instance ID: " + oldID);
+ }
+
+ if (TRACER.isEnabled())
+ {
+ TRACER.format("Remapping meta instance: {0} --> {1} <-> {2}", oldID, newID, metaInstance);
+ }
+
+ map(newID, metaInstance);
+ }
+
+ public void clear()
+ {
+ idToMetaInstanceMap.clear();
+ metaInstanceToIDMap.clear();
+ lastTempMetaID = 0;
+ }
+
+ private String dump()
+ {
+ ByteArrayOutputStream baos = new ByteArrayOutputStream();
+ PrintStream stream = new PrintStream(baos);
+
+ stream.println();
+ stream.println();
+ stream.println(CDOPackageRegistryImpl.this);
+
+ stream.println();
+ List<Map.Entry<CDOID, InternalEObject>> list = new ArrayList<Map.Entry<CDOID, InternalEObject>>(
+ idToMetaInstanceMap.entrySet());
+ Collections.sort(list, new Comparator<Map.Entry<CDOID, InternalEObject>>()
+ {
+ public int compare(Map.Entry<CDOID, InternalEObject> o1, Map.Entry<CDOID, InternalEObject> o2)
+ {
+ return o1.getKey().compareTo(o2.getKey());
+ }
+ });
+
+ for (Map.Entry<CDOID, InternalEObject> entry : list)
+ {
+ stream.println(" " + entry.getKey() + " --> " + entry.getValue());
+ }
+
+ // ReflectUtil.dump(idToMetaInstanceMap, " ", stream);
+ // stream.println();
+ // ReflectUtil.dump(metaInstanceToIDMap, " ", stream);
+
+ return baos.toString();
+ }
+
+ private CDOIDMetaRange map(EPackage ePackage, int firstMetaID)
+ {
+ CDOIDTemp lowerBound = CDOIDUtil.createTempMeta(firstMetaID);
+ CDOIDMetaRange range = CDOIDUtil.createMetaRange(lowerBound, 0);
+ return map((InternalEObject)ePackage, range);
+ }
+
+ private CDOIDMetaRange map(InternalEObject metaInstance, CDOIDMetaRange range)
+ {
+ range = range.increase();
+ CDOID id = range.getUpperBound();
+ if (TRACER.isEnabled())
+ {
+ TRACER.format("Registering meta instance: {0} <-> {1}", id, metaInstance);
+ }
+
+ idToMetaInstanceMap.put(id, metaInstance);
+ CDOID oldID = metaInstanceToIDMap.put(metaInstance, id);
+ if (oldID != null)
+ {
+ idToMetaInstanceMap.remove(oldID);
+ }
+
+ for (EObject content : metaInstance.eContents())
+ {
+ if (!(content instanceof EPackage))
+ {
+ range = map((InternalEObject)content, range);
+ }
+ }
+
+ return range;
+ }
+
+ private void map(CDOID metaID, InternalEObject metaInstance)
+ {
+ idToMetaInstanceMap.put(metaID, metaInstance);
+ metaInstanceToIDMap.put(metaInstance, metaID);
+ }
+ }
+}
diff --git a/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/internal/common/model/CDOPackageUnitImpl.java b/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/internal/common/model/CDOPackageUnitImpl.java
new file mode 100644
index 0000000000..f782fcc60a
--- /dev/null
+++ b/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/internal/common/model/CDOPackageUnitImpl.java
@@ -0,0 +1,362 @@
+/**
+ * Copyright (c) 2004 - 2009 Eike Stepper (Berlin, Germany) and others.
+ * 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.io.CDODataInput;
+import org.eclipse.emf.cdo.common.io.CDODataOutput;
+import org.eclipse.emf.cdo.common.model.CDOModelUtil;
+import org.eclipse.emf.cdo.common.model.CDOPackageTypeRegistry;
+import org.eclipse.emf.cdo.common.model.CDOPackageUnit;
+import org.eclipse.emf.cdo.common.model.EMFUtil;
+import org.eclipse.emf.cdo.internal.common.bundle.OM;
+import org.eclipse.emf.cdo.spi.common.model.InternalCDOPackageInfo;
+import org.eclipse.emf.cdo.spi.common.model.InternalCDOPackageRegistry;
+import org.eclipse.emf.cdo.spi.common.model.InternalCDOPackageUnit;
+
+import org.eclipse.net4j.util.om.trace.ContextTracer;
+
+import org.eclipse.emf.ecore.EPackage;
+import org.eclipse.emf.ecore.util.EcoreUtil;
+
+import java.io.IOException;
+import java.text.MessageFormat;
+import java.util.ArrayList;
+import java.util.List;
+
+/**
+ * @author Eike Stepper
+ */
+public class CDOPackageUnitImpl implements InternalCDOPackageUnit
+{
+ private static final ContextTracer TRACER = new ContextTracer(OM.DEBUG, CDOPackageUnitImpl.class);
+
+ private InternalCDOPackageRegistry packageRegistry;
+
+ private State state = State.PROXY;
+
+ private Type type;
+
+ private Type originalType;
+
+ private long timeStamp;
+
+ private InternalCDOPackageInfo[] packageInfos;
+
+ public CDOPackageUnitImpl()
+ {
+ }
+
+ public InternalCDOPackageRegistry getPackageRegistry()
+ {
+ return packageRegistry;
+ }
+
+ public void setPackageRegistry(InternalCDOPackageRegistry packageRegistry)
+ {
+ this.packageRegistry = packageRegistry;
+ }
+
+ public String getID()
+ {
+ try
+ {
+ return getTopLevelPackageInfo().getPackageURI();
+ }
+ catch (RuntimeException ex)
+ {
+ return "UNINITIALIZED";
+ }
+ }
+
+ public State getState()
+ {
+ return state;
+ }
+
+ public void setState(State state)
+ {
+ this.state = state;
+ if (state == State.LOADED)
+ {
+ type = null;
+ }
+ }
+
+ public Type getType()
+ {
+ if (getOriginalType() == Type.DYNAMIC)
+ {
+ type = Type.DYNAMIC;
+ }
+ else if (type == null || type == Type.UNKNOWN)
+ {
+ if (state == State.PROXY)
+ {
+ type = CDOPackageTypeRegistry.INSTANCE.lookup(getID());
+ }
+ else
+ {
+ InternalCDOPackageInfo packageInfo = getTopLevelPackageInfo();
+ EPackage ePackage = packageInfo.getEPackage();
+ type = CDOPackageTypeRegistry.INSTANCE.lookup(ePackage);
+ }
+
+ if (type == null)
+ {
+ type = Type.UNKNOWN;
+ }
+ }
+
+ return type;
+ }
+
+ public Type getOriginalType()
+ {
+ return originalType;
+ }
+
+ public void setOriginalType(Type originalType)
+ {
+ this.originalType = originalType;
+ }
+
+ public long getTimeStamp()
+ {
+ return timeStamp;
+ }
+
+ public void setTimeStamp(long timeStamp)
+ {
+ this.timeStamp = timeStamp;
+ }
+
+ public InternalCDOPackageInfo getTopLevelPackageInfo()
+ {
+ if (packageInfos == null || packageInfos.length == 0)
+ {
+ throw new IllegalStateException("Package unit not initialized");
+ }
+
+ return packageInfos[0];
+ }
+
+ public InternalCDOPackageInfo getPackageInfo(String packageURI)
+ {
+ for (InternalCDOPackageInfo packageInfo : packageInfos)
+ {
+ if (packageInfo.getPackageURI().equals(packageURI))
+ {
+ return packageInfo;
+ }
+ }
+
+ return null;
+ }
+
+ public InternalCDOPackageInfo[] getPackageInfos()
+ {
+ return packageInfos;
+ }
+
+ public void setPackageInfos(InternalCDOPackageInfo[] packageInfos)
+ {
+ this.packageInfos = packageInfos;
+ for (InternalCDOPackageInfo packageInfo : packageInfos)
+ {
+ packageInfo.setPackageUnit(this);
+ }
+ }
+
+ public EPackage[] getEPackages(boolean loadOnDemand)
+ {
+ List<EPackage> result = new ArrayList<EPackage>();
+ for (InternalCDOPackageInfo packageInfo : packageInfos)
+ {
+ EPackage ePackage = packageInfo.getEPackage(loadOnDemand);
+ if (ePackage != null)
+ {
+ result.add(ePackage);
+ }
+ }
+
+ return result.toArray(new EPackage[result.size()]);
+ }
+
+ public boolean isSystem()
+ {
+ return getTopLevelPackageInfo().isSystemPackage();
+ }
+
+ public void init(EPackage ePackage)
+ {
+ EPackage topLevelPackage = EMFUtil.getTopLevelPackage(ePackage);
+ List<InternalCDOPackageInfo> result = new ArrayList<InternalCDOPackageInfo>();
+ initPackageInfos(topLevelPackage, result);
+ packageInfos = result.toArray(new InternalCDOPackageInfo[result.size()]);
+
+ setState(State.NEW);
+ originalType = getType();
+ }
+
+ public void dispose()
+ {
+ for (InternalCDOPackageInfo packageInfo : packageInfos)
+ {
+ EPackage ePackage = packageInfo.getEPackage(false);
+ if (ePackage != null)
+ {
+ synchronized (ePackage)
+ {
+ ePackage.eAdapters().remove(packageInfo);
+ }
+ }
+ }
+
+ packageInfos = null;
+ setState(State.DISPOSED);
+ }
+
+ public synchronized void load()
+ {
+ if (state == State.PROXY)
+ {
+ EPackage[] ePackages = null;
+ ePackages = loadPackagesFromGlobalRegistry();
+ if (ePackages == null)
+ {
+ ePackages = packageRegistry.getPackageLoader().loadPackages(this);
+ }
+
+ for (EPackage ePackage : ePackages)
+ {
+ String packageURI = ePackage.getNsURI();
+ InternalCDOPackageInfo packageInfo = getPackageInfo(packageURI);
+ synchronized (ePackage)
+ {
+ EMFUtil.addAdapter(ePackage, packageInfo);
+ EcoreUtil.resolveAll(ePackage);
+ }
+ }
+
+ setState(State.LOADED);
+ }
+ }
+
+ public void write(CDODataOutput out, boolean withPackages) throws IOException
+ {
+ if (TRACER.isEnabled())
+ {
+ TRACER.format("Writing {0}", this);
+ }
+
+ out.writeBoolean(withPackages);
+ if (withPackages)
+ {
+ CDOModelUtil.writePackage(out, packageInfos[0].getEPackage(), true, packageRegistry);
+ }
+
+ out.writeCDOPackageUnitType(originalType);
+ out.writeLong(timeStamp);
+ out.writeInt(packageInfos.length);
+ for (InternalCDOPackageInfo packageInfo : packageInfos)
+ {
+ out.writeCDOPackageInfo(packageInfo);
+ }
+ }
+
+ public void read(CDODataInput in, InternalCDOPackageRegistry packageRegistry) throws IOException
+ {
+ EPackage ePackage = null;
+ boolean withPackages = in.readBoolean();
+ if (withPackages)
+ {
+ ePackage = CDOModelUtil.readPackage(in, packageRegistry);
+ setState(State.LOADED);
+ }
+
+ originalType = in.readCDOPackageUnitType();
+ timeStamp = in.readLong();
+ packageInfos = new InternalCDOPackageInfo[in.readInt()];
+ for (int i = 0; i < packageInfos.length; i++)
+ {
+ packageInfos[i] = (InternalCDOPackageInfo)in.readCDOPackageInfo();
+ packageInfos[i].setPackageUnit(this);
+ }
+
+ if (ePackage != null)
+ {
+ attachPackageInfos(ePackage);
+ }
+
+ if (TRACER.isEnabled())
+ {
+ TRACER.format("Read {0}", this);
+ }
+ }
+
+ public int compareTo(CDOPackageUnit o)
+ {
+ return getID().compareTo(o.getID());
+ }
+
+ @Override
+ public String toString()
+ {
+ String fmt = "CDOPackageUnit[id={0}, state={1}, type={2}, originalType={3}, timeStamp={4,date} {4,time}]";
+ return MessageFormat.format(fmt, getID(), getState(), getType(), getOriginalType(), getTimeStamp());
+ }
+
+ private void initPackageInfos(EPackage ePackage, List<InternalCDOPackageInfo> result)
+ {
+ InternalCDOPackageInfo packageInfo = (InternalCDOPackageInfo)CDOModelUtil.createPackageInfo();
+ packageInfo.setPackageUnit(this);
+ packageInfo.setPackageURI(ePackage.getNsURI());
+ packageInfo.setParentURI(ePackage.getESuperPackage() == null ? null : ePackage.getESuperPackage().getNsURI());
+ packageInfo.setMetaIDRange(packageRegistry.getMetaInstanceMapper().mapMetaInstances(ePackage));
+ EMFUtil.addAdapter(ePackage, packageInfo);
+
+ packageRegistry.basicPut(ePackage.getNsURI(), ePackage);
+ result.add(packageInfo);
+ for (EPackage subPackage : ePackage.getESubpackages())
+ {
+ initPackageInfos(subPackage, result);
+ }
+ }
+
+ private void attachPackageInfos(EPackage ePackage)
+ {
+ InternalCDOPackageInfo packageInfo = getPackageInfo(ePackage.getNsURI());
+ if (packageInfo != null)
+ {
+ EMFUtil.addAdapter(ePackage, packageInfo);
+ }
+
+ for (EPackage subPackage : ePackage.getESubpackages())
+ {
+ attachPackageInfos(subPackage);
+ }
+ }
+
+ private EPackage[] loadPackagesFromGlobalRegistry()
+ {
+ EPackage[] ePackages = new EPackage[packageInfos.length];
+ for (int i = 0; i < ePackages.length; i++)
+ {
+ ePackages[i] = EPackage.Registry.INSTANCE.getEPackage(packageInfos[i].getPackageURI());
+ if (ePackages[i] == null)
+ {
+ return null;
+ }
+ }
+
+ return ePackages;
+ }
+}
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
index e7309e6686..3b78f096d2 100644
--- 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
@@ -15,7 +15,6 @@ import org.eclipse.emf.cdo.common.io.CDODataInput;
import org.eclipse.emf.cdo.common.io.CDODataOutput;
import org.eclipse.emf.cdo.common.model.CDOType;
import org.eclipse.emf.cdo.common.revision.CDOReferenceAdjuster;
-import org.eclipse.emf.cdo.internal.common.model.core.CDOFeatureMapEntryDataTypeImpl;
import java.io.IOException;
import java.util.Date;
@@ -27,6 +26,7 @@ import java.util.Map;
*/
public abstract class CDOTypeImpl implements CDOType
{
+ // TODO Use an array
public static Map<Integer, CDOTypeImpl> ids = new HashMap<Integer, CDOTypeImpl>();
private static final byte BOOLEAN_DEFAULT_PRIMITIVE = 0;
@@ -358,36 +358,26 @@ public abstract class CDOTypeImpl implements CDOType
}
};
- public static final CDOType FEATURE_MAP_ENTRY = new CDOTypeImpl("FEATURE_MAP_ENTRY", 36, false)
+ public static final CDOType ENUM = new ObjectType("ENUM", 998)
{
+ @SuppressWarnings("cast")
@Override
public Object copyValue(Object value)
{
- return value;
- }
-
- public void writeValue(CDODataOutput out, Object value) throws IOException
- {
- CDOFeatureMapEntryDataTypeImpl featureMapEntry = (CDOFeatureMapEntryDataTypeImpl)value;
- out.writeString(featureMapEntry.getURI());
- out.writeCDOID(out.getIDProvider().provideCDOID(featureMapEntry.getObject()));
+ return (Integer)value;
}
- public Object readValue(CDODataInput in) throws IOException
+ @Override
+ public void doWriteValue(CDODataOutput out, Object value) throws IOException
{
- String uri = in.readString();
- Object id = in.readCDOID();
- return new CDOFeatureMapEntryDataTypeImpl(uri, id);
+ out.writeInt((Integer)value);
}
@Override
- public Object doAdjustReferences(CDOReferenceAdjuster adjuster, Object value)
+ public Object doReadValue(CDODataInput in) throws IOException
{
- CDOFeatureMapEntryDataTypeImpl featureMapEntry = (CDOFeatureMapEntryDataTypeImpl)value;
- featureMapEntry.adjustReferences(adjuster);
- return value;
+ return in.readInt();
}
-
};
public static final CDOType CUSTOM = new CDOTypeImpl("CUSTOM", 999, true)
@@ -410,6 +400,44 @@ public abstract class CDOTypeImpl implements CDOType
}
};
+ public static final CDOType FEATURE_MAP_ENTRY = new CDOTypeImpl("FEATURE_MAP_ENTRY", 36, false)
+ {
+ @Override
+ public Object copyValue(Object value)
+ {
+ return value;
+ }
+
+ public void writeValue(CDODataOutput out, Object value) throws IOException
+ {
+ // TODO: implement CDOTypeImpl.enclosing_method(enclosing_method_arguments)
+ throw new UnsupportedOperationException();
+ // CDOFeatureMapEntryDataTypeImpl featureMapEntry = (CDOFeatureMapEntryDataTypeImpl)value;
+ // out.writeString(featureMapEntry.getURI());
+ // out.writeCDOID(out.getIDProvider().provideCDOID(featureMapEntry.getObject()));
+ }
+
+ public Object readValue(CDODataInput in) throws IOException
+ {
+ // TODO: implement CDOTypeImpl.enclosing_method(enclosing_method_arguments)
+ throw new UnsupportedOperationException();
+ // String uri = in.readString();
+ // Object id = in.readCDOID();
+ // return new CDOFeatureMapEntryDataTypeImpl(uri, id);
+ }
+
+ @Override
+ public Object doAdjustReferences(CDOReferenceAdjuster adjuster, Object value)
+ {
+ // TODO: implement CDOTypeImpl.enclosing_method(enclosing_method_arguments)
+ throw new UnsupportedOperationException();
+ // CDOFeatureMapEntryDataTypeImpl featureMapEntry = (CDOFeatureMapEntryDataTypeImpl)value;
+ // featureMapEntry.adjustReferences(adjuster);
+ // return value;
+ }
+
+ };
+
private String name;
private int typeID;
@@ -465,6 +493,7 @@ public abstract class CDOTypeImpl implements CDOType
public void write(CDODataOutput out) throws IOException
{
+ // TODO Use byte IDs
out.writeInt(typeID);
}
diff --git a/plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/internal/cdo/util/GenUtil.java b/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/internal/common/model/GenUtil.java
index e5354912c2..ec293041e9 100644
--- a/plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/internal/cdo/util/GenUtil.java
+++ b/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/internal/common/model/GenUtil.java
@@ -8,7 +8,7 @@
* Contributors:
* Eike Stepper - initial API and implementation
*/
-package org.eclipse.emf.internal.cdo.util;
+package org.eclipse.emf.cdo.internal.common.model;
import org.eclipse.net4j.util.StringUtil;
diff --git a/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/internal/common/model/TestTransfer.java b/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/internal/common/model/TestTransfer.java
new file mode 100644
index 0000000000..1acec9e6eb
--- /dev/null
+++ b/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/internal/common/model/TestTransfer.java
@@ -0,0 +1,148 @@
+/**
+ * Copyright (c) 2004 - 2009 Eike Stepper (Berlin, Germany) and others.
+ * 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.net4j.util.WrappedException;
+
+import org.eclipse.emf.common.util.EList;
+import org.eclipse.emf.common.util.URI;
+import org.eclipse.emf.ecore.EAttribute;
+import org.eclipse.emf.ecore.EClass;
+import org.eclipse.emf.ecore.EObject;
+import org.eclipse.emf.ecore.EPackage;
+import org.eclipse.emf.ecore.EcoreFactory;
+import org.eclipse.emf.ecore.EcorePackage;
+import org.eclipse.emf.ecore.resource.Resource;
+import org.eclipse.emf.ecore.resource.ResourceSet;
+import org.eclipse.emf.ecore.resource.impl.ResourceSetImpl;
+import org.eclipse.emf.ecore.xmi.impl.EcoreResourceFactoryImpl;
+
+import java.io.ByteArrayInputStream;
+import java.io.ByteArrayOutputStream;
+import java.io.IOException;
+import java.io.OutputStream;
+
+/**
+ * @author Eike Stepper
+ */
+public class TestTransfer
+{
+ public static void main(String[] args) throws IOException
+ {
+ // Create packageA
+ //
+ EAttribute attributeA = EcoreFactory.eINSTANCE.createEAttribute();
+ attributeA.setName("attributeA");
+ attributeA.setEType(EcorePackage.eINSTANCE.getEString());
+
+ EClass classA = EcoreFactory.eINSTANCE.createEClass();
+ classA.setName("classA");
+ classA.getEStructuralFeatures().add(attributeA);
+
+ EPackage packageA = EcoreFactory.eINSTANCE.createEPackage();
+ packageA.setName("packageA");
+ packageA.setNsPrefix("packageA");
+ packageA.setNsURI("http://packageA");
+ packageA.getEClassifiers().add(classA);
+
+ // Create packageB
+ //
+ EAttribute attributeB = EcoreFactory.eINSTANCE.createEAttribute();
+ attributeB.setName("attributeB");
+ attributeB.setEType(EcorePackage.eINSTANCE.getEString());
+
+ EClass classB = EcoreFactory.eINSTANCE.createEClass();
+ classB.setName("classA");
+ classB.getEStructuralFeatures().add(attributeB);
+ classB.getESuperTypes().add(classA);
+
+ EPackage packageB = EcoreFactory.eINSTANCE.createEPackage();
+ packageB.setName("packageB");
+ packageB.setNsPrefix("packageB");
+ packageB.setNsURI("http://packageB");
+ packageB.getEClassifiers().add(classB);
+
+ // Simulate generated global packages
+ //
+ EPackage.Registry.INSTANCE.put(packageA.getNsURI(), packageA);
+ EPackage.Registry.INSTANCE.put(packageB.getNsURI(), packageB);
+
+ // Serialize both packages
+ //
+ ByteArrayOutputStream baos = new ByteArrayOutputStream();
+ serialize(packageA, baos);
+ serialize(packageB, baos);
+ }
+
+ private static void serialize(EPackage ePackage, OutputStream out) throws IOException
+ {
+ Resource resource = ePackage.eResource();
+ if (resource == null)
+ {
+ resource = createPackageResource(ePackage.getNsURI());
+ resource.getContents().add(ePackage);
+ }
+
+ resource.save(out, null);
+ }
+
+ private static Resource createPackageResource(String uri)
+ {
+ Resource.Factory resourceFactory = new EcoreResourceFactoryImpl();
+
+ ResourceSet resourceSet = new ResourceSetImpl();
+ resourceSet.getResourceFactoryRegistry().getExtensionToFactoryMap().put("*", resourceFactory);
+ resourceSet.getResourceFactoryRegistry().getProtocolToFactoryMap().put("*", resourceFactory);
+
+ return resourceSet.createResource(URI.createURI(uri));
+ }
+
+ public static class UTIL
+ {
+ public static byte[] getPackageBytes(EPackage ePackage, boolean zipped)
+ {
+ try
+ {
+ Resource resource = ePackage.eResource();
+ if (resource == null)
+ {
+ resource = createPackageResource(ePackage.getNsURI());
+ resource.getContents().add(ePackage);
+ }
+
+ ByteArrayOutputStream baos = new ByteArrayOutputStream();
+ resource.save(baos, null);
+ return baos.toByteArray();
+ }
+ catch (Exception ex)
+ {
+ throw WrappedException.wrap(ex);
+ }
+ }
+
+ public static EPackage createPackage(String uri, byte[] bytes, boolean zipped)
+ {
+ try
+ {
+ ByteArrayInputStream bais = new ByteArrayInputStream(bytes);
+ Resource resource = createPackageResource(uri);
+ resource.load(bais, null);
+
+ EList<EObject> contents = resource.getContents();
+ return (EPackage)contents.get(0);
+ }
+ catch (Exception ex)
+ {
+ throw WrappedException.wrap(ex);
+ }
+ }
+ }
+}
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
deleted file mode 100644
index b8da12e803..0000000000
--- a/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/internal/common/model/core/CDOCorePackageImpl.java
+++ /dev/null
@@ -1,47 +0,0 @@
-/**
- * Copyright (c) 2004 - 2009 Eike Stepper (Berlin, Germany) and others.
- * 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;
- }
-
- @SuppressWarnings("all")
- @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/CDOFeatureMapEntryDataTypeImpl.java b/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/internal/common/model/core/CDOFeatureMapEntryDataTypeImpl.java
deleted file mode 100644
index 20d3374e3e..0000000000
--- a/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/internal/common/model/core/CDOFeatureMapEntryDataTypeImpl.java
+++ /dev/null
@@ -1,47 +0,0 @@
-/**
- * Copyright (c) 2004 - 2009 Eike Stepper (Berlin, Germany) and others.
- * 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.model.core;
-
-import org.eclipse.emf.cdo.common.model.core.CDOFeatureMapEntryDataType;
-import org.eclipse.emf.cdo.common.revision.CDOReferenceAdjustable;
-import org.eclipse.emf.cdo.common.revision.CDOReferenceAdjuster;
-
-/**
- * @author Simon McDuff
- */
-public class CDOFeatureMapEntryDataTypeImpl implements CDOFeatureMapEntryDataType, CDOReferenceAdjustable
-{
- private String uri;
-
- private Object object;
-
- public CDOFeatureMapEntryDataTypeImpl(String uri, Object object)
- {
- this.uri = uri;
- this.object = object;
- }
-
- public String getURI()
- {
- return uri;
- }
-
- public Object getObject()
- {
- return object;
- }
-
- public void adjustReferences(CDOReferenceAdjuster revisionAdjuster)
- {
- object = revisionAdjuster.adjustReference(object);
- }
-}
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
deleted file mode 100644
index 132bfb1b89..0000000000
--- a/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/internal/common/model/core/CDOObjectClassImpl.java
+++ /dev/null
@@ -1,32 +0,0 @@
-/**
- * Copyright (c) 2004 - 2009 Eike Stepper (Berlin, Germany) and others.
- * 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
deleted file mode 100644
index 07f3a4889e..0000000000
--- a/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/internal/common/model/resource/CDOContentsFeatureImpl.java
+++ /dev/null
@@ -1,32 +0,0 @@
-/**
- * Copyright (c) 2004 - 2009 Eike Stepper (Berlin, Germany) and others.
- * 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.CDOModelUtil;
-import org.eclipse.emf.cdo.common.model.CDOPackageManager;
-import org.eclipse.emf.cdo.common.model.core.CDOCorePackage;
-import org.eclipse.emf.cdo.common.model.core.CDOObjectClass;
-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(CDOModelUtil.createClassRef(CDOCorePackage.PACKAGE_URI,
- CDOObjectClass.CLASSIFIER_ID), packageManager), true, true);
- }
-}
diff --git a/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/internal/common/model/resource/CDOFolderFeatureImpl.java b/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/internal/common/model/resource/CDOFolderFeatureImpl.java
deleted file mode 100644
index 17ab4a7616..0000000000
--- a/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/internal/common/model/resource/CDOFolderFeatureImpl.java
+++ /dev/null
@@ -1,32 +0,0 @@
-/**
- * Copyright (c) 2004 - 2009 Eike Stepper (Berlin, Germany) and others.
- * 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.CDOModelUtil;
-import org.eclipse.emf.cdo.common.model.CDOPackageManager;
-import org.eclipse.emf.cdo.common.model.resource.CDOFolderFeature;
-import org.eclipse.emf.cdo.common.model.resource.CDOResourceFolderClass;
-import org.eclipse.emf.cdo.common.model.resource.CDOResourcePackage;
-import org.eclipse.emf.cdo.internal.common.model.CDOFeatureImpl;
-
-/**
- * @author Eike Stepper
- */
-public class CDOFolderFeatureImpl extends CDOFeatureImpl implements CDOFolderFeature
-{
- public CDOFolderFeatureImpl(CDOClass containingClass, CDOPackageManager packageManager)
- {
- super(containingClass, FEATURE_ID, NAME, new CDOClassProxy(CDOModelUtil.createClassRef(
- CDOResourcePackage.PACKAGE_URI, CDOResourceFolderClass.CLASSIFIER_ID), packageManager), false, false);
- }
-}
diff --git a/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/internal/common/model/resource/CDONameFeatureImpl.java b/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/internal/common/model/resource/CDONameFeatureImpl.java
deleted file mode 100644
index ee395ad78d..0000000000
--- a/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/internal/common/model/resource/CDONameFeatureImpl.java
+++ /dev/null
@@ -1,27 +0,0 @@
-/**
- * Copyright (c) 2004 - 2009 Eike Stepper (Berlin, Germany) and others.
- * 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.CDONameFeature;
-import org.eclipse.emf.cdo.internal.common.model.CDOFeatureImpl;
-import org.eclipse.emf.cdo.internal.common.model.CDOTypeImpl;
-
-/**
- * @author Eike Stepper
- */
-public class CDONameFeatureImpl extends CDOFeatureImpl implements CDONameFeature
-{
- public CDONameFeatureImpl(CDOClass containingClass)
- {
- super(containingClass, FEATURE_ID, NAME, CDOTypeImpl.STRING, null, false);
- }
-}
diff --git a/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/internal/common/model/resource/CDONodesFeatureImpl.java b/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/internal/common/model/resource/CDONodesFeatureImpl.java
deleted file mode 100644
index a74b9bb31a..0000000000
--- a/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/internal/common/model/resource/CDONodesFeatureImpl.java
+++ /dev/null
@@ -1,32 +0,0 @@
-/**
- * Copyright (c) 2004 - 2009 Eike Stepper (Berlin, Germany) and others.
- * 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.CDOModelUtil;
-import org.eclipse.emf.cdo.common.model.CDOPackageManager;
-import org.eclipse.emf.cdo.common.model.resource.CDONodesFeature;
-import org.eclipse.emf.cdo.common.model.resource.CDOResourceNodeClass;
-import org.eclipse.emf.cdo.common.model.resource.CDOResourcePackage;
-import org.eclipse.emf.cdo.internal.common.model.CDOFeatureImpl;
-
-/**
- * @author Eike Stepper
- */
-public class CDONodesFeatureImpl extends CDOFeatureImpl implements CDONodesFeature
-{
- public CDONodesFeatureImpl(CDOClass containingClass, CDOPackageManager packageManager)
- {
- super(containingClass, FEATURE_ID, NAME, new CDOClassProxy(CDOModelUtil.createClassRef(
- CDOResourcePackage.PACKAGE_URI, CDOResourceNodeClass.CLASSIFIER_ID), packageManager), true, true);
- }
-}
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
deleted file mode 100644
index 4e1a6f2d5d..0000000000
--- a/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/internal/common/model/resource/CDOResourceClassImpl.java
+++ /dev/null
@@ -1,69 +0,0 @@
-/**
- * Copyright (c) 2004 - 2009 Eike Stepper (Berlin, Germany) and others.
- * 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.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.common.model.resource.CDOResourceClass;
-import org.eclipse.emf.cdo.common.model.resource.CDOResourceNodeClass;
-import org.eclipse.emf.cdo.common.model.resource.CDOResourcePackage;
-import org.eclipse.emf.cdo.internal.common.model.CDOClassImpl;
-
-/**
- * @author Eike Stepper
- */
-public class CDOResourceClassImpl extends CDOClassImpl implements CDOResourceClass
-{
- private CDOContentsFeatureImpl cdoContentsFeature;
-
- public CDOResourceClassImpl(CDOPackage containingPackage, CDOPackageManager packageManager)
- {
- super(containingPackage, CLASSIFIER_ID, NAME, false);
- addSuperType(CDOModelUtil.createClassRef(CDOResourcePackage.PACKAGE_URI, CDOResourceNodeClass.CLASSIFIER_ID));
- addFeature(cdoContentsFeature = new CDOContentsFeatureImpl(this, packageManager));
- }
-
- @Override
- public boolean isResourceNode()
- {
- return true;
- }
-
- @Override
- public boolean isResourceFolder()
- {
- return false;
- }
-
- @Override
- public boolean isResource()
- {
- return true;
- }
-
- public CDOContentsFeatureImpl getCDOContentsFeature()
- {
- return cdoContentsFeature;
- }
-
- @Override
- public CDOFeature lookupFeature(int featureID)
- {
- if (featureID == 5)
- {
- return cdoContentsFeature;
- }
-
- return super.lookupFeature(featureID);
- }
-}
diff --git a/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/internal/common/model/resource/CDOResourceFolderClassImpl.java b/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/internal/common/model/resource/CDOResourceFolderClassImpl.java
deleted file mode 100644
index e0c3ad9b6d..0000000000
--- a/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/internal/common/model/resource/CDOResourceFolderClassImpl.java
+++ /dev/null
@@ -1,57 +0,0 @@
-/**
- * Copyright (c) 2004 - 2009 Eike Stepper (Berlin, Germany) and others.
- * 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.CDOModelUtil;
-import org.eclipse.emf.cdo.common.model.CDOPackage;
-import org.eclipse.emf.cdo.common.model.CDOPackageManager;
-import org.eclipse.emf.cdo.common.model.resource.CDOResourceFolderClass;
-import org.eclipse.emf.cdo.common.model.resource.CDOResourceNodeClass;
-import org.eclipse.emf.cdo.common.model.resource.CDOResourcePackage;
-import org.eclipse.emf.cdo.internal.common.model.CDOClassImpl;
-
-/**
- * @author Eike Stepper
- */
-public class CDOResourceFolderClassImpl extends CDOClassImpl implements CDOResourceFolderClass
-{
- private CDONodesFeatureImpl cdoNodesFeature;
-
- public CDOResourceFolderClassImpl(CDOPackage containingPackage, CDOPackageManager packageManager)
- {
- super(containingPackage, CLASSIFIER_ID, NAME, false);
- addSuperType(CDOModelUtil.createClassRef(CDOResourcePackage.PACKAGE_URI, CDOResourceNodeClass.CLASSIFIER_ID));
- addFeature(cdoNodesFeature = new CDONodesFeatureImpl(this, packageManager));
- }
-
- @Override
- public boolean isResourceNode()
- {
- return true;
- }
-
- @Override
- public boolean isResourceFolder()
- {
- return true;
- }
-
- @Override
- public boolean isResource()
- {
- return false;
- }
-
- public CDONodesFeatureImpl getCDONodesFeature()
- {
- return cdoNodesFeature;
- }
-}
diff --git a/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/internal/common/model/resource/CDOResourceNodeClassImpl.java b/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/internal/common/model/resource/CDOResourceNodeClassImpl.java
deleted file mode 100644
index 3256085c4e..0000000000
--- a/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/internal/common/model/resource/CDOResourceNodeClassImpl.java
+++ /dev/null
@@ -1,61 +0,0 @@
-/**
- * Copyright (c) 2004 - 2009 Eike Stepper (Berlin, Germany) and others.
- * 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.CDOResourceNodeClass;
-import org.eclipse.emf.cdo.internal.common.model.CDOClassImpl;
-
-/**
- * @author Eike Stepper
- */
-public class CDOResourceNodeClassImpl extends CDOClassImpl implements CDOResourceNodeClass
-{
- private CDOFolderFeatureImpl cdoFolderFeature;
-
- private CDONameFeatureImpl cdoNameFeature;
-
- public CDOResourceNodeClassImpl(CDOPackage containingPackage, CDOPackageManager packageManager)
- {
- super(containingPackage, CLASSIFIER_ID, NAME, true);
- addFeature(cdoFolderFeature = new CDOFolderFeatureImpl(this, packageManager));
- addFeature(cdoNameFeature = new CDONameFeatureImpl(this));
- }
-
- @Override
- public boolean isResourceNode()
- {
- return true;
- }
-
- @Override
- public boolean isResourceFolder()
- {
- return false;
- }
-
- @Override
- public boolean isResource()
- {
- return false;
- }
-
- public CDOFolderFeatureImpl getCDOFolderFeature()
- {
- return cdoFolderFeature;
- }
-
- public CDONameFeatureImpl getCDONameFeature()
- {
- return cdoNameFeature;
- }
-}
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
deleted file mode 100644
index 5cfcd616fc..0000000000
--- a/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/internal/common/model/resource/CDOResourcePackageImpl.java
+++ /dev/null
@@ -1,63 +0,0 @@
-/**
- * Copyright (c) 2004 - 2009 Eike Stepper (Berlin, Germany) and others.
- * 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 CDOResourceNodeClassImpl cdoResourceNodeClass;
-
- private CDOResourceFolderClassImpl cdoResourceFolderClass;
-
- private CDOResourceClassImpl cdoResourceClass;
-
- public CDOResourcePackageImpl(CDOPackageManagerImpl packageManager)
- {
- super(packageManager, PACKAGE_URI, NAME, null, false, null, null);
- addClass(cdoResourceNodeClass = new CDOResourceNodeClassImpl(this, packageManager));
- addClass(cdoResourceFolderClass = new CDOResourceFolderClassImpl(this, packageManager));
- addClass(cdoResourceClass = new CDOResourceClassImpl(this, packageManager));
- }
-
- public CDOResourceFolderClassImpl getCDOResourceFolderClass()
- {
- return cdoResourceFolderClass;
- }
-
- public CDOResourceNodeClassImpl getCDOResourceNodeClass()
- {
- return cdoResourceNodeClass;
- }
-
- public CDOResourceClassImpl getCDOResourceClass()
- {
- return cdoResourceClass;
- }
-
- @SuppressWarnings("all")
- @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/CDOListImpl.java b/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/internal/common/revision/CDOListImpl.java
index aba35324db..f21de27ded 100644
--- a/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/internal/common/revision/CDOListImpl.java
+++ b/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/internal/common/revision/CDOListImpl.java
@@ -11,6 +11,7 @@
*/
package org.eclipse.emf.cdo.internal.common.revision;
+import org.eclipse.emf.cdo.common.model.CDOModelUtil;
import org.eclipse.emf.cdo.common.model.CDOType;
import org.eclipse.emf.cdo.common.revision.CDOList;
import org.eclipse.emf.cdo.common.revision.CDOListFactory;
@@ -20,6 +21,9 @@ import org.eclipse.emf.cdo.spi.common.revision.InternalCDORevision;
import org.eclipse.net4j.util.collection.MoveableArrayList;
+import org.eclipse.emf.ecore.EClass;
+import org.eclipse.emf.ecore.EClassifier;
+
/**
* @author Simon McDuff
*/
@@ -44,8 +48,9 @@ public class CDOListImpl extends MoveableArrayList<Object> implements InternalCD
}
}
- public InternalCDOList clone(CDOType type)
+ public InternalCDOList clone(EClassifier classifier)
{
+ CDOType type = CDOModelUtil.getType(classifier);
int size = size();
InternalCDOList list = new CDOListImpl(size, 0);
for (int j = 0; j < size; j++)
@@ -62,8 +67,9 @@ public class CDOListImpl extends MoveableArrayList<Object> implements InternalCD
return super.get(index);
}
- public void adjustReferences(CDOReferenceAdjuster revisionAdjuster, CDOType type)
+ public void adjustReferences(CDOReferenceAdjuster revisionAdjuster, EClass classifier)
{
+ CDOType type = CDOModelUtil.getType(classifier);
int size = size();
for (int i = 0; i < size; i++)
{
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
index e5bbb23a1a..81002ca0da 100644
--- 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
@@ -15,13 +15,16 @@ package org.eclipse.emf.cdo.internal.common.revision;
import org.eclipse.emf.cdo.common.id.CDOID;
import org.eclipse.emf.cdo.common.io.CDODataInput;
-import org.eclipse.emf.cdo.common.model.CDOClass;
-import org.eclipse.emf.cdo.common.model.CDOFeature;
+import org.eclipse.emf.cdo.common.model.CDOModelUtil;
import org.eclipse.emf.cdo.common.model.CDOType;
import org.eclipse.emf.cdo.common.revision.CDORevision;
import org.eclipse.emf.cdo.spi.common.revision.AbstractCDORevision;
import org.eclipse.emf.cdo.spi.common.revision.InternalCDOList;
+import org.eclipse.emf.ecore.EClass;
+import org.eclipse.emf.ecore.EClassifier;
+import org.eclipse.emf.ecore.EStructuralFeature;
+
import java.io.IOException;
/**
@@ -31,9 +34,9 @@ public class CDORevisionImpl extends AbstractCDORevision
{
private Object[] values;
- public CDORevisionImpl(CDOClass cdoClass, CDOID id)
+ public CDORevisionImpl(EClass eClass, CDOID id)
{
- super(cdoClass, id);
+ super(eClass, id);
}
public CDORevisionImpl(CDODataInput in) throws IOException
@@ -44,22 +47,23 @@ public class CDORevisionImpl extends AbstractCDORevision
public CDORevisionImpl(CDORevisionImpl source)
{
super(source);
- CDOFeature[] features = getCDOClass().getAllFeatures();
- initValues(features.length);
+ EStructuralFeature[] features = CDOModelUtil.getAllPersistentFeatures(getEClass());
+ initValues(features);
for (int i = 0; i < features.length; i++)
{
- CDOFeature feature = features[i];
- CDOType type = feature.getType();
+ EStructuralFeature feature = features[i];
+ EClassifier classifier = feature.getEType();
if (feature.isMany())
{
InternalCDOList sourceList = (InternalCDOList)source.values[i];
if (sourceList != null)
{
- setValue(i, sourceList.clone(type));
+ setValue(i, sourceList.clone(classifier));
}
}
else
{
+ CDOType type = CDOModelUtil.getType(classifier);
setValue(i, type.copyValue(source.values[i]));
}
}
@@ -71,20 +75,20 @@ public class CDORevisionImpl extends AbstractCDORevision
}
@Override
- protected void initValues(int size)
+ protected void initValues(EStructuralFeature[] allPersistentFeatures)
{
- values = new Object[size];
+ values = new Object[allPersistentFeatures.length];
}
@Override
- protected Object getValue(int i)
+ protected Object getValue(int featureIndex)
{
- return values[i];
+ return values[featureIndex];
}
@Override
- protected void setValue(int i, Object value)
+ protected void setValue(int featureIndex, Object value)
{
- values[i] = value;
+ values[featureIndex] = 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
index d3b2a23d4f..21073a061d 100644
--- 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
@@ -13,8 +13,6 @@
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.model.CDOPackageManager;
import org.eclipse.emf.cdo.common.revision.CDORevision;
import org.eclipse.emf.cdo.common.revision.CDORevisionResolver;
import org.eclipse.emf.cdo.common.revision.cache.CDORevisionCache;
@@ -26,6 +24,8 @@ import org.eclipse.net4j.util.lifecycle.Lifecycle;
import org.eclipse.net4j.util.lifecycle.LifecycleUtil;
import org.eclipse.net4j.util.om.trace.ContextTracer;
+import org.eclipse.emf.ecore.EClass;
+
import java.util.ArrayList;
import java.util.Collection;
import java.util.Iterator;
@@ -69,7 +69,7 @@ public abstract class CDORevisionResolverImpl extends Lifecycle implements CDORe
return cache.getRevisionByVersion(id, version) != null;
}
- public CDOClass getObjectType(CDOID id)
+ public EClass getObjectType(CDOID id)
{
return cache.getObjectType(id);
}
@@ -268,8 +268,6 @@ public abstract class CDORevisionResolverImpl extends Lifecycle implements CDORe
protected abstract List<InternalCDORevision> loadRevisionsByTime(Collection<CDOID> ids, int referenceChunk,
long timeStamp);
- protected abstract CDOPackageManager getPackageManager();
-
@Override
protected void doBeforeActivate() throws Exception
{
@@ -284,7 +282,6 @@ public abstract class CDORevisionResolverImpl extends Lifecycle implements CDORe
protected void doActivate() throws Exception
{
super.doActivate();
- cache.setPackageManager(getPackageManager());
LifecycleUtil.activate(cache);
}
diff --git a/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/internal/common/revision/cache/lru/LRURevisionCache.java b/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/internal/common/revision/cache/lru/LRURevisionCache.java
index 1550d9c431..c75b431460 100644
--- a/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/internal/common/revision/cache/lru/LRURevisionCache.java
+++ b/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/internal/common/revision/cache/lru/LRURevisionCache.java
@@ -13,10 +13,7 @@ package org.eclipse.emf.cdo.internal.common.revision.cache.lru;
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.CDOPackageManager;
-import org.eclipse.emf.cdo.common.model.resource.CDONameFeature;
-import org.eclipse.emf.cdo.common.model.resource.CDOResourceNodeClass;
+import org.eclipse.emf.cdo.common.model.CDOModelConstants;
import org.eclipse.emf.cdo.common.revision.CDORevision;
import org.eclipse.emf.cdo.common.revision.cache.CDORevisionCache;
import org.eclipse.emf.cdo.internal.common.bundle.OM;
@@ -27,6 +24,9 @@ import org.eclipse.net4j.util.ObjectUtil;
import org.eclipse.net4j.util.lifecycle.Lifecycle;
import org.eclipse.net4j.util.om.trace.ContextTracer;
+import org.eclipse.emf.ecore.EClass;
+import org.eclipse.emf.ecore.EStructuralFeature;
+
import java.text.MessageFormat;
import java.util.ArrayList;
import java.util.HashMap;
@@ -42,8 +42,6 @@ public class LRURevisionCache extends Lifecycle implements CDORevisionCache
private Map<CDOID, RevisionHolder> revisions = new HashMap<CDOID, RevisionHolder>();
- private CDOPackageManager packageManager;
-
private int capacityCurrent;
private int capacityRevised;
@@ -52,27 +50,10 @@ public class LRURevisionCache extends Lifecycle implements CDORevisionCache
private LRU revisedLRU;
- private transient CDONameFeature cdoNameFeature;
-
public LRURevisionCache()
{
}
- public CDOPackageManager getPackageManager()
- {
- return packageManager;
- }
-
- public void setPackageManager(CDOPackageManager packageManager)
- {
- this.packageManager = packageManager;
- if (packageManager != null)
- {
- CDOResourceNodeClass resourceNodeClass = packageManager.getCDOResourcePackage().getCDOResourceNodeClass();
- cdoNameFeature = resourceNodeClass.getCDONameFeature();
- }
- }
-
public int getCapacityCurrent()
{
return capacityCurrent;
@@ -124,7 +105,7 @@ public class LRURevisionCache extends Lifecycle implements CDORevisionCache
return currentRevisions;
}
- public synchronized CDOClass getObjectType(CDOID id)
+ public synchronized EClass getObjectType(CDOID id)
{
RevisionHolder holder = getHolder(id);
if (holder == null)
@@ -133,7 +114,7 @@ public class LRURevisionCache extends Lifecycle implements CDORevisionCache
}
InternalCDORevision revision = holder.getRevision();
- return revision.getCDOClass();
+ return revision.getEClass();
}
public synchronized InternalCDORevision getRevision(CDOID id)
@@ -271,7 +252,9 @@ public class LRURevisionCache extends Lifecycle implements CDORevisionCache
CDOID revisionFolderID = (CDOID)revision.getContainerID();
if (CDOIDUtil.equals(revisionFolderID, folderID))
{
- String revisionName = (String)revision.getValue(cdoNameFeature);
+ EStructuralFeature feature = revision.getEClass().getEStructuralFeature(
+ CDOModelConstants.RESOURCE_NODE_NAME_ATTRIBUTE);
+ String revisionName = (String)revision.getValue(feature);
if (ObjectUtil.equals(revisionName, name))
{
return revision.getID();
diff --git a/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/internal/common/revision/cache/mem/MEMRevisionCache.java b/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/internal/common/revision/cache/mem/MEMRevisionCache.java
index 4a947eba1f..f0e23fdf64 100644
--- a/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/internal/common/revision/cache/mem/MEMRevisionCache.java
+++ b/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/internal/common/revision/cache/mem/MEMRevisionCache.java
@@ -15,10 +15,7 @@ package org.eclipse.emf.cdo.internal.common.revision.cache.mem;
import org.eclipse.emf.cdo.common.id.CDOID;
import org.eclipse.emf.cdo.common.id.CDOIDAndVersion;
import org.eclipse.emf.cdo.common.id.CDOIDUtil;
-import org.eclipse.emf.cdo.common.model.CDOClass;
-import org.eclipse.emf.cdo.common.model.CDOPackageManager;
-import org.eclipse.emf.cdo.common.model.resource.CDONameFeature;
-import org.eclipse.emf.cdo.common.model.resource.CDOResourceNodeClass;
+import org.eclipse.emf.cdo.common.model.CDOModelConstants;
import org.eclipse.emf.cdo.common.revision.CDORevision;
import org.eclipse.emf.cdo.common.revision.cache.CDORevisionCache;
import org.eclipse.emf.cdo.internal.common.bundle.OM;
@@ -35,6 +32,9 @@ import org.eclipse.net4j.util.ref.KeyedWeakReference;
import org.eclipse.net4j.util.ref.ReferenceQueueWorker;
import org.eclipse.net4j.util.ref.ReferenceType;
+import org.eclipse.emf.ecore.EClass;
+import org.eclipse.emf.ecore.EStructuralFeature;
+
import java.lang.ref.Reference;
import java.util.ArrayList;
import java.util.HashMap;
@@ -52,14 +52,10 @@ public class MEMRevisionCache extends ReferenceQueueWorker<InternalCDORevision>
{
private static final ContextTracer TRACER = new ContextTracer(OM.DEBUG_REVISION, MEMRevisionCache.class);
- private CDOPackageManager packageManager;
-
private Map<CDOID, CacheList> cacheLists = new HashMap<CDOID, CacheList>();
private ReferenceType referenceType;
- private transient CDONameFeature cdoNameFeature;
-
public MEMRevisionCache(ReferenceType referenceType)
{
this.referenceType = referenceType;
@@ -70,21 +66,6 @@ public class MEMRevisionCache extends ReferenceQueueWorker<InternalCDORevision>
this(ReferenceType.SOFT);
}
- public CDOPackageManager getPackageManager()
- {
- return packageManager;
- }
-
- public void setPackageManager(CDOPackageManager packageManager)
- {
- this.packageManager = packageManager;
- if (packageManager != null)
- {
- CDOResourceNodeClass resourceNodeClass = packageManager.getCDOResourcePackage().getCDOResourceNodeClass();
- cdoNameFeature = resourceNodeClass.getCDONameFeature();
- }
- }
-
public ReferenceType getReferenceType()
{
return referenceType;
@@ -95,7 +76,7 @@ public class MEMRevisionCache extends ReferenceQueueWorker<InternalCDORevision>
this.referenceType = referenceType;
}
- public CDOClass getObjectType(CDOID id)
+ public EClass getObjectType(CDOID id)
{
return null;
}
@@ -348,7 +329,9 @@ public class MEMRevisionCache extends ReferenceQueueWorker<InternalCDORevision>
CDOID revisionFolderID = (CDOID)revision.getContainerID();
if (CDOIDUtil.equals(revisionFolderID, folderID))
{
- String revisionName = (String)revision.getValue(cdoNameFeature);
+ EStructuralFeature feature = revision.getEClass().getEStructuralFeature(
+ CDOModelConstants.RESOURCE_NODE_NAME_ATTRIBUTE);
+ String revisionName = (String)revision.getValue(feature);
if (ObjectUtil.equals(revisionName, name))
{
return revision.getID();
diff --git a/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/internal/common/revision/cache/two/TwoLevelRevisionCache.java b/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/internal/common/revision/cache/two/TwoLevelRevisionCache.java
index 2dbfbc4a6f..152c332fba 100644
--- a/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/internal/common/revision/cache/two/TwoLevelRevisionCache.java
+++ b/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/internal/common/revision/cache/two/TwoLevelRevisionCache.java
@@ -13,8 +13,6 @@
package org.eclipse.emf.cdo.internal.common.revision.cache.two;
import org.eclipse.emf.cdo.common.id.CDOID;
-import org.eclipse.emf.cdo.common.model.CDOClass;
-import org.eclipse.emf.cdo.common.model.CDOPackageManager;
import org.eclipse.emf.cdo.common.revision.CDORevision;
import org.eclipse.emf.cdo.common.revision.cache.CDORevisionCache;
import org.eclipse.emf.cdo.internal.common.bundle.OM;
@@ -26,6 +24,8 @@ import org.eclipse.net4j.util.lifecycle.Lifecycle;
import org.eclipse.net4j.util.lifecycle.LifecycleUtil;
import org.eclipse.net4j.util.om.trace.ContextTracer;
+import org.eclipse.emf.ecore.EClass;
+
import java.util.ArrayList;
import java.util.List;
@@ -36,8 +36,6 @@ public class TwoLevelRevisionCache extends Lifecycle implements CDORevisionCache
{
private static final ContextTracer TRACER = new ContextTracer(OM.DEBUG_REVISION, TwoLevelRevisionCache.class);
- private CDOPackageManager packageManager;
-
private CDORevisionCache level1;
private CDORevisionCache level2;
@@ -46,25 +44,6 @@ public class TwoLevelRevisionCache extends Lifecycle implements CDORevisionCache
{
}
- public CDOPackageManager getPackageManager()
- {
- return packageManager;
- }
-
- public void setPackageManager(CDOPackageManager packageManager)
- {
- this.packageManager = packageManager;
- if (level1 != null)
- {
- level1.setPackageManager(packageManager);
- }
-
- if (level2 != null)
- {
- level2.setPackageManager(packageManager);
- }
- }
-
public CDORevisionCache getLevel1()
{
return level1;
@@ -73,7 +52,6 @@ public class TwoLevelRevisionCache extends Lifecycle implements CDORevisionCache
public void setLevel1(CDORevisionCache level1)
{
this.level1 = level1;
- setPackageManager(packageManager);
}
public CDORevisionCache getLevel2()
@@ -84,12 +62,17 @@ public class TwoLevelRevisionCache extends Lifecycle implements CDORevisionCache
public void setLevel2(CDORevisionCache level2)
{
this.level2 = level2;
- setPackageManager(packageManager);
}
- public CDOClass getObjectType(CDOID id)
+ public EClass getObjectType(CDOID id)
{
- return null;
+ EClass objectType = level1.getObjectType(id);
+ if (objectType == null)
+ {
+ objectType = level2.getObjectType(id);
+ }
+
+ return objectType;
}
public InternalCDORevision getRevision(CDOID id)
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
index d0b454263c..916af9bd4f 100644
--- 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
@@ -12,13 +12,14 @@
package org.eclipse.emf.cdo.internal.common.revision.delta;
import org.eclipse.emf.cdo.common.io.CDODataInput;
-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.revision.InternalCDORevision;
+import org.eclipse.emf.ecore.EClass;
+import org.eclipse.emf.ecore.EStructuralFeature;
+
import java.io.IOException;
/**
@@ -27,14 +28,14 @@ import java.io.IOException;
public class CDOAddFeatureDeltaImpl extends CDOSingleValueFeatureDeltaImpl implements CDOAddFeatureDelta,
IListIndexAffecting, IListTargetAdding
{
- public CDOAddFeatureDeltaImpl(CDOFeature feature, int index, Object value)
+ public CDOAddFeatureDeltaImpl(EStructuralFeature feature, int index, Object value)
{
super(feature, index, value);
}
- public CDOAddFeatureDeltaImpl(CDODataInput in, CDOClass cdoClass) throws IOException
+ public CDOAddFeatureDeltaImpl(CDODataInput in, EClass eClass) throws IOException
{
- super(in, cdoClass);
+ super(in, eClass);
}
public Type getType()
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
index e3f9eaa76e..2f06ec99b1 100644
--- 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
@@ -12,14 +12,15 @@
package org.eclipse.emf.cdo.internal.common.revision.delta;
import org.eclipse.emf.cdo.common.io.CDODataInput;
-import org.eclipse.emf.cdo.common.model.CDOClass;
-import org.eclipse.emf.cdo.common.model.CDOFeature;
import org.eclipse.emf.cdo.common.revision.CDOReferenceAdjuster;
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.revision.InternalCDORevision;
+import org.eclipse.emf.ecore.EClass;
+import org.eclipse.emf.ecore.EStructuralFeature;
+
import java.io.IOException;
/**
@@ -27,14 +28,14 @@ import java.io.IOException;
*/
public class CDOClearFeatureDeltaImpl extends CDOFeatureDeltaImpl implements CDOClearFeatureDelta
{
- public CDOClearFeatureDeltaImpl(CDOFeature feature)
+ public CDOClearFeatureDeltaImpl(EStructuralFeature feature)
{
super(feature);
}
- public CDOClearFeatureDeltaImpl(CDODataInput in, CDOClass cdoClass) throws IOException
+ public CDOClearFeatureDeltaImpl(CDODataInput in, EClass eClass) throws IOException
{
- super(in, cdoClass);
+ super(in, eClass);
}
public Type getType()
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
index c31542c293..7f1798bb5c 100644
--- 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
@@ -16,18 +16,15 @@ package org.eclipse.emf.cdo.internal.common.revision.delta;
import org.eclipse.emf.cdo.common.id.CDOID;
import org.eclipse.emf.cdo.common.io.CDODataInput;
import org.eclipse.emf.cdo.common.io.CDODataOutput;
-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.CDOReferenceAdjuster;
import org.eclipse.emf.cdo.common.revision.CDORevision;
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.revision.InternalCDORevision;
+import org.eclipse.emf.ecore.EClass;
+import org.eclipse.emf.ecore.impl.EStructuralFeatureImpl;
+
import java.io.IOException;
/**
@@ -49,7 +46,7 @@ public class CDOContainerFeatureDeltaImpl extends CDOFeatureDeltaImpl implements
this.newContainerFeatureID = newContainerFeatureID;
}
- public CDOContainerFeatureDeltaImpl(CDODataInput in, CDOClass cdoClass) throws IOException
+ public CDOContainerFeatureDeltaImpl(CDODataInput in, EClass eClass) throws IOException
{
super(CONTAINER_FEATURE);
newContainerFeatureID = in.readInt();
@@ -92,7 +89,7 @@ public class CDOContainerFeatureDeltaImpl extends CDOFeatureDeltaImpl implements
}
@Override
- public void write(CDODataOutput out, CDOClass cdoClass) throws IOException
+ public void write(CDODataOutput out, EClass eClass) throws IOException
{
out.writeInt(getType().ordinal());
out.writeInt(newContainerFeatureID);
@@ -108,92 +105,9 @@ public class CDOContainerFeatureDeltaImpl extends CDOFeatureDeltaImpl implements
/**
* @author Simon McDuff
*/
- public static final class ContainerFeature implements CDOFeature
+ public static final class ContainerFeature extends EStructuralFeatureImpl
{
- 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 String getQualifiedName()
- {
- return null;
- }
-
- public CDOPackageManager getPackageManager()
- {
- return null;
- }
-
- public Object getServerInfo()
- {
- return null;
- }
-
- public void setClientInfo(Object clientInfo)
- {
- }
-
- public void setServerInfo(Object serverInfo)
+ public ContainerFeature()
{
}
@@ -202,10 +116,5 @@ public class CDOContainerFeatureDeltaImpl extends CDOFeatureDeltaImpl implements
{
return "CONTAINER_FEATURE";
}
-
- public Object getDefaultValue()
- {
- return null;
- }
}
}
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
index 55f51af19e..900f59d6d5 100644
--- 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
@@ -13,11 +13,12 @@ package org.eclipse.emf.cdo.internal.common.revision.delta;
import org.eclipse.emf.cdo.common.io.CDODataInput;
import org.eclipse.emf.cdo.common.io.CDODataOutput;
-import org.eclipse.emf.cdo.common.model.CDOClass;
-import org.eclipse.emf.cdo.common.model.CDOFeature;
import org.eclipse.emf.cdo.common.revision.CDOReferenceAdjuster;
import org.eclipse.emf.cdo.common.revision.delta.CDOFeatureDelta;
+import org.eclipse.emf.ecore.EClass;
+import org.eclipse.emf.ecore.EStructuralFeature;
+
import java.io.IOException;
/**
@@ -27,26 +28,26 @@ public abstract class CDOFeatureDeltaImpl implements InternalCDOFeatureDelta
{
public static final int NO_INDEX = -1;
- private CDOFeature feature;
+ private EStructuralFeature feature;
- protected CDOFeatureDeltaImpl(CDOFeature feature)
+ protected CDOFeatureDeltaImpl(EStructuralFeature feature)
{
this.feature = feature;
}
- public CDOFeatureDeltaImpl(CDODataInput in, CDOClass cdoClass) throws IOException
+ public CDOFeatureDeltaImpl(CDODataInput in, EClass eClass) throws IOException
{
int featureID = in.readInt();
- feature = cdoClass.getAllFeatures()[featureID];
+ feature = eClass.getEStructuralFeature(featureID);
}
- public void write(CDODataOutput out, CDOClass cdoClass) throws IOException
+ public void write(CDODataOutput out, EClass eClass) throws IOException
{
out.writeInt(getType().ordinal());
- out.writeInt(cdoClass.getFeatureID(feature));
+ out.writeInt(eClass.getFeatureID(feature));
}
- public CDOFeature getFeature()
+ public EStructuralFeature getFeature()
{
return feature;
}
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
index 73b12a26b4..0b1bac55bf 100644
--- 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
@@ -13,8 +13,6 @@ package org.eclipse.emf.cdo.internal.common.revision.delta;
import org.eclipse.emf.cdo.common.io.CDODataInput;
import org.eclipse.emf.cdo.common.io.CDODataOutput;
-import org.eclipse.emf.cdo.common.model.CDOClass;
-import org.eclipse.emf.cdo.common.model.CDOFeature;
import org.eclipse.emf.cdo.common.revision.CDOReferenceAdjuster;
import org.eclipse.emf.cdo.common.revision.CDORevision;
import org.eclipse.emf.cdo.common.revision.delta.CDOFeatureDelta;
@@ -24,6 +22,10 @@ import org.eclipse.emf.cdo.common.revision.delta.CDORemoveFeatureDelta;
import org.eclipse.net4j.util.collection.Pair;
+import org.eclipse.emf.ecore.EClass;
+import org.eclipse.emf.ecore.EReference;
+import org.eclipse.emf.ecore.EStructuralFeature;
+
import java.io.IOException;
import java.lang.reflect.Array;
import java.util.ArrayList;
@@ -43,18 +45,18 @@ public class CDOListFeatureDeltaImpl extends CDOFeatureDeltaImpl implements CDOL
private transient List<CDOFeatureDelta> notProcessedFeatureDelta;
- public CDOListFeatureDeltaImpl(CDOFeature feature)
+ public CDOListFeatureDeltaImpl(EStructuralFeature feature)
{
super(feature);
}
- public CDOListFeatureDeltaImpl(CDODataInput in, CDOClass cdoClass) throws IOException
+ public CDOListFeatureDeltaImpl(CDODataInput in, EClass eClass) throws IOException
{
- super(in, cdoClass);
+ super(in, eClass);
int size = in.readInt();
for (int i = 0; i < size; i++)
{
- featureDeltas.add(in.readCDOFeatureDelta(cdoClass));
+ featureDeltas.add(in.readCDOFeatureDelta(eClass));
}
}
@@ -71,13 +73,13 @@ public class CDOListFeatureDeltaImpl extends CDOFeatureDeltaImpl implements CDOL
}
@Override
- public void write(CDODataOutput out, CDOClass cdoClass) throws IOException
+ public void write(CDODataOutput out, EClass eClass) throws IOException
{
- super.write(out, cdoClass);
+ super.write(out, eClass);
out.writeInt(featureDeltas.size());
for (CDOFeatureDelta featureDelta : featureDeltas)
{
- out.writeCDOFeatureDelta(featureDelta, cdoClass);
+ out.writeCDOFeatureDelta(featureDelta, eClass);
}
}
@@ -155,8 +157,8 @@ public class CDOListFeatureDeltaImpl extends CDOFeatureDeltaImpl implements CDOL
private void cleanupWithNewDelta(CDOFeatureDelta featureDelta)
{
- CDOFeature feature = getFeature();
- if (feature.isReference() && featureDelta instanceof CDORemoveFeatureDelta)
+ EStructuralFeature feature = getFeature();
+ if (feature instanceof EReference && featureDelta instanceof CDORemoveFeatureDelta)
{
int indexToRemove = ((CDORemoveFeatureDelta)featureDelta).getIndex();
reconstructAddedIndicesWithNoCopy();
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
index 2fb19ae9e6..14326ad496 100644
--- 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
@@ -13,14 +13,15 @@ package org.eclipse.emf.cdo.internal.common.revision.delta;
import org.eclipse.emf.cdo.common.io.CDODataInput;
import org.eclipse.emf.cdo.common.io.CDODataOutput;
-import org.eclipse.emf.cdo.common.model.CDOClass;
-import org.eclipse.emf.cdo.common.model.CDOFeature;
import org.eclipse.emf.cdo.common.revision.CDOReferenceAdjuster;
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.revision.InternalCDORevision;
+import org.eclipse.emf.ecore.EClass;
+import org.eclipse.emf.ecore.EStructuralFeature;
+
import java.io.IOException;
/**
@@ -32,24 +33,24 @@ public class CDOMoveFeatureDeltaImpl extends CDOFeatureDeltaImpl implements CDOM
private int newPosition;
- public CDOMoveFeatureDeltaImpl(CDOFeature feature, int newPosition, int oldPosition)
+ public CDOMoveFeatureDeltaImpl(EStructuralFeature feature, int newPosition, int oldPosition)
{
super(feature);
this.newPosition = newPosition;
this.oldPosition = oldPosition;
}
- public CDOMoveFeatureDeltaImpl(CDODataInput in, CDOClass cdoClass) throws IOException
+ public CDOMoveFeatureDeltaImpl(CDODataInput in, EClass eClass) throws IOException
{
- super(in, cdoClass);
+ super(in, eClass);
newPosition = in.readInt();
oldPosition = in.readInt();
}
@Override
- public void write(CDODataOutput out, CDOClass cdoClass) throws IOException
+ public void write(CDODataOutput out, EClass eClass) throws IOException
{
- super.write(out, cdoClass);
+ super.write(out, eClass);
out.writeInt(newPosition);
out.writeInt(oldPosition);
}
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
index 36d7de44fe..ce2cd7bd44 100644
--- 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
@@ -13,14 +13,15 @@ package org.eclipse.emf.cdo.internal.common.revision.delta;
import org.eclipse.emf.cdo.common.io.CDODataInput;
import org.eclipse.emf.cdo.common.io.CDODataOutput;
-import org.eclipse.emf.cdo.common.model.CDOClass;
-import org.eclipse.emf.cdo.common.model.CDOFeature;
import org.eclipse.emf.cdo.common.revision.CDOReferenceAdjuster;
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.revision.InternalCDORevision;
+import org.eclipse.emf.ecore.EClass;
+import org.eclipse.emf.ecore.EStructuralFeature;
+
import java.io.IOException;
/**
@@ -31,22 +32,22 @@ public class CDORemoveFeatureDeltaImpl extends CDOFeatureDeltaImpl implements CD
{
private int index;
- public CDORemoveFeatureDeltaImpl(CDOFeature feature, int index)
+ public CDORemoveFeatureDeltaImpl(EStructuralFeature feature, int index)
{
super(feature);
this.index = index;
}
- public CDORemoveFeatureDeltaImpl(CDODataInput in, CDOClass cdoClass) throws IOException
+ public CDORemoveFeatureDeltaImpl(CDODataInput in, EClass eClass) throws IOException
{
- super(in, cdoClass);
+ super(in, eClass);
index = in.readInt();
}
@Override
- public void write(CDODataOutput out, CDOClass cdoClass) throws IOException
+ public void write(CDODataOutput out, EClass eClass) throws IOException
{
- super.write(out, cdoClass);
+ super.write(out, eClass);
out.writeInt(index);
}
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
index 3aeaed35da..11b376a9d6 100644
--- 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
@@ -15,8 +15,7 @@ package org.eclipse.emf.cdo.internal.common.revision.delta;
import org.eclipse.emf.cdo.common.id.CDOID;
import org.eclipse.emf.cdo.common.io.CDODataInput;
import org.eclipse.emf.cdo.common.io.CDODataOutput;
-import org.eclipse.emf.cdo.common.model.CDOClass;
-import org.eclipse.emf.cdo.common.model.CDOFeature;
+import org.eclipse.emf.cdo.common.model.CDOModelUtil;
import org.eclipse.emf.cdo.common.revision.CDOReferenceAdjuster;
import org.eclipse.emf.cdo.common.revision.CDORevision;
import org.eclipse.emf.cdo.common.revision.CDORevisionData;
@@ -28,6 +27,9 @@ import org.eclipse.emf.cdo.common.revision.delta.CDORevisionDelta;
import org.eclipse.emf.cdo.spi.common.revision.InternalCDORevision;
import org.eclipse.emf.cdo.spi.common.revision.InternalCDORevisionDelta;
+import org.eclipse.emf.ecore.EClass;
+import org.eclipse.emf.ecore.EStructuralFeature;
+
import java.io.IOException;
import java.util.ArrayList;
import java.util.HashMap;
@@ -41,18 +43,18 @@ public class CDORevisionDeltaImpl implements InternalCDORevisionDelta
{
private CDOID cdoID;
- private CDOClass cdoClass;
+ private EClass eClass;
private int dirtyVersion;
private int originVersion;
- private Map<CDOFeature, CDOFeatureDelta> featureDeltas = new HashMap<CDOFeature, CDOFeatureDelta>();
+ private Map<EStructuralFeature, CDOFeatureDelta> featureDeltas = new HashMap<EStructuralFeature, CDOFeatureDelta>();
public CDORevisionDeltaImpl(CDORevision revision)
{
cdoID = revision.getID();
- cdoClass = revision.getCDOClass();
+ eClass = revision.getEClass();
dirtyVersion = revision.getVersion();
originVersion = dirtyVersion - 1;
}
@@ -60,7 +62,7 @@ public class CDORevisionDeltaImpl implements InternalCDORevisionDelta
public CDORevisionDeltaImpl(CDORevisionDelta revisionDelta)
{
cdoID = revisionDelta.getID();
- cdoClass = ((CDORevisionDeltaImpl)revisionDelta).cdoClass;
+ eClass = ((CDORevisionDeltaImpl)revisionDelta).eClass;
dirtyVersion = revisionDelta.getDirtyVersion();
originVersion = revisionDelta.getOriginVersion();
@@ -72,13 +74,13 @@ public class CDORevisionDeltaImpl implements InternalCDORevisionDelta
public CDORevisionDeltaImpl(CDORevision originRevision, CDORevision dirtyRevision)
{
- if (originRevision.getCDOClass() != dirtyRevision.getCDOClass())
+ if (originRevision.getEClass() != dirtyRevision.getEClass())
{
throw new IllegalArgumentException();
}
cdoID = originRevision.getID();
- cdoClass = originRevision.getCDOClass();
+ eClass = originRevision.getEClass();
dirtyVersion = dirtyRevision.getVersion();
originVersion = originRevision.getVersion();
@@ -98,28 +100,28 @@ public class CDORevisionDeltaImpl implements InternalCDORevisionDelta
public CDORevisionDeltaImpl(CDODataInput in) throws IOException
{
- cdoClass = in.readCDOClassRefAndResolve();
+ eClass = (EClass)in.readCDOClassifierRefAndResolve();
cdoID = in.readCDOID();
originVersion = in.readInt();
dirtyVersion = in.readInt();
int size = in.readInt();
for (int i = 0; i < size; i++)
{
- CDOFeatureDelta featureDelta = in.readCDOFeatureDelta(cdoClass);
+ CDOFeatureDelta featureDelta = in.readCDOFeatureDelta(eClass);
featureDeltas.put(featureDelta.getFeature(), featureDelta);
}
}
public void write(CDODataOutput out) throws IOException
{
- out.writeCDOClassRef(cdoClass);
+ out.writeCDOClassifierRef(eClass);
out.writeCDOID(cdoID);
out.writeInt(originVersion);
out.writeInt(dirtyVersion);
out.writeInt(featureDeltas.size());
for (CDOFeatureDelta featureDelta : featureDeltas.values())
{
- out.writeCDOFeatureDelta(featureDelta, cdoClass);
+ out.writeCDOFeatureDelta(featureDelta, eClass);
}
}
@@ -180,7 +182,7 @@ public class CDORevisionDeltaImpl implements InternalCDORevisionDelta
private void addSingleFeatureDelta(CDOFeatureDelta delta)
{
- CDOFeature feature = delta.getFeature();
+ EStructuralFeature feature = delta.getFeature();
if (feature.isMany())
{
@@ -222,11 +224,11 @@ public class CDORevisionDeltaImpl implements InternalCDORevisionDelta
private void compare(CDORevision originRevision, CDORevision dirtyRevision)
{
- CDOFeature features[] = cdoClass.getAllFeatures();
- int count = cdoClass.getFeatureCount();
+ EStructuralFeature[] features = CDOModelUtil.getAllPersistentFeatures(eClass);
+ int count = eClass.getFeatureCount();
for (int i = 0; i < count; i++)
{
- CDOFeature feature = features[i];
+ EStructuralFeature feature = features[i];
if (feature.isMany())
{
int originSize = originRevision.data().size(feature);
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
index 64a820f805..c937e8d18a 100644
--- 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
@@ -12,13 +12,14 @@
package org.eclipse.emf.cdo.internal.common.revision.delta;
import org.eclipse.emf.cdo.common.io.CDODataInput;
-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.revision.InternalCDORevision;
+import org.eclipse.emf.ecore.EClass;
+import org.eclipse.emf.ecore.EStructuralFeature;
+
import java.io.IOException;
/**
@@ -27,14 +28,14 @@ import java.io.IOException;
public class CDOSetFeatureDeltaImpl extends CDOSingleValueFeatureDeltaImpl implements CDOSetFeatureDelta,
IListTargetAdding
{
- public CDOSetFeatureDeltaImpl(CDOFeature feature, int index, Object value)
+ public CDOSetFeatureDeltaImpl(EStructuralFeature feature, int index, Object value)
{
super(feature, index, value);
}
- public CDOSetFeatureDeltaImpl(CDODataInput in, CDOClass cdoClass) throws IOException
+ public CDOSetFeatureDeltaImpl(CDODataInput in, EClass eClass) throws IOException
{
- super(in, cdoClass);
+ super(in, eClass);
}
public Type getType()
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
index d2ffa8f8a7..a42ea48e20 100644
--- 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
@@ -14,11 +14,12 @@ package org.eclipse.emf.cdo.internal.common.revision.delta;
import org.eclipse.emf.cdo.common.id.CDOID;
import org.eclipse.emf.cdo.common.io.CDODataInput;
import org.eclipse.emf.cdo.common.io.CDODataOutput;
-import org.eclipse.emf.cdo.common.model.CDOClass;
-import org.eclipse.emf.cdo.common.model.CDOFeature;
import org.eclipse.emf.cdo.common.revision.CDOReferenceAdjuster;
import org.eclipse.emf.cdo.common.revision.delta.CDOFeatureDelta;
-import org.eclipse.emf.cdo.spi.common.model.InternalCDOFeature;
+
+import org.eclipse.emf.ecore.EClass;
+import org.eclipse.emf.ecore.EReference;
+import org.eclipse.emf.ecore.EStructuralFeature;
import java.io.IOException;
@@ -31,32 +32,33 @@ public abstract class CDOSingleValueFeatureDeltaImpl extends CDOFeatureDeltaImpl
private Object newValue;
- public CDOSingleValueFeatureDeltaImpl(CDOFeature feature, int index, Object value)
+ public CDOSingleValueFeatureDeltaImpl(EStructuralFeature feature, int index, Object value)
{
super(feature);
this.index = index;
newValue = value;
}
- public CDOSingleValueFeatureDeltaImpl(CDODataInput in, CDOClass cdoClass) throws IOException
+ public CDOSingleValueFeatureDeltaImpl(CDODataInput in, EClass eClass) throws IOException
{
- super(in, cdoClass);
+ super(in, eClass);
index = in.readInt();
- newValue = ((InternalCDOFeature)getFeature()).readValue(in);
+ newValue = in.readCDOFeatureValue(getFeature());
}
@Override
- public void write(CDODataOutput out, CDOClass cdoClass) throws IOException
+ public void write(CDODataOutput out, EClass eClass) throws IOException
{
- super.write(out, cdoClass);
+ super.write(out, eClass);
out.writeInt(index);
Object valueToWrite = newValue;
- if (valueToWrite != null && getFeature().isReference())
+ EStructuralFeature feature = getFeature();
+ if (valueToWrite != null && feature instanceof EReference)
{
valueToWrite = out.getIDProvider().provideCDOID(newValue);
}
- ((InternalCDOFeature)getFeature()).writeValue(out, valueToWrite);
+ out.writeCDOFeatureValue(valueToWrite, feature);
}
public int getIndex()
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
index 0f74985fb5..48ddc59ece 100644
--- 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
@@ -12,14 +12,15 @@
package org.eclipse.emf.cdo.internal.common.revision.delta;
import org.eclipse.emf.cdo.common.io.CDODataInput;
-import org.eclipse.emf.cdo.common.model.CDOClass;
-import org.eclipse.emf.cdo.common.model.CDOFeature;
import org.eclipse.emf.cdo.common.revision.CDOReferenceAdjuster;
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.revision.InternalCDORevision;
+import org.eclipse.emf.ecore.EClass;
+import org.eclipse.emf.ecore.EStructuralFeature;
+
import java.io.IOException;
/**
@@ -27,14 +28,14 @@ import java.io.IOException;
*/
public class CDOUnsetFeatureDeltaImpl extends CDOFeatureDeltaImpl implements CDOUnsetFeatureDelta
{
- public CDOUnsetFeatureDeltaImpl(CDOFeature feature)
+ public CDOUnsetFeatureDeltaImpl(EStructuralFeature feature)
{
super(feature);
}
- public CDOUnsetFeatureDeltaImpl(CDODataInput in, CDOClass cdoClass) throws IOException
+ public CDOUnsetFeatureDeltaImpl(CDODataInput in, EClass eClass) throws IOException
{
- super(in, cdoClass);
+ super(in, eClass);
}
public Type getType()
diff --git a/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/spi/common/id/AbstractCDOID.java b/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/spi/common/id/AbstractCDOID.java
index 3930dfd318..4c345eb787 100644
--- a/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/spi/common/id/AbstractCDOID.java
+++ b/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/spi/common/id/AbstractCDOID.java
@@ -95,6 +95,20 @@ public abstract class AbstractCDOID implements CDOID
}
}
+ public final int compareTo(CDOID o)
+ {
+ try
+ {
+ return doCompareTo(o);
+ }
+ catch (ClassCastException ex)
+ {
+ return getType().compareTo(o.getType());
+ }
+ }
+
+ protected abstract int doCompareTo(CDOID o) throws ClassCastException;
+
/**
* <b>Note:</b> {@link CDOID#toURIFragment()} and {@link AbstractCDOID#read(String)} need to match.
*/
diff --git a/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/spi/common/id/AbstractCDOIDInteger.java b/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/spi/common/id/AbstractCDOIDInteger.java
index 0cf4d109c7..618b8539c4 100644
--- a/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/spi/common/id/AbstractCDOIDInteger.java
+++ b/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/spi/common/id/AbstractCDOIDInteger.java
@@ -20,7 +20,7 @@ import java.io.IOException;
* @author Eike Stepper
* @since 2.0
*/
-public abstract class AbstractCDOIDInteger extends AbstractCDOID implements Comparable<AbstractCDOIDInteger>
+public abstract class AbstractCDOIDInteger extends AbstractCDOID
{
private static final long serialVersionUID = 1L;
diff --git a/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/spi/common/id/AbstractCDOIDLong.java b/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/spi/common/id/AbstractCDOIDLong.java
index c2ce5571f4..ebfaba2b33 100644
--- a/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/spi/common/id/AbstractCDOIDLong.java
+++ b/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/spi/common/id/AbstractCDOIDLong.java
@@ -21,7 +21,7 @@ import java.io.IOException;
* @author Eike Stepper
* @since 2.0
*/
-public abstract class AbstractCDOIDLong extends AbstractCDOID implements Comparable<AbstractCDOIDLong>
+public abstract class AbstractCDOIDLong extends AbstractCDOID
{
public static final long NULL_VALUE = 0L;
@@ -71,21 +71,6 @@ public abstract class AbstractCDOIDLong extends AbstractCDOID implements Compara
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)
{
diff --git a/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/spi/common/id/CDOIDLibraryDescriptorImpl.java b/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/spi/common/id/CDOIDLibraryDescriptorImpl.java
index 650f0901d8..3e5a43c436 100644
--- a/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/spi/common/id/CDOIDLibraryDescriptorImpl.java
+++ b/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/spi/common/id/CDOIDLibraryDescriptorImpl.java
@@ -25,8 +25,7 @@ import java.io.IOException;
*/
public class CDOIDLibraryDescriptorImpl implements CDOIDLibraryDescriptor
{
- private static final ContextTracer PROTOCOL_TRACER = new ContextTracer(OM.DEBUG_PROTOCOL,
- CDOIDLibraryDescriptorImpl.class);
+ private static final ContextTracer TRACER = new ContextTracer(OM.DEBUG_PROTOCOL, CDOIDLibraryDescriptorImpl.class);
private String factoryName;
@@ -41,24 +40,24 @@ public class CDOIDLibraryDescriptorImpl implements CDOIDLibraryDescriptor
public CDOIDLibraryDescriptorImpl(ExtendedDataInput in) throws IOException
{
factoryName = in.readString();
- if (PROTOCOL_TRACER.isEnabled())
+ if (TRACER.isEnabled())
{
- PROTOCOL_TRACER.format("Read factory name: {0}", factoryName);
+ TRACER.format("Read factory name: {0}", factoryName);
}
int size = in.readInt();
- if (PROTOCOL_TRACER.isEnabled())
+ if (TRACER.isEnabled())
{
- PROTOCOL_TRACER.format("Reading {0} library names", size);
+ TRACER.format("Reading {0} library names", size);
}
libraryNames = new String[size];
for (int i = 0; i < size; i++)
{
libraryNames[i] = in.readString();
- if (PROTOCOL_TRACER.isEnabled())
+ if (TRACER.isEnabled())
{
- PROTOCOL_TRACER.format("Read library name: {0}", libraryNames[i]);
+ TRACER.format("Read library name: {0}", libraryNames[i]);
}
}
}
@@ -75,23 +74,23 @@ public class CDOIDLibraryDescriptorImpl implements CDOIDLibraryDescriptor
public void write(ExtendedDataOutput out) throws IOException
{
- if (PROTOCOL_TRACER.isEnabled())
+ if (TRACER.isEnabled())
{
- PROTOCOL_TRACER.format("Writing factory name: {0}", factoryName);
+ TRACER.format("Writing factory name: {0}", factoryName);
}
out.writeString(factoryName);
- if (PROTOCOL_TRACER.isEnabled())
+ if (TRACER.isEnabled())
{
- PROTOCOL_TRACER.format("Writing {0} library names", libraryNames.length);
+ TRACER.format("Writing {0} library names", libraryNames.length);
}
out.writeInt(libraryNames.length);
for (String libraryName : libraryNames)
{
- if (PROTOCOL_TRACER.isEnabled())
+ if (TRACER.isEnabled())
{
- PROTOCOL_TRACER.format("Writing library name: {0}", libraryName);
+ TRACER.format("Writing library name: {0}", libraryName);
}
out.writeString(libraryName);
diff --git a/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/spi/common/id/CDOIDLongImpl.java b/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/spi/common/id/CDOIDLongImpl.java
index 19e720ef95..358ddd31a6 100644
--- a/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/spi/common/id/CDOIDLongImpl.java
+++ b/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/spi/common/id/CDOIDLongImpl.java
@@ -10,6 +10,7 @@
*/
package org.eclipse.emf.cdo.spi.common.id;
+import org.eclipse.emf.cdo.common.id.CDOID;
import org.eclipse.emf.cdo.common.id.CDOIDObject;
/**
@@ -39,4 +40,10 @@ public class CDOIDLongImpl extends AbstractCDOIDLong implements CDOIDObject
{
return "OID" + getLongValue();
}
+
+ @Override
+ protected int doCompareTo(CDOID o) throws ClassCastException
+ {
+ return new Long(getLongValue()).compareTo(((CDOIDLongImpl)o).getLongValue());
+ }
}
diff --git a/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/spi/common/model/InternalCDOClass.java b/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/spi/common/model/InternalCDOClass.java
deleted file mode 100644
index f1809bf463..0000000000
--- a/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/spi/common/model/InternalCDOClass.java
+++ /dev/null
@@ -1,37 +0,0 @@
-/**
- * Copyright (c) 2004 - 2009 Eike Stepper (Berlin, Germany) and others.
- * 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.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.CDOPackage;
-
-import java.util.List;
-
-/**
- * @author Eike Stepper
- * @noimplement This interface is not intended to be implemented by clients.
- * @since 2.0
- */
-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/model/InternalCDOFeature.java b/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/spi/common/model/InternalCDOFeature.java
deleted file mode 100644
index d621fa4948..0000000000
--- a/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/spi/common/model/InternalCDOFeature.java
+++ /dev/null
@@ -1,42 +0,0 @@
-/**
- * Copyright (c) 2004 - 2009 Eike Stepper (Berlin, Germany) and others.
- * 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.model;
-
-import org.eclipse.emf.cdo.common.io.CDODataInput;
-import org.eclipse.emf.cdo.common.io.CDODataOutput;
-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 java.io.IOException;
-
-/**
- * @author Eike Stepper
- * @noimplement This interface is not intended to be implemented by clients.
- * @since 2.0
- */
-public interface InternalCDOFeature extends CDOFeature, InternalCDOModelElement
-{
- public CDOClassProxy getReferenceTypeProxy();
-
- public void setContainingClass(CDOClass containingClass);
-
- public void setFeatureIndex(int featureIndex);
-
- public void setReferenceType(CDOClassRef cdoClassRef);
-
- public void setDefaultValue(Object defaultValue);
-
- public void writeValue(CDODataOutput out, Object value) throws IOException;
-
- public Object readValue(CDODataInput in) throws IOException;
-}
diff --git a/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/spi/common/model/InternalCDOPackage.java b/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/spi/common/model/InternalCDOPackage.java
deleted file mode 100644
index c2ab930ec8..0000000000
--- a/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/spi/common/model/InternalCDOPackage.java
+++ /dev/null
@@ -1,40 +0,0 @@
-/**
- * Copyright (c) 2004 - 2009 Eike Stepper (Berlin, Germany) and others.
- * 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.model;
-
-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
- * @noimplement This interface is not intended to be implemented by clients.
- * @since 2.0
- */
-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 String basicGetEcore();
-
- 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/model/InternalCDOModelElement.java b/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/spi/common/model/InternalCDOPackageInfo.java
index d04490ec75..3bce96e798 100644
--- a/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/spi/common/model/InternalCDOModelElement.java
+++ b/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/spi/common/model/InternalCDOPackageInfo.java
@@ -10,26 +10,31 @@
*/
package org.eclipse.emf.cdo.spi.common.model;
+import org.eclipse.emf.cdo.common.id.CDOIDMetaRange;
import org.eclipse.emf.cdo.common.io.CDODataInput;
import org.eclipse.emf.cdo.common.io.CDODataOutput;
-import org.eclipse.emf.cdo.common.model.CDOModelElement;
+import org.eclipse.emf.cdo.common.model.CDOPackageInfo;
+
+import org.eclipse.emf.common.notify.Adapter;
import java.io.IOException;
/**
* @author Eike Stepper
- * @noimplement This interface is not intended to be implemented by clients.
- * @since 2.0
*/
-public interface InternalCDOModelElement extends CDOModelElement
+public interface InternalCDOPackageInfo extends CDOPackageInfo, Adapter.Internal
{
- public void setName(String name);
+ public InternalCDOPackageUnit getPackageUnit();
- public void setClientInfo(Object clientInfo);
+ public void setPackageUnit(InternalCDOPackageUnit packageUnit);
- public void setServerInfo(Object serverInfo);
+ public void setPackageURI(String packageURI);
- public void read(CDODataInput in) throws IOException;
+ public void setParentURI(String parentURI);
+
+ public void setMetaIDRange(CDOIDMetaRange metaIDRange);
public void write(CDODataOutput out) throws IOException;
+
+ public void read(CDODataInput in) throws IOException;
}
diff --git a/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/spi/common/model/InternalCDOPackageManager.java b/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/spi/common/model/InternalCDOPackageManager.java
deleted file mode 100644
index a203d2eb8b..0000000000
--- a/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/spi/common/model/InternalCDOPackageManager.java
+++ /dev/null
@@ -1,33 +0,0 @@
-/**
- * Copyright (c) 2004 - 2009 Eike Stepper (Berlin, Germany) and others.
- * 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.model;
-
-import org.eclipse.emf.cdo.common.model.CDOPackage;
-import org.eclipse.emf.cdo.common.model.CDOPackageManager;
-
-/**
- * @author Eike Stepper
- * @since 2.0
- */
-public interface InternalCDOPackageManager extends CDOPackageManager
-{
- /**
- * @param cdoPackage
- * A proxy CDO package.
- */
- public void loadPackage(CDOPackage cdoPackage);
-
- /**
- * @param cdoPackage
- * A CDO package with <code>ecore == null</code>.
- */
- public void loadPackageEcore(CDOPackage cdoPackage);
-}
diff --git a/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/spi/common/model/InternalCDOPackageRegistry.java b/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/spi/common/model/InternalCDOPackageRegistry.java
new file mode 100644
index 0000000000..1ef0c8ed07
--- /dev/null
+++ b/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/spi/common/model/InternalCDOPackageRegistry.java
@@ -0,0 +1,91 @@
+/**
+ * Copyright (c) 2004 - 2009 Eike Stepper (Berlin, Germany) and others.
+ * 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.model;
+
+import org.eclipse.emf.cdo.common.id.CDOID;
+import org.eclipse.emf.cdo.common.id.CDOIDMetaRange;
+import org.eclipse.emf.cdo.common.model.CDOPackageRegistry;
+import org.eclipse.emf.cdo.common.model.CDOPackageUnit;
+
+import org.eclipse.net4j.util.lifecycle.ILifecycle;
+
+import org.eclipse.emf.ecore.EPackage;
+import org.eclipse.emf.ecore.InternalEObject;
+
+import java.util.Set;
+
+/**
+ * @author Eike Stepper
+ */
+public interface InternalCDOPackageRegistry extends CDOPackageRegistry, ILifecycle.Introspection
+{
+ public MetaInstanceMapper getMetaInstanceMapper();
+
+ public void setReplacingDescriptors(boolean replacingDescriptors);
+
+ public PackageProcessor getPackageProcessor();
+
+ public void setPackageProcessor(PackageProcessor packageProcessor);
+
+ public PackageLoader getPackageLoader();
+
+ public void setPackageLoader(PackageLoader packageLoader);
+
+ public Object basicPut(String nsURI, Object value);
+
+ public void putPackageUnit(InternalCDOPackageUnit packageUnit);
+
+ public InternalCDOPackageUnit getPackageUnit(EPackage ePackage);
+
+ public InternalCDOPackageUnit[] getPackageUnits();
+
+ public InternalCDOPackageInfo getPackageInfo(EPackage ePackage);
+
+ public InternalCDOPackageInfo[] getPackageInfos();
+
+ public EPackage[] getEPackages();
+
+ /**
+ * @author Eike Stepper
+ */
+ public interface PackageProcessor
+ {
+ public Object processPackage(Object value);
+ }
+
+ /**
+ * @author Eike Stepper
+ */
+ public interface PackageLoader
+ {
+ public EPackage[] loadPackages(CDOPackageUnit packageUnit);
+ }
+
+ /**
+ * @author Eike Stepper
+ */
+ public interface MetaInstanceMapper
+ {
+ public Set<Entry<CDOID, InternalEObject>> getEntrySet();
+
+ public InternalEObject lookupMetaInstance(CDOID id);
+
+ public CDOID lookupMetaInstanceID(InternalEObject metaInstance);
+
+ public CDOIDMetaRange mapMetaInstances(EPackage ePackage);
+
+ public void mapMetaInstances(EPackage ePackage, CDOIDMetaRange metaIDRange);
+
+ public void mapMetaInstances(MetaInstanceMapper source);
+
+ public void remapMetaInstanceID(CDOID oldID, CDOID newID);
+ }
+}
diff --git a/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/spi/common/model/InternalCDOPackageUnit.java b/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/spi/common/model/InternalCDOPackageUnit.java
new file mode 100644
index 0000000000..a8df264a89
--- /dev/null
+++ b/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/spi/common/model/InternalCDOPackageUnit.java
@@ -0,0 +1,43 @@
+package org.eclipse.emf.cdo.spi.common.model;
+
+import org.eclipse.emf.cdo.common.io.CDODataInput;
+import org.eclipse.emf.cdo.common.io.CDODataOutput;
+import org.eclipse.emf.cdo.common.model.CDOPackageUnit;
+
+import org.eclipse.emf.ecore.EPackage;
+
+import java.io.IOException;
+
+/**
+ * @author Eike Stepper
+ */
+public interface InternalCDOPackageUnit extends CDOPackageUnit
+{
+ public InternalCDOPackageRegistry getPackageRegistry();
+
+ public void setPackageRegistry(InternalCDOPackageRegistry packageRegistry);
+
+ public void setState(State state);
+
+ public void setOriginalType(Type originalType);
+
+ public void setTimeStamp(long timeStamp);
+
+ public InternalCDOPackageInfo getTopLevelPackageInfo();
+
+ public InternalCDOPackageInfo getPackageInfo(String packageURI);
+
+ public InternalCDOPackageInfo[] getPackageInfos();
+
+ public void setPackageInfos(InternalCDOPackageInfo[] packageInfos);
+
+ public void load();
+
+ public void write(CDODataOutput out, boolean withPackages) throws IOException;
+
+ public void read(CDODataInput in, InternalCDOPackageRegistry packageRegistry) throws IOException;
+
+ public void init(EPackage ePackage);
+
+ public void dispose();
+}
diff --git a/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/spi/common/revision/AbstractCDORevision.java b/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/spi/common/revision/AbstractCDORevision.java
index 37248fbdd7..57603a0828 100644
--- a/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/spi/common/revision/AbstractCDORevision.java
+++ b/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/spi/common/revision/AbstractCDORevision.java
@@ -18,9 +18,10 @@ import org.eclipse.emf.cdo.common.id.CDOIDTemp;
import org.eclipse.emf.cdo.common.id.CDOIDUtil;
import org.eclipse.emf.cdo.common.io.CDODataInput;
import org.eclipse.emf.cdo.common.io.CDODataOutput;
-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.CDOClassInfo;
+import org.eclipse.emf.cdo.common.model.CDOClassifierRef;
+import org.eclipse.emf.cdo.common.model.CDOModelUtil;
+import org.eclipse.emf.cdo.common.model.CDOType;
import org.eclipse.emf.cdo.common.revision.CDOList;
import org.eclipse.emf.cdo.common.revision.CDOListFactory;
import org.eclipse.emf.cdo.common.revision.CDOReferenceAdjuster;
@@ -29,14 +30,16 @@ import org.eclipse.emf.cdo.common.revision.CDORevisionData;
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.model.InternalCDOFeature;
import org.eclipse.net4j.util.ImplementationError;
import org.eclipse.net4j.util.collection.MoveableList;
import org.eclipse.net4j.util.om.trace.ContextTracer;
import org.eclipse.net4j.util.om.trace.PerfTracer;
+import org.eclipse.emf.ecore.EClass;
+import org.eclipse.emf.ecore.EReference;
+import org.eclipse.emf.ecore.EStructuralFeature;
+
import java.io.IOException;
import java.util.Map;
@@ -52,7 +55,7 @@ public abstract class AbstractCDORevision implements InternalCDORevision
private static final PerfTracer WRITING = new PerfTracer(OM.PERF_REVISION_WRITING, AbstractCDORevision.class);
- private CDOClass cdoClass;
+ private CDOClassInfo classAdapter;
private CDOID id;
@@ -68,19 +71,19 @@ public abstract class AbstractCDORevision implements InternalCDORevision
private int containingFeatureID;
- public AbstractCDORevision(CDOClass cdoClass, CDOID id)
+ public AbstractCDORevision(EClass eClass, CDOID id)
{
- if (cdoClass.isAbstract())
+ if (eClass.isAbstract())
{
- throw new IllegalArgumentException("CDOClass is abstract: " + cdoClass);
+ throw new IllegalArgumentException("EClass is abstract: " + eClass);
}
if (CDOIDUtil.isNull(id))
{
- throw new IllegalArgumentException("CDIID is null");
+ throw new IllegalArgumentException("CDOID is null");
}
- this.cdoClass = cdoClass;
+ classAdapter = CDOModelUtil.getClassInfo(eClass);
this.id = id;
version = 0;
created = UNSPECIFIED_DATE;
@@ -88,12 +91,12 @@ public abstract class AbstractCDORevision implements InternalCDORevision
resourceID = CDOID.NULL;
containerID = CDOID.NULL;
containingFeatureID = 0;
- initValues(cdoClass.getAllFeatures().length);
+ initValues(classAdapter.getAllPersistentFeatures());
}
public AbstractCDORevision(AbstractCDORevision source)
{
- cdoClass = source.cdoClass;
+ classAdapter = source.classAdapter;
id = source.id;
version = source.version;
created = source.created;
@@ -106,7 +109,7 @@ public abstract class AbstractCDORevision implements InternalCDORevision
public AbstractCDORevision(CDODataInput in) throws IOException
{
READING.start(this);
- cdoClass = in.readCDOClassRefAndResolve();
+ classAdapter = CDOModelUtil.getClassInfo((EClass)in.readCDOClassifierRefAndResolve());
id = in.readCDOID();
version = in.readInt();
@@ -123,8 +126,8 @@ public abstract class AbstractCDORevision implements InternalCDORevision
{
TRACER
.format(
- "Reading revision: ID={0}, className={1}, version={2}, created={3}, revised={4}, resource={5}, container={6}, feature={7}",
- id, cdoClass.getName(), version, created, revised, resourceID, containerID, containingFeatureID);
+ "Reading revision: ID={0}, className={1}, version={2}, created={3}, revised={4}, resource={5}, container={6}, featureID={7}",
+ id, getEClass().getName(), version, created, revised, resourceID, containerID, containingFeatureID);
}
readValues(in);
@@ -133,18 +136,17 @@ public abstract class AbstractCDORevision implements InternalCDORevision
public void write(CDODataOutput out, int referenceChunk) throws IOException
{
- CDOClassRef classRef = cdoClass.createClassRef();
+ CDOClassifierRef classRef = new CDOClassifierRef(getEClass());
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 revision: ID={0}, className={1}, version={2}, created={3}, revised={4}, resource={5}, container={6}, featureID={7}",
+ id, getEClass().getName(), getVersion(), created, revised, resourceID, containerID, containingFeatureID);
}
WRITING.start(this);
- out.writeCDOClassRef(classRef);
+ out.writeCDOClassifierRef(classRef);
out.writeCDOID(id);
out.writeInt(getVersion());
if (!id.isTemporary())
@@ -161,9 +163,9 @@ public abstract class AbstractCDORevision implements InternalCDORevision
WRITING.stop(this);
}
- public CDOClass getCDOClass()
+ public EClass getEClass()
{
- return cdoClass;
+ return classAdapter.getEClass();
}
public CDOID getID()
@@ -269,17 +271,17 @@ public abstract class AbstractCDORevision implements InternalCDORevision
public boolean isResourceNode()
{
- return cdoClass.isResourceNode();
+ return classAdapter.isResourceNode();
}
public boolean isResourceFolder()
{
- return cdoClass.isResourceFolder();
+ return classAdapter.isResourceFolder();
}
public boolean isResource()
{
- return cdoClass.isResource();
+ return classAdapter.isResource();
}
public CDORevisionData data()
@@ -348,12 +350,12 @@ public abstract class AbstractCDORevision implements InternalCDORevision
this.containingFeatureID = containingFeatureID;
}
- public int hashCode(CDOFeature feature)
+ public int hashCode(EStructuralFeature feature)
{
return getValue(feature).hashCode();
}
- public Object get(CDOFeature feature, int index)
+ public Object get(EStructuralFeature feature, int index)
{
if (feature.isMany())
{
@@ -363,7 +365,7 @@ public abstract class AbstractCDORevision implements InternalCDORevision
return getValue(feature);
}
- public Object basicGet(CDOFeature feature, int index)
+ public Object basicGet(EStructuralFeature feature, int index)
{
if (feature.isMany())
{
@@ -373,32 +375,32 @@ public abstract class AbstractCDORevision implements InternalCDORevision
return basicGet(feature);
}
- public boolean contains(CDOFeature feature, Object value)
+ public boolean contains(EStructuralFeature feature, Object value)
{
return getList(feature).contains(value);
}
- public int indexOf(CDOFeature feature, Object value)
+ public int indexOf(EStructuralFeature feature, Object value)
{
return getList(feature).indexOf(value);
}
- public boolean isEmpty(CDOFeature feature)
+ public boolean isEmpty(EStructuralFeature feature)
{
return getList(feature).isEmpty();
}
- public int lastIndexOf(CDOFeature feature, Object value)
+ public int lastIndexOf(EStructuralFeature feature, Object value)
{
return getList(feature).lastIndexOf(value);
}
- public int size(CDOFeature feature)
+ public int size(EStructuralFeature feature)
{
return getList(feature).size();
}
- public Object[] toArray(CDOFeature feature)
+ public Object[] toArray(EStructuralFeature feature)
{
if (!feature.isMany())
{
@@ -408,7 +410,7 @@ public abstract class AbstractCDORevision implements InternalCDORevision
return getList(feature).toArray();
}
- public <T> T[] toArray(CDOFeature feature, T[] array)
+ public <T> T[] toArray(EStructuralFeature feature, T[] array)
{
if (!feature.isMany())
{
@@ -418,27 +420,27 @@ public abstract class AbstractCDORevision implements InternalCDORevision
return getList(feature).toArray(array);
}
- public void add(CDOFeature feature, int index, Object value)
+ public void add(EStructuralFeature feature, int index, Object value)
{
getList(feature).add(index, value);
}
- public void clear(CDOFeature feature)
+ public void clear(EStructuralFeature feature)
{
setValue(feature, null);
}
- public Object move(CDOFeature feature, int targetIndex, int sourceIndex)
+ public Object move(EStructuralFeature feature, int targetIndex, int sourceIndex)
{
return getList(feature).move(targetIndex, sourceIndex);
}
- public Object remove(CDOFeature feature, int index)
+ public Object remove(EStructuralFeature feature, int index)
{
return getList(feature).remove(index);
}
- public Object set(CDOFeature feature, int index, Object value)
+ public Object set(EStructuralFeature feature, int index, Object value)
{
if (feature.isMany())
{
@@ -448,7 +450,7 @@ public abstract class AbstractCDORevision implements InternalCDORevision
return setValue(feature, value);
}
- public Object basicSet(CDOFeature feature, int index, Object value)
+ public Object basicSet(EStructuralFeature feature, int index, Object value)
{
if (feature.isMany())
{
@@ -458,7 +460,7 @@ public abstract class AbstractCDORevision implements InternalCDORevision
return basicSet(feature, value);
}
- public void unset(CDOFeature feature)
+ public void unset(EStructuralFeature feature)
{
setValue(feature, null);
}
@@ -473,21 +475,26 @@ public abstract class AbstractCDORevision implements InternalCDORevision
resourceID = (CDOID)revisionAdjuster.adjustReference(resourceID);
containerID = revisionAdjuster.adjustReference(containerID);
- CDOFeature[] features = cdoClass.getAllFeatures();
+ EStructuralFeature[] features = classAdapter.getAllPersistentFeatures();
for (int i = 0; i < features.length; i++)
{
- CDOFeature feature = features[i];
- if (feature.isMany())
+ EStructuralFeature feature = features[i];
+ if (feature instanceof EReference)
{
- InternalCDOList list = (InternalCDOList)getValueAsList(i);
- if (list != null)
+ EReference reference = (EReference)feature;
+ if (reference.isMany())
{
- list.adjustReferences(revisionAdjuster, feature.getType());
+ InternalCDOList list = (InternalCDOList)getValueAsList(i);
+ if (list != null)
+ {
+ list.adjustReferences(revisionAdjuster, reference.getEReferenceType());
+ }
+ }
+ else
+ {
+ CDOType type = CDOModelUtil.getType(feature.getEType());
+ setValue(i, type.adjustReferences(revisionAdjuster, getValue(i)));
}
- }
- else
- {
- setValue(i, feature.getType().adjustReferences(revisionAdjuster, getValue(i)));
}
}
}
@@ -495,20 +502,20 @@ public abstract class AbstractCDORevision implements InternalCDORevision
@Override
public String toString()
{
- return cdoClass.getName() + "@" + id + "v" + version;
+ return getEClass().getName() + "@" + id + "v" + version;
}
- public Object getValue(CDOFeature feature)
+ public Object getValue(EStructuralFeature feature)
{
return convertValue(feature, basicGet(feature));
}
- public Object setValue(CDOFeature feature, Object value)
+ public Object setValue(EStructuralFeature feature, Object value)
{
return convertValue(feature, basicSet(feature, value));
}
- protected Object convertValue(CDOFeature feature, Object value)
+ protected Object convertValue(EStructuralFeature feature, Object value)
{
if (value == null)
{
@@ -522,52 +529,53 @@ public abstract class AbstractCDORevision implements InternalCDORevision
return value;
}
- protected Object basicGet(CDOFeature feature)
+ protected Object basicGet(EStructuralFeature feature)
{
- int featureID = cdoClass.getFeatureID(feature);
- return getValue(featureID);
+ int featureIndex = classAdapter.getFeatureIndex(feature);
+ return getValue(featureIndex);
}
- protected Object basicSet(CDOFeature feature, Object value)
+ protected Object basicSet(EStructuralFeature feature, Object value)
{
- int featureID = cdoClass.getFeatureID(feature);
+ int featureIndex = classAdapter.getFeatureIndex(feature);
try
{
- Object old = getValue(featureID);
- setValue(featureID, value);
+ Object old = getValue(featureIndex);
+ setValue(featureIndex, value);
return old;
}
catch (ArrayIndexOutOfBoundsException ex)
{
- throw new IllegalArgumentException("Could not find feature " + feature + " in class " + cdoClass, ex);
+ throw new IllegalArgumentException("Could not find feature " + feature + " in class " + classAdapter, ex);
}
}
- public CDOList getList(CDOFeature feature)
+ public CDOList getList(EStructuralFeature feature)
{
return getList(feature, 0);
}
- public CDOList getList(CDOFeature feature, int size)
+ public CDOList getList(EStructuralFeature feature, int size)
{
- int i = cdoClass.getFeatureID(feature);
- CDOList list = (CDOList)getValue(i);
+ int featureIndex = classAdapter.getFeatureIndex(feature);
+ CDOList list = (CDOList)getValue(featureIndex);
if (list == null && size != -1)
{
list = CDOListFactory.DEFAULT.createList(size, 0, 0);
- setValue(i, list);
+ setValue(featureIndex, list);
}
+
return list;
}
- public void setList(CDOFeature feature, InternalCDOList list)
+ public void setList(EStructuralFeature feature, InternalCDOList list)
{
- int i = cdoClass.getFeatureID(feature);
- setValue(i, list);
+ int featureIndex = classAdapter.getFeatureIndex(feature);
+ setValue(featureIndex, list);
}
- public void setListSize(CDOFeature feature, int size)
+ public void setListSize(EStructuralFeature feature, int size)
{
MoveableList<Object> list = getList(feature, size);
for (int j = list.size(); j < size; j++)
@@ -576,11 +584,11 @@ public abstract class AbstractCDORevision implements InternalCDORevision
}
}
- protected abstract void initValues(int size);
+ protected abstract void initValues(EStructuralFeature[] allPersistentFeatures);
- protected abstract Object getValue(int i);
+ protected abstract Object getValue(int featureIndex);
- protected abstract void setValue(int i, Object value);
+ protected abstract void setValue(int featureIndex, Object value);
private CDOList getValueAsList(int i)
{
@@ -589,21 +597,21 @@ public abstract class AbstractCDORevision implements InternalCDORevision
private void readValues(CDODataInput in) throws IOException
{
- CDOFeature[] features = cdoClass.getAllFeatures();
- initValues(features.length);
+ EStructuralFeature[] features = classAdapter.getAllPersistentFeatures();
+ initValues(features);
for (int i = 0; i < features.length; i++)
{
- CDOFeature feature = features[i];
+ EStructuralFeature feature = features[i];
if (feature.isMany())
{
setValue(i, in.readCDOList(this, feature));
}
else
{
- setValue(i, ((InternalCDOFeature)feature).readValue(in));
+ setValue(i, in.readCDOFeatureValue(feature));
if (TRACER.isEnabled())
{
- TRACER.format("Read feature {0}: {1}", feature, getValue(i));
+ TRACER.format("Read feature {0}: {1}", feature.getName(), getValue(i));
}
}
}
@@ -611,10 +619,10 @@ public abstract class AbstractCDORevision implements InternalCDORevision
private void writeValues(CDODataOutput out, int referenceChunk) throws IOException
{
- CDOFeature[] features = cdoClass.getAllFeatures();
+ EStructuralFeature[] features = classAdapter.getAllPersistentFeatures();
for (int i = 0; i < features.length; i++)
{
- CDOFeature feature = features[i];
+ EStructuralFeature feature = features[i];
if (feature.isMany())
{
out.writeCDOList(getValueAsList(i), feature, referenceChunk);
@@ -622,17 +630,17 @@ public abstract class AbstractCDORevision implements InternalCDORevision
else
{
Object value = getValue(i);
- if (value != null && feature.isReference())
+ if (value != null && feature instanceof EReference)
{
value = out.getIDProvider().provideCDOID(value);
}
if (TRACER.isEnabled())
{
- TRACER.format("Writing feature {0}: {1}", feature, value);
+ TRACER.format("Writing feature {0}: {1}", feature.getName(), value);
}
- ((InternalCDOFeature)feature).writeValue(out, value);
+ out.writeCDOFeatureValue(value, feature);
}
}
}
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/spi/common/revision/CDORevisionMerger.java
index 3e95b6945e..602584c615 100644
--- 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/spi/common/revision/CDORevisionMerger.java
@@ -10,7 +10,7 @@
* Eike Stepper - maintenance
* Simon McDuff - http://bugs.eclipse.org/213402
*/
-package org.eclipse.emf.cdo.internal.common.revision.delta;
+package org.eclipse.emf.cdo.spi.common.revision;
import org.eclipse.emf.cdo.common.revision.delta.CDOAddFeatureDelta;
import org.eclipse.emf.cdo.common.revision.delta.CDOClearFeatureDelta;
@@ -20,7 +20,7 @@ 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.revision.InternalCDORevision;
+import org.eclipse.emf.cdo.internal.common.revision.delta.CDOFeatureDeltaVisitorImpl;
/**
* @author Simon McDuff
diff --git a/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/spi/common/revision/InternalCDOList.java b/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/spi/common/revision/InternalCDOList.java
index 39ad8b15a9..088a56e383 100644
--- a/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/spi/common/revision/InternalCDOList.java
+++ b/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/spi/common/revision/InternalCDOList.java
@@ -11,10 +11,12 @@
*/
package org.eclipse.emf.cdo.spi.common.revision;
-import org.eclipse.emf.cdo.common.model.CDOType;
import org.eclipse.emf.cdo.common.revision.CDOList;
import org.eclipse.emf.cdo.common.revision.CDOReferenceAdjuster;
+import org.eclipse.emf.ecore.EClass;
+import org.eclipse.emf.ecore.EClassifier;
+
/**
* @author Simon McDuff
* @since 2.0
@@ -24,10 +26,10 @@ public interface InternalCDOList extends CDOList
/**
* Adjusts references according to the passed adjuster and resynchronizes indexes.
*/
- public void adjustReferences(CDOReferenceAdjuster adjuster, CDOType type);
+ public void adjustReferences(CDOReferenceAdjuster adjuster, EClass classifier);
/**
* Clones the list.
*/
- public InternalCDOList clone(CDOType type);
+ public InternalCDOList clone(EClassifier classifier);
}
diff --git a/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/spi/common/revision/InternalCDORevision.java b/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/spi/common/revision/InternalCDORevision.java
index bace76c8cf..c6648f016b 100644
--- a/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/spi/common/revision/InternalCDORevision.java
+++ b/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/spi/common/revision/InternalCDORevision.java
@@ -13,13 +13,14 @@ package org.eclipse.emf.cdo.spi.common.revision;
import org.eclipse.emf.cdo.common.id.CDOID;
import org.eclipse.emf.cdo.common.io.CDODataOutput;
-import org.eclipse.emf.cdo.common.model.CDOFeature;
import org.eclipse.emf.cdo.common.revision.CDOList;
import org.eclipse.emf.cdo.common.revision.CDOReferenceAdjustable;
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.emf.ecore.EStructuralFeature;
+
import java.io.IOException;
/**
@@ -53,50 +54,50 @@ public interface InternalCDORevision extends CDORevision, CDORevisionData, CDORe
public void setContainingFeatureID(int containingFeatureID);
- public void add(CDOFeature feature, int index, Object value);
+ public void add(EStructuralFeature feature, int index, Object value);
- public void clear(CDOFeature feature);
+ public void clear(EStructuralFeature feature);
- public Object move(CDOFeature feature, int targetIndex, int sourceIndex);
+ public Object move(EStructuralFeature feature, int targetIndex, int sourceIndex);
- public Object remove(CDOFeature feature, int index);
+ public Object remove(EStructuralFeature feature, int index);
- public Object set(CDOFeature feature, int index, Object value);
+ public Object set(EStructuralFeature feature, int index, Object value);
- public void unset(CDOFeature feature);
+ public void unset(EStructuralFeature feature);
/**
* Should never return {@link InternalCDORevision#NIL}
*/
- public Object getValue(CDOFeature feature);
+ public Object getValue(EStructuralFeature feature);
- public Object setValue(CDOFeature feature, Object value);
+ public Object setValue(EStructuralFeature feature, Object value);
/**
* Use this method to retrieved {@link InternalCDORevision#NIL} object in some cases.
*
* @since 2.0
*/
- public Object basicGet(CDOFeature feature, int index);
+ public Object basicGet(EStructuralFeature feature, int index);
/**
* Use this method to retrieved {@link InternalCDORevision#NIL} object in some cases.
*/
- public Object basicSet(CDOFeature feature, int index, Object value);
+ public Object basicSet(EStructuralFeature feature, int index, Object value);
- public void setList(CDOFeature feature, InternalCDOList list);
+ public void setList(EStructuralFeature feature, InternalCDOList list);
- public CDOList getList(CDOFeature feature);
+ public CDOList getList(EStructuralFeature feature);
/**
* @param size
* the size of a new list to be created if this revision has no list so far, or -1 to skip list creation and
* return <code>null</code> in this case.
*/
- public CDOList getList(CDOFeature feature, int size);
+ public CDOList getList(EStructuralFeature feature, int size);
@Deprecated
- public void setListSize(CDOFeature feature, int size);
+ public void setListSize(EStructuralFeature feature, int size);
public void write(CDODataOutput out, int referenceChunk) throws IOException;
}
diff --git a/plugins/org.eclipse.emf.cdo.defs/src/org/eclipse/emf/cdo/defs/EDynamicPackageDef.java b/plugins/org.eclipse.emf.cdo.defs/src/org/eclipse/emf/cdo/defs/EDynamicPackageDef.java
index 1d56b2e810..cc791d2aa0 100644
--- a/plugins/org.eclipse.emf.cdo.defs/src/org/eclipse/emf/cdo/defs/EDynamicPackageDef.java
+++ b/plugins/org.eclipse.emf.cdo.defs/src/org/eclipse/emf/cdo/defs/EDynamicPackageDef.java
@@ -54,4 +54,4 @@ public interface EDynamicPackageDef extends EPackageDef
*/
void setResourceURI(String value);
-} // DynamicCDOPackageDef
+} // DynamicEPackageDef
diff --git a/plugins/org.eclipse.emf.cdo.defs/src/org/eclipse/emf/cdo/defs/EGlobalPackageDef.java b/plugins/org.eclipse.emf.cdo.defs/src/org/eclipse/emf/cdo/defs/EGlobalPackageDef.java
index 58fad1091b..e9fa656f57 100644
--- a/plugins/org.eclipse.emf.cdo.defs/src/org/eclipse/emf/cdo/defs/EGlobalPackageDef.java
+++ b/plugins/org.eclipse.emf.cdo.defs/src/org/eclipse/emf/cdo/defs/EGlobalPackageDef.java
@@ -21,4 +21,4 @@ package org.eclipse.emf.cdo.defs;
*/
public interface EGlobalPackageDef extends EPackageDef
{
-} // NativeCDOPackageDef
+} // NativeEPackageDef
diff --git a/plugins/org.eclipse.emf.cdo.defs/src/org/eclipse/emf/cdo/defs/EPackageDef.java b/plugins/org.eclipse.emf.cdo.defs/src/org/eclipse/emf/cdo/defs/EPackageDef.java
index 38000f0dce..5b60a91682 100644
--- a/plugins/org.eclipse.emf.cdo.defs/src/org/eclipse/emf/cdo/defs/EPackageDef.java
+++ b/plugins/org.eclipse.emf.cdo.defs/src/org/eclipse/emf/cdo/defs/EPackageDef.java
@@ -54,4 +54,4 @@ public interface EPackageDef extends Def
*/
void setNsURI(String value);
-} // CDOPackageDef
+} // EPackageDef
diff --git a/plugins/org.eclipse.emf.cdo.defs/src/org/eclipse/emf/cdo/defs/impl/CDODefsFactoryImpl.java b/plugins/org.eclipse.emf.cdo.defs/src/org/eclipse/emf/cdo/defs/impl/CDODefsFactoryImpl.java
index 701d71f122..cca78b3fde 100644
--- a/plugins/org.eclipse.emf.cdo.defs/src/org/eclipse/emf/cdo/defs/impl/CDODefsFactoryImpl.java
+++ b/plugins/org.eclipse.emf.cdo.defs/src/org/eclipse/emf/cdo/defs/impl/CDODefsFactoryImpl.java
@@ -209,8 +209,8 @@ public class CDODefsFactoryImpl extends EFactoryImpl implements CDODefsFactory
*/
public CDOPackageRegistryDef createCDOPackageRegistryDef()
{
- CDOPackageRegistryDefImpl cdoPackageRegistryDef = new CDOPackageRegistryDefImpl();
- return cdoPackageRegistryDef;
+ CDOPackageRegistryDefImpl ePackageRegistryDef = new CDOPackageRegistryDefImpl();
+ return ePackageRegistryDef;
}
/**
diff --git a/plugins/org.eclipse.emf.cdo.defs/src/org/eclipse/emf/cdo/defs/impl/CDODefsPackageImpl.java b/plugins/org.eclipse.emf.cdo.defs/src/org/eclipse/emf/cdo/defs/impl/CDODefsPackageImpl.java
index e10a53be43..78a2d34af2 100644
--- a/plugins/org.eclipse.emf.cdo.defs/src/org/eclipse/emf/cdo/defs/impl/CDODefsPackageImpl.java
+++ b/plugins/org.eclipse.emf.cdo.defs/src/org/eclipse/emf/cdo/defs/impl/CDODefsPackageImpl.java
@@ -93,7 +93,7 @@ public class CDODefsPackageImpl extends EPackageImpl implements CDODefsPackage
*
* @generated
*/
- private EClass cdoPackageRegistryDefEClass = null;
+ private EClass ePackageRegistryDefEClass = null;
/**
* <!-- begin-user-doc --> <!-- end-user-doc -->
@@ -378,7 +378,7 @@ public class CDODefsPackageImpl extends EPackageImpl implements CDODefsPackage
*/
public EClass getCDOPackageRegistryDef()
{
- return cdoPackageRegistryDefEClass;
+ return ePackageRegistryDefEClass;
}
/**
@@ -388,7 +388,7 @@ public class CDODefsPackageImpl extends EPackageImpl implements CDODefsPackage
*/
public EReference getCDOPackageRegistryDef_Packages()
{
- return (EReference)cdoPackageRegistryDefEClass.getEStructuralFeatures().get(0);
+ return (EReference)ePackageRegistryDefEClass.getEStructuralFeatures().get(0);
}
/**
@@ -572,8 +572,8 @@ public class CDODefsPackageImpl extends EPackageImpl implements CDODefsPackage
retryFailOverStrategyDefEClass = createEClass(RETRY_FAIL_OVER_STRATEGY_DEF);
createEAttribute(retryFailOverStrategyDefEClass, RETRY_FAIL_OVER_STRATEGY_DEF__RETRIES);
- cdoPackageRegistryDefEClass = createEClass(CDO_PACKAGE_REGISTRY_DEF);
- createEReference(cdoPackageRegistryDefEClass, CDO_PACKAGE_REGISTRY_DEF__PACKAGES);
+ ePackageRegistryDefEClass = createEClass(CDO_PACKAGE_REGISTRY_DEF);
+ createEReference(ePackageRegistryDefEClass, CDO_PACKAGE_REGISTRY_DEF__PACKAGES);
cdoEagerPackageRegistryDefEClass = createEClass(CDO_EAGER_PACKAGE_REGISTRY_DEF);
@@ -639,7 +639,7 @@ public class CDODefsPackageImpl extends EPackageImpl implements CDODefsPackage
cdoSessionDefEClass.getESuperTypes().add(theNet4jUtilDefsPackage.getDef());
failOverStrategyDefEClass.getESuperTypes().add(theNet4jUtilDefsPackage.getDef());
retryFailOverStrategyDefEClass.getESuperTypes().add(this.getFailOverStrategyDef());
- cdoPackageRegistryDefEClass.getESuperTypes().add(theNet4jUtilDefsPackage.getDef());
+ ePackageRegistryDefEClass.getESuperTypes().add(theNet4jUtilDefsPackage.getDef());
cdoEagerPackageRegistryDefEClass.getESuperTypes().add(this.getCDOPackageRegistryDef());
cdoLazyPackageRegistryDefEClass.getESuperTypes().add(this.getCDOPackageRegistryDef());
ePackageDefEClass.getESuperTypes().add(theNet4jUtilDefsPackage.getDef());
@@ -672,7 +672,7 @@ public class CDODefsPackageImpl extends EPackageImpl implements CDODefsPackage
CDOSessionDef.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, !IS_UNSETTABLE, !IS_ID, !IS_UNIQUE,
!IS_DERIVED, !IS_ORDERED);
initEReference(getCDOSessionDef_CdoPackageRegistryDef(), this.getCDOPackageRegistryDef(), null,
- "cdoPackageRegistryDef", null, 1, 1, CDOSessionDef.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE,
+ "ePackageRegistryDef", null, 1, 1, CDOSessionDef.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE,
!IS_COMPOSITE, IS_RESOLVE_PROXIES, !IS_UNSETTABLE, IS_UNIQUE, !IS_DERIVED, IS_ORDERED);
initEAttribute(getCDOSessionDef_LegacySupportEnabled(), ecorePackage.getEBoolean(), "legacySupportEnabled",
"false", 1, 1, CDOSessionDef.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, !IS_UNSETTABLE, !IS_ID,
@@ -693,7 +693,7 @@ public class CDODefsPackageImpl extends EPackageImpl implements CDODefsPackage
RetryFailOverStrategyDef.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, IS_UNSETTABLE, !IS_ID, IS_UNIQUE,
!IS_DERIVED, IS_ORDERED);
- initEClass(cdoPackageRegistryDefEClass, CDOPackageRegistryDef.class, "CDOPackageRegistryDef", !IS_ABSTRACT,
+ initEClass(ePackageRegistryDefEClass, CDOPackageRegistryDef.class, "CDOPackageRegistryDef", !IS_ABSTRACT,
!IS_INTERFACE, IS_GENERATED_INSTANCE_CLASS);
initEReference(getCDOPackageRegistryDef_Packages(), this.getEPackageDef(), null, "packages", null, 0, -1,
CDOPackageRegistryDef.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, IS_COMPOSITE, !IS_RESOLVE_PROXIES,
diff --git a/plugins/org.eclipse.emf.cdo.defs/src/org/eclipse/emf/cdo/defs/impl/CDOEagerPackageRegistryDefImpl.java b/plugins/org.eclipse.emf.cdo.defs/src/org/eclipse/emf/cdo/defs/impl/CDOEagerPackageRegistryDefImpl.java
index 6eee5dc0ca..0a2bff1189 100644
--- a/plugins/org.eclipse.emf.cdo.defs/src/org/eclipse/emf/cdo/defs/impl/CDOEagerPackageRegistryDefImpl.java
+++ b/plugins/org.eclipse.emf.cdo.defs/src/org/eclipse/emf/cdo/defs/impl/CDOEagerPackageRegistryDefImpl.java
@@ -13,9 +13,6 @@ package org.eclipse.emf.cdo.defs.impl;
import org.eclipse.emf.cdo.defs.CDODefsPackage;
import org.eclipse.emf.cdo.defs.CDOEagerPackageRegistryDef;
-import org.eclipse.emf.cdo.util.CDOUtil;
-
-import org.eclipse.emf.internal.cdo.session.CDOPackageRegistryImpl.Eager;
import org.eclipse.emf.ecore.EClass;
@@ -57,7 +54,9 @@ public class CDOEagerPackageRegistryDefImpl extends CDOPackageRegistryDefImpl im
*/
protected Object createInstance()
{
- return addPackages(CDOUtil.createEagerPackageRegistry());
+ // TODO: implement CDOEagerPackageRegistryDefImpl.createInstance()
+ throw new UnsupportedOperationException();
+ // return addPackages(CDOUtil.createEagerPackageRegistry());
}
} // EagerPackageRegistryDefImpl
diff --git a/plugins/org.eclipse.emf.cdo.defs/src/org/eclipse/emf/cdo/defs/impl/CDOLazyPackageRegistryDefImpl.java b/plugins/org.eclipse.emf.cdo.defs/src/org/eclipse/emf/cdo/defs/impl/CDOLazyPackageRegistryDefImpl.java
index f78c5f9f19..304ad6d856 100644
--- a/plugins/org.eclipse.emf.cdo.defs/src/org/eclipse/emf/cdo/defs/impl/CDOLazyPackageRegistryDefImpl.java
+++ b/plugins/org.eclipse.emf.cdo.defs/src/org/eclipse/emf/cdo/defs/impl/CDOLazyPackageRegistryDefImpl.java
@@ -13,9 +13,6 @@ package org.eclipse.emf.cdo.defs.impl;
import org.eclipse.emf.cdo.defs.CDODefsPackage;
import org.eclipse.emf.cdo.defs.CDOLazyPackageRegistryDef;
-import org.eclipse.emf.cdo.util.CDOUtil;
-
-import org.eclipse.emf.internal.cdo.session.CDOPackageRegistryImpl.Lazy;
import org.eclipse.emf.ecore.EClass;
@@ -57,6 +54,8 @@ public class CDOLazyPackageRegistryDefImpl extends CDOPackageRegistryDefImpl imp
*/
protected Object createInstance()
{
- return addPackages(CDOUtil.createLazyPackageRegistry());
+ // TODO: implement CDOLazyPackageRegistryDefImpl.createInstance()
+ throw new UnsupportedOperationException();
+ // return addPackages(CDOUtil.createLazyPackageRegistry());
}
} // LazyPackageRegistryDefImpl
diff --git a/plugins/org.eclipse.emf.cdo.defs/src/org/eclipse/emf/cdo/defs/impl/CDOPackageRegistryDefImpl.java b/plugins/org.eclipse.emf.cdo.defs/src/org/eclipse/emf/cdo/defs/impl/CDOPackageRegistryDefImpl.java
index 98b6e26aa5..0c2ef6d2e4 100644
--- a/plugins/org.eclipse.emf.cdo.defs/src/org/eclipse/emf/cdo/defs/impl/CDOPackageRegistryDefImpl.java
+++ b/plugins/org.eclipse.emf.cdo.defs/src/org/eclipse/emf/cdo/defs/impl/CDOPackageRegistryDefImpl.java
@@ -22,7 +22,6 @@ import org.eclipse.emf.common.util.EList;
import org.eclipse.emf.ecore.EClass;
import org.eclipse.emf.ecore.EPackage;
import org.eclipse.emf.ecore.InternalEObject;
-import org.eclipse.emf.ecore.impl.EPackageRegistryImpl;
import org.eclipse.emf.ecore.util.EObjectContainmentEList;
import org.eclipse.emf.ecore.util.InternalEList;
@@ -202,7 +201,9 @@ public class CDOPackageRegistryDefImpl extends DefImpl implements CDOPackageRegi
*/
protected Object createInstance()
{
- return addPackages(new EPackageRegistryImpl());
+ // TODO: implement CDOPackageRegistryDefImpl.createInstance()
+ throw new UnsupportedOperationException();
+ // return addPackages(new CDOPackageRegistryImpl());
}
/**
diff --git a/plugins/org.eclipse.emf.cdo.defs/src/org/eclipse/emf/cdo/defs/impl/CDOSessionDefImpl.java b/plugins/org.eclipse.emf.cdo.defs/src/org/eclipse/emf/cdo/defs/impl/CDOSessionDefImpl.java
index 614a97da5c..51b5c717cd 100644
--- a/plugins/org.eclipse.emf.cdo.defs/src/org/eclipse/emf/cdo/defs/impl/CDOSessionDefImpl.java
+++ b/plugins/org.eclipse.emf.cdo.defs/src/org/eclipse/emf/cdo/defs/impl/CDOSessionDefImpl.java
@@ -11,13 +11,13 @@
*/
package org.eclipse.emf.cdo.defs.impl;
+import org.eclipse.emf.cdo.common.model.CDOPackageRegistry;
import org.eclipse.emf.cdo.defs.CDODefsPackage;
import org.eclipse.emf.cdo.defs.CDOPackageRegistryDef;
import org.eclipse.emf.cdo.defs.CDOSessionDef;
import org.eclipse.emf.cdo.defs.FailOverStrategyDef;
import org.eclipse.emf.cdo.net4j.CDONet4jUtil;
import org.eclipse.emf.cdo.net4j.CDOSessionConfiguration;
-import org.eclipse.emf.cdo.session.CDOPackageRegistry;
import org.eclipse.emf.cdo.session.CDOSession;
import org.eclipse.emf.internal.cdo.session.CDOSessionConfigurationImpl;
@@ -98,7 +98,7 @@ public class CDOSessionDefImpl extends DefImpl implements CDOSessionDef
* @generated
* @ordered
*/
- protected CDOPackageRegistryDef cdoPackageRegistryDef;
+ protected CDOPackageRegistryDef ePackageRegistryDef;
/**
* The default value of the '{@link #isLegacySupportEnabled() <em>Legacy Support Enabled</em>}' attribute. <!--
@@ -285,18 +285,18 @@ public class CDOSessionDefImpl extends DefImpl implements CDOSessionDef
*/
public CDOPackageRegistryDef getCdoPackageRegistryDef()
{
- if (cdoPackageRegistryDef != null && cdoPackageRegistryDef.eIsProxy())
+ if (ePackageRegistryDef != null && ePackageRegistryDef.eIsProxy())
{
- InternalEObject oldCdoPackageRegistryDef = (InternalEObject)cdoPackageRegistryDef;
- cdoPackageRegistryDef = (CDOPackageRegistryDef)eResolveProxy(oldCdoPackageRegistryDef);
- if (cdoPackageRegistryDef != oldCdoPackageRegistryDef)
+ InternalEObject oldCdoPackageRegistryDef = (InternalEObject)ePackageRegistryDef;
+ ePackageRegistryDef = (CDOPackageRegistryDef)eResolveProxy(oldCdoPackageRegistryDef);
+ if (ePackageRegistryDef != oldCdoPackageRegistryDef)
{
if (eNotificationRequired())
eNotify(new ENotificationImpl(this, Notification.RESOLVE,
- CDODefsPackage.CDO_SESSION_DEF__CDO_PACKAGE_REGISTRY_DEF, oldCdoPackageRegistryDef, cdoPackageRegistryDef));
+ CDODefsPackage.CDO_SESSION_DEF__CDO_PACKAGE_REGISTRY_DEF, oldCdoPackageRegistryDef, ePackageRegistryDef));
}
}
- return cdoPackageRegistryDef;
+ return ePackageRegistryDef;
}
/**
@@ -306,7 +306,7 @@ public class CDOSessionDefImpl extends DefImpl implements CDOSessionDef
*/
public CDOPackageRegistryDef basicGetCdoPackageRegistryDef()
{
- return cdoPackageRegistryDef;
+ return ePackageRegistryDef;
}
/**
@@ -316,11 +316,11 @@ public class CDOSessionDefImpl extends DefImpl implements CDOSessionDef
*/
public void setCdoPackageRegistryDef(CDOPackageRegistryDef newCdoPackageRegistryDef)
{
- CDOPackageRegistryDef oldCdoPackageRegistryDef = cdoPackageRegistryDef;
- cdoPackageRegistryDef = newCdoPackageRegistryDef;
+ CDOPackageRegistryDef oldCdoPackageRegistryDef = ePackageRegistryDef;
+ ePackageRegistryDef = newCdoPackageRegistryDef;
if (eNotificationRequired())
eNotify(new ENotificationImpl(this, Notification.SET, CDODefsPackage.CDO_SESSION_DEF__CDO_PACKAGE_REGISTRY_DEF,
- oldCdoPackageRegistryDef, cdoPackageRegistryDef));
+ oldCdoPackageRegistryDef, ePackageRegistryDef));
}
/**
@@ -545,7 +545,7 @@ public class CDOSessionDefImpl extends DefImpl implements CDOSessionDef
return REPOSITORY_NAME_EDEFAULT == null ? repositoryName != null : !REPOSITORY_NAME_EDEFAULT
.equals(repositoryName);
case CDODefsPackage.CDO_SESSION_DEF__CDO_PACKAGE_REGISTRY_DEF:
- return cdoPackageRegistryDef != null;
+ return ePackageRegistryDef != null;
case CDODefsPackage.CDO_SESSION_DEF__LEGACY_SUPPORT_ENABLED:
return legacySupportEnabled != LEGACY_SUPPORT_ENABLED_EDEFAULT;
case CDODefsPackage.CDO_SESSION_DEF__FAIL_OVER_STRATEGY_DEF:
diff --git a/plugins/org.eclipse.emf.cdo.defs/src/org/eclipse/emf/cdo/defs/impl/EDynamicPackageDefImpl.java b/plugins/org.eclipse.emf.cdo.defs/src/org/eclipse/emf/cdo/defs/impl/EDynamicPackageDefImpl.java
index f01c12f92c..b550865ad6 100644
--- a/plugins/org.eclipse.emf.cdo.defs/src/org/eclipse/emf/cdo/defs/impl/EDynamicPackageDefImpl.java
+++ b/plugins/org.eclipse.emf.cdo.defs/src/org/eclipse/emf/cdo/defs/impl/EDynamicPackageDefImpl.java
@@ -201,4 +201,4 @@ public class EDynamicPackageDefImpl extends EPackageDefImpl implements EDynamicP
CheckUtil.checkState(eIsSet(CDODefsPackage.EDYNAMIC_PACKAGE_DEF__RESOURCE_URI), "resource uri not set!");
}
-} // DynamicCDOPackageDefImpl
+} // DynamicEPackageDefImpl
diff --git a/plugins/org.eclipse.emf.cdo.defs/src/org/eclipse/emf/cdo/defs/impl/EPackageDefImpl.java b/plugins/org.eclipse.emf.cdo.defs/src/org/eclipse/emf/cdo/defs/impl/EPackageDefImpl.java
index 15d960cdc9..4e897a8b76 100644
--- a/plugins/org.eclipse.emf.cdo.defs/src/org/eclipse/emf/cdo/defs/impl/EPackageDefImpl.java
+++ b/plugins/org.eclipse.emf.cdo.defs/src/org/eclipse/emf/cdo/defs/impl/EPackageDefImpl.java
@@ -195,4 +195,4 @@ public abstract class EPackageDefImpl extends DefImpl implements EPackageDef
&& URI.create(getNsURI()) != null, "nsURI not set or not valid!");
}
-} // CDOPackageDefImpl
+} // EPackageDefImpl
diff --git a/plugins/org.eclipse.emf.cdo.defs/src/org/eclipse/emf/cdo/defs/util/CDODefsSwitch.java b/plugins/org.eclipse.emf.cdo.defs/src/org/eclipse/emf/cdo/defs/util/CDODefsSwitch.java
index 7dc1d8f1f2..b3979db997 100644
--- a/plugins/org.eclipse.emf.cdo.defs/src/org/eclipse/emf/cdo/defs/util/CDODefsSwitch.java
+++ b/plugins/org.eclipse.emf.cdo.defs/src/org/eclipse/emf/cdo/defs/util/CDODefsSwitch.java
@@ -178,10 +178,10 @@ public class CDODefsSwitch<T>
}
case CDODefsPackage.CDO_PACKAGE_REGISTRY_DEF:
{
- CDOPackageRegistryDef cdoPackageRegistryDef = (CDOPackageRegistryDef)theEObject;
- T result = caseCDOPackageRegistryDef(cdoPackageRegistryDef);
+ CDOPackageRegistryDef ePackageRegistryDef = (CDOPackageRegistryDef)theEObject;
+ T result = caseCDOPackageRegistryDef(ePackageRegistryDef);
if (result == null)
- result = caseDef(cdoPackageRegistryDef);
+ result = caseDef(ePackageRegistryDef);
if (result == null)
result = defaultCase(theEObject);
return result;
diff --git a/plugins/org.eclipse.emf.cdo.defs/src/org/eclipse/emf/cdo/defs/util/CDODefsUtil.java b/plugins/org.eclipse.emf.cdo.defs/src/org/eclipse/emf/cdo/defs/util/CDODefsUtil.java
index e118794065..b707837881 100644
--- a/plugins/org.eclipse.emf.cdo.defs/src/org/eclipse/emf/cdo/defs/util/CDODefsUtil.java
+++ b/plugins/org.eclipse.emf.cdo.defs/src/org/eclipse/emf/cdo/defs/util/CDODefsUtil.java
@@ -28,36 +28,36 @@ import java.util.Date;
*/
public class CDODefsUtil
{
- public static CDOSessionDef createSessionDef(String repositoryName, CDOPackageRegistryDef cdoPackageRegistryDef,
+ public static CDOSessionDef createSessionDef(String repositoryName, CDOPackageRegistryDef ePackageRegistryDef,
TCPConnectorDef tcpConnectorDef)
{
CDOSessionDef cdoSessionDef = CDODefsFactory.eINSTANCE.createCDOSessionDef();
cdoSessionDef.setConnectorDef(tcpConnectorDef);
cdoSessionDef.setRepositoryName(repositoryName);
- cdoSessionDef.setCdoPackageRegistryDef(cdoPackageRegistryDef);
+ cdoSessionDef.setCdoPackageRegistryDef(ePackageRegistryDef);
return cdoSessionDef;
}
- public static CDOSessionDef createSessionDef(String repositoryName, CDOPackageRegistryDef cdoPackageRegistryDef,
+ public static CDOSessionDef createSessionDef(String repositoryName, CDOPackageRegistryDef ePackageRegistryDef,
FailOverStrategyDef failOverStrategyDef)
{
CDOSessionDef cdoSessionDef = CDODefsFactory.eINSTANCE.createCDOSessionDef();
cdoSessionDef.setFailOverStrategyDef(failOverStrategyDef);
cdoSessionDef.setRepositoryName(repositoryName);
- cdoSessionDef.setCdoPackageRegistryDef(cdoPackageRegistryDef);
+ cdoSessionDef.setCdoPackageRegistryDef(ePackageRegistryDef);
return cdoSessionDef;
}
public static CDOPackageRegistryDef createEagerPackageRegistryDef()
{
- CDOPackageRegistryDef cdoPackageRegistryDef = CDODefsFactory.eINSTANCE.createCDOEagerPackageRegistryDef();
- return cdoPackageRegistryDef;
+ CDOPackageRegistryDef ePackageRegistryDef = CDODefsFactory.eINSTANCE.createCDOEagerPackageRegistryDef();
+ return ePackageRegistryDef;
}
public static CDOPackageRegistryDef createLazyPackageRegistryDef()
{
- CDOPackageRegistryDef cdoPackageRegistryDef = CDODefsFactory.eINSTANCE.createCDOLazyPackageRegistryDef();
- return cdoPackageRegistryDef;
+ CDOPackageRegistryDef ePackageRegistryDef = CDODefsFactory.eINSTANCE.createCDOLazyPackageRegistryDef();
+ return ePackageRegistryDef;
}
public static CDOAuditDef createCDOAuditDef(CDOSessionDef cdoSessionDef)
diff --git a/plugins/org.eclipse.emf.cdo.edit/.settings/.api_filters b/plugins/org.eclipse.emf.cdo.edit/.settings/.api_filters
deleted file mode 100644
index bdcdcb9fb8..0000000000
--- a/plugins/org.eclipse.emf.cdo.edit/.settings/.api_filters
+++ /dev/null
@@ -1,15 +0,0 @@
-<?xml version="1.0" encoding="UTF-8" standalone="no"?>
-<component id="org.eclipse.emf.cdo.edit" version="2">
- <resource path="src/org/eclipse/emf/cdo/eresource/provider/EresourceItemProviderAdapterFactory.java" type="org.eclipse.emf.cdo.eresource.provider.EresourceItemProviderAdapterFactory">
- <filter id="1143996420">
- <message_arguments>
- <message_argument value="cdoResourceFolderItemProvider"/>
- </message_arguments>
- </filter>
- <filter id="1143996420">
- <message_arguments>
- <message_argument value="createCDOResourceFolderAdapter()"/>
- </message_arguments>
- </filter>
- </resource>
-</component>
diff --git a/plugins/org.eclipse.emf.cdo.edit/plugin.xml b/plugins/org.eclipse.emf.cdo.edit/plugin.xml
index fb1f2020c5..b22cb8e734 100644
--- a/plugins/org.eclipse.emf.cdo.edit/plugin.xml
+++ b/plugins/org.eclipse.emf.cdo.edit/plugin.xml
@@ -15,7 +15,7 @@
<extension point="org.eclipse.emf.edit.itemProviderAdapterFactories">
<factory
- uri = "http://www.eclipse.org/emf/CDO/resource/2.0.0"
+ uri = "http://www.eclipse.org/emf/CDO/Eresource/2.0.0"
class = "org.eclipse.emf.cdo.eresource.provider.EresourceItemProviderAdapterFactory"
supportedTypes =
"org.eclipse.emf.edit.provider.IEditingDomainItemProvider
diff --git a/plugins/org.eclipse.emf.cdo.edit/src/org/eclipse/emf/cdo/eresource/provider/CDOResourceFolderItemProvider.java b/plugins/org.eclipse.emf.cdo.edit/src/org/eclipse/emf/cdo/eresource/provider/CDOResourceFolderItemProvider.java
index 4839688268..8f725bf448 100644
--- a/plugins/org.eclipse.emf.cdo.edit/src/org/eclipse/emf/cdo/eresource/provider/CDOResourceFolderItemProvider.java
+++ b/plugins/org.eclipse.emf.cdo.edit/src/org/eclipse/emf/cdo/eresource/provider/CDOResourceFolderItemProvider.java
@@ -39,6 +39,13 @@ public class CDOResourceFolderItemProvider extends CDOResourceNodeItemProvider i
IStructuredItemContentProvider, ITreeItemContentProvider, IItemLabelProvider, IItemPropertySource
{
/**
+ * <!-- begin-user-doc --> <!-- end-user-doc -->
+ *
+ * @generated
+ */
+ public static final String copyright = "Copyright (c) 2004 - 2009 Eike Stepper (Berlin, Germany) and others.\r\nAll rights reserved. This program and the accompanying materials\r\nare made available under the terms of the Eclipse Public License v1.0\r\nwhich accompanies this distribution, and is available at\r\nhttp://www.eclipse.org/legal/epl-v10.html\r\n\r\nContributors:\r\n Eike Stepper - initial API and implementation";
+
+ /**
* This constructs an instance from a factory and a notifier. <!-- begin-user-doc --> <!-- end-user-doc -->
*
* @generated
diff --git a/plugins/org.eclipse.emf.cdo.edit/src/org/eclipse/emf/cdo/eresource/provider/CDOResourceItemProvider.java b/plugins/org.eclipse.emf.cdo.edit/src/org/eclipse/emf/cdo/eresource/provider/CDOResourceItemProvider.java
index af75c146f1..ae65bec250 100644
--- a/plugins/org.eclipse.emf.cdo.edit/src/org/eclipse/emf/cdo/eresource/provider/CDOResourceItemProvider.java
+++ b/plugins/org.eclipse.emf.cdo.edit/src/org/eclipse/emf/cdo/eresource/provider/CDOResourceItemProvider.java
@@ -40,6 +40,13 @@ public class CDOResourceItemProvider extends CDOResourceNodeItemProvider impleme
IStructuredItemContentProvider, ITreeItemContentProvider, IItemLabelProvider, IItemPropertySource
{
/**
+ * <!-- begin-user-doc --> <!-- end-user-doc -->
+ *
+ * @generated
+ */
+ public static final String copyright = "Copyright (c) 2004 - 2009 Eike Stepper (Berlin, Germany) and others.\r\nAll rights reserved. This program and the accompanying materials\r\nare made available under the terms of the Eclipse Public License v1.0\r\nwhich accompanies this distribution, and is available at\r\nhttp://www.eclipse.org/legal/epl-v10.html\r\n\r\nContributors:\r\n Eike Stepper - initial API and implementation";
+
+ /**
* This constructs an instance from a factory and a notifier. <!-- begin-user-doc --> <!-- end-user-doc -->
*
* @generated
diff --git a/plugins/org.eclipse.emf.cdo.edit/src/org/eclipse/emf/cdo/eresource/provider/CDOResourceNodeItemProvider.java b/plugins/org.eclipse.emf.cdo.edit/src/org/eclipse/emf/cdo/eresource/provider/CDOResourceNodeItemProvider.java
index 5f98e609ac..b0caaaceb5 100644
--- a/plugins/org.eclipse.emf.cdo.edit/src/org/eclipse/emf/cdo/eresource/provider/CDOResourceNodeItemProvider.java
+++ b/plugins/org.eclipse.emf.cdo.edit/src/org/eclipse/emf/cdo/eresource/provider/CDOResourceNodeItemProvider.java
@@ -42,6 +42,13 @@ public class CDOResourceNodeItemProvider extends ItemProviderAdapter implements
IStructuredItemContentProvider, ITreeItemContentProvider, IItemLabelProvider, IItemPropertySource
{
/**
+ * <!-- begin-user-doc --> <!-- end-user-doc -->
+ *
+ * @generated
+ */
+ public static final String copyright = "Copyright (c) 2004 - 2009 Eike Stepper (Berlin, Germany) and others.\r\nAll rights reserved. This program and the accompanying materials\r\nare made available under the terms of the Eclipse Public License v1.0\r\nwhich accompanies this distribution, and is available at\r\nhttp://www.eclipse.org/legal/epl-v10.html\r\n\r\nContributors:\r\n Eike Stepper - initial API and implementation";
+
+ /**
* This constructs an instance from a factory and a notifier. <!-- begin-user-doc --> <!-- end-user-doc -->
*
* @generated
diff --git a/plugins/org.eclipse.emf.cdo.edit/src/org/eclipse/emf/cdo/eresource/provider/EresourceEditPlugin.java b/plugins/org.eclipse.emf.cdo.edit/src/org/eclipse/emf/cdo/eresource/provider/EresourceEditPlugin.java
index 0cb8abbc7b..f314588f45 100644
--- a/plugins/org.eclipse.emf.cdo.edit/src/org/eclipse/emf/cdo/eresource/provider/EresourceEditPlugin.java
+++ b/plugins/org.eclipse.emf.cdo.edit/src/org/eclipse/emf/cdo/eresource/provider/EresourceEditPlugin.java
@@ -22,6 +22,13 @@ import org.eclipse.emf.ecore.provider.EcoreEditPlugin;
public final class EresourceEditPlugin extends EMFPlugin
{
/**
+ * <!-- begin-user-doc --> <!-- end-user-doc -->
+ *
+ * @generated
+ */
+ public static final String copyright = "Copyright (c) 2004 - 2009 Eike Stepper (Berlin, Germany) and others.\r\nAll rights reserved. This program and the accompanying materials\r\nare made available under the terms of the Eclipse Public License v1.0\r\nwhich accompanies this distribution, and is available at\r\nhttp://www.eclipse.org/legal/epl-v10.html\r\n\r\nContributors:\r\n Eike Stepper - initial API and implementation";
+
+ /**
* Keep track of the singleton. <!-- begin-user-doc --> <!-- end-user-doc -->
*
* @generated
diff --git a/plugins/org.eclipse.emf.cdo.edit/src/org/eclipse/emf/cdo/eresource/provider/EresourceItemProviderAdapterFactory.java b/plugins/org.eclipse.emf.cdo.edit/src/org/eclipse/emf/cdo/eresource/provider/EresourceItemProviderAdapterFactory.java
index 663d6b4e79..16616287b6 100644
--- a/plugins/org.eclipse.emf.cdo.edit/src/org/eclipse/emf/cdo/eresource/provider/EresourceItemProviderAdapterFactory.java
+++ b/plugins/org.eclipse.emf.cdo.edit/src/org/eclipse/emf/cdo/eresource/provider/EresourceItemProviderAdapterFactory.java
@@ -48,6 +48,13 @@ public class EresourceItemProviderAdapterFactory extends EresourceAdapterFactory
IChangeNotifier, IDisposable, IChildCreationExtender
{
/**
+ * <!-- begin-user-doc --> <!-- end-user-doc -->
+ *
+ * @generated
+ */
+ public static final String copyright = "Copyright (c) 2004 - 2009 Eike Stepper (Berlin, Germany) and others.\r\nAll rights reserved. This program and the accompanying materials\r\nare made available under the terms of the Eclipse Public License v1.0\r\nwhich accompanies this distribution, and is available at\r\nhttp://www.eclipse.org/legal/epl-v10.html\r\n\r\nContributors:\r\n Eike Stepper - initial API and implementation";
+
+ /**
* This keeps track of the root adapter factory that delegates to this adapter factory. <!-- begin-user-doc --> <!--
* end-user-doc -->
*
@@ -197,7 +204,7 @@ public class EresourceItemProviderAdapterFactory extends EresourceAdapterFactory
if (isFactoryForType(type))
{
Object adapter = super.adapt(object, type);
- if (!(type instanceof Class<?>) || ((Class<?>)type).isInstance(adapter))
+ if (!(type instanceof Class<?>) || (((Class<?>)type).isInstance(adapter)))
{
return adapter;
}
@@ -280,13 +287,9 @@ public class EresourceItemProviderAdapterFactory extends EresourceAdapterFactory
public void dispose()
{
if (cdoResourceFolderItemProvider != null)
- {
cdoResourceFolderItemProvider.dispose();
- }
if (cdoResourceItemProvider != null)
- {
cdoResourceItemProvider.dispose();
- }
}
}
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
index 99511812bf..51ca5023cf 100644
--- a/plugins/org.eclipse.emf.cdo.server.db/META-INF/MANIFEST.MF
+++ b/plugins/org.eclipse.emf.cdo.server.db/META-INF/MANIFEST.MF
@@ -13,6 +13,8 @@ Require-Bundle: org.eclipse.core.runtime;bundle-version="[3.4.0,4.0.0)",
org.eclipse.net4j.db;bundle-version="[2.0.0,3.0.0)";visibility:=reexport,
org.eclipse.emf.cdo.server;bundle-version="[2.0.0,3.0.0)";visibility:=reexport
Export-Package: org.eclipse.emf.cdo.server.db;version="2.0.0",
+ org.eclipse.emf.cdo.server.db.mapping;version="2.0.0",
org.eclipse.emf.cdo.server.internal.db;version="2.0.0";x-friends:="org.eclipse.emf.cdo.tests",
org.eclipse.emf.cdo.server.internal.db.bundle;version="2.0.0";x-internal:=true,
- org.eclipse.emf.cdo.server.internal.db.jdbc;version="2.0.0";x-friends:="org.eclipse.emf.cdo.tests"
+ org.eclipse.emf.cdo.server.internal.db.jdbc;version="2.0.0";x-friends:="org.eclipse.emf.cdo.tests",
+ org.eclipse.emf.cdo.server.internal.db.mapping;version="2.0.0";x-friends:="org.eclipse.emf.cdo.tests"
diff --git a/plugins/org.eclipse.emf.cdo.server.db/plugin.xml b/plugins/org.eclipse.emf.cdo.server.db/plugin.xml
index 64e6d0d1bd..acd168a01a 100644
--- a/plugins/org.eclipse.emf.cdo.server.db/plugin.xml
+++ b/plugins/org.eclipse.emf.cdo.server.db/plugin.xml
@@ -27,11 +27,11 @@
<extension
point="org.eclipse.emf.cdo.server.db.mappingStrategies">
<mappingStrategy
- class="org.eclipse.emf.cdo.server.internal.db.HorizontalMappingStrategy"
+ class="org.eclipse.emf.cdo.server.internal.db.mapping.HorizontalMappingStrategy"
type="horizontal">
</mappingStrategy>
<mappingStrategy
- class="org.eclipse.emf.cdo.server.internal.db.VerticalMappingStrategy"
+ class="org.eclipse.emf.cdo.server.internal.db.mapping.VerticalMappingStrategy"
type="vertical">
</mappingStrategy>
</extension>
diff --git a/plugins/org.eclipse.emf.cdo.server.db/src/org/eclipse/emf/cdo/server/db/CDODBUtil.java b/plugins/org.eclipse.emf.cdo.server.db/src/org/eclipse/emf/cdo/server/db/CDODBUtil.java
index 173320bd1a..b589142628 100644
--- a/plugins/org.eclipse.emf.cdo.server.db/src/org/eclipse/emf/cdo/server/db/CDODBUtil.java
+++ b/plugins/org.eclipse.emf.cdo.server.db/src/org/eclipse/emf/cdo/server/db/CDODBUtil.java
@@ -10,11 +10,12 @@
*/
package org.eclipse.emf.cdo.server.db;
+import org.eclipse.emf.cdo.server.db.mapping.IMappingStrategy;
import org.eclipse.emf.cdo.server.internal.db.DBStore;
-import org.eclipse.emf.cdo.server.internal.db.HorizontalMappingStrategy;
import org.eclipse.emf.cdo.server.internal.db.bundle.OM;
import org.eclipse.emf.cdo.server.internal.db.jdbc.PreparedStatementJDBCDelegateProvider;
import org.eclipse.emf.cdo.server.internal.db.jdbc.StatementJDBCDelegateProvider;
+import org.eclipse.emf.cdo.server.internal.db.mapping.HorizontalMappingStrategy;
import org.eclipse.net4j.db.IDBAdapter;
import org.eclipse.net4j.db.IDBConnectionProvider;
diff --git a/plugins/org.eclipse.emf.cdo.server.db/src/org/eclipse/emf/cdo/server/db/IDBStore.java b/plugins/org.eclipse.emf.cdo.server.db/src/org/eclipse/emf/cdo/server/db/IDBStore.java
index 53a21b436e..3533af0b99 100644
--- a/plugins/org.eclipse.emf.cdo.server.db/src/org/eclipse/emf/cdo/server/db/IDBStore.java
+++ b/plugins/org.eclipse.emf.cdo.server.db/src/org/eclipse/emf/cdo/server/db/IDBStore.java
@@ -10,12 +10,17 @@
*/
package org.eclipse.emf.cdo.server.db;
+import org.eclipse.emf.cdo.server.ISession;
import org.eclipse.emf.cdo.server.IStore;
+import org.eclipse.emf.cdo.server.ITransaction;
+import org.eclipse.emf.cdo.server.db.mapping.IMappingStrategy;
import org.eclipse.net4j.db.IDBAdapter;
import org.eclipse.net4j.db.IDBConnectionProvider;
import org.eclipse.net4j.db.ddl.IDBSchema;
+import org.eclipse.emf.ecore.EModelElement;
+
/**
* @author Eike Stepper
* @noimplement This interface is not intended to be implemented by clients.
@@ -29,4 +34,12 @@ public interface IDBStore extends IStore
public IDBAdapter getDBAdapter();
public IDBConnectionProvider getDBConnectionProvider();
+
+ public long getMetaID(EModelElement modelElement);
+
+ public EModelElement getMetaInstance(long id);
+
+ public IDBStoreAccessor getReader(ISession session);
+
+ public IDBStoreAccessor getWriter(ITransaction transaction);
}
diff --git a/plugins/org.eclipse.emf.cdo.server.db/src/org/eclipse/emf/cdo/server/db/IDBStoreAccessor.java b/plugins/org.eclipse.emf.cdo.server.db/src/org/eclipse/emf/cdo/server/db/IDBStoreAccessor.java
index 5f4ec2d368..53eeb07cfd 100644
--- a/plugins/org.eclipse.emf.cdo.server.db/src/org/eclipse/emf/cdo/server/db/IDBStoreAccessor.java
+++ b/plugins/org.eclipse.emf.cdo.server.db/src/org/eclipse/emf/cdo/server/db/IDBStoreAccessor.java
@@ -10,7 +10,6 @@
*/
package org.eclipse.emf.cdo.server.db;
-import org.eclipse.emf.cdo.common.model.CDOClassRef;
import org.eclipse.emf.cdo.server.IStoreAccessor;
/**
@@ -24,10 +23,5 @@ public interface IDBStoreAccessor extends IStoreAccessor
/**
* @since 2.0
*/
- public CDOClassRef readClassRef(int classID);
-
- /**
- * @since 2.0
- */
public IJDBCDelegate getJDBCDelegate();
}
diff --git a/plugins/org.eclipse.emf.cdo.server.db/src/org/eclipse/emf/cdo/server/db/IJDBCDelegate.java b/plugins/org.eclipse.emf.cdo.server.db/src/org/eclipse/emf/cdo/server/db/IJDBCDelegate.java
index a7327db0f8..e456e1fc40 100644
--- a/plugins/org.eclipse.emf.cdo.server.db/src/org/eclipse/emf/cdo/server/db/IJDBCDelegate.java
+++ b/plugins/org.eclipse.emf.cdo.server.db/src/org/eclipse/emf/cdo/server/db/IJDBCDelegate.java
@@ -8,19 +8,23 @@
* Contributors:
* Stefan Winkler - initial API and implementation
* Eike Stepper - maintenance
+ * Stefan Winkler - https://bugs.eclipse.org/bugs/show_bug.cgi?id=259402
*/
package org.eclipse.emf.cdo.server.db;
import org.eclipse.emf.cdo.common.id.CDOID;
-import org.eclipse.emf.cdo.common.revision.CDORevision;
import org.eclipse.emf.cdo.server.IStoreAccessor;
import org.eclipse.emf.cdo.server.IStoreChunkReader.Chunk;
+import org.eclipse.emf.cdo.server.db.mapping.IAttributeMapping;
+import org.eclipse.emf.cdo.server.db.mapping.IClassMapping;
+import org.eclipse.emf.cdo.server.db.mapping.IReferenceMapping;
import org.eclipse.emf.cdo.server.internal.db.jdbc.AbstractJDBCDelegate;
+import org.eclipse.emf.cdo.spi.common.revision.InternalCDORevision;
import org.eclipse.net4j.db.IDBConnectionProvider;
+import org.eclipse.net4j.util.collection.Pair;
import org.eclipse.net4j.util.om.monitor.OMMonitor;
-import java.sql.Connection;
import java.sql.PreparedStatement;
import java.sql.Statement;
import java.util.List;
@@ -33,37 +37,73 @@ import java.util.List;
* @noimplement This interface is not intended to be implemented by clients. Please extend the abstract class
* {@link AbstractJDBCDelegate} instead.
*/
-public interface IJDBCDelegate
+public interface IJDBCDelegate extends IDBConnectionProvider
{
+ // --------------------------------------------------------------
+ // General methods
+ // --------------------------------------------------------------
+
/**
- * Insert a reference row.
+ * Get the one omnipresent statement object of this JDBC delegate
*/
- public void insertReference(CDORevision sourceRevision, int index, CDOID targetId, IReferenceMapping referenceMapping);
+ public Statement getStatement();
/**
- * Delete all reference rows of a cdoid.
+ * Get a prepared statement. The caller is responsible of closing it.
*/
- public void deleteReferences(CDOID id, IReferenceMapping referenceMapping);
+ public PreparedStatement getPreparedStatement(String sql);
+
+ public void setStoreAccessor(IDBStoreAccessor storeAccessor);
+
+ /**
+ * Do any outstanding writes (e.g. execute batches). Called any number of times - but at least once immediately before
+ * commit().
+ *
+ * @see IStoreAccessor#write(org.eclipse.emf.cdo.server.IStoreAccessor.CommitContext, OMMonitor)
+ */
+ public void flush(OMMonitor monitor);
+
+ /**
+ * Do a commit on the JDBC connection.
+ */
+ public void commit(OMMonitor monitor);
+
+ /**
+ * Do a rollback on the JDBC connection.
+ */
+ public void rollback();
+
+ // --------------------------------------------------------------
+ // Writing Revisions / Attributes
+ // --------------------------------------------------------------
/**
* Insert an attribute row.
*/
- public void insertAttributes(CDORevision revision, IClassMapping classMapping);
+ public void insertAttributes(InternalCDORevision revision, IClassMapping classMapping);
/**
* Update an attribute row.
*/
- public void updateAttributes(CDORevision revision, IClassMapping classMapping);
+ public void updateAttributes(InternalCDORevision revision, IClassMapping classMapping);
/**
- * Remove an attribute row.
+ * Update an attribute row.
*/
- public void deleteAttributes(CDOID id, IClassMapping classMapping);
+ public void updateAttributes(CDOID id, int newVersion, long created,
+ List<Pair<IAttributeMapping, Object>> attributeChanges, IClassMapping classMapping);
+
+ /**
+ * Update an attribute row (including containment and resource attributes).
+ */
+ public void updateAttributes(CDOID id, int newVersion, long created, CDOID newContainerId,
+ int newContainingFeatureId, CDOID newResourceId, List<Pair<IAttributeMapping, Object>> attributeChanges,
+ IClassMapping classMapping);
/**
* Set the revised date of a specific revision's previous version.
*/
- public void updateRevisedForReplace(CDORevision revision, IClassMapping classMapping);
+ public void updateRevisedForReplace(InternalCDORevision revision, IClassMapping classMapping);
/**
* Set the revised date of all unrevised rows of cdoid
@@ -71,66 +111,71 @@ public interface IJDBCDelegate
public void updateRevisedForDetach(CDOID id, long revised, IClassMapping classMapping);
/**
- * Select a revision's attributes
- *
- * @return <code>true</code> if the revision attributes have been successfully loaded.<br>
- * <code>false</code> if the revision does not exist in the database.
+ * Remove an attribute row.
*/
- public boolean selectRevisionAttributes(CDORevision revision, IClassMapping classMapping, String where);
+ public void deleteAttributes(CDOID id, IClassMapping classMapping);
+
+ // --------------------------------------------------------------
+ // Writing References
+ // --------------------------------------------------------------
/**
- * Select a revision's references (or a part thereof)
+ * Insert a reference row.
*/
- public void selectRevisionReferences(CDORevision revision, IReferenceMapping referenceMapping, int referenceChunk);
+ public void insertReference(CDOID id, int version, int index, CDOID targetId, IReferenceMapping referenceMapping);
/**
- * Select a revision's reference's chunks
+ * Insert a reference row shifting all subsequent indices one position up.
*/
- public void selectRevisionReferenceChunks(IDBStoreChunkReader chunkReader, List<Chunk> chunks,
- IReferenceMapping referenceMapping, String where);
+ public void insertReferenceRow(CDOID id, int newVersion, int index, CDOID value, IReferenceMapping referenceMapping);
/**
- * Get the connection object of this JDBC delegate
+ * Move one reference row shifting all subsequent indices in between accordingly.
*/
- public Connection getConnection();
+ public void moveReferenceRow(CDOID id, int newVersion, int oldPosition, int newPosition,
+ IReferenceMapping referenceMapping);
/**
- * Get the one omnipresent statement object of this JDBC delegate
+ * Remove a reference row shifting all subsequent indices one position down.
*/
- public Statement getStatement();
+ public void removeReferenceRow(CDOID id, int index, int newVersion, IReferenceMapping referenceMapping);
/**
- * Do any outstanding writes (e.g. execute batches). Called any number of times - but at least once immediately before
- * commit().
- *
- * @see IStoreAccessor#write(org.eclipse.emf.cdo.server.IStoreAccessor.CommitContext, OMMonitor)
+ * Update the value of a reference row.
*/
- public void flush(OMMonitor monitor);
+ public void updateReference(CDOID id, int newVersion, int index, CDOID value, IReferenceMapping referenceMapping);
/**
- * Do a commit on the JDBC connection.
+ * Delete all reference rows of a cdoid.
*/
- public void commit(OMMonitor monitor);
+ public void deleteReferences(CDOID id, IReferenceMapping referenceMapping);
/**
- * Do a rollback on the JDBC connection.
+ * Update the version number of all references of a CDOID to newVersion.
*/
- public void rollback();
+ public void updateReferenceVersion(CDOID id, int newVersion, IReferenceMapping referenceMapping);
+
+ // --------------------------------------------------------------
+ // Reading
+ // --------------------------------------------------------------
/**
- * Get a prepared statement. The caller is responsible of closing it.
+ * Select a revision's attributes
+ *
+ * @return <code>true</code> if the revision attributes have been successfully loaded.<br>
+ * <code>false</code> if the revision does not exist in the database.
*/
- public PreparedStatement getPreparedStatement(String sql);
+ public boolean selectRevisionAttributes(InternalCDORevision revision, IClassMapping classMapping, String where);
/**
- * Set a connection provider to provide the delegate with the DB connection. This may only be called before
- * activation.
+ * Select a revision's references (or a part thereof)
*/
- public void setConnectionProvider(IDBConnectionProvider connectionProvider);
+ public void selectRevisionReferences(InternalCDORevision revision, IReferenceMapping referenceMapping,
+ int referenceChunk);
/**
- * Set a flag indicating that this delegate maintains a read-only DB connection. This may only be called before
- * activation.
+ * Select a revision's reference's chunks
*/
- public void setReadOnly(boolean reader);
+ public void selectRevisionReferenceChunks(IDBStoreChunkReader chunkReader, List<Chunk> chunks,
+ IReferenceMapping referenceMapping, String where);
}
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
index 77eb3fbf5b..152eb82ca8 100644
--- 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
@@ -11,8 +11,9 @@
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.emf.cdo.common.model.CDOClassifierRef;
+
+import org.eclipse.emf.ecore.EClass;
/**
* @author Eike Stepper
@@ -22,12 +23,12 @@ public interface IObjectTypeCache
/**
* @since 2.0
*/
- public CDOClassRef getObjectType(IDBStoreAccessor accessor, CDOID id);
+ public CDOClassifierRef getObjectType(IDBStoreAccessor accessor, CDOID id);
/**
* @since 2.0
*/
- public void putObjectType(IDBStoreAccessor accessor, CDOID id, CDOClass type);
+ public void putObjectType(IDBStoreAccessor accessor, CDOID id, EClass type);
/**
* @since 2.0
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
deleted file mode 100644
index d20f18fba7..0000000000
--- a/plugins/org.eclipse.emf.cdo.server.db/src/org/eclipse/emf/cdo/server/db/IReferenceMapping.java
+++ /dev/null
@@ -1,49 +0,0 @@
-/**
- * Copyright (c) 2004 - 2009 Eike Stepper (Berlin, Germany) and others.
- * 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.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();
-
- /**
- * @since 2.0
- */
- public boolean isWithFeature();
-
- /**
- * @since 2.0
- */
- public void writeReference(IDBStoreAccessor accessor, CDORevision revision);
-
- /**
- * @since 2.0
- */
- public void readReference(IDBStoreAccessor accessor, CDORevision revision, int referenceChunk);
-
- public void readChunks(IDBStoreChunkReader chunkReader, List<Chunk> chunks, String string);
-
- /**
- * @since 2.0
- */
- public void deleteReference(IDBStoreAccessor accessor, CDOID id);
-}
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/mapping/IAttributeMapping.java
index 7e4e659c04..cf3c424313 100644
--- 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/mapping/IAttributeMapping.java
@@ -7,10 +7,11 @@
*
* Contributors:
* Eike Stepper - initial API and implementation
+ * Stefan Winkler - https://bugs.eclipse.org/bugs/show_bug.cgi?id=259402
*/
-package org.eclipse.emf.cdo.server.db;
+package org.eclipse.emf.cdo.server.db.mapping;
-import org.eclipse.emf.cdo.common.revision.CDORevision;
+import org.eclipse.emf.cdo.spi.common.revision.InternalCDORevision;
import org.eclipse.net4j.db.ddl.IDBField;
@@ -26,15 +27,20 @@ public interface IAttributeMapping extends IFeatureMapping
/**
* @since 2.0
*/
- public void appendValue(StringBuilder builder, CDORevision revision);
+ public void appendValue(StringBuilder builder, InternalCDORevision revision);
/**
* @since 2.0
*/
- public void extractValue(ResultSet resultSet, int column, CDORevision revision);
+ public void appendValue(StringBuilder builder, Object value);
/**
* @since 2.0
*/
- public Object getRevisionValue(CDORevision revision);
+ public void extractValue(ResultSet resultSet, int column, InternalCDORevision revision);
+
+ /**
+ * @since 2.0
+ */
+ public Object getRevisionValue(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/mapping/IClassMapping.java
index 9c54482560..dc671ccd6a 100644
--- 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/mapping/IClassMapping.java
@@ -7,17 +7,21 @@
*
* Contributors:
* Eike Stepper - initial API and implementation
+ * Stefan Winkler - https://bugs.eclipse.org/bugs/show_bug.cgi?id=259402
*/
-package org.eclipse.emf.cdo.server.db;
+package org.eclipse.emf.cdo.server.db.mapping;
import org.eclipse.emf.cdo.common.id.CDOID;
-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.IDBStoreAccessor;
+import org.eclipse.emf.cdo.spi.common.revision.InternalCDORevision;
+import org.eclipse.emf.cdo.spi.common.revision.InternalCDORevisionDelta;
import org.eclipse.net4j.db.ddl.IDBTable;
import org.eclipse.net4j.util.om.monitor.OMMonitor;
+import org.eclipse.emf.ecore.EClass;
+import org.eclipse.emf.ecore.EStructuralFeature;
+
import java.util.List;
import java.util.Set;
@@ -28,7 +32,7 @@ public interface IClassMapping
{
public IMappingStrategy getMappingStrategy();
- public CDOClass getCDOClass();
+ public EClass getEClass();
public IDBTable getTable();
@@ -42,20 +46,26 @@ public interface IClassMapping
/**
* @since 2.0
*/
- public IFeatureMapping getFeatureMapping(CDOFeature feature);
+ public IFeatureMapping getFeatureMapping(EStructuralFeature feature);
public List<IAttributeMapping> getAttributeMappings();
public List<IReferenceMapping> getReferenceMappings();
- public IAttributeMapping getAttributeMapping(CDOFeature feature);
+ public IAttributeMapping getAttributeMapping(EStructuralFeature feature);
+
+ public IReferenceMapping getReferenceMapping(EStructuralFeature feature);
- public IReferenceMapping getReferenceMapping(CDOFeature feature);
+ /**
+ * @since 2.0
+ */
+ public void writeRevision(IDBStoreAccessor accessor, InternalCDORevision revision, OMMonitor monitor);
/**
* @since 2.0
*/
- public void writeRevision(IDBStoreAccessor accessor, CDORevision revision, OMMonitor monitor);
+ public void writeRevisionDelta(IDBStoreAccessor accessor, InternalCDORevisionDelta delta, long created,
+ OMMonitor monitor);
/**
* @since 2.0
@@ -67,19 +77,21 @@ public interface IClassMapping
* @return <code>true</code> if the revision has been loaded sucessfully.<br>
* <code>false</code> if the revision does not exist in the DB.
*/
- public boolean readRevision(IDBStoreAccessor accessor, CDORevision revision, int referenceChunk);
+ public boolean readRevision(IDBStoreAccessor accessor, InternalCDORevision revision, int referenceChunk);
/**
* @since 2.0
* @return <code>true</code> if the revision has been loaded sucessfully.<br>
* <code>false</code> if the revision does not exist in the DB.
*/
- public boolean readRevisionByTime(IDBStoreAccessor accessor, CDORevision revision, long timeStamp, int referenceChunk);
+ public boolean readRevisionByTime(IDBStoreAccessor accessor, InternalCDORevision revision, long timeStamp,
+ int referenceChunk);
/**
* @since 2.0
* @return <code>true</code> if the revision has been loaded sucessfully.<br>
* <code>false</code> if the revision does not exist in the DB.
*/
- public boolean readRevisionByVersion(IDBStoreAccessor accessor, CDORevision revision, int version, int referenceChunk);
+ public boolean readRevisionByVersion(IDBStoreAccessor accessor, InternalCDORevision revision, int version,
+ int referenceChunk);
}
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/mapping/IFeatureMapping.java
index 5199cb8cb3..66f44d9f2a 100644
--- 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/mapping/IFeatureMapping.java
@@ -8,9 +8,9 @@
* Contributors:
* Eike Stepper - initial API and implementation
*/
-package org.eclipse.emf.cdo.server.db;
+package org.eclipse.emf.cdo.server.db.mapping;
-import org.eclipse.emf.cdo.common.model.CDOFeature;
+import org.eclipse.emf.ecore.EStructuralFeature;
/**
* @author Eike Stepper
@@ -19,5 +19,5 @@ public interface IFeatureMapping
{
public IClassMapping getClassMapping();
- public CDOFeature getFeature();
+ public EStructuralFeature 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/mapping/IMappingStrategy.java
index 9990a6b798..c00831bcd8 100644
--- 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/mapping/IMappingStrategy.java
@@ -8,17 +8,19 @@
* Contributors:
* Eike Stepper - initial API and implementation
*/
-package org.eclipse.emf.cdo.server.db;
+package org.eclipse.emf.cdo.server.db.mapping;
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.CDOClassifierRef;
import org.eclipse.emf.cdo.server.IStoreAccessor;
-import org.eclipse.emf.cdo.server.internal.db.ServerInfo;
+import org.eclipse.emf.cdo.server.db.IDBStore;
+import org.eclipse.emf.cdo.server.db.IDBStoreAccessor;
import org.eclipse.net4j.db.IDBAdapter;
import org.eclipse.net4j.util.collection.CloseableIterator;
+import org.eclipse.emf.ecore.EClass;
+
import java.sql.Connection;
import java.util.Map;
@@ -86,12 +88,7 @@ public interface IMappingStrategy
public void setProperties(Map<String, String> properties);
- public IClassMapping getClassMapping(CDOClass cdoClass);
-
- /**
- * @since 2.0
- */
- public CDOClassRef getClassRef(IDBStoreAccessor accessor, int classID);
+ public IClassMapping getClassMapping(EClass eClass);
/**
* @since 2.0
@@ -101,7 +98,7 @@ public interface IMappingStrategy
/**
* @since 2.0
*/
- public CDOClassRef readObjectType(IDBStoreAccessor accessor, CDOID id);
+ public CDOClassifierRef readObjectType(IDBStoreAccessor accessor, CDOID id);
/**
* @since 2.0
@@ -109,14 +106,6 @@ public interface IMappingStrategy
public void queryResources(IDBStoreAccessor accessor, IStoreAccessor.QueryResourcesContext context);
/**
- * Responsible for creation of the resource tables (if dbAdapter and connection are not <code>null</code>) and for the
- * association with the static DBIDs (see {@link ServerInfo} with the respective model elements.
- *
- * @since 2.0
- */
- public void mapResourceTables(IDBAdapter dbAdapter, Connection connection);
-
- /**
* Returns the maximum CDOID value.
*
* @since 2.0
diff --git a/plugins/org.eclipse.emf.cdo.server.db/src/org/eclipse/emf/cdo/server/db/mapping/IReferenceMapping.java b/plugins/org.eclipse.emf.cdo.server.db/src/org/eclipse/emf/cdo/server/db/mapping/IReferenceMapping.java
new file mode 100644
index 0000000000..35c63315f1
--- /dev/null
+++ b/plugins/org.eclipse.emf.cdo.server.db/src/org/eclipse/emf/cdo/server/db/mapping/IReferenceMapping.java
@@ -0,0 +1,99 @@
+/**
+ * Copyright (c) 2004 - 2009 Eike Stepper (Berlin, Germany) and others.
+ * 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
+ * Stefan Winkler - https://bugs.eclipse.org/bugs/show_bug.cgi?id=259402
+ */
+package org.eclipse.emf.cdo.server.db.mapping;
+
+import org.eclipse.emf.cdo.common.id.CDOID;
+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.spi.common.revision.InternalCDORevision;
+
+import org.eclipse.net4j.db.ddl.IDBTable;
+
+import java.util.List;
+
+/**
+ * @author Eike Stepper
+ */
+public interface IReferenceMapping extends IFeatureMapping
+{
+ public IDBTable getTable();
+
+ /**
+ * @since 2.0
+ */
+ public boolean isWithFeature();
+
+ /**
+ * Write a list of references completely
+ *
+ * @since 2.0
+ */
+ public void writeReference(IDBStoreAccessor accessor, InternalCDORevision revision);
+
+ /**
+ * Write one element of the list of references
+ *
+ * @since 2.0
+ */
+ public void writeReferenceEntry(IDBStoreAccessor accessor, CDOID id, int version, int idx, CDOID targetId);
+
+ /**
+ * Insert a single reference (entry) and move all subsequent entries of the list upwards
+ *
+ * @since 2.0
+ */
+ public void insertReferenceEntry(IDBStoreAccessor accessor, CDOID id, int newVersion, int index, CDOID value);
+
+ /**
+ * Moves a single reference (entry) from <code>oldPosition</code> to <code>newPosition</code> and update the list
+ * indexes of the entries in between.
+ *
+ * @since 2.0
+ */
+ public void moveReferenceEntry(IDBStoreAccessor accessor, CDOID id, int newVersion, int oldPosition, int newPosition);
+
+ /**
+ * Remove a single reference (entry) and move all subsequent entries of the list downwards to fill the gap.
+ *
+ * @since 2.0
+ */
+ public void removeReferenceEntry(IDBStoreAccessor accessor, CDOID id, int index, int newVersion);
+
+ /**
+ * Updates the value and version of a single reference (entry).
+ *
+ * @since 2.0
+ */
+ public void updateReference(IDBStoreAccessor accessor, CDOID id, int newVersion, int index, CDOID value);
+
+ /**
+ * Updates the version of all entries of a reference (list) to <code>newVersion</code>.
+ *
+ * @since 2.0
+ */
+ public void updateReferenceVersion(IDBStoreAccessor accessor, CDOID id, int newVersion);
+
+ /**
+ * Clears the list of references for the revision with ID <code>id</code>.
+ *
+ * @since 2.0
+ */
+ public void deleteReference(IDBStoreAccessor accessor, CDOID id);
+
+ /**
+ * @since 2.0
+ */
+ public void readReference(IDBStoreAccessor accessor, InternalCDORevision 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/CDODBSchema.java b/plugins/org.eclipse.emf.cdo.server.db/src/org/eclipse/emf/cdo/server/internal/db/CDODBSchema.java
index d357e9a003..5d72877b26 100644
--- 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
@@ -47,126 +47,53 @@ public class CDODBSchema extends DBSchema
REPOSITORY.addField("next_metaid", DBType.BIGINT);
/**
- * DBTable cdo_packages
+ * DBTable cdo_package_units
*/
- 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 IDBTable PACKAGE_UNITS = INSTANCE.addTable("cdo_package_units");
- public static final IDBField PACKAGES_ECORE = //
- PACKAGES.addField("ecore", DBType.CLOB);
+ public static final IDBField PACKAGE_UNITS_ID = //
+ PACKAGE_UNITS.addField("id", DBType.VARCHAR, 255);
- public static final IDBField PACKAGES_DYNAMIC = //
- PACKAGES.addField("dynamic", DBType.BOOLEAN);
+ public static final IDBField PACKAGE_UNITS_ORIGINAL_TYPE = //
+ PACKAGE_UNITS.addField("original_type", DBType.INTEGER);
- public static final IDBField PACKAGES_RANGE_LB = //
- PACKAGES.addField("range_lb", DBType.BIGINT);
+ public static final IDBField PACKAGE_UNITS_TIME_STAMP = //
+ PACKAGE_UNITS.addField("time_stamp", DBType.BIGINT);
- public static final IDBField PACKAGES_RANGE_UB = //
- PACKAGES.addField("range_ub", DBType.BIGINT);
+ public static final IDBField PACKAGE_UNITS_PACKAGE_DATA = //
+ PACKAGE_UNITS.addField("package_data", DBType.BLOB);
- 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);
-
- public static final IDBIndex INDEX_PACKAGES_PARENT = //
- PACKAGES.addIndex(IDBIndex.Type.NON_UNIQUE, PACKAGES_PARENT);
+ public static final IDBIndex INDEX_PACKAGE_UNITS_PK = //
+ PACKAGE_UNITS.addIndex(IDBIndex.Type.PRIMARY_KEY, PACKAGE_UNITS_ID);
/**
- * 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);
-
- public static final IDBIndex INDEX_CLASSES_PACKAGE = //
- CLASSES.addIndex(IDBIndex.Type.NON_UNIQUE, CLASSES_PACKAGE);
-
- /**
- * 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
+ * DBTable cdo_packages
*/
- 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 IDBTable PACKAGE_INFOS = INSTANCE.addTable("cdo_package_infos");
- public static final IDBField FEATURES_TYPE = //
- FEATURES.addField("type", DBType.INTEGER);
+ public static final IDBField PACKAGE_INFOS_URI = //
+ PACKAGE_INFOS.addField("uri", DBType.VARCHAR, 255);
- public static final IDBField FEATURES_REFERENCE_PACKAGE = //
- FEATURES.addField("reference_package", DBType.VARCHAR, 255);
+ public static final IDBField PACKAGE_INFOS_PARENT = //
+ PACKAGE_INFOS.addField("parent", DBType.VARCHAR, 255);
- public static final IDBField FEATURES_REFERENCE_CLASSIFIER = //
- FEATURES.addField("reference_classifier", DBType.INTEGER);
+ public static final IDBField PACKAGE_INFOS_UNIT = //
+ PACKAGE_INFOS.addField("unit", DBType.VARCHAR, 255);
- public static final IDBField FEATURES_MANY = //
- FEATURES.addField("many", DBType.BOOLEAN);
+ public static final IDBField PACKAGE_INFOS_META_LB = //
+ PACKAGE_INFOS.addField("meta_lb", DBType.BIGINT);
- public static final IDBField FEATURES_CONTAINMENT = //
- FEATURES.addField("containment", DBType.BOOLEAN);
+ public static final IDBField PACKAGE_INFOS_META_UB = //
+ PACKAGE_INFOS.addField("meta_ub", DBType.BIGINT);
- public static final IDBField FEATURES_INDEX = //
- FEATURES.addField("idx", DBType.INTEGER);
+ public static final IDBIndex INDEX_PACKAGE_INFOS_PK = //
+ PACKAGE_INFOS.addIndex(IDBIndex.Type.PRIMARY_KEY, PACKAGE_INFOS_URI);
- public static final IDBIndex INDEX_FEATURES_PK = //
- FEATURES.addIndex(IDBIndex.Type.PRIMARY_KEY, FEATURES_ID);
+ public static final IDBIndex INDEX_PACKAGE_INFOS_PARENT = //
+ PACKAGE_INFOS.addIndex(IDBIndex.Type.NON_UNIQUE, PACKAGE_INFOS_PARENT);
- public static final IDBIndex INDEX_FEATURES_CLASS = //
- FEATURES.addIndex(IDBIndex.Type.NON_UNIQUE, FEATURES_CLASS);
+ public static final IDBIndex INDEX_PACKAGE_INFOS_UNIT = //
+ PACKAGE_INFOS.addIndex(IDBIndex.Type.NON_UNIQUE, PACKAGE_INFOS_UNIT);
/**
* Name of object table
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
deleted file mode 100644
index 7ac62099f9..0000000000
--- a/plugins/org.eclipse.emf.cdo.server.db/src/org/eclipse/emf/cdo/server/internal/db/ClassServerInfo.java
+++ /dev/null
@@ -1,91 +0,0 @@
-/**
- * Copyright (c) 2004 - 2009 Eike Stepper (Berlin, Germany) and others.
- * 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.model.InternalCDOClass;
-
-import org.eclipse.net4j.util.ImplementationError;
-
-/**
- * @author Eike Stepper
- */
-public final class ClassServerInfo extends ServerInfo
-{
- 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 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;
- }
-
- private 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())
- // {
- // CDOResourceClass c = (CDOResourceClass)cdoClass;
- // FeatureServerInfo.setDBID(c.getCDOContentsFeature(), CDO_CONTENTS_FEATURE_DBID);
- // serverInfo = setDBID(c, CDO_RESOURCE_CLASS_DBID);
- // }
- // else if (cdoClass.isResourceFolder())
- // {
- // CDOResourceFolderClass c = (CDOResourceFolderClass)cdoClass;
- // FeatureServerInfo.setDBID(c.getCDONodesFeature(), CDO_NODES_FEATURE_DBID);
- // serverInfo = setDBID(c, CDO_RESOURCE_FOLDER_CLASS_DBID);
- // }
- // else if (cdoClass.isResourceNode())
- // {
- // // Important to check the abstract class *after* the concrete ones!
- // CDOResourceNodeClass c = (CDOResourceNodeClass)cdoClass;
- // FeatureServerInfo.setDBID(c.getCDOFolderFeature(), CDO_FOLDER_FEATURE_DBID);
- // FeatureServerInfo.setDBID(c.getCDONameFeature(), CDO_NAME_FEATURE_DBID);
- // serverInfo = setDBID(cdoClass, CDO_RESOURCE_NODE_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
index 514a24a12d..58de38e265 100644
--- 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
@@ -7,20 +7,23 @@
*
* Contributors:
* Eike Stepper - initial API and implementation
+ * Stefan Winkler - https://bugs.eclipse.org/bugs/show_bug.cgi?id=259402
*/
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.internal.server.StoreAccessorPool;
+import org.eclipse.emf.cdo.common.id.CDOID;
+import org.eclipse.emf.cdo.common.id.CDOIDMeta;
+import org.eclipse.emf.cdo.common.id.CDOIDUtil;
import org.eclipse.emf.cdo.server.ISession;
import org.eclipse.emf.cdo.server.ITransaction;
import org.eclipse.emf.cdo.server.IView;
-import org.eclipse.emf.cdo.server.StoreThreadLocal;
import org.eclipse.emf.cdo.server.db.IDBStore;
import org.eclipse.emf.cdo.server.db.IJDBCDelegateProvider;
-import org.eclipse.emf.cdo.server.db.IMappingStrategy;
+import org.eclipse.emf.cdo.server.db.mapping.IMappingStrategy;
import org.eclipse.emf.cdo.server.internal.db.bundle.OM;
+import org.eclipse.emf.cdo.spi.common.model.InternalCDOPackageRegistry;
+import org.eclipse.emf.cdo.spi.server.LongIDStore;
+import org.eclipse.emf.cdo.spi.server.StoreAccessorPool;
import org.eclipse.net4j.db.DBException;
import org.eclipse.net4j.db.DBType;
@@ -30,15 +33,22 @@ 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.ReflectUtil.ExcludeFromDump;
import org.eclipse.net4j.util.lifecycle.LifecycleUtil;
import org.eclipse.net4j.util.om.monitor.ProgressDistributor;
+import org.eclipse.emf.ecore.EClass;
+import org.eclipse.emf.ecore.EClassifier;
+import org.eclipse.emf.ecore.EModelElement;
+import org.eclipse.emf.ecore.EcorePackage;
+import org.eclipse.emf.ecore.InternalEObject;
+
import javax.sql.DataSource;
import java.sql.Connection;
import java.text.MessageFormat;
+import java.util.HashMap;
+import java.util.Map;
import java.util.Set;
/**
@@ -50,6 +60,8 @@ public class DBStore extends LongIDStore implements IDBStore
private long creationTime;
+ private boolean firstTime;
+
private IMappingStrategy mappingStrategy;
private IDBSchema dbSchema;
@@ -82,22 +94,52 @@ public class DBStore extends LongIDStore implements IDBStore
@ExcludeFromDump
private transient StoreAccessorPool writerPool = new StoreAccessorPool(this, null);
- @ExcludeFromDump
- private transient int nextPackageID;
-
- @ExcludeFromDump
- private transient int nextClassID;
+ private static Map<EClassifier, DBType> typeMap = new HashMap<EClassifier, DBType>();
- @ExcludeFromDump
- private transient int nextFeatureID;
+ static
+ {
+ typeMap.put(EcorePackage.eINSTANCE.getEDate(), DBType.TIMESTAMP);
+ typeMap.put(EcorePackage.eINSTANCE.getEString(), DBType.VARCHAR);
+
+ typeMap.put(EcorePackage.eINSTANCE.getEBoolean(), DBType.BOOLEAN);
+ typeMap.put(EcorePackage.eINSTANCE.getEByte(), DBType.SMALLINT);
+ typeMap.put(EcorePackage.eINSTANCE.getEChar(), DBType.CHAR);
+ typeMap.put(EcorePackage.eINSTANCE.getEDouble(), DBType.DOUBLE);
+ typeMap.put(EcorePackage.eINSTANCE.getEFloat(), DBType.FLOAT);
+ typeMap.put(EcorePackage.eINSTANCE.getEInt(), DBType.INTEGER);
+ typeMap.put(EcorePackage.eINSTANCE.getELong(), DBType.BIGINT);
+ typeMap.put(EcorePackage.eINSTANCE.getEShort(), DBType.SMALLINT);
+
+ typeMap.put(EcorePackage.eINSTANCE.getEBooleanObject(), DBType.BOOLEAN);
+ typeMap.put(EcorePackage.eINSTANCE.getEByteObject(), DBType.SMALLINT);
+ typeMap.put(EcorePackage.eINSTANCE.getECharacterObject(), DBType.CHAR);
+ typeMap.put(EcorePackage.eINSTANCE.getEDoubleObject(), DBType.DOUBLE);
+ typeMap.put(EcorePackage.eINSTANCE.getEFloatObject(), DBType.FLOAT);
+ typeMap.put(EcorePackage.eINSTANCE.getEIntegerObject(), DBType.INTEGER);
+ typeMap.put(EcorePackage.eINSTANCE.getELongObject(), DBType.BIGINT);
+ typeMap.put(EcorePackage.eINSTANCE.getEShortObject(), DBType.SMALLINT);
+ }
public DBStore()
{
- super(TYPE, set(ChangeFormat.REVISION), set(RevisionTemporality.AUDITING, RevisionTemporality.NONE),
- set(RevisionParallelism.NONE));
+ super(TYPE, set(ChangeFormat.REVISION, ChangeFormat.DELTA), set(RevisionTemporality.AUDITING,
+ RevisionTemporality.NONE), set(RevisionParallelism.NONE));
setRevisionTemporality(RevisionTemporality.AUDITING);
}
+ @Override
+ public Set<ChangeFormat> getSupportedChangeFormats()
+ {
+ if (getRevisionTemporality() == RevisionTemporality.AUDITING)
+ {
+ return set(ChangeFormat.REVISION);
+ }
+ else
+ {
+ return set(ChangeFormat.REVISION, ChangeFormat.DELTA);
+ }
+ }
+
public IMappingStrategy getMappingStrategy()
{
return mappingStrategy;
@@ -126,7 +168,7 @@ public class DBStore extends LongIDStore implements IDBStore
public void setDbConnectionProvider(IDBConnectionProvider dbConnectionProvider)
{
- // FIXME: need to update provider in JDBCWrapper, too?
+ // TODO Need to update provider in JDBCWrapper, too?
this.dbConnectionProvider = dbConnectionProvider;
}
@@ -150,18 +192,24 @@ public class DBStore extends LongIDStore implements IDBStore
return accessorWriteDistributor;
}
- public synchronized IDBSchema getDBSchema()
+ public IDBSchema getDBSchema()
{
- // TODO Better synchronization or eager init
- if (dbSchema == null)
- {
- dbSchema = createSchema();
- }
-
return dbSchema;
}
@Override
+ public DBStoreAccessor getReader(ISession session)
+ {
+ return (DBStoreAccessor)super.getReader(session);
+ }
+
+ @Override
+ public DBStoreAccessor getWriter(ITransaction transaction)
+ {
+ return (DBStoreAccessor)super.getWriter(transaction);
+ }
+
+ @Override
protected StoreAccessorPool getReaderPool(ISession session, boolean forReleasing)
{
return readerPool;
@@ -185,22 +233,27 @@ public class DBStore extends LongIDStore implements IDBStore
return new DBStoreAccessor(this, transaction);
}
- public synchronized int getNextPackageID()
+ public long getMetaID(EModelElement modelElement)
{
- // TODO Better synchronization
- return nextPackageID++;
- }
-
- public synchronized int getNextClassID()
- {
- // TODO Better synchronization
- return nextClassID++;
+ InternalCDOPackageRegistry packageRegistry = (InternalCDOPackageRegistry)getRepository().getPackageRegistry();
+ try
+ {
+ CDOID cdoid = packageRegistry.getMetaInstanceMapper().lookupMetaInstanceID((InternalEObject)modelElement);
+ return ((CDOIDMeta)cdoid).getLongValue();
+ }
+ catch (RuntimeException ex)
+ {
+ packageRegistry.getMetaInstanceMapper().lookupMetaInstanceID((InternalEObject)modelElement);
+ throw ex;
+ }
}
- public synchronized int getNextFeatureID()
+ public EModelElement getMetaInstance(long id)
{
- // TODO Better synchronization
- return nextFeatureID++;
+ CDOIDMeta cdoid = CDOIDUtil.createMeta(id);
+ InternalCDOPackageRegistry packageRegistry = (InternalCDOPackageRegistry)getRepository().getPackageRegistry();
+ InternalEObject metaInstance = packageRegistry.getMetaInstanceMapper().lookupMetaInstance(cdoid);
+ return (EModelElement)metaInstance;
}
public Connection getConnection()
@@ -210,33 +263,18 @@ public class DBStore extends LongIDStore implements IDBStore
{
throw new DBException("No connection from connection provider: " + dbConnectionProvider);
}
+
return connection;
}
- public void repairAfterCrash()
+ public long getCreationTime()
{
- try
- {
- DBStoreAccessor accessor = (DBStoreAccessor)getWriter(null);
- StoreThreadLocal.setAccessor(accessor);
-
- Connection connection = accessor.getJDBCDelegate().getConnection();
- long maxObjectID = mappingStrategy.repairAfterCrash(dbAdapter, connection);
- long maxMetaID = DBUtil.selectMaximumLong(connection, CDODBSchema.PACKAGES_RANGE_UB);
-
- OM.LOG.info(MessageFormat.format("Repaired after crash: maxObjectID={0}, maxMetaID={1}", maxObjectID, maxMetaID));
- setLastObjectID(maxObjectID);
- setLastMetaID(maxMetaID);
- }
- finally
- {
- StoreThreadLocal.release();
- }
+ return creationTime;
}
- public long getCreationTime()
+ public boolean isFirstTime()
{
- return creationTime;
+ return firstTime;
}
@Override
@@ -252,71 +290,22 @@ public class DBStore extends LongIDStore implements IDBStore
protected void doActivate() throws Exception
{
super.doActivate();
- long startupTime = getStartupTime();
- Connection connection = null;
+ Connection connection = getConnection();
try
{
- connection = getConnection();
- Set<IDBTable> createdTables = CDODBSchema.INSTANCE.create(dbAdapter, dbConnectionProvider);
+ Set<IDBTable> createdTables = CDODBSchema.INSTANCE.create(dbAdapter, connection);
if (createdTables.contains(CDODBSchema.REPOSITORY))
{
- // First start
- creationTime = startupTime;
- DBUtil.insertRow(connection, dbAdapter, CDODBSchema.REPOSITORY, creationTime, 1, startupTime, 0, CRASHED,
- CRASHED);
-
- mappingStrategy.mapResourceTables(dbAdapter, connection);
+ firstStart(connection);
}
else
{
- // Restart
- creationTime = DBUtil.selectMaximumLong(connection, CDODBSchema.REPOSITORY_CREATED);
- 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(startupTime);
- 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);
- }
-
- getMappingStrategy().mapResourceTables(null, null);
+ reStart(connection);
}
- 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);
+ dbSchema = createSchema();
}
finally
{
@@ -324,6 +313,63 @@ public class DBStore extends LongIDStore implements IDBStore
}
}
+ protected void firstStart(Connection connection)
+ {
+ creationTime = getStartupTime();
+ firstTime = true;
+
+ DBUtil.insertRow(connection, dbAdapter, CDODBSchema.REPOSITORY, creationTime, 1, creationTime, 0, CRASHED, CRASHED);
+ OM.LOG.info(MessageFormat.format("First start: {0,date} {0,time}", creationTime));
+ }
+
+ protected void reStart(Connection connection)
+ {
+ creationTime = DBUtil.selectMaximumLong(connection, CDODBSchema.REPOSITORY_CREATED);
+ long lastMetaId = DBUtil.selectMaximumLong(connection, CDODBSchema.REPOSITORY_NEXT_METAID);
+ long lastObjectID = DBUtil.selectMaximumLong(connection, CDODBSchema.REPOSITORY_NEXT_CDOID);
+
+ if (lastObjectID == CRASHED || getLastMetaID() == CRASHED)
+ {
+ OM.LOG.info("Detected crash");
+ lastObjectID = mappingStrategy.repairAfterCrash(dbAdapter, connection);
+ lastMetaId = DBUtil.selectMaximumLong(connection, CDODBSchema.PACKAGE_INFOS_META_UB);
+ OM.LOG.info(MessageFormat
+ .format("Repaired after crash: maxObjectID={0}, maxMetaID={1}", lastObjectID, lastMetaId));
+ }
+
+ setLastMetaID(lastMetaId);
+ 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);
+ }
+ }
+
@Override
protected void doDeactivate() throws Exception
{
@@ -349,7 +395,7 @@ public class DBStore extends LongIDStore implements IDBStore
builder.append(", ");
builder.append(CDODBSchema.REPOSITORY_NEXT_METAID);
builder.append("=");
- builder.append(getRepository().getLastMetaID());
+ builder.append(getLastMetaID());
String sql = builder.toString();
int count = DBUtil.update(connection, sql);
@@ -384,53 +430,19 @@ public class DBStore extends LongIDStore implements IDBStore
return System.currentTimeMillis();
}
- public static DBType getDBType(CDOType type)
+ public static DBType getDBType(EClassifier 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.TIMESTAMP;
- }
- 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)
+ if (type instanceof EClass)
{
return DBType.BIGINT;
}
- else if (type == CDOType.SHORT || type == CDOType.SHORT_OBJECT)
- {
- return DBType.SMALLINT;
- }
- else if (type == CDOType.STRING || type == CDOType.CUSTOM)
+
+ DBType dbType = typeMap.get(type);
+ if (dbType != null)
{
- return DBType.VARCHAR;
+ return dbType;
}
- throw new ImplementationError("Unrecognized CDOType: " + type);
+ return DBType.VARCHAR;
}
}
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
index 013f3a4eec..fd541442d9 100644
--- 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
@@ -7,6 +7,7 @@
*
* Contributors:
* Eike Stepper - initial API and implementation
+ * Stefan Winkler - https://bugs.eclipse.org/bugs/show_bug.cgi?id=259402
*/
package org.eclipse.emf.cdo.server.internal.db;
@@ -15,37 +16,33 @@ import org.eclipse.emf.cdo.common.id.CDOID;
import org.eclipse.emf.cdo.common.id.CDOIDMeta;
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.CDOClassifierRef;
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.model.CDOPackageRegistry;
+import org.eclipse.emf.cdo.common.model.CDOPackageUnit;
+import org.eclipse.emf.cdo.common.model.EMFUtil;
import org.eclipse.emf.cdo.common.revision.CDORevisionUtil;
-import org.eclipse.emf.cdo.common.revision.delta.CDORevisionDelta;
-import org.eclipse.emf.cdo.internal.server.StoreAccessor;
-import org.eclipse.emf.cdo.server.IPackageManager;
import org.eclipse.emf.cdo.server.IQueryContext;
import org.eclipse.emf.cdo.server.IRepository;
import org.eclipse.emf.cdo.server.ISession;
import org.eclipse.emf.cdo.server.ITransaction;
-import org.eclipse.emf.cdo.server.db.IClassMapping;
+import org.eclipse.emf.cdo.server.IStore.RevisionTemporality;
import org.eclipse.emf.cdo.server.db.IDBStoreAccessor;
import org.eclipse.emf.cdo.server.db.IJDBCDelegate;
-import org.eclipse.emf.cdo.server.db.IMappingStrategy;
+import org.eclipse.emf.cdo.server.db.mapping.IClassMapping;
+import org.eclipse.emf.cdo.server.db.mapping.IMappingStrategy;
import org.eclipse.emf.cdo.server.internal.db.bundle.OM;
-import org.eclipse.emf.cdo.spi.common.model.InternalCDOClass;
-import org.eclipse.emf.cdo.spi.common.model.InternalCDOFeature;
-import org.eclipse.emf.cdo.spi.common.model.InternalCDOPackage;
+import org.eclipse.emf.cdo.spi.common.model.InternalCDOPackageInfo;
+import org.eclipse.emf.cdo.spi.common.model.InternalCDOPackageUnit;
import org.eclipse.emf.cdo.spi.common.revision.InternalCDORevision;
+import org.eclipse.emf.cdo.spi.common.revision.InternalCDORevisionDelta;
+import org.eclipse.emf.cdo.spi.server.LongIDStoreAccessor;
import org.eclipse.net4j.db.DBException;
import org.eclipse.net4j.db.DBUtil;
import org.eclipse.net4j.db.IDBRowHandler;
import org.eclipse.net4j.db.ddl.IDBTable;
+import org.eclipse.net4j.util.ReflectUtil.ExcludeFromDump;
import org.eclipse.net4j.util.collection.CloseableIterator;
import org.eclipse.net4j.util.lifecycle.LifecycleUtil;
import org.eclipse.net4j.util.om.monitor.OMMonitor;
@@ -54,22 +51,33 @@ import org.eclipse.net4j.util.om.monitor.ProgressDistributor;
import org.eclipse.net4j.util.om.monitor.OMMonitor.Async;
import org.eclipse.net4j.util.om.trace.ContextTracer;
+import org.eclipse.emf.ecore.EClass;
+import org.eclipse.emf.ecore.EPackage;
+import org.eclipse.emf.ecore.EStructuralFeature;
+
import java.sql.PreparedStatement;
import java.sql.SQLException;
import java.util.ArrayList;
import java.util.Collection;
+import java.util.HashMap;
import java.util.HashSet;
+import java.util.List;
+import java.util.Map;
import java.util.Set;
+import java.util.Map.Entry;
/**
* @author Eike Stepper
*/
-public class DBStoreAccessor extends StoreAccessor implements IDBStoreAccessor
+public class DBStoreAccessor extends LongIDStoreAccessor implements IDBStoreAccessor
{
private static final ContextTracer TRACER = new ContextTracer(OM.DEBUG, DBStoreAccessor.class);
+ private static final boolean ZIP_PACKAGE_BYTES = true;
+
private IJDBCDelegate jdbcDelegate;
+ @ExcludeFromDump
@SuppressWarnings("unchecked")
private final ProgressDistributable<CommitContext>[] ops = ProgressDistributor.array( //
new ProgressDistributable.Default<CommitContext>()
@@ -90,20 +98,19 @@ public class DBStoreAccessor extends StoreAccessor implements IDBStoreAccessor
public DBStoreAccessor(DBStore store, ISession session) throws DBException
{
super(store, session);
- initJDBCDelegate(store);
+ initJDBCDelegate();
}
public DBStoreAccessor(DBStore store, ITransaction transaction) throws DBException
{
super(store, transaction);
- initJDBCDelegate(store);
+ initJDBCDelegate();
}
- private void initJDBCDelegate(DBStore store)
+ private void initJDBCDelegate()
{
- jdbcDelegate = store.getJDBCDelegateProvider().getJDBCDelegate();
- jdbcDelegate.setConnectionProvider(store.getDBConnectionProvider());
- jdbcDelegate.setReadOnly(isReader());
+ jdbcDelegate = getStore().getJDBCDelegateProvider().getJDBCDelegate();
+ jdbcDelegate.setStoreAccessor(this);
}
public IJDBCDelegate getJDBCDelegate()
@@ -117,140 +124,81 @@ public class DBStoreAccessor extends StoreAccessor implements IDBStoreAccessor
return (DBStore)super.getStore();
}
- public DBStoreChunkReader createChunkReader(CDORevision revision, CDOFeature feature)
+ public DBStoreChunkReader createChunkReader(InternalCDORevision revision, EStructuralFeature feature)
{
return new DBStoreChunkReader(this, revision, feature);
}
- public final Collection<CDOPackageInfo> readPackageInfos()
+ public final Collection<InternalCDOPackageUnit> readPackageUnits()
{
- final Collection<CDOPackageInfo> result = new ArrayList<CDOPackageInfo>(0);
- IDBRowHandler rowHandler = new IDBRowHandler()
+ final Map<String, InternalCDOPackageUnit> packageUnits = new HashMap<String, InternalCDOPackageUnit>();
+ IDBRowHandler unitRowHandler = 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));
+ InternalCDOPackageUnit packageUnit = createPackageUnit();
+ packageUnit.setOriginalType(CDOPackageUnit.Type.values()[(Integer)values[1]]);
+ packageUnit.setTimeStamp((Long)values[2]);
+ packageUnits.put((String)values[0], packageUnit);
return true;
}
};
- DBUtil.select(jdbcDelegate.getConnection(), rowHandler, CDODBSchema.PACKAGES_URI, CDODBSchema.PACKAGES_DYNAMIC,
- CDODBSchema.PACKAGES_RANGE_LB, CDODBSchema.PACKAGES_RANGE_UB, CDODBSchema.PACKAGES_PARENT);
- return result;
- }
+ DBUtil.select(jdbcDelegate.getConnection(), unitRowHandler, CDODBSchema.PACKAGE_UNITS_ID,
+ CDODBSchema.PACKAGE_UNITS_ORIGINAL_TYPE, CDODBSchema.PACKAGE_UNITS_TIME_STAMP);
- public final void readPackage(CDOPackage cdoPackage)
- {
- String where = CDODBSchema.PACKAGES_URI.getName() + " = '" + cdoPackage.getPackageURI() + "'";
- Object[] values = DBUtil.select(jdbcDelegate.getConnection(), where, CDODBSchema.PACKAGES_ID,
- CDODBSchema.PACKAGES_NAME);
- PackageServerInfo.setDBID(cdoPackage, (Integer)values[0]);
- ((InternalCDOPackage)cdoPackage).setName((String)values[1]);
- readClasses(cdoPackage);
- mapPackages(cdoPackage);
- }
-
- protected final void readClasses(final CDOPackage cdoPackage)
- {
- IDBRowHandler rowHandler = new IDBRowHandler()
+ final Map<String, List<InternalCDOPackageInfo>> packageInfos = new HashMap<String, List<InternalCDOPackageInfo>>();
+ IDBRowHandler infoRowHandler = new IDBRowHandler()
{
- public boolean handle(int row, Object... values)
+ public boolean handle(int row, final 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(jdbcDelegate.getConnection(), rowHandler, where, CDODBSchema.CLASSES_ID,
- CDODBSchema.CLASSES_CLASSIFIER, CDODBSchema.CLASSES_NAME, CDODBSchema.CLASSES_ABSTRACT);
- }
+ long metaLB = (Long)values[3];
+ long metaUB = (Long)values[4];
+ CDOIDMetaRange metaIDRange = metaLB == 0 ? null : CDOIDUtil.createMetaRange(CDOIDUtil.createMeta(metaLB),
+ (int)(metaUB - metaLB) + 1);
+
+ InternalCDOPackageInfo packageInfo = createPackageInfo();
+ packageInfo.setPackageURI((String)values[1]);
+ packageInfo.setParentURI((String)values[2]);
+ packageInfo.setMetaIDRange(metaIDRange);
+
+ String unit = (String)values[0];
+ List<InternalCDOPackageInfo> list = packageInfos.get(unit);
+ if (list == null)
+ {
+ list = new ArrayList<InternalCDOPackageInfo>();
+ packageInfos.put(unit, list);
+ }
- protected final 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));
+ list.add(packageInfo);
return true;
}
};
- String where = CDODBSchema.SUPERTYPES_TYPE.getName() + "=" + classID;
- DBUtil.select(jdbcDelegate.getConnection(), rowHandler, where, CDODBSchema.SUPERTYPES_SUPERTYPE_PACKAGE,
- CDODBSchema.SUPERTYPES_SUPERTYPE_CLASSIFIER);
- }
+ DBUtil.select(jdbcDelegate.getConnection(), infoRowHandler, CDODBSchema.PACKAGE_INFOS_UNIT,
+ CDODBSchema.PACKAGE_INFOS_URI, CDODBSchema.PACKAGE_INFOS_PARENT, CDODBSchema.PACKAGE_INFOS_META_LB,
+ CDODBSchema.PACKAGE_INFOS_META_UB);
- protected final void readFeatures(final CDOClass cdoClass, int classID)
- {
- IDBRowHandler rowHandler = new IDBRowHandler()
+ for (Entry<String, InternalCDOPackageUnit> entry : packageUnits.entrySet())
{
- 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, null, many);
- }
-
- FeatureServerInfo.setDBID(feature, (Integer)values[0]);
- ((InternalCDOClass)cdoClass).addFeature(feature);
- return true;
- }
- };
+ String id = entry.getKey();
+ InternalCDOPackageUnit packageUnit = entry.getValue();
- String where = CDODBSchema.FEATURES_CLASS.getName() + "=" + classID;
- DBUtil.select(jdbcDelegate.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);
- }
+ List<InternalCDOPackageInfo> list = packageInfos.get(id);
+ InternalCDOPackageInfo[] array = list.toArray(new InternalCDOPackageInfo[list.size()]);
+ packageUnit.setPackageInfos(array);
+ }
- public final void readPackageEcore(CDOPackage cdoPackage)
- {
- String where = CDODBSchema.PACKAGES_URI.getName() + " = '" + cdoPackage.getPackageURI() + "'";
- Object[] values = DBUtil.select(jdbcDelegate.getConnection(), where, CDODBSchema.PACKAGES_ECORE);
- ((InternalCDOPackage)cdoPackage).setEcore((String)values[0]);
+ return packageUnits.values();
}
- public final String readPackageURI(int packageID)
+ public final EPackage[] loadPackageUnit(InternalCDOPackageUnit packageUnit)
{
- String where = CDODBSchema.PACKAGES_ID.getName() + "=" + packageID;
- Object[] uri = DBUtil.select(jdbcDelegate.getConnection(), where, CDODBSchema.PACKAGES_URI);
- return (String)uri[0];
+ String where = CDODBSchema.PACKAGE_UNITS_ID.getName() + "='" + packageUnit.getID() + "'";
+ Object[] values = DBUtil.select(jdbcDelegate.getConnection(), where, CDODBSchema.PACKAGE_UNITS_PACKAGE_DATA);
+ byte[] bytes = (byte[])values[0];
+ EPackage ePackage = createEPackage(packageUnit, bytes);
+ return EMFUtil.getAllPackages(ePackage);
}
public CloseableIterator<CDOID> readObjectIDs()
@@ -263,7 +211,7 @@ public class DBStoreAccessor extends StoreAccessor implements IDBStoreAccessor
return getStore().getMappingStrategy().readObjectIDs(this);
}
- public CDOClassRef readObjectType(CDOID id)
+ public CDOClassifierRef readObjectType(CDOID id)
{
if (TRACER.isEnabled())
{
@@ -273,28 +221,23 @@ public class DBStoreAccessor extends StoreAccessor implements IDBStoreAccessor
return getStore().getMappingStrategy().readObjectType(this, id);
}
- public final CDOClassRef readClassRef(int classID)
- {
- String where = CDODBSchema.CLASSES_ID.getName() + "=" + classID;
- Object[] res = DBUtil.select(jdbcDelegate.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)
+ public InternalCDORevision readRevision(CDOID id, int referenceChunk)
{
if (TRACER.isEnabled())
{
TRACER.format("Selecting revision: {0}", id);
}
- CDOClass cdoClass = getObjectType(id);
- InternalCDORevision revision = (InternalCDORevision)CDORevisionUtil.create(cdoClass, id);
+ EClass eClass = getObjectType(id);
+ if (eClass == null)
+ {
+ return null;
+ }
+
+ InternalCDORevision revision = (InternalCDORevision)CDORevisionUtil.create(eClass, id);
IMappingStrategy mappingStrategy = getStore().getMappingStrategy();
- IClassMapping mapping = mappingStrategy.getClassMapping(cdoClass);
+ IClassMapping mapping = mappingStrategy.getClassMapping(eClass);
if (mapping.readRevision(this, revision, referenceChunk))
{
return revision;
@@ -304,18 +247,18 @@ public class DBStoreAccessor extends StoreAccessor implements IDBStoreAccessor
return null;
}
- public CDORevision readRevisionByTime(CDOID id, int referenceChunk, long timeStamp)
+ public InternalCDORevision readRevisionByTime(CDOID id, int referenceChunk, long timeStamp)
{
if (TRACER.isEnabled())
{
TRACER.format("Selecting revision: {0}, timestamp={1,date} {1,time}", id, timeStamp);
}
- CDOClass cdoClass = getObjectType(id);
- InternalCDORevision revision = (InternalCDORevision)CDORevisionUtil.create(cdoClass, id);
+ EClass eClass = getObjectType(id);
+ InternalCDORevision revision = (InternalCDORevision)CDORevisionUtil.create(eClass, id);
IMappingStrategy mappingStrategy = getStore().getMappingStrategy();
- IClassMapping mapping = mappingStrategy.getClassMapping(cdoClass);
+ IClassMapping mapping = mappingStrategy.getClassMapping(eClass);
if (mapping.readRevisionByTime(this, revision, timeStamp, referenceChunk))
{
return revision;
@@ -325,18 +268,18 @@ public class DBStoreAccessor extends StoreAccessor implements IDBStoreAccessor
return null;
}
- public CDORevision readRevisionByVersion(CDOID id, int referenceChunk, int version)
+ public InternalCDORevision readRevisionByVersion(CDOID id, int referenceChunk, int version)
{
if (TRACER.isEnabled())
{
TRACER.format("Selecting revision: {0}, version={1}", id, version);
}
- CDOClass cdoClass = getObjectType(id);
- InternalCDORevision revision = (InternalCDORevision)CDORevisionUtil.create(cdoClass, id);
+ EClass eClass = getObjectType(id);
+ InternalCDORevision revision = (InternalCDORevision)CDORevisionUtil.create(eClass, id);
IMappingStrategy mappingStrategy = getStore().getMappingStrategy();
- IClassMapping mapping = mappingStrategy.getClassMapping(cdoClass);
+ IClassMapping mapping = mappingStrategy.getClassMapping(eClass);
if (mapping.readRevisionByVersion(this, revision, version, referenceChunk))
{
return revision;
@@ -364,13 +307,18 @@ public class DBStoreAccessor extends StoreAccessor implements IDBStoreAccessor
throw new UnsupportedOperationException();
}
- protected CDOClass getObjectType(CDOID id)
+ protected EClass getObjectType(CDOID id)
{
// TODO Replace calls to getObjectType by optimized calls to RevisionManager.getObjectType (cache!)
+ CDOClassifierRef type = readObjectType(id);
+ if (type == null)
+ {
+ return null;
+ }
+
IRepository repository = getStore().getRepository();
- IPackageManager packageManager = repository.getPackageManager();
- CDOClassRef type = readObjectType(id);
- return type.resolve(packageManager);
+ CDOPackageRegistry packageRegistry = repository.getPackageRegistry();
+ return (EClass)type.resolve(packageRegistry);
}
public CloseableIterator<Object> createQueryIterator(CDOQueryInfo queryInfo)
@@ -389,14 +337,13 @@ public class DBStoreAccessor extends StoreAccessor implements IDBStoreAccessor
distributor.run(ops, context, monitor);
}
- @Override
- protected final void writePackages(CDOPackage[] cdoPackages, OMMonitor monitor)
+ public final void writePackageUnits(InternalCDOPackageUnit[] packageUnits, OMMonitor monitor)
{
try
{
monitor.begin(2);
- fillSystemTables(cdoPackages, monitor.fork());
- createModelTables(cdoPackages, monitor.fork());
+ fillSystemTables(packageUnits, monitor.fork());
+ createModelTables(packageUnits, monitor.fork());
}
finally
{
@@ -404,158 +351,148 @@ public class DBStoreAccessor extends StoreAccessor implements IDBStoreAccessor
}
}
- private void fillSystemTables(CDOPackage[] cdoPackages, OMMonitor monitor)
+ private void fillSystemTables(InternalCDOPackageUnit[] packageUnits, OMMonitor monitor)
{
- new PackageWriter(cdoPackages, monitor)
+ try
{
- @Override
- protected void writePackage(InternalCDOPackage cdoPackage, OMMonitor monitor)
+ monitor.begin(packageUnits.length);
+ for (InternalCDOPackageUnit packageUnit : packageUnits)
{
- 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;
+ fillSystemTables(packageUnit, monitor.fork());
+ }
+ }
+ finally
+ {
+ monitor.done();
+ }
+ }
- monitor.begin();
- Async async = monitor.forkAsync();
+ private void fillSystemTables(InternalCDOPackageUnit packageUnit, OMMonitor monitor)
+ {
+ try
+ {
+ InternalCDOPackageInfo[] packageInfos = packageUnit.getPackageInfos();
+ monitor.begin(1 + packageInfos.length);
- try
- {
- pstmt = jdbcDelegate.getPreparedStatement(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);
- async.stop();
- monitor.done();
- }
+ if (TRACER.isEnabled())
+ {
+ TRACER.format("Writing package unit: {0}", packageUnit);
}
- @Override
- protected final void writeClass(InternalCDOClass cdoClass, OMMonitor monitor)
+ String sql = "INSERT INTO " + CDODBSchema.PACKAGE_UNITS + " VALUES (?, ?, ?, ?)";
+ DBUtil.trace(sql);
+ PreparedStatement pstmt = null;
+ Async async = monitor.forkAsync();
+
+ try
{
- monitor.begin();
- Async async = monitor.forkAsync();
+ pstmt = jdbcDelegate.getPreparedStatement(sql);
+ pstmt.setString(1, packageUnit.getID());
+ pstmt.setInt(2, packageUnit.getOriginalType().ordinal());
+ pstmt.setLong(3, packageUnit.getTimeStamp());
+ pstmt.setBytes(4, getEPackageBytes(packageUnit));
- try
+ if (pstmt.execute())
{
- 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(jdbcDelegate.getConnection(), getStore().getDBAdapter(), CDODBSchema.CLASSES, id, packageID,
- classifierID, name, isAbstract);
+ throw new DBException("No result set expected");
}
- finally
+
+ if (pstmt.getUpdateCount() == 0)
{
- async.stop();
- monitor.done();
+ throw new DBException("No row inserted into table " + CDODBSchema.PACKAGE_UNITS);
}
}
-
- @Override
- protected final void writeSuperType(InternalCDOClass type, CDOClassProxy superType, OMMonitor monitor)
+ catch (SQLException ex)
+ {
+ throw new DBException(ex);
+ }
+ finally
{
- monitor.begin();
- Async async = monitor.forkAsync();
+ DBUtil.close(pstmt);
+ async.stop();
+ }
- try
- {
- int id = ClassServerInfo.getDBID(type);
- String packageURI = superType.getPackageURI();
- int classifierID = superType.getClassifierID();
- DBUtil.insertRow(jdbcDelegate.getConnection(), getStore().getDBAdapter(), CDODBSchema.SUPERTYPES, id,
- packageURI, classifierID);
- }
- finally
- {
- async.stop();
- monitor.done();
- }
+ for (InternalCDOPackageInfo packageInfo : packageInfos)
+ {
+ fillSystemTables(packageInfo, monitor); // Don't fork monitor
}
+ }
+ finally
+ {
+ monitor.done();
+ }
+ }
+
+ private byte[] getEPackageBytes(InternalCDOPackageUnit packageUnit)
+ {
+ EPackage ePackage = packageUnit.getTopLevelPackageInfo().getEPackage();
+ CDOPackageRegistry packageRegistry = getStore().getRepository().getPackageRegistry();
+ return EMFUtil.getEPackageBytes(ePackage, ZIP_PACKAGE_BYTES, packageRegistry);
+ }
+
+ private EPackage createEPackage(InternalCDOPackageUnit packageUnit, byte[] bytes)
+ {
+ CDOPackageRegistry packageRegistry = getStore().getRepository().getPackageRegistry();
+ return EMFUtil.createEPackage(packageUnit.getID(), bytes, ZIP_PACKAGE_BYTES, packageRegistry);
+ }
- @Override
- protected void writeFeature(InternalCDOFeature feature, OMMonitor monitor)
+ private void fillSystemTables(InternalCDOPackageInfo packageInfo, OMMonitor monitor)
+ {
+ if (TRACER.isEnabled())
+ {
+ TRACER.format("Writing package info: {0}", packageInfo);
+ }
+
+ String packageURI = packageInfo.getPackageURI();
+ String parentURI = packageInfo.getParentURI();
+ String unitID = packageInfo.getPackageUnit().getID();
+ CDOIDMetaRange metaIDRange = packageInfo.getMetaIDRange();
+ long metaLB = metaIDRange == null ? 0L : ((CDOIDMeta)metaIDRange.getLowerBound()).getLongValue();
+ long metaUB = metaIDRange == null ? 0L : ((CDOIDMeta)metaIDRange.getUpperBound()).getLongValue();
+
+ String sql = "INSERT INTO " + CDODBSchema.PACKAGE_INFOS + " VALUES (?, ?, ?, ?, ?)";
+ DBUtil.trace(sql);
+ PreparedStatement pstmt = null;
+ Async async = monitor.forkAsync();
+
+ try
+ {
+ pstmt = jdbcDelegate.getPreparedStatement(sql);
+ pstmt.setString(1, packageURI);
+ pstmt.setString(2, parentURI);
+ pstmt.setString(3, unitID);
+ pstmt.setLong(4, metaLB);
+ pstmt.setLong(5, metaUB);
+
+ if (pstmt.execute())
{
- monitor.begin();
- Async async = monitor.forkAsync();
+ throw new DBException("No result set expected");
+ }
- try
- {
- 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 = 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(jdbcDelegate.getConnection(), getStore().getDBAdapter(), CDODBSchema.FEATURES, id, classID,
- featureID, name, type, packageURI, classifierID, many, containment, idx);
- }
- finally
- {
- async.stop();
- monitor.done();
- }
+ if (pstmt.getUpdateCount() == 0)
+ {
+ throw new DBException("No row inserted into table " + CDODBSchema.PACKAGE_INFOS);
}
- }.run();
+ }
+ catch (SQLException ex)
+ {
+ throw new DBException(ex);
+ }
+ finally
+ {
+ DBUtil.close(pstmt);
+ async.stop();
+ }
}
- private void createModelTables(CDOPackage[] cdoPackages, OMMonitor monitor)
+ private void createModelTables(InternalCDOPackageUnit[] packageUnits, OMMonitor monitor)
{
monitor.begin();
Async async = monitor.forkAsync();
try
{
- Set<IDBTable> affectedTables = mapPackages(cdoPackages);
+ Set<IDBTable> affectedTables = mapPackageUnits(packageUnits);
getStore().getDBAdapter().createTables(affectedTables, jdbcDelegate.getConnection());
}
finally
@@ -566,18 +503,41 @@ public class DBStoreAccessor extends StoreAccessor implements IDBStoreAccessor
}
@Override
- protected void writeRevisionDeltas(CDORevisionDelta[] revisionDeltas, long created, OMMonitor monitor)
+ protected void writeRevisionDeltas(InternalCDORevisionDelta[] revisionDeltas, long created, OMMonitor monitor)
{
- throw new UnsupportedOperationException();
+ if (!(getStore().getRevisionTemporality() == RevisionTemporality.NONE))
+ {
+ throw new UnsupportedOperationException("Revision Deltas are only supported in non-auditing mode!");
+ }
+
+ monitor.begin(revisionDeltas.length);
+ try
+ {
+ for (InternalCDORevisionDelta delta : revisionDeltas)
+ {
+ writeRevisionDelta(delta, created, monitor.fork());
+ }
+ }
+ finally
+ {
+ monitor.done();
+ }
+ }
+
+ protected void writeRevisionDelta(InternalCDORevisionDelta delta, long created, OMMonitor monitor)
+ {
+ EClass eClass = getObjectType(delta.getID());
+ IClassMapping mapping = getStore().getMappingStrategy().getClassMapping(eClass);
+ mapping.writeRevisionDelta(this, delta, created, monitor);
}
@Override
- protected void writeRevisions(CDORevision[] revisions, OMMonitor monitor)
+ protected void writeRevisions(InternalCDORevision[] revisions, OMMonitor monitor)
{
try
{
monitor.begin(revisions.length);
- for (CDORevision revision : revisions)
+ for (InternalCDORevision revision : revisions)
{
writeRevision(revision, monitor.fork());
}
@@ -588,15 +548,15 @@ public class DBStoreAccessor extends StoreAccessor implements IDBStoreAccessor
}
}
- protected void writeRevision(CDORevision revision, OMMonitor monitor)
+ protected void writeRevision(InternalCDORevision revision, OMMonitor monitor)
{
if (TRACER.isEnabled())
{
TRACER.format("Writing revision: {0}", revision);
}
- CDOClass cdoClass = revision.getCDOClass();
- IClassMapping mapping = getStore().getMappingStrategy().getClassMapping(cdoClass);
+ EClass eClass = revision.getEClass();
+ IClassMapping mapping = getStore().getMappingStrategy().getClassMapping(eClass);
mapping.writeRevision(this, revision, monitor);
}
@@ -627,8 +587,8 @@ public class DBStoreAccessor extends StoreAccessor implements IDBStoreAccessor
TRACER.format("Detaching object: {0}", id);
}
- CDOClass cdoClass = getObjectType(id);
- IClassMapping mapping = getStore().getMappingStrategy().getClassMapping(cdoClass);
+ EClass eClass = getObjectType(id);
+ IClassMapping mapping = getStore().getMappingStrategy().getClassMapping(eClass);
mapping.detachObject(this, id, revised, monitor);
}
@@ -655,30 +615,43 @@ public class DBStoreAccessor extends StoreAccessor implements IDBStoreAccessor
throw new IllegalArgumentException("Not a boolean value: " + value);
}
- protected Set<IDBTable> mapPackages(CDOPackage... cdoPackages)
+ protected Set<IDBTable> mapPackageUnits(InternalCDOPackageUnit[] packageUnits)
{
Set<IDBTable> affectedTables = new HashSet<IDBTable>();
- if (cdoPackages != null && cdoPackages.length != 0)
+ if (packageUnits != null && packageUnits.length != 0)
{
- for (CDOPackage cdoPackage : cdoPackages)
+ for (InternalCDOPackageUnit packageUnit : packageUnits)
{
- Set<IDBTable> tables = mapClasses(cdoPackage.getClasses());
- affectedTables.addAll(tables);
+ mapPackageInfos(packageUnit.getPackageInfos(), affectedTables);
}
}
return affectedTables;
}
- protected Set<IDBTable> mapClasses(CDOClass... cdoClasses)
+ protected void mapPackageInfos(InternalCDOPackageInfo[] packageInfos, Set<IDBTable> affectedTables)
+ {
+ for (InternalCDOPackageInfo packageInfo : packageInfos)
+ {
+ EPackage ePackage = packageInfo.getEPackage();
+ if (!CDOModelUtil.isCorePackage(ePackage))
+ {
+ EClass[] persistentClasses = EMFUtil.getPersistentClasses(ePackage);
+ Set<IDBTable> tables = mapClasses(persistentClasses);
+ affectedTables.addAll(tables);
+ }
+ }
+ }
+
+ protected Set<IDBTable> mapClasses(EClass... eClasses)
{
Set<IDBTable> affectedTables = new HashSet<IDBTable>();
- if (cdoClasses != null && cdoClasses.length != 0)
+ if (eClasses != null && eClasses.length != 0)
{
IMappingStrategy mappingStrategy = getStore().getMappingStrategy();
- for (CDOClass cdoClass : cdoClasses)
+ for (EClass eClass : eClasses)
{
- IClassMapping mapping = mappingStrategy.getClassMapping(cdoClass);
+ IClassMapping mapping = mappingStrategy.getClassMapping(eClass);
if (mapping != null)
{
affectedTables.addAll(mapping.getAffectedTables());
@@ -689,6 +662,16 @@ public class DBStoreAccessor extends StoreAccessor implements IDBStoreAccessor
return affectedTables;
}
+ protected InternalCDOPackageUnit createPackageUnit()
+ {
+ return (InternalCDOPackageUnit)CDOModelUtil.createPackageUnit();
+ }
+
+ protected InternalCDOPackageInfo createPackageInfo()
+ {
+ return (InternalCDOPackageInfo)CDOModelUtil.createPackageInfo();
+ }
+
public final void commit(OMMonitor monitor)
{
jdbcDelegate.commit(monitor);
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
index ab6dbb5205..3fde4ce6ba 100644
--- 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
@@ -10,13 +10,14 @@
*/
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.IMappingStrategy;
-import org.eclipse.emf.cdo.server.db.IReferenceMapping;
+import org.eclipse.emf.cdo.server.db.mapping.IClassMapping;
+import org.eclipse.emf.cdo.server.db.mapping.IMappingStrategy;
+import org.eclipse.emf.cdo.server.db.mapping.IReferenceMapping;
+import org.eclipse.emf.cdo.spi.server.StoreChunkReader;
+
+import org.eclipse.emf.ecore.EStructuralFeature;
import java.util.List;
@@ -29,11 +30,11 @@ public class DBStoreChunkReader extends StoreChunkReader implements IDBStoreChun
private StringBuilder builder = new StringBuilder();
- public DBStoreChunkReader(DBStoreAccessor accessor, CDORevision revision, CDOFeature feature)
+ public DBStoreChunkReader(DBStoreAccessor accessor, CDORevision revision, EStructuralFeature feature)
{
super(accessor, revision, feature);
IMappingStrategy mappingStrategy = accessor.getStore().getMappingStrategy();
- IClassMapping mapping = mappingStrategy.getClassMapping(revision.getCDOClass());
+ IClassMapping mapping = mappingStrategy.getClassMapping(revision.getEClass());
referenceMapping = mapping.getReferenceMapping(feature);
}
diff --git a/plugins/org.eclipse.emf.cdo.server.db/src/org/eclipse/emf/cdo/server/internal/db/DBStoreFactory.java b/plugins/org.eclipse.emf.cdo.server.db/src/org/eclipse/emf/cdo/server/internal/db/DBStoreFactory.java
index c5b425cd15..1f238772a8 100644
--- a/plugins/org.eclipse.emf.cdo.server.db/src/org/eclipse/emf/cdo/server/internal/db/DBStoreFactory.java
+++ b/plugins/org.eclipse.emf.cdo.server.db/src/org/eclipse/emf/cdo/server/internal/db/DBStoreFactory.java
@@ -15,7 +15,7 @@ import org.eclipse.emf.cdo.server.IStore;
import org.eclipse.emf.cdo.server.IStoreFactory;
import org.eclipse.emf.cdo.server.db.CDODBUtil;
import org.eclipse.emf.cdo.server.db.IJDBCDelegateProvider;
-import org.eclipse.emf.cdo.server.db.IMappingStrategy;
+import org.eclipse.emf.cdo.server.db.mapping.IMappingStrategy;
import org.eclipse.net4j.db.DBUtil;
import org.eclipse.net4j.db.IDBAdapter;
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
deleted file mode 100644
index 6289703f7b..0000000000
--- a/plugins/org.eclipse.emf.cdo.server.db/src/org/eclipse/emf/cdo/server/internal/db/FeatureServerInfo.java
+++ /dev/null
@@ -1,32 +0,0 @@
-/**
- * Copyright (c) 2004 - 2009 Eike Stepper (Berlin, Germany) and others.
- * 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.model.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/ObjectIDIterator.java b/plugins/org.eclipse.emf.cdo.server.db/src/org/eclipse/emf/cdo/server/internal/db/ObjectIDIterator.java
index d87cac6999..70611f9453 100644
--- 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
@@ -14,7 +14,7 @@ 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.server.db.IDBStoreAccessor;
-import org.eclipse.emf.cdo.server.db.IMappingStrategy;
+import org.eclipse.emf.cdo.server.db.mapping.IMappingStrategy;
import org.eclipse.net4j.db.DBException;
import org.eclipse.net4j.db.DBUtil;
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
index 93b88099de..e5f3823218 100644
--- 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
@@ -7,16 +7,16 @@
*
* Contributors:
* Eike Stepper - initial API and implementation
+ * Stefan Winkler - https://bugs.eclipse.org/bugs/show_bug.cgi?id=259402
*/
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.CDOClassifierRef;
import org.eclipse.emf.cdo.server.db.IDBStoreAccessor;
-import org.eclipse.emf.cdo.server.db.IMappingStrategy;
import org.eclipse.emf.cdo.server.db.IObjectTypeCache;
+import org.eclipse.emf.cdo.server.db.mapping.IMappingStrategy;
import org.eclipse.net4j.db.DBException;
import org.eclipse.net4j.db.DBType;
@@ -28,6 +28,8 @@ import org.eclipse.net4j.db.ddl.IDBSchema;
import org.eclipse.net4j.db.ddl.IDBTable;
import org.eclipse.net4j.util.lifecycle.Lifecycle;
+import org.eclipse.emf.ecore.EClass;
+
import java.sql.ResultSet;
import java.sql.SQLException;
import java.sql.Statement;
@@ -61,7 +63,7 @@ public class ObjectTypeCache extends Lifecycle implements IObjectTypeCache
this.mappingStrategy = mappingStrategy;
}
- public final CDOClassRef getObjectType(IDBStoreAccessor accessor, CDOID id)
+ public final CDOClassifierRef getObjectType(IDBStoreAccessor accessor, CDOID id)
{
Statement statement = accessor.getJDBCDelegate().getStatement();
initialize(statement);
@@ -85,11 +87,13 @@ public class ObjectTypeCache extends Lifecycle implements IObjectTypeCache
resultSet = statement.executeQuery(sql);
if (!resultSet.next())
{
- throw new DBException("ClassID for CDOID " + id + " not found");
+ DBUtil.trace("ClassID for CDOID " + id + " not found");
+ return null;
}
- int classID = resultSet.getInt(1);
- return mappingStrategy.getClassRef(accessor, classID);
+ long classID = resultSet.getLong(1);
+ EClass eClass = (EClass)mappingStrategy.getStore().getMetaInstance(classID);
+ return new CDOClassifierRef(eClass);
}
catch (SQLException ex)
{
@@ -101,7 +105,7 @@ public class ObjectTypeCache extends Lifecycle implements IObjectTypeCache
}
}
- public final void putObjectType(IDBStoreAccessor accessor, CDOID id, CDOClass type)
+ public final void putObjectType(IDBStoreAccessor accessor, CDOID id, EClass type)
{
Statement statement = accessor.getJDBCDelegate().getStatement();
initialize(statement);
@@ -112,7 +116,7 @@ public class ObjectTypeCache extends Lifecycle implements IObjectTypeCache
builder.append(" VALUES (");
builder.append(CDOIDUtil.getLong(id));
builder.append(", ");
- builder.append(ClassServerInfo.getDBID(type));
+ builder.append(accessor.getStore().getMetaID(type));
builder.append(")");
String sql = builder.toString();
DBUtil.trace(sql);
@@ -169,7 +173,7 @@ public class ObjectTypeCache extends Lifecycle implements IObjectTypeCache
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);
+ typeField = table.addField(CDODBSchema.ATTRIBUTES_CLASS, DBType.BIGINT);
table.addIndex(IDBIndex.Type.PRIMARY_KEY, idField);
IDBAdapter dbAdapter = mappingStrategy.getStore().getDBAdapter();
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
deleted file mode 100644
index b2fb878a46..0000000000
--- a/plugins/org.eclipse.emf.cdo.server.db/src/org/eclipse/emf/cdo/server/internal/db/PackageServerInfo.java
+++ /dev/null
@@ -1,46 +0,0 @@
-/**
- * Copyright (c) 2004 - 2009 Eike Stepper (Berlin, Germany) and others.
- * 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.model.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/Precedence.java b/plugins/org.eclipse.emf.cdo.server.db/src/org/eclipse/emf/cdo/server/internal/db/Precedence.java
deleted file mode 100644
index fcf735de92..0000000000
--- a/plugins/org.eclipse.emf.cdo.server.db/src/org/eclipse/emf/cdo/server/internal/db/Precedence.java
+++ /dev/null
@@ -1,19 +0,0 @@
-/**
- * Copyright (c) 2004 - 2009 Eike Stepper (Berlin, Germany) and others.
- * 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:
- * Ei