View | Details | Raw Unified | Return to bug 257270 | Differences between
and this patch

Collapse All | Expand All

(-)src/org/eclipse/emf/cdo/internal/server/Session.java (-1 / +11 lines)
Lines 14-19 Link Here
14
 **************************************************************************/
14
 **************************************************************************/
15
package org.eclipse.emf.cdo.internal.server;
15
package org.eclipse.emf.cdo.internal.server;
16
16
17
import org.eclipse.emf.cdo.common.CDOProtocolSession;
17
import org.eclipse.emf.cdo.common.id.CDOID;
18
import org.eclipse.emf.cdo.common.id.CDOID;
18
import org.eclipse.emf.cdo.common.id.CDOIDAndVersion;
19
import org.eclipse.emf.cdo.common.id.CDOIDAndVersion;
19
import org.eclipse.emf.cdo.common.id.CDOIDProvider;
20
import org.eclipse.emf.cdo.common.id.CDOIDProvider;
Lines 56-62 Link Here
56
/**
57
/**
57
 * @author Eike Stepper
58
 * @author Eike Stepper
58
 */
59
 */
59
public class Session extends Container<IView> implements ISession, CDOIDProvider, CDOPackageURICompressor
60
public class Session extends Container<IView> implements ISession, CDOIDProvider, CDOPackageURICompressor,
61
    CDOProtocolSession.Options
60
{
62
{
61
  private SessionManager sessionManager;
63
  private SessionManager sessionManager;
62
64
Lines 102-107 Link Here
102
    }
104
    }
103
  }
105
  }
104
106
107
  /**
108
   * @since 2.0
109
   */
110
  public Options getOptions()
111
  {
112
    return this;
113
  }
114
105
  public SessionManager getSessionManager()
115
  public SessionManager getSessionManager()
106
  {
116
  {
107
    return sessionManager;
117
    return sessionManager;
(-)src/org/eclipse/emf/cdo/common/CDOProtocolSession.java (-3 / +11 lines)
Lines 27-41 Link Here
27
  /**
27
  /**
28
   * @since 2.0
28
   * @since 2.0
29
   */
29
   */
30
  public boolean isPassiveUpdateEnabled();
30
  public void close();
31
31
32
  /**
32
  /**
33
   * @since 2.0
33
   * @since 2.0
34
   */
34
   */
35
  public void close();
35
  public boolean isClosed();
36
36
37
  /**
37
  /**
38
   * @since 2.0
38
   * @since 2.0
39
   */
39
   */
40
  public boolean isClosed();
40
  public Options getOptions();
41
42
  /**
43
   * @since 2.0
44
   */
45
  public interface Options
46
  {
47
    public boolean isPassiveUpdateEnabled();
48
  }
41
}
49
}
(-)src/org/eclipse/emf/cdo/tests/AdapterManagerTest.java (-15 / +15 lines)
Lines 37-43 Link Here
37
    msg("Opening session");
37
    msg("Opening session");
38
    final CDOSession session = openModel1Session();
38
    final CDOSession session = openModel1Session();
39
39
40
    session.setPassiveUpdateEnabled(false);
40
    session.getOptions().setPassiveUpdateEnabled(false);
41
41
42
    // ************************************************************* //
42
    // ************************************************************* //
43
43
Lines 46-52 Link Here
46
    TestAdapter testAdapter = new TestAdapter();
46
    TestAdapter testAdapter = new TestAdapter();
47
    msg("Opening transaction");
47
    msg("Opening transaction");
48
    CDOTransaction transaction = session.openTransaction();
48
    CDOTransaction transaction = session.openTransaction();
49
    transaction.setCacheReferenceType(ReferenceType.WEAK);
49
    transaction.getOptions().setCacheReferenceType(ReferenceType.WEAK);
50
50
51
    transaction.createResource("/resA").getContents().add(companyA);
51
    transaction.createResource("/resA").getContents().add(companyA);
52
52
Lines 71-77 Link Here
71
    msg("Opening session");
71
    msg("Opening session");
72
    final CDOSession session = openModel1Session();
72
    final CDOSession session = openModel1Session();
73
73
74
    session.setPassiveUpdateEnabled(false);
74
    session.getOptions().setPassiveUpdateEnabled(false);
75
75
76
    // ************************************************************* //
76
    // ************************************************************* //
77
77
Lines 80-87 Link Here
80
    TestAdapter testAdapter = new TestAdapter();
80
    TestAdapter testAdapter = new TestAdapter();
81
    msg("Opening transaction");
81
    msg("Opening transaction");
82
    CDOTransaction transaction = session.openTransaction();
82
    CDOTransaction transaction = session.openTransaction();
83
    transaction.setCacheReferenceType(ReferenceType.WEAK);
83
    transaction.getOptions().setCacheReferenceType(ReferenceType.WEAK);
84
    transaction.setStrongReferencePolicy(CDOAdapterPolicy.ALL);
84
    transaction.getOptions().setStrongReferencePolicy(CDOAdapterPolicy.ALL);
85
85
86
    transaction.createResource("/resA").getContents().add(companyA);
86
    transaction.createResource("/resA").getContents().add(companyA);
87
87
Lines 107-113 Link Here
107
    msg("Opening session");
107
    msg("Opening session");
108
    final CDOSession session = openModel1Session();
108
    final CDOSession session = openModel1Session();
109
109
110
    session.setPassiveUpdateEnabled(false);
110
    session.getOptions().setPassiveUpdateEnabled(false);
111
111
112
    // ************************************************************* //
112
    // ************************************************************* //
113
113
Lines 119-126 Link Here
119
119
120
    msg("Opening transaction");
120
    msg("Opening transaction");
121
    CDOTransaction transaction = session.openTransaction();
121
    CDOTransaction transaction = session.openTransaction();
122
    transaction.setCacheReferenceType(ReferenceType.WEAK);
122
    transaction.getOptions().setCacheReferenceType(ReferenceType.WEAK);
123
    transaction.setStrongReferencePolicy(CDOAdapterPolicy.ALL);
123
    transaction.getOptions().setStrongReferencePolicy(CDOAdapterPolicy.ALL);
124
124
125
    transaction.createResource("/resA").getContents().add(companyA);
125
    transaction.createResource("/resA").getContents().add(companyA);
126
126
Lines 146-152 Link Here
146
    msg("Opening session");
146
    msg("Opening session");
147
    final CDOSession session = openModel1Session();
147
    final CDOSession session = openModel1Session();
148
148
149
    session.setPassiveUpdateEnabled(false);
149
    session.getOptions().setPassiveUpdateEnabled(false);
150
150
151
    // ************************************************************* //
151
    // ************************************************************* //
152
152
Lines 160-167 Link Here
160
160
161
    msg("Opening transaction");
161
    msg("Opening transaction");
162
    CDOTransaction transaction = session.openTransaction();
162
    CDOTransaction transaction = session.openTransaction();
163
    transaction.setCacheReferenceType(ReferenceType.WEAK);
163
    transaction.getOptions().setCacheReferenceType(ReferenceType.WEAK);
164
    transaction.setStrongReferencePolicy(CDOAdapterPolicy.ALL);
164
    transaction.getOptions().setStrongReferencePolicy(CDOAdapterPolicy.ALL);
165
165
166
    transaction.createResource("/resA").getContents().add(companyA);
166
    transaction.createResource("/resA").getContents().add(companyA);
167
167
Lines 192-198 Link Here
192
    msg("Opening session");
192
    msg("Opening session");
193
    final CDOSession session = openModel1Session();
193
    final CDOSession session = openModel1Session();
194
194
195
    session.setPassiveUpdateEnabled(false);
195
    session.getOptions().setPassiveUpdateEnabled(false);
196
196
197
    // ************************************************************* //
197
    // ************************************************************* //
198
198
Lines 204-223 Link Here
204
204
205
    msg("Opening transaction");
205
    msg("Opening transaction");
206
    CDOTransaction transaction = session.openTransaction();
206
    CDOTransaction transaction = session.openTransaction();
