Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSimon McDuff2008-09-22 16:20:16 +0000
committerSimon McDuff2008-09-22 16:20:16 +0000
commitf5788715bdaab9f3fb09af5d93ef62352db683c5 (patch)
treef9a4230d36a42049c007064e7f3ed34a45562eec /plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/internal/cdo/revision
parenta3e251fc164f943083647300d293a7469e909ff9 (diff)
downloadcdo-f5788715bdaab9f3fb09af5d93ef62352db683c5.tar.gz
cdo-f5788715bdaab9f3fb09af5d93ef62352db683c5.tar.xz
cdo-f5788715bdaab9f3fb09af5d93ef62352db683c5.zip
[248017] Provide a CDOSession.setInitialReferenceChunkSize()
https://bugs.eclipse.org/bugs/show_bug.cgi?id=248017
Diffstat (limited to 'plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/internal/cdo/revision')
-rw-r--r--plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/internal/cdo/revision/CDOListReferenceProxyImpl.java88
-rw-r--r--plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/internal/cdo/revision/CDOReferenceProxy.java32
-rw-r--r--plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/internal/cdo/revision/CDOReferenceProxyImpl.java55
3 files changed, 175 insertions, 0 deletions
diff --git a/plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/internal/cdo/revision/CDOListReferenceProxyImpl.java b/plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/internal/cdo/revision/CDOListReferenceProxyImpl.java
new file mode 100644
index 0000000000..69d3a01343
--- /dev/null
+++ b/plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/internal/cdo/revision/CDOListReferenceProxyImpl.java
@@ -0,0 +1,88 @@
+/***************************************************************************
+ * Copyright (c) 2004 - 2008 Eike Stepper, Germany.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Simon McDuff - initial API and implementation
+ **************************************************************************/
+package org.eclipse.emf.internal.cdo.revision;
+
+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.internal.common.revision.CDOListImpl;
+import org.eclipse.emf.cdo.spi.common.InternalCDOList;
+import org.eclipse.emf.cdo.spi.common.InternalCDORevision;
+
+/**
+ * @author Simon McDuff
+ */
+public class CDOListReferenceProxyImpl extends CDOListImpl
+{
+
+ public static final CDOListFactory FACTORY = new CDOListFactory()
+ {
+ public CDOList createList(int initialCapacity, int size, int initialChunk)
+ {
+ return new CDOListReferenceProxyImpl(initialCapacity, size, initialChunk);
+ }
+ };
+
+ private static final long serialVersionUID = 1L;
+
+ public CDOListReferenceProxyImpl(int initialCapacity, int size, int initialChunk)
+ {
+ super(initialCapacity, initialChunk);
+ for (int j = initialChunk; j < size; j++)
+ {
+ this.add(new CDOReferenceProxyImpl(j));
+ }
+ }
+
+ @Override
+ public Object get(int index, boolean resolve)
+ {
+ if (resolve == true)
+ {
+ return get(index);
+ }
+
+ Object element = super.get(index);
+
+ return element instanceof CDOReferenceProxy ? InternalCDORevision.UNINITIALIZED : element;
+ }
+
+ @Override
+ protected void handleAdjustReference(int index, Object element)
+ {
+ if (element instanceof CDOReferenceProxy)
+ {
+ ((CDOReferenceProxyImpl)element).setIndex(index);
+ }
+ }
+
+ @Override
+ public InternalCDOList clone(CDOType type)
+ {
+ int size = size();
+ InternalCDOList list = new CDOListReferenceProxyImpl(size, 0, 0);
+ for (int j = 0; j < size; j++)
+ {
+ Object value = this.get(j);
+
+ if (value instanceof CDOReferenceProxy)
+ {
+ list.add(j, new CDOReferenceProxyImpl(((CDOReferenceProxy)value).getIndex()));
+ }
+ else
+ {
+ list.add(j, type.copyValue(value));
+ }
+ }
+
+ return list;
+ }
+}
diff --git a/plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/internal/cdo/revision/CDOReferenceProxy.java b/plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/internal/cdo/revision/CDOReferenceProxy.java
new file mode 100644
index 0000000000..32492e81e7
--- /dev/null
+++ b/plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/internal/cdo/revision/CDOReferenceProxy.java
@@ -0,0 +1,32 @@
+/***************************************************************************
+ * Copyright (c) 2004 - 2008 Eike Stepper, Germany.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Eike Stepper - initial API and implementation
+ * Simon McDuff - maintenance
+ **************************************************************************/
+package org.eclipse.emf.internal.cdo.revision;
+
+import org.eclipse.emf.cdo.CDORevisionManager;
+import org.eclipse.emf.cdo.common.id.CDOID;
+import org.eclipse.emf.cdo.common.model.CDOFeature;
+import org.eclipse.emf.cdo.common.revision.CDORevision;
+
+/**
+ * @author Eike Stepper
+ * @noimplement This interface is not intended to be implemented by clients.
+ */
+public interface CDOReferenceProxy
+{
+ public int getIndex();
+
+ /**
+ * @since 2.0
+ */
+ public CDOID resolve(CDORevisionManager revisionManager, CDORevision revision, CDOFeature feature, int index);
+
+}
diff --git a/plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/internal/cdo/revision/CDOReferenceProxyImpl.java b/plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/internal/cdo/revision/CDOReferenceProxyImpl.java
new file mode 100644
index 0000000000..80035b5313
--- /dev/null
+++ b/plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/internal/cdo/revision/CDOReferenceProxyImpl.java
@@ -0,0 +1,55 @@
+/***************************************************************************
+ * Copyright (c) 2004 - 2008 Eike Stepper, Germany.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Eike Stepper - initial API and implementation
+ * Simon McDuff - maintenance
+ **************************************************************************/
+package org.eclipse.emf.internal.cdo.revision;
+
+import org.eclipse.emf.cdo.CDORevisionManager;
+import org.eclipse.emf.cdo.common.id.CDOID;
+import org.eclipse.emf.cdo.common.model.CDOFeature;
+import org.eclipse.emf.cdo.common.revision.CDORevision;
+
+import org.eclipse.emf.internal.cdo.CDORevisionManagerImpl;
+
+import java.text.MessageFormat;
+
+/**
+ * @author Eike Stepper
+ */
+public final class CDOReferenceProxyImpl implements CDOReferenceProxy
+{
+ private int index;
+
+ public CDOReferenceProxyImpl(int index)
+ {
+ this.index = index;
+ }
+
+ public int getIndex()
+ {
+ return index;
+ }
+
+ public void setIndex(int index)
+ {
+ this.index = index;
+ }
+
+ public CDOID resolve(CDORevisionManager revisionManager, CDORevision revision, CDOFeature feature, int index)
+ {
+ return ((CDORevisionManagerImpl)revisionManager).resolveReferenceProxy(revision, feature, index, getIndex());
+ }
+
+ @Override
+ public String toString()
+ {
+ return MessageFormat.format("CDOReferenceProxy[{0}]", index);
+ }
+}

Back to the top