Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
Diffstat (limited to 'plugins/org.eclipse.emf.cdo.workspace')
-rw-r--r--plugins/org.eclipse.emf.cdo.workspace/META-INF/MANIFEST.MF1
-rw-r--r--plugins/org.eclipse.emf.cdo.workspace/src/org/eclipse/emf/cdo/internal/workspace/AbstractCDOWorkspaceMemory.java (renamed from plugins/org.eclipse.emf.cdo.workspace/src/org/eclipse/emf/cdo/internal/workspace/AbstractCDOWorkspaceBaseline.java)51
-rw-r--r--plugins/org.eclipse.emf.cdo.workspace/src/org/eclipse/emf/cdo/internal/workspace/CDOWorkspaceImpl.java189
-rw-r--r--plugins/org.eclipse.emf.cdo.workspace/src/org/eclipse/emf/cdo/internal/workspace/FolderCDOWorkspaceMemory.java (renamed from plugins/org.eclipse.emf.cdo.workspace/src/org/eclipse/emf/cdo/internal/workspace/FolderCDOWorkspaceBaseline.java)4
-rw-r--r--plugins/org.eclipse.emf.cdo.workspace/src/org/eclipse/emf/cdo/spi/workspace/InternalCDOWorkspace.java27
-rw-r--r--plugins/org.eclipse.emf.cdo.workspace/src/org/eclipse/emf/cdo/spi/workspace/InternalCDOWorkspaceMemory.java (renamed from plugins/org.eclipse.emf.cdo.workspace/src/org/eclipse/emf/cdo/internal/workspace/InternalCDOWorkspaceBaseline.java)15
-rw-r--r--plugins/org.eclipse.emf.cdo.workspace/src/org/eclipse/emf/cdo/workspace/CDOWorkspace.java17
-rw-r--r--plugins/org.eclipse.emf.cdo.workspace/src/org/eclipse/emf/cdo/workspace/CDOWorkspaceMemory.java (renamed from plugins/org.eclipse.emf.cdo.workspace/src/org/eclipse/emf/cdo/workspace/CDOWorkspaceBaseline.java)8
-rw-r--r--plugins/org.eclipse.emf.cdo.workspace/src/org/eclipse/emf/cdo/workspace/CDOWorkspaceUtil.java30
9 files changed, 193 insertions, 149 deletions
diff --git a/plugins/org.eclipse.emf.cdo.workspace/META-INF/MANIFEST.MF b/plugins/org.eclipse.emf.cdo.workspace/META-INF/MANIFEST.MF
index 50fa1fb0b9..82918c2fd0 100644
--- a/plugins/org.eclipse.emf.cdo.workspace/META-INF/MANIFEST.MF
+++ b/plugins/org.eclipse.emf.cdo.workspace/META-INF/MANIFEST.MF
@@ -10,6 +10,7 @@ Require-Bundle: org.eclipse.core.runtime;bundle-version="[3.4.0,4.0.0)";resoluti
org.eclipse.net4j.jvm;bundle-version="[4.0.0,5.0.0)"
Export-Package: org.eclipse.emf.cdo.internal.workspace;version="4.0.0";x-friends:="org.eclipse.emf.cdo.tests,org.eclipse.emf.cdo.tests.db",
org.eclipse.emf.cdo.internal.workspace.bundle;version="4.0.0";x-internal:=true,
+ org.eclipse.emf.cdo.spi.workspace;version="4.0.0",
org.eclipse.emf.cdo.workspace;version="4.0.0"
Bundle-Vendor: %providerName
Bundle-ActivationPolicy: lazy
diff --git a/plugins/org.eclipse.emf.cdo.workspace/src/org/eclipse/emf/cdo/internal/workspace/AbstractCDOWorkspaceBaseline.java b/plugins/org.eclipse.emf.cdo.workspace/src/org/eclipse/emf/cdo/internal/workspace/AbstractCDOWorkspaceMemory.java
index 77f64c8ec5..2beb6b75fb 100644
--- a/plugins/org.eclipse.emf.cdo.workspace/src/org/eclipse/emf/cdo/internal/workspace/AbstractCDOWorkspaceBaseline.java
+++ b/plugins/org.eclipse.emf.cdo.workspace/src/org/eclipse/emf/cdo/internal/workspace/AbstractCDOWorkspaceMemory.java
@@ -23,8 +23,9 @@ import org.eclipse.emf.cdo.spi.common.model.InternalCDOPackageRegistry;
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.transaction.CDOTransaction;
-import org.eclipse.emf.cdo.workspace.CDOWorkspace;
import org.eclipse.net4j.util.io.ExtendedDataInputStream;
import org.eclipse.net4j.util.io.ExtendedDataOutputStream;
@@ -37,15 +38,9 @@ import java.util.Set;
/**
* @author Eike Stepper
*/
-public abstract class AbstractCDOWorkspaceBaseline implements InternalCDOWorkspaceBaseline
+public abstract class AbstractCDOWorkspaceMemory implements InternalCDOWorkspaceMemory
{
- private CDOWorkspace workspace;
-
- private String branchPath;
-
- private long timeStamp;
-
- private long lastUpdateTime;
+ private InternalCDOWorkspace workspace;
private InternalStore store;
@@ -53,54 +48,24 @@ public abstract class AbstractCDOWorkspaceBaseline implements InternalCDOWorkspa
private InternalCDOBranchManager branchManager;
- protected AbstractCDOWorkspaceBaseline()
+ protected AbstractCDOWorkspaceMemory()
{
}
- public void init(CDOWorkspace workspace)
+ public void init(InternalCDOWorkspace workspace)
{
this.workspace = workspace;
- InternalRepository localRepository = (InternalRepository)workspace.getLocalRepository();
+ InternalRepository localRepository = workspace.getLocalRepository();
store = localRepository.getStore();
packageRegistry = localRepository.getPackageRegistry(false);
branchManager = localRepository.getBranchManager();
}
- public CDOWorkspace getWorkspace()
+ public InternalCDOWorkspace getWorkspace()
{
return workspace;
}
- public String getBranchPath()
- {
- return branchPath;
- }
-
- public void setBranchPath(String branchPath)
- {
- this.branchPath = branchPath;
- }
-
- public long getTimeStamp()
- {
- return timeStamp;
- }
-
- public void setTimeStamp(long timeStamp)
- {
- this.timeStamp = timeStamp;
- }
-
- public long getLastUpdateTime()
- {
- return lastUpdateTime;
- }
-
- public void setLastUpdateTime(long lastUpdateTime)
- {
- this.lastUpdateTime = lastUpdateTime;
- }
-
public void updateAfterCommit(CDOTransaction transaction)
{
InternalCDOTransaction tx = (InternalCDOTransaction)transaction;
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 616fdaacc7..e1770638cf 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
@@ -39,6 +39,8 @@ import org.eclipse.emf.cdo.spi.common.model.InternalCDOPackageUnit;
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.transaction.CDOCommitContext;
import org.eclipse.emf.cdo.transaction.CDODefaultTransactionHandler2;
import org.eclipse.emf.cdo.transaction.CDOMerger;
@@ -46,12 +48,12 @@ import org.eclipse.emf.cdo.transaction.CDOTransaction;
import org.eclipse.emf.cdo.util.CommitException;
import org.eclipse.emf.cdo.util.ReadOnlyException;
import org.eclipse.emf.cdo.view.CDOView;
-import org.eclipse.emf.cdo.workspace.CDOWorkspace;
import org.eclipse.net4j.Net4jUtil;
import org.eclipse.net4j.jvm.IJVMAcceptor;
import org.eclipse.net4j.jvm.IJVMConnector;
import org.eclipse.net4j.jvm.JVMUtil;
+import org.eclipse.net4j.util.StringUtil;
import org.eclipse.net4j.util.container.ContainerUtil;
import org.eclipse.net4j.util.container.IManagedContainer;
import org.eclipse.net4j.util.lifecycle.ILifecycle;
@@ -65,6 +67,7 @@ import org.eclipse.emf.spi.cdo.InternalCDOSession;
import org.eclipse.emf.spi.cdo.InternalCDOTransaction;
import org.eclipse.emf.spi.cdo.InternalCDOView;
+import java.util.Arrays;
import java.util.HashMap;
import java.util.HashSet;
import java.util.Map;
@@ -73,55 +76,63 @@ import java.util.Set;
/**
* @author Eike Stepper
*/
-public class CDOWorkspaceImpl implements CDOWorkspace
+public class CDOWorkspaceImpl implements InternalCDOWorkspace
{
private static final String PROP_BRANCH_PATH = "org.eclipse.emf.cdo.workspace.branchPath"; //$NON-NLS-1$
private static final String PROP_TIME_STAMP = "org.eclipse.emf.cdo.workspace.timeStamp"; //$NON-NLS-1$
- private static final String PROP_LAST_UPDATE_TIME = "org.eclipse.emf.cdo.workspace.lastUpdateTime"; //$NON-NLS-1$
+ private static final String PROP_READ_ONLY = "org.eclipse.emf.cdo.workspace.readOnly"; //$NON-NLS-1$
private IManagedContainer container;
- private InternalRepository localRepository;
+ private InternalCDOWorkspaceMemory memory;
- private IJVMAcceptor localAcceptor;
+ private InternalRepository localRepository;
private InternalCDOSession localSession;
- private InternalCDOWorkspaceBaseline baseline;
+ private String branchPath;
+
+ private long timeStamp;
+
+ private boolean readOnly;
private CDOSessionConfigurationFactory remoteSessionConfigurationFactory;
private Set<InternalCDOView> views = new HashSet<InternalCDOView>();
- private CDOWorkspaceImpl(IStore local, InternalCDOWorkspaceBaseline baseline)
+ public CDOWorkspaceImpl(IStore local, InternalCDOWorkspaceMemory memory, CDOSessionConfigurationFactory remote,
+ String branchPath, long timeStamp)
{
- container = createContainer(local);
- localRepository = createLocalRepository(local);
- localAcceptor = getLocalAcceptor();
- localSession = openLocalSession();
+ init(local, memory, remote);
+ remoteSessionConfigurationFactory = remote;
+
+ this.branchPath = StringUtil.isEmpty(branchPath) ? CDOBranch.MAIN_BRANCH_NAME : branchPath;
+ this.timeStamp = timeStamp;
+ readOnly = timeStamp != CDOBranchPoint.UNSPECIFIED_DATE;
- this.baseline = baseline;
- baseline.init(this);
+ saveProperties();
+ checkout();
}
- public CDOWorkspaceImpl(IStore local, InternalCDOWorkspaceBaseline baseline, CDOSessionConfigurationFactory remote,
- String branchPath, long timeStamp)
+ public CDOWorkspaceImpl(IStore local, InternalCDOWorkspaceMemory memory, CDOSessionConfigurationFactory remote)
{
- this(local, baseline);
- baseline.setBranchPath(branchPath);
- baseline.setTimeStamp(timeStamp);
- baseline.setLastUpdateTime(timeStamp);
- remoteSessionConfigurationFactory = remote;
- checkout();
+ init(local, memory, remote);
+ open();
+ loadProperties();
}
- public CDOWorkspaceImpl(IStore local, InternalCDOWorkspaceBaseline baseline, CDOSessionConfigurationFactory remote)
+ protected void init(IStore local, InternalCDOWorkspaceMemory memory, CDOSessionConfigurationFactory remote)
{
- this(local, baseline);
+ container = createContainer(local);
remoteSessionConfigurationFactory = remote;
- open();
+
+ localRepository = createLocalRepository(local);
+ localSession = openLocalSession();
+
+ this.memory = memory;
+ this.memory.init(this);
}
protected void checkout()
@@ -158,8 +169,8 @@ public class CDOWorkspaceImpl implements CDOWorkspace
}
};
- CDOBranch branch = session.getBranchManager().getBranch(baseline.getBranchPath());
- session.getSessionProtocol().handleRevisions(null, branch, false, baseline.getTimeStamp(), false, handler);
+ CDOBranch branch = session.getBranchManager().getBranch(branchPath);
+ session.getSessionProtocol().handleRevisions(null, branch, false, timeStamp, false, handler);
}
finally
{
@@ -167,7 +178,6 @@ public class CDOWorkspaceImpl implements CDOWorkspace
}
accessor.rawCommit(context[0], monitor);
- storeBranchPoint(baseline.getBranchPath(), baseline.getTimeStamp(), baseline.getLastUpdateTime());
}
finally
{
@@ -180,9 +190,24 @@ public class CDOWorkspaceImpl implements CDOWorkspace
{
}
- public InternalCDOWorkspaceBaseline getBaseline()
+ public String getBranchPath()
+ {
+ return branchPath;
+ }
+
+ public long getTimeStamp()
+ {
+ return timeStamp;
+ }
+
+ public boolean isReadOnly()
+ {
+ return readOnly;
+ }
+
+ public InternalCDOWorkspaceMemory getMemory()
{
- return baseline;
+ return memory;
}
public CDOView openView()
@@ -215,39 +240,35 @@ public class CDOWorkspaceImpl implements CDOWorkspace
public CDOTransaction update(CDOMerger merger)
{
- return update(merger, baseline.getBranchPath());
+ return merge(merger, branchPath);
}
- public CDOTransaction update(CDOMerger merger, String branchPath)
+ public CDOTransaction merge(CDOMerger merger, String branchPath)
{
- return update(merger, branchPath, CDOBranchPoint.UNSPECIFIED_DATE);
+ return merge(merger, branchPath, CDOBranchPoint.UNSPECIFIED_DATE);
}
- public CDOTransaction update(CDOMerger merger, String branchPath, long timeStamp)
+ public CDOTransaction merge(CDOMerger merger, String branchPath, long timeStamp)
{
InternalCDOSession session = openRemoteSession();
try
{
InternalCDOBranchManager branchManager = session.getBranchManager();
- CDOBranchPoint base = branchManager.getBranch(baseline.getBranchPath()).getPoint(baseline.getTimeStamp());
+ CDOBranchPoint base = branchManager.getBranch(branchPath).getPoint(timeStamp);
CDOBranchPoint remote = branchManager.getBranch(branchPath).getPoint(timeStamp);
- CDOBranchPoint local = branchManager.getBranch(branchPath).getPoint(timeStamp);
CDOBranchPointRange range = CDOBranchUtil.createRange(base, remote);
CDOChangeSetData remoteData = session.getSessionProtocol().loadChangeSets(range)[0];
+ CDOChangeSet remoteChanges = CDORevisionDeltaUtil.createChangeSet(base, remote, remoteData);
+
CDOChangeSetData localData = getLocalChanges();
+ CDOChangeSet localChanges = CDORevisionDeltaUtil.createChangeSet(base, null, localData);
- CDOChangeSet localChanges = CDORevisionDeltaUtil.createChangeSet(base, local, localData);
- CDOChangeSet remoteChanges = CDORevisionDeltaUtil.createChangeSet(base, remote, remoteData);
CDOChangeSetData result = merger.merge(localChanges, remoteChanges);
InternalCDOTransaction transaction = (InternalCDOTransaction)openTransaction();
- transaction.applyChangeSetData(result, baseline, this, null);
-
- baseline.clear();
- baseline.setLastUpdateTime(timeStamp);
-
+ transaction.applyChangeSetData(result, memory, this, null);
return transaction;
}
finally
@@ -279,19 +300,19 @@ public class CDOWorkspaceImpl implements CDOWorkspace
try
{
- InternalCDOBranch branch = session.getBranchManager().getBranch(baseline.getBranchPath());
+ InternalCDOBranch branch = session.getBranchManager().getBranch(branchPath);
InternalCDOTransaction transaction = (InternalCDOTransaction)session.openTransaction(branch);
CDOChangeSetData changes = getLocalChanges();
- transaction.applyChangeSetData(changes, baseline, this, null);
+ transaction.applyChangeSetData(changes, memory, this, null);
transaction.setCommitComment(comment);
CDOCommitInfo info = transaction.commit();
- long timeStamp = info.getTimeStamp();
- baseline.clear();
- baseline.setLastUpdateTime(timeStamp);
+ memory.clear();
+ timeStamp = info.getTimeStamp();
+ saveProperties();
return info;
}
@@ -301,14 +322,22 @@ public class CDOWorkspaceImpl implements CDOWorkspace
}
}
+ public CDOChangeSetData compare(String branchPath)
+ {
+ return compare(branchPath, CDOBranchPoint.UNSPECIFIED_DATE);
+ }
+
+ public CDOChangeSetData compare(String branchPath, long timeStamp)
+ {
+ // TODO: implement CDOWorkspaceImpl.compare(branchPath, timeStamp)
+ throw new UnsupportedOperationException();
+ }
+
public synchronized void close()
{
LifecycleUtil.deactivate(localSession);
localSession = null;
- LifecycleUtil.deactivate(localAcceptor);
- localAcceptor = null;
-
LifecycleUtil.deactivate(localRepository);
localRepository = null;
@@ -318,12 +347,7 @@ public class CDOWorkspaceImpl implements CDOWorkspace
public synchronized boolean isClosed()
{
- return localRepository == null;
- }
-
- public InternalRepository getLocalRepository()
- {
- return localRepository;
+ return container == null;
}
public CDORevision getRevision(CDOID id)
@@ -333,10 +357,25 @@ public class CDOWorkspaceImpl implements CDOWorkspace
return revisionManager.getRevision(id, head, CDORevision.UNCHUNKED, CDORevision.DEPTH_NONE, true);
}
+ public InternalRepository getLocalRepository()
+ {
+ return localRepository;
+ }
+
public CDOChangeSetData getLocalChanges()
{
- Set<CDOID> ids = baseline.getIDs();
- return CDORevisionDeltaUtil.createChangeSetData(ids, baseline, this);
+ Set<CDOID> ids = memory.getIDs();
+ return CDORevisionDeltaUtil.createChangeSetData(ids, memory, this);
+ }
+
+ protected IManagedContainer createContainer(IStore local)
+ {
+ IManagedContainer container = ContainerUtil.createContainer();
+ Net4jUtil.prepareContainer(container);
+ JVMUtil.prepareContainer(container);
+ CDONet4jServerUtil.prepareContainer(container);
+ container.activate();
+ return container;
}
protected IManagedContainer getContainer()
@@ -352,8 +391,7 @@ public class CDOWorkspaceImpl implements CDOWorkspace
protected IJVMAcceptor getLocalAcceptor()
{
String localAcceptorName = getLocalAcceptorName();
- IJVMAcceptor acceptor = JVMUtil.getAcceptor(container, localAcceptorName);
- return acceptor;
+ return JVMUtil.getAcceptor(container, localAcceptorName);
}
protected IJVMConnector getLocalConnector()
@@ -367,16 +405,6 @@ public class CDOWorkspaceImpl implements CDOWorkspace
return localSession;
}
- protected IManagedContainer createContainer(IStore local)
- {
- IManagedContainer container = ContainerUtil.createContainer();
- Net4jUtil.prepareContainer(container);
- JVMUtil.prepareContainer(container);
- CDONet4jServerUtil.prepareContainer(container);
- container.activate();
- return container;
- }
-
protected InternalRepository createLocalRepository(IStore store)
{
Map<String, String> props = new HashMap<String, String>();
@@ -411,6 +439,8 @@ public class CDOWorkspaceImpl implements CDOWorkspace
protected InternalCDOSession openLocalSession()
{
+ getLocalAcceptor();
+
IJVMConnector connector = getLocalConnector();
String repositoryName = localRepository.getName();
@@ -449,7 +479,7 @@ public class CDOWorkspaceImpl implements CDOWorkspace
if (view instanceof CDOTransaction)
{
- if (baseline.getTimeStamp() != CDOBranchPoint.UNSPECIFIED_DATE)
+ if (readOnly)
{
throw new ReadOnlyException("Workspace is read-only");
}
@@ -460,7 +490,7 @@ public class CDOWorkspaceImpl implements CDOWorkspace
@Override
public void committedTransaction(CDOTransaction transaction, CDOCommitContext commitContext)
{
- baseline.updateAfterCommit(transaction);
+ memory.updateAfterCommit(transaction);
}
});
}
@@ -477,12 +507,21 @@ public class CDOWorkspaceImpl implements CDOWorkspace
return (InternalCDOSession)configuration.openSession();
}
- protected void storeBranchPoint(String branchPath, long timeStamp, long lastUpdateTime)
+ protected void saveProperties()
{
Map<String, String> props = new HashMap<String, String>();
props.put(PROP_BRANCH_PATH, branchPath);
props.put(PROP_TIME_STAMP, String.valueOf(timeStamp));
- props.put(PROP_LAST_UPDATE_TIME, String.valueOf(lastUpdateTime));
- localRepository.setProperties(props);
+ props.put(PROP_READ_ONLY, String.valueOf(readOnly));
+ localRepository.getStore().setPropertyValues(props);
+ }
+
+ protected void loadProperties()
+ {
+ Set<String> names = new HashSet<String>(Arrays.asList(PROP_BRANCH_PATH, PROP_TIME_STAMP, PROP_READ_ONLY));
+ Map<String, String> props = localRepository.getStore().getPropertyValues(names);
+ branchPath = props.get(PROP_BRANCH_PATH);
+ timeStamp = Integer.parseInt(props.get(PROP_TIME_STAMP));
+ readOnly = Boolean.parseBoolean(props.get(PROP_READ_ONLY));
}
}
diff --git a/plugins/org.eclipse.emf.cdo.workspace/src/org/eclipse/emf/cdo/internal/workspace/FolderCDOWorkspaceBaseline.java b/plugins/org.eclipse.emf.cdo.workspace/src/org/eclipse/emf/cdo/internal/workspace/FolderCDOWorkspaceMemory.java
index 76ee4c5cb9..5a2b132eff 100644
--- a/plugins/org.eclipse.emf.cdo.workspace/src/org/eclipse/emf/cdo/internal/workspace/FolderCDOWorkspaceBaseline.java
+++ b/plugins/org.eclipse.emf.cdo.workspace/src/org/eclipse/emf/cdo/internal/workspace/FolderCDOWorkspaceMemory.java
@@ -30,11 +30,11 @@ import java.util.Set;
/**
* @author Eike Stepper
*/
-public class FolderCDOWorkspaceBaseline extends AbstractCDOWorkspaceBaseline
+public class FolderCDOWorkspaceMemory extends AbstractCDOWorkspaceMemory
{
private File folder;
- public FolderCDOWorkspaceBaseline(File folder)
+ public FolderCDOWorkspaceMemory(File folder)
{
this.folder = folder;
}
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
new file mode 100644
index 0000000000..eedb30a791
--- /dev/null
+++ b/plugins/org.eclipse.emf.cdo.workspace/src/org/eclipse/emf/cdo/spi/workspace/InternalCDOWorkspace.java
@@ -0,0 +1,27 @@
+/**
+ * Copyright (c) 2004 - 2010 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.spi.workspace;
+
+import org.eclipse.emf.cdo.common.commit.CDOChangeSetData;
+import org.eclipse.emf.cdo.spi.server.InternalRepository;
+import org.eclipse.emf.cdo.workspace.CDOWorkspace;
+
+/**
+ * @author Eike Stepper
+ */
+public interface InternalCDOWorkspace extends CDOWorkspace
+{
+ public InternalCDOWorkspaceMemory getMemory();
+
+ public InternalRepository getLocalRepository();
+
+ public CDOChangeSetData getLocalChanges();
+}
diff --git a/plugins/org.eclipse.emf.cdo.workspace/src/org/eclipse/emf/cdo/internal/workspace/InternalCDOWorkspaceBaseline.java b/plugins/org.eclipse.emf.cdo.workspace/src/org/eclipse/emf/cdo/spi/workspace/InternalCDOWorkspaceMemory.java
index f49b7910ce..add6a62311 100644
--- a/plugins/org.eclipse.emf.cdo.workspace/src/org/eclipse/emf/cdo/internal/workspace/InternalCDOWorkspaceBaseline.java
+++ b/plugins/org.eclipse.emf.cdo.workspace/src/org/eclipse/emf/cdo/spi/workspace/InternalCDOWorkspaceMemory.java
@@ -8,24 +8,19 @@
* Contributors:
* Eike Stepper - initial API and implementation
*/
-package org.eclipse.emf.cdo.internal.workspace;
+package org.eclipse.emf.cdo.spi.workspace;
import org.eclipse.emf.cdo.transaction.CDOTransaction;
-import org.eclipse.emf.cdo.workspace.CDOWorkspace;
-import org.eclipse.emf.cdo.workspace.CDOWorkspaceBaseline;
+import org.eclipse.emf.cdo.workspace.CDOWorkspaceMemory;
/**
* @author Eike Stepper
*/
-public interface InternalCDOWorkspaceBaseline extends CDOWorkspaceBaseline
+public interface InternalCDOWorkspaceMemory extends CDOWorkspaceMemory
{
- public void init(CDOWorkspace workspace);
+ public InternalCDOWorkspace getWorkspace();
- public void setBranchPath(String branchPath);
-
- public void setTimeStamp(long timeStamp);
-
- public void setLastUpdateTime(long lastUpdateTime);
+ public void init(InternalCDOWorkspace workspace);
public void updateAfterCommit(CDOTransaction transaction);
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 42b50a5e99..dcbfe2ec58 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
@@ -13,7 +13,6 @@ package org.eclipse.emf.cdo.workspace;
import org.eclipse.emf.cdo.common.commit.CDOChangeSetData;
import org.eclipse.emf.cdo.common.commit.CDOCommitInfo;
import org.eclipse.emf.cdo.common.revision.CDORevisionProvider;
-import org.eclipse.emf.cdo.server.IRepository;
import org.eclipse.emf.cdo.transaction.CDOMerger;
import org.eclipse.emf.cdo.transaction.CDOTransaction;
import org.eclipse.emf.cdo.util.CommitException;
@@ -28,7 +27,13 @@ import org.eclipse.emf.ecore.resource.ResourceSet;
*/
public interface CDOWorkspace extends CDORevisionProvider, Closeable
{
- public CDOWorkspaceBaseline getBaseline();
+ public String getBranchPath();
+
+ public long getTimeStamp();
+
+ public boolean isReadOnly();
+
+ public CDOWorkspaceMemory getMemory();
public CDOView openView();
@@ -40,17 +45,17 @@ public interface CDOWorkspace extends CDORevisionProvider, Closeable
public CDOTransaction update(CDOMerger merger);
- public CDOTransaction update(CDOMerger merger, String branchPath);
+ public CDOTransaction merge(CDOMerger merger, String branchPath);
- public CDOTransaction update(CDOMerger merger, String branchPath, long timeStamp);
+ public CDOTransaction merge(CDOMerger merger, String branchPath, long timeStamp);
public CDOCommitInfo commit() throws CommitException;
public CDOCommitInfo commit(String comment) throws CommitException;
- public CDOChangeSetData getLocalChanges();
+ public CDOChangeSetData compare(String branchPath);
- public IRepository getLocalRepository();
+ public CDOChangeSetData compare(String branchPath, long timeStamp);
public void replace(String branchPath, long timeStamp);
diff --git a/plugins/org.eclipse.emf.cdo.workspace/src/org/eclipse/emf/cdo/workspace/CDOWorkspaceBaseline.java b/plugins/org.eclipse.emf.cdo.workspace/src/org/eclipse/emf/cdo/workspace/CDOWorkspaceMemory.java
index 637361436c..9339deb05f 100644
--- a/plugins/org.eclipse.emf.cdo.workspace/src/org/eclipse/emf/cdo/workspace/CDOWorkspaceBaseline.java
+++ b/plugins/org.eclipse.emf.cdo.workspace/src/org/eclipse/emf/cdo/workspace/CDOWorkspaceMemory.java
@@ -18,15 +18,9 @@ import java.util.Set;
/**
* @author Eike Stepper
*/
-public interface CDOWorkspaceBaseline extends CDORevisionProvider
+public interface CDOWorkspaceMemory extends CDORevisionProvider
{
public CDOWorkspace getWorkspace();
- public String getBranchPath();
-
- public long getTimeStamp();
-
- public long getLastUpdateTime();
-
public Set<CDOID> getIDs();
}
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 452de08fe2..c229da1139 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
@@ -10,10 +10,11 @@
*/
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.InternalCDOWorkspaceBaseline;
import org.eclipse.emf.cdo.server.IStore;
import org.eclipse.emf.cdo.session.CDOSessionConfigurationFactory;
+import org.eclipse.emf.cdo.spi.workspace.InternalCDOWorkspaceMemory;
/**
* @author Eike Stepper
@@ -24,14 +25,31 @@ public final class CDOWorkspaceUtil
{
}
- public static CDOWorkspace checkout(IStore local, CDOWorkspaceBaseline baseline,
- CDOSessionConfigurationFactory remote, String branchPath, long timeStamp)
+ public static CDOWorkspace open(IStore local, CDOWorkspaceMemory baseline, CDOSessionConfigurationFactory remote)
{
- return new CDOWorkspaceImpl(local, (InternalCDOWorkspaceBaseline)baseline, remote, branchPath, timeStamp);
+ return new CDOWorkspaceImpl(local, (InternalCDOWorkspaceMemory)baseline, remote);
}
- public static CDOWorkspace open(IStore local, CDOWorkspaceBaseline baseline, CDOSessionConfigurationFactory remote)
+ public static CDOWorkspace checkout(IStore local, CDOWorkspaceMemory baseline, CDOSessionConfigurationFactory remote)
{
- return new CDOWorkspaceImpl(local, (InternalCDOWorkspaceBaseline)baseline, remote);
+ return checkout(local, baseline, remote, null);
+ }
+
+ public static CDOWorkspace checkout(IStore local, CDOWorkspaceMemory baseline, CDOSessionConfigurationFactory remote,
+ String branchPath)
+ {
+ return checkout(local, baseline, remote, branchPath, CDOBranchPoint.UNSPECIFIED_DATE);
+ }
+
+ public static CDOWorkspace checkout(IStore local, CDOWorkspaceMemory baseline, CDOSessionConfigurationFactory remote,
+ long timeStamp)
+ {
+ return checkout(local, baseline, remote, null, timeStamp);
+ }
+
+ public static CDOWorkspace checkout(IStore local, CDOWorkspaceMemory baseline, CDOSessionConfigurationFactory remote,
+ String branchPath, long timeStamp)
+ {
+ return new CDOWorkspaceImpl(local, (InternalCDOWorkspaceMemory)baseline, remote, branchPath, timeStamp);
}
}

Back to the top