Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorEike Stepper2010-12-22 12:18:22 +0000
committerEike Stepper2010-12-22 12:18:22 +0000
commit8e51b83543616ac83a586df027524bdf4b3ac4ed (patch)
treee7f5510b850e26c6ccb942f051caa7462e2d885b
parent0a8414698f6dd92dcdbba6bac8d84561a8bbc7b4 (diff)
downloadcdo-8e51b83543616ac83a586df027524bdf4b3ac4ed.tar.gz
cdo-8e51b83543616ac83a586df027524bdf4b3ac4ed.tar.xz
cdo-8e51b83543616ac83a586df027524bdf4b3ac4ed.zip
[327405] Provide an offline CDOWorkspace with Checkout/Update/Commit workflows
https://bugs.eclipse.org/bugs/show_bug.cgi?id=327405
-rw-r--r--plugins/org.eclipse.emf.cdo.workspace.efs/src/org/eclipse/emf/cdo/workspace/internal/efs/CDOResourceNodeStore.java3
-rw-r--r--plugins/org.eclipse.emf.cdo.workspace.efs/src/org/eclipse/emf/cdo/workspace/internal/efs/CDOWorkspaceStore.java2
-rw-r--r--plugins/org.eclipse.emf.cdo.workspace/src/org/eclipse/emf/cdo/internal/workspace/CDOWorkspaceImpl.java11
-rw-r--r--plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/cdo/transaction/CDOPushTransaction.java8
-rw-r--r--plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/cdo/transaction/CDOTransaction.java5
-rw-r--r--plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/internal/cdo/transaction/CDOTransactionImpl.java20
6 files changed, 41 insertions, 8 deletions
diff --git a/plugins/org.eclipse.emf.cdo.workspace.efs/src/org/eclipse/emf/cdo/workspace/internal/efs/CDOResourceNodeStore.java b/plugins/org.eclipse.emf.cdo.workspace.efs/src/org/eclipse/emf/cdo/workspace/internal/efs/CDOResourceNodeStore.java
index a2ebdda13a..38776a65b4 100644
--- a/plugins/org.eclipse.emf.cdo.workspace.efs/src/org/eclipse/emf/cdo/workspace/internal/efs/CDOResourceNodeStore.java
+++ b/plugins/org.eclipse.emf.cdo.workspace.efs/src/org/eclipse/emf/cdo/workspace/internal/efs/CDOResourceNodeStore.java
@@ -150,7 +150,8 @@ public final class CDOResourceNodeStore extends AbstractResourceNodeStore
@Override
protected CDOResourceFolder run(CDOView view)
{
- return ((CDOTransaction)view).createResourceFolder(getPath());
+ String path = getPath();
+ return ((CDOTransaction)view).getOrCreateResourceFolder(path);
}
}.run(true);
diff --git a/plugins/org.eclipse.emf.cdo.workspace.efs/src/org/eclipse/emf/cdo/workspace/internal/efs/CDOWorkspaceStore.java b/plugins/org.eclipse.emf.cdo.workspace.efs/src/org/eclipse/emf/cdo/workspace/internal/efs/CDOWorkspaceStore.java
index cc097b4770..952e7c619d 100644
--- a/plugins/org.eclipse.emf.cdo.workspace.efs/src/org/eclipse/emf/cdo/workspace/internal/efs/CDOWorkspaceStore.java
+++ b/plugins/org.eclipse.emf.cdo.workspace.efs/src/org/eclipse/emf/cdo/workspace/internal/efs/CDOWorkspaceStore.java
@@ -262,7 +262,7 @@ public final class CDOWorkspaceStore extends AbstractResourceNodeStore
try
{
- CDOResource cdoResource = transaction.getResource(cdoPath);
+ CDOResource cdoResource = transaction.getOrCreateResource(cdoPath);
saveContents(xmiResource.getContents(), cdoResource.getContents());
}
finally
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 f3c9a7c27b..2254a350e8 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
@@ -27,7 +27,6 @@ import org.eclipse.emf.cdo.common.revision.CDORevisionUtil;
import org.eclipse.emf.cdo.common.revision.delta.CDORevisionDeltaUtil;
import org.eclipse.emf.cdo.internal.server.Repository;
import org.eclipse.emf.cdo.net4j.CDONet4jUtil;
-import org.eclipse.emf.cdo.server.CDOServerBrowser;
import org.eclipse.emf.cdo.server.CDOServerUtil;
import org.eclipse.emf.cdo.server.IRepository.Props;
import org.eclipse.emf.cdo.server.IStore;
@@ -143,11 +142,11 @@ public class CDOWorkspaceImpl implements InternalCDOWorkspace
localRepository = createLocalRepository(local);
- Map<String, InternalRepository> repositories = new HashMap<String, InternalRepository>();
- repositories.put(localRepository.getName(), localRepository);
- CDOServerBrowser browser = new CDOServerBrowser(repositories);
- browser.setPort(7778);
- browser.activate();
+ // Map<String, InternalRepository> repositories = new HashMap<String, InternalRepository>();
+ // repositories.put(localRepository.getName(), localRepository);
+ // CDOServerBrowser browser = new CDOServerBrowser(repositories);
+ // browser.setPort(7778);
+ // browser.activate();
this.base = base;
this.base.init(this);
diff --git a/plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/cdo/transaction/CDOPushTransaction.java b/plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/cdo/transaction/CDOPushTransaction.java
index 1f262263c6..8880814c4d 100644
--- a/plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/cdo/transaction/CDOPushTransaction.java
+++ b/plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/cdo/transaction/CDOPushTransaction.java
@@ -440,6 +440,14 @@ public class CDOPushTransaction extends Notifier implements CDOTransaction
return delegate.getOrCreateResource(path);
}
+ /**
+ * @since 4.0
+ */
+ public CDOResourceFolder getOrCreateResourceFolder(String path)
+ {
+ return delegate.getOrCreateResourceFolder(path);
+ }
+
public CDOResource getResource(String path, boolean loadOnDemand)
{
return delegate.getResource(path, loadOnDemand);
diff --git a/plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/cdo/transaction/CDOTransaction.java b/plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/cdo/transaction/CDOTransaction.java
index bb1be62e97..f1bfce5b89 100644
--- a/plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/cdo/transaction/CDOTransaction.java
+++ b/plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/cdo/transaction/CDOTransaction.java
@@ -79,6 +79,11 @@ public interface CDOTransaction extends CDOView, CDOUserTransaction, CDOChangeSe
public CDOResourceFolder createResourceFolder(String path);
/**
+ * @since 4.0
+ */
+ public CDOResourceFolder getOrCreateResourceFolder(String path);
+
+ /**
* @see ResourceSet#createResource(URI)
*/
public CDOResource createResource(String path);
diff --git a/plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/internal/cdo/transaction/CDOTransactionImpl.java b/plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/internal/cdo/transaction/CDOTransactionImpl.java
index 4e8691e4ed..a04d66739b 100644
--- a/plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/internal/cdo/transaction/CDOTransactionImpl.java
+++ b/plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/internal/cdo/transaction/CDOTransactionImpl.java
@@ -789,6 +789,26 @@ public class CDOTransactionImpl extends CDOViewImpl implements InternalCDOTransa
attachNewResourceNode(folder, resourceName, resource);
}
+ public CDOResourceFolder getOrCreateResourceFolder(String path)
+ {
+ checkActive();
+
+ try
+ {
+ CDOID id = getResourceNodeID(path);
+ if (!CDOIDUtil.isNull(id))
+ {
+ return (CDOResourceFolder)getObject(id);
+ }
+ }
+ catch (Exception ignore)
+ {
+ // Just create the missing resource
+ }
+
+ return createResourceFolder(path);
+ }
+
/**
* @return never <code>null</code>;
* @since 2.0

Back to the top