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
parent5d07b888b76e385204a2188780c35dc7727c0d8c (diff)
downloadcdo-committers/estepper/pop-20081018.tar.gz
cdo-committers/estepper/pop-20081018.tar.xz
cdo-committers/estepper/pop-20081018.zip
[249847] Store resources in a hierarchical structurecommitters/estepper/pop-20081018
https://bugs.eclipse.org/bugs/show_bug.cgi?id=249847
-rw-r--r--plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/common/CDOProtocolConstants.java12
-rw-r--r--plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/common/id/CDOIDUtil.java24
-rw-r--r--plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/common/model/CDOClass.java10
-rw-r--r--plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/common/model/resource/CDOContentsFeature.java2
-rw-r--r--plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/common/model/resource/CDOFolderFeature.java (renamed from plugins/org.eclipse.emf.cdo.ui/src/org/eclipse/emf/cdo/ui/viewhistory/CDOViewHistoryEvent.java)16
-rw-r--r--plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/common/model/resource/CDONameFeature.java (renamed from plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/common/model/resource/CDOPathFeature.java)7
-rw-r--r--plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/common/model/resource/CDONodesFeature.java (renamed from plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/cdo/eresource/EresourceObject.java)17
-rw-r--r--plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/common/model/resource/CDOResourceClass.java4
-rw-r--r--plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/common/model/resource/CDOResourceFolderClass.java27
-rw-r--r--plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/common/model/resource/CDOResourceNodeClass.java29
-rw-r--r--plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/common/model/resource/CDOResourcePackage.java13
-rw-r--r--plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/common/revision/CDORevision.java10
-rw-r--r--plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/common/revision/CDORevisionResolver.java7
-rw-r--r--plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/common/revision/cache/CDORevisionCache.java8
-rw-r--r--plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/common/util/CDOQueryQueue.java11
-rw-r--r--plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/internal/common/model/CDOClassImpl.java10
-rw-r--r--plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/internal/common/model/resource/CDOContentsFeatureImpl.java7
-rw-r--r--plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/internal/common/model/resource/CDOFolderFeatureImpl.java32
-rw-r--r--plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/internal/common/model/resource/CDONameFeatureImpl.java (renamed from plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/internal/common/model/resource/CDOPathFeatureImpl.java)6
-rw-r--r--plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/internal/common/model/resource/CDONodesFeatureImpl.java32
-rw-r--r--plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/internal/common/model/resource/CDOResourceClassImpl.java32
-rw-r--r--plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/internal/common/model/resource/CDOResourceFolderClassImpl.java57
-rw-r--r--plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/internal/common/model/resource/CDOResourceNodeClassImpl.java61
-rw-r--r--plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/internal/common/model/resource/CDOResourcePackageImpl.java16
-rw-r--r--plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/internal/common/revision/CDORevisionImpl.java36
-rw-r--r--plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/internal/common/revision/CDORevisionResolverImpl.java27
-rw-r--r--plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/internal/common/revision/cache/lru/LRURevisionCache.java36
-rw-r--r--plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/internal/common/revision/cache/mem/MEMRevisionCache.java37
-rw-r--r--plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/internal/common/revision/cache/two/TwoLevelRevisionCache.java26
-rw-r--r--plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/spi/common/AbstractCDOIDLong.java9
-rw-r--r--plugins/org.eclipse.emf.cdo.edit/.settings/.api_filters15
-rw-r--r--plugins/org.eclipse.emf.cdo.edit/icons/full/ctool16/CreateCDOResourceFolder_contents_CDOResource.gifbin0 -> 225 bytes
-rw-r--r--plugins/org.eclipse.emf.cdo.edit/icons/full/ctool16/CreateCDOResourceFolder_contents_CDOResourceFolder.gifbin0 -> 225 bytes
-rw-r--r--plugins/org.eclipse.emf.cdo.edit/icons/full/ctool16/CreateCDOResourceFolder_nodes_CDOResource.gifbin0 -> 225 bytes
-rw-r--r--plugins/org.eclipse.emf.cdo.edit/icons/full/ctool16/CreateCDOResourceFolder_nodes_CDOResourceFolder.gifbin0 -> 225 bytes
-rw-r--r--plugins/org.eclipse.emf.cdo.edit/icons/full/obj16/CDOResourceFolder.gifbin0 -> 131 bytes
-rw-r--r--plugins/org.eclipse.emf.cdo.edit/plugin.properties7
-rw-r--r--plugins/org.eclipse.emf.cdo.edit/src/org/eclipse/emf/cdo/eresource/provider/CDOResourceFolderItemProvider.java158
-rw-r--r--plugins/org.eclipse.emf.cdo.edit/src/org/eclipse/emf/cdo/eresource/provider/CDOResourceItemProvider.java32
-rw-r--r--plugins/org.eclipse.emf.cdo.edit/src/org/eclipse/emf/cdo/eresource/provider/CDOResourceNodeItemProvider.java153
-rw-r--r--plugins/org.eclipse.emf.cdo.edit/src/org/eclipse/emf/cdo/eresource/provider/EresourceItemProviderAdapterFactory.java29
-rw-r--r--plugins/org.eclipse.emf.cdo.server.db/src/org/eclipse/emf/cdo/server/db/IClassMapping.java5
-rw-r--r--plugins/org.eclipse.emf.cdo.server.db/src/org/eclipse/emf/cdo/server/db/IMappingStrategy.java19
-rw-r--r--plugins/org.eclipse.emf.cdo.server.db/src/org/eclipse/emf/cdo/server/internal/db/ClassMapping.java90
-rw-r--r--plugins/org.eclipse.emf.cdo.server.db/src/org/eclipse/emf/cdo/server/internal/db/ClassServerInfo.java17
-rw-r--r--plugins/org.eclipse.emf.cdo.server.db/src/org/eclipse/emf/cdo/server/internal/db/DBStore.java13
-rw-r--r--plugins/org.eclipse.emf.cdo.server.db/src/org/eclipse/emf/cdo/server/internal/db/DBStoreReader.java4
-rw-r--r--plugins/org.eclipse.emf.cdo.server.db/src/org/eclipse/emf/cdo/server/internal/db/DBStoreWriter.java7
-rw-r--r--plugins/org.eclipse.emf.cdo.server.db/src/org/eclipse/emf/cdo/server/internal/db/HorizontalClassMapping.java26
-rw-r--r--plugins/org.eclipse.emf.cdo.server.db/src/org/eclipse/emf/cdo/server/internal/db/HorizontalMappingStrategy.java67
-rw-r--r--plugins/org.eclipse.emf.cdo.server.db/src/org/eclipse/emf/cdo/server/internal/db/MappingStrategy.java246
-rw-r--r--plugins/org.eclipse.emf.cdo.server.db/src/org/eclipse/emf/cdo/server/internal/db/NoClassMapping.java6
-rw-r--r--plugins/org.eclipse.emf.cdo.server.db/src/org/eclipse/emf/cdo/server/internal/db/ObjectIDIterator.java7
-rw-r--r--plugins/org.eclipse.emf.cdo.server.db/src/org/eclipse/emf/cdo/server/internal/db/ObjectTypeCache.java7
-rw-r--r--plugins/org.eclipse.emf.cdo.server.db/src/org/eclipse/emf/cdo/server/internal/db/ReferenceMapping.java1
-rw-r--r--plugins/org.eclipse.emf.cdo.server.db/src/org/eclipse/emf/cdo/server/internal/db/RootClassMapping.java9
-rw-r--r--plugins/org.eclipse.emf.cdo.server.db/src/org/eclipse/emf/cdo/server/internal/db/VerticalClassMapping.java8
-rw-r--r--plugins/org.eclipse.emf.cdo.server.db/src/org/eclipse/emf/cdo/server/internal/db/VerticalMappingStrategy.java7
-rw-r--r--plugins/org.eclipse.emf.cdo.server.hibernate/src/org/eclipse/emf/cdo/server/internal/hibernate/HibernateStoreReader.java108
-rw-r--r--plugins/org.eclipse.emf.cdo.server.hibernate/src/org/eclipse/emf/cdo/server/internal/hibernate/tuplizer/CDORevisionProxy.java21
-rw-r--r--plugins/org.eclipse.emf.cdo.server/src/org/eclipse/emf/cdo/internal/server/MEMStore.java86
-rw-r--r--plugins/org.eclipse.emf.cdo.server/src/org/eclipse/emf/cdo/internal/server/MEMStoreAccessor.java6
-rw-r--r--plugins/org.eclipse.emf.cdo.server/src/org/eclipse/emf/cdo/internal/server/QueryManager.java2
-rw-r--r--plugins/org.eclipse.emf.cdo.server/src/org/eclipse/emf/cdo/internal/server/Repository.java6
-rw-r--r--plugins/org.eclipse.emf.cdo.server/src/org/eclipse/emf/cdo/internal/server/ResourcesQueryHandler.java12
-rw-r--r--plugins/org.eclipse.emf.cdo.server/src/org/eclipse/emf/cdo/internal/server/RevisionManager.java5
-rw-r--r--plugins/org.eclipse.emf.cdo.server/src/org/eclipse/emf/cdo/internal/server/Store.java23
-rw-r--r--plugins/org.eclipse.emf.cdo.server/src/org/eclipse/emf/cdo/internal/server/View.java49
-rw-r--r--plugins/org.eclipse.emf.cdo.server/src/org/eclipse/emf/cdo/internal/server/protocol/CDOServerProtocol.java3
-rw-r--r--plugins/org.eclipse.emf.cdo.server/src/org/eclipse/emf/cdo/internal/server/protocol/ResourcePathIndication.java73
-rw-r--r--plugins/org.eclipse.emf.cdo.server/src/org/eclipse/emf/cdo/server/IStoreReader.java21
-rw-r--r--plugins/org.eclipse.emf.cdo.server/src/org/eclipse/emf/cdo/server/IView.java5
-rw-r--r--plugins/org.eclipse.emf.cdo.server/src/org/eclipse/emf/cdo/server/StoreUtil.java50
-rw-r--r--plugins/org.eclipse.emf.cdo.tests.model2/model/model2.ecore10
-rw-r--r--plugins/org.eclipse.emf.cdo.tests.model2/src/org/eclipse/emf/cdo/tests/model2/Model2Factory.java18
-rw-r--r--plugins/org.eclipse.emf.cdo.tests.model2/src/org/eclipse/emf/cdo/tests/model2/Model2Package.java190
-rw-r--r--plugins/org.eclipse.emf.cdo.tests.model2/src/org/eclipse/emf/cdo/tests/model2/Task.java110
-rw-r--r--plugins/org.eclipse.emf.cdo.tests.model2/src/org/eclipse/emf/cdo/tests/model2/TaskContainer.java45
-rw-r--r--plugins/org.eclipse.emf.cdo.tests.model2/src/org/eclipse/emf/cdo/tests/model2/impl/Model2FactoryImpl.java30
-rw-r--r--plugins/org.eclipse.emf.cdo.tests.model2/src/org/eclipse/emf/cdo/tests/model2/impl/Model2PackageImpl.java101
-rw-r--r--plugins/org.eclipse.emf.cdo.tests.model2/src/org/eclipse/emf/cdo/tests/model2/impl/TaskContainerImpl.java74
-rw-r--r--plugins/org.eclipse.emf.cdo.tests.model2/src/org/eclipse/emf/cdo/tests/model2/impl/TaskImpl.java124
-rw-r--r--plugins/org.eclipse.emf.cdo.tests.model2/src/org/eclipse/emf/cdo/tests/model2/util/Model2AdapterFactory.java44
-rw-r--r--plugins/org.eclipse.emf.cdo.tests.model2/src/org/eclipse/emf/cdo/tests/model2/util/Model2Switch.java54
-rw-r--r--plugins/org.eclipse.emf.cdo.tests/src/org/eclipse/emf/cdo/tests/AbstractCDOTest.java16
-rw-r--r--plugins/org.eclipse.emf.cdo.tests/src/org/eclipse/emf/cdo/tests/AllTestsAllConfigs.java2
-rw-r--r--plugins/org.eclipse.emf.cdo.tests/src/org/eclipse/emf/cdo/tests/ComplexTest.java27
-rw-r--r--plugins/org.eclipse.emf.cdo.tests/src/org/eclipse/emf/cdo/tests/ContainmentTest.java24
-rw-r--r--plugins/org.eclipse.emf.cdo.tests/src/org/eclipse/emf/cdo/tests/DetachTest.java7
-rw-r--r--plugins/org.eclipse.emf.cdo.tests/src/org/eclipse/emf/cdo/tests/ExternalReferenceTest.java15
-rw-r--r--plugins/org.eclipse.emf.cdo.tests/src/org/eclipse/emf/cdo/tests/InitialTest.java41
-rw-r--r--plugins/org.eclipse.emf.cdo.tests/src/org/eclipse/emf/cdo/tests/QueryTest.java4
-rw-r--r--plugins/org.eclipse.emf.cdo.tests/src/org/eclipse/emf/cdo/tests/ResourceTest.java573
-rw-r--r--plugins/org.eclipse.emf.cdo.tests/src/org/eclipse/emf/cdo/tests/RevisionHolderTest.java10
-rw-r--r--plugins/org.eclipse.emf.cdo.tests/src/org/eclipse/emf/cdo/tests/StateMachineTest.java2
-rw-r--r--plugins/org.eclipse.emf.cdo.tests/src/org/eclipse/emf/cdo/tests/TransactionHandlerTest.java4
-rw-r--r--plugins/org.eclipse.emf.cdo.tests/src/org/eclipse/emf/cdo/tests/XATransactionTest.java6
-rw-r--r--plugins/org.eclipse.emf.cdo.tests/src/org/eclipse/emf/cdo/tests/bugzilla/Bugzilla_248124_Test.java28
-rw-r--r--plugins/org.eclipse.emf.cdo.tests/src/org/eclipse/emf/cdo/tests/bugzilla/Bugzilla_248915_Test.java123
-rw-r--r--plugins/org.eclipse.emf.cdo.ui/META-INF/MANIFEST.MF1
-rw-r--r--plugins/org.eclipse.emf.cdo.ui/src/org/eclipse/emf/cdo/internal/ui/actions/OpenResourceEditorAction.java12
-rw-r--r--plugins/org.eclipse.emf.cdo.ui/src/org/eclipse/emf/cdo/internal/ui/actions/ResourceNodeAction.java (renamed from plugins/org.eclipse.emf.cdo.ui/src/org/eclipse/emf/cdo/internal/ui/actions/EntryAction.java)16
-rw-r--r--plugins/org.eclipse.emf.cdo.ui/src/org/eclipse/emf/cdo/internal/ui/editor/CDOEditor.java28
-rw-r--r--plugins/org.eclipse.emf.cdo.ui/src/org/eclipse/emf/cdo/internal/ui/views/CDOSessionsView.java21
-rw-r--r--plugins/org.eclipse.emf.cdo.ui/src/org/eclipse/emf/cdo/ui/CDOEventHandler.java15
-rw-r--r--plugins/org.eclipse.emf.cdo.ui/src/org/eclipse/emf/cdo/ui/CDOItemProvider.java131
-rw-r--r--plugins/org.eclipse.emf.cdo.ui/src/org/eclipse/emf/cdo/ui/viewhistory/CDOViewHistory.java156
-rw-r--r--plugins/org.eclipse.emf.cdo.ui/src/org/eclipse/emf/cdo/ui/viewhistory/CDOViewHistoryEntry.java74
-rw-r--r--plugins/org.eclipse.emf.cdo/model/eresource.ecore32
-rw-r--r--plugins/org.eclipse.emf.cdo/model/resource.genmodel9
-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.java42
-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
151 files changed, 5500 insertions, 2301 deletions
diff --git a/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/common/CDOProtocolConstants.java b/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/common/CDOProtocolConstants.java
index de0b94c008..04aec714a1 100644
--- a/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/common/CDOProtocolConstants.java
+++ b/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/common/CDOProtocolConstants.java
@@ -32,8 +32,6 @@ public interface CDOProtocolConstants
public static final short SIGNAL_RESOURCE_ID = 4;
- public static final short SIGNAL_RESOURCE_PATH = 5;
-
public static final short SIGNAL_LOAD_PACKAGE = 6;
public static final short SIGNAL_LOAD_REVISION = 7;
@@ -148,4 +146,14 @@ public interface CDOProtocolConstants
* @since 2.0
*/
public static final String QUERY_LANGUAGE_RESOURCES = "resources";
+
+ /**
+ * @since 2.0
+ */
+ public static final String QUERY_LANGUAGE_RESOURCES_FOLDER_ID = "folder";
+
+ /**
+ * @since 2.0
+ */
+ public static final String QUERY_LANGUAGE_RESOURCES_EXACT_MATCH = "exactMatch";
}
diff --git a/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/common/id/CDOIDUtil.java b/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/common/id/CDOIDUtil.java
index 9f93adb10c..32bb5cc429 100644
--- a/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/common/id/CDOIDUtil.java
+++ b/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/common/id/CDOIDUtil.java
@@ -22,10 +22,12 @@ import org.eclipse.emf.cdo.internal.common.id.CDOIDMetaRangeImpl;
import org.eclipse.emf.cdo.internal.common.id.CDOIDTempMetaImpl;
import org.eclipse.emf.cdo.internal.common.id.CDOIDTempObjectImpl;
import org.eclipse.emf.cdo.spi.common.AbstractCDOID;
+import org.eclipse.emf.cdo.spi.common.AbstractCDOIDLong;
import org.eclipse.emf.cdo.spi.common.CDOIDLibraryDescriptorImpl;
import org.eclipse.emf.cdo.spi.common.CDOIDLongImpl;
import org.eclipse.net4j.util.ImplementationError;
+import org.eclipse.net4j.util.ObjectUtil;
import org.eclipse.net4j.util.io.ExtendedDataInput;
import org.eclipse.net4j.util.om.trace.ContextTracer;
@@ -47,13 +49,13 @@ public final class CDOIDUtil
{
if (id == null)
{
- return 0L;
+ return AbstractCDOIDLong.NULL_VALUE;
}
switch (id.getType())
{
case NULL:
- return 0L;
+ return AbstractCDOIDLong.NULL_VALUE;
case OBJECT:
if (id instanceof CDOIDLongImpl)
@@ -229,4 +231,22 @@ public final class CDOIDUtil
{
return new CDOIDAndVersionImpl(id, version);
}
+
+ /**
+ * @since 2.0
+ */
+ public static boolean equals(CDOID id1, CDOID id2)
+ {
+ if (id1 == null)
+ {
+ id1 = CDOID.NULL;
+ }
+
+ if (id2 == null)
+ {
+ id2 = CDOID.NULL;
+ }
+
+ return ObjectUtil.equals(id1, id2);
+ }
}
diff --git a/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/common/model/CDOClass.java b/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/common/model/CDOClass.java
index 86a41ad434..32246265c6 100644
--- a/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/common/model/CDOClass.java
+++ b/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/common/model/CDOClass.java
@@ -20,6 +20,16 @@ public interface CDOClass extends CDOModelElement, Comparable<CDOClass>
public boolean isAbstract();
+ /**
+ * @since 2.0
+ */
+ public boolean isResourceNode();
+
+ /**
+ * @since 2.0
+ */
+ public boolean isResourceFolder();
+
public boolean isResource();
public boolean isRoot();
diff --git a/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/common/model/resource/CDOContentsFeature.java b/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/common/model/resource/CDOContentsFeature.java
index f0658e1e70..40da1e730f 100644
--- a/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/common/model/resource/CDOContentsFeature.java
+++ b/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/common/model/resource/CDOContentsFeature.java
@@ -18,7 +18,7 @@ import org.eclipse.emf.cdo.common.model.CDOFeature;
*/
public interface CDOContentsFeature extends CDOFeature
{
- public static final int FEATURE_ID = 2;
+ public static final int FEATURE_ID = 6;
public static final String NAME = "contents";
}
diff --git a/plugins/org.eclipse.emf.cdo.ui/src/org/eclipse/emf/cdo/ui/viewhistory/CDOViewHistoryEvent.java b/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/common/model/resource/CDOFolderFeature.java
index 200f9250ff..f183ddd0d5 100644
--- a/plugins/org.eclipse.emf.cdo.ui/src/org/eclipse/emf/cdo/ui/viewhistory/CDOViewHistoryEvent.java
+++ b/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/common/model/resource/CDOFolderFeature.java
@@ -8,24 +8,18 @@
* Contributors:
* Eike Stepper - initial API and implementation
**************************************************************************/
-package org.eclipse.emf.cdo.ui.viewhistory;
+package org.eclipse.emf.cdo.common.model.resource;
-import org.eclipse.net4j.util.event.IEvent;
+import org.eclipse.emf.cdo.common.model.CDOFeature;
/**
* @author Eike Stepper
* @noimplement This interface is not intended to be implemented by clients.
* @since 2.0
*/
-public interface CDOViewHistoryEvent extends IEvent
+public interface CDOFolderFeature extends CDOFeature
{
- /**
- * @since 2.0
- */
- public CDOViewHistory getViewHistory();
+ public static final int FEATURE_ID = 0;
- /**
- * @since 2.0
- */
- public CDOViewHistoryEntry getAddedEntry();
+ public static final String NAME = "folder";
}
diff --git a/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/common/model/resource/CDOPathFeature.java b/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/common/model/resource/CDONameFeature.java
index 7e43a15189..ed43489563 100644
--- a/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/common/model/resource/CDOPathFeature.java
+++ b/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/common/model/resource/CDONameFeature.java
@@ -15,10 +15,11 @@ import org.eclipse.emf.cdo.common.model.CDOFeature;
/**
* @author Eike Stepper
* @noimplement This interface is not intended to be implemented by clients.
+ * @since 2.0
*/
-public interface CDOPathFeature extends CDOFeature
+public interface CDONameFeature extends CDOFeature
{
- public static final int FEATURE_ID = 9;
+ public static final int FEATURE_ID = 1;
- public static final String NAME = "path";
+ public static final String NAME = "name";
}
diff --git a/plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/cdo/eresource/EresourceObject.java b/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/common/model/resource/CDONodesFeature.java
index e3f6b2223a..b69d81bdb1 100644
--- a/plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/cdo/eresource/EresourceObject.java
+++ b/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/common/model/resource/CDONodesFeature.java
@@ -8,19 +8,18 @@
* Contributors:
* Eike Stepper - initial API and implementation
**************************************************************************/
-package org.eclipse.emf.cdo.eresource;
+package org.eclipse.emf.cdo.common.model.resource;
-import org.eclipse.emf.cdo.CDOObject;
-
-import org.eclipse.emf.ecore.resource.Resource;
+import org.eclipse.emf.cdo.common.model.CDOFeature;
/**
* @author Eike Stepper
+ * @noimplement This interface is not intended to be implemented by clients.
+ * @since 2.0
*/
-public interface EresourceObject extends CDOObject, Resource.Internal
+public interface CDONodesFeature extends CDOFeature
{
- /**
- * @since 2.0
- */
- public boolean isExisting();
+ public static final int FEATURE_ID = 3;
+
+ public static final String NAME = "nodes";
}
diff --git a/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/common/model/resource/CDOResourceClass.java b/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/common/model/resource/CDOResourceClass.java
index 1a303164e9..38940008d1 100644
--- a/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/common/model/resource/CDOResourceClass.java
+++ b/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/common/model/resource/CDOResourceClass.java
@@ -18,11 +18,9 @@ import org.eclipse.emf.cdo.common.model.CDOClass;
*/
public interface CDOResourceClass extends CDOClass
{
- public static final int CLASSIFIER_ID = 0;
+ public static final int CLASSIFIER_ID = 2;
public static final String NAME = "CDOResource";
- public CDOPathFeature getCDOPathFeature();
-
public CDOContentsFeature getCDOContentsFeature();
}
diff --git a/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/common/model/resource/CDOResourceFolderClass.java b/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/common/model/resource/CDOResourceFolderClass.java
new file mode 100644
index 0000000000..3d305b9a2d
--- /dev/null
+++ b/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/common/model/resource/CDOResourceFolderClass.java
@@ -0,0 +1,27 @@
+/***************************************************************************
+ * 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.common.model.resource;
+
+import org.eclipse.emf.cdo.common.model.CDOClass;
+
+/**
+ * @author Eike Stepper
+ * @noimplement This interface is not intended to be implemented by clients.
+ * @since 2.0
+ */
+public interface CDOResourceFolderClass extends CDOClass
+{
+ public static final int CLASSIFIER_ID = 1;
+
+ public static final String NAME = "CDOResourceFolder";
+
+ public CDONodesFeature getCDONodesFeature();
+}
diff --git a/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/common/model/resource/CDOResourceNodeClass.java b/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/common/model/resource/CDOResourceNodeClass.java
new file mode 100644
index 0000000000..6dad3016e6
--- /dev/null
+++ b/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/common/model/resource/CDOResourceNodeClass.java
@@ -0,0 +1,29 @@
+/***************************************************************************
+ * 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.common.model.resource;
+
+import org.eclipse.emf.cdo.common.model.CDOClass;
+
+/**
+ * @author Eike Stepper
+ * @noimplement This interface is not intended to be implemented by clients.
+ * @since 2.0
+ */
+public interface CDOResourceNodeClass extends CDOClass
+{
+ public static final int CLASSIFIER_ID = 0;
+
+ public static final String NAME = "CDOResourceNode";
+
+ public CDOFolderFeature getCDOFolderFeature();
+
+ public CDONameFeature getCDONameFeature();
+}
diff --git a/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/common/model/resource/CDOResourcePackage.java b/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/common/model/resource/CDOResourcePackage.java
index baf5e54288..029e8dfa44 100644
--- a/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/common/model/resource/CDOResourcePackage.java
+++ b/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/common/model/resource/CDOResourcePackage.java
@@ -18,10 +18,19 @@ import org.eclipse.emf.cdo.common.model.CDOPackage;
*/
public interface CDOResourcePackage extends CDOPackage
{
- public static final String PACKAGE_URI = "http://www.eclipse.org/emf/CDO/resource/1.0.0";
+ public static final String PACKAGE_URI = "http://www.eclipse.org/emf/CDO/resource/2.0.0";
public static final String NAME = "cdoresource";
- public CDOResourceClass getCDOResourceClass();
+ /**
+ * @since 2.0
+ */
+ public CDOResourceNodeClass getCDOResourceNodeClass();
+
+ /**
+ * @since 2.0
+ */
+ public CDOResourceFolderClass getCDOResourceFolderClass();
+ public CDOResourceClass getCDOResourceClass();
}
diff --git a/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/common/revision/CDORevision.java b/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/common/revision/CDORevision.java
index 247dc10b17..f7f7fe3e83 100644
--- a/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/common/revision/CDORevision.java
+++ b/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/common/revision/CDORevision.java
@@ -41,6 +41,16 @@ public interface CDORevision
public boolean isTransactional();
+ /**
+ * @since 2.0
+ */
+ public boolean isResourceNode();
+
+ /**
+ * @since 2.0
+ */
+ public boolean isResourceFolder();
+
public boolean isResource();
public CDORevisionData getData();
diff --git a/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/common/revision/CDORevisionResolver.java b/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/common/revision/CDORevisionResolver.java
index b06487ad2a..99f7c9e9b0 100644
--- a/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/common/revision/CDORevisionResolver.java
+++ b/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/common/revision/CDORevisionResolver.java
@@ -59,10 +59,5 @@ public interface CDORevisionResolver
/**
* @since 2.0
*/
- public CDOID getResourceID(String path, long timeStamp);
-
- /**
- * @since 2.0
- */
- public String getResourcePath(CDOID id, long timeStamp);
+ public CDOID getResourceID(CDOID folderID, String name, long timeStamp);
}
diff --git a/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/common/revision/cache/CDORevisionCache.java b/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/common/revision/cache/CDORevisionCache.java
index 3db0bf307e..044568ec94 100644
--- a/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/common/revision/cache/CDORevisionCache.java
+++ b/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/common/revision/cache/CDORevisionCache.java
@@ -12,7 +12,7 @@ package org.eclipse.emf.cdo.common.revision.cache;
import org.eclipse.emf.cdo.common.id.CDOID;
import org.eclipse.emf.cdo.common.model.CDOClass;
-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.spi.common.InternalCDORevision;
@@ -45,11 +45,11 @@ public interface CDORevisionCache extends INotifier.Introspection
public boolean addRevision(InternalCDORevision revision);
- public CDOID getResourceID(String path, long timeStamp);
+ public CDOID getResourceID(CDOID folderID, String name, long timeStamp);
- public CDOFeature getResourcePathFeature();
+ public CDOPackageManager getPackageManager();
- public void setResourcePathFeature(CDOFeature resourcePathFeature);
+ public void setPackageManager(CDOPackageManager packageManager);
public void clear();
diff --git a/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/common/util/CDOQueryQueue.java b/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/common/util/CDOQueryQueue.java
index 3e31ae60d0..62b67da6f8 100644
--- a/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/common/util/CDOQueryQueue.java
+++ b/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/common/util/CDOQueryQueue.java
@@ -37,6 +37,8 @@ public class CDOQueryQueue<E> implements Queue<E>, Closeable
private boolean closed;
+ private Object closeLock = new Object();
+
public CDOQueryQueue()
{
}
@@ -48,9 +50,9 @@ public class CDOQueryQueue<E> implements Queue<E>, Closeable
public void close()
{
- synchronized (this)
+ synchronized (closeLock)
{
- if (!isClosed())
+ if (!closed)
{
closed = true;
queue.add(QUEUE_CLOSED);
@@ -60,8 +62,11 @@ public class CDOQueryQueue<E> implements Queue<E>, Closeable
public boolean isClosed()
{
+ synchronized (closeLock)
+ {
return closed;
}
+ }
public boolean add(E e)
{
@@ -352,7 +357,7 @@ public class CDOQueryQueue<E> implements Queue<E>, Closeable
{
try
{
- synchronized (CDOQueryQueue.this)
+ synchronized (closeLock)
{
if (CDOQueryQueue.this.isEmpty() && CDOQueryQueue.this.isClosed())
{
diff --git a/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/internal/common/model/CDOClassImpl.java b/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/internal/common/model/CDOClassImpl.java
index 7f84abb03b..1c4e871524 100644
--- a/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/internal/common/model/CDOClassImpl.java
+++ b/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/internal/common/model/CDOClassImpl.java
@@ -169,6 +169,16 @@ public class CDOClassImpl extends CDOModelElementImpl implements InternalCDOClas
this.isAbstract = isAbstract;
}
+ public boolean isResourceNode()
+ {
+ return false;
+ }
+
+ public boolean isResourceFolder()
+ {
+ return false;
+ }
+
public boolean isResource()
{
return false;
diff --git a/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/internal/common/model/resource/CDOContentsFeatureImpl.java b/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/internal/common/model/resource/CDOContentsFeatureImpl.java
index f8eed25188..6cb5ca1e53 100644
--- a/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/internal/common/model/resource/CDOContentsFeatureImpl.java
+++ b/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/internal/common/model/resource/CDOContentsFeatureImpl.java
@@ -12,7 +12,10 @@ package org.eclipse.emf.cdo.internal.common.model.resource;
import org.eclipse.emf.cdo.common.model.CDOClass;
import org.eclipse.emf.cdo.common.model.CDOClassProxy;
+import org.eclipse.emf.cdo.common.model.CDOModelUtil;
import org.eclipse.emf.cdo.common.model.CDOPackageManager;
+import org.eclipse.emf.cdo.common.model.core.CDOCorePackage;
+import org.eclipse.emf.cdo.common.model.core.CDOObjectClass;
import org.eclipse.emf.cdo.common.model.resource.CDOContentsFeature;
import org.eclipse.emf.cdo.internal.common.model.CDOFeatureImpl;
@@ -23,7 +26,7 @@ public class CDOContentsFeatureImpl extends CDOFeatureImpl implements CDOContent
{
public CDOContentsFeatureImpl(CDOClass containingClass, CDOPackageManager packageManager)
{
- super(containingClass, FEATURE_ID, NAME, new CDOClassProxy(packageManager.getCDOCorePackage().getCDOObjectClass()),
- true, true);
+ super(containingClass, FEATURE_ID, NAME, new CDOClassProxy(CDOModelUtil.createClassRef(CDOCorePackage.PACKAGE_URI,
+ CDOObjectClass.CLASSIFIER_ID), packageManager), true, true);
}
}
diff --git a/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/internal/common/model/resource/CDOFolderFeatureImpl.java b/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/internal/common/model/resource/CDOFolderFeatureImpl.java
new file mode 100644
index 0000000000..094106ccd5
--- /dev/null
+++ b/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/internal/common/model/resource/CDOFolderFeatureImpl.java
@@ -0,0 +1,32 @@
+/***************************************************************************
+ * 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.internal.common.model.resource;
+
+import org.eclipse.emf.cdo.common.model.CDOClass;
+import org.eclipse.emf.cdo.common.model.CDOClassProxy;
+import org.eclipse.emf.cdo.common.model.CDOModelUtil;
+import org.eclipse.emf.cdo.common.model.CDOPackageManager;
+import org.eclipse.emf.cdo.common.model.resource.CDOFolderFeature;
+import org.eclipse.emf.cdo.common.model.resource.CDOResourceFolderClass;
+import org.eclipse.emf.cdo.common.model.resource.CDOResourcePackage;
+import org.eclipse.emf.cdo.internal.common.model.CDOFeatureImpl;
+
+/**
+ * @author Eike Stepper
+ */
+public class CDOFolderFeatureImpl extends CDOFeatureImpl implements CDOFolderFeature
+{
+ public CDOFolderFeatureImpl(CDOClass containingClass, CDOPackageManager packageManager)
+ {
+ super(containingClass, FEATURE_ID, NAME, new CDOClassProxy(CDOModelUtil.createClassRef(
+ CDOResourcePackage.PACKAGE_URI, CDOResourceFolderClass.CLASSIFIER_ID), packageManager), false, false);
+ }
+}
diff --git a/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/internal/common/model/resource/CDOPathFeatureImpl.java b/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/internal/common/model/resource/CDONameFeatureImpl.java
index f42709edb5..e4fbc9be58 100644
--- a/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/internal/common/model/resource/CDOPathFeatureImpl.java
+++ b/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/internal/common/model/resource/CDONameFeatureImpl.java
@@ -11,16 +11,16 @@
package org.eclipse.emf.cdo.internal.common.model.resource;
import org.eclipse.emf.cdo.common.model.CDOClass;
-import org.eclipse.emf.cdo.common.model.resource.CDOPathFeature;
+import org.eclipse.emf.cdo.common.model.resource.CDONameFeature;
import org.eclipse.emf.cdo.internal.common.model.CDOFeatureImpl;
import org.eclipse.emf.cdo.internal.common.model.CDOTypeImpl;
/**
* @author Eike Stepper
*/
-public class CDOPathFeatureImpl extends CDOFeatureImpl implements CDOPathFeature
+public class CDONameFeatureImpl extends CDOFeatureImpl implements CDONameFeature
{
- public CDOPathFeatureImpl(CDOClass containingClass)
+ public CDONameFeatureImpl(CDOClass containingClass)
{
super(containingClass, FEATURE_ID, NAME, CDOTypeImpl.STRING, false);
}
diff --git a/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/internal/common/model/resource/CDONodesFeatureImpl.java b/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/internal/common/model/resource/CDONodesFeatureImpl.java
new file mode 100644
index 0000000000..6d5e437a81
--- /dev/null
+++ b/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/internal/common/model/resource/CDONodesFeatureImpl.java
@@ -0,0 +1,32 @@
+/***************************************************************************
+ * 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.internal.common.model.resource;
+
+import org.eclipse.emf.cdo.common.model.CDOClass;
+import org.eclipse.emf.cdo.common.model.CDOClassProxy;
+import org.eclipse.emf.cdo.common.model.CDOModelUtil;
+import org.eclipse.emf.cdo.common.model.CDOPackageManager;
+import org.eclipse.emf.cdo.common.model.resource.CDONodesFeature;
+import org.eclipse.emf.cdo.common.model.resource.CDOResourceNodeClass;
+import org.eclipse.emf.cdo.common.model.resource.CDOResourcePackage;
+import org.eclipse.emf.cdo.internal.common.model.CDOFeatureImpl;
+
+/**
+ * @author Eike Stepper
+ */
+public class CDONodesFeatureImpl extends CDOFeatureImpl implements CDONodesFeature
+{
+ public CDONodesFeatureImpl(CDOClass containingClass, CDOPackageManager packageManager)
+ {
+ super(containingClass, FEATURE_ID, NAME, new CDOClassProxy(CDOModelUtil.createClassRef(
+ CDOResourcePackage.PACKAGE_URI, CDOResourceNodeClass.CLASSIFIER_ID), packageManager), true, true);
+ }
+}
diff --git a/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/internal/common/model/resource/CDOResourceClassImpl.java b/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/internal/common/model/resource/CDOResourceClassImpl.java
index ec747c5195..9127c66168 100644
--- a/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/internal/common/model/resource/CDOResourceClassImpl.java
+++ b/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/internal/common/model/resource/CDOResourceClassImpl.java
@@ -10,9 +10,13 @@
**************************************************************************/
package org.eclipse.emf.cdo.internal.common.model.resource;
+import org.eclipse.emf.cdo.common.model.CDOFeature;
+import org.eclipse.emf.cdo.common.model.CDOModelUtil;
import org.eclipse.emf.cdo.common.model.CDOPackage;
import org.eclipse.emf.cdo.common.model.CDOPackageManager;
import org.eclipse.emf.cdo.common.model.resource.CDOResourceClass;
+import org.eclipse.emf.cdo.common.model.resource.CDOResourceNodeClass;
+import org.eclipse.emf.cdo.common.model.resource.CDOResourcePackage;
import org.eclipse.emf.cdo.internal.common.model.CDOClassImpl;
/**
@@ -20,30 +24,46 @@ import org.eclipse.emf.cdo.internal.common.model.CDOClassImpl;
*/
public class CDOResourceClassImpl extends CDOClassImpl implements CDOResourceClass
{
- private CDOPathFeatureImpl cdoPathFeature;
-
private CDOContentsFeatureImpl cdoContentsFeature;
public CDOResourceClassImpl(CDOPackage containingPackage, CDOPackageManager packageManager)
{
super(containingPackage, CLASSIFIER_ID, NAME, false);
- addFeature(cdoPathFeature = new CDOPathFeatureImpl(this));
+ addSuperType(CDOModelUtil.createClassRef(CDOResourcePackage.PACKAGE_URI, CDOResourceNodeClass.CLASSIFIER_ID));
addFeature(cdoContentsFeature = new CDOContentsFeatureImpl(this, packageManager));
}
@Override
- public boolean isResource()
+ public boolean isResourceNode()
{
return true;
}
- public CDOPathFeatureImpl getCDOPathFeature()
+ @Override
+ public boolean isResourceFolder()
+ {
+ return false;
+ }
+
+ @Override
+ public boolean isResource()
{
- return cdoPathFeature;
+ return true;
}
public CDOContentsFeatureImpl getCDOContentsFeature()
{
return cdoContentsFeature;
}
+
+ @Override
+ public CDOFeature lookupFeature(int featureID)
+ {
+ if (featureID == 5)
+ {
+ return cdoContentsFeature;
+ }
+
+ return super.lookupFeature(featureID);
+ }
}
diff --git a/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/internal/common/model/resource/CDOResourceFolderClassImpl.java b/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/internal/common/model/resource/CDOResourceFolderClassImpl.java
new file mode 100644
index 0000000000..890756457a
--- /dev/null
+++ b/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/internal/common/model/resource/CDOResourceFolderClassImpl.java
@@ -0,0 +1,57 @@
+/***************************************************************************
+ * 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.internal.common.model.resource;
+
+import org.eclipse.emf.cdo.common.model.CDOModelUtil;
+import org.eclipse.emf.cdo.common.model.CDOPackage;
+import org.eclipse.emf.cdo.common.model.CDOPackageManager;
+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.internal.common.model.CDOClassImpl;
+
+/**
+ * @author Eike Stepper
+ */
+public class CDOResourceFolderClassImpl extends CDOClassImpl implements CDOResourceFolderClass
+{
+ private CDONodesFeatureImpl cdoNodesFeature;
+
+ public CDOResourceFolderClassImpl(CDOPackage containingPackage, CDOPackageManager packageManager)
+ {
+ super(containingPackage, CLASSIFIER_ID, NAME, false);
+ addSuperType(CDOModelUtil.createClassRef(CDOResourcePackage.PACKAGE_URI, CDOResourceNodeClass.CLASSIFIER_ID));
+ addFeature(cdoNodesFeature = new CDONodesFeatureImpl(this, packageManager));
+ }
+
+ @Override
+ public boolean isResourceNode()
+ {
+ return true;
+ }
+
+ @Override
+ public boolean isResourceFolder()
+ {
+ return true;
+ }
+
+ @Override
+ public boolean isResource()
+ {
+ return false;
+ }
+
+ public CDONodesFeatureImpl getCDONodesFeature()
+ {
+ return cdoNodesFeature;
+ }
+}
diff --git a/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/internal/common/model/resource/CDOResourceNodeClassImpl.java b/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/internal/common/model/resource/CDOResourceNodeClassImpl.java
new file mode 100644
index 0000000000..c62bc5fdcd
--- /dev/null
+++ b/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/internal/common/model/resource/CDOResourceNodeClassImpl.java
@@ -0,0 +1,61 @@
+/***************************************************************************
+ * 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.internal.common.model.resource;
+
+import org.eclipse.emf.cdo.common.model.CDOPackage;
+import org.eclipse.emf.cdo.common.model.CDOPackageManager;
+import org.eclipse.emf.cdo.common.model.resource.CDOResourceNodeClass;
+import org.eclipse.emf.cdo.internal.common.model.CDOClassImpl;
+
+/**
+ * @author Eike Stepper
+ */
+public class CDOResourceNodeClassImpl extends CDOClassImpl implements CDOResourceNodeClass
+{
+ private CDOFolderFeatureImpl cdoFolderFeature;
+
+ private CDONameFeatureImpl cdoNameFeature;
+
+ public CDOResourceNodeClassImpl(CDOPackage containingPackage, CDOPackageManager packageManager)
+ {
+ super(containingPackage, CLASSIFIER_ID, NAME, true);
+ addFeature(cdoFolderFeature = new CDOFolderFeatureImpl(this, packageManager));
+ addFeature(cdoNameFeature = new CDONameFeatureImpl(this));
+ }
+
+ @Override
+ public boolean isResourceNode()
+ {
+ return true;
+ }
+
+ @Override
+ public boolean isResourceFolder()
+ {
+ return false;
+ }
+
+ @Override
+ public boolean isResource()
+ {
+ return false;
+ }
+
+ public CDOFolderFeatureImpl getCDOFolderFeature()
+ {
+ return cdoFolderFeature;
+ }
+
+ public CDONameFeatureImpl getCDONameFeature()
+ {
+ return cdoNameFeature;
+ }
+}
diff --git a/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/internal/common/model/resource/CDOResourcePackageImpl.java b/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/internal/common/model/resource/CDOResourcePackageImpl.java
index f1ac7bf14c..4998ca4f08 100644
--- a/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/internal/common/model/resource/CDOResourcePackageImpl.java
+++ b/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/internal/common/model/resource/CDOResourcePackageImpl.java
@@ -19,14 +19,30 @@ import org.eclipse.emf.cdo.internal.common.model.CDOPackageManagerImpl;
*/
public final class CDOResourcePackageImpl extends CDOPackageImpl implements CDOResourcePackage
{
+ private CDOResourceNodeClassImpl cdoResourceNodeClass;
+
+ private CDOResourceFolderClassImpl cdoResourceFolderClass;
+
private CDOResourceClassImpl cdoResourceClass;
public CDOResourcePackageImpl(CDOPackageManagerImpl packageManager)
{
super(packageManager, PACKAGE_URI, NAME, null, false, null, null);
+ addClass(cdoResourceNodeClass = new CDOResourceNodeClassImpl(this, packageManager));
+ addClass(cdoResourceFolderClass = new CDOResourceFolderClassImpl(this, packageManager));
addClass(cdoResourceClass = new CDOResourceClassImpl(this, packageManager));
}
+ public CDOResourceFolderClassImpl getCDOResourceFolderClass()
+ {
+ return cdoResourceFolderClass;
+ }
+
+ public CDOResourceNodeClassImpl getCDOResourceNodeClass()
+ {
+ return cdoResourceNodeClass;
+ }
+
public CDOResourceClassImpl getCDOResourceClass()
{
return cdoResourceClass;
diff --git a/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/internal/common/revision/CDORevisionImpl.java b/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/internal/common/revision/CDORevisionImpl.java
index b83043af65..397e0559d1 100644
--- a/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/internal/common/revision/CDORevisionImpl.java
+++ b/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/internal/common/revision/CDORevisionImpl.java
@@ -73,6 +73,16 @@ public class CDORevisionImpl implements InternalCDORevision
public CDORevisionImpl(CDOClass cdoClass, CDOID id)
{
+ if (cdoClass.isAbstract())
+ {
+ throw new IllegalArgumentException("CDOClass is abstract: " + cdoClass);
+ }
+
+ if (id == null || id.isNull())
+ {
+ throw new IllegalArgumentException("CDIID is null");
+ }
+
this.cdoClass = cdoClass;
this.id = id;
version = 0;
@@ -104,8 +114,12 @@ public class CDORevisionImpl implements InternalCDORevision
id = in.readCDOID();
version = in.readInt();
- created = in.readLong();
- revised = in.readLong();
+ if (!id.isTemporary())
+ {
+ created = in.readLong();
+ revised = in.readLong();
+ }
+
resourceID = in.readCDOID();
containerID = in.readCDOID();
containingFeatureID = in.readInt();
@@ -137,8 +151,12 @@ public class CDORevisionImpl implements InternalCDORevision
out.writeCDOClassRef(classRef);
out.writeCDOID(id);
out.writeInt(getVersion());
- out.writeLong(created);
- out.writeLong(revised);
+ if (!id.isTemporary())
+ {
+ out.writeLong(created);
+ out.writeLong(revised);
+ }
+
out.writeCDOID(resourceID);
Object newContainerID = out.getIDProvider().provideCDOID(containerID);
out.writeCDOID((CDOID)newContainerID);
@@ -253,6 +271,16 @@ public class CDORevisionImpl implements InternalCDORevision
return (revised == UNSPECIFIED_DATE || revised >= timeStamp) && timeStamp >= created;
}
+ public boolean isResourceNode()
+ {
+ return cdoClass.isResourceNode();
+ }
+
+ public boolean isResourceFolder()
+ {
+ return cdoClass.isResourceFolder();
+ }
+
public boolean isResource()
{
return cdoClass.isResource();
diff --git a/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/internal/common/revision/CDORevisionResolverImpl.java b/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/internal/common/revision/CDORevisionResolverImpl.java
index d08b908d24..34c1cca569 100644
--- a/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/internal/common/revision/CDORevisionResolverImpl.java
+++ b/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/internal/common/revision/CDORevisionResolverImpl.java
@@ -14,7 +14,7 @@ package org.eclipse.emf.cdo.internal.common.revision;
import org.eclipse.emf.cdo.common.id.CDOID;
import org.eclipse.emf.cdo.common.model.CDOClass;
-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.revision.CDORevisionResolver;
import org.eclipse.emf.cdo.common.revision.cache.CDORevisionCache;
@@ -214,26 +214,9 @@ public abstract class CDORevisionResolverImpl extends Lifecycle implements CDORe
return revisions;
}
- public CDOID getResourceID(String path, long timeStamp)
+ public CDOID getResourceID(CDOID folderID, String name, long timeStamp)
{
- return cache.getResourceID(path, timeStamp);
- }
-
- public String getResourcePath(CDOID id, long timeStamp)
- {
- InternalCDORevision revision = getRevisionByTime(id, CDORevision.UNCHUNKED, timeStamp, false);
- if (revision == null)
- {
- return null;
- }
-
- if (!revision.isResource())
- {
- throw new IllegalStateException("Revision is not a resource: " + revision);
- }
-
- CDOFeature pathFeature = getResourcePathFeature();
- return (String)revision.getValue(pathFeature);
+ return cache.getResourceID(folderID, name, timeStamp);
}
public List<CDORevision> getCachedRevisions()
@@ -285,7 +268,7 @@ public abstract class CDORevisionResolverImpl extends Lifecycle implements CDORe
protected abstract List<InternalCDORevision> loadRevisionsByTime(Collection<CDOID> ids, int referenceChunk,
long timeStamp);
- protected abstract CDOFeature getResourcePathFeature();
+ protected abstract CDOPackageManager getPackageManager();
@Override
protected void doBeforeActivate() throws Exception
@@ -301,7 +284,7 @@ public abstract class CDORevisionResolverImpl extends Lifecycle implements CDORe
protected void doActivate() throws Exception
{
super.doActivate();
- cache.setResourcePathFeature(getResourcePathFeature());
+ cache.setPackageManager(getPackageManager());
LifecycleUtil.activate(cache);
}
diff --git a/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/internal/common/revision/cache/lru/LRURevisionCache.java b/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/internal/common/revision/cache/lru/LRURevisionCache.java
index d4f7708b81..cac8de1432 100644
--- a/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/internal/common/revision/cache/lru/LRURevisionCache.java
+++ b/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/internal/common/revision/cache/lru/LRURevisionCache.java
@@ -13,8 +13,11 @@
package org.eclipse.emf.cdo.internal.common.revision.cache.lru;
import org.eclipse.emf.cdo.common.id.CDOID;
+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.CDOPackageManager;
+import org.eclipse.emf.cdo.common.model.resource.CDONameFeature;
+import org.eclipse.emf.cdo.common.model.resource.CDOResourceNodeClass;
import org.eclipse.emf.cdo.common.revision.CDORevision;
import org.eclipse.emf.cdo.common.revision.cache.CDORevisionCache;
import org.eclipse.emf.cdo.internal.common.bundle.OM;
@@ -40,7 +43,7 @@ public class LRURevisionCache extends Lifecycle implements CDORevisionCache
private Map<CDOID, RevisionHolder> revisions = new HashMap<CDOID, RevisionHolder>();
- private CDOFeature resourcePathFeature;
+ private CDOPackageManager packageManager;
private int capacityCurrent;
@@ -50,18 +53,25 @@ public class LRURevisionCache extends Lifecycle implements CDORevisionCache
private LRU revisedLRU;
+ private transient CDONameFeature cdoNameFeature;
+
public LRURevisionCache()
{
}
- public CDOFeature getResourcePathFeature()
+ public CDOPackageManager getPackageManager()
{
- return resourcePathFeature;
+ return packageManager;
}
- public void setResourcePathFeature(CDOFeature resourcePathFeature)
+ public void setPackageManager(CDOPackageManager packageManager)
{
- this.resourcePathFeature = resourcePathFeature;
+ this.packageManager = packageManager;
+ if (packageManager != null)
+ {
+ CDOResourceNodeClass resourceNodeClass = packageManager.getCDOResourcePackage().getCDOResourceNodeClass();
+ cdoNameFeature = resourceNodeClass.getCDONameFeature();
+ }
}
public int getCapacityCurrent()
@@ -245,7 +255,7 @@ public class LRURevisionCache extends Lifecycle implements CDORevisionCache
return lookupHolder != null;
}
- public synchronized CDOID getResourceID(String path, long timeStamp)
+ public synchronized CDOID getResourceID(CDOID folderID, String name, long timeStamp)
{
CDOID[] ids = getRevisionIDs();
for (CDOID id : ids)
@@ -254,15 +264,19 @@ public class LRURevisionCache extends Lifecycle implements CDORevisionCache
if (holder != null)
{
InternalCDORevision revision = holder.getRevision();
- if (revision.isResource())
+ if (revision.isResourceNode())
{
revision = getRevisionByTime(holder, timeStamp);
if (revision != null)
{
- String revisionPath = (String)revision.getValue(resourcePathFeature);
- if (ObjectUtil.equals(revisionPath, path))
+ CDOID revisionFolderID = (CDOID)revision.getContainerID();
+ if (CDOIDUtil.equals(revisionFolderID, folderID))
{
- return revision.getID();
+ String revisionName = (String)revision.getValue(cdoNameFeature);
+ if (ObjectUtil.equals(revisionName, name))
+ {
+ return revision.getID();
+ }
}
}
}
diff --git a/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/internal/common/revision/cache/mem/MEMRevisionCache.java b/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/internal/common/revision/cache/mem/MEMRevisionCache.java
index 3610d9e068..d8ccfa0ad4 100644
--- a/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/internal/common/revision/cache/mem/MEMRevisionCache.java
+++ b/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/internal/common/revision/cache/mem/MEMRevisionCache.java
@@ -16,7 +16,9 @@ import org.eclipse.emf.cdo.common.id.CDOID;
import org.eclipse.emf.cdo.common.id.CDOIDAndVersion;
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.CDOPackageManager;
+import org.eclipse.emf.cdo.common.model.resource.CDONameFeature;
+import org.eclipse.emf.cdo.common.model.resource.CDOResourceNodeClass;
import org.eclipse.emf.cdo.common.revision.CDORevision;
import org.eclipse.emf.cdo.common.revision.cache.CDORevisionCache;
import org.eclipse.emf.cdo.internal.common.bundle.OM;
@@ -50,12 +52,14 @@ public class MEMRevisionCache extends ReferenceQueueWorker<InternalCDORevision>
{
private static final ContextTracer TRACER = new ContextTracer(OM.DEBUG_REVISION, MEMRevisionCache.class);
- private CDOFeature resourcePathFeature;
+ private CDOPackageManager packageManager;
private Map<CDOID, CacheList> cacheLists = new HashMap<CDOID, CacheList>();
private ReferenceType referenceType;
+ private transient CDONameFeature cdoNameFeature;
+
public MEMRevisionCache(ReferenceType referenceType)
{
this.referenceType = referenceType;
@@ -66,14 +70,19 @@ public class MEMRevisionCache extends ReferenceQueueWorker<InternalCDORevision>
this(ReferenceType.SOFT);
}
- public CDOFeature getResourcePathFeature()
+ public CDOPackageManager getPackageManager()
{
- return resourcePathFeature;
+ return packageManager;
}
- public void setResourcePathFeature(CDOFeature resourcePathFeature)
+ public void setPackageManager(CDOPackageManager packageManager)
{
- this.resourcePathFeature = resourcePathFeature;
+ this.packageManager = packageManager;
+ if (packageManager != null)
+ {
+ CDOResourceNodeClass resourceNodeClass = packageManager.getCDOResourcePackage().getCDOResourceNodeClass();
+ cdoNameFeature = resourceNodeClass.getCDONameFeature();
+ }
}
public ReferenceType getReferenceType()
@@ -190,7 +199,7 @@ public class MEMRevisionCache extends ReferenceQueueWorker<InternalCDORevision>
return null;
}
- public CDOID getResourceID(String path, long timeStamp)
+ public CDOID getResourceID(CDOID folderID, String name, long timeStamp)
{
CDOID[] ids = getRevisionIDs();
for (CDOID id : ids)
@@ -200,7 +209,7 @@ public class MEMRevisionCache extends ReferenceQueueWorker<InternalCDORevision>
CacheList list = cacheLists.get(id);
if (list != null)
{
- return list.getResourceID(path, timeStamp);
+ return list.getResourceID(folderID, name, timeStamp);
}
}
}
@@ -331,15 +340,19 @@ public class MEMRevisionCache extends ReferenceQueueWorker<InternalCDORevision>
return getRevisionByTime(timeStamp, false);
}
- public CDOID getResourceID(String path, long timeStamp)
+ public CDOID getResourceID(CDOID folderID, String name, long timeStamp)
{
InternalCDORevision revision = getRevisionByTime(timeStamp, true);
if (revision != null)
{
- String revisionPath = (String)revision.getValue(resourcePathFeature);
- if (ObjectUtil.equals(revisionPath, path))
+ CDOID revisionFolderID = (CDOID)revision.getContainerID();
+ if (CDOIDUtil.equals(revisionFolderID, folderID))
{
- return revision.getID();
+ String revisionName = (String)revision.getValue(cdoNameFeature);
+ if (ObjectUtil.equals(revisionName, name))
+ {
+ return revision.getID();
+ }
}
}
diff --git a/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/internal/common/revision/cache/two/TwoLevelRevisionCache.java b/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/internal/common/revision/cache/two/TwoLevelRevisionCache.java
index 796f3d8d05..ad50da602b 100644
--- a/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/internal/common/revision/cache/two/TwoLevelRevisionCache.java
+++ b/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/internal/common/revision/cache/two/TwoLevelRevisionCache.java
@@ -14,7 +14,7 @@ package org.eclipse.emf.cdo.internal.common.revision.cache.two;
import org.eclipse.emf.cdo.common.id.CDOID;
import org.eclipse.emf.cdo.common.model.CDOClass;
-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.revision.cache.CDORevisionCache;
import org.eclipse.emf.cdo.internal.common.bundle.OM;
@@ -36,7 +36,7 @@ public class TwoLevelRevisionCache extends Lifecycle implements CDORevisionCache
{
private static final ContextTracer TRACER = new ContextTracer(OM.DEBUG_REVISION, TwoLevelRevisionCache.class);
- private CDOFeature resourcePathFeature;
+ private CDOPackageManager packageManager;
private CDORevisionCache level1;
@@ -46,22 +46,22 @@ public class TwoLevelRevisionCache extends Lifecycle implements CDORevisionCache
{
}
- public CDOFeature getResourcePathFeature()
+ public CDOPackageManager getPackageManager()
{
- return resourcePathFeature;
+ return packageManager;
}
- public void setResourcePathFeature(CDOFeature resourcePathFeature)
+ public void setPackageManager(CDOPackageManager packageManager)
{
- this.resourcePathFeature = resourcePathFeature;
+ this.packageManager = packageManager;
if (level1 != null)
{
- level1.setResourcePathFeature(resourcePathFeature);
+ level1.setPackageManager(packageManager);
}
if (level2 != null)
{
- level2.setResourcePathFeature(resourcePathFeature);
+ level2.setPackageManager(packageManager);
}
}
@@ -73,7 +73,7 @@ public class TwoLevelRevisionCache extends Lifecycle implements CDORevisionCache
public void setLevel1(CDORevisionCache level1)
{
this.level1 = level1;
- setResourcePathFeature(resourcePathFeature);
+ setPackageManager(packageManager);
}
public CDORevisionCache getLevel2()
@@ -84,7 +84,7 @@ public class TwoLevelRevisionCache extends Lifecycle implements CDORevisionCache
public void setLevel2(CDORevisionCache level2)
{
this.level2 = level2;
- setResourcePathFeature(resourcePathFeature);
+ setPackageManager(packageManager);
}
public CDOClass getObjectType(CDOID id)
@@ -149,12 +149,12 @@ public class TwoLevelRevisionCache extends Lifecycle implements CDORevisionCache
return revision;
}
- public CDOID getResourceID(String path, long timeStamp)
+ public CDOID getResourceID(CDOID folderID, String name, long timeStamp)
{
- CDOID id = level1.getResourceID(path, timeStamp);
+ CDOID id = level1.getResourceID(folderID, name, timeStamp);
if (id == null)
{
- id = level2.getResourceID(path, timeStamp);
+ id = level2.getResourceID(folderID, name, timeStamp);
}
return id;
diff --git a/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/spi/common/AbstractCDOIDLong.java b/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/spi/common/AbstractCDOIDLong.java
index 5b21e48ba4..85bb390b73 100644
--- a/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/spi/common/AbstractCDOIDLong.java
+++ b/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/spi/common/AbstractCDOIDLong.java
@@ -22,6 +22,11 @@ import java.io.IOException;
*/
public abstract class AbstractCDOIDLong extends AbstractCDOID implements Comparable<AbstractCDOIDLong>
{
+ /**
+ * @since 2.0
+ */
+ public static final long NULL_VALUE = 0L;
+
private static final long serialVersionUID = 1L;
private long value;
@@ -32,9 +37,9 @@ public abstract class AbstractCDOIDLong extends AbstractCDOID implements Compara
public AbstractCDOIDLong(long value)
{
- if (value == 0L)
+ if (value == NULL_VALUE)
{
- throw new IllegalArgumentException("value == 0L");
+ throw new IllegalArgumentException("value == NULL_VALUE");
}
this.value = value;
diff --git a/plugins/org.eclipse.emf.cdo.edit/.settings/.api_filters b/plugins/org.eclipse.emf.cdo.edit/.settings/.api_filters
new file mode 100644
index 0000000000..bdcdcb9fb8
--- /dev/null
+++ b/plugins/org.eclipse.emf.cdo.edit/.settings/.api_filters
@@ -0,0 +1,15 @@
+<?xml version="1.0" encoding="UTF-8" standalone="no"?>
+<component id="org.eclipse.emf.cdo.edit" version="2">
+ <resource path="src/org/eclipse/emf/cdo/eresource/provider/EresourceItemProviderAdapterFactory.java" type="org.eclipse.emf.cdo.eresource.provider.EresourceItemProviderAdapterFactory">
+ <filter id="1143996420">
+ <message_arguments>
+ <message_argument value="cdoResourceFolderItemProvider"/>
+ </message_arguments>
+ </filter>
+ <filter id="1143996420">
+ <message_arguments>
+ <message_argument value="createCDOResourceFolderAdapter()"/>
+ </message_arguments>
+ </filter>
+ </resource>
+</component>
diff --git a/plugins/org.eclipse.emf.cdo.edit/icons/full/ctool16/CreateCDOResourceFolder_contents_CDOResource.gif b/plugins/org.eclipse.emf.cdo.edit/icons/full/ctool16/CreateCDOResourceFolder_contents_CDOResource.gif
new file mode 100644
index 0000000000..9d64092d8d
--- /dev/null
+++ b/plugins/org.eclipse.emf.cdo.edit/icons/full/ctool16/CreateCDOResourceFolder_contents_CDOResource.gif
Binary files differ
diff --git a/plugins/org.eclipse.emf.cdo.edit/icons/full/ctool16/CreateCDOResourceFolder_contents_CDOResourceFolder.gif b/plugins/org.eclipse.emf.cdo.edit/icons/full/ctool16/CreateCDOResourceFolder_contents_CDOResourceFolder.gif
new file mode 100644
index 0000000000..2c76ed1e2d
--- /dev/null
+++ b/plugins/org.eclipse.emf.cdo.edit/icons/full/ctool16/CreateCDOResourceFolder_contents_CDOResourceFolder.gif
Binary files differ
diff --git a/plugins/org.eclipse.emf.cdo.edit/icons/full/ctool16/CreateCDOResourceFolder_nodes_CDOResource.gif b/plugins/org.eclipse.emf.cdo.edit/icons/full/ctool16/CreateCDOResourceFolder_nodes_CDOResource.gif
new file mode 100644
index 0000000000..9d64092d8d
--- /dev/null
+++ b/plugins/org.eclipse.emf.cdo.edit/icons/full/ctool16/CreateCDOResourceFolder_nodes_CDOResource.gif
Binary files differ
diff --git a/plugins/org.eclipse.emf.cdo.edit/icons/full/ctool16/CreateCDOResourceFolder_nodes_CDOResourceFolder.gif b/plugins/org.eclipse.emf.cdo.edit/icons/full/ctool16/CreateCDOResourceFolder_nodes_CDOResourceFolder.gif
new file mode 100644
index 0000000000..2c76ed1e2d
--- /dev/null
+++ b/plugins/org.eclipse.emf.cdo.edit/icons/full/ctool16/CreateCDOResourceFolder_nodes_CDOResourceFolder.gif
Binary files differ
diff --git a/plugins/org.eclipse.emf.cdo.edit/icons/full/obj16/CDOResourceFolder.gif b/plugins/org.eclipse.emf.cdo.edit/icons/full/obj16/CDOResourceFolder.gif
new file mode 100644
index 0000000000..480c478072
--- /dev/null
+++ b/plugins/org.eclipse.emf.cdo.edit/icons/full/obj16/CDOResourceFolder.gif
Binary files differ
diff --git a/plugins/org.eclipse.emf.cdo.edit/plugin.properties b/plugins/org.eclipse.emf.cdo.edit/plugin.properties
index a65712bce7..f4e7c4ae7b 100644
--- a/plugins/org.eclipse.emf.cdo.edit/plugin.properties
+++ b/plugins/org.eclipse.emf.cdo.edit/plugin.properties
@@ -49,3 +49,10 @@ _UI_Unknown_feature = Unspecified
# The above properties have been shipped for translation.
# ==============================================================================
_UI_CDOResource_timeStamp_feature = Time Stamp
+_UI_CDOResourceNode_type = CDO Resource Node
+_UI_CDOResourceFolder_type = CDO Resource Folder
+_UI_CDOResourceNode_folder_feature = Folder
+_UI_CDOResourceNode_name_feature = Name
+_UI_CDOResourceNode_path_feature = Path
+_UI_CDOResourceFolder_contents_feature = Contents
+_UI_CDOResourceFolder_nodes_feature = Nodes
diff --git a/plugins/org.eclipse.emf.cdo.edit/src/org/eclipse/emf/cdo/eresource/provider/CDOResourceFolderItemProvider.java b/plugins/org.eclipse.emf.cdo.edit/src/org/eclipse/emf/cdo/eresource/provider/CDOResourceFolderItemProvider.java
new file mode 100644
index 0000000000..9a648ee90c
--- /dev/null
+++ b/plugins/org.eclipse.emf.cdo.edit/src/org/eclipse/emf/cdo/eresource/provider/CDOResourceFolderItemProvider.java
@@ -0,0 +1,158 @@
+/**
+ * <copyright>
+ * </copyright>
+ *
+ * $Id: CDOResourceFolderItemProvider.java,v 1.2 2008-10-19 01:29:03 smcduff Exp $
+ */
+package org.eclipse.emf.cdo.eresource.provider;
+
+import org.eclipse.emf.cdo.eresource.CDOResourceFolder;
+import org.eclipse.emf.cdo.eresource.EresourceFactory;
+import org.eclipse.emf.cdo.eresource.EresourcePackage;
+
+import org.eclipse.emf.common.notify.AdapterFactory;
+import org.eclipse.emf.common.notify.Notification;
+import org.eclipse.emf.ecore.EStructuralFeature;
+import org.eclipse.emf.edit.provider.IEditingDomainItemProvider;
+import org.eclipse.emf.edit.provider.IItemLabelProvider;
+import org.eclipse.emf.edit.provider.IItemPropertyDescriptor;
+import org.eclipse.emf.edit.provider.IItemPropertySource;
+import org.eclipse.emf.edit.provider.IStructuredItemContentProvider;
+import org.eclipse.emf.edit.provider.ITreeItemContentProvider;
+import org.eclipse.emf.edit.provider.ViewerNotification;
+
+import java.util.Collection;
+import java.util.List;
+
+/**
+ * This is the item provider adapter for a {@link org.eclipse.emf.cdo.eresource.CDOResourceFolder} object. <!--
+ * begin-user-doc --> <!-- end-user-doc -->
+ *
+ * @generated
+ * @since 2.0
+ */
+public class CDOResourceFolderItemProvider extends CDOResourceNodeItemProvider implements IEditingDomainItemProvider,
+ IStructuredItemContentProvider, ITreeItemContentProvider, IItemLabelProvider, IItemPropertySource
+{
+ /**
+ * This constructs an instance from a factory and a notifier. <!-- begin-user-doc --> <!-- end-user-doc -->
+ *
+ * @generated
+ */
+ public CDOResourceFolderItemProvider(AdapterFactory adapterFactory)
+ {
+ super(adapterFactory);
+ }
+
+ /**
+ * This returns the property descriptors for the adapted class. <!-- begin-user-doc --> <!-- end-user-doc -->
+ *
+ * @generated
+ */
+ @Override
+ public List<IItemPropertyDescriptor> getPropertyDescriptors(Object object)
+ {
+ if (itemPropertyDescriptors == null)
+ {
+ super.getPropertyDescriptors(object);
+
+ }
+ return itemPropertyDescriptors;
+ }
+
+ /**
+ * This specifies how to implement {@link #getChildren} and is used to deduce an appropriate feature for an
+ * {@link org.eclipse.emf.edit.command.AddCommand}, {@link org.eclipse.emf.edit.command.RemoveCommand} or
+ * {@link org.eclipse.emf.edit.command.MoveCommand} in {@link #createCommand}. <!-- begin-user-doc --> <!--
+ * end-user-doc -->
+ *
+ * @generated
+ */
+ @Override
+ public Collection<? extends EStructuralFeature> getChildrenFeatures(Object object)
+ {
+ if (childrenFeatures == null)
+ {
+ super.getChildrenFeatures(object);
+ childrenFeatures.add(EresourcePackage.Literals.CDO_RESOURCE_FOLDER__NODES);
+ }
+ return childrenFeatures;
+ }
+
+ /**
+ * <!-- begin-user-doc --> <!-- end-user-doc -->
+ *
+ * @generated
+ */
+ @Override
+ protected EStructuralFeature getChildFeature(Object object, Object child)
+ {
+ // Check the type of the specified child object and return the proper feature to use for
+ // adding (see {@link AddCommand}) it as a child.
+
+ return super.getChildFeature(object, child);
+ }
+
+ /**
+ * This returns CDOResourceFolder.gif. <!-- begin-user-doc --> <!-- end-user-doc -->
+ *
+ * @generated
+ */
+ @Override
+ public Object getImage(Object object)
+ {
+ return overlayImage(object, getResourceLocator().getImage("full/obj16/CDOResourceFolder"));
+ }
+
+ /**
+ * This returns the label text for the adapted class. <!-- begin-user-doc --> <!-- end-user-doc -->
+ *
+ * @generated
+ */
+ @Override
+ public String getText(Object object)
+ {
+ String label = ((CDOResourceFolder)object).getName();
+ return label == null || label.length() == 0 ? getString("_UI_CDOResourceFolder_type")
+ : getString("_UI_CDOResourceFolder_type") + " " + label;
+ }
+
+ /**
+ * This handles model notifications by calling {@link #updateChildren} to update any cached children and by creating a
+ * viewer notification, which it passes to {@link #fireNotifyChanged}. <!-- begin-user-doc --> <!-- end-user-doc -->
+ *
+ * @generated
+ */
+ @Override
+ public void notifyChanged(Notification notification)
+ {
+ updateChildren(notification);
+
+ switch (notification.getFeatureID(CDOResourceFolder.class))
+ {
+ case EresourcePackage.CDO_RESOURCE_FOLDER__NODES:
+ fireNotifyChanged(new ViewerNotification(notification, notification.getNotifier(), true, false));
+ return;
+ }
+ super.notifyChanged(notification);
+ }
+
+ /**
+ * This adds {@link org.eclipse.emf.edit.command.CommandParameter}s describing the children that can be created under
+ * this object. <!-- begin-user-doc --> <!-- end-user-doc -->
+ *
+ * @generated
+ */
+ @Override
+ protected void collectNewChildDescriptors(Collection<Object> newChildDescriptors, Object object)
+ {
+ super.collectNewChildDescriptors(newChildDescriptors, object);
+
+ newChildDescriptors.add(createChildParameter(EresourcePackage.Literals.CDO_RESOURCE_FOLDER__NODES,
+ EresourceFactory.eINSTANCE.createCDOResourceFolder()));
+
+ newChildDescriptors.add(createChildParameter(EresourcePackage.Literals.CDO_RESOURCE_FOLDER__NODES,
+ EresourceFactory.eINSTANCE.createCDOResource()));
+ }
+
+}
diff --git a/plugins/org.eclipse.emf.cdo.edit/src/org/eclipse/emf/cdo/eresource/provider/CDOResourceItemProvider.java b/plugins/org.eclipse.emf.cdo.edit/src/org/eclipse/emf/cdo/eresource/provider/CDOResourceItemProvider.java
index c191c8080e..1ff7b4dc5a 100644
--- a/plugins/org.eclipse.emf.cdo.edit/src/org/eclipse/emf/cdo/eresource/provider/CDOResourceItemProvider.java
+++ b/plugins/org.eclipse.emf.cdo.edit/src/org/eclipse/emf/cdo/eresource/provider/CDOResourceItemProvider.java
@@ -16,10 +16,8 @@ import org.eclipse.emf.cdo.eresource.EresourcePackage;
import org.eclipse.emf.common.notify.AdapterFactory;
import org.eclipse.emf.common.notify.Notification;
-import org.eclipse.emf.common.util.ResourceLocator;
import org.eclipse.emf.ecore.EStructuralFeature;
import org.eclipse.emf.edit.provider.ComposeableAdapterFactory;
-import org.eclipse.emf.edit.provider.IChildCreationExtender;
import org.eclipse.emf.edit.provider.IEditingDomainItemProvider;
import org.eclipse.emf.edit.provider.IItemLabelProvider;
import org.eclipse.emf.edit.provider.IItemPropertyDescriptor;
@@ -27,7 +25,6 @@ import org.eclipse.emf.edit.provider.IItemPropertySource;
import org.eclipse.emf.edit.provider.IStructuredItemContentProvider;
import org.eclipse.emf.edit.provider.ITreeItemContentProvider;
import org.eclipse.emf.edit.provider.ItemPropertyDescriptor;
-import org.eclipse.emf.edit.provider.ItemProviderAdapter;
import org.eclipse.emf.edit.provider.ViewerNotification;
import java.util.Collection;
@@ -39,7 +36,7 @@ import java.util.List;
*
* @generated
*/
-public class CDOResourceItemProvider extends ItemProviderAdapter implements IEditingDomainItemProvider,
+public class CDOResourceItemProvider extends CDOResourceNodeItemProvider implements IEditingDomainItemProvider,
IStructuredItemContentProvider, ITreeItemContentProvider, IItemLabelProvider, IItemPropertySource
{
/**
@@ -69,7 +66,6 @@ public class CDOResourceItemProvider extends ItemProviderAdapter implements IEdi
addLoadedPropertyDescriptor(object);
addTrackingModificationPropertyDescriptor(object);
addTimeStampPropertyDescriptor(object);
- addPathPropertyDescriptor(object);
}
return itemPropertyDescriptors;
}
@@ -146,20 +142,6 @@ public class CDOResourceItemProvider extends ItemProviderAdapter implements IEdi
}
/**
- * This adds a property descriptor for the Path feature. <!-- begin-user-doc --> <!-- end-user-doc -->
- *
- * @generated
- */
- protected void addPathPropertyDescriptor(Object object)
- {
- itemPropertyDescriptors.add(createItemPropertyDescriptor(((ComposeableAdapterFactory)adapterFactory)
- .getRootAdapterFactory(), getResourceLocator(), getString("_UI_CDOResource_path_feature"), getString(
- "_UI_PropertyDescriptor_description", "_UI_CDOResource_path_feature", "_UI_CDOResource_type"),
- EresourcePackage.Literals.CDO_RESOURCE__PATH, false, false, false, ItemPropertyDescriptor.GENERIC_VALUE_IMAGE,
- null, null));
- }
-
- /**
* This specifies how to implement {@link #getChildren} and is used to deduce an appropriate feature for an
* {@link org.eclipse.emf.edit.command.AddCommand}, {@link org.eclipse.emf.edit.command.RemoveCommand} or
* {@link org.eclipse.emf.edit.command.MoveCommand} in {@link #createCommand}. <!-- begin-user-doc --> <!--
@@ -236,7 +218,6 @@ public class CDOResourceItemProvider extends ItemProviderAdapter implements IEdi
case EresourcePackage.CDO_RESOURCE__ERRORS:
case EresourcePackage.CDO_RESOURCE__WARNINGS:
case EresourcePackage.CDO_RESOURCE__TIME_STAMP:
- case EresourcePackage.CDO_RESOURCE__PATH:
fireNotifyChanged(new ViewerNotification(notification, notification.getNotifier(), false, true));
return;
case EresourcePackage.CDO_RESOURCE__CONTENTS:
@@ -257,15 +238,4 @@ public class CDOResourceItemProvider extends ItemProviderAdapter implements IEdi
{
}
- /**
- * Return the resource locator for this item provider's resources. <!-- begin-user-doc --> <!-- end-user-doc -->
- *
- * @generated
- */
- @Override
- public ResourceLocator getResourceLocator()
- {
- return ((IChildCreationExtender)adapterFactory).getResourceLocator();
- }
-
}
diff --git a/plugins/org.eclipse.emf.cdo.edit/src/org/eclipse/emf/cdo/eresource/provider/CDOResourceNodeItemProvider.java b/plugins/org.eclipse.emf.cdo.edit/src/org/eclipse/emf/cdo/eresource/provider/CDOResourceNodeItemProvider.java
new file mode 100644
index 0000000000..2a759ccc3f
--- /dev/null
+++ b/plugins/org.eclipse.emf.cdo.edit/src/org/eclipse/emf/cdo/eresource/provider/CDOResourceNodeItemProvider.java
@@ -0,0 +1,153 @@
+/**
+ * <copyright>
+ * </copyright>
+ *
+ * $Id: CDOResourceNodeItemProvider.java,v 1.2 2008-10-19 01:29:03 smcduff Exp $
+ */
+package org.eclipse.emf.cdo.eresource.provider;
+
+import org.eclipse.emf.cdo.eresource.CDOResourceNode;
+import org.eclipse.emf.cdo.eresource.EresourcePackage;
+
+import org.eclipse.emf.common.notify.AdapterFactory;
+import org.eclipse.emf.common.notify.Notification;
+import org.eclipse.emf.common.util.ResourceLocator;
+import org.eclipse.emf.edit.provider.ComposeableAdapterFactory;
+import org.eclipse.emf.edit.provider.IChildCreationExtender;
+import org.eclipse.emf.edit.provider.IEditingDomainItemProvider;
+import org.eclipse.emf.edit.provider.IItemLabelProvider;
+import org.eclipse.emf.edit.provider.IItemPropertyDescriptor;
+import org.eclipse.emf.edit.provider.IItemPropertySource;
+import org.eclipse.emf.edit.provider.IStructuredItemContentProvider;
+import org.eclipse.emf.edit.provider.ITreeItemContentProvider;
+import org.eclipse.emf.edit.provider.ItemPropertyDescriptor;
+import org.eclipse.emf.edit.provider.ItemProviderAdapter;
+import org.eclipse.emf.edit.provider.ViewerNotification;
+
+import java.util.Collection;
+import java.util.List;
+
+/**
+ * This is the item provider adapter for a {@link org.eclipse.emf.cdo.eresource.CDOResourceNode} object. <!--
+ * begin-user-doc --> <!-- end-user-doc -->
+ *
+ * @generated
+ * @since 2.0
+ */
+public class CDOResourceNodeItemProvider extends ItemProviderAdapter implements IEditingDomainItemProvider,
+ IStructuredItemContentProvider, ITreeItemContentProvider, IItemLabelProvider, IItemPropertySource
+{
+ /**
+ * This constructs an instance from a factory and a notifier. <!-- begin-user-doc --> <!-- end-user-doc -->
+ *
+ * @generated
+ */
+ public CDOResourceNodeItemProvider(AdapterFactory adapterFactory)
+ {
+ super(adapterFactory);
+ }
+
+ /**
+ * This returns the property descriptors for the adapted class. <!-- begin-user-doc --> <!-- end-user-doc -->
+ *
+ * @generated
+ */
+ @Override
+ public List<IItemPropertyDescriptor> getPropertyDescriptors(Object object)
+ {
+ if (itemPropertyDescriptors == null)
+ {
+ super.getPropertyDescriptors(object);
+
+ addNamePropertyDescriptor(object);
+ addPathPropertyDescriptor(object);
+ }
+ return itemPropertyDescriptors;
+ }
+
+ /**
+ * This adds a property descriptor for the Name feature. <!-- begin-user-doc --> <!-- end-user-doc -->
+ *
+ * @generated
+ */
+ protected void addNamePropertyDescriptor(Object object)
+ {
+ itemPropertyDescriptors.add(createItemPropertyDescriptor(((ComposeableAdapterFactory)adapterFactory)
+ .getRootAdapterFactory(), getResourceLocator(), getString("_UI_CDOResourceNode_name_feature"), getString(
+ "_UI_PropertyDescriptor_description", "_UI_CDOResourceNode_name_feature", "_UI_CDOResourceNode_type"),
+ EresourcePackage.Literals.CDO_RESOURCE_NODE__NAME, true, false, false,
+ ItemPropertyDescriptor.GENERIC_VALUE_IMAGE, null, null));
+ }
+
+ /**
+ * This adds a property descriptor for the Path feature. <!-- begin-user-doc --> <!-- end-user-doc -->
+ *
+ * @generated
+ */
+ protected void addPathPropertyDescriptor(Object object)
+ {
+ itemPropertyDescriptors.add(createItemPropertyDescriptor(((ComposeableAdapterFactory)adapterFactory)
+ .getRootAdapterFactory(), getResourceLocator(), getString("_UI_CDOResourceNode_path_feature"), getString(
+ "_UI_PropertyDescriptor_description", "_UI_CDOResourceNode_path_feature", "_UI_CDOResourceNode_type"),
+ EresourcePackage.Literals.CDO_RESOURCE_NODE__PATH, false, false, false,
+ ItemPropertyDescriptor.GENERIC_VALUE_IMAGE, null, null));
+ }
+
+ /**
+ * This returns the label text for the adapted class. <!-- begin-user-doc --> <!-- end-user-doc -->
+ *
+ * @generated
+ */
+ @Override
+ public String getText(Object object)
+ {
+ String label = ((CDOResourceNode)object).getName();
+ return label == null || label.length() == 0 ? getString("_UI_CDOResourceNode_type")
+ : getString("_UI_CDOResourceNode_type") + " " + label;
+ }
+
+ /**
+ * This handles model notifications by calling {@link #updateChildren} to update any cached children and by creating a
+ * viewer notification, which it passes to {@link #fireNotifyChanged}. <!-- begin-user-doc --> <!-- end-user-doc -->
+ *
+ * @generated
+ */
+ @Override
+ public void notifyChanged(Notification notification)
+ {
+ updateChildren(notification);
+
+ switch (notification.getFeatureID(CDOResourceNode.class))
+ {
+ case EresourcePackage.CDO_RESOURCE_NODE__NAME:
+ case EresourcePackage.CDO_RESOURCE_NODE__PATH:
+ fireNotifyChanged(new ViewerNotification(notification, notification.getNotifier(), false, true));
+ return;
+ }
+ super.notifyChanged(notification);
+ }
+
+ /**
+ * This adds {@link org.eclipse.emf.edit.command.CommandParameter}s describing the children that can be created under
+ * this object. <!-- begin-user-doc --> <!-- end-user-doc -->
+ *
+ * @generated
+ */
+ @Override
+ protected void collectNewChildDescriptors(Collection<Object> newChildDescriptors, Object object)
+ {
+ super.collectNewChildDescriptors(newChildDescriptors, object);
+ }
+
+ /**
+ * Return the resource locator for this item provider's resources. <!-- begin-user-doc --> <!-- end-user-doc -->
+ *
+ * @generated
+ */
+ @Override
+ public ResourceLocator getResourceLocator()
+ {
+ return ((IChildCreationExtender)adapterFactory).getResourceLocator();
+ }
+
+}
diff --git a/plugins/org.eclipse.emf.cdo.edit/src/org/eclipse/emf/cdo/eresource/provider/EresourceItemProviderAdapterFactory.java b/plugins/org.eclipse.emf.cdo.edit/src/org/eclipse/emf/cdo/eresource/provider/EresourceItemProviderAdapterFactory.java
index 7c2ca9f185..60396a1a28 100644
--- a/plugins/org.eclipse.emf.cdo.edit/src/org/eclipse/emf/cdo/eresource/provider/EresourceItemProviderAdapterFactory.java
+++ b/plugins/org.eclipse.emf.cdo.edit/src/org/eclipse/emf/cdo/eresource/provider/EresourceItemProviderAdapterFactory.java
@@ -94,6 +94,31 @@ public class EresourceItemProviderAdapterFactory extends EresourceAdapterFactory
}
/**
+ * This keeps track of the one adapter used for all {@link org.eclipse.emf.cdo.eresource.CDOResourceFolder} instances.
+ * <!-- begin-user-doc --> <!-- end-user-doc -->
+ *
+ * @generated
+ */
+ protected CDOResourceFolderItemProvider cdoResourceFolderItemProvider;
+
+ /**
+ * This creates an adapter for a {@link org.eclipse.emf.cdo.eresource.CDOResourceFolder}. <!-- begin-user-doc --> <!--
+ * end-user-doc -->
+ *
+ * @generated
+ */
+ @Override
+ public Adapter createCDOResourceFolderAdapter()
+ {
+ if (cdoResourceFolderItemProvider == null)
+ {
+ cdoResourceFolderItemProvider = new CDOResourceFolderItemProvider(this);
+ }
+
+ return cdoResourceFolderItemProvider;
+ }
+
+ /**
* This keeps track of the one adapter used for all {@link org.eclipse.emf.cdo.eresource.CDOResource} instances. <!--
* begin-user-doc --> <!-- end-user-doc -->
*
@@ -254,6 +279,10 @@ public class EresourceItemProviderAdapterFactory extends EresourceAdapterFactory
*/
public void dispose()
{
+ if (cdoResourceFolderItemProvider != null)
+ {
+ cdoResourceFolderItemProvider.dispose();
+ }
if (cdoResourceItemProvider != null)
{
cdoResourceItemProvider.dispose();
diff --git a/plugins/org.eclipse.emf.cdo.server.db/src/org/eclipse/emf/cdo/server/db/IClassMapping.java b/plugins/org.eclipse.emf.cdo.server.db/src/org/eclipse/emf/cdo/server/db/IClassMapping.java
index cebe25994b..9265682fcf 100644
--- a/plugins/org.eclipse.emf.cdo.server.db/src/org/eclipse/emf/cdo/server/db/IClassMapping.java
+++ b/plugins/org.eclipse.emf.cdo.server.db/src/org/eclipse/emf/cdo/server/db/IClassMapping.java
@@ -33,6 +33,11 @@ public interface IClassMapping
public Set<IDBTable> getAffectedTables();
+ /**
+ * @since 2.0
+ */
+ public IFeatureMapping getFeatureMapping(CDOFeature feature);
+
public List<IAttributeMapping> getAttributeMappings();
public List<IReferenceMapping> getReferenceMappings();
diff --git a/plugins/org.eclipse.emf.cdo.server.db/src/org/eclipse/emf/cdo/server/db/IMappingStrategy.java b/plugins/org.eclipse.emf.cdo.server.db/src/org/eclipse/emf/cdo/server/db/IMappingStrategy.java
index 130f6a53a0..9f562e3d3d 100644
--- a/plugins/org.eclipse.emf.cdo.server.db/src/org/eclipse/emf/cdo/server/db/IMappingStrategy.java
+++ b/plugins/org.eclipse.emf.cdo.server.db/src/org/eclipse/emf/cdo/server/db/IMappingStrategy.java
@@ -15,6 +15,7 @@ import org.eclipse.emf.cdo.common.model.CDOClass;
import org.eclipse.emf.cdo.common.model.CDOClassRef;
import org.eclipse.emf.cdo.server.IStoreReader.QueryResourcesContext;
+import org.eclipse.net4j.db.IDBAdapter;
import org.eclipse.net4j.util.collection.CloseableIterator;
import java.sql.Connection;
@@ -55,6 +56,11 @@ public interface IMappingStrategy
/**
* @since 2.0
*/
+ public CDOClassRef getClassRef(IDBStoreReader storeReader, int classID);
+
+ /**
+ * @since 2.0
+ */
public CloseableIterator<CDOID> readObjectIDs(IDBStoreReader storeReader);
public CDOClassRef readObjectType(IDBStoreReader storeReader, CDOID id);
@@ -62,7 +68,7 @@ public interface IMappingStrategy
/**
* @since 2.0
*/
- public CDOID readResourceID(IDBStoreReader storeReader, String path, long timeStamp);
+ public CDOID readResourceID(IDBStoreReader storeReader, CDOID folderID, String name, long timeStamp);
/**
* @since 2.0
@@ -70,7 +76,14 @@ public interface IMappingStrategy
public void queryResources(IDBStoreReader storeReader, QueryResourcesContext context);
/**
- * Must return the maximum CDOID value .
+ * @since 2.0
+ */
+ public void createResourceTables(IDBAdapter dbAdapter, Connection connection);
+
+ /**
+ * Returns the maximum CDOID value.
+ *
+ * @since 2.0
*/
- public long repairAfterCrash(Connection connection);
+ public long repairAfterCrash(IDBAdapter dbAdapter, Connection connection);
}
diff --git a/plugins/org.eclipse.emf.cdo.server.db/src/org/eclipse/emf/cdo/server/internal/db/ClassMapping.java b/plugins/org.eclipse.emf.cdo.server.db/src/org/eclipse/emf/cdo/server/internal/db/ClassMapping.java
index 1f3c084b28..6f3cdd4900 100644
--- a/plugins/org.eclipse.emf.cdo.server.db/src/org/eclipse/emf/cdo/server/internal/db/ClassMapping.java
+++ b/plugins/org.eclipse.emf.cdo.server.db/src/org/eclipse/emf/cdo/server/internal/db/ClassMapping.java
@@ -15,13 +15,13 @@ 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.CDOType;
-import org.eclipse.emf.cdo.common.model.resource.CDOResourceClass;
import org.eclipse.emf.cdo.common.revision.CDORevision;
import org.eclipse.emf.cdo.server.db.IAttributeMapping;
import org.eclipse.emf.cdo.server.db.IClassMapping;
import org.eclipse.emf.cdo.server.db.IDBStore;
import org.eclipse.emf.cdo.server.db.IDBStoreReader;
import org.eclipse.emf.cdo.server.db.IDBStoreWriter;
+import org.eclipse.emf.cdo.server.db.IFeatureMapping;
import org.eclipse.emf.cdo.server.db.IReferenceMapping;
import org.eclipse.emf.cdo.server.internal.db.bundle.OM;
import org.eclipse.emf.cdo.spi.common.InternalCDORevision;
@@ -31,7 +31,6 @@ import org.eclipse.net4j.db.DBType;
import org.eclipse.net4j.db.DBUtil;
import org.eclipse.net4j.db.IDBAdapter;
import org.eclipse.net4j.db.ddl.IDBField;
-import org.eclipse.net4j.db.ddl.IDBIndex;
import org.eclipse.net4j.db.ddl.IDBTable;
import org.eclipse.net4j.util.ImplementationError;
import org.eclipse.net4j.util.ObjectUtil;
@@ -81,43 +80,38 @@ public abstract class ClassMapping implements IClassMapping
attributeMappings = createAttributeMappings(features);
referenceMappings = createReferenceMappings(features);
- // Special handling of CDOResource table
- CDOResourceClass resourceClass = getResourceClass();
- if (cdoClass == resourceClass)
- {
- // Create a unique ids to prevent duplicate resource paths
- for (IAttributeMapping attributeMapping : attributeMappings)
- {
- if (attributeMapping.getFeature() == resourceClass.getCDOPathFeature())
- {
- IDBField versionField = table.getField(CDODBSchema.ATTRIBUTES_VERSION);
- IDBField pathField = attributeMapping.getField();
- pathField.setPrecision(760);// MYSQL key limitation 767
- pathField.setNotNull(true);
-
- // TODO Provide better design for store capabilities and repository support
- // Example: Currently a store can not specify that it does not support non-auditing mode!
- if (false && !mappingStrategy.getStore().getRepository().isSupportingAudits())
- {
- // Create a unique ids to prevent duplicate resource paths
- table.addIndex(IDBIndex.Type.UNIQUE, versionField, pathField);
- }
-
- break;
- }
- }
- }
+ // // Special handling of CDOResource table
+ // CDOResourceClass resourceClass = getResourceClass();
+ // if (cdoClass == resourceClass)
+ // {
+ // // Create a unique ids to prevent duplicate resource paths
+ // for (IAttributeMapping attributeMapping : attributeMappings)
+ // {
+ // if (attributeMapping.getFeature() == resourceClass.getCDOPathFeature())
+ // {
+ // IDBField versionField = table.getField(CDODBSchema.ATTRIBUTES_VERSION);
+ // IDBField pathField = attributeMapping.getField();
+ // pathField.setPrecision(760);// MYSQL key limitation 767
+ // pathField.setNotNull(true);
+ //
+ // // TODO Provide better design for store capabilities and repository support
+ // // Example: Currently a store can not specify that it does not support non-auditing mode!
+ // if (false && !mappingStrategy.getStore().getRepository().isSupportingAudits())
+ // {
+ // // Create a unique ids to prevent duplicate resource paths
+ // table.addIndex(IDBIndex.Type.UNIQUE, versionField, pathField);
+ // }
+ //
+ // break;
+ // }
+ // }
+ // }
}
selectPrefix = createSelectPrefix(false);
selectPrefixWithVersion = createSelectPrefix(true);
}
- private CDOResourceClass getResourceClass()
- {
- return mappingStrategy.getStore().getRepository().getPackageManager().getCDOResourcePackage().getCDOResourceClass();
- }
-
public MappingStrategy getMappingStrategy()
{
return mappingStrategy;
@@ -325,6 +319,16 @@ public abstract class ClassMapping implements IClassMapping
return builder.toString();
}
+ public IFeatureMapping getFeatureMapping(CDOFeature feature)
+ {
+ if (feature.isReference() && mappingStrategy.getToMany() != ToMany.LIKE_ATTRIBUTES)
+ {
+ return getReferenceMapping(feature);
+ }
+
+ return getAttributeMapping(feature);
+ }
+
public List<IAttributeMapping> getAttributeMappings()
{
return attributeMappings;
@@ -463,25 +467,14 @@ public abstract class ClassMapping implements IClassMapping
public void writeRevision(IDBStoreWriter storeWriter, CDORevision revision)
{
- if (revision.getVersion() >= 2 && hasFullRevisionInfo())
+ if (revision.getVersion() > 1 && hasFullRevisionInfo())
{
writeRevisedRow(storeWriter, (InternalCDORevision)revision);
}
- if (revision.isResource())
+ if (revision.isResourceFolder() || revision.isResource())
{
- // TODO Provide better design for store capabilities and repository support
- // Example: Currently a store can not specify that it does not support non-auditing mode!
- if (true || mappingStrategy.getStore().getRepository().isSupportingAudits())
- {
- // If auditing is not supported this is checked by a table index (see constructor)
- CDOFeature resourcePathFeature = getResourceClass().getCDOPathFeature();
- String revisionPath = (String)revision.getData().get(resourcePathFeature, 0);
- if (mappingStrategy.readResourceID(storeWriter, revisionPath, revision.getCreated()) != null)
- {
- throw new IllegalStateException("Duplicate resource path: " + revisionPath);
- }
- }
+ checkDuplicateResources(storeWriter, revision);
}
if (attributeMappings != null)
@@ -495,6 +488,9 @@ public abstract class ClassMapping implements IClassMapping
}
}
+ protected abstract void checkDuplicateResources(IDBStoreReader storeReader, CDORevision revision)
+ throws IllegalStateException;
+
public void detachObject(IDBStoreWriter storeWriter, CDOID id, long revised)
{
if (hasFullRevisionInfo())
diff --git a/plugins/org.eclipse.emf.cdo.server.db/src/org/eclipse/emf/cdo/server/internal/db/ClassServerInfo.java b/plugins/org.eclipse.emf.cdo.server.db/src/org/eclipse/emf/cdo/server/internal/db/ClassServerInfo.java
index cdf76c7770..0342bb3af3 100644
--- a/plugins/org.eclipse.emf.cdo.server.db/src/org/eclipse/emf/cdo/server/internal/db/ClassServerInfo.java
+++ b/plugins/org.eclipse.emf.cdo.server.db/src/org/eclipse/emf/cdo/server/internal/db/ClassServerInfo.java
@@ -25,6 +25,10 @@ public final class ClassServerInfo extends ServerInfo
public static final int CDO_RESOURCE_CLASS_DBID = -2;
+ public static final int CDO_RESOURCE_NODE_CLASS_DBID = -3;
+
+ public static final int CDO_RESOURCE_FOLDER_CLASS_DBID = -4;
+
private IClassMapping classMapping;
private ClassServerInfo(int id)
@@ -39,8 +43,8 @@ public final class ClassServerInfo extends ServerInfo
return serverInfo;
}
- /**
- * Should only be called from {@link MappingStrategy#getClassMapping(CDOClass)}.
+ /*
+ * Should only be called from MappingStrategy#getClassMapping(CDOClass).
*/
public static IClassMapping getClassMapping(CDOClass cdoClass)
{
@@ -72,6 +76,15 @@ public final class ClassServerInfo extends ServerInfo
{
serverInfo = setDBID(cdoClass, CDO_RESOURCE_CLASS_DBID);
}
+ else if (cdoClass.isResourceFolder())
+ {
+ serverInfo = setDBID(cdoClass, CDO_RESOURCE_FOLDER_CLASS_DBID);
+ }
+ else if (cdoClass.isResourceNode())
+ {
+ // Important to check the abstract class *after* the concrete ones!
+ serverInfo = setDBID(cdoClass, CDO_RESOURCE_NODE_CLASS_DBID);
+ }
}
return serverInfo;
diff --git a/plugins/org.eclipse.emf.cdo.server.db/src/org/eclipse/emf/cdo/server/internal/db/DBStore.java b/plugins/org.eclipse.emf.cdo.server.db/src/org/eclipse/emf/cdo/server/internal/db/DBStore.java
index 4b8de1786c..92dd511985 100644
--- a/plugins/org.eclipse.emf.cdo.server.db/src/org/eclipse/emf/cdo/server/internal/db/DBStore.java
+++ b/plugins/org.eclipse.emf.cdo.server.db/src/org/eclipse/emf/cdo/server/internal/db/DBStore.java
@@ -16,7 +16,6 @@ import org.eclipse.emf.cdo.internal.server.StoreAccessorPool;
import org.eclipse.emf.cdo.server.ISession;
import org.eclipse.emf.cdo.server.IView;
import org.eclipse.emf.cdo.server.StoreThreadLocal;
-import org.eclipse.emf.cdo.server.db.IClassMapping;
import org.eclipse.emf.cdo.server.db.IDBStore;
import org.eclipse.emf.cdo.server.db.IMappingStrategy;
import org.eclipse.emf.cdo.server.internal.db.bundle.OM;
@@ -185,7 +184,7 @@ public class DBStore extends LongIDStore implements IDBStore
StoreThreadLocal.setStoreReader(storeWriter);
Connection connection = storeWriter.getConnection();
- long maxObjectID = mappingStrategy.repairAfterCrash(connection);
+ long maxObjectID = mappingStrategy.repairAfterCrash(dbAdapter, connection);
long maxMetaID = DBUtil.selectMaximumLong(connection, CDODBSchema.PACKAGES_RANGE_UB);
OM.LOG.info(MessageFormat.format("Repaired after crash: maxObjectID={0}, maxMetaID={1}", maxObjectID, maxMetaID));
@@ -230,14 +229,8 @@ public class DBStore extends LongIDStore implements IDBStore
DBUtil.insertRow(connection, dbAdapter, CDODBSchema.REPOSITORY, creationTime, 1, startupTime, 0, CRASHED,
CRASHED);
- MappingStrategy mappingStrategy = (MappingStrategy)getMappingStrategy();
-
- IClassMapping resourceClassMapping = mappingStrategy.getResourceClassMapping();
- Set<IDBTable> tables = resourceClassMapping.getAffectedTables();
- if (dbAdapter.createTables(tables, connection).size() != tables.size())
- {
- throw new DBException("CDOResource tables not completely created");
- }
+ IMappingStrategy mappingStrategy = getMappingStrategy();
+ mappingStrategy.createResourceTables(dbAdapter, connection);
}
else
{
diff --git a/plugins/org.eclipse.emf.cdo.server.db/src/org/eclipse/emf/cdo/server/internal/db/DBStoreReader.java b/plugins/org.eclipse.emf.cdo.server.db/src/org/eclipse/emf/cdo/server/internal/db/DBStoreReader.java
index df3e4e15d4..6c75ce6848 100644
--- a/plugins/org.eclipse.emf.cdo.server.db/src/org/eclipse/emf/cdo/server/internal/db/DBStoreReader.java
+++ b/plugins/org.eclipse.emf.cdo.server.db/src/org/eclipse/emf/cdo/server/internal/db/DBStoreReader.java
@@ -270,10 +270,10 @@ public class DBStoreReader extends DBStoreAccessor implements IDBStoreReader
return revision;
}
- public CDOID readResourceID(String path, long timeStamp)
+ public CDOID readResourceID(CDOID folderID, String name, long timeStamp)
{
IMappingStrategy mappingStrategy = getStore().getMappingStrategy();
- return mappingStrategy.readResourceID(this, path, timeStamp);
+ return mappingStrategy.readResourceID(this, folderID, name, timeStamp);
}
/**
diff --git a/plugins/org.eclipse.emf.cdo.server.db/src/org/eclipse/emf/cdo/server/internal/db/DBStoreWriter.java b/plugins/org.eclipse.emf.cdo.server.db/src/org/eclipse/emf/cdo/server/internal/db/DBStoreWriter.java
index 0fb7f1e9ad..2218928102 100644
--- a/plugins/org.eclipse.emf.cdo.server.db/src/org/eclipse/emf/cdo/server/internal/db/DBStoreWriter.java
+++ b/plugins/org.eclipse.emf.cdo.server.db/src/org/eclipse/emf/cdo/server/internal/db/DBStoreWriter.java
@@ -21,7 +21,6 @@ import org.eclipse.emf.cdo.common.revision.CDORevision;
import org.eclipse.emf.cdo.server.IView;
import org.eclipse.emf.cdo.server.db.IClassMapping;
import org.eclipse.emf.cdo.server.db.IDBStoreWriter;
-import org.eclipse.emf.cdo.server.db.IMappingStrategy;
import org.eclipse.emf.cdo.server.internal.db.bundle.OM;
import org.eclipse.emf.cdo.spi.common.InternalCDOClass;
import org.eclipse.emf.cdo.spi.common.InternalCDOFeature;
@@ -205,8 +204,7 @@ public class DBStoreWriter extends DBStoreReader implements IDBStoreWriter
}
CDOClass cdoClass = revision.getCDOClass();
- IMappingStrategy mappingStrategy = getStore().getMappingStrategy();
- IClassMapping mapping = mappingStrategy.getClassMapping(cdoClass);
+ IClassMapping mapping = getStore().getMappingStrategy().getClassMapping(cdoClass);
mapping.writeRevision(this, revision);
}
@@ -231,8 +229,7 @@ public class DBStoreWriter extends DBStoreReader implements IDBStoreWriter
}
CDOClass cdoClass = getObjectType(id);
- IMappingStrategy mappingStrategy = getStore().getMappingStrategy();
- IClassMapping mapping = mappingStrategy.getClassMapping(cdoClass);
+ IClassMapping mapping = getStore().getMappingStrategy().getClassMapping(cdoClass);
mapping.detachObject(this, id, revised);
}
}
diff --git a/plugins/org.eclipse.emf.cdo.server.db/src/org/eclipse/emf/cdo/server/internal/db/HorizontalClassMapping.java b/plugins/org.eclipse.emf.cdo.server.db/src/org/eclipse/emf/cdo/server/internal/db/HorizontalClassMapping.java
index cc79018bbc..ae39366469 100644
--- a/plugins/org.eclipse.emf.cdo.server.db/src/org/eclipse/emf/cdo/server/internal/db/HorizontalClassMapping.java
+++ b/plugins/org.eclipse.emf.cdo.server.db/src/org/eclipse/emf/cdo/server/internal/db/HorizontalClassMapping.java
@@ -12,8 +12,13 @@ package org.eclipse.emf.cdo.server.internal.db;
import org.eclipse.emf.cdo.common.id.CDOID;
import org.eclipse.emf.cdo.common.model.CDOClass;
+import org.eclipse.emf.cdo.common.model.CDOFeature;
+import org.eclipse.emf.cdo.common.model.resource.CDOResourceNodeClass;
import org.eclipse.emf.cdo.common.revision.CDORevision;
+import org.eclipse.emf.cdo.server.IPackageManager;
+import org.eclipse.emf.cdo.server.db.IDBStoreReader;
import org.eclipse.emf.cdo.server.db.IDBStoreWriter;
+import org.eclipse.emf.cdo.server.db.IMappingStrategy;
/**
* @author Eike Stepper
@@ -44,6 +49,27 @@ public class HorizontalClassMapping extends ClassMapping
}
@Override
+ protected void checkDuplicateResources(IDBStoreReader storeReader, CDORevision revision) throws IllegalStateException
+ {
+ // If auditing is not supported this is checked by a table index (see constructor)
+ IMappingStrategy mappingStrategy = getMappingStrategy();
+ if (mappingStrategy.getStore().getRepository().isSupportingAudits())
+ {
+ IPackageManager packageManager = mappingStrategy.getStore().getRepository().getPackageManager();
+ CDOResourceNodeClass resourceNodeClass = packageManager.getCDOResourcePackage().getCDOResourceNodeClass();
+ CDOFeature resourceNameFeature = resourceNodeClass.getCDONameFeature();
+
+ CDOID folderID = (CDOID)revision.getData().getContainerID();
+ String name = (String)revision.getData().get(resourceNameFeature, 0);
+
+ if (mappingStrategy.readResourceID(storeReader, folderID, name, revision.getCreated()) != null)
+ {
+ throw new IllegalStateException("Duplicate resource or folder: " + name + " in folder " + folderID);
+ }
+ }
+ }
+
+ @Override
protected boolean hasFullRevisionInfo()
{
return true;
diff --git a/plugins/org.eclipse.emf.cdo.server.db/src/org/eclipse/emf/cdo/server/internal/db/HorizontalMappingStrategy.java b/plugins/org.eclipse.emf.cdo.server.db/src/org/eclipse/emf/cdo/server/internal/db/HorizontalMappingStrategy.java
index 045632678c..982c5da1dc 100644
--- a/plugins/org.eclipse.emf.cdo.server.db/src/org/eclipse/emf/cdo/server/internal/db/HorizontalMappingStrategy.java
+++ b/plugins/org.eclipse.emf.cdo.server.db/src/org/eclipse/emf/cdo/server/internal/db/HorizontalMappingStrategy.java
@@ -11,9 +11,12 @@
package org.eclipse.emf.cdo.server.internal.db;
import org.eclipse.emf.cdo.common.id.CDOID;
+import org.eclipse.emf.cdo.common.id.CDOIDUtil;
import org.eclipse.emf.cdo.common.model.CDOClass;
import org.eclipse.emf.cdo.common.model.CDOClassRef;
import org.eclipse.emf.cdo.common.model.CDOPackage;
+import org.eclipse.emf.cdo.common.model.resource.CDOResourceNodeClass;
+import org.eclipse.emf.cdo.common.model.resource.CDOResourcePackage;
import org.eclipse.emf.cdo.server.IPackageManager;
import org.eclipse.emf.cdo.server.db.IClassMapping;
import org.eclipse.emf.cdo.server.db.IDBStore;
@@ -23,6 +26,7 @@ import org.eclipse.emf.cdo.server.internal.db.bundle.OM;
import org.eclipse.net4j.db.DBException;
import org.eclipse.net4j.db.DBUtil;
+import org.eclipse.net4j.db.ddl.IDBField;
import org.eclipse.net4j.db.ddl.IDBTable;
import org.eclipse.net4j.util.lifecycle.LifecycleUtil;
import org.eclipse.net4j.util.om.trace.ContextTracer;
@@ -82,6 +86,7 @@ public class HorizontalMappingStrategy extends MappingStrategy
{
TRACER.trace(sql);
}
+
ResultSet resultSet = null;
try
@@ -150,6 +155,68 @@ public class HorizontalMappingStrategy extends MappingStrategy
}
@Override
+ protected String[] getResourceQueries(CDOID folderID, String name, boolean exactMatch)
+ {
+ CDOResourcePackage resourcePackage = getStore().getRepository().getPackageManager().getCDOResourcePackage();
+ String[] queries = new String[2];
+
+ IClassMapping resourceFolderMapping = getClassMapping(resourcePackage.getCDOResourceFolderClass());
+ queries[0] = getResourceQuery(folderID, name, exactMatch, resourceFolderMapping);
+
+ IClassMapping resourceMapping = getClassMapping(resourcePackage.getCDOResourceClass());
+ queries[1] = getResourceQuery(folderID, name, exactMatch, resourceMapping);
+
+ return queries;
+ }
+
+ protected String getResourceQuery(CDOID folderID, String name, boolean exactMatch, IClassMapping classMapping)
+ {
+ CDOResourcePackage resourcePackage = getStore().getRepository().getPackageManager().getCDOResourcePackage();
+ CDOResourceNodeClass resourceNodeClass = resourcePackage.getCDOResourceNodeClass();
+
+ IDBTable table = classMapping.getTable();
+ IDBField nameField = classMapping.getAttributeMapping(resourceNodeClass.getCDONameFeature()).getField();
+
+ StringBuilder builder = new StringBuilder();
+ builder.append("SELECT ");
+ builder.append(CDODBSchema.ATTRIBUTES_ID);
+ builder.append(" FROM ");
+ builder.append(table);
+ builder.append(" WHERE ");
+ builder.append(CDODBSchema.ATTRIBUTES_CONTAINER);
+ builder.append("=");
+ builder.append(CDOIDUtil.getLong(folderID));
+ if (exactMatch || name != null)
+ {
+ builder.append(" AND ");
+ builder.append(nameField);
+ if (exactMatch)
+ {
+ if (name == null)
+ {
+ builder.append(" IS NULL");
+ }
+ else
+ {
+ builder.append("=\'");
+ builder.append(name);
+ builder.append("\'");
+ }
+ }
+ else
+ {
+ // Here: name != null
+ builder.append(" LIKE \'");
+ builder.append(name);
+ builder.append("%\'");
+ }
+ }
+
+ String sql = builder.toString();
+ return sql;
+ }
+
+ @Override
protected void doDeactivate() throws Exception
{
LifecycleUtil.deactivate(objectTypeCache);
diff --git a/plugins/org.eclipse.emf.cdo.server.db/src/org/eclipse/emf/cdo/server/internal/db/MappingStrategy.java b/plugins/org.eclipse.emf.cdo.server.db/src/org/eclipse/emf/cdo/server/internal/db/MappingStrategy.java
index cb2304e4f3..ab33e3a74f 100644
--- a/plugins/org.eclipse.emf.cdo.server.db/src/org/eclipse/emf/cdo/server/internal/db/MappingStrategy.java
+++ b/plugins/org.eclipse.emf.cdo.server.db/src/org/eclipse/emf/cdo/server/internal/db/MappingStrategy.java
@@ -16,12 +16,11 @@ import org.eclipse.emf.cdo.common.id.CDOIDUtil;
import org.eclipse.emf.cdo.common.model.CDOClass;
import org.eclipse.emf.cdo.common.model.CDOClassRef;
import org.eclipse.emf.cdo.common.model.CDOPackage;
-import org.eclipse.emf.cdo.common.model.resource.CDOPathFeature;
-import org.eclipse.emf.cdo.common.model.resource.CDOResourceClass;
+import org.eclipse.emf.cdo.common.model.resource.CDOResourcePackage;
import org.eclipse.emf.cdo.common.revision.CDORevision;
-import org.eclipse.emf.cdo.server.IPackageManager;
+import org.eclipse.emf.cdo.server.StoreUtil;
import org.eclipse.emf.cdo.server.IStoreReader.QueryResourcesContext;
-import org.eclipse.emf.cdo.server.db.IAttributeMapping;
+import org.eclipse.emf.cdo.server.IStoreReader.QueryResourcesContext.ExactMatch;
import org.eclipse.emf.cdo.server.db.IClassMapping;
import org.eclipse.emf.cdo.server.db.IDBStore;
import org.eclipse.emf.cdo.server.db.IDBStoreReader;
@@ -30,6 +29,7 @@ import org.eclipse.emf.cdo.server.internal.db.bundle.OM;
import org.eclipse.net4j.db.DBException;
import org.eclipse.net4j.db.DBUtil;
+import org.eclipse.net4j.db.IDBAdapter;
import org.eclipse.net4j.db.ddl.IDBField;
import org.eclipse.net4j.db.ddl.IDBTable;
import org.eclipse.net4j.util.collection.CloseableIterator;
@@ -40,9 +40,11 @@ import java.sql.Connection;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.util.HashMap;
+import java.util.HashSet;
import java.util.Iterator;
import java.util.List;
import java.util.Map;
+import java.util.Set;
/**
* @author Eike Stepper
@@ -59,16 +61,6 @@ public abstract class MappingStrategy extends Lifecycle implements IMappingStrat
private Map<Integer, CDOClassRef> classRefs = new HashMap<Integer, CDOClassRef>();
- private IClassMapping resourceClassMapping;
-
- private IAttributeMapping resourcePathMapping;
-
- private IDBTable resourceTable;
-
- private IDBField resourceIDField;
-
- private IDBField resourcePathField;
-
public MappingStrategy()
{
}
@@ -126,14 +118,30 @@ public abstract class MappingStrategy extends Lifecycle implements IMappingStrat
CDOClassRef classRef = classRefs.get(classID);
if (classRef == null)
{
- if (classID == ClassServerInfo.CDO_RESOURCE_CLASS_DBID)
+ switch (classID)
+ {
+ case ClassServerInfo.CDO_RESOURCE_NODE_CLASS_DBID:
{
- IPackageManager packageManager = getStore().getRepository().getPackageManager();
- CDOResourceClass resourceClass = packageManager.getCDOResourcePackage().getCDOResourceClass();
- classRef = resourceClass.createClassRef();
+ CDOResourcePackage resourcePackage = getStore().getRepository().getPackageManager().getCDOResourcePackage();
+ classRef = resourcePackage.getCDOResourceNodeClass().createClassRef();
+ break;
}
- else
+
+ case ClassServerInfo.CDO_RESOURCE_FOLDER_CLASS_DBID:
{
+ CDOResourcePackage resourcePackage = getStore().getRepository().getPackageManager().getCDOResourcePackage();
+ classRef = resourcePackage.getCDOResourceFolderClass().createClassRef();
+ break;
+ }
+
+ case ClassServerInfo.CDO_RESOURCE_CLASS_DBID:
+ {
+ CDOResourcePackage resourcePackage = getStore().getRepository().getPackageManager().getCDOResourcePackage();
+ classRef = resourcePackage.getCDOResourceClass().createClassRef();
+ break;
+ }
+
+ default:
classRef = storeReader.readClassRef(classID);
}
@@ -160,70 +168,6 @@ public abstract class MappingStrategy extends Lifecycle implements IMappingStrat
return mapping;
}
- public IClassMapping getResourceClassMapping()
- {
- if (resourceClassMapping == null)
- {
- initResourceInfos();
- }
-
- return resourceClassMapping;
- }
-
- public IAttributeMapping getResourcePathMapping()
- {
- if (resourcePathMapping == null)
- {
- initResourceInfos();
- }
-
- return resourcePathMapping;
- }
-
- public IDBTable getResourceTable()
- {
- if (resourceTable == null)
- {
- initResourceInfos();
- }
-
- return resourceTable;
- }
-
- public IDBField getResourceIDField()
- {
- if (resourceIDField == null)
- {
- initResourceInfos();
- }
-
- return resourceIDField;
- }
-
- public IDBField getResourcePathField()
- {
- if (resourcePathField == null)
- {
- initResourceInfos();
- }
-
- return resourcePathField;
- }
-
- protected void initResourceInfos()
- {
- IPackageManager packageManager = getStore().getRepository().getPackageManager();
- CDOResourceClass resourceClass = packageManager.getCDOResourcePackage().getCDOResourceClass();
- CDOPathFeature pathFeature = packageManager.getCDOResourcePackage().getCDOResourceClass().getCDOPathFeature();
-
- resourceClassMapping = getClassMapping(resourceClass);
- resourcePathMapping = resourceClassMapping.getAttributeMapping(pathFeature);
-
- resourceTable = resourceClassMapping.getTable();
- resourceIDField = resourceTable.getField(CDODBSchema.ATTRIBUTES_ID);
- resourcePathField = resourcePathMapping.getField();
- }
-
public String getTableName(CDOPackage cdoPackage)
{
if (isQualifiedNames())
@@ -311,106 +255,90 @@ public abstract class MappingStrategy extends Lifecycle implements IMappingStrat
};
}
- public CDOID readResourceID(IDBStoreReader storeReader, final String path, final long timeStamp)
+ public CDOID readResourceID(IDBStoreReader storeReader, CDOID folderID, String name, long timeStamp)
{
- final CDOID[] result = new CDOID[1];
- queryResources(storeReader, new QueryResourcesContext()
+ ExactMatch context = StoreUtil.createExactMatchContext(folderID, name, timeStamp);
+ queryResources(storeReader, context);
+ return context.getResourceID();
+ }
+
+ public void queryResources(IDBStoreReader storeReader, QueryResourcesContext context)
+ {
+ CDOID folderID = context.getFolderID();
+ String name = context.getName();
+ boolean exactMatch = context.exactMatch();
+ String where = createWhereClause(context.getTimeStamp());
+
+ String[] queries = getResourceQueries(folderID, name, exactMatch);
+ for (String query : queries)
{
- public long getTimeStamp()
+ StringBuilder builder = new StringBuilder();
+ builder.append(query);
+ builder.append(" AND (");
+ builder.append(where);
+ builder.append(")");
+
+ String sql = builder.toString();
+ if (TRACER.isEnabled())
{
- return timeStamp;
+ TRACER.trace(sql);
}
- public String getPathPrefix()
+ ResultSet resultSet = null;
+
+ try
{
- return path;
+ resultSet = storeReader.getStatement().executeQuery(sql);
+ while (resultSet.next())
+ {
+ long longID = resultSet.getLong(1);
+ CDOID id = CDOIDUtil.createLong(longID);
+ if (!context.addResource(id))
+ {
+ // No more results allowed
+ return;
+ }
+ }
}
-
- public int getMaxResults()
+ catch (SQLException ex)
{
- return 1;
+ throw new DBException(ex);
}
-
- public boolean addResource(CDOID resourceID)
+ finally
{
- result[0] = resourceID;
- return false;
+ DBUtil.close(resultSet);
}
- }, true);
-
- return result[0];
+ }
}
- public void queryResources(IDBStoreReader storeReader, QueryResourcesContext context)
- {
- queryResources(storeReader, context, false);
- }
+ protected abstract String[] getResourceQueries(CDOID folderID, String name, boolean exactMatch);
- private void queryResources(IDBStoreReader storeReader, QueryResourcesContext context, boolean exactMatch)
+ public void createResourceTables(IDBAdapter dbAdapter, Connection connection)
{
- IClassMapping mapping = getResourceClassMapping();
- IDBTable resourceTable = mapping.getTable();
- IDBField pathField = getResourcePathField();
- String pathPrefix = context.getPathPrefix();
+ Set<IDBTable> tables = new HashSet<IDBTable>();
+ CDOResourcePackage resourcePackage = getStore().getRepository().getPackageManager().getCDOResourcePackage();
- StringBuilder builder = new StringBuilder();
- builder.append("SELECT ");
- builder.append(CDODBSchema.ATTRIBUTES_ID);
- builder.append(" FROM ");
- builder.append(resourceTable);
- builder.append(" WHERE ");
- builder.append(pathField);
- if (exactMatch)
- {
- builder.append("=\'");
- builder.append(pathPrefix);
- builder.append("\'");
- }
- else
- {
- builder.append(" LIKE \'");
- builder.append(pathPrefix);
- builder.append("%\'");
- }
+ addResourceTables(resourcePackage.getCDOResourceNodeClass(), tables);
+ addResourceTables(resourcePackage.getCDOResourceFolderClass(), tables);
+ addResourceTables(resourcePackage.getCDOResourceClass(), tables);
- String where = createWhereClause(context.getTimeStamp());
- builder.append(" AND (");
- builder.append(where);
- builder.append(")");
-
- String sql = builder.toString();
- if (TRACER.isEnabled())
+ if (dbAdapter.createTables(tables, connection).size() != tables.size())
{
- TRACER.trace(sql);
+ throw new DBException("Resource tables not completely created");
}
+ }
- ResultSet resultSet = null;
-
- try
- {
- resultSet = storeReader.getStatement().executeQuery(sql);
- while (resultSet.next())
- {
- long longID = resultSet.getLong(1);
- CDOID id = CDOIDUtil.createLong(longID);
- if (!context.addResource(id))
- {
- // No more results allowed
- break;
- }
- }
- }
- catch (SQLException ex)
- {
- throw new DBException(ex);
- }
- finally
+ private void addResourceTables(CDOClass cdoClass, Set<IDBTable> tables)
+ {
+ IClassMapping mapping = getClassMapping(cdoClass);
+ if (mapping != null)
{
- DBUtil.close(resultSet);
+ Set<IDBTable> affectedTables = mapping.getAffectedTables();
+ tables.addAll(affectedTables);
}
}
- public long repairAfterCrash(Connection connection)
+ public long repairAfterCrash(IDBAdapter dbAdapter, Connection connection)
{
long maxCDOID = 0L;
for (CDOClass idClass : getClassesWithObjectInfo())
diff --git a/plugins/org.eclipse.emf.cdo.server.db/src/org/eclipse/emf/cdo/server/internal/db/NoClassMapping.java b/plugins/org.eclipse.emf.cdo.server.db/src/org/eclipse/emf/cdo/server/internal/db/NoClassMapping.java
index cb6f1f96c9..b945f29a3b 100644
--- a/plugins/org.eclipse.emf.cdo.server.db/src/org/eclipse/emf/cdo/server/internal/db/NoClassMapping.java
+++ b/plugins/org.eclipse.emf.cdo.server.db/src/org/eclipse/emf/cdo/server/internal/db/NoClassMapping.java
@@ -18,6 +18,7 @@ import org.eclipse.emf.cdo.server.db.IAttributeMapping;
import org.eclipse.emf.cdo.server.db.IClassMapping;
import org.eclipse.emf.cdo.server.db.IDBStoreReader;
import org.eclipse.emf.cdo.server.db.IDBStoreWriter;
+import org.eclipse.emf.cdo.server.db.IFeatureMapping;
import org.eclipse.emf.cdo.server.db.IMappingStrategy;
import org.eclipse.emf.cdo.server.db.IReferenceMapping;
@@ -58,6 +59,11 @@ public class NoClassMapping implements IClassMapping
return Collections.emptySet();
}
+ public IFeatureMapping getFeatureMapping(CDOFeature feature)
+ {
+ return null;
+ }
+
public List<IAttributeMapping> getAttributeMappings()
{
return null;
diff --git a/plugins/org.eclipse.emf.cdo.server.db/src/org/eclipse/emf/cdo/server/internal/db/ObjectIDIterator.java b/plugins/org.eclipse.emf.cdo.server.db/src/org/eclipse/emf/cdo/server/internal/db/ObjectIDIterator.java
index c92259e858..94d4ea9105 100644
--- a/plugins/org.eclipse.emf.cdo.server.db/src/org/eclipse/emf/cdo/server/internal/db/ObjectIDIterator.java
+++ b/plugins/org.eclipse.emf.cdo.server.db/src/org/eclipse/emf/cdo/server/internal/db/ObjectIDIterator.java
@@ -14,6 +14,7 @@ package org.eclipse.emf.cdo.server.internal.db;
import org.eclipse.emf.cdo.common.id.CDOID;
import org.eclipse.emf.cdo.common.id.CDOIDUtil;
import org.eclipse.emf.cdo.server.db.IDBStoreReader;
+import org.eclipse.emf.cdo.server.db.IMappingStrategy;
import org.eclipse.net4j.db.DBException;
import org.eclipse.net4j.db.DBUtil;
@@ -28,7 +29,7 @@ import java.util.NoSuchElementException;
*/
public abstract class ObjectIDIterator implements CloseableIterator<CDOID>
{
- private MappingStrategy mappingStrategy;
+ private IMappingStrategy mappingStrategy;
private IDBStoreReader storeReader;
@@ -42,7 +43,7 @@ public abstract class ObjectIDIterator implements CloseableIterator<CDOID>
* Creates an iterator over all objects in a store. It is important to {@link #dispose()} of this iterator after usage
* to properly close internal result sets.
*/
- public ObjectIDIterator(MappingStrategy mappingStrategy, IDBStoreReader storeReader)
+ public ObjectIDIterator(IMappingStrategy mappingStrategy, IDBStoreReader storeReader)
{
this.mappingStrategy = mappingStrategy;
this.storeReader = storeReader;
@@ -60,7 +61,7 @@ public abstract class ObjectIDIterator implements CloseableIterator<CDOID>
return closed;
}
- public MappingStrategy getMappingStrategy()
+ public IMappingStrategy getMappingStrategy()
{
return mappingStrategy;
}
diff --git a/plugins/org.eclipse.emf.cdo.server.db/src/org/eclipse/emf/cdo/server/internal/db/ObjectTypeCache.java b/plugins/org.eclipse.emf.cdo.server.db/src/org/eclipse/emf/cdo/server/internal/db/ObjectTypeCache.java
index 71cfe61e8a..60a5ecd909 100644
--- a/plugins/org.eclipse.emf.cdo.server.db/src/org/eclipse/emf/cdo/server/internal/db/ObjectTypeCache.java
+++ b/plugins/org.eclipse.emf.cdo.server.db/src/org/eclipse/emf/cdo/server/internal/db/ObjectTypeCache.java
@@ -16,6 +16,7 @@ import org.eclipse.emf.cdo.common.model.CDOClass;
import org.eclipse.emf.cdo.common.model.CDOClassRef;
import org.eclipse.emf.cdo.server.db.IDBStoreReader;
import org.eclipse.emf.cdo.server.db.IDBStoreWriter;
+import org.eclipse.emf.cdo.server.db.IMappingStrategy;
import org.eclipse.emf.cdo.server.db.IObjectTypeCache;
import org.eclipse.net4j.db.DBException;
@@ -37,7 +38,7 @@ import java.sql.Statement;
*/
public class ObjectTypeCache extends Lifecycle implements IObjectTypeCache
{
- private MappingStrategy mappingStrategy;
+ private IMappingStrategy mappingStrategy;
private IDBTable table;
@@ -51,12 +52,12 @@ public class ObjectTypeCache extends Lifecycle implements IObjectTypeCache
{
}
- public MappingStrategy getMappingStrategy()
+ public IMappingStrategy getMappingStrategy()
{
return mappingStrategy;
}
- public void setMappingStrategy(MappingStrategy mappingStrategy)
+ public void setMappingStrategy(IMappingStrategy mappingStrategy)
{
this.mappingStrategy = mappingStrategy;
}
diff --git a/plugins/org.eclipse.emf.cdo.server.db/src/org/eclipse/emf/cdo/server/internal/db/ReferenceMapping.java b/plugins/org.eclipse.emf.cdo.server.db/src/org/eclipse/emf/cdo/server/internal/db/ReferenceMapping.java
index 0924734b41..7cf6c99bf7 100644
--- a/plugins/org.eclipse.emf.cdo.server.db/src/org/eclipse/emf/cdo/server/internal/db/ReferenceMapping.java
+++ b/plugins/org.eclipse.emf.cdo.server.db/src/org/eclipse/emf/cdo/server/internal/db/ReferenceMapping.java
@@ -146,6 +146,7 @@ public class ReferenceMapping extends FeatureMapping implements IReferenceMappin
{
TRACER.trace(sql);
}
+
ResultSet resultSet = null;
try
diff --git a/plugins/org.eclipse.emf.cdo.server.db/src/org/eclipse/emf/cdo/server/internal/db/RootClassMapping.java b/plugins/org.eclipse.emf.cdo.server.db/src/org/eclipse/emf/cdo/server/internal/db/RootClassMapping.java
index ca00ed9715..c783651d3d 100644
--- a/plugins/org.eclipse.emf.cdo.server.db/src/org/eclipse/emf/cdo/server/internal/db/RootClassMapping.java
+++ b/plugins/org.eclipse.emf.cdo.server.db/src/org/eclipse/emf/cdo/server/internal/db/RootClassMapping.java
@@ -11,6 +11,8 @@
package org.eclipse.emf.cdo.server.internal.db;
import org.eclipse.emf.cdo.common.model.core.CDOObjectClass;
+import org.eclipse.emf.cdo.common.revision.CDORevision;
+import org.eclipse.emf.cdo.server.db.IDBStoreReader;
/**
* @author Eike Stepper
@@ -35,6 +37,13 @@ public class RootClassMapping extends ClassMapping
return true;
}
+ @Override
+ protected void checkDuplicateResources(IDBStoreReader storeReader, CDORevision revision) throws IllegalStateException
+ {
+ // TODO: implement RootClassMapping.checkDuplicateResources(storeReader, revision)
+ throw new UnsupportedOperationException();
+ }
+
private static CDOObjectClass getRootClass(VerticalMappingStrategy mappingStrategy)
{
return mappingStrategy.getStore().getRepository().getPackageManager().getCDOCorePackage().getCDOObjectClass();
diff --git a/plugins/org.eclipse.emf.cdo.server.db/src/org/eclipse/emf/cdo/server/internal/db/VerticalClassMapping.java b/plugins/org.eclipse.emf.cdo.server.db/src/org/eclipse/emf/cdo/server/internal/db/VerticalClassMapping.java
index d1749026c9..9a07b556d6 100644
--- a/plugins/org.eclipse.emf.cdo.server.db/src/org/eclipse/emf/cdo/server/internal/db/VerticalClassMapping.java
+++ b/plugins/org.eclipse.emf.cdo.server.db/src/org/eclipse/emf/cdo/server/internal/db/VerticalClassMapping.java
@@ -13,6 +13,7 @@ package org.eclipse.emf.cdo.server.internal.db;
import org.eclipse.emf.cdo.common.model.CDOClass;
import org.eclipse.emf.cdo.common.revision.CDORevision;
import org.eclipse.emf.cdo.server.db.IClassMapping;
+import org.eclipse.emf.cdo.server.db.IDBStoreReader;
import org.eclipse.emf.cdo.server.db.IDBStoreWriter;
import java.util.ArrayList;
@@ -72,4 +73,11 @@ public class VerticalClassMapping extends ClassMapping
}
}
}
+
+ @Override
+ protected void checkDuplicateResources(IDBStoreReader storeReader, CDORevision revision) throws IllegalStateException
+ {
+ // TODO: implement VerticalClassMapping.checkDuplicateResources(storeReader, revision)
+ throw new UnsupportedOperationException();
+ }
}
diff --git a/plugins/org.eclipse.emf.cdo.server.db/src/org/eclipse/emf/cdo/server/internal/db/VerticalMappingStrategy.java b/plugins/org.eclipse.emf.cdo.server.db/src/org/eclipse/emf/cdo/server/internal/db/VerticalMappingStrategy.java
index cba25e8dfb..040594dc1d 100644
--- a/plugins/org.eclipse.emf.cdo.server.db/src/org/eclipse/emf/cdo/server/internal/db/VerticalMappingStrategy.java
+++ b/plugins/org.eclipse.emf.cdo.server.db/src/org/eclipse/emf/cdo/server/internal/db/VerticalMappingStrategy.java
@@ -62,4 +62,11 @@ public class VerticalMappingStrategy extends MappingStrategy
{
return Collections.singletonList(rootClassMapping.getCDOClass());
}
+
+ @Override
+ protected String[] getResourceQueries(CDOID folderID, String name, boolean exactMatch)
+ {
+ // TODO: implement VerticalMappingStrategy.getResourceQueries(folderID, name, exactMatch)
+ throw new UnsupportedOperationException();
+ }
}
diff --git a/plugins/org.eclipse.emf.cdo.server.hibernate/src/org/eclipse/emf/cdo/server/internal/hibernate/HibernateStoreReader.java b/plugins/org.eclipse.emf.cdo.server.hibernate/src/org/eclipse/emf/cdo/server/internal/hibernate/HibernateStoreReader.java
index e6b45fb4ac..9b07af70e8 100644
--- a/plugins/org.eclipse.emf.cdo.server.hibernate/src/org/eclipse/emf/cdo/server/internal/hibernate/HibernateStoreReader.java
+++ b/plugins/org.eclipse.emf.cdo.server.hibernate/src/org/eclipse/emf/cdo/server/internal/hibernate/HibernateStoreReader.java
@@ -11,13 +11,11 @@
**************************************************************************/
package org.eclipse.emf.cdo.server.internal.hibernate;
-import org.eclipse.emf.cdo.common.CDOProtocolView;
import org.eclipse.emf.cdo.common.id.CDOID;
import org.eclipse.emf.cdo.common.model.CDOClassRef;
import org.eclipse.emf.cdo.common.model.CDOFeature;
import org.eclipse.emf.cdo.common.model.CDOPackage;
import org.eclipse.emf.cdo.common.model.CDOPackageInfo;
-import org.eclipse.emf.cdo.common.model.resource.CDOResourceClass;
import org.eclipse.emf.cdo.common.query.CDOQueryInfo;
import org.eclipse.emf.cdo.common.revision.CDORevision;
import org.eclipse.emf.cdo.server.IQueryContext;
@@ -25,19 +23,12 @@ import org.eclipse.emf.cdo.server.ISession;
import org.eclipse.emf.cdo.server.IStoreReader;
import org.eclipse.emf.cdo.server.IView;
import org.eclipse.emf.cdo.server.hibernate.IHibernateStoreReader;
-import org.eclipse.emf.cdo.server.hibernate.id.CDOIDHibernate;
import org.eclipse.emf.cdo.server.internal.hibernate.bundle.OM;
import org.eclipse.net4j.util.collection.CloseableIterator;
import org.eclipse.net4j.util.om.trace.ContextTracer;
-import org.hibernate.Criteria;
-import org.hibernate.Query;
-import org.hibernate.Session;
-import org.hibernate.criterion.Expression;
-
import java.util.Collection;
-import java.util.List;
/**
* @author Eike Stepper
@@ -91,76 +82,39 @@ public class HibernateStoreReader extends HibernateStoreAccessor implements IHib
return getStore().getPackageHandler().getCDOPackageInfos();
}
- public CDOID readResourceID(String path, long timeStamp)
+ public CDOID readResourceID(CDOID folderID, String name, long timeStamp)
{
- if (timeStamp != CDOProtocolView.UNSPECIFIED_DATE)
- {
- throw new UnsupportedOperationException();
- }
-
- if (TRACER.isEnabled())
- {
- TRACER.trace("Finding resourceid using path " + path);
- }
-
- Session session = getHibernateSession();
- Criteria criteria = session.createCriteria(CDOResourceClass.NAME);
- criteria.add(Expression.eq("path", path));
- List<?> result = criteria.list();
- if (result.size() == 0)
- {
- if (TRACER.isEnabled())
- {
- TRACER.trace("Resource not found");
- }
-
- // TODO: throw exception?
- return null;
- }
-
- // TODO: throw exception if list.size() > 1?
- CDORevision cdoRevision = (CDORevision)result.get(0);
- return cdoRevision.getID();
- }
-
- /**
- * TODO Remove me
- */
- @Deprecated
- public String readResourcePath(CDOID id)
- {
- if (id == null)
- {
- throw new IllegalArgumentException("ID must be not null");
- }
-
- if (!(id instanceof CDOIDHibernate))
- {
- throw new IllegalArgumentException("ID type " + id.getClass().getName() + " not supported by hibernate reader");
- }
-
- if (TRACER.isEnabled())
- {
- TRACER.trace("Finding resource using id " + id);
- }
-
- Session session = getHibernateSession();
- Query qry = session.createQuery("select path from " + CDOResourceClass.NAME + " where id=:id");
- CDOIDHibernate idHibernate = (CDOIDHibernate)id;
- qry.setParameter("id", idHibernate.getId());
- final List<?> result = qry.list();
- if (result.size() == 0)
- {
- if (TRACER.isEnabled())
- {
- TRACER.trace("Resource not found");
- }
-
- // TODO: throw exception?
- return null;
- }
+ // TODO: implement HibernateStoreReader.readResourceID(folderID, name, timeStamp)
+ throw new UnsupportedOperationException();
- return (String)result.get(0);
+ // if (timeStamp != CDOProtocolView.UNSPECIFIED_DATE)
+ // {
+ // throw new UnsupportedOperationException();
+ // }
+ //
+ // if (TRACER.isEnabled())
+ // {
+ // TRACER.trace("Finding resourceid using path " + path);
+ // }
+ //
+ // Session session = getHibernateSession();
+ // Criteria criteria = session.createCriteria(CDOResourceClass.NAME);
+ // criteria.add(Expression.eq("path", path));
+ // List<?> result = criteria.list();
+ // if (result.size() == 0)
+ // {
+ // if (TRACER.isEnabled())
+ // {
+ // TRACER.trace("Resource not found");
+ // }
+ //
+ // // TODO: throw exception?
+ // return null;
+ // }
+ //
+ // // TODO: throw exception if list.size() > 1?
+ // CDORevision cdoRevision = (CDORevision)result.get(0);
+ // return cdoRevision.getID();
}
public CDORevision readRevision(CDOID id, int referenceChunk)
diff --git a/plugins/org.eclipse.emf.cdo.server.hibernate/src/org/eclipse/emf/cdo/server/internal/hibernate/tuplizer/CDORevisionProxy.java b/plugins/org.eclipse.emf.cdo.server.hibernate/src/org/eclipse/emf/cdo/server/internal/hibernate/tuplizer/CDORevisionProxy.java
index d9a8fd9293..ddbc1b661e 100644
--- a/plugins/org.eclipse.emf.cdo.server.hibernate/src/org/eclipse/emf/cdo/server/internal/hibernate/tuplizer/CDORevisionProxy.java
+++ b/plugins/org.eclipse.emf.cdo.server.hibernate/src/org/eclipse/emf/cdo/server/internal/hibernate/tuplizer/CDORevisionProxy.java
@@ -10,7 +10,6 @@
**************************************************************************/
package org.eclipse.emf.cdo.server.internal.hibernate.tuplizer;
-import org.eclipse.emf.cdo.common.CDODataOutput;
import org.eclipse.emf.cdo.common.id.CDOID;
import org.eclipse.emf.cdo.common.model.CDOClass;
import org.eclipse.emf.cdo.common.model.CDOFeature;
@@ -25,7 +24,6 @@ import org.eclipse.emf.cdo.spi.common.InternalCDORevision;
import org.hibernate.proxy.HibernateProxy;
import org.hibernate.proxy.LazyInitializer;
-import java.io.IOException;
import java.io.Serializable;
/**
@@ -42,15 +40,6 @@ public class CDORevisionProxy implements HibernateProxy, InternalCDORevision, Se
this.li = li;
}
- /**
- * @deprecated Doesn't seem to be used
- */
- @Deprecated
- public void write(CDODataOutput out, int referenceChunk) throws IOException
- {
- out.writeCDORevision(li.getRevision(), referenceChunk);
- }
-
public Object writeReplace()
{
return this;
@@ -181,6 +170,16 @@ public class CDORevisionProxy implements HibernateProxy, InternalCDORevision, Se
return li.getRevision().isEmpty(feature);
}
+ public boolean isResourceNode()
+ {
+ return li.getRevision().isResourceNode();
+ }
+
+ public boolean isResourceFolder()
+ {
+ return li.getRevision().isResourceFolder();
+ }
+
public boolean isResource()
{
return li.getRevision().isResource();
diff --git a/plugins/org.eclipse.emf.cdo.server/src/org/eclipse/emf/cdo/internal/server/MEMStore.java b/plugins/org.eclipse.emf.cdo.server/src/org/eclipse/emf/cdo/internal/server/MEMStore.java
index e91faffb83..eabb0662ac 100644
--- a/plugins/org.eclipse.emf.cdo.server/src/org/eclipse/emf/cdo/internal/server/MEMStore.java
+++ b/plugins/org.eclipse.emf.cdo.server/src/org/eclipse/emf/cdo/internal/server/MEMStore.java
@@ -13,13 +13,20 @@
package org.eclipse.emf.cdo.internal.server;
import org.eclipse.emf.cdo.common.id.CDOID;
+import org.eclipse.emf.cdo.common.id.CDOIDUtil;
+import org.eclipse.emf.cdo.common.model.CDOFeature;
+import org.eclipse.emf.cdo.common.model.resource.CDOResourceNodeClass;
import org.eclipse.emf.cdo.common.revision.CDORevision;
import org.eclipse.emf.cdo.server.IMEMStore;
import org.eclipse.emf.cdo.server.ISession;
import org.eclipse.emf.cdo.server.IView;
+import org.eclipse.emf.cdo.server.StoreUtil;
import org.eclipse.emf.cdo.server.IStoreReader.QueryResourcesContext;
+import org.eclipse.emf.cdo.server.IStoreReader.QueryResourcesContext.ExactMatch;
import org.eclipse.emf.cdo.spi.common.InternalCDORevision;
+import org.eclipse.net4j.util.ObjectUtil;
+
import java.util.ArrayList;
import java.util.HashMap;
import java.util.Iterator;
@@ -48,6 +55,7 @@ public class MEMStore extends LongIDStore implements IMEMStore
{
super(TYPE, set(ChangeFormat.REVISION, ChangeFormat.DELTA), set(RevisionTemporality.NONE,
RevisionTemporality.AUDITING), set(RevisionParallelism.NONE));
+ setRevisionTemporality(RevisionTemporality.AUDITING);
this.listLimit = listLimit;
}
@@ -169,10 +177,12 @@ public class MEMStore extends LongIDStore implements IMEMStore
if (revision.isResource())
{
- String revisionPath = (String)revision.getData().get(getResourcePathFeature(), 0);
- if (getResourceID(revisionPath, revision.getCreated()) != null)
+ CDOID revisionFolder = (CDOID)revision.getData().getContainerID();
+ String revisionName = (String)revision.getData().get(getResourceNameFeature(), 0);
+ CDOID resourceID = getResourceID(revisionFolder, revisionName, revision.getCreated());
+ if (resourceID != null)
{
- throw new IllegalStateException("Duplicate resource path: " + revisionPath);
+ throw new IllegalStateException("Duplicate resource: " + revisionName + " (folderID=" + revisionFolder + ")");
}
}
@@ -183,6 +193,16 @@ public class MEMStore extends LongIDStore implements IMEMStore
}
}
+ private CDOResourceNodeClass getResourceNodeClass()
+ {
+ return getRepository().getPackageManager().getCDOResourcePackage().getCDOResourceNodeClass();
+ }
+
+ private CDOFeature getResourceNameFeature()
+ {
+ return getResourceNodeClass().getCDONameFeature();
+ }
+
/**
* @since 2.0
*/
@@ -224,60 +244,45 @@ public class MEMStore extends LongIDStore implements IMEMStore
/**
* @since 2.0
*/
- public CDOID getResourceID(final String path, final long timeStamp)
+ public CDOID getResourceID(CDOID folderID, String name, long timeStamp)
{
- final CDOID[] result = new CDOID[1];
- queryResources(new QueryResourcesContext()
- {
- public long getTimeStamp()
- {
- return timeStamp;
- }
-
- public String getPathPrefix()
- {
- return path;
- }
-
- public int getMaxResults()
- {
- return 1;
- }
-
- public boolean addResource(CDOID resourceID)
- {
- result[0] = resourceID;
- return false;
- }
- }, true);
-
- return result[0];
+ ExactMatch context = StoreUtil.createExactMatchContext(folderID, name, timeStamp);
+ queryResources(context);
+ return context.getResourceID();
}
/**
* @since 2.0
*/
- public synchronized void queryResources(QueryResourcesContext context, boolean exactMatch)
+ public synchronized void queryResources(QueryResourcesContext context)
{
- String pathPrefix = context.getPathPrefix();
+ CDOID folderID = context.getFolderID();
+ String name = context.getName();
+ boolean exactMatch = context.exactMatch();
for (List<CDORevision> list : revisions.values())
{
if (!list.isEmpty())
{
CDORevision revision = list.get(0);
- if (revision.isResource())
+ if (revision.isResourceNode())
{
revision = getRevisionByTime(list, context.getTimeStamp());
if (revision != null)
{
- String path = (String)revision.getData().get(getResourcePathFeature(), 0);
- boolean match = exactMatch ? path.equals(pathPrefix) : path.startsWith(pathPrefix);
- if (match)
+ CDOID revisionFolder = (CDOID)revision.getData().getContainerID();
+ if (CDOIDUtil.equals(revisionFolder, folderID))
{
- if (!context.addResource(revision.getID()))
+ String revisionName = (String)revision.getData().get(getResourceNameFeature(), 0);
+ boolean match = exactMatch || revisionName == null || name == null ? ObjectUtil
+ .equals(revisionName, name) : revisionName.startsWith(name);
+
+ if (match)
{
- // No more results allowed
- break;
+ if (!context.addResource(revision.getID()))
+ {
+ // No more results allowed
+ break;
+ }
}
}
}
@@ -311,6 +316,9 @@ public class MEMStore extends LongIDStore implements IMEMStore
return creationTime;
}
+ /**
+ * @since 2.0
+ */
@Override
protected void doActivate() throws Exception
{
diff --git a/plugins/org.eclipse.emf.cdo.server/src/org/eclipse/emf/cdo/internal/server/MEMStoreAccessor.java b/plugins/org.eclipse.emf.cdo.server/src/org/eclipse/emf/cdo/internal/server/MEMStoreAccessor.java
index 4fad50d7b8..f1140367df 100644
--- a/plugins/org.eclipse.emf.cdo.server/src/org/eclipse/emf/cdo/internal/server/MEMStoreAccessor.java
+++ b/plugins/org.eclipse.emf.cdo.server/src/org/eclipse/emf/cdo/internal/server/MEMStoreAccessor.java
@@ -213,9 +213,9 @@ public class MEMStoreAccessor extends StoreAccessor implements IStoreReader, ISt
/**
* @since 2.0
*/
- public CDOID readResourceID(String path, long timeStamp)
+ public CDOID readResourceID(CDOID folderID, String name, long timeStamp)
{
- return getStore().getResourceID(path, timeStamp);
+ return getStore().getResourceID(folderID, name, timeStamp);
}
/**
@@ -223,7 +223,7 @@ public class MEMStoreAccessor extends StoreAccessor implements IStoreReader, ISt
*/
public void queryResources(QueryResourcesContext context)
{
- getStore().queryResources(context, false);
+ getStore().queryResources(context);
}
/**
diff --git a/plugins/org.eclipse.emf.cdo.server/src/org/eclipse/emf/cdo/internal/server/QueryManager.java b/plugins/org.eclipse.emf.cdo.server/src/org/eclipse/emf/cdo/internal/server/QueryManager.java
index f508444784..a0b53b75e4 100644
--- a/plugins/org.eclipse.emf.cdo.server/src/org/eclipse/emf/cdo/internal/server/QueryManager.java
+++ b/plugins/org.eclipse.emf.cdo.server/src/org/eclipse/emf/cdo/internal/server/QueryManager.java
@@ -231,6 +231,8 @@ public class QueryManager extends Lifecycle implements IRepositoryElement
public void run()
{
+ Session session = (Session)queryResult.getView().getSession();
+ StoreThreadLocal.setSession(session);
try
{
started = true;
diff --git a/plugins/org.eclipse.emf.cdo.server/src/org/eclipse/emf/cdo/internal/server/Repository.java b/plugins/org.eclipse.emf.cdo.server/src/org/eclipse/emf/cdo/internal/server/Repository.java
index dfe11e7d5e..b680fca943 100644
--- a/plugins/org.eclipse.emf.cdo.server/src/org/eclipse/emf/cdo/internal/server/Repository.java
+++ b/plugins/org.eclipse.emf.cdo.server/src/org/eclipse/emf/cdo/internal/server/Repository.java
@@ -518,12 +518,16 @@ public class Repository extends Container<IRepositoryElement> implements IReposi
{
String value = getProperties().get(Props.SUPPORTING_AUDITS);
- supportingAudits = value == null ? false : Boolean.valueOf(value);
if (value != null)
{
+ supportingAudits = Boolean.valueOf(value);
store.setRevisionTemporality(supportingAudits ? IStore.RevisionTemporality.AUDITING
: IStore.RevisionTemporality.NONE);
}
+ else
+ {
+ supportingAudits = store.getRevisionTemporality() == IStore.RevisionTemporality.AUDITING;
+ }
}
{
diff --git a/plugins/org.eclipse.emf.cdo.server/src/org/eclipse/emf/cdo/internal/server/ResourcesQueryHandler.java b/plugins/org.eclipse.emf.cdo.server/src/org/eclipse/emf/cdo/internal/server/ResourcesQueryHandler.java
index 2891268f28..ea1ab02ce5 100644
--- a/plugins/org.eclipse.emf.cdo.server/src/org/eclipse/emf/cdo/internal/server/ResourcesQueryHandler.java
+++ b/plugins/org.eclipse.emf.cdo.server/src/org/eclipse/emf/cdo/internal/server/ResourcesQueryHandler.java
@@ -41,11 +41,21 @@ public class ResourcesQueryHandler implements IQueryHandler
return context.getTimeStamp();
}
- public String getPathPrefix()
+ public CDOID getFolderID()
+ {
+ return (CDOID)info.getParameters().get(CDOProtocolConstants.QUERY_LANGUAGE_RESOURCES_FOLDER_ID);
+ }
+
+ public String getName()
{
return info.getQueryString();
}
+ public boolean exactMatch()
+ {
+ return (Boolean)info.getParameters().get(CDOProtocolConstants.QUERY_LANGUAGE_RESOURCES_EXACT_MATCH);
+ }
+
public int getMaxResults()
{
return info.getMaxResults();
diff --git a/plugins/org.eclipse.emf.cdo.server/src/org/eclipse/emf/cdo/internal/server/RevisionManager.java b/plugins/org.eclipse.emf.cdo.server/src/org/eclipse/emf/cdo/internal/server/RevisionManager.java
index a1d8bb3e2a..415a21a5da 100644
--- a/plugins/org.eclipse.emf.cdo.server/src/org/eclipse/emf/cdo/internal/server/RevisionManager.java
+++ b/plugins/org.eclipse.emf.cdo.server/src/org/eclipse/emf/cdo/internal/server/RevisionManager.java
@@ -16,6 +16,7 @@ import org.eclipse.emf.cdo.common.id.CDOID;
import org.eclipse.emf.cdo.common.id.CDOIDObjectFactory;
import org.eclipse.emf.cdo.common.model.CDOClass;
import org.eclipse.emf.cdo.common.model.CDOFeature;
+import org.eclipse.emf.cdo.common.model.CDOPackageManager;
import org.eclipse.emf.cdo.internal.common.revision.CDORevisionResolverImpl;
import org.eclipse.emf.cdo.server.IRepository;
import org.eclipse.emf.cdo.server.IRevisionManager;
@@ -266,9 +267,9 @@ public class RevisionManager extends CDORevisionResolverImpl implements IRevisio
* @since 2.0
*/
@Override
- protected CDOFeature getResourcePathFeature()
+ protected CDOPackageManager getPackageManager()
{
- return repository.getPackageManager().getCDOResourcePackage().getCDOResourceClass().getCDOPathFeature();
+ return repository.getPackageManager();
}
/**
diff --git a/plugins/org.eclipse.emf.cdo.server/src/org/eclipse/emf/cdo/internal/server/Store.java b/plugins/org.eclipse.emf.cdo.server/src/org/eclipse/emf/cdo/internal/server/Store.java
index a2e49b8e1d..7d37b8dce6 100644
--- a/plugins/org.eclipse.emf.cdo.server/src/org/eclipse/emf/cdo/internal/server/Store.java
+++ b/plugins/org.eclipse.emf.cdo.server/src/org/eclipse/emf/cdo/internal/server/Store.java
@@ -11,7 +11,6 @@
package org.eclipse.emf.cdo.internal.server;
import org.eclipse.emf.cdo.common.CDOProtocolView;
-import org.eclipse.emf.cdo.common.model.resource.CDOPathFeature;
import org.eclipse.emf.cdo.server.IRepository;
import org.eclipse.emf.cdo.server.ISession;
import org.eclipse.emf.cdo.server.ISessionManager;
@@ -57,9 +56,6 @@ public abstract class Store extends Lifecycle implements IStore
@ExcludeFromDump
private transient long lastMetaID;
- @ExcludeFromDump
- private transient CDOPathFeature resourcePathFeature;
-
/**
* @since 2.0
*/
@@ -171,14 +167,6 @@ public abstract class Store extends Lifecycle implements IStore
this.lastMetaID = lastMetaID;
}
- /**
- * @since 2.0
- */
- public CDOPathFeature getResourcePathFeature()
- {
- return resourcePathFeature;
- }
-
public final IStoreReader getReader(ISession session)
{
IStoreReader reader = null;
@@ -255,17 +243,6 @@ public abstract class Store extends Lifecycle implements IStore
}
/**
- * @since 2.0
- */
- @Override
- protected void doActivate() throws Exception
- {
- super.doActivate();
- resourcePathFeature = repository.getPackageManager().getCDOResourcePackage().getCDOResourceClass()
- .getCDOPathFeature();
- }
-
- /**
* Returns a {@link StoreAccessorPool pool} that may contain {@link IStoreReader} instances that are compatible with
* the given session. The implementor may return <code>null</code> to indicate that no pooling occurs. It's also left
* to the implementors choice how to determine the appropriate pool instance to be used for the given session, for
diff --git a/plugins/org.eclipse.emf.cdo.server/src/org/eclipse/emf/cdo/internal/server/View.java b/plugins/org.eclipse.emf.cdo.server/src/org/eclipse/emf/cdo/internal/server/View.java
index 174a95b5f4..a9ee84f7ca 100644
--- a/plugins/org.eclipse.emf.cdo.server/src/org/eclipse/emf/cdo/internal/server/View.java
+++ b/plugins/org.eclipse.emf.cdo.server/src/org/eclipse/emf/cdo/internal/server/View.java
@@ -13,16 +13,17 @@ package org.eclipse.emf.cdo.internal.server;
import org.eclipse.emf.cdo.common.CDOProtocolView;
import org.eclipse.emf.cdo.common.id.CDOID;
-import org.eclipse.emf.cdo.common.model.resource.CDOPathFeature;
import org.eclipse.emf.cdo.server.IRepository;
import org.eclipse.emf.cdo.server.IStoreReader;
import org.eclipse.emf.cdo.server.IView;
import org.eclipse.emf.cdo.server.StoreThreadLocal;
-import org.eclipse.emf.cdo.spi.common.InternalCDORevision;
+
+import org.eclipse.net4j.util.StringUtil;
import java.text.MessageFormat;
import java.util.HashSet;
import java.util.Set;
+import java.util.StringTokenizer;
/**
* @author Eike Stepper
@@ -35,8 +36,6 @@ public class View implements IView
private IRepository repository;
- private CDOPathFeature resourcePathFeature;
-
private Set<CDOID> changeSubscriptionIDs = new HashSet<CDOID>();
/**
@@ -46,10 +45,7 @@ public class View implements IView
{
this.session = session;
this.viewID = viewID;
-
repository = session.getSessionManager().getRepository();
- resourcePathFeature = repository.getPackageManager().getCDOResourcePackage().getCDOResourceClass()
- .getCDOPathFeature();
}
public Session getSession()
@@ -83,35 +79,35 @@ public class View implements IView
{
checkOpen();
long timeStamp = getTimeStamp();
- CDOID id = repository.getRevisionManager().getResourceID(path, timeStamp);
- if (id == null)
+ CDOID resourceID = null;
+
+ StringTokenizer tokenizer = new StringTokenizer(path, "/");
+ while (tokenizer.hasMoreTokens())
{
- IStoreReader storeReader = StoreThreadLocal.getStoreReader();
- id = storeReader.readResourceID(path, timeStamp);
+ String token = tokenizer.nextToken();
+ if (!StringUtil.isEmpty(token))
+ {
+ resourceID = getResourceID(resourceID, token, timeStamp);
+ if (resourceID == null)
+ {
+ return null;
+ }
+ }
}
- return id;
+ return resourceID;
}
- /**
- * @since 2.0
- */
- public String getResourcePath(CDOID id)
+ private CDOID getResourceID(CDOID folderID, String name, long timeStamp)
{
- checkOpen();
- long timeStamp = getTimeStamp();
- String path = repository.getRevisionManager().getResourcePath(id, timeStamp);
- if (path == null)
+ CDOID id = repository.getRevisionManager().getResourceID(folderID, name, timeStamp);
+ if (id == null)
{
IStoreReader storeReader = StoreThreadLocal.getStoreReader();
- InternalCDORevision revision = (InternalCDORevision)storeReader.readRevisionByTime(id, 0, timeStamp);
- if (revision != null && revision.isResource())
- {
- path = (String)revision.getValue(resourcePathFeature);
- }
+ id = storeReader.readResourceID(folderID, name, timeStamp);
}
- return path;
+ return id;
}
/**
@@ -186,7 +182,6 @@ public class View implements IView
clearChangeSubscription();
session = null;
repository = null;
- resourcePathFeature = null;
changeSubscriptionIDs = null;
}
diff --git a/plugins/org.eclipse.emf.cdo.server/src/org/eclipse/emf/cdo/internal/server/protocol/CDOServerProtocol.java b/plugins/org.eclipse.emf.cdo.server/src/org/eclipse/emf/cdo/internal/server/protocol/CDOServerProtocol.java
index 4e54928f5f..1eae63f6a1 100644
--- a/plugins/org.eclipse.emf.cdo.server/src/org/eclipse/emf/cdo/internal/server/protocol/CDOServerProtocol.java
+++ b/plugins/org.eclipse.emf.cdo.server/src/org/eclipse/emf/cdo/internal/server/protocol/CDOServerProtocol.java
@@ -52,9 +52,6 @@ public class CDOServerProtocol extends CDOProtocolImpl
case CDOProtocolConstants.SIGNAL_RESOURCE_ID:
return new ResourceIDIndication();
- case CDOProtocolConstants.SIGNAL_RESOURCE_PATH:
- return new ResourcePathIndication();
-
case CDOProtocolConstants.SIGNAL_LOAD_PACKAGE:
return new LoadPackageIndication();
diff --git a/plugins/org.eclipse.emf.cdo.server/src/org/eclipse/emf/cdo/internal/server/protocol/ResourcePathIndication.java b/plugins/org.eclipse.emf.cdo.server/src/org/eclipse/emf/cdo/internal/server/protocol/ResourcePathIndication.java
deleted file mode 100644
index 45da50c186..0000000000
--- a/plugins/org.eclipse.emf.cdo.server/src/org/eclipse/emf/cdo/internal/server/protocol/ResourcePathIndication.java
+++ /dev/null
@@ -1,73 +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.cdo.internal.server.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.cdo.internal.server.bundle.OM;
-import org.eclipse.emf.cdo.server.IView;
-
-import org.eclipse.net4j.util.om.trace.ContextTracer;
-
-import java.io.IOException;
-
-/**
- * @author Eike Stepper
- */
-public class ResourcePathIndication extends CDOReadIndication
-{
- private static final ContextTracer PROTOCOL_TRACER = new ContextTracer(OM.DEBUG_PROTOCOL,
- ResourcePathIndication.class);
-
- private String path;
-
- public ResourcePathIndication()
- {
- }
-
- @Override
- protected short getSignalID()
- {
- return CDOProtocolConstants.SIGNAL_RESOURCE_PATH;
- }
-
- @Override
- protected void indicating(CDODataInput in) throws IOException
- {
- int viewID = in.readInt();
- if (PROTOCOL_TRACER.isEnabled())
- {
- PROTOCOL_TRACER.format("Read viewID: {0}", viewID);
- }
-
- CDOID id = in.readCDOID();
- if (PROTOCOL_TRACER.isEnabled())
- {
- PROTOCOL_TRACER.format("Read ID: {0}", id);
- }
-
- IView view = getSession().getView(viewID);
- path = view.getResourcePath(id);
- }
-
- @Override
- protected void responding(CDODataOutput out) throws IOException
- {
- if (PROTOCOL_TRACER.isEnabled())
- {
- PROTOCOL_TRACER.format("Writing path: {0}", path);
- }
-
- out.writeString(path);
- }
-}
diff --git a/plugins/org.eclipse.emf.cdo.server/src/org/eclipse/emf/cdo/server/IStoreReader.java b/plugins/org.eclipse.emf.cdo.server/src/org/eclipse/emf/cdo/server/IStoreReader.java
index a9b6e89e3c..44c35c2b6a 100644
--- a/plugins/org.eclipse.emf.cdo.server/src/org/eclipse/emf/cdo/server/IStoreReader.java
+++ b/plugins/org.eclipse.emf.cdo.server/src/org/eclipse/emf/cdo/server/IStoreReader.java
@@ -76,12 +76,12 @@ public interface IStoreReader extends IStoreAccessor, IQueryHandler
public CDORevision readRevisionByTime(CDOID id, int referenceChunk, long timeStamp);
/**
- * Returns the <code>CDOID</code> of the resource with the given path if a resource with this path exists in the
- * store, <code>null</code> otherwise.
+ * Returns the <code>CDOID</code> of the resource node with the given folderID and name if a resource with this
+ * folderID and name exists in the store, <code>null</code> otherwise.
*
* @since 2.0
*/
- public CDOID readResourceID(String path, long timeStamp);
+ public CDOID readResourceID(CDOID folderID, String name, long timeStamp);
public CDORevision verifyRevision(CDORevision revision);
@@ -109,7 +109,11 @@ public interface IStoreReader extends IStoreAccessor, IQueryHandler
*/
public long getTimeStamp();
- public String getPathPrefix();
+ public CDOID getFolderID();
+
+ public String getName();
+
+ public boolean exactMatch();
/**
* Returns the maximum number of results expected by the client or {@link CDOQueryInfo#UNLIMITED_RESULTS} for no
@@ -124,5 +128,14 @@ public interface IStoreReader extends IStoreAccessor, IQueryHandler
* (i.e. maxResults has been reached or an asynchronous query has been canceled).
*/
public boolean addResource(CDOID resourceID);
+
+ /**
+ * @author Eike Stepper
+ * @since 2.0
+ */
+ public interface ExactMatch extends QueryResourcesContext
+ {
+ public CDOID getResourceID();
+ }
}
}
diff --git a/plugins/org.eclipse.emf.cdo.server/src/org/eclipse/emf/cdo/server/IView.java b/plugins/org.eclipse.emf.cdo.server/src/org/eclipse/emf/cdo/server/IView.java
index 263e457202..84a4382bac 100644
--- a/plugins/org.eclipse.emf.cdo.server/src/org/eclipse/emf/cdo/server/IView.java
+++ b/plugins/org.eclipse.emf.cdo.server/src/org/eclipse/emf/cdo/server/IView.java
@@ -30,9 +30,4 @@ public interface IView extends CDOProtocolView
* @since 2.0
*/
public CDOID getResourceID(String path);
-
- /**
- * @since 2.0
- */
- public String getResourcePath(CDOID id);
}
diff --git a/plugins/org.eclipse.emf.cdo.server/src/org/eclipse/emf/cdo/server/StoreUtil.java b/plugins/org.eclipse.emf.cdo.server/src/org/eclipse/emf/cdo/server/StoreUtil.java
index e18849d6bc..abaab0941c 100644
--- a/plugins/org.eclipse.emf.cdo.server/src/org/eclipse/emf/cdo/server/StoreUtil.java
+++ b/plugins/org.eclipse.emf.cdo.server/src/org/eclipse/emf/cdo/server/StoreUtil.java
@@ -10,7 +10,9 @@
**************************************************************************/
package org.eclipse.emf.cdo.server;
+import org.eclipse.emf.cdo.common.id.CDOID;
import org.eclipse.emf.cdo.internal.server.MEMStore;
+import org.eclipse.emf.cdo.server.IStoreReader.QueryResourcesContext;
/**
* @author Eike Stepper
@@ -28,4 +30,52 @@ public final class StoreUtil
{
return new MEMStore();
}
+
+ /**
+ * @since 2.0
+ */
+ public static QueryResourcesContext.ExactMatch createExactMatchContext(final CDOID folderID, final String name,
+ final long timeStamp)
+ {
+ return new QueryResourcesContext.ExactMatch()
+ {
+ private CDOID resourceID;
+
+ public CDOID getResourceID()
+ {
+ return resourceID;
+ }
+
+ public long getTimeStamp()
+ {
+ return timeStamp;
+ }
+
+ public CDOID getFolderID()
+ {
+ return folderID;
+ }
+
+ public String getName()
+ {
+ return name;
+ }
+
+ public boolean exactMatch()
+ {
+ return true;
+ }
+
+ public int getMaxResults()
+ {
+ return 1;
+ }
+
+ public boolean addResource(CDOID resourceID)
+ {
+ this.resourceID = resourceID;
+ return false;
+ }
+ };
+ }
}
diff --git a/plugins/org.eclipse.emf.cdo.tests.model2/model/model2.ecore b/plugins/org.eclipse.emf.cdo.tests.model2/model/model2.ecore
index 21a24d73b6..2a06d80ad0 100644
--- a/plugins/org.eclipse.emf.cdo.tests.model2/model/model2.ecore
+++ b/plugins/org.eclipse.emf.cdo.tests.model2/model/model2.ecore
@@ -8,4 +8,14 @@
<eStructuralFeatures xsi:type="ecore:EReference" name="shippingAddress" eType="ecore:EClass ../../org.eclipse.emf.cdo.tests.model1/model/model1.ecore#//Address"
containment="true"/>
</eClassifiers>
+ <eClassifiers xsi:type="ecore:EClass" name="TaskContainer">
+ <eStructuralFeatures xsi:type="ecore:EReference" name="tasks" upperBound="-1"
+ eType="#//Task" containment="true" eOpposite="#//Task/taskContainer"/>
+ </eClassifiers>
+ <eClassifiers xsi:type="ecore:EClass" name="Task">
+ <eStructuralFeatures xsi:type="ecore:EReference" name="taskContainer" eType="#//TaskContainer"
+ eOpposite="#//TaskContainer/tasks"/>
+ <eStructuralFeatures xsi:type="ecore:EAttribute" name="description" eType="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//EString"/>
+ <eStructuralFeatures xsi:type="ecore:EAttribute" name="done" eType="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//EBoolean"/>
+ </eClassifiers>
</ecore:EPackage>
diff --git a/plugins/org.eclipse.emf.cdo.tests.model2/src/org/eclipse/emf/cdo/tests/model2/Model2Factory.java b/plugins/org.eclipse.emf.cdo.tests.model2/src/org/eclipse/emf/cdo/tests/model2/Model2Factory.java
index 685ce013b7..a21ac94193 100644
--- a/plugins/org.eclipse.emf.cdo.tests.model2/src/org/eclipse/emf/cdo/tests/model2/Model2Factory.java
+++ b/plugins/org.eclipse.emf.cdo.tests.model2/src/org/eclipse/emf/cdo/tests/model2/Model2Factory.java
@@ -2,7 +2,7 @@
* <copyright>
* </copyright>
*
- * $Id: Model2Factory.java,v 1.3 2008-09-18 12:56:55 estepper Exp $
+ * $Id: Model2Factory.java,v 1.4 2008-10-19 01:28:55 smcduff Exp $
*/
package org.eclipse.emf.cdo.tests.model2;
@@ -33,6 +33,22 @@ public interface Model2Factory extends EFactory
SpecialPurchaseOrder createSpecialPurchaseOrder();
/**
+ * Returns a new object of class '<em>Task Container</em>'. <!-- begin-user-doc --> <!-- end-user-doc -->
+ *
+ * @return a new object of class '<em>Task Container</em>'.
+ * @generated
+ */
+ TaskContainer createTaskContainer();
+
+ /**
+ * Returns a new object of class '<em>Task</em>'. <!-- begin-user-doc --> <!-- end-user-doc -->
+ *
+ * @return a new object of class '<em>Task</em>'.
+ * @generated
+ */
+ Task createTask();
+
+ /**
* Returns the package supported by this factory. <!-- begin-user-doc --> <!-- end-user-doc -->
*
* @return the package supported by this factory.
diff --git a/plugins/org.eclipse.emf.cdo.tests.model2/src/org/eclipse/emf/cdo/tests/model2/Model2Package.java b/plugins/org.eclipse.emf.cdo.tests.model2/src/org/eclipse/emf/cdo/tests/model2/Model2Package.java
index a63dc573ed..6794d9af03 100644
--- a/plugins/org.eclipse.emf.cdo.tests.model2/src/org/eclipse/emf/cdo/tests/model2/Model2Package.java
+++ b/plugins/org.eclipse.emf.cdo.tests.model2/src/org/eclipse/emf/cdo/tests/model2/Model2Package.java
@@ -2,7 +2,7 @@
* <copyright>
* </copyright>
*
- * $Id: Model2Package.java,v 1.5 2008-09-18 12:56:55 estepper Exp $
+ * $Id: Model2Package.java,v 1.6 2008-10-19 01:28:55 smcduff Exp $
*/
package org.eclipse.emf.cdo.tests.model2;
@@ -119,6 +119,77 @@ public interface Model2Package extends EPackage
int SPECIAL_PURCHASE_ORDER_FEATURE_COUNT = Model1Package.PURCHASE_ORDER_FEATURE_COUNT + 2;
/**
+ * The meta object id for the '{@link org.eclipse.emf.cdo.tests.model2.impl.TaskContainerImpl <em>Task Container</em>}
+ * ' class. <!-- begin-user-doc --> <!-- end-user-doc -->
+ *
+ * @see org.eclipse.emf.cdo.tests.model2.impl.TaskContainerImpl
+ * @see org.eclipse.emf.cdo.tests.model2.impl.Model2PackageImpl#getTaskContainer()
+ * @generated
+ */
+ int TASK_CONTAINER = 1;
+
+ /**
+ * The feature id for the '<em><b>Tasks</b></em>' containment reference list. <!-- begin-user-doc --> <!--
+ * end-user-doc -->
+ *
+ * @generated
+ * @ordered
+ */
+ int TASK_CONTAINER__TASKS = 0;
+
+ /**
+ * The number of structural features of the '<em>Task Container</em>' class. <!-- begin-user-doc --> <!-- end-user-doc
+ * -->
+ *
+ * @generated
+ * @ordered
+ */
+ int TASK_CONTAINER_FEATURE_COUNT = 1;
+
+ /**
+ * The meta object id for the '{@link org.eclipse.emf.cdo.tests.model2.impl.TaskImpl <em>Task</em>}' class. <!--
+ * begin-user-doc --> <!-- end-user-doc -->
+ *
+ * @see org.eclipse.emf.cdo.tests.model2.impl.TaskImpl
+ * @see org.eclipse.emf.cdo.tests.model2.impl.Model2PackageImpl#getTask()
+ * @generated
+ */
+ int TASK = 2;
+
+ /**
+ * The feature id for the '<em><b>Task Container</b></em>' container reference. <!-- begin-user-doc --> <!--
+ * end-user-doc -->
+ *
+ * @generated
+ * @ordered
+ */
+ int TASK__TASK_CONTAINER = 0;
+
+ /**
+ * The feature id for the '<em><b>Description</b></em>' attribute. <!-- begin-user-doc --> <!-- end-user-doc -->
+ *
+ * @generated
+ * @ordered
+ */
+ int TASK__DESCRIPTION = 1;
+
+ /**
+ * The feature id for the '<em><b>Done</b></em>' attribute. <!-- begin-user-doc --> <!-- end-user-doc -->
+ *
+ * @generated
+ * @ordered
+ */
+ int TASK__DONE = 2;
+
+ /**
+ * The number of structural features of the '<em>Task</em>' class. <!-- begin-user-doc --> <!-- end-user-doc -->
+ *
+ * @generated
+ * @ordered
+ */
+ int TASK_FEATURE_COUNT = 3;
+
+ /**
* Returns the meta object for class '{@link org.eclipse.emf.cdo.tests.model2.SpecialPurchaseOrder
* <em>Special Purchase Order</em>}'. <!-- begin-user-doc --> <!-- end-user-doc -->
*
@@ -153,6 +224,71 @@ public interface Model2Package extends EPackage
EReference getSpecialPurchaseOrder_ShippingAddress();
/**
+ * Returns the meta object for class '{@link org.eclipse.emf.cdo.tests.model2.TaskContainer <em>Task Container</em>}'.
+ * <!-- begin-user-doc --> <!-- end-user-doc -->
+ *
+ * @return the meta object for class '<em>Task Container</em>'.
+ * @see org.eclipse.emf.cdo.tests.model2.TaskContainer
+ * @generated
+ */
+ EClass getTaskContainer();
+
+ /**
+ * Returns the meta object for the containment reference list '
+ * {@link org.eclipse.emf.cdo.tests.model2.TaskContainer#getTasks <em>Tasks</em>}'. <!-- begin-user-doc --> <!--
+ * end-user-doc -->
+ *
+ * @return the meta object for the containment reference list '<em>Tasks</em>'.
+ * @see org.eclipse.emf.cdo.tests.model2.TaskContainer#getTasks()
+ * @see #getTaskContainer()
+ * @generated
+ */
+ EReference getTaskContainer_Tasks();
+
+ /**
+ * Returns the meta object for class '{@link org.eclipse.emf.cdo.tests.model2.Task <em>Task</em>}'. <!--
+ * begin-user-doc --> <!-- end-user-doc -->
+ *
+ * @return the meta object for class '<em>Task</em>'.
+ * @see org.eclipse.emf.cdo.tests.model2.Task
+ * @generated
+ */
+ EClass getTask();
+
+ /**
+ * Returns the meta object for the container reference '{@link org.eclipse.emf.cdo.tests.model2.Task#getTaskContainer
+ * <em>Task Container</em>}'. <!-- begin-user-doc --> <!-- end-user-doc -->
+ *
+ * @return the meta object for the container reference '<em>Task Container</em>'.
+ * @see org.eclipse.emf.cdo.tests.model2.Task#getTaskContainer()
+ * @see #getTask()
+ * @generated
+ */
+ EReference getTask_TaskContainer();
+
+ /**
+ * Returns the meta object for the attribute '{@link org.eclipse.emf.cdo.tests.model2.Task#getDescription
+ * <em>Description</em>}'. <!-- begin-user-doc --> <!-- end-user-doc -->
+ *
+ * @return the meta object for the attribute '<em>Description</em>'.
+ * @see org.eclipse.emf.cdo.tests.model2.Task#getDescription()
+ * @see #getTask()
+ * @generated
+ */
+ EAttribute getTask_Description();
+
+ /**
+ * Returns the meta object for the attribute '{@link org.eclipse.emf.cdo.tests.model2.Task#isDone <em>Done</em>}'.
+ * <!-- begin-user-doc --> <!-- end-user-doc -->
+ *
+ * @return the meta object for the attribute '<em>Done</em>'.
+ * @see org.eclipse.emf.cdo.tests.model2.Task#isDone()
+ * @see #getTask()
+ * @generated
+ */
+ EAttribute getTask_Done();
+
+ /**
* Returns the factory that creates the instances of the model. <!-- begin-user-doc --> <!-- end-user-doc -->
*
* @return the factory that creates the instances of the model.
@@ -200,6 +336,58 @@ public interface Model2Package extends EPackage
*/
EReference SPECIAL_PURCHASE_ORDER__SHIPPING_ADDRESS = eINSTANCE.getSpecialPurchaseOrder_ShippingAddress();
+ /**
+ * The meta object literal for the '{@link org.eclipse.emf.cdo.tests.model2.impl.TaskContainerImpl
+ * <em>Task Container</em>}' class. <!-- begin-user-doc --> <!-- end-user-doc -->
+ *
+ * @see org.eclipse.emf.cdo.tests.model2.impl.TaskContainerImpl
+ * @see org.eclipse.emf.cdo.tests.model2.impl.Model2PackageImpl#getTaskContainer()
+ * @generated
+ */
+ EClass TASK_CONTAINER = eINSTANCE.getTaskContainer();
+
+ /**
+ * The meta object literal for the '<em><b>Tasks</b></em>' containment reference list feature. <!-- begin-user-doc
+ * --> <!-- end-user-doc -->
+ *
+ * @generated
+ */
+ EReference TASK_CONTAINER__TASKS = eINSTANCE.getTaskContainer_Tasks();
+
+ /**
+ * The meta object literal for the '{@link org.eclipse.emf.cdo.tests.model2.impl.TaskImpl <em>Task</em>}' class.
+ * <!-- begin-user-doc --> <!-- end-user-doc -->
+ *
+ * @see org.eclipse.emf.cdo.tests.model2.impl.TaskImpl
+ * @see org.eclipse.emf.cdo.tests.model2.impl.Model2PackageImpl#getTask()
+ * @generated
+ */
+ EClass TASK = eINSTANCE.getTask();
+
+ /**
+ * The meta object literal for the '<em><b>Task Container</b></em>' container reference feature. <!-- begin-user-doc
+ * --> <!-- end-user-doc -->
+ *
+ * @generated
+ */
+ EReference TASK__TASK_CONTAINER = eINSTANCE.getTask_TaskContainer();
+
+ /**
+ * The meta object literal for the '<em><b>Description</b></em>' attribute feature. <!-- begin-user-doc --> <!--
+ * end-user-doc -->
+ *
+ * @generated
+ */
+ EAttribute TASK__DESCRIPTION = eINSTANCE.getTask_Description();
+
+ /**
+ * The meta object literal for the '<em><b>Done</b></em>' attribute feature. <!-- begin-user-doc --> <!--
+ * end-user-doc -->
+ *
+ * @generated
+ */
+ EAttribute TASK__DONE = eINSTANCE.getTask_Done();
+
}
} // Model2Package
diff --git a/plugins/org.eclipse.emf.cdo.tests.model2/src/org/eclipse/emf/cdo/tests/model2/Task.java b/plugins/org.eclipse.emf.cdo.tests.model2/src/org/eclipse/emf/cdo/tests/model2/Task.java
new file mode 100644
index 0000000000..ad3a92cc54
--- /dev/null
+++ b/plugins/org.eclipse.emf.cdo.tests.model2/src/org/eclipse/emf/cdo/tests/model2/Task.java
@@ -0,0 +1,110 @@
+/**
+ * <copyright>
+ * </copyright>
+ *
+ * $Id: Task.java,v 1.2 2008-10-19 01:28:55 smcduff Exp $
+ */
+package org.eclipse.emf.cdo.tests.model2;
+
+import org.eclipse.emf.ecore.EObject;
+
+/**
+ * <!-- begin-user-doc --> A representation of the model object '<em><b>Task</b></em>'. <!-- end-user-doc -->
+ * <p>
+ * The following features are supported:
+ * <ul>
+ * <li>{@link org.eclipse.emf.cdo.tests.model2.Task#getTaskContainer <em>Task Container</em>}</li>
+ * <li>{@link org.eclipse.emf.cdo.tests.model2.Task#getDescription <em>Description</em>}</li>
+ * <li>{@link org.eclipse.emf.cdo.tests.model2.Task#isDone <em>Done</em>}</li>
+ * </ul>
+ * </p>
+ *
+ * @see org.eclipse.emf.cdo.tests.model2.Model2Package#getTask()
+ * @model
+ * @generated
+ */
+public interface Task extends EObject
+{
+ /**
+ * Returns the value of the '<em><b>Task Container</b></em>' container reference. It is bidirectional and its opposite
+ * is '{@link org.eclipse.emf.cdo.tests.model2.TaskContainer#getTasks <em>Tasks</em>}'. <!-- begin-user-doc -->
+ * <p>
+ * If the meaning of the '<em>Task Container</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>Task Container</em>' container reference.
+ * @see #setTaskContainer(TaskContainer)
+ * @see org.eclipse.emf.cdo.tests.model2.Model2Package#getTask_TaskContainer()
+ * @see org.eclipse.emf.cdo.tests.model2.TaskContainer#getTasks
+ * @model opposite="tasks" transient="false"
+ * @generated
+ */
+ TaskContainer getTaskContainer();
+
+ /**
+ * Sets the value of the '{@link org.eclipse.emf.cdo.tests.model2.Task#getTaskContainer <em>Task Container</em>}'
+ * container reference. <!-- begin-user-doc --> <!-- end-user-doc -->
+ *
+ * @param value
+ * the new value of the '<em>Task Container</em>' container reference.
+ * @see #getTaskContainer()
+ * @generated
+ */
+ void setTaskContainer(TaskContainer value);
+
+ /**
+ * Returns the value of the '<em><b>Description</b></em>' attribute. <!-- begin-user-doc -->
+ * <p>
+ * If the meaning of the '<em>Description</em>' attribute isn't clear, there really should be more of a description
+ * here...
+ * </p>
+ * <!-- end-user-doc -->
+ *
+ * @return the value of the '<em>Description</em>' attribute.
+ * @see #setDescription(String)
+ * @see org.eclipse.emf.cdo.tests.model2.Model2Package#getTask_Description()
+ * @model
+ * @generated
+ */
+ String getDescription();
+
+ /**
+ * Sets the value of the '{@link org.eclipse.emf.cdo.tests.model2.Task#getDescription <em>Description</em>}'
+ * attribute. <!-- begin-user-doc --> <!-- end-user-doc -->
+ *
+ * @param value
+ * the new value of the '<em>Description</em>' attribute.
+ * @see #getDescription()
+ * @generated
+ */
+ void setDescription(String value);
+
+ /**
+ * Returns the value of the '<em><b>Done</b></em>' attribute. <!-- begin-user-doc -->
+ * <p>
+ * If the meaning of the '<em>Done</em>' attribute isn't clear, there really should be more of a description here...
+ * </p>
+ * <!-- end-user-doc -->
+ *
+ * @return the value of the '<em>Done</em>' attribute.
+ * @see #setDone(boolean)
+ * @see org.eclipse.emf.cdo.tests.model2.Model2Package#getTask_Done()
+ * @model
+ * @generated
+ */
+ boolean isDone();
+
+ /**
+ * Sets the value of the '{@link org.eclipse.emf.cdo.tests.model2.Task#isDone <em>Done</em>}' attribute. <!--
+ * begin-user-doc --> <!-- end-user-doc -->
+ *
+ * @param value
+ * the new value of the '<em>Done</em>' attribute.
+ * @see #isDone()
+ * @generated
+ */
+ void setDone(boolean value);
+
+} // Task
diff --git a/plugins/org.eclipse.emf.cdo.tests.model2/src/org/eclipse/emf/cdo/tests/model2/TaskContainer.java b/plugins/org.eclipse.emf.cdo.tests.model2/src/org/eclipse/emf/cdo/tests/model2/TaskContainer.java
new file mode 100644
index 0000000000..90d84c6562
--- /dev/null
+++ b/plugins/org.eclipse.emf.cdo.tests.model2/src/org/eclipse/emf/cdo/tests/model2/TaskContainer.java
@@ -0,0 +1,45 @@
+/**
+ * <copyright>
+ * </copyright>
+ *
+ * $Id: TaskContainer.java,v 1.2 2008-10-19 01:28:55 smcduff Exp $
+ */
+package org.eclipse.emf.cdo.tests.model2;
+
+import org.eclipse.emf.common.util.EList;
+import org.eclipse.emf.ecore.EObject;
+
+/**
+ * <!-- begin-user-doc --> A representation of the model object '<em><b>Task Container</b></em>'. <!-- end-user-doc -->
+ * <p>
+ * The following features are supported:
+ * <ul>
+ * <li>{@link org.eclipse.emf.cdo.tests.model2.TaskContainer#getTasks <em>Tasks</em>}</li>
+ * </ul>
+ * </p>
+ *
+ * @see org.eclipse.emf.cdo.tests.model2.Model2Package#getTaskContainer()
+ * @model
+ * @generated
+ */
+public interface TaskContainer extends EObject
+{
+ /**
+ * Returns the value of the '<em><b>Tasks</b></em>' containment reference list. The list contents are of type
+ * {@link org.eclipse.emf.cdo.tests.model2.Task}. It is bidirectional and its opposite is '
+ * {@link org.eclipse.emf.cdo.tests.model2.Task#getTaskContainer <em>Task Container</em>}'. <!-- begin-user-doc -->
+ * <p>
+ * If the meaning of the '<em>Tasks</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>Tasks</em>' containment reference list.
+ * @see org.eclipse.emf.cdo.tests.model2.Model2Package#getTaskContainer_Tasks()
+ * @see org.eclipse.emf.cdo.tests.model2.Task#getTaskContainer
+ * @model opposite="taskContainer" containment="true"
+ * @generated
+ */
+ EList<Task> getTasks();
+
+} // TaskContainer
diff --git a/plugins/org.eclipse.emf.cdo.tests.model2/src/org/eclipse/emf/cdo/tests/model2/impl/Model2FactoryImpl.java b/plugins/org.eclipse.emf.cdo.tests.model2/src/org/eclipse/emf/cdo/tests/model2/impl/Model2FactoryImpl.java
index c54424975f..6c099cd93a 100644
--- a/plugins/org.eclipse.emf.cdo.tests.model2/src/org/eclipse/emf/cdo/tests/model2/impl/Model2FactoryImpl.java
+++ b/plugins/org.eclipse.emf.cdo.tests.model2/src/org/eclipse/emf/cdo/tests/model2/impl/Model2FactoryImpl.java
@@ -2,13 +2,15 @@
* <copyright>
* </copyright>
*
- * $Id: Model2FactoryImpl.java,v 1.4 2008-09-18 12:56:55 estepper Exp $
+ * $Id: Model2FactoryImpl.java,v 1.5 2008-10-19 01:28:55 smcduff Exp $
*/
package org.eclipse.emf.cdo.tests.model2.impl;
import org.eclipse.emf.cdo.tests.model2.Model2Factory;
import org.eclipse.emf.cdo.tests.model2.Model2Package;
import org.eclipse.emf.cdo.tests.model2.SpecialPurchaseOrder;
+import org.eclipse.emf.cdo.tests.model2.Task;
+import org.eclipse.emf.cdo.tests.model2.TaskContainer;
import org.eclipse.emf.ecore.EClass;
import org.eclipse.emf.ecore.EObject;
@@ -68,6 +70,10 @@ public class Model2FactoryImpl extends EFactoryImpl implements Model2Factory
{
case Model2Package.SPECIAL_PURCHASE_ORDER:
return createSpecialPurchaseOrder();
+ case Model2Package.TASK_CONTAINER:
+ return createTaskContainer();
+ case Model2Package.TASK:
+ return createTask();
default:
throw new IllegalArgumentException("The class '" + eClass.getName() + "' is not a valid classifier");
}
@@ -89,6 +95,28 @@ public class Model2FactoryImpl extends EFactoryImpl implements Model2Factory
*
* @generated
*/
+ public TaskContainer createTaskContainer()
+ {
+ TaskContainerImpl taskContainer = new TaskContainerImpl();
+ return taskContainer;
+ }
+
+ /**
+ * <!-- begin-user-doc --> <!-- end-user-doc -->
+ *
+ * @generated
+ */
+ public Task createTask()
+ {
+ TaskImpl task = new TaskImpl();
+ return task;
+ }
+
+ /**
+ * <!-- begin-user-doc --> <!-- end-user-doc -->
+ *
+ * @generated
+ */
public Model2Package getModel2Package()
{
return (Model2Package)getEPackage();
diff --git a/plugins/org.eclipse.emf.cdo.tests.model2/src/org/eclipse/emf/cdo/tests/model2/impl/Model2PackageImpl.java b/plugins/org.eclipse.emf.cdo.tests.model2/src/org/eclipse/emf/cdo/tests/model2/impl/Model2PackageImpl.java
index e416a5b275..146f0e7186 100644
--- a/plugins/org.eclipse.emf.cdo.tests.model2/src/org/eclipse/emf/cdo/tests/model2/impl/Model2PackageImpl.java
+++ b/plugins/org.eclipse.emf.cdo.tests.model2/src/org/eclipse/emf/cdo/tests/model2/impl/Model2PackageImpl.java
@@ -2,7 +2,7 @@
* <copyright>
* </copyright>
*
- * $Id: Model2PackageImpl.java,v 1.6 2008-09-18 12:56:55 estepper Exp $
+ * $Id: Model2PackageImpl.java,v 1.7 2008-10-19 01:28:55 smcduff Exp $
*/
package org.eclipse.emf.cdo.tests.model2.impl;
@@ -10,6 +10,8 @@ import org.eclipse.emf.cdo.tests.model1.Model1Package;
import org.eclipse.emf.cdo.tests.model2.Model2Factory;
import org.eclipse.emf.cdo.tests.model2.Model2Package;
import org.eclipse.emf.cdo.tests.model2.SpecialPurchaseOrder;
+import org.eclipse.emf.cdo.tests.model2.Task;
+import org.eclipse.emf.cdo.tests.model2.TaskContainer;
import org.eclipse.emf.ecore.EAttribute;
import org.eclipse.emf.ecore.EClass;
@@ -32,6 +34,20 @@ public class Model2PackageImpl extends EPackageImpl implements Model2Package
private EClass specialPurchaseOrderEClass = null;
/**
+ * <!-- begin-user-doc --> <!-- end-user-doc -->
+ *
+ * @generated
+ */
+ private EClass taskContainerEClass = null;
+
+ /**
+ * <!-- begin-user-doc --> <!-- end-user-doc -->
+ *
+ * @generated
+ */
+ private EClass taskEClass = null;
+
+ /**
* Creates an instance of the model <b>Package</b>, registered with {@link org.eclipse.emf.ecore.EPackage.Registry
* EPackage.Registry} by the package package URI value.
* <p>
@@ -138,6 +154,66 @@ public class Model2PackageImpl extends EPackageImpl implements Model2Package
*
* @generated
*/
+ public EClass getTaskContainer()
+ {
+ return taskContainerEClass;
+ }
+
+ /**
+ * <!-- begin-user-doc --> <!-- end-user-doc -->
+ *
+ * @generated
+ */
+ public EReference getTaskContainer_Tasks()
+ {
+ return (EReference)taskContainerEClass.getEStructuralFeatures().get(0);
+ }
+
+ /**
+ * <!-- begin-user-doc --> <!-- end-user-doc -->
+ *
+ * @generated
+ */
+ public EClass getTask()
+ {
+ return taskEClass;
+ }
+
+ /**
+ * <!-- begin-user-doc --> <!-- end-user-doc -->
+ *
+ * @generated
+ */
+ public EReference getTask_TaskContainer()
+ {
+ return (EReference)taskEClass.getEStructuralFeatures().get(0);
+ }
+
+ /**
+ * <!-- begin-user-doc --> <!-- end-user-doc -->
+ *
+ * @generated
+ */
+ public EAttribute getTask_Description()
+ {
+ return (EAttribute)taskEClass.getEStructuralFeatures().get(1);
+ }
+
+ /**
+ * <!-- begin-user-doc --> <!-- end-user-doc -->
+ *
+ * @generated
+ */
+ public EAttribute getTask_Done()
+ {
+ return (EAttribute)taskEClass.getEStructuralFeatures().get(2);
+ }
+
+ /**
+ * <!-- begin-user-doc --> <!-- end-user-doc -->
+ *
+ * @generated
+ */
public Model2Factory getModel2Factory()
{
return (Model2Factory)getEFactoryInstance();
@@ -168,6 +244,14 @@ public class Model2PackageImpl extends EPackageImpl implements Model2Package
specialPurchaseOrderEClass = createEClass(SPECIAL_PURCHASE_ORDER);
createEAttribute(specialPurchaseOrderEClass, SPECIAL_PURCHASE_ORDER__DISCOUNT_CODE);
createEReference(specialPurchaseOrderEClass, SPECIAL_PURCHASE_ORDER__SHIPPING_ADDRESS);
+
+ taskContainerEClass = createEClass(TASK_CONTAINER);
+ createEReference(taskContainerEClass, TASK_CONTAINER__TASKS);
+
+ taskEClass = createEClass(TASK);
+ createEReference(taskEClass, TASK__TASK_CONTAINER);
+ createEAttribute(taskEClass, TASK__DESCRIPTION);
+ createEAttribute(taskEClass, TASK__DONE);
}
/**
@@ -216,6 +300,21 @@ public class Model2PackageImpl extends EPackageImpl implements Model2Package
null, 0, 1, SpecialPurchaseOrder.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, IS_COMPOSITE,
!IS_RESOLVE_PROXIES, !IS_UNSETTABLE, IS_UNIQUE, !IS_DERIVED, IS_ORDERED);
+ initEClass(taskContainerEClass, TaskContainer.class, "TaskContainer", !IS_ABSTRACT, !IS_INTERFACE,
+ IS_GENERATED_INSTANCE_CLASS);
+ initEReference(getTaskContainer_Tasks(), getTask(), getTask_TaskContainer(), "tasks", null, 0, -1,
+ TaskContainer.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, IS_COMPOSITE, !IS_RESOLVE_PROXIES,
+ !IS_UNSETTABLE, IS_UNIQUE, !IS_DERIVED, IS_ORDERED);
+
+ initEClass(taskEClass, Task.class, "Task", !IS_ABSTRACT, !IS_INTERFACE, IS_GENERATED_INSTANCE_CLASS);
+ initEReference(getTask_TaskContainer(), getTaskContainer(), getTaskContainer_Tasks(), "taskContainer", null, 0, 1,
+ Task.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, !IS_COMPOSITE, !IS_RESOLVE_PROXIES, !IS_UNSETTABLE,
+ IS_UNIQUE, !IS_DERIVED, IS_ORDERED);
+ initEAttribute(getTask_Description(), ecorePackage.getEString(), "description", null, 0, 1, Task.class,
+ !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, !IS_UNSETTABLE, !IS_ID, IS_UNIQUE, !IS_DERIVED, IS_ORDERED);
+ initEAttribute(getTask_Done(), ecorePackage.getEBoolean(), "done", null, 0, 1, Task.class, !IS_TRANSIENT,
+ !IS_VOLATILE, IS_CHANGEABLE, !IS_UNSETTABLE, !IS_ID, IS_UNIQUE, !IS_DERIVED, IS_ORDERED);
+
// Create resource
createResource(eNS_URI);
}
diff --git a/plugins/org.eclipse.emf.cdo.tests.model2/src/org/eclipse/emf/cdo/tests/model2/impl/TaskContainerImpl.java b/plugins/org.eclipse.emf.cdo.tests.model2/src/org/eclipse/emf/cdo/tests/model2/impl/TaskContainerImpl.java
new file mode 100644
index 0000000000..a73f847086
--- /dev/null
+++ b/plugins/org.eclipse.emf.cdo.tests.model2/src/org/eclipse/emf/cdo/tests/model2/impl/TaskContainerImpl.java
@@ -0,0 +1,74 @@
+/**
+ * <copyright>
+ * </copyright>
+ *
+ * $Id: TaskContainerImpl.java,v 1.2 2008-10-19 01:28:55 smcduff Exp $
+ */
+package org.eclipse.emf.cdo.tests.model2.impl;
+
+import org.eclipse.emf.cdo.tests.model2.Model2Package;
+import org.eclipse.emf.cdo.tests.model2.Task;
+import org.eclipse.emf.cdo.tests.model2.TaskContainer;
+
+import org.eclipse.emf.internal.cdo.CDOObjectImpl;
+
+import org.eclipse.emf.common.util.EList;
+import org.eclipse.emf.ecore.EClass;
+
+/**
+ * <!-- begin-user-doc --> An implementation of the model object '<em><b>Task Container</b></em>'. <!-- end-user-doc -->
+ * <p>
+ * The following features are implemented:
+ * <ul>
+ * <li>{@link org.eclipse.emf.cdo.tests.model2.impl.TaskContainerImpl#getTasks <em>Tasks</em>}</li>
+ * </ul>
+ * </p>
+ *
+ * @generated
+ */
+public class TaskContainerImpl extends CDOObjectImpl implements TaskContainer
+{
+ /**
+ * <!-- begin-user-doc --> <!-- end-user-doc -->
+ *
+ * @generated
+ */
+ protected TaskContainerImpl()
+ {
+ super();
+ }
+
+ /**
+ * <!-- begin-user-doc --> <!-- end-user-doc -->
+ *
+ * @generated
+ */
+ @Override
+ protected EClass eStaticClass()
+ {
+ return Model2Package.Literals.TASK_CONTAINER;
+ }
+
+ /**
+ * <!-- begin-user-doc --> <!-- end-user-doc -->
+ *
+ * @generated
+ */
+ @Override
+ protected int eStaticFeatureCount()
+ {
+ return 0;
+ }
+
+ /**
+ * <!-- begin-user-doc --> <!-- end-user-doc -->
+ *
+ * @generated
+ */
+ @SuppressWarnings("unchecked")
+ public EList<Task> getTasks()
+ {
+ return (EList<Task>)eGet(Model2Package.Literals.TASK_CONTAINER__TASKS, true);
+ }
+
+} // TaskContainerImpl
diff --git a/plugins/org.eclipse.emf.cdo.tests.model2/src/org/eclipse/emf/cdo/tests/model2/impl/TaskImpl.java b/plugins/org.eclipse.emf.cdo.tests.model2/src/org/eclipse/emf/cdo/tests/model2/impl/TaskImpl.java
new file mode 100644
index 0000000000..769f382873
--- /dev/null
+++ b/plugins/org.eclipse.emf.cdo.tests.model2/src/org/eclipse/emf/cdo/tests/model2/impl/TaskImpl.java
@@ -0,0 +1,124 @@
+/**
+ * <copyright>
+ * </copyright>
+ *
+ * $Id: TaskImpl.java,v 1.2 2008-10-19 01:28:55 smcduff Exp $
+ */
+package org.eclipse.emf.cdo.tests.model2.impl;
+
+import org.eclipse.emf.cdo.tests.model2.Model2Package;
+import org.eclipse.emf.cdo.tests.model2.Task;
+import org.eclipse.emf.cdo.tests.model2.TaskContainer;
+
+import org.eclipse.emf.internal.cdo.CDOObjectImpl;
+
+import org.eclipse.emf.ecore.EClass;
+
+/**
+ * <!-- begin-user-doc --> An implementation of the model object '<em><b>Task</b></em>'. <!-- end-user-doc -->
+ * <p>
+ * The following features are implemented:
+ * <ul>
+ * <li>{@link org.eclipse.emf.cdo.tests.model2.impl.TaskImpl#getTaskContainer <em>Task Container</em>}</li>
+ * <li>{@link org.eclipse.emf.cdo.tests.model2.impl.TaskImpl#getDescription <em>Description</em>}</li>
+ * <li>{@link org.eclipse.emf.cdo.tests.model2.impl.TaskImpl#isDone <em>Done</em>}</li>
+ * </ul>
+ * </p>
+ *
+ * @generated
+ */
+public class TaskImpl extends CDOObjectImpl implements Task
+{
+ /**
+ * <!-- begin-user-doc --> <!-- end-user-doc -->
+ *
+ * @generated
+ */
+ protected TaskImpl()
+ {
+ super();
+ }
+
+ /**
+ * <!-- begin-user-doc --> <!-- end-user-doc -->
+ *
+ * @generated
+ */
+ @Override
+ protected EClass eStaticClass()
+ {
+ return Model2Package.Literals.TASK;
+ }
+
+ /**
+ * <!-- begin-user-doc --> <!-- end-user-doc -->
+ *
+ * @generated
+ */
+ @Override
+ protected int eStaticFeatureCount()
+ {
+ return 0;
+ }
+
+ /**
+ * <!-- begin-user-doc --> <!-- end-user-doc -->
+ *
+ * @generated
+ */
+ public TaskContainer getTaskContainer()
+ {
+ return (TaskContainer)eGet(Model2Package.Literals.TASK__TASK_CONTAINER, true);
+ }
+
+ /**
+ * <!-- begin-user-doc --> <!-- end-user-doc -->
+ *
+ * @generated
+ */
+ public void setTaskContainer(TaskContainer newTaskContainer)
+ {
+ eSet(Model2Package.Literals.TASK__TASK_CONTAINER, newTaskContainer);
+ }
+
+ /**
+ * <!-- begin-user-doc --> <!-- end-user-doc -->
+ *
+ * @generated
+ */
+ public String getDescription()
+ {
+ return (String)eGet(Model2Package.Literals.TASK__DESCRIPTION, true);
+ }
+
+ /**
+ * <!-- begin-user-doc --> <!-- end-user-doc -->
+ *
+ * @generated
+ */
+ public void setDescription(String newDescription)
+ {
+ eSet(Model2Package.Literals.TASK__DESCRIPTION, newDescription);
+ }
+
+ /**
+ * <!-- begin-user-doc --> <!-- end-user-doc -->
+ *
+ * @generated
+ */
+ public boolean isDone()
+ {
+ return ((Boolean)eGet(Model2Package.Literals.TASK__DONE, true)).booleanValue();
+ }
+
+ /**
+ * <!-- begin-user-doc --> <!-- end-user-doc -->
+ *
+ * @generated
+ */
+ public void setDone(boolean newDone)
+ {
+ eSet(Model2Package.Literals.TASK__DONE, new Boolean(newDone));
+ }
+
+} // TaskImpl
diff --git a/plugins/org.eclipse.emf.cdo.tests.model2/src/org/eclipse/emf/cdo/tests/model2/util/Model2AdapterFactory.java b/plugins/org.eclipse.emf.cdo.tests.model2/src/org/eclipse/emf/cdo/tests/model2/util/Model2AdapterFactory.java
index 56418eac30..c80935be66 100644
--- a/plugins/org.eclipse.emf.cdo.tests.model2/src/org/eclipse/emf/cdo/tests/model2/util/Model2AdapterFactory.java
+++ b/plugins/org.eclipse.emf.cdo.tests.model2/src/org/eclipse/emf/cdo/tests/model2/util/Model2AdapterFactory.java
@@ -2,7 +2,7 @@
* <copyright>
* </copyright>
*
- * $Id: Model2AdapterFactory.java,v 1.4 2008-09-18 12:56:55 estepper Exp $
+ * $Id: Model2AdapterFactory.java,v 1.5 2008-10-19 01:28:55 smcduff Exp $
*/
package org.eclipse.emf.cdo.tests.model2.util;
@@ -10,6 +10,8 @@ import org.eclipse.emf.cdo.tests.model1.Order;
import org.eclipse.emf.cdo.tests.model1.PurchaseOrder;
import org.eclipse.emf.cdo.tests.model2.Model2Package;
import org.eclipse.emf.cdo.tests.model2.SpecialPurchaseOrder;
+import org.eclipse.emf.cdo.tests.model2.Task;
+import org.eclipse.emf.cdo.tests.model2.TaskContainer;
import org.eclipse.emf.common.notify.Adapter;
import org.eclipse.emf.common.notify.Notifier;
@@ -81,6 +83,18 @@ public class Model2AdapterFactory extends AdapterFactoryImpl
}
@Override
+ public Adapter caseTaskContainer(TaskContainer object)
+ {
+ return createTaskContainerAdapter();
+ }
+
+ @Override
+ public Adapter caseTask(Task object)
+ {
+ return createTaskAdapter();
+ }
+
+ @Override
public Adapter caseOrder(Order object)
{
return createOrderAdapter();
@@ -129,6 +143,34 @@ public class Model2AdapterFactory extends AdapterFactoryImpl
}
/**
+ * Creates a new adapter for an object of class '{@link org.eclipse.emf.cdo.tests.model2.TaskContainer
+ * <em>Task Container</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 -->
+ *
+ * @return the new adapter.
+ * @see org.eclipse.emf.cdo.tests.model2.TaskContainer
+ * @generated
+ */
+ public Adapter createTaskContainerAdapter()
+ {
+ return null;
+ }
+
+ /**
+ * Creates a new adapter for an object of class '{@link org.eclipse.emf.cdo.tests.model2.Task <em>Task</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 -->
+ *
+ * @return the new adapter.
+ * @see org.eclipse.emf.cdo.tests.model2.Task
+ * @generated
+ */
+ public Adapter createTaskAdapter()
+ {
+ return null;
+ }
+
+ /**
* Creates a new adapter for an object of class '{@link org.eclipse.emf.cdo.tests.model1.Order <em>Order</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.tests.model2/src/org/eclipse/emf/cdo/tests/model2/util/Model2Switch.java b/plugins/org.eclipse.emf.cdo.tests.model2/src/org/eclipse/emf/cdo/tests/model2/util/Model2Switch.java
index e77c713041..b9a344eb96 100644
--- a/plugins/org.eclipse.emf.cdo.tests.model2/src/org/eclipse/emf/cdo/tests/model2/util/Model2Switch.java
+++ b/plugins/org.eclipse.emf.cdo.tests.model2/src/org/eclipse/emf/cdo/tests/model2/util/Model2Switch.java
@@ -2,7 +2,7 @@
* <copyright>
* </copyright>
*
- * $Id: Model2Switch.java,v 1.5 2008-09-18 12:56:55 estepper Exp $
+ * $Id: Model2Switch.java,v 1.6 2008-10-19 01:28:55 smcduff Exp $
*/
package org.eclipse.emf.cdo.tests.model2.util;
@@ -10,6 +10,8 @@ import org.eclipse.emf.cdo.tests.model1.Order;
import org.eclipse.emf.cdo.tests.model1.PurchaseOrder;
import org.eclipse.emf.cdo.tests.model2.Model2Package;
import org.eclipse.emf.cdo.tests.model2.SpecialPurchaseOrder;
+import org.eclipse.emf.cdo.tests.model2.Task;
+import org.eclipse.emf.cdo.tests.model2.TaskContainer;
import org.eclipse.emf.ecore.EClass;
import org.eclipse.emf.ecore.EObject;
@@ -108,6 +110,26 @@ public class Model2Switch<T>
}
return result;
}
+ case Model2Package.TASK_CONTAINER:
+ {
+ TaskContainer taskContainer = (TaskContainer)theEObject;
+ T result = caseTaskContainer(taskContainer);
+ if (result == null)
+ {
+ result = defaultCase(theEObject);
+ }
+ return result;
+ }
+ case Model2Package.TASK:
+ {
+ Task task = (Task)theEObject;
+ T result = caseTask(task);
+ if (result == null)
+ {
+ result = defaultCase(theEObject);
+ }
+ return result;
+ }
default:
return defaultCase(theEObject);
}
@@ -130,6 +152,36 @@ public class Model2Switch<T>
}
/**
+ * Returns the result of interpreting the object as an instance of '<em>Task Container</em>'. <!-- begin-user-doc -->
+ * This implementation returns null; returning a non-null result will terminate the switch. <!-- end-user-doc -->
+ *
+ * @param object
+ * the target of the switch.
+ * @return the result of interpreting the object as an instance of '<em>Task Container</em>'.
+ * @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject)
+ * @generated
+ */
+ public T caseTaskContainer(TaskContainer object)
+ {
+ return null;
+ }
+
+ /**
+ * Returns the result of interpreting the object as an instance of '<em>Task</em>'. <!-- begin-user-doc --> This
+ * implementation returns null; returning a non-null result will terminate the switch. <!-- end-user-doc -->
+ *
+ * @param object
+ * the target of the switch.
+ * @return the result of interpreting the object as an instance of '<em>Task</em>'.
+ * @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject)
+ * @generated
+ */
+ public T caseTask(Task object)
+ {
+ return null;
+ }
+
+ /**
* Returns the result of interpreting the object as an instance of '<em>Order</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.tests/src/org/eclipse/emf/cdo/tests/AbstractCDOTest.java b/plugins/org.eclipse.emf.cdo.tests/src/org/eclipse/emf/cdo/tests/AbstractCDOTest.java
index 565e93c384..f6f7b3dabe 100644
--- a/plugins/org.eclipse.emf.cdo.tests/src/org/eclipse/emf/cdo/tests/AbstractCDOTest.java
+++ b/plugins/org.eclipse.emf.cdo.tests/src/org/eclipse/emf/cdo/tests/AbstractCDOTest.java
@@ -101,7 +101,14 @@ public abstract class AbstractCDOTest extends ConfigTest
assertNotNull(object.cdoID());
assertNotNull(object.cdoRevision());
assertNotNull(object.cdoView());
- assertNotNull(object.eResource());
+ if (eObject instanceof CDOResource && ((CDOResource)eObject).isRoot())
+ {
+ assertNull(object.eResource());
+ }
+ else
+ {
+ assertNotNull(object.eResource());
+ }
assertEquals(view, object.cdoView());
assertEquals(object, view.getObject(object.cdoID(), false));
}
@@ -135,9 +142,6 @@ public abstract class AbstractCDOTest extends ConfigTest
assertEquals(false, FSMUtil.isTransient(object));
assertNotNull(object.cdoID());
assertNotNull(object.cdoView());
- assertNotNull(object.cdoResource());
- assertNotNull(object.eResource());
- assertEquals(object.eResource(), object.cdoResource());
assertEquals(CDOState.PROXY, object.cdoState());
}
}
@@ -148,16 +152,16 @@ public abstract class AbstractCDOTest extends ConfigTest
CDOObject contained = CDOUtil.getCDOObject(eContained);
if (container != null && contained != null)
{
- assertEquals(container.eResource(), contained.eResource());
assertEquals(true, container.eContents().contains(contained));
if (container instanceof CDOResource)
{
- assertEquals(container.eResource(), container.cdoResource());
+ assertEquals(container, contained.eResource());
assertEquals(null, contained.eContainer());
assertEquals(true, ((CDOResource)container).getContents().contains(contained));
}
else
{
+ assertEquals(container.eResource(), contained.eResource());
assertEquals(container, contained.eContainer());
}
}
diff --git a/plugins/org.eclipse.emf.cdo.tests/src/org/eclipse/emf/cdo/tests/AllTestsAllConfigs.java b/plugins/org.eclipse.emf.cdo.tests/src/org/eclipse/emf/cdo/tests/AllTestsAllConfigs.java
index 438a5340e1..6ea5a27bb0 100644
--- a/plugins/org.eclipse.emf.cdo.tests/src/org/eclipse/emf/cdo/tests/AllTestsAllConfigs.java
+++ b/plugins/org.eclipse.emf.cdo.tests/src/org/eclipse/emf/cdo/tests/AllTestsAllConfigs.java
@@ -17,6 +17,7 @@ import org.eclipse.emf.cdo.tests.bugzilla.Bugzilla_246442_Test;
import org.eclipse.emf.cdo.tests.bugzilla.Bugzilla_246456_Test;
import org.eclipse.emf.cdo.tests.bugzilla.Bugzilla_246622_Test;
import org.eclipse.emf.cdo.tests.bugzilla.Bugzilla_248124_Test;
+import org.eclipse.emf.cdo.tests.bugzilla.Bugzilla_248915_Test;
import org.eclipse.emf.cdo.tests.bugzilla.Bugzilla_250036_Test;
import org.eclipse.emf.cdo.tests.bugzilla.Bugzilla_250757_Test;
import org.eclipse.emf.cdo.tests.bugzilla.Bugzilla_251087_Test;
@@ -83,6 +84,7 @@ public class AllTestsAllConfigs extends ConfigTestSuite
testClasses.add(Bugzilla_246456_Test.class);
testClasses.add(Bugzilla_246622_Test.class);
testClasses.add(Bugzilla_248124_Test.class);
+ testClasses.add(Bugzilla_248915_Test.class);
testClasses.add(Bugzilla_250036_Test.class);
testClasses.add(Bugzilla_250757_Test.class);
testClasses.add(Bugzilla_251087_Test.class);
diff --git a/plugins/org.eclipse.emf.cdo.tests/src/org/eclipse/emf/cdo/tests/ComplexTest.java b/plugins/org.eclipse.emf.cdo.tests/src/org/eclipse/emf/cdo/tests/ComplexTest.java
index 906919a305..cf094864ff 100644
--- a/plugins/org.eclipse.emf.cdo.tests/src/org/eclipse/emf/cdo/tests/ComplexTest.java
+++ b/plugins/org.eclipse.emf.cdo.tests/src/org/eclipse/emf/cdo/tests/ComplexTest.java
@@ -83,8 +83,8 @@ public class ComplexTest extends AbstractCDOTest
transaction = session.openTransaction();
- String path1 = "/resources/1/" + uniqueCounter;
- String path2 = "/resources/2/" + uniqueCounter;
+ String path1 = "/resources/folder1/" + uniqueCounter;
+ String path2 = "/resources/folder2/" + uniqueCounter;
++uniqueCounter;
resource1 = transaction.createResource(path1);
@@ -478,14 +478,15 @@ public class ComplexTest extends AbstractCDOTest
public void testMultipleTransactions3()
{
-
CDOTransaction transaction1 = session.openTransaction();
String resource1path = "/resources/3/" + uniqueCounter;
CDOResource resource1 = transaction1.createResource(resource1path);
+ transaction1.commit();
CDOTransaction transaction2 = session.openTransaction();
String resource2path = "/resources/4/" + uniqueCounter++;
CDOResource resource2 = transaction2.createResource(resource2path);
+ transaction2.commit();
MultiContainedElement element0 = factory.createMultiContainedElement();
element0.setName("MultipleTransactions-Element-0");
@@ -534,10 +535,12 @@ public class ComplexTest extends AbstractCDOTest
CDOTransaction transaction1 = session.openTransaction();
String resource1path = "/resources/3/" + uniqueCounter;
CDOResource resource1 = transaction1.createResource(resource1path);
+ transaction1.commit();
CDOTransaction transaction2 = session.openTransaction();
String resource2path = "/resources/4/" + uniqueCounter++;
CDOResource resource2 = transaction2.createResource(resource2path);
+ transaction2.commit();
MultiContainedElement element0 = factory.createMultiContainedElement();
element0.setName("MultipleTransactions-Element-0");
@@ -573,12 +576,12 @@ public class ComplexTest extends AbstractCDOTest
for (EObject o : elementToRemove)
{
MultiContainedElement element_work = (MultiContainedElement)o;
- assertEquals(resource1FromTx2, CDOUtil.getCDOObject(element_work).cdoResource());
+ assertEquals(resource1FromTx2, CDOUtil.getCDOObject(element_work).cdoDirectResource());
assertEquals(resource1FromTx2, element_work.eResource());
container.getElements().add(element_work);
- assertEquals(null, CDOUtil.getCDOObject(element_work).cdoResource());
+ assertEquals(null, CDOUtil.getCDOObject(element_work).cdoDirectResource());
assertEquals(resource2, element_work.eResource());
transaction2.commit();
}
@@ -602,13 +605,13 @@ public class ComplexTest extends AbstractCDOTest
assertTrue(element.getParent() == container2);
assertTrue(element.eContainer() == container2);
- assertTrue(CDOUtil.getCDOObject(element).cdoResource() == null);
+ assertTrue(CDOUtil.getCDOObject(element).cdoDirectResource() == null);
assertTrue(container1.getElement() == null);
- assertTrue(CDOUtil.getCDOObject(container1).cdoResource() == resource1);
+ assertTrue(CDOUtil.getCDOObject(container1).cdoDirectResource() == resource1);
assertTrue(container2.getElement() == element);
- assertTrue(CDOUtil.getCDOObject(container2).cdoResource() == resource2);
+ assertTrue(CDOUtil.getCDOObject(container2).cdoDirectResource() == resource2);
}
public void testMigrateContainmentMulti()
@@ -634,19 +637,19 @@ public class ComplexTest extends AbstractCDOTest
assertTrue(elementA.getParent() == container2);
assertTrue(elementA.eContainer() == container2);
- assertTrue(CDOUtil.getCDOObject(elementA).cdoResource() == null);
+ assertTrue(CDOUtil.getCDOObject(elementA).cdoDirectResource() == null);
assertTrue(elementA.eResource() == resource2);
assertTrue(elementB.getParent() == container1);
assertTrue(elementB.eContainer() == container1);
- assertTrue(CDOUtil.getCDOObject(elementB).cdoResource() == null);
+ assertTrue(CDOUtil.getCDOObject(elementB).cdoDirectResource() == null);
assertTrue(elementB.eResource() == resource1);
- assertTrue(CDOUtil.getCDOObject(container1).cdoResource() == resource1);
+ assertTrue(CDOUtil.getCDOObject(container1).cdoDirectResource() == resource1);
assertEquals(1, container1.getElements().size());
assertEquals(elementB, container1.getElements().get(0));
- assertTrue(CDOUtil.getCDOObject(container2).cdoResource() == resource2);
+ assertTrue(CDOUtil.getCDOObject(container2).cdoDirectResource() == resource2);
assertEquals(1, container2.getElements().size());
assertEquals(elementA, container2.getElements().get(0));
}
diff --git a/plugins/org.eclipse.emf.cdo.tests/src/org/eclipse/emf/cdo/tests/ContainmentTest.java b/plugins/org.eclipse.emf.cdo.tests/src/org/eclipse/emf/cdo/tests/ContainmentTest.java
index 5bcb7d1194..9019d89699 100644
--- a/plugins/org.eclipse.emf.cdo.tests/src/org/eclipse/emf/cdo/tests/ContainmentTest.java
+++ b/plugins/org.eclipse.emf.cdo.tests/src/org/eclipse/emf/cdo/tests/ContainmentTest.java
@@ -19,6 +19,8 @@ import org.eclipse.emf.cdo.tests.model1.Company;
import org.eclipse.emf.cdo.tests.model1.Order;
import org.eclipse.emf.cdo.tests.model1.Supplier;
import org.eclipse.emf.cdo.tests.model2.SpecialPurchaseOrder;
+import org.eclipse.emf.cdo.tests.model2.Task;
+import org.eclipse.emf.cdo.tests.model2.TaskContainer;
import org.eclipse.emf.common.util.EList;
import org.eclipse.emf.common.util.URI;
@@ -482,6 +484,28 @@ public class ContainmentTest extends AbstractCDOTest
assertEquals(container, contained.eContainer());
}
+ public void testModeledBackPointer() throws Exception
+ {
+ Task task = getModel2Factory().createTask();
+ task.setDescription("Task 1");
+
+ TaskContainer taskContainer = getModel2Factory().createTaskContainer();
+ taskContainer.getTasks().add(task);
+ assertEquals(taskContainer, task.eContainer());
+ assertEquals(taskContainer, task.getTaskContainer());
+
+ CDOSession session = openModel2Session();
+ CDOTransaction transaction = session.openTransaction();
+ CDOResource resource = transaction.createResource("/resource1");
+ resource.getContents().add(taskContainer);
+
+ transaction.commit();
+ assertEquals(taskContainer, task.eContainer());
+ assertEquals(taskContainer, task.getTaskContainer());
+ session.close();
+ }
+
+ // TODO Revisit me
// Do not support legacy system
public void _testBug246540() throws Exception
{
diff --git a/plugins/org.eclipse.emf.cdo.tests/src/org/eclipse/emf/cdo/tests/DetachTest.java b/plugins/org.eclipse.emf.cdo.tests/src/org/eclipse/emf/cdo/tests/DetachTest.java
index 84a78e6af3..c2d8b6ceff 100644
--- a/plugins/org.eclipse.emf.cdo.tests/src/org/eclipse/emf/cdo/tests/DetachTest.java
+++ b/plugins/org.eclipse.emf.cdo.tests/src/org/eclipse/emf/cdo/tests/DetachTest.java
@@ -213,7 +213,7 @@ public class DetachTest extends AbstractCDOTest
orderDetail.setProduct(product1);
assertActive(resource);
Assert.assertEquals(1, CDOUtil.getViewSet(rset).getViews().length);
- Assert.assertEquals(1, rset.getResources().size());
+ Assert.assertEquals(2, rset.getResources().size());
if (commitBeforeDelete == true)
{
transaction.commit();
@@ -229,7 +229,7 @@ public class DetachTest extends AbstractCDOTest
assertTransient(product1);
assertEquals(1, CDOUtil.getViewSet(rset).getViews().length);
- assertEquals(0, rset.getResources().size());
+ assertEquals(1, rset.getResources().size());
assertEquals(2, resource.getContents().size());
assertEquals(true, resource.getContents().contains(order));
assertEquals(true, resource.getContents().contains(product1));
@@ -249,7 +249,6 @@ public class DetachTest extends AbstractCDOTest
msg("Opening transaction");
CDOTransaction transaction = session.openTransaction();
-
ResourceSet rset = transaction.getResourceSet();
msg("Creating resource");
@@ -348,7 +347,7 @@ public class DetachTest extends AbstractCDOTest
}
}.timedOut();
- assertTrue(rSet1.getResources().size() == 0);
+ assertEquals(1, rSet1.getResources().size());
assertEquals(false, timedOut);
assertTransient(res);
assertInvalid(res2);
diff --git a/plugins/org.eclipse.emf.cdo.tests/src/org/eclipse/emf/cdo/tests/ExternalReferenceTest.java b/plugins/org.eclipse.emf.cdo.tests/src/org/eclipse/emf/cdo/tests/ExternalReferenceTest.java
index 84bfe1ba15..4f77c4a6aa 100644
--- a/plugins/org.eclipse.emf.cdo.tests/src/org/eclipse/emf/cdo/tests/ExternalReferenceTest.java
+++ b/plugins/org.eclipse.emf.cdo.tests/src/org/eclipse/emf/cdo/tests/ExternalReferenceTest.java
@@ -25,6 +25,7 @@ import org.eclipse.emf.cdo.util.CDOUtil;
import org.eclipse.net4j.util.transaction.TransactionException;
+import org.eclipse.emf.common.util.EList;
import org.eclipse.emf.common.util.URI;
import org.eclipse.emf.ecore.EAttribute;
import org.eclipse.emf.ecore.EClass;
@@ -161,21 +162,15 @@ public class ExternalReferenceTest extends AbstractCDOTest
CDOResource resA = transactionA1.createResource("/resA");
CDOResource resB = transactionB1.createResource("/resB");
- assertEquals(2, resourceSet.getResources().size());
- // assertEquals(resA, resourceSet.getResource(CDOUtil.createResourceURI(sessionA, "/resA"), false));
- // assertEquals(resB, resourceSet.getResource(CDOUtil.createResourceURI(sessionA, "/resB"), false));
+ EList<Resource> resources = resourceSet.getResources();
+ assertEquals(4, resources.size());
- // CDOResource resC = (CDOResource)resourceSet.createResource(CDOUtil.createResourceURI(sessionA, "/resC"));
- // assertEquals(transactionA1, resC.cdoView());
CDOResource resC = transactionA1.createResource("/resC");
assertNotNull(resC);
-
- assertEquals(3, resourceSet.getResources().size());
- // assertEquals(resC, resourceSet.getResource(CDOUtil.createResourceURI(sessionA, "/resC"), false));
+ assertEquals(5, resources.size());
Resource resD = resourceSet.createResource(URI.createURI("test://1"));
-
- assertEquals(4, resourceSet.getResources().size());
+ assertEquals(6, resources.size());
assertEquals(false, resD instanceof CDOResource);
Company companyA = getModel1Factory().createCompany();
diff --git a/plugins/org.eclipse.emf.cdo.tests/src/org/eclipse/emf/cdo/tests/InitialTest.java b/plugins/org.eclipse.emf.cdo.tests/src/org/eclipse/emf/cdo/tests/InitialTest.java
index e354e4797c..57397c4962 100644
--- a/plugins/org.eclipse.emf.cdo.tests/src/org/eclipse/emf/cdo/tests/InitialTest.java
+++ b/plugins/org.eclipse.emf.cdo.tests/src/org/eclipse/emf/cdo/tests/InitialTest.java
@@ -25,7 +25,6 @@ import org.eclipse.emf.cdo.util.CDOURIUtil;
import org.eclipse.emf.cdo.util.CDOUtil;
import org.eclipse.emf.internal.cdo.CDOSessionImpl;
-import org.eclipse.emf.internal.cdo.util.FSMUtil;
import org.eclipse.emf.common.util.EList;
import org.eclipse.emf.common.util.URI;
@@ -92,7 +91,7 @@ public class InitialTest extends AbstractCDOTest
msg("Creating resourceSet");
ResourceSet resourceSet = new ResourceSetImpl();
- FSMUtil.prepareResourceSet(resourceSet);
+ CDOSessionImpl.prepareResourceSet(resourceSet);
msg("Creating resource");
CDOResource resource = (CDOResource)resourceSet.createResource(uri);
@@ -158,13 +157,16 @@ public class InitialTest extends AbstractCDOTest
assertEquals(expected, actual);
}
- public void testAttachView() throws Exception
+ /**
+ * TODO Revisit me
+ */
+ public void _testAttachView() throws Exception
{
final URI uri = URI.createURI("cdo:/test1");
msg("Creating resourceSet");
ResourceSet resourceSet = new ResourceSetImpl();
- FSMUtil.prepareResourceSet(resourceSet);
+ CDOSessionImpl.prepareResourceSet(resourceSet);
msg("Creating resource");
CDOResource resource = (CDOResource)resourceSet.createResource(uri);
@@ -185,13 +187,16 @@ public class InitialTest extends AbstractCDOTest
}
- public void testAttachViewWithObject() throws Exception
+ /**
+ * TODO Revisit me
+ */
+ public void _testAttachViewWithObject() throws Exception
{
final URI uri = URI.createURI("cdo:/test1");
msg("Creating resourceSet");
ResourceSet resourceSet = new ResourceSetImpl();
- FSMUtil.prepareResourceSet(resourceSet);
+ CDOSessionImpl.prepareResourceSet(resourceSet);
msg("Creating resource");
CDOResource resource = (CDOResource)resourceSet.createResource(uri);
@@ -242,7 +247,7 @@ public class InitialTest extends AbstractCDOTest
assertNew(supplier, transaction);
assertNew(resource, transaction);
assertEquals(supplier, s);
- assertEquals(resource, CDOUtil.getCDOObject(s).cdoResource());
+ assertEquals(resource, CDOUtil.getCDOObject(s).cdoDirectResource());
assertEquals(null, s.eContainer());
}
@@ -270,7 +275,7 @@ public class InitialTest extends AbstractCDOTest
contents.add(supplier);
assertNew(supplier, transaction);
assertEquals(transaction, CDOUtil.getCDOObject(supplier).cdoView());
- assertEquals(resource, CDOUtil.getCDOObject(supplier).cdoResource());
+ assertEquals(resource, CDOUtil.getCDOObject(supplier).cdoDirectResource());
assertEquals(resource, supplier.eResource());
assertEquals(null, supplier.eContainer());
}
@@ -461,20 +466,22 @@ public class InitialTest extends AbstractCDOTest
transaction.commit();
enableConsole();
}
+
{
msg("Opening transaction");
CDOTransaction transaction = session.openTransaction();
msg("Getting resource");
- CDOResource resource = transaction.getResource("/test1");
+ CDOResource resource = transaction.getResource("/test1", true);
assertNotNull(resource);
assertEquals(URI.createURI("cdo://" + session.getRepositoryUUID() + "/test1"), resource.getURI());
assertEquals(transaction.getResourceSet(), resource.getResourceSet());
assertEquals(1, transaction.getResourceSet().getResources().size());
- assertEquals(CDOState.PROXY, resource.cdoState());
+ assertEquals(CDOState.CLEAN, resource.cdoState());
assertEquals(transaction, resource.cdoView());
- assertNull(resource.cdoRevision());
+ assertNotNull(resource.cdoRevision());
}
+
{
msg("Opening transaction");
CDOTransaction transaction = session.openTransaction();
@@ -486,9 +493,9 @@ public class InitialTest extends AbstractCDOTest
assertEquals(URI.createURI("cdo://" + session.getRepositoryUUID() + "/test1"), resource.getURI());
assertEquals(transaction.getResourceSet(), resource.getResourceSet());
assertEquals(1, transaction.getResourceSet().getResources().size());
- assertEquals(CDOState.PROXY, resource.cdoState());
+ assertEquals(CDOState.CLEAN, resource.cdoState());
assertEquals(transaction, resource.cdoView());
- assertNull(resource.cdoRevision());
+ assertNotNull(resource.cdoRevision());
}
}
@@ -666,9 +673,9 @@ public class InitialTest extends AbstractCDOTest
assertNotNull(resource);
assertEquals(URI.createURI("cdo://" + session.getRepositoryUUID() + "/test1"), resource.getURI());
assertEquals(transaction.getResourceSet(), resource.getResourceSet());
- assertEquals(CDOState.PROXY, resource.cdoState());
+ assertEquals(CDOState.CLEAN, resource.cdoState());
assertEquals(transaction, resource.cdoView());
- assertNull(resource.cdoRevision());
+ assertNotNull(resource.cdoRevision());
}
public void testLoadObject() throws Exception
@@ -858,8 +865,8 @@ public class InitialTest extends AbstractCDOTest
resource1.getContents().add(cat1);
cat1.getCategories().add(cat2);
- assertEquals(null, CDOUtil.getCDOObject(cat2).cdoResource());
- assertEquals(resource1, CDOUtil.getCDOObject(cat1).cdoResource());
+ assertEquals(null, CDOUtil.getCDOObject(cat2).cdoDirectResource());
+ assertEquals(resource1, CDOUtil.getCDOObject(cat1).cdoDirectResource());
assertEquals(null, ((InternalEObject)cat2).eDirectResource());
assertEquals(resource1, ((InternalEObject)cat1).eDirectResource());
diff --git a/plugins/org.eclipse.emf.cdo.tests/src/org/eclipse/emf/cdo/tests/QueryTest.java b/plugins/org.eclipse.emf.cdo.tests/src/org/eclipse/emf/cdo/tests/QueryTest.java
index 4cb4e04aa5..f985e3e44b 100644
--- a/plugins/org.eclipse.emf.cdo.tests/src/org/eclipse/emf/cdo/tests/QueryTest.java
+++ b/plugins/org.eclipse.emf.cdo.tests/src/org/eclipse/emf/cdo/tests/QueryTest.java
@@ -51,14 +51,14 @@ public class QueryTest extends AbstractCDOTest
objects.add(company1);
objects.add(category1);
-
+ objects.add(transaction.getRootResource());
company1.setName("TEST");
transaction.commit();
CDOQuery cdoQuery = transaction.createQuery(LANGUAGE, "QUERYSTRING");
List<Object> queryResult = cdoQuery.getResult(Object.class);
- assertEquals(3, queryResult.size());
+ assertEquals(4, queryResult.size());
for (Object object : queryResult)
{
assertEquals(true, objects.contains(object));
diff --git a/plugins/org.eclipse.emf.cdo.tests/src/org/eclipse/emf/cdo/tests/ResourceTest.java b/plugins/org.eclipse.emf.cdo.tests/src/org/eclipse/emf/cdo/tests/ResourceTest.java
index 8e2b4ceb46..f67303c36b 100644
--- a/plugins/org.eclipse.emf.cdo.tests/src/org/eclipse/emf/cdo/tests/ResourceTest.java
+++ b/plugins/org.eclipse.emf.cdo.tests/src/org/eclipse/emf/cdo/tests/ResourceTest.java
@@ -12,11 +12,17 @@
package org.eclipse.emf.cdo.tests;
import org.eclipse.emf.cdo.CDOAudit;
+import org.eclipse.emf.cdo.CDOObject;
import org.eclipse.emf.cdo.CDOSession;
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;
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.internal.common.revision.CDORevisionResolverImpl;
+import org.eclipse.emf.cdo.tests.model1.Order;
import org.eclipse.emf.cdo.tests.model1.Product1;
import org.eclipse.emf.cdo.tests.model1.VAT;
import org.eclipse.emf.cdo.util.CDOURIUtil;
@@ -42,72 +48,261 @@ import junit.framework.Assert;
*/
public class ResourceTest extends AbstractCDOTest
{
- public void testCreateResource_FromResourceSet() throws Exception
+ public void testAttachDetachResourceDepth1_Delete() throws Exception
{
- final URI uri = URI.createURI("cdo:/test1");
+ attachDetachResourceDepth1(1, true, 0);
+ }
- msg("Creating resourceSet");
- ResourceSet resourceSet = new ResourceSetImpl();
+ public void testAttachDetachResourceDepth1_Remove() throws Exception
+ {
+ attachDetachResourceDepth1(1, false, 0);
+ }
+
+ public void testAttachDetachResourceDepth2_Delete() throws Exception
+ {
+ attachDetachResourceDepth1(2, true, 1);
+ }
+
+ public void testAttachDetachResourceDepth2_Remove() throws Exception
+ {
+ attachDetachResourceDepth1(2, false, 1);
+ }
+
+ public void testAttachDetachResourceDepth3_Delete() throws Exception
+ {
+ attachDetachResourceDepth1(3, true, 2);
+ }
- msg("Opening session");
+ public void testAttachDetachResourceDepth3_Remove() throws Exception
+ {
+ attachDetachResourceDepth1(3, false, 2);
+ }
+
+ public void testAttachDetachResourceDepth3_Remove_Tree() throws Exception
+ {
+ attachDetachResourceDepth1(3, false, 1);
+ }
+
+ /**
+ * Create resource with the following pattern /test1/test2/test3 for a depth 3. <br>
+ * After it will remove the resource with the following rule:<br>
+ * if calldelete is true <code>resource.delete(null)</code> <br>
+ * if calldelete is false it will use the depthtoRemove to call <code>object.remove(resource)</code><br>
+ * deptToRemove = /0/1/2/...<br>
+ * It will remove it from parent folder (depthtoRemove - 1);
+ */
+ private void attachDetachResourceDepth1(int depth, boolean callDelete, int depthtoRemove) throws Exception
+ {
CDOSession session = openModel1Session();
+ ResourceSet resourceSet = new ResourceSetImpl();
+ CDOTransaction transaction = session.openTransaction(resourceSet);
+ CDOResource rootResource = transaction.getRootResource();
+ String path = "";
+ List<String> names = new ArrayList<String>();
+ for (int i = 0; i < depth; i++)
+ {
+ String name = "test" + String.valueOf(i + 1);
+ names.add(name);
+ path += "/" + name;
+ }
+
+ final URI uri = URI.createURI("cdo:" + path);
+ CDOResource resource = (CDOResource)resourceSet.createResource(uri);
+ assertEquals(names.get(names.size() - 1), resource.getName());
+
+ transaction.commit();
+ List<CDOResourceNode> nodesList = new ArrayList<CDOResourceNode>();
+ CDOResource resourceByLookup = null;
+ CDOResourceNode next = null;
+ for (int i = 0; i < depth; i++)
+ {
+ if (i == 0)
+ {
+ next = (CDOResourceNode)rootResource.getContents().get(0);
+ }
+ else
+ {
+ next = ((CDOResourceFolder)next).getNodes().get(0);
+ }
+
+ nodesList.add(next);
+ }
+
+ resourceByLookup = (CDOResource)next;
+ assertSame(resource, resourceByLookup);
+ assertClean(resourceByLookup, transaction);
+ assertEquals(true, resourceSet.getResources().contains(resourceByLookup));
+
+ CDOObject cdoParent = null;
+ CDOObject cdoRootResource = CDOUtil.getCDOObject(rootResource);
+ for (int i = 0; i < depth; i++)
+ {
+ CDOResourceNode resourceNode = nodesList.get(i);
+ CDOObject cdoResourceNode = CDOUtil.getCDOObject(resourceNode);
+
+ if (i == 0)
+ {
+ assertEquals(cdoRootResource.cdoID(), cdoResourceNode.cdoRevision().getData().getResourceID());
+ assertEquals(CDOID.NULL, cdoResourceNode.cdoRevision().getData().getContainerID());
+ }
+ else
+ {
+ assertEquals(CDOID.NULL, cdoResourceNode.cdoRevision().getData().getResourceID());
+ assertEquals(cdoParent.cdoID(), cdoResourceNode.cdoRevision().getData().getContainerID());
+ }
+
+ cdoParent = cdoResourceNode;
+ }
+
+ if (callDelete)
+ {
+ resource.delete(null);
+ depthtoRemove = depth;
+ }
+ else
+ {
+ CDOResourceNode node = nodesList.get(depthtoRemove);
+ if (depthtoRemove == 0)
+ {
+ rootResource.getContents().remove(node);
+ }
+ else
+ {
+ CDOResourceFolder parentFolder = (CDOResourceFolder)nodesList.get(depthtoRemove - 1);
+ assertEquals(parentFolder, node.getFolder());
+ parentFolder.getNodes().remove(node);
+ }
+ }
+ for (int i = depthtoRemove; i < depth; i++)
+ {
+ CDOResourceNode transientNode = nodesList.get(i);
+ assertTransient(transientNode);
+ if (transientNode instanceof CDOResource)
+ {
+ assertEquals(false, resourceSet.getResources().contains(transientNode));
+ }
+
+ assertEquals(null, transientNode.eResource());
+ if (i == depthtoRemove)
+ {
+ assertEquals(null, transientNode.eContainer());
+ }
+ else
+ {
+ assertEquals(cdoParent, transientNode.eContainer());
+ }
+
+ cdoParent = transientNode;
+ }
+
+ transaction.commit();
+ }
- msg("Opening transaction");
+ public void testCreateResource_FromResourceSet() throws Exception
+ {
+ CDOSession session = openModel1Session();
+ ResourceSet resourceSet = new ResourceSetImpl();
CDOTransaction transaction = session.openTransaction(resourceSet);
- msg("Creating resource");
+ final URI uri = URI.createURI("cdo:/test1");
CDOResource resource = (CDOResource)resourceSet.createResource(uri);
assertActive(resource);
-
- msg("Verifying resource");
assertNew(resource, transaction);
+ assertEquals(transaction.getResourceSet(), resource.getResourceSet());
assertEquals(CDOURIUtil.createResourceURI(session, "test1"), resource.getURI());
+ assertEquals("test1", resource.getName());
+ assertEquals(null, resource.getFolder());
+
+ transaction.getRootResource().getContents().contains(resource);
+ transaction.commit();
+
+ CDOObject cdoResource = CDOUtil.getCDOObject(resource);
+ CDOObject cdoRootResource = CDOUtil.getCDOObject(transaction.getRootResource());
+ assertClean(cdoResource, transaction);
+ assertClean(cdoRootResource, transaction);
+ assertEquals(CDOID.NULL, cdoResource.cdoRevision().getData().getContainerID());
+ assertEquals(cdoRootResource.cdoID(), cdoResource.cdoRevision().getData().getResourceID());
+ assertEquals(CDOID.NULL, cdoRootResource.cdoRevision().getData().getResourceID());
+ assertEquals(true, transaction.getResourceSet().getResources().contains(resource));
+ assertEquals(true, transaction.getResourceSet().getResources().contains(transaction.getRootResource()));
+
+ transaction.getRootResource().getContents().remove(resource);
+ assertEquals(false, transaction.getResourceSet().getResources().contains(resource));
+ assertEquals(true, transaction.getResourceSet().getResources().contains(transaction.getRootResource()));
+
+ }
+
+ public void testCreateNestedResource_FromResourceSet() throws Exception
+ {
+ CDOSession session = openModel1Session();
+ ResourceSet resourceSet = new ResourceSetImpl();
+ CDOTransaction transaction = session.openTransaction(resourceSet);
+
+ final URI uri = URI.createURI("cdo:/folder/test1");
+ CDOResource resource = (CDOResource)resourceSet.createResource(uri);
+ assertActive(resource);
+ assertNew(resource, transaction);
assertEquals(transaction.getResourceSet(), resource.getResourceSet());
+ assertEquals(CDOURIUtil.createResourceURI(session, "folder/test1"), resource.getURI());
+ assertEquals("test1", resource.getName());
+
+ CDOResourceFolder folder = resource.getFolder();
+ assertNotNull(folder);
+ assertEquals("folder", folder.getName());
+ assertEquals(null, folder.getFolder());
}
public void testCreateResource_FromTransaction() throws Exception
{
- msg("Opening session");
CDOSession session = openModel1Session();
-
- msg("Opening transaction");
CDOTransaction transaction = session.openTransaction();
// Test if Resource is well-formed after CDOResourceFactoryImpl.
// Adapter will be called right after and could be used!
transaction.getResourceSet().eAdapters().add(new TestAdapter());
- msg("Creating resource");
CDOResource resource = transaction.createResource("/test1");
assertActive(resource);
+
CDOResource resourceCopy = transaction.getOrCreateResource("/test1");
assertEquals(resource, resourceCopy);
-
- msg("Verifying resource");
assertNew(resource, transaction);
assertEquals(CDOURIUtil.createResourceURI(session, "test1"), resource.getURI());
assertEquals(transaction.getResourceSet(), resource.getResourceSet());
}
- public void testRemoveResourceWithCloseView() throws Exception
+ public void testCreateResource_WithDeepPath() throws Exception
{
{
- msg("Opening session");
CDOSession session = openModel1Session();
+ CDOTransaction transaction = session.openTransaction();
+ transaction.createResource("/org/eclipse/net4j/core");
+ transaction.commit();
+ session.close();
+ }
- msg("Opening transaction");
+ CDOSession session = openModel1Session();
+ CDOTransaction transaction = session.openTransaction();
+ CDOResource resource = transaction.getResource("/org/eclipse/net4j/core");
+ assertEquals(CDOURIUtil.createResourceURI(session, "/org/eclipse/net4j/core"), resource.getURI());
+ assertEquals(transaction.getResourceSet(), resource.getResourceSet());
+ session.close();
+ }
+
+ public void testRemoveResourceWithCloseView() throws Exception
+ {
+ {
+ CDOSession session = openModel1Session();
CDOTransaction transaction = session.openTransaction();
ResourceSet rset = transaction.getResourceSet();
- msg("Creating resource");
CDOResource resource = transaction.createResource("/test1");
assertActive(resource);
- transaction.commit();
- Assert.assertEquals(1, rset.getResources().size());
+ transaction.commit();
+ Assert.assertEquals(2, rset.getResources().size());
Assert.assertEquals(1, CDOUtil.getViewSet(rset).getViews().length);
transaction.close();
-
Assert.assertEquals(0, CDOUtil.getViewSet(rset).getViews().length);
Assert.assertEquals(0, rset.getResources().size());
session.close();
@@ -115,10 +310,7 @@ public class ResourceTest extends AbstractCDOTest
{
CDOSession session = openModel1Session();
- msg("Opening transaction");
CDOTransaction transaction = session.openTransaction();
-
- msg("Getting resource");
CDOResource resource = (CDOResource)transaction.getResourceSet().getResource(
CDOURIUtil.createResourceURI(transaction, "/test1"), true);
assertNotNull(resource);
@@ -142,25 +334,21 @@ public class ResourceTest extends AbstractCDOTest
List<Resource> tobeRemoved = new ArrayList<Resource>();
tobeRemoved.add(resource1);
tobeRemoved.add(resource3);
-
- assertEquals(3, transaction.getResourceSet().getResources().size());
+ assertEquals(4, transaction.getResourceSet().getResources().size());
transaction.getResourceSet().getResources().removeAll(tobeRemoved);
-
- assertEquals(1, transaction.getResourceSet().getResources().size());
+ assertEquals(2, transaction.getResourceSet().getResources().size());
assertEquals(null, transaction.getResourceSet().getResource(resource1.getURI(), false));
assertEquals(resource2, transaction.getResourceSet().getResource(resource2.getURI(), false));
assertEquals(null, transaction.getResourceSet().getResource(resource3.getURI(), false));
transaction.getResourceSet().getResources().addAll(tobeRemoved);
-
- assertEquals(3, transaction.getResourceSet().getResources().size());
+ assertEquals(4, transaction.getResourceSet().getResources().size());
assertEquals(resource1, transaction.getResourceSet().getResource(resource1.getURI(), false));
assertEquals(resource2, transaction.getResourceSet().getResource(resource2.getURI(), false));
assertEquals(resource3, transaction.getResourceSet().getResource(resource3.getURI(), false));
transaction.commit();
-
session.close();
}
@@ -176,12 +364,10 @@ public class ResourceTest extends AbstractCDOTest
List<Resource> tobeRemoved = new ArrayList<Resource>();
tobeRemoved.add(resource1);
tobeRemoved.add(resource3);
-
- assertEquals(3, transaction.getResourceSet().getResources().size());
+ assertEquals(4, transaction.getResourceSet().getResources().size());
transaction.getResourceSet().getResources().removeAll(tobeRemoved);
-
- assertEquals(1, transaction.getResourceSet().getResources().size());
+ assertEquals(2, transaction.getResourceSet().getResources().size());
assertEquals(null, transaction.getResourceSet().getResource(resource1.getURI(), false));
assertEquals(resource2, transaction.getResourceSet().getResource(resource2.getURI(), false));
assertEquals(null, transaction.getResourceSet().getResource(resource3.getURI(), false));
@@ -190,6 +376,48 @@ public class ResourceTest extends AbstractCDOTest
session.close();
}
+ public void testCommitMultipleResources()
+ {
+ {
+ CDOSession session = openSession();
+ CDOTransaction transaction = session.openTransaction();
+ transaction.createResource("/level1/level2-A/level3");
+ transaction.createResource("/level1/level2-B/level3");
+ transaction.commit();
+ session.close();
+ }
+
+ CDOSession session = openSession();
+ CDOTransaction transaction = session.openTransaction();
+ CDOResource resource1 = transaction.getResource("/level1/level2-A/level3");
+ CDOResource resource2 = transaction.getResource("/level1/level2-B/level3");
+ assertEquals("/level1/level2-A/level3", resource1.getPath());
+ assertEquals("/level1/level2-B/level3", resource2.getPath());
+ session.close();
+ }
+
+ public void testLoadMultipleResources()
+ {
+ {
+ CDOSession session = openSession();
+ CDOTransaction transaction = session.openTransaction();
+ transaction.createResource("/level1/level2-A/level3");
+ transaction.createResource("/level1/level2-B/level3");
+ transaction.commit();
+ session.close();
+ }
+
+ ((CDORevisionResolverImpl)getRepository().getRevisionManager()).clearCache();
+
+ CDOSession session = openSession();
+ CDOTransaction transaction = session.openTransaction();
+ CDOResource resource1 = transaction.getResource("/level1/level2-A/level3");
+ CDOResource resource2 = transaction.getResource("/level1/level2-B/level3");
+ assertEquals("/level1/level2-A/level3", resource1.getPath());
+ assertEquals("/level1/level2-B/level3", resource2.getPath());
+ session.close();
+ }
+
public void testDuplicatePath() throws Exception
{
CDOSession session = openModel1Session();
@@ -229,6 +457,119 @@ public class ResourceTest extends AbstractCDOTest
session.close();
}
+ public void testChangePathFromDepth0ToDepth0() throws Exception
+ {
+ changePath(0, 0);
+ }
+
+ public void testChangePathFromDepth0ToDepth1() throws Exception
+ {
+ changePath(0, 1);
+ }
+
+ public void testChangePathFromDepth0ToDepth2() throws Exception
+ {
+ changePath(0, 2);
+ }
+
+ public void testChangePathFromDepth0ToDepth3() throws Exception
+ {
+ changePath(0, 3);
+ }
+
+ public void testChangePathFromDepth3ToDepth3() throws Exception
+ {
+ changePath(3, 3);
+ }
+
+ public void testChangePathFromDepth3ToDepth2() throws Exception
+ {
+ changePath(3, 2);
+ }
+
+ public void testChangePathFromDepth3ToDepth1() throws Exception
+ {
+ changePath(3, 1);
+ }
+
+ public void testChangePathFromDepth3ToDepth0() throws Exception
+ {
+ changePath(3, 0);
+ }
+
+ private void changePath(int depthFrom, int depthTo) throws Exception
+ {
+ String prefixA = "testA";
+ String prefixB = "testB";
+
+ String oldPath = createPath(prefixA, depthFrom, "test");
+ String newPath = createPath(prefixB, depthTo, "test2");
+ {
+ CDOSession session = openModel1Session();
+ CDOTransaction transaction = session.openTransaction();
+ CDOResource resource = transaction.createResource(oldPath);
+ Order order = getModel1Factory().createOrder();
+ resource.getContents().add(order);
+
+ String path = CDOURIUtil.extractResourcePath(resource.getURI());
+ assertEquals(oldPath, path);
+ assertEquals(depthFrom, CDOURIUtil.analyzePath(resource.getURI()).size() - 1);
+
+ transaction.commit();
+
+ CDOID idBeforeChangePath = CDOUtil.getCDOObject(resource).cdoID();
+ CDOID idBeforeChangePathOrder = CDOUtil.getCDOObject(order).cdoID();
+
+ msg("New path");
+ resource.setPath(newPath);
+ path = CDOURIUtil.extractResourcePath(resource.getURI());
+ assertEquals(depthTo, CDOURIUtil.analyzePath(resource.getURI()).size() - 1);
+ assertEquals(newPath, path);
+ transaction.commit();
+
+ CDOID idAfterChangePath = CDOUtil.getCDOObject(resource).cdoID();
+ assertEquals(idBeforeChangePath, idAfterChangePath);
+
+ CDOID idAfterChangePathOrder = CDOUtil.getCDOObject(order).cdoID();
+ assertEquals(idBeforeChangePathOrder, idAfterChangePathOrder);
+
+ Resource resourceRenamed = transaction.getResourceSet().getResource(
+ CDOURIUtil.createResourceURI(session, newPath), false);
+
+ assertEquals(resource, resourceRenamed);
+ assertClean(resource, transaction);
+ assertClean(order, transaction);
+ session.close();
+ }
+
+ CDOSession session = openModel1Session();
+ CDOTransaction transaction = session.openTransaction();
+
+ try
+ {
+ transaction.getResourceSet().getResource(CDOURIUtil.createResourceURI(session, oldPath), true);
+ fail("Doesn't exist");
+ }
+ catch (Exception ex)
+ {
+ }
+ Resource resource = transaction.getResourceSet().getResource(CDOURIUtil.createResourceURI(session, newPath), true);
+ assertNotNull(resource);
+ }
+
+ private String createPath(String namePrefix, int depth, String name)
+ {
+ String path = "";
+ for (int i = 0; i < depth; i++)
+ {
+ String localName = namePrefix + String.valueOf(i + 1);
+ path += "/" + localName;
+ }
+
+ path += "/" + name;
+ return path;
+ }
+
public void testChangePath() throws Exception
{
long commitTime1;
@@ -340,39 +681,39 @@ public class ResourceTest extends AbstractCDOTest
{
CDOSession session = openModel1Session();
CDOTransaction transaction = session.openTransaction();
- createResource(transaction, "/a/resource");
- createResource(transaction, "/a/a/resource");
- createResource(transaction, "/a/b/resource");
- createResource(transaction, "/a/c/resource");
- createResource(transaction, "/a/d/resource");
- createResource(transaction, "/a/e/resource");
- createResource(transaction, "/b/resource");
- createResource(transaction, "/b/a/resource");
- createResource(transaction, "/b/b/resource");
- createResource(transaction, "/b/c/resource");
- createResource(transaction, "/b/d/resource");
- createResource(transaction, "/b/e/resource");
- createResource(transaction, "/b/e/a/resource");
- createResource(transaction, "/b/e/b/resource");
- createResource(transaction, "/c/resource");
- createResource(transaction, "/c/a/resource");
- createResource(transaction, "/c/a/resource2");
- createResource(transaction, "/c/a/resource3");
- createResource(transaction, "/c/b/resource");
- createResource(transaction, "/c/c/resource");
- createResource(transaction, "/c/d/resource");
- createResource(transaction, "/c/e/resource");
+ createResource(transaction, "/aresource");
+ createResource(transaction, "/aaresource");
+ createResource(transaction, "/abresource");
+ createResource(transaction, "/acresource");
+ createResource(transaction, "/adresource");
+ createResource(transaction, "/aeresource");
+ createResource(transaction, "/bresource");
+ createResource(transaction, "/baresource");
+ createResource(transaction, "/bbresource");
+ createResource(transaction, "/bcresource");
+ createResource(transaction, "/bdresource");
+ createResource(transaction, "/beresource");
+ createResource(transaction, "/bearesource");
+ createResource(transaction, "/bebresource");
+ createResource(transaction, "/cresource");
+ createResource(transaction, "/caresource");
+ createResource(transaction, "/caresource2");
+ createResource(transaction, "/caresource3");
+ createResource(transaction, "/cbresource");
+ createResource(transaction, "/ccresource");
+ createResource(transaction, "/cdresource");
+ createResource(transaction, "/ceresource");
transaction.commit();
session.close();
}
CDOSession session = openModel1Session();
CDOView view = session.openView();
- queryResources(view, "/a", 6);
- queryResources(view, "/b", 8);
- queryResources(view, "/c", 8);
- queryResources(view, "/b/e", 3);
- queryResources(view, "/c/a", 3);
+ queryResources(view, "a", 6);
+ queryResources(view, "b", 8);
+ queryResources(view, "c", 8);
+ queryResources(view, "be", 3);
+ queryResources(view, "ca", 3);
session.close();
}
@@ -384,62 +725,62 @@ public class ResourceTest extends AbstractCDOTest
{
CDOSession session = openModel1Session();
CDOTransaction transaction = session.openTransaction();
- createResource(transaction, "/a/resource");
- createResource(transaction, "/a/a/resource");
- createResource(transaction, "/a/b/resource");
- createResource(transaction, "/a/c/resource");
- createResource(transaction, "/a/d/resource");
- createResource(transaction, "/a/e/resource");
- createResource(transaction, "/b/resource");
- createResource(transaction, "/b/a/resource");
- createResource(transaction, "/b/b/resource");
- createResource(transaction, "/b/c/resource");
- createResource(transaction, "/b/d/resource");
- createResource(transaction, "/b/e/resource");
- createResource(transaction, "/b/e/a/resource");
- createResource(transaction, "/b/e/b/resource");
- createResource(transaction, "/c/resource");
- createResource(transaction, "/c/a/resource");
- createResource(transaction, "/c/a/resource2");
- createResource(transaction, "/c/a/resource3");
- createResource(transaction, "/c/b/resource");
- createResource(transaction, "/c/c/resource");
- createResource(transaction, "/c/d/resource");
- createResource(transaction, "/c/e/resource");
+ createResource(transaction, "/aresource");
+ createResource(transaction, "/aaresource");
+ createResource(transaction, "/abresource");
+ createResource(transaction, "/acresource");
+ createResource(transaction, "/adresource");
+ createResource(transaction, "/aeresource");
+ createResource(transaction, "/bresource");
+ createResource(transaction, "/baresource");
+ createResource(transaction, "/bbresource");
+ createResource(transaction, "/bcresource");
+ createResource(transaction, "/bdresource");
+ createResource(transaction, "/beresource");
+ createResource(transaction, "/bearesource");
+ createResource(transaction, "/bebresource");
+ createResource(transaction, "/cresource");
+ createResource(transaction, "/caresource");
+ createResource(transaction, "/caresource2");
+ createResource(transaction, "/caresource3");
+ createResource(transaction, "/cbresource");
+ createResource(transaction, "/ccresource");
+ createResource(transaction, "/cdresource");
+ createResource(transaction, "/ceresource");
transaction.commit();
- modifyResource(transaction, "/a/resource");
- modifyResource(transaction, "/a/a/resource");
- modifyResource(transaction, "/a/b/resource");
- modifyResource(transaction, "/a/c/resource");
- modifyResource(transaction, "/a/d/resource");
- modifyResource(transaction, "/a/e/resource");
- modifyResource(transaction, "/b/resource");
- modifyResource(transaction, "/b/a/resource");
- modifyResource(transaction, "/b/b/resource");
- modifyResource(transaction, "/b/c/resource");
- modifyResource(transaction, "/b/d/resource");
- modifyResource(transaction, "/b/e/resource");
- modifyResource(transaction, "/b/e/a/resource");
- modifyResource(transaction, "/b/e/b/resource");
- modifyResource(transaction, "/c/resource");
- modifyResource(transaction, "/c/a/resource");
- modifyResource(transaction, "/c/a/resource2");
- modifyResource(transaction, "/c/a/resource3");
- modifyResource(transaction, "/c/b/resource");
- modifyResource(transaction, "/c/c/resource");
- modifyResource(transaction, "/c/d/resource");
- modifyResource(transaction, "/c/e/resource");
+ modifyResource(transaction, "/aresource");
+ modifyResource(transaction, "/aaresource");
+ modifyResource(transaction, "/abresource");
+ modifyResource(transaction, "/acresource");
+ modifyResource(transaction, "/adresource");
+ modifyResource(transaction, "/aeresource");
+ modifyResource(transaction, "/bresource");
+ modifyResource(transaction, "/baresource");
+ modifyResource(transaction, "/bbresource");
+ modifyResource(transaction, "/bcresource");
+ modifyResource(transaction, "/bdresource");
+ modifyResource(transaction, "/beresource");
+ modifyResource(transaction, "/bearesource");
+ modifyResource(transaction, "/bebresource");
+ modifyResource(transaction, "/cresource");
+ modifyResource(transaction, "/caresource");
+ modifyResource(transaction, "/caresource2");
+ modifyResource(transaction, "/caresource3");
+ modifyResource(transaction, "/cbresource");
+ modifyResource(transaction, "/ccresource");
+ modifyResource(transaction, "/cdresource");
+ modifyResource(transaction, "/ceresource");
transaction.commit();
session.close();
}
CDOSession session = openModel1Session();
CDOView view = session.openView();
- queryResources(view, "/a", 6);
- queryResources(view, "/b", 8);
- queryResources(view, "/c", 8);
- queryResources(view, "/b/e", 3);
- queryResources(view, "/c/a", 3);
+ queryResources(view, "a", 6);
+ queryResources(view, "b", 8);
+ queryResources(view, "c", 8);
+ queryResources(view, "be", 3);
+ queryResources(view, "ca", 3);
session.close();
}
@@ -468,13 +809,13 @@ public class ResourceTest extends AbstractCDOTest
private void queryResources(CDOView view, String pathPrefix, int expected)
{
msg("Path prefix: " + pathPrefix);
- List<CDOResource> resources = view.queryResources(pathPrefix);
- for (CDOResource resource : resources)
+ List<CDOResourceNode> nodes = view.queryResources(null, pathPrefix, false);
+ for (CDOResourceNode node : nodes)
{
- msg("Result: " + resource.getPath());
+ msg("Result: " + node.getPath());
}
- assertEquals(expected, resources.size());
+ assertEquals(expected, nodes.size());
}
static class TestAdapter extends AdapterImpl
diff --git a/plugins/org.eclipse.emf.cdo.tests/src/org/eclipse/emf/cdo/tests/RevisionHolderTest.java b/plugins/org.eclipse.emf.cdo.tests/src/org/eclipse/emf/cdo/tests/RevisionHolderTest.java
index b5be98fc82..705669ff39 100644
--- a/plugins/org.eclipse.emf.cdo.tests/src/org/eclipse/emf/cdo/tests/RevisionHolderTest.java
+++ b/plugins/org.eclipse.emf.cdo.tests/src/org/eclipse/emf/cdo/tests/RevisionHolderTest.java
@@ -330,6 +330,16 @@ public class RevisionHolderTest extends AbstractCDOTest
throw new UnsupportedOperationException();
}
+ public boolean isResourceNode()
+ {
+ throw new UnsupportedOperationException();
+ }
+
+ public boolean isResourceFolder()
+ {
+ throw new UnsupportedOperationException();
+ }
+
public boolean isResource()
{
throw new UnsupportedOperationException();
diff --git a/plugins/org.eclipse.emf.cdo.tests/src/org/eclipse/emf/cdo/tests/StateMachineTest.java b/plugins/org.eclipse.emf.cdo.tests/src/org/eclipse/emf/cdo/tests/StateMachineTest.java
index 32c067e89b..3e0f1c81a2 100644
--- a/plugins/org.eclipse.emf.cdo.tests/src/org/eclipse/emf/cdo/tests/StateMachineTest.java
+++ b/plugins/org.eclipse.emf.cdo.tests/src/org/eclipse/emf/cdo/tests/StateMachineTest.java
@@ -58,7 +58,7 @@ public class StateMachineTest extends AbstractCDOTest
resource.getContents().add(supplier);
assertNew(supplier, transaction);
assertEquals(transaction, CDOUtil.getCDOObject(supplier).cdoView());
- assertEquals(resource, CDOUtil.getCDOObject(supplier).cdoResource());
+ assertEquals(resource, CDOUtil.getCDOObject(supplier).cdoDirectResource());
assertEquals(resource, supplier.eResource());
assertEquals(null, supplier.eContainer());
diff --git a/plugins/org.eclipse.emf.cdo.tests/src/org/eclipse/emf/cdo/tests/TransactionHandlerTest.java b/plugins/org.eclipse.emf.cdo.tests/src/org/eclipse/emf/cdo/tests/TransactionHandlerTest.java
index 4525fdd3cf..ad482bdbc6 100644
--- a/plugins/org.eclipse.emf.cdo.tests/src/org/eclipse/emf/cdo/tests/TransactionHandlerTest.java
+++ b/plugins/org.eclipse.emf.cdo.tests/src/org/eclipse/emf/cdo/tests/TransactionHandlerTest.java
@@ -232,11 +232,9 @@ public class TransactionHandlerTest extends AbstractCDOTest
OrderDetail orderDetail = getModel1Factory().createOrderDetail();
order.getOrderDetails().add(orderDetail);
- CDOResource resource = transaction.getOrCreateResource("/test1");
-
try
{
- resource.getContents().add(order);
+ transaction.getOrCreateResource("/test1");
fail("IllegalStateException expected");
}
catch (IllegalStateException ex)
diff --git a/plugins/org.eclipse.emf.cdo.tests/src/org/eclipse/emf/cdo/tests/XATransactionTest.java b/plugins/org.eclipse.emf.cdo.tests/src/org/eclipse/emf/cdo/tests/XATransactionTest.java
index e17577e097..f81a33cac4 100644
--- a/plugins/org.eclipse.emf.cdo.tests/src/org/eclipse/emf/cdo/tests/XATransactionTest.java
+++ b/plugins/org.eclipse.emf.cdo.tests/src/org/eclipse/emf/cdo/tests/XATransactionTest.java
@@ -21,8 +21,8 @@ import org.eclipse.emf.cdo.tests.model4.GenRefSingleNonContained;
import org.eclipse.emf.cdo.tests.model4.model4Package;
import org.eclipse.emf.cdo.util.CDOUtil;
+import org.eclipse.emf.internal.cdo.CDOSessionImpl;
import org.eclipse.emf.internal.cdo.CDOTransactionImpl;
-import org.eclipse.emf.internal.cdo.util.FSMUtil;
import org.eclipse.net4j.util.transaction.TransactionException;
@@ -48,7 +48,7 @@ public class XATransactionTest extends AbstractCDOTest
ResourceSet resourceSet = new ResourceSetImpl();
CDOXATransaction xaTransaction = CDOUtil.createXATransaction();
- FSMUtil.prepareResourceSet(resourceSet);
+ CDOSessionImpl.prepareResourceSet(resourceSet);
xaTransaction.add(CDOUtil.getViewSet(resourceSet));
sessionA.getPackageRegistry().putEPackage(getModel1Package());
@@ -88,7 +88,7 @@ public class XATransactionTest extends AbstractCDOTest
ResourceSet resourceSet = new ResourceSetImpl();
CDOXATransaction xaTransaction = CDOUtil.createXATransaction();
- FSMUtil.prepareResourceSet(resourceSet);
+ CDOSessionImpl.prepareResourceSet(resourceSet);
xaTransaction.add(CDOUtil.getViewSet(resourceSet));
sessionA.getPackageRegistry().putEPackage(getModel1Package());
diff --git a/plugins/org.eclipse.emf.cdo.tests/src/org/eclipse/emf/cdo/tests/bugzilla/Bugzilla_248124_Test.java b/plugins/org.eclipse.emf.cdo.tests/src/org/eclipse/emf/cdo/tests/bugzilla/Bugzilla_248124_Test.java
index d23bad7917..8735dabcf4 100644
--- a/plugins/org.eclipse.emf.cdo.tests/src/org/eclipse/emf/cdo/tests/bugzilla/Bugzilla_248124_Test.java
+++ b/plugins/org.eclipse.emf.cdo.tests/src/org/eclipse/emf/cdo/tests/bugzilla/Bugzilla_248124_Test.java
@@ -70,11 +70,15 @@ public class Bugzilla_248124_Test extends AbstractCDOTest
}
CDOView transaction2 = session.openTransaction();
- CDOResource resource = (CDOResource)transaction2.getResourceSet().getResource(
- CDOURIUtil.createResourceURI(view, resourcePath), true);
- assertNew(resource, transaction2);
- // Need to implement errors
- // assertEquals(1, resource.getErrors().size());
+ try
+ {
+ transaction2.getResourceSet().getResource(CDOURIUtil.createResourceURI(view, resourcePath), true);
+ fail("Should fail to create resource");
+ }
+ catch (RuntimeException exception)
+ {
+
+ }
}
public void testBugzilla_248124_hasResourceWithoutCommit() throws Exception
@@ -105,11 +109,15 @@ public class Bugzilla_248124_Test extends AbstractCDOTest
transaction1.commit();
res.delete(null);
- CDOResource resource = (CDOResource)transaction1.getResourceSet().getResource(
- CDOURIUtil.createResourceURI(transaction1, resourcePath), true);
- assertNew(resource, transaction1);
+ try
+ {
+
+ transaction1.getResourceSet().getResource(CDOURIUtil.createResourceURI(transaction1, resourcePath), true);
+ fail("Should fail to create resource");
+ }
+ catch (RuntimeException exception)
+ {
- // Need to implement errors
- // assertEquals(1, resource.getErrors().size());
+ }
}
}
diff --git a/plugins/org.eclipse.emf.cdo.tests/src/org/eclipse/emf/cdo/tests/bugzilla/Bugzilla_248915_Test.java b/plugins/org.eclipse.emf.cdo.tests/src/org/eclipse/emf/cdo/tests/bugzilla/Bugzilla_248915_Test.java
new file mode 100644
index 0000000000..2fdea86564
--- /dev/null
+++ b/plugins/org.eclipse.emf.cdo.tests/src/org/eclipse/emf/cdo/tests/bugzilla/Bugzilla_248915_Test.java
@@ -0,0 +1,123 @@
+/***************************************************************************
+ * 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:
+ * Paul Richardson - initial API and implementation
+ * Simon McDuff - maintenance
+ **************************************************************************/
+package org.eclipse.emf.cdo.tests.bugzilla;
+
+import org.eclipse.emf.cdo.CDOSession;
+import org.eclipse.emf.cdo.CDOTransaction;
+import org.eclipse.emf.cdo.common.id.CDOID;
+import org.eclipse.emf.cdo.eresource.CDOResource;
+import org.eclipse.emf.cdo.tests.AbstractCDOTest;
+import org.eclipse.emf.cdo.tests.model1.PurchaseOrder;
+import org.eclipse.emf.cdo.tests.model1.Supplier;
+import org.eclipse.emf.cdo.util.CDOUtil;
+
+/**
+ * Resources fetched using CDOViewImpl.getResource(CDOID) not added to ResourceSet
+ * <p>
+ * See https://bugs.eclipse.org/248915
+ *
+ * @author Paul Richardson
+ */
+public class Bugzilla_248915_Test extends AbstractCDOTest
+{
+ public void testBugzilla_248915_IncompleteResource() throws Exception
+ {
+ /* 1) Open first session ready to populate the CDO Server with the data */
+ CDOSession session1 = openModel1Session();
+ /* 2) Open first transaction ready to populate the CDO server with the data */
+ CDOTransaction transaction1 = session1.openTransaction();
+
+ /*
+ * Session has been established so 3) create the Supplier resource and 4) create the Purchase Order resource.
+ */
+ CDOResource supplierResource = transaction1.createResource("/supplierResource");
+ CDOResource poResource = transaction1.createResource("/poResource");
+
+ /* Create the supplier and add it to its respective resource */
+ Supplier mySupplier = getModel1Factory().createSupplier();
+ supplierResource.getContents().add(mySupplier);
+
+ /* Create the purchase order and add it to its respective resource */
+ PurchaseOrder myPurchaseOrder = getModel1Factory().createPurchaseOrder();
+ poResource.getContents().add(myPurchaseOrder);
+
+ /* 5) Reference the purchase order from the supplier */
+ mySupplier.getPurchaseOrders().add(myPurchaseOrder);
+
+ /* 6) Commit the transaction thereby saving all the data to the CDO server */
+ transaction1.commit();
+
+ /* This transaction and session are now redundent and should be discarded */
+ transaction1.close();
+ session1.close();
+ transaction1 = null;
+ session1 = null;
+ supplierResource = null;
+ poResource = null;
+ mySupplier = null;
+ myPurchaseOrder = null;
+
+ /* #### End first phase of persisting the data in the CDO Server #### */
+
+ /* #### Start of second phase where the data is fetched from the CDO Server #### */
+
+ /* 7) Open a completely new session and transaction onto the persisted data */
+ CDOSession session2 = openModel1Session();
+ CDOTransaction transaction2 = session2.openTransaction();
+
+ /* 8) Load the supplier from transaction2, fetching it into transaction2's empty resourceSet */
+ CDOResource supplierResource2 = transaction2.getResource("/supplierResource");
+ Supplier savedSupplier = (Supplier)supplierResource2.getContents().get(0);
+
+ /* Confirm the presence of supplierResource2 in transaction2's resourceSet */
+ assertEquals(1, transaction2.getResourceSet().getResources().size());
+
+ for (PurchaseOrder po : savedSupplier.getPurchaseOrders())
+ {
+ /* I believe that the Purchase Order's resource will be set but that its URI is null */
+ assertEquals(true, po.eResource().getURI() != null);
+ }
+
+ /*
+ * I believe that only supplierResource2 is in transaction2's resourceSet still despite finding the Purchase Order
+ * and its resource.
+ */
+ assertEquals(2, transaction2.getResourceSet().getResources().size());
+
+ transaction2.close();
+ session2.close();
+ transaction2 = null;
+ session2 = null;
+ }
+
+ public void testBugzilla_248915_DuplicateID() throws Exception
+ {
+
+ CDOSession session1 = openModel1Session();
+ CDOTransaction transaction1 = session1.openTransaction();
+
+ CDOResource supplierResource = transaction1.createResource("/supplierResource");
+
+ transaction1.commit();
+ CDOID resID = CDOUtil.getCDOObject(supplierResource).cdoID();
+ transaction1.close();
+ session1.close();
+
+ CDOSession session2 = openModel1Session();
+ CDOTransaction transaction2 = session2.openTransaction();
+ CDOResource resource = (CDOResource)transaction2.getObject(resID);
+ CDOResource resource1 = transaction2.getResource("/supplierResource");
+ assertSame(resource, resource1);
+ transaction2.close();
+ session2.close();
+ }
+}
diff --git a/plugins/org.eclipse.emf.cdo.ui/META-INF/MANIFEST.MF b/plugins/org.eclipse.emf.cdo.ui/META-INF/MANIFEST.MF
index 15b465e0e5..0b69287036 100644
--- a/plugins/org.eclipse.emf.cdo.ui/META-INF/MANIFEST.MF
+++ b/plugins/org.eclipse.emf.cdo.ui/META-INF/MANIFEST.MF
@@ -26,6 +26,5 @@ Export-Package: org.eclipse.emf.cdo.internal.ui;version="2.0.0";x-internal:=true
org.eclipse.emf.cdo.internal.ui.preferences;version="2.0.0";x-internal:=true,
org.eclipse.emf.cdo.internal.ui.views;version="2.0.0";x-internal:=true,
org.eclipse.emf.cdo.ui;version="2.0.0",
- org.eclipse.emf.cdo.ui.viewhistory;version="2.0.0",
org.eclipse.emf.cdo.ui.widgets;version="2.0.0"
Bundle-ActivationPolicy: lazy
diff --git a/plugins/org.eclipse.emf.cdo.ui/src/org/eclipse/emf/cdo/internal/ui/actions/OpenResourceEditorAction.java b/plugins/org.eclipse.emf.cdo.ui/src/org/eclipse/emf/cdo/internal/ui/actions/OpenResourceEditorAction.java
index a9bd2929a7..d457a0b0e9 100644
--- a/plugins/org.eclipse.emf.cdo.ui/src/org/eclipse/emf/cdo/internal/ui/actions/OpenResourceEditorAction.java
+++ b/plugins/org.eclipse.emf.cdo.ui/src/org/eclipse/emf/cdo/internal/ui/actions/OpenResourceEditorAction.java
@@ -11,8 +11,8 @@
package org.eclipse.emf.cdo.internal.ui.actions;
import org.eclipse.emf.cdo.CDOView;
+import org.eclipse.emf.cdo.eresource.CDOResourceNode;
import org.eclipse.emf.cdo.internal.ui.editor.CDOEditor;
-import org.eclipse.emf.cdo.ui.viewhistory.CDOViewHistoryEntry;
import org.eclipse.jface.resource.ImageDescriptor;
import org.eclipse.ui.IWorkbenchPage;
@@ -20,23 +20,23 @@ import org.eclipse.ui.IWorkbenchPage;
/**
* @author Eike Stepper
*/
-public final class OpenResourceEditorAction extends EntryAction
+public final class OpenResourceEditorAction extends ResourceNodeAction
{
private static final String TITLE = "Open Editor";
private static final String TOOL_TIP = "Open a CDO editor for this resource";
public OpenResourceEditorAction(IWorkbenchPage page, String text, String toolTipText, ImageDescriptor image,
- CDOViewHistoryEntry entry)
+ CDOResourceNode resourceNode)
{
- super(page, TITLE, TOOL_TIP, null, entry);
+ super(page, TITLE, TOOL_TIP, null, resourceNode);
}
@Override
protected void doRun() throws Exception
{
- CDOView view = getEntry().getView();
- String resourcePath = getEntry().getResourcePath();
+ CDOView view = getResourceNode().cdoView();
+ String resourcePath = getResourceNode().getPath();
CDOEditor.open(getPage(), view, resourcePath);
}
}
diff --git a/plugins/org.eclipse.emf.cdo.ui/src/org/eclipse/emf/cdo/internal/ui/actions/EntryAction.java b/plugins/org.eclipse.emf.cdo.ui/src/org/eclipse/emf/cdo/internal/ui/actions/ResourceNodeAction.java
index 27e81e4c81..1eae1606ff 100644
--- a/plugins/org.eclipse.emf.cdo.ui/src/org/eclipse/emf/cdo/internal/ui/actions/EntryAction.java
+++ b/plugins/org.eclipse.emf.cdo.ui/src/org/eclipse/emf/cdo/internal/ui/actions/ResourceNodeAction.java
@@ -10,7 +10,7 @@
**************************************************************************/
package org.eclipse.emf.cdo.internal.ui.actions;
-import org.eclipse.emf.cdo.ui.viewhistory.CDOViewHistoryEntry;
+import org.eclipse.emf.cdo.eresource.CDOResourceNode;
import org.eclipse.net4j.util.ui.actions.LongRunningAction;
@@ -20,19 +20,19 @@ import org.eclipse.ui.IWorkbenchPage;
/**
* @author Eike Stepper
*/
-public abstract class EntryAction extends LongRunningAction
+public abstract class ResourceNodeAction extends LongRunningAction
{
- private CDOViewHistoryEntry entry;
+ private CDOResourceNode resourceNode;
- public EntryAction(IWorkbenchPage page, String text, String toolTipText, ImageDescriptor image,
- CDOViewHistoryEntry entry)
+ public ResourceNodeAction(IWorkbenchPage page, String text, String toolTipText, ImageDescriptor image,
+ CDOResourceNode resourceNode)
{
super(page, text, toolTipText, image);
- this.entry = entry;
+ this.resourceNode = resourceNode;
}
- public CDOViewHistoryEntry getEntry()
+ public CDOResourceNode getResourceNode()
{
- return entry;
+ return resourceNode;
}
}
diff --git a/plugins/org.eclipse.emf.cdo.ui/src/org/eclipse/emf/cdo/internal/ui/editor/CDOEditor.java b/plugins/org.eclipse.emf.cdo.ui/src/org/eclipse/emf/cdo/internal/ui/editor/CDOEditor.java
index c5888ccaac..5c4b21981f 100644
--- a/plugins/org.eclipse.emf.cdo.ui/src/org/eclipse/emf/cdo/internal/ui/editor/CDOEditor.java
+++ b/plugins/org.eclipse.emf.cdo.ui/src/org/eclipse/emf/cdo/internal/ui/editor/CDOEditor.java
@@ -23,6 +23,7 @@ import org.eclipse.emf.cdo.internal.ui.dialogs.RollbackTransactionDialog;
import org.eclipse.emf.cdo.ui.CDOEventHandler;
import org.eclipse.emf.cdo.ui.CDOLabelProvider;
import org.eclipse.emf.cdo.util.CDOURIUtil;
+import org.eclipse.emf.cdo.util.CDOUtil;
import org.eclipse.emf.internal.cdo.CDOLegacyWrapper;
import org.eclipse.emf.internal.cdo.CDOStateMachine;
@@ -85,7 +86,6 @@ import org.eclipse.core.resources.ResourcesPlugin;
import org.eclipse.core.runtime.CoreException;
import org.eclipse.core.runtime.IPath;
import org.eclipse.core.runtime.IProgressMonitor;
-import org.eclipse.core.runtime.NullProgressMonitor;
import org.eclipse.jface.action.IMenuListener;
import org.eclipse.jface.action.IMenuManager;
import org.eclipse.jface.action.IStatusLineManager;
@@ -1330,7 +1330,7 @@ public class CDOEditor extends MultiPageEditorPart implements IEditingDomainProv
/**
* This accesses a cached version of the content outliner. <!-- begin-user-doc --> <!-- end-user-doc -->
*
- * @generated
+ * @generated NOT
*/
public IContentOutlinePage getContentOutlinePage()
{
@@ -1357,12 +1357,12 @@ public class CDOEditor extends MultiPageEditorPart implements IEditingDomainProv
//
createContextMenuFor(contentOutlineViewer);
- if (!editingDomain.getResourceSet().getResources().isEmpty())
+ if (!CDOUtil.getResources(editingDomain.getResourceSet()).isEmpty())
{
// Select the root object in the view.
//
- contentOutlineViewer.setSelection(new StructuredSelection(editingDomain.getResourceSet().getResources()
- .get(0)), true);
+ contentOutlineViewer.setSelection(new StructuredSelection(CDOUtil.getResources(
+ editingDomain.getResourceSet()).get(0)), true);
}
}
@@ -1569,7 +1569,7 @@ public class CDOEditor extends MultiPageEditorPart implements IEditingDomainProv
// Save the resources to the file system.
//
boolean first = true;
- for (Resource resource : editingDomain.getResourceSet().getResources())
+ for (Resource resource : CDOUtil.getResources(editingDomain.getResourceSet()))
{
if ((first || !resource.getContents().isEmpty() || isPersisted(resource))
&& !editingDomain.isReadOnly(resource))
@@ -1700,16 +1700,18 @@ public class CDOEditor extends MultiPageEditorPart implements IEditingDomainProv
/**
* <!-- begin-user-doc --> <!-- end-user-doc -->
*
- * @generated
+ * @generated NOT
*/
protected void doSaveAs(URI uri, IEditorInput editorInput)
{
- editingDomain.getResourceSet().getResources().get(0).setURI(uri);
- setInputWithNotify(editorInput);
- setPartName(editorInput.getName());
- IProgressMonitor progressMonitor = getActionBars().getStatusLineManager() != null ? getActionBars()
- .getStatusLineManager().getProgressMonitor() : new NullProgressMonitor();
- doSave(progressMonitor);
+ throw new UnsupportedOperationException();
+
+ // CDOUtil.getResources(editingDomain.getResourceSet()).get(0).setURI(uri);
+ // setInputWithNotify(editorInput);
+ // setPartName(editorInput.getName());
+ // IProgressMonitor progressMonitor = getActionBars().getStatusLineManager() != null ? getActionBars()
+ // .getStatusLineManager().getProgressMonitor() : new NullProgressMonitor();
+ // doSave(progressMonitor);
}
/**
diff --git a/plugins/org.eclipse.emf.cdo.ui/src/org/eclipse/emf/cdo/internal/ui/views/CDOSessionsView.java b/plugins/org.eclipse.emf.cdo.ui/src/org/eclipse/emf/cdo/internal/ui/views/CDOSessionsView.java
index e6e46ab40e..e9308481f9 100644
--- a/plugins/org.eclipse.emf.cdo.ui/src/org/eclipse/emf/cdo/internal/ui/views/CDOSessionsView.java
+++ b/plugins/org.eclipse.emf.cdo.ui/src/org/eclipse/emf/cdo/internal/ui/views/CDOSessionsView.java
@@ -11,11 +11,8 @@
package org.eclipse.emf.cdo.internal.ui.views;
import org.eclipse.emf.cdo.CDOSession;
-import org.eclipse.emf.cdo.CDOView;
import org.eclipse.emf.cdo.internal.ui.actions.OpenSessionAction;
-import org.eclipse.emf.cdo.internal.ui.editor.CDOEditor;
import org.eclipse.emf.cdo.ui.CDOItemProvider;
-import org.eclipse.emf.cdo.ui.viewhistory.CDOViewHistoryEntry;
import org.eclipse.net4j.util.container.IContainer;
import org.eclipse.net4j.util.container.IManagedContainer;
@@ -27,7 +24,6 @@ import org.eclipse.net4j.util.ui.views.IElementFilter;
import org.eclipse.jface.action.IToolBarManager;
import org.eclipse.swt.widgets.Composite;
import org.eclipse.swt.widgets.Control;
-import org.eclipse.ui.IWorkbenchPage;
public class CDOSessionsView extends ContainerView
{
@@ -68,21 +64,4 @@ public class CDOSessionsView extends ContainerView
manager.add(openSessionAction);
super.fillLocalToolBar(manager);
}
-
- @Override
- protected void doubleClicked(Object object)
- {
- if (object instanceof CDOViewHistoryEntry)
- {
- CDOViewHistoryEntry entry = (CDOViewHistoryEntry)object;
- IWorkbenchPage page = getViewSite().getPage();
- CDOView view = entry.getView();
- String resourcePath = entry.getResourcePath();
- CDOEditor.open(page, view, resourcePath);
- }
- else
- {
- super.doubleClicked(object);
- }
- }
}
diff --git a/plugins/org.eclipse.emf.cdo.ui/src/org/eclipse/emf/cdo/ui/CDOEventHandler.java b/plugins/org.eclipse.emf.cdo.ui/src/org/eclipse/emf/cdo/ui/CDOEventHandler.java
index d2f37e7b09..d6be86dd2a 100644
--- a/plugins/org.eclipse.emf.cdo.ui/src/org/eclipse/emf/cdo/ui/CDOEventHandler.java
+++ b/plugins/org.eclipse.emf.cdo.ui/src/org/eclipse/emf/cdo/ui/CDOEventHandler.java
@@ -11,6 +11,7 @@
package org.eclipse.emf.cdo.ui;
import org.eclipse.emf.cdo.CDOObject;
+import org.eclipse.emf.cdo.CDOSession;
import org.eclipse.emf.cdo.CDOSessionInvalidationEvent;
import org.eclipse.emf.cdo.CDOTransactionConflictEvent;
import org.eclipse.emf.cdo.CDOTransactionFinishedEvent;
@@ -140,10 +141,18 @@ public class CDOEventHandler
public void dispose()
{
- view.removeListener(viewListener);
- view.getSession().removeListener(sessionListener);
- treeViewer = null;
+ if (view != null)
+ {
+ view.removeListener(viewListener);
+ CDOSession session = view.getSession();
+ if (session != null)
+ {
+ session.removeListener(sessionListener);
+ }
+ }
+
view = null;
+ treeViewer = null;
}
public CDOView getView()
diff --git a/plugins/org.eclipse.emf.cdo.ui/src/org/eclipse/emf/cdo/ui/CDOItemProvider.java b/plugins/org.eclipse.emf.cdo.ui/src/org/eclipse/emf/cdo/ui/CDOItemProvider.java
index 2668ba13c3..1f13777bd3 100644
--- a/plugins/org.eclipse.emf.cdo.ui/src/org/eclipse/emf/cdo/ui/CDOItemProvider.java
+++ b/plugins/org.eclipse.emf.cdo.ui/src/org/eclipse/emf/cdo/ui/CDOItemProvider.java
@@ -14,10 +14,7 @@ package org.eclipse.emf.cdo.ui;
import org.eclipse.emf.cdo.CDOAudit;
import org.eclipse.emf.cdo.CDOSession;
import org.eclipse.emf.cdo.CDOTransaction;
-import org.eclipse.emf.cdo.CDOTransactionFinishedEvent;
-import org.eclipse.emf.cdo.CDOTransactionStartedEvent;
import org.eclipse.emf.cdo.CDOView;
-import org.eclipse.emf.cdo.CDOViewEvent;
import org.eclipse.emf.cdo.internal.ui.SharedIcons;
import org.eclipse.emf.cdo.internal.ui.actions.CloseSessionAction;
import org.eclipse.emf.cdo.internal.ui.actions.CloseViewAction;
@@ -36,15 +33,10 @@ import org.eclipse.emf.cdo.internal.ui.actions.RegisterSinglePackageAction;
import org.eclipse.emf.cdo.internal.ui.actions.RegisterWorkspacePackagesAction;
import org.eclipse.emf.cdo.internal.ui.actions.ReloadViewAction;
import org.eclipse.emf.cdo.internal.ui.actions.RollbackTransactionAction;
-import org.eclipse.emf.cdo.ui.viewhistory.CDOViewHistory;
-import org.eclipse.emf.cdo.ui.viewhistory.CDOViewHistoryEntry;
-import org.eclipse.emf.cdo.ui.viewhistory.CDOViewHistoryEvent;
import org.eclipse.emf.cdo.util.CDOPackageType;
import org.eclipse.emf.cdo.util.CDOPackageTypeRegistry;
import org.eclipse.net4j.util.container.IContainer;
-import org.eclipse.net4j.util.event.IEvent;
-import org.eclipse.net4j.util.event.IListener;
import org.eclipse.net4j.util.ui.actions.SafeAction;
import org.eclipse.net4j.util.ui.views.ContainerItemProvider;
import org.eclipse.net4j.util.ui.views.IElementFilter;
@@ -61,7 +53,6 @@ import java.text.MessageFormat;
import java.util.ArrayList;
import java.util.Collections;
import java.util.Comparator;
-import java.util.HashMap;
import java.util.HashSet;
import java.util.List;
import java.util.Map;
@@ -74,66 +65,6 @@ public class CDOItemProvider extends ContainerItemProvider<IContainer<Object>>
{
private IWorkbenchPage page;
- private Map<CDOView, CDOViewHistory> viewHistories = new HashMap<CDOView, CDOViewHistory>();
-
- private IListener viewListener = new IListener()
- {
- public void notifyEvent(IEvent event)
- {
- if (event instanceof CDOTransactionStartedEvent || event instanceof CDOTransactionFinishedEvent)
- {
- try
- {
- final CDOView view = ((CDOViewEvent)event).getView();
- getViewer().getControl().getDisplay().syncExec(new Runnable()
- {
- public void run()
- {
- try
- {
- fireLabelProviderChanged(view);
- CDOViewHistory history = viewHistories.get(view);
- if (history != null)
- {
- CDOViewHistoryEntry[] entries = history.getEntries();
- if (entries != null && entries.length != 0)
- {
- fireLabelProviderChanged(entries);
- }
- }
- }
- catch (Exception ignore)
- {
- }
- }
- });
- }
- catch (Exception ignore)
- {
- }
- }
- }
- };
-
- private IListener historyListener = new IListener()
- {
- public void notifyEvent(IEvent event)
- {
- if (event instanceof CDOViewHistoryEvent)
- {
- CDOViewHistoryEvent e = (CDOViewHistoryEvent)event;
- CDOView view = e.getViewHistory().getView();
- refreshElement(view, false);
-
- CDOViewHistoryEntry addedEntry = e.getAddedEntry();
- if (addedEntry != null)
- {
- revealElement(addedEntry);
- }
- }
- }
- };
-
public CDOItemProvider(IWorkbenchPage page, IElementFilter rootElementFilter)
{
super(rootElementFilter);
@@ -150,13 +81,7 @@ public class CDOItemProvider extends ContainerItemProvider<IContainer<Object>>
{
if (element instanceof CDOView)
{
- CDOView view = (CDOView)element;
- CDOViewHistory history = viewHistories.get(view);
- if (history != null)
- {
- return history.getEntries();
- }
-
+ // CDOView view = (CDOView)element;
return NO_ELEMENTS;
}
@@ -168,13 +93,7 @@ public class CDOItemProvider extends ContainerItemProvider<IContainer<Object>>
{
if (element instanceof CDOView)
{
- CDOView view = (CDOView)element;
- CDOViewHistory history = viewHistories.get(view);
- if (history != null)
- {
- return history.hasEntries();
- }
-
+ // CDOView view = (CDOView)element;
return false;
}
@@ -184,10 +103,10 @@ public class CDOItemProvider extends ContainerItemProvider<IContainer<Object>>
@Override
public Object getParent(Object element)
{
- if (element instanceof CDOViewHistoryEntry)
- {
- return ((CDOViewHistoryEntry)element).getView();
- }
+ // if (element instanceof CDOViewHistoryEntry)
+ // {
+ // return ((CDOViewHistoryEntry)element).getView();
+ // }
return super.getParent(element);
}
@@ -205,11 +124,6 @@ public class CDOItemProvider extends ContainerItemProvider<IContainer<Object>>
return getViewLabel((CDOView)obj);
}
- if (obj instanceof CDOViewHistoryEntry)
- {
- return getHistroyEntryLabel((CDOViewHistoryEntry)obj);
- }
-
return super.getText(obj);
}
@@ -260,14 +174,6 @@ public class CDOItemProvider extends ContainerItemProvider<IContainer<Object>>
return MessageFormat.format("View [{0}]", view.getViewID());
}
- /**
- * @since 2.0
- */
- public static String getHistroyEntryLabel(CDOViewHistoryEntry entry)
- {
- return (entry.getView().isDirty() ? "*" : "") + entry.getResourcePath();
- }
-
@Override
protected void fillContextMenu(IMenuManager manager, ITreeSelection selection)
{
@@ -283,10 +189,6 @@ public class CDOItemProvider extends ContainerItemProvider<IContainer<Object>>
{
fillView(manager, (CDOView)object);
}
- else if (object instanceof CDOViewHistoryEntry)
- {
- fillHistoryEntry(manager, (CDOViewHistoryEntry)object);
- }
}
}
@@ -363,25 +265,13 @@ public class CDOItemProvider extends ContainerItemProvider<IContainer<Object>>
manager.add(new CloseViewAction(page, view));
}
- /**
- * @since 2.0
- */
- protected void fillHistoryEntry(IMenuManager manager, CDOViewHistoryEntry entry)
- {
- }
-
@Override
protected void elementAdded(Object element, Object parent)
{
super.elementAdded(element, parent);
if (element instanceof CDOView)
{
- CDOView view = (CDOView)element;
- view.addListener(viewListener);
-
- CDOViewHistory history = new CDOViewHistory(view);
- history.addListener(historyListener);
- viewHistories.put(view, history);
+ // CDOView view = (CDOView)element;
}
}
@@ -391,12 +281,7 @@ public class CDOItemProvider extends ContainerItemProvider<IContainer<Object>>
super.elementRemoved(element, parent);
if (element instanceof CDOView)
{
- CDOView view = (CDOView)element;
- view.removeListener(viewListener);
-
- CDOViewHistory history = viewHistories.remove(view);
- history.removeListener(historyListener);
- history.dispose();
+ // CDOView view = (CDOView)element;
}
}
}
diff --git a/plugins/org.eclipse.emf.cdo.ui/src/org/eclipse/emf/cdo/ui/viewhistory/CDOViewHistory.java b/plugins/org.eclipse.emf.cdo.ui/src/org/eclipse/emf/cdo/ui/viewhistory/CDOViewHistory.java
deleted file mode 100644
index ad050c1e36..0000000000
--- a/plugins/org.eclipse.emf.cdo.ui/src/org/eclipse/emf/cdo/ui/viewhistory/CDOViewHistory.java
+++ /dev/null
@@ -1,156 +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.cdo.ui.viewhistory;
-
-import org.eclipse.emf.cdo.CDOView;
-import org.eclipse.emf.cdo.CDOViewResourcesEvent;
-import org.eclipse.emf.cdo.eresource.CDOResource;
-
-import org.eclipse.net4j.util.event.Event;
-import org.eclipse.net4j.util.event.IEvent;
-import org.eclipse.net4j.util.event.IListener;
-import org.eclipse.net4j.util.event.Notifier;
-
-import org.eclipse.emf.ecore.resource.Resource;
-
-import java.text.MessageFormat;
-import java.util.HashSet;
-import java.util.Set;
-
-/**
- * @author Eike Stepper
- * @since 2.0
- */
-public final class CDOViewHistory extends Notifier
-{
- private CDOView view;
-
- private Set<CDOViewHistoryEntry> entries = new HashSet<CDOViewHistoryEntry>();
-
- private IListener viewListener = new IListener()
- {
- public void notifyEvent(IEvent event)
- {
- if (event instanceof CDOViewResourcesEvent)
- {
- CDOViewResourcesEvent e = (CDOViewResourcesEvent)event;
- if (e.getView() == view && e.getKind() == CDOViewResourcesEvent.Kind.ADDED)
- {
- addResource(e.getResourcePath());
- }
- }
- }
- };
-
- public CDOViewHistory(CDOView view)
- {
- this.view = view;
- view.addListener(viewListener);
- }
-
- public void dispose()
- {
- view.removeListener(viewListener);
- entries.clear();
- }
-
- public CDOView getView()
- {
- return view;
- }
-
- public CDOViewHistoryEntry[] getEntries()
- {
- synchronized (entries)
- {
- return entries.toArray(new CDOViewHistoryEntry[entries.size()]);
- }
- }
-
- public boolean hasEntries()
- {
- synchronized (entries)
- {
- return !entries.isEmpty();
- }
- }
-
- public void reset()
- {
- Set<CDOViewHistoryEntry> openResources = new HashSet<CDOViewHistoryEntry>();
- for (Resource resource : view.getResourceSet().getResources())
- {
- if (resource instanceof CDOResource)
- {
- CDOResource cdoResource = (CDOResource)resource;
- openResources.add(new CDOViewHistoryEntry(view, cdoResource.getPath()));
- }
- }
-
- boolean changed;
- synchronized (entries)
- {
- changed = entries.retainAll(openResources);
- }
-
- if (changed)
- {
- fireEvent(new ViewHistoryEvent(null));
- }
- }
-
- protected void addResource(String resourcePath)
- {
- CDOViewHistoryEntry entry = new CDOViewHistoryEntry(view, resourcePath);
- boolean changed;
- synchronized (entries)
- {
- changed = entries.add(entry);
- }
-
- if (changed)
- {
- fireEvent(new ViewHistoryEvent(entry));
- }
- }
-
- /**
- * @author Eike Stepper
- */
- private final class ViewHistoryEvent extends Event implements CDOViewHistoryEvent
- {
- private static final long serialVersionUID = 1L;
-
- CDOViewHistoryEntry addedEntry;
-
- public ViewHistoryEvent(CDOViewHistoryEntry addedEntry)
- {
- super(CDOViewHistory.this);
- this.addedEntry = addedEntry;
- }
-
- public CDOViewHistory getViewHistory()
- {
- return CDOViewHistory.this;
- }
-
- public CDOViewHistoryEntry getAddedEntry()
- {
- return addedEntry;
- }
-
- @Override
- public String toString()
- {
- return MessageFormat.format("CDOViewHistoryEvent[source={0}, addedEntry={1}]", getSource(), getAddedEntry());
- }
- }
-}
diff --git a/plugins/org.eclipse.emf.cdo.ui/src/org/eclipse/emf/cdo/ui/viewhistory/CDOViewHistoryEntry.java b/plugins/org.eclipse.emf.cdo.ui/src/org/eclipse/emf/cdo/ui/viewhistory/CDOViewHistoryEntry.java
deleted file mode 100644
index 2e27842687..0000000000
--- a/plugins/org.eclipse.emf.cdo.ui/src/org/eclipse/emf/cdo/ui/viewhistory/CDOViewHistoryEntry.java
+++ /dev/null
@@ -1,74 +0,0 @@
-package org.eclipse.emf.cdo.ui.viewhistory;
-
-import org.eclipse.emf.cdo.CDOView;
-
-/**
- * @author Eike Stepper
- * @since 2.0
- */
-public final class CDOViewHistoryEntry implements Comparable<CDOViewHistoryEntry>
-{
- private CDOView view;
-
- private String resourcePath;
-
- public CDOViewHistoryEntry(CDOView view, String resourcePath)
- {
- if (view == null)
- {
- throw new IllegalArgumentException("view == null");
- }
-
- if (resourcePath == null)
- {
- throw new IllegalArgumentException("resourcePath == null");
- }
-
- this.view = view;
- this.resourcePath = resourcePath;
- }
-
- public CDOView getView()
- {
- return view;
- }
-
- public String getResourcePath()
- {
- return resourcePath;
- }
-
- public int compareTo(CDOViewHistoryEntry entry)
- {
- return resourcePath.compareTo(entry.resourcePath);
- }
-
- @Override
- public boolean equals(Object obj)
- {
- if (obj == this)
- {
- return true;
- }
-
- if (obj instanceof CDOViewHistoryEntry)
- {
- CDOViewHistoryEntry that = (CDOViewHistoryEntry)obj;
- return view == that.getView() && resourcePath.equals(that.resourcePath);
- }
-
- return false;
- }
-
- @Override
- public int hashCode()
- {
- return resourcePath.hashCode();
- }
-
- @Override
- public String toString()
- {
- return resourcePath;
- }
-}
diff --git a/plugins/org.eclipse.emf.cdo/model/eresource.ecore b/plugins/org.eclipse.emf.cdo/model/eresource.ecore
index d3e21c6033..95b5a102ba 100644
--- a/plugins/org.eclipse.emf.cdo/model/eresource.ecore
+++ b/plugins/org.eclipse.emf.cdo/model/eresource.ecore
@@ -2,31 +2,41 @@
<ecore:EPackage xmi:version="2.0"
xmlns:xmi="http://www.omg.org/XMI" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:ecore="http://www.eclipse.org/emf/2002/Ecore" name="eresource"
- nsURI="http://www.eclipse.org/emf/CDO/resource/1.0.0" nsPrefix="eresource">
- <eClassifiers xsi:type="ecore:EClass" name="CDOResource">
+ nsURI="http://www.eclipse.org/emf/CDO/resource/2.0.0" nsPrefix="eresource">
+ <eClassifiers xsi:type="ecore:EClass" name="CDOResourceNode" abstract="true">
+ <eStructuralFeatures xsi:type="ecore:EReference" name="folder" eType="#//CDOResourceFolder"
+ eOpposite="#//CDOResourceFolder/nodes"/>
+ <eStructuralFeatures xsi:type="ecore:EAttribute" name="name" eType="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//EString"/>
+ <eStructuralFeatures xsi:type="ecore:EAttribute" name="path" eType="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//EString"
+ volatile="true" transient="true" derived="true"/>
+ </eClassifiers>
+ <eClassifiers xsi:type="ecore:EClass" name="CDOResourceFolder" eSuperTypes="#//CDOResourceNode">
+ <eStructuralFeatures xsi:type="ecore:EReference" name="nodes" upperBound="-1"
+ eType="#//CDOResourceNode" containment="true" eOpposite="#//CDOResourceNode/folder"/>
+ </eClassifiers>
+ <eClassifiers xsi:type="ecore:EClass" name="CDOResource" eSuperTypes="#//CDOResourceNode">
<eStructuralFeatures xsi:type="ecore:EAttribute" name="resourceSet" eType="#//ResourceSet"
transient="true"/>
- <eStructuralFeatures xsi:type="ecore:EAttribute" name="uRI" eType="#//URI" transient="true"/>
+ <eStructuralFeatures xsi:type="ecore:EAttribute" name="uRI" eType="#//URI" volatile="true"
+ transient="true" derived="true"/>
<eStructuralFeatures xsi:type="ecore:EReference" name="contents" upperBound="-1"
eType="ecore:EClass platform:/plugin/org.eclipse.emf.ecore/model/Ecore.ecore#//EObject"
containment="true"/>
<eStructuralFeatures xsi:type="ecore:EAttribute" name="modified" eType="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//EBoolean"
transient="true"/>
<eStructuralFeatures xsi:type="ecore:EAttribute" name="loaded" eType="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//EBoolean"
- transient="true" defaultValueLiteral="true">
- <eAnnotations source="http://www.eclipse.org/emf/2002/GenModel">
- <details key="suppressedSetVisibility" value="true"/>
- </eAnnotations>
- </eStructuralFeatures>
+ changeable="false" volatile="true" transient="true" defaultValueLiteral="true"
+ derived="true"/>
<eStructuralFeatures xsi:type="ecore:EAttribute" name="trackingModification" eType="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//EBoolean"
transient="true"/>
<eStructuralFeatures xsi:type="ecore:EAttribute" name="errors" upperBound="-1"
- eType="#//Diagnostic" transient="true"/>
+ eType="#//Diagnostic" changeable="false" volatile="true" transient="true"
+ derived="true"/>
<eStructuralFeatures xsi:type="ecore:EAttribute" name="warnings" upperBound="-1"
- eType="#//Diagnostic" transient="true"/>
+ eType="#//Diagnostic" changeable="false" volatile="true" transient="true"
+ derived="true"/>
<eStructuralFeatures xsi:type="ecore:EAttribute" name="timeStamp" eType="ecore:EDataType platform:/plugin/org.eclipse.emf.ecore/model/Ecore.ecore#//ELong"
transient="true"/>
- <eStructuralFeatures xsi:type="ecore:EAttribute" name="path" eType="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//EString"/>
</eClassifiers>
<eClassifiers xsi:type="ecore:EDataType" name="ResourceSet" instanceClassName="org.eclipse.emf.ecore.resource.ResourceSet"
serializable="false"/>
diff --git a/plugins/org.eclipse.emf.cdo/model/resource.genmodel b/plugins/org.eclipse.emf.cdo/model/resource.genmodel
index f1ae370ca8..bfdfb4a8f3 100644
--- a/plugins/org.eclipse.emf.cdo/model/resource.genmodel
+++ b/plugins/org.eclipse.emf.cdo/model/resource.genmodel
@@ -14,6 +14,14 @@
<genDataTypes ecoreDataType="eresource.ecore#//ResourceSet"/>
<genDataTypes ecoreDataType="eresource.ecore#//URI"/>
<genDataTypes ecoreDataType="eresource.ecore#//Diagnostic"/>
+ <genClasses image="false" ecoreClass="eresource.ecore#//CDOResourceNode">
+ <genFeatures property="None" notify="false" createChild="false" ecoreFeature="ecore:EReference eresource.ecore#//CDOResourceNode/folder"/>
+ <genFeatures createChild="false" ecoreFeature="ecore:EAttribute eresource.ecore#//CDOResourceNode/name"/>
+ <genFeatures property="Readonly" createChild="false" ecoreFeature="ecore:EAttribute eresource.ecore#//CDOResourceNode/path"/>
+ </genClasses>
+ <genClasses ecoreClass="eresource.ecore#//CDOResourceFolder">
+ <genFeatures property="None" children="true" createChild="true" ecoreFeature="ecore:EReference eresource.ecore#//CDOResourceFolder/contents"/>
+ </genClasses>
<genClasses ecoreClass="eresource.ecore#//CDOResource">
<genFeatures property="None" createChild="false" ecoreFeature="ecore:EAttribute eresource.ecore#//CDOResource/resourceSet"/>
<genFeatures property="Readonly" createChild="false" ecoreFeature="ecore:EAttribute eresource.ecore#//CDOResource/uRI"/>
@@ -24,7 +32,6 @@
<genFeatures property="None" createChild="false" ecoreFeature="ecore:EAttribute eresource.ecore#//CDOResource/errors"/>
<genFeatures property="None" createChild="false" ecoreFeature="ecore:EAttribute eresource.ecore#//CDOResource/warnings"/>
<genFeatures createChild="false" ecoreFeature="ecore:EAttribute eresource.ecore#//CDOResource/timeStamp"/>
- <genFeatures property="Readonly" createChild="false" ecoreFeature="ecore:EAttribute eresource.ecore#//CDOResource/path"/>
</genClasses>
</genPackages>
</genmodel:GenModel>
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/util/InvalidURIException.java b/plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/cdo/util/InvalidURIException.java
new file mode 100644
index 0000000000..667c880ca2
--- /dev/null
+++ b/plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/cdo/util/InvalidURIException.java
@@ -0,0 +1,42 @@
+/***************************************************************************
+ * 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.util;
+
+import org.eclipse.emf.cdo.common.util.CDOException;
+
+import org.eclipse.emf.common.util.URI;
+
+/**
+ * @author Eike Stepper
+ * @since 2.0
+ */
+public class InvalidURIException extends CDOException
+{
+ 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