Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSimon McDuff2008-10-19 01:29:08 +0000
committerSimon McDuff2008-10-19 01:29:08 +0000
commit5a3c0197ba134bb9cee54bd9952ce1a8aff9fbdf (patch)
treebd4dd1a0a3bdcb1c95046cc70c6876c0f4b211cd /plugins/org.eclipse.emf.cdo/src/org/eclipse/emf
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')
-rw-r--r--plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/cdo/CDOObject.java11
-rw-r--r--plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/cdo/CDOView.java82
-rw-r--r--plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/cdo/eresource/CDOResource.java43
-rw-r--r--plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/cdo/eresource/CDOResourceFolder.java46
-rw-r--r--plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/cdo/eresource/CDOResourceInputStream.java58
-rw-r--r--plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/cdo/eresource/CDOResourceNode.java129
-rw-r--r--plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/cdo/eresource/EresourceFactory.java9
-rw-r--r--plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/cdo/eresource/EresourcePackage.java311
-rw-r--r--plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/cdo/eresource/impl/CDOResourceFactoryImpl.java33
-rw-r--r--plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/cdo/eresource/impl/CDOResourceFolderImpl.java86
-rw-r--r--plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/cdo/eresource/impl/CDOResourceImpl.java519
-rw-r--r--plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/cdo/eresource/impl/CDOResourceNodeImpl.java266
-rw-r--r--plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/cdo/eresource/impl/EresourceFactoryImpl.java19
-rw-r--r--plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/cdo/eresource/impl/EresourcePackageImpl.java131
-rw-r--r--plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/cdo/eresource/util/EresourceAdapterFactory.java44
-rw-r--r--plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/cdo/eresource/util/EresourceSwitch.java62
-rw-r--r--plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/cdo/util/CDOURIUtil.java95
-rw-r--r--plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/cdo/util/CDOUtil.java27
-rw-r--r--plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/cdo/util/InvalidURIException.java (renamed from plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/cdo/eresource/EresourceObject.java)32
-rw-r--r--plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/internal/cdo/CDOLegacyWrapper.java18
-rw-r--r--plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/internal/cdo/CDOMetaWrapper.java16
-rw-r--r--plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/internal/cdo/CDOObjectImpl.java78
-rw-r--r--plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/internal/cdo/CDOObjectWrapper.java26
-rw-r--r--plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/internal/cdo/CDORevisionManagerImpl.java5
-rw-r--r--plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/internal/cdo/CDOSessionImpl.java22
-rw-r--r--plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/internal/cdo/CDOStore.java63
-rw-r--r--plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/internal/cdo/CDOTransactionImpl.java152
-rw-r--r--plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/internal/cdo/CDOURIHandler.java78
-rw-r--r--plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/internal/cdo/CDOViewImpl.java410
-rw-r--r--plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/internal/cdo/CDOViewSetImpl.java21
-rw-r--r--plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/internal/cdo/InternalCDOObject.java3
-rw-r--r--plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/internal/cdo/protocol/QueryRequest.java13
-rw-r--r--plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/internal/cdo/protocol/ResourcePathRequest.java76
-rw-r--r--plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/internal/cdo/query/CDOAbstractQueryIteratorImpl.java91
-rw-r--r--plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/internal/cdo/query/CDOQueryCDOIDIteratorImpl.java40
-rw-r--r--plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/internal/cdo/query/CDOQueryImpl.java26
-rw-r--r--plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/internal/cdo/query/CDOQueryResultIteratorImpl.java69
-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
41 files changed, 2543 insertions, 1047 deletions
diff --git a/plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/cdo/CDOObject.java b/plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/cdo/CDOObject.java
index fa4957c349..0f199e8b6e 100644
--- a/plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/cdo/CDOObject.java
+++ b/plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/cdo/CDOObject.java
@@ -22,17 +22,22 @@ import org.eclipse.emf.ecore.EObject;
*/
public interface CDOObject extends EObject
{
+ public CDOState cdoState();
+
public CDOClass cdoClass();
public CDOID cdoID();
- public CDOState cdoState();
-
public CDOView cdoView();
+ public CDORevision cdoRevision();
+
public CDOResource cdoResource();
- public CDORevision cdoRevision();
+ /**
+ * @since 2.0
+ */
+ public CDOResource cdoDirectResource();
public void cdoReload();
}
diff --git a/plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/cdo/CDOView.java b/plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/cdo/CDOView.java
index 621ea687fd..5da4a3947a 100644
--- a/plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/cdo/CDOView.java
+++ b/plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/cdo/CDOView.java
@@ -15,7 +15,10 @@ package org.eclipse.emf.cdo;
import org.eclipse.emf.cdo.common.CDOProtocolView;
import org.eclipse.emf.cdo.common.id.CDOID;
import org.eclipse.emf.cdo.eresource.CDOResource;
+import org.eclipse.emf.cdo.eresource.CDOResourceFolder;
+import org.eclipse.emf.cdo.eresource.CDOResourceNode;
import org.eclipse.emf.cdo.query.CDOQuery;
+import org.eclipse.emf.cdo.util.ReadOnlyException;
import org.eclipse.net4j.util.collection.CloseableIterator;
import org.eclipse.net4j.util.event.INotifier;
@@ -23,12 +26,26 @@ import org.eclipse.net4j.util.event.INotifier;
import org.eclipse.emf.common.util.URI;
import org.eclipse.emf.ecore.EObject;
import org.eclipse.emf.ecore.resource.ResourceSet;
+import org.eclipse.emf.ecore.resource.URIHandler;
import java.util.List;
import java.util.concurrent.locks.ReentrantLock;
/**
- * A read-only view to the <em>current</em> (i.e. latest) state of the object graph in the repository.
+ * A read-only view to the <em>current</em> (i.e. latest) state of the object graph in the repository of the underlying
+ * {@link CDOSession session}.
+ * <p>
+ * Objects that are accessed through this view are unchangeable for the client. Each attempt to call a mutator on one of
+ * these objects or one of their reference collections will result in a {@link ReadOnlyException} being thrown
+ * immediately.
+ * <p>
+ * A view is opened through API of the underlying session like this:
+ *
+ * <pre>
+ * CDOSession session = ...
+ * CDOView view = session.openView();
+ * ...
+ * </pre>
*
* @author Eike Stepper
* @noimplement This interface is not intended to be implemented by clients.
@@ -50,6 +67,11 @@ public interface CDOView extends CDOProtocolView, INotifier
public ResourceSet getResourceSet();
/**
+ * @since 2.0
+ */
+ public URIHandler getURIHandler();
+
+ /**
* Returns a reentrant lock that can be used to prevent the framework from writing to any object in this view (caused,
* for example, by passive updates).
* <p>
@@ -193,11 +215,48 @@ public interface CDOView extends CDOProtocolView, INotifier
public CDOResource getResource(String path);
/**
+ * @since 2.0
+ */
+ public CDOResource getRootResource();
+
+ /**
+ * Returns a list of the resources in the given folder with a name equal to or starting with the value of the name
+ * parameter.
+ *
+ * @param folder
+ * The folder to search in, or <code>null</code> for top level resource nodes.
+ * @param name
+ * the name or prefix of the resource nodes to return.
+ * @param exactMatch
+ * <code>true</code> if the complete name of the resource must match, <code>false</code> if only a common
+ * prefix of the name must match.
+ * @since 2.0
+ */
+ public List<CDOResourceNode> queryResources(CDOResourceFolder folder, String name, boolean exactMatch);
+
+ /**
+ * Returns an iterator over the resources in the given folder with a name equal to or starting with the value of the
+ * name parameter. The underlying query will be executed asynchronously.
+ *
+ * @param folder
+ * The folder to search in, or <code>null</code> for top level resource nodes.
+ * @param name
+ * the name or prefix of the resource nodes to return.
+ * @param exactMatch
+ * <code>true</code> if the complete name of the resource must match, <code>false</code> if only a common
+ * prefix of the name must match.
+ * @since 2.0
+ */
+ public CloseableIterator<CDOResourceNode> queryResourcesAsync(CDOResourceFolder folder, String name,
+ boolean exactMatch);
+
+ /**
* Returns the object for the given CDOID.
*
* @param loadOnDemand
* whether to create and load the object, if it doesn't already exist.
- * @return the object resolved by the CDOID, or <code>null</code> if there isn't one.
+ * @return the object resolved by the CDOID if the id is not <code>null</code>, or <code>null</code> if there isn't
+ * one and loadOnDemand is <code>false</code>.
*/
public CDOObject getObject(CDOID id, boolean loadOnDemand);
@@ -231,23 +290,4 @@ public interface CDOView extends CDOProtocolView, INotifier
* @since 2.0
*/
public CDOQuery createQuery(String language, String queryString);
-
- /**
- * Returns a list of those resources whose path starts with the value of the pathPrefix parameter.
- *
- * @param pathPrefix
- * the prefix of the resources' path
- * @since 2.0
- */
- public List<CDOResource> queryResources(String pathPrefix);
-
- /**
- * Returns an iterator over those resources whose path starts with the value of the pathPrefix parameter. The
- * underlying query will be executed asynchronously.
- *
- * @param pathPrefix
- * the prefix of the resources' path
- * @since 2.0
- */
- public CloseableIterator<CDOResource> queryResourcesAsync(String pathPrefix);
}
diff --git a/plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/cdo/eresource/CDOResource.java b/plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/cdo/eresource/CDOResource.java
index 8e1f845aec..b726f15440 100644
--- a/plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/cdo/eresource/CDOResource.java
+++ b/plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/cdo/eresource/CDOResource.java
@@ -10,17 +10,16 @@
**************************************************************************/
package org.eclipse.emf.cdo.eresource;
-import org.eclipse.emf.cdo.CDOObject;
-
import org.eclipse.emf.common.util.EList;
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;
/**
* <!-- begin-user-doc --> A representation of the model object '<em><b>CDO Resource</b></em>'.
*
- * @extends EresourceObject <!-- end-user-doc -->
+ * @extends Resource <!-- end-user-doc -->
* <p>
* The following features are supported:
* <ul>
@@ -33,15 +32,13 @@ import org.eclipse.emf.ecore.resource.ResourceSet;
* <li>{@link org.eclipse.emf.cdo.eresource.CDOResource#getErrors <em>Errors</em>}</li>
* <li>{@link org.eclipse.emf.cdo.eresource.CDOResource#getWarnings <em>Warnings</em>}</li>
* <li>{@link org.eclipse.emf.cdo.eresource.CDOResource#getTimeStamp <em>Time Stamp</em>}</li>
- * <li>{@link org.eclipse.emf.cdo.eresource.CDOResource#getPath <em>Path</em>}</li>
* </ul>
* </p>
* @see org.eclipse.emf.cdo.eresource.EresourcePackage#getCDOResource()
* @model
- * @extends CDOObject
* @generated
*/
-public interface CDOResource extends CDOObject, EresourceObject
+public interface CDOResource extends CDOResourceNode, Resource
{
/**
* Returns the value of the '<em><b>Resource Set</b></em>' attribute. <!-- begin-user-doc -->
@@ -80,7 +77,7 @@ public interface CDOResource extends CDOObject, EresourceObject
* @return the value of the '<em>URI</em>' attribute.
* @see #setURI(URI)
* @see org.eclipse.emf.cdo.eresource.EresourcePackage#getCDOResource_URI()
- * @model dataType="org.eclipse.emf.cdo.eresource.URI" transient="true"
+ * @model dataType="org.eclipse.emf.cdo.eresource.URI" transient="true" volatile="true" derived="true"
* @generated
*/
URI getURI();
@@ -192,7 +189,8 @@ public interface CDOResource extends CDOObject, EresourceObject
*
* @return the value of the '<em>Errors</em>' attribute list.
* @see org.eclipse.emf.cdo.eresource.EresourcePackage#getCDOResource_Errors()
- * @model dataType="org.eclipse.emf.cdo.eresource.Diagnostic" transient="true"
+ * @model dataType="org.eclipse.emf.cdo.eresource.Diagnostic" transient="true" changeable="false" volatile="true"
+ * derived="true"
* @generated
*/
EList<Diagnostic> getErrors();
@@ -208,7 +206,8 @@ public interface CDOResource extends CDOObject, EresourceObject
*
* @return the value of the '<em>Warnings</em>' attribute list.
* @see org.eclipse.emf.cdo.eresource.EresourcePackage#getCDOResource_Warnings()
- * @model dataType="org.eclipse.emf.cdo.eresource.Diagnostic" transient="true"
+ * @model dataType="org.eclipse.emf.cdo.eresource.Diagnostic" transient="true" changeable="false" volatile="true"
+ * derived="true"
* @generated
*/
EList<Diagnostic> getWarnings();
@@ -241,29 +240,9 @@ public interface CDOResource extends CDOObject, EresourceObject
void setTimeStamp(long value);
/**
- * Returns the value of the '<em><b>Path</b></em>' attribute. <!-- begin-user-doc -->
- * <p>
- * If the meaning of the '<em>Path</em>' attribute isn't clear, there really should be more of a description here...
- * </p>
- * <!-- end-user-doc -->
- *
- * @return the value of the '<em>Path</em>' attribute.
- * @see #setPath(String)
- * @see org.eclipse.emf.cdo.eresource.EresourcePackage#getCDOResource_Path()
- * @model
- * @generated
- */
- String getPath();
-
- /**
- * Sets the value of the '{@link org.eclipse.emf.cdo.eresource.CDOResource#getPath <em>Path</em>}' attribute. <!--
- * begin-user-doc --> <!-- end-user-doc -->
- *
- * @param value
- * the new value of the '<em>Path</em>' attribute.
- * @see #getPath()
- * @generated
+ * @ADDED
+ * @since 2.0
*/
- void setPath(String value);
+ public boolean isExisting();
} // CDOResource
diff --git a/plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/cdo/eresource/CDOResourceFolder.java b/plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/cdo/eresource/CDOResourceFolder.java
new file mode 100644
index 0000000000..e3e23d54c9
--- /dev/null
+++ b/plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/cdo/eresource/CDOResourceFolder.java
@@ -0,0 +1,46 @@
+/**
+ * <copyright>
+ * </copyright>
+ *
+ * $Id: CDOResourceFolder.java,v 1.2 2008-10-19 01:28:51 smcduff Exp $
+ */
+package org.eclipse.emf.cdo.eresource;
+
+import org.eclipse.emf.common.util.EList;
+
+/**
+ * <!-- begin-user-doc --> A representation of the model object '<em><b>CDO Resource Folder</b></em>'. <!-- end-user-doc
+ * -->
+ * <p>
+ * The following features are supported:
+ * <ul>
+ * <li>{@link org.eclipse.emf.cdo.eresource.CDOResourceFolder#getContents <em>Contents</em>}</li>
+ * </ul>
+ * </p>
+ *
+ * @see org.eclipse.emf.cdo.eresource.EresourcePackage#getCDOResourceFolder()
+ * @model
+ * @generated
+ * @since 2.0
+ */
+public interface CDOResourceFolder extends CDOResourceNode
+{
+ /**
+ * Returns the value of the '<em><b>Nodes</b></em>' containment reference list. The list contents are of type
+ * {@link org.eclipse.emf.cdo.eresource.CDOResourceNode}. It is bidirectional and its opposite is '
+ * {@link org.eclipse.emf.cdo.eresource.CDOResourceNode#getFolder <em>Folder</em>}'. <!-- begin-user-doc -->
+ * <p>
+ * If the meaning of the '<em>Nodes</em>' containment reference list isn't clear, there really should be more of a
+ * description here...
+ * </p>
+ * <!-- end-user-doc -->
+ *
+ * @return the value of the '<em>Nodes</em>' containment reference list.
+ * @see org.eclipse.emf.cdo.eresource.EresourcePackage#getCDOResourceFolder_Nodes()
+ * @see org.eclipse.emf.cdo.eresource.CDOResourceNode#getFolder
+ * @model opposite="folder" containment="true"
+ * @generated
+ */
+ EList<CDOResourceNode> getNodes();
+
+} // CDOResourceFolder
diff --git a/plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/cdo/eresource/CDOResourceInputStream.java b/plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/cdo/eresource/CDOResourceInputStream.java
new file mode 100644
index 0000000000..b42abbce9e
--- /dev/null
+++ b/plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/cdo/eresource/CDOResourceInputStream.java
@@ -0,0 +1,58 @@
+/***************************************************************************
+ * 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.cdo.eresource;
+
+import org.eclipse.emf.cdo.CDOView;
+
+import org.eclipse.emf.common.util.URI;
+
+import java.io.IOException;
+import java.io.InputStream;
+import java.text.MessageFormat;
+
+/**
+ * @author Eike Stepper
+ * @since 2.0
+ */
+public final class CDOResourceInputStream extends InputStream
+{
+ private CDOView view;
+
+ private URI uri;
+
+ public CDOResourceInputStream(CDOView view, URI uri)
+ {
+ this.view = view;
+ this.uri = uri;
+ }
+
+ public CDOView getView()
+ {
+ return view;
+ }
+
+ public URI getURI()
+ {
+ return uri;
+ }
+
+ @Override
+ public int read() throws IOException
+ {
+ throw new IOException("read not supported");
+ }
+
+ @Override
+ public String toString()
+ {
+ return MessageFormat.format("CDOInputStream[{0}]", uri);
+ }
+}
diff --git a/plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/cdo/eresource/CDOResourceNode.java b/plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/cdo/eresource/CDOResourceNode.java
new file mode 100644
index 0000000000..901f09d15c
--- /dev/null
+++ b/plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/cdo/eresource/CDOResourceNode.java
@@ -0,0 +1,129 @@
+/**
+ * <copyright>
+ * </copyright>
+ *
+ * $Id: CDOResourceNode.java,v 1.2 2008-10-19 01:28:51 smcduff Exp $
+ */
+package org.eclipse.emf.cdo.eresource;
+
+import org.eclipse.emf.cdo.CDOObject;
+
+/**
+ * <!-- begin-user-doc --> A representation of the model object '<em><b>CDO Resource Node</b></em>'. <!-- end-user-doc
+ * -->
+ * <p>
+ * The following features are supported:
+ * <ul>
+ * <li>{@link org.eclipse.emf.cdo.eresource.CDOResourceNode#getFolder <em>Folder</em>}</li>
+ * <li>{@link org.eclipse.emf.cdo.eresource.CDOResourceNode#getName <em>Name</em>}</li>
+ * <li>{@link org.eclipse.emf.cdo.eresource.CDOResourceNode#getPath <em>Path</em>}</li>
+ * </ul>
+ * </p>
+ *
+ * @see org.eclipse.emf.cdo.eresource.EresourcePackage#getCDOResourceNode()
+ * @model abstract="true"
+ * @generated
+ * @since 2.0
+ */
+public interface CDOResourceNode extends CDOObject
+{
+ /**
+ * @ADDED
+ * @since 2.0
+ */
+ public static final String ROOT_PATH = "/";
+
+ /**
+ * @ADDED
+ * @since 2.0
+ */
+ public static final String ROOT_NAME = null;
+
+ /**
+ * @ADDED
+ * @since 2.0
+ */
+ public boolean isRoot();
+
+ /**
+ * Returns the value of the '<em><b>Folder</b></em>' container reference. It is bidirectional and its opposite is '
+ * {@link org.eclipse.emf.cdo.eresource.CDOResourceFolder#getNodes <em>Nodes</em>}'. <!-- begin-user-doc -->
+ * <p>
+ * If the meaning of the '<em>Folder</em>' container reference isn't clear, there really should be more of a
+ * description here...
+ * </p>
+ * <!-- end-user-doc -->
+ *
+ * @return the value of the '<em>Folder</em>' container reference.
+ * @see #setFolder(CDOResourceFolder)
+ * @see org.eclipse.emf.cdo.eresource.EresourcePackage#getCDOResourceNode_Folder()
+ * @see org.eclipse.emf.cdo.eresource.CDOResourceFolder#getNodes
+ * @model opposite="nodes" transient="false"
+ * @generated
+ */
+ CDOResourceFolder getFolder();
+
+ /**
+ * Sets the value of the '{@link org.eclipse.emf.cdo.eresource.CDOResourceNode#getFolder <em>Folder</em>}' container
+ * reference. <!-- begin-user-doc --> <!-- end-user-doc -->
+ *
+ * @param value
+ * the new value of the '<em>Folder</em>' container reference.
+ * @see #getFolder()
+ * @generated
+ */
+ void setFolder(CDOResourceFolder value);
+
+ /**
+ * Returns the value of the '<em><b>Name</b></em>' attribute. <!-- begin-user-doc -->
+ * <p>
+ * If the meaning of the '<em>Name</em>' attribute isn't clear, there really should be more of a description here...
+ * </p>
+ * <!-- end-user-doc -->
+ *
+ * @return the value of the '<em>Name</em>' attribute.
+ * @see #setName(String)
+ * @see org.eclipse.emf.cdo.eresource.EresourcePackage#getCDOResourceNode_Name()
+ * @model
+ * @generated
+ */
+ String getName();
+
+ /**
+ * Sets the value of the '{@link org.eclipse.emf.cdo.eresource.CDOResourceNode#getName <em>Name</em>}' attribute. <!--
+ * begin-user-doc --> <!-- end-user-doc -->
+ *
+ * @param value
+ * the new value of the '<em>Name</em>' attribute.
+ * @see #getName()
+ * @generated
+ */
+ void setName(String value);
+
+ /**
+ * Returns the value of the '<em><b>Path</b></em>' attribute. <!-- begin-user-doc -->
+ * <p>
+ * If the meaning of the '<em>Path</em>' attribute isn't clear, there really should be more of a description here...
+ * </p>
+ * <!-- end-user-doc -->
+ *
+ * @return the value of the '<em>Path</em>' attribute.
+ * @see #setPath(String)
+ * @see org.eclipse.emf.cdo.eresource.EresourcePackage#getCDOResourceNode_Path()
+ * @model transient="true" volatile="true" derived="true"
+ * @generated
+ */
+ String getPath();
+
+ /**
+ * Sets the value of the '{@link org.eclipse.emf.cdo.eresource.CDOResourceNode#getPath <em>Path</em>}' attribute. <!--
+ * begin-user-doc --> <!-- end-user-doc -->
+ *
+ * @param value
+ * the new value of the '<em>Path</em>' attribute.
+ * @see #getPath()
+ * @generated
+ */
+ void setPath(String value);
+
+} // CDOResourceNode
diff --git a/plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/cdo/eresource/EresourceFactory.java b/plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/cdo/eresource/EresourceFactory.java
index 57e4841c29..50e830ded4 100644
--- a/plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/cdo/eresource/EresourceFactory.java
+++ b/plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/cdo/eresource/EresourceFactory.java
@@ -29,6 +29,15 @@ public interface EresourceFactory extends EFactory
EresourceFactory eINSTANCE = org.eclipse.emf.cdo.eresource.impl.EresourceFactoryImpl.init();
/**
+ * Returns a new object of class '<em>CDO Resource Folder</em>'. <!-- begin-user-doc -->
+ *
+ * @since 2.0<!-- end-user-doc -->
+ * @return a new object of class '<em>CDO Resource Folder</em>'.
+ * @generated
+ */
+ CDOResourceFolder createCDOResourceFolder();
+
+ /**
* Returns a new object of class '<em>CDO Resource</em>'. <!-- begin-user-doc --> <!-- end-user-doc -->
*
* @return a new object of class '<em>CDO Resource</em>'.
diff --git a/plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/cdo/eresource/EresourcePackage.java b/plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/cdo/eresource/EresourcePackage.java
index 5863888173..891155c44a 100644
--- a/plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/cdo/eresource/EresourcePackage.java
+++ b/plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/cdo/eresource/EresourcePackage.java
@@ -44,7 +44,7 @@ public interface EresourcePackage extends EPackage
*
* @generated
*/
- String eNS_URI = "http://www.eclipse.org/emf/CDO/resource/1.0.0";
+ String eNS_URI = "http://www.eclipse.org/emf/CDO/resource/2.0.0";
/**
* The package namespace name. <!-- begin-user-doc --> <!-- end-user-doc -->
@@ -61,6 +61,109 @@ public interface EresourcePackage extends EPackage
EresourcePackage eINSTANCE = org.eclipse.emf.cdo.eresource.impl.EresourcePackageImpl.init();
/**
+ * The meta object id for the '{@link org.eclipse.emf.cdo.eresource.impl.CDOResourceNodeImpl
+ * <em>CDO Resource Node</em>}' class. <!-- begin-user-doc -->
+ *
+ * @since 2.0<!-- end-user-doc -->
+ * @see org.eclipse.emf.cdo.eresource.impl.CDOResourceNodeImpl
+ * @see org.eclipse.emf.cdo.eresource.impl.EresourcePackageImpl#getCDOResourceNode()
+ * @generated
+ */
+ int CDO_RESOURCE_NODE = 0;
+
+ /**
+ * The feature id for the '<em><b>Folder</b></em>' container reference. <!-- begin-user-doc -->
+ *
+ * @since 2.0<!-- end-user-doc -->
+ * @generated
+ * @ordered
+ */
+ int CDO_RESOURCE_NODE__FOLDER = 0;
+
+ /**
+ * The feature id for the '<em><b>Name</b></em>' attribute. <!-- begin-user-doc -->
+ *
+ * @since 2.0<!-- end-user-doc -->
+ * @generated
+ * @ordered
+ */
+ int CDO_RESOURCE_NODE__NAME = 1;
+
+ /**
+ * The feature id for the '<em><b>Path</b></em>' attribute. <!-- begin-user-doc -->
+ *
+ * @since 2.0<!-- end-user-doc -->
+ * @generated
+ * @ordered
+ */
+ int CDO_RESOURCE_NODE__PATH = 2;
+
+ /**
+ * The number of structural features of the '<em>CDO Resource Node</em>' class. <!-- begin-user-doc -->
+ *
+ * @since 2.0<!-- end-user-doc -->
+ * @generated
+ * @ordered
+ */
+ int CDO_RESOURCE_NODE_FEATURE_COUNT = 3;
+
+ /**
+ * The meta object id for the '{@link org.eclipse.emf.cdo.eresource.impl.CDOResourceFolderImpl
+ * <em>CDO Resource Folder</em>}' class. <!-- begin-user-doc -->
+ *
+ * @since 2.0<!-- end-user-doc -->
+ * @see org.eclipse.emf.cdo.eresource.impl.CDOResourceFolderImpl
+ * @see org.eclipse.emf.cdo.eresource.impl.EresourcePackageImpl#getCDOResourceFolder()
+ * @generated
+ */
+ int CDO_RESOURCE_FOLDER = 1;
+
+ /**
+ * The feature id for the '<em><b>Folder</b></em>' container reference. <!-- begin-user-doc -->
+ *
+ * @since 2.0<!-- end-user-doc -->
+ * @generated
+ * @ordered
+ */
+ int CDO_RESOURCE_FOLDER__FOLDER = CDO_RESOURCE_NODE__FOLDER;
+
+ /**
+ * The feature id for the '<em><b>Name</b></em>' attribute. <!-- begin-user-doc -->
+ *
+ * @since 2.0<!-- end-user-doc -->
+ * @generated
+ * @ordered
+ */
+ int CDO_RESOURCE_FOLDER__NAME = CDO_RESOURCE_NODE__NAME;
+
+ /**
+ * The feature id for the '<em><b>Path</b></em>' attribute. <!-- begin-user-doc -->
+ *
+ * @since 2.0<!-- end-user-doc -->
+ * @generated
+ * @ordered
+ */
+ int CDO_RESOURCE_FOLDER__PATH = CDO_RESOURCE_NODE__PATH;
+
+ /**
+ * The feature id for the '<em><b>Nodes</b></em>' containment reference list. <!-- begin-user-doc -->
+ *
+ * @since 2.0<!-- end-user-doc -->
+ * @generated
+ * @ordered
+ */
+ int CDO_RESOURCE_FOLDER__NODES = CDO_RESOURCE_NODE_FEATURE_COUNT + 0;
+
+ /**
+ * The number of structural features of the '<em>CDO Resource Folder</em>' class. <!-- begin-user-doc -->
+ *
+ * @since 2.0<!-- end-user-doc -->
+ * @generated
+ * @ordered
+ */
+ int CDO_RESOURCE_FOLDER_FEATURE_COUNT = CDO_RESOURCE_NODE_FEATURE_COUNT + 1;
+
+ /**
* The meta object id for the '{@link org.eclipse.emf.cdo.eresource.impl.CDOResourceImpl <em>CDO Resource</em>}'
* class. <!-- begin-user-doc --> <!-- end-user-doc -->
*
@@ -68,7 +171,33 @@ public interface EresourcePackage extends EPackage
* @see org.eclipse.emf.cdo.eresource.impl.EresourcePackageImpl#getCDOResource()
* @generated
*/
- int CDO_RESOURCE = 0;
+ int CDO_RESOURCE = 2;
+
+ /**
+ * The feature id for the '<em><b>Folder</b></em>' container reference. <!-- begin-user-doc -->
+ *
+ * @since 2.0<!-- end-user-doc -->
+ * @generated
+ * @ordered
+ */
+ int CDO_RESOURCE__FOLDER = CDO_RESOURCE_NODE__FOLDER;
+
+ /**
+ * The feature id for the '<em><b>Name</b></em>' attribute. <!-- begin-user-doc -->
+ *
+ * @since 2.0<!-- end-user-doc -->
+ * @generated
+ * @ordered
+ */
+ int CDO_RESOURCE__NAME = CDO_RESOURCE_NODE__NAME;
+
+ /**
+ * The feature id for the '<em><b>Path</b></em>' attribute. <!-- begin-user-doc --> <!-- end-user-doc -->
+ *
+ * @generated
+ * @ordered
+ */
+ int CDO_RESOURCE__PATH = CDO_RESOURCE_NODE__PATH;
/**
* The feature id for the '<em><b>Resource Set</b></em>' attribute. <!-- begin-user-doc --> <!-- end-user-doc -->
@@ -76,7 +205,7 @@ public interface EresourcePackage extends EPackage
* @generated
* @ordered
*/
- int CDO_RESOURCE__RESOURCE_SET = 0;
+ int CDO_RESOURCE__RESOURCE_SET = CDO_RESOURCE_NODE_FEATURE_COUNT + 0;
/**
* The feature id for the '<em><b>URI</b></em>' attribute. <!-- begin-user-doc --> <!-- end-user-doc -->
@@ -84,7 +213,7 @@ public interface EresourcePackage extends EPackage
* @generated
* @ordered
*/
- int CDO_RESOURCE__URI = 1;
+ int CDO_RESOURCE__URI = CDO_RESOURCE_NODE_FEATURE_COUNT + 1;
/**
* The feature id for the '<em><b>Contents</b></em>' containment reference list. <!-- begin-user-doc --> <!--
@@ -93,7 +222,7 @@ public interface EresourcePackage extends EPackage
* @generated
* @ordered
*/
- int CDO_RESOURCE__CONTENTS = 2;
+ int CDO_RESOURCE__CONTENTS = CDO_RESOURCE_NODE_FEATURE_COUNT + 2;
/**
* The feature id for the '<em><b>Modified</b></em>' attribute. <!-- begin-user-doc --> <!-- end-user-doc -->
@@ -101,7 +230,7 @@ public interface EresourcePackage extends EPackage
* @generated
* @ordered
*/
- int CDO_RESOURCE__MODIFIED = 3;
+ int CDO_RESOURCE__MODIFIED = CDO_RESOURCE_NODE_FEATURE_COUNT + 3;
/**
* The feature id for the '<em><b>Loaded</b></em>' attribute. <!-- begin-user-doc --> <!-- end-user-doc -->
@@ -109,7 +238,7 @@ public interface EresourcePackage extends EPackage
* @generated
* @ordered
*/
- int CDO_RESOURCE__LOADED = 4;
+ int CDO_RESOURCE__LOADED = CDO_RESOURCE_NODE_FEATURE_COUNT + 4;
/**
* The feature id for the '<em><b>Tracking Modification</b></em>' attribute. <!-- begin-user-doc --> <!-- end-user-doc
@@ -118,7 +247,7 @@ public interface EresourcePackage extends EPackage
* @generated
* @ordered
*/
- int CDO_RESOURCE__TRACKING_MODIFICATION = 5;
+ int CDO_RESOURCE__TRACKING_MODIFICATION = CDO_RESOURCE_NODE_FEATURE_COUNT + 5;
/**
* The feature id for the '<em><b>Errors</b></em>' attribute list. <!-- begin-user-doc --> <!-- end-user-doc -->
@@ -126,7 +255,7 @@ public interface EresourcePackage extends EPackage
* @generated
* @ordered
*/
- int CDO_RESOURCE__ERRORS = 6;
+ int CDO_RESOURCE__ERRORS = CDO_RESOURCE_NODE_FEATURE_COUNT + 6;
/**
* The feature id for the '<em><b>Warnings</b></em>' attribute list. <!-- begin-user-doc --> <!-- end-user-doc -->
@@ -134,7 +263,7 @@ public interface EresourcePackage extends EPackage
* @generated
* @ordered
*/
- int CDO_RESOURCE__WARNINGS = 7;
+ int CDO_RESOURCE__WARNINGS = CDO_RESOURCE_NODE_FEATURE_COUNT + 7;
/**
* The feature id for the '<em><b>Time Stamp</b></em>' attribute. <!-- begin-user-doc --> <!-- end-user-doc -->
@@ -142,15 +271,7 @@ public interface EresourcePackage extends EPackage
* @generated
* @ordered
*/
- int CDO_RESOURCE__TIME_STAMP = 8;
-
- /**
- * The feature id for the '<em><b>Path</b></em>' attribute. <!-- begin-user-doc --> <!-- end-user-doc -->
- *
- * @generated
- * @ordered
- */
- int CDO_RESOURCE__PATH = 9;
+ int CDO_RESOURCE__TIME_STAMP = CDO_RESOURCE_NODE_FEATURE_COUNT + 8;
/**
* The number of structural features of the '<em>CDO Resource</em>' class. <!-- begin-user-doc --> <!-- end-user-doc
@@ -159,7 +280,7 @@ public interface EresourcePackage extends EPackage
* @generated
* @ordered
*/
- int CDO_RESOURCE_FEATURE_COUNT = 10;
+ int CDO_RESOURCE_FEATURE_COUNT = CDO_RESOURCE_NODE_FEATURE_COUNT + 9;
/**
* The meta object id for the '<em>Resource Set</em>' data type. <!-- begin-user-doc --> <!-- end-user-doc -->
@@ -168,7 +289,7 @@ public interface EresourcePackage extends EPackage
* @see org.eclipse.emf.cdo.eresource.impl.EresourcePackageImpl#getResourceSet()
* @generated
*/
- int RESOURCE_SET = 1;
+ int RESOURCE_SET = 3;
/**
* The meta object id for the '<em>URI</em>' data type. <!-- begin-user-doc --> <!-- end-user-doc -->
@@ -177,7 +298,7 @@ public interface EresourcePackage extends EPackage
* @see org.eclipse.emf.cdo.eresource.impl.EresourcePackageImpl#getURI()
* @generated
*/
- int URI = 2;
+ int URI = 4;
/**
* The meta object id for the '<em>Diagnostic</em>' data type. <!-- begin-user-doc --> <!-- end-user-doc -->
@@ -186,7 +307,77 @@ public interface EresourcePackage extends EPackage
* @see org.eclipse.emf.cdo.eresource.impl.EresourcePackageImpl#getDiagnostic()
* @generated
*/
- int DIAGNOSTIC = 3;
+ int DIAGNOSTIC = 5;
+
+ /**
+ * Returns the meta object for class '{@link org.eclipse.emf.cdo.eresource.CDOResourceNode <em>CDO Resource Node</em>}
+ * '. <!-- begin-user-doc -->
+ *
+ * @since 2.0<!-- end-user-doc -->
+ * @return the meta object for class '<em>CDO Resource Node</em>'.
+ * @see org.eclipse.emf.cdo.eresource.CDOResourceNode
+ * @generated
+ */
+ EClass getCDOResourceNode();
+
+ /**
+ * Returns the meta object for the container reference '
+ * {@link org.eclipse.emf.cdo.eresource.CDOResourceNode#getFolder <em>Folder</em>}'. <!-- begin-user-doc -->
+ *
+ * @since 2.0<!-- end-user-doc -->
+ * @return the meta object for the container reference '<em>Folder</em>'.
+ * @see org.eclipse.emf.cdo.eresource.CDOResourceNode#getFolder()
+ * @see #getCDOResourceNode()
+ * @generated
+ */
+ EReference getCDOResourceNode_Folder();
+
+ /**
+ * Returns the meta object for the attribute '{@link org.eclipse.emf.cdo.eresource.CDOResourceNode#getName
+ * <em>Name</em>}'. <!-- begin-user-doc -->
+ *
+ * @since 2.0<!-- end-user-doc -->
+ * @return the meta object for the attribute '<em>Name</em>'.
+ * @see org.eclipse.emf.cdo.eresource.CDOResourceNode#getName()
+ * @see #getCDOResourceNode()
+ * @generated
+ */
+ EAttribute getCDOResourceNode_Name();
+
+ /**
+ * Returns the meta object for the attribute '{@link org.eclipse.emf.cdo.eresource.CDOResourceNode#getPath
+ * <em>Path</em>}'. <!-- begin-user-doc -->
+ *
+ * @since 2.0<!-- end-user-doc -->
+ * @return the meta object for the attribute '<em>Path</em>'.
+ * @see org.eclipse.emf.cdo.eresource.CDOResourceNode#getPath()
+ * @see #getCDOResourceNode()
+ * @generated
+ */
+ EAttribute getCDOResourceNode_Path();
+
+ /**
+ * Returns the meta object for class '{@link org.eclipse.emf.cdo.eresource.CDOResourceFolder
+ * <em>CDO Resource Folder</em>}'. <!-- begin-user-doc -->
+ *
+ * @since 2.0<!-- end-user-doc -->
+ * @return the meta object for class '<em>CDO Resource Folder</em>'.
+ * @see org.eclipse.emf.cdo.eresource.CDOResourceFolder
+ * @generated
+ */
+ EClass getCDOResourceFolder();
+
+ /**
+ * Returns the meta object for the containment reference list '
+ * {@link org.eclipse.emf.cdo.eresource.CDOResourceFolder#getNodes <em>Nodes</em>}'. <!-- begin-user-doc -->
+ *
+ * @since 2.0<!-- end-user-doc -->
+ * @return the meta object for the containment reference list '<em>Nodes</em>'.
+ * @see org.eclipse.emf.cdo.eresource.CDOResourceFolder#getNodes()
+ * @see #getCDOResourceFolder()
+ * @generated
+ */
+ EReference getCDOResourceFolder_Nodes();
/**
* Returns the meta object for class '{@link org.eclipse.emf.cdo.eresource.CDOResource <em>CDO Resource</em>}'. <!--
@@ -299,17 +490,6 @@ public interface EresourcePackage extends EPackage
EAttribute getCDOResource_TimeStamp();
/**
- * Returns the meta object for the attribute '{@link org.eclipse.emf.cdo.eresource.CDOResource#getPath <em>Path</em>}
- * '. <!-- begin-user-doc --> <!-- end-user-doc -->
- *
- * @return the meta object for the attribute '<em>Path</em>'.
- * @see org.eclipse.emf.cdo.eresource.CDOResource#getPath()
- * @see #getCDOResource()
- * @generated
- */
- EAttribute getCDOResource_Path();
-
- /**
* Returns the meta object for data type '{@link org.eclipse.emf.ecore.resource.ResourceSet <em>Resource Set</em>}'.
* <!-- begin-user-doc --> <!-- end-user-doc -->
*
@@ -365,6 +545,61 @@ public interface EresourcePackage extends EPackage
interface Literals
{
/**
+ * The meta object literal for the '{@link org.eclipse.emf.cdo.eresource.impl.CDOResourceNodeImpl
+ * <em>CDO Resource Node</em>}' class. <!-- begin-user-doc -->
+ *
+ * @since 2.0<!-- end-user-doc -->
+ * @see org.eclipse.emf.cdo.eresource.impl.CDOResourceNodeImpl
+ * @see org.eclipse.emf.cdo.eresource.impl.EresourcePackageImpl#getCDOResourceNode()
+ * @generated
+ */
+ EClass CDO_RESOURCE_NODE = eINSTANCE.getCDOResourceNode();
+
+ /**
+ * The meta object literal for the '<em><b>Folder</b></em>' container reference feature. <!-- begin-user-doc -->
+ *
+ * @since 2.0<!-- end-user-doc -->
+ * @generated
+ */
+ EReference CDO_RESOURCE_NODE__FOLDER = eINSTANCE.getCDOResourceNode_Folder();
+
+ /**
+ * The meta object literal for the '<em><b>Name</b></em>' attribute feature. <!-- begin-user-doc -->
+ *
+ * @since 2.0<!-- end-user-doc -->
+ * @generated
+ */
+ EAttribute CDO_RESOURCE_NODE__NAME = eINSTANCE.getCDOResourceNode_Name();
+
+ /**
+ * The meta object literal for the '<em><b>Path</b></em>' attribute feature. <!-- begin-user-doc -->
+ *
+ * @since 2.0<!-- end-user-doc -->
+ * @generated
+ */
+ EAttribute CDO_RESOURCE_NODE__PATH = eINSTANCE.getCDOResourceNode_Path();
+
+ /**
+ * The meta object literal for the '{@link org.eclipse.emf.cdo.eresource.impl.CDOResourceFolderImpl
+ * <em>CDO Resource Folder</em>}' class. <!-- begin-user-doc -->
+ *
+ * @since 2.0<!-- end-user-doc -->
+ * @see org.eclipse.emf.cdo.eresource.impl.CDOResourceFolderImpl
+ * @see org.eclipse.emf.cdo.eresource.impl.EresourcePackageImpl#getCDOResourceFolder()
+ * @generated
+ */
+ EClass CDO_RESOURCE_FOLDER = eINSTANCE.getCDOResourceFolder();
+
+ /**
+ * The meta object literal for the '<em><b>Nodes</b></em>' containment reference list feature. <!-- begin-user-doc
+ * -->
+ *
+ * @since 2.0<!-- end-user-doc -->
+ * @generated
+ */
+ EReference CDO_RESOURCE_FOLDER__NODES = eINSTANCE.getCDOResourceFolder_Nodes();
+
+ /**
* The meta object literal for the '{@link org.eclipse.emf.cdo.eresource.impl.CDOResourceImpl <em>CDO Resource</em>}
* ' class. <!-- begin-user-doc --> <!-- end-user-doc -->
*
@@ -447,14 +682,6 @@ public interface EresourcePackage extends EPackage
EAttribute CDO_RESOURCE__TIME_STAMP = eINSTANCE.getCDOResource_TimeStamp();
/**
- * The meta object literal for the '<em><b>Path</b></em>' attribute feature. <!-- begin-user-doc --> <!--
- * end-user-doc -->
- *
- * @generated
- */
- EAttribute CDO_RESOURCE__PATH = eINSTANCE.getCDOResource_Path();
-
- /**
* The meta object literal for the '<em>Resource Set</em>' data type. <!-- begin-user-doc --> <!-- end-user-doc -->
*
* @see org.eclipse.emf.ecore.resource.ResourceSet
diff --git a/plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/cdo/eresource/impl/CDOResourceFactoryImpl.java b/plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/cdo/eresource/impl/CDOResourceFactoryImpl.java
index a4c5b392a9..da87dba0a4 100644
--- a/plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/cdo/eresource/impl/CDOResourceFactoryImpl.java
+++ b/plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/cdo/eresource/impl/CDOResourceFactoryImpl.java
@@ -14,7 +14,6 @@ package org.eclipse.emf.cdo.eresource.impl;
import org.eclipse.emf.cdo.CDOViewSet;
import org.eclipse.emf.cdo.eresource.CDOResourceFactory;
-import org.eclipse.emf.cdo.eresource.EresourceFactory;
import org.eclipse.emf.cdo.util.CDOURIUtil;
import org.eclipse.emf.internal.cdo.CDOViewImpl;
@@ -46,41 +45,27 @@ public class CDOResourceFactoryImpl implements Resource.Factory, CDOResourceFact
public Resource createResource(URI uri)
{
- // URI can be invalid or incomplete.
- // Extract repo + resource path and build a new URI.
-
- String repoUUID = CDOURIUtil.extractRepositoryUUID(uri);
+ // URI can be invalid or incomplete. Extract repo + resource path and build a new URI.
+ String repositoryUUID = CDOURIUtil.extractRepositoryUUID(uri);
// repoUUID can be null but can be null
- CDOViewImpl view = viewSet.resolveUUID(repoUUID);
-
- // Extract path
- String path = uri.path();
+ CDOViewImpl view = viewSet.resolveView(repositoryUUID);
+ String path = CDOURIUtil.extractResourcePath(uri);
// Build a new URI with the view and the path
URI newURI = CDOURIUtil.createResourceURI(view, path);
- CDOResourceImpl resource = (CDOResourceImpl)EresourceFactory.eINSTANCE.createCDOResource();
- resource.setURI(newURI);
- resource.setExisting(isExistingResource());
-
- if (resource.isExisting())
- {
- // Doesn't have any resource for that path!
- if (!view.registerProxyResource(resource))
- {
- // TODO Should fill getErrors here !!
- resource.setExisting(false);
- }
- }
-
+ // Important: Set URI *after* registration with the view!
+ CDOResourceImpl resource = new CDOResourceImpl(newURI);
+ resource.setRoot(CDOURIUtil.SEGMENT_SEPARATOR.equals(path));
+ resource.setExisting(isGetResource());
return resource;
}
/**
* TODO Add TCs to ensure that Ecore internally doesn't change the way the stack is used!!!
*/
- private boolean isExistingResource()
+ private boolean isGetResource()
{
boolean inResourceSet = false;
StackTraceElement[] elements = Thread.currentThread().getStackTrace();
diff --git a/plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/cdo/eresource/impl/CDOResourceFolderImpl.java b/plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/cdo/eresource/impl/CDOResourceFolderImpl.java
new file mode 100644
index 0000000000..5294c31322
--- /dev/null
+++ b/plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/cdo/eresource/impl/CDOResourceFolderImpl.java
@@ -0,0 +1,86 @@
+/**
+ * <copyright>
+ * </copyright>
+ *
+ * $Id: CDOResourceFolderImpl.java,v 1.2 2008-10-19 01:28:53 smcduff Exp $
+ */
+package org.eclipse.emf.cdo.eresource.impl;
+
+import org.eclipse.emf.cdo.eresource.CDOResourceFolder;
+import org.eclipse.emf.cdo.eresource.CDOResourceNode;
+import org.eclipse.emf.cdo.eresource.EresourcePackage;
+
+import org.eclipse.emf.common.util.EList;
+import org.eclipse.emf.ecore.EClass;
+
+/**
+ * <!-- begin-user-doc --> An implementation of the model object '<em><b>CDO Resource Folder</b></em>'.
+ *
+ * @since 2.0<!-- end-user-doc -->
+ * <p>
+ * The following features are implemented:
+ * <ul>
+ * <li>{@link org.eclipse.emf.cdo.eresource.impl.CDOResourceFolderImpl#getNodes <em>Nodes</em>}</li>
+ * </ul>
+ * </p>
+ * @generated
+ */
+public class CDOResourceFolderImpl extends CDOResourceNodeImpl implements CDOResourceFolder
+{
+ /**
+ * <!-- begin-user-doc --> <!-- end-user-doc -->
+ *
+ * @generated
+ */
+ protected CDOResourceFolderImpl()
+ {
+ super();
+ }
+
+ /**
+ * @ADDED
+ */
+ public boolean isRoot()
+ {
+ return false;
+ }
+
+ // @Override
+ // public Resource.Internal eDirectResource()
+ // {
+ // if (FSMUtil.isTransient(this))
+ // {
+ // return super.eDirectResource();
+ // }
+ //
+ // if (eStore().getContainer(this) == null)
+ // {
+ // return cdoView().getRootResource();
+ // }
+ //
+ // return null;
+ // }
+
+ /**
+ * <!-- begin-user-doc --> <!-- end-user-doc -->
+ *
+ * @generated
+ */
+ @Override
+ protected EClass eStaticClass()
+ {
+ return EresourcePackage.Literals.CDO_RESOURCE_FOLDER;
+ }
+
+ /**
+ * <!-- begin-user-doc --> <!-- end-user-doc -->
+ *
+ * @generated
+ */
+ @SuppressWarnings("unchecked")
+ public EList<CDOResourceNode> getNodes()
+ {
+ return (EList<CDOResourceNode>)eGet(EresourcePackage.Literals.CDO_RESOURCE_FOLDER__NODES, true);
+ }
+
+} // CDOResourceFolderImpl
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 5b3d40ac62..a3b2e63ce4 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
@@ -13,6 +13,7 @@
**************************************************************************/
package org.eclipse.emf.cdo.eresource.impl;
+import org.eclipse.emf.cdo.CDOState;
import org.eclipse.emf.cdo.CDOTransaction;
import org.eclipse.emf.cdo.CDOView;
import org.eclipse.emf.cdo.common.id.CDOID;
@@ -22,9 +23,9 @@ import org.eclipse.emf.cdo.eresource.EresourcePackage;
import org.eclipse.emf.cdo.util.CDOURIUtil;
import org.eclipse.emf.cdo.util.ObjectNotFoundException;
-import org.eclipse.emf.internal.cdo.CDOObjectImpl;
import org.eclipse.emf.internal.cdo.CDOStateMachine;
import org.eclipse.emf.internal.cdo.CDOTransactionImpl;
+import org.eclipse.emf.internal.cdo.CDOViewImpl;
import org.eclipse.emf.internal.cdo.InternalCDOObject;
import org.eclipse.emf.internal.cdo.util.FSMUtil;
@@ -43,46 +44,94 @@ import org.eclipse.emf.ecore.EStructuralFeature;
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.URIConverter;
+import org.eclipse.emf.ecore.resource.impl.ExtensibleURIConverterImpl;
import org.eclipse.emf.ecore.resource.impl.ResourceImpl;
import org.eclipse.emf.ecore.util.InternalEList;
+import org.eclipse.emf.ecore.util.NotifyingInternalEListImpl;
import java.io.IOException;
import java.io.InputStream;
import java.io.OutputStream;
import java.util.Collection;
import java.util.Iterator;
-import java.util.List;
-import java.util.ListIterator;
import java.util.Map;
/**
- * <!-- begin-user-doc --> An implementation of the model object '<em><b>CDO Resource</b></em>'. <!-- end-user-doc -->
- * <p>
- * The following features are implemented:
- * <ul>
- * <li>{@link org.eclipse.emf.cdo.eresource.impl.CDOResourceImpl#getResourceSet <em>Resource Set</em>}</li>
- * <li>{@link org.eclipse.emf.cdo.eresource.impl.CDOResourceImpl#getURI <em>URI</em>}</li>
- * <li>{@link org.eclipse.emf.cdo.eresource.impl.CDOResourceImpl#getContents <em>Contents</em>}</li>
- * <li>{@link org.eclipse.emf.cdo.eresource.impl.CDOResourceImpl#isModified <em>Modified</em>}</li>
- * <li>{@link org.eclipse.emf.cdo.eresource.impl.CDOResourceImpl#isLoaded <em>Loaded</em>}</li>
- * <li>{@link org.eclipse.emf.cdo.eresource.impl.CDOResourceImpl#isTrackingModification <em>Tracking Modification</em>}</li>
- * <li>{@link org.eclipse.emf.cdo.eresource.impl.CDOResourceImpl#getErrors <em>Errors</em>}</li>
- * <li>{@link org.eclipse.emf.cdo.eresource.impl.CDOResourceImpl#getWarnings <em>Warnings</em>}</li>
- * <li>{@link org.eclipse.emf.cdo.eresource.impl.CDOResourceImpl#getTimeStamp <em>Time Stamp</em>}</li>
- * <li>{@link org.eclipse.emf.cdo.eresource.impl.CDOResourceImpl#getPath <em>Path</em>}</li>
- * </ul>
- * </p>
+ * <!-- begin-user-doc --> An implementation of the model object '<em><b>CDO Resource</b></em>'.
*
+ * @extends Resource.Internal<!-- end-user-doc -->
+ * <p>
+ * The following features are implemented:
+ * <ul>
+ * <li>{@link org.eclipse.emf.cdo.eresource.impl.CDOResourceImpl#getResourceSet <em>Resource Set</em>}</li>
+ * <li>{@link org.eclipse.emf.cdo.eresource.impl.CDOResourceImpl#getURI <em>URI</em>}</li>
+ * <li>{@link org.eclipse.emf.cdo.eresource.impl.CDOResourceImpl#getContents <em>Contents</em>}</li>
+ * <li>{@link org.eclipse.emf.cdo.eresource.impl.CDOResourceImpl#isModified <em>Modified</em>}</li>
+ * <li>{@link org.eclipse.emf.cdo.eresource.impl.CDOResourceImpl#isLoaded <em>Loaded</em>}</li>
+ * <li>{@link org.eclipse.emf.cdo.eresource.impl.CDOResourceImpl#isTrackingModification <em>Tracking
+ * Modification</em>}</li>
+ * <li>{@link org.eclipse.emf.cdo.eresource.impl.CDOResourceImpl#getErrors <em>Errors</em>}</li>
+ * <li>{@link org.eclipse.emf.cdo.eresource.impl.CDOResourceImpl#getWarnings <em>Warnings</em>}</li>
+ * <li>{@link org.eclipse.emf.cdo.eresource.impl.CDOResourceImpl#getTimeStamp <em>Time Stamp</em>}</li>
+ * </ul>
+ * </p>
* @generated
*/
-public class CDOResourceImpl extends CDOObjectImpl implements CDOResource
+public class CDOResourceImpl extends CDOResourceNodeImpl implements CDOResource, Resource.Internal
{
/**
+ * The default URI converter when there is no resource set.
+ *
+ * @ADDED
+ */
+ private static URIConverter defaultURIConverter;
+
+ /**
+ * @ADDED
+ */
+ private boolean root;
+
+ /**
+ * @ADDED
+ */
+ private URI initialURI;
+
+ /**
* @ADDED
*/
private boolean existing;
/**
+ * @ADDED
+ */
+ private boolean loading;
+
+ /**
+ * @ADDED
+ */
+ private boolean loaded;
+
+ /**
+ * @ADDED
+ */
+ private EList<Diagnostic> errors;
+
+ /**
+ * @ADDED
+ */
+ private EList<Diagnostic> warnings;
+
+ /**
+ * @ADDED
+ * @since 2.0
+ */
+ public CDOResourceImpl(URI initialURI)
+ {
+ this.initialURI = initialURI;
+ }
+
+ /**
* <!-- begin-user-doc --> <!-- end-user-doc -->
*
* @generated
@@ -104,14 +153,16 @@ public class CDOResourceImpl extends CDOObjectImpl implements CDOResource
}
/**
- * <!-- begin-user-doc --> <!-- end-user-doc -->
- *
- * @generated
+ * @since 2.0
*/
- @Override
- protected int eStaticFeatureCount()
+ public boolean isRoot()
{
- return 0;
+ return root;
+ }
+
+ void setRoot(boolean root)
+ {
+ this.root = root;
}
/**
@@ -135,11 +186,12 @@ public class CDOResourceImpl extends CDOObjectImpl implements CDOResource
}
/**
- * <!-- begin-user-doc --> <!-- end-user-doc -->
+ * <!-- begin-user-doc -->
*
+ * @since 2.0 <!-- end-user-doc -->
* @generated
*/
- public URI getURI()
+ public URI getURIGen()
{
return (URI)eGet(EresourcePackage.Literals.CDO_RESOURCE__URI, true);
}
@@ -149,10 +201,36 @@ public class CDOResourceImpl extends CDOObjectImpl implements CDOResource
*
* @generated NOT
*/
- public void setURI(URI newURI)
+ public URI getURI()
+ {
+ if (cdoID() == null && initialURI != null)
+ {
+ return initialURI;
+ }
+
+ return CDOURIUtil.createResourceURI(cdoView(), getPath());
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ *
+ * @since 2.0 <!-- end-user-doc -->
+ * @generated
+ */
+ public void setURIGen(URI newURI)
{
eSet(EresourcePackage.Literals.CDO_RESOURCE__URI, newURI);
- basicSetPath(CDOURIUtil.extractResourcePath(newURI));
+ }
+
+ /**
+ * <!-- begin-user-doc --> <!-- end-user-doc -->
+ *
+ * @generated NOT
+ */
+ public void setURI(URI newURI)
+ {
+ String newPath = CDOURIUtil.extractResourcePath(newURI);
+ setPath(newPath);
}
/**
@@ -216,21 +294,45 @@ public class CDOResourceImpl extends CDOObjectImpl implements CDOResource
/**
* <!-- begin-user-doc --> <!-- end-user-doc -->
*
- * @generated
+ * @generated NOT
*/
public boolean isLoaded()
{
- return ((Boolean)eGet(EresourcePackage.Literals.CDO_RESOURCE__LOADED, true)).booleanValue();
+ return loaded;
}
/**
- * <!-- begin-user-doc --> <!-- end-user-doc -->
- *
- * @generated
+ * @see ResourceImpl#setLoaded(boolean)
+ * @ADDED
*/
- public void setLoaded(boolean newLoaded)
+ private Notification setLoaded(boolean isLoaded)
{
- eSet(EresourcePackage.Literals.CDO_RESOURCE__LOADED, new Boolean(newLoaded));
+ boolean oldIsLoaded = loaded;
+ loaded = isLoaded;
+
+ if (eNotificationRequired())
+ {
+ Notification notification = new NotificationImpl(Notification.SET, oldIsLoaded, isLoaded)
+ {
+ @Override
+ public Object getNotifier()
+ {
+ return CDOResourceImpl.this;
+ }
+
+ @Override
+ public int getFeatureID(Class<?> expectedClass)
+ {
+ return EresourcePackage.CDO_RESOURCE__LOADED;
+ }
+ };
+
+ return notification;
+ }
+ else
+ {
+ return null;
+ }
}
/**
@@ -256,23 +358,73 @@ public class CDOResourceImpl extends CDOObjectImpl implements CDOResource
/**
* <!-- begin-user-doc --> <!-- end-user-doc -->
*
- * @generated
+ * @generated NOT
*/
- @SuppressWarnings("unchecked")
public EList<Diagnostic> getErrors()
{
- return (EList<Diagnostic>)eGet(EresourcePackage.Literals.CDO_RESOURCE__ERRORS, true);
+ if (errors == null)
+ {
+ errors = new NotifyingListImpl<Diagnostic>()
+ {
+ private static final long serialVersionUID = 1L;
+
+ @Override
+ protected boolean isNotificationRequired()
+ {
+ return CDOResourceImpl.this.eNotificationRequired();
+ }
+
+ @Override
+ public Object getNotifier()
+ {
+ return CDOResourceImpl.this;
+ }
+
+ @Override
+ public int getFeatureID()
+ {
+ return EresourcePackage.CDO_RESOURCE__ERRORS;
+ }
+ };
+ }
+
+ return errors;
}
/**
* <!-- begin-user-doc --> <!-- end-user-doc -->
*
- * @generated
+ * @generated NOT
*/
- @SuppressWarnings("unchecked")
public EList<Diagnostic> getWarnings()
{
- return (EList<Diagnostic>)eGet(EresourcePackage.Literals.CDO_RESOURCE__WARNINGS, true);
+ if (warnings == null)
+ {
+ warnings = new NotifyingListImpl<Diagnostic>()
+ {
+ private static final long serialVersionUID = 1L;
+
+ @Override
+ protected boolean isNotificationRequired()
+ {
+ return CDOResourceImpl.this.eNotificationRequired();
+ }
+
+ @Override
+ public Object getNotifier()
+ {
+ return CDOResourceImpl.this;
+ }
+
+ @Override
+ public int getFeatureID()
+ {
+ return EresourcePackage.CDO_RESOURCE__WARNINGS;
+ }
+ };
+ }
+
+ return warnings;
}
/**
@@ -296,26 +448,6 @@ public class CDOResourceImpl extends CDOObjectImpl implements CDOResource
}
/**
- * <!-- begin-user-doc --> <!-- end-user-doc -->
- *
- * @generated
- */
- public String getPath()
- {
- return (String)eGet(EresourcePackage.Literals.CDO_RESOURCE__PATH, true);
- }
-
- /**
- * <!-- begin-user-doc --> <!-- end-user-doc -->
- *
- * @generated NOT
- */
- public void setPath(String newPath)
- {
- setURI(CDOURIUtil.createResourceURI(cdoView(), newPath));
- }
-
- /**
* @ADDED
* @see ResourceImpl#getAllContents()
*/
@@ -393,7 +525,16 @@ public class CDOResourceImpl extends CDOObjectImpl implements CDOResource
*/
public void load(InputStream inputStream, Map<?, ?> options) throws IOException
{
- // Do nothing
+ throw new UnsupportedOperationException();
+ // if (inputStream instanceof CDOResourceInputStream)
+ // {
+ // CDOResourceInputStream stream = (CDOResourceInputStream)inputStream;
+ // URI uri = stream.getURI();
+ // }
+ // else
+ // {
+ // throw new IOException("Stream not supported: " + inputStream);
+ // }
}
/**
@@ -401,7 +542,109 @@ public class CDOResourceImpl extends CDOObjectImpl implements CDOResource
*/
public void load(Map<?, ?> options) throws IOException
{
- // Do nothing
+ if (!isLoaded())
+ {
+ CDOViewImpl view = cdoView();
+ if (!FSMUtil.isTransient(this))
+ {
+ CDOID id = cdoID();
+ if (id == null || id != null && !view.isObjectRegistered(id))
+ {
+ try
+ {
+ view.registerProxyResource(this);
+ }
+ catch (Exception ex)
+ {
+ setExisting(false);
+ cdoInternalSetState(CDOState.TRANSIENT);
+ throw new IOWrappedException(ex);
+ }
+ }
+ }
+
+ setLoaded(true);
+
+ // URIConverter uriConverter = getURIConverter();
+ //
+ // // If an input stream can't be created, ensure that the resource is still considered loaded after the failure,
+ // // and do all the same processing we'd do if we actually were able to create a valid input stream.
+ // //
+ // InputStream inputStream = null;
+ //
+ // try
+ // {
+ // inputStream = uriConverter.createInputStream(getURI(), options);
+ // }
+ // catch (IOException exception)
+ // {
+ // Notification notification = setLoaded(true);
+ // loading = true;
+ // if (errors != null)
+ // {
+ // errors.clear();
+ // }
+ //
+ // if (warnings != null)
+ // {
+ // warnings.clear();
+ // }
+ //
+ // loading = false;
+ // if (notification != null)
+ // {
+ // eNotify(notification);
+ // }
+ //
+ // setModified(false);
+ // throw exception;
+ // }
+ //
+ // try
+ // {
+ // load(inputStream, options);
+ // }
+ // finally
+ // {
+ // inputStream.close();
+ // // TODO Handle timeStamp
+ // // Long timeStamp = (Long)response.get(URIConverter.RESPONSE_TIME_STAMP_PROPERTY);
+ // // if (timeStamp != null)
+ // // {
+ // // setTimeStamp(timeStamp);
+ // // }
+ // }
+ }
+ }
+
+ /**
+ * Returns the URI converter. This typically gets the {@link ResourceSet#getURIConverter converter} from the
+ * {@link #getResourceSet containing} resource set, but it calls {@link #getDefaultURIConverter} when there is no
+ * containing resource set.
+ *
+ * @return the URI converter.
+ * @ADDED
+ */
+ private URIConverter getURIConverter()
+ {
+ return getResourceSet() == null ? getDefaultURIConverter() : getResourceSet().getURIConverter();
+ }
+
+ /**
+ * Returns the default URI converter that's used when there is no resource set.
+ *
+ * @return the default URI converter.
+ * @see #getURIConverter
+ * @ADDED
+ */
+ private static synchronized URIConverter getDefaultURIConverter()
+ {
+ if (defaultURIConverter == null)
+ {
+ defaultURIConverter = new ExtensibleURIConverterImpl();
+ }
+
+ return defaultURIConverter;
}
/**
@@ -417,7 +660,7 @@ public class CDOResourceImpl extends CDOObjectImpl implements CDOResource
}
else
{
- throw new IOException("CDO view is read only: " + view);
+ throw new IOException("CDO view is read-only: " + view);
}
}
@@ -442,15 +685,45 @@ public class CDOResourceImpl extends CDOObjectImpl implements CDOResource
*/
public void delete(Map<?, ?> defaultDeleteOptions) throws IOException
{
- ResourceSet resourceSet = getResourceSet();
- if (resourceSet != null)
+ if (FSMUtil.isTransient(this))
{
- resourceSet.getResources().remove(this);
+ removeFromResourceSet();
}
+ else
+ {
+ if (isRoot())
+ {
+ throw new UnsupportedOperationException();
+ }
- if (!FSMUtil.isTransient(this))
+ if (getFolder() == null)
+ {
+ CDOViewImpl view = cdoView();
+ view.getRootResource().getContents().remove(this);
+ }
+ else
+ {
+ basicSetFolder(null, false);
+ }
+ }
+ }
+
+ /**
+ * @since 2.0
+ */
+ @Override
+ public void cdoInternalPostDetach()
+ {
+ super.cdoInternalPostDetach();
+ removeFromResourceSet();
+ }
+
+ private void removeFromResourceSet()
+ {
+ ResourceSet resourceSet = getResourceSet();
+ if (resourceSet != null)
{
- cdoView().toTransaction().detach(this);
+ resourceSet.getResources().remove(this);
}
}
@@ -530,8 +803,7 @@ public class CDOResourceImpl extends CDOObjectImpl implements CDOResource
*/
public boolean isLoading()
{
- // TODO Implement method CDOResourceImpl.isLoading()
- throw new UnsupportedOperationException("Not yet implemented");
+ return loading;
}
/**
@@ -565,14 +837,6 @@ public class CDOResourceImpl extends CDOObjectImpl implements CDOResource
}
/**
- * @ADDED
- */
- private void basicSetPath(String newPath)
- {
- eSet(EresourcePackage.Literals.CDO_RESOURCE__PATH, newPath);
- }
-
- /**
* {@link ResourceImpl.ContentsEList}!!! --> Bugzilla!
*
* @ADDED
@@ -635,14 +899,14 @@ public class CDOResourceImpl extends CDOObjectImpl implements CDOResource
}
/**
- * TODO Change superclass to NotifyingInternalEListImpl when EMF 2.3 is out of maintenance TODO Reuse
- * {@link ResourceImpl.ContentsEList}!!! --> Bugzilla!
+ * TODO Change superclass to NotifyingInternalEListImpl when EMF 2.3 is out of maintenance
+ * <p>
+ * TODO Reuse {@link ResourceImpl.ContentsEList}!!! --> Bugzilla!
*
* @ADDED
* @author Eike Stepper
*/
- protected class TransientContents<E extends Object & EObject> extends NotifyingListImpl<E> implements
- InternalEList<E>
+ protected class TransientContents<E extends Object & EObject> extends NotifyingInternalEListImpl<E>
{
private static final long serialVersionUID = 1L;
@@ -737,66 +1001,6 @@ public class CDOResourceImpl extends CDOObjectImpl implements CDOResource
return eObject.eSetResource(null, notifications);
}
- public boolean basicContains(Object object)
- {
- return super.contains(object);
- }
-
- public boolean basicContainsAll(Collection<?> collection)
- {
- return super.containsAll(collection);
- }
-
- public int basicIndexOf(Object object)
- {
- return super.indexOf(object);
- }
-
- public int basicLastIndexOf(Object object)
- {
- return super.lastIndexOf(object);
- }
-
- public Object[] basicToArray()
- {
- return super.toArray();
- }
-
- public <T> T[] basicToArray(T[] array)
- {
- return super.toArray(array);
- }
-
- @Override
- public Iterator<E> basicIterator()
- {
- return super.basicIterator();
- }
-
- @Override
- public ListIterator<E> basicListIterator()
- {
- return super.basicListIterator();
- }
-
- @Override
- public ListIterator<E> basicListIterator(int index)
- {
- return super.basicListIterator(index);
- }
-
- @Override
- public List<E> basicList()
- {
- return super.basicList();
- }
-
- @Override
- protected Object[] newData(int capacity)
- {
- return new EObject[capacity];
- }
-
@Override
protected void didAdd(int index, E object)
{
@@ -821,8 +1025,29 @@ public class CDOResourceImpl extends CDOObjectImpl implements CDOResource
@Override
protected void didClear(int oldSize, Object[] oldData)
{
- super.didClear(oldSize, oldData);
- // modified();
+ if (oldSize == 0)
+ {
+ loaded();
+ }
+ else
+ {
+ super.didClear(oldSize, oldData);
+ }
+ }
+
+ /**
+ * @since 2.0
+ */
+ protected void loaded()
+ {
+ if (!isLoaded())
+ {
+ Notification notification = setLoaded(true);
+ if (notification != null)
+ {
+ eNotify(notification);
+ }
+ }
}
protected void modified()
diff --git a/plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/cdo/eresource/impl/CDOResourceNodeImpl.java b/plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/cdo/eresource/impl/CDOResourceNodeImpl.java
new file mode 100644
index 0000000000..f53383a84f
--- /dev/null
+++ b/plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/cdo/eresource/impl/CDOResourceNodeImpl.java
@@ -0,0 +1,266 @@
+/**
+ * <copyright>
+ * </copyright>
+ *
+ * $Id: CDOResourceNodeImpl.java,v 1.2 2008-10-19 01:28:53 smcduff Exp $
+ */
+package org.eclipse.emf.cdo.eresource.impl;
+
+import org.eclipse.emf.cdo.common.util.CDOException;
+import org.eclipse.emf.cdo.eresource.CDOResourceFolder;
+import org.eclipse.emf.cdo.eresource.CDOResourceNode;
+import org.eclipse.emf.cdo.eresource.EresourcePackage;
+import org.eclipse.emf.cdo.util.CDOURIUtil;
+
+import org.eclipse.emf.internal.cdo.CDOObjectImpl;
+import org.eclipse.emf.internal.cdo.CDOTransactionImpl;
+
+import org.eclipse.net4j.util.ObjectUtil;
+
+import org.eclipse.emf.ecore.EClass;
+
+import java.util.List;
+
+/**
+ * <!-- begin-user-doc --> An implementation of the model object '<em><b>CDO Resource Node</b></em>'. <!-- end-user-doc
+ * -->
+ * <p>
+ * The following features are implemented:
+ * <ul>
+ * <li>{@link org.eclipse.emf.cdo.eresource.impl.CDOResourceNodeImpl#getFolder <em>Folder</em>}</li>
+ * <li>{@link org.eclipse.emf.cdo.eresource.impl.CDOResourceNodeImpl#getName <em>Name</em>}</li>
+ * <li>{@link org.eclipse.emf.cdo.eresource.impl.CDOResourceNodeImpl#getPath <em>Path</em>}</li>
+ * </ul>
+ * </p>
+ *
+ * @generated
+ * @since 2.0
+ */
+public abstract class CDOResourceNodeImpl extends CDOObjectImpl implements CDOResourceNode
+{
+ /**
+ * <!-- begin-user-doc --> <!-- end-user-doc -->
+ *
+ * @generated
+ */
+ protected CDOResourceNodeImpl()
+ {
+ super();
+ }
+
+ /**
+ * <!-- begin-user-doc --> <!-- end-user-doc -->
+ *
+ * @generated
+ */
+ @Override
+ protected EClass eStaticClass()
+ {
+ return EresourcePackage.Literals.CDO_RESOURCE_NODE;
+ }
+
+ /**
+ * <!-- begin-user-doc --> <!-- end-user-doc -->
+ *
+ * @generated
+ */
+ @Override
+ protected int eStaticFeatureCount()
+ {
+ return 0;
+ }
+
+ /**
+ * <!-- begin-user-doc --> <!-- end-user-doc -->
+ *
+ * @generated
+ */
+ public CDOResourceFolder getFolder()
+ {
+ return (CDOResourceFolder)eGet(EresourcePackage.Literals.CDO_RESOURCE_NODE__FOLDER, true);
+ }
+
+ /**
+ * <!-- begin-user-doc --> <!-- end-user-doc -->
+ *
+ * @generated
+ */
+ public void setFolderGen(CDOResourceFolder newFolder)
+ {
+ eSet(EresourcePackage.Literals.CDO_RESOURCE_NODE__FOLDER, newFolder);
+ }
+
+ /**
+ * <!-- begin-user-doc --> <!-- end-user-doc -->
+ *
+ * @generated NOT
+ */
+ public void setFolder(CDOResourceFolder newFolder)
+ {
+ String oldPath = getPath();
+ basicSetFolder(newFolder, true);
+ adjustContainedResources(oldPath);
+ }
+
+ /**
+ * @ADDED
+ */
+ public void basicSetFolder(CDOResourceFolder newFolder, boolean checkDuplicates)
+ {
+ CDOResourceFolder oldFolder = getFolder();
+ if (!ObjectUtil.equals(oldFolder, newFolder))
+ {
+ if (checkDuplicates)
+ {
+ String newPath = (newFolder == null ? "" : newFolder.getPath()) + CDOURIUtil.SEGMENT_SEPARATOR + getName();
+ checkDuplicates(newPath);
+ }
+
+ setFolderGen(newFolder);
+ }
+ }
+
+ /**
+ * <!-- begin-user-doc --> <!-- end-user-doc -->
+ *
+ * @generated
+ */
+ public String getName()
+ {
+ return (String)eGet(EresourcePackage.Literals.CDO_RESOURCE_NODE__NAME, true);
+ }
+
+ /**
+ * <!-- begin-user-doc --> <!-- end-user-doc -->
+ *
+ * @generated
+ */
+ public void setNameGen(String newName)
+ {
+ eSet(EresourcePackage.Literals.CDO_RESOURCE_NODE__NAME, newName);
+ }
+
+ /**
+ * <!-- begin-user-doc --> <!-- end-user-doc -->
+ *
+ * @generated NOT
+ */
+ public void setName(String newName)
+ {
+ String oldPath = getPath();
+ basicSetName(newName, true);
+ adjustContainedResources(oldPath);
+ }
+
+ /**
+ * @ADDED
+ */
+ public void basicSetName(String newName, boolean checkDuplicates)
+ {
+ String oldName = getName();
+ if (!ObjectUtil.equals(oldName, newName))
+ {
+ if (checkDuplicates)
+ {
+ CDOResourceFolder parent = getFolder();
+ String newPath = (parent == null ? "" : parent.getPath()) + CDOURIUtil.SEGMENT_SEPARATOR + getName();
+ checkDuplicates(newPath);
+ }
+
+ setNameGen(newName);
+ }
+ }
+
+ /**
+ * <!-- begin-user-doc --> <!-- end-user-doc -->
+ *
+ * @generated NOT
+ */
+ public String getPath()
+ {
+ CDOResourceFolder folder = getFolder();
+ if (folder == null)
+ {
+ return "/" + getName();
+ }
+
+ return folder.getPath() + "/" + getName();
+ }
+
+ /**
+ * <!-- begin-user-doc --> <!-- end-user-doc -->
+ *
+ * @generated NOT
+ */
+ public void setPath(String newPath)
+ {
+ CDOTransactionImpl transaction = cdoView().toTransaction();
+ if (newPath == null)
+ {
+ throw new CDOException("Null path is not allowed");
+ }
+
+ String oldPath = getPath();
+ if (!ObjectUtil.equals(oldPath, newPath))
+ {
+ // TODO check for duplicates
+ List<String> names = CDOURIUtil.analyzePath(newPath);
+ if (names.isEmpty())
+ {
+ throw new CDOException("Root path is not allowed");
+ }
+
+ String newName = names.remove(names.size() - 1);
+ CDOResourceFolder newFolder = transaction.getOrCreateResourceFolder(names);
+ if (newFolder == null)
+ {
+ transaction.getRootResource().getContents().add(this);
+ }
+
+ basicSetFolder(newFolder, false);
+ basicSetName(newName, false);
+ adjustContainedResources(oldPath);
+ }
+ }
+
+ /**
+ * @ADDED
+ */
+ private void adjustContainedResources(String oldPath)
+ {
+ // ResourceSet resourceSet = cdoView().getViewSet().getResourceSet();
+ // EList<Resource> resources = resourceSet.getResources();
+ // for (Resource resource : resources.toArray(new Resource[resources.size()]))
+ // {
+ // if (resource instanceof CDOResource)
+ // {
+ // CDOResource cdoResource = (CDOResource)resource;
+ // String path = cdoResource.getPath();
+ // // if (ObjectUtil.equals(path, oldPath))
+ // // {
+ // // // Don't handle *this* node
+ // // continue;
+ // // }
+ //
+ // if (path.startsWith(oldPath))
+ // {
+ // }
+ // }
+ // }
+ }
+
+ /**
+ * @ADDED
+ */
+ private void checkDuplicates(String newPath)
+ {
+ try
+ {
+ cdoView().getResourceID(newPath);
+ }
+ catch (Exception ex)
+ {
+ throw new CDOException("Duplicate path: " + newPath);
+ }
+ }
+} // CDOResourceNodeImpl
diff --git a/plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/cdo/eresource/impl/EresourceFactoryImpl.java b/plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/cdo/eresource/impl/EresourceFactoryImpl.java
index e36d510f4c..d3da182ed1 100644
--- a/plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/cdo/eresource/impl/EresourceFactoryImpl.java
+++ b/plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/cdo/eresource/impl/EresourceFactoryImpl.java
@@ -11,6 +11,7 @@
package org.eclipse.emf.cdo.eresource.impl;
import org.eclipse.emf.cdo.eresource.CDOResource;
+import org.eclipse.emf.cdo.eresource.CDOResourceFolder;
import org.eclipse.emf.cdo.eresource.EresourceFactory;
import org.eclipse.emf.cdo.eresource.EresourcePackage;
@@ -39,7 +40,7 @@ public class EresourceFactoryImpl extends EFactoryImpl implements EresourceFacto
try
{
EresourceFactory theEresourceFactory = (EresourceFactory)EPackage.Registry.INSTANCE
- .getEFactory("http://www.eclipse.org/emf/CDO/resource/1.0.0");
+ .getEFactory("http://www.eclipse.org/emf/CDO/resource/2.0.0");
if (theEresourceFactory != null)
{
return theEresourceFactory;
@@ -65,13 +66,15 @@ public class EresourceFactoryImpl extends EFactoryImpl implements EresourceFacto
/**
* <!-- begin-user-doc --> <!-- end-user-doc -->
*
- * @generated NOT
+ * @generated
*/
@Override
public EObject create(EClass eClass)
{
switch (eClass.getClassifierID())
{
+ case EresourcePackage.CDO_RESOURCE_FOLDER:
+ return createCDOResourceFolder();
case EresourcePackage.CDO_RESOURCE:
return createCDOResource();
default:
@@ -114,6 +117,18 @@ public class EresourceFactoryImpl extends EFactoryImpl implements EresourceFacto
}
/**
+ * <!-- begin-user-doc -->
+ *
+ * @since 2.0 <!-- end-user-doc -->
+ * @generated
+ */
+ public CDOResourceFolder createCDOResourceFolder()
+ {
+ CDOResourceFolderImpl cdoResourceFolder = new CDOResourceFolderImpl();
+ return cdoResourceFolder;
+ }
+
+ /**
* <!-- begin-user-doc --> <!-- end-user-doc -->
*
* @generated
diff --git a/plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/cdo/eresource/impl/EresourcePackageImpl.java b/plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/cdo/eresource/impl/EresourcePackageImpl.java
index 9f94999836..f782442c0e 100644
--- a/plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/cdo/eresource/impl/EresourcePackageImpl.java
+++ b/plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/cdo/eresource/impl/EresourcePackageImpl.java
@@ -11,6 +11,8 @@
package org.eclipse.emf.cdo.eresource.impl;
import org.eclipse.emf.cdo.eresource.CDOResource;
+import org.eclipse.emf.cdo.eresource.CDOResourceFolder;
+import org.eclipse.emf.cdo.eresource.CDOResourceNode;
import org.eclipse.emf.cdo.eresource.EresourceFactory;
import org.eclipse.emf.cdo.eresource.EresourcePackage;
@@ -36,6 +38,20 @@ public class EresourcePackageImpl extends EPackageImpl implements EresourcePacka
*
* @generated
*/
+ private EClass cdoResourceNodeEClass = null;
+
+ /**
+ * <!-- begin-user-doc --> <!-- end-user-doc -->
+ *
+ * @generated
+ */
+ private EClass cdoResourceFolderEClass = null;
+
+ /**
+ * <!-- begin-user-doc --> <!-- end-user-doc -->
+ *
+ * @generated
+ */
private EClass cdoResourceEClass = null;
/**
@@ -132,6 +148,72 @@ public class EresourcePackageImpl extends EPackageImpl implements EresourcePacka
}
/**
+ * <!-- begin-user-doc -->
+ *
+ * @since 2.0<!-- end-user-doc -->
+ * @generated
+ */
+ public EClass getCDOResourceNode()
+ {
+ return cdoResourceNodeEClass;
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ *
+ * @since 2.0<!-- end-user-doc -->
+ * @generated
+ */
+ public EReference getCDOResourceNode_Folder()
+ {
+ return (EReference)cdoResourceNodeEClass.getEStructuralFeatures().get(0);
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ *
+ * @since 2.0<!-- end-user-doc -->
+ * @generated
+ */
+ public EAttribute getCDOResourceNode_Name()
+ {
+ return (EAttribute)cdoResourceNodeEClass.getEStructuralFeatures().get(1);
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ *
+ * @since 2.0<!-- end-user-doc -->
+ * @generated
+ */
+ public EAttribute getCDOResourceNode_Path()
+ {
+ return (EAttribute)cdoResourceNodeEClass.getEStructuralFeatures().get(2);
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ *
+ * @since 2.0<!-- end-user-doc -->
+ * @generated
+ */
+ public EClass getCDOResourceFolder()
+ {
+ return cdoResourceFolderEClass;
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ *
+ * @since 2.0<!-- end-user-doc -->
+ * @generated
+ */
+ public EReference getCDOResourceFolder_Nodes()
+ {
+ return (EReference)cdoResourceFolderEClass.getEStructuralFeatures().get(0);
+ }
+
+ /**
* <!-- begin-user-doc --> <!-- end-user-doc -->
*
* @generated
@@ -236,16 +318,6 @@ public class EresourcePackageImpl extends EPackageImpl implements EresourcePacka
*
* @generated
*/
- public EAttribute getCDOResource_Path()
- {
- return (EAttribute)cdoResourceEClass.getEStructuralFeatures().get(9);
- }
-
- /**
- * <!-- begin-user-doc --> <!-- end-user-doc -->
- *
- * @generated
- */
public EDataType getResourceSet()
{
return resourceSetEDataType;
@@ -303,6 +375,14 @@ public class EresourcePackageImpl extends EPackageImpl implements EresourcePacka
isCreated = true;
// Create classes and their features
+ cdoResourceNodeEClass = createEClass(CDO_RESOURCE_NODE);
+ createEReference(cdoResourceNodeEClass, CDO_RESOURCE_NODE__FOLDER);
+ createEAttribute(cdoResourceNodeEClass, CDO_RESOURCE_NODE__NAME);
+ createEAttribute(cdoResourceNodeEClass, CDO_RESOURCE_NODE__PATH);
+
+ cdoResourceFolderEClass = createEClass(CDO_RESOURCE_FOLDER);
+ createEReference(cdoResourceFolderEClass, CDO_RESOURCE_FOLDER__NODES);
+
cdoResourceEClass = createEClass(CDO_RESOURCE);
createEAttribute(cdoResourceEClass, CDO_RESOURCE__RESOURCE_SET);
createEAttribute(cdoResourceEClass, CDO_RESOURCE__URI);
@@ -313,7 +393,6 @@ public class EresourcePackageImpl extends EPackageImpl implements EresourcePacka
createEAttribute(cdoResourceEClass, CDO_RESOURCE__ERRORS);
createEAttribute(cdoResourceEClass, CDO_RESOURCE__WARNINGS);
createEAttribute(cdoResourceEClass, CDO_RESOURCE__TIME_STAMP);
- createEAttribute(cdoResourceEClass, CDO_RESOURCE__PATH);
// Create data types
resourceSetEDataType = createEDataType(RESOURCE_SET);
@@ -355,32 +434,48 @@ public class EresourcePackageImpl extends EPackageImpl implements EresourcePacka
// Set bounds for type parameters
// Add supertypes to classes
+ cdoResourceFolderEClass.getESuperTypes().add(getCDOResourceNode());
+ cdoResourceEClass.getESuperTypes().add(getCDOResourceNode());
// Initialize classes and features; add operations and parameters
+ initEClass(cdoResourceNodeEClass, CDOResourceNode.class, "CDOResourceNode", IS_ABSTRACT, !IS_INTERFACE,
+ IS_GENERATED_INSTANCE_CLASS);
+ initEReference(getCDOResourceNode_Folder(), getCDOResourceFolder(), getCDOResourceFolder_Nodes(), "folder", null,
+ 0, 1, CDOResourceNode.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, !IS_COMPOSITE, !IS_RESOLVE_PROXIES,
+ !IS_UNSETTABLE, IS_UNIQUE, !IS_DERIVED, IS_ORDERED);
+ initEAttribute(getCDOResourceNode_Name(), ecorePackage.getEString(), "name", null, 0, 1, CDOResourceNode.class,
+ !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, !IS_UNSETTABLE, !IS_ID, IS_UNIQUE, !IS_DERIVED, IS_ORDERED);
+ initEAttribute(getCDOResourceNode_Path(), ecorePackage.getEString(), "path", null, 0, 1, CDOResourceNode.class,
+ IS_TRANSIENT, IS_VOLATILE, IS_CHANGEABLE, !IS_UNSETTABLE, !IS_ID, IS_UNIQUE, IS_DERIVED, IS_ORDERED);
+
+ initEClass(cdoResourceFolderEClass, CDOResourceFolder.class, "CDOResourceFolder", !IS_ABSTRACT, !IS_INTERFACE,
+ IS_GENERATED_INSTANCE_CLASS);
+ initEReference(getCDOResourceFolder_Nodes(), getCDOResourceNode(), getCDOResourceNode_Folder(), "nodes", null, 0,
+ -1, CDOResourceFolder.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, IS_COMPOSITE, !IS_RESOLVE_PROXIES,
+ !IS_UNSETTABLE, IS_UNIQUE, !IS_DERIVED, IS_ORDERED);
+
initEClass(cdoResourceEClass, CDOResource.class, "CDOResource", !IS_ABSTRACT, !IS_INTERFACE,
IS_GENERATED_INSTANCE_CLASS);
initEAttribute(getCDOResource_ResourceSet(), getResourceSet(), "resourceSet", null, 0, 1, CDOResource.class,
IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, !IS_UNSETTABLE, !IS_ID, IS_UNIQUE, !IS_DERIVED, IS_ORDERED);
- initEAttribute(getCDOResource_URI(), getURI(), "uRI", null, 0, 1, CDOResource.class, IS_TRANSIENT, !IS_VOLATILE,
- IS_CHANGEABLE, !IS_UNSETTABLE, !IS_ID, IS_UNIQUE, !IS_DERIVED, IS_ORDERED);
+ initEAttribute(getCDOResource_URI(), getURI(), "uRI", null, 0, 1, CDOResource.class, IS_TRANSIENT, IS_VOLATILE,
+ IS_CHANGEABLE, !IS_UNSETTABLE, !IS_ID, IS_UNIQUE, IS_DERIVED, IS_ORDERED);
initEReference(getCDOResource_Contents(), theEcorePackage.getEObject(), null, "contents", null, 0, -1,
CDOResource.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, IS_COMPOSITE, !IS_RESOLVE_PROXIES,
!IS_UNSETTABLE, IS_UNIQUE, !IS_DERIVED, IS_ORDERED);
initEAttribute(getCDOResource_Modified(), ecorePackage.getEBoolean(), "modified", null, 0, 1, CDOResource.class,
IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, !IS_UNSETTABLE, !IS_ID, IS_UNIQUE, !IS_DERIVED, IS_ORDERED);
initEAttribute(getCDOResource_Loaded(), ecorePackage.getEBoolean(), "loaded", "true", 0, 1, CDOResource.class,
- IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, !IS_UNSETTABLE, !IS_ID, IS_UNIQUE, !IS_DERIVED, IS_ORDERED);
+ IS_TRANSIENT, IS_VOLATILE, !IS_CHANGEABLE, !IS_UNSETTABLE, !IS_ID, IS_UNIQUE, IS_DERIVED, IS_ORDERED);
initEAttribute(getCDOResource_TrackingModification(), ecorePackage.getEBoolean(), "trackingModification", null, 0,
1, CDOResource.class, IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, !IS_UNSETTABLE, !IS_ID, IS_UNIQUE,
!IS_DERIVED, IS_ORDERED);
initEAttribute(getCDOResource_Errors(), getDiagnostic(), "errors", null, 0, -1, CDOResource.class, IS_TRANSIENT,
- !IS_VOLATILE, IS_CHANGEABLE, !IS_UNSETTABLE, !IS_ID, IS_UNIQUE, !IS_DERIVED, IS_ORDERED);
+ IS_VOLATILE, !IS_CHANGEABLE, !IS_UNSETTABLE, !IS_ID, IS_UNIQUE, IS_DERIVED, IS_ORDERED);
initEAttribute(getCDOResource_Warnings(), getDiagnostic(), "warnings", null, 0, -1, CDOResource.class,
- IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, !IS_UNSETTABLE, !IS_ID, IS_UNIQUE, !IS_DERIVED, IS_ORDERED);
+ IS_TRANSIENT, IS_VOLATILE, !IS_CHANGEABLE, !IS_UNSETTABLE, !IS_ID, IS_UNIQUE, IS_DERIVED, IS_ORDERED);
initEAttribute(getCDOResource_TimeStamp(), theEcorePackage.getELong(), "timeStamp", null, 0, 1, CDOResource.class,
IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, !IS_UNSETTABLE, !IS_ID, IS_UNIQUE, !IS_DERIVED, IS_ORDERED);
- initEAttribute(getCDOResource_Path(), ecorePackage.getEString(), "path", null, 0, 1, CDOResource.class,
- !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, !IS_UNSETTABLE, !IS_ID, IS_UNIQUE, !IS_DERIVED, IS_ORDERED);
// Initialize data types
initEDataType(resourceSetEDataType, ResourceSet.class, "ResourceSet", !IS_SERIALIZABLE,
diff --git a/plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/cdo/eresource/util/EresourceAdapterFactory.java b/plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/cdo/eresource/util/EresourceAdapterFactory.java
index 84265bd643..b682d6a099 100644
--- a/plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/cdo/eresource/util/EresourceAdapterFactory.java
+++ b/plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/cdo/eresource/util/EresourceAdapterFactory.java
@@ -11,6 +11,8 @@
package org.eclipse.emf.cdo.eresource.util;
import org.eclipse.emf.cdo.eresource.CDOResource;
+import org.eclipse.emf.cdo.eresource.CDOResourceFolder;
+import org.eclipse.emf.cdo.eresource.CDOResourceNode;
import org.eclipse.emf.cdo.eresource.EresourcePackage;
import org.eclipse.emf.common.notify.Adapter;
@@ -77,6 +79,18 @@ public class EresourceAdapterFactory extends AdapterFactoryImpl
protected EresourceSwitch<Adapter> modelSwitch = new EresourceSwitch<Adapter>()
{
@Override
+ public Adapter caseCDOResourceNode(CDOResourceNode object)
+ {
+ return createCDOResourceNodeAdapter();
+ }
+
+ @Override
+ public Adapter caseCDOResourceFolder(CDOResourceFolder object)
+ {
+ return createCDOResourceFolderAdapter();
+ }
+
+ @Override
public Adapter caseCDOResource(CDOResource object)
{
return createCDOResourceAdapter();
@@ -104,6 +118,36 @@ public class EresourceAdapterFactory extends AdapterFactoryImpl
}
/**
+ * Creates a new adapter for an object of class '{@link org.eclipse.emf.cdo.eresource.CDOResourceNode
+ * <em>CDO Resource Node</em>}'. <!-- begin-user-doc --> This default implementation returns null so that we can
+ * easily ignore cases; it's useful to ignore a case when inheritance will catch all the cases anyway.
+ *
+ * @since 2.0<!-- end-user-doc -->
+ * @return the new adapter.
+ * @see org.eclipse.emf.cdo.eresource.CDOResourceNode
+ * @generated
+ */
+ public Adapter createCDOResourceNodeAdapter()
+ {
+ return null;
+ }
+
+ /**
+ * Creates a new adapter for an object of class '{@link org.eclipse.emf.cdo.eresource.CDOResourceFolder
+ * <em>CDO Resource Folder</em>}'. <!-- begin-user-doc --> This default implementation returns null so that we can
+ * easily ignore cases; it's useful to ignore a case when inheritance will catch all the cases anyway.
+ *
+ * @since 2.0<!-- end-user-doc -->
+ * @return the new adapter.
+ * @see org.eclipse.emf.cdo.eresource.CDOResourceFolder
+ * @generated
+ */
+ public Adapter createCDOResourceFolderAdapter()
+ {
+ return null;
+ }
+
+ /**
* Creates a new adapter for an object of class '{@link org.eclipse.emf.cdo.eresource.CDOResource
* <em>CDO Resource</em>}'. <!-- begin-user-doc --> This default implementation returns null so that we can easily
* ignore cases; it's useful to ignore a case when inheritance will catch all the cases anyway. <!-- end-user-doc -->
diff --git a/plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/cdo/eresource/util/EresourceSwitch.java b/plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/cdo/eresource/util/EresourceSwitch.java
index 75c3246f12..6075a7f16e 100644
--- a/plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/cdo/eresource/util/EresourceSwitch.java
+++ b/plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/cdo/eresource/util/EresourceSwitch.java
@@ -11,6 +11,8 @@
package org.eclipse.emf.cdo.eresource.util;
import org.eclipse.emf.cdo.eresource.CDOResource;
+import org.eclipse.emf.cdo.eresource.CDOResourceFolder;
+import org.eclipse.emf.cdo.eresource.CDOResourceNode;
import org.eclipse.emf.cdo.eresource.EresourcePackage;
import org.eclipse.emf.ecore.EClass;
@@ -92,12 +94,40 @@ public class EresourceSwitch<T>
{
switch (classifierID)
{
+ case EresourcePackage.CDO_RESOURCE_NODE:
+ {
+ CDOResourceNode cdoResourceNode = (CDOResourceNode)theEObject;
+ T result = caseCDOResourceNode(cdoResourceNode);
+ if (result == null)
+ {
+ result = defaultCase(theEObject);
+ }
+ return result;
+ }
+ case EresourcePackage.CDO_RESOURCE_FOLDER:
+ {
+ CDOResourceFolder cdoResourceFolder = (CDOResourceFolder)theEObject;
+ T result = caseCDOResourceFolder(cdoResourceFolder);
+ if (result == null)
+ {
+ result = caseCDOResourceNode(cdoResourceFolder);
+ }
+ if (result == null)
+ {
+ result = defaultCase(theEObject);
+ }
+ return result;
+ }
case EresourcePackage.CDO_RESOURCE:
{
CDOResource cdoResource = (CDOResource)theEObject;
T result = caseCDOResource(cdoResource);
if (result == null)
{
+ result = caseCDOResourceNode(cdoResource);
+ }
+ if (result == null)
+ {
result = defaultCase(theEObject);
}
return result;
@@ -108,6 +138,38 @@ public class EresourceSwitch<T>
}
/**
+ * Returns the result of interpreting the object as an instance of '<em>CDO Resource Node</em>'. <!-- begin-user-doc
+ * --> This implementation returns null; returning a non-null result will terminate the switch.
+ *
+ * @since 2.0<!-- end-user-doc -->
+ * @param object
+ * the target of the switch.
+ * @return the result of interpreting the object as an instance of '<em>CDO Resource Node</em>'.
+ * @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject)
+ * @generated
+ */
+ public T caseCDOResourceNode(CDOResourceNode object)
+ {
+ return null;
+ }
+
+ /**
+ * Returns the result of interpreting the object as an instance of '<em>CDO Resource Folder</em>'. <!-- begin-user-doc
+ * --> This implementation returns null; returning a non-null result will terminate the switch.
+ *
+ * @since 2.0 <!-- end-user-doc -->
+ * @param object
+ * the target of the switch.
+ * @return the result of interpreting the object as an instance of '<em>CDO Resource Folder</em>'.
+ * @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject)
+ * @generated
+ */
+ public T caseCDOResourceFolder(CDOResourceFolder object)
+ {
+ return null;
+ }
+
+ /**
* Returns the result of interpreting the object as an instance of '<em>CDO Resource</em>'. <!-- begin-user-doc -->
* This implementation returns null; returning a non-null result will terminate the switch. <!-- end-user-doc -->
*
diff --git a/plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/cdo/util/CDOURIUtil.java b/plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/cdo/util/CDOURIUtil.java
index 66aace87bc..04fef03b40 100644
--- a/plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/cdo/util/CDOURIUtil.java
+++ b/plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/cdo/util/CDOURIUtil.java
@@ -7,6 +7,7 @@
*
* Contributors:
* Simon McDuff - initial API and implementation
+ * Eike Stepper - maintenance
**************************************************************************/
package org.eclipse.emf.cdo.util;
@@ -19,49 +20,75 @@ import org.eclipse.emf.cdo.internal.common.id.CDOIDExternalImpl;
import org.eclipse.emf.common.util.URI;
+import java.util.ArrayList;
+import java.util.List;
+import java.util.StringTokenizer;
+
/**
* @author Simon McDuff
* @since 2.0
*/
public class CDOURIUtil
{
- private static final char SEGMENT_SEPARATOR = '/';
+ public static final char SEGMENT_SEPARATOR_CHAR = '/';
+
+ public static final String SEGMENT_SEPARATOR = new String(new char[] { SEGMENT_SEPARATOR_CHAR });
- public static boolean validateURI(URI uri)
+ public static void validateURI(URI uri) throws InvalidURIException
{
if (!CDOProtocolConstants.PROTOCOL_NAME.equals(uri.scheme()))
{
- return false;
+ throw new InvalidURIException(uri);
}
if (!uri.isHierarchical())
{
- return false;
+ throw new InvalidURIException(uri);
}
+ }
+
+ public static String extractRepositoryUUID(URI uri)
+ {
+ try
+ {
+ validateURI(uri);
+ if (!uri.hasAuthority())
+ {
+ throw new InvalidURIException(uri);
+ }
- if (!uri.hasAbsolutePath())
+ return uri.authority();
+ }
+ catch (InvalidURIException ex)
{
- return false;
+ return null;
}
- return true;
}
- public static String extractResourcePath(URI uri)
+ public static String[] extractResourceFolderAndName(URI uri) throws InvalidURIException
{
- if (!validateURI(uri))
+ String path = extractResourcePath(uri);
+ int lastSeparator = path.lastIndexOf(SEGMENT_SEPARATOR_CHAR);
+ if (lastSeparator == -1)
{
- return null;
+ return new String[] { null, path };
}
- return uri.path();
+
+ String folder = path.substring(0, lastSeparator);
+ String name = path.substring(lastSeparator + 1);
+ return new String[] { folder, name };
}
- public static String extractRepositoryUUID(URI uri)
+ public static String extractResourcePath(URI uri) throws InvalidURIException
{
- if (!validateURI(uri) || !uri.hasAuthority())
+ validateURI(uri);
+ String path = uri.path();
+ if (path == null)
{
- return null;
+ return SEGMENT_SEPARATOR;
}
- return uri.authority();
+
+ return path;
}
/**
@@ -86,11 +113,16 @@ public class CDOURIUtil
stringBuilder.append(repositoryUUID);
}
- if (path.charAt(0) != SEGMENT_SEPARATOR)
+ if (!SEGMENT_SEPARATOR.equals(path))
{
- stringBuilder.append(SEGMENT_SEPARATOR);
+ if (path.charAt(0) != SEGMENT_SEPARATOR_CHAR)
+ {
+ stringBuilder.append(SEGMENT_SEPARATOR_CHAR);
+ }
+
+ stringBuilder.append(path);
}
- stringBuilder.append(path);
+
return URI.createURI(stringBuilder.toString());
}
@@ -113,13 +145,32 @@ public class CDOURIUtil
*/
public static CDOID convertExternalCDOID(URI baseURI, CDOID newCDOID)
{
- baseURI = baseURI.trimFragment();
-
StringBuilder builder = new StringBuilder();
-
CDOIDUtil.write(builder, newCDOID);
- baseURI = baseURI.appendFragment(builder.toString());
+ baseURI = baseURI.trimFragment().appendFragment(builder.toString());
return new CDOIDExternalImpl(baseURI.toString());
}
+
+ public static List<String> analyzePath(URI uri)
+ {
+ String path = extractResourcePath(uri);
+ return analyzePath(path);
+ }
+
+ public static List<String> analyzePath(String path)
+ {
+ List<String> segments = new ArrayList<String>();
+ StringTokenizer tokenizer = new StringTokenizer(path, CDOURIUtil.SEGMENT_SEPARATOR);
+ while (tokenizer.hasMoreTokens())
+ {
+ String name = tokenizer.nextToken();
+ if (name != null)
+ {
+ segments.add(name);
+ }
+ }
+
+ return segments;
+ }
}
diff --git a/plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/cdo/util/CDOUtil.java b/plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/cdo/util/CDOUtil.java
index 2811efd78f..e7291133c9 100644
--- a/plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/cdo/util/CDOUtil.java
+++ b/plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/cdo/util/CDOUtil.java
@@ -19,6 +19,7 @@ import org.eclipse.emf.cdo.CDOView;
import org.eclipse.emf.cdo.CDOViewSet;
import org.eclipse.emf.cdo.CDOXATransaction;
import org.eclipse.emf.cdo.common.revision.CDORevision;
+import org.eclipse.emf.cdo.eresource.CDOResource;
import org.eclipse.emf.internal.cdo.CDOCollectionLoadingPolicyImpl;
import org.eclipse.emf.internal.cdo.CDORevisionPrefetchingPolicyImpl;
@@ -34,6 +35,7 @@ import org.eclipse.emf.internal.cdo.util.FSMUtil;
import org.eclipse.net4j.util.container.IManagedContainer;
import org.eclipse.emf.common.notify.Adapter;
+import org.eclipse.emf.common.util.BasicEList;
import org.eclipse.emf.common.util.EList;
import org.eclipse.emf.ecore.EAttribute;
import org.eclipse.emf.ecore.EClass;
@@ -46,6 +48,7 @@ import org.eclipse.emf.ecore.EReference;
import org.eclipse.emf.ecore.EcoreFactory;
import org.eclipse.emf.ecore.InternalEObject;
import org.eclipse.emf.ecore.impl.EStringToStringMapEntryImpl;
+import org.eclipse.emf.ecore.resource.Resource;
import org.eclipse.emf.ecore.resource.ResourceSet;
import java.util.Iterator;
@@ -273,4 +276,28 @@ public final class CDOUtil
{
return FSMUtil.adaptMeta(object, view);
}
+
+ /**
+ * @since 2.0
+ */
+ public static EList<Resource> getResources(ResourceSet resourceSet)
+ {
+ EList<Resource> result = new BasicEList<Resource>();
+ EList<Resource> resources = resourceSet.getResources();
+ for (Resource resource : resources)
+ {
+ if (resource instanceof CDOResource)
+ {
+ CDOResource cdoResource = (CDOResource)resource;
+ if (cdoResource.isRoot())
+ {
+ continue;
+ }
+ }
+
+ result.add(resource);
+ }
+
+ return result;
+ }
}
diff --git a/plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/cdo/eresource/EresourceObject.java b/plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/cdo/util/InvalidURIException.java
index e3f6b2223a..667c880ca2 100644
--- a/plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/cdo/eresource/EresourceObject.java
+++ b/plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/cdo/util/InvalidURIException.java
@@ -8,19 +8,35 @@
* Contributors:
* Eike Stepper - initial API and implementation
**************************************************************************/
-package org.eclipse.emf.cdo.eresource;
+package org.eclipse.emf.cdo.util;
-import org.eclipse.emf.cdo.CDOObject;
+import org.eclipse.emf.cdo.common.util.CDOException;
-import org.eclipse.emf.ecore.resource.Resource;
+import org.eclipse.emf.common.util.URI;
/**
* @author Eike Stepper
+ * @since 2.0
*/
-public interface EresourceObject extends CDOObject, Resource.Internal
+public class InvalidURIException extends CDOException
{
- /**
- * @since 2.0
- */
- public boolean isExisting();
+ private static final long serialVersionUID = 1L;
+
+ private URI uri;
+
+ public InvalidURIException(URI uri, Throwable cause)
+ {
+ super("Invalid URI: " + uri, cause);
+ this.uri = uri;
+ }
+
+ public InvalidURIException(URI uri)
+ {
+ this(uri, null);
+ }
+
+ public URI getURI()
+ {
+ return uri;
+ }
}
diff --git a/plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/internal/cdo/CDOLegacyWrapper.java b/plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/internal/cdo/CDOLegacyWrapper.java
index 195e27004b..483ea8f60e 100644
--- a/plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/internal/cdo/CDOLegacyWrapper.java
+++ b/plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/internal/cdo/CDOLegacyWrapper.java
@@ -20,7 +20,6 @@ import org.eclipse.emf.cdo.common.model.CDOType;
import org.eclipse.emf.cdo.common.revision.CDORevision;
import org.eclipse.emf.cdo.common.revision.delta.CDORevisionDelta;
import org.eclipse.emf.cdo.eresource.CDOResource;
-import org.eclipse.emf.cdo.eresource.impl.CDOResourceImpl;
import org.eclipse.emf.cdo.spi.common.InternalCDORevision;
import org.eclipse.emf.cdo.util.CDOPackageRegistry;
@@ -79,8 +78,6 @@ public final class CDOLegacyWrapper extends CDOObjectWrapper
private CDOState state;
- private CDOResourceImpl resource;
-
private InternalCDORevision revision;
private boolean allProxiesResolved;
@@ -108,11 +105,6 @@ public final class CDOLegacyWrapper extends CDOObjectWrapper
return revision;
}
- public CDOResourceImpl cdoResource()
- {
- return resource;
- }
-
public void cdoReload()
{
CDOStateMachine.INSTANCE.reload(this);
@@ -147,16 +139,6 @@ public final class CDOLegacyWrapper extends CDOObjectWrapper
this.revision = (InternalCDORevision)revision;
}
- public void cdoInternalSetResource(CDOResource resource)
- {
- if (TRACER.isEnabled())
- {
- TRACER.format("Setting resource: {0}", resource);
- }
-
- this.resource = (CDOResourceImpl)resource;
- }
-
public void cdoInternalPostAttach()
{
// TODO Avoid if no adapters in list (eBasicAdapters?)
diff --git a/plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/internal/cdo/CDOMetaWrapper.java b/plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/internal/cdo/CDOMetaWrapper.java
index ac897b88ef..9020dbf1e2 100644
--- a/plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/internal/cdo/CDOMetaWrapper.java
+++ b/plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/internal/cdo/CDOMetaWrapper.java
@@ -14,7 +14,7 @@ import org.eclipse.emf.cdo.CDOState;
import org.eclipse.emf.cdo.common.id.CDOID;
import org.eclipse.emf.cdo.common.model.CDOClass;
import org.eclipse.emf.cdo.common.revision.CDORevision;
-import org.eclipse.emf.cdo.eresource.CDOResource;
+import org.eclipse.emf.cdo.eresource.impl.CDOResourceImpl;
import org.eclipse.emf.ecore.InternalEObject;
@@ -41,7 +41,14 @@ public class CDOMetaWrapper extends CDOObjectWrapper
throw new UnsupportedOperationException();
}
- public CDOResource cdoResource()
+ @Override
+ public CDOResourceImpl cdoResource()
+ {
+ throw new UnsupportedOperationException();
+ }
+
+ @Override
+ public CDOResourceImpl cdoDirectResource()
{
throw new UnsupportedOperationException();
}
@@ -71,11 +78,6 @@ public class CDOMetaWrapper extends CDOObjectWrapper
throw new UnsupportedOperationException();
}
- public void cdoInternalSetResource(CDOResource resource)
- {
- throw new UnsupportedOperationException();
- }
-
public void cdoInternalPostLoad()
{
throw new UnsupportedOperationException();
diff --git a/plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/internal/cdo/CDOObjectImpl.java b/plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/internal/cdo/CDOObjectImpl.java
index 904402299d..d9648d411e 100644
--- a/plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/internal/cdo/CDOObjectImpl.java
+++ b/plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/internal/cdo/CDOObjectImpl.java
@@ -73,11 +73,7 @@ public class CDOObjectImpl extends EStoreEObjectImpl implements InternalCDOObjec
private CDOState state;
- private CDOViewImpl cdoView;
-
- // TODO Consider removal because it's only an optimization (proof that revision.resourceID could be used in all cases
- // as well)
- private CDOResourceImpl resource;
+ private CDOViewImpl view;
private InternalCDORevision revision;
@@ -109,17 +105,32 @@ public class CDOObjectImpl extends EStoreEObjectImpl implements InternalCDOObjec
public CDOViewImpl cdoView()
{
- return cdoView;
+ return view;
}
public CDOResourceImpl cdoResource()
{
- if (this instanceof CDOResourceImpl)
+ Resource resource = eResource();
+ if (resource instanceof CDOResourceImpl)
{
- resource = (CDOResourceImpl)this;
+ return (CDOResourceImpl)resource;
}
- return resource;
+ return null;
+ }
+
+ /**
+ * @since 2.0
+ */
+ public CDOResourceImpl cdoDirectResource()
+ {
+ Resource.Internal resource = eDirectResource();
+ if (resource instanceof CDOResourceImpl)
+ {
+ return (CDOResourceImpl)resource;
+ }
+
+ return null;
}
public void cdoReload()
@@ -172,10 +183,10 @@ public class CDOObjectImpl extends EStoreEObjectImpl implements InternalCDOObjec
public void cdoInternalSetView(CDOView view)
{
- cdoView = (CDOViewImpl)view;
- if (cdoView != null)
+ this.view = (CDOViewImpl)view;
+ if (this.view != null)
{
- eSetStore(cdoView.getStore());
+ eSetStore(this.view.getStore());
}
else
{
@@ -185,17 +196,7 @@ public class CDOObjectImpl extends EStoreEObjectImpl implements InternalCDOObjec
public void cdoInternalSetResource(CDOResource resource)
{
- if (this instanceof CDOResourceImpl)
- {
- return;
- }
-
- if (TRACER.isEnabled())
- {
- TRACER.format("Setting resource: {0}", resource);
- }
-
- this.resource = (CDOResourceImpl)resource;
+ throw new UnsupportedOperationException();
}
public void cdoInternalPostLoad()
@@ -259,7 +260,6 @@ public class CDOObjectImpl extends EStoreEObjectImpl implements InternalCDOObjec
if (directResource instanceof CDOResource)
{
CDOResource cdoResource = (CDOResource)directResource;
- cdoInternalSetResource(cdoResource);
revision.setResourceID(cdoResource.cdoID());
}
@@ -345,7 +345,7 @@ public class CDOObjectImpl extends EStoreEObjectImpl implements InternalCDOObjec
}
CDOViewImpl view = cdoView();
- super.eSetDirectResource(cdoResource());
+ super.eSetDirectResource(cdoDirectResource());
eContainer = eStore().getContainer(this);
eContainerFeatureID = getStore().getContainingFeatureID(this);
if (eContainer != null && eContainmentFeature().isResolveProxies())
@@ -659,9 +659,7 @@ public class CDOObjectImpl extends EStoreEObjectImpl implements InternalCDOObjec
}
else if (resource instanceof CDOResourceImpl || resource == null)
{
-
- this.resource = (CDOResourceImpl)resource;
- getStore().setContainer(this, cdoResource(), eInternalContainer(), eContainerFeatureID());
+ getStore().setContainer(this, (CDOResourceImpl)resource, eInternalContainer(), eContainerFeatureID());
}
else
{
@@ -673,19 +671,14 @@ public class CDOObjectImpl extends EStoreEObjectImpl implements InternalCDOObjec
* @since 2.0
*/
@Override
- public Internal eDirectResource()
+ public Resource.Internal eDirectResource()
{
- if (this instanceof Internal)
- {
- return (Internal)this;
- }
-
if (FSMUtil.isTransient(this))
{
return super.eDirectResource();
}
- return cdoResource();
+ return (Resource.Internal)getStore().getResource(this);
}
/**
@@ -808,6 +801,8 @@ public class CDOObjectImpl extends EStoreEObjectImpl implements InternalCDOObjec
public NotificationChain eBasicSetContainer(InternalEObject newContainer, int newContainerFeatureID,
NotificationChain msgs)
{
+ boolean isResourceRoot = this instanceof CDOResource && ((CDOResource)this).isRoot();
+
InternalEObject oldContainer = eInternalContainer();
Resource.Internal oldResource = eDirectResource();
Resource.Internal newResource = null;
@@ -830,18 +825,19 @@ public class CDOObjectImpl extends EStoreEObjectImpl implements InternalCDOObjec
{
oldResource = oldContainer.eInternalResource();
}
+
if (newContainer != null)
{
newResource = newContainer.eInternalResource();
}
}
- CDOView oldView = cdoView;
+
+ CDOView oldView = view;
CDOView newView = newResource != null && newResource instanceof CDOResource ? ((CDOResource)newResource).cdoView()
: null;
boolean moved = oldView != null && oldView == newView;
-
- if (!moved && oldResource != null)
+ if (!moved && oldResource != null && !isResourceRoot)
{
oldResource.detached(this);
}
@@ -869,6 +865,7 @@ public class CDOObjectImpl extends EStoreEObjectImpl implements InternalCDOObjec
msgs.add(notification);
}
}
+
if (newContainerFeatureID >= 0)
{
ENotificationImpl notification = new ENotificationImpl(this, Notification.SET, newContainerFeatureID,
@@ -883,6 +880,7 @@ public class CDOObjectImpl extends EStoreEObjectImpl implements InternalCDOObjec
}
}
}
+
return msgs;
}
@@ -897,7 +895,7 @@ public class CDOObjectImpl extends EStoreEObjectImpl implements InternalCDOObjec
{
Resource.Internal oldResource = eDirectResource();
- CDOView oldView = cdoView;
+ CDOView oldView = view;
CDOView newView = resource != null && resource instanceof CDOResource ? ((CDOResource)resource).cdoView() : null;
boolean isSameView = oldView != null && oldView == newView;
@@ -962,7 +960,7 @@ public class CDOObjectImpl extends EStoreEObjectImpl implements InternalCDOObjec
}
else
{
- getStore().setContainer(this, cdoResource(), newEContainer, newContainerFeatureID);
+ getStore().setContainer(this, cdoDirectResource(), newEContainer, newContainerFeatureID);
}
}
diff --git a/plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/internal/cdo/CDOObjectWrapper.java b/plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/internal/cdo/CDOObjectWrapper.java
index ac8845d500..78441c6506 100644
--- a/plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/internal/cdo/CDOObjectWrapper.java
+++ b/plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/internal/cdo/CDOObjectWrapper.java
@@ -12,6 +12,7 @@ package org.eclipse.emf.internal.cdo;
import org.eclipse.emf.cdo.CDOView;
import org.eclipse.emf.cdo.common.id.CDOID;
+import org.eclipse.emf.cdo.eresource.impl.CDOResourceImpl;
import org.eclipse.emf.internal.cdo.bundle.OM;
@@ -60,6 +61,31 @@ public abstract class CDOObjectWrapper implements InternalCDOObject
return view;
}
+ public CDOResourceImpl cdoResource()
+ {
+ Resource resource = eResource();
+ if (resource instanceof CDOResourceImpl)
+ {
+ return (CDOResourceImpl)resource;
+ }
+
+ return null;
+ }
+
+ /**
+ * @since 2.0
+ */
+ public CDOResourceImpl cdoDirectResource()
+ {
+ Resource.Internal resource = eDirectResource();
+ if (resource instanceof CDOResourceImpl)
+ {
+ return (CDOResourceImpl)resource;
+ }
+
+ return null;
+ }
+
public void cdoInternalSetID(CDOID id)
{
if (id == null)
diff --git a/plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/internal/cdo/CDORevisionManagerImpl.java b/plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/internal/cdo/CDORevisionManagerImpl.java
index 4e026fe621..3f4c60cd95 100644
--- a/plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/internal/cdo/CDORevisionManagerImpl.java
+++ b/plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/internal/cdo/CDORevisionManagerImpl.java
@@ -16,6 +16,7 @@ import org.eclipse.emf.cdo.analyzer.CDOFetchRuleManager;
import org.eclipse.emf.cdo.common.id.CDOID;
import org.eclipse.emf.cdo.common.id.CDOIDObjectFactory;
import org.eclipse.emf.cdo.common.model.CDOFeature;
+import org.eclipse.emf.cdo.common.model.CDOPackageManager;
import org.eclipse.emf.cdo.common.revision.CDORevision;
import org.eclipse.emf.cdo.common.util.TransportException;
import org.eclipse.emf.cdo.internal.common.revision.CDORevisionResolverImpl;
@@ -133,9 +134,9 @@ public class CDORevisionManagerImpl extends CDORevisionResolverImpl implements C
* @since 2.0
*/
@Override
- protected CDOFeature getResourcePathFeature()
+ protected CDOPackageManager getPackageManager()
{
- return session.getPackageManager().getCDOResourcePackage().getCDOResourceClass().getCDOPathFeature();
+ return session.getPackageManager();
}
private List<InternalCDORevision> send(LoadRevisionRequest request)
diff --git a/plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/internal/cdo/CDOSessionImpl.java b/plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/internal/cdo/CDOSessionImpl.java
index 17b70a46be..4cca73d5e9 100644
--- a/plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/internal/cdo/CDOSessionImpl.java
+++ b/plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/internal/cdo/CDOSessionImpl.java
@@ -51,7 +51,6 @@ import org.eclipse.emf.internal.cdo.protocol.SetPassiveUpdateRequest;
import org.eclipse.emf.internal.cdo.protocol.SyncRevisionRequest;
import org.eclipse.emf.internal.cdo.protocol.ViewsChangedRequest;
import org.eclipse.emf.internal.cdo.util.CDOPackageRegistryImpl;
-import org.eclipse.emf.internal.cdo.util.FSMUtil;
import org.eclipse.emf.internal.cdo.util.ModelUtil;
import org.eclipse.net4j.channel.IChannel;
@@ -829,7 +828,7 @@ public class CDOSessionImpl extends Container<CDOView> implements CDOSession, CD
protected void attach(ResourceSet resourceSet, CDOViewImpl view)
{
- CDOViewSet viewSet = FSMUtil.prepareResourceSet(resourceSet);
+ CDOViewSet viewSet = CDOSessionImpl.prepareResourceSet(resourceSet);
synchronized (views)
{
views.add(view);
@@ -1084,6 +1083,25 @@ public class CDOSessionImpl extends Container<CDOView> implements CDOSession, CD
}
/**
+ * @since 2.0
+ */
+ public static CDOViewSet prepareResourceSet(ResourceSet resourceSet)
+ {
+ CDOViewSetImpl viewSet = null;
+ synchronized (resourceSet)
+ {
+ viewSet = (CDOViewSetImpl)CDOUtil.getViewSet(resourceSet);
+ if (viewSet == null)
+ {
+ viewSet = new CDOViewSetImpl();
+ resourceSet.eAdapters().add(viewSet);
+ }
+ }
+
+ return viewSet;
+ }
+
+ /**
* @author Eike Stepper
*/
private final class InvalidationEvent extends Event implements CDOSessionInvalidationEvent
diff --git a/plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/internal/cdo/CDOStore.java b/plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/internal/cdo/CDOStore.java
index bfe0a2488c..39d5dc2038 100644
--- a/plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/internal/cdo/CDOStore.java
+++ b/plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/internal/cdo/CDOStore.java
@@ -127,6 +127,21 @@ public final class CDOStore implements EStore
return revision.getContainingFeatureID();
}
+ /**
+ * @since 2.0
+ */
+ public InternalEObject getResource(InternalEObject eObject)
+ {
+ InternalCDOObject cdoObject = getCDOObject(eObject);
+ if (TRACER.isEnabled())
+ {
+ TRACER.format("getContainer({0})", cdoObject);
+ }
+
+ InternalCDORevision revision = getRevisionForReading(cdoObject);
+ return (InternalEObject)((CDOViewImpl)cdoObject.cdoView()).convertIDToObject(revision.getResourceID());
+ }
+
@Deprecated
public EStructuralFeature getContainingFeature(InternalEObject eObject)
{
@@ -147,12 +162,7 @@ public final class CDOStore implements EStore
Object value = revision.get(cdoFeature, index);
if (cdoFeature.isReference())
{
- if (value instanceof CDOReferenceProxy)
- {
- value = ((CDOReferenceProxy)value).resolve(getView().getSession().getRevisionManager(), revision, cdoFeature,
- index);
- }
-
+ value = resolveProxy(revision, cdoFeature, index, value);
if (cdoFeature.isMany() && value instanceof CDOID)
{
CDOID id = (CDOID)value;
@@ -299,12 +309,7 @@ public final class CDOStore implements EStore
{
for (int i = 0; i < result.length; i++)
{
- if (result[i] instanceof CDOReferenceProxy)
- {
- result[i] = ((CDOReferenceProxy)result[i]).resolve(getView().getSession().getRevisionManager(), revision,
- cdoFeature, i);
- }
-
+ result[i] = resolveProxy(revision, cdoFeature, i, result[i]);
result[i] = ((CDOViewImpl)cdoObject.cdoView()).convertIDToObject(result[i]);
}
}
@@ -355,11 +360,7 @@ public final class CDOStore implements EStore
if (cdoFeature.isReference())
{
Object oldValue = revision.get(cdoFeature, index);
- if (oldValue instanceof CDOReferenceProxy)
- {
- ((CDOReferenceProxy)oldValue).resolve(getView().getSession().getRevisionManager(), revision, cdoFeature, index);
- }
-
+ oldValue = resolveProxy(revision, cdoFeature, index, oldValue);
value = ((CDOViewImpl)cdoObject.cdoView()).convertObjectToID(value, true);
}
@@ -420,12 +421,7 @@ public final class CDOStore implements EStore
Object result = revision.remove(cdoFeature, index);
if (cdoFeature.isReference())
{
- if (result instanceof CDOReferenceProxy)
- {
- result = ((CDOReferenceProxy)result).resolve(getView().getSession().getRevisionManager(), revision, cdoFeature,
- index);
- }
-
+ result = resolveProxy(revision, cdoFeature, index, result);
result = ((CDOViewImpl)cdoObject.cdoView()).convertIDToObject(result);
}
@@ -461,12 +457,7 @@ public final class CDOStore implements EStore
Object result = revision.move(cdoFeature, target, source);
if (cdoFeature.isReference())
{
- if (result instanceof CDOReferenceProxy)
- {
- result = ((CDOReferenceProxy)result).resolve(getView().getSession().getRevisionManager(), revision, cdoFeature,
- target);
- }
-
+ result = resolveProxy(revision, cdoFeature, target, result);
result = ((CDOViewImpl)cdoObject.cdoView()).convertIDToObject(result);
}
@@ -489,6 +480,20 @@ public final class CDOStore implements EStore
return FSMUtil.adapt(object, view);
}
+ /**
+ * @since 2.0
+ */
+ public Object resolveProxy(InternalCDORevision revision, CDOFeature cdoFeature, int index, Object value)
+ {
+ if (value instanceof CDOReferenceProxy)
+ {
+ value = ((CDOReferenceProxy)value).resolve(getView().getSession().getRevisionManager(), revision, cdoFeature,
+ index);
+ }
+
+ return value;
+ }
+
private CDOFeature getCDOFeature(InternalCDOObject cdoObject, EStructuralFeature eFeature)
{
synchronized (lock)
diff --git a/plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/internal/cdo/CDOTransactionImpl.java b/plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/internal/cdo/CDOTransactionImpl.java
index 0a32f677af..39b5d3e4e7 100644
--- a/plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/internal/cdo/CDOTransactionImpl.java
+++ b/plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/internal/cdo/CDOTransactionImpl.java
@@ -29,8 +29,13 @@ import org.eclipse.emf.cdo.common.revision.CDORevisionUtil;
import org.eclipse.emf.cdo.common.revision.delta.CDOFeatureDelta;
import org.eclipse.emf.cdo.common.revision.delta.CDORevisionDelta;
import org.eclipse.emf.cdo.common.revision.delta.CDORevisionDeltaUtil;
+import org.eclipse.emf.cdo.common.util.CDOException;
import org.eclipse.emf.cdo.eresource.CDOResource;
+import org.eclipse.emf.cdo.eresource.CDOResourceFolder;
+import org.eclipse.emf.cdo.eresource.CDOResourceNode;
+import org.eclipse.emf.cdo.eresource.EresourceFactory;
import org.eclipse.emf.cdo.eresource.impl.CDOResourceImpl;
+import org.eclipse.emf.cdo.eresource.impl.CDOResourceNodeImpl;
import org.eclipse.emf.cdo.spi.common.InternalCDOPackage;
import org.eclipse.emf.cdo.spi.common.InternalCDORevision;
import org.eclipse.emf.cdo.spi.common.InternalCDORevisionDelta;
@@ -44,6 +49,7 @@ import org.eclipse.emf.internal.cdo.util.IPackageClosure;
import org.eclipse.emf.internal.cdo.util.ModelUtil;
import org.eclipse.net4j.util.ImplementationError;
+import org.eclipse.net4j.util.ObjectUtil;
import org.eclipse.net4j.util.event.Notifier;
import org.eclipse.net4j.util.om.trace.ContextTracer;
import org.eclipse.net4j.util.transaction.TransactionException;
@@ -172,11 +178,20 @@ public class CDOTransactionImpl extends CDOViewImpl implements InternalCDOTransa
return CDOIDUtil.createTempObject(++lastTemporaryID);
}
+ /**
+ * @since 2.0
+ */
+ @Override
+ protected CDOResourceImpl createRootResource()
+ {
+ return (CDOResourceImpl)getOrCreateResource(CDOResourceNode.ROOT_PATH);
+ }
+
public CDOResource createResource(String path)
{
checkOpen();
- URI createURI = CDOURIUtil.createResourceURI(this, path);
- return (CDOResource)getResourceSet().createResource(createURI);
+ URI uri = CDOURIUtil.createResourceURI(this, path);
+ return (CDOResource)getResourceSet().createResource(uri);
}
public CDOResource getOrCreateResource(String path)
@@ -191,9 +206,9 @@ public class CDOTransactionImpl extends CDOViewImpl implements InternalCDOTransa
return (CDOResource)getObject(id);
}
}
- catch (Exception expected)
+ catch (Exception ignore)
{
- TRACER.trace(expected);
+ // Just create the missing resource
}
return createResource(path);
@@ -202,35 +217,89 @@ public class CDOTransactionImpl extends CDOViewImpl implements InternalCDOTransa
/**
* @since 2.0
*/
-
- public void attach(CDOResourceImpl cdoResource)
+ @Override
+ public void attachResource(CDOResourceImpl resource)
{
- try
+ if (resource.isExisting())
{
- CDOStateMachine.INSTANCE.attach(cdoResource, this);
- fireEvent(new ResourcesEvent(cdoResource.getPath(), ResourcesEvent.Kind.ADDED));
+ super.attachResource(resource);
}
- catch (RuntimeException ex)
+ else
+ {
+ // ResourceSet.createResource(uri) was called!!
+ attachNewResource(resource);
+ }
+ }
+
+ private void attachNewResource(CDOResourceImpl resource)
+ {
+ URI uri = resource.getURI();
+ List<String> names = CDOURIUtil.analyzePath(uri);
+ String resourceName = names.isEmpty() ? null : names.remove(names.size() - 1);
+
+ CDOResourceFolder folder = getOrCreateResourceFolder(names);
+ attachNewResourceNode(folder, resourceName, resource);
+ }
+
+ /**
+ * @return never <code>null</code>;
+ * @since 2.0
+ */
+ public CDOResourceFolder getOrCreateResourceFolder(List<String> names)
+ {
+ CDOResourceFolder folder = null;
+ for (String name : names)
{
- OM.LOG.error(ex);
+ CDOResourceNode node;
try
{
- ((InternalCDOObject)cdoResource).cdoInternalSetState(CDOState.NEW);
- getResourceSet().getResources().remove(cdoResource);
+ CDOID folderID = folder == null ? null : folder.cdoID();
+ node = getResourceNode(folderID, name);
}
- catch (RuntimeException ignore)
+ catch (CDOException ex)
{
+ node = EresourceFactory.eINSTANCE.createCDOResourceFolder();
+ attachNewResourceNode(folder, name, node);
}
- throw ex;
+ if (node instanceof CDOResourceFolder)
+ {
+ folder = (CDOResourceFolder)node;
+ }
+ else
+ {
+ throw new CDOException("Not a ResourceFolder: " + node);
+ }
+ }
+
+ return folder;
+ }
+
+ private void attachNewResourceNode(CDOResourceFolder folder, String name, CDOResourceNode newNode)
+ {
+ CDOResourceNodeImpl node = (CDOResourceNodeImpl)newNode;
+ node.basicSetName(name, false);
+ if (folder == null)
+ {
+ if (node.isRoot())
+ {
+ CDOStateMachine.INSTANCE.attach(node, this);
+ }
+ else
+ {
+ getRootResource().getContents().add(node);
+ }
+ }
+ else
+ {
+ node.basicSetFolder(folder, false);
}
}
/**
* @since 2.0
*/
-
public void detach(CDOResourceImpl cdoResource)
{
CDOStateMachine.INSTANCE.detach(cdoResource);
@@ -271,7 +340,6 @@ public class CDOTransactionImpl extends CDOViewImpl implements InternalCDOTransa
}
this.transactionStrategy = transactionStrategy;
-
if (this.transactionStrategy != null)
{
this.transactionStrategy.setTarget(this);
@@ -282,10 +350,53 @@ public class CDOTransactionImpl extends CDOViewImpl implements InternalCDOTransa
* @since 2.0
*/
@Override
- public CDOID getResourceID(String path)
+ protected CDOID getRootOrTopLevelResourceNodeID(String name)
{
- CDOID id = super.getResourceID(path);
- return isDetached(id) ? CDOID.NULL : id;
+ if (dirty)
+ {
+ CDOResourceNode node = getRootResourceNode(name, getDirtyObjects().values());
+ if (node != null)
+ {
+ return node.cdoID();
+ }
+
+ node = getRootResourceNode(name, getNewObjects().values());
+ if (node != null)
+ {
+ return node.cdoID();
+ }
+
+ node = getRootResourceNode(name, getNewResources().values());
+ if (node != null)
+ {
+ return node.cdoID();
+ }
+ }
+
+ CDOID id = super.getRootOrTopLevelResourceNodeID(name);
+ if (getLastSavepoint().getAllDetachedObjects().containsKey(id) || getDirtyObjects().containsKey(id))
+ {
+ throw new CDOException("Root resource node " + name + " doesn't exist");
+ }
+
+ return id;
+ }
+
+ private CDOResourceNode getRootResourceNode(String name, Collection<? extends CDOObject> objects)
+ {
+ for (CDOObject object : objects)
+ {
+ if (object instanceof CDOResourceNode)
+ {
+ CDOResourceNode node = (CDOResourceNode)object;
+ if (node.getFolder() == null && ObjectUtil.equals(name, node.getName()))
+ {
+ return node;
+ }
+ }
+ }
+
+ return null;
}
private boolean isDetached(CDOID id)
@@ -300,7 +411,6 @@ public class CDOTransactionImpl extends CDOViewImpl implements InternalCDOTransa
public InternalCDOObject getObject(CDOID id, boolean loadOnDemand)
{
checkOpen();
-
if (id == null || id.isNull())
{
return null;
diff --git a/plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/internal/cdo/CDOURIHandler.java b/plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/internal/cdo/CDOURIHandler.java
new file mode 100644
index 0000000000..8e8310a0e1
--- /dev/null
+++ b/plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/internal/cdo/CDOURIHandler.java
@@ -0,0 +1,78 @@
+/***************************************************************************
+ * 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;
+
+import org.eclipse.emf.cdo.eresource.CDOResourceInputStream;
+
+import org.eclipse.emf.common.util.URI;
+import org.eclipse.emf.ecore.resource.URIHandler;
+
+import java.io.IOException;
+import java.io.InputStream;
+import java.io.OutputStream;
+import java.util.Map;
+
+/**
+ * @author Eike Stepper
+ * @since 2.0
+ */
+public class CDOURIHandler implements URIHandler
+{
+ private CDOViewImpl view;
+
+ public CDOURIHandler(CDOViewImpl view)
+ {
+ this.view = view;
+ }
+
+ public CDOViewImpl getView()
+ {
+ return view;
+ }
+
+ public boolean canHandle(URI uri)
+ {
+ return false;
+ }
+
+ public boolean exists(URI uri, Map<?, ?> options)
+ {
+ return false;
+ }
+
+ public void delete(URI uri, Map<?, ?> options) throws IOException
+ {
+ }
+
+ public InputStream createInputStream(URI uri, Map<?, ?> options) throws IOException
+ {
+ return new CDOResourceInputStream(view, uri);
+ }
+
+ public OutputStream createOutputStream(URI uri, Map<?, ?> options) throws IOException
+ {
+ return null;
+ }
+
+ public Map<String, ?> contentDescription(URI uri, Map<?, ?> options) throws IOException
+ {
+ return null;
+ }
+
+ public Map<String, ?> getAttributes(URI uri, Map<?, ?> options)
+ {
+ return null;
+ }
+
+ public void setAttributes(URI uri, Map<String, ?> attributes, Map<?, ?> options) throws IOException
+ {
+ }
+}
diff --git a/plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/internal/cdo/CDOViewImpl.java b/plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/internal/cdo/CDOViewImpl.java
index 51386a5104..2c09d92169 100644
--- a/plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/internal/cdo/CDOViewImpl.java
+++ b/plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/internal/cdo/CDOViewImpl.java
@@ -28,28 +28,34 @@ import org.eclipse.emf.cdo.common.id.CDOIDMeta;
import org.eclipse.emf.cdo.common.id.CDOIDProvider;
import org.eclipse.emf.cdo.common.id.CDOIDUtil;
import org.eclipse.emf.cdo.common.model.CDOClass;
+import org.eclipse.emf.cdo.common.model.CDOFeature;
+import org.eclipse.emf.cdo.common.model.resource.CDONameFeature;
+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.common.revision.CDORevision;
import org.eclipse.emf.cdo.common.revision.CDORevisionResolver;
import org.eclipse.emf.cdo.common.revision.delta.CDORevisionDelta;
import org.eclipse.emf.cdo.common.util.CDOException;
-import org.eclipse.emf.cdo.common.util.TransportException;
import org.eclipse.emf.cdo.eresource.CDOResource;
+import org.eclipse.emf.cdo.eresource.CDOResourceFolder;
+import org.eclipse.emf.cdo.eresource.CDOResourceNode;
import org.eclipse.emf.cdo.eresource.impl.CDOResourceImpl;
import org.eclipse.emf.cdo.query.CDOQuery;
import org.eclipse.emf.cdo.spi.common.InternalCDORevision;
import org.eclipse.emf.cdo.util.CDOURIUtil;
import org.eclipse.emf.cdo.util.CDOUtil;
+import org.eclipse.emf.cdo.util.InvalidURIException;
import org.eclipse.emf.cdo.util.ReadOnlyException;
import org.eclipse.emf.internal.cdo.bundle.OM;
import org.eclipse.emf.internal.cdo.protocol.ChangeSubscriptionRequest;
-import org.eclipse.emf.internal.cdo.protocol.ResourceIDRequest;
-import org.eclipse.emf.internal.cdo.protocol.ResourcePathRequest;
import org.eclipse.emf.internal.cdo.query.CDOQueryImpl;
import org.eclipse.emf.internal.cdo.util.FSMUtil;
import org.eclipse.emf.internal.cdo.util.ModelUtil;
import org.eclipse.net4j.util.ImplementationError;
+import org.eclipse.net4j.util.StringUtil;
import org.eclipse.net4j.util.ReflectUtil.ExcludeFromDump;
import org.eclipse.net4j.util.collection.CloseableIterator;
import org.eclipse.net4j.util.om.trace.ContextTracer;
@@ -75,6 +81,7 @@ import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.Set;
+import java.util.StringTokenizer;
import java.util.concurrent.ConcurrentMap;
import java.util.concurrent.locks.ReentrantLock;
@@ -91,6 +98,8 @@ public class CDOViewImpl extends org.eclipse.net4j.util.event.Notifier implement
private CDOViewSet viewSet;
+ private CDOURIHandler uriHandler = new CDOURIHandler(this);
+
private boolean uniqueResourceContents = true;
private boolean invalidationNotificationEnabled;
@@ -105,6 +114,8 @@ public class CDOViewImpl extends org.eclipse.net4j.util.event.Notifier implement
private ReentrantLock lock = new ReentrantLock(true);
+ private CDOResourceImpl rootResource;
+
@ExcludeFromDump
private transient CDOID lastLookupID;
@@ -169,6 +180,36 @@ public class CDOViewImpl extends org.eclipse.net4j.util.event.Notifier implement
/**
* @since 2.0
*/
+ public synchronized CDOResourceImpl getRootResource()
+ {
+ if (rootResource == null)
+ {
+ rootResource = createRootResource();
+ }
+
+ return rootResource;
+ }
+
+ /**
+ * @return
+ * @since 2.0
+ */
+ protected CDOResourceImpl createRootResource()
+ {
+ return (CDOResourceImpl)getResource(CDOResourceNode.ROOT_PATH);
+ }
+
+ /**
+ * @since 2.0
+ */
+ public CDOURIHandler getURIHandler()
+ {
+ return uriHandler;
+ }
+
+ /**
+ * @since 2.0
+ */
public ReentrantLock getLock()
{
return lock;
@@ -278,8 +319,16 @@ public class CDOViewImpl extends org.eclipse.net4j.util.event.Notifier implement
public boolean hasResource(String path)
{
checkOpen();
- CDOID id = getResourceID(path);
- return id != null && !id.isNull();
+
+ try
+ {
+ getResourceID(path);
+ return true;
+ }
+ catch (Exception ex)
+ {
+ return false;
+ }
}
/**
@@ -291,23 +340,162 @@ public class CDOViewImpl extends org.eclipse.net4j.util.event.Notifier implement
return new CDOQueryImpl(this, language, queryString);
}
+ /**
+ * @return never <code>null</code>
+ * @since 2.0
+ */
public CDOID getResourceID(String path)
{
- try
+ if (StringUtil.isEmpty(path))
+ {
+ throw new IllegalArgumentException("path");
+ }
+
+ CDOID folderID = null;
+ if (CDOURIUtil.SEGMENT_SEPARATOR.equals(path))
{
- CDOResource resource = getResource(path, false);
- if (resource != null && resource.cdoID() != null)
+ folderID = getResourceID(null, null);
+ }
+ else
+ {
+ List<String> names = CDOURIUtil.analyzePath(path);
+ for (String name : names)
{
- return resource.cdoID();
+ folderID = getResourceID(folderID, name);
}
+ }
- ResourceIDRequest request = new ResourceIDRequest(session.getProtocol(), viewID, path);
- return session.getFailOverStrategy().send(request);
+ return folderID;
+ }
+
+ /**
+ * @retrn never <code>null</code>
+ */
+ private CDOID getResourceID(CDOID folderID, String name)
+ {
+ folderID = getResourceNodeID(folderID, name);
+ if (folderID == null)
+ {
+ throw new CDOException("Can not find " + name);
+ }
+
+ return folderID;
+ }
+
+ /**
+ * @return never <code>null</code>
+ * @since 2.0
+ */
+ protected CDOResourceNode getResourceNode(CDOID folderID, String name)
+ {
+ try
+ {
+ CDOID id = getResourceNodeID(folderID, name);
+ return (CDOResourceNode)getObject(id);
+ }
+ catch (CDOException ex)
+ {
+ throw ex;
}
catch (Exception ex)
{
- throw new TransactionException(ex);
+ throw new CDOException(ex);
+ }
+ }
+
+ /**
+ * @since 2.0
+ */
+ protected CDOID getResourceNodeID(CDOID folderID, String name)
+ {
+ if (folderID == null)
+ {
+ return getRootOrTopLevelResourceNodeID(name);
+ }
+ else if (name == null)
+ {
+ throw new IllegalArgumentException("name");
+ }
+
+ InternalCDORevision folderRevision = getLocalRevision(folderID);
+ CDOResourcePackage resourcePackage = getSession().getPackageManager().getCDOResourcePackage();
+ CDOResourceFolderClass resourceFolderClass = resourcePackage.getCDOResourceFolderClass();
+ if (folderRevision.getCDOClass() != resourceFolderClass)
+ {
+ throw new CDOException("Expected folder for id = " + folderID);
+ }
+
+ CDOFeature nodesFeature = resourceFolderClass.getCDONodesFeature();
+ CDOFeature nameFeature = resourcePackage.getCDOResourceNodeClass().getCDONameFeature();
+
+ int size = folderRevision.getData().size(nodesFeature);
+ for (int i = 0; i < size; i++)
+ {
+ Object value = folderRevision.getData().get(nodesFeature, i);
+ value = getStore().resolveProxy(folderRevision, nodesFeature, i, value);
+
+ CDORevision childRevision = getLocalRevision((CDOID)value);
+ if (name.equals(childRevision.getData().get(nameFeature, 0)))
+ {
+ return childRevision.getID();
+ }
+ }
+
+ throw new CDOException("Node " + name + " not found");
+ }
+
+ /**
+ * @since 2.0
+ */
+ protected CDOID getRootOrTopLevelResourceNodeID(String name)
+ {
+ CDOQuery resourceQuery = createResourcesQuery(null, name, true);
+ resourceQuery.setMaxResults(1);
+ List<CDOID> ids = resourceQuery.getResult(CDOID.class);
+ if (ids.isEmpty())
+ {
+ if (name == null)
+ {
+ throw new CDOException("No root ResourceNode");
+ }
+ else
+ {
+ throw new CDOException("No top level ResourceNode with the name " + name);
+ }
+ }
+
+ if (ids.size() > 1)
+ {
+ // TODO is this still needed since the is resourceQuery.setMaxResults(1) ??
+ throw new ImplementationError("Duplicate top-level ResourceNodes");
+ }
+
+ return ids.get(0);
+ }
+
+ /**
+ * @since 2.0
+ */
+ protected InternalCDORevision getLocalRevision(CDOID id)
+ {
+ InternalCDORevision revision = null;
+ InternalCDOObject object = getObject(id, false);
+ if (object != null && object.cdoState() != CDOState.PROXY)
+ {
+ revision = (InternalCDORevision)object.cdoRevision();
}
+
+ if (revision == null)
+ {
+ revision = getRevision(id, true);
+ }
+
+ if (revision == null)
+ {
+ throw new CDOException("Cannot find revision with ID " + id);
+ }
+
+ return revision;
}
/**
@@ -322,11 +510,42 @@ public class CDOViewImpl extends org.eclipse.net4j.util.event.Notifier implement
}
/**
+ * TODO Remove me
+ *
+ * @since 2.0
+ */
+ @Deprecated
+ public CDOResourceFolder getResourceFolder(String path)
+ {
+ if (path == null)
+ {
+ return null;
+ }
+
+ CDOResourceFolder folder = null;
+ StringTokenizer tokenizer = new StringTokenizer(path, CDOURIUtil.SEGMENT_SEPARATOR);
+ while (tokenizer.hasMoreTokens())
+ {
+ String segment = tokenizer.nextToken();
+ if (segment != null)
+ {
+ if (folder == null)
+ {
+ }
+ else
+ {
+ }
+ }
+ }
+
+ return folder;
+ }
+
+ /**
* @since 2.0
*/
public CDOResource getResource(String path)
{
- checkOpen();
return getResource(path, true);
}
@@ -343,24 +562,29 @@ public class CDOViewImpl extends org.eclipse.net4j.util.event.Notifier implement
/**
* @since 2.0
*/
- public List<CDOResource> queryResources(String pathPrefix)
+ public List<CDOResourceNode> queryResources(CDOResourceFolder folder, String name, boolean exactMatch)
{
- CDOQuery resourceQuery = createResourcesQuery(pathPrefix);
- return resourceQuery.getResult(CDOResource.class);
+ CDOQuery resourceQuery = createResourcesQuery(folder, name, exactMatch);
+ return resourceQuery.getResult(CDOResourceNode.class);
}
/**
* @since 2.0
*/
- public CloseableIterator<CDOResource> queryResourcesAsync(String pathPrefix)
+ public CloseableIterator<CDOResourceNode> queryResourcesAsync(CDOResourceFolder folder, String name,
+ boolean exactMatch)
{
- CDOQuery resourceQuery = createResourcesQuery(pathPrefix);
- return resourceQuery.getResultAsync(CDOResource.class);
+ CDOQuery resourceQuery = createResourcesQuery(folder, name, exactMatch);
+ return resourceQuery.getResultAsync(CDOResourceNode.class);
}
- private CDOQuery createResourcesQuery(String pathPrefix)
+ private CDOQuery createResourcesQuery(CDOResourceFolder folder, String name, boolean exactMatch)
{
- return createQuery(CDOProtocolConstants.QUERY_LANGUAGE_RESOURCES, pathPrefix);
+ CDOQuery query = createQuery(CDOProtocolConstants.QUERY_LANGUAGE_RESOURCES, name);
+ query.setParameter(CDOProtocolConstants.QUERY_LANGUAGE_RESOURCES_FOLDER_ID, folder == null ? null : folder.cdoID());
+ query.setParameter(CDOProtocolConstants.QUERY_LANGUAGE_RESOURCES_EXACT_MATCH, exactMatch);
+ return query;
+
}
public CDOResourceImpl getResource(CDOID resourceID)
@@ -370,43 +594,7 @@ public class CDOViewImpl extends org.eclipse.net4j.util.event.Notifier implement
throw new IllegalArgumentException("resourceID: " + resourceID);
}
- CDOResourceImpl resource = (CDOResourceImpl)getObject(resourceID);
- if (resource != null)
- {
- return resource;
- }
-
- try
- {
- ResourcePathRequest request = new ResourcePathRequest(session.getProtocol(), viewID, resourceID);
- String path = session.getFailOverStrategy().send(request);
- return addResource(resourceID, path);
- }
- catch (RuntimeException ex)
- {
- throw ex;
- }
- catch (Exception ex)
- {
- throw new TransportException(ex);
- }
- }
-
- public CDOResourceImpl addResource(CDOID id, String path)
- {
- URI createURI = CDOURIUtil.createResourceURI(this, path);
- CDOResourceImpl resource = (CDOResourceImpl)viewSet.getResourceFactory().createResource(createURI);
- resource.setURI(createURI);
-
- InternalCDOObject resourceObject = resource;
- resourceObject.cdoInternalSetID(id);
- resourceObject.cdoInternalSetView(this);
- resourceObject.cdoInternalSetResource(resource);
- resourceObject.cdoInternalSetState(CDOState.PROXY);
-
- ResourceSet resourceSet = getResourceSet();
- resourceSet.getResources().add(resource);
- return resource;
+ return (CDOResourceImpl)getObject(resourceID);
}
public InternalCDOObject newInstance(EClass eClass)
@@ -476,7 +664,11 @@ public class CDOViewImpl extends org.eclipse.net4j.util.event.Notifier implement
}
}
- registerObject(localLookupObject);
+ // CDOResource have a special way to register to the view.
+ if (!localLookupObject.cdoClass().isResource())
+ {
+ registerObject(localLookupObject);
+ }
}
lastLookupID = id;
@@ -573,30 +765,63 @@ public class CDOViewImpl extends org.eclipse.net4j.util.event.Notifier implement
FSMUtil.validate(id, revision);
CDOClass cdoClass = revision.getCDOClass();
- InternalCDOObject object = newInstance(cdoClass);
+ InternalCDOObject object;
+ if (cdoClass.isResource())
+ {
+ object = (InternalCDOObject)newResourceInstance(revision);
+ // object is PROXY
+ }
+ else
+ {
+ object = newInstance(cdoClass);
+ // object is TRANSIENT
+ }
+
cleanObject(object, revision);
return object;
}
+ private CDOResource newResourceInstance(InternalCDORevision revision)
+ {
+ String path = getResourcePath(revision);
+ return getResource(path, true);
+ }
+
+ private String getResourcePath(InternalCDORevision revision)
+ {
+ CDOResourcePackage resourcePackage = session.getPackageManager().getCDOResourcePackage();
+ CDOResourceNodeClass resourceNodeClass = resourcePackage.getCDOResourceNodeClass();
+ CDONameFeature nameFeature = resourceNodeClass.getCDONameFeature();
+
+ CDOID folderID = (CDOID)revision.getData().getContainerID();
+ String name = (String)revision.getData().get(nameFeature, 0);
+ if (folderID == null || folderID.isNull())
+ {
+ if (name == null)
+ {
+ return CDOURIUtil.SEGMENT_SEPARATOR;
+ }
+
+ return name;
+ }
+
+ InternalCDOObject object = getObject(folderID, true);
+ if (object instanceof CDOResourceFolder)
+ {
+ CDOResourceFolder folder = (CDOResourceFolder)object;
+ String path = folder.getPath();
+ return path + CDOURIUtil.SEGMENT_SEPARATOR + name;
+ }
+
+ throw new ImplementationError("Not a ResourceFolder: " + object);
+ }
+
/**
* @since 2.0
*/
protected void cleanObject(InternalCDOObject object, InternalCDORevision revision)
{
object.cdoInternalCleanup();
- if (object instanceof CDOResourceImpl)
- {
- object.cdoInternalSetResource((CDOResourceImpl)object);
- }
- else
- {
- CDOID resourceID = revision.getResourceID();
- if (!resourceID.isNull())
- {
- CDOResourceImpl resource = getResource(resourceID);
- object.cdoInternalSetResource(resource);
- }
- }
object.cdoInternalSetView(this);
object.cdoInternalSetRevision(revision);
@@ -614,7 +839,7 @@ public class CDOViewImpl extends org.eclipse.net4j.util.event.Notifier implement
CDOID id = (CDOID)shouldBeCDOID;
if (TRACER.isEnabled() && id != idOrObject)
{
- TRACER.format("Converted dangling reference: {0} --> {1}", idOrObject, id);
+ TRACER.format("Converted object to CDOID: {0} --> {1}", idOrObject, id);
}
return id;
@@ -717,21 +942,36 @@ public class CDOViewImpl extends org.eclipse.net4j.util.event.Notifier implement
/**
* @since 2.0
*/
- public boolean registerProxyResource(CDOResourceImpl resource)
+ public void attachResource(CDOResourceImpl resource)
{
- CDOID id = getResourceID(resource.getPath());
+ if (!resource.isExisting())
+ {
+ throw new ReadOnlyException("CDO view is read-only: " + this);
+ }
+
+ // ResourceSet.getResource(uri, true) was called!!
+ resource.cdoInternalSetView(this);
+ resource.cdoInternalSetState(CDOState.PROXY);
+ }
- boolean exists = id != null && !id.isNull();
- if (exists)
+ /**
+ * @since 2.0
+ */
+ public void registerProxyResource(CDOResourceImpl resource)
+ {
+ URI uri = resource.getURI();
+ String path = CDOURIUtil.extractResourcePath(uri);
+
+ try
{
- resource.cdoInternalSetResource(resource);
- resource.cdoInternalSetView(this);
+ CDOID id = getResourceID(path);
resource.cdoInternalSetID(id);
- resource.cdoInternalSetState(CDOState.PROXY);
registerObject(resource);
}
-
- return exists;
+ catch (Exception ex)
+ {
+ throw new InvalidURIException(uri, ex);
+ }
}
public void registerObject(InternalCDOObject object)
@@ -1028,6 +1268,10 @@ public class CDOViewImpl extends org.eclipse.net4j.util.event.Notifier implement
public void setViewSet(CDOViewSet viewSet)
{
this.viewSet = viewSet;
+ if (viewSet != null)
+ {
+ viewSet.getResourceSet().getURIConverter().getURIHandlers().add(getURIHandler());
+ }
}
private void checkOpen()
diff --git a/plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/internal/cdo/CDOViewSetImpl.java b/plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/internal/cdo/CDOViewSetImpl.java
index 5bcff13bfc..64491de399 100644
--- a/plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/internal/cdo/CDOViewSetImpl.java
+++ b/plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/internal/cdo/CDOViewSetImpl.java
@@ -21,7 +21,6 @@ import org.eclipse.emf.cdo.util.CDOURIUtil;
import org.eclipse.emf.internal.cdo.bundle.OM;
import org.eclipse.emf.internal.cdo.util.CDOViewSetPackageRegistryImpl;
-import org.eclipse.emf.internal.cdo.util.FSMUtil;
import org.eclipse.emf.common.notify.Adapter;
import org.eclipse.emf.common.notify.Notification;
@@ -88,7 +87,7 @@ public class CDOViewSetImpl extends NotifierImpl implements CDOViewSet, Adapter
* @throws IllegalArgumentException
* if repositoryUUID doesn't match any CDOView.
*/
- public CDOViewImpl resolveUUID(String repositoryUUID)
+ public CDOViewImpl resolveView(String repositoryUUID)
{
CDOViewImpl view = null;
synchronized (views)
@@ -242,13 +241,18 @@ public class CDOViewSetImpl extends NotifierImpl implements CDOViewSet, Adapter
switch (notification.getEventType())
{
case Notification.ADD:
- if (notification.getNewValue() instanceof CDOResourceImpl)
+ {
+ Object newResource = notification.getNewValue();
+ if (newResource instanceof CDOResourceImpl)
{
- notifyAdd((CDOResourceImpl)notification.getNewValue());
+ notifyAdd((CDOResourceImpl)newResource);
}
+
break;
+ }
case Notification.ADD_MANY:
+ {
List<Resource> newResources = (List<Resource>)notification.getNewValue();
for (Resource newResource : newResources)
{
@@ -257,8 +261,10 @@ public class CDOViewSetImpl extends NotifierImpl implements CDOViewSet, Adapter
notifyAdd((CDOResourceImpl)newResource);
}
}
+
break;
}
+ }
}
catch (RuntimeException ex)
{
@@ -272,10 +278,11 @@ public class CDOViewSetImpl extends NotifierImpl implements CDOViewSet, Adapter
*/
private void notifyAdd(CDOResourceImpl resource)
{
- CDOViewImpl view = resolveUUID(resource.getURI().authority());
- if (view != null && FSMUtil.isTransient(resource))
+ String respositoryUUID = CDOURIUtil.extractRepositoryUUID(resource.getURI());
+ CDOViewImpl view = resolveView(respositoryUUID);
+ if (view != null)
{
- view.toTransaction().attach(resource);
+ view.attachResource(resource);
}
}
}
diff --git a/plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/internal/cdo/InternalCDOObject.java b/plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/internal/cdo/InternalCDOObject.java
index 3dda5274cf..8ed7feab37 100644
--- a/plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/internal/cdo/InternalCDOObject.java
+++ b/plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/internal/cdo/InternalCDOObject.java
@@ -15,7 +15,6 @@ import org.eclipse.emf.cdo.CDOState;
import org.eclipse.emf.cdo.CDOView;
import org.eclipse.emf.cdo.common.id.CDOID;
import org.eclipse.emf.cdo.common.revision.CDORevision;
-import org.eclipse.emf.cdo.eresource.CDOResource;
import org.eclipse.emf.ecore.EStructuralFeature;
import org.eclipse.emf.ecore.InternalEObject;
@@ -40,8 +39,6 @@ public interface InternalCDOObject extends CDOObject, InternalEObject, InternalC
public void cdoInternalSetID(CDOID id);
- public void cdoInternalSetResource(CDOResource resource);
-
public void cdoInternalSetView(CDOView view);
public void cdoInternalSetRevision(CDORevision revision);
diff --git a/plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/internal/cdo/protocol/QueryRequest.java b/plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/internal/cdo/protocol/QueryRequest.java
index 7eaeae4f79..ae317d9473 100644
--- a/plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/internal/cdo/protocol/QueryRequest.java
+++ b/plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/internal/cdo/protocol/QueryRequest.java
@@ -18,7 +18,7 @@ import org.eclipse.emf.cdo.common.util.CDOQueryQueue;
import org.eclipse.emf.cdo.internal.common.query.CDOQueryInfoImpl;
import org.eclipse.emf.internal.cdo.bundle.OM;
-import org.eclipse.emf.internal.cdo.query.CDOQueryResultIteratorImpl;
+import org.eclipse.emf.internal.cdo.query.CDOAbstractQueryIteratorImpl;
import org.eclipse.net4j.util.om.trace.ContextTracer;
@@ -35,16 +35,12 @@ public class QueryRequest extends CDOClientRequest<Object>
private int viewID;
- private CDOQueryInfoImpl queryInfo;
+ private CDOAbstractQueryIteratorImpl<?> queryResult;
- private CDOQueryResultIteratorImpl<?> queryResult;
-
- public QueryRequest(CDOClientProtocol protocol, int viewID, CDOQueryInfoImpl queryInfo,
- CDOQueryResultIteratorImpl<?> queryResult)
+ public QueryRequest(CDOClientProtocol protocol, int viewID, CDOAbstractQueryIteratorImpl<?> queryResult)
{
super(protocol);
this.viewID = viewID;
- this.queryInfo = queryInfo;
this.queryResult = queryResult;
}
@@ -58,7 +54,8 @@ public class QueryRequest extends CDOClientRequest<Object>
protected void requesting(CDODataOutput out) throws IOException
{
out.writeInt(viewID);
- queryInfo.write(out);
+ // TODO Simon: Move I/O logic to CDODataInput/OutputStream?!
+ ((CDOQueryInfoImpl)queryResult.getQueryInfo()).write(out);
}
@Override
diff --git a/plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/internal/cdo/protocol/ResourcePathRequest.java b/plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/internal/cdo/protocol/ResourcePathRequest.java
deleted file mode 100644
index 126f758ee0..0000000000
--- a/plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/internal/cdo/protocol/ResourcePathRequest.java
+++ /dev/null
@@ -1,76 +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.protocol;
-
-import org.eclipse.emf.cdo.common.CDODataInput;
-import org.eclipse.emf.cdo.common.CDODataOutput;
-import org.eclipse.emf.cdo.common.CDOProtocolConstants;
-import org.eclipse.emf.cdo.common.id.CDOID;
-
-import org.eclipse.emf.internal.cdo.bundle.OM;
-
-import org.eclipse.net4j.util.om.trace.ContextTracer;
-
-import java.io.IOException;
-
-/**
- * @author Eike Stepper
- */
-public class ResourcePathRequest extends CDOClientRequest<String>
-{
- private static final ContextTracer PROTOCOL_TRACER = new ContextTracer(OM.DEBUG_PROTOCOL, ResourcePathRequest.class);
-
- private int viewID;
-
- private CDOID id;
-
- public ResourcePathRequest(CDOClientProtocol protocol, int viewID, CDOID id)
- {
- super(protocol);
- this.viewID = viewID;
- this.id = id;
- }
-
- @Override
- protected short getSignalID()
- {
- return CDOProtocolConstants.SIGNAL_RESOURCE_PATH;
- }
-
- @Override
- protected void requesting(CDODataOutput out) throws IOException
- {
- if (PROTOCOL_TRACER.isEnabled())
- {
- PROTOCOL_TRACER.format("Writing viewID: {0}", viewID);
- }
-
- out.writeInt(viewID);
- if (PROTOCOL_TRACER.isEnabled())
- {
- PROTOCOL_TRACER.format("Writing ID: {0}", id);
- }
-
- out.writeCDOID(id);
- }
-
- @Override
- protected String confirming(CDODataInput in) throws IOException
- {
- String path = in.readString();
- if (PROTOCOL_TRACER.isEnabled())
- {
- PROTOCOL_TRACER.format("Read path: {0}", path);
- }
-
- return path;
- }
-}
diff --git a/plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/internal/cdo/query/CDOAbstractQueryIteratorImpl.java b/plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/internal/cdo/query/CDOAbstractQueryIteratorImpl.java
new file mode 100644
index 0000000000..b805278193
--- /dev/null
+++ b/plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/internal/cdo/query/CDOAbstractQueryIteratorImpl.java
@@ -0,0 +1,91 @@
+/***************************************************************************
+ * 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:
+ * Simon McDuff - initial API and implementation
+ **************************************************************************/
+package org.eclipse.emf.internal.cdo.query;
+
+import org.eclipse.emf.cdo.CDOView;
+import org.eclipse.emf.cdo.common.query.CDOQueryInfo;
+import org.eclipse.emf.cdo.internal.common.query.AbstractQueryResult;
+
+import org.eclipse.emf.internal.cdo.CDOSessionImpl;
+import org.eclipse.emf.internal.cdo.protocol.QueryCancelRequest;
+
+import org.eclipse.net4j.util.concurrent.ConcurrentValue;
+
+import java.util.List;
+
+/**
+ * @author Simon McDuff
+ */
+public abstract class CDOAbstractQueryIteratorImpl<T> extends AbstractQueryResult<T>
+{
+ private static final int UNDEFINED_QUERY_ID = -1;
+
+ private ConcurrentValue<Boolean> queryIDSet = new ConcurrentValue<Boolean>(false);
+
+ public CDOAbstractQueryIteratorImpl(CDOView view, CDOQueryInfo queryInfo)
+ {
+ super(view, queryInfo, UNDEFINED_QUERY_ID);
+ }
+
+ @Override
+ public void setQueryID(int queryID)
+ {
+ super.setQueryID(queryID);
+ queryIDSet.set(true);
+ }
+
+ public void waitForInitialization() throws InterruptedException
+ {
+ queryIDSet.acquire(new Object()
+ {
+ @Override
+ public boolean equals(Object obj)
+ {
+ return Boolean.TRUE.equals(obj) || isClosed();
+ }
+ });
+ }
+
+ @Override
+ public CDOView getView()
+ {
+ return (CDOView)super.getView();
+ }
+
+ @Override
+ public void remove()
+ {
+ throw new UnsupportedOperationException();
+ }
+
+ @Override
+ public void close()
+ {
+ if (!isClosed())
+ {
+ super.close();
+ queryIDSet.reevaluate();
+
+ try
+ {
+ CDOSessionImpl session = (CDOSessionImpl)getView().getSession();
+ QueryCancelRequest request = new QueryCancelRequest(session.getProtocol(), getQueryID());
+ session.getFailOverStrategy().send(request);
+ }
+ catch (Exception ignore)
+ {
+ // Catch all exception
+ }
+ }
+ }
+
+ public abstract List<T> asList();
+}
diff --git a/plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/internal/cdo/query/CDOQueryCDOIDIteratorImpl.java b/plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/internal/cdo/query/CDOQueryCDOIDIteratorImpl.java
new file mode 100644
index 0000000000..d11660f90e
--- /dev/null
+++ b/plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/internal/cdo/query/CDOQueryCDOIDIteratorImpl.java
@@ -0,0 +1,40 @@
+/***************************************************************************
+ * 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:
+ * Simon McDuff - initial API and implementation
+ **************************************************************************/
+package org.eclipse.emf.internal.cdo.query;
+
+import org.eclipse.emf.cdo.CDOView;
+import org.eclipse.emf.cdo.common.query.CDOQueryInfo;
+
+import java.util.ArrayList;
+import java.util.List;
+
+/**
+ * @author Simon McDuff
+ */
+public class CDOQueryCDOIDIteratorImpl<CDOID> extends CDOAbstractQueryIteratorImpl<CDOID>
+{
+ public CDOQueryCDOIDIteratorImpl(CDOView view, CDOQueryInfo queryInfo)
+ {
+ super(view, queryInfo);
+ }
+
+ @Override
+ public List<CDOID> asList()
+ {
+ ArrayList<CDOID> result = new ArrayList<CDOID>();
+ while (hasNext())
+ {
+ result.add(next());
+ }
+
+ return result;
+ }
+}
diff --git a/plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/internal/cdo/query/CDOQueryImpl.java b/plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/internal/cdo/query/CDOQueryImpl.java
index a57f29859a..3c7ca04776 100644
--- a/plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/internal/cdo/query/CDOQueryImpl.java
+++ b/plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/internal/cdo/query/CDOQueryImpl.java
@@ -12,6 +12,7 @@
package org.eclipse.emf.internal.cdo.query;
import org.eclipse.emf.cdo.CDOView;
+import org.eclipse.emf.cdo.common.id.CDOID;
import org.eclipse.emf.cdo.common.util.BlockingCloseableIterator;
import org.eclipse.emf.cdo.internal.common.query.CDOQueryInfoImpl;
import org.eclipse.emf.cdo.query.CDOQuery;
@@ -61,15 +62,26 @@ public class CDOQueryImpl extends CDOQueryInfoImpl implements CDOQuery
return this;
}
- public <T> List<T> getResult(Class<T> classObject)
+ @SuppressWarnings("unchecked")
+ protected <T> CDOAbstractQueryIteratorImpl<T> createQueryResult(Class<T> classObject)
{
CDOQueryInfoImpl queryInfo = createQueryInfo();
- CDOQueryResultIteratorImpl<T> queryResult = new CDOQueryResultIteratorImpl<T>(view, queryInfo);
+ if (classObject.equals(CDOID.class))
+ {
+ return new CDOQueryCDOIDIteratorImpl(view, queryInfo);
+ }
+
+ return new CDOQueryResultIteratorImpl<T>(view, queryInfo);
+ }
+
+ public <T> List<T> getResult(Class<T> classObject)
+ {
+ CDOAbstractQueryIteratorImpl<T> queryResult = createQueryResult(classObject);
try
{
CDOSessionImpl session = view.getSession();
- QueryRequest request = new QueryRequest(session.getProtocol(), view.getViewID(), queryInfo, queryResult);
+ QueryRequest request = new QueryRequest(session.getProtocol(), view.getViewID(), queryResult);
session.getFailOverStrategy().send(request);
}
catch (Exception exception)
@@ -77,13 +89,12 @@ public class CDOQueryImpl extends CDOQueryInfoImpl implements CDOQuery
throw WrappedException.wrap(exception);
}
- return queryResult.getAsList();
+ return queryResult.asList();
}
public <T> BlockingCloseableIterator<T> getResultAsync(Class<T> classObject)
{
- final CDOQueryInfoImpl queryInfo = createQueryInfo();
- final CDOQueryResultIteratorImpl<T> queryResult = new CDOQueryResultIteratorImpl<T>(view, queryInfo);
+ final CDOAbstractQueryIteratorImpl<T> queryResult = createQueryResult(classObject);
final Exception exception[] = new Exception[1];
Runnable runnable = new Runnable()
{
@@ -92,7 +103,7 @@ public class CDOQueryImpl extends CDOQueryInfoImpl implements CDOQuery
try
{
CDOSessionImpl session = view.getSession();
- QueryRequest request = new QueryRequest(session.getProtocol(), view.getViewID(), queryInfo, queryResult);
+ QueryRequest request = new QueryRequest(session.getProtocol(), view.getViewID(), queryResult);
session.getFailOverStrategy().send(request);
}
catch (Exception ex)
@@ -103,6 +114,7 @@ public class CDOQueryImpl extends CDOQueryInfoImpl implements CDOQuery
}
};
+ // TODO Simon: Can we leverage a thread pool?
new Thread(runnable).start();
try
diff --git a/plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/internal/cdo/query/CDOQueryResultIteratorImpl.java b/plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/internal/cdo/query/CDOQueryResultIteratorImpl.java
index 99395a63dc..d83eafecc2 100644
--- a/plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/internal/cdo/query/CDOQueryResultIteratorImpl.java
+++ b/plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/internal/cdo/query/CDOQueryResultIteratorImpl.java
@@ -14,12 +14,6 @@ package org.eclipse.emf.internal.cdo.query;
import org.eclipse.emf.cdo.CDOView;
import org.eclipse.emf.cdo.common.id.CDOID;
import org.eclipse.emf.cdo.common.query.CDOQueryInfo;
-import org.eclipse.emf.cdo.internal.common.query.AbstractQueryResult;
-
-import org.eclipse.emf.internal.cdo.CDOSessionImpl;
-import org.eclipse.emf.internal.cdo.protocol.QueryCancelRequest;
-
-import org.eclipse.net4j.util.concurrent.ConcurrentValue;
import java.util.ArrayList;
import java.util.List;
@@ -27,40 +21,11 @@ import java.util.List;
/**
* @author Simon McDuff
*/
-public class CDOQueryResultIteratorImpl<T> extends AbstractQueryResult<T>
+public class CDOQueryResultIteratorImpl<T> extends CDOAbstractQueryIteratorImpl<T>
{
- private static final int UNDEFINED_QUERY_ID = -1;
-
- private ConcurrentValue<Boolean> queryIDSet = new ConcurrentValue<Boolean>(false);
-
public CDOQueryResultIteratorImpl(CDOView view, CDOQueryInfo queryInfo)
{
- super(view, queryInfo, UNDEFINED_QUERY_ID);
- }
-
- @Override
- public void setQueryID(int queryID)
- {
- super.setQueryID(queryID);
- queryIDSet.set(true);
- }
-
- public void waitForInitialization() throws InterruptedException
- {
- queryIDSet.acquire(new Object()
- {
- @Override
- public boolean equals(Object obj)
- {
- return Boolean.TRUE.equals(obj) || isClosed();
- }
- });
- }
-
- @Override
- public CDOView getView()
- {
- return (CDOView)super.getView();
+ super(view, queryInfo);
}
@Override
@@ -69,12 +34,6 @@ public class CDOQueryResultIteratorImpl<T> extends AbstractQueryResult<T>
return adapt(super.next());
}
- @Override
- public void remove()
- {
- throw new UnsupportedOperationException();
- }
-
@SuppressWarnings("unchecked")
protected T adapt(Object object)
{
@@ -92,29 +51,9 @@ public class CDOQueryResultIteratorImpl<T> extends AbstractQueryResult<T>
}
@Override
- public void close()
- {
- if (!isClosed())
- {
- super.close();
- queryIDSet.reevaluate();
-
- try
- {
- CDOSessionImpl session = (CDOSessionImpl)getView().getSession();
- QueryCancelRequest request = new QueryCancelRequest(session.getProtocol(), getQueryID());
- session.getFailOverStrategy().send(request);
- }
- catch (Exception exception)
- {
- // Catch all exception
- }
- }
- }
-
- public List<T> getAsList()
+ public List<T> asList()
{
- ArrayList<Object> result = new ArrayList<Object>();
+ List<Object> result = new ArrayList<Object>();
while (super.hasNext())
{
result.add(super.next());
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