Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorEike Stepper2010-10-25 07:14:54 -0400
committerEike Stepper2010-10-25 07:14:54 -0400
commit3bb4ee73dcee5d8ce153e900a20319303115a4ac (patch)
treec4617c0a7e5f3db6c72edbb1e61a49c49d0f7a5e /plugins/org.eclipse.emf.cdo.workspace.efs
parent191409bb69f812f1b8c1d91af487c88aea558bb6 (diff)
downloadcdo-3bb4ee73dcee5d8ce153e900a20319303115a4ac.tar.gz
cdo-3bb4ee73dcee5d8ce153e900a20319303115a4ac.tar.xz
cdo-3bb4ee73dcee5d8ce153e900a20319303115a4ac.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.efs')
-rw-r--r--plugins/org.eclipse.emf.cdo.workspace.efs/src/org/eclipse/emf/cdo/workspace/internal/efs/AbstractResourceNodeStore.java4
-rw-r--r--plugins/org.eclipse.emf.cdo.workspace.efs/src/org/eclipse/emf/cdo/workspace/internal/efs/CDOResourceNodeStore.java9
-rw-r--r--plugins/org.eclipse.emf.cdo.workspace.efs/src/org/eclipse/emf/cdo/workspace/internal/efs/CDOWorkspaceStore.java87
3 files changed, 65 insertions, 35 deletions
diff --git a/plugins/org.eclipse.emf.cdo.workspace.efs/src/org/eclipse/emf/cdo/workspace/internal/efs/AbstractResourceNodeStore.java b/plugins/org.eclipse.emf.cdo.workspace.efs/src/org/eclipse/emf/cdo/workspace/internal/efs/AbstractResourceNodeStore.java
index 98e10c3d60..4d7de17b54 100644
--- a/plugins/org.eclipse.emf.cdo.workspace.efs/src/org/eclipse/emf/cdo/workspace/internal/efs/AbstractResourceNodeStore.java
+++ b/plugins/org.eclipse.emf.cdo.workspace.efs/src/org/eclipse/emf/cdo/workspace/internal/efs/AbstractResourceNodeStore.java
@@ -75,7 +75,7 @@ public abstract class AbstractResourceNodeStore extends AbstractFileStore
boolean directory = exists && isDirectory(node);
if (!directory)
{
- lastModified = getWorkspaceStore().getLastModified(node.getPath());
+ lastModified = getWorkspaceStore().getLastModified(getPath());
}
FileInfo info = new FileInfo(getName());
@@ -95,6 +95,8 @@ public abstract class AbstractResourceNodeStore extends AbstractFileStore
@Override
public abstract AbstractResourceNodeStore getParent();
+ public abstract String getPath();
+
protected CDOView getView()
{
return getWorkspaceStore().getView();
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 320a45b5a3..43cfdfc744 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
@@ -64,14 +64,10 @@ public final class CDOResourceNodeStore extends AbstractResourceNodeStore
return name;
}
+ @Override
public String getPath()
{
- if (parent instanceof CDOResourceNodeStore)
- {
- return ((CDOResourceNodeStore)parent).getPath() + "/" + name;
- }
-
- return name;
+ return parent.getPath() + "/" + name;
}
@Override
@@ -109,6 +105,7 @@ public final class CDOResourceNodeStore extends AbstractResourceNodeStore
public void close() throws IOException
{
byte[] bytes = toByteArray();
+ System.err.println(new String(bytes));
InputStream in = new ByteArrayInputStream(bytes);
XMIResource xmiResource = new XMIResourceImpl();
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 7b0a2f1e95..20445218d3 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
@@ -13,7 +13,6 @@ package org.eclipse.emf.cdo.workspace.internal.efs;
import org.eclipse.emf.cdo.CDOObject;
import org.eclipse.emf.cdo.common.id.CDOID;
import org.eclipse.emf.cdo.common.id.CDOIDUtil;
-import org.eclipse.emf.cdo.common.model.CDOClassInfo;
import org.eclipse.emf.cdo.eresource.CDOResource;
import org.eclipse.emf.cdo.eresource.CDOResourceNode;
import org.eclipse.emf.cdo.transaction.CDOTransaction;
@@ -196,6 +195,12 @@ public final class CDOWorkspaceStore extends AbstractResourceNodeStore
}
@Override
+ public String getPath()
+ {
+ return "";
+ }
+
+ @Override
protected synchronized CDOView getView()
{
if (view == null)
@@ -300,8 +305,8 @@ public final class CDOWorkspaceStore extends AbstractResourceNodeStore
private void saveObject(InternalEObject xmiObject, InternalCDOObject cdoObject)
{
- CDOClassInfo classInfo = cdoObject.cdoRevision().getClassInfo();
- for (EStructuralFeature feature : classInfo.getAllPersistentFeatures())
+ // CDOClassInfo classInfo = cdoObject.cdoRevision().getClassInfo();
+ for (EStructuralFeature feature : xmiObject.eClass().getEAllStructuralFeatures())
{
Object xmiValue = xmiObject.eGet(feature);
if (feature instanceof EReference)
@@ -323,14 +328,21 @@ public final class CDOWorkspaceStore extends AbstractResourceNodeStore
else
{
// Single-valued containment reference
- InternalCDOObject cdoValue = getCDOObjectByXMIID((EObject)xmiValue);
- if (cdoValue == null)
+ if (xmiValue != null)
{
- cdoValue = createNewCDOObject((EObject)xmiValue);
- }
+ InternalCDOObject cdoValue = getCDOObjectByXMIID((EObject)xmiValue);
+ if (cdoValue == null)
+ {
+ cdoValue = createNewCDOObject((EObject)xmiValue);
+ }
- cdoObject.eSet(reference, cdoValue);
- saveObject((InternalEObject)xmiValue, cdoValue);
+ cdoObject.eSet(reference, cdoValue);
+ saveObject((InternalEObject)xmiValue, cdoValue);
+ }
+ else
+ {
+ cdoObject.eSet(reference, null);
+ }
}
}
else
@@ -348,26 +360,35 @@ public final class CDOWorkspaceStore extends AbstractResourceNodeStore
for (int i = 0; i < size; i++)
{
InternalEObject xmiElement = (InternalEObject)xmiElements.get(i);
- String href = xmiResource.getURIFragment(xmiElement);
- InternalCDOObject cdoElement = getCDOObjectByHREF(href);
- if (cdoElement == null)
+ InternalCDOObject cdoElement;
+
+ org.eclipse.emf.common.util.URI eProxyURI = xmiElement.eProxyURI();
+ if (eProxyURI != null)
{
- registerForwardReference(cdoObject, reference, i, href);
+ String href = eProxyURI.fragment();
+ cdoElement = getCDOObjectByHREF(href);
+ if (cdoElement == null)
+ {
+ registerForwardReference(cdoObject, reference, i, href);
- InternalCDOObject dummy = createNewCDOObject(xmiElement);
- cdoElements.add(i, dummy);
+ InternalCDOObject dummy = createNewCDOObject(xmiElement);
+ cdoElements.add(i, dummy);
+ continue;
+ }
}
else
{
- int index = cdoElements.indexOf(cdoElement);
- if (index != -1)
- {
- cdoElements.move(i, index);
- }
- else
- {
- cdoElements.add(i, cdoElement);
- }
+ cdoElement = getCDOObjectByXMIID(xmiElement);
+ }
+
+ int index = cdoElements.indexOf(cdoElement);
+ if (index != -1)
+ {
+ cdoElements.move(i, index);
+ }
+ else
+ {
+ cdoElements.add(i, cdoElement);
}
}
@@ -376,11 +397,21 @@ public final class CDOWorkspaceStore extends AbstractResourceNodeStore
else
{
// Single-valued cross reference
- String href = xmiResource.getURIFragment((EObject)xmiValue);
- CDOObject cdoValue = getCDOObjectByHREF(href);
- if (cdoValue == null)
+ CDOObject cdoValue;
+
+ org.eclipse.emf.common.util.URI eProxyURI = ((InternalEObject)xmiValue).eProxyURI();
+ if (eProxyURI != null)
+ {
+ String href = eProxyURI.fragment();
+ cdoValue = getCDOObjectByHREF(href);
+ if (cdoValue == null)
+ {
+ registerForwardReference(cdoObject, reference, -1, href);
+ }
+ }
+ else
{
- registerForwardReference(cdoObject, reference, -1, href);
+ cdoValue = getCDOObjectByXMIID((EObject)xmiValue);
}
cdoObject.eSet(reference, cdoValue);

Back to the top