Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorEike Stepper2009-03-14 07:07:36 -0400
committerEike Stepper2009-03-14 07:07:36 -0400
commited0e1b1e3bd246b5c11ba88b166e1678703bc887 (patch)
tree42780d403e12ef54d670d0634e7b22c2deda473f /plugins/org.eclipse.emf.cdo/src
parent04ab084a7995a3303dc3b6e84d7d2c356614927b (diff)
downloadcdo-ed0e1b1e3bd246b5c11ba88b166e1678703bc887.tar.gz
cdo-ed0e1b1e3bd246b5c11ba88b166e1678703bc887.tar.xz
cdo-ed0e1b1e3bd246b5c11ba88b166e1678703bc887.zip
[265435] Replace CDOModelElements by EModelElements
https://bugs.eclipse.org/bugs/show_bug.cgi?id=265435
Diffstat (limited to 'plugins/org.eclipse.emf.cdo/src')
-rw-r--r--plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/cdo/CDOObject.java9
-rw-r--r--plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/cdo/eresource/CDOResource.java7
-rw-r--r--plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/cdo/eresource/CDOResourceFolder.java7
-rw-r--r--plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/cdo/eresource/CDOResourceNode.java7
-rw-r--r--plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/cdo/eresource/EresourceFactory.java7
-rw-r--r--plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/cdo/eresource/EresourcePackage.java9
-rw-r--r--plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/cdo/eresource/impl/CDOResourceFolderImpl.java7
-rw-r--r--plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/cdo/eresource/impl/CDOResourceImpl.java11
-rw-r--r--plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/cdo/eresource/impl/CDOResourceNodeImpl.java7
-rw-r--r--plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/cdo/eresource/impl/EresourceFactoryImpl.java13
-rw-r--r--plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/cdo/eresource/impl/EresourcePackageImpl.java41
-rw-r--r--plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/cdo/eresource/util/EresourceAdapterFactory.java7
-rw-r--r--plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/cdo/eresource/util/EresourceSwitch.java17
-rw-r--r--plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/cdo/session/CDOCollectionLoadingPolicy.java11
-rw-r--r--plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/cdo/session/CDOPackageRegistry.java39
-rw-r--r--plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/cdo/session/CDOPackageType.java33
-rw-r--r--plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/cdo/session/CDOPackageTypeRegistry.java33
-rw-r--r--plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/cdo/session/CDORevisionManager.java5
-rw-r--r--plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/cdo/session/CDOSession.java46
-rw-r--r--plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/cdo/session/CDOSessionConfiguration.java15
-rw-r--r--plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/cdo/session/CDOSessionPackageManager.java67
-rw-r--r--plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/cdo/transaction/CDOCommitContext.java6
-rw-r--r--plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/cdo/transaction/CDOTransaction.java6
-rw-r--r--plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/cdo/util/CDOUtil.java18
-rw-r--r--plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/cdo/util/EMFUtil.java378
-rw-r--r--plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/cdo/util/ModelUtil.java58
-rw-r--r--plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/cdo/view/CDOFeatureAnalyzer.java7
-rw-r--r--plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/internal/cdo/CDOFactoryImpl.java19
-rw-r--r--plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/internal/cdo/CDOLegacyWrapper.java63
-rw-r--r--plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/internal/cdo/CDOMetaWrapper.java4
-rw-r--r--plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/internal/cdo/CDONotificationBuilder.java12
-rw-r--r--plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/internal/cdo/CDOObjectImpl.java32
-rw-r--r--plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/internal/cdo/CDOObjectMerger.java2
-rw-r--r--plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/internal/cdo/CDOStateMachine.java8
-rw-r--r--plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/internal/cdo/CDOStore.java292
-rw-r--r--plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/internal/cdo/analyzer/CDOAbstractFeatureRuleAnalyzer.java17
-rw-r--r--plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/internal/cdo/analyzer/CDOAnalyzerFeatureInfo.java49
-rw-r--r--plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/internal/cdo/analyzer/CDOClusterOfFetchRule.java12
-rw-r--r--plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/internal/cdo/analyzer/CDOFeatureAnalyzerModelBased.java11
-rw-r--r--plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/internal/cdo/analyzer/CDOFeatureAnalyzerUI.java36
-rw-r--r--plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/internal/cdo/analyzer/CDOFetchFeatureInfo.java26
-rw-r--r--plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/internal/cdo/analyzer/NOOPFeatureAnalyzer.java7
-rw-r--r--plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/internal/cdo/analyzer/NOOPFetchRuleManager.java6
-rw-r--r--plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/internal/cdo/bundle/Activator.java3
-rw-r--r--plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/internal/cdo/bundle/OM.java8
-rw-r--r--plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/internal/cdo/net4j/CDONet4jSessionFactory.java9
-rw-r--r--plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/internal/cdo/net4j/protocol/CDOClientIndication.java56
-rw-r--r--plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/internal/cdo/net4j/protocol/CDOClientProtocol.java21
-rw-r--r--plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/internal/cdo/net4j/protocol/CDOClientRequest.java63
-rw-r--r--plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/internal/cdo/net4j/protocol/CDOTimeRequest.java18
-rw-r--r--plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/internal/cdo/net4j/protocol/ChangeSubscriptionRequest.java7
-rw-r--r--plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/internal/cdo/net4j/protocol/CommitNotificationIndication.java33
-rw-r--r--plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/internal/cdo/net4j/protocol/CommitTransactionRequest.java112
-rw-r--r--plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/internal/cdo/net4j/protocol/GetRemoteSessionsRequest.java7
-rw-r--r--plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/internal/cdo/net4j/protocol/LoadChunkRequest.java38
-rw-r--r--plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/internal/cdo/net4j/protocol/LoadLibrariesRequest.java14
-rw-r--r--plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/internal/cdo/net4j/protocol/LoadPackageRequest.java59
-rw-r--r--plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/internal/cdo/net4j/protocol/LoadPackagesRequest.java61
-rw-r--r--plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/internal/cdo/net4j/protocol/LoadRevisionByTimeRequest.java7
-rw-r--r--plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/internal/cdo/net4j/protocol/LoadRevisionByVersionRequest.java7
-rw-r--r--plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/internal/cdo/net4j/protocol/LoadRevisionRequest.java26
-rw-r--r--plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/internal/cdo/net4j/protocol/LockObjectsRequest.java10
-rw-r--r--plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/internal/cdo/net4j/protocol/ObjectLockedRequest.java6
-rw-r--r--plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/internal/cdo/net4j/protocol/OpenSessionRequest.java94
-rw-r--r--plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/internal/cdo/net4j/protocol/QueryCancelRequest.java6
-rw-r--r--plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/internal/cdo/net4j/protocol/QueryRequest.java6
-rw-r--r--plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/internal/cdo/net4j/protocol/ResourceIDRequest.java14
-rw-r--r--plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/internal/cdo/net4j/protocol/SetAuditRequest.java26
-rw-r--r--plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/internal/cdo/net4j/protocol/SetPassiveUpdateRequest.java7
-rw-r--r--plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/internal/cdo/net4j/protocol/SyncRevisionsRequest.java12
-rw-r--r--plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/internal/cdo/net4j/protocol/UnlockObjectsRequest.java16
-rw-r--r--plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/internal/cdo/net4j/protocol/UnsubscribeRemoteSessionsRequest.java6
-rw-r--r--plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/internal/cdo/net4j/protocol/VerifyRevisionRequest.java18
-rw-r--r--plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/internal/cdo/query/CDOQueryImpl.java10
-rw-r--r--plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/internal/cdo/revision/CDOElementProxyImpl.java4
-rw-r--r--plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/internal/cdo/revision/CDOListWithElementProxiesImpl.java5
-rw-r--r--plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/internal/cdo/session/CDOCollectionLoadingPolicyImpl.java6
-rw-r--r--plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/internal/cdo/session/CDOPackageRegistryImpl.java446
-rw-r--r--plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/internal/cdo/session/CDOPackageTypeRegistryImpl.java269
-rw-r--r--plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/internal/cdo/session/CDORevisionManagerImpl.java16
-rw-r--r--plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/internal/cdo/session/CDOSessionConfigurationImpl.java19
-rw-r--r--plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/internal/cdo/session/CDOSessionImpl.java591
-rw-r--r--plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/internal/cdo/session/CDOSessionPackageManagerImpl.java171
-rw-r--r--plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/internal/cdo/session/SessionUtil.java57
-rw-r--r--plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/internal/cdo/transaction/CDOTransactionImpl.java84
-rw-r--r--plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/internal/cdo/transaction/CDOXACommitContextImpl.java6
-rw-r--r--plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/internal/cdo/util/FSMUtil.java12
-rw-r--r--plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/internal/cdo/util/GenUtil.java207
-rw-r--r--plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/internal/cdo/util/ModelUtil.java438
-rw-r--r--plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/internal/cdo/util/RevisionAdjuster.java11
-rw-r--r--plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/internal/cdo/view/CDOViewImpl.java54
-rw-r--r--plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/internal/cdo/view/CDOViewSetImpl.java29
-rw-r--r--plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/spi/cdo/AbstractObjectConflictResolver.java8
-rw-r--r--plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/spi/cdo/CDOElementProxy.java5
-rw-r--r--plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/spi/cdo/CDOSessionProtocol.java52
-rw-r--r--plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/spi/cdo/InternalCDOObject.java3
-rw-r--r--plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/spi/cdo/InternalCDORemoteSessionManager.java4
-rw-r--r--plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/spi/cdo/InternalCDOSession.java22
98 files changed, 1276 insertions, 3490 deletions
diff --git a/plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/cdo/CDOObject.java b/plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/cdo/CDOObject.java
index 59452e7cb9..dc1c6618f3 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
@@ -12,7 +12,6 @@ package org.eclipse.emf.cdo;
import org.eclipse.emf.cdo.common.id.CDOID;
import org.eclipse.emf.cdo.common.id.CDOIDTemp;
-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.view.CDOView;
@@ -44,14 +43,6 @@ public interface CDOObject extends EObject
public CDOID cdoID();
/**
- * Returns the immutable {@link CDOClass class} of this object. This method must only be called if this object is
- * properly associated with a {@link CDOView view}, i.e. if {@link #cdoView()} does not return <code>null</code> .
- *
- * @return Never <code>null</code>.
- */
- public CDOClass cdoClass();
-
- /**
* Returns the local {@link CDOState state} of this object.
*/
public CDOState cdoState();
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 f2b4b9292e..5105f5df69 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
@@ -43,6 +43,13 @@ import org.eclipse.core.runtime.IProgressMonitor;
public interface CDOResource extends CDOResourceNode, Resource
{
/**
+ * <!-- begin-user-doc --> <!-- end-user-doc -->
+ *
+ * @generated
+ */
+ String copyright = "Copyright (c) 2004 - 2009 Eike Stepper (Berlin, Germany) and others.\r\nAll rights reserved. This program and the accompanying materials\r\nare made available under the terms of the Eclipse Public License v1.0\r\nwhich accompanies this distribution, and is available at\r\nhttp://www.eclipse.org/legal/epl-v10.html\r\n\r\nContributors:\r\n Eike Stepper - initial API and implementation";
+
+ /**
* @ADDED
* @since 2.0
*/
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
index 9fdca62ee0..2fabd49262 100644
--- 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
@@ -30,6 +30,13 @@ import org.eclipse.emf.common.util.EList;
public interface CDOResourceFolder extends CDOResourceNode
{
/**
+ * <!-- begin-user-doc --> <!-- end-user-doc -->
+ *
+ * @generated
+ */
+ String copyright = "Copyright (c) 2004 - 2009 Eike Stepper (Berlin, Germany) and others.\r\nAll rights reserved. This program and the accompanying materials\r\nare made available under the terms of the Eclipse Public License v1.0\r\nwhich accompanies this distribution, and is available at\r\nhttp://www.eclipse.org/legal/epl-v10.html\r\n\r\nContributors:\r\n Eike Stepper - initial API and implementation";
+
+ /**
* 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 -->
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
index d72ea31141..3f731d76b0 100644
--- 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
@@ -32,6 +32,13 @@ import org.eclipse.emf.cdo.CDOObject;
public interface CDOResourceNode extends CDOObject
{
/**
+ * <!-- begin-user-doc --> <!-- end-user-doc -->
+ *
+ * @generated
+ */
+ String copyright = "Copyright (c) 2004 - 2009 Eike Stepper (Berlin, Germany) and others.\r\nAll rights reserved. This program and the accompanying materials\r\nare made available under the terms of the Eclipse Public License v1.0\r\nwhich accompanies this distribution, and is available at\r\nhttp://www.eclipse.org/legal/epl-v10.html\r\n\r\nContributors:\r\n Eike Stepper - initial API and implementation";
+
+ /**
* @ADDED
* @since 2.0
*/
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 03a306cf66..b67610dccd 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
@@ -22,6 +22,13 @@ import org.eclipse.emf.ecore.EFactory;
public interface EresourceFactory extends EFactory
{
/**
+ * <!-- begin-user-doc --> <!-- end-user-doc -->
+ *
+ * @generated
+ */
+ String copyright = "Copyright (c) 2004 - 2009 Eike Stepper (Berlin, Germany) and others.\r\nAll rights reserved. This program and the accompanying materials\r\nare made available under the terms of the Eclipse Public License v1.0\r\nwhich accompanies this distribution, and is available at\r\nhttp://www.eclipse.org/legal/epl-v10.html\r\n\r\nContributors:\r\n Eike Stepper - initial API and implementation";
+
+ /**
* The singleton instance of the factory. <!-- begin-user-doc --> <!-- end-user-doc -->
*
* @generated
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 6140166998..9dde53858a 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
@@ -33,6 +33,13 @@ import org.eclipse.emf.ecore.EReference;
public interface EresourcePackage extends EPackage
{
/**
+ * <!-- begin-user-doc --> <!-- end-user-doc -->
+ *
+ * @generated
+ */
+ String copyright = "Copyright (c) 2004 - 2009 Eike Stepper (Berlin, Germany) and others.\r\nAll rights reserved. This program and the accompanying materials\r\nare made available under the terms of the Eclipse Public License v1.0\r\nwhich accompanies this distribution, and is available at\r\nhttp://www.eclipse.org/legal/epl-v10.html\r\n\r\nContributors:\r\n Eike Stepper - initial API and implementation";
+
+ /**
* The package name. <!-- begin-user-doc --> <!-- end-user-doc -->
*
* @generated
@@ -44,7 +51,7 @@ public interface EresourcePackage extends EPackage
*
* @generated
*/
- String eNS_URI = "http://www.eclipse.org/emf/CDO/resource/2.0.0";
+ String eNS_URI = "http://www.eclipse.org/emf/CDO/Eresource/2.0.0";
/**
* The package namespace name. <!-- begin-user-doc --> <!-- end-user-doc -->
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
index d713966926..e07eb4735a 100644
--- 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
@@ -36,6 +36,13 @@ public class CDOResourceFolderImpl extends CDOResourceNodeImpl implements CDORes
*
* @generated
*/
+ public static final String copyright = "Copyright (c) 2004 - 2009 Eike Stepper (Berlin, Germany) and others.\r\nAll rights reserved. This program and the accompanying materials\r\nare made available under the terms of the Eclipse Public License v1.0\r\nwhich accompanies this distribution, and is available at\r\nhttp://www.eclipse.org/legal/epl-v10.html\r\n\r\nContributors:\r\n Eike Stepper - initial API and implementation";
+
+ /**
+ * <!-- begin-user-doc --> <!-- end-user-doc -->
+ *
+ * @generated
+ */
protected CDOResourceFolderImpl()
{
super();
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 afc3422dc6..47d38f5b7f 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.common.id.CDOID;
+import org.eclipse.emf.cdo.common.id.CDOIDObjectFactory;
import org.eclipse.emf.cdo.common.id.CDOIDUtil;
import org.eclipse.emf.cdo.eresource.CDOResource;
import org.eclipse.emf.cdo.eresource.EresourcePackage;
@@ -82,6 +83,13 @@ import java.util.Map;
*/
public class CDOResourceImpl extends CDOResourceNodeImpl implements CDOResource, Resource.Internal
{
+ /**
+ * <!-- begin-user-doc --> <!-- end-user-doc -->
+ *
+ * @generated
+ */
+ public static final String copyright = "Copyright (c) 2004 - 2009 Eike Stepper (Berlin, Germany) and others.\r\nAll rights reserved. This program and the accompanying materials\r\nare made available under the terms of the Eclipse Public License v1.0\r\nwhich accompanies this distribution, and is available at\r\nhttp://www.eclipse.org/legal/epl-v10.html\r\n\r\nContributors:\r\n Eike Stepper - initial API and implementation";
+
private static final EReference CDO_RESOURCE_CONTENTS = EresourcePackage.eINSTANCE.getCDOResource_Contents();
/**
@@ -511,7 +519,8 @@ public class CDOResourceImpl extends CDOResourceNodeImpl implements CDOResource,
return null;
}
- CDOID cdoID = CDOIDUtil.read(uriFragment, cdoView().getSession().getPackageManager().getCDOIDObjectFactory());
+ CDOIDObjectFactory cdoidObjectFactory = cdoView().getSession();
+ CDOID cdoID = CDOIDUtil.read(uriFragment, cdoidObjectFactory);
if (CDOIDUtil.isNull(cdoID) || cdoID.isTemporary() && !cdoView().isObjectRegistered(cdoID))
{
return null;
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
index eadc14498f..8f97dbbeff 100644
--- 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
@@ -47,6 +47,13 @@ public abstract class CDOResourceNodeImpl extends CDOObjectImpl implements CDORe
*
* @generated
*/
+ public static final String copyright = "Copyright (c) 2004 - 2009 Eike Stepper (Berlin, Germany) and others.\r\nAll rights reserved. This program and the accompanying materials\r\nare made available under the terms of the Eclipse Public License v1.0\r\nwhich accompanies this distribution, and is available at\r\nhttp://www.eclipse.org/legal/epl-v10.html\r\n\r\nContributors:\r\n Eike Stepper - initial API and implementation";
+
+ /**
+ * <!-- begin-user-doc --> <!-- end-user-doc -->
+ *
+ * @generated
+ */
protected CDOResourceNodeImpl()
{
super();
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 23738ff774..ad35ec04b4 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
@@ -31,6 +31,13 @@ import org.eclipse.emf.ecore.plugin.EcorePlugin;
public class EresourceFactoryImpl extends EFactoryImpl implements EresourceFactory
{
/**
+ * <!-- begin-user-doc --> <!-- end-user-doc -->
+ *
+ * @generated
+ */
+ public static final String copyright = "Copyright (c) 2004 - 2009 Eike Stepper (Berlin, Germany) and others.\r\nAll rights reserved. This program and the accompanying materials\r\nare made available under the terms of the Eclipse Public License v1.0\r\nwhich accompanies this distribution, and is available at\r\nhttp://www.eclipse.org/legal/epl-v10.html\r\n\r\nContributors:\r\n Eike Stepper - initial API and implementation";
+
+ /**
* Creates the default factory implementation. <!-- begin-user-doc --> <!-- end-user-doc -->
*
* @generated
@@ -40,7 +47,7 @@ public class EresourceFactoryImpl extends EFactoryImpl implements EresourceFacto
try
{
EresourceFactory theEresourceFactory = (EresourceFactory)EPackage.Registry.INSTANCE
- .getEFactory("http://www.eclipse.org/emf/CDO/resource/2.0.0");
+ .getEFactory("http://www.eclipse.org/emf/CDO/Eresource/2.0.0");
if (theEresourceFactory != null)
{
return theEresourceFactory;
@@ -74,9 +81,9 @@ public class EresourceFactoryImpl extends EFactoryImpl implements EresourceFacto
switch (eClass.getClassifierID())
{
case EresourcePackage.CDO_RESOURCE_FOLDER:
- return createCDOResourceFolder();
+ return (EObject)createCDOResourceFolder();
case EresourcePackage.CDO_RESOURCE:
- return createCDOResource();
+ return (EObject)createCDOResource();
default:
throw new IllegalArgumentException("The class '" + eClass.getName() + "' is not a valid classifier");
}
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 f9f0673191..3076394110 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
@@ -38,6 +38,13 @@ public class EresourcePackageImpl extends EPackageImpl implements EresourcePacka
*
* @generated
*/
+ public static final String copyright = "Copyright (c) 2004 - 2009 Eike Stepper (Berlin, Germany) and others.\r\nAll rights reserved. This program and the accompanying materials\r\nare made available under the terms of the Eclipse Public License v1.0\r\nwhich accompanies this distribution, and is available at\r\nhttp://www.eclipse.org/legal/epl-v10.html\r\n\r\nContributors:\r\n Eike Stepper - initial API and implementation";
+
+ /**
+ * <!-- begin-user-doc --> <!-- end-user-doc -->
+ *
+ * @generated
+ */
private EClass cdoResourceNodeEClass = null;
/**
@@ -121,9 +128,7 @@ public class EresourcePackageImpl extends EPackageImpl implements EresourcePacka
public static EresourcePackage init()
{
if (isInited)
- {
return (EresourcePackage)EPackage.Registry.INSTANCE.getEPackage(EresourcePackage.eNS_URI);
- }
// Obtain or create and register package
EresourcePackageImpl theEresourcePackage = (EresourcePackageImpl)(EPackage.Registry.INSTANCE.getEPackage(eNS_URI) instanceof EresourcePackageImpl ? EPackage.Registry.INSTANCE
@@ -369,9 +374,7 @@ public class EresourcePackageImpl extends EPackageImpl implements EresourcePacka
public void createPackageContents()
{
if (isCreated)
- {
return;
- }
isCreated = true;
// Create classes and their features
@@ -416,9 +419,7 @@ public class EresourcePackageImpl extends EPackageImpl implements EresourcePacka
public void initializePackageContents()
{
if (isInitialized)
- {
return;
- }
isInitialized = true;
// Initialize package
@@ -434,15 +435,15 @@ public class EresourcePackageImpl extends EPackageImpl implements EresourcePacka
// Set bounds for type parameters
// Add supertypes to classes
- cdoResourceFolderEClass.getESuperTypes().add(getCDOResourceNode());
- cdoResourceEClass.getESuperTypes().add(getCDOResourceNode());
+ cdoResourceFolderEClass.getESuperTypes().add(this.getCDOResourceNode());
+ cdoResourceEClass.getESuperTypes().add(this.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);
+ initEReference(getCDOResourceNode_Folder(), this.getCDOResourceFolder(), this.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,
@@ -450,16 +451,16 @@ public class EresourcePackageImpl extends EPackageImpl implements EresourcePacka
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);
+ initEReference(getCDOResourceFolder_Nodes(), this.getCDOResourceNode(), this.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,
+ initEAttribute(getCDOResource_ResourceSet(), this.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(), this.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);
@@ -470,9 +471,9 @@ public class EresourcePackageImpl extends EPackageImpl implements EresourcePacka
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);
- initEAttribute(getCDOResource_Warnings(), getDiagnostic(), "warnings", null, 0, -1, CDOResource.class,
+ initEAttribute(getCDOResource_Errors(), this.getDiagnostic(), "errors", null, 0, -1, CDOResource.class,
+ IS_TRANSIENT, IS_VOLATILE, !IS_CHANGEABLE, !IS_UNSETTABLE, !IS_ID, IS_UNIQUE, IS_DERIVED, IS_ORDERED);
+ initEAttribute(getCDOResource_Warnings(), this.getDiagnostic(), "warnings", null, 0, -1, CDOResource.class,
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);
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 bcaaedd8ee..b7bc30df6e 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
@@ -30,6 +30,13 @@ import org.eclipse.emf.ecore.EObject;
public class EresourceAdapterFactory extends AdapterFactoryImpl
{
/**
+ * <!-- begin-user-doc --> <!-- end-user-doc -->
+ *
+ * @generated
+ */
+ public static final String copyright = "Copyright (c) 2004 - 2009 Eike Stepper (Berlin, Germany) and others.\r\nAll rights reserved. This program and the accompanying materials\r\nare made available under the terms of the Eclipse Public License v1.0\r\nwhich accompanies this distribution, and is available at\r\nhttp://www.eclipse.org/legal/epl-v10.html\r\n\r\nContributors:\r\n Eike Stepper - initial API and implementation";
+
+ /**
* The cached model package. <!-- begin-user-doc --> <!-- end-user-doc -->
*
* @generated
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 9bcd26876f..ef766ec6c1 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
@@ -32,6 +32,13 @@ import java.util.List;
public class EresourceSwitch<T>
{
/**
+ * <!-- begin-user-doc --> <!-- end-user-doc -->
+ *
+ * @generated
+ */
+ public static final String copyright = "Copyright (c) 2004 - 2009 Eike Stepper (Berlin, Germany) and others.\r\nAll rights reserved. This program and the accompanying materials\r\nare made available under the terms of the Eclipse Public License v1.0\r\nwhich accompanies this distribution, and is available at\r\nhttp://www.eclipse.org/legal/epl-v10.html\r\n\r\nContributors:\r\n Eike Stepper - initial API and implementation";
+
+ /**
* The cached model package <!-- begin-user-doc --> <!-- end-user-doc -->
*
* @generated
@@ -99,9 +106,7 @@ public class EresourceSwitch<T>
CDOResourceNode cdoResourceNode = (CDOResourceNode)theEObject;
T result = caseCDOResourceNode(cdoResourceNode);
if (result == null)
- {
result = defaultCase(theEObject);
- }
return result;
}
case EresourcePackage.CDO_RESOURCE_FOLDER:
@@ -109,13 +114,9 @@ public class EresourceSwitch<T>
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:
@@ -123,13 +124,9 @@ public class EresourceSwitch<T>
CDOResource cdoResource = (CDOResource)theEObject;
T result = caseCDOResource(cdoResource);
if (result == null)
- {
result = caseCDOResourceNode(cdoResource);
- }
if (result == null)
- {
result = defaultCase(theEObject);
- }
return result;
}
default:
diff --git a/plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/cdo/session/CDOCollectionLoadingPolicy.java b/plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/cdo/session/CDOCollectionLoadingPolicy.java
index ba2ff3f645..bad1db2911 100644
--- a/plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/cdo/session/CDOCollectionLoadingPolicy.java
+++ b/plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/cdo/session/CDOCollectionLoadingPolicy.java
@@ -12,9 +12,10 @@
package org.eclipse.emf.cdo.session;
import org.eclipse.emf.cdo.common.id.CDOID;
-import org.eclipse.emf.cdo.common.model.CDOFeature;
import org.eclipse.emf.cdo.common.revision.CDORevision;
+import org.eclipse.emf.ecore.EStructuralFeature;
+
/**
* A strategy that specifies which list elememts must be present (loaded) in a {@link CDOID} list of a
* {@link CDORevision revision} when a certain list index is accessed. Implementations of this interface can control the
@@ -39,7 +40,7 @@ public interface CDOCollectionLoadingPolicy
return CDORevision.UNCHUNKED;
}
- public Object resolveProxy(CDORevisionManager revisionManager, CDORevision revision, CDOFeature feature,
+ public Object resolveProxy(CDORevisionManager revisionManager, CDORevision revision, EStructuralFeature feature,
int accessIndex, int serverIndex)
{
return revisionManager.loadChunkByRange(revision, feature, accessIndex, serverIndex, accessIndex, accessIndex);
@@ -54,9 +55,9 @@ public interface CDOCollectionLoadingPolicy
/**
* Defines a strategy to be used when the collection needs to resolve one element.
- * {@link CDORevisionManager#loadChunkByRange(CDORevision, CDOFeature, int, int, int, int)} should be used to resolve
- * them.
+ * {@link CDORevisionManager#loadChunkByRange(CDORevision, EStructuralFeature, int, int, int, int)} should be used to
+ * resolve them.
*/
- public Object resolveProxy(CDORevisionManager revisionManager, CDORevision revision, CDOFeature feature,
+ public Object resolveProxy(CDORevisionManager revisionManager, CDORevision revision, EStructuralFeature feature,
int accessIndex, int serverIndex);
}
diff --git a/plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/cdo/session/CDOPackageRegistry.java b/plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/cdo/session/CDOPackageRegistry.java
deleted file mode 100644
index ed65a896d9..0000000000
--- a/plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/cdo/session/CDOPackageRegistry.java
+++ /dev/null
@@ -1,39 +0,0 @@
-/**
- * Copyright (c) 2004 - 2009 Eike Stepper (Berlin, Germany) and others.
- * 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.session;
-
-import org.eclipse.emf.cdo.common.model.CDOPackage;
-
-import org.eclipse.emf.ecore.EPackage;
-
-/**
- * @author Eike Stepper
- * @since 2.0
- */
-public interface CDOPackageRegistry extends EPackage.Registry
-{
- /**
- * Registers a top level {@link EPackage} <b>and</b> its sub packages with this package registry.
- *
- * @param ePackage
- * a top level EPackage (i.e. a package with <code>eSuperPackage == null</code>).
- * @return the package that is registered under the <code>nsURI</code> of the top level package or <code>null</code>.
- * @throws IllegalArgumentException
- * if the given EPackage is not a top level package.
- */
- public EPackage putEPackage(EPackage ePackage) throws IllegalArgumentException;
-
- public void putPackageDescriptor(CDOPackage proxy);
-
- public CDOSession getSession();
-
- public void setSession(CDOSession session);
-}
diff --git a/plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/cdo/session/CDOPackageType.java b/plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/cdo/session/CDOPackageType.java
deleted file mode 100644
index ad0d58da8e..0000000000
--- a/plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/cdo/session/CDOPackageType.java
+++ /dev/null
@@ -1,33 +0,0 @@
-/**
- * Copyright (c) 2004 - 2009 Eike Stepper (Berlin, Germany) and others.
- * 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.session;
-
-import org.eclipse.emf.internal.cdo.CDOObjectImpl;
-import org.eclipse.emf.internal.cdo.CDOStateMachine;
-
-/**
- * @author Eike Stepper
- * @since 2.0
- */
-public enum CDOPackageType
-{
- /**
- * The type of <code>EPackages</code> that have been dedicatedly generated for CDO. Instances of <code>EClasses</code>
- * of these packages are represented by {@link CDOObjectImpl} to the {@link CDOStateMachine}.
- */
- NATIVE,
-
- /**
- * The type of <code>EPackages</code> that have been normally generated for EMF. Instances of <code>EClasses</code> of
- * these packages are represented by {@link CDOAdapterImpl} to the {@link CDOStateMachine}.
- */
- LEGACY
-}
diff --git a/plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/cdo/session/CDOPackageTypeRegistry.java b/plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/cdo/session/CDOPackageTypeRegistry.java
deleted file mode 100644
index 852d38b42a..0000000000
--- a/plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/cdo/session/CDOPackageTypeRegistry.java
+++ /dev/null
@@ -1,33 +0,0 @@
-/**
- * Copyright (c) 2004 - 2009 Eike Stepper (Berlin, Germany) and others.
- * 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.session;
-
-import org.eclipse.net4j.util.registry.IRegistry;
-
-import org.eclipse.emf.ecore.EPackage;
-
-/**
- * Can only be used with Eclipse running!
- *
- * @author Eike Stepper
- * @noimplement This interface is not intended to be implemented by clients.
- * @since 2.0
- */
-public interface CDOPackageTypeRegistry extends IRegistry<String, CDOPackageType>
-{
- public static final CDOPackageTypeRegistry INSTANCE = org.eclipse.emf.internal.cdo.session.CDOPackageTypeRegistryImpl.INSTANCE;
-
- public void register(EPackage ePackage);
-
- public void registerLegacy(String packageURI);
-
- public void registerNative(String packageURI);
-}
diff --git a/plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/cdo/session/CDORevisionManager.java b/plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/cdo/session/CDORevisionManager.java
index db195b3a6a..3262850dc7 100644
--- a/plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/cdo/session/CDORevisionManager.java
+++ b/plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/cdo/session/CDORevisionManager.java
@@ -11,10 +11,11 @@
*/
package org.eclipse.emf.cdo.session;
-import org.eclipse.emf.cdo.common.model.CDOFeature;
import org.eclipse.emf.cdo.common.revision.CDORevision;
import org.eclipse.emf.cdo.common.revision.CDORevisionResolver;
+import org.eclipse.emf.ecore.EStructuralFeature;
+
/**
* @author Eike Stepper
* @noimplement This interface is not intended to be implemented by clients.
@@ -36,6 +37,6 @@ public interface CDORevisionManager extends CDORevisionResolver
* @param toIndex
* Load objects at the client to toIndex (inclusive)
*/
- public Object loadChunkByRange(CDORevision revision, CDOFeature feature, int accessIndex, int fetchIndex,
+ public Object loadChunkByRange(CDORevision revision, EStructuralFeature feature, int accessIndex, int fetchIndex,
int fromIndex, int toIndex);
}
diff --git a/plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/cdo/session/CDOSession.java b/plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/cdo/session/CDOSession.java
index 846ef66c4d..2675b583e5 100644
--- a/plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/cdo/session/CDOSession.java
+++ b/plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/cdo/session/CDOSession.java
@@ -13,7 +13,8 @@
package org.eclipse.emf.cdo.session;
import org.eclipse.emf.cdo.common.CDOCommonSession;
-import org.eclipse.emf.cdo.common.model.CDOPackage;
+import org.eclipse.emf.cdo.common.model.CDOPackageRegistry;
+import org.eclipse.emf.cdo.common.model.CDOPackageUnit;
import org.eclipse.emf.cdo.common.revision.CDORevision;
import org.eclipse.emf.cdo.common.revision.CDORevisionFactory;
import org.eclipse.emf.cdo.session.remote.CDORemoteSessionManager;
@@ -39,9 +40,8 @@ import java.util.Collection;
* A session has the following responsibilities:
* <ul>
* <li> {@link CDOSession#repository() Repository information}
- * <li> {@link CDOSession#getProtocol() Connection management}
- * <li> {@link CDOSession#getPackageRegistry() Package management}
- * <li> {@link CDOSession#getPackageManager() Package information}
+ * <li> {@link CDOSession#getPackageRegistry() Package registry}
+ * <li> {@link CDOSession#getPackageUnitManager() Package unit management}
* <li> {@link CDOSession#getRevisionManager() Data management}
* <li> {@link CDOSession#getViews() View management}
* </ul>
@@ -59,23 +59,16 @@ public interface CDOSession extends CDOCommonSession, IContainer<CDOView>, IOpti
* Returns the EMF {@link EPackage.Registry package registry} that is used by all {@link EObject objects} of all
* {@link CDOView views} of this session.
* <p>
- * This registry is managed by the {@link CDOSessionPackageManager package manager} of this session. All
- * {@link EPackage packages} that are already persisted in the repository of this session are automatically registered
- * with this registry. New packages can be locally registered with this registry and are committed to the repository
- * through a {@link CDOTransaction transaction} if needed.
+ * This registry is managed by the {@link CDOPackageUnit package unit manager} of this session. All {@link EPackage
+ * packages} that are already persisted in the repository of this session are automatically registered with this
+ * registry. New packages can be locally registered with this registry and are committed to the repository through a
+ * {@link CDOTransaction transaction}, if needed.
*
- * @see #getPackageManager()
+ * @see #getPackageUnitManager()
*/
public CDOPackageRegistry getPackageRegistry();
/**
- * Returns the CDO {@link CDOSessionPackageManager package manager} that represents the CDO {@link CDOPackage
- * packages} currently stored in the repository of this session. The package manager can be used to query information
- * about the packages in the repository as well as convert between the EMF and CDO instances of these packages.
- */
- public CDOSessionPackageManager getPackageManager();
-
- /**
* Returns the CDO {@link CDORevisionManager revision manager} that manages the {@link CDORevision revisions} of the
* repository of this session.
*/
@@ -170,6 +163,11 @@ public interface CDOSession extends CDOCommonSession, IContainer<CDOView>, IOpti
*/
public interface Options extends CDOCommonSession.Options
{
+
+ public boolean isGeneratedPackageEmulationEnabled();
+
+ public void setGeneratedPackageEmulationEnabled(boolean generatedPackageEmulationEnabled);
+
/**
* Specifies whether objects will be invalidated due by other users changes.
* <p>
@@ -221,14 +219,30 @@ public interface CDOSession extends CDOCommonSession, IContainer<CDOView>, IOpti
*/
public void setRevisionFactory(CDORevisionFactory factory);
+ /**
+ * @author Eike Stepper
+ */
+ public interface GeneratedPackageEmulationEvent extends IOptionsEvent, CDOEvent
+ {
+ }
+
+ /**
+ * @author Eike Stepper
+ */
public interface PassiveUpdateEvent extends IOptionsEvent, CDOEvent
{
}
+ /**
+ * @author Eike Stepper
+ */
public interface CollectionLoadingPolicyEvent extends IOptionsEvent, CDOEvent
{
}
+ /**
+ * @author Eike Stepper
+ */
public interface RevisionFactoryEvent extends IOptionsEvent, CDOEvent
{
}
diff --git a/plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/cdo/session/CDOSessionConfiguration.java b/plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/cdo/session/CDOSessionConfiguration.java
index d08f62cf77..e1237c4342 100644
--- a/plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/cdo/session/CDOSessionConfiguration.java
+++ b/plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/cdo/session/CDOSessionConfiguration.java
@@ -10,6 +10,7 @@
*/
package org.eclipse.emf.cdo.session;
+import org.eclipse.emf.cdo.common.model.CDOPackageRegistry;
import org.eclipse.emf.cdo.common.revision.cache.CDORevisionCache;
import org.eclipse.emf.internal.cdo.session.CDORevisionManagerImpl;
@@ -44,20 +45,6 @@ public interface CDOSessionConfiguration
public void setPackageRegistry(CDOPackageRegistry packageRegistry);
/**
- * The package registry must be set <b>before</b> the session is opened and can not be changed thereafter.
- *
- * @see CDOSession#getPackageRegistry()
- */
- public void setEagerPackageRegistry();
-
- /**
- * The package registry must be set <b>before</b> the session is opened and can not be changed thereafter.
- *
- * @see CDOSession#getPackageRegistry()
- */
- public void setLazyPackageRegistry();
-
- /**
* @see CDORevisionManagerImpl#getCache()
*/
public CDORevisionCache getRevisionCache();
diff --git a/plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/cdo/session/CDOSessionPackageManager.java b/plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/cdo/session/CDOSessionPackageManager.java
deleted file mode 100644
index 46d2686ced..0000000000
--- a/plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/cdo/session/CDOSessionPackageManager.java
+++ /dev/null
@@ -1,67 +0,0 @@
-/**
- * Copyright (c) 2004 - 2009 Eike Stepper (Berlin, Germany) and others.
- * 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.session;
-
-import org.eclipse.emf.cdo.common.model.CDOClass;
-import org.eclipse.emf.cdo.common.model.CDOFeature;
-import org.eclipse.emf.cdo.common.model.CDOPackage;
-import org.eclipse.emf.cdo.common.model.CDOPackageManager;
-
-import org.eclipse.emf.ecore.EClass;
-import org.eclipse.emf.ecore.EPackage;
-import org.eclipse.emf.ecore.EStructuralFeature;
-
-/**
- * Represents the CDO {@link CDOPackage packages} currently stored in the {@link CDOSession.Repository repository} of a
- * {@link CDOSession session}. A package manager can be used to query information about the CDO {@link CDOPackage
- * packages} in the repository as well as convert between the EMF and CDO instances of these packages.
- *
- * @author Eike Stepper
- * @noimplement This interface is not intended to be implemented by clients.
- * @since 2.0
- */
-public interface CDOSessionPackageManager extends CDOPackageManager
-{
- /**
- * Returns the session this package manager is associated with.
- */
- public CDOSession getSession();
-
- /**
- * Returns the CDO instance of the given EMF package.
- */
- public CDOPackage convert(EPackage ePackage);
-
- /**
- * Returns the CDO instance of the given EMF class.
- */
- public CDOClass convert(EClass eClass);
-
- /**
- * Returns the CDO instance of the given EMF feature.
- */
- public CDOFeature convert(EStructuralFeature eFeature);
-
- /**
- * Returns the EMF instance of the given CDO package.
- */
- public EPackage convert(CDOPackage cdoPackage);
-
- /**
- * Returns the EMF instance of the given CDO class.
- */
- public EClass convert(CDOClass cdoClass);
-
- /**
- * Returns the EMF instance of the given CDO feature.
- */
- public EStructuralFeature convert(CDOFeature cdoFeature);
-}
diff --git a/plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/cdo/transaction/CDOCommitContext.java b/plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/cdo/transaction/CDOCommitContext.java
index 7aaabeed89..bcaf0be3ea 100644
--- a/plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/cdo/transaction/CDOCommitContext.java
+++ b/plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/cdo/transaction/CDOCommitContext.java
@@ -13,7 +13,7 @@ package org.eclipse.emf.cdo.transaction;
import org.eclipse.emf.cdo.CDOObject;
import org.eclipse.emf.cdo.common.id.CDOID;
-import org.eclipse.emf.cdo.common.model.CDOPackage;
+import org.eclipse.emf.cdo.common.model.CDOPackageUnit;
import org.eclipse.emf.cdo.common.revision.delta.CDORevisionDelta;
import org.eclipse.emf.cdo.eresource.CDOResource;
@@ -34,9 +34,9 @@ public interface CDOCommitContext
public CDOTransaction getTransaction();
/**
- * Returns a list of the new {@link CDOPackage packages} that are to be committed with this commit context.
+ * Returns a list of the new {@link CDOPackageUnit package units} that are to be committed with this commit context.
*/
- public List<CDOPackage> getNewPackages();
+ public List<CDOPackageUnit> getNewPackageUnits();
/**
* Returns a map of the new {@link CDOResource resources} that are to be committed with this commit context.
diff --git a/plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/cdo/transaction/CDOTransaction.java b/plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/cdo/transaction/CDOTransaction.java
index 1e4e6c2647..79d0ae5f58 100644
--- a/plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/cdo/transaction/CDOTransaction.java
+++ b/plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/cdo/transaction/CDOTransaction.java
@@ -16,7 +16,6 @@ package org.eclipse.emf.cdo.transaction;
import org.eclipse.emf.cdo.CDOObject;
import org.eclipse.emf.cdo.common.id.CDOID;
-import org.eclipse.emf.cdo.common.model.CDOClass;
import org.eclipse.emf.cdo.common.revision.delta.CDORevisionDelta;
import org.eclipse.emf.cdo.eresource.CDOResource;
import org.eclipse.emf.cdo.util.CDOEvent;
@@ -25,7 +24,6 @@ import org.eclipse.emf.cdo.view.CDOView;
import org.eclipse.net4j.util.options.IOptionsEvent;
import org.eclipse.emf.common.util.URI;
-import org.eclipse.emf.ecore.EClass;
import org.eclipse.emf.ecore.resource.ResourceSet;
import java.util.Map;
@@ -65,10 +63,6 @@ public interface CDOTransaction extends CDOView, CDOUserTransaction
public CDOResource getOrCreateResource(String path);
- public CDOObject newInstance(EClass eClass);
-
- public CDOObject newInstance(CDOClass cdoClass);
-
public void addHandler(CDOTransactionHandler handler);
public void removeHandler(CDOTransactionHandler handler);
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 72c33e6335..7f780db20a 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
@@ -18,7 +18,6 @@ import org.eclipse.emf.cdo.eresource.CDOResource;
import org.eclipse.emf.cdo.net4j.CDONet4jUtil;
import org.eclipse.emf.cdo.net4j.CDOSessionConfiguration;
import org.eclipse.emf.cdo.session.CDOCollectionLoadingPolicy;
-import org.eclipse.emf.cdo.session.CDOPackageRegistry;
import org.eclipse.emf.cdo.session.CDOSession;
import org.eclipse.emf.cdo.transaction.CDOTransaction;
import org.eclipse.emf.cdo.transaction.CDOXATransaction;
@@ -28,7 +27,6 @@ import org.eclipse.emf.cdo.view.CDOViewSet;
import org.eclipse.emf.internal.cdo.CDOStateMachine;
import org.eclipse.emf.internal.cdo.session.CDOCollectionLoadingPolicyImpl;
-import org.eclipse.emf.internal.cdo.session.CDOPackageRegistryImpl;
import org.eclipse.emf.internal.cdo.transaction.CDOXATransactionImpl;
import org.eclipse.emf.internal.cdo.util.FSMUtil;
import org.eclipse.emf.internal.cdo.view.CDORevisionPrefetchingPolicyImpl;
@@ -106,22 +104,6 @@ public final class CDOUtil
/**
* @since 2.0
*/
- public static CDOPackageRegistry createEagerPackageRegistry()
- {
- return new CDOPackageRegistryImpl.Eager();
- }
-
- /**
- * @since 2.0
- */
- public static CDOPackageRegistry createLazyPackageRegistry()
- {
- return new CDOPackageRegistryImpl.Lazy();
- }
-
- /**
- * @since 2.0
- */
public static CDOXATransaction createXATransaction(CDOViewSet viewSet)
{
CDOXATransaction xaTransaction = new CDOXATransactionImpl();
diff --git a/plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/cdo/util/EMFUtil.java b/plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/cdo/util/EMFUtil.java
deleted file mode 100644
index 4b0c3f82e1..0000000000
--- a/plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/cdo/util/EMFUtil.java
+++ /dev/null
@@ -1,378 +0,0 @@
-/**
- * Copyright (c) 2004 - 2009 Eike Stepper (Berlin, Germany) and others.
- * 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
- * Victor Roldan Betancort - http://bugs.eclipse.org/244801
- * Simon McDuff - maintenance
- */
-package org.eclipse.emf.cdo.util;
-
-import org.eclipse.emf.internal.cdo.CDOFactoryImpl;
-
-import org.eclipse.net4j.util.io.IORuntimeException;
-
-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.EAttribute;
-import org.eclipse.emf.ecore.EClass;
-import org.eclipse.emf.ecore.EClassifier;
-import org.eclipse.emf.ecore.EObject;
-import org.eclipse.emf.ecore.EPackage;
-import org.eclipse.emf.ecore.EReference;
-import org.eclipse.emf.ecore.EStructuralFeature;
-import org.eclipse.emf.ecore.EcoreFactory;
-import org.eclipse.emf.ecore.EcorePackage;
-import org.eclipse.emf.ecore.EPackage.Registry;
-import org.eclipse.emf.ecore.impl.EPackageImpl;
-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 org.eclipse.emf.ecore.xmi.XMIResource;
-import org.eclipse.emf.ecore.xmi.impl.EcoreResourceFactoryImpl;
-import org.eclipse.emf.ecore.xmi.impl.XMIResourceFactoryImpl;
-import org.eclipse.emf.ecore.xmi.impl.XMIResourceImpl;
-
-import java.io.ByteArrayInputStream;
-import java.io.ByteArrayOutputStream;
-import java.io.IOException;
-import java.util.ArrayList;
-import java.util.Collections;
-import java.util.List;
-
-/**
- * @author Eike Stepper
- * @since 2.0
- */
-public final class EMFUtil
-{
- private static final String ECORE_ENCODING = "ASCII";
-
- private EMFUtil()
- {
- }
-
- /**
- * @since 2.0
- */
- public static EPackage createEPackage(String name, String nsPrefix, String nsURI)
- {
- EPackage ePackage = EcoreFactory.eINSTANCE.createEPackage();
- ePackage.setName(name);
- ePackage.setNsPrefix(nsPrefix);
- ePackage.setNsURI(nsURI);
- return ePackage;
- }
-
- /**
- * @since 2.0
- */
- public static EClass createEClass(EPackage ePackage, String name, boolean isAbstract, boolean isInterface)
- {
- EClass eClass = EcoreFactory.eINSTANCE.createEClass();
- eClass.setName(name);
- eClass.setAbstract(isAbstract);
- eClass.setInterface(isInterface);
- ePackage.getEClassifiers().add(eClass);
- return eClass;
- }
-
- /**
- * @since 2.0
- */
- public static EAttribute createEAttribute(EClass eClass, String name, EClassifier type)
- {
- EAttribute eAttribute = EcoreFactory.eINSTANCE.createEAttribute();
- eAttribute.setName(name);
- eAttribute.setEType(type);
- eClass.getEStructuralFeatures().add(eAttribute);
- return eAttribute;
- }
-
- /**
- * @since 2.0
- */
- public static EReference createEReference(EClass eClass, String name, EClassifier type, boolean isRequired,
- boolean isMany)
- {
- EReference eReference = EcoreFactory.eINSTANCE.createEReference();
- eReference.setName(name);
- eReference.setEType(type);
- eReference.setLowerBound(isRequired ? 1 : 0);
- eReference.setUpperBound(isMany ? -1 : 0);
- eClass.getEStructuralFeatures().add(eReference);
- return eReference;
- }
-
- public static ResourceSet newResourceSet(Resource.Factory resourceFactory)
- {
- ResourceSet resourceSet = new ResourceSetImpl();
- resourceSet.getResourceFactoryRegistry().getExtensionToFactoryMap().put("*", resourceFactory);
- return resourceSet;
- }
-
- public static ResourceSet newXMIResourceSet(EPackage... ePackages)
- {
- ResourceSet resourceSet = newResourceSet(new XMIResourceFactoryImpl());
- if (ePackages != null && ePackages.length != 0)
- {
- Registry packageRegistry = resourceSet.getPackageRegistry();
- for (EPackage ePackage : ePackages)
- {
- packageRegistry.put(ePackage.getNsURI(), ePackage);
- }
- }
-
- return resourceSet;
- }
-
- public static ResourceSet newEcoreResourceSet(EPackage.Registry packageRegistry)
- {
- ResourceSet resourceSet = newResourceSet(new EcoreResourceFactoryImpl());
- resourceSet.setPackageRegistry(packageRegistry);
- return resourceSet;
- }
-
- public static ResourceSet newEcoreResourceSet()
- {
- return newEcoreResourceSet(EPackage.Registry.INSTANCE);
- }
-
- public static EObject load(String fileName, ResourceSet resourceSet)
- {
- Resource resource = resourceSet.getResource(URI.createFileURI(fileName), true);
- return resource.getContents().get(0);
- }
-
- public static EObject loadXMI(String fileName, EPackage... ePackages)
- {
- ResourceSet resourceSet = newXMIResourceSet(ePackages);
- return load(fileName, resourceSet);
- }
-
- public static EObject loadXMI(String fileName, EPackage.Registry packageRegistry)
- {
- ResourceSet resourceSet = newXMIResourceSet();
- resourceSet.setPackageRegistry(packageRegistry);
- return load(fileName, resourceSet);
- }
-
- public static EObject loadEcore(String fileName, EPackage.Registry packageRegistry)
- {
- return load(fileName, newEcoreResourceSet(packageRegistry));
- }
-
- public static EObject loadEcore(String fileName)
- {
- return load(fileName, newEcoreResourceSet());
- }
-
- public static void save(String fileName, EObject root, ResourceSet resourceSet)
- {
- save(fileName, Collections.singletonList(root), resourceSet);
- }
-
- public static void save(String fileName, List<EObject> roots, ResourceSet resourceSet)
- {
- URI uri = URI.createURI(fileName);
- Resource resource = resourceSet.createResource(uri);
- for (EObject root : roots)
- {
- EObject copy = EcoreUtil.copy(root);
- resource.getContents().add(copy);
- }
-
- try
- {
- resource.save(null);
- }
- catch (IOException ex)
- {
- throw new IORuntimeException(ex);
- }
- }
-
- public static void saveXMI(String fileName, EObject root)
- {
- save(fileName, root, newXMIResourceSet());
- }
-
- public static void saveXMI(String fileName, List<EObject> roots)
- {
- save(fileName, roots, newXMIResourceSet());
- }
-
- public static void saveEcore(String fileName, EObject root)
- {
- save(fileName, root, newEcoreResourceSet());
- }
-
- public static int countAllContents(EObject eObject)
- {
- int count = 0;
- for (TreeIterator<EObject> it = eObject.eAllContents(); it.hasNext(); it.next())
- {
- ++count;
- }
-
- return count;
- }
-
- public static List<EClass> getPersistentClasses(EPackage ePackage)
- {
- List<EClass> result = new ArrayList<EClass>();
- for (EClassifier classifier : ePackage.getEClassifiers())
- {
- if (classifier instanceof EClass)
- {
- result.add((EClass)classifier);
- }
- }
-
- return result;
- }
-
- public static List<EStructuralFeature> getPersistentFeatures(EList<EStructuralFeature> eFeatures)
- {
- List<EStructuralFeature> result = new ArrayList<EStructuralFeature>();
- for (EStructuralFeature feature : eFeatures)
- {
- if (feature.isTransient())
- {
- continue;
- }
-
- // TODO Make configurable via ExtPoint
- if (feature == EcorePackage.eINSTANCE.getEClass_ESuperTypes())
- {
- // See
- // http://www.eclipse.org/newsportal/article.php?id=26780&group=eclipse.tools.emf#26780
- continue;
- }
-
- if (feature == EcorePackage.eINSTANCE.getETypedElement_EType())
- {
- // See
- // http://www.eclipse.org/newsportal/article.php?id=26780&group=eclipse.tools.emf#26780
- continue;
- }
-
- if (feature == EcorePackage.eINSTANCE.getEOperation_EExceptions())
- {
- // See
- // http://www.eclipse.org/newsportal/article.php?id=26780&group=eclipse.tools.emf#26780
- continue;
- }
-
- result.add(feature);
- }
-
- return result;
- }
-
- public static boolean isDynamicEPackage(Object value)
- {
- return value.getClass() == EPackageImpl.class;
- }
-
- /**
- * @since 2.0
- */
- public static boolean prepareDynamicEPackage(EPackage ePackage)
- {
- if (isDynamicEPackage(ePackage))
- {
- ePackage.setEFactoryInstance(new CDOFactoryImpl(ePackage));
- return true;
- }
-
- return false;
- }
-
- public static boolean isMany(EStructuralFeature eFeature)
- {
- return eFeature.isMany();
- }
-
- public static boolean isReference(EStructuralFeature eFeature)
- {
- return eFeature instanceof EReference;
- }
-
- public static boolean isContainment(EStructuralFeature eFeature)
- {
- if (isReference(eFeature))
- {
- EReference ref = (EReference)eFeature;
- return ref.isContainment();
- }
-
- return false;
- }
-
- public static EPackage ePackageFromString(String ecore)
- {
- try
- {
- ByteArrayInputStream stream = new ByteArrayInputStream(ecore.getBytes(ECORE_ENCODING));
- XMIResource resource = new XMIResourceImpl();
- resource.load(stream, null);
- return (EPackage)resource.getContents().get(0);
- }
- catch (RuntimeException ex)
- {
- throw ex;
- }
- catch (IOException ex)
- {
- throw new IORuntimeException(ex);
- }
- }
-
- public static String ePackageToString(EPackage ePackage, EPackage.Registry packageRegistry)
- {
- synchronized (EMFUtil.class)
- {
- ePackage = (EPackage)EcoreUtil.copy(ePackage);
- }
-
- Resource.Factory resourceFactory = new XMIResourceFactoryImpl();
- ResourceSetImpl resourceSet = new ResourceSetImpl();
-
- Resource.Factory.Registry registry = resourceSet.getResourceFactoryRegistry();
- registry.getExtensionToFactoryMap().put("*", resourceFactory);
- registry.getProtocolToFactoryMap().put("*", resourceFactory);
-
- Resource packageResource = createPackageResource(resourceSet, ePackage);
- ByteArrayOutputStream stream = new ByteArrayOutputStream();
-
- try
- {
- packageResource.save(stream, null);
- String string = stream.toString(ECORE_ENCODING);
- return string;
- }
- catch (RuntimeException ex)
- {
- throw ex;
- }
- catch (IOException ex)
- {
- throw new IORuntimeException(ex);
- }
- }
-
- private static Resource createPackageResource(ResourceSetImpl resourceSet, EPackage ePackage)
- {
- URI uri = URI.createURI(ePackage.getNsURI());
- Resource resource = resourceSet.createResource(uri);
- resource.getContents().add(ePackage);
- return resource;
- }
-}
diff --git a/plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/cdo/util/ModelUtil.java b/plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/cdo/util/ModelUtil.java
new file mode 100644
index 0000000000..4576208598
--- /dev/null
+++ b/plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/cdo/util/ModelUtil.java
@@ -0,0 +1,58 @@
+/**
+ * Copyright (c) 2004 - 2009 Eike Stepper (Berlin, Germany) and others.
+ * 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
+ * Simon McDuff - maintenance
+ */
+package org.eclipse.emf.cdo.util;
+
+import org.eclipse.emf.internal.cdo.CDOFactoryImpl;
+
+import org.eclipse.net4j.util.ObjectUtil;
+
+import org.eclipse.emf.ecore.EPackage;
+import org.eclipse.emf.ecore.EcorePackage;
+import org.eclipse.emf.ecore.impl.EPackageImpl;
+
+/**
+ * @author Eike Stepper
+ */
+public final class ModelUtil
+{
+ private ModelUtil()
+ {
+ }
+
+ public static EPackage getGeneratedEPackage(EPackage ePackage)
+ {
+ String packageURI = ePackage.getNsURI();
+ if (packageURI.equals(EcorePackage.eINSTANCE.getNsURI()))
+ {
+ return EcorePackage.eINSTANCE;
+ }
+
+ EPackage.Registry registry = EPackage.Registry.INSTANCE;
+ return registry.getEPackage(packageURI);
+ }
+
+ public static EPackageImpl prepareDynamicEPackage(EPackageImpl ePackage, String nsURI)
+ {
+ CDOFactoryImpl.prepareDynamicEPackage(ePackage);
+ EPackageImpl result = ObjectUtil.equals(ePackage.getNsURI(), nsURI) ? ePackage : null;
+ for (EPackage subPackage : ePackage.getESubpackages())
+ {
+ EPackageImpl p = prepareDynamicEPackage((EPackageImpl)subPackage, nsURI);
+ if (p != null && result == null)
+ {
+ result = p;
+ }
+ }
+
+ return result;
+ }
+}
diff --git a/plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/cdo/view/CDOFeatureAnalyzer.java b/plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/cdo/view/CDOFeatureAnalyzer.java
index 39963b2e19..9d49714f40 100644
--- a/plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/cdo/view/CDOFeatureAnalyzer.java
+++ b/plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/cdo/view/CDOFeatureAnalyzer.java
@@ -12,10 +12,11 @@
package org.eclipse.emf.cdo.view;
import org.eclipse.emf.cdo.CDOObject;
-import org.eclipse.emf.cdo.common.model.CDOFeature;
import org.eclipse.emf.internal.cdo.analyzer.NOOPFeatureAnalyzer;
+import org.eclipse.emf.ecore.EStructuralFeature;
+
/**
* TODO Simon: JavaDoc
*
@@ -34,12 +35,12 @@ public interface CDOFeatureAnalyzer
*
* @since 2.0
*/
- public void preTraverseFeature(CDOObject revision, CDOFeature feature, int index);
+ public void preTraverseFeature(CDOObject revision, EStructuralFeature feature, int index);
/**
* TODO Simon: JavaDoc
*
* @since 2.0
*/
- public void postTraverseFeature(CDOObject revision, CDOFeature feature, int index, Object value);
+ public void postTraverseFeature(CDOObject revision, EStructuralFeature feature, int index, Object value);
}
diff --git a/plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/internal/cdo/CDOFactoryImpl.java b/plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/internal/cdo/CDOFactoryImpl.java
index 2668cd0047..7dc455460e 100644
--- a/plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/internal/cdo/CDOFactoryImpl.java
+++ b/plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/internal/cdo/CDOFactoryImpl.java
@@ -10,6 +10,7 @@
*/
package org.eclipse.emf.internal.cdo;
+import org.eclipse.emf.cdo.common.model.EMFUtil;
import org.eclipse.emf.cdo.util.CDOFactory;
import org.eclipse.emf.ecore.EClass;
@@ -32,4 +33,22 @@ public class CDOFactoryImpl extends EFactoryImpl implements CDOFactory
{
return new DynamicCDOObjectImpl(eClass);
}
+
+ /**
+ * @since 2.0
+ */
+ public static boolean prepareDynamicEPackage(Object value)
+ {
+ if (EMFUtil.isDynamicEPackage(value))
+ {
+ EPackage ePackage = (EPackage)value;
+ if (!(ePackage.getEFactoryInstance() instanceof CDOFactory))
+ {
+ ePackage.setEFactoryInstance(new CDOFactoryImpl(ePackage));
+ return true;
+ }
+ }
+
+ return false;
+ }
}
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 7744f578a9..e8f00e51e3 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
@@ -13,21 +13,18 @@ package org.eclipse.emf.internal.cdo;
import org.eclipse.emf.cdo.CDOObject;
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.model.CDOFeature;
-import org.eclipse.emf.cdo.common.model.CDOType;
+import org.eclipse.emf.cdo.common.model.CDOModelUtil;
+import org.eclipse.emf.cdo.common.model.CDOPackageRegistry;
import org.eclipse.emf.cdo.common.protocol.CDOProtocolConstants;
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.session.CDOPackageRegistry;
+import org.eclipse.emf.cdo.internal.common.model.GenUtil;
import org.eclipse.emf.cdo.spi.common.revision.InternalCDORevision;
import org.eclipse.emf.internal.cdo.bundle.OM;
import org.eclipse.emf.internal.cdo.session.CDORevisionManagerImpl;
import org.eclipse.emf.internal.cdo.util.FSMUtil;
-import org.eclipse.emf.internal.cdo.util.GenUtil;
-import org.eclipse.emf.internal.cdo.util.ModelUtil;
import org.eclipse.net4j.util.ImplementationError;
import org.eclipse.net4j.util.ReflectUtil;
@@ -36,9 +33,12 @@ import org.eclipse.net4j.util.om.trace.ContextTracer;
import org.eclipse.emf.common.notify.Adapter;
import org.eclipse.emf.common.notify.impl.NotifyingListImpl;
import org.eclipse.emf.common.util.URI;
+import org.eclipse.emf.ecore.EClass;
import org.eclipse.emf.ecore.EClassifier;
import org.eclipse.emf.ecore.EObject;
+import org.eclipse.emf.ecore.EReference;
import org.eclipse.emf.ecore.EStructuralFeature;
+import org.eclipse.emf.ecore.EcorePackage;
import org.eclipse.emf.ecore.InternalEObject;
import org.eclipse.emf.ecore.impl.EAttributeImpl;
import org.eclipse.emf.ecore.impl.EClassImpl;
@@ -94,11 +94,6 @@ public final class CDOLegacyWrapper extends CDOObjectWrapper
state = CDOState.TRANSIENT;
}
- public CDOClass cdoClass()
- {
- return CDOObjectImpl.getCDOClass(this);
- }
-
public CDOState cdoState()
{
return state;
@@ -264,8 +259,8 @@ public final class CDOLegacyWrapper extends CDOObjectWrapper
// Handle values
CDOPackageRegistry packageRegistry = cdoView().getSession().getPackageRegistry();
- CDOClass cdoClass = revision.getCDOClass();
- for (CDOFeature feature : cdoClass.getAllFeatures())
+ EClass eClass = revision.getEClass();
+ for (EStructuralFeature feature : CDOModelUtil.getAllPersistentFeatures(eClass))
{
instanceToRevisionFeature(feature, packageRegistry);
}
@@ -290,7 +285,7 @@ public final class CDOLegacyWrapper extends CDOObjectWrapper
}
}
- private void instanceToRevisionFeature(CDOFeature feature, CDOPackageRegistry packageRegistry)
+ private void instanceToRevisionFeature(EStructuralFeature feature, CDOPackageRegistry packageRegistry)
{
Object instanceValue = getInstanceValue(instance, feature, packageRegistry);
if (feature.isMany())
@@ -306,7 +301,7 @@ public final class CDOLegacyWrapper extends CDOObjectWrapper
for (Iterator<?> it = instanceList.basicIterator(); it.hasNext();)
{
Object instanceElement = it.next();
- if (instanceElement != null && feature.isReference())
+ if (instanceElement != null && feature instanceof EReference)
{
instanceElement = view.convertObjectToID(instanceElement);
}
@@ -318,7 +313,7 @@ public final class CDOLegacyWrapper extends CDOObjectWrapper
}
else
{
- if (instanceValue != null && feature.isReference())
+ if (instanceValue != null && feature instanceof EReference)
{
instanceValue = view.convertObjectToID(instanceValue);
}
@@ -350,8 +345,8 @@ public final class CDOLegacyWrapper extends CDOObjectWrapper
// Handle values
CDOPackageRegistry packageRegistry = cdoView().getSession().getPackageRegistry();
- CDOClass cdoClass = revision.getCDOClass();
- for (CDOFeature feature : cdoClass.getAllFeatures())
+ EClass eClass = revision.getEClass();
+ for (EStructuralFeature feature : CDOModelUtil.getAllPersistentFeatures(eClass))
{
revisionToInstanceFeature(feature, packageRegistry);
}
@@ -377,7 +372,7 @@ public final class CDOLegacyWrapper extends CDOObjectWrapper
}
@SuppressWarnings("unchecked")
- private void revisionToInstanceFeature(CDOFeature feature, CDOPackageRegistry packageRegistry)
+ private void revisionToInstanceFeature(EStructuralFeature feature, CDOPackageRegistry packageRegistry)
{
Object value = revision.getValue(feature);
if (feature.isMany())
@@ -389,7 +384,7 @@ public final class CDOLegacyWrapper extends CDOObjectWrapper
if (value != null)
{
List<?> revisionList = (List<?>)value;
- if (feature.isReference())
+ if (feature instanceof EReference)
{
for (Object element : revisionList)
{
@@ -410,7 +405,7 @@ public final class CDOLegacyWrapper extends CDOObjectWrapper
}
else
{
- if (feature.isReference())
+ if (feature instanceof EReference)
{
value = getEObjectFromPotentialID(view, feature, value);
}
@@ -434,10 +429,10 @@ public final class CDOLegacyWrapper extends CDOObjectWrapper
return instance.eContainerFeatureID();
}
- private Object getInstanceValue(InternalEObject instance, CDOFeature feature, CDOPackageRegistry packageRegistry)
+ private Object getInstanceValue(InternalEObject instance, EStructuralFeature feature,
+ CDOPackageRegistry packageRegistry)
{
- EStructuralFeature eFeature = ModelUtil.getEFeature(feature, packageRegistry);
- return instance.eGet(eFeature);
+ return instance.eGet(feature);
}
private void setInstanceResource(Resource.Internal resource)
@@ -453,7 +448,7 @@ public final class CDOLegacyWrapper extends CDOObjectWrapper
/**
* TODO Ed: Help to fix whole mess (avoid inverse updates)
*/
- private void setInstanceValue(InternalEObject instance, CDOFeature feature, Object value)
+ private void setInstanceValue(InternalEObject instance, EStructuralFeature feature, Object value)
{
// TODO Consider EStoreEObjectImpl based objects as well!
// TODO Don't use Java reflection
@@ -461,7 +456,7 @@ public final class CDOLegacyWrapper extends CDOObjectWrapper
String featureName = feature.getName();
String fieldName = featureName;// TODO safeName()
Field field = ReflectUtil.getField(instanceClass, fieldName);
- if (field == null && feature.getType() == CDOType.BOOLEAN)
+ if (field == null && feature.getEType() == EcorePackage.eINSTANCE.getEBoolean())
{
if (instanceClass.isAssignableFrom(EAttributeImpl.class) || instanceClass.isAssignableFrom(EClassImpl.class)
|| instanceClass.isAssignableFrom(EDataTypeImpl.class)
@@ -524,7 +519,7 @@ public final class CDOLegacyWrapper extends CDOObjectWrapper
* that will be used later to resolve the proxy. <code>null</code> indicates that proxy creation will be
* avoided!
*/
- private InternalEObject getEObjectFromPotentialID(InternalCDOView view, CDOFeature feature, Object potentialID)
+ private InternalEObject getEObjectFromPotentialID(InternalCDOView view, EStructuralFeature feature, Object potentialID)
{
if (potentialID instanceof CDOID)
{
@@ -565,11 +560,9 @@ public final class CDOLegacyWrapper extends CDOObjectWrapper
* <p>
* TODO {@link InternalEObject#eResolveProxy(InternalEObject)
*/
- private InternalEObject createProxy(InternalCDOView view, CDOFeature feature, CDOID id)
+ private InternalEObject createProxy(InternalCDOView view, EStructuralFeature feature, CDOID id)
{
- CDOPackageRegistry packageRegistry = view.getSession().getPackageRegistry();
- EStructuralFeature eFeature = ModelUtil.getEFeature(feature, packageRegistry);
- EClassifier eType = eFeature.getEType();
+ EClassifier eType = feature.getEType();
Class<?> instanceClass = eType.getInstanceClass();
Class<?>[] interfaces = { instanceClass, InternalEObject.class, LegacyProxy.class };
@@ -586,10 +579,10 @@ public final class CDOLegacyWrapper extends CDOObjectWrapper
// if (!allProxiesResolved)
{
CDOPackageRegistry packageRegistry = cdoView().getSession().getPackageRegistry();
- CDOClass cdoClass = revision.getCDOClass();
- for (CDOFeature feature : cdoClass.getAllFeatures())
+ EClass eClass = revision.getEClass();
+ for (EStructuralFeature feature : CDOModelUtil.getAllPersistentFeatures(eClass))
{
- if (feature.isReference())
+ if (feature instanceof EReference)
{
resolveProxies(feature, packageRegistry);
}
@@ -604,7 +597,7 @@ public final class CDOLegacyWrapper extends CDOObjectWrapper
* EMF with fixed bug #247130. These compile errors do not affect native models!
*/
@SuppressWarnings("unchecked")
- private void resolveProxies(CDOFeature feature, CDOPackageRegistry packageRegistry)
+ private void resolveProxies(EStructuralFeature feature, CDOPackageRegistry packageRegistry)
{
Object value = getInstanceValue(instance, feature, packageRegistry);
if (value != null)
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 dff5aded57..fdda3570b9 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
@@ -12,11 +12,11 @@ package org.eclipse.emf.internal.cdo;
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.impl.CDOResourceImpl;
import org.eclipse.emf.cdo.spi.common.revision.InternalCDORevision;
+import org.eclipse.emf.ecore.EClass;
import org.eclipse.emf.ecore.InternalEObject;
import org.eclipse.emf.spi.cdo.InternalCDOView;
@@ -55,7 +55,7 @@ public class CDOMetaWrapper extends CDOObjectWrapper
throw new UnsupportedOperationException();
}
- public CDOClass cdoClass()
+ public EClass eClass()
{
throw new UnsupportedOperationException();
}
diff --git a/plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/internal/cdo/CDONotificationBuilder.java b/plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/internal/cdo/CDONotificationBuilder.java
index 0bb52f550c..0afea782a9 100644
--- a/plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/internal/cdo/CDONotificationBuilder.java
+++ b/plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/internal/cdo/CDONotificationBuilder.java
@@ -11,7 +11,6 @@
*/
package org.eclipse.emf.internal.cdo;
-import org.eclipse.emf.cdo.common.model.CDOFeature;
import org.eclipse.emf.cdo.common.revision.delta.CDOAddFeatureDelta;
import org.eclipse.emf.cdo.common.revision.delta.CDOClearFeatureDelta;
import org.eclipse.emf.cdo.common.revision.delta.CDOContainerFeatureDelta;
@@ -23,9 +22,6 @@ import org.eclipse.emf.cdo.common.revision.delta.CDORemoveFeatureDelta;
import org.eclipse.emf.cdo.common.revision.delta.CDORevisionDelta;
import org.eclipse.emf.cdo.common.revision.delta.CDOSetFeatureDelta;
import org.eclipse.emf.cdo.common.revision.delta.CDOUnsetFeatureDelta;
-import org.eclipse.emf.cdo.session.CDOPackageRegistry;
-
-import org.eclipse.emf.internal.cdo.util.ModelUtil;
import org.eclipse.emf.common.notify.impl.NotificationImpl;
import org.eclipse.emf.ecore.EStructuralFeature;
@@ -44,11 +40,8 @@ public class CDONotificationBuilder implements CDOFeatureDeltaVisitor
private InternalEObject internalObject;
- private CDOPackageRegistry packageRegistry;
-
- public CDONotificationBuilder(CDOPackageRegistry packageRegistry)
+ public CDONotificationBuilder()
{
- this.packageRegistry = packageRegistry;
}
public synchronized NotificationImpl buildNotification(InternalEObject internalObject, CDORevisionDelta delta)
@@ -125,9 +118,8 @@ public class CDONotificationBuilder implements CDOFeatureDeltaVisitor
}
}
- private int getEFeatureID(CDOFeature cdoFeature)
+ private int getEFeatureID(EStructuralFeature eFeature)
{
- EStructuralFeature eFeature = ModelUtil.getEFeature(cdoFeature, packageRegistry);
return internalObject.eClass().getFeatureID(eFeature);
}
}
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 473fab7faa..0ccb4a3a9c 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
@@ -14,8 +14,6 @@ package org.eclipse.emf.internal.cdo;
import org.eclipse.emf.cdo.CDOLock;
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.model.CDOFeature;
import org.eclipse.emf.cdo.common.revision.CDORevision;
import org.eclipse.emf.cdo.eresource.CDOResource;
import org.eclipse.emf.cdo.eresource.impl.CDOResourceImpl;
@@ -24,9 +22,7 @@ import org.eclipse.emf.cdo.util.CDOUtil;
import org.eclipse.emf.cdo.view.CDOView;
import org.eclipse.emf.internal.cdo.bundle.OM;
-import org.eclipse.emf.internal.cdo.session.CDOSessionPackageManagerImpl;
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.WrappedException;
@@ -139,11 +135,6 @@ public class CDOObjectImpl extends EStoreEObjectImpl implements InternalCDOObjec
return cdoSettings;
}
- public CDOClass cdoClass()
- {
- return getCDOClass(this);
- }
-
/**
* @since 2.0
*/
@@ -368,21 +359,19 @@ public class CDOObjectImpl extends EStoreEObjectImpl implements InternalCDOObjec
}
@SuppressWarnings("unchecked")
- private void populateRevisionFeature(InternalCDOView view, InternalCDORevision revision, EStructuralFeature eFeature,
+ private void populateRevisionFeature(InternalCDOView view, InternalCDORevision revision, EStructuralFeature feature,
Object[] eSettings, int i)
{
- CDOSessionPackageManagerImpl packageManager = (CDOSessionPackageManagerImpl)view.getSession().getPackageManager();
- CDOFeature cdoFeature = packageManager.getCDOFeature(eFeature);
if (TRACER.isEnabled())
{
- TRACER.format("Populating feature {0}", cdoFeature);
+ TRACER.format("Populating feature {0}", feature);
}
Object setting = cdoBasicSettings() != null ? cdoSettings()[i] : null;
CDOStore cdoStore = cdoStore();
- if (cdoFeature.isMany())
+ if (feature.isMany())
{
if (setting != null)
{
@@ -390,15 +379,15 @@ public class CDOObjectImpl extends EStoreEObjectImpl implements InternalCDOObjec
EList<Object> list = (EList<Object>)setting;
for (Object value : list)
{
- value = cdoStore.convertToCDO(cdoView(), eFeature, cdoFeature, value);
- revision.add(cdoFeature, index++, value);
+ value = cdoStore.convertToCDO(cdoView(), feature, value);
+ revision.add(feature, index++, value);
}
}
}
else
{
- setting = cdoStore.convertToCDO(cdoView(), eFeature, cdoFeature, setting);
- revision.set(cdoFeature, 0, setting);
+ setting = cdoStore.convertToCDO(cdoView(), feature, setting);
+ revision.set(feature, 0, setting);
}
}
@@ -1041,13 +1030,6 @@ public class CDOObjectImpl extends EStoreEObjectImpl implements InternalCDOObjec
return eClass().getName() + "@" + id;
}
- static CDOClass getCDOClass(InternalCDOObject cdoObject)
- {
- InternalCDOView view = cdoObject.cdoView();
- CDOSessionPackageManagerImpl packageManager = (CDOSessionPackageManagerImpl)view.getSession().getPackageManager();
- return ModelUtil.getCDOClass(cdoObject.eClass(), packageManager);
- }
-
private CDOStore cdoStore()
{
return cdoView().getStore();
diff --git a/plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/internal/cdo/CDOObjectMerger.java b/plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/internal/cdo/CDOObjectMerger.java
index 1f9d7a0bbb..bd8740168e 100644
--- a/plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/internal/cdo/CDOObjectMerger.java
+++ b/plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/internal/cdo/CDOObjectMerger.java
@@ -13,7 +13,7 @@ package org.eclipse.emf.internal.cdo;
import org.eclipse.emf.cdo.CDOState;
import org.eclipse.emf.cdo.common.revision.delta.CDORevisionDelta;
-import org.eclipse.emf.cdo.internal.common.revision.delta.CDORevisionMerger;
+import org.eclipse.emf.cdo.spi.common.revision.CDORevisionMerger;
import org.eclipse.emf.cdo.spi.common.revision.InternalCDORevision;
import org.eclipse.emf.spi.cdo.InternalCDOObject;
diff --git a/plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/internal/cdo/CDOStateMachine.java b/plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/internal/cdo/CDOStateMachine.java
index ddf034b55b..da9e1682a2 100644
--- a/plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/internal/cdo/CDOStateMachine.java
+++ b/plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/internal/cdo/CDOStateMachine.java
@@ -14,7 +14,6 @@ package org.eclipse.emf.internal.cdo;
import org.eclipse.emf.cdo.CDOState;
import org.eclipse.emf.cdo.common.id.CDOID;
import org.eclipse.emf.cdo.common.id.CDOIDTemp;
-import org.eclipse.emf.cdo.common.model.CDOClass;
import org.eclipse.emf.cdo.common.revision.CDORevision;
import org.eclipse.emf.cdo.common.revision.CDORevisionFactory;
import org.eclipse.emf.cdo.common.revision.delta.CDOFeatureDelta;
@@ -32,6 +31,7 @@ import org.eclipse.net4j.util.fsm.FiniteStateMachine;
import org.eclipse.net4j.util.fsm.ITransition;
import org.eclipse.net4j.util.om.trace.ContextTracer;
+import org.eclipse.emf.ecore.EClass;
import org.eclipse.emf.ecore.EObject;
import org.eclipse.emf.ecore.InternalEObject;
import org.eclipse.emf.ecore.impl.EStoreEObjectImpl;
@@ -460,9 +460,9 @@ public final class CDOStateMachine extends FiniteStateMachine<CDOState, CDOEvent
changeState(object, CDOState.PREPARED);
// Create new revision
- CDOClass cdoClass = object.cdoClass();
+ EClass eClass = object.eClass();
CDORevisionFactory factory = transaction.getSession().options().getRevisionFactory();
- InternalCDORevision revision = (InternalCDORevision)factory.createRevision(cdoClass, id);
+ InternalCDORevision revision = (InternalCDORevision)factory.createRevision(eClass, id);
revision.setVersion(-1);
object.cdoInternalSetRevision(revision);
@@ -693,7 +693,7 @@ public final class CDOStateMachine extends FiniteStateMachine<CDOState, CDOEvent
* @author Eike Stepper
* @since 2.0
*/
- protected class ConflictTransition extends InvalidateTransition
+ private class ConflictTransition extends InvalidateTransition
{
@Override
public void execute(InternalCDOObject object, CDOState state, CDOEvent event, Integer version)
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 df4a284328..44cf2e9033 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
@@ -15,13 +15,11 @@
package org.eclipse.emf.internal.cdo;
import org.eclipse.emf.cdo.common.id.CDOID;
-import org.eclipse.emf.cdo.common.model.CDOFeature;
+import org.eclipse.emf.cdo.common.model.CDOModelUtil;
import org.eclipse.emf.cdo.common.model.CDOType;
import org.eclipse.emf.cdo.common.revision.CDOList;
-import org.eclipse.emf.cdo.common.revision.CDORevisionUtil;
import org.eclipse.emf.cdo.common.revision.delta.CDOFeatureDelta;
import org.eclipse.emf.cdo.eresource.CDOResource;
-import org.eclipse.emf.cdo.internal.common.model.core.CDOFeatureMapEntryDataTypeImpl;
import org.eclipse.emf.cdo.internal.common.revision.delta.CDOAddFeatureDeltaImpl;
import org.eclipse.emf.cdo.internal.common.revision.delta.CDOClearFeatureDeltaImpl;
import org.eclipse.emf.cdo.internal.common.revision.delta.CDOContainerFeatureDeltaImpl;
@@ -34,23 +32,20 @@ import org.eclipse.emf.cdo.view.CDORevisionPrefetchingPolicy;
import org.eclipse.emf.internal.cdo.bundle.OM;
import org.eclipse.emf.internal.cdo.session.CDORevisionManagerImpl;
-import org.eclipse.emf.internal.cdo.session.CDOSessionPackageManagerImpl;
import org.eclipse.emf.internal.cdo.util.FSMUtil;
import org.eclipse.net4j.util.ImplementationError;
import org.eclipse.net4j.util.om.trace.ContextTracer;
-import org.eclipse.emf.common.util.URI;
import org.eclipse.emf.ecore.EClass;
import org.eclipse.emf.ecore.EDataType;
import org.eclipse.emf.ecore.EObject;
+import org.eclipse.emf.ecore.EReference;
import org.eclipse.emf.ecore.EStructuralFeature;
import org.eclipse.emf.ecore.InternalEObject;
import org.eclipse.emf.ecore.InternalEObject.EStore;
import org.eclipse.emf.ecore.impl.EStoreEObjectImpl;
import org.eclipse.emf.ecore.util.EcoreUtil;
-import org.eclipse.emf.ecore.util.FeatureMap;
-import org.eclipse.emf.ecore.util.FeatureMapUtil;
import org.eclipse.emf.spi.cdo.CDOElementProxy;
import org.eclipse.emf.spi.cdo.InternalCDOObject;
import org.eclipse.emf.spi.cdo.InternalCDOView;
@@ -74,12 +69,12 @@ public final class CDOStore implements EStore
private InternalCDOView view;
- // Used for optimization. Multiple call to CDStore will be sent like size and than add.
- private EStructuralFeature lastLookupEFeature;
-
- private CDOFeature lastLookupCDOFeature;
-
- private Object lock = new Object();
+ // // Used for optimization. Multiple call to CDStore will be sent like size and than add.
+ // private EStructuralFeature lastLookupEFeature;
+ //
+ // private EStructuralFeature lastLookupEStructuralFeature;
+ //
+ // private Object lock = new Object();
/**
* @since 2.0
@@ -165,141 +160,133 @@ public final class CDOStore implements EStore
throw new UnsupportedOperationException("Use getContainingFeatureID() instead");
}
- public Object get(InternalEObject eObject, EStructuralFeature eFeature, int index)
+ public Object get(InternalEObject eObject, EStructuralFeature feature, int index)
{
InternalCDOObject cdoObject = getCDOObject(eObject);
- CDOFeature cdoFeature = getCDOFeature(cdoObject, eFeature);
if (TRACER.isEnabled())
{
- TRACER.format("get({0}, {1}, {2})", cdoObject, cdoFeature, index);
+ TRACER.format("get({0}, {1}, {2})", cdoObject, feature, index);
}
- view.getFeatureAnalyzer().preTraverseFeature(cdoObject, cdoFeature, index);
+ view.getFeatureAnalyzer().preTraverseFeature(cdoObject, feature, index);
InternalCDORevision revision = getRevisionForReading(cdoObject);
- Object value = revision.basicGet(cdoFeature, index);
- value = convertToEMF(view, eObject, revision, eFeature, cdoFeature, index, value);
+ Object value = revision.basicGet(feature, index);
+ value = convertToEMF(view, eObject, revision, feature, index, value);
- view.getFeatureAnalyzer().postTraverseFeature(cdoObject, cdoFeature, index, value);
+ view.getFeatureAnalyzer().postTraverseFeature(cdoObject, feature, index, value);
return value;
}
@Deprecated
- public boolean isSet(InternalEObject eObject, EStructuralFeature eFeature)
+ public boolean isSet(InternalEObject eObject, EStructuralFeature feature)
{
// Should not be called
throw new ImplementationError();
}
- public int size(InternalEObject eObject, EStructuralFeature eFeature)
+ public int size(InternalEObject eObject, EStructuralFeature feature)
{
InternalCDOObject cdoObject = getCDOObject(eObject);
- CDOFeature cdoFeature = getCDOFeature(cdoObject, eFeature);
if (TRACER.isEnabled())
{
- TRACER.format("size({0}, {1})", cdoObject, cdoFeature);
+ TRACER.format("size({0}, {1})", cdoObject, feature);
}
InternalCDORevision revision = getRevisionForReading(cdoObject);
- return revision.size(cdoFeature);
+ return revision.size(feature);
}
- public boolean isEmpty(InternalEObject eObject, EStructuralFeature eFeature)
+ public boolean isEmpty(InternalEObject eObject, EStructuralFeature feature)
{
InternalCDOObject cdoObject = getCDOObject(eObject);
- CDOFeature cdoFeature = getCDOFeature(cdoObject, eFeature);
if (TRACER.isEnabled())
{
- TRACER.format("isEmpty({0}, {1})", cdoObject, cdoFeature);
+ TRACER.format("isEmpty({0}, {1})", cdoObject, feature);
}
InternalCDORevision revision = getRevisionForReading(cdoObject);
- return revision.isEmpty(cdoFeature);
+ return revision.isEmpty(feature);
}
- public boolean contains(InternalEObject eObject, EStructuralFeature eFeature, Object value)
+ public boolean contains(InternalEObject eObject, EStructuralFeature feature, Object value)
{
InternalCDOObject cdoObject = getCDOObject(eObject);
- CDOFeature cdoFeature = getCDOFeature(cdoObject, eFeature);
if (TRACER.isEnabled())
{
- TRACER.format("contains({0}, {1}, {2})", cdoObject, cdoFeature, value);
+ TRACER.format("contains({0}, {1}, {2})", cdoObject, feature, value);
}
- if (cdoFeature.isReference())
+ if (feature instanceof EReference)
{
value = cdoObject.cdoView().convertObjectToID(value, true);
}
InternalCDORevision revision = getRevisionForReading(cdoObject);
- return revision.contains(cdoFeature, value);
+ return revision.contains(feature, value);
}
- public int indexOf(InternalEObject eObject, EStructuralFeature eFeature, Object value)
+ public int indexOf(InternalEObject eObject, EStructuralFeature feature, Object value)
{
InternalCDOObject cdoObject = getCDOObject(eObject);
- CDOFeature cdoFeature = getCDOFeature(cdoObject, eFeature);
if (TRACER.isEnabled())
{
- TRACER.format("indexOf({0}, {1}, {2})", cdoObject, cdoFeature, value);
+ TRACER.format("indexOf({0}, {1}, {2})", cdoObject, feature, value);
}
- if (cdoFeature.isReference())
+ if (feature instanceof EReference)
{
value = cdoObject.cdoView().convertObjectToID(value, true);
}
InternalCDORevision revision = getRevisionForReading(cdoObject);
- return revision.indexOf(cdoFeature, value);
+ return revision.indexOf(feature, value);
}
- public int lastIndexOf(InternalEObject eObject, EStructuralFeature eFeature, Object value)
+ public int lastIndexOf(InternalEObject eObject, EStructuralFeature feature, Object value)
{
InternalCDOObject cdoObject = getCDOObject(eObject);
- CDOFeature cdoFeature = getCDOFeature(cdoObject, eFeature);
if (TRACER.isEnabled())
{
- TRACER.format("lastIndexOf({0}, {1}, {2})", cdoObject, cdoFeature, value);
+ TRACER.format("lastIndexOf({0}, {1}, {2})", cdoObject, feature, value);
}
- if (cdoFeature.isReference())
+ if (feature instanceof EReference)
{
value = cdoObject.cdoView().convertObjectToID(value, true);
}
InternalCDORevision revision = getRevisionForReading(cdoObject);
- return revision.lastIndexOf(cdoFeature, value);
+ return revision.lastIndexOf(feature, value);
}
- public int hashCode(InternalEObject eObject, EStructuralFeature eFeature)
+ public int hashCode(InternalEObject eObject, EStructuralFeature feature)
{
InternalCDOObject cdoObject = getCDOObject(eObject);
- CDOFeature cdoFeature = getCDOFeature(cdoObject, eFeature);
if (TRACER.isEnabled())
{
- TRACER.format("hashCode({0}, {1})", cdoObject, cdoFeature);
+ TRACER.format("hashCode({0}, {1})", cdoObject, feature);
}
InternalCDORevision revision = getRevisionForReading(cdoObject);
- return revision.hashCode(cdoFeature);
+ return revision.hashCode(feature);
}
- public Object[] toArray(InternalEObject eObject, EStructuralFeature eFeature)
+ public Object[] toArray(InternalEObject eObject, EStructuralFeature feature)
{
InternalCDOObject cdoObject = getCDOObject(eObject);
- CDOFeature cdoFeature = getCDOFeature(cdoObject, eFeature);
if (TRACER.isEnabled())
{
- TRACER.format("toArray({0}, {1})", cdoObject, cdoFeature);
+ TRACER.format("toArray({0}, {1})", cdoObject, feature);
}
InternalCDORevision revision = getRevisionForReading(cdoObject);
- Object[] result = revision.toArray(cdoFeature);
- if (cdoFeature.isReference())
+ Object[] result = revision.toArray(feature);
+ if (feature instanceof EReference)
{
for (int i = 0; i < result.length; i++)
{
- result[i] = resolveProxy(revision, cdoFeature, i, result[i]);
+ result[i] = resolveProxy(revision, feature, i, result[i]);
result[i] = cdoObject.cdoView().convertIDToObject(result[i]);
}
}
@@ -308,9 +295,9 @@ public final class CDOStore implements EStore
}
@SuppressWarnings("unchecked")
- public <T> T[] toArray(InternalEObject eObject, EStructuralFeature eFeature, T[] a)
+ public <T> T[] toArray(InternalEObject eObject, EStructuralFeature feature, T[] a)
{
- Object[] array = toArray(eObject, eFeature);
+ Object[] array = toArray(eObject, feature);
int size = array.length;
if (a.length < size)
@@ -327,28 +314,27 @@ public final class CDOStore implements EStore
return a;
}
- public Object set(InternalEObject eObject, EStructuralFeature eFeature, int index, Object value)
+ public Object set(InternalEObject eObject, EStructuralFeature feature, int index, Object value)
{
InternalCDOObject cdoObject = getCDOObject(eObject);
- CDOFeature cdoFeature = getCDOFeature(cdoObject, eFeature);
if (TRACER.isEnabled())
{
- TRACER.format("set({0}, {1}, {2}, {3})", cdoObject, cdoFeature, index, value);
+ TRACER.format("set({0}, {1}, {2}, {3})", cdoObject, feature, index, value);
}
- value = convertToCDO(getView(), eFeature, cdoFeature, value);
+ value = convertToCDO(getView(), feature, value);
- CDOFeatureDelta delta = new CDOSetFeatureDeltaImpl(cdoFeature, index, value);
+ CDOFeatureDelta delta = new CDOSetFeatureDeltaImpl(feature, index, value);
InternalCDORevision revision = getRevisionForWriting(cdoObject, delta);
- if (cdoFeature.isReference())
+ if (feature instanceof EReference)
{
- Object oldValue = revision.basicGet(cdoFeature, index);
- oldValue = resolveProxy(revision, cdoFeature, index, oldValue);
+ Object oldValue = revision.basicGet(feature, index);
+ oldValue = resolveProxy(revision, feature, index, oldValue);
value = cdoObject.cdoView().convertObjectToID(value, true);
}
- Object oldValue = revision.basicSet(cdoFeature, index, value);
- oldValue = convertToEMF(cdoObject.cdoView(), eObject, revision, eFeature, cdoFeature, index, oldValue);
+ Object oldValue = revision.basicSet(feature, index, value);
+ oldValue = convertToEMF(cdoObject.cdoView(), eObject, revision, feature, index, oldValue);
return oldValue;
}
@@ -356,7 +342,7 @@ public final class CDOStore implements EStore
* @since 2.0
*/
public Object convertToEMF(InternalCDOView view, EObject eObject, InternalCDORevision revision,
- EStructuralFeature eFeature, CDOFeature cdoFeature, int index, Object value)
+ EStructuralFeature feature, int index, Object value)
{
if (value != null)
{
@@ -365,16 +351,16 @@ public final class CDOStore implements EStore
return EStoreEObjectImpl.NIL;
}
- if (cdoFeature.isMany() && EStore.NO_INDEX != index)
+ if (feature.isMany() && EStore.NO_INDEX != index)
{
- value = resolveProxy(revision, cdoFeature, index, value);
- if (cdoFeature.isMany() && value instanceof CDOID)
+ value = resolveProxy(revision, feature, index, value);
+ if (feature.isMany() && value instanceof CDOID)
{
CDOID id = (CDOID)value;
- CDOList list = revision.getList(cdoFeature);
+ CDOList list = revision.getList(feature);
CDORevisionManagerImpl revisionManager = (CDORevisionManagerImpl)view.getSession().getRevisionManager();
CDORevisionPrefetchingPolicy policy = view.options().getRevisionPrefetchingPolicy();
- Collection<CDOID> listOfIDs = policy.loadAhead(revisionManager, eObject, eFeature, list, index, id);
+ Collection<CDOID> listOfIDs = policy.loadAhead(revisionManager, eObject, feature, list, index, id);
if (!listOfIDs.isEmpty())
{
revisionManager.getRevisions(listOfIDs, view.getSession().options().getCollectionLoadingPolicy()
@@ -383,22 +369,27 @@ public final class CDOStore implements EStore
}
}
- if (cdoFeature.isReference())
+ if (feature instanceof EReference)
{
value = view.convertIDToObject(value);
}
- else if (cdoFeature.getType() == CDOType.CUSTOM)
- {
- value = EcoreUtil.createFromString((EDataType)eFeature.getEType(), (String)value);
- }
- else if (cdoFeature.getType() == CDOType.FEATURE_MAP_ENTRY)
+ else if (feature.getEType() instanceof EDataType)
{
- CDOFeatureMapEntryDataTypeImpl entry = (CDOFeatureMapEntryDataTypeImpl)value;
- EStructuralFeature feature = (EStructuralFeature)view.getResourceSet().getEObject(
- URI.createURI(entry.getURI()), true);
- Object object = view.convertIDToObject(entry.getObject());
- value = FeatureMapUtil.createEntry(feature, object);
+ EDataType eType = (EDataType)feature.getEType();
+ CDOType type = CDOModelUtil.getCoreType(eType);
+ if (type == null)
+ {
+ value = EcoreUtil.createFromString(eType, (String)value);
+ }
}
+ // TODO Handle feature maps! else if (feature.getType() == CDOType.FEATURE_MAP_ENTRY)
+ // {
+ // EStructuralFeatureMapEntryDataTypeImpl entry = (EStructuralFeatureMapEntryDataTypeImpl)value;
+ // EStructuralFeature feature = (EStructuralFeature)view.getResourceSet().getEObject(
+ // URI.createURI(entry.getURI()), true);
+ // Object object = view.convertIDToObject(entry.getObject());
+ // value = FeatureMapUtil.createEntry(feature, object);
+ // }
}
return value;
@@ -407,7 +398,7 @@ public final class CDOStore implements EStore
/**
* @since 2.0
*/
- public Object convertToCDO(InternalCDOView view, EStructuralFeature eFeature, CDOFeature cdoFeature, Object value)
+ public Object convertToCDO(InternalCDOView view, EStructuralFeature feature, Object value)
{
if (value != null)
{
@@ -415,104 +406,104 @@ public final class CDOStore implements EStore
{
value = InternalCDORevision.NIL;
}
- else if (cdoFeature.isReference())
+ else if (feature instanceof EReference)
{
value = view.convertObjectToID(value, true);
}
- else if (cdoFeature.getType() == CDOType.FEATURE_MAP_ENTRY)
+ // TODO Handle feature maps! else if (feature.getType() == CDOType.FEATURE_MAP_ENTRY)
+ // {
+ // FeatureMap.Entry entry = (FeatureMap.Entry)value;
+ // String uri = EcoreUtil.getURI(entry.getEStructuralFeature()).toString();
+ // value = CDORevisionUtil.createFeatureMapEntry(uri, entry.getValue());
+ // }
+ else if (feature.getEType() instanceof EDataType)
{
- FeatureMap.Entry entry = (FeatureMap.Entry)value;
- String uri = EcoreUtil.getURI(entry.getEStructuralFeature()).toString();
- value = CDORevisionUtil.createFeatureMapEntry(uri, entry.getValue());
- }
- else if (cdoFeature.getType() == CDOType.CUSTOM)
- {
- value = EcoreUtil.convertToString((EDataType)eFeature.getEType(), value);
+ EDataType eType = (EDataType)feature.getEType();
+ CDOType type = CDOModelUtil.getCoreType(eType);
+ if (type == null)
+ {
+ value = EcoreUtil.convertToString(eType, value);
+ }
}
}
return value;
}
- public void unset(InternalEObject eObject, EStructuralFeature eFeature)
+ public void unset(InternalEObject eObject, EStructuralFeature feature)
{
InternalCDOObject cdoObject = getCDOObject(eObject);
- CDOFeature cdoFeature = getCDOFeature(cdoObject, eFeature);
if (TRACER.isEnabled())
{
- TRACER.format("unset({0}, {1})", cdoObject, cdoFeature);
+ TRACER.format("unset({0}, {1})", cdoObject, feature);
}
- CDOFeatureDelta delta = new CDOUnsetFeatureDeltaImpl(cdoFeature);
+ CDOFeatureDelta delta = new CDOUnsetFeatureDeltaImpl(feature);
InternalCDORevision revision = getRevisionForWriting(cdoObject, delta);
// TODO Handle containment remove!!!
- revision.set(cdoFeature, 0, null);
+ revision.set(feature, 0, null);
}
- public void add(InternalEObject eObject, EStructuralFeature eFeature, int index, Object value)
+ public void add(InternalEObject eObject, EStructuralFeature feature, int index, Object value)
{
InternalCDOObject cdoObject = getCDOObject(eObject);
- CDOFeature cdoFeature = getCDOFeature(cdoObject, eFeature);
if (TRACER.isEnabled())
{
- TRACER.format("add({0}, {1}, {2}, {3})", cdoObject, cdoFeature, index, value);
+ TRACER.format("add({0}, {1}, {2}, {3})", cdoObject, feature, index, value);
}
- value = convertToCDO(cdoObject.cdoView(), eFeature, cdoFeature, value);
+ value = convertToCDO(cdoObject.cdoView(), feature, value);
- CDOFeatureDelta delta = new CDOAddFeatureDeltaImpl(cdoFeature, index, value);
+ CDOFeatureDelta delta = new CDOAddFeatureDeltaImpl(feature, index, value);
InternalCDORevision revision = getRevisionForWriting(cdoObject, delta);
- revision.add(cdoFeature, index, value);
+ revision.add(feature, index, value);
}
- public Object remove(InternalEObject eObject, EStructuralFeature eFeature, int index)
+ public Object remove(InternalEObject eObject, EStructuralFeature feature, int index)
{
InternalCDOObject cdoObject = getCDOObject(eObject);
- CDOFeature cdoFeature = getCDOFeature(cdoObject, eFeature);
if (TRACER.isEnabled())
{
- TRACER.format("remove({0}, {1}, {2})", cdoObject, cdoFeature, index);
+ TRACER.format("remove({0}, {1}, {2})", cdoObject, feature, index);
}
- CDOFeatureDelta delta = new CDORemoveFeatureDeltaImpl(cdoFeature, index);
+ CDOFeatureDelta delta = new CDORemoveFeatureDeltaImpl(feature, index);
InternalCDORevision revision = getRevisionForWriting(cdoObject, delta);
- Object result = revision.remove(cdoFeature, index);
+ Object result = revision.remove(feature, index);
- result = convertToEMF(cdoObject.cdoView(), eObject, revision, eFeature, cdoFeature, index, result);
+ result = convertToEMF(cdoObject.cdoView(), eObject, revision, feature, index, result);
return result;
}
- public void clear(InternalEObject eObject, EStructuralFeature eFeature)
+ public void clear(InternalEObject eObject, EStructuralFeature feature)
{
InternalCDOObject cdoObject = getCDOObject(eObject);
- CDOFeature cdoFeature = getCDOFeature(cdoObject, eFeature);
if (TRACER.isEnabled())
{
- TRACER.format("clear({0}, {1})", cdoObject, cdoFeature);
+ TRACER.format("clear({0}, {1})", cdoObject, feature);
}
- CDOFeatureDelta delta = new CDOClearFeatureDeltaImpl(cdoFeature);
+ CDOFeatureDelta delta = new CDOClearFeatureDeltaImpl(feature);
InternalCDORevision revision = getRevisionForWriting(cdoObject, delta);
// TODO Handle containment remove!!!
- revision.clear(cdoFeature);
+ revision.clear(feature);
}
- public Object move(InternalEObject eObject, EStructuralFeature eFeature, int target, int source)
+ public Object move(InternalEObject eObject, EStructuralFeature feature, int target, int source)
{
InternalCDOObject cdoObject = getCDOObject(eObject);
- CDOFeature cdoFeature = getCDOFeature(cdoObject, eFeature);
if (TRACER.isEnabled())
{
- TRACER.format("move({0}, {1}, {2}, {3})", cdoObject, cdoFeature, target, source);
+ TRACER.format("move({0}, {1}, {2}, {3})", cdoObject, feature, target, source);
}
- CDOFeatureDelta delta = new CDOMoveFeatureDeltaImpl(cdoFeature, target, source);
+ CDOFeatureDelta delta = new CDOMoveFeatureDeltaImpl(feature, target, source);
InternalCDORevision revision = getRevisionForWriting(cdoObject, delta);
- Object result = revision.move(cdoFeature, target, source);
+ Object result = revision.move(feature, target, source);
- result = convertToEMF(cdoObject.cdoView(), eObject, revision, eFeature, cdoFeature, EStore.NO_INDEX, result);
+ result = convertToEMF(cdoObject.cdoView(), eObject, revision, feature, EStore.NO_INDEX, result);
return result;
}
@@ -535,44 +526,43 @@ public final class CDOStore implements EStore
/**
* @since 2.0
*/
- public Object resolveProxy(InternalCDORevision revision, CDOFeature cdoFeature, int index, Object value)
+ public Object resolveProxy(InternalCDORevision revision, EStructuralFeature feature, int index, Object value)
{
if (value instanceof CDOElementProxy)
{
- value = ((CDOElementProxy)value)
- .resolve(getView().getSession().getRevisionManager(), revision, cdoFeature, index);
+ value = ((CDOElementProxy)value).resolve(getView().getSession().getRevisionManager(), revision, feature, index);
}
return value;
}
- private CDOFeature getCDOFeature(InternalCDOObject cdoObject, EStructuralFeature eFeature)
- {
- synchronized (lock)
- {
- if (eFeature == lastLookupEFeature)
- {
- return lastLookupCDOFeature;
- }
- }
-
- InternalCDOView view = cdoObject.cdoView();
- if (view == null)
- {
- throw new IllegalStateException("view == null");
- }
-
- CDOSessionPackageManagerImpl packageManager = (CDOSessionPackageManagerImpl)view.getSession().getPackageManager();
- CDOFeature cdoFeature = packageManager.getCDOFeature(eFeature);
-
- synchronized (lock)
- {
- lastLookupEFeature = eFeature;
- lastLookupCDOFeature = cdoFeature;
- }
-
- return cdoFeature;
- }
+ // private EStructuralFeature getEStructuralFeature(InternalCDOObject cdoObject, EStructuralFeature feature)
+ // {
+ // synchronized (lock)
+ // {
+ // if (feature == lastLookupEFeature)
+ // {
+ // return lastLookupEStructuralFeature;
+ // }
+ // }
+ //
+ // InternalCDOView view = cdoObject.cdoView();
+ // if (view == null)
+ // {
+ // throw new IllegalStateException("view == null");
+ // }
+ //
+ // CDOSessionPackageManagerImpl packageManager = (CDOSessionPackageManagerImpl)view.getSession().getPackageManager();
+ // EStructuralFeature feature = packageManager.getEStructuralFeature(feature);
+ //
+ // synchronized (lock)
+ // {
+ // lastLookupEFeature = feature;
+ // lastLookupEStructuralFeature = feature;
+ // }
+ //
+ // return feature;
+ // }
private static InternalCDORevision getRevisionForReading(InternalCDOObject cdoObject)
{
diff --git a/plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/internal/cdo/analyzer/CDOAbstractFeatureRuleAnalyzer.java b/plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/internal/cdo/analyzer/CDOAbstractFeatureRuleAnalyzer.java
index c7b9a09c71..310ceec434 100644
--- a/plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/internal/cdo/analyzer/CDOAbstractFeatureRuleAnalyzer.java
+++ b/plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/internal/cdo/analyzer/CDOAbstractFeatureRuleAnalyzer.java
@@ -12,7 +12,6 @@
package org.eclipse.emf.internal.cdo.analyzer;
import org.eclipse.emf.cdo.CDOObject;
-import org.eclipse.emf.cdo.common.model.CDOFeature;
import org.eclipse.emf.cdo.session.CDOCollectionLoadingPolicy;
import org.eclipse.emf.cdo.view.CDOFeatureAnalyzer;
import org.eclipse.emf.cdo.view.CDOFetchRuleManager;
@@ -21,6 +20,8 @@ import org.eclipse.emf.internal.cdo.bundle.OM;
import org.eclipse.net4j.util.om.trace.ContextTracer;
+import org.eclipse.emf.ecore.EStructuralFeature;
+
/**
* @author Simon McDuff
*/
@@ -28,7 +29,7 @@ public abstract class CDOAbstractFeatureRuleAnalyzer implements CDOFeatureAnalyz
{
private static final ContextTracer TRACER = new ContextTracer(OM.DEBUG, CDOAbstractFeatureRuleAnalyzer.class);
- protected CDOFeature lastTraverseFeature;
+ protected EStructuralFeature lastTraverseFeature;
protected int lastTraverseIndex;
@@ -60,11 +61,11 @@ public abstract class CDOAbstractFeatureRuleAnalyzer implements CDOFeatureAnalyz
return loadCollectionPolicy;
}
- public void preTraverseFeature(CDOObject cdoObject, CDOFeature feature, int index)
+ public void preTraverseFeature(CDOObject cdoObject, EStructuralFeature feature, int index)
{
if (TRACER.isEnabled())
{
- TRACER.format("preTraverseFeature : {0}.{1}", cdoObject.cdoClass(), feature.getName());
+ TRACER.format("preTraverseFeature : {0}.{1}", cdoObject.eClass(), feature.getName());
}
loadCollectionPolicy = cdoObject.cdoView().getSession().options().getCollectionLoadingPolicy();
@@ -79,11 +80,11 @@ public abstract class CDOAbstractFeatureRuleAnalyzer implements CDOFeatureAnalyz
doPreTraverseFeature(cdoObject, feature, index);
}
- public void postTraverseFeature(CDOObject cdoObject, CDOFeature feature, int index, Object value)
+ public void postTraverseFeature(CDOObject cdoObject, EStructuralFeature feature, int index, Object value)
{
if (TRACER.isEnabled())
{
- TRACER.format("postTraverseFeature : {0}.{1}", cdoObject.cdoClass(), feature.getName());
+ TRACER.format("postTraverseFeature : {0}.{1}", cdoObject.eClass(), feature.getName());
}
try
@@ -97,11 +98,11 @@ public abstract class CDOAbstractFeatureRuleAnalyzer implements CDOFeatureAnalyz
}
}
- protected void doPreTraverseFeature(CDOObject cdoObject, CDOFeature feature, int index)
+ protected void doPreTraverseFeature(CDOObject cdoObject, EStructuralFeature feature, int index)
{
}
- protected void doPostTraverseFeature(CDOObject cdoObject, CDOFeature feature, int index, Object value)
+ protected void doPostTraverseFeature(CDOObject cdoObject, EStructuralFeature feature, int index, Object value)
{
}
diff --git a/plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/internal/cdo/analyzer/CDOAnalyzerFeatureInfo.java b/plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/internal/cdo/analyzer/CDOAnalyzerFeatureInfo.java
index 2d6d4a6527..d42e5e30a5 100644
--- a/plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/internal/cdo/analyzer/CDOAnalyzerFeatureInfo.java
+++ b/plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/internal/cdo/analyzer/CDOAnalyzerFeatureInfo.java
@@ -13,13 +13,14 @@
package org.eclipse.emf.internal.cdo.analyzer;
import org.eclipse.emf.cdo.common.CDOFetchRule;
-import org.eclipse.emf.cdo.common.model.CDOClass;
-import org.eclipse.emf.cdo.common.model.CDOFeature;
import org.eclipse.emf.internal.cdo.bundle.OM;
import org.eclipse.net4j.util.om.trace.ContextTracer;
+import org.eclipse.emf.ecore.EClass;
+import org.eclipse.emf.ecore.EStructuralFeature;
+
import java.util.Collection;
import java.util.HashMap;
import java.util.Map;
@@ -33,20 +34,20 @@ public class CDOAnalyzerFeatureInfo
private Map<CDOFetchFeatureInfo, CDOFetchFeatureInfo> featureStats = new HashMap<CDOFetchFeatureInfo, CDOFetchFeatureInfo>();
- private Map<CDOClass, CDOFetchRule> fetchRules = new HashMap<CDOClass, CDOFetchRule>();
+ private Map<EClass, CDOFetchRule> fetchRules = new HashMap<EClass, CDOFetchRule>();
public CDOAnalyzerFeatureInfo()
{
}
- public Collection<CDOFetchRule> getRules(CDOClass cdoClass, CDOFeature cdoFeature)
+ public Collection<CDOFetchRule> getRules(EClass eClass, EStructuralFeature feature)
{
return fetchRules.values();
}
- public synchronized CDOFetchFeatureInfo getFeatureStat(CDOClass cdoClass, CDOFeature cdoFeature)
+ public synchronized CDOFetchFeatureInfo getFeatureStat(EClass eClass, EStructuralFeature feature)
{
- CDOFetchFeatureInfo search = new CDOFetchFeatureInfo(cdoClass, cdoFeature);
+ CDOFetchFeatureInfo search = new CDOFetchFeatureInfo(eClass, feature);
CDOFetchFeatureInfo featureRule = featureStats.get(search);
if (featureRule == null)
{
@@ -57,63 +58,63 @@ public class CDOAnalyzerFeatureInfo
return featureRule;
}
- public boolean isActive(CDOClass cdoClass, CDOFeature cdoFeature)
+ public boolean isActive(EClass eClass, EStructuralFeature feature)
{
- CDOFetchFeatureInfo search = new CDOFetchFeatureInfo(cdoClass, cdoFeature);
+ CDOFetchFeatureInfo search = new CDOFetchFeatureInfo(eClass, feature);
CDOFetchFeatureInfo featureRule = featureStats.get(search);
return featureRule != null && featureRule.isActive();
}
- public void activate(CDOClass cdoClass, CDOFeature cdoFeature)
+ public void activate(EClass eClass, EStructuralFeature feature)
{
- CDOFetchFeatureInfo info = getFeatureStat(cdoClass, cdoFeature);
+ CDOFetchFeatureInfo info = getFeatureStat(eClass, feature);
if (!info.isActive())
{
info.setActive(true);
- addRule(cdoClass, cdoFeature);
+ addRule(eClass, feature);
}
}
- public void deactivate(CDOClass cdoClass, CDOFeature cdoFeature)
+ public void deactivate(EClass eClass, EStructuralFeature feature)
{
- CDOFetchFeatureInfo info = getFeatureStat(cdoClass, cdoFeature);
+ CDOFetchFeatureInfo info = getFeatureStat(eClass, feature);
if (info.isActive())
{
info.setActive(false);
- removeRule(cdoClass, cdoFeature);
+ removeRule(eClass, feature);
}
}
- private void addRule(CDOClass cdoClass, CDOFeature cdoFeature)
+ private void addRule(EClass eClass, EStructuralFeature feature)
{
if (TRACER.isEnabled())
{
- TRACER.format("Adding rule : {0}.{1}", cdoClass.getName(), cdoFeature.getName());
+ TRACER.format("Adding rule : {0}.{1}", eClass.getName(), feature.getName());
}
- CDOFetchRule fetchRule = fetchRules.get(cdoClass);
+ CDOFetchRule fetchRule = fetchRules.get(eClass);
if (fetchRule == null)
{
- fetchRule = new CDOFetchRule(cdoClass);
- fetchRules.put(cdoClass, fetchRule);
+ fetchRule = new CDOFetchRule(eClass);
+ fetchRules.put(eClass, fetchRule);
}
- fetchRule.addFeature(cdoFeature);
+ fetchRule.addFeature(feature);
}
- private void removeRule(CDOClass cdoClass, CDOFeature cdoFeature)
+ private void removeRule(EClass eClass, EStructuralFeature feature)
{
if (TRACER.isEnabled())
{
- TRACER.format("Removing rule : {0}.{1}", cdoClass.getName(), cdoFeature.getName());
+ TRACER.format("Removing rule : {0}.{1}", eClass.getName(), feature.getName());
}
- CDOFetchRule fetchRule = fetchRules.get(cdoClass);
+ CDOFetchRule fetchRule = fetchRules.get(eClass);
if (fetchRule == null)
{
return;
}
- fetchRule.removeFeature(cdoFeature);
+ fetchRule.removeFeature(feature);
}
}
diff --git a/plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/internal/cdo/analyzer/CDOClusterOfFetchRule.java b/plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/internal/cdo/analyzer/CDOClusterOfFetchRule.java
index ebeebee531..1e44411d21 100644
--- a/plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/internal/cdo/analyzer/CDOClusterOfFetchRule.java
+++ b/plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/internal/cdo/analyzer/CDOClusterOfFetchRule.java
@@ -11,8 +11,8 @@
*/
package org.eclipse.emf.internal.cdo.analyzer;
-import org.eclipse.emf.cdo.common.model.CDOClass;
-import org.eclipse.emf.cdo.common.model.CDOFeature;
+import org.eclipse.emf.ecore.EClass;
+import org.eclipse.emf.ecore.EStructuralFeature;
/**
* @author Simon McDuff
@@ -21,20 +21,20 @@ public class CDOClusterOfFetchRule
{
private CDOAnalyzerFeatureInfo featureInfo = new CDOAnalyzerFeatureInfo();
- private CDOFeature rootFeature;
+ private EStructuralFeature rootFeature;
- private CDOClass rootClass;
+ private EClass rootClass;
private long lastUpdate;
- public CDOClusterOfFetchRule(CDOClass rootClass, CDOFeature rootFeature)
+ public CDOClusterOfFetchRule(EClass rootClass, EStructuralFeature rootFeature)
{
this.rootFeature = rootFeature;
this.rootClass = rootClass;
lastUpdate = System.currentTimeMillis();
}
- public CDOFeature getRootFeature()
+ public EStructuralFeature getRootFeature()
{
return rootFeature;
}
diff --git a/plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/internal/cdo/analyzer/CDOFeatureAnalyzerModelBased.java b/plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/internal/cdo/analyzer/CDOFeatureAnalyzerModelBased.java
index 5b0fb5559b..91722e5864 100644
--- a/plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/internal/cdo/analyzer/CDOFeatureAnalyzerModelBased.java
+++ b/plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/internal/cdo/analyzer/CDOFeatureAnalyzerModelBased.java
@@ -14,7 +14,8 @@ package org.eclipse.emf.internal.cdo.analyzer;
import org.eclipse.emf.cdo.CDOObject;
import org.eclipse.emf.cdo.common.CDOFetchRule;
import org.eclipse.emf.cdo.common.id.CDOID;
-import org.eclipse.emf.cdo.common.model.CDOFeature;
+
+import org.eclipse.emf.ecore.EStructuralFeature;
import java.util.ArrayList;
import java.util.Collection;
@@ -32,16 +33,16 @@ public class CDOFeatureAnalyzerModelBased extends CDOAbstractFeatureRuleAnalyzer
}
@Override
- public void doPreTraverseFeature(CDOObject cdoObject, CDOFeature feature, int index)
+ public void doPreTraverseFeature(CDOObject cdoObject, EStructuralFeature feature, int index)
{
}
@Override
- public void doPostTraverseFeature(CDOObject cdoObject, CDOFeature feature, int index, Object value)
+ public void doPostTraverseFeature(CDOObject cdoObject, EStructuralFeature feature, int index, Object value)
{
if (didFetch())
{
- featureInfos.activate(cdoObject.cdoClass(), feature);
+ featureInfos.activate(cdoObject.eClass(), feature);
}
}
@@ -54,7 +55,7 @@ public class CDOFeatureAnalyzerModelBased extends CDOAbstractFeatureRuleAnalyzer
{
fetchData();
List<CDOFetchRule> rules = new ArrayList<CDOFetchRule>();
- rules.addAll(featureInfos.getRules(lastTraverseCDOObject.cdoClass(), lastTraverseFeature));
+ rules.addAll(featureInfos.getRules(lastTraverseCDOObject.eClass(), lastTraverseFeature));
return rules;
}
}
diff --git a/plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/internal/cdo/analyzer/CDOFeatureAnalyzerUI.java b/plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/internal/cdo/analyzer/CDOFeatureAnalyzerUI.java
index 762e34ecb0..2225a1d106 100644
--- a/plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/internal/cdo/analyzer/CDOFeatureAnalyzerUI.java
+++ b/plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/internal/cdo/analyzer/CDOFeatureAnalyzerUI.java
@@ -14,8 +14,10 @@ package org.eclipse.emf.internal.cdo.analyzer;
import org.eclipse.emf.cdo.CDOObject;
import org.eclipse.emf.cdo.common.CDOFetchRule;
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.ecore.EClass;
+import org.eclipse.emf.ecore.EReference;
+import org.eclipse.emf.ecore.EStructuralFeature;
import java.util.ArrayList;
import java.util.Collection;
@@ -56,9 +58,9 @@ public class CDOFeatureAnalyzerUI extends CDOAbstractFeatureRuleAnalyzer
return lastTraverseCDOObject.cdoID();
}
- public synchronized CDOClusterOfFetchRule getFeatureRule(CDOClass cdoClass, CDOFeature cdoFeature)
+ public synchronized CDOClusterOfFetchRule getFeatureRule(EClass eClass, EStructuralFeature feature)
{
- CDOClusterOfFetchRule search = new CDOClusterOfFetchRule(cdoClass, cdoFeature);
+ CDOClusterOfFetchRule search = new CDOClusterOfFetchRule(eClass, feature);
CDOClusterOfFetchRule featureRule = featureRules.get(search);
if (featureRule == null)
{
@@ -79,7 +81,7 @@ public class CDOFeatureAnalyzerUI extends CDOAbstractFeatureRuleAnalyzer
addRootFeature = false;
}
- CDOClusterOfFetchRule search = new CDOClusterOfFetchRule(lastTraverseCDOObject.cdoClass(), lastTraverseFeature);
+ CDOClusterOfFetchRule search = new CDOClusterOfFetchRule(lastTraverseCDOObject.eClass(), lastTraverseFeature);
CDOClusterOfFetchRule fetchOfRule = featureRules.get(search);
if (fetchOfRule == null)
{
@@ -90,7 +92,7 @@ public class CDOFeatureAnalyzerUI extends CDOAbstractFeatureRuleAnalyzer
List<CDOFetchRule> list = new ArrayList<CDOFetchRule>();
for (CDOFetchRule fetchRule : fetchRules)
{
- if (addRootFeature == true || lastTraverseCDOObject.cdoClass() != fetchRule.getCDOClass())
+ if (addRootFeature == true || lastTraverseCDOObject.eClass() != fetchRule.getEClass())
{
list.add(fetchRule);
}
@@ -100,27 +102,25 @@ public class CDOFeatureAnalyzerUI extends CDOAbstractFeatureRuleAnalyzer
}
@Override
- protected void doPreTraverseFeature(CDOObject cdoObject, CDOFeature feature, int index)
+ protected void doPreTraverseFeature(CDOObject cdoObject, EStructuralFeature feature, int index)
{
- // Don`t handle containment relationship
- if (!feature.isReference())
- {
- return;
- }
-
- if (lastElapseTimeBetweenOperations > maxTimeBetweenOperation || currentClusterOfFetchRule == null)
+ // Don`t handle containment relationship TODO Simon: Do yu really mean containment here? The check is different...
+ if (feature instanceof EReference)
{
- // The user interacted with the UI. Restart a new ClusterOfFetchRule
- currentClusterOfFetchRule = getFeatureRule(cdoObject.cdoClass(), feature);
+ if (lastElapseTimeBetweenOperations > maxTimeBetweenOperation || currentClusterOfFetchRule == null)
+ {
+ // The user interacted with the UI. Restart a new ClusterOfFetchRule
+ currentClusterOfFetchRule = getFeatureRule(cdoObject.eClass(), feature);
+ }
}
}
@Override
- protected void doPostTraverseFeature(CDOObject cdoObject, CDOFeature feature, int index, Object object)
+ protected void doPostTraverseFeature(CDOObject cdoObject, EStructuralFeature feature, int index, Object object)
{
if (didFetch())
{
- currentClusterOfFetchRule.getFeatureInfo().activate(cdoObject.cdoClass(), feature);
+ currentClusterOfFetchRule.getFeatureInfo().activate(cdoObject.eClass(), feature);
}
}
}
diff --git a/plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/internal/cdo/analyzer/CDOFetchFeatureInfo.java b/plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/internal/cdo/analyzer/CDOFetchFeatureInfo.java
index c2e036ead1..f61b0f9322 100644
--- a/plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/internal/cdo/analyzer/CDOFetchFeatureInfo.java
+++ b/plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/internal/cdo/analyzer/CDOFetchFeatureInfo.java
@@ -11,8 +11,8 @@
*/
package org.eclipse.emf.internal.cdo.analyzer;
-import org.eclipse.emf.cdo.common.model.CDOClass;
-import org.eclipse.emf.cdo.common.model.CDOFeature;
+import org.eclipse.emf.ecore.EClass;
+import org.eclipse.emf.ecore.EStructuralFeature;
/**
* @author Simon McDuff
@@ -25,26 +25,26 @@ public class CDOFetchFeatureInfo
private boolean active;
- private CDOClass cdoClass;
+ private EClass eClass;
- private CDOFeature cdoFeature;
+ private EStructuralFeature feature;
- public CDOFetchFeatureInfo(CDOClass cdoClass, CDOFeature cdoFeature)
+ public CDOFetchFeatureInfo(EClass eClass, EStructuralFeature feature)
{
- this.cdoClass = cdoClass;
- this.cdoFeature = cdoFeature;
+ this.eClass = eClass;
+ this.feature = feature;
active = false;
latencyTime = -1;
}
- public CDOClass getCDOClass()
+ public EClass getEClass()
{
- return cdoClass;
+ return eClass;
}
- public CDOFeature getCDOFeature()
+ public EStructuralFeature getEStructuralFeature()
{
- return cdoFeature;
+ return feature;
}
public boolean isActive()
@@ -104,7 +104,7 @@ public class CDOFetchFeatureInfo
@Override
public int hashCode()
{
- return cdoClass.hashCode() ^ cdoFeature.hashCode();
+ return eClass.hashCode() ^ feature.hashCode();
}
@Override
@@ -118,7 +118,7 @@ public class CDOFetchFeatureInfo
if (obj instanceof CDOFetchFeatureInfo)
{
CDOFetchFeatureInfo featureInfo = (CDOFetchFeatureInfo)obj;
- return featureInfo.cdoClass == cdoClass && featureInfo.cdoFeature == cdoFeature;
+ return featureInfo.eClass == eClass && featureInfo.feature == feature;
}
return false;
diff --git a/plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/internal/cdo/analyzer/NOOPFeatureAnalyzer.java b/plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/internal/cdo/analyzer/NOOPFeatureAnalyzer.java
index 94e67e24fc..642aa6716d 100644
--- a/plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/internal/cdo/analyzer/NOOPFeatureAnalyzer.java
+++ b/plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/internal/cdo/analyzer/NOOPFeatureAnalyzer.java
@@ -12,9 +12,10 @@
package org.eclipse.emf.internal.cdo.analyzer;
import org.eclipse.emf.cdo.CDOObject;
-import org.eclipse.emf.cdo.common.model.CDOFeature;
import org.eclipse.emf.cdo.view.CDOFeatureAnalyzer;
+import org.eclipse.emf.ecore.EStructuralFeature;
+
/**
* @author Simon McDuff
*/
@@ -24,11 +25,11 @@ public class NOOPFeatureAnalyzer implements CDOFeatureAnalyzer
{
}
- public void preTraverseFeature(CDOObject cdoClass, CDOFeature feature, int index)
+ public void preTraverseFeature(CDOObject eClass, EStructuralFeature feature, int index)
{
}
- public void postTraverseFeature(CDOObject cdoClass, CDOFeature feature, int index, Object value)
+ public void postTraverseFeature(CDOObject eClass, EStructuralFeature feature, int index, Object value)
{
}
}
diff --git a/plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/internal/cdo/analyzer/NOOPFetchRuleManager.java b/plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/internal/cdo/analyzer/NOOPFetchRuleManager.java
index 6da4c0a03b..2bedf202b8 100644
--- a/plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/internal/cdo/analyzer/NOOPFetchRuleManager.java
+++ b/plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/internal/cdo/analyzer/NOOPFetchRuleManager.java
@@ -42,4 +42,10 @@ public class NOOPFetchRuleManager implements CDOFetchRuleManager
{
return CDOCollectionLoadingPolicy.DEFAULT;
}
+
+ @Override
+ public String toString()
+ {
+ return "NOOP";
+ }
}
diff --git a/plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/internal/cdo/bundle/Activator.java b/plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/internal/cdo/bundle/Activator.java
index 59ebd730ad..52ea29e181 100644
--- a/plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/internal/cdo/bundle/Activator.java
+++ b/plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/internal/cdo/bundle/Activator.java
@@ -10,7 +10,6 @@
*/
package org.eclipse.emf.internal.cdo.bundle;
-import org.eclipse.emf.internal.cdo.session.CDOPackageTypeRegistryImpl;
import org.eclipse.emf.internal.cdo.view.CDOViewProviderRegistryImpl;
import org.eclipse.net4j.util.om.OSGiActivator;
@@ -125,7 +124,7 @@ public final class Activator extends EMFPlugin
protected void doStop() throws Exception
{
CDOViewProviderRegistryImpl.INSTANCE.deactivate();
- CDOPackageTypeRegistryImpl.INSTANCE.deactivate();
+ // CDOPackageTypeRegistryImpl.INSTANCE.deactivate();
}
}
}
diff --git a/plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/internal/cdo/bundle/OM.java b/plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/internal/cdo/bundle/OM.java
index 466966be8e..7b1f2d3f16 100644
--- a/plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/internal/cdo/bundle/OM.java
+++ b/plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/internal/cdo/bundle/OM.java
@@ -13,6 +13,8 @@ package org.eclipse.emf.internal.cdo.bundle;
import org.eclipse.emf.cdo.common.revision.CDORevision;
import org.eclipse.emf.cdo.view.CDOView;
+import org.eclipse.emf.internal.cdo.net4j.protocol.CommitTransactionRequest;
+
import org.eclipse.net4j.util.om.OMBundle;
import org.eclipse.net4j.util.om.OMPlatform;
import org.eclipse.net4j.util.om.log.OMLogger;
@@ -84,4 +86,10 @@ public abstract class OM
public static final OMPreference<Integer> PREF_REVISION_LOADING_CHUNK_SIZE = //
PREFS.init("PREF_REVISION_LOADING_CHUNK_SIZE", CDOView.Options.NO_REVISION_PREFETCHING); //$NON-NLS-1$
+
+ public static final OMPreference<Integer> PREF_COMMIT_MONITOR_PROGRESS_SECONDS = //
+ PREFS.init("PREF_COMMIT_MONITOR_PROGRESS_SECONDS", CommitTransactionRequest.DEFAULT_MONITOR_PROGRESS_SECONDS); //$NON-NLS-1$
+
+ public static final OMPreference<Integer> PREF_COMMIT_MONITOR_TIMEOUT_SECONDS = //
+ PREFS.init("PREF_COMMIT_MONITOR_TIMEOUT_SECONDS", CommitTransactionRequest.DEFAULT_MONITOR_TIMEOUT_SECONDS); //$NON-NLS-1$
}
diff --git a/plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/internal/cdo/net4j/CDONet4jSessionFactory.java b/plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/internal/cdo/net4j/CDONet4jSessionFactory.java
index 4e1168081e..eb58a21aa4 100644
--- a/plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/internal/cdo/net4j/CDONet4jSessionFactory.java
+++ b/plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/internal/cdo/net4j/CDONet4jSessionFactory.java
@@ -14,7 +14,6 @@ import org.eclipse.emf.cdo.net4j.CDONet4jUtil;
import org.eclipse.emf.cdo.net4j.CDOSessionConfiguration;
import org.eclipse.emf.cdo.session.CDOSession;
-import org.eclipse.emf.internal.cdo.session.CDOPackageRegistryImpl;
import org.eclipse.emf.internal.cdo.session.CDOSessionFactory;
import org.eclipse.net4j.util.container.IManagedContainer;
@@ -51,10 +50,10 @@ public class CDONet4jSessionFactory extends CDOSessionFactory
// The session will be activated by the container
configuration.setActivateOnOpen(false);
configuration.setRepositoryName(repositoryName);
- if (automaticPackageRegistry)
- {
- configuration.setPackageRegistry(new CDOPackageRegistryImpl.Eager());
- }
+ // if (automaticPackageRegistry)
+ // {
+ // configuration.setPackageRegistry(new CDOPackageRegistryImpl.Eager());
+ // }
return (InternalCDOSession)configuration.openSession();
}
diff --git a/plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/internal/cdo/net4j/protocol/CDOClientIndication.java b/plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/internal/cdo/net4j/protocol/CDOClientIndication.java
index 4d5ae358cc..e1376949f0 100644
--- a/plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/internal/cdo/net4j/protocol/CDOClientIndication.java
+++ b/plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/internal/cdo/net4j/protocol/CDOClientIndication.java
@@ -13,20 +13,16 @@ package org.eclipse.emf.internal.cdo.net4j.protocol;
import org.eclipse.emf.cdo.common.id.CDOIDObjectFactory;
import org.eclipse.emf.cdo.common.io.CDODataInput;
-import org.eclipse.emf.cdo.common.model.CDOPackageManager;
-import org.eclipse.emf.cdo.common.model.CDOPackageURICompressor;
+import org.eclipse.emf.cdo.common.model.CDOPackageRegistry;
import org.eclipse.emf.cdo.common.revision.CDOListFactory;
-import org.eclipse.emf.cdo.common.revision.CDORevision;
-import org.eclipse.emf.cdo.common.revision.CDORevisionFactory;
import org.eclipse.emf.cdo.common.revision.CDORevisionResolver;
import org.eclipse.emf.cdo.internal.common.io.CDODataInputImpl;
-import org.eclipse.emf.cdo.session.CDORevisionManager;
-import org.eclipse.emf.cdo.session.CDOSessionPackageManager;
import org.eclipse.emf.internal.cdo.revision.CDOListWithElementProxiesImpl;
import org.eclipse.net4j.signal.Indication;
import org.eclipse.net4j.util.io.ExtendedDataInputStream;
+import org.eclipse.net4j.util.io.StringIO;
import org.eclipse.emf.spi.cdo.InternalCDOSession;
@@ -50,27 +46,7 @@ public abstract class CDOClientIndication extends Indication
protected InternalCDOSession getSession()
{
- return (InternalCDOSession)getProtocol().getInfraStructure();
- }
-
- protected CDORevisionManager getRevisionManager()
- {
- return getSession().getRevisionManager();
- }
-
- protected CDOSessionPackageManager getPackageManager()
- {
- return getSession().getPackageManager();
- }
-
- protected CDOPackageURICompressor getPackageURICompressor()
- {
- return getSession();
- }
-
- protected CDOIDObjectFactory getIDFactory()
- {
- return getSession();
+ return (InternalCDOSession)getProtocol().getSession();
}
@Override
@@ -79,41 +55,35 @@ public abstract class CDOClientIndication extends Indication
indicating(new CDODataInputImpl(in)
{
@Override
- protected CDORevision readCDORevisionData() throws IOException
+ protected CDOIDObjectFactory getIDFactory()
{
- CDORevisionFactory factory = getSession().options().getRevisionFactory();
- return factory.createRevision(this);
+ return getSession();
}
@Override
- protected CDORevisionResolver getRevisionResolver()
+ protected StringIO getPackageURICompressor()
{
- return CDOClientIndication.this.getRevisionManager();
+ return getProtocol().getPackageURICompressor();
}
@Override
- protected CDOPackageManager getPackageManager()
+ protected CDOListFactory getListFactory()
{
- return CDOClientIndication.this.getPackageManager();
+ return CDOListWithElementProxiesImpl.FACTORY;
}
@Override
- protected CDOPackageURICompressor getPackageURICompressor()
+ protected CDOPackageRegistry getPackageRegistry()
{
- return CDOClientIndication.this.getPackageURICompressor();
+ return getSession().getPackageRegistry();
}
@Override
- protected CDOIDObjectFactory getIDFactory()
+ protected CDORevisionResolver getRevisionResolver()
{
- return CDOClientIndication.this.getIDFactory();
+ return getSession().getRevisionManager();
}
- @Override
- protected CDOListFactory getListFactory()
- {
- return CDOListWithElementProxiesImpl.FACTORY;
- }
});
}
diff --git a/plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/internal/cdo/net4j/protocol/CDOClientProtocol.java b/plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/internal/cdo/net4j/protocol/CDOClientProtocol.java
index 7141432a04..94f0cf18fc 100644
--- a/plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/internal/cdo/net4j/protocol/CDOClientProtocol.java
+++ b/plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/internal/cdo/net4j/protocol/CDOClientProtocol.java
@@ -12,14 +12,14 @@ package org.eclipse.emf.internal.cdo.net4j.protocol;
import org.eclipse.emf.cdo.CDOObject;
import org.eclipse.emf.cdo.common.id.CDOID;
-import org.eclipse.emf.cdo.common.model.CDOFeature;
-import org.eclipse.emf.cdo.common.model.CDOPackage;
+import org.eclipse.emf.cdo.common.model.CDOPackageUnit;
import org.eclipse.emf.cdo.common.protocol.CDOProtocolConstants;
import org.eclipse.emf.cdo.common.revision.CDORevision;
import org.eclipse.emf.cdo.common.util.TransportException;
import org.eclipse.emf.cdo.internal.common.protocol.CDOProtocolImpl;
import org.eclipse.emf.cdo.session.CDOSession;
import org.eclipse.emf.cdo.session.remote.CDORemoteSession;
+import org.eclipse.emf.cdo.spi.common.model.InternalCDOPackageUnit;
import org.eclipse.emf.cdo.spi.common.revision.InternalCDORevision;
import org.eclipse.emf.cdo.transaction.CDOTimeStampContext;
import org.eclipse.emf.cdo.view.CDOView;
@@ -32,9 +32,13 @@ import org.eclipse.net4j.signal.RequestWithConfirmation;
import org.eclipse.net4j.signal.SignalReactor;
import org.eclipse.net4j.util.WrappedException;
import org.eclipse.net4j.util.concurrent.RWLockManager.LockType;
+import org.eclipse.net4j.util.io.StringCompressor;
+import org.eclipse.net4j.util.io.StringIO;
import org.eclipse.net4j.util.om.monitor.OMMonitor;
import org.eclipse.net4j.util.om.trace.PerfTracer;
+import org.eclipse.emf.ecore.EPackage;
+import org.eclipse.emf.ecore.EStructuralFeature;
import org.eclipse.emf.spi.cdo.AbstractQueryIterator;
import org.eclipse.emf.spi.cdo.CDOSessionProtocol;
import org.eclipse.emf.spi.cdo.InternalCDOObject;
@@ -56,14 +60,15 @@ public class CDOClientProtocol extends CDOProtocolImpl implements CDOSessionProt
private static final PerfTracer REVISION_LOADING = new PerfTracer(OM.PERF_REVISION_LOADING,
CDORevisionManagerImpl.class);
+ private StringCompressor packageURICompressor = new StringCompressor(true);
+
public CDOClientProtocol()
{
}
- @Override
- public CDOSession getSession()
+ public StringIO getPackageURICompressor()
{
- return (CDOSession)super.getSession();
+ return packageURICompressor;
}
public OpenSessionResult openSession(String repositoryName, boolean passiveUpdateEnabled)
@@ -87,12 +92,12 @@ public class CDOClientProtocol extends CDOProtocolImpl implements CDOSessionProt
return send(new RepositoryTimeRequest(this));
}
- public void loadPackage(CDOPackage cdoPackage, boolean onlyEcore)
+ public EPackage[] loadPackages(CDOPackageUnit packageUnit)
{
- send(new LoadPackageRequest(this, cdoPackage, onlyEcore));
+ return send(new LoadPackagesRequest(this, (InternalCDOPackageUnit)packageUnit));
}
- public Object loadChunk(InternalCDORevision revision, CDOFeature feature, int accessIndex, int fetchIndex,
+ public Object loadChunk(InternalCDORevision revision, EStructuralFeature feature, int accessIndex, int fetchIndex,
int fromIndex, int toIndex)
{
return send(new LoadChunkRequest(this, revision, feature, accessIndex, fetchIndex, fromIndex, toIndex));
diff --git a/plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/internal/cdo/net4j/protocol/CDOClientRequest.java b/plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/internal/cdo/net4j/protocol/CDOClientRequest.java
index 84f8c1e5ca..714973e61c 100644
--- a/plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/internal/cdo/net4j/protocol/CDOClientRequest.java
+++ b/plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/internal/cdo/net4j/protocol/CDOClientRequest.java
@@ -15,20 +15,18 @@ import org.eclipse.emf.cdo.common.id.CDOIDObjectFactory;
import org.eclipse.emf.cdo.common.id.CDOIDProvider;
import org.eclipse.emf.cdo.common.io.CDODataInput;
import org.eclipse.emf.cdo.common.io.CDODataOutput;
-import org.eclipse.emf.cdo.common.model.CDOPackageManager;
-import org.eclipse.emf.cdo.common.model.CDOPackageURICompressor;
+import org.eclipse.emf.cdo.common.model.CDOPackageRegistry;
import org.eclipse.emf.cdo.common.revision.CDOListFactory;
import org.eclipse.emf.cdo.common.revision.CDORevisionResolver;
import org.eclipse.emf.cdo.internal.common.io.CDODataInputImpl;
import org.eclipse.emf.cdo.internal.common.io.CDODataOutputImpl;
-import org.eclipse.emf.cdo.session.CDORevisionManager;
-import org.eclipse.emf.cdo.session.CDOSessionPackageManager;
import org.eclipse.emf.internal.cdo.revision.CDOListWithElementProxiesImpl;
import org.eclipse.net4j.signal.RequestWithConfirmation;
import org.eclipse.net4j.util.io.ExtendedDataInputStream;
import org.eclipse.net4j.util.io.ExtendedDataOutputStream;
+import org.eclipse.net4j.util.io.StringIO;
import org.eclipse.emf.spi.cdo.InternalCDOSession;
@@ -52,32 +50,7 @@ public abstract class CDOClientRequest<RESULT> extends RequestWithConfirmation<R
protected InternalCDOSession getSession()
{
- return (InternalCDOSession)getProtocol().getInfraStructure();
- }
-
- protected CDORevisionManager getRevisionManager()
- {
- return getSession().getRevisionManager();
- }
-
- protected CDOSessionPackageManager getPackageManager()
- {
- return getSession().getPackageManager();
- }
-
- protected CDOPackageURICompressor getPackageURICompressor()
- {
- return getSession();
- }
-
- protected CDOIDProvider getIDProvider()
- {
- throw new UnsupportedOperationException();
- }
-
- protected CDOIDObjectFactory getIDFactory()
- {
- return getSession();
+ return (InternalCDOSession)getProtocol().getSession();
}
@Override
@@ -85,15 +58,15 @@ public abstract class CDOClientRequest<RESULT> extends RequestWithConfirmation<R
{
requesting(new CDODataOutputImpl(out)
{
- @Override
- protected CDOPackageURICompressor getPackageURICompressor()
+ public CDOIDProvider getIDProvider()
{
- return CDOClientRequest.this.getPackageURICompressor();
+ throw new UnsupportedOperationException();
}
- public CDOIDProvider getIDProvider()
+ @Override
+ protected StringIO getPackageURICompressor()
{
- return CDOClientRequest.this.getIDProvider();
+ return getProtocol().getPackageURICompressor();
}
});
}
@@ -104,33 +77,33 @@ public abstract class CDOClientRequest<RESULT> extends RequestWithConfirmation<R
return confirming(new CDODataInputImpl(in)
{
@Override
- protected CDORevisionResolver getRevisionResolver()
+ protected CDOIDObjectFactory getIDFactory()
{
- return CDOClientRequest.this.getRevisionManager();
+ return getSession();
}
@Override
- protected CDOPackageManager getPackageManager()
+ protected CDOListFactory getListFactory()
{
- return CDOClientRequest.this.getPackageManager();
+ return CDOListWithElementProxiesImpl.FACTORY;
}
@Override
- protected CDOPackageURICompressor getPackageURICompressor()
+ protected CDOPackageRegistry getPackageRegistry()
{
- return CDOClientRequest.this.getPackageURICompressor();
+ return getSession().getPackageRegistry();
}
@Override
- protected CDOIDObjectFactory getIDFactory()
+ protected StringIO getPackageURICompressor()
{
- return CDOClientRequest.this.getIDFactory();
+ return getProtocol().getPackageURICompressor();
}
@Override
- protected CDOListFactory getListFactory()
+ protected CDORevisionResolver getRevisionResolver()
{
- return CDOListWithElementProxiesImpl.FACTORY;
+ return getSession().getRevisionManager();
}
});
}
diff --git a/plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/internal/cdo/net4j/protocol/CDOTimeRequest.java b/plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/internal/cdo/net4j/protocol/CDOTimeRequest.java
index 275d037ceb..45b0528921 100644
--- a/plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/internal/cdo/net4j/protocol/CDOTimeRequest.java
+++ b/plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/internal/cdo/net4j/protocol/CDOTimeRequest.java
@@ -26,7 +26,7 @@ import java.io.IOException;
*/
public abstract class CDOTimeRequest<RESULT> extends CDOClientRequest<RESULT>
{
- private static final ContextTracer PROTOCOL_TRACER = new ContextTracer(OM.DEBUG_PROTOCOL, CDOTimeRequest.class);
+ private static final ContextTracer TRACER = new ContextTracer(OM.DEBUG_PROTOCOL, CDOTimeRequest.class);
private RepositoryTimeResult repositoryTimeResult = new RepositoryTimeResult();
@@ -44,9 +44,9 @@ public abstract class CDOTimeRequest<RESULT> extends CDOClientRequest<RESULT>
protected void requesting(CDODataOutput out) throws IOException
{
repositoryTimeResult.setRequested(System.currentTimeMillis());
- if (PROTOCOL_TRACER.isEnabled())
+ if (TRACER.isEnabled())
{
- PROTOCOL_TRACER.format("Requested: {0,date} {0,time}", repositoryTimeResult.getRequested());
+ TRACER.format("Requested: {0,date} {0,time}", repositoryTimeResult.getRequested());
}
}
@@ -54,21 +54,21 @@ public abstract class CDOTimeRequest<RESULT> extends CDOClientRequest<RESULT>
protected RESULT confirming(CDODataInput in) throws IOException
{
repositoryTimeResult.setConfirmed(System.currentTimeMillis());
- if (PROTOCOL_TRACER.isEnabled())
+ if (TRACER.isEnabled())
{
- PROTOCOL_TRACER.format("Confirmed: {0,date} {0,time}", repositoryTimeResult.getConfirmed());
+ TRACER.format("Confirmed: {0,date} {0,time}", repositoryTimeResult.getConfirmed());
}
repositoryTimeResult.setIndicated(in.readLong());
- if (PROTOCOL_TRACER.isEnabled())
+ if (TRACER.isEnabled())
{
- PROTOCOL_TRACER.format("Read indicated: {0,date} {0,time}", repositoryTimeResult.getIndicated());
+ TRACER.format("Read indicated: {0,date} {0,time}", repositoryTimeResult.getIndicated());
}
repositoryTimeResult.setResponded(in.readLong());
- if (PROTOCOL_TRACER.isEnabled())
+ if (TRACER.isEnabled())
{
- PROTOCOL_TRACER.format("Read responded: {0,date} {0,time}", repositoryTimeResult.getResponded());
+ TRACER.format("Read responded: {0,date} {0,time}", repositoryTimeResult.getResponded());
}
return null;
diff --git a/plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/internal/cdo/net4j/protocol/ChangeSubscriptionRequest.java b/plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/internal/cdo/net4j/protocol/ChangeSubscriptionRequest.java
index 85163bfca9..1c6e60c08a 100644
--- a/plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/internal/cdo/net4j/protocol/ChangeSubscriptionRequest.java
+++ b/plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/internal/cdo/net4j/protocol/ChangeSubscriptionRequest.java
@@ -29,8 +29,7 @@ import java.util.List;
*/
public class ChangeSubscriptionRequest extends CDOClientRequest<Boolean>
{
- private static final ContextTracer PROTOCOL_TRACER = new ContextTracer(OM.DEBUG_PROTOCOL,
- ChangeSubscriptionRequest.class);
+ private static final ContextTracer TRACER = new ContextTracer(OM.DEBUG_PROTOCOL, ChangeSubscriptionRequest.class);
private int viewID;
@@ -57,9 +56,9 @@ public class ChangeSubscriptionRequest extends CDOClientRequest<Boolean>
@Override
protected void requesting(CDODataOutput out) throws IOException
{
- if (PROTOCOL_TRACER.isEnabled())
+ if (TRACER.isEnabled())
{
- PROTOCOL_TRACER.trace("View " + viewID + " subscribing to " + cdoIDs.size());
+ TRACER.trace("View " + viewID + " subscribing to " + cdoIDs.size());
}
out.writeInt(viewID);
diff --git a/plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/internal/cdo/net4j/protocol/CommitNotificationIndication.java b/plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/internal/cdo/net4j/protocol/CommitNotificationIndication.java
index 45aaeb5b52..1d503bb412 100644
--- a/plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/internal/cdo/net4j/protocol/CommitNotificationIndication.java
+++ b/plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/internal/cdo/net4j/protocol/CommitNotificationIndication.java
@@ -14,8 +14,11 @@ package org.eclipse.emf.internal.cdo.net4j.protocol;
import org.eclipse.emf.cdo.common.id.CDOID;
import org.eclipse.emf.cdo.common.id.CDOIDAndVersion;
import org.eclipse.emf.cdo.common.io.CDODataInput;
+import org.eclipse.emf.cdo.common.model.CDOPackageUnit;
import org.eclipse.emf.cdo.common.protocol.CDOProtocolConstants;
import org.eclipse.emf.cdo.common.revision.delta.CDORevisionDelta;
+import org.eclipse.emf.cdo.spi.common.model.InternalCDOPackageRegistry;
+import org.eclipse.emf.cdo.spi.common.model.InternalCDOPackageUnit;
import org.eclipse.emf.internal.cdo.bundle.OM;
@@ -34,8 +37,7 @@ import java.util.Set;
*/
public class CommitNotificationIndication extends CDOClientIndication
{
- private static final ContextTracer PROTOCOL_TRACER = new ContextTracer(OM.DEBUG_PROTOCOL,
- CommitNotificationIndication.class);
+ private static final ContextTracer TRACER = new ContextTracer(OM.DEBUG_PROTOCOL, CommitNotificationIndication.class);
public CommitNotificationIndication(CDOClientProtocol protocol)
{
@@ -46,15 +48,22 @@ public class CommitNotificationIndication extends CDOClientIndication
protected void indicating(CDODataInput in) throws IOException
{
long timeStamp = in.readLong();
- if (PROTOCOL_TRACER.isEnabled())
+ if (TRACER.isEnabled())
{
- PROTOCOL_TRACER.format("Read timeStamp: {0,date} {0,time}", timeStamp);
+ TRACER.format("Read timeStamp: {0,date} {0,time}", timeStamp);
+ }
+
+ CDOPackageUnit[] packageUnits = in.readCDOPackageUnits(null);
+ InternalCDOPackageRegistry packageRegistry = (InternalCDOPackageRegistry)getSession().getPackageRegistry();
+ for (int i = 0; i < packageUnits.length; i++)
+ {
+ packageRegistry.putPackageUnit((InternalCDOPackageUnit)packageUnits[i]);
}
int size = in.readInt();
- if (PROTOCOL_TRACER.isEnabled())
+ if (TRACER.isEnabled())
{
- PROTOCOL_TRACER.format("Reading {0} dirty IDs", size);
+ TRACER.format("Reading {0} dirty IDs", size);
}
InternalCDOSession session = getSession();
@@ -62,18 +71,18 @@ public class CommitNotificationIndication extends CDOClientIndication
for (int i = 0; i < size; i++)
{
CDOIDAndVersion dirtyOID = in.readCDOIDAndVersion();
- if (PROTOCOL_TRACER.isEnabled())
+ if (TRACER.isEnabled())
{
- PROTOCOL_TRACER.format("Read dirty ID: {0}", dirtyOID);
+ TRACER.format("Read dirty ID: {0}", dirtyOID);
}
dirtyOIDs.add(dirtyOID);
}
size = in.readInt();
- if (PROTOCOL_TRACER.isEnabled())
+ if (TRACER.isEnabled())
{
- PROTOCOL_TRACER.format("Reading {0} Deltas", size);
+ TRACER.format("Reading {0} Deltas", size);
}
List<CDORevisionDelta> deltas = new ArrayList<CDORevisionDelta>();
@@ -84,9 +93,9 @@ public class CommitNotificationIndication extends CDOClientIndication
}
size = in.readInt();
- if (PROTOCOL_TRACER.isEnabled())
+ if (TRACER.isEnabled())
{
- PROTOCOL_TRACER.format("Reading {0} Detach Objects", size);
+ TRACER.format("Reading {0} Detach Objects", size);
}
List<CDOID> detachedObjects = new ArrayList<CDOID>();
diff --git a/plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/internal/cdo/net4j/protocol/CommitTransactionRequest.java b/plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/internal/cdo/net4j/protocol/CommitTransactionRequest.java
index adecc57212..876fa6e56b 100644
--- a/plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/internal/cdo/net4j/protocol/CommitTransactionRequest.java
+++ b/plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/internal/cdo/net4j/protocol/CommitTransactionRequest.java
@@ -22,9 +22,9 @@ import org.eclipse.emf.cdo.common.id.CDOIDTemp;
import org.eclipse.emf.cdo.common.id.CDOIDUtil;
import org.eclipse.emf.cdo.common.io.CDODataInput;
import org.eclipse.emf.cdo.common.io.CDODataOutput;
-import org.eclipse.emf.cdo.common.model.CDOPackage;
-import org.eclipse.emf.cdo.common.model.CDOPackageManager;
-import org.eclipse.emf.cdo.common.model.CDOPackageURICompressor;
+import org.eclipse.emf.cdo.common.model.CDOPackageInfo;
+import org.eclipse.emf.cdo.common.model.CDOPackageRegistry;
+import org.eclipse.emf.cdo.common.model.CDOPackageUnit;
import org.eclipse.emf.cdo.common.protocol.CDOProtocolConstants;
import org.eclipse.emf.cdo.common.revision.CDOListFactory;
import org.eclipse.emf.cdo.common.revision.CDORevision;
@@ -33,9 +33,8 @@ import org.eclipse.emf.cdo.common.revision.delta.CDORevisionDelta;
import org.eclipse.emf.cdo.eresource.CDOResource;
import org.eclipse.emf.cdo.internal.common.io.CDODataInputImpl;
import org.eclipse.emf.cdo.internal.common.io.CDODataOutputImpl;
-import org.eclipse.emf.cdo.session.CDORevisionManager;
-import org.eclipse.emf.cdo.session.CDOSessionPackageManager;
-import org.eclipse.emf.cdo.spi.common.model.InternalCDOPackage;
+import org.eclipse.emf.cdo.spi.common.model.InternalCDOPackageInfo;
+import org.eclipse.emf.cdo.spi.common.model.InternalCDOPackageRegistry;
import org.eclipse.emf.internal.cdo.bundle.OM;
import org.eclipse.emf.internal.cdo.revision.CDOListWithElementProxiesImpl;
@@ -43,6 +42,7 @@ import org.eclipse.emf.internal.cdo.revision.CDOListWithElementProxiesImpl;
import org.eclipse.net4j.signal.RequestWithMonitoring;
import org.eclipse.net4j.util.io.ExtendedDataInputStream;
import org.eclipse.net4j.util.io.ExtendedDataOutputStream;
+import org.eclipse.net4j.util.io.StringIO;
import org.eclipse.net4j.util.om.monitor.OMMonitor;
import org.eclipse.net4j.util.om.trace.ContextTracer;
@@ -60,8 +60,7 @@ import java.util.List;
*/
public class CommitTransactionRequest extends RequestWithMonitoring<CommitTransactionResult>
{
- private static final ContextTracer PROTOCOL_TRACER = new ContextTracer(OM.DEBUG_PROTOCOL,
- CommitTransactionRequest.class);
+ private static final ContextTracer TRACER = new ContextTracer(OM.DEBUG_PROTOCOL, CommitTransactionRequest.class);
protected InternalCDOCommitContext commitContext;
@@ -89,22 +88,7 @@ public class CommitTransactionRequest extends RequestWithMonitoring<CommitTransa
protected InternalCDOSession getSession()
{
- return (InternalCDOSession)getProtocol().getInfraStructure();
- }
-
- protected CDORevisionManager getRevisionManager()
- {
- return getSession().getRevisionManager();
- }
-
- protected CDOSessionPackageManager getPackageManager()
- {
- return getSession().getPackageManager();
- }
-
- protected CDOPackageURICompressor getPackageURICompressor()
- {
- return getSession();
+ return (InternalCDOSession)getProtocol().getSession();
}
protected CDOIDProvider getIDProvider()
@@ -112,20 +96,15 @@ public class CommitTransactionRequest extends RequestWithMonitoring<CommitTransa
return commitContext.getTransaction();
}
- protected CDOIDObjectFactory getIDFactory()
- {
- return getSession();
- }
-
@Override
protected final void requesting(ExtendedDataOutputStream out, OMMonitor monitor) throws Exception
{
requesting(new CDODataOutputImpl(out)
{
@Override
- protected CDOPackageURICompressor getPackageURICompressor()
+ protected StringIO getPackageURICompressor()
{
- return CommitTransactionRequest.this.getPackageURICompressor();
+ return getProtocol().getPackageURICompressor();
}
public CDOIDProvider getIDProvider()
@@ -141,27 +120,27 @@ public class CommitTransactionRequest extends RequestWithMonitoring<CommitTransa
return confirming(new CDODataInputImpl(in)
{
@Override
- protected CDORevisionResolver getRevisionResolver()
+ protected StringIO getPackageURICompressor()
{
- return CommitTransactionRequest.this.getRevisionManager();
+ return getProtocol().getPackageURICompressor();
}
@Override
- protected CDOPackageManager getPackageManager()
+ protected CDOPackageRegistry getPackageRegistry()
{
- return CommitTransactionRequest.this.getPackageManager();
+ return getSession().getPackageRegistry();
}
@Override
- protected CDOPackageURICompressor getPackageURICompressor()
+ protected CDORevisionResolver getRevisionResolver()
{
- return CommitTransactionRequest.this.getPackageURICompressor();
+ return getSession().getRevisionManager();
}
@Override
protected CDOIDObjectFactory getIDFactory()
{
- return CommitTransactionRequest.this.getIDFactory();
+ return getSession();
}
@Override
@@ -199,45 +178,39 @@ public class CommitTransactionRequest extends RequestWithMonitoring<CommitTransa
protected void requestingCommit(CDODataOutput out) throws IOException
{
- List<CDOPackage> newPackages = commitContext.getNewPackages();
+ List<CDOPackageUnit> newPackageUnits = commitContext.getNewPackageUnits();
Collection<CDOResource> newResources = commitContext.getNewResources().values();
Collection<CDOObject> newObjects = commitContext.getNewObjects().values();
Collection<CDORevisionDelta> revisionDeltas = commitContext.getRevisionDeltas().values();
Collection<CDOID> detachedObjects = commitContext.getDetachedObjects().keySet();
out.writeBoolean(commitContext.getTransaction().options().isAutoReleaseLocksEnabled());
- out.writeInt(newPackages.size());
+ out.writeInt(newPackageUnits.size());
out.writeInt(newResources.size() + newObjects.size());
out.writeInt(revisionDeltas.size());
out.writeInt(detachedObjects.size());
- if (PROTOCOL_TRACER.isEnabled())
+ if (TRACER.isEnabled())
{
- PROTOCOL_TRACER.format("Writing {0} new packages", newPackages.size());
+ TRACER.format("Writing {0} new package units", newPackageUnits.size());
}
- for (CDOPackage newPackage : newPackages)
+ for (CDOPackageUnit newPackageUnit : newPackageUnits)
{
- if (PROTOCOL_TRACER.isEnabled())
- {
- PROTOCOL_TRACER.format("Writing package {0}", newPackage);
- }
-
- out.writeCDOPackage(newPackage);
- out.writeString(((InternalCDOPackage)newPackage).basicGetEcore());
+ out.writeCDOPackageUnit(newPackageUnit, true);
}
- if (PROTOCOL_TRACER.isEnabled())
+ if (TRACER.isEnabled())
{
- PROTOCOL_TRACER.format("Writing {0} new objects", newResources.size() + newObjects.size());
+ TRACER.format("Writing {0} new objects", newResources.size() + newObjects.size());
}
writeRevisions(out, newResources);
writeRevisions(out, newObjects);
- if (PROTOCOL_TRACER.isEnabled())
+ if (TRACER.isEnabled())
{
- PROTOCOL_TRACER.format("Writing {0} dirty objects", revisionDeltas.size());
+ TRACER.format("Writing {0} dirty objects", revisionDeltas.size());
}
for (CDORevisionDelta revisionDelta : revisionDeltas)
@@ -268,26 +241,24 @@ public class CommitTransactionRequest extends RequestWithMonitoring<CommitTransa
protected CommitTransactionResult confirmingTransactionResult(CDODataInput in) throws IOException
{
long timeStamp = in.readLong();
- CommitTransactionResult result = new CommitTransactionResult(commitContext, timeStamp);
- return result;
+ return new CommitTransactionResult(commitContext, timeStamp);
}
protected void confirmingNewPackage(CDODataInput in, CommitTransactionResult result) throws IOException
{
- InternalCDOSession session = commitContext.getTransaction().getSession();
- List<CDOPackage> newPackages = commitContext.getNewPackages();
- for (CDOPackage newPackage : newPackages)
+ InternalCDOPackageRegistry packageRegistry = (InternalCDOPackageRegistry)getSession().getPackageRegistry();
+ for (CDOPackageUnit newPackageUnit : commitContext.getNewPackageUnits())
{
- if (newPackage.getParentURI() == null)
+ for (CDOPackageInfo packageInfo : newPackageUnit.getPackageInfos())
{
- CDOIDMetaRange oldRange = newPackage.getMetaIDRange();
+ CDOIDMetaRange oldRange = packageInfo.getMetaIDRange();
CDOIDMetaRange newRange = in.readCDOIDMetaRange();
- ((InternalCDOPackage)newPackage).setMetaIDRange(newRange);
+ ((InternalCDOPackageInfo)packageInfo).setMetaIDRange(newRange);
for (int i = 0; i < oldRange.size(); i++)
{
CDOIDTemp oldID = (CDOIDTemp)oldRange.get(i);
CDOID newID = newRange.get(i);
- session.remapMetaInstance(oldID, newID);
+ packageRegistry.getMetaInstanceMapper().remapMetaInstanceID(oldID, newID);
result.addIDMapping(oldID, newID);
}
}
@@ -297,7 +268,7 @@ public class CommitTransactionRequest extends RequestWithMonitoring<CommitTransa
/*
* Write ids that are needed
*/
- public void confirmingIdMapping(CDODataInput in, CommitTransactionResult result) throws IOException
+ protected void confirmingIdMapping(CDODataInput in, CommitTransactionResult result) throws IOException
{
for (;;)
{
@@ -312,6 +283,18 @@ public class CommitTransactionRequest extends RequestWithMonitoring<CommitTransa
}
}
+ @Override
+ protected int getMonitorProgressSeconds()
+ {
+ return OM.PREF_COMMIT_MONITOR_PROGRESS_SECONDS.getValue();
+ }
+
+ @Override
+ protected int getMonitorTimeoutSeconds()
+ {
+ return OM.PREF_COMMIT_MONITOR_TIMEOUT_SECONDS.getValue();
+ }
+
private void writeRevisions(CDODataOutput out, Collection<?> objects) throws IOException
{
for (Iterator<?> it = objects.iterator(); it.hasNext();)
@@ -321,5 +304,4 @@ public class CommitTransactionRequest extends RequestWithMonitoring<CommitTransa
out.writeCDORevision(revision, CDORevision.UNCHUNKED);
}
}
-
}
diff --git a/plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/internal/cdo/net4j/protocol/GetRemoteSessionsRequest.java b/plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/internal/cdo/net4j/protocol/GetRemoteSessionsRequest.java
index 718aac382e..7656b44c91 100644
--- a/plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/internal/cdo/net4j/protocol/GetRemoteSessionsRequest.java
+++ b/plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/internal/cdo/net4j/protocol/GetRemoteSessionsRequest.java
@@ -30,8 +30,7 @@ import java.util.List;
*/
public class GetRemoteSessionsRequest extends CDOClientRequest<List<CDORemoteSession>>
{
- private static final ContextTracer PROTOCOL_TRACER = new ContextTracer(OM.DEBUG_PROTOCOL,
- GetRemoteSessionsRequest.class);
+ private static final ContextTracer TRACER = new ContextTracer(OM.DEBUG_PROTOCOL, GetRemoteSessionsRequest.class);
private InternalCDORemoteSessionManager manager;
@@ -47,9 +46,9 @@ public class GetRemoteSessionsRequest extends CDOClientRequest<List<CDORemoteSes
@Override
protected void requesting(CDODataOutput out) throws IOException
{
- if (PROTOCOL_TRACER.isEnabled())
+ if (TRACER.isEnabled())
{
- PROTOCOL_TRACER.format("Writing subscribe: {0}", subscribe);
+ TRACER.format("Writing subscribe: {0}", subscribe);
}
out.writeBoolean(subscribe);
diff --git a/plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/internal/cdo/net4j/protocol/LoadChunkRequest.java b/plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/internal/cdo/net4j/protocol/LoadChunkRequest.java
index 0a87f07363..50b30dfb5d 100644
--- a/plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/internal/cdo/net4j/protocol/LoadChunkRequest.java
+++ b/plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/internal/cdo/net4j/protocol/LoadChunkRequest.java
@@ -13,7 +13,8 @@ package org.eclipse.emf.internal.cdo.net4j.protocol;
import org.eclipse.emf.cdo.common.id.CDOID;
import org.eclipse.emf.cdo.common.io.CDODataInput;
import org.eclipse.emf.cdo.common.io.CDODataOutput;
-import org.eclipse.emf.cdo.common.model.CDOFeature;
+import org.eclipse.emf.cdo.common.model.CDOModelUtil;
+import org.eclipse.emf.cdo.common.model.CDOType;
import org.eclipse.emf.cdo.common.protocol.CDOProtocolConstants;
import org.eclipse.emf.cdo.spi.common.revision.InternalCDORevision;
@@ -22,6 +23,8 @@ import org.eclipse.emf.internal.cdo.bundle.OM;
import org.eclipse.net4j.util.collection.MoveableList;
import org.eclipse.net4j.util.om.trace.ContextTracer;
+import org.eclipse.emf.ecore.EStructuralFeature;
+
import java.io.IOException;
/**
@@ -29,11 +32,11 @@ import java.io.IOException;
*/
public class LoadChunkRequest extends CDOClientRequest<Object>
{
- private static final ContextTracer PROTOCOL_TRACER = new ContextTracer(OM.DEBUG_PROTOCOL, LoadChunkRequest.class);
+ private static final ContextTracer TRACER = new ContextTracer(OM.DEBUG_PROTOCOL, LoadChunkRequest.class);
private InternalCDORevision revision;
- private CDOFeature feature;
+ private EStructuralFeature feature;
private int accessIndex;
@@ -43,7 +46,7 @@ public class LoadChunkRequest extends CDOClientRequest<Object>
private int fetchIndex;
- public LoadChunkRequest(CDOClientProtocol protocol, InternalCDORevision revision, CDOFeature feature,
+ public LoadChunkRequest(CDOClientProtocol protocol, InternalCDORevision revision, EStructuralFeature feature,
int accessIndex, int fetchIndex, int fromIndex, int toIndex)
{
super(protocol, CDOProtocolConstants.SIGNAL_LOAD_CHUNK);
@@ -59,9 +62,9 @@ public class LoadChunkRequest extends CDOClientRequest<Object>
protected void requesting(CDODataOutput out) throws IOException
{
CDOID id = revision.getID();
- if (PROTOCOL_TRACER.isEnabled())
+ if (TRACER.isEnabled())
{
- PROTOCOL_TRACER.format("Writing revision ID: {0}", id);
+ TRACER.format("Writing revision ID: {0}", id);
}
out.writeCDOID(id);
@@ -71,28 +74,28 @@ public class LoadChunkRequest extends CDOClientRequest<Object>
--version;
}
- if (PROTOCOL_TRACER.isEnabled())
+ if (TRACER.isEnabled())
{
- PROTOCOL_TRACER.format("Writing revision version: {0}", version);
+ TRACER.format("Writing revision version: {0}", version);
}
out.writeInt(version);
- if (PROTOCOL_TRACER.isEnabled())
+ if (TRACER.isEnabled())
{
- PROTOCOL_TRACER.format("Writing feature: {0}", feature);
+ TRACER.format("Writing feature: {0}", feature);
}
- out.writeCDOClassRef(feature.getContainingClass());
- out.writeInt(feature.getFeatureIndex());
- if (PROTOCOL_TRACER.isEnabled())
+ out.writeCDOClassifierRef(feature.getEContainingClass());
+ out.writeInt(feature.getFeatureID());
+ if (TRACER.isEnabled())
{
- PROTOCOL_TRACER.format("Writing fromIndex: {0}", fromIndex);
+ TRACER.format("Writing fromIndex: {0}", fromIndex);
}
int diffIndex = accessIndex - fetchIndex;
out.writeInt(fromIndex - diffIndex);
- if (PROTOCOL_TRACER.isEnabled())
+ if (TRACER.isEnabled())
{
- PROTOCOL_TRACER.format("Writing toIndex: {0}", toIndex);
+ TRACER.format("Writing toIndex: {0}", toIndex);
}
out.writeInt(toIndex - diffIndex);
@@ -101,11 +104,12 @@ public class LoadChunkRequest extends CDOClientRequest<Object>
@Override
protected Object confirming(CDODataInput in) throws IOException
{
+ CDOType type = CDOModelUtil.getType(feature.getEType());
Object accessID = null;
MoveableList<Object> list = revision.getList(feature);
for (int i = fromIndex; i <= toIndex; i++)
{
- Object value = feature.getType().readValue(in);
+ Object value = type.readValue(in);
list.set(i, value);
if (i == accessIndex)
{
diff --git a/plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/internal/cdo/net4j/protocol/LoadLibrariesRequest.java b/plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/internal/cdo/net4j/protocol/LoadLibrariesRequest.java
index 2218310147..162bbec6a8 100644
--- a/plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/internal/cdo/net4j/protocol/LoadLibrariesRequest.java
+++ b/plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/internal/cdo/net4j/protocol/LoadLibrariesRequest.java
@@ -29,7 +29,7 @@ import java.util.Collection;
*/
public class LoadLibrariesRequest extends RequestWithConfirmation<Integer>
{
- private static final ContextTracer PROTOCOL_TRACER = new ContextTracer(OM.DEBUG_PROTOCOL, LoadLibrariesRequest.class);
+ private static final ContextTracer TRACER = new ContextTracer(OM.DEBUG_PROTOCOL, LoadLibrariesRequest.class);
private Collection<String> libraryNames;
@@ -46,17 +46,17 @@ public class LoadLibrariesRequest extends RequestWithConfirmation<Integer>
protected void requesting(ExtendedDataOutputStream out) throws Exception
{
int size = libraryNames.size();
- if (PROTOCOL_TRACER.isEnabled())
+ if (TRACER.isEnabled())
{
- PROTOCOL_TRACER.format("Writing {0} library names", size);
+ TRACER.format("Writing {0} library names", size);
}
out.writeInt(size);
for (String libraryName : libraryNames)
{
- if (PROTOCOL_TRACER.isEnabled())
+ if (TRACER.isEnabled())
{
- PROTOCOL_TRACER.format("Writing library name: {0}", libraryName);
+ TRACER.format("Writing library name: {0}", libraryName);
}
out.writeString(libraryName);
@@ -71,9 +71,9 @@ public class LoadLibrariesRequest extends RequestWithConfirmation<Integer>
for (String libraryName : libraryNames)
{
int size = in.readInt();
- if (PROTOCOL_TRACER.isEnabled())
+ if (TRACER.isEnabled())
{
- PROTOCOL_TRACER.format("Reading library {0}: {1} bytes", libraryName, size);
+ TRACER.format("Reading library {0}: {1} bytes", libraryName, size);
}
File file = new File(cacheFolder, libraryName);
diff --git a/plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/internal/cdo/net4j/protocol/LoadPackageRequest.java b/plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/internal/cdo/net4j/protocol/LoadPackageRequest.java
deleted file mode 100644
index 00ad4ad316..0000000000
--- a/plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/internal/cdo/net4j/protocol/LoadPackageRequest.java
+++ /dev/null
@@ -1,59 +0,0 @@
-/***************************************************************************
- * Copyright (c) 2004 - 2009 Eike Stepper (Berlin, Germany) and others.
- * 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.net4j.protocol;
-
-import org.eclipse.emf.cdo.common.io.CDODataInput;
-import org.eclipse.emf.cdo.common.io.CDODataOutput;
-import org.eclipse.emf.cdo.common.model.CDOPackage;
-import org.eclipse.emf.cdo.common.protocol.CDOProtocolConstants;
-import org.eclipse.emf.cdo.spi.common.model.InternalCDOPackage;
-
-import java.io.IOException;
-
-/**
- * @author Eike Stepper
- */
-public class LoadPackageRequest extends CDOClientRequest<Object>
-{
- private CDOPackage cdoPackage;
-
- private boolean onlyEcore;
-
- public LoadPackageRequest(CDOClientProtocol protocol, CDOPackage cdoPackage, boolean onlyEcore)
- {
- super(protocol, CDOProtocolConstants.SIGNAL_LOAD_PACKAGE);
- this.cdoPackage = cdoPackage;
- this.onlyEcore = onlyEcore;
- }
-
- @Override
- protected void requesting(CDODataOutput out) throws IOException
- {
- out.writeCDOPackageURI(cdoPackage.getPackageURI());
- out.writeBoolean(onlyEcore);
- }
-
- @Override
- protected Object confirming(CDODataInput in) throws IOException
- {
- if (onlyEcore)
- {
- String ecore = in.readString();
- ((InternalCDOPackage)cdoPackage).setEcore(ecore);
- }
- else
- {
- in.readCDOPackage(cdoPackage);
- }
-
- return null;
- }
-}
diff --git a/plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/internal/cdo/net4j/protocol/LoadPackagesRequest.java b/plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/internal/cdo/net4j/protocol/LoadPackagesRequest.java
new file mode 100644
index 0000000000..e3eee6a65b
--- /dev/null
+++ b/plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/internal/cdo/net4j/protocol/LoadPackagesRequest.java
@@ -0,0 +1,61 @@
+/***************************************************************************
+ * Copyright (c) 2004 - 2009 Eike Stepper (Berlin, Germany) and others.
+ * 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.net4j.protocol;
+
+import org.eclipse.emf.cdo.common.io.CDODataInput;
+import org.eclipse.emf.cdo.common.io.CDODataOutput;
+import org.eclipse.emf.cdo.common.model.CDOModelUtil;
+import org.eclipse.emf.cdo.common.model.EMFUtil;
+import org.eclipse.emf.cdo.common.protocol.CDOProtocolConstants;
+import org.eclipse.emf.cdo.spi.common.model.InternalCDOPackageUnit;
+
+import org.eclipse.emf.internal.cdo.bundle.OM;
+
+import org.eclipse.net4j.util.om.trace.ContextTracer;
+
+import org.eclipse.emf.ecore.EPackage;
+
+import java.io.IOException;
+
+/**
+ * @author Eike Stepper
+ */
+public class LoadPackagesRequest extends CDOClientRequest<EPackage[]>
+{
+ private static final ContextTracer TRACER = new ContextTracer(OM.DEBUG_PROTOCOL, LoadPackagesRequest.class);
+
+ private InternalCDOPackageUnit packageUnit;
+
+ public LoadPackagesRequest(CDOClientProtocol protocol, InternalCDOPackageUnit packageUnit)
+ {
+ super(protocol, CDOProtocolConstants.SIGNAL_LOAD_PACKAGES);
+ this.packageUnit = packageUnit;
+ }
+
+ @Override
+ protected void requesting(CDODataOutput out) throws IOException
+ {
+ String packageUnitID = packageUnit.getID();
+ if (TRACER.isEnabled())
+ {
+ TRACER.format("Writing packageUnitID: {0}", packageUnitID);
+ }
+
+ out.writeCDOPackageURI(packageUnitID);
+ }
+
+ @Override
+ protected EPackage[] confirming(CDODataInput in) throws IOException
+ {
+ EPackage ePackage = CDOModelUtil.readPackage(in, packageUnit.getPackageRegistry());
+ return EMFUtil.getAllPackages(ePackage);
+ }
+}
diff --git a/plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/internal/cdo/net4j/protocol/LoadRevisionByTimeRequest.java b/plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/internal/cdo/net4j/protocol/LoadRevisionByTimeRequest.java
index 02c34b1975..ccfcacf6ba 100644
--- a/plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/internal/cdo/net4j/protocol/LoadRevisionByTimeRequest.java
+++ b/plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/internal/cdo/net4j/protocol/LoadRevisionByTimeRequest.java
@@ -27,8 +27,7 @@ import java.util.Collection;
*/
public class LoadRevisionByTimeRequest extends LoadRevisionRequest
{
- private static final ContextTracer PROTOCOL_TRACER = new ContextTracer(OM.DEBUG_PROTOCOL,
- LoadRevisionByTimeRequest.class);
+ private static final ContextTracer TRACER = new ContextTracer(OM.DEBUG_PROTOCOL, LoadRevisionByTimeRequest.class);
private long timeStamp;
@@ -42,9 +41,9 @@ public class LoadRevisionByTimeRequest extends LoadRevisionRequest
protected void requesting(CDODataOutput out) throws IOException
{
super.requesting(out);
- if (PROTOCOL_TRACER.isEnabled())
+ if (TRACER.isEnabled())
{
- PROTOCOL_TRACER.format("Writing timeStamp: {0}", timeStamp);
+ TRACER.format("Writing timeStamp: {0}", timeStamp);
}
out.writeLong(timeStamp);
diff --git a/plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/internal/cdo/net4j/protocol/LoadRevisionByVersionRequest.java b/plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/internal/cdo/net4j/protocol/LoadRevisionByVersionRequest.java
index 55a4428786..16dfcbc779 100644
--- a/plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/internal/cdo/net4j/protocol/LoadRevisionByVersionRequest.java
+++ b/plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/internal/cdo/net4j/protocol/LoadRevisionByVersionRequest.java
@@ -27,8 +27,7 @@ import java.util.Collections;
*/
public class LoadRevisionByVersionRequest extends LoadRevisionRequest
{
- private static final ContextTracer PROTOCOL_TRACER = new ContextTracer(OM.DEBUG_PROTOCOL,
- LoadRevisionByVersionRequest.class);
+ private static final ContextTracer TRACER = new ContextTracer(OM.DEBUG_PROTOCOL, LoadRevisionByVersionRequest.class);
private int version;
@@ -42,9 +41,9 @@ public class LoadRevisionByVersionRequest extends LoadRevisionRequest
protected void requesting(CDODataOutput out) throws IOException
{
super.requesting(out);
- if (PROTOCOL_TRACER.isEnabled())
+ if (TRACER.isEnabled())
{
- PROTOCOL_TRACER.format("Writing version: {0}", version);
+ TRACER.format("Writing version: {0}", version);
}
out.writeInt(version);
diff --git a/plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/internal/cdo/net4j/protocol/LoadRevisionRequest.java b/plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/internal/cdo/net4j/protocol/LoadRevisionRequest.java
index 17b5f8fefc..69638a96df 100644
--- a/plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/internal/cdo/net4j/protocol/LoadRevisionRequest.java
+++ b/plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/internal/cdo/net4j/protocol/LoadRevisionRequest.java
@@ -34,7 +34,7 @@ import java.util.List;
*/
public class LoadRevisionRequest extends CDOClientRequest<List<InternalCDORevision>>
{
- private static final ContextTracer PROTOCOL_TRACER = new ContextTracer(OM.DEBUG_PROTOCOL, LoadRevisionRequest.class);
+ private static final ContextTracer TRACER = new ContextTracer(OM.DEBUG_PROTOCOL, LoadRevisionRequest.class);
private Collection<CDOID> ids;
@@ -55,29 +55,29 @@ public class LoadRevisionRequest extends CDOClientRequest<List<InternalCDORevisi
@Override
protected void requesting(CDODataOutput out) throws IOException
{
- if (PROTOCOL_TRACER.isEnabled())
+ if (TRACER.isEnabled())
{
- PROTOCOL_TRACER.format("Writing referenceChunk: {0}", referenceChunk);
+ TRACER.format("Writing referenceChunk: {0}", referenceChunk);
}
out.writeInt(referenceChunk);
- if (PROTOCOL_TRACER.isEnabled())
+ if (TRACER.isEnabled())
{
- PROTOCOL_TRACER.format("Writing {0} IDs", ids.size());
+ TRACER.format("Writing {0} IDs", ids.size());
}
out.writeInt(ids.size());
for (CDOID id : ids)
{
- if (PROTOCOL_TRACER.isEnabled())
+ if (TRACER.isEnabled())
{
- PROTOCOL_TRACER.format("Writing ID: {0}", id);
+ TRACER.format("Writing ID: {0}", id);
}
out.writeCDOID(id);
}
- CDORevisionManagerImpl revisionManager = (CDORevisionManagerImpl)getRevisionManager();
+ CDORevisionManagerImpl revisionManager = (CDORevisionManagerImpl)getSession().getRevisionManager();
CDOFetchRuleManager ruleManager = revisionManager.getRuleManager();
List<CDOFetchRule> fetchRules = ruleManager.getFetchRules(ids);
if (fetchRules == null || fetchRules.size() <= 0)
@@ -106,9 +106,9 @@ public class LoadRevisionRequest extends CDOClientRequest<List<InternalCDORevisi
{
int idSize = ids.size();
ArrayList<InternalCDORevision> revisions = new ArrayList<InternalCDORevision>(idSize);
- if (PROTOCOL_TRACER.isEnabled())
+ if (TRACER.isEnabled())
{
- PROTOCOL_TRACER.format("Reading {0} revisions", idSize);
+ TRACER.format("Reading {0} revisions", idSize);
}
for (int i = 0; i < idSize; i++)
@@ -120,12 +120,12 @@ public class LoadRevisionRequest extends CDOClientRequest<List<InternalCDORevisi
int additionalSize = in.readInt();
if (additionalSize != 0)
{
- if (PROTOCOL_TRACER.isEnabled())
+ if (TRACER.isEnabled())
{
- PROTOCOL_TRACER.format("Reading {0} additional revisions", additionalSize);
+ TRACER.format("Reading {0} additional revisions", additionalSize);
}
- CDORevisionManagerImpl revisionManager = (CDORevisionManagerImpl)getRevisionManager();
+ CDORevisionManagerImpl revisionManager = (CDORevisionManagerImpl)getSession().getRevisionManager();
for (int i = 0; i < additionalSize; i++)
{
InternalCDORevision revision = (InternalCDORevision)in.readCDORevision();
diff --git a/plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/internal/cdo/net4j/protocol/LockObjectsRequest.java b/plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/internal/cdo/net4j/protocol/LockObjectsRequest.java
index ac62f2112c..93dab154e6 100644
--- a/plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/internal/cdo/net4j/protocol/LockObjectsRequest.java
+++ b/plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/internal/cdo/net4j/protocol/LockObjectsRequest.java
@@ -29,7 +29,7 @@ import java.util.Collection;
*/
public class LockObjectsRequest extends CDOClientRequest<Object>
{
- private static final ContextTracer PROTOCOL_TRACER = new ContextTracer(OM.DEBUG_PROTOCOL, LockObjectsRequest.class);
+ private static final ContextTracer TRACER = new ContextTracer(OM.DEBUG_PROTOCOL, LockObjectsRequest.class);
private CDOView view;
@@ -56,18 +56,18 @@ public class LockObjectsRequest extends CDOClientRequest<Object>
out.writeCDOLockType(lockType);
out.writeLong(timeout);
- if (PROTOCOL_TRACER.isEnabled())
+ if (TRACER.isEnabled())
{
- PROTOCOL_TRACER.format("Locking of type {0} requested for view {1} with timeout {2}",
+ TRACER.format("Locking of type {0} requested for view {1} with timeout {2}",
lockType == RWLockManager.LockType.READ ? "read" : "write", view.getViewID(), timeout);
}
out.writeInt(objects.size());
for (CDOObject object : objects)
{
- if (PROTOCOL_TRACER.isEnabled())
+ if (TRACER.isEnabled())
{
- PROTOCOL_TRACER.format("Locking requested for objects {0}", object.cdoID());
+ TRACER.format("Locking requested for objects {0}", object.cdoID());
}
out.writeCDOID(object.cdoID());
diff --git a/plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/internal/cdo/net4j/protocol/ObjectLockedRequest.java b/plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/internal/cdo/net4j/protocol/ObjectLockedRequest.java
index 5f67a7238d..e5dbe17eec 100644
--- a/plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/internal/cdo/net4j/protocol/ObjectLockedRequest.java
+++ b/plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/internal/cdo/net4j/protocol/ObjectLockedRequest.java
@@ -28,7 +28,7 @@ import java.io.IOException;
*/
public class ObjectLockedRequest extends CDOClientRequest<Boolean>
{
- private static final ContextTracer PROTOCOL_TRACER = new ContextTracer(OM.DEBUG_PROTOCOL, ObjectLockedRequest.class);
+ private static final ContextTracer TRACER = new ContextTracer(OM.DEBUG_PROTOCOL, ObjectLockedRequest.class);
private CDOView view;
@@ -47,9 +47,9 @@ public class ObjectLockedRequest extends CDOClientRequest<Boolean>
@Override
protected void requesting(CDODataOutput out) throws IOException
{
- if (PROTOCOL_TRACER.isEnabled())
+ if (TRACER.isEnabled())
{
- PROTOCOL_TRACER.format("Requesting if object {0} has of lock for object {1}", object.cdoID(),
+ TRACER.format("Requesting if object {0} has of lock for object {1}", object.cdoID(),
lockType == RWLockManager.LockType.READ ? "read" : "write");
}
diff --git a/plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/internal/cdo/net4j/protocol/OpenSessionRequest.java b/plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/internal/cdo/net4j/protocol/OpenSessionRequest.java
index 6f524fe599..3ca4a4814e 100644
--- a/plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/internal/cdo/net4j/protocol/OpenSessionRequest.java
+++ b/plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/internal/cdo/net4j/protocol/OpenSessionRequest.java
@@ -12,22 +12,18 @@
package org.eclipse.emf.internal.cdo.net4j.protocol;
import org.eclipse.emf.cdo.common.id.CDOIDLibraryDescriptor;
-import org.eclipse.emf.cdo.common.id.CDOIDMetaRange;
-import org.eclipse.emf.cdo.common.id.CDOIDObjectFactory;
import org.eclipse.emf.cdo.common.id.CDOIDUtil;
import org.eclipse.emf.cdo.common.io.CDODataInput;
import org.eclipse.emf.cdo.common.io.CDODataOutput;
-import org.eclipse.emf.cdo.common.model.CDOPackageURICompressor;
+import org.eclipse.emf.cdo.common.model.CDOPackageUnit;
import org.eclipse.emf.cdo.common.protocol.CDOProtocolConstants;
+import org.eclipse.emf.cdo.spi.common.model.InternalCDOPackageUnit;
import org.eclipse.emf.cdo.util.ServerException;
import org.eclipse.emf.internal.cdo.bundle.OM;
-import org.eclipse.emf.internal.cdo.session.CDORevisionManagerImpl;
-import org.eclipse.emf.internal.cdo.session.CDOSessionPackageManagerImpl;
import org.eclipse.net4j.util.om.trace.ContextTracer;
-import org.eclipse.emf.spi.cdo.InternalCDOSession;
import org.eclipse.emf.spi.cdo.CDOSessionProtocol.OpenSessionResult;
import java.io.IOException;
@@ -38,7 +34,7 @@ import java.text.MessageFormat;
*/
public class OpenSessionRequest extends CDOTimeRequest<OpenSessionResult>
{
- private static final ContextTracer PROTOCOL_TRACER = new ContextTracer(OM.DEBUG_PROTOCOL, OpenSessionRequest.class);
+ private static final ContextTracer TRACER = new ContextTracer(OM.DEBUG_PROTOCOL, OpenSessionRequest.class);
private String repositoryName;
@@ -54,54 +50,19 @@ public class OpenSessionRequest extends CDOTimeRequest<OpenSessionResult>
}
@Override
- protected InternalCDOSession getSession()
- {
- throw new UnsupportedOperationException();
- }
-
- @Override
- protected CDORevisionManagerImpl getRevisionManager()
- {
- throw new UnsupportedOperationException();
- }
-
- @Override
- protected CDOSessionPackageManagerImpl getPackageManager()
- {
- throw new UnsupportedOperationException();
- }
-
- @Override
- protected CDOPackageURICompressor getPackageURICompressor()
- {
- if (result == null)
- {
- throw new IllegalStateException("result == null");
- }
-
- return result;
- }
-
- @Override
- protected CDOIDObjectFactory getIDFactory()
- {
- throw new UnsupportedOperationException();
- }
-
- @Override
protected void requesting(CDODataOutput out) throws IOException
{
super.requesting(out);
- if (PROTOCOL_TRACER.isEnabled())
+ if (TRACER.isEnabled())
{
- PROTOCOL_TRACER.format("Writing repositoryName: {0}", repositoryName);
+ TRACER.format("Writing repositoryName: {0}", repositoryName);
}
out.writeString(repositoryName);
- if (PROTOCOL_TRACER.isEnabled())
+ if (TRACER.isEnabled())
{
- PROTOCOL_TRACER.format("Writing passiveUpdateEnabled: {0}", passiveUpdateEnabled);
+ TRACER.format("Writing passiveUpdateEnabled: {0}", passiveUpdateEnabled);
}
out.writeBoolean(passiveUpdateEnabled);
@@ -123,57 +84,42 @@ public class OpenSessionRequest extends CDOTimeRequest<OpenSessionResult>
throw new ServerException(msg);
}
- if (PROTOCOL_TRACER.isEnabled())
+ if (TRACER.isEnabled())
{
- PROTOCOL_TRACER.format("Read sessionID: {0}", sessionID);
+ TRACER.format("Read sessionID: {0}", sessionID);
}
String repositoryUUID = in.readString();
- if (PROTOCOL_TRACER.isEnabled())
+ if (TRACER.isEnabled())
{
- PROTOCOL_TRACER.format("Read repositoryUUID: {0}", repositoryUUID);
+ TRACER.format("Read repositoryUUID: {0}", repositoryUUID);
}
long repositoryCreationTime = in.readLong();
- if (PROTOCOL_TRACER.isEnabled())
+ if (TRACER.isEnabled())
{
- PROTOCOL_TRACER.format("Read repositoryCreationTime: {0,date} {0,time}", repositoryCreationTime);
+ TRACER.format("Read repositoryCreationTime: {0,date} {0,time}", repositoryCreationTime);
}
boolean repositorySupportingAudits = in.readBoolean();
- if (PROTOCOL_TRACER.isEnabled())
+ if (TRACER.isEnabled())
{
- PROTOCOL_TRACER.format("Read repositorySupportingAudits: {0}", repositorySupportingAudits);
+ TRACER.format("Read repositorySupportingAudits: {0}", repositorySupportingAudits);
}
CDOIDLibraryDescriptor libraryDescriptor = CDOIDUtil.readLibraryDescriptor(in);
- if (PROTOCOL_TRACER.isEnabled())
+ if (TRACER.isEnabled())
{
- PROTOCOL_TRACER.format("Read libraryDescriptor: {0}", libraryDescriptor);
+ TRACER.format("Read libraryDescriptor: {0}", libraryDescriptor);
}
result = new OpenSessionResult(sessionID, repositoryUUID, repositoryCreationTime, repositorySupportingAudits,
libraryDescriptor);
- for (;;)
+ CDOPackageUnit[] packageUnits = in.readCDOPackageUnits(null);
+ for (int i = 0; i < packageUnits.length; i++)
{
- boolean readInfo = in.readBoolean();
- if (!readInfo)
- {
- break;
- }
-
- String packageURI = in.readCDOPackageURI();
- boolean dynamic = in.readBoolean();
- CDOIDMetaRange metaIDRange = in.readCDOIDMetaRange();
- String parentURI = in.readCDOPackageURI();
- if (PROTOCOL_TRACER.isEnabled())
- {
- PROTOCOL_TRACER.format("Read package info: uri={0}, dynamic={1}, metaIDRange={2}, parentURI={3}", packageURI,
- dynamic, metaIDRange, parentURI);
- }
-
- result.addPackageInfo(packageURI, dynamic, metaIDRange, parentURI);
+ result.getPackageUnits().add((InternalCDOPackageUnit)packageUnits[i]);
}
super.confirming(in);
diff --git a/plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/internal/cdo/net4j/protocol/QueryCancelRequest.java b/plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/internal/cdo/net4j/protocol/QueryCancelRequest.java
index cad541d4c5..aa77ff354f 100644
--- a/plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/internal/cdo/net4j/protocol/QueryCancelRequest.java
+++ b/plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/internal/cdo/net4j/protocol/QueryCancelRequest.java
@@ -26,7 +26,7 @@ import java.io.IOException;
*/
public class QueryCancelRequest extends CDOClientRequest<Boolean>
{
- private static final ContextTracer PROTOCOL_TRACER = new ContextTracer(OM.DEBUG_PROTOCOL, QueryCancelRequest.class);
+ private static final ContextTracer TRACER = new ContextTracer(OM.DEBUG_PROTOCOL, QueryCancelRequest.class);
private int queryID;
@@ -39,9 +39,9 @@ public class QueryCancelRequest extends CDOClientRequest<Boolean>
@Override
protected void requesting(CDODataOutput out) throws IOException
{
- if (PROTOCOL_TRACER.isEnabled())
+ if (TRACER.isEnabled())
{
- PROTOCOL_TRACER.trace("Cancel query " + queryID);
+ TRACER.trace("Cancel query " + queryID);
}
out.writeInt(queryID);
diff --git a/plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/internal/cdo/net4j/protocol/QueryRequest.java b/plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/internal/cdo/net4j/protocol/QueryRequest.java
index a68c8a9927..d9752e46d1 100644
--- a/plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/internal/cdo/net4j/protocol/QueryRequest.java
+++ b/plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/internal/cdo/net4j/protocol/QueryRequest.java
@@ -32,7 +32,7 @@ import java.util.List;
*/
public class QueryRequest extends CDOClientRequest<List<Object>>
{
- private static final ContextTracer PROTOCOL_TRACER = new ContextTracer(OM.DEBUG_PROTOCOL, QueryRequest.class);
+ private static final ContextTracer TRACER = new ContextTracer(OM.DEBUG_PROTOCOL, QueryRequest.class);
private int viewID;
@@ -73,9 +73,9 @@ public class QueryRequest extends CDOClientRequest<List<Object>>
numberOfObjectsReceived++;
}
- if (PROTOCOL_TRACER.isEnabled())
+ if (TRACER.isEnabled())
{
- PROTOCOL_TRACER.format("Query executed [{0} elements received]", numberOfObjectsReceived);
+ TRACER.format("Query executed [{0} elements received]", numberOfObjectsReceived);
}
}
catch (RuntimeException ex)
diff --git a/plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/internal/cdo/net4j/protocol/ResourceIDRequest.java b/plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/internal/cdo/net4j/protocol/ResourceIDRequest.java
index ac00447092..42d5ae513f 100644
--- a/plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/internal/cdo/net4j/protocol/ResourceIDRequest.java
+++ b/plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/internal/cdo/net4j/protocol/ResourceIDRequest.java
@@ -26,7 +26,7 @@ import java.io.IOException;
*/
public class ResourceIDRequest extends CDOClientRequest<CDOID>
{
- private static final ContextTracer PROTOCOL_TRACER = new ContextTracer(OM.DEBUG_PROTOCOL, ResourceIDRequest.class);
+ private static final ContextTracer TRACER = new ContextTracer(OM.DEBUG_PROTOCOL, ResourceIDRequest.class);
private int viewID;
@@ -42,15 +42,15 @@ public class ResourceIDRequest extends CDOClientRequest<CDOID>
@Override
protected void requesting(CDODataOutput out) throws IOException
{
- if (PROTOCOL_TRACER.isEnabled())
+ if (TRACER.isEnabled())
{
- PROTOCOL_TRACER.format("Writing viewID: {0}", viewID);
+ TRACER.format("Writing viewID: {0}", viewID);
}
out.writeInt(viewID);
- if (PROTOCOL_TRACER.isEnabled())
+ if (TRACER.isEnabled())
{
- PROTOCOL_TRACER.format("Writing path: {0}", path);
+ TRACER.format("Writing path: {0}", path);
}
out.writeString(path);
@@ -60,9 +60,9 @@ public class ResourceIDRequest extends CDOClientRequest<CDOID>
protected CDOID confirming(CDODataInput in) throws IOException
{
CDOID id = in.readCDOID();
- if (PROTOCOL_TRACER.isEnabled())
+ if (TRACER.isEnabled())
{
- PROTOCOL_TRACER.format("Read ID: {0}", id);
+ TRACER.format("Read ID: {0}", id);
}
return id;
diff --git a/plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/internal/cdo/net4j/protocol/SetAuditRequest.java b/plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/internal/cdo/net4j/protocol/SetAuditRequest.java
index 9f157eeb02..9095430692 100644
--- a/plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/internal/cdo/net4j/protocol/SetAuditRequest.java
+++ b/plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/internal/cdo/net4j/protocol/SetAuditRequest.java
@@ -28,7 +28,7 @@ import java.util.List;
*/
public class SetAuditRequest extends CDOClientRequest<boolean[]>
{
- private static final ContextTracer PROTOCOL_TRACER = new ContextTracer(OM.DEBUG_PROTOCOL, SetAuditRequest.class);
+ private static final ContextTracer TRACER = new ContextTracer(OM.DEBUG_PROTOCOL, SetAuditRequest.class);
private int viewID;
@@ -47,31 +47,31 @@ public class SetAuditRequest extends CDOClientRequest<boolean[]>
@Override
protected void requesting(CDODataOutput out) throws IOException
{
- if (PROTOCOL_TRACER.isEnabled())
+ if (TRACER.isEnabled())
{
- PROTOCOL_TRACER.format("Writing viewID: {0}", viewID);
+ TRACER.format("Writing viewID: {0}", viewID);
}
out.writeInt(viewID);
- if (PROTOCOL_TRACER.isEnabled())
+ if (TRACER.isEnabled())
{
- PROTOCOL_TRACER.format("Writing timeStamp: {0,date} {0,time}", timeStamp);
+ TRACER.format("Writing timeStamp: {0,date} {0,time}", timeStamp);
}
out.writeLong(timeStamp);
int size = invalidObjects.size();
- if (PROTOCOL_TRACER.isEnabled())
+ if (TRACER.isEnabled())
{
- PROTOCOL_TRACER.format("Writing {0} IDs", size);
+ TRACER.format("Writing {0} IDs", size);
}
out.writeInt(size);
for (InternalCDOObject object : invalidObjects)
{
- if (PROTOCOL_TRACER.isEnabled())
+ if (TRACER.isEnabled())
{
- PROTOCOL_TRACER.format("Writing ID: {0}", object.cdoID());
+ TRACER.format("Writing ID: {0}", object.cdoID());
}
out.writeCDOID(object.cdoID());
@@ -82,9 +82,9 @@ public class SetAuditRequest extends CDOClientRequest<boolean[]>
protected boolean[] confirming(CDODataInput in) throws IOException
{
int size = in.readInt();
- if (PROTOCOL_TRACER.isEnabled())
+ if (TRACER.isEnabled())
{
- PROTOCOL_TRACER.format("Reading {0} existanceFlags", size);
+ TRACER.format("Reading {0} existanceFlags", size);
}
boolean[] existanceFlags = new boolean[size];
@@ -92,9 +92,9 @@ public class SetAuditRequest extends CDOClientRequest<boolean[]>
{
boolean existanceFlag = in.readBoolean();
existanceFlags[i] = existanceFlag;
- if (PROTOCOL_TRACER.isEnabled())
+ if (TRACER.isEnabled())
{
- PROTOCOL_TRACER.format("Read existanceFlag: {0}", existanceFlag);
+ TRACER.format("Read existanceFlag: {0}", existanceFlag);
}
}
diff --git a/plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/internal/cdo/net4j/protocol/SetPassiveUpdateRequest.java b/plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/internal/cdo/net4j/protocol/SetPassiveUpdateRequest.java
index 0454f46e12..fa4977d4da 100644
--- a/plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/internal/cdo/net4j/protocol/SetPassiveUpdateRequest.java
+++ b/plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/internal/cdo/net4j/protocol/SetPassiveUpdateRequest.java
@@ -29,8 +29,7 @@ import java.util.Map;
*/
public class SetPassiveUpdateRequest extends SyncRevisionsRequest
{
- private static final ContextTracer PROTOCOL_TRACER = new ContextTracer(OM.DEBUG_PROTOCOL,
- SetPassiveUpdateRequest.class);
+ private static final ContextTracer TRACER = new ContextTracer(OM.DEBUG_PROTOCOL, SetPassiveUpdateRequest.class);
private boolean passiveUpdateEnabled;
@@ -44,9 +43,9 @@ public class SetPassiveUpdateRequest extends SyncRevisionsRequest
@Override
protected void requesting(CDODataOutput out) throws IOException
{
- if (PROTOCOL_TRACER.isEnabled())
+ if (TRACER.isEnabled())
{
- PROTOCOL_TRACER.trace("Turning " + (passiveUpdateEnabled ? "on" : "off") + " passive update");
+ TRACER.trace("Turning " + (passiveUpdateEnabled ? "on" : "off") + " passive update");
}
super.requesting(out);
diff --git a/plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/internal/cdo/net4j/protocol/SyncRevisionsRequest.java b/plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/internal/cdo/net4j/protocol/SyncRevisionsRequest.java
index dc9d4bfe67..065eda635a 100644
--- a/plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/internal/cdo/net4j/protocol/SyncRevisionsRequest.java
+++ b/plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/internal/cdo/net4j/protocol/SyncRevisionsRequest.java
@@ -40,7 +40,7 @@ import java.util.TreeMap;
*/
public class SyncRevisionsRequest extends CDOClientRequest<Collection<CDOTimeStampContext>>
{
- private static final ContextTracer PROTOCOL_TRACER = new ContextTracer(OM.DEBUG_PROTOCOL, SyncRevisionsRequest.class);
+ private static final ContextTracer TRACER = new ContextTracer(OM.DEBUG_PROTOCOL, SyncRevisionsRequest.class);
private Map<CDOID, CDORevision> revisions;
@@ -62,9 +62,9 @@ public class SyncRevisionsRequest extends CDOClientRequest<Collection<CDOTimeSta
@Override
protected void requesting(CDODataOutput out) throws IOException
{
- if (PROTOCOL_TRACER.isEnabled())
+ if (TRACER.isEnabled())
{
- PROTOCOL_TRACER.trace("Synchronization " + revisions.size() + " objects");
+ TRACER.trace("Synchronization " + revisions.size() + " objects");
}
out.writeInt(referenceChunk);
@@ -79,7 +79,7 @@ public class SyncRevisionsRequest extends CDOClientRequest<Collection<CDOTimeSta
@Override
protected Collection<CDOTimeStampContext> confirming(CDODataInput in) throws IOException
{
- CDORevisionManagerImpl revisionManager = (CDORevisionManagerImpl)getRevisionManager();
+ CDORevisionManagerImpl revisionManager = (CDORevisionManagerImpl)getSession().getRevisionManager();
TreeMap<Long, CDOTimeStampContext> mapofContext = new TreeMap<Long, CDOTimeStampContext>();
int size = in.readInt();
@@ -99,9 +99,9 @@ public class SyncRevisionsRequest extends CDOClientRequest<Collection<CDOTimeSta
revisionManager.addCachedRevision((InternalCDORevision)revision);
}
- if (PROTOCOL_TRACER.isEnabled())
+ if (TRACER.isEnabled())
{
- PROTOCOL_TRACER.trace("Synchronization received " + size + " dirty objects");
+ TRACER.trace("Synchronization received " + size + " dirty objects");
}
size = in.readInt();
diff --git a/plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/internal/cdo/net4j/protocol/UnlockObjectsRequest.java b/plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/internal/cdo/net4j/protocol/UnlockObjectsRequest.java
index 80df6d4fd6..5fc6e4ecd1 100644
--- a/plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/internal/cdo/net4j/protocol/UnlockObjectsRequest.java
+++ b/plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/internal/cdo/net4j/protocol/UnlockObjectsRequest.java
@@ -29,7 +29,7 @@ import java.util.Collection;
*/
public class UnlockObjectsRequest extends CDOClientRequest<Boolean>
{
- private static final ContextTracer PROTOCOL_TRACER = new ContextTracer(OM.DEBUG_PROTOCOL, UnlockObjectsRequest.class);
+ private static final ContextTracer TRACER = new ContextTracer(OM.DEBUG_PROTOCOL, UnlockObjectsRequest.class);
private CDOView view;
@@ -53,27 +53,27 @@ public class UnlockObjectsRequest extends CDOClientRequest<Boolean>
out.writeCDOLockType(lockType);
if (objects == null)
{
- if (PROTOCOL_TRACER.isEnabled())
+ if (TRACER.isEnabled())
{
- PROTOCOL_TRACER.format("Unlocking all objects for view {0}", view.getViewID());
+ TRACER.format("Unlocking all objects for view {0}", view.getViewID());
}
out.writeInt(CDOProtocolConstants.RELEASE_ALL_LOCKS);
}
else
{
- if (PROTOCOL_TRACER.isEnabled())
+ if (TRACER.isEnabled())
{
- PROTOCOL_TRACER.format("Unlocking of type {0} requested for view {1}",
- lockType == RWLockManager.LockType.READ ? "read" : "write", view.getViewID());
+ TRACER.format("Unlocking of type {0} requested for view {1}", lockType == RWLockManager.LockType.READ ? "read"
+ : "write", view.getViewID());
}
out.writeInt(objects.size());
for (CDOObject object : objects)
{
- if (PROTOCOL_TRACER.isEnabled())
+ if (TRACER.isEnabled())
{
- PROTOCOL_TRACER.format("Unlocking requested for objects {0}", object.cdoID());
+ TRACER.format("Unlocking requested for objects {0}", object.cdoID());
}
out.writeCDOID(object.cdoID());
diff --git a/plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/internal/cdo/net4j/protocol/UnsubscribeRemoteSessionsRequest.java b/plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/internal/cdo/net4j/protocol/UnsubscribeRemoteSessionsRequest.java
index 7eaa622f7c..17722b2ec2 100644
--- a/plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/internal/cdo/net4j/protocol/UnsubscribeRemoteSessionsRequest.java
+++ b/plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/internal/cdo/net4j/protocol/UnsubscribeRemoteSessionsRequest.java
@@ -25,7 +25,7 @@ import java.io.IOException;
*/
public class UnsubscribeRemoteSessionsRequest extends CDOClientRequest<Boolean>
{
- private static final ContextTracer PROTOCOL_TRACER = new ContextTracer(OM.DEBUG_PROTOCOL,
+ private static final ContextTracer TRACER = new ContextTracer(OM.DEBUG_PROTOCOL,
UnsubscribeRemoteSessionsRequest.class);
public UnsubscribeRemoteSessionsRequest(CDOClientProtocol protocol)
@@ -36,9 +36,9 @@ public class UnsubscribeRemoteSessionsRequest extends CDOClientRequest<Boolean>
@Override
protected void requesting(CDODataOutput out) throws IOException
{
- if (PROTOCOL_TRACER.isEnabled())
+ if (TRACER.isEnabled())
{
- PROTOCOL_TRACER.trace("Unsubscribing");
+ TRACER.trace("Unsubscribing");
}
}
diff --git a/plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/internal/cdo/net4j/protocol/VerifyRevisionRequest.java b/plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/internal/cdo/net4j/protocol/VerifyRevisionRequest.java
index c2f64a529e..71f9471490 100644
--- a/plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/internal/cdo/net4j/protocol/VerifyRevisionRequest.java
+++ b/plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/internal/cdo/net4j/protocol/VerifyRevisionRequest.java
@@ -32,7 +32,7 @@ import java.util.List;
*/
public class VerifyRevisionRequest extends CDOClientRequest<List<InternalCDORevision>>
{
- private static final ContextTracer PROTOCOL_TRACER = new ContextTracer(OM.DEBUG_PROTOCOL, VerifyRevisionRequest.class);
+ private static final ContextTracer TRACER = new ContextTracer(OM.DEBUG_PROTOCOL, VerifyRevisionRequest.class);
private Collection<InternalCDORevision> revisions;
@@ -50,9 +50,9 @@ public class VerifyRevisionRequest extends CDOClientRequest<List<InternalCDORevi
@Override
protected void requesting(CDODataOutput out) throws IOException
{
- if (PROTOCOL_TRACER.isEnabled())
+ if (TRACER.isEnabled())
{
- PROTOCOL_TRACER.format("Writing {0} IDs and versions", revisions.size());
+ TRACER.format("Writing {0} IDs and versions", revisions.size());
}
out.writeInt(revisions.size());
@@ -60,9 +60,9 @@ public class VerifyRevisionRequest extends CDOClientRequest<List<InternalCDORevi
{
CDOID id = revision.getID();
int version = revision.getVersion();
- if (PROTOCOL_TRACER.isEnabled())
+ if (TRACER.isEnabled())
{
- PROTOCOL_TRACER.format("Writing ID and version: {0}v{1}", id, version);
+ TRACER.format("Writing ID and version: {0}v{1}", id, version);
}
out.writeCDOID(id);
@@ -74,17 +74,17 @@ public class VerifyRevisionRequest extends CDOClientRequest<List<InternalCDORevi
protected List<InternalCDORevision> confirming(CDODataInput in) throws IOException
{
ArrayList<InternalCDORevision> result = new ArrayList<InternalCDORevision>();
- if (PROTOCOL_TRACER.isEnabled())
+ if (TRACER.isEnabled())
{
- PROTOCOL_TRACER.format("Reading {0} timeStamps", revisions.size());
+ TRACER.format("Reading {0} timeStamps", revisions.size());
}
for (InternalCDORevision revision : revisions)
{
long revised = in.readLong();
- if (PROTOCOL_TRACER.isEnabled())
+ if (TRACER.isEnabled())
{
- PROTOCOL_TRACER.format("Reading timeStamp: {0}", revised);
+ TRACER.format("Reading timeStamp: {0}", revised);
}
if (revised != CDORevision.UNSPECIFIED_DATE)
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 843dbc4dd5..afbbbe1cf0 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
@@ -16,13 +16,10 @@ import org.eclipse.emf.cdo.common.util.BlockingCloseableIterator;
import org.eclipse.emf.cdo.internal.common.CDOQueryInfoImpl;
import org.eclipse.emf.cdo.view.CDOQuery;
-import org.eclipse.emf.internal.cdo.session.CDOSessionPackageManagerImpl;
import org.eclipse.emf.internal.cdo.util.FSMUtil;
-import org.eclipse.emf.internal.cdo.util.ModelUtil;
import org.eclipse.net4j.util.WrappedException;
-import org.eclipse.emf.ecore.EClass;
import org.eclipse.emf.spi.cdo.AbstractQueryIterator;
import org.eclipse.emf.spi.cdo.InternalCDOObject;
import org.eclipse.emf.spi.cdo.InternalCDOView;
@@ -136,12 +133,7 @@ public class CDOQueryImpl extends CDOQueryInfoImpl implements CDOQuery
protected Object adapt(Object object)
{
- if (object instanceof EClass)
- {
- EClass eClass = (EClass)object;
- return ModelUtil.getCDOClass(eClass, (CDOSessionPackageManagerImpl)view.getSession().getPackageManager());
- }
- else if (object instanceof InternalCDOObject)
+ if (object instanceof InternalCDOObject)
{
InternalCDOObject internalCDOObject = FSMUtil.adapt(object, view);
if (internalCDOObject.cdoID() == null)
diff --git a/plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/internal/cdo/revision/CDOElementProxyImpl.java b/plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/internal/cdo/revision/CDOElementProxyImpl.java
index 6c08863ee4..3f61de4900 100644
--- a/plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/internal/cdo/revision/CDOElementProxyImpl.java
+++ b/plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/internal/cdo/revision/CDOElementProxyImpl.java
@@ -11,12 +11,12 @@
*/
package org.eclipse.emf.internal.cdo.revision;
-import org.eclipse.emf.cdo.common.model.CDOFeature;
import org.eclipse.emf.cdo.common.revision.CDORevision;
import org.eclipse.emf.cdo.session.CDORevisionManager;
import org.eclipse.emf.internal.cdo.session.CDORevisionManagerImpl;
+import org.eclipse.emf.ecore.EStructuralFeature;
import org.eclipse.emf.spi.cdo.CDOElementProxy;
import java.text.MessageFormat;
@@ -43,7 +43,7 @@ public final class CDOElementProxyImpl implements CDOElementProxy
this.index = index;
}
- public Object resolve(CDORevisionManager revisionManager, CDORevision revision, CDOFeature feature, int index)
+ public Object resolve(CDORevisionManager revisionManager, CDORevision revision, EStructuralFeature feature, int index)
{
return ((CDORevisionManagerImpl)revisionManager).resolveElementProxy(revision, feature, index, getIndex());
}
diff --git a/plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/internal/cdo/revision/CDOListWithElementProxiesImpl.java b/plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/internal/cdo/revision/CDOListWithElementProxiesImpl.java
index 8f1904db74..5456bbf85a 100644
--- a/plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/internal/cdo/revision/CDOListWithElementProxiesImpl.java
+++ b/plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/internal/cdo/revision/CDOListWithElementProxiesImpl.java
@@ -11,6 +11,7 @@
*/
package org.eclipse.emf.internal.cdo.revision;
+import org.eclipse.emf.cdo.common.model.CDOModelUtil;
import org.eclipse.emf.cdo.common.model.CDOType;
import org.eclipse.emf.cdo.common.revision.CDOList;
import org.eclipse.emf.cdo.common.revision.CDOListFactory;
@@ -18,6 +19,7 @@ import org.eclipse.emf.cdo.internal.common.revision.CDOListImpl;
import org.eclipse.emf.cdo.spi.common.revision.InternalCDOList;
import org.eclipse.emf.cdo.spi.common.revision.InternalCDORevision;
+import org.eclipse.emf.ecore.EClassifier;
import org.eclipse.emf.spi.cdo.CDOElementProxy;
/**
@@ -68,8 +70,9 @@ public class CDOListWithElementProxiesImpl extends CDOListImpl
}
@Override
- public InternalCDOList clone(CDOType type)
+ public InternalCDOList clone(EClassifier classifier)
{
+ CDOType type = CDOModelUtil.getType(classifier);
int size = size();
InternalCDOList list = new CDOListWithElementProxiesImpl(size, 0, 0);
for (int j = 0; j < size; j++)
diff --git a/plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/internal/cdo/session/CDOCollectionLoadingPolicyImpl.java b/plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/internal/cdo/session/CDOCollectionLoadingPolicyImpl.java
index ace75f2d0f..47de988d6c 100644
--- a/plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/internal/cdo/session/CDOCollectionLoadingPolicyImpl.java
+++ b/plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/internal/cdo/session/CDOCollectionLoadingPolicyImpl.java
@@ -11,7 +11,6 @@
*/
package org.eclipse.emf.internal.cdo.session;
-import org.eclipse.emf.cdo.common.model.CDOFeature;
import org.eclipse.emf.cdo.common.revision.CDORevision;
import org.eclipse.emf.cdo.session.CDOCollectionLoadingPolicy;
import org.eclipse.emf.cdo.session.CDORevisionManager;
@@ -19,6 +18,7 @@ import org.eclipse.emf.cdo.spi.common.revision.InternalCDORevision;
import org.eclipse.net4j.util.collection.MoveableList;
+import org.eclipse.emf.ecore.EStructuralFeature;
import org.eclipse.emf.spi.cdo.CDOElementProxy;
/**
@@ -47,8 +47,8 @@ public class CDOCollectionLoadingPolicyImpl implements CDOCollectionLoadingPolic
return resolveChunkSize;
}
- public Object resolveProxy(CDORevisionManager revisionManager, CDORevision rev, CDOFeature feature, int accessIndex,
- int serverIndex)
+ public Object resolveProxy(CDORevisionManager revisionManager, CDORevision rev, EStructuralFeature feature,
+ int accessIndex, int serverIndex)
{
// Get proxy values
InternalCDORevision revision = (InternalCDORevision)rev;
diff --git a/plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/internal/cdo/session/CDOPackageRegistryImpl.java b/plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/internal/cdo/session/CDOPackageRegistryImpl.java
deleted file mode 100644
index 71ffca3ff0..0000000000
--- a/plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/internal/cdo/session/CDOPackageRegistryImpl.java
+++ /dev/null
@@ -1,446 +0,0 @@
-/**
- * Copyright (c) 2004 - 2009 Eike Stepper (Berlin, Germany) and others.
- * 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
- * Eike Stepper - maintenance
- */
-package org.eclipse.emf.internal.cdo.session;
-
-import org.eclipse.emf.cdo.CDOObject;
-import org.eclipse.emf.cdo.common.id.CDOIDMetaRange;
-import org.eclipse.emf.cdo.common.model.CDOPackage;
-import org.eclipse.emf.cdo.common.revision.delta.CDOFeatureDelta;
-import org.eclipse.emf.cdo.session.CDOPackageRegistry;
-import org.eclipse.emf.cdo.session.CDOPackageType;
-import org.eclipse.emf.cdo.session.CDOPackageTypeRegistry;
-import org.eclipse.emf.cdo.session.CDOSession;
-import org.eclipse.emf.cdo.spi.common.model.InternalCDOPackage;
-import org.eclipse.emf.cdo.transaction.CDOCommitContext;
-import org.eclipse.emf.cdo.transaction.CDOTransaction;
-import org.eclipse.emf.cdo.transaction.CDOTransactionHandler;
-import org.eclipse.emf.cdo.util.EMFUtil;
-import org.eclipse.emf.cdo.view.CDOView;
-
-import org.eclipse.emf.internal.cdo.bundle.OM;
-import org.eclipse.emf.internal.cdo.util.ModelUtil;
-
-import org.eclipse.net4j.util.container.ContainerEventAdapter;
-import org.eclipse.net4j.util.container.IContainer;
-import org.eclipse.net4j.util.event.IListener;
-import org.eclipse.net4j.util.lifecycle.ILifecycle;
-import org.eclipse.net4j.util.lifecycle.LifecycleEventAdapter;
-import org.eclipse.net4j.util.om.trace.ContextTracer;
-
-import org.eclipse.emf.ecore.EClass;
-import org.eclipse.emf.ecore.EFactory;
-import org.eclipse.emf.ecore.EPackage;
-import org.eclipse.emf.ecore.EReference;
-import org.eclipse.emf.ecore.impl.EPackageRegistryImpl;
-import org.eclipse.emf.spi.cdo.InternalCDOSession;
-
-import java.text.MessageFormat;
-import java.util.ArrayList;
-import java.util.HashSet;
-import java.util.List;
-import java.util.Map;
-import java.util.Set;
-
-/**
- * @author Eike Stepper
- */
-public class CDOPackageRegistryImpl extends EPackageRegistryImpl implements CDOPackageRegistry
-{
- private static final long serialVersionUID = 1L;
-
- private final ContextTracer tracer = new ContextTracer(OM.DEBUG_MODEL, CDOPackageRegistryImpl.class);
-
- private InternalCDOSession session;
-
- public CDOPackageRegistryImpl()
- {
- }
-
- public InternalCDOSession getSession()
- {
- return session;
- }
-
- public void setSession(CDOSession session)
- {
- this.session = (InternalCDOSession)session;
- }
-
- public void putPackageDescriptor(CDOPackage cdoPackage)
- {
- checkSession();
- EPackage.Descriptor descriptor = new RemotePackageDescriptor(cdoPackage);
- String uri = cdoPackage.getPackageURI();
- if (tracer.isEnabled())
- {
- tracer.format("Registering package descriptor for {0}", uri);
- }
-
- put(uri, descriptor);
- }
-
- /**
- * Insert the topPackage and its sub-packages by their URI
- */
- public EPackage putEPackage(EPackage ePackage) throws IllegalArgumentException
- {
- checkSession();
- String uri = ePackage.getNsURI();
- if (ePackage.getESuperPackage() != null)
- {
- throw new IllegalArgumentException("Not a top level package: " + uri);
- }
-
- putEPackage(uri, ePackage);
- return getEPackage(uri);
- }
-
- private void putEPackage(String uri, EPackage ePackage)
- {
- if (uri != null)
- {
- put(uri, ePackage);
- }
-
- for (EPackage subPackage : ePackage.getESubpackages())
- {
- putEPackage(subPackage.getNsURI(), subPackage);
- }
- }
-
- @Override
- public Object put(String key, Object value)
- {
- checkSession();
- if (value instanceof EPackage)
- {
- if (tracer.isEnabled())
- {
- tracer.format("Registering package for {0}", key);
- }
-
- EPackage ePackage = (EPackage)value;
- EMFUtil.prepareDynamicEPackage(ePackage);
-
- CDOSessionPackageManagerImpl packageManager = (CDOSessionPackageManagerImpl)session.getPackageManager();
- CDOPackage cdoPackage = ModelUtil.getCDOPackage(ePackage, packageManager);
- CDOIDMetaRange metaIDRange = cdoPackage.getTopLevelPackage().getMetaIDRange();
- ((InternalCDOPackage)cdoPackage).setPersistent(metaIDRange != null && !metaIDRange.isTemporary());
- }
-
- return super.put(key, value);
- }
-
- @Override
- public void putAll(Map<? extends String, ? extends Object> m)
- {
- throw new UnsupportedOperationException();
- }
-
- private void checkSession()
- {
- if (session == null)
- {
- throw new IllegalStateException("session == null");
- }
- }
-
- /**
- * @author Eike Stepper
- */
- private final class RemotePackageDescriptor implements EPackage.Descriptor
- {
- private CDOPackage cdoPackage;
-
- private RemotePackageDescriptor(CDOPackage cdoPackage)
- {
- this.cdoPackage = cdoPackage;
- }
-
- public CDOPackage getCDOPackage()
- {
- return cdoPackage;
- }
-
- public EFactory getEFactory()
- {
- // TODO Implement method RemotePackageDescriptor.getEFactory()
- throw new UnsupportedOperationException("Not yet implemented");
- }
-
- public EPackage getEPackage()
- {
- EPackage ePackage = ModelUtil.createEPackage(cdoPackage);
- CDOIDMetaRange idRange = cdoPackage.getMetaIDRange();
- if (idRange != null)
- {
- session.registerEPackage(ePackage, idRange);
- }
-
- return ePackage;
- }
-
- @Override
- public String toString()
- {
- return MessageFormat.format("RemotePackageDescriptor[{0}]", cdoPackage.getPackageURI());
- }
- }
-
- /**
- * @author Eike Stepper
- */
- public static abstract class SessionBound extends CDOPackageRegistryImpl
- {
- private static final long serialVersionUID = 1L;
-
- private IListener sessionLifecycleListener = new LifecycleEventAdapter()
- {
- @Override
- protected void onActivated(ILifecycle lifecycle)
- {
- sessionActivated();
- }
-
- @Override
- protected void onAboutToDeactivate(ILifecycle lifecycle)
- {
- getSession().removeListener(this);
- sessionAboutToDeactivate();
- }
- };
-
- public SessionBound()
- {
- }
-
- @Override
- public void setSession(CDOSession session)
- {
- super.setSession(session);
- session.addListener(sessionLifecycleListener);
- }
-
- protected abstract void sessionActivated();
-
- protected abstract void sessionAboutToDeactivate();
- }
-
- /**
- * @author Eike Stepper
- */
- public static class Eager extends SessionBound
- {
- private static final long serialVersionUID = 1L;
-
- private IListener typeListener = new ContainerEventAdapter<Map.Entry<String, CDOPackageType>>()
- {
- @Override
- protected void onAdded(IContainer<java.util.Map.Entry<String, CDOPackageType>> container,
- java.util.Map.Entry<String, CDOPackageType> entry)
- {
- addEntry(entry);
- }
- };
-
- public Eager()
- {
- }
-
- @Override
- protected void sessionActivated()
- {
- for (Map.Entry<String, CDOPackageType> entry : CDOPackageTypeRegistry.INSTANCE.entrySet())
- {
- addEntry(entry);
- }
-
- CDOPackageTypeRegistry.INSTANCE.addListener(typeListener);
- }
-
- @Override
- protected void sessionAboutToDeactivate()
- {
- CDOPackageTypeRegistry.INSTANCE.removeListener(typeListener);
- }
-
- protected void addEntry(Map.Entry<String, CDOPackageType> entry)
- {
- CDOPackageType packageType = entry.getValue();
- // TODO LEGACY
- if (packageType != CDOPackageType.LEGACY)
- {
- String uri = entry.getKey();
- if (!containsKey(uri))
- {
- try
- {
- EPackage ePackage = EPackage.Registry.INSTANCE.getEPackage(uri);
- if (ePackage.getESuperPackage() == null)
- {
- putEPackage(ePackage);
- }
- }
- catch (RuntimeException ex)
- {
- OM.LOG.error(ex);
- }
- }
- }
- }
- }
-
- /**
- * @author Eike Stepper
- */
- public static class TransactionBound extends SessionBound implements CDOTransactionHandler
- {
- private static final long serialVersionUID = 1L;
-
- private List<CDOTransaction> transactions = new ArrayList<CDOTransaction>();
-
- private IListener sessionContainerListener = new ContainerEventAdapter<CDOView>()
- {
- @Override
- protected void onAdded(IContainer<CDOView> session, CDOView view)
- {
- if (view instanceof CDOTransaction)
- {
- CDOTransaction transaction = (CDOTransaction)view;
- transaction.addHandler(TransactionBound.this);
- synchronized (transactions)
- {
- transactions.add(transaction);
- }
- }
- }
-
- @Override
- protected void onRemoved(IContainer<CDOView> session, CDOView view)
- {
- if (view instanceof CDOTransaction)
- {
- CDOTransaction transaction = (CDOTransaction)view;
- transaction.removeHandler(TransactionBound.this);
- synchronized (transactions)
- {
- transactions.remove(transaction);
- }
- }
- }
- };
-
- public TransactionBound()
- {
- }
-
- @Override
- protected void sessionActivated()
- {
- getSession().addListener(sessionContainerListener);
- }
-
- @Override
- protected void sessionAboutToDeactivate()
- {
- getSession().removeListener(sessionContainerListener);
- synchronized (transactions)
- {
- for (CDOTransaction transaction : transactions)
- {
- transaction.removeHandler(this);
- }
-
- transactions.clear();
- }
- }
-
- public void attachingObject(CDOTransaction transaction, CDOObject object)
- {
- }
-
- public void modifyingObject(CDOTransaction transaction, CDOObject object, CDOFeatureDelta featureDelta)
- {
- }
-
- public void committingTransaction(CDOTransaction transaction, CDOCommitContext commitContext)
- {
- }
-
- public void rolledBackTransaction(CDOTransaction transaction)
- {
- }
-
- public void detachingObject(CDOTransaction transaction, CDOObject object)
- {
- }
-
- public void committedTransaction(CDOTransaction transaction, CDOCommitContext commitContext)
- {
- }
- }
-
- /**
- * @author Eike Stepper
- */
- public static class Lazy extends TransactionBound
- {
- private static final long serialVersionUID = 1L;
-
- private Set<EClass> usedClasses = new HashSet<EClass>();
-
- public Lazy()
- {
- }
-
- @Override
- public void attachingObject(CDOTransaction transaction, CDOObject object)
- {
- EClass usedClass = object.eClass();
- addAllEPackages(usedClass);
- }
-
- private void addAllEPackages(EClass eClass)
- {
- if (usedClasses.add(eClass))
- {
- addPackage(eClass.getEPackage());
- for (EClass superType : eClass.getEAllSuperTypes())
- {
- addAllEPackages(superType);
- }
-
- for (EReference eReference : eClass.getEAllReferences())
- {
- addAllEPackages(eReference.getEReferenceType());
- }
- }
- }
-
- @Override
- protected void sessionAboutToDeactivate()
- {
- usedClasses.clear();
- super.sessionAboutToDeactivate();
- }
-
- private void addPackage(EPackage ePackage)
- {
- if (!containsKey(ePackage.getNsURI()))
- {
- EPackage topLevelPackage = ModelUtil.getTopLevelPackage(ePackage);
- // PutEPackage
- putEPackage(topLevelPackage);
- }
- }
- }
-}
diff --git a/plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/internal/cdo/session/CDOPackageTypeRegistryImpl.java b/plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/internal/cdo/session/CDOPackageTypeRegistryImpl.java
deleted file mode 100644
index 38423ec660..0000000000
--- a/plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/internal/cdo/session/CDOPackageTypeRegistryImpl.java
+++ /dev/null
@@ -1,269 +0,0 @@
-/**
- * Copyright (c) 2004 - 2009 Eike Stepper (Berlin, Germany) and others.
- * 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.session;
-
-import org.eclipse.emf.cdo.CDOObject;
-import org.eclipse.emf.cdo.eresource.EresourcePackage;
-import org.eclipse.emf.cdo.session.CDOPackageType;
-import org.eclipse.emf.cdo.session.CDOPackageTypeRegistry;
-import org.eclipse.emf.cdo.util.CDOFactory;
-
-import org.eclipse.emf.internal.cdo.bundle.OM;
-import org.eclipse.emf.internal.cdo.util.ModelUtil;
-
-import org.eclipse.net4j.util.StringUtil;
-import org.eclipse.net4j.util.ReflectUtil.ExcludeFromDump;
-import org.eclipse.net4j.util.om.OMPlatform;
-import org.eclipse.net4j.util.registry.HashMapRegistry;
-
-import org.eclipse.emf.ecore.EClass;
-import org.eclipse.emf.ecore.EClassifier;
-import org.eclipse.emf.ecore.EFactory;
-import org.eclipse.emf.ecore.EObject;
-import org.eclipse.emf.ecore.EPackage;
-import org.eclipse.emf.ecore.impl.EPackageImpl;
-import org.eclipse.emf.ecore.plugin.EcorePlugin;
-import org.eclipse.emf.ecore.util.EcoreUtil;
-
-import org.eclipse.core.runtime.IConfigurationElement;
-import org.eclipse.core.runtime.IExtension;
-import org.eclipse.core.runtime.IExtensionPoint;
-import org.eclipse.core.runtime.Platform;
-import org.eclipse.core.runtime.dynamichelpers.ExtensionTracker;
-import org.eclipse.core.runtime.dynamichelpers.IExtensionChangeHandler;
-import org.eclipse.core.runtime.dynamichelpers.IExtensionTracker;
-import org.eclipse.core.runtime.dynamichelpers.IFilter;
-
-import org.osgi.framework.Bundle;
-
-import java.util.HashMap;
-import java.util.Map;
-
-/**
- * @author Eike Stepper
- */
-public final class CDOPackageTypeRegistryImpl extends HashMapRegistry<String, CDOPackageType> implements
- CDOPackageTypeRegistry
-{
- public static final CDOPackageTypeRegistryImpl INSTANCE = new CDOPackageTypeRegistryImpl();
-
- private static final String ECORE_ID = "org.eclipse.emf.ecore";
-
- @ExcludeFromDump
- private transient Object extensionTracker;
-
- private CDOPackageTypeRegistryImpl()
- {
- activate();
- }
-
- public void register(EPackage ePackage)
- {
- put(ePackage.getNsURI(), getPackageType(ePackage));
- }
-
- public void registerLegacy(String packageURI)
- {
- put(packageURI, CDOPackageType.LEGACY);
- }
-
- public void registerNative(String packageURI)
- {
- put(packageURI, CDOPackageType.NATIVE);
- }
-
- public void reset()
- {
- deactivate();
- activate();
- }
-
- @Override
- protected void doActivate() throws Exception
- {
- super.doActivate();
- initPackageTypes();
- if (OMPlatform.INSTANCE.isOSGiRunning())
- {
- try
- {
- connectExtensionTracker();
- }
- catch (Throwable t)
- {
- OM.LOG.error(t);
- }
- }
- }
-
- @Override
- protected void doDeactivate() throws Exception
- {
- if (OMPlatform.INSTANCE.isOSGiRunning())
- {
- try
- {
- disconnectExtensionTracker();
- }
- catch (Throwable t)
- {
- OM.LOG.error(t);
- }
- }
-
- clear();
- super.doDeactivate();
- }
-
- private void initPackageTypes()
- {
- for (Object object : EPackage.Registry.INSTANCE.values())
- {
- if (object instanceof EPackage)
- {
- EPackage ePackage = (EPackage)object;
- register(ePackage);
- }
- }
-
- if (OMPlatform.INSTANCE.isOSGiRunning())
- {
- IConfigurationElement[] elements = Platform.getExtensionRegistry().getConfigurationElementsFor(ECORE_ID,
- EcorePlugin.GENERATED_PACKAGE_PPID);
- addPackageTypes(elements);
- }
- }
-
- private void addPackageTypes(IConfigurationElement[] elements)
- {
- Map<String, CDOPackageType> bundles = new HashMap<String, CDOPackageType>();
- for (IConfigurationElement element : elements)
- {
- String uri = element.getAttribute("uri");
- if (!StringUtil.isEmpty(uri) && !uri.equals(EresourcePackage.eINSTANCE.getNsURI()) && !containsKey(uri))
- {
- String bundleName = element.getContributor().getName();
- CDOPackageType packageType = bundles.get(bundleName);
- if (packageType == null)
- {
- Bundle bundle = Platform.getBundle(bundleName);
- packageType = getBundleType(bundle);
- bundles.put(bundleName, packageType);
- }
-
- put(uri, packageType);
- }
- }
- }
-
- private CDOPackageType getBundleType(Bundle bundle)
- {
- if (bundle.getEntry("META-INF/CDO.MF") != null)
- {
- return CDOPackageType.NATIVE;
- }
-
- return CDOPackageType.LEGACY;
- }
-
- private void connectExtensionTracker()
- {
- ExtensionTracker extensionTracker = new ExtensionTracker();
- extensionTracker.registerHandler(new IExtensionChangeHandler()
- {
- public void addExtension(IExtensionTracker tracker, IExtension extension)
- {
- IConfigurationElement[] elements = extension.getConfigurationElements();
- addPackageTypes(elements);
- }
-
- public void removeExtension(IExtension extension, Object[] objects)
- {
- }
- }, createExtensionPointFilter());
-
- this.extensionTracker = extensionTracker;
- }
-
- private void disconnectExtensionTracker()
- {
- ExtensionTracker extensionTracker = (ExtensionTracker)this.extensionTracker;
- extensionTracker.close();
- }
-
- private IFilter createExtensionPointFilter()
- {
- final IExtensionPoint xpt = Platform.getExtensionRegistry().getExtensionPoint("org.eclipse.emf.ecore",
- EcorePlugin.GENERATED_PACKAGE_PPID);
- return new IFilter()
- {
- public boolean matches(IExtensionPoint target)
- {
- return xpt.equals(target);
- }
- };
- }
-
- public static CDOPackageType getPackageType(EPackage ePackage)
- {
- if (ePackage.getClass() == EPackageImpl.class)
- {
- EFactory factory = ePackage.getEFactoryInstance();
- if (factory instanceof CDOFactory)
- {
- return CDOPackageType.NATIVE;
- }
-
- return CDOPackageType.LEGACY;
- }
-
- EPackage topLevelPackage = ModelUtil.getTopLevelPackage(ePackage);
- EClass eClass = getAnyConcreteEClass(topLevelPackage);
- if (eClass == null)
- {
- return CDOPackageType.LEGACY;
- }
-
- EObject testObject = EcoreUtil.create(eClass);
- if (testObject instanceof CDOObject)
- {
- return CDOPackageType.NATIVE;
- }
-
- return CDOPackageType.LEGACY;
- }
-
- private static EClass getAnyConcreteEClass(EPackage ePackage)
- {
- for (EClassifier classifier : ePackage.getEClassifiers())
- {
- if (classifier instanceof EClass)
- {
- EClass eClass = (EClass)classifier;
- if (!(eClass.isAbstract() || eClass.isInterface()))
- {
- return eClass;
- }
- }
- }
-
- for (EPackage subpackage : ePackage.getESubpackages())
- {
- EClass eClass = getAnyConcreteEClass(subpackage);
- if (eClass != null)
- {
- return eClass;
- }
- }
-
- return null;
- }
-}
diff --git a/plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/internal/cdo/session/CDORevisionManagerImpl.java b/plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/internal/cdo/session/CDORevisionManagerImpl.java
index 07f792e708..69d6ede7e6 100644
--- a/plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/internal/cdo/session/CDORevisionManagerImpl.java
+++ b/plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/internal/cdo/session/CDORevisionManagerImpl.java
@@ -13,14 +13,13 @@ package org.eclipse.emf.internal.cdo.session;
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.internal.common.revision.CDORevisionResolverImpl;
import org.eclipse.emf.cdo.session.CDORevisionManager;
import org.eclipse.emf.cdo.spi.common.revision.InternalCDORevision;
import org.eclipse.emf.cdo.view.CDOFetchRuleManager;
+import org.eclipse.emf.ecore.EStructuralFeature;
import org.eclipse.emf.spi.cdo.InternalCDOSession;
import java.util.Collection;
@@ -76,7 +75,7 @@ public class CDORevisionManagerImpl extends CDORevisionResolverImpl implements C
/**
* @since 2.0
*/
- public Object resolveElementProxy(CDORevision revision, CDOFeature feature, int accessIndex, int serverIndex)
+ public Object resolveElementProxy(CDORevision revision, EStructuralFeature feature, int accessIndex, int serverIndex)
{
return session.options().getCollectionLoadingPolicy().resolveProxy(this, revision, feature, accessIndex,
serverIndex);
@@ -85,7 +84,7 @@ public class CDORevisionManagerImpl extends CDORevisionResolverImpl implements C
/**
* @since 2.0
*/
- public Object loadChunkByRange(CDORevision revision, CDOFeature feature, int accessIndex, int fetchIndex,
+ public Object loadChunkByRange(CDORevision revision, EStructuralFeature feature, int accessIndex, int fetchIndex,
int fromIndex, int toIndex)
{
return session.getSessionProtocol().loadChunk((InternalCDORevision)revision, feature, accessIndex, fetchIndex,
@@ -121,13 +120,4 @@ public class CDORevisionManagerImpl extends CDORevisionResolverImpl implements C
{
return session.getSessionProtocol().loadRevisionsByTime(ids, referenceChunk, timeStamp);
}
-
- /**
- * @since 2.0
- */
- @Override
- protected CDOPackageManager getPackageManager()
- {
- return session.getPackageManager();
- }
}
diff --git a/plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/internal/cdo/session/CDOSessionConfigurationImpl.java b/plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/internal/cdo/session/CDOSessionConfigurationImpl.java
index 4bd38d7b06..f410106d09 100644
--- a/plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/internal/cdo/session/CDOSessionConfigurationImpl.java
+++ b/plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/internal/cdo/session/CDOSessionConfigurationImpl.java
@@ -10,11 +10,10 @@
*/
package org.eclipse.emf.internal.cdo.session;
+import org.eclipse.emf.cdo.common.model.CDOPackageRegistry;
import org.eclipse.emf.cdo.common.revision.cache.CDORevisionCache;
-import org.eclipse.emf.cdo.session.CDOPackageRegistry;
import org.eclipse.emf.cdo.session.CDOSession;
import org.eclipse.emf.cdo.session.CDOSessionConfiguration;
-import org.eclipse.emf.cdo.util.CDOUtil;
import org.eclipse.emf.spi.cdo.InternalCDOSession;
@@ -68,22 +67,6 @@ public abstract class CDOSessionConfigurationImpl implements CDOSessionConfigura
/**
* @since 2.0
*/
- public void setEagerPackageRegistry()
- {
- setPackageRegistry(CDOUtil.createEagerPackageRegistry());
- }
-
- /**
- * @since 2.0
- */
- public void setLazyPackageRegistry()
- {
- setPackageRegistry(CDOUtil.createLazyPackageRegistry());
- }
-
- /**
- * @since 2.0
- */
public CDORevisionCache getRevisionCache()
{
return revisionCache;
diff --git a/plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/internal/cdo/session/CDOSessionImpl.java b/plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/internal/cdo/session/CDOSessionImpl.java
index ef89740c5b..9a8838b44b 100644
--- a/plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/internal/cdo/session/CDOSessionImpl.java
+++ b/plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/internal/cdo/session/CDOSessionImpl.java
@@ -19,33 +19,33 @@ import org.eclipse.emf.cdo.CDOObject;
import org.eclipse.emf.cdo.common.id.CDOID;
import org.eclipse.emf.cdo.common.id.CDOIDAndVersion;
import org.eclipse.emf.cdo.common.id.CDOIDLibraryDescriptor;
-import org.eclipse.emf.cdo.common.id.CDOIDMetaRange;
import org.eclipse.emf.cdo.common.id.CDOIDObject;
import org.eclipse.emf.cdo.common.id.CDOIDObjectFactory;
-import org.eclipse.emf.cdo.common.id.CDOIDTemp;
-import org.eclipse.emf.cdo.common.id.CDOIDTempMeta;
-import org.eclipse.emf.cdo.common.id.CDOIDUtil;
import org.eclipse.emf.cdo.common.io.CDODataInput;
-import org.eclipse.emf.cdo.common.model.CDOClass;
-import org.eclipse.emf.cdo.common.model.CDOPackage;
+import org.eclipse.emf.cdo.common.model.CDOPackageRegistry;
+import org.eclipse.emf.cdo.common.model.CDOPackageUnit;
+import org.eclipse.emf.cdo.common.model.EMFUtil;
import org.eclipse.emf.cdo.common.revision.CDORevision;
import org.eclipse.emf.cdo.common.revision.CDORevisionFactory;
import org.eclipse.emf.cdo.common.revision.CDORevisionUtil;
import org.eclipse.emf.cdo.common.revision.delta.CDORevisionDelta;
+import org.eclipse.emf.cdo.common.util.CDOException;
+import org.eclipse.emf.cdo.eresource.EresourcePackage;
+import org.eclipse.emf.cdo.internal.common.model.CDOPackageRegistryImpl;
import org.eclipse.emf.cdo.session.CDOCollectionLoadingPolicy;
-import org.eclipse.emf.cdo.session.CDOPackageRegistry;
import org.eclipse.emf.cdo.session.CDOSession;
import org.eclipse.emf.cdo.session.CDOSessionInvalidationEvent;
-import org.eclipse.emf.cdo.session.CDOSession.Repository;
+import org.eclipse.emf.cdo.spi.common.model.InternalCDOPackageRegistry;
+import org.eclipse.emf.cdo.spi.common.model.InternalCDOPackageUnit;
import org.eclipse.emf.cdo.spi.common.revision.InternalCDORevision;
import org.eclipse.emf.cdo.transaction.CDOTimeStampContext;
import org.eclipse.emf.cdo.util.CDOUtil;
import org.eclipse.emf.cdo.view.CDOView;
+import org.eclipse.emf.internal.cdo.CDOFactoryImpl;
import org.eclipse.emf.internal.cdo.bundle.OM;
import org.eclipse.emf.internal.cdo.session.remote.CDORemoteSessionManagerImpl;
import org.eclipse.emf.internal.cdo.transaction.CDOTransactionImpl;
-import org.eclipse.emf.internal.cdo.util.ModelUtil;
import org.eclipse.emf.internal.cdo.view.CDOAuditImpl;
import org.eclipse.emf.internal.cdo.view.CDOViewImpl;
@@ -56,17 +56,15 @@ import org.eclipse.net4j.util.container.Container;
import org.eclipse.net4j.util.event.Event;
import org.eclipse.net4j.util.event.Notifier;
import org.eclipse.net4j.util.io.ExtendedDataInput;
-import org.eclipse.net4j.util.io.ExtendedDataOutput;
import org.eclipse.net4j.util.io.IOUtil;
-import org.eclipse.net4j.util.io.StringCompressor;
import org.eclipse.net4j.util.lifecycle.LifecycleUtil;
import org.eclipse.net4j.util.om.trace.ContextTracer;
-import org.eclipse.net4j.util.options.IOptions;
import org.eclipse.net4j.util.options.IOptionsContainer;
import org.eclipse.net4j.util.options.OptionsEvent;
+import org.eclipse.emf.ecore.EClass;
import org.eclipse.emf.ecore.EPackage;
-import org.eclipse.emf.ecore.InternalEObject;
+import org.eclipse.emf.ecore.EcorePackage;
import org.eclipse.emf.ecore.resource.ResourceSet;
import org.eclipse.emf.ecore.resource.impl.ResourceSetImpl;
import org.eclipse.emf.spi.cdo.InternalCDOObject;
@@ -93,25 +91,17 @@ import java.util.Set;
/**
* @author Eike Stepper
*/
-public abstract class CDOSessionImpl extends Container<CDOView> implements InternalCDOSession, Repository
+public abstract class CDOSessionImpl extends Container<CDOView> implements InternalCDOSession
{
private static final ContextTracer TRACER = new ContextTracer(OM.DEBUG_SESSION, CDOSessionImpl.class);
private int sessionID;
- private String repositoryName;
+ private CDOSession.Options options;
- private String repositoryUUID;
+ private CDOSession.Repository repository;
- private long repositoryCreationTime;
-
- private RepositoryTimeResult repositoryTimeResult;
-
- private boolean repositorySupportingAudits;
-
- private CDOPackageRegistry packageRegistry;
-
- private CDOSessionPackageManagerImpl packageManager;
+ private InternalCDOPackageRegistry packageRegistry;
private CDORevisionManagerImpl revisionManager;
@@ -119,37 +109,21 @@ public abstract class CDOSessionImpl extends Container<CDOView> implements Inter
private Set<InternalCDOView> views = new HashSet<InternalCDOView>();
- private QueueRunner invalidationRunner;
-
- private Object invalidationRunnerLock = new Object();
-
@ExcludeFromDump
- private transient Map<CDOID, InternalEObject> idToMetaInstanceMap = new HashMap<CDOID, InternalEObject>();
-
- @ExcludeFromDump
- private transient Map<InternalEObject, CDOID> metaInstanceToIDMap = new HashMap<InternalEObject, CDOID>();
-
- @ExcludeFromDump
- private transient int lastViewID;
+ private CDOIDObjectFactory cdoidObjectFactory;
@ExcludeFromDump
- private transient int lastTempMetaID;
+ private transient QueueRunner invalidationRunner;
@ExcludeFromDump
- private transient StringCompressor packageURICompressor;
+ private transient Object invalidationRunnerLock = new Object();
@ExcludeFromDump
- private CDOIDObjectFactory cdoidObjectFactory;
-
- /**
- * @since 2.0
- */
- protected IOptions options;
+ private transient int lastViewID;
public CDOSessionImpl()
{
options = createOptions();
- packageManager = createPackageManager();
revisionManager = createRevisionManager();
remoteSessionManager = createRemoteSessionManager();
}
@@ -162,15 +136,15 @@ public abstract class CDOSessionImpl extends Container<CDOView> implements Inter
/**
* @since 2.0
*/
- public OptionsImpl options()
+ public CDOSession.Options options()
{
- return (OptionsImpl)options;
+ return options;
}
/**
* @since 2.0
*/
- protected OptionsImpl createOptions()
+ protected CDOSession.Options createOptions()
{
return new OptionsImpl();
}
@@ -178,118 +152,81 @@ public abstract class CDOSessionImpl extends Container<CDOView> implements Inter
/**
* @since 2.0
*/
- public Repository repository()
- {
- return this;
- }
-
- public CDOIDObject createCDOIDObject(ExtendedDataInput in)
- {
- return cdoidObjectFactory.createCDOIDObject(in);
- }
-
- /**
- * @since 2.0
- */
- public CDOIDObject createCDOIDObject(String in)
+ public CDOSession.Repository repository()
{
- return cdoidObjectFactory.createCDOIDObject(in);
+ return repository;
}
/**
+ * @param result
* @since 2.0
*/
- public String getName()
- {
- return repositoryName;
- }
-
- public void setRepositoryName(String repositoryName)
+ protected CDOSession.Repository createRepository(OpenSessionResult result)
{
- this.repositoryName = repositoryName;
+ return new RepositoryImpl(repository.getName(), result);
}
- /**
- * @since 2.0
- */
- public String getUUID()
+ public CDOIDObject createCDOIDObject(ExtendedDataInput in)
{
- return repositoryUUID;
+ return cdoidObjectFactory.createCDOIDObject(in);
}
/**
* @since 2.0
*/
- public long getCreationTime()
+ public CDOIDObject createCDOIDObject(String in)
{
- checkActive();
- return repositoryCreationTime;
+ return cdoidObjectFactory.createCDOIDObject(in);
}
- /**
- * @since 2.0
- */
- public long getCurrentTime()
+ public void close()
{
- return getCurrentTime(false);
+ deactivate();
}
/**
* @since 2.0
*/
- public long getCurrentTime(boolean forceRefresh)
+ public boolean isClosed()
{
- checkActive();
- if (repositoryTimeResult == null || forceRefresh)
- {
- repositoryTimeResult = sendRepositoryTimeRequest();
- }
-
- return repositoryTimeResult.getAproximateRepositoryTime();
+ return !isActive();
}
- private RepositoryTimeResult sendRepositoryTimeRequest()
+ public void setRepositoryName(String repositoryName)
{
- return getSessionProtocol().getRepositoryTime();
+ repository = new TemporaryRepositoryName(repositoryName);
}
/**
* @since 2.0
*/
- public boolean isSupportingAudits()
+ public void setPackageRegistry(CDOPackageRegistry packageRegistry)
{
- return repositorySupportingAudits;
+ this.packageRegistry = (InternalCDOPackageRegistry)packageRegistry;
}
- public void close()
+ public InternalCDOPackageRegistry getPackageRegistry()
{
- deactivate();
- }
-
- /**
- * @since 2.0
- */
- public boolean isClosed()
- {
- return !isActive();
+ return packageRegistry;
}
- /**
- * @since 2.0
- */
- public void setPackageRegistry(CDOPackageRegistry packageRegistry)
+ public Object processPackage(Object value)
{
- this.packageRegistry = packageRegistry;
+ CDOFactoryImpl.prepareDynamicEPackage(value);
+ return value;
}
- public CDOPackageRegistry getPackageRegistry()
+ public EPackage[] loadPackages(CDOPackageUnit packageUnit)
{
- return packageRegistry;
- }
+ if (packageUnit.getOriginalType().isGenerated())
+ {
+ if (!options().isGeneratedPackageEmulationEnabled())
+ {
+ throw new CDOException("Generated packages locally not available: " + packageUnit);
+ }
+ }
- public CDOSessionPackageManagerImpl getPackageManager()
- {
- return packageManager;
+ return getSessionProtocol().loadPackages(packageUnit);
}
public CDORevisionManagerImpl getRevisionManager()
@@ -397,8 +334,6 @@ public abstract class CDOSessionImpl extends Container<CDOView> implements Inter
try
{
LifecycleUtil.deactivate(view);
- // new ViewsChangedRequest(protocol, view.getViewID(), CDOProtocolConstants.VIEW_CLOSED,
- // CDOCommonView.UNSPECIFIED_DATE).send();
}
catch (Exception ex)
{
@@ -447,81 +382,6 @@ public abstract class CDOSessionImpl extends Container<CDOView> implements Inter
return views.isEmpty();
}
- public synchronized CDOIDMetaRange getTempMetaIDRange(int count)
- {
- CDOIDTemp lowerBound = CDOIDUtil.createTempMeta(lastTempMetaID + 1);
- lastTempMetaID += count;
- return CDOIDUtil.createMetaRange(lowerBound, count);
- }
-
- public InternalEObject lookupMetaInstance(CDOID id)
- {
- InternalEObject metaInstance = idToMetaInstanceMap.get(id);
- if (metaInstance == null)
- {
- CDOPackage[] cdoPackages = packageManager.getPackages();
- for (CDOPackage cdoPackage : cdoPackages)
- {
- CDOIDMetaRange metaIDRange = cdoPackage.getMetaIDRange();
- if (metaIDRange != null && metaIDRange.contains(id))
- {
- EPackage ePackage = ModelUtil.getEPackage(cdoPackage, packageRegistry);
- registerEPackage(ePackage);
- metaInstance = idToMetaInstanceMap.get(id);
- break;
- }
- }
- }
-
- return metaInstance;
- }
-
- public CDOID lookupMetaInstanceID(InternalEObject metaInstance)
- {
- return metaInstanceToIDMap.get(metaInstance);
- }
-
- public void registerEPackage(EPackage ePackage, CDOIDMetaRange metaIDRange)
- {
- if (metaIDRange.isTemporary())
- {
- throw new IllegalArgumentException("metaIDRange.isTemporary()");
- }
-
- CDOIDMetaRange range = CDOIDUtil.createMetaRange(metaIDRange.getLowerBound(), 0);
- range = SessionUtil
- .registerMetaInstance((InternalEObject)ePackage, range, idToMetaInstanceMap, metaInstanceToIDMap);
- if (range.size() != metaIDRange.size())
- {
- throw new IllegalStateException("range.size() != metaIDRange.size()");
- }
- }
-
- public CDOIDMetaRange registerEPackage(EPackage ePackage)
- {
- CDOIDMetaRange range = SessionUtil.registerEPackage(ePackage, lastTempMetaID + 1, idToMetaInstanceMap,
- metaInstanceToIDMap);
- lastTempMetaID = ((CDOIDTempMeta)range.getUpperBound()).getIntValue();
- return range;
- }
-
- public void remapMetaInstance(CDOID oldID, CDOID newID)
- {
- InternalEObject metaInstance = idToMetaInstanceMap.remove(oldID);
- if (metaInstance == null)
- {
- throw new IllegalArgumentException("Unknown meta instance id: " + oldID);
- }
-
- if (TRACER.isEnabled())
- {
- TRACER.format("Remapping meta instance: {0} --> {1} <-> {2}", oldID, newID, metaInstance);
- }
-
- idToMetaInstanceMap.put(newID, metaInstance);
- metaInstanceToIDMap.put(metaInstance, newID);
- }
-
/**
* @since 2.0
*/
@@ -662,41 +522,20 @@ public abstract class CDOSessionImpl extends Container<CDOView> implements Inter
fireEvent(new InvalidationEvent(excludedView, timeStamp, dirtyOIDs, detachedObjects));
}
- /**
- * @since 2.0
- */
- public void writePackageURI(ExtendedDataOutput out, String uri) throws IOException
- {
- packageURICompressor.write(out, uri);
- }
-
- /**
- * @since 2.0
- */
- public String readPackageURI(ExtendedDataInput in) throws IOException
- {
- return packageURICompressor.read(in);
- }
-
@Override
public String toString()
{
- return MessageFormat.format("CDOSession[{0}, {1}]", repositoryName, sessionID);
+ return MessageFormat.format("CDOSession[{0}, {1}]", repository().getName(), sessionID);
}
/**
* @since 2.0
*/
- protected CDOPackageRegistry createPackageRegistry()
+ protected InternalCDOPackageRegistry createPackageRegistry()
{
return new CDOPackageRegistryImpl();
}
- protected CDOSessionPackageManagerImpl createPackageManager()
- {
- return new CDOSessionPackageManagerImpl(this);
- }
-
protected CDORevisionManagerImpl createRevisionManager()
{
return new CDORevisionManagerImpl(this);
@@ -751,31 +590,49 @@ public abstract class CDOSessionImpl extends Container<CDOView> implements Inter
{
super.doBeforeActivate();
checkState(getSessionProtocol(), "sessionProtocol");
- checkState(repositoryName, "repositoryName");
+ checkState(repository().getName(), "repository().getName()");
}
@Override
protected void doActivate() throws Exception
{
super.doActivate();
+ revisionManager.activate();
+ remoteSessionManager.activate();
if (packageRegistry == null)
{
packageRegistry = createPackageRegistry();
}
- packageRegistry.setSession(this);
+ packageRegistry.setPackageProcessor(this);
+ packageRegistry.setPackageLoader(this);
+ packageRegistry.activate();
+ // EMFUtil.registerPackage(EcorePackage.eINSTANCE, packageRegistry);
+ // EMFUtil.registerPackage(EresourcePackage.eINSTANCE, packageRegistry);
+
+ String name = repository().getName();
+ boolean passiveUpdateEnabled = options().isPassiveUpdateEnabled();
+ OpenSessionResult result = getSessionProtocol().openSession(name, passiveUpdateEnabled);
- OpenSessionResult result = getSessionProtocol().openSession(repositoryName, options().isPassiveUpdateEnabled());
sessionID = result.getSessionID();
- repositoryUUID = result.getRepositoryUUID();
- repositoryCreationTime = result.getRepositoryCreationTime();
- repositoryTimeResult = result.getRepositoryTimeResult();
- repositorySupportingAudits = result.isRepositorySupportingAudits();
+ repository = createRepository(result);
handleLibraryDescriptor(result.getLibraryDescriptor());
- packageURICompressor = result.getCompressor();
- packageManager.addPackageProxies(result.getPackageInfos());
- packageManager.activate();
- revisionManager.activate();
+
+ for (InternalCDOPackageUnit packageUnit : result.getPackageUnits())
+ {
+ if (EcorePackage.eINSTANCE.getNsURI().equals(packageUnit.getID()))
+ {
+ EMFUtil.addAdapter(EcorePackage.eINSTANCE, packageUnit.getTopLevelPackageInfo());
+ packageUnit.setState(CDOPackageUnit.State.LOADED);
+ }
+ else if (EresourcePackage.eINSTANCE.getNsURI().equals(packageUnit.getID()))
+ {
+ EMFUtil.addAdapter(EresourcePackage.eINSTANCE, packageUnit.getTopLevelPackageInfo());
+ packageUnit.setState(CDOPackageUnit.State.LOADED);
+ }
+
+ packageRegistry.putPackageUnit(packageUnit);
+ }
}
@Override
@@ -804,8 +661,8 @@ public abstract class CDOSessionImpl extends Container<CDOView> implements Inter
revisionManager.deactivate();
revisionManager = null;
- packageManager.deactivate();
- packageManager = null;
+ packageRegistry.deactivate();
+ packageRegistry = null;
super.doDeactivate();
}
@@ -856,7 +713,7 @@ public abstract class CDOSessionImpl extends Container<CDOView> implements Inter
{
String stateLocation = OM.BUNDLE.getStateLocation();
File repos = new File(stateLocation, "repos");
- return new File(repos, repositoryUUID);
+ return new File(repos, repository().getUUID());
}
private Set<String> createSet(String[] fileNames)
@@ -932,67 +789,12 @@ public abstract class CDOSessionImpl extends Container<CDOView> implements Inter
/**
* @author Eike Stepper
- */
- private final class InvalidationEvent extends Event implements CDOSessionInvalidationEvent
- {
- private static final long serialVersionUID = 1L;
-
- private InternalCDOView view;
-
- private long timeStamp;
-
- private Set<CDOIDAndVersion> dirtyOIDs;
-
- private Collection<CDOID> detachedObjects;
-
- public InvalidationEvent(InternalCDOView view, long timeStamp, Set<CDOIDAndVersion> dirtyOIDs,
- Collection<CDOID> detachedObjects)
- {
- super(CDOSessionImpl.this);
- this.view = view;
- this.timeStamp = timeStamp;
- this.dirtyOIDs = dirtyOIDs;
- this.detachedObjects = detachedObjects;
- }
-
- public CDOSession getSession()
- {
- return (CDOSession)getSource();
- }
-
- public InternalCDOView getView()
- {
- return view;
- }
-
- public long getTimeStamp()
- {
- return timeStamp;
- }
-
- public Set<CDOIDAndVersion> getDirtyOIDs()
- {
- return dirtyOIDs;
- }
-
- public Collection<CDOID> getDetachedObjects()
- {
- return detachedObjects;
- }
-
- @Override
- public String toString()
- {
- return "CDOSessionInvalidationEvent: " + dirtyOIDs;
- }
- }
-
- /**
- * @author Eike Stepper
* @since 2.0
*/
protected class OptionsImpl extends Notifier implements Options
{
+ private boolean generatedPackageEmulationEnabled = false;
+
private boolean passiveUpdateEnabled = true;
private CDOCollectionLoadingPolicy collectionLoadingPolicy;
@@ -1011,6 +813,28 @@ public abstract class CDOSessionImpl extends Container<CDOView> implements Inter
return CDOSessionImpl.this;
}
+ public boolean isGeneratedPackageEmulationEnabled()
+ {
+ return generatedPackageEmulationEnabled;
+ }
+
+ public void setGeneratedPackageEmulationEnabled(boolean generatedPackageEmulationEnabled)
+ {
+ this.generatedPackageEmulationEnabled = generatedPackageEmulationEnabled;
+ if (this.generatedPackageEmulationEnabled != generatedPackageEmulationEnabled)
+ {
+ this.generatedPackageEmulationEnabled = generatedPackageEmulationEnabled;
+ // TODO Check inconsistent state if switching off?
+
+ fireEvent(new GeneratedPackageEmulationEventImpl());
+ }
+ }
+
+ public boolean isPassiveUpdateEnabled()
+ {
+ return passiveUpdateEnabled;
+ }
+
public void setPassiveUpdateEnabled(boolean passiveUpdateEnabled)
{
if (this.passiveUpdateEnabled != passiveUpdateEnabled)
@@ -1029,11 +853,6 @@ public abstract class CDOSessionImpl extends Container<CDOView> implements Inter
}
}
- public boolean isPassiveUpdateEnabled()
- {
- return passiveUpdateEnabled;
- }
-
public CDOCollectionLoadingPolicy getCollectionLoadingPolicy()
{
return collectionLoadingPolicy;
@@ -1059,9 +878,9 @@ public abstract class CDOSessionImpl extends Container<CDOView> implements Inter
{
revisionFactory = new CDORevisionFactory()
{
- public CDORevision createRevision(CDOClass cdoClass, CDOID id)
+ public CDORevision createRevision(EClass eClass, CDOID id)
{
- return CDORevisionUtil.create(cdoClass, id);
+ return CDORevisionUtil.create(eClass, id);
}
public CDORevision createRevision(CDODataInput in) throws IOException
@@ -1092,6 +911,20 @@ public abstract class CDOSessionImpl extends Container<CDOView> implements Inter
/**
* @author Eike Stepper
*/
+ private final class GeneratedPackageEmulationEventImpl extends OptionsEvent implements
+ GeneratedPackageEmulationEvent
+ {
+ private static final long serialVersionUID = 1L;
+
+ public GeneratedPackageEmulationEventImpl()
+ {
+ super(OptionsImpl.this);
+ }
+ }
+
+ /**
+ * @author Eike Stepper
+ */
private final class PassiveUpdateEventImpl extends OptionsEvent implements PassiveUpdateEvent
{
private static final long serialVersionUID = 1L;
@@ -1128,4 +961,174 @@ public abstract class CDOSessionImpl extends Container<CDOView> implements Inter
}
}
}
+
+ /**
+ * @author Eike Stepper
+ */
+ protected class RepositoryImpl implements CDOSession.Repository
+ {
+ private String name;
+
+ private String uuid;
+
+ private long creationTime;
+
+ private RepositoryTimeResult timeResult;
+
+ private boolean supportingAudits;
+
+ public RepositoryImpl(String name, OpenSessionResult result)
+ {
+ this.name = name;
+ uuid = result.getRepositoryUUID();
+ creationTime = result.getRepositoryCreationTime();
+ timeResult = result.getRepositoryTimeResult();
+ supportingAudits = result.isRepositorySupportingAudits();
+ }
+
+ public String getName()
+ {
+ return name;
+ }
+
+ /**
+ * Must be callable before session activation has finished!
+ */
+ public String getUUID()
+ {
+ return uuid;
+ }
+
+ public long getCreationTime()
+ {
+ checkActive();
+ return creationTime;
+ }
+
+ public long getCurrentTime()
+ {
+ return getCurrentTime(false);
+ }
+
+ public long getCurrentTime(boolean forceRefresh)
+ {
+ checkActive();
+ if (timeResult == null || forceRefresh)
+ {
+ timeResult = refreshTime();
+ }
+
+ return timeResult.getAproximateRepositoryTime();
+ }
+
+ public boolean isSupportingAudits()
+ {
+ return supportingAudits;
+ }
+
+ private RepositoryTimeResult refreshTime()
+ {
+ return getSessionProtocol().getRepositoryTime();
+ }
+ }
+
+ /**
+ * @author Eike Stepper
+ */
+ private static final class TemporaryRepositoryName implements CDOSession.Repository
+ {
+ private String name;
+
+ public TemporaryRepositoryName(String name)
+ {
+ this.name = name;
+ }
+
+ public String getName()
+ {
+ return name;
+ }
+
+ public long getCreationTime()
+ {
+ throw new UnsupportedOperationException();
+ }
+
+ public long getCurrentTime()
+ {
+ throw new UnsupportedOperationException();
+ }
+
+ public long getCurrentTime(boolean forceRefresh)
+ {
+ throw new UnsupportedOperationException();
+ }
+
+ public String getUUID()
+ {
+ throw new UnsupportedOperationException();
+ }
+
+ public boolean isSupportingAudits()
+ {
+ throw new UnsupportedOperationException();
+ }
+ }
+
+ /**
+ * @author Eike Stepper
+ */
+ private final class InvalidationEvent extends Event implements CDOSessionInvalidationEvent
+ {
+ private static final long serialVersionUID = 1L;
+
+ private InternalCDOView view;
+
+ private long timeStamp;
+
+ private Set<CDOIDAndVersion> dirtyOIDs;
+
+ private Collection<CDOID> detachedObjects;
+
+ public InvalidationEvent(InternalCDOView view, long timeStamp, Set<CDOIDAndVersion> dirtyOIDs,
+ Collection<CDOID> detachedObjects)
+ {
+ super(CDOSessionImpl.this);
+ this.view = view;
+ this.timeStamp = timeStamp;
+ this.dirtyOIDs = dirtyOIDs;
+ this.detachedObjects = detachedObjects;
+ }
+
+ public CDOSession getSession()
+ {
+ return (CDOSession)getSource();
+ }
+
+ public InternalCDOView getView()
+ {
+ return view;
+ }
+
+ public long getTimeStamp()
+ {
+ return timeStamp;
+ }
+
+ public Set<CDOIDAndVersion> getDirtyOIDs()
+ {
+ return dirtyOIDs;
+ }
+
+ public Collection<CDOID> getDetachedObjects()
+ {
+ return detachedObjects;
+ }
+
+ @Override
+ public String toString()
+ {
+ return "CDOSessionInvalidationEvent: " + dirtyOIDs;
+ }
+ }
}
diff --git a/plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/internal/cdo/session/CDOSessionPackageManagerImpl.java b/plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/internal/cdo/session/CDOSessionPackageManagerImpl.java
deleted file mode 100644
index fcf99fce92..0000000000
--- a/plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/internal/cdo/session/CDOSessionPackageManagerImpl.java
+++ /dev/null
@@ -1,171 +0,0 @@
-/**
- * Copyright (c) 2004 - 2009 Eike Stepper (Berlin, Germany) and others.
- * 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
- * Simon McDuff - maintenance
- */
-package org.eclipse.emf.internal.cdo.session;
-
-import org.eclipse.emf.cdo.common.id.CDOIDMetaRange;
-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.CDOModelUtil;
-import org.eclipse.emf.cdo.common.model.CDOPackage;
-import org.eclipse.emf.cdo.common.model.CDOPackageInfo;
-import org.eclipse.emf.cdo.internal.common.model.CDOPackageManagerImpl;
-import org.eclipse.emf.cdo.session.CDOSessionPackageManager;
-
-import org.eclipse.emf.internal.cdo.bundle.OM;
-import org.eclipse.emf.internal.cdo.util.ModelUtil;
-
-import org.eclipse.emf.ecore.EClass;
-import org.eclipse.emf.ecore.EPackage;
-import org.eclipse.emf.ecore.EStructuralFeature;
-import org.eclipse.emf.spi.cdo.InternalCDOSession;
-
-import java.util.Collection;
-import java.util.Map;
-import java.util.concurrent.ConcurrentHashMap;
-
-/**
- * @author Eike Stepper
- */
-public class CDOSessionPackageManagerImpl extends CDOPackageManagerImpl implements CDOSessionPackageManager
-{
- private InternalCDOSession session;
-
- /**
- * For optimization only. Instead of doing 3 lookups we are doing only one.
- * <p>
- * We could apply the same strategy for CDOClass and CDOPackage, because this is an optimization it will be good to do
- * it only if it proof to make a difference. CDOPackage doesn't need to do it since we will do one lookup anyway...
- * otherwise we need to proof it is more efficient.
- * <p>
- * TODO Should we have a cache for CDOClass(to save 1 lookup), CDOPackage (doesn'T save any lookup) ? TODO A reverse
- * lookup cache is it worth it ?
- */
- private Map<EStructuralFeature, CDOFeature> featureCache = new ConcurrentHashMap<EStructuralFeature, CDOFeature>();
-
- /**
- * @since 2.0
- */
- public CDOSessionPackageManagerImpl(InternalCDOSession session)
- {
- this.session = session;
- ModelUtil.addModelInfos(this);
- }
-
- /**
- * @since 2.0
- */
- public InternalCDOSession getSession()
- {
- return session;
- }
-
- public CDOIDObjectFactory getCDOIDObjectFactory()
- {
- return session;
- }
-
- public CDOPackage convert(EPackage ePackage)
- {
- return ModelUtil.getCDOPackage(ePackage, this);
- }
-
- public CDOClass convert(EClass eClass)
- {
- return ModelUtil.getCDOClass(eClass, this);
- }
-
- public CDOFeature convert(EStructuralFeature eFeature)
- {
- return ModelUtil.getCDOFeature(eFeature, this);
- }
-
- public EPackage convert(CDOPackage cdoPackage)
- {
- return ModelUtil.getEPackage(cdoPackage, session.getPackageRegistry());
- }
-
- public EClass convert(CDOClass cdoClass)
- {
- return ModelUtil.getEClass(cdoClass, session.getPackageRegistry());
- }
-
- public EStructuralFeature convert(CDOFeature cdoFeature)
- {
- return ModelUtil.getEFeature(cdoFeature, session.getPackageRegistry());
- }
-
- /**
- * TODO Simon: If we enhance all these convert methods like getCDOFeature I suggest to do it directly in convert and
- * remove the corresdonding static methods from ModelUtil. Then always call through the interface.
- *
- * @since 2.0
- */
- public CDOFeature getCDOFeature(EStructuralFeature eFeature)
- {
- // Do not synchronized since we don't mind putting the same CDOFeeature twice in the Map.
- CDOFeature feature = featureCache.get(eFeature);
- if (feature == null)
- {
- feature = ModelUtil.getCDOFeature(eFeature, this);
- featureCache.put(eFeature, feature);
- }
-
- return feature;
- }
-
- public void addPackageProxies(Collection<CDOPackageInfo> packageInfos)
- {
- for (CDOPackageInfo info : packageInfos)
- {
- String packageURI = info.getPackageURI();
- boolean dynamic = info.isDynamic();
- CDOIDMetaRange metaIDRange = info.getMetaIDRange();
- String parentURI = info.getParentURI();
-
- CDOPackage proxy = CDOModelUtil.createProxyPackage(this, packageURI, dynamic, metaIDRange, parentURI);
- addPackage(proxy);
- session.getPackageRegistry().putPackageDescriptor(proxy);
- }
- }
-
- /**
- * @since 2.0
- */
- public void loadPackage(CDOPackage cdoPackage)
- {
- if (!cdoPackage.isDynamic())
- {
- String uri = cdoPackage.getPackageURI();
- EPackage ePackage = session.getPackageRegistry().getEPackage(uri);
- if (ePackage != null)
- {
- ModelUtil.initializeCDOPackage(ePackage, cdoPackage);
- return;
- }
- }
-
- session.getSessionProtocol().loadPackage(cdoPackage, false);
- if (!cdoPackage.isDynamic())
- {
- OM.LOG.info("Dynamic package created for " + cdoPackage.getPackageURI());
- }
- }
-
- /**
- * @since 2.0
- */
- public void loadPackageEcore(CDOPackage cdoPackage)
- {
- session.getSessionProtocol().loadPackage(cdoPackage, true);
- }
-}
diff --git a/plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/internal/cdo/session/SessionUtil.java b/plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/internal/cdo/session/SessionUtil.java
index 573b3efff6..1ddd197ddc 100644
--- a/plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/internal/cdo/session/SessionUtil.java
+++ b/plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/internal/cdo/session/SessionUtil.java
@@ -10,79 +10,22 @@
*/
package org.eclipse.emf.internal.cdo.session;
-import org.eclipse.emf.cdo.common.id.CDOID;
-import org.eclipse.emf.cdo.common.id.CDOIDMetaRange;
-import org.eclipse.emf.cdo.common.id.CDOIDTemp;
-import org.eclipse.emf.cdo.common.id.CDOIDUtil;
import org.eclipse.emf.cdo.util.CDOUtil;
-import org.eclipse.emf.internal.cdo.bundle.OM;
import org.eclipse.emf.internal.cdo.view.CDOViewSetImpl;
-import org.eclipse.net4j.util.om.trace.ContextTracer;
-
-import org.eclipse.emf.ecore.EObject;
-import org.eclipse.emf.ecore.EPackage;
-import org.eclipse.emf.ecore.InternalEObject;
import org.eclipse.emf.ecore.resource.ResourceSet;
import org.eclipse.emf.spi.cdo.InternalCDOViewSet;
-import java.util.Map;
-
/**
* @author Eike Stepper
*/
public final class SessionUtil
{
- private static final ContextTracer TRACER = new ContextTracer(OM.DEBUG_SESSION, SessionUtil.class);
-
private SessionUtil()
{
}
- public static CDOIDMetaRange registerEPackage(EPackage ePackage, int firstMetaID,
- Map<CDOID, InternalEObject> idToMetaInstances, Map<InternalEObject, CDOID> metaInstanceToIDs)
- {
- CDOIDTemp lowerBound = CDOIDUtil.createTempMeta(firstMetaID);
- CDOIDMetaRange range = CDOIDUtil.createMetaRange(lowerBound, 0);
- range = registerMetaInstance((InternalEObject)ePackage, range, idToMetaInstances, metaInstanceToIDs);
- return range;
- }
-
- public static CDOIDMetaRange registerMetaInstance(InternalEObject metaInstance, CDOIDMetaRange range,
- Map<CDOID, InternalEObject> idToMetaInstances, Map<InternalEObject, CDOID> metaInstanceToIDs)
- {
- range = range.increase();
- CDOID id = range.getUpperBound();
- if (TRACER.isEnabled())
- {
- TRACER.format("Registering meta instance: {0} <-> {1}", id, metaInstance);
- }
-
- if (idToMetaInstances != null)
- {
- if (idToMetaInstances.put(id, metaInstance) != null)
- {
- throw new IllegalStateException("Duplicate meta ID: " + id + " --> " + metaInstance);
- }
- }
-
- if (metaInstanceToIDs != null)
- {
- if (metaInstanceToIDs.put(metaInstance, id) != null)
- {
- throw new IllegalStateException("Duplicate metaInstance: " + metaInstance + " --> " + id);
- }
- }
-
- for (EObject content : metaInstance.eContents())
- {
- range = registerMetaInstance((InternalEObject)content, range, idToMetaInstances, metaInstanceToIDs);
- }
-
- return range;
- }
-
/**
* @since 2.0
*/
diff --git a/plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/internal/cdo/transaction/CDOTransactionImpl.java b/plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/internal/cdo/transaction/CDOTransactionImpl.java
index f2929fe496..9c6e9bd542 100644
--- a/plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/internal/cdo/transaction/CDOTransactionImpl.java
+++ b/plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/internal/cdo/transaction/CDOTransactionImpl.java
@@ -18,7 +18,10 @@ import org.eclipse.emf.cdo.common.id.CDOID;
import org.eclipse.emf.cdo.common.id.CDOIDAndVersion;
import org.eclipse.emf.cdo.common.id.CDOIDTemp;
import org.eclipse.emf.cdo.common.id.CDOIDUtil;
-import org.eclipse.emf.cdo.common.model.CDOPackage;
+import org.eclipse.emf.cdo.common.model.CDOModelUtil;
+import org.eclipse.emf.cdo.common.model.CDOPackageRegistry;
+import org.eclipse.emf.cdo.common.model.CDOPackageUnit;
+import org.eclipse.emf.cdo.common.model.EMFUtil;
import org.eclipse.emf.cdo.common.revision.CDORevision;
import org.eclipse.emf.cdo.common.revision.delta.CDOFeatureDelta;
import org.eclipse.emf.cdo.common.revision.delta.CDORevisionDelta;
@@ -30,7 +33,7 @@ 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.model.InternalCDOPackage;
+import org.eclipse.emf.cdo.spi.common.model.InternalCDOPackageUnit;
import org.eclipse.emf.cdo.spi.common.revision.InternalCDORevisionDelta;
import org.eclipse.emf.cdo.transaction.CDOConflictResolver;
import org.eclipse.emf.cdo.transaction.CDOSavepoint;
@@ -45,11 +48,9 @@ import org.eclipse.emf.cdo.view.CDOViewResourcesEvent;
import org.eclipse.emf.internal.cdo.CDOObjectMerger;
import org.eclipse.emf.internal.cdo.CDOStateMachine;
import org.eclipse.emf.internal.cdo.bundle.OM;
-import org.eclipse.emf.internal.cdo.session.CDOSessionPackageManagerImpl;
import org.eclipse.emf.internal.cdo.util.CompletePackageClosure;
import org.eclipse.emf.internal.cdo.util.FSMUtil;
import org.eclipse.emf.internal.cdo.util.IPackageClosure;
-import org.eclipse.emf.internal.cdo.util.ModelUtil;
import org.eclipse.emf.internal.cdo.view.CDOViewImpl;
import org.eclipse.net4j.util.ImplementationError;
@@ -927,6 +928,8 @@ public class CDOTransactionImpl extends CDOViewImpl implements InternalCDOTransa
TRACER.format("Registering new object {0}", object);
}
+ registerNewPackage(object.eClass().getEPackage());
+
for (CDOTransactionHandler handler : getHandlers())
{
handler.attachingObject(this, object);
@@ -942,6 +945,15 @@ public class CDOTransactionImpl extends CDOViewImpl implements InternalCDOTransa
}
}
+ private void registerNewPackage(EPackage ePackage)
+ {
+ CDOPackageRegistry packageRegistry = getSession().getPackageRegistry();
+ if (!packageRegistry.containsKey(ePackage.getNsURI()))
+ {
+ packageRegistry.putEPackage(ePackage);
+ }
+ }
+
/**
* Receives notification for new and dirty objects
*/
@@ -1020,10 +1032,9 @@ public class CDOTransactionImpl extends CDOViewImpl implements InternalCDOTransa
}
}
- @SuppressWarnings("unchecked")
- private List<CDOPackage> analyzeNewPackages()
+ private List<CDOPackageUnit> analyzeNewPackages()
{
- CDOSessionPackageManagerImpl packageManager = (CDOSessionPackageManagerImpl)getSession().getPackageManager();
+ CDOPackageRegistry packageRegistry = getSession().getPackageRegistry();
Set<EPackage> usedPackages = new HashSet<EPackage>();
Set<EPackage> usedNewPackages = new HashSet<EPackage>();
for (CDOObject object : getNewObjects().values())
@@ -1031,13 +1042,16 @@ public class CDOTransactionImpl extends CDOViewImpl implements InternalCDOTransa
EPackage ePackage = object.eClass().getEPackage();
if (usedPackages.add(ePackage))
{
- EPackage topLevelPackage = ModelUtil.getTopLevelPackage(ePackage);
+ EPackage topLevelPackage = EMFUtil.getTopLevelPackage(ePackage);
if (ePackage == topLevelPackage || usedPackages.add(topLevelPackage))
{
- CDOPackage cdoPackage = ModelUtil.getCDOPackage(topLevelPackage, packageManager);
- if (!cdoPackage.isPersistent() && !cdoPackage.isSystem())
+ if (!CDOModelUtil.isSystemPackage(topLevelPackage))
{
- usedNewPackages.add(topLevelPackage);
+ CDOPackageUnit packageUnit = packageRegistry.getPackageUnit(topLevelPackage);
+ if (packageUnit.getState() == CDOPackageUnit.State.NEW)
+ {
+ usedNewPackages.add(topLevelPackage);
+ }
}
}
}
@@ -1045,32 +1059,42 @@ public class CDOTransactionImpl extends CDOViewImpl implements InternalCDOTransa
if (usedNewPackages.size() > 0)
{
- return analyzeNewPackages(usedNewPackages, packageManager);
+ Set<CDOPackageUnit> result = new HashSet<CDOPackageUnit>();
+ for (EPackage usedNewPackage : analyzeNewPackages(usedNewPackages, packageRegistry))
+ {
+ CDOPackageUnit packageUnit = packageRegistry.getPackageUnit(usedNewPackage);
+ result.add(packageUnit);
+ }
+
+ return new ArrayList<CDOPackageUnit>(result);
}
- return Collections.EMPTY_LIST;
+ return Collections.emptyList();
}
- private static List<CDOPackage> analyzeNewPackages(Collection<EPackage> usedTopLevelPackages,
- CDOSessionPackageManagerImpl packageManager)
+ private static List<EPackage> analyzeNewPackages(Collection<EPackage> usedTopLevelPackages,
+ CDOPackageRegistry packageRegistry)
{
- // Determine which of the corresdonding CDOPackages are new
- List<CDOPackage> newPackages = new ArrayList<CDOPackage>();
+ // Determine which of the corresdonding EPackages are new
+ List<EPackage> newPackages = new ArrayList<EPackage>();
IPackageClosure closure = new CompletePackageClosure();
usedTopLevelPackages = closure.calculate(usedTopLevelPackages);
for (EPackage usedPackage : usedTopLevelPackages)
{
- CDOPackage cdoPackage = ModelUtil.getCDOPackage(usedPackage, packageManager);
- if (cdoPackage == null)
+ if (!CDOModelUtil.isSystemPackage(usedPackage))
{
- throw new IllegalStateException("Missing CDO package: " + usedPackage.getNsURI());
- }
+ CDOPackageUnit packageUnit = packageRegistry.getPackageUnit(usedPackage);
+ if (packageUnit == null)
+ {
+ throw new CDOException("No package unit for " + usedPackage);
+ }
- if (!(cdoPackage.isPersistent() || cdoPackage.isSystem()))
- {
- newPackages.add(cdoPackage);
+ if (packageUnit.getState() == CDOPackageUnit.State.NEW)
+ {
+ newPackages.add(usedPackage);
+ }
}
}
@@ -1158,7 +1182,7 @@ public class CDOTransactionImpl extends CDOViewImpl implements InternalCDOTransa
private Map<CDOID, CDOObject> detachedObjects;
- private List<CDOPackage> newPackages;
+ private List<CDOPackageUnit> newPackageUnits;
public CDOCommitContextImpl()
{
@@ -1168,7 +1192,7 @@ public class CDOTransactionImpl extends CDOViewImpl implements InternalCDOTransa
dirtyObjects = transaction.getDirtyObjects();
detachedObjects = transaction.getDetachedObjects();
revisionDeltas = transaction.getRevisionDeltas();
- newPackages = transaction.analyzeNewPackages();
+ newPackageUnits = transaction.analyzeNewPackages();
}
public CDOTransactionImpl getTransaction()
@@ -1186,9 +1210,9 @@ public class CDOTransactionImpl extends CDOViewImpl implements InternalCDOTransa
return newObjects;
}
- public List<CDOPackage> getNewPackages()
+ public List<CDOPackageUnit> getNewPackageUnits()
{
- return newPackages;
+ return newPackageUnits;
}
public Map<CDOID, CDOResource> getNewResources()
@@ -1254,9 +1278,9 @@ public class CDOTransactionImpl extends CDOViewImpl implements InternalCDOTransa
}
InternalCDOSession session = getSession();
- for (CDOPackage newPackage : newPackages)
+ for (CDOPackageUnit newPackageUnit : newPackageUnits)
{
- ((InternalCDOPackage)newPackage).setPersistent(true);
+ ((InternalCDOPackageUnit)newPackageUnit).setState(CDOPackageUnit.State.LOADED);
}
long timeStamp = result.getTimeStamp();
diff --git a/plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/internal/cdo/transaction/CDOXACommitContextImpl.java b/plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/internal/cdo/transaction/CDOXACommitContextImpl.java
index 62d62eda7c..636fc9b1ad 100644
--- a/plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/internal/cdo/transaction/CDOXACommitContextImpl.java
+++ b/plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/internal/cdo/transaction/CDOXACommitContextImpl.java
@@ -12,7 +12,7 @@ package org.eclipse.emf.internal.cdo.transaction;
import org.eclipse.emf.cdo.CDOObject;
import org.eclipse.emf.cdo.common.id.CDOID;
-import org.eclipse.emf.cdo.common.model.CDOPackage;
+import org.eclipse.emf.cdo.common.model.CDOPackageUnit;
import org.eclipse.emf.cdo.common.revision.CDOReferenceAdjuster;
import org.eclipse.emf.cdo.common.revision.delta.CDORevisionDelta;
import org.eclipse.emf.cdo.eresource.CDOResource;
@@ -112,9 +112,9 @@ public class CDOXACommitContextImpl implements InternalCDOXACommitContext
return delegateCommitContext.getNewObjects();
}
- public List<CDOPackage> getNewPackages()
+ public List<CDOPackageUnit> getNewPackageUnits()
{
- return delegateCommitContext.getNewPackages();
+ return delegateCommitContext.getNewPackageUnits();
}
public Map<CDOID, CDOResource> getNewResources()
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 2144e6712b..d4515e90bd 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
@@ -15,6 +15,7 @@ import org.eclipse.emf.cdo.CDOObject;
import org.eclipse.emf.cdo.CDOState;
import org.eclipse.emf.cdo.common.id.CDOID;
import org.eclipse.emf.cdo.common.revision.CDORevision;
+import org.eclipse.emf.cdo.spi.common.model.InternalCDOPackageRegistry;
import org.eclipse.emf.cdo.util.InvalidObjectException;
import org.eclipse.emf.cdo.util.ObjectNotFoundException;
import org.eclipse.emf.cdo.view.CDOView;
@@ -133,13 +134,16 @@ public final class FSMUtil
object = (InternalEObject)EcoreUtil.resolve(object, view.getResourceSet());
}
- CDOID id = ((InternalCDOView)view).getSession().lookupMetaInstanceID(object);
- if (id != null)
+ try
{
+ InternalCDOPackageRegistry packageRegistry = (InternalCDOPackageRegistry)view.getSession().getPackageRegistry();
+ CDOID id = packageRegistry.getMetaInstanceMapper().lookupMetaInstanceID(object);
return new CDOMetaWrapper((InternalCDOView)view, object, id);
}
-
- return null;
+ catch (RuntimeException ex)
+ {
+ return null;
+ }
}
/*
diff --git a/plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/internal/cdo/util/GenUtil.java b/plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/internal/cdo/util/GenUtil.java
deleted file mode 100644
index e5354912c2..0000000000
--- a/plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/internal/cdo/util/GenUtil.java
+++ /dev/null
@@ -1,207 +0,0 @@
-/**
- * Copyright (c) 2004 - 2009 Eike Stepper (Berlin, Germany) and others.
- * 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.net4j.util.StringUtil;
-
-import org.eclipse.emf.ecore.EClassifier;
-
-import java.util.ArrayList;
-import java.util.Iterator;
-import java.util.List;
-
-/**
- * @author Eike Stepper
- */
-public final class GenUtil
-{
- private GenUtil()
- {
- }
-
- /**
- * @see GenGenBaseImpl#isPrimitiveType
- */
- public static boolean isPrimitiveType(EClassifier eType)
- {
- try
- {
- // J9 2.2 has problems assigning null to a Class variable.
- Object result = eType.getInstanceClass();
- if (result == null)
- {
- return false;
- }
- Class<?> instanceClass = (Class<?>)result;
- return instanceClass.isPrimitive();
- }
- catch (Exception e)
- {
- return false;
- }
- }
-
- /**
- * @see GenFeatureImpl#getUpperName
- */
- public static String getFeatureUpperName(String featureName)
- {
- return format(featureName, '_', null, false, true).toUpperCase();
- }
-
- /**
- * @see GenFeatureImpl#getGetAccessor
- */
- public static String getFeatureGetterName(String featureName, boolean isBooleanType)
- {
- String capName = StringUtil.cap(featureName);
- // if (isMapEntryFeature())
- // return "getTyped" + capName;
- String result = isBooleanType ? "is" + capName : "get" + ("Class".equals(capName) ? "Class_" : capName);
-
- // if (isListType() && !isFeatureMapType() && !isMapType() &&
- // getGenModel().isArrayAccessors())
- // {
- // result += "List";
- // }
-
- // GenClass rootImplementsInterface =
- // getGenModel().getRootImplementsInterfaceGenClass();
- // GenClass context = getContext();
- // if (rootImplementsInterface != null &&
- // !rootImplementsInterface.isEObject())
- // {
- // for (GenOperation genOperation :
- // rootImplementsInterface.getAllGenOperations())
- // {
- // if (genOperation.getName().equals(result) &&
- // genOperation.getGenParameters().isEmpty() &&
- // !genOperation.getType(context).equals(getType(context)))
- // {
- // result = result + "_";
- // break;
- // }
- // }
- // }
-
- return result;
- }
-
- /**
- * Formats a name by parsing it into words separated by underscores and/or mixed-casing and then recombining them
- * using the specified separator. A prefix can also be given to be recognized as a separate word or to be trimmed.
- * Leading underscores can be ignored or can cause a leading separator to be prepended.
- */
- public static String format(String name, char separator, String prefix, boolean includePrefix,
- boolean includeLeadingSeparator)
- {
- String leadingSeparators = includeLeadingSeparator ? getLeadingSeparators(name, '_') : null;
- if (leadingSeparators != null)
- {
- name = name.substring(leadingSeparators.length());
- }
-
- List<String> parsedName = new ArrayList<String>();
- if (prefix != null && name.startsWith(prefix) && name.length() > prefix.length()
- && Character.isUpperCase(name.charAt(prefix.length())))
- {
- name = name.substring(prefix.length());
- if (includePrefix)
- {
- parsedName = parseName(prefix, '_');
- }
- }
-
- if (name.length() != 0)
- {
- parsedName.addAll(parseName(name, '_'));
- }
-
- StringBuilder result = new StringBuilder();
-
- for (Iterator<String> nameIter = parsedName.iterator(); nameIter.hasNext();)
- {
- String nameComponent = nameIter.next();
- result.append(nameComponent);
-
- if (nameIter.hasNext() && nameComponent.length() > 1)
- {
- result.append(separator);
- }
- }
-
- if (result.length() == 0 && prefix != null)
- {
- result.append(prefix);
- }
- return leadingSeparators != null ? "_" + result.toString() : result.toString();
- }
-
- /**
- * This method breaks sourceName into words delimited by separator and/or mixed-case naming.
- */
- public static List<String> parseName(String sourceName, char separator)
- {
- List<String> result = new ArrayList<String>();
- if (sourceName != null)
- {
- StringBuilder currentWord = new StringBuilder();
- boolean lastIsLower = false;
- for (int index = 0, length = sourceName.length(); index < length; ++index)
- {
- char curChar = sourceName.charAt(index);
- if (Character.isUpperCase(curChar) || !lastIsLower && Character.isDigit(curChar) || curChar == separator)
- {
- if (lastIsLower && currentWord.length() > 1 || curChar == separator && currentWord.length() > 0)
- {
- result.add(currentWord.toString());
- currentWord = new StringBuilder();
- }
- lastIsLower = false;
- }
- else
- {
- if (!lastIsLower)
- {
- int currentWordLength = currentWord.length();
- if (currentWordLength > 1)
- {
- char lastChar = currentWord.charAt(--currentWordLength);
- currentWord.setLength(currentWordLength);
- result.add(currentWord.toString());
- currentWord = new StringBuilder();
- currentWord.append(lastChar);
- }
- }
- lastIsLower = true;
- }
-
- if (curChar != separator)
- {
- currentWord.append(curChar);
- }
- }
-
- result.add(currentWord.toString());
- }
- return result;
- }
-
- private static String getLeadingSeparators(String name, char separator)
- {
- int i = 0;
- for (int len = name.length(); i < len && name.charAt(i) == separator; i++)
- {
- // the for loop's condition finds the separator
- }
- return i != 0 ? name.substring(0, i) : null;
- }
-}
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
deleted file mode 100644
index 5d0c9047bf..0000000000
--- a/plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/internal/cdo/util/ModelUtil.java
+++ /dev/null
@@ -1,438 +0,0 @@
-/**
- * Copyright (c) 2004 - 2009 Eike Stepper (Berlin, Germany) and others.
- * 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
- * Simon McDuff - maintenance
- */
-package org.eclipse.emf.internal.cdo.util;
-
-import org.eclipse.emf.cdo.common.id.CDOIDMetaRange;
-import org.eclipse.emf.cdo.common.model.CDOClass;
-import org.eclipse.emf.cdo.common.model.CDOClassProxy;
-import org.eclipse.emf.cdo.common.model.CDOClassRef;
-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.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.common.util.CDOException;
-import org.eclipse.emf.cdo.eresource.EresourcePackage;
-import org.eclipse.emf.cdo.session.CDOPackageRegistry;
-import org.eclipse.emf.cdo.spi.common.model.InternalCDOClass;
-import org.eclipse.emf.cdo.spi.common.model.InternalCDOFeature;
-import org.eclipse.emf.cdo.spi.common.model.InternalCDOPackage;
-import org.eclipse.emf.cdo.util.EMFUtil;
-
-import org.eclipse.emf.internal.cdo.bundle.OM;
-import org.eclipse.emf.internal.cdo.session.CDOSessionPackageManagerImpl;
-
-import org.eclipse.net4j.util.ImplementationError;
-import org.eclipse.net4j.util.ObjectUtil;
-import org.eclipse.net4j.util.om.trace.ContextTracer;
-
-import org.eclipse.emf.ecore.EAttribute;
-import org.eclipse.emf.ecore.EClass;
-import org.eclipse.emf.ecore.EClassifier;
-import org.eclipse.emf.ecore.EDataType;
-import org.eclipse.emf.ecore.EPackage;
-import org.eclipse.emf.ecore.EReference;
-import org.eclipse.emf.ecore.EStructuralFeature;
-import org.eclipse.emf.ecore.EcorePackage;
-import org.eclipse.emf.ecore.impl.EPackageImpl;
-import org.eclipse.emf.ecore.util.EcoreUtil;
-import org.eclipse.emf.spi.cdo.InternalCDOSession;
-
-/**
- * @author Eike Stepper
- */
-public final class ModelUtil
-{
- private static final ContextTracer MODEL_TRACER = new ContextTracer(OM.DEBUG_MODEL, ModelUtil.class);
-
- private ModelUtil()
- {
- }
-
- public static String getParentURI(EPackage ePackage)
- {
- EPackage superPackage = ePackage.getESuperPackage();
- String parentURI = superPackage == null ? null : superPackage.getNsURI();
- return parentURI;
- }
-
- public static EPackage getTopLevelPackage(EPackage ePackage)
- {
- EPackage superPackage = ePackage.getESuperPackage();
- return superPackage == null ? ePackage : getTopLevelPackage(superPackage);
- }
-
- public static CDOType getCDOType(EStructuralFeature eFeature)
- {
- if (eFeature instanceof EReference)
- {
- throw new ImplementationError("Should only be called for attributes");
- // return CDOTypeImpl.OBJECT;
- }
-
- EClassifier classifier = eFeature.getEType();
- if (classifier.getEPackage() == EcorePackage.eINSTANCE)
- {
- int classifierID = classifier.getClassifierID();
- switch (classifierID)
- {
- case EcorePackage.EBOOLEAN:
- case EcorePackage.EBOOLEAN_OBJECT:
- case EcorePackage.EBYTE:
- case EcorePackage.EBYTE_OBJECT:
- case EcorePackage.ECHAR:
- case EcorePackage.ECHARACTER_OBJECT:
- case EcorePackage.EDATE:
- case EcorePackage.EDOUBLE:
- case EcorePackage.EDOUBLE_OBJECT:
- case EcorePackage.EFLOAT:
- case EcorePackage.EFLOAT_OBJECT:
- case EcorePackage.EINT:
- case EcorePackage.EINTEGER_OBJECT:
- case EcorePackage.ELONG:
- case EcorePackage.ELONG_OBJECT:
- case EcorePackage.ESHORT:
- case EcorePackage.ESHORT_OBJECT:
- case EcorePackage.EFEATURE_MAP_ENTRY:
- CDOType type = CDOModelUtil.getType(classifierID);
- if (type == CDOType.OBJECT)
- {
- throw new ImplementationError("Attributes can not be of type OBJECT");
- }
-
- return type;
-
- case EcorePackage.ESTRING:
- return CDOType.STRING;
- }
- }
-
- if (classifier instanceof EDataType)
- {
- return CDOType.CUSTOM;
- }
-
- throw new IllegalArgumentException("Invalid attribute type: " + classifier);
- }
-
- public static void initializeCDOPackage(EPackage ePackage, CDOPackage cdoPackage)
- {
- ((InternalCDOPackage)cdoPackage).setClientInfo(ePackage);
- for (EClass eClass : EMFUtil.getPersistentClasses(ePackage))
- {
- CDOClass cdoClass = createCDOClass(eClass, cdoPackage);
- ((InternalCDOPackage)cdoPackage).addClass(cdoClass);
- }
- }
-
- public static CDOPackage getCDOPackage(EPackage ePackage, CDOSessionPackageManagerImpl packageManager)
- {
- String packageURI = ePackage.getNsURI();
- CDOPackage cdoPackage = packageManager.lookupPackage(packageURI);
- if (cdoPackage == null)
- {
- EPackage topLevelPackage = getTopLevelPackage(ePackage);
- if (topLevelPackage != ePackage)
- {
- getCDOPackage(topLevelPackage, packageManager);
- cdoPackage = packageManager.lookupPackage(packageURI);
- }
- else
- {
- cdoPackage = addCDOPackage(topLevelPackage, packageManager);
- }
- }
-
- return cdoPackage;
- }
-
- public static CDOClass getCDOClass(EClass eClass, CDOSessionPackageManagerImpl packageManager)
- {
- CDOPackage cdoPackage = getCDOPackage(eClass.getEPackage(), packageManager);
- return cdoPackage.lookupClass(eClass.getClassifierID());
- }
-
- public static CDOFeature getCDOFeature(EStructuralFeature eFeature, CDOSessionPackageManagerImpl packageManager)
- {
- CDOClass cdoClass = getCDOClass(eFeature.getEContainingClass(), packageManager);
- return cdoClass.lookupFeature(eFeature.getFeatureID());
- }
-
- public static CDOPackage addCDOPackage(EPackage ePackage, CDOSessionPackageManagerImpl packageManager)
- {
- CDOPackage cdoPackage = createCDOPackage(ePackage, packageManager);
- packageManager.addPackage(cdoPackage);
-
- for (EPackage subPackage : ePackage.getESubpackages())
- {
- addCDOPackage(subPackage, packageManager);
- }
-
- return cdoPackage;
- }
-
- /**
- * @see EMFUtil#getPersistentFeatures(org.eclipse.emf.common.util.EList)
- * @see http://www.eclipse.org/newsportal/article.php?id=26780&group=eclipse.tools.emf#26780
- */
- public static CDOPackage createCDOPackage(EPackage ePackage, CDOSessionPackageManagerImpl packageManager)
- {
- InternalCDOSession session = packageManager.getSession();
- String uri = ePackage.getNsURI();
- String parentURI = getParentURI(ePackage);
- String name = ePackage.getName();
- boolean dynamic = EMFUtil.isDynamicEPackage(ePackage);
- String ecore = null;
- CDOIDMetaRange idRange = null;
-
- if (parentURI == null)
- {
- if (!EcorePackage.eINSTANCE.getNsURI().equals(uri))
- {
- ecore = EMFUtil.ePackageToString(ePackage, session.getPackageRegistry());
- }
-
- idRange = session.registerEPackage(ePackage);
- }
-
- CDOPackage cdoPackage = CDOModelUtil.createPackage(packageManager, uri, name, ecore, dynamic, idRange, parentURI);
- initializeCDOPackage(ePackage, cdoPackage);
- return cdoPackage;
- }
-
- public static CDOClass createCDOClass(EClass eClass, CDOPackage containingPackage)
- {
- InternalCDOClass cdoClass = (InternalCDOClass)CDOModelUtil.createClass(containingPackage, eClass.getClassifierID(),
- eClass.getName(), eClass.isAbstract());
- cdoClass.setClientInfo(eClass);
-
- for (EClass superType : eClass.getESuperTypes())
- {
- CDOClassRef classRef = createClassRef(superType);
- cdoClass.addSuperType(classRef);
- }
-
- // Bugs: 247978 Make sure featureIndex are properly set for dynamic classes
- eClass.getEAllStructuralFeatures();
-
- for (EStructuralFeature eFeature : EMFUtil.getPersistentFeatures(eClass.getEStructuralFeatures()))
- {
- CDOFeature cdoFeature = createCDOFeature(eFeature, cdoClass);
- cdoClass.addFeature(cdoFeature);
- }
-
- return cdoClass;
- }
-
- public static CDOFeature createCDOFeature(EStructuralFeature eFeature, CDOClass containingClass)
- {
- InternalCDOFeature cdoFeature = (InternalCDOFeature)(EMFUtil.isReference(eFeature) ? createCDOReference(
- (EReference)eFeature, containingClass) : createCDOAttribute((EAttribute)eFeature, containingClass));
- cdoFeature.setClientInfo(eFeature);
- return cdoFeature;
- }
-
- public static CDOFeature createCDOReference(EReference eFeature, CDOClass containingClass)
- {
- CDOPackageManager packageManager = containingClass.getPackageManager();
- int featureID = eFeature.getFeatureID();
- String name = eFeature.getName();
- CDOClassRef classRef = createClassRef(eFeature.getEType());
- boolean many = eFeature.isMany();
- boolean containment = EMFUtil.isContainment(eFeature);
- CDOFeature cdoFeature = CDOModelUtil.createReference(containingClass, featureID, name, new CDOClassProxy(classRef,
- packageManager), many, containment);
-
- EReference opposite = eFeature.getEOpposite();
- if (MODEL_TRACER.isEnabled() && opposite != null)
- {
- MODEL_TRACER.format("Opposite info: package={0}, class={1}, feature={2}", opposite.getEContainingClass()
- .getEPackage().getNsURI(), opposite.getEContainingClass().getName(), opposite.getName());
- }
-
- return cdoFeature;
- }
-
- public static CDOFeature createCDOAttribute(EAttribute eFeature, CDOClass containingClass)
- {
- int featureID = eFeature.getFeatureID();
- String name = eFeature.getName();
- CDOType type = getCDOType(eFeature);
- boolean many = EMFUtil.isMany(eFeature);
- Object defaultValue = eFeature.getDefaultValue();
- if (type == CDOType.CUSTOM)
- {
- try
- {
- defaultValue = EcoreUtil.convertToString((EDataType)eFeature.getEType(), defaultValue);
- }
- catch (RuntimeException ex)
- {
- if (defaultValue != null)
- {
- throw ex;
- }
- }
- }
-
- return CDOModelUtil.createAttribute(containingClass, featureID, name, type, defaultValue, many);
- }
-
- public static EPackage getEPackage(CDOPackage cdoPackage, CDOPackageRegistry packageRegistry)
- {
- EPackage ePackage = (EPackage)cdoPackage.getClientInfo();
- if (ePackage == null)
- {
- String uri = cdoPackage.getPackageURI();
- ePackage = packageRegistry.getEPackage(uri);
- if (ePackage == null)
- {
- ePackage = createEPackage(cdoPackage);
- packageRegistry.put(uri, ePackage);
- }
-
- ((InternalCDOPackage)cdoPackage).setClientInfo(ePackage);
- }
-
- return ePackage;
- }
-
- public static EClass getEClass(CDOClass cdoClass, CDOPackageRegistry packageRegistry)
- {
- EClass eClass = (EClass)cdoClass.getClientInfo();
- if (eClass == null)
- {
- EPackage ePackage = getEPackage(cdoClass.getContainingPackage(), packageRegistry);
- eClass = (EClass)ePackage.getEClassifier(cdoClass.getName());
- ((InternalCDOClass)cdoClass).setClientInfo(eClass);
- }
-
- return eClass;
- }
-
- public static EStructuralFeature getEFeature(CDOFeature cdoFeature, CDOPackageRegistry packageRegistry)
- {
- EStructuralFeature eFeature = (EStructuralFeature)cdoFeature.getClientInfo();
- if (eFeature == null)
- {
- EClass eClass = getEClass(cdoFeature.getContainingClass(), packageRegistry);
- eFeature = eClass.getEStructuralFeature(cdoFeature.getFeatureID());
- ((InternalCDOFeature)cdoFeature).setClientInfo(eFeature);
- }
-
- return eFeature;
- }
-
- public static EPackage createEPackage(CDOPackage cdoPackage)
- {
- if (cdoPackage.isDynamic())
- {
- return createDynamicEPackage(cdoPackage);
- }
-
- EPackage ePackage = getGeneratedEPackage(cdoPackage);
- if (ePackage == null)
- {
- throw new CDOException("Generated package locally not available: " + cdoPackage.getPackageURI());
- }
-
- return ePackage;
- }
-
- public static EPackage getGeneratedEPackage(CDOPackage cdoPackage)
- {
- String packageURI = cdoPackage.getPackageURI();
- if (packageURI.equals(EcorePackage.eINSTANCE.getNsURI()))
- {
- return EcorePackage.eINSTANCE;
- }
-
- EPackage.Registry registry = EPackage.Registry.INSTANCE;
- return registry.getEPackage(packageURI);
- }
-
- public static EPackage createDynamicEPackage(CDOPackage cdoPackage)
- {
- CDOPackage topLevelPackage = cdoPackage.getTopLevelPackage();
- String ecore = topLevelPackage.getEcore();
- EPackageImpl topLevelPackageEPackage = (EPackageImpl)EMFUtil.ePackageFromString(ecore);
- EPackageImpl ePackage = prepareDynamicEPackage(topLevelPackageEPackage, cdoPackage.getPackageURI());
- return ePackage;
- }
-
- public static EPackageImpl prepareDynamicEPackage(EPackageImpl ePackage, String nsURI)
- {
- EMFUtil.prepareDynamicEPackage(ePackage);
- EPackageImpl result = ObjectUtil.equals(ePackage.getNsURI(), nsURI) ? ePackage : null;
- for (EPackage subPackage : ePackage.getESubpackages())
- {
- EPackageImpl p = prepareDynamicEPackage((EPackageImpl)subPackage, nsURI);
- if (p != null && result == null)
- {
- result = p;
- }
- }
-
- return result;
- }
-
- public static CDOClassRef createClassRef(EClassifier classifier)
- {
- if (classifier instanceof EClass)
- {
- String packageURI = classifier.getEPackage().getNsURI();
- int classifierID = classifier.getClassifierID();
- return CDOModelUtil.createClassRef(packageURI, classifierID);
- }
-
- return null;
- }
-
- public static void addModelInfos(CDOSessionPackageManagerImpl packageManager)
- {
- // Ecore
- CDOCorePackage corePackage = packageManager.getCDOCorePackage();
- ((InternalCDOPackage)corePackage).setClientInfo(EcorePackage.eINSTANCE);
- ((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());
- }
-}
diff --git a/plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/internal/cdo/util/RevisionAdjuster.java b/plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/internal/cdo/util/RevisionAdjuster.java
index 8ee7ab0cb4..0b623e3df2 100644
--- a/plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/internal/cdo/util/RevisionAdjuster.java
+++ b/plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/internal/cdo/util/RevisionAdjuster.java
@@ -13,7 +13,6 @@
package org.eclipse.emf.internal.cdo.util;
import org.eclipse.emf.cdo.common.id.CDOID;
-import org.eclipse.emf.cdo.common.model.CDOFeature;
import org.eclipse.emf.cdo.common.revision.CDOReferenceAdjuster;
import org.eclipse.emf.cdo.common.revision.delta.CDOAddFeatureDelta;
import org.eclipse.emf.cdo.common.revision.delta.CDOContainerFeatureDelta;
@@ -25,6 +24,8 @@ import org.eclipse.emf.cdo.internal.common.revision.delta.CDOListFeatureDeltaImp
import org.eclipse.emf.cdo.spi.common.revision.InternalCDOList;
import org.eclipse.emf.cdo.spi.common.revision.InternalCDORevision;
+import org.eclipse.emf.ecore.EReference;
+import org.eclipse.emf.ecore.EStructuralFeature;
import org.eclipse.emf.spi.cdo.CDOElementProxy;
/**
@@ -65,9 +66,9 @@ public class RevisionAdjuster extends CDOFeatureDeltaVisitorImpl
@Override
public void visit(CDOSetFeatureDelta delta)
{
- CDOFeature feature = delta.getFeature();
+ EStructuralFeature feature = delta.getFeature();
Object value = delta.getValue();
- if (value != null && feature.isReference() && !(value instanceof CDOElementProxy))
+ if (value != null && feature instanceof EReference && !(value instanceof CDOElementProxy))
{
revision.setValue(feature, referenceAdjuster.adjustReference(value));
}
@@ -76,10 +77,10 @@ public class RevisionAdjuster extends CDOFeatureDeltaVisitorImpl
@Override
public void visit(CDOListFeatureDelta deltas)
{
- CDOFeature feature = deltas.getFeature();
+ EStructuralFeature feature = deltas.getFeature();
InternalCDOList list = (InternalCDOList)revision.getValue(feature);
- if (feature.isReference())
+ if (feature instanceof EReference)
{
int[] indices = ((CDOListFeatureDeltaImpl)deltas).reconstructAddedIndices().getElement2();
for (int i = 1; i <= indices[0]; i++)
diff --git a/plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/internal/cdo/view/CDOViewImpl.java b/plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/internal/cdo/view/CDOViewImpl.java
index cac2017419..a0004e3150 100644
--- a/plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/internal/cdo/view/CDOViewImpl.java
+++ b/plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/internal/cdo/view/CDOViewImpl.java
@@ -19,12 +19,7 @@ import org.eclipse.emf.cdo.common.id.CDOID;
import org.eclipse.emf.cdo.common.id.CDOIDAndVersion;
import org.eclipse.emf.cdo.common.id.CDOIDMeta;
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.model.CDOModelUtil;
import org.eclipse.emf.cdo.common.protocol.CDOProtocolConstants;
import org.eclipse.emf.cdo.common.revision.CDORevision;
import org.eclipse.emf.cdo.common.revision.CDORevisionResolver;
@@ -33,7 +28,9 @@ 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.EresourcePackage;
import org.eclipse.emf.cdo.eresource.impl.CDOResourceImpl;
+import org.eclipse.emf.cdo.spi.common.model.InternalCDOPackageRegistry;
import org.eclipse.emf.cdo.spi.common.revision.InternalCDORevision;
import org.eclipse.emf.cdo.transaction.CDOCommitContext;
import org.eclipse.emf.cdo.transaction.CDOTransaction;
@@ -60,7 +57,6 @@ import org.eclipse.emf.internal.cdo.CDOURIHandler;
import org.eclipse.emf.internal.cdo.bundle.OM;
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;
@@ -79,8 +75,10 @@ import org.eclipse.emf.common.notify.Adapter;
import org.eclipse.emf.common.notify.Notification;
import org.eclipse.emf.common.notify.impl.NotificationImpl;
import org.eclipse.emf.common.util.URI;
+import org.eclipse.emf.ecore.EAttribute;
import org.eclipse.emf.ecore.EClass;
import org.eclipse.emf.ecore.EObject;
+import org.eclipse.emf.ecore.EReference;
import org.eclipse.emf.ecore.InternalEObject;
import org.eclipse.emf.ecore.resource.ResourceSet;
import org.eclipse.emf.ecore.util.EcoreUtil;
@@ -449,15 +447,14 @@ public class CDOViewImpl extends Lifecycle implements InternalCDOView
}
InternalCDORevision folderRevision = getLocalRevision(folderID);
- CDOResourcePackage resourcePackage = getSession().getPackageManager().getCDOResourcePackage();
- CDOResourceFolderClass resourceFolderClass = resourcePackage.getCDOResourceFolderClass();
- if (folderRevision.getCDOClass() != resourceFolderClass)
+ EClass resourceFolderClass = EresourcePackage.eINSTANCE.getCDOResourceFolder();
+ if (folderRevision.getEClass() != resourceFolderClass)
{
throw new CDOException("Expected folder for id = " + folderID);
}
- CDOFeature nodesFeature = resourceFolderClass.getCDONodesFeature();
- CDOFeature nameFeature = resourcePackage.getCDOResourceNodeClass().getCDONameFeature();
+ EReference nodesFeature = EresourcePackage.eINSTANCE.getCDOResourceFolder_Nodes();
+ EAttribute nameFeature = EresourcePackage.eINSTANCE.getCDOResourceNode_Name();
int size = folderRevision.data().size(nodesFeature);
for (int i = 0; i < size; i++)
@@ -630,17 +627,6 @@ public class CDOViewImpl extends Lifecycle implements InternalCDOView
return (CDOResourceImpl)getObject(resourceID);
}
- public InternalCDOObject newInstance(CDOClass cdoClass)
- {
- EClass eClass = ModelUtil.getEClass(cdoClass, session.getPackageRegistry());
- if (eClass == null)
- {
- throw new IllegalStateException("No EClass for " + cdoClass);
- }
-
- return newInstance(eClass);
- }
-
public InternalCDOObject newInstance(EClass eClass)
{
EObject eObject = EcoreUtil.create(eClass);
@@ -698,7 +684,7 @@ public class CDOViewImpl extends Lifecycle implements InternalCDOView
}
// CDOResource have a special way to register to the view.
- if (!localLookupObject.cdoClass().isResource())
+ if (!CDOModelUtil.isResource(localLookupObject.eClass()))
{
registerObject(localLookupObject);
}
@@ -774,12 +760,8 @@ public class CDOViewImpl extends Lifecycle implements InternalCDOView
TRACER.trace("Creating meta object for " + id);
}
- InternalEObject metaInstance = session.lookupMetaInstance(id);
- if (metaInstance == null)
- {
- throw new ImplementationError("No metaInstance for " + id);
- }
-
+ InternalCDOPackageRegistry packageRegistry = (InternalCDOPackageRegistry)session.getPackageRegistry();
+ InternalEObject metaInstance = packageRegistry.getMetaInstanceMapper().lookupMetaInstance(id);
return new CDOMetaWrapper(this, metaInstance, id);
}
@@ -796,16 +778,16 @@ public class CDOViewImpl extends Lifecycle implements InternalCDOView
InternalCDORevision revision = getRevision(id, true);
FSMUtil.validate(id, revision);
- CDOClass cdoClass = revision.getCDOClass();
+ EClass eClass = revision.getEClass();
InternalCDOObject object;
- if (cdoClass.isResource())
+ if (CDOModelUtil.isResource(eClass))
{
object = (InternalCDOObject)newResourceInstance(revision);
// object is PROXY
}
else
{
- object = newInstance(cdoClass);
+ object = newInstance(eClass);
// object is TRANSIENT
}
@@ -821,9 +803,7 @@ public class CDOViewImpl extends Lifecycle implements InternalCDOView
private String getResourcePath(InternalCDORevision revision)
{
- CDOResourcePackage resourcePackage = session.getPackageManager().getCDOResourcePackage();
- CDOResourceNodeClass resourceNodeClass = resourcePackage.getCDOResourceNodeClass();
- CDONameFeature nameFeature = resourceNodeClass.getCDONameFeature();
+ EAttribute nameFeature = EresourcePackage.eINSTANCE.getCDOResourceNode_Name();
CDOID folderID = (CDOID)revision.data().getContainerID();
String name = (String)revision.data().get(nameFeature, 0);
@@ -1178,7 +1158,7 @@ public class CDOViewImpl extends Lifecycle implements InternalCDOView
if (deltas != null)
{
- CDONotificationBuilder builder = new CDONotificationBuilder(getSession().getPackageRegistry());
+ CDONotificationBuilder builder = new CDONotificationBuilder();
for (CDORevisionDelta delta : deltas)
{
InternalCDOObject object = changeSubscriptionManager.getSubcribeObject(delta.getID());
diff --git a/plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/internal/cdo/view/CDOViewSetImpl.java b/plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/internal/cdo/view/CDOViewSetImpl.java
index e04dd7b0ee..5395adc862 100644
--- a/plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/internal/cdo/view/CDOViewSetImpl.java
+++ b/plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/internal/cdo/view/CDOViewSetImpl.java
@@ -179,25 +179,24 @@ public class CDOViewSetImpl extends NotifierImpl implements InternalCDOViewSet
public void setTarget(Notifier newTarget)
{
- if (resourceSet != null)
- {
- throw new IllegalStateException("Cannot associate more than 1 resourceset to this viewset");
- }
- if (isAdapterForType(newTarget))
+ if (!isAdapterForType(newTarget))
{
- resourceSet = (ResourceSet)newTarget;
- EPackage.Registry oldPackageRegistry = resourceSet.getPackageRegistry();
- packageRegistry = new CDOViewSetPackageRegistryImpl(this, oldPackageRegistry);
- resourceSet.setPackageRegistry(packageRegistry);
-
- Registry registry = resourceSet.getResourceFactoryRegistry();
- Map<String, Object> map = registry.getProtocolToFactoryMap();
- map.put(CDOProtocolConstants.PROTOCOL_NAME, getResourceFactory());
+ throw new IllegalArgumentException("Unsupported target: " + newTarget);
}
- else
+
+ if (resourceSet != null)
{
- throw new IllegalArgumentException("Doesn't support " + newTarget);
+ throw new IllegalStateException("Cannot associate more than 1 resource set with this view set");
}
+
+ resourceSet = (ResourceSet)newTarget;
+ EPackage.Registry oldPackageRegistry = resourceSet.getPackageRegistry();
+ packageRegistry = new CDOViewSetPackageRegistryImpl(this, oldPackageRegistry);
+ resourceSet.setPackageRegistry(packageRegistry);
+
+ Registry registry = resourceSet.getResourceFactoryRegistry();
+ Map<String, Object> map = registry.getProtocolToFactoryMap();
+ map.put(CDOProtocolConstants.PROTOCOL_NAME, getResourceFactory());
}
public boolean isAdapterForType(Object type)
diff --git a/plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/spi/cdo/AbstractObjectConflictResolver.java b/plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/spi/cdo/AbstractObjectConflictResolver.java
index 724926c23a..96b1c8df18 100644
--- a/plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/spi/cdo/AbstractObjectConflictResolver.java
+++ b/plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/spi/cdo/AbstractObjectConflictResolver.java
@@ -14,11 +14,10 @@ import org.eclipse.emf.cdo.CDODeltaNotification;
import org.eclipse.emf.cdo.CDOObject;
import org.eclipse.emf.cdo.CDOState;
import org.eclipse.emf.cdo.common.id.CDOID;
-import org.eclipse.emf.cdo.common.model.CDOFeature;
import org.eclipse.emf.cdo.common.revision.delta.CDOFeatureDelta;
import org.eclipse.emf.cdo.common.revision.delta.CDORevisionDelta;
import org.eclipse.emf.cdo.common.util.CDOException;
-import org.eclipse.emf.cdo.internal.common.revision.delta.CDORevisionMerger;
+import org.eclipse.emf.cdo.spi.common.revision.CDORevisionMerger;
import org.eclipse.emf.cdo.spi.common.revision.InternalCDORevision;
import org.eclipse.emf.cdo.spi.common.revision.InternalCDORevisionDelta;
import org.eclipse.emf.cdo.transaction.CDOCommitContext;
@@ -36,6 +35,7 @@ import org.eclipse.emf.common.notify.Adapter;
import org.eclipse.emf.common.notify.Notification;
import org.eclipse.emf.common.notify.impl.AdapterImpl;
import org.eclipse.emf.ecore.EObject;
+import org.eclipse.emf.ecore.EStructuralFeature;
import java.util.ArrayList;
import java.util.Collections;
@@ -346,7 +346,7 @@ public abstract class AbstractObjectConflictResolver implements CDOConflictResol
protected boolean hasFeatureConflicts(CDORevisionDelta localDelta, List<CDORevisionDelta> remoteDeltas)
{
- Set<CDOFeature> features = new HashSet<CDOFeature>();
+ Set<EStructuralFeature> features = new HashSet<EStructuralFeature>();
for (CDOFeatureDelta localFeatureDelta : localDelta.getFeatureDeltas())
{
features.add(localFeatureDelta.getFeature());
@@ -356,7 +356,7 @@ public abstract class AbstractObjectConflictResolver implements CDOConflictResol
{
for (CDOFeatureDelta remoteFeatureDelta : remoteDelta.getFeatureDeltas())
{
- CDOFeature feature = remoteFeatureDelta.getFeature();
+ EStructuralFeature feature = remoteFeatureDelta.getFeature();
if (features.contains(feature))
{
return true;
diff --git a/plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/spi/cdo/CDOElementProxy.java b/plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/spi/cdo/CDOElementProxy.java
index 879fdf4acd..e188c2d542 100644
--- a/plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/spi/cdo/CDOElementProxy.java
+++ b/plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/spi/cdo/CDOElementProxy.java
@@ -11,10 +11,11 @@
*/
package org.eclipse.emf.spi.cdo;
-import org.eclipse.emf.cdo.common.model.CDOFeature;
import org.eclipse.emf.cdo.common.revision.CDORevision;
import org.eclipse.emf.cdo.session.CDORevisionManager;
+import org.eclipse.emf.ecore.EStructuralFeature;
+
/**
* @author Eike Stepper
* @noimplement This interface is not intended to be implemented by clients.
@@ -24,6 +25,6 @@ public interface CDOElementProxy
{
public int getIndex();
- public Object resolve(CDORevisionManager revisionManager, CDORevision revision, CDOFeature feature, int index);
+ public Object resolve(CDORevisionManager revisionManager, CDORevision revision, EStructuralFeature feature, int index);
}
diff --git a/plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/spi/cdo/CDOSessionProtocol.java b/plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/spi/cdo/CDOSessionProtocol.java
index a4220e17ee..8cdd102fd0 100644
--- a/plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/spi/cdo/CDOSessionProtocol.java
+++ b/plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/spi/cdo/CDOSessionProtocol.java
@@ -13,33 +13,27 @@ package org.eclipse.emf.spi.cdo;
import org.eclipse.emf.cdo.CDOObject;
import org.eclipse.emf.cdo.common.id.CDOID;
import org.eclipse.emf.cdo.common.id.CDOIDLibraryDescriptor;
-import org.eclipse.emf.cdo.common.id.CDOIDMetaRange;
import org.eclipse.emf.cdo.common.id.CDOIDProvider;
import org.eclipse.emf.cdo.common.id.CDOIDTemp;
-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.CDOPackageURICompressor;
import org.eclipse.emf.cdo.common.revision.CDOReferenceAdjuster;
import org.eclipse.emf.cdo.common.revision.CDORevision;
import org.eclipse.emf.cdo.session.remote.CDORemoteSession;
+import org.eclipse.emf.cdo.spi.common.model.InternalCDOPackageUnit;
+import org.eclipse.emf.cdo.spi.common.model.InternalCDOPackageRegistry.PackageLoader;
import org.eclipse.emf.cdo.spi.common.revision.CDOIDMapper;
import org.eclipse.emf.cdo.spi.common.revision.InternalCDORevision;
import org.eclipse.emf.cdo.transaction.CDOTimeStampContext;
import org.eclipse.emf.cdo.view.CDOView;
import org.eclipse.net4j.util.concurrent.RWLockManager.LockType;
-import org.eclipse.net4j.util.io.ExtendedDataInput;
-import org.eclipse.net4j.util.io.ExtendedDataOutput;
-import org.eclipse.net4j.util.io.StringCompressor;
import org.eclipse.net4j.util.om.monitor.OMMonitor;
+import org.eclipse.emf.ecore.EStructuralFeature;
import org.eclipse.emf.ecore.InternalEObject;
import org.eclipse.emf.spi.cdo.InternalCDOTransaction.InternalCDOCommitContext;
import org.eclipse.emf.spi.cdo.InternalCDOXATransaction.InternalCDOXACommitContext;
import java.io.File;
-import java.io.IOException;
import java.text.MessageFormat;
import java.util.ArrayList;
import java.util.Collection;
@@ -52,7 +46,7 @@ import java.util.Set;
* @author Eike Stepper
* @since 2.0
*/
-public interface CDOSessionProtocol
+public interface CDOSessionProtocol extends PackageLoader
{
public OpenSessionResult openSession(String repositoryName, boolean passiveUpdateEnabled);
@@ -62,9 +56,7 @@ public interface CDOSessionProtocol
public RepositoryTimeResult getRepositoryTime();
- public void loadPackage(CDOPackage cdoPackage, boolean onlyEcore);
-
- public Object loadChunk(InternalCDORevision revision, CDOFeature feature, int accessIndex, int fetchIndex,
+ public Object loadChunk(InternalCDORevision revision, EStructuralFeature feature, int accessIndex, int fetchIndex,
int fromIndex, int toIndex);
public List<InternalCDORevision> loadRevisions(Collection<CDOID> ids, int referenceChunk);
@@ -113,7 +105,7 @@ public interface CDOSessionProtocol
/**
* @author Eike Stepper
*/
- public final class OpenSessionResult implements CDOPackageURICompressor
+ public final class OpenSessionResult
{
private int sessionID;
@@ -127,9 +119,10 @@ public interface CDOSessionProtocol
private CDOIDLibraryDescriptor libraryDescriptor;
- private List<CDOPackageInfo> packageInfos = new ArrayList<CDOPackageInfo>();
+ private List<InternalCDOPackageUnit> packageUnits = new ArrayList<InternalCDOPackageUnit>();
- private StringCompressor compressor = new StringCompressor(true);
+ // private Map<InternalCDOPackageUnit, CDOPackageUnit.Type> repositoryActualTypes = new
+ // HashMap<InternalCDOPackageUnit, CDOPackageUnit.Type>();
public OpenSessionResult(int sessionID, String repositoryUUID, long repositoryCreationTime,
boolean repositorySupportingAudits, CDOIDLibraryDescriptor libraryDescriptor)
@@ -176,30 +169,15 @@ public interface CDOSessionProtocol
return libraryDescriptor;
}
- public List<CDOPackageInfo> getPackageInfos()
- {
- return packageInfos;
- }
-
- public void addPackageInfo(String packageURI, boolean dynamic, CDOIDMetaRange metaIDRange, String parentURI)
- {
- packageInfos.add(new CDOPackageInfo(packageURI, dynamic, metaIDRange, parentURI));
- }
-
- public StringCompressor getCompressor()
- {
- return compressor;
- }
-
- public void writePackageURI(ExtendedDataOutput out, String uri) throws IOException
+ public List<InternalCDOPackageUnit> getPackageUnits()
{
- compressor.write(out, uri);
+ return packageUnits;
}
- public String readPackageURI(ExtendedDataInput in) throws IOException
- {
- return compressor.read(in);
- }
+ // public Map<InternalCDOPackageUnit, CDOPackageUnit.Type> getRepositoryActualTypes()
+ // {
+ // return repositoryActualTypes;
+ // }
}
/**
diff --git a/plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/spi/cdo/InternalCDOObject.java b/plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/spi/cdo/InternalCDOObject.java
index 65a9178b8d..5673aacba5 100644
--- a/plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/spi/cdo/InternalCDOObject.java
+++ b/plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/spi/cdo/InternalCDOObject.java
@@ -13,6 +13,7 @@ package org.eclipse.emf.spi.cdo;
import org.eclipse.emf.cdo.CDOObject;
import org.eclipse.emf.cdo.CDOState;
import org.eclipse.emf.cdo.common.id.CDOID;
+import org.eclipse.emf.cdo.common.model.CDOPackageTypeRegistry.CDOObjectMarker;
import org.eclipse.emf.cdo.common.revision.CDORevision;
import org.eclipse.emf.cdo.spi.common.revision.InternalCDORevision;
import org.eclipse.emf.cdo.view.CDOView;
@@ -24,7 +25,7 @@ import org.eclipse.emf.ecore.InternalEObject;
* @author Eike Stepper
* @since 2.0
*/
-public interface InternalCDOObject extends CDOObject, InternalEObject, InternalCDOLoadable
+public interface InternalCDOObject extends CDOObject, InternalEObject, InternalCDOLoadable, CDOObjectMarker
{
public InternalCDOView cdoView();
diff --git a/plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/spi/cdo/InternalCDORemoteSessionManager.java b/plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/spi/cdo/InternalCDORemoteSessionManager.java
index 7437da3a6f..e08d1a710f 100644
--- a/plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/spi/cdo/InternalCDORemoteSessionManager.java
+++ b/plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/spi/cdo/InternalCDORemoteSessionManager.java
@@ -13,11 +13,13 @@ package org.eclipse.emf.spi.cdo;
import org.eclipse.emf.cdo.session.remote.CDORemoteSession;
import org.eclipse.emf.cdo.session.remote.CDORemoteSessionManager;
+import org.eclipse.net4j.util.lifecycle.ILifecycle;
+
/**
* @author Eike Stepper
* @since 2.0
*/
-public interface InternalCDORemoteSessionManager extends CDORemoteSessionManager
+public interface InternalCDORemoteSessionManager extends CDORemoteSessionManager, ILifecycle.Introspection
{
public CDORemoteSession createRemoteSession(int sessionID, String userID, boolean subscribed);
diff --git a/plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/spi/cdo/InternalCDOSession.java b/plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/spi/cdo/InternalCDOSession.java
index cbb5a23a05..50a4de0be3 100644
--- a/plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/spi/cdo/InternalCDOSession.java
+++ b/plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/spi/cdo/InternalCDOSession.java
@@ -12,18 +12,14 @@ package org.eclipse.emf.spi.cdo;
import org.eclipse.emf.cdo.common.id.CDOID;
import org.eclipse.emf.cdo.common.id.CDOIDAndVersion;
-import org.eclipse.emf.cdo.common.id.CDOIDMetaRange;
import org.eclipse.emf.cdo.common.id.CDOIDObjectFactory;
-import org.eclipse.emf.cdo.common.model.CDOPackageURICompressor;
+import org.eclipse.emf.cdo.common.model.CDOPackageRegistry;
import org.eclipse.emf.cdo.common.revision.delta.CDORevisionDelta;
-import org.eclipse.emf.cdo.session.CDOPackageRegistry;
import org.eclipse.emf.cdo.session.CDOSession;
+import org.eclipse.emf.cdo.spi.common.model.InternalCDOPackageRegistry;
import org.eclipse.net4j.util.lifecycle.ILifecycle;
-import org.eclipse.emf.ecore.EPackage;
-import org.eclipse.emf.ecore.InternalEObject;
-
import java.util.Collection;
import java.util.Set;
@@ -31,8 +27,8 @@ import java.util.Set;
* @author Eike Stepper
* @since 2.0
*/
-public interface InternalCDOSession extends CDOSession, CDOIDObjectFactory, CDOPackageURICompressor,
- ILifecycle.Introspection
+public interface InternalCDOSession extends CDOSession, CDOIDObjectFactory,
+ InternalCDOPackageRegistry.PackageProcessor, InternalCDOPackageRegistry.PackageLoader, ILifecycle.Introspection
{
public CDOSessionProtocol getSessionProtocol();
@@ -40,16 +36,6 @@ public interface InternalCDOSession extends CDOSession, CDOIDObjectFactory, CDOP
public void setPackageRegistry(CDOPackageRegistry packageRegistry);
- public void registerEPackage(EPackage ePackage, CDOIDMetaRange metaIDRange);
-
- public CDOIDMetaRange registerEPackage(EPackage ePackage);
-
- public InternalEObject lookupMetaInstance(CDOID id);
-
- public CDOID lookupMetaInstanceID(InternalEObject metaInstance);
-
- public void remapMetaInstance(CDOID oldID, CDOID newID);
-
public void viewDetached(InternalCDOView view);
public void handleCommitNotification(long timeStamp, Set<CDOIDAndVersion> dirtyOIDs,

Back to the top