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
|
/**
* Copyright (c) 2004 - 2009 Eike Stepper (Berlin, Germany) and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms 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.session;
import org.eclipse.emf.cdo.common.id.CDOID;
import org.eclipse.emf.cdo.common.revision.CDORevision;
import org.eclipse.emf.cdo.common.revision.CDORevisionResolver;
import org.eclipse.emf.ecore.EStructuralFeature;
import org.eclipse.emf.spi.cdo.InternalCDORevisionManager;
/**
* 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 Simon McDuff
* @since 2.0
*/
public interface CDOCollectionLoadingPolicy
{
/**
* A default collection loading strategy that leads to complete loading of {@link CDOID} lists <b>before</b> any of
* their elements is accessed.
*/
public static final CDOCollectionLoadingPolicy DEFAULT = new CDOCollectionLoadingPolicy()
{
/**
* Returns {@link CDORevision#UNCHUNKED}.
*/
public int getInitialChunkSize()
{
return CDORevision.UNCHUNKED;
}
public Object resolveProxy(CDORevisionResolver revisionManager, CDORevision revision, EStructuralFeature feature,
int accessIndex, int serverIndex)
{
return ((InternalCDORevisionManager)revisionManager).loadChunkByRange(revision, feature, accessIndex,
serverIndex, accessIndex, accessIndex);
}
};
/**
* Returns the maximum number of CDOIDs to be loaded for collections when an object is loaded, i.e. <b>before</b> any
* of their elements is accessed.
*/
public int getInitialChunkSize();
/**
* Defines a strategy to be used when the collection needs to resolve one element.
* {@link CDORevisionResolver#loadChunkByRange(CDORevision, EStructuralFeature, int, int, int, int)} should be used to
* resolve them.
*
* @since 3.0
*/
public Object resolveProxy(CDORevisionResolver revisionManager, CDORevision revision, EStructuralFeature feature,
int accessIndex, int serverIndex);
}
|