207
    transaction.setCacheReferenceType(ReferenceType.WEAK);
207
    transaction.getOptions().setCacheReferenceType(ReferenceType.WEAK);
208
    transaction.createResource("/resA").getContents().add(companyA);
208
    transaction.createResource("/resA").getContents().add(companyA);
209
209
210
    msg("Committing");
210
    msg("Committing");
211
    transaction.commit();
211
    transaction.commit();
212
    CDOID id = CDOUtil.getCDOObject(companyA).cdoID();
212
    CDOID id = CDOUtil.getCDOObject(companyA).cdoID();
213
    transaction.setStrongReferencePolicy(CDOAdapterPolicy.ALL);
213
    transaction.getOptions().setStrongReferencePolicy(CDOAdapterPolicy.ALL);
214
    companyA = null;
214
    companyA = null;
215
215
216
    testAdapter.getNotifications().clear();
216
    testAdapter.getNotifications().clear();
217
    System.gc();
217
    System.gc();
218
218
219
    assertEquals(true, transaction.isObjectRegistered(id));
219
    assertEquals(true, transaction.isObjectRegistered(id));
220
    transaction.setStrongReferencePolicy(CDOAdapterPolicy.NONE);
220
    transaction.getOptions().setStrongReferencePolicy(CDOAdapterPolicy.NONE);
221
221
222
    System.gc();
222
    System.gc();
223
223
(-)src/org/eclipse/emf/cdo/tests/ChunkingTest.java (-5 / +5 lines)
Lines 56-62 Link Here
56
    // ************************************************************* //
56
    // ************************************************************* //
57
57
58
    CDOSession session = openModel1Session();
58
    CDOSession session = openModel1Session();
59
    session.setCollectionLoadingPolicy(CDOUtil.createCollectionLoadingPolicy(10, 10));
59
    session.getOptions().setCollectionLoadingPolicy(CDOUtil.createCollectionLoadingPolicy(10, 10));
60
60
61
    CDOTransaction transaction = session.openTransaction();
61
    CDOTransaction transaction = session.openTransaction();
62
    CDOResource resource = transaction.getResource("/test1");
62
    CDOResource resource = transaction.getResource("/test1");
Lines 101-107 Link Here
101
    // ************************************************************* //
101
    // ************************************************************* //
102
102
103
    CDOSession session = openModel1Session();
103
    CDOSession session = openModel1Session();
104
    session.setCollectionLoadingPolicy(CDOUtil.createCollectionLoadingPolicy(10, 10));
104
    session.getOptions().setCollectionLoadingPolicy(CDOUtil.createCollectionLoadingPolicy(10, 10));
105
105
106
    CDOTransaction transaction = session.openTransaction();
106
    CDOTransaction transaction = session.openTransaction();
107
    CDOResource resource = transaction.getResource("/test1");
107
    CDOResource resource = transaction.getResource("/test1");
Lines 142-148 Link Here
142
    CDOSession session = openModel1Session();
142
    CDOSession session = openModel1Session();
143
143
144
    CDOTransaction transaction = session.openTransaction();
144
    CDOTransaction transaction = session.openTransaction();
145
    transaction.setRevisionPrefetchingPolicy(CDOUtil.createRevisionPrefetchingPolicy(10));
145
    transaction.getOptions().setRevisionPrefetchingPolicy(CDOUtil.createRevisionPrefetchingPolicy(10));
146
146
147
    CDOResource resource = transaction.getResource("/test1");
147
    CDOResource resource = transaction.getResource("/test1");
148
148
Lines 179-185 Link Here
179
    // ************************************************************* //
179
    // ************************************************************* //
180
180
181
    CDOSession session = openModel1Session();
181
    CDOSession session = openModel1Session();
182
    session.setCollectionLoadingPolicy(CDOUtil.createCollectionLoadingPolicy(10, 10));
182
    session.getOptions().setCollectionLoadingPolicy(CDOUtil.createCollectionLoadingPolicy(10, 10));
183
183
184
    CDOTransaction transaction = session.openTransaction();
184
    CDOTransaction transaction = session.openTransaction();
185
    CDOResource resource = transaction.getResource("/test1");
185
    CDOResource resource = transaction.getResource("/test1");
Lines 221-227 Link Here
221
    // ************************************************************* //
221
    // ************************************************************* //
222
222
223
    CDOSession session = openModel1Session();
223
    CDOSession session = openModel1Session();
224
    session.setCollectionLoadingPolicy(CDOUtil.createCollectionLoadingPolicy(10, 10));
224
    session.getOptions().setCollectionLoadingPolicy(CDOUtil.createCollectionLoadingPolicy(10, 10));
225
225
226
    msg("Creating resource");
226
    msg("Creating resource");
227
    CDOTransaction transaction = session.openTransaction();
227
    CDOTransaction transaction = session.openTransaction();
(-)src/org/eclipse/emf/cdo/tests/MultiValuedOfAttributeTest.java (-1 / +1 lines)
Lines 200-206 Link Here
200
200
201
    {
201
    {
202
      CDOSession session = openSession(getModel5Package());
202
      CDOSession session = openSession(getModel5Package());
203
      session.setCollectionLoadingPolicy(CDOUtil.createCollectionLoadingPolicy(0, 100));
203
      session.getOptions().setCollectionLoadingPolicy(CDOUtil.createCollectionLoadingPolicy(0, 100));
204
      CDOTransaction transaction = session.openTransaction();
204
      CDOTransaction transaction = session.openTransaction();
205
      CDOResource resource = transaction.getResource("/res1");
205
      CDOResource resource = transaction.getResource("/res1");
206
206
(-)src/org/eclipse/emf/cdo/tests/InvalidationTest.java (-7 / +7 lines)
Lines 589-595 Link Here
589
    msg("Opening sessionB");
589
    msg("Opening sessionB");
590
    final CDOSession sessionB = openModel1Session();
590
    final CDOSession sessionB = openModel1Session();
591
591
592
    sessionB.setPassiveUpdateEnabled(false);
592
    sessionB.getOptions().setPassiveUpdateEnabled(false);
593
593
594
    msg("Attaching viewB");
594
    msg("Attaching viewB");
595
    final CDOView viewB = sessionB.openTransaction();
595
    final CDOView viewB = sessionB.openTransaction();
Lines 668-674 Link Here
668
    msg("Opening sessionB");
668
    msg("Opening sessionB");
669
    final CDOSession sessionB = openModel1Session();
669
    final CDOSession sessionB = openModel1Session();
670
670
671
    sessionB.setPassiveUpdateEnabled(false);
671
    sessionB.getOptions().setPassiveUpdateEnabled(false);
672
672
673
    msg("Attaching viewB");
673
    msg("Attaching viewB");
674
    final CDOView viewB = sessionB.openTransaction();
674
    final CDOView viewB = sessionB.openTransaction();
Lines 679-685 Link Here
679
    msg("Opening sessionB");
679
    msg("Opening sessionB");
680
    final CDOSession sessionC = openModel1Session();
680
    final CDOSession sessionC = openModel1Session();
681
681
682
    assertEquals(true, sessionC.isPassiveUpdateEnabled());
682
    assertEquals(true, sessionC.getOptions().isPassiveUpdateEnabled());
683
683
684
    msg("Attaching viewB");
684
    msg("Attaching viewB");
685
    final CDOView viewC = sessionC.openTransaction();
685
    final CDOView viewC = sessionC.openTransaction();
Lines 719-725 Link Here
719
    assertEquals(false, timeOuterC.timedOut());
719
    assertEquals(false, timeOuterC.timedOut());
720
720
721
    // It should refresh the session
721
    // It should refresh the session
722
    sessionB.setPassiveUpdateEnabled(true);
722
    sessionB.getOptions().setPassiveUpdateEnabled(true);
723
723
724
    msg("Checking after sync");
724
    msg("Checking after sync");
725
    assertEquals(false, timeOuterB.timedOut());
725
    assertEquals(false, timeOuterB.timedOut());
Lines 784-790 Link Here
784
784
785
    msg("Attaching viewB");
785
    msg("Attaching viewB");
786
    final CDOView viewB = sessionB.openTransaction();
786
    final CDOView viewB = sessionB.openTransaction();
787
    viewB.setInvalidationNotificationEnabled(true);
787
    viewB.getOptions().setInvalidationNotificationEnabled(true);
788
788
789
    msg("Loading resource");
789
    msg("Loading resource");
790
    final CDOResource resourceB = viewB.getResource("/test1");
790
    final CDOResource resourceB = viewB.getResource("/test1");
Lines 864-874 Link Here
864
864
865
    msg("Opening sessionB");
865
    msg("Opening sessionB");
866
    final CDOSession sessionB = openModel1Session();
866
    final CDOSession sessionB = openModel1Session();
867
    sessionB.setPassiveUpdateEnabled(false);
867
    sessionB.getOptions().setPassiveUpdateEnabled(false);
868
868
869
    msg("Attaching viewB");
869
    msg("Attaching viewB");
870
    final CDOView viewB = sessionB.openTransaction();
870
    final CDOView viewB = sessionB.openTransaction();
871
    viewB.setInvalidationNotificationEnabled(true);
871
    viewB.getOptions().setInvalidationNotificationEnabled(true);
872
872
873
    msg("Loading resource");
873
    msg("Loading resource");
874
    final CDOResource resourceB = viewB.getResource("/test1");
874
    final CDOResource resourceB = viewB.getResource("/test1");
(-)src/org/eclipse/emf/cdo/tests/ViewTest.java (-8 / +8 lines)
Lines 97-103 Link Here
97
    }
97
    }
