Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorEike Stepper2010-09-24 10:18:00 +0000
committerEike Stepper2010-09-24 10:18:00 +0000
commite9ad297a427a36b7d84b4847ecdd331432e9f6b9 (patch)
treecc95a3dc00f4fc76a70678bc2b2366089b9ed424
parent0718eed1754e39dcd96949f944c569252764c671 (diff)
downloadcdo-e9ad297a427a36b7d84b4847ecdd331432e9f6b9.tar.gz
cdo-e9ad297a427a36b7d84b4847ecdd331432e9f6b9.tar.xz
cdo-e9ad297a427a36b7d84b4847ecdd331432e9f6b9.zip
[273562] Make EObjects available at the server-side
https://bugs.eclipse.org/bugs/show_bug.cgi?id=273562
-rw-r--r--plugins/org.eclipse.emf.cdo.server/src/org/eclipse/emf/cdo/internal/server/ServerCDOView.java22
-rw-r--r--plugins/org.eclipse.emf.cdo.server/src/org/eclipse/emf/cdo/server/CDOServerUtil.java10
-rw-r--r--plugins/org.eclipse.emf.cdo.tests/src/org/eclipse/emf/cdo/tests/RepositoryTest.java5
3 files changed, 13 insertions, 24 deletions
diff --git a/plugins/org.eclipse.emf.cdo.server/src/org/eclipse/emf/cdo/internal/server/ServerCDOView.java b/plugins/org.eclipse.emf.cdo.server/src/org/eclipse/emf/cdo/internal/server/ServerCDOView.java
index da74e1f8e2..0804601c53 100644
--- a/plugins/org.eclipse.emf.cdo.server/src/org/eclipse/emf/cdo/internal/server/ServerCDOView.java
+++ b/plugins/org.eclipse.emf.cdo.server/src/org/eclipse/emf/cdo/internal/server/ServerCDOView.java
@@ -23,7 +23,6 @@ import org.eclipse.emf.cdo.common.revision.CDORevisionKey;
import org.eclipse.emf.cdo.common.revision.CDORevisionProvider;
import org.eclipse.emf.cdo.server.IStoreAccessor;
import org.eclipse.emf.cdo.session.CDORepositoryInfo;
-import org.eclipse.emf.cdo.spi.common.branch.CDOBranchUtil;
import org.eclipse.emf.cdo.spi.common.branch.InternalCDOBranch;
import org.eclipse.emf.cdo.spi.common.branch.InternalCDOBranchManager;
import org.eclipse.emf.cdo.spi.common.commit.InternalCDOCommitInfoManager;
@@ -32,12 +31,12 @@ import org.eclipse.emf.cdo.spi.common.revision.InternalCDORevision;
import org.eclipse.emf.cdo.spi.common.revision.InternalCDORevisionManager;
import org.eclipse.emf.cdo.spi.server.InternalRepository;
import org.eclipse.emf.cdo.spi.server.InternalSession;
-import org.eclipse.emf.cdo.spi.server.InternalView;
import org.eclipse.emf.cdo.transaction.CDOTransaction;
import org.eclipse.emf.cdo.view.CDOFeatureAnalyzer;
import org.eclipse.emf.cdo.view.CDOFetchRuleManager;
import org.eclipse.emf.cdo.view.CDOView;
+import org.eclipse.emf.internal.cdo.session.SessionUtil;
import org.eclipse.emf.internal.cdo.view.AbstractCDOView;
import org.eclipse.net4j.util.concurrent.IRWLockManager.LockType;
@@ -51,6 +50,7 @@ import org.eclipse.emf.ecore.EObject;
import org.eclipse.emf.ecore.EPackage;
import org.eclipse.emf.ecore.EStructuralFeature;
import org.eclipse.emf.ecore.resource.ResourceSet;
+import org.eclipse.emf.ecore.resource.impl.ResourceSetImpl;
import org.eclipse.emf.spi.cdo.CDOSessionProtocol;
import org.eclipse.emf.spi.cdo.CDOSessionProtocol.RefreshSessionResult;
import org.eclipse.emf.spi.cdo.InternalCDOObject;
@@ -80,24 +80,8 @@ public class ServerCDOView extends AbstractCDOView
super(branchPoint, legacyModeEnabled);
this.session = new ServerCDOSession(session);
this.revisionProvider = revisionProvider;
- setObjects(new ReferenceValueMap.Soft<CDOID, InternalCDOObject>());
- activate();
- }
- public ServerCDOView(InternalView view, boolean legacyModeEnabled)
- {
- super(CDOBranchUtil.copyBranchPoint(view), legacyModeEnabled);
- session = new ServerCDOSession(view.getSession());
- revisionProvider = view;
- setObjects(new ReferenceValueMap.Soft<CDOID, InternalCDOObject>());
- activate();
- }
-
- public ServerCDOView(IStoreAccessor.CommitContext commitContext, boolean legacyModeEnabled)
- {
- super(CDOBranchUtil.copyBranchPoint(commitContext.getTransaction()), legacyModeEnabled);
- session = new ServerCDOSession((InternalSession)commitContext.getTransaction().getSession());
- revisionProvider = commitContext;
+ setViewSet(SessionUtil.prepareResourceSet(new ResourceSetImpl()));
setObjects(new ReferenceValueMap.Soft<CDOID, InternalCDOObject>());
activate();
}
diff --git a/plugins/org.eclipse.emf.cdo.server/src/org/eclipse/emf/cdo/server/CDOServerUtil.java b/plugins/org.eclipse.emf.cdo.server/src/org/eclipse/emf/cdo/server/CDOServerUtil.java
index eae5e9553e..d22b9f9860 100644
--- a/plugins/org.eclipse.emf.cdo.server/src/org/eclipse/emf/cdo/server/CDOServerUtil.java
+++ b/plugins/org.eclipse.emf.cdo.server/src/org/eclipse/emf/cdo/server/CDOServerUtil.java
@@ -24,10 +24,10 @@ import org.eclipse.emf.cdo.internal.server.syncing.OfflineClone;
import org.eclipse.emf.cdo.internal.server.syncing.RepositorySynchronizer;
import org.eclipse.emf.cdo.server.embedded.CDOSessionConfiguration;
import org.eclipse.emf.cdo.session.CDOSessionConfigurationFactory;
+import org.eclipse.emf.cdo.spi.common.branch.CDOBranchUtil;
import org.eclipse.emf.cdo.spi.server.InternalRepositorySynchronizer;
import org.eclipse.emf.cdo.spi.server.InternalSession;
import org.eclipse.emf.cdo.spi.server.InternalStore;
-import org.eclipse.emf.cdo.spi.server.InternalView;
import org.eclipse.emf.cdo.spi.server.RepositoryFactory;
import org.eclipse.emf.cdo.view.CDOView;
@@ -76,7 +76,9 @@ public final class CDOServerUtil
*/
public static CDOView openView(IView view, boolean legacyModeEnabled)
{
- return new ServerCDOView((InternalView)view, legacyModeEnabled);
+ ISession session = view.getSession();
+ CDOBranchPoint branchPoint = CDOBranchUtil.copyBranchPoint(view);
+ return openView(session, branchPoint, legacyModeEnabled, view);
}
/**
@@ -84,7 +86,9 @@ public final class CDOServerUtil
*/
public static CDOView openView(IStoreAccessor.CommitContext commitContext, boolean legacyModeEnabled)
{
- return new ServerCDOView(commitContext, legacyModeEnabled);
+ ISession session = commitContext.getTransaction().getSession();
+ CDOBranchPoint branchPoint = commitContext.getBranchPoint();
+ return openView(session, branchPoint, legacyModeEnabled, commitContext);
}
/**
diff --git a/plugins/org.eclipse.emf.cdo.tests/src/org/eclipse/emf/cdo/tests/RepositoryTest.java b/plugins/org.eclipse.emf.cdo.tests/src/org/eclipse/emf/cdo/tests/RepositoryTest.java
index bc170e2bfa..34b2e4a4ef 100644
--- a/plugins/org.eclipse.emf.cdo.tests/src/org/eclipse/emf/cdo/tests/RepositoryTest.java
+++ b/plugins/org.eclipse.emf.cdo.tests/src/org/eclipse/emf/cdo/tests/RepositoryTest.java
@@ -10,7 +10,6 @@
*/
package org.eclipse.emf.cdo.tests;
-import org.eclipse.emf.cdo.CDOObject;
import org.eclipse.emf.cdo.common.revision.CDORevision;
import org.eclipse.emf.cdo.eresource.CDOResource;
import org.eclipse.emf.cdo.server.CDOServerUtil;
@@ -23,6 +22,7 @@ import org.eclipse.emf.cdo.session.CDOSession;
import org.eclipse.emf.cdo.spi.server.InternalStore;
import org.eclipse.emf.cdo.tests.model1.Customer;
import org.eclipse.emf.cdo.transaction.CDOTransaction;
+import org.eclipse.emf.cdo.util.CDOUtil;
import org.eclipse.emf.cdo.util.CommitException;
import org.eclipse.emf.cdo.view.CDOView;
@@ -172,7 +172,8 @@ public class RepositoryTest extends AbstractCDOTest
CDOView view = CDOServerUtil.openView(commitContext, isConfig(LEGACY));
for (CDORevision revision : commitContext.getNewObjects())
{
- CDOObject object = view.getObject(revision.getID());
+ EObject object = view.getObject(revision.getID());
+ object = CDOUtil.getEObject(object); // Make legacy mode happy
if (object instanceof Customer)
{
Customer customer = (Customer)object;

Back to the top