Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSimon McDuff2008-10-18 21:29:08 -0400
committerSimon McDuff2008-10-18 21:29:08 -0400
commit5a3c0197ba134bb9cee54bd9952ce1a8aff9fbdf (patch)
treebd4dd1a0a3bdcb1c95046cc70c6876c0f4b211cd /plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/internal/cdo/util
parent5d07b888b76e385204a2188780c35dc7727c0d8c (diff)
downloadcdo-5a3c0197ba134bb9cee54bd9952ce1a8aff9fbdf.tar.gz
cdo-5a3c0197ba134bb9cee54bd9952ce1a8aff9fbdf.tar.xz
cdo-5a3c0197ba134bb9cee54bd9952ce1a8aff9fbdf.zip
[249847] Store resources in a hierarchical structurecommitters/estepper/pop-20081018
https://bugs.eclipse.org/bugs/show_bug.cgi?id=249847
Diffstat (limited to 'plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/internal/cdo/util')
-rw-r--r--plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/internal/cdo/util/FSMUtil.java39
-rw-r--r--plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/internal/cdo/util/ModelUtil.java22
-rw-r--r--plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/internal/cdo/util/ProxyResolverResource.java190
-rw-r--r--plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/internal/cdo/util/ProxyResolverURIResourceMap.java129
4 files changed, 20 insertions, 360 deletions
diff --git a/plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/internal/cdo/util/FSMUtil.java b/plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/internal/cdo/util/FSMUtil.java
index 254289eee5..4b5228bc8b 100644
--- a/plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/internal/cdo/util/FSMUtil.java
+++ b/plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/internal/cdo/util/FSMUtil.java
@@ -14,10 +14,8 @@ package org.eclipse.emf.internal.cdo.util;
import org.eclipse.emf.cdo.CDOObject;
import org.eclipse.emf.cdo.CDOState;
import org.eclipse.emf.cdo.CDOView;
-import org.eclipse.emf.cdo.CDOViewSet;
import org.eclipse.emf.cdo.common.id.CDOID;
import org.eclipse.emf.cdo.common.revision.CDORevision;
-import org.eclipse.emf.cdo.util.CDOUtil;
import org.eclipse.emf.cdo.util.InvalidObjectException;
import org.eclipse.emf.cdo.util.ObjectNotFoundException;
@@ -25,25 +23,18 @@ import org.eclipse.emf.internal.cdo.CDOLegacyWrapper;
import org.eclipse.emf.internal.cdo.CDOMetaWrapper;
import org.eclipse.emf.internal.cdo.CDOStateMachine;
import org.eclipse.emf.internal.cdo.CDOViewImpl;
-import org.eclipse.emf.internal.cdo.CDOViewSetImpl;
import org.eclipse.emf.internal.cdo.InternalCDOObject;
-import org.eclipse.net4j.util.ImplementationError;
-
import org.eclipse.emf.common.util.EList;
-import org.eclipse.emf.common.util.URI;
import org.eclipse.emf.ecore.EGenericType;
import org.eclipse.emf.ecore.EModelElement;
import org.eclipse.emf.ecore.EObject;
import org.eclipse.emf.ecore.InternalEObject;
import org.eclipse.emf.ecore.resource.Resource;
-import org.eclipse.emf.ecore.resource.ResourceSet;
-import org.eclipse.emf.ecore.resource.impl.ResourceSetImpl;
import org.eclipse.emf.ecore.util.EcoreUtil;
import java.util.Collection;
import java.util.Iterator;
-import java.util.Map;
/**
* @author Eike Stepper
@@ -274,34 +265,4 @@ public final class FSMUtil
{
return iterator(instances.iterator(), view);
}
-
- public static CDOViewSet prepareResourceSet(ResourceSet resourceSet)
- {
- CDOViewSetImpl viewSet = null;
- synchronized (resourceSet)
- {
- viewSet = (CDOViewSetImpl)CDOUtil.getViewSet(resourceSet);
-
- if (viewSet == null)
- {
- if (resourceSet instanceof ResourceSetImpl)
- {
- Map<URI, Resource> resourceMap = null;
- ResourceSetImpl rs = (ResourceSetImpl)resourceSet;
- resourceMap = rs.getURIResourceMap();
- rs.setURIResourceMap(new ProxyResolverURIResourceMap(null, resourceMap));
- }
- else
- {
- throw new ImplementationError("Not a " + ResourceSetImpl.class.getName() + ": "
- + resourceSet.getClass().getName());
- }
-
- viewSet = new CDOViewSetImpl();
- resourceSet.eAdapters().add(viewSet);
- }
- }
-
- return viewSet;
- }
}
diff --git a/plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/internal/cdo/util/ModelUtil.java b/plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/internal/cdo/util/ModelUtil.java
index 3583d992c9..1384bea8a1 100644
--- a/plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/internal/cdo/util/ModelUtil.java
+++ b/plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/internal/cdo/util/ModelUtil.java
@@ -22,6 +22,8 @@ import org.eclipse.emf.cdo.common.model.CDOPackageManager;
import org.eclipse.emf.cdo.common.model.CDOType;
import org.eclipse.emf.cdo.common.model.core.CDOCorePackage;
import org.eclipse.emf.cdo.common.model.resource.CDOResourceClass;
+import org.eclipse.emf.cdo.common.model.resource.CDOResourceFolderClass;
+import org.eclipse.emf.cdo.common.model.resource.CDOResourceNodeClass;
import org.eclipse.emf.cdo.common.model.resource.CDOResourcePackage;
import org.eclipse.emf.cdo.eresource.EresourcePackage;
import org.eclipse.emf.cdo.spi.common.InternalCDOClass;
@@ -391,13 +393,29 @@ public final class ModelUtil
((InternalCDOClass)corePackage.getCDOObjectClass()).setClientInfo(EcorePackage.eINSTANCE.getEObject());
// Eresource
+ if (!ObjectUtil.equals(CDOResourcePackage.PACKAGE_URI, EresourcePackage.eNS_URI))
+ {
+ throw new ImplementationError();
+ }
+
CDOResourcePackage resourcePackage = packageManager.getCDOResourcePackage();
((InternalCDOPackage)resourcePackage).setClientInfo(EresourcePackage.eINSTANCE);
+
+ CDOResourceNodeClass resourceNodeClass = resourcePackage.getCDOResourceNodeClass();
+ ((InternalCDOClass)resourceNodeClass).setClientInfo(EresourcePackage.eINSTANCE.getCDOResourceNode());
+ ((InternalCDOFeature)resourceNodeClass.getCDOFolderFeature()).setClientInfo(EresourcePackage.eINSTANCE
+ .getCDOResourceNode_Folder());
+ ((InternalCDOFeature)resourceNodeClass.getCDONameFeature()).setClientInfo(EresourcePackage.eINSTANCE
+ .getCDOResourceNode_Name());
+
+ CDOResourceFolderClass resourceFolderClass = resourcePackage.getCDOResourceFolderClass();
+ ((InternalCDOClass)resourceFolderClass).setClientInfo(EresourcePackage.eINSTANCE.getCDOResourceFolder());
+ ((InternalCDOFeature)resourceFolderClass.getCDONodesFeature()).setClientInfo(EresourcePackage.eINSTANCE
+ .getCDOResourceFolder_Nodes());
+
CDOResourceClass resourceClass = resourcePackage.getCDOResourceClass();
((InternalCDOClass)resourceClass).setClientInfo(EresourcePackage.eINSTANCE.getCDOResource());
((InternalCDOFeature)resourceClass.getCDOContentsFeature()).setClientInfo(EresourcePackage.eINSTANCE
.getCDOResource_Contents());
- ((InternalCDOFeature)resourceClass.getCDOPathFeature()).setClientInfo(EresourcePackage.eINSTANCE
- .getCDOResource_Path());
}
}
diff --git a/plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/internal/cdo/util/ProxyResolverResource.java b/plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/internal/cdo/util/ProxyResolverResource.java
deleted file mode 100644
index 1e4f98d4f1..0000000000
--- a/plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/internal/cdo/util/ProxyResolverResource.java
+++ /dev/null
@@ -1,190 +0,0 @@
-/***************************************************************************
- * Copyright (c) 2004 - 2008 Eike Stepper, Germany.
- * 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.internal.cdo.util;
-
-import org.eclipse.emf.internal.cdo.CDOViewImpl;
-
-import org.eclipse.emf.common.notify.Adapter;
-import org.eclipse.emf.common.notify.Notification;
-import org.eclipse.emf.common.util.EList;
-import org.eclipse.emf.common.util.TreeIterator;
-import org.eclipse.emf.common.util.URI;
-import org.eclipse.emf.ecore.EObject;
-import org.eclipse.emf.ecore.resource.Resource;
-import org.eclipse.emf.ecore.resource.ResourceSet;
-
-import java.io.IOException;
-import java.io.InputStream;
-import java.io.OutputStream;
-import java.util.Map;
-
-/**
- * @author Eike Stepper
- */
-final class ProxyResolverResource implements Resource
-{
- @SuppressWarnings("unused")
- private CDOViewImpl view;
-
- public ProxyResolverResource(CDOViewImpl view)
- {
- this.view = view;
- }
-
- /*
- * @ADDED Called by {@link ResourceSetImpl#getResource(URI, boolean)}
- */
- public boolean isLoaded()
- {
- return true;
- }
-
- /*
- * @ADDED Called by {@link ResourceSetImpl#getEObject(URI, boolean)}
- */
- public EObject getEObject(String uriFragment)
- {
- // TODO Implement me
- throw new UnsupportedOperationException("Not yet implemented");
- // CDOID id = CDOIDUtil.create(Long.parseLong(uriFragment));
- // InternalCDOObject object = view.getObject(id);
- // InternalEObject instance = object.cdoInternalInstance();
- // if (instance instanceof CDOAdapterImpl)
- // {
- // if (object.cdoState() == CDOState.PROXY)
- // {
- // object.cdoInternalPostLoad();
- // }
- // }
- //
- // return instance;
- }
-
- public TreeIterator<EObject> getAllContents()
- {
- throw new UnsupportedOperationException();
- }
-
- public EList<EObject> getContents()
- {
- throw new UnsupportedOperationException();
- }
-
- public EList<Diagnostic> getErrors()
- {
- throw new UnsupportedOperationException();
- }
-
- public ResourceSet getResourceSet()
- {
- throw new UnsupportedOperationException();
- }
-
- public URI getURI()
- {
- throw new UnsupportedOperationException();
- }
-
- public String getURIFragment(EObject object)
- {
- throw new UnsupportedOperationException();
- }
-
- public void delete(Map<?, ?> options) throws IOException
- {
- throw new UnsupportedOperationException();
- }
-
- public long getTimeStamp()
- {
- throw new UnsupportedOperationException();
- }
-
- public void setTimeStamp(long timeStamp)
- {
- throw new UnsupportedOperationException();
- }
-
- public EList<Diagnostic> getWarnings()
- {
- throw new UnsupportedOperationException();
- }
-
- public boolean isModified()
- {
- throw new UnsupportedOperationException();
- }
-
- public boolean isTrackingModification()
- {
- throw new UnsupportedOperationException();
- }
-
- public void load(Map<?, ?> options) throws IOException
- {
- throw new UnsupportedOperationException();
- }
-
- public void load(InputStream inputStream, Map<?, ?> options) throws IOException
- {
- throw new UnsupportedOperationException();
- }
-
- public void save(Map<?, ?> options) throws IOException
- {
- throw new UnsupportedOperationException();
- }
-
- public void save(OutputStream outputStream, Map<?, ?> options) throws IOException
- {
- throw new UnsupportedOperationException();
- }
-
- public void setModified(boolean isModified)
- {
- throw new UnsupportedOperationException();
- }
-
- public void setTrackingModification(boolean isTrackingModification)
- {
- throw new UnsupportedOperationException();
- }
-
- public void setURI(URI uri)
- {
- throw new UnsupportedOperationException();
- }
-
- public void unload()
- {
- throw new UnsupportedOperationException();
- }
-
- public EList<Adapter> eAdapters()
- {
- throw new UnsupportedOperationException();
- }
-
- public boolean eDeliver()
- {
- throw new UnsupportedOperationException();
- }
-
- public void eNotify(Notification notification)
- {
- throw new UnsupportedOperationException();
- }
-
- public void eSetDeliver(boolean deliver)
- {
- throw new UnsupportedOperationException();
- }
-}
diff --git a/plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/internal/cdo/util/ProxyResolverURIResourceMap.java b/plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/internal/cdo/util/ProxyResolverURIResourceMap.java
deleted file mode 100644
index df14a5ede6..0000000000
--- a/plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/internal/cdo/util/ProxyResolverURIResourceMap.java
+++ /dev/null
@@ -1,129 +0,0 @@
-/***************************************************************************
- * Copyright (c) 2004 - 2008 Eike Stepper, Germany.
- * 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.internal.cdo.util;
-
-import org.eclipse.emf.internal.cdo.CDOViewImpl;
-
-import org.eclipse.emf.common.util.URI;
-import org.eclipse.emf.ecore.resource.Resource;
-
-import java.util.Collection;
-import java.util.HashMap;
-import java.util.Map;
-import java.util.Set;
-
-/**
- * @author Eike Stepper
- */
-public final class ProxyResolverURIResourceMap implements Map<URI, Resource>
-{
- private Map<URI, Resource> delegate;
-
- private Resource proxyResolverResource;
-
- public ProxyResolverURIResourceMap(CDOViewImpl view, Map<URI, Resource> delegate)
- {
- if (delegate == null)
- {
- delegate = new HashMap<URI, Resource>(); // TODO Cleanup of this lookup
- // cache?
- }
-
- this.delegate = delegate;
- proxyResolverResource = new ProxyResolverResource(view);
- }
-
- public Resource get(Object key)
- {
- if (key instanceof URI)
- {
- URI uri = (URI)key;
- String scheme = uri.scheme();
- if ("cdo".equals(scheme))
- {
- String opaquePart = uri.opaquePart();
- if ("proxy".equals(opaquePart))
- {
- return proxyResolverResource;
- }
- }
- }
-
- return delegate.get(key);
- }
-
- public void clear()
- {
- delegate.clear();
- }
-
- public boolean containsKey(Object key)
- {
- return delegate.containsKey(key);
- }
-
- public boolean containsValue(Object value)
- {
- return delegate.containsValue(value);
- }
-
- public Set<Entry<URI, Resource>> entrySet()
- {
- return delegate.entrySet();
- }
-
- @Override
- public boolean equals(Object o)
- {
- return delegate.equals(o);
- }
-
- @Override
- public int hashCode()
- {
- return delegate.hashCode();
- }
-
- public boolean isEmpty()
- {
- return delegate.isEmpty();
- }
-
- public Set<URI> keySet()
- {
- return delegate.keySet();
- }
-
- public Resource put(URI key, Resource value)
- {
- return delegate.put(key, value);
- }
-
- public void putAll(Map<? extends URI, ? extends Resource> t)
- {
- delegate.putAll(t);
- }
-
- public Resource remove(Object key)
- {
- return delegate.remove(key);
- }
-
- public int size()
- {
- return delegate.size();
- }
-
- public Collection<Resource> values()
- {
- return delegate.values();
- }
-}

Back to the top