98
98
99
    CDOSession session = openModel1Session();
99
    CDOSession session = openModel1Session();
100
    session.setCollectionLoadingPolicy(CDOUtil.createCollectionLoadingPolicy(2, 2));
100
    session.getOptions().setCollectionLoadingPolicy(CDOUtil.createCollectionLoadingPolicy(2, 2));
101
101
102
    CDOTransaction transaction = session.openTransaction();
102
    CDOTransaction transaction = session.openTransaction();
103
103
Lines 137-143 Link Here
137
    }
137
    }
138
138
139
    CDOSession session = openModel1Session();
139
    CDOSession session = openModel1Session();
140
    session.setCollectionLoadingPolicy(CDOUtil.createCollectionLoadingPolicy(2, 2));
140
    session.getOptions().setCollectionLoadingPolicy(CDOUtil.createCollectionLoadingPolicy(2, 2));
141
141
142
    CDOTransaction transaction = session.openTransaction();
142
    CDOTransaction transaction = session.openTransaction();
143
143
Lines 229-250 Link Here
229
    transaction.createResource("/my/test5");
229
    transaction.createResource("/my/test5");
230
230
231
    boolean done;
231
    boolean done;
232
    done = transaction.setCacheReferenceType(ReferenceType.SOFT);
232
    done = transaction.getOptions().setCacheReferenceType(ReferenceType.SOFT);
233
    assertEquals(false, done);
233
    assertEquals(false, done);
234
234
235
    done = transaction.setCacheReferenceType(null);
235
    done = transaction.getOptions().setCacheReferenceType(null);
236
    assertEquals(false, done);
236
    assertEquals(false, done);
237
237
238
    done = transaction.setCacheReferenceType(ReferenceType.STRONG);
238
    done = transaction.getOptions().setCacheReferenceType(ReferenceType.STRONG);
239
    assertEquals(true, done);
239
    assertEquals(true, done);
240
240
241
    done = transaction.setCacheReferenceType(ReferenceType.SOFT);
241
    done = transaction.getOptions().setCacheReferenceType(ReferenceType.SOFT);
242
    assertEquals(true, done);
242
    assertEquals(true, done);
243
243
244
    done = transaction.setCacheReferenceType(ReferenceType.WEAK);
244
    done = transaction.getOptions().setCacheReferenceType(ReferenceType.WEAK);
245
    assertEquals(true, done);
245
    assertEquals(true, done);
246
246
247
    done = transaction.setCacheReferenceType(null);
247
    done = transaction.getOptions().setCacheReferenceType(null);
248
    assertEquals(true, done);
248
    assertEquals(true, done);
249
249
250
    session.close();
250
    session.close();
(-)src/org/eclipse/emf/cdo/tests/ChunkingWithMEMTest.java (-2 / +2 lines)
Lines 69-75 Link Here
69
69
70
    msg("Opening session");
70
    msg("Opening session");
71
    CDOSession session = openModel1Session();
71
    CDOSession session = openModel1Session();
72
    session.setCollectionLoadingPolicy(CDOUtil.createCollectionLoadingPolicy(10, 10));
72
    session.getOptions().setCollectionLoadingPolicy(CDOUtil.createCollectionLoadingPolicy(10, 10));
73
73
74
    msg("Attaching transaction");
74
    msg("Attaching transaction");
75
    CDOTransaction transaction = session.openTransaction();
75
    CDOTransaction transaction = session.openTransaction();
Lines 128-134 Link Here
128
128
129
    msg("Opening session");
129
    msg("Opening session");
130
    CDOSession session = openModel1Session();
130
    CDOSession session = openModel1Session();
131
    session.setCollectionLoadingPolicy(CDOUtil.createCollectionLoadingPolicy(10, 10));
131
    session.getOptions().setCollectionLoadingPolicy(CDOUtil.createCollectionLoadingPolicy(10, 10));
132
132
133
    msg("Attaching transaction");
133
    msg("Attaching transaction");
134
    CDOTransaction transaction = session.openTransaction();
134
    CDOTransaction transaction = session.openTransaction();
(-)src/org/eclipse/emf/cdo/tests/FetchRuleAnalyzerTest.java (-1 / +1 lines)
Lines 95-101 Link Here
95
    InternalCDOTransaction transaction = (InternalCDOTransaction)session.openTransaction();
95
    InternalCDOTransaction transaction = (InternalCDOTransaction)session.openTransaction();
96
    CDOFeatureAnalyzerModelBased featureanalyzerModelBased = new CDOFeatureAnalyzerModelBased();
96
    CDOFeatureAnalyzerModelBased featureanalyzerModelBased = new CDOFeatureAnalyzerModelBased();
97
    transaction.setFeatureAnalyzer(featureanalyzerModelBased);
97
    transaction.setFeatureAnalyzer(featureanalyzerModelBased);
98
    transaction.setRevisionPrefetchingPolicy(CDOUtil.createRevisionPrefetchingPolicy(10));
98
    transaction.getOptions().setRevisionPrefetchingPolicy(CDOUtil.createRevisionPrefetchingPolicy(10));
99
99
100
    msg("Getting resource");
100
    msg("Getting resource");
101
101
(-)src/org/eclipse/emf/cdo/tests/LockingManagerTest.java (-4 / +4 lines)
Lines 469-475 Link Here
469
    CDOResource res = transaction.createResource("/res1");
469
    CDOResource res = transaction.createResource("/res1");
470
    res.getContents().add(company);
470
    res.getContents().add(company);
471
    transaction.commit();
471
    transaction.commit();
472
    transaction.setAutoReleaseLocksEnabled(false);
472
    transaction.getOptions().setAutoReleaseLocksEnabled(false);
473
473
474
    CDOObject cdoCompany = CDOUtil.getCDOObject(company);
474
    CDOObject cdoCompany = CDOUtil.getCDOObject(company);
475
    cdoCompany.cdoWriteLock().lock();
475
    cdoCompany.cdoWriteLock().lock();
Lines 495-501 Link Here
495
    transaction.commit();
495
    transaction.commit();
496
    assertEquals(true, cdoCompany.cdoReadLock().isLocked());
496
    assertEquals(true, cdoCompany.cdoReadLock().isLocked());
497
497
498
    transaction.setAutoReleaseLocksEnabled(true);
498
    transaction.getOptions().setAutoReleaseLocksEnabled(true);
499
    transaction.commit();
499
    transaction.commit();
500
    assertEquals(false, cdoCompany.cdoReadLock().isLocked());
