Skip to main content
aboutsummaryrefslogtreecommitdiffstats
blob: 1f4b91c5bbb91ebd36c41d11e3ba02973ff6e535 (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
/*
 * Copyright (c) 2007-2012, 2015 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
 */
package org.eclipse.emf.cdo.server;

import org.eclipse.emf.cdo.common.CDOCommonRepository.IDGenerationLocation;
import org.eclipse.emf.cdo.common.branch.CDOBranch;
import org.eclipse.emf.cdo.common.id.CDOID;
import org.eclipse.emf.cdo.common.id.CDOID.ObjectType;
import org.eclipse.emf.cdo.common.revision.CDORevision;
import org.eclipse.emf.cdo.common.revision.delta.CDORevisionDelta;

import org.eclipse.net4j.util.om.monitor.ProgressDistributor;

import java.util.Collection;
import java.util.Map;
import java.util.Set;

/**
 * Represents the physical data storage back-end of a CDO {@link IRepository repository}, such as a database or a file
 * system folder.
 *
 * @author Eike Stepper
 * @apiviz.landmark
 * @apiviz.has {@link IStore.ChangeFormat}
 * @apiviz.has {@link IStore.RevisionTemporality}
 * @apiviz.has {@link IStore.RevisionParallelism}
 * @apiviz.uses {@link IStoreAccessor} - - creates
 */
public interface IStore
{
  /**
   * @since 2.0
   */
  public IRepository getRepository();

  /**
   * @since 2.0
   */
  public String getType();

  /**
   * @since 3.0
   */
  public Set<CDOID.ObjectType> getObjectIDTypes();

  /**
   * @since 4.0
   */
  public CDOID createObjectID(String val);

  /**
   * @since 2.0
   */
  public Set<ChangeFormat> getSupportedChangeFormats();

  /**
   * @since 2.0
   */
  public Set<RevisionTemporality> getSupportedRevisionTemporalities();

  /**
   * @since 2.0
   */
  public Set<RevisionParallelism> getSupportedRevisionParallelisms();

  /**
   * @since 2.0
   */
  public RevisionTemporality getRevisionTemporality();

  /**
   * @since 2.0
   */
  public RevisionParallelism getRevisionParallelism();

  /**
   * Returns <code>true</code>if this store was activated for the first time, <code>false</code> otherwise.
   *
   * @since 4.0
   */
  public boolean isFirstStart();

  /**
   * Returns the store creation time.
   *
   * @since 2.0
   */
  public long getCreationTime();

  /**
   * Returns the id of the last branch that has been created in this store.
   *
   * @since 3.0
   */
  public int getLastBranchID();

  /**
   * Returns the id of the last local branch that has been created in this store.
   *
   * @since 3.0
   */
  public int getLastLocalBranchID();

  /**
   * Returns the time stamp of the last successful commit operation.
   *
   * @since 3.0
   */
  public long getLastCommitTime();

  /**
   * Returns the time stamp of the last successful commit operation to a non-local {@link CDOBranch branch}.
   *
   * @since 3.0
   */
  public long getLastNonLocalCommitTime();

  /**
   * Returns a map filled with the property entries for the requested property <code>names</code> if names is not
   * <code>null</code> and not {@link Collection#isEmpty() empty}, all existing property entries otherwise.
   *
   * @since 4.0
   */
  public Map<String, String> getPersistentProperties(Set<String> names);

  /**
   * @since 4.0
   */
  public void setPersistentProperties(Map<String, String> properties);

  /**
   * @since 4.0
   */
  public void removePersistentProperties(Set<String> names);

  /**
   * Returns a reader that can be used to read from this store in the context of the given session.
   *
   * @param session
   *          The session that should be used as a context for read access or <code>null</code>. The store implementor
   *          is free to interpret and use the session in a manner suitable for him or ignore it at all. It is meant
   *          only as a hint. Implementor can use it as a key into a cache and/or register a
   *          {@link org.eclipse.net4j.util.lifecycle.LifecycleEventAdapter LifecycleEventAdapter} with it to intercept
   *          cleanup on session close. Note however that the session can be <code>null</code>, for example during
   *          startup of the server while the repositories are initialized but before any user session has been opened.
   * @return a reader that can be used to read from this store in the context of the given session, never
   *         <code>null</code>.
   * @since 2.0
   */
  public IStoreAccessor getReader(ISession session);

  /**
   * Returns a writer that can be used to write to this store in the context of the given view. The given view is always
   * marked as a transaction.
   *
   * @param transaction
   *          The view that must be used as a context for write access. The store implementor is free to interpret and
   *          use the view in a manner suitable for him or ignore it at all. It is meant only as a hint. Implementor can
   *          use it as a key into a cache and/or register a
   *          {@link org.eclipse.net4j.util.lifecycle.LifecycleEventAdapter LifecycleEventAdapter} with it to intercept
   *          cleanup on view close.
   * @return a writer that can be used to write to this store in the context of the given view, never <code>null</code>.
   * @since 2.0
   */
  public IStoreAccessor getWriter(ITransaction transaction);

  /**
   * @since 2.0
   */
  public ProgressDistributor getIndicatingCommitDistributor();

  /**
   * Enumerates the possible data formats a {@link IStore store} can accept for commit operations.
   *
   * @author Eike Stepper
   * @since 2.0
   */
  public enum ChangeFormat
  {
    /**
     * An indication that the store accepts full {@link CDORevision revisions} for dirty objects.
     */
    REVISION,

    /**
     * An indication that the store accepts incremental {@link CDORevisionDelta revision deltas} for dirty objects.
     */
    DELTA
  }

  /**
   * Enumerates the possible history recording options a {@link IStore store} can accept.
   *
   * @author Eike Stepper
   * @since 2.0
   */
  public enum RevisionTemporality
  {
    /**
     * An indication that the store can work <b>without</b> <i>auditing</i>.
     */
    NONE,

    /**
     * An indication that the store can work <b>with</b> <i>auditing</i>.
     */
    AUDITING
  }

  /**
   * Enumerates the possible branching options a {@link IStore store} can accept.
   *
   * @author Eike Stepper
   * @since 2.0
   */
  public enum RevisionParallelism
  {
    /**
     * An indication that the store can work <b>without</b> <i>branching</i>.
     */
    NONE,

    /**
     * An indication that the store can work <b>with</b> <i>branching</i>.
     */
    BRANCHING
  }

  /**
   * A marker interface for {@link IStore stores} that can handle {@link CDOID IDs} assigned by a
   * {@link IDGenerationLocation#CLIENT client}, typically {@link ObjectType#UUID UUIDs}.
   *
   * @author Eike Stepper
   * @since 4.1
   * @apiviz.exclude
   */
  public interface CanHandleClientAssignedIDs
  {
  }
}

Back to the top