Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorEike Stepper2010-10-24 07:00:38 +0000
committerEike Stepper2010-10-24 07:00:38 +0000
commitfa94c921667dffd9d8620171734cf0c7a6c5be5a (patch)
tree889b8d117a3c1f4208b233b0f74d779c0b2af464 /plugins
parent63e7b2e5636cc9501e3a720ed01805eff8845756 (diff)
downloadcdo-fa94c921667dffd9d8620171734cf0c7a6c5be5a.tar.gz
cdo-fa94c921667dffd9d8620171734cf0c7a6c5be5a.tar.xz
cdo-fa94c921667dffd9d8620171734cf0c7a6c5be5a.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')
-rw-r--r--plugins/org.eclipse.emf.cdo.workspace.efs/src/org/eclipse/emf/cdo/workspace/internal/efs/CDOResourceNodeStore.java27
-rw-r--r--plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/cdo/eresource/impl/CDOResourceImpl.java150
2 files changed, 159 insertions, 18 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 cf72c111af..046d6bf123 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
@@ -78,7 +78,6 @@ public final class CDOResourceNodeStore extends AbstractResourceNodeStore
{
ByteArrayOutputStream baos = new ByteArrayOutputStream();
CDOResource resource = (CDOResource)node;
- // resource.cdoPrefetch(CDORevision.DEPTH_INFINITE);
try
{
@@ -95,6 +94,32 @@ public final class CDOResourceNodeStore extends AbstractResourceNodeStore
}.run();
}
+ // @Override
+ // public OutputStream openOutputStream(int options, IProgressMonitor monitor) throws CoreException
+ // {
+ // return new ResourceNodeRunnable<OutputStream>()
+ // {
+ // @Override
+ // protected OutputStream run(CDOResourceNode node)
+ // {
+ // ByteArrayOutputStream baos = new ByteArrayOutputStream();
+ // CDOResource resource = (CDOResource)node;
+ //
+ // try
+ // {
+ // resource.save(baos, null);
+ // }
+ // catch (Exception ex)
+ // {
+ // OM.LOG.error(ex);
+ // throw WrappedException.wrap(ex);
+ // }
+ //
+ // return new ByteArrayInputStream(baos.toByteArray());
+ // }
+ // }.run();
+ // }
+
@Override
public IFileStore mkdir(int options, IProgressMonitor monitor) throws CoreException
{
diff --git a/plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/cdo/eresource/impl/CDOResourceImpl.java b/plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/cdo/eresource/impl/CDOResourceImpl.java
index 4653cad7ae..f9b6ed1a1b 100644
--- a/plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/cdo/eresource/impl/CDOResourceImpl.java
+++ b/plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/cdo/eresource/impl/CDOResourceImpl.java
@@ -623,23 +623,6 @@ public class CDOResourceImpl extends CDOResourceNodeImpl implements CDOResource,
}
/**
- * @ADDED
- */
- public void load(InputStream inputStream, Map<?, ?> options) throws IOException
- {
- throw new UnsupportedOperationException();
- // if (inputStream instanceof CDOResourceInputStream)
- // {
- // CDOResourceInputStream stream = (CDOResourceInputStream)inputStream;
- // URI uri = stream.getURI();
- // }
- // else
- // {
- // throw new IOException("Stream not supported: " + inputStream);
- // }
- }
-
- /**
* @since 2.0
*/
@Override
@@ -658,6 +641,139 @@ public class CDOResourceImpl extends CDOResourceNodeImpl implements CDOResource,
/**
* @ADDED
*/
+ public void load(InputStream inputStream, Map<?, ?> options) throws IOException
+ {
+ // final String baseURI = getBaseURIOption(options);
+ // final Map<Resource, CDOResource> resourceMappings = new HashMap<Resource, CDOResource>();
+ //
+ // class ImportResource extends XMIResourceImpl
+ // {
+ // private CDOResource delegate;
+ //
+ // public ImportResource(CDOResource delegate)
+ // {
+ // super(URI.createURI(baseURI + delegate.getPath()));
+ // this.delegate = delegate;
+ // }
+ //
+ // @Override
+ // public EList<EObject> getContents()
+ // {
+ // return delegate.getContents();
+ // }
+ //
+ // @Override
+ // public String getURIFragment(EObject eObject)
+ // {
+ // String id = EcoreUtil.getID(eObject);
+ // if (id != null)
+ // {
+ // return id;
+ // }
+ //
+ // InternalEObject internalEObject = (InternalEObject)eObject;
+ // if (getMappedResource(internalEObject.eDirectResource()) == this)
+ // {
+ // return "/" + getURIFragmentRootSegment(eObject);
+ // }
+ //
+ // List<String> uriFragmentPath = new ArrayList<String>();
+ // boolean isContained = false;
+ // for (InternalEObject container = internalEObject.eInternalContainer(); container != null; container =
+ // internalEObject
+ // .eInternalContainer())
+ // {
+ // uriFragmentPath.add(container.eURIFragmentSegment(internalEObject.eContainingFeature(), internalEObject));
+ // internalEObject = container;
+ // if (getMappedResource(container.eDirectResource()) == this)
+ // {
+ // isContained = true;
+ // break;
+ // }
+ // }
+ //
+ // if (!isContained)
+ // {
+ // return "/-1";
+ // }
+ //
+ // StringBuilder result = new StringBuilder("/");
+ // result.append(getURIFragmentRootSegment(internalEObject));
+ //
+ // for (int i = uriFragmentPath.size() - 1; i >= 0; --i)
+ // {
+ // result.append('/');
+ // result.append(uriFragmentPath.get(i));
+ // }
+ //
+ // return result.toString();
+ // }
+ //
+ // @Override
+ // protected XMLHelper createXMLHelper()
+ // {
+ // return new XMIHelperImpl(this)
+ // {
+ // @Override
+ // public String getHREF(EObject obj)
+ // {
+ // InternalEObject o = (InternalEObject)obj;
+ //
+ // URI objectURI = o.eProxyURI();
+ // if (objectURI == null)
+ // {
+ // Resource otherResource = obj.eResource();
+ // otherResource = getMappedResource(otherResource);
+ // objectURI = getHREF(otherResource, obj);
+ // }
+ //
+ // objectURI = deresolve(objectURI);
+ // return objectURI.toString();
+ // }
+ //
+ // @Override
+ // protected URI getHREF(Resource otherResource, EObject obj)
+ // {
+ // String uriFragment = getURIFragment(otherResource, obj);
+ // if (otherResource == ImportResource.this)
+ // {
+ // return URI.createURI(uriFragment);
+ // }
+ //
+ // return otherResource.getURI().appendFragment(uriFragment);
+ // }
+ // };
+ // }
+ //
+ // private Resource getMappedResource(Resource otherResource)
+ // {
+ // Resource resource = resourceMappings.get(otherResource);
+ // if (resource != null)
+ // {
+ // return resource;
+ // }
+ //
+ // if (otherResource instanceof CDOResource)
+ // {
+ // CDOResource cdoResource = (CDOResource)otherResource;
+ // otherResource = new ImportResource(cdoResource);
+ // resourceMappings.put(cdoResource, otherResource);
+ // }
+ //
+ // return otherResource;
+ // }
+ // }
+ //
+ // XMIResource xmiResource = new ImportResource(this);
+ // resourceMappings.put(this, xmiResource);
+ // xmiResource.save(outputStream, options);
+
+ throw new UnsupportedOperationException();
+ }
+
+ /**
+ * @ADDED
+ */
public void load(Map<?, ?> options) throws IOException
{
if (!isLoaded())

Back to the top