500
    assertEquals(false, cdoCompany.cdoReadLock().isLocked());
501
  }
501
  }
Lines 509-515 Link Here
509
    CDOResource res = transaction.createResource("/res1");
509
    CDOResource res = transaction.createResource("/res1");
510
    res.getContents().add(company);
510
    res.getContents().add(company);
511
    transaction.commit();
511
    transaction.commit();
512
    transaction.setAutoReleaseLocksEnabled(false);
512
    transaction.getOptions().setAutoReleaseLocksEnabled(false);
513
513
514
    CDOObject cdoCompany = CDOUtil.getCDOObject(company);
514
    CDOObject cdoCompany = CDOUtil.getCDOObject(company);
515
    cdoCompany.cdoWriteLock().lock();
515
    cdoCompany.cdoWriteLock().lock();
Lines 535-541 Link Here
535
    transaction.rollback();
535
    transaction.rollback();
536
    assertEquals(true, cdoCompany.cdoReadLock().isLocked());
536
    assertEquals(true, cdoCompany.cdoReadLock().isLocked());
537
537
538
    transaction.setAutoReleaseLocksEnabled(true);
538
    transaction.getOptions().setAutoReleaseLocksEnabled(true);
539
    transaction.rollback();
539
    transaction.rollback();
540
    assertEquals(false, cdoCompany.cdoReadLock().isLocked());
540
    assertEquals(false, cdoCompany.cdoReadLock().isLocked());
541
  }
541
  }
(-)src/org/eclipse/emf/cdo/tests/ChangeSubscriptionTest.java (-18 / +18 lines)
Lines 52-58 Link Here
52
    msg("Opening session");
52
    msg("Opening session");
53
    final CDOSession session = openModel1Session();
53
    final CDOSession session = openModel1Session();
54
54
55
    session.setPassiveUpdateEnabled(false);
55
    session.getOptions().setPassiveUpdateEnabled(false);
56
56
57
    // ************************************************************* //
57
    // ************************************************************* //
58
58
Lines 69-75 Link Here
69
    msg("Opening transaction");
69
    msg("Opening transaction");
70
    final CDOTransaction transaction = session.openTransaction();
70
    final CDOTransaction transaction = session.openTransaction();
71
71
72
    transaction.setChangeSubscriptionPolicy(enabled);
72
    transaction.getOptions().setChangeSubscriptionPolicy(enabled);
73
73
74
    msg("Creating resource");
74
    msg("Creating resource");
75
    final CDOResource resourceA = transaction.createResource("/test1");
75
    final CDOResource resourceA = transaction.createResource("/test1");
Lines 113-119 Link Here
113
    // Switching policy to the other
113
    // Switching policy to the other
114
    final CDOAdapterPolicy enabled2 = enabled == CDOAdapterPolicy.ALL ? CDOAdapterPolicy.NONE : CDOAdapterPolicy.ALL;
114
    final CDOAdapterPolicy enabled2 = enabled == CDOAdapterPolicy.ALL ? CDOAdapterPolicy.NONE : CDOAdapterPolicy.ALL;
115
115
116
    transaction.setChangeSubscriptionPolicy(enabled2);
116
    transaction.getOptions().setChangeSubscriptionPolicy(enabled2);
117
117
118
    adapter.getNotifications().clear();
118
    adapter.getNotifications().clear();
119
119
Lines 155-161 Link Here
155
    msg("Opening session");
155
    msg("Opening session");
156
    final CDOSession session = openModel1Session();
156
    final CDOSession session = openModel1Session();
157
157
158
    session.setPassiveUpdateEnabled(false);
158
    session.getOptions().setPassiveUpdateEnabled(false);
159
159
160
    // ************************************************************* //
160
    // ************************************************************* //
161
161
Lines 171-177 Link Here
171
171
172
    msg("Opening transaction");
172
    msg("Opening transaction");
173
    final CDOTransaction transaction = session.openTransaction();
173
    final CDOTransaction transaction = session.openTransaction();
174
    transaction.setChangeSubscriptionPolicy(enabled);
174
    transaction.getOptions().setChangeSubscriptionPolicy(enabled);
175
175
176
    msg("Creating resource");
176
    msg("Creating resource");
177
    final CDOResource resourceA = transaction.createResource("/test1");
177
    final CDOResource resourceA = transaction.createResource("/test1");
Lines 188-194 Link Here
188
188
189
    msg("Opening view");
189
    msg("Opening view");
190
    final CDOSession session2 = openModel1Session();
190
    final CDOSession session2 = openModel1Session();
191
    session2.setPassiveUpdateEnabled(false);
191
    session2.getOptions().setPassiveUpdateEnabled(false);
192
192
193
    final CDOTransaction transaction2 = session2.openTransaction();
193
    final CDOTransaction transaction2 = session2.openTransaction();
194
194
Lines 218-224 Link Here
218
    // Switching policy to the other
218
    // Switching policy to the other
219
    final CDOAdapterPolicy enabled2 = enabled == CDOAdapterPolicy.ALL ? CDOAdapterPolicy.NONE : CDOAdapterPolicy.ALL;
219
    final CDOAdapterPolicy enabled2 = enabled == CDOAdapterPolicy.ALL ? CDOAdapterPolicy.NONE : CDOAdapterPolicy.ALL;
220
220
221
    transaction.setChangeSubscriptionPolicy(enabled2);
221
    transaction.getOptions().setChangeSubscriptionPolicy(enabled2);
222
222
223
    adapter.getNotifications().clear();
223
    adapter.getNotifications().clear();
224
224
Lines 250-256 Link Here
250
    msg("Opening session");
250
    msg("Opening session");
251
    final CDOSession session = openModel1Session();
251
    final CDOSession session = openModel1Session();
252
252
253
    session.setPassiveUpdateEnabled(false);
253
    session.getOptions().setPassiveUpdateEnabled(false);
254
254
255
    // ************************************************************* //
255
    // ************************************************************* //
256
256
Lines 266-272 Link Here
266
266
267
    msg("Opening transaction");
267
    msg("Opening transaction");
268
    final CDOTransaction transaction = session.openTransaction();
268
    final CDOTransaction transaction = session.openTransaction();
269
    transaction.setChangeSubscriptionPolicy(CDOAdapterPolicy.ALL);
269
    transaction.getOptions().setChangeSubscriptionPolicy(CDOAdapterPolicy.ALL);
270
    msg("Creating resource");
270
    msg("Creating resource");
271
    final CDOResource resourceA = transaction.createResource("/test1");
271
    final CDOResource resourceA = transaction.createResource("/test1");
272
272
Lines 284-293 Link Here
284
284
285
    msg("Opening view");
285
    msg("Opening view");
286
    final CDOSession session2 = openModel1Session();
286
    final CDOSession session2 = openModel1Session();
287
    session2.setPassiveUpdateEnabled(false);
287
    session2.getOptions().setPassiveUpdateEnabled(false);
288
288
289
    final CDOTransaction transaction2 = session2.openTransaction();
289
    final CDOTransaction transaction2 = session2.openTransaction();
290
    transaction.setChangeSubscriptionPolicy(CDOAdapterPolicy.ALL);
290
    transaction.getOptions().setChangeSubscriptionPolicy(CDOAdapterPolicy.ALL);
291
291
292
    final Category category1B = (Category)transaction2.getObject(CDOUtil.getCDOObject(category1A).cdoID(), true);
292
    final Category category1B = (Category)transaction2.getObject(CDOUtil.getCDOObject(category1A).cdoID(), true);
293
293
Lines 320-326 Link Here
320
    msg("Opening session");
320
    msg("Opening session");
321
    final CDOSession session = openModel1Session();
321
    final CDOSession session = openModel1Session();
322
322
323
    session.setPassiveUpdateEnabled(false);
323
    session.getOptions().setPassiveUpdateEnabled(false);
324
324
325
    // ************************************************************* //
325
    // ************************************************************* //
326
326
Lines 337-343 Link Here
337
    msg("Opening transaction");
