Skip to main content
aboutsummaryrefslogtreecommitdiffstats
blob: b2c586d81c7008398ecf83a5ce268a6c303faa12 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
/*
 * Copyright (c) 2009-2014 Eike Stepper (Berlin, Germany) and others.
 * All rights reserved. This program and the accompanying materials
 * are made available under the terms of the Eclipse Public License v1.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.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.security.CDOPermission;
import org.eclipse.emf.cdo.spi.common.branch.CDOBranchAdjustable;
import org.eclipse.emf.cdo.spi.common.branch.InternalCDOBranch;
import org.eclipse.emf.cdo.spi.common.model.InternalCDOClassInfo;

import org.eclipse.emf.ecore.EStructuralFeature;

import java.io.IOException;
import java.util.List;

/**
 * If the meaning of this type isn't clear, there really should be more of a description here...
 *
 * @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 InternalCDORevision extends CDORevision, CDORevisionData, CDOReferenceAdjustable, CDOBranchAdjustable
{
  /**
   * @since 4.7
   */
  public static final int DO_NOT_CREATE_LIST = -1;

  /**
   * @since 4.2
   */
  public InternalCDOClassInfo getClassInfo();

  /**
   * @since 4.2
   */
  public InternalCDOBranch getBranch();

  /**
   * @since 4.2
   */
  public InternalCDORevision getRevisionForID(CDOID id);

  /**
   * @since 4.2
   */
  public InternalCDORevision getProperRevision();

  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);

  /**
   * @deprecated As of 4.7 use either {@link #getListOrNull(EStructuralFeature)} or {@link #getOrCreateList(EStructuralFeature)}.
   */
  @Deprecated
  public CDOList getList(EStructuralFeature feature);

  /**
   * @deprecated As of 4.7 use either {@link #getListOrNull(EStructuralFeature)} or {@link #getOrCreateList(EStructuralFeature, int)}.
   */
  @Deprecated
  public CDOList getList(EStructuralFeature feature, int initialCapacity);

  /**
   * @since 4.7
   */
  public CDOList getListOrNull(EStructuralFeature feature);

  /**
   * Same as {@link #getOrCreateList(EStructuralFeature, int) getOrCreateList(feature, 0)}.
   * <p>
   * <b>Warning</b>: Must be used with caution because list creation for an {@link EStructuralFeature#isUnsettable() unsettable}
   * feature implies a transition from UNSET to SET!
   *
   * @since 4.7
   */
  public CDOList getOrCreateList(EStructuralFeature feature);

  /**
   * Returns the list that represents the passed feature, possibly creates it if needed.
   * <p>
   * <b>Warning</b>: Must be used with caution because list creation for an {@link EStructuralFeature#isUnsettable() unsettable}
   * feature implies a transition from UNSET to SET!
   *
   * @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.
   *
   * @see #DO_NOT_CREATE_LIST
   * @since 4.7
   */
  public CDOList getOrCreateList(EStructuralFeature feature, int initialCapacity);

  /**
   * @since 3.0
   */
  public void read(CDODataInput in) throws IOException;

  /**
   * @since 4.3
   */
  public boolean readValues(CDODataInput in) throws IOException;

  /**
   * @since 3.0
   */
  public void write(CDODataOutput out, int referenceChunk) throws IOException;

  /**
   * @since 4.1
   */
  public void write(CDODataOutput out, int referenceChunk, CDOBranchPoint securityContext) throws IOException;

  /**
   * @since 4.3
   */
  public void writeValues(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.2
   */
  public EStructuralFeature[] clearValues();

  /**
   * @since 4.3
   */
  public String getResourceNodeName();

  /**
   * @since 4.1
   */
  public void setPermission(CDOPermission permission);

  /**
   * Enables or disables permission checking for this revision.
   * <p>
   * This method is used on the client side if the framework changes the revision on another
   * user's behalf, e.g., during invalidation or general revision copying. It's safe to offer this method
   * on the client side because the server is always the permission checking authority (during load or commit).
   *
   * @since 4.3
   */
  public boolean bypassPermissionChecks(boolean on);

  /**
   * @since 4.3
   */
  public boolean isListPreserving();

  /**
   * The default behavior of a revision for calls to the {@link #clear(EStructuralFeature)} and
   * {@link #unset(EStructuralFeature)} methods is to set the feature's value to null (discarding the
   * value itself, a List). By calling this {@link #setListPreserving()} method the default behavior
   * is changed; instead of setting the feature's value to null, the {@link List#clear()} method is
   * called on the feature's list instance.
   *
   * @since 4.3
   */
  public void setListPreserving();

  /**
   * @since 4.0
   */
  public void freeze();

  /**
   * @since 4.2
   */
  public boolean isFrozen();

  /**
   * @since 4.1
   */
  public boolean isUnchunked();

  /**
   * @since 4.1
   */
  public void setUnchunked();
}

Back to the top