diff options
Diffstat (limited to 'plugins/org.eclipse.emf.cdo.server.db/src/org/eclipse/emf/cdo/server/internal/db/mapping/horizontal/HorizontalNonAuditClassMapping.java')
-rw-r--r-- | plugins/org.eclipse.emf.cdo.server.db/src/org/eclipse/emf/cdo/server/internal/db/mapping/horizontal/HorizontalNonAuditClassMapping.java | 98 |
1 files changed, 16 insertions, 82 deletions
diff --git a/plugins/org.eclipse.emf.cdo.server.db/src/org/eclipse/emf/cdo/server/internal/db/mapping/horizontal/HorizontalNonAuditClassMapping.java b/plugins/org.eclipse.emf.cdo.server.db/src/org/eclipse/emf/cdo/server/internal/db/mapping/horizontal/HorizontalNonAuditClassMapping.java index 2879544040..5bf405e926 100644 --- a/plugins/org.eclipse.emf.cdo.server.db/src/org/eclipse/emf/cdo/server/internal/db/mapping/horizontal/HorizontalNonAuditClassMapping.java +++ b/plugins/org.eclipse.emf.cdo.server.db/src/org/eclipse/emf/cdo/server/internal/db/mapping/horizontal/HorizontalNonAuditClassMapping.java @@ -19,14 +19,8 @@ import org.eclipse.emf.cdo.common.branch.CDOBranchVersion; import org.eclipse.emf.cdo.common.id.CDOID; import org.eclipse.emf.cdo.common.revision.CDOList; 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.CDOClearFeatureDelta; import org.eclipse.emf.cdo.common.revision.delta.CDOContainerFeatureDelta; -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.CDORevisionDelta; import org.eclipse.emf.cdo.common.revision.delta.CDOSetFeatureDelta; import org.eclipse.emf.cdo.common.revision.delta.CDOUnsetFeatureDelta; import org.eclipse.emf.cdo.eresource.EresourcePackage; @@ -88,15 +82,6 @@ public class HorizontalNonAuditClassMapping extends AbstractHorizontalClassMappi private boolean hasLists; - private ThreadLocal<FeatureDeltaWriter> deltaWriter = new ThreadLocal<FeatureDeltaWriter>() - { - @Override - protected FeatureDeltaWriter initialValue() - { - return new FeatureDeltaWriter(); - } - }; - public HorizontalNonAuditClassMapping(AbstractHorizontalMappingStrategy mappingStrategy, EClass eClass) { super(mappingStrategy, eClass); @@ -508,7 +493,8 @@ public class HorizontalNonAuditClassMapping extends AbstractHorizontalClassMappi try { async = monitor.forkAsync(); - FeatureDeltaWriter writer = deltaWriter.get(); + + FeatureDeltaWriter writer = new FeatureDeltaWriter(); writer.process(accessor, delta, created); } finally @@ -528,22 +514,16 @@ public class HorizontalNonAuditClassMapping extends AbstractHorizontalClassMappi /** * @author Eike Stepper */ - private class FeatureDeltaWriter implements CDOFeatureDeltaVisitor + private final class FeatureDeltaWriter extends AbstractFeatureDeltaWriter { - private CDOID id; - - private int oldVersion; + private final List<Pair<ITypeMapping, Object>> attributeChanges = new ArrayList<Pair<ITypeMapping, Object>>(); - private long created; + private final List<Pair<EStructuralFeature, Integer>> listSizeChanges = new ArrayList<Pair<EStructuralFeature, Integer>>(); - private IDBStoreAccessor accessor; + private int oldVersion; private boolean updateContainer; - private List<Pair<ITypeMapping, Object>> attributeChanges; - - private List<Pair<EStructuralFeature, Integer>> listSizeChanges; - private int newContainingFeatureID; private CDOID newContainerID; @@ -554,48 +534,20 @@ public class HorizontalNonAuditClassMapping extends AbstractHorizontalClassMappi private int newVersion; - public FeatureDeltaWriter() - { - attributeChanges = new ArrayList<Pair<ITypeMapping, Object>>(); - listSizeChanges = new ArrayList<Pair<EStructuralFeature, Integer>>(); - } - - protected void reset() - { - attributeChanges.clear(); - listSizeChanges.clear(); - updateContainer = false; - } - - public void process(IDBStoreAccessor accessor, CDORevisionDelta delta, long created) + @Override + protected void doProcess(InternalCDORevisionDelta delta) { - try - { - // Set context - id = delta.getID(); + // Set context + id = delta.getID(); - branchId = delta.getBranch().getID(); - oldVersion = delta.getVersion(); - newVersion = oldVersion + 1; - this.created = created; - this.accessor = accessor; + branchId = delta.getBranch().getID(); + oldVersion = delta.getVersion(); + newVersion = oldVersion + 1; - // Process revision delta tree - delta.accept(this); + // Process revision delta tree + delta.accept(this); - updateAttributes(); - } - finally - { - // Clean up - reset(); - } - } - - @Deprecated - public void visit(CDOMoveFeatureDelta delta) - { - throw new ImplementationError("Should not be called"); //$NON-NLS-1$ + updateAttributes(); } public void visit(CDOSetFeatureDelta delta) @@ -644,24 +596,6 @@ public class HorizontalNonAuditClassMapping extends AbstractHorizontalClassMappi } } - @Deprecated - public void visit(CDOClearFeatureDelta delta) - { - throw new ImplementationError("Should not be called"); //$NON-NLS-1$ - } - - @Deprecated - public void visit(CDOAddFeatureDelta delta) - { - throw new ImplementationError("Should not be called"); //$NON-NLS-1$ - } - - @Deprecated - public void visit(CDORemoveFeatureDelta delta) - { - throw new ImplementationError("Should not be called"); //$NON-NLS-1$ - } - public void visit(CDOContainerFeatureDelta delta) { newContainingFeatureID = delta.getContainerFeatureID(); |