337
    msg("Opening transaction");
338
    final CDOTransaction transaction = session.openTransaction();
338
    final CDOTransaction transaction = session.openTransaction();
339
339
340
    transaction.setChangeSubscriptionPolicy(customPolicy);
340
    transaction.getOptions().setChangeSubscriptionPolicy(customPolicy);
341
341
342
    msg("Creating resource");
342
    msg("Creating resource");
343
    final CDOResource resourceA = transaction.createResource("/test1");
343
    final CDOResource resourceA = transaction.createResource("/test1");
Lines 359-365 Link Here
359
359
360
    msg("Opening view");
360
    msg("Opening view");
361
    final CDOSession session2 = openModel1Session();
361
    final CDOSession session2 = openModel1Session();
362
    session2.setPassiveUpdateEnabled(false);
362
    session2.getOptions().setPassiveUpdateEnabled(false);
363
363
364
    final CDOTransaction transaction2 = session2.openTransaction();
364
    final CDOTransaction transaction2 = session2.openTransaction();
365
365
Lines 388-394 Link Here
388
    assertEquals(false, timedOut);
388
    assertEquals(false, timedOut);
389
389
390
    // Switching policy to the other
390
    // Switching policy to the other
391
    transaction.setChangeSubscriptionPolicy(CDOAdapterPolicy.ALL);
391
    transaction.getOptions().setChangeSubscriptionPolicy(CDOAdapterPolicy.ALL);
392
392
393
    adapter.getNotifications().clear();
393
    adapter.getNotifications().clear();
394
394
Lines 420-426 Link Here
420
    msg("Opening session");
420
    msg("Opening session");
421
    final CDOSession session = openModel1Session();
421
    final CDOSession session = openModel1Session();
422
422
423
    session.setPassiveUpdateEnabled(false);
423
    session.getOptions().setPassiveUpdateEnabled(false);
424
424
425
    // ************************************************************* //
425
    // ************************************************************* //
426
426
Lines 437-443 Link Here
437
    msg("Opening transaction");
437
    msg("Opening transaction");
438
    final CDOTransaction transaction = session.openTransaction();
438
    final CDOTransaction transaction = session.openTransaction();
439
439
440
    transaction.setChangeSubscriptionPolicy(CDOAdapterPolicy.ALL);
440
    transaction.getOptions().setChangeSubscriptionPolicy(CDOAdapterPolicy.ALL);
441
441
442
    msg("Creating resource");
442
    msg("Creating resource");
443
    final CDOResource resourceA = transaction.createResource("/test1");
443
    final CDOResource resourceA = transaction.createResource("/test1");
Lines 456-462 Link Here
456
456
457
    msg("Opening view");
457
    msg("Opening view");
458
    final CDOSession session2 = openModel1Session();
458
    final CDOSession session2 = openModel1Session();
459
    session2.setPassiveUpdateEnabled(false);
459
    session2.getOptions().setPassiveUpdateEnabled(false);
460
460
461
    final CDOTransaction transaction2 = session2.openTransaction();
461
    final CDOTransaction transaction2 = session2.openTransaction();
462
462
(-)src/org/eclipse/emf/cdo/tests/bugzilla/Bugzilla_250036_Test.java (-1 / +1 lines)
Lines 75-81 Link Here
75
    }
75
    }
76
    final TestAdapter counter = new TestAdapter();
76
    final TestAdapter counter = new TestAdapter();
77
    genRefMap.eAdapters().add(counter);
77
    genRefMap.eAdapters().add(counter);
78
    transaction2.setInvalidationNotificationEnabled(true);
78
    transaction2.getOptions().setInvalidationNotificationEnabled(true);
79
79
80
    /********* transaction 1 ***************/
80
    /********* transaction 1 ***************/
81
    for (int i = 10; i < 20; i++)
81
    for (int i = 10; i < 20; i++)
(-)src/org/eclipse/emf/cdo/tests/bugzilla/Bugzilla_251087_Test.java (-6 / +6 lines)
Lines 44-51 Link Here
44
    CDOSession session = openModel1Session();
44
    CDOSession session = openModel1Session();
45
    CDOTransaction transaction1 = session.openTransaction();
45
    CDOTransaction transaction1 = session.openTransaction();
46
46
47
    transaction1.setInvalidationNotificationEnabled(true);
47
    transaction1.getOptions().setInvalidationNotificationEnabled(true);
48
    transaction1.setChangeSubscriptionPolicy(CDOAdapterPolicy.ALL);
48
    transaction1.getOptions().setChangeSubscriptionPolicy(CDOAdapterPolicy.ALL);
49
49
50
    String resourcePath = "/test1";
50
    String resourcePath = "/test1";
51
    CDOResource res = transaction1.createResource(resourcePath);
51
    CDOResource res = transaction1.createResource(resourcePath);
Lines 70-77 Link Here
70
    CDOSession sessionB = openModel1Session();
70
    CDOSession sessionB = openModel1Session();
71
    CDOTransaction transaction1 = sessionA.openTransaction();
71
    CDOTransaction transaction1 = sessionA.openTransaction();
72
72
73
    transaction1.setInvalidationNotificationEnabled(true);
73
    transaction1.getOptions().setInvalidationNotificationEnabled(true);
74
    transaction1.setChangeSubscriptionPolicy(CDOAdapterPolicy.ALL);
74
    transaction1.getOptions().setChangeSubscriptionPolicy(CDOAdapterPolicy.ALL);
75
75
76
    String resourcePath = "/test1";
76
    String resourcePath = "/test1";
77
    CDOResource res = transaction1.createResource(resourcePath);
77
    CDOResource res = transaction1.createResource(resourcePath);
Lines 82-89 Link Here
82
    CDOTransaction transB1 = sessionB.openTransaction();
82
    CDOTransaction transB1 = sessionB.openTransaction();
83
    CDOID companyID = CDOUtil.getCDOObject(obj2).cdoID();
83
    CDOID companyID = CDOUtil.getCDOObject(obj2).cdoID();
84
    Company companyB = (Company)transB1.getObject(companyID);
84
    Company companyB = (Company)transB1.getObject(companyID);
85
    sessionB.setPassiveUpdateEnabled(false);
85
    sessionB.getOptions().setPassiveUpdateEnabled(false);
86
    transB1.setChangeSubscriptionPolicy(CDOAdapterPolicy.ALL);
86
    transB1.getOptions().setChangeSubscriptionPolicy(CDOAdapterPolicy.ALL);
87
    final TestAdapter testAdapter = new TestAdapter();
87
    final TestAdapter testAdapter = new TestAdapter();
88
    companyB.eAdapters().add(testAdapter);
88
    companyB.eAdapters().add(testAdapter);
89
    assertEquals(true, ((InternalCDOTransaction)transB1).hasSubscription(companyID));
89
    assertEquals(true, ((InternalCDOTransaction)transB1).hasSubscription(companyID));
(-)src/org/eclipse/emf/cdo/tests/bugzilla/Bugzilla_250910_Test.java (-1 / +1 lines)
Lines 60-66 Link Here
60
60
61
      transaction1.commit();
61
      transaction1.commit();
62
62
63
      transaction2.setInvalidationNotificationEnabled(true);
63
      transaction2.getOptions().setInvalidationNotificationEnabled(true);
64
      Company company2 = (Company)transaction2.getObject(id, true);
64
      Company company2 = (Company)transaction2.getObject(id, true);
65
      company2.eAdapters().add(testAdapter);
65
      company2.eAdapters().add(testAdapter);
66
66
(-)src/org/eclipse/emf/cdo/tests/bugzilla/Bugzilla_254489_Test.java (-2 / +2 lines)
Lines 42-48 Link Here
42
    msg("Opening session");
42
    msg("Opening session");
43
    final CDOSession session = openModel1Session();
43
    final CDOSession session = openModel1Session();
44
44
45
    session.setPassiveUpdateEnabled(false);
45
    session.getOptions().setPassiveUpdateEnabled(false);
46
46
47
    // ************************************************************* //
47
    // ************************************************************* //
