Skip to main content
summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
Diffstat (limited to 'plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo')
-rw-r--r--plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/common/CDOCommonRepository.java352
-rw-r--r--plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/common/CDOCommonSession.java374
-rw-r--r--plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/common/CDOCommonTransaction.java48
-rw-r--r--plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/common/CDOCommonView.java196
-rw-r--r--plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/common/branch/CDOBranch.java370
-rw-r--r--plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/common/branch/CDOBranchCreatedEvent.java58
-rw-r--r--plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/common/branch/CDOBranchHandler.java54
-rw-r--r--plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/common/branch/CDOBranchManager.java158
-rw-r--r--plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/common/branch/CDOBranchPoint.java118
-rw-r--r--plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/common/branch/CDOBranchPointRange.java88
-rw-r--r--plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/common/branch/CDOBranchTag.java54
-rw-r--r--plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/common/branch/CDOBranchVersion.java106
-rw-r--r--plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/common/branch/package-info.java2
-rw-r--r--plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/common/commit/CDOChangeKind.java46
-rw-r--r--plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/common/commit/CDOChangeKindProvider.java50
-rw-r--r--plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/common/commit/CDOChangeSet.java56
-rw-r--r--plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/common/commit/CDOChangeSetData.java156
-rw-r--r--plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/common/commit/CDOChangeSetDataProvider.java46
-rw-r--r--plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/common/commit/CDOCommitData.java58
-rw-r--r--plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/common/commit/CDOCommitInfo.java74
-rw-r--r--plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/common/commit/CDOCommitInfoHandler.java48
-rw-r--r--plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/common/commit/CDOCommitInfoManager.java78
-rw-r--r--plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/common/commit/handler/AsyncCommitInfoHandler.java116
-rw-r--r--plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/common/commit/handler/BinaryCommitInfoLog.java118
-rw-r--r--plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/common/commit/handler/TextCommitInfoLog.java130
-rw-r--r--plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/common/commit/handler/package-info.java2
-rw-r--r--plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/common/commit/package-info.java2
-rw-r--r--plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/common/id/CDOID.java324
-rw-r--r--plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/common/id/CDOIDExternal.java54
-rw-r--r--plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/common/id/CDOIDGenerator.java144
-rw-r--r--plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/common/id/CDOIDObject.java50
-rw-r--r--plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/common/id/CDOIDProvider.java66
-rw-r--r--plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/common/id/CDOIDReference.java216
-rw-r--r--plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/common/id/CDOIDTemp.java52
-rw-r--r--plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/common/id/CDOIDUtil.java904
-rw-r--r--plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/common/id/CDOReference.java86
-rw-r--r--plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/common/id/CDOWithID.java2
-rw-r--r--plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/common/id/package-info.java2
-rw-r--r--plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/common/lob/CDOBlob.java120
-rw-r--r--plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/common/lob/CDOClob.java120
-rw-r--r--plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/common/lob/CDOLob.java138
-rw-r--r--plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/common/lob/CDOLobHandler.java82
-rw-r--r--plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/common/lob/CDOLobInfo.java118
-rw-r--r--plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/common/lob/CDOLobStore.java156
-rw-r--r--plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/common/lob/CDOLobUtil.java118
-rw-r--r--plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/common/lob/package-info.java2
-rw-r--r--plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/common/lock/CDOLockChangeInfo.java158
-rw-r--r--plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/common/lock/CDOLockChangeInfoHandler.java46
-rw-r--r--plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/common/lock/CDOLockOwner.java74
-rw-r--r--plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/common/lock/CDOLockState.java122
-rw-r--r--plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/common/lock/CDOLockUtil.java326
-rw-r--r--plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/common/lock/IDurableLockingManager.java2
-rw-r--r--plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/common/lock/package-info.java2
-rw-r--r--plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/common/model/CDOClassInfo.java84
-rw-r--r--plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/common/model/CDOClassifierRef.java318
-rw-r--r--plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/common/model/CDOModelConstants.java138
-rw-r--r--plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/common/model/CDOModelUtil.java1278
-rw-r--r--plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/common/model/CDOPackageInfo.java184
-rw-r--r--plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/common/model/CDOPackageRegistry.java162
-rw-r--r--plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/common/model/CDOPackageRegistryPopulator.java318
-rw-r--r--plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/common/model/CDOPackageTypeRegistry.java454
-rw-r--r--plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/common/model/CDOPackageUnit.java416
-rw-r--r--plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/common/model/CDOType.java314
-rw-r--r--plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/common/model/EMFUtil.java1026
-rw-r--r--plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/common/model/package-info.java2
-rw-r--r--plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/common/package-info.java2
-rw-r--r--plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/common/protocol/CDOAuthenticator.java90
-rw-r--r--plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/common/protocol/CDODataInput.java334
-rw-r--r--plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/common/protocol/CDODataOutput.java336
-rw-r--r--plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/common/protocol/CDOProtocol.java56
-rw-r--r--plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/common/protocol/CDOProtocolConstants.java674
-rw-r--r--plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/common/protocol/package-info.java2
-rw-r--r--plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/common/revision/CDOAllRevisionsProvider.java56
-rw-r--r--plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/common/revision/CDOElementProxy.java50
-rw-r--r--plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/common/revision/CDOIDAndBranch.java60
-rw-r--r--plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/common/revision/CDOIDAndVersion.java56
-rw-r--r--plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/common/revision/CDOList.java82
-rw-r--r--plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/common/revision/CDOListFactory.java56
-rw-r--r--plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/common/revision/CDOListResolver.java74
-rw-r--r--plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/common/revision/CDORevisable.java2
-rw-r--r--plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/common/revision/CDORevision.java206
-rw-r--r--plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/common/revision/CDORevisionCache.java166
-rw-r--r--plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/common/revision/CDORevisionCacheAdder.java54
-rw-r--r--plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/common/revision/CDORevisionData.java224
-rw-r--r--plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/common/revision/CDORevisionFactory.java76
-rw-r--r--plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/common/revision/CDORevisionHandler.java164
-rw-r--r--plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/common/revision/CDORevisionKey.java52
-rw-r--r--plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/common/revision/CDORevisionManager.java342
-rw-r--r--plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/common/revision/CDORevisionProvider.java54
-rw-r--r--plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/common/revision/CDORevisionUtil.java1194
-rw-r--r--plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/common/revision/delta/CDOAddFeatureDelta.java58
-rw-r--r--plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/common/revision/delta/CDOClearFeatureDelta.java52
-rw-r--r--plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/common/revision/delta/CDOContainerFeatureDelta.java92
-rw-r--r--plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/common/revision/delta/CDOFeatureDelta.java156
-rw-r--r--plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/common/revision/delta/CDOFeatureDeltaVisitor.java76
-rw-r--r--plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/common/revision/delta/CDOListFeatureDelta.java62
-rw-r--r--plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/common/revision/delta/CDOMoveFeatureDelta.java68
-rw-r--r--plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/common/revision/delta/CDORemoveFeatureDelta.java64
-rw-r--r--plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/common/revision/delta/CDORevisionDelta.java176
-rw-r--r--plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/common/revision/delta/CDORevisionDeltaProvider.java50
-rw-r--r--plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/common/revision/delta/CDOSetFeatureDelta.java78
-rw-r--r--plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/common/revision/delta/CDOUnsetFeatureDelta.java52
-rw-r--r--plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/common/revision/delta/package-info.java2
-rw-r--r--plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/common/revision/package-info.java2
-rw-r--r--plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/common/util/BlockingCloseableIterator.java58
-rw-r--r--plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/common/util/CDOCommonEventAdapter.java170
-rw-r--r--plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/common/util/CDOCommonUtil.java348
-rw-r--r--plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/common/util/CDOException.java80
-rw-r--r--plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/common/util/CDOFetchRule.java176
-rw-r--r--plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/common/util/CDOQueryInfo.java150
-rw-r--r--plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/common/util/CDOQueryQueue.java830
-rw-r--r--plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/common/util/CDOTimeProvider.java44
-rw-r--r--plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/common/util/PartialCollectionLoadingNotSupportedException.java90
-rw-r--r--plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/common/util/RepositoryStateChangedEvent.java104
-rw-r--r--plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/common/util/RepositoryTypeChangedEvent.java102
-rw-r--r--plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/common/util/TransportException.java82
-rw-r--r--plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/common/util/package-info.java2
-rw-r--r--plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/internal/common/CDOQueryInfoImpl.java320
-rw-r--r--plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/internal/common/branch/CDOBranchImpl.java684
-rw-r--r--plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/internal/common/branch/CDOBranchManagerImpl.java502
-rw-r--r--plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/internal/common/branch/CDOBranchPointImpl.java170
-rw-r--r--plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/internal/common/branch/CDOBranchPointRangeImpl.java96
-rw-r--r--plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/internal/common/branch/CDOBranchVersionImpl.java146
-rw-r--r--plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/internal/common/bundle/OM.java116
-rw-r--r--plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/internal/common/commit/CDOChangeSetDataImpl.java450
-rw-r--r--plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/internal/common/commit/CDOChangeSetImpl.java96
-rw-r--r--plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/internal/common/commit/CDOCommitDataImpl.java94
-rw-r--r--plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/internal/common/commit/CDOCommitInfoImpl.java306
-rw-r--r--plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/internal/common/commit/CDOCommitInfoManagerImpl.java174
-rw-r--r--plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/internal/common/commit/DelegatingCommitInfo.java222
-rw-r--r--plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/internal/common/commit/FailureCommitInfo.java232
-rw-r--r--plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/internal/common/id/CDOIDExternalImpl.java262
-rw-r--r--plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/internal/common/id/CDOIDNullImpl.java250
-rw-r--r--plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/internal/common/id/CDOIDObjectLongImpl.java166
-rw-r--r--plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/internal/common/id/CDOIDObjectLongWithClassifierImpl.java290
-rw-r--r--plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/internal/common/id/CDOIDObjectStringImpl.java162
-rw-r--r--plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/internal/common/id/CDOIDObjectStringWithClassifierImpl.java276
-rw-r--r--plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/internal/common/id/CDOIDObjectUUIDImpl.java208
-rw-r--r--plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/internal/common/id/CDOIDTempObjectExternalImpl.java66
-rw-r--r--plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/internal/common/id/CDOIDTempObjectImpl.java140
-rw-r--r--plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/internal/common/lock/CDOLockAreaImpl.java212
-rw-r--r--plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/internal/common/lock/CDOLockChangeInfoImpl.java186
-rw-r--r--plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/internal/common/lock/CDOLockOwnerImpl.java182
-rw-r--r--plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/internal/common/lock/CDOLockStateImpl.java382
-rw-r--r--plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/internal/common/messages/Messages.java82
-rw-r--r--plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/internal/common/messages/messages.properties78
-rw-r--r--plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/internal/common/model/CDOClassInfoImpl.java252
-rw-r--r--plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/internal/common/model/CDOPackageInfoImpl.java320
-rw-r--r--plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/internal/common/model/CDOPackageRegistryImpl.java1326
-rw-r--r--plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/internal/common/model/CDOPackageUnitImpl.java786
-rw-r--r--plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/internal/common/model/CDOTypeImpl.java1886
-rw-r--r--plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/internal/common/model/GenUtil.java426
-rw-r--r--plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/internal/common/protocol/CDODataInputImpl.java1302
-rw-r--r--plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/internal/common/protocol/CDODataOutputImpl.java1120
-rw-r--r--plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/internal/common/revision/AbstractCDORevisionCache.java312
-rw-r--r--plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/internal/common/revision/CDOElementProxyImpl.java90
-rw-r--r--plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/internal/common/revision/CDOFeatureMapEntryImpl.java126
-rw-r--r--plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/internal/common/revision/CDOIDAndBranchImpl.java156
-rw-r--r--plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/internal/common/revision/CDOIDAndVersionImpl.java150
-rw-r--r--plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/internal/common/revision/CDOListImpl.java374
-rw-r--r--plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/internal/common/revision/CDOListWithElementProxiesImpl.java182
-rw-r--r--plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/internal/common/revision/CDORevisableImpl.java180
-rw-r--r--plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/internal/common/revision/CDORevisionCacheAuditing.java886
-rw-r--r--plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/internal/common/revision/CDORevisionCacheBranching.java262
-rw-r--r--plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/internal/common/revision/CDORevisionCacheNonAuditing.java434
-rw-r--r--plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/internal/common/revision/CDORevisionImpl.java286
-rw-r--r--plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/internal/common/revision/CDORevisionKeyImpl.java132
-rw-r--r--plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/internal/common/revision/CDORevisionManagerImpl.java1078
-rw-r--r--plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/internal/common/revision/EvictionEventImpl.java134
-rw-r--r--plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/internal/common/revision/NOOPRevisionCache.java202
-rw-r--r--plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/internal/common/revision/delta/CDOAddFeatureDeltaImpl.java158
-rw-r--r--plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/internal/common/revision/delta/CDOClearFeatureDeltaImpl.java146
-rw-r--r--plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/internal/common/revision/delta/CDOContainerFeatureDeltaImpl.java346
-rw-r--r--plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/internal/common/revision/delta/CDODetachedRevisionDeltaImpl.java178
-rw-r--r--plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/internal/common/revision/delta/CDOFeatureDeltaImpl.java180
-rw-r--r--plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/internal/common/revision/delta/CDOListFeatureDeltaImpl.java928
-rw-r--r--plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/internal/common/revision/delta/CDOMoveFeatureDeltaImpl.java414
-rw-r--r--plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/internal/common/revision/delta/CDORemoveFeatureDeltaImpl.java198
-rw-r--r--plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/internal/common/revision/delta/CDORevisionDeltaImpl.java1102
-rw-r--r--plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/internal/common/revision/delta/CDOSetFeatureDeltaImpl.java194
-rw-r--r--plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/internal/common/revision/delta/CDOSingleValueFeatureDeltaImpl.java370
-rw-r--r--plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/internal/common/revision/delta/CDOUnsetFeatureDeltaImpl.java146
-rw-r--r--plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/spi/common/AbstractQueryResult.java208
-rw-r--r--plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/spi/common/CDOAuthenticationResult.java120
-rw-r--r--plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/spi/common/CDOLobStoreImpl.java394
-rw-r--r--plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/spi/common/CDORawReplicationContext.java58
-rw-r--r--plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/spi/common/CDOReplicationContext.java50
-rw-r--r--plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/spi/common/CDOReplicationInfo.java58
-rw-r--r--plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/spi/common/branch/CDOBranchUtil.java248
-rw-r--r--plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/spi/common/branch/InternalCDOBranch.java92
-rw-r--r--plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/spi/common/branch/InternalCDOBranchManager.java380
-rw-r--r--plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/spi/common/branch/package-info.java2
-rw-r--r--plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/spi/common/commit/CDOChangeKindCache.java130
-rw-r--r--plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/spi/common/commit/CDOChangeSetDataRevisionProvider.java320
-rw-r--r--plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/spi/common/commit/CDOChangeSetSegment.java174
-rw-r--r--plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/spi/common/commit/CDOCommitInfoUtil.java204
-rw-r--r--plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/spi/common/commit/CDORevisionAvailabilityInfo.java146
-rw-r--r--plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/spi/common/commit/InternalCDOCommitInfoManager.java96
-rw-r--r--plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/spi/common/commit/package-info.java2
-rw-r--r--plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/spi/common/id/AbstractCDOID.java136
-rw-r--r--plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/spi/common/id/AbstractCDOIDByteArray.java190
-rw-r--r--plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/spi/common/id/AbstractCDOIDInteger.java218
-rw-r--r--plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/spi/common/id/AbstractCDOIDLong.java206
-rw-r--r--plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/spi/common/id/AbstractCDOIDString.java202
-rw-r--r--plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/spi/common/id/InternalCDOIDObject.java48
-rw-r--r--plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/spi/common/id/package-info.java2
-rw-r--r--plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/spi/common/lock/InternalCDOLockState.java62
-rw-r--r--plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/spi/common/lock/package-info.java2
-rw-r--r--plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/spi/common/model/DelegatingCDOPackageRegistry.java348
-rw-r--r--plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/spi/common/model/InternalCDOPackageInfo.java92
-rw-r--r--plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/spi/common/model/InternalCDOPackageRegistry.java210
-rw-r--r--plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/spi/common/model/InternalCDOPackageUnit.java144
-rw-r--r--plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/spi/common/model/package-info.java2
-rw-r--r--plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/spi/common/package-info.java2
-rw-r--r--plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/spi/common/revision/AbstractCDORevision.java408
-rw-r--r--plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/spi/common/revision/BaseCDORevision.java1550
-rw-r--r--plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/spi/common/revision/CDOFeatureDeltaVisitorImpl.java196
-rw-r--r--plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/spi/common/revision/CDOFeatureMapEntry.java50
-rw-r--r--plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/spi/common/revision/CDOIDMapper.java126
-rw-r--r--plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/spi/common/revision/CDOReferenceAdjustable.java42
-rw-r--r--plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/spi/common/revision/CDOReferenceAdjuster.java68
-rw-r--r--plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/spi/common/revision/CDORevisionMerger.java172
-rw-r--r--plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/spi/common/revision/DelegatingCDORevision.java648
-rw-r--r--plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/spi/common/revision/DelegatingCDORevisionManager.java386
-rw-r--r--plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/spi/common/revision/DetachedCDORevision.java138
-rw-r--r--plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/spi/common/revision/InternalCDOFeatureDelta.java114
-rw-r--r--plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/spi/common/revision/InternalCDOList.java98
-rw-r--r--plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/spi/common/revision/InternalCDORevision.java242
-rw-r--r--plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/spi/common/revision/InternalCDORevisionCache.java74
-rw-r--r--plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/spi/common/revision/InternalCDORevisionDelta.java102
-rw-r--r--plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/spi/common/revision/InternalCDORevisionManager.java214
-rw-r--r--plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/spi/common/revision/ManagedRevisionProvider.java98
-rw-r--r--plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/spi/common/revision/PointerCDORevision.java138
-rw-r--r--plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/spi/common/revision/RevisionInfo.java1142
-rw-r--r--plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/spi/common/revision/StubCDORevision.java538
-rw-r--r--plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/spi/common/revision/SyntheticCDORevision.java140
-rw-r--r--plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/spi/common/revision/package-info.java2
237 files changed, 26683 insertions, 26683 deletions
diff --git a/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/common/CDOCommonRepository.java b/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/common/CDOCommonRepository.java
index 1d63fa854d..782d4d99aa 100644
--- a/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/common/CDOCommonRepository.java
+++ b/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/common/CDOCommonRepository.java
@@ -1,176 +1,176 @@
-/*
- * Copyright (c) 2004 - 2011 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;
-
-import org.eclipse.emf.cdo.common.id.CDOID;
-import org.eclipse.emf.cdo.common.util.CDOTimeProvider;
-
-import org.eclipse.net4j.util.event.IEvent;
-
-import java.util.Set;
-
-/**
- * Abstracts the information about CDO repositories that is common to both client and server side.
- * <p>
- * A CDOCommonRepository can fire the following events:
- * <ul>
- * <li> {@link TypeChangedEvent} after the {@link #getType() repository type} has changed in a fail-over cluster.
- * <li> {@link StateChangedEvent} after the {@link #getState() repository state} has changed in a replicating deployment.
- * </ul>
- *
- * @author Eike Stepper
- * @since 3.0
- * @noextend This interface is not intended to be extended by clients.
- * @noimplement This interface is not intended to be implemented by clients.
- * @apiviz.landmark
- * @apiviz.has {@link CDOCommonRepository.IDGenerationLocation}
- * @apiviz.has {@link CDOCommonRepository.Type}
- * @apiviz.has {@link CDOCommonRepository.State}
- * @apiviz.uses {@link CDOCommonRepository.TypeChangedEvent} - - fires
- * @apiviz.uses {@link CDOCommonRepository.StateChangedEvent} - - fires
- */
-public interface CDOCommonRepository extends CDOTimeProvider
-{
- /**
- * Returns the name of this repository.
- */
- public String getName();
-
- /**
- * Returns the UUID of this repository.
- */
- public String getUUID();
-
- /**
- * Returns the type of this repository.
- */
- public Type getType();
-
- /**
- * Returns the state of this repository.
- */
- public State getState();
-
- /**
- * Returns the creation time of this repository.
- */
- public long getCreationTime();
-
- /**
- * Returns the type of the store of this repository.
- */
- public String getStoreType();
-
- /**
- * Returns the type of CDOIDs created by the store of this repository.
- */
- public Set<CDOID.ObjectType> getObjectIDTypes();
-
- /**
- * @since 4.1
- */
- public IDGenerationLocation getIDGenerationLocation();
-
- /**
- * Returns the ID of the root resource of this repository.
- */
- public CDOID getRootResourceID();
-
- /**
- * Returns <code>true</code> if this repository supports auditing, <code>false</code> otherwise.
- */
- public boolean isSupportingAudits();
-
- /**
- * Returns <code>true</code> if this repository supports branching, <code>false</code> otherwise.
- */
- public boolean isSupportingBranches();
-
- /**
- * Returns <code>true</code> if this repository supports instances of Ecore, <code>false</code> otherwise.
- *
- * @since 4.0
- */
- public boolean isSupportingEcore();
-
- /**
- * Returns <code>true</code> if this repository ensures referential integrity, <code>false</code> otherwise.
- *
- * @since 4.0
- */
- public boolean isEnsuringReferentialIntegrity();
-
- /**
- * Enumerates the possible {@link CDOCommonRepository#getIDGenerationLocation() ID generation locations} of a CDO
- * repository.
- *
- * @author Eike Stepper
- * @since 4.1
- */
- public enum IDGenerationLocation
- {
- STORE, CLIENT
- }
-
- /**
- * Enumerates the possible {@link CDOCommonRepository#getType() types} of a CDO repository.
- *
- * @author Eike Stepper
- */
- public enum Type
- {
- MASTER, BACKUP, CLONE
- }
-
- /**
- * Enumerates the possible {@link CDOCommonRepository#getState() states} of a CDO repository.
- *
- * @author Eike Stepper
- */
- public static enum State
- {
- INITIAL, OFFLINE, SYNCING, ONLINE;
-
- public boolean isConnected()
- {
- return this == SYNCING || this == ONLINE;
- }
- }
-
- /**
- * An {@link IEvent event} fired when the {@link Type type} of a CDO repository has changed. This usually happens only
- * for repository fail-over participants.
- *
- * @author Eike Stepper
- * @noextend This interface is not intended to be extended by clients.
- * @noimplement This interface is not intended to be implemented by clients.
- */
- public interface TypeChangedEvent extends IEvent
- {
- public Type getOldType();
-
- public Type getNewType();
- }
-
- /**
- * An {@link IEvent event} fired when the {@link State state} of a CDO repository has changed.
- *
- * @author Eike Stepper
- * @noextend This interface is not intended to be extended by clients.
- * @noimplement This interface is not intended to be implemented by clients.
- */
- public interface StateChangedEvent extends IEvent
- {
- public State getOldState();
-
- public State getNewState();
- }
-}
+/*
+ * Copyright (c) 2004 - 2012 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;
+
+import org.eclipse.emf.cdo.common.id.CDOID;
+import org.eclipse.emf.cdo.common.util.CDOTimeProvider;
+
+import org.eclipse.net4j.util.event.IEvent;
+
+import java.util.Set;
+
+/**
+ * Abstracts the information about CDO repositories that is common to both client and server side.
+ * <p>
+ * A CDOCommonRepository can fire the following events:
+ * <ul>
+ * <li> {@link TypeChangedEvent} after the {@link #getType() repository type} has changed in a fail-over cluster.
+ * <li> {@link StateChangedEvent} after the {@link #getState() repository state} has changed in a replicating deployment.
+ * </ul>
+ *
+ * @author Eike Stepper
+ * @since 3.0
+ * @noextend This interface is not intended to be extended by clients.
+ * @noimplement This interface is not intended to be implemented by clients.
+ * @apiviz.landmark
+ * @apiviz.has {@link CDOCommonRepository.IDGenerationLocation}
+ * @apiviz.has {@link CDOCommonRepository.Type}
+ * @apiviz.has {@link CDOCommonRepository.State}
+ * @apiviz.uses {@link CDOCommonRepository.TypeChangedEvent} - - fires
+ * @apiviz.uses {@link CDOCommonRepository.StateChangedEvent} - - fires
+ */
+public interface CDOCommonRepository extends CDOTimeProvider
+{
+ /**
+ * Returns the name of this repository.
+ */
+ public String getName();
+
+ /**
+ * Returns the UUID of this repository.
+ */
+ public String getUUID();
+
+ /**
+ * Returns the type of this repository.
+ */
+ public Type getType();
+
+ /**
+ * Returns the state of this repository.
+ */
+ public State getState();
+
+ /**
+ * Returns the creation time of this repository.
+ */
+ public long getCreationTime();
+
+ /**
+ * Returns the type of the store of this repository.
+ */
+ public String getStoreType();
+
+ /**
+ * Returns the type of CDOIDs created by the store of this repository.
+ */
+ public Set<CDOID.ObjectType> getObjectIDTypes();
+
+ /**
+ * @since 4.1
+ */
+ public IDGenerationLocation getIDGenerationLocation();
+
+ /**
+ * Returns the ID of the root resource of this repository.
+ */
+ public CDOID getRootResourceID();
+
+ /**
+ * Returns <code>true</code> if this repository supports auditing, <code>false</code> otherwise.
+ */
+ public boolean isSupportingAudits();
+
+ /**
+ * Returns <code>true</code> if this repository supports branching, <code>false</code> otherwise.
+ */
+ public boolean isSupportingBranches();
+
+ /**
+ * Returns <code>true</code> if this repository supports instances of Ecore, <code>false</code> otherwise.
+ *
+ * @since 4.0
+ */
+ public boolean isSupportingEcore();
+
+ /**
+ * Returns <code>true</code> if this repository ensures referential integrity, <code>false</code> otherwise.
+ *
+ * @since 4.0
+ */
+ public boolean isEnsuringReferentialIntegrity();
+
+ /**
+ * Enumerates the possible {@link CDOCommonRepository#getIDGenerationLocation() ID generation locations} of a CDO
+ * repository.
+ *
+ * @author Eike Stepper
+ * @since 4.1
+ */
+ public enum IDGenerationLocation
+ {
+ STORE, CLIENT
+ }
+
+ /**
+ * Enumerates the possible {@link CDOCommonRepository#getType() types} of a CDO repository.
+ *
+ * @author Eike Stepper
+ */
+ public enum Type
+ {
+ MASTER, BACKUP, CLONE
+ }
+
+ /**
+ * Enumerates the possible {@link CDOCommonRepository#getState() states} of a CDO repository.
+ *
+ * @author Eike Stepper
+ */
+ public static enum State
+ {
+ INITIAL, OFFLINE, SYNCING, ONLINE;
+
+ public boolean isConnected()
+ {
+ return this == SYNCING || this == ONLINE;
+ }
+ }
+
+ /**
+ * An {@link IEvent event} fired when the {@link Type type} of a CDO repository has changed. This usually happens only
+ * for repository fail-over participants.
+ *
+ * @author Eike Stepper
+ * @noextend This interface is not intended to be extended by clients.
+ * @noimplement This interface is not intended to be implemented by clients.
+ */
+ public interface TypeChangedEvent extends IEvent
+ {
+ public Type getOldType();
+
+ public Type getNewType();
+ }
+
+ /**
+ * An {@link IEvent event} fired when the {@link State state} of a CDO repository has changed.
+ *
+ * @author Eike Stepper
+ * @noextend This interface is not intended to be extended by clients.
+ * @noimplement This interface is not intended to be implemented by clients.
+ */
+ public interface StateChangedEvent extends IEvent
+ {
+ public State getOldState();
+
+ public State getNewState();
+ }
+}
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 2c8751b5d7..c5a68c63c8 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
@@ -1,187 +1,187 @@
-/*
- * Copyright (c) 2004 - 2011 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;
-
-import org.eclipse.net4j.util.collection.Closeable;
-import org.eclipse.net4j.util.options.IOptions;
-import org.eclipse.net4j.util.options.IOptionsContainer;
-import org.eclipse.net4j.util.options.IOptionsEvent;
-import org.eclipse.net4j.util.security.IUserAware;
-
-/**
- * Abstracts the information about CDO sessions that is common to both client and server side.
- *
- * @author Eike Stepper
- * @since 2.0
- * @noextend This interface is not intended to be extended by clients.
- * @noimplement This interface is not intended to be implemented by clients.
- * @apiviz.landmark
- * @apiviz.composedOf {@link CDOCommonView} - - views
- * @apiviz.has {@link CDOCommonSession.Options}
- * @apiviz.uses {@link CDOCommonRepository} - - connectsTo
- */
-public interface CDOCommonSession extends IUserAware, IOptionsContainer, Closeable
-{
- public int getSessionID();
-
- public CDOCommonView[] getViews();
-
- public CDOCommonView getView(int viewID);
-
- /**
- * Returns the {@link Options options} of this session.
- */
- public Options options();
-
- /**
- * Encapsulates the configuration options of CDO sessions that are common to both client and server side.
- *
- * @author Simon McDuff
- * @noextend This interface is not intended to be extended by clients.
- * @noimplement This interface is not intended to be implemented by clients.
- * @apiviz.has CDOCommonSession.Options.PassiveUpdateMode
- * @apiviz.has CDOCommonSession.Options.LockNotificationMode
- */
- public interface Options extends IOptions
- {
- /**
- * Returns the {@link CDOCommonSession session} of this options object.
- *
- * @since 4.0
- */
- public CDOCommonSession getContainer();
-
- public boolean isPassiveUpdateEnabled();
-
- /**
- * Specifies whether objects will be invalidated due by other users changes.
- * <p>
- * Example:
- * <p>
- * <code>session.setPassiveUpdateEnabled(false);</code>
- * <p>
- * By default this property is enabled. If this property is disabled the latest versions of objects can still be
- * obtained by calling refresh().
- * <p>
- * Passive update can be disabled in cases where more performance is needed and/or more control over when objects
- * will be refreshed.
- * <p>
- * When enabled again, a refresh will be automatically performed to be in sync with the server.
- *
- * @since 3.0
- */
- public void setPassiveUpdateEnabled(boolean enabled);
-
- /**
- * @since 3.0
- */
- public PassiveUpdateMode getPassiveUpdateMode();
-
- /**
- * @since 3.0
- */
- public void setPassiveUpdateMode(PassiveUpdateMode mode);
-
- /**
- * @since 4.1
- */
- public LockNotificationMode getLockNotificationMode();
-
- /**
- * @since 4.1
- */
- public void setLockNotificationMode(LockNotificationMode mode);
-
- /**
- * Enumerates the possible {@link CDOCommonSession.Options#getPassiveUpdateMode() passive update modes} of a CDO
- * session.
- *
- * @author Eike Stepper
- * @since 3.0
- */
- public enum PassiveUpdateMode
- {
- /**
- * This mode delivers change deltas only for change subscriptions, invalidation information for all other objects.
- */
- INVALIDATIONS,
-
- /**
- * This mode delivers change deltas for all changed objects, whether they have change subscriptions or not.
- * Revisions for new objects are not delivered.
- */
- CHANGES,
-
- /**
- * This mode delivers change deltas for all changed objects, whether they have change subscriptions or not. In
- * addition full revisions for new objects are delivered.
- */
- ADDITIONS
- }
-
- /**
- * Enumerates the possible {@link CDOCommonSession.Options#getLockNotificationMode() lock notification modes} of a
- * CDO session.
- *
- * @since 4.1
- */
- public enum LockNotificationMode
- {
- /**
- * This mode delivers no lock notifications
- */
- OFF,
-
- /**
- * This mode delivers lock notifications if one or more views have enabled them.
- */
- IF_REQUIRED_BY_VIEWS,
-
- /**
- * This mode always delivers lock notifications, even if no views have them enabled, and even if no views are
- * open.
- */
- ALWAYS
- }
-
- /**
- * An {@link IOptionsEvent options event} fired when the {@link PassiveUpdateMode passive update mode} of a CDO
- * session has changed.
- *
- * @author Eike Stepper
- * @since 3.0
- */
- public interface PassiveUpdateEvent extends IOptionsEvent
- {
- public boolean getOldEnabled();
-
- public boolean getNewEnabled();
-
- public PassiveUpdateMode getOldMode();
-
- public PassiveUpdateMode getNewMode();
- }
-
- /**
- * An {@link IOptionsEvent options event} fired when the {@link LockNotificationMode lock notification mode} of a
- * CDO session has changed.
- *
- * @author Caspar De Groot
- * @since 4.1
- */
- public interface LockNotificationModeEvent extends IOptionsEvent
- {
- public LockNotificationMode getOldMode();
-
- public LockNotificationMode getNewMode();
- }
- }
-}
+/*
+ * Copyright (c) 2004 - 2012 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;
+
+import org.eclipse.net4j.util.collection.Closeable;
+import org.eclipse.net4j.util.options.IOptions;
+import org.eclipse.net4j.util.options.IOptionsContainer;
+import org.eclipse.net4j.util.options.IOptionsEvent;
+import org.eclipse.net4j.util.security.IUserAware;
+
+/**
+ * Abstracts the information about CDO sessions that is common to both client and server side.
+ *
+ * @author Eike Stepper
+ * @since 2.0
+ * @noextend This interface is not intended to be extended by clients.
+ * @noimplement This interface is not intended to be implemented by clients.
+ * @apiviz.landmark
+ * @apiviz.composedOf {@link CDOCommonView} - - views
+ * @apiviz.has {@link CDOCommonSession.Options}
+ * @apiviz.uses {@link CDOCommonRepository} - - connectsTo
+ */
+public interface CDOCommonSession extends IUserAware, IOptionsContainer, Closeable
+{
+ public int getSessionID();
+
+ public CDOCommonView[] getViews();
+
+ public CDOCommonView getView(int viewID);
+
+ /**
+ * Returns the {@link Options options} of this session.
+ */
+ public Options options();
+
+ /**
+ * Encapsulates the configuration options of CDO sessions that are common to both client and server side.
+ *
+ * @author Simon McDuff
+ * @noextend This interface is not intended to be extended by clients.
+ * @noimplement This interface is not intended to be implemented by clients.
+ * @apiviz.has CDOCommonSession.Options.PassiveUpdateMode
+ * @apiviz.has CDOCommonSession.Options.LockNotificationMode
+ */
+ public interface Options extends IOptions
+ {
+ /**
+ * Returns the {@link CDOCommonSession session} of this options object.
+ *
+ * @since 4.0
+ */
+ public CDOCommonSession getContainer();
+
+ public boolean isPassiveUpdateEnabled();
+
+ /**
+ * Specifies whether objects will be invalidated due by other users changes.
+ * <p>
+ * Example:
+ * <p>
+ * <code>session.setPassiveUpdateEnabled(false);</code>
+ * <p>
+ * By default this property is enabled. If this property is disabled the latest versions of objects can still be
+ * obtained by calling refresh().
+ * <p>
+ * Passive update can be disabled in cases where more performance is needed and/or more control over when objects
+ * will be refreshed.
+ * <p>
+ * When enabled again, a refresh will be automatically performed to be in sync with the server.
+ *
+ * @since 3.0
+ */
+ public void setPassiveUpdateEnabled(boolean enabled);
+
+ /**
+ * @since 3.0
+ */
+ public PassiveUpdateMode getPassiveUpdateMode();
+
+ /**
+ * @since 3.0
+ */
+ public void setPassiveUpdateMode(PassiveUpdateMode mode);
+
+ /**
+ * @since 4.1
+ */
+ public LockNotificationMode getLockNotificationMode();
+
+ /**
+ * @since 4.1
+ */
+ public void setLockNotificationMode(LockNotificationMode mode);
+
+ /**
+ * Enumerates the possible {@link CDOCommonSession.Options#getPassiveUpdateMode() passive update modes} of a CDO
+ * session.
+ *
+ * @author Eike Stepper
+ * @since 3.0
+ */
+ public enum PassiveUpdateMode
+ {
+ /**
+ * This mode delivers change deltas only for change subscriptions, invalidation information for all other objects.
+ */
+ INVALIDATIONS,
+
+ /**
+ * This mode delivers change deltas for all changed objects, whether they have change subscriptions or not.
+ * Revisions for new objects are not delivered.
+ */
+ CHANGES,
+
+ /**
+ * This mode delivers change deltas for all changed objects, whether they have change subscriptions or not. In
+ * addition full revisions for new objects are delivered.
+ */
+ ADDITIONS
+ }
+
+ /**
+ * Enumerates the possible {@link CDOCommonSession.Options#getLockNotificationMode() lock notification modes} of a
+ * CDO session.
+ *
+ * @since 4.1
+ */
+ public enum LockNotificationMode
+ {
+ /**
+ * This mode delivers no lock notifications
+ */
+ OFF,
+
+ /**
+ * This mode delivers lock notifications if one or more views have enabled them.
+ */
+ IF_REQUIRED_BY_VIEWS,
+
+ /**
+ * This mode always delivers lock notifications, even if no views have them enabled, and even if no views are
+ * open.
+ */
+ ALWAYS
+ }
+
+ /**
+ * An {@link IOptionsEvent options event} fired when the {@link PassiveUpdateMode passive update mode} of a CDO
+ * session has changed.
+ *
+ * @author Eike Stepper
+ * @since 3.0
+ */
+ public interface PassiveUpdateEvent extends IOptionsEvent
+ {
+ public boolean getOldEnabled();
+
+ public boolean getNewEnabled();
+
+ public PassiveUpdateMode getOldMode();
+
+ public PassiveUpdateMode getNewMode();
+ }
+
+ /**
+ * An {@link IOptionsEvent options event} fired when the {@link LockNotificationMode lock notification mode} of a
+ * CDO session has changed.
+ *
+ * @author Caspar De Groot
+ * @since 4.1
+ */
+ public interface LockNotificationModeEvent extends IOptionsEvent
+ {
+ public LockNotificationMode getOldMode();
+
+ public LockNotificationMode getNewMode();
+ }
+ }
+}
diff --git a/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/common/CDOCommonTransaction.java b/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/common/CDOCommonTransaction.java
index 32d7fa0c2d..ab4a051ff6 100644
--- a/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/common/CDOCommonTransaction.java
+++ b/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/common/CDOCommonTransaction.java
@@ -1,24 +1,24 @@
-/*
- * Copyright (c) 2004 - 2011 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;
-
-/**
- * Abstracts the information about CDO transactions that is common to both client and server side.
- *
- * @author Eike Stepper
- * @since 4.0
- * @noextend This interface is not intended to be extended by clients.
- * @noimplement This interface is not intended to be implemented by clients.
- * @apiviz.landmark
- */
-public interface CDOCommonTransaction extends CDOCommonView
-{
-}
+/*
+ * Copyright (c) 2004 - 2012 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;
+
+/**
+ * Abstracts the information about CDO transactions that is common to both client and server side.
+ *
+ * @author Eike Stepper
+ * @since 4.0
+ * @noextend This interface is not intended to be extended by clients.
+ * @noimplement This interface is not intended to be implemented by clients.
+ * @apiviz.landmark
+ */
+public interface CDOCommonTransaction extends CDOCommonView
+{
+}
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 057a5fc213..d0c826f77c 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
@@ -1,98 +1,98 @@
-/*
- * Copyright (c) 2004 - 2011 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;
-
-import org.eclipse.emf.cdo.common.branch.CDOBranchPoint;
-import org.eclipse.emf.cdo.common.lock.CDOLockState;
-import org.eclipse.emf.cdo.common.revision.CDORevisionProvider;
-
-import org.eclipse.net4j.util.collection.Closeable;
-import org.eclipse.net4j.util.event.IListener;
-import org.eclipse.net4j.util.options.IOptions;
-import org.eclipse.net4j.util.options.IOptionsContainer;
-import org.eclipse.net4j.util.options.IOptionsEvent;
-
-/**
- * Abstracts the information about CDO views that is common to both client and server side.
- *
- * @author Eike Stepper
- * @since 2.0
- * @noextend This interface is not intended to be extended by clients.
- * @noimplement This interface is not intended to be implemented by clients.
- * @apiviz.landmark
- * @apiviz.has {@link CDOCommonView.Options}
- */
-public interface CDOCommonView extends CDOBranchPoint, CDORevisionProvider, IOptionsContainer, Closeable
-{
- public int getViewID();
-
- /**
- * @since 3.0
- */
- public boolean isReadOnly();
-
- public CDOCommonSession getSession();
-
- /**
- * @since 4.0
- */
- public String getDurableLockingID();
-
- /**
- * Returns the {@link Options options} of this view.
- *
- * @since 4.1
- */
- public Options options();
-
- /**
- * Encapsulates the configuration options of CDO views that are common to both client and server side.
- *
- * @author Eike Stepper
- * @noextend This interface is not intended to be extended by clients.
- * @noimplement This interface is not intended to be implemented by clients.
- * @since 4.1
- * @apiviz.uses {@link CDOCommonView.Options.LockNotificationEvent} - - fires
- */
- public interface Options extends IOptions
- {
- /**
- * Returns <code>true</code> if this view will notify its {@link IListener listeners} about changes to the
- * {@link CDOLockState lock states} of the objects in this view (due to lock operations in <i>other</i> views),
- * <code>false</code> otherwise.
- *
- * @see CDOLockState
- */
- public boolean isLockNotificationEnabled();
-
- /**
- * Specifies whether this view will notify its {@link IListener listeners} about changes to the {@link CDOLockState
- * lock states} of the objects in this view (due to lock operations in <i>other</i> views), or not.
- *
- * @see CDOLockState
- */
- public void setLockNotificationEnabled(boolean enabled);
-
- /**
- * An {@link IOptionsEvent options event} fired from common view {@link CDOCommonView#options() options} when the
- * {@link Options#setLockNotificationEnabled(boolean) lock notification enabled} option has changed.
- *
- * @author Caspar De Groot
- * @noextend This interface is not intended to be extended by clients.
- * @noimplement This interface is not intended to be implemented by clients.
- * @since 4.1
- */
- public interface LockNotificationEvent extends IOptionsEvent
- {
- boolean getEnabled();
- }
- }
-}
+/*
+ * Copyright (c) 2004 - 2012 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;
+
+import org.eclipse.emf.cdo.common.branch.CDOBranchPoint;
+import org.eclipse.emf.cdo.common.lock.CDOLockState;
+import org.eclipse.emf.cdo.common.revision.CDORevisionProvider;
+
+import org.eclipse.net4j.util.collection.Closeable;
+import org.eclipse.net4j.util.event.IListener;
+import org.eclipse.net4j.util.options.IOptions;
+import org.eclipse.net4j.util.options.IOptionsContainer;
+import org.eclipse.net4j.util.options.IOptionsEvent;
+
+/**
+ * Abstracts the information about CDO views that is common to both client and server side.
+ *
+ * @author Eike Stepper
+ * @since 2.0
+ * @noextend This interface is not intended to be extended by clients.
+ * @noimplement This interface is not intended to be implemented by clients.
+ * @apiviz.landmark
+ * @apiviz.has {@link CDOCommonView.Options}
+ */
+public interface CDOCommonView extends CDOBranchPoint, CDORevisionProvider, IOptionsContainer, Closeable
+{
+ public int getViewID();
+
+ /**
+ * @since 3.0
+ */
+ public boolean isReadOnly();
+
+ public CDOCommonSession getSession();
+
+ /**
+ * @since 4.0
+ */
+ public String getDurableLockingID();
+
+ /**
+ * Returns the {@link Options options} of this view.
+ *
+ * @since 4.1
+ */
+ public Options options();
+
+ /**
+ * Encapsulates the configuration options of CDO views that are common to both client and server side.
+ *
+ * @author Eike Stepper
+ * @noextend This interface is not intended to be extended by clients.
+ * @noimplement This interface is not intended to be implemented by clients.
+ * @since 4.1
+ * @apiviz.uses {@link CDOCommonView.Options.LockNotificationEvent} - - fires
+ */
+ public interface Options extends IOptions
+ {
+ /**
+ * Returns <code>true</code> if this view will notify its {@link IListener listeners} about changes to the
+ * {@link CDOLockState lock states} of the objects in this view (due to lock operations in <i>other</i> views),
+ * <code>false</code> otherwise.
+ *
+ * @see CDOLockState
+ */
+ public boolean isLockNotificationEnabled();
+
+ /**
+ * Specifies whether this view will notify its {@link IListener listeners} about changes to the {@link CDOLockState
+ * lock states} of the objects in this view (due to lock operations in <i>other</i> views), or not.
+ *
+ * @see CDOLockState
+ */
+ public void setLockNotificationEnabled(boolean enabled);
+
+ /**
+ * An {@link IOptionsEvent options event} fired from common view {@link CDOCommonView#options() options} when the
+ * {@link Options#setLockNotificationEnabled(boolean) lock notification enabled} option has changed.
+ *
+ * @author Caspar De Groot
+ * @noextend This interface is not intended to be extended by clients.
+ * @noimplement This interface is not intended to be implemented by clients.
+ * @since 4.1
+ */
+ public interface LockNotificationEvent extends IOptionsEvent
+ {
+ boolean getEnabled();
+ }
+ }
+}
diff --git a/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/common/branch/CDOBranch.java b/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/common/branch/CDOBranch.java
index bccaaa62f6..afe328c786 100644
--- a/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/common/branch/CDOBranch.java
+++ b/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/common/branch/CDOBranch.java
@@ -1,185 +1,185 @@
-/*
- * Copyright (c) 2004 - 2011 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.branch;
-
-import org.eclipse.emf.cdo.common.CDOCommonRepository;
-import org.eclipse.emf.cdo.common.CDOCommonRepository.State;
-import org.eclipse.emf.cdo.common.commit.CDOCommitInfo;
-import org.eclipse.emf.cdo.common.util.CDOTimeProvider;
-
-import org.eclipse.net4j.util.container.IContainer;
-
-/**
- * Represents a <i>stream of changes</i> that is isolated from other streams of changes.
- * <p>
- * A branch starts at a fixed {@link #getBase() base} point and ends at a floating {@link #getHead() head} point.
- * Between these two points there can be a number of other {@link CDOBranchPoint branch points}:
- * <ul>
- * <li> {@link CDOCommitInfo Commit infos} are points in a branch that represent commit operations.
- * <li> {@link CDOBranchTag Branch tags} are named points in a branch.
- * <li> {@link #getBase() Base points } of sub branches of a branch.
- * </ul>
- *
- * @author Eike Stepper
- * @since 3.0
- * @noextend This interface is not intended to be extended by clients.
- * @noimplement This interface is not intended to be implemented by clients.
- * @apiviz.landmark
- * @apiviz.has {@link CDOBranchPoint} oneway - - base
- * @apiviz.composedOf {@link CDOBranch} - - subBranches
- */
-public interface CDOBranch extends IContainer<CDOBranch>, Comparable<CDOBranch>
-{
- /**
- * The fixed ID of the {@link CDOBranchManager#getMainBranch() main branch}.
- */
- public static final int MAIN_BRANCH_ID = 0;
-
- /**
- * The fixed name of the {@link CDOBranchManager#getMainBranch() main branch}.
- */
- public static final String MAIN_BRANCH_NAME = "MAIN"; //$NON-NLS-1$
-
- /**
- * The string used to separate the segments of branch paths.
- *
- * @see #getPathName()
- * @see #getBranch(String)
- * @see CDOBranchManager#getBranch(String)
- */
- public static final String PATH_SEPARATOR = "/"; //$NON-NLS-1$
-
- /**
- * Returns <code>true</code> if this branch is the {@link CDOBranchManager#getMainBranch() main branch},
- * <code>false</code> otherwise.
- */
- public boolean isMainBranch();
-
- /**
- * Returns <code>true</code> if this branch is a local branch, <code>false</code> otherwise.
- * <p>
- * Local branches are created on the fly when committing to a
- * {@link org.eclipse.emf.cdo.common.CDOCommonRepository.Type#CLONE clone} repository while it is in
- * {@link State#OFFLINE offline} state and they do not participate in repository replication. They can not be created
- * manually and they have negative {@link #getID() IDs}.
- */
- public boolean isLocal();
-
- /**
- * Returns the ID of this branch.
- * <p>
- * The {@link CDOBranchManager#getMainBranch() main branch} has the fixed ID 0 (zero), {@link #isLocal() Local
- * branches} have negative IDs and normal branches have positive IDs.
- */
- public int getID();
-
- /**
- * Returns the name of this branch as specified when it was created with {@link #createBranch(String, long)
- * createBranch()} or {@link #MAIN_BRANCH_NAME} if this branch is the {@link CDOBranchManager#getMainBranch() main
- * branch}.
- */
- public String getName();
-
- /**
- * Returns the fully qualified path name of this branch, a concatenation of the names of all branches from the
- * {@link CDOBranchManager#getMainBranch() main branch} to this branch, separated by {@link #PATH_SEPARATOR slashes}
- * ("/" characters). Example: "MAIN/team1/smith".
- */
- public String getPathName();
-
- /**
- * Returns an array of the {@link #getBase() base} branch points starting from the base of the
- * {@link CDOBranchManager#getMainBranch() main branch} down to and including the base of this branch.
- */
- public CDOBranchPoint[] getBasePath();
-
- /**
- * Returns the immutable base branch point of this branch, the point in the parent branch that marks the creation of
- * this branch.
- * <p>
- * The base of the {@link CDOBranchManager#getMainBranch() main branch} marks the creation of the
- * {@link CDOCommonRepository repository}.
- *
- * @see CDOBranch#getHead()
- * @see #getPoint(long)
- */
- public CDOBranchPoint getBase();
-
- /**
- * Returns the floating <i>end point</i> of this branch, a pair of this branch and the fixed special time stamp <i>
- * {@link CDOBranchPoint#UNSPECIFIED_DATE unspecified}</i>.
- *
- * @see CDOBranch#getBase()
- * @see #getPoint(long)
- */
- public CDOBranchPoint getHead();
-
- /**
- * Returns the branch point in this branch with the given time stamp.
- * <p>
- * This factory method never returns <code>null</code>.
- *
- * @see CDOBranch#getBase()
- * @see CDOBranch#getHead()
- * @see #getVersion(int)
- */
- public CDOBranchPoint getPoint(long timeStamp);
-
- /**
- * Returns the branch version in this branch with the given version number.
- * <p>
- * This factory method never returns <code>null</code>.
- *
- * @see #getPoint(long)
- */
- public CDOBranchVersion getVersion(int version);
-
- /**
- * Returns the branch manager that manages this branch, never <code>null</code>.
- */
- public CDOBranchManager getBranchManager();
-
- /**
- * Returns an array of the sub branches of this branch, never <code>null</code>.
- */
- public CDOBranch[] getBranches();
-
- /**
- * Returns the sub branch of this branch with the given relative path, or <code>null</code> if no sub branch with this
- * path exists in this branch.
- * <p>
- * The path name is the concatenation of the names of all branches from a direct sub branch of this branch, separated
- * by {@link #PATH_SEPARATOR slashes} ("/" characters). Example: "team1/smith".
- */
- public CDOBranch getBranch(String path);
-
- /**
- * Creates a sub branch of this branch with the given name, {@link #getBase() based} at the {@link CDOBranchPoint
- * branch point} in this branch with the given time stamp.
- * <p>
- *
- * @param name
- * The name of the sub branch to be created. It must not contain the {@link #PATH_SEPARATOR path separator}
- * character (slash).
- * @param timeStamp
- * The time stamp in this branch that the sub branch to be created is supposed to be {@link #getBase() based
- * at}. It must not be before the base time stamp of this branch and it must be different from the fixed
- * special time stamp <i> {@link CDOBranchPoint#UNSPECIFIED_DATE unspecified}</i>
- * @see #createBranch(String)
- */
- public CDOBranch createBranch(String name, long timeStamp);
-
- /**
- * Creates a sub branch of this branch with the given name, {@link #getBase() based} at the {@link CDOTimeProvider
- * current time}.
- */
- public CDOBranch createBranch(String name);
-}
+/*
+ * Copyright (c) 2004 - 2012 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.branch;
+
+import org.eclipse.emf.cdo.common.CDOCommonRepository;
+import org.eclipse.emf.cdo.common.CDOCommonRepository.State;
+import org.eclipse.emf.cdo.common.commit.CDOCommitInfo;
+import org.eclipse.emf.cdo.common.util.CDOTimeProvider;
+
+import org.eclipse.net4j.util.container.IContainer;
+
+/**
+ * Represents a <i>stream of changes</i> that is isolated from other streams of changes.
+ * <p>
+ * A branch starts at a fixed {@link #getBase() base} point and ends at a floating {@link #getHead() head} point.
+ * Between these two points there can be a number of other {@link CDOBranchPoint branch points}:
+ * <ul>
+ * <li> {@link CDOCommitInfo Commit infos} are points in a branch that represent commit operations.
+ * <li> {@link CDOBranchTag Branch tags} are named points in a branch.
+ * <li> {@link #getBase() Base points } of sub branches of a branch.
+ * </ul>
+ *
+ * @author Eike Stepper
+ * @since 3.0
+ * @noextend This interface is not intended to be extended by clients.
+ * @noimplement This interface is not intended to be implemented by clients.
+ * @apiviz.landmark
+ * @apiviz.has {@link CDOBranchPoint} oneway - - base
+ * @apiviz.composedOf {@link CDOBranch} - - subBranches
+ */
+public interface CDOBranch extends IContainer<CDOBranch>, Comparable<CDOBranch>
+{
+ /**
+ * The fixed ID of the {@link CDOBranchManager#getMainBranch() main branch}.
+ */
+ public static final int MAIN_BRANCH_ID = 0;
+
+ /**
+ * The fixed name of the {@link CDOBranchManager#getMainBranch() main branch}.
+ */
+ public static final String MAIN_BRANCH_NAME = "MAIN"; //$NON-NLS-1$
+
+ /**
+ * The string used to separate the segments of branch paths.
+ *
+ * @see #getPathName()
+ * @see #getBranch(String)
+ * @see CDOBranchManager#getBranch(String)
+ */
+ public static final String PATH_SEPARATOR = "/"; //$NON-NLS-1$
+
+ /**
+ * Returns <code>true</code> if this branch is the {@link CDOBranchManager#getMainBranch() main branch},
+ * <code>false</code> otherwise.
+ */
+ public boolean isMainBranch();
+
+ /**
+ * Returns <code>true</code> if this branch is a local branch, <code>false</code> otherwise.
+ * <p>
+ * Local branches are created on the fly when committing to a
+ * {@link org.eclipse.emf.cdo.common.CDOCommonRepository.Type#CLONE clone} repository while it is in
+ * {@link State#OFFLINE offline} state and they do not participate in repository replication. They can not be created
+ * manually and they have negative {@link #getID() IDs}.
+ */
+ public boolean isLocal();
+
+ /**
+ * Returns the ID of this branch.
+ * <p>
+ * The {@link CDOBranchManager#getMainBranch() main branch} has the fixed ID 0 (zero), {@link #isLocal() Local
+ * branches} have negative IDs and normal branches have positive IDs.
+ */
+ public int getID();
+
+ /**
+ * Returns the name of this branch as specified when it was created with {@link #createBranch(String, long)
+ * createBranch()} or {@link #MAIN_BRANCH_NAME} if this branch is the {@link CDOBranchManager#getMainBranch() main
+ * branch}.
+ */
+ public String getName();
+
+ /**
+ * Returns the fully qualified path name of this branch, a concatenation of the names of all branches from the
+ * {@link CDOBranchManager#getMainBranch() main branch} to this branch, separated by {@link #PATH_SEPARATOR slashes}
+ * ("/" characters). Example: "MAIN/team1/smith".
+ */
+ public String getPathName();
+
+ /**
+ * Returns an array of the {@link #getBase() base} branch points starting from the base of the
+ * {@link CDOBranchManager#getMainBranch() main branch} down to and including the base of this branch.
+ */
+ public CDOBranchPoint[] getBasePath();
+
+ /**
+ * Returns the immutable base branch point of this branch, the point in the parent branch that marks the creation of
+ * this branch.
+ * <p>
+ * The base of the {@link CDOBranchManager#getMainBranch() main branch} marks the creation of the
+ * {@link CDOCommonRepository repository}.
+ *
+ * @see CDOBranch#getHead()
+ * @see #getPoint(long)
+ */
+ public CDOBranchPoint getBase();
+
+ /**
+ * Returns the floating <i>end point</i> of this branch, a pair of this branch and the fixed special time stamp <i>
+ * {@link CDOBranchPoint#UNSPECIFIED_DATE unspecified}</i>.
+ *
+ * @see CDOBranch#getBase()
+ * @see #getPoint(long)
+ */
+ public CDOBranchPoint getHead();
+
+ /**
+ * Returns the branch point in this branch with the given time stamp.
+ * <p>
+ * This factory method never returns <code>null</code>.
+ *
+ * @see CDOBranch#getBase()
+ * @see CDOBranch#getHead()
+ * @see #getVersion(int)
+ */
+ public CDOBranchPoint getPoint(long timeStamp);
+
+ /**
+ * Returns the branch version in this branch with the given version number.
+ * <p>
+ * This factory method never returns <code>null</code>.
+ *
+ * @see #getPoint(long)
+ */
+ public CDOBranchVersion getVersion(int version);
+
+ /**
+ * Returns the branch manager that manages this branch, never <code>null</code>.
+ */
+ public CDOBranchManager getBranchManager();
+
+ /**
+ * Returns an array of the sub branches of this branch, never <code>null</code>.
+ */
+ public CDOBranch[] getBranches();
+
+ /**
+ * Returns the sub branch of this branch with the given relative path, or <code>null</code> if no sub branch with this
+ * path exists in this branch.
+ * <p>
+ * The path name is the concatenation of the names of all branches from a direct sub branch of this branch, separated
+ * by {@link #PATH_SEPARATOR slashes} ("/" characters). Example: "team1/smith".
+ */
+ public CDOBranch getBranch(String path);
+
+ /**
+ * Creates a sub branch of this branch with the given name, {@link #getBase() based} at the {@link CDOBranchPoint
+ * branch point} in this branch with the given time stamp.
+ * <p>
+ *
+ * @param name
+ * The name of the sub branch to be created. It must not contain the {@link #PATH_SEPARATOR path separator}
+ * character (slash).
+ * @param timeStamp
+ * The time stamp in this branch that the sub branch to be created is supposed to be {@link #getBase() based
+ * at}. It must not be before the base time stamp of this branch and it must be different from the fixed
+ * special time stamp <i> {@link CDOBranchPoint#UNSPECIFIED_DATE unspecified}</i>
+ * @see #createBranch(String)
+ */
+ public CDOBranch createBranch(String name, long timeStamp);
+
+ /**
+ * Creates a sub branch of this branch with the given name, {@link #getBase() based} at the {@link CDOTimeProvider
+ * current time}.
+ */
+ public CDOBranch createBranch(String name);
+}
diff --git a/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/common/branch/CDOBranchCreatedEvent.java b/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/common/branch/CDOBranchCreatedEvent.java
index f3969fc540..f0f755ee9e 100644
--- a/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/common/branch/CDOBranchCreatedEvent.java
+++ b/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/common/branch/CDOBranchCreatedEvent.java
@@ -1,29 +1,29 @@
-/*
- * Copyright (c) 2004 - 2011 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.branch;
-
-import org.eclipse.net4j.util.event.IEvent;
-
-/**
- * An {@link IEvent event} fired from a {@link CDOBranchManager branch manager} when a new {@link CDOBranch branch} has
- * been created.
- *
- * @author Eike Stepper
- * @since 3.0
- * @noextend This interface is not intended to be extended by clients.
- * @noimplement This interface is not intended to be implemented by clients.
- */
-public interface CDOBranchCreatedEvent extends IEvent
-{
- public CDOBranchManager getSource();
-
- public CDOBranch getBranch();
-}
+/*
+ * Copyright (c) 2004 - 2012 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.branch;
+
+import org.eclipse.net4j.util.event.IEvent;
+
+/**
+ * An {@link IEvent event} fired from a {@link CDOBranchManager branch manager} when a new {@link CDOBranch branch} has
+ * been created.
+ *
+ * @author Eike Stepper
+ * @since 3.0
+ * @noextend This interface is not intended to be extended by clients.
+ * @noimplement This interface is not intended to be implemented by clients.
+ */
+public interface CDOBranchCreatedEvent extends IEvent
+{
+ public CDOBranchManager getSource();
+
+ public CDOBranch getBranch();
+}
diff --git a/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/common/branch/CDOBranchHandler.java b/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/common/branch/CDOBranchHandler.java
index 2310503156..4299176b90 100644
--- a/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/common/branch/CDOBranchHandler.java
+++ b/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/common/branch/CDOBranchHandler.java
@@ -1,27 +1,27 @@
-/*
- * Copyright (c) 2004 - 2011 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.branch;
-
-/**
- * A call-back interface that indicates the ability to <i>handle</i> branches that are passed from other entities.
- *
- * @see CDOBranchManager#getBranches(int, int, CDOBranchHandler)
- * @author Eike Stepper
- * @since 3.0
- * @apiviz.uses {@link CDOBranch} - - handles
- */
-public interface CDOBranchHandler
-{
- /**
- * A call-back method that other entities can pass branches to.
- */
- public void handleBranch(CDOBranch branch);
-}
+/*
+ * Copyright (c) 2004 - 2012 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.branch;
+
+/**
+ * A call-back interface that indicates the ability to <i>handle</i> branches that are passed from other entities.
+ *
+ * @see CDOBranchManager#getBranches(int, int, CDOBranchHandler)
+ * @author Eike Stepper
+ * @since 3.0
+ * @apiviz.uses {@link CDOBranch} - - handles
+ */
+public interface CDOBranchHandler
+{
+ /**
+ * A call-back method that other entities can pass branches to.
+ */
+ public void handleBranch(CDOBranch branch);
+}
diff --git a/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/common/branch/CDOBranchManager.java b/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/common/branch/CDOBranchManager.java
index f6e4d8d88d..4274ca75e0 100644
--- a/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/common/branch/CDOBranchManager.java
+++ b/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/common/branch/CDOBranchManager.java
@@ -1,79 +1,79 @@
-/*
- * Copyright (c) 2004 - 2011 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.branch;
-
-import org.eclipse.net4j.util.event.INotifier;
-
-/**
- * Manages a tree of {@link CDOBranch branches} and notifies about changes in this branch tree.
- * <p>
- * The branch tree is represented by a {@link #getMainBranch() main} branch, which, like all
- * {@link CDOBranch#getBranches() sub} branches, offers the major part of the branching functionality. A branch manager
- * provides additional methods to find branches by their unique integer ID or by their fully qualified path name, as
- * well as asynchronous bulk queries.
- * <p>
- * A branch manager can fire the following events:
- * <ul>
- * <li> {@link CDOBranchCreatedEvent} after a new branch has been created.
- * </ul>
- * <p>
- * Branch managers are usually associated with the following entities:
- * <ul>
- * <li> <code>org.eclipse.emf.cdo.session.CDOSession</code>
- * <li> <code>org.eclipse.emf.cdo.server.IRepository</code>
- * </ul>
- *
- * @author Eike Stepper
- * @since 3.0
- * @noextend This interface is not intended to be extended by clients.
- * @noimplement This interface is not intended to be implemented by clients.
- * @apiviz.landmark
- * @apiviz.has {@link CDOBranch} oneway - - mainBranch
- * @apiviz.uses {@link CDOBranchCreatedEvent} - - fires
- */
-public interface CDOBranchManager extends INotifier
-{
- /**
- * Returns the main branch of the branch tree managed by this branch manager.
- * <p>
- * The main branch has the fixed {@link CDOBranch#MAIN_BRANCH_NAME name} "MAIN" and the fixed
- * {@link CDOBranch#MAIN_BRANCH_ID ID} 0 (zero).
- */
- public CDOBranch getMainBranch();
-
- /**
- * Returns the branch with the given unique integer ID.
- * <p>
- * Note that this method never returns <code>null</code>. Due to the lazy loading nature of branch managers this
- * method returns a transparent <i>branch proxy</i> if the branch is not already loaded in the internal <i>branch
- * cache</i>. This can result in unchecked exceptions being thrown from calls to arbitrary branch methods if the ID
- * that the proxy was created with does not exist in the branch tree.
- */
- public CDOBranch getBranch(int branchID);
-
- /**
- * Returns the branch with the given absolute path.
- *
- * @param path
- * A concatenation of the names of all branches from the {@link #getMainBranch() main branch} to the
- * requested branch, separated by {@link CDOBranch#PATH_SEPARATOR slashes} ("/" characters). Example:
- * "MAIN/team1/smith".
- */
- public CDOBranch getBranch(String path);
-
- /**
- * Passes all branches with IDs in the given range to the given {@link CDOBranchHandler#handleBranch(CDOBranch) branch
- * handler} and returns the number of handler invocations.
- * <p>
- * This is a blocking call.
- */
- public int getBranches(int startID, int endID, CDOBranchHandler handler);
-}
+/*
+ * Copyright (c) 2004 - 2012 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.branch;
+
+import org.eclipse.net4j.util.event.INotifier;
+
+/**
+ * Manages a tree of {@link CDOBranch branches} and notifies about changes in this branch tree.
+ * <p>
+ * The branch tree is represented by a {@link #getMainBranch() main} branch, which, like all
+ * {@link CDOBranch#getBranches() sub} branches, offers the major part of the branching functionality. A branch manager
+ * provides additional methods to find branches by their unique integer ID or by their fully qualified path name, as
+ * well as asynchronous bulk queries.
+ * <p>
+ * A branch manager can fire the following events:
+ * <ul>
+ * <li> {@link CDOBranchCreatedEvent} after a new branch has been created.
+ * </ul>
+ * <p>
+ * Branch managers are usually associated with the following entities:
+ * <ul>
+ * <li> <code>org.eclipse.emf.cdo.session.CDOSession</code>
+ * <li> <code>org.eclipse.emf.cdo.server.IRepository</code>
+ * </ul>
+ *
+ * @author Eike Stepper
+ * @since 3.0
+ * @noextend This interface is not intended to be extended by clients.
+ * @noimplement This interface is not intended to be implemented by clients.
+ * @apiviz.landmark
+ * @apiviz.has {@link CDOBranch} oneway - - mainBranch
+ * @apiviz.uses {@link CDOBranchCreatedEvent} - - fires
+ */
+public interface CDOBranchManager extends INotifier
+{
+ /**
+ * Returns the main branch of the branch tree managed by this branch manager.
+ * <p>
+ * The main branch has the fixed {@link CDOBranch#MAIN_BRANCH_NAME name} "MAIN" and the fixed
+ * {@link CDOBranch#MAIN_BRANCH_ID ID} 0 (zero).
+ */
+ public CDOBranch getMainBranch();
+
+ /**
+ * Returns the branch with the given unique integer ID.
+ * <p>
+ * Note that this method never returns <code>null</code>. Due to the lazy loading nature of branch managers this
+ * method returns a transparent <i>branch proxy</i> if the branch is not already loaded in the internal <i>branch
+ * cache</i>. This can result in unchecked exceptions being thrown from calls to arbitrary branch methods if the ID
+ * that the proxy was created with does not exist in the branch tree.
+ */
+ public CDOBranch getBranch(int branchID);
+
+ /**
+ * Returns the branch with the given absolute path.
+ *
+ * @param path
+ * A concatenation of the names of all branches from the {@link #getMainBranch() main branch} to the
+ * requested branch, separated by {@link CDOBranch#PATH_SEPARATOR slashes} ("/" characters). Example:
+ * "MAIN/team1/smith".
+ */
+ public CDOBranch getBranch(String path);
+
+ /**
+ * Passes all branches with IDs in the given range to the given {@link CDOBranchHandler#handleBranch(CDOBranch) branch
+ * handler} and returns the number of handler invocations.
+ * <p>
+ * This is a blocking call.
+ */
+ public int getBranches(int startID, int endID, CDOBranchHandler handler);
+}
diff --git a/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/common/branch/CDOBranchPoint.java b/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/common/branch/CDOBranchPoint.java
index 80da9a4dec..ac4ba9b7dd 100644
--- a/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/common/branch/CDOBranchPoint.java
+++ b/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/common/branch/CDOBranchPoint.java
@@ -1,59 +1,59 @@
-/*
- * Copyright (c) 2004 - 2011 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.branch;
-
-import org.eclipse.emf.cdo.common.commit.CDOCommitInfo;
-import org.eclipse.emf.cdo.spi.common.branch.CDOBranchUtil;
-
-/**
- * A {@link #getTimeStamp() point in time} in a particular {@link #getBranch() branch}.
- *
- * @see CDOCommitInfo
- * @see CDOBranchTag
- * @see CDOBranch#getBase()
- * @see CDOBranch#getHead()
- * @see CDOBranch#getPoint(long)
- * @see CDOBranchUtil#copyBranchPoint(CDOBranchPoint)
- * @author Eike Stepper
- * @since 3.0
- * @noextend This interface is not intended to be extended by clients.
- * @noimplement This interface is not intended to be implemented by clients.
- * @apiviz.has {@link CDOBranch}
- */
-public interface CDOBranchPoint
-{
- /**
- * The fixed special time stamp <i>unspecified</i>.
- *
- * @see CDOBranch#getHead()
- */
- public static final long UNSPECIFIED_DATE = 0;
-
- /**
- * The fixed special time stamp <i>invalid</i>.
- *
- * @since 4.0
- */
- public static final long INVALID_DATE = -1;
-
- /**
- * Returns the branch of this branch point, or <code>null</code> if this branch point is the
- * {@link CDOBranch#getBase() base} of the {@link CDOBranchManager#getMainBranch() main branch}.
- */
- public CDOBranch getBranch();
-
- /**
- * Returns the time stamp of this branch point, or the fixed special time stamp <i>
- * {@link CDOBranchPoint#UNSPECIFIED_DATE unspecified}</i> if this branch point marks the {@link CDOBranch#getHead()
- * head} of a branch.
- */
- public long getTimeStamp();
-}
+/*
+ * Copyright (c) 2004 - 2012 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.branch;
+
+import org.eclipse.emf.cdo.common.commit.CDOCommitInfo;
+import org.eclipse.emf.cdo.spi.common.branch.CDOBranchUtil;
+
+/**
+ * A {@link #getTimeStamp() point in time} in a particular {@link #getBranch() branch}.
+ *
+ * @see CDOCommitInfo
+ * @see CDOBranchTag
+ * @see CDOBranch#getBase()
+ * @see CDOBranch#getHead()
+ * @see CDOBranch#getPoint(long)
+ * @see CDOBranchUtil#copyBranchPoint(CDOBranchPoint)
+ * @author Eike Stepper
+ * @since 3.0
+ * @noextend This interface is not intended to be extended by clients.
+ * @noimplement This interface is not intended to be implemented by clients.
+ * @apiviz.has {@link CDOBranch}
+ */
+public interface CDOBranchPoint
+{
+ /**
+ * The fixed special time stamp <i>unspecified</i>.
+ *
+ * @see CDOBranch#getHead()
+ */
+ public static final long UNSPECIFIED_DATE = 0;
+
+ /**
+ * The fixed special time stamp <i>invalid</i>.
+ *
+ * @since 4.0
+ */
+ public static final long INVALID_DATE = -1;
+
+ /**
+ * Returns the branch of this branch point, or <code>null</code> if this branch point is the
+ * {@link CDOBranch#getBase() base} of the {@link CDOBranchManager#getMainBranch() main branch}.
+ */
+ public CDOBranch getBranch();
+
+ /**
+ * Returns the time stamp of this branch point, or the fixed special time stamp <i>
+ * {@link CDOBranchPoint#UNSPECIFIED_DATE unspecified}</i> if this branch point marks the {@link CDOBranch#getHead()
+ * head} of a branch.
+ */
+ public long getTimeStamp();
+}
diff --git a/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/common/branch/CDOBranchPointRange.java b/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/common/branch/CDOBranchPointRange.java
index 28c2c9cfbb..dd80e94871 100644
--- a/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/common/branch/CDOBranchPointRange.java
+++ b/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/common/branch/CDOBranchPointRange.java
@@ -1,44 +1,44 @@
-/*
- * Copyright (c) 2004 - 2011 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.branch;
-
-import org.eclipse.emf.cdo.common.commit.CDOChangeSet;
-import org.eclipse.emf.cdo.spi.common.branch.CDOBranchUtil;
-
-/**
- * A range between the {@link CDOBranch#getBase() base} of the {@link CDOBranchManager#getMainBranch() main branch} and
- * the {@link CDOBranch#getHead() head} of any branch that is demarkated by a {@link #getStartPoint() start point} and
- * an {@link #getEndPoint() end point}.
- * <p>
- * The start point and the end point of a branch point range may have different branches or not.
- * <p>
- * Branch point ranges are usually created with {@link CDOBranchUtil#createRange(CDOBranchPoint, CDOBranchPoint)
- * CDOBranchUtil.createRange()} and often used in the context of {@link CDOChangeSet change sets}.
- *
- * @author Eike Stepper
- * @since 3.0
- * @noextend This interface is not intended to be extended by clients.
- * @noimplement This interface is not intended to be implemented by clients.
- * @apiviz.has {@link CDOBranchPoint} oneway - - start
- * @apiviz.has {@link CDOBranchPoint} oneway - - end
- */
-public interface CDOBranchPointRange
-{
- /**
- * Returns the start point of this branch point range, never <code>null</code>.
- */
- public CDOBranchPoint getStartPoint();
-
- /**
- * Returns the end point of this branch point range, never <code>null</code>.
- */
- public CDOBranchPoint getEndPoint();
-}
+/*
+ * Copyright (c) 2004 - 2012 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.branch;
+
+import org.eclipse.emf.cdo.common.commit.CDOChangeSet;
+import org.eclipse.emf.cdo.spi.common.branch.CDOBranchUtil;
+
+/**
+ * A range between the {@link CDOBranch#getBase() base} of the {@link CDOBranchManager#getMainBranch() main branch} and
+ * the {@link CDOBranch#getHead() head} of any branch that is demarkated by a {@link #getStartPoint() start point} and
+ * an {@link #getEndPoint() end point}.
+ * <p>
+ * The start point and the end point of a branch point range may have different branches or not.
+ * <p>
+ * Branch point ranges are usually created with {@link CDOBranchUtil#createRange(CDOBranchPoint, CDOBranchPoint)
+ * CDOBranchUtil.createRange()} and often used in the context of {@link CDOChangeSet change sets}.
+ *
+ * @author Eike Stepper
+ * @since 3.0
+ * @noextend This interface is not intended to be extended by clients.
+ * @noimplement This interface is not intended to be implemented by clients.
+ * @apiviz.has {@link CDOBranchPoint} oneway - - start
+ * @apiviz.has {@link CDOBranchPoint} oneway - - end
+ */
+public interface CDOBranchPointRange
+{
+ /**
+ * Returns the start point of this branch point range, never <code>null</code>.
+ */
+ public CDOBranchPoint getStartPoint();
+
+ /**
+ * Returns the end point of this branch point range, never <code>null</code>.
+ */
+ public CDOBranchPoint getEndPoint();
+}
diff --git a/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/common/branch/CDOBranchTag.java b/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/common/branch/CDOBranchTag.java
index a7113d3c67..7ba2e64fd0 100644
--- a/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/common/branch/CDOBranchTag.java
+++ b/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/common/branch/CDOBranchTag.java
@@ -1,27 +1,27 @@
-/*
- * Copyright (c) 2004 - 2011 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.branch;
-
-/**
- * A named {@link CDOBranchPoint branch point}.
- *
- * @author Eike Stepper
- * @since 3.0
- * @noextend This interface is not intended to be extended by clients.
- * @noimplement This interface is not intended to be implemented by clients.
- */
-public interface CDOBranchTag extends CDOBranchPoint
-{
- /**
- * Returns the name of this branch tag.
- */
- public String getName();
-}
+/*
+ * Copyright (c) 2004 - 2012 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.branch;
+
+/**
+ * A named {@link CDOBranchPoint branch point}.
+ *
+ * @author Eike Stepper
+ * @since 3.0
+ * @noextend This interface is not intended to be extended by clients.
+ * @noimplement This interface is not intended to be implemented by clients.
+ */
+public interface CDOBranchTag extends CDOBranchPoint
+{
+ /**
+ * Returns the name of this branch tag.
+ */
+ public String getName();
+}
diff --git a/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/common/branch/CDOBranchVersion.java b/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/common/branch/CDOBranchVersion.java
index d98957e586..78f1153c41 100644
--- a/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/common/branch/CDOBranchVersion.java
+++ b/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/common/branch/CDOBranchVersion.java
@@ -1,53 +1,53 @@
-/*
- * Copyright (c) 2004 - 2011 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.branch;
-
-import org.eclipse.emf.cdo.common.id.CDOID;
-import org.eclipse.emf.cdo.common.revision.CDORevision;
-import org.eclipse.emf.cdo.common.revision.CDORevisionManager;
-
-/**
- * A pair of a {@link #getBranch() branch} and an integer {@link #getVersion() version} number.
- * <p>
- * It is often used in the context of
- * {@link CDORevisionManager#getRevisionByVersion(CDOID, CDOBranchVersion, int, boolean)
- * CDORevisionManager.getRevisionByVersion()}.
- *
- * @see CDOBranch#getVersion(int)
- * @author Eike Stepper
- * @since 3.0
- * @noextend This interface is not intended to be extended by clients.
- * @noimplement This interface is not intended to be implemented by clients.
- * @apiviz.has {@link CDOBranch}
- */
-public interface CDOBranchVersion
-{
- /**
- * The fixed special version number <i>unspecified</i>.
- */
- public static final int UNSPECIFIED_VERSION = 0;
-
- /**
- * The fixed version number that is assigned to the first {@link CDORevision revision} of an {@link CDOID object} that
- * is committed to a particular branch .
- */
- public static final int FIRST_VERSION = 1;
-
- /**
- * Returns the branch of this branch version.
- */
- public CDOBranch getBranch();
-
- /**
- * Returns the version number of this branch version.
- */
- public int getVersion();
-}
+/*
+ * Copyright (c) 2004 - 2012 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.branch;
+
+import org.eclipse.emf.cdo.common.id.CDOID;
+import org.eclipse.emf.cdo.common.revision.CDORevision;
+import org.eclipse.emf.cdo.common.revision.CDORevisionManager;
+
+/**
+ * A pair of a {@link #getBranch() branch} and an integer {@link #getVersion() version} number.
+ * <p>
+ * It is often used in the context of
+ * {@link CDORevisionManager#getRevisionByVersion(CDOID, CDOBranchVersion, int, boolean)
+ * CDORevisionManager.getRevisionByVersion()}.
+ *
+ * @see CDOBranch#getVersion(int)
+ * @author Eike Stepper
+ * @since 3.0
+ * @noextend This interface is not intended to be extended by clients.
+ * @noimplement This interface is not intended to be implemented by clients.
+ * @apiviz.has {@link CDOBranch}
+ */
+public interface CDOBranchVersion
+{
+ /**
+ * The fixed special version number <i>unspecified</i>.
+ */
+ public static final int UNSPECIFIED_VERSION = 0;
+
+ /**
+ * The fixed version number that is assigned to the first {@link CDORevision revision} of an {@link CDOID object} that
+ * is committed to a particular branch .
+ */
+ public static final int FIRST_VERSION = 1;
+
+ /**
+ * Returns the branch of this branch version.
+ */
+ public CDOBranch getBranch();
+
+ /**
+ * Returns the version number of this branch version.
+ */
+ public int getVersion();
+}
diff --git a/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/common/branch/package-info.java b/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/common/branch/package-info.java
index a3974bdde3..e30279294b 100644
--- a/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/common/branch/package-info.java
+++ b/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/common/branch/package-info.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2004 - 2011 Eike Stepper (Berlin, Germany) and others.
+ * Copyright (c) 2004 - 2012 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
diff --git a/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/common/commit/CDOChangeKind.java b/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/common/commit/CDOChangeKind.java
index b8b8fa7e0b..4fdabd758b 100644
--- a/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/common/commit/CDOChangeKind.java
+++ b/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/common/commit/CDOChangeKind.java
@@ -1,23 +1,23 @@
-/*
- * Copyright (c) 2004 - 2011 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.commit;
-
-/**
- * Enumerates possible change kinds.
- *
- * @author Eike Stepper
- * @since 4.0
- * @noextend This interface is not intended to be extended by clients.
- */
-public enum CDOChangeKind
-{
- NEW, CHANGED, DETACHED
-}
+/*
+ * Copyright (c) 2004 - 2012 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.commit;
+
+/**
+ * Enumerates possible change kinds.
+ *
+ * @author Eike Stepper
+ * @since 4.0
+ * @noextend This interface is not intended to be extended by clients.
+ */
+public enum CDOChangeKind
+{
+ NEW, CHANGED, DETACHED
+}
diff --git a/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/common/commit/CDOChangeKindProvider.java b/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/common/commit/CDOChangeKindProvider.java
index 38fddf677f..2c76354da2 100644
--- a/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/common/commit/CDOChangeKindProvider.java
+++ b/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/common/commit/CDOChangeKindProvider.java
@@ -1,25 +1,25 @@
-/*
- * Copyright (c) 2004 - 2011 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.commit;
-
-import org.eclipse.emf.cdo.common.id.CDOID;
-
-/**
- * Generic provider for the kinds of changes that have been applied to objects.
- *
- * @author Eike Stepper
- * @since 4.0
- * @apiviz.uses {@link CDOChangeKind} - - provides
- */
-public interface CDOChangeKindProvider
-{
- public CDOChangeKind getChangeKind(CDOID id);
-}
+/*
+ * Copyright (c) 2004 - 2012 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.commit;
+
+import org.eclipse.emf.cdo.common.id.CDOID;
+
+/**
+ * Generic provider for the kinds of changes that have been applied to objects.
+ *
+ * @author Eike Stepper
+ * @since 4.0
+ * @apiviz.uses {@link CDOChangeKind} - - provides
+ */
+public interface CDOChangeKindProvider
+{
+ public CDOChangeKind getChangeKind(CDOID id);
+}
diff --git a/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/common/commit/CDOChangeSet.java b/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/common/commit/CDOChangeSet.java
index c54a90c61f..c36e8a6c48 100644
--- a/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/common/commit/CDOChangeSet.java
+++ b/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/common/commit/CDOChangeSet.java
@@ -1,28 +1,28 @@
-/*
- * Copyright (c) 2004 - 2011 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.commit;
-
-import org.eclipse.emf.cdo.common.branch.CDOBranchPoint;
-import org.eclipse.emf.cdo.common.branch.CDOBranchPointRange;
-
-/**
- * The {@link CDOChangeSetData change set data} between two {@link CDOBranchPointRange branch points} with a common
- * ancestor.
- *
- * @author Eike Stepper
- * @since 3.0
- * @noextend This interface is not intended to be extended by clients.
- * @noimplement This interface is not intended to be implemented by clients.
- */
-public interface CDOChangeSet extends CDOBranchPointRange, CDOChangeSetData
-{
- public CDOBranchPoint getAncestorPoint();
-}
+/*
+ * Copyright (c) 2004 - 2012 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.commit;
+
+import org.eclipse.emf.cdo.common.branch.CDOBranchPoint;
+import org.eclipse.emf.cdo.common.branch.CDOBranchPointRange;
+
+/**
+ * The {@link CDOChangeSetData change set data} between two {@link CDOBranchPointRange branch points} with a common
+ * ancestor.
+ *
+ * @author Eike Stepper
+ * @since 3.0
+ * @noextend This interface is not intended to be extended by clients.
+ * @noimplement This interface is not intended to be implemented by clients.
+ */
+public interface CDOChangeSet extends CDOBranchPointRange, CDOChangeSetData
+{
+ public CDOBranchPoint getAncestorPoint();
+}
diff --git a/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/common/commit/CDOChangeSetData.java b/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/common/commit/CDOChangeSetData.java
index 05b36d2ff0..b9cdb068e4 100644
--- a/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/common/commit/CDOChangeSetData.java
+++ b/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/common/commit/CDOChangeSetData.java
@@ -1,78 +1,78 @@
-/*
- * Copyright (c) 2004 - 2011 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.commit;
-
-import org.eclipse.emf.cdo.common.branch.CDOBranchVersion;
-import org.eclipse.emf.cdo.common.id.CDOID;
-import org.eclipse.emf.cdo.common.revision.CDOIDAndVersion;
-import org.eclipse.emf.cdo.common.revision.CDORevision;
-import org.eclipse.emf.cdo.common.revision.CDORevisionKey;
-import org.eclipse.emf.cdo.common.revision.delta.CDORevisionDelta;
-
-import java.util.List;
-import java.util.Map;
-
-/**
- * A {@link CDOChangeKindProvider change kind provider} with detailed information about {@link #getNewObjects() new},
- * {@link #getChangedObjects() changed} and {@link #getDetachedObjects() detached} objects.
- *
- * @author Eike Stepper
- * @since 3.0
- * @noextend This interface is not intended to be extended by clients.
- * @noimplement This interface is not intended to be implemented by clients.
- */
-public interface CDOChangeSetData extends CDOChangeKindProvider
-{
- /**
- * Returns <code>true</code>, if this change set data does not contain any changes, <code>false</code> otherwise.
- */
- public boolean isEmpty();
-
- /**
- * Returns a deep copy of this change set data.
- *
- * @since 4.0
- */
- public CDOChangeSetData copy();
-
- /**
- * Changes the internal state of this change set data by adding the changes of the given change set data.
- *
- * @since 4.0
- */
- public void merge(CDOChangeSetData changeSetData);
-
- /**
- * Returns a collection of keys denoting which revisions have been added in the context of a commit operation.
- * Depending on various conditions like change subscriptions particular elements can also be full {@link CDORevision
- * revisions}.
- */
- public List<CDOIDAndVersion> getNewObjects();
-
- /**
- * Returns a collection of revision keys denoting which (original) revisions have been changed in the context of a
- * commit operation. Depending on various conditions like change subscriptions particular elements can also be full
- * {@link CDORevisionDelta revision deltas}.
- */
- public List<CDORevisionKey> getChangedObjects();
-
- /**
- * Returns a collection of keys denoting which revisions have been revised (corresponds to detached objects) in the
- * context of a commit operation. Depending on various conditions the version part of particular elements can be
- * {@link CDOBranchVersion#UNSPECIFIED_VERSION unspecified}.
- */
- public List<CDOIDAndVersion> getDetachedObjects();
-
- /**
- * @since 4.1
- */
- public Map<CDOID, CDOChangeKind> getChangeKinds();
-}
+/*
+ * Copyright (c) 2004 - 2012 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.commit;
+
+import org.eclipse.emf.cdo.common.branch.CDOBranchVersion;
+import org.eclipse.emf.cdo.common.id.CDOID;
+import org.eclipse.emf.cdo.common.revision.CDOIDAndVersion;
+import org.eclipse.emf.cdo.common.revision.CDORevision;
+import org.eclipse.emf.cdo.common.revision.CDORevisionKey;
+import org.eclipse.emf.cdo.common.revision.delta.CDORevisionDelta;
+
+import java.util.List;
+import java.util.Map;
+
+/**
+ * A {@link CDOChangeKindProvider change kind provider} with detailed information about {@link #getNewObjects() new},
+ * {@link #getChangedObjects() changed} and {@link #getDetachedObjects() detached} objects.
+ *
+ * @author Eike Stepper
+ * @since 3.0
+ * @noextend This interface is not intended to be extended by clients.
+ * @noimplement This interface is not intended to be implemented by clients.
+ */
+public interface CDOChangeSetData extends CDOChangeKindProvider
+{
+ /**
+ * Returns <code>true</code>, if this change set data does not contain any changes, <code>false</code> otherwise.
+ */
+ public boolean isEmpty();
+
+ /**
+ * Returns a deep copy of this change set data.
+ *
+ * @since 4.0
+ */
+ public CDOChangeSetData copy();
+
+ /**
+ * Changes the internal state of this change set data by adding the changes of the given change set data.
+ *
+ * @since 4.0
+ */
+ public void merge(CDOChangeSetData changeSetData);
+
+ /**
+ * Returns a collection of keys denoting which revisions have been added in the context of a commit operation.
+ * Depending on various conditions like change subscriptions particular elements can also be full {@link CDORevision
+ * revisions}.
+ */
+ public List<CDOIDAndVersion> getNewObjects();
+
+ /**
+ * Returns a collection of revision keys denoting which (original) revisions have been changed in the context of a
+ * commit operation. Depending on various conditions like change subscriptions particular elements can also be full
+ * {@link CDORevisionDelta revision deltas}.
+ */
+ public List<CDORevisionKey> getChangedObjects();
+
+ /**
+ * Returns a collection of keys denoting which revisions have been revised (corresponds to detached objects) in the
+ * context of a commit operation. Depending on various conditions the version part of particular elements can be
+ * {@link CDOBranchVersion#UNSPECIFIED_VERSION unspecified}.
+ */
+ public List<CDOIDAndVersion> getDetachedObjects();
+
+ /**
+ * @since 4.1
+ */
+ public Map<CDOID, CDOChangeKind> getChangeKinds();
+}
diff --git a/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/common/commit/CDOChangeSetDataProvider.java b/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/common/commit/CDOChangeSetDataProvider.java
index aba9672d19..a9122c0ecf 100644
--- a/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/common/commit/CDOChangeSetDataProvider.java
+++ b/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/common/commit/CDOChangeSetDataProvider.java
@@ -1,23 +1,23 @@
-/*
- * Copyright (c) 2004 - 2011 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.commit;
-
-/**
- * Provides consumers with {@link CDOChangeSetData change set data} structures.
- *
- * @author Eike Stepper
- * @since 4.0
- * @apiviz.uses {@link CDOChangeSetData} - - provides
- */
-public interface CDOChangeSetDataProvider
-{
- public CDOChangeSetData getChangeSetData();
-}
+/*
+ * Copyright (c) 2004 - 2012 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.commit;
+
+/**
+ * Provides consumers with {@link CDOChangeSetData change set data} structures.
+ *
+ * @author Eike Stepper
+ * @since 4.0
+ * @apiviz.uses {@link CDOChangeSetData} - - provides
+ */
+public interface CDOChangeSetDataProvider
+{
+ public CDOChangeSetData getChangeSetData();
+}
diff --git a/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/common/commit/CDOCommitData.java b/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/common/commit/CDOCommitData.java
index 664e2931ef..41ea320c6d 100644
--- a/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/common/commit/CDOCommitData.java
+++ b/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/common/commit/CDOCommitData.java
@@ -1,29 +1,29 @@
-/*
- * Copyright (c) 2004 - 2011 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.commit;
-
-import org.eclipse.emf.cdo.common.model.CDOPackageUnit;
-
-import java.util.List;
-
-/**
- * {@link CDOChangeSetData Change set data} with detailed information about new {@link #getNewPackageUnits() package
- * units}.
- *
- * @author Eike Stepper
- * @since 3.0
- * @noextend This interface is not intended to be extended by clients.
- * @noimplement This interface is not intended to be implemented by clients.
- */
-public interface CDOCommitData extends CDOChangeSetData
-{
- public List<CDOPackageUnit> getNewPackageUnits();
-}
+/*
+ * Copyright (c) 2004 - 2012 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.commit;
+
+import org.eclipse.emf.cdo.common.model.CDOPackageUnit;
+
+import java.util.List;
+
+/**
+ * {@link CDOChangeSetData Change set data} with detailed information about new {@link #getNewPackageUnits() package
+ * units}.
+ *
+ * @author Eike Stepper
+ * @since 3.0
+ * @noextend This interface is not intended to be extended by clients.
+ * @noimplement This interface is not intended to be implemented by clients.
+ */
+public interface CDOCommitData extends CDOChangeSetData
+{
+ public List<CDOPackageUnit> getNewPackageUnits();
+}
diff --git a/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/common/commit/CDOCommitInfo.java b/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/common/commit/CDOCommitInfo.java
index 18e5ff56e5..1b93982d3a 100644
--- a/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/common/commit/CDOCommitInfo.java
+++ b/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/common/commit/CDOCommitInfo.java
@@ -1,37 +1,37 @@
-/*
- * Copyright (c) 2004 - 2011 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.commit;
-
-import org.eclipse.emf.cdo.common.branch.CDOBranchPoint;
-
-/**
- * {@link CDOCommitData Commit data} in the context of a {@link CDOCommitInfoManager commit info manager} with
- * additional commit informations.
- *
- * @author Eike Stepper
- * @since 3.0
- * @noextend This interface is not intended to be extended by clients.
- * @noimplement This interface is not intended to be implemented by clients.
- * @apiviz.landmark
- */
-public interface CDOCommitInfo extends CDOBranchPoint, CDOCommitData
-{
- public CDOCommitInfoManager getCommitInfoManager();
-
- /**
- * @since 4.0
- */
- public long getPreviousTimeStamp();
-
- public String getUserID();
-
- public String getComment();
-}
+/*
+ * Copyright (c) 2004 - 2012 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.commit;
+
+import org.eclipse.emf.cdo.common.branch.CDOBranchPoint;
+
+/**
+ * {@link CDOCommitData Commit data} in the context of a {@link CDOCommitInfoManager commit info manager} with
+ * additional commit informations.
+ *
+ * @author Eike Stepper
+ * @since 3.0
+ * @noextend This interface is not intended to be extended by clients.
+ * @noimplement This interface is not intended to be implemented by clients.
+ * @apiviz.landmark
+ */
+public interface CDOCommitInfo extends CDOBranchPoint, CDOCommitData
+{
+ public CDOCommitInfoManager getCommitInfoManager();
+
+ /**
+ * @since 4.0
+ */
+ public long getPreviousTimeStamp();
+
+ public String getUserID();
+
+ public String getComment();
+}
diff --git a/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/common/commit/CDOCommitInfoHandler.java b/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/common/commit/CDOCommitInfoHandler.java
index 49166cb47f..800ccc5bb5 100644
--- a/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/common/commit/CDOCommitInfoHandler.java
+++ b/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/common/commit/CDOCommitInfoHandler.java
@@ -1,24 +1,24 @@
-/*
- * Copyright (c) 2004 - 2011 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.commit;
-
-/**
- * A call-back interface that indicates the ability to <i>handle</i> {@link CDOCommitInfo commit infos} that are passed
- * from other entities.
- *
- * @author Eike Stepper
- * @since 3.0
- * @apiviz.uses {@link CDOCommitInfo} - - handles
- */
-public interface CDOCommitInfoHandler
-{
- public void handleCommitInfo(CDOCommitInfo commitInfo);
-}
+/*
+ * Copyright (c) 2004 - 2012 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.commit;
+
+/**
+ * A call-back interface that indicates the ability to <i>handle</i> {@link CDOCommitInfo commit infos} that are passed
+ * from other entities.
+ *
+ * @author Eike Stepper
+ * @since 3.0
+ * @apiviz.uses {@link CDOCommitInfo} - - handles
+ */
+public interface CDOCommitInfoHandler
+{
+ public void handleCommitInfo(CDOCommitInfo commitInfo);
+}
diff --git a/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/common/commit/CDOCommitInfoManager.java b/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/common/commit/CDOCommitInfoManager.java
index 9e9a3a18ce..58b7dee9de 100644
--- a/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/common/commit/CDOCommitInfoManager.java
+++ b/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/common/commit/CDOCommitInfoManager.java
@@ -1,39 +1,39 @@
-/*
- * Copyright (c) 2004 - 2011 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:
- * Andre Dietisheim - initial API and implementation
- */
-package org.eclipse.emf.cdo.common.commit;
-
-import org.eclipse.emf.cdo.common.branch.CDOBranch;
-
-/**
- * Loads, provides and possible manages {@link CDOCommitInfo commit info} objects.
- *
- * @author Andre Dietisheim
- * @since 3.0
- * @noextend This interface is not intended to be extended by clients.
- * @noimplement This interface is not intended to be implemented by clients.
- * @apiviz.landmark
- * @apiviz.uses {@link CDOCommitInfo} - - manages
- */
-public interface CDOCommitInfoManager
-{
- /**
- * @since 4.0
- */
- public CDOCommitInfo getCommitInfo(long timeStamp);
-
- public void getCommitInfos(CDOBranch branch, long startTime, long endTime, CDOCommitInfoHandler handler);
-
- /**
- * @since 4.0
- */
- public void getCommitInfos(CDOBranch branch, long startTime, String userID, String comment, int count,
- CDOCommitInfoHandler handler);
-}
+/*
+ * Copyright (c) 2004 - 2012 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:
+ * Andre Dietisheim - initial API and implementation
+ */
+package org.eclipse.emf.cdo.common.commit;
+
+import org.eclipse.emf.cdo.common.branch.CDOBranch;
+
+/**
+ * Loads, provides and possible manages {@link CDOCommitInfo commit info} objects.
+ *
+ * @author Andre Dietisheim
+ * @since 3.0
+ * @noextend This interface is not intended to be extended by clients.
+ * @noimplement This interface is not intended to be implemented by clients.
+ * @apiviz.landmark
+ * @apiviz.uses {@link CDOCommitInfo} - - manages
+ */
+public interface CDOCommitInfoManager
+{
+ /**
+ * @since 4.0
+ */
+ public CDOCommitInfo getCommitInfo(long timeStamp);
+
+ public void getCommitInfos(CDOBranch branch, long startTime, long endTime, CDOCommitInfoHandler handler);
+
+ /**
+ * @since 4.0
+ */
+ public void getCommitInfos(CDOBranch branch, long startTime, String userID, String comment, int count,
+ CDOCommitInfoHandler handler);
+}
diff --git a/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/common/commit/handler/AsyncCommitInfoHandler.java b/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/common/commit/handler/AsyncCommitInfoHandler.java
index e81565e4b4..441ce866fe 100644
--- a/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/common/commit/handler/AsyncCommitInfoHandler.java
+++ b/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/common/commit/handler/AsyncCommitInfoHandler.java
@@ -1,58 +1,58 @@
-/*
- * Copyright (c) 2004 - 2011 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.commit.handler;
-
-import org.eclipse.emf.cdo.common.commit.CDOCommitInfo;
-import org.eclipse.emf.cdo.common.commit.CDOCommitInfoHandler;
-import org.eclipse.emf.cdo.internal.common.bundle.OM;
-
-import org.eclipse.net4j.util.concurrent.QueueWorker;
-
-/**
- * A {@link CDOCommitInfoHandler commit info handler} that asynchronously delegates {@link CDOCommitInfo commit infos}
- * to another handler.
- *
- * @author Eike Stepper
- * @since 4.0
- */
-public class AsyncCommitInfoHandler extends QueueWorker<CDOCommitInfo> implements CDOCommitInfoHandler
-{
- private CDOCommitInfoHandler delegate;
-
- public AsyncCommitInfoHandler(CDOCommitInfoHandler delegate)
- {
- this.delegate = delegate;
- }
-
- public void handleCommitInfo(CDOCommitInfo commitInfo)
- {
- addWork(commitInfo);
- }
-
- @Override
- protected void work(WorkContext context, CDOCommitInfo commitInfo)
- {
- try
- {
- delegate.handleCommitInfo(commitInfo);
- }
- catch (Exception ex)
- {
- OM.LOG.error(ex);
- }
- }
-
- @Override
- protected boolean doRemainingWorkBeforeDeactivate()
- {
- return true;
- }
-}
+/*
+ * Copyright (c) 2004 - 2012 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.commit.handler;
+
+import org.eclipse.emf.cdo.common.commit.CDOCommitInfo;
+import org.eclipse.emf.cdo.common.commit.CDOCommitInfoHandler;
+import org.eclipse.emf.cdo.internal.common.bundle.OM;
+
+import org.eclipse.net4j.util.concurrent.QueueWorker;
+
+/**
+ * A {@link CDOCommitInfoHandler commit info handler} that asynchronously delegates {@link CDOCommitInfo commit infos}
+ * to another handler.
+ *
+ * @author Eike Stepper
+ * @since 4.0
+ */
+public class AsyncCommitInfoHandler extends QueueWorker<CDOCommitInfo> implements CDOCommitInfoHandler
+{
+ private CDOCommitInfoHandler delegate;
+
+ public AsyncCommitInfoHandler(CDOCommitInfoHandler delegate)
+ {
+ this.delegate = delegate;
+ }
+
+ public void handleCommitInfo(CDOCommitInfo commitInfo)
+ {
+ addWork(commitInfo);
+ }
+
+ @Override
+ protected void work(WorkContext context, CDOCommitInfo commitInfo)
+ {
+ try
+ {
+ delegate.handleCommitInfo(commitInfo);
+ }
+ catch (Exception ex)
+ {
+ OM.LOG.error(ex);
+ }
+ }
+
+ @Override
+ protected boolean doRemainingWorkBeforeDeactivate()
+ {
+ return true;
+ }
+}
diff --git a/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/common/commit/handler/BinaryCommitInfoLog.java b/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/common/commit/handler/BinaryCommitInfoLog.java
index 4129ff5ee2..011db925db 100644
--- a/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/common/commit/handler/BinaryCommitInfoLog.java
+++ b/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/common/commit/handler/BinaryCommitInfoLog.java
@@ -1,59 +1,59 @@
-/*
- * Copyright (c) 2004 - 2011 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.commit.handler;
-
-import org.eclipse.emf.cdo.common.commit.CDOCommitInfo;
-import org.eclipse.emf.cdo.common.commit.CDOCommitInfoHandler;
-import org.eclipse.emf.cdo.common.id.CDOIDProvider;
-import org.eclipse.emf.cdo.common.model.CDOPackageRegistry;
-import org.eclipse.emf.cdo.common.protocol.CDODataOutput;
-import org.eclipse.emf.cdo.common.util.CDOCommonUtil;
-import org.eclipse.emf.cdo.internal.common.bundle.OM;
-
-import org.eclipse.net4j.util.io.ExtendedDataOutput;
-import org.eclipse.net4j.util.io.ExtendedDataOutputStream;
-
-import java.io.OutputStream;
-
-/**
- * A {@link CDOCommitInfoHandler commit info handler} that synchronously writes {@link CDOCommitInfo commit infos} to a
- * binary log.
- *
- * @author Eike Stepper
- * @since 4.0
- */
-public class BinaryCommitInfoLog implements CDOCommitInfoHandler
-{
- private CDODataOutput out;
-
- public BinaryCommitInfoLog(OutputStream stream, CDOPackageRegistry packageRegistry)
- {
- ExtendedDataOutput eod = ExtendedDataOutputStream.wrap(stream);
- out = CDOCommonUtil.createCDODataOutput(eod, packageRegistry, CDOIDProvider.NOOP);
- }
-
- public void handleCommitInfo(CDOCommitInfo commitInfo)
- {
- try
- {
- out.writeCDOCommitInfo(commitInfo);
- }
- catch (Exception ex)
- {
- handleException(ex);
- }
- }
-
- protected void handleException(Exception ex)
- {
- OM.LOG.error(ex);
- }
-}
+/*
+ * Copyright (c) 2004 - 2012 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.commit.handler;
+
+import org.eclipse.emf.cdo.common.commit.CDOCommitInfo;
+import org.eclipse.emf.cdo.common.commit.CDOCommitInfoHandler;
+import org.eclipse.emf.cdo.common.id.CDOIDProvider;
+import org.eclipse.emf.cdo.common.model.CDOPackageRegistry;
+import org.eclipse.emf.cdo.common.protocol.CDODataOutput;
+import org.eclipse.emf.cdo.common.util.CDOCommonUtil;
+import org.eclipse.emf.cdo.internal.common.bundle.OM;
+
+import org.eclipse.net4j.util.io.ExtendedDataOutput;
+import org.eclipse.net4j.util.io.ExtendedDataOutputStream;
+
+import java.io.OutputStream;
+
+/**
+ * A {@link CDOCommitInfoHandler commit info handler} that synchronously writes {@link CDOCommitInfo commit infos} to a
+ * binary log.
+ *
+ * @author Eike Stepper
+ * @since 4.0
+ */
+public class BinaryCommitInfoLog implements CDOCommitInfoHandler
+{
+ private CDODataOutput out;
+
+ public BinaryCommitInfoLog(OutputStream stream, CDOPackageRegistry packageRegistry)
+ {
+ ExtendedDataOutput eod = ExtendedDataOutputStream.wrap(stream);
+ out = CDOCommonUtil.createCDODataOutput(eod, packageRegistry, CDOIDProvider.NOOP);
+ }
+
+ public void handleCommitInfo(CDOCommitInfo commitInfo)
+ {
+ try
+ {
+ out.writeCDOCommitInfo(commitInfo);
+ }
+ catch (Exception ex)
+ {
+ handleException(ex);
+ }
+ }
+
+ protected void handleException(Exception ex)
+ {
+ OM.LOG.error(ex);
+ }
+}
diff --git a/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/common/commit/handler/TextCommitInfoLog.java b/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/common/commit/handler/TextCommitInfoLog.java
index dddd283966..ca4e5c16d5 100644
--- a/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/common/commit/handler/TextCommitInfoLog.java
+++ b/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/common/commit/handler/TextCommitInfoLog.java
@@ -1,65 +1,65 @@
-/*
- * Copyright (c) 2004 - 2011 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.commit.handler;
-
-import org.eclipse.emf.cdo.common.commit.CDOCommitInfo;
-import org.eclipse.emf.cdo.common.commit.CDOCommitInfoHandler;
-import org.eclipse.emf.cdo.common.model.CDOPackageUnit;
-import org.eclipse.emf.cdo.internal.common.bundle.OM;
-import org.eclipse.emf.cdo.spi.common.commit.CDOCommitInfoUtil;
-
-import java.io.OutputStream;
-import java.io.PrintStream;
-
-/**
- * A {@link CDOCommitInfoHandler commit info handler} that synchronously writes {@link CDOCommitInfo commit infos} to a
- * text log.
- *
- * @author Eike Stepper
- * @since 4.0
- */
-public class TextCommitInfoLog implements CDOCommitInfoHandler
-{
- private PrintStream printStream;
-
- public TextCommitInfoLog(OutputStream stream)
- {
- printStream = stream instanceof PrintStream ? (PrintStream)stream : new PrintStream(stream);
- }
-
- public void handleCommitInfo(CDOCommitInfo commitInfo)
- {
- try
- {
- if (printStream != null)
- {
- printStream.println(commitInfo);
-
- for (CDOPackageUnit packageUnit : commitInfo.getNewPackageUnits())
- {
- printStream.println(" P " + packageUnit.getID());
- }
-
- CDOCommitInfoUtil.dump(printStream, commitInfo);
- printStream.flush();
- }
- }
- catch (Exception ex)
- {
- handleException(ex);
- }
- }
-
- protected void handleException(Exception ex)
- {
- OM.LOG.error(ex);
- }
-}
+/*
+ * Copyright (c) 2004 - 2012 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.commit.handler;
+
+import org.eclipse.emf.cdo.common.commit.CDOCommitInfo;
+import org.eclipse.emf.cdo.common.commit.CDOCommitInfoHandler;
+import org.eclipse.emf.cdo.common.model.CDOPackageUnit;
+import org.eclipse.emf.cdo.internal.common.bundle.OM;
+import org.eclipse.emf.cdo.spi.common.commit.CDOCommitInfoUtil;
+
+import java.io.OutputStream;
+import java.io.PrintStream;
+
+/**
+ * A {@link CDOCommitInfoHandler commit info handler} that synchronously writes {@link CDOCommitInfo commit infos} to a
+ * text log.
+ *
+ * @author Eike Stepper
+ * @since 4.0
+ */
+public class TextCommitInfoLog implements CDOCommitInfoHandler
+{
+ private PrintStream printStream;
+
+ public TextCommitInfoLog(OutputStream stream)
+ {
+ printStream = stream instanceof PrintStream ? (PrintStream)stream : new PrintStream(stream);
+ }
+
+ public void handleCommitInfo(CDOCommitInfo commitInfo)
+ {
+ try
+ {
+ if (printStream != null)
+ {
+ printStream.println(commitInfo);
+
+ for (CDOPackageUnit packageUnit : commitInfo.getNewPackageUnits())
+ {
+ printStream.println(" P " + packageUnit.getID());
+ }
+
+ CDOCommitInfoUtil.dump(printStream, commitInfo);
+ printStream.flush();
+ }
+ }
+ catch (Exception ex)
+ {
+ handleException(ex);
+ }
+ }
+
+ protected void handleException(Exception ex)
+ {
+ OM.LOG.error(ex);
+ }
+}
diff --git a/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/common/commit/handler/package-info.java b/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/common/commit/handler/package-info.java
index 9b3abafe7e..132c167e63 100644
--- a/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/common/commit/handler/package-info.java
+++ b/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/common/commit/handler/package-info.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2004 - 2011 Eike Stepper (Berlin, Germany) and others.
+ * Copyright (c) 2004 - 2012 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
diff --git a/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/common/commit/package-info.java b/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/common/commit/package-info.java
index 04104245ad..8c68efd5ef 100644
--- a/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/common/commit/package-info.java
+++ b/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/common/commit/package-info.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2004 - 2011 Eike Stepper (Berlin, Germany) and others.
+ * Copyright (c) 2004 - 2012 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
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 cc74e54b0b..054fef251e 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
@@ -1,162 +1,162 @@
-/*
- * Copyright (c) 2004 - 2011 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 - bug 226778
- * Simon McDuff - bug 213402
- */
-package org.eclipse.emf.cdo.common.id;
-
-import org.eclipse.emf.cdo.common.CDOCommonRepository;
-
-import org.eclipse.net4j.util.ImplementationError;
-
-import java.io.Serializable;
-import java.lang.reflect.Array;
-
-/**
- * Identifies CDO objects uniquely in a CDO {@link CDOCommonRepository repository}.
- *
- * @author Eike Stepper
- * @noextend This interface is not intended to be extended by clients.
- * @noimplement This interface is not intended to be implemented by clients.
- * @apiviz.landmark
- * @apiviz.has {@link CDOID.Type}
- */
-public interface CDOID extends Serializable, Comparable<CDOID>
-{
- public static final CDOID NULL = org.eclipse.emf.cdo.internal.common.id.CDOIDNullImpl.INSTANCE;
-
- public Type getType();
-
- public boolean isNull();
-
- public boolean isObject();
-
- public boolean isTemporary();
-
- /**
- * @since 3.0
- */
- public boolean isDangling();
-
- /**
- * @since 2.0
- */
- public boolean isExternal();
-
- /**
- * @since 2.0
- */
- public String toURIFragment();
-
- /**
- * Enumerates the possible types of CDO {@link CDOID IDs}.
- *
- * @author Eike Stepper
- */
- public enum Type
- {
- NULL('N'), //
- OBJECT(' '), // Superceded by ObjectType.getID()
-
- /**
- * @since 2.0
- */
- EXTERNAL_OBJECT('E'),
-
- /**
- * @since 3.0
- */
- DANGLING_OBJECT('D'),
-
- /**
- * @since 2.0
- */
- EXTERNAL_TEMP_OBJECT('e'), //
- TEMP_OBJECT('t');
-
- private static Enum<?>[] chars;
-
- private char id;
-
- private Type(char id)
- {
- registerChar(id, this);
- this.id = id;
- }
-
- private static void registerChar(char id, Enum<?> literal)
- {
- if (chars == null)
- {
- chars = (Enum<?>[])Array.newInstance(Enum.class, id + 1);
- }
- else if (chars.length < id)
- {
- Enum<?>[] newChars = (Enum<?>[])Array.newInstance(Enum.class, id + 1);
- System.arraycopy(chars, 0, newChars, 0, chars.length);
- chars = newChars;
- }
-
- if (chars[id] != null)
- {
- throw new ImplementationError("Duplicate id: " + id);
- }
-
- chars[id] = literal;
- }
-
- /**
- * @since 4.0
- */
- public static Enum<?> getLiteral(char id)
- {
- return chars[id];
- }
-
- /**
- * @since 4.0
- */
- public char getID()
- {
- return id;
- }
- }
-
- /**
- * Enumerates the possible <b>sub</b> types of CDO {@link CDOID IDs} with the main type {@link Type#OBJECT OBJECT}.
- *
- * @author Eike Stepper
- * @since 3.0
- */
- public enum ObjectType
- {
- LONG('L'), //
- STRING('S'), //
- LONG_WITH_CLASSIFIER('l'), //
- STRING_WITH_CLASSIFIER('s'), //
- UUID('U');
-
- private char id;
-
- private ObjectType(char id)
- {
- Type.registerChar(id, this);
- this.id = id;
- }
-
- /**
- * @since 4.0
- */
- public char getID()
- {
- return id;
- }
- }
-}
+/*
+ * Copyright (c) 2004 - 2012 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 - bug 226778
+ * Simon McDuff - bug 213402
+ */
+package org.eclipse.emf.cdo.common.id;
+
+import org.eclipse.emf.cdo.common.CDOCommonRepository;
+
+import org.eclipse.net4j.util.ImplementationError;
+
+import java.io.Serializable;
+import java.lang.reflect.Array;
+
+/**
+ * Identifies CDO objects uniquely in a CDO {@link CDOCommonRepository repository}.
+ *
+ * @author Eike Stepper
+ * @noextend This interface is not intended to be extended by clients.
+ * @noimplement This interface is not intended to be implemented by clients.
+ * @apiviz.landmark
+ * @apiviz.has {@link CDOID.Type}
+ */
+public interface CDOID extends Serializable, Comparable<CDOID>
+{
+ public static final CDOID NULL = org.eclipse.emf.cdo.internal.common.id.CDOIDNullImpl.INSTANCE;
+
+ public Type getType();
+
+ public boolean isNull();
+
+ public boolean isObject();
+
+ public boolean isTemporary();
+
+ /**
+ * @since 3.0
+ */
+ public boolean isDangling();
+
+ /**
+ * @since 2.0
+ */
+ public boolean isExternal();
+
+ /**
+ * @since 2.0
+ */
+ public String toURIFragment();
+
+ /**
+ * Enumerates the possible types of CDO {@link CDOID IDs}.
+ *
+ * @author Eike Stepper
+ */
+ public enum Type
+ {
+ NULL('N'), //
+ OBJECT(' '), // Superceded by ObjectType.getID()
+
+ /**
+ * @since 2.0
+ */
+ EXTERNAL_OBJECT('E'),
+
+ /**
+ * @since 3.0
+ */
+ DANGLING_OBJECT('D'),
+
+ /**
+ * @since 2.0
+ */
+ EXTERNAL_TEMP_OBJECT('e'), //
+ TEMP_OBJECT('t');
+
+ private static Enum<?>[] chars;
+
+ private char id;
+
+ private Type(char id)
+ {
+ registerChar(id, this);
+ this.id = id;
+ }
+
+ private static void registerChar(char id, Enum<?> literal)
+ {
+ if (chars == null)
+ {
+ chars = (Enum<?>[])Array.newInstance(Enum.class, id + 1);
+ }
+ else if (chars.length < id)
+ {
+ Enum<?>[] newChars = (Enum<?>[])Array.newInstance(Enum.class, id + 1);
+ System.arraycopy(chars, 0, newChars, 0, chars.length);
+ chars = newChars;
+ }
+
+ if (chars[id] != null)
+ {
+ throw new ImplementationError("Duplicate id: " + id);
+ }
+
+ chars[id] = literal;
+ }
+
+ /**
+ * @since 4.0
+ */
+ public static Enum<?> getLiteral(char id)
+ {
+ return chars[id];
+ }
+
+ /**
+ * @since 4.0
+ */
+ public char getID()
+ {
+ return id;
+ }
+ }
+
+ /**
+ * Enumerates the possible <b>sub</b> types of CDO {@link CDOID IDs} with the main type {@link Type#OBJECT OBJECT}.
+ *
+ * @author Eike Stepper
+ * @since 3.0
+ */
+ public enum ObjectType
+ {
+ LONG('L'), //
+ STRING('S'), //
+ LONG_WITH_CLASSIFIER('l'), //
+ STRING_WITH_CLASSIFIER('s'), //
+ UUID('U');
+
+ private char id;
+
+ private ObjectType(char id)
+ {
+ Type.registerChar(id, this);
+ this.id = id;
+ }
+
+ /**
+ * @since 4.0
+ */
+ public char getID()
+ {
+ return id;
+ }
+ }
+}
diff --git a/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/common/id/CDOIDExternal.java b/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/common/id/CDOIDExternal.java
index bba12e86bf..7b52e8340d 100644
--- a/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/common/id/CDOIDExternal.java
+++ b/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/common/id/CDOIDExternal.java
@@ -1,27 +1,27 @@
-/*
- * Copyright (c) 2004 - 2011 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.id;
-
-import org.eclipse.emf.cdo.common.CDOCommonRepository;
-
-/**
- * The {@link CDOID ID} of a CDO object that is external to a CDO {@link CDOCommonRepository repository}.
- *
- * @author Simon McDuff
- * @since 2.0
- * @noextend This interface is not intended to be extended by clients.
- * @noimplement This interface is not intended to be implemented by clients.
- */
-public interface CDOIDExternal extends CDOID
-{
- public String getURI();
-}
+/*
+ * Copyright (c) 2004 - 2012 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.id;
+
+import org.eclipse.emf.cdo.common.CDOCommonRepository;
+
+/**
+ * The {@link CDOID ID} of a CDO object that is external to a CDO {@link CDOCommonRepository repository}.
+ *
+ * @author Simon McDuff
+ * @since 2.0
+ * @noextend This interface is not intended to be extended by clients.
+ * @noimplement This interface is not intended to be implemented by clients.
+ */
+public interface CDOIDExternal extends CDOID
+{
+ public String getURI();
+}
diff --git a/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/common/id/CDOIDGenerator.java b/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/common/id/CDOIDGenerator.java
index 293825eba8..b929df6373 100644
--- a/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/common/id/CDOIDGenerator.java
+++ b/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/common/id/CDOIDGenerator.java
@@ -1,72 +1,72 @@
-/*
- * Copyright (c) 2004 - 2011 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.id;
-
-import org.eclipse.net4j.util.UUIDGenerator;
-
-import org.eclipse.emf.ecore.EObject;
-import org.eclipse.emf.ecore.util.EcoreUtil;
-
-/**
- * Generates {@link CDOID IDs}.
- *
- * @author Eike Stepper
- * @since 4.1
- */
-public interface CDOIDGenerator
-{
- /**
- * Generates {@link CDOID#NULL NULL} values.
- */
- public static final CDOIDGenerator NULL = new CDOIDGenerator()
- {
- public CDOID generateCDOID(EObject object)
- {
- return CDOID.NULL;
- }
-
- public void reset()
- {
- // Do nothing
- }
- };
-
- /**
- * Generates {@link EcoreUtil#generateUUID(byte[]) UUID} values.
- */
- public static final CDOIDGenerator UUID = new CDOIDGenerator()
- {
- public CDOID generateCDOID(EObject object)
- {
- byte[] bytes = new byte[16];
- UUIDGenerator.DEFAULT.generate(bytes);
- return CDOIDUtil.createUUID(bytes);
- }
-
- public void reset()
- {
- // Do nothing
- }
- };
-
- /**
- * Generates a {@link CDOID}.
- *
- * @param object
- * the object to generate a new CDOID for if available, <code>null</code> otherwise.
- */
- public CDOID generateCDOID(EObject object);
-
- /**
- * Called at the end of a commit operation to give this ID generator a chance to reset its sequence of IDs.
- */
- public void reset();
-}
+/*
+ * Copyright (c) 2004 - 2012 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.id;
+
+import org.eclipse.net4j.util.UUIDGenerator;
+
+import org.eclipse.emf.ecore.EObject;
+import org.eclipse.emf.ecore.util.EcoreUtil;
+
+/**
+ * Generates {@link CDOID IDs}.
+ *
+ * @author Eike Stepper
+ * @since 4.1
+ */
+public interface CDOIDGenerator
+{
+ /**
+ * Generates {@link CDOID#NULL NULL} values.
+ */
+ public static final CDOIDGenerator NULL = new CDOIDGenerator()
+ {
+ public CDOID generateCDOID(EObject object)
+ {
+ return CDOID.NULL;
+ }
+
+ public void reset()
+ {
+ // Do nothing
+ }
+ };
+
+ /**
+ * Generates {@link EcoreUtil#generateUUID(byte[]) UUID} values.
+ */
+ public static final CDOIDGenerator UUID = new CDOIDGenerator()
+ {
+ public CDOID generateCDOID(EObject object)
+ {
+ byte[] bytes = new byte[16];
+ UUIDGenerator.DEFAULT.generate(bytes);
+ return CDOIDUtil.createUUID(bytes);
+ }
+
+ public void reset()
+ {
+ // Do nothing
+ }
+ };
+
+ /**
+ * Generates a {@link CDOID}.
+ *
+ * @param object
+ * the object to generate a new CDOID for if available, <code>null</code> otherwise.
+ */
+ public CDOID generateCDOID(EObject object);
+
+ /**
+ * Called at the end of a commit operation to give this ID generator a chance to reset its sequence of IDs.
+ */
+ public void reset();
+}
diff --git a/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/common/id/CDOIDObject.java b/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/common/id/CDOIDObject.java
index 4a61ce239a..19d9ec4c96 100644
--- a/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/common/id/CDOIDObject.java
+++ b/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/common/id/CDOIDObject.java
@@ -1,25 +1,25 @@
-/*
- * Copyright (c) 2004 - 2011 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.id;
-
-import org.eclipse.emf.cdo.common.CDOCommonRepository;
-
-/**
- * The {@link CDOID ID} of a CDO object that is persistent in a CDO {@link CDOCommonRepository repository}.
- *
- * @author Eike Stepper
- * @noextend This interface is not intended to be extended by clients.
- * @noimplement This interface is not intended to be implemented by clients.
- * @apiviz.has {@link CDOID.ObjectType}
- */
-public interface CDOIDObject extends CDOID
-{
-}
+/*
+ * Copyright (c) 2004 - 2012 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.id;
+
+import org.eclipse.emf.cdo.common.CDOCommonRepository;
+
+/**
+ * The {@link CDOID ID} of a CDO object that is persistent in a CDO {@link CDOCommonRepository repository}.
+ *
+ * @author Eike Stepper
+ * @noextend This interface is not intended to be extended by clients.
+ * @noimplement This interface is not intended to be implemented by clients.
+ * @apiviz.has {@link CDOID.ObjectType}
+ */
+public interface CDOIDObject extends CDOID
+{
+}
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 d6a1fd0cb1..8914221b5b 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
@@ -1,33 +1,33 @@
-/*
- * Copyright (c) 2004 - 2011 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.id;
-
-/**
- * Provides the {@link CDOID IDs} of passed objects.
- *
- * @author Eike Stepper
- * @apiviz.uses {@link CDOID} - - provides
- */
-public interface CDOIDProvider
-{
- /**
- * @since 3.0
- */
- public static final CDOIDProvider NOOP = new CDOIDProvider()
- {
- public CDOID provideCDOID(Object id)
- {
- return (CDOID)id;
- }
- };
-
- public CDOID provideCDOID(Object idOrObject);
-}
+/*
+ * Copyright (c) 2004 - 2012 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.id;
+
+/**
+ * Provides the {@link CDOID IDs} of passed objects.
+ *
+ * @author Eike Stepper
+ * @apiviz.uses {@link CDOID} - - provides
+ */
+public interface CDOIDProvider
+{
+ /**
+ * @since 3.0
+ */
+ public static final CDOIDProvider NOOP = new CDOIDProvider()
+ {
+ public CDOID provideCDOID(Object id)
+ {
+ return (CDOID)id;
+ }
+ };
+
+ public CDOID provideCDOID(Object idOrObject);
+}
diff --git a/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/common/id/CDOIDReference.java b/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/common/id/CDOIDReference.java
index 356cfc8958..775ab10c69 100644
--- a/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/common/id/CDOIDReference.java
+++ b/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/common/id/CDOIDReference.java
@@ -1,108 +1,108 @@
-/*
- * Copyright (c) 2004 - 2011 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.id;
-
-import org.eclipse.emf.cdo.common.protocol.CDODataInput;
-import org.eclipse.emf.cdo.common.protocol.CDODataOutput;
-
-import org.eclipse.emf.ecore.EClass;
-import org.eclipse.emf.ecore.EStructuralFeature;
-
-import java.io.IOException;
-
-/**
- * Represents a {@link CDOID} typed reference from one object to another object.
- *
- * @author Eike Stepper
- * @since 4.0
- * @noextend This interface is not intended to be extended by clients.
- * @noinstantiate This class is not intended to be instantiated by clients.
- * @apiviz.has {@link CDOID} oneway - - source
- * @apiviz.has {@link CDOID} oneway - - target
- */
-public class CDOIDReference implements CDOReference<CDOID>
-{
- private CDOID targetID;
-
- private CDOID sourceID;
-
- private EStructuralFeature sourceFeature;
-
- private int sourceIndex;
-
- public CDOIDReference(CDOID targetID, CDOID sourceID, EStructuralFeature sourceFeature, int sourceIndex)
- {
- this.targetID = targetID;
- this.sourceID = sourceID;
- this.sourceFeature = sourceFeature;
- this.sourceIndex = sourceIndex;
- }
-
- public CDOIDReference(CDODataInput in) throws IOException
- {
- targetID = in.readCDOID();
- sourceID = in.readCDOID();
-
- EClass eClass = (EClass)in.readCDOClassifierRefAndResolve();
- String featureName = in.readString();
- sourceFeature = eClass.getEStructuralFeature(featureName);
-
- sourceIndex = in.readInt();
- }
-
- public void write(CDODataOutput out) throws IOException
- {
- out.writeCDOID(targetID);
- out.writeCDOID(sourceID);
- out.writeCDOClassifierRef(sourceFeature.getEContainingClass());
- out.writeString(sourceFeature.getName());
- out.writeInt(sourceIndex);
- }
-
- public CDOID getTargetObject()
- {
- return targetID;
- }
-
- public CDOID getSourceObject()
- {
- return sourceID;
- }
-
- public EStructuralFeature getSourceFeature()
- {
- return sourceFeature;
- }
-
- public int getSourceIndex()
- {
- return sourceIndex;
- }
-
- @Override
- public String toString()
- {
- StringBuilder builder = new StringBuilder();
- builder.append(sourceID);
- builder.append(".");
- builder.append(sourceFeature.getName());
- if (sourceIndex != NO_INDEX)
- {
- builder.append("[");
- builder.append(sourceIndex);
- builder.append("]");
- }
-
- builder.append(" --> ");
- builder.append(targetID);
- return builder.toString();
- }
-}
+/*
+ * Copyright (c) 2004 - 2012 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.id;
+
+import org.eclipse.emf.cdo.common.protocol.CDODataInput;
+import org.eclipse.emf.cdo.common.protocol.CDODataOutput;
+
+import org.eclipse.emf.ecore.EClass;
+import org.eclipse.emf.ecore.EStructuralFeature;
+
+import java.io.IOException;
+
+/**
+ * Represents a {@link CDOID} typed reference from one object to another object.
+ *
+ * @author Eike Stepper
+ * @since 4.0
+ * @noextend This interface is not intended to be extended by clients.
+ * @noinstantiate This class is not intended to be instantiated by clients.
+ * @apiviz.has {@link CDOID} oneway - - source
+ * @apiviz.has {@link CDOID} oneway - - target
+ */
+public class CDOIDReference implements CDOReference<CDOID>
+{
+ private CDOID targetID;
+
+ private CDOID sourceID;
+
+ private EStructuralFeature sourceFeature;
+
+ private int sourceIndex;
+
+ public CDOIDReference(CDOID targetID, CDOID sourceID, EStructuralFeature sourceFeature, int sourceIndex)
+ {
+ this.targetID = targetID;
+ this.sourceID = sourceID;
+ this.sourceFeature = sourceFeature;
+ this.sourceIndex = sourceIndex;
+ }
+
+ public CDOIDReference(CDODataInput in) throws IOException
+ {
+ targetID = in.readCDOID();
+ sourceID = in.readCDOID();
+
+ EClass eClass = (EClass)in.readCDOClassifierRefAndResolve();
+ String featureName = in.readString();
+ sourceFeature = eClass.getEStructuralFeature(featureName);
+
+ sourceIndex = in.readInt();
+ }
+
+ public void write(CDODataOutput out) throws IOException
+ {
+ out.writeCDOID(targetID);
+ out.writeCDOID(sourceID);
+ out.writeCDOClassifierRef(sourceFeature.getEContainingClass());
+ out.writeString(sourceFeature.getName());
+ out.writeInt(sourceIndex);
+ }
+
+ public CDOID getTargetObject()
+ {
+ return targetID;
+ }
+
+ public CDOID getSourceObject()
+ {
+ return sourceID;
+ }
+
+ public EStructuralFeature getSourceFeature()
+ {
+ return sourceFeature;
+ }
+
+ public int getSourceIndex()
+ {
+ return sourceIndex;
+ }
+
+ @Override
+ public String toString()
+ {
+ StringBuilder builder = new StringBuilder();
+ builder.append(sourceID);
+ builder.append(".");
+ builder.append(sourceFeature.getName());
+ if (sourceIndex != NO_INDEX)
+ {
+ builder.append("[");
+ builder.append(sourceIndex);
+ builder.append("]");
+ }
+
+ builder.append(" --> ");
+ builder.append(targetID);
+ return builder.toString();
+ }
+}
diff --git a/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/common/id/CDOIDTemp.java b/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/common/id/CDOIDTemp.java
index b8ba1ae781..bec16fbfa9 100644
--- a/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/common/id/CDOIDTemp.java
+++ b/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/common/id/CDOIDTemp.java
@@ -1,26 +1,26 @@
-/*
- * Copyright (c) 2004 - 2011 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 - bug 213402
- */
-package org.eclipse.emf.cdo.common.id;
-
-import org.eclipse.emf.cdo.common.CDOCommonTransaction;
-
-/**
- * The {@link CDOID ID} of a CDO object that is new in a dirty (uncommitted) CDO {@link CDOCommonTransaction
- * transaction}.
- *
- * @author Eike Stepper
- * @noextend This interface is not intended to be extended by clients.
- * @noimplement This interface is not intended to be implemented by clients.
- */
-public interface CDOIDTemp extends CDOID
-{
-}
+/*
+ * Copyright (c) 2004 - 2012 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 - bug 213402
+ */
+package org.eclipse.emf.cdo.common.id;
+
+import org.eclipse.emf.cdo.common.CDOCommonTransaction;
+
+/**
+ * The {@link CDOID ID} of a CDO object that is new in a dirty (uncommitted) CDO {@link CDOCommonTransaction
+ * transaction}.
+ *
+ * @author Eike Stepper
+ * @noextend This interface is not intended to be extended by clients.
+ * @noimplement This interface is not intended to be implemented by clients.
+ */
+public interface CDOIDTemp extends CDOID
+{
+}
diff --git a/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/common/id/CDOIDUtil.java b/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/common/id/CDOIDUtil.java
index a5869fd03b..9b1687e02a 100644
--- a/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/common/id/CDOIDUtil.java
+++ b/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/common/id/CDOIDUtil.java
@@ -1,452 +1,452 @@
-/*
- * Copyright (c) 2004 - 2011 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 - bug 226778
- * Simon McDuff - bug 213402
- * Martin Taal - Added subtype handling and EClass conversion, bug 283106
- */
-package org.eclipse.emf.cdo.common.id;
-
-import org.eclipse.emf.cdo.common.branch.CDOBranch;
-import org.eclipse.emf.cdo.common.id.CDOID.ObjectType;
-import org.eclipse.emf.cdo.common.id.CDOID.Type;
-import org.eclipse.emf.cdo.common.model.CDOClassifierRef;
-import org.eclipse.emf.cdo.common.revision.CDOIDAndBranch;
-import org.eclipse.emf.cdo.common.revision.CDOIDAndVersion;
-import org.eclipse.emf.cdo.internal.common.id.CDOIDExternalImpl;
-import org.eclipse.emf.cdo.internal.common.id.CDOIDObjectLongImpl;
-import org.eclipse.emf.cdo.internal.common.id.CDOIDObjectLongWithClassifierImpl;
-import org.eclipse.emf.cdo.internal.common.id.CDOIDObjectStringImpl;
-import org.eclipse.emf.cdo.internal.common.id.CDOIDObjectStringWithClassifierImpl;
-import org.eclipse.emf.cdo.internal.common.id.CDOIDObjectUUIDImpl;
-import org.eclipse.emf.cdo.internal.common.id.CDOIDTempObjectExternalImpl;
-import org.eclipse.emf.cdo.internal.common.id.CDOIDTempObjectImpl;
-import org.eclipse.emf.cdo.internal.common.messages.Messages;
-import org.eclipse.emf.cdo.internal.common.revision.CDOIDAndBranchImpl;
-import org.eclipse.emf.cdo.internal.common.revision.CDOIDAndVersionImpl;
-import org.eclipse.emf.cdo.spi.common.id.AbstractCDOID;
-import org.eclipse.emf.cdo.spi.common.id.AbstractCDOIDByteArray;
-import org.eclipse.emf.cdo.spi.common.id.AbstractCDOIDLong;
-import org.eclipse.emf.cdo.spi.common.id.AbstractCDOIDString;
-import org.eclipse.emf.cdo.spi.common.id.InternalCDOIDObject;
-
-import org.eclipse.net4j.util.ObjectUtil;
-import org.eclipse.net4j.util.UUIDGenerator;
-
-import java.text.MessageFormat;
-
-/**
- * Various static methods that may help with CDO {@link CDOID IDs}.
- *
- * @author Eike Stepper
- * @since 2.0
- */
-public final class CDOIDUtil
-{
- private CDOIDUtil()
- {
- }
-
- /**
- * @since 2.0
- */
- public static boolean isNull(CDOID id)
- {
- return id == null || id.isNull();
- }
-
- public static long getLong(CDOID id)
- {
- if (id == null)
- {
- return AbstractCDOIDLong.NULL_VALUE;
- }
-
- switch (id.getType())
- {
- case NULL:
- return AbstractCDOIDLong.NULL_VALUE;
-
- case OBJECT:
- if (id instanceof AbstractCDOIDLong)
- {
- return ((AbstractCDOIDLong)id).getLongValue();
- }
-
- throw new IllegalArgumentException(MessageFormat.format(
- Messages.getString("CDOIDUtil.0"), id.getClass().getName())); //$NON-NLS-1$
-
- case TEMP_OBJECT:
- throw new IllegalArgumentException(Messages.getString("CDOIDUtil.1")); //$NON-NLS-1$
-
- case EXTERNAL_OBJECT:
- case EXTERNAL_TEMP_OBJECT:
- throw new IllegalArgumentException(Messages.getString("CDOIDUtil.2")); //$NON-NLS-1$
-
- default:
- throw new IllegalArgumentException(MessageFormat.format(
- Messages.getString("CDOIDUtil.3"), id.getClass().getName())); //$NON-NLS-1$
- }
- }
-
- /**
- * @since 4.0
- */
- public static String getString(CDOID id)
- {
- if (id == null)
- {
- return AbstractCDOIDString.NULL_VALUE;
- }
-
- switch (id.getType())
- {
- case NULL:
- return AbstractCDOIDString.NULL_VALUE;
-
- case OBJECT:
- if (id instanceof AbstractCDOIDString)
- {
- return ((AbstractCDOIDString)id).getStringValue();
- }
-
- throw new IllegalArgumentException(MessageFormat.format(
- Messages.getString("CDOIDUtil.0"), id.getClass().getName())); //$NON-NLS-1$
-
- case TEMP_OBJECT:
- throw new IllegalArgumentException(Messages.getString("CDOIDUtil.1")); //$NON-NLS-1$
-
- case EXTERNAL_OBJECT:
- case EXTERNAL_TEMP_OBJECT:
- if (id instanceof CDOIDExternalImpl)
- {
- return ((CDOIDExternalImpl)id).getURI();
- }
-
- throw new IllegalArgumentException(MessageFormat.format(
- Messages.getString("CDOIDUtil.0"), id.getClass().getName())); //$NON-NLS-1$
-
- default:
- throw new IllegalArgumentException(MessageFormat.format(
- Messages.getString("CDOIDUtil.3"), id.getClass().getName())); //$NON-NLS-1$
- }
- }
-
- /**
- * @since 4.1
- */
- public static byte[] getByteArray(CDOID id)
- {
- if (id == null)
- {
- return null;
- }
-
- switch (id.getType())
- {
- case NULL:
- return null;
-
- case OBJECT:
- if (id instanceof AbstractCDOIDByteArray)
- {
- return ((AbstractCDOIDByteArray)id).getByteArrayValue();
- }
-
- throw new IllegalArgumentException(MessageFormat.format(
- Messages.getString("CDOIDUtil.0"), id.getClass().getName())); //$NON-NLS-1$
-
- default:
- throw new IllegalArgumentException(MessageFormat.format(
- Messages.getString("CDOIDUtil.3"), id.getClass().getName())); //$NON-NLS-1$
- }
- }
-
- /**
- * @since 3.0
- */
- public static CDOClassifierRef getClassifierRef(CDOID id)
- {
- if (id instanceof CDOClassifierRef.Provider)
- {
- return ((CDOClassifierRef.Provider)id).getClassifierRef();
- }
-
- return null;
- }
-
- public static CDOIDTemp createTempObject(int value)
- {
- return new CDOIDTempObjectImpl(value);
- }
-
- /**
- * @since 3.0
- */
- public static CDOIDExternal createTempObjectExternal(String uri)
- {
- return new CDOIDTempObjectExternalImpl(uri);
- }
-
- public static CDOID createLong(long value)
- {
- if (value == AbstractCDOIDLong.NULL_VALUE)
- {
- return CDOID.NULL;
- }
-
- return new CDOIDObjectLongImpl(value);
- }
-
- /**
- * @since 3.0
- */
- public static CDOID createLongWithClassifier(CDOClassifierRef classifierRef, long value)
- {
- return new CDOIDObjectLongWithClassifierImpl(classifierRef, value);
- }
-
- /**
- * @since 4.0
- */
- public static CDOID createString(String value)
- {
- return new CDOIDObjectStringImpl(value);
- }
-
- /**
- * @since 3.0
- */
- public static CDOID createStringWithClassifier(CDOClassifierRef classifierRef, String value)
- {
- return new CDOIDObjectStringWithClassifierImpl(classifierRef, value);
- }
-
- /**
- * @since 4.1
- */
- public static CDOID createUUID(byte[] value)
- {
- return new CDOIDObjectUUIDImpl(value);
- }
-
- /**
- * @since 4.1
- */
- public static CDOID createUUID()
- {
- byte[] value = new byte[16];
- UUIDGenerator.DEFAULT.generate(value);
- return createUUID(value);
- }
-
- /**
- * @since 4.1
- */
- public static String encodeUUID(byte[] bytes)
- {
- return UUIDGenerator.DEFAULT.encode(bytes);
- }
-
- /**
- * @since 4.1
- */
- public static byte[] decodeUUID(String string)
- {
- return UUIDGenerator.DEFAULT.decode(string);
- }
-
- /**
- * @since 2.0
- */
- public static CDOIDExternal createExternal(String uri)
- {
- return new CDOIDExternalImpl(uri);
- }
-
- /**
- * @since 4.0
- */
- public static CDOIDAndVersion createIDAndVersion(CDOID id, int version)
- {
- return new CDOIDAndVersionImpl(id, version);
- }
-
- /**
- * @since 4.0
- */
- public static CDOIDAndVersion createIDAndVersion(CDOIDAndVersion source)
- {
- return createIDAndVersion(source.getID(), source.getVersion());
- }
-
- /**
- * @since 4.0
- */
- public static CDOIDAndBranch createIDAndBranch(CDOID id, CDOBranch branch)
- {
- return new CDOIDAndBranchImpl(id, branch);
- }
-
- /**
- * Creates the correct implementation class for the passed {@link CDOID.ObjectType}.
- *
- * @param subType
- * the subType for which to create an empty CDOID instance
- * @return the instance of CDOIDObject which represents the subtype.
- * @since 3.0
- */
- public static AbstractCDOID createCDOIDObject(CDOID.ObjectType subType)
- {
- if (subType == null)
- {
- throw new IllegalArgumentException("SubType may not be null");
- }
-
- InternalCDOIDObject id;
- switch (subType)
- {
- case LONG:
- id = new CDOIDObjectLongImpl();
- break;
-
- case STRING:
- id = new CDOIDObjectStringImpl();
- break;
-
- case LONG_WITH_CLASSIFIER:
- id = new CDOIDObjectLongWithClassifierImpl();
- break;
-
- case STRING_WITH_CLASSIFIER:
- id = new CDOIDObjectStringWithClassifierImpl();
- break;
-
- case UUID:
- id = new CDOIDObjectUUIDImpl();
- break;
-
- default:
- throw new IllegalArgumentException("Subtype " + subType.name() + " not supported");
- }
-
- if (id.getSubType() != subType)
- {
- throw new IllegalStateException("Subtype of created id " + id + " is unequal (" + id.getSubType().name()
- + ") to requested subtype " + subType.name());
- }
-
- return (AbstractCDOID)id;
- }
-
- /**
- * Format of the uri fragment.
- * <p>
- * Non-legacy: <code>&lt;ID TYPE>/&lt;CUSTOM STRING FROM OBJECT FACTORY></code>
- * <p>
- * Legacy: <code>&lt;ID TYPE>/&lt;PACKAGE URI>/&lt;CLASSIFIER ID>/&lt;CUSTOM STRING FROM OBJECT FACTORY></code>
- *
- * @since 2.0
- */
- public static void write(StringBuilder builder, CDOID id)
- {
- if (id == null)
- {
- id = CDOID.NULL;
- }
-
- if (id instanceof InternalCDOIDObject)
- {
- ObjectType subType = ((InternalCDOIDObject)id).getSubType();
- builder.append(subType.getID());
- }
- else
- {
- Type type = id.getType();
- builder.append(type.getID());
- }
-
- builder.append(id.toURIFragment());
- }
-
- /**
- * Format of the URI fragment.
- * <p>
- * Non-legacy: <code>&lt;ID TYPE>/&lt;CUSTOM STRING FROM OBJECT FACTORY></code>
- * <p>
- * Legacy: <code>&lt;ID TYPE>/&lt;PACKAGE URI>/&lt;CLASSIFIER ID>/&lt;CUSTOM STRING FROM OBJECT FACTORY></code>
- *
- * @since 3.0
- */
- public static CDOID read(String uriFragment)
- {
- char typeID = uriFragment.charAt(0);
- Enum<?> literal = CDOID.Type.getLiteral(typeID);
- if (literal == null)
- {
- throw new IllegalArgumentException("Unknown type ID: " + typeID);
- }
-
- String fragment = uriFragment.substring(1);
- if (literal instanceof ObjectType)
- {
- return readCDOIDObject((ObjectType)literal, fragment);
- }
-
- Type type = (Type)literal;
- switch (type)
- {
- case NULL:
- return CDOID.NULL;
-
- case TEMP_OBJECT:
- return new CDOIDTempObjectImpl(Integer.valueOf(fragment));
-
- case EXTERNAL_OBJECT:
- return new CDOIDExternalImpl(fragment);
-
- case EXTERNAL_TEMP_OBJECT:
- return new CDOIDTempObjectExternalImpl(fragment);
-
- case OBJECT:
- {
- // Normally this case should not occur (is an OBJECT subtype).
- throw new IllegalArgumentException();
- }
-
- default:
- throw new IllegalArgumentException(MessageFormat.format(Messages.getString("CDOIDUtil.5"), uriFragment)); //$NON-NLS-1$
- }
- }
-
- private static CDOID readCDOIDObject(CDOID.ObjectType subType, String fragment)
- {
- AbstractCDOID id = createCDOIDObject(subType);
- id.read(fragment);
- return id;
- }
-
- /**
- * @since 2.0
- */
- public static boolean equals(CDOID id1, CDOID id2)
- {
- if (id1 == null)
- {
- id1 = CDOID.NULL;
- }
-
- if (id2 == null)
- {
- id2 = CDOID.NULL;
- }
-
- return ObjectUtil.equals(id1, id2);
- }
-}
+/*
+ * Copyright (c) 2004 - 2012 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 - bug 226778
+ * Simon McDuff - bug 213402
+ * Martin Taal - Added subtype handling and EClass conversion, bug 283106
+ */
+package org.eclipse.emf.cdo.common.id;
+
+import org.eclipse.emf.cdo.common.branch.CDOBranch;
+import org.eclipse.emf.cdo.common.id.CDOID.ObjectType;
+import org.eclipse.emf.cdo.common.id.CDOID.Type;
+import org.eclipse.emf.cdo.common.model.CDOClassifierRef;
+import org.eclipse.emf.cdo.common.revision.CDOIDAndBranch;
+import org.eclipse.emf.cdo.common.revision.CDOIDAndVersion;
+import org.eclipse.emf.cdo.internal.common.id.CDOIDExternalImpl;
+import org.eclipse.emf.cdo.internal.common.id.CDOIDObjectLongImpl;
+import org.eclipse.emf.cdo.internal.common.id.CDOIDObjectLongWithClassifierImpl;
+import org.eclipse.emf.cdo.internal.common.id.CDOIDObjectStringImpl;
+import org.eclipse.emf.cdo.internal.common.id.CDOIDObjectStringWithClassifierImpl;
+import org.eclipse.emf.cdo.internal.common.id.CDOIDObjectUUIDImpl;
+import org.eclipse.emf.cdo.internal.common.id.CDOIDTempObjectExternalImpl;
+import org.eclipse.emf.cdo.internal.common.id.CDOIDTempObjectImpl;
+import org.eclipse.emf.cdo.internal.common.messages.Messages;
+import org.eclipse.emf.cdo.internal.common.revision.CDOIDAndBranchImpl;
+import org.eclipse.emf.cdo.internal.common.revision.CDOIDAndVersionImpl;
+import org.eclipse.emf.cdo.spi.common.id.AbstractCDOID;
+import org.eclipse.emf.cdo.spi.common.id.AbstractCDOIDByteArray;
+import org.eclipse.emf.cdo.spi.common.id.AbstractCDOIDLong;
+import org.eclipse.emf.cdo.spi.common.id.AbstractCDOIDString;
+import org.eclipse.emf.cdo.spi.common.id.InternalCDOIDObject;
+
+import org.eclipse.net4j.util.ObjectUtil;
+import org.eclipse.net4j.util.UUIDGenerator;
+
+import java.text.MessageFormat;
+
+/**
+ * Various static methods that may help with CDO {@link CDOID IDs}.
+ *
+ * @author Eike Stepper
+ * @since 2.0
+ */
+public final class CDOIDUtil
+{
+ private CDOIDUtil()
+ {
+ }
+
+ /**
+ * @since 2.0
+ */
+ public static boolean isNull(CDOID id)
+ {
+ return id == null || id.isNull();
+ }
+
+ public static long getLong(CDOID id)
+ {
+ if (id == null)
+ {
+ return AbstractCDOIDLong.NULL_VALUE;
+ }
+
+ switch (id.getType())
+ {
+ case NULL:
+ return AbstractCDOIDLong.NULL_VALUE;
+
+ case OBJECT:
+ if (id instanceof AbstractCDOIDLong)
+ {
+ return ((AbstractCDOIDLong)id).getLongValue();
+ }
+
+ throw new IllegalArgumentException(MessageFormat.format(
+ Messages.getString("CDOIDUtil.0"), id.getClass().getName())); //$NON-NLS-1$
+
+ case TEMP_OBJECT:
+ throw new IllegalArgumentException(Messages.getString("CDOIDUtil.1")); //$NON-NLS-1$
+
+ case EXTERNAL_OBJECT:
+ case EXTERNAL_TEMP_OBJECT:
+ throw new IllegalArgumentException(Messages.getString("CDOIDUtil.2")); //$NON-NLS-1$
+
+ default:
+ throw new IllegalArgumentException(MessageFormat.format(
+ Messages.getString("CDOIDUtil.3"), id.getClass().getName())); //$NON-NLS-1$
+ }
+ }
+
+ /**
+ * @since 4.0
+ */
+ public static String getString(CDOID id)
+ {
+ if (id == null)
+ {
+ return AbstractCDOIDString.NULL_VALUE;
+ }
+
+ switch (id.getType())
+ {
+ case NULL:
+ return AbstractCDOIDString.NULL_VALUE;
+
+ case OBJECT:
+ if (id instanceof AbstractCDOIDString)
+ {
+ return ((AbstractCDOIDString)id).getStringValue();
+ }
+
+ throw new IllegalArgumentException(MessageFormat.format(
+ Messages.getString("CDOIDUtil.0"), id.getClass().getName())); //$NON-NLS-1$
+
+ case TEMP_OBJECT:
+ throw new IllegalArgumentException(Messages.getString("CDOIDUtil.1")); //$NON-NLS-1$
+
+ case EXTERNAL_OBJECT:
+ case EXTERNAL_TEMP_OBJECT:
+ if (id instanceof CDOIDExternalImpl)
+ {
+ return ((CDOIDExternalImpl)id).getURI();
+ }
+
+ throw new IllegalArgumentException(MessageFormat.format(
+ Messages.getString("CDOIDUtil.0"), id.getClass().getName())); //$NON-NLS-1$
+
+ default:
+ throw new IllegalArgumentException(MessageFormat.format(
+ Messages.getString("CDOIDUtil.3"), id.getClass().getName())); //$NON-NLS-1$
+ }
+ }
+
+ /**
+ * @since 4.1
+ */
+ public static byte[] getByteArray(CDOID id)
+ {
+ if (id == null)
+ {
+ return null;
+ }
+
+ switch (id.getType())
+ {
+ case NULL:
+ return null;
+
+ case OBJECT:
+ if (id instanceof AbstractCDOIDByteArray)
+ {
+ return ((AbstractCDOIDByteArray)id).getByteArrayValue();
+ }
+
+ throw new IllegalArgumentException(MessageFormat.format(
+ Messages.getString("CDOIDUtil.0"), id.getClass().getName())); //$NON-NLS-1$
+
+ default:
+ throw new IllegalArgumentException(MessageFormat.format(
+ Messages.getString("CDOIDUtil.3"), id.getClass().getName())); //$NON-NLS-1$
+ }
+ }
+
+ /**
+ * @since 3.0
+ */
+ public static CDOClassifierRef getClassifierRef(CDOID id)
+ {
+ if (id instanceof CDOClassifierRef.Provider)
+ {
+ return ((CDOClassifierRef.Provider)id).getClassifierRef();
+ }
+
+ return null;
+ }
+
+ public static CDOIDTemp createTempObject(int value)
+ {
+ return new CDOIDTempObjectImpl(value);
+ }
+
+ /**
+ * @since 3.0
+ */
+ public static CDOIDExternal createTempObjectExternal(String uri)
+ {
+ return new CDOIDTempObjectExternalImpl(uri);
+ }
+
+ public static CDOID createLong(long value)
+ {
+ if (value == AbstractCDOIDLong.NULL_VALUE)
+ {
+ return CDOID.NULL;
+ }
+
+ return new CDOIDObjectLongImpl(value);
+ }
+
+ /**
+ * @since 3.0
+ */
+ public static CDOID createLongWithClassifier(CDOClassifierRef classifierRef, long value)
+ {
+ return new CDOIDObjectLongWithClassifierImpl(classifierRef, value);
+ }
+
+ /**
+ * @since 4.0
+ */
+ public static CDOID createString(String value)
+ {
+ return new CDOIDObjectStringImpl(value);
+ }
+
+ /**
+ * @since 3.0
+ */
+ public static CDOID createStringWithClassifier(CDOClassifierRef classifierRef, String value)
+ {
+ return new CDOIDObjectStringWithClassifierImpl(classifierRef, value);
+ }
+
+ /**
+ * @since 4.1
+ */
+ public static CDOID createUUID(byte[] value)
+ {
+ return new CDOIDObjectUUIDImpl(value);
+ }
+
+ /**
+ * @since 4.1
+ */
+ public static CDOID createUUID()
+ {
+ byte[] value = new byte[16];
+ UUIDGenerator.DEFAULT.generate(value);
+ return createUUID(value);
+ }
+
+ /**
+ * @since 4.1
+ */
+ public static String encodeUUID(byte[] bytes)
+ {
+ return UUIDGenerator.DEFAULT.encode(bytes);
+ }
+
+ /**
+ * @since 4.1
+ */
+ public static byte[] decodeUUID(String string)
+ {
+ return UUIDGenerator.DEFAULT.decode(string);
+ }
+
+ /**
+ * @since 2.0
+ */
+ public static CDOIDExternal createExternal(String uri)
+ {
+ return new CDOIDExternalImpl(uri);
+ }
+
+ /**
+ * @since 4.0
+ */
+ public static CDOIDAndVersion createIDAndVersion(CDOID id, int version)
+ {
+ return new CDOIDAndVersionImpl(id, version);
+ }
+
+ /**
+ * @since 4.0
+ */
+ public static CDOIDAndVersion createIDAndVersion(CDOIDAndVersion source)
+ {
+ return createIDAndVersion(source.getID(), source.getVersion());
+ }
+
+ /**
+ * @since 4.0
+ */
+ public static CDOIDAndBranch createIDAndBranch(CDOID id, CDOBranch branch)
+ {
+ return new CDOIDAndBranchImpl(id, branch);
+ }
+
+ /**
+ * Creates the correct implementation class for the passed {@link CDOID.ObjectType}.
+ *
+ * @param subType
+ * the subType for which to create an empty CDOID instance
+ * @return the instance of CDOIDObject which represents the subtype.
+ * @since 3.0
+ */
+ public static AbstractCDOID createCDOIDObject(CDOID.ObjectType subType)
+ {
+ if (subType == null)
+ {
+ throw new IllegalArgumentException("SubType may not be null");
+ }
+
+ InternalCDOIDObject id;
+ switch (subType)
+ {
+ case LONG:
+ id = new CDOIDObjectLongImpl();
+ break;
+
+ case STRING:
+ id = new CDOIDObjectStringImpl();
+ break;
+
+ case LONG_WITH_CLASSIFIER:
+ id = new CDOIDObjectLongWithClassifierImpl();
+ break;
+
+ case STRING_WITH_CLASSIFIER:
+ id = new CDOIDObjectStringWithClassifierImpl();
+ break;
+
+ case UUID:
+ id = new CDOIDObjectUUIDImpl();
+ break;
+
+ default:
+ throw new IllegalArgumentException("Subtype " + subType.name() + " not supported");
+ }
+
+ if (id.getSubType() != subType)
+ {
+ throw new IllegalStateException("Subtype of created id " + id + " is unequal (" + id.getSubType().name()
+ + ") to requested subtype " + subType.name());
+ }
+
+ return (AbstractCDOID)id;
+ }
+
+ /**
+ * Format of the uri fragment.
+ * <p>
+ * Non-legacy: <code>&lt;ID TYPE>/&lt;CUSTOM STRING FROM OBJECT FACTORY></code>
+ * <p>
+ * Legacy: <code>&lt;ID TYPE>/&lt;PACKAGE URI>/&lt;CLASSIFIER ID>/&lt;CUSTOM STRING FROM OBJECT FACTORY></code>
+ *
+ * @since 2.0
+ */
+ public static void write(StringBuilder builder, CDOID id)
+ {
+ if (id == null)
+ {
+ id = CDOID.NULL;
+ }
+
+ if (id instanceof InternalCDOIDObject)
+ {
+ ObjectType subType = ((InternalCDOIDObject)id).getSubType();
+ builder.append(subType.getID());
+ }
+ else
+ {
+ Type type = id.getType();
+ builder.append(type.getID());
+ }
+
+ builder.append(id.toURIFragment());
+ }
+
+ /**
+ * Format of the URI fragment.
+ * <p>
+ * Non-legacy: <code>&lt;ID TYPE>/&lt;CUSTOM STRING FROM OBJECT FACTORY></code>
+ * <p>
+ * Legacy: <code>&lt;ID TYPE>/&lt;PACKAGE URI>/&lt;CLASSIFIER ID>/&lt;CUSTOM STRING FROM OBJECT FACTORY></code>
+ *
+ * @since 3.0
+ */
+ public static CDOID read(String uriFragment)
+ {
+ char typeID = uriFragment.charAt(0);
+ Enum<?> literal = CDOID.Type.getLiteral(typeID);
+ if (literal == null)
+ {
+ throw new IllegalArgumentException("Unknown type ID: " + typeID);
+ }
+
+ String fragment = uriFragment.substring(1);
+ if (literal instanceof ObjectType)
+ {
+ return readCDOIDObject((ObjectType)literal, fragment);
+ }
+
+ Type type = (Type)literal;
+ switch (type)
+ {
+ case NULL:
+ return CDOID.NULL;
+
+ case TEMP_OBJECT:
+ return new CDOIDTempObjectImpl(Integer.valueOf(fragment));
+
+ case EXTERNAL_OBJECT:
+ return new CDOIDExternalImpl(fragment);
+
+ case EXTERNAL_TEMP_OBJECT:
+ return new CDOIDTempObjectExternalImpl(fragment);
+
+ case OBJECT:
+ {
+ // Normally this case should not occur (is an OBJECT subtype).
+ throw new IllegalArgumentException();
+ }
+
+ default:
+ throw new IllegalArgumentException(MessageFormat.format(Messages.getString("CDOIDUtil.5"), uriFragment)); //$NON-NLS-1$
+ }
+ }
+
+ private static CDOID readCDOIDObject(CDOID.ObjectType subType, String fragment)
+ {
+ AbstractCDOID id = createCDOIDObject(subType);
+ id.read(fragment);
+ return id;
+ }
+
+ /**
+ * @since 2.0
+ */
+ public static boolean equals(CDOID id1, CDOID id2)
+ {
+ if (id1 == null)
+ {
+ id1 = CDOID.NULL;
+ }
+
+ if (id2 == null)
+ {
+ id2 = CDOID.NULL;
+ }
+
+ return ObjectUtil.equals(id1, id2);
+ }
+}
diff --git a/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/common/id/CDOReference.java b/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/common/id/CDOReference.java
index af7e8da1a8..a6af2693bc 100644
--- a/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/common/id/CDOReference.java
+++ b/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/common/id/CDOReference.java
@@ -1,43 +1,43 @@
-/*
- * Copyright (c) 2004 - 2011 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.id;
-
-import org.eclipse.emf.common.notify.Notification;
-import org.eclipse.emf.ecore.EAttribute;
-import org.eclipse.emf.ecore.EReference;
-import org.eclipse.emf.ecore.EStructuralFeature;
-import org.eclipse.emf.ecore.util.FeatureMap;
-
-/**
- * Represents a reference from one object to another object, possibly {@link CDOID} or CDOObject typed.
- *
- * @author Eike Stepper
- * @since 4.0
- * @noextend This interface is not intended to be extended by clients.
- * @noimplement This interface is not intended to be implemented by clients.
- * @apiviz.has {@link org.eclipse.emf.ecore.EStructuralFeature}
- */
-public interface CDOReference<OBJECT>
-{
- public static final int NO_INDEX = Notification.NO_INDEX;
-
- public OBJECT getTargetObject();
-
- public OBJECT getSourceObject();
-
- /**
- * Returns the source {@link EReference} or the source {@link EAttribute} if the source feature is a
- * {@link FeatureMap}.
- */
- public EStructuralFeature getSourceFeature();
-
- public int getSourceIndex();
-}
+/*
+ * Copyright (c) 2004 - 2012 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.id;
+
+import org.eclipse.emf.common.notify.Notification;
+import org.eclipse.emf.ecore.EAttribute;
+import org.eclipse.emf.ecore.EReference;
+import org.eclipse.emf.ecore.EStructuralFeature;
+import org.eclipse.emf.ecore.util.FeatureMap;
+
+/**
+ * Represents a reference from one object to another object, possibly {@link CDOID} or CDOObject typed.
+ *
+ * @author Eike Stepper
+ * @since 4.0
+ * @noextend This interface is not intended to be extended by clients.
+ * @noimplement This interface is not intended to be implemented by clients.
+ * @apiviz.has {@link org.eclipse.emf.ecore.EStructuralFeature}
+ */
+public interface CDOReference<OBJECT>
+{
+ public static final int NO_INDEX = Notification.NO_INDEX;
+
+ public OBJECT getTargetObject();
+
+ public OBJECT getSourceObject();
+
+ /**
+ * Returns the source {@link EReference} or the source {@link EAttribute} if the source feature is a
+ * {@link FeatureMap}.
+ */
+ public EStructuralFeature getSourceFeature();
+
+ public int getSourceIndex();
+}
diff --git a/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/common/id/CDOWithID.java b/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/common/id/CDOWithID.java
index 3815258e29..1868346cdf 100644
--- a/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/common/id/CDOWithID.java
+++ b/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/common/id/CDOWithID.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2004 - 2011 Eike Stepper (Berlin, Germany) and others.
+ * Copyright (c) 2004 - 2012 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
diff --git a/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/common/id/package-info.java b/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/common/id/package-info.java
index a642658e9c..67bb822de0 100644
--- a/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/common/id/package-info.java
+++ b/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/common/id/package-info.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2004 - 2011 Eike Stepper (Berlin, Germany) and others.
+ * Copyright (c) 2004 - 2012 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
diff --git a/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/common/lob/CDOBlob.java b/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/common/lob/CDOBlob.java
index 260144976f..c3c2bb78f1 100644
--- a/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/common/lob/CDOBlob.java
+++ b/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/common/lob/CDOBlob.java
@@ -1,60 +1,60 @@
-/*
- * Copyright (c) 2004 - 2011 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.lob;
-
-import org.eclipse.emf.cdo.spi.common.CDOLobStoreImpl;
-
-import org.eclipse.net4j.util.io.ExtendedDataInput;
-
-import java.io.IOException;
-import java.io.InputStream;
-
-/**
- * A identifiable binary large object with streaming support.
- *
- * @author Eike Stepper
- * @since 4.0
- * @apiviz.landmark
- */
-public final class CDOBlob extends CDOLob<InputStream>
-{
- public CDOBlob(InputStream contents) throws IOException
- {
- super(contents, CDOLobStoreImpl.INSTANCE);
- }
-
- public CDOBlob(InputStream contents, CDOLobStore store) throws IOException
- {
- super(contents, store);
- }
-
- CDOBlob(byte[] id, long size)
- {
- super(id, size);
- }
-
- CDOBlob(ExtendedDataInput in) throws IOException
- {
- super(in);
- }
-
- @Override
- public InputStream getContents() throws IOException
- {
- return getStore().getBinary(this);
- }
-
- @Override
- protected CDOLobInfo put(InputStream contents) throws IOException
- {
- return getStore().putBinary(contents);
- }
-}
+/*
+ * Copyright (c) 2004 - 2012 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.lob;
+
+import org.eclipse.emf.cdo.spi.common.CDOLobStoreImpl;
+
+import org.eclipse.net4j.util.io.ExtendedDataInput;
+
+import java.io.IOException;
+import java.io.InputStream;
+
+/**
+ * A identifiable binary large object with streaming support.
+ *
+ * @author Eike Stepper
+ * @since 4.0
+ * @apiviz.landmark
+ */
+public final class CDOBlob extends CDOLob<InputStream>
+{
+ public CDOBlob(InputStream contents) throws IOException
+ {
+ super(contents, CDOLobStoreImpl.INSTANCE);
+ }
+
+ public CDOBlob(InputStream contents, CDOLobStore store) throws IOException
+ {
+ super(contents, store);
+ }
+
+ CDOBlob(byte[] id, long size)
+ {
+ super(id, size);
+ }
+
+ CDOBlob(ExtendedDataInput in) throws IOException
+ {
+ super(in);
+ }
+
+ @Override
+ public InputStream getContents() throws IOException
+ {
+ return getStore().getBinary(this);
+ }
+
+ @Override
+ protected CDOLobInfo put(InputStream contents) throws IOException
+ {
+ return getStore().putBinary(contents);
+ }
+}
diff --git a/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/common/lob/CDOClob.java b/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/common/lob/CDOClob.java
index 630fa70930..8d195a4605 100644
--- a/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/common/lob/CDOClob.java
+++ b/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/common/lob/CDOClob.java
@@ -1,60 +1,60 @@
-/*
- * Copyright (c) 2004 - 2011 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.lob;
-
-import org.eclipse.emf.cdo.spi.common.CDOLobStoreImpl;
-
-import org.eclipse.net4j.util.io.ExtendedDataInput;
-
-import java.io.IOException;
-import java.io.Reader;
-
-/**
- * A identifiable character large object with streaming support.
- *
- * @author Eike Stepper
- * @since 4.0
- * @apiviz.landmark
- */
-public final class CDOClob extends CDOLob<Reader>
-{
- public CDOClob(Reader contents) throws IOException
- {
- super(contents, CDOLobStoreImpl.INSTANCE);
- }
-
- public CDOClob(Reader contents, CDOLobStore store) throws IOException
- {
- super(contents, store);
- }
-
- CDOClob(byte[] id, long size)
- {
- super(id, size);
- }
-
- CDOClob(ExtendedDataInput in) throws IOException
- {
- super(in);
- }
-
- @Override
- public Reader getContents() throws IOException
- {
- return getStore().getCharacter(this);
- }
-
- @Override
- protected CDOLobInfo put(Reader contents) throws IOException
- {
- return getStore().putCharacter(contents);
- }
-}
+/*
+ * Copyright (c) 2004 - 2012 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.lob;
+
+import org.eclipse.emf.cdo.spi.common.CDOLobStoreImpl;
+
+import org.eclipse.net4j.util.io.ExtendedDataInput;
+
+import java.io.IOException;
+import java.io.Reader;
+
+/**
+ * A identifiable character large object with streaming support.
+ *
+ * @author Eike Stepper
+ * @since 4.0
+ * @apiviz.landmark
+ */
+public final class CDOClob extends CDOLob<Reader>
+{
+ public CDOClob(Reader contents) throws IOException
+ {
+ super(contents, CDOLobStoreImpl.INSTANCE);
+ }
+
+ public CDOClob(Reader contents, CDOLobStore store) throws IOException
+ {
+ super(contents, store);
+ }
+
+ CDOClob(byte[] id, long size)
+ {
+ super(id, size);
+ }
+
+ CDOClob(ExtendedDataInput in) throws IOException
+ {
+ super(in);
+ }
+
+ @Override
+ public Reader getContents() throws IOException
+ {
+ return getStore().getCharacter(this);
+ }
+
+ @Override
+ protected CDOLobInfo put(Reader contents) throws IOException
+ {
+ return getStore().putCharacter(contents);
+ }
+}
diff --git a/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/common/lob/CDOLob.java b/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/common/lob/CDOLob.java
index 74bdc1d9f5..e1621d76ef 100644
--- a/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/common/lob/CDOLob.java
+++ b/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/common/lob/CDOLob.java
@@ -1,69 +1,69 @@
-/*
- * Copyright (c) 2004 - 2011 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.lob;
-
-import org.eclipse.net4j.util.io.ExtendedDataInput;
-import org.eclipse.net4j.util.io.ExtendedDataOutput;
-
-import java.io.IOException;
-
-/**
- * A identifiable large object with streaming support.
- *
- * @author Eike Stepper
- * @since 4.0
- * @noextend This interface is not intended to be extended by clients.
- * @noimplement This interface is not intended to be implemented by clients.
- */
-public abstract class CDOLob<IO> extends CDOLobInfo
-{
- private CDOLobStore store;
-
- CDOLob(byte[] id, long size)
- {
- this.id = id;
- this.size = size;
- }
-
- CDOLob(IO contents, CDOLobStore store) throws IOException
- {
- this.store = store;
- CDOLobInfo info = put(contents);
- id = info.getID();
- size = info.getSize();
- }
-
- CDOLob(ExtendedDataInput in) throws IOException
- {
- id = in.readByteArray();
- size = in.readLong();
- }
-
- final void write(ExtendedDataOutput out) throws IOException
- {
- out.writeByteArray(id);
- out.writeLong(size);
- }
-
- final void setStore(CDOLobStore store)
- {
- this.store = store;
- }
-
- public final CDOLobStore getStore()
- {
- return store;
- }
-
- public abstract IO getContents() throws IOException;
-
- protected abstract CDOLobInfo put(IO contents) throws IOException;
-}
+/*
+ * Copyright (c) 2004 - 2012 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.lob;
+
+import org.eclipse.net4j.util.io.ExtendedDataInput;
+import org.eclipse.net4j.util.io.ExtendedDataOutput;
+
+import java.io.IOException;
+
+/**
+ * A identifiable large object with streaming support.
+ *
+ * @author Eike Stepper
+ * @since 4.0
+ * @noextend This interface is not intended to be extended by clients.
+ * @noimplement This interface is not intended to be implemented by clients.
+ */
+public abstract class CDOLob<IO> extends CDOLobInfo
+{
+ private CDOLobStore store;
+
+ CDOLob(byte[] id, long size)
+ {
+ this.id = id;
+ this.size = size;
+ }
+
+ CDOLob(IO contents, CDOLobStore store) throws IOException
+ {
+ this.store = store;
+ CDOLobInfo info = put(contents);
+ id = info.getID();
+ size = info.getSize();
+ }
+
+ CDOLob(ExtendedDataInput in) throws IOException
+ {
+ id = in.readByteArray();
+ size = in.readLong();
+ }
+
+ final void write(ExtendedDataOutput out) throws IOException
+ {
+ out.writeByteArray(id);
+ out.writeLong(size);
+ }
+
+ final void setStore(CDOLobStore store)
+ {
+ this.store = store;
+ }
+
+ public final CDOLobStore getStore()
+ {
+ return store;
+ }
+
+ public abstract IO getContents() throws IOException;
+
+ protected abstract CDOLobInfo put(IO contents) throws IOException;
+}
diff --git a/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/common/lob/CDOLobHandler.java b/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/common/lob/CDOLobHandler.java
index c04f0264f0..0262df1275 100644
--- a/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/common/lob/CDOLobHandler.java
+++ b/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/common/lob/CDOLobHandler.java
@@ -1,41 +1,41 @@
-/*
- * Copyright (c) 2004 - 2011 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.lob;
-
-import java.io.IOException;
-import java.io.OutputStream;
-import java.io.Writer;
-
-/**
- * A callback interface for handling large objects.
- *
- * @author Eike Stepper
- * @since 4.0
- * @apiviz.uses {@link CDOLob} - - handles
- */
-public interface CDOLobHandler
-{
- /**
- * A callback method for handling a {@link CDOBlob binary large object}. The {@link CDOLob#getID() ID} and
- * {@link CDOLob#getSize() size} of the blob are passed by the caller. The implementor may return a
- * {@link OutputStream stream} that the blob content will be written to by the caller of this method, or
- * <code>null</code> to indicate that the content is not needed.
- */
- public OutputStream handleBlob(byte[] id, long size) throws IOException;
-
- /**
- * A callback method for handling a {@link CDOClob character large object}. The {@link CDOLob#getID() ID} and
- * {@link CDOLob#getSize() size} of the blob are passed by the caller. The implementor may return a {@link Writer
- * writer} that the blob content will be written to by the caller of this method, or <code>null</code> to indicate
- * that the content is not needed.
- */
- public Writer handleClob(byte[] id, long size) throws IOException;
-}
+/*
+ * Copyright (c) 2004 - 2012 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.lob;
+
+import java.io.IOException;
+import java.io.OutputStream;
+import java.io.Writer;
+
+/**
+ * A callback interface for handling large objects.
+ *
+ * @author Eike Stepper
+ * @since 4.0
+ * @apiviz.uses {@link CDOLob} - - handles
+ */
+public interface CDOLobHandler
+{
+ /**
+ * A callback method for handling a {@link CDOBlob binary large object}. The {@link CDOLob#getID() ID} and
+ * {@link CDOLob#getSize() size} of the blob are passed by the caller. The implementor may return a
+ * {@link OutputStream stream} that the blob content will be written to by the caller of this method, or
+ * <code>null</code> to indicate that the content is not needed.
+ */
+ public OutputStream handleBlob(byte[] id, long size) throws IOException;
+
+ /**
+ * A callback method for handling a {@link CDOClob character large object}. The {@link CDOLob#getID() ID} and
+ * {@link CDOLob#getSize() size} of the blob are passed by the caller. The implementor may return a {@link Writer
+ * writer} that the blob content will be written to by the caller of this method, or <code>null</code> to indicate
+ * that the content is not needed.
+ */
+ public Writer handleClob(byte[] id, long size) throws IOException;
+}
diff --git a/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/common/lob/CDOLobInfo.java b/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/common/lob/CDOLobInfo.java
index 33204e7a24..05a4319be0 100644
--- a/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/common/lob/CDOLobInfo.java
+++ b/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/common/lob/CDOLobInfo.java
@@ -1,59 +1,59 @@
-/*
- * Copyright (c) 2004 - 2011 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.lob;
-
-import org.eclipse.net4j.util.HexUtil;
-
-import java.text.MessageFormat;
-
-/**
- * Encapsulates {@link #getID() ID} and {@link #getSize() size} of a {@link CDOLob large object}.
- *
- * @author Eike Stepper
- * @since 4.0
- * @noextend This interface is not intended to be extended by clients.
- * @noinstantiate This class is not intended to be instantiated by clients.
- */
-public class CDOLobInfo
-{
- byte[] id;
-
- long size;
-
- CDOLobInfo()
- {
- }
-
- public CDOLobInfo(byte[] id, long size)
- {
- this.id = id;
- this.size = size;
- }
-
- /**
- * The identifier of this large object. A SHA-1 digest of the content of this large object.
- */
- public final byte[] getID()
- {
- return id;
- }
-
- public final long getSize()
- {
- return size;
- }
-
- @Override
- public String toString()
- {
- return MessageFormat.format("{0}[id={1}, size={2}]", getClass().getSimpleName(), HexUtil.bytesToHex(id), size);
- }
-}
+/*
+ * Copyright (c) 2004 - 2012 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.lob;
+
+import org.eclipse.net4j.util.HexUtil;
+
+import java.text.MessageFormat;
+
+/**
+ * Encapsulates {@link #getID() ID} and {@link #getSize() size} of a {@link CDOLob large object}.
+ *
+ * @author Eike Stepper
+ * @since 4.0
+ * @noextend This interface is not intended to be extended by clients.
+ * @noinstantiate This class is not intended to be instantiated by clients.
+ */
+public class CDOLobInfo
+{
+ byte[] id;
+
+ long size;
+
+ CDOLobInfo()
+ {
+ }
+
+ public CDOLobInfo(byte[] id, long size)
+ {
+ this.id = id;
+ this.size = size;
+ }
+
+ /**
+ * The identifier of this large object. A SHA-1 digest of the content of this large object.
+ */
+ public final byte[] getID()
+ {
+ return id;
+ }
+
+ public final long getSize()
+ {
+ return size;
+ }
+
+ @Override
+ public String toString()
+ {
+ return MessageFormat.format("{0}[id={1}, size={2}]", getClass().getSimpleName(), HexUtil.bytesToHex(id), size);
+ }
+}
diff --git a/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/common/lob/CDOLobStore.java b/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/common/lob/CDOLobStore.java
index 10fbde1844..66d3a421a8 100644
--- a/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/common/lob/CDOLobStore.java
+++ b/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/common/lob/CDOLobStore.java
@@ -1,78 +1,78 @@
-/*
- * Copyright (c) 2004 - 2011 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.lob;
-
-import java.io.File;
-import java.io.IOException;
-import java.io.InputStream;
-import java.io.Reader;
-
-/**
- * Stores and loads {@link CDOLob large objects}.
- *
- * @author Eike Stepper
- * @since 4.0
- * @apiviz.composedOf {@link CDOLob}
- */
-public interface CDOLobStore
-{
- public File getBinaryFile(byte[] id);
-
- public InputStream getBinary(CDOLobInfo info) throws IOException;
-
- public CDOLobInfo putBinary(InputStream contents) throws IOException;
-
- public File getCharacterFile(byte[] id);
-
- public Reader getCharacter(CDOLobInfo info) throws IOException;
-
- public CDOLobInfo putCharacter(Reader contents) throws IOException;
-
- /**
- * An abstract {@link CDOLobStore large object store} that delegates all method calls to a delegate.
- *
- * @author Eike Stepper
- */
- public static abstract class Delegating implements CDOLobStore
- {
- public File getBinaryFile(byte[] id)
- {
- return getDelegate().getBinaryFile(id);
- }
-
- public InputStream getBinary(CDOLobInfo info) throws IOException
- {
- return getDelegate().getBinary(info);
- }
-
- public CDOLobInfo putBinary(InputStream contents) throws IOException
- {
- return getDelegate().putBinary(contents);
- }
-
- public File getCharacterFile(byte[] id)
- {
- return getDelegate().getCharacterFile(id);
- }
-
- public Reader getCharacter(CDOLobInfo info) throws IOException
- {
- return getDelegate().getCharacter(info);
- }
-
- public CDOLobInfo putCharacter(Reader contents) throws IOException
- {
- return getDelegate().putCharacter(contents);
- }
-
- protected abstract CDOLobStore getDelegate();
- }
-}
+/*
+ * Copyright (c) 2004 - 2012 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.lob;
+
+import java.io.File;
+import java.io.IOException;
+import java.io.InputStream;
+import java.io.Reader;
+
+/**
+ * Stores and loads {@link CDOLob large objects}.
+ *
+ * @author Eike Stepper
+ * @since 4.0
+ * @apiviz.composedOf {@link CDOLob}
+ */
+public interface CDOLobStore
+{
+ public File getBinaryFile(byte[] id);
+
+ public InputStream getBinary(CDOLobInfo info) throws IOException;
+
+ public CDOLobInfo putBinary(InputStream contents) throws IOException;
+
+ public File getCharacterFile(byte[] id);
+
+ public Reader getCharacter(CDOLobInfo info) throws IOException;
+
+ public CDOLobInfo putCharacter(Reader contents) throws IOException;
+
+ /**
+ * An abstract {@link CDOLobStore large object store} that delegates all method calls to a delegate.
+ *
+ * @author Eike Stepper
+ */
+ public static abstract class Delegating implements CDOLobStore
+ {
+ public File getBinaryFile(byte[] id)
+ {
+ return getDelegate().getBinaryFile(id);
+ }
+
+ public InputStream getBinary(CDOLobInfo info) throws IOException
+ {
+ return getDelegate().getBinary(info);
+ }
+
+ public CDOLobInfo putBinary(InputStream contents) throws IOException
+ {
+ return getDelegate().putBinary(contents);
+ }
+
+ public File getCharacterFile(byte[] id)
+ {
+ return getDelegate().getCharacterFile(id);
+ }
+
+ public Reader getCharacter(CDOLobInfo info) throws IOException
+ {
+ return getDelegate().getCharacter(info);
+ }
+
+ public CDOLobInfo putCharacter(Reader contents) throws IOException
+ {
+ return getDelegate().putCharacter(contents);
+ }
+
+ protected abstract CDOLobStore getDelegate();
+ }
+}
diff --git a/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/common/lob/CDOLobUtil.java b/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/common/lob/CDOLobUtil.java
index b164424bd6..132c763fc8 100644
--- a/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/common/lob/CDOLobUtil.java
+++ b/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/common/lob/CDOLobUtil.java
@@ -1,59 +1,59 @@
-/*
- * Copyright (c) 2004 - 2011 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.lob;
-
-import org.eclipse.net4j.util.io.ExtendedDataInput;
-import org.eclipse.net4j.util.io.ExtendedDataOutput;
-
-import java.io.IOException;
-
-/**
- * Some useful helpers for dealing with {@link CDOLob large objects}.
- *
- * @author Eike Stepper
- * @since 4.0
- */
-public final class CDOLobUtil
-{
- private CDOLobUtil()
- {
- }
-
- public static CDOBlob readBlob(ExtendedDataInput in) throws IOException
- {
- return new CDOBlob(in);
- }
-
- public static CDOClob readClob(ExtendedDataInput in) throws IOException
- {
- return new CDOClob(in);
- }
-
- public static void write(ExtendedDataOutput out, CDOLob<?> lob) throws IOException
- {
- lob.write(out);
- }
-
- public static CDOBlob createBlob(byte[] id, long size)
- {
- return new CDOBlob(id, size);
- }
-
- public static CDOClob createClob(byte[] id, long size)
- {
- return new CDOClob(id, size);
- }
-
- public static void setStore(CDOLobStore store, CDOLob<?> lob) throws IOException
- {
- lob.setStore(store);
- }
-}
+/*
+ * Copyright (c) 2004 - 2012 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.lob;
+
+import org.eclipse.net4j.util.io.ExtendedDataInput;
+import org.eclipse.net4j.util.io.ExtendedDataOutput;
+
+import java.io.IOException;
+
+/**
+ * Some useful helpers for dealing with {@link CDOLob large objects}.
+ *
+ * @author Eike Stepper
+ * @since 4.0
+ */
+public final class CDOLobUtil
+{
+ private CDOLobUtil()
+ {
+ }
+
+ public static CDOBlob readBlob(ExtendedDataInput in) throws IOException
+ {
+ return new CDOBlob(in);
+ }
+
+ public static CDOClob readClob(ExtendedDataInput in) throws IOException
+ {
+ return new CDOClob(in);
+ }
+
+ public static void write(ExtendedDataOutput out, CDOLob<?> lob) throws IOException
+ {
+ lob.write(out);
+ }
+
+ public static CDOBlob createBlob(byte[] id, long size)
+ {
+ return new CDOBlob(id, size);
+ }
+
+ public static CDOClob createClob(byte[] id, long size)
+ {
+ return new CDOClob(id, size);
+ }
+
+ public static void setStore(CDOLobStore store, CDOLob<?> lob) throws IOException
+ {
+ lob.setStore(store);
+ }
+}
diff --git a/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/common/lob/package-info.java b/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/common/lob/package-info.java
index c5ba461dad..6d80513cc1 100644
--- a/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/common/lob/package-info.java
+++ b/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/common/lob/package-info.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2004 - 2011 Eike Stepper (Berlin, Germany) and others.
+ * Copyright (c) 2004 - 2012 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
diff --git a/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/common/lock/CDOLockChangeInfo.java b/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/common/lock/CDOLockChangeInfo.java
index 7e73384b67..117f8bb176 100644
--- a/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/common/lock/CDOLockChangeInfo.java
+++ b/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/common/lock/CDOLockChangeInfo.java
@@ -1,79 +1,79 @@
-/*
- * Copyright (c) 2004 - 2011 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:
- * Caspar De Groot - initial API and implementation
- */
-package org.eclipse.emf.cdo.common.lock;
-
-import org.eclipse.emf.cdo.common.branch.CDOBranch;
-import org.eclipse.emf.cdo.common.branch.CDOBranchPoint;
-
-import org.eclipse.net4j.util.concurrent.IRWLockManager.LockType;
-
-/**
- * Represents a change in the lock state of a set of objects. Instances are meant to be sent from the server to the
- * client for the purpose of notifying the latter.
- *
- * @author Caspar De Groot
- * @since 4.1
- * @noextend This interface is not intended to be extended by clients.
- * @noimplement This interface is not intended to be implemented by clients.
- * @apiviz.has {@link CDOLockOwner}
- * @apiviz.has {@link CDOLockChangeInfo.Operation}
- * @apiviz.has {@link org.eclipse.net4j.util.concurrent.IRWLockManager.LockType}
- * @apiviz.composedOf {@link CDOLockState}
- */
-public interface CDOLockChangeInfo extends CDOBranchPoint
-{
- /**
- * @return <code>true</code> if this instance signals that all {@link CDOLockState lockstates} must be invalidated,
- * <code>false</code> otherwise
- */
- public boolean isInvalidateAll();
-
- /**
- * @return The branch at which the lock changes took place, same as <code>getView().getBranch()</code>.
- */
- public CDOBranch getBranch();
-
- /**
- * @return The repository time at which the lock changes took place. This is only an informal indication; no formal
- * relation (e.g. an ordering) with commit timestamps is guaranteed.
- */
- public long getTimeStamp();
-
- /**
- * @return The view, represented as a {@link CDOLockOwner}, that authored the lock changes.
- */
- public CDOLockOwner getLockOwner();
-
- /**
- * @return The new lock states of the objects that were affected by the change
- */
- public CDOLockState[] getLockStates();
-
- /**
- * @return the type of lock operation that caused the lock changes
- */
- public Operation getOperation();
-
- /**
- * @return the type of locks that were affected by the lock operation
- */
- public LockType getLockType();
-
- /**
- * Enumerates the possible locking operations.
- *
- * @author Caspar De Groot
- */
- public enum Operation
- {
- LOCK, UNLOCK
- }
-}
+/*
+ * Copyright (c) 2004 - 2012 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:
+ * Caspar De Groot - initial API and implementation
+ */
+package org.eclipse.emf.cdo.common.lock;
+
+import org.eclipse.emf.cdo.common.branch.CDOBranch;
+import org.eclipse.emf.cdo.common.branch.CDOBranchPoint;
+
+import org.eclipse.net4j.util.concurrent.IRWLockManager.LockType;
+
+/**
+ * Represents a change in the lock state of a set of objects. Instances are meant to be sent from the server to the
+ * client for the purpose of notifying the latter.
+ *
+ * @author Caspar De Groot
+ * @since 4.1
+ * @noextend This interface is not intended to be extended by clients.
+ * @noimplement This interface is not intended to be implemented by clients.
+ * @apiviz.has {@link CDOLockOwner}
+ * @apiviz.has {@link CDOLockChangeInfo.Operation}
+ * @apiviz.has {@link org.eclipse.net4j.util.concurrent.IRWLockManager.LockType}
+ * @apiviz.composedOf {@link CDOLockState}
+ */
+public interface CDOLockChangeInfo extends CDOBranchPoint
+{
+ /**
+ * @return <code>true</code> if this instance signals that all {@link CDOLockState lockstates} must be invalidated,
+ * <code>false</code> otherwise
+ */
+ public boolean isInvalidateAll();
+
+ /**
+ * @return The branch at which the lock changes took place, same as <code>getView().getBranch()</code>.
+ */
+ public CDOBranch getBranch();
+
+ /**
+ * @return The repository time at which the lock changes took place. This is only an informal indication; no formal
+ * relation (e.g. an ordering) with commit timestamps is guaranteed.
+ */
+ public long getTimeStamp();
+
+ /**
+ * @return The view, represented as a {@link CDOLockOwner}, that authored the lock changes.
+ */
+ public CDOLockOwner getLockOwner();
+
+ /**
+ * @return The new lock states of the objects that were affected by the change
+ */
+ public CDOLockState[] getLockStates();
+
+ /**
+ * @return the type of lock operation that caused the lock changes
+ */
+ public Operation getOperation();
+
+ /**
+ * @return the type of locks that were affected by the lock operation
+ */
+ public LockType getLockType();
+
+ /**
+ * Enumerates the possible locking operations.
+ *
+ * @author Caspar De Groot
+ */
+ public enum Operation
+ {
+ LOCK, UNLOCK
+ }
+}
diff --git a/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/common/lock/CDOLockChangeInfoHandler.java b/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/common/lock/CDOLockChangeInfoHandler.java
index e84ba6b29c..e2a0047760 100644
--- a/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/common/lock/CDOLockChangeInfoHandler.java
+++ b/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/common/lock/CDOLockChangeInfoHandler.java
@@ -1,23 +1,23 @@
-/*
- * Copyright (c) 2004 - 2011 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:
- * Caspar De Groot - initial API and implementation
- */
-package org.eclipse.emf.cdo.common.lock;
-
-/**
- * A call-back interface that indicates the ability to <i>handle</i> {@link CDOLockChangeInfo lock-change infos} that
- * are passed from other entities.
- *
- * @author Caspar De Groot
- * @since 4.1
- */
-public interface CDOLockChangeInfoHandler
-{
- public void handleLockChangeInfo(CDOLockChangeInfo lockChangeInfo);
-}
+/*
+ * Copyright (c) 2004 - 2012 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:
+ * Caspar De Groot - initial API and implementation
+ */
+package org.eclipse.emf.cdo.common.lock;
+
+/**
+ * A call-back interface that indicates the ability to <i>handle</i> {@link CDOLockChangeInfo lock-change infos} that
+ * are passed from other entities.
+ *
+ * @author Caspar De Groot
+ * @since 4.1
+ */
+public interface CDOLockChangeInfoHandler
+{
+ public void handleLockChangeInfo(CDOLockChangeInfo lockChangeInfo);
+}
diff --git a/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/common/lock/CDOLockOwner.java b/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/common/lock/CDOLockOwner.java
index e629a6dc95..fda27b77a8 100644
--- a/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/common/lock/CDOLockOwner.java
+++ b/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/common/lock/CDOLockOwner.java
@@ -1,37 +1,37 @@
-/*
- * Copyright (c) 2004 - 2011 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:
- * Caspar De Groot - initial API and implementation
- */
-package org.eclipse.emf.cdo.common.lock;
-
-/**
- * A client-side representation of a view owning locks.
- * <p>
- *
- * @author Caspar De Groot
- * @since 4.1
- * @noextend This interface is not intended to be extended by clients.
- * @noimplement This interface is not intended to be implemented by clients.
- */
-public interface CDOLockOwner
-{
- /**
- * @return the ID identifying the session that owns the view
- */
- public int getSessionID();
-
- /**
- * @return the ID identifying the view within the session
- */
- public int getViewID();
-
- public String getDurableLockingID();
-
- public boolean isDurableView();
-}
+/*
+ * Copyright (c) 2004 - 2012 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:
+ * Caspar De Groot - initial API and implementation
+ */
+package org.eclipse.emf.cdo.common.lock;
+
+/**
+ * A client-side representation of a view owning locks.
+ * <p>
+ *
+ * @author Caspar De Groot
+ * @since 4.1
+ * @noextend This interface is not intended to be extended by clients.
+ * @noimplement This interface is not intended to be implemented by clients.
+ */
+public interface CDOLockOwner
+{
+ /**
+ * @return the ID identifying the session that owns the view
+ */
+ public int getSessionID();
+
+ /**
+ * @return the ID identifying the view within the session
+ */
+ public int getViewID();
+
+ public String getDurableLockingID();
+
+ public boolean isDurableView();
+}
diff --git a/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/common/lock/CDOLockState.java b/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/common/lock/CDOLockState.java
index 242c1d208e..78f423c7c4 100644
--- a/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/common/lock/CDOLockState.java
+++ b/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/common/lock/CDOLockState.java
@@ -1,61 +1,61 @@
-/*
- * Copyright (c) 2004 - 2011 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:
- * Caspar De Groot - initial API and implementation
- */
-package org.eclipse.emf.cdo.common.lock;
-
-import org.eclipse.emf.cdo.common.id.CDOID;
-import org.eclipse.emf.cdo.common.revision.CDOIDAndBranch;
-
-import org.eclipse.net4j.util.concurrent.IRWLockManager.LockType;
-
-import java.util.Set;
-
-/**
- * A client-side representation of <i>all</i> the locks on a single CDOObject.
- * <p>
- * As an individual lock is always owned by view, which in turn is owned by a session, the methods on this interface
- * return instances of {@link CDOLockOwner} which carry that information.
- * <p>
- *
- * @author Caspar De Groot
- * @since 4.1
- * @noextend This interface is not intended to be extended by clients.
- * @noimplement This interface is not intended to be implemented by clients.
- * @apiviz.landmark
- * @apiviz.has {@link java.lang.Object} oneway - - lockedObject
- * @apiviz.owns {@link CDOLockOwner} - - readLockOwners
- * @apiviz.has {@link CDOLockOwner} oneway - - writeLockOwner
- * @apiviz.has {@link CDOLockOwner} oneway - - writeOptionOwner
- */
-public interface CDOLockState
-{
- /**
- * Gets a unique identifier for the object that is locked; typically a {@link CDOID} or a {@link CDOIDAndBranch},
- * depending on whether branching support is enabled or not
- *
- * @return the identifier
- */
- public Object getLockedObject();
-
- /**
- * If the 'others' argument is <code>false</code>, this method returns <code>true</code> if this lock is currently
- * held by the <i>requesting</i> CDOView, <code>false</code> otherwise.
- * <p>
- * If the 'others' argument is <code>true</code>, this method returns <code>true</code> if this lock is currently held
- * by <i>another</i> view (i.e. any view different from the requesting one), <code>false</code> otherwise.
- */
- public boolean isLocked(LockType lockType, CDOLockOwner lockOwner, boolean others);
-
- public Set<CDOLockOwner> getReadLockOwners();
-
- public CDOLockOwner getWriteLockOwner();
-
- public CDOLockOwner getWriteOptionOwner();
-}
+/*
+ * Copyright (c) 2004 - 2012 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:
+ * Caspar De Groot - initial API and implementation
+ */
+package org.eclipse.emf.cdo.common.lock;
+
+import org.eclipse.emf.cdo.common.id.CDOID;
+import org.eclipse.emf.cdo.common.revision.CDOIDAndBranch;
+
+import org.eclipse.net4j.util.concurrent.IRWLockManager.LockType;
+
+import java.util.Set;
+
+/**
+ * A client-side representation of <i>all</i> the locks on a single CDOObject.
+ * <p>
+ * As an individual lock is always owned by view, which in turn is owned by a session, the methods on this interface
+ * return instances of {@link CDOLockOwner} which carry that information.
+ * <p>
+ *
+ * @author Caspar De Groot
+ * @since 4.1
+ * @noextend This interface is not intended to be extended by clients.
+ * @noimplement This interface is not intended to be implemented by clients.
+ * @apiviz.landmark
+ * @apiviz.has {@link java.lang.Object} oneway - - lockedObject
+ * @apiviz.owns {@link CDOLockOwner} - - readLockOwners
+ * @apiviz.has {@link CDOLockOwner} oneway - - writeLockOwner
+ * @apiviz.has {@link CDOLockOwner} oneway - - writeOptionOwner
+ */
+public interface CDOLockState
+{
+ /**
+ * Gets a unique identifier for the object that is locked; typically a {@link CDOID} or a {@link CDOIDAndBranch},
+ * depending on whether branching support is enabled or not
+ *
+ * @return the identifier
+ */
+ public Object getLockedObject();
+
+ /**
+ * If the 'others' argument is <code>false</code>, this method returns <code>true</code> if this lock is currently
+ * held by the <i>requesting</i> CDOView, <code>false</code> otherwise.
+ * <p>
+ * If the 'others' argument is <code>true</code>, this method returns <code>true</code> if this lock is currently held
+ * by <i>another</i> view (i.e. any view different from the requesting one), <code>false</code> otherwise.
+ */
+ public boolean isLocked(LockType lockType, CDOLockOwner lockOwner, boolean others);
+
+ public Set<CDOLockOwner> getReadLockOwners();
+
+ public CDOLockOwner getWriteLockOwner();
+
+ public CDOLockOwner getWriteOptionOwner();
+}
diff --git a/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/common/lock/CDOLockUtil.java b/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/common/lock/CDOLockUtil.java
index 2dbfde6b1f..03ef04127e 100644
--- a/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/common/lock/CDOLockUtil.java
+++ b/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/common/lock/CDOLockUtil.java
@@ -1,163 +1,163 @@
-/*
- * Copyright (c) 2004 - 2011 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:
- * Caspar De Groot - initial API and implementation
- */
-package org.eclipse.emf.cdo.common.lock;
-
-import org.eclipse.emf.cdo.common.CDOCommonSession;
-import org.eclipse.emf.cdo.common.CDOCommonView;
-import org.eclipse.emf.cdo.common.branch.CDOBranch;
-import org.eclipse.emf.cdo.common.branch.CDOBranchPoint;
-import org.eclipse.emf.cdo.common.id.CDOID;
-import org.eclipse.emf.cdo.common.lock.CDOLockChangeInfo.Operation;
-import org.eclipse.emf.cdo.common.lock.IDurableLockingManager.LockArea;
-import org.eclipse.emf.cdo.common.lock.IDurableLockingManager.LockGrade;
-import org.eclipse.emf.cdo.internal.common.lock.CDOLockAreaImpl;
-import org.eclipse.emf.cdo.internal.common.lock.CDOLockChangeInfoImpl;
-import org.eclipse.emf.cdo.internal.common.lock.CDOLockOwnerImpl;
-import org.eclipse.emf.cdo.internal.common.lock.CDOLockStateImpl;
-import org.eclipse.emf.cdo.spi.common.lock.InternalCDOLockState;
-
-import org.eclipse.net4j.util.CheckUtil;
-import org.eclipse.net4j.util.HexUtil;
-import org.eclipse.net4j.util.concurrent.IRWLockManager.LockType;
-import org.eclipse.net4j.util.concurrent.RWOLockManager.LockState;
-
-import java.util.Map;
-import java.util.Random;
-
-/**
- * Various static methods that may help with classes related to CDO locks.
- *
- * @author Caspar De Groot
- * @since 4.1
- */
-public final class CDOLockUtil
-{
- private static final int DURABLE_SESSION_ID = 0;
-
- private static final int DURABLE_VIEW_ID = 0;
-
- private CDOLockUtil()
- {
- }
-
- public static CDOLockState copyLockState(CDOLockState lockState)
- {
- CheckUtil.checkArg(lockState instanceof CDOLockStateImpl, "lockState instanceof CDOLockStateImpl");
- return ((CDOLockStateImpl)lockState).copy();
- }
-
- public static CDOLockState createLockState(Object target)
- {
- return new CDOLockStateImpl(target);
- }
-
- public static CDOLockState createLockState(LockState<Object, ? extends CDOCommonView> lockState)
- {
- CheckUtil.checkArg(lockState, "lockState");
- InternalCDOLockState cdoLockState = new CDOLockStateImpl(lockState.getLockedObject());
-
- for (CDOCommonView view : lockState.getReadLockOwners())
- {
- String durableLockingID = view.getDurableLockingID();
- int sessionID, viewID;
- CDOCommonSession session = view.getSession();
- boolean isDurableView = session == null;
- if (isDurableView)
- {
- sessionID = DURABLE_SESSION_ID;
- viewID = DURABLE_VIEW_ID;
- }
- else
- {
- sessionID = session.getSessionID();
- viewID = view.getViewID();
- }
-
- CDOLockOwner owner = new CDOLockOwnerImpl(sessionID, viewID, durableLockingID, isDurableView);
- cdoLockState.addReadLockOwner(owner);
- }
-
- CDOCommonView writeLockOwner = lockState.getWriteLockOwner();
- if (writeLockOwner != null)
- {
- CDOLockOwner owner = createLockOwner(writeLockOwner);
- cdoLockState.setWriteLockOwner(owner);
- }
-
- CDOCommonView writeOptionOwner = lockState.getWriteOptionOwner();
- if (writeOptionOwner != null)
- {
- CDOLockOwner owner = createLockOwner(writeOptionOwner);
- cdoLockState.setWriteOptionOwner(owner);
- }
-
- return cdoLockState;
- }
-
- public static CDOLockOwner createLockOwner(CDOCommonView view)
- {
- CDOCommonSession session = view.getSession();
- String durableLockingID = view.getDurableLockingID();
- if (session != null)
- {
- int sessionID = session.getSessionID();
- int viewID = view.getViewID();
- return new CDOLockOwnerImpl(sessionID, viewID, durableLockingID, false);
- }
-
- CheckUtil.checkNull(durableLockingID, "durableLockingID");
- return new CDOLockOwnerImpl(DURABLE_SESSION_ID, DURABLE_VIEW_ID, durableLockingID, true);
- }
-
- public static CDOLockChangeInfo createLockChangeInfo(long timestamp, CDOLockOwner lockOwner, CDOBranch branch,
- Operation op, LockType lockType, CDOLockState[] cdoLockStates)
- {
- return new CDOLockChangeInfoImpl(branch.getPoint(timestamp), lockOwner, cdoLockStates, op, lockType);
- }
-
- public static CDOLockChangeInfo createLockChangeInfo()
- {
- return new CDOLockChangeInfoImpl();
- }
-
- public static CDOLockChangeInfo createLockChangeInfo(long timestamp, CDOCommonView view, CDOBranch viewedBranch,
- Operation op, LockType lockType, CDOLockState[] cdoLockStates)
- {
- CDOLockOwner lockOwner = createLockOwner(view);
- return createLockChangeInfo(timestamp, lockOwner, viewedBranch, op, lockType, cdoLockStates);
- }
-
- public static LockArea createLockArea(String durableLockingID, String userID, CDOBranchPoint branchPoint,
- boolean readOnly, Map<CDOID, LockGrade> locks)
- {
- return new CDOLockAreaImpl(durableLockingID, userID, branchPoint, readOnly, locks);
- }
-
- public static LockArea createLockArea(String durableLockingID)
- {
- return new CDOLockAreaImpl(durableLockingID);
- }
-
- public static String createDurableLockingID()
- {
- return createDurableLockingID(LockArea.DEFAULT_DURABLE_LOCKING_ID_BYTES);
- }
-
- public static String createDurableLockingID(int bytes)
- {
- byte[] buffer = new byte[bytes];
-
- Random random = new Random(System.currentTimeMillis());
- random.nextBytes(buffer);
-
- return HexUtil.bytesToHex(buffer);
- }
-}
+/*
+ * Copyright (c) 2004 - 2012 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:
+ * Caspar De Groot - initial API and implementation
+ */
+package org.eclipse.emf.cdo.common.lock;
+
+import org.eclipse.emf.cdo.common.CDOCommonSession;
+import org.eclipse.emf.cdo.common.CDOCommonView;
+import org.eclipse.emf.cdo.common.branch.CDOBranch;
+import org.eclipse.emf.cdo.common.branch.CDOBranchPoint;
+import org.eclipse.emf.cdo.common.id.CDOID;
+import org.eclipse.emf.cdo.common.lock.CDOLockChangeInfo.Operation;
+import org.eclipse.emf.cdo.common.lock.IDurableLockingManager.LockArea;
+import org.eclipse.emf.cdo.common.lock.IDurableLockingManager.LockGrade;
+import org.eclipse.emf.cdo.internal.common.lock.CDOLockAreaImpl;
+import org.eclipse.emf.cdo.internal.common.lock.CDOLockChangeInfoImpl;
+import org.eclipse.emf.cdo.internal.common.lock.CDOLockOwnerImpl;
+import org.eclipse.emf.cdo.internal.common.lock.CDOLockStateImpl;
+import org.eclipse.emf.cdo.spi.common.lock.InternalCDOLockState;
+
+import org.eclipse.net4j.util.CheckUtil;
+import org.eclipse.net4j.util.HexUtil;
+import org.eclipse.net4j.util.concurrent.IRWLockManager.LockType;
+import org.eclipse.net4j.util.concurrent.RWOLockManager.LockState;
+
+import java.util.Map;
+import java.util.Random;
+
+/**
+ * Various static methods that may help with classes related to CDO locks.
+ *
+ * @author Caspar De Groot
+ * @since 4.1
+ */
+public final class CDOLockUtil
+{
+ private static final int DURABLE_SESSION_ID = 0;
+
+ private static final int DURABLE_VIEW_ID = 0;
+
+ private CDOLockUtil()
+ {
+ }
+
+ public static CDOLockState copyLockState(CDOLockState lockState)
+ {
+ CheckUtil.checkArg(lockState instanceof CDOLockStateImpl, "lockState instanceof CDOLockStateImpl");
+ return ((CDOLockStateImpl)lockState).copy();
+ }
+
+ public static CDOLockState createLockState(Object target)
+ {
+ return new CDOLockStateImpl(target);
+ }
+
+ public static CDOLockState createLockState(LockState<Object, ? extends CDOCommonView> lockState)
+ {
+ CheckUtil.checkArg(lockState, "lockState");
+ InternalCDOLockState cdoLockState = new CDOLockStateImpl(lockState.getLockedObject());
+
+ for (CDOCommonView view : lockState.getReadLockOwners())
+ {
+ String durableLockingID = view.getDurableLockingID();
+ int sessionID, viewID;
+ CDOCommonSession session = view.getSession();
+ boolean isDurableView = session == null;
+ if (isDurableView)
+ {
+ sessionID = DURABLE_SESSION_ID;
+ viewID = DURABLE_VIEW_ID;
+ }
+ else
+ {
+ sessionID = session.getSessionID();
+ viewID = view.getViewID();
+ }
+
+ CDOLockOwner owner = new CDOLockOwnerImpl(sessionID, viewID, durableLockingID, isDurableView);
+ cdoLockState.addReadLockOwner(owner);
+ }
+
+ CDOCommonView writeLockOwner = lockState.getWriteLockOwner();
+ if (writeLockOwner != null)
+ {
+ CDOLockOwner owner = createLockOwner(writeLockOwner);
+ cdoLockState.setWriteLockOwner(owner);
+ }
+
+ CDOCommonView writeOptionOwner = lockState.getWriteOptionOwner();
+ if (writeOptionOwner != null)
+ {
+ CDOLockOwner owner = createLockOwner(writeOptionOwner);
+ cdoLockState.setWriteOptionOwner(owner);
+ }
+
+ return cdoLockState;
+ }
+
+ public static CDOLockOwner createLockOwner(CDOCommonView view)
+ {
+ CDOCommonSession session = view.getSession();
+ String durableLockingID = view.getDurableLockingID();
+ if (session != null)
+ {
+ int sessionID = session.getSessionID();
+ int viewID = view.getViewID();
+ return new CDOLockOwnerImpl(sessionID, viewID, durableLockingID, false);
+ }
+
+ CheckUtil.checkNull(durableLockingID, "durableLockingID");
+ return new CDOLockOwnerImpl(DURABLE_SESSION_ID, DURABLE_VIEW_ID, durableLockingID, true);
+ }
+
+ public static CDOLockChangeInfo createLockChangeInfo(long timestamp, CDOLockOwner lockOwner, CDOBranch branch,
+ Operation op, LockType lockType, CDOLockState[] cdoLockStates)
+ {
+ return new CDOLockChangeInfoImpl(branch.getPoint(timestamp), lockOwner, cdoLockStates, op, lockType);
+ }
+
+ public static CDOLockChangeInfo createLockChangeInfo()
+ {
+ return new CDOLockChangeInfoImpl();
+ }
+
+ public static CDOLockChangeInfo createLockChangeInfo(long timestamp, CDOCommonView view, CDOBranch viewedBranch,
+ Operation op, LockType lockType, CDOLockState[] cdoLockStates)
+ {
+ CDOLockOwner lockOwner = createLockOwner(view);
+ return createLockChangeInfo(timestamp, lockOwner, viewedBranch, op, lockType, cdoLockStates);
+ }
+
+ public static LockArea createLockArea(String durableLockingID, String userID, CDOBranchPoint branchPoint,
+ boolean readOnly, Map<CDOID, LockGrade> locks)
+ {
+ return new CDOLockAreaImpl(durableLockingID, userID, branchPoint, readOnly, locks);
+ }
+
+ public static LockArea createLockArea(String durableLockingID)
+ {
+ return new CDOLockAreaImpl(durableLockingID);
+ }
+
+ public static String createDurableLockingID()
+ {
+ return createDurableLockingID(LockArea.DEFAULT_DURABLE_LOCKING_ID_BYTES);
+ }
+
+ public static String createDurableLockingID(int bytes)
+ {
+ byte[] buffer = new byte[bytes];
+
+ Random random = new Random(System.currentTimeMillis());
+ random.nextBytes(buffer);
+
+ return HexUtil.bytesToHex(buffer);
+ }
+}
diff --git a/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/common/lock/IDurableLockingManager.java b/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/common/lock/IDurableLockingManager.java
index d10fd22d94..7f3620a187 100644
--- a/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/common/lock/IDurableLockingManager.java
+++ b/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/common/lock/IDurableLockingManager.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2004 - 2011 Eike Stepper (Berlin, Germany) and others.
+ * Copyright (c) 2004 - 2012 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
diff --git a/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/common/lock/package-info.java b/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/common/lock/package-info.java
index b59e380108..daf76d03b3 100644
--- a/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/common/lock/package-info.java
+++ b/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/common/lock/package-info.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2004 - 2011 Eike Stepper (Berlin, Germany) and others.
+ * Copyright (c) 2004 - 2012 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
diff --git a/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/common/model/CDOClassInfo.java b/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/common/model/CDOClassInfo.java
index b43dd30a4d..7ec16a3dbe 100644
--- a/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/common/model/CDOClassInfo.java
+++ b/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/common/model/CDOClassInfo.java
@@ -1,42 +1,42 @@
-/*
- * Copyright (c) 2004 - 2011 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.common.notify.Adapter;
-import org.eclipse.emf.ecore.EClass;
-import org.eclipse.emf.ecore.EStructuralFeature;
-
-/**
- * An EMF {@link Adapter adapter} that encapsulates CDO specific information about an {@link EClass}.
- *
- * @author Eike Stepper
- * @since 2.0
- * @noextend This interface is not intended to be extended by clients.
- * @noimplement This interface is not intended to be implemented by clients.
- * @apiviz.landmark
- * @apiviz.has {@link org.eclipse.emf.ecore.EClass}
- */
-public interface CDOClassInfo extends Adapter
-{
- public EClass getEClass();
-
- public boolean isResourceNode();
-
- public boolean isResourceFolder();
-
- public boolean isResource();
-
- public EStructuralFeature[] getAllPersistentFeatures();
-
- public int getFeatureIndex(EStructuralFeature feature);
-
- public int getFeatureIndex(int featureID);
-}
+/*
+ * Copyright (c) 2004 - 2012 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.common.notify.Adapter;
+import org.eclipse.emf.ecore.EClass;
+import org.eclipse.emf.ecore.EStructuralFeature;
+
+/**
+ * An EMF {@link Adapter adapter} that encapsulates CDO specific information about an {@link EClass}.
+ *
+ * @author Eike Stepper
+ * @since 2.0
+ * @noextend This interface is not intended to be extended by clients.
+ * @noimplement This interface is not intended to be implemented by clients.
+ * @apiviz.landmark
+ * @apiviz.has {@link org.eclipse.emf.ecore.EClass}
+ */
+public interface CDOClassInfo extends Adapter
+{
+ public EClass getEClass();
+
+ public boolean isResourceNode();
+
+ public boolean isResourceFolder();
+
+ public boolean isResource();
+
+ public EStructuralFeature[] getAllPersistentFeatures();
+
+ public int getFeatureIndex(EStructuralFeature feature);
+
+ public int getFeatureIndex(int featureID);
+}
diff --git a/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/common/model/CDOClassifierRef.java b/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/common/model/CDOClassifierRef.java
index 2650fa1d0f..1a050de87f 100644
--- a/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/common/model/CDOClassifierRef.java
+++ b/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/common/model/CDOClassifierRef.java
@@ -1,159 +1,159 @@
-/*
- * Copyright (c) 2004 - 2011 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.protocol.CDODataInput;
-import org.eclipse.emf.cdo.common.protocol.CDODataOutput;
-import org.eclipse.emf.cdo.internal.common.messages.Messages;
-
-import org.eclipse.net4j.util.ObjectUtil;
-
-import org.eclipse.emf.ecore.EClassifier;
-import org.eclipse.emf.ecore.EPackage;
-
-import java.io.IOException;
-import java.text.MessageFormat;
-
-/**
- * References an {@link EClassifier}.
- *
- * @author Eike Stepper
- * @since 2.0
- */
-public final class CDOClassifierRef
-{
- public static final String URI_SEPARATOR = "#"; //$NON-NLS-1$
-
- private String packageURI;
-
- private String classifierName;
-
- public CDOClassifierRef()
- {
- }
-
- public CDOClassifierRef(EClassifier classifier)
- {
- this(classifier.getEPackage().getNsURI(), classifier.getName());
- }
-
- public CDOClassifierRef(String packageURI, String classifierName)
- {
- this.packageURI = packageURI.intern();
- this.classifierName = classifierName.intern();
- }
-
- /**
- * @since 4.0
- */
- public CDOClassifierRef(String uri)
- {
- if (uri == null)
- {
- throw new IllegalArgumentException(Messages.getString("CDOClassifierRef.1") + uri); //$NON-NLS-1$
- }
-
- int hash = uri.lastIndexOf(URI_SEPARATOR);
- if (hash == -1)
- {
- throw new IllegalArgumentException(Messages.getString("CDOClassifierRef.1") + uri); //$NON-NLS-1$
- }
-
- packageURI = uri.substring(0, hash);
- classifierName = uri.substring(hash + 1);
- }
-
- /**
- * @since 3.0
- */
- public CDOClassifierRef(CDODataInput in) throws IOException
- {
- this(in.readCDOPackageURI());
- }
-
- /**
- * @since 3.0
- */
- public void write(CDODataOutput out) throws IOException
- {
- out.writeCDOPackageURI(getURI());
- }
-
- /**
- * @since 4.0
- */
- public String getURI()
- {
- return packageURI + URI_SEPARATOR + classifierName;
- }
-
- public String getPackageURI()
- {
- return packageURI;
- }
-
- public String getClassifierName()
- {
- return classifierName;
- }
-
- public EClassifier resolve(EPackage.Registry packageRegistry)
- {
- EPackage ePackage = packageRegistry.getEPackage(packageURI);
- if (ePackage == null)
- {
- throw new IllegalStateException(MessageFormat.format(Messages.getString("CDOClassifierRef.0"), packageURI)); //$NON-NLS-1$
- }
-
- return ePackage.getEClassifier(classifierName);
- }
-
- @Override
- public boolean equals(Object obj)
- {
- if (obj == this)
- {
- return true;
- }
-
- if (obj != null && obj.getClass() == CDOClassifierRef.class)
- {
- CDOClassifierRef that = (CDOClassifierRef)obj;
- return ObjectUtil.equals(packageURI, that.packageURI) && ObjectUtil.equals(classifierName, that.classifierName);
- }
-
- return false;
- }
-
- @Override
- public int hashCode()
- {
- return packageURI.hashCode() ^ classifierName.hashCode();
- }
-
- @Override
- public String toString()
- {
- return MessageFormat.format("CDOClassifierRef({0}, {1})", packageURI, classifierName); //$NON-NLS-1$
- }
-
- /**
- * Provides {@link CDOClassifierRef classifier references}.
- *
- * @author Eike Stepper
- * @since 3.0
- * @apiviz.uses {@link CDOClassifierRef} - - provides
- */
- public interface Provider
- {
- public CDOClassifierRef getClassifierRef();
- }
-}
+/*
+ * Copyright (c) 2004 - 2012 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.protocol.CDODataInput;
+import org.eclipse.emf.cdo.common.protocol.CDODataOutput;
+import org.eclipse.emf.cdo.internal.common.messages.Messages;
+
+import org.eclipse.net4j.util.ObjectUtil;
+
+import org.eclipse.emf.ecore.EClassifier;
+import org.eclipse.emf.ecore.EPackage;
+
+import java.io.IOException;
+import java.text.MessageFormat;
+
+/**
+ * References an {@link EClassifier}.
+ *
+ * @author Eike Stepper
+ * @since 2.0
+ */
+public final class CDOClassifierRef
+{
+ public static final String URI_SEPARATOR = "#"; //$NON-NLS-1$
+
+ private String packageURI;
+
+ private String classifierName;
+
+ public CDOClassifierRef()
+ {
+ }
+
+ public CDOClassifierRef(EClassifier classifier)
+ {
+ this(classifier.getEPackage().getNsURI(), classifier.getName());
+ }
+
+ public CDOClassifierRef(String packageURI, String classifierName)
+ {
+ this.packageURI = packageURI.intern();
+ this.classifierName = classifierName.intern();
+ }
+
+ /**
+ * @since 4.0
+ */
+ public CDOClassifierRef(String uri)
+ {
+ if (uri == null)
+ {
+ throw new IllegalArgumentException(Messages.getString("CDOClassifierRef.1") + uri); //$NON-NLS-1$
+ }
+
+ int hash = uri.lastIndexOf(URI_SEPARATOR);
+ if (hash == -1)
+ {
+ throw new IllegalArgumentException(Messages.getString("CDOClassifierRef.1") + uri); //$NON-NLS-1$
+ }
+
+ packageURI = uri.substring(0, hash);
+ classifierName = uri.substring(hash + 1);
+ }
+
+ /**
+ * @since 3.0
+ */
+ public CDOClassifierRef(CDODataInput in) throws IOException
+ {
+ this(in.readCDOPackageURI());
+ }
+
+ /**
+ * @since 3.0
+ */
+ public void write(CDODataOutput out) throws IOException
+ {
+ out.writeCDOPackageURI(getURI());
+ }
+
+ /**
+ * @since 4.0
+ */
+ public String getURI()
+ {
+ return packageURI + URI_SEPARATOR + classifierName;
+ }
+
+ public String getPackageURI()
+ {
+ return packageURI;
+ }
+
+ public String getClassifierName()
+ {
+ return classifierName;
+ }
+
+ public EClassifier resolve(EPackage.Registry packageRegistry)
+ {
+ EPackage ePackage = packageRegistry.getEPackage(packageURI);
+ if (ePackage == null)
+ {
+ throw new IllegalStateException(MessageFormat.format(Messages.getString("CDOClassifierRef.0"), packageURI)); //$NON-NLS-1$
+ }
+
+ return ePackage.getEClassifier(classifierName);
+ }
+
+ @Override
+ public boolean equals(Object obj)
+ {
+ if (obj == this)
+ {
+ return true;
+ }
+
+ if (obj != null && obj.getClass() == CDOClassifierRef.class)
+ {
+ CDOClassifierRef that = (CDOClassifierRef)obj;
+ return ObjectUtil.equals(packageURI, that.packageURI) && ObjectUtil.equals(classifierName, that.classifierName);
+ }
+
+ return false;
+ }
+
+ @Override
+ public int hashCode()
+ {
+ return packageURI.hashCode() ^ classifierName.hashCode();
+ }
+
+ @Override
+ public String toString()
+ {
+ return MessageFormat.format("CDOClassifierRef({0}, {1})", packageURI, classifierName); //$NON-NLS-1$
+ }
+
+ /**
+ * Provides {@link CDOClassifierRef classifier references}.
+ *
+ * @author Eike Stepper
+ * @since 3.0
+ * @apiviz.uses {@link CDOClassifierRef} - - provides
+ */
+ public interface Provider
+ {
+ public CDOClassifierRef getClassifierRef();
+ }
+}
diff --git a/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/common/model/CDOModelConstants.java b/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/common/model/CDOModelConstants.java
index 09573fc0b0..c786f72657 100644
--- a/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/common/model/CDOModelConstants.java
+++ b/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/common/model/CDOModelConstants.java
@@ -1,69 +1,69 @@
-/*
- * Copyright (c) 2004 - 2011 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;
-
-/**
- * Symbolic model constants commonly used in CDO.
- *
- * @author Eike Stepper
- * @since 4.0
- * @noextend This interface is not intended to be extended by clients.
- * @noimplement This interface is not intended to be implemented by clients.
- */
-public interface CDOModelConstants
-{
- public static final String RESOURCE_NODE_NAME_ATTRIBUTE = "name"; //$NON-NLS-1$
-
- /**
- * @since 4.0
- */
- public static final String CORE_PACKAGE_URI = "http://www.eclipse.org/emf/2002/Ecore"; //$NON-NLS-1$
-
- /**
- * @since 4.0
- */
- public static final String ROOT_CLASS_NAME = "EObject"; //$NON-NLS-1$
-
- /**
- * @since 4.0
- */
- public static final String RESOURCE_PACKAGE_URI = "http://www.eclipse.org/emf/CDO/Eresource/4.0.0"; //$NON-NLS-1$
-
- /**
- * @since 4.0
- */
- public static final String RESOURCE_NODE_CLASS_NAME = "CDOResourceNode"; //$NON-NLS-1$
-
- /**
- * @since 4.0
- */
- public static final String RESOURCE_FOLDER_CLASS_NAME = "CDOResourceFolder"; //$NON-NLS-1$
-
- /**
- * @since 4.0
- */
- public static final String RESOURCE_CLASS_NAME = "CDOResource"; //$NON-NLS-1$
-
- /**
- * @since 4.0
- */
- public static final String TYPES_PACKAGE_URI = "http://www.eclipse.org/emf/CDO/Etypes/4.0.0"; //$NON-NLS-1$
-
- /**
- * @since 4.0
- */
- public static final String BLOB_CLASS_NAME = "Blob"; //$NON-NLS-1$
-
- /**
- * @since 4.0
- */
- public static final String CLOB_CLASS_NAME = "Clob"; //$NON-NLS-1$
-}
+/*
+ * Copyright (c) 2004 - 2012 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;
+
+/**
+ * Symbolic model constants commonly used in CDO.
+ *
+ * @author Eike Stepper
+ * @since 4.0
+ * @noextend This interface is not intended to be extended by clients.
+ * @noimplement This interface is not intended to be implemented by clients.
+ */
+public interface CDOModelConstants
+{
+ public static final String RESOURCE_NODE_NAME_ATTRIBUTE = "name"; //$NON-NLS-1$
+
+ /**
+ * @since 4.0
+ */
+ public static final String CORE_PACKAGE_URI = "http://www.eclipse.org/emf/2002/Ecore"; //$NON-NLS-1$
+
+ /**
+ * @since 4.0
+ */
+ public static final String ROOT_CLASS_NAME = "EObject"; //$NON-NLS-1$
+
+ /**
+ * @since 4.0
+ */
+ public static final String RESOURCE_PACKAGE_URI = "http://www.eclipse.org/emf/CDO/Eresource/4.0.0"; //$NON-NLS-1$
+
+ /**
+ * @since 4.0
+ */
+ public static final String RESOURCE_NODE_CLASS_NAME = "CDOResourceNode"; //$NON-NLS-1$
+
+ /**
+ * @since 4.0
+ */
+ public static final String RESOURCE_FOLDER_CLASS_NAME = "CDOResourceFolder"; //$NON-NLS-1$
+
+ /**
+ * @since 4.0
+ */
+ public static final String RESOURCE_CLASS_NAME = "CDOResource"; //$NON-NLS-1$
+
+ /**
+ * @since 4.0
+ */
+ public static final String TYPES_PACKAGE_URI = "http://www.eclipse.org/emf/CDO/Etypes/4.0.0"; //$NON-NLS-1$
+
+ /**
+ * @since 4.0
+ */
+ public static final String BLOB_CLASS_NAME = "Blob"; //$NON-NLS-1$
+
+ /**
+ * @since 4.0
+ */
+ public static final String CLOB_CLASS_NAME = "Clob"; //$NON-NLS-1$
+}
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 fc6098ca79..7afd0bc65b 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
@@ -1,639 +1,639 @@
-/*
- * Copyright (c) 2004 - 2011 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 - Bug 332912 - Caching subtype-relationships in the CDOPackageRegistry
- * Erdal Karaca - added support for HASHMAP CDO Type
- */
-package org.eclipse.emf.cdo.common.model;
-
-import org.eclipse.emf.cdo.common.id.CDOID;
-import org.eclipse.emf.cdo.common.revision.CDORevision;
-import org.eclipse.emf.cdo.internal.common.bundle.OM;
-import org.eclipse.emf.cdo.internal.common.messages.Messages;
-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.common.util.Enumerator;
-import org.eclipse.emf.common.util.TreeIterator;
-import org.eclipse.emf.ecore.EClass;
-import org.eclipse.emf.ecore.EClassifier;
-import org.eclipse.emf.ecore.EDataType;
-import org.eclipse.emf.ecore.EEnum;
-import org.eclipse.emf.ecore.EEnumLiteral;
-import org.eclipse.emf.ecore.EGenericType;
-import org.eclipse.emf.ecore.EObject;
-import org.eclipse.emf.ecore.EPackage;
-import org.eclipse.emf.ecore.EStructuralFeature;
-import org.eclipse.emf.ecore.EcorePackage;
-import org.eclipse.emf.ecore.InternalEObject;
-import org.eclipse.emf.ecore.resource.ResourceSet;
-import org.eclipse.emf.ecore.util.EcoreUtil;
-import org.eclipse.emf.ecore.util.FeatureMap;
-import org.eclipse.emf.ecore.util.FeatureMapUtil;
-
-import java.io.IOException;
-import java.math.BigDecimal;
-import java.math.BigInteger;
-import java.text.MessageFormat;
-import java.util.ArrayList;
-import java.util.Date;
-import java.util.HashMap;
-import java.util.List;
-import java.util.Map;
-
-/**
- * Various static helper methods for dealing with CDO meta models.
- *
- * @author Eike Stepper
- * @since 2.0
- * @apiviz.uses {@link CDOType} - - provides
- */
-public final class CDOModelUtil implements CDOModelConstants
-{
- private static CDOType[] coreTypes;
-
- static
- {
- List<CDOType> types = new ArrayList<CDOType>();
- registerCoreType(types, EcorePackage.eINSTANCE.getEBigDecimal(), CDOType.BIG_DECIMAL);
- registerCoreType(types, EcorePackage.eINSTANCE.getEBigInteger(), CDOType.BIG_INTEGER);
- 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);
- 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()
- {
- }
-
- /**
- * @since 2.0
- */
- public static boolean isCorePackage(EPackage ePackage)
- {
- return CDOModelConstants.CORE_PACKAGE_URI.equals(ePackage.getNsURI());
- }
-
- /**
- * @since 2.0
- */
- public static boolean isRoot(EClass eClass)
- {
- return isCorePackage(eClass.getEPackage()) && CDOModelConstants.ROOT_CLASS_NAME.equals(eClass.getName());
- }
-
- /**
- * @since 2.0
- */
- public static boolean isResourcePackage(EPackage ePackage)
- {
- return CDOModelConstants.RESOURCE_PACKAGE_URI.equals(ePackage.getNsURI());
- }
-
- /**
- * @since 2.0
- */
- public static boolean isResource(EClass eClass)
- {
- return isResourcePackage(eClass.getEPackage()) && CDOModelConstants.RESOURCE_CLASS_NAME.equals(eClass.getName());
- }
-
- /**
- * @since 2.0
- */
- public static boolean isResourceFolder(EClass eClass)
- {
- return isResourcePackage(eClass.getEPackage())
- && CDOModelConstants.RESOURCE_FOLDER_CLASS_NAME.equals(eClass.getName());
- }
-
- /**
- * @since 2.0
- */
- public static boolean isResourceNode(EClass eClass)
- {
- return isResourcePackage(eClass.getEPackage())
- && (CDOModelConstants.RESOURCE_NODE_CLASS_NAME.equals(eClass.getName())
- || CDOModelConstants.RESOURCE_CLASS_NAME.equals(eClass.getName()) || CDOModelConstants.RESOURCE_FOLDER_CLASS_NAME
- .equals(eClass.getName()));
- }
-
- /**
- * @since 4.0
- */
- public static boolean isTypesPackage(EPackage ePackage)
- {
- return CDOModelConstants.TYPES_PACKAGE_URI.equals(ePackage.getNsURI());
- }
-
- /**
- * @since 2.0
- */
- public static boolean isSystemPackage(EPackage ePackage)
- {
- return isCorePackage(ePackage) || isResourcePackage(ePackage) || isTypesPackage(ePackage);
- }
-
- /**
- * @since 4.0
- */
- public static boolean isLob(EClassifier eClassifier)
- {
- return isTypesPackage(eClassifier.getEPackage())
- && (CDOModelConstants.BLOB_CLASS_NAME.equals(eClassifier.getName()) || CDOModelConstants.CLOB_CLASS_NAME
- .equals(eClassifier.getName()));
- }
-
- /**
- * @since 2.0
- */
- public static CDOType getType(EStructuralFeature feature)
- {
- if (FeatureMapUtil.isFeatureMap(feature))
- {
- return CDOType.FEATURE_MAP_ENTRY;
- }
-
- return CDOModelUtil.getType(feature.getEType());
- }
-
- /**
- * @since 4.0
- */
- public static CDOType getType(byte typeID)
- {
- return CDOTypeImpl.getType(typeID);
- }
-
- /**
- * @since 2.0
- */
- public static CDOType getType(EClassifier classifier)
- {
- if (classifier instanceof EClass)
- {
- return CDOType.OBJECT;
- }
-
- if (classifier instanceof EEnum)
- {
- return CDOType.ENUM_ORDINAL;
- }
-
- EDataType eDataType = (EDataType)classifier;
- EPackage ePackage = eDataType.getEPackage();
-
- if (isCorePackage(ePackage))
- {
- CDOType type = getCoreType(eDataType);
- if (type != null)
- {
- return type;
- }
- }
- else if (isTypesPackage(ePackage))
- {
- String name = eDataType.getName();
- if (CDOModelConstants.BLOB_CLASS_NAME.equals(name))
- {
- return CDOType.BLOB;
- }
-
- if (CDOModelConstants.CLOB_CLASS_NAME.equals(name))
- {
- return CDOType.CLOB;
- }
-
- throw new IllegalArgumentException("Illegal data type: " + eDataType);
- }
-
- return CDOType.CUSTOM;
- }
-
- /**
- * Core types includes also complex data like EAnnotation, and EEnum
- *
- * @since 2.0
- */
- public static CDOType getCoreType(EClassifier eDataType)
- {
- int index = eDataType.getClassifierID();
- if (0 <= index && index < coreTypes.length)
- {
- return coreTypes[index];
- }
-
- return null;
- }
-
- /**
- * @since 2.0
- */
- public static CDOType getPrimitiveType(Class<? extends Object> primitiveType)
- {
- 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;
- }
-
- if (primitiveType == Object[].class)
- {
- return CDOType.OBJECT_ARRAY;
- }
-
- if (EEnumLiteral.class.isAssignableFrom(primitiveType) || Enumerator.class.isAssignableFrom(primitiveType))
- {
- return CDOType.ENUM_LITERAL;
- }
-
- if (Map.class.isAssignableFrom(primitiveType))
- {
- return CDOType.MAP;
- }
-
- throw new IllegalArgumentException(MessageFormat.format(Messages.getString("CDOModelUtil.7"), primitiveType)); //$NON-NLS-1$
- }
-
- /**
- * @since 4.0
- */
- public static CDOType getTypeOfObject(Object object)
- {
- if (object instanceof BigDecimal)
- {
- return CDOType.BIG_DECIMAL;
- }
-
- if (object instanceof BigInteger)
- {
- return CDOType.BIG_INTEGER;
- }
-
- if (object instanceof Boolean)
- {
- return CDOType.BOOLEAN_OBJECT;
- }
-
- if (object instanceof Byte)
- {
- return CDOType.BYTE_OBJECT;
- }
-
- if (object instanceof byte[])
- {
- return CDOType.BYTE_ARRAY;
- }
-
- if (object instanceof Character)
- {
- return CDOType.CHARACTER_OBJECT;
- }
-
- if (object instanceof Date)
- {
- return CDOType.DATE;
- }
-
- if (object instanceof Double)
- {
- return CDOType.DOUBLE_OBJECT;
- }
-
- if (object instanceof EEnumLiteral)
- {
- return CDOType.ENUM_LITERAL;
- }
-
- if (object instanceof FeatureMap.Entry)
- {
- return CDOType.FEATURE_MAP_ENTRY;
- }
-
- if (object instanceof Float)
- {
- return CDOType.FLOAT_OBJECT;
- }
-
- if (object instanceof Integer)
- {
- return CDOType.INTEGER_OBJECT;
- }
-
- if (object instanceof Long)
- {
- return CDOType.LONG_OBJECT;
- }
-
- if (object instanceof Short)
- {
- return CDOType.SHORT_OBJECT;
- }
-
- if (object instanceof String)
- {
- return CDOType.STRING;
- }
-
- if (object instanceof CDOID || object instanceof CDORevision)
- {
- return CDOType.OBJECT;
- }
-
- if (object == null)
- {
- return CDOType.OBJECT;
- }
-
- throw new IllegalArgumentException("Object type " + object.getClass().getName() + " is not supported.");
- }
-
- /**
- * @since 2.0
- */
- public static CDOPackageInfo getPackageInfo(Object value, CDOPackageRegistry packageRegistry)
- {
- 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 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;
- }
- }
-
- /**
- * @since 2.0
- */
- public static EStructuralFeature[] getAllPersistentFeatures(EClass eClass)
- {
- CDOClassInfo classInfo = getClassInfo(eClass);
- return classInfo.getAllPersistentFeatures();
- }
-
- /**
- * @since 2.0
- */
- public static CDOPackageUnit createPackageUnit()
- {
- return new CDOPackageUnitImpl();
- }
-
- /**
- * @since 2.0
- */
- public static CDOPackageInfo createPackageInfo()
- {
- return new CDOPackageInfoImpl();
- }
-
- /**
- * @since 3.0
- */
- public static EPackage readPackage(ExtendedDataInput in, ResourceSet resourceSet, boolean lookForResource)
- throws IOException
- {
- String uri = in.readString();
- boolean zipped = in.readBoolean();
- byte[] bytes = in.readByteArray();
- return EMFUtil.createEPackage(uri, bytes, zipped, resourceSet, lookForResource);
- }
-
- /**
- * @since 2.0
- */
- public static void writePackage(ExtendedDataOutput out, EPackage ePackage, boolean zipped,
- EPackage.Registry packageRegistry) throws IOException
- {
- checkCrossResourceURIs(ePackage);
-
- byte[] bytes = EMFUtil.getEPackageBytes(ePackage, zipped, packageRegistry);
- out.writeString(ePackage.getNsURI());
- out.writeBoolean(zipped);
- out.writeByteArray(bytes);
- }
-
- /**
- * @since 3.0
- */
- public static void checkCrossResourceURIs(EPackage ePackage)
- {
- TreeIterator<EObject> it = ePackage.eAllContents();
- while (it.hasNext())
- {
- EObject e = it.next();
- for (EObject r : e.eCrossReferences())
- {
- EObject refTarget = null;
-
- if (r.eIsProxy())
- {
- String msg = "Package '%s' contains unresolved proxy '%s'";
- msg = String.format(msg, ePackage.getNsURI(), ((InternalEObject)r).eProxyURI());
- throw new IllegalStateException(msg);
- }
-
- if (r.eResource() != null && r.eResource() != e.eResource())
- {
- // It's a ref into another resource
- EPackage pkg = null;
- if (r instanceof EClassifier)
- {
- refTarget = r;
- pkg = ((EClassifier)r).getEPackage();
- }
- else if (r instanceof EStructuralFeature)
- {
- refTarget = r;
- EStructuralFeature feature = (EStructuralFeature)r;
- EClass ownerClass = (EClass)feature.eContainer();
- pkg = ownerClass.getEPackage();
- }
- else if (r instanceof EGenericType)
- {
- EGenericType genType = (EGenericType)r;
- EClassifier c = genType.getEClassifier();
- if (c != null)
- {
- refTarget = c;
- pkg = c.getEPackage();
- }
- }
-
- if (pkg == null)
- {
- continue;
- }
-
- while (pkg.getESuperPackage() != null)
- {
- pkg = pkg.getESuperPackage();
- }
-
- String resourceURI = refTarget.eResource().getURI().toString();
- if (!resourceURI.toString().equals(pkg.getNsURI()))
- {
- String msg = "URI of the resource (%s) does not match the nsURI (%s) of the top-level package;\n"
- + "this can be fixed by calling Resource.setURI(URI) after loading the packages,\n"
- + "or by configuring a URI mapping from nsURI's to location URI's before loading the packages,\n"
- + "and then loading them with their nsURI's";
- msg = String.format(msg, resourceURI, pkg.getNsURI());
- throw new IllegalStateException(msg);
- }
- }
- }
- }
- }
-
- /**
- * @since 4.0
- */
- public static Map<EClass, List<EClass>> getSubTypes(EPackage.Registry packageRegistry)
- {
- Map<EClass, List<EClass>> result = new HashMap<EClass, List<EClass>>();
- for (String nsURI : packageRegistry.keySet())
- {
- EPackage ePackage = packageRegistry.getEPackage(nsURI);
- getSubTypes(ePackage, result);
- }
-
- return result;
- }
-
- private static void getSubTypes(EPackage ePackage, Map<EClass, List<EClass>> result)
- {
- for (EClassifier classifier : ePackage.getEClassifiers())
- {
- if (classifier instanceof EClass)
- {
- EClass eClass = (EClass)classifier;
- for (EClass eSuperType : eClass.getEAllSuperTypes())
- {
- if (eSuperType.eIsProxy())
- {
- OM.LOG.warn("getSubTypes encountered a proxy EClass which will be ignored: " + eSuperType);
- continue;
- }
-
- List<EClass> list = result.get(eSuperType);
- if (list == null)
- {
- list = new ArrayList<EClass>();
- result.put(eSuperType, list);
- }
-
- list.add(eClass);
- }
- }
- }
- }
-}
+/*
+ * Copyright (c) 2004 - 2012 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 - Bug 332912 - Caching subtype-relationships in the CDOPackageRegistry
+ * Erdal Karaca - added support for HASHMAP CDO Type
+ */
+package org.eclipse.emf.cdo.common.model;
+
+import org.eclipse.emf.cdo.common.id.CDOID;
+import org.eclipse.emf.cdo.common.revision.CDORevision;
+import org.eclipse.emf.cdo.internal.common.bundle.OM;
+import org.eclipse.emf.cdo.internal.common.messages.Messages;
+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.common.util.Enumerator;
+import org.eclipse.emf.common.util.TreeIterator;
+import org.eclipse.emf.ecore.EClass;
+import org.eclipse.emf.ecore.EClassifier;
+import org.eclipse.emf.ecore.EDataType;
+import org.eclipse.emf.ecore.EEnum;
+import org.eclipse.emf.ecore.EEnumLiteral;
+import org.eclipse.emf.ecore.EGenericType;
+import org.eclipse.emf.ecore.EObject;
+import org.eclipse.emf.ecore.EPackage;
+import org.eclipse.emf.ecore.EStructuralFeature;
+import org.eclipse.emf.ecore.EcorePackage;
+import org.eclipse.emf.ecore.InternalEObject;
+import org.eclipse.emf.ecore.resource.ResourceSet;
+import org.eclipse.emf.ecore.util.EcoreUtil;
+import org.eclipse.emf.ecore.util.FeatureMap;
+import org.eclipse.emf.ecore.util.FeatureMapUtil;
+
+import java.io.IOException;
+import java.math.BigDecimal;
+import java.math.BigInteger;
+import java.text.MessageFormat;
+import java.util.ArrayList;
+import java.util.Date;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+
+/**
+ * Various static helper methods for dealing with CDO meta models.
+ *
+ * @author Eike Stepper
+ * @since 2.0
+ * @apiviz.uses {@link CDOType} - - provides
+ */
+public final class CDOModelUtil implements CDOModelConstants
+{
+ private static CDOType[] coreTypes;
+
+ static
+ {
+ List<CDOType> types = new ArrayList<CDOType>();
+ registerCoreType(types, EcorePackage.eINSTANCE.getEBigDecimal(), CDOType.BIG_DECIMAL);
+ registerCoreType(types, EcorePackage.eINSTANCE.getEBigInteger(), CDOType.BIG_INTEGER);
+ 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);
+ 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()
+ {
+ }
+
+ /**
+ * @since 2.0
+ */
+ public static boolean isCorePackage(EPackage ePackage)
+ {
+ return CDOModelConstants.CORE_PACKAGE_URI.equals(ePackage.getNsURI());
+ }
+
+ /**
+ * @since 2.0
+ */
+ public static boolean isRoot(EClass eClass)
+ {
+ return isCorePackage(eClass.getEPackage()) && CDOModelConstants.ROOT_CLASS_NAME.equals(eClass.getName());
+ }
+
+ /**
+ * @since 2.0
+ */
+ public static boolean isResourcePackage(EPackage ePackage)
+ {
+ return CDOModelConstants.RESOURCE_PACKAGE_URI.equals(ePackage.getNsURI());
+ }
+
+ /**
+ * @since 2.0
+ */
+ public static boolean isResource(EClass eClass)
+ {
+ return isResourcePackage(eClass.getEPackage()) && CDOModelConstants.RESOURCE_CLASS_NAME.equals(eClass.getName());
+ }
+
+ /**
+ * @since 2.0
+ */
+ public static boolean isResourceFolder(EClass eClass)
+ {
+ return isResourcePackage(eClass.getEPackage())
+ && CDOModelConstants.RESOURCE_FOLDER_CLASS_NAME.equals(eClass.getName());
+ }
+
+ /**
+ * @since 2.0
+ */
+ public static boolean isResourceNode(EClass eClass)
+ {
+ return isResourcePackage(eClass.getEPackage())
+ && (CDOModelConstants.RESOURCE_NODE_CLASS_NAME.equals(eClass.getName())
+ || CDOModelConstants.RESOURCE_CLASS_NAME.equals(eClass.getName()) || CDOModelConstants.RESOURCE_FOLDER_CLASS_NAME
+ .equals(eClass.getName()));
+ }
+
+ /**
+ * @since 4.0
+ */
+ public static boolean isTypesPackage(EPackage ePackage)
+ {
+ return CDOModelConstants.TYPES_PACKAGE_URI.equals(ePackage.getNsURI());
+ }
+
+ /**
+ * @since 2.0
+ */
+ public static boolean isSystemPackage(EPackage ePackage)
+ {
+ return isCorePackage(ePackage) || isResourcePackage(ePackage) || isTypesPackage(ePackage);
+ }
+
+ /**
+ * @since 4.0
+ */
+ public static boolean isLob(EClassifier eClassifier)
+ {
+ return isTypesPackage(eClassifier.getEPackage())
+ && (CDOModelConstants.BLOB_CLASS_NAME.equals(eClassifier.getName()) || CDOModelConstants.CLOB_CLASS_NAME
+ .equals(eClassifier.getName()));
+ }
+
+ /**
+ * @since 2.0
+ */
+ public static CDOType getType(EStructuralFeature feature)
+ {
+ if (FeatureMapUtil.isFeatureMap(feature))
+ {
+ return CDOType.FEATURE_MAP_ENTRY;
+ }
+
+ return CDOModelUtil.getType(feature.getEType());
+ }
+
+ /**
+ * @since 4.0
+ */
+ public static CDOType getType(byte typeID)
+ {
+ return CDOTypeImpl.getType(typeID);
+ }
+
+ /**
+ * @since 2.0
+ */
+ public static CDOType getType(EClassifier classifier)
+ {
+ if (classifier instanceof EClass)
+ {
+ return CDOType.OBJECT;
+ }
+
+ if (classifier instanceof EEnum)
+ {
+ return CDOType.ENUM_ORDINAL;
+ }
+
+ EDataType eDataType = (EDataType)classifier;
+ EPackage ePackage = eDataType.getEPackage();
+
+ if (isCorePackage(ePackage))
+ {
+ CDOType type = getCoreType(eDataType);
+ if (type != null)
+ {
+ return type;
+ }
+ }
+ else if (isTypesPackage(ePackage))
+ {
+ String name = eDataType.getName();
+ if (CDOModelConstants.BLOB_CLASS_NAME.equals(name))
+ {
+ return CDOType.BLOB;
+ }
+
+ if (CDOModelConstants.CLOB_CLASS_NAME.equals(name))
+ {
+ return CDOType.CLOB;
+ }
+
+ throw new IllegalArgumentException("Illegal data type: " + eDataType);
+ }
+
+ return CDOType.CUSTOM;
+ }
+
+ /**
+ * Core types includes also complex data like EAnnotation, and EEnum
+ *
+ * @since 2.0
+ */
+ public static CDOType getCoreType(EClassifier eDataType)
+ {
+ int index = eDataType.getClassifierID();
+ if (0 <= index && index < coreTypes.length)
+ {
+ return coreTypes[index];
+ }
+
+ return null;
+ }
+
+ /**
+ * @since 2.0
+ */
+ public static CDOType getPrimitiveType(Class<? extends Object> primitiveType)
+ {
+ 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;
+ }
+
+ if (primitiveType == Object[].class)
+ {
+ return CDOType.OBJECT_ARRAY;
+ }
+
+ if (EEnumLiteral.class.isAssignableFrom(primitiveType) || Enumerator.class.isAssignableFrom(primitiveType))
+ {
+ return CDOType.ENUM_LITERAL;
+ }
+
+ if (Map.class.isAssignableFrom(primitiveType))
+ {
+ return CDOType.MAP;
+ }
+
+ throw new IllegalArgumentException(MessageFormat.format(Messages.getString("CDOModelUtil.7"), primitiveType)); //$NON-NLS-1$
+ }
+
+ /**
+ * @since 4.0
+ */
+ public static CDOType getTypeOfObject(Object object)
+ {
+ if (object instanceof BigDecimal)
+ {
+ return CDOType.BIG_DECIMAL;
+ }
+
+ if (object instanceof BigInteger)
+ {
+ return CDOType.BIG_INTEGER;
+ }
+
+ if (object instanceof Boolean)
+ {
+ return CDOType.BOOLEAN_OBJECT;
+ }
+
+ if (object instanceof Byte)
+ {
+ return CDOType.BYTE_OBJECT;
+ }
+
+ if (object instanceof byte[])
+ {
+ return CDOType.BYTE_ARRAY;
+ }
+
+ if (object instanceof Character)
+ {
+ return CDOType.CHARACTER_OBJECT;
+ }
+
+ if (object instanceof Date)
+ {
+ return CDOType.DATE;
+ }
+
+ if (object instanceof Double)
+ {
+ return CDOType.DOUBLE_OBJECT;
+ }
+
+ if (object instanceof EEnumLiteral)
+ {
+ return CDOType.ENUM_LITERAL;
+ }
+
+ if (object instanceof FeatureMap.Entry)
+ {
+ return CDOType.FEATURE_MAP_ENTRY;
+ }
+
+ if (object instanceof Float)
+ {
+ return CDOType.FLOAT_OBJECT;
+ }
+
+ if (object instanceof Integer)
+ {
+ return CDOType.INTEGER_OBJECT;
+ }
+
+ if (object instanceof Long)
+ {
+ return CDOType.LONG_OBJECT;
+ }
+
+ if (object instanceof Short)
+ {
+ return CDOType.SHORT_OBJECT;
+ }
+
+ if (object instanceof String)
+ {
+ return CDOType.STRING;
+ }
+
+ if (object instanceof CDOID || object instanceof CDORevision)
+ {
+ return CDOType.OBJECT;
+ }
+
+ if (object == null)
+ {
+ return CDOType.OBJECT;
+ }
+
+ throw new IllegalArgumentException("Object type " + object.getClass().getName() + " is not supported.");
+ }
+
+ /**
+ * @since 2.0
+ */
+ public static CDOPackageInfo getPackageInfo(Object value, CDOPackageRegistry packageRegistry)
+ {
+ 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 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;
+ }
+ }
+
+ /**
+ * @since 2.0
+ */
+ public static EStructuralFeature[] getAllPersistentFeatures(EClass eClass)
+ {
+ CDOClassInfo classInfo = getClassInfo(eClass);
+ return classInfo.getAllPersistentFeatures();
+ }
+
+ /**
+ * @since 2.0
+ */
+ public static CDOPackageUnit createPackageUnit()
+ {
+ return new CDOPackageUnitImpl();
+ }
+
+ /**
+ * @since 2.0
+ */
+ public static CDOPackageInfo createPackageInfo()
+ {
+ return new CDOPackageInfoImpl();
+ }
+
+ /**
+ * @since 3.0
+ */
+ public static EPackage readPackage(ExtendedDataInput in, ResourceSet resourceSet, boolean lookForResource)
+ throws IOException
+ {
+ String uri = in.readString();
+ boolean zipped = in.readBoolean();
+ byte[] bytes = in.readByteArray();
+ return EMFUtil.createEPackage(uri, bytes, zipped, resourceSet, lookForResource);
+ }
+
+ /**
+ * @since 2.0
+ */
+ public static void writePackage(ExtendedDataOutput out, EPackage ePackage, boolean zipped,
+ EPackage.Registry packageRegistry) throws IOException
+ {
+ checkCrossResourceURIs(ePackage);
+
+ byte[] bytes = EMFUtil.getEPackageBytes(ePackage, zipped, packageRegistry);
+ out.writeString(ePackage.getNsURI());
+ out.writeBoolean(zipped);
+ out.writeByteArray(bytes);
+ }
+
+ /**
+ * @since 3.0
+ */
+ public static void checkCrossResourceURIs(EPackage ePackage)
+ {
+ TreeIterator<EObject> it = ePackage.eAllContents();
+ while (it.hasNext())
+ {
+ EObject e = it.next();
+ for (EObject r : e.eCrossReferences())
+ {
+ EObject refTarget = null;
+
+ if (r.eIsProxy())
+ {
+ String msg = "Package '%s' contains unresolved proxy '%s'";
+ msg = String.format(msg, ePackage.getNsURI(), ((InternalEObject)r).eProxyURI());
+ throw new IllegalStateException(msg);
+ }
+
+ if (r.eResource() != null && r.eResource() != e.eResource())
+ {
+ // It's a ref into another resource
+ EPackage pkg = null;
+ if (r instanceof EClassifier)
+ {
+ refTarget = r;
+ pkg = ((EClassifier)r).getEPackage();
+ }
+ else if (r instanceof EStructuralFeature)
+ {
+ refTarget = r;
+ EStructuralFeature feature = (EStructuralFeature)r;
+ EClass ownerClass = (EClass)feature.eContainer();
+ pkg = ownerClass.getEPackage();
+ }
+ else if (r instanceof EGenericType)
+ {
+ EGenericType genType = (EGenericType)r;
+ EClassifier c = genType.getEClassifier();
+ if (c != null)
+ {
+ refTarget = c;
+ pkg = c.getEPackage();
+ }
+ }
+
+ if (pkg == null)
+ {
+ continue;
+ }
+
+ while (pkg.getESuperPackage() != null)
+ {
+ pkg = pkg.getESuperPackage();
+ }
+
+ String resourceURI = refTarget.eResource().getURI().toString();
+ if (!resourceURI.toString().equals(pkg.getNsURI()))
+ {
+ String msg = "URI of the resource (%s) does not match the nsURI (%s) of the top-level package;\n"
+ + "this can be fixed by calling Resource.setURI(URI) after loading the packages,\n"
+ + "or by configuring a URI mapping from nsURI's to location URI's before loading the packages,\n"
+ + "and then loading them with their nsURI's";
+ msg = String.format(msg, resourceURI, pkg.getNsURI());
+ throw new IllegalStateException(msg);
+ }
+ }
+ }
+ }
+ }
+
+ /**
+ * @since 4.0
+ */
+ public static Map<EClass, List<EClass>> getSubTypes(EPackage.Registry packageRegistry)
+ {
+ Map<EClass, List<EClass>> result = new HashMap<EClass, List<EClass>>();
+ for (String nsURI : packageRegistry.keySet())
+ {
+ EPackage ePackage = packageRegistry.getEPackage(nsURI);
+ getSubTypes(ePackage, result);
+ }
+
+ return result;
+ }
+
+ private static void getSubTypes(EPackage ePackage, Map<EClass, List<EClass>> result)
+ {
+ for (EClassifier classifier : ePackage.getEClassifiers())
+ {
+ if (classifier instanceof EClass)
+ {
+ EClass eClass = (EClass)classifier;
+ for (EClass eSuperType : eClass.getEAllSuperTypes())
+ {
+ if (eSuperType.eIsProxy())
+ {
+ OM.LOG.warn("getSubTypes encountered a proxy EClass which will be ignored: " + eSuperType);
+ continue;
+ }
+
+ List<EClass> list = result.get(eSuperType);
+ if (list == null)
+ {
+ list = new ArrayList<EClass>();
+ result.put(eSuperType, list);
+ }
+
+ list.add(eClass);
+ }
+ }
+ }
+ }
+}
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 b83fbff8b9..269d38f507 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
@@ -1,92 +1,92 @@
-/*
- * Copyright (c) 2004 - 2011 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.model.CDOPackageUnit.State;
-
-import org.eclipse.emf.common.notify.Adapter;
-import org.eclipse.emf.ecore.EPackage;
-import org.eclipse.emf.ecore.EPackage.Descriptor;
-
-/**
- * Describes a single {@link EPackage package } instance of the nested package tree strucure represented by the
- * containing {@link CDOPackageUnit package unit}.
- * <p>
- * While the containing package unit is in the {@link CDOPackageUnit.State#PROXY PROXY} state this package info acts as
- * a {@link Descriptor package descriptor} in the associated {@link CDOPackageRegistry package registry}. When that
- * package unit is loaded all contained package infos/descriptors are resolved and replaced by their actual packages. At
- * the same time the describing package info objects are attached as adapters to the resolved packages. This way the
- * descriptive information is available before and after loading the packages.
- *
- * @author Eike Stepper
- * @noextend This interface is not intended to be extended by clients.
- * @noimplement This interface is not intended to be implemented by clients.
- * @apiviz.landmark
- * @apiviz.has {@link org.eclipse.emf.ecore.EPackage}
- * @apiviz.composedOf {@link CDOClassInfo}
- */
-public interface CDOPackageInfo extends Adapter, EPackage.Descriptor, Comparable<CDOPackageInfo>
-{
- /**
- * Returns the package unit containing this package info.
- */
- public CDOPackageUnit getPackageUnit();
-
- /**
- * Returns the namespace URI of the package described by this package info.
- */
- public String getPackageURI();
-
- /**
- * Returns the namespace URI of the {@link EPackage#getESuperPackage() super package} of the package described by this
- * package info.
- */
- public String getParentURI();
-
- /**
- * Returns the {@link EPackage package} described by this package info.
- *
- * @param loadOnDemand
- * If <code>true</code> and the containing {@link CDOPackageUnit package unit} is not {@link State#LOADED
- * LOADED} the package unit is implicitely loaded. If <code>false</code> and this package unit is not
- * {@link State#LOADED LOADED} <code>null</code> is returned.
- */
- public EPackage getEPackage(boolean loadOnDemand);
-
- /**
- * Returnes <code>true</code> if the package described by this package info is the <i>Ecore</i> model,
- * <code>false</code> oterwise.
- */
- public boolean isCorePackage();
-
- /**
- * Returnes <code>true</code> if the package described by this package info is the <i>Eresource</i> model,
- * <code>false</code> oterwise.
- */
- public boolean isResourcePackage();
-
- /**
- * Returnes <code>true</code> if the package described by this package info is the <i>Etypes</i> model,
- * <code>false</code> oterwise.
- *
- * @since 4.0
- */
- public boolean isTypePackage();
-
- /**
- * Returns <code>true</code> is this package info describes one of the models <i>Ecore</i>, <i>Eresource</i> or
- * <i>Etypes</i>, <code>false</code> otherwise.
- * <p>
- * Note that the models <i>Ecore</i>, <i>Eresource</i> and <i>Etypes</i> are expected to present as generated
- * {@link CDOPackageUnit.Type#NATIVE NATIVE} models in all deployments.
- */
- public boolean isSystemPackage();
-}
+/*
+ * Copyright (c) 2004 - 2012 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.model.CDOPackageUnit.State;
+
+import org.eclipse.emf.common.notify.Adapter;
+import org.eclipse.emf.ecore.EPackage;
+import org.eclipse.emf.ecore.EPackage.Descriptor;
+
+/**
+ * Describes a single {@link EPackage package } instance of the nested package tree strucure represented by the
+ * containing {@link CDOPackageUnit package unit}.
+ * <p>
+ * While the containing package unit is in the {@link CDOPackageUnit.State#PROXY PROXY} state this package info acts as
+ * a {@link Descriptor package descriptor} in the associated {@link CDOPackageRegistry package registry}. When that
+ * package unit is loaded all contained package infos/descriptors are resolved and replaced by their actual packages. At
+ * the same time the describing package info objects are attached as adapters to the resolved packages. This way the
+ * descriptive information is available before and after loading the packages.
+ *
+ * @author Eike Stepper
+ * @noextend This interface is not intended to be extended by clients.
+ * @noimplement This interface is not intended to be implemented by clients.
+ * @apiviz.landmark
+ * @apiviz.has {@link org.eclipse.emf.ecore.EPackage}
+ * @apiviz.composedOf {@link CDOClassInfo}
+ */
+public interface CDOPackageInfo extends Adapter, EPackage.Descriptor, Comparable<CDOPackageInfo>
+{
+ /**
+ * Returns the package unit containing this package info.
+ */
+ public CDOPackageUnit getPackageUnit();
+
+ /**
+ * Returns the namespace URI of the package described by this package info.
+ */
+ public String getPackageURI();
+
+ /**
+ * Returns the namespace URI of the {@link EPackage#getESuperPackage() super package} of the package described by this
+ * package info.
+ */
+ public String getParentURI();
+
+ /**
+ * Returns the {@link EPackage package} described by this package info.
+ *
+ * @param loadOnDemand
+ * If <code>true</code> and the containing {@link CDOPackageUnit package unit} is not {@link State#LOADED
+ * LOADED} the package unit is implicitely loaded. If <code>false</code> and this package unit is not
+ * {@link State#LOADED LOADED} <code>null</code> is returned.
+ */
+ public EPackage getEPackage(boolean loadOnDemand);
+
+ /**
+ * Returnes <code>true</code> if the package described by this package info is the <i>Ecore</i> model,
+ * <code>false</code> oterwise.
+ */
+ public boolean isCorePackage();
+
+ /**
+ * Returnes <code>true</code> if the package described by this package info is the <i>Eresource</i> model,
+ * <code>false</code> oterwise.
+ */
+ public boolean isResourcePackage();
+
+ /**
+ * Returnes <code>true</code> if the package described by this package info is the <i>Etypes</i> model,
+ * <code>false</code> oterwise.
+ *
+ * @since 4.0
+ */
+ public boolean isTypePackage();
+
+ /**
+ * Returns <code>true</code> is this package info describes one of the models <i>Ecore</i>, <i>Eresource</i> or
+ * <i>Etypes</i>, <code>false</code> otherwise.
+ * <p>
+ * Note that the models <i>Ecore</i>, <i>Eresource</i> and <i>Etypes</i> are expected to present as generated
+ * {@link CDOPackageUnit.Type#NATIVE NATIVE} models in all deployments.
+ */
+ public boolean isSystemPackage();
+}
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
index f400bacfef..96f6bdac67 100644
--- 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
@@ -1,81 +1,81 @@
-/*
- * Copyright (c) 2004 - 2011 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 - Bug 332912 - Caching subtype-relationships in the CDOPackageRegistry
- */
-package org.eclipse.emf.cdo.common.model;
-
-import org.eclipse.emf.cdo.common.CDOCommonRepository;
-import org.eclipse.emf.cdo.common.CDOCommonSession;
-
-import org.eclipse.emf.common.util.Enumerator;
-import org.eclipse.emf.ecore.EClass;
-import org.eclipse.emf.ecore.EEnumLiteral;
-import org.eclipse.emf.ecore.EPackage;
-import org.eclipse.emf.ecore.EPackage.Registry;
-
-import java.util.List;
-import java.util.Map;
-
-/**
- * An EMF {@link Registry package registry} that is used by CDO {@link CDOCommonRepository repositories} and
- * {@link CDOCommonSession sessions}.
- *
- * @author Eike Stepper
- * @since 2.0
- * @noextend This interface is not intended to be extended by clients.
- * @noimplement This interface is not intended to be implemented by clients.
- * @apiviz.landmark
- * @apiviz.composedOf {@link CDOPackageUnit}
- */
-public interface CDOPackageRegistry extends EPackage.Registry
-{
- public boolean isReplacingDescriptors();
-
- /**
- * Registers an {@link EPackage} with this package registry.
- */
- public Object putEPackage(EPackage ePackage);
-
- /**
- * @since 3.0
- */
- public CDOPackageUnit getPackageUnit(String id);
-
- public CDOPackageUnit getPackageUnit(EPackage ePackage);
-
- /**
- * Returns all package units that are registered in this package registry.
- *
- * @since 3.0
- */
- public CDOPackageUnit[] getPackageUnits();
-
- /**
- * @since 3.0
- */
- public CDOPackageUnit[] getPackageUnits(long startTime, long endTime);
-
- public CDOPackageInfo getPackageInfo(EPackage ePackage);
-
- /**
- * Returns all package infos that are registered in this package registry.
- */
- public CDOPackageInfo[] getPackageInfos();
-
- /**
- * @since 4.0
- */
- public Map<EClass, List<EClass>> getSubTypes();
-
- /**
- * @since 4.0
- */
- public EEnumLiteral getEnumLiteralFor(Enumerator value);
-}
+/*
+ * Copyright (c) 2004 - 2012 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 - Bug 332912 - Caching subtype-relationships in the CDOPackageRegistry
+ */
+package org.eclipse.emf.cdo.common.model;
+
+import org.eclipse.emf.cdo.common.CDOCommonRepository;
+import org.eclipse.emf.cdo.common.CDOCommonSession;
+
+import org.eclipse.emf.common.util.Enumerator;
+import org.eclipse.emf.ecore.EClass;
+import org.eclipse.emf.ecore.EEnumLiteral;
+import org.eclipse.emf.ecore.EPackage;
+import org.eclipse.emf.ecore.EPackage.Registry;
+
+import java.util.List;
+import java.util.Map;
+
+/**
+ * An EMF {@link Registry package registry} that is used by CDO {@link CDOCommonRepository repositories} and
+ * {@link CDOCommonSession sessions}.
+ *
+ * @author Eike Stepper
+ * @since 2.0
+ * @noextend This interface is not intended to be extended by clients.
+ * @noimplement This interface is not intended to be implemented by clients.
+ * @apiviz.landmark
+ * @apiviz.composedOf {@link CDOPackageUnit}
+ */
+public interface CDOPackageRegistry extends EPackage.Registry
+{
+ public boolean isReplacingDescriptors();
+
+ /**
+ * Registers an {@link EPackage} with this package registry.
+ */
+ public Object putEPackage(EPackage ePackage);
+
+ /**
+ * @since 3.0
+ */
+ public CDOPackageUnit getPackageUnit(String id);
+
+ public CDOPackageUnit getPackageUnit(EPackage ePackage);
+
+ /**
+ * Returns all package units that are registered in this package registry.
+ *
+ * @since 3.0
+ */
+ public CDOPackageUnit[] getPackageUnits();
+
+ /**
+ * @since 3.0
+ */
+ public CDOPackageUnit[] getPackageUnits(long startTime, long endTime);
+
+ public CDOPackageInfo getPackageInfo(EPackage ePackage);
+
+ /**
+ * Returns all package infos that are registered in this package registry.
+ */
+ public CDOPackageInfo[] getPackageInfos();
+
+ /**
+ * @since 4.0
+ */
+ public Map<EClass, List<EClass>> getSubTypes();
+
+ /**
+ * @since 4.0
+ */
+ public EEnumLiteral getEnumLiteralFor(Enumerator value);
+}
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
index 138e887f1d..26e11b8b96 100644
--- 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
@@ -1,159 +1,159 @@
-/*
- * Copyright (c) 2004 - 2011 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.concurrent.Worker;
-
-import org.eclipse.emf.ecore.EFactory;
-import org.eclipse.emf.ecore.EPackage;
-
-import java.util.Map.Entry;
-
-/**
- * Populates a {@link #getTarget() target} package registry by asynchronously polling a {@link #getSource() source}
- * package registry for new {@link EPackage} registrations.
- *
- * @author Eike Stepper
- * @since 2.0
- * @apiviz.uses {@link CDOPackageRegistryPopulator.Descriptor} - - creates
- * @apiviz.uses {@link CDOPackageRegistry} - - populates
- * @apiviz.uses {@link org.eclipse.emf.ecore.EPackage.Registry} - - polls
- */
-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;
- }
-
- /**
- * A package {@link org.eclipse.emf.ecore.EPackage.Descriptor descriptor} that resolves {@link EPackage packages} from
- * a {@link #getSource() source } package registry.
- *
- * @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);
- }
- }
-}
+/*
+ * Copyright (c) 2004 - 2012 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.concurrent.Worker;
+
+import org.eclipse.emf.ecore.EFactory;
+import org.eclipse.emf.ecore.EPackage;
+
+import java.util.Map.Entry;
+
+/**
+ * Populates a {@link #getTarget() target} package registry by asynchronously polling a {@link #getSource() source}
+ * package registry for new {@link EPackage} registrations.
+ *
+ * @author Eike Stepper
+ * @since 2.0
+ * @apiviz.uses {@link CDOPackageRegistryPopulator.Descriptor} - - creates
+ * @apiviz.uses {@link CDOPackageRegistry} - - populates
+ * @apiviz.uses {@link org.eclipse.emf.ecore.EPackage.Registry} - - polls
+ */
+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;
+ }
+
+ /**
+ * A package {@link org.eclipse.emf.ecore.EPackage.Descriptor descriptor} that resolves {@link EPackage packages} from
+ * a {@link #getSource() source } package registry.
+ *
+ * @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
index 1e727b2960..cb3e0e5df8 100644
--- 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
@@ -1,227 +1,227 @@
-/*
- * Copyright (c) 2004 - 2011 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.model.CDOPackageUnit.Type;
-
-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;
-
-/**
- * A {@link #INSTANCE singleton} registry for the {@link Type package unit types} of EMF {@link EPackage packages}.
- *
- * @author Eike Stepper
- * @since 2.0
- * @apiviz.exclude
- */
-public final class CDOPackageTypeRegistry
-{
- public static final CDOPackageTypeRegistry INSTANCE = new CDOPackageTypeRegistry();
-
- private static final String ECORE_ID = "org.eclipse.emf.ecore"; //$NON-NLS-1$
-
- private static final String PPID = EcorePlugin.GENERATED_PACKAGE_PPID;
-
- private static final String MARKER_FILE = "META-INF/CDO.MF"; //$NON-NLS-1$
-
- 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);
- }
-
- 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"); //$NON-NLS-1$
- 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;
- }
-
- /**
- * A common marker interface for CDO (native) objects.
- *
- * @author Eike Stepper
- * @noextend This interface is not intended to be extended by clients.
- * @noimplement This interface is not intended to be implemented by clients.
- * @apiviz.exclude
- */
- public static interface CDOObjectMarker
- {
- }
-}
+/*
+ * Copyright (c) 2004 - 2012 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.model.CDOPackageUnit.Type;
+
+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;
+
+/**
+ * A {@link #INSTANCE singleton} registry for the {@link Type package unit types} of EMF {@link EPackage packages}.
+ *
+ * @author Eike Stepper
+ * @since 2.0
+ * @apiviz.exclude
+ */
+public final class CDOPackageTypeRegistry
+{
+ public static final CDOPackageTypeRegistry INSTANCE = new CDOPackageTypeRegistry();
+
+ private static final String ECORE_ID = "org.eclipse.emf.ecore"; //$NON-NLS-1$
+
+ private static final String PPID = EcorePlugin.GENERATED_PACKAGE_PPID;
+
+ private static final String MARKER_FILE = "META-INF/CDO.MF"; //$NON-NLS-1$
+
+ 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);
+ }
+
+ 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"); //$NON-NLS-1$
+ 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;
+ }
+
+ /**
+ * A common marker interface for CDO (native) objects.
+ *
+ * @author Eike Stepper
+ * @noextend This interface is not intended to be extended by clients.
+ * @noimplement This interface is not intended to be implemented by clients.
+ * @apiviz.exclude
+ */
+ public static interface CDOObjectMarker
+ {
+ }
+}
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
index 314de36d22..00e7ca7a8f 100644
--- 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
@@ -1,208 +1,208 @@
-/*
- * Copyright (c) 2004 - 2011 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.internal.common.messages.Messages;
-
-import org.eclipse.emf.ecore.EClass;
-import org.eclipse.emf.ecore.EPackage;
-import org.eclipse.emf.ecore.EPackage.Registry;
-
-/**
- * Represents a tree structure of nested {@link EPackage packages} that are registered with a {@link CDOPackageRegistry
- * package registry} and that can only be serialized as a whole.
- * <p>
- * A package unit is the granule of committing or lazy loading packages. It contains some overall information like
- * {@link Type type}, {@link State state}, {@link #getTimeStamp() commit time} and nested {@link CDOPackageInfo package
- * info} objects that describe all the nested packages.
- *
- * @author Eike Stepper
- * @since 2.0
- * @noextend This interface is not intended to be extended by clients.
- * @noimplement This interface is not intended to be implemented by clients.
- * @apiviz.landmark
- * @apiviz.has {@link CDOPackageUnit.Type}
- * @apiviz.has {@link CDOPackageUnit.State}
- * @apiviz.composedOf {@link CDOPackageInfo}
- */
-public interface CDOPackageUnit extends Comparable<CDOPackageUnit>
-{
- /**
- * Returns the package registry this package unit is managed by.
- */
- public CDOPackageRegistry getPackageRegistry();
-
- /**
- * Returns the ID of this package unit.
- * <p>
- * Same as {@link #getTopLevelPackageInfo()}. {@link CDOPackageInfo#getPackageURI()}.
- */
- public String getID();
-
- /**
- * Returns the current state of this package unit.
- */
- public State getState();
-
- /**
- * Returns the current type of this package unit.
- */
- public Type getType();
-
- /**
- * Returns the type of this package unit as it was at the time it was originally committed by a client.
- */
- public Type getOriginalType();
-
- /**
- * Returns the time this package unit was originally committed.
- */
- public long getTimeStamp();
-
- /**
- * Returns the {@link CDOPackageInfo package info} object that describes the top level {@link EPackage package} of the
- * nested package tree structure described by this package unit.
- */
- public CDOPackageInfo getTopLevelPackageInfo();
-
- /**
- * Returns the {@link CDOPackageInfo package info} object that describes the {@link EPackage package} with the given
- * namespace URI, or <code>null</code> if this package unit does not contain a package with this URI.
- */
- public CDOPackageInfo getPackageInfo(String packageURI);
-
- /**
- * Returns all {@link CDOPackageInfo package info} objects of the nested package tree structure described by this
- * package unit in depth-first traversal order.
- */
- public CDOPackageInfo[] getPackageInfos();
-
- /**
- * Returns all {@link EPackage packages} of the nested package tree structure described by this package unit in
- * depth-first traversal order.
- *
- * @param loadOnDemand
- * If <code>true</code> and this package unit is not {@link State#LOADED LOADED} the package unit is
- * implicitely loaded. If <code>false</code> and this package unit is not {@link State#LOADED LOADED} an
- * empty array is returned.
- */
- public EPackage[] getEPackages(boolean loadOnDemand);
-
- /**
- * Returns <code>true</code> is this package unit describes one of the models <i>Ecore</i>, <i>Eresource</i> or
- * <i>Etypes</i>, <code>false</code> otherwise.
- * <p>
- * Note that the models <i>Ecore</i>, <i>Eresource</i> and <i>Etypes</i> are expected to be present as generated
- * {@link Type#NATIVE NATIVE} models in all deployments.
- */
- public boolean isSystem();
-
- /**
- * Returns <code>true</code> is this package unit describes the model <i>Eresource</i> , <code>false</code> otherwise.
- * <p>
- * Note that the model <i>Eresource</i> is expected to bepresent as generated {@link Type#NATIVE NATIVE} models in all
- * deployments.
- *
- * @since 4.0
- */
- public boolean isResource();
-
- /**
- * Describes the possible states a {@link CDOPackageUnit package unit} may be in during its lifecycle.
- *
- * @author Eike Stepper
- */
- public enum State
- {
- /**
- * The state of a {@link CDOPackageUnit package unit} after one of its described {@link EPackage packages} is newly
- * attached to a transactional {@link CDOPackageRegistry package registry}, but before the associated transaction is
- * committed. A {@link #NEW} package unit can only transition to {@link #LOADED} or {@link #DISPOSED}.
- */
- NEW,
-
- /**
- * The state of a {@link CDOPackageUnit package unit} after the described {@link EPackage packages} are loaded or
- * wired from the {@link Registry#INSTANCE global package registry}. A {@link #LOADED} package unit can only
- * transition to {@link #DISPOSED}.
- */
- LOADED,
-
- /**
- * The state of a {@link CDOPackageUnit package unit} after the context of the associated {@link CDOPackageRegistry
- * package registry} has been initialized, that is the repository been started or the session been opened. A
- * {@link #PROXY} package unit can only transition to {@link #LOADED} or {@link #DISPOSED}.
- */
- PROXY,
-
- /**
- * The state of a {@link CDOPackageUnit package unit} after the associated {@link CDOPackageRegistry package
- * registry} has been deactivated, that is the repository been stopped or the session been closed. A
- * {@link #DISPOSED} package unit can not transition to any other state.
- */
- DISPOSED
- }
-
- /**
- * Describes the instances of {@link EClass classes} of a {@link CDOPackageUnit package unit}.
- *
- * @author Eike Stepper
- */
- public enum Type
- {
- /**
- * The type of models that are generated specifically for the usage with CDO. Instances of {@link EClass classes} of
- * these models can be directly cast to InternalCDOObject.
- */
- NATIVE,
-
- /**
- * The type of models that are <b>not</b> generated specifically for the usage with CDO. Instances of {@link EClass
- * classes} of these models can <b>not</b> be directly cast to InternalCDOObject.
- */
- LEGACY,
-
- /**
- * The type of models that are not generated <b>at all</b> but rather dynamically contructed at runtime. Instances
- * of {@link EClass classes} of these models <b>can</b> be directly cast to InternalCDOObject, i.e. they're
- * implicitely <i>native</i>.
- */
- DYNAMIC,
-
- /**
- * Used to indicate that the type of a model could not be determined. Refer to the
- * {@link CDOPackageTypeRegistry#INSTANCE package type registry} on how to deal with this scenario.
- */
- UNKNOWN;
-
- /**
- * Returns <code>true</code> if this type is either {@link #NATIVE} or {@link #LEGACY}, <code>false</code>
- * otherwise.
- */
- public boolean isGenerated()
- {
- checkNotUnknown();
- return this == NATIVE || this == LEGACY;
- }
-
- /**
- * @throws IllegalStateException
- * if this type is {@link #UNKNOWN}.
- */
- public void checkNotUnknown() throws IllegalStateException
- {
- if (this == UNKNOWN)
- {
- throw new IllegalStateException(Messages.getString("CDOPackageUnit.0")); //$NON-NLS-1$
- }
- }
- }
-}
+/*
+ * Copyright (c) 2004 - 2012 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.internal.common.messages.Messages;
+
+import org.eclipse.emf.ecore.EClass;
+import org.eclipse.emf.ecore.EPackage;
+import org.eclipse.emf.ecore.EPackage.Registry;
+
+/**
+ * Represents a tree structure of nested {@link EPackage packages} that are registered with a {@link CDOPackageRegistry
+ * package registry} and that can only be serialized as a whole.
+ * <p>
+ * A package unit is the granule of committing or lazy loading packages. It contains some overall information like
+ * {@link Type type}, {@link State state}, {@link #getTimeStamp() commit time} and nested {@link CDOPackageInfo package
+ * info} objects that describe all the nested packages.
+ *
+ * @author Eike Stepper
+ * @since 2.0
+ * @noextend This interface is not intended to be extended by clients.
+ * @noimplement This interface is not intended to be implemented by clients.
+ * @apiviz.landmark
+ * @apiviz.has {@link CDOPackageUnit.Type}
+ * @apiviz.has {@link CDOPackageUnit.State}
+ * @apiviz.composedOf {@link CDOPackageInfo}
+ */
+public interface CDOPackageUnit extends Comparable<CDOPackageUnit>
+{
+ /**
+ * Returns the package registry this package unit is managed by.
+ */
+ public CDOPackageRegistry getPackageRegistry();
+
+ /**
+ * Returns the ID of this package unit.
+ * <p>
+ * Same as {@link #getTopLevelPackageInfo()}. {@link CDOPackageInfo#getPackageURI()}.
+ */
+ public String getID();
+
+ /**
+ * Returns the current state of this package unit.
+ */
+ public State getState();
+
+ /**
+ * Returns the current type of this package unit.
+ */
+ public Type getType();
+
+ /**
+ * Returns the type of this package unit as it was at the time it was originally committed by a client.
+ */
+ public Type getOriginalType();
+
+ /**
+ * Returns the time this package unit was originally committed.
+ */
+ public long getTimeStamp();
+
+ /**
+ * Returns the {@link CDOPackageInfo package info} object that describes the top level {@link EPackage package} of the
+ * nested package tree structure described by this package unit.
+ */
+ public CDOPackageInfo getTopLevelPackageInfo();
+
+ /**
+ * Returns the {@link CDOPackageInfo package info} object that describes the {@link EPackage package} with the given
+ * namespace URI, or <code>null</code> if this package unit does not contain a package with this URI.
+ */
+ public CDOPackageInfo getPackageInfo(String packageURI);
+
+ /**
+ * Returns all {@link CDOPackageInfo package info} objects of the nested package tree structure described by this
+ * package unit in depth-first traversal order.
+ */
+ public CDOPackageInfo[] getPackageInfos();
+
+ /**
+ * Returns all {@link EPackage packages} of the nested package tree structure described by this package unit in
+ * depth-first traversal order.
+ *
+ * @param loadOnDemand
+ * If <code>true</code> and this package unit is not {@link State#LOADED LOADED} the package unit is
+ * implicitely loaded. If <code>false</code> and this package unit is not {@link State#LOADED LOADED} an
+ * empty array is returned.
+ */
+ public EPackage[] getEPackages(boolean loadOnDemand);
+
+ /**
+ * Returns <code>true</code> is this package unit describes one of the models <i>Ecore</i>, <i>Eresource</i> or
+ * <i>Etypes</i>, <code>false</code> otherwise.
+ * <p>
+ * Note that the models <i>Ecore</i>, <i>Eresource</i> and <i>Etypes</i> are expected to be present as generated
+ * {@link Type#NATIVE NATIVE} models in all deployments.
+ */
+ public boolean isSystem();
+
+ /**
+ * Returns <code>true</code> is this package unit describes the model <i>Eresource</i> , <code>false</code> otherwise.
+ * <p>
+ * Note that the model <i>Eresource</i> is expected to bepresent as generated {@link Type#NATIVE NATIVE} models in all
+ * deployments.
+ *
+ * @since 4.0
+ */
+ public boolean isResource();
+
+ /**
+ * Describes the possible states a {@link CDOPackageUnit package unit} may be in during its lifecycle.
+ *
+ * @author Eike Stepper
+ */
+ public enum State
+ {
+ /**
+ * The state of a {@link CDOPackageUnit package unit} after one of its described {@link EPackage packages} is newly
+ * attached to a transactional {@link CDOPackageRegistry package registry}, but before the associated transaction is
+ * committed. A {@link #NEW} package unit can only transition to {@link #LOADED} or {@link #DISPOSED}.
+ */
+ NEW,
+
+ /**
+ * The state of a {@link CDOPackageUnit package unit} after the described {@link EPackage packages} are loaded or
+ * wired from the {@link Registry#INSTANCE global package registry}. A {@link #LOADED} package unit can only
+ * transition to {@link #DISPOSED}.
+ */
+ LOADED,
+
+ /**
+ * The state of a {@link CDOPackageUnit package unit} after the context of the associated {@link CDOPackageRegistry
+ * package registry} has been initialized, that is the repository been started or the session been opened. A
+ * {@link #PROXY} package unit can only transition to {@link #LOADED} or {@link #DISPOSED}.
+ */
+ PROXY,
+
+ /**
+ * The state of a {@link CDOPackageUnit package unit} after the associated {@link CDOPackageRegistry package
+ * registry} has been deactivated, that is the repository been stopped or the session been closed. A
+ * {@link #DISPOSED} package unit can not transition to any other state.
+ */
+ DISPOSED
+ }
+
+ /**
+ * Describes the instances of {@link EClass classes} of a {@link CDOPackageUnit package unit}.
+ *
+ * @author Eike Stepper
+ */
+ public enum Type
+ {
+ /**
+ * The type of models that are generated specifically for the usage with CDO. Instances of {@link EClass classes} of
+ * these models can be directly cast to InternalCDOObject.
+ */
+ NATIVE,
+
+ /**
+ * The type of models that are <b>not</b> generated specifically for the usage with CDO. Instances of {@link EClass
+ * classes} of these models can <b>not</b> be directly cast to InternalCDOObject.
+ */
+ LEGACY,
+
+ /**
+ * The type of models that are not generated <b>at all</b> but rather dynamically contructed at runtime. Instances
+ * of {@link EClass classes} of these models <b>can</b> be directly cast to InternalCDOObject, i.e. they're
+ * implicitely <i>native</i>.
+ */
+ DYNAMIC,
+
+ /**
+ * Used to indicate that the type of a model could not be determined. Refer to the
+ * {@link CDOPackageTypeRegistry#INSTANCE package type registry} on how to deal with this scenario.
+ */
+ UNKNOWN;
+
+ /**
+ * Returns <code>true</code> if this type is either {@link #NATIVE} or {@link #LEGACY}, <code>false</code>
+ * otherwise.
+ */
+ public boolean isGenerated()
+ {
+ checkNotUnknown();
+ return this == NATIVE || this == LEGACY;
+ }
+
+ /**
+ * @throws IllegalStateException
+ * if this type is {@link #UNKNOWN}.
+ */
+ public void checkNotUnknown() throws IllegalStateException
+ {
+ if (this == UNKNOWN)
+ {
+ throw new IllegalStateException(Messages.getString("CDOPackageUnit.0")); //$NON-NLS-1$
+ }
+ }
+ }
+}
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 45fb183616..b49b80ae61 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
@@ -1,157 +1,157 @@
-/*
- * Copyright (c) 2004 - 2011 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
- * Erdal Karaca - added support for MAP Type
- */
-package org.eclipse.emf.cdo.common.model;
-
-import org.eclipse.emf.cdo.common.protocol.CDODataInput;
-import org.eclipse.emf.cdo.common.protocol.CDODataOutput;
-import org.eclipse.emf.cdo.spi.common.revision.CDOReferenceAdjuster;
-
-import org.eclipse.emf.ecore.EClassifier;
-import org.eclipse.emf.ecore.EStructuralFeature;
-
-import java.io.IOException;
-
-/**
- * Provides access to all CDO-supported data types.
- *
- * @author Eike Stepper
- * @noimplement This interface is not intended to be implemented by clients.
- * @since 2.0
- * @apiviz.landmark
- */
-public interface CDOType
-{
- public static final CDOType OBJECT = org.eclipse.emf.cdo.internal.common.model.CDOTypeImpl.OBJECT;
-
- public static final CDOType BOOLEAN = org.eclipse.emf.cdo.internal.common.model.CDOTypeImpl.BOOLEAN;
-
- public static final CDOType BOOLEAN_OBJECT = org.eclipse.emf.cdo.internal.common.model.CDOTypeImpl.BOOLEAN_OBJECT;
-
- public static final CDOType BYTE = org.eclipse.emf.cdo.internal.common.model.CDOTypeImpl.BYTE;
-
- public static final CDOType BYTE_OBJECT = org.eclipse.emf.cdo.internal.common.model.CDOTypeImpl.BYTE_OBJECT;
-
- public static final CDOType CHAR = org.eclipse.emf.cdo.internal.common.model.CDOTypeImpl.CHAR;
-
- public static final CDOType CHARACTER_OBJECT = org.eclipse.emf.cdo.internal.common.model.CDOTypeImpl.CHARACTER_OBJECT;
-
- public static final CDOType DATE = org.eclipse.emf.cdo.internal.common.model.CDOTypeImpl.DATE;
-
- public static final CDOType DOUBLE = org.eclipse.emf.cdo.internal.common.model.CDOTypeImpl.DOUBLE;
-
- public static final CDOType DOUBLE_OBJECT = org.eclipse.emf.cdo.internal.common.model.CDOTypeImpl.DOUBLE_OBJECT;
-
- public static final CDOType FLOAT = org.eclipse.emf.cdo.internal.common.model.CDOTypeImpl.FLOAT;
-
- public static final CDOType FLOAT_OBJECT = org.eclipse.emf.cdo.internal.common.model.CDOTypeImpl.FLOAT_OBJECT;
-
- public static final CDOType INT = org.eclipse.emf.cdo.internal.common.model.CDOTypeImpl.INT;
-
- public static final CDOType INTEGER_OBJECT = org.eclipse.emf.cdo.internal.common.model.CDOTypeImpl.INTEGER_OBJECT;
-
- public static final CDOType LONG = org.eclipse.emf.cdo.internal.common.model.CDOTypeImpl.LONG;
-
- public static final CDOType LONG_OBJECT = org.eclipse.emf.cdo.internal.common.model.CDOTypeImpl.LONG_OBJECT;
-
- public static final CDOType SHORT = org.eclipse.emf.cdo.internal.common.model.CDOTypeImpl.SHORT;
-
- public static final CDOType SHORT_OBJECT = org.eclipse.emf.cdo.internal.common.model.CDOTypeImpl.SHORT_OBJECT;
-
- public static final CDOType STRING = org.eclipse.emf.cdo.internal.common.model.CDOTypeImpl.STRING;
-
- public static final CDOType BYTE_ARRAY = org.eclipse.emf.cdo.internal.common.model.CDOTypeImpl.BYTE_ARRAY;
-
- /**
- * @since 3.0
- */
- public static final CDOType OBJECT_ARRAY = org.eclipse.emf.cdo.internal.common.model.CDOTypeImpl.OBJECT_ARRAY;
-
- /**
- * @since 4.0
- */
- public static final CDOType MAP = org.eclipse.emf.cdo.internal.common.model.CDOTypeImpl.MAP;
-
- /**
- * @since 2.0
- */
- public static final CDOType BIG_DECIMAL = org.eclipse.emf.cdo.internal.common.model.CDOTypeImpl.BIG_DECIMAL;
-
- /**
- * @since 2.0
- */
- public static final CDOType BIG_INTEGER = org.eclipse.emf.cdo.internal.common.model.CDOTypeImpl.BIG_INTEGER;
-
- /**
- * @since 3.0
- */
- public static final CDOType ENUM_ORDINAL = org.eclipse.emf.cdo.internal.common.model.CDOTypeImpl.ENUM_ORDINAL;
-
- /**
- * @since 3.0
- */
- public static final CDOType ENUM_LITERAL = org.eclipse.emf.cdo.internal.common.model.CDOTypeImpl.ENUM_LITERAL;
-
- /**
- * @since 4.0
- */
- public static final CDOType BLOB = org.eclipse.emf.cdo.internal.common.model.CDOTypeImpl.BLOB;
-
- /**
- * @since 4.0
- */
- public static final CDOType CLOB = org.eclipse.emf.cdo.internal.common.model.CDOTypeImpl.CLOB;
-
- 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 String getName();
-
- /**
- * @since 4.0
- */
- public byte getTypeID();
-
- public boolean canBeNull();
-
- public Object getDefaultValue();
-
- public Object copyValue(Object value);
-
- /**
- * @since 4.0
- */
- public Object adjustReferences(CDOReferenceAdjuster adjuster, Object value, EStructuralFeature feature, int index);
-
- /**
- * @since 3.0
- */
- public Object readValue(CDODataInput in) throws IOException;
-
- /**
- * @since 3.0
- */
- public void writeValue(CDODataOutput out, Object value) throws IOException;
-
- /**
- * @since 2.0
- */
- public Object convertToEMF(EClassifier feature, Object value);
-
- /**
- * @since 2.0
- */
- public Object convertToCDO(EClassifier feature, Object value);
-}
+/*
+ * Copyright (c) 2004 - 2012 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
+ * Erdal Karaca - added support for MAP Type
+ */
+package org.eclipse.emf.cdo.common.model;
+
+import org.eclipse.emf.cdo.common.protocol.CDODataInput;
+import org.eclipse.emf.cdo.common.protocol.CDODataOutput;
+import org.eclipse.emf.cdo.spi.common.revision.CDOReferenceAdjuster;
+
+import org.eclipse.emf.ecore.EClassifier;
+import org.eclipse.emf.ecore.EStructuralFeature;
+
+import java.io.IOException;
+
+/**
+ * Provides access to all CDO-supported data types.
+ *
+ * @author Eike Stepper
+ * @noimplement This interface is not intended to be implemented by clients.
+ * @since 2.0
+ * @apiviz.landmark
+ */
+public interface CDOType
+{
+ public static final CDOType OBJECT = org.eclipse.emf.cdo.internal.common.model.CDOTypeImpl.OBJECT;
+
+ public static final CDOType BOOLEAN = org.eclipse.emf.cdo.internal.common.model.CDOTypeImpl.BOOLEAN;
+
+ public static final CDOType BOOLEAN_OBJECT = org.eclipse.emf.cdo.internal.common.model.CDOTypeImpl.BOOLEAN_OBJECT;
+
+ public static final CDOType BYTE = org.eclipse.emf.cdo.internal.common.model.CDOTypeImpl.BYTE;
+
+ public static final CDOType BYTE_OBJECT = org.eclipse.emf.cdo.internal.common.model.CDOTypeImpl.BYTE_OBJECT;
+
+ public static final CDOType CHAR = org.eclipse.emf.cdo.internal.common.model.CDOTypeImpl.CHAR;
+
+ public static final CDOType CHARACTER_OBJECT = org.eclipse.emf.cdo.internal.common.model.CDOTypeImpl.CHARACTER_OBJECT;
+
+ public static final CDOType DATE = org.eclipse.emf.cdo.internal.common.model.CDOTypeImpl.DATE;
+
+ public static final CDOType DOUBLE = org.eclipse.emf.cdo.internal.common.model.CDOTypeImpl.DOUBLE;
+
+ public static final CDOType DOUBLE_OBJECT = org.eclipse.emf.cdo.internal.common.model.CDOTypeImpl.DOUBLE_OBJECT;
+
+ public static final CDOType FLOAT = org.eclipse.emf.cdo.internal.common.model.CDOTypeImpl.FLOAT;
+
+ public static final CDOType FLOAT_OBJECT = org.eclipse.emf.cdo.internal.common.model.CDOTypeImpl.FLOAT_OBJECT;
+
+ public static final CDOType INT = org.eclipse.emf.cdo.internal.common.model.CDOTypeImpl.INT;
+
+ public static final CDOType INTEGER_OBJECT = org.eclipse.emf.cdo.internal.common.model.CDOTypeImpl.INTEGER_OBJECT;
+
+ public static final CDOType LONG = org.eclipse.emf.cdo.internal.common.model.CDOTypeImpl.LONG;
+
+ public static final CDOType LONG_OBJECT = org.eclipse.emf.cdo.internal.common.model.CDOTypeImpl.LONG_OBJECT;
+
+ public static final CDOType SHORT = org.eclipse.emf.cdo.internal.common.model.CDOTypeImpl.SHORT;
+
+ public static final CDOType SHORT_OBJECT = org.eclipse.emf.cdo.internal.common.model.CDOTypeImpl.SHORT_OBJECT;
+
+ public static final CDOType STRING = org.eclipse.emf.cdo.internal.common.model.CDOTypeImpl.STRING;
+
+ public static final CDOType BYTE_ARRAY = org.eclipse.emf.cdo.internal.common.model.CDOTypeImpl.BYTE_ARRAY;
+
+ /**
+ * @since 3.0
+ */
+ public static final CDOType OBJECT_ARRAY = org.eclipse.emf.cdo.internal.common.model.CDOTypeImpl.OBJECT_ARRAY;
+
+ /**
+ * @since 4.0
+ */
+ public static final CDOType MAP = org.eclipse.emf.cdo.internal.common.model.CDOTypeImpl.MAP;
+
+ /**
+ * @since 2.0
+ */
+ public static final CDOType BIG_DECIMAL = org.eclipse.emf.cdo.internal.common.model.CDOTypeImpl.BIG_DECIMAL;
+
+ /**
+ * @since 2.0
+ */
+ public static final CDOType BIG_INTEGER = org.eclipse.emf.cdo.internal.common.model.CDOTypeImpl.BIG_INTEGER;
+
+ /**
+ * @since 3.0
+ */
+ public static final CDOType ENUM_ORDINAL = org.eclipse.emf.cdo.internal.common.model.CDOTypeImpl.ENUM_ORDINAL;
+
+ /**
+ * @since 3.0
+ */
+ public static final CDOType ENUM_LITERAL = org.eclipse.emf.cdo.internal.common.model.CDOTypeImpl.ENUM_LITERAL;
+
+ /**
+ * @since 4.0
+ */
+ public static final CDOType BLOB = org.eclipse.emf.cdo.internal.common.model.CDOTypeImpl.BLOB;
+
+ /**
+ * @since 4.0
+ */
+ public static final CDOType CLOB = org.eclipse.emf.cdo.internal.common.model.CDOTypeImpl.CLOB;
+
+ 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 String getName();
+
+ /**
+ * @since 4.0
+ */
+ public byte getTypeID();
+
+ public boolean canBeNull();
+
+ public Object getDefaultValue();
+
+ public Object copyValue(Object value);
+
+ /**
+ * @since 4.0
+ */
+ public Object adjustReferences(CDOReferenceAdjuster adjuster, Object value, EStructuralFeature feature, int index);
+
+ /**
+ * @since 3.0
+ */
+ public Object readValue(CDODataInput in) throws IOException;
+
+ /**
+ * @since 3.0
+ */
+ public void writeValue(CDODataOutput out, Object value) throws IOException;
+
+ /**
+ * @since 2.0
+ */
+ public Object convertToEMF(EClassifier feature, Object value);
+
+ /**
+ * @since 2.0
+ */
+ public Object convertToCDO(EClassifier feature, Object value);
+}
diff --git a/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/common/model/EMFUtil.java b/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/common/model/EMFUtil.java
index 2b343dde74..cfd8b13691 100644
--- a/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/common/model/EMFUtil.java
+++ b/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/common/model/EMFUtil.java
@@ -1,513 +1,513 @@
-/*
- * Copyright (c) 2004 - 2011 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
- * Victor Roldan Betancort - maintenance
- * Simon McDuff - maintenance
- */
-package org.eclipse.emf.cdo.common.model;
-
-import org.eclipse.emf.cdo.spi.common.model.InternalCDOPackageRegistry;
-
-import org.eclipse.net4j.util.WrappedException;
-
-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;
-import org.eclipse.emf.ecore.EAttribute;
-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.EReference;
-import org.eclipse.emf.ecore.EStructuralFeature;
-import org.eclipse.emf.ecore.EcoreFactory;
-import org.eclipse.emf.ecore.EcorePackage;
-import org.eclipse.emf.ecore.InternalEObject;
-import org.eclipse.emf.ecore.impl.EPackageImpl;
-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.impl.EcoreResourceFactoryImpl;
-
-import java.io.ByteArrayInputStream;
-import java.io.ByteArrayOutputStream;
-import java.io.IOException;
-import java.util.ArrayList;
-import java.util.Arrays;
-import java.util.Comparator;
-import java.util.HashMap;
-import java.util.Iterator;
-import java.util.List;
-import java.util.Map;
-import java.util.Map.Entry;
-import java.util.Set;
-
-/**
- * Various static helper methods for dealing with EMF meta models.
- *
- * @author Eike Stepper
- * @since 2.0
- * @apiviz.exclude
- */
-public final class EMFUtil
-{
- /**
- * @since 3.0
- */
- public static final String CDO_ANNOTATION_SOURCE = "http://www.eclipse.org/emf/CDO";
-
- /**
- * @since 3.0
- */
- public static final String CDO_ANNOTATION_KEY_PERSISTENT = "persistent";
-
- private static final EReference EOPERATION_EEXCEPTIONS = EcorePackage.eINSTANCE.getEOperation_EExceptions();
-
- private static final EReference ETYPED_ELEMENT_ETYPE = EcorePackage.eINSTANCE.getETypedElement_EType();
-
- private static final EReference ECLASS_ESUPER_TYPES = EcorePackage.eINSTANCE.getEClass_ESuperTypes();
-
- private EMFUtil()
- {
- }
-
- public static EPackage getGeneratedEPackage(EPackage ePackage)
- {
- String packageURI = ePackage.getNsURI();
- if (packageURI.equals(EcorePackage.eINSTANCE.getNsURI()))
- {
- return EcorePackage.eINSTANCE;
- }
-
- EPackage.Registry registry = EPackage.Registry.INSTANCE;
- return registry.getEPackage(packageURI);
- }
-
- 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 EPackage getTopLevelPackage(EPackage ePackage)
- {
- EPackage superPackage = ePackage.getESuperPackage();
- return superPackage == null ? ePackage : getTopLevelPackage(superPackage);
- }
-
- /**
- * @since 2.0
- */
- public static EPackage createEPackage(String name, String nsPrefix, String nsURI)
- {
- EPackage ePackage = EcoreFactory.eINSTANCE.createEPackage();
- ePackage.setName(name);
- ePackage.setNsPrefix(nsPrefix);
- ePackage.setNsURI(nsURI);
- return ePackage;
- }
-
- /**
- * @since 2.0
- */
- public static EClass createEClass(EPackage ePackage, String name, boolean isAbstract, boolean isInterface)
- {
- EClass eClass = EcoreFactory.eINSTANCE.createEClass();
- eClass.setName(name);
- eClass.setAbstract(isAbstract);
- eClass.setInterface(isInterface);
- ePackage.getEClassifiers().add(eClass);
- return eClass;
- }
-
- /**
- * @since 2.0
- */
- public static EAttribute createEAttribute(EClass eClass, String name, EClassifier type)
- {
- EAttribute eAttribute = EcoreFactory.eINSTANCE.createEAttribute();
- eAttribute.setName(name);
- eAttribute.setEType(type);
- eClass.getEStructuralFeatures().add(eAttribute);
- return eAttribute;
- }
-
- /**
- * @since 2.0
- */
- public static EReference createEReference(EClass eClass, String name, EClassifier type, boolean isRequired,
- boolean isMany)
- {
- EReference eReference = EcoreFactory.eINSTANCE.createEReference();
- eReference.setName(name);
- eReference.setEType(type);
- eReference.setLowerBound(isRequired ? 1 : 0);
- eReference.setUpperBound(isMany ? -1 : 0);
- eClass.getEStructuralFeatures().add(eReference);
- return eReference;
- }
-
- public static EClass[] getPersistentClasses(EPackage ePackage)
- {
- List<EClass> result = new ArrayList<EClass>();
- for (EClassifier classifier : ePackage.getEClassifiers())
- {
- if (classifier instanceof EClass)
- {
- result.add((EClass)classifier);
- }
- }
-
- return result.toArray(new EClass[result.size()]);
- }
-
- /**
- * @since 3.0
- */
- public static List<EStructuralFeature> getPersistentFeatures(EList<EStructuralFeature> eFeatures)
- {
- List<EStructuralFeature> result = new ArrayList<EStructuralFeature>();
- for (EStructuralFeature feature : eFeatures)
- {
- if (isPersistent(feature))
- {
- result.add(feature);
- }
- }
-
- return result;
- }
-
- /**
- * @since 3.0
- */
- public static boolean isPersistent(EStructuralFeature feature)
- {
- if (feature == ECLASS_ESUPER_TYPES || feature == ETYPED_ELEMENT_ETYPE || feature == EOPERATION_EEXCEPTIONS)
- {
- // http://www.eclipse.org/newsportal/article.php?id=26780&group=eclipse.tools.emf#26780
- return false;
- }
-
- String persistent = EcoreUtil.getAnnotation(feature, CDO_ANNOTATION_SOURCE, CDO_ANNOTATION_KEY_PERSISTENT);
- if (persistent != null)
- {
- return "true".equalsIgnoreCase(persistent);
- }
-
- if (feature.isTransient())
- {
- // Bug 333950: Transient eRefs with a persistent eOpposite, must be considered persistent
- if (feature instanceof EReference)
- {
- EReference eOpposite = ((EReference)feature).getEOpposite();
- if (eOpposite != null && !eOpposite.isTransient())
- {
- return true;
- }
- }
-
- return false;
- }
-
- return true;
- }
-
- public static boolean isDynamicEPackage(Object value)
- {
- return value.getClass() == EPackageImpl.class;
- }
-
- public static String getParentURI(EPackage ePackage)
- {
- EPackage superPackage = ePackage.getESuperPackage();
- String parentURI = superPackage == null ? null : superPackage.getNsURI();
- return parentURI;
- }
-
- 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 byte[] getEPackageBytes(EPackage ePackage, boolean zipped, EPackage.Registry packageRegistry)
- {
- try
- {
- Resource resource = ePackage.eResource();
- if (resource == null)
- {
- // Happens e.g. for dynamic packages that were not loaded from a resource
- ResourceSet resourceSet = newEcoreResourceSet(packageRegistry);
- resource = resourceSet.createResource(URI.createURI(ePackage.getNsURI()));
- resource.getContents().add(ePackage);
- }
-
- ByteArrayOutputStream baos = new ByteArrayOutputStream();
- resource.save(baos, createResourceOptions(zipped));
- return baos.toByteArray();
- }
- catch (Exception ex)
- {
- throw WrappedException.wrap(ex);
- }
- }
-
- /**
- * @since 3.0
- */
- public static EPackage createEPackage(String uri, byte[] bytes, boolean zipped, ResourceSet resourceSet,
- boolean lookForResource)
- {
- try
- {
- Resource resource = null;
- if (lookForResource)
- {
- resource = resourceSet.getResource(URI.createURI(uri), true);
- }
-
- if (resource == null)
- {
- resource = resourceSet.createResource(URI.createURI(uri));
- }
-
- ByteArrayInputStream bais = new ByteArrayInputStream(bytes);
- resource.load(bais, createResourceOptions(zipped));
-
- EList<EObject> contents = resource.getContents();
- return (EPackage)contents.get(0);
- }
- catch (Exception ex)
- {
- throw WrappedException.wrap(ex);
- }
- }
-
- private static Map<String, Object> createResourceOptions(boolean zipped)
- {
- Map<String, Object> options = new HashMap<String, Object>();
- if (zipped)
- {
- options.put(Resource.OPTION_ZIP, true);
- }
-
- return options;
- }
-
- public static void addAdapter(Notifier notifier, Adapter adapter)
- {
- synchronized (notifier)
- {
- EList<Adapter> adapters = notifier.eAdapters();
- adapters.add(adapter);
- }
- }
-
- 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())
- {
- getAllPackages(subPackage, result);
- }
- }
-
- public static String getQualifiedName(EPackage ePackage, String separator)
- {
- 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();
- }
-
- public static ResourceSet newResourceSet(Resource.Factory resourceFactory)
- {
- ResourceSet resourceSet = new ResourceSetImpl();
- resourceSet.getResourceFactoryRegistry().getExtensionToFactoryMap().put("*", resourceFactory); //$NON-NLS-1$
- return resourceSet;
- }
-
- public static ResourceSet newEcoreResourceSet(EPackage.Registry packageRegistry)
- {
- ResourceSet resourceSet = newResourceSet(new EcoreResourceFactoryImpl());
- resourceSet.setPackageRegistry(packageRegistry);
- return resourceSet;
- }
-
- public static ResourceSet newEcoreResourceSet()
- {
- return newEcoreResourceSet(EPackage.Registry.INSTANCE);
- }
-
- /**
- * @since 3.0
- */
- public static EObject safeResolve(EObject proxy, ResourceSet resourceSet)
- {
- if (!proxy.eIsProxy())
- {
- return proxy;
- }
-
- EObject resolved = EcoreUtil.resolve(proxy, resourceSet);
- if (resolved == proxy)
- {
- throw new IllegalStateException("Unresolvable proxy: " + ((InternalEObject)proxy).eProxyURI());
- }
-
- return resolved;
- }
-
- /**
- * @since 3.0
- */
- public static void safeResolveAll(ResourceSet resourceSet)
- {
- TreeIterator<Notifier> it = resourceSet.getAllContents();
- while (it.hasNext())
- {
- Notifier notifier = it.next();
- if (notifier instanceof EObject)
- {
- safeResolve((EObject)notifier, resourceSet);
- Iterator<EObject> it2 = ((EObject)notifier).eCrossReferences().iterator();
- while (it2.hasNext())
- {
- safeResolve(it2.next(), resourceSet);
- }
- }
- }
- }
-
- /**
- * @see ExtResourceSet
- * @since 4.0
- */
- public static ExtResourceSet createExtResourceSet(InternalCDOPackageRegistry packageRegistry, boolean delegating,
- boolean demandLoading)
- {
- Resource.Factory resourceFactory = new EcoreResourceFactoryImpl();
-
- ExtResourceSet resourceSet = new ExtResourceSet(delegating, demandLoading);
- resourceSet.getResourceFactoryRegistry().getExtensionToFactoryMap().put("*", resourceFactory); //$NON-NLS-1$
- resourceSet.setPackageRegistry(packageRegistry);
- return resourceSet;
- }
-
- /**
- * An extension of {@link ResourceSetImpl} that allows demandLoading of resources and delegation of resource lookups,
- * to be switched on/off as desired.
- *
- * @since 4.0
- * @apiviz.exclude
- */
- public static class ExtResourceSet extends ResourceSetImpl
- {
- private boolean delegating;
-
- private boolean demandLoading;
-
- ExtResourceSet(boolean delegating, boolean demandLoading)
- {
- this.delegating = delegating;
- this.demandLoading = demandLoading;
- }
-
- public boolean isDelegating()
- {
- return delegating;
- }
-
- public void setDelegating(boolean delegating)
- {
- this.delegating = delegating;
- }
-
- public boolean isDemandLoading()
- {
- return demandLoading;
- }
-
- public void setDemandLoading(boolean demandLoading)
- {
- this.demandLoading = demandLoading;
- }
-
- @Override
- protected void demandLoad(Resource resource) throws IOException
- {
- if (demandLoading)
- {
- super.demandLoad(resource);
- }
- }
-
- @Override
- protected Resource delegatedGetResource(URI uri, boolean loadOnDemand)
- {
- if (delegating)
- {
- return super.delegatedGetResource(uri, loadOnDemand);
- }
-
- return null;
- }
- }
-}
+/*
+ * Copyright (c) 2004 - 2012 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
+ * Victor Roldan Betancort - maintenance
+ * Simon McDuff - maintenance
+ */
+package org.eclipse.emf.cdo.common.model;
+
+import org.eclipse.emf.cdo.spi.common.model.InternalCDOPackageRegistry;
+
+import org.eclipse.net4j.util.WrappedException;
+
+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;
+import org.eclipse.emf.ecore.EAttribute;
+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.EReference;
+import org.eclipse.emf.ecore.EStructuralFeature;
+import org.eclipse.emf.ecore.EcoreFactory;
+import org.eclipse.emf.ecore.EcorePackage;
+import org.eclipse.emf.ecore.InternalEObject;
+import org.eclipse.emf.ecore.impl.EPackageImpl;
+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.impl.EcoreResourceFactoryImpl;
+
+import java.io.ByteArrayInputStream;
+import java.io.ByteArrayOutputStream;
+import java.io.IOException;
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.Comparator;
+import java.util.HashMap;
+import java.util.Iterator;
+import java.util.List;
+import java.util.Map;
+import java.util.Map.Entry;
+import java.util.Set;
+
+/**
+ * Various static helper methods for dealing with EMF meta models.
+ *
+ * @author Eike Stepper
+ * @since 2.0
+ * @apiviz.exclude
+ */
+public final class EMFUtil
+{
+ /**
+ * @since 3.0
+ */
+ public static final String CDO_ANNOTATION_SOURCE = "http://www.eclipse.org/emf/CDO";
+
+ /**
+ * @since 3.0
+ */
+ public static final String CDO_ANNOTATION_KEY_PERSISTENT = "persistent";
+
+ private static final EReference EOPERATION_EEXCEPTIONS = EcorePackage.eINSTANCE.getEOperation_EExceptions();
+
+ private static final EReference ETYPED_ELEMENT_ETYPE = EcorePackage.eINSTANCE.getETypedElement_EType();
+
+ private static final EReference ECLASS_ESUPER_TYPES = EcorePackage.eINSTANCE.getEClass_ESuperTypes();
+
+ private EMFUtil()
+ {
+ }
+
+ public static EPackage getGeneratedEPackage(EPackage ePackage)
+ {
+ String packageURI = ePackage.getNsURI();
+ if (packageURI.equals(EcorePackage.eINSTANCE.getNsURI()))
+ {
+ return EcorePackage.eINSTANCE;
+ }
+
+ EPackage.Registry registry = EPackage.Registry.INSTANCE;
+ return registry.getEPackage(packageURI);
+ }
+
+ 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 EPackage getTopLevelPackage(EPackage ePackage)
+ {
+ EPackage superPackage = ePackage.getESuperPackage();
+ return superPackage == null ? ePackage : getTopLevelPackage(superPackage);
+ }
+
+ /**
+ * @since 2.0
+ */
+ public static EPackage createEPackage(String name, String nsPrefix, String nsURI)
+ {
+ EPackage ePackage = EcoreFactory.eINSTANCE.createEPackage();
+ ePackage.setName(name);
+ ePackage.setNsPrefix(nsPrefix);
+ ePackage.setNsURI(nsURI);
+ return ePackage;
+ }
+
+ /**
+ * @since 2.0
+ */
+ public static EClass createEClass(EPackage ePackage, String name, boolean isAbstract, boolean isInterface)
+ {
+ EClass eClass = EcoreFactory.eINSTANCE.createEClass();
+ eClass.setName(name);
+ eClass.setAbstract(isAbstract);
+ eClass.setInterface(isInterface);
+ ePackage.getEClassifiers().add(eClass);
+ return eClass;
+ }
+
+ /**
+ * @since 2.0
+ */
+ public static EAttribute createEAttribute(EClass eClass, String name, EClassifier type)
+ {
+ EAttribute eAttribute = EcoreFactory.eINSTANCE.createEAttribute();
+ eAttribute.setName(name);
+ eAttribute.setEType(type);
+ eClass.getEStructuralFeatures().add(eAttribute);
+ return eAttribute;
+ }
+
+ /**
+ * @since 2.0
+ */
+ public static EReference createEReference(EClass eClass, String name, EClassifier type, boolean isRequired,
+ boolean isMany)
+ {
+ EReference eReference = EcoreFactory.eINSTANCE.createEReference();
+ eReference.setName(name);
+ eReference.setEType(type);
+ eReference.setLowerBound(isRequired ? 1 : 0);
+ eReference.setUpperBound(isMany ? -1 : 0);
+ eClass.getEStructuralFeatures().add(eReference);
+ return eReference;
+ }
+
+ public static EClass[] getPersistentClasses(EPackage ePackage)
+ {
+ List<EClass> result = new ArrayList<EClass>();
+ for (EClassifier classifier : ePackage.getEClassifiers())
+ {
+ if (classifier instanceof EClass)
+ {
+ result.add((EClass)classifier);
+ }
+ }
+
+ return result.toArray(new EClass[result.size()]);
+ }
+
+ /**
+ * @since 3.0
+ */
+ public static List<EStructuralFeature> getPersistentFeatures(EList<EStructuralFeature> eFeatures)
+ {
+ List<EStructuralFeature> result = new ArrayList<EStructuralFeature>();
+ for (EStructuralFeature feature : eFeatures)
+ {
+ if (isPersistent(feature))
+ {
+ result.add(feature);
+ }
+ }
+
+ return result;
+ }
+
+ /**
+ * @since 3.0
+ */
+ public static boolean isPersistent(EStructuralFeature feature)
+ {
+ if (feature == ECLASS_ESUPER_TYPES || feature == ETYPED_ELEMENT_ETYPE || feature == EOPERATION_EEXCEPTIONS)
+ {
+ // http://www.eclipse.org/newsportal/article.php?id=26780&group=eclipse.tools.emf#26780
+ return false;
+ }
+
+ String persistent = EcoreUtil.getAnnotation(feature, CDO_ANNOTATION_SOURCE, CDO_ANNOTATION_KEY_PERSISTENT);
+ if (persistent != null)
+ {
+ return "true".equalsIgnoreCase(persistent);
+ }
+
+ if (feature.isTransient())
+ {
+ // Bug 333950: Transient eRefs with a persistent eOpposite, must be considered persistent
+ if (feature instanceof EReference)
+ {
+ EReference eOpposite = ((EReference)feature).getEOpposite();
+ if (eOpposite != null && !eOpposite.isTransient())
+ {
+ return true;
+ }
+ }
+
+ return false;
+ }
+
+ return true;
+ }
+
+ public static boolean isDynamicEPackage(Object value)
+ {
+ return value.getClass() == EPackageImpl.class;
+ }
+
+ public static String getParentURI(EPackage ePackage)
+ {
+ EPackage superPackage = ePackage.getESuperPackage();
+ String parentURI = superPackage == null ? null : superPackage.getNsURI();
+ return parentURI;
+ }
+
+ 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 byte[] getEPackageBytes(EPackage ePackage, boolean zipped, EPackage.Registry packageRegistry)
+ {
+ try
+ {
+ Resource resource = ePackage.eResource();
+ if (resource == null)
+ {
+ // Happens e.g. for dynamic packages that were not loaded from a resource
+ ResourceSet resourceSet = newEcoreResourceSet(packageRegistry);
+ resource = resourceSet.createResource(URI.createURI(ePackage.getNsURI()));
+ resource.getContents().add(ePackage);
+ }
+
+ ByteArrayOutputStream baos = new ByteArrayOutputStream();
+ resource.save(baos, createResourceOptions(zipped));
+ return baos.toByteArray();
+ }
+ catch (Exception ex)
+ {
+ throw WrappedException.wrap(ex);
+ }
+ }
+
+ /**
+ * @since 3.0
+ */
+ public static EPackage createEPackage(String uri, byte[] bytes, boolean zipped, ResourceSet resourceSet,
+ boolean lookForResource)
+ {
+ try
+ {
+ Resource resource = null;
+ if (lookForResource)
+ {
+ resource = resourceSet.getResource(URI.createURI(uri), true);
+ }
+
+ if (resource == null)
+ {
+ resource = resourceSet.createResource(URI.createURI(uri));
+ }
+
+ ByteArrayInputStream bais = new ByteArrayInputStream(bytes);
+ resource.load(bais, createResourceOptions(zipped));
+
+ EList<EObject> contents = resource.getContents();
+ return (EPackage)contents.get(0);
+ }
+ catch (Exception ex)
+ {
+ throw WrappedException.wrap(ex);
+ }
+ }
+
+ private static Map<String, Object> createResourceOptions(boolean zipped)
+ {
+ Map<String, Object> options = new HashMap<String, Object>();
+ if (zipped)
+ {
+ options.put(Resource.OPTION_ZIP, true);
+ }
+
+ return options;
+ }
+
+ public static void addAdapter(Notifier notifier, Adapter adapter)
+ {
+ synchronized (notifier)
+ {
+ EList<Adapter> adapters = notifier.eAdapters();
+ adapters.add(adapter);
+ }
+ }
+
+ 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())
+ {
+ getAllPackages(subPackage, result);
+ }
+ }
+
+ public static String getQualifiedName(EPackage ePackage, String separator)
+ {
+ 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();
+ }
+
+ public static ResourceSet newResourceSet(Resource.Factory resourceFactory)
+ {
+ ResourceSet resourceSet = new ResourceSetImpl();
+ resourceSet.getResourceFactoryRegistry().getExtensionToFactoryMap().put("*", resourceFactory); //$NON-NLS-1$
+ return resourceSet;
+ }
+
+ public static ResourceSet newEcoreResourceSet(EPackage.Registry packageRegistry)
+ {
+ ResourceSet resourceSet = newResourceSet(new EcoreResourceFactoryImpl());
+ resourceSet.setPackageRegistry(packageRegistry);
+ return resourceSet;
+ }
+
+ public static ResourceSet newEcoreResourceSet()
+ {
+ return newEcoreResourceSet(EPackage.Registry.INSTANCE);
+ }
+
+ /**
+ * @since 3.0
+ */
+ public static EObject safeResolve(EObject proxy, ResourceSet resourceSet)
+ {
+ if (!proxy.eIsProxy())
+ {
+ return proxy;
+ }
+
+ EObject resolved = EcoreUtil.resolve(proxy, resourceSet);
+ if (resolved == proxy)
+ {
+ throw new IllegalStateException("Unresolvable proxy: " + ((InternalEObject)proxy).eProxyURI());
+ }
+
+ return resolved;
+ }
+
+ /**
+ * @since 3.0
+ */
+ public static void safeResolveAll(ResourceSet resourceSet)
+ {
+ TreeIterator<Notifier> it = resourceSet.getAllContents();
+ while (it.hasNext())
+ {
+ Notifier notifier = it.next();
+ if (notifier instanceof EObject)
+ {
+ safeResolve((EObject)notifier, resourceSet);
+ Iterator<EObject> it2 = ((EObject)notifier).eCrossReferences().iterator();
+ while (it2.hasNext())
+ {
+ safeResolve(it2.next(), resourceSet);
+ }
+ }
+ }
+ }
+
+ /**
+ * @see ExtResourceSet
+ * @since 4.0
+ */
+ public static ExtResourceSet createExtResourceSet(InternalCDOPackageRegistry packageRegistry, boolean delegating,
+ boolean demandLoading)
+ {
+ Resource.Factory resourceFactory = new EcoreResourceFactoryImpl();
+
+ ExtResourceSet resourceSet = new ExtResourceSet(delegating, demandLoading);
+ resourceSet.getResourceFactoryRegistry().getExtensionToFactoryMap().put("*", resourceFactory); //$NON-NLS-1$
+ resourceSet.setPackageRegistry(packageRegistry);
+ return resourceSet;
+ }
+
+ /**
+ * An extension of {@link ResourceSetImpl} that allows demandLoading of resources and delegation of resource lookups,
+ * to be switched on/off as desired.
+ *
+ * @since 4.0
+ * @apiviz.exclude
+ */
+ public static class ExtResourceSet extends ResourceSetImpl
+ {
+ private boolean delegating;
+
+ private boolean demandLoading;
+
+ ExtResourceSet(boolean delegating, boolean demandLoading)
+ {
+ this.delegating = delegating;
+ this.demandLoading = demandLoading;
+ }
+
+ public boolean isDelegating()
+ {
+ return delegating;
+ }
+
+ public void setDelegating(boolean delegating)
+ {
+ this.delegating = delegating;
+ }
+
+ public boolean isDemandLoading()
+ {
+ return demandLoading;
+ }
+
+ public void setDemandLoading(boolean demandLoading)
+ {
+ this.demandLoading = demandLoading;
+ }
+
+ @Override
+ protected void demandLoad(Resource resource) throws IOException
+ {
+ if (demandLoading)
+ {
+ super.demandLoad(resource);
+ }
+ }
+
+ @Override
+ protected Resource delegatedGetResource(URI uri, boolean loadOnDemand)
+ {
+ if (delegating)
+ {
+ return super.delegatedGetResource(uri, loadOnDemand);
+ }
+
+ return null;
+ }
+ }
+}
diff --git a/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/common/model/package-info.java b/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/common/model/package-info.java
index 60f669011a..63bfb5eb9c 100644
--- a/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/common/model/package-info.java
+++ b/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/common/model/package-info.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2004 - 2011 Eike Stepper (Berlin, Germany) and others.
+ * Copyright (c) 2004 - 2012 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
diff --git a/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/common/package-info.java b/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/common/package-info.java
index 96f974eb3c..750d1ee1fa 100644
--- a/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/common/package-info.java
+++ b/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/common/package-info.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2004 - 2011 Eike Stepper (Berlin, Germany) and others.
+ * Copyright (c) 2004 - 2012 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
diff --git a/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/common/protocol/CDOAuthenticator.java b/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/common/protocol/CDOAuthenticator.java
index 6017406519..2eb66f6cc7 100644
--- a/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/common/protocol/CDOAuthenticator.java
+++ b/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/common/protocol/CDOAuthenticator.java
@@ -1,45 +1,45 @@
-/*
- * Copyright (c) 2004 - 2011 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.protocol;
-
-import org.eclipse.emf.cdo.spi.common.CDOAuthenticationResult;
-
-import org.eclipse.net4j.util.security.IPasswordCredentialsProvider;
-
-/**
- * The front-end of the CDO challenge/response authentication.
- *
- * @author Eike Stepper
- * @since 2.0
- */
-public interface CDOAuthenticator
-{
- public String getEncryptionAlgorithmName();
-
- public void setEncryptionAlgorithmName(String encryptionAlgorithmName);
-
- public byte[] getEncryptionSaltBytes();
-
- public void setEncryptionSaltBytes(byte[] encryptionSaltBytes);
-
- public int getEncryptionIterationCount();
-
- public void setEncryptionIterationCount(int encryptionIterationCount);
-
- public IPasswordCredentialsProvider getCredentialsProvider();
-
- public void setCredentialsProvider(IPasswordCredentialsProvider credentialsProvider);
-
- /**
- * @since 4.0
- */
- public CDOAuthenticationResult authenticate(byte[] randomToken);
-}
+/*
+ * Copyright (c) 2004 - 2012 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.protocol;
+
+import org.eclipse.emf.cdo.spi.common.CDOAuthenticationResult;
+
+import org.eclipse.net4j.util.security.IPasswordCredentialsProvider;
+
+/**
+ * The front-end of the CDO challenge/response authentication.
+ *
+ * @author Eike Stepper
+ * @since 2.0
+ */
+public interface CDOAuthenticator
+{
+ public String getEncryptionAlgorithmName();
+
+ public void setEncryptionAlgorithmName(String encryptionAlgorithmName);
+
+ public byte[] getEncryptionSaltBytes();
+
+ public void setEncryptionSaltBytes(byte[] encryptionSaltBytes);
+
+ public int getEncryptionIterationCount();
+
+ public void setEncryptionIterationCount(int encryptionIterationCount);
+
+ public IPasswordCredentialsProvider getCredentialsProvider();
+
+ public void setCredentialsProvider(IPasswordCredentialsProvider credentialsProvider);
+
+ /**
+ * @since 4.0
+ */
+ public CDOAuthenticationResult authenticate(byte[] randomToken);
+}
diff --git a/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/common/protocol/CDODataInput.java b/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/common/protocol/CDODataInput.java
index 2231e70115..0cb9d5915d 100644
--- a/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/common/protocol/CDODataInput.java
+++ b/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/common/protocol/CDODataInput.java
@@ -1,167 +1,167 @@
-/*
- * Copyright (c) 2004 - 2011 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 - maintenance
- */
-package org.eclipse.emf.cdo.common.protocol;
-
-import org.eclipse.emf.cdo.common.branch.CDOBranch;
-import org.eclipse.emf.cdo.common.branch.CDOBranchPoint;
-import org.eclipse.emf.cdo.common.branch.CDOBranchVersion;
-import org.eclipse.emf.cdo.common.commit.CDOChangeSetData;
-import org.eclipse.emf.cdo.common.commit.CDOCommitData;
-import org.eclipse.emf.cdo.common.commit.CDOCommitInfo;
-import org.eclipse.emf.cdo.common.id.CDOID;
-import org.eclipse.emf.cdo.common.id.CDOIDReference;
-import org.eclipse.emf.cdo.common.lock.CDOLockChangeInfo;
-import org.eclipse.emf.cdo.common.lock.CDOLockOwner;
-import org.eclipse.emf.cdo.common.lock.CDOLockState;
-import org.eclipse.emf.cdo.common.lock.IDurableLockingManager.LockArea;
-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.CDOIDAndBranch;
-import org.eclipse.emf.cdo.common.revision.CDOIDAndVersion;
-import org.eclipse.emf.cdo.common.revision.CDOList;
-import org.eclipse.emf.cdo.common.revision.CDORevisable;
-import org.eclipse.emf.cdo.common.revision.CDORevision;
-import org.eclipse.emf.cdo.common.revision.CDORevisionKey;
-import org.eclipse.emf.cdo.common.revision.delta.CDOFeatureDelta;
-import org.eclipse.emf.cdo.common.revision.delta.CDORevisionDelta;
-
-import org.eclipse.net4j.util.concurrent.IRWLockManager.LockType;
-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 org.eclipse.emf.ecore.resource.ResourceSet;
-
-import java.io.IOException;
-
-/**
- * Provides I/O methods for reading various CDO data types and concepts from streams.
- *
- * @author Eike Stepper
- * @since 3.0
- * @noextend This interface is not intended to be extended by clients.
- * @noimplement This interface is not intended to be implemented by clients.
- */
-public interface CDODataInput extends ExtendedDataInput
-{
- // /////////////////////////////////////////////////////////////////////////////////////////////////
-
- public CDOPackageUnit readCDOPackageUnit(ResourceSet resourceSet) throws IOException;
-
- public CDOPackageUnit[] readCDOPackageUnits(ResourceSet resourceSet) throws IOException;
-
- public CDOPackageUnit.Type readCDOPackageUnitType() throws IOException;
-
- public CDOPackageInfo readCDOPackageInfo() throws IOException;
-
- public CDOClassifierRef readCDOClassifierRef() throws IOException;
-
- public EClassifier readCDOClassifierRefAndResolve() throws IOException;
-
- public String readCDOPackageURI() throws IOException;
-
- public CDOType readCDOType() throws IOException;
-
- // /////////////////////////////////////////////////////////////////////////////////////////////////
-
- public CDOBranch readCDOBranch() throws IOException;
-
- public CDOBranchPoint readCDOBranchPoint() throws IOException;
-
- public CDOBranchVersion readCDOBranchVersion() throws IOException;
-
- public CDOChangeSetData readCDOChangeSetData() throws IOException;
-
- public CDOCommitData readCDOCommitData() throws IOException;
-
- public CDOCommitInfo readCDOCommitInfo() throws IOException;
-
- // /////////////////////////////////////////////////////////////////////////////////////////////////
-
- public CDOID readCDOID() throws IOException;
-
- /**
- * @since 4.0
- */
- public CDOIDReference readCDOIDReference() throws IOException;
-
- /**
- * @since 4.0
- */
- public CDOIDAndVersion readCDOIDAndVersion() throws IOException;
-
- /**
- * @since 4.0
- */
- public CDOIDAndBranch readCDOIDAndBranch() throws IOException;
-
- // /////////////////////////////////////////////////////////////////////////////////////////////////
-
- public CDORevisionKey readCDORevisionKey() throws IOException;
-
- public CDORevision readCDORevision() throws IOException;
-
- /**
- * @since 4.1
- */
- public CDORevision readCDORevision(boolean freeze) throws IOException;
-
- /**
- * @since 4.0
- */
- public CDORevisable readCDORevisable() throws IOException;
-
- public CDOList readCDOList(EClass owner, EStructuralFeature feature) throws IOException;
-
- public Object readCDOFeatureValue(EStructuralFeature feature) throws IOException;
-
- public CDORevisionDelta readCDORevisionDelta() throws IOException;
-
- public CDOFeatureDelta readCDOFeatureDelta(EClass owner) throws IOException;
-
- /**
- * Read either a CDORevision or a primitive value.
- */
- public Object readCDORevisionOrPrimitive() throws IOException;
-
- /**
- * Read either a CDORevision, a primitive value or a EClass.
- */
- public Object readCDORevisionOrPrimitiveOrClassifier() throws IOException;
-
- // /////////////////////////////////////////////////////////////////////////////////////////////////
-
- public LockType readCDOLockType() throws IOException;
-
- /**
- * @since 4.1
- */
- public CDOLockChangeInfo readCDOLockChangeInfo() throws IOException;
-
- /**
- * @since 4.1
- */
- public CDOLockOwner readCDOLockOwner() throws IOException;
-
- /**
- * @since 4.1
- */
- public CDOLockState readCDOLockState() throws IOException;
-
- /**
- * @since 4.1
- */
- public LockArea readCDOLockArea() throws IOException;
-}
+/*
+ * Copyright (c) 2004 - 2012 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 - maintenance
+ */
+package org.eclipse.emf.cdo.common.protocol;
+
+import org.eclipse.emf.cdo.common.branch.CDOBranch;
+import org.eclipse.emf.cdo.common.branch.CDOBranchPoint;
+import org.eclipse.emf.cdo.common.branch.CDOBranchVersion;
+import org.eclipse.emf.cdo.common.commit.CDOChangeSetData;
+import org.eclipse.emf.cdo.common.commit.CDOCommitData;
+import org.eclipse.emf.cdo.common.commit.CDOCommitInfo;
+import org.eclipse.emf.cdo.common.id.CDOID;
+import org.eclipse.emf.cdo.common.id.CDOIDReference;
+import org.eclipse.emf.cdo.common.lock.CDOLockChangeInfo;
+import org.eclipse.emf.cdo.common.lock.CDOLockOwner;
+import org.eclipse.emf.cdo.common.lock.CDOLockState;
+import org.eclipse.emf.cdo.common.lock.IDurableLockingManager.LockArea;
+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.CDOIDAndBranch;
+import org.eclipse.emf.cdo.common.revision.CDOIDAndVersion;
+import org.eclipse.emf.cdo.common.revision.CDOList;
+import org.eclipse.emf.cdo.common.revision.CDORevisable;
+import org.eclipse.emf.cdo.common.revision.CDORevision;
+import org.eclipse.emf.cdo.common.revision.CDORevisionKey;
+import org.eclipse.emf.cdo.common.revision.delta.CDOFeatureDelta;
+import org.eclipse.emf.cdo.common.revision.delta.CDORevisionDelta;
+
+import org.eclipse.net4j.util.concurrent.IRWLockManager.LockType;
+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 org.eclipse.emf.ecore.resource.ResourceSet;
+
+import java.io.IOException;
+
+/**
+ * Provides I/O methods for reading various CDO data types and concepts from streams.
+ *
+ * @author Eike Stepper
+ * @since 3.0
+ * @noextend This interface is not intended to be extended by clients.
+ * @noimplement This interface is not intended to be implemented by clients.
+ */
+public interface CDODataInput extends ExtendedDataInput
+{
+ // /////////////////////////////////////////////////////////////////////////////////////////////////
+
+ public CDOPackageUnit readCDOPackageUnit(ResourceSet resourceSet) throws IOException;
+
+ public CDOPackageUnit[] readCDOPackageUnits(ResourceSet resourceSet) throws IOException;
+
+ public CDOPackageUnit.Type readCDOPackageUnitType() throws IOException;
+
+ public CDOPackageInfo readCDOPackageInfo() throws IOException;
+
+ public CDOClassifierRef readCDOClassifierRef() throws IOException;
+
+ public EClassifier readCDOClassifierRefAndResolve() throws IOException;
+
+ public String readCDOPackageURI() throws IOException;
+
+ public CDOType readCDOType() throws IOException;
+
+ // /////////////////////////////////////////////////////////////////////////////////////////////////
+
+ public CDOBranch readCDOBranch() throws IOException;
+
+ public CDOBranchPoint readCDOBranchPoint() throws IOException;
+
+ public CDOBranchVersion readCDOBranchVersion() throws IOException;
+
+ public CDOChangeSetData readCDOChangeSetData() throws IOException;
+
+ public CDOCommitData readCDOCommitData() throws IOException;
+
+ public CDOCommitInfo readCDOCommitInfo() throws IOException;
+
+ // /////////////////////////////////////////////////////////////////////////////////////////////////
+
+ public CDOID readCDOID() throws IOException;
+
+ /**
+ * @since 4.0
+ */
+ public CDOIDReference readCDOIDReference() throws IOException;
+
+ /**
+ * @since 4.0
+ */
+ public CDOIDAndVersion readCDOIDAndVersion() throws IOException;
+
+ /**
+ * @since 4.0
+ */
+ public CDOIDAndBranch readCDOIDAndBranch() throws IOException;
+
+ // /////////////////////////////////////////////////////////////////////////////////////////////////
+
+ public CDORevisionKey readCDORevisionKey() throws IOException;
+
+ public CDORevision readCDORevision() throws IOException;
+
+ /**
+ * @since 4.1
+ */
+ public CDORevision readCDORevision(boolean freeze) throws IOException;
+
+ /**
+ * @since 4.0
+ */
+ public CDORevisable readCDORevisable() throws IOException;
+
+ public CDOList readCDOList(EClass owner, EStructuralFeature feature) throws IOException;
+
+ public Object readCDOFeatureValue(EStructuralFeature feature) throws IOException;
+
+ public CDORevisionDelta readCDORevisionDelta() throws IOException;
+
+ public CDOFeatureDelta readCDOFeatureDelta(EClass owner) throws IOException;
+
+ /**
+ * Read either a CDORevision or a primitive value.
+ */
+ public Object readCDORevisionOrPrimitive() throws IOException;
+
+ /**
+ * Read either a CDORevision, a primitive value or a EClass.
+ */
+ public Object readCDORevisionOrPrimitiveOrClassifier() throws IOException;
+
+ // /////////////////////////////////////////////////////////////////////////////////////////////////
+
+ public LockType readCDOLockType() throws IOException;
+
+ /**
+ * @since 4.1
+ */
+ public CDOLockChangeInfo readCDOLockChangeInfo() throws IOException;
+
+ /**
+ * @since 4.1
+ */
+ public CDOLockOwner readCDOLockOwner() throws IOException;
+
+ /**
+ * @since 4.1
+ */
+ public CDOLockState readCDOLockState() throws IOException;
+
+ /**
+ * @since 4.1
+ */
+ public LockArea readCDOLockArea() throws IOException;
+}
diff --git a/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/common/protocol/CDODataOutput.java b/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/common/protocol/CDODataOutput.java
index 3608ed436a..07f9aa4390 100644
--- a/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/common/protocol/CDODataOutput.java
+++ b/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/common/protocol/CDODataOutput.java
@@ -1,168 +1,168 @@
-/*
- * Copyright (c) 2004 - 2011 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 - maintenance
- */
-package org.eclipse.emf.cdo.common.protocol;
-
-import org.eclipse.emf.cdo.common.branch.CDOBranch;
-import org.eclipse.emf.cdo.common.branch.CDOBranchPoint;
-import org.eclipse.emf.cdo.common.branch.CDOBranchVersion;
-import org.eclipse.emf.cdo.common.commit.CDOChangeSetData;
-import org.eclipse.emf.cdo.common.commit.CDOCommitData;
-import org.eclipse.emf.cdo.common.commit.CDOCommitInfo;
-import org.eclipse.emf.cdo.common.id.CDOID;
-import org.eclipse.emf.cdo.common.id.CDOIDProvider;
-import org.eclipse.emf.cdo.common.id.CDOIDReference;
-import org.eclipse.emf.cdo.common.lock.CDOLockChangeInfo;
-import org.eclipse.emf.cdo.common.lock.CDOLockOwner;
-import org.eclipse.emf.cdo.common.lock.CDOLockState;
-import org.eclipse.emf.cdo.common.lock.IDurableLockingManager.LockArea;
-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.CDOIDAndBranch;
-import org.eclipse.emf.cdo.common.revision.CDOIDAndVersion;
-import org.eclipse.emf.cdo.common.revision.CDOList;
-import org.eclipse.emf.cdo.common.revision.CDORevisable;
-import org.eclipse.emf.cdo.common.revision.CDORevision;
-import org.eclipse.emf.cdo.common.revision.CDORevisionKey;
-import org.eclipse.emf.cdo.common.revision.delta.CDOFeatureDelta;
-import org.eclipse.emf.cdo.common.revision.delta.CDORevisionDelta;
-
-import org.eclipse.net4j.util.concurrent.IRWLockManager.LockType;
-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;
-
-/**
- * Provides I/O methods for writing various CDO data types and concepts to streams.
- *
- * @author Eike Stepper
- * @since 3.0
- * @noextend This interface is not intended to be extended by clients.
- * @noimplement This interface is not intended to be implemented by clients.
- */
-public interface CDODataOutput extends ExtendedDataOutput
-{
- public CDOPackageRegistry getPackageRegistry();
-
- public CDOIDProvider getIDProvider();
-
- // /////////////////////////////////////////////////////////////////////////////////////////////////
-
- public void writeCDOPackageUnit(CDOPackageUnit packageUnit, boolean withPackages) throws IOException;
-
- public void writeCDOPackageUnits(CDOPackageUnit... packageUnit) throws IOException;
-
- public void writeCDOPackageUnitType(CDOPackageUnit.Type type) throws IOException;
-
- public void writeCDOPackageInfo(CDOPackageInfo packageInfo) throws IOException;
-
- public void writeCDOClassifierRef(CDOClassifierRef eClassifierRef) throws IOException;
-
- public void writeCDOClassifierRef(EClassifier eClassifier) throws IOException;
-
- public void writeCDOPackageURI(String uri) throws IOException;
-
- public void writeCDOType(CDOType cdoType) throws IOException;
-
- // /////////////////////////////////////////////////////////////////////////////////////////////////
-
- public void writeCDOBranch(CDOBranch branch) throws IOException;
-
- public void writeCDOBranchPoint(CDOBranchPoint branchPoint) throws IOException;
-
- public void writeCDOBranchVersion(CDOBranchVersion branchVersion) throws IOException;
-
- public void writeCDOChangeSetData(CDOChangeSetData changeSetData) throws IOException;
-
- public void writeCDOCommitData(CDOCommitData commitData) throws IOException;
-
- public void writeCDOCommitInfo(CDOCommitInfo commitInfo) throws IOException;
-
- // /////////////////////////////////////////////////////////////////////////////////////////////////
-
- public void writeCDOID(CDOID id) throws IOException;
-
- /**
- * @since 4.0
- */
- public void writeCDOIDReference(CDOIDReference idReference) throws IOException;
-
- /**
- * @since 4.0
- */
- public void writeCDOIDAndVersion(CDOIDAndVersion idAndVersion) throws IOException;
-
- /**
- * @since 4.0
- */
- public void writeCDOIDAndBranch(CDOIDAndBranch idAndBranch) throws IOException;
-
- // /////////////////////////////////////////////////////////////////////////////////////////////////
-
- public void writeCDORevisionKey(CDORevisionKey revisionKey) throws IOException;
-
- public void writeCDORevision(CDORevision revision, int referenceChunk) throws IOException;
-
- /**
- * @since 4.0
- */
- public void writeCDORevisable(CDORevisable revisable) throws IOException;
-
- public void writeCDOList(EClass owner, EStructuralFeature feature, CDOList list, int referenceChunk)
- throws IOException;
-
- public void writeCDOFeatureValue(EStructuralFeature feature, Object value) throws IOException;
-
- public void writeCDORevisionDelta(CDORevisionDelta revisionDelta) throws IOException;
-
- public void writeCDOFeatureDelta(EClass owner, CDOFeatureDelta featureDelta) throws IOException;
-
- /**
- * Write either a CDORevision or a primitive value.
- */
- public void writeCDORevisionOrPrimitive(Object value) throws IOException;
-
- /**
- * Write either a CDORevision, a primitive value or a EClass.
- */
- public void writeCDORevisionOrPrimitiveOrClassifier(Object value) throws IOException;
-
- // /////////////////////////////////////////////////////////////////////////////////////////////////
-
- public void writeCDOLockType(LockType lockType) throws IOException;
-
- /**
- * @since 4.1
- */
- public void writeCDOLockChangeInfo(CDOLockChangeInfo lockChangeInfo) throws IOException;
-
- /**
- * @since 4.1
- */
- public void writeCDOLockState(CDOLockState lockState) throws IOException;
-
- /**
- * @since 4.1
- */
- public void writeCDOLockOwner(CDOLockOwner lockOwner) throws IOException;
-
- /**
- * @since 4.1
- */
- public void writeCDOLockArea(LockArea lockArea) throws IOException;
-}
+/*
+ * Copyright (c) 2004 - 2012 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 - maintenance
+ */
+package org.eclipse.emf.cdo.common.protocol;
+
+import org.eclipse.emf.cdo.common.branch.CDOBranch;
+import org.eclipse.emf.cdo.common.branch.CDOBranchPoint;
+import org.eclipse.emf.cdo.common.branch.CDOBranchVersion;
+import org.eclipse.emf.cdo.common.commit.CDOChangeSetData;
+import org.eclipse.emf.cdo.common.commit.CDOCommitData;
+import org.eclipse.emf.cdo.common.commit.CDOCommitInfo;
+import org.eclipse.emf.cdo.common.id.CDOID;
+import org.eclipse.emf.cdo.common.id.CDOIDProvider;
+import org.eclipse.emf.cdo.common.id.CDOIDReference;
+import org.eclipse.emf.cdo.common.lock.CDOLockChangeInfo;
+import org.eclipse.emf.cdo.common.lock.CDOLockOwner;
+import org.eclipse.emf.cdo.common.lock.CDOLockState;
+import org.eclipse.emf.cdo.common.lock.IDurableLockingManager.LockArea;
+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.CDOIDAndBranch;
+import org.eclipse.emf.cdo.common.revision.CDOIDAndVersion;
+import org.eclipse.emf.cdo.common.revision.CDOList;
+import org.eclipse.emf.cdo.common.revision.CDORevisable;
+import org.eclipse.emf.cdo.common.revision.CDORevision;
+import org.eclipse.emf.cdo.common.revision.CDORevisionKey;
+import org.eclipse.emf.cdo.common.revision.delta.CDOFeatureDelta;
+import org.eclipse.emf.cdo.common.revision.delta.CDORevisionDelta;
+
+import org.eclipse.net4j.util.concurrent.IRWLockManager.LockType;
+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;
+
+/**
+ * Provides I/O methods for writing various CDO data types and concepts to streams.
+ *
+ * @author Eike Stepper
+ * @since 3.0
+ * @noextend This interface is not intended to be extended by clients.
+ * @noimplement This interface is not intended to be implemented by clients.
+ */
+public interface CDODataOutput extends ExtendedDataOutput
+{
+ public CDOPackageRegistry getPackageRegistry();
+
+ public CDOIDProvider getIDProvider();
+
+ // /////////////////////////////////////////////////////////////////////////////////////////////////
+
+ public void writeCDOPackageUnit(CDOPackageUnit packageUnit, boolean withPackages) throws IOException;
+
+ public void writeCDOPackageUnits(CDOPackageUnit... packageUnit) throws IOException;
+
+ public void writeCDOPackageUnitType(CDOPackageUnit.Type type) throws IOException;
+
+ public void writeCDOPackageInfo(CDOPackageInfo packageInfo) throws IOException;
+
+ public void writeCDOClassifierRef(CDOClassifierRef eClassifierRef) throws IOException;
+
+ public void writeCDOClassifierRef(EClassifier eClassifier) throws IOException;
+
+ public void writeCDOPackageURI(String uri) throws IOException;
+
+ public void writeCDOType(CDOType cdoType) throws IOException;
+
+ // /////////////////////////////////////////////////////////////////////////////////////////////////
+
+ public void writeCDOBranch(CDOBranch branch) throws IOException;
+
+ public void writeCDOBranchPoint(CDOBranchPoint branchPoint) throws IOException;
+
+ public void writeCDOBranchVersion(CDOBranchVersion branchVersion) throws IOException;
+
+ public void writeCDOChangeSetData(CDOChangeSetData changeSetData) throws IOException;
+
+ public void writeCDOCommitData(CDOCommitData commitData) throws IOException;
+
+ public void writeCDOCommitInfo(CDOCommitInfo commitInfo) throws IOException;
+
+ // /////////////////////////////////////////////////////////////////////////////////////////////////
+
+ public void writeCDOID(CDOID id) throws IOException;
+
+ /**
+ * @since 4.0
+ */
+ public void writeCDOIDReference(CDOIDReference idReference) throws IOException;
+
+ /**
+ * @since 4.0
+ */
+ public void writeCDOIDAndVersion(CDOIDAndVersion idAndVersion) throws IOException;
+
+ /**
+ * @since 4.0
+ */
+ public void writeCDOIDAndBranch(CDOIDAndBranch idAndBranch) throws IOException;
+
+ // /////////////////////////////////////////////////////////////////////////////////////////////////
+
+ public void writeCDORevisionKey(CDORevisionKey revisionKey) throws IOException;
+
+ public void writeCDORevision(CDORevision revision, int referenceChunk) throws IOException;
+
+ /**
+ * @since 4.0
+ */
+ public void writeCDORevisable(CDORevisable revisable) throws IOException;
+
+ public void writeCDOList(EClass owner, EStructuralFeature feature, CDOList list, int referenceChunk)
+ throws IOException;
+
+ public void writeCDOFeatureValue(EStructuralFeature feature, Object value) throws IOException;
+
+ public void writeCDORevisionDelta(CDORevisionDelta revisionDelta) throws IOException;
+
+ public void writeCDOFeatureDelta(EClass owner, CDOFeatureDelta featureDelta) throws IOException;
+
+ /**
+ * Write either a CDORevision or a primitive value.
+ */
+ public void writeCDORevisionOrPrimitive(Object value) throws IOException;
+
+ /**
+ * Write either a CDORevision, a primitive value or a EClass.
+ */
+ public void writeCDORevisionOrPrimitiveOrClassifier(Object value) throws IOException;
+
+ // /////////////////////////////////////////////////////////////////////////////////////////////////
+
+ public void writeCDOLockType(LockType lockType) throws IOException;
+
+ /**
+ * @since 4.1
+ */
+ public void writeCDOLockChangeInfo(CDOLockChangeInfo lockChangeInfo) throws IOException;
+
+ /**
+ * @since 4.1
+ */
+ public void writeCDOLockState(CDOLockState lockState) throws IOException;
+
+ /**
+ * @since 4.1
+ */
+ public void writeCDOLockOwner(CDOLockOwner lockOwner) throws IOException;
+
+ /**
+ * @since 4.1
+ */
+ public void writeCDOLockArea(LockArea lockArea) throws IOException;
+}
diff --git a/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/common/protocol/CDOProtocol.java b/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/common/protocol/CDOProtocol.java
index c23231e8d4..b67dca234f 100644
--- a/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/common/protocol/CDOProtocol.java
+++ b/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/common/protocol/CDOProtocol.java
@@ -1,28 +1,28 @@
-/*
- * Copyright (c) 2004 - 2011 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.protocol;
-
-import org.eclipse.emf.cdo.common.CDOCommonSession;
-
-/**
- * The communications protocol associated with a CDO {@link CDOCommonSession session}.
- *
- * @author Eike Stepper
- * @since 2.0
- * @noextend This interface is not intended to be extended by clients.
- * @noimplement This interface is not intended to be implemented by clients.
- * @apiviz.uses {@link CDODataInput}
- * @apiviz.uses {@link CDODataOutput}
- */
-public interface CDOProtocol
-{
- public CDOCommonSession getSession();
-}
+/*
+ * Copyright (c) 2004 - 2012 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.protocol;
+
+import org.eclipse.emf.cdo.common.CDOCommonSession;
+
+/**
+ * The communications protocol associated with a CDO {@link CDOCommonSession session}.
+ *
+ * @author Eike Stepper
+ * @since 2.0
+ * @noextend This interface is not intended to be extended by clients.
+ * @noimplement This interface is not intended to be implemented by clients.
+ * @apiviz.uses {@link CDODataInput}
+ * @apiviz.uses {@link CDODataOutput}
+ */
+public interface CDOProtocol
+{
+ public CDOCommonSession getSession();
+}
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 260b3f764c..d23efa66c5 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
@@ -1,337 +1,337 @@
-/*
- * Copyright (c) 2004 - 2011 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 - bug 230832
- * Simon McDuff - bug 233490
- * Simon McDuff - bug 213402
- */
-package org.eclipse.emf.cdo.common.protocol;
-
-/**
- * Symbolic protocol constants commonly used in CDO.
- *
- * @author Eike Stepper
- * @since 2.0
- * @noextend This interface is not intended to be extended by clients.
- * @noimplement This interface is not intended to be implemented by clients.
- */
-public interface CDOProtocolConstants
-{
- public static final String PROTOCOL_NAME = "cdo"; //$NON-NLS-1$
-
- // //////////////////////////////////////////////////////////////////////
- // Signal IDs
-
- public static final short SIGNAL_OPEN_SESSION = 1;
-
- public static final short SIGNAL_AUTHENTICATION = 2;
-
- /**
- * @since 3.0
- */
- public static final short SIGNAL_OPEN_VIEW = 3;
-
- /**
- * @since 4.0
- */
- public static final short SIGNAL_SWITCH_TARGET = 4;
-
- /**
- * @since 3.0
- */
- public static final short SIGNAL_CLOSE_VIEW = 5;
-
- public static final short SIGNAL_LOAD_PACKAGES = 6;
-
- /**
- * @since 3.0
- */
- public static final short SIGNAL_LOAD_REVISIONS = 7;
-
- public static final short SIGNAL_LOAD_REVISION_BY_VERSION = 8;
-
- public static final short SIGNAL_LOAD_CHUNK = 9;
-
- public static final short SIGNAL_COMMIT_NOTIFICATION = 10;
-
- public static final short SIGNAL_COMMIT_TRANSACTION = 11;
-
- /**
- * @since 3.0
- */
- public static final short SIGNAL_COMMIT_DELEGATION = 12;
-
- /**
- * @since 3.0
- */
- public static final short SIGNAL_XA_COMMIT_TRANSACTION_PHASE1 = 13;
-
- /**
- * @since 3.0
- */
- public static final short SIGNAL_XA_COMMIT_TRANSACTION_PHASE2 = 14;
-
- /**
- * @since 3.0
- */
- public static final short SIGNAL_XA_COMMIT_TRANSACTION_PHASE3 = 15;
-
- /**
- * @since 3.0
- */
- public static final short SIGNAL_XA_COMMIT_TRANSACTION_CANCEL = 16;
-
- public static final short SIGNAL_QUERY = 17;
-
- public static final short SIGNAL_QUERY_CANCEL = 18;
-
- /**
- * @since 3.0
- */
- public static final short SIGNAL_REFRESH_SESSION = 19;
-
- /**
- * @since 3.0
- */
- public static final short SIGNAL_DISABLE_PASSIVE_UPDATE = 20;
-
- /**
- * @since 3.0
- */
- public static final short SIGNAL_SET_PASSIVE_UPDATE_MODE = 21;
-
- public static final short SIGNAL_CHANGE_SUBSCRIPTION = 22;
-
- public static final short SIGNAL_REPOSITORY_TIME = 23;
-
- public static final short SIGNAL_LOCK_OBJECTS = 24;
-
- public static final short SIGNAL_UNLOCK_OBJECTS = 25;
-
- public static final short SIGNAL_OBJECT_LOCKED = 26;
-
- /**
- * @since 4.0
- */
- public static final short SIGNAL_LOCK_AREA = 27;
-
- public static final short SIGNAL_GET_REMOTE_SESSIONS = 28;
-
- /**
- * @since 3.0
- */
- public static final short SIGNAL_REMOTE_MESSAGE = 29;
-
- /**
- * @since 3.0
- */
- public static final short SIGNAL_REMOTE_MESSAGE_NOTIFICATION = 30;
-
- public static final short SIGNAL_UNSUBSCRIBE_REMOTE_SESSIONS = 31;
-
- public static final short SIGNAL_REMOTE_SESSION_NOTIFICATION = 32;
-
- /**
- * @since 3.0
- */
- public static final short SIGNAL_CREATE_BRANCH = 33;
-
- /**
- * @since 3.0
- */
- public static final short SIGNAL_LOAD_BRANCH = 34;
-
- /**
- * @since 3.0
- */
- public static final short SIGNAL_LOAD_SUB_BRANCHES = 35;
-
- /**
- * @since 3.0
- */
- public static final short SIGNAL_LOAD_BRANCHES = 36;
-
- /**
- * @since 3.0
- */
- public static final short SIGNAL_REPOSITORY_TYPE_NOTIFICATION = 37;
-
- /**
- * @since 3.0
- */
- public static final short SIGNAL_REPOSITORY_STATE_NOTIFICATION = 38;
-
- /**
- * @since 3.0
- */
- public static final short SIGNAL_BRANCH_NOTIFICATION = 39;
-
- /**
- * @since 3.0
- */
- public static final short SIGNAL_LOAD_COMMIT_INFOS = 40;
-
- /**
- * @since 3.0
- */
- public static final short SIGNAL_LOAD_COMMIT_DATA = 41;
-
- /**
- * @since 3.0
- */
- public static final short SIGNAL_REPLICATE_REPOSITORY = 42;
-
- /**
- * @since 3.0
- */
- public static final short SIGNAL_REPLICATE_REPOSITORY_RAW = 43;
-
- /**
- * @since 3.0
- */
- public static final short SIGNAL_LOAD_CHANGE_SETS = 44;
-
- /**
- * @since 3.0
- */
- public static final short SIGNAL_LOAD_MERGE_DATA = 45;
-
- /**
- * @since 4.0
- */
- public static final short SIGNAL_QUERY_LOBS = 46;
-
- /**
- * @since 4.0
- */
- public static final short SIGNAL_LOAD_LOB = 47;
-
- /**
- * @since 4.0
- */
- public static final short SIGNAL_HANDLE_REVISIONS = 48;
-
- /**
- * @since 4.1
- */
- public static final short SIGNAL_LOCK_DELEGATION = 49;
-
- /**
- * @since 4.1
- */
- public static final short SIGNAL_UNLOCK_DELEGATION = 50;
-
- /**
- * @since 4.1
- */
- public static final short SIGNAL_LOCK_NOTIFICATION = 51;
-
- /**
- * @since 4.1
- */
- public static final short SIGNAL_LOCK_STATE = 52;
-
- /**
- * @since 4.1
- */
- public static final short SIGNAL_ENABLE_LOCK_NOTIFICATION = 53;
-
- /**
- * @since 4.1
- */
- public static final short SIGNAL_SET_LOCK_NOTIFICATION_MODE = 54;
-
- // //////////////////////////////////////////////////////////////////////
- // Session Refresh
-
- /**
- * @since 3.0
- */
- public static final byte REFRESH_FINISHED = 0;
-
- /**
- * @since 3.0
- */
- public static final byte REFRESH_PACKAGE_UNIT = 1;
-
- /**
- * @since 3.0
- */
- public static final byte REFRESH_CHANGED_OBJECT = 2;
-
- /**
- * @since 3.0
- */
- public static final byte REFRESH_DETACHED_OBJECT = 3;
-
- // //////////////////////////////////////////////////////////////////////
- // Query Support
-
- public static final String QUERY_LANGUAGE_RESOURCES = "resources"; //$NON-NLS-1$
-
- public static final String QUERY_LANGUAGE_RESOURCES_FOLDER_ID = "folder"; //$NON-NLS-1$
-
- public static final String QUERY_LANGUAGE_RESOURCES_EXACT_MATCH = "exactMatch"; //$NON-NLS-1$
-
- /**
- * @since 3.0
- */
- public static final String QUERY_LANGUAGE_XREFS = "xrefs"; //$NON-NLS-1$
-
- /**
- * @since 3.0
- */
- public static final String QUERY_LANGUAGE_XREFS_SOURCE_REFERENCES = "sourceReferences"; //$NON-NLS-1$
-
- // //////////////////////////////////////////////////////////////////////
- // Locking Objects
-
- public static final int RELEASE_ALL_LOCKS = -1;
-
- // //////////////////////////////////////////////////////////////////////
- // Remote Sessions
-
- public static final int NO_MORE_REMOTE_SESSIONS = -1;
-
- public static final byte REMOTE_SESSION_OPENED = 1;
-
- public static final byte REMOTE_SESSION_CLOSED = 2;
-
- public static final byte REMOTE_SESSION_SUBSCRIBED = 3;
-
- public static final byte REMOTE_SESSION_UNSUBSCRIBED = 4;
-
- /**
- * @since 3.0
- */
- public static final byte REMOTE_SESSION_CUSTOM_DATA = 5;
-
- // //////////////////////////////////////////////////////////////////////
- // Syncing
-
- /**
- * @since 3.0
- */
- public static final byte REPLICATE_FINISHED = 0;
-
- /**
- * @since 3.0
- */
- public static final byte REPLICATE_BRANCH = 1;
-
- /**
- * @since 3.0
- */
- public static final byte REPLICATE_COMMIT = 2;
-
- /**
- * @since 4.1
- */
- public static final byte REPLICATE_LOCKAREA = 3;
-}
+/*
+ * Copyright (c) 2004 - 2012 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 - bug 230832
+ * Simon McDuff - bug 233490
+ * Simon McDuff - bug 213402
+ */
+package org.eclipse.emf.cdo.common.protocol;
+
+/**
+ * Symbolic protocol constants commonly used in CDO.
+ *
+ * @author Eike Stepper
+ * @since 2.0
+ * @noextend This interface is not intended to be extended by clients.
+ * @noimplement This interface is not intended to be implemented by clients.
+ */
+public interface CDOProtocolConstants
+{
+ public static final String PROTOCOL_NAME = "cdo"; //$NON-NLS-1$
+
+ // //////////////////////////////////////////////////////////////////////
+ // Signal IDs
+
+ public static final short SIGNAL_OPEN_SESSION = 1;
+
+ public static final short SIGNAL_AUTHENTICATION = 2;
+
+ /**
+ * @since 3.0
+ */
+ public static final short SIGNAL_OPEN_VIEW = 3;
+
+ /**
+ * @since 4.0
+ */
+ public static final short SIGNAL_SWITCH_TARGET = 4;
+
+ /**
+ * @since 3.0
+ */
+ public static final short SIGNAL_CLOSE_VIEW = 5;
+
+ public static final short SIGNAL_LOAD_PACKAGES = 6;
+
+ /**
+ * @since 3.0
+ */
+ public static final short SIGNAL_LOAD_REVISIONS = 7;
+
+ public static final short SIGNAL_LOAD_REVISION_BY_VERSION = 8;
+
+ public static final short SIGNAL_LOAD_CHUNK = 9;
+
+ public static final short SIGNAL_COMMIT_NOTIFICATION = 10;
+
+ public static final short SIGNAL_COMMIT_TRANSACTION = 11;
+
+ /**
+ * @since 3.0
+ */
+ public static final short SIGNAL_COMMIT_DELEGATION = 12;
+
+ /**
+ * @since 3.0
+ */
+ public static final short SIGNAL_XA_COMMIT_TRANSACTION_PHASE1 = 13;
+
+ /**
+ * @since 3.0
+ */
+ public static final short SIGNAL_XA_COMMIT_TRANSACTION_PHASE2 = 14;
+
+ /**
+ * @since 3.0
+ */
+ public static final short SIGNAL_XA_COMMIT_TRANSACTION_PHASE3 = 15;
+
+ /**
+ * @since 3.0
+ */
+ public static final short SIGNAL_XA_COMMIT_TRANSACTION_CANCEL = 16;
+
+ public static final short SIGNAL_QUERY = 17;
+
+ public static final short SIGNAL_QUERY_CANCEL = 18;
+
+ /**
+ * @since 3.0
+ */
+ public static final short SIGNAL_REFRESH_SESSION = 19;
+
+ /**
+ * @since 3.0
+ */
+ public static final short SIGNAL_DISABLE_PASSIVE_UPDATE = 20;
+
+ /**
+ * @since 3.0
+ */
+ public static final short SIGNAL_SET_PASSIVE_UPDATE_MODE = 21;
+
+ public static final short SIGNAL_CHANGE_SUBSCRIPTION = 22;
+
+ public static final short SIGNAL_REPOSITORY_TIME = 23;
+
+ public static final short SIGNAL_LOCK_OBJECTS = 24;
+
+ public static final short SIGNAL_UNLOCK_OBJECTS = 25;
+
+ public static final short SIGNAL_OBJECT_LOCKED = 26;
+
+ /**
+ * @since 4.0
+ */
+ public static final short SIGNAL_LOCK_AREA = 27;
+
+ public static final short SIGNAL_GET_REMOTE_SESSIONS = 28;
+
+ /**
+ * @since 3.0
+ */
+ public static final short SIGNAL_REMOTE_MESSAGE = 29;
+
+ /**
+ * @since 3.0
+ */
+ public static final short SIGNAL_REMOTE_MESSAGE_NOTIFICATION = 30;
+
+ public static final short SIGNAL_UNSUBSCRIBE_REMOTE_SESSIONS = 31;
+
+ public static final short SIGNAL_REMOTE_SESSION_NOTIFICATION = 32;
+
+ /**
+ * @since 3.0
+ */
+ public static final short SIGNAL_CREATE_BRANCH = 33;
+
+ /**
+ * @since 3.0
+ */
+ public static final short SIGNAL_LOAD_BRANCH = 34;
+
+ /**
+ * @since 3.0
+ */
+ public static final short SIGNAL_LOAD_SUB_BRANCHES = 35;
+
+ /**
+ * @since 3.0
+ */
+ public static final short SIGNAL_LOAD_BRANCHES = 36;
+
+ /**
+ * @since 3.0
+ */
+ public static final short SIGNAL_REPOSITORY_TYPE_NOTIFICATION = 37;
+
+ /**
+ * @since 3.0
+ */
+ public static final short SIGNAL_REPOSITORY_STATE_NOTIFICATION = 38;
+
+ /**
+ * @since 3.0
+ */
+ public static final short SIGNAL_BRANCH_NOTIFICATION = 39;
+
+ /**
+ * @since 3.0
+ */
+ public static final short SIGNAL_LOAD_COMMIT_INFOS = 40;
+
+ /**
+ * @since 3.0
+ */
+ public static final short SIGNAL_LOAD_COMMIT_DATA = 41;
+
+ /**
+ * @since 3.0
+ */
+ public static final short SIGNAL_REPLICATE_REPOSITORY = 42;
+
+ /**
+ * @since 3.0
+ */
+ public static final short SIGNAL_REPLICATE_REPOSITORY_RAW = 43;
+
+ /**
+ * @since 3.0
+ */
+ public static final short SIGNAL_LOAD_CHANGE_SETS = 44;
+
+ /**
+ * @since 3.0
+ */
+ public static final short SIGNAL_LOAD_MERGE_DATA = 45;
+
+ /**
+ * @since 4.0
+ */
+ public static final short SIGNAL_QUERY_LOBS = 46;
+
+ /**
+ * @since 4.0
+ */
+ public static final short SIGNAL_LOAD_LOB = 47;
+
+ /**
+ * @since 4.0
+ */
+ public static final short SIGNAL_HANDLE_REVISIONS = 48;
+
+ /**
+ * @since 4.1
+ */
+ public static final short SIGNAL_LOCK_DELEGATION = 49;
+
+ /**
+ * @since 4.1
+ */
+ public static final short SIGNAL_UNLOCK_DELEGATION = 50;
+
+ /**
+ * @since 4.1
+ */
+ public static final short SIGNAL_LOCK_NOTIFICATION = 51;
+
+ /**
+ * @since 4.1
+ */
+ public static final short SIGNAL_LOCK_STATE = 52;
+
+ /**
+ * @since 4.1
+ */
+ public static final short SIGNAL_ENABLE_LOCK_NOTIFICATION = 53;
+
+ /**
+ * @since 4.1
+ */
+ public static final short SIGNAL_SET_LOCK_NOTIFICATION_MODE = 54;
+
+ // //////////////////////////////////////////////////////////////////////
+ // Session Refresh
+
+ /**
+ * @since 3.0
+ */
+ public static final byte REFRESH_FINISHED = 0;
+
+ /**
+ * @since 3.0
+ */
+ public static final byte REFRESH_PACKAGE_UNIT = 1;
+
+ /**
+ * @since 3.0
+ */
+ public static final byte REFRESH_CHANGED_OBJECT = 2;
+
+ /**
+ * @since 3.0
+ */
+ public static final byte REFRESH_DETACHED_OBJECT = 3;
+
+ // //////////////////////////////////////////////////////////////////////
+ // Query Support
+
+ public static final String QUERY_LANGUAGE_RESOURCES = "resources"; //$NON-NLS-1$
+
+ public static final String QUERY_LANGUAGE_RESOURCES_FOLDER_ID = "folder"; //$NON-NLS-1$
+
+ public static final String QUERY_LANGUAGE_RESOURCES_EXACT_MATCH = "exactMatch"; //$NON-NLS-1$
+
+ /**
+ * @since 3.0
+ */
+ public static final String QUERY_LANGUAGE_XREFS = "xrefs"; //$NON-NLS-1$
+
+ /**
+ * @since 3.0
+ */
+ public static final String QUERY_LANGUAGE_XREFS_SOURCE_REFERENCES = "sourceReferences"; //$NON-NLS-1$
+
+ // //////////////////////////////////////////////////////////////////////
+ // Locking Objects
+
+ public static final int RELEASE_ALL_LOCKS = -1;
+
+ // //////////////////////////////////////////////////////////////////////
+ // Remote Sessions
+
+ public static final int NO_MORE_REMOTE_SESSIONS = -1;
+
+ public static final byte REMOTE_SESSION_OPENED = 1;
+
+ public static final byte REMOTE_SESSION_CLOSED = 2;
+
+ public static final byte REMOTE_SESSION_SUBSCRIBED = 3;
+
+ public static final byte REMOTE_SESSION_UNSUBSCRIBED = 4;
+
+ /**
+ * @since 3.0
+ */
+ public static final byte REMOTE_SESSION_CUSTOM_DATA = 5;
+
+ // //////////////////////////////////////////////////////////////////////
+ // Syncing
+
+ /**
+ * @since 3.0
+ */
+ public static final byte REPLICATE_FINISHED = 0;
+
+ /**
+ * @since 3.0
+ */
+ public static final byte REPLICATE_BRANCH = 1;
+
+ /**
+ * @since 3.0
+ */
+ public static final byte REPLICATE_COMMIT = 2;
+
+ /**
+ * @since 4.1
+ */
+ public static final byte REPLICATE_LOCKAREA = 3;
+}
diff --git a/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/common/protocol/package-info.java b/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/common/protocol/package-info.java
index aa7b150166..cdc5429d8a 100644
--- a/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/common/protocol/package-info.java
+++ b/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/common/protocol/package-info.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2004 - 2011 Eike Stepper (Berlin, Germany) and others.
+ * Copyright (c) 2004 - 2012 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
diff --git a/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/common/revision/CDOAllRevisionsProvider.java b/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/common/revision/CDOAllRevisionsProvider.java
index a94148929f..82768439d4 100644
--- a/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/common/revision/CDOAllRevisionsProvider.java
+++ b/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/common/revision/CDOAllRevisionsProvider.java
@@ -1,28 +1,28 @@
-/*
- * Copyright (c) 2004 - 2011 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.revision;
-
-import org.eclipse.emf.cdo.common.branch.CDOBranch;
-
-import java.util.List;
-import java.util.Map;
-
-/**
- * Provides consumers with all {@link CDORevision revisions} available in an instance of this interface.
- *
- * @author Eike Stepper
- * @since 3.0
- * @apiviz.exclude
- */
-public interface CDOAllRevisionsProvider
-{
- public Map<CDOBranch, List<CDORevision>> getAllRevisions();
-}
+/*
+ * Copyright (c) 2004 - 2012 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.revision;
+
+import org.eclipse.emf.cdo.common.branch.CDOBranch;
+
+import java.util.List;
+import java.util.Map;
+
+/**
+ * Provides consumers with all {@link CDORevision revisions} available in an instance of this interface.
+ *
+ * @author Eike Stepper
+ * @since 3.0
+ * @apiviz.exclude
+ */
+public interface CDOAllRevisionsProvider
+{
+ public Map<CDOBranch, List<CDORevision>> getAllRevisions();
+}
diff --git a/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/common/revision/CDOElementProxy.java b/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/common/revision/CDOElementProxy.java
index 3865b4b7db..4fe98a5d37 100644
--- a/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/common/revision/CDOElementProxy.java
+++ b/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/common/revision/CDOElementProxy.java
@@ -1,25 +1,25 @@
-/*
- * Copyright (c) 2004 - 2011 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 - maintenance
- */
-package org.eclipse.emf.cdo.common.revision;
-
-/**
- * A moveable placeholder for the element of a {@link CDOList list} at a specified {@link #getIndex() index}.
- *
- * @author Eike Stepper
- * @since 4.0
- * @noextend This interface is not intended to be extended by clients.
- * @noimplement This interface is not intended to be implemented by clients.
- */
-public interface CDOElementProxy
-{
- public int getIndex();
-}
+/*
+ * Copyright (c) 2004 - 2012 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 - maintenance
+ */
+package org.eclipse.emf.cdo.common.revision;
+
+/**
+ * A moveable placeholder for the element of a {@link CDOList list} at a specified {@link #getIndex() index}.
+ *
+ * @author Eike Stepper
+ * @since 4.0
+ * @noextend This interface is not intended to be extended by clients.
+ * @noimplement This interface is not intended to be implemented by clients.
+ */
+public interface CDOElementProxy
+{
+ public int getIndex();
+}
diff --git a/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/common/revision/CDOIDAndBranch.java b/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/common/revision/CDOIDAndBranch.java
index f1e295e308..a187a22891 100644
--- a/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/common/revision/CDOIDAndBranch.java
+++ b/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/common/revision/CDOIDAndBranch.java
@@ -1,30 +1,30 @@
-/*
- * Copyright (c) 2004 - 2011 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.revision;
-
-import org.eclipse.emf.cdo.common.branch.CDOBranch;
-import org.eclipse.emf.cdo.common.id.CDOID;
-
-/**
- * An {@link CDOID ID} / {@link CDOBranch branch} pair.
- *
- * @author Eike Stepper
- * @since 4.0
- * @noextend This interface is not intended to be extended by clients.
- * @noimplement This interface is not intended to be implemented by clients.
- * @apiviz.exclude
- */
-public interface CDOIDAndBranch
-{
- public CDOID getID();
-
- public CDOBranch getBranch();
-}
+/*
+ * Copyright (c) 2004 - 2012 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.revision;
+
+import org.eclipse.emf.cdo.common.branch.CDOBranch;
+import org.eclipse.emf.cdo.common.id.CDOID;
+
+/**
+ * An {@link CDOID ID} / {@link CDOBranch branch} pair.
+ *
+ * @author Eike Stepper
+ * @since 4.0
+ * @noextend This interface is not intended to be extended by clients.
+ * @noimplement This interface is not intended to be implemented by clients.
+ * @apiviz.exclude
+ */
+public interface CDOIDAndBranch
+{
+ public CDOID getID();
+
+ public CDOBranch getBranch();
+}
diff --git a/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/common/revision/CDOIDAndVersion.java b/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/common/revision/CDOIDAndVersion.java
index 1bce44a0f7..14d6b87d4b 100644
--- a/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/common/revision/CDOIDAndVersion.java
+++ b/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/common/revision/CDOIDAndVersion.java
@@ -1,28 +1,28 @@
-/*
- * Copyright (c) 2004 - 2011 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.revision;
-
-import org.eclipse.emf.cdo.common.id.CDOID;
-
-/**
- * An {@link CDOID ID} / version pair.
- *
- * @author Eike Stepper
- * @since 4.0
- * @noextend This interface is not intended to be extended by clients.
- * @noimplement This interface is not intended to be implemented by clients.
- */
-public interface CDOIDAndVersion
-{
- public CDOID getID();
-
- public int getVersion();
-}
+/*
+ * Copyright (c) 2004 - 2012 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.revision;
+
+import org.eclipse.emf.cdo.common.id.CDOID;
+
+/**
+ * An {@link CDOID ID} / version pair.
+ *
+ * @author Eike Stepper
+ * @since 4.0
+ * @noextend This interface is not intended to be extended by clients.
+ * @noimplement This interface is not intended to be implemented by clients.
+ */
+public interface CDOIDAndVersion
+{
+ public CDOID getID();
+
+ public int getVersion();
+}
diff --git a/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/common/revision/CDOList.java b/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/common/revision/CDOList.java
index 12c0870bcf..0b9b27df27 100644
--- a/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/common/revision/CDOList.java
+++ b/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/common/revision/CDOList.java
@@ -1,41 +1,41 @@
-/*
- * Copyright (c) 2004 - 2011 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.revision;
-
-import org.eclipse.net4j.util.collection.MoveableList;
-
-import org.eclipse.emf.common.util.EList;
-
-/**
- * A {@link MoveableList moveable} {@link EList}.
- *
- * @author Simon McDuff
- * @since 2.0
- * @noextend This interface is not intended to be extended by clients.
- * @noimplement This interface is not intended to be implemented by clients.
- * @apiviz.uses {@link CDOElementProxy} - - contains
- */
-public interface CDOList extends MoveableList<Object>, EList<Object>
-{
- /**
- * Returns the element at position index of this list and optionally resolves proxies (see CDOElementProxy).
- * <p>
- *
- * @param index
- * The position of the element to return from this list.
- * @param resolve
- * A value of <code>false</code> indicates that {@link CDORevisionUtil#UNINITIALIZED} may be returned for
- * unresolved elements. A value of <code>true</code> indicates that it should behave identical to
- * {@link CDOList#get(int)}.
- */
- public Object get(int index, boolean resolve);
-}
+/*
+ * Copyright (c) 2004 - 2012 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.revision;
+
+import org.eclipse.net4j.util.collection.MoveableList;
+
+import org.eclipse.emf.common.util.EList;
+
+/**
+ * A {@link MoveableList moveable} {@link EList}.
+ *
+ * @author Simon McDuff
+ * @since 2.0
+ * @noextend This interface is not intended to be extended by clients.
+ * @noimplement This interface is not intended to be implemented by clients.
+ * @apiviz.uses {@link CDOElementProxy} - - contains
+ */
+public interface CDOList extends MoveableList<Object>, EList<Object>
+{
+ /**
+ * Returns the element at position index of this list and optionally resolves proxies (see CDOElementProxy).
+ * <p>
+ *
+ * @param index
+ * The position of the element to return from this list.
+ * @param resolve
+ * A value of <code>false</code> indicates that {@link CDORevisionUtil#UNINITIALIZED} may be returned for
+ * unresolved elements. A value of <code>true</code> indicates that it should behave identical to
+ * {@link CDOList#get(int)}.
+ */
+ public Object get(int index, boolean resolve);
+}
diff --git a/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/common/revision/CDOListFactory.java b/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/common/revision/CDOListFactory.java
index 96542128c8..f67b58a5e0 100644
--- a/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/common/revision/CDOListFactory.java
+++ b/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/common/revision/CDOListFactory.java
@@ -1,28 +1,28 @@
-/*
- * Copyright (c) 2004 - 2011 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.revision;
-
-import org.eclipse.emf.cdo.internal.common.revision.CDOListImpl;
-
-/**
- * Creates {@link CDOList list} instances.
- *
- * @author Simon McDuff
- * @since 2.0
- * @apiviz.uses {@link CDOList} - - creates
- */
-public interface CDOListFactory
-{
- public static final CDOListFactory DEFAULT = CDOListImpl.FACTORY;
-
- public CDOList createList(int intitialCapacity, int size, int initialChunk);
-}
+/*
+ * Copyright (c) 2004 - 2012 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.revision;
+
+import org.eclipse.emf.cdo.internal.common.revision.CDOListImpl;
+
+/**
+ * Creates {@link CDOList list} instances.
+ *
+ * @author Simon McDuff
+ * @since 2.0
+ * @apiviz.uses {@link CDOList} - - creates
+ */
+public interface CDOListFactory
+{
+ public static final CDOListFactory DEFAULT = CDOListImpl.FACTORY;
+
+ public CDOList createList(int intitialCapacity, int size, int initialChunk);
+}
diff --git a/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/common/revision/CDOListResolver.java b/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/common/revision/CDOListResolver.java
index cec257d209..98b15be4b2 100644
--- a/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/common/revision/CDOListResolver.java
+++ b/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/common/revision/CDOListResolver.java
@@ -1,37 +1,37 @@
-/*
- * Copyright (c) 2004 - 2011 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.revision;
-
-import org.eclipse.emf.cdo.common.id.CDOID;
-
-import org.eclipse.emf.ecore.EStructuralFeature;
-
-/**
- * A strategy that specifies which list elememts must be present (loaded) in a {@link CDOID} list of a
- * {@link CDORevision revision} when a certain list index is accessed. Implementations of this interface can control the
- * exact characteristics of a certain <em>partial collection loading</em> strategy.
- *
- * @author Eike Stepper
- * @since 4.0
- * @apiviz.uses {@link CDOList} - - resolves
- */
-public interface CDOListResolver
-{
- /**
- * Defines a strategy to be used when the collection needs to resolve one element.
- */
- public Object resolveProxy(CDORevision revision, EStructuralFeature feature, int accessIndex, int serverIndex);
-
- /**
- * Defines a strategy to be used when the collection needs to resolve all elements.
- */
- public void resolveAllProxies(CDORevision revision, EStructuralFeature feature);
-}
+/*
+ * Copyright (c) 2004 - 2012 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.revision;
+
+import org.eclipse.emf.cdo.common.id.CDOID;
+
+import org.eclipse.emf.ecore.EStructuralFeature;
+
+/**
+ * A strategy that specifies which list elememts must be present (loaded) in a {@link CDOID} list of a
+ * {@link CDORevision revision} when a certain list index is accessed. Implementations of this interface can control the
+ * exact characteristics of a certain <em>partial collection loading</em> strategy.
+ *
+ * @author Eike Stepper
+ * @since 4.0
+ * @apiviz.uses {@link CDOList} - - resolves
+ */
+public interface CDOListResolver
+{
+ /**
+ * Defines a strategy to be used when the collection needs to resolve one element.
+ */
+ public Object resolveProxy(CDORevision revision, EStructuralFeature feature, int accessIndex, int serverIndex);
+
+ /**
+ * Defines a strategy to be used when the collection needs to resolve all elements.
+ */
+ public void resolveAllProxies(CDORevision revision, EStructuralFeature feature);
+}
diff --git a/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/common/revision/CDORevisable.java b/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/common/revision/CDORevisable.java
index b67eda9774..0864240027 100644
--- a/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/common/revision/CDORevisable.java
+++ b/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/common/revision/CDORevisable.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2004 - 2011 Eike Stepper (Berlin, Germany) and others.
+ * Copyright (c) 2004 - 2012 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
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 ee535b97f7..cfb54d3a1d 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
@@ -1,103 +1,103 @@
-/*
- * Copyright (c) 2004 - 2011 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 - delta support
- */
-package org.eclipse.emf.cdo.common.revision;
-
-import org.eclipse.emf.cdo.common.branch.CDOBranch;
-import org.eclipse.emf.cdo.common.branch.CDOBranchPoint;
-import org.eclipse.emf.cdo.common.branch.CDOBranchVersion;
-import org.eclipse.emf.cdo.common.commit.CDOCommitInfo;
-import org.eclipse.emf.cdo.common.revision.delta.CDORevisionDelta;
-
-import org.eclipse.emf.ecore.EClass;
-import org.eclipse.emf.ecore.EObject;
-
-/**
- * Encapsulates the immutable system information of a <b>single</b> CDO {@link EObject object} between two
- * {@link CDOCommitInfo commits} in a {@link CDOBranch branch} and provides access to its modeled
- * {@link CDORevisionData data}.
- *
- * @author Eike Stepper
- * @noextend This interface is not intended to be extended by clients.
- * @noimplement This interface is not intended to be implemented by clients.
- * @apiviz.landmark
- * @apiviz.has {@link CDORevisionData}
- */
-public interface CDORevision extends CDORevisionKey, CDORevisable
-{
- /**
- * @since 3.0
- */
- public static final int MAIN_BRANCH_ID = CDOBranch.MAIN_BRANCH_ID;
-
- /**
- * @since 3.0
- */
- public static final int FIRST_VERSION = CDOBranchVersion.FIRST_VERSION;
-
- public static final int UNCHUNKED = -1;
-
- /**
- * @since 3.0
- */
- public static final int DEPTH_NONE = 0;
-
- /**
- * @since 3.0
- */
- public static final int DEPTH_INFINITE = -1;
-
- /**
- * @since 2.0
- */
- public EClass getEClass();
-
- /**
- * Returns <code>true</code> exactly if {@link #getTimeStamp()} does not return {@link #UNSPECIFIED_DATE},
- * <code>false</code> otherwise.
- *
- * @since 3.0
- */
- public boolean isHistorical();
-
- public boolean isValid(long timeStamp);
-
- /**
- * @since 4.0
- */
- public boolean isValid(CDOBranchPoint branchPoint);
-
- /**
- * @since 2.0
- */
- public boolean isResourceNode();
-
- /**
- * @since 2.0
- */
- public boolean isResourceFolder();
-
- public boolean isResource();
-
- /**
- * @since 2.0
- */
- public CDORevisionData data();
-
- public CDORevisionDelta compare(CDORevision origin);
-
- public void merge(CDORevisionDelta delta);
-
- /**
- * @since 2.0
- */
- public CDORevision copy();
-}
+/*
+ * Copyright (c) 2004 - 2012 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 - delta support
+ */
+package org.eclipse.emf.cdo.common.revision;
+
+import org.eclipse.emf.cdo.common.branch.CDOBranch;
+import org.eclipse.emf.cdo.common.branch.CDOBranchPoint;
+import org.eclipse.emf.cdo.common.branch.CDOBranchVersion;
+import org.eclipse.emf.cdo.common.commit.CDOCommitInfo;
+import org.eclipse.emf.cdo.common.revision.delta.CDORevisionDelta;
+
+import org.eclipse.emf.ecore.EClass;
+import org.eclipse.emf.ecore.EObject;
+
+/**
+ * Encapsulates the immutable system information of a <b>single</b> CDO {@link EObject object} between two
+ * {@link CDOCommitInfo commits} in a {@link CDOBranch branch} and provides access to its modeled
+ * {@link CDORevisionData data}.
+ *
+ * @author Eike Stepper
+ * @noextend This interface is not intended to be extended by clients.
+ * @noimplement This interface is not intended to be implemented by clients.
+ * @apiviz.landmark
+ * @apiviz.has {@link CDORevisionData}
+ */
+public interface CDORevision extends CDORevisionKey, CDORevisable
+{
+ /**
+ * @since 3.0
+ */
+ public static final int MAIN_BRANCH_ID = CDOBranch.MAIN_BRANCH_ID;
+
+ /**
+ * @since 3.0
+ */
+ public static final int FIRST_VERSION = CDOBranchVersion.FIRST_VERSION;
+
+ public static final int UNCHUNKED = -1;
+
+ /**
+ * @since 3.0
+ */
+ public static final int DEPTH_NONE = 0;
+
+ /**
+ * @since 3.0
+ */
+ public static final int DEPTH_INFINITE = -1;
+
+ /**
+ * @since 2.0
+ */
+ public EClass getEClass();
+
+ /**
+ * Returns <code>true</code> exactly if {@link #getTimeStamp()} does not return {@link #UNSPECIFIED_DATE},
+ * <code>false</code> otherwise.
+ *
+ * @since 3.0
+ */
+ public boolean isHistorical();
+
+ public boolean isValid(long timeStamp);
+
+ /**
+ * @since 4.0
+ */
+ public boolean isValid(CDOBranchPoint branchPoint);
+
+ /**
+ * @since 2.0
+ */
+ public boolean isResourceNode();
+
+ /**
+ * @since 2.0
+ */
+ public boolean isResourceFolder();
+
+ public boolean isResource();
+
+ /**
+ * @since 2.0
+ */
+ public CDORevisionData data();
+
+ public CDORevisionDelta compare(CDORevision origin);
+
+ public void merge(CDORevisionDelta delta);
+
+ /**
+ * @since 2.0
+ */
+ public CDORevision copy();
+}
diff --git a/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/common/revision/CDORevisionCache.java b/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/common/revision/CDORevisionCache.java
index 2211737463..7bd85e287a 100644
--- a/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/common/revision/CDORevisionCache.java
+++ b/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/common/revision/CDORevisionCache.java
@@ -1,83 +1,83 @@
-/*
- * Copyright (c) 2004 - 2011 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.revision;
-
-import org.eclipse.emf.cdo.common.branch.CDOBranchPoint;
-import org.eclipse.emf.cdo.common.branch.CDOBranchVersion;
-import org.eclipse.emf.cdo.common.id.CDOID;
-import org.eclipse.emf.cdo.internal.common.revision.NOOPRevisionCache;
-
-import org.eclipse.net4j.util.event.IEvent;
-import org.eclipse.net4j.util.event.INotifier;
-
-import org.eclipse.emf.ecore.EClass;
-
-import java.util.List;
-
-/**
- * Caches {@link CDORevision revisions} and possibly {@link EvictionEvent evicts} those that are no longer strongly
- * referenced when free memory runs low.
- *
- * @author Eike Stepper
- * @since 4.0
- * @noextend This interface is not intended to be extended by clients.
- * @noimplement This interface is not intended to be implemented by clients.
- * @apiviz.composedOf {@link CDORevision}
- */
-public interface CDORevisionCache extends CDORevisionCacheAdder, INotifier
-{
- /**
- * @since 3.0
- */
- public static final CDORevisionCache NOOP = NOOPRevisionCache.INSTANCE;
-
- public EClass getObjectType(CDOID id);
-
- /**
- * @since 3.0
- */
- public CDORevision getRevision(CDOID id, CDOBranchPoint branchPoint);
-
- /**
- * @since 3.0
- */
- public CDORevision getRevisionByVersion(CDOID id, CDOBranchVersion branchVersion);
-
- /**
- * Returns a list of {@link CDORevision revisions} that are current.
- *
- * @since 3.0
- */
- public List<CDORevision> getCurrentRevisions();
-
- /**
- * An {@link IEvent event} fired from a {@link CDORevisionCache revision cache} for {@link CDORevision revisions} that
- * are evicted because they are no longer strongly referenced when free memory runs low.
- *
- * @author Eike Stepper
- * @noextend This interface is not intended to be extended by clients.
- * @noimplement This interface is not intended to be implemented by clients.
- */
- public interface EvictionEvent extends IEvent, CDORevisionKey
- {
- /**
- * @since 3.0
- */
- public CDORevisionCache getSource();
-
- /**
- * May be <code>null</code> for certain cache implementations.
- *
- * @since 3.0
- */
- public CDORevision getRevision();
- }
-}
+/*
+ * Copyright (c) 2004 - 2012 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.revision;
+
+import org.eclipse.emf.cdo.common.branch.CDOBranchPoint;
+import org.eclipse.emf.cdo.common.branch.CDOBranchVersion;
+import org.eclipse.emf.cdo.common.id.CDOID;
+import org.eclipse.emf.cdo.internal.common.revision.NOOPRevisionCache;
+
+import org.eclipse.net4j.util.event.IEvent;
+import org.eclipse.net4j.util.event.INotifier;
+
+import org.eclipse.emf.ecore.EClass;
+
+import java.util.List;
+
+/**
+ * Caches {@link CDORevision revisions} and possibly {@link EvictionEvent evicts} those that are no longer strongly
+ * referenced when free memory runs low.
+ *
+ * @author Eike Stepper
+ * @since 4.0
+ * @noextend This interface is not intended to be extended by clients.
+ * @noimplement This interface is not intended to be implemented by clients.
+ * @apiviz.composedOf {@link CDORevision}
+ */
+public interface CDORevisionCache extends CDORevisionCacheAdder, INotifier
+{
+ /**
+ * @since 3.0
+ */
+ public static final CDORevisionCache NOOP = NOOPRevisionCache.INSTANCE;
+
+ public EClass getObjectType(CDOID id);
+
+ /**
+ * @since 3.0
+ */
+ public CDORevision getRevision(CDOID id, CDOBranchPoint branchPoint);
+
+ /**
+ * @since 3.0
+ */
+ public CDORevision getRevisionByVersion(CDOID id, CDOBranchVersion branchVersion);
+
+ /**
+ * Returns a list of {@link CDORevision revisions} that are current.
+ *
+ * @since 3.0
+ */
+ public List<CDORevision> getCurrentRevisions();
+
+ /**
+ * An {@link IEvent event} fired from a {@link CDORevisionCache revision cache} for {@link CDORevision revisions} that
+ * are evicted because they are no longer strongly referenced when free memory runs low.
+ *
+ * @author Eike Stepper
+ * @noextend This interface is not intended to be extended by clients.
+ * @noimplement This interface is not intended to be implemented by clients.
+ */
+ public interface EvictionEvent extends IEvent, CDORevisionKey
+ {
+ /**
+ * @since 3.0
+ */
+ public CDORevisionCache getSource();
+
+ /**
+ * May be <code>null</code> for certain cache implementations.
+ *
+ * @since 3.0
+ */
+ public CDORevision getRevision();
+ }
+}
diff --git a/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/common/revision/CDORevisionCacheAdder.java b/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/common/revision/CDORevisionCacheAdder.java
index e517a00da6..cb002b5e3b 100644
--- a/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/common/revision/CDORevisionCacheAdder.java
+++ b/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/common/revision/CDORevisionCacheAdder.java
@@ -1,27 +1,27 @@
-/*
- * Copyright (c) 2004 - 2011 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.revision;
-
-/**
- * An entity that {@link CDORevision revisions} can be added to.
- *
- * @author Eike Stepper
- * @since 4.0
- * @noextend This interface is not intended to be extended by clients.
- * @noimplement This interface is not intended to be implemented by clients.
- */
-public interface CDORevisionCacheAdder
-{
- /**
- * Adds the given revision to this cache.
- */
- public void addRevision(CDORevision revision);
-}
+/*
+ * Copyright (c) 2004 - 2012 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.revision;
+
+/**
+ * An entity that {@link CDORevision revisions} can be added to.
+ *
+ * @author Eike Stepper
+ * @since 4.0
+ * @noextend This interface is not intended to be extended by clients.
+ * @noimplement This interface is not intended to be implemented by clients.
+ */
+public interface CDORevisionCacheAdder
+{
+ /**
+ * Adds the given revision to this cache.
+ */
+ public void addRevision(CDORevision revision);
+}
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 6dbf2b0f53..d38a2740b5 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
@@ -1,112 +1,112 @@
-/*
- * Copyright (c) 2004 - 2011 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.revision;
-
-import org.eclipse.emf.cdo.common.id.CDOID;
-
-import org.eclipse.emf.ecore.EStructuralFeature;
-import org.eclipse.emf.ecore.impl.BasicEObjectImpl;
-import org.eclipse.emf.ecore.impl.EStoreEObjectImpl;
-
-/**
- * Encapsulates the modeled information and the EMF system values of a {@link CDORevision revision}.
- *
- * @author Eike Stepper
- * @noextend This interface is not intended to be extended by clients.
- * @noimplement This interface is not intended to be implemented by clients.
- */
-public interface CDORevisionData
-{
- /**
- * The equivalent of <code>EStructuralFeatureImpl.NIL</code> (i.e. explicit <code>null</code>).
- *
- * @since 3.0
- */
- public static final Object NIL = EStoreEObjectImpl.NIL;
-
- /**
- * @since 2.0
- */
- public CDORevision revision();
-
- public CDOID getResourceID();
-
- /**
- * @since 2.0
- */
- public Object getContainerID();
-
- /**
- * Provides the input to the calculation of the feature in the container revision that actually holds this revision.
- * <p>
- * <b>Usage Example:</b>
- * <p>
- * <code><pre>
- * CDORevision revision = ...;
- * CDORevision container = <i>Util.getRevision</i>(revision.data().getContainerID());
- *
- * int containingFeatureID = revision.data().getContainingFeatureID();
- *
- * EStructuralFeature feature = containingFeatureID <= InternalEObject.EOPPOSITE_FEATURE_BASE ?
- * container.getEClass().getEStructuralFeature(InternalEObject.EOPPOSITE_FEATURE_BASE - containingFeatureID) :
- * ((EReference)revision.getEClass().getEStructuralFeature(containingFeatureID)).getEOpposite();</pre></code>
- *
- * @see BasicEObjectImpl#eContainingFeature()
- * @see #getContainerID()
- */
- public int getContainingFeatureID();
-
- /**
- * @since 2.0
- */
- public Object get(EStructuralFeature feature, int index);
-
- /**
- * @since 2.0
- */
- public int size(EStructuralFeature feature);
-
- /**
- * @since 2.0
- */
- public boolean isEmpty(EStructuralFeature feature);
-
- /**
- * @since 2.0
- */
- public boolean contains(EStructuralFeature feature, Object value);
-
- /**
- * @since 2.0
- */
- public int indexOf(EStructuralFeature feature, Object value);
-
- /**
- * @since 2.0
- */
- public int lastIndexOf(EStructuralFeature feature, Object value);
-
- /**
- * @since 2.0
- */
- public <T> T[] toArray(EStructuralFeature feature, T[] array);
-
- /**
- * @since 2.0
- */
- public Object[] toArray(EStructuralFeature feature);
-
- /**
- * @since 2.0
- */
- public int hashCode(EStructuralFeature feature);
-
-}
+/*
+ * Copyright (c) 2004 - 2012 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.revision;
+
+import org.eclipse.emf.cdo.common.id.CDOID;
+
+import org.eclipse.emf.ecore.EStructuralFeature;
+import org.eclipse.emf.ecore.impl.BasicEObjectImpl;
+import org.eclipse.emf.ecore.impl.EStoreEObjectImpl;
+
+/**
+ * Encapsulates the modeled information and the EMF system values of a {@link CDORevision revision}.
+ *
+ * @author Eike Stepper
+ * @noextend This interface is not intended to be extended by clients.
+ * @noimplement This interface is not intended to be implemented by clients.
+ */
+public interface CDORevisionData
+{
+ /**
+ * The equivalent of <code>EStructuralFeatureImpl.NIL</code> (i.e. explicit <code>null</code>).
+ *
+ * @since 3.0
+ */
+ public static final Object NIL = EStoreEObjectImpl.NIL;
+
+ /**
+ * @since 2.0
+ */
+ public CDORevision revision();
+
+ public CDOID getResourceID();
+
+ /**
+ * @since 2.0
+ */
+ public Object getContainerID();
+
+ /**
+ * Provides the input to the calculation of the feature in the container revision that actually holds this revision.
+ * <p>
+ * <b>Usage Example:</b>
+ * <p>
+ * <code><pre>
+ * CDORevision revision = ...;
+ * CDORevision container = <i>Util.getRevision</i>(revision.data().getContainerID());
+ *
+ * int containingFeatureID = revision.data().getContainingFeatureID();
+ *
+ * EStructuralFeature feature = containingFeatureID <= InternalEObject.EOPPOSITE_FEATURE_BASE ?
+ * container.getEClass().getEStructuralFeature(InternalEObject.EOPPOSITE_FEATURE_BASE - containingFeatureID) :
+ * ((EReference)revision.getEClass().getEStructuralFeature(containingFeatureID)).getEOpposite();</pre></code>
+ *
+ * @see BasicEObjectImpl#eContainingFeature()
+ * @see #getContainerID()
+ */
+ public int getContainingFeatureID();
+
+ /**
+ * @since 2.0
+ */
+ public Object get(EStructuralFeature feature, int index);
+
+ /**
+ * @since 2.0
+ */
+ public int size(EStructuralFeature feature);
+
+ /**
+ * @since 2.0
+ */
+ public boolean isEmpty(EStructuralFeature feature);
+
+ /**
+ * @since 2.0
+ */
+ public boolean contains(EStructuralFeature feature, Object value);
+
+ /**
+ * @since 2.0
+ */
+ public int indexOf(EStructuralFeature feature, Object value);
+
+ /**
+ * @since 2.0
+ */
+ public int lastIndexOf(EStructuralFeature feature, Object value);
+
+ /**
+ * @since 2.0
+ */
+ public <T> T[] toArray(EStructuralFeature feature, T[] array);
+
+ /**
+ * @since 2.0
+ */
+ public Object[] toArray(EStructuralFeature feature);
+
+ /**
+ * @since 2.0
+ */
+ 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 80985dce93..a45f526117 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
@@ -1,38 +1,38 @@
-/*
- * Copyright (c) 2004 - 2011 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.revision;
-
-import org.eclipse.emf.ecore.EClass;
-
-/**
- * Creates {@link CDORevision revision} instances.
- *
- * @author Eike Stepper
- * @since 2.0
- */
-public interface CDORevisionFactory
-{
- /**
- * @since 3.0
- */
- public static final CDORevisionFactory DEFAULT = new CDORevisionFactory()
- {
- public CDORevision createRevision(EClass eClass)
- {
- return new org.eclipse.emf.cdo.internal.common.revision.CDORevisionImpl(eClass);
- }
- };
-
- /**
- * @since 3.0
- */
- public CDORevision createRevision(EClass eClass);
-}
+/*
+ * Copyright (c) 2004 - 2012 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.revision;
+
+import org.eclipse.emf.ecore.EClass;
+
+/**
+ * Creates {@link CDORevision revision} instances.
+ *
+ * @author Eike Stepper
+ * @since 2.0
+ */
+public interface CDORevisionFactory
+{
+ /**
+ * @since 3.0
+ */
+ public static final CDORevisionFactory DEFAULT = new CDORevisionFactory()
+ {
+ public CDORevision createRevision(EClass eClass)
+ {
+ return new org.eclipse.emf.cdo.internal.common.revision.CDORevisionImpl(eClass);
+ }
+ };
+
+ /**
+ * @since 3.0
+ */
+ public CDORevision createRevision(EClass eClass);
+}
diff --git a/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/common/revision/CDORevisionHandler.java b/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/common/revision/CDORevisionHandler.java
index dfbf63ba41..c51560a472 100644
--- a/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/common/revision/CDORevisionHandler.java
+++ b/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/common/revision/CDORevisionHandler.java
@@ -1,82 +1,82 @@
-/*
- * Copyright (c) 2004 - 2011 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.revision;
-
-import org.eclipse.emf.cdo.spi.common.revision.DetachedCDORevision;
-
-/**
- * A call-back interface that indicates the ability to <i>handle</i> {@link CDORevision revisions} that are passed from
- * other entities.
- *
- * @author Eike Stepper
- * @since 3.0
- */
-public interface CDORevisionHandler
-{
- /**
- * Handles a revision.
- *
- * @return <code>true</code> to indicate that the caller may pass more revisions, <code>false</code> otherwise.
- * @since 4.0
- */
- public boolean handleRevision(CDORevision revision);
-
- /**
- * A delegating {@link CDORevisionHandler revision handler} with a {@link #filter(CDORevision) filter()} method used
- * to suppress specific revisions.
- *
- * @author Eike Stepper
- * @since 4.1
- */
- public static class Filtered implements CDORevisionHandler
- {
- private final CDORevisionHandler delegate;
-
- public Filtered(CDORevisionHandler delegate)
- {
- this.delegate = delegate;
- }
-
- public final boolean handleRevision(CDORevision revision)
- {
- if (filter(revision))
- {
- return true;
- }
-
- return delegate.handleRevision(revision);
- }
-
- protected boolean filter(CDORevision revision)
- {
- return false;
- }
-
- /**
- * A delegating {@link Filtered revision handler} that filters detached revisions.
- *
- * @author Eike Stepper
- */
- public static final class Undetached extends Filtered
- {
- public Undetached(CDORevisionHandler delegate)
- {
- super(delegate);
- }
-
- @Override
- protected boolean filter(CDORevision revision)
- {
- return revision instanceof DetachedCDORevision;
- }
- }
- }
-}
+/*
+ * Copyright (c) 2004 - 2012 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.revision;
+
+import org.eclipse.emf.cdo.spi.common.revision.DetachedCDORevision;
+
+/**
+ * A call-back interface that indicates the ability to <i>handle</i> {@link CDORevision revisions} that are passed from
+ * other entities.
+ *
+ * @author Eike Stepper
+ * @since 3.0
+ */
+public interface CDORevisionHandler
+{
+ /**
+ * Handles a revision.
+ *
+ * @return <code>true</code> to indicate that the caller may pass more revisions, <code>false</code> otherwise.
+ * @since 4.0
+ */
+ public boolean handleRevision(CDORevision revision);
+
+ /**
+ * A delegating {@link CDORevisionHandler revision handler} with a {@link #filter(CDORevision) filter()} method used
+ * to suppress specific revisions.
+ *
+ * @author Eike Stepper
+ * @since 4.1
+ */
+ public static class Filtered implements CDORevisionHandler
+ {
+ private final CDORevisionHandler delegate;
+
+ public Filtered(CDORevisionHandler delegate)
+ {
+ this.delegate = delegate;
+ }
+
+ public final boolean handleRevision(CDORevision revision)
+ {
+ if (filter(revision))
+ {
+ return true;
+ }
+
+ return delegate.handleRevision(revision);
+ }
+
+ protected boolean filter(CDORevision revision)
+ {
+ return false;
+ }
+
+ /**
+ * A delegating {@link Filtered revision handler} that filters detached revisions.
+ *
+ * @author Eike Stepper
+ */
+ public static final class Undetached extends Filtered
+ {
+ public Undetached(CDORevisionHandler delegate)
+ {
+ super(delegate);
+ }
+
+ @Override
+ protected boolean filter(CDORevision revision)
+ {
+ return revision instanceof DetachedCDORevision;
+ }
+ }
+ }
+}
diff --git a/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/common/revision/CDORevisionKey.java b/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/common/revision/CDORevisionKey.java
index 64b89c765b..89a37d2987 100644
--- a/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/common/revision/CDORevisionKey.java
+++ b/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/common/revision/CDORevisionKey.java
@@ -1,26 +1,26 @@
-/*
- * Copyright (c) 2004 - 2011 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.revision;
-
-import org.eclipse.emf.cdo.common.branch.CDOBranch;
-import org.eclipse.emf.cdo.common.branch.CDOBranchVersion;
-
-/**
- * Uniquely identifies a {@link CDORevision revision} by version in a {@link CDOBranch branch}.
- *
- * @author Eike Stepper
- * @since 3.0
- * @noextend This interface is not intended to be extended by clients.
- * @noimplement This interface is not intended to be implemented by clients.
- */
-public interface CDORevisionKey extends CDOBranchVersion, CDOIDAndVersion
-{
-}
+/*
+ * Copyright (c) 2004 - 2012 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.revision;
+
+import org.eclipse.emf.cdo.common.branch.CDOBranch;
+import org.eclipse.emf.cdo.common.branch.CDOBranchVersion;
+
+/**
+ * Uniquely identifies a {@link CDORevision revision} by version in a {@link CDOBranch branch}.
+ *
+ * @author Eike Stepper
+ * @since 3.0
+ * @noextend This interface is not intended to be extended by clients.
+ * @noimplement This interface is not intended to be implemented by clients.
+ */
+public interface CDORevisionKey extends CDOBranchVersion, CDOIDAndVersion
+{
+}
diff --git a/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/common/revision/CDORevisionManager.java b/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/common/revision/CDORevisionManager.java
index 5cfc2f926e..9409d0b7db 100644
--- a/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/common/revision/CDORevisionManager.java
+++ b/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/common/revision/CDORevisionManager.java
@@ -1,171 +1,171 @@
-/*
- * Copyright (c) 2004 - 2011 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.revision;
-
-import org.eclipse.emf.cdo.common.CDOCommonRepository;
-import org.eclipse.emf.cdo.common.CDOCommonSession;
-import org.eclipse.emf.cdo.common.branch.CDOBranch;
-import org.eclipse.emf.cdo.common.branch.CDOBranchManager;
-import org.eclipse.emf.cdo.common.branch.CDOBranchPoint;
-import org.eclipse.emf.cdo.common.branch.CDOBranchVersion;
-import org.eclipse.emf.cdo.common.id.CDOID;
-
-import org.eclipse.emf.ecore.EClass;
-import org.eclipse.emf.ecore.EObject;
-
-import java.util.List;
-
-/**
- * Provides access to {@link CDORevision revisions} in a CDO {@link CDOCommonRepository repository} by demand loading
- * and caching them.
- * <p>
- * Revisions are generally queried by:
- * <p>
- * <ul>
- * <li>their object {@link CDOID ID} <b>and</b>
- * <li>their {@link CDOBranch branch} plus <b>either</b>:
- * <ul>
- * <li>a timestamp <b>or</b>
- * <li>a version
- * </ul>
- * </ul>
- * <p>
- * If querying by timestamp it's also possible to ask for multiple revisions (identified by a list of object IDs) in one
- * round trip (to the server if this revision manager is contained by a {@link CDOCommonSession session} or to the
- * backend store if it is contained by a {@link CDOCommonRepository repository}.
- *
- * @author Eike Stepper
- * @since 3.0
- * @noextend This interface is not intended to be extended by clients.
- * @noimplement This interface is not intended to be implemented by clients.
- * @apiviz.landmark
- * @apiviz.has {@link CDORevisionFactory}
- * @apiviz.has {@link CDORevisionCache}
- * @apiviz.uses {@link CDORevision} - - loads
- */
-public interface CDORevisionManager
-{
- /**
- * Returns the {@link CDORevision#getEClass() type} of an object if a revision for that object is in the revision
- * cache, <code>null</code> otherwise.
- * <p>
- * Same as calling {@link #getObjectType(CDOID, CDOBranchManager) getObjectType(id, null)}.
- *
- * @see EObject#eClass()
- * @see #getObjectType(CDOID, CDOBranchManager)
- */
- public EClass getObjectType(CDOID id);
-
- /**
- * Returns the {@link CDORevision#getEClass() type} of an object.
- * <p>
- * If no revision for that object is found in the revision cache the following is tried:
- * <ol>
- * <li>If <code>branchManagerForLoadOnDemand</code> is not <code>null</code> the first revision of the object in the
- * main branch is loaded from the server and its type is returned.
- * <li>Otherwise (i.e., if <code>branchManagerForLoadOnDemand</code> is <code>null</code> or the object does not
- * exist) <code>null</code> is returned.
- * </ol>
- * <p>
- * A {@link CDOBranchManager branch manager} is required instead of just a boolean value to specify whether to
- * demand-load or not because this revision manager must be able to access the
- * {@link CDOBranchManager#getMainBranch() main branch} while demand-loading.
- *
- * @see EObject#eClass()
- * @see #getObjectType(CDOID)
- * @since 4.1
- */
- public EClass getObjectType(CDOID id, CDOBranchManager branchManagerForLoadOnDemand);
-
- /**
- * Returns <code>true</code> if the {@link CDORevisionCache revision cache} contains a {@link CDORevision revision}
- * with the given {@link CDOID ID} at the given {@link CDOBranchPoint branch point} (branch + timestamp),
- * <code>false</code> otherwise.
- *
- * @see CDORevisionManager#getRevision(CDOID, CDOBranchPoint, int, int, boolean)
- * @see CDORevisionManager#getRevisions(List, CDOBranchPoint, int, int, boolean)
- */
- public boolean containsRevision(CDOID id, CDOBranchPoint branchPoint);
-
- /**
- * Returns the {@link CDORevision revision} with the given {@link CDOID ID} at the given {@link CDOBranchPoint branch
- * point} (branch + timestamp), optionally demand loading it if it is not already in the {@link CDORevisionCache
- * cache}.
- *
- * @param referenceChunk
- * The number of target {@link CDOID IDs} to load for each many-valued reference in the returned revision, or
- * {@link CDORevision#UNCHUNKED} for all such list elements (IDs).
- * @param prefetchDepth
- * The number of nested containment levels to load revisions for in one round trip. Use the symbolic
- * constants {@link CDORevision#DEPTH_INFINITE} to prefetch all contained revisions or
- * {@link CDORevision#DEPTH_NONE} to not prefetch anything. Only the explicitely requested revision is
- * returned by this method. If additional revisions are prefetched they are placed in the revision cache to
- * speed up subsequent calls to this method.
- * @param loadOnDemand
- * If the requested revision is not contained in the revision cache it depends on this parameter's value
- * whether the revision is loaded from the server or <code>null</code> is returned.
- * @see #getRevisions(List, CDOBranchPoint, int, int, boolean)
- * @see #getRevisionByVersion(CDOID, CDOBranchVersion, int, boolean)
- */
- public CDORevision getRevision(CDOID id, CDOBranchPoint branchPoint, int referenceChunk, int prefetchDepth,
- boolean loadOnDemand);
-
- /**
- * Returns the {@link CDORevision revisions} with the given {@link CDOID IDs} at the given {@link CDOBranchPoint
- * branch point} (branch + timestamp), optionally demand loading them if they are not already in the
- * {@link CDORevisionCache cache}.
- *
- * @param referenceChunk
- * The number of target {@link CDOID IDs} to load for each many-valued reference in the returned revisions,
- * or {@link CDORevision#UNCHUNKED} for all such list elements (IDs).
- * @param prefetchDepth
- * The number of nested containment levels to load revisions for in one round trip. Use the symbolic
- * constants {@link CDORevision#DEPTH_INFINITE} to prefetch all contained revisions or
- * {@link CDORevision#DEPTH_NONE} to not prefetch anything. Only the explicitely requested revisions are
- * returned by this method. If additional revisions are prefetched they are placed in the revision cache to
- * speed up subsequent calls to this method.
- * @param loadOnDemand
- * If one or more of the requested revisions is/are not contained in the revision cache it depends on this
- * parameter's value whether the revision(s) is/are loaded from the server or <code>null</code> is placed in
- * the list that is returned.
- * @see #getRevision(CDOID, CDOBranchPoint, int, int, boolean)
- */
- public List<CDORevision> getRevisions(List<CDOID> ids, CDOBranchPoint branchPoint, int referenceChunk,
- int prefetchDepth, boolean loadOnDemand);
-
- /**
- * Returns <code>true</code> if the {@link CDORevisionCache revision cache} contains a {@link CDORevision revision}
- * with the given {@link CDOID ID} at the given {@link CDOBranchVersion branch version} (branch + version),
- * <code>false</code> otherwise.
- *
- * @see #getRevisionByVersion(CDOID, CDOBranchVersion, int, boolean)
- */
- public boolean containsRevisionByVersion(CDOID id, CDOBranchVersion branchVersion);
-
- /**
- * Returns the {@link CDORevision revision} with the given {@link CDOID ID} at the given {@link CDOBranchVersion
- * branch version} (branch + version), optionally demand loading it if it is not already in the
- * {@link CDORevisionCache cache}.
- * <p>
- * Prefetching of nested containment levels is not support by this method because the version of a particular revision
- * can not serve as a reasonable baseline criterium for a consistent graph of multiple revisions.
- *
- * @param referenceChunk
- * The number of target {@link CDOID IDs} to load for each many-valued reference in the returned revision, or
- * {@link CDORevision#UNCHUNKED} for all such list elements (IDs).
- * @param loadOnDemand
- * If the requested revision is not contained in the revision cache it depends on this parameter's value
- * whether the revision is loaded from the server or <code>null</code> is returned.
- * @see #getRevision(CDOID, CDOBranchPoint, int, int, boolean)
- */
- public CDORevision getRevisionByVersion(CDOID id, CDOBranchVersion branchVersion, int referenceChunk,
- boolean loadOnDemand);
-}
+/*
+ * Copyright (c) 2004 - 2012 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.revision;
+
+import org.eclipse.emf.cdo.common.CDOCommonRepository;
+import org.eclipse.emf.cdo.common.CDOCommonSession;
+import org.eclipse.emf.cdo.common.branch.CDOBranch;
+import org.eclipse.emf.cdo.common.branch.CDOBranchManager;
+import org.eclipse.emf.cdo.common.branch.CDOBranchPoint;
+import org.eclipse.emf.cdo.common.branch.CDOBranchVersion;
+import org.eclipse.emf.cdo.common.id.CDOID;
+
+import org.eclipse.emf.ecore.EClass;
+import org.eclipse.emf.ecore.EObject;
+
+import java.util.List;
+
+/**
+ * Provides access to {@link CDORevision revisions} in a CDO {@link CDOCommonRepository repository} by demand loading
+ * and caching them.
+ * <p>
+ * Revisions are generally queried by:
+ * <p>
+ * <ul>
+ * <li>their object {@link CDOID ID} <b>and</b>
+ * <li>their {@link CDOBranch branch} plus <b>either</b>:
+ * <ul>
+ * <li>a timestamp <b>or</b>
+ * <li>a version
+ * </ul>
+ * </ul>
+ * <p>
+ * If querying by timestamp it's also possible to ask for multiple revisions (identified by a list of object IDs) in one
+ * round trip (to the server if this revision manager is contained by a {@link CDOCommonSession session} or to the
+ * backend store if it is contained by a {@link CDOCommonRepository repository}.
+ *
+ * @author Eike Stepper
+ * @since 3.0
+ * @noextend This interface is not intended to be extended by clients.
+ * @noimplement This interface is not intended to be implemented by clients.
+ * @apiviz.landmark
+ * @apiviz.has {@link CDORevisionFactory}
+ * @apiviz.has {@link CDORevisionCache}
+ * @apiviz.uses {@link CDORevision} - - loads
+ */
+public interface CDORevisionManager
+{
+ /**
+ * Returns the {@link CDORevision#getEClass() type} of an object if a revision for that object is in the revision
+ * cache, <code>null</code> otherwise.
+ * <p>
+ * Same as calling {@link #getObjectType(CDOID, CDOBranchManager) getObjectType(id, null)}.
+ *
+ * @see EObject#eClass()
+ * @see #getObjectType(CDOID, CDOBranchManager)
+ */
+ public EClass getObjectType(CDOID id);
+
+ /**
+ * Returns the {@link CDORevision#getEClass() type} of an object.
+ * <p>
+ * If no revision for that object is found in the revision cache the following is tried:
+ * <ol>
+ * <li>If <code>branchManagerForLoadOnDemand</code> is not <code>null</code> the first revision of the object in the
+ * main branch is loaded from the server and its type is returned.
+ * <li>Otherwise (i.e., if <code>branchManagerForLoadOnDemand</code> is <code>null</code> or the object does not
+ * exist) <code>null</code> is returned.
+ * </ol>
+ * <p>
+ * A {@link CDOBranchManager branch manager} is required instead of just a boolean value to specify whether to
+ * demand-load or not because this revision manager must be able to access the
+ * {@link CDOBranchManager#getMainBranch() main branch} while demand-loading.
+ *
+ * @see EObject#eClass()
+ * @see #getObjectType(CDOID)
+ * @since 4.1
+ */
+ public EClass getObjectType(CDOID id, CDOBranchManager branchManagerForLoadOnDemand);
+
+ /**
+ * Returns <code>true</code> if the {@link CDORevisionCache revision cache} contains a {@link CDORevision revision}
+ * with the given {@link CDOID ID} at the given {@link CDOBranchPoint branch point} (branch + timestamp),
+ * <code>false</code> otherwise.
+ *
+ * @see CDORevisionManager#getRevision(CDOID, CDOBranchPoint, int, int, boolean)
+ * @see CDORevisionManager#getRevisions(List, CDOBranchPoint, int, int, boolean)
+ */
+ public boolean containsRevision(CDOID id, CDOBranchPoint branchPoint);
+
+ /**
+ * Returns the {@link CDORevision revision} with the given {@link CDOID ID} at the given {@link CDOBranchPoint branch
+ * point} (branch + timestamp), optionally demand loading it if it is not already in the {@link CDORevisionCache
+ * cache}.
+ *
+ * @param referenceChunk
+ * The number of target {@link CDOID IDs} to load for each many-valued reference in the returned revision, or
+ * {@link CDORevision#UNCHUNKED} for all such list elements (IDs).
+ * @param prefetchDepth
+ * The number of nested containment levels to load revisions for in one round trip. Use the symbolic
+ * constants {@link CDORevision#DEPTH_INFINITE} to prefetch all contained revisions or
+ * {@link CDORevision#DEPTH_NONE} to not prefetch anything. Only the explicitely requested revision is
+ * returned by this method. If additional revisions are prefetched they are placed in the revision cache to
+ * speed up subsequent calls to this method.
+ * @param loadOnDemand
+ * If the requested revision is not contained in the revision cache it depends on this parameter's value
+ * whether the revision is loaded from the server or <code>null</code> is returned.
+ * @see #getRevisions(List, CDOBranchPoint, int, int, boolean)
+ * @see #getRevisionByVersion(CDOID, CDOBranchVersion, int, boolean)
+ */
+ public CDORevision getRevision(CDOID id, CDOBranchPoint branchPoint, int referenceChunk, int prefetchDepth,
+ boolean loadOnDemand);
+
+ /**
+ * Returns the {@link CDORevision revisions} with the given {@link CDOID IDs} at the given {@link CDOBranchPoint
+ * branch point} (branch + timestamp), optionally demand loading them if they are not already in the
+ * {@link CDORevisionCache cache}.
+ *
+ * @param referenceChunk
+ * The number of target {@link CDOID IDs} to load for each many-valued reference in the returned revisions,
+ * or {@link CDORevision#UNCHUNKED} for all such list elements (IDs).
+ * @param prefetchDepth
+ * The number of nested containment levels to load revisions for in one round trip. Use the symbolic
+ * constants {@link CDORevision#DEPTH_INFINITE} to prefetch all contained revisions or
+ * {@link CDORevision#DEPTH_NONE} to not prefetch anything. Only the explicitely requested revisions are
+ * returned by this method. If additional revisions are prefetched they are placed in the revision cache to
+ * speed up subsequent calls to this method.
+ * @param loadOnDemand
+ * If one or more of the requested revisions is/are not contained in the revision cache it depends on this
+ * parameter's value whether the revision(s) is/are loaded from the server or <code>null</code> is placed in
+ * the list that is returned.
+ * @see #getRevision(CDOID, CDOBranchPoint, int, int, boolean)
+ */
+ public List<CDORevision> getRevisions(List<CDOID> ids, CDOBranchPoint branchPoint, int referenceChunk,
+ int prefetchDepth, boolean loadOnDemand);
+
+ /**
+ * Returns <code>true</code> if the {@link CDORevisionCache revision cache} contains a {@link CDORevision revision}
+ * with the given {@link CDOID ID} at the given {@link CDOBranchVersion branch version} (branch + version),
+ * <code>false</code> otherwise.
+ *
+ * @see #getRevisionByVersion(CDOID, CDOBranchVersion, int, boolean)
+ */
+ public boolean containsRevisionByVersion(CDOID id, CDOBranchVersion branchVersion);
+
+ /**
+ * Returns the {@link CDORevision revision} with the given {@link CDOID ID} at the given {@link CDOBranchVersion
+ * branch version} (branch + version), optionally demand loading it if it is not already in the
+ * {@link CDORevisionCache cache}.
+ * <p>
+ * Prefetching of nested containment levels is not support by this method because the version of a particular revision
+ * can not serve as a reasonable baseline criterium for a consistent graph of multiple revisions.
+ *
+ * @param referenceChunk
+ * The number of target {@link CDOID IDs} to load for each many-valued reference in the returned revision, or
+ * {@link CDORevision#UNCHUNKED} for all such list elements (IDs).
+ * @param loadOnDemand
+ * If the requested revision is not contained in the revision cache it depends on this parameter's value
+ * whether the revision is loaded from the server or <code>null</code> is returned.
+ * @see #getRevision(CDOID, CDOBranchPoint, int, int, boolean)
+ */
+ public CDORevision getRevisionByVersion(CDOID id, CDOBranchVersion branchVersion, int referenceChunk,
+ boolean loadOnDemand);
+}
diff --git a/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/common/revision/CDORevisionProvider.java b/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/common/revision/CDORevisionProvider.java
index cf7e5fb4e3..c18c2b9c96 100644
--- a/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/common/revision/CDORevisionProvider.java
+++ b/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/common/revision/CDORevisionProvider.java
@@ -1,27 +1,27 @@
-/*
- * Copyright (c) 2004 - 2011 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.revision;
-
-import org.eclipse.emf.cdo.common.branch.CDOBranchPoint;
-import org.eclipse.emf.cdo.common.id.CDOID;
-
-/**
- * Provides consumers with the {@link CDORevision revisions} of {@link CDOID identifiable} CDO objects by selecting a
- * particular one from several possible {@link CDOBranchPoint branch points}.
- *
- * @author Eike Stepper
- * @since 3.0
- * @apiviz.uses {@link CDORevision} - - provides
- */
-public interface CDORevisionProvider
-{
- public CDORevision getRevision(CDOID id);
-}
+/*
+ * Copyright (c) 2004 - 2012 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.revision;
+
+import org.eclipse.emf.cdo.common.branch.CDOBranchPoint;
+import org.eclipse.emf.cdo.common.id.CDOID;
+
+/**
+ * Provides consumers with the {@link CDORevision revisions} of {@link CDOID identifiable} CDO objects by selecting a
+ * particular one from several possible {@link CDOBranchPoint branch points}.
+ *
+ * @author Eike Stepper
+ * @since 3.0
+ * @apiviz.uses {@link CDORevision} - - provides
+ */
+public interface CDORevisionProvider
+{
+ public CDORevision getRevision(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 8cb55a0a14..67914d9066 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
@@ -1,597 +1,597 @@
-/*
- * Copyright (c) 2004 - 2011 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.revision;
-
-import org.eclipse.emf.cdo.common.branch.CDOBranch;
-import org.eclipse.emf.cdo.common.branch.CDOBranchManager;
-import org.eclipse.emf.cdo.common.branch.CDOBranchPoint;
-import org.eclipse.emf.cdo.common.branch.CDOBranchVersion;
-import org.eclipse.emf.cdo.common.commit.CDOChangeSet;
-import org.eclipse.emf.cdo.common.commit.CDOChangeSetData;
-import org.eclipse.emf.cdo.common.id.CDOID;
-import org.eclipse.emf.cdo.common.id.CDOIDUtil;
-import org.eclipse.emf.cdo.common.revision.delta.CDORevisionDelta;
-import org.eclipse.emf.cdo.common.util.CDOCommonUtil;
-import org.eclipse.emf.cdo.internal.common.commit.CDOChangeSetDataImpl;
-import org.eclipse.emf.cdo.internal.common.commit.CDOChangeSetImpl;
-import org.eclipse.emf.cdo.internal.common.messages.Messages;
-import org.eclipse.emf.cdo.internal.common.revision.CDOFeatureMapEntryImpl;
-import org.eclipse.emf.cdo.internal.common.revision.CDORevisableImpl;
-import org.eclipse.emf.cdo.internal.common.revision.CDORevisionCacheAuditing;
-import org.eclipse.emf.cdo.internal.common.revision.CDORevisionCacheBranching;
-import org.eclipse.emf.cdo.internal.common.revision.CDORevisionCacheNonAuditing;
-import org.eclipse.emf.cdo.internal.common.revision.CDORevisionImpl;
-import org.eclipse.emf.cdo.internal.common.revision.CDORevisionKeyImpl;
-import org.eclipse.emf.cdo.internal.common.revision.CDORevisionManagerImpl;
-import org.eclipse.emf.cdo.internal.common.revision.delta.CDORevisionDeltaImpl;
-import org.eclipse.emf.cdo.spi.common.revision.CDOFeatureMapEntry;
-import org.eclipse.emf.cdo.spi.common.revision.InternalCDORevision;
-import org.eclipse.emf.cdo.spi.common.revision.InternalCDORevisionManager;
-import org.eclipse.emf.cdo.spi.common.revision.ManagedRevisionProvider;
-
-import org.eclipse.emf.ecore.EAttribute;
-import org.eclipse.emf.ecore.EStructuralFeature;
-import org.eclipse.emf.ecore.util.FeatureMap;
-
-import java.io.ByteArrayOutputStream;
-import java.io.PrintStream;
-import java.util.ArrayList;
-import java.util.Collections;
-import java.util.Comparator;
-import java.util.List;
-import java.util.Map;
-import java.util.Set;
-import java.util.StringTokenizer;
-
-/**
- * Various static helper methods for dealing with {@link CDORevision revisions}.
- *
- * @author Eike Stepper
- * @apiviz.exclude
- */
-public final class CDORevisionUtil
-{
- public static final Object UNINITIALIZED = new Uninitialized();
-
- private CDORevisionUtil()
- {
- }
-
- /**
- * Creates and returns a new memory sensitive revision cache.
- *
- * @since 4.0
- */
- public static CDORevisionCache createRevisionCache(boolean supportingAudits, boolean supportingBranches)
- {
- if (supportingBranches)
- {
- return new CDORevisionCacheBranching();
- }
-
- if (supportingAudits)
- {
- return new CDORevisionCacheAuditing();
- }
-
- return new CDORevisionCacheNonAuditing();
- }
-
- /**
- * @since 4.0
- */
- public static CDORevisionManager createRevisionManager()
- {
- return new CDORevisionManagerImpl();
- }
-
- /**
- * @since 4.0
- */
- public static CDORevisionManager createRevisionManager(CDORevisionCache cache)
- {
- InternalCDORevisionManager revisionManager = (InternalCDORevisionManager)createRevisionManager();
- revisionManager.setCache(cache);
- return revisionManager;
- }
-
- /**
- * @since 4.0
- */
- public static CDORevisable copyRevisable(CDORevisable source)
- {
- return new CDORevisableImpl(source);
- }
-
- /**
- * @since 4.0
- */
- public static CDORevisable createRevisable(CDOBranch branch, int version, long timeStamp, long revised)
- {
- return new CDORevisableImpl(branch, version, timeStamp, revised);
- }
-
- /**
- * @since 4.0
- */
- public static CDORevisionKey copyRevisionKey(CDORevisionKey source)
- {
- return new CDORevisionKeyImpl(source.getID(), source.getBranch(), source.getVersion());
- }
-
- /**
- * @since 3.0
- */
- public static CDORevisionKey createRevisionKey(CDOID id, CDOBranch branch, int version)
- {
- return new CDORevisionKeyImpl(id, branch, version);
- }
-
- /**
- * @since 4.0
- */
- public static String formatRevisionKey(CDORevisionKey key)
- {
- StringBuilder builder = new StringBuilder();
- CDOIDUtil.write(builder, key.getID());
- builder.append(":");
- builder.append(key.getBranch().getID());
- builder.append(":");
- builder.append(key.getVersion());
- return builder.toString();
- }
-
- /**
- * @since 4.0
- */
- public static CDORevisionKey parseRevisionKey(String source, CDOBranchManager branchManager)
- {
- StringTokenizer tokenizer = new StringTokenizer(source, ":");
- if (!tokenizer.hasMoreTokens())
- {
- throw new IllegalArgumentException("No ID segment");
- }
-
- String idSegment = tokenizer.nextToken();
- CDOID id = CDOIDUtil.read(idSegment);
-
- if (!tokenizer.hasMoreTokens())
- {
- throw new IllegalArgumentException("No branch segment");
- }
-
- String branchSegment = tokenizer.nextToken();
- CDOBranch branch = branchManager.getBranch(Integer.parseInt(branchSegment));
-
- if (!tokenizer.hasMoreTokens())
- {
- throw new IllegalArgumentException("No version segment");
- }
-
- String versionSegment = tokenizer.nextToken();
- int version = Integer.parseInt(versionSegment);
-
- return new CDORevisionKeyImpl(id, branch, version);
- }
-
- /**
- * @since 2.0
- */
- public static FeatureMap.Entry createFeatureMapEntry(EStructuralFeature feature, Object value)
- {
- return new CDOFeatureMapEntryImpl(feature, value);
- }
-
- /**
- * @since 3.0
- */
- public static CDOFeatureMapEntry createCDOFeatureMapEntry()
- {
- return new CDOFeatureMapEntryImpl();
- }
-
- /**
- * @since 4.0
- */
- public static CDORevisionDelta createDelta(CDORevision revision)
- {
- return new CDORevisionDeltaImpl(revision);
- }
-
- /**
- * @since 4.0
- */
- public static CDOChangeSetData createChangeSetData(Set<CDOID> ids, final CDOBranchPoint startPoint,
- final CDOBranchPoint endPoint, final CDORevisionManager revisionManager)
- {
- CDORevisionProvider startProvider = new ManagedRevisionProvider(revisionManager, startPoint);
- CDORevisionProvider endProvider = new ManagedRevisionProvider(revisionManager, endPoint);
- return createChangeSetData(ids, startProvider, endProvider);
- }
-
- /**
- * @since 4.0
- */
- public static CDOChangeSetData createChangeSetData(Set<CDOID> ids, CDORevisionProvider startProvider,
- CDORevisionProvider endProvider)
- {
- return createChangeSetData(ids, startProvider, endProvider, false);
- }
-
- /**
- * @since 4.1
- */
- public static CDOChangeSetData createChangeSetData(Set<CDOID> ids, CDORevisionProvider startProvider,
- CDORevisionProvider endProvider, boolean useStartVersions)
- {
- List<CDOIDAndVersion> newObjects = new ArrayList<CDOIDAndVersion>();
- List<CDORevisionKey> changedObjects = new ArrayList<CDORevisionKey>();
- List<CDOIDAndVersion> detachedObjects = new ArrayList<CDOIDAndVersion>();
- for (CDOID id : ids)
- {
- CDORevision startRevision = startProvider.getRevision(id);
- CDORevision endRevision = endProvider.getRevision(id);
-
- if (startRevision == null && endRevision != null)
- {
- if (useStartVersions)
- {
- ((InternalCDORevision)endRevision).setVersion(0);
- }
-
- newObjects.add(endRevision);
- }
- else if (startRevision != null && endRevision == null)
- {
- detachedObjects.add(CDOIDUtil.createIDAndVersion(id, CDOBranchVersion.UNSPECIFIED_VERSION));
- }
- else if (startRevision != null && endRevision != null)
- {
- if (!startRevision.equals(endRevision))
- {
- if (useStartVersions)
- {
- ((InternalCDORevision)endRevision).setVersion(startRevision.getVersion());
- }
-
- CDORevisionDelta delta = endRevision.compare(startRevision);
- if (!delta.isEmpty())
- {
- changedObjects.add(delta);
- }
- }
- }
- }
-
- return createChangeSetData(newObjects, changedObjects, detachedObjects);
- }
-
- /**
- * @since 4.0
- */
- public static CDOChangeSetData createChangeSetData(List<CDOIDAndVersion> newObjects,
- List<CDORevisionKey> changedObjects, List<CDOIDAndVersion> detachedObjects)
- {
- return new CDOChangeSetDataImpl(newObjects, changedObjects, detachedObjects);
- }
-
- /**
- * @since 4.0
- */
- public static CDOChangeSet createChangeSet(CDOBranchPoint startPoint, CDOBranchPoint endPoint, CDOChangeSetData data)
- {
- return new CDOChangeSetImpl(startPoint, endPoint, data);
- }
-
- /**
- * @since 3.0
- */
- public static Object remapID(Object value, Map<CDOID, CDOID> idMappings, boolean allowUnmappedTempIDs)
- {
- return CDORevisionImpl.remapID(value, idMappings, allowUnmappedTempIDs);
- }
-
- /**
- * @since 4.0
- */
- public static String getResourceNodePath(CDORevision revision, CDORevisionProvider provider)
- {
- EAttribute nameFeature = (EAttribute)revision.getEClass().getEStructuralFeature("name");
-
- StringBuilder builder = new StringBuilder();
- getResourceNodePath((InternalCDORevision)revision, provider, nameFeature, builder);
-
- builder.insert(0, "/");
- return builder.toString();
- }
-
- private static void getResourceNodePath(InternalCDORevision revision, CDORevisionProvider provider,
- EAttribute nameFeature, StringBuilder result)
- {
- String name = (String)revision.get(nameFeature, 0);
- if (name != null)
- {
- if (result.length() != 0)
- {
- result.insert(0, "/");
- }
-
- result.insert(0, name);
- }
-
- CDOID folder = (CDOID)revision.getContainerID();
- if (!CDOIDUtil.isNull(folder))
- {
- InternalCDORevision container = (InternalCDORevision)provider.getRevision(folder);
- getResourceNodePath(container, provider, nameFeature, result);
- }
- }
-
- /**
- * @since 3.0
- */
- public static String dumpAllRevisions(Map<CDOBranch, List<CDORevision>> map)
- {
- ByteArrayOutputStream baos = new ByteArrayOutputStream();
- PrintStream out = new PrintStream(baos);
- dumpAllRevisions(map, out);
- return baos.toString();
- }
-
- /**
- * @since 3.0
- */
- public static void dumpAllRevisions(Map<CDOBranch, List<CDORevision>> map, PrintStream out)
- {
- new AllRevisionsDumper.Stream.Plain(map, out).dump();
- }
-
- /**
- * Dumps {@link CDORevision revisions}, sorted and grouped by {@link CDOBranch branch}, to various output formats and
- * targets. Concrete output formats and targets are implemented by subclasses.
- *
- * @since 4.0
- * @apiviz.exclude
- */
- public static abstract class AllRevisionsDumper
- {
- private Map<CDOBranch, List<CDORevision>> map;
-
- public AllRevisionsDumper(Map<CDOBranch, List<CDORevision>> map)
- {
- this.map = map;
- }
-
- public Map<CDOBranch, List<CDORevision>> getMap()
- {
- return map;
- }
-
- public void dump()
- {
- ArrayList<CDOBranch> branches = new ArrayList<CDOBranch>(map.keySet());
- Collections.sort(branches);
-
- dumpStart(branches);
- for (CDOBranch branch : branches)
- {
- dumpBranch(branch);
-
- List<CDORevision> revisions = map.get(branch);
- Collections.sort(revisions, new CDORevisionComparator());
-
- for (CDORevision revision : revisions)
- {
- dumpRevision(revision);
- }
- }
-
- dumpEnd(branches);
- }
-
- protected void dumpStart(List<CDOBranch> branches)
- {
- }
-
- protected void dumpEnd(List<CDOBranch> branches)
- {
- }
-
- protected abstract void dumpBranch(CDOBranch branch);
-
- protected abstract void dumpRevision(CDORevision revision);
-
- /**
- * A {@link AllRevisionsDumper revision dumper} that directs all output to a stream. The concrete output format is
- * implemented by subclasses.
- *
- * @author Eike Stepper
- * @apiviz.exclude
- */
- public static abstract class Stream extends AllRevisionsDumper
- {
- private PrintStream out;
-
- public Stream(Map<CDOBranch, List<CDORevision>> map, PrintStream out)
- {
- super(map);
- this.out = out;
- }
-
- public PrintStream out()
- {
- return out;
- }
-
- /**
- * A {@link Stream revision dumper} that directs all output as plain text to a stream.
- *
- * @author Eike Stepper
- * @apiviz.exclude
- */
- public static class Plain extends Stream
- {
- public static final int pad = 48;
-
- public Plain(Map<CDOBranch, List<CDORevision>> map, PrintStream out)
- {
- super(map, out);
- }
-
- @Override
- protected void dumpEnd(List<CDOBranch> branches)
- {
- out().println();
- }
-
- @Override
- protected void dumpBranch(CDOBranch branch)
- {
- out().println(
- padTimeRange(branch.getName() + "[" + branch.getID() + "]", pad, branch.getBase().getTimeStamp(), //$NON-NLS-1$ //$NON-NLS-2$
- CDORevision.UNSPECIFIED_DATE));
- }
-
- @Override
- protected void dumpRevision(CDORevision revision)
- {
- out().println(padTimeRange(" " + revision, pad, revision.getTimeStamp(), revision.getRevised())); //$NON-NLS-1$
- }
-
- private static String padTimeRange(String s, int pos, long t1, long t2)
- {
- StringBuffer buffer = new StringBuffer(s);
- while (buffer.length() < pos)
- {
- buffer.append(' ');
- }
-
- buffer.append(CDOCommonUtil.formatTimeStamp(t1));
- buffer.append("/");
- buffer.append(CDOCommonUtil.formatTimeStamp(t2));
- return buffer.toString();
- }
- }
-
- /**
- * A {@link Stream revision dumper} that directs all output as HTML text to a stream.
- *
- * @author Eike Stepper
- * @apiviz.exclude
- */
- public static class Html extends Stream
- {
- public Html(Map<CDOBranch, List<CDORevision>> map, PrintStream out)
- {
- super(map, out);
- }
-
- @Override
- protected void dumpStart(List<CDOBranch> branches)
- {
- out().println("<table border=\"0\">");
- }
-
- @Override
- protected void dumpEnd(List<CDOBranch> branches)
- {
- out().println("</table>");
- }
-
- @Override
- protected void dumpBranch(CDOBranch branch)
- {
- PrintStream out = out();
- if (!branch.isMainBranch())
- {
- out.println("<tr><td>&nbsp;</td><td>&nbsp;</td></tr>");
- }
-
- out.println("<tr>");
- out.println("<td>");
- out.println("<h4>" + branch.getName() + "[" + branch.getID() + "]</h4>");
- out.println("</td>");
- out.println("<td>");
- out.println("<h4>" + CDOCommonUtil.formatTimeStamp(branch.getBase().getTimeStamp()) + " / "
- + CDOCommonUtil.formatTimeStamp(CDORevision.UNSPECIFIED_DATE) + "</h4>");
- out.println("</td>");
- out.println("</tr>");
- }
-
- @Override
- protected void dumpRevision(CDORevision revision)
- {
- PrintStream out = out();
-
- out.println("<tr>");
- out.println("<td>&nbsp;&nbsp;&nbsp;&nbsp;");
- dumpRevision(revision, out);
- out.println("&nbsp;&nbsp;&nbsp;&nbsp;</td>");
-
- out.println("<td>");
- out.println(CDOCommonUtil.formatTimeStamp(revision.getTimeStamp()) + " / "
- + CDOCommonUtil.formatTimeStamp(revision.getRevised()));
- out.println("</td>");
- out.println("</tr>");
- }
-
- protected void dumpRevision(CDORevision revision, PrintStream out)
- {
- out.println(revision);
- }
- }
- }
- }
-
- /**
- * Compares {@link CDORevisionKey revision keys} by {@link CDORevision#getID() ID} and
- * {@link CDORevision#getVersion() version}.
- *
- * @author Eike Stepper
- * @since 4.0
- * @apiviz.exclude
- */
- public static class CDORevisionComparator implements Comparator<CDORevisionKey>
- {
- public CDORevisionComparator()
- {
- }
-
- public int compare(CDORevisionKey rev1, CDORevisionKey rev2)
- {
- int result = rev1.getID().compareTo(rev2.getID());
- if (result == 0)
- {
- int version1 = rev1.getVersion();
- int version2 = rev2.getVersion();
- result = version1 < version2 ? -1 : version1 == version2 ? 0 : 1;
- }
-
- return result;
- }
- }
-
- /**
- * @author Eike Stepper
- */
- private static final class Uninitialized
- {
- public Uninitialized()
- {
- }
-
- @Override
- public String toString()
- {
- return Messages.getString("CDORevisionUtil.0"); //$NON-NLS-1$
- }
- }
-}
+/*
+ * Copyright (c) 2004 - 2012 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.revision;
+
+import org.eclipse.emf.cdo.common.branch.CDOBranch;
+import org.eclipse.emf.cdo.common.branch.CDOBranchManager;
+import org.eclipse.emf.cdo.common.branch.CDOBranchPoint;
+import org.eclipse.emf.cdo.common.branch.CDOBranchVersion;
+import org.eclipse.emf.cdo.common.commit.CDOChangeSet;
+import org.eclipse.emf.cdo.common.commit.CDOChangeSetData;
+import org.eclipse.emf.cdo.common.id.CDOID;
+import org.eclipse.emf.cdo.common.id.CDOIDUtil;
+import org.eclipse.emf.cdo.common.revision.delta.CDORevisionDelta;
+import org.eclipse.emf.cdo.common.util.CDOCommonUtil;
+import org.eclipse.emf.cdo.internal.common.commit.CDOChangeSetDataImpl;
+import org.eclipse.emf.cdo.internal.common.commit.CDOChangeSetImpl;
+import org.eclipse.emf.cdo.internal.common.messages.Messages;
+import org.eclipse.emf.cdo.internal.common.revision.CDOFeatureMapEntryImpl;
+import org.eclipse.emf.cdo.internal.common.revision.CDORevisableImpl;
+import org.eclipse.emf.cdo.internal.common.revision.CDORevisionCacheAuditing;
+import org.eclipse.emf.cdo.internal.common.revision.CDORevisionCacheBranching;
+import org.eclipse.emf.cdo.internal.common.revision.CDORevisionCacheNonAuditing;
+import org.eclipse.emf.cdo.internal.common.revision.CDORevisionImpl;
+import org.eclipse.emf.cdo.internal.common.revision.CDORevisionKeyImpl;
+import org.eclipse.emf.cdo.internal.common.revision.CDORevisionManagerImpl;
+import org.eclipse.emf.cdo.internal.common.revision.delta.CDORevisionDeltaImpl;
+import org.eclipse.emf.cdo.spi.common.revision.CDOFeatureMapEntry;
+import org.eclipse.emf.cdo.spi.common.revision.InternalCDORevision;
+import org.eclipse.emf.cdo.spi.common.revision.InternalCDORevisionManager;
+import org.eclipse.emf.cdo.spi.common.revision.ManagedRevisionProvider;
+
+import org.eclipse.emf.ecore.EAttribute;
+import org.eclipse.emf.ecore.EStructuralFeature;
+import org.eclipse.emf.ecore.util.FeatureMap;
+
+import java.io.ByteArrayOutputStream;
+import java.io.PrintStream;
+import java.util.ArrayList;
+import java.util.Collections;
+import java.util.Comparator;
+import java.util.List;
+import java.util.Map;
+import java.util.Set;
+import java.util.StringTokenizer;
+
+/**
+ * Various static helper methods for dealing with {@link CDORevision revisions}.
+ *
+ * @author Eike Stepper
+ * @apiviz.exclude
+ */
+public final class CDORevisionUtil
+{
+ public static final Object UNINITIALIZED = new Uninitialized();
+
+ private CDORevisionUtil()
+ {
+ }
+
+ /**
+ * Creates and returns a new memory sensitive revision cache.
+ *
+ * @since 4.0
+ */
+ public static CDORevisionCache createRevisionCache(boolean supportingAudits, boolean supportingBranches)
+ {
+ if (supportingBranches)
+ {
+ return new CDORevisionCacheBranching();
+ }
+
+ if (supportingAudits)
+ {
+ return new CDORevisionCacheAuditing();
+ }
+
+ return new CDORevisionCacheNonAuditing();
+ }
+
+ /**
+ * @since 4.0
+ */
+ public static CDORevisionManager createRevisionManager()
+ {
+ return new CDORevisionManagerImpl();
+ }
+
+ /**
+ * @since 4.0
+ */
+ public static CDORevisionManager createRevisionManager(CDORevisionCache cache)
+ {
+ InternalCDORevisionManager revisionManager = (InternalCDORevisionManager)createRevisionManager();
+ revisionManager.setCache(cache);
+ return revisionManager;
+ }
+
+ /**
+ * @since 4.0
+ */
+ public static CDORevisable copyRevisable(CDORevisable source)
+ {
+ return new CDORevisableImpl(source);
+ }
+
+ /**
+ * @since 4.0
+ */
+ public static CDORevisable createRevisable(CDOBranch branch, int version, long timeStamp, long revised)
+ {
+ return new CDORevisableImpl(branch, version, timeStamp, revised);
+ }
+
+ /**
+ * @since 4.0
+ */
+ public static CDORevisionKey copyRevisionKey(CDORevisionKey source)
+ {
+ return new CDORevisionKeyImpl(source.getID(), source.getBranch(), source.getVersion());
+ }
+
+ /**
+ * @since 3.0
+ */
+ public static CDORevisionKey createRevisionKey(CDOID id, CDOBranch branch, int version)
+ {
+ return new CDORevisionKeyImpl(id, branch, version);
+ }
+
+ /**
+ * @since 4.0
+ */
+ public static String formatRevisionKey(CDORevisionKey key)
+ {
+ StringBuilder builder = new StringBuilder();
+ CDOIDUtil.write(builder, key.getID());
+ builder.append(":");
+ builder.append(key.getBranch().getID());
+ builder.append(":");
+ builder.append(key.getVersion());
+ return builder.toString();
+ }
+
+ /**
+ * @since 4.0
+ */
+ public static CDORevisionKey parseRevisionKey(String source, CDOBranchManager branchManager)
+ {
+ StringTokenizer tokenizer = new StringTokenizer(source, ":");
+ if (!tokenizer.hasMoreTokens())
+ {
+ throw new IllegalArgumentException("No ID segment");
+ }
+
+ String idSegment = tokenizer.nextToken();
+ CDOID id = CDOIDUtil.read(idSegment);
+
+ if (!tokenizer.hasMoreTokens())
+ {
+ throw new IllegalArgumentException("No branch segment");
+ }
+
+ String branchSegment = tokenizer.nextToken();
+ CDOBranch branch = branchManager.getBranch(Integer.parseInt(branchSegment));
+
+ if (!tokenizer.hasMoreTokens())
+ {
+ throw new IllegalArgumentException("No version segment");
+ }
+
+ String versionSegment = tokenizer.nextToken();
+ int version = Integer.parseInt(versionSegment);
+
+ return new CDORevisionKeyImpl(id, branch, version);
+ }
+
+ /**
+ * @since 2.0
+ */
+ public static FeatureMap.Entry createFeatureMapEntry(EStructuralFeature feature, Object value)
+ {
+ return new CDOFeatureMapEntryImpl(feature, value);
+ }
+
+ /**
+ * @since 3.0
+ */
+ public static CDOFeatureMapEntry createCDOFeatureMapEntry()
+ {
+ return new CDOFeatureMapEntryImpl();
+ }
+
+ /**
+ * @since 4.0
+ */
+ public static CDORevisionDelta createDelta(CDORevision revision)
+ {
+ return new CDORevisionDeltaImpl(revision);
+ }
+
+ /**
+ * @since 4.0
+ */
+ public static CDOChangeSetData createChangeSetData(Set<CDOID> ids, final CDOBranchPoint startPoint,
+ final CDOBranchPoint endPoint, final CDORevisionManager revisionManager)
+ {
+ CDORevisionProvider startProvider = new ManagedRevisionProvider(revisionManager, startPoint);
+ CDORevisionProvider endProvider = new ManagedRevisionProvider(revisionManager, endPoint);
+ return createChangeSetData(ids, startProvider, endProvider);
+ }
+
+ /**
+ * @since 4.0
+ */
+ public static CDOChangeSetData createChangeSetData(Set<CDOID> ids, CDORevisionProvider startProvider,
+ CDORevisionProvider endProvider)
+ {
+ return createChangeSetData(ids, startProvider, endProvider, false);
+ }
+
+ /**
+ * @since 4.1
+ */
+ public static CDOChangeSetData createChangeSetData(Set<CDOID> ids, CDORevisionProvider startProvider,
+ CDORevisionProvider endProvider, boolean useStartVersions)
+ {
+ List<CDOIDAndVersion> newObjects = new ArrayList<CDOIDAndVersion>();
+ List<CDORevisionKey> changedObjects = new ArrayList<CDORevisionKey>();
+ List<CDOIDAndVersion> detachedObjects = new ArrayList<CDOIDAndVersion>();
+ for (CDOID id : ids)
+ {
+ CDORevision startRevision = startProvider.getRevision(id);
+ CDORevision endRevision = endProvider.getRevision(id);
+
+ if (startRevision == null && endRevision != null)
+ {
+ if (useStartVersions)
+ {
+ ((InternalCDORevision)endRevision).setVersion(0);
+ }
+
+ newObjects.add(endRevision);
+ }
+ else if (startRevision != null && endRevision == null)
+ {
+ detachedObjects.add(CDOIDUtil.createIDAndVersion(id, CDOBranchVersion.UNSPECIFIED_VERSION));
+ }
+ else if (startRevision != null && endRevision != null)
+ {
+ if (!startRevision.equals(endRevision))
+ {
+ if (useStartVersions)
+ {
+ ((InternalCDORevision)endRevision).setVersion(startRevision.getVersion());
+ }
+
+ CDORevisionDelta delta = endRevision.compare(startRevision);
+ if (!delta.isEmpty())
+ {
+ changedObjects.add(delta);
+ }
+ }
+ }
+ }
+
+ return createChangeSetData(newObjects, changedObjects, detachedObjects);
+ }
+
+ /**
+ * @since 4.0
+ */
+ public static CDOChangeSetData createChangeSetData(List<CDOIDAndVersion> newObjects,
+ List<CDORevisionKey> changedObjects, List<CDOIDAndVersion> detachedObjects)
+ {
+ return new CDOChangeSetDataImpl(newObjects, changedObjects, detachedObjects);
+ }
+
+ /**
+ * @since 4.0
+ */
+ public static CDOChangeSet createChangeSet(CDOBranchPoint startPoint, CDOBranchPoint endPoint, CDOChangeSetData data)
+ {
+ return new CDOChangeSetImpl(startPoint, endPoint, data);
+ }
+
+ /**
+ * @since 3.0
+ */
+ public static Object remapID(Object value, Map<CDOID, CDOID> idMappings, boolean allowUnmappedTempIDs)
+ {
+ return CDORevisionImpl.remapID(value, idMappings, allowUnmappedTempIDs);
+ }
+
+ /**
+ * @since 4.0
+ */
+ public static String getResourceNodePath(CDORevision revision, CDORevisionProvider provider)
+ {
+ EAttribute nameFeature = (EAttribute)revision.getEClass().getEStructuralFeature("name");
+
+ StringBuilder builder = new StringBuilder();
+ getResourceNodePath((InternalCDORevision)revision, provider, nameFeature, builder);
+
+ builder.insert(0, "/");
+ return builder.toString();
+ }
+
+ private static void getResourceNodePath(InternalCDORevision revision, CDORevisionProvider provider,
+ EAttribute nameFeature, StringBuilder result)
+ {
+ String name = (String)revision.get(nameFeature, 0);
+ if (name != null)
+ {
+ if (result.length() != 0)
+ {
+ result.insert(0, "/");
+ }
+
+ result.insert(0, name);
+ }
+
+ CDOID folder = (CDOID)revision.getContainerID();
+ if (!CDOIDUtil.isNull(folder))
+ {
+ InternalCDORevision container = (InternalCDORevision)provider.getRevision(folder);
+ getResourceNodePath(container, provider, nameFeature, result);
+ }
+ }
+
+ /**
+ * @since 3.0
+ */
+ public static String dumpAllRevisions(Map<CDOBranch, List<CDORevision>> map)
+ {
+ ByteArrayOutputStream baos = new ByteArrayOutputStream();
+ PrintStream out = new PrintStream(baos);
+ dumpAllRevisions(map, out);
+ return baos.toString();
+ }
+
+ /**
+ * @since 3.0
+ */
+ public static void dumpAllRevisions(Map<CDOBranch, List<CDORevision>> map, PrintStream out)
+ {
+ new AllRevisionsDumper.Stream.Plain(map, out).dump();
+ }
+
+ /**
+ * Dumps {@link CDORevision revisions}, sorted and grouped by {@link CDOBranch branch}, to various output formats and
+ * targets. Concrete output formats and targets are implemented by subclasses.
+ *
+ * @since 4.0
+ * @apiviz.exclude
+ */
+ public static abstract class AllRevisionsDumper
+ {
+ private Map<CDOBranch, List<CDORevision>> map;
+
+ public AllRevisionsDumper(Map<CDOBranch, List<CDORevision>> map)
+ {
+ this.map = map;
+ }
+
+ public Map<CDOBranch, List<CDORevision>> getMap()
+ {
+ return map;
+ }
+
+ public void dump()
+ {
+ ArrayList<CDOBranch> branches = new ArrayList<CDOBranch>(map.keySet());
+ Collections.sort(branches);
+
+ dumpStart(branches);
+ for (CDOBranch branch : branches)
+ {
+ dumpBranch(branch);
+
+ List<CDORevision> revisions = map.get(branch);
+ Collections.sort(revisions, new CDORevisionComparator());
+
+ for (CDORevision revision : revisions)
+ {
+ dumpRevision(revision);
+ }
+ }
+
+ dumpEnd(branches);
+ }
+
+ protected void dumpStart(List<CDOBranch> branches)
+ {
+ }
+
+ protected void dumpEnd(List<CDOBranch> branches)
+ {
+ }
+
+ protected abstract void dumpBranch(CDOBranch branch);
+
+ protected abstract void dumpRevision(CDORevision revision);
+
+ /**
+ * A {@link AllRevisionsDumper revision dumper} that directs all output to a stream. The concrete output format is
+ * implemented by subclasses.
+ *
+ * @author Eike Stepper
+ * @apiviz.exclude
+ */
+ public static abstract class Stream extends AllRevisionsDumper
+ {
+ private PrintStream out;
+
+ public Stream(Map<CDOBranch, List<CDORevision>> map, PrintStream out)
+ {
+ super(map);
+ this.out = out;
+ }
+
+ public PrintStream out()
+ {
+ return out;
+ }
+
+ /**
+ * A {@link Stream revision dumper} that directs all output as plain text to a stream.
+ *
+ * @author Eike Stepper
+ * @apiviz.exclude
+ */
+ public static class Plain extends Stream
+ {
+ public static final int pad = 48;
+
+ public Plain(Map<CDOBranch, List<CDORevision>> map, PrintStream out)
+ {
+ super(map, out);
+ }
+
+ @Override
+ protected void dumpEnd(List<CDOBranch> branches)
+ {
+ out().println();
+ }
+
+ @Override
+ protected void dumpBranch(CDOBranch branch)
+ {
+ out().println(
+ padTimeRange(branch.getName() + "[" + branch.getID() + "]", pad, branch.getBase().getTimeStamp(), //$NON-NLS-1$ //$NON-NLS-2$
+ CDORevision.UNSPECIFIED_DATE));
+ }
+
+ @Override
+ protected void dumpRevision(CDORevision revision)
+ {
+ out().println(padTimeRange(" " + revision, pad, revision.getTimeStamp(), revision.getRevised())); //$NON-NLS-1$
+ }
+
+ private static String padTimeRange(String s, int pos, long t1, long t2)
+ {
+ StringBuffer buffer = new StringBuffer(s);
+ while (buffer.length() < pos)
+ {
+ buffer.append(' ');
+ }
+
+ buffer.append(CDOCommonUtil.formatTimeStamp(t1));
+ buffer.append("/");
+ buffer.append(CDOCommonUtil.formatTimeStamp(t2));
+ return buffer.toString();
+ }
+ }
+
+ /**
+ * A {@link Stream revision dumper} that directs all output as HTML text to a stream.
+ *
+ * @author Eike Stepper
+ * @apiviz.exclude
+ */
+ public static class Html extends Stream
+ {
+ public Html(Map<CDOBranch, List<CDORevision>> map, PrintStream out)
+ {
+ super(map, out);
+ }
+
+ @Override
+ protected void dumpStart(List<CDOBranch> branches)
+ {
+ out().println("<table border=\"0\">");
+ }
+
+ @Override
+ protected void dumpEnd(List<CDOBranch> branches)
+ {
+ out().println("</table>");
+ }
+
+ @Override
+ protected void dumpBranch(CDOBranch branch)
+ {
+ PrintStream out = out();
+ if (!branch.isMainBranch())
+ {
+ out.println("<tr><td>&nbsp;</td><td>&nbsp;</td></tr>");
+ }
+
+ out.println("<tr>");
+ out.println("<td>");
+ out.println("<h4>" + branch.getName() + "[" + branch.getID() + "]</h4>");
+ out.println("</td>");
+ out.println("<td>");
+ out.println("<h4>" + CDOCommonUtil.formatTimeStamp(branch.getBase().getTimeStamp()) + " / "
+ + CDOCommonUtil.formatTimeStamp(CDORevision.UNSPECIFIED_DATE) + "</h4>");
+ out.println("</td>");
+ out.println("</tr>");
+ }
+
+ @Override
+ protected void dumpRevision(CDORevision revision)
+ {
+ PrintStream out = out();
+
+ out.println("<tr>");
+ out.println("<td>&nbsp;&nbsp;&nbsp;&nbsp;");
+ dumpRevision(revision, out);
+ out.println("&nbsp;&nbsp;&nbsp;&nbsp;</td>");
+
+ out.println("<td>");
+ out.println(CDOCommonUtil.formatTimeStamp(revision.getTimeStamp()) + " / "
+ + CDOCommonUtil.formatTimeStamp(revision.getRevised()));
+ out.println("</td>");
+ out.println("</tr>");
+ }
+
+ protected void dumpRevision(CDORevision revision, PrintStream out)
+ {
+ out.println(revision);
+ }
+ }
+ }
+ }
+
+ /**
+ * Compares {@link CDORevisionKey revision keys} by {@link CDORevision#getID() ID} and
+ * {@link CDORevision#getVersion() version}.
+ *
+ * @author Eike Stepper
+ * @since 4.0
+ * @apiviz.exclude
+ */
+ public static class CDORevisionComparator implements Comparator<CDORevisionKey>
+ {
+ public CDORevisionComparator()
+ {
+ }
+
+ public int compare(CDORevisionKey rev1, CDORevisionKey rev2)
+ {
+ int result = rev1.getID().compareTo(rev2.getID());
+ if (result == 0)
+ {
+ int version1 = rev1.getVersion();
+ int version2 = rev2.getVersion();
+ result = version1 < version2 ? -1 : version1 == version2 ? 0 : 1;
+ }
+
+ return result;
+ }
+ }
+
+ /**
+ * @author Eike Stepper
+ */
+ private static final class Uninitialized
+ {
+ public Uninitialized()
+ {
+ }
+
+ @Override
+ public String toString()
+ {
+ return Messages.getString("CDORevisionUtil.0"); //$NON-NLS-1$
+ }
+ }
+}
diff --git a/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/common/revision/delta/CDOAddFeatureDelta.java b/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/common/revision/delta/CDOAddFeatureDelta.java
index f1862fbcde..ace02a912f 100644
--- a/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/common/revision/delta/CDOAddFeatureDelta.java
+++ b/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/common/revision/delta/CDOAddFeatureDelta.java
@@ -1,29 +1,29 @@
-/*
- * Copyright (c) 2004 - 2011 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.revision.delta;
-
-import org.eclipse.emf.ecore.EStructuralFeature;
-
-/**
- * A {@link CDOFeatureDelta feature delta} that represents an addition to a many-valued {@link EStructuralFeature
- * feature}.
- *
- * @author Simon McDuff
- * @noextend This interface is not intended to be extended by clients.
- * @noimplement This interface is not intended to be implemented by clients.
- */
-public interface CDOAddFeatureDelta extends CDOFeatureDelta
-{
- public int getIndex();
-
- public Object getValue();
-}
+/*
+ * Copyright (c) 2004 - 2012 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.revision.delta;
+
+import org.eclipse.emf.ecore.EStructuralFeature;
+
+/**
+ * A {@link CDOFeatureDelta feature delta} that represents an addition to a many-valued {@link EStructuralFeature
+ * feature}.
+ *
+ * @author Simon McDuff
+ * @noextend This interface is not intended to be extended by clients.
+ * @noimplement This interface is not intended to be implemented by clients.
+ */
+public interface CDOAddFeatureDelta extends CDOFeatureDelta
+{
+ public int getIndex();
+
+ public Object getValue();
+}
diff --git a/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/common/revision/delta/CDOClearFeatureDelta.java b/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/common/revision/delta/CDOClearFeatureDelta.java
index 14e5c17b25..3e3e88ccac 100644
--- a/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/common/revision/delta/CDOClearFeatureDelta.java
+++ b/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/common/revision/delta/CDOClearFeatureDelta.java
@@ -1,26 +1,26 @@
-/*
- * Copyright (c) 2004 - 2011 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.revision.delta;
-
-import org.eclipse.emf.ecore.EStructuralFeature;
-
-/**
- * A {@link CDOFeatureDelta feature delta} that represents the removal of all elements from a many-valued
- * {@link EStructuralFeature feature}.
- *
- * @author Simon McDuff
- * @noextend This interface is not intended to be extended by clients.
- * @noimplement This interface is not intended to be implemented by clients.
- */
-public interface CDOClearFeatureDelta extends CDOFeatureDelta
-{
-}
+/*
+ * Copyright (c) 2004 - 2012 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.revision.delta;
+
+import org.eclipse.emf.ecore.EStructuralFeature;
+
+/**
+ * A {@link CDOFeatureDelta feature delta} that represents the removal of all elements from a many-valued
+ * {@link EStructuralFeature feature}.
+ *
+ * @author Simon McDuff
+ * @noextend This interface is not intended to be extended by clients.
+ * @noimplement This interface is not intended to be implemented by clients.
+ */
+public interface CDOClearFeatureDelta extends CDOFeatureDelta
+{
+}
diff --git a/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/common/revision/delta/CDOContainerFeatureDelta.java b/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/common/revision/delta/CDOContainerFeatureDelta.java
index 628c213603..0a55ae00a6 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
@@ -1,46 +1,46 @@
-/*
- * Copyright (c) 2004 - 2011 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
- * Simon McDuff - bug 213402
- */
-package org.eclipse.emf.cdo.common.revision.delta;
-
-import org.eclipse.emf.cdo.common.id.CDOID;
-
-import org.eclipse.emf.ecore.EObject;
-import org.eclipse.emf.ecore.EReference;
-
-/**
- * A {@link CDOFeatureDelta feature delta} that represents a modification of the {@link EObject#eContainer() eContainer}
- * feature.
- *
- * @author Simon McDuff
- * @noextend This interface is not intended to be extended by clients.
- * @noimplement This interface is not intended to be implemented by clients.
- */
-public interface CDOContainerFeatureDelta extends CDOFeatureDelta
-{
- /**
- * @since 2.0
- */
- public static final EReference CONTAINER_FEATURE = new org.eclipse.emf.cdo.internal.common.revision.delta.CDOContainerFeatureDeltaImpl.ContainerFeature();
-
- /**
- * @since 2.0
- */
- public CDOID getResourceID();
-
- /**
- * @since 2.0
- */
- public Object getContainerID();
-
- public int getContainerFeatureID();
-}
+/*
+ * Copyright (c) 2004 - 2012 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
+ * Simon McDuff - bug 213402
+ */
+package org.eclipse.emf.cdo.common.revision.delta;
+
+import org.eclipse.emf.cdo.common.id.CDOID;
+
+import org.eclipse.emf.ecore.EObject;
+import org.eclipse.emf.ecore.EReference;
+
+/**
+ * A {@link CDOFeatureDelta feature delta} that represents a modification of the {@link EObject#eContainer() eContainer}
+ * feature.
+ *
+ * @author Simon McDuff
+ * @noextend This interface is not intended to be extended by clients.
+ * @noimplement This interface is not intended to be implemented by clients.
+ */
+public interface CDOContainerFeatureDelta extends CDOFeatureDelta
+{
+ /**
+ * @since 2.0
+ */
+ public static final EReference CONTAINER_FEATURE = new org.eclipse.emf.cdo.internal.common.revision.delta.CDOContainerFeatureDeltaImpl.ContainerFeature();
+
+ /**
+ * @since 2.0
+ */
+ public CDOID getResourceID();
+
+ /**
+ * @since 2.0
+ */
+ public Object getContainerID();
+
+ public int getContainerFeatureID();
+}
diff --git a/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/common/revision/delta/CDOFeatureDelta.java b/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/common/revision/delta/CDOFeatureDelta.java
index c7ae6f3852..c911e1d782 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
@@ -1,78 +1,78 @@
-/*
- * Copyright (c) 2004 - 2011 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.revision.delta;
-
-import org.eclipse.emf.cdo.common.revision.CDORevision;
-
-import org.eclipse.emf.common.notify.Notification;
-import org.eclipse.emf.ecore.EStructuralFeature;
-
-/**
- * Represents a change delta between two values of a single {@link EStructuralFeature feature}.
- *
- * @author Simon McDuff
- * @noextend This interface is not intended to be extended by clients.
- * @noimplement This interface is not intended to be implemented by clients.
- * @apiviz.landmark
- * @apiviz.has {@link org.eclipse.emf.ecore.EStructuralFeature}
- * @apiviz.has {@link CDOFeatureDelta.Type}
- */
-public interface CDOFeatureDelta
-{
- /**
- * @since 4.0
- */
- public static final int NO_INDEX = Notification.NO_INDEX;
-
- /**
- * @since 3.0
- */
- public static final Object UNKNOWN_VALUE = new Object()
- {
- @Override
- public String toString()
- {
- return "UNKNOWN"; //$NON-NLS-1$
- }
- };
-
- public Type getType();
-
- /**
- * @since 2.0
- */
- public EStructuralFeature getFeature();
-
- public void apply(CDORevision revision);
-
- public void accept(CDOFeatureDeltaVisitor visitor);
-
- /**
- * @since 3.0
- */
- public CDOFeatureDelta copy();
-
- /**
- * @since 4.0
- */
- public boolean isStructurallyEqual(Object obj);
-
- /**
- * Enumerates the possible types of {@link CDOFeatureDelta feature deltas}.
- *
- * @author Simon McDuff
- */
- public enum Type
- {
- ADD, REMOVE, CLEAR, MOVE, SET, UNSET, LIST, CONTAINER
- }
-}
+/*
+ * Copyright (c) 2004 - 2012 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.revision.delta;
+
+import org.eclipse.emf.cdo.common.revision.CDORevision;
+
+import org.eclipse.emf.common.notify.Notification;
+import org.eclipse.emf.ecore.EStructuralFeature;
+
+/**
+ * Represents a change delta between two values of a single {@link EStructuralFeature feature}.
+ *
+ * @author Simon McDuff
+ * @noextend This interface is not intended to be extended by clients.
+ * @noimplement This interface is not intended to be implemented by clients.
+ * @apiviz.landmark
+ * @apiviz.has {@link org.eclipse.emf.ecore.EStructuralFeature}
+ * @apiviz.has {@link CDOFeatureDelta.Type}
+ */
+public interface CDOFeatureDelta
+{
+ /**
+ * @since 4.0
+ */
+ public static final int NO_INDEX = Notification.NO_INDEX;
+
+ /**
+ * @since 3.0
+ */
+ public static final Object UNKNOWN_VALUE = new Object()
+ {
+ @Override
+ public String toString()
+ {
+ return "UNKNOWN"; //$NON-NLS-1$
+ }
+ };
+
+ public Type getType();
+
+ /**
+ * @since 2.0
+ */
+ public EStructuralFeature getFeature();
+
+ public void apply(CDORevision revision);
+
+ public void accept(CDOFeatureDeltaVisitor visitor);
+
+ /**
+ * @since 3.0
+ */
+ public CDOFeatureDelta copy();
+
+ /**
+ * @since 4.0
+ */
+ public boolean isStructurallyEqual(Object obj);
+
+ /**
+ * Enumerates the possible types of {@link CDOFeatureDelta feature deltas}.
+ *
+ * @author Simon McDuff
+ */
+ public enum Type
+ {
+ ADD, REMOVE, CLEAR, MOVE, SET, UNSET, LIST, CONTAINER
+ }
+}
diff --git a/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/common/revision/delta/CDOFeatureDeltaVisitor.java b/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/common/revision/delta/CDOFeatureDeltaVisitor.java
index 17fb77151f..f86ff72900 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
@@ -1,38 +1,38 @@
-/*
- * Copyright (c) 2004 - 2011 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.revision.delta;
-
-/**
- * Visits all {@link CDOFeatureDelta feature deltas} of a {@link CDORevisionDelta revision delta}.
- *
- * @see CDORevisionDelta#accept(CDOFeatureDeltaVisitor)
- * @author Simon McDuff
- * @apiviz.uses {@link CDOFeatureDelta} - - visits
- */
-public interface CDOFeatureDeltaVisitor
-{
- public void visit(CDOMoveFeatureDelta delta);
-
- public void visit(CDOAddFeatureDelta delta);
-
- public void visit(CDORemoveFeatureDelta delta);
-
- public void visit(CDOSetFeatureDelta delta);
-
- public void visit(CDOUnsetFeatureDelta delta);
-
- public void visit(CDOListFeatureDelta delta);
-
- public void visit(CDOClearFeatureDelta delta);
-
- public void visit(CDOContainerFeatureDelta delta);
-}
+/*
+ * Copyright (c) 2004 - 2012 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.revision.delta;
+
+/**
+ * Visits all {@link CDOFeatureDelta feature deltas} of a {@link CDORevisionDelta revision delta}.
+ *
+ * @see CDORevisionDelta#accept(CDOFeatureDeltaVisitor)
+ * @author Simon McDuff
+ * @apiviz.uses {@link CDOFeatureDelta} - - visits
+ */
+public interface CDOFeatureDeltaVisitor
+{
+ public void visit(CDOMoveFeatureDelta delta);
+
+ public void visit(CDOAddFeatureDelta delta);
+
+ public void visit(CDORemoveFeatureDelta delta);
+
+ public void visit(CDOSetFeatureDelta delta);
+
+ public void visit(CDOUnsetFeatureDelta delta);
+
+ public void visit(CDOListFeatureDelta delta);
+
+ public void visit(CDOClearFeatureDelta delta);
+
+ public void visit(CDOContainerFeatureDelta delta);
+}
diff --git a/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/common/revision/delta/CDOListFeatureDelta.java b/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/common/revision/delta/CDOListFeatureDelta.java
index c0b15aee40..1495f5e188 100644
--- a/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/common/revision/delta/CDOListFeatureDelta.java
+++ b/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/common/revision/delta/CDOListFeatureDelta.java
@@ -1,31 +1,31 @@
-/*
- * Copyright (c) 2004 - 2011 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.revision.delta;
-
-import org.eclipse.emf.ecore.EStructuralFeature;
-
-import java.util.List;
-
-/**
- * A {@link CDOFeatureDelta feature delta} that represents any modification of the list of a many-valued
- * {@link EStructuralFeature feature}. The detailed changes to this list are returned by the {@link #getListChanges()}
- * method.
- *
- * @author Simon McDuff
- * @noextend This interface is not intended to be extended by clients.
- * @noimplement This interface is not intended to be implemented by clients.
- * @apiviz.composedOf {@link CDOFeatureDelta} - - listChanges
- */
-public interface CDOListFeatureDelta extends CDOFeatureDelta
-{
- public List<CDOFeatureDelta> getListChanges();
-}
+/*
+ * Copyright (c) 2004 - 2012 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.revision.delta;
+
+import org.eclipse.emf.ecore.EStructuralFeature;
+
+import java.util.List;
+
+/**
+ * A {@link CDOFeatureDelta feature delta} that represents any modification of the list of a many-valued
+ * {@link EStructuralFeature feature}. The detailed changes to this list are returned by the {@link #getListChanges()}
+ * method.
+ *
+ * @author Simon McDuff
+ * @noextend This interface is not intended to be extended by clients.
+ * @noimplement This interface is not intended to be implemented by clients.
+ * @apiviz.composedOf {@link CDOFeatureDelta} - - listChanges
+ */
+public interface CDOListFeatureDelta extends CDOFeatureDelta
+{
+ public List<CDOFeatureDelta> getListChanges();
+}
diff --git a/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/common/revision/delta/CDOMoveFeatureDelta.java b/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/common/revision/delta/CDOMoveFeatureDelta.java
index 669309bfe6..a2f5ad9ca2 100644
--- a/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/common/revision/delta/CDOMoveFeatureDelta.java
+++ b/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/common/revision/delta/CDOMoveFeatureDelta.java
@@ -1,34 +1,34 @@
-/*
- * Copyright (c) 2004 - 2011 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.revision.delta;
-
-import org.eclipse.emf.ecore.EStructuralFeature;
-
-/**
- * A {@link CDOFeatureDelta feature delta} that represents a move of one element of a many-valued
- * {@link EStructuralFeature feature} to a different list position.
- *
- * @author Simon McDuff
- * @noextend This interface is not intended to be extended by clients.
- * @noimplement This interface is not intended to be implemented by clients.
- */
-public interface CDOMoveFeatureDelta extends CDOFeatureDelta
-{
- public int getOldPosition();
-
- public int getNewPosition();
-
- /**
- * @since 4.0
- */
- public Object getValue();
-}
+/*
+ * Copyright (c) 2004 - 2012 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.revision.delta;
+
+import org.eclipse.emf.ecore.EStructuralFeature;
+
+/**
+ * A {@link CDOFeatureDelta feature delta} that represents a move of one element of a many-valued
+ * {@link EStructuralFeature feature} to a different list position.
+ *
+ * @author Simon McDuff
+ * @noextend This interface is not intended to be extended by clients.
+ * @noimplement This interface is not intended to be implemented by clients.
+ */
+public interface CDOMoveFeatureDelta extends CDOFeatureDelta
+{
+ public int getOldPosition();
+
+ public int getNewPosition();
+
+ /**
+ * @since 4.0
+ */
+ public Object getValue();
+}
diff --git a/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/common/revision/delta/CDORemoveFeatureDelta.java b/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/common/revision/delta/CDORemoveFeatureDelta.java
index 530ccd0129..578c6de287 100644
--- a/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/common/revision/delta/CDORemoveFeatureDelta.java
+++ b/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/common/revision/delta/CDORemoveFeatureDelta.java
@@ -1,32 +1,32 @@
-/*
- * Copyright (c) 2004 - 2011 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.revision.delta;
-
-import org.eclipse.emf.ecore.EStructuralFeature;
-
-/**
- * A {@link CDOFeatureDelta feature delta} that represents a removal from a many-valued {@link EStructuralFeature
- * feature}.
- *
- * @author Simon McDuff
- * @noextend This interface is not intended to be extended by clients.
- * @noimplement This interface is not intended to be implemented by clients.
- */
-public interface CDORemoveFeatureDelta extends CDOFeatureDelta
-{
- public int getIndex();
-
- /**
- * @since 3.0
- */
- public Object getValue();
-}
+/*
+ * Copyright (c) 2004 - 2012 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.revision.delta;
+
+import org.eclipse.emf.ecore.EStructuralFeature;
+
+/**
+ * A {@link CDOFeatureDelta feature delta} that represents a removal from a many-valued {@link EStructuralFeature
+ * feature}.
+ *
+ * @author Simon McDuff
+ * @noextend This interface is not intended to be extended by clients.
+ * @noimplement This interface is not intended to be implemented by clients.
+ */
+public interface CDORemoveFeatureDelta extends CDOFeatureDelta
+{
+ public int getIndex();
+
+ /**
+ * @since 3.0
+ */
+ public Object getValue();
+}
diff --git a/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/common/revision/delta/CDORevisionDelta.java b/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/common/revision/delta/CDORevisionDelta.java
index 47c8433db5..a9d6a4e639 100644
--- a/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/common/revision/delta/CDORevisionDelta.java
+++ b/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/common/revision/delta/CDORevisionDelta.java
@@ -1,88 +1,88 @@
-/*
- * Copyright (c) 2004 - 2011 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 - bug 201266
- */
-package org.eclipse.emf.cdo.common.revision.delta;
-
-import org.eclipse.emf.cdo.common.branch.CDOBranchPoint;
-import org.eclipse.emf.cdo.common.branch.CDOBranchVersion;
-import org.eclipse.emf.cdo.common.revision.CDORevisable;
-import org.eclipse.emf.cdo.common.revision.CDORevision;
-import org.eclipse.emf.cdo.common.revision.CDORevisionData;
-import org.eclipse.emf.cdo.common.revision.CDORevisionKey;
-import org.eclipse.emf.cdo.internal.common.revision.delta.CDODetachedRevisionDeltaImpl;
-
-import org.eclipse.emf.ecore.EClass;
-import org.eclipse.emf.ecore.EStructuralFeature;
-
-import java.util.List;
-
-/**
- * Represents the change delta between two {@link CDORevision revisions} of a CDO object. The detailed
- * {@link CDOFeatureDelta feature deltas} are returned by the {@link #getFeatureDeltas()} method.
- *
- * @author Eike Stepper
- * @since 2.0
- * @noextend This interface is not intended to be extended by clients.
- * @noimplement This interface is not intended to be implemented by clients.
- * @apiviz.landmark
- * @apiviz.has {@link org.eclipse.emf.ecore.EClass}
- * @apiviz.has {@link org.eclipse.emf.cdo.common.revision.CDORevisable} oneway - - target
- * @apiviz.composedOf {@link CDOFeatureDelta}
- */
-public interface CDORevisionDelta extends CDORevisionKey
-{
- /**
- * This constant is only passed into conflict resolvers to indicate that a conflict was caused by remote detachment of
- * an object. Calling any method on this marker instance will result in an {@link UnsupportedOperationException} being
- * thrown.
- *
- * @since 4.0
- */
- public static final CDORevisionDelta DETACHED = new CDODetachedRevisionDeltaImpl();
-
- /**
- * @since 3.0
- */
- public EClass getEClass();
-
- /**
- * @since 4.0
- */
- public CDORevisable getTarget();
-
- /**
- * @since 3.0
- */
- public boolean isEmpty();
-
- /**
- * @since 4.0
- */
- public CDORevisionDelta copy();
-
- /**
- * @since 4.0
- */
- public CDOFeatureDelta getFeatureDelta(EStructuralFeature feature);
-
- public List<CDOFeatureDelta> getFeatureDeltas();
-
- /**
- * Applies the {@link #getFeatureDeltas() feature deltas} in this revision delta to the {@link CDORevisionData data}
- * of the given revision.
- * <p>
- * The system data of the given revision, e.g. {@link CDOBranchPoint branch point} or {@link CDOBranchVersion branch
- * version} of the given revision are <b>not</b> modified.
- */
- public void apply(CDORevision revision);
-
- public void accept(CDOFeatureDeltaVisitor visitor);
-}
+/*
+ * Copyright (c) 2004 - 2012 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 - bug 201266
+ */
+package org.eclipse.emf.cdo.common.revision.delta;
+
+import org.eclipse.emf.cdo.common.branch.CDOBranchPoint;
+import org.eclipse.emf.cdo.common.branch.CDOBranchVersion;
+import org.eclipse.emf.cdo.common.revision.CDORevisable;
+import org.eclipse.emf.cdo.common.revision.CDORevision;
+import org.eclipse.emf.cdo.common.revision.CDORevisionData;
+import org.eclipse.emf.cdo.common.revision.CDORevisionKey;
+import org.eclipse.emf.cdo.internal.common.revision.delta.CDODetachedRevisionDeltaImpl;
+
+import org.eclipse.emf.ecore.EClass;
+import org.eclipse.emf.ecore.EStructuralFeature;
+
+import java.util.List;
+
+/**
+ * Represents the change delta between two {@link CDORevision revisions} of a CDO object. The detailed
+ * {@link CDOFeatureDelta feature deltas} are returned by the {@link #getFeatureDeltas()} method.
+ *
+ * @author Eike Stepper
+ * @since 2.0
+ * @noextend This interface is not intended to be extended by clients.
+ * @noimplement This interface is not intended to be implemented by clients.
+ * @apiviz.landmark
+ * @apiviz.has {@link org.eclipse.emf.ecore.EClass}
+ * @apiviz.has {@link org.eclipse.emf.cdo.common.revision.CDORevisable} oneway - - target
+ * @apiviz.composedOf {@link CDOFeatureDelta}
+ */
+public interface CDORevisionDelta extends CDORevisionKey
+{
+ /**
+ * This constant is only passed into conflict resolvers to indicate that a conflict was caused by remote detachment of
+ * an object. Calling any method on this marker instance will result in an {@link UnsupportedOperationException} being
+ * thrown.
+ *
+ * @since 4.0
+ */
+ public static final CDORevisionDelta DETACHED = new CDODetachedRevisionDeltaImpl();
+
+ /**
+ * @since 3.0
+ */
+ public EClass getEClass();
+
+ /**
+ * @since 4.0
+ */
+ public CDORevisable getTarget();
+
+ /**
+ * @since 3.0
+ */
+ public boolean isEmpty();
+
+ /**
+ * @since 4.0
+ */
+ public CDORevisionDelta copy();
+
+ /**
+ * @since 4.0
+ */
+ public CDOFeatureDelta getFeatureDelta(EStructuralFeature feature);
+
+ public List<CDOFeatureDelta> getFeatureDeltas();
+
+ /**
+ * Applies the {@link #getFeatureDeltas() feature deltas} in this revision delta to the {@link CDORevisionData data}
+ * of the given revision.
+ * <p>
+ * The system data of the given revision, e.g. {@link CDOBranchPoint branch point} or {@link CDOBranchVersion branch
+ * version} of the given revision are <b>not</b> modified.
+ */
+ public void apply(CDORevision revision);
+
+ public void accept(CDOFeatureDeltaVisitor visitor);
+}
diff --git a/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/common/revision/delta/CDORevisionDeltaProvider.java b/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/common/revision/delta/CDORevisionDeltaProvider.java
index 213f842b4c..f5f99b1582 100644
--- a/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/common/revision/delta/CDORevisionDeltaProvider.java
+++ b/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/common/revision/delta/CDORevisionDeltaProvider.java
@@ -1,25 +1,25 @@
-/*
- * Copyright (c) 2004 - 2011 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.revision.delta;
-
-import org.eclipse.emf.cdo.common.id.CDOID;
-
-/**
- * Provides consumers with the {@link CDORevisionDelta revision deltas} of {@link CDOID identifiable} CDO objects.
- *
- * @author Eike Stepper
- * @since 4.0
- * @apiviz.uses {@link CDORevisionDelta} - - provides
- */
-public interface CDORevisionDeltaProvider
-{
- public CDORevisionDelta getRevisionDelta(CDOID id);
-}
+/*
+ * Copyright (c) 2004 - 2012 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.revision.delta;
+
+import org.eclipse.emf.cdo.common.id.CDOID;
+
+/**
+ * Provides consumers with the {@link CDORevisionDelta revision deltas} of {@link CDOID identifiable} CDO objects.
+ *
+ * @author Eike Stepper
+ * @since 4.0
+ * @apiviz.uses {@link CDORevisionDelta} - - provides
+ */
+public interface CDORevisionDeltaProvider
+{
+ public CDORevisionDelta getRevisionDelta(CDOID id);
+}
diff --git a/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/common/revision/delta/CDOSetFeatureDelta.java b/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/common/revision/delta/CDOSetFeatureDelta.java
index bbcc2ad3ef..36f43c2755 100644
--- a/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/common/revision/delta/CDOSetFeatureDelta.java
+++ b/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/common/revision/delta/CDOSetFeatureDelta.java
@@ -1,39 +1,39 @@
-/*
- * Copyright (c) 2004 - 2011 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.revision.delta;
-
-import org.eclipse.emf.ecore.EStructuralFeature;
-
-/**
- * A {@link CDOFeatureDelta feature delta} that represents a value change of a single-valued {@link EStructuralFeature
- * feature}.
- *
- * @author Simon McDuff
- * @noextend This interface is not intended to be extended by clients.
- * @noimplement This interface is not intended to be implemented by clients.
- */
-public interface CDOSetFeatureDelta extends CDOFeatureDelta
-{
- /**
- * @since 4.0
- */
- public static final Object UNSPECIFIED = new Object();
-
- public int getIndex();
-
- public Object getValue();
-
- /**
- * @since 4.0
- */
- public Object getOldValue();
-}
+/*
+ * Copyright (c) 2004 - 2012 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.revision.delta;
+
+import org.eclipse.emf.ecore.EStructuralFeature;
+
+/**
+ * A {@link CDOFeatureDelta feature delta} that represents a value change of a single-valued {@link EStructuralFeature
+ * feature}.
+ *
+ * @author Simon McDuff
+ * @noextend This interface is not intended to be extended by clients.
+ * @noimplement This interface is not intended to be implemented by clients.
+ */
+public interface CDOSetFeatureDelta extends CDOFeatureDelta
+{
+ /**
+ * @since 4.0
+ */
+ public static final Object UNSPECIFIED = new Object();
+
+ public int getIndex();
+
+ public Object getValue();
+
+ /**
+ * @since 4.0
+ */
+ public Object getOldValue();
+}
diff --git a/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/common/revision/delta/CDOUnsetFeatureDelta.java b/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/common/revision/delta/CDOUnsetFeatureDelta.java
index fccb6b57f1..a3e495f42a 100644
--- a/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/common/revision/delta/CDOUnsetFeatureDelta.java
+++ b/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/common/revision/delta/CDOUnsetFeatureDelta.java
@@ -1,26 +1,26 @@
-/*
- * Copyright (c) 2004 - 2011 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.revision.delta;
-
-import org.eclipse.emf.ecore.EStructuralFeature;
-
-/**
- * A {@link CDOFeatureDelta feature delta} that represents the <em>unsetting</em> of the value of a
- * {@link EStructuralFeature feature}.
- *
- * @author Simon McDuff
- * @noextend This interface is not intended to be extended by clients.
- * @noimplement This interface is not intended to be implemented by clients.
- */
-public interface CDOUnsetFeatureDelta extends CDOFeatureDelta
-{
-}
+/*
+ * Copyright (c) 2004 - 2012 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.revision.delta;
+
+import org.eclipse.emf.ecore.EStructuralFeature;
+
+/**
+ * A {@link CDOFeatureDelta feature delta} that represents the <em>unsetting</em> of the value of a
+ * {@link EStructuralFeature feature}.
+ *
+ * @author Simon McDuff
+ * @noextend This interface is not intended to be extended by clients.
+ * @noimplement This interface is not intended to be implemented by clients.
+ */
+public interface CDOUnsetFeatureDelta extends CDOFeatureDelta
+{
+}
diff --git a/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/common/revision/delta/package-info.java b/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/common/revision/delta/package-info.java
index c0b93c464b..244301ea74 100644
--- a/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/common/revision/delta/package-info.java
+++ b/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/common/revision/delta/package-info.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2004 - 2011 Eike Stepper (Berlin, Germany) and others.
+ * Copyright (c) 2004 - 2012 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
diff --git a/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/common/revision/package-info.java b/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/common/revision/package-info.java
index d33bb844ec..7797a7f021 100644
--- a/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/common/revision/package-info.java
+++ b/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/common/revision/package-info.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2004 - 2011 Eike Stepper (Berlin, Germany) and others.
+ * Copyright (c) 2004 - 2012 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
diff --git a/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/common/util/BlockingCloseableIterator.java b/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/common/util/BlockingCloseableIterator.java
index 8686d490e0..7b2e36e181 100644
--- a/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/common/util/BlockingCloseableIterator.java
+++ b/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/common/util/BlockingCloseableIterator.java
@@ -1,29 +1,29 @@
-/*
- * Copyright (c) 2004 - 2011 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.util;
-
-import org.eclipse.net4j.util.collection.CloseableIterator;
-
-/**
- * A closeable iterator that blocks on {@link #hasNext()} until the next element is available or the end of the
- * iteration is reached.
- *
- * @author Simon McDuff
- * @since 2.0
- */
-public interface BlockingCloseableIterator<T> extends CloseableIterator<T>
-{
- /**
- * Non-blocking call.
- */
- public T peek();
-}
+/*
+ * Copyright (c) 2004 - 2012 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.util;
+
+import org.eclipse.net4j.util.collection.CloseableIterator;
+
+/**
+ * A closeable iterator that blocks on {@link #hasNext()} until the next element is available or the end of the
+ * iteration is reached.
+ *
+ * @author Simon McDuff
+ * @since 2.0
+ */
+public interface BlockingCloseableIterator<T> extends CloseableIterator<T>
+{
+ /**
+ * Non-blocking call.
+ */
+ public T peek();
+}
diff --git a/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/common/util/CDOCommonEventAdapter.java b/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/common/util/CDOCommonEventAdapter.java
index 111ab1ae86..ca59d4e14b 100644
--- a/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/common/util/CDOCommonEventAdapter.java
+++ b/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/common/util/CDOCommonEventAdapter.java
@@ -1,85 +1,85 @@
-/*
- * Copyright (c) 2004 - 2011 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.util;
-
-import org.eclipse.emf.cdo.common.CDOCommonSession;
-import org.eclipse.emf.cdo.common.CDOCommonSession.Options.PassiveUpdateMode;
-import org.eclipse.emf.cdo.common.CDOCommonView;
-
-import org.eclipse.net4j.util.container.ContainerEventAdapter;
-import org.eclipse.net4j.util.container.IContainer;
-import org.eclipse.net4j.util.event.IEvent;
-
-/**
- * A convenience adapter for common CDO {@link IEvent events}.
- *
- * @author Eike Stepper
- * @since 3.0
- */
-public class CDOCommonEventAdapter extends ContainerEventAdapter<Object>
-{
- public CDOCommonEventAdapter()
- {
- }
-
- @Override
- protected void notifyOtherEvent(IEvent event)
- {
- if (event instanceof CDOCommonSession.Options.PassiveUpdateEvent)
- {
- CDOCommonSession.Options.PassiveUpdateEvent e = (CDOCommonSession.Options.PassiveUpdateEvent)event;
- boolean oldEnabled = e.getOldEnabled();
- boolean newEnabled = e.getNewEnabled();
- if (oldEnabled != newEnabled)
- {
- onPassiveUpdatesEnabled(oldEnabled, newEnabled);
- }
- else
- {
- onPassiveUpdatesMode(e.getOldMode(), e.getNewMode());
- }
- }
- }
-
- @Override
- protected void onAdded(IContainer<Object> container, Object element)
- {
- if (element instanceof CDOCommonView)
- {
- onViewOpened((CDOCommonView)element);
- }
- }
-
- @Override
- protected void onRemoved(IContainer<Object> container, Object element)
- {
- if (element instanceof CDOCommonView)
- {
- onViewClosed((CDOCommonView)element);
- }
- }
-
- protected void onViewOpened(CDOCommonView view)
- {
- }
-
- protected void onViewClosed(CDOCommonView element)
- {
- }
-
- protected void onPassiveUpdatesEnabled(boolean oldEnabled, boolean newEnabled)
- {
- }
-
- protected void onPassiveUpdatesMode(PassiveUpdateMode oldMode, PassiveUpdateMode newMode)
- {
- }
-}
+/*
+ * Copyright (c) 2004 - 2012 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.util;
+
+import org.eclipse.emf.cdo.common.CDOCommonSession;
+import org.eclipse.emf.cdo.common.CDOCommonSession.Options.PassiveUpdateMode;
+import org.eclipse.emf.cdo.common.CDOCommonView;
+
+import org.eclipse.net4j.util.container.ContainerEventAdapter;
+import org.eclipse.net4j.util.container.IContainer;
+import org.eclipse.net4j.util.event.IEvent;
+
+/**
+ * A convenience adapter for common CDO {@link IEvent events}.
+ *
+ * @author Eike Stepper
+ * @since 3.0
+ */
+public class CDOCommonEventAdapter extends ContainerEventAdapter<Object>
+{
+ public CDOCommonEventAdapter()
+ {
+ }
+
+ @Override
+ protected void notifyOtherEvent(IEvent event)
+ {
+ if (event instanceof CDOCommonSession.Options.PassiveUpdateEvent)
+ {
+ CDOCommonSession.Options.PassiveUpdateEvent e = (CDOCommonSession.Options.PassiveUpdateEvent)event;
+ boolean oldEnabled = e.getOldEnabled();
+ boolean newEnabled = e.getNewEnabled();
+ if (oldEnabled != newEnabled)
+ {
+ onPassiveUpdatesEnabled(oldEnabled, newEnabled);
+ }
+ else
+ {
+ onPassiveUpdatesMode(e.getOldMode(), e.getNewMode());
+ }
+ }
+ }
+
+ @Override
+ protected void onAdded(IContainer<Object> container, Object element)
+ {
+ if (element instanceof CDOCommonView)
+ {
+ onViewOpened((CDOCommonView)element);
+ }
+ }
+
+ @Override
+ protected void onRemoved(IContainer<Object> container, Object element)
+ {
+ if (element instanceof CDOCommonView)
+ {
+ onViewClosed((CDOCommonView)element);
+ }
+ }
+
+ protected void onViewOpened(CDOCommonView view)
+ {
+ }
+
+ protected void onViewClosed(CDOCommonView element)
+ {
+ }
+
+ protected void onPassiveUpdatesEnabled(boolean oldEnabled, boolean newEnabled)
+ {
+ }
+
+ protected void onPassiveUpdatesMode(PassiveUpdateMode oldMode, PassiveUpdateMode newMode)
+ {
+ }
+}
diff --git a/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/common/util/CDOCommonUtil.java b/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/common/util/CDOCommonUtil.java
index 4dab399657..16785e73c4 100644
--- a/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/common/util/CDOCommonUtil.java
+++ b/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/common/util/CDOCommonUtil.java
@@ -1,174 +1,174 @@
-/*
- * Copyright (c) 2004 - 2011 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.util;
-
-import org.eclipse.emf.cdo.common.branch.CDOBranchManager;
-import org.eclipse.emf.cdo.common.branch.CDOBranchPoint;
-import org.eclipse.emf.cdo.common.commit.CDOCommitInfoManager;
-import org.eclipse.emf.cdo.common.id.CDOIDProvider;
-import org.eclipse.emf.cdo.common.lob.CDOLobStore;
-import org.eclipse.emf.cdo.common.model.CDOPackageRegistry;
-import org.eclipse.emf.cdo.common.protocol.CDODataInput;
-import org.eclipse.emf.cdo.common.protocol.CDODataOutput;
-import org.eclipse.emf.cdo.common.revision.CDOListFactory;
-import org.eclipse.emf.cdo.common.revision.CDORevision;
-import org.eclipse.emf.cdo.common.revision.CDORevisionFactory;
-import org.eclipse.emf.cdo.internal.common.protocol.CDODataInputImpl;
-import org.eclipse.emf.cdo.internal.common.protocol.CDODataOutputImpl;
-
-import org.eclipse.net4j.util.io.ExtendedDataInputStream;
-import org.eclipse.net4j.util.io.ExtendedDataOutput;
-
-import java.io.IOException;
-import java.text.ParseException;
-import java.text.SimpleDateFormat;
-import java.util.Date;
-
-/**
- * Various static methods that may help with I/O and time stamps.
- *
- * @author Eike Stepper
- * @since 3.0
- */
-public final class CDOCommonUtil
-{
- /**
- * @since 4.0
- */
- public static final SimpleDateFormat DATE_FORMAT = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss'.'SSS");
-
- private CDOCommonUtil()
- {
- }
-
- /**
- * @since 4.0
- */
- public static CDODataInput createCDODataInput(ExtendedDataInputStream inputStream,
- final CDOPackageRegistry packageRegistry, final CDOBranchManager branchManager,
- final CDOCommitInfoManager commitManager, final CDORevisionFactory revisionFactory,
- final CDOListFactory listFactory, final CDOLobStore lobStore) throws IOException
- {
- return new CDODataInputImpl(inputStream)
- {
- @Override
- protected CDOPackageRegistry getPackageRegistry()
- {
- return packageRegistry;
- }
-
- @Override
- protected CDOBranchManager getBranchManager()
- {
- return branchManager;
- }
-
- @Override
- protected CDOCommitInfoManager getCommitInfoManager()
- {
- return commitManager;
- }
-
- @Override
- protected CDORevisionFactory getRevisionFactory()
- {
- return revisionFactory;
- }
-
- @Override
- protected CDOListFactory getListFactory()
- {
- return listFactory;
- }
-
- @Override
- protected CDOLobStore getLobStore()
- {
- return lobStore;
- }
- };
- }
-
- /**
- * @since 4.0
- */
- public static CDODataOutput createCDODataOutput(ExtendedDataOutput extendedDataOutputStream,
- final CDOPackageRegistry packageRegistry, final CDOIDProvider idProvider)
- {
- return new CDODataOutputImpl(extendedDataOutputStream)
- {
- @Override
- public CDOPackageRegistry getPackageRegistry()
- {
- return packageRegistry;
- }
-
- @Override
- public CDOIDProvider getIDProvider()
- {
- return idProvider;
- }
- };
- }
-
- public static boolean isValidTimeStamp(long timeStamp, long startTime, long endTime)
- {
- if (timeStamp == CDOBranchPoint.UNSPECIFIED_DATE)
- {
- return endTime == CDOBranchPoint.UNSPECIFIED_DATE;
- }
-
- return (endTime == CDOBranchPoint.UNSPECIFIED_DATE || endTime >= timeStamp) && timeStamp >= startTime;
- }
-
- public static int compareTimeStamps(long t1, long t2)
- {
- if (t1 == CDORevision.UNSPECIFIED_DATE)
- {
- t1 = Long.MAX_VALUE;
- }
-
- if (t2 == CDORevision.UNSPECIFIED_DATE)
- {
- t2 = Long.MAX_VALUE;
- }
-
- return t1 < t2 ? -1 : t1 == t2 ? 0 : 1;
- }
-
- public static String formatTimeStamp()
- {
- return formatTimeStamp(System.currentTimeMillis());
- }
-
- public static String formatTimeStamp(long timeStamp)
- {
- if (timeStamp == CDORevision.UNSPECIFIED_DATE)
- {
- return "*";
- }
-
- return DATE_FORMAT.format(new Date(timeStamp));
- }
-
- /**
- * @since 4.0
- */
- public static long parseTimeStamp(String timeStamp) throws ParseException
- {
- if ("*".equals(timeStamp))
- {
- return CDORevision.UNSPECIFIED_DATE;
- }
-
- return DATE_FORMAT.parse(timeStamp).getTime();
- }
-}
+/*
+ * Copyright (c) 2004 - 2012 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.util;
+
+import org.eclipse.emf.cdo.common.branch.CDOBranchManager;
+import org.eclipse.emf.cdo.common.branch.CDOBranchPoint;
+import org.eclipse.emf.cdo.common.commit.CDOCommitInfoManager;
+import org.eclipse.emf.cdo.common.id.CDOIDProvider;
+import org.eclipse.emf.cdo.common.lob.CDOLobStore;
+import org.eclipse.emf.cdo.common.model.CDOPackageRegistry;
+import org.eclipse.emf.cdo.common.protocol.CDODataInput;
+import org.eclipse.emf.cdo.common.protocol.CDODataOutput;
+import org.eclipse.emf.cdo.common.revision.CDOListFactory;
+import org.eclipse.emf.cdo.common.revision.CDORevision;
+import org.eclipse.emf.cdo.common.revision.CDORevisionFactory;
+import org.eclipse.emf.cdo.internal.common.protocol.CDODataInputImpl;
+import org.eclipse.emf.cdo.internal.common.protocol.CDODataOutputImpl;
+
+import org.eclipse.net4j.util.io.ExtendedDataInputStream;
+import org.eclipse.net4j.util.io.ExtendedDataOutput;
+
+import java.io.IOException;
+import java.text.ParseException;
+import java.text.SimpleDateFormat;
+import java.util.Date;
+
+/**
+ * Various static methods that may help with I/O and time stamps.
+ *
+ * @author Eike Stepper
+ * @since 3.0
+ */
+public final class CDOCommonUtil
+{
+ /**
+ * @since 4.0
+ */
+ public static final SimpleDateFormat DATE_FORMAT = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss'.'SSS");
+
+ private CDOCommonUtil()
+ {
+ }
+
+ /**
+ * @since 4.0
+ */
+ public static CDODataInput createCDODataInput(ExtendedDataInputStream inputStream,
+ final CDOPackageRegistry packageRegistry, final CDOBranchManager branchManager,
+ final CDOCommitInfoManager commitManager, final CDORevisionFactory revisionFactory,
+ final CDOListFactory listFactory, final CDOLobStore lobStore) throws IOException
+ {
+ return new CDODataInputImpl(inputStream)
+ {
+ @Override
+ protected CDOPackageRegistry getPackageRegistry()
+ {
+ return packageRegistry;
+ }
+
+ @Override
+ protected CDOBranchManager getBranchManager()
+ {
+ return branchManager;
+ }
+
+ @Override
+ protected CDOCommitInfoManager getCommitInfoManager()
+ {
+ return commitManager;
+ }
+
+ @Override
+ protected CDORevisionFactory getRevisionFactory()
+ {
+ return revisionFactory;
+ }
+
+ @Override
+ protected CDOListFactory getListFactory()
+ {
+ return listFactory;
+ }
+
+ @Override
+ protected CDOLobStore getLobStore()
+ {
+ return lobStore;
+ }
+ };
+ }
+
+ /**
+ * @since 4.0
+ */
+ public static CDODataOutput createCDODataOutput(ExtendedDataOutput extendedDataOutputStream,
+ final CDOPackageRegistry packageRegistry, final CDOIDProvider idProvider)
+ {
+ return new CDODataOutputImpl(extendedDataOutputStream)
+ {
+ @Override
+ public CDOPackageRegistry getPackageRegistry()
+ {
+ return packageRegistry;
+ }
+
+ @Override
+ public CDOIDProvider getIDProvider()
+ {
+ return idProvider;
+ }
+ };
+ }
+
+ public static boolean isValidTimeStamp(long timeStamp, long startTime, long endTime)
+ {
+ if (timeStamp == CDOBranchPoint.UNSPECIFIED_DATE)
+ {
+ return endTime == CDOBranchPoint.UNSPECIFIED_DATE;
+ }
+
+ return (endTime == CDOBranchPoint.UNSPECIFIED_DATE || endTime >= timeStamp) && timeStamp >= startTime;
+ }
+
+ public static int compareTimeStamps(long t1, long t2)
+ {
+ if (t1 == CDORevision.UNSPECIFIED_DATE)
+ {
+ t1 = Long.MAX_VALUE;
+ }
+
+ if (t2 == CDORevision.UNSPECIFIED_DATE)
+ {
+ t2 = Long.MAX_VALUE;
+ }
+
+ return t1 < t2 ? -1 : t1 == t2 ? 0 : 1;
+ }
+
+ public static String formatTimeStamp()
+ {
+ return formatTimeStamp(System.currentTimeMillis());
+ }
+
+ public static String formatTimeStamp(long timeStamp)
+ {
+ if (timeStamp == CDORevision.UNSPECIFIED_DATE)
+ {
+ return "*";
+ }
+
+ return DATE_FORMAT.format(new Date(timeStamp));
+ }
+
+ /**
+ * @since 4.0
+ */
+ public static long parseTimeStamp(String timeStamp) throws ParseException
+ {
+ if ("*".equals(timeStamp))
+ {
+ return CDORevision.UNSPECIFIED_DATE;
+ }
+
+ return DATE_FORMAT.parse(timeStamp).getTime();
+ }
+}
diff --git a/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/common/util/CDOException.java b/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/common/util/CDOException.java
index 9be82f2df7..ad35efb2af 100644
--- a/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/common/util/CDOException.java
+++ b/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/common/util/CDOException.java
@@ -1,40 +1,40 @@
-/*
- * Copyright (c) 2004 - 2011 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.util;
-
-/**
- * An unchecked exception for general CDO purposes.
- *
- * @author Eike Stepper
- */
-public class CDOException extends RuntimeException
-{
- private static final long serialVersionUID = 1L;
-
- public CDOException()
- {
- }
-
- public CDOException(String message)
- {
- super(message);
- }
-
- public CDOException(Throwable cause)
- {
- super(cause);
- }
-
- public CDOException(String message, Throwable cause)
- {
- super(message, cause);
- }
-}
+/*
+ * Copyright (c) 2004 - 2012 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.util;
+
+/**
+ * An unchecked exception for general CDO purposes.
+ *
+ * @author Eike Stepper
+ */
+public class CDOException extends RuntimeException
+{
+ private static final long serialVersionUID = 1L;
+
+ public CDOException()
+ {
+ }
+
+ public CDOException(String message)
+ {
+ super(message);
+ }
+
+ public CDOException(Throwable cause)
+ {
+ super(cause);
+ }
+
+ public CDOException(String message, Throwable cause)
+ {
+ super(message, cause);
+ }
+}
diff --git a/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/common/util/CDOFetchRule.java b/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/common/util/CDOFetchRule.java
index 432c8ab0eb..f8fe8d88fb 100644
--- a/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/common/util/CDOFetchRule.java
+++ b/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/common/util/CDOFetchRule.java
@@ -1,88 +1,88 @@
-/*
- * Copyright (c) 2004 - 2011 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.util;
-
-import org.eclipse.emf.cdo.common.model.CDOPackageRegistry;
-import org.eclipse.emf.cdo.common.protocol.CDODataInput;
-import org.eclipse.emf.cdo.common.protocol.CDODataOutput;
-
-import org.eclipse.emf.ecore.EClass;
-import org.eclipse.emf.ecore.EStructuralFeature;
-
-import java.io.IOException;
-import java.util.ArrayList;
-import java.util.List;
-
-/**
- * Represents a subset of the {@link EStructuralFeature features} of a {@link EClass class}.
- *
- * @author Simon McDuff
- * @since 3.0
- */
-public final class CDOFetchRule
-{
- private EClass eClass;
-
- private List<EStructuralFeature> features = new ArrayList<EStructuralFeature>(0);
-
- public CDOFetchRule(EClass eClass)
- {
- this.eClass = eClass;
- }
-
- public CDOFetchRule(CDODataInput in, CDOPackageRegistry packageManager) throws IOException
- {
- eClass = (EClass)in.readCDOClassifierRefAndResolve();
- int size = in.readInt();
- for (int i = 0; i < size; i++)
- {
- int featureID = in.readInt();
- EStructuralFeature feature = eClass.getEStructuralFeature(featureID);
- features.add(feature);
- }
- }
-
- public void write(CDODataOutput out) throws IOException
- {
- out.writeCDOClassifierRef(eClass);
- out.writeInt(features.size());
- for (EStructuralFeature feature : features)
- {
- out.writeInt(feature.getFeatureID());
- }
- }
-
- public EClass getEClass()
- {
- return eClass;
- }
-
- public List<EStructuralFeature> getFeatures()
- {
- return features;
- }
-
- public void addFeature(EStructuralFeature feature)
- {
- features.add(feature);
- }
-
- public void removeFeature(EStructuralFeature feature)
- {
- features.remove(feature);
- }
-
- public boolean isEmpty()
- {
- return features.isEmpty();
- }
-}
+/*
+ * Copyright (c) 2004 - 2012 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.util;
+
+import org.eclipse.emf.cdo.common.model.CDOPackageRegistry;
+import org.eclipse.emf.cdo.common.protocol.CDODataInput;
+import org.eclipse.emf.cdo.common.protocol.CDODataOutput;
+
+import org.eclipse.emf.ecore.EClass;
+import org.eclipse.emf.ecore.EStructuralFeature;
+
+import java.io.IOException;
+import java.util.ArrayList;
+import java.util.List;
+
+/**
+ * Represents a subset of the {@link EStructuralFeature features} of a {@link EClass class}.
+ *
+ * @author Simon McDuff
+ * @since 3.0
+ */
+public final class CDOFetchRule
+{
+ private EClass eClass;
+
+ private List<EStructuralFeature> features = new ArrayList<EStructuralFeature>(0);
+
+ public CDOFetchRule(EClass eClass)
+ {
+ this.eClass = eClass;
+ }
+
+ public CDOFetchRule(CDODataInput in, CDOPackageRegistry packageManager) throws IOException
+ {
+ eClass = (EClass)in.readCDOClassifierRefAndResolve();
+ int size = in.readInt();
+ for (int i = 0; i < size; i++)
+ {
+ int featureID = in.readInt();
+ EStructuralFeature feature = eClass.getEStructuralFeature(featureID);
+ features.add(feature);
+ }
+ }
+
+ public void write(CDODataOutput out) throws IOException
+ {
+ out.writeCDOClassifierRef(eClass);
+ out.writeInt(features.size());
+ for (EStructuralFeature feature : features)
+ {
+ out.writeInt(feature.getFeatureID());
+ }
+ }
+
+ public EClass getEClass()
+ {
+ return eClass;
+ }
+
+ public List<EStructuralFeature> getFeatures()
+ {
+ return features;
+ }
+
+ public void addFeature(EStructuralFeature feature)
+ {
+ features.add(feature);
+ }
+
+ public void removeFeature(EStructuralFeature feature)
+ {
+ features.remove(feature);
+ }
+
+ public boolean isEmpty()
+ {
+ return features.isEmpty();
+ }
+}
diff --git a/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/common/util/CDOQueryInfo.java b/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/common/util/CDOQueryInfo.java
index 8f5880724b..8a8d19aa1e 100644
--- a/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/common/util/CDOQueryInfo.java
+++ b/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/common/util/CDOQueryInfo.java
@@ -1,75 +1,75 @@
-/*
- * Copyright (c) 2004 - 2011 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.util;
-
-import org.eclipse.emf.cdo.common.CDOCommonRepository;
-import org.eclipse.emf.cdo.common.CDOCommonView;
-import org.eclipse.emf.cdo.common.commit.CDOChangeSetData;
-
-import java.util.Map;
-
-/**
- * Encapsulates all the transferrable information that fully specifies a query from a {@link CDOCommonView view} to a
- * {@link CDOCommonRepository repository}.
- *
- * @author Simon McDuff
- * @since 3.0
- * @noextend This interface is not intended to be extended by clients.
- * @noimplement This interface is not intended to be implemented by clients.
- */
-public interface CDOQueryInfo
-{
- public static final int UNLIMITED_RESULTS = -1;
-
- /**
- * Returns the language identifier of this query, never <code>null</code>.
- */
- public String getQueryLanguage();
-
- /**
- * Returns the query string of this query or <code>null</code> if no query string has been set.
- */
- public String getQueryString();
-
- /**
- * Returns the parameters of this query as a map.
- */
- public Map<String, Object> getParameters();
-
- /**
- * Returns the context object, or <code>null</code> if no context is bound.
- *
- * @since 4.0
- */
- public Object getContext();
-
- /**
- * Returns the maximum number of results to retrieve or {@link #UNLIMITED_RESULTS} for no limitation.
- */
- public int getMaxResults();
-
- /**
- * Returns <code>true</code> if the view of this query had legacy mode enabled at the time this query was created,
- * <code>false</code> otherwise.
- *
- * @since 4.0
- */
- public boolean isLegacyModeEnabled();
-
- /**
- * Returns the {@link CDOChangeSetData change set} to be considered if this query has been created by a dirty
- * transaction, <code>null</code> otherwise.
- *
- * @since 4.0
- */
- public CDOChangeSetData getChangeSetData();
-}
+/*
+ * Copyright (c) 2004 - 2012 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.util;
+
+import org.eclipse.emf.cdo.common.CDOCommonRepository;
+import org.eclipse.emf.cdo.common.CDOCommonView;
+import org.eclipse.emf.cdo.common.commit.CDOChangeSetData;
+
+import java.util.Map;
+
+/**
+ * Encapsulates all the transferrable information that fully specifies a query from a {@link CDOCommonView view} to a
+ * {@link CDOCommonRepository repository}.
+ *
+ * @author Simon McDuff
+ * @since 3.0
+ * @noextend This interface is not intended to be extended by clients.
+ * @noimplement This interface is not intended to be implemented by clients.
+ */
+public interface CDOQueryInfo
+{
+ public static final int UNLIMITED_RESULTS = -1;
+
+ /**
+ * Returns the language identifier of this query, never <code>null</code>.
+ */
+ public String getQueryLanguage();
+
+ /**
+ * Returns the query string of this query or <code>null</code> if no query string has been set.
+ */
+ public String getQueryString();
+
+ /**
+ * Returns the parameters of this query as a map.
+ */
+ public Map<String, Object> getParameters();
+
+ /**
+ * Returns the context object, or <code>null</code> if no context is bound.
+ *
+ * @since 4.0
+ */
+ public Object getContext();
+
+ /**
+ * Returns the maximum number of results to retrieve or {@link #UNLIMITED_RESULTS} for no limitation.
+ */
+ public int getMaxResults();
+
+ /**
+ * Returns <code>true</code> if the view of this query had legacy mode enabled at the time this query was created,
+ * <code>false</code> otherwise.
+ *
+ * @since 4.0
+ */
+ public boolean isLegacyModeEnabled();
+
+ /**
+ * Returns the {@link CDOChangeSetData change set} to be considered if this query has been created by a dirty
+ * transaction, <code>null</code> otherwise.
+ *
+ * @since 4.0
+ */
+ public CDOChangeSetData getChangeSetData();
+}
diff --git a/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/common/util/CDOQueryQueue.java b/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/common/util/CDOQueryQueue.java
index deee8997ed..576522c67f 100644
--- a/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/common/util/CDOQueryQueue.java
+++ b/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/common/util/CDOQueryQueue.java
@@ -1,415 +1,415 @@
-/*
- * Copyright (c) 2004 - 2011 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.util;
-
-import org.eclipse.net4j.util.WrappedException;
-import org.eclipse.net4j.util.collection.Closeable;
-
-import java.util.Collection;
-import java.util.Comparator;
-import java.util.NoSuchElementException;
-import java.util.Queue;
-import java.util.concurrent.PriorityBlockingQueue;
-import java.util.concurrent.TimeUnit;
-import java.util.concurrent.atomic.AtomicLong;
-
-/**
- * The {@link Queue queue} that represents the result of a CDOQuery.
- *
- * @author Simon McDuff
- * @since 2.0
- * @noextend This interface is not intended to be extended by clients.
- * @noimplement This interface is not intended to be implemented by clients.
- */
-public class CDOQueryQueue<E> implements Queue<E>, Closeable
-{
- // Static not allowed due to <E>
- private final QueueEntry<E> QUEUE_CLOSED = new QueueEntry<E>();
-
- private PriorityBlockingQueue<QueueEntry<E>> queue = new PriorityBlockingQueue<QueueEntry<E>>(10);
-
- private boolean closed;
-
- private Object closeLock = new Object();
-
- public CDOQueryQueue()
- {
- }
-
- public void setException(Throwable exception)
- {
- queue.add(new QueueEntry<E>(exception));
- }
-
- public void close()
- {
- synchronized (closeLock)
- {
- if (!closed)
- {
- closed = true;
- queue.add(QUEUE_CLOSED);
- }
- }
- }
-
- public boolean isClosed()
- {
- synchronized (closeLock)
- {
- return closed;
- }
- }
-
- public boolean add(E e)
- {
- return queue.add(new QueueEntry<E>(e));
- }
-
- public void clear()
- {
- queue.clear();
- }
-
- public boolean contains(Object o)
- {
- return queue.contains(o);
- }
-
- public E element()
- {
- return checkObject(queue.element());
- }
-
- @Override
- public boolean equals(Object obj)
- {
- return queue.equals(obj);
- }
-
- @Override
- public int hashCode()
- {
- return queue.hashCode();
- }
-
- public boolean isEmpty()
- {
- return queue.isEmpty();
- }
-
- public BlockingCloseableIterator<E> iterator()
- {
- return new BlockingCloseableIteratorImpl();
- }
-
- public boolean offer(E e, long timeout, TimeUnit unit)
- {
- return queue.offer(new QueueEntry<E>(e), timeout, unit);
- }
-
- public boolean offer(E e)
- {
- return queue.offer(new QueueEntry<E>(e));
- }
-
- public E peek()
- {
- return checkObject(queue.peek());
- }
-
- public E poll(long timeout, TimeUnit unit) throws InterruptedException
- {
- return checkObject(queue.poll(timeout, unit));
- }
-
- public void put(E e)
- {
- queue.put(new QueueEntry<E>(e));
- }
-
- public int remainingCapacity()
- {
- return queue.remainingCapacity();
- }
-
- public E remove()
- {
- return checkObject(queue.remove());
- }
-
- public boolean remove(Object o)
- {
- return queue.remove(o);
- }
-
- public int size()
- {
- return queue.size();
- }
-
- public E take() throws InterruptedException
- {
- QueueEntry<E> entry = null;
-
- entry = queue.take();
-
- return checkObject(entry);
- }
-
- public Object[] toArray()
- {
- return queue.toArray();
- }
-
- @SuppressWarnings("unchecked")
- public Object[] toArray(Object[] a)
- {
- return queue.toArray(a);
- }
-
- @Override
- public String toString()
- {
- return queue.toString();
- }
-
- public E poll()
- {
- QueueEntry<E> entry = queue.poll();
- return checkObject(entry);
- }
-
- public Comparator<?> comparator()
- {
- throw new UnsupportedOperationException();
- }
-
- public boolean containsAll(Collection<?> c)
- {
- throw new UnsupportedOperationException();
- }
-
- public boolean addAll(Collection<? extends E> c)
- {
- throw new UnsupportedOperationException();
- }
-
- public boolean removeAll(Collection<?> c)
- {
- throw new UnsupportedOperationException();
- }
-
- public boolean retainAll(Collection<?> c)
- {
- throw new UnsupportedOperationException();
- }
-
- private E checkObject(QueueEntry<E> entry)
- {
- if (entry == null || entry == QUEUE_CLOSED)
- {
- return null;
- }
-
- return entry.getObjectWithException();
- }
-
- /**
- * @author Simon McDuff
- * @since 2.0
- */
- private static class QueueEntry<E> implements Comparable<QueueEntry<E>>
- {
- private static final AtomicLong nextSeq = new AtomicLong(0);
-
- private long seqNumber;
-
- private Object internalObject;
-
- public QueueEntry()
- {
- seqNumber = Long.MAX_VALUE;
- }
-
- public QueueEntry(E object)
- {
- internalObject = object;
- seqNumber = nextSeq.getAndIncrement();
- }
-
- public QueueEntry(Throwable object)
- {
- internalObject = object;
- seqNumber = nextSeq.getAndIncrement();
- }
-
- @SuppressWarnings("unchecked")
- public E getObjectWithException()
- {
- Throwable exception = getException();
- if (exception instanceof Exception)
- {
- throw WrappedException.wrap((Exception)exception);
- }
- else if (exception instanceof Error)
- {
- throw (Error)exception;
- }
-
- return (E)internalObject;
- }
-
- public Throwable getException()
- {
- if (internalObject instanceof Throwable)
- {
- return (Throwable)internalObject;
- }
-
- return null;
- }
-
- public int compareTo(QueueEntry<E> o)
- {
- if (getException() != null)
- {
- return -1;
- }
-
- if (o.getException() != null)
- {
- return 1;
- }
-
- if (this == o)
- {
- return 0;
- }
-
- if (seqNumber == o.seqNumber)
- {
- // Should not be possible
- return 0;
- }
-
- return seqNumber < o.seqNumber ? -1 : 1;
- }
-
- // @Override
- // public boolean equals(Object obj)
- // {
- // if (this == obj)
- // {
- // return true;
- // }
- //
- // if (obj instanceof QueueEntry<?>)
- // {
- // @SuppressWarnings("unchecked")
- // QueueEntry<E> that = (QueueEntry<E>)obj;
- // return compareTo(that) == 0;
- // }
- //
- // return false;
- // }
- }
-
- /**
- * A blocking iterator that takes elements from a {@link CDOQueryQueue}.
- *
- * @author Simon McDuff
- * @since 2.0
- */
- public class BlockingCloseableIteratorImpl implements BlockingCloseableIterator<E>
- {
- private boolean closed;
-
- private E nextElement;
-
- public BlockingCloseableIteratorImpl()
- {
- }
-
- public E peek()
- {
- if (nextElement == null)
- {
- return CDOQueryQueue.this.peek();
- }
-
- return nextElement;
- }
-
- public boolean hasNext()
- {
- privateNext(false);
- return nextElement != null;
- }
-
- private void privateNext(boolean failOnNull)
- {
- if (nextElement == null)
- {
- try
- {
- synchronized (closeLock)
- {
- if (CDOQueryQueue.this.isEmpty() && CDOQueryQueue.this.isClosed())
- {
- if (failOnNull)
- {
- throw new NoSuchElementException();
- }
-
- return;
- }
- }
-
- nextElement = take();
- }
- catch (InterruptedException ex)
- {
- throw WrappedException.wrap(ex);
- }
- }
- }
-
- public E next()
- {
- try
- {
- privateNext(true);
- return nextElement;
- }
- finally
- {
- nextElement = null;
- }
- }
-
- public void remove()
- {
- throw new UnsupportedOperationException();
- }
-
- public void close()
- {
- this.closed = true;
- }
-
- public boolean isClosed()
- {
- return this.closed;
- }
- }
-}
+/*
+ * Copyright (c) 2004 - 2012 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.util;
+
+import org.eclipse.net4j.util.WrappedException;
+import org.eclipse.net4j.util.collection.Closeable;
+
+import java.util.Collection;
+import java.util.Comparator;
+import java.util.NoSuchElementException;
+import java.util.Queue;
+import java.util.concurrent.PriorityBlockingQueue;
+import java.util.concurrent.TimeUnit;
+import java.util.concurrent.atomic.AtomicLong;
+
+/**
+ * The {@link Queue queue} that represents the result of a CDOQuery.
+ *
+ * @author Simon McDuff
+ * @since 2.0
+ * @noextend This interface is not intended to be extended by clients.
+ * @noimplement This interface is not intended to be implemented by clients.
+ */
+public class CDOQueryQueue<E> implements Queue<E>, Closeable
+{
+ // Static not allowed due to <E>
+ private final QueueEntry<E> QUEUE_CLOSED = new QueueEntry<E>();
+
+ private PriorityBlockingQueue<QueueEntry<E>> queue = new PriorityBlockingQueue<QueueEntry<E>>(10);
+
+ private boolean closed;
+
+ private Object closeLock = new Object();
+
+ public CDOQueryQueue()
+ {
+ }
+
+ public void setException(Throwable exception)
+ {
+ queue.add(new QueueEntry<E>(exception));
+ }
+
+ public void close()
+ {
+ synchronized (closeLock)
+ {
+ if (!closed)
+ {
+ closed = true;
+ queue.add(QUEUE_CLOSED);
+ }
+ }
+ }
+
+ public boolean isClosed()
+ {
+ synchronized (closeLock)
+ {
+ return closed;
+ }
+ }
+
+ public boolean add(E e)
+ {
+ return queue.add(new QueueEntry<E>(e));
+ }
+
+ public void clear()
+ {
+ queue.clear();
+ }
+
+ public boolean contains(Object o)
+ {
+ return queue.contains(o);
+ }
+
+ public E element()
+ {
+ return checkObject(queue.element());
+ }
+
+ @Override
+ public boolean equals(Object obj)
+ {
+ return queue.equals(obj);
+ }
+
+ @Override
+ public int hashCode()
+ {
+ return queue.hashCode();
+ }
+
+ public boolean isEmpty()
+ {
+ return queue.isEmpty();
+ }
+
+ public BlockingCloseableIterator<E> iterator()
+ {
+ return new BlockingCloseableIteratorImpl();
+ }
+
+ public boolean offer(E e, long timeout, TimeUnit unit)
+ {
+ return queue.offer(new QueueEntry<E>(e), timeout, unit);
+ }
+
+ public boolean offer(E e)
+ {
+ return queue.offer(new QueueEntry<E>(e));
+ }
+
+ public E peek()
+ {
+ return checkObject(queue.peek());
+ }
+
+ public E poll(long timeout, TimeUnit unit) throws InterruptedException
+ {
+ return checkObject(queue.poll(timeout, unit));
+ }
+
+ public void put(E e)
+ {
+ queue.put(new QueueEntry<E>(e));
+ }
+
+ public int remainingCapacity()
+ {
+ return queue.remainingCapacity();
+ }
+
+ public E remove()
+ {
+ return checkObject(queue.remove());
+ }
+
+ public boolean remove(Object o)
+ {
+ return queue.remove(o);
+ }
+
+ public int size()
+ {
+ return queue.size();
+ }
+
+ public E take() throws InterruptedException
+ {
+ QueueEntry<E> entry = null;
+
+ entry = queue.take();
+
+ return checkObject(entry);
+ }
+
+ public Object[] toArray()
+ {
+ return queue.toArray();
+ }
+
+ @SuppressWarnings("unchecked")
+ public Object[] toArray(Object[] a)
+ {
+ return queue.toArray(a);
+ }
+
+ @Override
+ public String toString()
+ {
+ return queue.toString();
+ }
+
+ public E poll()
+ {
+ QueueEntry<E> entry = queue.poll();
+ return checkObject(entry);
+ }
+
+ public Comparator<?> comparator()
+ {
+ throw new UnsupportedOperationException();
+ }
+
+ public boolean containsAll(Collection<?> c)
+ {
+ throw new UnsupportedOperationException();
+ }
+
+ public boolean addAll(Collection<? extends E> c)
+ {
+ throw new UnsupportedOperationException();
+ }
+
+ public boolean removeAll(Collection<?> c)
+ {
+ throw new UnsupportedOperationException();
+ }
+
+ public boolean retainAll(Collection<?> c)
+ {
+ throw new UnsupportedOperationException();
+ }
+
+ private E checkObject(QueueEntry<E> entry)
+ {
+ if (entry == null || entry == QUEUE_CLOSED)
+ {
+ return null;
+ }
+
+ return entry.getObjectWithException();
+ }
+
+ /**
+ * @author Simon McDuff
+ * @since 2.0
+ */
+ private static class QueueEntry<E> implements Comparable<QueueEntry<E>>
+ {
+ private static final AtomicLong nextSeq = new AtomicLong(0);
+
+ private long seqNumber;
+
+ private Object internalObject;
+
+ public QueueEntry()
+ {
+ seqNumber = Long.MAX_VALUE;
+ }
+
+ public QueueEntry(E object)
+ {
+ internalObject = object;
+ seqNumber = nextSeq.getAndIncrement();
+ }
+
+ public QueueEntry(Throwable object)
+ {
+ internalObject = object;
+ seqNumber = nextSeq.getAndIncrement();
+ }
+
+ @SuppressWarnings("unchecked")
+ public E getObjectWithException()
+ {
+ Throwable exception = getException();
+ if (exception instanceof Exception)
+ {
+ throw WrappedException.wrap((Exception)exception);
+ }
+ else if (exception instanceof Error)
+ {
+ throw (Error)exception;
+ }
+
+ return (E)internalObject;
+ }
+
+ public Throwable getException()
+ {
+ if (internalObject instanceof Throwable)
+ {
+ return (Throwable)internalObject;
+ }
+
+ return null;
+ }
+
+ public int compareTo(QueueEntry<E> o)
+ {
+ if (getException() != null)
+ {
+ return -1;
+ }
+
+ if (o.getException() != null)
+ {
+ return 1;
+ }
+
+ if (this == o)
+ {
+ return 0;
+ }
+
+ if (seqNumber == o.seqNumber)
+ {
+ // Should not be possible
+ return 0;
+ }
+
+ return seqNumber < o.seqNumber ? -1 : 1;
+ }
+
+ // @Override
+ // public boolean equals(Object obj)
+ // {
+ // if (this == obj)
+ // {
+ // return true;
+ // }
+ //
+ // if (obj instanceof QueueEntry<?>)
+ // {
+ // @SuppressWarnings("unchecked")
+ // QueueEntry<E> that = (QueueEntry<E>)obj;
+ // return compareTo(that) == 0;
+ // }
+ //
+ // return false;
+ // }
+ }
+
+ /**
+ * A blocking iterator that takes elements from a {@link CDOQueryQueue}.
+ *
+ * @author Simon McDuff
+ * @since 2.0
+ */
+ public class BlockingCloseableIteratorImpl implements BlockingCloseableIterator<E>
+ {
+ private boolean closed;
+
+ private E nextElement;
+
+ public BlockingCloseableIteratorImpl()
+ {
+ }
+
+ public E peek()
+ {
+ if (nextElement == null)
+ {
+ return CDOQueryQueue.this.peek();
+ }
+
+ return nextElement;
+ }
+
+ public boolean hasNext()
+ {
+ privateNext(false);
+ return nextElement != null;
+ }
+
+ private void privateNext(boolean failOnNull)
+ {
+ if (nextElement == null)
+ {
+ try
+ {
+ synchronized (closeLock)
+ {
+ if (CDOQueryQueue.this.isEmpty() && CDOQueryQueue.this.isClosed())
+ {
+ if (failOnNull)
+ {
+ throw new NoSuchElementException();
+ }
+
+ return;
+ }
+ }
+
+ nextElement = take();
+ }
+ catch (InterruptedException ex)
+ {
+ throw WrappedException.wrap(ex);
+ }
+ }
+ }
+
+ public E next()
+ {
+ try
+ {
+ privateNext(true);
+ return nextElement;
+ }
+ finally
+ {
+ nextElement = null;
+ }
+ }
+
+ public void remove()
+ {
+ throw new UnsupportedOperationException();
+ }
+
+ public void close()
+ {
+ this.closed = true;
+ }
+
+ public boolean isClosed()
+ {
+ return this.closed;
+ }
+ }
+}
diff --git a/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/common/util/CDOTimeProvider.java b/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/common/util/CDOTimeProvider.java
index 33de8a435f..d951c3044c 100644
--- a/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/common/util/CDOTimeProvider.java
+++ b/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/common/util/CDOTimeProvider.java
@@ -1,22 +1,22 @@
-/*
- * Copyright (c) 2004 - 2011 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.util;
-
-/**
- * Provides the consumer with a long-valued time stamp.
- *
- * @author Eike Stepper
- * @since 3.0
- */
-public interface CDOTimeProvider
-{
- public long getTimeStamp();
-}
+/*
+ * Copyright (c) 2004 - 2012 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.util;
+
+/**
+ * Provides the consumer with a long-valued time stamp.
+ *
+ * @author Eike Stepper
+ * @since 3.0
+ */
+public interface CDOTimeProvider
+{
+ public long getTimeStamp();
+}
diff --git a/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/common/util/PartialCollectionLoadingNotSupportedException.java b/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/common/util/PartialCollectionLoadingNotSupportedException.java
index f4f3db5926..392eceb0a6 100644
--- a/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/common/util/PartialCollectionLoadingNotSupportedException.java
+++ b/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/common/util/PartialCollectionLoadingNotSupportedException.java
@@ -1,45 +1,45 @@
-/*
- * Copyright (c) 2004 - 2011 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.util;
-
-import org.eclipse.emf.cdo.common.revision.CDOElementProxy;
-
-/**
- * An unchecked exception that indicates that {@link CDOElementProxy list element proxies} have been encountered but
- * cannot be handled.
- *
- * @author Eike Stepper
- * @noextend This interface is not intended to be extended by clients.
- * @since 4.1
- */
-public class PartialCollectionLoadingNotSupportedException extends IllegalStateException
-{
- private static final long serialVersionUID = 1L;
-
- public PartialCollectionLoadingNotSupportedException()
- {
- }
-
- public PartialCollectionLoadingNotSupportedException(String message)
- {
- super(message);
- }
-
- public PartialCollectionLoadingNotSupportedException(String message, Throwable cause)
- {
- super(message, cause);
- }
-
- public PartialCollectionLoadingNotSupportedException(Throwable cause)
- {
- super(cause);
- }
-}
+/*
+ * Copyright (c) 2004 - 2012 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.util;
+
+import org.eclipse.emf.cdo.common.revision.CDOElementProxy;
+
+/**
+ * An unchecked exception that indicates that {@link CDOElementProxy list element proxies} have been encountered but
+ * cannot be handled.
+ *
+ * @author Eike Stepper
+ * @noextend This interface is not intended to be extended by clients.
+ * @since 4.1
+ */
+public class PartialCollectionLoadingNotSupportedException extends IllegalStateException
+{
+ private static final long serialVersionUID = 1L;
+
+ public PartialCollectionLoadingNotSupportedException()
+ {
+ }
+
+ public PartialCollectionLoadingNotSupportedException(String message)
+ {
+ super(message);
+ }
+
+ public PartialCollectionLoadingNotSupportedException(String message, Throwable cause)
+ {
+ super(message, cause);
+ }
+
+ public PartialCollectionLoadingNotSupportedException(Throwable cause)
+ {
+ super(cause);
+ }
+}
diff --git a/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/common/util/RepositoryStateChangedEvent.java b/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/common/util/RepositoryStateChangedEvent.java
index 507b318536..6c74a8cf1c 100644
--- a/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/common/util/RepositoryStateChangedEvent.java
+++ b/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/common/util/RepositoryStateChangedEvent.java
@@ -1,52 +1,52 @@
-/*
- * Copyright (c) 2004 - 2011 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.util;
-
-import org.eclipse.emf.cdo.common.CDOCommonRepository;
-
-import org.eclipse.net4j.util.event.Event;
-import org.eclipse.net4j.util.event.IEvent;
-import org.eclipse.net4j.util.event.INotifier;
-
-/**
- * An {@link IEvent event} fired when the {@link org.eclipse.emf.cdo.common.CDOCommonRepository.State state} of a
- * repository has changed.
- *
- * @author Eike Stepper
- * @since 3.0
- * @noextend This interface is not intended to be extended by clients.
- */
-public class RepositoryStateChangedEvent extends Event implements CDOCommonRepository.StateChangedEvent
-{
- private static final long serialVersionUID = 1L;
-
- private CDOCommonRepository.State oldState;
-
- private CDOCommonRepository.State newState;
-
- public RepositoryStateChangedEvent(INotifier source, CDOCommonRepository.State oldState,
- CDOCommonRepository.State newState)
- {
- super(source);
- this.oldState = oldState;
- this.newState = newState;
- }
-
- public CDOCommonRepository.State getOldState()
- {
- return oldState;
- }
-
- public CDOCommonRepository.State getNewState()
- {
- return newState;
- }
-}
+/*
+ * Copyright (c) 2004 - 2012 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.util;
+
+import org.eclipse.emf.cdo.common.CDOCommonRepository;
+
+import org.eclipse.net4j.util.event.Event;
+import org.eclipse.net4j.util.event.IEvent;
+import org.eclipse.net4j.util.event.INotifier;
+
+/**
+ * An {@link IEvent event} fired when the {@link org.eclipse.emf.cdo.common.CDOCommonRepository.State state} of a
+ * repository has changed.
+ *
+ * @author Eike Stepper
+ * @since 3.0
+ * @noextend This interface is not intended to be extended by clients.
+ */
+public class RepositoryStateChangedEvent extends Event implements CDOCommonRepository.StateChangedEvent
+{
+ private static final long serialVersionUID = 1L;
+
+ private CDOCommonRepository.State oldState;
+
+ private CDOCommonRepository.State newState;
+
+ public RepositoryStateChangedEvent(INotifier source, CDOCommonRepository.State oldState,
+ CDOCommonRepository.State newState)
+ {
+ super(source);
+ this.oldState = oldState;
+ this.newState = newState;
+ }
+
+ public CDOCommonRepository.State getOldState()
+ {
+ return oldState;
+ }
+
+ public CDOCommonRepository.State getNewState()
+ {
+ return newState;
+ }
+}
diff --git a/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/common/util/RepositoryTypeChangedEvent.java b/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/common/util/RepositoryTypeChangedEvent.java
index 1fec51f7e8..aa3ba5e222 100644
--- a/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/common/util/RepositoryTypeChangedEvent.java
+++ b/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/common/util/RepositoryTypeChangedEvent.java
@@ -1,51 +1,51 @@
-/*
- * Copyright (c) 2004 - 2011 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.util;
-
-import org.eclipse.emf.cdo.common.CDOCommonRepository;
-
-import org.eclipse.net4j.util.event.Event;
-import org.eclipse.net4j.util.event.IEvent;
-import org.eclipse.net4j.util.event.INotifier;
-
-/**
- * An {@link IEvent event} fired when the {@link org.eclipse.emf.cdo.common.CDOCommonRepository.Type type} of a
- * repository has changed.
- *
- * @author Eike Stepper
- * @since 3.0
- * @noextend This interface is not intended to be extended by clients.
- */
-public class RepositoryTypeChangedEvent extends Event implements CDOCommonRepository.TypeChangedEvent
-{
- private static final long serialVersionUID = 1L;
-
- private CDOCommonRepository.Type oldType;
-
- private CDOCommonRepository.Type newType;
-
- public RepositoryTypeChangedEvent(INotifier source, CDOCommonRepository.Type oldType, CDOCommonRepository.Type newType)
- {
- super(source);
- this.oldType = oldType;
- this.newType = newType;
- }
-
- public CDOCommonRepository.Type getOldType()
- {
- return oldType;
- }
-
- public CDOCommonRepository.Type getNewType()
- {
- return newType;
- }
-}
+/*
+ * Copyright (c) 2004 - 2012 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.util;
+
+import org.eclipse.emf.cdo.common.CDOCommonRepository;
+
+import org.eclipse.net4j.util.event.Event;
+import org.eclipse.net4j.util.event.IEvent;
+import org.eclipse.net4j.util.event.INotifier;
+
+/**
+ * An {@link IEvent event} fired when the {@link org.eclipse.emf.cdo.common.CDOCommonRepository.Type type} of a
+ * repository has changed.
+ *
+ * @author Eike Stepper
+ * @since 3.0
+ * @noextend This interface is not intended to be extended by clients.
+ */
+public class RepositoryTypeChangedEvent extends Event implements CDOCommonRepository.TypeChangedEvent
+{
+ private static final long serialVersionUID = 1L;
+
+ private CDOCommonRepository.Type oldType;
+
+ private CDOCommonRepository.Type newType;
+
+ public RepositoryTypeChangedEvent(INotifier source, CDOCommonRepository.Type oldType, CDOCommonRepository.Type newType)
+ {
+ super(source);
+ this.oldType = oldType;
+ this.newType = newType;
+ }
+
+ public CDOCommonRepository.Type getOldType()
+ {
+ return oldType;
+ }
+
+ public CDOCommonRepository.Type getNewType()
+ {
+ return newType;
+ }
+}
diff --git a/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/common/util/TransportException.java b/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/common/util/TransportException.java
index caba1020c7..e9b4c1b91a 100644
--- a/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/common/util/TransportException.java
+++ b/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/common/util/TransportException.java
@@ -1,41 +1,41 @@
-/*
- * Copyright (c) 2004 - 2011 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.util;
-
-/**
- * An unchecked exception that indicates transport-level problems.
- *
- * @author Eike Stepper
- * @noextend This interface is not intended to be extended by clients.
- */
-public class TransportException extends CDOException
-{
- private static final long serialVersionUID = 1L;
-
- public TransportException()
- {
- }
-
- public TransportException(String message)
- {
- super(message);
- }
-
- public TransportException(String message, Throwable cause)
- {
- super(message, cause);
- }
-
- public TransportException(Throwable cause)
- {
- super(cause);
- }
-}
+/*
+ * Copyright (c) 2004 - 2012 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.util;
+
+/**
+ * An unchecked exception that indicates transport-level problems.
+ *
+ * @author Eike Stepper
+ * @noextend This interface is not intended to be extended by clients.
+ */
+public class TransportException extends CDOException
+{
+ private static final long serialVersionUID = 1L;
+
+ public TransportException()
+ {
+ }
+
+ public TransportException(String message)
+ {
+ super(message);
+ }
+
+ public TransportException(String message, Throwable cause)
+ {
+ super(message, cause);
+ }
+
+ public TransportException(Throwable cause)
+ {
+ super(cause);
+ }
+}
diff --git a/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/common/util/package-info.java b/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/common/util/package-info.java
index 5466baa84d..c7b15046b4 100644
--- a/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/common/util/package-info.java
+++ b/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/common/util/package-info.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2004 - 2011 Eike Stepper (Berlin, Germany) and others.
+ * Copyright (c) 2004 - 2012 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
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 0ae3d4b9e9..1053c06e5f 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
@@ -1,160 +1,160 @@
-/*
- * Copyright (c) 2004 - 2011 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;
-
-import org.eclipse.emf.cdo.common.commit.CDOChangeSetData;
-import org.eclipse.emf.cdo.common.protocol.CDODataInput;
-import org.eclipse.emf.cdo.common.protocol.CDODataOutput;
-import org.eclipse.emf.cdo.common.util.CDOQueryInfo;
-
-import java.io.IOException;
-import java.util.Collections;
-import java.util.HashMap;
-import java.util.Map;
-import java.util.Map.Entry;
-
-/**
- * @author Simon McDuff
- */
-public class CDOQueryInfoImpl implements CDOQueryInfo
-{
- protected String queryLanguage;
-
- protected String queryString;
-
- protected Object context;
-
- protected Map<String, Object> parameters = new HashMap<String, Object>();
-
- protected int maxResults = UNLIMITED_RESULTS;
-
- protected boolean legacyModeEnabled;
-
- protected CDOChangeSetData changeSetData;
-
- public CDOQueryInfoImpl(String queryLanguage, String queryString, Object context)
- {
- this.queryLanguage = queryLanguage;
- this.queryString = queryString;
- this.context = context;
- }
-
- public CDOQueryInfoImpl(CDODataInput in) throws IOException
- {
- queryLanguage = in.readString();
- queryString = in.readString();
- context = in.readCDORevisionOrPrimitiveOrClassifier();
- maxResults = in.readInt();
- legacyModeEnabled = in.readBoolean();
-
- if (in.readBoolean())
- {
- changeSetData = in.readCDOChangeSetData();
- }
-
- int size = in.readInt();
- for (int i = 0; i < size; i++)
- {
- String key = in.readString();
- Object object = in.readCDORevisionOrPrimitiveOrClassifier();
- parameters.put(key, object);
- }
- }
-
- public void write(CDODataOutput out) throws IOException
- {
- out.writeString(queryLanguage);
- out.writeString(queryString);
- out.writeCDORevisionOrPrimitiveOrClassifier(context);
- out.writeInt(maxResults);
- out.writeBoolean(legacyModeEnabled);
-
- if (changeSetData != null)
- {
- out.writeBoolean(true);
- out.writeCDOChangeSetData(changeSetData);
- }
- else
- {
- out.writeBoolean(false);
- }
-
- out.writeInt(parameters.size());
- for (Entry<String, Object> entry : parameters.entrySet())
- {
- out.writeString(entry.getKey());
- out.writeCDORevisionOrPrimitiveOrClassifier(entry.getValue());
- }
- }
-
- public String getQueryString()
- {
- return queryString;
- }
-
- public String getQueryLanguage()
- {
- return queryLanguage;
- }
-
- public Map<String, Object> getParameters()
- {
- return Collections.unmodifiableMap(parameters);
- }
-
- public Object getContext()
- {
- return context;
- }
-
- public CDOQueryInfoImpl setContext(Object context)
- {
- this.context = context;
- return this;
- }
-
- public void addParameter(String key, Object value)
- {
- parameters.put(key, value);
- }
-
- public int getMaxResults()
- {
- return maxResults;
- }
-
- public CDOQueryInfoImpl setMaxResults(int maxResults)
- {
- this.maxResults = maxResults;
- return this;
- }
-
- public boolean isLegacyModeEnabled()
- {
- return legacyModeEnabled;
- }
-
- public void setLegacyModeEnabled(boolean legacyModeEnabled)
- {
- this.legacyModeEnabled = legacyModeEnabled;
- }
-
- public CDOChangeSetData getChangeSetData()
- {
- return changeSetData;
- }
-
- public void setChangeSetData(CDOChangeSetData changeSetData)
- {
- this.changeSetData = changeSetData;
- }
-}
+/*
+ * Copyright (c) 2004 - 2012 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;
+
+import org.eclipse.emf.cdo.common.commit.CDOChangeSetData;
+import org.eclipse.emf.cdo.common.protocol.CDODataInput;
+import org.eclipse.emf.cdo.common.protocol.CDODataOutput;
+import org.eclipse.emf.cdo.common.util.CDOQueryInfo;
+
+import java.io.IOException;
+import java.util.Collections;
+import java.util.HashMap;
+import java.util.Map;
+import java.util.Map.Entry;
+
+/**
+ * @author Simon McDuff
+ */
+public class CDOQueryInfoImpl implements CDOQueryInfo
+{
+ protected String queryLanguage;
+
+ protected String queryString;
+
+ protected Object context;
+
+ protected Map<String, Object> parameters = new HashMap<String, Object>();
+
+ protected int maxResults = UNLIMITED_RESULTS;
+
+ protected boolean legacyModeEnabled;
+
+ protected CDOChangeSetData changeSetData;
+
+ public CDOQueryInfoImpl(String queryLanguage, String queryString, Object context)
+ {
+ this.queryLanguage = queryLanguage;
+ this.queryString = queryString;
+ this.context = context;
+ }
+
+ public CDOQueryInfoImpl(CDODataInput in) throws IOException
+ {
+ queryLanguage = in.readString();
+ queryString = in.readString();
+ context = in.readCDORevisionOrPrimitiveOrClassifier();
+ maxResults = in.readInt();
+ legacyModeEnabled = in.readBoolean();
+
+ if (in.readBoolean())
+ {
+ changeSetData = in.readCDOChangeSetData();
+ }
+
+ int size = in.readInt();
+ for (int i = 0; i < size; i++)
+ {
+ String key = in.readString();
+ Object object = in.readCDORevisionOrPrimitiveOrClassifier();
+ parameters.put(key, object);
+ }
+ }
+
+ public void write(CDODataOutput out) throws IOException
+ {
+ out.writeString(queryLanguage);
+ out.writeString(queryString);
+ out.writeCDORevisionOrPrimitiveOrClassifier(context);
+ out.writeInt(maxResults);
+ out.writeBoolean(legacyModeEnabled);
+
+ if (changeSetData != null)
+ {
+ out.writeBoolean(true);
+ out.writeCDOChangeSetData(changeSetData);
+ }
+ else
+ {
+ out.writeBoolean(false);
+ }
+
+ out.writeInt(parameters.size());
+ for (Entry<String, Object> entry : parameters.entrySet())
+ {
+ out.writeString(entry.getKey());
+ out.writeCDORevisionOrPrimitiveOrClassifier(entry.getValue());
+ }
+ }
+
+ public String getQueryString()
+ {
+ return queryString;
+ }
+
+ public String getQueryLanguage()
+ {
+ return queryLanguage;
+ }
+
+ public Map<String, Object> getParameters()
+ {
+ return Collections.unmodifiableMap(parameters);
+ }
+
+ public Object getContext()
+ {
+ return context;
+ }
+
+ public CDOQueryInfoImpl setContext(Object context)
+ {
+ this.context = context;
+ return this;
+ }
+
+ public void addParameter(String key, Object value)
+ {
+ parameters.put(key, value);
+ }
+
+ public int getMaxResults()
+ {
+ return maxResults;
+ }
+
+ public CDOQueryInfoImpl setMaxResults(int maxResults)
+ {
+ this.maxResults = maxResults;
+ return this;
+ }
+
+ public boolean isLegacyModeEnabled()
+ {
+ return legacyModeEnabled;
+ }
+
+ public void setLegacyModeEnabled(boolean legacyModeEnabled)
+ {
+ this.legacyModeEnabled = legacyModeEnabled;
+ }
+
+ public CDOChangeSetData getChangeSetData()
+ {
+ return changeSetData;
+ }
+
+ public void setChangeSetData(CDOChangeSetData changeSetData)
+ {
+ this.changeSetData = changeSetData;
+ }
+}
diff --git a/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/internal/common/branch/CDOBranchImpl.java b/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/internal/common/branch/CDOBranchImpl.java
index 0317b3a974..6d3986dff0 100644
--- a/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/internal/common/branch/CDOBranchImpl.java
+++ b/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/internal/common/branch/CDOBranchImpl.java
@@ -1,342 +1,342 @@
-/*
- * Copyright (c) 2004 - 2011 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.branch;
-
-import org.eclipse.emf.cdo.common.branch.CDOBranch;
-import org.eclipse.emf.cdo.common.branch.CDOBranchPoint;
-import org.eclipse.emf.cdo.common.branch.CDOBranchVersion;
-import org.eclipse.emf.cdo.spi.common.branch.InternalCDOBranch;
-import org.eclipse.emf.cdo.spi.common.branch.InternalCDOBranchManager;
-import org.eclipse.emf.cdo.spi.common.branch.InternalCDOBranchManager.BranchLoader;
-import org.eclipse.emf.cdo.spi.common.branch.InternalCDOBranchManager.BranchLoader.BranchInfo;
-import org.eclipse.emf.cdo.spi.common.branch.InternalCDOBranchManager.BranchLoader.SubBranchInfo;
-
-import org.eclipse.net4j.util.container.Container;
-
-import java.text.MessageFormat;
-import java.util.ArrayList;
-import java.util.List;
-
-/**
- * @author Eike Stepper
- */
-public class CDOBranchImpl extends Container<CDOBranch> implements InternalCDOBranch
-{
- public static final int ILLEGAL_BRANCH_ID = Integer.MIN_VALUE;
-
- private InternalCDOBranchManager branchManager;
-
- private int id;
-
- private String name;
-
- private CDOBranchPoint base;
-
- private CDOBranchPoint head = getPoint(CDOBranchPoint.UNSPECIFIED_DATE);
-
- private InternalCDOBranch[] branches;
-
- public CDOBranchImpl(InternalCDOBranchManager branchManager, int id, String name, CDOBranchPoint base)
- {
- this.branchManager = branchManager;
- this.id = id;
- this.name = name;
- this.base = base;
- activate();
- }
-
- public boolean isMainBranch()
- {
- return false;
- }
-
- public boolean isLocal()
- {
- return id < 0;
- }
-
- public InternalCDOBranchManager getBranchManager()
- {
- return branchManager;
- }
-
- public int getID()
- {
- return id;
- }
-
- public synchronized String getName()
- {
- if (name == null)
- {
- load();
- }
-
- return name;
- }
-
- public boolean isProxy()
- {
- return name == null || base == null;
- }
-
- public String getPathName()
- {
- StringBuilder builder = new StringBuilder();
- computePathName(this, builder);
- return builder.toString();
- }
-
- private void computePathName(CDOBranch branch, StringBuilder builder)
- {
- CDOBranchPoint base = branch.getBase();
- CDOBranch parent = base.getBranch();
- if (parent != null)
- {
- computePathName(parent, builder);
- builder.append(PATH_SEPARATOR);
- }
-
- builder.append(branch.getName());
- }
-
- public CDOBranchPoint[] getBasePath()
- {
- List<CDOBranchPoint> path = new ArrayList<CDOBranchPoint>();
- computeBasePath(this, path);
- return path.toArray(new CDOBranchPoint[path.size()]);
- }
-
- private void computeBasePath(CDOBranch branch, List<CDOBranchPoint> path)
- {
- CDOBranchPoint base = branch.getBase();
- CDOBranch parent = base.getBranch();
- if (parent != null)
- {
- computeBasePath(parent, path);
- }
-
- path.add(base);
- }
-
- public synchronized CDOBranchPoint getBase()
- {
- if (base == null)
- {
- load();
- }
-
- return base;
- }
-
- public CDOBranchPoint getHead()
- {
- return head;
- }
-
- public CDOBranchPoint getPoint(long timeStamp)
- {
- return new CDOBranchPointImpl(this, timeStamp);
- }
-
- public CDOBranchVersion getVersion(int version)
- {
- return new CDOBranchVersionImpl(this, version);
- }
-
- public InternalCDOBranch createBranch(String name, long timeStamp)
- {
- return getBranchManager().createBranch(BranchLoader.NEW_BRANCH, name, this, timeStamp);
- }
-
- public InternalCDOBranch createBranch(String name)
- {
- return createBranch(name, CDOBranchPoint.UNSPECIFIED_DATE);
- }
-
- public InternalCDOBranch[] getElements()
- {
- return getBranches();
- }
-
- public InternalCDOBranch[] getBranches(boolean loadOnDemand)
- {
- if (branches == null && loadOnDemand)
- {
- InternalCDOBranchManager branchManager = getBranchManager();
- SubBranchInfo[] infos = branchManager.getBranchLoader().loadSubBranches(id);
- branches = new InternalCDOBranch[infos.length];
- for (int i = 0; i < infos.length; i++)
- {
- SubBranchInfo info = infos[i];
- branches[i] = branchManager.getBranch(info.getID(), info.getName(), this, info.getBaseTimeStamp());
- }
- }
-
- return branches;
- }
-
- public synchronized InternalCDOBranch[] getBranches()
- {
- return getBranches(true);
- }
-
- public InternalCDOBranch getBranch(String path)
- {
- while (path.startsWith(PATH_SEPARATOR))
- {
- path = path.substring(1);
- }
-
- while (path.endsWith(PATH_SEPARATOR))
- {
- path = path.substring(0, path.length() - PATH_SEPARATOR.length());
- }
-
- int sep = path.indexOf(PATH_SEPARATOR);
- if (sep == -1)
- {
- return getChild(path);
- }
-
- String name = path.substring(0, sep);
- InternalCDOBranch child = getChild(name);
- if (child == null)
- {
- return null;
- }
-
- // Recurse
- String rest = path.substring(sep + 1);
- return child.getBranch(rest);
- }
-
- private InternalCDOBranch getChild(String name)
- {
- InternalCDOBranch[] branches = getBranches();
- for (InternalCDOBranch branch : branches)
- {
- if (name.equals(branch.getName()))
- {
- return branch;
- }
- }
-
- return null;
- }
-
- public BranchInfo getBranchInfo()
- {
- CDOBranchPoint base = getBase();
- return new BranchInfo(getName(), base.getBranch().getID(), base.getTimeStamp());
- }
-
- public void setBranchInfo(String name, InternalCDOBranch baseBranch, long baseTimeStamp)
- {
- this.name = name;
- base = baseBranch.getPoint(baseTimeStamp);
- }
-
- public void addChild(InternalCDOBranch branch)
- {
- synchronized (this)
- {
- if (branches == null)
- {
- branches = new InternalCDOBranch[] { branch };
- }
- else
- {
- InternalCDOBranch[] newBranches = new InternalCDOBranch[branches.length + 1];
- System.arraycopy(branches, 0, newBranches, 0, branches.length);
- newBranches[branches.length] = branch;
- branches = newBranches;
- }
- }
-
- fireElementAddedEvent(branch);
- }
-
- public int compareTo(CDOBranch o)
- {
- int otherID = o.getID();
- return id < otherID ? -1 : id == otherID ? 0 : 1;
- }
-
- @Override
- public int hashCode()
- {
- return id;
- }
-
- @Override
- public boolean equals(Object obj)
- {
- if (obj == this)
- {
- return true;
- }
-
- if (obj instanceof CDOBranch)
- {
- CDOBranch that = (CDOBranch)obj;
- return id == that.getID();
- }
-
- return false;
- }
-
- @Override
- public String toString()
- {
- if (isProxy())
- {
- return MessageFormat.format("Branch[id={0}, PROXY]", id); //$NON-NLS-1$
- }
-
- return MessageFormat.format("Branch[id={0}, name={1}]", id, name); //$NON-NLS-1$
- }
-
- private synchronized void load()
- {
- BranchInfo branchInfo = branchManager.getBranchLoader().loadBranch(id);
- CDOBranch baseBranch = branchManager.getBranch(branchInfo.getBaseBranchID());
-
- name = branchInfo.getName();
- base = baseBranch.getPoint(branchInfo.getBaseTimeStamp());
- }
-
- /**
- * @author Eike Stepper
- */
- public static class Main extends CDOBranchImpl
- {
- private boolean local;
-
- public Main(InternalCDOBranchManager branchManager, boolean local, long timeStamp)
- {
- super(branchManager, MAIN_BRANCH_ID, MAIN_BRANCH_NAME, new CDOBranchPointImpl(null, timeStamp));
- this.local = local;
- }
-
- @Override
- public boolean isMainBranch()
- {
- return true;
- }
-
- @Override
- public boolean isLocal()
- {
- return local;
- }
- }
-}
+/*
+ * Copyright (c) 2004 - 2012 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.branch;
+
+import org.eclipse.emf.cdo.common.branch.CDOBranch;
+import org.eclipse.emf.cdo.common.branch.CDOBranchPoint;
+import org.eclipse.emf.cdo.common.branch.CDOBranchVersion;
+import org.eclipse.emf.cdo.spi.common.branch.InternalCDOBranch;
+import org.eclipse.emf.cdo.spi.common.branch.InternalCDOBranchManager;
+import org.eclipse.emf.cdo.spi.common.branch.InternalCDOBranchManager.BranchLoader;
+import org.eclipse.emf.cdo.spi.common.branch.InternalCDOBranchManager.BranchLoader.BranchInfo;
+import org.eclipse.emf.cdo.spi.common.branch.InternalCDOBranchManager.BranchLoader.SubBranchInfo;
+
+import org.eclipse.net4j.util.container.Container;
+
+import java.text.MessageFormat;
+import java.util.ArrayList;
+import java.util.List;
+
+/**
+ * @author Eike Stepper
+ */
+public class CDOBranchImpl extends Container<CDOBranch> implements InternalCDOBranch
+{
+ public static final int ILLEGAL_BRANCH_ID = Integer.MIN_VALUE;
+
+ private InternalCDOBranchManager branchManager;
+
+ private int id;
+
+ private String name;
+
+ private CDOBranchPoint base;
+
+ private CDOBranchPoint head = getPoint(CDOBranchPoint.UNSPECIFIED_DATE);
+
+ private InternalCDOBranch[] branches;
+
+ public CDOBranchImpl(InternalCDOBranchManager branchManager, int id, String name, CDOBranchPoint base)
+ {
+ this.branchManager = branchManager;
+ this.id = id;
+ this.name = name;
+ this.base = base;
+ activate();
+ }
+
+ public boolean isMainBranch()
+ {
+ return false;
+ }
+
+ public boolean isLocal()
+ {
+ return id < 0;
+ }
+
+ public InternalCDOBranchManager getBranchManager()
+ {
+ return branchManager;
+ }
+
+ public int getID()
+ {
+ return id;
+ }
+
+ public synchronized String getName()
+ {
+ if (name == null)
+ {
+ load();
+ }
+
+ return name;
+ }
+
+ public boolean isProxy()
+ {
+ return name == null || base == null;
+ }
+
+ public String getPathName()
+ {
+ StringBuilder builder = new StringBuilder();
+ computePathName(this, builder);
+ return builder.toString();
+ }
+
+ private void computePathName(CDOBranch branch, StringBuilder builder)
+ {
+ CDOBranchPoint base = branch.getBase();
+ CDOBranch parent = base.getBranch();
+ if (parent != null)
+ {
+ computePathName(parent, builder);
+ builder.append(PATH_SEPARATOR);
+ }
+
+ builder.append(branch.getName());
+ }
+
+ public CDOBranchPoint[] getBasePath()
+ {
+ List<CDOBranchPoint> path = new ArrayList<CDOBranchPoint>();
+ computeBasePath(this, path);
+ return path.toArray(new CDOBranchPoint[path.size()]);
+ }
+
+ private void computeBasePath(CDOBranch branch, List<CDOBranchPoint> path)
+ {
+ CDOBranchPoint base = branch.getBase();
+ CDOBranch parent = base.getBranch();
+ if (parent != null)
+ {
+ computeBasePath(parent, path);
+ }
+
+ path.add(base);
+ }
+
+ public synchronized CDOBranchPoint getBase()
+ {
+ if (base == null)
+ {
+ load();
+ }
+
+ return base;
+ }
+
+ public CDOBranchPoint getHead()
+ {
+ return head;
+ }
+
+ public CDOBranchPoint getPoint(long timeStamp)
+ {
+ return new CDOBranchPointImpl(this, timeStamp);
+ }
+
+ public CDOBranchVersion getVersion(int version)
+ {
+ return new CDOBranchVersionImpl(this, version);
+ }
+
+ public InternalCDOBranch createBranch(String name, long timeStamp)
+ {
+ return getBranchManager().createBranch(BranchLoader.NEW_BRANCH, name, this, timeStamp);
+ }
+
+ public InternalCDOBranch createBranch(String name)
+ {
+ return createBranch(name, CDOBranchPoint.UNSPECIFIED_DATE);
+ }
+
+ public InternalCDOBranch[] getElements()
+ {
+ return getBranches();
+ }
+
+ public InternalCDOBranch[] getBranches(boolean loadOnDemand)
+ {
+ if (branches == null && loadOnDemand)
+ {
+ InternalCDOBranchManager branchManager = getBranchManager();
+ SubBranchInfo[] infos = branchManager.getBranchLoader().loadSubBranches(id);
+ branches = new InternalCDOBranch[infos.length];
+ for (int i = 0; i < infos.length; i++)
+ {
+ SubBranchInfo info = infos[i];
+ branches[i] = branchManager.getBranch(info.getID(), info.getName(), this, info.getBaseTimeStamp());
+ }
+ }
+
+ return branches;
+ }
+
+ public synchronized InternalCDOBranch[] getBranches()
+ {
+ return getBranches(true);
+ }
+
+ public InternalCDOBranch getBranch(String path)
+ {
+ while (path.startsWith(PATH_SEPARATOR))
+ {
+ path = path.substring(1);
+ }
+
+ while (path.endsWith(PATH_SEPARATOR))
+ {
+ path = path.substring(0, path.length() - PATH_SEPARATOR.length());
+ }
+
+ int sep = path.indexOf(PATH_SEPARATOR);
+ if (sep == -1)
+ {
+ return getChild(path);
+ }
+
+ String name = path.substring(0, sep);
+ InternalCDOBranch child = getChild(name);
+ if (child == null)
+ {
+ return null;
+ }
+
+ // Recurse
+ String rest = path.substring(sep + 1);
+ return child.getBranch(rest);
+ }
+
+ private InternalCDOBranch getChild(String name)
+ {
+ InternalCDOBranch[] branches = getBranches();
+ for (InternalCDOBranch branch : branches)
+ {
+ if (name.equals(branch.getName()))
+ {
+ return branch;
+ }
+ }
+
+ return null;
+ }
+
+ public BranchInfo getBranchInfo()
+ {
+ CDOBranchPoint base = getBase();
+ return new BranchInfo(getName(), base.getBranch().getID(), base.getTimeStamp());
+ }
+
+ public void setBranchInfo(String name, InternalCDOBranch baseBranch, long baseTimeStamp)
+ {
+ this.name = name;
+ base = baseBranch.getPoint(baseTimeStamp);
+ }
+
+ public void addChild(InternalCDOBranch branch)
+ {
+ synchronized (this)
+ {
+ if (branches == null)
+ {
+ branches = new InternalCDOBranch[] { branch };
+ }
+ else
+ {
+ InternalCDOBranch[] newBranches = new InternalCDOBranch[branches.length + 1];
+ System.arraycopy(branches, 0, newBranches, 0, branches.length);
+ newBranches[branches.length] = branch;
+ branches = newBranches;
+ }
+ }
+
+ fireElementAddedEvent(branch);
+ }
+
+ public int compareTo(CDOBranch o)
+ {
+ int otherID = o.getID();
+ return id < otherID ? -1 : id == otherID ? 0 : 1;
+ }
+
+ @Override
+ public int hashCode()
+ {
+ return id;
+ }
+
+ @Override
+ public boolean equals(Object obj)
+ {
+ if (obj == this)
+ {
+ return true;
+ }
+
+ if (obj instanceof CDOBranch)
+ {
+ CDOBranch that = (CDOBranch)obj;
+ return id == that.getID();
+ }
+
+ return false;
+ }
+
+ @Override
+ public String toString()
+ {
+ if (isProxy())
+ {
+ return MessageFormat.format("Branch[id={0}, PROXY]", id); //$NON-NLS-1$
+ }
+
+ return MessageFormat.format("Branch[id={0}, name={1}]", id, name); //$NON-NLS-1$
+ }
+
+ private synchronized void load()
+ {
+ BranchInfo branchInfo = branchManager.getBranchLoader().loadBranch(id);
+ CDOBranch baseBranch = branchManager.getBranch(branchInfo.getBaseBranchID());
+
+ name = branchInfo.getName();
+ base = baseBranch.getPoint(branchInfo.getBaseTimeStamp());
+ }
+
+ /**
+ * @author Eike Stepper
+ */
+ public static class Main extends CDOBranchImpl
+ {
+ private boolean local;
+
+ public Main(InternalCDOBranchManager branchManager, boolean local, long timeStamp)
+ {
+ super(branchManager, MAIN_BRANCH_ID, MAIN_BRANCH_NAME, new CDOBranchPointImpl(null, timeStamp));
+ this.local = local;
+ }
+
+ @Override
+ public boolean isMainBranch()
+ {
+ return true;
+ }
+
+ @Override
+ public boolean isLocal()
+ {
+ return local;
+ }
+ }
+}
diff --git a/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/internal/common/branch/CDOBranchManagerImpl.java b/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/internal/common/branch/CDOBranchManagerImpl.java
index 5f46a60958..94e69d80aa 100644
--- a/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/internal/common/branch/CDOBranchManagerImpl.java
+++ b/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/internal/common/branch/CDOBranchManagerImpl.java
@@ -1,251 +1,251 @@
-/*
- * Copyright (c) 2004 - 2011 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.branch;
-
-import org.eclipse.emf.cdo.common.branch.CDOBranch;
-import org.eclipse.emf.cdo.common.branch.CDOBranchCreatedEvent;
-import org.eclipse.emf.cdo.common.branch.CDOBranchHandler;
-import org.eclipse.emf.cdo.common.branch.CDOBranchManager;
-import org.eclipse.emf.cdo.common.branch.CDOBranchPoint;
-import org.eclipse.emf.cdo.common.util.CDOTimeProvider;
-import org.eclipse.emf.cdo.spi.common.branch.InternalCDOBranch;
-import org.eclipse.emf.cdo.spi.common.branch.InternalCDOBranchManager;
-import org.eclipse.emf.cdo.spi.common.branch.InternalCDOBranchManager.BranchLoader.BranchInfo;
-
-import org.eclipse.net4j.util.collection.Pair;
-import org.eclipse.net4j.util.container.Container;
-import org.eclipse.net4j.util.event.Event;
-import org.eclipse.net4j.util.ref.ReferenceValueMap;
-import org.eclipse.net4j.util.ref.ReferenceValueMap.Soft;
-
-import java.util.Map;
-
-/**
- * @author Eike Stepper
- */
-public class CDOBranchManagerImpl extends Container<CDOBranch> implements InternalCDOBranchManager
-{
- private BranchLoader branchLoader;
-
- private CDOTimeProvider timeProvider;
-
- private InternalCDOBranch mainBranch;
-
- private Map<Integer, InternalCDOBranch> branches = createMap();
-
- public CDOBranchManagerImpl()
- {
- }
-
- public BranchLoader getBranchLoader()
- {
- return branchLoader;
- }
-
- public void setBranchLoader(BranchLoader branchLoader)
- {
- checkInactive();
- this.branchLoader = branchLoader;
- }
-
- public CDOTimeProvider getTimeProvider()
- {
- return timeProvider;
- }
-
- public void setTimeProvider(CDOTimeProvider timeProvider)
- {
- this.timeProvider = timeProvider;
- }
-
- public void initMainBranch(boolean local, long timeStamp)
- {
- mainBranch = new CDOBranchImpl.Main(this, local, timeStamp);
- }
-
- public void handleBranchCreated(InternalCDOBranch branch)
- {
- CDOBranchPoint base = branch.getBase();
- InternalCDOBranch baseBranch = (InternalCDOBranch)base.getBranch();
- baseBranch.addChild(branch);
-
- fireEvent(new BranchCreatedEvent(branch));
- }
-
- public CDOBranch[] getElements()
- {
- return new CDOBranch[] { getMainBranch() };
- }
-
- public InternalCDOBranch getMainBranch()
- {
- checkActive();
- return mainBranch;
- }
-
- public InternalCDOBranch getBranch(int branchID)
- {
- checkActive();
- if (branchID == CDOBranch.MAIN_BRANCH_ID)
- {
- return mainBranch;
- }
-
- InternalCDOBranch branch;
- synchronized (branches)
- {
- branch = branches.get(branchID);
- if (branch == null)
- {
- branch = new CDOBranchImpl(this, branchID, null, null);
- putBranch(branch);
- }
- }
-
- return branch;
- }
-
- public InternalCDOBranch getBranch(int id, String name, InternalCDOBranch baseBranch, long baseTimeStamp)
- {
- synchronized (branches)
- {
- InternalCDOBranch branch = branches.get(id);
- if (branch == null)
- {
- branch = new CDOBranchImpl(this, id, name, baseBranch.getPoint(baseTimeStamp));
- putBranch(branch);
- }
- else if (branch.isProxy())
- {
- branch.setBranchInfo(name, baseBranch, baseTimeStamp);
- }
-
- return branch;
- }
- }
-
- public InternalCDOBranch getBranch(int id, BranchInfo branchInfo)
- {
- String name = branchInfo.getName();
- InternalCDOBranch baseBranch = getBranch(branchInfo.getBaseBranchID());
- long baseTimeStamp = branchInfo.getBaseTimeStamp();
- return getBranch(id, name, baseBranch, baseTimeStamp);
- }
-
- public InternalCDOBranch getBranch(String path)
- {
- if (path.startsWith(CDOBranch.PATH_SEPARATOR))
- {
- path = path.substring(1);
- }
-
- int sep = path.indexOf(CDOBranch.PATH_SEPARATOR);
- if (sep == -1)
- {
- if (CDOBranch.MAIN_BRANCH_NAME.equals(path))
- {
- return mainBranch;
- }
-
- return null;
- }
-
- String name = path.substring(0, sep);
- if (CDOBranch.MAIN_BRANCH_NAME.equals(name))
- {
- String rest = path.substring(sep + 1);
- return mainBranch.getBranch(rest);
- }
-
- return null;
- }
-
- public int getBranches(int startID, int endID, CDOBranchHandler handler)
- {
- checkActive();
- return branchLoader.loadBranches(startID, endID, handler);
- }
-
- public InternalCDOBranch createBranch(int branchID, String name, InternalCDOBranch baseBranch, long baseTimeStamp)
- {
- checkActive();
-
- Pair<Integer, Long> result = branchLoader.createBranch(branchID, new BranchInfo(name, baseBranch.getID(),
- baseTimeStamp));
- branchID = result.getElement1();
- baseTimeStamp = result.getElement2();
-
- CDOBranchPoint base = baseBranch.getPoint(baseTimeStamp);
- InternalCDOBranch branch = new CDOBranchImpl(this, branchID, name, base);
- synchronized (branches)
- {
- putBranch(branch);
- }
-
- handleBranchCreated(branch);
- return branch;
- }
-
- /**
- * {@link #branches} must be synchronized by caller!
- */
- private boolean putBranch(InternalCDOBranch branch)
- {
- int id = branch.getID();
- if (branches.containsKey(id))
- {
- return false;
- }
-
- branches.put(id, branch);
- return true;
- }
-
- protected Soft<Integer, InternalCDOBranch> createMap()
- {
- return new ReferenceValueMap.Soft<Integer, InternalCDOBranch>();
- }
-
- @Override
- protected void doBeforeActivate() throws Exception
- {
- super.doBeforeActivate();
- checkState(branchLoader, "branchLoader"); //$NON-NLS-1$
- checkState(timeProvider, "timeProvider"); //$NON-NLS-1$
- }
-
- /**
- * @author Eike Stepper
- */
- private static final class BranchCreatedEvent extends Event implements CDOBranchCreatedEvent
- {
- private static final long serialVersionUID = 1L;
-
- private CDOBranch branch;
-
- public BranchCreatedEvent(CDOBranch branch)
- {
- super(branch.getBranchManager());
- this.branch = branch;
- }
-
- @Override
- public CDOBranchManager getSource()
- {
- return (CDOBranchManager)super.getSource();
- }
-
- public CDOBranch getBranch()
- {
- return branch;
- }
- }
-}
+/*
+ * Copyright (c) 2004 - 2012 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.branch;
+
+import org.eclipse.emf.cdo.common.branch.CDOBranch;
+import org.eclipse.emf.cdo.common.branch.CDOBranchCreatedEvent;
+import org.eclipse.emf.cdo.common.branch.CDOBranchHandler;
+import org.eclipse.emf.cdo.common.branch.CDOBranchManager;
+import org.eclipse.emf.cdo.common.branch.CDOBranchPoint;
+import org.eclipse.emf.cdo.common.util.CDOTimeProvider;
+import org.eclipse.emf.cdo.spi.common.branch.InternalCDOBranch;
+import org.eclipse.emf.cdo.spi.common.branch.InternalCDOBranchManager;
+import org.eclipse.emf.cdo.spi.common.branch.InternalCDOBranchManager.BranchLoader.BranchInfo;
+
+import org.eclipse.net4j.util.collection.Pair;
+import org.eclipse.net4j.util.container.Container;
+import org.eclipse.net4j.util.event.Event;
+import org.eclipse.net4j.util.ref.ReferenceValueMap;
+import org.eclipse.net4j.util.ref.ReferenceValueMap.Soft;
+
+import java.util.Map;
+
+/**
+ * @author Eike Stepper
+ */
+public class CDOBranchManagerImpl extends Container<CDOBranch> implements InternalCDOBranchManager
+{
+ private BranchLoader branchLoader;
+
+ private CDOTimeProvider timeProvider;
+
+ private InternalCDOBranch mainBranch;
+
+ private Map<Integer, InternalCDOBranch> branches = createMap();
+
+ public CDOBranchManagerImpl()
+ {
+ }
+
+ public BranchLoader getBranchLoader()
+ {
+ return branchLoader;
+ }
+
+ public void setBranchLoader(BranchLoader branchLoader)
+ {
+ checkInactive();
+ this.branchLoader = branchLoader;
+ }
+
+ public CDOTimeProvider getTimeProvider()
+ {
+ return timeProvider;
+ }
+
+ public void setTimeProvider(CDOTimeProvider timeProvider)
+ {
+ this.timeProvider = timeProvider;
+ }
+
+ public void initMainBranch(boolean local, long timeStamp)
+ {
+ mainBranch = new CDOBranchImpl.Main(this, local, timeStamp);
+ }
+
+ public void handleBranchCreated(InternalCDOBranch branch)
+ {
+ CDOBranchPoint base = branch.getBase();
+ InternalCDOBranch baseBranch = (InternalCDOBranch)base.getBranch();
+ baseBranch.addChild(branch);
+
+ fireEvent(new BranchCreatedEvent(branch));
+ }
+
+ public CDOBranch[] getElements()
+ {
+ return new CDOBranch[] { getMainBranch() };
+ }
+
+ public InternalCDOBranch getMainBranch()
+ {
+ checkActive();
+ return mainBranch;
+ }
+
+ public InternalCDOBranch getBranch(int branchID)
+ {
+ checkActive();
+ if (branchID == CDOBranch.MAIN_BRANCH_ID)
+ {
+ return mainBranch;
+ }
+
+ InternalCDOBranch branch;
+ synchronized (branches)
+ {
+ branch = branches.get(branchID);
+ if (branch == null)
+ {
+ branch = new CDOBranchImpl(this, branchID, null, null);
+ putBranch(branch);
+ }
+ }
+
+ return branch;
+ }
+
+ public InternalCDOBranch getBranch(int id, String name, InternalCDOBranch baseBranch, long baseTimeStamp)
+ {
+ synchronized (branches)
+ {
+ InternalCDOBranch branch = branches.get(id);
+ if (branch == null)
+ {
+ branch = new CDOBranchImpl(this, id, name, baseBranch.getPoint(baseTimeStamp));
+ putBranch(branch);
+ }
+ else if (branch.isProxy())
+ {
+ branch.setBranchInfo(name, baseBranch, baseTimeStamp);
+ }
+
+ return branch;
+ }
+ }
+
+ public InternalCDOBranch getBranch(int id, BranchInfo branchInfo)
+ {
+ String name = branchInfo.getName();
+ InternalCDOBranch baseBranch = getBranch(branchInfo.getBaseBranchID());
+ long baseTimeStamp = branchInfo.getBaseTimeStamp();
+ return getBranch(id, name, baseBranch, baseTimeStamp);
+ }
+
+ public InternalCDOBranch getBranch(String path)
+ {
+ if (path.startsWith(CDOBranch.PATH_SEPARATOR))
+ {
+ path = path.substring(1);
+ }
+
+ int sep = path.indexOf(CDOBranch.PATH_SEPARATOR);
+ if (sep == -1)
+ {
+ if (CDOBranch.MAIN_BRANCH_NAME.equals(path))
+ {
+ return mainBranch;
+ }
+
+ return null;
+ }
+
+ String name = path.substring(0, sep);
+ if (CDOBranch.MAIN_BRANCH_NAME.equals(name))
+ {
+ String rest = path.substring(sep + 1);
+ return mainBranch.getBranch(rest);
+ }
+
+ return null;
+ }
+
+ public int getBranches(int startID, int endID, CDOBranchHandler handler)
+ {
+ checkActive();
+ return branchLoader.loadBranches(startID, endID, handler);
+ }
+
+ public InternalCDOBranch createBranch(int branchID, String name, InternalCDOBranch baseBranch, long baseTimeStamp)
+ {
+ checkActive();
+
+ Pair<Integer, Long> result = branchLoader.createBranch(branchID, new BranchInfo(name, baseBranch.getID(),
+ baseTimeStamp));
+ branchID = result.getElement1();
+ baseTimeStamp = result.getElement2();
+
+ CDOBranchPoint base = baseBranch.getPoint(baseTimeStamp);
+ InternalCDOBranch branch = new CDOBranchImpl(this, branchID, name, base);
+ synchronized (branches)
+ {
+ putBranch(branch);
+ }
+
+ handleBranchCreated(branch);
+ return branch;
+ }
+
+ /**
+ * {@link #branches} must be synchronized by caller!
+ */
+ private boolean putBranch(InternalCDOBranch branch)
+ {
+ int id = branch.getID();
+ if (branches.containsKey(id))
+ {
+ return false;
+ }
+
+ branches.put(id, branch);
+ return true;
+ }
+
+ protected Soft<Integer, InternalCDOBranch> createMap()
+ {
+ return new ReferenceValueMap.Soft<Integer, InternalCDOBranch>();
+ }
+
+ @Override
+ protected void doBeforeActivate() throws Exception
+ {
+ super.doBeforeActivate();
+ checkState(branchLoader, "branchLoader"); //$NON-NLS-1$
+ checkState(timeProvider, "timeProvider"); //$NON-NLS-1$
+ }
+
+ /**
+ * @author Eike Stepper
+ */
+ private static final class BranchCreatedEvent extends Event implements CDOBranchCreatedEvent
+ {
+ private static final long serialVersionUID = 1L;
+
+ private CDOBranch branch;
+
+ public BranchCreatedEvent(CDOBranch branch)
+ {
+ super(branch.getBranchManager());
+ this.branch = branch;
+ }
+
+ @Override
+ public CDOBranchManager getSource()
+ {
+ return (CDOBranchManager)super.getSource();
+ }
+
+ public CDOBranch getBranch()
+ {
+ return branch;
+ }
+ }
+}
diff --git a/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/internal/common/branch/CDOBranchPointImpl.java b/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/internal/common/branch/CDOBranchPointImpl.java
index e80fc10d22..48341226a1 100644
--- a/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/internal/common/branch/CDOBranchPointImpl.java
+++ b/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/internal/common/branch/CDOBranchPointImpl.java
@@ -1,85 +1,85 @@
-/*
- * Copyright (c) 2004 - 2011 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.branch;
-
-import org.eclipse.emf.cdo.common.branch.CDOBranch;
-import org.eclipse.emf.cdo.common.branch.CDOBranchPoint;
-import org.eclipse.emf.cdo.common.util.CDOCommonUtil;
-
-import org.eclipse.net4j.util.ObjectUtil;
-
-import java.text.MessageFormat;
-
-/**
- * @author Eike Stepper
- */
-public class CDOBranchPointImpl implements CDOBranchPoint, Comparable<CDOBranchPoint>
-{
- private CDOBranch branch;
-
- private long timeStamp;
-
- public CDOBranchPointImpl(CDOBranch branch, long timeStamp)
- {
- this.branch = branch;
- this.timeStamp = timeStamp;
- }
-
- public CDOBranch getBranch()
- {
- return branch;
- }
-
- public long getTimeStamp()
- {
- return timeStamp;
- }
-
- public int compareTo(CDOBranchPoint o)
- {
- int result = branch.compareTo(o.getBranch());
- if (result == 0)
- {
- result = CDOCommonUtil.compareTimeStamps(timeStamp, o.getTimeStamp());
- }
-
- return result;
- }
-
- @Override
- public int hashCode()
- {
- return branch.hashCode() ^ new Long(timeStamp).hashCode();
- }
-
- @Override
- public boolean equals(Object obj)
- {
- if (obj == this)
- {
- return true;
- }
-
- if (obj instanceof CDOBranchPoint)
- {
- CDOBranchPoint that = (CDOBranchPoint)obj;
- return ObjectUtil.equals(branch, that.getBranch()) && timeStamp == that.getTimeStamp();
- }
-
- return false;
- }
-
- @Override
- public String toString()
- {
- return MessageFormat.format("BranchPoint[{0}, {1}]", branch, CDOCommonUtil.formatTimeStamp(timeStamp)); //$NON-NLS-1$
- }
-}
+/*
+ * Copyright (c) 2004 - 2012 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.branch;
+
+import org.eclipse.emf.cdo.common.branch.CDOBranch;
+import org.eclipse.emf.cdo.common.branch.CDOBranchPoint;
+import org.eclipse.emf.cdo.common.util.CDOCommonUtil;
+
+import org.eclipse.net4j.util.ObjectUtil;
+
+import java.text.MessageFormat;
+
+/**
+ * @author Eike Stepper
+ */
+public class CDOBranchPointImpl implements CDOBranchPoint, Comparable<CDOBranchPoint>
+{
+ private CDOBranch branch;
+
+ private long timeStamp;
+
+ public CDOBranchPointImpl(CDOBranch branch, long timeStamp)
+ {
+ this.branch = branch;
+ this.timeStamp = timeStamp;
+ }
+
+ public CDOBranch getBranch()
+ {
+ return branch;
+ }
+
+ public long getTimeStamp()
+ {
+ return timeStamp;
+ }
+
+ public int compareTo(CDOBranchPoint o)
+ {
+ int result = branch.compareTo(o.getBranch());
+ if (result == 0)
+ {
+ result = CDOCommonUtil.compareTimeStamps(timeStamp, o.getTimeStamp());
+ }
+
+ return result;
+ }
+
+ @Override
+ public int hashCode()
+ {
+ return branch.hashCode() ^ new Long(timeStamp).hashCode();
+ }
+
+ @Override
+ public boolean equals(Object obj)
+ {
+ if (obj == this)
+ {
+ return true;
+ }
+
+ if (obj instanceof CDOBranchPoint)
+ {
+ CDOBranchPoint that = (CDOBranchPoint)obj;
+ return ObjectUtil.equals(branch, that.getBranch()) && timeStamp == that.getTimeStamp();
+ }
+
+ return false;
+ }
+
+ @Override
+ public String toString()
+ {
+ return MessageFormat.format("BranchPoint[{0}, {1}]", branch, CDOCommonUtil.formatTimeStamp(timeStamp)); //$NON-NLS-1$
+ }
+}
diff --git a/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/internal/common/branch/CDOBranchPointRangeImpl.java b/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/internal/common/branch/CDOBranchPointRangeImpl.java
index 709d77c4b9..c980e44c84 100644
--- a/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/internal/common/branch/CDOBranchPointRangeImpl.java
+++ b/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/internal/common/branch/CDOBranchPointRangeImpl.java
@@ -1,48 +1,48 @@
-/*
- * Copyright (c) 2004 - 2011 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.branch;
-
-import org.eclipse.emf.cdo.common.branch.CDOBranchPoint;
-import org.eclipse.emf.cdo.common.branch.CDOBranchPointRange;
-
-import java.text.MessageFormat;
-
-/**
- * @author Eike Stepper
- */
-public class CDOBranchPointRangeImpl implements CDOBranchPointRange
-{
- private CDOBranchPoint startPoint;
-
- private CDOBranchPoint endPoint;
-
- public CDOBranchPointRangeImpl(CDOBranchPoint startPoint, CDOBranchPoint endPoint)
- {
- this.startPoint = startPoint;
- this.endPoint = endPoint;
- }
-
- public CDOBranchPoint getStartPoint()
- {
- return startPoint;
- }
-
- public CDOBranchPoint getEndPoint()
- {
- return endPoint;
- }
-
- @Override
- public String toString()
- {
- return MessageFormat.format("Range[{0}, {1}]", startPoint, endPoint); //$NON-NLS-1$
- }
-}
+/*
+ * Copyright (c) 2004 - 2012 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.branch;
+
+import org.eclipse.emf.cdo.common.branch.CDOBranchPoint;
+import org.eclipse.emf.cdo.common.branch.CDOBranchPointRange;
+
+import java.text.MessageFormat;
+
+/**
+ * @author Eike Stepper
+ */
+public class CDOBranchPointRangeImpl implements CDOBranchPointRange
+{
+ private CDOBranchPoint startPoint;
+
+ private CDOBranchPoint endPoint;
+
+ public CDOBranchPointRangeImpl(CDOBranchPoint startPoint, CDOBranchPoint endPoint)
+ {
+ this.startPoint = startPoint;
+ this.endPoint = endPoint;
+ }
+
+ public CDOBranchPoint getStartPoint()
+ {
+ return startPoint;
+ }
+
+ public CDOBranchPoint getEndPoint()
+ {
+ return endPoint;
+ }
+
+ @Override
+ public String toString()
+ {
+ return MessageFormat.format("Range[{0}, {1}]", startPoint, endPoint); //$NON-NLS-1$
+ }
+}
diff --git a/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/internal/common/branch/CDOBranchVersionImpl.java b/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/internal/common/branch/CDOBranchVersionImpl.java
index 369de1d147..dc04d2ad0e 100644
--- a/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/internal/common/branch/CDOBranchVersionImpl.java
+++ b/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/internal/common/branch/CDOBranchVersionImpl.java
@@ -1,73 +1,73 @@
-/*
- * Copyright (c) 2004 - 2011 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.branch;
-
-import org.eclipse.emf.cdo.common.branch.CDOBranch;
-import org.eclipse.emf.cdo.common.branch.CDOBranchVersion;
-
-import org.eclipse.net4j.util.ObjectUtil;
-
-import java.text.MessageFormat;
-
-/**
- * @author Eike Stepper
- */
-public class CDOBranchVersionImpl implements CDOBranchVersion
-{
- private CDOBranch branch;
-
- private int version;
-
- public CDOBranchVersionImpl(CDOBranch branch, int version)
- {
- this.branch = branch;
- this.version = version;
- }
-
- public CDOBranch getBranch()
- {
- return branch;
- }
-
- public int getVersion()
- {
- return version;
- }
-
- @Override
- public int hashCode()
- {
- return branch.hashCode() ^ version;
- }
-
- @Override
- public boolean equals(Object obj)
- {
- if (obj == this)
- {
- return true;
- }
-
- if (obj instanceof CDOBranchVersion)
- {
- CDOBranchVersion that = (CDOBranchVersion)obj;
- return ObjectUtil.equals(branch, that.getBranch()) && version == that.getVersion();
- }
-
- return false;
- }
-
- @Override
- public String toString()
- {
- return MessageFormat.format("BranchVersion[{0}, v{1}]", branch, version); //$NON-NLS-1$
- }
-}
+/*
+ * Copyright (c) 2004 - 2012 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.branch;
+
+import org.eclipse.emf.cdo.common.branch.CDOBranch;
+import org.eclipse.emf.cdo.common.branch.CDOBranchVersion;
+
+import org.eclipse.net4j.util.ObjectUtil;
+
+import java.text.MessageFormat;
+
+/**
+ * @author Eike Stepper
+ */
+public class CDOBranchVersionImpl implements CDOBranchVersion
+{
+ private CDOBranch branch;
+
+ private int version;
+
+ public CDOBranchVersionImpl(CDOBranch branch, int version)
+ {
+ this.branch = branch;
+ this.version = version;
+ }
+
+ public CDOBranch getBranch()
+ {
+ return branch;
+ }
+
+ public int getVersion()
+ {
+ return version;
+ }
+
+ @Override
+ public int hashCode()
+ {
+ return branch.hashCode() ^ version;
+ }
+
+ @Override
+ public boolean equals(Object obj)
+ {
+ if (obj == this)
+ {
+ return true;
+ }
+
+ if (obj instanceof CDOBranchVersion)
+ {
+ CDOBranchVersion that = (CDOBranchVersion)obj;
+ return ObjectUtil.equals(branch, that.getBranch()) && version == that.getVersion();
+ }
+
+ return false;
+ }
+
+ @Override
+ public String toString()
+ {
+ return MessageFormat.format("BranchVersion[{0}, v{1}]", branch, version); //$NON-NLS-1$
+ }
+}
diff --git a/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/internal/common/bundle/OM.java b/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/internal/common/bundle/OM.java
index e14625a66a..90481c4df5 100644
--- a/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/internal/common/bundle/OM.java
+++ b/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/internal/common/bundle/OM.java
@@ -1,58 +1,58 @@
-/*
- * Copyright (c) 2004 - 2011 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.bundle;
-
-import org.eclipse.net4j.util.om.OMBundle;
-import org.eclipse.net4j.util.om.OMPlatform;
-import org.eclipse.net4j.util.om.OSGiActivator;
-import org.eclipse.net4j.util.om.log.OMLogger;
-import org.eclipse.net4j.util.om.trace.OMTracer;
-
-/**
- * The <em>Operations & Maintenance</em> class of this bundle.
- *
- * @author Eike Stepper
- */
-public abstract class OM
-{
- public static final String BUNDLE_ID = "org.eclipse.emf.cdo.common"; //$NON-NLS-1$
-
- public static final OMBundle BUNDLE = OMPlatform.INSTANCE.bundle(BUNDLE_ID, OM.class);
-
- public static final OMTracer DEBUG = BUNDLE.tracer("debug"); //$NON-NLS-1$
-
- public static final OMTracer DEBUG_PROTOCOL = DEBUG.tracer("protocol"); //$NON-NLS-1$
-
- public static final OMTracer DEBUG_ID = DEBUG.tracer("id"); //$NON-NLS-1$
-
- public static final OMTracer DEBUG_REVISION = DEBUG.tracer("revision"); //$NON-NLS-1$
-
- public static final OMTracer PERF = BUNDLE.tracer("perf"); //$NON-NLS-1$
-
- public static final OMTracer PERF_REVISION = PERF.tracer("revision"); //$NON-NLS-1$
-
- public static final OMTracer PERF_REVISION_READING = PERF_REVISION.tracer("reading"); //$NON-NLS-1$
-
- public static final OMTracer PERF_REVISION_WRITING = PERF_REVISION.tracer("writing"); //$NON-NLS-1$
-
- public static final OMLogger LOG = BUNDLE.logger();
-
- /**
- * @author Eike Stepper
- */
- public static final class Activator extends OSGiActivator
- {
- public Activator()
- {
- super(BUNDLE);
- }
- }
-}
+/*
+ * Copyright (c) 2004 - 2012 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.bundle;
+
+import org.eclipse.net4j.util.om.OMBundle;
+import org.eclipse.net4j.util.om.OMPlatform;
+import org.eclipse.net4j.util.om.OSGiActivator;
+import org.eclipse.net4j.util.om.log.OMLogger;
+import org.eclipse.net4j.util.om.trace.OMTracer;
+
+/**
+ * The <em>Operations & Maintenance</em> class of this bundle.
+ *
+ * @author Eike Stepper
+ */
+public abstract class OM
+{
+ public static final String BUNDLE_ID = "org.eclipse.emf.cdo.common"; //$NON-NLS-1$
+
+ public static final OMBundle BUNDLE = OMPlatform.INSTANCE.bundle(BUNDLE_ID, OM.class);
+
+ public static final OMTracer DEBUG = BUNDLE.tracer("debug"); //$NON-NLS-1$
+
+ public static final OMTracer DEBUG_PROTOCOL = DEBUG.tracer("protocol"); //$NON-NLS-1$
+
+ public static final OMTracer DEBUG_ID = DEBUG.tracer("id"); //$NON-NLS-1$
+
+ public static final OMTracer DEBUG_REVISION = DEBUG.tracer("revision"); //$NON-NLS-1$
+
+ public static final OMTracer PERF = BUNDLE.tracer("perf"); //$NON-NLS-1$
+
+ public static final OMTracer PERF_REVISION = PERF.tracer("revision"); //$NON-NLS-1$
+
+ public static final OMTracer PERF_REVISION_READING = PERF_REVISION.tracer("reading"); //$NON-NLS-1$
+
+ public static final OMTracer PERF_REVISION_WRITING = PERF_REVISION.tracer("writing"); //$NON-NLS-1$
+
+ public static final OMLogger LOG = BUNDLE.logger();
+
+ /**
+ * @author Eike Stepper
+ */
+ public static final class Activator extends OSGiActivator
+ {
+ public Activator()
+ {
+ super(BUNDLE);
+ }
+ }
+}
diff --git a/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/internal/common/commit/CDOChangeSetDataImpl.java b/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/internal/common/commit/CDOChangeSetDataImpl.java
index 5bf0c33f6a..b327991a41 100644
--- a/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/internal/common/commit/CDOChangeSetDataImpl.java
+++ b/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/internal/common/commit/CDOChangeSetDataImpl.java
@@ -1,225 +1,225 @@
-/*
- * Copyright (c) 2004 - 2011 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.commit;
-
-import org.eclipse.emf.cdo.common.commit.CDOChangeKind;
-import org.eclipse.emf.cdo.common.commit.CDOChangeSetData;
-import org.eclipse.emf.cdo.common.id.CDOID;
-import org.eclipse.emf.cdo.common.revision.CDOIDAndVersion;
-import org.eclipse.emf.cdo.common.revision.CDORevision;
-import org.eclipse.emf.cdo.common.revision.CDORevisionKey;
-import org.eclipse.emf.cdo.common.revision.delta.CDOFeatureDelta;
-import org.eclipse.emf.cdo.common.revision.delta.CDORevisionDelta;
-import org.eclipse.emf.cdo.spi.common.commit.CDOChangeKindCache;
-import org.eclipse.emf.cdo.spi.common.revision.InternalCDORevisionDelta;
-
-import java.text.MessageFormat;
-import java.util.ArrayList;
-import java.util.Collection;
-import java.util.HashMap;
-import java.util.List;
-import java.util.Map;
-
-/**
- * @author Eike Stepper
- */
-public class CDOChangeSetDataImpl implements CDOChangeSetData
-{
- private List<CDOIDAndVersion> newObjects;
-
- private List<CDORevisionKey> changedObjects;
-
- private List<CDOIDAndVersion> detachedObjects;
-
- private CDOChangeKindCache changeKindCache;
-
- public CDOChangeSetDataImpl(List<CDOIDAndVersion> newObjects, List<CDORevisionKey> changedObjects,
- List<CDOIDAndVersion> detachedObjects)
- {
- this.newObjects = newObjects;
- this.changedObjects = changedObjects;
- this.detachedObjects = detachedObjects;
- }
-
- public CDOChangeSetDataImpl()
- {
- this(new ArrayList<CDOIDAndVersion>(), new ArrayList<CDORevisionKey>(), new ArrayList<CDOIDAndVersion>());
- }
-
- public boolean isEmpty()
- {
- if (newObjects != null && !newObjects.isEmpty())
- {
- return false;
- }
-
- if (changedObjects != null && !changedObjects.isEmpty())
- {
- return false;
- }
-
- if (detachedObjects != null && !detachedObjects.isEmpty())
- {
- return false;
- }
-
- return true;
- }
-
- public CDOChangeSetData copy()
- {
- List<CDOIDAndVersion> newObjectsCopy = new ArrayList<CDOIDAndVersion>(newObjects.size());
- for (CDOIDAndVersion key : newObjects)
- {
- if (key instanceof CDORevision)
- {
- CDORevision revision = (CDORevision)key;
- newObjectsCopy.add(revision.copy());
- }
- else
- {
- newObjectsCopy.add(key);
- }
- }
-
- List<CDORevisionKey> changedObjectsCopy = new ArrayList<CDORevisionKey>(changedObjects.size());
- for (CDORevisionKey key : changedObjects)
- {
- if (key instanceof CDORevisionDelta)
- {
- CDORevisionDelta delta = (CDORevisionDelta)key;
- changedObjectsCopy.add(delta.copy());
- }
- else
- {
- changedObjectsCopy.add(key);
- }
- }
-
- List<CDOIDAndVersion> detachedObjectsCopy = new ArrayList<CDOIDAndVersion>(detachedObjects.size());
- for (CDOIDAndVersion key : detachedObjects)
- {
- detachedObjectsCopy.add(key);
- }
-
- return new CDOChangeSetDataImpl(newObjectsCopy, changedObjectsCopy, detachedObjectsCopy);
- }
-
- public void merge(CDOChangeSetData changeSetData)
- {
- Map<CDOID, CDOIDAndVersion> newMap = new HashMap<CDOID, CDOIDAndVersion>();
- fillMap(newMap, newObjects);
- fillMap(newMap, changeSetData.getNewObjects());
-
- Map<CDOID, CDORevisionKey> changedMap = new HashMap<CDOID, CDORevisionKey>();
- fillMap(changedMap, changedObjects);
- for (CDORevisionKey key : changeSetData.getChangedObjects())
- {
- mergeChangedObject(key, newMap, changedMap);
- }
-
- Map<CDOID, CDOIDAndVersion> detachedMap = new HashMap<CDOID, CDOIDAndVersion>();
- fillMap(detachedMap, detachedObjects);
- for (CDOIDAndVersion key : changeSetData.getDetachedObjects())
- {
- CDOID id = key.getID();
- if (newMap.remove(id) == null)
- {
- detachedMap.put(id, key);
- }
- }
-
- newObjects = new ArrayList<CDOIDAndVersion>(newMap.values());
- changedObjects = new ArrayList<CDORevisionKey>(changedMap.values());
- detachedObjects = new ArrayList<CDOIDAndVersion>(detachedMap.values());
- }
-
- private void mergeChangedObject(CDORevisionKey key, Map<CDOID, CDOIDAndVersion> newMap,
- Map<CDOID, CDORevisionKey> changedMap)
- {
- CDOID id = key.getID();
- if (key instanceof CDORevisionDelta)
- {
- CDORevisionDelta delta = (CDORevisionDelta)key;
-
- // Try to add the delta to existing new revision
- CDOIDAndVersion oldRevision = newMap.get(id);
- if (oldRevision instanceof CDORevision)
- {
- CDORevision newRevision = (CDORevision)oldRevision;
- delta.apply(newRevision);
- return;
- }
-
- // Try to add the delta to existing delta
- CDORevisionKey oldDelta = changedMap.get(id);
- if (oldDelta instanceof CDORevisionDelta)
- {
- InternalCDORevisionDelta newDelta = (InternalCDORevisionDelta)oldDelta;
- for (CDOFeatureDelta featureDelta : delta.getFeatureDeltas())
- {
- newDelta.addFeatureDelta(featureDelta);
- }
-
- return;
- }
- }
-
- // Fall back
- changedMap.put(id, key);
- }
-
- public List<CDOIDAndVersion> getNewObjects()
- {
- return newObjects;
- }
-
- public List<CDORevisionKey> getChangedObjects()
- {
- return changedObjects;
- }
-
- public List<CDOIDAndVersion> getDetachedObjects()
- {
- return detachedObjects;
- }
-
- public synchronized Map<CDOID, CDOChangeKind> getChangeKinds()
- {
- if (changeKindCache == null)
- {
- changeKindCache = new CDOChangeKindCache(this);
- }
-
- return changeKindCache;
- }
-
- public CDOChangeKind getChangeKind(CDOID id)
- {
- return getChangeKinds().get(id);
- }
-
- @Override
- public String toString()
- {
- return MessageFormat
- .format(
- "ChangeSetData[newObjects={0}, changedObjects={1}, detachedObjects={2}]", newObjects.size(), changedObjects.size(), detachedObjects.size()); //$NON-NLS-1$
- }
-
- private static <T extends CDOIDAndVersion> void fillMap(Map<CDOID, T> map, Collection<T> c)
- {
- for (T key : c)
- {
- map.put(key.getID(), key);
- }
- }
-}
+/*
+ * Copyright (c) 2004 - 2012 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.commit;
+
+import org.eclipse.emf.cdo.common.commit.CDOChangeKind;
+import org.eclipse.emf.cdo.common.commit.CDOChangeSetData;
+import org.eclipse.emf.cdo.common.id.CDOID;
+import org.eclipse.emf.cdo.common.revision.CDOIDAndVersion;
+import org.eclipse.emf.cdo.common.revision.CDORevision;
+import org.eclipse.emf.cdo.common.revision.CDORevisionKey;
+import org.eclipse.emf.cdo.common.revision.delta.CDOFeatureDelta;
+import org.eclipse.emf.cdo.common.revision.delta.CDORevisionDelta;
+import org.eclipse.emf.cdo.spi.common.commit.CDOChangeKindCache;
+import org.eclipse.emf.cdo.spi.common.revision.InternalCDORevisionDelta;
+
+import java.text.MessageFormat;
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+
+/**
+ * @author Eike Stepper
+ */
+public class CDOChangeSetDataImpl implements CDOChangeSetData
+{
+ private List<CDOIDAndVersion> newObjects;
+
+ private List<CDORevisionKey> changedObjects;
+
+ private List<CDOIDAndVersion> detachedObjects;
+
+ private CDOChangeKindCache changeKindCache;
+
+ public CDOChangeSetDataImpl(List<CDOIDAndVersion> newObjects, List<CDORevisionKey> changedObjects,
+ List<CDOIDAndVersion> detachedObjects)
+ {
+ this.newObjects = newObjects;
+ this.changedObjects = changedObjects;
+ this.detachedObjects = detachedObjects;
+ }
+
+ public CDOChangeSetDataImpl()
+ {
+ this(new ArrayList<CDOIDAndVersion>(), new ArrayList<CDORevisionKey>(), new ArrayList<CDOIDAndVersion>());
+ }
+
+ public boolean isEmpty()
+ {
+ if (newObjects != null && !newObjects.isEmpty())
+ {
+ return false;
+ }
+
+ if (changedObjects != null && !changedObjects.isEmpty())
+ {
+ return false;
+ }
+
+ if (detachedObjects != null && !detachedObjects.isEmpty())
+ {
+ return false;
+ }
+
+ return true;
+ }
+
+ public CDOChangeSetData copy()
+ {
+ List<CDOIDAndVersion> newObjectsCopy = new ArrayList<CDOIDAndVersion>(newObjects.size());
+ for (CDOIDAndVersion key : newObjects)
+ {
+ if (key instanceof CDORevision)
+ {
+ CDORevision revision = (CDORevision)key;
+ newObjectsCopy.add(revision.copy());
+ }
+ else
+ {
+ newObjectsCopy.add(key);
+ }
+ }
+
+ List<CDORevisionKey> changedObjectsCopy = new ArrayList<CDORevisionKey>(changedObjects.size());
+ for (CDORevisionKey key : changedObjects)
+ {
+ if (key instanceof CDORevisionDelta)
+ {
+ CDORevisionDelta delta = (CDORevisionDelta)key;
+ changedObjectsCopy.add(delta.copy());
+ }
+ else
+ {
+ changedObjectsCopy.add(key);
+ }
+ }
+
+ List<CDOIDAndVersion> detachedObjectsCopy = new ArrayList<CDOIDAndVersion>(detachedObjects.size());
+ for (CDOIDAndVersion key : detachedObjects)
+ {
+ detachedObjectsCopy.add(key);
+ }
+
+ return new CDOChangeSetDataImpl(newObjectsCopy, changedObjectsCopy, detachedObjectsCopy);
+ }
+
+ public void merge(CDOChangeSetData changeSetData)
+ {
+ Map<CDOID, CDOIDAndVersion> newMap = new HashMap<CDOID, CDOIDAndVersion>();
+ fillMap(newMap, newObjects);
+ fillMap(newMap, changeSetData.getNewObjects());
+
+ Map<CDOID, CDORevisionKey> changedMap = new HashMap<CDOID, CDORevisionKey>();
+ fillMap(changedMap, changedObjects);
+ for (CDORevisionKey key : changeSetData.getChangedObjects())
+ {
+ mergeChangedObject(key, newMap, changedMap);
+ }
+
+ Map<CDOID, CDOIDAndVersion> detachedMap = new HashMap<CDOID, CDOIDAndVersion>();
+ fillMap(detachedMap, detachedObjects);
+ for (CDOIDAndVersion key : changeSetData.getDetachedObjects())
+ {
+ CDOID id = key.getID();
+ if (newMap.remove(id) == null)
+ {
+ detachedMap.put(id, key);
+ }
+ }
+
+ newObjects = new ArrayList<CDOIDAndVersion>(newMap.values());
+ changedObjects = new ArrayList<CDORevisionKey>(changedMap.values());
+ detachedObjects = new ArrayList<CDOIDAndVersion>(detachedMap.values());
+ }
+
+ private void mergeChangedObject(CDORevisionKey key, Map<CDOID, CDOIDAndVersion> newMap,
+ Map<CDOID, CDORevisionKey> changedMap)
+ {
+ CDOID id = key.getID();
+ if (key instanceof CDORevisionDelta)
+ {
+ CDORevisionDelta delta = (CDORevisionDelta)key;
+
+ // Try to add the delta to existing new revision
+ CDOIDAndVersion oldRevision = newMap.get(id);
+ if (oldRevision instanceof CDORevision)
+ {
+ CDORevision newRevision = (CDORevision)oldRevision;
+ delta.apply(newRevision);
+ return;
+ }
+
+ // Try to add the delta to existing delta
+ CDORevisionKey oldDelta = changedMap.get(id);
+ if (oldDelta instanceof CDORevisionDelta)
+ {
+ InternalCDORevisionDelta newDelta = (InternalCDORevisionDelta)oldDelta;
+ for (CDOFeatureDelta featureDelta : delta.getFeatureDeltas())
+ {
+ newDelta.addFeatureDelta(featureDelta);
+ }
+
+ return;
+ }
+ }
+
+ // Fall back
+ changedMap.put(id, key);
+ }
+
+ public List<CDOIDAndVersion> getNewObjects()
+ {
+ return newObjects;
+ }
+
+ public List<CDORevisionKey> getChangedObjects()
+ {
+ return changedObjects;
+ }
+
+ public List<CDOIDAndVersion> getDetachedObjects()
+ {
+ return detachedObjects;
+ }
+
+ public synchronized Map<CDOID, CDOChangeKind> getChangeKinds()
+ {
+ if (changeKindCache == null)
+ {
+ changeKindCache = new CDOChangeKindCache(this);
+ }
+
+ return changeKindCache;
+ }
+
+ public CDOChangeKind getChangeKind(CDOID id)
+ {
+ return getChangeKinds().get(id);
+ }
+
+ @Override
+ public String toString()
+ {
+ return MessageFormat
+ .format(
+ "ChangeSetData[newObjects={0}, changedObjects={1}, detachedObjects={2}]", newObjects.size(), changedObjects.size(), detachedObjects.size()); //$NON-NLS-1$
+ }
+
+ private static <T extends CDOIDAndVersion> void fillMap(Map<CDOID, T> map, Collection<T> c)
+ {
+ for (T key : c)
+ {
+ map.put(key.getID(), key);
+ }
+ }
+}
diff --git a/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/internal/common/commit/CDOChangeSetImpl.java b/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/internal/common/commit/CDOChangeSetImpl.java
index ab04acaf47..f637f6ee24 100644
--- a/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/internal/common/commit/CDOChangeSetImpl.java
+++ b/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/internal/common/commit/CDOChangeSetImpl.java
@@ -1,48 +1,48 @@
-/*
- * Copyright (c) 2004 - 2011 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.commit;
-
-import org.eclipse.emf.cdo.common.branch.CDOBranchPoint;
-import org.eclipse.emf.cdo.common.commit.CDOChangeSet;
-import org.eclipse.emf.cdo.common.commit.CDOChangeSetData;
-import org.eclipse.emf.cdo.spi.common.branch.CDOBranchUtil;
-
-/**
- * @author Eike Stepper
- */
-public class CDOChangeSetImpl extends CDOChangeSetDataImpl implements CDOChangeSet
-{
- private CDOBranchPoint startPoint;
-
- private CDOBranchPoint endPoint;
-
- public CDOChangeSetImpl(CDOBranchPoint startPoint, CDOBranchPoint endPoint, CDOChangeSetData data)
- {
- super(data.getNewObjects(), data.getChangedObjects(), data.getDetachedObjects());
- this.startPoint = startPoint;
- this.endPoint = endPoint;
- }
-
- public CDOBranchPoint getStartPoint()
- {
- return startPoint;
- }
-
- public CDOBranchPoint getEndPoint()
- {
- return endPoint;
- }
-
- public CDOBranchPoint getAncestorPoint()
- {
- return CDOBranchUtil.getAncestor(startPoint, endPoint);
- }
-}
+/*
+ * Copyright (c) 2004 - 2012 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.commit;
+
+import org.eclipse.emf.cdo.common.branch.CDOBranchPoint;
+import org.eclipse.emf.cdo.common.commit.CDOChangeSet;
+import org.eclipse.emf.cdo.common.commit.CDOChangeSetData;
+import org.eclipse.emf.cdo.spi.common.branch.CDOBranchUtil;
+
+/**
+ * @author Eike Stepper
+ */
+public class CDOChangeSetImpl extends CDOChangeSetDataImpl implements CDOChangeSet
+{
+ private CDOBranchPoint startPoint;
+
+ private CDOBranchPoint endPoint;
+
+ public CDOChangeSetImpl(CDOBranchPoint startPoint, CDOBranchPoint endPoint, CDOChangeSetData data)
+ {
+ super(data.getNewObjects(), data.getChangedObjects(), data.getDetachedObjects());
+ this.startPoint = startPoint;
+ this.endPoint = endPoint;
+ }
+
+ public CDOBranchPoint getStartPoint()
+ {
+ return startPoint;
+ }
+
+ public CDOBranchPoint getEndPoint()
+ {
+ return endPoint;
+ }
+
+ public CDOBranchPoint getAncestorPoint()
+ {
+ return CDOBranchUtil.getAncestor(startPoint, endPoint);
+ }
+}
diff --git a/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/internal/common/commit/CDOCommitDataImpl.java b/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/internal/common/commit/CDOCommitDataImpl.java
index 9d47b8a77a..3ae3d24957 100644
--- a/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/internal/common/commit/CDOCommitDataImpl.java
+++ b/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/internal/common/commit/CDOCommitDataImpl.java
@@ -1,47 +1,47 @@
-/*
- * Copyright (c) 2004 - 2011 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.commit;
-
-import org.eclipse.emf.cdo.common.commit.CDOCommitData;
-import org.eclipse.emf.cdo.common.model.CDOPackageUnit;
-import org.eclipse.emf.cdo.common.revision.CDOIDAndVersion;
-import org.eclipse.emf.cdo.common.revision.CDORevisionKey;
-
-import java.text.MessageFormat;
-import java.util.List;
-
-/**
- * @author Eike Stepper
- */
-public class CDOCommitDataImpl extends CDOChangeSetDataImpl implements CDOCommitData
-{
- private List<CDOPackageUnit> newPackageUnits;
-
- public CDOCommitDataImpl(List<CDOPackageUnit> newPackageUnits, List<CDOIDAndVersion> newObjects,
- List<CDORevisionKey> changedObjects, List<CDOIDAndVersion> detachedObjects)
- {
- super(newObjects, changedObjects, detachedObjects);
- this.newPackageUnits = newPackageUnits;
- }
-
- public List<CDOPackageUnit> getNewPackageUnits()
- {
- return newPackageUnits;
- }
-
- @Override
- public String toString()
- {
- return MessageFormat.format(
- "CommitData[newPackageUnits={0}, newObjects={1}, changedObjects={2}, detachedObjects={3}]", //$NON-NLS-1$
- newPackageUnits.size(), getNewObjects().size(), getChangedObjects().size(), getDetachedObjects().size());
- }
-}
+/*
+ * Copyright (c) 2004 - 2012 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.commit;
+
+import org.eclipse.emf.cdo.common.commit.CDOCommitData;
+import org.eclipse.emf.cdo.common.model.CDOPackageUnit;
+import org.eclipse.emf.cdo.common.revision.CDOIDAndVersion;
+import org.eclipse.emf.cdo.common.revision.CDORevisionKey;
+
+import java.text.MessageFormat;
+import java.util.List;
+
+/**
+ * @author Eike Stepper
+ */
+public class CDOCommitDataImpl extends CDOChangeSetDataImpl implements CDOCommitData
+{
+ private List<CDOPackageUnit> newPackageUnits;
+
+ public CDOCommitDataImpl(List<CDOPackageUnit> newPackageUnits, List<CDOIDAndVersion> newObjects,
+ List<CDORevisionKey> changedObjects, List<CDOIDAndVersion> detachedObjects)
+ {
+ super(newObjects, changedObjects, detachedObjects);
+ this.newPackageUnits = newPackageUnits;
+ }
+
+ public List<CDOPackageUnit> getNewPackageUnits()
+ {
+ return newPackageUnits;
+ }
+
+ @Override
+ public String toString()
+ {
+ return MessageFormat.format(
+ "CommitData[newPackageUnits={0}, newObjects={1}, changedObjects={2}, detachedObjects={3}]", //$NON-NLS-1$
+ newPackageUnits.size(), getNewObjects().size(), getChangedObjects().size(), getDetachedObjects().size());
+ }
+}
diff --git a/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/internal/common/commit/CDOCommitInfoImpl.java b/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/internal/common/commit/CDOCommitInfoImpl.java
index b4267abc82..b556e5072a 100644
--- a/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/internal/common/commit/CDOCommitInfoImpl.java
+++ b/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/internal/common/commit/CDOCommitInfoImpl.java
@@ -1,153 +1,153 @@
-/*
- * Copyright (c) 2004 - 2011 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.commit;
-
-import org.eclipse.emf.cdo.common.branch.CDOBranch;
-import org.eclipse.emf.cdo.common.commit.CDOChangeKind;
-import org.eclipse.emf.cdo.common.commit.CDOChangeSetData;
-import org.eclipse.emf.cdo.common.commit.CDOCommitData;
-import org.eclipse.emf.cdo.common.commit.CDOCommitInfo;
-import org.eclipse.emf.cdo.common.id.CDOID;
-import org.eclipse.emf.cdo.common.model.CDOPackageUnit;
-import org.eclipse.emf.cdo.common.revision.CDOIDAndVersion;
-import org.eclipse.emf.cdo.common.revision.CDORevisionKey;
-import org.eclipse.emf.cdo.common.util.CDOCommonUtil;
-import org.eclipse.emf.cdo.internal.common.branch.CDOBranchPointImpl;
-import org.eclipse.emf.cdo.spi.common.commit.InternalCDOCommitInfoManager;
-
-import org.eclipse.net4j.util.CheckUtil;
-
-import java.text.MessageFormat;
-import java.util.List;
-import java.util.Map;
-
-/**
- * @author Eike Stepper
- */
-public class CDOCommitInfoImpl extends CDOBranchPointImpl implements CDOCommitInfo
-{
- private InternalCDOCommitInfoManager commitInfoManager;
-
- private long previousTimeStamp;
-
- private String userID;
-
- private String comment;
-
- private CDOCommitData commitData;
-
- public CDOCommitInfoImpl(InternalCDOCommitInfoManager commitInfoManager, CDOBranch branch, long timeStamp,
- long previousTimeStamp, String userID, String comment, CDOCommitData commitData)
- {
- super(branch, timeStamp);
- CheckUtil.checkArg(commitInfoManager, "commitInfoManager"); //$NON-NLS-1$
- this.commitInfoManager = commitInfoManager;
- this.previousTimeStamp = previousTimeStamp;
- this.userID = userID;
- this.comment = comment;
- this.commitData = commitData;
- }
-
- public InternalCDOCommitInfoManager getCommitInfoManager()
- {
- return commitInfoManager;
- }
-
- public long getPreviousTimeStamp()
- {
- return previousTimeStamp;
- }
-
- public String getUserID()
- {
- return userID;
- }
-
- public String getComment()
- {
- return comment;
- }
-
- public boolean isEmpty()
- {
- return false;
- }
-
- public CDOChangeSetData copy()
- {
- return commitData == null ? null : commitData.copy();
- }
-
- public void merge(CDOChangeSetData changeSetData)
- {
- loadCommitDataIfNeeded();
- commitData.merge(changeSetData);
- }
-
- public synchronized List<CDOPackageUnit> getNewPackageUnits()
- {
- loadCommitDataIfNeeded();
- return commitData.getNewPackageUnits();
- }
-
- public synchronized List<CDOIDAndVersion> getNewObjects()
- {
- loadCommitDataIfNeeded();
- return commitData.getNewObjects();
- }
-
- public synchronized List<CDORevisionKey> getChangedObjects()
- {
- loadCommitDataIfNeeded();
- return commitData.getChangedObjects();
- }
-
- public synchronized List<CDOIDAndVersion> getDetachedObjects()
- {
- loadCommitDataIfNeeded();
- return commitData.getDetachedObjects();
- }
-
- public Map<CDOID, CDOChangeKind> getChangeKinds()
- {
- loadCommitDataIfNeeded();
- return commitData.getChangeKinds();
- }
-
- public CDOChangeKind getChangeKind(CDOID id)
- {
- loadCommitDataIfNeeded();
- return commitData.getChangeKind(id);
- }
-
- @Override
- public String toString()
- {
- String data = null;
- if (commitData != null)
- {
- data = commitData.toString();
- }
-
- String timeStamp = CDOCommonUtil.formatTimeStamp(getTimeStamp());
- return MessageFormat
- .format(
- "CommitInfo[{0}, {1}, {2}, {3}, {4}, {5}]", getPreviousTimeStamp(), getBranch(), timeStamp, getUserID(), getComment(), data); //$NON-NLS-1$
- }
-
- private void loadCommitDataIfNeeded()
- {
- if (commitData == null)
- {
- commitData = commitInfoManager.getCommitInfoLoader().loadCommitData(getTimeStamp());
- }
- }
-}
+/*
+ * Copyright (c) 2004 - 2012 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.commit;
+
+import org.eclipse.emf.cdo.common.branch.CDOBranch;
+import org.eclipse.emf.cdo.common.commit.CDOChangeKind;
+import org.eclipse.emf.cdo.common.commit.CDOChangeSetData;
+import org.eclipse.emf.cdo.common.commit.CDOCommitData;
+import org.eclipse.emf.cdo.common.commit.CDOCommitInfo;
+import org.eclipse.emf.cdo.common.id.CDOID;
+import org.eclipse.emf.cdo.common.model.CDOPackageUnit;
+import org.eclipse.emf.cdo.common.revision.CDOIDAndVersion;
+import org.eclipse.emf.cdo.common.revision.CDORevisionKey;
+import org.eclipse.emf.cdo.common.util.CDOCommonUtil;
+import org.eclipse.emf.cdo.internal.common.branch.CDOBranchPointImpl;
+import org.eclipse.emf.cdo.spi.common.commit.InternalCDOCommitInfoManager;
+
+import org.eclipse.net4j.util.CheckUtil;
+
+import java.text.MessageFormat;
+import java.util.List;
+import java.util.Map;
+
+/**
+ * @author Eike Stepper
+ */
+public class CDOCommitInfoImpl extends CDOBranchPointImpl implements CDOCommitInfo
+{
+ private InternalCDOCommitInfoManager commitInfoManager;
+
+ private long previousTimeStamp;
+
+ private String userID;
+
+ private String comment;
+
+ private CDOCommitData commitData;
+
+ public CDOCommitInfoImpl(InternalCDOCommitInfoManager commitInfoManager, CDOBranch branch, long timeStamp,
+ long previousTimeStamp, String userID, String comment, CDOCommitData commitData)
+ {
+ super(branch, timeStamp);
+ CheckUtil.checkArg(commitInfoManager, "commitInfoManager"); //$NON-NLS-1$
+ this.commitInfoManager = commitInfoManager;
+ this.previousTimeStamp = previousTimeStamp;
+ this.userID = userID;
+ this.comment = comment;
+ this.commitData = commitData;
+ }
+
+ public InternalCDOCommitInfoManager getCommitInfoManager()
+ {
+ return commitInfoManager;
+ }
+
+ public long getPreviousTimeStamp()
+ {
+ return previousTimeStamp;
+ }
+
+ public String getUserID()
+ {
+ return userID;
+ }
+
+ public String getComment()
+ {
+ return comment;
+ }
+
+ public boolean isEmpty()
+ {
+ return false;
+ }
+
+ public CDOChangeSetData copy()
+ {
+ return commitData == null ? null : commitData.copy();
+ }
+
+ public void merge(CDOChangeSetData changeSetData)
+ {
+ loadCommitDataIfNeeded();
+ commitData.merge(changeSetData);
+ }
+
+ public synchronized List<CDOPackageUnit> getNewPackageUnits()
+ {
+ loadCommitDataIfNeeded();
+ return commitData.getNewPackageUnits();
+ }
+
+ public synchronized List<CDOIDAndVersion> getNewObjects()
+ {
+ loadCommitDataIfNeeded();
+ return commitData.getNewObjects();
+ }
+
+ public synchronized List<CDORevisionKey> getChangedObjects()
+ {
+ loadCommitDataIfNeeded();
+ return commitData.getChangedObjects();
+ }
+
+ public synchronized List<CDOIDAndVersion> getDetachedObjects()
+ {
+ loadCommitDataIfNeeded();
+ return commitData.getDetachedObjects();
+ }
+
+ public Map<CDOID, CDOChangeKind> getChangeKinds()
+ {
+ loadCommitDataIfNeeded();
+ return commitData.getChangeKinds();
+ }
+
+ public CDOChangeKind getChangeKind(CDOID id)
+ {
+ loadCommitDataIfNeeded();
+ return commitData.getChangeKind(id);
+ }
+
+ @Override
+ public String toString()
+ {
+ String data = null;
+ if (commitData != null)
+ {
+ data = commitData.toString();
+ }
+
+ String timeStamp = CDOCommonUtil.formatTimeStamp(getTimeStamp());
+ return MessageFormat
+ .format(
+ "CommitInfo[{0}, {1}, {2}, {3}, {4}, {5}]", getPreviousTimeStamp(), getBranch(), timeStamp, getUserID(), getComment(), data); //$NON-NLS-1$
+ }
+
+ private void loadCommitDataIfNeeded()
+ {
+ if (commitData == null)
+ {
+ commitData = commitInfoManager.getCommitInfoLoader().loadCommitData(getTimeStamp());
+ }
+ }
+}
diff --git a/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/internal/common/commit/CDOCommitInfoManagerImpl.java b/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/internal/common/commit/CDOCommitInfoManagerImpl.java
index 78f1339385..271f294d24 100644
--- a/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/internal/common/commit/CDOCommitInfoManagerImpl.java
+++ b/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/internal/common/commit/CDOCommitInfoManagerImpl.java
@@ -1,87 +1,87 @@
-/*
- * Copyright (c) 2004 - 2011 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
- * Andre Dietisheim - bug 256649
- */
-package org.eclipse.emf.cdo.internal.common.commit;
-
-import org.eclipse.emf.cdo.common.branch.CDOBranch;
-import org.eclipse.emf.cdo.common.commit.CDOCommitData;
-import org.eclipse.emf.cdo.common.commit.CDOCommitInfo;
-import org.eclipse.emf.cdo.common.commit.CDOCommitInfoHandler;
-import org.eclipse.emf.cdo.spi.common.commit.InternalCDOCommitInfoManager;
-
-import org.eclipse.net4j.util.lifecycle.Lifecycle;
-
-/**
- * @author Andre Dietisheim
- */
-public class CDOCommitInfoManagerImpl extends Lifecycle implements InternalCDOCommitInfoManager
-{
- private CommitInfoLoader commitInfoLoader;
-
- public CDOCommitInfoManagerImpl()
- {
- }
-
- public CommitInfoLoader getCommitInfoLoader()
- {
- return commitInfoLoader;
- }
-
- public void setCommitInfoLoader(CommitInfoLoader commitInfoLoader)
- {
- checkInactive();
- this.commitInfoLoader = commitInfoLoader;
- }
-
- public CDOCommitInfo createCommitInfo(CDOBranch branch, long timeStamp, long previousTimeStamp, String userID,
- String comment, CDOCommitData commitData)
- {
- checkActive();
- return new CDOCommitInfoImpl(this, branch, timeStamp, previousTimeStamp, userID, comment, commitData);
- }
-
- public CDOCommitInfo getCommitInfo(long timeStamp)
- {
- checkActive();
- final CDOCommitInfo[] result = { null };
- getCommitInfos(null, timeStamp, timeStamp, new CDOCommitInfoHandler()
- {
- public void handleCommitInfo(CDOCommitInfo commitInfo)
- {
- result[0] = commitInfo;
- }
- });
-
- return result[0];
- }
-
- public void getCommitInfos(CDOBranch branch, long startTime, long endTime, CDOCommitInfoHandler handler)
- {
- checkActive();
- commitInfoLoader.loadCommitInfos(branch, startTime, endTime, handler);
- }
-
- public void getCommitInfos(CDOBranch branch, long startTime, String userID, String comment, int count,
- CDOCommitInfoHandler handler)
- {
- checkActive();
-
- // TODO: implement CDOCommitInfoManagerImpl.getCommitInfos(branch, startTime, userID, comment, count, handler)
- throw new UnsupportedOperationException();
- }
-
- @Override
- protected void doBeforeActivate() throws Exception
- {
- super.doBeforeActivate();
- checkState(commitInfoLoader, "commitInfoLoader"); //$NON-NLS-1$
- }
-}
+/*
+ * Copyright (c) 2004 - 2012 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
+ * Andre Dietisheim - bug 256649
+ */
+package org.eclipse.emf.cdo.internal.common.commit;
+
+import org.eclipse.emf.cdo.common.branch.CDOBranch;
+import org.eclipse.emf.cdo.common.commit.CDOCommitData;
+import org.eclipse.emf.cdo.common.commit.CDOCommitInfo;
+import org.eclipse.emf.cdo.common.commit.CDOCommitInfoHandler;
+import org.eclipse.emf.cdo.spi.common.commit.InternalCDOCommitInfoManager;
+
+import org.eclipse.net4j.util.lifecycle.Lifecycle;
+
+/**
+ * @author Andre Dietisheim
+ */
+public class CDOCommitInfoManagerImpl extends Lifecycle implements InternalCDOCommitInfoManager
+{
+ private CommitInfoLoader commitInfoLoader;
+
+ public CDOCommitInfoManagerImpl()
+ {
+ }
+
+ public CommitInfoLoader getCommitInfoLoader()
+ {
+ return commitInfoLoader;
+ }
+
+ public void setCommitInfoLoader(CommitInfoLoader commitInfoLoader)
+ {
+ checkInactive();
+ this.commitInfoLoader = commitInfoLoader;
+ }
+
+ public CDOCommitInfo createCommitInfo(CDOBranch branch, long timeStamp, long previousTimeStamp, String userID,
+ String comment, CDOCommitData commitData)
+ {
+ checkActive();
+ return new CDOCommitInfoImpl(this, branch, timeStamp, previousTimeStamp, userID, comment, commitData);
+ }
+
+ public CDOCommitInfo getCommitInfo(long timeStamp)
+ {
+ checkActive();
+ final CDOCommitInfo[] result = { null };
+ getCommitInfos(null, timeStamp, timeStamp, new CDOCommitInfoHandler()
+ {
+ public void handleCommitInfo(CDOCommitInfo commitInfo)
+ {
+ result[0] = commitInfo;
+ }
+ });
+
+ return result[0];
+ }
+
+ public void getCommitInfos(CDOBranch branch, long startTime, long endTime, CDOCommitInfoHandler handler)
+ {
+ checkActive();
+ commitInfoLoader.loadCommitInfos(branch, startTime, endTime, handler);
+ }
+
+ public void getCommitInfos(CDOBranch branch, long startTime, String userID, String comment, int count,
+ CDOCommitInfoHandler handler)
+ {
+ checkActive();
+
+ // TODO: implement CDOCommitInfoManagerImpl.getCommitInfos(branch, startTime, userID, comment, count, handler)
+ throw new UnsupportedOperationException();
+ }
+
+ @Override
+ protected void doBeforeActivate() throws Exception
+ {
+ super.doBeforeActivate();
+ checkState(commitInfoLoader, "commitInfoLoader"); //$NON-NLS-1$
+ }
+}
diff --git a/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/internal/common/commit/DelegatingCommitInfo.java b/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/internal/common/commit/DelegatingCommitInfo.java
index 517e590bba..6f464afefe 100644
--- a/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/internal/common/commit/DelegatingCommitInfo.java
+++ b/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/internal/common/commit/DelegatingCommitInfo.java
@@ -1,111 +1,111 @@
-/*
- * Copyright (c) 2004 - 2011 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.commit;
-
-import org.eclipse.emf.cdo.common.branch.CDOBranch;
-import org.eclipse.emf.cdo.common.commit.CDOChangeKind;
-import org.eclipse.emf.cdo.common.commit.CDOChangeSetData;
-import org.eclipse.emf.cdo.common.commit.CDOCommitInfo;
-import org.eclipse.emf.cdo.common.commit.CDOCommitInfoManager;
-import org.eclipse.emf.cdo.common.id.CDOID;
-import org.eclipse.emf.cdo.common.model.CDOPackageUnit;
-import org.eclipse.emf.cdo.common.revision.CDOIDAndVersion;
-import org.eclipse.emf.cdo.common.revision.CDORevisionKey;
-
-import java.util.List;
-import java.util.Map;
-
-/**
- * @author Eike Stepper
- */
-public abstract class DelegatingCommitInfo implements CDOCommitInfo
-{
- public DelegatingCommitInfo()
- {
- }
-
- protected abstract CDOCommitInfo getDelegate();
-
- public CDOBranch getBranch()
- {
- return getDelegate().getBranch();
- }
-
- public CDOCommitInfoManager getCommitInfoManager()
- {
- return getDelegate().getCommitInfoManager();
- }
-
- public long getPreviousTimeStamp()
- {
- return getDelegate().getPreviousTimeStamp();
- }
-
- public long getTimeStamp()
- {
- return getDelegate().getTimeStamp();
- }
-
- public String getUserID()
- {
- return getDelegate().getUserID();
- }
-
- public String getComment()
- {
- return getDelegate().getComment();
- }
-
- public boolean isEmpty()
- {
- return getDelegate().isEmpty();
- }
-
- public List<CDOPackageUnit> getNewPackageUnits()
- {
- return getDelegate().getNewPackageUnits();
- }
-
- public List<CDOIDAndVersion> getNewObjects()
- {
- return getDelegate().getNewObjects();
- }
-
- public List<CDORevisionKey> getChangedObjects()
- {
- return getDelegate().getChangedObjects();
- }
-
- public List<CDOIDAndVersion> getDetachedObjects()
- {
- return getDelegate().getDetachedObjects();
- }
-
- public Map<CDOID, CDOChangeKind> getChangeKinds()
- {
- return getDelegate().getChangeKinds();
- }
-
- public CDOChangeKind getChangeKind(CDOID id)
- {
- return getDelegate().getChangeKind(id);
- }
-
- public CDOChangeSetData copy()
- {
- return getDelegate().copy();
- }
-
- public void merge(CDOChangeSetData changeSetData)
- {
- getDelegate().merge(changeSetData);
- }
-}
+/*
+ * Copyright (c) 2004 - 2012 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.commit;
+
+import org.eclipse.emf.cdo.common.branch.CDOBranch;
+import org.eclipse.emf.cdo.common.commit.CDOChangeKind;
+import org.eclipse.emf.cdo.common.commit.CDOChangeSetData;
+import org.eclipse.emf.cdo.common.commit.CDOCommitInfo;
+import org.eclipse.emf.cdo.common.commit.CDOCommitInfoManager;
+import org.eclipse.emf.cdo.common.id.CDOID;
+import org.eclipse.emf.cdo.common.model.CDOPackageUnit;
+import org.eclipse.emf.cdo.common.revision.CDOIDAndVersion;
+import org.eclipse.emf.cdo.common.revision.CDORevisionKey;
+
+import java.util.List;
+import java.util.Map;
+
+/**
+ * @author Eike Stepper
+ */
+public abstract class DelegatingCommitInfo implements CDOCommitInfo
+{
+ public DelegatingCommitInfo()
+ {
+ }
+
+ protected abstract CDOCommitInfo getDelegate();
+
+ public CDOBranch getBranch()
+ {
+ return getDelegate().getBranch();
+ }
+
+ public CDOCommitInfoManager getCommitInfoManager()
+ {
+ return getDelegate().getCommitInfoManager();
+ }
+
+ public long getPreviousTimeStamp()
+ {
+ return getDelegate().getPreviousTimeStamp();
+ }
+
+ public long getTimeStamp()
+ {
+ return getDelegate().getTimeStamp();
+ }
+
+ public String getUserID()
+ {
+ return getDelegate().getUserID();
+ }
+
+ public String getComment()
+ {
+ return getDelegate().getComment();
+ }
+
+ public boolean isEmpty()
+ {
+ return getDelegate().isEmpty();
+ }
+
+ public List<CDOPackageUnit> getNewPackageUnits()
+ {
+ return getDelegate().getNewPackageUnits();
+ }
+
+ public List<CDOIDAndVersion> getNewObjects()
+ {
+ return getDelegate().getNewObjects();
+ }
+
+ public List<CDORevisionKey> getChangedObjects()
+ {
+ return getDelegate().getChangedObjects();
+ }
+
+ public List<CDOIDAndVersion> getDetachedObjects()
+ {
+ return getDelegate().getDetachedObjects();
+ }
+
+ public Map<CDOID, CDOChangeKind> getChangeKinds()
+ {
+ return getDelegate().getChangeKinds();
+ }
+
+ public CDOChangeKind getChangeKind(CDOID id)
+ {
+ return getDelegate().getChangeKind(id);
+ }
+
+ public CDOChangeSetData copy()
+ {
+ return getDelegate().copy();
+ }
+
+ public void merge(CDOChangeSetData changeSetData)
+ {
+ getDelegate().merge(changeSetData);
+ }
+}
diff --git a/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/internal/common/commit/FailureCommitInfo.java b/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/internal/common/commit/FailureCommitInfo.java
index c4f54e6cc9..11bc8b007a 100644
--- a/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/internal/common/commit/FailureCommitInfo.java
+++ b/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/internal/common/commit/FailureCommitInfo.java
@@ -1,116 +1,116 @@
-/*
- * Copyright (c) 2004 - 2011 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.commit;
-
-import org.eclipse.emf.cdo.common.branch.CDOBranch;
-import org.eclipse.emf.cdo.common.commit.CDOChangeKind;
-import org.eclipse.emf.cdo.common.commit.CDOChangeSetData;
-import org.eclipse.emf.cdo.common.commit.CDOCommitInfo;
-import org.eclipse.emf.cdo.common.commit.CDOCommitInfoManager;
-import org.eclipse.emf.cdo.common.id.CDOID;
-import org.eclipse.emf.cdo.common.model.CDOPackageUnit;
-import org.eclipse.emf.cdo.common.revision.CDOIDAndVersion;
-import org.eclipse.emf.cdo.common.revision.CDORevisionKey;
-
-import java.util.Collections;
-import java.util.List;
-import java.util.Map;
-
-/**
- * @author Eike Stepper
- */
-public class FailureCommitInfo implements CDOCommitInfo
-{
- private long timeStamp;
-
- private long previousTimeStamp;
-
- public FailureCommitInfo(long timeStamp, long previousTimeStamp)
- {
- this.timeStamp = timeStamp;
- this.previousTimeStamp = previousTimeStamp;
- }
-
- public long getTimeStamp()
- {
- return timeStamp;
- }
-
- public long getPreviousTimeStamp()
- {
- return previousTimeStamp;
- }
-
- public CDOBranch getBranch()
- {
- return null;
- }
-
- public String getUserID()
- {
- return null;
- }
-
- public String getComment()
- {
- return null;
- }
-
- public CDOCommitInfoManager getCommitInfoManager()
- {
- return null;
- }
-
- public boolean isEmpty()
- {
- return true;
- }
-
- public List<CDOPackageUnit> getNewPackageUnits()
- {
- return Collections.emptyList();
- }
-
- public List<CDOIDAndVersion> getNewObjects()
- {
- return Collections.emptyList();
- }
-
- public List<CDORevisionKey> getChangedObjects()
- {
- return Collections.emptyList();
- }
-
- public List<CDOIDAndVersion> getDetachedObjects()
- {
- return Collections.emptyList();
- }
-
- public Map<CDOID, CDOChangeKind> getChangeKinds()
- {
- return Collections.emptyMap();
- }
-
- public CDOChangeKind getChangeKind(CDOID id)
- {
- return null;
- }
-
- public CDOChangeSetData copy()
- {
- return this;
- }
-
- public void merge(CDOChangeSetData changeSetData)
- {
- throw new UnsupportedOperationException();
- }
-}
+/*
+ * Copyright (c) 2004 - 2012 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.commit;
+
+import org.eclipse.emf.cdo.common.branch.CDOBranch;
+import org.eclipse.emf.cdo.common.commit.CDOChangeKind;
+import org.eclipse.emf.cdo.common.commit.CDOChangeSetData;
+import org.eclipse.emf.cdo.common.commit.CDOCommitInfo;
+import org.eclipse.emf.cdo.common.commit.CDOCommitInfoManager;
+import org.eclipse.emf.cdo.common.id.CDOID;
+import org.eclipse.emf.cdo.common.model.CDOPackageUnit;
+import org.eclipse.emf.cdo.common.revision.CDOIDAndVersion;
+import org.eclipse.emf.cdo.common.revision.CDORevisionKey;
+
+import java.util.Collections;
+import java.util.List;
+import java.util.Map;
+
+/**
+ * @author Eike Stepper
+ */
+public class FailureCommitInfo implements CDOCommitInfo
+{
+ private long timeStamp;
+
+ private long previousTimeStamp;
+
+ public FailureCommitInfo(long timeStamp, long previousTimeStamp)
+ {
+ this.timeStamp = timeStamp;
+ this.previousTimeStamp = previousTimeStamp;
+ }
+
+ public long getTimeStamp()
+ {
+ return timeStamp;
+ }
+
+ public long getPreviousTimeStamp()
+ {
+ return previousTimeStamp;
+ }
+
+ public CDOBranch getBranch()
+ {
+ return null;
+ }
+
+ public String getUserID()
+ {
+ return null;
+ }
+
+ public String getComment()
+ {
+ return null;
+ }
+
+ public CDOCommitInfoManager getCommitInfoManager()
+ {
+ return null;
+ }
+
+ public boolean isEmpty()
+ {
+ return true;
+ }
+
+ public List<CDOPackageUnit> getNewPackageUnits()
+ {
+ return Collections.emptyList();
+ }
+
+ public List<CDOIDAndVersion> getNewObjects()
+ {
+ return Collections.emptyList();
+ }
+
+ public List<CDORevisionKey> getChangedObjects()
+ {
+ return Collections.emptyList();
+ }
+
+ public List<CDOIDAndVersion> getDetachedObjects()
+ {
+ return Collections.emptyList();
+ }
+
+ public Map<CDOID, CDOChangeKind> getChangeKinds()
+ {
+ return Collections.emptyMap();
+ }
+
+ public CDOChangeKind getChangeKind(CDOID id)
+ {
+ return null;
+ }
+
+ public CDOChangeSetData copy()
+ {
+ return this;
+ }
+
+ public void merge(CDOChangeSetData changeSetData)
+ {
+ throw new UnsupportedOperationException();
+ }
+}
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 c90cc9af5d..887ac19adf 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
@@ -1,131 +1,131 @@
-/*
- * Copyright (c) 2004 - 2011 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.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;
-
-import org.eclipse.net4j.util.ObjectUtil;
-import org.eclipse.net4j.util.io.ExtendedDataInput;
-import org.eclipse.net4j.util.io.ExtendedDataOutput;
-
-import java.io.IOException;
-
-/**
- * @author Simon McDuff
- */
-public class CDOIDExternalImpl extends AbstractCDOID implements CDOIDExternal
-{
- private static final long serialVersionUID = 1L;
-
- private String uri;
-
- public CDOIDExternalImpl(String uri)
- {
- this.uri = uri;
- }
-
- public Type getType()
- {
- return Type.EXTERNAL_OBJECT;
- }
-
- public boolean isDangling()
- {
- return false;
- }
-
- public boolean isExternal()
- {
- return true;
- }
-
- public boolean isNull()
- {
- return false;
- }
-
- public boolean isObject()
- {
- return true;
- }
-
- public boolean isTemporary()
- {
- return false;
- }
-
- public String getURI()
- {
- return uri;
- }
-
- @Override
- public String toString()
- {
- return "oid:" + toURIFragment(); //$NON-NLS-1$
- }
-
- @Override
- public void read(String fragmentPart)
- {
- uri = fragmentPart;
- }
-
- @Override
- public void read(ExtendedDataInput in) throws IOException
- {
- uri = in.readString();
- }
-
- @Override
- public void write(ExtendedDataOutput out) throws IOException
- {
- out.writeString(uri);
- }
-
- public String toURIFragment()
- {
- return uri;
- }
-
- @Override
- public boolean equals(Object obj)
- {
- if (obj == this)
- {
- return true;
- }
-
- // Could CDOIDTempObjectExternalImpl and CDOIDExternalImpl have the same uri. We don't want to mixed them.
- if (obj != null && obj.getClass() == getClass())
- {
- CDOIDExternal that = (CDOIDExternal)obj;
- return ObjectUtil.equals(getURI(), that.getURI());
- }
-
- return false;
- }
-
- @Override
- public int hashCode()
- {
- return getClass().hashCode() ^ uri.hashCode();
- }
-
- @Override
- protected int doCompareTo(CDOID o) throws ClassCastException
- {
- return getURI().compareTo(((CDOIDExternalImpl)o).getURI());
- }
-}
+/*
+ * Copyright (c) 2004 - 2012 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.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;
+
+import org.eclipse.net4j.util.ObjectUtil;
+import org.eclipse.net4j.util.io.ExtendedDataInput;
+import org.eclipse.net4j.util.io.ExtendedDataOutput;
+
+import java.io.IOException;
+
+/**
+ * @author Simon McDuff
+ */
+public class CDOIDExternalImpl extends AbstractCDOID implements CDOIDExternal
+{
+ private static final long serialVersionUID = 1L;
+
+ private String uri;
+
+ public CDOIDExternalImpl(String uri)
+ {
+ this.uri = uri;
+ }
+
+ public Type getType()
+ {
+ return Type.EXTERNAL_OBJECT;
+ }
+
+ public boolean isDangling()
+ {
+ return false;
+ }
+
+ public boolean isExternal()
+ {
+ return true;
+ }
+
+ public boolean isNull()
+ {
+ return false;
+ }
+
+ public boolean isObject()
+ {
+ return true;
+ }
+
+ public boolean isTemporary()
+ {
+ return false;
+ }
+
+ public String getURI()
+ {
+ return uri;
+ }
+
+ @Override
+ public String toString()
+ {
+ return "oid:" + toURIFragment(); //$NON-NLS-1$
+ }
+
+ @Override
+ public void read(String fragmentPart)
+ {
+ uri = fragmentPart;
+ }
+
+ @Override
+ public void read(ExtendedDataInput in) throws IOException
+ {
+ uri = in.readString();
+ }
+
+ @Override
+ public void write(ExtendedDataOutput out) throws IOException
+ {
+ out.writeString(uri);
+ }
+
+ public String toURIFragment()
+ {
+ return uri;
+ }
+
+ @Override
+ public boolean equals(Object obj)
+ {
+ if (obj == this)
+ {
+ return true;
+ }
+
+ // Could CDOIDTempObjectExternalImpl and CDOIDExternalImpl have the same uri. We don't want to mixed them.
+ if (obj != null && obj.getClass() == getClass())
+ {
+ CDOIDExternal that = (CDOIDExternal)obj;
+ return ObjectUtil.equals(getURI(), that.getURI());
+ }
+
+ return false;
+ }
+
+ @Override
+ public int hashCode()
+ {
+ 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/CDOIDNullImpl.java b/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/internal/common/id/CDOIDNullImpl.java
index 4fd07ea586..4162b4d7b9 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
@@ -1,125 +1,125 @@
-/*
- * Copyright (c) 2004 - 2011 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 - bug 226778
- *
- */
-package org.eclipse.emf.cdo.internal.common.id;
-
-import org.eclipse.emf.cdo.common.id.CDOID;
-import org.eclipse.emf.cdo.common.id.CDOIDObject;
-import org.eclipse.emf.cdo.common.id.CDOIDTemp;
-import org.eclipse.emf.cdo.spi.common.id.AbstractCDOID;
-
-import org.eclipse.net4j.util.io.ExtendedDataInput;
-import org.eclipse.net4j.util.io.ExtendedDataOutput;
-
-import java.io.IOException;
-
-/**
- * @author Eike Stepper
- */
-public final class CDOIDNullImpl extends AbstractCDOID implements CDOIDTemp, CDOIDObject
-{
- public static final CDOIDNullImpl INSTANCE = new CDOIDNullImpl();
-
- private static final long serialVersionUID = 1L;
-
- private CDOIDNullImpl()
- {
- }
-
- public Type getType()
- {
- return Type.NULL;
- }
-
- public boolean isDangling()
- {
- return false;
- }
-
- public boolean isExternal()
- {
- return false;
- }
-
- public boolean isNull()
- {
- return true;
- }
-
- public boolean isObject()
- {
- return false;
- }
-
- public boolean isTemporary()
- {
- return false;
- }
-
- public int getIntValue()
- {
- return 0;
- }
-
- public long getLongValue()
- {
- return 0L;
- }
-
- public String toURIFragment()
- {
- return "NULL"; //$NON-NLS-1$
- }
-
- @Override
- public void read(String fragmentPart)
- {
- // Do nothing
- }
-
- @Override
- public void read(ExtendedDataInput in) throws IOException
- {
- // Do nothing
- }
-
- @Override
- public void write(ExtendedDataOutput out) throws IOException
- {
- // Do nothing
- }
-
- @Override
- public boolean equals(Object obj)
- {
- return obj == INSTANCE;
- }
-
- @Override
- public int hashCode()
- {
- return 0;
- }
-
- @Override
- public String toString()
- {
- return "NULL"; //$NON-NLS-1$
- }
-
- @Override
- protected int doCompareTo(CDOID o) throws ClassCastException
- {
- ((CDOIDNullImpl)o).getIntValue(); // Possibly throw ClassCastException
- return 0; // NULL == NULL
- }
-}
+/*
+ * Copyright (c) 2004 - 2012 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 - bug 226778
+ *
+ */
+package org.eclipse.emf.cdo.internal.common.id;
+
+import org.eclipse.emf.cdo.common.id.CDOID;
+import org.eclipse.emf.cdo.common.id.CDOIDObject;
+import org.eclipse.emf.cdo.common.id.CDOIDTemp;
+import org.eclipse.emf.cdo.spi.common.id.AbstractCDOID;
+
+import org.eclipse.net4j.util.io.ExtendedDataInput;
+import org.eclipse.net4j.util.io.ExtendedDataOutput;
+
+import java.io.IOException;
+
+/**
+ * @author Eike Stepper
+ */
+public final class CDOIDNullImpl extends AbstractCDOID implements CDOIDTemp, CDOIDObject
+{
+ public static final CDOIDNullImpl INSTANCE = new CDOIDNullImpl();
+
+ private static final long serialVersionUID = 1L;
+
+ private CDOIDNullImpl()
+ {
+ }
+
+ public Type getType()
+ {
+ return Type.NULL;
+ }
+
+ public boolean isDangling()
+ {
+ return false;
+ }
+
+ public boolean isExternal()
+ {
+ return false;
+ }
+
+ public boolean isNull()
+ {
+ return true;
+ }
+
+ public boolean isObject()
+ {
+ return false;
+ }
+
+ public boolean isTemporary()
+ {
+ return false;
+ }
+
+ public int getIntValue()
+ {
+ return 0;
+ }
+
+ public long getLongValue()
+ {
+ return 0L;
+ }
+
+ public String toURIFragment()
+ {
+ return "NULL"; //$NON-NLS-1$
+ }
+
+ @Override
+ public void read(String fragmentPart)
+ {
+ // Do nothing
+ }
+
+ @Override
+ public void read(ExtendedDataInput in) throws IOException
+ {
+ // Do nothing
+ }
+
+ @Override
+ public void write(ExtendedDataOutput out) throws IOException
+ {
+ // Do nothing
+ }
+
+ @Override
+ public boolean equals(Object obj)
+ {
+ return obj == INSTANCE;
+ }
+
+ @Override
+ public int hashCode()
+ {
+ return 0;
+ }
+
+ @Override
+ public String toString()
+ {
+ return "NULL"; //$NON-NLS-1$
+ }
+
+ @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/CDOIDObjectLongImpl.java b/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/internal/common/id/CDOIDObjectLongImpl.java
index 49d3eb23b5..9e95fc337c 100644
--- a/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/internal/common/id/CDOIDObjectLongImpl.java
+++ b/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/internal/common/id/CDOIDObjectLongImpl.java
@@ -1,83 +1,83 @@
-/*
- * Copyright (c) 2004 - 2011 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.id;
-
-import org.eclipse.emf.cdo.common.id.CDOID;
-import org.eclipse.emf.cdo.spi.common.id.AbstractCDOIDLong;
-import org.eclipse.emf.cdo.spi.common.id.InternalCDOIDObject;
-
-/**
- * @author Eike Stepper
- * @since 2.0
- */
-public class CDOIDObjectLongImpl extends AbstractCDOIDLong implements InternalCDOIDObject
-{
- private static final long serialVersionUID = 1L;
-
- public CDOIDObjectLongImpl()
- {
- }
-
- public CDOIDObjectLongImpl(long value)
- {
- super(value);
- }
-
- public Type getType()
- {
- return Type.OBJECT;
- }
-
- public boolean isDangling()
- {
- return false;
- }
-
- public boolean isExternal()
- {
- return false;
- }
-
- public boolean isNull()
- {
- return false;
- }
-
- public boolean isObject()
- {
- return true;
- }
-
- public boolean isTemporary()
- {
- return false;
- }
-
- /**
- * @since 3.0
- */
- public CDOID.ObjectType getSubType()
- {
- return CDOID.ObjectType.LONG;
- }
-
- @Override
- public String toString()
- {
- return "OID" + getLongValue(); //$NON-NLS-1$
- }
-
- @Override
- protected int doCompareTo(CDOID o) throws ClassCastException
- {
- return new Long(getLongValue()).compareTo(((CDOIDObjectLongImpl)o).getLongValue());
- }
-}
+/*
+ * Copyright (c) 2004 - 2012 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.id;
+
+import org.eclipse.emf.cdo.common.id.CDOID;
+import org.eclipse.emf.cdo.spi.common.id.AbstractCDOIDLong;
+import org.eclipse.emf.cdo.spi.common.id.InternalCDOIDObject;
+
+/**
+ * @author Eike Stepper
+ * @since 2.0
+ */
+public class CDOIDObjectLongImpl extends AbstractCDOIDLong implements InternalCDOIDObject
+{
+ private static final long serialVersionUID = 1L;
+
+ public CDOIDObjectLongImpl()
+ {
+ }
+
+ public CDOIDObjectLongImpl(long value)
+ {
+ super(value);
+ }
+
+ public Type getType()
+ {
+ return Type.OBJECT;
+ }
+
+ public boolean isDangling()
+ {
+ return false;
+ }
+
+ public boolean isExternal()
+ {
+ return false;
+ }
+
+ public boolean isNull()
+ {
+ return false;
+ }
+
+ public boolean isObject()
+ {
+ return true;
+ }
+
+ public boolean isTemporary()
+ {
+ return false;
+ }
+
+ /**
+ * @since 3.0
+ */
+ public CDOID.ObjectType getSubType()
+ {
+ return CDOID.ObjectType.LONG;
+ }
+
+ @Override
+ public String toString()
+ {
+ return "OID" + getLongValue(); //$NON-NLS-1$
+ }
+
+ @Override
+ protected int doCompareTo(CDOID o) throws ClassCastException
+ {
+ return new Long(getLongValue()).compareTo(((CDOIDObjectLongImpl)o).getLongValue());
+ }
+}
diff --git a/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/internal/common/id/CDOIDObjectLongWithClassifierImpl.java b/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/internal/common/id/CDOIDObjectLongWithClassifierImpl.java
index 7bbc109e38..6e3a5c7ae1 100644
--- a/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/internal/common/id/CDOIDObjectLongWithClassifierImpl.java
+++ b/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/internal/common/id/CDOIDObjectLongWithClassifierImpl.java
@@ -1,145 +1,145 @@
-/*
- * Copyright (c) 2004 - 2011 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:
- * Martin Taal - initial API and implementation
- * Eike Stepper - maintenance
- */
-package org.eclipse.emf.cdo.internal.common.id;
-
-import org.eclipse.emf.cdo.common.id.CDOID;
-import org.eclipse.emf.cdo.common.model.CDOClassifierRef;
-import org.eclipse.emf.cdo.common.protocol.CDODataInput;
-import org.eclipse.emf.cdo.common.protocol.CDODataOutput;
-
-import org.eclipse.net4j.util.ObjectUtil;
-import org.eclipse.net4j.util.io.ExtendedDataInput;
-import org.eclipse.net4j.util.io.ExtendedDataOutput;
-
-import java.io.IOException;
-
-/**
- * @author Martin Taal
- * @since 3.0
- */
-public class CDOIDObjectLongWithClassifierImpl extends CDOIDObjectLongImpl implements CDOClassifierRef.Provider
-{
- private static final long serialVersionUID = 1L;
-
- private CDOClassifierRef classifierRef;
-
- public CDOIDObjectLongWithClassifierImpl()
- {
- }
-
- public CDOIDObjectLongWithClassifierImpl(CDOClassifierRef classifierRef, long value)
- {
- super(value);
- this.classifierRef = classifierRef;
- }
-
- public CDOClassifierRef getClassifierRef()
- {
- return classifierRef;
- }
-
- @Override
- public Type getType()
- {
- return Type.OBJECT;
- }
-
- @Override
- public CDOID.ObjectType getSubType()
- {
- return CDOID.ObjectType.LONG_WITH_CLASSIFIER;
- }
-
- @Override
- public String toURIFragment()
- {
- return getClassifierRef().getPackageURI() + CDOClassifierRef.URI_SEPARATOR + getClassifierRef().getClassifierName()
- + CDOClassifierRef.URI_SEPARATOR + super.toURIFragment();
- }
-
- @Override
- public void read(String fragmentPart)
- {
- // get the CDOClassifierRef part
- int index1 = fragmentPart.indexOf(CDOClassifierRef.URI_SEPARATOR);
- int index2 = fragmentPart.indexOf(CDOClassifierRef.URI_SEPARATOR, index1 + 1);
- if (index1 == -1 || index2 == -1)
- {
- throw new IllegalArgumentException("The fragment " + fragmentPart + " is not a valid fragment");
- }
-
- classifierRef = new CDOClassifierRef(fragmentPart.substring(0, index1), fragmentPart.substring(index1 + 1, index2));
-
- // let the super take care of the rest
- super.read(fragmentPart.substring(index2 + 1));
- }
-
- @Override
- public void read(ExtendedDataInput in) throws IOException
- {
- // TODO: change the parameter to prevent casting to CDODataInput
- CDODataInput cdoDataInput = (CDODataInput)in;
- classifierRef = cdoDataInput.readCDOClassifierRef();
-
- // and let the super take care of the rest
- super.read(in);
- }
-
- @Override
- public void write(ExtendedDataOutput out) throws IOException
- {
- // TODO: change the parameter to prevent casting to CDODataInput
- CDODataOutput cdoDataOutput = (CDODataOutput)out;
- cdoDataOutput.writeCDOClassifierRef(classifierRef);
-
- // and let the super write the rest
- super.write(out);
- }
-
- @Override
- public boolean equals(Object obj)
- {
- if (obj == this)
- {
- return true;
- }
-
- if (obj != null && obj.getClass() == getClass())
- {
- CDOIDObjectLongWithClassifierImpl that = (CDOIDObjectLongWithClassifierImpl)obj;
- return ObjectUtil.equals(classifierRef, that.classifierRef) && getLongValue() == that.getLongValue();
- }
-
- return false;
- }
-
- @Override
- public int hashCode()
- {
- int hashCode = classifierRef.hashCode() ^ ObjectUtil.hashCode(getLongValue());
- return getClass().hashCode() ^ hashCode;
- }
-
- @Override
- public String toString()
- {
- return "OID:" + toURIFragment(); //$NON-NLS-1$
- }
-
- @Override
- protected int doCompareTo(CDOID o) throws ClassCastException
- {
- // conversion to uri fragment is pretty heavy but afaics the compareTo
- // is not used in a critical place.
- return toURIFragment().compareTo(o.toURIFragment());
- }
-}
+/*
+ * Copyright (c) 2004 - 2012 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:
+ * Martin Taal - initial API and implementation
+ * Eike Stepper - maintenance
+ */
+package org.eclipse.emf.cdo.internal.common.id;
+
+import org.eclipse.emf.cdo.common.id.CDOID;
+import org.eclipse.emf.cdo.common.model.CDOClassifierRef;
+import org.eclipse.emf.cdo.common.protocol.CDODataInput;
+import org.eclipse.emf.cdo.common.protocol.CDODataOutput;
+
+import org.eclipse.net4j.util.ObjectUtil;
+import org.eclipse.net4j.util.io.ExtendedDataInput;
+import org.eclipse.net4j.util.io.ExtendedDataOutput;
+
+import java.io.IOException;
+
+/**
+ * @author Martin Taal
+ * @since 3.0
+ */
+public class CDOIDObjectLongWithClassifierImpl extends CDOIDObjectLongImpl implements CDOClassifierRef.Provider
+{
+ private static final long serialVersionUID = 1L;
+
+ private CDOClassifierRef classifierRef;
+
+ public CDOIDObjectLongWithClassifierImpl()
+ {
+ }
+
+ public CDOIDObjectLongWithClassifierImpl(CDOClassifierRef classifierRef, long value)
+ {
+ super(value);
+ this.classifierRef = classifierRef;
+ }
+
+ public CDOClassifierRef getClassifierRef()
+ {
+ return classifierRef;
+ }
+
+ @Override
+ public Type getType()
+ {
+ return Type.OBJECT;
+ }
+
+ @Override
+ public CDOID.ObjectType getSubType()
+ {
+ return CDOID.ObjectType.LONG_WITH_CLASSIFIER;
+ }
+
+ @Override
+ public String toURIFragment()
+ {
+ return getClassifierRef().getPackageURI() + CDOClassifierRef.URI_SEPARATOR + getClassifierRef().getClassifierName()
+ + CDOClassifierRef.URI_SEPARATOR + super.toURIFragment();
+ }
+
+ @Override
+ public void read(String fragmentPart)
+ {
+ // get the CDOClassifierRef part
+ int index1 = fragmentPart.indexOf(CDOClassifierRef.URI_SEPARATOR);
+ int index2 = fragmentPart.indexOf(CDOClassifierRef.URI_SEPARATOR, index1 + 1);
+ if (index1 == -1 || index2 == -1)
+ {
+ throw new IllegalArgumentException("The fragment " + fragmentPart + " is not a valid fragment");
+ }
+
+ classifierRef = new CDOClassifierRef(fragmentPart.substring(0, index1), fragmentPart.substring(index1 + 1, index2));
+
+ // let the super take care of the rest
+ super.read(fragmentPart.substring(index2 + 1));
+ }
+
+ @Override
+ public void read(ExtendedDataInput in) throws IOException
+ {
+ // TODO: change the parameter to prevent casting to CDODataInput
+ CDODataInput cdoDataInput = (CDODataInput)in;
+ classifierRef = cdoDataInput.readCDOClassifierRef();
+
+ // and let the super take care of the rest
+ super.read(in);
+ }
+
+ @Override
+ public void write(ExtendedDataOutput out) throws IOException
+ {
+ // TODO: change the parameter to prevent casting to CDODataInput
+ CDODataOutput cdoDataOutput = (CDODataOutput)out;
+ cdoDataOutput.writeCDOClassifierRef(classifierRef);
+
+ // and let the super write the rest
+ super.write(out);
+ }
+
+ @Override
+ public boolean equals(Object obj)
+ {
+ if (obj == this)
+ {
+ return true;
+ }
+
+ if (obj != null && obj.getClass() == getClass())
+ {
+ CDOIDObjectLongWithClassifierImpl that = (CDOIDObjectLongWithClassifierImpl)obj;
+ return ObjectUtil.equals(classifierRef, that.classifierRef) && getLongValue() == that.getLongValue();
+ }
+
+ return false;
+ }
+
+ @Override
+ public int hashCode()
+ {
+ int hashCode = classifierRef.hashCode() ^ ObjectUtil.hashCode(getLongValue());
+ return getClass().hashCode() ^ hashCode;
+ }
+
+ @Override
+ public String toString()
+ {
+ return "OID:" + toURIFragment(); //$NON-NLS-1$
+ }
+
+ @Override
+ protected int doCompareTo(CDOID o) throws ClassCastException
+ {
+ // conversion to uri fragment is pretty heavy but afaics the compareTo
+ // is not used in a critical place.
+ return toURIFragment().compareTo(o.toURIFragment());
+ }
+}
diff --git a/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/internal/common/id/CDOIDObjectStringImpl.java b/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/internal/common/id/CDOIDObjectStringImpl.java
index 9e8d7c4496..42ceebddd6 100644
--- a/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/internal/common/id/CDOIDObjectStringImpl.java
+++ b/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/internal/common/id/CDOIDObjectStringImpl.java
@@ -1,81 +1,81 @@
-/*
- * Copyright (c) 2004 - 2011 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:
- * Martin Taal - initial API and implementation
- * Eike Stepper - maintenance
- */
-package org.eclipse.emf.cdo.internal.common.id;
-
-import org.eclipse.emf.cdo.common.id.CDOID;
-import org.eclipse.emf.cdo.spi.common.id.AbstractCDOIDString;
-import org.eclipse.emf.cdo.spi.common.id.InternalCDOIDObject;
-
-/**
- * @author Martin Taal
- * @since 3.0
- */
-public class CDOIDObjectStringImpl extends AbstractCDOIDString implements InternalCDOIDObject
-{
- private static final long serialVersionUID = 1L;
-
- public CDOIDObjectStringImpl()
- {
- }
-
- public CDOIDObjectStringImpl(String value)
- {
- super(value);
- }
-
- public Type getType()
- {
- return Type.OBJECT;
- }
-
- public boolean isDangling()
- {
- return false;
- }
-
- public boolean isExternal()
- {
- return false;
- }
-
- public boolean isNull()
- {
- return false;
- }
-
- public boolean isObject()
- {
- return true;
- }
-
- public boolean isTemporary()
- {
- return false;
- }
-
- public CDOID.ObjectType getSubType()
- {
- return CDOID.ObjectType.STRING;
- }
-
- @Override
- public String toString()
- {
- return "OID" + getStringValue(); //$NON-NLS-1$
- }
-
- @Override
- protected int doCompareTo(CDOID o) throws ClassCastException
- {
- return getStringValue().compareTo(((CDOIDObjectStringImpl)o).getStringValue());
- }
-}
+/*
+ * Copyright (c) 2004 - 2012 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:
+ * Martin Taal - initial API and implementation
+ * Eike Stepper - maintenance
+ */
+package org.eclipse.emf.cdo.internal.common.id;
+
+import org.eclipse.emf.cdo.common.id.CDOID;
+import org.eclipse.emf.cdo.spi.common.id.AbstractCDOIDString;
+import org.eclipse.emf.cdo.spi.common.id.InternalCDOIDObject;
+
+/**
+ * @author Martin Taal
+ * @since 3.0
+ */
+public class CDOIDObjectStringImpl extends AbstractCDOIDString implements InternalCDOIDObject
+{
+ private static final long serialVersionUID = 1L;
+
+ public CDOIDObjectStringImpl()
+ {
+ }
+
+ public CDOIDObjectStringImpl(String value)
+ {
+ super(value);
+ }
+
+ public Type getType()
+ {
+ return Type.OBJECT;
+ }
+
+ public boolean isDangling()
+ {
+ return false;
+ }
+
+ public boolean isExternal()
+ {
+ return false;
+ }
+
+ public boolean isNull()
+ {
+ return false;
+ }
+
+ public boolean isObject()
+ {
+ return true;
+ }
+
+ public boolean isTemporary()
+ {
+ return false;
+ }
+
+ public CDOID.ObjectType getSubType()
+ {
+ return CDOID.ObjectType.STRING;
+ }
+
+ @Override
+ public String toString()
+ {
+ return "OID" + getStringValue(); //$NON-NLS-1$
+ }
+
+ @Override
+ protected int doCompareTo(CDOID o) throws ClassCastException
+ {
+ return getStringValue().compareTo(((CDOIDObjectStringImpl)o).getStringValue());
+ }
+}
diff --git a/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/internal/common/id/CDOIDObjectStringWithClassifierImpl.java b/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/internal/common/id/CDOIDObjectStringWithClassifierImpl.java
index 48e592e500..4d24ee6380 100644
--- a/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/internal/common/id/CDOIDObjectStringWithClassifierImpl.java
+++ b/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/internal/common/id/CDOIDObjectStringWithClassifierImpl.java
@@ -1,138 +1,138 @@
-/*
- * Copyright (c) 2004 - 2011 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:
- * Martin Taal - initial API and implementation
- * Eike Stepper - maintenance
- */
-package org.eclipse.emf.cdo.internal.common.id;
-
-import org.eclipse.emf.cdo.common.id.CDOID;
-import org.eclipse.emf.cdo.common.model.CDOClassifierRef;
-import org.eclipse.emf.cdo.common.protocol.CDODataInput;
-import org.eclipse.emf.cdo.common.protocol.CDODataOutput;
-
-import org.eclipse.net4j.util.ObjectUtil;
-import org.eclipse.net4j.util.io.ExtendedDataInput;
-import org.eclipse.net4j.util.io.ExtendedDataOutput;
-
-import java.io.IOException;
-
-/**
- * @author Martin Taal
- * @since 3.0
- */
-public class CDOIDObjectStringWithClassifierImpl extends CDOIDObjectStringImpl implements CDOClassifierRef.Provider
-{
- private static final long serialVersionUID = 1L;
-
- private CDOClassifierRef classifierRef;
-
- public CDOIDObjectStringWithClassifierImpl()
- {
- }
-
- public CDOIDObjectStringWithClassifierImpl(CDOClassifierRef classifierRef, String value)
- {
- super(value);
- this.classifierRef = classifierRef;
- }
-
- public CDOClassifierRef getClassifierRef()
- {
- return classifierRef;
- }
-
- @Override
- public CDOID.ObjectType getSubType()
- {
- return CDOID.ObjectType.STRING_WITH_CLASSIFIER;
- }
-
- @Override
- public String toURIFragment()
- {
- return getClassifierRef().getPackageURI() + CDOClassifierRef.URI_SEPARATOR + getClassifierRef().getClassifierName()
- + CDOClassifierRef.URI_SEPARATOR + super.toURIFragment();
- }
-
- @Override
- public void read(String fragmentPart)
- {
- // get the EClass part
- int index1 = fragmentPart.indexOf(CDOClassifierRef.URI_SEPARATOR);
- int index2 = fragmentPart.indexOf(CDOClassifierRef.URI_SEPARATOR, index1 + 1);
- if (index1 == -1 || index2 == -1)
- {
- throw new IllegalArgumentException("The fragment " + fragmentPart + " is invalid");
- }
-
- classifierRef = new CDOClassifierRef(fragmentPart.substring(0, index1), fragmentPart.substring(index1 + 1, index2));
-
- // let the super take care of the rest
- super.read(fragmentPart.substring(index2 + 1));
- }
-
- @Override
- public void read(ExtendedDataInput in) throws IOException
- {
- CDODataInput cdoDataInput = (CDODataInput)in;
- classifierRef = cdoDataInput.readCDOClassifierRef();
-
- // and let the super take care of the rest
- super.read(in);
- }
-
- @Override
- public void write(ExtendedDataOutput out) throws IOException
- {
- // TODO: change the parameter to prevent casting to CDODataInput
- CDODataOutput cdoDataOutput = (CDODataOutput)out;
- cdoDataOutput.writeCDOClassifierRef(classifierRef);
-
- // and let the super write the rest
- super.write(out);
- }
-
- @Override
- public boolean equals(Object obj)
- {
- if (obj == this)
- {
- return true;
- }
-
- if (obj != null && obj.getClass() == getClass())
- {
- CDOIDObjectStringWithClassifierImpl that = (CDOIDObjectStringWithClassifierImpl)obj;
- return ObjectUtil.equals(classifierRef, that.classifierRef) && getStringValue().equals(that.getStringValue());
- }
-
- return false;
- }
-
- @Override
- public int hashCode()
- {
- int hashCode = classifierRef.hashCode() ^ ObjectUtil.hashCode(getStringValue());
- return getClass().hashCode() ^ hashCode;
- }
-
- @Override
- public String toString()
- {
- return "OID:" + toURIFragment(); //$NON-NLS-1$
- }
-
- @Override
- protected int doCompareTo(CDOID o) throws ClassCastException
- {
- // conversion to uri fragment is pretty heavy but afaics the compareTo
- // is not used in a critical place.
- return toURIFragment().compareTo(o.toURIFragment());
- }
-}
+/*
+ * Copyright (c) 2004 - 2012 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:
+ * Martin Taal - initial API and implementation
+ * Eike Stepper - maintenance
+ */
+package org.eclipse.emf.cdo.internal.common.id;
+
+import org.eclipse.emf.cdo.common.id.CDOID;
+import org.eclipse.emf.cdo.common.model.CDOClassifierRef;
+import org.eclipse.emf.cdo.common.protocol.CDODataInput;
+import org.eclipse.emf.cdo.common.protocol.CDODataOutput;
+
+import org.eclipse.net4j.util.ObjectUtil;
+import org.eclipse.net4j.util.io.ExtendedDataInput;
+import org.eclipse.net4j.util.io.ExtendedDataOutput;
+
+import java.io.IOException;
+
+/**
+ * @author Martin Taal
+ * @since 3.0
+ */
+public class CDOIDObjectStringWithClassifierImpl extends CDOIDObjectStringImpl implements CDOClassifierRef.Provider
+{
+ private static final long serialVersionUID = 1L;
+
+ private CDOClassifierRef classifierRef;
+
+ public CDOIDObjectStringWithClassifierImpl()
+ {
+ }
+
+ public CDOIDObjectStringWithClassifierImpl(CDOClassifierRef classifierRef, String value)
+ {
+ super(value);
+ this.classifierRef = classifierRef;
+ }
+
+ public CDOClassifierRef getClassifierRef()
+ {
+ return classifierRef;
+ }
+
+ @Override
+ public CDOID.ObjectType getSubType()
+ {
+ return CDOID.ObjectType.STRING_WITH_CLASSIFIER;
+ }
+
+ @Override
+ public String toURIFragment()
+ {
+ return getClassifierRef().getPackageURI() + CDOClassifierRef.URI_SEPARATOR + getClassifierRef().getClassifierName()
+ + CDOClassifierRef.URI_SEPARATOR + super.toURIFragment();
+ }
+
+ @Override
+ public void read(String fragmentPart)
+ {
+ // get the EClass part
+ int index1 = fragmentPart.indexOf(CDOClassifierRef.URI_SEPARATOR);
+ int index2 = fragmentPart.indexOf(CDOClassifierRef.URI_SEPARATOR, index1 + 1);
+ if (index1 == -1 || index2 == -1)
+ {
+ throw new IllegalArgumentException("The fragment " + fragmentPart + " is invalid");
+ }
+
+ classifierRef = new CDOClassifierRef(fragmentPart.substring(0, index1), fragmentPart.substring(index1 + 1, index2));
+
+ // let the super take care of the rest
+ super.read(fragmentPart.substring(index2 + 1));
+ }
+
+ @Override
+ public void read(ExtendedDataInput in) throws IOException
+ {
+ CDODataInput cdoDataInput = (CDODataInput)in;
+ classifierRef = cdoDataInput.readCDOClassifierRef();
+
+ // and let the super take care of the rest
+ super.read(in);
+ }
+
+ @Override
+ public void write(ExtendedDataOutput out) throws IOException
+ {
+ // TODO: change the parameter to prevent casting to CDODataInput
+ CDODataOutput cdoDataOutput = (CDODataOutput)out;
+ cdoDataOutput.writeCDOClassifierRef(classifierRef);
+
+ // and let the super write the rest
+ super.write(out);
+ }
+
+ @Override
+ public boolean equals(Object obj)
+ {
+ if (obj == this)
+ {
+ return true;
+ }
+
+ if (obj != null && obj.getClass() == getClass())
+ {
+ CDOIDObjectStringWithClassifierImpl that = (CDOIDObjectStringWithClassifierImpl)obj;
+ return ObjectUtil.equals(classifierRef, that.classifierRef) && getStringValue().equals(that.getStringValue());
+ }
+
+ return false;
+ }
+
+ @Override
+ public int hashCode()
+ {
+ int hashCode = classifierRef.hashCode() ^ ObjectUtil.hashCode(getStringValue());
+ return getClass().hashCode() ^ hashCode;
+ }
+
+ @Override
+ public String toString()
+ {
+ return "OID:" + toURIFragment(); //$NON-NLS-1$
+ }
+
+ @Override
+ protected int doCompareTo(CDOID o) throws ClassCastException
+ {
+ // conversion to uri fragment is pretty heavy but afaics the compareTo
+ // is not used in a critical place.
+ return toURIFragment().compareTo(o.toURIFragment());
+ }
+}
diff --git a/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/internal/common/id/CDOIDObjectUUIDImpl.java b/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/internal/common/id/CDOIDObjectUUIDImpl.java
index 1337fac0db..5b5e04f3fc 100644
--- a/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/internal/common/id/CDOIDObjectUUIDImpl.java
+++ b/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/internal/common/id/CDOIDObjectUUIDImpl.java
@@ -1,104 +1,104 @@
-/*
- * Copyright (c) 2004 - 2011 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:
- * Martin Taal - initial API and implementation
- * Eike Stepper - maintenance
- */
-package org.eclipse.emf.cdo.internal.common.id;
-
-import org.eclipse.emf.cdo.common.id.CDOID;
-import org.eclipse.emf.cdo.spi.common.id.AbstractCDOIDByteArray;
-import org.eclipse.emf.cdo.spi.common.id.InternalCDOIDObject;
-
-/**
- * @author Martin Taal
- * @since 3.0
- */
-public class CDOIDObjectUUIDImpl extends AbstractCDOIDByteArray implements InternalCDOIDObject
-{
- private static final long serialVersionUID = 1L;
-
- public CDOIDObjectUUIDImpl()
- {
- }
-
- public CDOIDObjectUUIDImpl(byte[] value)
- {
- super(value);
- }
-
- public Type getType()
- {
- return Type.OBJECT;
- }
-
- public boolean isDangling()
- {
- return false;
- }
-
- public boolean isExternal()
- {
- return false;
- }
-
- public boolean isNull()
- {
- return false;
- }
-
- public boolean isObject()
- {
- return true;
- }
-
- public boolean isTemporary()
- {
- return false;
- }
-
- public CDOID.ObjectType getSubType()
- {
- return CDOID.ObjectType.UUID;
- }
-
- @Override
- protected int doCompareTo(CDOID o) throws ClassCastException
- {
- byte[] thisValue = getByteArrayValue();
- byte[] thatValue = ((CDOIDObjectUUIDImpl)o).getByteArrayValue();
- int minLength = Math.min(thisValue.length, thatValue.length);
-
- for (int i = 0; i < minLength; i++)
- {
- byte thisByte = thisValue[i];
- byte thatByte = thatValue[i];
- if (thisByte < thatByte)
- {
- return -1;
- }
-
- if (thisByte > thatByte)
- {
- return 1;
- }
- }
-
- if (thisValue.length < thatValue.length)
- {
- return -1;
- }
-
- if (thisValue.length > thatValue.length)
- {
- return 1;
- }
-
- return 0;
- }
-}
+/*
+ * Copyright (c) 2004 - 2012 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:
+ * Martin Taal - initial API and implementation
+ * Eike Stepper - maintenance
+ */
+package org.eclipse.emf.cdo.internal.common.id;
+
+import org.eclipse.emf.cdo.common.id.CDOID;
+import org.eclipse.emf.cdo.spi.common.id.AbstractCDOIDByteArray;
+import org.eclipse.emf.cdo.spi.common.id.InternalCDOIDObject;
+
+/**
+ * @author Martin Taal
+ * @since 3.0
+ */
+public class CDOIDObjectUUIDImpl extends AbstractCDOIDByteArray implements InternalCDOIDObject
+{
+ private static final long serialVersionUID = 1L;
+
+ public CDOIDObjectUUIDImpl()
+ {
+ }
+
+ public CDOIDObjectUUIDImpl(byte[] value)
+ {
+ super(value);
+ }
+
+ public Type getType()
+ {
+ return Type.OBJECT;
+ }
+
+ public boolean isDangling()
+ {
+ return false;
+ }
+
+ public boolean isExternal()
+ {
+ return false;
+ }
+
+ public boolean isNull()
+ {
+ return false;
+ }
+
+ public boolean isObject()
+ {
+ return true;
+ }
+
+ public boolean isTemporary()
+ {
+ return false;
+ }
+
+ public CDOID.ObjectType getSubType()
+ {
+ return CDOID.ObjectType.UUID;
+ }
+
+ @Override
+ protected int doCompareTo(CDOID o) throws ClassCastException
+ {
+ byte[] thisValue = getByteArrayValue();
+ byte[] thatValue = ((CDOIDObjectUUIDImpl)o).getByteArrayValue();
+ int minLength = Math.min(thisValue.length, thatValue.length);
+
+ for (int i = 0; i < minLength; i++)
+ {
+ byte thisByte = thisValue[i];
+ byte thatByte = thatValue[i];
+ if (thisByte < thatByte)
+ {
+ return -1;
+ }
+
+ if (thisByte > thatByte)
+ {
+ return 1;
+ }
+ }
+
+ if (thisValue.length < thatValue.length)
+ {
+ return -1;
+ }
+
+ if (thisValue.length > thatValue.length)
+ {
+ return 1;
+ }
+
+ return 0;
+ }
+}
diff --git a/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/internal/common/id/CDOIDTempObjectExternalImpl.java b/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/internal/common/id/CDOIDTempObjectExternalImpl.java
index a0c534dacf..1a637113b6 100644
--- a/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/internal/common/id/CDOIDTempObjectExternalImpl.java
+++ b/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/internal/common/id/CDOIDTempObjectExternalImpl.java
@@ -1,33 +1,33 @@
-/*
- * Copyright (c) 2004 - 2011 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.id;
-
-import org.eclipse.emf.cdo.common.id.CDOIDTemp;
-
-/**
- * @author Simon McDuff
- */
-public class CDOIDTempObjectExternalImpl extends CDOIDExternalImpl implements CDOIDTemp
-{
- private static final long serialVersionUID = 1L;
-
- public CDOIDTempObjectExternalImpl(String uri)
- {
- super(uri);
- }
-
- @Override
- public Type getType()
- {
- return Type.EXTERNAL_TEMP_OBJECT;
- }
-}
+/*
+ * Copyright (c) 2004 - 2012 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.id;
+
+import org.eclipse.emf.cdo.common.id.CDOIDTemp;
+
+/**
+ * @author Simon McDuff
+ */
+public class CDOIDTempObjectExternalImpl extends CDOIDExternalImpl implements CDOIDTemp
+{
+ private static final long serialVersionUID = 1L;
+
+ public CDOIDTempObjectExternalImpl(String uri)
+ {
+ super(uri);
+ }
+
+ @Override
+ public Type getType()
+ {
+ return Type.EXTERNAL_TEMP_OBJECT;
+ }
+}
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 28601c5ad9..625d9660b4 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
@@ -1,70 +1,70 @@
-/*
- * Copyright (c) 2004 - 2011 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.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;
-
-/**
- * @author Eike Stepper
- */
-public class CDOIDTempObjectImpl extends AbstractCDOIDInteger implements CDOIDTemp
-{
- private static final long serialVersionUID = 1L;
-
- public CDOIDTempObjectImpl(int value)
- {
- super(value);
- }
-
- public Type getType()
- {
- return Type.TEMP_OBJECT;
- }
-
- public boolean isDangling()
- {
- return false;
- }
-
- public boolean isExternal()
- {
- return false;
- }
-
- public boolean isNull()
- {
- return false;
- }
-
- public boolean isObject()
- {
- return true;
- }
-
- public boolean isTemporary()
- {
- return true;
- }
-
- @Override
- public String toString()
- {
- return "oid" + getIntValue(); //$NON-NLS-1$
- }
-
- @Override
- protected int doCompareTo(CDOID o) throws ClassCastException
- {
- return new Integer(getIntValue()).compareTo(((CDOIDTempObjectImpl)o).getIntValue());
- }
-}
+/*
+ * Copyright (c) 2004 - 2012 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.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;
+
+/**
+ * @author Eike Stepper
+ */
+public class CDOIDTempObjectImpl extends AbstractCDOIDInteger implements CDOIDTemp
+{
+ private static final long serialVersionUID = 1L;
+
+ public CDOIDTempObjectImpl(int value)
+ {
+ super(value);
+ }
+
+ public Type getType()
+ {
+ return Type.TEMP_OBJECT;
+ }
+
+ public boolean isDangling()
+ {
+ return false;
+ }
+
+ public boolean isExternal()
+ {
+ return false;
+ }
+
+ public boolean isNull()
+ {
+ return false;
+ }
+
+ public boolean isObject()
+ {
+ return true;
+ }
+
+ public boolean isTemporary()
+ {
+ return true;
+ }
+
+ @Override
+ public String toString()
+ {
+ return "oid" + getIntValue(); //$NON-NLS-1$
+ }
+
+ @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/lock/CDOLockAreaImpl.java b/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/internal/common/lock/CDOLockAreaImpl.java
index 79fb5e4154..923dd38f8f 100644
--- a/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/internal/common/lock/CDOLockAreaImpl.java
+++ b/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/internal/common/lock/CDOLockAreaImpl.java
@@ -1,106 +1,106 @@
-/*
- * Copyright (c) 2004 - 2011 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
- * Caspar De Groot - maintenance
- */
-package org.eclipse.emf.cdo.internal.common.lock;
-
-import org.eclipse.emf.cdo.common.branch.CDOBranch;
-import org.eclipse.emf.cdo.common.branch.CDOBranchPoint;
-import org.eclipse.emf.cdo.common.id.CDOID;
-import org.eclipse.emf.cdo.common.lock.IDurableLockingManager.LockArea;
-import org.eclipse.emf.cdo.common.lock.IDurableLockingManager.LockGrade;
-
-import java.text.MessageFormat;
-import java.util.Map;
-
-/**
- * @author Eike Stepper
- * @since 4.1
- * @noextend This interface is not intended to be extended by clients.
- */
-public class CDOLockAreaImpl implements LockArea
-{
- public static final int DEFAULT_DURABLE_LOCKING_ID_BYTES = 32;
-
- private final String durableLockingID;
-
- private final String userID;
-
- private final CDOBranchPoint branchPoint;
-
- private final boolean readOnly;
-
- private final Map<CDOID, LockGrade> locks;
-
- private final boolean missing;
-
- public CDOLockAreaImpl(String durableLockingID, String userID, CDOBranchPoint branchPoint, boolean readOnly,
- Map<CDOID, LockGrade> locks)
- {
- this.durableLockingID = durableLockingID;
- this.userID = userID;
- this.branchPoint = branchPoint;
- this.readOnly = readOnly;
- this.locks = locks;
- missing = false;
- }
-
- public CDOLockAreaImpl(String durableLockingID)
- {
- this.durableLockingID = durableLockingID;
- userID = null;
- branchPoint = null;
- readOnly = false;
- locks = null;
- missing = true;
- }
-
- public String getDurableLockingID()
- {
- return durableLockingID;
- }
-
- public String getUserID()
- {
- return userID;
- }
-
- public CDOBranch getBranch()
- {
- return branchPoint.getBranch();
- }
-
- public long getTimeStamp()
- {
- return branchPoint.getTimeStamp();
- }
-
- public boolean isReadOnly()
- {
- return readOnly;
- }
-
- public Map<CDOID, LockGrade> getLocks()
- {
- return locks;
- }
-
- @Override
- public String toString()
- {
- return MessageFormat.format("DurableLockArea\nid={0}\nuser={1}\nbranchPoint={2}\nreadOnly={3}\nlocks={4}",
- durableLockingID, userID, branchPoint, readOnly, locks);
- }
-
- public boolean isMissing()
- {
- return missing;
- }
-}
+/*
+ * Copyright (c) 2004 - 2012 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
+ * Caspar De Groot - maintenance
+ */
+package org.eclipse.emf.cdo.internal.common.lock;
+
+import org.eclipse.emf.cdo.common.branch.CDOBranch;
+import org.eclipse.emf.cdo.common.branch.CDOBranchPoint;
+import org.eclipse.emf.cdo.common.id.CDOID;
+import org.eclipse.emf.cdo.common.lock.IDurableLockingManager.LockArea;
+import org.eclipse.emf.cdo.common.lock.IDurableLockingManager.LockGrade;
+
+import java.text.MessageFormat;
+import java.util.Map;
+
+/**
+ * @author Eike Stepper
+ * @since 4.1
+ * @noextend This interface is not intended to be extended by clients.
+ */
+public class CDOLockAreaImpl implements LockArea
+{
+ public static final int DEFAULT_DURABLE_LOCKING_ID_BYTES = 32;
+
+ private final String durableLockingID;
+
+ private final String userID;
+
+ private final CDOBranchPoint branchPoint;
+
+ private final boolean readOnly;
+
+ private final Map<CDOID, LockGrade> locks;
+
+ private final boolean missing;
+
+ public CDOLockAreaImpl(String durableLockingID, String userID, CDOBranchPoint branchPoint, boolean readOnly,
+ Map<CDOID, LockGrade> locks)
+ {
+ this.durableLockingID = durableLockingID;
+ this.userID = userID;
+ this.branchPoint = branchPoint;
+ this.readOnly = readOnly;
+ this.locks = locks;
+ missing = false;
+ }
+
+ public CDOLockAreaImpl(String durableLockingID)
+ {
+ this.durableLockingID = durableLockingID;
+ userID = null;
+ branchPoint = null;
+ readOnly = false;
+ locks = null;
+ missing = true;
+ }
+
+ public String getDurableLockingID()
+ {
+ return durableLockingID;
+ }
+
+ public String getUserID()
+ {
+ return userID;
+ }
+
+ public CDOBranch getBranch()
+ {
+ return branchPoint.getBranch();
+ }
+
+ public long getTimeStamp()
+ {
+ return branchPoint.getTimeStamp();
+ }
+
+ public boolean isReadOnly()
+ {
+ return readOnly;
+ }
+
+ public Map<CDOID, LockGrade> getLocks()
+ {
+ return locks;
+ }
+
+ @Override
+ public String toString()
+ {
+ return MessageFormat.format("DurableLockArea\nid={0}\nuser={1}\nbranchPoint={2}\nreadOnly={3}\nlocks={4}",
+ durableLockingID, userID, branchPoint, readOnly, locks);
+ }
+
+ public boolean isMissing()
+ {
+ return missing;
+ }
+}
diff --git a/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/internal/common/lock/CDOLockChangeInfoImpl.java b/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/internal/common/lock/CDOLockChangeInfoImpl.java
index 47379ccd6f..49747d85f1 100644
--- a/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/internal/common/lock/CDOLockChangeInfoImpl.java
+++ b/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/internal/common/lock/CDOLockChangeInfoImpl.java
@@ -1,93 +1,93 @@
-/*
- * Copyright (c) 2004 - 2011 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:
- * Caspar De Groot - initial API and implementation
- */
-package org.eclipse.emf.cdo.internal.common.lock;
-
-import org.eclipse.emf.cdo.common.branch.CDOBranch;
-import org.eclipse.emf.cdo.common.branch.CDOBranchPoint;
-import org.eclipse.emf.cdo.common.lock.CDOLockChangeInfo;
-import org.eclipse.emf.cdo.common.lock.CDOLockOwner;
-import org.eclipse.emf.cdo.common.lock.CDOLockState;
-
-import org.eclipse.net4j.util.concurrent.IRWLockManager.LockType;
-
-/**
- * @author Caspar De Groot
- */
-public class CDOLockChangeInfoImpl implements CDOLockChangeInfo
-{
- private final CDOBranchPoint branchPoint;
-
- private final CDOLockOwner lockOwner;
-
- private final CDOLockState[] lockStates;
-
- private final Operation operation;
-
- private final LockType lockType;
-
- private final boolean isInvalidateAll;
-
- public CDOLockChangeInfoImpl(CDOBranchPoint branchPoint, CDOLockOwner lockOwner, CDOLockState[] lockStates,
- Operation operation, LockType lockType)
- {
- this.branchPoint = branchPoint;
- this.lockOwner = lockOwner;
- this.lockStates = lockStates;
- this.operation = operation;
- this.lockType = lockType;
- isInvalidateAll = false;
- }
-
- public CDOLockChangeInfoImpl()
- {
- branchPoint = null;
- lockOwner = null;
- lockStates = null;
- operation = null;
- lockType = null;
- isInvalidateAll = true;
- }
-
- public CDOBranch getBranch()
- {
- return branchPoint == null ? null : branchPoint.getBranch();
- }
-
- public long getTimeStamp()
- {
- return branchPoint == null ? CDOBranchPoint.UNSPECIFIED_DATE : branchPoint.getTimeStamp();
- }
-
- public CDOLockOwner getLockOwner()
- {
- return lockOwner;
- }
-
- public CDOLockState[] getLockStates()
- {
- return lockStates;
- }
-
- public Operation getOperation()
- {
- return operation;
- }
-
- public LockType getLockType()
- {
- return lockType;
- }
-
- public boolean isInvalidateAll()
- {
- return isInvalidateAll;
- }
-}
+/*
+ * Copyright (c) 2004 - 2012 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:
+ * Caspar De Groot - initial API and implementation
+ */
+package org.eclipse.emf.cdo.internal.common.lock;
+
+import org.eclipse.emf.cdo.common.branch.CDOBranch;
+import org.eclipse.emf.cdo.common.branch.CDOBranchPoint;
+import org.eclipse.emf.cdo.common.lock.CDOLockChangeInfo;
+import org.eclipse.emf.cdo.common.lock.CDOLockOwner;
+import org.eclipse.emf.cdo.common.lock.CDOLockState;
+
+import org.eclipse.net4j.util.concurrent.IRWLockManager.LockType;
+
+/**
+ * @author Caspar De Groot
+ */
+public class CDOLockChangeInfoImpl implements CDOLockChangeInfo
+{
+ private final CDOBranchPoint branchPoint;
+
+ private final CDOLockOwner lockOwner;
+
+ private final CDOLockState[] lockStates;
+
+ private final Operation operation;
+
+ private final LockType lockType;
+
+ private final boolean isInvalidateAll;
+
+ public CDOLockChangeInfoImpl(CDOBranchPoint branchPoint, CDOLockOwner lockOwner, CDOLockState[] lockStates,
+ Operation operation, LockType lockType)
+ {
+ this.branchPoint = branchPoint;
+ this.lockOwner = lockOwner;
+ this.lockStates = lockStates;
+ this.operation = operation;
+ this.lockType = lockType;
+ isInvalidateAll = false;
+ }
+
+ public CDOLockChangeInfoImpl()
+ {
+ branchPoint = null;
+ lockOwner = null;
+ lockStates = null;
+ operation = null;
+ lockType = null;
+ isInvalidateAll = true;
+ }
+
+ public CDOBranch getBranch()
+ {
+ return branchPoint == null ? null : branchPoint.getBranch();
+ }
+
+ public long getTimeStamp()
+ {
+ return branchPoint == null ? CDOBranchPoint.UNSPECIFIED_DATE : branchPoint.getTimeStamp();
+ }
+
+ public CDOLockOwner getLockOwner()
+ {
+ return lockOwner;
+ }
+
+ public CDOLockState[] getLockStates()
+ {
+ return lockStates;
+ }
+
+ public Operation getOperation()
+ {
+ return operation;
+ }
+
+ public LockType getLockType()
+ {
+ return lockType;
+ }
+
+ public boolean isInvalidateAll()
+ {
+ return isInvalidateAll;
+ }
+}
diff --git a/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/internal/common/lock/CDOLockOwnerImpl.java b/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/internal/common/lock/CDOLockOwnerImpl.java
index e110e63839..7d4c1c7925 100644
--- a/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/internal/common/lock/CDOLockOwnerImpl.java
+++ b/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/internal/common/lock/CDOLockOwnerImpl.java
@@ -1,91 +1,91 @@
-/*
- * Copyright (c) 2004 - 2011 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:
- * Caspar De Groot - initial API and implementation
- */
-package org.eclipse.emf.cdo.internal.common.lock;
-
-import org.eclipse.emf.cdo.common.lock.CDOLockOwner;
-
-import org.eclipse.net4j.util.ObjectUtil;
-
-/**
- * @author Caspar De Groot
- */
-public class CDOLockOwnerImpl implements CDOLockOwner
-{
- private final int sessionID;
-
- private final int viewID;
-
- private final String durableLockingID;
-
- private final boolean isDurableView;
-
- public CDOLockOwnerImpl(int sessionID, int viewID, String durableLockingID, boolean isDurableView)
- {
- this.sessionID = sessionID;
- this.viewID = viewID;
- this.durableLockingID = durableLockingID;
- this.isDurableView = isDurableView;
- }
-
- public int getSessionID()
- {
- return sessionID;
- }
-
- public int getViewID()
- {
- return viewID;
- }
-
- public String getDurableLockingID()
- {
- return durableLockingID;
- }
-
- public boolean isDurableView()
- {
- return isDurableView;
- }
-
- @Override
- public int hashCode()
- {
- return ObjectUtil.hashCode(sessionID, viewID);
- }
-
- @Override
- public boolean equals(Object obj)
- {
- if (obj == this)
- {
- return true;
- }
-
- if (obj instanceof CDOLockOwner)
- {
- CDOLockOwner that = (CDOLockOwner)obj;
- return sessionID == that.getSessionID() && viewID == that.getViewID();
- }
-
- return false;
- }
-
- @Override
- public String toString()
- {
- StringBuilder builder = new StringBuilder("CDOLockOwner[");
- builder.append(sessionID);
- builder.append(':');
- builder.append(viewID);
- builder.append(']');
- return builder.toString();
- }
-}
+/*
+ * Copyright (c) 2004 - 2012 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:
+ * Caspar De Groot - initial API and implementation
+ */
+package org.eclipse.emf.cdo.internal.common.lock;
+
+import org.eclipse.emf.cdo.common.lock.CDOLockOwner;
+
+import org.eclipse.net4j.util.ObjectUtil;
+
+/**
+ * @author Caspar De Groot
+ */
+public class CDOLockOwnerImpl implements CDOLockOwner
+{
+ private final int sessionID;
+
+ private final int viewID;
+
+ private final String durableLockingID;
+
+ private final boolean isDurableView;
+
+ public CDOLockOwnerImpl(int sessionID, int viewID, String durableLockingID, boolean isDurableView)
+ {
+ this.sessionID = sessionID;
+ this.viewID = viewID;
+ this.durableLockingID = durableLockingID;
+ this.isDurableView = isDurableView;
+ }
+
+ public int getSessionID()
+ {
+ return sessionID;
+ }
+
+ public int getViewID()
+ {
+ return viewID;
+ }
+
+ public String getDurableLockingID()
+ {
+ return durableLockingID;
+ }
+
+ public boolean isDurableView()
+ {
+ return isDurableView;
+ }
+
+ @Override
+ public int hashCode()
+ {
+ return ObjectUtil.hashCode(sessionID, viewID);
+ }
+
+ @Override
+ public boolean equals(Object obj)
+ {
+ if (obj == this)
+ {
+ return true;
+ }
+
+ if (obj instanceof CDOLockOwner)
+ {
+ CDOLockOwner that = (CDOLockOwner)obj;
+ return sessionID == that.getSessionID() && viewID == that.getViewID();
+ }
+
+ return false;
+ }
+
+ @Override
+ public String toString()
+ {
+ StringBuilder builder = new StringBuilder("CDOLockOwner[");
+ builder.append(sessionID);
+ builder.append(':');
+ builder.append(viewID);
+ builder.append(']');
+ return builder.toString();
+ }
+}
diff --git a/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/internal/common/lock/CDOLockStateImpl.java b/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/internal/common/lock/CDOLockStateImpl.java
index 5f85e905a3..f5f88aff7d 100644
--- a/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/internal/common/lock/CDOLockStateImpl.java
+++ b/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/internal/common/lock/CDOLockStateImpl.java
@@ -1,191 +1,191 @@
-/*
- * Copyright (c) 2004 - 2011 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:
- * Caspar De Groot - initial API and implementation
- */
-package org.eclipse.emf.cdo.internal.common.lock;
-
-import org.eclipse.emf.cdo.common.id.CDOID;
-import org.eclipse.emf.cdo.common.lock.CDOLockOwner;
-import org.eclipse.emf.cdo.common.revision.CDOIDAndBranch;
-import org.eclipse.emf.cdo.spi.common.lock.InternalCDOLockState;
-
-import org.eclipse.net4j.util.CheckUtil;
-import org.eclipse.net4j.util.concurrent.IRWLockManager.LockType;
-
-import java.util.Collections;
-import java.util.HashSet;
-import java.util.Set;
-
-/**
- * @author Caspar De Groot
- */
-public class CDOLockStateImpl implements InternalCDOLockState
-{
- private final Object lockedObject;
-
- private final Set<CDOLockOwner> readLockOwners = new HashSet<CDOLockOwner>();
-
- private CDOLockOwner writeLockOwner;
-
- private CDOLockOwner writeOptionOwner;
-
- public CDOLockStateImpl(Object lockedObject)
- {
- CheckUtil.checkArg(lockedObject, "lockedObject");
- CheckUtil.checkState(lockedObject instanceof CDOID || lockedObject instanceof CDOIDAndBranch,
- "lockedObject is of wrong type");
- this.lockedObject = lockedObject;
- }
-
- public CDOLockStateImpl copy()
- {
- CDOLockStateImpl newLockState = new CDOLockStateImpl(lockedObject);
- for (CDOLockOwner owner : readLockOwners)
- {
- newLockState.readLockOwners.add(owner);
- }
-
- newLockState.writeLockOwner = writeLockOwner;
- newLockState.writeOptionOwner = writeOptionOwner;
- return newLockState;
- }
-
- public boolean isLocked(LockType lockType, CDOLockOwner lockOwner, boolean others)
- {
- switch (lockType)
- {
- case READ:
- return isReadLocked(lockOwner, others);
-
- case WRITE:
- return isWriteLocked(lockOwner, others);
-
- case OPTION:
- return isOptionLocked(lockOwner, others);
- }
-
- return false;
- }
-
- private boolean isReadLocked(CDOLockOwner by, boolean others)
- {
- int n = readLockOwners.size();
- if (n == 0)
- {
- return false;
- }
-
- if (!others)
- {
- return readLockOwners.contains(by);
- }
-
- return true;
- }
-
- private boolean isWriteLocked(CDOLockOwner by, boolean others)
- {
- if (writeLockOwner == null)
- {
- return false;
- }
-
- return writeLockOwner.equals(by) ^ others;
- }
-
- private boolean isOptionLocked(CDOLockOwner by, boolean others)
- {
- if (writeOptionOwner == null)
- {
- return false;
- }
-
- return writeOptionOwner.equals(by) ^ others;
- }
-
- public Set<CDOLockOwner> getReadLockOwners()
- {
- return Collections.unmodifiableSet(readLockOwners);
- }
-
- public void addReadLockOwner(CDOLockOwner lockOwner)
- {
- readLockOwners.add(lockOwner);
- }
-
- public boolean removeReadLockOwner(CDOLockOwner lockOwner)
- {
- return readLockOwners.remove(lockOwner);
- }
-
- public CDOLockOwner getWriteLockOwner()
- {
- return writeLockOwner;
- }
-
- public void setWriteLockOwner(CDOLockOwner lockOwner)
- {
- writeLockOwner = lockOwner;
- }
-
- public CDOLockOwner getWriteOptionOwner()
- {
- return writeOptionOwner;
- }
-
- public void setWriteOptionOwner(CDOLockOwner lockOwner)
- {
- writeOptionOwner = lockOwner;
- }
-
- public Object getLockedObject()
- {
- return lockedObject;
- }
-
- @Override
- public String toString()
- {
- StringBuilder builder = new StringBuilder("CDOLockState\nlockedObject=");
- builder.append(lockedObject);
-
- builder.append("\nreadLockOwners=");
- if (readLockOwners.size() > 0)
- {
- boolean first = true;
- for (CDOLockOwner lockOwner : readLockOwners)
- {
- if (first)
- {
- first = false;
- }
- else
- {
- builder.append(", ");
- }
-
- builder.append(lockOwner);
- }
-
- builder.deleteCharAt(builder.length() - 1);
- }
- else
- {
- builder.append("NONE");
- }
-
- builder.append("\nwriteLockOwner=");
- builder.append(writeLockOwner != null ? writeLockOwner : "NONE");
-
- builder.append("\nwriteOptionOwner=");
- builder.append(writeOptionOwner != null ? writeOptionOwner : "NONE");
-
- return builder.toString();
- }
-}
+/*
+ * Copyright (c) 2004 - 2012 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:
+ * Caspar De Groot - initial API and implementation
+ */
+package org.eclipse.emf.cdo.internal.common.lock;
+
+import org.eclipse.emf.cdo.common.id.CDOID;
+import org.eclipse.emf.cdo.common.lock.CDOLockOwner;
+import org.eclipse.emf.cdo.common.revision.CDOIDAndBranch;
+import org.eclipse.emf.cdo.spi.common.lock.InternalCDOLockState;
+
+import org.eclipse.net4j.util.CheckUtil;
+import org.eclipse.net4j.util.concurrent.IRWLockManager.LockType;
+
+import java.util.Collections;
+import java.util.HashSet;
+import java.util.Set;
+
+/**
+ * @author Caspar De Groot
+ */
+public class CDOLockStateImpl implements InternalCDOLockState
+{
+ private final Object lockedObject;
+
+ private final Set<CDOLockOwner> readLockOwners = new HashSet<CDOLockOwner>();
+
+ private CDOLockOwner writeLockOwner;
+
+ private CDOLockOwner writeOptionOwner;
+
+ public CDOLockStateImpl(Object lockedObject)
+ {
+ CheckUtil.checkArg(lockedObject, "lockedObject");
+ CheckUtil.checkState(lockedObject instanceof CDOID || lockedObject instanceof CDOIDAndBranch,
+ "lockedObject is of wrong type");
+ this.lockedObject = lockedObject;
+ }
+
+ public CDOLockStateImpl copy()
+ {
+ CDOLockStateImpl newLockState = new CDOLockStateImpl(lockedObject);
+ for (CDOLockOwner owner : readLockOwners)
+ {
+ newLockState.readLockOwners.add(owner);
+ }
+
+ newLockState.writeLockOwner = writeLockOwner;
+ newLockState.writeOptionOwner = writeOptionOwner;
+ return newLockState;
+ }
+
+ public boolean isLocked(LockType lockType, CDOLockOwner lockOwner, boolean others)
+ {
+ switch (lockType)
+ {
+ case READ:
+ return isReadLocked(lockOwner, others);
+
+ case WRITE:
+ return isWriteLocked(lockOwner, others);
+
+ case OPTION:
+ return isOptionLocked(lockOwner, others);
+ }
+
+ return false;
+ }
+
+ private boolean isReadLocked(CDOLockOwner by, boolean others)
+ {
+ int n = readLockOwners.size();
+ if (n == 0)
+ {
+ return false;
+ }
+
+ if (!others)
+ {
+ return readLockOwners.contains(by);
+ }
+
+ return true;
+ }
+
+ private boolean isWriteLocked(CDOLockOwner by, boolean others)
+ {
+ if (writeLockOwner == null)
+ {
+ return false;
+ }
+
+ return writeLockOwner.equals(by) ^ others;
+ }
+
+ private boolean isOptionLocked(CDOLockOwner by, boolean others)
+ {
+ if (writeOptionOwner == null)
+ {
+ return false;
+ }
+
+ return writeOptionOwner.equals(by) ^ others;
+ }
+
+ public Set<CDOLockOwner> getReadLockOwners()
+ {
+ return Collections.unmodifiableSet(readLockOwners);
+ }
+
+ public void addReadLockOwner(CDOLockOwner lockOwner)
+ {
+ readLockOwners.add(lockOwner);
+ }
+
+ public boolean removeReadLockOwner(CDOLockOwner lockOwner)
+ {
+ return readLockOwners.remove(lockOwner);
+ }
+
+ public CDOLockOwner getWriteLockOwner()
+ {
+ return writeLockOwner;
+ }
+
+ public void setWriteLockOwner(CDOLockOwner lockOwner)
+ {
+ writeLockOwner = lockOwner;
+ }
+
+ public CDOLockOwner getWriteOptionOwner()
+ {
+ return writeOptionOwner;
+ }
+
+ public void setWriteOptionOwner(CDOLockOwner lockOwner)
+ {
+ writeOptionOwner = lockOwner;
+ }
+
+ public Object getLockedObject()
+ {
+ return lockedObject;
+ }
+
+ @Override
+ public String toString()
+ {
+ StringBuilder builder = new StringBuilder("CDOLockState\nlockedObject=");
+ builder.append(lockedObject);
+
+ builder.append("\nreadLockOwners=");
+ if (readLockOwners.size() > 0)
+ {
+ boolean first = true;
+ for (CDOLockOwner lockOwner : readLockOwners)
+ {
+ if (first)
+ {
+ first = false;
+ }
+ else
+ {
+ builder.append(", ");
+ }
+
+ builder.append(lockOwner);
+ }
+
+ builder.deleteCharAt(builder.length() - 1);
+ }
+ else
+ {
+ builder.append("NONE");
+ }
+
+ builder.append("\nwriteLockOwner=");
+ builder.append(writeLockOwner != null ? writeLockOwner : "NONE");
+
+ builder.append("\nwriteOptionOwner=");
+ builder.append(writeOptionOwner != null ? writeOptionOwner : "NONE");
+
+ return builder.toString();
+ }
+}
diff --git a/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/internal/common/messages/Messages.java b/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/internal/common/messages/Messages.java
index 25c110b98c..6e854db79c 100644
--- a/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/internal/common/messages/Messages.java
+++ b/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/internal/common/messages/Messages.java
@@ -1,41 +1,41 @@
-/*
- * Copyright (c) 2004 - 2011 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:
- * Victor Roldan Betancort - initial API and implementation
- * Eike Stepper - maintenance
- */
-package org.eclipse.emf.cdo.internal.common.messages;
-
-import java.util.MissingResourceException;
-import java.util.ResourceBundle;
-
-/**
- * @author Victor Roldan Betancort
- */
-public class Messages
-{
- private static final String BUNDLE_NAME = "org.eclipse.emf.cdo.internal.common.messages.messages"; //$NON-NLS-1$
-
- private static final ResourceBundle RESOURCE_BUNDLE = ResourceBundle.getBundle(BUNDLE_NAME);
-
- private Messages()
- {
- }
-
- public static String getString(String key)
- {
- try
- {
- return RESOURCE_BUNDLE.getString(key);
- }
- catch (MissingResourceException e)
- {
- return '!' + key + '!';
- }
- }
-}
+/*
+ * Copyright (c) 2004 - 2012 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:
+ * Victor Roldan Betancort - initial API and implementation
+ * Eike Stepper - maintenance
+ */
+package org.eclipse.emf.cdo.internal.common.messages;
+
+import java.util.MissingResourceException;
+import java.util.ResourceBundle;
+
+/**
+ * @author Victor Roldan Betancort
+ */
+public class Messages
+{
+ private static final String BUNDLE_NAME = "org.eclipse.emf.cdo.internal.common.messages.messages"; //$NON-NLS-1$
+
+ private static final ResourceBundle RESOURCE_BUNDLE = ResourceBundle.getBundle(BUNDLE_NAME);
+
+ private Messages()
+ {
+ }
+
+ public static String getString(String key)
+ {
+ try
+ {
+ return RESOURCE_BUNDLE.getString(key);
+ }
+ catch (MissingResourceException e)
+ {
+ return '!' + key + '!';
+ }
+ }
+}
diff --git a/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/internal/common/messages/messages.properties b/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/internal/common/messages/messages.properties
index b6a593995b..cf74bb5f59 100644
--- a/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/internal/common/messages/messages.properties
+++ b/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/internal/common/messages/messages.properties
@@ -1,39 +1,39 @@
-# Copyright (c) 2004 - 2011 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:
-# Victor Roldan Betancort - initial API and implementation
-# Eike Stepper - maintenance
-
-AbstractCDORevision.0=EClass is abstract: {0}
-AbstractCDORevision.1=CDOID is null
-AbstractCDORevision.2=Missing ID mapping for {0}
-AbstractCDORevision.20=Could not find feature {0} in class {1}
-CDOClassifierRef.0=Package not found: {0}
-CDOClassifierRef.1=Invalid classifier URI:
-CDODataInputImpl.5=Invalid CDOFeatureDelta type
-CDODataOutputImpl.5=Temporary ID not supported: {0}
-CDODataOutputImpl.6=No type for object of class {0}
-CDOIDLibraryProviderImpl.0=Unknown library: {0}
-CDOIDLibraryProviderImpl.2=Not a JAR: {0}
-CDOIDUtil.0=Unknown CDOIDObject implementation: {0}
-CDOIDUtil.1=ID is temporary
-CDOIDUtil.2=Can not get id value from external ID types
-CDOIDUtil.3=Invalid CDOID type: {0}
-CDOIDUtil.5=Invalid ID type: {0}
-CDOModelUtil.6=No type for id {0}
-CDOModelUtil.7=Not a primitive type nor String nor Date: {0}
-CDOPackageRegistryImpl.0=No package unit available for: {0}
-CDOPackageUnit.0=Package unit type is unknown
-CDOPackageUnitImpl.0=UNINITIALIZED
-CDOPackageUnitImpl.1=Package unit not initialized
-CDORevisionUtil.0=UNINITIALIZED
-CDOTypeImpl.23=Cannot find the enum literal {0}
-DLRevisionList.0=Cannot assign to a different list while linked to a list
-DLRevisionList.3=Holder {0} is still linked in different list
-DLRevisionList.5=Holder {0} does not belong to this list
-LRURevisionHolder.0=Not a {0}: {1}
-MEMRevisionCache.1=Invalid referenceType: {0}
+# Copyright (c) 2004 - 2012 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:
+# Victor Roldan Betancort - initial API and implementation
+# Eike Stepper - maintenance
+
+AbstractCDORevision.0=EClass is abstract: {0}
+AbstractCDORevision.1=CDOID is null
+AbstractCDORevision.2=Missing ID mapping for {0}
+AbstractCDORevision.20=Could not find feature {0} in class {1}
+CDOClassifierRef.0=Package not found: {0}
+CDOClassifierRef.1=Invalid classifier URI:
+CDODataInputImpl.5=Invalid CDOFeatureDelta type
+CDODataOutputImpl.5=Temporary ID not supported: {0}
+CDODataOutputImpl.6=No type for object of class {0}
+CDOIDLibraryProviderImpl.0=Unknown library: {0}
+CDOIDLibraryProviderImpl.2=Not a JAR: {0}
+CDOIDUtil.0=Unknown CDOIDObject implementation: {0}
+CDOIDUtil.1=ID is temporary
+CDOIDUtil.2=Can not get id value from external ID types
+CDOIDUtil.3=Invalid CDOID type: {0}
+CDOIDUtil.5=Invalid ID type: {0}
+CDOModelUtil.6=No type for id {0}
+CDOModelUtil.7=Not a primitive type nor String nor Date: {0}
+CDOPackageRegistryImpl.0=No package unit available for: {0}
+CDOPackageUnit.0=Package unit type is unknown
+CDOPackageUnitImpl.0=UNINITIALIZED
+CDOPackageUnitImpl.1=Package unit not initialized
+CDORevisionUtil.0=UNINITIALIZED
+CDOTypeImpl.23=Cannot find the enum literal {0}
+DLRevisionList.0=Cannot assign to a different list while linked to a list
+DLRevisionList.3=Holder {0} is still linked in different list
+DLRevisionList.5=Holder {0} does not belong to this list
+LRURevisionHolder.0=Not a {0}: {1}
+MEMRevisionCache.1=Invalid referenceType: {0}
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
index 1c8b7e8ed8..49ed16a907 100644
--- 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
@@ -1,126 +1,126 @@
-/*
- * Copyright (c) 2004 - 2011 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.cdo.common.model.EMFUtil;
-
-import org.eclipse.emf.common.notify.Notifier;
-import org.eclipse.emf.common.notify.impl.AdapterImpl;
-import org.eclipse.emf.common.util.EList;
-import org.eclipse.emf.ecore.EClass;
-import org.eclipse.emf.ecore.EStructuralFeature;
-
-import java.util.ArrayList;
-import java.util.Arrays;
-import java.util.List;
-
-/**
- * @author Eike Stepper
- */
-public class CDOClassInfoImpl extends AdapterImpl implements CDOClassInfo
-{
- private static final int NOT_MAPPED = -1;
-
- 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)
- {
- int index = featureIDMappings[featureID];
- if (index == NOT_MAPPED)
- {
- throw new IllegalArgumentException("Feature not mapped: " + getEClass().getEStructuralFeature(featureID)); //$NON-NLS-1$
- }
-
- return index;
- }
-
- private void init(EClass eClass)
- {
- List<EStructuralFeature> persistentFeatures = new ArrayList<EStructuralFeature>();
- EList<EStructuralFeature> allFeatures = eClass.getEAllStructuralFeatures();
- for (EStructuralFeature feature : allFeatures)
- {
- if (EMFUtil.isPersistent(feature))
- {
- persistentFeatures.add(feature);
- }
- }
-
- allPersistentFeatures = persistentFeatures.toArray(new EStructuralFeature[persistentFeatures.size()]);
- featureIDMappings = new int[allFeatures.size()];
- Arrays.fill(featureIDMappings, NOT_MAPPED);
-
- for (int i = 0; i < allPersistentFeatures.length; i++)
- {
- EStructuralFeature feature = allPersistentFeatures[i];
- int featureID = eClass.getFeatureID(feature);
- featureIDMappings[featureID] = i;
- }
- }
-
- @Override
- public String toString()
- {
- return getEClass().toString();
- }
-}
+/*
+ * Copyright (c) 2004 - 2012 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.cdo.common.model.EMFUtil;
+
+import org.eclipse.emf.common.notify.Notifier;
+import org.eclipse.emf.common.notify.impl.AdapterImpl;
+import org.eclipse.emf.common.util.EList;
+import org.eclipse.emf.ecore.EClass;
+import org.eclipse.emf.ecore.EStructuralFeature;
+
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.List;
+
+/**
+ * @author Eike Stepper
+ */
+public class CDOClassInfoImpl extends AdapterImpl implements CDOClassInfo
+{
+ private static final int NOT_MAPPED = -1;
+
+ 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)
+ {
+ int index = featureIDMappings[featureID];
+ if (index == NOT_MAPPED)
+ {
+ throw new IllegalArgumentException("Feature not mapped: " + getEClass().getEStructuralFeature(featureID)); //$NON-NLS-1$
+ }
+
+ return index;
+ }
+
+ private void init(EClass eClass)
+ {
+ List<EStructuralFeature> persistentFeatures = new ArrayList<EStructuralFeature>();
+ EList<EStructuralFeature> allFeatures = eClass.getEAllStructuralFeatures();
+ for (EStructuralFeature feature : allFeatures)
+ {
+ if (EMFUtil.isPersistent(feature))
+ {
+ persistentFeatures.add(feature);
+ }
+ }
+
+ allPersistentFeatures = persistentFeatures.toArray(new EStructuralFeature[persistentFeatures.size()]);
+ featureIDMappings = new int[allFeatures.size()];
+ Arrays.fill(featureIDMappings, NOT_MAPPED);
+
+ for (int i = 0; i < allPersistentFeatures.length; i++)
+ {
+ EStructuralFeature feature = allPersistentFeatures[i];
+ int featureID = eClass.getFeatureID(feature);
+ featureIDMappings[featureID] = i;
+ }
+ }
+
+ @Override
+ public String toString()
+ {
+ return getEClass().toString();
+ }
+}
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
index b3fa82be4c..2b182cc038 100644
--- 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
@@ -1,160 +1,160 @@
-/*
- * Copyright (c) 2004 - 2011 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.CDOModelUtil;
-import org.eclipse.emf.cdo.common.model.CDOPackageInfo;
-import org.eclipse.emf.cdo.common.protocol.CDODataInput;
-import org.eclipse.emf.cdo.common.protocol.CDODataOutput;
-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;
-
- 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 void write(CDODataOutput out) throws IOException
- {
- if (TRACER.isEnabled())
- {
- TRACER.format("Writing {0}", this); //$NON-NLS-1$
- }
-
- out.writeCDOPackageURI(packageURI);
- out.writeCDOPackageURI(parentURI);
- }
-
- public void read(CDODataInput in) throws IOException
- {
- packageURI = in.readCDOPackageURI();
- parentURI = in.readCDOPackageURI();
- if (TRACER.isEnabled())
- {
- TRACER.format("Read {0}", this); //$NON-NLS-1$
- }
- }
-
- public EFactory getEFactory()
- {
- return getEPackage().getEFactoryInstance();
- }
-
- public EPackage getEPackage()
- {
- return getEPackage(true);
- }
-
- public EPackage getEPackage(boolean loadOnDemand)
- {
- return doGetEPackage(loadOnDemand);
- }
-
- public EPackage doGetEPackage(boolean loadOnDemand)
- {
- EPackage ePackage = (EPackage)getTarget();
- if (ePackage != null)
- {
- return ePackage;
- }
-
- if (loadOnDemand)
- {
- packageUnit.load(true); // TODO (CD) Dubious: is resolution-on-load really a good idea?
- return (EPackage)getTarget();
- }
-
- return null;
- }
-
- public boolean isCorePackage()
- {
- return CDOModelUtil.isCorePackage(getEPackage());
- }
-
- public boolean isResourcePackage()
- {
- return CDOModelUtil.isResourcePackage(getEPackage());
- }
-
- public boolean isTypePackage()
- {
- return CDOModelUtil.isTypesPackage(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}]", packageURI, parentURI); //$NON-NLS-1$
- }
-}
+/*
+ * Copyright (c) 2004 - 2012 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.CDOModelUtil;
+import org.eclipse.emf.cdo.common.model.CDOPackageInfo;
+import org.eclipse.emf.cdo.common.protocol.CDODataInput;
+import org.eclipse.emf.cdo.common.protocol.CDODataOutput;
+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;
+
+ 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 void write(CDODataOutput out) throws IOException
+ {
+ if (TRACER.isEnabled())
+ {
+ TRACER.format("Writing {0}", this); //$NON-NLS-1$
+ }
+
+ out.writeCDOPackageURI(packageURI);
+ out.writeCDOPackageURI(parentURI);
+ }
+
+ public void read(CDODataInput in) throws IOException
+ {
+ packageURI = in.readCDOPackageURI();
+ parentURI = in.readCDOPackageURI();
+ if (TRACER.isEnabled())
+ {
+ TRACER.format("Read {0}", this); //$NON-NLS-1$
+ }
+ }
+
+ public EFactory getEFactory()
+ {
+ return getEPackage().getEFactoryInstance();
+ }
+
+ public EPackage getEPackage()
+ {
+ return getEPackage(true);
+ }
+
+ public EPackage getEPackage(boolean loadOnDemand)
+ {
+ return doGetEPackage(loadOnDemand);
+ }
+
+ public EPackage doGetEPackage(boolean loadOnDemand)
+ {
+ EPackage ePackage = (EPackage)getTarget();
+ if (ePackage != null)
+ {
+ return ePackage;
+ }
+
+ if (loadOnDemand)
+ {
+ packageUnit.load(true); // TODO (CD) Dubious: is resolution-on-load really a good idea?
+ return (EPackage)getTarget();
+ }
+
+ return null;
+ }
+
+ public boolean isCorePackage()
+ {
+ return CDOModelUtil.isCorePackage(getEPackage());
+ }
+
+ public boolean isResourcePackage()
+ {
+ return CDOModelUtil.isResourcePackage(getEPackage());
+ }
+
+ public boolean isTypePackage()
+ {
+ return CDOModelUtil.isTypesPackage(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}]", packageURI, parentURI); //$NON-NLS-1$
+ }
+}
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
index 4e774d13d5..8c07d0c508 100644
--- 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
@@ -1,663 +1,663 @@
-/*
- * Copyright (c) 2004 - 2011 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 - Bug 332912 - Caching subtype-relationships in the CDOPackageRegistry
- */
-package org.eclipse.emf.cdo.internal.common.model;
-
-import org.eclipse.emf.cdo.common.branch.CDOBranchPoint;
-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.CDOPackageUnit.State;
-import org.eclipse.emf.cdo.common.model.EMFUtil;
-import org.eclipse.emf.cdo.internal.common.bundle.OM;
-import org.eclipse.emf.cdo.internal.common.messages.Messages;
-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.ImplementationError;
-import org.eclipse.net4j.util.ReflectUtil.ExcludeFromDump;
-import org.eclipse.net4j.util.event.EventUtil;
-import org.eclipse.net4j.util.event.IListener;
-import org.eclipse.net4j.util.lifecycle.LifecycleException;
-import org.eclipse.net4j.util.lifecycle.LifecycleState;
-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.common.util.Enumerator;
-import org.eclipse.emf.ecore.EClass;
-import org.eclipse.emf.ecore.EClassifier;
-import org.eclipse.emf.ecore.EEnum;
-import org.eclipse.emf.ecore.EEnumLiteral;
-import org.eclipse.emf.ecore.EPackage;
-import org.eclipse.emf.ecore.impl.EPackageRegistryImpl;
-
-import java.text.MessageFormat;
-import java.util.ArrayList;
-import java.util.Arrays;
-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 boolean replacingDescriptors;
-
- private PackageProcessor packageProcessor;
-
- private PackageLoader packageLoader;
-
- private transient boolean active;
-
- @ExcludeFromDump
- private transient InternalCDOPackageInfo[] packageInfos;
-
- @ExcludeFromDump
- private transient InternalCDOPackageUnit[] packageUnits;
-
- @ExcludeFromDump
- private transient Map<EClass, List<EClass>> subTypes;
-
- private Map<Enumerator, EEnumLiteral> enumLiterals = new HashMap<Enumerator, EEnumLiteral>();
-
- private Set<CDOPackageInfo> visitedPackages = new HashSet<CDOPackageInfo>();
-
- public CDOPackageRegistryImpl()
- {
- }
-
- 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;
- }
-
- static int lockCount;
-
- @Override
- public Object get(Object key)
- {
- LifecycleUtil.checkActive(this);
- return super.get(key);
- }
-
- public synchronized Set<String> getAllKeys()
- {
- LifecycleUtil.checkActive(this);
- Set<String> result = new HashSet<String>();
- result.addAll(keySet());
- if (delegateRegistry != null)
- {
- if (delegateRegistry instanceof InternalCDOPackageRegistry)
- {
- result.addAll(((InternalCDOPackageRegistry)delegateRegistry).getAllKeys());
- }
- else
- {
- result.addAll(delegateRegistry.keySet());
- }
- }
-
- return result;
- }
-
- public synchronized Object getWithDelegation(String nsURI, boolean resolve)
- {
- LifecycleUtil.checkActive(this);
- Object result = getFrom(this, nsURI, resolve);
- if (result == null && delegateRegistry != null)
- {
- result = getFrom(delegateRegistry, nsURI, resolve);
- }
-
- return result;
- }
-
- private static Object getFrom(EPackage.Registry registry, String nsURI, boolean resolve)
- {
- if (resolve)
- {
- return registry.getEPackage(nsURI);
- }
-
- return registry.get(nsURI);
- }
-
- public synchronized Object basicPut(String nsURI, Object value)
- {
- LifecycleUtil.checkActive(this);
- if (TRACER.isEnabled())
- {
- TRACER.format("Registering {0} --> {1}", nsURI, value); //$NON-NLS-1$
- }
-
- 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);
- }
- }
- else if (oldValue instanceof EPackage && value instanceof InternalCDOPackageInfo)
- {
- EPackage oldPackage = (EPackage)oldValue;
- InternalCDOPackageInfo oldPackageInfo = getPackageInfo(oldPackage);
- InternalCDOPackageInfo newPackageInfo = (InternalCDOPackageInfo)value;
-
- InternalCDOPackageUnit oldPackageUnit = oldPackageInfo.getPackageUnit();
- InternalCDOPackageUnit newPackageUnit = newPackageInfo.getPackageUnit();
- if (oldPackageUnit.getState() == CDOPackageUnit.State.NEW
- && newPackageUnit.getState() != CDOPackageUnit.State.NEW)
- {
- oldPackageUnit.setState(CDOPackageUnit.State.LOADED);
- }
-
- // Keep old value!
- return null;
- }
-
- 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)
- {
- LifecycleUtil.checkActive(this);
- 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 void putPackageUnits(InternalCDOPackageUnit[] packageUnits, State state)
- {
- LifecycleUtil.checkActive(this);
- for (InternalCDOPackageUnit packageUnit : packageUnits)
- {
- if (state != null)
- {
- packageUnit.setState(state);
- }
-
- putPackageUnit(packageUnit);
- }
- }
-
- 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 synchronized InternalCDOPackageUnit getPackageUnit(EPackage ePackage)
- {
- LifecycleUtil.checkActive(this);
- CDOPackageInfo packageInfo = getPackageInfo(ePackage);
- if (packageInfo == null)
- {
- putEPackage(ePackage);
- packageInfo = getPackageInfo(ePackage);
- if (packageInfo == null)
- {
- throw new ImplementationError(MessageFormat.format(Messages.getString("CDOPackageRegistryImpl.0"), ePackage)); //$NON-NLS-1$
- }
- }
-
- return (InternalCDOPackageUnit)packageInfo.getPackageUnit();
- }
-
- public synchronized InternalCDOPackageUnit getPackageUnit(String id)
- {
- LifecycleUtil.checkActive(this);
- for (Object value : values())
- {
- InternalCDOPackageUnit packageUnit = null;
- if (value instanceof InternalCDOPackageInfo)
- {
- packageUnit = ((InternalCDOPackageInfo)value).getPackageUnit();
- }
- else if (value instanceof EPackage)
- {
- InternalCDOPackageInfo packageInfo = getPackageInfo((EPackage)value);
- if (packageInfo != null)
- {
- packageUnit = packageInfo.getPackageUnit();
- }
- }
-
- if (packageUnit != null && id.equals(packageUnit.getID()))
- {
- return packageUnit;
- }
- }
-
- return null;
- }
-
- public synchronized InternalCDOPackageUnit[] getPackageUnits(long startTime, long endTime)
- {
- LifecycleUtil.checkActive(this);
- if (endTime == CDOBranchPoint.UNSPECIFIED_DATE)
- {
- endTime = Long.MAX_VALUE;
- }
-
- Set<InternalCDOPackageUnit> result = new HashSet<InternalCDOPackageUnit>();
- for (Object value : values())
- {
- InternalCDOPackageUnit packageUnit = null;
- if (value instanceof InternalCDOPackageInfo)
- {
- packageUnit = ((InternalCDOPackageInfo)value).getPackageUnit();
- }
- else if (value instanceof EPackage)
- {
- InternalCDOPackageInfo packageInfo = getPackageInfo((EPackage)value);
- if (packageInfo != null)
- {
- packageUnit = packageInfo.getPackageUnit();
- }
- }
-
- if (packageUnit != null)
- {
- long timeStamp = packageUnit.getTimeStamp();
- if (startTime <= timeStamp && timeStamp <= endTime)
- {
- result.add(packageUnit);
- }
- }
- }
-
- return result.toArray(new InternalCDOPackageUnit[result.size()]);
- }
-
- public synchronized InternalCDOPackageUnit[] getPackageUnits(boolean withSystemPackages)
- {
- LifecycleUtil.checkActive(this);
- return collectPackageUnits(withSystemPackages);
- }
-
- public synchronized InternalCDOPackageUnit[] getPackageUnits()
- {
- LifecycleUtil.checkActive(this);
- if (packageUnits == null)
- {
- packageUnits = collectPackageUnits(true);
- Arrays.sort(packageUnits);
- }
-
- return packageUnits;
- }
-
- private InternalCDOPackageUnit[] collectPackageUnits(boolean withSystemPackages)
- {
- Set<InternalCDOPackageUnit> result = new HashSet<InternalCDOPackageUnit>();
- for (Object value : values())
- {
- InternalCDOPackageUnit packageUnit = collectPackageUnit(value);
- if (packageUnit != null && (withSystemPackages || !packageUnit.isSystem()))
- {
- result.add(packageUnit);
- }
- }
-
- return result.toArray(new InternalCDOPackageUnit[result.size()]);
- }
-
- private InternalCDOPackageUnit collectPackageUnit(Object value)
- {
- if (value instanceof InternalCDOPackageInfo)
- {
- return ((InternalCDOPackageInfo)value).getPackageUnit();
- }
-
- if (value instanceof EPackage)
- {
- InternalCDOPackageInfo packageInfo = getPackageInfo((EPackage)value);
- if (packageInfo != null)
- {
- InternalCDOPackageUnit packageUnit = packageInfo.getPackageUnit();
- return packageUnit;
- }
- }
-
- return null;
- }
-
- 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()]);
- }
-
- public synchronized EEnumLiteral getEnumLiteralFor(Enumerator value)
- {
- LifecycleUtil.checkActive(this);
- EEnumLiteral result = enumLiterals.get(value);
- if (result != null)
- {
- return result;
- }
-
- for (CDOPackageUnit packageUnit : getPackageUnits())
- {
- for (CDOPackageInfo packageInfo : packageUnit.getPackageInfos())
- {
- if (visitedPackages.add(packageInfo))
- {
- result = visitPackage(packageInfo, value);
- if (result != null)
- {
- return result;
- }
- }
- }
- }
-
- return null;
- }
-
- private EEnumLiteral visitPackage(CDOPackageInfo packageInfo, Enumerator value)
- {
- EEnumLiteral result = null;
- for (EClassifier classifier : packageInfo.getEPackage().getEClassifiers())
- {
- if (classifier instanceof EEnum)
- {
- EEnum eenum = (EEnum)classifier;
- for (EEnumLiteral eEnumLiteral : eenum.getELiterals())
- {
- Enumerator instance = eEnumLiteral.getInstance();
- enumLiterals.put(instance, eEnumLiteral);
- if (instance == value)
- {
- result = eEnumLiteral;
- }
- }
- }
- }
-
- return result;
- }
-
- public synchronized Map<EClass, List<EClass>> getSubTypes()
- {
- LifecycleUtil.checkActive(this);
- if (subTypes == null)
- {
- subTypes = CDOModelUtil.getSubTypes(this);
- }
-
- return subTypes;
- }
-
- @Override
- public String toString()
- {
- return MessageFormat.format("{0}[packageLoader={1}]", getClass().getSimpleName(), getPackageLoader()); //$NON-NLS-1$
- }
-
- public void addListener(IListener listener)
- {
- // Do nothing
- }
-
- public void removeListener(IListener listener)
- {
- // Do nothing
- }
-
- public IListener[] getListeners()
- {
- return EventUtil.NO_LISTENERS;
- }
-
- public boolean hasListeners()
- {
- return false;
- }
-
- public synchronized boolean isActive()
- {
- return active;
- }
-
- public synchronized LifecycleState getLifecycleState()
- {
- return active ? LifecycleState.ACTIVE : LifecycleState.INACTIVE;
- }
-
- public synchronized void activate() throws LifecycleException
- {
- if (!active)
- {
- CheckUtil.checkState(packageLoader, "packageLoader"); //$NON-NLS-1$
- active = true;
- }
- }
-
- public synchronized Exception deactivate()
- {
- if (active)
- {
- try
- {
- disposePackageUnits();
- clear();
- active = false;
- }
- catch (RuntimeException ex)
- {
- return ex;
- }
- }
-
- return null;
- }
-
- protected void disposePackageUnits()
- {
- for (InternalCDOPackageUnit packageUnit : getPackageUnits())
- {
- packageUnit.dispose();
- }
-
- packageInfos = null;
- packageUnits = null;
- subTypes = null;
- }
-
- protected void initPackageUnit(EPackage ePackage)
- {
- InternalCDOPackageUnit packageUnit = createPackageUnit();
- packageUnit.init(ePackage);
- resetInternalCaches();
- }
-
- protected void resetInternalCaches()
- {
- packageInfos = null;
- packageUnits = null;
- subTypes = null;
- if (eagerInternalCaches)
- {
- getPackageInfos();
- getPackageUnits();
- getSubTypes();
- }
- }
-
- public InternalCDOPackageUnit createPackageUnit()
- {
- InternalCDOPackageUnit packageUnit = (InternalCDOPackageUnit)CDOModelUtil.createPackageUnit();
- packageUnit.setPackageRegistry(this);
- return packageUnit;
- }
-}
+/*
+ * Copyright (c) 2004 - 2012 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 - Bug 332912 - Caching subtype-relationships in the CDOPackageRegistry
+ */
+package org.eclipse.emf.cdo.internal.common.model;
+
+import org.eclipse.emf.cdo.common.branch.CDOBranchPoint;
+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.CDOPackageUnit.State;
+import org.eclipse.emf.cdo.common.model.EMFUtil;
+import org.eclipse.emf.cdo.internal.common.bundle.OM;
+import org.eclipse.emf.cdo.internal.common.messages.Messages;
+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.ImplementationError;
+import org.eclipse.net4j.util.ReflectUtil.ExcludeFromDump;
+import org.eclipse.net4j.util.event.EventUtil;
+import org.eclipse.net4j.util.event.IListener;
+import org.eclipse.net4j.util.lifecycle.LifecycleException;
+import org.eclipse.net4j.util.lifecycle.LifecycleState;
+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.common.util.Enumerator;
+import org.eclipse.emf.ecore.EClass;
+import org.eclipse.emf.ecore.EClassifier;
+import org.eclipse.emf.ecore.EEnum;
+import org.eclipse.emf.ecore.EEnumLiteral;
+import org.eclipse.emf.ecore.EPackage;
+import org.eclipse.emf.ecore.impl.EPackageRegistryImpl;
+
+import java.text.MessageFormat;
+import java.util.ArrayList;
+import java.util.Arrays;
+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 boolean replacingDescriptors;
+
+ private PackageProcessor packageProcessor;
+
+ private PackageLoader packageLoader;
+
+ private transient boolean active;
+
+ @ExcludeFromDump
+ private transient InternalCDOPackageInfo[] packageInfos;
+
+ @ExcludeFromDump
+ private transient InternalCDOPackageUnit[] packageUnits;
+
+ @ExcludeFromDump
+ private transient Map<EClass, List<EClass>> subTypes;
+
+ private Map<Enumerator, EEnumLiteral> enumLiterals = new HashMap<Enumerator, EEnumLiteral>();
+
+ private Set<CDOPackageInfo> visitedPackages = new HashSet<CDOPackageInfo>();
+
+ public CDOPackageRegistryImpl()
+ {
+ }
+
+ 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;
+ }
+
+ static int lockCount;
+
+ @Override
+ public Object get(Object key)
+ {
+ LifecycleUtil.checkActive(this);
+ return super.get(key);
+ }
+
+ public synchronized Set<String> getAllKeys()
+ {
+ LifecycleUtil.checkActive(this);
+ Set<String> result = new HashSet<String>();
+ result.addAll(keySet());
+ if (delegateRegistry != null)
+ {
+ if (delegateRegistry instanceof InternalCDOPackageRegistry)
+ {
+ result.addAll(((InternalCDOPackageRegistry)delegateRegistry).getAllKeys());
+ }
+ else
+ {
+ result.addAll(delegateRegistry.keySet());
+ }
+ }
+
+ return result;
+ }
+
+ public synchronized Object getWithDelegation(String nsURI, boolean resolve)
+ {
+ LifecycleUtil.checkActive(this);
+ Object result = getFrom(this, nsURI, resolve);
+ if (result == null && delegateRegistry != null)
+ {
+ result = getFrom(delegateRegistry, nsURI, resolve);
+ }
+
+ return result;
+ }
+
+ private static Object getFrom(EPackage.Registry registry, String nsURI, boolean resolve)
+ {
+ if (resolve)
+ {
+ return registry.getEPackage(nsURI);
+ }
+
+ return registry.get(nsURI);
+ }
+
+ public synchronized Object basicPut(String nsURI, Object value)
+ {
+ LifecycleUtil.checkActive(this);
+ if (TRACER.isEnabled())
+ {
+ TRACER.format("Registering {0} --> {1}", nsURI, value); //$NON-NLS-1$
+ }
+
+ 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);
+ }
+ }
+ else if (oldValue instanceof EPackage && value instanceof InternalCDOPackageInfo)
+ {
+ EPackage oldPackage = (EPackage)oldValue;
+ InternalCDOPackageInfo oldPackageInfo = getPackageInfo(oldPackage);
+ InternalCDOPackageInfo newPackageInfo = (InternalCDOPackageInfo)value;
+
+ InternalCDOPackageUnit oldPackageUnit = oldPackageInfo.getPackageUnit();
+ InternalCDOPackageUnit newPackageUnit = newPackageInfo.getPackageUnit();
+ if (oldPackageUnit.getState() == CDOPackageUnit.State.NEW
+ && newPackageUnit.getState() != CDOPackageUnit.State.NEW)
+ {
+ oldPackageUnit.setState(CDOPackageUnit.State.LOADED);
+ }
+
+ // Keep old value!
+ return null;
+ }
+
+ 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)
+ {
+ LifecycleUtil.checkActive(this);
+ 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 void putPackageUnits(InternalCDOPackageUnit[] packageUnits, State state)
+ {
+ LifecycleUtil.checkActive(this);
+ for (InternalCDOPackageUnit packageUnit : packageUnits)
+ {
+ if (state != null)
+ {
+ packageUnit.setState(state);
+ }
+
+ putPackageUnit(packageUnit);
+ }
+ }
+
+ 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 synchronized InternalCDOPackageUnit getPackageUnit(EPackage ePackage)
+ {
+ LifecycleUtil.checkActive(this);
+ CDOPackageInfo packageInfo = getPackageInfo(ePackage);
+ if (packageInfo == null)
+ {
+ putEPackage(ePackage);
+ packageInfo = getPackageInfo(ePackage);
+ if (packageInfo == null)
+ {
+ throw new ImplementationError(MessageFormat.format(Messages.getString("CDOPackageRegistryImpl.0"), ePackage)); //$NON-NLS-1$
+ }
+ }
+
+ return (InternalCDOPackageUnit)packageInfo.getPackageUnit();
+ }
+
+ public synchronized InternalCDOPackageUnit getPackageUnit(String id)
+ {
+ LifecycleUtil.checkActive(this);
+ for (Object value : values())
+ {
+ InternalCDOPackageUnit packageUnit = null;
+ if (value instanceof InternalCDOPackageInfo)
+ {
+ packageUnit = ((InternalCDOPackageInfo)value).getPackageUnit();
+ }
+ else if (value instanceof EPackage)
+ {
+ InternalCDOPackageInfo packageInfo = getPackageInfo((EPackage)value);
+ if (packageInfo != null)
+ {
+ packageUnit = packageInfo.getPackageUnit();
+ }
+ }
+
+ if (packageUnit != null && id.equals(packageUnit.getID()))
+ {
+ return packageUnit;
+ }
+ }
+
+ return null;
+ }
+
+ public synchronized InternalCDOPackageUnit[] getPackageUnits(long startTime, long endTime)
+ {
+ LifecycleUtil.checkActive(this);
+ if (endTime == CDOBranchPoint.UNSPECIFIED_DATE)
+ {
+ endTime = Long.MAX_VALUE;
+ }
+
+ Set<InternalCDOPackageUnit> result = new HashSet<InternalCDOPackageUnit>();
+ for (Object value : values())
+ {
+ InternalCDOPackageUnit packageUnit = null;
+ if (value instanceof InternalCDOPackageInfo)
+ {
+ packageUnit = ((InternalCDOPackageInfo)value).getPackageUnit();
+ }
+ else if (value instanceof EPackage)
+ {
+ InternalCDOPackageInfo packageInfo = getPackageInfo((EPackage)value);
+ if (packageInfo != null)
+ {
+ packageUnit = packageInfo.getPackageUnit();
+ }
+ }
+
+ if (packageUnit != null)
+ {
+ long timeStamp = packageUnit.getTimeStamp();
+ if (startTime <= timeStamp && timeStamp <= endTime)
+ {
+ result.add(packageUnit);
+ }
+ }
+ }
+
+ return result.toArray(new InternalCDOPackageUnit[result.size()]);
+ }
+
+ public synchronized InternalCDOPackageUnit[] getPackageUnits(boolean withSystemPackages)
+ {
+ LifecycleUtil.checkActive(this);
+ return collectPackageUnits(withSystemPackages);
+ }
+
+ public synchronized InternalCDOPackageUnit[] getPackageUnits()
+ {
+ LifecycleUtil.checkActive(this);
+ if (packageUnits == null)
+ {
+ packageUnits = collectPackageUnits(true);
+ Arrays.sort(packageUnits);
+ }
+
+ return packageUnits;
+ }
+
+ private InternalCDOPackageUnit[] collectPackageUnits(boolean withSystemPackages)
+ {
+ Set<InternalCDOPackageUnit> result = new HashSet<InternalCDOPackageUnit>();
+ for (Object value : values())
+ {
+ InternalCDOPackageUnit packageUnit = collectPackageUnit(value);
+ if (packageUnit != null && (withSystemPackages || !packageUnit.isSystem()))
+ {
+ result.add(packageUnit);
+ }
+ }
+
+ return result.toArray(new InternalCDOPackageUnit[result.size()]);
+ }
+
+ private InternalCDOPackageUnit collectPackageUnit(Object value)
+ {
+ if (value instanceof InternalCDOPackageInfo)
+ {
+ return ((InternalCDOPackageInfo)value).getPackageUnit();
+ }
+
+ if (value instanceof EPackage)
+ {
+ InternalCDOPackageInfo packageInfo = getPackageInfo((EPackage)value);
+ if (packageInfo != null)
+ {
+ InternalCDOPackageUnit packageUnit = packageInfo.getPackageUnit();
+ return packageUnit;
+ }
+ }
+
+ return null;
+ }
+
+ 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()]);
+ }
+
+ public synchronized EEnumLiteral getEnumLiteralFor(Enumerator value)
+ {
+ LifecycleUtil.checkActive(this);
+ EEnumLiteral result = enumLiterals.get(value);
+ if (result != null)
+ {
+ return result;
+ }
+
+ for (CDOPackageUnit packageUnit : getPackageUnits())
+ {
+ for (CDOPackageInfo packageInfo : packageUnit.getPackageInfos())
+ {
+ if (visitedPackages.add(packageInfo))
+ {
+ result = visitPackage(packageInfo, value);
+ if (result != null)
+ {
+ return result;
+ }
+ }
+ }
+ }
+
+ return null;
+ }
+
+ private EEnumLiteral visitPackage(CDOPackageInfo packageInfo, Enumerator value)
+ {
+ EEnumLiteral result = null;
+ for (EClassifier classifier : packageInfo.getEPackage().getEClassifiers())
+ {
+ if (classifier instanceof EEnum)
+ {
+ EEnum eenum = (EEnum)classifier;
+ for (EEnumLiteral eEnumLiteral : eenum.getELiterals())
+ {
+ Enumerator instance = eEnumLiteral.getInstance();
+ enumLiterals.put(instance, eEnumLiteral);
+ if (instance == value)
+ {
+ result = eEnumLiteral;
+ }
+ }
+ }
+ }
+
+ return result;
+ }
+
+ public synchronized Map<EClass, List<EClass>> getSubTypes()
+ {
+ LifecycleUtil.checkActive(this);
+ if (subTypes == null)
+ {
+ subTypes = CDOModelUtil.getSubTypes(this);
+ }
+
+ return subTypes;
+ }
+
+ @Override
+ public String toString()
+ {
+ return MessageFormat.format("{0}[packageLoader={1}]", getClass().getSimpleName(), getPackageLoader()); //$NON-NLS-1$
+ }
+
+ public void addListener(IListener listener)
+ {
+ // Do nothing
+ }
+
+ public void removeListener(IListener listener)
+ {
+ // Do nothing
+ }
+
+ public IListener[] getListeners()
+ {
+ return EventUtil.NO_LISTENERS;
+ }
+
+ public boolean hasListeners()
+ {
+ return false;
+ }
+
+ public synchronized boolean isActive()
+ {
+ return active;
+ }
+
+ public synchronized LifecycleState getLifecycleState()
+ {
+ return active ? LifecycleState.ACTIVE : LifecycleState.INACTIVE;
+ }
+
+ public synchronized void activate() throws LifecycleException
+ {
+ if (!active)
+ {
+ CheckUtil.checkState(packageLoader, "packageLoader"); //$NON-NLS-1$
+ active = true;
+ }
+ }
+
+ public synchronized Exception deactivate()
+ {
+ if (active)
+ {
+ try
+ {
+ disposePackageUnits();
+ clear();
+ active = false;
+ }
+ catch (RuntimeException ex)
+ {
+ return ex;
+ }
+ }
+
+ return null;
+ }
+
+ protected void disposePackageUnits()
+ {
+ for (InternalCDOPackageUnit packageUnit : getPackageUnits())
+ {
+ packageUnit.dispose();
+ }
+
+ packageInfos = null;
+ packageUnits = null;
+ subTypes = null;
+ }
+
+ protected void initPackageUnit(EPackage ePackage)
+ {
+ InternalCDOPackageUnit packageUnit = createPackageUnit();
+ packageUnit.init(ePackage);
+ resetInternalCaches();
+ }
+
+ protected void resetInternalCaches()
+ {
+ packageInfos = null;
+ packageUnits = null;
+ subTypes = null;
+ if (eagerInternalCaches)
+ {
+ getPackageInfos();
+ getPackageUnits();
+ getSubTypes();
+ }
+ }
+
+ public InternalCDOPackageUnit createPackageUnit()
+ {
+ InternalCDOPackageUnit packageUnit = (InternalCDOPackageUnit)CDOModelUtil.createPackageUnit();
+ packageUnit.setPackageRegistry(this);
+ return packageUnit;
+ }
+}
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
index 8282ed13c0..bd0106bea3 100644
--- 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
@@ -1,393 +1,393 @@
-/*
- * Copyright (c) 2004 - 2011 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.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.common.protocol.CDODataInput;
-import org.eclipse.emf.cdo.common.protocol.CDODataOutput;
-import org.eclipse.emf.cdo.common.util.CDOCommonUtil;
-import org.eclipse.emf.cdo.internal.common.bundle.OM;
-import org.eclipse.emf.cdo.internal.common.messages.Messages;
-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.InternalCDOPackageRegistry.PackageLoader;
-import org.eclipse.emf.cdo.spi.common.model.InternalCDOPackageUnit;
-
-import org.eclipse.net4j.util.CheckUtil;
-import org.eclipse.net4j.util.om.trace.ContextTracer;
-
-import org.eclipse.emf.ecore.EPackage;
-import org.eclipse.emf.ecore.resource.ResourceSet;
-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 Messages.getString("CDOPackageUnitImpl.0"); //$NON-NLS-1$
- }
- }
-
- 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(Messages.getString("CDOPackageUnitImpl.1")); //$NON-NLS-1$
- }
-
- 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 boolean isResource()
- {
- return getTopLevelPackageInfo().isResourcePackage();
- }
-
- 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);
- setOriginalType(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(boolean resolve)
- {
- load(packageRegistry.getPackageLoader(), resolve);
- }
-
- public synchronized void load(PackageLoader packageLoader, boolean resolve)
- {
- if (state == State.PROXY)
- {
- EPackage[] ePackages = null;
- ePackages = loadPackagesFromGlobalRegistry();
- if (ePackages == null)
- {
- ePackages = packageLoader.loadPackages(this);
- }
-
- for (EPackage ePackage : ePackages)
- {
- String packageURI = ePackage.getNsURI();
- InternalCDOPackageInfo packageInfo = getPackageInfo(packageURI);
- synchronized (ePackage)
- {
- EMFUtil.addAdapter(ePackage, packageInfo);
- if (resolve)
- {
- EcoreUtil.resolveAll(ePackage);
- }
- }
- }
-
- setState(State.LOADED);
- }
- }
-
- public void write(CDODataOutput out, boolean withPackages) throws IOException
- {
- if (TRACER.isEnabled())
- {
- TRACER.format("Writing {0}", this); //$NON-NLS-1$
- }
-
- 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, ResourceSet resourceSet) throws IOException
- {
- EPackage ePackage = null;
- boolean withPackages = in.readBoolean();
- if (withPackages)
- {
- CheckUtil.checkArg(resourceSet, "resourceSet"); //$NON-NLS-1$
- CheckUtil.checkNull(resourceSet.getPackageRegistry(), "ResourceSet's packageRegistry == null");
- ePackage = CDOModelUtil.readPackage(in, resourceSet, true);
- EPackage globalPackage = loadPackageFromGlobalRegistry(ePackage.getNsURI());
- if (globalPackage != null)
- {
- ePackage = globalPackage;
- }
-
- 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); //$NON-NLS-1$
- }
- }
-
- 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}]"; //$NON-NLS-1$
- return MessageFormat.format(fmt, getID(), getState(), getType(), getOriginalType(),
- CDOCommonUtil.formatTimeStamp(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());
- 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] = loadPackageFromGlobalRegistry(packageInfos[i].getPackageURI());
- if (ePackages[i] == null)
- {
- return null;
- }
- }
-
- return ePackages;
- }
-
- private EPackage loadPackageFromGlobalRegistry(String packageURI)
- {
- return EPackage.Registry.INSTANCE.getEPackage(packageURI);
- }
-}
+/*
+ * Copyright (c) 2004 - 2012 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.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.common.protocol.CDODataInput;
+import org.eclipse.emf.cdo.common.protocol.CDODataOutput;
+import org.eclipse.emf.cdo.common.util.CDOCommonUtil;
+import org.eclipse.emf.cdo.internal.common.bundle.OM;
+import org.eclipse.emf.cdo.internal.common.messages.Messages;
+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.InternalCDOPackageRegistry.PackageLoader;
+import org.eclipse.emf.cdo.spi.common.model.InternalCDOPackageUnit;
+
+import org.eclipse.net4j.util.CheckUtil;
+import org.eclipse.net4j.util.om.trace.ContextTracer;
+
+import org.eclipse.emf.ecore.EPackage;
+import org.eclipse.emf.ecore.resource.ResourceSet;
+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 Messages.getString("CDOPackageUnitImpl.0"); //$NON-NLS-1$
+ }
+ }
+
+ 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(Messages.getString("CDOPackageUnitImpl.1")); //$NON-NLS-1$
+ }
+
+ 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 boolean isResource()
+ {
+ return getTopLevelPackageInfo().isResourcePackage();
+ }
+
+ 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);
+ setOriginalType(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(boolean resolve)
+ {
+ load(packageRegistry.getPackageLoader(), resolve);
+ }
+
+ public synchronized void load(PackageLoader packageLoader, boolean resolve)
+ {
+ if (state == State.PROXY)
+ {
+ EPackage[] ePackages = null;
+ ePackages = loadPackagesFromGlobalRegistry();
+ if (ePackages == null)
+ {
+ ePackages = packageLoader.loadPackages(this);
+ }
+
+ for (EPackage ePackage : ePackages)
+ {
+ String packageURI = ePackage.getNsURI();
+ InternalCDOPackageInfo packageInfo = getPackageInfo(packageURI);
+ synchronized (ePackage)
+ {
+ EMFUtil.addAdapter(ePackage, packageInfo);
+ if (resolve)
+ {
+ EcoreUtil.resolveAll(ePackage);
+ }
+ }
+ }
+
+ setState(State.LOADED);
+ }
+ }
+
+ public void write(CDODataOutput out, boolean withPackages) throws IOException
+ {
+ if (TRACER.isEnabled())
+ {
+ TRACER.format("Writing {0}", this); //$NON-NLS-1$
+ }
+
+ 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, ResourceSet resourceSet) throws IOException
+ {
+ EPackage ePackage = null;
+ boolean withPackages = in.readBoolean();
+ if (withPackages)
+ {
+ CheckUtil.checkArg(resourceSet, "resourceSet"); //$NON-NLS-1$
+ CheckUtil.checkNull(resourceSet.getPackageRegistry(), "ResourceSet's packageRegistry == null");
+ ePackage = CDOModelUtil.readPackage(in, resourceSet, true);
+ EPackage globalPackage = loadPackageFromGlobalRegistry(ePackage.getNsURI());
+ if (globalPackage != null)
+ {
+ ePackage = globalPackage;
+ }
+
+ 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); //$NON-NLS-1$
+ }
+ }
+
+ 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}]"; //$NON-NLS-1$
+ return MessageFormat.format(fmt, getID(), getState(), getType(), getOriginalType(),
+ CDOCommonUtil.formatTimeStamp(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());
+ 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] = loadPackageFromGlobalRegistry(packageInfos[i].getPackageURI());
+ if (ePackages[i] == null)
+ {
+ return null;
+ }
+ }
+
+ return ePackages;
+ }
+
+ private EPackage loadPackageFromGlobalRegistry(String packageURI)
+ {
+ return EPackage.Registry.INSTANCE.getEPackage(packageURI);
+ }
+}
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 909e9c9f77..48ba6aaf38 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
@@ -1,943 +1,943 @@
-/*
- * Copyright (c) 2004 - 2011 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 - Bug 299194: unsettable features inconsistent between revisions
- * Erdal Karaca - added support for HASHMAP CDO Type
- */
-package org.eclipse.emf.cdo.internal.common.model;
-
-import org.eclipse.emf.cdo.common.id.CDOID;
-import org.eclipse.emf.cdo.common.lob.CDOBlob;
-import org.eclipse.emf.cdo.common.lob.CDOClob;
-import org.eclipse.emf.cdo.common.lob.CDOLobUtil;
-import org.eclipse.emf.cdo.common.model.CDOModelUtil;
-import org.eclipse.emf.cdo.common.model.CDOType;
-import org.eclipse.emf.cdo.common.protocol.CDODataInput;
-import org.eclipse.emf.cdo.common.protocol.CDODataOutput;
-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.cdo.internal.common.messages.Messages;
-import org.eclipse.emf.cdo.spi.common.model.InternalCDOPackageRegistry;
-import org.eclipse.emf.cdo.spi.common.revision.CDOReferenceAdjuster;
-
-import org.eclipse.emf.common.util.Enumerator;
-import org.eclipse.emf.ecore.EClassifier;
-import org.eclipse.emf.ecore.EDataType;
-import org.eclipse.emf.ecore.EEnum;
-import org.eclipse.emf.ecore.EEnumLiteral;
-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 org.eclipse.emf.ecore.util.FeatureMap;
-
-import java.io.IOException;
-import java.math.BigDecimal;
-import java.math.BigInteger;
-import java.text.MessageFormat;
-import java.util.Date;
-import java.util.HashMap;
-import java.util.Map;
-import java.util.Map.Entry;
-import java.util.Set;
-
-/**
- * @author Eike Stepper
- */
-public abstract class CDOTypeImpl implements CDOType
-{
- private static CDOTypeImpl[] ids = new CDOTypeImpl[Byte.MAX_VALUE - Byte.MIN_VALUE + 1];
-
- private static final byte BOOLEAN_DEFAULT_PRIMITIVE = 0;
-
- private static final char CHARACTER_DEFAULT_PRIMITIVE = 0;
-
- private static final short SHORT_DEFAULT_PRIMITIVE = 0;
-
- public static final Boolean BOOLEAN_DEFAULT = new Boolean(false);
-
- public static final Byte BYTE_DEFAULT = new Byte(BOOLEAN_DEFAULT_PRIMITIVE);
-
- public static final Character CHARACTER_DEFAULT = new Character(CHARACTER_DEFAULT_PRIMITIVE);
-
- public static final Double DOUBLE_DEFAULT = new Double(0.0);
-
- public static final Float FLOAT_DEFAULT = new Float(0.0);
-
- public static final Integer INTEGER_DEFAULT = new Integer(0);
-
- public static final Long LONG_DEFAULT = new Long(0L);
-
- public static final Short SHORT_DEFAULT = new Short(SHORT_DEFAULT_PRIMITIVE);
-
- public static final CDOType BOOLEAN = new CDOTypeImpl("BOOLEAN", EcorePackage.EBOOLEAN, false, BOOLEAN_DEFAULT) //$NON-NLS-1$
- {
- public void writeValue(CDODataOutput out, Object value) throws IOException
- {
- boolean v = (Boolean)(value == null ? getDefaultValue() : value);
- out.writeBoolean(v);
- }
-
- public Boolean readValue(CDODataInput in) throws IOException
- {
- return in.readBoolean();
- }
- };
-
- public static final CDOType BYTE = new CDOTypeImpl("BYTE", EcorePackage.EBYTE, false, BYTE_DEFAULT) //$NON-NLS-1$
- {
- public void writeValue(CDODataOutput out, Object value) throws IOException
- {
- out.writeByte((Byte)(value == null ? getDefaultValue() : value));
- }
-
- public Byte readValue(CDODataInput in) throws IOException
- {
- return in.readByte();
- }
- };
-
- public static final CDOType CHAR = new CDOTypeImpl("CHAR", EcorePackage.ECHAR, false, CHARACTER_DEFAULT) //$NON-NLS-1$
- {
- public void writeValue(CDODataOutput out, Object value) throws IOException
- {
- out.writeChar(((Character)(value == null ? getDefaultValue() : value)).charValue());
- }
-
- public Character readValue(CDODataInput in) throws IOException
- {
- return in.readChar();
- }
- };
-
- public static final CDOType DOUBLE = new CDOTypeImpl("DOUBLE", EcorePackage.EDOUBLE, false, DOUBLE_DEFAULT) //$NON-NLS-1$
- {
- public void writeValue(CDODataOutput out, Object value) throws IOException
- {
- out.writeDouble((Double)(value == null ? getDefaultValue() : value));
- }
-
- public Double readValue(CDODataInput in) throws IOException
- {
- return in.readDouble();
- }
- };
-
- public static final CDOType FLOAT = new CDOTypeImpl("FLOAT", EcorePackage.EFLOAT, false, FLOAT_DEFAULT) //$NON-NLS-1$
- {
- public void writeValue(CDODataOutput out, Object value) throws IOException
- {
- out.writeFloat((Float)(value == null ? getDefaultValue() : value));
- }
-
- public Float readValue(CDODataInput in) throws IOException
- {
- return in.readFloat();
- }
- };
-
- public static final CDOType INT = new CDOTypeImpl("INT", EcorePackage.EINT, false, INTEGER_DEFAULT) //$NON-NLS-1$
- {
- public void writeValue(CDODataOutput out, Object value) throws IOException
- {
- out.writeInt((Integer)(value == null ? getDefaultValue() : value));
- }
-
- public Integer readValue(CDODataInput in) throws IOException
- {
- return in.readInt();
- }
- };
-
- public static final CDOType LONG = new CDOTypeImpl("LONG", EcorePackage.ELONG, false, LONG_DEFAULT) //$NON-NLS-1$
- {
- public void writeValue(CDODataOutput out, Object value) throws IOException
- {
- out.writeLong((Long)(value == null ? getDefaultValue() : value));
- }
-
- public Long readValue(CDODataInput in) throws IOException
- {
- return in.readLong();
- }
- };
-
- public static final CDOType SHORT = new CDOTypeImpl("SHORT", EcorePackage.ESHORT, false, SHORT_DEFAULT) //$NON-NLS-1$
- {
- public void writeValue(CDODataOutput out, Object value) throws IOException
- {
- out.writeShort((Short)(value == null ? getDefaultValue() : value));
- }
-
- public Short readValue(CDODataInput in) throws IOException
- {
- return in.readShort();
- }
- };
-
- public static final CDOType BIG_DECIMAL = new CDOTypeImpl("BIG_DECIMAL", EcorePackage.EBIG_DECIMAL, true) //$NON-NLS-1$
- {
- public void writeValue(CDODataOutput out, Object value) throws IOException
- {
- if (value == null)
- {
- out.writeByteArray(null);
- }
- else
- {
- BigDecimal bigDecimal = (BigDecimal)value;
- out.writeByteArray(bigDecimal.unscaledValue().toByteArray());
- out.writeInt(bigDecimal.scale());
- }
- }
-
- public BigDecimal readValue(CDODataInput in) throws IOException
- {
- byte[] array = in.readByteArray();
- if (array == null)
- {
- return null;
- }
-
- BigInteger unscaled = new BigInteger(array);
- int scale = in.readInt();
- return new BigDecimal(unscaled, scale);
- }
- };
-
- public static final CDOType BIG_INTEGER = new CDOTypeImpl("BIG_INTEGER", EcorePackage.EBIG_INTEGER, true) //$NON-NLS-1$
- {
- public void writeValue(CDODataOutput out, Object value) throws IOException
- {
- if (value == null)
- {
- out.writeByteArray(null);
- }
- else
- {
- out.writeByteArray(((BigInteger)value).toByteArray());
- }
- }
-
- public BigInteger readValue(CDODataInput in) throws IOException
- {
- byte[] array = in.readByteArray();
- if (array == null)
- {
- return null;
- }
-
- return new BigInteger(array);
- }
- };
-
- public static final CDOType OBJECT = new CDOTypeImpl("OBJECT", EcorePackage.EOBJECT, true, CDOID.NULL) //$NON-NLS-1$
- {
- public void writeValue(CDODataOutput out, Object value) throws IOException
- {
- if (value instanceof CDORevision)
- {
- out.writeCDOID(((CDORevision)value).getID());
- }
- else
- {
- out.writeCDOID((CDOID)value);
- }
- }
-
- public CDOID readValue(CDODataInput in) throws IOException
- {
- return in.readCDOID();
- }
-
- @Override
- public Object doAdjustReferences(CDOReferenceAdjuster adjuster, Object value, EStructuralFeature feature, int index)
- {
- return adjuster.adjustReference(value, feature, index);
- }
- };
-
- public static final CDOType BOOLEAN_OBJECT = new ObjectType("BOOLEAN_OBJECT", EcorePackage.EBOOLEAN_OBJECT) //$NON-NLS-1$
- {
- @Override
- protected void doWriteValue(CDODataOutput out, Object value) throws IOException
- {
- out.writeBoolean((Boolean)value);
- }
-
- @Override
- protected Boolean doReadValue(CDODataInput in) throws IOException
- {
- return in.readBoolean();
- }
- };
-
- public static final CDOType BYTE_OBJECT = new ObjectType("BYTE_OBJECT", EcorePackage.EBYTE_OBJECT) //$NON-NLS-1$
- {
- @Override
- protected void doWriteValue(CDODataOutput out, Object value) throws IOException
- {
- out.writeByte((Byte)value);
- }
-
- @Override
- protected Byte doReadValue(CDODataInput in) throws IOException
- {
- return in.readByte();
- }
- };
-
- public static final CDOType CHARACTER_OBJECT = new ObjectType("CHARACTER_OBJECT", EcorePackage.ECHARACTER_OBJECT) //$NON-NLS-1$
- {
- @Override
- protected void doWriteValue(CDODataOutput out, Object value) throws IOException
- {
- out.writeChar((Character)value);
- }
-
- @Override
- protected Character doReadValue(CDODataInput in) throws IOException
- {
- return in.readChar();
- }
- };
-
- public static final CDOType DATE = new ObjectType("DATE", EcorePackage.EDATE) //$NON-NLS-1$
- {
- @Override
- protected void doWriteValue(CDODataOutput out, Object value) throws IOException
- {
- out.writeLong(((Date)value).getTime());
- }
-
- @Override
- protected Date doReadValue(CDODataInput in) throws IOException
- {
- return new Date(in.readLong());
- }
- };
-
- public static final CDOType DOUBLE_OBJECT = new ObjectType("DOUBLE_OBJECT", EcorePackage.EDOUBLE_OBJECT) //$NON-NLS-1$
- {
- @Override
- protected void doWriteValue(CDODataOutput out, Object value) throws IOException
- {
- out.writeDouble((Double)value);
- }
-
- @Override
- protected Double doReadValue(CDODataInput in) throws IOException
- {
- return in.readDouble();
- }
- };
-
- public static final CDOType FLOAT_OBJECT = new ObjectType("FLOAT_OBJECT", EcorePackage.EFLOAT_OBJECT) //$NON-NLS-1$
- {
- @Override
- protected void doWriteValue(CDODataOutput out, Object value) throws IOException
- {
- out.writeFloat((Float)value);
- }
-
- @Override
- protected Float doReadValue(CDODataInput in) throws IOException
- {
- return in.readFloat();
- }
- };
-
- public static final CDOType INTEGER_OBJECT = new ObjectType("INTEGER_OBJECT", EcorePackage.EINTEGER_OBJECT) //$NON-NLS-1$
- {
- @Override
- protected void doWriteValue(CDODataOutput out, Object value) throws IOException
- {
- out.writeInt((Integer)value);
- }
-
- @Override
- protected Integer doReadValue(CDODataInput in) throws IOException
- {
- return in.readInt();
- }
- };
-
- public static final CDOType LONG_OBJECT = new ObjectType("LONG_OBJECT", EcorePackage.ELONG_OBJECT) //$NON-NLS-1$
- {
- @Override
- protected void doWriteValue(CDODataOutput out, Object value) throws IOException
- {
- out.writeLong((Long)value);
- }
-
- @Override
- protected Long doReadValue(CDODataInput in) throws IOException
- {
- return in.readLong();
- }
- };
-
- public static final CDOType SHORT_OBJECT = new ObjectType("SHORT_OBJECT", EcorePackage.ESHORT_OBJECT) //$NON-NLS-1$
- {
- @Override
- protected void doWriteValue(CDODataOutput out, Object value) throws IOException
- {
- out.writeShort((Short)value);
- }
-
- @Override
- protected Short doReadValue(CDODataInput in) throws IOException
- {
- return in.readShort();
- }
- };
-
- public static final CDOType STRING = new CDOTypeImpl("STRING", EcorePackage.ESTRING, true) //$NON-NLS-1$
- {
- @Override
- protected String doCopyValue(Object value)
- {
- return (String)value;
- }
-
- public void writeValue(CDODataOutput out, Object value) throws IOException
- {
- out.writeString((String)value);
- }
-
- public String readValue(CDODataInput in) throws IOException
- {
- return in.readString();
- }
- };
-
- public static final CDOType BYTE_ARRAY = new CDOTypeImpl("BYTE_ARRAY", EcorePackage.EBYTE_ARRAY, true) //$NON-NLS-1$
- {
- @Override
- protected byte[] doCopyValue(Object value)
- {
- byte[] array = (byte[])value;
- byte[] result = new byte[array.length];
- System.arraycopy(value, 0, result, 0, array.length);
- return result;
- }
-
- public void writeValue(CDODataOutput out, Object value) throws IOException
- {
- out.writeByteArray((byte[])value);
- }
-
- public byte[] readValue(CDODataInput in) throws IOException
- {
- return in.readByteArray();
- }
- };
-
- public static final CDOType FEATURE_MAP_ENTRY = new CDOTypeImpl("FEATURE_MAP_ENTRY", EcorePackage.EFEATURE_MAP_ENTRY, //$NON-NLS-1$
- false)
- {
- @Override
- protected FeatureMap.Entry doCopyValue(Object value)
- {
- FeatureMap.Entry entry = (FeatureMap.Entry)value;
- EStructuralFeature innerFeature = entry.getEStructuralFeature();
- Object innerValue = entry.getValue();
- CDOType innerType = CDOModelUtil.getType(innerFeature.getEType());
-
- Object innerCopy = innerType.copyValue(innerValue);
- return CDORevisionUtil.createFeatureMapEntry(innerFeature, innerCopy);
- }
-
- public void writeValue(CDODataOutput out, Object value) throws IOException
- {
- throw new UnsupportedOperationException();
- }
-
- public FeatureMap.Entry readValue(CDODataInput in) throws IOException
- {
- throw new UnsupportedOperationException();
- }
-
- @Override
- public Object doAdjustReferences(CDOReferenceAdjuster adjuster, Object value, EStructuralFeature feature, int index)
- {
- FeatureMap.Entry entry = (FeatureMap.Entry)value;
- EStructuralFeature innerFeature = entry.getEStructuralFeature();
- Object innerValue = entry.getValue();
- CDOType innerType = CDOModelUtil.getType(innerFeature.getEType());
-
- Object innerCopy = innerType.adjustReferences(adjuster, innerValue, feature, index);
- if (innerCopy != innerValue) // Just an optimization for NOOP adjusters
- {
- value = CDORevisionUtil.createFeatureMapEntry(innerFeature, innerCopy);
- }
-
- return value;
- }
- };
-
- public static final CDOType CUSTOM = new CDOTypeImpl("CUSTOM", 0, true) //$NON-NLS-1$
- {
- @Override
- protected String doCopyValue(Object value)
- {
- return (String)value;
- }
-
- public void writeValue(CDODataOutput out, Object value) throws IOException
- {
- out.writeString((String)value);
- }
-
- public String readValue(CDODataInput in) throws IOException
- {
- return in.readString();
- }
-
- @Override
- public Object convertToEMF(EClassifier eType, Object value)
- {
- return EcoreUtil.createFromString((EDataType)eType, (String)value);
- }
-
- @Override
- public Object convertToCDO(EClassifier eType, Object value)
- {
- return EcoreUtil.convertToString((EDataType)eType, value);
- }
- };
-
- /**
- * TODO Transfer integers!
- */
- public static final CDOType ENUM_ORDINAL = new ObjectType("ENUM_ORDINAL", -1) //$NON-NLS-1$
- {
- @Override
- protected Integer doCopyValue(Object value)
- {
- return (Integer)value;
- }
-
- @Override
- public void doWriteValue(CDODataOutput out, Object value) throws IOException
- {
- out.writeInt((Integer)value);
- }
-
- @Override
- public Integer doReadValue(CDODataInput in) throws IOException
- {
- return in.readInt();
- }
-
- @Override
- public Object convertToCDO(EClassifier type, Object value)
- {
- for (EEnumLiteral literal : ((EEnum)type).getELiterals())
- {
- if (literal == value || literal.getInstance() == value)
- {
- return literal.getValue();
- }
- }
-
- throw new IllegalStateException(MessageFormat.format(Messages.getString("CDOTypeImpl.23"), value)); //$NON-NLS-1$
- }
-
- @Override
- public Object convertToEMF(EClassifier type, Object value)
- {
- return ((EEnum)type).getEEnumLiteral((Integer)value).getInstance();
- }
- };
-
- public static final CDOType ENUM_LITERAL = new ObjectType("ENUM_LITERAL", -2) //$NON-NLS-1$
- {
- @Override
- protected void doWriteValue(CDODataOutput out, Object value) throws IOException
- {
- EEnum eEnum;
- if (value instanceof EEnumLiteral)
- {
- eEnum = ((EEnumLiteral)value).getEEnum();
- }
- else
- {
- eEnum = findEnum((InternalCDOPackageRegistry)out.getPackageRegistry(), value);
- }
-
- out.writeCDOClassifierRef(eEnum);
- out.writeInt(((Enumerator)value).getValue());
- }
-
- @Override
- protected Object doReadValue(CDODataInput in) throws IOException
- {
- EEnum eEnum = (EEnum)in.readCDOClassifierRefAndResolve();
- int ordinal = in.readInt();
-
- EEnumLiteral literal = eEnum.getEEnumLiteral(ordinal);
- if (literal == null)
- {
- throw new IllegalArgumentException("Enum literal " + ordinal + " not found in " + eEnum);
- }
-
- return literal.getInstance();
- }
-
- private EEnum findEnum(InternalCDOPackageRegistry registry, Object value)
- {
- Set<String> keys = registry.getAllKeys();
-
- // First try all the packages that are already resolved
- for (String nsURI : keys)
- {
- Object possiblePackage = registry.getWithDelegation(nsURI, false);
- if (possiblePackage instanceof EPackage)
- {
- EPackage ePackage = (EPackage)possiblePackage;
- EEnum eEnum = findEnum(ePackage, value);
- if (eEnum != null)
- {
- return eEnum;
- }
- }
- }
-
- // Then try all the package descriptors
- for (String nsURI : keys)
- {
- Object possiblePackage = registry.getWithDelegation(nsURI, false);
- if (possiblePackage instanceof EPackage.Descriptor)
- {
- EPackage ePackage = registry.getEPackage(nsURI);
- EEnum eEnum = findEnum(ePackage, value);
- if (eEnum != null)
- {
- return eEnum;
- }
- }
- }
-
- throw new IllegalArgumentException("EENum instance " + value.getClass().getName() + " not supported");
- }
-
- private EEnum findEnum(EPackage ePackage, Object value)
- {
- for (EClassifier eClassifier : ePackage.getEClassifiers())
- {
- if (eClassifier instanceof EEnum)
- {
- EEnum eEnum = (EEnum)eClassifier;
- if (eEnum.getInstanceClass() != null && eEnum.getInstanceClass() == value.getClass())
- {
- return eEnum;
- }
- }
- }
-
- return null;
- }
- };
-
- public static final CDOType BLOB = new CDOTypeImpl("BLOB", -3, true) //$NON-NLS-1$
- {
- public CDOBlob readValue(CDODataInput in) throws IOException
- {
- if (in.readBoolean())
- {
- return CDOLobUtil.readBlob(in);
- }
-
- return null;
- }
-
- public void writeValue(CDODataOutput out, Object value) throws IOException
- {
- if (value != null)
- {
- out.writeBoolean(true);
- CDOLobUtil.write(out, (CDOBlob)value);
- }
- else
- {
- out.writeBoolean(false);
- }
- }
- };
-
- public static final CDOType CLOB = new CDOTypeImpl("CLOB", -4, true) //$NON-NLS-1$
- {
- public CDOClob readValue(CDODataInput in) throws IOException
- {
- if (in.readBoolean())
- {
- return CDOLobUtil.readClob(in);
- }
-
- return null;
- }
-
- public void writeValue(CDODataOutput out, Object value) throws IOException
- {
- if (value != null)
- {
- out.writeBoolean(true);
- CDOLobUtil.write(out, (CDOClob)value);
- }
- else
- {
- out.writeBoolean(false);
- }
- }
- };
-
- public static final CDOType OBJECT_ARRAY = new ObjectType("OBJECT_ARRAY", -5) //$NON-NLS-1$
- {
- @Override
- protected void doWriteValue(CDODataOutput out, Object value) throws IOException
- {
- Object[] objects = (Object[])value;
- out.writeInt(objects.length);
- for (Object object : objects)
- {
- writeTypeAndValue(out, object);
- }
- }
-
- @Override
- protected Object[] doReadValue(CDODataInput in) throws IOException
- {
- int size = in.readInt();
- Object[] objects = new Object[size];
- for (int i = 0; i < size; i++)
- {
- objects[i] = readTypeAndValue(in);
- }
-
- return objects;
- }
-
- @Override
- public Object doAdjustReferences(CDOReferenceAdjuster adjuster, Object value, EStructuralFeature feature, int index)
- {
- Object[] objects = (Object[])value;
- int i = 0;
- for (Object object : objects)
- {
- if (object instanceof CDOID)
- {
- objects[i] = adjuster.adjustReference(object, feature, i);
- }
- else
- {
- objects[i] = object;
- }
-
- ++i;
- }
-
- return objects;
- }
- };
-
- public static final CDOType MAP = new ObjectType("MAP", -6) //$NON-NLS-1$
- {
- @SuppressWarnings("unchecked")
- @Override
- protected void doWriteValue(CDODataOutput out, Object value) throws IOException
- {
- Map<Object, Object> map = (Map<Object, Object>)value;
- out.writeInt(map.size());
-
- for (Entry<Object, Object> entry : map.entrySet())
- {
- writeTypeAndValue(out, entry.getKey());
- writeTypeAndValue(out, entry.getValue());
- }
- }
-
- @Override
- protected Map<Object, Object> doReadValue(CDODataInput in) throws IOException
- {
- Map<Object, Object> result = new HashMap<Object, Object>();
- int size = in.readInt();
- for (int i = 0; i < size; i++)
- {
- Object key = readTypeAndValue(in);
- Object value = readTypeAndValue(in);
- result.put(key, value == CDOID.NULL ? null : value);
- }
-
- return result;
- }
- };
-
- private String name;
-
- private byte typeID;
-
- private boolean canBeNull;
-
- private Object defaultValue;
-
- private CDOTypeImpl(String name, int typeID, boolean canBeNull, Object defaultValue)
- {
- ids[typeID - Byte.MIN_VALUE] = this;
-
- this.name = name;
- this.typeID = (byte)typeID;
- this.canBeNull = canBeNull;
- this.defaultValue = defaultValue;
- }
-
- private CDOTypeImpl(String name, int typeID, boolean canBeNull)
- {
- this(name, typeID, canBeNull, null);
- }
-
- public String getName()
- {
- return name;
- }
-
- public byte getTypeID()
- {
- return typeID;
- }
-
- public boolean canBeNull()
- {
- return canBeNull;
- }
-
- public Object getDefaultValue()
- {
- return defaultValue;
- }
-
- @Override
- public String toString()
- {
- return name;
- }
-
- public final Object copyValue(Object value)
- {
- if (value == null || value == CDORevisionData.NIL)
- {
- return value;
- }
-
- return doCopyValue(value);
- }
-
- protected Object doCopyValue(Object value)
- {
- return value;
- }
-
- public void write(CDODataOutput out) throws IOException
- {
- out.writeByte(typeID);
- }
-
- final public Object adjustReferences(CDOReferenceAdjuster adjuster, Object value, EStructuralFeature feature,
- int index)
- {
- return value == null ? null : doAdjustReferences(adjuster, value, feature, index);
- }
-
- protected Object doAdjustReferences(CDOReferenceAdjuster adjuster, Object value, EStructuralFeature feature,
- int indexs)
- {
- return value;
- }
-
- /**
- * @since 2.0
- */
- public Object convertToEMF(EClassifier feature, Object value)
- {
- return value;
- }
-
- /**
- * @since 2.0
- */
- public Object convertToCDO(EClassifier feature, Object value)
- {
- return value;
- }
-
- protected void writeTypeAndValue(CDODataOutput out, Object object) throws IOException
- {
- CDOType cdoType = CDOModelUtil.getTypeOfObject(object);
- out.writeByte(cdoType.getTypeID());
- cdoType.writeValue(out, object);
- }
-
- protected Object readTypeAndValue(CDODataInput in) throws IOException
- {
- byte typeID = in.readByte();
- CDOType cdoType = CDOModelUtil.getType(typeID);
- return cdoType.readValue(in);
- }
-
- public static CDOType getType(byte typeID)
- {
- CDOTypeImpl type = ids[typeID - Byte.MIN_VALUE];
- if (type == null)
- {
- throw new IllegalStateException(MessageFormat.format(Messages.getString("CDOModelUtil.6"), typeID));
- }
-
- return type;
- }
-
- /**
- * @author Eike Stepper
- */
- private static abstract class ObjectType extends CDOTypeImpl
- {
- public ObjectType(String name, int typeID)
- {
- super(name, typeID, true);
- }
-
- public final void writeValue(CDODataOutput out, Object value) throws IOException
- {
- if (value == null)
- {
- out.writeBoolean(false);
- }
- else
- {
- out.writeBoolean(true);
- doWriteValue(out, value);
- }
- }
-
- protected abstract void doWriteValue(CDODataOutput out, Object value) throws IOException;
-
- public final Object readValue(CDODataInput in) throws IOException
- {
- boolean notNull = in.readBoolean();
- if (notNull)
- {
- return doReadValue(in);
- }
-
- return null;
- }
-
- protected abstract Object doReadValue(CDODataInput in) throws IOException;
- }
-}
+/*
+ * Copyright (c) 2004 - 2012 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 - Bug 299194: unsettable features inconsistent between revisions
+ * Erdal Karaca - added support for HASHMAP CDO Type
+ */
+package org.eclipse.emf.cdo.internal.common.model;
+
+import org.eclipse.emf.cdo.common.id.CDOID;
+import org.eclipse.emf.cdo.common.lob.CDOBlob;
+import org.eclipse.emf.cdo.common.lob.CDOClob;
+import org.eclipse.emf.cdo.common.lob.CDOLobUtil;
+import org.eclipse.emf.cdo.common.model.CDOModelUtil;
+import org.eclipse.emf.cdo.common.model.CDOType;
+import org.eclipse.emf.cdo.common.protocol.CDODataInput;
+import org.eclipse.emf.cdo.common.protocol.CDODataOutput;
+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.cdo.internal.common.messages.Messages;
+import org.eclipse.emf.cdo.spi.common.model.InternalCDOPackageRegistry;
+import org.eclipse.emf.cdo.spi.common.revision.CDOReferenceAdjuster;
+
+import org.eclipse.emf.common.util.Enumerator;
+import org.eclipse.emf.ecore.EClassifier;
+import org.eclipse.emf.ecore.EDataType;
+import org.eclipse.emf.ecore.EEnum;
+import org.eclipse.emf.ecore.EEnumLiteral;
+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 org.eclipse.emf.ecore.util.FeatureMap;
+
+import java.io.IOException;
+import java.math.BigDecimal;
+import java.math.BigInteger;
+import java.text.MessageFormat;
+import java.util.Date;
+import java.util.HashMap;
+import java.util.Map;
+import java.util.Map.Entry;
+import java.util.Set;
+
+/**
+ * @author Eike Stepper
+ */
+public abstract class CDOTypeImpl implements CDOType
+{
+ private static CDOTypeImpl[] ids = new CDOTypeImpl[Byte.MAX_VALUE - Byte.MIN_VALUE + 1];
+
+ private static final byte BOOLEAN_DEFAULT_PRIMITIVE = 0;
+
+ private static final char CHARACTER_DEFAULT_PRIMITIVE = 0;
+
+ private static final short SHORT_DEFAULT_PRIMITIVE = 0;
+
+ public static final Boolean BOOLEAN_DEFAULT = new Boolean(false);
+
+ public static final Byte BYTE_DEFAULT = new Byte(BOOLEAN_DEFAULT_PRIMITIVE);
+
+ public static final Character CHARACTER_DEFAULT = new Character(CHARACTER_DEFAULT_PRIMITIVE);
+
+ public static final Double DOUBLE_DEFAULT = new Double(0.0);
+
+ public static final Float FLOAT_DEFAULT = new Float(0.0);
+
+ public static final Integer INTEGER_DEFAULT = new Integer(0);
+
+ public static final Long LONG_DEFAULT = new Long(0L);
+
+ public static final Short SHORT_DEFAULT = new Short(SHORT_DEFAULT_PRIMITIVE);
+
+ public static final CDOType BOOLEAN = new CDOTypeImpl("BOOLEAN", EcorePackage.EBOOLEAN, false, BOOLEAN_DEFAULT) //$NON-NLS-1$
+ {
+ public void writeValue(CDODataOutput out, Object value) throws IOException
+ {
+ boolean v = (Boolean)(value == null ? getDefaultValue() : value);
+ out.writeBoolean(v);
+ }
+
+ public Boolean readValue(CDODataInput in) throws IOException
+ {
+ return in.readBoolean();
+ }
+ };
+
+ public static final CDOType BYTE = new CDOTypeImpl("BYTE", EcorePackage.EBYTE, false, BYTE_DEFAULT) //$NON-NLS-1$
+ {
+ public void writeValue(CDODataOutput out, Object value) throws IOException
+ {
+ out.writeByte((Byte)(value == null ? getDefaultValue() : value));
+ }
+
+ public Byte readValue(CDODataInput in) throws IOException
+ {
+ return in.readByte();
+ }
+ };
+
+ public static final CDOType CHAR = new CDOTypeImpl("CHAR", EcorePackage.ECHAR, false, CHARACTER_DEFAULT) //$NON-NLS-1$
+ {
+ public void writeValue(CDODataOutput out, Object value) throws IOException
+ {
+ out.writeChar(((Character)(value == null ? getDefaultValue() : value)).charValue());
+ }
+
+ public Character readValue(CDODataInput in) throws IOException
+ {
+ return in.readChar();
+ }
+ };
+
+ public static final CDOType DOUBLE = new CDOTypeImpl("DOUBLE", EcorePackage.EDOUBLE, false, DOUBLE_DEFAULT) //$NON-NLS-1$
+ {
+ public void writeValue(CDODataOutput out, Object value) throws IOException
+ {
+ out.writeDouble((Double)(value == null ? getDefaultValue() : value));
+ }
+
+ public Double readValue(CDODataInput in) throws IOException
+ {
+ return in.readDouble();
+ }
+ };
+
+ public static final CDOType FLOAT = new CDOTypeImpl("FLOAT", EcorePackage.EFLOAT, false, FLOAT_DEFAULT) //$NON-NLS-1$
+ {
+ public void writeValue(CDODataOutput out, Object value) throws IOException
+ {
+ out.writeFloat((Float)(value == null ? getDefaultValue() : value));
+ }
+
+ public Float readValue(CDODataInput in) throws IOException
+ {
+ return in.readFloat();
+ }
+ };
+
+ public static final CDOType INT = new CDOTypeImpl("INT", EcorePackage.EINT, false, INTEGER_DEFAULT) //$NON-NLS-1$
+ {
+ public void writeValue(CDODataOutput out, Object value) throws IOException
+ {
+ out.writeInt((Integer)(value == null ? getDefaultValue() : value));
+ }
+
+ public Integer readValue(CDODataInput in) throws IOException
+ {
+ return in.readInt();
+ }
+ };
+
+ public static final CDOType LONG = new CDOTypeImpl("LONG", EcorePackage.ELONG, false, LONG_DEFAULT) //$NON-NLS-1$
+ {
+ public void writeValue(CDODataOutput out, Object value) throws IOException
+ {
+ out.writeLong((Long)(value == null ? getDefaultValue() : value));
+ }
+
+ public Long readValue(CDODataInput in) throws IOException
+ {
+ return in.readLong();
+ }
+ };
+
+ public static final CDOType SHORT = new CDOTypeImpl("SHORT", EcorePackage.ESHORT, false, SHORT_DEFAULT) //$NON-NLS-1$
+ {
+ public void writeValue(CDODataOutput out, Object value) throws IOException
+ {
+ out.writeShort((Short)(value == null ? getDefaultValue() : value));
+ }
+
+ public Short readValue(CDODataInput in) throws IOException
+ {
+ return in.readShort();
+ }
+ };
+
+ public static final CDOType BIG_DECIMAL = new CDOTypeImpl("BIG_DECIMAL", EcorePackage.EBIG_DECIMAL, true) //$NON-NLS-1$
+ {
+ public void writeValue(CDODataOutput out, Object value) throws IOException
+ {
+ if (value == null)
+ {
+ out.writeByteArray(null);
+ }
+ else
+ {
+ BigDecimal bigDecimal = (BigDecimal)value;
+ out.writeByteArray(bigDecimal.unscaledValue().toByteArray());
+ out.writeInt(bigDecimal.scale());
+ }
+ }
+
+ public BigDecimal readValue(CDODataInput in) throws IOException
+ {
+ byte[] array = in.readByteArray();
+ if (array == null)
+ {
+ return null;
+ }
+
+ BigInteger unscaled = new BigInteger(array);
+ int scale = in.readInt();
+ return new BigDecimal(unscaled, scale);
+ }
+ };
+
+ public static final CDOType BIG_INTEGER = new CDOTypeImpl("BIG_INTEGER", EcorePackage.EBIG_INTEGER, true) //$NON-NLS-1$
+ {
+ public void writeValue(CDODataOutput out, Object value) throws IOException
+ {
+ if (value == null)
+ {
+ out.writeByteArray(null);
+ }
+ else
+ {
+ out.writeByteArray(((BigInteger)value).toByteArray());
+ }
+ }
+
+ public BigInteger readValue(CDODataInput in) throws IOException
+ {
+ byte[] array = in.readByteArray();
+ if (array == null)
+ {
+ return null;
+ }
+
+ return new BigInteger(array);
+ }
+ };
+
+ public static final CDOType OBJECT = new CDOTypeImpl("OBJECT", EcorePackage.EOBJECT, true, CDOID.NULL) //$NON-NLS-1$
+ {
+ public void writeValue(CDODataOutput out, Object value) throws IOException
+ {
+ if (value instanceof CDORevision)
+ {
+ out.writeCDOID(((CDORevision)value).getID());
+ }
+ else
+ {
+ out.writeCDOID((CDOID)value);
+ }
+ }
+
+ public CDOID readValue(CDODataInput in) throws IOException
+ {
+ return in.readCDOID();
+ }
+
+ @Override
+ public Object doAdjustReferences(CDOReferenceAdjuster adjuster, Object value, EStructuralFeature feature, int index)
+ {
+ return adjuster.adjustReference(value, feature, index);
+ }
+ };
+
+ public static final CDOType BOOLEAN_OBJECT = new ObjectType("BOOLEAN_OBJECT", EcorePackage.EBOOLEAN_OBJECT) //$NON-NLS-1$
+ {
+ @Override
+ protected void doWriteValue(CDODataOutput out, Object value) throws IOException
+ {
+ out.writeBoolean((Boolean)value);
+ }
+
+ @Override
+ protected Boolean doReadValue(CDODataInput in) throws IOException
+ {
+ return in.readBoolean();
+ }
+ };
+
+ public static final CDOType BYTE_OBJECT = new ObjectType("BYTE_OBJECT", EcorePackage.EBYTE_OBJECT) //$NON-NLS-1$
+ {
+ @Override
+ protected void doWriteValue(CDODataOutput out, Object value) throws IOException
+ {
+ out.writeByte((Byte)value);
+ }
+
+ @Override
+ protected Byte doReadValue(CDODataInput in) throws IOException
+ {
+ return in.readByte();
+ }
+ };
+
+ public static final CDOType CHARACTER_OBJECT = new ObjectType("CHARACTER_OBJECT", EcorePackage.ECHARACTER_OBJECT) //$NON-NLS-1$
+ {
+ @Override
+ protected void doWriteValue(CDODataOutput out, Object value) throws IOException
+ {
+ out.writeChar((Character)value);
+ }
+
+ @Override
+ protected Character doReadValue(CDODataInput in) throws IOException
+ {
+ return in.readChar();
+ }
+ };
+
+ public static final CDOType DATE = new ObjectType("DATE", EcorePackage.EDATE) //$NON-NLS-1$
+ {
+ @Override
+ protected void doWriteValue(CDODataOutput out, Object value) throws IOException
+ {
+ out.writeLong(((Date)value).getTime());
+ }
+
+ @Override
+ protected Date doReadValue(CDODataInput in) throws IOException
+ {
+ return new Date(in.readLong());
+ }
+ };
+
+ public static final CDOType DOUBLE_OBJECT = new ObjectType("DOUBLE_OBJECT", EcorePackage.EDOUBLE_OBJECT) //$NON-NLS-1$
+ {
+ @Override
+ protected void doWriteValue(CDODataOutput out, Object value) throws IOException
+ {
+ out.writeDouble((Double)value);
+ }
+
+ @Override
+ protected Double doReadValue(CDODataInput in) throws IOException
+ {
+ return in.readDouble();
+ }
+ };
+
+ public static final CDOType FLOAT_OBJECT = new ObjectType("FLOAT_OBJECT", EcorePackage.EFLOAT_OBJECT) //$NON-NLS-1$
+ {
+ @Override
+ protected void doWriteValue(CDODataOutput out, Object value) throws IOException
+ {
+ out.writeFloat((Float)value);
+ }
+
+ @Override
+ protected Float doReadValue(CDODataInput in) throws IOException
+ {
+ return in.readFloat();
+ }
+ };
+
+ public static final CDOType INTEGER_OBJECT = new ObjectType("INTEGER_OBJECT", EcorePackage.EINTEGER_OBJECT) //$NON-NLS-1$
+ {
+ @Override
+ protected void doWriteValue(CDODataOutput out, Object value) throws IOException
+ {
+ out.writeInt((Integer)value);
+ }
+
+ @Override
+ protected Integer doReadValue(CDODataInput in) throws IOException
+ {
+ return in.readInt();
+ }
+ };
+
+ public static final CDOType LONG_OBJECT = new ObjectType("LONG_OBJECT", EcorePackage.ELONG_OBJECT) //$NON-NLS-1$
+ {
+ @Override
+ protected void doWriteValue(CDODataOutput out, Object value) throws IOException
+ {
+ out.writeLong((Long)value);
+ }
+
+ @Override
+ protected Long doReadValue(CDODataInput in) throws IOException
+ {
+ return in.readLong();
+ }
+ };
+
+ public static final CDOType SHORT_OBJECT = new ObjectType("SHORT_OBJECT", EcorePackage.ESHORT_OBJECT) //$NON-NLS-1$
+ {
+ @Override
+ protected void doWriteValue(CDODataOutput out, Object value) throws IOException
+ {
+ out.writeShort((Short)value);
+ }
+
+ @Override
+ protected Short doReadValue(CDODataInput in) throws IOException
+ {
+ return in.readShort();
+ }
+ };
+
+ public static final CDOType STRING = new CDOTypeImpl("STRING", EcorePackage.ESTRING, true) //$NON-NLS-1$
+ {
+ @Override
+ protected String doCopyValue(Object value)
+ {
+ return (String)value;
+ }
+
+ public void writeValue(CDODataOutput out, Object value) throws IOException
+ {
+ out.writeString((String)value);
+ }
+
+ public String readValue(CDODataInput in) throws IOException
+ {
+ return in.readString();
+ }
+ };
+
+ public static final CDOType BYTE_ARRAY = new CDOTypeImpl("BYTE_ARRAY", EcorePackage.EBYTE_ARRAY, true) //$NON-NLS-1$
+ {
+ @Override
+ protected byte[] doCopyValue(Object value)
+ {
+ byte[] array = (byte[])value;
+ byte[] result = new byte[array.length];
+ System.arraycopy(value, 0, result, 0, array.length);
+ return result;
+ }
+
+ public void writeValue(CDODataOutput out, Object value) throws IOException
+ {
+ out.writeByteArray((byte[])value);
+ }
+
+ public byte[] readValue(CDODataInput in) throws IOException
+ {
+ return in.readByteArray();
+ }
+ };
+
+ public static final CDOType FEATURE_MAP_ENTRY = new CDOTypeImpl("FEATURE_MAP_ENTRY", EcorePackage.EFEATURE_MAP_ENTRY, //$NON-NLS-1$
+ false)
+ {
+ @Override
+ protected FeatureMap.Entry doCopyValue(Object value)
+ {
+ FeatureMap.Entry entry = (FeatureMap.Entry)value;
+ EStructuralFeature innerFeature = entry.getEStructuralFeature();
+ Object innerValue = entry.getValue();
+ CDOType innerType = CDOModelUtil.getType(innerFeature.getEType());
+
+ Object innerCopy = innerType.copyValue(innerValue);
+ return CDORevisionUtil.createFeatureMapEntry(innerFeature, innerCopy);
+ }
+
+ public void writeValue(CDODataOutput out, Object value) throws IOException
+ {
+ throw new UnsupportedOperationException();
+ }
+
+ public FeatureMap.Entry readValue(CDODataInput in) throws IOException
+ {
+ throw new UnsupportedOperationException();
+ }
+
+ @Override
+ public Object doAdjustReferences(CDOReferenceAdjuster adjuster, Object value, EStructuralFeature feature, int index)
+ {
+ FeatureMap.Entry entry = (FeatureMap.Entry)value;
+ EStructuralFeature innerFeature = entry.getEStructuralFeature();
+ Object innerValue = entry.getValue();
+ CDOType innerType = CDOModelUtil.getType(innerFeature.getEType());
+
+ Object innerCopy = innerType.adjustReferences(adjuster, innerValue, feature, index);
+ if (innerCopy != innerValue) // Just an optimization for NOOP adjusters
+ {
+ value = CDORevisionUtil.createFeatureMapEntry(innerFeature, innerCopy);
+ }
+
+ return value;
+ }
+ };
+
+ public static final CDOType CUSTOM = new CDOTypeImpl("CUSTOM", 0, true) //$NON-NLS-1$
+ {
+ @Override
+ protected String doCopyValue(Object value)
+ {
+ return (String)value;
+ }
+
+ public void writeValue(CDODataOutput out, Object value) throws IOException
+ {
+ out.writeString((String)value);
+ }
+
+ public String readValue(CDODataInput in) throws IOException
+ {
+ return in.readString();
+ }
+
+ @Override
+ public Object convertToEMF(EClassifier eType, Object value)
+ {
+ return EcoreUtil.createFromString((EDataType)eType, (String)value);
+ }
+
+ @Override
+ public Object convertToCDO(EClassifier eType, Object value)
+ {
+ return EcoreUtil.convertToString((EDataType)eType, value);
+ }
+ };
+
+ /**
+ * TODO Transfer integers!
+ */
+ public static final CDOType ENUM_ORDINAL = new ObjectType("ENUM_ORDINAL", -1) //$NON-NLS-1$
+ {
+ @Override
+ protected Integer doCopyValue(Object value)
+ {
+ return (Integer)value;
+ }
+
+ @Override
+ public void doWriteValue(CDODataOutput out, Object value) throws IOException
+ {
+ out.writeInt((Integer)value);
+ }
+
+ @Override
+ public Integer doReadValue(CDODataInput in) throws IOException
+ {
+ return in.readInt();
+ }
+
+ @Override
+ public Object convertToCDO(EClassifier type, Object value)
+ {
+ for (EEnumLiteral literal : ((EEnum)type).getELiterals())
+ {
+ if (literal == value || literal.getInstance() == value)
+ {
+ return literal.getValue();
+ }
+ }
+
+ throw new IllegalStateException(MessageFormat.format(Messages.getString("CDOTypeImpl.23"), value)); //$NON-NLS-1$
+ }
+
+ @Override
+ public Object convertToEMF(EClassifier type, Object value)
+ {
+ return ((EEnum)type).getEEnumLiteral((Integer)value).getInstance();
+ }
+ };
+
+ public static final CDOType ENUM_LITERAL = new ObjectType("ENUM_LITERAL", -2) //$NON-NLS-1$
+ {
+ @Override
+ protected void doWriteValue(CDODataOutput out, Object value) throws IOException
+ {
+ EEnum eEnum;
+ if (value instanceof EEnumLiteral)
+ {
+ eEnum = ((EEnumLiteral)value).getEEnum();
+ }
+ else
+ {
+ eEnum = findEnum((InternalCDOPackageRegistry)out.getPackageRegistry(), value);
+ }
+
+ out.writeCDOClassifierRef(eEnum);
+ out.writeInt(((Enumerator)value).getValue());
+ }
+
+ @Override
+ protected Object doReadValue(CDODataInput in) throws IOException
+ {
+ EEnum eEnum = (EEnum)in.readCDOClassifierRefAndResolve();
+ int ordinal = in.readInt();
+
+ EEnumLiteral literal = eEnum.getEEnumLiteral(ordinal);
+ if (literal == null)
+ {
+ throw new IllegalArgumentException("Enum literal " + ordinal + " not found in " + eEnum);
+ }
+
+ return literal.getInstance();
+ }
+
+ private EEnum findEnum(InternalCDOPackageRegistry registry, Object value)
+ {
+ Set<String> keys = registry.getAllKeys();
+
+ // First try all the packages that are already resolved
+ for (String nsURI : keys)
+ {
+ Object possiblePackage = registry.getWithDelegation(nsURI, false);
+ if (possiblePackage instanceof EPackage)
+ {
+ EPackage ePackage = (EPackage)possiblePackage;
+ EEnum eEnum = findEnum(ePackage, value);
+ if (eEnum != null)
+ {
+ return eEnum;
+ }
+ }
+ }
+
+ // Then try all the package descriptors
+ for (String nsURI : keys)
+ {
+ Object possiblePackage = registry.getWithDelegation(nsURI, false);
+ if (possiblePackage instanceof EPackage.Descriptor)
+ {
+ EPackage ePackage = registry.getEPackage(nsURI);
+ EEnum eEnum = findEnum(ePackage, value);
+ if (eEnum != null)
+ {
+ return eEnum;
+ }
+ }
+ }
+
+ throw new IllegalArgumentException("EENum instance " + value.getClass().getName() + " not supported");
+ }
+
+ private EEnum findEnum(EPackage ePackage, Object value)
+ {
+ for (EClassifier eClassifier : ePackage.getEClassifiers())
+ {
+ if (eClassifier instanceof EEnum)
+ {
+ EEnum eEnum = (EEnum)eClassifier;
+ if (eEnum.getInstanceClass() != null && eEnum.getInstanceClass() == value.getClass())
+ {
+ return eEnum;
+ }
+ }
+ }
+
+ return null;
+ }
+ };
+
+ public static final CDOType BLOB = new CDOTypeImpl("BLOB", -3, true) //$NON-NLS-1$
+ {
+ public CDOBlob readValue(CDODataInput in) throws IOException
+ {
+ if (in.readBoolean())
+ {
+ return CDOLobUtil.readBlob(in);
+ }
+
+ return null;
+ }
+
+ public void writeValue(CDODataOutput out, Object value) throws IOException
+ {
+ if (value != null)
+ {
+ out.writeBoolean(true);
+ CDOLobUtil.write(out, (CDOBlob)value);
+ }
+ else
+ {
+ out.writeBoolean(false);
+ }
+ }
+ };
+
+ public static final CDOType CLOB = new CDOTypeImpl("CLOB", -4, true) //$NON-NLS-1$
+ {
+ public CDOClob readValue(CDODataInput in) throws IOException
+ {
+ if (in.readBoolean())
+ {
+ return CDOLobUtil.readClob(in);
+ }
+
+ return null;
+ }
+
+ public void writeValue(CDODataOutput out, Object value) throws IOException
+ {
+ if (value != null)
+ {
+ out.writeBoolean(true);
+ CDOLobUtil.write(out, (CDOClob)value);
+ }
+ else
+ {
+ out.writeBoolean(false);
+ }
+ }
+ };
+
+ public static final CDOType OBJECT_ARRAY = new ObjectType("OBJECT_ARRAY", -5) //$NON-NLS-1$
+ {
+ @Override
+ protected void doWriteValue(CDODataOutput out, Object value) throws IOException
+ {
+ Object[] objects = (Object[])value;
+ out.writeInt(objects.length);
+ for (Object object : objects)
+ {
+ writeTypeAndValue(out, object);
+ }
+ }
+
+ @Override
+ protected Object[] doReadValue(CDODataInput in) throws IOException
+ {
+ int size = in.readInt();
+ Object[] objects = new Object[size];
+ for (int i = 0; i < size; i++)
+ {
+ objects[i] = readTypeAndValue(in);
+ }
+
+ return objects;
+ }
+
+ @Override
+ public Object doAdjustReferences(CDOReferenceAdjuster adjuster, Object value, EStructuralFeature feature, int index)
+ {
+ Object[] objects = (Object[])value;
+ int i = 0;
+ for (Object object : objects)
+ {
+ if (object instanceof CDOID)
+ {
+ objects[i] = adjuster.adjustReference(object, feature, i);
+ }
+ else
+ {
+ objects[i] = object;
+ }
+
+ ++i;
+ }
+
+ return objects;
+ }
+ };
+
+ public static final CDOType MAP = new ObjectType("MAP", -6) //$NON-NLS-1$
+ {
+ @SuppressWarnings("unchecked")
+ @Override
+ protected void doWriteValue(CDODataOutput out, Object value) throws IOException
+ {
+ Map<Object, Object> map = (Map<Object, Object>)value;
+ out.writeInt(map.size());
+
+ for (Entry<Object, Object> entry : map.entrySet())
+ {
+ writeTypeAndValue(out, entry.getKey());
+ writeTypeAndValue(out, entry.getValue());
+ }
+ }
+
+ @Override
+ protected Map<Object, Object> doReadValue(CDODataInput in) throws IOException
+ {
+ Map<Object, Object> result = new HashMap<Object, Object>();
+ int size = in.readInt();
+ for (int i = 0; i < size; i++)
+ {
+ Object key = readTypeAndValue(in);
+ Object value = readTypeAndValue(in);
+ result.put(key, value == CDOID.NULL ? null : value);
+ }
+
+ return result;
+ }
+ };
+
+ private String name;
+
+ private byte typeID;
+
+ private boolean canBeNull;
+
+ private Object defaultValue;
+
+ private CDOTypeImpl(String name, int typeID, boolean canBeNull, Object defaultValue)
+ {
+ ids[typeID - Byte.MIN_VALUE] = this;
+
+ this.name = name;
+ this.typeID = (byte)typeID;
+ this.canBeNull = canBeNull;
+ this.defaultValue = defaultValue;
+ }
+
+ private CDOTypeImpl(String name, int typeID, boolean canBeNull)
+ {
+ this(name, typeID, canBeNull, null);
+ }
+
+ public String getName()
+ {
+ return name;
+ }
+
+ public byte getTypeID()
+ {
+ return typeID;
+ }
+
+ public boolean canBeNull()
+ {
+ return canBeNull;
+ }
+
+ public Object getDefaultValue()
+ {
+ return defaultValue;
+ }
+
+ @Override
+ public String toString()
+ {
+ return name;
+ }
+
+ public final Object copyValue(Object value)
+ {
+ if (value == null || value == CDORevisionData.NIL)
+ {
+ return value;
+ }
+
+ return doCopyValue(value);
+ }
+
+ protected Object doCopyValue(Object value)
+ {
+ return value;
+ }
+
+ public void write(CDODataOutput out) throws IOException
+ {
+ out.writeByte(typeID);
+ }
+
+ final public Object adjustReferences(CDOReferenceAdjuster adjuster, Object value, EStructuralFeature feature,
+ int index)
+ {
+ return value == null ? null : doAdjustReferences(adjuster, value, feature, index);
+ }
+
+ protected Object doAdjustReferences(CDOReferenceAdjuster adjuster, Object value, EStructuralFeature feature,
+ int indexs)
+ {
+ return value;
+ }
+
+ /**
+ * @since 2.0
+ */
+ public Object convertToEMF(EClassifier feature, Object value)
+ {
+ return value;
+ }
+
+ /**
+ * @since 2.0
+ */
+ public Object convertToCDO(EClassifier feature, Object value)
+ {
+ return value;
+ }
+
+ protected void writeTypeAndValue(CDODataOutput out, Object object) throws IOException
+ {
+ CDOType cdoType = CDOModelUtil.getTypeOfObject(object);
+ out.writeByte(cdoType.getTypeID());
+ cdoType.writeValue(out, object);
+ }
+
+ protected Object readTypeAndValue(CDODataInput in) throws IOException
+ {
+ byte typeID = in.readByte();
+ CDOType cdoType = CDOModelUtil.getType(typeID);
+ return cdoType.readValue(in);
+ }
+
+ public static CDOType getType(byte typeID)
+ {
+ CDOTypeImpl type = ids[typeID - Byte.MIN_VALUE];
+ if (type == null)
+ {
+ throw new IllegalStateException(MessageFormat.format(Messages.getString("CDOModelUtil.6"), typeID));
+ }
+
+ return type;
+ }
+
+ /**
+ * @author Eike Stepper
+ */
+ private static abstract class ObjectType extends CDOTypeImpl
+ {
+ public ObjectType(String name, int typeID)
+ {
+ super(name, typeID, true);
+ }
+
+ public final void writeValue(CDODataOutput out, Object value) throws IOException
+ {
+ if (value == null)
+ {
+ out.writeBoolean(false);
+ }
+ else
+ {
+ out.writeBoolean(true);
+ doWriteValue(out, value);
+ }
+ }
+
+ protected abstract void doWriteValue(CDODataOutput out, Object value) throws IOException;
+
+ public final Object readValue(CDODataInput in) throws IOException
+ {
+ boolean notNull = in.readBoolean();
+ if (notNull)
+ {
+ return doReadValue(in);
+ }
+
+ return null;
+ }
+
+ protected abstract Object doReadValue(CDODataInput in) throws IOException;
+ }
+}
diff --git a/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/internal/common/model/GenUtil.java b/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/internal/common/model/GenUtil.java
index b407d25fec..14794fe6b5 100644
--- a/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/internal/common/model/GenUtil.java
+++ b/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/internal/common/model/GenUtil.java
@@ -1,213 +1,213 @@
-/*
- * Copyright (c) 2004 - 2011 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.StringUtil;
-
-import org.eclipse.emf.ecore.EClassifier;
-
-import java.util.ArrayList;
-import java.util.Iterator;
-import java.util.List;
-
-/**
- * @author Eike Stepper
- */
-public final class GenUtil
-{
- private GenUtil()
- {
- }
-
- /**
- * See GenGenBaseImpl.isPrimitiveType
- */
- public static boolean isPrimitiveType(EClassifier eType)
- {
- try
- {
- // J9 2.2 has problems assigning null to a Class variable.
- Object result = eType.getInstanceClass();
- if (result == null)
- {
- return false;
- }
-
- Class<?> instanceClass = (Class<?>)result;
- return instanceClass.isPrimitive();
- }
- catch (Exception e)
- {
- return false;
- }
- }
-
- /**
- * See GenFeatureImpl.getUpperName
- */
- public static String getFeatureUpperName(String featureName)
- {
- return format(featureName, '_', null, false, true).toUpperCase();
- }
-
- /**
- * See GenFeatureImpl.getGetAccessor
- */
- public static String getFeatureGetterName(String featureName, boolean isBooleanType)
- {
- String capName = StringUtil.cap(featureName);
- // if (isMapEntryFeature())
- // return "getTyped" + capName;
- String result = isBooleanType ? "is" + capName : "get" + ("Class".equals(capName) ? "Class_" : capName); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
-
- // if (isListType() && !isFeatureMapType() && !isMapType() &&
- // getGenModel().isArrayAccessors())
- // {
- // result += "List";
- // }
-
- // GenClass rootImplementsInterface =
- // getGenModel().getRootImplementsInterfaceGenClass();
- // GenClass context = getContext();
- // if (rootImplementsInterface != null &&
- // !rootImplementsInterface.isEObject())
- // {
- // for (GenOperation genOperation :
- // rootImplementsInterface.getAllGenOperations())
- // {
- // if (genOperation.getName().equals(result) &&
- // genOperation.getGenParameters().isEmpty() &&
- // !genOperation.getType(context).equals(getType(context)))
- // {
- // result = result + "_";
- // break;
- // }
- // }
- // }
-
- return result;
- }
-
- /**
- * Formats a name by parsing it into words separated by underscores and/or mixed-casing and then recombining them
- * using the specified separator. A prefix can also be given to be recognized as a separate word or to be trimmed.
- * Leading underscores can be ignored or can cause a leading separator to be prepended.
- */
- public static String format(String name, char separator, String prefix, boolean includePrefix,
- boolean includeLeadingSeparator)
- {
- String leadingSeparators = includeLeadingSeparator ? getLeadingSeparators(name, '_') : null;
- if (leadingSeparators != null)
- {
- name = name.substring(leadingSeparators.length());
- }
-
- List<String> parsedName = new ArrayList<String>();
- if (prefix != null && name.startsWith(prefix) && name.length() > prefix.length()
- && Character.isUpperCase(name.charAt(prefix.length())))
- {
- name = name.substring(prefix.length());
- if (includePrefix)
- {
- parsedName = parseName(prefix, '_');
- }
- }
-
- if (name.length() != 0)
- {
- parsedName.addAll(parseName(name, '_'));
- }
-
- StringBuilder result = new StringBuilder();
-
- for (Iterator<String> nameIter = parsedName.iterator(); nameIter.hasNext();)
- {
- String nameComponent = nameIter.next();
- result.append(nameComponent);
-
- if (nameIter.hasNext() && nameComponent.length() > 1)
- {
- result.append(separator);
- }
- }
-
- if (result.length() == 0 && prefix != null)
- {
- result.append(prefix);
- }
-
- return leadingSeparators != null ? "_" + result.toString() : result.toString(); //$NON-NLS-1$
- }
-
- /**
- * This method breaks sourceName into words delimited by separator and/or mixed-case naming.
- */
- public static List<String> parseName(String sourceName, char separator)
- {
- List<String> result = new ArrayList<String>();
- if (sourceName != null)
- {
- StringBuilder currentWord = new StringBuilder();
- boolean lastIsLower = false;
- for (int index = 0, length = sourceName.length(); index < length; ++index)
- {
- char curChar = sourceName.charAt(index);
- if (Character.isUpperCase(curChar) || !lastIsLower && Character.isDigit(curChar) || curChar == separator)
- {
- if (lastIsLower && currentWord.length() > 1 || curChar == separator && currentWord.length() > 0)
- {
- result.add(currentWord.toString());
- currentWord = new StringBuilder();
- }
-
- lastIsLower = false;
- }
- else
- {
- if (!lastIsLower)
- {
- int currentWordLength = currentWord.length();
- if (currentWordLength > 1)
- {
- char lastChar = currentWord.charAt(--currentWordLength);
- currentWord.setLength(currentWordLength);
- result.add(currentWord.toString());
- currentWord = new StringBuilder();
- currentWord.append(lastChar);
- }
- }
-
- lastIsLower = true;
- }
-
- if (curChar != separator)
- {
- currentWord.append(curChar);
- }
- }
-
- result.add(currentWord.toString());
- }
-
- return result;
- }
-
- private static String getLeadingSeparators(String name, char separator)
- {
- int i = 0;
- for (int len = name.length(); i < len && name.charAt(i) == separator; i++)
- {
- // the for loop's condition finds the separator
- }
-
- return i != 0 ? name.substring(0, i) : null;
- }
-}
+/*
+ * Copyright (c) 2004 - 2012 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.StringUtil;
+
+import org.eclipse.emf.ecore.EClassifier;
+
+import java.util.ArrayList;
+import java.util.Iterator;
+import java.util.List;
+
+/**
+ * @author Eike Stepper
+ */
+public final class GenUtil
+{
+ private GenUtil()
+ {
+ }
+
+ /**
+ * See GenGenBaseImpl.isPrimitiveType
+ */
+ public static boolean isPrimitiveType(EClassifier eType)
+ {
+ try
+ {
+ // J9 2.2 has problems assigning null to a Class variable.
+ Object result = eType.getInstanceClass();
+ if (result == null)
+ {
+ return false;
+ }
+
+ Class<?> instanceClass = (Class<?>)result;
+ return instanceClass.isPrimitive();
+ }
+ catch (Exception e)
+ {
+ return false;
+ }
+ }
+
+ /**
+ * See GenFeatureImpl.getUpperName
+ */
+ public static String getFeatureUpperName(String featureName)
+ {
+ return format(featureName, '_', null, false, true).toUpperCase();
+ }
+
+ /**
+ * See GenFeatureImpl.getGetAccessor
+ */
+ public static String getFeatureGetterName(String featureName, boolean isBooleanType)
+ {
+ String capName = StringUtil.cap(featureName);
+ // if (isMapEntryFeature())
+ // return "getTyped" + capName;
+ String result = isBooleanType ? "is" + capName : "get" + ("Class".equals(capName) ? "Class_" : capName); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
+
+ // if (isListType() && !isFeatureMapType() && !isMapType() &&
+ // getGenModel().isArrayAccessors())
+ // {
+ // result += "List";
+ // }
+
+ // GenClass rootImplementsInterface =
+ // getGenModel().getRootImplementsInterfaceGenClass();
+ // GenClass context = getContext();
+ // if (rootImplementsInterface != null &&
+ // !rootImplementsInterface.isEObject())
+ // {
+ // for (GenOperation genOperation :
+ // rootImplementsInterface.getAllGenOperations())
+ // {
+ // if (genOperation.getName().equals(result) &&
+ // genOperation.getGenParameters().isEmpty() &&
+ // !genOperation.getType(context).equals(getType(context)))
+ // {
+ // result = result + "_";
+ // break;
+ // }
+ // }
+ // }
+
+ return result;
+ }
+
+ /**
+ * Formats a name by parsing it into words separated by underscores and/or mixed-casing and then recombining them
+ * using the specified separator. A prefix can also be given to be recognized as a separate word or to be trimmed.
+ * Leading underscores can be ignored or can cause a leading separator to be prepended.
+ */
+ public static String format(String name, char separator, String prefix, boolean includePrefix,
+ boolean includeLeadingSeparator)
+ {
+ String leadingSeparators = includeLeadingSeparator ? getLeadingSeparators(name, '_') : null;
+ if (leadingSeparators != null)
+ {
+ name = name.substring(leadingSeparators.length());
+ }
+
+ List<String> parsedName = new ArrayList<String>();
+ if (prefix != null && name.startsWith(prefix) && name.length() > prefix.length()
+ && Character.isUpperCase(name.charAt(prefix.length())))
+ {
+ name = name.substring(prefix.length());
+ if (includePrefix)
+ {
+ parsedName = parseName(prefix, '_');
+ }
+ }
+
+ if (name.length() != 0)
+ {
+ parsedName.addAll(parseName(name, '_'));
+ }
+
+ StringBuilder result = new StringBuilder();
+
+ for (Iterator<String> nameIter = parsedName.iterator(); nameIter.hasNext();)
+ {
+ String nameComponent = nameIter.next();
+ result.append(nameComponent);
+
+ if (nameIter.hasNext() && nameComponent.length() > 1)
+ {
+ result.append(separator);
+ }
+ }
+
+ if (result.length() == 0 && prefix != null)
+ {
+ result.append(prefix);
+ }
+
+ return leadingSeparators != null ? "_" + result.toString() : result.toString(); //$NON-NLS-1$
+ }
+
+ /**
+ * This method breaks sourceName into words delimited by separator and/or mixed-case naming.
+ */
+ public static List<String> parseName(String sourceName, char separator)
+ {
+ List<String> result = new ArrayList<String>();
+ if (sourceName != null)
+ {
+ StringBuilder currentWord = new StringBuilder();
+ boolean lastIsLower = false;
+ for (int index = 0, length = sourceName.length(); index < length; ++index)
+ {
+ char curChar = sourceName.charAt(index);
+ if (Character.isUpperCase(curChar) || !lastIsLower && Character.isDigit(curChar) || curChar == separator)
+ {
+ if (lastIsLower && currentWord.length() > 1 || curChar == separator && currentWord.length() > 0)
+ {
+ result.add(currentWord.toString());
+ currentWord = new StringBuilder();
+ }
+
+ lastIsLower = false;
+ }
+ else
+ {
+ if (!lastIsLower)
+ {
+ int currentWordLength = currentWord.length();
+ if (currentWordLength > 1)
+ {
+ char lastChar = currentWord.charAt(--currentWordLength);
+ currentWord.setLength(currentWordLength);
+ result.add(currentWord.toString());
+ currentWord = new StringBuilder();
+ currentWord.append(lastChar);
+ }
+ }
+
+ lastIsLower = true;
+ }
+
+ if (curChar != separator)
+ {
+ currentWord.append(curChar);
+ }
+ }
+
+ result.add(currentWord.toString());
+ }
+
+ return result;
+ }
+
+ private static String getLeadingSeparators(String name, char separator)
+ {
+ int i = 0;
+ for (int len = name.length(); i < len && name.charAt(i) == separator; i++)
+ {
+ // the for loop's condition finds the separator
+ }
+
+ return i != 0 ? name.substring(0, i) : null;
+ }
+}
diff --git a/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/internal/common/protocol/CDODataInputImpl.java b/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/internal/common/protocol/CDODataInputImpl.java
index c37dd98f69..9013a9485b 100644
--- a/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/internal/common/protocol/CDODataInputImpl.java
+++ b/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/internal/common/protocol/CDODataInputImpl.java
@@ -1,651 +1,651 @@
-/*
- * Copyright (c) 2004 - 2011 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 - bug 213402
- */
-package org.eclipse.emf.cdo.internal.common.protocol;
-
-import org.eclipse.emf.cdo.common.branch.CDOBranch;
-import org.eclipse.emf.cdo.common.branch.CDOBranchManager;
-import org.eclipse.emf.cdo.common.branch.CDOBranchPoint;
-import org.eclipse.emf.cdo.common.branch.CDOBranchVersion;
-import org.eclipse.emf.cdo.common.commit.CDOChangeSetData;
-import org.eclipse.emf.cdo.common.commit.CDOCommitData;
-import org.eclipse.emf.cdo.common.commit.CDOCommitInfo;
-import org.eclipse.emf.cdo.common.commit.CDOCommitInfoManager;
-import org.eclipse.emf.cdo.common.id.CDOID;
-import org.eclipse.emf.cdo.common.id.CDOID.Type;
-import org.eclipse.emf.cdo.common.id.CDOIDReference;
-import org.eclipse.emf.cdo.common.id.CDOIDUtil;
-import org.eclipse.emf.cdo.common.lob.CDOLob;
-import org.eclipse.emf.cdo.common.lob.CDOLobStore;
-import org.eclipse.emf.cdo.common.lob.CDOLobUtil;
-import org.eclipse.emf.cdo.common.lock.CDOLockChangeInfo;
-import org.eclipse.emf.cdo.common.lock.CDOLockChangeInfo.Operation;
-import org.eclipse.emf.cdo.common.lock.CDOLockOwner;
-import org.eclipse.emf.cdo.common.lock.CDOLockState;
-import org.eclipse.emf.cdo.common.lock.CDOLockUtil;
-import org.eclipse.emf.cdo.common.lock.IDurableLockingManager.LockArea;
-import org.eclipse.emf.cdo.common.lock.IDurableLockingManager.LockGrade;
-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.CDOPackageRegistry;
-import org.eclipse.emf.cdo.common.model.CDOPackageUnit;
-import org.eclipse.emf.cdo.common.model.CDOType;
-import org.eclipse.emf.cdo.common.protocol.CDODataInput;
-import org.eclipse.emf.cdo.common.revision.CDOIDAndBranch;
-import org.eclipse.emf.cdo.common.revision.CDOIDAndVersion;
-import org.eclipse.emf.cdo.common.revision.CDOList;
-import org.eclipse.emf.cdo.common.revision.CDOListFactory;
-import org.eclipse.emf.cdo.common.revision.CDORevisable;
-import org.eclipse.emf.cdo.common.revision.CDORevision;
-import org.eclipse.emf.cdo.common.revision.CDORevisionFactory;
-import org.eclipse.emf.cdo.common.revision.CDORevisionKey;
-import org.eclipse.emf.cdo.common.revision.CDORevisionUtil;
-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.commit.CDOChangeSetDataImpl;
-import org.eclipse.emf.cdo.internal.common.commit.CDOCommitDataImpl;
-import org.eclipse.emf.cdo.internal.common.commit.FailureCommitInfo;
-import org.eclipse.emf.cdo.internal.common.id.CDOIDExternalImpl;
-import org.eclipse.emf.cdo.internal.common.id.CDOIDObjectLongImpl;
-import org.eclipse.emf.cdo.internal.common.id.CDOIDTempObjectExternalImpl;
-import org.eclipse.emf.cdo.internal.common.id.CDOIDTempObjectImpl;
-import org.eclipse.emf.cdo.internal.common.lock.CDOLockAreaImpl;
-import org.eclipse.emf.cdo.internal.common.lock.CDOLockChangeInfoImpl;
-import org.eclipse.emf.cdo.internal.common.lock.CDOLockOwnerImpl;
-import org.eclipse.emf.cdo.internal.common.lock.CDOLockStateImpl;
-import org.eclipse.emf.cdo.internal.common.messages.Messages;
-import org.eclipse.emf.cdo.internal.common.revision.CDOIDAndBranchImpl;
-import org.eclipse.emf.cdo.internal.common.revision.CDOIDAndVersionImpl;
-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;
-import org.eclipse.emf.cdo.internal.common.revision.delta.CDOListFeatureDeltaImpl;
-import org.eclipse.emf.cdo.internal.common.revision.delta.CDOMoveFeatureDeltaImpl;
-import org.eclipse.emf.cdo.internal.common.revision.delta.CDORemoveFeatureDeltaImpl;
-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.commit.InternalCDOCommitInfoManager;
-import org.eclipse.emf.cdo.spi.common.id.AbstractCDOID;
-import org.eclipse.emf.cdo.spi.common.lock.InternalCDOLockState;
-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.concurrent.IRWLockManager.LockType;
-import org.eclipse.net4j.util.io.ExtendedDataInput;
-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 org.eclipse.emf.ecore.resource.ResourceSet;
-import org.eclipse.emf.ecore.resource.impl.ResourceSetImpl;
-import org.eclipse.emf.ecore.util.FeatureMapUtil;
-
-import java.io.IOException;
-import java.text.MessageFormat;
-import java.util.ArrayList;
-import java.util.HashMap;
-import java.util.List;
-import java.util.Map;
-
-/**
- * @author Eike Stepper
- */
-public abstract class CDODataInputImpl extends ExtendedDataInput.Delegating implements CDODataInput
-{
- private static final ContextTracer TRACER = new ContextTracer(OM.DEBUG_PROTOCOL, CDODataInputImpl.class);
-
- public CDODataInputImpl(ExtendedDataInput delegate)
- {
- super(delegate);
- }
-
- public CDOPackageUnit readCDOPackageUnit(ResourceSet resourceSet) throws IOException
- {
- InternalCDOPackageUnit packageUnit = (InternalCDOPackageUnit)CDOModelUtil.createPackageUnit();
- packageUnit.read(this, resourceSet);
- return packageUnit;
- }
-
- public CDOPackageUnit[] readCDOPackageUnits(ResourceSet resourceSet) throws IOException
- {
- int size = readInt();
- if (TRACER.isEnabled())
- {
- TRACER.format("Reading {0} package units", size); //$NON-NLS-1$
- }
-
- CDOPackageUnit[] packageUnits = new CDOPackageUnit[size];
- for (int i = 0; i < size; i++)
- {
- packageUnits[i] = readCDOPackageUnit(resourceSet);
- }
-
- return packageUnits;
- }
-
- public CDOPackageUnit.Type readCDOPackageUnitType() throws IOException
- {
- return CDOPackageUnit.Type.values()[readByte()];
- }
-
- public CDOPackageInfo readCDOPackageInfo() throws IOException
- {
- InternalCDOPackageInfo packageInfo = (InternalCDOPackageInfo)CDOModelUtil.createPackageInfo();
- packageInfo.read(this);
- return packageInfo;
- }
-
- public String readCDOPackageURI() throws IOException
- {
- return getPackageURICompressor().read(this);
- }
-
- public CDOClassifierRef readCDOClassifierRef() throws IOException
- {
- return new CDOClassifierRef(this);
- }
-
- public EClassifier readCDOClassifierRefAndResolve() throws IOException
- {
- CDOClassifierRef classifierRef = readCDOClassifierRef();
- EClassifier classifier = classifierRef.resolve(getPackageRegistry());
- if (classifier == null)
- {
- throw new IOException("Unable to resolve " + classifierRef);
- }
-
- return classifier;
- }
-
- public CDOType readCDOType() throws IOException
- {
- byte typeID = readByte();
- return CDOModelUtil.getType(typeID);
- }
-
- public CDOBranch readCDOBranch() throws IOException
- {
- int branchID = readInt();
- return getBranchManager().getBranch(branchID);
- }
-
- public CDOBranchPoint readCDOBranchPoint() throws IOException
- {
- CDOBranch branch = readCDOBranch();
- long timeStamp = readLong();
- return branch.getPoint(timeStamp);
- }
-
- public CDOBranchVersion readCDOBranchVersion() throws IOException
- {
- CDOBranch branch = readCDOBranch();
- int version = readInt();
- return branch.getVersion(version);
- }
-
- public CDOChangeSetData readCDOChangeSetData() throws IOException
- {
- int size1 = readInt();
- List<CDOIDAndVersion> newObjects = new ArrayList<CDOIDAndVersion>(size1);
- for (int i = 0; i < size1; i++)
- {
- boolean revision = readBoolean();
- CDOIDAndVersion data = revision ? readCDORevision() : readCDOIDAndVersion();
- newObjects.add(data);
- }
-
- int size2 = readInt();
- List<CDORevisionKey> changedObjects = new ArrayList<CDORevisionKey>(size2);
- for (int i = 0; i < size2; i++)
- {
- boolean delta = readBoolean();
- CDORevisionKey data = delta ? readCDORevisionDelta() : readCDORevisionKey();
- changedObjects.add(data);
- }
-
- int size3 = readInt();
- List<CDOIDAndVersion> detachedObjects = new ArrayList<CDOIDAndVersion>(size3);
- for (int i = 0; i < size3; i++)
- {
- CDOIDAndVersion data = readCDOIDAndVersion();
- detachedObjects.add(data);
- }
-
- return new CDOChangeSetDataImpl(newObjects, changedObjects, detachedObjects);
- }
-
- public CDOCommitData readCDOCommitData() throws IOException
- {
- InternalCDOPackageRegistry packageRegistry = (InternalCDOPackageRegistry)getPackageRegistry();
- ResourceSet resourceSet = new ResourceSetImpl();
- resourceSet.setPackageRegistry(packageRegistry);
-
- int size = readInt();
- List<CDOPackageUnit> newPackageUnits = new ArrayList<CDOPackageUnit>(size);
- for (int i = 0; i < size; i++)
- {
- CDOPackageUnit data = readCDOPackageUnit(resourceSet);
- newPackageUnits.add(data);
- packageRegistry.putPackageUnit((InternalCDOPackageUnit)data);
- }
-
- CDOChangeSetData data = readCDOChangeSetData();
- return new CDOCommitDataImpl(newPackageUnits, data.getNewObjects(), data.getChangedObjects(),
- data.getDetachedObjects());
- }
-
- public CDOCommitInfo readCDOCommitInfo() throws IOException
- {
- long timeStamp = readLong();
- long previousTimeStamp = readLong();
-
- if (readBoolean())
- {
- CDOBranch branch = readCDOBranch();
- String userID = readString();
- String comment = readString();
- CDOCommitData commitData = readCDOCommitData();
-
- InternalCDOCommitInfoManager commitInfoManager = (InternalCDOCommitInfoManager)getCommitInfoManager();
- return commitInfoManager.createCommitInfo(branch, timeStamp, previousTimeStamp, userID, comment, commitData);
- }
-
- return new FailureCommitInfo(timeStamp, previousTimeStamp);
- }
-
- public CDOLockChangeInfo readCDOLockChangeInfo() throws IOException
- {
- boolean isInvalidateAll = readBoolean();
- if (isInvalidateAll)
- {
- return CDOLockUtil.createLockChangeInfo();
- }
-
- CDOBranchPoint branchPoint = readCDOBranchPoint();
- CDOLockOwner lockOwner = readCDOLockOwner();
- Operation operation = readEnum(Operation.class);
- LockType lockType = readCDOLockType();
-
- int n = readInt();
- CDOLockState[] lockStates = new CDOLockState[n];
- for (int i = 0; i < n; i++)
- {
- lockStates[i] = readCDOLockState();
- }
-
- return new CDOLockChangeInfoImpl(branchPoint, lockOwner, lockStates, operation, lockType);
- }
-
- public LockArea readCDOLockArea() throws IOException
- {
- String durableLockingID = readString();
- CDOBranch branch = readCDOBranch();
- long timestamp = readLong();
- String userID = readString();
- boolean readOnly = readBoolean();
-
- int nLockStates = readInt();
- Map<CDOID, LockGrade> locks = new HashMap<CDOID, LockGrade>();
- for (int i = 0; i < nLockStates; i++)
- {
- CDOID key = readCDOID();
- LockGrade value = readEnum(LockGrade.class);
- locks.put(key, value);
- }
-
- return new CDOLockAreaImpl(durableLockingID, userID, branch.getPoint(timestamp), readOnly, locks);
- }
-
- public CDOLockOwner readCDOLockOwner() throws IOException
- {
- int session = readInt();
- int view = readInt();
- String lockAreaID = readString();
- boolean isDurableView = readBoolean();
- return new CDOLockOwnerImpl(session, view, lockAreaID, isDurableView);
- }
-
- public CDOLockState readCDOLockState() throws IOException
- {
- Object target;
- boolean sendingBranchWithID = readBoolean();
- if (!sendingBranchWithID)
- {
- target = readCDOID();
- }
- else
- {
- target = readCDOIDAndBranch();
- }
-
- InternalCDOLockState lockState = new CDOLockStateImpl(target);
-
- int nReadLockOwners = readInt();
- for (int i = 0; i < nReadLockOwners; i++)
- {
- CDOLockOwner lockOwner = readCDOLockOwner();
- lockState.addReadLockOwner(lockOwner);
- }
-
- boolean hasWriteLock = readBoolean();
- if (hasWriteLock)
- {
- CDOLockOwner lockOwner = readCDOLockOwner();
- lockState.setWriteLockOwner(lockOwner);
- }
-
- boolean hasWriteOption = readBoolean();
- if (hasWriteOption)
- {
- CDOLockOwner lockOwner = readCDOLockOwner();
- lockState.setWriteOptionOwner(lockOwner);
- }
-
- return lockState;
- }
-
- public LockType readCDOLockType() throws IOException
- {
- return readEnum(LockType.class);
- }
-
- public CDOID readCDOID() throws IOException
- {
- byte ordinal = readByte();
-
- // A subtype of OBJECT
- if (ordinal < 0)
- {
- // The ordinal value is negated in the stream to distinguish from the main type.
- // Note: Added 1 because ordinal start at 0, so correct by minus 1.
- return readCDOIDObject(-ordinal - 1);
- }
-
- if (TRACER.isEnabled())
- {
- String type;
- try
- {
- type = Type.values()[ordinal].toString();
- }
- catch (RuntimeException ex)
- {
- type = ex.getMessage();
- }
-
- TRACER.format("Reading CDOID of type {0} ({1})", ordinal, type); //$NON-NLS-1$
- }
-
- Type type = Type.values()[ordinal];
- switch (type)
- {
- case NULL:
- return CDOID.NULL;
-
- case TEMP_OBJECT:
- return new CDOIDTempObjectImpl(readInt());
-
- case EXTERNAL_OBJECT:
- return new CDOIDExternalImpl(readString());
-
- case EXTERNAL_TEMP_OBJECT:
- return new CDOIDTempObjectExternalImpl(readString());
-
- case OBJECT:
- {
- // should normally not occur is handled by
- // readCDOIDObject, code remains here
- // for backward compatibility
- AbstractCDOID id = new CDOIDObjectLongImpl();
- id.read(this);
- return id;
- }
-
- default:
- throw new IOException("Illegal type: " + type);
- }
- }
-
- private CDOID readCDOIDObject(int subTypeOrdinal) throws IOException
- {
- if (TRACER.isEnabled())
- {
- String subType;
-
- try
- {
- subType = CDOID.ObjectType.values()[subTypeOrdinal].toString();
- }
- catch (RuntimeException ex)
- {
- subType = ex.getMessage();
- }
-
- TRACER.format("Reading CDOIDObject of sub type {0} ({1})", subTypeOrdinal, subType); //$NON-NLS-1$
- }
-
- CDOID.ObjectType subType = CDOID.ObjectType.values()[subTypeOrdinal];
- AbstractCDOID id = CDOIDUtil.createCDOIDObject(subType);
- id.read(this);
- return id;
- }
-
- public CDOIDReference readCDOIDReference() throws IOException
- {
- return new CDOIDReference(this);
- }
-
- public CDOIDAndVersion readCDOIDAndVersion() throws IOException
- {
- CDOID id = readCDOID();
- int version = readInt();
- return new CDOIDAndVersionImpl(id, version);
- }
-
- public CDOIDAndBranch readCDOIDAndBranch() throws IOException
- {
- CDOID id = readCDOID();
- CDOBranch branch = readCDOBranch();
- return new CDOIDAndBranchImpl(id, branch);
- }
-
- public CDORevisionKey readCDORevisionKey() throws IOException
- {
- CDOID id = readCDOID();
- CDOBranch branch = readCDOBranch();
- int version = readInt();
- return CDORevisionUtil.createRevisionKey(id, branch, version);
- }
-
- public CDORevision readCDORevision() throws IOException
- {
- return readCDORevision(true);
- }
-
- public CDORevision readCDORevision(boolean freeze) throws IOException
- {
- boolean notNull = readBoolean();
- if (notNull)
- {
- InternalCDORevision revision = (InternalCDORevision)getRevisionFactory().createRevision(null);
- revision.read(this);
-
- if (freeze)
- {
- revision.freeze();
- }
-
- return revision;
- }
-
- return null;
- }
-
- public CDORevisable readCDORevisable() throws IOException
- {
- CDOBranch branch = readCDOBranch();
- int version = readInt();
- long timeStamp = readLong();
- long revised = readLong();
- return CDORevisionUtil.createRevisable(branch, version, timeStamp, revised);
- }
-
- public CDOList readCDOList(EClass owner, EStructuralFeature feature) throws IOException
- {
- int referenceChunk;
- int size = readInt();
- if (size < 0)
- {
- size = -size;
- referenceChunk = readInt();
- if (TRACER.isEnabled())
- {
- TRACER.format("Read feature {0}: size={1}, referenceChunk={2}", feature.getName(), size, referenceChunk); //$NON-NLS-1$
- }
- }
- else
- {
- referenceChunk = size;
- if (TRACER.isEnabled())
- {
- TRACER.format("Read feature {0}: size={1}", feature.getName(), size); //$NON-NLS-1$
- }
- }
-
- Object value = null;
- CDOType type = null;
- boolean isFeatureMap = FeatureMapUtil.isFeatureMap(feature);
- if (!isFeatureMap)
- {
- type = CDOModelUtil.getType(feature.getEType());
- }
-
- InternalCDOList list = (InternalCDOList)getListFactory().createList(size, size, referenceChunk);
- for (int j = 0; j < referenceChunk; j++)
- {
- if (isFeatureMap)
- {
- int featureID = readInt();
- EStructuralFeature innerFeature = owner.getEStructuralFeature(featureID);
- type = CDOModelUtil.getType(innerFeature.getEType());
- value = type.readValue(this);
- value = CDORevisionUtil.createFeatureMapEntry(innerFeature, value);
- }
- else
- {
- value = type.readValue(this);
- }
-
- list.set(j, value);
- if (TRACER.isEnabled())
- {
- TRACER.trace(" " + value); //$NON-NLS-1$
- }
- }
-
- return list;
- }
-
- public Object readCDOFeatureValue(EStructuralFeature feature) throws IOException
- {
- CDOType type = CDOModelUtil.getType(feature);
- Object value = type.readValue(this);
- if (value instanceof CDOLob<?>)
- {
- CDOLob<?> lob = (CDOLob<?>)value;
- CDOLobUtil.setStore(getLobStore(), lob);
- }
-
- return value;
- }
-
- public CDORevisionDelta readCDORevisionDelta() throws IOException
- {
- return new CDORevisionDeltaImpl(this);
- }
-
- public CDOFeatureDelta readCDOFeatureDelta(EClass owner) throws IOException
- {
- int typeOrdinal = readInt();
- CDOFeatureDelta.Type type = CDOFeatureDelta.Type.values()[typeOrdinal];
- switch (type)
- {
- case ADD:
- return new CDOAddFeatureDeltaImpl(this, owner);
-
- case SET:
- return new CDOSetFeatureDeltaImpl(this, owner);
-
- case LIST:
- return new CDOListFeatureDeltaImpl(this, owner);
-
- case MOVE:
- return new CDOMoveFeatureDeltaImpl(this, owner);
-
- case CLEAR:
- return new CDOClearFeatureDeltaImpl(this, owner);
-
- case REMOVE:
- return new CDORemoveFeatureDeltaImpl(this, owner);
-
- case CONTAINER:
- return new CDOContainerFeatureDeltaImpl(this, owner);
-
- case UNSET:
- return new CDOUnsetFeatureDeltaImpl(this, owner);
-
- default:
- throw new IOException(MessageFormat.format(Messages.getString("CDODataInputImpl.5"), typeOrdinal)); //$NON-NLS-1$
- }
- }
-
- public Object readCDORevisionOrPrimitive() throws IOException
- {
- CDOType type = readCDOType();
- return type.readValue(this);
- }
-
- public Object readCDORevisionOrPrimitiveOrClassifier() throws IOException
- {
- boolean isClassifier = readBoolean();
- if (isClassifier)
- {
- return readCDOClassifierRefAndResolve();
- }
-
- return readCDORevisionOrPrimitive();
- }
-
- protected StringIO getPackageURICompressor()
- {
- return StringIO.DIRECT;
- }
-
- protected abstract CDOPackageRegistry getPackageRegistry();
-
- protected abstract CDOBranchManager getBranchManager();
-
- protected abstract CDOCommitInfoManager getCommitInfoManager();
-
- protected abstract CDORevisionFactory getRevisionFactory();
-
- protected abstract CDOListFactory getListFactory();
-
- protected abstract CDOLobStore getLobStore();
-}
+/*
+ * Copyright (c) 2004 - 2012 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 - bug 213402
+ */
+package org.eclipse.emf.cdo.internal.common.protocol;
+
+import org.eclipse.emf.cdo.common.branch.CDOBranch;
+import org.eclipse.emf.cdo.common.branch.CDOBranchManager;
+import org.eclipse.emf.cdo.common.branch.CDOBranchPoint;
+import org.eclipse.emf.cdo.common.branch.CDOBranchVersion;
+import org.eclipse.emf.cdo.common.commit.CDOChangeSetData;
+import org.eclipse.emf.cdo.common.commit.CDOCommitData;
+import org.eclipse.emf.cdo.common.commit.CDOCommitInfo;
+import org.eclipse.emf.cdo.common.commit.CDOCommitInfoManager;
+import org.eclipse.emf.cdo.common.id.CDOID;
+import org.eclipse.emf.cdo.common.id.CDOID.Type;
+import org.eclipse.emf.cdo.common.id.CDOIDReference;
+import org.eclipse.emf.cdo.common.id.CDOIDUtil;
+import org.eclipse.emf.cdo.common.lob.CDOLob;
+import org.eclipse.emf.cdo.common.lob.CDOLobStore;
+import org.eclipse.emf.cdo.common.lob.CDOLobUtil;
+import org.eclipse.emf.cdo.common.lock.CDOLockChangeInfo;
+import org.eclipse.emf.cdo.common.lock.CDOLockChangeInfo.Operation;
+import org.eclipse.emf.cdo.common.lock.CDOLockOwner;
+import org.eclipse.emf.cdo.common.lock.CDOLockState;
+import org.eclipse.emf.cdo.common.lock.CDOLockUtil;
+import org.eclipse.emf.cdo.common.lock.IDurableLockingManager.LockArea;
+import org.eclipse.emf.cdo.common.lock.IDurableLockingManager.LockGrade;
+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.CDOPackageRegistry;
+import org.eclipse.emf.cdo.common.model.CDOPackageUnit;
+import org.eclipse.emf.cdo.common.model.CDOType;
+import org.eclipse.emf.cdo.common.protocol.CDODataInput;
+import org.eclipse.emf.cdo.common.revision.CDOIDAndBranch;
+import org.eclipse.emf.cdo.common.revision.CDOIDAndVersion;
+import org.eclipse.emf.cdo.common.revision.CDOList;
+import org.eclipse.emf.cdo.common.revision.CDOListFactory;
+import org.eclipse.emf.cdo.common.revision.CDORevisable;
+import org.eclipse.emf.cdo.common.revision.CDORevision;
+import org.eclipse.emf.cdo.common.revision.CDORevisionFactory;
+import org.eclipse.emf.cdo.common.revision.CDORevisionKey;
+import org.eclipse.emf.cdo.common.revision.CDORevisionUtil;
+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.commit.CDOChangeSetDataImpl;
+import org.eclipse.emf.cdo.internal.common.commit.CDOCommitDataImpl;
+import org.eclipse.emf.cdo.internal.common.commit.FailureCommitInfo;
+import org.eclipse.emf.cdo.internal.common.id.CDOIDExternalImpl;
+import org.eclipse.emf.cdo.internal.common.id.CDOIDObjectLongImpl;
+import org.eclipse.emf.cdo.internal.common.id.CDOIDTempObjectExternalImpl;
+import org.eclipse.emf.cdo.internal.common.id.CDOIDTempObjectImpl;
+import org.eclipse.emf.cdo.internal.common.lock.CDOLockAreaImpl;
+import org.eclipse.emf.cdo.internal.common.lock.CDOLockChangeInfoImpl;
+import org.eclipse.emf.cdo.internal.common.lock.CDOLockOwnerImpl;
+import org.eclipse.emf.cdo.internal.common.lock.CDOLockStateImpl;
+import org.eclipse.emf.cdo.internal.common.messages.Messages;
+import org.eclipse.emf.cdo.internal.common.revision.CDOIDAndBranchImpl;
+import org.eclipse.emf.cdo.internal.common.revision.CDOIDAndVersionImpl;
+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;
+import org.eclipse.emf.cdo.internal.common.revision.delta.CDOListFeatureDeltaImpl;
+import org.eclipse.emf.cdo.internal.common.revision.delta.CDOMoveFeatureDeltaImpl;
+import org.eclipse.emf.cdo.internal.common.revision.delta.CDORemoveFeatureDeltaImpl;
+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.commit.InternalCDOCommitInfoManager;
+import org.eclipse.emf.cdo.spi.common.id.AbstractCDOID;
+import org.eclipse.emf.cdo.spi.common.lock.InternalCDOLockState;
+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.concurrent.IRWLockManager.LockType;
+import org.eclipse.net4j.util.io.ExtendedDataInput;
+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 org.eclipse.emf.ecore.resource.ResourceSet;
+import org.eclipse.emf.ecore.resource.impl.ResourceSetImpl;
+import org.eclipse.emf.ecore.util.FeatureMapUtil;
+
+import java.io.IOException;
+import java.text.MessageFormat;
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+
+/**
+ * @author Eike Stepper
+ */
+public abstract class CDODataInputImpl extends ExtendedDataInput.Delegating implements CDODataInput
+{
+ private static final ContextTracer TRACER = new ContextTracer(OM.DEBUG_PROTOCOL, CDODataInputImpl.class);
+
+ public CDODataInputImpl(ExtendedDataInput delegate)
+ {
+ super(delegate);
+ }
+
+ public CDOPackageUnit readCDOPackageUnit(ResourceSet resourceSet) throws IOException
+ {
+ InternalCDOPackageUnit packageUnit = (InternalCDOPackageUnit)CDOModelUtil.createPackageUnit();
+ packageUnit.read(this, resourceSet);
+ return packageUnit;
+ }
+
+ public CDOPackageUnit[] readCDOPackageUnits(ResourceSet resourceSet) throws IOException
+ {
+ int size = readInt();
+ if (TRACER.isEnabled())
+ {
+ TRACER.format("Reading {0} package units", size); //$NON-NLS-1$
+ }
+
+ CDOPackageUnit[] packageUnits = new CDOPackageUnit[size];
+ for (int i = 0; i < size; i++)
+ {
+ packageUnits[i] = readCDOPackageUnit(resourceSet);
+ }
+
+ return packageUnits;
+ }
+
+ public CDOPackageUnit.Type readCDOPackageUnitType() throws IOException
+ {
+ return CDOPackageUnit.Type.values()[readByte()];
+ }
+
+ public CDOPackageInfo readCDOPackageInfo() throws IOException
+ {
+ InternalCDOPackageInfo packageInfo = (InternalCDOPackageInfo)CDOModelUtil.createPackageInfo();
+ packageInfo.read(this);
+ return packageInfo;
+ }
+
+ public String readCDOPackageURI() throws IOException
+ {
+ return getPackageURICompressor().read(this);
+ }
+
+ public CDOClassifierRef readCDOClassifierRef() throws IOException
+ {
+ return new CDOClassifierRef(this);
+ }
+
+ public EClassifier readCDOClassifierRefAndResolve() throws IOException
+ {
+ CDOClassifierRef classifierRef = readCDOClassifierRef();
+ EClassifier classifier = classifierRef.resolve(getPackageRegistry());
+ if (classifier == null)
+ {
+ throw new IOException("Unable to resolve " + classifierRef);
+ }
+
+ return classifier;
+ }
+
+ public CDOType readCDOType() throws IOException
+ {
+ byte typeID = readByte();
+ return CDOModelUtil.getType(typeID);
+ }
+
+ public CDOBranch readCDOBranch() throws IOException
+ {
+ int branchID = readInt();
+ return getBranchManager().getBranch(branchID);
+ }
+
+ public CDOBranchPoint readCDOBranchPoint() throws IOException
+ {
+ CDOBranch branch = readCDOBranch();
+ long timeStamp = readLong();
+ return branch.getPoint(timeStamp);
+ }
+
+ public CDOBranchVersion readCDOBranchVersion() throws IOException
+ {
+ CDOBranch branch = readCDOBranch();
+ int version = readInt();
+ return branch.getVersion(version);
+ }
+
+ public CDOChangeSetData readCDOChangeSetData() throws IOException
+ {
+ int size1 = readInt();
+ List<CDOIDAndVersion> newObjects = new ArrayList<CDOIDAndVersion>(size1);
+ for (int i = 0; i < size1; i++)
+ {
+ boolean revision = readBoolean();
+ CDOIDAndVersion data = revision ? readCDORevision() : readCDOIDAndVersion();
+ newObjects.add(data);
+ }
+
+ int size2 = readInt();
+ List<CDORevisionKey> changedObjects = new ArrayList<CDORevisionKey>(size2);
+ for (int i = 0; i < size2; i++)
+ {
+ boolean delta = readBoolean();
+ CDORevisionKey data = delta ? readCDORevisionDelta() : readCDORevisionKey();
+ changedObjects.add(data);
+ }
+
+ int size3 = readInt();
+ List<CDOIDAndVersion> detachedObjects = new ArrayList<CDOIDAndVersion>(size3);
+ for (int i = 0; i < size3; i++)
+ {
+ CDOIDAndVersion data = readCDOIDAndVersion();
+ detachedObjects.add(data);
+ }
+
+ return new CDOChangeSetDataImpl(newObjects, changedObjects, detachedObjects);
+ }
+
+ public CDOCommitData readCDOCommitData() throws IOException
+ {
+ InternalCDOPackageRegistry packageRegistry = (InternalCDOPackageRegistry)getPackageRegistry();
+ ResourceSet resourceSet = new ResourceSetImpl();
+ resourceSet.setPackageRegistry(packageRegistry);
+
+ int size = readInt();
+ List<CDOPackageUnit> newPackageUnits = new ArrayList<CDOPackageUnit>(size);
+ for (int i = 0; i < size; i++)
+ {
+ CDOPackageUnit data = readCDOPackageUnit(resourceSet);
+ newPackageUnits.add(data);
+ packageRegistry.putPackageUnit((InternalCDOPackageUnit)data);
+ }
+
+ CDOChangeSetData data = readCDOChangeSetData();
+ return new CDOCommitDataImpl(newPackageUnits, data.getNewObjects(), data.getChangedObjects(),
+ data.getDetachedObjects());
+ }
+
+ public CDOCommitInfo readCDOCommitInfo() throws IOException
+ {
+ long timeStamp = readLong();
+ long previousTimeStamp = readLong();
+
+ if (readBoolean())
+ {
+ CDOBranch branch = readCDOBranch();
+ String userID = readString();
+ String comment = readString();
+ CDOCommitData commitData = readCDOCommitData();
+
+ InternalCDOCommitInfoManager commitInfoManager = (InternalCDOCommitInfoManager)getCommitInfoManager();
+ return commitInfoManager.createCommitInfo(branch, timeStamp, previousTimeStamp, userID, comment, commitData);
+ }
+
+ return new FailureCommitInfo(timeStamp, previousTimeStamp);
+ }
+
+ public CDOLockChangeInfo readCDOLockChangeInfo() throws IOException
+ {
+ boolean isInvalidateAll = readBoolean();
+ if (isInvalidateAll)
+ {
+ return CDOLockUtil.createLockChangeInfo();
+ }
+
+ CDOBranchPoint branchPoint = readCDOBranchPoint();
+ CDOLockOwner lockOwner = readCDOLockOwner();
+ Operation operation = readEnum(Operation.class);
+ LockType lockType = readCDOLockType();
+
+ int n = readInt();
+ CDOLockState[] lockStates = new CDOLockState[n];
+ for (int i = 0; i < n; i++)
+ {
+ lockStates[i] = readCDOLockState();
+ }
+
+ return new CDOLockChangeInfoImpl(branchPoint, lockOwner, lockStates, operation, lockType);
+ }
+
+ public LockArea readCDOLockArea() throws IOException
+ {
+ String durableLockingID = readString();
+ CDOBranch branch = readCDOBranch();
+ long timestamp = readLong();
+ String userID = readString();
+ boolean readOnly = readBoolean();
+
+ int nLockStates = readInt();
+ Map<CDOID, LockGrade> locks = new HashMap<CDOID, LockGrade>();
+ for (int i = 0; i < nLockStates; i++)
+ {
+ CDOID key = readCDOID();
+ LockGrade value = readEnum(LockGrade.class);
+ locks.put(key, value);
+ }
+
+ return new CDOLockAreaImpl(durableLockingID, userID, branch.getPoint(timestamp), readOnly, locks);
+ }
+
+ public CDOLockOwner readCDOLockOwner() throws IOException
+ {
+ int session = readInt();
+ int view = readInt();
+ String lockAreaID = readString();
+ boolean isDurableView = readBoolean();
+ return new CDOLockOwnerImpl(session, view, lockAreaID, isDurableView);
+ }
+
+ public CDOLockState readCDOLockState() throws IOException
+ {
+ Object target;
+ boolean sendingBranchWithID = readBoolean();
+ if (!sendingBranchWithID)
+ {
+ target = readCDOID();
+ }
+ else
+ {
+ target = readCDOIDAndBranch();
+ }
+
+ InternalCDOLockState lockState = new CDOLockStateImpl(target);
+
+ int nReadLockOwners = readInt();
+ for (int i = 0; i < nReadLockOwners; i++)
+ {
+ CDOLockOwner lockOwner = readCDOLockOwner();
+ lockState.addReadLockOwner(lockOwner);
+ }
+
+ boolean hasWriteLock = readBoolean();
+ if (hasWriteLock)
+ {
+ CDOLockOwner lockOwner = readCDOLockOwner();
+ lockState.setWriteLockOwner(lockOwner);
+ }
+
+ boolean hasWriteOption = readBoolean();
+ if (hasWriteOption)
+ {
+ CDOLockOwner lockOwner = readCDOLockOwner();
+ lockState.setWriteOptionOwner(lockOwner);
+ }
+
+ return lockState;
+ }
+
+ public LockType readCDOLockType() throws IOException
+ {
+ return readEnum(LockType.class);
+ }
+
+ public CDOID readCDOID() throws IOException
+ {
+ byte ordinal = readByte();
+
+ // A subtype of OBJECT
+ if (ordinal < 0)
+ {
+ // The ordinal value is negated in the stream to distinguish from the main type.
+ // Note: Added 1 because ordinal start at 0, so correct by minus 1.
+ return readCDOIDObject(-ordinal - 1);
+ }
+
+ if (TRACER.isEnabled())
+ {
+ String type;
+ try
+ {
+ type = Type.values()[ordinal].toString();
+ }
+ catch (RuntimeException ex)
+ {
+ type = ex.getMessage();
+ }
+
+ TRACER.format("Reading CDOID of type {0} ({1})", ordinal, type); //$NON-NLS-1$
+ }
+
+ Type type = Type.values()[ordinal];
+ switch (type)
+ {
+ case NULL:
+ return CDOID.NULL;
+
+ case TEMP_OBJECT:
+ return new CDOIDTempObjectImpl(readInt());
+
+ case EXTERNAL_OBJECT:
+ return new CDOIDExternalImpl(readString());
+
+ case EXTERNAL_TEMP_OBJECT:
+ return new CDOIDTempObjectExternalImpl(readString());
+
+ case OBJECT:
+ {
+ // should normally not occur is handled by
+ // readCDOIDObject, code remains here
+ // for backward compatibility
+ AbstractCDOID id = new CDOIDObjectLongImpl();
+ id.read(this);
+ return id;
+ }
+
+ default:
+ throw new IOException("Illegal type: " + type);
+ }
+ }
+
+ private CDOID readCDOIDObject(int subTypeOrdinal) throws IOException
+ {
+ if (TRACER.isEnabled())
+ {
+ String subType;
+
+ try
+ {
+ subType = CDOID.ObjectType.values()[subTypeOrdinal].toString();
+ }
+ catch (RuntimeException ex)
+ {
+ subType = ex.getMessage();
+ }
+
+ TRACER.format("Reading CDOIDObject of sub type {0} ({1})", subTypeOrdinal, subType); //$NON-NLS-1$
+ }
+
+ CDOID.ObjectType subType = CDOID.ObjectType.values()[subTypeOrdinal];
+ AbstractCDOID id = CDOIDUtil.createCDOIDObject(subType);
+ id.read(this);
+ return id;
+ }
+
+ public CDOIDReference readCDOIDReference() throws IOException
+ {
+ return new CDOIDReference(this);
+ }
+
+ public CDOIDAndVersion readCDOIDAndVersion() throws IOException
+ {
+ CDOID id = readCDOID();
+ int version = readInt();
+ return new CDOIDAndVersionImpl(id, version);
+ }
+
+ public CDOIDAndBranch readCDOIDAndBranch() throws IOException
+ {
+ CDOID id = readCDOID();
+ CDOBranch branch = readCDOBranch();
+ return new CDOIDAndBranchImpl(id, branch);
+ }
+
+ public CDORevisionKey readCDORevisionKey() throws IOException
+ {
+ CDOID id = readCDOID();
+ CDOBranch branch = readCDOBranch();
+ int version = readInt();
+ return CDORevisionUtil.createRevisionKey(id, branch, version);
+ }
+
+ public CDORevision readCDORevision() throws IOException
+ {
+ return readCDORevision(true);
+ }
+
+ public CDORevision readCDORevision(boolean freeze) throws IOException
+ {
+ boolean notNull = readBoolean();
+ if (notNull)
+ {
+ InternalCDORevision revision = (InternalCDORevision)getRevisionFactory().createRevision(null);
+ revision.read(this);
+
+ if (freeze)
+ {
+ revision.freeze();
+ }
+
+ return revision;
+ }
+
+ return null;
+ }
+
+ public CDORevisable readCDORevisable() throws IOException
+ {
+ CDOBranch branch = readCDOBranch();
+ int version = readInt();
+ long timeStamp = readLong();
+ long revised = readLong();
+ return CDORevisionUtil.createRevisable(branch, version, timeStamp, revised);
+ }
+
+ public CDOList readCDOList(EClass owner, EStructuralFeature feature) throws IOException
+ {
+ int referenceChunk;
+ int size = readInt();
+ if (size < 0)
+ {
+ size = -size;
+ referenceChunk = readInt();
+ if (TRACER.isEnabled())
+ {
+ TRACER.format("Read feature {0}: size={1}, referenceChunk={2}", feature.getName(), size, referenceChunk); //$NON-NLS-1$
+ }
+ }
+ else
+ {
+ referenceChunk = size;
+ if (TRACER.isEnabled())
+ {
+ TRACER.format("Read feature {0}: size={1}", feature.getName(), size); //$NON-NLS-1$
+ }
+ }
+
+ Object value = null;
+ CDOType type = null;
+ boolean isFeatureMap = FeatureMapUtil.isFeatureMap(feature);
+ if (!isFeatureMap)
+ {
+ type = CDOModelUtil.getType(feature.getEType());
+ }
+
+ InternalCDOList list = (InternalCDOList)getListFactory().createList(size, size, referenceChunk);
+ for (int j = 0; j < referenceChunk; j++)
+ {
+ if (isFeatureMap)
+ {
+ int featureID = readInt();
+ EStructuralFeature innerFeature = owner.getEStructuralFeature(featureID);
+ type = CDOModelUtil.getType(innerFeature.getEType());
+ value = type.readValue(this);
+ value = CDORevisionUtil.createFeatureMapEntry(innerFeature, value);
+ }
+ else
+ {
+ value = type.readValue(this);
+ }
+
+ list.set(j, value);
+ if (TRACER.isEnabled())
+ {
+ TRACER.trace(" " + value); //$NON-NLS-1$
+ }
+ }
+
+ return list;
+ }
+
+ public Object readCDOFeatureValue(EStructuralFeature feature) throws IOException
+ {
+ CDOType type = CDOModelUtil.getType(feature);
+ Object value = type.readValue(this);
+ if (value instanceof CDOLob<?>)
+ {
+ CDOLob<?> lob = (CDOLob<?>)value;
+ CDOLobUtil.setStore(getLobStore(), lob);
+ }
+
+ return value;
+ }
+
+ public CDORevisionDelta readCDORevisionDelta() throws IOException
+ {
+ return new CDORevisionDeltaImpl(this);
+ }
+
+ public CDOFeatureDelta readCDOFeatureDelta(EClass owner) throws IOException
+ {
+ int typeOrdinal = readInt();
+ CDOFeatureDelta.Type type = CDOFeatureDelta.Type.values()[typeOrdinal];
+ switch (type)
+ {
+ case ADD:
+ return new CDOAddFeatureDeltaImpl(this, owner);
+
+ case SET:
+ return new CDOSetFeatureDeltaImpl(this, owner);
+
+ case LIST:
+ return new CDOListFeatureDeltaImpl(this, owner);
+
+ case MOVE:
+ return new CDOMoveFeatureDeltaImpl(this, owner);
+
+ case CLEAR:
+ return new CDOClearFeatureDeltaImpl(this, owner);
+
+ case REMOVE:
+ return new CDORemoveFeatureDeltaImpl(this, owner);
+
+ case CONTAINER:
+ return new CDOContainerFeatureDeltaImpl(this, owner);
+
+ case UNSET:
+ return new CDOUnsetFeatureDeltaImpl(this, owner);
+
+ default:
+ throw new IOException(MessageFormat.format(Messages.getString("CDODataInputImpl.5"), typeOrdinal)); //$NON-NLS-1$
+ }
+ }
+
+ public Object readCDORevisionOrPrimitive() throws IOException
+ {
+ CDOType type = readCDOType();
+ return type.readValue(this);
+ }
+
+ public Object readCDORevisionOrPrimitiveOrClassifier() throws IOException
+ {
+ boolean isClassifier = readBoolean();
+ if (isClassifier)
+ {
+ return readCDOClassifierRefAndResolve();
+ }
+
+ return readCDORevisionOrPrimitive();
+ }
+
+ protected StringIO getPackageURICompressor()
+ {
+ return StringIO.DIRECT;
+ }
+
+ protected abstract CDOPackageRegistry getPackageRegistry();
+
+ protected abstract CDOBranchManager getBranchManager();
+
+ protected abstract CDOCommitInfoManager getCommitInfoManager();
+
+ protected abstract CDORevisionFactory getRevisionFactory();
+
+ protected abstract CDOListFactory getListFactory();
+
+ protected abstract CDOLobStore getLobStore();
+}
diff --git a/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/internal/common/protocol/CDODataOutputImpl.java b/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/internal/common/protocol/CDODataOutputImpl.java
index df2a2a7a8b..3853a9f162 100644
--- a/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/internal/common/protocol/CDODataOutputImpl.java
+++ b/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/internal/common/protocol/CDODataOutputImpl.java
@@ -1,560 +1,560 @@
-/*
- * Copyright (c) 2004 - 2011 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.protocol;
-
-import org.eclipse.emf.cdo.common.branch.CDOBranch;
-import org.eclipse.emf.cdo.common.branch.CDOBranchPoint;
-import org.eclipse.emf.cdo.common.branch.CDOBranchVersion;
-import org.eclipse.emf.cdo.common.commit.CDOChangeSetData;
-import org.eclipse.emf.cdo.common.commit.CDOCommitData;
-import org.eclipse.emf.cdo.common.commit.CDOCommitInfo;
-import org.eclipse.emf.cdo.common.id.CDOID;
-import org.eclipse.emf.cdo.common.id.CDOIDProvider;
-import org.eclipse.emf.cdo.common.id.CDOIDReference;
-import org.eclipse.emf.cdo.common.lock.CDOLockChangeInfo;
-import org.eclipse.emf.cdo.common.lock.CDOLockOwner;
-import org.eclipse.emf.cdo.common.lock.CDOLockState;
-import org.eclipse.emf.cdo.common.lock.IDurableLockingManager.LockArea;
-import org.eclipse.emf.cdo.common.lock.IDurableLockingManager.LockGrade;
-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.CDOPackageRegistry;
-import org.eclipse.emf.cdo.common.model.CDOPackageUnit;
-import org.eclipse.emf.cdo.common.model.CDOType;
-import org.eclipse.emf.cdo.common.protocol.CDODataOutput;
-import org.eclipse.emf.cdo.common.revision.CDOIDAndBranch;
-import org.eclipse.emf.cdo.common.revision.CDOIDAndVersion;
-import org.eclipse.emf.cdo.common.revision.CDOList;
-import org.eclipse.emf.cdo.common.revision.CDORevisable;
-import org.eclipse.emf.cdo.common.revision.CDORevision;
-import org.eclipse.emf.cdo.common.revision.CDORevisionKey;
-import org.eclipse.emf.cdo.common.revision.CDORevisionUtil;
-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.messages.Messages;
-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.id.InternalCDOIDObject;
-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.IRWLockManager.LockType;
-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.EObject;
-import org.eclipse.emf.ecore.EReference;
-import org.eclipse.emf.ecore.EStructuralFeature;
-import org.eclipse.emf.ecore.util.FeatureMap;
-import org.eclipse.emf.ecore.util.FeatureMap.Entry;
-import org.eclipse.emf.ecore.util.FeatureMapUtil;
-
-import java.io.IOException;
-import java.text.MessageFormat;
-import java.util.Collection;
-import java.util.Map;
-import java.util.Set;
-
-/**
- * @author Eike Stepper
- */
-public abstract class CDODataOutputImpl extends ExtendedDataOutput.Delegating implements CDODataOutput
-{
- private static final ContextTracer TRACER = new ContextTracer(OM.DEBUG_PROTOCOL, CDODataOutputImpl.class);
-
- public CDODataOutputImpl(ExtendedDataOutput delegate)
- {
- super(delegate);
- }
-
- public void writeCDOPackageUnit(CDOPackageUnit packageUnit, boolean withPackages) throws IOException
- {
- ((InternalCDOPackageUnit)packageUnit).write(this, withPackages);
- }
-
- public void writeCDOPackageUnits(CDOPackageUnit... packageUnits) throws IOException
- {
- int size = packageUnits.length;
- writeInt(size);
- if (TRACER.isEnabled())
- {
- TRACER.format("Writing {0} package units", size); //$NON-NLS-1$
- }
-
- for (CDOPackageUnit packageUnit : packageUnits)
- {
- writeCDOPackageUnit(packageUnit, false);
- }
- }
-
- public void writeCDOPackageUnitType(CDOPackageUnit.Type type) throws IOException
- {
- writeByte(type.ordinal());
- }
-
- public void writeCDOPackageInfo(CDOPackageInfo packageInfo) throws IOException
- {
- ((InternalCDOPackageInfo)packageInfo).write(this);
- }
-
- public void writeCDOClassifierRef(CDOClassifierRef eClassifierRef) throws IOException
- {
- eClassifierRef.write(this);
- }
-
- public void writeCDOClassifierRef(EClassifier eClassifier) throws IOException
- {
- writeCDOClassifierRef(new CDOClassifierRef(eClassifier));
- }
-
- public void writeCDOPackageURI(String uri) throws IOException
- {
- getPackageURICompressor().write(this, uri);
- }
-
- public void writeCDOType(CDOType cdoType) throws IOException
- {
- ((CDOTypeImpl)cdoType).write(this);
- }
-
- public void writeCDOBranch(CDOBranch branch) throws IOException
- {
- writeInt(branch.getID());
- }
-
- public void writeCDOBranchPoint(CDOBranchPoint branchPoint) throws IOException
- {
- writeCDOBranch(branchPoint.getBranch());
- writeLong(branchPoint.getTimeStamp());
- }
-
- public void writeCDOBranchVersion(CDOBranchVersion branchVersion) throws IOException
- {
- writeCDOBranch(branchVersion.getBranch());
- writeInt(branchVersion.getVersion());
- }
-
- public void writeCDOChangeSetData(CDOChangeSetData changeSetData) throws IOException
- {
- Collection<CDOIDAndVersion> newObjects = changeSetData.getNewObjects();
- writeInt(newObjects.size());
- for (CDOIDAndVersion data : newObjects)
- {
- if (data instanceof CDORevision)
- {
- writeBoolean(true);
- writeCDORevision((CDORevision)data, CDORevision.UNCHUNKED);
- }
- else
- {
- writeBoolean(false);
- writeCDOIDAndVersion(data);
- }
- }
-
- Collection<CDORevisionKey> changedObjects = changeSetData.getChangedObjects();
- writeInt(changedObjects.size());
- for (CDORevisionKey data : changedObjects)
- {
- if (data instanceof CDORevisionDelta)
- {
- writeBoolean(true);
- writeCDORevisionDelta((CDORevisionDelta)data);
- }
- else
- {
- writeBoolean(false);
- writeCDORevisionKey(data);
- }
- }
-
- Collection<CDOIDAndVersion> detachedObjects = changeSetData.getDetachedObjects();
- writeInt(detachedObjects.size());
- for (CDOIDAndVersion data : detachedObjects)
- {
- writeCDOIDAndVersion(data);
- }
- }
-
- public void writeCDOCommitData(CDOCommitData commitData) throws IOException
- {
- Collection<CDOPackageUnit> newPackageUnits = commitData.getNewPackageUnits();
- writeInt(newPackageUnits.size());
- for (CDOPackageUnit data : newPackageUnits)
- {
- writeCDOPackageUnit(data, false);
- }
-
- writeCDOChangeSetData(commitData);
- }
-
- public void writeCDOCommitInfo(CDOCommitInfo commitInfo) throws IOException
- {
- writeLong(commitInfo.getTimeStamp());
- writeLong(commitInfo.getPreviousTimeStamp());
-
- CDOBranch branch = commitInfo.getBranch();
- if (branch != null)
- {
- writeBoolean(true);
- writeCDOBranch(branch);
- writeString(commitInfo.getUserID());
- writeString(commitInfo.getComment());
- writeCDOCommitData(commitInfo);
- }
- else
- {
- // FailureCommitInfo
- writeBoolean(false);
- }
- }
-
- public void writeCDOLockChangeInfo(CDOLockChangeInfo lockChangeInfo) throws IOException
- {
- if (lockChangeInfo.isInvalidateAll())
- {
- writeBoolean(true);
- }
- else
- {
- writeBoolean(false);
- writeCDOBranchPoint(lockChangeInfo);
- writeCDOLockOwner(lockChangeInfo.getLockOwner());
- writeEnum(lockChangeInfo.getOperation());
- writeCDOLockType(lockChangeInfo.getLockType());
-
- CDOLockState[] lockStates = lockChangeInfo.getLockStates();
- writeInt(lockStates.length);
- for (CDOLockState lockState : lockStates)
- {
- writeCDOLockState(lockState);
- }
- }
- }
-
- public void writeCDOLockArea(LockArea lockArea) throws IOException
- {
- writeString(lockArea.getDurableLockingID());
- writeCDOBranch(lockArea.getBranch());
- writeLong(lockArea.getTimeStamp());
- writeString(lockArea.getUserID());
- writeBoolean(lockArea.isReadOnly());
-
- writeInt(lockArea.getLocks().size());
- for (Map.Entry<CDOID, LockGrade> entry : lockArea.getLocks().entrySet())
- {
- writeCDOID(entry.getKey());
- writeEnum(entry.getValue());
- }
- }
-
- public void writeCDOLockOwner(CDOLockOwner lockOwner) throws IOException
- {
- writeInt(lockOwner.getSessionID());
- writeInt(lockOwner.getViewID());
- writeString(lockOwner.getDurableLockingID());
- writeBoolean(lockOwner.isDurableView());
- }
-
- public void writeCDOLockState(CDOLockState lockState) throws IOException
- {
- Object o = lockState.getLockedObject();
- if (o instanceof CDOID)
- {
- writeBoolean(false);
- writeCDOID((CDOID)o);
- }
- else if (o instanceof CDOIDAndBranch)
- {
- writeBoolean(true);
- writeCDOIDAndBranch((CDOIDAndBranch)o);
- }
- else
- {
- throw new AssertionError("Unexpected type: " + o.getClass().getSimpleName());
- }
-
- Set<CDOLockOwner> readLockOwners = lockState.getReadLockOwners();
- writeInt(readLockOwners.size());
- for (CDOLockOwner readLockOwner : readLockOwners)
- {
- writeCDOLockOwner(readLockOwner);
- }
-
- CDOLockOwner writeLockOwner = lockState.getWriteLockOwner();
- if (writeLockOwner != null)
- {
- writeBoolean(true);
- writeCDOLockOwner(writeLockOwner);
- }
- else
- {
- writeBoolean(false);
- }
-
- CDOLockOwner writeOptionOwner = lockState.getWriteOptionOwner();
- if (writeOptionOwner != null)
- {
- writeBoolean(true);
- writeCDOLockOwner(writeOptionOwner);
- }
- else
- {
- writeBoolean(false);
- }
- }
-
- public void writeCDOLockType(LockType lockType) throws IOException
- {
- writeEnum(lockType);
- }
-
- public void writeCDOID(CDOID id) throws IOException
- {
- if (id == null)
- {
- id = CDOID.NULL;
- }
-
- if (id instanceof InternalCDOIDObject)
- {
- CDOID.ObjectType subType = ((InternalCDOIDObject)id).getSubType();
- int ordinal = subType.ordinal();
- if (TRACER.isEnabled())
- {
- TRACER.format("Writing CDOIDObject of subtype {0} ({1})", ordinal, subType); //$NON-NLS-1$
- }
-
- // Negated to distinguish between the subtypes and the maintypes.
- // Note: Added 1 because ordinal start at 0
- writeByte(-ordinal - 1);
- }
- else
- {
- CDOID.Type type = id.getType();
- int ordinal = type.ordinal();
- if (TRACER.isEnabled())
- {
- TRACER.format("Writing CDOID of type {0} ({1})", ordinal, type); //$NON-NLS-1$
- }
-
- writeByte(ordinal);
- }
-
- ((AbstractCDOID)id).write(this);
- }
-
- public void writeCDOIDReference(CDOIDReference idReference) throws IOException
- {
- idReference.write(this);
- }
-
- public void writeCDOIDAndVersion(CDOIDAndVersion idAndVersion) throws IOException
- {
- writeCDOID(idAndVersion.getID());
- writeInt(idAndVersion.getVersion());
- }
-
- public void writeCDOIDAndBranch(CDOIDAndBranch idAndBranch) throws IOException
- {
- writeCDOID(idAndBranch.getID());
- writeCDOBranch(idAndBranch.getBranch());
- }
-
- public void writeCDORevisionKey(CDORevisionKey revisionKey) throws IOException
- {
- writeCDOID(revisionKey.getID());
- writeCDOBranch(revisionKey.getBranch());
- writeInt(revisionKey.getVersion());
- }
-
- public void writeCDORevision(CDORevision revision, int referenceChunk) throws IOException
- {
- if (revision != null)
- {
- writeBoolean(true);
- ((InternalCDORevision)revision).write(this, referenceChunk);
- }
- else
- {
- writeBoolean(false);
- }
- }
-
- public void writeCDORevisable(CDORevisable revisable) throws IOException
- {
- writeCDOBranch(revisable.getBranch());
- writeInt(revisable.getVersion());
- writeLong(revisable.getTimeStamp());
- writeLong(revisable.getRevised());
- }
-
- public void writeCDOList(EClass owner, EStructuralFeature feature, CDOList list, 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)
- int size = list == null ? 0 : list.size();
- if (size > 0)
- {
- // Need to adjust the referenceChunk in case where we do not have enough value in the list.
- // Even if the referenceChunk is specified, a provider of data could have override that value.
- int sizeToLook = referenceChunk == CDORevision.UNCHUNKED ? size : Math.min(referenceChunk, size);
- for (int i = 0; i < sizeToLook; i++)
- {
- Object element = list.get(i, false);
- if (element == CDORevisionUtil.UNINITIALIZED)
- {
- referenceChunk = i;
- break;
- }
- }
- }
-
- if (referenceChunk != CDORevision.UNCHUNKED && referenceChunk < size)
- {
- // This happens only on server-side
- if (TRACER.isEnabled())
- {
- TRACER.format("Writing feature {0}: size={1}, referenceChunk={2}", feature.getName(), size, referenceChunk); //$NON-NLS-1$
- }
-
- writeInt(-size);
- writeInt(referenceChunk);
- size = referenceChunk;
- }
- else
- {
- if (TRACER.isEnabled())
- {
- TRACER.format("Writing feature {0}: size={1}", feature.getName(), size); //$NON-NLS-1$
- }
-
- writeInt(size);
- }
-
- CDOIDProvider idProvider = getIDProvider();
- boolean isFeatureMap = FeatureMapUtil.isFeatureMap(feature);
- for (int j = 0; j < size; j++)
- {
- Object value = list.get(j, false);
- EStructuralFeature innerFeature = feature; // Prepare for possible feature map
- if (isFeatureMap)
- {
- Entry entry = (FeatureMap.Entry)value;
- innerFeature = entry.getEStructuralFeature();
- value = entry.getValue();
-
- int featureID = owner.getFeatureID(innerFeature);
- writeInt(featureID);
- }
-
- if (value != null && innerFeature instanceof EReference)
- {
- value = idProvider.provideCDOID(value);
- }
-
- if (TRACER.isEnabled())
- {
- TRACER.trace(" " + value); //$NON-NLS-1$
- }
-
- writeCDOFeatureValue(innerFeature, value);
- }
- }
-
- public void writeCDOFeatureValue(EStructuralFeature feature, Object value) throws IOException
- {
- CDOType type = CDOModelUtil.getType(feature);
- type.writeValue(this, value);
- }
-
- public void writeCDORevisionDelta(CDORevisionDelta revisionDelta) throws IOException
- {
- ((CDORevisionDeltaImpl)revisionDelta).write(this);
- }
-
- public void writeCDOFeatureDelta(EClass owner, CDOFeatureDelta featureDelta) throws IOException
- {
- ((CDOFeatureDeltaImpl)featureDelta).write(this, owner);
- }
-
- public void writeCDORevisionOrPrimitive(Object value) throws IOException
- {
- if (value == null)
- {
- value = CDOID.NULL;
- }
- else if (value instanceof EObject)
- {
- value = getIDProvider().provideCDOID(value);
- }
- else if (value instanceof CDORevision)
- {
- value = ((CDORevision)value).getID();
- }
-
- CDOType type = null;
- if (value instanceof CDOID)
- {
- type = CDOType.OBJECT;
- }
- else
- {
- type = CDOModelUtil.getPrimitiveType(value.getClass());
- if (type == null)
- {
- throw new IllegalArgumentException(MessageFormat.format(
- Messages.getString("CDODataOutputImpl.6"), value.getClass())); //$NON-NLS-1$
- }
- }
-
- writeCDOType(type);
- type.writeValue(this, value);
- }
-
- public void writeCDORevisionOrPrimitiveOrClassifier(Object value) throws IOException
- {
- if (value instanceof EClassifier)
- {
- writeBoolean(true);
- writeCDOClassifierRef((EClass)value);
- }
- else
- {
- writeBoolean(false);
- writeCDORevisionOrPrimitive(value);
- }
- }
-
- public CDOPackageRegistry getPackageRegistry()
- {
- return null;
- }
-
- public CDOIDProvider getIDProvider()
- {
- return null;
- }
-
- protected StringIO getPackageURICompressor()
- {
- return StringIO.DIRECT;
- }
-}
+/*
+ * Copyright (c) 2004 - 2012 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.protocol;
+
+import org.eclipse.emf.cdo.common.branch.CDOBranch;
+import org.eclipse.emf.cdo.common.branch.CDOBranchPoint;
+import org.eclipse.emf.cdo.common.branch.CDOBranchVersion;
+import org.eclipse.emf.cdo.common.commit.CDOChangeSetData;
+import org.eclipse.emf.cdo.common.commit.CDOCommitData;
+import org.eclipse.emf.cdo.common.commit.CDOCommitInfo;
+import org.eclipse.emf.cdo.common.id.CDOID;
+import org.eclipse.emf.cdo.common.id.CDOIDProvider;
+import org.eclipse.emf.cdo.common.id.CDOIDReference;
+import org.eclipse.emf.cdo.common.lock.CDOLockChangeInfo;
+import org.eclipse.emf.cdo.common.lock.CDOLockOwner;
+import org.eclipse.emf.cdo.common.lock.CDOLockState;
+import org.eclipse.emf.cdo.common.lock.IDurableLockingManager.LockArea;
+import org.eclipse.emf.cdo.common.lock.IDurableLockingManager.LockGrade;
+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.CDOPackageRegistry;
+import org.eclipse.emf.cdo.common.model.CDOPackageUnit;
+import org.eclipse.emf.cdo.common.model.CDOType;
+import org.eclipse.emf.cdo.common.protocol.CDODataOutput;
+import org.eclipse.emf.cdo.common.revision.CDOIDAndBranch;
+import org.eclipse.emf.cdo.common.revision.CDOIDAndVersion;
+import org.eclipse.emf.cdo.common.revision.CDOList;
+import org.eclipse.emf.cdo.common.revision.CDORevisable;
+import org.eclipse.emf.cdo.common.revision.CDORevision;
+import org.eclipse.emf.cdo.common.revision.CDORevisionKey;
+import org.eclipse.emf.cdo.common.revision.CDORevisionUtil;
+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.messages.Messages;
+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.id.InternalCDOIDObject;
+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.IRWLockManager.LockType;
+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.EObject;
+import org.eclipse.emf.ecore.EReference;
+import org.eclipse.emf.ecore.EStructuralFeature;
+import org.eclipse.emf.ecore.util.FeatureMap;
+import org.eclipse.emf.ecore.util.FeatureMap.Entry;
+import org.eclipse.emf.ecore.util.FeatureMapUtil;
+
+import java.io.IOException;
+import java.text.MessageFormat;
+import java.util.Collection;
+import java.util.Map;
+import java.util.Set;
+
+/**
+ * @author Eike Stepper
+ */
+public abstract class CDODataOutputImpl extends ExtendedDataOutput.Delegating implements CDODataOutput
+{
+ private static final ContextTracer TRACER = new ContextTracer(OM.DEBUG_PROTOCOL, CDODataOutputImpl.class);
+
+ public CDODataOutputImpl(ExtendedDataOutput delegate)
+ {
+ super(delegate);
+ }
+
+ public void writeCDOPackageUnit(CDOPackageUnit packageUnit, boolean withPackages) throws IOException
+ {
+ ((InternalCDOPackageUnit)packageUnit).write(this, withPackages);
+ }
+
+ public void writeCDOPackageUnits(CDOPackageUnit... packageUnits) throws IOException
+ {
+ int size = packageUnits.length;
+ writeInt(size);
+ if (TRACER.isEnabled())
+ {
+ TRACER.format("Writing {0} package units", size); //$NON-NLS-1$
+ }
+
+ for (CDOPackageUnit packageUnit : packageUnits)
+ {
+ writeCDOPackageUnit(packageUnit, false);
+ }
+ }
+
+ public void writeCDOPackageUnitType(CDOPackageUnit.Type type) throws IOException
+ {
+ writeByte(type.ordinal());
+ }
+
+ public void writeCDOPackageInfo(CDOPackageInfo packageInfo) throws IOException
+ {
+ ((InternalCDOPackageInfo)packageInfo).write(this);
+ }
+
+ public void writeCDOClassifierRef(CDOClassifierRef eClassifierRef) throws IOException
+ {
+ eClassifierRef.write(this);
+ }
+
+ public void writeCDOClassifierRef(EClassifier eClassifier) throws IOException
+ {
+ writeCDOClassifierRef(new CDOClassifierRef(eClassifier));
+ }
+
+ public void writeCDOPackageURI(String uri) throws IOException
+ {
+ getPackageURICompressor().write(this, uri);
+ }
+
+ public void writeCDOType(CDOType cdoType) throws IOException
+ {
+ ((CDOTypeImpl)cdoType).write(this);
+ }
+
+ public void writeCDOBranch(CDOBranch branch) throws IOException
+ {
+ writeInt(branch.getID());
+ }
+
+ public void writeCDOBranchPoint(CDOBranchPoint branchPoint) throws IOException
+ {
+ writeCDOBranch(branchPoint.getBranch());
+ writeLong(branchPoint.getTimeStamp());
+ }
+
+ public void writeCDOBranchVersion(CDOBranchVersion branchVersion) throws IOException
+ {
+ writeCDOBranch(branchVersion.getBranch());
+ writeInt(branchVersion.getVersion());
+ }
+
+ public void writeCDOChangeSetData(CDOChangeSetData changeSetData) throws IOException
+ {
+ Collection<CDOIDAndVersion> newObjects = changeSetData.getNewObjects();
+ writeInt(newObjects.size());
+ for (CDOIDAndVersion data : newObjects)
+ {
+ if (data instanceof CDORevision)
+ {
+ writeBoolean(true);
+ writeCDORevision((CDORevision)data, CDORevision.UNCHUNKED);
+ }
+ else
+ {
+ writeBoolean(false);
+ writeCDOIDAndVersion(data);
+ }
+ }
+
+ Collection<CDORevisionKey> changedObjects = changeSetData.getChangedObjects();
+ writeInt(changedObjects.size());
+ for (CDORevisionKey data : changedObjects)
+ {
+ if (data instanceof CDORevisionDelta)
+ {
+ writeBoolean(true);
+ writeCDORevisionDelta((CDORevisionDelta)data);
+ }
+ else
+ {
+ writeBoolean(false);
+ writeCDORevisionKey(data);
+ }
+ }
+
+ Collection<CDOIDAndVersion> detachedObjects = changeSetData.getDetachedObjects();
+ writeInt(detachedObjects.size());
+ for (CDOIDAndVersion data : detachedObjects)
+ {
+ writeCDOIDAndVersion(data);
+ }
+ }
+
+ public void writeCDOCommitData(CDOCommitData commitData) throws IOException
+ {
+ Collection<CDOPackageUnit> newPackageUnits = commitData.getNewPackageUnits();
+ writeInt(newPackageUnits.size());
+ for (CDOPackageUnit data : newPackageUnits)
+ {
+ writeCDOPackageUnit(data, false);
+ }
+
+ writeCDOChangeSetData(commitData);
+ }
+
+ public void writeCDOCommitInfo(CDOCommitInfo commitInfo) throws IOException
+ {
+ writeLong(commitInfo.getTimeStamp());
+ writeLong(commitInfo.getPreviousTimeStamp());
+
+ CDOBranch branch = commitInfo.getBranch();
+ if (branch != null)
+ {
+ writeBoolean(true);
+ writeCDOBranch(branch);
+ writeString(commitInfo.getUserID());
+ writeString(commitInfo.getComment());
+ writeCDOCommitData(commitInfo);
+ }
+ else
+ {
+ // FailureCommitInfo
+ writeBoolean(false);
+ }
+ }
+
+ public void writeCDOLockChangeInfo(CDOLockChangeInfo lockChangeInfo) throws IOException
+ {
+ if (lockChangeInfo.isInvalidateAll())
+ {
+ writeBoolean(true);
+ }
+ else
+ {
+ writeBoolean(false);
+ writeCDOBranchPoint(lockChangeInfo);
+ writeCDOLockOwner(lockChangeInfo.getLockOwner());
+ writeEnum(lockChangeInfo.getOperation());
+ writeCDOLockType(lockChangeInfo.getLockType());
+
+ CDOLockState[] lockStates = lockChangeInfo.getLockStates();
+ writeInt(lockStates.length);
+ for (CDOLockState lockState : lockStates)
+ {
+ writeCDOLockState(lockState);
+ }
+ }
+ }
+
+ public void writeCDOLockArea(LockArea lockArea) throws IOException
+ {
+ writeString(lockArea.getDurableLockingID());
+ writeCDOBranch(lockArea.getBranch());
+ writeLong(lockArea.getTimeStamp());
+ writeString(lockArea.getUserID());
+ writeBoolean(lockArea.isReadOnly());
+
+ writeInt(lockArea.getLocks().size());
+ for (Map.Entry<CDOID, LockGrade> entry : lockArea.getLocks().entrySet())
+ {
+ writeCDOID(entry.getKey());
+ writeEnum(entry.getValue());
+ }
+ }
+
+ public void writeCDOLockOwner(CDOLockOwner lockOwner) throws IOException
+ {
+ writeInt(lockOwner.getSessionID());
+ writeInt(lockOwner.getViewID());
+ writeString(lockOwner.getDurableLockingID());
+ writeBoolean(lockOwner.isDurableView());
+ }
+
+ public void writeCDOLockState(CDOLockState lockState) throws IOException
+ {
+ Object o = lockState.getLockedObject();
+ if (o instanceof CDOID)
+ {
+ writeBoolean(false);
+ writeCDOID((CDOID)o);
+ }
+ else if (o instanceof CDOIDAndBranch)
+ {
+ writeBoolean(true);
+ writeCDOIDAndBranch((CDOIDAndBranch)o);
+ }
+ else
+ {
+ throw new AssertionError("Unexpected type: " + o.getClass().getSimpleName());
+ }
+
+ Set<CDOLockOwner> readLockOwners = lockState.getReadLockOwners();
+ writeInt(readLockOwners.size());
+ for (CDOLockOwner readLockOwner : readLockOwners)
+ {
+ writeCDOLockOwner(readLockOwner);
+ }
+
+ CDOLockOwner writeLockOwner = lockState.getWriteLockOwner();
+ if (writeLockOwner != null)
+ {
+ writeBoolean(true);
+ writeCDOLockOwner(writeLockOwner);
+ }
+ else
+ {
+ writeBoolean(false);
+ }
+
+ CDOLockOwner writeOptionOwner = lockState.getWriteOptionOwner();
+ if (writeOptionOwner != null)
+ {
+ writeBoolean(true);
+ writeCDOLockOwner(writeOptionOwner);
+ }
+ else
+ {
+ writeBoolean(false);
+ }
+ }
+
+ public void writeCDOLockType(LockType lockType) throws IOException
+ {
+ writeEnum(lockType);
+ }
+
+ public void writeCDOID(CDOID id) throws IOException
+ {
+ if (id == null)
+ {
+ id = CDOID.NULL;
+ }
+
+ if (id instanceof InternalCDOIDObject)
+ {
+ CDOID.ObjectType subType = ((InternalCDOIDObject)id).getSubType();
+ int ordinal = subType.ordinal();
+ if (TRACER.isEnabled())
+ {
+ TRACER.format("Writing CDOIDObject of subtype {0} ({1})", ordinal, subType); //$NON-NLS-1$
+ }
+
+ // Negated to distinguish between the subtypes and the maintypes.
+ // Note: Added 1 because ordinal start at 0
+ writeByte(-ordinal - 1);
+ }
+ else
+ {
+ CDOID.Type type = id.getType();
+ int ordinal = type.ordinal();
+ if (TRACER.isEnabled())
+ {
+ TRACER.format("Writing CDOID of type {0} ({1})", ordinal, type); //$NON-NLS-1$
+ }
+
+ writeByte(ordinal);
+ }
+
+ ((AbstractCDOID)id).write(this);
+ }
+
+ public void writeCDOIDReference(CDOIDReference idReference) throws IOException
+ {
+ idReference.write(this);
+ }
+
+ public void writeCDOIDAndVersion(CDOIDAndVersion idAndVersion) throws IOException
+ {
+ writeCDOID(idAndVersion.getID());
+ writeInt(idAndVersion.getVersion());
+ }
+
+ public void writeCDOIDAndBranch(CDOIDAndBranch idAndBranch) throws IOException
+ {
+ writeCDOID(idAndBranch.getID());
+ writeCDOBranch(idAndBranch.getBranch());
+ }
+
+ public void writeCDORevisionKey(CDORevisionKey revisionKey) throws IOException
+ {
+ writeCDOID(revisionKey.getID());
+ writeCDOBranch(revisionKey.getBranch());
+ writeInt(revisionKey.getVersion());
+ }
+
+ public void writeCDORevision(CDORevision revision, int referenceChunk) throws IOException
+ {
+ if (revision != null)
+ {
+ writeBoolean(true);
+ ((InternalCDORevision)revision).write(this, referenceChunk);
+ }
+ else
+ {
+ writeBoolean(false);
+ }
+ }
+
+ public void writeCDORevisable(CDORevisable revisable) throws IOException
+ {
+ writeCDOBranch(revisable.getBranch());
+ writeInt(revisable.getVersion());
+ writeLong(revisable.getTimeStamp());
+ writeLong(revisable.getRevised());
+ }
+
+ public void writeCDOList(EClass owner, EStructuralFeature feature, CDOList list, 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)
+ int size = list == null ? 0 : list.size();
+ if (size > 0)
+ {
+ // Need to adjust the referenceChunk in case where we do not have enough value in the list.
+ // Even if the referenceChunk is specified, a provider of data could have override that value.
+ int sizeToLook = referenceChunk == CDORevision.UNCHUNKED ? size : Math.min(referenceChunk, size);
+ for (int i = 0; i < sizeToLook; i++)
+ {
+ Object element = list.get(i, false);
+ if (element == CDORevisionUtil.UNINITIALIZED)
+ {
+ referenceChunk = i;
+ break;
+ }
+ }
+ }
+
+ if (referenceChunk != CDORevision.UNCHUNKED && referenceChunk < size)
+ {
+ // This happens only on server-side
+ if (TRACER.isEnabled())
+ {
+ TRACER.format("Writing feature {0}: size={1}, referenceChunk={2}", feature.getName(), size, referenceChunk); //$NON-NLS-1$
+ }
+
+ writeInt(-size);
+ writeInt(referenceChunk);
+ size = referenceChunk;
+ }
+ else
+ {
+ if (TRACER.isEnabled())
+ {
+ TRACER.format("Writing feature {0}: size={1}", feature.getName(), size); //$NON-NLS-1$
+ }
+
+ writeInt(size);
+ }
+
+ CDOIDProvider idProvider = getIDProvider();
+ boolean isFeatureMap = FeatureMapUtil.isFeatureMap(feature);
+ for (int j = 0; j < size; j++)
+ {
+ Object value = list.get(j, false);
+ EStructuralFeature innerFeature = feature; // Prepare for possible feature map
+ if (isFeatureMap)
+ {
+ Entry entry = (FeatureMap.Entry)value;
+ innerFeature = entry.getEStructuralFeature();
+ value = entry.getValue();
+
+ int featureID = owner.getFeatureID(innerFeature);
+ writeInt(featureID);
+ }
+
+ if (value != null && innerFeature instanceof EReference)
+ {
+ value = idProvider.provideCDOID(value);
+ }
+
+ if (TRACER.isEnabled())
+ {
+ TRACER.trace(" " + value); //$NON-NLS-1$
+ }
+
+ writeCDOFeatureValue(innerFeature, value);
+ }
+ }
+
+ public void writeCDOFeatureValue(EStructuralFeature feature, Object value) throws IOException
+ {
+ CDOType type = CDOModelUtil.getType(feature);
+ type.writeValue(this, value);
+ }
+
+ public void writeCDORevisionDelta(CDORevisionDelta revisionDelta) throws IOException
+ {
+ ((CDORevisionDeltaImpl)revisionDelta).write(this);
+ }
+
+ public void writeCDOFeatureDelta(EClass owner, CDOFeatureDelta featureDelta) throws IOException
+ {
+ ((CDOFeatureDeltaImpl)featureDelta).write(this, owner);
+ }
+
+ public void writeCDORevisionOrPrimitive(Object value) throws IOException
+ {
+ if (value == null)
+ {
+ value = CDOID.NULL;
+ }
+ else if (value instanceof EObject)
+ {
+ value = getIDProvider().provideCDOID(value);
+ }
+ else if (value instanceof CDORevision)
+ {
+ value = ((CDORevision)value).getID();
+ }
+
+ CDOType type = null;
+ if (value instanceof CDOID)
+ {
+ type = CDOType.OBJECT;
+ }
+ else
+ {
+ type = CDOModelUtil.getPrimitiveType(value.getClass());
+ if (type == null)
+ {
+ throw new IllegalArgumentException(MessageFormat.format(
+ Messages.getString("CDODataOutputImpl.6"), value.getClass())); //$NON-NLS-1$
+ }
+ }
+
+ writeCDOType(type);
+ type.writeValue(this, value);
+ }
+
+ public void writeCDORevisionOrPrimitiveOrClassifier(Object value) throws IOException
+ {
+ if (value instanceof EClassifier)
+ {
+ writeBoolean(true);
+ writeCDOClassifierRef((EClass)value);
+ }
+ else
+ {
+ writeBoolean(false);
+ writeCDORevisionOrPrimitive(value);
+ }
+ }
+
+ public CDOPackageRegistry getPackageRegistry()
+ {
+ return null;
+ }
+
+ public CDOIDProvider getIDProvider()
+ {
+ return null;
+ }
+
+ protected StringIO getPackageURICompressor()
+ {
+ return StringIO.DIRECT;
+ }
+}
diff --git a/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/internal/common/revision/AbstractCDORevisionCache.java b/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/internal/common/revision/AbstractCDORevisionCache.java
index 58eb68b4f3..43f0cf2f8c 100644
--- a/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/internal/common/revision/AbstractCDORevisionCache.java
+++ b/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/internal/common/revision/AbstractCDORevisionCache.java
@@ -1,156 +1,156 @@
-/*
- * Copyright (c) 2004 - 2011 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 - bug 201266
- * Simon McDuff - bug 230832
- */
-package org.eclipse.emf.cdo.internal.common.revision;
-
-import org.eclipse.emf.cdo.common.branch.CDOBranch;
-import org.eclipse.emf.cdo.common.id.CDOID;
-import org.eclipse.emf.cdo.common.revision.CDORevision;
-import org.eclipse.emf.cdo.common.revision.CDORevisionKey;
-import org.eclipse.emf.cdo.spi.common.revision.InternalCDORevision;
-import org.eclipse.emf.cdo.spi.common.revision.InternalCDORevisionCache;
-
-import org.eclipse.net4j.util.event.IListener;
-import org.eclipse.net4j.util.ref.ReferenceQueueWorker;
-
-import java.lang.ref.Reference;
-import java.lang.ref.ReferenceQueue;
-import java.lang.ref.SoftReference;
-import java.text.MessageFormat;
-
-/**
- * @author Eike Stepper
- */
-public abstract class AbstractCDORevisionCache extends ReferenceQueueWorker<InternalCDORevision> implements
- InternalCDORevisionCache
-{
- private static boolean disableGC;
-
- public AbstractCDORevisionCache()
- {
- }
-
- @Override
- protected void work(Reference<? extends InternalCDORevision> reference)
- {
- CDORevisionKey key = (CDORevisionKey)reference;
-
- CDOID id = key.getID();
- CDOBranch branch = key.getBranch();
- int version = key.getVersion();
-
- InternalCDORevision revision = (InternalCDORevision)removeRevision(id, branch.getVersion(version));
- if (revision == null)
- {
- // Use revision in eviction event
- key = revision;
- }
-
- IListener[] listeners = getListeners();
- if (listeners != null)
- {
- fireEvent(new EvictionEventImpl(this, key), listeners);
- }
- }
-
- protected Reference<InternalCDORevision> createReference(CDORevision revision)
- {
- if (disableGC)
- {
- return new CacheStrongReference((InternalCDORevision)revision);
- }
-
- return new CacheSoftReference((InternalCDORevision)revision, getQueue());
- }
-
- /**
- * @author Eike Stepper
- */
- private static final class CacheSoftReference extends SoftReference<InternalCDORevision> implements CDORevisionKey
- {
- private CDOID id;
-
- private CDOBranch branch;
-
- private int version;
-
- public CacheSoftReference(InternalCDORevision revision, ReferenceQueue<InternalCDORevision> queue)
- {
- super(revision, queue);
- id = revision.getID();
- branch = revision.getBranch();
- version = revision.getVersion();
- }
-
- public CDOID getID()
- {
- return id;
- }
-
- public CDOBranch getBranch()
- {
- return branch;
- }
-
- public int getVersion()
- {
- return version;
- }
-
- @Override
- public String toString()
- {
- return MessageFormat.format("{0}:{1}v{2}", getID(), getBranch().getID(), getVersion());
- }
- }
-
- /**
- * @author Eike Stepper
- */
- private static final class CacheStrongReference extends SoftReference<InternalCDORevision> implements CDORevisionKey
- {
- private CDOID id;
-
- private CDOBranch branch;
-
- private int version;
-
- public CacheStrongReference(InternalCDORevision revision)
- {
- super(revision);
- id = revision.getID();
- branch = revision.getBranch();
- version = revision.getVersion();
- }
-
- public CDOID getID()
- {
- return id;
- }
-
- public CDOBranch getBranch()
- {
- return branch;
- }
-
- public int getVersion()
- {
- return version;
- }
-
- @Override
- public String toString()
- {
- return MessageFormat.format("{0}:{1}v{2}", getID(), getBranch().getID(), getVersion());
- }
- }
-}
+/*
+ * Copyright (c) 2004 - 2012 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 - bug 201266
+ * Simon McDuff - bug 230832
+ */
+package org.eclipse.emf.cdo.internal.common.revision;
+
+import org.eclipse.emf.cdo.common.branch.CDOBranch;
+import org.eclipse.emf.cdo.common.id.CDOID;
+import org.eclipse.emf.cdo.common.revision.CDORevision;
+import org.eclipse.emf.cdo.common.revision.CDORevisionKey;
+import org.eclipse.emf.cdo.spi.common.revision.InternalCDORevision;
+import org.eclipse.emf.cdo.spi.common.revision.InternalCDORevisionCache;
+
+import org.eclipse.net4j.util.event.IListener;
+import org.eclipse.net4j.util.ref.ReferenceQueueWorker;
+
+import java.lang.ref.Reference;
+import java.lang.ref.ReferenceQueue;
+import java.lang.ref.SoftReference;
+import java.text.MessageFormat;
+
+/**
+ * @author Eike Stepper
+ */
+public abstract class AbstractCDORevisionCache extends ReferenceQueueWorker<InternalCDORevision> implements
+ InternalCDORevisionCache
+{
+ private static boolean disableGC;
+
+ public AbstractCDORevisionCache()
+ {
+ }
+
+ @Override
+ protected void work(Reference<? extends InternalCDORevision> reference)
+ {
+ CDORevisionKey key = (CDORevisionKey)reference;
+
+ CDOID id = key.getID();
+ CDOBranch branch = key.getBranch();
+ int version = key.getVersion();
+
+ InternalCDORevision revision = (InternalCDORevision)removeRevision(id, branch.getVersion(version));
+ if (revision == null)
+ {
+ // Use revision in eviction event
+ key = revision;
+ }
+
+ IListener[] listeners = getListeners();
+ if (listeners != null)
+ {
+ fireEvent(new EvictionEventImpl(this, key), listeners);
+ }
+ }
+
+ protected Reference<InternalCDORevision> createReference(CDORevision revision)
+ {
+ if (disableGC)
+ {
+ return new CacheStrongReference((InternalCDORevision)revision);
+ }
+
+ return new CacheSoftReference((InternalCDORevision)revision, getQueue());
+ }
+
+ /**
+ * @author Eike Stepper
+ */
+ private static final class CacheSoftReference extends SoftReference<InternalCDORevision> implements CDORevisionKey
+ {
+ private CDOID id;
+
+ private CDOBranch branch;
+
+ private int version;
+
+ public CacheSoftReference(InternalCDORevision revision, ReferenceQueue<InternalCDORevision> queue)
+ {
+ super(revision, queue);
+ id = revision.getID();
+ branch = revision.getBranch();
+ version = revision.getVersion();
+ }
+
+ public CDOID getID()
+ {
+ return id;
+ }
+
+ public CDOBranch getBranch()
+ {
+ return branch;
+ }
+
+ public int getVersion()
+ {
+ return version;
+ }
+
+ @Override
+ public String toString()
+ {
+ return MessageFormat.format("{0}:{1}v{2}", getID(), getBranch().getID(), getVersion());
+ }
+ }
+
+ /**
+ * @author Eike Stepper
+ */
+ private static final class CacheStrongReference extends SoftReference<InternalCDORevision> implements CDORevisionKey
+ {
+ private CDOID id;
+
+ private CDOBranch branch;
+
+ private int version;
+
+ public CacheStrongReference(InternalCDORevision revision)
+ {
+ super(revision);
+ id = revision.getID();
+ branch = revision.getBranch();
+ version = revision.getVersion();
+ }
+
+ public CDOID getID()
+ {
+ return id;
+ }
+
+ public CDOBranch getBranch()
+ {
+ return branch;
+ }
+
+ public int getVersion()
+ {
+ return version;
+ }
+
+ @Override
+ public String toString()
+ {
+ return MessageFormat.format("{0}:{1}v{2}", getID(), getBranch().getID(), getVersion());
+ }
+ }
+}
diff --git a/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/internal/common/revision/CDOElementProxyImpl.java b/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/internal/common/revision/CDOElementProxyImpl.java
index 8c5536fae8..cda9a09a9e 100644
--- a/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/internal/common/revision/CDOElementProxyImpl.java
+++ b/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/internal/common/revision/CDOElementProxyImpl.java
@@ -1,45 +1,45 @@
-/*
- * Copyright (c) 2004 - 2011 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 - maintenance
- */
-package org.eclipse.emf.cdo.internal.common.revision;
-
-import org.eclipse.emf.cdo.common.revision.CDOElementProxy;
-
-import java.text.MessageFormat;
-
-/**
- * @author Eike Stepper
- */
-public final class CDOElementProxyImpl implements CDOElementProxy
-{
- private int index;
-
- public CDOElementProxyImpl(int index)
- {
- this.index = index;
- }
-
- public int getIndex()
- {
- return index;
- }
-
- public void setIndex(int index)
- {
- this.index = index;
- }
-
- @Override
- public String toString()
- {
- return MessageFormat.format("CDOElementProxy[{0}]", index); //$NON-NLS-1$
- }
-}
+/*
+ * Copyright (c) 2004 - 2012 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 - maintenance
+ */
+package org.eclipse.emf.cdo.internal.common.revision;
+
+import org.eclipse.emf.cdo.common.revision.CDOElementProxy;
+
+import java.text.MessageFormat;
+
+/**
+ * @author Eike Stepper
+ */
+public final class CDOElementProxyImpl implements CDOElementProxy
+{
+ private int index;
+
+ public CDOElementProxyImpl(int index)
+ {
+ this.index = index;
+ }
+
+ public int getIndex()
+ {
+ return index;
+ }
+
+ public void setIndex(int index)
+ {
+ this.index = index;
+ }
+
+ @Override
+ public String toString()
+ {
+ return MessageFormat.format("CDOElementProxy[{0}]", index); //$NON-NLS-1$
+ }
+}
diff --git a/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/internal/common/revision/CDOFeatureMapEntryImpl.java b/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/internal/common/revision/CDOFeatureMapEntryImpl.java
index 7e317f626d..f852ffafd8 100644
--- a/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/internal/common/revision/CDOFeatureMapEntryImpl.java
+++ b/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/internal/common/revision/CDOFeatureMapEntryImpl.java
@@ -1,63 +1,63 @@
-/*
- * Copyright (c) 2004 - 2011 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.revision;
-
-import org.eclipse.emf.cdo.spi.common.revision.CDOFeatureMapEntry;
-
-import org.eclipse.emf.ecore.EStructuralFeature;
-
-import java.text.MessageFormat;
-
-/**
- * @author Eike Stepper
- */
-public class CDOFeatureMapEntryImpl implements CDOFeatureMapEntry
-{
- private EStructuralFeature feature;
-
- private Object value;
-
- public CDOFeatureMapEntryImpl()
- {
- }
-
- public CDOFeatureMapEntryImpl(EStructuralFeature feature, Object value)
- {
- this.feature = feature;
- this.value = value;
- }
-
- public EStructuralFeature getEStructuralFeature()
- {
- return feature;
- }
-
- public void setEStructuralFeature(EStructuralFeature feature)
- {
- this.feature = feature;
- }
-
- public Object getValue()
- {
- return value;
- }
-
- public void setValue(Object value)
- {
- this.value = value;
- }
-
- @Override
- public String toString()
- {
- return MessageFormat.format("CDOFeatureMapEntry({0}, {1})", feature.getName(), value); //$NON-NLS-1$
- }
-}
+/*
+ * Copyright (c) 2004 - 2012 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.revision;
+
+import org.eclipse.emf.cdo.spi.common.revision.CDOFeatureMapEntry;
+
+import org.eclipse.emf.ecore.EStructuralFeature;
+
+import java.text.MessageFormat;
+
+/**
+ * @author Eike Stepper
+ */
+public class CDOFeatureMapEntryImpl implements CDOFeatureMapEntry
+{
+ private EStructuralFeature feature;
+
+ private Object value;
+
+ public CDOFeatureMapEntryImpl()
+ {
+ }
+
+ public CDOFeatureMapEntryImpl(EStructuralFeature feature, Object value)
+ {
+ this.feature = feature;
+ this.value = value;
+ }
+
+ public EStructuralFeature getEStructuralFeature()
+ {
+ return feature;
+ }
+
+ public void setEStructuralFeature(EStructuralFeature feature)
+ {
+ this.feature = feature;
+ }
+
+ public Object getValue()
+ {
+ return value;
+ }
+
+ public void setValue(Object value)
+ {
+ this.value = value;
+ }
+
+ @Override
+ public String toString()
+ {
+ return MessageFormat.format("CDOFeatureMapEntry({0}, {1})", feature.getName(), value); //$NON-NLS-1$
+ }
+}
diff --git a/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/internal/common/revision/CDOIDAndBranchImpl.java b/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/internal/common/revision/CDOIDAndBranchImpl.java
index a9d8d05cbf..22abddb88f 100644
--- a/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/internal/common/revision/CDOIDAndBranchImpl.java
+++ b/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/internal/common/revision/CDOIDAndBranchImpl.java
@@ -1,78 +1,78 @@
-/*
- * Copyright (c) 2004 - 2011 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.revision;
-
-import org.eclipse.emf.cdo.common.branch.CDOBranch;
-import org.eclipse.emf.cdo.common.id.CDOID;
-import org.eclipse.emf.cdo.common.revision.CDOIDAndBranch;
-
-import org.eclipse.net4j.util.CheckUtil;
-import org.eclipse.net4j.util.ObjectUtil;
-
-import java.text.MessageFormat;
-
-/**
- * @author Eike Stepper
- */
-public class CDOIDAndBranchImpl implements CDOIDAndBranch
-{
- private CDOID id;
-
- private CDOBranch branch;
-
- public CDOIDAndBranchImpl(CDOID id, CDOBranch branch)
- {
- CheckUtil.checkArg(id, "id");
- CheckUtil.checkArg(branch, "branch");
-
- this.id = id;
- this.branch = branch;
- }
-
- public CDOID getID()
- {
- return id;
- }
-
- public CDOBranch getBranch()
- {
- return branch;
- }
-
- @Override
- public boolean equals(Object obj)
- {
- if (obj == this)
- {
- return true;
- }
-
- if (obj instanceof CDOIDAndBranch)
- {
- CDOIDAndBranch that = (CDOIDAndBranch)obj;
- return ObjectUtil.equals(branch, that.getBranch()) && ObjectUtil.equals(id, that.getID());
- }
-
- return false;
- }
-
- @Override
- public int hashCode()
- {
- return id.hashCode() ^ branch.hashCode();
- }
-
- @Override
- public String toString()
- {
- return MessageFormat.format("{0}:{1}", id, branch.getID()); //$NON-NLS-1$
- }
-}
+/*
+ * Copyright (c) 2004 - 2012 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.revision;
+
+import org.eclipse.emf.cdo.common.branch.CDOBranch;
+import org.eclipse.emf.cdo.common.id.CDOID;
+import org.eclipse.emf.cdo.common.revision.CDOIDAndBranch;
+
+import org.eclipse.net4j.util.CheckUtil;
+import org.eclipse.net4j.util.ObjectUtil;
+
+import java.text.MessageFormat;
+
+/**
+ * @author Eike Stepper
+ */
+public class CDOIDAndBranchImpl implements CDOIDAndBranch
+{
+ private CDOID id;
+
+ private CDOBranch branch;
+
+ public CDOIDAndBranchImpl(CDOID id, CDOBranch branch)
+ {
+ CheckUtil.checkArg(id, "id");
+ CheckUtil.checkArg(branch, "branch");
+
+ this.id = id;
+ this.branch = branch;
+ }
+
+ public CDOID getID()
+ {
+ return id;
+ }
+
+ public CDOBranch getBranch()
+ {
+ return branch;
+ }
+
+ @Override
+ public boolean equals(Object obj)
+ {
+ if (obj == this)
+ {
+ return true;
+ }
+
+ if (obj instanceof CDOIDAndBranch)
+ {
+ CDOIDAndBranch that = (CDOIDAndBranch)obj;
+ return ObjectUtil.equals(branch, that.getBranch()) && ObjectUtil.equals(id, that.getID());
+ }
+
+ return false;
+ }
+
+ @Override
+ public int hashCode()
+ {
+ return id.hashCode() ^ branch.hashCode();
+ }
+
+ @Override
+ public String toString()
+ {
+ return MessageFormat.format("{0}:{1}", id, branch.getID()); //$NON-NLS-1$
+ }
+}
diff --git a/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/internal/common/revision/CDOIDAndVersionImpl.java b/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/internal/common/revision/CDOIDAndVersionImpl.java
index 3ffd488c67..27ead89940 100644
--- a/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/internal/common/revision/CDOIDAndVersionImpl.java
+++ b/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/internal/common/revision/CDOIDAndVersionImpl.java
@@ -1,75 +1,75 @@
-/*
- * Copyright (c) 2004 - 2011 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.revision;
-
-import org.eclipse.emf.cdo.common.id.CDOID;
-import org.eclipse.emf.cdo.common.revision.CDOIDAndVersion;
-
-import org.eclipse.net4j.util.CheckUtil;
-
-import java.text.MessageFormat;
-
-/**
- * @author Eike Stepper
- */
-public class CDOIDAndVersionImpl implements CDOIDAndVersion
-{
- private CDOID id;
-
- private int version;
-
- public CDOIDAndVersionImpl(CDOID id, int version)
- {
- CheckUtil.checkArg(id, "id");
-
- this.id = id;
- this.version = version;
- }
-
- public CDOID getID()
- {
- return id;
- }
-
- public int getVersion()
- {
- return version;
- }
-
- @Override
- public boolean equals(Object obj)
- {
- if (obj == this)
- {
- return true;
- }
-
- if (obj instanceof CDOIDAndVersion)
- {
- CDOIDAndVersion that = (CDOIDAndVersion)obj;
- return id.equals(that.getID()) && version == that.getVersion();
- }
-
- return false;
- }
-
- @Override
- public int hashCode()
- {
- return id.hashCode() ^ version;
- }
-
- @Override
- public String toString()
- {
- return MessageFormat.format("{0}v{1}", id, version); //$NON-NLS-1$
- }
-}
+/*
+ * Copyright (c) 2004 - 2012 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.revision;
+
+import org.eclipse.emf.cdo.common.id.CDOID;
+import org.eclipse.emf.cdo.common.revision.CDOIDAndVersion;
+
+import org.eclipse.net4j.util.CheckUtil;
+
+import java.text.MessageFormat;
+
+/**
+ * @author Eike Stepper
+ */
+public class CDOIDAndVersionImpl implements CDOIDAndVersion
+{
+ private CDOID id;
+
+ private int version;
+
+ public CDOIDAndVersionImpl(CDOID id, int version)
+ {
+ CheckUtil.checkArg(id, "id");
+
+ this.id = id;
+ this.version = version;
+ }
+
+ public CDOID getID()
+ {
+ return id;
+ }
+
+ public int getVersion()
+ {
+ return version;
+ }
+
+ @Override
+ public boolean equals(Object obj)
+ {
+ if (obj == this)
+ {
+ return true;
+ }
+
+ if (obj instanceof CDOIDAndVersion)
+ {
+ CDOIDAndVersion that = (CDOIDAndVersion)obj;
+ return id.equals(that.getID()) && version == that.getVersion();
+ }
+
+ return false;
+ }
+
+ @Override
+ public int hashCode()
+ {
+ return id.hashCode() ^ version;
+ }
+
+ @Override
+ public String toString()
+ {
+ return MessageFormat.format("{0}v{1}", id, version); //$NON-NLS-1$
+ }
+}
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 fb4ccfe944..62b5cbc176 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
@@ -1,187 +1,187 @@
-/*
- * Copyright (c) 2004 - 2011 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.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;
-import org.eclipse.emf.cdo.spi.common.revision.CDOReferenceAdjuster;
-import org.eclipse.emf.cdo.spi.common.revision.InternalCDOList;
-
-import org.eclipse.net4j.util.collection.MoveableArrayList;
-
-import org.eclipse.emf.ecore.EClassifier;
-import org.eclipse.emf.ecore.EStructuralFeature;
-
-import java.util.Collection;
-
-/**
- * @author Simon McDuff
- */
-public class CDOListImpl extends MoveableArrayList<Object> implements InternalCDOList
-{
- public static final CDOListFactory FACTORY = new CDOListFactory()
- {
- public CDOList createList(int initialCapacity, int size, int initialChunk)
- {
- return new CDOListImpl(initialCapacity, size);
- }
- };
-
- private static final long serialVersionUID = 1L;
-
- private transient boolean frozen;
-
- public CDOListImpl(int initialCapacity, int size)
- {
- super(initialCapacity);
- for (int j = 0; j < size; j++)
- {
- this.add(UNINITIALIZED);
- }
- }
-
- 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++)
- {
- Object value = this.get(j);
- list.add(j, type.copyValue(value));
- }
-
- return list;
- }
-
- public Object get(int index, boolean resolve)
- {
- return super.get(index);
- }
-
- /**
- * There's a duplicate of this method in WrappedHibernateList!!!
- */
- public boolean adjustReferences(CDOReferenceAdjuster revisionAdjuster, EStructuralFeature feature)
- {
- boolean changed = false;
- CDOType type = CDOModelUtil.getType(feature);
- int size = size();
- for (int i = 0; i < size; i++)
- {
- Object element = super.get(i);
- handleAdjustReference(i, element);
- Object newID = type.adjustReferences(revisionAdjuster, element, feature, i);
- if (newID != element) // Just an optimization for NOOP adjusters
- {
- super.set(i, newID);
- changed = true;
- }
- }
-
- return changed;
- }
-
- protected void handleAdjustReference(int index, Object element)
- {
- }
-
- public void freeze()
- {
- frozen = true;
- }
-
- private void checkFrozen()
- {
- if (frozen)
- {
- throw new IllegalStateException("Cannot modify a frozen list");
- }
- }
-
- @Override
- public boolean add(Object o)
- {
- checkFrozen();
- return super.add(o);
- }
-
- @Override
- public boolean remove(Object o)
- {
- checkFrozen();
- return super.remove(o);
- }
-
- @Override
- public boolean addAll(Collection<? extends Object> c)
- {
- checkFrozen();
- return super.addAll(c);
- }
-
- @Override
- public boolean addAll(int index, Collection<? extends Object> c)
- {
- checkFrozen();
- return super.addAll(index, c);
- }
-
- @Override
- public boolean removeAll(Collection<?> c)
- {
- checkFrozen();
- return super.removeAll(c);
- }
-
- @Override
- public boolean retainAll(Collection<?> c)
- {
- checkFrozen();
- return super.retainAll(c);
- }
-
- @Override
- public void clear()
- {
- checkFrozen();
- super.clear();
- }
-
- @Override
- public Object set(int index, Object element)
- {
- checkFrozen();
- return super.set(index, element);
- }
-
- @Override
- public void add(int index, Object element)
- {
- checkFrozen();
- super.add(index, element);
- }
-
- @Override
- public Object remove(int index)
- {
- checkFrozen();
- return super.remove(index);
- }
-
- public void setWithoutFrozenCheck(int index, Object element)
- {
- super.set(index, element);
- }
-}
+/*
+ * Copyright (c) 2004 - 2012 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.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;
+import org.eclipse.emf.cdo.spi.common.revision.CDOReferenceAdjuster;
+import org.eclipse.emf.cdo.spi.common.revision.InternalCDOList;
+
+import org.eclipse.net4j.util.collection.MoveableArrayList;
+
+import org.eclipse.emf.ecore.EClassifier;
+import org.eclipse.emf.ecore.EStructuralFeature;
+
+import java.util.Collection;
+
+/**
+ * @author Simon McDuff
+ */
+public class CDOListImpl extends MoveableArrayList<Object> implements InternalCDOList
+{
+ public static final CDOListFactory FACTORY = new CDOListFactory()
+ {
+ public CDOList createList(int initialCapacity, int size, int initialChunk)
+ {
+ return new CDOListImpl(initialCapacity, size);
+ }
+ };
+
+ private static final long serialVersionUID = 1L;
+
+ private transient boolean frozen;
+
+ public CDOListImpl(int initialCapacity, int size)
+ {
+ super(initialCapacity);
+ for (int j = 0; j < size; j++)
+ {
+ this.add(UNINITIALIZED);
+ }
+ }
+
+ 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++)
+ {
+ Object value = this.get(j);
+ list.add(j, type.copyValue(value));
+ }
+
+ return list;
+ }
+
+ public Object get(int index, boolean resolve)
+ {
+ return super.get(index);
+ }
+
+ /**
+ * There's a duplicate of this method in WrappedHibernateList!!!
+ */
+ public boolean adjustReferences(CDOReferenceAdjuster revisionAdjuster, EStructuralFeature feature)
+ {
+ boolean changed = false;
+ CDOType type = CDOModelUtil.getType(feature);
+ int size = size();
+ for (int i = 0; i < size; i++)
+ {
+ Object element = super.get(i);
+ handleAdjustReference(i, element);
+ Object newID = type.adjustReferences(revisionAdjuster, element, feature, i);
+ if (newID != element) // Just an optimization for NOOP adjusters
+ {
+ super.set(i, newID);
+ changed = true;
+ }
+ }
+
+ return changed;
+ }
+
+ protected void handleAdjustReference(int index, Object element)
+ {
+ }
+
+ public void freeze()
+ {
+ frozen = true;
+ }
+
+ private void checkFrozen()
+ {
+ if (frozen)
+ {
+ throw new IllegalStateException("Cannot modify a frozen list");
+ }
+ }
+
+ @Override
+ public boolean add(Object o)
+ {
+ checkFrozen();
+ return super.add(o);
+ }
+
+ @Override
+ public boolean remove(Object o)
+ {
+ checkFrozen();
+ return super.remove(o);
+ }
+
+ @Override
+ public boolean addAll(Collection<? extends Object> c)
+ {
+ checkFrozen();
+ return super.addAll(c);
+ }
+
+ @Override
+ public boolean addAll(int index, Collection<? extends Object> c)
+ {
+ checkFrozen();
+ return super.addAll(index, c);
+ }
+
+ @Override
+ public boolean removeAll(Collection<?> c)
+ {
+ checkFrozen();
+ return super.removeAll(c);
+ }
+
+ @Override
+ public boolean retainAll(Collection<?> c)
+ {
+ checkFrozen();
+ return super.retainAll(c);
+ }
+
+ @Override
+ public void clear()
+ {
+ checkFrozen();
+ super.clear();
+ }
+
+ @Override
+ public Object set(int index, Object element)
+ {
+ checkFrozen();
+ return super.set(index, element);
+ }
+
+ @Override
+ public void add(int index, Object element)
+ {
+ checkFrozen();
+ super.add(index, element);
+ }
+
+ @Override
+ public Object remove(int index)
+ {
+ checkFrozen();
+ return super.remove(index);
+ }
+
+ public void setWithoutFrozenCheck(int index, Object element)
+ {
+ super.set(index, element);
+ }
+}
diff --git a/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/internal/common/revision/CDOListWithElementProxiesImpl.java b/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/internal/common/revision/CDOListWithElementProxiesImpl.java
index eb1cb667b5..2179d9b092 100644
--- a/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/internal/common/revision/CDOListWithElementProxiesImpl.java
+++ b/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/internal/common/revision/CDOListWithElementProxiesImpl.java
@@ -1,91 +1,91 @@
-/*
- * Copyright (c) 2004 - 2011 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.revision;
-
-import org.eclipse.emf.cdo.common.model.CDOModelUtil;
-import org.eclipse.emf.cdo.common.model.CDOType;
-import org.eclipse.emf.cdo.common.revision.CDOElementProxy;
-import org.eclipse.emf.cdo.common.revision.CDOList;
-import org.eclipse.emf.cdo.common.revision.CDOListFactory;
-import org.eclipse.emf.cdo.spi.common.revision.InternalCDOList;
-
-import org.eclipse.emf.ecore.EClassifier;
-
-/**
- * @author Simon McDuff
- */
-public class CDOListWithElementProxiesImpl extends CDOListImpl
-{
- public static final CDOListFactory FACTORY = new CDOListFactory()
- {
- public CDOList createList(int initialCapacity, int size, int initialChunk)
- {
- return new CDOListWithElementProxiesImpl(initialCapacity, size, initialChunk);
- }
- };
-
- private static final long serialVersionUID = 1L;
-
- public CDOListWithElementProxiesImpl(int initialCapacity, int size, int initialChunk)
- {
- super(initialCapacity, initialChunk);
- for (int j = initialChunk; j < size; j++)
- {
- this.add(new CDOElementProxyImpl(j));
- }
- }
-
- @Override
- public Object get(int index, boolean resolve)
- {
- if (resolve == true)
- {
- return get(index);
- }
-
- Object element = super.get(index);
-
- return element instanceof CDOElementProxy ? UNINITIALIZED : element;
- }
-
- @Override
- protected void handleAdjustReference(int index, Object element)
- {
- if (element instanceof CDOElementProxy)
- {
- ((CDOElementProxyImpl)element).setIndex(index);
- }
- }
-
- @Override
- public InternalCDOList clone(EClassifier classifier)
- {
- CDOType type = CDOModelUtil.getType(classifier);
- int size = size();
- InternalCDOList list = new CDOListWithElementProxiesImpl(size, 0, 0);
- for (int j = 0; j < size; j++)
- {
- Object value = this.get(j);
-
- if (value instanceof CDOElementProxy)
- {
- list.add(j, new CDOElementProxyImpl(((CDOElementProxy)value).getIndex()));
- }
- else
- {
- list.add(j, type.copyValue(value));
- }
- }
-
- return list;
- }
-}
+/*
+ * Copyright (c) 2004 - 2012 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.revision;
+
+import org.eclipse.emf.cdo.common.model.CDOModelUtil;
+import org.eclipse.emf.cdo.common.model.CDOType;
+import org.eclipse.emf.cdo.common.revision.CDOElementProxy;
+import org.eclipse.emf.cdo.common.revision.CDOList;
+import org.eclipse.emf.cdo.common.revision.CDOListFactory;
+import org.eclipse.emf.cdo.spi.common.revision.InternalCDOList;
+
+import org.eclipse.emf.ecore.EClassifier;
+
+/**
+ * @author Simon McDuff
+ */
+public class CDOListWithElementProxiesImpl extends CDOListImpl
+{
+ public static final CDOListFactory FACTORY = new CDOListFactory()
+ {
+ public CDOList createList(int initialCapacity, int size, int initialChunk)
+ {
+ return new CDOListWithElementProxiesImpl(initialCapacity, size, initialChunk);
+ }
+ };
+
+ private static final long serialVersionUID = 1L;
+
+ public CDOListWithElementProxiesImpl(int initialCapacity, int size, int initialChunk)
+ {
+ super(initialCapacity, initialChunk);
+ for (int j = initialChunk; j < size; j++)
+ {
+ this.add(new CDOElementProxyImpl(j));
+ }
+ }
+
+ @Override
+ public Object get(int index, boolean resolve)
+ {
+ if (resolve == true)
+ {
+ return get(index);
+ }
+
+ Object element = super.get(index);
+
+ return element instanceof CDOElementProxy ? UNINITIALIZED : element;
+ }
+
+ @Override
+ protected void handleAdjustReference(int index, Object element)
+ {
+ if (element instanceof CDOElementProxy)
+ {
+ ((CDOElementProxyImpl)element).setIndex(index);
+ }
+ }
+
+ @Override
+ public InternalCDOList clone(EClassifier classifier)
+ {
+ CDOType type = CDOModelUtil.getType(classifier);
+ int size = size();
+ InternalCDOList list = new CDOListWithElementProxiesImpl(size, 0, 0);
+ for (int j = 0; j < size; j++)
+ {
+ Object value = this.get(j);
+
+ if (value instanceof CDOElementProxy)
+ {
+ list.add(j, new CDOElementProxyImpl(((CDOElementProxy)value).getIndex()));
+ }
+ else
+ {
+ list.add(j, type.copyValue(value));
+ }
+ }
+
+ return list;
+ }
+}
diff --git a/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/internal/common/revision/CDORevisableImpl.java b/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/internal/common/revision/CDORevisableImpl.java
index 6deff7e029..b9ce22a600 100644
--- a/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/internal/common/revision/CDORevisableImpl.java
+++ b/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/internal/common/revision/CDORevisableImpl.java
@@ -1,90 +1,90 @@
-/*
- * Copyright (c) 2004 - 2011 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.revision;
-
-import org.eclipse.emf.cdo.common.branch.CDOBranch;
-import org.eclipse.emf.cdo.common.revision.CDORevisable;
-import org.eclipse.emf.cdo.common.util.CDOCommonUtil;
-import org.eclipse.emf.cdo.internal.common.branch.CDOBranchVersionImpl;
-
-import org.eclipse.net4j.util.ObjectUtil;
-
-import java.text.MessageFormat;
-
-/**
- * @author Eike Stepper
- */
-public class CDORevisableImpl extends CDOBranchVersionImpl implements CDORevisable
-{
- private long timeStamp;
-
- private long revised;
-
- public CDORevisableImpl(CDOBranch branch, int version, long timeStamp, long revised)
- {
- super(branch, version);
- this.timeStamp = timeStamp;
- this.revised = revised;
- }
-
- public CDORevisableImpl(CDORevisable source)
- {
- super(source.getBranch(), source.getVersion());
- timeStamp = source.getTimeStamp();
- revised = source.getRevised();
- }
-
- public CDORevisableImpl(CDOBranch branch, int version)
- {
- super(branch, version);
- }
-
- public long getTimeStamp()
- {
- return timeStamp;
- }
-
- public long getRevised()
- {
- return revised;
- }
-
- @Override
- public int hashCode()
- {
- return ObjectUtil.hashCode(timeStamp) ^ ObjectUtil.hashCode(revised) ^ super.hashCode();
- }
-
- @Override
- public boolean equals(Object obj)
- {
- if (obj == this)
- {
- return true;
- }
-
- if (obj instanceof CDORevisable)
- {
- CDORevisable that = (CDORevisable)obj;
- return timeStamp == that.getTimeStamp() && revised == that.getRevised() && getBranch().equals(that.getBranch())
- && getVersion() == that.getVersion();
- }
-
- return false;
- }
-
- @Override
- public String toString()
- {
- return MessageFormat.format("{0}v{1}[{2}-{3}]", getBranch().getID(), getVersion(),
- CDOCommonUtil.formatTimeStamp(timeStamp), CDOCommonUtil.formatTimeStamp(revised));
- }
-}
+/*
+ * Copyright (c) 2004 - 2012 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.revision;
+
+import org.eclipse.emf.cdo.common.branch.CDOBranch;
+import org.eclipse.emf.cdo.common.revision.CDORevisable;
+import org.eclipse.emf.cdo.common.util.CDOCommonUtil;
+import org.eclipse.emf.cdo.internal.common.branch.CDOBranchVersionImpl;
+
+import org.eclipse.net4j.util.ObjectUtil;
+
+import java.text.MessageFormat;
+
+/**
+ * @author Eike Stepper
+ */
+public class CDORevisableImpl extends CDOBranchVersionImpl implements CDORevisable
+{
+ private long timeStamp;
+
+ private long revised;
+
+ public CDORevisableImpl(CDOBranch branch, int version, long timeStamp, long revised)
+ {
+ super(branch, version);
+ this.timeStamp = timeStamp;
+ this.revised = revised;
+ }
+
+ public CDORevisableImpl(CDORevisable source)
+ {
+ super(source.getBranch(), source.getVersion());
+ timeStamp = source.getTimeStamp();
+ revised = source.getRevised();
+ }
+
+ public CDORevisableImpl(CDOBranch branch, int version)
+ {
+ super(branch, version);
+ }
+
+ public long getTimeStamp()
+ {
+ return timeStamp;
+ }
+
+ public long getRevised()
+ {
+ return revised;
+ }
+
+ @Override
+ public int hashCode()
+ {
+ return ObjectUtil.hashCode(timeStamp) ^ ObjectUtil.hashCode(revised) ^ super.hashCode();
+ }
+
+ @Override
+ public boolean equals(Object obj)
+ {
+ if (obj == this)
+ {
+ return true;
+ }
+
+ if (obj instanceof CDORevisable)
+ {
+ CDORevisable that = (CDORevisable)obj;
+ return timeStamp == that.getTimeStamp() && revised == that.getRevised() && getBranch().equals(that.getBranch())
+ && getVersion() == that.getVersion();
+ }
+
+ return false;
+ }
+
+ @Override
+ public String toString()
+ {
+ return MessageFormat.format("{0}v{1}[{2}-{3}]", getBranch().getID(), getVersion(),
+ CDOCommonUtil.formatTimeStamp(timeStamp), CDOCommonUtil.formatTimeStamp(revised));
+ }
+}
diff --git a/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/internal/common/revision/CDORevisionCacheAuditing.java b/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/internal/common/revision/CDORevisionCacheAuditing.java
index c19cf28a81..41125adba2 100644
--- a/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/internal/common/revision/CDORevisionCacheAuditing.java
+++ b/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/internal/common/revision/CDORevisionCacheAuditing.java
@@ -1,443 +1,443 @@
-/*
- * Copyright (c) 2004 - 2011 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 - bug 201266
- * Simon McDuff - bug 230832
- */
-package org.eclipse.emf.cdo.internal.common.revision;
-
-import org.eclipse.emf.cdo.common.branch.CDOBranch;
-import org.eclipse.emf.cdo.common.branch.CDOBranchPoint;
-import org.eclipse.emf.cdo.common.branch.CDOBranchVersion;
-import org.eclipse.emf.cdo.common.id.CDOID;
-import org.eclipse.emf.cdo.common.revision.CDORevision;
-import org.eclipse.emf.cdo.common.revision.CDORevisionKey;
-import org.eclipse.emf.cdo.internal.common.bundle.OM;
-import org.eclipse.emf.cdo.spi.common.revision.InternalCDORevision;
-import org.eclipse.emf.cdo.spi.common.revision.InternalCDORevisionCache;
-
-import org.eclipse.net4j.util.CheckUtil;
-import org.eclipse.net4j.util.om.trace.ContextTracer;
-
-import org.eclipse.emf.ecore.EClass;
-
-import java.lang.ref.Reference;
-import java.util.ArrayList;
-import java.util.HashMap;
-import java.util.Iterator;
-import java.util.LinkedList;
-import java.util.List;
-import java.util.ListIterator;
-import java.util.Map;
-
-/**
- * @author Eike Stepper
- */
-public class CDORevisionCacheAuditing extends AbstractCDORevisionCache
-{
- private static final ContextTracer TRACER = new ContextTracer(OM.DEBUG_REVISION, CDORevisionCacheAuditing.class);
-
- protected Map<Object, RevisionList> revisionLists = new HashMap<Object, RevisionList>();
-
- public CDORevisionCacheAuditing()
- {
- }
-
- public InternalCDORevisionCache instantiate(CDORevision revision)
- {
- return new CDORevisionCacheAuditing();
- }
-
- public EClass getObjectType(CDOID id)
- {
- synchronized (revisionLists)
- {
- RevisionList revisionList = revisionLists.get(id);
- if (revisionList != null && !revisionList.isEmpty())
- {
- Reference<InternalCDORevision> ref = revisionList.getFirst();
- InternalCDORevision revision = ref.get();
- if (revision != null)
- {
- return revision.getEClass();
- }
- }
-
- return null;
- }
- }
-
- public InternalCDORevision getRevision(CDOID id, CDOBranchPoint branchPoint)
- {
- RevisionList revisionList = getRevisionList(id, branchPoint.getBranch());
- if (revisionList != null)
- {
- return revisionList.getRevision(branchPoint.getTimeStamp());
- }
-
- return null;
- }
-
- public InternalCDORevision getRevisionByVersion(CDOID id, CDOBranchVersion branchVersion)
- {
- RevisionList revisionList = getRevisionList(id, branchVersion.getBranch());
- if (revisionList != null)
- {
- return revisionList.getRevisionByVersion(branchVersion.getVersion());
- }
-
- return null;
- }
-
- public List<CDORevision> getCurrentRevisions()
- {
- List<CDORevision> currentRevisions = new ArrayList<CDORevision>();
- synchronized (revisionLists)
- {
- for (RevisionList revisionList : revisionLists.values())
- {
- InternalCDORevision revision = revisionList.getRevision(CDORevision.UNSPECIFIED_DATE);
- if (revision != null)
- {
- currentRevisions.add(revision);
- }
- }
- }
-
- return currentRevisions;
- }
-
- public Map<CDOBranch, List<CDORevision>> getAllRevisions()
- {
- Map<CDOBranch, List<CDORevision>> result = new HashMap<CDOBranch, List<CDORevision>>();
- synchronized (revisionLists)
- {
- for (RevisionList list : revisionLists.values())
- {
- list.getAllRevisions(result);
- }
- }
-
- return result;
- }
-
- public List<CDORevision> getRevisions(CDOBranchPoint branchPoint)
- {
- List<CDORevision> result = new ArrayList<CDORevision>();
- CDOBranch branch = branchPoint.getBranch();
- synchronized (revisionLists)
- {
- for (Map.Entry<Object, RevisionList> entry : revisionLists.entrySet())
- {
- if (isKeyInBranch(entry.getKey(), branch))
- // if (ObjectUtil.equals(entry.getKey().getBranch(), branch))
- {
- RevisionList list = entry.getValue();
- InternalCDORevision revision = list.getRevision(branchPoint.getTimeStamp());
- if (revision != null)
- {
- result.add(revision);
- }
- }
- }
- }
-
- return result;
- }
-
- public void addRevision(CDORevision revision)
- {
- CheckUtil.checkArg(revision, "revision");
-
- CDOID id = revision.getID();
- Object key = createKey(id, revision.getBranch());
-
- synchronized (revisionLists)
- {
- RevisionList list = revisionLists.get(key);
- if (list == null)
- {
- list = new RevisionList();
- revisionLists.put(key, list);
- }
-
- list.addRevision((InternalCDORevision)revision, createReference(revision));
- typeRefIncrease(id, revision.getEClass());
- }
- }
-
- public InternalCDORevision removeRevision(CDOID id, CDOBranchVersion branchVersion)
- {
- Object key = createKey(id, branchVersion.getBranch());
- synchronized (revisionLists)
- {
- RevisionList list = revisionLists.get(key);
- if (list != null)
- {
- list.removeRevision(branchVersion.getVersion());
- if (list.isEmpty())
- {
- revisionLists.remove(key);
- typeRefDecrease(id);
-
- if (TRACER.isEnabled())
- {
- TRACER.format("Removed cache list of {0}", key); //$NON-NLS-1$
- }
- }
- }
- }
-
- return null;
- }
-
- public void clear()
- {
- synchronized (revisionLists)
- {
- revisionLists.clear();
- typeRefDispose();
- }
- }
-
- @Override
- public String toString()
- {
- synchronized (revisionLists)
- {
- return revisionLists.toString();
- }
- }
-
- protected void typeRefIncrease(CDOID id, EClass type)
- {
- // Do nothing
- }
-
- protected void typeRefDecrease(CDOID id)
- {
- // Do nothing
- }
-
- protected void typeRefDispose()
- {
- // Do nothing
- }
-
- protected Object createKey(CDOID id, CDOBranch branch)
- {
- return id;
- }
-
- protected boolean isKeyInBranch(Object key, CDOBranch branch)
- {
- return true;
- }
-
- protected RevisionList getRevisionList(CDOID id, CDOBranch branch)
- {
- Object key = createKey(id, branch);
- synchronized (revisionLists)
- {
- return revisionLists.get(key);
- }
- }
-
- /**
- * @author Eike Stepper
- */
- protected static final class RevisionList extends LinkedList<Reference<InternalCDORevision>>
- {
- private static final long serialVersionUID = 1L;
-
- public RevisionList()
- {
- }
-
- public synchronized InternalCDORevision getRevision(long timeStamp)
- {
- if (timeStamp == CDORevision.UNSPECIFIED_DATE)
- {
- Reference<InternalCDORevision> ref = isEmpty() ? null : getFirst();
- if (ref != null)
- {
- InternalCDORevision revision = ref.get();
- if (revision != null)
- {
- if (!revision.isHistorical())
- {
- return revision;
- }
- }
- else
- {
- removeFirst();
- }
- }
-
- return null;
- }
-
- for (Iterator<Reference<InternalCDORevision>> it = iterator(); it.hasNext();)
- {
- Reference<InternalCDORevision> ref = it.next();
- InternalCDORevision revision = ref.get();
- if (revision != null)
- {
- long created = revision.getTimeStamp();
- if (created <= timeStamp)
- {
- long revised = revision.getRevised();
- if (timeStamp <= revised || revised == CDORevision.UNSPECIFIED_DATE)
- {
- return revision;
- }
-
- break;
- }
- }
- else
- {
- it.remove();
- }
- }
-
- return null;
- }
-
- public synchronized InternalCDORevision getRevisionByVersion(int version)
- {
- for (Iterator<Reference<InternalCDORevision>> it = iterator(); it.hasNext();)
- {
- Reference<InternalCDORevision> ref = it.next();
- InternalCDORevision revision = ref.get();
- if (revision != null)
- {
- int v = revision.getVersion();
- if (v == version)
- {
- return revision;
- }
- else if (v < version)
- {
- break;
- }
- }
- else
- {
- it.remove();
- }
- }
-
- return null;
- }
-
- public synchronized boolean addRevision(InternalCDORevision revision, Reference<InternalCDORevision> reference)
- {
- int version = revision.getVersion();
- for (ListIterator<Reference<InternalCDORevision>> it = listIterator(); it.hasNext();)
- {
- Reference<InternalCDORevision> ref = it.next();
- InternalCDORevision foundRevision = ref.get();
- if (foundRevision != null)
- {
- CDORevisionKey key = (CDORevisionKey)ref;
- int v = key.getVersion();
- if (v == version)
- {
- return false;
- }
-
- if (v < version)
- {
- it.previous();
- it.add(reference);
- return true;
- }
- }
- else
- {
- it.remove();
- }
- }
-
- addLast(reference);
- return true;
- }
-
- public synchronized void removeRevision(int version)
- {
- for (Iterator<Reference<InternalCDORevision>> it = iterator(); it.hasNext();)
- {
- Reference<InternalCDORevision> ref = it.next();
- CDORevisionKey key = (CDORevisionKey)ref;
- int v = key.getVersion();
- if (v == version)
- {
- it.remove();
- if (TRACER.isEnabled())
- {
- TRACER.format("Removed version {0} from cache list of {1}", version, key.getID()); //$NON-NLS-1$
- }
-
- break;
- }
- else if (v < version)
- {
- break;
- }
- }
- }
-
- @Override
- public String toString()
- {
- StringBuffer buffer = new StringBuffer();
- for (Iterator<Reference<InternalCDORevision>> it = iterator(); it.hasNext();)
- {
- Reference<InternalCDORevision> ref = it.next();
- InternalCDORevision revision = ref.get();
- if (buffer.length() == 0)
- {
- buffer.append("{");
- }
- else
- {
- buffer.append(", ");
- }
-
- buffer.append(revision);
- }
-
- buffer.append("}");
- return buffer.toString();
- }
-
- public void getAllRevisions(Map<CDOBranch, List<CDORevision>> result)
- {
- for (Iterator<Reference<InternalCDORevision>> it = iterator(); it.hasNext();)
- {
- Reference<InternalCDORevision> ref = it.next();
- InternalCDORevision revision = ref.get();
- if (revision != null)
- {
- CDOBranch branch = revision.getBranch();
- List<CDORevision> resultList = result.get(branch);
- if (resultList == null)
- {
- resultList = new ArrayList<CDORevision>(1);
- result.put(branch, resultList);
- }
-
- resultList.add(revision);
- }
- }
- }
- }
-}
+/*
+ * Copyright (c) 2004 - 2012 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 - bug 201266
+ * Simon McDuff - bug 230832
+ */
+package org.eclipse.emf.cdo.internal.common.revision;
+
+import org.eclipse.emf.cdo.common.branch.CDOBranch;
+import org.eclipse.emf.cdo.common.branch.CDOBranchPoint;
+import org.eclipse.emf.cdo.common.branch.CDOBranchVersion;
+import org.eclipse.emf.cdo.common.id.CDOID;
+import org.eclipse.emf.cdo.common.revision.CDORevision;
+import org.eclipse.emf.cdo.common.revision.CDORevisionKey;
+import org.eclipse.emf.cdo.internal.common.bundle.OM;
+import org.eclipse.emf.cdo.spi.common.revision.InternalCDORevision;
+import org.eclipse.emf.cdo.spi.common.revision.InternalCDORevisionCache;
+
+import org.eclipse.net4j.util.CheckUtil;
+import org.eclipse.net4j.util.om.trace.ContextTracer;
+
+import org.eclipse.emf.ecore.EClass;
+
+import java.lang.ref.Reference;
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.Iterator;
+import java.util.LinkedList;
+import java.util.List;
+import java.util.ListIterator;
+import java.util.Map;
+
+/**
+ * @author Eike Stepper
+ */
+public class CDORevisionCacheAuditing extends AbstractCDORevisionCache
+{
+ private static final ContextTracer TRACER = new ContextTracer(OM.DEBUG_REVISION, CDORevisionCacheAuditing.class);
+
+ protected Map<Object, RevisionList> revisionLists = new HashMap<Object, RevisionList>();
+
+ public CDORevisionCacheAuditing()
+ {
+ }
+
+ public InternalCDORevisionCache instantiate(CDORevision revision)
+ {
+ return new CDORevisionCacheAuditing();
+ }
+
+ public EClass getObjectType(CDOID id)
+ {
+ synchronized (revisionLists)
+ {
+ RevisionList revisionList = revisionLists.get(id);
+ if (revisionList != null && !revisionList.isEmpty())
+ {
+ Reference<InternalCDORevision> ref = revisionList.getFirst();
+ InternalCDORevision revision = ref.get();
+ if (revision != null)
+ {
+ return revision.getEClass();
+ }
+ }
+
+ return null;
+ }
+ }
+
+ public InternalCDORevision getRevision(CDOID id, CDOBranchPoint branchPoint)
+ {
+ RevisionList revisionList = getRevisionList(id, branchPoint.getBranch());
+ if (revisionList != null)
+ {
+ return revisionList.getRevision(branchPoint.getTimeStamp());
+ }
+
+ return null;
+ }
+
+ public InternalCDORevision getRevisionByVersion(CDOID id, CDOBranchVersion branchVersion)
+ {
+ RevisionList revisionList = getRevisionList(id, branchVersion.getBranch());
+ if (revisionList != null)
+ {
+ return revisionList.getRevisionByVersion(branchVersion.getVersion());
+ }
+
+ return null;
+ }
+
+ public List<CDORevision> getCurrentRevisions()
+ {
+ List<CDORevision> currentRevisions = new ArrayList<CDORevision>();
+ synchronized (revisionLists)
+ {
+ for (RevisionList revisionList : revisionLists.values())
+ {
+ InternalCDORevision revision = revisionList.getRevision(CDORevision.UNSPECIFIED_DATE);
+ if (revision != null)
+ {
+ currentRevisions.add(revision);
+ }
+ }
+ }
+
+ return currentRevisions;
+ }
+
+ public Map<CDOBranch, List<CDORevision>> getAllRevisions()
+ {
+ Map<CDOBranch, List<CDORevision>> result = new HashMap<CDOBranch, List<CDORevision>>();
+ synchronized (revisionLists)
+ {
+ for (RevisionList list : revisionLists.values())
+ {
+ list.getAllRevisions(result);
+ }
+ }
+
+ return result;
+ }
+
+ public List<CDORevision> getRevisions(CDOBranchPoint branchPoint)
+ {
+ List<CDORevision> result = new ArrayList<CDORevision>();
+ CDOBranch branch = branchPoint.getBranch();
+ synchronized (revisionLists)
+ {
+ for (Map.Entry<Object, RevisionList> entry : revisionLists.entrySet())
+ {
+ if (isKeyInBranch(entry.getKey(), branch))
+ // if (ObjectUtil.equals(entry.getKey().getBranch(), branch))
+ {
+ RevisionList list = entry.getValue();
+ InternalCDORevision revision = list.getRevision(branchPoint.getTimeStamp());
+ if (revision != null)
+ {
+ result.add(revision);
+ }
+ }
+ }
+ }
+
+ return result;
+ }
+
+ public void addRevision(CDORevision revision)
+ {
+ CheckUtil.checkArg(revision, "revision");
+
+ CDOID id = revision.getID();
+ Object key = createKey(id, revision.getBranch());
+
+ synchronized (revisionLists)
+ {
+ RevisionList list = revisionLists.get(key);
+ if (list == null)
+ {
+ list = new RevisionList();
+ revisionLists.put(key, list);
+ }
+
+ list.addRevision((InternalCDORevision)revision, createReference(revision));
+ typeRefIncrease(id, revision.getEClass());
+ }
+ }
+
+ public InternalCDORevision removeRevision(CDOID id, CDOBranchVersion branchVersion)
+ {
+ Object key = createKey(id, branchVersion.getBranch());
+ synchronized (revisionLists)
+ {
+ RevisionList list = revisionLists.get(key);
+ if (list != null)
+ {
+ list.removeRevision(branchVersion.getVersion());
+ if (list.isEmpty())
+ {
+ revisionLists.remove(key);
+ typeRefDecrease(id);
+
+ if (TRACER.isEnabled())
+ {
+ TRACER.format("Removed cache list of {0}", key); //$NON-NLS-1$
+ }
+ }
+ }
+ }
+
+ return null;
+ }
+
+ public void clear()
+ {
+ synchronized (revisionLists)
+ {
+ revisionLists.clear();
+ typeRefDispose();
+ }
+ }
+
+ @Override
+ public String toString()
+ {
+ synchronized (revisionLists)
+ {
+ return revisionLists.toString();
+ }
+ }
+
+ protected void typeRefIncrease(CDOID id, EClass type)
+ {
+ // Do nothing
+ }
+
+ protected void typeRefDecrease(CDOID id)
+ {
+ // Do nothing
+ }
+
+ protected void typeRefDispose()
+ {
+ // Do nothing
+ }
+
+ protected Object createKey(CDOID id, CDOBranch branch)
+ {
+ return id;
+ }
+
+ protected boolean isKeyInBranch(Object key, CDOBranch branch)
+ {
+ return true;
+ }
+
+ protected RevisionList getRevisionList(CDOID id, CDOBranch branch)
+ {
+ Object key = createKey(id, branch);
+ synchronized (revisionLists)
+ {
+ return revisionLists.get(key);
+ }
+ }
+
+ /**
+ * @author Eike Stepper
+ */
+ protected static final class RevisionList extends LinkedList<Reference<InternalCDORevision>>
+ {
+ private static final long serialVersionUID = 1L;
+
+ public RevisionList()
+ {
+ }
+
+ public synchronized InternalCDORevision getRevision(long timeStamp)
+ {
+ if (timeStamp == CDORevision.UNSPECIFIED_DATE)
+ {
+ Reference<InternalCDORevision> ref = isEmpty() ? null : getFirst();
+ if (ref != null)
+ {
+ InternalCDORevision revision = ref.get();
+ if (revision != null)
+ {
+ if (!revision.isHistorical())
+ {
+ return revision;
+ }
+ }
+ else
+ {
+ removeFirst();
+ }
+ }
+
+ return null;
+ }
+
+ for (Iterator<Reference<InternalCDORevision>> it = iterator(); it.hasNext();)
+ {
+ Reference<InternalCDORevision> ref = it.next();
+ InternalCDORevision revision = ref.get();
+ if (revision != null)
+ {
+ long created = revision.getTimeStamp();
+ if (created <= timeStamp)
+ {
+ long revised = revision.getRevised();
+ if (timeStamp <= revised || revised == CDORevision.UNSPECIFIED_DATE)
+ {
+ return revision;
+ }
+
+ break;
+ }
+ }
+ else
+ {
+ it.remove();
+ }
+ }
+
+ return null;
+ }
+
+ public synchronized InternalCDORevision getRevisionByVersion(int version)
+ {
+ for (Iterator<Reference<InternalCDORevision>> it = iterator(); it.hasNext();)
+ {
+ Reference<InternalCDORevision> ref = it.next();
+ InternalCDORevision revision = ref.get();
+ if (revision != null)
+ {
+ int v = revision.getVersion();
+ if (v == version)
+ {
+ return revision;
+ }
+ else if (v < version)
+ {
+ break;
+ }
+ }
+ else
+ {
+ it.remove();
+ }
+ }
+
+ return null;
+ }
+
+ public synchronized boolean addRevision(InternalCDORevision revision, Reference<InternalCDORevision> reference)
+ {
+ int version = revision.getVersion();
+ for (ListIterator<Reference<InternalCDORevision>> it = listIterator(); it.hasNext();)
+ {
+ Reference<InternalCDORevision> ref = it.next();
+ InternalCDORevision foundRevision = ref.get();
+ if (foundRevision != null)
+ {
+ CDORevisionKey key = (CDORevisionKey)ref;
+ int v = key.getVersion();
+ if (v == version)
+ {
+ return false;
+ }
+
+ if (v < version)
+ {
+ it.previous();
+ it.add(reference);
+ return true;
+ }
+ }
+ else
+ {
+ it.remove();
+ }
+ }
+
+ addLast(reference);
+ return true;
+ }
+
+ public synchronized void removeRevision(int version)
+ {
+ for (Iterator<Reference<InternalCDORevision>> it = iterator(); it.hasNext();)
+ {
+ Reference<InternalCDORevision> ref = it.next();
+ CDORevisionKey key = (CDORevisionKey)ref;
+ int v = key.getVersion();
+ if (v == version)
+ {
+ it.remove();
+ if (TRACER.isEnabled())
+ {
+ TRACER.format("Removed version {0} from cache list of {1}", version, key.getID()); //$NON-NLS-1$
+ }
+
+ break;
+ }
+ else if (v < version)
+ {
+ break;
+ }
+ }
+ }
+
+ @Override
+ public String toString()
+ {
+ StringBuffer buffer = new StringBuffer();
+ for (Iterator<Reference<InternalCDORevision>> it = iterator(); it.hasNext();)
+ {
+ Reference<InternalCDORevision> ref = it.next();
+ InternalCDORevision revision = ref.get();
+ if (buffer.length() == 0)
+ {
+ buffer.append("{");
+ }
+ else
+ {
+ buffer.append(", ");
+ }
+
+ buffer.append(revision);
+ }
+
+ buffer.append("}");
+ return buffer.toString();
+ }
+
+ public void getAllRevisions(Map<CDOBranch, List<CDORevision>> result)
+ {
+ for (Iterator<Reference<InternalCDORevision>> it = iterator(); it.hasNext();)
+ {
+ Reference<InternalCDORevision> ref = it.next();
+ InternalCDORevision revision = ref.get();
+ if (revision != null)
+ {
+ CDOBranch branch = revision.getBranch();
+ List<CDORevision> resultList = result.get(branch);
+ if (resultList == null)
+ {
+ resultList = new ArrayList<CDORevision>(1);
+ result.put(branch, resultList);
+ }
+
+ resultList.add(revision);
+ }
+ }
+ }
+ }
+}
diff --git a/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/internal/common/revision/CDORevisionCacheBranching.java b/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/internal/common/revision/CDORevisionCacheBranching.java
index b6e14f108a..c099944732 100644
--- a/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/internal/common/revision/CDORevisionCacheBranching.java
+++ b/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/internal/common/revision/CDORevisionCacheBranching.java
@@ -1,131 +1,131 @@
-/*
- * Copyright (c) 2004 - 2011 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 - bug 201266
- * Simon McDuff - bug 230832
- */
-package org.eclipse.emf.cdo.internal.common.revision;
-
-import org.eclipse.emf.cdo.common.branch.CDOBranch;
-import org.eclipse.emf.cdo.common.id.CDOID;
-import org.eclipse.emf.cdo.common.id.CDOIDUtil;
-import org.eclipse.emf.cdo.common.revision.CDOIDAndBranch;
-import org.eclipse.emf.cdo.common.revision.CDORevision;
-import org.eclipse.emf.cdo.spi.common.revision.InternalCDORevisionCache;
-
-import org.eclipse.net4j.util.ObjectUtil;
-
-import org.eclipse.emf.ecore.EClass;
-
-import java.util.HashMap;
-import java.util.Map;
-
-/**
- * @author Eike Stepper
- */
-public class CDORevisionCacheBranching extends CDORevisionCacheAuditing
-{
- private Map<CDOID, TypeAndRefCounter> typeMap = new HashMap<CDOID, TypeAndRefCounter>();
-
- public CDORevisionCacheBranching()
- {
- }
-
- @Override
- public InternalCDORevisionCache instantiate(CDORevision revision)
- {
- return new CDORevisionCacheBranching();
- }
-
- @Override
- public EClass getObjectType(CDOID id)
- {
- synchronized (revisionLists)
- {
- TypeAndRefCounter typeCounter = typeMap.get(id);
- if (typeCounter != null)
- {
- return typeCounter.getType();
- }
-
- return null;
- }
- }
-
- @Override
- protected void typeRefIncrease(CDOID id, EClass type)
- {
- TypeAndRefCounter typeCounter = typeMap.get(id);
- if (typeCounter == null)
- {
- typeCounter = new TypeAndRefCounter(type);
- typeMap.put(id, typeCounter);
- }
-
- typeCounter.increase();
- }
-
- @Override
- protected void typeRefDecrease(CDOID id)
- {
- TypeAndRefCounter typeCounter = typeMap.get(id);
- if (typeCounter != null && typeCounter.decreaseAndGet() == 0)
- {
- typeMap.remove(id);
- }
- }
-
- @Override
- protected void typeRefDispose()
- {
- typeMap.clear();
- }
-
- @Override
- protected boolean isKeyInBranch(Object key, CDOBranch branch)
- {
- return ObjectUtil.equals(((CDOIDAndBranch)key).getBranch(), branch);
- }
-
- @Override
- protected Object createKey(CDOID id, CDOBranch branch)
- {
- return CDOIDUtil.createIDAndBranch(id, branch);
- }
-
- /**
- * @author Eike Stepper
- */
- private static final class TypeAndRefCounter
- {
- private EClass type;
-
- private int refCounter;
-
- public TypeAndRefCounter(EClass type)
- {
- this.type = type;
- }
-
- public EClass getType()
- {
- return type;
- }
-
- public void increase()
- {
- ++refCounter;
- }
-
- public int decreaseAndGet()
- {
- return --refCounter;
- }
- }
-}
+/*
+ * Copyright (c) 2004 - 2012 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 - bug 201266
+ * Simon McDuff - bug 230832
+ */
+package org.eclipse.emf.cdo.internal.common.revision;
+
+import org.eclipse.emf.cdo.common.branch.CDOBranch;
+import org.eclipse.emf.cdo.common.id.CDOID;
+import org.eclipse.emf.cdo.common.id.CDOIDUtil;
+import org.eclipse.emf.cdo.common.revision.CDOIDAndBranch;
+import org.eclipse.emf.cdo.common.revision.CDORevision;
+import org.eclipse.emf.cdo.spi.common.revision.InternalCDORevisionCache;
+
+import org.eclipse.net4j.util.ObjectUtil;
+
+import org.eclipse.emf.ecore.EClass;
+
+import java.util.HashMap;
+import java.util.Map;
+
+/**
+ * @author Eike Stepper
+ */
+public class CDORevisionCacheBranching extends CDORevisionCacheAuditing
+{
+ private Map<CDOID, TypeAndRefCounter> typeMap = new HashMap<CDOID, TypeAndRefCounter>();
+
+ public CDORevisionCacheBranching()
+ {
+ }
+
+ @Override
+ public InternalCDORevisionCache instantiate(CDORevision revision)
+ {
+ return new CDORevisionCacheBranching();
+ }
+
+ @Override
+ public EClass getObjectType(CDOID id)
+ {
+ synchronized (revisionLists)
+ {
+ TypeAndRefCounter typeCounter = typeMap.get(id);
+ if (typeCounter != null)
+ {
+ return typeCounter.getType();
+ }
+
+ return null;
+ }
+ }
+
+ @Override
+ protected void typeRefIncrease(CDOID id, EClass type)
+ {
+ TypeAndRefCounter typeCounter = typeMap.get(id);
+ if (typeCounter == null)
+ {
+ typeCounter = new TypeAndRefCounter(type);
+ typeMap.put(id, typeCounter);
+ }
+
+ typeCounter.increase();
+ }
+
+ @Override
+ protected void typeRefDecrease(CDOID id)
+ {
+ TypeAndRefCounter typeCounter = typeMap.get(id);
+ if (typeCounter != null && typeCounter.decreaseAndGet() == 0)
+ {
+ typeMap.remove(id);
+ }
+ }
+
+ @Override
+ protected void typeRefDispose()
+ {
+ typeMap.clear();
+ }
+
+ @Override
+ protected boolean isKeyInBranch(Object key, CDOBranch branch)
+ {
+ return ObjectUtil.equals(((CDOIDAndBranch)key).getBranch(), branch);
+ }
+
+ @Override
+ protected Object createKey(CDOID id, CDOBranch branch)
+ {
+ return CDOIDUtil.createIDAndBranch(id, branch);
+ }
+
+ /**
+ * @author Eike Stepper
+ */
+ private static final class TypeAndRefCounter
+ {
+ private EClass type;
+
+ private int refCounter;
+
+ public TypeAndRefCounter(EClass type)
+ {
+ this.type = type;
+ }
+
+ public EClass getType()
+ {
+ return type;
+ }
+
+ public void increase()
+ {
+ ++refCounter;
+ }
+
+ public int decreaseAndGet()
+ {
+ return --refCounter;
+ }
+ }
+}
diff --git a/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/internal/common/revision/CDORevisionCacheNonAuditing.java b/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/internal/common/revision/CDORevisionCacheNonAuditing.java
index a22694a0c4..4faa69bc04 100644
--- a/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/internal/common/revision/CDORevisionCacheNonAuditing.java
+++ b/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/internal/common/revision/CDORevisionCacheNonAuditing.java
@@ -1,217 +1,217 @@
-/*
- * Copyright (c) 2004 - 2011 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 - bug 201266
- * Simon McDuff - bug 230832
- */
-package org.eclipse.emf.cdo.internal.common.revision;
-
-import org.eclipse.emf.cdo.common.branch.CDOBranch;
-import org.eclipse.emf.cdo.common.branch.CDOBranchPoint;
-import org.eclipse.emf.cdo.common.branch.CDOBranchVersion;
-import org.eclipse.emf.cdo.common.id.CDOID;
-import org.eclipse.emf.cdo.common.revision.CDORevision;
-import org.eclipse.emf.cdo.spi.common.revision.InternalCDORevision;
-import org.eclipse.emf.cdo.spi.common.revision.InternalCDORevisionCache;
-
-import org.eclipse.net4j.util.CheckUtil;
-
-import org.eclipse.emf.ecore.EClass;
-
-import java.lang.ref.Reference;
-import java.util.ArrayList;
-import java.util.HashMap;
-import java.util.List;
-import java.util.Map;
-
-/**
- * @author Eike Stepper
- */
-public class CDORevisionCacheNonAuditing extends AbstractCDORevisionCache
-{
- private Map<CDOID, Reference<InternalCDORevision>> revisions = new HashMap<CDOID, Reference<InternalCDORevision>>();
-
- public CDORevisionCacheNonAuditing()
- {
- }
-
- public InternalCDORevisionCache instantiate(CDORevision revision)
- {
- return new CDORevisionCacheNonAuditing();
- }
-
- public EClass getObjectType(CDOID id)
- {
- synchronized (revisions)
- {
- Reference<InternalCDORevision> ref = revisions.get(id);
- if (ref != null)
- {
- InternalCDORevision revision = ref.get();
- if (revision != null)
- {
- return revision.getEClass();
- }
- }
-
- return null;
- }
- }
-
- public InternalCDORevision getRevision(CDOID id, CDOBranchPoint branchPoint)
- {
- synchronized (revisions)
- {
- Reference<InternalCDORevision> ref = revisions.get(id);
- if (ref != null)
- {
- InternalCDORevision revision = ref.get();
- if (revision != null && revision.isValid(branchPoint))
- {
- return revision;
- }
- }
-
- return null;
- }
- }
-
- public InternalCDORevision getRevisionByVersion(CDOID id, CDOBranchVersion branchVersion)
- {
- synchronized (revisions)
- {
- Reference<InternalCDORevision> ref = revisions.get(id);
- if (ref != null)
- {
- InternalCDORevision revision = ref.get();
- if (revision != null && revision.getVersion() == branchVersion.getVersion())
- {
- return revision;
- }
- }
-
- return null;
- }
- }
-
- public List<CDORevision> getCurrentRevisions()
- {
- List<CDORevision> currentRevisions = new ArrayList<CDORevision>();
- synchronized (revisions)
- {
- for (Reference<InternalCDORevision> ref : revisions.values())
- {
- InternalCDORevision revision = ref.get();
- if (revision != null && !revision.isHistorical())
- {
- currentRevisions.add(revision);
- }
- }
- }
-
- return currentRevisions;
- }
-
- public Map<CDOBranch, List<CDORevision>> getAllRevisions()
- {
- Map<CDOBranch, List<CDORevision>> result = new HashMap<CDOBranch, List<CDORevision>>();
- synchronized (revisions)
- {
- List<CDORevision> list = new ArrayList<CDORevision>();
- for (Reference<InternalCDORevision> ref : revisions.values())
- {
- InternalCDORevision revision = ref.get();
- if (revision != null)
- {
- list.add(revision);
- }
- }
-
- if (!list.isEmpty())
- {
- result.put(list.get(0).getBranch(), list);
- }
- }
-
- return result;
- }
-
- public List<CDORevision> getRevisions(CDOBranchPoint branchPoint)
- {
- List<CDORevision> result = new ArrayList<CDORevision>();
- synchronized (revisions)
- {
- for (Reference<InternalCDORevision> ref : revisions.values())
- {
- InternalCDORevision revision = ref.get();
- if (revision != null && revision.isValid(branchPoint))
- {
- result.add(revision);
- }
- }
- }
-
- return result;
- }
-
- public void addRevision(CDORevision revision)
- {
- CheckUtil.checkArg(revision, "revision");
- if (!revision.isHistorical())
- {
- synchronized (revisions)
- {
- revisions.put(revision.getID(), createReference(revision));
- }
- }
- }
-
- public InternalCDORevision removeRevision(CDOID id, CDOBranchVersion branchVersion)
- {
- synchronized (revisions)
- {
- Reference<InternalCDORevision> ref = revisions.get(id);
- if (ref != null)
- {
- InternalCDORevision revision = ref.get();
- if (revision != null)
- {
- if (revision.getVersion() == branchVersion.getVersion()) // No branch check needed in non-auditing
- {
- revisions.remove(id);
- return revision;
- }
- }
- else
- {
- revisions.remove(id);
- }
- }
- }
-
- return null;
- }
-
- public void clear()
- {
- synchronized (revisions)
- {
- revisions.clear();
- }
- }
-
- @Override
- public String toString()
- {
- synchronized (revisions)
- {
- return revisions.toString();
- }
- }
-}
+/*
+ * Copyright (c) 2004 - 2012 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 - bug 201266
+ * Simon McDuff - bug 230832
+ */
+package org.eclipse.emf.cdo.internal.common.revision;
+
+import org.eclipse.emf.cdo.common.branch.CDOBranch;
+import org.eclipse.emf.cdo.common.branch.CDOBranchPoint;
+import org.eclipse.emf.cdo.common.branch.CDOBranchVersion;
+import org.eclipse.emf.cdo.common.id.CDOID;
+import org.eclipse.emf.cdo.common.revision.CDORevision;
+import org.eclipse.emf.cdo.spi.common.revision.InternalCDORevision;
+import org.eclipse.emf.cdo.spi.common.revision.InternalCDORevisionCache;
+
+import org.eclipse.net4j.util.CheckUtil;
+
+import org.eclipse.emf.ecore.EClass;
+
+import java.lang.ref.Reference;
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+
+/**
+ * @author Eike Stepper
+ */
+public class CDORevisionCacheNonAuditing extends AbstractCDORevisionCache
+{
+ private Map<CDOID, Reference<InternalCDORevision>> revisions = new HashMap<CDOID, Reference<InternalCDORevision>>();
+
+ public CDORevisionCacheNonAuditing()
+ {
+ }
+
+ public InternalCDORevisionCache instantiate(CDORevision revision)
+ {
+ return new CDORevisionCacheNonAuditing();
+ }
+
+ public EClass getObjectType(CDOID id)
+ {
+ synchronized (revisions)
+ {
+ Reference<InternalCDORevision> ref = revisions.get(id);
+ if (ref != null)
+ {
+ InternalCDORevision revision = ref.get();
+ if (revision != null)
+ {
+ return revision.getEClass();
+ }
+ }
+
+ return null;
+ }
+ }
+
+ public InternalCDORevision getRevision(CDOID id, CDOBranchPoint branchPoint)
+ {
+ synchronized (revisions)
+ {
+ Reference<InternalCDORevision> ref = revisions.get(id);
+ if (ref != null)
+ {
+ InternalCDORevision revision = ref.get();
+ if (revision != null && revision.isValid(branchPoint))
+ {
+ return revision;
+ }
+ }
+
+ return null;
+ }
+ }
+
+ public InternalCDORevision getRevisionByVersion(CDOID id, CDOBranchVersion branchVersion)
+ {
+ synchronized (revisions)
+ {
+ Reference<InternalCDORevision> ref = revisions.get(id);
+ if (ref != null)
+ {
+ InternalCDORevision revision = ref.get();
+ if (revision != null && revision.getVersion() == branchVersion.getVersion())
+ {
+ return revision;
+ }
+ }
+
+ return null;
+ }
+ }
+
+ public List<CDORevision> getCurrentRevisions()
+ {
+ List<CDORevision> currentRevisions = new ArrayList<CDORevision>();
+ synchronized (revisions)
+ {
+ for (Reference<InternalCDORevision> ref : revisions.values())
+ {
+ InternalCDORevision revision = ref.get();
+ if (revision != null && !revision.isHistorical())
+ {
+ currentRevisions.add(revision);
+ }
+ }
+ }
+
+ return currentRevisions;
+ }
+
+ public Map<CDOBranch, List<CDORevision>> getAllRevisions()
+ {
+ Map<CDOBranch, List<CDORevision>> result = new HashMap<CDOBranch, List<CDORevision>>();
+ synchronized (revisions)
+ {
+ List<CDORevision> list = new ArrayList<CDORevision>();
+ for (Reference<InternalCDORevision> ref : revisions.values())
+ {
+ InternalCDORevision revision = ref.get();
+ if (revision != null)
+ {
+ list.add(revision);
+ }
+ }
+
+ if (!list.isEmpty())
+ {
+ result.put(list.get(0).getBranch(), list);
+ }
+ }
+
+ return result;
+ }
+
+ public List<CDORevision> getRevisions(CDOBranchPoint branchPoint)
+ {
+ List<CDORevision> result = new ArrayList<CDORevision>();
+ synchronized (revisions)
+ {
+ for (Reference<InternalCDORevision> ref : revisions.values())
+ {
+ InternalCDORevision revision = ref.get();
+ if (revision != null && revision.isValid(branchPoint))
+ {
+ result.add(revision);
+ }
+ }
+ }
+
+ return result;
+ }
+
+ public void addRevision(CDORevision revision)
+ {
+ CheckUtil.checkArg(revision, "revision");
+ if (!revision.isHistorical())
+ {
+ synchronized (revisions)
+ {
+ revisions.put(revision.getID(), createReference(revision));
+ }
+ }
+ }
+
+ public InternalCDORevision removeRevision(CDOID id, CDOBranchVersion branchVersion)
+ {
+ synchronized (revisions)
+ {
+ Reference<InternalCDORevision> ref = revisions.get(id);
+ if (ref != null)
+ {
+ InternalCDORevision revision = ref.get();
+ if (revision != null)
+ {
+ if (revision.getVersion() == branchVersion.getVersion()) // No branch check needed in non-auditing
+ {
+ revisions.remove(id);
+ return revision;
+ }
+ }
+ else
+ {
+ revisions.remove(id);
+ }
+ }
+ }
+
+ return null;
+ }
+
+ public void clear()
+ {
+ synchronized (revisions)
+ {
+ revisions.clear();
+ }
+ }
+
+ @Override
+ public String toString()
+ {
+ synchronized (revisions)
+ {
+ return revisions.toString();
+ }
+ }
+}
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 96e21a207c..a5822febd2 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
@@ -1,143 +1,143 @@
-/*
- * Copyright (c) 2004 - 2011 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 - bug 201266
- * Simon McDuff - bug 212958
- * Simon McDuff - bug 213402
- * Caspar De Groot - bug 341081
- */
-package org.eclipse.emf.cdo.internal.common.revision;
-
-import org.eclipse.emf.cdo.common.id.CDOID;
-import org.eclipse.emf.cdo.common.id.CDOIDTemp;
-import org.eclipse.emf.cdo.common.model.CDOModelUtil;
-import org.eclipse.emf.cdo.common.model.CDOType;
-import org.eclipse.emf.cdo.spi.common.revision.BaseCDORevision;
-import org.eclipse.emf.cdo.spi.common.revision.InternalCDOList;
-import org.eclipse.emf.cdo.spi.common.revision.InternalCDORevision;
-
-import org.eclipse.emf.common.util.EList;
-import org.eclipse.emf.ecore.EClass;
-import org.eclipse.emf.ecore.EClassifier;
-import org.eclipse.emf.ecore.EStructuralFeature;
-
-/**
- * @author Eike Stepper
- */
-public class CDORevisionImpl extends BaseCDORevision
-{
- private Object[] values;
-
- private transient boolean frozen;
-
- public CDORevisionImpl(EClass eClass)
- {
- super(eClass);
- }
-
- protected CDORevisionImpl(CDORevisionImpl source)
- {
- super(source);
- EStructuralFeature[] features = CDOModelUtil.getAllPersistentFeatures(getEClass());
- initValues(features);
- for (int i = 0; i < features.length; i++)
- {
- EStructuralFeature feature = features[i];
- EClassifier classifier = feature.getEType();
- if (feature.isMany())
- {
- InternalCDOList sourceList = (InternalCDOList)source.values[i];
- if (sourceList != null)
- {
- setValue(i, sourceList.clone(classifier));
- }
- }
- else
- {
- CDOType type = CDOModelUtil.getType(feature);
- setValue(i, type.copyValue(source.values[i]));
- }
- }
- }
-
- public InternalCDORevision copy()
- {
- return new CDORevisionImpl(this);
- }
-
- @Override
- protected void initValues(EStructuralFeature[] allPersistentFeatures)
- {
- values = new Object[allPersistentFeatures.length];
- }
-
- @Override
- protected Object getValue(int featureIndex)
- {
- return values[featureIndex];
- }
-
- @Override
- protected void setValue(int featureIndex, Object value)
- {
- checkFrozen(featureIndex, value);
- values[featureIndex] = value;
- }
-
- public void freeze()
- {
- if (getEClass().getName().equals("Node"))
- {
- System.out.println();
- }
-
- frozen = true;
-
- EStructuralFeature[] features = CDOModelUtil.getAllPersistentFeatures(getEClass());
- for (int i = 0; i < features.length; i++)
- {
- EStructuralFeature feature = features[i];
- if (feature.isMany())
- {
- InternalCDOList list = (InternalCDOList)values[i];
- if (list != null)
- {
- list.freeze();
- }
- }
- }
- }
-
- private void checkFrozen(int featureIndex, Object value)
- {
- if (frozen)
- {
- Object oldValue = values[featureIndex];
-
- // Exception 1: Setting an empty list as the value for an isMany feature, is
- // allowed if the old value is null. This is a case of lazy initialization.
- boolean newIsEmptyList = value instanceof EList<?> && ((EList<?>)value).size() == 0;
- if (newIsEmptyList && oldValue == null)
- {
- return;
- }
-
- // Exception 2a: Replacing a temp ID with a regular ID is allowed (happens during
- // postCommit of new objects)
- // Exception 2b: Replacing a temp ID with another temp ID is also allowed (happens
- // when changes are imported in a PushTx).
- if (oldValue instanceof CDOIDTemp && value instanceof CDOID)
- {
- return;
- }
-
- throw new IllegalStateException("Cannot modify a frozen revision");
- }
- }
-}
+/*
+ * Copyright (c) 2004 - 2012 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 - bug 201266
+ * Simon McDuff - bug 212958
+ * Simon McDuff - bug 213402
+ * Caspar De Groot - bug 341081
+ */
+package org.eclipse.emf.cdo.internal.common.revision;
+
+import org.eclipse.emf.cdo.common.id.CDOID;
+import org.eclipse.emf.cdo.common.id.CDOIDTemp;
+import org.eclipse.emf.cdo.common.model.CDOModelUtil;
+import org.eclipse.emf.cdo.common.model.CDOType;
+import org.eclipse.emf.cdo.spi.common.revision.BaseCDORevision;
+import org.eclipse.emf.cdo.spi.common.revision.InternalCDOList;
+import org.eclipse.emf.cdo.spi.common.revision.InternalCDORevision;
+
+import org.eclipse.emf.common.util.EList;
+import org.eclipse.emf.ecore.EClass;
+import org.eclipse.emf.ecore.EClassifier;
+import org.eclipse.emf.ecore.EStructuralFeature;
+
+/**
+ * @author Eike Stepper
+ */
+public class CDORevisionImpl extends BaseCDORevision
+{
+ private Object[] values;
+
+ private transient boolean frozen;
+
+ public CDORevisionImpl(EClass eClass)
+ {
+ super(eClass);
+ }
+
+ protected CDORevisionImpl(CDORevisionImpl source)
+ {
+ super(source);
+ EStructuralFeature[] features = CDOModelUtil.getAllPersistentFeatures(getEClass());
+ initValues(features);
+ for (int i = 0; i < features.length; i++)
+ {
+ EStructuralFeature feature = features[i];
+ EClassifier classifier = feature.getEType();
+ if (feature.isMany())
+ {
+ InternalCDOList sourceList = (InternalCDOList)source.values[i];
+ if (sourceList != null)
+ {
+ setValue(i, sourceList.clone(classifier));
+ }
+ }
+ else
+ {
+ CDOType type = CDOModelUtil.getType(feature);
+ setValue(i, type.copyValue(source.values[i]));
+ }
+ }
+ }
+
+ public InternalCDORevision copy()
+ {
+ return new CDORevisionImpl(this);
+ }
+
+ @Override
+ protected void initValues(EStructuralFeature[] allPersistentFeatures)
+ {
+ values = new Object[allPersistentFeatures.length];
+ }
+
+ @Override
+ protected Object getValue(int featureIndex)
+ {
+ return values[featureIndex];
+ }
+
+ @Override
+ protected void setValue(int featureIndex, Object value)
+ {
+ checkFrozen(featureIndex, value);
+ values[featureIndex] = value;
+ }
+
+ public void freeze()
+ {
+ if (getEClass().getName().equals("Node"))
+ {
+ System.out.println();
+ }
+
+ frozen = true;
+
+ EStructuralFeature[] features = CDOModelUtil.getAllPersistentFeatures(getEClass());
+ for (int i = 0; i < features.length; i++)
+ {
+ EStructuralFeature feature = features[i];
+ if (feature.isMany())
+ {
+ InternalCDOList list = (InternalCDOList)values[i];
+ if (list != null)
+ {
+ list.freeze();
+ }
+ }
+ }
+ }
+
+ private void checkFrozen(int featureIndex, Object value)
+ {
+ if (frozen)
+ {
+ Object oldValue = values[featureIndex];
+
+ // Exception 1: Setting an empty list as the value for an isMany feature, is
+ // allowed if the old value is null. This is a case of lazy initialization.
+ boolean newIsEmptyList = value instanceof EList<?> && ((EList<?>)value).size() == 0;
+ if (newIsEmptyList && oldValue == null)
+ {
+ return;
+ }
+
+ // Exception 2a: Replacing a temp ID with a regular ID is allowed (happens during
+ // postCommit of new objects)
+ // Exception 2b: Replacing a temp ID with another temp ID is also allowed (happens
+ // when changes are imported in a PushTx).
+ if (oldValue instanceof CDOIDTemp && value instanceof CDOID)
+ {
+ return;
+ }
+
+ throw new IllegalStateException("Cannot modify a frozen revision");
+ }
+ }
+}
diff --git a/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/internal/common/revision/CDORevisionKeyImpl.java b/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/internal/common/revision/CDORevisionKeyImpl.java
index 0c3e4a72f0..c220b309a6 100644
--- a/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/internal/common/revision/CDORevisionKeyImpl.java
+++ b/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/internal/common/revision/CDORevisionKeyImpl.java
@@ -1,66 +1,66 @@
-/*
- * Copyright (c) 2004 - 2011 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.revision;
-
-import org.eclipse.emf.cdo.common.branch.CDOBranch;
-import org.eclipse.emf.cdo.common.id.CDOID;
-import org.eclipse.emf.cdo.common.revision.CDORevisionKey;
-import org.eclipse.emf.cdo.internal.common.branch.CDOBranchVersionImpl;
-
-import java.text.MessageFormat;
-
-/**
- * @author Eike Stepper
- */
-public class CDORevisionKeyImpl extends CDOBranchVersionImpl implements CDORevisionKey
-{
- private CDOID id;
-
- public CDORevisionKeyImpl(CDOID id, CDOBranch branch, int version)
- {
- super(branch, version);
- this.id = id;
- }
-
- public CDOID getID()
- {
- return id;
- }
-
- @Override
- public int hashCode()
- {
- return id.hashCode() ^ super.hashCode();
- }
-
- @Override
- public boolean equals(Object obj)
- {
- if (obj == this)
- {
- return true;
- }
-
- if (obj instanceof CDORevisionKey)
- {
- CDORevisionKey that = (CDORevisionKey)obj;
- return id.equals(that.getID()) && getBranch().equals(that.getBranch()) && getVersion() == that.getVersion();
- }
-
- return false;
- }
-
- @Override
- public String toString()
- {
- return MessageFormat.format("{0}:{1}v{2}", id, getBranch().getID(), getVersion());
- }
-}
+/*
+ * Copyright (c) 2004 - 2012 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.revision;
+
+import org.eclipse.emf.cdo.common.branch.CDOBranch;
+import org.eclipse.emf.cdo.common.id.CDOID;
+import org.eclipse.emf.cdo.common.revision.CDORevisionKey;
+import org.eclipse.emf.cdo.internal.common.branch.CDOBranchVersionImpl;
+
+import java.text.MessageFormat;
+
+/**
+ * @author Eike Stepper
+ */
+public class CDORevisionKeyImpl extends CDOBranchVersionImpl implements CDORevisionKey
+{
+ private CDOID id;
+
+ public CDORevisionKeyImpl(CDOID id, CDOBranch branch, int version)
+ {
+ super(branch, version);
+ this.id = id;
+ }
+
+ public CDOID getID()
+ {
+ return id;
+ }
+
+ @Override
+ public int hashCode()
+ {
+ return id.hashCode() ^ super.hashCode();
+ }
+
+ @Override
+ public boolean equals(Object obj)
+ {
+ if (obj == this)
+ {
+ return true;
+ }
+
+ if (obj instanceof CDORevisionKey)
+ {
+ CDORevisionKey that = (CDORevisionKey)obj;
+ return id.equals(that.getID()) && getBranch().equals(that.getBranch()) && getVersion() == that.getVersion();
+ }
+
+ return false;
+ }
+
+ @Override
+ public String toString()
+ {
+ return MessageFormat.format("{0}:{1}v{2}", id, getBranch().getID(), getVersion());
+ }
+}
diff --git a/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/internal/common/revision/CDORevisionManagerImpl.java b/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/internal/common/revision/CDORevisionManagerImpl.java
index 946938b0c0..00331a53d3 100644
--- a/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/internal/common/revision/CDORevisionManagerImpl.java
+++ b/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/internal/common/revision/CDORevisionManagerImpl.java
@@ -1,539 +1,539 @@
-/*
- * Copyright (c) 2004 - 2011 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 - bug 201266
- * Simon McDuff - bug 230832
- */
-package org.eclipse.emf.cdo.internal.common.revision;
-
-import org.eclipse.emf.cdo.common.branch.CDOBranch;
-import org.eclipse.emf.cdo.common.branch.CDOBranchManager;
-import org.eclipse.emf.cdo.common.branch.CDOBranchPoint;
-import org.eclipse.emf.cdo.common.branch.CDOBranchVersion;
-import org.eclipse.emf.cdo.common.id.CDOID;
-import org.eclipse.emf.cdo.common.revision.CDORevision;
-import org.eclipse.emf.cdo.common.revision.CDORevisionCache;
-import org.eclipse.emf.cdo.common.revision.CDORevisionFactory;
-import org.eclipse.emf.cdo.common.revision.CDORevisionUtil;
-import org.eclipse.emf.cdo.internal.common.bundle.OM;
-import org.eclipse.emf.cdo.spi.common.branch.CDOBranchUtil;
-import org.eclipse.emf.cdo.spi.common.revision.DetachedCDORevision;
-import org.eclipse.emf.cdo.spi.common.revision.InternalCDORevision;
-import org.eclipse.emf.cdo.spi.common.revision.InternalCDORevisionCache;
-import org.eclipse.emf.cdo.spi.common.revision.InternalCDORevisionManager;
-import org.eclipse.emf.cdo.spi.common.revision.PointerCDORevision;
-import org.eclipse.emf.cdo.spi.common.revision.RevisionInfo;
-import org.eclipse.emf.cdo.spi.common.revision.SyntheticCDORevision;
-
-import org.eclipse.net4j.util.ReflectUtil.ExcludeFromDump;
-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.Collections;
-import java.util.Iterator;
-import java.util.List;
-
-/**
- * @author Eike Stepper
- */
-public class CDORevisionManagerImpl extends Lifecycle implements InternalCDORevisionManager
-{
- private static final ContextTracer TRACER = new ContextTracer(OM.DEBUG_REVISION, CDORevisionManagerImpl.class);
-
- private boolean supportingAudits;
-
- private boolean supportingBranches;
-
- private RevisionLoader revisionLoader;
-
- private RevisionLocker revisionLocker;
-
- private CDORevisionFactory factory;
-
- private InternalCDORevisionCache cache;
-
- @ExcludeFromDump
- private transient Object loadAndAddLock = new Object()
- {
- @Override
- public String toString()
- {
- return "LoadAndAddLock"; //$NON-NLS-1$
- }
- };
-
- @ExcludeFromDump
- private transient Object reviseLock = new Object()
- {
- @Override
- public String toString()
- {
- return "ReviseLock"; //$NON-NLS-1$
- }
- };
-
- public CDORevisionManagerImpl()
- {
- }
-
- public boolean isSupportingAudits()
- {
- return supportingAudits;
- }
-
- public void setSupportingAudits(boolean on)
- {
- checkInactive();
- supportingAudits = on;
- }
-
- public boolean isSupportingBranches()
- {
- return supportingBranches;
- }
-
- public void setSupportingBranches(boolean on)
- {
- checkInactive();
- supportingBranches = on;
- }
-
- public RevisionLoader getRevisionLoader()
- {
- return revisionLoader;
- }
-
- public void setRevisionLoader(RevisionLoader revisionLoader)
- {
- checkInactive();
- this.revisionLoader = revisionLoader;
- }
-
- public RevisionLocker getRevisionLocker()
- {
- return revisionLocker;
- }
-
- public void setRevisionLocker(RevisionLocker revisionLocker)
- {
- checkInactive();
- this.revisionLocker = revisionLocker;
- }
-
- public CDORevisionFactory getFactory()
- {
- return factory;
- }
-
- public void setFactory(CDORevisionFactory factory)
- {
- checkInactive();
- this.factory = factory;
- }
-
- public InternalCDORevisionCache getCache()
- {
- return cache;
- }
-
- public void setCache(CDORevisionCache cache)
- {
- checkInactive();
- this.cache = (InternalCDORevisionCache)cache;
- }
-
- public EClass getObjectType(CDOID id, CDOBranchManager branchManagerForLoadOnDemand)
- {
- EClass type = cache.getObjectType(id);
- if (type == null && branchManagerForLoadOnDemand != null)
- {
- CDOBranch mainBranch = branchManagerForLoadOnDemand.getMainBranch();
- CDORevision revision = getRevisionByVersion(id, mainBranch.getVersion(CDOBranchVersion.FIRST_VERSION), 0, true);
- if (revision != null)
- {
- type = revision.getEClass();
- }
- }
-
- return type;
- }
-
- public EClass getObjectType(CDOID id)
- {
- return getObjectType(id, null);
- }
-
- public boolean containsRevision(CDOID id, CDOBranchPoint branchPoint)
- {
- if (supportingBranches)
- {
- return getRevision(id, branchPoint, CDORevision.UNCHUNKED, CDORevision.DEPTH_NONE, false, null) != null;
- }
-
- return getCachedRevision(id, branchPoint) != null;
- }
-
- public boolean containsRevisionByVersion(CDOID id, CDOBranchVersion branchVersion)
- {
- return cache.getRevisionByVersion(id, branchVersion) != null;
- }
-
- public void reviseLatest(CDOID id, CDOBranch branch)
- {
- acquireAtomicRequestLock(reviseLock);
-
- try
- {
- InternalCDORevision revision = (InternalCDORevision)cache.getRevision(id, branch.getHead());
- if (revision != null)
- {
- cache.removeRevision(id, branch.getVersion(revision.getVersion()));
- }
- }
- finally
- {
- releaseAtomicRequestLock(reviseLock);
- }
- }
-
- public void reviseVersion(CDOID id, CDOBranchVersion branchVersion, long timeStamp)
- {
- acquireAtomicRequestLock(reviseLock);
-
- try
- {
- InternalCDORevision revision = getCachedRevisionByVersion(id, branchVersion);
- if (revision != null)
- {
- if (timeStamp == CDORevision.UNSPECIFIED_DATE)
- {
- cache.removeRevision(id, branchVersion);
- }
- else
- {
- revision.setRevised(timeStamp - 1);
- }
- }
- }
- finally
- {
- releaseAtomicRequestLock(reviseLock);
- }
- }
-
- public InternalCDORevision getRevisionByVersion(CDOID id, CDOBranchVersion branchVersion, int referenceChunk,
- boolean loadOnDemand)
- {
- checkArg(branchVersion.getVersion() >= CDOBranchVersion.FIRST_VERSION,
- "Invalid version: " + branchVersion.getVersion());
- acquireAtomicRequestLock(loadAndAddLock);
-
- try
- {
- InternalCDORevision revision = getCachedRevisionByVersion(id, branchVersion);
- if (revision == null)
- {
- if (loadOnDemand)
- {
- if (TRACER.isEnabled())
- {
- TRACER.format("Loading revision {0} from {1}", id, branchVersion); //$NON-NLS-1$
- }
-
- revision = revisionLoader.loadRevisionByVersion(id, branchVersion, referenceChunk);
- addRevision(revision);
- }
- }
-
- return revision;
- }
- finally
- {
- releaseAtomicRequestLock(loadAndAddLock);
- }
- }
-
- public InternalCDORevision getRevision(CDOID id, CDOBranchPoint branchPoint, int referenceChunk, int prefetchDepth,
- boolean loadOnDemand)
- {
- return getRevision(id, branchPoint, referenceChunk, prefetchDepth, loadOnDemand, null);
- }
-
- public InternalCDORevision getRevision(CDOID id, CDOBranchPoint branchPoint, int referenceChunk, int prefetchDepth,
- boolean loadOnDemand, SyntheticCDORevision[] synthetics)
- {
- List<CDOID> ids = Collections.singletonList(id);
- CDORevision result = getRevisions(ids, branchPoint, referenceChunk, prefetchDepth, loadOnDemand, synthetics).get(0);
- return (InternalCDORevision)result;
- }
-
- public List<CDORevision> getRevisions(List<CDOID> ids, CDOBranchPoint branchPoint, int referenceChunk,
- int prefetchDepth, boolean loadOnDemand)
- {
- return getRevisions(ids, branchPoint, referenceChunk, prefetchDepth, loadOnDemand, null);
- }
-
- public List<CDORevision> getRevisions(List<CDOID> ids, CDOBranchPoint branchPoint, int referenceChunk,
- int prefetchDepth, boolean loadOnDemand, SyntheticCDORevision[] synthetics)
- {
- RevisionInfo[] infos = new RevisionInfo[ids.size()];
- List<RevisionInfo> infosToLoad = createRevisionInfos(ids, branchPoint, prefetchDepth, loadOnDemand, infos);
- if (infosToLoad != null)
- {
- loadRevisions(infosToLoad, branchPoint, referenceChunk, prefetchDepth);
- }
-
- return getResultsAndSynthetics(infos, synthetics);
- }
-
- private List<RevisionInfo> createRevisionInfos(List<CDOID> ids, CDOBranchPoint branchPoint, int prefetchDepth,
- boolean loadOnDemand, RevisionInfo[] infos)
- {
- List<RevisionInfo> infosToLoad = null;
- Iterator<CDOID> idIterator = ids.iterator();
- for (int i = 0; i < infos.length; i++)
- {
- CDOID id = idIterator.next();
- RevisionInfo info = createRevisionInfo(id, branchPoint);
- infos[i] = info;
-
- if (loadOnDemand && (prefetchDepth != CDORevision.DEPTH_NONE || info.isLoadNeeded()))
- {
- if (infosToLoad == null)
- {
- infosToLoad = new ArrayList<RevisionInfo>(1);
- }
-
- infosToLoad.add(info);
- }
- }
-
- return infosToLoad;
- }
-
- private RevisionInfo createRevisionInfo(CDOID id, CDOBranchPoint branchPoint)
- {
- InternalCDORevision revision = getCachedRevision(id, branchPoint);
- if (revision != null)
- {
- return createRevisionInfoAvailable(revision, branchPoint);
- }
-
- if (supportingBranches)
- {
- revision = getCachedRevisionRecursively(id, branchPoint);
- if (revision != null)
- {
- return createRevisionInfoAvailable(revision, branchPoint);
- }
- }
-
- return createRevisionInfoMissing(id, branchPoint);
- }
-
- private RevisionInfo.Available createRevisionInfoAvailable(InternalCDORevision revision,
- CDOBranchPoint requestedBranchPoint)
- {
- if (revision instanceof PointerCDORevision)
- {
- PointerCDORevision pointer = (PointerCDORevision)revision;
- CDOBranchVersion target = pointer.getTarget();
- InternalCDORevision targetRevision = target == null ? null : getCachedRevisionByVersion(pointer.getID(), target);
- if (targetRevision != null)
- {
- target = targetRevision;
- }
-
- return new RevisionInfo.Available.Pointer(pointer.getID(), requestedBranchPoint, pointer, target);
- }
-
- if (revision instanceof DetachedCDORevision)
- {
- DetachedCDORevision detached = (DetachedCDORevision)revision;
- return new RevisionInfo.Available.Detached(detached.getID(), requestedBranchPoint, detached);
- }
-
- return new RevisionInfo.Available.Normal(revision.getID(), requestedBranchPoint, revision);
- }
-
- private RevisionInfo.Missing createRevisionInfoMissing(CDOID id, CDOBranchPoint requestedBranchPoint)
- {
- return new RevisionInfo.Missing(id, requestedBranchPoint);
- }
-
- protected List<InternalCDORevision> loadRevisions(List<RevisionInfo> infosToLoad, CDOBranchPoint branchPoint,
- int referenceChunk, int prefetchDepth)
- {
- acquireAtomicRequestLock(loadAndAddLock);
-
- try
- {
- List<InternalCDORevision> additionalRevisions = //
- revisionLoader.loadRevisions(infosToLoad, branchPoint, referenceChunk, prefetchDepth);
-
- if (additionalRevisions != null)
- {
- for (InternalCDORevision revision : additionalRevisions)
- {
- addRevision(revision);
- }
- }
-
- return additionalRevisions;
- }
- finally
- {
- releaseAtomicRequestLock(loadAndAddLock);
- }
- }
-
- private List<CDORevision> getResultsAndSynthetics(RevisionInfo[] infos, SyntheticCDORevision[] synthetics)
- {
- List<CDORevision> results = new ArrayList<CDORevision>(infos.length);
- for (int i = 0; i < infos.length; i++)
- {
- RevisionInfo info = infos[i];
- info.processResult(this, results, synthetics, i);
- }
-
- return results;
- }
-
- public void addRevision(CDORevision revision)
- {
- if (revision != null)
- {
- acquireAtomicRequestLock(loadAndAddLock);
-
- try
- {
- if (revision instanceof PointerCDORevision)
- {
- PointerCDORevision pointer = (PointerCDORevision)revision;
- CDOBranchVersion target = pointer.getTarget();
- if (target instanceof InternalCDORevision)
- {
- revision = new PointerCDORevision(pointer.getEClass(), pointer.getID(), pointer.getBranch(),
- pointer.getRevised(), CDOBranchUtil.copyBranchVersion(target));
- }
- }
-
- int oldVersion = revision.getVersion() - 1;
- if (oldVersion >= CDORevision.UNSPECIFIED_VERSION)
- {
- CDOBranchVersion old = revision.getBranch().getVersion(oldVersion);
- InternalCDORevision oldRevision = getCachedRevisionByVersion(revision.getID(), old);
- if (!revision.isHistorical())
- {
- if (oldRevision != null)
- {
- oldRevision.setRevised(revision.getTimeStamp() - 1);
- }
- else
- {
- // Remove last revision from cache, which is not revised
- InternalCDORevision cachedLatestRevision = getCachedRevision(revision.getID(), revision);
- if (cachedLatestRevision != null && !cachedLatestRevision.isHistorical())
- {
- // Found revision is stale.
- // We cannot revise it now because of lack information, thus remove it from the cache
- cache.removeRevision(cachedLatestRevision.getID(), cachedLatestRevision);
- }
- }
- }
- }
-
- cache.addRevision(revision);
- }
- finally
- {
- releaseAtomicRequestLock(loadAndAddLock);
- }
- }
- }
-
- @Override
- protected void doBeforeActivate() throws Exception
- {
- super.doBeforeActivate();
- if (factory == null)
- {
- factory = CDORevisionFactory.DEFAULT;
- }
-
- if (cache == null)
- {
- cache = (InternalCDORevisionCache)CDORevisionUtil.createRevisionCache(supportingAudits, supportingBranches);
- }
- }
-
- @Override
- protected void doActivate() throws Exception
- {
- super.doActivate();
- LifecycleUtil.activate(cache);
- }
-
- @Override
- protected void doDeactivate() throws Exception
- {
- LifecycleUtil.deactivate(cache);
- super.doDeactivate();
- }
-
- private void acquireAtomicRequestLock(Object key)
- {
- if (revisionLocker != null)
- {
- revisionLocker.acquireAtomicRequestLock(key);
- }
- }
-
- private void releaseAtomicRequestLock(Object key)
- {
- if (revisionLocker != null)
- {
- revisionLocker.releaseAtomicRequestLock(key);
- }
- }
-
- private InternalCDORevision getCachedRevisionByVersion(CDOID id, CDOBranchVersion branchVersion)
- {
- return (InternalCDORevision)cache.getRevisionByVersion(id, branchVersion);
- }
-
- private InternalCDORevision getCachedRevision(CDOID id, CDOBranchPoint branchPoint)
- {
- return (InternalCDORevision)cache.getRevision(id, branchPoint);
- }
-
- private InternalCDORevision getCachedRevisionRecursively(CDOID id, CDOBranchPoint branchPoint)
- {
- CDOBranch branch = branchPoint.getBranch();
- if (!branch.isMainBranch())
- {
- CDOBranchPoint base = branch.getBase();
- InternalCDORevision revision = getCachedRevision(id, base);
- if (revision != null)
- {
- return revision;
- }
-
- // Recurse
- return getCachedRevisionRecursively(id, base);
- }
-
- // Reached main branch
- return null;
- }
-}
+/*
+ * Copyright (c) 2004 - 2012 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 - bug 201266
+ * Simon McDuff - bug 230832
+ */
+package org.eclipse.emf.cdo.internal.common.revision;
+
+import org.eclipse.emf.cdo.common.branch.CDOBranch;
+import org.eclipse.emf.cdo.common.branch.CDOBranchManager;
+import org.eclipse.emf.cdo.common.branch.CDOBranchPoint;
+import org.eclipse.emf.cdo.common.branch.CDOBranchVersion;
+import org.eclipse.emf.cdo.common.id.CDOID;
+import org.eclipse.emf.cdo.common.revision.CDORevision;
+import org.eclipse.emf.cdo.common.revision.CDORevisionCache;
+import org.eclipse.emf.cdo.common.revision.CDORevisionFactory;
+import org.eclipse.emf.cdo.common.revision.CDORevisionUtil;
+import org.eclipse.emf.cdo.internal.common.bundle.OM;
+import org.eclipse.emf.cdo.spi.common.branch.CDOBranchUtil;
+import org.eclipse.emf.cdo.spi.common.revision.DetachedCDORevision;
+import org.eclipse.emf.cdo.spi.common.revision.InternalCDORevision;
+import org.eclipse.emf.cdo.spi.common.revision.InternalCDORevisionCache;
+import org.eclipse.emf.cdo.spi.common.revision.InternalCDORevisionManager;
+import org.eclipse.emf.cdo.spi.common.revision.PointerCDORevision;
+import org.eclipse.emf.cdo.spi.common.revision.RevisionInfo;
+import org.eclipse.emf.cdo.spi.common.revision.SyntheticCDORevision;
+
+import org.eclipse.net4j.util.ReflectUtil.ExcludeFromDump;
+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.Collections;
+import java.util.Iterator;
+import java.util.List;
+
+/**
+ * @author Eike Stepper
+ */
+public class CDORevisionManagerImpl extends Lifecycle implements InternalCDORevisionManager
+{
+ private static final ContextTracer TRACER = new ContextTracer(OM.DEBUG_REVISION, CDORevisionManagerImpl.class);
+
+ private boolean supportingAudits;
+
+ private boolean supportingBranches;
+
+ private RevisionLoader revisionLoader;
+
+ private RevisionLocker revisionLocker;
+
+ private CDORevisionFactory factory;
+
+ private InternalCDORevisionCache cache;
+
+ @ExcludeFromDump
+ private transient Object loadAndAddLock = new Object()
+ {
+ @Override
+ public String toString()
+ {
+ return "LoadAndAddLock"; //$NON-NLS-1$
+ }
+ };
+
+ @ExcludeFromDump
+ private transient Object reviseLock = new Object()
+ {
+ @Override
+ public String toString()
+ {
+ return "ReviseLock"; //$NON-NLS-1$
+ }
+ };
+
+ public CDORevisionManagerImpl()
+ {
+ }
+
+ public boolean isSupportingAudits()
+ {
+ return supportingAudits;
+ }
+
+ public void setSupportingAudits(boolean on)
+ {
+ checkInactive();
+ supportingAudits = on;
+ }
+
+ public boolean isSupportingBranches()
+ {
+ return supportingBranches;
+ }
+
+ public void setSupportingBranches(boolean on)
+ {
+ checkInactive();
+ supportingBranches = on;
+ }
+
+ public RevisionLoader getRevisionLoader()
+ {
+ return revisionLoader;
+ }
+
+ public void setRevisionLoader(RevisionLoader revisionLoader)
+ {
+ checkInactive();
+ this.revisionLoader = revisionLoader;
+ }
+
+ public RevisionLocker getRevisionLocker()
+ {
+ return revisionLocker;
+ }
+
+ public void setRevisionLocker(RevisionLocker revisionLocker)
+ {
+ checkInactive();
+ this.revisionLocker = revisionLocker;
+ }
+
+ public CDORevisionFactory getFactory()
+ {
+ return factory;
+ }
+
+ public void setFactory(CDORevisionFactory factory)
+ {
+ checkInactive();
+ this.factory = factory;
+ }
+
+ public InternalCDORevisionCache getCache()
+ {
+ return cache;
+ }
+
+ public void setCache(CDORevisionCache cache)
+ {
+ checkInactive();
+ this.cache = (InternalCDORevisionCache)cache;
+ }
+
+ public EClass getObjectType(CDOID id, CDOBranchManager branchManagerForLoadOnDemand)
+ {
+ EClass type = cache.getObjectType(id);
+ if (type == null && branchManagerForLoadOnDemand != null)
+ {
+ CDOBranch mainBranch = branchManagerForLoadOnDemand.getMainBranch();
+ CDORevision revision = getRevisionByVersion(id, mainBranch.getVersion(CDOBranchVersion.FIRST_VERSION), 0, true);
+ if (revision != null)
+ {
+ type = revision.getEClass();
+ }
+ }
+
+ return type;
+ }
+
+ public EClass getObjectType(CDOID id)
+ {
+ return getObjectType(id, null);
+ }
+
+ public boolean containsRevision(CDOID id, CDOBranchPoint branchPoint)
+ {
+ if (supportingBranches)
+ {
+ return getRevision(id, branchPoint, CDORevision.UNCHUNKED, CDORevision.DEPTH_NONE, false, null) != null;
+ }
+
+ return getCachedRevision(id, branchPoint) != null;
+ }
+
+ public boolean containsRevisionByVersion(CDOID id, CDOBranchVersion branchVersion)
+ {
+ return cache.getRevisionByVersion(id, branchVersion) != null;
+ }
+
+ public void reviseLatest(CDOID id, CDOBranch branch)
+ {
+ acquireAtomicRequestLock(reviseLock);
+
+ try
+ {
+ InternalCDORevision revision = (InternalCDORevision)cache.getRevision(id, branch.getHead());
+ if (revision != null)
+ {
+ cache.removeRevision(id, branch.getVersion(revision.getVersion()));
+ }
+ }
+ finally
+ {
+ releaseAtomicRequestLock(reviseLock);
+ }
+ }
+
+ public void reviseVersion(CDOID id, CDOBranchVersion branchVersion, long timeStamp)
+ {
+ acquireAtomicRequestLock(reviseLock);
+
+ try
+ {
+ InternalCDORevision revision = getCachedRevisionByVersion(id, branchVersion);
+ if (revision != null)
+ {
+ if (timeStamp == CDORevision.UNSPECIFIED_DATE)
+ {
+ cache.removeRevision(id, branchVersion);
+ }
+ else
+ {
+ revision.setRevised(timeStamp - 1);
+ }
+ }
+ }
+ finally
+ {
+ releaseAtomicRequestLock(reviseLock);
+ }
+ }
+
+ public InternalCDORevision getRevisionByVersion(CDOID id, CDOBranchVersion branchVersion, int referenceChunk,
+ boolean loadOnDemand)
+ {
+ checkArg(branchVersion.getVersion() >= CDOBranchVersion.FIRST_VERSION,
+ "Invalid version: " + branchVersion.getVersion());
+ acquireAtomicRequestLock(loadAndAddLock);
+
+ try
+ {
+ InternalCDORevision revision = getCachedRevisionByVersion(id, branchVersion);
+ if (revision == null)
+ {
+ if (loadOnDemand)
+ {
+ if (TRACER.isEnabled())
+ {
+ TRACER.format("Loading revision {0} from {1}", id, branchVersion); //$NON-NLS-1$
+ }
+
+ revision = revisionLoader.loadRevisionByVersion(id, branchVersion, referenceChunk);
+ addRevision(revision);
+ }
+ }
+
+ return revision;
+ }
+ finally
+ {
+ releaseAtomicRequestLock(loadAndAddLock);
+ }
+ }
+
+ public InternalCDORevision getRevision(CDOID id, CDOBranchPoint branchPoint, int referenceChunk, int prefetchDepth,
+ boolean loadOnDemand)
+ {
+ return getRevision(id, branchPoint, referenceChunk, prefetchDepth, loadOnDemand, null);
+ }
+
+ public InternalCDORevision getRevision(CDOID id, CDOBranchPoint branchPoint, int referenceChunk, int prefetchDepth,
+ boolean loadOnDemand, SyntheticCDORevision[] synthetics)
+ {
+ List<CDOID> ids = Collections.singletonList(id);
+ CDORevision result = getRevisions(ids, branchPoint, referenceChunk, prefetchDepth, loadOnDemand, synthetics).get(0);
+ return (InternalCDORevision)result;
+ }
+
+ public List<CDORevision> getRevisions(List<CDOID> ids, CDOBranchPoint branchPoint, int referenceChunk,
+ int prefetchDepth, boolean loadOnDemand)
+ {
+ return getRevisions(ids, branchPoint, referenceChunk, prefetchDepth, loadOnDemand, null);
+ }
+
+ public List<CDORevision> getRevisions(List<CDOID> ids, CDOBranchPoint branchPoint, int referenceChunk,
+ int prefetchDepth, boolean loadOnDemand, SyntheticCDORevision[] synthetics)
+ {
+ RevisionInfo[] infos = new RevisionInfo[ids.size()];
+ List<RevisionInfo> infosToLoad = createRevisionInfos(ids, branchPoint, prefetchDepth, loadOnDemand, infos);
+ if (infosToLoad != null)
+ {
+ loadRevisions(infosToLoad, branchPoint, referenceChunk, prefetchDepth);
+ }
+
+ return getResultsAndSynthetics(infos, synthetics);
+ }
+
+ private List<RevisionInfo> createRevisionInfos(List<CDOID> ids, CDOBranchPoint branchPoint, int prefetchDepth,
+ boolean loadOnDemand, RevisionInfo[] infos)
+ {
+ List<RevisionInfo> infosToLoad = null;
+ Iterator<CDOID> idIterator = ids.iterator();
+ for (int i = 0; i < infos.length; i++)
+ {
+ CDOID id = idIterator.next();
+ RevisionInfo info = createRevisionInfo(id, branchPoint);
+ infos[i] = info;
+
+ if (loadOnDemand && (prefetchDepth != CDORevision.DEPTH_NONE || info.isLoadNeeded()))
+ {
+ if (infosToLoad == null)
+ {
+ infosToLoad = new ArrayList<RevisionInfo>(1);
+ }
+
+ infosToLoad.add(info);
+ }
+ }
+
+ return infosToLoad;
+ }
+
+ private RevisionInfo createRevisionInfo(CDOID id, CDOBranchPoint branchPoint)
+ {
+ InternalCDORevision revision = getCachedRevision(id, branchPoint);
+ if (revision != null)
+ {
+ return createRevisionInfoAvailable(revision, branchPoint);
+ }
+
+ if (supportingBranches)
+ {
+ revision = getCachedRevisionRecursively(id, branchPoint);
+ if (revision != null)
+ {
+ return createRevisionInfoAvailable(revision, branchPoint);
+ }
+ }
+
+ return createRevisionInfoMissing(id, branchPoint);
+ }
+
+ private RevisionInfo.Available createRevisionInfoAvailable(InternalCDORevision revision,
+ CDOBranchPoint requestedBranchPoint)
+ {
+ if (revision instanceof PointerCDORevision)
+ {
+ PointerCDORevision pointer = (PointerCDORevision)revision;
+ CDOBranchVersion target = pointer.getTarget();
+ InternalCDORevision targetRevision = target == null ? null : getCachedRevisionByVersion(pointer.getID(), target);
+ if (targetRevision != null)
+ {
+ target = targetRevision;
+ }
+
+ return new RevisionInfo.Available.Pointer(pointer.getID(), requestedBranchPoint, pointer, target);
+ }
+
+ if (revision instanceof DetachedCDORevision)
+ {
+ DetachedCDORevision detached = (DetachedCDORevision)revision;
+ return new RevisionInfo.Available.Detached(detached.getID(), requestedBranchPoint, detached);
+ }
+
+ return new RevisionInfo.Available.Normal(revision.getID(), requestedBranchPoint, revision);
+ }
+
+ private RevisionInfo.Missing createRevisionInfoMissing(CDOID id, CDOBranchPoint requestedBranchPoint)
+ {
+ return new RevisionInfo.Missing(id, requestedBranchPoint);
+ }
+
+ protected List<InternalCDORevision> loadRevisions(List<RevisionInfo> infosToLoad, CDOBranchPoint branchPoint,
+ int referenceChunk, int prefetchDepth)
+ {
+ acquireAtomicRequestLock(loadAndAddLock);
+
+ try
+ {
+ List<InternalCDORevision> additionalRevisions = //
+ revisionLoader.loadRevisions(infosToLoad, branchPoint, referenceChunk, prefetchDepth);
+
+ if (additionalRevisions != null)
+ {
+ for (InternalCDORevision revision : additionalRevisions)
+ {
+ addRevision(revision);
+ }
+ }
+
+ return additionalRevisions;
+ }
+ finally
+ {
+ releaseAtomicRequestLock(loadAndAddLock);
+ }
+ }
+
+ private List<CDORevision> getResultsAndSynthetics(RevisionInfo[] infos, SyntheticCDORevision[] synthetics)
+ {
+ List<CDORevision> results = new ArrayList<CDORevision>(infos.length);
+ for (int i = 0; i < infos.length; i++)
+ {
+ RevisionInfo info = infos[i];
+ info.processResult(this, results, synthetics, i);
+ }
+
+ return results;
+ }
+
+ public void addRevision(CDORevision revision)
+ {
+ if (revision != null)
+ {
+ acquireAtomicRequestLock(loadAndAddLock);
+
+ try
+ {
+ if (revision instanceof PointerCDORevision)
+ {
+ PointerCDORevision pointer = (PointerCDORevision)revision;
+ CDOBranchVersion target = pointer.getTarget();
+ if (target instanceof InternalCDORevision)
+ {
+ revision = new PointerCDORevision(pointer.getEClass(), pointer.getID(), pointer.getBranch(),
+ pointer.getRevised(), CDOBranchUtil.copyBranchVersion(target));
+ }
+ }
+
+ int oldVersion = revision.getVersion() - 1;
+ if (oldVersion >= CDORevision.UNSPECIFIED_VERSION)
+ {
+ CDOBranchVersion old = revision.getBranch().getVersion(oldVersion);
+ InternalCDORevision oldRevision = getCachedRevisionByVersion(revision.getID(), old);
+ if (!revision.isHistorical())
+ {
+ if (oldRevision != null)
+ {
+ oldRevision.setRevised(revision.getTimeStamp() - 1);
+ }
+ else
+ {
+ // Remove last revision from cache, which is not revised
+ InternalCDORevision cachedLatestRevision = getCachedRevision(revision.getID(), revision);
+ if (cachedLatestRevision != null && !cachedLatestRevision.isHistorical())
+ {
+ // Found revision is stale.
+ // We cannot revise it now because of lack information, thus remove it from the cache
+ cache.removeRevision(cachedLatestRevision.getID(), cachedLatestRevision);
+ }
+ }
+ }
+ }
+
+ cache.addRevision(revision);
+ }
+ finally
+ {
+ releaseAtomicRequestLock(loadAndAddLock);
+ }
+ }
+ }
+
+ @Override
+ protected void doBeforeActivate() throws Exception
+ {
+ super.doBeforeActivate();
+ if (factory == null)
+ {
+ factory = CDORevisionFactory.DEFAULT;
+ }
+
+ if (cache == null)
+ {
+ cache = (InternalCDORevisionCache)CDORevisionUtil.createRevisionCache(supportingAudits, supportingBranches);
+ }
+ }
+
+ @Override
+ protected void doActivate() throws Exception
+ {
+ super.doActivate();
+ LifecycleUtil.activate(cache);
+ }
+
+ @Override
+ protected void doDeactivate() throws Exception
+ {
+ LifecycleUtil.deactivate(cache);
+ super.doDeactivate();
+ }
+
+ private void acquireAtomicRequestLock(Object key)
+ {
+ if (revisionLocker != null)
+ {
+ revisionLocker.acquireAtomicRequestLock(key);
+ }
+ }
+
+ private void releaseAtomicRequestLock(Object key)
+ {
+ if (revisionLocker != null)
+ {
+ revisionLocker.releaseAtomicRequestLock(key);
+ }
+ }
+
+ private InternalCDORevision getCachedRevisionByVersion(CDOID id, CDOBranchVersion branchVersion)
+ {
+ return (InternalCDORevision)cache.getRevisionByVersion(id, branchVersion);
+ }
+
+ private InternalCDORevision getCachedRevision(CDOID id, CDOBranchPoint branchPoint)
+ {
+ return (InternalCDORevision)cache.getRevision(id, branchPoint);
+ }
+
+ private InternalCDORevision getCachedRevisionRecursively(CDOID id, CDOBranchPoint branchPoint)
+ {
+ CDOBranch branch = branchPoint.getBranch();
+ if (!branch.isMainBranch())
+ {
+ CDOBranchPoint base = branch.getBase();
+ InternalCDORevision revision = getCachedRevision(id, base);
+ if (revision != null)
+ {
+ return revision;
+ }
+
+ // Recurse
+ return getCachedRevisionRecursively(id, base);
+ }
+
+ // Reached main branch
+ return null;
+ }
+}
diff --git a/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/internal/common/revision/EvictionEventImpl.java b/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/internal/common/revision/EvictionEventImpl.java
index 833b02309a..6decf1eada 100644
--- a/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/internal/common/revision/EvictionEventImpl.java
+++ b/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/internal/common/revision/EvictionEventImpl.java
@@ -1,67 +1,67 @@
-/*
- * Copyright (c) 2004 - 2011 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.revision;
-
-import org.eclipse.emf.cdo.common.branch.CDOBranch;
-import org.eclipse.emf.cdo.common.id.CDOID;
-import org.eclipse.emf.cdo.common.revision.CDORevisionCache;
-import org.eclipse.emf.cdo.common.revision.CDORevisionCache.EvictionEvent;
-import org.eclipse.emf.cdo.common.revision.CDORevisionKey;
-import org.eclipse.emf.cdo.spi.common.revision.InternalCDORevision;
-
-import org.eclipse.net4j.util.event.Event;
-
-/**
- * @author Eike Stepper
- */
-public class EvictionEventImpl extends Event implements EvictionEvent
-{
- private static final long serialVersionUID = 1L;
-
- private CDORevisionKey key;
-
- public EvictionEventImpl(CDORevisionCache cache, CDORevisionKey key)
- {
- super(cache);
- this.key = key;
- }
-
- @Override
- public CDORevisionCache getSource()
- {
- return (CDORevisionCache)super.getSource();
- }
-
- public CDOID getID()
- {
- return key.getID();
- }
-
- public CDOBranch getBranch()
- {
- return key.getBranch();
- }
-
- public int getVersion()
- {
- return key.getVersion();
- }
-
- public InternalCDORevision getRevision()
- {
- if (key instanceof InternalCDORevision)
- {
- return (InternalCDORevision)key;
- }
-
- return null;
- }
-}
+/*
+ * Copyright (c) 2004 - 2012 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.revision;
+
+import org.eclipse.emf.cdo.common.branch.CDOBranch;
+import org.eclipse.emf.cdo.common.id.CDOID;
+import org.eclipse.emf.cdo.common.revision.CDORevisionCache;
+import org.eclipse.emf.cdo.common.revision.CDORevisionCache.EvictionEvent;
+import org.eclipse.emf.cdo.common.revision.CDORevisionKey;
+import org.eclipse.emf.cdo.spi.common.revision.InternalCDORevision;
+
+import org.eclipse.net4j.util.event.Event;
+
+/**
+ * @author Eike Stepper
+ */
+public class EvictionEventImpl extends Event implements EvictionEvent
+{
+ private static final long serialVersionUID = 1L;
+
+ private CDORevisionKey key;
+
+ public EvictionEventImpl(CDORevisionCache cache, CDORevisionKey key)
+ {
+ super(cache);
+ this.key = key;
+ }
+
+ @Override
+ public CDORevisionCache getSource()
+ {
+ return (CDORevisionCache)super.getSource();
+ }
+
+ public CDOID getID()
+ {
+ return key.getID();
+ }
+
+ public CDOBranch getBranch()
+ {
+ return key.getBranch();
+ }
+
+ public int getVersion()
+ {
+ return key.getVersion();
+ }
+
+ public InternalCDORevision getRevision()
+ {
+ if (key instanceof InternalCDORevision)
+ {
+ return (InternalCDORevision)key;
+ }
+
+ return null;
+ }
+}
diff --git a/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/internal/common/revision/NOOPRevisionCache.java b/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/internal/common/revision/NOOPRevisionCache.java
index a513aa7feb..60d392215b 100644
--- a/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/internal/common/revision/NOOPRevisionCache.java
+++ b/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/internal/common/revision/NOOPRevisionCache.java
@@ -1,101 +1,101 @@
-/*
- * Copyright (c) 2004 - 2011 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.revision;
-
-import org.eclipse.emf.cdo.common.branch.CDOBranch;
-import org.eclipse.emf.cdo.common.branch.CDOBranchPoint;
-import org.eclipse.emf.cdo.common.branch.CDOBranchVersion;
-import org.eclipse.emf.cdo.common.id.CDOID;
-import org.eclipse.emf.cdo.common.revision.CDORevision;
-import org.eclipse.emf.cdo.spi.common.revision.InternalCDORevision;
-import org.eclipse.emf.cdo.spi.common.revision.InternalCDORevisionCache;
-
-import org.eclipse.net4j.util.lifecycle.Lifecycle;
-
-import org.eclipse.emf.ecore.EClass;
-
-import java.util.Collections;
-import java.util.List;
-import java.util.Map;
-
-/**
- * @author Eike Stepper
- */
-public class NOOPRevisionCache extends Lifecycle implements InternalCDORevisionCache
-{
- public static final NOOPRevisionCache INSTANCE = new NOOPRevisionCache();
-
- private static final List<CDORevision> EMPTY = Collections.emptyList();
-
- public NOOPRevisionCache()
- {
- }
-
- public InternalCDORevisionCache instantiate(CDORevision revision)
- {
- return this;
- }
-
- public boolean isSupportingBranches()
- {
- return true;
- }
-
- public EClass getObjectType(CDOID id)
- {
- return null;
- }
-
- public List<CDORevision> getCurrentRevisions()
- {
- return EMPTY;
- }
-
- public InternalCDORevision getRevision(CDOID id)
- {
- return null;
- }
-
- public InternalCDORevision getRevision(CDOID id, CDOBranchPoint branchPoint)
- {
- return null;
- }
-
- public InternalCDORevision getRevisionByVersion(CDOID id, CDOBranchVersion branchVersion)
- {
- return null;
- }
-
- public void addRevision(CDORevision revision)
- {
- // Do nothing
- }
-
- public InternalCDORevision removeRevision(CDOID id, CDOBranchVersion branchVersion)
- {
- return null;
- }
-
- public void clear()
- {
- // Do nothing
- }
-
- public Map<CDOBranch, List<CDORevision>> getAllRevisions()
- {
- return Collections.emptyMap();
- }
-
- public List<CDORevision> getRevisions(CDOBranchPoint branchPoint)
- {
- return Collections.emptyList();
- }
-}
+/*
+ * Copyright (c) 2004 - 2012 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.revision;
+
+import org.eclipse.emf.cdo.common.branch.CDOBranch;
+import org.eclipse.emf.cdo.common.branch.CDOBranchPoint;
+import org.eclipse.emf.cdo.common.branch.CDOBranchVersion;
+import org.eclipse.emf.cdo.common.id.CDOID;
+import org.eclipse.emf.cdo.common.revision.CDORevision;
+import org.eclipse.emf.cdo.spi.common.revision.InternalCDORevision;
+import org.eclipse.emf.cdo.spi.common.revision.InternalCDORevisionCache;
+
+import org.eclipse.net4j.util.lifecycle.Lifecycle;
+
+import org.eclipse.emf.ecore.EClass;
+
+import java.util.Collections;
+import java.util.List;
+import java.util.Map;
+
+/**
+ * @author Eike Stepper
+ */
+public class NOOPRevisionCache extends Lifecycle implements InternalCDORevisionCache
+{
+ public static final NOOPRevisionCache INSTANCE = new NOOPRevisionCache();
+
+ private static final List<CDORevision> EMPTY = Collections.emptyList();
+
+ public NOOPRevisionCache()
+ {
+ }
+
+ public InternalCDORevisionCache instantiate(CDORevision revision)
+ {
+ return this;
+ }
+
+ public boolean isSupportingBranches()
+ {
+ return true;
+ }
+
+ public EClass getObjectType(CDOID id)
+ {
+ return null;
+ }
+
+ public List<CDORevision> getCurrentRevisions()
+ {
+ return EMPTY;
+ }
+
+ public InternalCDORevision getRevision(CDOID id)
+ {
+ return null;
+ }
+
+ public InternalCDORevision getRevision(CDOID id, CDOBranchPoint branchPoint)
+ {
+ return null;
+ }
+
+ public InternalCDORevision getRevisionByVersion(CDOID id, CDOBranchVersion branchVersion)
+ {
+ return null;
+ }
+
+ public void addRevision(CDORevision revision)
+ {
+ // Do nothing
+ }
+
+ public InternalCDORevision removeRevision(CDOID id, CDOBranchVersion branchVersion)
+ {
+ return null;
+ }
+
+ public void clear()
+ {
+ // Do nothing
+ }
+
+ public Map<CDOBranch, List<CDORevision>> getAllRevisions()
+ {
+ return Collections.emptyMap();
+ }
+
+ public List<CDORevision> getRevisions(CDOBranchPoint branchPoint)
+ {
+ return Collections.emptyList();
+ }
+}
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 a42a4b4380..aa46c162ed 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
@@ -1,79 +1,79 @@
-/*
- * Copyright (c) 2004 - 2011 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.revision.delta;
-
-import org.eclipse.emf.cdo.common.protocol.CDODataInput;
-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.InternalCDOFeatureDelta.ListIndexAffecting;
-import org.eclipse.emf.cdo.spi.common.revision.InternalCDOFeatureDelta.ListTargetAdding;
-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;
-
-/**
- * @author Simon McDuff
- */
-public class CDOAddFeatureDeltaImpl extends CDOSingleValueFeatureDeltaImpl implements CDOAddFeatureDelta,
- ListIndexAffecting, ListTargetAdding
-{
- public CDOAddFeatureDeltaImpl(EStructuralFeature feature, int index, Object value)
- {
- super(feature, index, value);
- }
-
- public CDOAddFeatureDeltaImpl(CDODataInput in, EClass eClass) throws IOException
- {
- super(in, eClass);
- }
-
- public Type getType()
- {
- return Type.ADD;
- }
-
- public void apply(CDORevision revision)
- {
- ((InternalCDORevision)revision).getList(getFeature()).add(getIndex(), getValue());
- }
-
- public void accept(CDOFeatureDeltaVisitor visitor)
- {
- visitor.visit(this);
- }
-
- public CDOAddFeatureDelta copy()
- {
- return new CDOAddFeatureDeltaImpl(getFeature(), getIndex(), getValue());
- }
-
- public void affectIndices(ListTargetAdding[] source, int[] indices)
- {
- int index = getIndex();
- if (index == NO_INDEX)
- {
- return;
- }
-
- for (int i = 1; i <= indices[0]; i++)
- {
- if (indices[i] >= index)
- {
- ++indices[i];
- }
- }
- }
-}
+/*
+ * Copyright (c) 2004 - 2012 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.revision.delta;
+
+import org.eclipse.emf.cdo.common.protocol.CDODataInput;
+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.InternalCDOFeatureDelta.ListIndexAffecting;
+import org.eclipse.emf.cdo.spi.common.revision.InternalCDOFeatureDelta.ListTargetAdding;
+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;
+
+/**
+ * @author Simon McDuff
+ */
+public class CDOAddFeatureDeltaImpl extends CDOSingleValueFeatureDeltaImpl implements CDOAddFeatureDelta,
+ ListIndexAffecting, ListTargetAdding
+{
+ public CDOAddFeatureDeltaImpl(EStructuralFeature feature, int index, Object value)
+ {
+ super(feature, index, value);
+ }
+
+ public CDOAddFeatureDeltaImpl(CDODataInput in, EClass eClass) throws IOException
+ {
+ super(in, eClass);
+ }
+
+ public Type getType()
+ {
+ return Type.ADD;
+ }
+
+ public void apply(CDORevision revision)
+ {
+ ((InternalCDORevision)revision).getList(getFeature()).add(getIndex(), getValue());
+ }
+
+ public void accept(CDOFeatureDeltaVisitor visitor)
+ {
+ visitor.visit(this);
+ }
+
+ public CDOAddFeatureDelta copy()
+ {
+ return new CDOAddFeatureDeltaImpl(getFeature(), getIndex(), getValue());
+ }
+
+ public void affectIndices(ListTargetAdding[] source, int[] indices)
+ {
+ int index = getIndex();
+ if (index == NO_INDEX)
+ {
+ return;
+ }
+
+ for (int i = 1; i <= indices[0]; i++)
+ {
+ if (indices[i] >= index)
+ {
+ ++indices[i];
+ }
+ }
+ }
+}
diff --git a/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/internal/common/revision/delta/CDOClearFeatureDeltaImpl.java b/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/internal/common/revision/delta/CDOClearFeatureDeltaImpl.java
index 440315be4a..6affdc1a20 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
@@ -1,73 +1,73 @@
-/*
- * Copyright (c) 2004 - 2011 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.revision.delta;
-
-import org.eclipse.emf.cdo.common.protocol.CDODataInput;
-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.CDOFeatureDelta;
-import org.eclipse.emf.cdo.common.revision.delta.CDOFeatureDeltaVisitor;
-import org.eclipse.emf.cdo.spi.common.revision.CDOReferenceAdjuster;
-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;
-
-/**
- * @author Simon McDuff
- */
-public class CDOClearFeatureDeltaImpl extends CDOFeatureDeltaImpl implements CDOClearFeatureDelta
-{
- public CDOClearFeatureDeltaImpl(EStructuralFeature feature)
- {
- super(feature);
- }
-
- public CDOClearFeatureDeltaImpl(CDODataInput in, EClass eClass) throws IOException
- {
- super(in, eClass);
- }
-
- public Type getType()
- {
- return Type.CLEAR;
- }
-
- public CDOFeatureDelta copy()
- {
- return new CDOClearFeatureDeltaImpl(getFeature());
- }
-
- public void apply(CDORevision revision)
- {
- ((InternalCDORevision)revision).clear(getFeature());
- }
-
- public void accept(CDOFeatureDeltaVisitor visitor)
- {
- visitor.visit(this);
- }
-
- @Override
- public boolean adjustReferences(CDOReferenceAdjuster referenceAdjuster)
- {
- return false;
- }
-
- @Override
- protected String toStringAdditional()
- {
- return null;
- }
-}
+/*
+ * Copyright (c) 2004 - 2012 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.revision.delta;
+
+import org.eclipse.emf.cdo.common.protocol.CDODataInput;
+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.CDOFeatureDelta;
+import org.eclipse.emf.cdo.common.revision.delta.CDOFeatureDeltaVisitor;
+import org.eclipse.emf.cdo.spi.common.revision.CDOReferenceAdjuster;
+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;
+
+/**
+ * @author Simon McDuff
+ */
+public class CDOClearFeatureDeltaImpl extends CDOFeatureDeltaImpl implements CDOClearFeatureDelta
+{
+ public CDOClearFeatureDeltaImpl(EStructuralFeature feature)
+ {
+ super(feature);
+ }
+
+ public CDOClearFeatureDeltaImpl(CDODataInput in, EClass eClass) throws IOException
+ {
+ super(in, eClass);
+ }
+
+ public Type getType()
+ {
+ return Type.CLEAR;
+ }
+
+ public CDOFeatureDelta copy()
+ {
+ return new CDOClearFeatureDeltaImpl(getFeature());
+ }
+
+ public void apply(CDORevision revision)
+ {
+ ((InternalCDORevision)revision).clear(getFeature());
+ }
+
+ public void accept(CDOFeatureDeltaVisitor visitor)
+ {
+ visitor.visit(this);
+ }
+
+ @Override
+ public boolean adjustReferences(CDOReferenceAdjuster referenceAdjuster)
+ {
+ return false;
+ }
+
+ @Override
+ protected String toStringAdditional()
+ {
+ return null;
+ }
+}
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 d7108db667..33eb961254 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
@@ -1,173 +1,173 @@
-/*
- * Copyright (c) 2004 - 2011 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
- * Simon McDuff - bug 204890
- * Simon McDuff - bug 213402
- */
-package org.eclipse.emf.cdo.internal.common.revision.delta;
-
-import org.eclipse.emf.cdo.common.id.CDOID;
-import org.eclipse.emf.cdo.common.protocol.CDODataInput;
-import org.eclipse.emf.cdo.common.protocol.CDODataOutput;
-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.CDOFeatureDelta;
-import org.eclipse.emf.cdo.common.revision.delta.CDOFeatureDeltaVisitor;
-import org.eclipse.emf.cdo.spi.common.revision.CDOReferenceAdjuster;
-import org.eclipse.emf.cdo.spi.common.revision.InternalCDORevision;
-
-import org.eclipse.net4j.util.ObjectUtil;
-
-import org.eclipse.emf.ecore.EClass;
-import org.eclipse.emf.ecore.impl.EReferenceImpl;
-
-import java.io.IOException;
-import java.text.MessageFormat;
-
-/**
- * @author Simon McDuff
- */
-public class CDOContainerFeatureDeltaImpl extends CDOFeatureDeltaImpl implements CDOContainerFeatureDelta
-{
- private CDOID newResourceID;
-
- private Object newContainerID;
-
- private int newContainerFeatureID;
-
- public CDOContainerFeatureDeltaImpl(CDOID newResourceID, Object newContainerID, int newContainerFeatureID)
- {
- super(CONTAINER_FEATURE);
- this.newResourceID = newResourceID;
- this.newContainerID = newContainerID;
- this.newContainerFeatureID = newContainerFeatureID;
- }
-
- public CDOContainerFeatureDeltaImpl(CDODataInput in, EClass eClass) throws IOException
- {
- super(CONTAINER_FEATURE);
- newContainerFeatureID = in.readInt();
- newContainerID = in.readCDOID();
- newResourceID = in.readCDOID();
- }
-
- public Type getType()
- {
- return Type.CONTAINER;
- }
-
- public CDOFeatureDelta copy()
- {
- return new CDOContainerFeatureDeltaImpl(newResourceID, newContainerID, newContainerFeatureID);
- }
-
- public CDOID getResourceID()
- {
- return newResourceID;
- }
-
- public Object getContainerID()
- {
- return newContainerID;
- }
-
- public int getContainerFeatureID()
- {
- return newContainerFeatureID;
- }
-
- public void apply(CDORevision revision)
- {
- ((InternalCDORevision)revision).setResourceID(newResourceID);
- ((InternalCDORevision)revision).setContainerID(newContainerID);
- ((InternalCDORevision)revision).setContainingFeatureID(newContainerFeatureID);
- }
-
- @Override
- public boolean adjustReferences(CDOReferenceAdjuster referenceAdjuster)
- {
- boolean changed = false;
-
- CDOID id1 = (CDOID)referenceAdjuster.adjustReference(newResourceID, CONTAINER_FEATURE, NO_INDEX);
- if (id1 != newResourceID)
- {
- newResourceID = id1;
- changed = true;
- }
-
- Object id2 = referenceAdjuster.adjustReference(newContainerID, CONTAINER_FEATURE, NO_INDEX);
- if (id2 != newContainerID)
- {
- newContainerID = id2;
- changed = true;
- }
-
- return changed;
- }
-
- @Override
- public void write(CDODataOutput out, EClass eClass) throws IOException
- {
- out.writeInt(getType().ordinal());
- out.writeInt(newContainerFeatureID);
- out.writeCDOID(out.getIDProvider().provideCDOID(newContainerID));
- out.writeCDOID(newResourceID);
- }
-
- public void accept(CDOFeatureDeltaVisitor visitor)
- {
- visitor.visit(this);
- }
-
- @Override
- public boolean isStructurallyEqual(Object obj)
- {
- if (!super.isStructurallyEqual(obj))
- {
- return false;
- }
-
- CDOContainerFeatureDelta that = (CDOContainerFeatureDelta)obj;
- return ObjectUtil.equals(newResourceID, that.getResourceID())
- && ObjectUtil.equals(newContainerID, that.getContainerID())
- && newContainerFeatureID == that.getContainerFeatureID();
- }
-
- @Override
- protected String toStringAdditional()
- {
- return MessageFormat.format("resource={0}, container={1}, feature={2}", newResourceID, newContainerID,
- newContainerFeatureID);
- }
-
- /**
- * @author Simon McDuff
- */
- public static final class ContainerFeature extends EReferenceImpl
- {
- public static final String NAME = "eContainer";
-
- public ContainerFeature()
- {
- }
-
- @Override
- public String getName()
- {
- return null;
- }
-
- @Override
- public String toString()
- {
- return NAME;
- }
- }
-}
+/*
+ * Copyright (c) 2004 - 2012 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
+ * Simon McDuff - bug 204890
+ * Simon McDuff - bug 213402
+ */
+package org.eclipse.emf.cdo.internal.common.revision.delta;
+
+import org.eclipse.emf.cdo.common.id.CDOID;
+import org.eclipse.emf.cdo.common.protocol.CDODataInput;
+import org.eclipse.emf.cdo.common.protocol.CDODataOutput;
+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.CDOFeatureDelta;
+import org.eclipse.emf.cdo.common.revision.delta.CDOFeatureDeltaVisitor;
+import org.eclipse.emf.cdo.spi.common.revision.CDOReferenceAdjuster;
+import org.eclipse.emf.cdo.spi.common.revision.InternalCDORevision;
+
+import org.eclipse.net4j.util.ObjectUtil;
+
+import org.eclipse.emf.ecore.EClass;
+import org.eclipse.emf.ecore.impl.EReferenceImpl;
+
+import java.io.IOException;
+import java.text.MessageFormat;
+
+/**
+ * @author Simon McDuff
+ */
+public class CDOContainerFeatureDeltaImpl extends CDOFeatureDeltaImpl implements CDOContainerFeatureDelta
+{
+ private CDOID newResourceID;
+
+ private Object newContainerID;
+
+ private int newContainerFeatureID;
+
+ public CDOContainerFeatureDeltaImpl(CDOID newResourceID, Object newContainerID, int newContainerFeatureID)
+ {
+ super(CONTAINER_FEATURE);
+ this.newResourceID = newResourceID;
+ this.newContainerID = newContainerID;
+ this.newContainerFeatureID = newContainerFeatureID;
+ }
+
+ public CDOContainerFeatureDeltaImpl(CDODataInput in, EClass eClass) throws IOException
+ {
+ super(CONTAINER_FEATURE);
+ newContainerFeatureID = in.readInt();
+ newContainerID = in.readCDOID();
+ newResourceID = in.readCDOID();
+ }
+
+ public Type getType()
+ {
+ return Type.CONTAINER;
+ }
+
+ public CDOFeatureDelta copy()
+ {
+ return new CDOContainerFeatureDeltaImpl(newResourceID, newContainerID, newContainerFeatureID);
+ }
+
+ public CDOID getResourceID()
+ {
+ return newResourceID;
+ }
+
+ public Object getContainerID()
+ {
+ return newContainerID;
+ }
+
+ public int getContainerFeatureID()
+ {
+ return newContainerFeatureID;
+ }
+
+ public void apply(CDORevision revision)
+ {
+ ((InternalCDORevision)revision).setResourceID(newResourceID);
+ ((InternalCDORevision)revision).setContainerID(newContainerID);
+ ((InternalCDORevision)revision).setContainingFeatureID(newContainerFeatureID);
+ }
+
+ @Override
+ public boolean adjustReferences(CDOReferenceAdjuster referenceAdjuster)
+ {
+ boolean changed = false;
+
+ CDOID id1 = (CDOID)referenceAdjuster.adjustReference(newResourceID, CONTAINER_FEATURE, NO_INDEX);
+ if (id1 != newResourceID)
+ {
+ newResourceID = id1;
+ changed = true;
+ }
+
+ Object id2 = referenceAdjuster.adjustReference(newContainerID, CONTAINER_FEATURE, NO_INDEX);
+ if (id2 != newContainerID)
+ {
+ newContainerID = id2;
+ changed = true;
+ }
+
+ return changed;
+ }
+
+ @Override
+ public void write(CDODataOutput out, EClass eClass) throws IOException
+ {
+ out.writeInt(getType().ordinal());
+ out.writeInt(newContainerFeatureID);
+ out.writeCDOID(out.getIDProvider().provideCDOID(newContainerID));
+ out.writeCDOID(newResourceID);
+ }
+
+ public void accept(CDOFeatureDeltaVisitor visitor)
+ {
+ visitor.visit(this);
+ }
+
+ @Override
+ public boolean isStructurallyEqual(Object obj)
+ {
+ if (!super.isStructurallyEqual(obj))
+ {
+ return false;
+ }
+
+ CDOContainerFeatureDelta that = (CDOContainerFeatureDelta)obj;
+ return ObjectUtil.equals(newResourceID, that.getResourceID())
+ && ObjectUtil.equals(newContainerID, that.getContainerID())
+ && newContainerFeatureID == that.getContainerFeatureID();
+ }
+
+ @Override
+ protected String toStringAdditional()
+ {
+ return MessageFormat.format("resource={0}, container={1}, feature={2}", newResourceID, newContainerID,
+ newContainerFeatureID);
+ }
+
+ /**
+ * @author Simon McDuff
+ */
+ public static final class ContainerFeature extends EReferenceImpl
+ {
+ public static final String NAME = "eContainer";
+
+ public ContainerFeature()
+ {
+ }
+
+ @Override
+ public String getName()
+ {
+ return null;
+ }
+
+ @Override
+ public String toString()
+ {
+ return NAME;
+ }
+ }
+}
diff --git a/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/internal/common/revision/delta/CDODetachedRevisionDeltaImpl.java b/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/internal/common/revision/delta/CDODetachedRevisionDeltaImpl.java
index 6daf5421b4..3a9ec9263f 100644
--- a/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/internal/common/revision/delta/CDODetachedRevisionDeltaImpl.java
+++ b/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/internal/common/revision/delta/CDODetachedRevisionDeltaImpl.java
@@ -1,89 +1,89 @@
-/*
- * Copyright (c) 2004 - 2011 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.revision.delta;
-
-import org.eclipse.emf.cdo.common.branch.CDOBranch;
-import org.eclipse.emf.cdo.common.id.CDOID;
-import org.eclipse.emf.cdo.common.revision.CDORevisable;
-import org.eclipse.emf.cdo.common.revision.CDORevision;
-import org.eclipse.emf.cdo.common.revision.delta.CDOFeatureDelta;
-import org.eclipse.emf.cdo.common.revision.delta.CDOFeatureDeltaVisitor;
-import org.eclipse.emf.cdo.common.revision.delta.CDORevisionDelta;
-
-import org.eclipse.emf.ecore.EClass;
-import org.eclipse.emf.ecore.EStructuralFeature;
-
-import java.util.List;
-
-/**
- * @author Eike Stepper
- */
-public class CDODetachedRevisionDeltaImpl implements CDORevisionDelta
-{
- public CDODetachedRevisionDeltaImpl()
- {
- }
-
- public CDOID getID()
- {
- throw new UnsupportedOperationException();
- }
-
- public CDOBranch getBranch()
- {
- throw new UnsupportedOperationException();
- }
-
- public int getVersion()
- {
- throw new UnsupportedOperationException();
- }
-
- public EClass getEClass()
- {
- throw new UnsupportedOperationException();
- }
-
- public CDORevisable getTarget()
- {
- throw new UnsupportedOperationException();
- }
-
- public boolean isEmpty()
- {
- throw new UnsupportedOperationException();
- }
-
- public CDORevisionDelta copy()
- {
- return this;
- }
-
- public CDOFeatureDelta getFeatureDelta(EStructuralFeature feature)
- {
- throw new UnsupportedOperationException();
- }
-
- public List<CDOFeatureDelta> getFeatureDeltas()
- {
- throw new UnsupportedOperationException();
- }
-
- public void apply(CDORevision revision)
- {
- throw new UnsupportedOperationException();
- }
-
- public void accept(CDOFeatureDeltaVisitor visitor)
- {
- throw new UnsupportedOperationException();
- }
-}
+/*
+ * Copyright (c) 2004 - 2012 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.revision.delta;
+
+import org.eclipse.emf.cdo.common.branch.CDOBranch;
+import org.eclipse.emf.cdo.common.id.CDOID;
+import org.eclipse.emf.cdo.common.revision.CDORevisable;
+import org.eclipse.emf.cdo.common.revision.CDORevision;
+import org.eclipse.emf.cdo.common.revision.delta.CDOFeatureDelta;
+import org.eclipse.emf.cdo.common.revision.delta.CDOFeatureDeltaVisitor;
+import org.eclipse.emf.cdo.common.revision.delta.CDORevisionDelta;
+
+import org.eclipse.emf.ecore.EClass;
+import org.eclipse.emf.ecore.EStructuralFeature;
+
+import java.util.List;
+
+/**
+ * @author Eike Stepper
+ */
+public class CDODetachedRevisionDeltaImpl implements CDORevisionDelta
+{
+ public CDODetachedRevisionDeltaImpl()
+ {
+ }
+
+ public CDOID getID()
+ {
+ throw new UnsupportedOperationException();
+ }
+
+ public CDOBranch getBranch()
+ {
+ throw new UnsupportedOperationException();
+ }
+
+ public int getVersion()
+ {
+ throw new UnsupportedOperationException();
+ }
+
+ public EClass getEClass()
+ {
+ throw new UnsupportedOperationException();
+ }
+
+ public CDORevisable getTarget()
+ {
+ throw new UnsupportedOperationException();
+ }
+
+ public boolean isEmpty()
+ {
+ throw new UnsupportedOperationException();
+ }
+
+ public CDORevisionDelta copy()
+ {
+ return this;
+ }
+
+ public CDOFeatureDelta getFeatureDelta(EStructuralFeature feature)
+ {
+ throw new UnsupportedOperationException();
+ }
+
+ public List<CDOFeatureDelta> getFeatureDeltas()
+ {
+ throw new UnsupportedOperationException();
+ }
+
+ public void apply(CDORevision revision)
+ {
+ throw new UnsupportedOperationException();
+ }
+
+ public void accept(CDOFeatureDeltaVisitor visitor)
+ {
+ throw new UnsupportedOperationException();
+ }
+}
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 c55f653dcc..647e781afe 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
@@ -1,90 +1,90 @@
-/*
- * Copyright (c) 2004 - 2011 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.revision.delta;
-
-import org.eclipse.emf.cdo.common.protocol.CDODataInput;
-import org.eclipse.emf.cdo.common.protocol.CDODataOutput;
-import org.eclipse.emf.cdo.common.revision.delta.CDOFeatureDelta;
-import org.eclipse.emf.cdo.spi.common.revision.CDOReferenceAdjuster;
-import org.eclipse.emf.cdo.spi.common.revision.InternalCDOFeatureDelta;
-
-import org.eclipse.net4j.util.CheckUtil;
-
-import org.eclipse.emf.ecore.EClass;
-import org.eclipse.emf.ecore.EStructuralFeature;
-
-import java.io.IOException;
-import java.text.MessageFormat;
-
-/**
- * @author Simon McDuff
- */
-public abstract class CDOFeatureDeltaImpl implements InternalCDOFeatureDelta
-{
- private EStructuralFeature feature;
-
- protected CDOFeatureDeltaImpl(EStructuralFeature feature)
- {
- CheckUtil.checkArg(feature, "feature");
- this.feature = feature;
- }
-
- public CDOFeatureDeltaImpl(CDODataInput in, EClass eClass) throws IOException
- {
- int featureID = in.readInt();
- feature = eClass.getEStructuralFeature(featureID);
- CheckUtil.checkState(feature, "feature");
- }
-
- public void write(CDODataOutput out, EClass eClass) throws IOException
- {
- out.writeInt(getType().ordinal());
- out.writeInt(eClass.getFeatureID(feature));
- }
-
- public EStructuralFeature getFeature()
- {
- return feature;
- }
-
- public boolean isStructurallyEqual(Object obj)
- {
- if (obj == this)
- {
- return true;
- }
-
- if (obj instanceof CDOFeatureDelta)
- {
- CDOFeatureDelta that = (CDOFeatureDelta)obj;
- return feature.equals(that.getFeature()) && getType().equals(that.getType());
- }
-
- return false;
- }
-
- @Override
- public String toString()
- {
- String additional = toStringAdditional();
- if (additional == null)
- {
- return MessageFormat.format("CDOFeatureDelta[{0}, {1}]", feature.getName(), getType());
- }
-
- return MessageFormat.format("CDOFeatureDelta[{0}, {1}, {2}]", feature.getName(), getType(), additional);
- }
-
- public abstract boolean adjustReferences(CDOReferenceAdjuster referenceAdjuster);
-
- protected abstract String toStringAdditional();
-}
+/*
+ * Copyright (c) 2004 - 2012 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.revision.delta;
+
+import org.eclipse.emf.cdo.common.protocol.CDODataInput;
+import org.eclipse.emf.cdo.common.protocol.CDODataOutput;
+import org.eclipse.emf.cdo.common.revision.delta.CDOFeatureDelta;
+import org.eclipse.emf.cdo.spi.common.revision.CDOReferenceAdjuster;
+import org.eclipse.emf.cdo.spi.common.revision.InternalCDOFeatureDelta;
+
+import org.eclipse.net4j.util.CheckUtil;
+
+import org.eclipse.emf.ecore.EClass;
+import org.eclipse.emf.ecore.EStructuralFeature;
+
+import java.io.IOException;
+import java.text.MessageFormat;
+
+/**
+ * @author Simon McDuff
+ */
+public abstract class CDOFeatureDeltaImpl implements InternalCDOFeatureDelta
+{
+ private EStructuralFeature feature;
+
+ protected CDOFeatureDeltaImpl(EStructuralFeature feature)
+ {
+ CheckUtil.checkArg(feature, "feature");
+ this.feature = feature;
+ }
+
+ public CDOFeatureDeltaImpl(CDODataInput in, EClass eClass) throws IOException
+ {
+ int featureID = in.readInt();
+ feature = eClass.getEStructuralFeature(featureID);
+ CheckUtil.checkState(feature, "feature");
+ }
+
+ public void write(CDODataOutput out, EClass eClass) throws IOException
+ {
+ out.writeInt(getType().ordinal());
+ out.writeInt(eClass.getFeatureID(feature));
+ }
+
+ public EStructuralFeature getFeature()
+ {
+ return feature;
+ }
+
+ public boolean isStructurallyEqual(Object obj)
+ {
+ if (obj == this)
+ {
+ return true;
+ }
+
+ if (obj instanceof CDOFeatureDelta)
+ {
+ CDOFeatureDelta that = (CDOFeatureDelta)obj;
+ return feature.equals(that.getFeature()) && getType().equals(that.getType());
+ }
+
+ return false;
+ }
+
+ @Override
+ public String toString()
+ {
+ String additional = toStringAdditional();
+ if (additional == null)
+ {
+ return MessageFormat.format("CDOFeatureDelta[{0}, {1}]", feature.getName(), getType());
+ }
+
+ return MessageFormat.format("CDOFeatureDelta[{0}, {1}, {2}]", feature.getName(), getType(), additional);
+ }
+
+ public abstract boolean adjustReferences(CDOReferenceAdjuster referenceAdjuster);
+
+ protected abstract String toStringAdditional();
+}
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 9f31acf505..0bba475f15 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
@@ -1,464 +1,464 @@
-/*
- * Copyright (c) 2004 - 2011 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
- * Cyril Jaquier - Bug 310574 (with the help of Pascal Lehmann)
- */
-package org.eclipse.emf.cdo.internal.common.revision.delta;
-
-import org.eclipse.emf.cdo.common.protocol.CDODataInput;
-import org.eclipse.emf.cdo.common.protocol.CDODataOutput;
-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.CDOFeatureDelta;
-import org.eclipse.emf.cdo.common.revision.delta.CDOFeatureDeltaVisitor;
-import org.eclipse.emf.cdo.common.revision.delta.CDOListFeatureDelta;
-import org.eclipse.emf.cdo.common.revision.delta.CDOMoveFeatureDelta;
-import org.eclipse.emf.cdo.common.revision.delta.CDORemoveFeatureDelta;
-import org.eclipse.emf.cdo.common.revision.delta.CDOSetFeatureDelta;
-import org.eclipse.emf.cdo.spi.common.revision.CDOReferenceAdjuster;
-
-import org.eclipse.net4j.util.ObjectUtil;
-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 org.eclipse.emf.ecore.util.FeatureMapUtil;
-
-import java.io.IOException;
-import java.lang.reflect.Array;
-import java.util.ArrayList;
-import java.util.Arrays;
-import java.util.HashMap;
-import java.util.List;
-import java.util.ListIterator;
-import java.util.Map;
-
-/**
- * @author Simon McDuff
- */
-public class CDOListFeatureDeltaImpl extends CDOFeatureDeltaImpl implements CDOListFeatureDelta
-{
- private List<CDOFeatureDelta> featureDeltas = new ArrayList<CDOFeatureDelta>();
-
- private transient int[] cachedIndices;
-
- private transient ListTargetAdding[] cachedSources;
-
- private transient List<CDOFeatureDelta> unprocessedFeatureDeltas;
-
- public CDOListFeatureDeltaImpl(EStructuralFeature feature)
- {
- super(feature);
- }
-
- public CDOListFeatureDeltaImpl(CDODataInput in, EClass eClass) throws IOException
- {
- super(in, eClass);
- int size = in.readInt();
- for (int i = 0; i < size; i++)
- {
- featureDeltas.add(in.readCDOFeatureDelta(eClass));
- }
- }
-
- public CDOListFeatureDelta copy()
- {
- CDOListFeatureDeltaImpl result = new CDOListFeatureDeltaImpl(getFeature());
-
- Map<CDOFeatureDelta, CDOFeatureDelta> map = null;
- if (cachedSources != null || unprocessedFeatureDeltas != null)
- {
- map = new HashMap<CDOFeatureDelta, CDOFeatureDelta>();
- }
-
- for (CDOFeatureDelta delta : featureDeltas)
- {
- CDOFeatureDelta newDelta = delta.copy();
- result.featureDeltas.add(newDelta);
- if (map != null)
- {
- map.put(delta, newDelta);
- }
- }
-
- if (cachedIndices != null)
- {
- result.cachedIndices = copyOf(cachedIndices, cachedIndices.length);
- }
-
- if (cachedSources != null)
- {
- int length = cachedSources.length;
- result.cachedSources = new ListTargetAdding[length];
- for (int i = 0; i < length; i++)
- {
- ListTargetAdding oldElement = cachedSources[i];
- CDOFeatureDelta newElement = map.get(oldElement);
- if (newElement instanceof ListTargetAdding)
- {
- result.cachedSources[i] = (ListTargetAdding)newElement;
- }
- }
- }
-
- if (unprocessedFeatureDeltas != null)
- {
- int size = unprocessedFeatureDeltas.size();
- result.unprocessedFeatureDeltas = new ArrayList<CDOFeatureDelta>(size);
- for (CDOFeatureDelta oldDelta : unprocessedFeatureDeltas)
- {
- CDOFeatureDelta newDelta = map.get(oldDelta);
- if (newDelta != null)
- {
- result.unprocessedFeatureDeltas.add(newDelta);
- }
- }
- }
-
- return result;
- }
-
- @Override
- public void write(CDODataOutput out, EClass eClass) throws IOException
- {
- super.write(out, eClass);
- out.writeInt(featureDeltas.size());
- for (CDOFeatureDelta featureDelta : featureDeltas)
- {
- out.writeCDOFeatureDelta(eClass, featureDelta);
- }
- }
-
- public Type getType()
- {
- return Type.LIST;
- }
-
- public List<CDOFeatureDelta> getListChanges()
- {
- return featureDeltas;
- }
-
- /**
- * Returns the number of indices as the first element of the array.
- *
- * @return never <code>null</code>.
- */
- public Pair<ListTargetAdding[], int[]> reconstructAddedIndices()
- {
- reconstructAddedIndicesWithNoCopy();
- return new Pair<ListTargetAdding[], int[]>(copyOf(cachedSources, cachedSources.length, cachedSources.getClass()),
- copyOf(cachedIndices, cachedIndices.length));
- }
-
- private void reconstructAddedIndicesWithNoCopy()
- {
- // Note that cachedIndices and cachedSources are always either both null or
- // both non-null, and in the latter case, are always of the same length.
- // Furthermore, there can only be unprocessedFeatureDeltas if cachesIndices
- // and cachedSources are non-null.
-
- if (cachedIndices == null || unprocessedFeatureDeltas != null)
- {
- if (cachedIndices == null)
- {
- int initialCapacity = featureDeltas.size() + 1;
- cachedIndices = new int[initialCapacity];
- cachedSources = new ListTargetAdding[initialCapacity];
- }
- else
- // i.e. unprocessedFeatureDeltas != null
- {
- int requiredCapacity = 1 + cachedIndices[0] + unprocessedFeatureDeltas.size();
- if (cachedIndices.length < requiredCapacity)
- {
- int newCapacity = Math.max(requiredCapacity, cachedIndices.length * 2);
-
- int[] newIndices = new int[newCapacity];
- System.arraycopy(cachedIndices, 0, newIndices, 0, cachedIndices.length);
- cachedIndices = newIndices;
-
- ListTargetAdding[] newSources = new ListTargetAdding[newCapacity];
- System.arraycopy(cachedSources, 0, newSources, 0, cachedSources.length);
- cachedSources = newSources;
- }
- }
-
- List<CDOFeatureDelta> featureDeltasToBeProcessed = unprocessedFeatureDeltas == null ? featureDeltas
- : unprocessedFeatureDeltas;
- for (CDOFeatureDelta featureDelta : featureDeltasToBeProcessed)
- {
- if (featureDelta instanceof ListIndexAffecting)
- {
- ListIndexAffecting affecting = (ListIndexAffecting)featureDelta;
- affecting.affectIndices(cachedSources, cachedIndices);
- }
-
- if (featureDelta instanceof ListTargetAdding)
- {
- cachedIndices[++cachedIndices[0]] = ((ListTargetAdding)featureDelta).getIndex();
- cachedSources[cachedIndices[0]] = (ListTargetAdding)featureDelta;
- }
- }
-
- unprocessedFeatureDeltas = null;
- }
- }
-
- private boolean cleanupWithNewDelta(CDOFeatureDelta featureDelta)
- {
- EStructuralFeature feature = getFeature();
- if ((feature instanceof EReference || FeatureMapUtil.isFeatureMap(feature))
- && featureDelta instanceof CDORemoveFeatureDelta)
- {
- int indexToRemove = ((CDORemoveFeatureDelta)featureDelta).getIndex();
- reconstructAddedIndicesWithNoCopy();
-
- for (int i = 1; i <= cachedIndices[0]; i++)
- {
- int index = cachedIndices[i];
- if (indexToRemove == index)
- {
- // The previous implementation set the value of the feature delta to CDOID.NULL. Databinding and probably
- // others don't really like it. We now remove the ADD (or SET which seems to appear in CDOListFeatureDelta
- // during opposite adjustment!? Why???) and patch the other feature deltas.
- // See https://bugs.eclipse.org/bugs/show_bug.cgi?id=310574
-
- ListTargetAdding delta = cachedSources[i];
-
- // We use a "floating" index which is the index (in the list) of the item to remove at the time when the
- // object was still in the list. This index evolves with the feature deltas.
- int floatingIndex = delta.getIndex();
-
- // First updates cachedSources and cachedIndices using CDORemoveFeatureDelta.
- ListIndexAffecting affecting = (ListIndexAffecting)featureDelta;
- affecting.affectIndices(cachedSources, cachedIndices);
-
- // Then adjusts the remaining feature deltas.
- boolean skip = true;
- ListIterator<CDOFeatureDelta> iterator = featureDeltas.listIterator();
-
- while (iterator.hasNext())
- {
- CDOFeatureDelta fd = iterator.next();
-
- // We only need to process feature deltas that come after the ADD (or SET) to be removed.
- if (skip)
- {
- if (fd == delta)
- {
- // Found the ADD (or SET) feature delta that we need to remove. So remove it from the list and start
- // processing the next feature deltas.
- skip = false;
- iterator.remove();
-
- // SET
- if (fd instanceof CDOSetFeatureDelta)
- {
- // If the removed delta is SET we add the REMOVE to the feature deltas. We do not need to adjust the
- // other feature deltas because SET do not modify the list.
- return true;
- }
- }
-
- continue;
- }
-
- // ADD
- if (fd instanceof CDOAddFeatureDelta)
- {
- // Increases the floating index if the ADD came in front of the item.
- if (((CDOAddFeatureDelta)fd).getIndex() <= floatingIndex)
- {
- ++floatingIndex;
- }
-
- // Adjusts the feature delta too.
- ((WithIndex)fd).adjustAfterRemoval(floatingIndex);
- }
-
- // REMOVE
- else if (fd instanceof CDORemoveFeatureDelta)
- {
- int idx = floatingIndex;
- // Decreases the floating index if the REMOVE came in front of the item.
- if (((CDORemoveFeatureDelta)fd).getIndex() <= floatingIndex)
- {
- --floatingIndex;
- }
-
- // Adjusts the feature delta too.
- ((WithIndex)fd).adjustAfterRemoval(idx);
- }
-
- // MOVE
- else if (fd instanceof CDOMoveFeatureDelta)
- {
- // Remembers the positions before we patch them.
- int from = ((CDOMoveFeatureDelta)fd).getOldPosition();
- int to = ((CDOMoveFeatureDelta)fd).getNewPosition();
-
- if (floatingIndex == from)
- {
- // We are moving the "to be deleted" item. So we update our floating index and remove the MOVE. It has
- // no effect on the list.
- floatingIndex = to;
- iterator.remove();
- }
- else
- {
- // In the other cases, we need to patch the positions.
-
- // If the old position is greater or equal to the current position of the item to be removed (remember,
- // that's our floating index), decrease the position.
- int patchedFrom = floatingIndex <= from ? from - 1 : from;
-
- // The new position requires more care. We need to know the direction of the move (left-to-right or
- // right-to-left).
- int patchedTo;
- if (from > to)
- {
- // left-to-right. Only decreases the position if it is strictly greater than the current item
- // position.
- patchedTo = floatingIndex < to ? to - 1 : to;
- }
- else
- {
- // right-to-left. Decreases the position if it is greater or equal than the current item position.
- patchedTo = floatingIndex <= to ? to - 1 : to;
- }
-
- // We can now update our floating index. We use the original positions because the floating index
- // represents the item "to be deleted" before it was actually removed.
- if (from < floatingIndex && floatingIndex <= to)
- {
- --floatingIndex;
- }
- else if (to <= floatingIndex && floatingIndex < from)
- {
- ++floatingIndex;
- }
-
- // And finally adjust the feature delta.
- if (patchedFrom == patchedTo)
- {
- // Source and destination are the same so just remove the feature delta.
- iterator.remove();
- }
- else
- {
- ((CDOMoveFeatureDeltaImpl)fd).setOldPosition(patchedFrom);
- ((CDOMoveFeatureDeltaImpl)fd).setNewPosition(patchedTo);
- }
- }
- }
-
- // SET
- else if (fd instanceof CDOSetFeatureDelta)
- {
- // Adjusts the feature delta too.
- ((WithIndex)fd).adjustAfterRemoval(floatingIndex);
- }
- }
-
- // If the removed delta was ADD so we do not add the REMOVE to the feature deltas.
- return false;
- }
- }
- }
-
- if (cachedIndices != null)
- {
- if (unprocessedFeatureDeltas == null)
- {
- unprocessedFeatureDeltas = new ArrayList<CDOFeatureDelta>();
- }
-
- unprocessedFeatureDeltas.add(featureDelta);
- }
-
- return true;
- }
-
- public void add(CDOFeatureDelta featureDelta)
- {
- // Only adds the feature delta to the list if required.
- if (cleanupWithNewDelta(featureDelta))
- {
- featureDeltas.add(featureDelta);
- }
- }
-
- public void apply(CDORevision revision)
- {
- for (CDOFeatureDelta featureDelta : featureDeltas)
- {
- ((CDOFeatureDeltaImpl)featureDelta).apply(revision);
- }
- }
-
- @Override
- public boolean adjustReferences(CDOReferenceAdjuster adjuster)
- {
- boolean changed = false;
- for (CDOFeatureDelta featureDelta : featureDeltas)
- {
- changed |= ((CDOFeatureDeltaImpl)featureDelta).adjustReferences(adjuster);
- }
-
- return changed;
- }
-
- public void accept(CDOFeatureDeltaVisitor visitor)
- {
- visitor.visit(this);
- }
-
- @Override
- public boolean isStructurallyEqual(Object obj)
- {
- if (!super.isStructurallyEqual(obj))
- {
- return false;
- }
-
- CDOListFeatureDelta that = (CDOListFeatureDelta)obj;
- return ObjectUtil.equals(featureDeltas, that.getListChanges());
- }
-
- @Override
- protected String toStringAdditional()
- {
- return "list=" + featureDeltas; //$NON-NLS-1$
- }
-
- /**
- * Copied from JAVA 1.6 {@link Arrays Arrays.copyOf}.
- */
- private static <T, U> T[] copyOf(U[] original, int newLength, Class<? extends T[]> newType)
- {
- @SuppressWarnings("unchecked")
- T[] copy = (Object)newType == (Object)Object[].class ? (T[])new Object[newLength] : (T[])Array.newInstance(
- newType.getComponentType(), newLength);
- System.arraycopy(original, 0, copy, 0, Math.min(original.length, newLength));
- return copy;
- }
-
- /**
- * Copied from JAVA 1.6 {@link Arrays Arrays.copyOf}.
- */
- private static int[] copyOf(int[] original, int newLength)
- {
- int[] copy = new int[newLength];
- System.arraycopy(original, 0, copy, 0, Math.min(original.length, newLength));
- return copy;
- }
-}
+/*
+ * Copyright (c) 2004 - 2012 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
+ * Cyril Jaquier - Bug 310574 (with the help of Pascal Lehmann)
+ */
+package org.eclipse.emf.cdo.internal.common.revision.delta;
+
+import org.eclipse.emf.cdo.common.protocol.CDODataInput;
+import org.eclipse.emf.cdo.common.protocol.CDODataOutput;
+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.CDOFeatureDelta;
+import org.eclipse.emf.cdo.common.revision.delta.CDOFeatureDeltaVisitor;
+import org.eclipse.emf.cdo.common.revision.delta.CDOListFeatureDelta;
+import org.eclipse.emf.cdo.common.revision.delta.CDOMoveFeatureDelta;
+import org.eclipse.emf.cdo.common.revision.delta.CDORemoveFeatureDelta;
+import org.eclipse.emf.cdo.common.revision.delta.CDOSetFeatureDelta;
+import org.eclipse.emf.cdo.spi.common.revision.CDOReferenceAdjuster;
+
+import org.eclipse.net4j.util.ObjectUtil;
+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 org.eclipse.emf.ecore.util.FeatureMapUtil;
+
+import java.io.IOException;
+import java.lang.reflect.Array;
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.HashMap;
+import java.util.List;
+import java.util.ListIterator;
+import java.util.Map;
+
+/**
+ * @author Simon McDuff
+ */
+public class CDOListFeatureDeltaImpl extends CDOFeatureDeltaImpl implements CDOListFeatureDelta
+{
+ private List<CDOFeatureDelta> featureDeltas = new ArrayList<CDOFeatureDelta>();
+
+ private transient int[] cachedIndices;
+
+ private transient ListTargetAdding[] cachedSources;
+
+ private transient List<CDOFeatureDelta> unprocessedFeatureDeltas;
+
+ public CDOListFeatureDeltaImpl(EStructuralFeature feature)
+ {
+ super(feature);
+ }
+
+ public CDOListFeatureDeltaImpl(CDODataInput in, EClass eClass) throws IOException
+ {
+ super(in, eClass);
+ int size = in.readInt();
+ for (int i = 0; i < size; i++)
+ {
+ featureDeltas.add(in.readCDOFeatureDelta(eClass));
+ }
+ }
+
+ public CDOListFeatureDelta copy()
+ {
+ CDOListFeatureDeltaImpl result = new CDOListFeatureDeltaImpl(getFeature());
+
+ Map<CDOFeatureDelta, CDOFeatureDelta> map = null;
+ if (cachedSources != null || unprocessedFeatureDeltas != null)
+ {
+ map = new HashMap<CDOFeatureDelta, CDOFeatureDelta>();
+ }
+
+ for (CDOFeatureDelta delta : featureDeltas)
+ {
+ CDOFeatureDelta newDelta = delta.copy();
+ result.featureDeltas.add(newDelta);
+ if (map != null)
+ {
+ map.put(delta, newDelta);
+ }
+ }
+
+ if (cachedIndices != null)
+ {
+ result.cachedIndices = copyOf(cachedIndices, cachedIndices.length);
+ }
+
+ if (cachedSources != null)
+ {
+ int length = cachedSources.length;
+ result.cachedSources = new ListTargetAdding[length];
+ for (int i = 0; i < length; i++)
+ {
+ ListTargetAdding oldElement = cachedSources[i];
+ CDOFeatureDelta newElement = map.get(oldElement);
+ if (newElement instanceof ListTargetAdding)
+ {
+ result.cachedSources[i] = (ListTargetAdding)newElement;
+ }
+ }
+ }
+
+ if (unprocessedFeatureDeltas != null)
+ {
+ int size = unprocessedFeatureDeltas.size();
+ result.unprocessedFeatureDeltas = new ArrayList<CDOFeatureDelta>(size);
+ for (CDOFeatureDelta oldDelta : unprocessedFeatureDeltas)
+ {
+ CDOFeatureDelta newDelta = map.get(oldDelta);
+ if (newDelta != null)
+ {
+ result.unprocessedFeatureDeltas.add(newDelta);
+ }
+ }
+ }
+
+ return result;
+ }
+
+ @Override
+ public void write(CDODataOutput out, EClass eClass) throws IOException
+ {
+ super.write(out, eClass);
+ out.writeInt(featureDeltas.size());
+ for (CDOFeatureDelta featureDelta : featureDeltas)
+ {
+ out.writeCDOFeatureDelta(eClass, featureDelta);
+ }
+ }
+
+ public Type getType()
+ {
+ return Type.LIST;
+ }
+
+ public List<CDOFeatureDelta> getListChanges()
+ {
+ return featureDeltas;
+ }
+
+ /**
+ * Returns the number of indices as the first element of the array.
+ *
+ * @return never <code>null</code>.
+ */
+ public Pair<ListTargetAdding[], int[]> reconstructAddedIndices()
+ {
+ reconstructAddedIndicesWithNoCopy();
+ return new Pair<ListTargetAdding[], int[]>(copyOf(cachedSources, cachedSources.length, cachedSources.getClass()),
+ copyOf(cachedIndices, cachedIndices.length));
+ }
+
+ private void reconstructAddedIndicesWithNoCopy()
+ {
+ // Note that cachedIndices and cachedSources are always either both null or
+ // both non-null, and in the latter case, are always of the same length.
+ // Furthermore, there can only be unprocessedFeatureDeltas if cachesIndices
+ // and cachedSources are non-null.
+
+ if (cachedIndices == null || unprocessedFeatureDeltas != null)
+ {
+ if (cachedIndices == null)
+ {
+ int initialCapacity = featureDeltas.size() + 1;
+ cachedIndices = new int[initialCapacity];
+ cachedSources = new ListTargetAdding[initialCapacity];
+ }
+ else
+ // i.e. unprocessedFeatureDeltas != null
+ {
+ int requiredCapacity = 1 + cachedIndices[0] + unprocessedFeatureDeltas.size();
+ if (cachedIndices.length < requiredCapacity)
+ {
+ int newCapacity = Math.max(requiredCapacity, cachedIndices.length * 2);
+
+ int[] newIndices = new int[newCapacity];
+ System.arraycopy(cachedIndices, 0, newIndices, 0, cachedIndices.length);
+ cachedIndices = newIndices;
+
+ ListTargetAdding[] newSources = new ListTargetAdding[newCapacity];
+ System.arraycopy(cachedSources, 0, newSources, 0, cachedSources.length);
+ cachedSources = newSources;
+ }
+ }
+
+ List<CDOFeatureDelta> featureDeltasToBeProcessed = unprocessedFeatureDeltas == null ? featureDeltas
+ : unprocessedFeatureDeltas;
+ for (CDOFeatureDelta featureDelta : featureDeltasToBeProcessed)
+ {
+ if (featureDelta instanceof ListIndexAffecting)
+ {
+ ListIndexAffecting affecting = (ListIndexAffecting)featureDelta;
+ affecting.affectIndices(cachedSources, cachedIndices);
+ }
+
+ if (featureDelta instanceof ListTargetAdding)
+ {
+ cachedIndices[++cachedIndices[0]] = ((ListTargetAdding)featureDelta).getIndex();
+ cachedSources[cachedIndices[0]] = (ListTargetAdding)featureDelta;
+ }
+ }
+
+ unprocessedFeatureDeltas = null;
+ }
+ }
+
+ private boolean cleanupWithNewDelta(CDOFeatureDelta featureDelta)
+ {
+ EStructuralFeature feature = getFeature();
+ if ((feature instanceof EReference || FeatureMapUtil.isFeatureMap(feature))
+ && featureDelta instanceof CDORemoveFeatureDelta)
+ {
+ int indexToRemove = ((CDORemoveFeatureDelta)featureDelta).getIndex();
+ reconstructAddedIndicesWithNoCopy();
+
+ for (int i = 1; i <= cachedIndices[0]; i++)
+ {
+ int index = cachedIndices[i];
+ if (indexToRemove == index)
+ {
+ // The previous implementation set the value of the feature delta to CDOID.NULL. Databinding and probably
+ // others don't really like it. We now remove the ADD (or SET which seems to appear in CDOListFeatureDelta
+ // during opposite adjustment!? Why???) and patch the other feature deltas.
+ // See https://bugs.eclipse.org/bugs/show_bug.cgi?id=310574
+
+ ListTargetAdding delta = cachedSources[i];
+
+ // We use a "floating" index which is the index (in the list) of the item to remove at the time when the
+ // object was still in the list. This index evolves with the feature deltas.
+ int floatingIndex = delta.getIndex();
+
+ // First updates cachedSources and cachedIndices using CDORemoveFeatureDelta.
+ ListIndexAffecting affecting = (ListIndexAffecting)featureDelta;
+ affecting.affectIndices(cachedSources, cachedIndices);
+
+ // Then adjusts the remaining feature deltas.
+ boolean skip = true;
+ ListIterator<CDOFeatureDelta> iterator = featureDeltas.listIterator();
+
+ while (iterator.hasNext())
+ {
+ CDOFeatureDelta fd = iterator.next();
+
+ // We only need to process feature deltas that come after the ADD (or SET) to be removed.
+ if (skip)
+ {
+ if (fd == delta)
+ {
+ // Found the ADD (or SET) feature delta that we need to remove. So remove it from the list and start
+ // processing the next feature deltas.
+ skip = false;
+ iterator.remove();
+
+ // SET
+ if (fd instanceof CDOSetFeatureDelta)
+ {
+ // If the removed delta is SET we add the REMOVE to the feature deltas. We do not need to adjust the
+ // other feature deltas because SET do not modify the list.
+ return true;
+ }
+ }
+
+ continue;
+ }
+
+ // ADD
+ if (fd instanceof CDOAddFeatureDelta)
+ {
+ // Increases the floating index if the ADD came in front of the item.
+ if (((CDOAddFeatureDelta)fd).getIndex() <= floatingIndex)
+ {
+ ++floatingIndex;
+ }
+
+ // Adjusts the feature delta too.
+ ((WithIndex)fd).adjustAfterRemoval(floatingIndex);
+ }
+
+ // REMOVE
+ else if (fd instanceof CDORemoveFeatureDelta)
+ {
+ int idx = floatingIndex;
+ // Decreases the floating index if the REMOVE came in front of the item.
+ if (((CDORemoveFeatureDelta)fd).getIndex() <= floatingIndex)
+ {
+ --floatingIndex;
+ }
+
+ // Adjusts the feature delta too.
+ ((WithIndex)fd).adjustAfterRemoval(idx);
+ }
+
+ // MOVE
+ else if (fd instanceof CDOMoveFeatureDelta)
+ {
+ // Remembers the positions before we patch them.
+ int from = ((CDOMoveFeatureDelta)fd).getOldPosition();
+ int to = ((CDOMoveFeatureDelta)fd).getNewPosition();
+
+ if (floatingIndex == from)
+ {
+ // We are moving the "to be deleted" item. So we update our floating index and remove the MOVE. It has
+ // no effect on the list.
+ floatingIndex = to;
+ iterator.remove();
+ }
+ else
+ {
+ // In the other cases, we need to patch the positions.
+
+ // If the old position is greater or equal to the current position of the item to be removed (remember,
+ // that's our floating index), decrease the position.
+ int patchedFrom = floatingIndex <= from ? from - 1 : from;
+
+ // The new position requires more care. We need to know the direction of the move (left-to-right or
+ // right-to-left).
+ int patchedTo;
+ if (from > to)
+ {
+ // left-to-right. Only decreases the position if it is strictly greater than the current item
+ // position.
+ patchedTo = floatingIndex < to ? to - 1 : to;
+ }
+ else
+ {
+ // right-to-left. Decreases the position if it is greater or equal than the current item position.
+ patchedTo = floatingIndex <= to ? to - 1 : to;
+ }
+
+ // We can now update our floating index. We use the original positions because the floating index
+ // represents the item "to be deleted" before it was actually removed.
+ if (from < floatingIndex && floatingIndex <= to)
+ {
+ --floatingIndex;
+ }
+ else if (to <= floatingIndex && floatingIndex < from)
+ {
+ ++floatingIndex;
+ }
+
+ // And finally adjust the feature delta.
+ if (patchedFrom == patchedTo)
+ {
+ // Source and destination are the same so just remove the feature delta.
+ iterator.remove();
+ }
+ else
+ {
+ ((CDOMoveFeatureDeltaImpl)fd).setOldPosition(patchedFrom);
+ ((CDOMoveFeatureDeltaImpl)fd).setNewPosition(patchedTo);
+ }
+ }
+ }
+
+ // SET
+ else if (fd instanceof CDOSetFeatureDelta)
+ {
+ // Adjusts the feature delta too.
+ ((WithIndex)fd).adjustAfterRemoval(floatingIndex);
+ }
+ }
+
+ // If the removed delta was ADD so we do not add the REMOVE to the feature deltas.
+ return false;
+ }
+ }
+ }
+
+ if (cachedIndices != null)
+ {
+ if (unprocessedFeatureDeltas == null)
+ {
+ unprocessedFeatureDeltas = new ArrayList<CDOFeatureDelta>();
+ }
+
+ unprocessedFeatureDeltas.add(featureDelta);
+ }
+
+ return true;
+ }
+
+ public void add(CDOFeatureDelta featureDelta)
+ {
+ // Only adds the feature delta to the list if required.
+ if (cleanupWithNewDelta(featureDelta))
+ {
+ featureDeltas.add(featureDelta);
+ }
+ }
+
+ public void apply(CDORevision revision)
+ {
+ for (CDOFeatureDelta featureDelta : featureDeltas)
+ {
+ ((CDOFeatureDeltaImpl)featureDelta).apply(revision);
+ }
+ }
+
+ @Override
+ public boolean adjustReferences(CDOReferenceAdjuster adjuster)
+ {
+ boolean changed = false;
+ for (CDOFeatureDelta featureDelta : featureDeltas)
+ {
+ changed |= ((CDOFeatureDeltaImpl)featureDelta).adjustReferences(adjuster);
+ }
+
+ return changed;
+ }
+
+ public void accept(CDOFeatureDeltaVisitor visitor)
+ {
+ visitor.visit(this);
+ }
+
+ @Override
+ public boolean isStructurallyEqual(Object obj)
+ {
+ if (!super.isStructurallyEqual(obj))
+ {
+ return false;
+ }
+
+ CDOListFeatureDelta that = (CDOListFeatureDelta)obj;
+ return ObjectUtil.equals(featureDeltas, that.getListChanges());
+ }
+
+ @Override
+ protected String toStringAdditional()
+ {
+ return "list=" + featureDeltas; //$NON-NLS-1$
+ }
+
+ /**
+ * Copied from JAVA 1.6 {@link Arrays Arrays.copyOf}.
+ */
+ private static <T, U> T[] copyOf(U[] original, int newLength, Class<? extends T[]> newType)
+ {
+ @SuppressWarnings("unchecked")
+ T[] copy = (Object)newType == (Object)Object[].class ? (T[])new Object[newLength] : (T[])Array.newInstance(
+ newType.getComponentType(), newLength);
+ System.arraycopy(original, 0, copy, 0, Math.min(original.length, newLength));
+ return copy;
+ }
+
+ /**
+ * Copied from JAVA 1.6 {@link Arrays Arrays.copyOf}.
+ */
+ private static int[] copyOf(int[] original, int newLength)
+ {
+ int[] copy = new int[newLength];
+ System.arraycopy(original, 0, copy, 0, Math.min(original.length, newLength));
+ return copy;
+ }
+}
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 f3fa903d1e..e8c352afc6 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
@@ -1,207 +1,207 @@
-/*
- * Copyright (c) 2004 - 2011 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.revision.delta;
-
-import org.eclipse.emf.cdo.common.protocol.CDODataInput;
-import org.eclipse.emf.cdo.common.protocol.CDODataOutput;
-import org.eclipse.emf.cdo.common.revision.CDORevision;
-import org.eclipse.emf.cdo.common.revision.delta.CDOFeatureDelta;
-import org.eclipse.emf.cdo.common.revision.delta.CDOFeatureDeltaVisitor;
-import org.eclipse.emf.cdo.common.revision.delta.CDOMoveFeatureDelta;
-import org.eclipse.emf.cdo.spi.common.revision.CDOReferenceAdjuster;
-import org.eclipse.emf.cdo.spi.common.revision.InternalCDOFeatureDelta.ListIndexAffecting;
-import org.eclipse.emf.cdo.spi.common.revision.InternalCDOFeatureDelta.WithIndex;
-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;
-import java.text.MessageFormat;
-
-/**
- * @author Simon McDuff
- */
-public class CDOMoveFeatureDeltaImpl extends CDOFeatureDeltaImpl implements CDOMoveFeatureDelta, ListIndexAffecting,
- WithIndex
-{
- private int oldPosition;
-
- private int newPosition;
-
- private Object value;
-
- public CDOMoveFeatureDeltaImpl(EStructuralFeature feature, int newPosition, int oldPosition)
- {
- super(feature);
- this.newPosition = newPosition;
- this.oldPosition = oldPosition;
- value = UNKNOWN_VALUE;
- }
-
- public CDOMoveFeatureDeltaImpl(CDODataInput in, EClass eClass) throws IOException
- {
- super(in, eClass);
- newPosition = in.readInt();
- oldPosition = in.readInt();
- value = UNKNOWN_VALUE;
- }
-
- @Override
- public void write(CDODataOutput out, EClass eClass) throws IOException
- {
- super.write(out, eClass);
- out.writeInt(newPosition);
- out.writeInt(oldPosition);
- }
-
- public int getNewPosition()
- {
- return newPosition;
- }
-
- public int getOldPosition()
- {
- return oldPosition;
- }
-
- public Type getType()
- {
- return Type.MOVE;
- }
-
- public Object getValue()
- {
- return value;
- }
-
- public void setValue(Object value)
- {
- this.value = value;
- }
-
- public void setOldPosition(int oldPosition)
- {
- this.oldPosition = oldPosition;
- }
-
- public void setNewPosition(int newPosition)
- {
- this.newPosition = newPosition;
- }
-
- public CDOFeatureDelta copy()
- {
- CDOFeatureDelta copy = new CDOMoveFeatureDeltaImpl(getFeature(), newPosition, oldPosition);
- ((CDOMoveFeatureDeltaImpl)copy).setValue(getValue());
- return copy;
- }
-
- public void apply(CDORevision revision)
- {
- ((InternalCDORevision)revision).getList(getFeature()).move(newPosition, oldPosition);
- }
-
- public void affectIndices(ListTargetAdding[] source, int[] indices)
- {
- if (oldPosition < newPosition)
- {
- for (int i = 1; i <= indices[0]; i++)
- {
- if (oldPosition < indices[i] && indices[i] <= newPosition)
- {
- --indices[i];
- }
- else if (indices[i] == oldPosition)
- {
- indices[i] = newPosition;
- }
- }
- }
- else if (newPosition < oldPosition)
- {
- for (int i = 1; i <= indices[0]; i++)
- {
- if (newPosition <= indices[i] && indices[i] < oldPosition)
- {
- ++indices[i];
- }
- else if (indices[i] == oldPosition)
- {
- indices[i] = newPosition;
- }
- }
- }
- }
-
- public void accept(CDOFeatureDeltaVisitor visitor)
- {
- visitor.visit(this);
- }
-
- public void adjustAfterAddition(int index)
- {
- if (index <= oldPosition)
- {
- ++oldPosition;
- }
-
- if (index <= newPosition)
- {
- ++newPosition;
- }
- }
-
- public void adjustAfterRemoval(int index)
- {
- if (index < oldPosition && oldPosition > 0)
- {
- --oldPosition;
- }
-
- // Index fix for moves from left to right.
- if (oldPosition < newPosition)
- {
- --index;
- }
-
- if (index < newPosition && newPosition > 0)
- {
- --newPosition;
- }
- }
-
- @Override
- public boolean adjustReferences(CDOReferenceAdjuster adjuster)
- {
- return false;
- }
-
- @Override
- public boolean isStructurallyEqual(Object obj)
- {
- if (!super.isStructurallyEqual(obj))
- {
- return false;
- }
-
- CDOMoveFeatureDelta that = (CDOMoveFeatureDelta)obj;
- return oldPosition == that.getOldPosition() && newPosition == that.getNewPosition();
- }
-
- @Override
- protected String toStringAdditional()
- {
- return MessageFormat.format("from={0}, to={1}, value={2}", oldPosition, newPosition, value);
- }
-
-}
+/*
+ * Copyright (c) 2004 - 2012 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.revision.delta;
+
+import org.eclipse.emf.cdo.common.protocol.CDODataInput;
+import org.eclipse.emf.cdo.common.protocol.CDODataOutput;
+import org.eclipse.emf.cdo.common.revision.CDORevision;
+import org.eclipse.emf.cdo.common.revision.delta.CDOFeatureDelta;
+import org.eclipse.emf.cdo.common.revision.delta.CDOFeatureDeltaVisitor;
+import org.eclipse.emf.cdo.common.revision.delta.CDOMoveFeatureDelta;
+import org.eclipse.emf.cdo.spi.common.revision.CDOReferenceAdjuster;
+import org.eclipse.emf.cdo.spi.common.revision.InternalCDOFeatureDelta.ListIndexAffecting;
+import org.eclipse.emf.cdo.spi.common.revision.InternalCDOFeatureDelta.WithIndex;
+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;
+import java.text.MessageFormat;
+
+/**
+ * @author Simon McDuff
+ */
+public class CDOMoveFeatureDeltaImpl extends CDOFeatureDeltaImpl implements CDOMoveFeatureDelta, ListIndexAffecting,
+ WithIndex
+{
+ private int oldPosition;
+
+ private int newPosition;
+
+ private Object value;
+
+ public CDOMoveFeatureDeltaImpl(EStructuralFeature feature, int newPosition, int oldPosition)
+ {
+ super(feature);
+ this.newPosition = newPosition;
+ this.oldPosition = oldPosition;
+ value = UNKNOWN_VALUE;
+ }
+
+ public CDOMoveFeatureDeltaImpl(CDODataInput in, EClass eClass) throws IOException
+ {
+ super(in, eClass);
+ newPosition = in.readInt();
+ oldPosition = in.readInt();
+ value = UNKNOWN_VALUE;
+ }
+
+ @Override
+ public void write(CDODataOutput out, EClass eClass) throws IOException
+ {
+ super.write(out, eClass);
+ out.writeInt(newPosition);
+ out.writeInt(oldPosition);
+ }
+
+ public int getNewPosition()
+ {
+ return newPosition;
+ }
+
+ public int getOldPosition()
+ {
+ return oldPosition;
+ }
+
+ public Type getType()
+ {
+ return Type.MOVE;
+ }
+
+ public Object getValue()
+ {
+ return value;
+ }
+
+ public void setValue(Object value)
+ {
+ this.value = value;
+ }
+
+ public void setOldPosition(int oldPosition)
+ {
+ this.oldPosition = oldPosition;
+ }
+
+ public void setNewPosition(int newPosition)
+ {
+ this.newPosition = newPosition;
+ }
+
+ public CDOFeatureDelta copy()
+ {
+ CDOFeatureDelta copy = new CDOMoveFeatureDeltaImpl(getFeature(), newPosition, oldPosition);
+ ((CDOMoveFeatureDeltaImpl)copy).setValue(getValue());
+ return copy;
+ }
+
+ public void apply(CDORevision revision)
+ {
+ ((InternalCDORevision)revision).getList(getFeature()).move(newPosition, oldPosition);
+ }
+
+ public void affectIndices(ListTargetAdding[] source, int[] indices)
+ {
+ if (oldPosition < newPosition)
+ {
+ for (int i = 1; i <= indices[0]; i++)
+ {
+ if (oldPosition < indices[i] && indices[i] <= newPosition)
+ {
+ --indices[i];
+ }
+ else if (indices[i] == oldPosition)
+ {
+ indices[i] = newPosition;
+ }
+ }
+ }
+ else if (newPosition < oldPosition)
+ {
+ for (int i = 1; i <= indices[0]; i++)
+ {
+ if (newPosition <= indices[i] && indices[i] < oldPosition)
+ {
+ ++indices[i];
+ }
+ else if (indices[i] == oldPosition)
+ {
+ indices[i] = newPosition;
+ }
+ }
+ }
+ }
+
+ public void accept(CDOFeatureDeltaVisitor visitor)
+ {
+ visitor.visit(this);
+ }
+
+ public void adjustAfterAddition(int index)
+ {
+ if (index <= oldPosition)
+ {
+ ++oldPosition;
+ }
+
+ if (index <= newPosition)
+ {
+ ++newPosition;
+ }
+ }
+
+ public void adjustAfterRemoval(int index)
+ {
+ if (index < oldPosition && oldPosition > 0)
+ {
+ --oldPosition;
+ }
+
+ // Index fix for moves from left to right.
+ if (oldPosition < newPosition)
+ {
+ --index;
+ }
+
+ if (index < newPosition && newPosition > 0)
+ {
+ --newPosition;
+ }
+ }
+
+ @Override
+ public boolean adjustReferences(CDOReferenceAdjuster adjuster)
+ {
+ return false;
+ }
+
+ @Override
+ public boolean isStructurallyEqual(Object obj)
+ {
+ if (!super.isStructurallyEqual(obj))
+ {
+ return false;
+ }
+
+ CDOMoveFeatureDelta that = (CDOMoveFeatureDelta)obj;
+ return oldPosition == that.getOldPosition() && newPosition == that.getNewPosition();
+ }
+
+ @Override
+ protected String toStringAdditional()
+ {
+ return MessageFormat.format("from={0}, to={1}, value={2}", oldPosition, newPosition, value);
+ }
+
+}
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 0b8e303f68..4141ffc4c6 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
@@ -1,99 +1,99 @@
-/*
- * Copyright (c) 2004 - 2011 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.revision.delta;
-
-import org.eclipse.emf.cdo.common.protocol.CDODataInput;
-import org.eclipse.emf.cdo.common.protocol.CDODataOutput;
-import org.eclipse.emf.cdo.common.revision.CDORevision;
-import org.eclipse.emf.cdo.common.revision.delta.CDOFeatureDelta;
-import org.eclipse.emf.cdo.common.revision.delta.CDOFeatureDeltaVisitor;
-import org.eclipse.emf.cdo.common.revision.delta.CDORemoveFeatureDelta;
-import org.eclipse.emf.cdo.spi.common.revision.InternalCDOFeatureDelta.ListIndexAffecting;
-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;
-
-/**
- * @author Simon McDuff
- */
-public class CDORemoveFeatureDeltaImpl extends CDOSingleValueFeatureDeltaImpl implements CDORemoveFeatureDelta,
- ListIndexAffecting
-{
- public CDORemoveFeatureDeltaImpl(EStructuralFeature feature, int index)
- {
- super(feature, index, UNKNOWN_VALUE);
- }
-
- public CDORemoveFeatureDeltaImpl(CDODataInput in, EClass eClass) throws IOException
- {
- super(in, eClass);
- }
-
- @Override
- protected void writeValue(CDODataOutput out, EClass eClass) throws IOException
- {
- // Do nothing
- }
-
- @Override
- protected Object readValue(CDODataInput in, EClass eClass) throws IOException
- {
- return UNKNOWN_VALUE;
- }
-
- public Type getType()
- {
- return Type.REMOVE;
- }
-
- public CDOFeatureDelta copy()
- {
- CDORemoveFeatureDeltaImpl delta = new CDORemoveFeatureDeltaImpl(getFeature(), getIndex());
- delta.setValue(getValue());
- return delta;
- }
-
- public void apply(CDORevision revision)
- {
- ((InternalCDORevision)revision).getList(getFeature()).remove(getIndex());
- }
-
- public void accept(CDOFeatureDeltaVisitor visitor)
- {
- visitor.visit(this);
- }
-
- public void affectIndices(ListTargetAdding sources[], int[] indices)
- {
- int index = getIndex();
- for (int i = 1; i <= indices[0]; i++)
- {
- if (indices[i] > index)
- {
- --indices[i];
- }
- else if (indices[i] == index)
- {
- int rest = indices[0]-- - i;
- if (rest > 0)
- {
- System.arraycopy(indices, i + 1, indices, i, rest);
- System.arraycopy(sources, i + 1, sources, i, rest);
- --i;
- }
- }
- }
- }
-}
+/*
+ * Copyright (c) 2004 - 2012 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.revision.delta;
+
+import org.eclipse.emf.cdo.common.protocol.CDODataInput;
+import org.eclipse.emf.cdo.common.protocol.CDODataOutput;
+import org.eclipse.emf.cdo.common.revision.CDORevision;
+import org.eclipse.emf.cdo.common.revision.delta.CDOFeatureDelta;
+import org.eclipse.emf.cdo.common.revision.delta.CDOFeatureDeltaVisitor;
+import org.eclipse.emf.cdo.common.revision.delta.CDORemoveFeatureDelta;
+import org.eclipse.emf.cdo.spi.common.revision.InternalCDOFeatureDelta.ListIndexAffecting;
+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;
+
+/**
+ * @author Simon McDuff
+ */
+public class CDORemoveFeatureDeltaImpl extends CDOSingleValueFeatureDeltaImpl implements CDORemoveFeatureDelta,
+ ListIndexAffecting
+{
+ public CDORemoveFeatureDeltaImpl(EStructuralFeature feature, int index)
+ {
+ super(feature, index, UNKNOWN_VALUE);
+ }
+
+ public CDORemoveFeatureDeltaImpl(CDODataInput in, EClass eClass) throws IOException
+ {
+ super(in, eClass);
+ }
+
+ @Override
+ protected void writeValue(CDODataOutput out, EClass eClass) throws IOException
+ {
+ // Do nothing
+ }
+
+ @Override
+ protected Object readValue(CDODataInput in, EClass eClass) throws IOException
+ {
+ return UNKNOWN_VALUE;
+ }
+
+ public Type getType()
+ {
+ return Type.REMOVE;
+ }
+
+ public CDOFeatureDelta copy()
+ {
+ CDORemoveFeatureDeltaImpl delta = new CDORemoveFeatureDeltaImpl(getFeature(), getIndex());
+ delta.setValue(getValue());
+ return delta;
+ }
+
+ public void apply(CDORevision revision)
+ {
+ ((InternalCDORevision)revision).getList(getFeature()).remove(getIndex());
+ }
+
+ public void accept(CDOFeatureDeltaVisitor visitor)
+ {
+ visitor.visit(this);
+ }
+
+ public void affectIndices(ListTargetAdding sources[], int[] indices)
+ {
+ int index = getIndex();
+ for (int i = 1; i <= indices[0]; i++)
+ {
+ if (indices[i] > index)
+ {
+ --indices[i];
+ }
+ else if (indices[i] == index)
+ {
+ int rest = indices[0]-- - i;
+ if (rest > 0)
+ {
+ System.arraycopy(indices, i + 1, indices, i, rest);
+ System.arraycopy(sources, i + 1, sources, i, rest);
+ --i;
+ }
+ }
+ }
+ }
+}
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 bd5b0ba57e..de4a5c3859 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
@@ -1,551 +1,551 @@
-/*
- * Copyright (c) 2004 - 2011 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 - bug 201266
- * Simon McDuff - bug 204890
- */
-package org.eclipse.emf.cdo.internal.common.revision.delta;
-
-import org.eclipse.emf.cdo.common.branch.CDOBranch;
-import org.eclipse.emf.cdo.common.id.CDOID;
-import org.eclipse.emf.cdo.common.id.CDOWithID;
-import org.eclipse.emf.cdo.common.model.CDOModelUtil;
-import org.eclipse.emf.cdo.common.protocol.CDODataInput;
-import org.eclipse.emf.cdo.common.protocol.CDODataOutput;
-import org.eclipse.emf.cdo.common.revision.CDOElementProxy;
-import org.eclipse.emf.cdo.common.revision.CDOList;
-import org.eclipse.emf.cdo.common.revision.CDORevisable;
-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.cdo.common.revision.delta.CDOClearFeatureDelta;
-import org.eclipse.emf.cdo.common.revision.delta.CDOFeatureDelta;
-import org.eclipse.emf.cdo.common.revision.delta.CDOFeatureDeltaVisitor;
-import org.eclipse.emf.cdo.common.revision.delta.CDOListFeatureDelta;
-import org.eclipse.emf.cdo.common.revision.delta.CDORevisionDelta;
-import org.eclipse.emf.cdo.common.revision.delta.CDOUnsetFeatureDelta;
-import org.eclipse.emf.cdo.common.util.PartialCollectionLoadingNotSupportedException;
-import org.eclipse.emf.cdo.spi.common.revision.CDOReferenceAdjuster;
-import org.eclipse.emf.cdo.spi.common.revision.InternalCDOFeatureDelta;
-import org.eclipse.emf.cdo.spi.common.revision.InternalCDORevision;
-import org.eclipse.emf.cdo.spi.common.revision.InternalCDORevisionDelta;
-
-import org.eclipse.emf.common.util.ECollections;
-import org.eclipse.emf.common.util.EList;
-import org.eclipse.emf.ecore.EClass;
-import org.eclipse.emf.ecore.EStructuralFeature;
-import org.eclipse.emf.ecore.change.ListChange;
-import org.eclipse.emf.ecore.change.util.ListDifferenceAnalyzer;
-
-import java.io.IOException;
-import java.text.MessageFormat;
-import java.util.ArrayList;
-import java.util.Collection;
-import java.util.HashMap;
-import java.util.Iterator;
-import java.util.List;
-import java.util.ListIterator;
-import java.util.Map;
-
-/**
- * @author Eike Stepper
- */
-public class CDORevisionDeltaImpl implements InternalCDORevisionDelta
-{
- private EClass eClass;
-
- private CDOID id;
-
- private CDOBranch branch;
-
- private int version;
-
- private CDORevisable target;
-
- private Map<EStructuralFeature, CDOFeatureDelta> featureDeltas = new HashMap<EStructuralFeature, CDOFeatureDelta>();
-
- public CDORevisionDeltaImpl(CDORevision revision)
- {
- eClass = revision.getEClass();
- id = revision.getID();
- branch = revision.getBranch();
- version = revision.getVersion();
- }
-
- public CDORevisionDeltaImpl(CDORevisionDelta revisionDelta, boolean copyFeatureDeltas)
- {
- eClass = revisionDelta.getEClass();
- id = revisionDelta.getID();
- branch = revisionDelta.getBranch();
- version = revisionDelta.getVersion();
-
- if (copyFeatureDeltas)
- {
- for (CDOFeatureDelta delta : revisionDelta.getFeatureDeltas())
- {
- addFeatureDelta(((InternalCDOFeatureDelta)delta).copy());
- }
- }
- }
-
- public CDORevisionDeltaImpl(CDORevision sourceRevision, CDORevision targetRevision)
- {
- if (sourceRevision.getEClass() != targetRevision.getEClass())
- {
- throw new IllegalArgumentException();
- }
-
- eClass = sourceRevision.getEClass();
- id = sourceRevision.getID();
- branch = sourceRevision.getBranch();
- version = sourceRevision.getVersion();
- target = CDORevisionUtil.copyRevisable(targetRevision);
-
- compare(sourceRevision, targetRevision);
-
- CDORevisionData originData = sourceRevision.data();
- CDORevisionData dirtyData = targetRevision.data();
-
- Object dirtyContainerID = dirtyData.getContainerID();
- if (dirtyContainerID instanceof CDOWithID)
- {
- dirtyContainerID = ((CDOWithID)dirtyContainerID).cdoID();
- }
-
- if (!compare(originData.getContainerID(), dirtyContainerID)
- || !compare(originData.getContainingFeatureID(), dirtyData.getContainingFeatureID())
- || !compare(originData.getResourceID(), dirtyData.getResourceID()))
- {
- addFeatureDelta(new CDOContainerFeatureDeltaImpl(dirtyData.getResourceID(), dirtyContainerID,
- dirtyData.getContainingFeatureID()));
- }
- }
-
- public CDORevisionDeltaImpl(CDODataInput in) throws IOException
- {
- eClass = (EClass)in.readCDOClassifierRefAndResolve();
- id = in.readCDOID();
- branch = in.readCDOBranch();
- version = in.readInt();
- if (version < 0)
- {
- version = -version;
- target = in.readCDORevisable();
- }
-
- int size = in.readInt();
- for (int i = 0; i < size; i++)
- {
- CDOFeatureDelta featureDelta = in.readCDOFeatureDelta(eClass);
- featureDeltas.put(featureDelta.getFeature(), featureDelta);
- }
- }
-
- public void write(CDODataOutput out) throws IOException
- {
- out.writeCDOClassifierRef(eClass);
- out.writeCDOID(id);
- out.writeCDOBranch(branch);
- if (target == null)
- {
- out.writeInt(version);
- }
- else
- {
- out.writeInt(-version);
- out.writeCDORevisable(target);
- }
-
- out.writeInt(featureDeltas.size());
- for (CDOFeatureDelta featureDelta : featureDeltas.values())
- {
- out.writeCDOFeatureDelta(eClass, featureDelta);
- }
- }
-
- public EClass getEClass()
- {
- return eClass;
- }
-
- public CDOID getID()
- {
- return id;
- }
-
- public CDOBranch getBranch()
- {
- return branch;
- }
-
- public void setBranch(CDOBranch branch)
- {
- this.branch = branch;
- }
-
- public int getVersion()
- {
- return version;
- }
-
- public void setVersion(int version)
- {
- this.version = version;
- }
-
- public CDORevisable getTarget()
- {
- return target;
- }
-
- public void setTarget(CDORevisable target)
- {
- this.target = target;
- }
-
- public boolean isEmpty()
- {
- return featureDeltas.isEmpty();
- }
-
- public CDORevisionDelta copy()
- {
- return new CDORevisionDeltaImpl(this, true);
- }
-
- public Map<EStructuralFeature, CDOFeatureDelta> getFeatureDeltaMap()
- {
- return featureDeltas;
- }
-
- public CDOFeatureDelta getFeatureDelta(EStructuralFeature feature)
- {
- return featureDeltas.get(feature);
- }
-
- public List<CDOFeatureDelta> getFeatureDeltas()
- {
- return new ArrayList<CDOFeatureDelta>(featureDeltas.values());
- }
-
- public void apply(CDORevision revision)
- {
- for (CDOFeatureDelta featureDelta : featureDeltas.values())
- {
- ((CDOFeatureDeltaImpl)featureDelta).apply(revision);
- }
- }
-
- public void addFeatureDelta(CDOFeatureDelta delta)
- {
- if (delta instanceof CDOListFeatureDelta)
- {
- CDOListFeatureDelta deltas = (CDOListFeatureDelta)delta;
- for (CDOFeatureDelta childDelta : deltas.getListChanges())
- {
- addFeatureDelta(childDelta);
- }
- }
- else
- {
- addSingleFeatureDelta(delta);
- }
- }
-
- private void addSingleFeatureDelta(CDOFeatureDelta delta)
- {
- EStructuralFeature feature = delta.getFeature();
- if (feature.isMany())
- {
- CDOListFeatureDeltaImpl listDelta = (CDOListFeatureDeltaImpl)featureDeltas.get(feature);
- if (listDelta == null)
- {
- listDelta = new CDOListFeatureDeltaImpl(feature);
- featureDeltas.put(listDelta.getFeature(), listDelta);
- }
-
- // Remove all previous changes
- if (delta instanceof CDOClearFeatureDelta || delta instanceof CDOUnsetFeatureDelta)
- {
- listDelta.getListChanges().clear();
- }
-
- listDelta.add(delta);
- }
- else
- {
- featureDeltas.put(feature, delta);
- }
- }
-
- public boolean adjustReferences(CDOReferenceAdjuster referenceAdjuster)
- {
- boolean changed = false;
- for (CDOFeatureDelta featureDelta : featureDeltas.values())
- {
- changed |= ((CDOFeatureDeltaImpl)featureDelta).adjustReferences(referenceAdjuster);
- }
-
- return changed;
- }
-
- public void accept(CDOFeatureDeltaVisitor visitor)
- {
- for (CDOFeatureDelta featureDelta : featureDeltas.values())
- {
- ((CDOFeatureDeltaImpl)featureDelta).accept(visitor);
- }
- }
-
- private void compare(CDORevision originRevision, CDORevision dirtyRevision)
- {
- CDORevisionData originData = originRevision.data();
- CDORevisionData dirtyData = dirtyRevision.data();
-
- for (final EStructuralFeature feature : CDOModelUtil.getAllPersistentFeatures(eClass))
- {
- if (feature.isMany())
- {
- if (originData.size(feature) > 0 && dirtyData.size(feature) == 0)
- {
- addFeatureDelta(new CDOClearFeatureDeltaImpl(feature));
- }
- else
- {
- CDOListFeatureDelta listFeatureDelta = new CDOListFeatureDeltaImpl(feature);
- final List<CDOFeatureDelta> changes = listFeatureDelta.getListChanges();
-
- ListDifferenceAnalyzer analyzer = new ListDifferenceAnalyzer()
- {
- @Override
- public void analyzeLists(EList<Object> oldList, EList<?> newList, EList<ListChange> listChanges)
- {
- checkNoProxies(oldList);
- checkNoProxies(newList);
- super.analyzeLists(oldList, newList, listChanges);
- }
-
- @Override
- protected void createAddListChange(EList<Object> oldList, EList<ListChange> listChanges, Object value,
- int index)
- {
- CDOFeatureDelta delta = new CDOAddFeatureDeltaImpl(feature, index, value);
- changes.add(delta);
- oldList.add(index, value);
- }
-
- @Override
- protected void createRemoveListChange(EList<?> oldList, EList<ListChange> listChanges, Object value,
- int index)
- {
- CDORemoveFeatureDeltaImpl delta = new CDORemoveFeatureDeltaImpl(feature, index);
- // fix until ListDifferenceAnalyzer delivers the correct value (bug #308618).
- delta.setValue(oldList.get(index));
- changes.add(delta);
- oldList.remove(index);
- }
-
- @Override
- protected void createMoveListChange(EList<?> oldList, EList<ListChange> listChanges, Object value,
- int index, int toIndex)
- {
- CDOMoveFeatureDeltaImpl delta = new CDOMoveFeatureDeltaImpl(feature, toIndex, index);
- // fix until ListDifferenceAnalyzer delivers the correct value (same problem as bug #308618).
- delta.setValue(oldList.get(index));
- changes.add(delta);
- oldList.move(toIndex, index);
- }
-
- private void checkNoProxies(EList<?> list)
- {
- for (Object element : list)
- {
- if (element instanceof CDOElementProxy)
- {
- throw new PartialCollectionLoadingNotSupportedException("List contains proxy elements");
- }
- }
- }
- };
-
- CDOList originList = ((InternalCDORevision)originRevision).getList(feature);
- CDOList dirtyList = ((InternalCDORevision)dirtyRevision).getList(feature);
-
- analyzer.analyzeLists(originList, dirtyList, new NOOPList());
- if (!changes.isEmpty())
- {
- featureDeltas.put(feature, listFeatureDelta);
- }
- }
- }
- else
- {
- Object originValue = originData.get(feature, 0);
- Object dirtyValue = dirtyData.get(feature, 0);
- if (!compare(originValue, dirtyValue))
- {
- if (dirtyValue == null)
- {
- addFeatureDelta(new CDOUnsetFeatureDeltaImpl(feature));
- }
- else
- {
- addFeatureDelta(new CDOSetFeatureDeltaImpl(feature, 0, dirtyValue, originValue));
- }
- }
- }
- }
- }
-
- private boolean compare(Object originValue, Object dirtyValue)
- {
- return originValue == dirtyValue || originValue != null && dirtyValue != null && originValue.equals(dirtyValue);
- }
-
- @Override
- public String toString()
- {
- return MessageFormat.format("CDORevisionDelta[{0}@{1}:{2}v{3} --> {4}]", eClass.getName(), id, branch.getID(),
- version, featureDeltas.values());
- }
-
- /**
- * @author Eike Stepper
- */
- public static class NOOPList implements EList<ListChange>
- {
- private static final EList<ListChange> LIST = ECollections.emptyEList();
-
- public NOOPList()
- {
- }
-
- public int size()
- {
- return 0;
- }
-
- public boolean isEmpty()
- {
- return true;
- }
-
- public boolean contains(Object o)
- {
- return false;
- }
-
- public Iterator<ListChange> iterator()
- {
- return LIST.iterator();
- }
-
- public Object[] toArray()
- {
- return LIST.toArray();
- }
-
- public <T> T[] toArray(T[] a)
- {
- return LIST.toArray(a);
- }
-
- public boolean add(ListChange o)
- {
- return false;
- }
-
- public boolean remove(Object o)
- {
- return false;
- }
-
- public boolean containsAll(Collection<?> c)
- {
- return false;
- }
-
- public boolean addAll(Collection<? extends ListChange> c)
- {
- return false;
- }
-
- public boolean addAll(int index, Collection<? extends ListChange> c)
- {
- return false;
- }
-
- public boolean removeAll(Collection<?> c)
- {
- return false;
- }
-
- public boolean retainAll(Collection<?> c)
- {
- return false;
- }
-
- public void clear()
- {
- }
-
- public ListChange get(int index)
- {
- return LIST.get(index);
- }
-
- public ListChange set(int index, ListChange element)
- {
- return null;
- }
-
- public void add(int index, ListChange element)
- {
- }
-
- public ListChange remove(int index)
- {
- return null;
- }
-
- public int indexOf(Object o)
- {
- return LIST.indexOf(o);
- }
-
- public int lastIndexOf(Object o)
- {
- return LIST.lastIndexOf(o);
- }
-
- public ListIterator<ListChange> listIterator()
- {
- return LIST.listIterator();
- }
-
- public ListIterator<ListChange> listIterator(int index)
- {
- return LIST.listIterator(index);
- }
-
- public List<ListChange> subList(int fromIndex, int toIndex)
- {
- return LIST.subList(fromIndex, toIndex);
- }
-
- public void move(int newPosition, ListChange object)
- {
- }
-
- public ListChange move(int newPosition, int oldPosition)
- {
- return null;
- }
- }
-}
+/*
+ * Copyright (c) 2004 - 2012 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 - bug 201266
+ * Simon McDuff - bug 204890
+ */
+package org.eclipse.emf.cdo.internal.common.revision.delta;
+
+import org.eclipse.emf.cdo.common.branch.CDOBranch;
+import org.eclipse.emf.cdo.common.id.CDOID;
+import org.eclipse.emf.cdo.common.id.CDOWithID;
+import org.eclipse.emf.cdo.common.model.CDOModelUtil;
+import org.eclipse.emf.cdo.common.protocol.CDODataInput;
+import org.eclipse.emf.cdo.common.protocol.CDODataOutput;
+import org.eclipse.emf.cdo.common.revision.CDOElementProxy;
+import org.eclipse.emf.cdo.common.revision.CDOList;
+import org.eclipse.emf.cdo.common.revision.CDORevisable;
+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.cdo.common.revision.delta.CDOClearFeatureDelta;
+import org.eclipse.emf.cdo.common.revision.delta.CDOFeatureDelta;
+import org.eclipse.emf.cdo.common.revision.delta.CDOFeatureDeltaVisitor;
+import org.eclipse.emf.cdo.common.revision.delta.CDOListFeatureDelta;
+import org.eclipse.emf.cdo.common.revision.delta.CDORevisionDelta;
+import org.eclipse.emf.cdo.common.revision.delta.CDOUnsetFeatureDelta;
+import org.eclipse.emf.cdo.common.util.PartialCollectionLoadingNotSupportedException;
+import org.eclipse.emf.cdo.spi.common.revision.CDOReferenceAdjuster;
+import org.eclipse.emf.cdo.spi.common.revision.InternalCDOFeatureDelta;
+import org.eclipse.emf.cdo.spi.common.revision.InternalCDORevision;
+import org.eclipse.emf.cdo.spi.common.revision.InternalCDORevisionDelta;
+
+import org.eclipse.emf.common.util.ECollections;
+import org.eclipse.emf.common.util.EList;
+import org.eclipse.emf.ecore.EClass;
+import org.eclipse.emf.ecore.EStructuralFeature;
+import org.eclipse.emf.ecore.change.ListChange;
+import org.eclipse.emf.ecore.change.util.ListDifferenceAnalyzer;
+
+import java.io.IOException;
+import java.text.MessageFormat;
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.HashMap;
+import java.util.Iterator;
+import java.util.List;
+import java.util.ListIterator;
+import java.util.Map;
+
+/**
+ * @author Eike Stepper
+ */
+public class CDORevisionDeltaImpl implements InternalCDORevisionDelta
+{
+ private EClass eClass;
+
+ private CDOID id;
+
+ private CDOBranch branch;
+
+ private int version;
+
+ private CDORevisable target;
+
+ private Map<EStructuralFeature, CDOFeatureDelta> featureDeltas = new HashMap<EStructuralFeature, CDOFeatureDelta>();
+
+ public CDORevisionDeltaImpl(CDORevision revision)
+ {
+ eClass = revision.getEClass();
+ id = revision.getID();
+ branch = revision.getBranch();
+ version = revision.getVersion();
+ }
+
+ public CDORevisionDeltaImpl(CDORevisionDelta revisionDelta, boolean copyFeatureDeltas)
+ {
+ eClass = revisionDelta.getEClass();
+ id = revisionDelta.getID();
+ branch = revisionDelta.getBranch();
+ version = revisionDelta.getVersion();
+
+ if (copyFeatureDeltas)
+ {
+ for (CDOFeatureDelta delta : revisionDelta.getFeatureDeltas())
+ {
+ addFeatureDelta(((InternalCDOFeatureDelta)delta).copy());
+ }
+ }
+ }
+
+ public CDORevisionDeltaImpl(CDORevision sourceRevision, CDORevision targetRevision)
+ {
+ if (sourceRevision.getEClass() != targetRevision.getEClass())
+ {
+ throw new IllegalArgumentException();
+ }
+
+ eClass = sourceRevision.getEClass();
+ id = sourceRevision.getID();
+ branch = sourceRevision.getBranch();
+ version = sourceRevision.getVersion();
+ target = CDORevisionUtil.copyRevisable(targetRevision);
+
+ compare(sourceRevision, targetRevision);
+
+ CDORevisionData originData = sourceRevision.data();
+ CDORevisionData dirtyData = targetRevision.data();
+
+ Object dirtyContainerID = dirtyData.getContainerID();
+ if (dirtyContainerID instanceof CDOWithID)
+ {
+ dirtyContainerID = ((CDOWithID)dirtyContainerID).cdoID();
+ }
+
+ if (!compare(originData.getContainerID(), dirtyContainerID)
+ || !compare(originData.getContainingFeatureID(), dirtyData.getContainingFeatureID())
+ || !compare(originData.getResourceID(), dirtyData.getResourceID()))
+ {
+ addFeatureDelta(new CDOContainerFeatureDeltaImpl(dirtyData.getResourceID(), dirtyContainerID,
+ dirtyData.getContainingFeatureID()));
+ }
+ }
+
+ public CDORevisionDeltaImpl(CDODataInput in) throws IOException
+ {
+ eClass = (EClass)in.readCDOClassifierRefAndResolve();
+ id = in.readCDOID();
+ branch = in.readCDOBranch();
+ version = in.readInt();
+ if (version < 0)
+ {
+ version = -version;
+ target = in.readCDORevisable();
+ }
+
+ int size = in.readInt();
+ for (int i = 0; i < size; i++)
+ {
+ CDOFeatureDelta featureDelta = in.readCDOFeatureDelta(eClass);
+ featureDeltas.put(featureDelta.getFeature(), featureDelta);
+ }
+ }
+
+ public void write(CDODataOutput out) throws IOException
+ {
+ out.writeCDOClassifierRef(eClass);
+ out.writeCDOID(id);
+ out.writeCDOBranch(branch);
+ if (target == null)
+ {
+ out.writeInt(version);
+ }
+ else
+ {
+ out.writeInt(-version);
+ out.writeCDORevisable(target);
+ }
+
+ out.writeInt(featureDeltas.size());
+ for (CDOFeatureDelta featureDelta : featureDeltas.values())
+ {
+ out.writeCDOFeatureDelta(eClass, featureDelta);
+ }
+ }
+
+ public EClass getEClass()
+ {
+ return eClass;
+ }
+
+ public CDOID getID()
+ {
+ return id;
+ }
+
+ public CDOBranch getBranch()
+ {
+ return branch;
+ }
+
+ public void setBranch(CDOBranch branch)
+ {
+ this.branch = branch;
+ }
+
+ public int getVersion()
+ {
+ return version;
+ }
+
+ public void setVersion(int version)
+ {
+ this.version = version;
+ }
+
+ public CDORevisable getTarget()
+ {
+ return target;
+ }
+
+ public void setTarget(CDORevisable target)
+ {
+ this.target = target;
+ }
+
+ public boolean isEmpty()
+ {
+ return featureDeltas.isEmpty();
+ }
+
+ public CDORevisionDelta copy()
+ {
+ return new CDORevisionDeltaImpl(this, true);
+ }
+
+ public Map<EStructuralFeature, CDOFeatureDelta> getFeatureDeltaMap()
+ {
+ return featureDeltas;
+ }
+
+ public CDOFeatureDelta getFeatureDelta(EStructuralFeature feature)
+ {
+ return featureDeltas.get(feature);
+ }
+
+ public List<CDOFeatureDelta> getFeatureDeltas()
+ {
+ return new ArrayList<CDOFeatureDelta>(featureDeltas.values());
+ }
+
+ public void apply(CDORevision revision)
+ {
+ for (CDOFeatureDelta featureDelta : featureDeltas.values())
+ {
+ ((CDOFeatureDeltaImpl)featureDelta).apply(revision);
+ }
+ }
+
+ public void addFeatureDelta(CDOFeatureDelta delta)
+ {
+ if (delta instanceof CDOListFeatureDelta)
+ {
+ CDOListFeatureDelta deltas = (CDOListFeatureDelta)delta;
+ for (CDOFeatureDelta childDelta : deltas.getListChanges())
+ {
+ addFeatureDelta(childDelta);
+ }
+ }
+ else
+ {
+ addSingleFeatureDelta(delta);
+ }
+ }
+
+ private void addSingleFeatureDelta(CDOFeatureDelta delta)
+ {
+ EStructuralFeature feature = delta.getFeature();
+ if (feature.isMany())
+ {
+ CDOListFeatureDeltaImpl listDelta = (CDOListFeatureDeltaImpl)featureDeltas.get(feature);
+ if (listDelta == null)
+ {
+ listDelta = new CDOListFeatureDeltaImpl(feature);
+ featureDeltas.put(listDelta.getFeature(), listDelta);
+ }
+
+ // Remove all previous changes
+ if (delta instanceof CDOClearFeatureDelta || delta instanceof CDOUnsetFeatureDelta)
+ {
+ listDelta.getListChanges().clear();
+ }
+
+ listDelta.add(delta);
+ }
+ else
+ {
+ featureDeltas.put(feature, delta);
+ }
+ }
+
+ public boolean adjustReferences(CDOReferenceAdjuster referenceAdjuster)
+ {
+ boolean changed = false;
+ for (CDOFeatureDelta featureDelta : featureDeltas.values())
+ {
+ changed |= ((CDOFeatureDeltaImpl)featureDelta).adjustReferences(referenceAdjuster);
+ }
+
+ return changed;
+ }
+
+ public void accept(CDOFeatureDeltaVisitor visitor)
+ {
+ for (CDOFeatureDelta featureDelta : featureDeltas.values())
+ {
+ ((CDOFeatureDeltaImpl)featureDelta).accept(visitor);
+ }
+ }
+
+ private void compare(CDORevision originRevision, CDORevision dirtyRevision)
+ {
+ CDORevisionData originData = originRevision.data();
+ CDORevisionData dirtyData = dirtyRevision.data();
+
+ for (final EStructuralFeature feature : CDOModelUtil.getAllPersistentFeatures(eClass))
+ {
+ if (feature.isMany())
+ {
+ if (originData.size(feature) > 0 && dirtyData.size(feature) == 0)
+ {
+ addFeatureDelta(new CDOClearFeatureDeltaImpl(feature));
+ }
+ else
+ {
+ CDOListFeatureDelta listFeatureDelta = new CDOListFeatureDeltaImpl(feature);
+ final List<CDOFeatureDelta> changes = listFeatureDelta.getListChanges();
+
+ ListDifferenceAnalyzer analyzer = new ListDifferenceAnalyzer()
+ {
+ @Override
+ public void analyzeLists(EList<Object> oldList, EList<?> newList, EList<ListChange> listChanges)
+ {
+ checkNoProxies(oldList);
+ checkNoProxies(newList);
+ super.analyzeLists(oldList, newList, listChanges);
+ }
+
+ @Override
+ protected void createAddListChange(EList<Object> oldList, EList<ListChange> listChanges, Object value,
+ int index)
+ {
+ CDOFeatureDelta delta = new CDOAddFeatureDeltaImpl(feature, index, value);
+ changes.add(delta);
+ oldList.add(index, value);
+ }
+
+ @Override
+ protected void createRemoveListChange(EList<?> oldList, EList<ListChange> listChanges, Object value,
+ int index)
+ {
+ CDORemoveFeatureDeltaImpl delta = new CDORemoveFeatureDeltaImpl(feature, index);
+ // fix until ListDifferenceAnalyzer delivers the correct value (bug #308618).
+ delta.setValue(oldList.get(index));
+ changes.add(delta);
+ oldList.remove(index);
+ }
+
+ @Override
+ protected void createMoveListChange(EList<?> oldList, EList<ListChange> listChanges, Object value,
+ int index, int toIndex)
+ {
+ CDOMoveFeatureDeltaImpl delta = new CDOMoveFeatureDeltaImpl(feature, toIndex, index);
+ // fix until ListDifferenceAnalyzer delivers the correct value (same problem as bug #308618).
+ delta.setValue(oldList.get(index));
+ changes.add(delta);
+ oldList.move(toIndex, index);
+ }
+
+ private void checkNoProxies(EList<?> list)
+ {
+ for (Object element : list)
+ {
+ if (element instanceof CDOElementProxy)
+ {
+ throw new PartialCollectionLoadingNotSupportedException("List contains proxy elements");
+ }
+ }
+ }
+ };
+
+ CDOList originList = ((InternalCDORevision)originRevision).getList(feature);
+ CDOList dirtyList = ((InternalCDORevision)dirtyRevision).getList(feature);
+
+ analyzer.analyzeLists(originList, dirtyList, new NOOPList());
+ if (!changes.isEmpty())
+ {
+ featureDeltas.put(feature, listFeatureDelta);
+ }
+ }
+ }
+ else
+ {
+ Object originValue = originData.get(feature, 0);
+ Object dirtyValue = dirtyData.get(feature, 0);
+ if (!compare(originValue, dirtyValue))
+ {
+ if (dirtyValue == null)
+ {
+ addFeatureDelta(new CDOUnsetFeatureDeltaImpl(feature));
+ }
+ else
+ {
+ addFeatureDelta(new CDOSetFeatureDeltaImpl(feature, 0, dirtyValue, originValue));
+ }
+ }
+ }
+ }
+ }
+
+ private boolean compare(Object originValue, Object dirtyValue)
+ {
+ return originValue == dirtyValue || originValue != null && dirtyValue != null && originValue.equals(dirtyValue);
+ }
+
+ @Override
+ public String toString()
+ {
+ return MessageFormat.format("CDORevisionDelta[{0}@{1}:{2}v{3} --> {4}]", eClass.getName(), id, branch.getID(),
+ version, featureDeltas.values());
+ }
+
+ /**
+ * @author Eike Stepper
+ */
+ public static class NOOPList implements EList<ListChange>
+ {
+ private static final EList<ListChange> LIST = ECollections.emptyEList();
+
+ public NOOPList()
+ {
+ }
+
+ public int size()
+ {
+ return 0;
+ }
+
+ public boolean isEmpty()
+ {
+ return true;
+ }
+
+ public boolean contains(Object o)
+ {
+ return false;
+ }
+
+ public Iterator<ListChange> iterator()
+ {
+ return LIST.iterator();
+ }
+
+ public Object[] toArray()
+ {
+ return LIST.toArray();
+ }
+
+ public <T> T[] toArray(T[] a)
+ {
+ return LIST.toArray(a);
+ }
+
+ public boolean add(ListChange o)
+ {
+ return false;
+ }
+
+ public boolean remove(Object o)
+ {
+ return false;
+ }
+
+ public boolean containsAll(Collection<?> c)
+ {
+ return false;
+ }
+
+ public boolean addAll(Collection<? extends ListChange> c)
+ {
+ return false;
+ }
+
+ public boolean addAll(int index, Collection<? extends ListChange> c)
+ {
+ return false;
+ }
+
+ public boolean removeAll(Collection<?> c)
+ {
+ return false;
+ }
+
+ public boolean retainAll(Collection<?> c)
+ {
+ return false;
+ }
+
+ public void clear()
+ {
+ }
+
+ public ListChange get(int index)
+ {
+ return LIST.get(index);
+ }
+
+ public ListChange set(int index, ListChange element)
+ {
+ return null;
+ }
+
+ public void add(int index, ListChange element)
+ {
+ }
+
+ public ListChange remove(int index)
+ {
+ return null;
+ }
+
+ public int indexOf(Object o)
+ {
+ return LIST.indexOf(o);
+ }
+
+ public int lastIndexOf(Object o)
+ {
+ return LIST.lastIndexOf(o);
+ }
+
+ public ListIterator<ListChange> listIterator()
+ {
+ return LIST.listIterator();
+ }
+
+ public ListIterator<ListChange> listIterator(int index)
+ {
+ return LIST.listIterator(index);
+ }
+
+ public List<ListChange> subList(int fromIndex, int toIndex)
+ {
+ return LIST.subList(fromIndex, toIndex);
+ }
+
+ public void move(int newPosition, ListChange object)
+ {
+ }
+
+ public ListChange move(int newPosition, int oldPosition)
+ {
+ return null;
+ }
+ }
+}
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 6887f655f3..859e7c72b7 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
@@ -1,97 +1,97 @@
-/*
- * Copyright (c) 2004 - 2011 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.revision.delta;
-
-import org.eclipse.emf.cdo.common.protocol.CDODataInput;
-import org.eclipse.emf.cdo.common.revision.CDORevision;
-import org.eclipse.emf.cdo.common.revision.delta.CDOFeatureDelta;
-import org.eclipse.emf.cdo.common.revision.delta.CDOFeatureDeltaVisitor;
-import org.eclipse.emf.cdo.common.revision.delta.CDOSetFeatureDelta;
-import org.eclipse.emf.cdo.spi.common.revision.InternalCDOFeatureDelta.ListTargetAdding;
-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;
-import java.text.MessageFormat;
-
-/**
- * @author Simon McDuff
- */
-public class CDOSetFeatureDeltaImpl extends CDOSingleValueFeatureDeltaImpl implements CDOSetFeatureDelta,
- ListTargetAdding
-{
- private Object oldValue = CDOSetFeatureDelta.UNSPECIFIED;
-
- public CDOSetFeatureDeltaImpl(EStructuralFeature feature, int index, Object value)
- {
- super(feature, index, value);
- }
-
- public CDOSetFeatureDeltaImpl(EStructuralFeature feature, int index, Object value, Object oldValue)
- {
- super(feature, index, value);
- this.oldValue = oldValue;
- }
-
- public CDOSetFeatureDeltaImpl(CDODataInput in, EClass eClass) throws IOException
- {
- super(in, eClass);
- }
-
- public Type getType()
- {
- return Type.SET;
- }
-
- public CDOFeatureDelta copy()
- {
- return new CDOSetFeatureDeltaImpl(getFeature(), getIndex(), getValue(), getOldValue());
- }
-
- public void apply(CDORevision revision)
- {
- ((InternalCDORevision)revision).set(getFeature(), getIndex(), getValue());
- }
-
- public void accept(CDOFeatureDeltaVisitor visitor)
- {
- visitor.visit(this);
- }
-
- public Object getOldValue()
- {
- return oldValue;
- }
-
- public void setOldValue(Object oldValue)
- {
- this.oldValue = oldValue;
- }
-
- @Override
- protected String toStringAdditional()
- {
- String oldValueForMessage;
- if (oldValue != CDOSetFeatureDelta.UNSPECIFIED)
- {
- oldValueForMessage = oldValue == null ? "null" : oldValue.toString();
- }
- else
- {
- oldValueForMessage = "UNSPECIFIED"; //$NON-NLS-1$
- }
-
- return super.toStringAdditional() + MessageFormat.format(", oldValue={0}", oldValueForMessage); //$NON-NLS-1$
- }
-}
+/*
+ * Copyright (c) 2004 - 2012 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.revision.delta;
+
+import org.eclipse.emf.cdo.common.protocol.CDODataInput;
+import org.eclipse.emf.cdo.common.revision.CDORevision;
+import org.eclipse.emf.cdo.common.revision.delta.CDOFeatureDelta;
+import org.eclipse.emf.cdo.common.revision.delta.CDOFeatureDeltaVisitor;
+import org.eclipse.emf.cdo.common.revision.delta.CDOSetFeatureDelta;
+import org.eclipse.emf.cdo.spi.common.revision.InternalCDOFeatureDelta.ListTargetAdding;
+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;
+import java.text.MessageFormat;
+
+/**
+ * @author Simon McDuff
+ */
+public class CDOSetFeatureDeltaImpl extends CDOSingleValueFeatureDeltaImpl implements CDOSetFeatureDelta,
+ ListTargetAdding
+{
+ private Object oldValue = CDOSetFeatureDelta.UNSPECIFIED;
+
+ public CDOSetFeatureDeltaImpl(EStructuralFeature feature, int index, Object value)
+ {
+ super(feature, index, value);
+ }
+
+ public CDOSetFeatureDeltaImpl(EStructuralFeature feature, int index, Object value, Object oldValue)
+ {
+ super(feature, index, value);
+ this.oldValue = oldValue;
+ }
+
+ public CDOSetFeatureDeltaImpl(CDODataInput in, EClass eClass) throws IOException
+ {
+ super(in, eClass);
+ }
+
+ public Type getType()
+ {
+ return Type.SET;
+ }
+
+ public CDOFeatureDelta copy()
+ {
+ return new CDOSetFeatureDeltaImpl(getFeature(), getIndex(), getValue(), getOldValue());
+ }
+
+ public void apply(CDORevision revision)
+ {
+ ((InternalCDORevision)revision).set(getFeature(), getIndex(), getValue());
+ }
+
+ public void accept(CDOFeatureDeltaVisitor visitor)
+ {
+ visitor.visit(this);
+ }
+
+ public Object getOldValue()
+ {
+ return oldValue;
+ }
+
+ public void setOldValue(Object oldValue)
+ {
+ this.oldValue = oldValue;
+ }
+
+ @Override
+ protected String toStringAdditional()
+ {
+ String oldValueForMessage;
+ if (oldValue != CDOSetFeatureDelta.UNSPECIFIED)
+ {
+ oldValueForMessage = oldValue == null ? "null" : oldValue.toString();
+ }
+ else
+ {
+ oldValueForMessage = "UNSPECIFIED"; //$NON-NLS-1$
+ }
+
+ return super.toStringAdditional() + MessageFormat.format(", oldValue={0}", oldValueForMessage); //$NON-NLS-1$
+ }
+}
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 8ebbdda3a6..4977e1da15 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
@@ -1,185 +1,185 @@
-/*
- * Copyright (c) 2004 - 2011 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.revision.delta;
-
-import org.eclipse.emf.cdo.common.id.CDOID;
-import org.eclipse.emf.cdo.common.protocol.CDODataInput;
-import org.eclipse.emf.cdo.common.protocol.CDODataOutput;
-import org.eclipse.emf.cdo.common.revision.CDORevisionUtil;
-import org.eclipse.emf.cdo.spi.common.revision.CDOReferenceAdjuster;
-import org.eclipse.emf.cdo.spi.common.revision.InternalCDOFeatureDelta.WithIndex;
-
-import org.eclipse.net4j.util.ObjectUtil;
-
-import org.eclipse.emf.common.notify.Notification;
-import org.eclipse.emf.ecore.EClass;
-import org.eclipse.emf.ecore.EReference;
-import org.eclipse.emf.ecore.EStructuralFeature;
-import org.eclipse.emf.ecore.util.FeatureMap;
-import org.eclipse.emf.ecore.util.FeatureMap.Entry;
-import org.eclipse.emf.ecore.util.FeatureMapUtil;
-
-import java.io.IOException;
-import java.text.MessageFormat;
-
-/**
- * @author Simon McDuff
- */
-public abstract class CDOSingleValueFeatureDeltaImpl extends CDOFeatureDeltaImpl implements WithIndex
-{
- private int index;
-
- private Object value;
-
- public CDOSingleValueFeatureDeltaImpl(EStructuralFeature feature, int index, Object value)
- {
- super(feature);
- this.index = index;
- this.value = value;
- }
-
- public CDOSingleValueFeatureDeltaImpl(CDODataInput in, EClass eClass) throws IOException
- {
- super(in, eClass);
- index = in.readInt();
- value = readValue(in, eClass);
- }
-
- @Override
- public void write(CDODataOutput out, EClass eClass) throws IOException
- {
- super.write(out, eClass);
- out.writeInt(index);
- writeValue(out, eClass);
- }
-
- protected void writeValue(CDODataOutput out, EClass eClass) throws IOException
- {
- Object valueToWrite = value;
- if (valueToWrite == UNKNOWN_VALUE)
- {
- throw new IOException("Value is unknown");
- }
-
- EStructuralFeature feature = getFeature();
- if (FeatureMapUtil.isFeatureMap(feature))
- {
- FeatureMap.Entry entry = (Entry)valueToWrite;
- feature = entry.getEStructuralFeature();
- valueToWrite = entry.getValue();
-
- int featureID = eClass.getFeatureID(feature);
- out.writeInt(featureID);
- }
-
- if (valueToWrite != null && feature instanceof EReference)
- {
- valueToWrite = out.getIDProvider().provideCDOID(value);
- }
-
- out.writeCDOFeatureValue(feature, valueToWrite);
- }
-
- protected Object readValue(CDODataInput in, EClass eClass) throws IOException
- {
- EStructuralFeature feature = getFeature();
- if (FeatureMapUtil.isFeatureMap(feature))
- {
- int featureID = in.readInt();
- feature = eClass.getEStructuralFeature(featureID);
- Object innerValue = in.readCDOFeatureValue(feature);
- return CDORevisionUtil.createFeatureMapEntry(feature, innerValue);
- }
-
- return in.readCDOFeatureValue(feature);
- }
-
- public int getIndex()
- {
- return index;
- }
-
- public void setIndex(int index)
- {
- this.index = index;
- }
-
- public Object getValue()
- {
- return value;
- }
-
- public void setValue(Object value)
- {
- this.value = value;
- }
-
- public void clear()
- {
- setValue(CDOID.NULL);
- }
-
- public void adjustAfterAddition(int index)
- {
- if (index <= this.index)
- {
- ++this.index;
- }
- }
-
- public void adjustAfterRemoval(int index)
- {
- if (index < this.index && this.index > 0)
- {
- --this.index;
- }
- }
-
- @Override
- public boolean adjustReferences(CDOReferenceAdjuster referenceAdjuster)
- {
- if (value != UNKNOWN_VALUE)
- {
- Object adjustedValue = referenceAdjuster.adjustReference(value, getFeature(), NO_INDEX);
- if (adjustedValue != value)
- {
- value = adjustedValue;
- return true;
- }
- }
-
- return false;
- }
-
- @Override
- public boolean isStructurallyEqual(Object obj)
- {
- if (!super.isStructurallyEqual(obj))
- {
- return false;
- }
-
- CDOSingleValueFeatureDeltaImpl that = (CDOSingleValueFeatureDeltaImpl)obj;
- return index == that.getIndex() && ObjectUtil.equals(value, that.getValue());
- }
-
- @Override
- protected String toStringAdditional()
- {
- if (index == Notification.NO_INDEX)
- {
- return MessageFormat.format("value={0}", value); //$NON-NLS-1$
- }
-
- return MessageFormat.format("value={0}, index={1}", value, index); //$NON-NLS-1$
- }
-}
+/*
+ * Copyright (c) 2004 - 2012 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.revision.delta;
+
+import org.eclipse.emf.cdo.common.id.CDOID;
+import org.eclipse.emf.cdo.common.protocol.CDODataInput;
+import org.eclipse.emf.cdo.common.protocol.CDODataOutput;
+import org.eclipse.emf.cdo.common.revision.CDORevisionUtil;
+import org.eclipse.emf.cdo.spi.common.revision.CDOReferenceAdjuster;
+import org.eclipse.emf.cdo.spi.common.revision.InternalCDOFeatureDelta.WithIndex;
+
+import org.eclipse.net4j.util.ObjectUtil;
+
+import org.eclipse.emf.common.notify.Notification;
+import org.eclipse.emf.ecore.EClass;
+import org.eclipse.emf.ecore.EReference;
+import org.eclipse.emf.ecore.EStructuralFeature;
+import org.eclipse.emf.ecore.util.FeatureMap;
+import org.eclipse.emf.ecore.util.FeatureMap.Entry;
+import org.eclipse.emf.ecore.util.FeatureMapUtil;
+
+import java.io.IOException;
+import java.text.MessageFormat;
+
+/**
+ * @author Simon McDuff
+ */
+public abstract class CDOSingleValueFeatureDeltaImpl extends CDOFeatureDeltaImpl implements WithIndex
+{
+ private int index;
+
+ private Object value;
+
+ public CDOSingleValueFeatureDeltaImpl(EStructuralFeature feature, int index, Object value)
+ {
+ super(feature);
+ this.index = index;
+ this.value = value;
+ }
+
+ public CDOSingleValueFeatureDeltaImpl(CDODataInput in, EClass eClass) throws IOException
+ {
+ super(in, eClass);
+ index = in.readInt();
+ value = readValue(in, eClass);
+ }
+
+ @Override
+ public void write(CDODataOutput out, EClass eClass) throws IOException
+ {
+ super.write(out, eClass);
+ out.writeInt(index);
+ writeValue(out, eClass);
+ }
+
+ protected void writeValue(CDODataOutput out, EClass eClass) throws IOException
+ {
+ Object valueToWrite = value;
+ if (valueToWrite == UNKNOWN_VALUE)
+ {
+ throw new IOException("Value is unknown");
+ }
+
+ EStructuralFeature feature = getFeature();
+ if (FeatureMapUtil.isFeatureMap(feature))
+ {
+ FeatureMap.Entry entry = (Entry)valueToWrite;
+ feature = entry.getEStructuralFeature();
+ valueToWrite = entry.getValue();
+
+ int featureID = eClass.getFeatureID(feature);
+ out.writeInt(featureID);
+ }
+
+ if (valueToWrite != null && feature instanceof EReference)
+ {
+ valueToWrite = out.getIDProvider().provideCDOID(value);
+ }
+
+ out.writeCDOFeatureValue(feature, valueToWrite);
+ }
+
+ protected Object readValue(CDODataInput in, EClass eClass) throws IOException
+ {
+ EStructuralFeature feature = getFeature();
+ if (FeatureMapUtil.isFeatureMap(feature))
+ {
+ int featureID = in.readInt();
+ feature = eClass.getEStructuralFeature(featureID);
+ Object innerValue = in.readCDOFeatureValue(feature);
+ return CDORevisionUtil.createFeatureMapEntry(feature, innerValue);
+ }
+
+ return in.readCDOFeatureValue(feature);
+ }
+
+ public int getIndex()
+ {
+ return index;
+ }
+
+ public void setIndex(int index)
+ {
+ this.index = index;
+ }
+
+ public Object getValue()
+ {
+ return value;
+ }
+
+ public void setValue(Object value)
+ {
+ this.value = value;
+ }
+
+ public void clear()
+ {
+ setValue(CDOID.NULL);
+ }
+
+ public void adjustAfterAddition(int index)
+ {
+ if (index <= this.index)
+ {
+ ++this.index;
+ }
+ }
+
+ public void adjustAfterRemoval(int index)
+ {
+ if (index < this.index && this.index > 0)
+ {
+ --this.index;
+ }
+ }
+
+ @Override
+ public boolean adjustReferences(CDOReferenceAdjuster referenceAdjuster)
+ {
+ if (value != UNKNOWN_VALUE)
+ {
+ Object adjustedValue = referenceAdjuster.adjustReference(value, getFeature(), NO_INDEX);
+ if (adjustedValue != value)
+ {
+ value = adjustedValue;
+ return true;
+ }
+ }
+
+ return false;
+ }
+
+ @Override
+ public boolean isStructurallyEqual(Object obj)
+ {
+ if (!super.isStructurallyEqual(obj))
+ {
+ return false;
+ }
+
+ CDOSingleValueFeatureDeltaImpl that = (CDOSingleValueFeatureDeltaImpl)obj;
+ return index == that.getIndex() && ObjectUtil.equals(value, that.getValue());
+ }
+
+ @Override
+ protected String toStringAdditional()
+ {
+ if (index == Notification.NO_INDEX)
+ {
+ return MessageFormat.format("value={0}", value); //$NON-NLS-1$
+ }
+
+ return MessageFormat.format("value={0}, index={1}", value, index); //$NON-NLS-1$
+ }
+}
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 2d917a2e63..5c52f2a197 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
@@ -1,73 +1,73 @@
-/*
- * Copyright (c) 2004 - 2011 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.revision.delta;
-
-import org.eclipse.emf.cdo.common.protocol.CDODataInput;
-import org.eclipse.emf.cdo.common.revision.CDORevision;
-import org.eclipse.emf.cdo.common.revision.delta.CDOFeatureDelta;
-import org.eclipse.emf.cdo.common.revision.delta.CDOFeatureDeltaVisitor;
-import org.eclipse.emf.cdo.common.revision.delta.CDOUnsetFeatureDelta;
-import org.eclipse.emf.cdo.spi.common.revision.CDOReferenceAdjuster;
-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;
-
-/**
- * @author Simon McDuff
- */
-public class CDOUnsetFeatureDeltaImpl extends CDOFeatureDeltaImpl implements CDOUnsetFeatureDelta
-{
- public CDOUnsetFeatureDeltaImpl(EStructuralFeature feature)
- {
- super(feature);
- }
-
- public CDOUnsetFeatureDeltaImpl(CDODataInput in, EClass eClass) throws IOException
- {
- super(in, eClass);
- }
-
- public Type getType()
- {
- return Type.UNSET;
- }
-
- public CDOFeatureDelta copy()
- {
- return new CDOUnsetFeatureDeltaImpl(getFeature());
- }
-
- public void apply(CDORevision revision)
- {
- ((InternalCDORevision)revision).unset(getFeature());
- }
-
- public void accept(CDOFeatureDeltaVisitor visitor)
- {
- visitor.visit(this);
- }
-
- @Override
- public boolean adjustReferences(CDOReferenceAdjuster adjuster)
- {
- return false;
- }
-
- @Override
- protected String toStringAdditional()
- {
- return null;
- }
-}
+/*
+ * Copyright (c) 2004 - 2012 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.revision.delta;
+
+import org.eclipse.emf.cdo.common.protocol.CDODataInput;
+import org.eclipse.emf.cdo.common.revision.CDORevision;
+import org.eclipse.emf.cdo.common.revision.delta.CDOFeatureDelta;
+import org.eclipse.emf.cdo.common.revision.delta.CDOFeatureDeltaVisitor;
+import org.eclipse.emf.cdo.common.revision.delta.CDOUnsetFeatureDelta;
+import org.eclipse.emf.cdo.spi.common.revision.CDOReferenceAdjuster;
+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;
+
+/**
+ * @author Simon McDuff
+ */
+public class CDOUnsetFeatureDeltaImpl extends CDOFeatureDeltaImpl implements CDOUnsetFeatureDelta
+{
+ public CDOUnsetFeatureDeltaImpl(EStructuralFeature feature)
+ {
+ super(feature);
+ }
+
+ public CDOUnsetFeatureDeltaImpl(CDODataInput in, EClass eClass) throws IOException
+ {
+ super(in, eClass);
+ }
+
+ public Type getType()
+ {
+ return Type.UNSET;
+ }
+
+ public CDOFeatureDelta copy()
+ {
+ return new CDOUnsetFeatureDeltaImpl(getFeature());
+ }
+
+ public void apply(CDORevision revision)
+ {
+ ((InternalCDORevision)revision).unset(getFeature());
+ }
+
+ public void accept(CDOFeatureDeltaVisitor visitor)
+ {
+ visitor.visit(this);
+ }
+
+ @Override
+ public boolean adjustReferences(CDOReferenceAdjuster adjuster)
+ {
+ return false;
+ }
+
+ @Override
+ protected String toStringAdditional()
+ {
+ return null;
+ }
+}
diff --git a/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/spi/common/AbstractQueryResult.java b/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/spi/common/AbstractQueryResult.java
index 2810eddc9e..0716feabf7 100644
--- a/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/spi/common/AbstractQueryResult.java
+++ b/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/spi/common/AbstractQueryResult.java
@@ -1,104 +1,104 @@
-/*
- * Copyright (c) 2004 - 2011 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.spi.common;
-
-import org.eclipse.emf.cdo.common.CDOCommonView;
-import org.eclipse.emf.cdo.common.util.BlockingCloseableIterator;
-import org.eclipse.emf.cdo.common.util.CDOQueryInfo;
-import org.eclipse.emf.cdo.common.util.CDOQueryQueue;
-
-/**
- * @author Simon McDuff
- * @since 2.0
- */
-public class AbstractQueryResult<T> implements BlockingCloseableIterator<T>
-{
- private int queryID;
-
- private CDOCommonView view;
-
- private CDOQueryInfo queryInfo;
-
- private CDOQueryQueue<Object> linkQueue = new CDOQueryQueue<Object>();
-
- private BlockingCloseableIterator<Object> queueItr = linkQueue.iterator();
-
- /**
- * @since 3.0
- */
- public AbstractQueryResult(CDOCommonView view, CDOQueryInfo queryInfo, int queryID)
- {
- this.queryID = queryID;
- this.view = view;
- this.queryInfo = queryInfo;
- }
-
- /**
- * @since 3.0
- */
- public CDOQueryInfo getQueryInfo()
- {
- return queryInfo;
- }
-
- public CDOQueryQueue<Object> getQueue()
- {
- return linkQueue;
- }
-
- public CDOCommonView getView()
- {
- return view;
- }
-
- public int getQueryID()
- {
- return queryID;
- }
-
- public void setQueryID(int queryID)
- {
- this.queryID = queryID;
- }
-
- @SuppressWarnings("unchecked")
- public T peek()
- {
- return (T)queueItr.peek();
- }
-
- public boolean hasNext()
- {
- return queueItr.hasNext();
- }
-
- @SuppressWarnings("unchecked")
- public T next()
- {
- return (T)queueItr.next();
- }
-
- public void remove()
- {
- throw new UnsupportedOperationException();
- }
-
- public void close()
- {
- queueItr.close();
- }
-
- public boolean isClosed()
- {
- return queueItr.isClosed();
- }
-}
+/*
+ * Copyright (c) 2004 - 2012 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.spi.common;
+
+import org.eclipse.emf.cdo.common.CDOCommonView;
+import org.eclipse.emf.cdo.common.util.BlockingCloseableIterator;
+import org.eclipse.emf.cdo.common.util.CDOQueryInfo;
+import org.eclipse.emf.cdo.common.util.CDOQueryQueue;
+
+/**
+ * @author Simon McDuff
+ * @since 2.0
+ */
+public class AbstractQueryResult<T> implements BlockingCloseableIterator<T>
+{
+ private int queryID;
+
+ private CDOCommonView view;
+
+ private CDOQueryInfo queryInfo;
+
+ private CDOQueryQueue<Object> linkQueue = new CDOQueryQueue<Object>();
+
+ private BlockingCloseableIterator<Object> queueItr = linkQueue.iterator();
+
+ /**
+ * @since 3.0
+ */
+ public AbstractQueryResult(CDOCommonView view, CDOQueryInfo queryInfo, int queryID)
+ {
+ this.queryID = queryID;
+ this.view = view;
+ this.queryInfo = queryInfo;
+ }
+
+ /**
+ * @since 3.0
+ */
+ public CDOQueryInfo getQueryInfo()
+ {
+ return queryInfo;
+ }
+
+ public CDOQueryQueue<Object> getQueue()
+ {
+ return linkQueue;
+ }
+
+ public CDOCommonView getView()
+ {
+ return view;
+ }
+
+ public int getQueryID()
+ {
+ return queryID;
+ }
+
+ public void setQueryID(int queryID)
+ {
+ this.queryID = queryID;
+ }
+
+ @SuppressWarnings("unchecked")
+ public T peek()
+ {
+ return (T)queueItr.peek();
+ }
+
+ public boolean hasNext()
+ {
+ return queueItr.hasNext();
+ }
+
+ @SuppressWarnings("unchecked")
+ public T next()
+ {
+ return (T)queueItr.next();
+ }
+
+ public void remove()
+ {
+ throw new UnsupportedOperationException();
+ }
+
+ public void close()
+ {
+ queueItr.close();
+ }
+
+ public boolean isClosed()
+ {
+ return queueItr.isClosed();
+ }
+}
diff --git a/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/spi/common/CDOAuthenticationResult.java b/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/spi/common/CDOAuthenticationResult.java
index bd0d39f6f7..4a513e7906 100644
--- a/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/spi/common/CDOAuthenticationResult.java
+++ b/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/spi/common/CDOAuthenticationResult.java
@@ -1,60 +1,60 @@
-/*
- * Copyright (c) 2004 - 2011 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;
-
-import org.eclipse.net4j.util.io.ExtendedDataInput;
-import org.eclipse.net4j.util.io.ExtendedDataOutput;
-
-import java.io.IOException;
-import java.io.Serializable;
-
-/**
- * The result of an authentication operation. Carries a userID and a crypted token.
- *
- * @author Eike Stepper
- * @since 4.0
- */
-public final class CDOAuthenticationResult implements Serializable
-{
- private static final long serialVersionUID = 1L;
-
- private String userID;
-
- private byte[] cryptedToken;
-
- public CDOAuthenticationResult(String userID, byte[] cryptedToken)
- {
- this.userID = userID;
- this.cryptedToken = cryptedToken;
- }
-
- public CDOAuthenticationResult(ExtendedDataInput in) throws IOException
- {
- userID = in.readString();
- cryptedToken = in.readByteArray();
- }
-
- public void write(ExtendedDataOutput out) throws IOException
- {
- out.writeString(userID);
- out.writeByteArray(cryptedToken);
- }
-
- public String getUserID()
- {
- return userID;
- }
-
- public byte[] getCryptedToken()
- {
- return cryptedToken;
- }
-}
+/*
+ * Copyright (c) 2004 - 2012 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;
+
+import org.eclipse.net4j.util.io.ExtendedDataInput;
+import org.eclipse.net4j.util.io.ExtendedDataOutput;
+
+import java.io.IOException;
+import java.io.Serializable;
+
+/**
+ * The result of an authentication operation. Carries a userID and a crypted token.
+ *
+ * @author Eike Stepper
+ * @since 4.0
+ */
+public final class CDOAuthenticationResult implements Serializable
+{
+ private static final long serialVersionUID = 1L;
+
+ private String userID;
+
+ private byte[] cryptedToken;
+
+ public CDOAuthenticationResult(String userID, byte[] cryptedToken)
+ {
+ this.userID = userID;
+ this.cryptedToken = cryptedToken;
+ }
+
+ public CDOAuthenticationResult(ExtendedDataInput in) throws IOException
+ {
+ userID = in.readString();
+ cryptedToken = in.readByteArray();
+ }
+
+ public void write(ExtendedDataOutput out) throws IOException
+ {
+ out.writeString(userID);
+ out.writeByteArray(cryptedToken);
+ }
+
+ public String getUserID()
+ {
+ return userID;
+ }
+
+ public byte[] getCryptedToken()
+ {
+ return cryptedToken;
+ }
+}
diff --git a/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/spi/common/CDOLobStoreImpl.java b/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/spi/common/CDOLobStoreImpl.java
index 124b481c01..0fffa37750 100644
--- a/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/spi/common/CDOLobStoreImpl.java
+++ b/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/spi/common/CDOLobStoreImpl.java
@@ -1,197 +1,197 @@
-/*
- * Copyright (c) 2004 - 2011 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;
-
-import org.eclipse.emf.cdo.common.lob.CDOLobInfo;
-import org.eclipse.emf.cdo.common.lob.CDOLobStore;
-
-import org.eclipse.net4j.util.HexUtil;
-import org.eclipse.net4j.util.WrappedException;
-import org.eclipse.net4j.util.io.DigestWriter;
-import org.eclipse.net4j.util.io.ExpectedFileInputStream;
-import org.eclipse.net4j.util.io.ExpectedFileReader;
-import org.eclipse.net4j.util.io.IORuntimeException;
-import org.eclipse.net4j.util.io.IOUtil;
-import org.eclipse.net4j.util.om.OMPlatform;
-
-import java.io.File;
-import java.io.FileOutputStream;
-import java.io.FileWriter;
-import java.io.IOException;
-import java.io.InputStream;
-import java.io.Reader;
-import java.security.DigestOutputStream;
-import java.security.MessageDigest;
-import java.security.NoSuchAlgorithmException;
-
-/**
- * @author Eike Stepper
- * @since 4.0
- */
-public class CDOLobStoreImpl implements CDOLobStore
-{
- public static final CDOLobStoreImpl INSTANCE = new CDOLobStoreImpl();
-
- private File folder;
-
- private int tempID;
-
- public CDOLobStoreImpl(File folder)
- {
- this.folder = folder;
- if (folder.exists())
- {
- checkDirectory();
- }
- }
-
- public CDOLobStoreImpl()
- {
- this(getDefaultFolder());
- }
-
- public File getFolder()
- {
- if (!folder.exists())
- {
- folder.mkdirs();
- }
-
- checkDirectory();
- return folder;
- }
-
- public File getBinaryFile(byte[] id)
- {
- return new File(getFolder(), HexUtil.bytesToHex(id) + ".blob");
- }
-
- public InputStream getBinary(CDOLobInfo info) throws IOException
- {
- File file = getBinaryFile(info.getID());
- long expectedSize = info.getSize();
- return new ExpectedFileInputStream(file, expectedSize);
- }
-
- public CDOLobInfo putBinary(InputStream contents) throws IOException
- {
- File tempFile = getTempFile();
- MessageDigest digest = createDigest();
- digest.update("BINARY".getBytes());
-
- FileOutputStream fos = null;
- long size;
-
- try
- {
- fos = new FileOutputStream(tempFile);
- DigestOutputStream dos = new DigestOutputStream(fos, digest);
- size = IOUtil.copyBinary(contents, dos);
- }
- finally
- {
- IOUtil.close(fos);
- }
-
- byte[] id = digest.digest();
- makePermanent(tempFile, getBinaryFile(id));
- return new CDOLobInfo(id, size);
- }
-
- public File getCharacterFile(byte[] id)
- {
- return new File(getFolder(), HexUtil.bytesToHex(id) + ".clob");
- }
-
- public Reader getCharacter(CDOLobInfo info) throws IOException
- {
- File file = getCharacterFile(info.getID());
- long expectedSize = info.getSize();
- return new ExpectedFileReader(file, expectedSize);
-
- }
-
- public CDOLobInfo putCharacter(Reader contents) throws IOException
- {
- File tempFile = getTempFile();
- MessageDigest digest = createDigest();
- digest.update("CHARACTER".getBytes());
-
- FileWriter fw = null;
- long size;
-
- try
- {
- fw = new FileWriter(tempFile);
- DigestWriter dw = new DigestWriter(fw, digest);
- size = IOUtil.copyCharacter(contents, dw);
- }
- finally
- {
- IOUtil.close(fw);
- }
-
- byte[] id = digest.digest();
- makePermanent(tempFile, getCharacterFile(id));
- return new CDOLobInfo(id, size);
- }
-
- protected MessageDigest createDigest()
- {
- try
- {
- return MessageDigest.getInstance("SHA-1");
- }
- catch (NoSuchAlgorithmException ex)
- {
- throw WrappedException.wrap(ex);
- }
- }
-
- protected synchronized File getTempFile()
- {
- for (;;)
- {
- ++tempID;
- File file = new File(getFolder(), "contents" + tempID + ".tmp");
- if (!file.exists())
- {
- return file;
- }
- }
- }
-
- private void makePermanent(File tempFile, File file)
- {
- if (file.exists())
- {
- tempFile.delete();
- }
- else
- {
- tempFile.renameTo(file);
- }
- }
-
- private void checkDirectory()
- {
- if (!folder.isDirectory())
- {
- throw new IORuntimeException("Not a folder: " + folder.getAbsolutePath());
- }
- }
-
- private static File getDefaultFolder()
- {
- String path = OMPlatform.INSTANCE.getProperty("java.io.tmpdir");
- return new File(new File(path), "cdo_lobs");
- }
-}
+/*
+ * Copyright (c) 2004 - 2012 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;
+
+import org.eclipse.emf.cdo.common.lob.CDOLobInfo;
+import org.eclipse.emf.cdo.common.lob.CDOLobStore;
+
+import org.eclipse.net4j.util.HexUtil;
+import org.eclipse.net4j.util.WrappedException;
+import org.eclipse.net4j.util.io.DigestWriter;
+import org.eclipse.net4j.util.io.ExpectedFileInputStream;
+import org.eclipse.net4j.util.io.ExpectedFileReader;
+import org.eclipse.net4j.util.io.IORuntimeException;
+import org.eclipse.net4j.util.io.IOUtil;
+import org.eclipse.net4j.util.om.OMPlatform;
+
+import java.io.File;
+import java.io.FileOutputStream;
+import java.io.FileWriter;
+import java.io.IOException;
+import java.io.InputStream;
+import java.io.Reader;
+import java.security.DigestOutputStream;
+import java.security.MessageDigest;
+import java.security.NoSuchAlgorithmException;
+
+/**
+ * @author Eike Stepper
+ * @since 4.0
+ */
+public class CDOLobStoreImpl implements CDOLobStore
+{
+ public static final CDOLobStoreImpl INSTANCE = new CDOLobStoreImpl();
+
+ private File folder;
+
+ private int tempID;
+
+ public CDOLobStoreImpl(File folder)
+ {
+ this.folder = folder;
+ if (folder.exists())
+ {
+ checkDirectory();
+ }
+ }
+
+ public CDOLobStoreImpl()
+ {
+ this(getDefaultFolder());
+ }
+
+ public File getFolder()
+ {
+ if (!folder.exists())
+ {
+ folder.mkdirs();
+ }
+
+ checkDirectory();
+ return folder;
+ }
+
+ public File getBinaryFile(byte[] id)
+ {
+ return new File(getFolder(), HexUtil.bytesToHex(id) + ".blob");
+ }
+
+ public InputStream getBinary(CDOLobInfo info) throws IOException
+ {
+ File file = getBinaryFile(info.getID());
+ long expectedSize = info.getSize();
+ return new ExpectedFileInputStream(file, expectedSize);
+ }
+
+ public CDOLobInfo putBinary(InputStream contents) throws IOException
+ {
+ File tempFile = getTempFile();
+ MessageDigest digest = createDigest();
+ digest.update("BINARY".getBytes());
+
+ FileOutputStream fos = null;
+ long size;
+
+ try
+ {
+ fos = new FileOutputStream(tempFile);
+ DigestOutputStream dos = new DigestOutputStream(fos, digest);
+ size = IOUtil.copyBinary(contents, dos);
+ }
+ finally
+ {
+ IOUtil.close(fos);
+ }
+
+ byte[] id = digest.digest();
+ makePermanent(tempFile, getBinaryFile(id));
+ return new CDOLobInfo(id, size);
+ }
+
+ public File getCharacterFile(byte[] id)
+ {
+ return new File(getFolder(), HexUtil.bytesToHex(id) + ".clob");
+ }
+
+ public Reader getCharacter(CDOLobInfo info) throws IOException
+ {
+ File file = getCharacterFile(info.getID());
+ long expectedSize = info.getSize();
+ return new ExpectedFileReader(file, expectedSize);
+
+ }
+
+ public CDOLobInfo putCharacter(Reader contents) throws IOException
+ {
+ File tempFile = getTempFile();
+ MessageDigest digest = createDigest();
+ digest.update("CHARACTER".getBytes());
+
+ FileWriter fw = null;
+ long size;
+
+ try
+ {
+ fw = new FileWriter(tempFile);
+ DigestWriter dw = new DigestWriter(fw, digest);
+ size = IOUtil.copyCharacter(contents, dw);
+ }
+ finally
+ {
+ IOUtil.close(fw);
+ }
+
+ byte[] id = digest.digest();
+ makePermanent(tempFile, getCharacterFile(id));
+ return new CDOLobInfo(id, size);
+ }
+
+ protected MessageDigest createDigest()
+ {
+ try
+ {
+ return MessageDigest.getInstance("SHA-1");
+ }
+ catch (NoSuchAlgorithmException ex)
+ {
+ throw WrappedException.wrap(ex);
+ }
+ }
+
+ protected synchronized File getTempFile()
+ {
+ for (;;)
+ {
+ ++tempID;
+ File file = new File(getFolder(), "contents" + tempID + ".tmp");
+ if (!file.exists())
+ {
+ return file;
+ }
+ }
+ }
+
+ private void makePermanent(File tempFile, File file)
+ {
+ if (file.exists())
+ {
+ tempFile.delete();
+ }
+ else
+ {
+ tempFile.renameTo(file);
+ }
+ }
+
+ private void checkDirectory()
+ {
+ if (!folder.isDirectory())
+ {
+ throw new IORuntimeException("Not a folder: " + folder.getAbsolutePath());
+ }
+ }
+
+ private static File getDefaultFolder()
+ {
+ String path = OMPlatform.INSTANCE.getProperty("java.io.tmpdir");
+ return new File(new File(path), "cdo_lobs");
+ }
+}
diff --git a/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/spi/common/CDORawReplicationContext.java b/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/spi/common/CDORawReplicationContext.java
index 4c5e06f95f..f5d5151253 100644
--- a/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/spi/common/CDORawReplicationContext.java
+++ b/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/spi/common/CDORawReplicationContext.java
@@ -1,29 +1,29 @@
-/*
- * Copyright (c) 2004 - 2011 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;
-
-import org.eclipse.emf.cdo.common.protocol.CDODataInput;
-
-import org.eclipse.net4j.util.om.monitor.OMMonitor;
-
-import java.io.IOException;
-
-/**
- * @author Eike Stepper
- * @since 3.0
- */
-public interface CDORawReplicationContext extends CDOReplicationInfo
-{
- /**
- * @since 4.0
- */
- public void replicateRaw(CDODataInput in, OMMonitor monitor) throws IOException;
-}
+/*
+ * Copyright (c) 2004 - 2012 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;
+
+import org.eclipse.emf.cdo.common.protocol.CDODataInput;
+
+import org.eclipse.net4j.util.om.monitor.OMMonitor;
+
+import java.io.IOException;
+
+/**
+ * @author Eike Stepper
+ * @since 3.0
+ */
+public interface CDORawReplicationContext extends CDOReplicationInfo
+{
+ /**
+ * @since 4.0
+ */
+ public void replicateRaw(CDODataInput in, OMMonitor monitor) throws IOException;
+}
diff --git a/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/spi/common/CDOReplicationContext.java b/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/spi/common/CDOReplicationContext.java
index e00ed845df..68f9b8550e 100644
--- a/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/spi/common/CDOReplicationContext.java
+++ b/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/spi/common/CDOReplicationContext.java
@@ -1,25 +1,25 @@
-/*
- * Copyright (c) 2004 - 2011 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;
-
-import org.eclipse.emf.cdo.common.branch.CDOBranchHandler;
-import org.eclipse.emf.cdo.common.commit.CDOCommitInfoHandler;
-import org.eclipse.emf.cdo.common.lock.IDurableLockingManager;
-
-/**
- * @author Eike Stepper
- * @noextend This interface is not intended to be extended by clients.
- * @noimplement This interface is not intended to be implemented by clients.
- */
-public interface CDOReplicationContext extends CDOReplicationInfo, CDOBranchHandler, CDOCommitInfoHandler,
- IDurableLockingManager.LockArea.Handler
-{
-}
+/*
+ * Copyright (c) 2004 - 2012 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;
+
+import org.eclipse.emf.cdo.common.branch.CDOBranchHandler;
+import org.eclipse.emf.cdo.common.commit.CDOCommitInfoHandler;
+import org.eclipse.emf.cdo.common.lock.IDurableLockingManager;
+
+/**
+ * @author Eike Stepper
+ * @noextend This interface is not intended to be extended by clients.
+ * @noimplement This interface is not intended to be implemented by clients.
+ */
+public interface CDOReplicationContext extends CDOReplicationInfo, CDOBranchHandler, CDOCommitInfoHandler,
+ IDurableLockingManager.LockArea.Handler
+{
+}
diff --git a/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/spi/common/CDOReplicationInfo.java b/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/spi/common/CDOReplicationInfo.java
index f1336ddcf8..d3126aeaa9 100644
--- a/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/spi/common/CDOReplicationInfo.java
+++ b/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/spi/common/CDOReplicationInfo.java
@@ -1,29 +1,29 @@
-/*
- * Copyright (c) 2004 - 2011 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
- * Caspar De Groot - maintenance
- */
-package org.eclipse.emf.cdo.spi.common;
-
-/**
- * @author Eike Stepper
- * @noextend This interface is not intended to be extended by clients.
- * @noimplement This interface is not intended to be implemented by clients.
- */
-public interface CDOReplicationInfo
-{
- public int getLastReplicatedBranchID();
-
- public long getLastReplicatedCommitTime();
-
- /**
- * @since 4.1
- */
- public String[] getLockAreaIDs();
-}
+/*
+ * Copyright (c) 2004 - 2012 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
+ * Caspar De Groot - maintenance
+ */
+package org.eclipse.emf.cdo.spi.common;
+
+/**
+ * @author Eike Stepper
+ * @noextend This interface is not intended to be extended by clients.
+ * @noimplement This interface is not intended to be implemented by clients.
+ */
+public interface CDOReplicationInfo
+{
+ public int getLastReplicatedBranchID();
+
+ public long getLastReplicatedCommitTime();
+
+ /**
+ * @since 4.1
+ */
+ public String[] getLockAreaIDs();
+}
diff --git a/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/spi/common/branch/CDOBranchUtil.java b/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/spi/common/branch/CDOBranchUtil.java
index ca7cd04d8b..dfc206b380 100644
--- a/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/spi/common/branch/CDOBranchUtil.java
+++ b/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/spi/common/branch/CDOBranchUtil.java
@@ -1,124 +1,124 @@
-/*
- * Copyright (c) 2004 - 2011 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.branch;
-
-import org.eclipse.emf.cdo.common.branch.CDOBranch;
-import org.eclipse.emf.cdo.common.branch.CDOBranchPoint;
-import org.eclipse.emf.cdo.common.branch.CDOBranchPointRange;
-import org.eclipse.emf.cdo.common.branch.CDOBranchVersion;
-import org.eclipse.emf.cdo.common.util.CDOCommonUtil;
-import org.eclipse.emf.cdo.internal.common.branch.CDOBranchManagerImpl;
-import org.eclipse.emf.cdo.internal.common.branch.CDOBranchPointRangeImpl;
-
-import org.eclipse.net4j.util.ObjectUtil;
-
-import java.util.ArrayList;
-import java.util.List;
-
-/**
- * @author Eike Stepper
- * @since 3.0
- */
-public final class CDOBranchUtil
-{
- private CDOBranchUtil()
- {
- }
-
- public static InternalCDOBranchManager createBranchManager()
- {
- return new CDOBranchManagerImpl();
- }
-
- public static CDOBranchPointRange createRange(CDOBranchPoint startPoint, CDOBranchPoint endPoint)
- {
- return new CDOBranchPointRangeImpl(startPoint, endPoint);
- }
-
- public static CDOBranchPoint copyBranchPoint(CDOBranchPoint source)
- {
- return source.getBranch().getPoint(source.getTimeStamp());
- }
-
- public static CDOBranchVersion copyBranchVersion(CDOBranchVersion source)
- {
- return source.getBranch().getVersion(source.getVersion());
- }
-
- public static boolean isContainedBy(CDOBranchPoint contained, CDOBranchPoint container)
- {
- CDOBranch containerBranch = container.getBranch();
- if (ObjectUtil.equals(containerBranch, contained.getBranch()))
- {
- return CDOCommonUtil.compareTimeStamps(contained.getTimeStamp(), container.getTimeStamp()) <= 0;
- }
-
- if (containerBranch == null)
- {
- return false;
- }
-
- return isContainedBy(contained, containerBranch.getBase());
- }
-
- public static CDOBranchPoint getAncestor(CDOBranchPoint point1, CDOBranchPoint point2)
- {
- if (point1.getBranch() == null)
- {
- // Must be the main branch base
- return point1;
- }
-
- if (point2.getBranch() == null)
- {
- // Must be the main branch base
- return point2;
- }
-
- CDOBranchPoint[] path1 = getPath(point1);
- CDOBranchPoint[] path2 = getPath(point2);
- for (CDOBranchPoint pathPoint1 : path1)
- {
- for (CDOBranchPoint pathPoint2 : path2)
- {
- if (ObjectUtil.equals(pathPoint1.getBranch(), pathPoint2.getBranch()))
- {
- if (CDOCommonUtil.compareTimeStamps(pathPoint1.getTimeStamp(), pathPoint2.getTimeStamp()) < 0)
- {
- return pathPoint1;
- }
-
- return pathPoint2;
- }
- }
- }
-
- // Can not happen because any two branches meet on the main branch
- return null;
- }
-
- public static CDOBranchPoint[] getPath(CDOBranchPoint point)
- {
- List<CDOBranchPoint> result = new ArrayList<CDOBranchPoint>();
- getPath(point, result);
- return result.toArray(new CDOBranchPoint[result.size()]);
- }
-
- private static void getPath(CDOBranchPoint point, List<CDOBranchPoint> result)
- {
- CDOBranch branch = point.getBranch();
- if (branch != null)
- {
- result.add(point);
- getPath(branch.getBase(), result);
- }
- }
-}
+/*
+ * Copyright (c) 2004 - 2012 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.branch;
+
+import org.eclipse.emf.cdo.common.branch.CDOBranch;
+import org.eclipse.emf.cdo.common.branch.CDOBranchPoint;
+import org.eclipse.emf.cdo.common.branch.CDOBranchPointRange;
+import org.eclipse.emf.cdo.common.branch.CDOBranchVersion;
+import org.eclipse.emf.cdo.common.util.CDOCommonUtil;
+import org.eclipse.emf.cdo.internal.common.branch.CDOBranchManagerImpl;
+import org.eclipse.emf.cdo.internal.common.branch.CDOBranchPointRangeImpl;
+
+import org.eclipse.net4j.util.ObjectUtil;
+
+import java.util.ArrayList;
+import java.util.List;
+
+/**
+ * @author Eike Stepper
+ * @since 3.0
+ */
+public final class CDOBranchUtil
+{
+ private CDOBranchUtil()
+ {
+ }
+
+ public static InternalCDOBranchManager createBranchManager()
+ {
+ return new CDOBranchManagerImpl();
+ }
+
+ public static CDOBranchPointRange createRange(CDOBranchPoint startPoint, CDOBranchPoint endPoint)
+ {
+ return new CDOBranchPointRangeImpl(startPoint, endPoint);
+ }
+
+ public static CDOBranchPoint copyBranchPoint(CDOBranchPoint source)
+ {
+ return source.getBranch().getPoint(source.getTimeStamp());
+ }
+
+ public static CDOBranchVersion copyBranchVersion(CDOBranchVersion source)
+ {
+ return source.getBranch().getVersion(source.getVersion());
+ }
+
+ public static boolean isContainedBy(CDOBranchPoint contained, CDOBranchPoint container)
+ {
+ CDOBranch containerBranch = container.getBranch();
+ if (ObjectUtil.equals(containerBranch, contained.getBranch()))
+ {
+ return CDOCommonUtil.compareTimeStamps(contained.getTimeStamp(), container.getTimeStamp()) <= 0;
+ }
+
+ if (containerBranch == null)
+ {
+ return false;
+ }
+
+ return isContainedBy(contained, containerBranch.getBase());
+ }
+
+ public static CDOBranchPoint getAncestor(CDOBranchPoint point1, CDOBranchPoint point2)
+ {
+ if (point1.getBranch() == null)
+ {
+ // Must be the main branch base
+ return point1;
+ }
+
+ if (point2.getBranch() == null)
+ {
+ // Must be the main branch base
+ return point2;
+ }
+
+ CDOBranchPoint[] path1 = getPath(point1);
+ CDOBranchPoint[] path2 = getPath(point2);
+ for (CDOBranchPoint pathPoint1 : path1)
+ {
+ for (CDOBranchPoint pathPoint2 : path2)
+ {
+ if (ObjectUtil.equals(pathPoint1.getBranch(), pathPoint2.getBranch()))
+ {
+ if (CDOCommonUtil.compareTimeStamps(pathPoint1.getTimeStamp(), pathPoint2.getTimeStamp()) < 0)
+ {
+ return pathPoint1;
+ }
+
+ return pathPoint2;
+ }
+ }
+ }
+
+ // Can not happen because any two branches meet on the main branch
+ return null;
+ }
+
+ public static CDOBranchPoint[] getPath(CDOBranchPoint point)
+ {
+ List<CDOBranchPoint> result = new ArrayList<CDOBranchPoint>();
+ getPath(point, result);
+ return result.toArray(new CDOBranchPoint[result.size()]);
+ }
+
+ private static void getPath(CDOBranchPoint point, List<CDOBranchPoint> result)
+ {
+ CDOBranch branch = point.getBranch();
+ if (branch != null)
+ {
+ result.add(point);
+ getPath(branch.getBase(), result);
+ }
+ }
+}
diff --git a/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/spi/common/branch/InternalCDOBranch.java b/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/spi/common/branch/InternalCDOBranch.java
index c641575c2a..522addc62c 100644
--- a/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/spi/common/branch/InternalCDOBranch.java
+++ b/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/spi/common/branch/InternalCDOBranch.java
@@ -1,46 +1,46 @@
-/*
- * Copyright (c) 2004 - 2011 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.branch;
-
-import org.eclipse.emf.cdo.common.branch.CDOBranch;
-import org.eclipse.emf.cdo.spi.common.branch.InternalCDOBranchManager.BranchLoader.BranchInfo;
-
-/**
- * @author Eike Stepper
- * @since 3.0
- * @noextend This interface is not intended to be extended by clients.
- * @noimplement This interface is not intended to be implemented by clients.
- */
-public interface InternalCDOBranch extends CDOBranch
-{
- public boolean isProxy();
-
- public InternalCDOBranchManager getBranchManager();
-
- public InternalCDOBranch[] getBranches();
-
- /**
- * @since 4.0
- */
- public InternalCDOBranch[] getBranches(boolean loadOnDemand);
-
- public InternalCDOBranch getBranch(String path);
-
- public InternalCDOBranch createBranch(String name, long timeStamp);
-
- public InternalCDOBranch createBranch(String name);
-
- public BranchInfo getBranchInfo();
-
- public void setBranchInfo(String name, InternalCDOBranch baseBranch, long baseTimeStamp);
-
- public void addChild(InternalCDOBranch branch);
-}
+/*
+ * Copyright (c) 2004 - 2012 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.branch;
+
+import org.eclipse.emf.cdo.common.branch.CDOBranch;
+import org.eclipse.emf.cdo.spi.common.branch.InternalCDOBranchManager.BranchLoader.BranchInfo;
+
+/**
+ * @author Eike Stepper
+ * @since 3.0
+ * @noextend This interface is not intended to be extended by clients.
+ * @noimplement This interface is not intended to be implemented by clients.
+ */
+public interface InternalCDOBranch extends CDOBranch
+{
+ public boolean isProxy();
+
+ public InternalCDOBranchManager getBranchManager();
+
+ public InternalCDOBranch[] getBranches();
+
+ /**
+ * @since 4.0
+ */
+ public InternalCDOBranch[] getBranches(boolean loadOnDemand);
+
+ public InternalCDOBranch getBranch(String path);
+
+ public InternalCDOBranch createBranch(String name, long timeStamp);
+
+ public InternalCDOBranch createBranch(String name);
+
+ public BranchInfo getBranchInfo();
+
+ public void setBranchInfo(String name, InternalCDOBranch baseBranch, long baseTimeStamp);
+
+ public void addChild(InternalCDOBranch branch);
+}
diff --git a/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/spi/common/branch/InternalCDOBranchManager.java b/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/spi/common/branch/InternalCDOBranchManager.java
index 80878b2ba7..04242a6648 100644
--- a/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/spi/common/branch/InternalCDOBranchManager.java
+++ b/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/spi/common/branch/InternalCDOBranchManager.java
@@ -1,190 +1,190 @@
-/*
- * Copyright (c) 2004 - 2011 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.branch;
-
-import org.eclipse.emf.cdo.common.branch.CDOBranchHandler;
-import org.eclipse.emf.cdo.common.branch.CDOBranchManager;
-import org.eclipse.emf.cdo.common.protocol.CDODataInput;
-import org.eclipse.emf.cdo.common.protocol.CDODataOutput;
-import org.eclipse.emf.cdo.common.util.CDOTimeProvider;
-import org.eclipse.emf.cdo.spi.common.branch.InternalCDOBranchManager.BranchLoader.BranchInfo;
-
-import org.eclipse.net4j.util.collection.Pair;
-import org.eclipse.net4j.util.lifecycle.ILifecycle;
-
-import java.io.IOException;
-
-/**
- * @author Eike Stepper
- * @since 3.0
- * @noextend This interface is not intended to be extended by clients.
- * @noimplement This interface is not intended to be implemented by clients.
- */
-public interface InternalCDOBranchManager extends CDOBranchManager, ILifecycle
-{
- public BranchLoader getBranchLoader();
-
- public void setBranchLoader(BranchLoader branchLoader);
-
- public CDOTimeProvider getTimeProvider();
-
- public void setTimeProvider(CDOTimeProvider timeProvider);
-
- /**
- * @since 4.0
- */
- public void initMainBranch(boolean local, long timestamp);
-
- public InternalCDOBranch getMainBranch();
-
- public InternalCDOBranch getBranch(int branchID);
-
- public InternalCDOBranch getBranch(int id, String name, InternalCDOBranch baseBranch, long baseTimeStamp);
-
- public InternalCDOBranch getBranch(int id, BranchInfo branchInfo);
-
- public InternalCDOBranch getBranch(String path);
-
- public InternalCDOBranch createBranch(int id, String name, InternalCDOBranch baseBranch, long baseTimeStamp);
-
- public void handleBranchCreated(InternalCDOBranch branch);
-
- /**
- * @author Eike Stepper
- * @since 3.0
- */
- public interface BranchLoader
- {
- /**
- * Passed as the branchID in {@link #createBranch(int, BranchInfo)} causes a new non-local branch to be created.
- */
- public static final int NEW_BRANCH = Integer.MAX_VALUE;
-
- /**
- * Passed as the branchID in {@link #createBranch(int, BranchInfo)} causes a new local branch to be created.
- */
- public static final int NEW_LOCAL_BRANCH = Integer.MIN_VALUE;
-
- /**
- * Creates a new branch with the given id and branch info. If the id is equal to {@link #NEW_BRANCH} the implementor
- * of this method will determine a new positive unique branch id. If the id is equal to {@link #NEW_LOCAL_BRANCH}
- * the implementor of this method will determine a new negative unique branch id, so that the new branch becomes a
- * local branch. In either case the used branch id is returned to the caller.
- *
- * @since 4.0
- */
- public Pair<Integer, Long> createBranch(int branchID, BranchInfo branchInfo);
-
- public BranchInfo loadBranch(int branchID);
-
- public SubBranchInfo[] loadSubBranches(int branchID);
-
- public int loadBranches(int startID, int endID, CDOBranchHandler branchHandler);
-
- /**
- * @author Eike Stepper
- * @since 3.0
- */
- public static final class BranchInfo
- {
- private String name;
-
- private int baseBranchID;
-
- private long baseTimeStamp;
-
- public BranchInfo(String name, int baseBranchID, long baseTimeStamp)
- {
- this.name = name;
- this.baseBranchID = baseBranchID;
- this.baseTimeStamp = baseTimeStamp;
- }
-
- public BranchInfo(CDODataInput in) throws IOException
- {
- name = in.readString();
- baseBranchID = in.readInt();
- baseTimeStamp = in.readLong();
- }
-
- public void write(CDODataOutput out) throws IOException
- {
- out.writeString(name);
- out.writeInt(baseBranchID);
- out.writeLong(baseTimeStamp);
- }
-
- public String getName()
- {
- return name;
- }
-
- public int getBaseBranchID()
- {
- return baseBranchID;
- }
-
- public long getBaseTimeStamp()
- {
- return baseTimeStamp;
- }
- }
-
- /**
- * @author Eike Stepper
- * @since 3.0
- */
- public static final class SubBranchInfo
- {
- private int id;
-
- private String name;
-
- private long baseTimeStamp;
-
- public SubBranchInfo(int id, String name, long baseTimeStamp)
- {
- this.id = id;
- this.name = name;
- this.baseTimeStamp = baseTimeStamp;
- }
-
- public SubBranchInfo(CDODataInput in) throws IOException
- {
- id = in.readInt();
- name = in.readString();
- baseTimeStamp = in.readLong();
- }
-
- public void write(CDODataOutput out) throws IOException
- {
- out.writeInt(id);
- out.writeString(name);
- out.writeLong(baseTimeStamp);
- }
-
- public int getID()
- {
- return id;
- }
-
- public String getName()
- {
- return name;
- }
-
- public long getBaseTimeStamp()
- {
- return baseTimeStamp;
- }
- }
- }
-}
+/*
+ * Copyright (c) 2004 - 2012 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.branch;
+
+import org.eclipse.emf.cdo.common.branch.CDOBranchHandler;
+import org.eclipse.emf.cdo.common.branch.CDOBranchManager;
+import org.eclipse.emf.cdo.common.protocol.CDODataInput;
+import org.eclipse.emf.cdo.common.protocol.CDODataOutput;
+import org.eclipse.emf.cdo.common.util.CDOTimeProvider;
+import org.eclipse.emf.cdo.spi.common.branch.InternalCDOBranchManager.BranchLoader.BranchInfo;
+
+import org.eclipse.net4j.util.collection.Pair;
+import org.eclipse.net4j.util.lifecycle.ILifecycle;
+
+import java.io.IOException;
+
+/**
+ * @author Eike Stepper
+ * @since 3.0
+ * @noextend This interface is not intended to be extended by clients.
+ * @noimplement This interface is not intended to be implemented by clients.
+ */
+public interface InternalCDOBranchManager extends CDOBranchManager, ILifecycle
+{
+ public BranchLoader getBranchLoader();
+
+ public void setBranchLoader(BranchLoader branchLoader);
+
+ public CDOTimeProvider getTimeProvider();
+
+ public void setTimeProvider(CDOTimeProvider timeProvider);
+
+ /**
+ * @since 4.0
+ */
+ public void initMainBranch(boolean local, long timestamp);
+
+ public InternalCDOBranch getMainBranch();
+
+ public InternalCDOBranch getBranch(int branchID);
+
+ public InternalCDOBranch getBranch(int id, String name, InternalCDOBranch baseBranch, long baseTimeStamp);
+
+ public InternalCDOBranch getBranch(int id, BranchInfo branchInfo);
+
+ public InternalCDOBranch getBranch(String path);
+
+ public InternalCDOBranch createBranch(int id, String name, InternalCDOBranch baseBranch, long baseTimeStamp);
+
+ public void handleBranchCreated(InternalCDOBranch branch);
+
+ /**
+ * @author Eike Stepper
+ * @since 3.0
+ */
+ public interface BranchLoader
+ {
+ /**
+ * Passed as the branchID in {@link #createBranch(int, BranchInfo)} causes a new non-local branch to be created.
+ */
+ public static final int NEW_BRANCH = Integer.MAX_VALUE;
+
+ /**
+ * Passed as the branchID in {@link #createBranch(int, BranchInfo)} causes a new local branch to be created.
+ */
+ public static final int NEW_LOCAL_BRANCH = Integer.MIN_VALUE;
+
+ /**
+ * Creates a new branch with the given id and branch info. If the id is equal to {@link #NEW_BRANCH} the implementor
+ * of this method will determine a new positive unique branch id. If the id is equal to {@link #NEW_LOCAL_BRANCH}
+ * the implementor of this method will determine a new negative unique branch id, so that the new branch becomes a
+ * local branch. In either case the used branch id is returned to the caller.
+ *
+ * @since 4.0
+ */
+ public Pair<Integer, Long> createBranch(int branchID, BranchInfo branchInfo);
+
+ public BranchInfo loadBranch(int branchID);
+
+ public SubBranchInfo[] loadSubBranches(int branchID);
+
+ public int loadBranches(int startID, int endID, CDOBranchHandler branchHandler);
+
+ /**
+ * @author Eike Stepper
+ * @since 3.0
+ */
+ public static final class BranchInfo
+ {
+ private String name;
+
+ private int baseBranchID;
+
+ private long baseTimeStamp;
+
+ public BranchInfo(String name, int baseBranchID, long baseTimeStamp)
+ {
+ this.name = name;
+ this.baseBranchID = baseBranchID;
+ this.baseTimeStamp = baseTimeStamp;
+ }
+
+ public BranchInfo(CDODataInput in) throws IOException
+ {
+ name = in.readString();
+ baseBranchID = in.readInt();
+ baseTimeStamp = in.readLong();
+ }
+
+ public void write(CDODataOutput out) throws IOException
+ {
+ out.writeString(name);
+ out.writeInt(baseBranchID);
+ out.writeLong(baseTimeStamp);
+ }
+
+ public String getName()
+ {
+ return name;
+ }
+
+ public int getBaseBranchID()
+ {
+ return baseBranchID;
+ }
+
+ public long getBaseTimeStamp()
+ {
+ return baseTimeStamp;
+ }
+ }
+
+ /**
+ * @author Eike Stepper
+ * @since 3.0
+ */
+ public static final class SubBranchInfo
+ {
+ private int id;
+
+ private String name;
+
+ private long baseTimeStamp;
+
+ public SubBranchInfo(int id, String name, long baseTimeStamp)
+ {
+ this.id = id;
+ this.name = name;
+ this.baseTimeStamp = baseTimeStamp;
+ }
+
+ public SubBranchInfo(CDODataInput in) throws IOException
+ {
+ id = in.readInt();
+ name = in.readString();
+ baseTimeStamp = in.readLong();
+ }
+
+ public void write(CDODataOutput out) throws IOException
+ {
+ out.writeInt(id);
+ out.writeString(name);
+ out.writeLong(baseTimeStamp);
+ }
+
+ public int getID()
+ {
+ return id;
+ }
+
+ public String getName()
+ {
+ return name;
+ }
+
+ public long getBaseTimeStamp()
+ {
+ return baseTimeStamp;
+ }
+ }
+ }
+}
diff --git a/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/spi/common/branch/package-info.java b/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/spi/common/branch/package-info.java
index 8c8de65d9a..471bebd78c 100644
--- a/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/spi/common/branch/package-info.java
+++ b/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/spi/common/branch/package-info.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2004 - 2011 Eike Stepper (Berlin, Germany) and others.
+ * Copyright (c) 2004 - 2012 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
diff --git a/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/spi/common/commit/CDOChangeKindCache.java b/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/spi/common/commit/CDOChangeKindCache.java
index d77216fbd1..52d49f3c05 100644
--- a/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/spi/common/commit/CDOChangeKindCache.java
+++ b/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/spi/common/commit/CDOChangeKindCache.java
@@ -1,65 +1,65 @@
-/*
- * Copyright (c) 2004 - 2011 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.commit;
-
-import org.eclipse.emf.cdo.common.commit.CDOChangeKind;
-import org.eclipse.emf.cdo.common.commit.CDOChangeKindProvider;
-import org.eclipse.emf.cdo.common.commit.CDOChangeSetData;
-import org.eclipse.emf.cdo.common.id.CDOID;
-import org.eclipse.emf.cdo.common.revision.CDOIDAndVersion;
-import org.eclipse.emf.cdo.common.revision.CDORevisionKey;
-
-import java.util.HashMap;
-import java.util.List;
-
-/**
- * @author Eike Stepper
- * @since 4.0
- */
-public class CDOChangeKindCache extends HashMap<CDOID, CDOChangeKind> implements CDOChangeKindProvider
-{
- private static final long serialVersionUID = 1L;
-
- public CDOChangeKindCache(CDOChangeSetData changeSetData)
- {
- List<CDOIDAndVersion> newObjects = changeSetData.getNewObjects();
- if (newObjects != null)
- {
- for (CDOIDAndVersion key : newObjects)
- {
- put(key.getID(), CDOChangeKind.NEW);
- }
- }
-
- List<CDORevisionKey> changedObjects = changeSetData.getChangedObjects();
- if (changedObjects != null)
- {
- for (CDOIDAndVersion key : changedObjects)
- {
- put(key.getID(), CDOChangeKind.CHANGED);
- }
- }
-
- List<CDOIDAndVersion> detachedObjects = changeSetData.getDetachedObjects();
- if (detachedObjects != null)
- {
- for (CDOIDAndVersion key : detachedObjects)
- {
- put(key.getID(), CDOChangeKind.DETACHED);
- }
- }
- }
-
- public CDOChangeKind getChangeKind(CDOID id)
- {
- return get(id);
- }
-}
+/*
+ * Copyright (c) 2004 - 2012 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.commit;
+
+import org.eclipse.emf.cdo.common.commit.CDOChangeKind;
+import org.eclipse.emf.cdo.common.commit.CDOChangeKindProvider;
+import org.eclipse.emf.cdo.common.commit.CDOChangeSetData;
+import org.eclipse.emf.cdo.common.id.CDOID;
+import org.eclipse.emf.cdo.common.revision.CDOIDAndVersion;
+import org.eclipse.emf.cdo.common.revision.CDORevisionKey;
+
+import java.util.HashMap;
+import java.util.List;
+
+/**
+ * @author Eike Stepper
+ * @since 4.0
+ */
+public class CDOChangeKindCache extends HashMap<CDOID, CDOChangeKind> implements CDOChangeKindProvider
+{
+ private static final long serialVersionUID = 1L;
+
+ public CDOChangeKindCache(CDOChangeSetData changeSetData)
+ {
+ List<CDOIDAndVersion> newObjects = changeSetData.getNewObjects();
+ if (newObjects != null)
+ {
+ for (CDOIDAndVersion key : newObjects)
+ {
+ put(key.getID(), CDOChangeKind.NEW);
+ }
+ }
+
+ List<CDORevisionKey> changedObjects = changeSetData.getChangedObjects();
+ if (changedObjects != null)
+ {
+ for (CDOIDAndVersion key : changedObjects)
+ {
+ put(key.getID(), CDOChangeKind.CHANGED);
+ }
+ }
+
+ List<CDOIDAndVersion> detachedObjects = changeSetData.getDetachedObjects();
+ if (detachedObjects != null)
+ {
+ for (CDOIDAndVersion key : detachedObjects)
+ {
+ put(key.getID(), CDOChangeKind.DETACHED);
+ }
+ }
+ }
+
+ public CDOChangeKind getChangeKind(CDOID id)
+ {
+ return get(id);
+ }
+}
diff --git a/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/spi/common/commit/CDOChangeSetDataRevisionProvider.java b/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/spi/common/commit/CDOChangeSetDataRevisionProvider.java
index e079eb8ee3..6c20d5d2f5 100644
--- a/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/spi/common/commit/CDOChangeSetDataRevisionProvider.java
+++ b/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/spi/common/commit/CDOChangeSetDataRevisionProvider.java
@@ -1,160 +1,160 @@
-/*
- * Copyright (c) 2004 - 2011 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.commit;
-
-import org.eclipse.emf.cdo.common.commit.CDOChangeSetData;
-import org.eclipse.emf.cdo.common.commit.CDOChangeSetDataProvider;
-import org.eclipse.emf.cdo.common.id.CDOID;
-import org.eclipse.emf.cdo.common.revision.CDOIDAndVersion;
-import org.eclipse.emf.cdo.common.revision.CDORevision;
-import org.eclipse.emf.cdo.common.revision.CDORevisionKey;
-import org.eclipse.emf.cdo.common.revision.CDORevisionProvider;
-import org.eclipse.emf.cdo.common.revision.delta.CDORevisionDelta;
-import org.eclipse.emf.cdo.common.revision.delta.CDORevisionDeltaProvider;
-
-import java.util.HashMap;
-import java.util.Map;
-
-/**
- * @author Eike Stepper
- * @since 4.0
- */
-public class CDOChangeSetDataRevisionProvider implements CDORevisionProvider, CDOChangeSetDataProvider
-{
- private static final CDOIDAndVersion DETACHED = new CDOIDAndVersion()
- {
- public CDOID getID()
- {
- return CDOID.NULL;
- }
-
- public int getVersion()
- {
- return Integer.MIN_VALUE;
- }
-
- @Override
- public String toString()
- {
- return "DETACHED";
- }
- };
-
- private CDORevisionProvider delegate;
-
- private CDOChangeSetData changeSetData;
-
- private CDORevisionProvider revisionCallback;
-
- private CDORevisionDeltaProvider revisionDeltaCallback;
-
- private Map<CDOID, CDOIDAndVersion> cachedRevisions;
-
- public CDOChangeSetDataRevisionProvider(CDORevisionProvider delegate, CDOChangeSetData changeSetData,
- CDORevisionProvider revisionCallback, CDORevisionDeltaProvider revisionDeltaCallback)
- {
- this.delegate = delegate;
- this.changeSetData = changeSetData;
- this.revisionCallback = revisionCallback;
- this.revisionDeltaCallback = revisionDeltaCallback;
- }
-
- public CDOChangeSetDataRevisionProvider(CDORevisionProvider delegate, CDOChangeSetData changeSetData)
- {
- this(delegate, changeSetData, null, null);
- }
-
- public CDOChangeSetData getChangeSetData()
- {
- return changeSetData;
- }
-
- public synchronized CDORevision getRevision(CDOID id)
- {
- if (cachedRevisions == null)
- {
- cachedRevisions = cacheRevisions();
- }
-
- CDOIDAndVersion key = cachedRevisions.get(id);
- if (key == DETACHED)
- {
- return null;
- }
-
- if (key instanceof CDORevision) // New object (eager)
- {
- return (CDORevision)key;
- }
-
- if (key instanceof CDORevisionDelta) // Changed object (eager)
- {
- CDORevisionDelta revisionDelta = (CDORevisionDelta)key;
- return applyDelta(revisionDelta);
- }
-
- if (key instanceof CDORevisionKey) // Changed object (lazy)
- {
- CDORevisionDelta revisionDelta = revisionDeltaCallback.getRevisionDelta(id);
- return applyDelta(revisionDelta);
- }
-
- if (key != null) // New object (lazy)
- {
- CDORevision revision = revisionCallback.getRevision(id);
- cachedRevisions.put(id, revision);
- return revision;
- }
-
- return delegate.getRevision(id);
- }
-
- private Map<CDOID, CDOIDAndVersion> cacheRevisions()
- {
- Map<CDOID, CDOIDAndVersion> cache = new HashMap<CDOID, CDOIDAndVersion>();
-
- for (CDOIDAndVersion key : changeSetData.getNewObjects())
- {
- if (revisionCallback == null && !(key instanceof CDORevision))
- {
- throw new IllegalStateException("No callback installed to lazily obtain revision " + key);
- }
-
- cache.put(key.getID(), key);
- }
-
- for (CDORevisionKey key : changeSetData.getChangedObjects())
- {
- if (revisionDeltaCallback == null && !(key instanceof CDORevisionDelta))
- {
- throw new IllegalStateException("No callback installed to lazily obtain revision delta " + key);
- }
-
- cache.put(key.getID(), key);
- }
-
- for (CDOIDAndVersion key : changeSetData.getDetachedObjects())
- {
- cache.put(key.getID(), DETACHED);
- }
-
- return cache;
- }
-
- private CDORevision applyDelta(CDORevisionDelta revisionDelta)
- {
- CDOID id = revisionDelta.getID();
- CDORevision changedObject = delegate.getRevision(id).copy();
- revisionDelta.apply(changedObject);
- cachedRevisions.put(id, changedObject);
- return changedObject;
- }
-}
+/*
+ * Copyright (c) 2004 - 2012 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.commit;
+
+import org.eclipse.emf.cdo.common.commit.CDOChangeSetData;
+import org.eclipse.emf.cdo.common.commit.CDOChangeSetDataProvider;
+import org.eclipse.emf.cdo.common.id.CDOID;
+import org.eclipse.emf.cdo.common.revision.CDOIDAndVersion;
+import org.eclipse.emf.cdo.common.revision.CDORevision;
+import org.eclipse.emf.cdo.common.revision.CDORevisionKey;
+import org.eclipse.emf.cdo.common.revision.CDORevisionProvider;
+import org.eclipse.emf.cdo.common.revision.delta.CDORevisionDelta;
+import org.eclipse.emf.cdo.common.revision.delta.CDORevisionDeltaProvider;
+
+import java.util.HashMap;
+import java.util.Map;
+
+/**
+ * @author Eike Stepper
+ * @since 4.0
+ */
+public class CDOChangeSetDataRevisionProvider implements CDORevisionProvider, CDOChangeSetDataProvider
+{
+ private static final CDOIDAndVersion DETACHED = new CDOIDAndVersion()
+ {
+ public CDOID getID()
+ {
+ return CDOID.NULL;
+ }
+
+ public int getVersion()
+ {
+ return Integer.MIN_VALUE;
+ }
+
+ @Override
+ public String toString()
+ {
+ return "DETACHED";
+ }
+ };
+
+ private CDORevisionProvider delegate;
+
+ private CDOChangeSetData changeSetData;
+
+ private CDORevisionProvider revisionCallback;
+
+ private CDORevisionDeltaProvider revisionDeltaCallback;
+
+ private Map<CDOID, CDOIDAndVersion> cachedRevisions;
+
+ public CDOChangeSetDataRevisionProvider(CDORevisionProvider delegate, CDOChangeSetData changeSetData,
+ CDORevisionProvider revisionCallback, CDORevisionDeltaProvider revisionDeltaCallback)
+ {
+ this.delegate = delegate;
+ this.changeSetData = changeSetData;
+ this.revisionCallback = revisionCallback;
+ this.revisionDeltaCallback = revisionDeltaCallback;
+ }
+
+ public CDOChangeSetDataRevisionProvider(CDORevisionProvider delegate, CDOChangeSetData changeSetData)
+ {
+ this(delegate, changeSetData, null, null);
+ }
+
+ public CDOChangeSetData getChangeSetData()
+ {
+ return changeSetData;
+ }
+
+ public synchronized CDORevision getRevision(CDOID id)
+ {
+ if (cachedRevisions == null)
+ {
+ cachedRevisions = cacheRevisions();
+ }
+
+ CDOIDAndVersion key = cachedRevisions.get(id);
+ if (key == DETACHED)
+ {
+ return null;
+ }
+
+ if (key instanceof CDORevision) // New object (eager)
+ {
+ return (CDORevision)key;
+ }
+
+ if (key instanceof CDORevisionDelta) // Changed object (eager)
+ {
+ CDORevisionDelta revisionDelta = (CDORevisionDelta)key;
+ return applyDelta(revisionDelta);
+ }
+
+ if (key instanceof CDORevisionKey) // Changed object (lazy)
+ {
+ CDORevisionDelta revisionDelta = revisionDeltaCallback.getRevisionDelta(id);
+ return applyDelta(revisionDelta);
+ }
+
+ if (key != null) // New object (lazy)
+ {
+ CDORevision revision = revisionCallback.getRevision(id);
+ cachedRevisions.put(id, revision);
+ return revision;
+ }
+
+ return delegate.getRevision(id);
+ }
+
+ private Map<CDOID, CDOIDAndVersion> cacheRevisions()
+ {
+ Map<CDOID, CDOIDAndVersion> cache = new HashMap<CDOID, CDOIDAndVersion>();
+
+ for (CDOIDAndVersion key : changeSetData.getNewObjects())
+ {
+ if (revisionCallback == null && !(key instanceof CDORevision))
+ {
+ throw new IllegalStateException("No callback installed to lazily obtain revision " + key);
+ }
+
+ cache.put(key.getID(), key);
+ }
+
+ for (CDORevisionKey key : changeSetData.getChangedObjects())
+ {
+ if (revisionDeltaCallback == null && !(key instanceof CDORevisionDelta))
+ {
+ throw new IllegalStateException("No callback installed to lazily obtain revision delta " + key);
+ }
+
+ cache.put(key.getID(), key);
+ }
+
+ for (CDOIDAndVersion key : changeSetData.getDetachedObjects())
+ {
+ cache.put(key.getID(), DETACHED);
+ }
+
+ return cache;
+ }
+
+ private CDORevision applyDelta(CDORevisionDelta revisionDelta)
+ {
+ CDOID id = revisionDelta.getID();
+ CDORevision changedObject = delegate.getRevision(id).copy();
+ revisionDelta.apply(changedObject);
+ cachedRevisions.put(id, changedObject);
+ return changedObject;
+ }
+}
diff --git a/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/spi/common/commit/CDOChangeSetSegment.java b/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/spi/common/commit/CDOChangeSetSegment.java
index 1473c3ef20..c35dac97a6 100644
--- a/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/spi/common/commit/CDOChangeSetSegment.java
+++ b/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/spi/common/commit/CDOChangeSetSegment.java
@@ -1,87 +1,87 @@
-/*
- * Copyright (c) 2004 - 2011 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.commit;
-
-import org.eclipse.emf.cdo.common.branch.CDOBranch;
-import org.eclipse.emf.cdo.common.branch.CDOBranchPoint;
-import org.eclipse.emf.cdo.internal.common.branch.CDOBranchPointImpl;
-
-import org.eclipse.net4j.util.ObjectUtil;
-
-import java.text.MessageFormat;
-import java.util.LinkedList;
-
-/**
- * @author Eike Stepper
- * @since 3.0
- * @noextend This interface is not intended to be extended by clients.
- */
-public class CDOChangeSetSegment implements CDOBranchPoint
-{
- private CDOBranchPoint branchPoint;
-
- private long endTime;
-
- public CDOChangeSetSegment(CDOBranch branch, long timeStamp, long endTime)
- {
- branchPoint = new CDOBranchPointImpl(branch, timeStamp);
- this.endTime = endTime;
- }
-
- public CDOBranch getBranch()
- {
- return branchPoint.getBranch();
- }
-
- public long getTimeStamp()
- {
- return branchPoint.getTimeStamp();
- }
-
- public long getEndTime()
- {
- return endTime;
- }
-
- public CDOBranchPoint getEndPoint()
- {
- return getBranch().getPoint(endTime);
- }
-
- public boolean isOpenEnded()
- {
- return endTime == CDOBranchPoint.UNSPECIFIED_DATE;
- }
-
- @Override
- public String toString()
- {
- return MessageFormat.format("Segment[{0}, {1}, {2}]", getBranch(), getTimeStamp(), endTime); //$NON-NLS-1$
- }
-
- public static CDOChangeSetSegment[] createFrom(CDOBranchPoint startPoint, CDOBranchPoint endPoint)
- {
- LinkedList<CDOChangeSetSegment> result = new LinkedList<CDOChangeSetSegment>();
- CDOBranch startBranch = startPoint.getBranch();
- CDOBranch endBranch = endPoint.getBranch();
-
- while (!ObjectUtil.equals(startBranch, endBranch))
- {
- CDOBranchPoint base = endBranch.getBase();
- result.addFirst(new CDOChangeSetSegment(endBranch, base.getTimeStamp(), endPoint.getTimeStamp()));
- endPoint = base;
- endBranch = base.getBranch();
- }
-
- result.addFirst(new CDOChangeSetSegment(startBranch, startPoint.getTimeStamp(), endPoint.getTimeStamp()));
- return result.toArray(new CDOChangeSetSegment[result.size()]);
- }
-}
+/*
+ * Copyright (c) 2004 - 2012 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.commit;
+
+import org.eclipse.emf.cdo.common.branch.CDOBranch;
+import org.eclipse.emf.cdo.common.branch.CDOBranchPoint;
+import org.eclipse.emf.cdo.internal.common.branch.CDOBranchPointImpl;
+
+import org.eclipse.net4j.util.ObjectUtil;
+
+import java.text.MessageFormat;
+import java.util.LinkedList;
+
+/**
+ * @author Eike Stepper
+ * @since 3.0
+ * @noextend This interface is not intended to be extended by clients.
+ */
+public class CDOChangeSetSegment implements CDOBranchPoint
+{
+ private CDOBranchPoint branchPoint;
+
+ private long endTime;
+
+ public CDOChangeSetSegment(CDOBranch branch, long timeStamp, long endTime)
+ {
+ branchPoint = new CDOBranchPointImpl(branch, timeStamp);
+ this.endTime = endTime;
+ }
+
+ public CDOBranch getBranch()
+ {
+ return branchPoint.getBranch();
+ }
+
+ public long getTimeStamp()
+ {
+ return branchPoint.getTimeStamp();
+ }
+
+ public long getEndTime()
+ {
+ return endTime;
+ }
+
+ public CDOBranchPoint getEndPoint()
+ {
+ return getBranch().getPoint(endTime);
+ }
+
+ public boolean isOpenEnded()
+ {
+ return endTime == CDOBranchPoint.UNSPECIFIED_DATE;
+ }
+
+ @Override
+ public String toString()
+ {
+ return MessageFormat.format("Segment[{0}, {1}, {2}]", getBranch(), getTimeStamp(), endTime); //$NON-NLS-1$
+ }
+
+ public static CDOChangeSetSegment[] createFrom(CDOBranchPoint startPoint, CDOBranchPoint endPoint)
+ {
+ LinkedList<CDOChangeSetSegment> result = new LinkedList<CDOChangeSetSegment>();
+ CDOBranch startBranch = startPoint.getBranch();
+ CDOBranch endBranch = endPoint.getBranch();
+
+ while (!ObjectUtil.equals(startBranch, endBranch))
+ {
+ CDOBranchPoint base = endBranch.getBase();
+ result.addFirst(new CDOChangeSetSegment(endBranch, base.getTimeStamp(), endPoint.getTimeStamp()));
+ endPoint = base;
+ endBranch = base.getBranch();
+ }
+
+ result.addFirst(new CDOChangeSetSegment(startBranch, startPoint.getTimeStamp(), endPoint.getTimeStamp()));
+ return result.toArray(new CDOChangeSetSegment[result.size()]);
+ }
+}
diff --git a/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/spi/common/commit/CDOCommitInfoUtil.java b/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/spi/common/commit/CDOCommitInfoUtil.java
index 51438bf8d3..76378f2d4a 100644
--- a/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/spi/common/commit/CDOCommitInfoUtil.java
+++ b/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/spi/common/commit/CDOCommitInfoUtil.java
@@ -1,102 +1,102 @@
-/*
- * Copyright (c) 2004 - 2011 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.commit;
-
-import org.eclipse.emf.cdo.common.commit.CDOChangeSetData;
-import org.eclipse.emf.cdo.common.id.CDOID;
-import org.eclipse.emf.cdo.common.revision.CDOIDAndVersion;
-import org.eclipse.emf.cdo.common.revision.CDORevisionKey;
-import org.eclipse.emf.cdo.common.revision.delta.CDOFeatureDelta;
-import org.eclipse.emf.cdo.common.revision.delta.CDOListFeatureDelta;
-import org.eclipse.emf.cdo.common.revision.delta.CDORevisionDelta;
-import org.eclipse.emf.cdo.internal.common.commit.CDOCommitInfoManagerImpl;
-import org.eclipse.emf.cdo.spi.common.revision.InternalCDORevision;
-
-import org.eclipse.emf.ecore.EStructuralFeature;
-
-import java.io.PrintStream;
-import java.text.MessageFormat;
-import java.util.List;
-
-/**
- * @author Eike Stepper
- * @since 3.0
- */
-public final class CDOCommitInfoUtil
-{
- private CDOCommitInfoUtil()
- {
- }
-
- public static InternalCDOCommitInfoManager createCommitInfoManager()
- {
- return new CDOCommitInfoManagerImpl();
- }
-
- /**
- * @since 4.0
- */
- public static void dump(PrintStream out, CDOChangeSetData changeSetData)
- {
- for (CDOIDAndVersion key : changeSetData.getNewObjects())
- {
- out.println(" + " + key);
- if (key instanceof InternalCDORevision)
- {
- InternalCDORevision revision = (InternalCDORevision)key;
- for (EStructuralFeature feature : revision.getClassInfo().getAllPersistentFeatures())
- {
- Object value = revision.getValue(feature);
- dumpFeature(out, feature, value);
- }
- }
- }
-
- for (CDORevisionKey key : changeSetData.getChangedObjects())
- {
- CDORevisionDelta delta = (CDORevisionDelta)key;
-
- String name = delta.getEClass().getName();
- CDOID id = delta.getID();
- int branch = delta.getBranch().getID();
- int version = delta.getVersion();
-
- out.println(MessageFormat.format(" * {0}@{1}:{2}v{3}", name, id, branch, version));
- dumpFeatureDeltas(out, delta.getFeatureDeltas());
- }
-
- for (CDOIDAndVersion key : changeSetData.getDetachedObjects())
- {
- out.println(" - " + key);
- }
- }
-
- private static void dumpFeatureDeltas(PrintStream out, List<CDOFeatureDelta> featureDeltas)
- {
- for (CDOFeatureDelta featureDelta : featureDeltas)
- {
- if (featureDelta instanceof CDOListFeatureDelta)
- {
- CDOListFeatureDelta list = (CDOListFeatureDelta)featureDelta;
- dumpFeatureDeltas(out, list.getListChanges());
- }
- else
- {
- dumpFeature(out, featureDelta.getFeature(), featureDelta);
- }
- }
- }
-
- private static void dumpFeature(PrintStream out, EStructuralFeature feature, Object value)
- {
- out.println(" " + feature.getName() + " = " + value);
- }
-}
+/*
+ * Copyright (c) 2004 - 2012 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.commit;
+
+import org.eclipse.emf.cdo.common.commit.CDOChangeSetData;
+import org.eclipse.emf.cdo.common.id.CDOID;
+import org.eclipse.emf.cdo.common.revision.CDOIDAndVersion;
+import org.eclipse.emf.cdo.common.revision.CDORevisionKey;
+import org.eclipse.emf.cdo.common.revision.delta.CDOFeatureDelta;
+import org.eclipse.emf.cdo.common.revision.delta.CDOListFeatureDelta;
+import org.eclipse.emf.cdo.common.revision.delta.CDORevisionDelta;
+import org.eclipse.emf.cdo.internal.common.commit.CDOCommitInfoManagerImpl;
+import org.eclipse.emf.cdo.spi.common.revision.InternalCDORevision;
+
+import org.eclipse.emf.ecore.EStructuralFeature;
+
+import java.io.PrintStream;
+import java.text.MessageFormat;
+import java.util.List;
+
+/**
+ * @author Eike Stepper
+ * @since 3.0
+ */
+public final class CDOCommitInfoUtil
+{
+ private CDOCommitInfoUtil()
+ {
+ }
+
+ public static InternalCDOCommitInfoManager createCommitInfoManager()
+ {
+ return new CDOCommitInfoManagerImpl();
+ }
+
+ /**
+ * @since 4.0
+ */
+ public static void dump(PrintStream out, CDOChangeSetData changeSetData)
+ {
+ for (CDOIDAndVersion key : changeSetData.getNewObjects())
+ {
+ out.println(" + " + key);
+ if (key instanceof InternalCDORevision)
+ {
+ InternalCDORevision revision = (InternalCDORevision)key;
+ for (EStructuralFeature feature : revision.getClassInfo().getAllPersistentFeatures())
+ {
+ Object value = revision.getValue(feature);
+ dumpFeature(out, feature, value);
+ }
+ }
+ }
+
+ for (CDORevisionKey key : changeSetData.getChangedObjects())
+ {
+ CDORevisionDelta delta = (CDORevisionDelta)key;
+
+ String name = delta.getEClass().getName();
+ CDOID id = delta.getID();
+ int branch = delta.getBranch().getID();
+ int version = delta.getVersion();
+
+ out.println(MessageFormat.format(" * {0}@{1}:{2}v{3}", name, id, branch, version));
+ dumpFeatureDeltas(out, delta.getFeatureDeltas());
+ }
+
+ for (CDOIDAndVersion key : changeSetData.getDetachedObjects())
+ {
+ out.println(" - " + key);
+ }
+ }
+
+ private static void dumpFeatureDeltas(PrintStream out, List<CDOFeatureDelta> featureDeltas)
+ {
+ for (CDOFeatureDelta featureDelta : featureDeltas)
+ {
+ if (featureDelta instanceof CDOListFeatureDelta)
+ {
+ CDOListFeatureDelta list = (CDOListFeatureDelta)featureDelta;
+ dumpFeatureDeltas(out, list.getListChanges());
+ }
+ else
+ {
+ dumpFeature(out, featureDelta.getFeature(), featureDelta);
+ }
+ }
+ }
+
+ private static void dumpFeature(PrintStream out, EStructuralFeature feature, Object value)
+ {
+ out.println(" " + feature.getName() + " = " + value);
+ }
+}
diff --git a/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/spi/common/commit/CDORevisionAvailabilityInfo.java b/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/spi/common/commit/CDORevisionAvailabilityInfo.java
index a0d3303d5e..d98c8d359b 100644
--- a/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/spi/common/commit/CDORevisionAvailabilityInfo.java
+++ b/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/spi/common/commit/CDORevisionAvailabilityInfo.java
@@ -1,73 +1,73 @@
-/*
- * Copyright (c) 2004 - 2011 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.commit;
-
-import org.eclipse.emf.cdo.common.branch.CDOBranchPoint;
-import org.eclipse.emf.cdo.common.id.CDOID;
-import org.eclipse.emf.cdo.common.revision.CDORevision;
-import org.eclipse.emf.cdo.common.revision.CDORevisionKey;
-import org.eclipse.emf.cdo.common.revision.CDORevisionProvider;
-
-import java.text.MessageFormat;
-import java.util.HashMap;
-import java.util.Map;
-
-/**
- * @author Eike Stepper
- * @since 3.0
- */
-public final class CDORevisionAvailabilityInfo implements CDORevisionProvider
-{
- private CDOBranchPoint branchPoint;
-
- private Map<CDOID, CDORevisionKey> availableRevisions = new HashMap<CDOID, CDORevisionKey>();
-
- public CDORevisionAvailabilityInfo(CDOBranchPoint branchPoint)
- {
- this.branchPoint = branchPoint;
- }
-
- public CDOBranchPoint getBranchPoint()
- {
- return branchPoint;
- }
-
- public Map<CDOID, CDORevisionKey> getAvailableRevisions()
- {
- return availableRevisions;
- }
-
- public void addRevision(CDORevisionKey key)
- {
- availableRevisions.put(key.getID(), key);
- }
-
- public void removeRevision(CDOID id)
- {
- availableRevisions.remove(id);
- }
-
- public boolean containsRevision(CDOID id)
- {
- return availableRevisions.containsKey(id);
- }
-
- public CDORevision getRevision(CDOID id)
- {
- return (CDORevision)availableRevisions.get(id);
- }
-
- @Override
- public String toString()
- {
- return MessageFormat.format("CDORevisionAvailabilityInfo[{0} -> {1} ]", branchPoint, availableRevisions.values());
- }
-}
+/*
+ * Copyright (c) 2004 - 2012 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.commit;
+
+import org.eclipse.emf.cdo.common.branch.CDOBranchPoint;
+import org.eclipse.emf.cdo.common.id.CDOID;
+import org.eclipse.emf.cdo.common.revision.CDORevision;
+import org.eclipse.emf.cdo.common.revision.CDORevisionKey;
+import org.eclipse.emf.cdo.common.revision.CDORevisionProvider;
+
+import java.text.MessageFormat;
+import java.util.HashMap;
+import java.util.Map;
+
+/**
+ * @author Eike Stepper
+ * @since 3.0
+ */
+public final class CDORevisionAvailabilityInfo implements CDORevisionProvider
+{
+ private CDOBranchPoint branchPoint;
+
+ private Map<CDOID, CDORevisionKey> availableRevisions = new HashMap<CDOID, CDORevisionKey>();
+
+ public CDORevisionAvailabilityInfo(CDOBranchPoint branchPoint)
+ {
+ this.branchPoint = branchPoint;
+ }
+
+ public CDOBranchPoint getBranchPoint()
+ {
+ return branchPoint;
+ }
+
+ public Map<CDOID, CDORevisionKey> getAvailableRevisions()
+ {
+ return availableRevisions;
+ }
+
+ public void addRevision(CDORevisionKey key)
+ {
+ availableRevisions.put(key.getID(), key);
+ }
+
+ public void removeRevision(CDOID id)
+ {
+ availableRevisions.remove(id);
+ }
+
+ public boolean containsRevision(CDOID id)
+ {
+ return availableRevisions.containsKey(id);
+ }
+
+ public CDORevision getRevision(CDOID id)
+ {
+ return (CDORevision)availableRevisions.get(id);
+ }
+
+ @Override
+ public String toString()
+ {
+ return MessageFormat.format("CDORevisionAvailabilityInfo[{0} -> {1} ]", branchPoint, availableRevisions.values());
+ }
+}
diff --git a/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/spi/common/commit/InternalCDOCommitInfoManager.java b/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/spi/common/commit/InternalCDOCommitInfoManager.java
index f258c554f0..a1039d380f 100644
--- a/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/spi/common/commit/InternalCDOCommitInfoManager.java
+++ b/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/spi/common/commit/InternalCDOCommitInfoManager.java
@@ -1,48 +1,48 @@
-/*
- * Copyright (c) 2004 - 2011 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.commit;
-
-import org.eclipse.emf.cdo.common.branch.CDOBranch;
-import org.eclipse.emf.cdo.common.commit.CDOCommitData;
-import org.eclipse.emf.cdo.common.commit.CDOCommitInfo;
-import org.eclipse.emf.cdo.common.commit.CDOCommitInfoHandler;
-import org.eclipse.emf.cdo.common.commit.CDOCommitInfoManager;
-
-import org.eclipse.net4j.util.lifecycle.ILifecycle;
-
-/**
- * @author Eike Stepper
- * @since 3.0
- * @noextend This interface is not intended to be extended by clients.
- * @noimplement This interface is not intended to be implemented by clients.
- */
-public interface InternalCDOCommitInfoManager extends CDOCommitInfoManager, ILifecycle
-{
- public CommitInfoLoader getCommitInfoLoader();
-
- public void setCommitInfoLoader(CommitInfoLoader commitInfoLoader);
-
- /**
- * @since 4.0
- */
- public CDOCommitInfo createCommitInfo(CDOBranch branch, long timeStamp, long previousTimeStamp, String userID,
- String comment, CDOCommitData commitData);
-
- /**
- * @author Eike Stepper
- */
- public interface CommitInfoLoader
- {
- public void loadCommitInfos(CDOBranch branch, long startTime, long endTime, CDOCommitInfoHandler handler);
-
- public CDOCommitData loadCommitData(long timeStamp);
- }
-}
+/*
+ * Copyright (c) 2004 - 2012 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.commit;
+
+import org.eclipse.emf.cdo.common.branch.CDOBranch;
+import org.eclipse.emf.cdo.common.commit.CDOCommitData;
+import org.eclipse.emf.cdo.common.commit.CDOCommitInfo;
+import org.eclipse.emf.cdo.common.commit.CDOCommitInfoHandler;
+import org.eclipse.emf.cdo.common.commit.CDOCommitInfoManager;
+
+import org.eclipse.net4j.util.lifecycle.ILifecycle;
+
+/**
+ * @author Eike Stepper
+ * @since 3.0
+ * @noextend This interface is not intended to be extended by clients.
+ * @noimplement This interface is not intended to be implemented by clients.
+ */
+public interface InternalCDOCommitInfoManager extends CDOCommitInfoManager, ILifecycle
+{
+ public CommitInfoLoader getCommitInfoLoader();
+
+ public void setCommitInfoLoader(CommitInfoLoader commitInfoLoader);
+
+ /**
+ * @since 4.0
+ */
+ public CDOCommitInfo createCommitInfo(CDOBranch branch, long timeStamp, long previousTimeStamp, String userID,
+ String comment, CDOCommitData commitData);
+
+ /**
+ * @author Eike Stepper
+ */
+ public interface CommitInfoLoader
+ {
+ public void loadCommitInfos(CDOBranch branch, long startTime, long endTime, CDOCommitInfoHandler handler);
+
+ public CDOCommitData loadCommitData(long timeStamp);
+ }
+}
diff --git a/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/spi/common/commit/package-info.java b/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/spi/common/commit/package-info.java
index 968cc44e53..9b8e34f2ed 100644
--- a/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/spi/common/commit/package-info.java
+++ b/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/spi/common/commit/package-info.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2004 - 2011 Eike Stepper (Berlin, Germany) and others.
+ * Copyright (c) 2004 - 2012 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
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 c30295f1a8..a45f7cf7c3 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
@@ -1,68 +1,68 @@
-/*
- * Copyright (c) 2004 - 2011 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 - bug 213402
- */
-package org.eclipse.emf.cdo.spi.common.id;
-
-import org.eclipse.emf.cdo.common.id.CDOID;
-
-import org.eclipse.net4j.util.io.ExtendedDataInput;
-import org.eclipse.net4j.util.io.ExtendedDataOutput;
-
-import java.io.IOException;
-
-/**
- * @author Eike Stepper
- * @since 2.0
- * @noextend This interface is not intended to be extended by clients.
- */
-public abstract class AbstractCDOID implements CDOID
-{
- private static final long serialVersionUID = 1L;
-
- public AbstractCDOID()
- {
- }
-
- @Override
- public String toString()
- {
- return toURIFragment();
- }
-
- 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.
- */
- public abstract void read(String fragmentPart);
-
- /**
- * TODO: Change the parameter to CDODataInput to prevent casting in IDs with classifier.
- */
- public abstract void read(ExtendedDataInput in) throws IOException;
-
- /**
- * TODO: Change the parameter to CDODataInput to prevent casting in IDs with classifier.
- */
- public abstract void write(ExtendedDataOutput out) throws IOException;
-}
+/*
+ * Copyright (c) 2004 - 2012 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 - bug 213402
+ */
+package org.eclipse.emf.cdo.spi.common.id;
+
+import org.eclipse.emf.cdo.common.id.CDOID;
+
+import org.eclipse.net4j.util.io.ExtendedDataInput;
+import org.eclipse.net4j.util.io.ExtendedDataOutput;
+
+import java.io.IOException;
+
+/**
+ * @author Eike Stepper
+ * @since 2.0
+ * @noextend This interface is not intended to be extended by clients.
+ */
+public abstract class AbstractCDOID implements CDOID
+{
+ private static final long serialVersionUID = 1L;
+
+ public AbstractCDOID()
+ {
+ }
+
+ @Override
+ public String toString()
+ {
+ return toURIFragment();
+ }
+
+ 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.
+ */
+ public abstract void read(String fragmentPart);
+
+ /**
+ * TODO: Change the parameter to CDODataInput to prevent casting in IDs with classifier.
+ */
+ public abstract void read(ExtendedDataInput in) throws IOException;
+
+ /**
+ * TODO: Change the parameter to CDODataInput to prevent casting in IDs with classifier.
+ */
+ public abstract void write(ExtendedDataOutput out) throws IOException;
+}
diff --git a/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/spi/common/id/AbstractCDOIDByteArray.java b/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/spi/common/id/AbstractCDOIDByteArray.java
index fefe0ec001..51e2fb92c7 100644
--- a/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/spi/common/id/AbstractCDOIDByteArray.java
+++ b/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/spi/common/id/AbstractCDOIDByteArray.java
@@ -1,95 +1,95 @@
-/*
- * Copyright (c) 2004 - 2011 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.id;
-
-import org.eclipse.emf.cdo.common.id.CDOIDUtil;
-
-import org.eclipse.net4j.util.CheckUtil;
-import org.eclipse.net4j.util.io.ExtendedDataInput;
-import org.eclipse.net4j.util.io.ExtendedDataOutput;
-
-import java.io.IOException;
-import java.util.Arrays;
-
-/**
- * @author Eike Stepper
- * @since 4.1
- * @noextend This interface is not intended to be extended by clients.
- */
-public abstract class AbstractCDOIDByteArray extends AbstractCDOID
-{
- public static final String NULL_VALUE = null;
-
- private static final long serialVersionUID = 1L;
-
- private byte[] value;
-
- public AbstractCDOIDByteArray()
- {
- }
-
- public AbstractCDOIDByteArray(byte[] value)
- {
- CheckUtil.checkArg(value != null && value.length == 16, "Illegal UUID value");
- this.value = value;
- }
-
- public byte[] getByteArrayValue()
- {
- return value;
- }
-
- public String toURIFragment()
- {
- return CDOIDUtil.encodeUUID(value);
- }
-
- @Override
- public void read(String fragmentPart)
- {
- value = CDOIDUtil.decodeUUID(fragmentPart);
- }
-
- @Override
- public void read(ExtendedDataInput in) throws IOException
- {
- value = in.readByteArray();
- }
-
- @Override
- public void write(ExtendedDataOutput out) throws IOException
- {
- out.writeByteArray(value);
- }
-
- @Override
- public boolean equals(Object obj)
- {
- if (obj == this)
- {
- return true;
- }
-
- if (obj != null && obj.getClass() == getClass())
- {
- AbstractCDOIDByteArray that = (AbstractCDOIDByteArray)obj;
- return Arrays.equals(value, that.value);
- }
-
- return false;
- }
-
- @Override
- public int hashCode()
- {
- return getClass().hashCode() ^ Arrays.hashCode(value);
- }
-}
+/*
+ * Copyright (c) 2004 - 2012 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.id;
+
+import org.eclipse.emf.cdo.common.id.CDOIDUtil;
+
+import org.eclipse.net4j.util.CheckUtil;
+import org.eclipse.net4j.util.io.ExtendedDataInput;
+import org.eclipse.net4j.util.io.ExtendedDataOutput;
+
+import java.io.IOException;
+import java.util.Arrays;
+
+/**
+ * @author Eike Stepper
+ * @since 4.1
+ * @noextend This interface is not intended to be extended by clients.
+ */
+public abstract class AbstractCDOIDByteArray extends AbstractCDOID
+{
+ public static final String NULL_VALUE = null;
+
+ private static final long serialVersionUID = 1L;
+
+ private byte[] value;
+
+ public AbstractCDOIDByteArray()
+ {
+ }
+
+ public AbstractCDOIDByteArray(byte[] value)
+ {
+ CheckUtil.checkArg(value != null && value.length == 16, "Illegal UUID value");
+ this.value = value;
+ }
+
+ public byte[] getByteArrayValue()
+ {
+ return value;
+ }
+
+ public String toURIFragment()
+ {
+ return CDOIDUtil.encodeUUID(value);
+ }
+
+ @Override
+ public void read(String fragmentPart)
+ {
+ value = CDOIDUtil.decodeUUID(fragmentPart);
+ }
+
+ @Override
+ public void read(ExtendedDataInput in) throws IOException
+ {
+ value = in.readByteArray();
+ }
+
+ @Override
+ public void write(ExtendedDataOutput out) throws IOException
+ {
+ out.writeByteArray(value);
+ }
+
+ @Override
+ public boolean equals(Object obj)
+ {
+ if (obj == this)
+ {
+ return true;
+ }
+
+ if (obj != null && obj.getClass() == getClass())
+ {
+ AbstractCDOIDByteArray that = (AbstractCDOIDByteArray)obj;
+ return Arrays.equals(value, that.value);
+ }
+
+ return false;
+ }
+
+ @Override
+ public int hashCode()
+ {
+ return getClass().hashCode() ^ Arrays.hashCode(value);
+ }
+}
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 6208803b73..790243fd78 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
@@ -1,109 +1,109 @@
-/*
- * Copyright (c) 2004 - 2011 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 - bug 226778
- */
-package org.eclipse.emf.cdo.spi.common.id;
-
-import org.eclipse.net4j.util.io.ExtendedDataInput;
-import org.eclipse.net4j.util.io.ExtendedDataOutput;
-
-import java.io.IOException;
-
-/**
- * @author Eike Stepper
- * @since 2.0
- * @noextend This interface is not intended to be extended by clients.
- */
-public abstract class AbstractCDOIDInteger extends AbstractCDOID
-{
- private static final long serialVersionUID = 1L;
-
- private int value;
-
- public AbstractCDOIDInteger()
- {
- }
-
- public AbstractCDOIDInteger(int value)
- {
- if (value == 0)
- {
- throw new IllegalArgumentException("value == 0"); //$NON-NLS-1$
- }
-
- this.value = value;
- }
-
- public int getIntValue()
- {
- return value;
- }
-
- public String toURIFragment()
- {
- return String.valueOf(value);
- }
-
- @Override
- public void read(String fragmentPart)
- {
- value = Integer.valueOf(fragmentPart);
- }
-
- @Override
- public void read(ExtendedDataInput in) throws IOException
- {
- value = in.readInt();
- }
-
- @Override
- public void write(ExtendedDataOutput out) throws IOException
- {
- out.writeInt(value);
- }
-
- public int compareTo(AbstractCDOIDInteger that)
- {
- if (value < that.value)
- {
- return -1;
- }
-
- if (value > that.value)
- {
- return 1;
- }
-
- return 0;
- }
-
- @Override
- public boolean equals(Object obj)
- {
- if (obj == this)
- {
- return true;
- }
-
- if (obj != null && obj.getClass() == getClass())
- {
- AbstractCDOIDInteger that = (AbstractCDOIDInteger)obj;
- return value == that.value;
- }
-
- return false;
- }
-
- @Override
- public int hashCode()
- {
- return getClass().hashCode() ^ value;
- }
-}
+/*
+ * Copyright (c) 2004 - 2012 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 - bug 226778
+ */
+package org.eclipse.emf.cdo.spi.common.id;
+
+import org.eclipse.net4j.util.io.ExtendedDataInput;
+import org.eclipse.net4j.util.io.ExtendedDataOutput;
+
+import java.io.IOException;
+
+/**
+ * @author Eike Stepper
+ * @since 2.0
+ * @noextend This interface is not intended to be extended by clients.
+ */
+public abstract class AbstractCDOIDInteger extends AbstractCDOID
+{
+ private static final long serialVersionUID = 1L;
+
+ private int value;
+
+ public AbstractCDOIDInteger()
+ {
+ }
+
+ public AbstractCDOIDInteger(int value)
+ {
+ if (value == 0)
+ {
+ throw new IllegalArgumentException("value == 0"); //$NON-NLS-1$
+ }
+
+ this.value = value;
+ }
+
+ public int getIntValue()
+ {
+ return value;
+ }
+
+ public String toURIFragment()
+ {
+ return String.valueOf(value);
+ }
+
+ @Override
+ public void read(String fragmentPart)
+ {
+ value = Integer.valueOf(fragmentPart);
+ }
+
+ @Override
+ public void read(ExtendedDataInput in) throws IOException
+ {
+ value = in.readInt();
+ }
+
+ @Override
+ public void write(ExtendedDataOutput out) throws IOException
+ {
+ out.writeInt(value);
+ }
+
+ public int compareTo(AbstractCDOIDInteger that)
+ {
+ if (value < that.value)
+ {
+ return -1;
+ }
+
+ if (value > that.value)
+ {
+ return 1;
+ }
+
+ return 0;
+ }
+
+ @Override
+ public boolean equals(Object obj)
+ {
+ if (obj == this)
+ {
+ return true;
+ }
+
+ if (obj != null && obj.getClass() == getClass())
+ {
+ AbstractCDOIDInteger that = (AbstractCDOIDInteger)obj;
+ return value == that.value;
+ }
+
+ return false;
+ }
+
+ @Override
+ public int hashCode()
+ {
+ return getClass().hashCode() ^ value;
+ }
+}
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 9dedd21366..60c0bbccaf 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
@@ -1,103 +1,103 @@
-/*
- * Copyright (c) 2004 - 2011 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 - bug 226778
- */
-package org.eclipse.emf.cdo.spi.common.id;
-
-import org.eclipse.net4j.util.ObjectUtil;
-import org.eclipse.net4j.util.io.ExtendedDataInput;
-import org.eclipse.net4j.util.io.ExtendedDataOutput;
-
-import java.io.IOException;
-
-/**
- * @author Eike Stepper
- * @since 2.0
- * @noextend This interface is not intended to be extended by clients.
- */
-public abstract class AbstractCDOIDLong extends AbstractCDOID
-{
- public static final long NULL_VALUE = 0L;
-
- private static final long serialVersionUID = 1L;
-
- private long value;
-
- public AbstractCDOIDLong()
- {
- }
-
- public AbstractCDOIDLong(long value)
- {
- if (value == NULL_VALUE)
- {
- throw new IllegalArgumentException("value == NULL_VALUE"); //$NON-NLS-1$
- }
-
- this.value = value;
- }
-
- public long getLongValue()
- {
- return value;
- }
-
- public String toURIFragment()
- {
- return String.valueOf(value);
- }
-
- @Override
- public void read(String fragmentPart)
- {
- value = Long.valueOf(fragmentPart);
- }
-
- @Override
- public void read(ExtendedDataInput in) throws IOException
- {
- value = in.readLong();
- }
-
- @Override
- public void write(ExtendedDataOutput out) throws IOException
- {
- out.writeLong(value);
- }
-
- @Override
- public boolean equals(Object obj)
- {
- if (obj == this)
- {
- return true;
- }
-
- if (obj != null && obj.getClass() == getClass())
- {
- AbstractCDOIDLong that = (AbstractCDOIDLong)obj;
- return value == that.value;
- }
-
- return false;
- }
-
- @Override
- public int hashCode()
- {
- return getClass().hashCode() ^ ObjectUtil.hashCode(value);
- }
-
- @Override
- public String toString()
- {
- return String.valueOf(value);
- }
-}
+/*
+ * Copyright (c) 2004 - 2012 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 - bug 226778
+ */
+package org.eclipse.emf.cdo.spi.common.id;
+
+import org.eclipse.net4j.util.ObjectUtil;
+import org.eclipse.net4j.util.io.ExtendedDataInput;
+import org.eclipse.net4j.util.io.ExtendedDataOutput;
+
+import java.io.IOException;
+
+/**
+ * @author Eike Stepper
+ * @since 2.0
+ * @noextend This interface is not intended to be extended by clients.
+ */
+public abstract class AbstractCDOIDLong extends AbstractCDOID
+{
+ public static final long NULL_VALUE = 0L;
+
+ private static final long serialVersionUID = 1L;
+
+ private long value;
+
+ public AbstractCDOIDLong()
+ {
+ }
+
+ public AbstractCDOIDLong(long value)
+ {
+ if (value == NULL_VALUE)
+ {
+ throw new IllegalArgumentException("value == NULL_VALUE"); //$NON-NLS-1$
+ }
+
+ this.value = value;
+ }
+
+ public long getLongValue()
+ {
+ return value;
+ }
+
+ public String toURIFragment()
+ {
+ return String.valueOf(value);
+ }
+
+ @Override
+ public void read(String fragmentPart)
+ {
+ value = Long.valueOf(fragmentPart);
+ }
+
+ @Override
+ public void read(ExtendedDataInput in) throws IOException
+ {
+ value = in.readLong();
+ }
+
+ @Override
+ public void write(ExtendedDataOutput out) throws IOException
+ {
+ out.writeLong(value);
+ }
+
+ @Override
+ public boolean equals(Object obj)
+ {
+ if (obj == this)
+ {
+ return true;
+ }
+
+ if (obj != null && obj.getClass() == getClass())
+ {
+ AbstractCDOIDLong that = (AbstractCDOIDLong)obj;
+ return value == that.value;
+ }
+
+ return false;
+ }
+
+ @Override
+ public int hashCode()
+ {
+ return getClass().hashCode() ^ ObjectUtil.hashCode(value);
+ }
+
+ @Override
+ public String toString()
+ {
+ return String.valueOf(value);
+ }
+}
diff --git a/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/spi/common/id/AbstractCDOIDString.java b/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/spi/common/id/AbstractCDOIDString.java
index c200b7d7fa..b9ded5ab2e 100644
--- a/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/spi/common/id/AbstractCDOIDString.java
+++ b/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/spi/common/id/AbstractCDOIDString.java
@@ -1,101 +1,101 @@
-/*
- * Copyright (c) 2004 - 2011 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:
- * Martin Taal - initial API and implementation
- * Eike Stepper - maintenance
- */
-package org.eclipse.emf.cdo.spi.common.id;
-
-import org.eclipse.net4j.util.ObjectUtil;
-import org.eclipse.net4j.util.io.ExtendedDataInput;
-import org.eclipse.net4j.util.io.ExtendedDataOutput;
-
-import java.io.IOException;
-
-/**
- * @author Martin Taal
- * @since 3.0
- * @noextend This interface is not intended to be extended by clients.
- */
-public abstract class AbstractCDOIDString extends AbstractCDOID
-{
- /**
- * @since 4.0
- */
- public static final String NULL_VALUE = null;
-
- private static final long serialVersionUID = 1L;
-
- private String value;
-
- public AbstractCDOIDString()
- {
- }
-
- public AbstractCDOIDString(String value)
- {
- this.value = value;
- }
-
- public String getStringValue()
- {
- return value;
- }
-
- public String toURIFragment()
- {
- return value;
- }
-
- @Override
- public void read(String fragmentPart)
- {
- value = fragmentPart;
- }
-
- @Override
- public void read(ExtendedDataInput in) throws IOException
- {
- value = in.readString();
- }
-
- @Override
- public void write(ExtendedDataOutput out) throws IOException
- {
- out.writeString(value);
- }
-
- @Override
- public boolean equals(Object obj)
- {
- if (obj == this)
- {
- return true;
- }
-
- if (obj != null && obj.getClass() == getClass())
- {
- AbstractCDOIDString that = (AbstractCDOIDString)obj;
- return value.equals(that.value);
- }
-
- return false;
- }
-
- @Override
- public int hashCode()
- {
- return getClass().hashCode() ^ ObjectUtil.hashCode(value);
- }
-
- @Override
- public String toString()
- {
- return value;
- }
-}
+/*
+ * Copyright (c) 2004 - 2012 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:
+ * Martin Taal - initial API and implementation
+ * Eike Stepper - maintenance
+ */
+package org.eclipse.emf.cdo.spi.common.id;
+
+import org.eclipse.net4j.util.ObjectUtil;
+import org.eclipse.net4j.util.io.ExtendedDataInput;
+import org.eclipse.net4j.util.io.ExtendedDataOutput;
+
+import java.io.IOException;
+
+/**
+ * @author Martin Taal
+ * @since 3.0
+ * @noextend This interface is not intended to be extended by clients.
+ */
+public abstract class AbstractCDOIDString extends AbstractCDOID
+{
+ /**
+ * @since 4.0
+ */
+ public static final String NULL_VALUE = null;
+
+ private static final long serialVersionUID = 1L;
+
+ private String value;
+
+ public AbstractCDOIDString()
+ {
+ }
+
+ public AbstractCDOIDString(String value)
+ {
+ this.value = value;
+ }
+
+ public String getStringValue()
+ {
+ return value;
+ }
+
+ public String toURIFragment()
+ {
+ return value;
+ }
+
+ @Override
+ public void read(String fragmentPart)
+ {
+ value = fragmentPart;
+ }
+
+ @Override
+ public void read(ExtendedDataInput in) throws IOException
+ {
+ value = in.readString();
+ }
+
+ @Override
+ public void write(ExtendedDataOutput out) throws IOException
+ {
+ out.writeString(value);
+ }
+
+ @Override
+ public boolean equals(Object obj)
+ {
+ if (obj == this)
+ {
+ return true;
+ }
+
+ if (obj != null && obj.getClass() == getClass())
+ {
+ AbstractCDOIDString that = (AbstractCDOIDString)obj;
+ return value.equals(that.value);
+ }
+
+ return false;
+ }
+
+ @Override
+ public int hashCode()
+ {
+ return getClass().hashCode() ^ ObjectUtil.hashCode(value);
+ }
+
+ @Override
+ public String toString()
+ {
+ return value;
+ }
+}
diff --git a/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/spi/common/id/InternalCDOIDObject.java b/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/spi/common/id/InternalCDOIDObject.java
index 6e48b9d1fb..47071b8b6d 100644
--- a/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/spi/common/id/InternalCDOIDObject.java
+++ b/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/spi/common/id/InternalCDOIDObject.java
@@ -1,24 +1,24 @@
-/*
- * Copyright (c) 2004 - 2011 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.id;
-
-import org.eclipse.emf.cdo.common.id.CDOIDObject;
-
-/**
- * @author Eike Stepper
- * @since 3.0
- * @noextend This interface is not intended to be extended by clients.
- * @noimplement This interface is not intended to be implemented by clients.
- */
-public interface InternalCDOIDObject extends CDOIDObject
-{
- public ObjectType getSubType();
-}
+/*
+ * Copyright (c) 2004 - 2012 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.id;
+
+import org.eclipse.emf.cdo.common.id.CDOIDObject;
+
+/**
+ * @author Eike Stepper
+ * @since 3.0
+ * @noextend This interface is not intended to be extended by clients.
+ * @noimplement This interface is not intended to be implemented by clients.
+ */
+public interface InternalCDOIDObject extends CDOIDObject
+{
+ public ObjectType getSubType();
+}
diff --git a/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/spi/common/id/package-info.java b/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/spi/common/id/package-info.java
index b400e07001..548c925814 100644
--- a/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/spi/common/id/package-info.java
+++ b/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/spi/common/id/package-info.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2004 - 2011 Eike Stepper (Berlin, Germany) and others.
+ * Copyright (c) 2004 - 2012 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
diff --git a/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/spi/common/lock/InternalCDOLockState.java b/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/spi/common/lock/InternalCDOLockState.java
index 0b6a548aeb..841f520093 100644
--- a/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/spi/common/lock/InternalCDOLockState.java
+++ b/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/spi/common/lock/InternalCDOLockState.java
@@ -1,31 +1,31 @@
-/*
- * Copyright (c) 2004 - 2011 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:
- * Caspar De Groot - initial API and implementation
- */
-package org.eclipse.emf.cdo.spi.common.lock;
-
-import org.eclipse.emf.cdo.common.lock.CDOLockOwner;
-import org.eclipse.emf.cdo.common.lock.CDOLockState;
-
-/**
- * @author Caspar De Groot
- * @since 4.1
- * @noextend This interface is not intended to be extended by clients.
- * @noimplement This interface is not intended to be implemented by clients.
- */
-public interface InternalCDOLockState extends CDOLockState
-{
- public void addReadLockOwner(CDOLockOwner lockOwner);
-
- public boolean removeReadLockOwner(CDOLockOwner lockOwner);
-
- public void setWriteLockOwner(CDOLockOwner lockOwner);
-
- public void setWriteOptionOwner(CDOLockOwner lockOwner);
-}
+/*
+ * Copyright (c) 2004 - 2012 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:
+ * Caspar De Groot - initial API and implementation
+ */
+package org.eclipse.emf.cdo.spi.common.lock;
+
+import org.eclipse.emf.cdo.common.lock.CDOLockOwner;
+import org.eclipse.emf.cdo.common.lock.CDOLockState;
+
+/**
+ * @author Caspar De Groot
+ * @since 4.1
+ * @noextend This interface is not intended to be extended by clients.
+ * @noimplement This interface is not intended to be implemented by clients.
+ */
+public interface InternalCDOLockState extends CDOLockState
+{
+ public void addReadLockOwner(CDOLockOwner lockOwner);
+
+ public boolean removeReadLockOwner(CDOLockOwner lockOwner);
+
+ public void setWriteLockOwner(CDOLockOwner lockOwner);
+
+ public void setWriteOptionOwner(CDOLockOwner lockOwner);
+}
diff --git a/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/spi/common/lock/package-info.java b/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/spi/common/lock/package-info.java
index a9c3f10e1c..c4dbb6f6ea 100644
--- a/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/spi/common/lock/package-info.java
+++ b/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/spi/common/lock/package-info.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2004 - 2011 Eike Stepper (Berlin, Germany) and others.
+ * Copyright (c) 2004 - 2012 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
diff --git a/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/spi/common/model/DelegatingCDOPackageRegistry.java b/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/spi/common/model/DelegatingCDOPackageRegistry.java
index e45ee0fbcc..e1552684bc 100644
--- a/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/spi/common/model/DelegatingCDOPackageRegistry.java
+++ b/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/spi/common/model/DelegatingCDOPackageRegistry.java
@@ -1,174 +1,174 @@
-/*
- * Copyright (c) 2004 - 2011 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.net4j.util.lifecycle.Lifecycle;
-
-import org.eclipse.emf.ecore.EFactory;
-import org.eclipse.emf.ecore.EPackage;
-
-import java.util.Collection;
-import java.util.Map;
-import java.util.Set;
-
-/**
- * @author Eike Stepper
- * @since 4.0
- */
-@Deprecated
-public abstract class DelegatingCDOPackageRegistry extends Lifecycle implements InternalCDOPackageRegistry
-{
- public DelegatingCDOPackageRegistry()
- {
- }
-
- protected abstract InternalCDOPackageRegistry getDelegate();
-
- public Object basicPut(String nsURI, Object value)
- {
- return getDelegate().basicPut(nsURI, value);
- }
-
- public void clear()
- {
- getDelegate().clear();
- }
-
- public boolean containsKey(Object key)
- {
- return getDelegate().containsKey(key);
- }
-
- public boolean containsValue(Object value)
- {
- return getDelegate().containsValue(value);
- }
-
- public Set<java.util.Map.Entry<String, Object>> entrySet()
- {
- return getDelegate().entrySet();
- }
-
- public Object get(Object key)
- {
- return getDelegate().get(key);
- }
-
- public EFactory getEFactory(String nsURI)
- {
- return getDelegate().getEFactory(nsURI);
- }
-
- public EPackage getEPackage(String nsURI)
- {
- return getDelegate().getEPackage(nsURI);
- }
-
- public EPackage[] getEPackages()
- {
- return getDelegate().getEPackages();
- }
-
- public InternalCDOPackageInfo getPackageInfo(EPackage ePackage)
- {
- return getDelegate().getPackageInfo(ePackage);
- }
-
- public InternalCDOPackageInfo[] getPackageInfos()
- {
- return getDelegate().getPackageInfos();
- }
-
- public PackageLoader getPackageLoader()
- {
- return getDelegate().getPackageLoader();
- }
-
- public PackageProcessor getPackageProcessor()
- {
- return getDelegate().getPackageProcessor();
- }
-
- public InternalCDOPackageUnit getPackageUnit(EPackage ePackage)
- {
- return getDelegate().getPackageUnit(ePackage);
- }
-
- public InternalCDOPackageUnit[] getPackageUnits()
- {
- return getDelegate().getPackageUnits();
- }
-
- public boolean isEmpty()
- {
- return getDelegate().isEmpty();
- }
-
- public boolean isReplacingDescriptors()
- {
- return getDelegate().isReplacingDescriptors();
- }
-
- public Set<String> keySet()
- {
- return getDelegate().keySet();
- }
-
- public Object put(String key, Object value)
- {
- return getDelegate().put(key, value);
- }
-
- public void putAll(Map<? extends String, ? extends Object> t)
- {
- getDelegate().putAll(t);
- }
-
- public Object putEPackage(EPackage ePackage)
- {
- return getDelegate().putEPackage(ePackage);
- }
-
- public void putPackageUnit(InternalCDOPackageUnit packageUnit)
- {
- getDelegate().putPackageUnit(packageUnit);
- }
-
- public Object remove(Object key)
- {
- return getDelegate().remove(key);
- }
-
- public void setPackageLoader(PackageLoader packageLoader)
- {
- getDelegate().setPackageLoader(packageLoader);
- }
-
- public void setPackageProcessor(PackageProcessor packageProcessor)
- {
- getDelegate().setPackageProcessor(packageProcessor);
- }
-
- public void setReplacingDescriptors(boolean replacingDescriptors)
- {
- getDelegate().setReplacingDescriptors(replacingDescriptors);
- }
-
- public int size()
- {
- return getDelegate().size();
- }
-
- public Collection<Object> values()
- {
- return getDelegate().values();
- }
-}
+/*
+ * Copyright (c) 2004 - 2012 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.net4j.util.lifecycle.Lifecycle;
+
+import org.eclipse.emf.ecore.EFactory;
+import org.eclipse.emf.ecore.EPackage;
+
+import java.util.Collection;
+import java.util.Map;
+import java.util.Set;
+
+/**
+ * @author Eike Stepper
+ * @since 4.0
+ */
+@Deprecated
+public abstract class DelegatingCDOPackageRegistry extends Lifecycle implements InternalCDOPackageRegistry
+{
+ public DelegatingCDOPackageRegistry()
+ {
+ }
+
+ protected abstract InternalCDOPackageRegistry getDelegate();
+
+ public Object basicPut(String nsURI, Object value)
+ {
+ return getDelegate().basicPut(nsURI, value);
+ }
+
+ public void clear()
+ {
+ getDelegate().clear();
+ }
+
+ public boolean containsKey(Object key)
+ {
+ return getDelegate().containsKey(key);
+ }
+
+ public boolean containsValue(Object value)
+ {
+ return getDelegate().containsValue(value);
+ }
+
+ public Set<java.util.Map.Entry<String, Object>> entrySet()
+ {
+ return getDelegate().entrySet();
+ }
+
+ public Object get(Object key)
+ {
+ return getDelegate().get(key);
+ }
+
+ public EFactory getEFactory(String nsURI)
+ {
+ return getDelegate().getEFactory(nsURI);
+ }
+
+ public EPackage getEPackage(String nsURI)
+ {
+ return getDelegate().getEPackage(nsURI);
+ }
+
+ public EPackage[] getEPackages()
+ {
+ return getDelegate().getEPackages();
+ }
+
+ public InternalCDOPackageInfo getPackageInfo(EPackage ePackage)
+ {
+ return getDelegate().getPackageInfo(ePackage);
+ }
+
+ public InternalCDOPackageInfo[] getPackageInfos()
+ {
+ return getDelegate().getPackageInfos();
+ }
+
+ public PackageLoader getPackageLoader()
+ {
+ return getDelegate().getPackageLoader();
+ }
+
+ public PackageProcessor getPackageProcessor()
+ {
+ return getDelegate().getPackageProcessor();
+ }
+
+ public InternalCDOPackageUnit getPackageUnit(EPackage ePackage)
+ {
+ return getDelegate().getPackageUnit(ePackage);
+ }
+
+ public InternalCDOPackageUnit[] getPackageUnits()
+ {
+ return getDelegate().getPackageUnits();
+ }
+
+ public boolean isEmpty()
+ {
+ return getDelegate().isEmpty();
+ }
+
+ public boolean isReplacingDescriptors()
+ {
+ return getDelegate().isReplacingDescriptors();
+ }
+
+ public Set<String> keySet()
+ {
+ return getDelegate().keySet();
+ }
+
+ public Object put(String key, Object value)
+ {
+ return getDelegate().put(key, value);
+ }
+
+ public void putAll(Map<? extends String, ? extends Object> t)
+ {
+ getDelegate().putAll(t);
+ }
+
+ public Object putEPackage(EPackage ePackage)
+ {
+ return getDelegate().putEPackage(ePackage);
+ }
+
+ public void putPackageUnit(InternalCDOPackageUnit packageUnit)
+ {
+ getDelegate().putPackageUnit(packageUnit);
+ }
+
+ public Object remove(Object key)
+ {
+ return getDelegate().remove(key);
+ }
+
+ public void setPackageLoader(PackageLoader packageLoader)
+ {
+ getDelegate().setPackageLoader(packageLoader);
+ }
+
+ public void setPackageProcessor(PackageProcessor packageProcessor)
+ {
+ getDelegate().setPackageProcessor(packageProcessor);
+ }
+
+ public void setReplacingDescriptors(boolean replacingDescriptors)
+ {
+ getDelegate().setReplacingDescriptors(replacingDescriptors);
+ }
+
+ public int size()
+ {
+ return getDelegate().size();
+ }
+
+ public Collection<Object> values()
+ {
+ return getDelegate().values();
+ }
+}
diff --git a/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/spi/common/model/InternalCDOPackageInfo.java b/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/spi/common/model/InternalCDOPackageInfo.java
index 2b9f032024..20a56a7435 100644
--- a/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/spi/common/model/InternalCDOPackageInfo.java
+++ b/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/spi/common/model/InternalCDOPackageInfo.java
@@ -1,46 +1,46 @@
-/*
- * Copyright (c) 2004 - 2011 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.CDOPackageInfo;
-import org.eclipse.emf.cdo.common.protocol.CDODataInput;
-import org.eclipse.emf.cdo.common.protocol.CDODataOutput;
-
-import org.eclipse.emf.common.notify.Adapter;
-
-import java.io.IOException;
-
-/**
- * @author Eike Stepper
- * @since 2.0
- * @noextend This interface is not intended to be extended by clients.
- * @noimplement This interface is not intended to be implemented by clients.
- */
-public interface InternalCDOPackageInfo extends CDOPackageInfo, Adapter.Internal
-{
- public InternalCDOPackageUnit getPackageUnit();
-
- public void setPackageUnit(InternalCDOPackageUnit packageUnit);
-
- public void setPackageURI(String packageURI);
-
- public void setParentURI(String parentURI);
-
- /**
- * @since 3.0
- */
- public void write(CDODataOutput out) throws IOException;
-
- /**
- * @since 3.0
- */
- public void read(CDODataInput in) throws IOException;
-}
+/*
+ * Copyright (c) 2004 - 2012 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.CDOPackageInfo;
+import org.eclipse.emf.cdo.common.protocol.CDODataInput;
+import org.eclipse.emf.cdo.common.protocol.CDODataOutput;
+
+import org.eclipse.emf.common.notify.Adapter;
+
+import java.io.IOException;
+
+/**
+ * @author Eike Stepper
+ * @since 2.0
+ * @noextend This interface is not intended to be extended by clients.
+ * @noimplement This interface is not intended to be implemented by clients.
+ */
+public interface InternalCDOPackageInfo extends CDOPackageInfo, Adapter.Internal
+{
+ public InternalCDOPackageUnit getPackageUnit();
+
+ public void setPackageUnit(InternalCDOPackageUnit packageUnit);
+
+ public void setPackageURI(String packageURI);
+
+ public void setParentURI(String parentURI);
+
+ /**
+ * @since 3.0
+ */
+ public void write(CDODataOutput out) throws IOException;
+
+ /**
+ * @since 3.0
+ */
+ public void read(CDODataInput in) throws IOException;
+}
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
index ff99bd21d0..82a441eece 100644
--- 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
@@ -1,105 +1,105 @@
-/*
- * Copyright (c) 2004 - 2011 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.CDOPackageRegistry;
-import org.eclipse.emf.cdo.common.model.CDOPackageUnit;
-import org.eclipse.emf.cdo.common.model.CDOPackageUnit.State;
-
-import org.eclipse.net4j.util.lifecycle.ILifecycle;
-
-import org.eclipse.emf.ecore.EPackage;
-
-import java.util.Set;
-
-/**
- * @author Eike Stepper
- * @since 2.0
- * @noextend This interface is not intended to be extended by clients.
- * @noimplement This interface is not intended to be implemented by clients.
- */
-public interface InternalCDOPackageRegistry extends CDOPackageRegistry, ILifecycle
-{
- 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);
-
- /**
- * @since 4.0
- */
- public void putPackageUnits(InternalCDOPackageUnit[] packageUnits, State state);
-
- /**
- * @since 4.0
- */
- public InternalCDOPackageUnit createPackageUnit();
-
- /**
- * @since 3.0
- */
- public InternalCDOPackageUnit getPackageUnit(String id);
-
- public InternalCDOPackageUnit getPackageUnit(EPackage ePackage);
-
- public InternalCDOPackageUnit[] getPackageUnits();
-
- /**
- * @since 4.0
- */
- public InternalCDOPackageUnit[] getPackageUnits(boolean withSystemPackages);
-
- /**
- * @since 3.0
- */
- public InternalCDOPackageUnit[] getPackageUnits(long startTime, long endTime);
-
- public InternalCDOPackageInfo getPackageInfo(EPackage ePackage);
-
- public InternalCDOPackageInfo[] getPackageInfos();
-
- public EPackage[] getEPackages();
-
- /**
- * @since 3.0
- */
- public Set<String> getAllKeys();
-
- /**
- * @since 3.0
- */
- public Object getWithDelegation(String nsURI, boolean resolve);
-
- /**
- * @author Eike Stepper
- */
- public interface PackageProcessor
- {
- public Object processPackage(Object value);
- }
-
- /**
- * @author Eike Stepper
- */
- public interface PackageLoader
- {
- public EPackage[] loadPackages(CDOPackageUnit packageUnit);
- }
-}
+/*
+ * Copyright (c) 2004 - 2012 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.CDOPackageRegistry;
+import org.eclipse.emf.cdo.common.model.CDOPackageUnit;
+import org.eclipse.emf.cdo.common.model.CDOPackageUnit.State;
+
+import org.eclipse.net4j.util.lifecycle.ILifecycle;
+
+import org.eclipse.emf.ecore.EPackage;
+
+import java.util.Set;
+
+/**
+ * @author Eike Stepper
+ * @since 2.0
+ * @noextend This interface is not intended to be extended by clients.
+ * @noimplement This interface is not intended to be implemented by clients.
+ */
+public interface InternalCDOPackageRegistry extends CDOPackageRegistry, ILifecycle
+{
+ 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);
+
+ /**
+ * @since 4.0
+ */
+ public void putPackageUnits(InternalCDOPackageUnit[] packageUnits, State state);
+
+ /**
+ * @since 4.0
+ */
+ public InternalCDOPackageUnit createPackageUnit();
+
+ /**
+ * @since 3.0
+ */
+ public InternalCDOPackageUnit getPackageUnit(String id);
+
+ public InternalCDOPackageUnit getPackageUnit(EPackage ePackage);
+
+ public InternalCDOPackageUnit[] getPackageUnits();
+
+ /**
+ * @since 4.0
+ */
+ public InternalCDOPackageUnit[] getPackageUnits(boolean withSystemPackages);
+
+ /**
+ * @since 3.0
+ */
+ public InternalCDOPackageUnit[] getPackageUnits(long startTime, long endTime);
+
+ public InternalCDOPackageInfo getPackageInfo(EPackage ePackage);
+
+ public InternalCDOPackageInfo[] getPackageInfos();
+
+ public EPackage[] getEPackages();
+
+ /**
+ * @since 3.0
+ */
+ public Set<String> getAllKeys();
+
+ /**
+ * @since 3.0
+ */
+ public Object getWithDelegation(String nsURI, boolean resolve);
+
+ /**
+ * @author Eike Stepper
+ */
+ public interface PackageProcessor
+ {
+ public Object processPackage(Object value);
+ }
+
+ /**
+ * @author Eike Stepper
+ */
+ public interface PackageLoader
+ {
+ public EPackage[] loadPackages(CDOPackageUnit packageUnit);
+ }
+}
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
index a9d06db675..1232fc6a5a 100644
--- 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
@@ -1,72 +1,72 @@
-/*
- * Copyright (c) 2004 - 2011 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.CDOPackageUnit;
-import org.eclipse.emf.cdo.common.protocol.CDODataInput;
-import org.eclipse.emf.cdo.common.protocol.CDODataOutput;
-import org.eclipse.emf.cdo.spi.common.model.InternalCDOPackageRegistry.PackageLoader;
-
-import org.eclipse.emf.ecore.EPackage;
-import org.eclipse.emf.ecore.resource.ResourceSet;
-
-import java.io.IOException;
-
-/**
- * @author Eike Stepper
- * @since 2.0
- * @noextend This interface is not intended to be extended by clients.
- * @noimplement This interface is not intended to be implemented by clients.
- */
-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);
-
- /**
- * @since 4.0
- */
- public void load(boolean resolve);
-
- /**
- * @since 4.0
- */
- public void load(PackageLoader packageLoader, boolean resolve);
-
- /**
- * @since 3.0
- */
- public void write(CDODataOutput out, boolean withPackages) throws IOException;
-
- /**
- * @since 3.0
- */
- public void read(CDODataInput in, ResourceSet resourceSet) throws IOException;
-
- public void init(EPackage ePackage);
-
- public void dispose();
-}
+/*
+ * Copyright (c) 2004 - 2012 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.CDOPackageUnit;
+import org.eclipse.emf.cdo.common.protocol.CDODataInput;
+import org.eclipse.emf.cdo.common.protocol.CDODataOutput;
+import org.eclipse.emf.cdo.spi.common.model.InternalCDOPackageRegistry.PackageLoader;
+
+import org.eclipse.emf.ecore.EPackage;
+import org.eclipse.emf.ecore.resource.ResourceSet;
+
+import java.io.IOException;
+
+/**
+ * @author Eike Stepper
+ * @since 2.0
+ * @noextend This interface is not intended to be extended by clients.
+ * @noimplement This interface is not intended to be implemented by clients.
+ */
+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);
+
+ /**
+ * @since 4.0
+ */
+ public void load(boolean resolve);
+
+ /**
+ * @since 4.0
+ */
+ public void load(PackageLoader packageLoader, boolean resolve);
+
+ /**
+ * @since 3.0
+ */
+ public void write(CDODataOutput out, boolean withPackages) throws IOException;
+
+ /**
+ * @since 3.0
+ */
+ public void read(CDODataInput in, ResourceSet resourceSet) 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/model/package-info.java b/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/spi/common/model/package-info.java
index 43b09bf134..6508609913 100644
--- a/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/spi/common/model/package-info.java
+++ b/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/spi/common/model/package-info.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2004 - 2011 Eike Stepper (Berlin, Germany) and others.
+ * Copyright (c) 2004 - 2012 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
diff --git a/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/spi/common/package-info.java b/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/spi/common/package-info.java
index 7fc674a2bf..8494f69797 100644
--- a/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/spi/common/package-info.java
+++ b/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/spi/common/package-info.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2004 - 2011 Eike Stepper (Berlin, Germany) and others.
+ * Copyright (c) 2004 - 2012 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
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 0784e42d5b..751821d389 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
@@ -1,204 +1,204 @@
-/*
- * Copyright (c) 2004 - 2011 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 - bug 201266
- * Simon McDuff - bug 212958
- * Simon McDuff - bug 213402
- */
-package org.eclipse.emf.cdo.spi.common.revision;
-
-import org.eclipse.emf.cdo.common.branch.CDOBranch;
-import org.eclipse.emf.cdo.common.branch.CDOBranchPoint;
-import org.eclipse.emf.cdo.common.model.CDOClassInfo;
-import org.eclipse.emf.cdo.common.model.CDOModelUtil;
-import org.eclipse.emf.cdo.common.revision.CDORevision;
-import org.eclipse.emf.cdo.common.revision.CDORevisionData;
-import org.eclipse.emf.cdo.common.util.CDOCommonUtil;
-import org.eclipse.emf.cdo.internal.common.messages.Messages;
-
-import org.eclipse.net4j.util.ObjectUtil;
-
-import org.eclipse.emf.ecore.EClass;
-import org.eclipse.emf.ecore.EStructuralFeature;
-
-import java.text.MessageFormat;
-
-/**
- * @author Eike Stepper
- * @since 2.0
- */
-public abstract class AbstractCDORevision implements InternalCDORevision
-{
- private CDOClassInfo classInfo;
-
- /**
- * @since 3.0
- */
- protected AbstractCDORevision(EClass eClass)
- {
- if (eClass != null)
- {
- if (eClass.isAbstract())
- {
- throw new IllegalArgumentException(MessageFormat.format(Messages.getString("AbstractCDORevision.0"), eClass)); //$NON-NLS-1$
- }
-
- classInfo = CDOModelUtil.getClassInfo(eClass);
- }
- }
-
- /**
- * @since 3.0
- */
- public CDOClassInfo getClassInfo()
- {
- return classInfo;
- }
-
- public EClass getEClass()
- {
- CDOClassInfo classInfo = getClassInfo();
- if (classInfo != null)
- {
- return classInfo.getEClass();
- }
-
- return null;
- }
-
- public boolean isResourceNode()
- {
- return getClassInfo().isResourceNode();
- }
-
- public boolean isResourceFolder()
- {
- return getClassInfo().isResourceFolder();
- }
-
- public boolean isResource()
- {
- return getClassInfo().isResource();
- }
-
- public CDORevisionData data()
- {
- return this;
- }
-
- public CDORevision revision()
- {
- return this;
- }
-
- /**
- * @since 3.0
- */
- public boolean isHistorical()
- {
- return getRevised() != UNSPECIFIED_DATE;
- }
-
- public boolean isValid(long timeStamp)
- {
- long startTime = getTimeStamp();
- long endTime = getRevised();
- return CDOCommonUtil.isValidTimeStamp(timeStamp, startTime, endTime);
- }
-
- /**
- * @since 4.0
- */
- public boolean isValid(CDOBranchPoint branchPoint)
- {
- return getBranch() == branchPoint.getBranch() && isValid(branchPoint.getTimeStamp());
- }
-
- /**
- * @since 3.0
- */
- public void adjustForCommit(CDOBranch branch, long timeStamp)
- {
- if (ObjectUtil.equals(branch, getBranch()))
- {
- // Same branch, increase version
- setVersion(getVersion() + 1);
- }
- else
- {
- // Different branch, start with v1
- setVersion(FIRST_VERSION);
- }
-
- setBranchPoint(branch.getPoint(timeStamp));
- setRevised(UNSPECIFIED_DATE);
- }
-
- @Override
- public int hashCode()
- {
- return getID().hashCode() ^ getBranch().hashCode() ^ getVersion();
- }
-
- @Override
- public boolean equals(Object obj)
- {
- if (obj == this)
- {
- return true;
- }
-
- if (obj instanceof CDORevision)
- {
- CDORevision that = (CDORevision)obj;
- return getID().equals(that.getID()) && getBranch().equals(that.getBranch()) && getVersion() == that.getVersion();
- }
-
- return false;
- }
-
- @Override
- public String toString()
- {
- EClass eClass = getEClass();
- String name = eClass == null ? "Revision" : eClass.getName();
-
- CDOBranch branch = getBranch();
- if (branch == null)
- {
- return name + "@" + getID() + "v" + getVersion();
- }
-
- return name + "@" + getID() + ":" + branch.getID() + "v" + getVersion();
- }
-
- /**
- * @since 3.0
- */
- protected void setClassInfo(CDOClassInfo classInfo)
- {
- this.classInfo = classInfo;
- }
-
- /**
- * @since 3.0
- */
- protected EStructuralFeature[] getAllPersistentFeatures()
- {
- return classInfo.getAllPersistentFeatures();
- }
-
- /**
- * @since 3.0
- */
- protected int getFeatureIndex(EStructuralFeature feature)
- {
- return classInfo.getFeatureIndex(feature);
- }
-}
+/*
+ * Copyright (c) 2004 - 2012 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 - bug 201266
+ * Simon McDuff - bug 212958
+ * Simon McDuff - bug 213402
+ */
+package org.eclipse.emf.cdo.spi.common.revision;
+
+import org.eclipse.emf.cdo.common.branch.CDOBranch;
+import org.eclipse.emf.cdo.common.branch.CDOBranchPoint;
+import org.eclipse.emf.cdo.common.model.CDOClassInfo;
+import org.eclipse.emf.cdo.common.model.CDOModelUtil;
+import org.eclipse.emf.cdo.common.revision.CDORevision;
+import org.eclipse.emf.cdo.common.revision.CDORevisionData;
+import org.eclipse.emf.cdo.common.util.CDOCommonUtil;
+import org.eclipse.emf.cdo.internal.common.messages.Messages;
+
+import org.eclipse.net4j.util.ObjectUtil;
+
+import org.eclipse.emf.ecore.EClass;
+import org.eclipse.emf.ecore.EStructuralFeature;
+
+import java.text.MessageFormat;
+
+/**
+ * @author Eike Stepper
+ * @since 2.0
+ */
+public abstract class AbstractCDORevision implements InternalCDORevision
+{
+ private CDOClassInfo classInfo;
+
+ /**
+ * @since 3.0
+ */
+ protected AbstractCDORevision(EClass eClass)
+ {
+ if (eClass != null)
+ {
+ if (eClass.isAbstract())
+ {
+ throw new IllegalArgumentException(MessageFormat.format(Messages.getString("AbstractCDORevision.0"), eClass)); //$NON-NLS-1$
+ }
+
+ classInfo = CDOModelUtil.getClassInfo(eClass);
+ }
+ }
+
+ /**
+ * @since 3.0
+ */
+ public CDOClassInfo getClassInfo()
+ {
+ return classInfo;
+ }
+
+ public EClass getEClass()
+ {
+ CDOClassInfo classInfo = getClassInfo();
+ if (classInfo != null)
+ {
+ return classInfo.getEClass();
+ }
+
+ return null;
+ }
+
+ public boolean isResourceNode()
+ {
+ return getClassInfo().isResourceNode();
+ }
+
+ public boolean isResourceFolder()
+ {
+ return getClassInfo().isResourceFolder();
+ }
+
+ public boolean isResource()
+ {
+ return getClassInfo().isResource();
+ }
+
+ public CDORevisionData data()
+ {
+ return this;
+ }
+
+ public CDORevision revision()
+ {
+ return this;
+ }
+
+ /**
+ * @since 3.0
+ */
+ public boolean isHistorical()
+ {
+ return getRevised() != UNSPECIFIED_DATE;
+ }
+
+ public boolean isValid(long timeStamp)
+ {
+ long startTime = getTimeStamp();
+ long endTime = getRevised();
+ return CDOCommonUtil.isValidTimeStamp(timeStamp, startTime, endTime);
+ }
+
+ /**
+ * @since 4.0
+ */
+ public boolean isValid(CDOBranchPoint branchPoint)
+ {
+ return getBranch() == branchPoint.getBranch() && isValid(branchPoint.getTimeStamp());
+ }
+
+ /**
+ * @since 3.0
+ */
+ public void adjustForCommit(CDOBranch branch, long timeStamp)
+ {
+ if (ObjectUtil.equals(branch, getBranch()))
+ {
+ // Same branch, increase version
+ setVersion(getVersion() + 1);
+ }
+ else
+ {
+ // Different branch, start with v1
+ setVersion(FIRST_VERSION);
+ }
+
+ setBranchPoint(branch.getPoint(timeStamp));
+ setRevised(UNSPECIFIED_DATE);
+ }
+
+ @Override
+ public int hashCode()
+ {
+ return getID().hashCode() ^ getBranch().hashCode() ^ getVersion();
+ }
+
+ @Override
+ public boolean equals(Object obj)
+ {
+ if (obj == this)
+ {
+ return true;
+ }
+
+ if (obj instanceof CDORevision)
+ {
+ CDORevision that = (CDORevision)obj;
+ return getID().equals(that.getID()) && getBranch().equals(that.getBranch()) && getVersion() == that.getVersion();
+ }
+
+ return false;
+ }
+
+ @Override
+ public String toString()
+ {
+ EClass eClass = getEClass();
+ String name = eClass == null ? "Revision" : eClass.getName();
+
+ CDOBranch branch = getBranch();
+ if (branch == null)
+ {
+ return name + "@" + getID() + "v" + getVersion();
+ }
+
+ return name + "@" + getID() + ":" + branch.getID() + "v" + getVersion();
+ }
+
+ /**
+ * @since 3.0
+ */
+ protected void setClassInfo(CDOClassInfo classInfo)
+ {
+ this.classInfo = classInfo;
+ }
+
+ /**
+ * @since 3.0
+ */
+ protected EStructuralFeature[] getAllPersistentFeatures()
+ {
+ return classInfo.getAllPersistentFeatures();
+ }
+
+ /**
+ * @since 3.0
+ */
+ protected int getFeatureIndex(EStructuralFeature feature)
+ {
+ return classInfo.getFeatureIndex(feature);
+ }
+}
diff --git a/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/spi/common/revision/BaseCDORevision.java b/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/spi/common/revision/BaseCDORevision.java
index fad38ba764..9f86573039 100644
--- a/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/spi/common/revision/BaseCDORevision.java
+++ b/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/spi/common/revision/BaseCDORevision.java
@@ -1,775 +1,775 @@
-/*
- * Copyright (c) 2004 - 2011 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 - bug 201266
- * Simon McDuff - bug 212958
- * Simon McDuff - bug 213402
- */
-package org.eclipse.emf.cdo.spi.common.revision;
-
-import org.eclipse.emf.cdo.common.branch.CDOBranch;
-import org.eclipse.emf.cdo.common.branch.CDOBranchPoint;
-import org.eclipse.emf.cdo.common.id.CDOID;
-import org.eclipse.emf.cdo.common.id.CDOIDProvider;
-import org.eclipse.emf.cdo.common.id.CDOIDTemp;
-import org.eclipse.emf.cdo.common.id.CDOIDUtil;
-import org.eclipse.emf.cdo.common.model.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.protocol.CDODataInput;
-import org.eclipse.emf.cdo.common.protocol.CDODataOutput;
-import org.eclipse.emf.cdo.common.revision.CDOList;
-import org.eclipse.emf.cdo.common.revision.CDOListFactory;
-import org.eclipse.emf.cdo.common.revision.CDORevision;
-import org.eclipse.emf.cdo.common.revision.CDORevisionData;
-import org.eclipse.emf.cdo.common.revision.delta.CDOContainerFeatureDelta;
-import org.eclipse.emf.cdo.common.revision.delta.CDOFeatureDelta;
-import org.eclipse.emf.cdo.common.revision.delta.CDORevisionDelta;
-import org.eclipse.emf.cdo.common.util.CDOCommonUtil;
-import org.eclipse.emf.cdo.internal.common.bundle.OM;
-import org.eclipse.emf.cdo.internal.common.messages.Messages;
-import org.eclipse.emf.cdo.internal.common.revision.delta.CDORevisionDeltaImpl;
-import org.eclipse.emf.cdo.spi.common.branch.CDOBranchUtil;
-
-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.EClassifier;
-import org.eclipse.emf.ecore.EReference;
-import org.eclipse.emf.ecore.EStructuralFeature;
-import org.eclipse.emf.ecore.InternalEObject.EStore;
-import org.eclipse.emf.ecore.util.FeatureMap;
-import org.eclipse.emf.ecore.util.FeatureMap.Entry;
-import org.eclipse.emf.ecore.util.FeatureMapUtil;
-
-import java.io.IOException;
-import java.text.MessageFormat;
-import java.util.Map;
-
-/**
- * @author Eike Stepper
- * @since 3.0
- */
-public abstract class BaseCDORevision extends AbstractCDORevision
-{
- private static final ContextTracer TRACER = new ContextTracer(OM.DEBUG_REVISION, BaseCDORevision.class);
-
- private static final PerfTracer READING = new PerfTracer(OM.PERF_REVISION_READING, BaseCDORevision.class);
-
- private static final PerfTracer WRITING = new PerfTracer(OM.PERF_REVISION_WRITING, BaseCDORevision.class);
-
- private static final byte UNSET = 0;
-
- private static final byte SET_NULL = 1;
-
- private static final byte SET_NOT_NULL = 2;
-
- private CDOID id;
-
- private CDOBranchPoint branchPoint;
-
- private int version;
-
- private long revised;
-
- private CDOID resourceID;
-
- /**
- * On a client, between a local modification and the commit the value of this <i>ID</i> can be an EObject.
- */
- private Object containerID;
-
- private int containingFeatureID;
-
- /**
- * @since 3.0
- */
- public BaseCDORevision(EClass eClass)
- {
- super(eClass);
- if (eClass != null)
- {
- version = UNSPECIFIED_VERSION;
- revised = UNSPECIFIED_DATE;
- resourceID = CDOID.NULL;
- containerID = CDOID.NULL;
- containingFeatureID = 0;
- initValues(getAllPersistentFeatures());
- }
- }
-
- protected BaseCDORevision(BaseCDORevision source)
- {
- super(source.getEClass());
- id = source.id;
- branchPoint = source.branchPoint;
- version = source.version;
- revised = source.revised;
- resourceID = source.resourceID;
- containerID = source.containerID;
- containingFeatureID = source.containingFeatureID;
- }
-
- /**
- * @since 3.0
- */
- public void read(CDODataInput in) throws IOException
- {
- if (READING.isEnabled())
- {
- READING.start(this);
- }
-
- readSystemValues(in);
- readValues(in);
-
- if (READING.isEnabled())
- {
- READING.stop(this);
- }
- }
-
- /**
- * @since 4.0
- */
- protected void readSystemValues(CDODataInput in) throws IOException
- {
- EClassifier classifier = in.readCDOClassifierRefAndResolve();
- CDOClassInfo classInfo = CDOModelUtil.getClassInfo((EClass)classifier);
- setClassInfo(classInfo);
-
- id = in.readCDOID();
- branchPoint = in.readCDOBranchPoint();
- version = in.readInt();
- if (!id.isTemporary())
- {
- revised = in.readLong();
- }
-
- resourceID = in.readCDOID();
- containerID = in.readCDOID();
- containingFeatureID = in.readInt();
-
- if (TRACER.isEnabled())
- {
- TRACER
- .format(
- "Reading revision: ID={0}, className={1}, version={2}, branchPoint={3}, revised={4}, resource={5}, container={6}, featureID={7}", //$NON-NLS-1$
- id, getEClass().getName(), version, branchPoint, revised, resourceID, containerID, containingFeatureID);
- }
- }
-
- /**
- * @since 4.0
- */
- public void write(CDODataOutput out, int referenceChunk) throws IOException
- {
- if (WRITING.isEnabled())
- {
- WRITING.start(this);
- }
-
- writeSystemValues(out);
- writeValues(out, referenceChunk);
-
- if (WRITING.isEnabled())
- {
- WRITING.stop(this);
- }
- }
-
- /**
- * @since 4.0
- */
- protected void writeSystemValues(CDODataOutput out) throws IOException
- {
- EClass eClass = getEClass();
- CDOClassifierRef classRef = new CDOClassifierRef(eClass);
-
- if (TRACER.isEnabled())
- {
- TRACER
- .format(
- "Writing revision: ID={0}, className={1}, version={2}, branchPoint={3}, revised={4}, resource={5}, container={6}, featureID={7}", //$NON-NLS-1$
- id, eClass.getName(), getVersion(), branchPoint, revised, resourceID, containerID, containingFeatureID);
- }
-
- out.writeCDOClassifierRef(classRef);
- out.writeCDOID(id);
- out.writeCDOBranchPoint(branchPoint);
- out.writeInt(getVersion());
- if (!id.isTemporary())
- {
- out.writeLong(revised);
- }
-
- out.writeCDOID(resourceID);
- out.writeCDOID(out.getIDProvider().provideCDOID(containerID));
- out.writeInt(containingFeatureID);
- }
-
- /**
- * @see #write(CDODataOutput, int)
- * @since 3.0
- */
- public void convertEObjects(CDOIDProvider idProvider)
- {
- if (!(containerID instanceof CDOID))
- {
- containerID = idProvider.provideCDOID(containerID);
- }
-
- EStructuralFeature[] features = getAllPersistentFeatures();
- for (int i = 0; i < features.length; i++)
- {
- EStructuralFeature feature = features[i];
- if (feature.isMany())
- {
- CDOList list = getValueAsList(i);
- if (list != null)
- {
- boolean isFeatureMap = FeatureMapUtil.isFeatureMap(feature);
- for (int j = 0; j < list.size(); j++)
- {
- Object value = list.get(j, false);
- EStructuralFeature innerFeature = feature; // Prepare for possible feature map
- if (isFeatureMap)
- {
- Entry entry = (FeatureMap.Entry)value;
- innerFeature = entry.getEStructuralFeature();
- value = entry.getValue();
- }
-
- if (value != null && innerFeature instanceof EReference)
- {
- CDOID newValue = idProvider.provideCDOID(value);
- if (newValue != value)
- {
- list.set(j, newValue);
- }
- }
- }
- }
- }
- else
- {
- checkNoFeatureMap(feature);
- Object value = getValue(i);
- if (value != null && feature instanceof EReference)
- {
- CDOID newValue = idProvider.provideCDOID(value);
- if (newValue != value)
- {
- setValue(i, newValue);
- }
- }
- }
- }
- }
-
- public CDOID getID()
- {
- return id;
- }
-
- public void setID(CDOID id)
- {
- if (CDOIDUtil.isNull(id))
- {
- throw new IllegalArgumentException(Messages.getString("AbstractCDORevision.1")); //$NON-NLS-1$
- }
-
- if (TRACER.isEnabled())
- {
- TRACER.format("Setting ID: {0}", id);
- }
-
- this.id = id;
- }
-
- /**
- * @since 3.0
- */
- public CDOBranch getBranch()
- {
- if (branchPoint == null)
- {
- return null;
- }
-
- return branchPoint.getBranch();
- }
-
- /**
- * @since 3.0
- */
- public long getTimeStamp()
- {
- if (branchPoint == null)
- {
- return UNSPECIFIED_DATE;
- }
-
- return branchPoint.getTimeStamp();
- }
-
- /**
- * @since 3.0
- */
- public void setBranchPoint(CDOBranchPoint branchPoint)
- {
- branchPoint = CDOBranchUtil.copyBranchPoint(branchPoint);
- if (TRACER.isEnabled())
- {
- TRACER.format("Setting branchPoint {0}: {1}", this, branchPoint);
- }
-
- this.branchPoint = branchPoint;
- }
-
- public int getVersion()
- {
- return version;
- }
-
- public void setVersion(int version)
- {
- if (TRACER.isEnabled())
- {
- TRACER.format("Setting version for {0}: v{1}", this, version);
- }
-
- this.version = version;
- }
-
- public long getRevised()
- {
- return revised;
- }
-
- public void setRevised(long revised)
- {
- long created = branchPoint.getTimeStamp();
- if (revised != UNSPECIFIED_DATE && revised < Math.max(0, created))
- {
- throw new IllegalArgumentException("revision=" + this + ", created=" + CDOCommonUtil.formatTimeStamp(created)
- + ", revised=" + CDOCommonUtil.formatTimeStamp(revised));
- }
-
- if (TRACER.isEnabled())
- {
- TRACER.format("Setting revised {0}: {1}", this, CDOCommonUtil.formatTimeStamp(revised));
- }
-
- this.revised = revised;
- }
-
- public InternalCDORevisionDelta compare(CDORevision origin)
- {
- return new CDORevisionDeltaImpl(origin, this);
- }
-
- public void merge(CDORevisionDelta delta)
- {
- CDORevisionMerger applier = new CDORevisionMerger();
- applier.merge(this, delta);
- }
-
- public CDOID getResourceID()
- {
- return resourceID;
- }
-
- public void setResourceID(CDOID resourceID)
- {
- if (TRACER.isEnabled())
- {
- TRACER.format("Setting resourceID {0}: {1}", this, resourceID);
- }
-
- this.resourceID = resourceID;
- }
-
- public Object getContainerID()
- {
- return containerID;
- }
-
- public void setContainerID(Object containerID)
- {
- if (TRACER.isEnabled())
- {
- TRACER.format("Setting containerID {0}: {1}", this, containerID);
- }
-
- this.containerID = containerID;
- }
-
- public int getContainingFeatureID()
- {
- return containingFeatureID;
- }
-
- public void setContainingFeatureID(int containingFeatureID)
- {
- if (TRACER.isEnabled())
- {
- TRACER.format("Setting containingFeatureID {0}: {1}", this, containingFeatureID);
- }
-
- this.containingFeatureID = containingFeatureID;
- }
-
- public int hashCode(EStructuralFeature feature)
- {
- return getValue(feature).hashCode();
- }
-
- public Object get(EStructuralFeature feature, int index)
- {
- if (feature.isMany() && index != EStore.NO_INDEX)
- {
- CDOList list = getList(feature);
- return list.get(index);
- }
-
- return getValue(feature);
- }
-
- public boolean contains(EStructuralFeature feature, Object value)
- {
- CDOList list = getList(feature);
- return list.contains(value);
- }
-
- public int indexOf(EStructuralFeature feature, Object value)
- {
- CDOList list = getList(feature);
- return list.indexOf(value);
- }
-
- public int lastIndexOf(EStructuralFeature feature, Object value)
- {
- CDOList list = getList(feature);
- return list.lastIndexOf(value);
- }
-
- public boolean isEmpty(EStructuralFeature feature)
- {
- CDOList list = getList(feature);
- return list.isEmpty();
- }
-
- public int size(EStructuralFeature feature)
- {
- CDOList list = getList(feature);
- return list.size();
- }
-
- public Object[] toArray(EStructuralFeature feature)
- {
- if (!feature.isMany())
- {
- throw new IllegalStateException("!feature.isMany()");
- }
-
- CDOList list = getList(feature);
- return list.toArray();
- }
-
- public <T> T[] toArray(EStructuralFeature feature, T[] array)
- {
- if (!feature.isMany())
- {
- throw new IllegalStateException("!feature.isMany()");
- }
-
- CDOList list = getList(feature);
- return list.toArray(array);
- }
-
- public void add(EStructuralFeature feature, int index, Object value)
- {
- CDOList list = getList(feature);
- list.add(index, value);
- }
-
- public void clear(EStructuralFeature feature)
- {
- setValue(feature, null);
- }
-
- public Object move(EStructuralFeature feature, int targetIndex, int sourceIndex)
- {
- CDOList list = getList(feature);
- return list.move(targetIndex, sourceIndex);
- }
-
- public Object remove(EStructuralFeature feature, int index)
- {
- CDOList list = getList(feature);
- return list.remove(index);
- }
-
- public Object set(EStructuralFeature feature, int index, Object value)
- {
- if (feature.isMany())
- {
- CDOList list = getList(feature);
- return list.set(index, value);
- }
-
- return setValue(feature, value);
- }
-
- public void unset(EStructuralFeature feature)
- {
- setValue(feature, null);
- }
-
- /**
- * @since 4.0
- */
- public boolean adjustReferences(CDOReferenceAdjuster referenceAdjuster)
- {
- if (TRACER.isEnabled())
- {
- TRACER.format("Adjusting references for revision {0}", this);
- }
-
- boolean changed = false;
-
- CDOID id1 = (CDOID)referenceAdjuster.adjustReference(resourceID, CDOContainerFeatureDelta.CONTAINER_FEATURE,
- CDOFeatureDelta.NO_INDEX);
- if (id1 != resourceID)
- {
- resourceID = id1;
- changed = true;
- }
-
- Object id2 = referenceAdjuster.adjustReference(containerID, CDOContainerFeatureDelta.CONTAINER_FEATURE,
- CDOFeatureDelta.NO_INDEX);
- if (id2 != containerID)
- {
- containerID = id2;
- changed = true;
- }
-
- EStructuralFeature[] features = getAllPersistentFeatures();
- for (int i = 0; i < features.length; i++)
- {
- EStructuralFeature feature = features[i];
- if (feature instanceof EReference || FeatureMapUtil.isFeatureMap(feature))
- {
- if (feature.isMany())
- {
- InternalCDOList list = (InternalCDOList)getValueAsList(i);
- if (list != null)
- {
- changed |= list.adjustReferences(referenceAdjuster, feature);
- }
- }
- else
- {
- CDOType type = CDOModelUtil.getType(feature);
- Object oldValue = getValue(i);
- Object newValue = type.adjustReferences(referenceAdjuster, oldValue, feature, CDOFeatureDelta.NO_INDEX);
- if (oldValue != newValue) // Just an optimization for NOOP adjusters
- {
- setValue(i, newValue);
- changed = true;
- }
- }
- }
- }
-
- return changed;
- }
-
- public Object getValue(EStructuralFeature feature)
- {
- int featureIndex = getFeatureIndex(feature);
- return getValue(featureIndex);
- }
-
- public Object setValue(EStructuralFeature feature, Object value)
- {
- int featureIndex = getFeatureIndex(feature);
-
- try
- {
- Object old = getValue(featureIndex);
- setValue(featureIndex, value);
- return old;
- }
- catch (ArrayIndexOutOfBoundsException ex)
- {
- throw new IllegalArgumentException(MessageFormat.format(Messages.getString("AbstractCDORevision.20"), feature,
- getClassInfo()), ex);
- }
- }
-
- public CDOList getList(EStructuralFeature feature)
- {
- return getList(feature, 0);
- }
-
- public CDOList getList(EStructuralFeature feature, int size)
- {
- int featureIndex = getFeatureIndex(feature);
- CDOList list = (CDOList)getValue(featureIndex);
- if (list == null && size != -1)
- {
- list = CDOListFactory.DEFAULT.createList(size, 0, 0);
- setValue(featureIndex, list);
- }
-
- return list;
- }
-
- public void setList(EStructuralFeature feature, InternalCDOList list)
- {
- int featureIndex = getFeatureIndex(feature);
- setValue(featureIndex, list);
- }
-
- protected abstract void initValues(EStructuralFeature[] allPersistentFeatures);
-
- protected abstract Object getValue(int featureIndex);
-
- protected abstract void setValue(int featureIndex, Object value);
-
- private CDOList getValueAsList(int i)
- {
- return (CDOList)getValue(i);
- }
-
- private void writeValues(CDODataOutput out, int referenceChunk) throws IOException
- {
- EClass owner = getEClass();
- EStructuralFeature[] features = getAllPersistentFeatures();
- for (int i = 0; i < features.length; i++)
- {
- EStructuralFeature feature = features[i];
- Object value = getValue(i);
- if (value == null)
- {
- // Feature is NOT set
- out.writeByte(UNSET);
- continue;
- }
-
- // Feature IS set
- if (value == CDORevisionData.NIL)
- {
- // Feature IS null
- out.writeByte(SET_NULL);
- continue;
- }
-
- // Feature is NOT null
- out.writeByte(SET_NOT_NULL);
- if (feature.isMany())
- {
- CDOList list = (CDOList)value;
- out.writeCDOList(owner, feature, list, referenceChunk);
- }
- else
- {
- checkNoFeatureMap(feature);
- if (feature instanceof EReference)
- {
- value = out.getIDProvider().provideCDOID(value);
- }
-
- if (TRACER.isEnabled())
- {
- TRACER.format("Writing feature {0}: {1}", feature.getName(), value);
- }
-
- out.writeCDOFeatureValue(feature, value);
- }
- }
- }
-
- private void readValues(CDODataInput in) throws IOException
- {
- EClass owner = getEClass();
- EStructuralFeature[] features = getAllPersistentFeatures();
- initValues(features);
- for (int i = 0; i < features.length; i++)
- {
- Object value;
- EStructuralFeature feature = features[i];
- byte unsetState = in.readByte();
- switch (unsetState)
- {
- case UNSET:
- continue;
-
- case SET_NULL:
- setValue(i, CDORevisionData.NIL);
- continue;
- }
-
- if (feature.isMany())
- {
- value = in.readCDOList(owner, feature);
- }
- else
- {
- value = in.readCDOFeatureValue(feature);
- if (TRACER.isEnabled())
- {
- TRACER.format("Read feature {0}: {1}", feature.getName(), value);
- }
- }
-
- setValue(i, value);
- }
- }
-
- public static void checkNoFeatureMap(EStructuralFeature feature)
- {
- if (FeatureMapUtil.isFeatureMap(feature))
- {
- throw new UnsupportedOperationException("Single-valued feature maps not yet handled");
- }
- }
-
- public static Object remapID(Object value, Map<CDOID, CDOID> idMappings, boolean allowUnmappedTempIDs)
- {
- if (value instanceof CDOID)
- {
- CDOID oldID = (CDOID)value;
- if (!oldID.isNull())
- {
- CDOID newID = idMappings.get(oldID);
- if (newID != null)
- {
- if (TRACER.isEnabled())
- {
- TRACER.format("Adjusting ID: {0} --> {1}", oldID, newID);
- }
-
- return newID;
- }
-
- if (oldID instanceof CDOIDTemp)
- {
- throw new IllegalStateException(MessageFormat.format(Messages.getString("AbstractCDORevision.2"), oldID));
- }
- }
- }
-
- return value;
- }
-}
+/*
+ * Copyright (c) 2004 - 2012 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 - bug 201266
+ * Simon McDuff - bug 212958
+ * Simon McDuff - bug 213402
+ */
+package org.eclipse.emf.cdo.spi.common.revision;
+
+import org.eclipse.emf.cdo.common.branch.CDOBranch;
+import org.eclipse.emf.cdo.common.branch.CDOBranchPoint;
+import org.eclipse.emf.cdo.common.id.CDOID;
+import org.eclipse.emf.cdo.common.id.CDOIDProvider;
+import org.eclipse.emf.cdo.common.id.CDOIDTemp;
+import org.eclipse.emf.cdo.common.id.CDOIDUtil;
+import org.eclipse.emf.cdo.common.model.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.protocol.CDODataInput;
+import org.eclipse.emf.cdo.common.protocol.CDODataOutput;
+import org.eclipse.emf.cdo.common.revision.CDOList;
+import org.eclipse.emf.cdo.common.revision.CDOListFactory;
+import org.eclipse.emf.cdo.common.revision.CDORevision;
+import org.eclipse.emf.cdo.common.revision.CDORevisionData;
+import org.eclipse.emf.cdo.common.revision.delta.CDOContainerFeatureDelta;
+import org.eclipse.emf.cdo.common.revision.delta.CDOFeatureDelta;
+import org.eclipse.emf.cdo.common.revision.delta.CDORevisionDelta;
+import org.eclipse.emf.cdo.common.util.CDOCommonUtil;
+import org.eclipse.emf.cdo.internal.common.bundle.OM;
+import org.eclipse.emf.cdo.internal.common.messages.Messages;
+import org.eclipse.emf.cdo.internal.common.revision.delta.CDORevisionDeltaImpl;
+import org.eclipse.emf.cdo.spi.common.branch.CDOBranchUtil;
+
+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.EClassifier;
+import org.eclipse.emf.ecore.EReference;
+import org.eclipse.emf.ecore.EStructuralFeature;
+import org.eclipse.emf.ecore.InternalEObject.EStore;
+import org.eclipse.emf.ecore.util.FeatureMap;
+import org.eclipse.emf.ecore.util.FeatureMap.Entry;
+import org.eclipse.emf.ecore.util.FeatureMapUtil;
+
+import java.io.IOException;
+import java.text.MessageFormat;
+import java.util.Map;
+
+/**
+ * @author Eike Stepper
+ * @since 3.0
+ */
+public abstract class BaseCDORevision extends AbstractCDORevision
+{
+ private static final ContextTracer TRACER = new ContextTracer(OM.DEBUG_REVISION, BaseCDORevision.class);
+
+ private static final PerfTracer READING = new PerfTracer(OM.PERF_REVISION_READING, BaseCDORevision.class);
+
+ private static final PerfTracer WRITING = new PerfTracer(OM.PERF_REVISION_WRITING, BaseCDORevision.class);
+
+ private static final byte UNSET = 0;
+
+ private static final byte SET_NULL = 1;
+
+ private static final byte SET_NOT_NULL = 2;
+
+ private CDOID id;
+
+ private CDOBranchPoint branchPoint;
+
+ private int version;
+
+ private long revised;
+
+ private CDOID resourceID;
+
+ /**
+ * On a client, between a local modification and the commit the value of this <i>ID</i> can be an EObject.
+ */
+ private Object containerID;
+
+ private int containingFeatureID;
+
+ /**
+ * @since 3.0
+ */
+ public BaseCDORevision(EClass eClass)
+ {
+ super(eClass);
+ if (eClass != null)
+ {
+ version = UNSPECIFIED_VERSION;
+ revised = UNSPECIFIED_DATE;
+ resourceID = CDOID.NULL;
+ containerID = CDOID.NULL;
+ containingFeatureID = 0;
+ initValues(getAllPersistentFeatures());
+ }
+ }
+
+ protected BaseCDORevision(BaseCDORevision source)
+ {
+ super(source.getEClass());
+ id = source.id;
+ branchPoint = source.branchPoint;
+ version = source.version;
+ revised = source.revised;
+ resourceID = source.resourceID;
+ containerID = source.containerID;
+ containingFeatureID = source.containingFeatureID;
+ }
+
+ /**
+ * @since 3.0
+ */
+ public void read(CDODataInput in) throws IOException
+ {
+ if (READING.isEnabled())
+ {
+ READING.start(this);
+ }
+
+ readSystemValues(in);
+ readValues(in);
+
+ if (READING.isEnabled())
+ {
+ READING.stop(this);
+ }
+ }
+
+ /**
+ * @since 4.0
+ */
+ protected void readSystemValues(CDODataInput in) throws IOException
+ {
+ EClassifier classifier = in.readCDOClassifierRefAndResolve();
+ CDOClassInfo classInfo = CDOModelUtil.getClassInfo((EClass)classifier);
+ setClassInfo(classInfo);
+
+ id = in.readCDOID();
+ branchPoint = in.readCDOBranchPoint();
+ version = in.readInt();
+ if (!id.isTemporary())
+ {
+ revised = in.readLong();
+ }
+
+ resourceID = in.readCDOID();
+ containerID = in.readCDOID();
+ containingFeatureID = in.readInt();
+
+ if (TRACER.isEnabled())
+ {
+ TRACER
+ .format(
+ "Reading revision: ID={0}, className={1}, version={2}, branchPoint={3}, revised={4}, resource={5}, container={6}, featureID={7}", //$NON-NLS-1$
+ id, getEClass().getName(), version, branchPoint, revised, resourceID, containerID, containingFeatureID);
+ }
+ }
+
+ /**
+ * @since 4.0
+ */
+ public void write(CDODataOutput out, int referenceChunk) throws IOException
+ {
+ if (WRITING.isEnabled())
+ {
+ WRITING.start(this);
+ }
+
+ writeSystemValues(out);
+ writeValues(out, referenceChunk);
+
+ if (WRITING.isEnabled())
+ {
+ WRITING.stop(this);
+ }
+ }
+
+ /**
+ * @since 4.0
+ */
+ protected void writeSystemValues(CDODataOutput out) throws IOException
+ {
+ EClass eClass = getEClass();
+ CDOClassifierRef classRef = new CDOClassifierRef(eClass);
+
+ if (TRACER.isEnabled())
+ {
+ TRACER
+ .format(
+ "Writing revision: ID={0}, className={1}, version={2}, branchPoint={3}, revised={4}, resource={5}, container={6}, featureID={7}", //$NON-NLS-1$
+ id, eClass.getName(), getVersion(), branchPoint, revised, resourceID, containerID, containingFeatureID);
+ }
+
+ out.writeCDOClassifierRef(classRef);
+ out.writeCDOID(id);
+ out.writeCDOBranchPoint(branchPoint);
+ out.writeInt(getVersion());
+ if (!id.isTemporary())
+ {
+ out.writeLong(revised);
+ }
+
+ out.writeCDOID(resourceID);
+ out.writeCDOID(out.getIDProvider().provideCDOID(containerID));
+ out.writeInt(containingFeatureID);
+ }
+
+ /**
+ * @see #write(CDODataOutput, int)
+ * @since 3.0
+ */
+ public void convertEObjects(CDOIDProvider idProvider)
+ {
+ if (!(containerID instanceof CDOID))
+ {
+ containerID = idProvider.provideCDOID(containerID);
+ }
+
+ EStructuralFeature[] features = getAllPersistentFeatures();
+ for (int i = 0; i < features.length; i++)
+ {
+ EStructuralFeature feature = features[i];
+ if (feature.isMany())
+ {
+ CDOList list = getValueAsList(i);
+ if (list != null)
+ {
+ boolean isFeatureMap = FeatureMapUtil.isFeatureMap(feature);
+ for (int j = 0; j < list.size(); j++)
+ {
+ Object value = list.get(j, false);
+ EStructuralFeature innerFeature = feature; // Prepare for possible feature map
+ if (isFeatureMap)
+ {
+ Entry entry = (FeatureMap.Entry)value;
+ innerFeature = entry.getEStructuralFeature();
+ value = entry.getValue();
+ }
+
+ if (value != null && innerFeature instanceof EReference)
+ {
+ CDOID newValue = idProvider.provideCDOID(value);
+ if (newValue != value)
+ {
+ list.set(j, newValue);
+ }
+ }
+ }
+ }
+ }
+ else
+ {
+ checkNoFeatureMap(feature);
+ Object value = getValue(i);
+ if (value != null && feature instanceof EReference)
+ {
+ CDOID newValue = idProvider.provideCDOID(value);
+ if (newValue != value)
+ {
+ setValue(i, newValue);
+ }
+ }
+ }
+ }
+ }
+
+ public CDOID getID()
+ {
+ return id;
+ }
+
+ public void setID(CDOID id)
+ {
+ if (CDOIDUtil.isNull(id))
+ {
+ throw new IllegalArgumentException(Messages.getString("AbstractCDORevision.1")); //$NON-NLS-1$
+ }
+
+ if (TRACER.isEnabled())
+ {
+ TRACER.format("Setting ID: {0}", id);
+ }
+
+ this.id = id;
+ }
+
+ /**
+ * @since 3.0
+ */
+ public CDOBranch getBranch()
+ {
+ if (branchPoint == null)
+ {
+ return null;
+ }
+
+ return branchPoint.getBranch();
+ }
+
+ /**
+ * @since 3.0
+ */
+ public long getTimeStamp()
+ {
+ if (branchPoint == null)
+ {
+ return UNSPECIFIED_DATE;
+ }
+
+ return branchPoint.getTimeStamp();
+ }
+
+ /**
+ * @since 3.0
+ */
+ public void setBranchPoint(CDOBranchPoint branchPoint)
+ {
+ branchPoint = CDOBranchUtil.copyBranchPoint(branchPoint);
+ if (TRACER.isEnabled())
+ {
+ TRACER.format("Setting branchPoint {0}: {1}", this, branchPoint);
+ }
+
+ this.branchPoint = branchPoint;
+ }
+
+ public int getVersion()
+ {
+ return version;
+ }
+
+ public void setVersion(int version)
+ {
+ if (TRACER.isEnabled())
+ {
+ TRACER.format("Setting version for {0}: v{1}", this, version);
+ }
+
+ this.version = version;
+ }
+
+ public long getRevised()
+ {
+ return revised;
+ }
+
+ public void setRevised(long revised)
+ {
+ long created = branchPoint.getTimeStamp();
+ if (revised != UNSPECIFIED_DATE && revised < Math.max(0, created))
+ {
+ throw new IllegalArgumentException("revision=" + this + ", created=" + CDOCommonUtil.formatTimeStamp(created)
+ + ", revised=" + CDOCommonUtil.formatTimeStamp(revised));
+ }
+
+ if (TRACER.isEnabled())
+ {
+ TRACER.format("Setting revised {0}: {1}", this, CDOCommonUtil.formatTimeStamp(revised));
+ }
+
+ this.revised = revised;
+ }
+
+ public InternalCDORevisionDelta compare(CDORevision origin)
+ {
+ return new CDORevisionDeltaImpl(origin, this);
+ }
+
+ public void merge(CDORevisionDelta delta)
+ {
+ CDORevisionMerger applier = new CDORevisionMerger();
+ applier.merge(this, delta);
+ }
+
+ public CDOID getResourceID()
+ {
+ return resourceID;
+ }
+
+ public void setResourceID(CDOID resourceID)
+ {
+ if (TRACER.isEnabled())
+ {
+ TRACER.format("Setting resourceID {0}: {1}", this, resourceID);
+ }
+
+ this.resourceID = resourceID;
+ }
+
+ public Object getContainerID()
+ {
+ return containerID;
+ }
+
+ public void setContainerID(Object containerID)
+ {
+ if (TRACER.isEnabled())
+ {
+ TRACER.format("Setting containerID {0}: {1}", this, containerID);
+ }
+
+ this.containerID = containerID;
+ }
+
+ public int getContainingFeatureID()
+ {
+ return containingFeatureID;
+ }
+
+ public void setContainingFeatureID(int containingFeatureID)
+ {
+ if (TRACER.isEnabled())
+ {
+ TRACER.format("Setting containingFeatureID {0}: {1}", this, containingFeatureID);
+ }
+
+ this.containingFeatureID = containingFeatureID;
+ }
+
+ public int hashCode(EStructuralFeature feature)
+ {
+ return getValue(feature).hashCode();
+ }
+
+ public Object get(EStructuralFeature feature, int index)
+ {
+ if (feature.isMany() && index != EStore.NO_INDEX)
+ {
+ CDOList list = getList(feature);
+ return list.get(index);
+ }
+
+ return getValue(feature);
+ }
+
+ public boolean contains(EStructuralFeature feature, Object value)
+ {
+ CDOList list = getList(feature);
+ return list.contains(value);
+ }
+
+ public int indexOf(EStructuralFeature feature, Object value)
+ {
+ CDOList list = getList(feature);
+ return list.indexOf(value);
+ }
+
+ public int lastIndexOf(EStructuralFeature feature, Object value)
+ {
+ CDOList list = getList(feature);
+ return list.lastIndexOf(value);
+ }
+
+ public boolean isEmpty(EStructuralFeature feature)
+ {
+ CDOList list = getList(feature);
+ return list.isEmpty();
+ }
+
+ public int size(EStructuralFeature feature)
+ {
+ CDOList list = getList(feature);
+ return list.size();
+ }
+
+ public Object[] toArray(EStructuralFeature feature)
+ {
+ if (!feature.isMany())
+ {
+ throw new IllegalStateException("!feature.isMany()");
+ }
+
+ CDOList list = getList(feature);
+ return list.toArray();
+ }
+
+ public <T> T[] toArray(EStructuralFeature feature, T[] array)
+ {
+ if (!feature.isMany())
+ {
+ throw new IllegalStateException("!feature.isMany()");
+ }
+
+ CDOList list = getList(feature);
+ return list.toArray(array);
+ }
+
+ public void add(EStructuralFeature feature, int index, Object value)
+ {
+ CDOList list = getList(feature);
+ list.add(index, value);
+ }
+
+ public void clear(EStructuralFeature feature)
+ {
+ setValue(feature, null);
+ }
+
+ public Object move(EStructuralFeature feature, int targetIndex, int sourceIndex)
+ {
+ CDOList list = getList(feature);
+ return list.move(targetIndex, sourceIndex);
+ }
+
+ public Object remove(EStructuralFeature feature, int index)
+ {
+ CDOList list = getList(feature);
+ return list.remove(index);
+ }
+
+ public Object set(EStructuralFeature feature, int index, Object value)
+ {
+ if (feature.isMany())
+ {
+ CDOList list = getList(feature);
+ return list.set(index, value);
+ }
+
+ return setValue(feature, value);
+ }
+
+ public void unset(EStructuralFeature feature)
+ {
+ setValue(feature, null);
+ }
+
+ /**
+ * @since 4.0
+ */
+ public boolean adjustReferences(CDOReferenceAdjuster referenceAdjuster)
+ {
+ if (TRACER.isEnabled())
+ {
+ TRACER.format("Adjusting references for revision {0}", this);
+ }
+
+ boolean changed = false;
+
+ CDOID id1 = (CDOID)referenceAdjuster.adjustReference(resourceID, CDOContainerFeatureDelta.CONTAINER_FEATURE,
+ CDOFeatureDelta.NO_INDEX);
+ if (id1 != resourceID)
+ {
+ resourceID = id1;
+ changed = true;
+ }
+
+ Object id2 = referenceAdjuster.adjustReference(containerID, CDOContainerFeatureDelta.CONTAINER_FEATURE,
+ CDOFeatureDelta.NO_INDEX);
+ if (id2 != containerID)
+ {
+ containerID = id2;
+ changed = true;
+ }
+
+ EStructuralFeature[] features = getAllPersistentFeatures();
+ for (int i = 0; i < features.length; i++)
+ {
+ EStructuralFeature feature = features[i];
+ if (feature instanceof EReference || FeatureMapUtil.isFeatureMap(feature))
+ {
+ if (feature.isMany())
+ {
+ InternalCDOList list = (InternalCDOList)getValueAsList(i);
+ if (list != null)
+ {
+ changed |= list.adjustReferences(referenceAdjuster, feature);
+ }
+ }
+ else
+ {
+ CDOType type = CDOModelUtil.getType(feature);
+ Object oldValue = getValue(i);
+ Object newValue = type.adjustReferences(referenceAdjuster, oldValue, feature, CDOFeatureDelta.NO_INDEX);
+ if (oldValue != newValue) // Just an optimization for NOOP adjusters
+ {
+ setValue(i, newValue);
+ changed = true;
+ }
+ }
+ }
+ }
+
+ return changed;
+ }
+
+ public Object getValue(EStructuralFeature feature)
+ {
+ int featureIndex = getFeatureIndex(feature);
+ return getValue(featureIndex);
+ }
+
+ public Object setValue(EStructuralFeature feature, Object value)
+ {
+ int featureIndex = getFeatureIndex(feature);
+
+ try
+ {
+ Object old = getValue(featureIndex);
+ setValue(featureIndex, value);
+ return old;
+ }
+ catch (ArrayIndexOutOfBoundsException ex)
+ {
+ throw new IllegalArgumentException(MessageFormat.format(Messages.getString("AbstractCDORevision.20"), feature,
+ getClassInfo()), ex);
+ }
+ }
+
+ public CDOList getList(EStructuralFeature feature)
+ {
+ return getList(feature, 0);
+ }
+
+ public CDOList getList(EStructuralFeature feature, int size)
+ {
+ int featureIndex = getFeatureIndex(feature);
+ CDOList list = (CDOList)getValue(featureIndex);
+ if (list == null && size != -1)
+ {
+ list = CDOListFactory.DEFAULT.createList(size, 0, 0);
+ setValue(featureIndex, list);
+ }
+
+ return list;
+ }
+
+ public void setList(EStructuralFeature feature, InternalCDOList list)
+ {
+ int featureIndex = getFeatureIndex(feature);
+ setValue(featureIndex, list);
+ }
+
+ protected abstract void initValues(EStructuralFeature[] allPersistentFeatures);
+
+ protected abstract Object getValue(int featureIndex);
+
+ protected abstract void setValue(int featureIndex, Object value);
+
+ private CDOList getValueAsList(int i)
+ {
+ return (CDOList)getValue(i);
+ }
+
+ private void writeValues(CDODataOutput out, int referenceChunk) throws IOException
+ {
+ EClass owner = getEClass();
+ EStructuralFeature[] features = getAllPersistentFeatures();
+ for (int i = 0; i < features.length; i++)
+ {
+ EStructuralFeature feature = features[i];
+ Object value = getValue(i);
+ if (value == null)
+ {
+ // Feature is NOT set
+ out.writeByte(UNSET);
+ continue;
+ }
+
+ // Feature IS set
+ if (value == CDORevisionData.NIL)
+ {
+ // Feature IS null
+ out.writeByte(SET_NULL);
+ continue;
+ }
+
+ // Feature is NOT null
+ out.writeByte(SET_NOT_NULL);
+ if (feature.isMany())
+ {
+ CDOList list = (CDOList)value;
+ out.writeCDOList(owner, feature, list, referenceChunk);
+ }
+ else
+ {
+ checkNoFeatureMap(feature);
+ if (feature instanceof EReference)
+ {
+ value = out.getIDProvider().provideCDOID(value);
+ }
+
+ if (TRACER.isEnabled())
+ {
+ TRACER.format("Writing feature {0}: {1}", feature.getName(), value);
+ }
+
+ out.writeCDOFeatureValue(feature, value);
+ }
+ }
+ }
+
+ private void readValues(CDODataInput in) throws IOException
+ {
+ EClass owner = getEClass();
+ EStructuralFeature[] features = getAllPersistentFeatures();
+ initValues(features);
+ for (int i = 0; i < features.length; i++)
+ {
+ Object value;
+ EStructuralFeature feature = features[i];
+ byte unsetState = in.readByte();
+ switch (unsetState)
+ {
+ case UNSET:
+ continue;
+
+ case SET_NULL:
+ setValue(i, CDORevisionData.NIL);
+ continue;
+ }
+
+ if (feature.isMany())
+ {
+ value = in.readCDOList(owner, feature);
+ }
+ else
+ {
+ value = in.readCDOFeatureValue(feature);
+ if (TRACER.isEnabled())
+ {
+ TRACER.format("Read feature {0}: {1}", feature.getName(), value);
+ }
+ }
+
+ setValue(i, value);
+ }
+ }
+
+ public static void checkNoFeatureMap(EStructuralFeature feature)
+ {
+ if (FeatureMapUtil.isFeatureMap(feature))
+ {
+ throw new UnsupportedOperationException("Single-valued feature maps not yet handled");
+ }
+ }
+
+ public static Object remapID(Object value, Map<CDOID, CDOID> idMappings, boolean allowUnmappedTempIDs)
+ {
+ if (value instanceof CDOID)
+ {
+ CDOID oldID = (CDOID)value;
+ if (!oldID.isNull())
+ {
+ CDOID newID = idMappings.get(oldID);
+ if (newID != null)
+ {
+ if (TRACER.isEnabled())
+ {
+ TRACER.format("Adjusting ID: {0} --> {1}", oldID, newID);
+ }
+
+ return newID;
+ }
+
+ if (oldID instanceof CDOIDTemp)
+ {
+ throw new IllegalStateException(MessageFormat.format(Messages.getString("AbstractCDORevision.2"), oldID));
+ }
+ }
+ }
+
+ return value;
+ }
+}
diff --git a/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/spi/common/revision/CDOFeatureDeltaVisitorImpl.java b/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/spi/common/revision/CDOFeatureDeltaVisitorImpl.java
index 0b3e989ce3..e1e6f96338 100644
--- a/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/spi/common/revision/CDOFeatureDeltaVisitorImpl.java
+++ b/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/spi/common/revision/CDOFeatureDeltaVisitorImpl.java
@@ -1,98 +1,98 @@
-/*
- * Copyright (c) 2004 - 2011 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.spi.common.revision;
-
-import org.eclipse.emf.cdo.common.revision.delta.CDOAddFeatureDelta;
-import org.eclipse.emf.cdo.common.revision.delta.CDOClearFeatureDelta;
-import org.eclipse.emf.cdo.common.revision.delta.CDOContainerFeatureDelta;
-import org.eclipse.emf.cdo.common.revision.delta.CDOFeatureDelta;
-import org.eclipse.emf.cdo.common.revision.delta.CDOFeatureDeltaVisitor;
-import org.eclipse.emf.cdo.common.revision.delta.CDOListFeatureDelta;
-import org.eclipse.emf.cdo.common.revision.delta.CDOMoveFeatureDelta;
-import org.eclipse.emf.cdo.common.revision.delta.CDORemoveFeatureDelta;
-import org.eclipse.emf.cdo.common.revision.delta.CDOSetFeatureDelta;
-import org.eclipse.emf.cdo.common.revision.delta.CDOUnsetFeatureDelta;
-
-/**
- * @author Simon McDuff
- * @since 3.0
- */
-public class CDOFeatureDeltaVisitorImpl implements CDOFeatureDeltaVisitor
-{
- public CDOFeatureDeltaVisitorImpl()
- {
- }
-
- public void visit(CDOAddFeatureDelta delta)
- {
- }
-
- public void visit(CDOClearFeatureDelta delta)
- {
- }
-
- public void visit(CDOContainerFeatureDelta delta)
- {
- }
-
- public void visit(CDOListFeatureDelta deltas)
- {
- for (CDOFeatureDelta delta : deltas.getListChanges())
- {
- try
- {
- delta.accept(this);
- }
- catch (StopVisitException ex)
- {
- return;
- }
- }
- }
-
- public void visit(CDOMoveFeatureDelta delta)
- {
- }
-
- public void visit(CDORemoveFeatureDelta delta)
- {
- }
-
- public void visit(CDOSetFeatureDelta delta)
- {
- }
-
- public void visit(CDOUnsetFeatureDelta delta)
- {
- }
-
- /**
- * @since 4.0
- */
- protected void stopVisit()
- {
- throw new StopVisitException();
- }
-
- /**
- * @author Eike Stepper
- * @since 4.0
- */
- private static final class StopVisitException extends RuntimeException
- {
- private static final long serialVersionUID = 1L;
-
- public StopVisitException()
- {
- }
- }
-}
+/*
+ * Copyright (c) 2004 - 2012 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.spi.common.revision;
+
+import org.eclipse.emf.cdo.common.revision.delta.CDOAddFeatureDelta;
+import org.eclipse.emf.cdo.common.revision.delta.CDOClearFeatureDelta;
+import org.eclipse.emf.cdo.common.revision.delta.CDOContainerFeatureDelta;
+import org.eclipse.emf.cdo.common.revision.delta.CDOFeatureDelta;
+import org.eclipse.emf.cdo.common.revision.delta.CDOFeatureDeltaVisitor;
+import org.eclipse.emf.cdo.common.revision.delta.CDOListFeatureDelta;
+import org.eclipse.emf.cdo.common.revision.delta.CDOMoveFeatureDelta;
+import org.eclipse.emf.cdo.common.revision.delta.CDORemoveFeatureDelta;
+import org.eclipse.emf.cdo.common.revision.delta.CDOSetFeatureDelta;
+import org.eclipse.emf.cdo.common.revision.delta.CDOUnsetFeatureDelta;
+
+/**
+ * @author Simon McDuff
+ * @since 3.0
+ */
+public class CDOFeatureDeltaVisitorImpl implements CDOFeatureDeltaVisitor
+{
+ public CDOFeatureDeltaVisitorImpl()
+ {
+ }
+
+ public void visit(CDOAddFeatureDelta delta)
+ {
+ }
+
+ public void visit(CDOClearFeatureDelta delta)
+ {
+ }
+
+ public void visit(CDOContainerFeatureDelta delta)
+ {
+ }
+
+ public void visit(CDOListFeatureDelta deltas)
+ {
+ for (CDOFeatureDelta delta : deltas.getListChanges())
+ {
+ try
+ {
+ delta.accept(this);
+ }
+ catch (StopVisitException ex)
+ {
+ return;
+ }
+ }
+ }
+
+ public void visit(CDOMoveFeatureDelta delta)
+ {
+ }
+
+ public void visit(CDORemoveFeatureDelta delta)
+ {
+ }
+
+ public void visit(CDOSetFeatureDelta delta)
+ {
+ }
+
+ public void visit(CDOUnsetFeatureDelta delta)
+ {
+ }
+
+ /**
+ * @since 4.0
+ */
+ protected void stopVisit()
+ {
+ throw new StopVisitException();
+ }
+
+ /**
+ * @author Eike Stepper
+ * @since 4.0
+ */
+ private static final class StopVisitException extends RuntimeException
+ {
+ private static final long serialVersionUID = 1L;
+
+ public StopVisitException()
+ {
+ }
+ }
+}
diff --git a/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/spi/common/revision/CDOFeatureMapEntry.java b/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/spi/common/revision/CDOFeatureMapEntry.java
index c4a8db2419..e09c0ff74d 100644
--- a/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/spi/common/revision/CDOFeatureMapEntry.java
+++ b/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/spi/common/revision/CDOFeatureMapEntry.java
@@ -1,25 +1,25 @@
-/*
- * Copyright (c) 2004 - 2011 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:
- * Martin Taal - derived from CDOFeatureMapEntryImpl
- */
-package org.eclipse.emf.cdo.spi.common.revision;
-
-import org.eclipse.emf.ecore.EStructuralFeature;
-import org.eclipse.emf.ecore.util.FeatureMap;
-
-/**
- * @since 3.0
- * @author Martin Taal
- */
-public interface CDOFeatureMapEntry extends FeatureMap.Entry
-{
- void setEStructuralFeature(EStructuralFeature feature);
-
- void setValue(Object value);
-}
+/*
+ * Copyright (c) 2004 - 2012 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:
+ * Martin Taal - derived from CDOFeatureMapEntryImpl
+ */
+package org.eclipse.emf.cdo.spi.common.revision;
+
+import org.eclipse.emf.ecore.EStructuralFeature;
+import org.eclipse.emf.ecore.util.FeatureMap;
+
+/**
+ * @since 3.0
+ * @author Martin Taal
+ */
+public interface CDOFeatureMapEntry extends FeatureMap.Entry
+{
+ void setEStructuralFeature(EStructuralFeature feature);
+
+ void setValue(Object value);
+}
diff --git a/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/spi/common/revision/CDOIDMapper.java b/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/spi/common/revision/CDOIDMapper.java
index d11f697a82..3f18ffa4af 100644
--- a/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/spi/common/revision/CDOIDMapper.java
+++ b/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/spi/common/revision/CDOIDMapper.java
@@ -1,63 +1,63 @@
-/*
- * Copyright (c) 2004 - 2011 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
- */
-package org.eclipse.emf.cdo.spi.common.revision;
-
-import org.eclipse.emf.cdo.common.id.CDOID;
-import org.eclipse.emf.cdo.common.revision.CDORevisionUtil;
-
-import org.eclipse.emf.ecore.EStructuralFeature;
-
-import java.util.Map;
-
-/**
- * @author Simon McDuff
- * @since 2.0
- */
-public class CDOIDMapper implements CDOReferenceAdjuster
-{
- private Map<CDOID, CDOID> idMappings;
-
- private boolean allowUnmappedTempIDs;
-
- public CDOIDMapper(Map<CDOID, CDOID> idMappings)
- {
- this.idMappings = idMappings;
- }
-
- public Map<CDOID, CDOID> getIDMappings()
- {
- return idMappings;
- }
-
- /**
- * @since 3.0
- */
- public boolean isAllowUnmappedTempIDs()
- {
- return allowUnmappedTempIDs;
- }
-
- /**
- * @since 3.0
- */
- public void setAllowUnmappedTempIDs(boolean allowUnmappedTempIDs)
- {
- this.allowUnmappedTempIDs = allowUnmappedTempIDs;
- }
-
- /**
- * @since 4.0
- */
- public Object adjustReference(Object value, EStructuralFeature feature, int index)
- {
- return CDORevisionUtil.remapID(value, idMappings, allowUnmappedTempIDs);
- }
-}
+/*
+ * Copyright (c) 2004 - 2012 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
+ */
+package org.eclipse.emf.cdo.spi.common.revision;
+
+import org.eclipse.emf.cdo.common.id.CDOID;
+import org.eclipse.emf.cdo.common.revision.CDORevisionUtil;
+
+import org.eclipse.emf.ecore.EStructuralFeature;
+
+import java.util.Map;
+
+/**
+ * @author Simon McDuff
+ * @since 2.0
+ */
+public class CDOIDMapper implements CDOReferenceAdjuster
+{
+ private Map<CDOID, CDOID> idMappings;
+
+ private boolean allowUnmappedTempIDs;
+
+ public CDOIDMapper(Map<CDOID, CDOID> idMappings)
+ {
+ this.idMappings = idMappings;
+ }
+
+ public Map<CDOID, CDOID> getIDMappings()
+ {
+ return idMappings;
+ }
+
+ /**
+ * @since 3.0
+ */
+ public boolean isAllowUnmappedTempIDs()
+ {
+ return allowUnmappedTempIDs;
+ }
+
+ /**
+ * @since 3.0
+ */
+ public void setAllowUnmappedTempIDs(boolean allowUnmappedTempIDs)
+ {
+ this.allowUnmappedTempIDs = allowUnmappedTempIDs;
+ }
+
+ /**
+ * @since 4.0
+ */
+ public Object adjustReference(Object value, EStructuralFeature feature, int index)
+ {
+ return CDORevisionUtil.remapID(value, idMappings, allowUnmappedTempIDs);
+ }
+}
diff --git a/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/spi/common/revision/CDOReferenceAdjustable.java b/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/spi/common/revision/CDOReferenceAdjustable.java
index 22ad3d624f..a206671ff3 100644
--- a/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/spi/common/revision/CDOReferenceAdjustable.java
+++ b/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/spi/common/revision/CDOReferenceAdjustable.java
@@ -1,21 +1,21 @@
-/*
- * Copyright (c) 2004 - 2011 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.spi.common.revision;
-
-/**
- * @author Simon McDuff
- * @since 4.0
- */
-public interface CDOReferenceAdjustable
-{
- public boolean adjustReferences(CDOReferenceAdjuster referenceAdjuster);
-}
+/*
+ * Copyright (c) 2004 - 2012 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.spi.common.revision;
+
+/**
+ * @author Simon McDuff
+ * @since 4.0
+ */
+public interface CDOReferenceAdjustable
+{
+ public boolean adjustReferences(CDOReferenceAdjuster referenceAdjuster);
+}
diff --git a/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/spi/common/revision/CDOReferenceAdjuster.java b/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/spi/common/revision/CDOReferenceAdjuster.java
index dbe2b7f68f..3b9673d107 100644
--- a/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/spi/common/revision/CDOReferenceAdjuster.java
+++ b/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/spi/common/revision/CDOReferenceAdjuster.java
@@ -1,34 +1,34 @@
-/*
- * Copyright (c) 2004 - 2011 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.spi.common.revision;
-
-import org.eclipse.emf.cdo.common.id.CDOID;
-import org.eclipse.emf.cdo.common.id.CDOIDTemp;
-import org.eclipse.emf.cdo.common.revision.CDOList;
-import org.eclipse.emf.cdo.common.revision.CDORevision;
-
-import org.eclipse.emf.ecore.EStructuralFeature;
-
-/**
- * @author Simon McDuff
- * @since 4.0
- */
-public interface CDOReferenceAdjuster
-{
- /**
- * Adjusts the internal structure of an object (e.g: {@link CDORevision}). This is mainly used after committing a
- * transaction. {@link CDORevision} must replace {@link CDOIDTemp} for non-temporary {@link CDOID} with a mapped ID.
- * Only the internal structure knows how to do these modifications. This is important to consider using different
- * implementation of {@link CDOList}.
- */
- public Object adjustReference(Object id, EStructuralFeature feature, int index);
-}
+/*
+ * Copyright (c) 2004 - 2012 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.spi.common.revision;
+
+import org.eclipse.emf.cdo.common.id.CDOID;
+import org.eclipse.emf.cdo.common.id.CDOIDTemp;
+import org.eclipse.emf.cdo.common.revision.CDOList;
+import org.eclipse.emf.cdo.common.revision.CDORevision;
+
+import org.eclipse.emf.ecore.EStructuralFeature;
+
+/**
+ * @author Simon McDuff
+ * @since 4.0
+ */
+public interface CDOReferenceAdjuster
+{
+ /**
+ * Adjusts the internal structure of an object (e.g: {@link CDORevision}). This is mainly used after committing a
+ * transaction. {@link CDORevision} must replace {@link CDOIDTemp} for non-temporary {@link CDOID} with a mapped ID.
+ * Only the internal structure knows how to do these modifications. This is important to consider using different
+ * implementation of {@link CDOList}.
+ */
+ public Object adjustReference(Object id, EStructuralFeature feature, int index);
+}
diff --git a/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/spi/common/revision/CDORevisionMerger.java b/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/spi/common/revision/CDORevisionMerger.java
index 649c24b4c3..5d2934404f 100644
--- a/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/spi/common/revision/CDORevisionMerger.java
+++ b/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/spi/common/revision/CDORevisionMerger.java
@@ -1,86 +1,86 @@
-/*
- * Copyright (c) 2004 - 2011 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
- * Simon McDuff - bug 213402
- */
-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;
-import org.eclipse.emf.cdo.common.revision.delta.CDOContainerFeatureDelta;
-import org.eclipse.emf.cdo.common.revision.delta.CDOMoveFeatureDelta;
-import org.eclipse.emf.cdo.common.revision.delta.CDORemoveFeatureDelta;
-import org.eclipse.emf.cdo.common.revision.delta.CDORevisionDelta;
-import org.eclipse.emf.cdo.common.revision.delta.CDOSetFeatureDelta;
-import org.eclipse.emf.cdo.common.revision.delta.CDOUnsetFeatureDelta;
-
-/**
- * @author Simon McDuff
- * @since 2.0
- */
-public class CDORevisionMerger extends CDOFeatureDeltaVisitorImpl
-{
- private InternalCDORevision revision;
-
- public CDORevisionMerger()
- {
- }
-
- public synchronized void merge(InternalCDORevision revision, CDORevisionDelta delta)
- {
- this.revision = revision;
- delta.accept(this);
- revision = null;
- }
-
- @Override
- public void visit(CDOMoveFeatureDelta delta)
- {
- revision.move(delta.getFeature(), delta.getNewPosition(), delta.getOldPosition());
- }
-
- @Override
- public void visit(CDOAddFeatureDelta delta)
- {
- revision.add(delta.getFeature(), delta.getIndex(), delta.getValue());
- }
-
- @Override
- public void visit(CDORemoveFeatureDelta delta)
- {
- revision.remove(delta.getFeature(), delta.getIndex());
- }
-
- @Override
- public void visit(CDOSetFeatureDelta delta)
- {
- revision.set(delta.getFeature(), delta.getIndex(), delta.getValue());
- }
-
- @Override
- public void visit(CDOUnsetFeatureDelta delta)
- {
- revision.unset(delta.getFeature());
- }
-
- @Override
- public void visit(CDOClearFeatureDelta delta)
- {
- revision.clear(delta.getFeature());
- }
-
- @Override
- public void visit(CDOContainerFeatureDelta delta)
- {
- revision.setResourceID(delta.getResourceID());
- revision.setContainerID(delta.getContainerID());
- revision.setContainingFeatureID(delta.getContainerFeatureID());
- }
-}
+/*
+ * Copyright (c) 2004 - 2012 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
+ * Simon McDuff - bug 213402
+ */
+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;
+import org.eclipse.emf.cdo.common.revision.delta.CDOContainerFeatureDelta;
+import org.eclipse.emf.cdo.common.revision.delta.CDOMoveFeatureDelta;
+import org.eclipse.emf.cdo.common.revision.delta.CDORemoveFeatureDelta;
+import org.eclipse.emf.cdo.common.revision.delta.CDORevisionDelta;
+import org.eclipse.emf.cdo.common.revision.delta.CDOSetFeatureDelta;
+import org.eclipse.emf.cdo.common.revision.delta.CDOUnsetFeatureDelta;
+
+/**
+ * @author Simon McDuff
+ * @since 2.0
+ */
+public class CDORevisionMerger extends CDOFeatureDeltaVisitorImpl
+{
+ private InternalCDORevision revision;
+
+ public CDORevisionMerger()
+ {
+ }
+
+ public synchronized void merge(InternalCDORevision revision, CDORevisionDelta delta)
+ {
+ this.revision = revision;
+ delta.accept(this);
+ revision = null;
+ }
+
+ @Override
+ public void visit(CDOMoveFeatureDelta delta)
+ {
+ revision.move(delta.getFeature(), delta.getNewPosition(), delta.getOldPosition());
+ }
+
+ @Override
+ public void visit(CDOAddFeatureDelta delta)
+ {
+ revision.add(delta.getFeature(), delta.getIndex(), delta.getValue());
+ }
+
+ @Override
+ public void visit(CDORemoveFeatureDelta delta)
+ {
+ revision.remove(delta.getFeature(), delta.getIndex());
+ }
+
+ @Override
+ public void visit(CDOSetFeatureDelta delta)
+ {
+ revision.set(delta.getFeature(), delta.getIndex(), delta.getValue());
+ }
+
+ @Override
+ public void visit(CDOUnsetFeatureDelta delta)
+ {
+ revision.unset(delta.getFeature());
+ }
+
+ @Override
+ public void visit(CDOClearFeatureDelta delta)
+ {
+ revision.clear(delta.getFeature());
+ }
+
+ @Override
+ public void visit(CDOContainerFeatureDelta delta)
+ {
+ revision.setResourceID(delta.getResourceID());
+ revision.setContainerID(delta.getContainerID());
+ revision.setContainingFeatureID(delta.getContainerFeatureID());
+ }
+}
diff --git a/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/spi/common/revision/DelegatingCDORevision.java b/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/spi/common/revision/DelegatingCDORevision.java
index 5e0bb3bad2..57d87a2b4e 100644
--- a/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/spi/common/revision/DelegatingCDORevision.java
+++ b/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/spi/common/revision/DelegatingCDORevision.java
@@ -1,324 +1,324 @@
-/*
- * Copyright (c) 2004 - 2011 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
- * Caspar De Groot - bug 341081
- */
-package org.eclipse.emf.cdo.spi.common.revision;
-
-import org.eclipse.emf.cdo.common.branch.CDOBranch;
-import org.eclipse.emf.cdo.common.branch.CDOBranchPoint;
-import org.eclipse.emf.cdo.common.id.CDOID;
-import org.eclipse.emf.cdo.common.id.CDOIDProvider;
-import org.eclipse.emf.cdo.common.model.CDOClassInfo;
-import org.eclipse.emf.cdo.common.protocol.CDODataInput;
-import org.eclipse.emf.cdo.common.protocol.CDODataOutput;
-import org.eclipse.emf.cdo.common.revision.CDOList;
-import org.eclipse.emf.cdo.common.revision.CDORevision;
-import org.eclipse.emf.cdo.common.revision.CDORevisionData;
-import org.eclipse.emf.cdo.common.revision.delta.CDORevisionDelta;
-
-import org.eclipse.emf.ecore.EClass;
-import org.eclipse.emf.ecore.EStructuralFeature;
-
-import java.io.IOException;
-
-/**
- * @author Eike Stepper
- * @since 3.0
- */
-public abstract class DelegatingCDORevision implements InternalCDORevision
-{
- public DelegatingCDORevision()
- {
- }
-
- public abstract InternalCDORevision getDelegate();
-
- /**
- * @since 4.0
- */
- public boolean adjustReferences(CDOReferenceAdjuster referenceAdjuster)
- {
- return getDelegate().adjustReferences(referenceAdjuster);
- }
-
- public long getTimeStamp()
- {
- return getDelegate().getTimeStamp();
- }
-
- public CDOBranch getBranch()
- {
- return getDelegate().getBranch();
- }
-
- public boolean isHistorical()
- {
- return getDelegate().isHistorical();
- }
-
- public CDOID getID()
- {
- return getDelegate().getID();
- }
-
- public CDORevision revision()
- {
- return getDelegate().revision();
- }
-
- public CDOID getResourceID()
- {
- return getDelegate().getResourceID();
- }
-
- public Object getContainerID()
- {
- return getDelegate().getContainerID();
- }
-
- public int getContainingFeatureID()
- {
- return getDelegate().getContainingFeatureID();
- }
-
- public Object get(EStructuralFeature feature, int index)
- {
- return getDelegate().get(feature, index);
- }
-
- public EClass getEClass()
- {
- return getDelegate().getEClass();
- }
-
- public int getVersion()
- {
- return getDelegate().getVersion();
- }
-
- public int size(EStructuralFeature feature)
- {
- return getDelegate().size(feature);
- }
-
- public long getRevised()
- {
- return getDelegate().getRevised();
- }
-
- public boolean isEmpty(EStructuralFeature feature)
- {
- return getDelegate().isEmpty(feature);
- }
-
- public boolean isValid(long timeStamp)
- {
- return getDelegate().isValid(timeStamp);
- }
-
- /**
- * @since 4.0
- */
- public boolean isValid(CDOBranchPoint branchPoint)
- {
- return getDelegate().isValid(branchPoint);
- }
-
- /**
- * @since 4.0
- */
- public InternalCDORevision copy()
- {
- return null;
- }
-
- public CDOClassInfo getClassInfo()
- {
- return getDelegate().getClassInfo();
- }
-
- public void setID(CDOID id)
- {
- getDelegate().setID(id);
- }
-
- public boolean contains(EStructuralFeature feature, Object value)
- {
- return getDelegate().contains(feature, value);
- }
-
- public boolean isResourceNode()
- {
- return getDelegate().isResourceNode();
- }
-
- public void setVersion(int version)
- {
- getDelegate().setVersion(version);
- }
-
- public boolean isResourceFolder()
- {
- return getDelegate().isResourceFolder();
- }
-
- public int indexOf(EStructuralFeature feature, Object value)
- {
- return getDelegate().indexOf(feature, value);
- }
-
- public boolean isResource()
- {
- return getDelegate().isResource();
- }
-
- public void setBranchPoint(CDOBranchPoint branchPoint)
- {
- getDelegate().setBranchPoint(branchPoint);
- }
-
- public void adjustForCommit(CDOBranch branch, long timeStamp)
- {
- getDelegate().adjustForCommit(branch, timeStamp);
- }
-
- public CDORevisionData data()
- {
- return getDelegate().data();
- }
-
- public int lastIndexOf(EStructuralFeature feature, Object value)
- {
- return getDelegate().lastIndexOf(feature, value);
- }
-
- public void setRevised(long revised)
- {
- getDelegate().setRevised(revised);
- }
-
- public InternalCDORevisionDelta compare(CDORevision origin)
- {
- return getDelegate().compare(origin);
- }
-
- public void setResourceID(CDOID resourceID)
- {
- getDelegate().setResourceID(resourceID);
- }
-
- public void merge(CDORevisionDelta delta)
- {
- getDelegate().merge(delta);
- }
-
- public <T> T[] toArray(EStructuralFeature feature, T[] array)
- {
- return getDelegate().toArray(feature, array);
- }
-
- public void setContainerID(Object containerID)
- {
- getDelegate().setContainerID(containerID);
- }
-
- public void setContainingFeatureID(int containingFeatureID)
- {
- getDelegate().setContainingFeatureID(containingFeatureID);
- }
-
- public Object[] toArray(EStructuralFeature feature)
- {
- return getDelegate().toArray(feature);
- }
-
- public void add(EStructuralFeature feature, int index, Object value)
- {
- getDelegate().add(feature, index, value);
- }
-
- public int hashCode(EStructuralFeature feature)
- {
- return getDelegate().hashCode(feature);
- }
-
- public void clear(EStructuralFeature feature)
- {
- getDelegate().clear(feature);
- }
-
- public Object move(EStructuralFeature feature, int targetIndex, int sourceIndex)
- {
- return getDelegate().move(feature, targetIndex, sourceIndex);
- }
-
- public Object remove(EStructuralFeature feature, int index)
- {
- return getDelegate().remove(feature, index);
- }
-
- public Object set(EStructuralFeature feature, int index, Object value)
- {
- return getDelegate().set(feature, index, value);
- }
-
- public void unset(EStructuralFeature feature)
- {
- getDelegate().unset(feature);
- }
-
- public Object getValue(EStructuralFeature feature)
- {
- return getDelegate().getValue(feature);
- }
-
- public Object setValue(EStructuralFeature feature, Object value)
- {
- return getDelegate().setValue(feature, value);
- }
-
- public void setList(EStructuralFeature feature, InternalCDOList list)
- {
- getDelegate().setList(feature, list);
- }
-
- public CDOList getList(EStructuralFeature feature)
- {
- return getDelegate().getList(feature);
- }
-
- public CDOList getList(EStructuralFeature feature, int size)
- {
- return getDelegate().getList(feature, size);
- }
-
- public void read(CDODataInput in) throws IOException
- {
- getDelegate().read(in);
- }
-
- public void write(CDODataOutput out, int referenceChunk) throws IOException
- {
- getDelegate().write(out, referenceChunk);
- }
-
- public void convertEObjects(CDOIDProvider oidProvider)
- {
- getDelegate().convertEObjects(oidProvider);
- }
-
- /**
- * @since 4.0
- */
- public void freeze()
- {
- getDelegate().freeze();
- }
-}
+/*
+ * Copyright (c) 2004 - 2012 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
+ * Caspar De Groot - bug 341081
+ */
+package org.eclipse.emf.cdo.spi.common.revision;
+
+import org.eclipse.emf.cdo.common.branch.CDOBranch;
+import org.eclipse.emf.cdo.common.branch.CDOBranchPoint;
+import org.eclipse.emf.cdo.common.id.CDOID;
+import org.eclipse.emf.cdo.common.id.CDOIDProvider;
+import org.eclipse.emf.cdo.common.model.CDOClassInfo;
+import org.eclipse.emf.cdo.common.protocol.CDODataInput;
+import org.eclipse.emf.cdo.common.protocol.CDODataOutput;
+import org.eclipse.emf.cdo.common.revision.CDOList;
+import org.eclipse.emf.cdo.common.revision.CDORevision;
+import org.eclipse.emf.cdo.common.revision.CDORevisionData;
+import org.eclipse.emf.cdo.common.revision.delta.CDORevisionDelta;
+
+import org.eclipse.emf.ecore.EClass;
+import org.eclipse.emf.ecore.EStructuralFeature;
+
+import java.io.IOException;
+
+/**
+ * @author Eike Stepper
+ * @since 3.0
+ */
+public abstract class DelegatingCDORevision implements InternalCDORevision
+{
+ public DelegatingCDORevision()
+ {
+ }
+
+ public abstract InternalCDORevision getDelegate();
+
+ /**
+ * @since 4.0
+ */
+ public boolean adjustReferences(CDOReferenceAdjuster referenceAdjuster)
+ {
+ return getDelegate().adjustReferences(referenceAdjuster);
+ }
+
+ public long getTimeStamp()
+ {
+ return getDelegate().getTimeStamp();
+ }
+
+ public CDOBranch getBranch()
+ {
+ return getDelegate().getBranch();
+ }
+
+ public boolean isHistorical()
+ {
+ return getDelegate().isHistorical();
+ }
+
+ public CDOID getID()
+ {
+ return getDelegate().getID();
+ }
+
+ public CDORevision revision()
+ {
+ return getDelegate().revision();
+ }
+
+ public CDOID getResourceID()
+ {
+ return getDelegate().getResourceID();
+ }
+
+ public Object getContainerID()
+ {
+ return getDelegate().getContainerID();
+ }
+
+ public int getContainingFeatureID()
+ {
+ return getDelegate().getContainingFeatureID();
+ }
+
+ public Object get(EStructuralFeature feature, int index)
+ {
+ return getDelegate().get(feature, index);
+ }
+
+ public EClass getEClass()
+ {
+ return getDelegate().getEClass();
+ }
+
+ public int getVersion()
+ {
+ return getDelegate().getVersion();
+ }
+
+ public int size(EStructuralFeature feature)
+ {
+ return getDelegate().size(feature);
+ }
+
+ public long getRevised()
+ {
+ return getDelegate().getRevised();
+ }
+
+ public boolean isEmpty(EStructuralFeature feature)
+ {
+ return getDelegate().isEmpty(feature);
+ }
+
+ public boolean isValid(long timeStamp)
+ {
+ return getDelegate().isValid(timeStamp);
+ }
+
+ /**
+ * @since 4.0
+ */
+ public boolean isValid(CDOBranchPoint branchPoint)
+ {
+ return getDelegate().isValid(branchPoint);
+ }
+
+ /**
+ * @since 4.0
+ */
+ public InternalCDORevision copy()
+ {
+ return null;
+ }
+
+ public CDOClassInfo getClassInfo()
+ {
+ return getDelegate().getClassInfo();
+ }
+
+ public void setID(CDOID id)
+ {
+ getDelegate().setID(id);
+ }
+
+ public boolean contains(EStructuralFeature feature, Object value)
+ {
+ return getDelegate().contains(feature, value);
+ }
+
+ public boolean isResourceNode()
+ {
+ return getDelegate().isResourceNode();
+ }
+
+ public void setVersion(int version)
+ {
+ getDelegate().setVersion(version);
+ }
+
+ public boolean isResourceFolder()
+ {
+ return getDelegate().isResourceFolder();
+ }
+
+ public int indexOf(EStructuralFeature feature, Object value)
+ {
+ return getDelegate().indexOf(feature, value);
+ }
+
+ public boolean isResource()
+ {
+ return getDelegate().isResource();
+ }
+
+ public void setBranchPoint(CDOBranchPoint branchPoint)
+ {
+ getDelegate().setBranchPoint(branchPoint);
+ }
+
+ public void adjustForCommit(CDOBranch branch, long timeStamp)
+ {
+ getDelegate().adjustForCommit(branch, timeStamp);
+ }
+
+ public CDORevisionData data()
+ {
+ return getDelegate().data();
+ }
+
+ public int lastIndexOf(EStructuralFeature feature, Object value)
+ {
+ return getDelegate().lastIndexOf(feature, value);
+ }
+
+ public void setRevised(long revised)
+ {
+ getDelegate().setRevised(revised);
+ }
+
+ public InternalCDORevisionDelta compare(CDORevision origin)
+ {
+ return getDelegate().compare(origin);
+ }
+
+ public void setResourceID(CDOID resourceID)
+ {
+ getDelegate().setResourceID(resourceID);
+ }
+
+ public void merge(CDORevisionDelta delta)
+ {
+ getDelegate().merge(delta);
+ }
+
+ public <T> T[] toArray(EStructuralFeature feature, T[] array)
+ {
+ return getDelegate().toArray(feature, array);
+ }
+
+ public void setContainerID(Object containerID)
+ {
+ getDelegate().setContainerID(containerID);
+ }
+
+ public void setContainingFeatureID(int containingFeatureID)
+ {
+ getDelegate().setContainingFeatureID(containingFeatureID);
+ }
+
+ public Object[] toArray(EStructuralFeature feature)
+ {
+ return getDelegate().toArray(feature);
+ }
+
+ public void add(EStructuralFeature feature, int index, Object value)
+ {
+ getDelegate().add(feature, index, value);
+ }
+
+ public int hashCode(EStructuralFeature feature)
+ {
+ return getDelegate().hashCode(feature);
+ }
+
+ public void clear(EStructuralFeature feature)
+ {
+ getDelegate().clear(feature);
+ }
+
+ public Object move(EStructuralFeature feature, int targetIndex, int sourceIndex)
+ {
+ return getDelegate().move(feature, targetIndex, sourceIndex);
+ }
+
+ public Object remove(EStructuralFeature feature, int index)
+ {
+ return getDelegate().remove(feature, index);
+ }
+
+ public Object set(EStructuralFeature feature, int index, Object value)
+ {
+ return getDelegate().set(feature, index, value);
+ }
+
+ public void unset(EStructuralFeature feature)
+ {
+ getDelegate().unset(feature);
+ }
+
+ public Object getValue(EStructuralFeature feature)
+ {
+ return getDelegate().getValue(feature);
+ }
+
+ public Object setValue(EStructuralFeature feature, Object value)
+ {
+ return getDelegate().setValue(feature, value);
+ }
+
+ public void setList(EStructuralFeature feature, InternalCDOList list)
+ {
+ getDelegate().setList(feature, list);
+ }
+
+ public CDOList getList(EStructuralFeature feature)
+ {
+ return getDelegate().getList(feature);
+ }
+
+ public CDOList getList(EStructuralFeature feature, int size)
+ {
+ return getDelegate().getList(feature, size);
+ }
+
+ public void read(CDODataInput in) throws IOException
+ {
+ getDelegate().read(in);
+ }
+
+ public void write(CDODataOutput out, int referenceChunk) throws IOException
+ {
+ getDelegate().write(out, referenceChunk);
+ }
+
+ public void convertEObjects(CDOIDProvider oidProvider)
+ {
+ getDelegate().convertEObjects(oidProvider);
+ }
+
+ /**
+ * @since 4.0
+ */
+ public void freeze()
+ {
+ getDelegate().freeze();
+ }
+}
diff --git a/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/spi/common/revision/DelegatingCDORevisionManager.java b/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/spi/common/revision/DelegatingCDORevisionManager.java
index 4eaf5189f4..6e36ce3ecd 100644
--- a/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/spi/common/revision/DelegatingCDORevisionManager.java
+++ b/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/spi/common/revision/DelegatingCDORevisionManager.java
@@ -1,193 +1,193 @@
-/*
- * Copyright (c) 2004 - 2011 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.revision;
-
-import org.eclipse.emf.cdo.common.branch.CDOBranch;
-import org.eclipse.emf.cdo.common.branch.CDOBranchPoint;
-import org.eclipse.emf.cdo.common.branch.CDOBranchVersion;
-import org.eclipse.emf.cdo.common.id.CDOID;
-import org.eclipse.emf.cdo.common.revision.CDORevision;
-import org.eclipse.emf.cdo.common.revision.CDORevisionCache;
-import org.eclipse.emf.cdo.common.revision.CDORevisionFactory;
-
-import org.eclipse.net4j.util.lifecycle.Lifecycle;
-
-import org.eclipse.emf.ecore.EClass;
-
-import java.util.List;
-
-/**
- * @author Eike Stepper
- * @since 3.0
- */
-public abstract class DelegatingCDORevisionManager extends Lifecycle implements InternalCDORevisionManager
-{
- public DelegatingCDORevisionManager()
- {
- }
-
- public InternalCDORevisionCache getCache()
- {
- return getDelegate().getCache();
- }
-
- /**
- * @since 4.0
- */
- public void setCache(CDORevisionCache cache)
- {
- getDelegate().setCache(cache);
- }
-
- public void setFactory(CDORevisionFactory factory)
- {
- getDelegate().setFactory(factory);
- }
-
- public CDORevisionFactory getFactory()
- {
- return getDelegate().getFactory();
- }
-
- public RevisionLoader getRevisionLoader()
- {
- return getDelegate().getRevisionLoader();
- }
-
- public void setRevisionLoader(RevisionLoader revisionLoader)
- {
- getDelegate().setRevisionLoader(revisionLoader);
- }
-
- public RevisionLocker getRevisionLocker()
- {
- return getDelegate().getRevisionLocker();
- }
-
- public void setRevisionLocker(RevisionLocker revisionLocker)
- {
- getDelegate().setRevisionLocker(revisionLocker);
- }
-
- /**
- * @since 4.0
- */
- public boolean isSupportingAudits()
- {
- return getDelegate().isSupportingAudits();
- }
-
- /**
- * @since 4.0
- */
- public void setSupportingAudits(boolean on)
- {
- getDelegate().setSupportingAudits(on);
- }
-
- public boolean isSupportingBranches()
- {
- return getDelegate().isSupportingBranches();
- }
-
- public void setSupportingBranches(boolean on)
- {
- getDelegate().setSupportingBranches(on);
- }
-
- /**
- * @since 4.0
- */
- public void addRevision(CDORevision revision)
- {
- getDelegate().addRevision(revision);
- }
-
- public boolean containsRevision(CDOID id, CDOBranchPoint branchPoint)
- {
- return getDelegate().containsRevision(id, branchPoint);
- }
-
- public boolean containsRevisionByVersion(CDOID id, CDOBranchVersion branchVersion)
- {
- return getDelegate().containsRevisionByVersion(id, branchVersion);
- }
-
- public EClass getObjectType(CDOID id)
- {
- return getDelegate().getObjectType(id);
- }
-
- public InternalCDORevision getRevisionByVersion(CDOID id, CDOBranchVersion branchVersion, int referenceChunk,
- boolean loadOnDemand)
- {
- return getDelegate().getRevisionByVersion(id, branchVersion, referenceChunk, loadOnDemand);
- }
-
- public InternalCDORevision getRevision(CDOID id, CDOBranchPoint branchPoint, int referenceChunk, int prefetchDepth,
- boolean loadOnDemand)
- {
- return getDelegate().getRevision(id, branchPoint, referenceChunk, prefetchDepth, loadOnDemand);
- }
-
- public InternalCDORevision getRevision(CDOID id, CDOBranchPoint branchPoint, int referenceChunk, int prefetchDepth,
- boolean loadOnDemand, SyntheticCDORevision[] synthetics)
- {
- return getDelegate().getRevision(id, branchPoint, referenceChunk, prefetchDepth, loadOnDemand, synthetics);
- }
-
- public List<CDORevision> getRevisions(List<CDOID> ids, CDOBranchPoint branchPoint, int referenceChunk,
- int prefetchDepth, boolean loadOnDemand)
- {
- return getDelegate().getRevisions(ids, branchPoint, referenceChunk, prefetchDepth, loadOnDemand);
- }
-
- public List<CDORevision> getRevisions(List<CDOID> ids, CDOBranchPoint branchPoint, int referenceChunk,
- int prefetchDepth, boolean loadOnDemand, SyntheticCDORevision[] synthetics)
- {
- return getDelegate().getRevisions(ids, branchPoint, referenceChunk, prefetchDepth, loadOnDemand, synthetics);
- }
-
- public void reviseLatest(CDOID id, CDOBranch branch)
- {
- getDelegate().reviseLatest(id, branch);
- }
-
- public void reviseVersion(CDOID id, CDOBranchVersion branchVersion, long timeStamp)
- {
- getDelegate().reviseVersion(id, branchVersion, timeStamp);
- }
-
- @Override
- protected void doActivate() throws Exception
- {
- if (isDelegatingLifecycle())
- {
- getDelegate().activate();
- }
- }
-
- @Override
- protected void doDeactivate() throws Exception
- {
- if (isDelegatingLifecycle())
- {
- getDelegate().deactivate();
- }
- }
-
- protected boolean isDelegatingLifecycle()
- {
- return true;
- }
-
- protected abstract InternalCDORevisionManager getDelegate();
-}
+/*
+ * Copyright (c) 2004 - 2012 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.revision;
+
+import org.eclipse.emf.cdo.common.branch.CDOBranch;
+import org.eclipse.emf.cdo.common.branch.CDOBranchPoint;
+import org.eclipse.emf.cdo.common.branch.CDOBranchVersion;
+import org.eclipse.emf.cdo.common.id.CDOID;
+import org.eclipse.emf.cdo.common.revision.CDORevision;
+import org.eclipse.emf.cdo.common.revision.CDORevisionCache;
+import org.eclipse.emf.cdo.common.revision.CDORevisionFactory;
+
+import org.eclipse.net4j.util.lifecycle.Lifecycle;
+
+import org.eclipse.emf.ecore.EClass;
+
+import java.util.List;
+
+/**
+ * @author Eike Stepper
+ * @since 3.0
+ */
+public abstract class DelegatingCDORevisionManager extends Lifecycle implements InternalCDORevisionManager
+{
+ public DelegatingCDORevisionManager()
+ {
+ }
+
+ public InternalCDORevisionCache getCache()
+ {
+ return getDelegate().getCache();
+ }
+
+ /**
+ * @since 4.0
+ */
+ public void setCache(CDORevisionCache cache)
+ {
+ getDelegate().setCache(cache);
+ }
+
+ public void setFactory(CDORevisionFactory factory)
+ {
+ getDelegate().setFactory(factory);
+ }
+
+ public CDORevisionFactory getFactory()
+ {
+ return getDelegate().getFactory();
+ }
+
+ public RevisionLoader getRevisionLoader()
+ {
+ return getDelegate().getRevisionLoader();
+ }
+
+ public void setRevisionLoader(RevisionLoader revisionLoader)
+ {
+ getDelegate().setRevisionLoader(revisionLoader);
+ }
+
+ public RevisionLocker getRevisionLocker()
+ {
+ return getDelegate().getRevisionLocker();
+ }
+
+ public void setRevisionLocker(RevisionLocker revisionLocker)
+ {
+ getDelegate().setRevisionLocker(revisionLocker);
+ }
+
+ /**
+ * @since 4.0
+ */
+ public boolean isSupportingAudits()
+ {
+ return getDelegate().isSupportingAudits();
+ }
+
+ /**
+ * @since 4.0
+ */
+ public void setSupportingAudits(boolean on)
+ {
+ getDelegate().setSupportingAudits(on);
+ }
+
+ public boolean isSupportingBranches()
+ {
+ return getDelegate().isSupportingBranches();
+ }
+
+ public void setSupportingBranches(boolean on)
+ {
+ getDelegate().setSupportingBranches(on);
+ }
+
+ /**
+ * @since 4.0
+ */
+ public void addRevision(CDORevision revision)
+ {
+ getDelegate().addRevision(revision);
+ }
+
+ public boolean containsRevision(CDOID id, CDOBranchPoint branchPoint)
+ {
+ return getDelegate().containsRevision(id, branchPoint);
+ }
+
+ public boolean containsRevisionByVersion(CDOID id, CDOBranchVersion branchVersion)
+ {
+ return getDelegate().containsRevisionByVersion(id, branchVersion);
+ }
+
+ public EClass getObjectType(CDOID id)
+ {
+ return getDelegate().getObjectType(id);
+ }
+
+ public InternalCDORevision getRevisionByVersion(CDOID id, CDOBranchVersion branchVersion, int referenceChunk,
+ boolean loadOnDemand)
+ {
+ return getDelegate().getRevisionByVersion(id, branchVersion, referenceChunk, loadOnDemand);
+ }
+
+ public InternalCDORevision getRevision(CDOID id, CDOBranchPoint branchPoint, int referenceChunk, int prefetchDepth,
+ boolean loadOnDemand)
+ {
+ return getDelegate().getRevision(id, branchPoint, referenceChunk, prefetchDepth, loadOnDemand);
+ }
+
+ public InternalCDORevision getRevision(CDOID id, CDOBranchPoint branchPoint, int referenceChunk, int prefetchDepth,
+ boolean loadOnDemand, SyntheticCDORevision[] synthetics)
+ {
+ return getDelegate().getRevision(id, branchPoint, referenceChunk, prefetchDepth, loadOnDemand, synthetics);
+ }
+
+ public List<CDORevision> getRevisions(List<CDOID> ids, CDOBranchPoint branchPoint, int referenceChunk,
+ int prefetchDepth, boolean loadOnDemand)
+ {
+ return getDelegate().getRevisions(ids, branchPoint, referenceChunk, prefetchDepth, loadOnDemand);
+ }
+
+ public List<CDORevision> getRevisions(List<CDOID> ids, CDOBranchPoint branchPoint, int referenceChunk,
+ int prefetchDepth, boolean loadOnDemand, SyntheticCDORevision[] synthetics)
+ {
+ return getDelegate().getRevisions(ids, branchPoint, referenceChunk, prefetchDepth, loadOnDemand, synthetics);
+ }
+
+ public void reviseLatest(CDOID id, CDOBranch branch)
+ {
+ getDelegate().reviseLatest(id, branch);
+ }
+
+ public void reviseVersion(CDOID id, CDOBranchVersion branchVersion, long timeStamp)
+ {
+ getDelegate().reviseVersion(id, branchVersion, timeStamp);
+ }
+
+ @Override
+ protected void doActivate() throws Exception
+ {
+ if (isDelegatingLifecycle())
+ {
+ getDelegate().activate();
+ }
+ }
+
+ @Override
+ protected void doDeactivate() throws Exception
+ {
+ if (isDelegatingLifecycle())
+ {
+ getDelegate().deactivate();
+ }
+ }
+
+ protected boolean isDelegatingLifecycle()
+ {
+ return true;
+ }
+
+ protected abstract InternalCDORevisionManager getDelegate();
+}
diff --git a/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/spi/common/revision/DetachedCDORevision.java b/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/spi/common/revision/DetachedCDORevision.java
index 906f14e27f..b940ae58a8 100644
--- a/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/spi/common/revision/DetachedCDORevision.java
+++ b/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/spi/common/revision/DetachedCDORevision.java
@@ -1,69 +1,69 @@
-/*
- * Copyright (c) 2004 - 2011 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.revision;
-
-import org.eclipse.emf.cdo.common.branch.CDOBranch;
-import org.eclipse.emf.cdo.common.id.CDOID;
-
-import org.eclipse.emf.ecore.EClass;
-
-/**
- * @author Eike Stepper
- * @since 3.0
- */
-public class DetachedCDORevision extends SyntheticCDORevision
-{
- private int version;
-
- private long timeStamp;
-
- private long revised;
-
- public DetachedCDORevision(EClass eClass, CDOID id, CDOBranch branch, int version, long timeStamp)
- {
- this(eClass, id, branch, version, timeStamp, UNSPECIFIED_DATE);
- }
-
- /**
- * @since 4.0
- */
- public DetachedCDORevision(EClass eClass, CDOID id, CDOBranch branch, int version, long timeStamp, long revised)
- {
- super(eClass, id, branch);
- this.version = version;
- this.timeStamp = timeStamp;
- this.revised = revised;
- }
-
- @Override
- public final int getVersion()
- {
- return version;
- }
-
- @Override
- public long getTimeStamp()
- {
- return timeStamp;
- }
-
- @Override
- public long getRevised()
- {
- return revised;
- }
-
- @Override
- public void setRevised(long revised)
- {
- this.revised = revised;
- }
-}
+/*
+ * Copyright (c) 2004 - 2012 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.revision;
+
+import org.eclipse.emf.cdo.common.branch.CDOBranch;
+import org.eclipse.emf.cdo.common.id.CDOID;
+
+import org.eclipse.emf.ecore.EClass;
+
+/**
+ * @author Eike Stepper
+ * @since 3.0
+ */
+public class DetachedCDORevision extends SyntheticCDORevision
+{
+ private int version;
+
+ private long timeStamp;
+
+ private long revised;
+
+ public DetachedCDORevision(EClass eClass, CDOID id, CDOBranch branch, int version, long timeStamp)
+ {
+ this(eClass, id, branch, version, timeStamp, UNSPECIFIED_DATE);
+ }
+
+ /**
+ * @since 4.0
+ */
+ public DetachedCDORevision(EClass eClass, CDOID id, CDOBranch branch, int version, long timeStamp, long revised)
+ {
+ super(eClass, id, branch);
+ this.version = version;
+ this.timeStamp = timeStamp;
+ this.revised = revised;
+ }
+
+ @Override
+ public final int getVersion()
+ {
+ return version;
+ }
+
+ @Override
+ public long getTimeStamp()
+ {
+ return timeStamp;
+ }
+
+ @Override
+ public long getRevised()
+ {
+ return revised;
+ }
+
+ @Override
+ public void setRevised(long revised)
+ {
+ this.revised = revised;
+ }
+}
diff --git a/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/spi/common/revision/InternalCDOFeatureDelta.java b/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/spi/common/revision/InternalCDOFeatureDelta.java
index af74162fbe..81cc54549b 100644
--- a/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/spi/common/revision/InternalCDOFeatureDelta.java
+++ b/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/spi/common/revision/InternalCDOFeatureDelta.java
@@ -1,57 +1,57 @@
-/*
- * Copyright (c) 2004 - 2011 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.spi.common.revision;
-
-import org.eclipse.emf.cdo.common.revision.delta.CDOFeatureDelta;
-
-/**
- * @author Simon McDuff
- * @since 3.0
- */
-public interface InternalCDOFeatureDelta extends CDOFeatureDelta
-{
- /**
- * @author Eike Stepper
- */
- public interface WithIndex
- {
- public void adjustAfterAddition(int index);
-
- public void adjustAfterRemoval(int index);
- }
-
- /**
- * @author Eike Stepper
- */
- public interface ListIndexAffecting
- {
- /**
- * Expects the number of indices in the first element of the indices array.
- */
- public void affectIndices(ListTargetAdding source[], int[] indices);
- }
-
- /**
- * @author Eike Stepper
- */
- public interface ListTargetAdding
- {
- /**
- * @since 4.0
- */
- public Object getValue();
-
- public int getIndex();
-
- public void clear();
- }
-}
+/*
+ * Copyright (c) 2004 - 2012 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.spi.common.revision;
+
+import org.eclipse.emf.cdo.common.revision.delta.CDOFeatureDelta;
+
+/**
+ * @author Simon McDuff
+ * @since 3.0
+ */
+public interface InternalCDOFeatureDelta extends CDOFeatureDelta
+{
+ /**
+ * @author Eike Stepper
+ */
+ public interface WithIndex
+ {
+ public void adjustAfterAddition(int index);
+
+ public void adjustAfterRemoval(int index);
+ }
+
+ /**
+ * @author Eike Stepper
+ */
+ public interface ListIndexAffecting
+ {
+ /**
+ * Expects the number of indices in the first element of the indices array.
+ */
+ public void affectIndices(ListTargetAdding source[], int[] indices);
+ }
+
+ /**
+ * @author Eike Stepper
+ */
+ public interface ListTargetAdding
+ {
+ /**
+ * @since 4.0
+ */
+ public Object getValue();
+
+ public int getIndex();
+
+ public void clear();
+ }
+}
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 d65b6fba1e..9960d1fbe1 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
@@ -1,49 +1,49 @@
-/*
- * Copyright (c) 2004 - 2011 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.spi.common.revision;
-
-import org.eclipse.emf.cdo.common.revision.CDOList;
-import org.eclipse.emf.cdo.common.revision.CDORevisionUtil;
-
-import org.eclipse.emf.ecore.EClassifier;
-import org.eclipse.emf.ecore.EStructuralFeature;
-
-/**
- * @author Simon McDuff
- * @since 2.0
- */
-public interface InternalCDOList extends CDOList
-{
- public static final Object UNINITIALIZED = CDORevisionUtil.UNINITIALIZED;
-
- /**
- * Adjusts references according to the passed adjuster and resynchronizes indexes.
- *
- * @since 4.0
- */
- public boolean adjustReferences(CDOReferenceAdjuster adjuster, EStructuralFeature feature);
-
- /**
- * Clones the list.
- */
- public InternalCDOList clone(EClassifier classifier);
-
- /**
- * @since 4.0
- */
- public void freeze();
-
- /**
- * @since 4.0
- */
- public void setWithoutFrozenCheck(int i, Object value);
-}
+/*
+ * Copyright (c) 2004 - 2012 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.spi.common.revision;
+
+import org.eclipse.emf.cdo.common.revision.CDOList;
+import org.eclipse.emf.cdo.common.revision.CDORevisionUtil;
+
+import org.eclipse.emf.ecore.EClassifier;
+import org.eclipse.emf.ecore.EStructuralFeature;
+
+/**
+ * @author Simon McDuff
+ * @since 2.0
+ */
+public interface InternalCDOList extends CDOList
+{
+ public static final Object UNINITIALIZED = CDORevisionUtil.UNINITIALIZED;
+
+ /**
+ * Adjusts references according to the passed adjuster and resynchronizes indexes.
+ *
+ * @since 4.0
+ */
+ public boolean adjustReferences(CDOReferenceAdjuster adjuster, EStructuralFeature feature);
+
+ /**
+ * Clones the list.
+ */
+ public InternalCDOList clone(EClassifier classifier);
+
+ /**
+ * @since 4.0
+ */
+ public void freeze();
+
+ /**
+ * @since 4.0
+ */
+ public void setWithoutFrozenCheck(int i, Object value);
+}
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 9bf134fb5f..dbce8a0caf 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
@@ -1,121 +1,121 @@
-/*
- * Copyright (c) 2004 - 2011 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 - maintenance
- */
-package org.eclipse.emf.cdo.spi.common.revision;
-
-import org.eclipse.emf.cdo.common.branch.CDOBranch;
-import org.eclipse.emf.cdo.common.branch.CDOBranchPoint;
-import org.eclipse.emf.cdo.common.id.CDOID;
-import org.eclipse.emf.cdo.common.id.CDOIDProvider;
-import org.eclipse.emf.cdo.common.model.CDOClassInfo;
-import org.eclipse.emf.cdo.common.protocol.CDODataInput;
-import org.eclipse.emf.cdo.common.protocol.CDODataOutput;
-import org.eclipse.emf.cdo.common.revision.CDOList;
-import org.eclipse.emf.cdo.common.revision.CDORevision;
-import org.eclipse.emf.cdo.common.revision.CDORevisionData;
-
-import org.eclipse.emf.ecore.EStructuralFeature;
-
-import java.io.IOException;
-
-/**
- * @author Eike Stepper
- * @since 2.0
- */
-public interface InternalCDORevision extends CDORevision, CDORevisionData, CDOReferenceAdjustable
-{
- /**
- * @since 3.0
- */
- public CDOClassInfo getClassInfo();
-
- public void setID(CDOID id);
-
- public void setVersion(int version);
-
- /**
- * @since 3.0
- */
- public void setBranchPoint(CDOBranchPoint branchPoint);
-
- public void setRevised(long revised);
-
- public void setResourceID(CDOID resourceID);
-
- public void setContainerID(Object containerID);
-
- public void setContainingFeatureID(int containingFeatureID);
-
- /**
- * @since 3.0
- */
- public void adjustForCommit(CDOBranch branch, long timeStamp);
-
- public void add(EStructuralFeature feature, int index, Object value);
-
- public void clear(EStructuralFeature feature);
-
- public Object move(EStructuralFeature feature, int targetIndex, int sourceIndex);
-
- public Object remove(EStructuralFeature feature, int index);
-
- public Object set(EStructuralFeature feature, int index, Object value);
-
- public void unset(EStructuralFeature feature);
-
- /**
- * Should never return {@link InternalCDORevision#NIL}
- */
- public Object getValue(EStructuralFeature feature);
-
- public Object setValue(EStructuralFeature feature, Object value);
-
- public void setList(EStructuralFeature feature, InternalCDOList list);
-
- public CDOList getList(EStructuralFeature feature);
-
- /**
- * @param initialCapacity
- * the initialCapacity of a new list to be created if this revision has no list so far (its size will always
- * be 0), or -1 to skip list creation and return <code>null</code> in this case.
- */
- public CDOList getList(EStructuralFeature feature, int initialCapacity);
-
- /**
- * @since 3.0
- */
- public void read(CDODataInput in) throws IOException;
-
- /**
- * @since 3.0
- */
- public void write(CDODataOutput out, int referenceChunk) throws IOException;
-
- /**
- * @since 3.0
- */
- public void convertEObjects(CDOIDProvider oidProvider);
-
- /**
- * @since 3.0
- */
- public InternalCDORevisionDelta compare(CDORevision origin);
-
- /**
- * @since 3.0
- */
- public InternalCDORevision copy();
-
- /**
- * @since 4.0
- */
- public void freeze();
-}
+/*
+ * Copyright (c) 2004 - 2012 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 - maintenance
+ */
+package org.eclipse.emf.cdo.spi.common.revision;
+
+import org.eclipse.emf.cdo.common.branch.CDOBranch;
+import org.eclipse.emf.cdo.common.branch.CDOBranchPoint;
+import org.eclipse.emf.cdo.common.id.CDOID;
+import org.eclipse.emf.cdo.common.id.CDOIDProvider;
+import org.eclipse.emf.cdo.common.model.CDOClassInfo;
+import org.eclipse.emf.cdo.common.protocol.CDODataInput;
+import org.eclipse.emf.cdo.common.protocol.CDODataOutput;
+import org.eclipse.emf.cdo.common.revision.CDOList;
+import org.eclipse.emf.cdo.common.revision.CDORevision;
+import org.eclipse.emf.cdo.common.revision.CDORevisionData;
+
+import org.eclipse.emf.ecore.EStructuralFeature;
+
+import java.io.IOException;
+
+/**
+ * @author Eike Stepper
+ * @since 2.0
+ */
+public interface InternalCDORevision extends CDORevision, CDORevisionData, CDOReferenceAdjustable
+{
+ /**
+ * @since 3.0
+ */
+ public CDOClassInfo getClassInfo();
+
+ public void setID(CDOID id);
+
+ public void setVersion(int version);
+
+ /**
+ * @since 3.0
+ */
+ public void setBranchPoint(CDOBranchPoint branchPoint);
+
+ public void setRevised(long revised);
+
+ public void setResourceID(CDOID resourceID);
+
+ public void setContainerID(Object containerID);
+
+ public void setContainingFeatureID(int containingFeatureID);
+
+ /**
+ * @since 3.0
+ */
+ public void adjustForCommit(CDOBranch branch, long timeStamp);
+
+ public void add(EStructuralFeature feature, int index, Object value);
+
+ public void clear(EStructuralFeature feature);
+
+ public Object move(EStructuralFeature feature, int targetIndex, int sourceIndex);
+
+ public Object remove(EStructuralFeature feature, int index);
+
+ public Object set(EStructuralFeature feature, int index, Object value);
+
+ public void unset(EStructuralFeature feature);
+
+ /**
+ * Should never return {@link InternalCDORevision#NIL}
+ */
+ public Object getValue(EStructuralFeature feature);
+
+ public Object setValue(EStructuralFeature feature, Object value);
+
+ public void setList(EStructuralFeature feature, InternalCDOList list);
+
+ public CDOList getList(EStructuralFeature feature);
+
+ /**
+ * @param initialCapacity
+ * the initialCapacity of a new list to be created if this revision has no list so far (its size will always
+ * be 0), or -1 to skip list creation and return <code>null</code> in this case.
+ */
+ public CDOList getList(EStructuralFeature feature, int initialCapacity);
+
+ /**
+ * @since 3.0
+ */
+ public void read(CDODataInput in) throws IOException;
+
+ /**
+ * @since 3.0
+ */
+ public void write(CDODataOutput out, int referenceChunk) throws IOException;
+
+ /**
+ * @since 3.0
+ */
+ public void convertEObjects(CDOIDProvider oidProvider);
+
+ /**
+ * @since 3.0
+ */
+ public InternalCDORevisionDelta compare(CDORevision origin);
+
+ /**
+ * @since 3.0
+ */
+ public InternalCDORevision copy();
+
+ /**
+ * @since 4.0
+ */
+ public void freeze();
+}
diff --git a/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/spi/common/revision/InternalCDORevisionCache.java b/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/spi/common/revision/InternalCDORevisionCache.java
index 1c10453c5b..e753650b93 100644
--- a/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/spi/common/revision/InternalCDORevisionCache.java
+++ b/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/spi/common/revision/InternalCDORevisionCache.java
@@ -1,37 +1,37 @@
-/*
- * Copyright (c) 2004 - 2011 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.revision;
-
-import org.eclipse.emf.cdo.common.branch.CDOBranchPoint;
-import org.eclipse.emf.cdo.common.branch.CDOBranchVersion;
-import org.eclipse.emf.cdo.common.id.CDOID;
-import org.eclipse.emf.cdo.common.revision.CDOAllRevisionsProvider;
-import org.eclipse.emf.cdo.common.revision.CDORevision;
-import org.eclipse.emf.cdo.common.revision.CDORevisionCache;
-
-import org.eclipse.net4j.util.lifecycle.ILifecycle;
-
-import java.util.List;
-
-/**
- * @author Eike Stepper
- * @since 3.0
- */
-public interface InternalCDORevisionCache extends CDORevisionCache, CDOAllRevisionsProvider, ILifecycle
-{
- public InternalCDORevisionCache instantiate(CDORevision revision);
-
- public CDORevision removeRevision(CDOID id, CDOBranchVersion branchVersion);
-
- public void clear();
-
- public List<CDORevision> getRevisions(CDOBranchPoint branchPoint);
-}
+/*
+ * Copyright (c) 2004 - 2012 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.revision;
+
+import org.eclipse.emf.cdo.common.branch.CDOBranchPoint;
+import org.eclipse.emf.cdo.common.branch.CDOBranchVersion;
+import org.eclipse.emf.cdo.common.id.CDOID;
+import org.eclipse.emf.cdo.common.revision.CDOAllRevisionsProvider;
+import org.eclipse.emf.cdo.common.revision.CDORevision;
+import org.eclipse.emf.cdo.common.revision.CDORevisionCache;
+
+import org.eclipse.net4j.util.lifecycle.ILifecycle;
+
+import java.util.List;
+
+/**
+ * @author Eike Stepper
+ * @since 3.0
+ */
+public interface InternalCDORevisionCache extends CDORevisionCache, CDOAllRevisionsProvider, ILifecycle
+{
+ public InternalCDORevisionCache instantiate(CDORevision revision);
+
+ public CDORevision removeRevision(CDOID id, CDOBranchVersion branchVersion);
+
+ public void clear();
+
+ public List<CDORevision> getRevisions(CDOBranchPoint branchPoint);
+}
diff --git a/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/spi/common/revision/InternalCDORevisionDelta.java b/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/spi/common/revision/InternalCDORevisionDelta.java
index c90530f38f..ca4cdb0268 100644
--- a/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/spi/common/revision/InternalCDORevisionDelta.java
+++ b/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/spi/common/revision/InternalCDORevisionDelta.java
@@ -1,51 +1,51 @@
-/*
- * Copyright (c) 2004 - 2011 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.revision;
-
-import org.eclipse.emf.cdo.common.branch.CDOBranch;
-import org.eclipse.emf.cdo.common.revision.CDORevisable;
-import org.eclipse.emf.cdo.common.revision.delta.CDOFeatureDelta;
-import org.eclipse.emf.cdo.common.revision.delta.CDORevisionDelta;
-
-import org.eclipse.emf.ecore.EStructuralFeature;
-
-import java.util.Map;
-
-/**
- * @author Eike Stepper
- * @noimplement This interface is not intended to be implemented by clients.
- * @noextend This interface is not intended to be extended by clients.
- * @since 2.0
- */
-public interface InternalCDORevisionDelta extends CDORevisionDelta, CDOReferenceAdjustable
-{
- /**
- * @since 3.0
- */
- public Map<EStructuralFeature, CDOFeatureDelta> getFeatureDeltaMap();
-
- public void addFeatureDelta(CDOFeatureDelta delta);
-
- /**
- * @since 3.0
- */
- public void setBranch(CDOBranch branch);
-
- /**
- * @since 3.0
- */
- public void setVersion(int version);
-
- /**
- * @since 4.0
- */
- public void setTarget(CDORevisable target);
-}
+/*
+ * Copyright (c) 2004 - 2012 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.revision;
+
+import org.eclipse.emf.cdo.common.branch.CDOBranch;
+import org.eclipse.emf.cdo.common.revision.CDORevisable;
+import org.eclipse.emf.cdo.common.revision.delta.CDOFeatureDelta;
+import org.eclipse.emf.cdo.common.revision.delta.CDORevisionDelta;
+
+import org.eclipse.emf.ecore.EStructuralFeature;
+
+import java.util.Map;
+
+/**
+ * @author Eike Stepper
+ * @noimplement This interface is not intended to be implemented by clients.
+ * @noextend This interface is not intended to be extended by clients.
+ * @since 2.0
+ */
+public interface InternalCDORevisionDelta extends CDORevisionDelta, CDOReferenceAdjustable
+{
+ /**
+ * @since 3.0
+ */
+ public Map<EStructuralFeature, CDOFeatureDelta> getFeatureDeltaMap();
+
+ public void addFeatureDelta(CDOFeatureDelta delta);
+
+ /**
+ * @since 3.0
+ */
+ public void setBranch(CDOBranch branch);
+
+ /**
+ * @since 3.0
+ */
+ public void setVersion(int version);
+
+ /**
+ * @since 4.0
+ */
+ public void setTarget(CDORevisable target);
+}
diff --git a/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/spi/common/revision/InternalCDORevisionManager.java b/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/spi/common/revision/InternalCDORevisionManager.java
index f32d3c713a..98d9dcf73f 100644
--- a/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/spi/common/revision/InternalCDORevisionManager.java
+++ b/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/spi/common/revision/InternalCDORevisionManager.java
@@ -1,107 +1,107 @@
-/*
- * Copyright (c) 2004 - 2011 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.revision;
-
-import org.eclipse.emf.cdo.common.branch.CDOBranch;
-import org.eclipse.emf.cdo.common.branch.CDOBranchPoint;
-import org.eclipse.emf.cdo.common.branch.CDOBranchVersion;
-import org.eclipse.emf.cdo.common.id.CDOID;
-import org.eclipse.emf.cdo.common.revision.CDORevision;
-import org.eclipse.emf.cdo.common.revision.CDORevisionCache;
-import org.eclipse.emf.cdo.common.revision.CDORevisionCacheAdder;
-import org.eclipse.emf.cdo.common.revision.CDORevisionFactory;
-import org.eclipse.emf.cdo.common.revision.CDORevisionManager;
-
-import org.eclipse.net4j.util.lifecycle.ILifecycle;
-
-import java.util.List;
-
-/**
- * @author Eike Stepper
- * @since 3.0
- */
-public interface InternalCDORevisionManager extends CDORevisionManager, CDORevisionCacheAdder, ILifecycle
-{
- /**
- * @since 4.0
- */
- public boolean isSupportingAudits();
-
- /**
- * @since 4.0
- */
- public void setSupportingAudits(boolean on);
-
- public boolean isSupportingBranches();
-
- public void setSupportingBranches(boolean on);
-
- public RevisionLoader getRevisionLoader();
-
- public void setRevisionLoader(RevisionLoader revisionLoader);
-
- public RevisionLocker getRevisionLocker();
-
- public void setRevisionLocker(RevisionLocker revisionLocker);
-
- public CDORevisionFactory getFactory();
-
- public void setFactory(CDORevisionFactory factory);
-
- public InternalCDORevisionCache getCache();
-
- /**
- * @since 4.0
- */
- public void setCache(CDORevisionCache cache);
-
- /**
- * Called on client via postCommit when there is no version of detached objects available.
- */
- public void reviseLatest(CDOID id, CDOBranch branch);
-
- public void reviseVersion(CDOID id, CDOBranchVersion branchVersion, long timeStamp);
-
- public InternalCDORevision getRevision(CDOID id, CDOBranchPoint branchPoint, int referenceChunk, int prefetchDepth,
- boolean loadOnDemand, SyntheticCDORevision[] synthetics);
-
- public List<CDORevision> getRevisions(List<CDOID> ids, CDOBranchPoint branchPoint, int referenceChunk,
- int prefetchDepth, boolean loadOnDemand, SyntheticCDORevision[] synthetics);
-
- public InternalCDORevision getRevision(CDOID id, CDOBranchPoint branchPoint, int referenceChunk, int prefetchDepth,
- boolean loadOnDemand);
-
- public InternalCDORevision getRevisionByVersion(CDOID id, CDOBranchVersion branchVersion, int referenceChunk,
- boolean loadOnDemand);
-
- /**
- * @author Eike Stepper
- * @since 3.0
- */
- public interface RevisionLoader
- {
- public List<InternalCDORevision> loadRevisions(List<RevisionInfo> infos, CDOBranchPoint branchPoint,
- int referenceChunk, int prefetchDepth);
-
- public InternalCDORevision loadRevisionByVersion(CDOID id, CDOBranchVersion branchVersion, int referenceChunk);
- }
-
- /**
- * @author Eike Stepper
- * @since 3.0
- */
- public interface RevisionLocker
- {
- public void acquireAtomicRequestLock(Object key);
-
- public void releaseAtomicRequestLock(Object key);
- }
-}
+/*
+ * Copyright (c) 2004 - 2012 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.revision;
+
+import org.eclipse.emf.cdo.common.branch.CDOBranch;
+import org.eclipse.emf.cdo.common.branch.CDOBranchPoint;
+import org.eclipse.emf.cdo.common.branch.CDOBranchVersion;
+import org.eclipse.emf.cdo.common.id.CDOID;
+import org.eclipse.emf.cdo.common.revision.CDORevision;
+import org.eclipse.emf.cdo.common.revision.CDORevisionCache;
+import org.eclipse.emf.cdo.common.revision.CDORevisionCacheAdder;
+import org.eclipse.emf.cdo.common.revision.CDORevisionFactory;
+import org.eclipse.emf.cdo.common.revision.CDORevisionManager;
+
+import org.eclipse.net4j.util.lifecycle.ILifecycle;
+
+import java.util.List;
+
+/**
+ * @author Eike Stepper
+ * @since 3.0
+ */
+public interface InternalCDORevisionManager extends CDORevisionManager, CDORevisionCacheAdder, ILifecycle
+{
+ /**
+ * @since 4.0
+ */
+ public boolean isSupportingAudits();
+
+ /**
+ * @since 4.0
+ */
+ public void setSupportingAudits(boolean on);
+
+ public boolean isSupportingBranches();
+
+ public void setSupportingBranches(boolean on);
+
+ public RevisionLoader getRevisionLoader();
+
+ public void setRevisionLoader(RevisionLoader revisionLoader);
+
+ public RevisionLocker getRevisionLocker();
+
+ public void setRevisionLocker(RevisionLocker revisionLocker);
+
+ public CDORevisionFactory getFactory();
+
+ public void setFactory(CDORevisionFactory factory);
+
+ public InternalCDORevisionCache getCache();
+
+ /**
+ * @since 4.0
+ */
+ public void setCache(CDORevisionCache cache);
+
+ /**
+ * Called on client via postCommit when there is no version of detached objects available.
+ */
+ public void reviseLatest(CDOID id, CDOBranch branch);
+
+ public void reviseVersion(CDOID id, CDOBranchVersion branchVersion, long timeStamp);
+
+ public InternalCDORevision getRevision(CDOID id, CDOBranchPoint branchPoint, int referenceChunk, int prefetchDepth,
+ boolean loadOnDemand, SyntheticCDORevision[] synthetics);
+
+ public List<CDORevision> getRevisions(List<CDOID> ids, CDOBranchPoint branchPoint, int referenceChunk,
+ int prefetchDepth, boolean loadOnDemand, SyntheticCDORevision[] synthetics);
+
+ public InternalCDORevision getRevision(CDOID id, CDOBranchPoint branchPoint, int referenceChunk, int prefetchDepth,
+ boolean loadOnDemand);
+
+ public InternalCDORevision getRevisionByVersion(CDOID id, CDOBranchVersion branchVersion, int referenceChunk,
+ boolean loadOnDemand);
+
+ /**
+ * @author Eike Stepper
+ * @since 3.0
+ */
+ public interface RevisionLoader
+ {
+ public List<InternalCDORevision> loadRevisions(List<RevisionInfo> infos, CDOBranchPoint branchPoint,
+ int referenceChunk, int prefetchDepth);
+
+ public InternalCDORevision loadRevisionByVersion(CDOID id, CDOBranchVersion branchVersion, int referenceChunk);
+ }
+
+ /**
+ * @author Eike Stepper
+ * @since 3.0
+ */
+ public interface RevisionLocker
+ {
+ public void acquireAtomicRequestLock(Object key);
+
+ public void releaseAtomicRequestLock(Object key);
+ }
+}
diff --git a/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/spi/common/revision/ManagedRevisionProvider.java b/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/spi/common/revision/ManagedRevisionProvider.java
index ff1096b7af..6fd1f59d71 100644
--- a/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/spi/common/revision/ManagedRevisionProvider.java
+++ b/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/spi/common/revision/ManagedRevisionProvider.java
@@ -1,49 +1,49 @@
-/*
- * Copyright (c) 2004 - 2011 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.revision;
-
-import org.eclipse.emf.cdo.common.branch.CDOBranchPoint;
-import org.eclipse.emf.cdo.common.id.CDOID;
-import org.eclipse.emf.cdo.common.revision.CDORevision;
-import org.eclipse.emf.cdo.common.revision.CDORevisionManager;
-import org.eclipse.emf.cdo.common.revision.CDORevisionProvider;
-
-/**
- * @author Eike Stepper
- * @since 4.0
- */
-public class ManagedRevisionProvider implements CDORevisionProvider
-{
- private CDORevisionManager revisionManager;
-
- private CDOBranchPoint branchPoint;
-
- public ManagedRevisionProvider(CDORevisionManager revisionManager, CDOBranchPoint branchPoint)
- {
- this.branchPoint = branchPoint;
- this.revisionManager = revisionManager;
- }
-
- public CDORevisionManager getRevisionManager()
- {
- return revisionManager;
- }
-
- public CDOBranchPoint getBranchPoint()
- {
- return branchPoint;
- }
-
- public CDORevision getRevision(CDOID id)
- {
- return revisionManager.getRevision(id, branchPoint, CDORevision.UNCHUNKED, CDORevision.DEPTH_NONE, true);
- }
-}
+/*
+ * Copyright (c) 2004 - 2012 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.revision;
+
+import org.eclipse.emf.cdo.common.branch.CDOBranchPoint;
+import org.eclipse.emf.cdo.common.id.CDOID;
+import org.eclipse.emf.cdo.common.revision.CDORevision;
+import org.eclipse.emf.cdo.common.revision.CDORevisionManager;
+import org.eclipse.emf.cdo.common.revision.CDORevisionProvider;
+
+/**
+ * @author Eike Stepper
+ * @since 4.0
+ */
+public class ManagedRevisionProvider implements CDORevisionProvider
+{
+ private CDORevisionManager revisionManager;
+
+ private CDOBranchPoint branchPoint;
+
+ public ManagedRevisionProvider(CDORevisionManager revisionManager, CDOBranchPoint branchPoint)
+ {
+ this.branchPoint = branchPoint;
+ this.revisionManager = revisionManager;
+ }
+
+ public CDORevisionManager getRevisionManager()
+ {
+ return revisionManager;
+ }
+
+ public CDOBranchPoint getBranchPoint()
+ {
+ return branchPoint;
+ }
+
+ public CDORevision getRevision(CDOID id)
+ {
+ return revisionManager.getRevision(id, branchPoint, CDORevision.UNCHUNKED, CDORevision.DEPTH_NONE, true);
+ }
+}
diff --git a/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/spi/common/revision/PointerCDORevision.java b/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/spi/common/revision/PointerCDORevision.java
index 7a65167082..1cab3a0ecb 100644
--- a/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/spi/common/revision/PointerCDORevision.java
+++ b/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/spi/common/revision/PointerCDORevision.java
@@ -1,69 +1,69 @@
-/*
- * Copyright (c) 2004 - 2011 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.revision;
-
-import org.eclipse.emf.cdo.common.branch.CDOBranch;
-import org.eclipse.emf.cdo.common.branch.CDOBranchVersion;
-import org.eclipse.emf.cdo.common.id.CDOID;
-
-import org.eclipse.emf.ecore.EClass;
-
-/**
- * A {@link SyntheticCDORevision synthetic} revision that represents the initial period of an object in a
- * {@link CDOBranch branch} when the object is still associated with a revision from one of the baseline branches. It
- * always has {@link #getVersion() version} {@link CDOBranchVersion#UNSPECIFIED_VERSION zero} and can only appear in
- * branches below the {@link CDOBranch#isMainBranch() main} branch.
- *
- * @author Eike Stepper
- * @since 3.0
- */
-public class PointerCDORevision extends SyntheticCDORevision
-{
- private long revised = UNSPECIFIED_DATE;
-
- private CDOBranchVersion target;
-
- public PointerCDORevision(EClass eClass, CDOID id, CDOBranch branch, long revised, CDOBranchVersion target)
- {
- super(eClass, id, branch);
- this.revised = revised;
- this.target = target;
- }
-
- @Override
- public final int getVersion()
- {
- return UNSPECIFIED_VERSION;
- }
-
- @Override
- public long getTimeStamp()
- {
- return getBranch().getBase().getTimeStamp();
- }
-
- @Override
- public long getRevised()
- {
- return revised;
- }
-
- @Override
- public void setRevised(long revised)
- {
- this.revised = revised;
- }
-
- public CDOBranchVersion getTarget()
- {
- return target;
- }
-}
+/*
+ * Copyright (c) 2004 - 2012 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.revision;
+
+import org.eclipse.emf.cdo.common.branch.CDOBranch;
+import org.eclipse.emf.cdo.common.branch.CDOBranchVersion;
+import org.eclipse.emf.cdo.common.id.CDOID;
+
+import org.eclipse.emf.ecore.EClass;
+
+/**
+ * A {@link SyntheticCDORevision synthetic} revision that represents the initial period of an object in a
+ * {@link CDOBranch branch} when the object is still associated with a revision from one of the baseline branches. It
+ * always has {@link #getVersion() version} {@link CDOBranchVersion#UNSPECIFIED_VERSION zero} and can only appear in
+ * branches below the {@link CDOBranch#isMainBranch() main} branch.
+ *
+ * @author Eike Stepper
+ * @since 3.0
+ */
+public class PointerCDORevision extends SyntheticCDORevision
+{
+ private long revised = UNSPECIFIED_DATE;
+
+ private CDOBranchVersion target;
+
+ public PointerCDORevision(EClass eClass, CDOID id, CDOBranch branch, long revised, CDOBranchVersion target)
+ {
+ super(eClass, id, branch);
+ this.revised = revised;
+ this.target = target;
+ }
+
+ @Override
+ public final int getVersion()
+ {
+ return UNSPECIFIED_VERSION;
+ }
+
+ @Override
+ public long getTimeStamp()
+ {
+ return getBranch().getBase().getTimeStamp();
+ }
+
+ @Override
+ public long getRevised()
+ {
+ return revised;
+ }
+
+ @Override
+ public void setRevised(long revised)
+ {
+ this.revised = revised;
+ }
+
+ public CDOBranchVersion getTarget()
+ {
+ return target;
+ }
+}
diff --git a/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/spi/common/revision/RevisionInfo.java b/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/spi/common/revision/RevisionInfo.java
index 4eb1532769..71e6ea8153 100644
--- a/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/spi/common/revision/RevisionInfo.java
+++ b/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/spi/common/revision/RevisionInfo.java
@@ -1,571 +1,571 @@
-/*
- * Copyright (c) 2004 - 2011 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.revision;
-
-import org.eclipse.emf.cdo.common.branch.CDOBranch;
-import org.eclipse.emf.cdo.common.branch.CDOBranchPoint;
-import org.eclipse.emf.cdo.common.branch.CDOBranchVersion;
-import org.eclipse.emf.cdo.common.id.CDOID;
-import org.eclipse.emf.cdo.common.protocol.CDODataInput;
-import org.eclipse.emf.cdo.common.protocol.CDODataOutput;
-import org.eclipse.emf.cdo.common.revision.CDORevision;
-
-import org.eclipse.net4j.util.CheckUtil;
-import org.eclipse.net4j.util.ObjectUtil;
-
-import org.eclipse.emf.ecore.EClass;
-import org.eclipse.emf.ecore.EClassifier;
-
-import java.io.IOException;
-import java.util.List;
-
-/**
- * @author Eike Stepper
- * @since 3.0
- */
-public abstract class RevisionInfo
-{
- private static final int NO_RESULT = 0;
-
- private static final int POINTER_RESULT = 1;
-
- private static final int DETACHED_RESULT = 2;
-
- private static final int NORMAL_RESULT = 3;
-
- private CDOID id;
-
- private CDOBranchPoint requestedBranchPoint;
-
- private InternalCDORevision result;
-
- private SyntheticCDORevision synthetic;
-
- protected RevisionInfo(CDOID id, CDOBranchPoint requestedBranchPoint)
- {
- CheckUtil.checkArg(requestedBranchPoint, "requestedBranchPoint");
- this.id = id;
- this.requestedBranchPoint = requestedBranchPoint;
- }
-
- protected RevisionInfo(CDODataInput in, CDOBranchPoint requestedBranchPoint) throws IOException
- {
- CheckUtil.checkArg(requestedBranchPoint, "requestedBranchPoint");
- id = in.readCDOID();
- this.requestedBranchPoint = requestedBranchPoint;
- }
-
- public abstract Type getType();
-
- public final CDOID getID()
- {
- return id;
- }
-
- public final CDOBranchPoint getRequestedBranchPoint()
- {
- return requestedBranchPoint;
- }
-
- public InternalCDORevision getResult()
- {
- return result;
- }
-
- public void setResult(InternalCDORevision result)
- {
- this.result = result;
- }
-
- public SyntheticCDORevision getSynthetic()
- {
- return synthetic;
- }
-
- public void setSynthetic(SyntheticCDORevision synthetic)
- {
- this.synthetic = synthetic;
- }
-
- public abstract boolean isLoadNeeded();
-
- public void write(CDODataOutput out) throws IOException
- {
- out.writeByte(getType().ordinal());
- out.writeCDOID(getID());
- }
-
- public static RevisionInfo read(CDODataInput in, CDOBranchPoint requestedBranchPoint) throws IOException
- {
- byte ordinal = in.readByte();
- Type type = Type.values()[ordinal];
- switch (type)
- {
- case AVAILABLE_NORMAL:
- return new Available.Normal(in, requestedBranchPoint);
-
- case AVAILABLE_POINTER:
- return new Available.Pointer(in, requestedBranchPoint);
-
- case AVAILABLE_DETACHED:
- return new Available.Detached(in, requestedBranchPoint);
-
- case MISSING:
- return new Missing(in, requestedBranchPoint);
-
- default:
- throw new IOException("Invalid revision info type: " + type);
- }
- }
-
- public void execute(InternalCDORevisionManager revisionManager, int referenceChunk)
- {
- SyntheticCDORevision[] synthetics = new SyntheticCDORevision[1];
- result = revisionManager.getRevision(getID(), requestedBranchPoint, referenceChunk, CDORevision.DEPTH_NONE, true,
- synthetics);
- synthetic = synthetics[0];
- }
-
- public void writeResult(CDODataOutput out, int referenceChunk) throws IOException
- {
- writeRevision(out, referenceChunk);
- writeResult(out, synthetic, referenceChunk);
- }
-
- public void readResult(CDODataInput in) throws IOException
- {
- readRevision(in);
- synthetic = (SyntheticCDORevision)readResult(in, getID(), requestedBranchPoint.getBranch());
- }
-
- public void processResult(InternalCDORevisionManager revisionManager, List<CDORevision> results,
- SyntheticCDORevision[] synthetics, int i)
- {
- if (result instanceof DetachedCDORevision)
- {
- results.add(null);
- }
- else
- {
- results.add(result);
- }
-
- if (result != null)
- {
- revisionManager.addRevision(result);
- }
-
- if (synthetic != null)
- {
- revisionManager.addRevision(synthetic);
- if (synthetic instanceof PointerCDORevision)
- {
- PointerCDORevision pointer = (PointerCDORevision)synthetic;
- CDOBranchVersion target = pointer.getTarget();
- if (target != result && target instanceof InternalCDORevision)
- {
- revisionManager.addRevision((CDORevision)target);
- }
- }
-
- if (synthetics != null)
- {
- synthetics[i] = synthetic;
- }
- }
- }
-
- protected void writeRevision(CDODataOutput out, int referenceChunk) throws IOException
- {
- out.writeCDORevision(result, referenceChunk);
- }
-
- protected void readRevision(CDODataInput in) throws IOException
- {
- result = (InternalCDORevision)in.readCDORevision();
- }
-
- /**
- * @since 4.0
- */
- public static void writeResult(CDODataOutput out, InternalCDORevision revision, int referenceChunk)
- throws IOException
- {
- if (revision == null)
- {
- out.writeByte(NO_RESULT);
- }
- else if (revision instanceof PointerCDORevision)
- {
- PointerCDORevision pointer = (PointerCDORevision)revision;
- out.writeByte(POINTER_RESULT);
- out.writeCDOClassifierRef(pointer.getEClass());
- out.writeLong(pointer.getRevised());
-
- CDOBranchVersion target = pointer.getTarget();
- if (target instanceof InternalCDORevision)
- {
- writeResult(out, (InternalCDORevision)target, referenceChunk);
- }
- else
- {
- out.writeByte(NO_RESULT);
- }
- }
- else if (revision instanceof DetachedCDORevision)
- {
- DetachedCDORevision detached = (DetachedCDORevision)revision;
- out.writeByte(DETACHED_RESULT);
- out.writeCDOClassifierRef(detached.getEClass());
- out.writeLong(detached.getTimeStamp());
- out.writeLong(detached.getRevised());
- out.writeInt(detached.getVersion());
- }
- else
- {
- out.writeByte(NORMAL_RESULT);
- out.writeCDORevision(revision, referenceChunk);
- }
- }
-
- /**
- * @since 4.0
- */
- public static InternalCDORevision readResult(CDODataInput in, CDOID id, CDOBranch branch) throws IOException
- {
- byte type = in.readByte();
- switch (type)
- {
- case NO_RESULT:
- return null;
-
- case POINTER_RESULT:
- {
- EClassifier classifier = in.readCDOClassifierRefAndResolve();
- long revised = in.readLong();
- InternalCDORevision target = readResult(in, id, branch);
- return new PointerCDORevision((EClass)classifier, id, branch, revised, target);
- }
-
- case DETACHED_RESULT:
- {
- EClassifier classifier = in.readCDOClassifierRefAndResolve();
- long timeStamp = in.readLong();
- long revised = in.readLong();
- int version = in.readInt();
- return new DetachedCDORevision((EClass)classifier, id, branch, version, timeStamp, revised);
- }
-
- case NORMAL_RESULT:
- return (InternalCDORevision)in.readCDORevision();
-
- default:
- throw new IllegalStateException("Invalid synthetic type: " + type);
- }
- }
-
- protected void doWriteResult(CDODataOutput out, InternalCDORevision revision, int referenceChunk) throws IOException
- {
- writeResult(out, revision, referenceChunk);
- }
-
- protected InternalCDORevision doReadResult(CDODataInput in) throws IOException
- {
- return readResult(in, id, requestedBranchPoint.getBranch());
- }
-
- /**
- * @author Eike Stepper
- * @since 3.0
- */
- public static enum Type
- {
- AVAILABLE_NORMAL, AVAILABLE_POINTER, AVAILABLE_DETACHED, MISSING
- }
-
- /**
- * @author Eike Stepper
- * @since 3.0
- */
- public static abstract class Available extends RevisionInfo
- {
- private CDOBranchVersion availableBranchVersion;
-
- protected Available(CDOID id, CDOBranchPoint requestedBranchPoint, CDOBranchVersion availableBranchVersion)
- {
- super(id, requestedBranchPoint);
- this.availableBranchVersion = availableBranchVersion;
- }
-
- protected Available(CDODataInput in, CDOBranchPoint requestedBranchPoint) throws IOException
- {
- super(in, requestedBranchPoint);
- availableBranchVersion = in.readCDOBranchVersion();
- }
-
- public CDOBranchVersion getAvailableBranchVersion()
- {
- return availableBranchVersion;
- }
-
- public boolean isDirect()
- {
- return ObjectUtil.equals(availableBranchVersion.getBranch(), getRequestedBranchPoint().getBranch());
- }
-
- @Override
- public boolean isLoadNeeded()
- {
- return !isDirect();
- }
-
- @Override
- public void write(CDODataOutput out) throws IOException
- {
- super.write(out);
- out.writeCDOBranchVersion(availableBranchVersion);
- }
-
- @Override
- protected void writeRevision(CDODataOutput out, int referenceChunk) throws IOException
- {
- InternalCDORevision result = getResult();
- if (result != null && ObjectUtil.equals(result.getBranch(), availableBranchVersion.getBranch()))
- {
- // Use available
- out.writeBoolean(true);
- }
- else
- {
- out.writeBoolean(false);
- super.writeRevision(out, referenceChunk);
- }
- }
-
- @Override
- protected void readRevision(CDODataInput in) throws IOException
- {
- boolean useAvailable = in.readBoolean();
- if (useAvailable)
- {
- setResult((InternalCDORevision)availableBranchVersion);
- }
- else
- {
- super.readRevision(in);
- }
- }
-
- /**
- * @author Eike Stepper
- * @since 3.0
- */
- public static class Normal extends Available
- {
- public Normal(CDOID id, CDOBranchPoint requestedBranchPoint, CDOBranchVersion availableBranchVersion)
- {
- super(id, requestedBranchPoint, availableBranchVersion);
- }
-
- private Normal(CDODataInput in, CDOBranchPoint requestedBranchPoint) throws IOException
- {
- super(in, requestedBranchPoint);
- }
-
- @Override
- public Type getType()
- {
- return Type.AVAILABLE_NORMAL;
- }
-
- @Override
- public InternalCDORevision getResult()
- {
- if (isDirect())
- {
- CDOBranchVersion branchVersion = getAvailableBranchVersion();
- if (branchVersion instanceof InternalCDORevision)
- {
- return (InternalCDORevision)branchVersion;
- }
- }
-
- return super.getResult();
- }
-
- @Override
- public void processResult(InternalCDORevisionManager revisionManager, List<CDORevision> results,
- SyntheticCDORevision[] synthetics, int i)
- {
- if (!isLoadNeeded())
- {
- setResult((InternalCDORevision)getAvailableBranchVersion());
- }
-
- super.processResult(revisionManager, results, synthetics, i);
- }
- }
-
- /**
- * @author Eike Stepper
- * @since 3.0
- */
- public static class Pointer extends Available
- {
- private CDOBranchVersion targetBranchVersion;
-
- private boolean hasTarget;
-
- public Pointer(CDOID id, CDOBranchPoint requestedBranchPoint, CDOBranchVersion availableBranchVersion,
- CDOBranchVersion targetBranchVersion)
- {
- super(id, requestedBranchPoint, availableBranchVersion);
- this.targetBranchVersion = targetBranchVersion;
- hasTarget = targetBranchVersion instanceof InternalCDORevision;
- }
-
- private Pointer(CDODataInput in, CDOBranchPoint requestedBranchPoint) throws IOException
- {
- super(in, requestedBranchPoint);
- if (in.readBoolean())
- {
- targetBranchVersion = in.readCDOBranchVersion();
- hasTarget = in.readBoolean();
- }
- }
-
- public CDOBranchVersion getTargetBranchVersion()
- {
- return targetBranchVersion;
- }
-
- @Override
- public Type getType()
- {
- return Type.AVAILABLE_POINTER;
- }
-
- public boolean hasTarget()
- {
- return hasTarget;
- }
-
- @Override
- public boolean isLoadNeeded()
- {
- if (getRequestedBranchPoint().getBranch().isMainBranch())
- {
- return false;
- }
-
- return !isDirect() || !hasTarget();
- }
-
- @Override
- public void write(CDODataOutput out) throws IOException
- {
- super.write(out);
- if (targetBranchVersion != null)
- {
- out.writeBoolean(true);
- out.writeCDOBranchVersion(targetBranchVersion);
- out.writeBoolean(hasTarget);
- }
- else
- {
- out.writeBoolean(false);
- }
- }
-
- @Override
- public void processResult(InternalCDORevisionManager revisionManager, List<CDORevision> results,
- SyntheticCDORevision[] synthetics, int i)
- {
- if (!isLoadNeeded())
- {
- CDOBranchVersion target = getTargetBranchVersion();
- if (target instanceof InternalCDORevision)
- {
- setResult((InternalCDORevision)target);
- }
-
- setSynthetic((PointerCDORevision)getAvailableBranchVersion());
- }
-
- super.processResult(revisionManager, results, synthetics, i);
- }
- }
-
- /**
- * @author Eike Stepper
- * @since 3.0
- */
- public static class Detached extends Available
- {
- public Detached(CDOID id, CDOBranchPoint requestedBranchPoint, CDOBranchVersion availableBranchVersion)
- {
- super(id, requestedBranchPoint, availableBranchVersion);
- }
-
- private Detached(CDODataInput in, CDOBranchPoint requestedBranchPoint) throws IOException
- {
- super(in, requestedBranchPoint);
- }
-
- @Override
- public Type getType()
- {
- return Type.AVAILABLE_DETACHED;
- }
-
- @Override
- public void processResult(InternalCDORevisionManager revisionManager, List<CDORevision> results,
- SyntheticCDORevision[] synthetics, int i)
- {
- if (!isLoadNeeded())
- {
- setSynthetic((DetachedCDORevision)getAvailableBranchVersion());
- }
-
- super.processResult(revisionManager, results, synthetics, i);
- }
- }
- }
-
- /**
- * @author Eike Stepper
- * @since 3.0
- */
- public static class Missing extends RevisionInfo
- {
- public Missing(CDOID id, CDOBranchPoint requestedBranchPoint)
- {
- super(id, requestedBranchPoint);
- }
-
- private Missing(CDODataInput in, CDOBranchPoint requestedBranchPoint) throws IOException
- {
- super(in, requestedBranchPoint);
- }
-
- @Override
- public Type getType()
- {
- return Type.MISSING;
- }
-
- @Override
- public boolean isLoadNeeded()
- {
- return true;
- }
- }
-}
+/*
+ * Copyright (c) 2004 - 2012 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.revision;
+
+import org.eclipse.emf.cdo.common.branch.CDOBranch;
+import org.eclipse.emf.cdo.common.branch.CDOBranchPoint;
+import org.eclipse.emf.cdo.common.branch.CDOBranchVersion;
+import org.eclipse.emf.cdo.common.id.CDOID;
+import org.eclipse.emf.cdo.common.protocol.CDODataInput;
+import org.eclipse.emf.cdo.common.protocol.CDODataOutput;
+import org.eclipse.emf.cdo.common.revision.CDORevision;
+
+import org.eclipse.net4j.util.CheckUtil;
+import org.eclipse.net4j.util.ObjectUtil;
+
+import org.eclipse.emf.ecore.EClass;
+import org.eclipse.emf.ecore.EClassifier;
+
+import java.io.IOException;
+import java.util.List;
+
+/**
+ * @author Eike Stepper
+ * @since 3.0
+ */
+public abstract class RevisionInfo
+{
+ private static final int NO_RESULT = 0;
+
+ private static final int POINTER_RESULT = 1;
+
+ private static final int DETACHED_RESULT = 2;
+
+ private static final int NORMAL_RESULT = 3;
+
+ private CDOID id;
+
+ private CDOBranchPoint requestedBranchPoint;
+
+ private InternalCDORevision result;
+
+ private SyntheticCDORevision synthetic;
+
+ protected RevisionInfo(CDOID id, CDOBranchPoint requestedBranchPoint)
+ {
+ CheckUtil.checkArg(requestedBranchPoint, "requestedBranchPoint");
+ this.id = id;
+ this.requestedBranchPoint = requestedBranchPoint;
+ }
+
+ protected RevisionInfo(CDODataInput in, CDOBranchPoint requestedBranchPoint) throws IOException
+ {
+ CheckUtil.checkArg(requestedBranchPoint, "requestedBranchPoint");
+ id = in.readCDOID();
+ this.requestedBranchPoint = requestedBranchPoint;
+ }
+
+ public abstract Type getType();
+
+ public final CDOID getID()
+ {
+ return id;
+ }
+
+ public final CDOBranchPoint getRequestedBranchPoint()
+ {
+ return requestedBranchPoint;
+ }
+
+ public InternalCDORevision getResult()
+ {
+ return result;
+ }
+
+ public void setResult(InternalCDORevision result)
+ {
+ this.result = result;
+ }
+
+ public SyntheticCDORevision getSynthetic()
+ {
+ return synthetic;
+ }
+
+ public void setSynthetic(SyntheticCDORevision synthetic)
+ {
+ this.synthetic = synthetic;
+ }
+
+ public abstract boolean isLoadNeeded();
+
+ public void write(CDODataOutput out) throws IOException
+ {
+ out.writeByte(getType().ordinal());
+ out.writeCDOID(getID());
+ }
+
+ public static RevisionInfo read(CDODataInput in, CDOBranchPoint requestedBranchPoint) throws IOException
+ {
+ byte ordinal = in.readByte();
+ Type type = Type.values()[ordinal];
+ switch (type)
+ {
+ case AVAILABLE_NORMAL:
+ return new Available.Normal(in, requestedBranchPoint);
+
+ case AVAILABLE_POINTER:
+ return new Available.Pointer(in, requestedBranchPoint);
+
+ case AVAILABLE_DETACHED:
+ return new Available.Detached(in, requestedBranchPoint);
+
+ case MISSING:
+ return new Missing(in, requestedBranchPoint);
+
+ default:
+ throw new IOException("Invalid revision info type: " + type);
+ }
+ }
+
+ public void execute(InternalCDORevisionManager revisionManager, int referenceChunk)
+ {
+ SyntheticCDORevision[] synthetics = new SyntheticCDORevision[1];
+ result = revisionManager.getRevision(getID(), requestedBranchPoint, referenceChunk, CDORevision.DEPTH_NONE, true,
+ synthetics);
+ synthetic = synthetics[0];
+ }
+
+ public void writeResult(CDODataOutput out, int referenceChunk) throws IOException
+ {
+ writeRevision(out, referenceChunk);
+ writeResult(out, synthetic, referenceChunk);
+ }
+
+ public void readResult(CDODataInput in) throws IOException
+ {
+ readRevision(in);
+ synthetic = (SyntheticCDORevision)readResult(in, getID(), requestedBranchPoint.getBranch());
+ }
+
+ public void processResult(InternalCDORevisionManager revisionManager, List<CDORevision> results,
+ SyntheticCDORevision[] synthetics, int i)
+ {
+ if (result instanceof DetachedCDORevision)
+ {
+ results.add(null);
+ }
+ else
+ {
+ results.add(result);
+ }
+
+ if (result != null)
+ {
+ revisionManager.addRevision(result);
+ }
+
+ if (synthetic != null)
+ {
+ revisionManager.addRevision(synthetic);
+ if (synthetic instanceof PointerCDORevision)
+ {
+ PointerCDORevision pointer = (PointerCDORevision)synthetic;
+ CDOBranchVersion target = pointer.getTarget();
+ if (target != result && target instanceof InternalCDORevision)
+ {
+ revisionManager.addRevision((CDORevision)target);
+ }
+ }
+
+ if (synthetics != null)
+ {
+ synthetics[i] = synthetic;
+ }
+ }
+ }
+
+ protected void writeRevision(CDODataOutput out, int referenceChunk) throws IOException
+ {
+ out.writeCDORevision(result, referenceChunk);
+ }
+
+ protected void readRevision(CDODataInput in) throws IOException
+ {
+ result = (InternalCDORevision)in.readCDORevision();
+ }
+
+ /**
+ * @since 4.0
+ */
+ public static void writeResult(CDODataOutput out, InternalCDORevision revision, int referenceChunk)
+ throws IOException
+ {
+ if (revision == null)
+ {
+ out.writeByte(NO_RESULT);
+ }
+ else if (revision instanceof PointerCDORevision)
+ {
+ PointerCDORevision pointer = (PointerCDORevision)revision;
+ out.writeByte(POINTER_RESULT);
+ out.writeCDOClassifierRef(pointer.getEClass());
+ out.writeLong(pointer.getRevised());
+
+ CDOBranchVersion target = pointer.getTarget();
+ if (target instanceof InternalCDORevision)
+ {
+ writeResult(out, (InternalCDORevision)target, referenceChunk);
+ }
+ else
+ {
+ out.writeByte(NO_RESULT);
+ }
+ }
+ else if (revision instanceof DetachedCDORevision)
+ {
+ DetachedCDORevision detached = (DetachedCDORevision)revision;
+ out.writeByte(DETACHED_RESULT);
+ out.writeCDOClassifierRef(detached.getEClass());
+ out.writeLong(detached.getTimeStamp());
+ out.writeLong(detached.getRevised());
+ out.writeInt(detached.getVersion());
+ }
+ else
+ {
+ out.writeByte(NORMAL_RESULT);
+ out.writeCDORevision(revision, referenceChunk);
+ }
+ }
+
+ /**
+ * @since 4.0
+ */
+ public static InternalCDORevision readResult(CDODataInput in, CDOID id, CDOBranch branch) throws IOException
+ {
+ byte type = in.readByte();
+ switch (type)
+ {
+ case NO_RESULT:
+ return null;
+
+ case POINTER_RESULT:
+ {
+ EClassifier classifier = in.readCDOClassifierRefAndResolve();
+ long revised = in.readLong();
+ InternalCDORevision target = readResult(in, id, branch);
+ return new PointerCDORevision((EClass)classifier, id, branch, revised, target);
+ }
+
+ case DETACHED_RESULT:
+ {
+ EClassifier classifier = in.readCDOClassifierRefAndResolve();
+ long timeStamp = in.readLong();
+ long revised = in.readLong();
+ int version = in.readInt();
+ return new DetachedCDORevision((EClass)classifier, id, branch, version, timeStamp, revised);
+ }
+
+ case NORMAL_RESULT:
+ return (InternalCDORevision)in.readCDORevision();
+
+ default:
+ throw new IllegalStateException("Invalid synthetic type: " + type);
+ }
+ }
+
+ protected void doWriteResult(CDODataOutput out, InternalCDORevision revision, int referenceChunk) throws IOException
+ {
+ writeResult(out, revision, referenceChunk);
+ }
+
+ protected InternalCDORevision doReadResult(CDODataInput in) throws IOException
+ {
+ return readResult(in, id, requestedBranchPoint.getBranch());
+ }
+
+ /**
+ * @author Eike Stepper
+ * @since 3.0
+ */
+ public static enum Type
+ {
+ AVAILABLE_NORMAL, AVAILABLE_POINTER, AVAILABLE_DETACHED, MISSING
+ }
+
+ /**
+ * @author Eike Stepper
+ * @since 3.0
+ */
+ public static abstract class Available extends RevisionInfo
+ {
+ private CDOBranchVersion availableBranchVersion;
+
+ protected Available(CDOID id, CDOBranchPoint requestedBranchPoint, CDOBranchVersion availableBranchVersion)
+ {
+ super(id, requestedBranchPoint);
+ this.availableBranchVersion = availableBranchVersion;
+ }
+
+ protected Available(CDODataInput in, CDOBranchPoint requestedBranchPoint) throws IOException
+ {
+ super(in, requestedBranchPoint);
+ availableBranchVersion = in.readCDOBranchVersion();
+ }
+
+ public CDOBranchVersion getAvailableBranchVersion()
+ {
+ return availableBranchVersion;
+ }
+
+ public boolean isDirect()
+ {
+ return ObjectUtil.equals(availableBranchVersion.getBranch(), getRequestedBranchPoint().getBranch());
+ }
+
+ @Override
+ public boolean isLoadNeeded()
+ {
+ return !isDirect();
+ }
+
+ @Override
+ public void write(CDODataOutput out) throws IOException
+ {
+ super.write(out);
+ out.writeCDOBranchVersion(availableBranchVersion);
+ }
+
+ @Override
+ protected void writeRevision(CDODataOutput out, int referenceChunk) throws IOException
+ {
+ InternalCDORevision result = getResult();
+ if (result != null && ObjectUtil.equals(result.getBranch(), availableBranchVersion.getBranch()))
+ {
+ // Use available
+ out.writeBoolean(true);
+ }
+ else
+ {
+ out.writeBoolean(false);
+ super.writeRevision(out, referenceChunk);
+ }
+ }
+
+ @Override
+ protected void readRevision(CDODataInput in) throws IOException
+ {
+ boolean useAvailable = in.readBoolean();
+ if (useAvailable)
+ {
+ setResult((InternalCDORevision)availableBranchVersion);
+ }
+ else
+ {
+ super.readRevision(in);
+ }
+ }
+
+ /**
+ * @author Eike Stepper
+ * @since 3.0
+ */
+ public static class Normal extends Available
+ {
+ public Normal(CDOID id, CDOBranchPoint requestedBranchPoint, CDOBranchVersion availableBranchVersion)
+ {
+ super(id, requestedBranchPoint, availableBranchVersion);
+ }
+
+ private Normal(CDODataInput in, CDOBranchPoint requestedBranchPoint) throws IOException
+ {
+ super(in, requestedBranchPoint);
+ }
+
+ @Override
+ public Type getType()
+ {
+ return Type.AVAILABLE_NORMAL;
+ }
+
+ @Override
+ public InternalCDORevision getResult()
+ {
+ if (isDirect())
+ {
+ CDOBranchVersion branchVersion = getAvailableBranchVersion();
+ if (branchVersion instanceof InternalCDORevision)
+ {
+ return (InternalCDORevision)branchVersion;
+ }
+ }
+
+ return super.getResult();
+ }
+
+ @Override
+ public void processResult(InternalCDORevisionManager revisionManager, List<CDORevision> results,
+ SyntheticCDORevision[] synthetics, int i)
+ {
+ if (!isLoadNeeded())
+ {
+ setResult((InternalCDORevision)getAvailableBranchVersion());
+ }
+
+ super.processResult(revisionManager, results, synthetics, i);
+ }
+ }
+
+ /**
+ * @author Eike Stepper
+ * @since 3.0
+ */
+ public static class Pointer extends Available
+ {
+ private CDOBranchVersion targetBranchVersion;
+
+ private boolean hasTarget;
+
+ public Pointer(CDOID id, CDOBranchPoint requestedBranchPoint, CDOBranchVersion availableBranchVersion,
+ CDOBranchVersion targetBranchVersion)
+ {
+ super(id, requestedBranchPoint, availableBranchVersion);
+ this.targetBranchVersion = targetBranchVersion;
+ hasTarget = targetBranchVersion instanceof InternalCDORevision;
+ }
+
+ private Pointer(CDODataInput in, CDOBranchPoint requestedBranchPoint) throws IOException
+ {
+ super(in, requestedBranchPoint);
+ if (in.readBoolean())
+ {
+ targetBranchVersion = in.readCDOBranchVersion();
+ hasTarget = in.readBoolean();
+ }
+ }
+
+ public CDOBranchVersion getTargetBranchVersion()
+ {
+ return targetBranchVersion;
+ }
+
+ @Override
+ public Type getType()
+ {
+ return Type.AVAILABLE_POINTER;
+ }
+
+ public boolean hasTarget()
+ {
+ return hasTarget;
+ }
+
+ @Override
+ public boolean isLoadNeeded()
+ {
+ if (getRequestedBranchPoint().getBranch().isMainBranch())
+ {
+ return false;
+ }
+
+ return !isDirect() || !hasTarget();
+ }
+
+ @Override
+ public void write(CDODataOutput out) throws IOException
+ {
+ super.write(out);
+ if (targetBranchVersion != null)
+ {
+ out.writeBoolean(true);
+ out.writeCDOBranchVersion(targetBranchVersion);
+ out.writeBoolean(hasTarget);
+ }
+ else
+ {
+ out.writeBoolean(false);
+ }
+ }
+
+ @Override
+ public void processResult(InternalCDORevisionManager revisionManager, List<CDORevision> results,
+ SyntheticCDORevision[] synthetics, int i)
+ {
+ if (!isLoadNeeded())
+ {
+ CDOBranchVersion target = getTargetBranchVersion();
+ if (target instanceof InternalCDORevision)
+ {
+ setResult((InternalCDORevision)target);
+ }
+
+ setSynthetic((PointerCDORevision)getAvailableBranchVersion());
+ }
+
+ super.processResult(revisionManager, results, synthetics, i);
+ }
+ }
+
+ /**
+ * @author Eike Stepper
+ * @since 3.0
+ */
+ public static class Detached extends Available
+ {
+ public Detached(CDOID id, CDOBranchPoint requestedBranchPoint, CDOBranchVersion availableBranchVersion)
+ {
+ super(id, requestedBranchPoint, availableBranchVersion);
+ }
+
+ private Detached(CDODataInput in, CDOBranchPoint requestedBranchPoint) throws IOException
+ {
+ super(in, requestedBranchPoint);
+ }
+
+ @Override
+ public Type getType()
+ {
+ return Type.AVAILABLE_DETACHED;
+ }
+
+ @Override
+ public void processResult(InternalCDORevisionManager revisionManager, List<CDORevision> results,
+ SyntheticCDORevision[] synthetics, int i)
+ {
+ if (!isLoadNeeded())
+ {
+ setSynthetic((DetachedCDORevision)getAvailableBranchVersion());
+ }
+
+ super.processResult(revisionManager, results, synthetics, i);
+ }
+ }
+ }
+
+ /**
+ * @author Eike Stepper
+ * @since 3.0
+ */
+ public static class Missing extends RevisionInfo
+ {
+ public Missing(CDOID id, CDOBranchPoint requestedBranchPoint)
+ {
+ super(id, requestedBranchPoint);
+ }
+
+ private Missing(CDODataInput in, CDOBranchPoint requestedBranchPoint) throws IOException
+ {
+ super(in, requestedBranchPoint);
+ }
+
+ @Override
+ public Type getType()
+ {
+ return Type.MISSING;
+ }
+
+ @Override
+ public boolean isLoadNeeded()
+ {
+ return true;
+ }
+ }
+}
diff --git a/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/spi/common/revision/StubCDORevision.java b/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/spi/common/revision/StubCDORevision.java
index 574b0ae8d4..cc2449465c 100644
--- a/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/spi/common/revision/StubCDORevision.java
+++ b/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/spi/common/revision/StubCDORevision.java
@@ -1,269 +1,269 @@
-/*
- * Copyright (c) 2004 - 2011 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.revision;
-
-import org.eclipse.emf.cdo.common.branch.CDOBranch;
-import org.eclipse.emf.cdo.common.branch.CDOBranchPoint;
-import org.eclipse.emf.cdo.common.id.CDOID;
-import org.eclipse.emf.cdo.common.id.CDOIDProvider;
-import org.eclipse.emf.cdo.common.protocol.CDODataInput;
-import org.eclipse.emf.cdo.common.protocol.CDODataOutput;
-import org.eclipse.emf.cdo.common.revision.CDOList;
-import org.eclipse.emf.cdo.common.revision.CDORevision;
-import org.eclipse.emf.cdo.common.revision.delta.CDORevisionDelta;
-
-import org.eclipse.emf.ecore.EClass;
-import org.eclipse.emf.ecore.EStructuralFeature;
-
-import java.io.IOException;
-
-/**
- * @author Eike Stepper
- * @since 3.0
- */
-public class StubCDORevision extends AbstractCDORevision
-{
- public StubCDORevision(EClass eClass)
- {
- super(eClass);
- }
-
- public int compareTo(CDOBranchPoint o)
- {
- throw new UnsupportedOperationException(getExceptionMessage());
- }
-
- public void setID(CDOID id)
- {
- throw new UnsupportedOperationException(getExceptionMessage());
- }
-
- public void setVersion(int version)
- {
- throw new UnsupportedOperationException(getExceptionMessage());
- }
-
- public void setBranchPoint(CDOBranchPoint branchPoint)
- {
- throw new UnsupportedOperationException(getExceptionMessage());
- }
-
- public void setRevised(long revised)
- {
- throw new UnsupportedOperationException(getExceptionMessage());
- }
-
- public void setResourceID(CDOID resourceID)
- {
- throw new UnsupportedOperationException(getExceptionMessage());
- }
-
- public void setContainerID(Object containerID)
- {
- throw new UnsupportedOperationException(getExceptionMessage());
- }
-
- public void setContainingFeatureID(int containingFeatureID)
- {
- throw new UnsupportedOperationException(getExceptionMessage());
- }
-
- public void add(EStructuralFeature feature, int index, Object value)
- {
- throw new UnsupportedOperationException(getExceptionMessage());
- }
-
- public void clear(EStructuralFeature feature)
- {
- throw new UnsupportedOperationException(getExceptionMessage());
- }
-
- public Object move(EStructuralFeature feature, int targetIndex, int sourceIndex)
- {
- throw new UnsupportedOperationException(getExceptionMessage());
- }
-
- public Object remove(EStructuralFeature feature, int index)
- {
- throw new UnsupportedOperationException(getExceptionMessage());
- }
-
- public Object set(EStructuralFeature feature, int index, Object value)
- {
- throw new UnsupportedOperationException(getExceptionMessage());
- }
-
- public void unset(EStructuralFeature feature)
- {
- throw new UnsupportedOperationException(getExceptionMessage());
- }
-
- public Object getValue(EStructuralFeature feature)
- {
- throw new UnsupportedOperationException(getExceptionMessage());
- }
-
- public Object setValue(EStructuralFeature feature, Object value)
- {
- throw new UnsupportedOperationException(getExceptionMessage());
- }
-
- public void setList(EStructuralFeature feature, InternalCDOList list)
- {
- throw new UnsupportedOperationException(getExceptionMessage());
- }
-
- public CDOList getList(EStructuralFeature feature)
- {
- throw new UnsupportedOperationException(getExceptionMessage());
- }
-
- public CDOList getList(EStructuralFeature feature, int size)
- {
- throw new UnsupportedOperationException(getExceptionMessage());
- }
-
- public void read(CDODataInput in) throws IOException
- {
- throw new UnsupportedOperationException(getExceptionMessage());
- }
-
- public void write(CDODataOutput out, int referenceChunk) throws IOException
- {
- throw new UnsupportedOperationException(getExceptionMessage());
- }
-
- public void convertEObjects(CDOIDProvider oidProvider)
- {
- throw new UnsupportedOperationException(getExceptionMessage());
- }
-
- public int getVersion()
- {
- throw new UnsupportedOperationException(getExceptionMessage());
- }
-
- public long getRevised()
- {
- throw new UnsupportedOperationException(getExceptionMessage());
- }
-
- public InternalCDORevisionDelta compare(CDORevision origin)
- {
- throw new UnsupportedOperationException(getExceptionMessage());
- }
-
- public void merge(CDORevisionDelta delta)
- {
- throw new UnsupportedOperationException(getExceptionMessage());
- }
-
- public InternalCDORevision copy()
- {
- throw new UnsupportedOperationException(getExceptionMessage());
- }
-
- public CDOID getID()
- {
- throw new UnsupportedOperationException(getExceptionMessage());
- }
-
- public CDOBranch getBranch()
- {
- throw new UnsupportedOperationException(getExceptionMessage());
- }
-
- public long getTimeStamp()
- {
- throw new UnsupportedOperationException(getExceptionMessage());
- }
-
- public CDOID getResourceID()
- {
- throw new UnsupportedOperationException(getExceptionMessage());
- }
-
- public Object getContainerID()
- {
- throw new UnsupportedOperationException(getExceptionMessage());
- }
-
- public int getContainingFeatureID()
- {
- throw new UnsupportedOperationException(getExceptionMessage());
- }
-
- public Object get(EStructuralFeature feature, int index)
- {
- throw new UnsupportedOperationException(getExceptionMessage());
- }
-
- public int size(EStructuralFeature feature)
- {
- throw new UnsupportedOperationException(getExceptionMessage());
- }
-
- public boolean isEmpty(EStructuralFeature feature)
- {
- throw new UnsupportedOperationException(getExceptionMessage());
- }
-
- public boolean contains(EStructuralFeature feature, Object value)
- {
- throw new UnsupportedOperationException(getExceptionMessage());
- }
-
- public int indexOf(EStructuralFeature feature, Object value)
- {
- throw new UnsupportedOperationException(getExceptionMessage());
- }
-
- public int lastIndexOf(EStructuralFeature feature, Object value)
- {
- throw new UnsupportedOperationException(getExceptionMessage());
- }
-
- public <T> T[] toArray(EStructuralFeature feature, T[] array)
- {
- throw new UnsupportedOperationException(getExceptionMessage());
- }
-
- public Object[] toArray(EStructuralFeature feature)
- {
- throw new UnsupportedOperationException(getExceptionMessage());
- }
-
- public int hashCode(EStructuralFeature feature)
- {
- throw new UnsupportedOperationException(getExceptionMessage());
- }
-
- /**
- * @since 4.0
- */
- public boolean adjustReferences(CDOReferenceAdjuster referenceAdjuster)
- {
- throw new UnsupportedOperationException(getExceptionMessage());
- }
-
- /**
- * @since 4.0
- */
- public void freeze()
- {
- throw new UnsupportedOperationException(getExceptionMessage());
- }
-
- private String getExceptionMessage()
- {
- return "Unsupported operation in " + this;
- }
-}
+/*
+ * Copyright (c) 2004 - 2012 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.revision;
+
+import org.eclipse.emf.cdo.common.branch.CDOBranch;
+import org.eclipse.emf.cdo.common.branch.CDOBranchPoint;
+import org.eclipse.emf.cdo.common.id.CDOID;
+import org.eclipse.emf.cdo.common.id.CDOIDProvider;
+import org.eclipse.emf.cdo.common.protocol.CDODataInput;
+import org.eclipse.emf.cdo.common.protocol.CDODataOutput;
+import org.eclipse.emf.cdo.common.revision.CDOList;
+import org.eclipse.emf.cdo.common.revision.CDORevision;
+import org.eclipse.emf.cdo.common.revision.delta.CDORevisionDelta;
+
+import org.eclipse.emf.ecore.EClass;
+import org.eclipse.emf.ecore.EStructuralFeature;
+
+import java.io.IOException;
+
+/**
+ * @author Eike Stepper
+ * @since 3.0
+ */
+public class StubCDORevision extends AbstractCDORevision
+{
+ public StubCDORevision(EClass eClass)
+ {
+ super(eClass);
+ }
+
+ public int compareTo(CDOBranchPoint o)
+ {
+ throw new UnsupportedOperationException(getExceptionMessage());
+ }
+
+ public void setID(CDOID id)
+ {
+ throw new UnsupportedOperationException(getExceptionMessage());
+ }
+
+ public void setVersion(int version)
+ {
+ throw new UnsupportedOperationException(getExceptionMessage());
+ }
+
+ public void setBranchPoint(CDOBranchPoint branchPoint)
+ {
+ throw new UnsupportedOperationException(getExceptionMessage());
+ }
+
+ public void setRevised(long revised)
+ {
+ throw new UnsupportedOperationException(getExceptionMessage());
+ }
+
+ public void setResourceID(CDOID resourceID)
+ {
+ throw new UnsupportedOperationException(getExceptionMessage());
+ }
+
+ public void setContainerID(Object containerID)
+ {
+ throw new UnsupportedOperationException(getExceptionMessage());
+ }
+
+ public void setContainingFeatureID(int containingFeatureID)
+ {
+ throw new UnsupportedOperationException(getExceptionMessage());
+ }
+
+ public void add(EStructuralFeature feature, int index, Object value)
+ {
+ throw new UnsupportedOperationException(getExceptionMessage());
+ }
+
+ public void clear(EStructuralFeature feature)
+ {
+ throw new UnsupportedOperationException(getExceptionMessage());
+ }
+
+ public Object move(EStructuralFeature feature, int targetIndex, int sourceIndex)
+ {
+ throw new UnsupportedOperationException(getExceptionMessage());
+ }
+
+ public Object remove(EStructuralFeature feature, int index)
+ {
+ throw new UnsupportedOperationException(getExceptionMessage());
+ }
+
+ public Object set(EStructuralFeature feature, int index, Object value)
+ {
+ throw new UnsupportedOperationException(getExceptionMessage());
+ }
+
+ public void unset(EStructuralFeature feature)
+ {
+ throw new UnsupportedOperationException(getExceptionMessage());
+ }
+
+ public Object getValue(EStructuralFeature feature)
+ {
+ throw new UnsupportedOperationException(getExceptionMessage());
+ }
+
+ public Object setValue(EStructuralFeature feature, Object value)
+ {
+ throw new UnsupportedOperationException(getExceptionMessage());
+ }
+
+ public void setList(EStructuralFeature feature, InternalCDOList list)
+ {
+ throw new UnsupportedOperationException(getExceptionMessage());
+ }
+
+ public CDOList getList(EStructuralFeature feature)
+ {
+ throw new UnsupportedOperationException(getExceptionMessage());
+ }
+
+ public CDOList getList(EStructuralFeature feature, int size)
+ {
+ throw new UnsupportedOperationException(getExceptionMessage());
+ }
+
+ public void read(CDODataInput in) throws IOException
+ {
+ throw new UnsupportedOperationException(getExceptionMessage());
+ }
+
+ public void write(CDODataOutput out, int referenceChunk) throws IOException
+ {
+ throw new UnsupportedOperationException(getExceptionMessage());
+ }
+
+ public void convertEObjects(CDOIDProvider oidProvider)
+ {
+ throw new UnsupportedOperationException(getExceptionMessage());
+ }
+
+ public int getVersion()
+ {
+ throw new UnsupportedOperationException(getExceptionMessage());
+ }
+
+ public long getRevised()
+ {
+ throw new UnsupportedOperationException(getExceptionMessage());
+ }
+
+ public InternalCDORevisionDelta compare(CDORevision origin)
+ {
+ throw new UnsupportedOperationException(getExceptionMessage());
+ }
+
+ public void merge(CDORevisionDelta delta)
+ {
+ throw new UnsupportedOperationException(getExceptionMessage());
+ }
+
+ public InternalCDORevision copy()
+ {
+ throw new UnsupportedOperationException(getExceptionMessage());
+ }
+
+ public CDOID getID()
+ {
+ throw new UnsupportedOperationException(getExceptionMessage());
+ }
+
+ public CDOBranch getBranch()
+ {
+ throw new UnsupportedOperationException(getExceptionMessage());
+ }
+
+ public long getTimeStamp()
+ {
+ throw new UnsupportedOperationException(getExceptionMessage());
+ }
+
+ public CDOID getResourceID()
+ {
+ throw new UnsupportedOperationException(getExceptionMessage());
+ }
+
+ public Object getContainerID()
+ {
+ throw new UnsupportedOperationException(getExceptionMessage());
+ }
+
+ public int getContainingFeatureID()
+ {
+ throw new UnsupportedOperationException(getExceptionMessage());
+ }
+
+ public Object get(EStructuralFeature feature, int index)
+ {
+ throw new UnsupportedOperationException(getExceptionMessage());
+ }
+
+ public int size(EStructuralFeature feature)
+ {
+ throw new UnsupportedOperationException(getExceptionMessage());
+ }
+
+ public boolean isEmpty(EStructuralFeature feature)
+ {
+ throw new UnsupportedOperationException(getExceptionMessage());
+ }
+
+ public boolean contains(EStructuralFeature feature, Object value)
+ {
+ throw new UnsupportedOperationException(getExceptionMessage());
+ }
+
+ public int indexOf(EStructuralFeature feature, Object value)
+ {
+ throw new UnsupportedOperationException(getExceptionMessage());
+ }
+
+ public int lastIndexOf(EStructuralFeature feature, Object value)
+ {
+ throw new UnsupportedOperationException(getExceptionMessage());
+ }
+
+ public <T> T[] toArray(EStructuralFeature feature, T[] array)
+ {
+ throw new UnsupportedOperationException(getExceptionMessage());
+ }
+
+ public Object[] toArray(EStructuralFeature feature)
+ {
+ throw new UnsupportedOperationException(getExceptionMessage());
+ }
+
+ public int hashCode(EStructuralFeature feature)
+ {
+ throw new UnsupportedOperationException(getExceptionMessage());
+ }
+
+ /**
+ * @since 4.0
+ */
+ public boolean adjustReferences(CDOReferenceAdjuster referenceAdjuster)
+ {
+ throw new UnsupportedOperationException(getExceptionMessage());
+ }
+
+ /**
+ * @since 4.0
+ */
+ public void freeze()
+ {
+ throw new UnsupportedOperationException(getExceptionMessage());
+ }
+
+ private String getExceptionMessage()
+ {
+ return "Unsupported operation in " + this;
+ }
+}
diff --git a/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/spi/common/revision/SyntheticCDORevision.java b/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/spi/common/revision/SyntheticCDORevision.java
index 3977035e8e..3fe2ae2dd2 100644
--- a/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/spi/common/revision/SyntheticCDORevision.java
+++ b/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/spi/common/revision/SyntheticCDORevision.java
@@ -1,70 +1,70 @@
-/*
- * Copyright (c) 2004 - 2011 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.revision;
-
-import org.eclipse.emf.cdo.common.branch.CDOBranch;
-import org.eclipse.emf.cdo.common.branch.CDOBranchVersion;
-import org.eclipse.emf.cdo.common.id.CDOID;
-import org.eclipse.emf.cdo.common.revision.CDORevisionCache;
-import org.eclipse.emf.cdo.common.revision.CDORevisionManager;
-
-import org.eclipse.emf.ecore.EClass;
-
-/**
- * A synthetic revision that represents the initial period of an object in a {@link CDOBranch branch} when the object is
- * still associated with a revision from one of the baseline branches. It always has {@link #getVersion() version}
- * {@link CDOBranchVersion#UNSPECIFIED_VERSION zero} and can only appear in branches below the
- * {@link CDOBranch#isMainBranch() main} branch.
- * <p>
- * Synthetic revisions are used for two slightly different purposes:
- * <ol>
- * <li>For {@link CDORevisionCache cache} optimization.
- * <li>As a persistent "detach marker" indicating that the first modification of an object in a branch is its deletion.
- * </ol>
- * <p>
- * Instances of this marker revision are not supposed to be exposed outside of a revision {@link CDORevisionManager
- * manager}. They are mainly used in the communication between a revision manager and its associated revision
- * {@link InternalCDORevisionManager.RevisionLoader loader}.
- *
- * @author Eike Stepper
- * @since 3.0
- */
-public abstract class SyntheticCDORevision extends StubCDORevision
-{
- private CDOID id;
-
- private CDOBranch branch;
-
- public SyntheticCDORevision(EClass eClass, CDOID id, CDOBranch branch)
- {
- super(eClass);
- this.id = id;
- this.branch = branch;
- }
-
- @Override
- public CDOID getID()
- {
- return id;
- }
-
- @Override
- public CDOBranch getBranch()
- {
- return branch;
- }
-
- @Override
- public void freeze()
- {
- // Do nothing
- }
-}
+/*
+ * Copyright (c) 2004 - 2012 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.revision;
+
+import org.eclipse.emf.cdo.common.branch.CDOBranch;
+import org.eclipse.emf.cdo.common.branch.CDOBranchVersion;
+import org.eclipse.emf.cdo.common.id.CDOID;
+import org.eclipse.emf.cdo.common.revision.CDORevisionCache;
+import org.eclipse.emf.cdo.common.revision.CDORevisionManager;
+
+import org.eclipse.emf.ecore.EClass;
+
+/**
+ * A synthetic revision that represents the initial period of an object in a {@link CDOBranch branch} when the object is
+ * still associated with a revision from one of the baseline branches. It always has {@link #getVersion() version}
+ * {@link CDOBranchVersion#UNSPECIFIED_VERSION zero} and can only appear in branches below the
+ * {@link CDOBranch#isMainBranch() main} branch.
+ * <p>
+ * Synthetic revisions are used for two slightly different purposes:
+ * <ol>
+ * <li>For {@link CDORevisionCache cache} optimization.
+ * <li>As a persistent "detach marker" indicating that the first modification of an object in a branch is its deletion.
+ * </ol>
+ * <p>
+ * Instances of this marker revision are not supposed to be exposed outside of a revision {@link CDORevisionManager
+ * manager}. They are mainly used in the communication between a revision manager and its associated revision
+ * {@link InternalCDORevisionManager.RevisionLoader loader}.
+ *
+ * @author Eike Stepper
+ * @since 3.0
+ */
+public abstract class SyntheticCDORevision extends StubCDORevision
+{
+ private CDOID id;
+
+ private CDOBranch branch;
+
+ public SyntheticCDORevision(EClass eClass, CDOID id, CDOBranch branch)
+ {
+ super(eClass);
+ this.id = id;
+ this.branch = branch;
+ }
+
+ @Override
+ public CDOID getID()
+ {
+ return id;
+ }
+
+ @Override
+ public CDOBranch getBranch()
+ {
+ return branch;
+ }
+
+ @Override
+ public void freeze()
+ {
+ // Do nothing
+ }
+}
diff --git a/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/spi/common/revision/package-info.java b/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/spi/common/revision/package-info.java
index 2936b833f3..5488739d64 100644
--- a/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/spi/common/revision/package-info.java
+++ b/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/spi/common/revision/package-info.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2004 - 2011 Eike Stepper (Berlin, Germany) and others.
+ * Copyright (c) 2004 - 2012 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

Back to the top