Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorEike Stepper2011-08-06 00:00:10 -0400
committerEike Stepper2011-08-06 00:00:10 -0400
commit563846e41cab7621cf50c5cdd117142c9543d7d4 (patch)
tree92724d2b035a560ef812f836a6892b6d0de3c29d
parentdb6239bc0805ef6620c1e1e550dad6832a3d199f (diff)
downloadcdo-563846e41cab7621cf50c5cdd117142c9543d7d4.tar.gz
cdo-563846e41cab7621cf50c5cdd117142c9543d7d4.tar.xz
cdo-563846e41cab7621cf50c5cdd117142c9543d7d4.zip
[352561] Support client assigned CDOIDs (UUIDs)
https://bugs.eclipse.org/bugs/show_bug.cgi?id=352561
-rw-r--r--plugins/org.eclipse.emf.cdo.server.db/src/org/eclipse/emf/cdo/server/internal/db/DBStore.java38
-rw-r--r--plugins/org.eclipse.emf.cdo.server.db/src/org/eclipse/emf/cdo/server/internal/db/mapping/horizontal/AbstractHorizontalMappingStrategy.java16
-rw-r--r--plugins/org.eclipse.emf.cdo.server.db/src/org/eclipse/emf/cdo/server/internal/db/messages/messages.properties13
-rw-r--r--plugins/org.eclipse.emf.cdo.server/src/org/eclipse/emf/cdo/internal/server/SessionManager.java10
4 files changed, 45 insertions, 32 deletions
diff --git a/plugins/org.eclipse.emf.cdo.server.db/src/org/eclipse/emf/cdo/server/internal/db/DBStore.java b/plugins/org.eclipse.emf.cdo.server.db/src/org/eclipse/emf/cdo/server/internal/db/DBStore.java
index f99471a8b7..fa4e098f26 100644
--- a/plugins/org.eclipse.emf.cdo.server.db/src/org/eclipse/emf/cdo/server/internal/db/DBStore.java
+++ b/plugins/org.eclipse.emf.cdo.server.db/src/org/eclipse/emf/cdo/server/internal/db/DBStore.java
@@ -32,6 +32,7 @@ import org.eclipse.emf.cdo.server.db.IMetaDataManager;
import org.eclipse.emf.cdo.server.db.mapping.IMappingStrategy;
import org.eclipse.emf.cdo.server.internal.db.bundle.OM;
import org.eclipse.emf.cdo.server.internal.db.messages.Messages;
+import org.eclipse.emf.cdo.spi.server.InternalRepository;
import org.eclipse.emf.cdo.spi.server.LongIDStoreAccessor;
import org.eclipse.emf.cdo.spi.server.Store;
import org.eclipse.emf.cdo.spi.server.StoreAccessorPool;
@@ -611,10 +612,11 @@ public class DBStore extends Store implements IDBStore, CDOAllRevisionsProvider
protected void firstStart()
{
- setCreationTime(getRepository().getTimeStamp());
+ InternalRepository repository = getRepository();
+ setCreationTime(repository.getTimeStamp());
firstTime = true;
- OM.LOG.info(MessageFormat.format(Messages.getString("DBStore.8"), creationTime)); //$NON-NLS-1$
+ OM.LOG.info(MessageFormat.format(Messages.getString("DBStore.8"), repository.getName(), creationTime)); //$NON-NLS-1$
}
protected void reStart()
@@ -630,7 +632,8 @@ public class DBStore extends Store implements IDBStore, CDOAllRevisionsProvider
{
names.clear();
- boolean generatingIDs = getRepository().getIDGenerationLocation() == IDGenerationLocation.STORE;
+ InternalRepository repository = getRepository();
+ boolean generatingIDs = repository.getIDGenerationLocation() == IDGenerationLocation.STORE;
if (generatingIDs)
{
names.add(PROP_NEXT_LOCAL_CDOID);
@@ -653,6 +656,8 @@ public class DBStore extends Store implements IDBStore, CDOAllRevisionsProvider
setLastLocalBranchID(Integer.valueOf(map.get(PROP_LAST_LOCAL_BRANCHID)));
setLastCommitTime(Long.valueOf(map.get(PROP_LAST_COMMITTIME)));
setLastNonLocalCommitTime(Long.valueOf(map.get(PROP_LAST_NONLOCAL_COMMITTIME)));
+
+ OM.LOG.info(MessageFormat.format(Messages.getString("DBStore.8b"), repository.getName())); //$NON-NLS-1$
}
else
{
@@ -664,17 +669,21 @@ public class DBStore extends Store implements IDBStore, CDOAllRevisionsProvider
protected void repairAfterCrash()
{
+ String name = getRepository().getName();
+ OM.LOG.info(MessageFormat.format(Messages.getString("DBStore.9"), name)); //$NON-NLS-1$
+
Connection connection = getConnection();
try
{
connection.setAutoCommit(false);
connection.setReadOnly(true);
- OM.LOG.info(Messages.getString("DBStore.9")); //$NON-NLS-1$
mappingStrategy.repairAfterCrash(dbAdapter, connection); // Must update the idHandler
- CDOID lastObjectID = idHandler.getLastObjectID();
- CDOID nextLocalObjectID = idHandler.getNextLocalObjectID();
+
+ boolean storeIDs = getRepository().getIDGenerationLocation() == IDGenerationLocation.STORE;
+ CDOID lastObjectID = storeIDs ? idHandler.getLastObjectID() : CDOID.NULL;
+ CDOID nextLocalObjectID = storeIDs ? idHandler.getNextLocalObjectID() : CDOID.NULL;
int branchID = DBUtil.selectMaximumInt(connection, CDODBSchema.BRANCHES_ID);
setLastBranchID(branchID > 0 ? branchID : 0);
@@ -689,13 +698,22 @@ public class DBStore extends Store implements IDBStore, CDOAllRevisionsProvider
CDOBranch.MAIN_BRANCH_ID + "<=" + CDODBSchema.COMMIT_INFOS_BRANCH);
setLastNonLocalCommitTime(lastNonLocalCommitTime);
- OM.LOG
- .info(MessageFormat.format(
- Messages.getString("DBStore.10"), lastObjectID, nextLocalObjectID, getLastBranchID(), getLastCommitTime(), getLastNonLocalCommitTime())); //$NON-NLS-1$
+ if (storeIDs)
+ {
+ OM.LOG
+ .info(MessageFormat.format(
+ Messages.getString("DBStore.10"), name, lastObjectID, nextLocalObjectID, getLastBranchID(), getLastCommitTime(), getLastNonLocalCommitTime())); //$NON-NLS-1$
+ }
+ else
+ {
+ OM.LOG
+ .info(MessageFormat.format(
+ Messages.getString("DBStore.10b"), name, getLastBranchID(), getLastCommitTime(), getLastNonLocalCommitTime())); //$NON-NLS-1$
+ }
}
catch (SQLException e)
{
- OM.LOG.error(Messages.getString("DBStore.12"), e); //$NON-NLS-1$
+ OM.LOG.error(MessageFormat.format(Messages.getString("DBStore.11"), name), e); //$NON-NLS-1$
throw new DBException(e);
}
finally
diff --git a/plugins/org.eclipse.emf.cdo.server.db/src/org/eclipse/emf/cdo/server/internal/db/mapping/horizontal/AbstractHorizontalMappingStrategy.java b/plugins/org.eclipse.emf.cdo.server.db/src/org/eclipse/emf/cdo/server/internal/db/mapping/horizontal/AbstractHorizontalMappingStrategy.java
index 5cb63f20dd..7a9cd33b45 100644
--- a/plugins/org.eclipse.emf.cdo.server.db/src/org/eclipse/emf/cdo/server/internal/db/mapping/horizontal/AbstractHorizontalMappingStrategy.java
+++ b/plugins/org.eclipse.emf.cdo.server.db/src/org/eclipse/emf/cdo/server/internal/db/mapping/horizontal/AbstractHorizontalMappingStrategy.java
@@ -11,6 +11,7 @@
*/
package org.eclipse.emf.cdo.server.internal.db.mapping.horizontal;
+import org.eclipse.emf.cdo.common.CDOCommonRepository.IDGenerationLocation;
import org.eclipse.emf.cdo.common.id.CDOID;
import org.eclipse.emf.cdo.common.model.CDOClassifierRef;
import org.eclipse.emf.cdo.common.protocol.CDODataInput;
@@ -20,6 +21,7 @@ import org.eclipse.emf.cdo.eresource.CDOResourceNode;
import org.eclipse.emf.cdo.eresource.EresourcePackage;
import org.eclipse.emf.cdo.server.IStoreAccessor.QueryResourcesContext;
import org.eclipse.emf.cdo.server.IStoreAccessor.QueryXRefsContext;
+import org.eclipse.emf.cdo.server.db.IDBStore;
import org.eclipse.emf.cdo.server.db.IDBStoreAccessor;
import org.eclipse.emf.cdo.server.db.IIDHandler;
import org.eclipse.emf.cdo.server.db.mapping.IClassMapping;
@@ -80,13 +82,17 @@ public abstract class AbstractHorizontalMappingStrategy extends AbstractMappingS
public void repairAfterCrash(IDBAdapter dbAdapter, Connection connection)
{
- IIDHandler idHandler = getStore().getIDHandler();
+ IDBStore store = getStore();
+ if (store.getRepository().getIDGenerationLocation() == IDGenerationLocation.STORE)
+ {
+ IIDHandler idHandler = store.getIDHandler();
- CDOID minLocalID = getMinLocalID(connection);
- idHandler.setNextLocalObjectID(minLocalID);
+ CDOID minLocalID = getMinLocalID(connection);
+ idHandler.setNextLocalObjectID(minLocalID);
- CDOID maxID = objectTypeMapper.getMaxID(connection, idHandler);
- idHandler.setLastObjectID(maxID);
+ CDOID maxID = objectTypeMapper.getMaxID(connection, idHandler);
+ idHandler.setLastObjectID(maxID);
+ }
}
public void queryResources(IDBStoreAccessor accessor, QueryResourcesContext context)
diff --git a/plugins/org.eclipse.emf.cdo.server.db/src/org/eclipse/emf/cdo/server/internal/db/messages/messages.properties b/plugins/org.eclipse.emf.cdo.server.db/src/org/eclipse/emf/cdo/server/internal/db/messages/messages.properties
index 55088278ee..f5bb054c8e 100644
--- a/plugins/org.eclipse.emf.cdo.server.db/src/org/eclipse/emf/cdo/server/internal/db/messages/messages.properties
+++ b/plugins/org.eclipse.emf.cdo.server.db/src/org/eclipse/emf/cdo/server/internal/db/messages/messages.properties
@@ -11,15 +11,14 @@
DBStore.0=dbConnectionProvider is null
DBStore.1=dbAdapter is null
-DBStore.10=Repaired after crash: lastObjectID={0}, nextLocalObjectID={1}, lastBranchID={2}, lastCommitTime={3}, lastNonLocalCommitTime={4}
DBStore.2=mappingStrategy is null
DBStore.3=idHandler is null
-DBStore.7=AuditSupport of MappingStrategy and Store does not match. Please check configuration.
-DBStore.8=First start: {0,date} {0,time}
-DBStore.9=Detected crash
-DBStore.11=BranchingSupport of MappingStrategy and Store do not match. Please check configuration.
-DBStore.12=Repairing after crash failed.
-DBStore.13=Invalid EENum default literal {0} for model element {1}. Falling back to EENum default value.
+DBStore.8=First start of repository '{0}': {1,date} {1,time}
+DBStore.8b=Restart of repository '{0}'
+DBStore.9=Detected crash of repository '{0}'
+DBStore.10=Repaired crash of repository '{0}': lastObjectID={1}, nextLocalObjectID={2}, lastBranchID={3}, lastCommitTime={4}, lastNonLocalCommitTime={5}
+DBStore.10b=Repaired crash of repository '{0}': lastBranchID={1}, lastCommitTime={2}, lastNonLocalCommitTime={3}
+DBStore.11=Repairing crash of repository '{0}' failed.
TypeMappingRegistry.1=No type mapping factory found for {0}: {1} --> DBType.{2}
diff --git a/plugins/org.eclipse.emf.cdo.server/src/org/eclipse/emf/cdo/internal/server/SessionManager.java b/plugins/org.eclipse.emf.cdo.server/src/org/eclipse/emf/cdo/internal/server/SessionManager.java
index c5631b5c45..e519b9d216 100644
--- a/plugins/org.eclipse.emf.cdo.server/src/org/eclipse/emf/cdo/internal/server/SessionManager.java
+++ b/plugins/org.eclipse.emf.cdo.server/src/org/eclipse/emf/cdo/internal/server/SessionManager.java
@@ -424,16 +424,6 @@ public class SessionManager extends Container<ISession> implements InternalSessi
}
@Override
- protected void doBeforeActivate() throws Exception
- {
- super.doBeforeActivate();
- if (userManager == null)
- {
- OM.LOG.info("No user manager configured. Users will not be authenticated");
- }
- }
-
- @Override
protected void doActivate() throws Exception
{
super.doActivate();

Back to the top