summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorEike Stepper2008-02-09 15:28:20 (EST)
committerEike Stepper2008-02-09 15:28:20 (EST)
commit8c3a93f9da597a0eb5f07b95f4673af6edbe2c15 (patch)
tree0ccbce343e369713b477ed176a138635c732d512
parent71f5ff0fe04559324da8e7017583766ae3748c1a (diff)
downloadcdo-8c3a93f9da597a0eb5f07b95f4673af6edbe2c15.zip
cdo-8c3a93f9da597a0eb5f07b95f4673af6edbe2c15.tar.gz
cdo-8c3a93f9da597a0eb5f07b95f4673af6edbe2c15.tar.bz2
[217117] Develop a HibernateStore
https://bugs.eclipse.org/bugs/show_bug.cgi?id=217117
-rw-r--r--plugins/org.eclipse.emf.cdo.server.db/src/org/eclipse/emf/cdo/server/internal/db/DBStoreWriter.java23
-rw-r--r--plugins/org.eclipse.emf.cdo.server/src/org/eclipse/emf/cdo/internal/server/MEMStoreAccessor.java20
-rw-r--r--plugins/org.eclipse.emf.cdo.server/src/org/eclipse/emf/cdo/internal/server/NOOPStoreAccessor.java18
-rw-r--r--plugins/org.eclipse.emf.cdo.server/src/org/eclipse/emf/cdo/internal/server/Transaction.java35
-rw-r--r--plugins/org.eclipse.emf.cdo.server/src/org/eclipse/emf/cdo/internal/server/protocol/CommitTransactionIndication.java14
-rw-r--r--plugins/org.eclipse.emf.cdo.server/src/org/eclipse/emf/cdo/server/IStoreWriter.java16
-rw-r--r--plugins/org.eclipse.emf.cdo.ui/src/org/eclipse/emf/cdo/internal/ui/dialogs/RollbackTransactionDialog.java26
-rw-r--r--plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/internal/cdo/protocol/CommitTransactionRequest.java11
8 files changed, 35 insertions, 128 deletions
diff --git a/plugins/org.eclipse.emf.cdo.server.db/src/org/eclipse/emf/cdo/server/internal/db/DBStoreWriter.java b/plugins/org.eclipse.emf.cdo.server.db/src/org/eclipse/emf/cdo/server/internal/db/DBStoreWriter.java
index 4357afb..3ee17d2 100644
--- a/plugins/org.eclipse.emf.cdo.server.db/src/org/eclipse/emf/cdo/server/internal/db/DBStoreWriter.java
+++ b/plugins/org.eclipse.emf.cdo.server.db/src/org/eclipse/emf/cdo/server/internal/db/DBStoreWriter.java
@@ -52,24 +52,16 @@ public class DBStoreWriter extends DBStoreReader implements IDBStoreWriter
writePackages(context.getNewPackages());
}
- public CDOID createNewResourceID(CommitContext context, int i, CDORevision newResource)
+ public void createNewIDs(CommitContext context, CDORevision[] newObjects, CDOID[] newIDs)
{
- return getStore().getNextCDOID();
- }
-
- public CDOID createNewObjectID(CommitContext context, int i, CDORevision newObject)
- {
- return getStore().getNextCDOID();
- }
-
- public void finishCommit(CommitContext context, CDORevision[] newResources, CDORevision[] newObjects,
- CDORevision[] dirtyObjects)
- {
- for (CDORevision revision : newResources)
+ for (int i = 0; i < newObjects.length; i++)
{
- writeRevision(revision);
+ newIDs[i] = getStore().getNextCDOID();
}
+ }
+ public void finishCommit(CommitContext context, CDORevision[] newObjects, CDORevision[] dirtyObjects)
+ {
for (CDORevision revision : newObjects)
{
writeRevision(revision);
@@ -95,8 +87,7 @@ public class DBStoreWriter extends DBStoreReader implements IDBStoreWriter
}
}
- public void finishCommit(CommitContext context, CDORevision[] newResources, CDORevision[] newObjects,
- CDORevisionDelta[] dirtyObjectDeltas)
+ public void finishCommit(CommitContext context, CDORevision[] newObjects, CDORevisionDelta[] dirtyObjectDeltas)
{
throw new UnsupportedOperationException();
}
diff --git a/plugins/org.eclipse.emf.cdo.server/src/org/eclipse/emf/cdo/internal/server/MEMStoreAccessor.java b/plugins/org.eclipse.emf.cdo.server/src/org/eclipse/emf/cdo/internal/server/MEMStoreAccessor.java
index 0acdc44..88f8aa3 100644
--- a/plugins/org.eclipse.emf.cdo.server/src/org/eclipse/emf/cdo/internal/server/MEMStoreAccessor.java
+++ b/plugins/org.eclipse.emf.cdo.server/src/org/eclipse/emf/cdo/internal/server/MEMStoreAccessor.java
@@ -133,29 +133,23 @@ public class MEMStoreAccessor extends StoreAccessor implements IStoreReader, ISt
// Do nothing
}
- public CDOID createNewResourceID(CommitContext context, int i, CDORevision newResource)
+ public void createNewIDs(CommitContext context, CDORevision[] newObjects, CDOID[] newIDs)
{
- return getStore().getNextCDOID();
- }
-
- public CDOID createNewObjectID(CommitContext context, int i, CDORevision newObject)
- {
- return getStore().getNextCDOID();
+ for (int i = 0; i < newObjects.length; i++)
+ {
+ newIDs[i] = getStore().getNextCDOID();
+ }
}
- public void finishCommit(CommitContext context, CDORevision[] newResources, CDORevision[] newObjects,
- CDORevision[] dirtyObjects)
+ public void finishCommit(CommitContext context, CDORevision[] newObjects, CDORevision[] dirtyObjects)
{
- writeRevisions(newResources);
writeRevisions(newObjects);
writeRevisions(dirtyObjects);
commit();
}
- public void finishCommit(CommitContext context, CDORevision[] newResources, CDORevision[] newObjects,
- CDORevisionDelta[] dirtyObjectDeltas)
+ public void finishCommit(CommitContext context, CDORevision[] newObjects, CDORevisionDelta[] dirtyObjectDeltas)
{
- writeRevisions(newResources);
writeRevisions(newObjects);
writeRevisionDeltas(dirtyObjectDeltas);
commit();
diff --git a/plugins/org.eclipse.emf.cdo.server/src/org/eclipse/emf/cdo/internal/server/NOOPStoreAccessor.java b/plugins/org.eclipse.emf.cdo.server/src/org/eclipse/emf/cdo/internal/server/NOOPStoreAccessor.java
index 49951fc..a205e62 100644
--- a/plugins/org.eclipse.emf.cdo.server/src/org/eclipse/emf/cdo/internal/server/NOOPStoreAccessor.java
+++ b/plugins/org.eclipse.emf.cdo.server/src/org/eclipse/emf/cdo/internal/server/NOOPStoreAccessor.java
@@ -103,23 +103,19 @@ public class NOOPStoreAccessor extends StoreAccessor implements IStoreReader, IS
{
}
- public CDOID createNewResourceID(CommitContext context, int i, CDORevision newResource)
+ public void createNewIDs(CommitContext context, CDORevision[] newObjects, CDOID[] newIDs)
{
- return getStore().getNextCDOID();
+ for (int i = 0; i < newObjects.length; i++)
+ {
+ newIDs[i] = getStore().getNextCDOID();
+ }
}
- public CDOID createNewObjectID(CommitContext context, int i, CDORevision newObject)
+ public void finishCommit(CommitContext context, CDORevision[] newObjects, CDORevision[] dirtyObjects)
{
- return getStore().getNextCDOID();
}
- public void finishCommit(CommitContext context, CDORevision[] newResources, CDORevision[] newObjects,
- CDORevision[] dirtyObjects)
- {
- }
-
- public void finishCommit(CommitContext context, CDORevision[] newResources, CDORevision[] newObjects,
- CDORevisionDelta[] dirtyObjectDeltas)
+ public void finishCommit(CommitContext context, CDORevision[] newObjects, CDORevisionDelta[] dirtyObjectDeltas)
{
}
diff --git a/plugins/org.eclipse.emf.cdo.server/src/org/eclipse/emf/cdo/internal/server/Transaction.java b/plugins/org.eclipse.emf.cdo.server/src/org/eclipse/emf/cdo/internal/server/Transaction.java
index dfd30ea..4483c5a 100644
--- a/plugins/org.eclipse.emf.cdo.server/src/org/eclipse/emf/cdo/internal/server/Transaction.java
+++ b/plugins/org.eclipse.emf.cdo.server/src/org/eclipse/emf/cdo/internal/server/Transaction.java
@@ -62,8 +62,6 @@ public class Transaction extends View implements ITransaction, IStoreWriter.Comm
private CDOPackage[] newPackages;
- private CDORevision[] newResources;
-
private CDORevision[] newObjects;
private CDORevisionDelta[] dirtyObjectDeltas;
@@ -105,11 +103,6 @@ public class Transaction extends View implements ITransaction, IStoreWriter.Comm
return newPackages;
}
- public int getNumberOfNewResources()
- {
- return newResources == null ? 0 : newResources.length;
- }
-
public int getNumberOfNewObjects()
{
return newObjects == null ? 0 : newObjects.length;
@@ -135,12 +128,10 @@ public class Transaction extends View implements ITransaction, IStoreWriter.Comm
return rollbackMessage;
}
- public void commit(CDOPackage[] newPackages, CDORevision[] newResources, CDORevision[] newObjects,
- CDORevisionDelta[] dirtyObjectDeltas)
+ public void commit(CDOPackage[] newPackages, CDORevision[] newObjects, CDORevisionDelta[] dirtyObjectDeltas)
{
timeStamp = System.currentTimeMillis();
this.newPackages = newPackages;
- this.newResources = newResources;
this.newObjects = newObjects;
this.dirtyObjectDeltas = dirtyObjectDeltas;
dirtyObjects = new CDORevision[dirtyObjectDeltas.length];
@@ -199,7 +190,6 @@ public class Transaction extends View implements ITransaction, IStoreWriter.Comm
idMappings.clear();
rollbackMessage = null;
newPackages = null;
- newResources = null;
newObjects = null;
dirtyObjectDeltas = null;
dirtyObjects = null;
@@ -246,18 +236,11 @@ public class Transaction extends View implements ITransaction, IStoreWriter.Comm
private void populateIDMappings()
{
- for (int i = 0; i < newResources.length; i++)
- {
- CDORevision newResource = newResources[i];
- CDOID newID = storeWriter.createNewResourceID(this, i, newResource);
- addIDMapping((CDOIDTemp)newResource.getID(), newID);
- }
-
+ CDOID[] newIDs = new CDOID[newObjects.length];
+ storeWriter.createNewIDs(this, newObjects, newIDs);
for (int i = 0; i < newObjects.length; i++)
{
- CDORevision newObject = newObjects[i];
- CDOID newID = storeWriter.createNewObjectID(this, i, newObject);
- addIDMapping((CDOIDTemp)newObject.getID(), newID);
+ addIDMapping((CDOIDTemp)newObjects[i].getID(), newIDs[i]);
}
}
@@ -277,11 +260,6 @@ public class Transaction extends View implements ITransaction, IStoreWriter.Comm
private void adjust()
{
- for (CDORevision newResource : newResources)
- {
- adjustRevision((InternalCDORevision)newResource);
- }
-
for (CDORevision newObject : newObjects)
{
adjustRevision((InternalCDORevision)newObject);
@@ -335,12 +313,12 @@ public class Transaction extends View implements ITransaction, IStoreWriter.Comm
if (repository.isSupportingRevisionDeltas())
{
computeDirtyObjects(false);
- storeWriter.finishCommit(this, newResources, newObjects, dirtyObjectDeltas);
+ storeWriter.finishCommit(this, newObjects, dirtyObjectDeltas);
}
else
{
computeDirtyObjects(true);
- storeWriter.finishCommit(this, newResources, newObjects, dirtyObjects);
+ storeWriter.finishCommit(this, newObjects, dirtyObjects);
}
}
@@ -364,7 +342,6 @@ public class Transaction extends View implements ITransaction, IStoreWriter.Comm
try
{
addNewPackages();
- addRevisions(newResources);
addRevisions(newObjects);
addRevisions(dirtyObjects);
}
diff --git a/plugins/org.eclipse.emf.cdo.server/src/org/eclipse/emf/cdo/internal/server/protocol/CommitTransactionIndication.java b/plugins/org.eclipse.emf.cdo.server/src/org/eclipse/emf/cdo/internal/server/protocol/CommitTransactionIndication.java
index 6a36e48..42b2dfc 100644
--- a/plugins/org.eclipse.emf.cdo.server/src/org/eclipse/emf/cdo/internal/server/protocol/CommitTransactionIndication.java
+++ b/plugins/org.eclipse.emf.cdo.server/src/org/eclipse/emf/cdo/internal/server/protocol/CommitTransactionIndication.java
@@ -68,7 +68,6 @@ public class CommitTransactionIndication extends CDOServerIndication
TransactionPackageManager packageManager = transaction.getPackageManager();
CDOPackage[] newPackages = new CDOPackage[in.readInt()];
- CDORevision[] newResources = new CDORevision[in.readInt()];
CDORevision[] newObjects = new CDORevision[in.readInt()];
CDORevisionDelta[] dirtyObjectDeltas = new CDORevisionDelta[in.readInt()];
@@ -84,17 +83,6 @@ public class CommitTransactionIndication extends CDOServerIndication
packageManager.addPackage(newPackages[i]);
}
- // New resources
- if (PROTOCOL.isEnabled())
- {
- PROTOCOL.format("Reading {0} new resources", newResources.length);
- }
-
- for (int i = 0; i < newResources.length; i++)
- {
- newResources[i] = CDORevisionUtil.read(in, revisionResolver, packageManager);
- }
-
// New objects
if (PROTOCOL.isEnabled())
{
@@ -117,7 +105,7 @@ public class CommitTransactionIndication extends CDOServerIndication
dirtyObjectDeltas[i] = new CDORevisionDeltaImpl(in, packageManager);
}
- transaction.commit(newPackages, newResources, newObjects, dirtyObjectDeltas);
+ transaction.commit(newPackages, newObjects, dirtyObjectDeltas);
}
@Override
diff --git a/plugins/org.eclipse.emf.cdo.server/src/org/eclipse/emf/cdo/server/IStoreWriter.java b/plugins/org.eclipse.emf.cdo.server/src/org/eclipse/emf/cdo/server/IStoreWriter.java
index c1ddffa..7e6e8e9 100644
--- a/plugins/org.eclipse.emf.cdo.server/src/org/eclipse/emf/cdo/server/IStoreWriter.java
+++ b/plugins/org.eclipse.emf.cdo.server/src/org/eclipse/emf/cdo/server/IStoreWriter.java
@@ -31,15 +31,11 @@ public interface IStoreWriter extends IStoreReader
public void beginCommit(CommitContext context);
- public CDOID createNewResourceID(CommitContext context, int i, CDORevision newResource);
+ public void createNewIDs(CommitContext context, CDORevision[] newObjects, CDOID[] newIDs);
- public CDOID createNewObjectID(CommitContext context, int i, CDORevision newObject);
+ public void finishCommit(CommitContext context, CDORevision[] newObjects, CDORevision[] dirtyObjects);
- public void finishCommit(CommitContext context, CDORevision[] newResources, CDORevision[] newObjects,
- CDORevision[] dirtyObjects);
-
- public void finishCommit(CommitContext context, CDORevision[] newResources, CDORevision[] newObjects,
- CDORevisionDelta[] dirtyObjectDeltas);
+ public void finishCommit(CommitContext context, CDORevision[] newObjects, CDORevisionDelta[] dirtyObjectDeltas);
public void cancelCommit(CommitContext context);
@@ -78,12 +74,6 @@ public interface IStoreWriter extends IStoreReader
public CDOPackage[] getNewPackages();
/**
- * Returns the number of new resources that are part of the commit operation represented by this
- * <code>CommitContext</code>.
- */
- public int getNumberOfNewResources();
-
- /**
* Returns the number of new objects that are part of the commit operation represented by this
* <code>CommitContext</code>.
*/
diff --git a/plugins/org.eclipse.emf.cdo.ui/src/org/eclipse/emf/cdo/internal/ui/dialogs/RollbackTransactionDialog.java b/plugins/org.eclipse.emf.cdo.ui/src/org/eclipse/emf/cdo/internal/ui/dialogs/RollbackTransactionDialog.java
index 63c5999..7e20f9c 100644
--- a/plugins/org.eclipse.emf.cdo.ui/src/org/eclipse/emf/cdo/internal/ui/dialogs/RollbackTransactionDialog.java
+++ b/plugins/org.eclipse.emf.cdo.ui/src/org/eclipse/emf/cdo/internal/ui/dialogs/RollbackTransactionDialog.java
@@ -116,37 +116,15 @@ public class RollbackTransactionDialog extends TitleAreaDialog
protected String formatMessage()
{
- int newResources = transaction.getNewResources().size();
int newObjects = transaction.getNewObjects().size();
int dirtyObjects = transaction.getDirtyObjects().size();
- int count = (newResources > 0 ? 1 : 0) + (newObjects > 0 ? 1 : 0) + (dirtyObjects > 0 ? 1 : 0);
+ int count = (newObjects > 0 ? 1 : 0) + (dirtyObjects > 0 ? 1 : 0);
StringBuilder builder = new StringBuilder();
builder.append("This transaction contains ");
- if (newResources > 0)
- {
- builder.append(newResources);
- builder.append(" new resource");
- if (newResources > 1)
- {
- builder.append("s");
- }
- }
if (newObjects > 0)
{
- if (newResources > 0)
- {
- if (count > 2)
- {
- builder.append(", ");
- }
- else
- {
- builder.append(" and ");
- }
- }
-
builder.append(newObjects);
builder.append(" new object");
if (newObjects > 1)
@@ -157,7 +135,7 @@ public class RollbackTransactionDialog extends TitleAreaDialog
if (dirtyObjects > 0)
{
- if (count > 1)
+ if (count > 0)
{
builder.append(" and ");
}
diff --git a/plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/internal/cdo/protocol/CommitTransactionRequest.java b/plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/internal/cdo/protocol/CommitTransactionRequest.java
index fef017c..c10727c 100644
--- a/plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/internal/cdo/protocol/CommitTransactionRequest.java
+++ b/plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/internal/cdo/protocol/CommitTransactionRequest.java
@@ -71,8 +71,7 @@ public class CommitTransactionRequest extends CDOClientRequest<CommitTransaction
out.writeInt(transaction.getViewID());
out.writeInt(newPackages.size());
- out.writeInt(newResources.size());
- out.writeInt(newObjects.size());
+ out.writeInt(newResources.size() + newObjects.size());
out.writeInt(dirtyObjects.size());
if (PROTOCOL.isEnabled())
@@ -87,16 +86,10 @@ public class CommitTransactionRequest extends CDOClientRequest<CommitTransaction
if (PROTOCOL.isEnabled())
{
- PROTOCOL.format("Writing {0} new resources", newResources.size());
+ PROTOCOL.format("Writing {0} new objects", newResources.size() + newObjects.size());
}
writeRevisions(out, newResources);
-
- if (PROTOCOL.isEnabled())
- {
- PROTOCOL.format("Writing {0} new objects", newObjects.size());
- }
-
writeRevisions(out, newObjects);
if (PROTOCOL.isEnabled())