Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorEike Stepper2010-10-17 07:15:21 +0000
committerEike Stepper2010-10-17 07:15:21 +0000
commitcc1e1367fce0021c92e69f441bfa341230aef1a5 (patch)
treef1bd0fc63606bf8c9e88ec4842bed081e7793ef9 /plugins/org.eclipse.emf.cdo.workspace
parent2746e5c21da94fed21ab7e2de5a118b736e1e0f1 (diff)
downloadcdo-cc1e1367fce0021c92e69f441bfa341230aef1a5.tar.gz
cdo-cc1e1367fce0021c92e69f441bfa341230aef1a5.tar.xz
cdo-cc1e1367fce0021c92e69f441bfa341230aef1a5.zip
[327405] Provide an offline CDOWorkspace with Checkout/Update/Commit workflows
https://bugs.eclipse.org/bugs/show_bug.cgi?id=327405
Diffstat (limited to 'plugins/org.eclipse.emf.cdo.workspace')
-rw-r--r--plugins/org.eclipse.emf.cdo.workspace/plugin.xml4
-rw-r--r--plugins/org.eclipse.emf.cdo.workspace/src/org/eclipse/emf/cdo/internal/workspace/AbstractCDOWorkspaceBase.java (renamed from plugins/org.eclipse.emf.cdo.workspace/src/org/eclipse/emf/cdo/internal/workspace/AbstractCDOWorkspaceMemory.java)6
-rw-r--r--plugins/org.eclipse.emf.cdo.workspace/src/org/eclipse/emf/cdo/internal/workspace/CDOWorkspaceImpl.java46
-rw-r--r--plugins/org.eclipse.emf.cdo.workspace/src/org/eclipse/emf/cdo/internal/workspace/FolderCDOWorkspaceBase.java (renamed from plugins/org.eclipse.emf.cdo.workspace/src/org/eclipse/emf/cdo/internal/workspace/FolderCDOWorkspaceMemory.java)14
-rw-r--r--plugins/org.eclipse.emf.cdo.workspace/src/org/eclipse/emf/cdo/spi/workspace/InternalCDOWorkspace.java2
-rw-r--r--plugins/org.eclipse.emf.cdo.workspace/src/org/eclipse/emf/cdo/spi/workspace/InternalCDOWorkspaceBase.java (renamed from plugins/org.eclipse.emf.cdo.workspace/src/org/eclipse/emf/cdo/spi/workspace/InternalCDOWorkspaceMemory.java)6
-rw-r--r--plugins/org.eclipse.emf.cdo.workspace/src/org/eclipse/emf/cdo/workspace/CDOWorkspace.java2
-rw-r--r--plugins/org.eclipse.emf.cdo.workspace/src/org/eclipse/emf/cdo/workspace/CDOWorkspaceBase.java (renamed from plugins/org.eclipse.emf.cdo.workspace/src/org/eclipse/emf/cdo/workspace/CDOWorkspaceMemory.java)2
-rw-r--r--plugins/org.eclipse.emf.cdo.workspace/src/org/eclipse/emf/cdo/workspace/CDOWorkspaceUtil.java30
9 files changed, 61 insertions, 51 deletions
diff --git a/plugins/org.eclipse.emf.cdo.workspace/plugin.xml b/plugins/org.eclipse.emf.cdo.workspace/plugin.xml
index fb167b4f69..568d1356a8 100644
--- a/plugins/org.eclipse.emf.cdo.workspace/plugin.xml
+++ b/plugins/org.eclipse.emf.cdo.workspace/plugin.xml
@@ -16,8 +16,8 @@
<extension
point="org.eclipse.net4j.util.factories">
<factory
- class="org.eclipse.emf.cdo.internal.workspace.FolderCDOWorkspaceMemory$Factory"
- productGroup="org.eclipse.emf.cdo.workspace.memories"
+ class="org.eclipse.emf.cdo.internal.workspace.FolderCDOWorkspaceBase$Factory"
+ productGroup="org.eclipse.emf.cdo.workspace.bases"
type="folder"/>
</extension>
diff --git a/plugins/org.eclipse.emf.cdo.workspace/src/org/eclipse/emf/cdo/internal/workspace/AbstractCDOWorkspaceMemory.java b/plugins/org.eclipse.emf.cdo.workspace/src/org/eclipse/emf/cdo/internal/workspace/AbstractCDOWorkspaceBase.java
index 2beb6b75fb..c87280d027 100644
--- a/plugins/org.eclipse.emf.cdo.workspace/src/org/eclipse/emf/cdo/internal/workspace/AbstractCDOWorkspaceMemory.java
+++ b/plugins/org.eclipse.emf.cdo.workspace/src/org/eclipse/emf/cdo/internal/workspace/AbstractCDOWorkspaceBase.java
@@ -24,7 +24,7 @@ import org.eclipse.emf.cdo.spi.common.revision.InternalCDORevision;
import org.eclipse.emf.cdo.spi.server.InternalRepository;
import org.eclipse.emf.cdo.spi.server.InternalStore;
import org.eclipse.emf.cdo.spi.workspace.InternalCDOWorkspace;
-import org.eclipse.emf.cdo.spi.workspace.InternalCDOWorkspaceMemory;
+import org.eclipse.emf.cdo.spi.workspace.InternalCDOWorkspaceBase;
import org.eclipse.emf.cdo.transaction.CDOTransaction;
import org.eclipse.net4j.util.io.ExtendedDataInputStream;
@@ -38,7 +38,7 @@ import java.util.Set;
/**
* @author Eike Stepper
*/
-public abstract class AbstractCDOWorkspaceMemory implements InternalCDOWorkspaceMemory
+public abstract class AbstractCDOWorkspaceBase implements InternalCDOWorkspaceBase
{
private InternalCDOWorkspace workspace;
@@ -48,7 +48,7 @@ public abstract class AbstractCDOWorkspaceMemory implements InternalCDOWorkspace
private InternalCDOBranchManager branchManager;
- protected AbstractCDOWorkspaceMemory()
+ protected AbstractCDOWorkspaceBase()
{
}
diff --git a/plugins/org.eclipse.emf.cdo.workspace/src/org/eclipse/emf/cdo/internal/workspace/CDOWorkspaceImpl.java b/plugins/org.eclipse.emf.cdo.workspace/src/org/eclipse/emf/cdo/internal/workspace/CDOWorkspaceImpl.java
index 07a2f47c28..9220a9432f 100644
--- a/plugins/org.eclipse.emf.cdo.workspace/src/org/eclipse/emf/cdo/internal/workspace/CDOWorkspaceImpl.java
+++ b/plugins/org.eclipse.emf.cdo.workspace/src/org/eclipse/emf/cdo/internal/workspace/CDOWorkspaceImpl.java
@@ -43,7 +43,7 @@ import org.eclipse.emf.cdo.spi.common.revision.InternalCDORevision;
import org.eclipse.emf.cdo.spi.server.InternalRepository;
import org.eclipse.emf.cdo.spi.server.InternalStore;
import org.eclipse.emf.cdo.spi.workspace.InternalCDOWorkspace;
-import org.eclipse.emf.cdo.spi.workspace.InternalCDOWorkspaceMemory;
+import org.eclipse.emf.cdo.spi.workspace.InternalCDOWorkspaceBase;
import org.eclipse.emf.cdo.transaction.CDOCommitContext;
import org.eclipse.emf.cdo.transaction.CDODefaultTransactionHandler2;
import org.eclipse.emf.cdo.transaction.CDOMerger;
@@ -89,7 +89,7 @@ public class CDOWorkspaceImpl implements InternalCDOWorkspace
private IManagedContainer container;
- private InternalCDOWorkspaceMemory memory;
+ private InternalCDOWorkspaceBase base;
private InternalRepository localRepository;
@@ -105,10 +105,10 @@ public class CDOWorkspaceImpl implements InternalCDOWorkspace
private Set<InternalCDOView> views = new HashSet<InternalCDOView>();
- public CDOWorkspaceImpl(IStore local, InternalCDOWorkspaceMemory memory, CDOSessionConfigurationFactory remote,
+ public CDOWorkspaceImpl(IStore local, InternalCDOWorkspaceBase base, CDOSessionConfigurationFactory remote,
String branchPath, long timeStamp)
{
- init(local, memory, remote);
+ init(local, base, remote);
remoteSessionConfigurationFactory = remote;
this.branchPath = StringUtil.isEmpty(branchPath) ? CDOBranch.MAIN_BRANCH_NAME : branchPath;
@@ -119,14 +119,14 @@ public class CDOWorkspaceImpl implements InternalCDOWorkspace
saveProperties();
}
- public CDOWorkspaceImpl(IStore local, InternalCDOWorkspaceMemory memory, CDOSessionConfigurationFactory remote)
+ public CDOWorkspaceImpl(IStore local, InternalCDOWorkspaceBase base, CDOSessionConfigurationFactory remote)
{
- init(local, memory, remote);
+ init(local, base, remote);
open();
loadProperties();
}
- protected void init(IStore local, InternalCDOWorkspaceMemory memory, CDOSessionConfigurationFactory remote)
+ protected void init(IStore local, InternalCDOWorkspaceBase base, CDOSessionConfigurationFactory remote)
{
container = createContainer(local);
remoteSessionConfigurationFactory = remote;
@@ -134,8 +134,8 @@ public class CDOWorkspaceImpl implements InternalCDOWorkspace
localRepository = createLocalRepository(local);
localSession = openLocalSession();
- this.memory = memory;
- this.memory.init(this);
+ this.base = base;
+ this.base.init(this);
}
protected void checkout()
@@ -214,9 +214,9 @@ public class CDOWorkspaceImpl implements InternalCDOWorkspace
return fixed;
}
- public InternalCDOWorkspaceMemory getMemory()
+ public InternalCDOWorkspaceBase getBase()
{
- return memory;
+ return base;
}
public CDOView openView()
@@ -264,17 +264,17 @@ public class CDOWorkspaceImpl implements InternalCDOWorkspace
try
{
InternalCDOBranchManager branchManager = session.getBranchManager();
- CDOBranchPoint base = branchManager.getBranch(branchPath).getPoint(this.timeStamp);
- CDOBranchPoint remote = branchManager.getBranch(branchPath).getPoint(timeStamp);
+ CDOBranchPoint basePoint = branchManager.getBranch(branchPath).getPoint(this.timeStamp);
+ CDOBranchPoint remotePoint = branchManager.getBranch(branchPath).getPoint(timeStamp);
- CDOBranchPointRange range = CDOBranchUtil.createRange(base, remote);
+ CDOBranchPointRange range = CDOBranchUtil.createRange(basePoint, remotePoint);
CDOChangeSetData remoteData = session.getSessionProtocol().loadChangeSets(range)[0];
CDOChangeSetData localData = getLocalChanges();
if (!localData.isEmpty())
{
- CDOChangeSet localChanges = CDORevisionDeltaUtil.createChangeSet(base, null, localData);
- CDOChangeSet remoteChanges = CDORevisionDeltaUtil.createChangeSet(base, remote, remoteData);
+ CDOChangeSet localChanges = CDORevisionDeltaUtil.createChangeSet(basePoint, null, localData);
+ CDOChangeSet remoteChanges = CDORevisionDeltaUtil.createChangeSet(basePoint, remotePoint, remoteData);
remoteData = merger.merge(localChanges, remoteChanges);
}
@@ -284,7 +284,7 @@ public class CDOWorkspaceImpl implements InternalCDOWorkspace
@Override
public void committedTransaction(CDOTransaction transaction, CDOCommitContext commitContext)
{
- memory.clear();
+ base.clear();
}
});
@@ -292,7 +292,7 @@ public class CDOWorkspaceImpl implements InternalCDOWorkspace
{
public CDORevision getRevision(CDOID id)
{
- CDORevision revision = memory.getRevision(id);
+ CDORevision revision = base.getRevision(id);
if (revision == null)
{
revision = CDOWorkspaceImpl.this.getRevision(id);
@@ -338,12 +338,12 @@ public class CDOWorkspaceImpl implements InternalCDOWorkspace
CDOChangeSetData changes = getLocalChanges();
- transaction.applyChangeSetData(changes, memory, this, null);
+ transaction.applyChangeSetData(changes, base, this, null);
transaction.setCommitComment(comment);
CDOCommitInfo info = transaction.commit();
- memory.clear();
+ base.clear();
timeStamp = info.getTimeStamp();
saveProperties();
@@ -397,8 +397,8 @@ public class CDOWorkspaceImpl implements InternalCDOWorkspace
public CDOChangeSetData getLocalChanges()
{
- Set<CDOID> ids = memory.getIDs();
- return CDORevisionDeltaUtil.createChangeSetData(ids, memory, this);
+ Set<CDOID> ids = base.getIDs();
+ return CDORevisionDeltaUtil.createChangeSetData(ids, base, this);
}
protected IManagedContainer createContainer(IStore local)
@@ -524,7 +524,7 @@ public class CDOWorkspaceImpl implements InternalCDOWorkspace
@Override
public void committedTransaction(CDOTransaction transaction, CDOCommitContext commitContext)
{
- memory.updateAfterCommit(transaction);
+ base.updateAfterCommit(transaction);
}
});
}
diff --git a/plugins/org.eclipse.emf.cdo.workspace/src/org/eclipse/emf/cdo/internal/workspace/FolderCDOWorkspaceMemory.java b/plugins/org.eclipse.emf.cdo.workspace/src/org/eclipse/emf/cdo/internal/workspace/FolderCDOWorkspaceBase.java
index 91c51fd056..2c8aedf12a 100644
--- a/plugins/org.eclipse.emf.cdo.workspace/src/org/eclipse/emf/cdo/internal/workspace/FolderCDOWorkspaceMemory.java
+++ b/plugins/org.eclipse.emf.cdo.workspace/src/org/eclipse/emf/cdo/internal/workspace/FolderCDOWorkspaceBase.java
@@ -16,7 +16,9 @@ import org.eclipse.emf.cdo.common.protocol.CDODataInput;
import org.eclipse.emf.cdo.common.protocol.CDODataOutput;
import org.eclipse.emf.cdo.common.revision.CDORevision;
import org.eclipse.emf.cdo.spi.common.revision.InternalCDORevision;
-import org.eclipse.emf.cdo.spi.workspace.InternalCDOWorkspaceMemory;
+import org.eclipse.emf.cdo.spi.workspace.InternalCDOWorkspaceBase;
+import org.eclipse.emf.cdo.workspace.CDOWorkspaceBase;
+import org.eclipse.emf.cdo.workspace.CDOWorkspaceUtil;
import org.eclipse.net4j.util.factory.ProductCreationException;
import org.eclipse.net4j.util.io.ExtendedDataInputStream;
@@ -32,11 +34,11 @@ import java.util.Set;
/**
* @author Eike Stepper
*/
-public class FolderCDOWorkspaceMemory extends AbstractCDOWorkspaceMemory
+public class FolderCDOWorkspaceBase extends AbstractCDOWorkspaceBase
{
private File folder;
- public FolderCDOWorkspaceMemory(File folder)
+ public FolderCDOWorkspaceBase(File folder)
{
this.folder = folder;
}
@@ -205,7 +207,7 @@ public class FolderCDOWorkspaceMemory extends AbstractCDOWorkspaceMemory
public Factory()
{
- super(InternalCDOWorkspaceMemory.PRODUCT_GROUP, TYPE);
+ super(InternalCDOWorkspaceBase.PRODUCT_GROUP, TYPE);
}
public Factory(String productGroup, String type)
@@ -213,9 +215,9 @@ public class FolderCDOWorkspaceMemory extends AbstractCDOWorkspaceMemory
super(productGroup, type);
}
- public FolderCDOWorkspaceMemory create(String description) throws ProductCreationException
+ public CDOWorkspaceBase create(String description) throws ProductCreationException
{
- return new FolderCDOWorkspaceMemory(new File(description));
+ return CDOWorkspaceUtil.createFolderWorkspaceBase(new File(description));
}
}
}
diff --git a/plugins/org.eclipse.emf.cdo.workspace/src/org/eclipse/emf/cdo/spi/workspace/InternalCDOWorkspace.java b/plugins/org.eclipse.emf.cdo.workspace/src/org/eclipse/emf/cdo/spi/workspace/InternalCDOWorkspace.java
index 66f5af5e9e..249e0aae70 100644
--- a/plugins/org.eclipse.emf.cdo.workspace/src/org/eclipse/emf/cdo/spi/workspace/InternalCDOWorkspace.java
+++ b/plugins/org.eclipse.emf.cdo.workspace/src/org/eclipse/emf/cdo/spi/workspace/InternalCDOWorkspace.java
@@ -18,7 +18,7 @@ import org.eclipse.emf.cdo.workspace.CDOWorkspace;
*/
public interface InternalCDOWorkspace extends CDOWorkspace
{
- public InternalCDOWorkspaceMemory getMemory();
+ public InternalCDOWorkspaceBase getBase();
public InternalRepository getLocalRepository();
}
diff --git a/plugins/org.eclipse.emf.cdo.workspace/src/org/eclipse/emf/cdo/spi/workspace/InternalCDOWorkspaceMemory.java b/plugins/org.eclipse.emf.cdo.workspace/src/org/eclipse/emf/cdo/spi/workspace/InternalCDOWorkspaceBase.java
index 6c3c90e52e..7d16709963 100644
--- a/plugins/org.eclipse.emf.cdo.workspace/src/org/eclipse/emf/cdo/spi/workspace/InternalCDOWorkspaceMemory.java
+++ b/plugins/org.eclipse.emf.cdo.workspace/src/org/eclipse/emf/cdo/spi/workspace/InternalCDOWorkspaceBase.java
@@ -11,14 +11,14 @@
package org.eclipse.emf.cdo.spi.workspace;
import org.eclipse.emf.cdo.transaction.CDOTransaction;
-import org.eclipse.emf.cdo.workspace.CDOWorkspaceMemory;
+import org.eclipse.emf.cdo.workspace.CDOWorkspaceBase;
/**
* @author Eike Stepper
*/
-public interface InternalCDOWorkspaceMemory extends CDOWorkspaceMemory
+public interface InternalCDOWorkspaceBase extends CDOWorkspaceBase
{
- public static final String PRODUCT_GROUP = "org.eclipse.emf.cdo.workspace.memories";
+ public static final String PRODUCT_GROUP = "org.eclipse.emf.cdo.workspace.bases";
public InternalCDOWorkspace getWorkspace();
diff --git a/plugins/org.eclipse.emf.cdo.workspace/src/org/eclipse/emf/cdo/workspace/CDOWorkspace.java b/plugins/org.eclipse.emf.cdo.workspace/src/org/eclipse/emf/cdo/workspace/CDOWorkspace.java
index 0598992f13..c431d1f1a5 100644
--- a/plugins/org.eclipse.emf.cdo.workspace/src/org/eclipse/emf/cdo/workspace/CDOWorkspace.java
+++ b/plugins/org.eclipse.emf.cdo.workspace/src/org/eclipse/emf/cdo/workspace/CDOWorkspace.java
@@ -33,7 +33,7 @@ public interface CDOWorkspace extends CDORevisionProvider, Closeable
public boolean isFixed();
- public CDOWorkspaceMemory getMemory();
+ public CDOWorkspaceBase getBase();
public CDOView openView();
diff --git a/plugins/org.eclipse.emf.cdo.workspace/src/org/eclipse/emf/cdo/workspace/CDOWorkspaceMemory.java b/plugins/org.eclipse.emf.cdo.workspace/src/org/eclipse/emf/cdo/workspace/CDOWorkspaceBase.java
index 9339deb05f..7ea8db1e62 100644
--- a/plugins/org.eclipse.emf.cdo.workspace/src/org/eclipse/emf/cdo/workspace/CDOWorkspaceMemory.java
+++ b/plugins/org.eclipse.emf.cdo.workspace/src/org/eclipse/emf/cdo/workspace/CDOWorkspaceBase.java
@@ -18,7 +18,7 @@ import java.util.Set;
/**
* @author Eike Stepper
*/
-public interface CDOWorkspaceMemory extends CDORevisionProvider
+public interface CDOWorkspaceBase extends CDORevisionProvider
{
public CDOWorkspace getWorkspace();
diff --git a/plugins/org.eclipse.emf.cdo.workspace/src/org/eclipse/emf/cdo/workspace/CDOWorkspaceUtil.java b/plugins/org.eclipse.emf.cdo.workspace/src/org/eclipse/emf/cdo/workspace/CDOWorkspaceUtil.java
index 7a5f3c60ac..e69b88bf76 100644
--- a/plugins/org.eclipse.emf.cdo.workspace/src/org/eclipse/emf/cdo/workspace/CDOWorkspaceUtil.java
+++ b/plugins/org.eclipse.emf.cdo.workspace/src/org/eclipse/emf/cdo/workspace/CDOWorkspaceUtil.java
@@ -12,9 +12,12 @@ package org.eclipse.emf.cdo.workspace;
import org.eclipse.emf.cdo.common.branch.CDOBranchPoint;
import org.eclipse.emf.cdo.internal.workspace.CDOWorkspaceImpl;
+import org.eclipse.emf.cdo.internal.workspace.FolderCDOWorkspaceBase;
import org.eclipse.emf.cdo.server.IStore;
import org.eclipse.emf.cdo.session.CDOSessionConfigurationFactory;
-import org.eclipse.emf.cdo.spi.workspace.InternalCDOWorkspaceMemory;
+import org.eclipse.emf.cdo.spi.workspace.InternalCDOWorkspaceBase;
+
+import java.io.File;
/**
* @author Eike Stepper
@@ -25,31 +28,36 @@ public final class CDOWorkspaceUtil
{
}
- public static CDOWorkspace open(IStore local, CDOWorkspaceMemory memory, CDOSessionConfigurationFactory remote)
+ public static CDOWorkspaceBase createFolderWorkspaceBase(File folder)
+ {
+ return new FolderCDOWorkspaceBase(folder);
+ }
+
+ public static CDOWorkspace open(IStore local, CDOWorkspaceBase base, CDOSessionConfigurationFactory remote)
{
- return new CDOWorkspaceImpl(local, (InternalCDOWorkspaceMemory)memory, remote);
+ return new CDOWorkspaceImpl(local, (InternalCDOWorkspaceBase)base, remote);
}
- public static CDOWorkspace checkout(IStore local, CDOWorkspaceMemory memory, CDOSessionConfigurationFactory remote)
+ public static CDOWorkspace checkout(IStore local, CDOWorkspaceBase base, CDOSessionConfigurationFactory remote)
{
- return checkout(local, memory, remote, null);
+ return checkout(local, base, remote, null);
}
- public static CDOWorkspace checkout(IStore local, CDOWorkspaceMemory memory, CDOSessionConfigurationFactory remote,
+ public static CDOWorkspace checkout(IStore local, CDOWorkspaceBase base, CDOSessionConfigurationFactory remote,
String branchPath)
{
- return checkout(local, memory, remote, branchPath, CDOBranchPoint.UNSPECIFIED_DATE);
+ return checkout(local, base, remote, branchPath, CDOBranchPoint.UNSPECIFIED_DATE);
}
- public static CDOWorkspace checkout(IStore local, CDOWorkspaceMemory memory, CDOSessionConfigurationFactory remote,
+ public static CDOWorkspace checkout(IStore local, CDOWorkspaceBase base, CDOSessionConfigurationFactory remote,
long timeStamp)
{
- return checkout(local, memory, remote, null, timeStamp);
+ return checkout(local, base, remote, null, timeStamp);
}
- public static CDOWorkspace checkout(IStore local, CDOWorkspaceMemory memory, CDOSessionConfigurationFactory remote,
+ public static CDOWorkspace checkout(IStore local, CDOWorkspaceBase base, CDOSessionConfigurationFactory remote,
String branchPath, long timeStamp)
{
- return new CDOWorkspaceImpl(local, (InternalCDOWorkspaceMemory)memory, remote, branchPath, timeStamp);
+ return new CDOWorkspaceImpl(local, (InternalCDOWorkspaceBase)base, remote, branchPath, timeStamp);
}
}

Back to the top