48
    msg("Opening transaction");
48
    msg("Opening transaction");
Lines 55-61 Link Here
55
55
56
    transaction1.commit();
56
    transaction1.commit();
57
57
58
    transaction2.setChangeSubscriptionPolicy(CDOAdapterPolicy.ALL);
58
    transaction2.getOptions().setChangeSubscriptionPolicy(CDOAdapterPolicy.ALL);
59
    CDOResource res2 = transaction2.getResource("/res1");
59
    CDOResource res2 = transaction2.getResource("/res1");
60
    Company companyA2 = (Company)res2.getContents().get(0);
60
    Company companyA2 = (Company)res2.getContents().get(0);
61
    final TestAdapter companyA2Adapter = new TestAdapter();
61
    final TestAdapter companyA2Adapter = new TestAdapter();
(-)src/org/eclipse/emf/internal/cdo/CDOSessionImpl.java (+8 lines)
Lines 172-177 Link Here
172
  /**
172
  /**
173
   * @since 2.0
173
   * @since 2.0
174
   */
174
   */
175
  public CDOSession.Options getOptions()
176
  {
177
    return this;
178
  }
179
180
  /**
181
   * @since 2.0
182
   */
175
  public String getUserID()
183
  public String getUserID()
176
  {
184
  {
177
    IChannel channel = protocol.getChannel();
185
    IChannel channel = protocol.getChannel();
(-)src/org/eclipse/emf/internal/cdo/InternalCDOSession.java (-1 / +1 lines)
Lines 33-39 Link Here
33
 * @since 2.0
33
 * @since 2.0
34
 */
34
 */
35
public interface InternalCDOSession extends CDOSession, CDOIDObjectFactory, CDOPackageURICompressor,
35
public interface InternalCDOSession extends CDOSession, CDOIDObjectFactory, CDOPackageURICompressor,
36
    ILifecycle.Introspection
36
    ILifecycle.Introspection, CDOSession.Options
37
{
37
{
38
  public CDOSessionProtocol getProtocol();
38
  public CDOSessionProtocol getProtocol();
39
39
(-)src/org/eclipse/emf/internal/cdo/CDOViewImpl.java (+8 lines)
Lines 171-176 Link Here
171
  /**
171
  /**
172
   * @since 2.0
172
   * @since 2.0
173
   */
173
   */
174
  public Options getOptions()
175
  {
176
    return this;
177
  }
178
179
  /**
180
   * @since 2.0
181
   */
174
  public InternalCDOViewSet getViewSet()
182
  public InternalCDOViewSet getViewSet()
175
  {
183
  {
176
    return viewSet;
184
    return viewSet;
(-)src/org/eclipse/emf/internal/cdo/InternalCDOTransaction.java (-1 / +1 lines)
Lines 23-29 Link Here
23
 * @author Simon McDuff
23
 * @author Simon McDuff
24
 * @since 2.0
24
 * @since 2.0
25
 */
25
 */
26
public interface InternalCDOTransaction extends CDOTransaction, InternalCDOView
26
public interface InternalCDOTransaction extends CDOTransaction, InternalCDOView, CDOTransaction.Options
27
{
27
{
28
  public InternalCDOCommitContext createCommitContext();
28
  public InternalCDOCommitContext createCommitContext();
29
29
(-)src/org/eclipse/emf/internal/cdo/InternalCDOView.java (-1 / +1 lines)
Lines 32-38 Link Here
32
 * @author Eike Stepper
32
 * @author Eike Stepper
33
 * @since 2.0
33
 * @since 2.0
34
 */
34
 */
35
public interface InternalCDOView extends CDOView, CDOIDProvider
35
public interface InternalCDOView extends CDOView, CDOIDProvider, CDOView.Options
36
{
36
{
37
  public InternalCDOSession getSession();
37
  public InternalCDOSession getSession();
38
38
(-)src/org/eclipse/emf/internal/cdo/CDOStore.java (-1 / +1 lines)
Lines 367-373 Link Here
367
        CDOID id = (CDOID)value;
367
        CDOID id = (CDOID)value;
368
        CDOList list = revision.getList(cdoFeature);
368
        CDOList list = revision.getList(cdoFeature);
369
        CDORevisionManagerImpl revisionManager = (CDORevisionManagerImpl)view.getSession().getRevisionManager();
369
        CDORevisionManagerImpl revisionManager = (CDORevisionManagerImpl)view.getSession().getRevisionManager();
370
        CDORevisionPrefetchingPolicy policy = view.getRevisionPrefetchingPolicy();
370
        CDORevisionPrefetchingPolicy policy = view.getOptions().getRevisionPrefetchingPolicy();
371
        Collection<CDOID> listOfIDs = policy.loadAhead(revisionManager, eObject, eFeature, list, index, id);
371
        Collection<CDOID> listOfIDs = policy.loadAhead(revisionManager, eObject, eFeature, list, index, id);
372
        if (!listOfIDs.isEmpty())
372
        if (!listOfIDs.isEmpty())
373
        {
373
        {
(-)src/org/eclipse/emf/internal/cdo/CDOTransactionImpl.java (+10 lines)
Lines 14-19 Link Here
14
import org.eclipse.emf.cdo.CDOObject;
14
import org.eclipse.emf.cdo.CDOObject;
15
import org.eclipse.emf.cdo.CDOSavepoint;
15
import org.eclipse.emf.cdo.CDOSavepoint;
16
import org.eclipse.emf.cdo.CDOState;
16
import org.eclipse.emf.cdo.CDOState;
17
import org.eclipse.emf.cdo.CDOTransaction;
17
import org.eclipse.emf.cdo.CDOTransactionConflictEvent;
18
import org.eclipse.emf.cdo.CDOTransactionConflictEvent;
18
import org.eclipse.emf.cdo.CDOTransactionFinishedEvent;
19
import org.eclipse.emf.cdo.CDOTransactionFinishedEvent;
19
import org.eclipse.emf.cdo.CDOTransactionHandler;
20
import org.eclipse.emf.cdo.CDOTransactionHandler;
Lines 114-119 Link Here
114
    return Type.TRANSACTION;
115
    return Type.TRANSACTION;
115
  }
116
  }
116
117
118
  /**
119
   * @since 2.0
120
   */
121
  @Override
122
  public CDOTransaction.Options getOptions()
123
  {
124
    return this;
125
  }
126
117
  public void addHandler(CDOTransactionHandler handler)
127
  public void addHandler(CDOTransactionHandler handler)
118
  {
128
  {
119
    synchronized (handlers)
129
    synchronized (handlers)
(-)src/org/eclipse/emf/cdo/CDOView.java (-92 / +107 lines)
Lines 168-265 Link Here
168
  public boolean hasConflict();
168
  public boolean hasConflict();
169
169
170
  /**
170
  /**
171
   * Sets the type of references to be used in the internal object cache to either {@link ReferenceType#STRONG STRONG},
172
   * {@link ReferenceType#SOFT SOFT} or {@link ReferenceType#WEAK WEAK}. If <code>null</code> is passed the default
173
   * reference type {@link ReferenceType#SOFT SOFT} is set. If the given reference type does not differ from the one
174
   * being currently set the new value is ignored and <code>false</code> is returned. Otherwise existing object
175
   * references are converted to the new type and <code>true</code> is returned.
176
   * 
177
   * @since 2.0
178
   */
179
  public boolean setCacheReferenceType(ReferenceType referenceType);
180
181
  /**
182
   * Returns <code>true</code> if the {@link CDOObject objects} in this view will notify their
183
   * {@link org.eclipse.emf.common.notify.Adapter adapters} about the fact that they are <em>invalidated</em> (due to
184
   * remote changes), <code>false</code> otherwise.
185
   * 
186
   * @see CDOInvalidationNotification
187
   * @since 2.0
188
   */
189
  public boolean isInvalidationNotificationEnabled();
190
191
  /**
192
   * Specifies whether the {@link CDOObject objects} in this view will notify their
193
   * {@link org.eclipse.emf.common.notify.Adapter adapters} about the fact that they are <em>invalidated</em> (due to
194
   * remote changes) or not.
195
   * 
196
   * @see CDOInvalidationNotification
197
   * @since 2.0
198
   */
199
  public void setInvalidationNotificationEnabled(boolean enabled);
200
201
  /**
202
   * Returns the current {@link CDOAdapterPolicy change subscription policy}.
203
   * 
204
   * @return The current change subscription policy, never <code>null</code>.
205
   * @see #setChangeSubscriptionPolicy(CDOAdapterPolicy)
206
   * @since 2.0
207
   */
208
  public CDOAdapterPolicy getChangeSubscriptionPolicy();
209
210
  /**
211
   * Specifies the change subscription policy. By default, the value is set to {@link CDOAdapterPolicy#NONE}.
212
   * <p>
213
   * To activate the policy, you must do the following: <br>
214
   * <code>view.setChangeSubscriptionPolicy(CDOChangeSubscriptionPolicy.ALL);</code>
215
   * <p>
216
   * To register an object, you must add an adapter to the object in which you are interested:<br>
217
   * <code>eObject.eAdapters().add(myAdapter);</code>
218
   * <p>
219
   * By activating this feature, each object having at least one adapter that matches the current policy will be
220
   * registered with the server and will be notified for each change occurring in the scope of any other transaction.
221
   * <p>
222
   * {@link CDOAdapterPolicy#NONE} - Disabled. <br>
223
   * {@link CDOAdapterPolicy#ALL} - Enabled for all adapters used.<br>
224
   * {@link CDOAdapterPolicy#ONLY_CDO_ADAPTER} - Enabled only for adapters that implement {@link CDOAdapter}. <br>
225
   * Any other class that implement {@link CDOAdapterPolicy} will enable for whatever rules defined in that class. <br>
226
   * <p>
227
   * If <code>myAdapter</code> in the above example matches the current policy, <code>eObject</code> will be registered
228
   * with the server and you will receive all changes from other transaction.
229
   * <p>
230
   * When the policy is changed all objects in the cache will automatically be recalculated.
231
   * <p>
232
   * You can subscribe to temporary objects. Even if you cannot receive notifications from other {@link CDOTransaction}
233
   * for these because they are only local to you, at commit time these objects will be registered automatically.
234
   * <p>
235
   * <b>Note:</b> It can be used with <code>CDOSession.setPassiveUpdate(false)</code>. In this case, it will receive
236
   * changes without having the objects changed.
237
   * 
238
   * @since 2.0
239
   */
240
  public void setChangeSubscriptionPolicy(CDOAdapterPolicy policy);
241
242
  /**
243
   * @since 2.0
244
   */
245
  public CDOAdapterPolicy getStrongReferencePolicy();
246
247
  /**
248
   * @since 2.0
249
   */
250
  public void setStrongReferencePolicy(CDOAdapterPolicy policy);
251
252
  /**
253
   * @since 2.0
254
   */
255
  public CDORevisionPrefetchingPolicy getRevisionPrefetchingPolicy();
256
257
  /**
258
   * @since 2.0
259
   */
260
  public void setRevisionPrefetchingPolicy(CDORevisionPrefetchingPolicy prefetchingPolicy);
261
262
  /**
263
   * Returns <code>true</code> if a resource with the given path exists in the repository, <code>false</code>.
171
   * Returns <code>true</code> if a resource with the given path exists in the repository, <code>false</code>.
264
   * 
172
   * 
265
   * @see #getResource(String, boolean)
173
   * @see #getResource(String, boolean)
Lines 379-382 Link Here
379
   * @since 2.0
287
   * @since 2.0
380
   */
288
   */
381
  public CDOQuery createQuery(String language, String queryString);
289
  public CDOQuery createQuery(String language, String queryString);
290
291
  /**
292
   * @since 2.0
293
   */
294
  public Options getOptions();
295
296
  /**
297
   * @since 2.0
298
   */
299
  public interface Options
300
  {
301
302
    /**
303
     * Sets the type of references to be used in the internal object cache to either {@link ReferenceType#STRONG STRONG}
304
     * , {@link ReferenceType#SOFT SOFT} or {@link ReferenceType#WEAK WEAK}. If <code>null</code> is passed the default
305
     * reference type {@link ReferenceType#SOFT SOFT} is set. If the given reference type does not differ from the one
306
     * being currently set the new value is ignored and <code>false</code> is returned. Otherwise existing object
307
     * references are converted to the new type and <code>true</code> is returned.
308
     * 
309
     * @since 2.0
310
     */
311
    public boolean setCacheReferenceType(ReferenceType referenceType);
312
313
    /**
314
     * Returns <code>true</code> if the {@link CDOObject objects} in this view will notify their
315
     * {@link org.eclipse.emf.common.notify.Adapter adapters} about the fact that they are <em>invalidated</em> (due to
316
     * remote changes), <code>false</code> otherwise.
317
     * 
318
     * @see CDOInvalidationNotification
319
     * @since 2.0
320
     */
321
    public boolean isInvalidationNotificationEnabled();
322
323
    /**
324
     * Specifies whether the {@link CDOObject objects} in this view will notify their
325
     * {@link org.eclipse.emf.common.notify.Adapter adapters} about the fact that they are <em>invalidated</em> (due to
326
     * remote changes) or not.
327
     * 
328
     * @see CDOInvalidationNotification
329
     * @since 2.0
330
     */
331
    public void setInvalidationNotificationEnabled(boolean enabled);
332
333
    /**
334
     * Returns the current {@link CDOAdapterPolicy change subscription policy}.
335
     * 
336
     * @return The current change subscription policy, never <code>null</code>.
337
     * @see #setChangeSubscriptionPolicy(CDOAdapterPolicy)
338
     * @since 2.0
339
     */
340
    public CDOAdapterPolicy getChangeSubscriptionPolicy();
341
342
    /**
343
     * Specifies the change subscription policy. By default, the value is set to {@link CDOAdapterPolicy#NONE}.
344
     * <p>
345
     * To activate the policy, you must do the following: <br>
346
     * <code>view.setChangeSubscriptionPolicy(CDOChangeSubscriptionPolicy.ALL);</code>
347
     * <p>
348
     * To register an object, you must add an adapter to the object in which you are interested:<br>
349
     * <code>eObject.eAdapters().add(myAdapter);</code>
350
     * <p>
351
     * By activating this feature, each object having at least one adapter that matches the current policy will be
352
     * registered with the server and will be notified for each change occurring in the scope of any other transaction.
353
     * <p>
354
     * {@link CDOAdapterPolicy#NONE} - Disabled. <br>
355
     * {@link CDOAdapterPolicy#ALL} - Enabled for all adapters used.<br>
356
     * {@link CDOAdapterPolicy#ONLY_CDO_ADAPTER} - Enabled only for adapters that implement {@link CDOAdapter}. <br>
357
     * Any other class that implement {@link CDOAdapterPolicy} will enable for whatever rules defined in that class.
358
     * <br>
359
     * <p>
360
     * If <code>myAdapter</code> in the above example matches the current policy, <code>eObject</code> will be
361
     * registered with the server and you will receive all changes from other transaction.
362
     * <p>
363
     * When the policy is changed all objects in the cache will automatically be recalculated.
364
     * <p>
365
     * You can subscribe to temporary objects. Even if you cannot receive notifications from other
366
     * {@link CDOTransaction} for these because they are only local to you, at commit time these objects will be
367
     * registered automatically.
368
     * <p>
369
     * <b>Note:</b> It can be used with <code>CDOSession.setPassiveUpdate(false)</code>. In this case, it will receive
370
     * changes without having the objects changed.
371
     * 
372
     * @since 2.0
373
     */
374
    public void setChangeSubscriptionPolicy(CDOAdapterPolicy policy);
375
376
    /**
377
     * @since 2.0
378
     */
379
    public CDOAdapterPolicy getStrongReferencePolicy();
380
381
    /**
382
     * @since 2.0
383
     */
384
    public void setStrongReferencePolicy(CDOAdapterPolicy policy);
385
386
    /**
387
     * @since 2.0
388
     */
389
    public CDORevisionPrefetchingPolicy getRevisionPrefetchingPolicy();
390
391
    /**
392
     * @since 2.0
393
     */
394
    public void setRevisionPrefetchingPolicy(CDORevisionPrefetchingPolicy prefetchingPolicy);
395
396
  }
382
}
397
}
(-)src/org/eclipse/emf/cdo/CDOSession.java (-27 / +40 lines)
Lines 63-95 Link Here
63
63
64
  public CDORevisionManager getRevisionManager();
64
  public CDORevisionManager getRevisionManager();
65
65
66
  /**
67
   * @since 2.0
68
   */
69
  public CDOCollectionLoadingPolicy getCollectionLoadingPolicy();
70
71
  /**
72
   * @since 2.0
73
   */
74
  public void setCollectionLoadingPolicy(CDOCollectionLoadingPolicy policy);
75
76
  /**
77
   * Specifies whether objects will be invalidated due by other users changes.
78
   * <p>
79
   * E.g.: <code>session.setPassiveUpdateEnabled(false);</code>
80
   * <p>
81
   * By default this property is enabled. If this property is disabled the latest versions of objects can still be
82
   * obtained by calling {@link #refresh()}.
83
   * <p>
84
   * Passive update can be disabled in cases where more performance is needed and/or more control over when objects will
85
   * be refreshed.
86
   * <p>
87
   * When enabled again, a refresh will be automatically performed to be in sync with the server.
88
   * 
89
   * @since 2.0
90
   */
91
  public void setPassiveUpdateEnabled(boolean enabled);
92
93
  public CDOView[] getViews();
66
  public CDOView[] getViews();
94
67
95
  public CDOTransaction openTransaction(ResourceSet resourceSet);
68
  public CDOTransaction openTransaction(ResourceSet resourceSet);
Lines 114-117 Link Here
114
   * @since 2.0
87
   * @since 2.0
115
   */
88
   */
116
  public Collection<CDOTimeStampContext> refresh();
89
  public Collection<CDOTimeStampContext> refresh();
90
91
  /**
92
   * @since 2.0
93
   */
94
  public CDOSession.Options getOptions();
95
96
  /**
97
   * @since 2.0
98
   */
99
  public interface Options extends CDOProtocolSession.Options
100
  {
101
102
    /**
103
     * @since 2.0
104
     */
105
    public CDOCollectionLoadingPolicy getCollectionLoadingPolicy();
106
107
    /**
108
     * @since 2.0
109
     */
110
    public void setCollectionLoadingPolicy(CDOCollectionLoadingPolicy policy);
111
112
    /**
113
     * Specifies whether objects will be invalidated due by other users changes.
114
     * <p>
115
     * E.g.: <code>session.setPassiveUpdateEnabled(false);</code>
116
     * <p>
117
     * By default this property is enabled. If this property is disabled the latest versions of objects can still be
118
     * obtained by calling {@link #refresh()}.
119
     * <p>
120
     * Passive update can be disabled in cases where more performance is needed and/or more control over when objects
121
     * will be refreshed.
122
     * <p>
123
     * When enabled again, a refresh will be automatically performed to be in sync with the server.
124
     * 
125
     * @since 2.0
126
     */
127
    public void setPassiveUpdateEnabled(boolean enabled);
128
129
  }
117
}
130
}
(-)src/org/eclipse/emf/cdo/CDOTransaction.java (-26 / +38 lines)
Lines 34-65 Link Here
34
{
34
{
35
  public static final long DEFAULT_COMMIT_TIMEOUT = 100000L;
35
  public static final long DEFAULT_COMMIT_TIMEOUT = 100000L;
36
36
37
  public long getCommitTimeout();
38
39
  public void setCommitTimeout(long timeout);
40
41
  /**
42
   * Specifies whether locks in this view will be removed when {@link CDOTransaction#commit()} or
43
   * {@link CDOTransaction#rollback()} is called.
44
   * <p>
45
   * If false all locks are kept.
46
   * <p>
47
   * Default value is true.
48
   * 
49
   * @since 2.0
50
   */
51
  public boolean setAutoReleaseLocksEnabled(boolean on);
52
53
  /**
54
   * Returns true if locks in this view will be removes when {@link CDOTransaction#commit()} or
55
   * {@link CDOTransaction#rollback()} is called.
56
   * <p>
57
   * Default value is true.
58
   * 
59
   * @since 2.0
60
   */
61
  public boolean isAutoReleaseLocksEnabled();
62
63
  /**
37
  /**
64
   * @since 2.0
38
   * @since 2.0
65
   */
39
   */
Lines 109-112 Link Here
109
   * @since 2.0
83
   * @since 2.0
110
   */
84
   */
111
  public Map<CDOID, CDOObject> getDetachedObjects();
85
  public Map<CDOID, CDOObject> getDetachedObjects();
86
87
  /**
88
   * @since 2.0
89
   */
90
  public Options getOptions();
91
92
  /**
93
   * @since 2.0
94
   */
95
  public interface Options extends CDOView.Options
96
  {
97
98
    /**
99
     * Specifies whether locks in this view will be removed when {@link CDOTransaction#commit()} or
100
     * {@link CDOTransaction#rollback()} is called.
101
     * <p>
102
     * If false all locks are kept.
103
     * <p>
104
     * Default value is true.
105
     * 
106
     * @since 2.0
107
     */
108
    public boolean setAutoReleaseLocksEnabled(boolean on);
109
110
    /**
111
     * Returns true if locks in this view will be removes when {@link CDOTransaction#commit()} or
112
     * {@link CDOTransaction#rollback()} is called.
113
     * <p>
114
     * Default value is true.
115
     * 
116
     * @since 2.0
117
     */
118
    public boolean isAutoReleaseLocksEnabled();
119
120
    public long getCommitTimeout();
121
122
    public void setCommitTimeout(long timeout);
123
  }
112
}
124
}
(-)src/org/eclipse/emf/internal/cdo/protocol/CommitTransactionRequest.java (-1 / +1 lines)
Lines 203-209 Link Here
203
    Collection<CDORevisionDelta> revisionDeltas = commitContext.getRevisionDeltas().values();
203
    Collection<CDORevisionDelta> revisionDeltas = commitContext.getRevisionDeltas().values();
204
    Collection<CDOID> detachedObjects = commitContext.getDetachedObjects().keySet();
204
    Collection<CDOID> detachedObjects = commitContext.getDetachedObjects().keySet();
205
205
206
    out.writeBoolean(commitContext.getTransaction().isAutoReleaseLocksEnabled());
206
    out.writeBoolean(commitContext.getTransaction().getOptions().isAutoReleaseLocksEnabled());
207
    out.writeInt(newPackages.size());
207
    out.writeInt(newPackages.size());
208
    out.writeInt(newResources.size() + newObjects.size());
208
    out.writeInt(newResources.size() + newObjects.size());
209
    out.writeInt(revisionDeltas.size());
209
    out.writeInt(revisionDeltas.size());
(-)src/org/eclipse/emf/internal/cdo/analyzer/CDOAbstractFeatureRuleAnalyzer.java (-1 / +1 lines)
Lines 67-73 Link Here
67
      TRACER.format("preTraverseFeature : {0}.{1}", cdoObject.cdoClass(), feature.getName());
67
      TRACER.format("preTraverseFeature : {0}.{1}", cdoObject.cdoClass(), feature.getName());
68
    }
68
    }
69
69
70
    loadCollectionPolicy = cdoObject.cdoView().getSession().getCollectionLoadingPolicy();
70
    loadCollectionPolicy = cdoObject.cdoView().getSession().getOptions().getCollectionLoadingPolicy();
71
    lastTraverseFeature = feature;
71
    lastTraverseFeature = feature;
72
    lastTraverseCDOObject = cdoObject;
72
    lastTraverseCDOObject = cdoObject;
73
    lastTraverseIndex = index;
73
    lastTraverseIndex = index;

Return to bug 257270