diff options
Diffstat (limited to 'plugins')
106 files changed, 1686 insertions, 1382 deletions
diff --git a/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/common/protocol/CDOProtocolConstants.java b/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/common/protocol/CDOProtocolConstants.java index 707217ab54..4b24c6e0a8 100644 --- a/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/common/protocol/CDOProtocolConstants.java +++ b/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/common/protocol/CDOProtocolConstants.java @@ -61,7 +61,7 @@ public interface CDOProtocolConstants public static final short SIGNAL_QUERY_CANCEL = 19; - public static final short SIGNAL_SYNC = 20; + public static final short SIGNAL_SYNC_REVISIONS = 20; public static final short SIGNAL_PASSIVE_UPDATE = 21; diff --git a/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/internal/common/revision/CDOIDMapper.java b/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/spi/common/revision/CDOIDMapper.java index 61ebc5b191..f588a50058 100644 --- a/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/internal/common/revision/CDOIDMapper.java +++ b/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/spi/common/revision/CDOIDMapper.java @@ -1,5 +1,5 @@ -/** - * Copyright (c) 2004 - 2009 Eike Stepper (Berlin, Germany) and others. +/*************************************************************************** + * Copyright (c) 2004 - 2008 Eike Stepper, Germany. * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v1.0 * which accompanies this distribution, and is available at @@ -7,9 +7,8 @@ * * Contributors: * Simon McDuff - initial API and implementation - * Eike Stepper - maintenance - */ -package org.eclipse.emf.cdo.internal.common.revision; + **************************************************************************/ +package org.eclipse.emf.cdo.spi.common.revision; import org.eclipse.emf.cdo.common.id.CDOID; import org.eclipse.emf.cdo.common.id.CDOIDTemp; @@ -20,6 +19,7 @@ import java.util.Map; /** * @author Simon McDuff + * @since 2.0 */ public class CDOIDMapper implements CDOReferenceAdjuster { diff --git a/plugins/org.eclipse.emf.cdo.defs/src/org/eclipse/emf/cdo/defs/impl/CDOClientProtocolFactoryDefImpl.java b/plugins/org.eclipse.emf.cdo.defs/src/org/eclipse/emf/cdo/defs/impl/CDOClientProtocolFactoryDefImpl.java index 74da25099f..61aed9ada2 100644 --- a/plugins/org.eclipse.emf.cdo.defs/src/org/eclipse/emf/cdo/defs/impl/CDOClientProtocolFactoryDefImpl.java +++ b/plugins/org.eclipse.emf.cdo.defs/src/org/eclipse/emf/cdo/defs/impl/CDOClientProtocolFactoryDefImpl.java @@ -14,7 +14,7 @@ package org.eclipse.emf.cdo.defs.impl; import org.eclipse.emf.cdo.defs.CDOClientProtocolFactoryDef; import org.eclipse.emf.cdo.defs.CDODefsPackage; -import org.eclipse.emf.internal.cdo.protocol.CDOClientProtocolFactory; +import org.eclipse.emf.internal.cdo.net4j.protocol.CDOClientProtocolFactory; import org.eclipse.net4j.defs.impl.ClientProtocolFactoryDefImpl; diff --git a/plugins/org.eclipse.emf.cdo.defs/src/org/eclipse/emf/cdo/defs/impl/CDOSessionDefImpl.java b/plugins/org.eclipse.emf.cdo.defs/src/org/eclipse/emf/cdo/defs/impl/CDOSessionDefImpl.java index bf9115d6a0..614a97da5c 100644 --- a/plugins/org.eclipse.emf.cdo.defs/src/org/eclipse/emf/cdo/defs/impl/CDOSessionDefImpl.java +++ b/plugins/org.eclipse.emf.cdo.defs/src/org/eclipse/emf/cdo/defs/impl/CDOSessionDefImpl.java @@ -15,10 +15,10 @@ import org.eclipse.emf.cdo.defs.CDODefsPackage; import org.eclipse.emf.cdo.defs.CDOPackageRegistryDef; import org.eclipse.emf.cdo.defs.CDOSessionDef; import org.eclipse.emf.cdo.defs.FailOverStrategyDef; +import org.eclipse.emf.cdo.net4j.CDONet4jUtil; +import org.eclipse.emf.cdo.net4j.CDOSessionConfiguration; 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.internal.cdo.session.CDOSessionConfigurationImpl; @@ -577,7 +577,7 @@ public class CDOSessionDefImpl extends DefImpl implements CDOSessionDef @Override protected CDOSession createInstance() { - CDOSessionConfiguration configuration = CDOUtil.createSessionConfiguration(); + CDOSessionConfiguration configuration = CDONet4jUtil.createSessionConfiguration(); if (isSetConnectorDef()) { diff --git a/plugins/org.eclipse.emf.cdo.examples/src/org/eclipse/emf/cdo/examples/StandaloneContainerExample.java b/plugins/org.eclipse.emf.cdo.examples/src/org/eclipse/emf/cdo/examples/StandaloneContainerExample.java index 56a2587249..b97f07130a 100644 --- a/plugins/org.eclipse.emf.cdo.examples/src/org/eclipse/emf/cdo/examples/StandaloneContainerExample.java +++ b/plugins/org.eclipse.emf.cdo.examples/src/org/eclipse/emf/cdo/examples/StandaloneContainerExample.java @@ -11,12 +11,12 @@ package org.eclipse.emf.cdo.examples; 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.CDOSession; -import org.eclipse.emf.cdo.session.CDOSessionConfiguration; import org.eclipse.emf.cdo.tests.model1.Model1Factory; import org.eclipse.emf.cdo.tests.model1.Model1Package; import org.eclipse.emf.cdo.transaction.CDOTransaction; -import org.eclipse.emf.cdo.util.CDOUtil; import org.eclipse.net4j.Net4jUtil; import org.eclipse.net4j.connector.IConnector; @@ -45,14 +45,14 @@ public class StandaloneContainerExample IManagedContainer container = ContainerUtil.createContainer(); Net4jUtil.prepareContainer(container); // Register Net4j factories TCPUtil.prepareContainer(container); // Register TCP factories - CDOUtil.prepareContainer(container); // Register CDO factories + CDONet4jUtil.prepareContainer(container); // Register CDO factories container.activate(); // Create connector IConnector connector = TCPUtil.getConnector(container, "localhost:2036"); // Create configuration - CDOSessionConfiguration configuration = CDOUtil.createSessionConfiguration(); + CDOSessionConfiguration configuration = CDONet4jUtil.createSessionConfiguration(); configuration.setConnector(connector); configuration.setRepositoryName("repo1"); diff --git a/plugins/org.eclipse.emf.cdo.examples/src/org/eclipse/emf/cdo/examples/StandaloneManualExample.java b/plugins/org.eclipse.emf.cdo.examples/src/org/eclipse/emf/cdo/examples/StandaloneManualExample.java index 7ea3faa050..f97bd8bfb2 100644 --- a/plugins/org.eclipse.emf.cdo.examples/src/org/eclipse/emf/cdo/examples/StandaloneManualExample.java +++ b/plugins/org.eclipse.emf.cdo.examples/src/org/eclipse/emf/cdo/examples/StandaloneManualExample.java @@ -11,12 +11,12 @@ package org.eclipse.emf.cdo.examples; 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.CDOSession; -import org.eclipse.emf.cdo.session.CDOSessionConfiguration; import org.eclipse.emf.cdo.tests.model1.Model1Factory; import org.eclipse.emf.cdo.tests.model1.Model1Package; import org.eclipse.emf.cdo.transaction.CDOTransaction; -import org.eclipse.emf.cdo.util.CDOUtil; import org.eclipse.net4j.FactoriesProtocolProvider; import org.eclipse.net4j.Net4jUtil; @@ -63,7 +63,7 @@ public class StandaloneManualExample LifecycleUtil.activate(bufferProvider); IProtocolProvider protocolProvider = new FactoriesProtocolProvider( - new org.eclipse.emf.internal.cdo.protocol.CDOClientProtocolFactory()); + new org.eclipse.emf.internal.cdo.net4j.protocol.CDOClientProtocolFactory()); // Prepare selector org.eclipse.net4j.internal.tcp.TCPSelector selector = new org.eclipse.net4j.internal.tcp.TCPSelector(); @@ -81,7 +81,7 @@ public class StandaloneManualExample connector.activate(); // Create configuration - CDOSessionConfiguration configuration = CDOUtil.createSessionConfiguration(); + CDOSessionConfiguration configuration = CDONet4jUtil.createSessionConfiguration(); configuration.setConnector(connector); configuration.setRepositoryName("repo1"); diff --git a/plugins/org.eclipse.emf.cdo.server/.settings/.api_filters b/plugins/org.eclipse.emf.cdo.server/.settings/.api_filters index 810e9f5786..a492541c0d 100644 --- a/plugins/org.eclipse.emf.cdo.server/.settings/.api_filters +++ b/plugins/org.eclipse.emf.cdo.server/.settings/.api_filters @@ -125,12 +125,6 @@ <message_argument value="TransactionPackageManager"/> </message_arguments> </filter> - <filter id="574619656"> - <message_arguments> - <message_argument value="CDOPackageManager"/> - <message_argument value="TransactionPackageManager"/> - </message_arguments> - </filter> </resource> <resource path="src/org/eclipse/emf/cdo/server/ISession.java" type="org.eclipse.emf.cdo.server.ISession"> <filter id="574619656"> diff --git a/plugins/org.eclipse.emf.cdo.server/src/org/eclipse/emf/cdo/internal/server/TransactionCommitContextImpl.java b/plugins/org.eclipse.emf.cdo.server/src/org/eclipse/emf/cdo/internal/server/TransactionCommitContextImpl.java index a030106559..2e65b3d5c6 100644 --- a/plugins/org.eclipse.emf.cdo.server/src/org/eclipse/emf/cdo/internal/server/TransactionCommitContextImpl.java +++ b/plugins/org.eclipse.emf.cdo.server/src/org/eclipse/emf/cdo/internal/server/TransactionCommitContextImpl.java @@ -19,15 +19,16 @@ import org.eclipse.emf.cdo.common.id.CDOIDUtil; import org.eclipse.emf.cdo.common.model.CDOPackage; import org.eclipse.emf.cdo.common.model.core.CDOCorePackage; import org.eclipse.emf.cdo.common.model.resource.CDOResourcePackage; +import org.eclipse.emf.cdo.common.revision.CDOReferenceAdjuster; import org.eclipse.emf.cdo.common.revision.CDORevision; import org.eclipse.emf.cdo.common.revision.CDORevisionResolver; import org.eclipse.emf.cdo.common.revision.delta.CDORevisionDelta; -import org.eclipse.emf.cdo.internal.common.revision.CDOIDMapper; import org.eclipse.emf.cdo.internal.server.bundle.OM; import org.eclipse.emf.cdo.server.IStoreAccessor; import org.eclipse.emf.cdo.server.StoreThreadLocal; import org.eclipse.emf.cdo.spi.common.model.InternalCDOPackage; import org.eclipse.emf.cdo.spi.common.model.InternalCDOPackageManager; +import org.eclipse.emf.cdo.spi.common.revision.CDOIDMapper; import org.eclipse.emf.cdo.spi.common.revision.InternalCDORevision; import org.eclipse.emf.cdo.spi.common.revision.InternalCDORevisionDelta; @@ -79,7 +80,7 @@ public class TransactionCommitContextImpl implements IStoreAccessor.CommitContex private ConcurrentMap<CDOIDTemp, CDOID> idMappings = new ConcurrentHashMap<CDOIDTemp, CDOID>(); - private CDOIDMapper idMapper = new CDOIDMapper(idMappings); + private CDOReferenceAdjuster idMapper = new CDOIDMapper(idMappings); private String rollbackMessage; diff --git a/plugins/org.eclipse.emf.cdo.server/src/org/eclipse/emf/cdo/internal/server/protocol/CDOServerProtocol.java b/plugins/org.eclipse.emf.cdo.server/src/org/eclipse/emf/cdo/internal/server/protocol/CDOServerProtocol.java index a10791b8a7..ed6b7afe96 100644 --- a/plugins/org.eclipse.emf.cdo.server/src/org/eclipse/emf/cdo/internal/server/protocol/CDOServerProtocol.java +++ b/plugins/org.eclipse.emf.cdo.server/src/org/eclipse/emf/cdo/internal/server/protocol/CDOServerProtocol.java @@ -100,8 +100,8 @@ public class CDOServerProtocol extends CDOProtocolImpl case CDOProtocolConstants.SIGNAL_QUERY_CANCEL: return new QueryCancelIndication(this); - case CDOProtocolConstants.SIGNAL_SYNC: - return new SyncRevisionIndication(this); + case CDOProtocolConstants.SIGNAL_SYNC_REVISIONS: + return new SyncRevisionsIndication(this); case CDOProtocolConstants.SIGNAL_PASSIVE_UPDATE: return new SetPassiveUpdateIndication(this); diff --git a/plugins/org.eclipse.emf.cdo.server/src/org/eclipse/emf/cdo/internal/server/protocol/SetPassiveUpdateIndication.java b/plugins/org.eclipse.emf.cdo.server/src/org/eclipse/emf/cdo/internal/server/protocol/SetPassiveUpdateIndication.java index 74aec56ceb..ab80fcb77e 100644 --- a/plugins/org.eclipse.emf.cdo.server/src/org/eclipse/emf/cdo/internal/server/protocol/SetPassiveUpdateIndication.java +++ b/plugins/org.eclipse.emf.cdo.server/src/org/eclipse/emf/cdo/internal/server/protocol/SetPassiveUpdateIndication.java @@ -23,7 +23,7 @@ import java.io.IOException; /** * @author Simon McDuff */ -public class SetPassiveUpdateIndication extends SyncRevisionIndication +public class SetPassiveUpdateIndication extends SyncRevisionsIndication { private static final ContextTracer PROTOCOL_TRACER = new ContextTracer(OM.DEBUG_PROTOCOL, SetPassiveUpdateIndication.class); diff --git a/plugins/org.eclipse.emf.cdo.server/src/org/eclipse/emf/cdo/internal/server/protocol/SyncRevisionIndication.java b/plugins/org.eclipse.emf.cdo.server/src/org/eclipse/emf/cdo/internal/server/protocol/SyncRevisionsIndication.java index 7316eae744..cc5f9ded66 100644 --- a/plugins/org.eclipse.emf.cdo.server/src/org/eclipse/emf/cdo/internal/server/protocol/SyncRevisionIndication.java +++ b/plugins/org.eclipse.emf.cdo.server/src/org/eclipse/emf/cdo/internal/server/protocol/SyncRevisionsIndication.java @@ -1,4 +1,4 @@ -/** +/*************************************************************************** * Copyright (c) 2004-2007 Eike Stepper, Germany. * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v1.0 @@ -8,7 +8,7 @@ * Contributors: * Simon McDuff - initial API and implementation * Eike Stepper - maintenance - */ + **************************************************************************/ package org.eclipse.emf.cdo.internal.server.protocol; import org.eclipse.emf.cdo.common.id.CDOID; @@ -31,10 +31,10 @@ import java.util.List; /** * @author Simon McDuff */ -public class SyncRevisionIndication extends CDOReadIndication +public class SyncRevisionsIndication extends CDOReadIndication { private static final ContextTracer PROTOCOL_TRACER = new ContextTracer(OM.DEBUG_PROTOCOL, - SyncRevisionIndication.class); + SyncRevisionsIndication.class); private List<Pair<InternalCDORevision, Long>> dirtyObjects = new ArrayList<Pair<InternalCDORevision, Long>>(); @@ -42,12 +42,12 @@ public class SyncRevisionIndication extends CDOReadIndication private int referenceChunk; - public SyncRevisionIndication(CDOServerProtocol protocol) + public SyncRevisionsIndication(CDOServerProtocol protocol) { - super(protocol, CDOProtocolConstants.SIGNAL_SYNC); + super(protocol, CDOProtocolConstants.SIGNAL_SYNC_REVISIONS); } - public SyncRevisionIndication(CDOServerProtocol protocol, short signalID) + public SyncRevisionsIndication(CDOServerProtocol protocol, short signalID) { super(protocol, signalID); } diff --git a/plugins/org.eclipse.emf.cdo.tests/src/org/eclipse/emf/cdo/tests/AttributeTest.java b/plugins/org.eclipse.emf.cdo.tests/src/org/eclipse/emf/cdo/tests/AttributeTest.java index 4c83dbb201..bd9f4a3238 100644 --- a/plugins/org.eclipse.emf.cdo.tests/src/org/eclipse/emf/cdo/tests/AttributeTest.java +++ b/plugins/org.eclipse.emf.cdo.tests/src/org/eclipse/emf/cdo/tests/AttributeTest.java @@ -120,6 +120,7 @@ public class AttributeTest extends AbstractCDOTest { assertEquals(storeByteArray[i], saveByteArray[i]); } + view.close(); session.close(); } diff --git a/plugins/org.eclipse.emf.cdo.tests/src/org/eclipse/emf/cdo/tests/ConflictResolverTest.java b/plugins/org.eclipse.emf.cdo.tests/src/org/eclipse/emf/cdo/tests/ConflictResolverTest.java index b59a5c95cd..700705a29c 100644 --- a/plugins/org.eclipse.emf.cdo.tests/src/org/eclipse/emf/cdo/tests/ConflictResolverTest.java +++ b/plugins/org.eclipse.emf.cdo.tests/src/org/eclipse/emf/cdo/tests/ConflictResolverTest.java @@ -16,7 +16,7 @@ import org.eclipse.emf.cdo.tests.model1.Address; import org.eclipse.emf.cdo.transaction.CDOTransaction; import org.eclipse.emf.cdo.util.CDOUtil; -import org.eclipse.emf.spi.cdo.CDOObjectConflictResolver.MergeLocalChangesPerFeature; +import org.eclipse.emf.spi.cdo.AbstractObjectConflictResolver.MergeLocalChangesPerFeature; /** * @author Simon McDuff diff --git a/plugins/org.eclipse.emf.cdo.tests/src/org/eclipse/emf/cdo/tests/ImportXML.java b/plugins/org.eclipse.emf.cdo.tests/src/org/eclipse/emf/cdo/tests/ImportXML.java index 347fe37778..b4b1ff84dc 100644 --- a/plugins/org.eclipse.emf.cdo.tests/src/org/eclipse/emf/cdo/tests/ImportXML.java +++ b/plugins/org.eclipse.emf.cdo.tests/src/org/eclipse/emf/cdo/tests/ImportXML.java @@ -10,19 +10,19 @@ */ package org.eclipse.emf.cdo.tests; +import org.eclipse.emf.cdo.net4j.CDONet4jUtil; +import org.eclipse.emf.cdo.net4j.CDOSessionConfiguration; import org.eclipse.emf.cdo.server.CDOServerUtil; import org.eclipse.emf.cdo.server.IRepository; import org.eclipse.emf.cdo.server.IStore; import org.eclipse.emf.cdo.server.StoreUtil; import org.eclipse.emf.cdo.server.IRepository.Props; import org.eclipse.emf.cdo.session.CDOSession; -import org.eclipse.emf.cdo.session.CDOSessionConfiguration; import org.eclipse.emf.cdo.tests.model1.Category; import org.eclipse.emf.cdo.tests.model1.Model1Factory; import org.eclipse.emf.cdo.tests.model1.Model1Package; import org.eclipse.emf.cdo.tests.model1.Product1; import org.eclipse.emf.cdo.transaction.CDOTransaction; -import org.eclipse.emf.cdo.util.CDOUtil; import org.eclipse.net4j.Net4jUtil; import org.eclipse.net4j.connector.IConnector; @@ -54,7 +54,7 @@ public class ImportXML Net4jUtil.prepareContainer(container); // Prepare the Net4j kernel JVMUtil.prepareContainer(container); // Prepare the JVM transport CDOServerUtil.prepareContainer(container); // Prepare the CDO server - CDOUtil.prepareContainer(container); // Prepare the CDO client + CDONet4jUtil.prepareContainer(container); // Prepare the CDO client container.activate(); // Start the transport and create a repository @@ -112,7 +112,7 @@ public class ImportXML protected static CDOSession openSession(IConnector connector) { - CDOSessionConfiguration configuration = CDOUtil.createSessionConfiguration(); + CDOSessionConfiguration configuration = CDONet4jUtil.createSessionConfiguration(); configuration.setConnector(connector); configuration.setRepositoryName(REPOSITORY_NAME); return configuration.openSession(); diff --git a/plugins/org.eclipse.emf.cdo.tests/src/org/eclipse/emf/cdo/tests/LegacyTest.java b/plugins/org.eclipse.emf.cdo.tests/src/org/eclipse/emf/cdo/tests/LegacyTest.java index e2b161d873..8c8518a19a 100644 --- a/plugins/org.eclipse.emf.cdo.tests/src/org/eclipse/emf/cdo/tests/LegacyTest.java +++ b/plugins/org.eclipse.emf.cdo.tests/src/org/eclipse/emf/cdo/tests/LegacyTest.java @@ -26,7 +26,7 @@ public class LegacyTest extends AbstractCDOTest // resource.getContents().add(hook); // transaction.commit(); // - // CDOObject cdoHook = CDOUtil.getCDOObject(hook); + // CDOObject cdoHook = CDONet4jUtil.getCDOObject(hook); // assertEquals(false, CDOLegacyWrapper.isLegacyProxy(cdoHook)); // assertEquals(CDOState.CLEAN, cdoHook.cdoState()); // assertEquals(CDOState.CLEAN, resource.cdoState()); @@ -50,7 +50,7 @@ public class LegacyTest extends AbstractCDOTest // EList<EObject> contents = resource.getContents(); // // Hook hook = (Hook)contents.get(0); - // CDOObject cdoHook = CDOUtil.getCDOObject(hook); + // CDOObject cdoHook = CDONet4jUtil.getCDOObject(hook); // assertEquals(false, CDOLegacyWrapper.isLegacyProxy(cdoHook)); // assertEquals(CDOState.CLEAN, cdoHook.cdoState()); // assertEquals(CDOState.CLEAN, resource.cdoState()); @@ -76,7 +76,7 @@ public class LegacyTest extends AbstractCDOTest // resource.getContents().add(hook); // transaction.commit(); // - // CDOObject cdoHook = CDOUtil.getCDOObject(hook); + // CDOObject cdoHook = CDONet4jUtil.getCDOObject(hook); // assertEquals(false, CDOLegacyWrapper.isLegacyProxy(cdoHook)); // assertEquals(CDOState.CLEAN, cdoHook.cdoState()); // assertEquals(CDOState.CLEAN, resource.cdoState()); @@ -91,7 +91,7 @@ public class LegacyTest extends AbstractCDOTest // Hook hook = (Hook)contents.get(0); // assertNotProxy(hook); // - // CDOObject cdoHook = CDOUtil.getCDOObject(hook); + // CDOObject cdoHook = CDONet4jUtil.getCDOObject(hook); // assertEquals(false, CDOLegacyWrapper.isLegacyProxy(cdoHook)); // assertEquals(CDOState.CLEAN, cdoHook.cdoState()); // @@ -111,17 +111,17 @@ public class LegacyTest extends AbstractCDOTest // Hook h0 = children.get(0); // assertNotProxy(h0); // assertEquals("Hook 1", h0.getName()); - // assertEquals(CDOState.CLEAN, CDOUtil.getCDOObject(h0).cdoState()); + // assertEquals(CDOState.CLEAN, CDONet4jUtil.getCDOObject(h0).cdoState()); // // Hook h1 = children.get(1); // assertNotProxy(h1); // assertEquals("Hook 2", h1.getName()); - // assertEquals(CDOState.CLEAN, CDOUtil.getCDOObject(h1).cdoState()); + // assertEquals(CDOState.CLEAN, CDONet4jUtil.getCDOObject(h1).cdoState()); // // Hook h2 = children.get(2); // assertNotProxy(h2); // assertEquals("Hook 3", h2.getName()); - // assertEquals(CDOState.CLEAN, CDOUtil.getCDOObject(h2).cdoState()); + // assertEquals(CDOState.CLEAN, CDONet4jUtil.getCDOObject(h2).cdoState()); // session.close(); // } // diff --git a/plugins/org.eclipse.emf.cdo.tests/src/org/eclipse/emf/cdo/tests/PackageRegistryTest.java b/plugins/org.eclipse.emf.cdo.tests/src/org/eclipse/emf/cdo/tests/PackageRegistryTest.java index 2bdccd36e7..d419b1814f 100644 --- a/plugins/org.eclipse.emf.cdo.tests/src/org/eclipse/emf/cdo/tests/PackageRegistryTest.java +++ b/plugins/org.eclipse.emf.cdo.tests/src/org/eclipse/emf/cdo/tests/PackageRegistryTest.java @@ -13,9 +13,10 @@ package org.eclipse.emf.cdo.tests; import org.eclipse.emf.cdo.CDOObject; import org.eclipse.emf.cdo.common.model.CDOPackage; 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.CDOPackageTypeRegistry; import org.eclipse.emf.cdo.session.CDOSession; -import org.eclipse.emf.cdo.session.CDOSessionConfiguration; import org.eclipse.emf.cdo.tests.bundle.OM; import org.eclipse.emf.cdo.tests.config.IRepositoryConfig; import org.eclipse.emf.cdo.tests.mango.Value; @@ -29,7 +30,6 @@ import org.eclipse.emf.cdo.tests.model3.subpackage.Class2; import org.eclipse.emf.cdo.tests.model3.subpackage.SubpackageFactory; import org.eclipse.emf.cdo.tests.model3.subpackage.SubpackagePackage; import org.eclipse.emf.cdo.transaction.CDOTransaction; -import org.eclipse.emf.cdo.util.CDOUtil; import org.eclipse.emf.cdo.util.EMFUtil; import org.eclipse.emf.common.util.URI; @@ -237,7 +237,7 @@ public class PackageRegistryTest extends AbstractCDOTest { { // Create resource in session 1 - CDOSessionConfiguration configuration = CDOUtil.createSessionConfiguration(); + CDOSessionConfiguration configuration = CDONet4jUtil.createSessionConfiguration(); configuration.setConnector(getConnector()); configuration.setRepositoryName(IRepositoryConfig.REPOSITORY_NAME); configuration.setEagerPackageRegistry(); @@ -270,7 +270,7 @@ public class PackageRegistryTest extends AbstractCDOTest { { // Create resource in session 1 - CDOSessionConfiguration configuration = CDOUtil.createSessionConfiguration(); + CDOSessionConfiguration configuration = CDONet4jUtil.createSessionConfiguration(); configuration.setConnector(getConnector()); configuration.setRepositoryName(IRepositoryConfig.REPOSITORY_NAME); configuration.setLazyPackageRegistry(); diff --git a/plugins/org.eclipse.emf.cdo.tests/src/org/eclipse/emf/cdo/tests/StateMachineTest.java b/plugins/org.eclipse.emf.cdo.tests/src/org/eclipse/emf/cdo/tests/StateMachineTest.java index 161d32a97f..901d60add6 100644 --- a/plugins/org.eclipse.emf.cdo.tests/src/org/eclipse/emf/cdo/tests/StateMachineTest.java +++ b/plugins/org.eclipse.emf.cdo.tests/src/org/eclipse/emf/cdo/tests/StateMachineTest.java @@ -24,13 +24,13 @@ import org.eclipse.emf.cdo.transaction.CDOTransaction; import org.eclipse.emf.cdo.util.CDOUtil; import org.eclipse.emf.internal.cdo.CDOStateMachine; -import org.eclipse.emf.internal.cdo.protocol.CommitTransactionResult; import org.eclipse.net4j.util.io.IOUtil; import org.eclipse.emf.common.util.URI; import org.eclipse.emf.ecore.EObject; import org.eclipse.emf.spi.cdo.InternalCDOObject; +import org.eclipse.emf.spi.cdo.CDOSessionProtocol.CommitTransactionResult; import java.lang.reflect.InvocationTargetException; import java.lang.reflect.Method; diff --git a/plugins/org.eclipse.emf.cdo.tests/src/org/eclipse/emf/cdo/tests/TransactionMonitoringTest.java b/plugins/org.eclipse.emf.cdo.tests/src/org/eclipse/emf/cdo/tests/TransactionMonitoringTest.java index cd5b10a28b..693b21d78f 100644 --- a/plugins/org.eclipse.emf.cdo.tests/src/org/eclipse/emf/cdo/tests/TransactionMonitoringTest.java +++ b/plugins/org.eclipse.emf.cdo.tests/src/org/eclipse/emf/cdo/tests/TransactionMonitoringTest.java @@ -10,12 +10,12 @@ */ package org.eclipse.emf.cdo.tests; +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.cdo.session.CDOSessionConfiguration; import org.eclipse.emf.cdo.tests.model1.Model1Factory; import org.eclipse.emf.cdo.tests.model1.Model1Package; import org.eclipse.emf.cdo.transaction.CDOTransaction; -import org.eclipse.emf.cdo.util.CDOUtil; import org.eclipse.net4j.Net4jUtil; import org.eclipse.net4j.tcp.TCPUtil; @@ -41,10 +41,10 @@ public class TransactionMonitoringTest IManagedContainer container = ContainerUtil.createContainer(); Net4jUtil.prepareContainer(container); TCPUtil.prepareContainer(container); - CDOUtil.prepareContainer(container); + CDONet4jUtil.prepareContainer(container); container.activate(); - CDOSessionConfiguration configuration = CDOUtil.createSessionConfiguration(); + CDOSessionConfiguration configuration = CDONet4jUtil.createSessionConfiguration(); configuration.setConnector(TCPUtil.getConnector(container, "localhost")); configuration.setRepositoryName("repo1"); diff --git a/plugins/org.eclipse.emf.cdo.tests/src/org/eclipse/emf/cdo/tests/bugzilla/Bugzilla_241464_Test.java b/plugins/org.eclipse.emf.cdo.tests/src/org/eclipse/emf/cdo/tests/bugzilla/Bugzilla_241464_Test.java index bd869c2c04..dfab51d152 100644 --- a/plugins/org.eclipse.emf.cdo.tests/src/org/eclipse/emf/cdo/tests/bugzilla/Bugzilla_241464_Test.java +++ b/plugins/org.eclipse.emf.cdo.tests/src/org/eclipse/emf/cdo/tests/bugzilla/Bugzilla_241464_Test.java @@ -44,7 +44,10 @@ public class Bugzilla_241464_Test extends AbstractCDOTest } CDOSession session = openModel1Session(); - session.getProtocol().setTimeout(2000L); + if (session instanceof org.eclipse.emf.cdo.net4j.CDOSession) + { + ((org.eclipse.emf.cdo.net4j.CDOSession)session).options().getProtocol().setTimeout(2000L); + } CDOTransaction transaction = session.openTransaction(); CDOResource resource = transaction.getResource("/test1"); diff --git a/plugins/org.eclipse.emf.cdo.tests/src/org/eclipse/emf/cdo/tests/bugzilla/Bugzilla_246442_Test.java b/plugins/org.eclipse.emf.cdo.tests/src/org/eclipse/emf/cdo/tests/bugzilla/Bugzilla_246442_Test.java index 768ef00ace..d1fd0c0212 100644 --- a/plugins/org.eclipse.emf.cdo.tests/src/org/eclipse/emf/cdo/tests/bugzilla/Bugzilla_246442_Test.java +++ b/plugins/org.eclipse.emf.cdo.tests/src/org/eclipse/emf/cdo/tests/bugzilla/Bugzilla_246442_Test.java @@ -67,7 +67,10 @@ public class Bugzilla_246442_Test extends AbstractCDOTest } CDOSession session = openSession(); - session.getProtocol().setTimeout(2000L); + if (session instanceof org.eclipse.emf.cdo.net4j.CDOSession) + { + ((org.eclipse.emf.cdo.net4j.CDOSession)session).options().getProtocol().setTimeout(2000L); + } CDOTransaction transaction = session.openTransaction(); transaction.getObject(lookupObject); diff --git a/plugins/org.eclipse.emf.cdo.tests/src/org/eclipse/emf/cdo/tests/bugzilla/Bugzilla_258933_Test.java b/plugins/org.eclipse.emf.cdo.tests/src/org/eclipse/emf/cdo/tests/bugzilla/Bugzilla_258933_Test.java index 25a366fa86..0c193e970e 100644 --- a/plugins/org.eclipse.emf.cdo.tests/src/org/eclipse/emf/cdo/tests/bugzilla/Bugzilla_258933_Test.java +++ b/plugins/org.eclipse.emf.cdo.tests/src/org/eclipse/emf/cdo/tests/bugzilla/Bugzilla_258933_Test.java @@ -124,7 +124,10 @@ public class Bugzilla_258933_Test extends AbstractCDOTest CDOSession session = openSession(); session.getPackageRegistry().putEPackage(topPackage); - session.getProtocol().setTimeout(2000L); + if (session instanceof org.eclipse.emf.cdo.net4j.CDOSession) + { + ((org.eclipse.emf.cdo.net4j.CDOSession)session).options().getProtocol().setTimeout(2000L); + } CDOTransaction transaction = session.openTransaction(); CDOObject instance = (CDOObject)transaction.getResource("/test1").getContents().get(0); diff --git a/plugins/org.eclipse.emf.cdo.tests/src/org/eclipse/emf/cdo/tests/config/impl/ContainerConfig.java b/plugins/org.eclipse.emf.cdo.tests/src/org/eclipse/emf/cdo/tests/config/impl/ContainerConfig.java index 4aed791ce2..89b83956b0 100644 --- a/plugins/org.eclipse.emf.cdo.tests/src/org/eclipse/emf/cdo/tests/config/impl/ContainerConfig.java +++ b/plugins/org.eclipse.emf.cdo.tests/src/org/eclipse/emf/cdo/tests/config/impl/ContainerConfig.java @@ -10,9 +10,9 @@ */ package org.eclipse.emf.cdo.tests.config.impl; +import org.eclipse.emf.cdo.net4j.CDONet4jUtil; import org.eclipse.emf.cdo.server.CDOServerUtil; import org.eclipse.emf.cdo.tests.config.IContainerConfig; -import org.eclipse.emf.cdo.util.CDOUtil; import org.eclipse.net4j.Net4jUtil; import org.eclipse.net4j.util.container.ContainerUtil; @@ -96,7 +96,7 @@ public abstract class ContainerConfig extends Config implements IContainerConfig { IManagedContainer container = ContainerUtil.createContainer(); Net4jUtil.prepareContainer(container); - CDOUtil.prepareContainer(container); + CDONet4jUtil.prepareContainer(container); CDOServerUtil.prepareContainer(container); return container; } @@ -144,7 +144,7 @@ public abstract class ContainerConfig extends Config implements IContainerConfig { IManagedContainer container = ContainerUtil.createContainer(); Net4jUtil.prepareContainer(container); - CDOUtil.prepareContainer(container); + CDONet4jUtil.prepareContainer(container); return container; } diff --git a/plugins/org.eclipse.emf.cdo.tests/src/org/eclipse/emf/cdo/tests/config/impl/SessionConfig.java b/plugins/org.eclipse.emf.cdo.tests/src/org/eclipse/emf/cdo/tests/config/impl/SessionConfig.java index 65e4c5cadf..8600dda89f 100644 --- a/plugins/org.eclipse.emf.cdo.tests/src/org/eclipse/emf/cdo/tests/config/impl/SessionConfig.java +++ b/plugins/org.eclipse.emf.cdo.tests/src/org/eclipse/emf/cdo/tests/config/impl/SessionConfig.java @@ -10,12 +10,12 @@ */ package org.eclipse.emf.cdo.tests.config.impl; +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.cdo.session.CDOSessionConfiguration; import org.eclipse.emf.cdo.tests.config.IConfig; import org.eclipse.emf.cdo.tests.config.IRepositoryConfig; import org.eclipse.emf.cdo.tests.config.ISessionConfig; -import org.eclipse.emf.cdo.util.CDOUtil; import org.eclipse.emf.internal.cdo.session.CDOPackageTypeRegistryImpl; @@ -147,7 +147,7 @@ public abstract class SessionConfig extends Config implements ISessionConfig private CDOSessionConfiguration createSessionConfiguration(String repositoryName) { - CDOSessionConfiguration configuration = CDOUtil.createSessionConfiguration(); + CDOSessionConfiguration configuration = CDONet4jUtil.createSessionConfiguration(); configuration.setConnector(getConnector()); configuration.setRepositoryName(repositoryName); return configuration; diff --git a/plugins/org.eclipse.emf.cdo.ui/src/org/eclipse/emf/cdo/internal/ui/editor/CDOEditor.java b/plugins/org.eclipse.emf.cdo.ui/src/org/eclipse/emf/cdo/internal/ui/editor/CDOEditor.java index 361c7c9e08..849a059661 100644 --- a/plugins/org.eclipse.emf.cdo.ui/src/org/eclipse/emf/cdo/internal/ui/editor/CDOEditor.java +++ b/plugins/org.eclipse.emf.cdo.ui/src/org/eclipse/emf/cdo/internal/ui/editor/CDOEditor.java @@ -1791,7 +1791,7 @@ public class CDOEditor extends MultiPageEditorPart implements IEditingDomainProv { throw new UnsupportedOperationException(); - // CDOUtil.getResources(editingDomain.getResourceSet()).get(0).setURI(uri); + // CDONet4jUtil.getResources(editingDomain.getResourceSet()).get(0).setURI(uri); // setInputWithNotify(editorInput); // setPartName(editorInput.getName()); // IProgressMonitor progressMonitor = getActionBars().getStatusLineManager() != null ? getActionBars() diff --git a/plugins/org.eclipse.emf.cdo/.settings/.api_filters b/plugins/org.eclipse.emf.cdo/.settings/.api_filters index 860b4e2582..77aa9a2d76 100644 --- a/plugins/org.eclipse.emf.cdo/.settings/.api_filters +++ b/plugins/org.eclipse.emf.cdo/.settings/.api_filters @@ -27,7 +27,7 @@ </message_arguments> </filter> </resource> - <resource path="src/org/eclipse/emf/internal/cdo/CDOXATransactionCommitContext.java" type="org.eclipse.emf.internal.cdo.transaction.CDOXATransactionCommitContext"> + <resource path="src/org/eclipse/emf/internal/cdo/CDOXATransactionCommitContext.java" type="org.eclipse.emf.internal.cdo.transaction.CDOXACommitContextImpl"> <filter id="643846161"> <message_arguments> <message_argument value="CommitTransactionResult"/> diff --git a/plugins/org.eclipse.emf.cdo/META-INF/MANIFEST.MF b/plugins/org.eclipse.emf.cdo/META-INF/MANIFEST.MF index e16f3326eb..d02a8f8374 100644 --- a/plugins/org.eclipse.emf.cdo/META-INF/MANIFEST.MF +++ b/plugins/org.eclipse.emf.cdo/META-INF/MANIFEST.MF @@ -17,6 +17,7 @@ Export-Package: org.eclipse.emf.cdo;version="2.0.0", org.eclipse.emf.cdo.eresource.impl;version="2.0.0", org.eclipse.emf.cdo.eresource.util;version="2.0.0", org.eclipse.emf.cdo.eresource.validation;version="2.0.0", + org.eclipse.emf.cdo.net4j;version="2.0.0", org.eclipse.emf.cdo.session;version="2.0.0", org.eclipse.emf.cdo.session.remote;version="2.0.0", org.eclipse.emf.cdo.transaction;version="2.0.0", @@ -25,7 +26,8 @@ Export-Package: org.eclipse.emf.cdo;version="2.0.0", org.eclipse.emf.internal.cdo;version="2.0.0", org.eclipse.emf.internal.cdo.analyzer;version="2.0.0";x-friends:="org.eclipse.emf.cdo.tests,org.eclipse.emf.cdo.defs,org.eclipse.emf.cdo.ui", org.eclipse.emf.internal.cdo.bundle;version="2.0.0";x-friends:="org.eclipse.emf.cdo.ui", - org.eclipse.emf.internal.cdo.protocol;version="2.0.0";x-friends:="org.eclipse.emf.cdo.tests,org.eclipse.emf.cdo.defs,org.eclipse.emf.cdo.ui", + org.eclipse.emf.internal.cdo.net4j;version="2.0.0";x-friends:="org.eclipse.emf.cdo.tests,org.eclipse.emf.cdo.defs,org.eclipse.emf.cdo.ui", + org.eclipse.emf.internal.cdo.net4j.protocol;version="2.0.0";x-friends:="org.eclipse.emf.cdo.tests,org.eclipse.emf.cdo.defs,org.eclipse.emf.cdo.ui", org.eclipse.emf.internal.cdo.query;version="2.0.0";x-friends:="org.eclipse.emf.cdo.tests,org.eclipse.emf.cdo.defs,org.eclipse.emf.cdo.ui", org.eclipse.emf.internal.cdo.revision;version="2.0.0";x-friends:="org.eclipse.emf.cdo.tests,org.eclipse.emf.cdo.defs,org.eclipse.emf.cdo.ui", org.eclipse.emf.internal.cdo.session;version="2.0.0";x-friends:="org.eclipse.emf.cdo.tests,org.eclipse.emf.cdo.defs,org.eclipse.emf.cdo.ui", diff --git a/plugins/org.eclipse.emf.cdo/plugin.xml b/plugins/org.eclipse.emf.cdo/plugin.xml index b6cc94bd4a..fc053ab4bd 100644 --- a/plugins/org.eclipse.emf.cdo/plugin.xml +++ b/plugins/org.eclipse.emf.cdo/plugin.xml @@ -18,7 +18,7 @@ <extension point="org.eclipse.net4j.util.factories"> <factory - class="org.eclipse.emf.internal.cdo.protocol.CDOClientProtocolFactory" + class="org.eclipse.emf.internal.cdo.net4j.protocol.CDOClientProtocolFactory" productGroup="org.eclipse.net4j.clientProtocols" type="cdo"/> <factory @@ -30,7 +30,7 @@ <extension point="org.eclipse.net4j.util.elementProcessors"> <elementProcessor - class="org.eclipse.emf.internal.cdo.protocol.ChannelInjector"> + class="org.eclipse.emf.internal.cdo.net4j.protocol.ChannelInjector"> </elementProcessor> </extension> diff --git a/plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/cdo/net4j/CDONet4jUtil.java b/plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/cdo/net4j/CDONet4jUtil.java new file mode 100644 index 0000000000..8ba73209e7 --- /dev/null +++ b/plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/cdo/net4j/CDONet4jUtil.java @@ -0,0 +1,39 @@ +/*************************************************************************** + * Copyright (c) 2004 - 2008 Eike Stepper, Germany. + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * Eike Stepper - initial API and implementation + * Simon McDuff - maintenance + * Victor Roldan Betancort - maintenance + **************************************************************************/ +package org.eclipse.emf.cdo.net4j; + +import org.eclipse.emf.internal.cdo.net4j.CDONet4jSessionConfigurationImpl; +import org.eclipse.emf.internal.cdo.net4j.protocol.CDOClientProtocolFactory; + +import org.eclipse.net4j.util.container.IManagedContainer; + +/** + * @since 2.0 + * @author Eike Stepper + */ +public final class CDONet4jUtil +{ + private CDONet4jUtil() + { + } + + public static CDOSessionConfiguration createSessionConfiguration() + { + return new CDONet4jSessionConfigurationImpl(); + } + + public static void prepareContainer(IManagedContainer container) + { + container.registerFactory(new CDOClientProtocolFactory()); + } +} diff --git a/plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/cdo/net4j/CDOSession.java b/plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/cdo/net4j/CDOSession.java new file mode 100644 index 0000000000..4a03d4dc96 --- /dev/null +++ b/plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/cdo/net4j/CDOSession.java @@ -0,0 +1,44 @@ +/*************************************************************************** + * Copyright (c) 2004 - 2008 Eike Stepper, Germany. + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * Eike Stepper - initial API and implementation + * Simon McDuff - maintenance + * Victor Roldan Betancort - maintenance + **************************************************************************/ +package org.eclipse.emf.cdo.net4j; + +import org.eclipse.emf.cdo.common.CDOCommonSession; + +import org.eclipse.net4j.signal.ISignalProtocol; + +import org.eclipse.emf.spi.cdo.CDOSessionProtocol; + +/** + * @since 2.0 + * @author Eike Stepper + * @noimplement This interface is not intended to be implemented by clients. + */ +public interface CDOSession extends org.eclipse.emf.cdo.session.CDOSession +{ + /** + * Returns the {@link Options options} of this session. + */ + public Options options(); + + /** + * @author Eike Stepper + */ + public interface Options extends org.eclipse.emf.cdo.session.CDOSession.Options + { + /** + * Returns the Net4j {@link CDOSessionProtocol protocol} instance that represents the underlying + * <em>signalling connection</em> to the repository of this session. + */ + public ISignalProtocol<CDOCommonSession> getProtocol(); + } +} diff --git a/plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/cdo/net4j/CDOSessionConfiguration.java b/plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/cdo/net4j/CDOSessionConfiguration.java new file mode 100644 index 0000000000..816aa7d970 --- /dev/null +++ b/plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/cdo/net4j/CDOSessionConfiguration.java @@ -0,0 +1,46 @@ +/*************************************************************************** + * Copyright (c) 2004 - 2008 Eike Stepper, Germany. + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * Eike Stepper - initial API and implementation + **************************************************************************/ +package org.eclipse.emf.cdo.net4j; + +import org.eclipse.net4j.connector.IConnector; +import org.eclipse.net4j.signal.ISignalProtocol; +import org.eclipse.net4j.signal.failover.IFailOverStrategy; + +/** + * @author Eike Stepper + * @noimplement This interface is not intended to be implemented by clients. + */ +public interface CDOSessionConfiguration extends org.eclipse.emf.cdo.session.CDOSessionConfiguration +{ + /** + * @see CDOSession#open(ISignalProtocol) + */ + public IConnector getConnector(); + + /** + * @see CDOSession#open(ISignalProtocol) + */ + public void setConnector(IConnector connector); + + /** + * @see CDOSession#getFailOverStrategy() + */ + public IFailOverStrategy getFailOverStrategy(); + + /** + * The fail-over strategy must be set <b>before</b> the session is opened and can not be changed thereafter. + * + * @see CDOSession#getFailOverStrategy() + */ + public void setFailOverStrategy(IFailOverStrategy failOverStrategy); + + public CDOSession openSession(); +} 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 85d2570b26..44594226e8 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 @@ -54,22 +54,6 @@ import java.util.Collection; public interface CDOSession extends CDOCommonSession, IContainer<CDOView>, IOptionsContainer { /** - * Returns an instance of {@link Repository} that describes the model repository this {@link CDOSession session} is - * connected to. - * - * @since 2.0 - */ - public Repository repository(); - - /** - * Returns the Net4j {@link CDOSessionProtocol protocol} instance that represents the underlying - * <em>signalling connection</em> to the repository of this session. - * - * @since 2.0 - */ - public CDOSessionProtocol getProtocol(); - - /** * 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> @@ -172,6 +156,14 @@ public interface CDOSession extends CDOCommonSession, IContainer<CDOView>, IOpti public Options options(); /** + * Returns an instance of {@link Repository} that describes the model repository this {@link CDOSession session} is + * connected to. + * + * @since 2.0 + */ + public Repository repository(); + + /** * @author Simon McDuff * @since 2.0 */ @@ -207,7 +199,7 @@ public interface CDOSession extends CDOCommonSession, IContainer<CDOView>, IOpti * </ol> * Example: * <p> - * <code>CDOUtil.createCollectionLoadingPolicy(initialElements, subsequentElements);</code> + * <code>CDONet4jUtil.createCollectionLoadingPolicy(initialElements, subsequentElements);</code> * <p> * The user can also provide its own implementation of the CDOCollectionLoadingPolicy interface. */ 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 d6e09cae1f..1f7fe31a1a 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 @@ -14,10 +14,6 @@ import org.eclipse.emf.cdo.common.revision.cache.CDORevisionCache; import org.eclipse.emf.internal.cdo.session.CDORevisionManagerImpl; -import org.eclipse.net4j.connector.IConnector; -import org.eclipse.net4j.signal.ISignalProtocol; -import org.eclipse.net4j.signal.failover.IFailOverStrategy; - /** * @author Eike Stepper * @noimplement This interface is not intended to be implemented by clients. @@ -25,16 +21,6 @@ import org.eclipse.net4j.signal.failover.IFailOverStrategy; public interface CDOSessionConfiguration { /** - * @see CDOSession#open(ISignalProtocol) - */ - public IConnector getConnector(); - - /** - * @see CDOSession#open(ISignalProtocol) - */ - public void setConnector(IConnector connector); - - /** * @see CDOSession#getName() */ public String getRepositoryName(); @@ -45,18 +31,6 @@ public interface CDOSessionConfiguration public void setRepositoryName(String repositoryName); /** - * @see CDOSession#getFailOverStrategy() - */ - public IFailOverStrategy getFailOverStrategy(); - - /** - * The fail-over strategy must be set <b>before</b> the session is opened and can not be changed thereafter. - * - * @see CDOSession#getFailOverStrategy() - */ - public void setFailOverStrategy(IFailOverStrategy failOverStrategy); - - /** * @see CDOSession#getPackageRegistry() * @since 2.0 */ @@ -101,13 +75,13 @@ public interface CDOSessionConfiguration public void setRevisionCache(CDORevisionCache revisionCache); /** - * Opens the session for this configuration. Once the session is openend this method always returns the same session - * instance. Therefore it is impossible to change this configuration while the session is open. + * Returns <code>true</code> if the session for this configuration is currently open, <code>false</code> otherwise. */ - public CDOSession openSession(); + public boolean isSessionOpen(); /** - * Returns <code>true</code> if the session for this configuration is currently open, <code>false</code> otherwise. + * Opens the session for this configuration. Once the session is openend this method always returns the same session + * instance. Therefore it is impossible to change this configuration while the session is open. */ - public boolean isSessionOpen(); + public CDOSession openSession(); } diff --git a/plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/cdo/session/CDOSessionProtocol.java b/plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/cdo/session/CDOSessionProtocol.java deleted file mode 100644 index df6b466940..0000000000 --- a/plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/cdo/session/CDOSessionProtocol.java +++ /dev/null @@ -1,24 +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.CDOCommonSession; - -import org.eclipse.net4j.signal.ISignalProtocol; - -/** - * @author Eike Stepper - * @since 2.0 - */ -public interface CDOSessionProtocol extends ISignalProtocol<CDOCommonSession> -{ - public CDOSession getSession(); -} diff --git a/plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/cdo/session/remote/CDORemoteSession.java b/plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/cdo/session/remote/CDORemoteSession.java index 965f68b46c..690e6c2b73 100644 --- a/plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/cdo/session/remote/CDORemoteSession.java +++ b/plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/cdo/session/remote/CDORemoteSession.java @@ -10,7 +10,6 @@ */ package org.eclipse.emf.cdo.session.remote; - /** * @author Eike Stepper */ 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 8439bf0638..2fcb2ff08c 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 @@ -15,10 +15,11 @@ package org.eclipse.emf.cdo.util; 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.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.session.CDOSessionConfiguration; import org.eclipse.emf.cdo.transaction.CDOTransaction; import org.eclipse.emf.cdo.transaction.CDOXATransaction; import org.eclipse.emf.cdo.view.CDORevisionPrefetchingPolicy; @@ -26,10 +27,8 @@ import org.eclipse.emf.cdo.view.CDOView; import org.eclipse.emf.cdo.view.CDOViewSet; import org.eclipse.emf.internal.cdo.CDOStateMachine; -import org.eclipse.emf.internal.cdo.protocol.CDOClientProtocolFactory; import org.eclipse.emf.internal.cdo.session.CDOCollectionLoadingPolicyImpl; import org.eclipse.emf.internal.cdo.session.CDOPackageRegistryImpl; -import org.eclipse.emf.internal.cdo.session.CDOSessionConfigurationImpl; import org.eclipse.emf.internal.cdo.transaction.CDOXATransactionImpl; import org.eclipse.emf.internal.cdo.util.FSMUtil; import org.eclipse.emf.internal.cdo.view.CDORevisionPrefetchingPolicyImpl; @@ -39,15 +38,9 @@ import org.eclipse.net4j.util.container.IManagedContainer; import org.eclipse.emf.common.notify.Adapter; import org.eclipse.emf.common.util.BasicEList; import org.eclipse.emf.common.util.EList; -import org.eclipse.emf.ecore.EAttribute; -import org.eclipse.emf.ecore.EClass; -import org.eclipse.emf.ecore.EClassifier; import org.eclipse.emf.ecore.EGenericType; import org.eclipse.emf.ecore.EModelElement; import org.eclipse.emf.ecore.EObject; -import org.eclipse.emf.ecore.EPackage; -import org.eclipse.emf.ecore.EReference; -import org.eclipse.emf.ecore.EcoreFactory; import org.eclipse.emf.ecore.InternalEObject; import org.eclipse.emf.ecore.impl.EStringToStringMapEntryImpl; import org.eclipse.emf.ecore.resource.Resource; @@ -68,7 +61,14 @@ public final class CDOUtil public static CDOSessionConfiguration createSessionConfiguration() { - return new CDOSessionConfigurationImpl(); + // TODO Remove before release + return CDONet4jUtil.createSessionConfiguration(); + } + + public static void prepareContainer(IManagedContainer container) + { + // TODO Remove before release + CDONet4jUtil.prepareContainer(container); } /** @@ -169,54 +169,6 @@ public final class CDOUtil return null; } - /** - * @since 2.0 - */ - public static void prepareContainer(IManagedContainer container) - { - container.registerFactory(new CDOClientProtocolFactory()); - } - - 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; - } - - 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; - } - - 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; - } - - 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 void load(EObject eObject, CDOView view) { InternalCDOObject cdoObject = FSMUtil.adapt(eObject, view); 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 index fa7c68c42d..9aa497690f 100644 --- 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 @@ -19,12 +19,14 @@ 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; @@ -56,6 +58,46 @@ public final class EMFUtil { } + 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; + } + + 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; + } + + 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; + } + + 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(); diff --git a/plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/cdo/view/CDOConflictResolver.java b/plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/cdo/view/CDOConflictResolver.java index 7da0aeb9f4..f5302d24e0 100644 --- a/plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/cdo/view/CDOConflictResolver.java +++ b/plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/cdo/view/CDOConflictResolver.java @@ -13,7 +13,7 @@ package org.eclipse.emf.cdo.view; import org.eclipse.emf.cdo.CDOObject; import org.eclipse.emf.cdo.transaction.CDOTransaction; -import org.eclipse.emf.spi.cdo.CDOObjectConflictResolver; +import org.eclipse.emf.spi.cdo.AbstractObjectConflictResolver; import java.util.Set; @@ -39,7 +39,7 @@ public interface CDOConflictResolver /** * Resolves conflicts after remote invalidations arrived for objects that are locally dirty or detached. * <p> - * The implementor might want to use/extend {@link CDOObjectConflictResolver}. + * The implementor might want to use/extend {@link AbstractObjectConflictResolver}. */ public void resolveConflicts(Set<CDOObject> conflicts); } diff --git a/plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/cdo/view/CDOView.java b/plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/cdo/view/CDOView.java index b4f4fc5940..2d729e02e8 100644 --- a/plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/cdo/view/CDOView.java +++ b/plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/cdo/view/CDOView.java @@ -418,7 +418,7 @@ public interface CDOView extends CDOCommonView, INotifier, IOptionsContainer * subtle. The CDOCollectionLoadingPolicy feature determines how and when to fetch CDOIDs, while the * CDORevisionPrefetchingPolicy feature determines how and when to resolve CDOIDs (i.e. fetch the target objects). * <p> - * <code>view.options().setRevisionPrefetchingPolicy (CDOUtil.createRevisionPrefetchingPolicy(10));</code> + * <code>view.options().setRevisionPrefetchingPolicy (CDONet4jUtil.createRevisionPrefetchingPolicy(10));</code> * <p> * The end-user could provide its own implementation of the CDORevisionPrefetchingPolicy interface. */ 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 b4a68a7665..920ddf4791 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 @@ -18,16 +18,12 @@ 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; -import org.eclipse.emf.cdo.common.util.TransportException; import org.eclipse.emf.cdo.spi.common.revision.InternalCDORevision; import org.eclipse.emf.cdo.transaction.CDOTransaction; import org.eclipse.emf.cdo.util.InvalidObjectException; import org.eclipse.emf.cdo.view.CDOView; import org.eclipse.emf.internal.cdo.bundle.OM; -import org.eclipse.emf.internal.cdo.protocol.CDOClientProtocol; -import org.eclipse.emf.internal.cdo.protocol.CommitTransactionResult; -import org.eclipse.emf.internal.cdo.protocol.VerifyRevisionRequest; import org.eclipse.emf.internal.cdo.session.CDORevisionManagerImpl; import org.eclipse.emf.internal.cdo.util.FSMUtil; @@ -41,8 +37,10 @@ import org.eclipse.emf.ecore.InternalEObject; import org.eclipse.emf.ecore.impl.EStoreEObjectImpl; import org.eclipse.emf.ecore.resource.Resource; import org.eclipse.emf.spi.cdo.InternalCDOObject; +import org.eclipse.emf.spi.cdo.InternalCDOSession; import org.eclipse.emf.spi.cdo.InternalCDOTransaction; import org.eclipse.emf.spi.cdo.InternalCDOView; +import org.eclipse.emf.spi.cdo.CDOSessionProtocol.CommitTransactionResult; import java.util.ArrayList; import java.util.HashMap; @@ -308,15 +306,8 @@ public final class CDOStateMachine extends FiniteStateMachine<CDOState, CDOEvent if (view != null) { - try - { - CDOClientProtocol protocol = (CDOClientProtocol)view.getSession().getProtocol(); - revisions = new VerifyRevisionRequest(protocol, revisions).send(); - } - catch (Exception ex) - { - throw new TransportException(ex); - } + InternalCDOSession session = (InternalCDOSession)view.getSession(); + revisions = session.getSessionProtocol().verifyRevision(revisions); revisions.addAll(revised); for (InternalCDORevision revision : revisions) diff --git a/plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/internal/cdo/net4j/CDONet4jSessionConfigurationImpl.java b/plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/internal/cdo/net4j/CDONet4jSessionConfigurationImpl.java new file mode 100644 index 0000000000..5e0e1d2c4c --- /dev/null +++ b/plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/internal/cdo/net4j/CDONet4jSessionConfigurationImpl.java @@ -0,0 +1,82 @@ +/*************************************************************************** + * Copyright (c) 2004 - 2008 Eike Stepper, Germany. + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * Eike Stepper - initial API and implementation + **************************************************************************/ +package org.eclipse.emf.internal.cdo.net4j; + +import org.eclipse.emf.internal.cdo.session.CDOSessionConfigurationImpl; + +import org.eclipse.net4j.connector.IConnector; +import org.eclipse.net4j.signal.failover.IFailOverStrategy; +import org.eclipse.net4j.signal.failover.NOOPFailOverStrategy; +import org.eclipse.net4j.util.CheckUtil; + +import org.eclipse.emf.spi.cdo.InternalCDOSession; + +/** + * @author Eike Stepper + */ +public class CDONet4jSessionConfigurationImpl extends CDOSessionConfigurationImpl implements + org.eclipse.emf.cdo.net4j.CDOSessionConfiguration +{ + private IConnector connector; + + private IFailOverStrategy failOverStrategy; + + public CDONet4jSessionConfigurationImpl() + { + } + + public IConnector getConnector() + { + return connector; + } + + public void setConnector(IConnector connector) + { + checkNotOpen(); + this.connector = connector; + } + + public IFailOverStrategy getFailOverStrategy() + { + return failOverStrategy; + } + + public void setFailOverStrategy(IFailOverStrategy failOverStrategy) + { + checkNotOpen(); + this.failOverStrategy = failOverStrategy; + } + + @Override + public org.eclipse.emf.cdo.net4j.CDOSession openSession() + { + return (org.eclipse.emf.cdo.net4j.CDOSession)super.openSession(); + } + + @Override + protected InternalCDOSession createSession() + { + CheckUtil.checkState(connector != null ^ failOverStrategy != null, + "Specify exactly one of connector or failOverStrategy"); + + CDONet4jSessionImpl session = new CDONet4jSessionImpl(); + if (connector != null) + { + session.options().getProtocol().setFailOverStrategy(new NOOPFailOverStrategy(connector)); + } + else + { + session.options().getProtocol().setFailOverStrategy(failOverStrategy); + } + + return session; + } +} 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 new file mode 100644 index 0000000000..c5ad6ee46c --- /dev/null +++ b/plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/internal/cdo/net4j/CDONet4jSessionFactory.java @@ -0,0 +1,60 @@ +/*************************************************************************** + * Copyright (c) 2004 - 2008 Eike Stepper, Germany. + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * Eike Stepper - initial API and implementation + **************************************************************************/ +package org.eclipse.emf.internal.cdo.net4j; + +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.signal.failover.IFailOverStrategy; +import org.eclipse.net4j.util.container.IManagedContainer; + +import org.eclipse.emf.spi.cdo.InternalCDOSession; + +/** + * @author Eike Stepper + */ +public class CDONet4jSessionFactory extends CDOSessionFactory +{ + + public static final String TYPE = "cdo"; + + public CDONet4jSessionFactory() + { + super(TYPE); + } + + public static CDOSession get(IManagedContainer container, String description) + { + return (CDOSession)container.getElement(PRODUCT_GROUP, TYPE, description); + } + + /** + * @since 2.0 + */ + @Override + protected InternalCDOSession createSession(String repositoryName, boolean automaticPackageRegistry, + IFailOverStrategy failOverStrategy) + { + CDOSessionConfiguration configuration = CDONet4jUtil.createSessionConfiguration(); + configuration.setRepositoryName(repositoryName); + configuration.setFailOverStrategy(failOverStrategy); + 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/CDONet4jSessionImpl.java b/plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/internal/cdo/net4j/CDONet4jSessionImpl.java new file mode 100644 index 0000000000..c5885038bd --- /dev/null +++ b/plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/internal/cdo/net4j/CDONet4jSessionImpl.java @@ -0,0 +1,110 @@ +/*************************************************************************** + * Copyright (c) 2004 - 2008 Eike Stepper, Germany. + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * Eike Stepper - initial API and implementation + * Simon McDuff - http://bugs.eclipse.org/226778 + * Simon McDuff - http://bugs.eclipse.org/230832 + * Simon McDuff - http://bugs.eclipse.org/233490 + * Simon McDuff - http://bugs.eclipse.org/213402 + * Victor Roldan Betancort - maintenance + **************************************************************************/ +package org.eclipse.emf.internal.cdo.net4j; + +import org.eclipse.emf.internal.cdo.net4j.protocol.CDOClientProtocol; +import org.eclipse.emf.internal.cdo.session.CDOSessionImpl; + +import org.eclipse.net4j.channel.IChannel; +import org.eclipse.net4j.util.ReflectUtil.ExcludeFromDump; +import org.eclipse.net4j.util.event.EventUtil; +import org.eclipse.net4j.util.event.IListener; +import org.eclipse.net4j.util.lifecycle.ILifecycle; +import org.eclipse.net4j.util.lifecycle.LifecycleEventAdapter; + +import org.eclipse.emf.spi.cdo.CDOSessionProtocol; + +/** + * @author Eike Stepper + */ +public class CDONet4jSessionImpl extends CDOSessionImpl implements org.eclipse.emf.cdo.net4j.CDOSession +{ + private CDOClientProtocol protocol; + + @ExcludeFromDump + private IListener protocolListener = new LifecycleEventAdapter() + { + @Override + protected void onDeactivated(ILifecycle lifecycle) + { + close(); + } + }; + + public CDONet4jSessionImpl() + { + protocol = new CDOClientProtocol(); + protocol.setInfraStructure(this); + } + + public CDOSessionProtocol getSessionProtocol() + { + return protocol; + } + + /** + * @since 2.0 + */ + public String getUserID() + { + IChannel channel = protocol.getChannel(); + return channel == null ? null : channel.getUserID(); + } + + @Override + public OptionsImpl options() + { + return (OptionsImpl)super.options(); + } + + @Override + protected OptionsImpl createOptions() + { + return new OptionsImpl(); + } + + @Override + protected void doActivate() throws Exception + { + super.doActivate(); + EventUtil.addListener(protocol, protocolListener); + } + + @Override + protected void doDeactivate() throws Exception + { + EventUtil.removeListener(protocol, protocolListener); + super.doDeactivate(); + protocol.close(); + protocol = null; + } + + /** + * @author Eike Stepper + */ + protected class OptionsImpl extends org.eclipse.emf.internal.cdo.session.CDOSessionImpl.OptionsImpl implements + org.eclipse.emf.cdo.net4j.CDOSession.Options + { + public OptionsImpl() + { + } + + public CDOClientProtocol getProtocol() + { + return protocol; + } + } +} diff --git a/plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/internal/cdo/protocol/CDOClientIndication.java b/plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/internal/cdo/net4j/protocol/CDOClientIndication.java index fe2a4c236c..3a2654d8de 100644 --- a/plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/internal/cdo/protocol/CDOClientIndication.java +++ b/plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/internal/cdo/net4j/protocol/CDOClientIndication.java @@ -1,5 +1,5 @@ -/** - * Copyright (c) 2004 - 2009 Eike Stepper (Berlin, Germany) and others. +/*************************************************************************** + * Copyright (c) 2004 - 2008 Eike Stepper, Germany. * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v1.0 * which accompanies this distribution, and is available at @@ -8,8 +8,8 @@ * Contributors: * Eike Stepper - initial API and implementation * Simon McDuff - http://bugs.eclipse.org/233490 - */ -package org.eclipse.emf.internal.cdo.protocol; + **************************************************************************/ +package org.eclipse.emf.internal.cdo.net4j.protocol; import org.eclipse.emf.cdo.common.id.CDOIDObjectFactory; import org.eclipse.emf.cdo.common.io.CDODataInput; 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 new file mode 100644 index 0000000000..356cfa8bde --- /dev/null +++ b/plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/internal/cdo/net4j/protocol/CDOClientProtocol.java @@ -0,0 +1,300 @@ +/*************************************************************************** + * Copyright (c) 2004 - 2008 Eike Stepper, Germany. + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * Eike Stepper - initial API and implementation + **************************************************************************/ +package org.eclipse.emf.internal.cdo.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.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.spi.common.revision.InternalCDORevision; +import org.eclipse.emf.cdo.transaction.CDOTimeStampContext; +import org.eclipse.emf.cdo.view.CDOView; + +import org.eclipse.emf.internal.cdo.bundle.OM; +import org.eclipse.emf.internal.cdo.session.CDORevisionManagerImpl; + +import org.eclipse.net4j.signal.RemoteException; +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.om.monitor.OMMonitor; +import org.eclipse.net4j.util.om.trace.PerfTracer; + +import org.eclipse.emf.spi.cdo.AbstractQueryIterator; +import org.eclipse.emf.spi.cdo.CDOSessionProtocol; +import org.eclipse.emf.spi.cdo.InternalCDOObject; +import org.eclipse.emf.spi.cdo.InternalCDOTransaction.InternalCDOCommitContext; +import org.eclipse.emf.spi.cdo.InternalCDOXATransaction.InternalCDOXACommitContext; + +import java.io.File; +import java.util.Collection; +import java.util.List; +import java.util.Map; +import java.util.Set; + +/** + * @author Eike Stepper + */ +public class CDOClientProtocol extends CDOProtocolImpl implements CDOSessionProtocol +{ + private static final PerfTracer REVISION_LOADING = new PerfTracer(OM.PERF_REVISION_LOADING, + CDORevisionManagerImpl.class); + + public CDOClientProtocol() + { + } + + @Override + public CDOSession getSession() + { + return (CDOSession)super.getSession(); + } + + public OpenSessionResult openSession(String repositoryName, boolean passiveUpdateEnabled) + { + open(); + return send(new OpenSessionRequest(this, repositoryName, passiveUpdateEnabled)); + } + + public void loadLibraries(Set<String> missingLibraries, File cacheFolder) + { + send(new LoadLibrariesRequest(this, missingLibraries, cacheFolder)); + } + + public void setPassiveUpdate(Map<CDOID, CDORevision> allRevisions, int initialChunkSize, boolean passiveUpdateEnabled) + { + send(new SetPassiveUpdateRequest(this, allRevisions, initialChunkSize, passiveUpdateEnabled)); + } + + public RepositoryTimeResult getRepositoryTime() + { + return send(new RepositoryTimeRequest(this)); + } + + public void loadPackage(CDOPackage cdoPackage, boolean onlyEcore) + { + send(new LoadPackageRequest(this, cdoPackage, onlyEcore)); + } + + public Object loadChunk(InternalCDORevision revision, CDOFeature feature, int accessIndex, int fetchIndex, + int fromIndex, int toIndex) + { + return send(new LoadChunkRequest(this, revision, feature, accessIndex, fetchIndex, fromIndex, toIndex)); + } + + public List<InternalCDORevision> loadRevisions(Collection<CDOID> ids, int referenceChunk) + { + return send(new LoadRevisionRequest(this, ids, referenceChunk)); + } + + public List<InternalCDORevision> loadRevisionsByTime(Collection<CDOID> ids, int referenceChunk, long timeStamp) + { + return send(new LoadRevisionByTimeRequest(this, ids, referenceChunk, timeStamp)); + } + + public InternalCDORevision loadRevisionByVersion(CDOID id, int referenceChunk, int version) + { + return send(new LoadRevisionByVersionRequest(this, id, referenceChunk, version)).get(0); + } + + public List<InternalCDORevision> verifyRevision(List<InternalCDORevision> revisions) throws TransportException + { + return send(new VerifyRevisionRequest(this, revisions)); + } + + public Collection<CDOTimeStampContext> syncRevisions(Map<CDOID, CDORevision> allRevisions, int initialChunkSize) + { + return send(new SyncRevisionsRequest(this, allRevisions, initialChunkSize)); + } + + public void openView(int viewId, byte protocolViewType, long timeStamp) + { + send(new ViewsChangedRequest(this, viewId, protocolViewType, timeStamp)); + } + + public void closeView(int viewId) + { + send(new ViewsChangedRequest(this, viewId)); + } + + public boolean[] setAudit(int viewId, long timeStamp, List<InternalCDOObject> invalidObjects) + { + return send(new SetAuditRequest(this, viewId, timeStamp, invalidObjects)); + } + + public void changeSubscription(int viewId, List<CDOID> cdoIDs, boolean subscribeMode, boolean clear) + { + send(new ChangeSubscriptionRequest(this, viewId, cdoIDs, subscribeMode, clear)); + } + + public List<Object> query(int viewID, AbstractQueryIterator<?> queryResult) + { + return send(new QueryRequest(this, viewID, queryResult)); + } + + public boolean cancelQuery(int queryId) + { + try + { + return new QueryCancelRequest(this, queryId).send(); + } + catch (Exception ignore) + { + return false; + } + } + + public void lockObjects(CDOView view, Collection<? extends CDOObject> objects, long timeout, LockType lockType) + throws InterruptedException + { + InterruptedException interruptedException = null; + RuntimeException runtimeException = null; + + try + { + new LockObjectsRequest(this, view, objects, timeout, lockType).send(); + } + catch (RemoteException ex) + { + if (ex.getCause() instanceof RuntimeException) + { + runtimeException = (RuntimeException)ex.getCause(); + } + else if (ex.getCause() instanceof InterruptedException) + { + interruptedException = (InterruptedException)ex.getCause(); + } + } + catch (Exception ex) + { + throw WrappedException.wrap(ex); + } + + if (interruptedException != null) + { + throw interruptedException; + } + + if (runtimeException != null) + { + throw runtimeException; + } + } + + public void unlockObjects(CDOView view, Collection<? extends CDOObject> objects, LockType lockType) + { + send(new UnlockObjectsRequest(this, view, objects, lockType)); + } + + public boolean isObjectLocked(CDOView view, CDOObject object, LockType lockType) + { + return send(new ObjectLockedRequest(this, view, object, lockType)); + } + + public CommitTransactionResult commitTransaction(InternalCDOCommitContext commitContext, OMMonitor monitor) + { + return send(new CommitTransactionRequest(this, commitContext), monitor); + } + + public CommitTransactionResult commitTransactionPhase1(InternalCDOXACommitContext xaContext, OMMonitor monitor) + { + return send(new CommitTransactionPhase1Request(this, xaContext), monitor); + } + + public CommitTransactionResult commitTransactionPhase2(InternalCDOXACommitContext xaContext, OMMonitor monitor) + { + return send(new CommitTransactionPhase2Request(this, xaContext), monitor); + } + + public CommitTransactionResult commitTransactionPhase3(InternalCDOXACommitContext xaContext, OMMonitor monitor) + { + return send(new CommitTransactionPhase3Request(this, xaContext), monitor); + } + + public CommitTransactionResult commitTransactionCancel(InternalCDOXACommitContext xaContext, OMMonitor monitor) + { + return send(new CommitTransactionCancelRequest(this, xaContext), monitor); + } + + @Override + protected SignalReactor createSignalReactor(short signalID) + { + switch (signalID) + { + case CDOProtocolConstants.SIGNAL_COMMIT_NOTIFICATION: + return new CommitNotificationIndication(this); + + default: + return super.createSignalReactor(signalID); + } + } + + @Override + protected void doBeforeActivate() throws Exception + { + super.doBeforeActivate(); + if (!(getInfraStructure() instanceof CDOSession)) + { + throw new IllegalStateException("No session"); + } + } + + private <RESULT> RESULT send(RequestWithConfirmation<RESULT> request) + { + try + { + return request.send(); + } + catch (RuntimeException ex) + { + throw ex; + } + catch (Exception ex) + { + throw new TransportException(ex); + } + } + + private CommitTransactionResult send(CommitTransactionRequest request, OMMonitor monitor) + { + try + { + return request.send(monitor); + } + catch (RuntimeException ex) + { + throw ex; + } + catch (Exception ex) + { + throw new TransportException(ex); + } + } + + private List<InternalCDORevision> send(LoadRevisionRequest request) + { + try + { + REVISION_LOADING.start(request); + return send((RequestWithConfirmation<List<InternalCDORevision>>)request); + } + finally + { + REVISION_LOADING.stop(request); + } + } +} diff --git a/plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/internal/cdo/protocol/CDOClientProtocolFactory.java b/plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/internal/cdo/net4j/protocol/CDOClientProtocolFactory.java index 430d4a85d8..880c15fe1a 100644 --- a/plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/internal/cdo/protocol/CDOClientProtocolFactory.java +++ b/plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/internal/cdo/net4j/protocol/CDOClientProtocolFactory.java @@ -1,5 +1,5 @@ -/** - * Copyright (c) 2004 - 2009 Eike Stepper (Berlin, Germany) and others. +/*************************************************************************** + * Copyright (c) 2004 - 2008 Eike Stepper, Germany. * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v1.0 * which accompanies this distribution, and is available at @@ -7,8 +7,8 @@ * * Contributors: * Eike Stepper - initial API and implementation - */ -package org.eclipse.emf.internal.cdo.protocol; + **************************************************************************/ +package org.eclipse.emf.internal.cdo.net4j.protocol; import org.eclipse.emf.cdo.common.protocol.CDOProtocolConstants; diff --git a/plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/internal/cdo/protocol/CDOClientRequest.java b/plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/internal/cdo/net4j/protocol/CDOClientRequest.java index 0daefeae86..77e01b426f 100644 --- a/plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/internal/cdo/protocol/CDOClientRequest.java +++ b/plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/internal/cdo/net4j/protocol/CDOClientRequest.java @@ -1,5 +1,5 @@ -/** - * Copyright (c) 2004 - 2009 Eike Stepper (Berlin, Germany) and others. +/*************************************************************************** + * Copyright (c) 2004 - 2008 Eike Stepper, Germany. * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v1.0 * which accompanies this distribution, and is available at @@ -8,8 +8,8 @@ * Contributors: * Eike Stepper - initial API and implementation * Simon McDuff - maintenance - */ -package org.eclipse.emf.internal.cdo.protocol; + **************************************************************************/ +package org.eclipse.emf.internal.cdo.net4j.protocol; import org.eclipse.emf.cdo.common.id.CDOIDObjectFactory; import org.eclipse.emf.cdo.common.id.CDOIDProvider; diff --git a/plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/internal/cdo/protocol/CDOTimeRequest.java b/plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/internal/cdo/net4j/protocol/CDOTimeRequest.java index 8d3a7be7a7..3430f4a36a 100644 --- a/plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/internal/cdo/protocol/CDOTimeRequest.java +++ b/plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/internal/cdo/net4j/protocol/CDOTimeRequest.java @@ -1,5 +1,5 @@ -/** - * Copyright (c) 2004 - 2009 Eike Stepper (Berlin, Germany) and others. +/*************************************************************************** + * Copyright (c) 2004 - 2008 Eike Stepper, Germany. * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v1.0 * which accompanies this distribution, and is available at @@ -7,8 +7,8 @@ * * Contributors: * Eike Stepper - initial API and implementation - */ -package org.eclipse.emf.internal.cdo.protocol; + **************************************************************************/ +package org.eclipse.emf.internal.cdo.net4j.protocol; import org.eclipse.emf.cdo.common.io.CDODataInput; import org.eclipse.emf.cdo.common.io.CDODataOutput; @@ -17,6 +17,8 @@ import org.eclipse.emf.internal.cdo.bundle.OM; import org.eclipse.net4j.util.om.trace.ContextTracer; +import org.eclipse.emf.spi.cdo.CDOSessionProtocol.RepositoryTimeResult; + import java.io.IOException; /** diff --git a/plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/internal/cdo/protocol/ChangeSubscriptionRequest.java b/plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/internal/cdo/net4j/protocol/ChangeSubscriptionRequest.java index 3650f16893..278ec61fa6 100644 --- a/plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/internal/cdo/protocol/ChangeSubscriptionRequest.java +++ b/plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/internal/cdo/net4j/protocol/ChangeSubscriptionRequest.java @@ -1,5 +1,5 @@ -/** - * Copyright (c) 2004 - 2009 Eike Stepper (Berlin, Germany) and others. +/*************************************************************************** + * Copyright (c) 2004 - 2008 Eike Stepper, Germany. * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v1.0 * which accompanies this distribution, and is available at @@ -9,8 +9,8 @@ * Simon McDuff - initial API and implementation * Simon McDuff - http://bugs.eclipse.org/230832 * Eike Stepper - maintenance - */ -package org.eclipse.emf.internal.cdo.protocol; + **************************************************************************/ +package org.eclipse.emf.internal.cdo.net4j.protocol; import org.eclipse.emf.cdo.common.id.CDOID; import org.eclipse.emf.cdo.common.io.CDODataInput; diff --git a/plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/internal/cdo/protocol/ChannelInjector.java b/plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/internal/cdo/net4j/protocol/ChannelInjector.java index a48f70ca3d..7122afa7e7 100644 --- a/plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/internal/cdo/protocol/ChannelInjector.java +++ b/plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/internal/cdo/net4j/protocol/ChannelInjector.java @@ -1,5 +1,5 @@ -/** - * Copyright (c) 2004 - 2009 Eike Stepper (Berlin, Germany) and others. +/*************************************************************************** + * Copyright (c) 2004 - 2008 Eike Stepper, Germany. * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v1.0 * which accompanies this distribution, and is available at @@ -7,10 +7,8 @@ * * Contributors: * Eike Stepper - initial API and implementation - */ -package org.eclipse.emf.internal.cdo.protocol; - -import org.eclipse.emf.cdo.session.CDOSession; + **************************************************************************/ +package org.eclipse.emf.internal.cdo.net4j.protocol; import org.eclipse.net4j.connector.IConnector; import org.eclipse.net4j.signal.failover.NOOPFailOverStrategy; @@ -34,10 +32,10 @@ public class ChannelInjector implements IElementProcessor public Object process(IManagedContainer container, String productGroup, String factoryType, String description, Object element) { - if (element instanceof CDOSession) + if (element instanceof org.eclipse.emf.cdo.net4j.CDOSession) { - CDOSession session = (CDOSession)element; - session.getProtocol().setFailOverStrategy(new NOOPFailOverStrategy(getConnector(container, description))); + NOOPFailOverStrategy failOverStrategy = new NOOPFailOverStrategy(getConnector(container, description)); + ((org.eclipse.emf.cdo.net4j.CDOSession)element).options().getProtocol().setFailOverStrategy(failOverStrategy); } return element; diff --git a/plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/internal/cdo/protocol/CommitNotificationIndication.java b/plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/internal/cdo/net4j/protocol/CommitNotificationIndication.java index 0a3b2ee59b..6eeff83345 100644 --- a/plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/internal/cdo/protocol/CommitNotificationIndication.java +++ b/plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/internal/cdo/net4j/protocol/CommitNotificationIndication.java @@ -1,5 +1,5 @@ -/** - * Copyright (c) 2004 - 2009 Eike Stepper (Berlin, Germany) and others. +/*************************************************************************** + * Copyright (c) 2004 - 2008 Eike Stepper, Germany. * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v1.0 * which accompanies this distribution, and is available at @@ -8,8 +8,8 @@ * Contributors: * Eike Stepper - initial API and implementation * Simon McDuff - http://bugs.eclipse.org/233490 - */ -package org.eclipse.emf.internal.cdo.protocol; + **************************************************************************/ +package org.eclipse.emf.internal.cdo.net4j.protocol; import org.eclipse.emf.cdo.common.id.CDOID; import org.eclipse.emf.cdo.common.id.CDOIDAndVersion; diff --git a/plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/internal/cdo/protocol/CommitTransactionCancelRequest.java b/plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/internal/cdo/net4j/protocol/CommitTransactionCancelRequest.java index 33cb859f54..87313f3257 100644 --- a/plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/internal/cdo/protocol/CommitTransactionCancelRequest.java +++ b/plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/internal/cdo/net4j/protocol/CommitTransactionCancelRequest.java @@ -1,5 +1,5 @@ -/** - * Copyright (c) 2004 - 2009 Eike Stepper (Berlin, Germany) and others. +/*************************************************************************** + * Copyright (c) 2004 - 2008 Eike Stepper, Germany. * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v1.0 * which accompanies this distribution, and is available at @@ -7,19 +7,19 @@ * * Contributors: * Simon McDuff - initial API and implementation - * Eike Stepper - maintenance - */ -package org.eclipse.emf.internal.cdo.protocol; + **************************************************************************/ +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.protocol.CDOProtocolConstants; import org.eclipse.emf.cdo.transaction.CDOTransaction; -import org.eclipse.emf.internal.cdo.transaction.CDOXATransactionCommitContext; - import org.eclipse.net4j.util.om.monitor.OMMonitor; +import org.eclipse.emf.spi.cdo.CDOSessionProtocol.CommitTransactionResult; +import org.eclipse.emf.spi.cdo.InternalCDOXATransaction.InternalCDOXACommitContext; + import java.io.IOException; /** @@ -33,7 +33,7 @@ import java.io.IOException; */ public class CommitTransactionCancelRequest extends CommitTransactionRequest { - public CommitTransactionCancelRequest(CDOClientProtocol protocol, CDOXATransactionCommitContext xaContext) + public CommitTransactionCancelRequest(CDOClientProtocol protocol, InternalCDOXACommitContext xaContext) { super(protocol, CDOProtocolConstants.SIGNAL_COMMIT_TRANSACTION_CANCEL, xaContext); } diff --git a/plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/internal/cdo/protocol/CommitTransactionPhase1Request.java b/plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/internal/cdo/net4j/protocol/CommitTransactionPhase1Request.java index b6a3c8925d..904ebb7c2c 100644 --- a/plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/internal/cdo/protocol/CommitTransactionPhase1Request.java +++ b/plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/internal/cdo/net4j/protocol/CommitTransactionPhase1Request.java @@ -1,5 +1,5 @@ -/** - * Copyright (c) 2004 - 2009 Eike Stepper (Berlin, Germany) and others. +/*************************************************************************** + * Copyright (c) 2004 - 2008 Eike Stepper, Germany. * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v1.0 * which accompanies this distribution, and is available at @@ -7,19 +7,19 @@ * * Contributors: * Simon McDuff - initial API and implementation - * Eike Stepper - maintenance - */ -package org.eclipse.emf.internal.cdo.protocol; + **************************************************************************/ +package org.eclipse.emf.internal.cdo.net4j.protocol; import org.eclipse.emf.cdo.common.id.CDOIDProvider; import org.eclipse.emf.cdo.common.io.CDODataInput; import org.eclipse.emf.cdo.common.protocol.CDOProtocolConstants; import org.eclipse.emf.cdo.transaction.CDOTransaction; -import org.eclipse.emf.internal.cdo.transaction.CDOXATransactionCommitContext; - import org.eclipse.net4j.util.om.monitor.OMMonitor; +import org.eclipse.emf.spi.cdo.CDOSessionProtocol.CommitTransactionResult; +import org.eclipse.emf.spi.cdo.InternalCDOXATransaction.InternalCDOXACommitContext; + import java.io.IOException; /** @@ -32,7 +32,7 @@ import java.io.IOException; */ public class CommitTransactionPhase1Request extends CommitTransactionRequest { - public CommitTransactionPhase1Request(CDOClientProtocol protocol, CDOXATransactionCommitContext xaContext) + public CommitTransactionPhase1Request(CDOClientProtocol protocol, InternalCDOXACommitContext xaContext) { super(protocol, CDOProtocolConstants.SIGNAL_COMMIT_TRANSACTION_PHASE1, xaContext); } diff --git a/plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/internal/cdo/protocol/CommitTransactionPhase2Request.java b/plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/internal/cdo/net4j/protocol/CommitTransactionPhase2Request.java index afba8cade1..37c295dd97 100644 --- a/plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/internal/cdo/protocol/CommitTransactionPhase2Request.java +++ b/plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/internal/cdo/net4j/protocol/CommitTransactionPhase2Request.java @@ -1,5 +1,5 @@ -/** - * Copyright (c) 2004 - 2009 Eike Stepper (Berlin, Germany) and others. +/*************************************************************************** + * Copyright (c) 2004 - 2008 Eike Stepper, Germany. * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v1.0 * which accompanies this distribution, and is available at @@ -7,9 +7,8 @@ * * Contributors: * Simon McDuff - initial API and implementation - * Eike Stepper - maintenance - */ -package org.eclipse.emf.internal.cdo.protocol; + **************************************************************************/ +package org.eclipse.emf.internal.cdo.net4j.protocol; import org.eclipse.emf.cdo.common.id.CDOID; import org.eclipse.emf.cdo.common.id.CDOIDUtil; @@ -20,13 +19,14 @@ import org.eclipse.emf.cdo.internal.common.id.CDOIDExternalTempImpl; import org.eclipse.emf.cdo.util.CDOURIUtil; import org.eclipse.emf.internal.cdo.bundle.OM; -import org.eclipse.emf.internal.cdo.transaction.CDOXATransactionCommitContext; import org.eclipse.net4j.util.om.monitor.OMMonitor; import org.eclipse.net4j.util.om.trace.ContextTracer; import org.eclipse.emf.common.util.URI; import org.eclipse.emf.spi.cdo.InternalCDOTransaction; +import org.eclipse.emf.spi.cdo.CDOSessionProtocol.CommitTransactionResult; +import org.eclipse.emf.spi.cdo.InternalCDOXATransaction.InternalCDOXACommitContext; import java.io.IOException; import java.util.Map; @@ -45,15 +45,15 @@ public class CommitTransactionPhase2Request extends CommitTransactionRequest private static final ContextTracer PROTOCOL = new ContextTracer(OM.DEBUG_PROTOCOL, CommitTransactionPhase1Request.class); - public CommitTransactionPhase2Request(CDOClientProtocol protocol, CDOXATransactionCommitContext xaContext) + public CommitTransactionPhase2Request(CDOClientProtocol protocol, InternalCDOXACommitContext xaContext) { super(protocol, CDOProtocolConstants.SIGNAL_COMMIT_TRANSACTION_PHASE2, xaContext); } @Override - protected CDOXATransactionCommitContext getCommitContext() + protected InternalCDOXACommitContext getCommitContext() { - return (CDOXATransactionCommitContext)super.getCommitContext(); + return (InternalCDOXACommitContext)super.getCommitContext(); } @Override @@ -74,7 +74,7 @@ public class CommitTransactionPhase2Request extends CommitTransactionRequest */ protected void requestingIdMapping(CDODataOutput out) throws IOException { - CDOXATransactionCommitContext context = getCommitContext(); + InternalCDOXACommitContext context = getCommitContext(); Map<CDOIDExternalTempImpl, InternalCDOTransaction> requestedIDs = context.getRequestedIDs(); int size = requestedIDs.size(); out.writeInt(size); @@ -89,7 +89,7 @@ public class CommitTransactionPhase2Request extends CommitTransactionRequest URI oldURIExternal = URI.createURI(tempID.toURIFragment()); CDOID oldCDOID = CDOIDUtil.read(oldURIExternal.fragment(), null); - CDOXATransactionCommitContext commitContext = context.getTransactionManager().getCommitContext(entry.getValue()); + InternalCDOXACommitContext commitContext = context.getTransactionManager().getCommitContext(entry.getValue()); if (commitContext == null) { throw new IllegalStateException("Missing informations. " + entry.getValue() + " isn't involved in the commit."); diff --git a/plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/internal/cdo/protocol/CommitTransactionPhase3Request.java b/plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/internal/cdo/net4j/protocol/CommitTransactionPhase3Request.java index 2f25c1f518..c63da59f6b 100644 --- a/plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/internal/cdo/protocol/CommitTransactionPhase3Request.java +++ b/plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/internal/cdo/net4j/protocol/CommitTransactionPhase3Request.java @@ -1,5 +1,5 @@ -/** - * Copyright (c) 2004 - 2009 Eike Stepper (Berlin, Germany) and others. +/*************************************************************************** + * Copyright (c) 2004 - 2008 Eike Stepper, Germany. * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v1.0 * which accompanies this distribution, and is available at @@ -7,19 +7,19 @@ * * Contributors: * Simon McDuff - initial API and implementation - * Eike Stepper - maintenance - */ -package org.eclipse.emf.internal.cdo.protocol; + **************************************************************************/ +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.protocol.CDOProtocolConstants; import org.eclipse.emf.cdo.transaction.CDOTransaction; -import org.eclipse.emf.internal.cdo.transaction.CDOXATransactionCommitContext; - import org.eclipse.net4j.util.om.monitor.OMMonitor; +import org.eclipse.emf.spi.cdo.CDOSessionProtocol.CommitTransactionResult; +import org.eclipse.emf.spi.cdo.InternalCDOXATransaction.InternalCDOXACommitContext; + import java.io.IOException; /** @@ -33,7 +33,7 @@ import java.io.IOException; */ public class CommitTransactionPhase3Request extends CommitTransactionRequest { - public CommitTransactionPhase3Request(CDOClientProtocol protocol, CDOXATransactionCommitContext xaContext) + public CommitTransactionPhase3Request(CDOClientProtocol protocol, InternalCDOXACommitContext xaContext) { super(protocol, CDOProtocolConstants.SIGNAL_COMMIT_TRANSACTION_PHASE3, xaContext); } @@ -53,7 +53,7 @@ public class CommitTransactionPhase3Request extends CommitTransactionRequest return result; } - CDOXATransactionCommitContext context = (CDOXATransactionCommitContext)getCommitContext(); + InternalCDOXACommitContext context = (InternalCDOXACommitContext)getCommitContext(); confirmingNewPackage(in, context.getResult()); return context.getResult(); } diff --git a/plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/internal/cdo/protocol/CommitTransactionRequest.java b/plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/internal/cdo/net4j/protocol/CommitTransactionRequest.java index c38d72d8c1..271cb48dad 100644 --- a/plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/internal/cdo/protocol/CommitTransactionRequest.java +++ b/plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/internal/cdo/net4j/protocol/CommitTransactionRequest.java @@ -1,5 +1,5 @@ -/** - * Copyright (c) 2004 - 2009 Eike Stepper (Berlin, Germany) and others. +/*************************************************************************** + * Copyright (c) 2004 - 2008 Eike Stepper, Germany. * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v1.0 * which accompanies this distribution, and is available at @@ -10,8 +10,8 @@ * Simon McDuff - http://bugs.eclipse.org/201266 * Simon McDuff - http://bugs.eclipse.org/215688 * Simon McDuff - http://bugs.eclipse.org/213402 - */ -package org.eclipse.emf.internal.cdo.protocol; + **************************************************************************/ +package org.eclipse.emf.internal.cdo.net4j.protocol; import org.eclipse.emf.cdo.CDOObject; import org.eclipse.emf.cdo.common.id.CDOID; @@ -46,8 +46,9 @@ import org.eclipse.net4j.util.io.ExtendedDataOutputStream; import org.eclipse.net4j.util.om.monitor.OMMonitor; import org.eclipse.net4j.util.om.trace.ContextTracer; -import org.eclipse.emf.spi.cdo.InternalCDOCommitContext; import org.eclipse.emf.spi.cdo.InternalCDOSession; +import org.eclipse.emf.spi.cdo.CDOSessionProtocol.CommitTransactionResult; +import org.eclipse.emf.spi.cdo.InternalCDOTransaction.InternalCDOCommitContext; import java.io.IOException; import java.util.Collection; diff --git a/plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/internal/cdo/protocol/LoadChunkRequest.java b/plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/internal/cdo/net4j/protocol/LoadChunkRequest.java index 85dd4c880a..9be6f77a75 100644 --- a/plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/internal/cdo/protocol/LoadChunkRequest.java +++ b/plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/internal/cdo/net4j/protocol/LoadChunkRequest.java @@ -1,5 +1,5 @@ -/** - * Copyright (c) 2004 - 2009 Eike Stepper (Berlin, Germany) and others. +/*************************************************************************** + * Copyright (c) 2004 - 2008 Eike Stepper, Germany. * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v1.0 * which accompanies this distribution, and is available at @@ -7,8 +7,8 @@ * * Contributors: * Eike Stepper - initial API and implementation - */ -package org.eclipse.emf.internal.cdo.protocol; + **************************************************************************/ +package org.eclipse.emf.internal.cdo.net4j.protocol; import org.eclipse.emf.cdo.common.id.CDOID; import org.eclipse.emf.cdo.common.io.CDODataInput; diff --git a/plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/internal/cdo/protocol/LoadLibrariesRequest.java b/plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/internal/cdo/net4j/protocol/LoadLibrariesRequest.java index d599c456a9..8248cd769a 100644 --- a/plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/internal/cdo/protocol/LoadLibrariesRequest.java +++ b/plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/internal/cdo/net4j/protocol/LoadLibrariesRequest.java @@ -1,5 +1,5 @@ -/** - * Copyright (c) 2004 - 2009 Eike Stepper (Berlin, Germany) and others. +/*************************************************************************** + * Copyright (c) 2004 - 2008 Eike Stepper, Germany. * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v1.0 * which accompanies this distribution, and is available at @@ -7,8 +7,8 @@ * * Contributors: * Eike Stepper - initial API and implementation - */ -package org.eclipse.emf.internal.cdo.protocol; + **************************************************************************/ +package org.eclipse.emf.internal.cdo.net4j.protocol; import org.eclipse.emf.cdo.common.protocol.CDOProtocolConstants; diff --git a/plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/internal/cdo/protocol/LoadPackageRequest.java b/plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/internal/cdo/net4j/protocol/LoadPackageRequest.java index f9f2f7ad41..f0efd04cca 100644 --- a/plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/internal/cdo/protocol/LoadPackageRequest.java +++ b/plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/internal/cdo/net4j/protocol/LoadPackageRequest.java @@ -1,5 +1,5 @@ -/** - * Copyright (c) 2004 - 2009 Eike Stepper (Berlin, Germany) and others. +/*************************************************************************** + * Copyright (c) 2004 - 2008 Eike Stepper, Germany. * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v1.0 * which accompanies this distribution, and is available at @@ -7,20 +7,21 @@ * * Contributors: * Eike Stepper - initial API and implementation - */ -package org.eclipse.emf.internal.cdo.protocol; + **************************************************************************/ +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<String> +public class LoadPackageRequest extends CDOClientRequest<Object> { private CDOPackage cdoPackage; @@ -41,14 +42,18 @@ public class LoadPackageRequest extends CDOClientRequest<String> } @Override - protected String confirming(CDODataInput in) throws IOException + protected Object confirming(CDODataInput in) throws IOException { if (onlyEcore) { - return in.readString(); + String ecore = in.readString(); + ((InternalCDOPackage)cdoPackage).setEcore(ecore); + } + else + { + in.readCDOPackage(cdoPackage); } - in.readCDOPackage(cdoPackage); return null; } } diff --git a/plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/internal/cdo/protocol/LoadRevisionByTimeRequest.java b/plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/internal/cdo/net4j/protocol/LoadRevisionByTimeRequest.java index 4ab1767e1d..06f63f5f35 100644 --- a/plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/internal/cdo/protocol/LoadRevisionByTimeRequest.java +++ b/plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/internal/cdo/net4j/protocol/LoadRevisionByTimeRequest.java @@ -1,5 +1,5 @@ -/** - * Copyright (c) 2004 - 2009 Eike Stepper (Berlin, Germany) and others. +/*************************************************************************** + * Copyright (c) 2004 - 2008 Eike Stepper, Germany. * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v1.0 * which accompanies this distribution, and is available at @@ -7,8 +7,8 @@ * * Contributors: * Eike Stepper - initial API and implementation - */ -package org.eclipse.emf.internal.cdo.protocol; + **************************************************************************/ +package org.eclipse.emf.internal.cdo.net4j.protocol; import org.eclipse.emf.cdo.common.id.CDOID; import org.eclipse.emf.cdo.common.io.CDODataOutput; diff --git a/plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/internal/cdo/protocol/LoadRevisionByVersionRequest.java b/plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/internal/cdo/net4j/protocol/LoadRevisionByVersionRequest.java index 8dacb20858..48110d8621 100644 --- a/plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/internal/cdo/protocol/LoadRevisionByVersionRequest.java +++ b/plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/internal/cdo/net4j/protocol/LoadRevisionByVersionRequest.java @@ -1,5 +1,5 @@ -/** - * Copyright (c) 2004 - 2009 Eike Stepper (Berlin, Germany) and others. +/*************************************************************************** + * Copyright (c) 2004 - 2008 Eike Stepper, Germany. * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v1.0 * which accompanies this distribution, and is available at @@ -7,8 +7,8 @@ * * Contributors: * Eike Stepper - initial API and implementation - */ -package org.eclipse.emf.internal.cdo.protocol; + **************************************************************************/ +package org.eclipse.emf.internal.cdo.net4j.protocol; import org.eclipse.emf.cdo.common.id.CDOID; import org.eclipse.emf.cdo.common.io.CDODataOutput; diff --git a/plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/internal/cdo/protocol/LoadRevisionRequest.java b/plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/internal/cdo/net4j/protocol/LoadRevisionRequest.java index c0ea0a2154..48919f6e10 100644 --- a/plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/internal/cdo/protocol/LoadRevisionRequest.java +++ b/plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/internal/cdo/net4j/protocol/LoadRevisionRequest.java @@ -1,5 +1,5 @@ -/** - * Copyright (c) 2004 - 2009 Eike Stepper (Berlin, Germany) and others. +/*************************************************************************** + * Copyright (c) 2004 - 2008 Eike Stepper, Germany. * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v1.0 * which accompanies this distribution, and is available at @@ -7,8 +7,8 @@ * * Contributors: * Eike Stepper - initial API and implementation - */ -package org.eclipse.emf.internal.cdo.protocol; + **************************************************************************/ +package org.eclipse.emf.internal.cdo.net4j.protocol; import org.eclipse.emf.cdo.common.CDOFetchRule; import org.eclipse.emf.cdo.common.id.CDOID; diff --git a/plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/internal/cdo/protocol/LockObjectsRequest.java b/plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/internal/cdo/net4j/protocol/LockObjectsRequest.java index 0b4a54bb3e..019a4147e0 100644 --- a/plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/internal/cdo/protocol/LockObjectsRequest.java +++ b/plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/internal/cdo/net4j/protocol/LockObjectsRequest.java @@ -1,5 +1,5 @@ -/** - * Copyright (c) 2004 - 2009 Eike Stepper (Berlin, Germany) and others. +/*************************************************************************** + * Copyright (c) 2004 - 2008 Eike Stepper, Germany. * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v1.0 * which accompanies this distribution, and is available at @@ -7,9 +7,8 @@ * * Contributors: * Simon McDuff - initial API and implementation - * Eike Stepper - maintenance - */ -package org.eclipse.emf.internal.cdo.protocol; + **************************************************************************/ +package org.eclipse.emf.internal.cdo.net4j.protocol; import org.eclipse.emf.cdo.CDOObject; import org.eclipse.emf.cdo.common.io.CDODataInput; diff --git a/plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/internal/cdo/protocol/ObjectLockedRequest.java b/plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/internal/cdo/net4j/protocol/ObjectLockedRequest.java index c9d30ae26f..5ff6c79bd0 100644 --- a/plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/internal/cdo/protocol/ObjectLockedRequest.java +++ b/plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/internal/cdo/net4j/protocol/ObjectLockedRequest.java @@ -1,5 +1,5 @@ -/** - * Copyright (c) 2004 - 2009 Eike Stepper (Berlin, Germany) and others. +/*************************************************************************** + * Copyright (c) 2004 - 2008 Eike Stepper, Germany. * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v1.0 * which accompanies this distribution, and is available at @@ -7,9 +7,8 @@ * * Contributors: * Simon McDuff - initial API and implementation - * Eike Stepper - maintenance - */ -package org.eclipse.emf.internal.cdo.protocol; + **************************************************************************/ +package org.eclipse.emf.internal.cdo.net4j.protocol; import org.eclipse.emf.cdo.CDOObject; import org.eclipse.emf.cdo.common.io.CDODataInput; diff --git a/plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/internal/cdo/protocol/OpenSessionRequest.java b/plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/internal/cdo/net4j/protocol/OpenSessionRequest.java index d1e0439b72..3bb51f82e1 100644 --- a/plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/internal/cdo/protocol/OpenSessionRequest.java +++ b/plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/internal/cdo/net4j/protocol/OpenSessionRequest.java @@ -1,5 +1,5 @@ -/** - * Copyright (c) 2004 - 2009 Eike Stepper (Berlin, Germany) and others. +/*************************************************************************** + * Copyright (c) 2004 - 2008 Eike Stepper, Germany. * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v1.0 * which accompanies this distribution, and is available at @@ -8,8 +8,8 @@ * Contributors: * Eike Stepper - initial API and implementation * Simon McDuff - http://bugs.eclipse.org/230832 - */ -package org.eclipse.emf.internal.cdo.protocol; + **************************************************************************/ +package org.eclipse.emf.internal.cdo.net4j.protocol; import org.eclipse.emf.cdo.common.id.CDOIDLibraryDescriptor; import org.eclipse.emf.cdo.common.id.CDOIDMetaRange; @@ -28,6 +28,7 @@ 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; import java.text.MessageFormat; diff --git a/plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/internal/cdo/protocol/QueryCancelRequest.java b/plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/internal/cdo/net4j/protocol/QueryCancelRequest.java index 88057107dc..bb48b83caa 100644 --- a/plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/internal/cdo/protocol/QueryCancelRequest.java +++ b/plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/internal/cdo/net4j/protocol/QueryCancelRequest.java @@ -1,5 +1,5 @@ -/** - * Copyright (c) 2004 - 2009 Eike Stepper (Berlin, Germany) and others. +/*************************************************************************** + * Copyright (c) 2004 - 2008 Eike Stepper, Germany. * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v1.0 * which accompanies this distribution, and is available at @@ -8,8 +8,8 @@ * Contributors: * Simon McDuff - initial API and implementation * Eike Stepper - maintenance - */ -package org.eclipse.emf.internal.cdo.protocol; + **************************************************************************/ +package org.eclipse.emf.internal.cdo.net4j.protocol; import org.eclipse.emf.cdo.common.io.CDODataInput; import org.eclipse.emf.cdo.common.io.CDODataOutput; @@ -24,7 +24,7 @@ import java.io.IOException; /** * @author Simon McDuff */ -public class QueryCancelRequest extends CDOClientRequest<Object> +public class QueryCancelRequest extends CDOClientRequest<Boolean> { private static final ContextTracer PROTOCOL_TRACER = new ContextTracer(OM.DEBUG_PROTOCOL, QueryCancelRequest.class); @@ -48,7 +48,7 @@ public class QueryCancelRequest extends CDOClientRequest<Object> } @Override - protected Object confirming(CDODataInput in) throws IOException + protected Boolean confirming(CDODataInput in) throws IOException { boolean exception = in.readBoolean(); if (exception) diff --git a/plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/internal/cdo/protocol/QueryRequest.java b/plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/internal/cdo/net4j/protocol/QueryRequest.java index 3930734b91..7bede39a6e 100644 --- a/plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/internal/cdo/protocol/QueryRequest.java +++ b/plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/internal/cdo/net4j/protocol/QueryRequest.java @@ -1,5 +1,5 @@ -/** - * Copyright (c) 2004 - 2009 Eike Stepper (Berlin, Germany) and others. +/*************************************************************************** + * Copyright (c) 2004 - 2008 Eike Stepper, Germany. * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v1.0 * which accompanies this distribution, and is available at @@ -8,8 +8,8 @@ * Contributors: * Simon McDuff - initial API and implementation * Eike Stepper - maintenance - */ -package org.eclipse.emf.internal.cdo.protocol; + **************************************************************************/ +package org.eclipse.emf.internal.cdo.net4j.protocol; import org.eclipse.emf.cdo.common.io.CDODataInput; import org.eclipse.emf.cdo.common.io.CDODataOutput; @@ -18,10 +18,11 @@ import org.eclipse.emf.cdo.common.util.CDOQueryQueue; import org.eclipse.emf.cdo.internal.common.CDOQueryInfoImpl; import org.eclipse.emf.internal.cdo.bundle.OM; -import org.eclipse.emf.internal.cdo.query.CDOAbstractQueryIteratorImpl; import org.eclipse.net4j.util.om.trace.ContextTracer; +import org.eclipse.emf.spi.cdo.AbstractQueryIterator; + import java.io.IOException; import java.util.ArrayList; import java.util.List; @@ -29,15 +30,15 @@ import java.util.List; /** * @author Simon McDuff */ -public class QueryRequest extends CDOClientRequest<Object> +public class QueryRequest extends CDOClientRequest<List<Object>> { private static final ContextTracer PROTOCOL_TRACER = new ContextTracer(OM.DEBUG_PROTOCOL, QueryRequest.class); private int viewID; - private CDOAbstractQueryIteratorImpl<?> queryResult; + private AbstractQueryIterator<?> queryResult; - public QueryRequest(CDOClientProtocol protocol, int viewID, CDOAbstractQueryIteratorImpl<?> queryResult) + public QueryRequest(CDOClientProtocol protocol, int viewID, AbstractQueryIterator<?> queryResult) { super(protocol, CDOProtocolConstants.SIGNAL_QUERY); this.viewID = viewID; @@ -53,7 +54,7 @@ public class QueryRequest extends CDOClientRequest<Object> } @Override - protected Object confirming(CDODataInput in) throws IOException + protected List<Object> confirming(CDODataInput in) throws IOException { int queryID = in.readInt(); queryResult.setQueryID(queryID); diff --git a/plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/internal/cdo/protocol/RepositoryTimeRequest.java b/plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/internal/cdo/net4j/protocol/RepositoryTimeRequest.java index def3a06cd9..ab9466aaf5 100644 --- a/plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/internal/cdo/protocol/RepositoryTimeRequest.java +++ b/plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/internal/cdo/net4j/protocol/RepositoryTimeRequest.java @@ -1,5 +1,5 @@ -/** - * Copyright (c) 2004 - 2009 Eike Stepper (Berlin, Germany) and others. +/*************************************************************************** + * Copyright (c) 2004 - 2008 Eike Stepper, Germany. * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v1.0 * which accompanies this distribution, and is available at @@ -7,12 +7,14 @@ * * Contributors: * Eike Stepper - initial API and implementation - */ -package org.eclipse.emf.internal.cdo.protocol; + **************************************************************************/ +package org.eclipse.emf.internal.cdo.net4j.protocol; import org.eclipse.emf.cdo.common.io.CDODataInput; import org.eclipse.emf.cdo.common.protocol.CDOProtocolConstants; +import org.eclipse.emf.spi.cdo.CDOSessionProtocol.RepositoryTimeResult; + import java.io.IOException; /** diff --git a/plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/internal/cdo/protocol/ResourceIDRequest.java b/plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/internal/cdo/net4j/protocol/ResourceIDRequest.java index f365b31c88..cfdffdb9d7 100644 --- a/plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/internal/cdo/protocol/ResourceIDRequest.java +++ b/plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/internal/cdo/net4j/protocol/ResourceIDRequest.java @@ -1,5 +1,5 @@ -/** - * Copyright (c) 2004 - 2009 Eike Stepper (Berlin, Germany) and others. +/*************************************************************************** + * Copyright (c) 2004 - 2008 Eike Stepper, Germany. * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v1.0 * which accompanies this distribution, and is available at @@ -7,8 +7,8 @@ * * Contributors: * Eike Stepper - initial API and implementation - */ -package org.eclipse.emf.internal.cdo.protocol; + **************************************************************************/ +package org.eclipse.emf.internal.cdo.net4j.protocol; import org.eclipse.emf.cdo.common.id.CDOID; import org.eclipse.emf.cdo.common.io.CDODataInput; diff --git a/plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/internal/cdo/protocol/SetAuditRequest.java b/plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/internal/cdo/net4j/protocol/SetAuditRequest.java index 74a4008c88..f53990c850 100644 --- a/plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/internal/cdo/protocol/SetAuditRequest.java +++ b/plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/internal/cdo/net4j/protocol/SetAuditRequest.java @@ -1,5 +1,5 @@ -/** - * Copyright (c) 2004 - 2009 Eike Stepper (Berlin, Germany) and others. +/*************************************************************************** + * Copyright (c) 2004 - 2008 Eike Stepper, Germany. * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v1.0 * which accompanies this distribution, and is available at @@ -7,8 +7,8 @@ * * Contributors: * Eike Stepper - initial API and implementation - */ -package org.eclipse.emf.internal.cdo.protocol; + **************************************************************************/ +package org.eclipse.emf.internal.cdo.net4j.protocol; import org.eclipse.emf.cdo.common.io.CDODataInput; import org.eclipse.emf.cdo.common.io.CDODataOutput; diff --git a/plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/internal/cdo/protocol/SetPassiveUpdateRequest.java b/plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/internal/cdo/net4j/protocol/SetPassiveUpdateRequest.java index a1a2d782a9..17ee873ecb 100644 --- a/plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/internal/cdo/protocol/SetPassiveUpdateRequest.java +++ b/plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/internal/cdo/net4j/protocol/SetPassiveUpdateRequest.java @@ -1,5 +1,5 @@ -/** - * Copyright (c) 2004 - 2009 Eike Stepper (Berlin, Germany) and others. +/*************************************************************************** + * Copyright (c) 2004 - 2008 Eike Stepper, Germany. * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v1.0 * which accompanies this distribution, and is available at @@ -7,9 +7,9 @@ * * Contributors: * Simon McDuff - initial API and implementation - * Eike Stepper - maintenance - */ -package org.eclipse.emf.internal.cdo.protocol; + * Simon McDuff - http://bugs.eclipse.org/230832 + **************************************************************************/ +package org.eclipse.emf.internal.cdo.net4j.protocol; import org.eclipse.emf.cdo.common.id.CDOID; import org.eclipse.emf.cdo.common.io.CDODataOutput; @@ -20,8 +20,6 @@ import org.eclipse.emf.internal.cdo.bundle.OM; import org.eclipse.net4j.util.om.trace.ContextTracer; -import org.eclipse.emf.spi.cdo.InternalCDOSession; - import java.io.IOException; import java.util.Map; @@ -29,17 +27,17 @@ import java.util.Map; * @author Simon McDuff * @since 2.0 */ -public class SetPassiveUpdateRequest extends SyncRevisionRequest +public class SetPassiveUpdateRequest extends SyncRevisionsRequest { private static final ContextTracer PROTOCOL_TRACER = new ContextTracer(OM.DEBUG_PROTOCOL, SetPassiveUpdateRequest.class); private boolean passiveUpdateEnabled; - public SetPassiveUpdateRequest(CDOClientProtocol protocol, InternalCDOSession session, - Map<CDOID, CDORevision> revisions, int referenceChunk, boolean passiveUpdateEnabled) + public SetPassiveUpdateRequest(CDOClientProtocol protocol, Map<CDOID, CDORevision> revisions, int referenceChunk, + boolean passiveUpdateEnabled) { - super(protocol, CDOProtocolConstants.SIGNAL_PASSIVE_UPDATE, session, revisions, referenceChunk); + super(protocol, CDOProtocolConstants.SIGNAL_PASSIVE_UPDATE, revisions, referenceChunk); this.passiveUpdateEnabled = passiveUpdateEnabled; } diff --git a/plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/internal/cdo/protocol/SyncRevisionRequest.java b/plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/internal/cdo/net4j/protocol/SyncRevisionsRequest.java index f65527ab2a..6e18bc9ae2 100644 --- a/plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/internal/cdo/protocol/SyncRevisionRequest.java +++ b/plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/internal/cdo/net4j/protocol/SyncRevisionsRequest.java @@ -1,5 +1,5 @@ -/** - * Copyright (c) 2004 - 2009 Eike Stepper (Berlin, Germany) and others. +/*************************************************************************** + * Copyright (c) 2004 - 2008 Eike Stepper, Germany. * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v1.0 * which accompanies this distribution, and is available at @@ -8,8 +8,8 @@ * Contributors: * Simon McDuff - initial API and implementation * Eike Stepper - maintenance - */ -package org.eclipse.emf.internal.cdo.protocol; + **************************************************************************/ +package org.eclipse.emf.internal.cdo.net4j.protocol; import org.eclipse.emf.cdo.common.id.CDOID; import org.eclipse.emf.cdo.common.id.CDOIDAndVersion; @@ -27,8 +27,6 @@ import org.eclipse.emf.internal.cdo.transaction.CDOTimeStampContextImpl; import org.eclipse.net4j.util.om.trace.ContextTracer; -import org.eclipse.emf.spi.cdo.InternalCDOSession; - import java.io.IOException; import java.util.Collection; import java.util.Collections; @@ -40,27 +38,23 @@ import java.util.TreeMap; * @author Simon McDuff * @since 2.0 */ -public class SyncRevisionRequest extends CDOClientRequest<Collection<CDOTimeStampContext>> +public class SyncRevisionsRequest extends CDOClientRequest<Collection<CDOTimeStampContext>> { - private static final ContextTracer PROTOCOL_TRACER = new ContextTracer(OM.DEBUG_PROTOCOL, SyncRevisionRequest.class); + private static final ContextTracer PROTOCOL_TRACER = new ContextTracer(OM.DEBUG_PROTOCOL, SyncRevisionsRequest.class); private Map<CDOID, CDORevision> revisions; - private InternalCDOSession session; - private int referenceChunk; - public SyncRevisionRequest(CDOClientProtocol protocol, InternalCDOSession session, Map<CDOID, CDORevision> revisions, - int referenceChunk) + public SyncRevisionsRequest(CDOClientProtocol protocol, Map<CDOID, CDORevision> revisions, int referenceChunk) { - this(protocol, CDOProtocolConstants.SIGNAL_SYNC, session, revisions, referenceChunk); + this(protocol, CDOProtocolConstants.SIGNAL_SYNC_REVISIONS, revisions, referenceChunk); } - public SyncRevisionRequest(CDOClientProtocol protocol, short signalID, InternalCDOSession session, - Map<CDOID, CDORevision> revisions, int referenceChunk) + public SyncRevisionsRequest(CDOClientProtocol protocol, short signalID, Map<CDOID, CDORevision> revisions, + int referenceChunk) { super(protocol, signalID); - this.session = session; this.revisions = revisions; this.referenceChunk = referenceChunk; } @@ -131,7 +125,7 @@ public class SyncRevisionRequest extends CDOClientRequest<Collection<CDOTimeStam ((CDOTimeStampContextImpl)timestampContext).setDirtyObjects(dirtyObjects); ((CDOTimeStampContextImpl)timestampContext).setDetachedObjects(detachedObjects); - session.handleSyncResponse(timestampContext.getTimeStamp(), dirtyObjects, detachedObjects); + getSession().handleSyncResponse(timestampContext.getTimeStamp(), dirtyObjects, detachedObjects); } return Collections.unmodifiableCollection(mapofContext.values()); diff --git a/plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/internal/cdo/protocol/UnlockObjectsRequest.java b/plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/internal/cdo/net4j/protocol/UnlockObjectsRequest.java index 9355b00f49..978dda818b 100644 --- a/plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/internal/cdo/protocol/UnlockObjectsRequest.java +++ b/plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/internal/cdo/net4j/protocol/UnlockObjectsRequest.java @@ -1,5 +1,5 @@ -/** - * Copyright (c) 2004 - 2009 Eike Stepper (Berlin, Germany) and others. +/*************************************************************************** + * Copyright (c) 2004 - 2008 Eike Stepper, Germany. * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v1.0 * which accompanies this distribution, and is available at @@ -7,9 +7,8 @@ * * Contributors: * Simon McDuff - initial API and implementation - * Eike Stepper - maintenance - */ -package org.eclipse.emf.internal.cdo.protocol; + **************************************************************************/ +package org.eclipse.emf.internal.cdo.net4j.protocol; import org.eclipse.emf.cdo.CDOObject; import org.eclipse.emf.cdo.common.io.CDODataInput; diff --git a/plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/internal/cdo/protocol/VerifyRevisionRequest.java b/plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/internal/cdo/net4j/protocol/VerifyRevisionRequest.java index 1b91e9b90d..996869515e 100644 --- a/plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/internal/cdo/protocol/VerifyRevisionRequest.java +++ b/plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/internal/cdo/net4j/protocol/VerifyRevisionRequest.java @@ -1,5 +1,5 @@ -/** - * Copyright (c) 2004 - 2009 Eike Stepper (Berlin, Germany) and others. +/*************************************************************************** + * Copyright (c) 2004 - 2008 Eike Stepper, Germany. * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v1.0 * which accompanies this distribution, and is available at @@ -7,8 +7,8 @@ * * Contributors: * Eike Stepper - initial API and implementation - */ -package org.eclipse.emf.internal.cdo.protocol; + **************************************************************************/ +package org.eclipse.emf.internal.cdo.net4j.protocol; import org.eclipse.emf.cdo.common.id.CDOID; import org.eclipse.emf.cdo.common.io.CDODataInput; diff --git a/plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/internal/cdo/protocol/ViewsChangedRequest.java b/plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/internal/cdo/net4j/protocol/ViewsChangedRequest.java index b0a6141709..a31ff13c4a 100644 --- a/plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/internal/cdo/protocol/ViewsChangedRequest.java +++ b/plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/internal/cdo/net4j/protocol/ViewsChangedRequest.java @@ -1,5 +1,5 @@ -/** - * Copyright (c) 2004 - 2009 Eike Stepper (Berlin, Germany) and others. +/*************************************************************************** + * Copyright (c) 2004 - 2008 Eike Stepper, Germany. * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v1.0 * which accompanies this distribution, and is available at @@ -7,8 +7,8 @@ * * Contributors: * Eike Stepper - initial API and implementation - */ -package org.eclipse.emf.internal.cdo.protocol; + **************************************************************************/ +package org.eclipse.emf.internal.cdo.net4j.protocol; import org.eclipse.emf.cdo.common.CDOCommonView; import org.eclipse.emf.cdo.common.io.CDODataInput; diff --git a/plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/internal/cdo/protocol/CDOClientProtocol.java b/plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/internal/cdo/protocol/CDOClientProtocol.java deleted file mode 100644 index 3421055058..0000000000 --- a/plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/internal/cdo/protocol/CDOClientProtocol.java +++ /dev/null @@ -1,57 +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.protocol; - -import org.eclipse.emf.cdo.common.protocol.CDOProtocolConstants; -import org.eclipse.emf.cdo.internal.common.protocol.CDOProtocolImpl; -import org.eclipse.emf.cdo.session.CDOSession; -import org.eclipse.emf.cdo.session.CDOSessionProtocol; - -import org.eclipse.net4j.signal.SignalReactor; - -/** - * @author Eike Stepper - */ -public class CDOClientProtocol extends CDOProtocolImpl implements CDOSessionProtocol -{ - public CDOClientProtocol() - { - } - - @Override - public CDOSession getSession() - { - return (CDOSession)super.getSession(); - } - - @Override - protected SignalReactor createSignalReactor(short signalID) - { - switch (signalID) - { - case CDOProtocolConstants.SIGNAL_COMMIT_NOTIFICATION: - return new CommitNotificationIndication(this); - - default: - return super.createSignalReactor(signalID); - } - } - - @Override - protected void doBeforeActivate() throws Exception - { - super.doBeforeActivate(); - if (!(getInfraStructure() instanceof CDOSession)) - { - throw new IllegalStateException("No session"); - } - } -} diff --git a/plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/internal/cdo/protocol/CommitTransactionResult.java b/plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/internal/cdo/protocol/CommitTransactionResult.java deleted file mode 100644 index c890f2293c..0000000000 --- a/plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/internal/cdo/protocol/CommitTransactionResult.java +++ /dev/null @@ -1,92 +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.protocol; - -import org.eclipse.emf.cdo.common.id.CDOID; -import org.eclipse.emf.cdo.common.id.CDOIDTemp; -import org.eclipse.emf.cdo.common.revision.CDOReferenceAdjuster; -import org.eclipse.emf.cdo.internal.common.revision.CDOIDMapper; - -import org.eclipse.emf.internal.cdo.revision.CDOPostCommitReferenceAdjuster; - -import org.eclipse.emf.spi.cdo.InternalCDOCommitContext; - -import java.util.HashMap; -import java.util.Map; - -/** - * @author Eike Stepper - */ -public final class CommitTransactionResult -{ - private String rollbackMessage; - - private long timeStamp; - - private Map<CDOIDTemp, CDOID> idMappings = new HashMap<CDOIDTemp, CDOID>(); - - private CDOReferenceAdjuster referenceAdjuster; - - private InternalCDOCommitContext commitContext; - - public CommitTransactionResult(InternalCDOCommitContext commitContext, String rollbackMessage) - { - this.rollbackMessage = rollbackMessage; - this.commitContext = commitContext; - } - - public CommitTransactionResult(InternalCDOCommitContext commitContext, long timeStamp) - { - this.timeStamp = timeStamp; - this.commitContext = commitContext; - } - - public CDOReferenceAdjuster getReferenceAdjuster() - { - if (referenceAdjuster == null) - { - referenceAdjuster = new CDOPostCommitReferenceAdjuster(commitContext.getTransaction(), - new CDOIDMapper(idMappings)); - } - - return referenceAdjuster; - } - - public void setReferenceAdjuster(CDOReferenceAdjuster referenceAdjuster) - { - this.referenceAdjuster = referenceAdjuster; - } - - public InternalCDOCommitContext getCommitContext() - { - return commitContext; - } - - public String getRollbackMessage() - { - return rollbackMessage; - } - - public long getTimeStamp() - { - return timeStamp; - } - - public Map<CDOIDTemp, CDOID> getIDMappings() - { - return idMappings; - } - - void addIDMapping(CDOIDTemp oldID, CDOID newID) - { - idMappings.put(oldID, newID); - } -} diff --git a/plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/internal/cdo/protocol/OpenSessionResult.java b/plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/internal/cdo/protocol/OpenSessionResult.java deleted file mode 100644 index 009527a83f..0000000000 --- a/plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/internal/cdo/protocol/OpenSessionResult.java +++ /dev/null @@ -1,122 +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.protocol; - -import org.eclipse.emf.cdo.common.id.CDOIDLibraryDescriptor; -import org.eclipse.emf.cdo.common.id.CDOIDMetaRange; -import org.eclipse.emf.cdo.common.model.CDOPackageInfo; -import org.eclipse.emf.cdo.common.model.CDOPackageURICompressor; - -import org.eclipse.net4j.util.io.ExtendedDataInput; -import org.eclipse.net4j.util.io.ExtendedDataOutput; -import org.eclipse.net4j.util.io.StringCompressor; - -import java.io.IOException; -import java.util.ArrayList; -import java.util.List; - -/** - * @author Eike Stepper - */ -public final class OpenSessionResult implements CDOPackageURICompressor -{ - private int sessionID; - - private String repositoryUUID; - - private long repositoryCreationTime; - - private RepositoryTimeResult repositoryTimeResult; - - private boolean repositorySupportingAudits; - - private CDOIDLibraryDescriptor libraryDescriptor; - - private List<CDOPackageInfo> packageInfos = new ArrayList<CDOPackageInfo>(); - - private StringCompressor compressor = new StringCompressor(true); - - public OpenSessionResult(int sessionID, String repositoryUUID, long repositoryCreationTime, - boolean repositorySupportingAudits, CDOIDLibraryDescriptor libraryDescriptor) - { - this.sessionID = sessionID; - this.repositoryUUID = repositoryUUID; - this.repositoryCreationTime = repositoryCreationTime; - this.repositorySupportingAudits = repositorySupportingAudits; - this.libraryDescriptor = libraryDescriptor; - } - - public int getSessionID() - { - return sessionID; - } - - public String getRepositoryUUID() - { - return repositoryUUID; - } - - public long getRepositoryCreationTime() - { - return repositoryCreationTime; - } - - public boolean isRepositorySupportingAudits() - { - return repositorySupportingAudits; - } - - public RepositoryTimeResult getRepositoryTimeResult() - { - return repositoryTimeResult; - } - - public void setRepositoryTimeResult(RepositoryTimeResult repositoryTimeResult) - { - this.repositoryTimeResult = repositoryTimeResult; - } - - public CDOIDLibraryDescriptor getLibraryDescriptor() - { - return libraryDescriptor; - } - - public List<CDOPackageInfo> getPackageInfos() - { - return packageInfos; - } - - void addPackageInfo(String packageURI, boolean dynamic, CDOIDMetaRange metaIDRange, String parentURI) - { - packageInfos.add(new CDOPackageInfo(packageURI, dynamic, metaIDRange, parentURI)); - } - - public StringCompressor getCompressor() - { - return compressor; - } - - /** - * @since 2.0 - */ - public void writePackageURI(ExtendedDataOutput out, String uri) throws IOException - { - compressor.write(out, uri); - } - - /** - * @since 2.0 - */ - public String readPackageURI(ExtendedDataInput in) throws IOException - { - return compressor.read(in); - } -} diff --git a/plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/internal/cdo/protocol/RepositoryTimeResult.java b/plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/internal/cdo/protocol/RepositoryTimeResult.java deleted file mode 100644 index f3c3c2e0f7..0000000000 --- a/plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/internal/cdo/protocol/RepositoryTimeResult.java +++ /dev/null @@ -1,93 +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.protocol; - -import java.text.MessageFormat; - -/** - * @author Eike Stepper - */ -public final class RepositoryTimeResult -{ - private long requested; - - private long indicated; - - private long responded; - - private long confirmed; - - public RepositoryTimeResult() - { - } - - public long getRequested() - { - return requested; - } - - public void setRequested(long requested) - { - this.requested = requested; - } - - public long getIndicated() - { - return indicated; - } - - public void setIndicated(long indicated) - { - this.indicated = indicated; - } - - public long getResponded() - { - return responded; - } - - public void setResponded(long responded) - { - this.responded = responded; - } - - public long getConfirmed() - { - return confirmed; - } - - public void setConfirmed(long confirmed) - { - this.confirmed = confirmed; - } - - public long getAproximateRepositoryOffset() - { - long latency = confirmed - requested >> 1; - long shift = confirmed - responded; - return shift - latency; - } - - public long getAproximateRepositoryTime() - { - long offset = getAproximateRepositoryOffset(); - return System.currentTimeMillis() + offset; - } - - @Override - public String toString() - { - return MessageFormat - .format( - "RepositoryTime[requested={0,date} {0,time}, indicated={1,date} {1,time}, responded={2,date} {2,time}, confirmed={3,date} {3,time}]", - requested, indicated, responded, confirmed); - } -} diff --git a/plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/internal/cdo/query/CDOQueryCDOIDIteratorImpl.java b/plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/internal/cdo/query/CDOQueryCDOIDIteratorImpl.java index 578a2ca69c..35b16d4cee 100644 --- a/plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/internal/cdo/query/CDOQueryCDOIDIteratorImpl.java +++ b/plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/internal/cdo/query/CDOQueryCDOIDIteratorImpl.java @@ -14,13 +14,15 @@ package org.eclipse.emf.internal.cdo.query; import org.eclipse.emf.cdo.common.CDOQueryInfo; import org.eclipse.emf.cdo.view.CDOView; +import org.eclipse.emf.spi.cdo.AbstractQueryIterator; + import java.util.ArrayList; import java.util.List; /** * @author Simon McDuff */ -public class CDOQueryCDOIDIteratorImpl<CDOID> extends CDOAbstractQueryIteratorImpl<CDOID> +public class CDOQueryCDOIDIteratorImpl<CDOID> extends AbstractQueryIterator<CDOID> { public CDOQueryCDOIDIteratorImpl(CDOView view, CDOQueryInfo queryInfo) { 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 9a34e27a98..843dbc4dd5 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,8 +16,6 @@ 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.protocol.CDOClientProtocol; -import org.eclipse.emf.internal.cdo.protocol.QueryRequest; import org.eclipse.emf.internal.cdo.session.CDOSessionPackageManagerImpl; import org.eclipse.emf.internal.cdo.util.FSMUtil; import org.eclipse.emf.internal.cdo.util.ModelUtil; @@ -25,6 +23,7 @@ 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; @@ -63,7 +62,7 @@ public class CDOQueryImpl extends CDOQueryInfoImpl implements CDOQuery } @SuppressWarnings("unchecked") - protected <T> CDOAbstractQueryIteratorImpl<T> createQueryResult(Class<T> classObject) + protected <T> AbstractQueryIterator<T> createQueryResult(Class<T> classObject) { CDOQueryInfoImpl queryInfo = createQueryInfo(); if (classObject.equals(CDOID.class)) @@ -76,24 +75,14 @@ public class CDOQueryImpl extends CDOQueryInfoImpl implements CDOQuery public <T> List<T> getResult(Class<T> classObject) { - CDOAbstractQueryIteratorImpl<T> queryResult = createQueryResult(classObject); - - try - { - CDOClientProtocol protocol = (CDOClientProtocol)view.getSession().getProtocol(); - new QueryRequest(protocol, view.getViewID(), queryResult).send(); - } - catch (Exception exception) - { - throw WrappedException.wrap(exception); - } - + AbstractQueryIterator<T> queryResult = createQueryResult(classObject); + view.getSession().getSessionProtocol().query(view.getViewID(), queryResult); return queryResult.asList(); } public <T> BlockingCloseableIterator<T> getResultAsync(Class<T> classObject) { - final CDOAbstractQueryIteratorImpl<T> queryResult = createQueryResult(classObject); + final AbstractQueryIterator<T> queryResult = createQueryResult(classObject); final Exception exception[] = new Exception[1]; Runnable runnable = new Runnable() { @@ -101,8 +90,7 @@ public class CDOQueryImpl extends CDOQueryInfoImpl implements CDOQuery { try { - CDOClientProtocol protocol = (CDOClientProtocol)view.getSession().getProtocol(); - new QueryRequest(protocol, view.getViewID(), queryResult).send(); + view.getSession().getSessionProtocol().query(view.getViewID(), queryResult); } catch (Exception ex) { diff --git a/plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/internal/cdo/query/CDOQueryResultIteratorImpl.java b/plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/internal/cdo/query/CDOQueryResultIteratorImpl.java index 4f2d94b7e8..8caf9af18e 100644 --- a/plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/internal/cdo/query/CDOQueryResultIteratorImpl.java +++ b/plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/internal/cdo/query/CDOQueryResultIteratorImpl.java @@ -15,13 +15,15 @@ import org.eclipse.emf.cdo.common.CDOQueryInfo; import org.eclipse.emf.cdo.common.id.CDOID; import org.eclipse.emf.cdo.view.CDOView; +import org.eclipse.emf.spi.cdo.AbstractQueryIterator; + import java.util.ArrayList; import java.util.List; /** * @author Simon McDuff */ -public class CDOQueryResultIteratorImpl<T> extends CDOAbstractQueryIteratorImpl<T> +public class CDOQueryResultIteratorImpl<T> extends AbstractQueryIterator<T> { public CDOQueryResultIteratorImpl(CDOView view, CDOQueryInfo queryInfo) { diff --git a/plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/internal/cdo/revision/CDOPostCommitReferenceAdjuster.java b/plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/internal/cdo/revision/CDOPostCommitReferenceAdjuster.java deleted file mode 100644 index 79e76d209d..0000000000 --- a/plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/internal/cdo/revision/CDOPostCommitReferenceAdjuster.java +++ /dev/null @@ -1,60 +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: - * Simon McDuff - initial API and implementation - * Eike Stepper - maintenance - */ -package org.eclipse.emf.internal.cdo.revision; - -import org.eclipse.emf.cdo.common.id.CDOID; -import org.eclipse.emf.cdo.common.id.CDOIDProvider; -import org.eclipse.emf.cdo.common.revision.CDOReferenceAdjuster; -import org.eclipse.emf.cdo.internal.common.revision.CDOIDMapper; - -import org.eclipse.emf.ecore.InternalEObject; - -/** - * @author Simon McDuff - */ -public class CDOPostCommitReferenceAdjuster implements CDOReferenceAdjuster -{ - private CDOIDProvider idProvider; - - private CDOIDMapper idMapper; - - public CDOPostCommitReferenceAdjuster(CDOIDProvider idProvider, CDOIDMapper idMapper) - { - this.idProvider = idProvider; - this.idMapper = idMapper; - } - - public CDOIDProvider getIDProvider() - { - return idProvider; - } - - public CDOIDMapper getIDMapper() - { - return idMapper; - } - - public Object adjustReference(Object id) - { - if (id == null) - { - return null; - } - - if (idProvider != null && (id instanceof CDOID || id instanceof InternalEObject)) - { - id = idProvider.provideCDOID(id); - } - - return idMapper.adjustReference(id); - } -} 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 062b681b8b..07f792e708 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 @@ -16,21 +16,11 @@ import org.eclipse.emf.cdo.common.id.CDOIDObjectFactory; import org.eclipse.emf.cdo.common.model.CDOFeature; import org.eclipse.emf.cdo.common.model.CDOPackageManager; import org.eclipse.emf.cdo.common.revision.CDORevision; -import org.eclipse.emf.cdo.common.util.TransportException; import org.eclipse.emf.cdo.internal.common.revision.CDORevisionResolverImpl; 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.internal.cdo.bundle.OM; -import org.eclipse.emf.internal.cdo.protocol.CDOClientProtocol; -import org.eclipse.emf.internal.cdo.protocol.LoadChunkRequest; -import org.eclipse.emf.internal.cdo.protocol.LoadRevisionByTimeRequest; -import org.eclipse.emf.internal.cdo.protocol.LoadRevisionByVersionRequest; -import org.eclipse.emf.internal.cdo.protocol.LoadRevisionRequest; - -import org.eclipse.net4j.util.om.trace.PerfTracer; - import org.eclipse.emf.spi.cdo.InternalCDOSession; import java.util.Collection; @@ -42,8 +32,6 @@ import java.util.List; */ public class CDORevisionManagerImpl extends CDORevisionResolverImpl implements CDORevisionManager { - private static final PerfTracer LOADING = new PerfTracer(OM.PERF_REVISION_LOADING, CDORevisionManagerImpl.class); - private InternalCDOSession session; private CDOFetchRuleManager ruleManager = CDOFetchRuleManager.NOOP; @@ -64,6 +52,22 @@ public class CDORevisionManagerImpl extends CDORevisionResolverImpl implements C return session; } + /** + * @since 2.0 + */ + public CDOFetchRuleManager getRuleManager() + { + return ruleManager; + } + + /** + * @since 2.0 + */ + public void setRuleManager(CDOFetchRuleManager ruleManager) + { + this.ruleManager = ruleManager; + } + public CDOIDObjectFactory getCDOIDObjectFactory() { return session; @@ -84,55 +88,38 @@ public class CDORevisionManagerImpl extends CDORevisionResolverImpl implements C public Object loadChunkByRange(CDORevision revision, CDOFeature feature, int accessIndex, int fetchIndex, int fromIndex, int toIndex) { - try - { - CDOClientProtocol protocol = (CDOClientProtocol)session.getProtocol(); - return new LoadChunkRequest(protocol, (InternalCDORevision)revision, feature, accessIndex, fetchIndex, fromIndex, - toIndex).send(); - } - catch (RuntimeException ex) - { - throw ex; - } - catch (Exception ex) - { - throw new TransportException(ex); - } + return session.getSessionProtocol().loadChunk((InternalCDORevision)revision, feature, accessIndex, fetchIndex, + fromIndex, toIndex); } @Override protected InternalCDORevision loadRevision(CDOID id, int referenceChunk) { - CDOClientProtocol protocol = (CDOClientProtocol)session.getProtocol(); - return send(new LoadRevisionRequest(protocol, Collections.singleton(id), referenceChunk)).get(0); + return loadRevisions(Collections.singleton(id), referenceChunk).get(0); } @Override protected InternalCDORevision loadRevisionByTime(CDOID id, int referenceChunk, long timeStamp) { - CDOClientProtocol protocol = (CDOClientProtocol)session.getProtocol(); - return send(new LoadRevisionByTimeRequest(protocol, Collections.singleton(id), referenceChunk, timeStamp)).get(0); + return loadRevisionsByTime(Collections.singleton(id), referenceChunk, timeStamp).get(0); } @Override protected InternalCDORevision loadRevisionByVersion(CDOID id, int referenceChunk, int version) { - CDOClientProtocol protocol = (CDOClientProtocol)session.getProtocol(); - return send(new LoadRevisionByVersionRequest(protocol, id, referenceChunk, version)).get(0); + return session.getSessionProtocol().loadRevisionByVersion(id, referenceChunk, version); } @Override protected List<InternalCDORevision> loadRevisions(Collection<CDOID> ids, int referenceChunk) { - CDOClientProtocol protocol = (CDOClientProtocol)session.getProtocol(); - return send(new LoadRevisionRequest(protocol, ids, referenceChunk)); + return session.getSessionProtocol().loadRevisions(ids, referenceChunk); } @Override protected List<InternalCDORevision> loadRevisionsByTime(Collection<CDOID> ids, int referenceChunk, long timeStamp) { - CDOClientProtocol protocol = (CDOClientProtocol)session.getProtocol(); - return send(new LoadRevisionByTimeRequest(protocol, ids, referenceChunk, timeStamp)); + return session.getSessionProtocol().loadRevisionsByTime(ids, referenceChunk, timeStamp); } /** @@ -143,41 +130,4 @@ public class CDORevisionManagerImpl extends CDORevisionResolverImpl implements C { return session.getPackageManager(); } - - private List<InternalCDORevision> send(LoadRevisionRequest request) - { - try - { - LOADING.start(request); - return request.send(); - } - catch (RuntimeException ex) - { - throw ex; - } - catch (Exception ex) - { - throw new TransportException(ex); - } - finally - { - LOADING.stop(request); - } - } - - /** - * @since 2.0 - */ - public CDOFetchRuleManager getRuleManager() - { - return ruleManager; - } - - /** - * @since 2.0 - */ - public void setRuleManager(CDOFetchRuleManager ruleManager) - { - this.ruleManager = ruleManager; - } } 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 c566395527..4bd38d7b06 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 @@ -12,29 +12,21 @@ package org.eclipse.emf.internal.cdo.session; 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.net4j.connector.IConnector; -import org.eclipse.net4j.signal.failover.IFailOverStrategy; -import org.eclipse.net4j.signal.failover.NOOPFailOverStrategy; -import org.eclipse.net4j.util.CheckUtil; - import org.eclipse.emf.spi.cdo.InternalCDOSession; /** * @author Eike Stepper */ -public class CDOSessionConfigurationImpl implements CDOSessionConfiguration +public abstract class CDOSessionConfigurationImpl implements CDOSessionConfiguration { private InternalCDOSession session; - private IConnector connector; - private String repositoryName; - private IFailOverStrategy failOverStrategy; - private CDOPackageRegistry packageRegistry; private CDORevisionCache revisionCache; @@ -45,17 +37,6 @@ public class CDOSessionConfigurationImpl implements CDOSessionConfiguration { } - public IConnector getConnector() - { - return connector; - } - - public void setConnector(IConnector connector) - { - checkNotOpen(); - this.connector = connector; - } - public String getRepositoryName() { return repositoryName; @@ -67,17 +48,6 @@ public class CDOSessionConfigurationImpl implements CDOSessionConfiguration this.repositoryName = repositoryName; } - public IFailOverStrategy getFailOverStrategy() - { - return failOverStrategy; - } - - public void setFailOverStrategy(IFailOverStrategy failOverStrategy) - { - checkNotOpen(); - this.failOverStrategy = failOverStrategy; - } - /** * @since 2.0 */ @@ -139,26 +109,30 @@ public class CDOSessionConfigurationImpl implements CDOSessionConfiguration this.activateOnOpen = activateOnOpen; } + public boolean isSessionOpen() + { + if (session == null) + { + return false; + } + + if (!session.isClosed()) + { + return true; + } + + session = null; + return false; + } + /** * @since 2.0 */ - public InternalCDOSession openSession() + public CDOSession openSession() { - CheckUtil.checkState(connector != null ^ failOverStrategy != null, - "Specify exactly one of connector or failOverStrategy"); - if (!isSessionOpen()) { - session = SessionUtil.createSession(); - if (connector != null) - { - session.getProtocol().setFailOverStrategy(new NOOPFailOverStrategy(connector)); - } - else - { - session.getProtocol().setFailOverStrategy(failOverStrategy); - } - + session = createSession(); session.setRepositoryName(repositoryName); session.setPackageRegistry(packageRegistry); session.getRevisionManager().setCache(revisionCache); @@ -172,27 +146,13 @@ public class CDOSessionConfigurationImpl implements CDOSessionConfiguration return session; } - public boolean isSessionOpen() - { - if (session == null) - { - return false; - } - - if (!session.isClosed()) - { - return true; - } - - session = null; - return false; - } - - private void checkNotOpen() + protected void checkNotOpen() { if (isSessionOpen()) { throw new IllegalStateException("Session is already open"); } } + + protected abstract InternalCDOSession createSession(); } diff --git a/plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/internal/cdo/session/CDOSessionFactory.java b/plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/internal/cdo/session/CDOSessionFactory.java index 7bbbe58ca0..1d33461c68 100644 --- a/plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/internal/cdo/session/CDOSessionFactory.java +++ b/plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/internal/cdo/session/CDOSessionFactory.java @@ -14,7 +14,6 @@ import org.eclipse.emf.cdo.session.CDOSession; import org.eclipse.net4j.signal.failover.IFailOverStrategy; import org.eclipse.net4j.util.StringUtil; -import org.eclipse.net4j.util.container.IManagedContainer; import org.eclipse.net4j.util.factory.Factory; import org.eclipse.emf.spi.cdo.InternalCDOSession; @@ -28,17 +27,15 @@ import java.util.StringTokenizer; /** * @author Eike Stepper */ -public class CDOSessionFactory extends Factory +public abstract class CDOSessionFactory extends Factory { public static final String PRODUCT_GROUP = "org.eclipse.emf.cdo.sessions"; - public static final String TYPE = "cdo"; - private static final String TRUE = Boolean.TRUE.toString(); - public CDOSessionFactory() + public CDOSessionFactory(String type) { - super(PRODUCT_GROUP, TYPE); + super(PRODUCT_GROUP, type); } public CDOSession create(String description) @@ -84,27 +81,9 @@ public class CDOSessionFactory extends Factory } } - public static CDOSession get(IManagedContainer container, String description) - { - return (CDOSession)container.getElement(PRODUCT_GROUP, TYPE, description); - } - /** * @since 2.0 */ - public static InternalCDOSession createSession(String repositoryName, boolean automaticPackageRegistry, - IFailOverStrategy failOverStrategy) - { - InternalCDOSession session = SessionUtil.createSession(); - if (automaticPackageRegistry) - { - CDOPackageRegistryImpl.Eager packageRegistry = new CDOPackageRegistryImpl.Eager(); - packageRegistry.setSession(session); - session.setPackageRegistry(packageRegistry); - } - - session.setRepositoryName(repositoryName); - session.getProtocol().setFailOverStrategy(failOverStrategy); - return session; - } + protected abstract InternalCDOSession createSession(String repositoryName, boolean automaticPackageRegistry, + IFailOverStrategy failOverStrategy); } 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 c82642b8e5..19099008d4 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 @@ -43,34 +43,21 @@ 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.protocol.CDOClientProtocol; -import org.eclipse.emf.internal.cdo.protocol.LoadLibrariesRequest; -import org.eclipse.emf.internal.cdo.protocol.OpenSessionRequest; -import org.eclipse.emf.internal.cdo.protocol.OpenSessionResult; -import org.eclipse.emf.internal.cdo.protocol.RepositoryTimeRequest; -import org.eclipse.emf.internal.cdo.protocol.RepositoryTimeResult; -import org.eclipse.emf.internal.cdo.protocol.SetPassiveUpdateRequest; -import org.eclipse.emf.internal.cdo.protocol.SyncRevisionRequest; 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; -import org.eclipse.net4j.channel.IChannel; import org.eclipse.net4j.util.WrappedException; import org.eclipse.net4j.util.ReflectUtil.ExcludeFromDump; import org.eclipse.net4j.util.concurrent.QueueRunner; import org.eclipse.net4j.util.container.Container; import org.eclipse.net4j.util.event.Event; -import org.eclipse.net4j.util.event.EventUtil; -import org.eclipse.net4j.util.event.IListener; 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.ILifecycle; -import org.eclipse.net4j.util.lifecycle.LifecycleEventAdapter; import org.eclipse.net4j.util.lifecycle.LifecycleUtil; import org.eclipse.net4j.util.om.trace.ContextTracer; import org.eclipse.net4j.util.options.IOptions; @@ -86,6 +73,8 @@ import org.eclipse.emf.spi.cdo.InternalCDOSession; import org.eclipse.emf.spi.cdo.InternalCDOTransaction; import org.eclipse.emf.spi.cdo.InternalCDOView; import org.eclipse.emf.spi.cdo.InternalCDOViewSet; +import org.eclipse.emf.spi.cdo.CDOSessionProtocol.OpenSessionResult; +import org.eclipse.emf.spi.cdo.CDOSessionProtocol.RepositoryTimeResult; import java.io.File; import java.io.IOException; @@ -102,24 +91,12 @@ import java.util.Set; /** * @author Eike Stepper */ -public class CDOSessionImpl extends Container<CDOView> implements InternalCDOSession, Repository +public abstract class CDOSessionImpl extends Container<CDOView> implements InternalCDOSession, Repository { private static final ContextTracer TRACER = new ContextTracer(OM.DEBUG_SESSION, CDOSessionImpl.class); private int sessionID; - private CDOClientProtocol protocol; - - @ExcludeFromDump - private IListener protocolListener = new LifecycleEventAdapter() - { - @Override - protected void onDeactivated(ILifecycle lifecycle) - { - close(); - } - }; - private String repositoryName; private String repositoryUUID; @@ -163,13 +140,11 @@ public class CDOSessionImpl extends Container<CDOView> implements InternalCDOSes /** * @since 2.0 */ - protected IOptions options = new OptionsImpl(); + protected IOptions options; public CDOSessionImpl() { - protocol = new CDOClientProtocol(); - protocol.setInfraStructure(this); - + options = createOptions(); packageManager = createPackageManager(); revisionManager = createRevisionManager(); } @@ -182,26 +157,25 @@ public class CDOSessionImpl extends Container<CDOView> implements InternalCDOSes /** * @since 2.0 */ - public Options options() + public OptionsImpl options() { - return (Options)options; + return (OptionsImpl)options; } /** * @since 2.0 */ - public Repository repository() + protected OptionsImpl createOptions() { - return this; + return new OptionsImpl(); } /** * @since 2.0 */ - public String getUserID() + public Repository repository() { - IChannel channel = protocol.getChannel(); - return channel == null ? null : channel.getUserID(); + return this; } public CDOIDObject createCDOIDObject(ExtendedDataInput in) @@ -217,11 +191,6 @@ public class CDOSessionImpl extends Container<CDOView> implements InternalCDOSes return cdoidObjectFactory.createCDOIDObject(in); } - public CDOClientProtocol getProtocol() - { - return protocol; - } - /** * @since 2.0 */ @@ -276,14 +245,7 @@ public class CDOSessionImpl extends Container<CDOView> implements InternalCDOSes private RepositoryTimeResult sendRepositoryTimeRequest() { - try - { - return new RepositoryTimeRequest(protocol).send(); - } - catch (Exception ex) - { - throw WrappedException.wrap(ex); - } + return getSessionProtocol().getRepositoryTime(); } /** @@ -709,8 +671,7 @@ public class CDOSessionImpl extends Container<CDOView> implements InternalCDOSes @Override public String toString() { - IChannel channel = protocol.getChannel(); - return MessageFormat.format("CDOSession[{0}/{1}]", channel, repositoryName); + return MessageFormat.format("CDOSession[{0}, {1}]", repositoryName, sessionID); } /** @@ -774,7 +735,8 @@ public class CDOSessionImpl extends Container<CDOView> implements InternalCDOSes protected void doBeforeActivate() throws Exception { super.doBeforeActivate(); - checkState(repositoryName, "repositoryName == null"); + checkState(getSessionProtocol(), "sessionProtocol"); + checkState(repositoryName, "repositoryName"); } @Override @@ -787,10 +749,8 @@ public class CDOSessionImpl extends Container<CDOView> implements InternalCDOSes } packageRegistry.setSession(this); - protocol.open(); - boolean passiveUpdateEnabled = options().isPassiveUpdateEnabled(); - OpenSessionResult result = new OpenSessionRequest(protocol, repositoryName, passiveUpdateEnabled).send(); + OpenSessionResult result = getSessionProtocol().openSession(repositoryName, options().isPassiveUpdateEnabled()); sessionID = result.getSessionID(); repositoryUUID = result.getRepositoryUUID(); repositoryCreationTime = result.getRepositoryCreationTime(); @@ -801,7 +761,6 @@ public class CDOSessionImpl extends Container<CDOView> implements InternalCDOSes packageManager.addPackageProxies(result.getPackageInfos()); packageManager.activate(); revisionManager.activate(); - EventUtil.addListener(protocol, protocolListener); } @Override @@ -832,10 +791,6 @@ public class CDOSessionImpl extends Container<CDOView> implements InternalCDOSes packageManager.deactivate(); packageManager = null; - - EventUtil.removeListener(protocol, protocolListener); - protocol.close(); - protocol = null; super.doDeactivate(); } @@ -860,7 +815,7 @@ public class CDOSessionImpl extends Container<CDOView> implements InternalCDOSes missingLibraries.removeAll(existingLibraries); if (!missingLibraries.isEmpty()) { - new LoadLibrariesRequest(protocol, missingLibraries, cacheFolder).send(); + getSessionProtocol().loadLibraries(missingLibraries, cacheFolder); } } @@ -948,7 +903,7 @@ public class CDOSessionImpl extends Container<CDOView> implements InternalCDOSes if (!allRevisions.isEmpty()) { int initialChunkSize = options().getCollectionLoadingPolicy().getInitialChunkSize(); - return new SyncRevisionRequest(protocol, this, allRevisions, initialChunkSize).send(); + return getSessionProtocol().syncRevisions(allRevisions, initialChunkSize); } } catch (Exception ex) @@ -1049,18 +1004,10 @@ public class CDOSessionImpl extends Container<CDOView> implements InternalCDOSes // Need to refresh if we change state Map<CDOID, CDORevision> allRevisions = getAllRevisions(); - - try - { - if (!allRevisions.isEmpty()) - { - new SetPassiveUpdateRequest(protocol, CDOSessionImpl.this, allRevisions, collectionLoadingPolicy - .getInitialChunkSize(), passiveUpdateEnabled).send(); - } - } - catch (Exception ex) + if (!allRevisions.isEmpty()) { - throw WrappedException.wrap(ex); + int initialChunkSize = collectionLoadingPolicy.getInitialChunkSize(); + getSessionProtocol().setPassiveUpdate(allRevisions, initialChunkSize, passiveUpdateEnabled); } fireEvent(new PassiveUpdateEventImpl()); 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 index 5328ab5d59..fcf99fce92 100644 --- 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 @@ -18,14 +18,10 @@ 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.common.util.TransportException; import org.eclipse.emf.cdo.internal.common.model.CDOPackageManagerImpl; import org.eclipse.emf.cdo.session.CDOSessionPackageManager; -import org.eclipse.emf.cdo.spi.common.model.InternalCDOPackage; import org.eclipse.emf.internal.cdo.bundle.OM; -import org.eclipse.emf.internal.cdo.protocol.CDOClientProtocol; -import org.eclipse.emf.internal.cdo.protocol.LoadPackageRequest; import org.eclipse.emf.internal.cdo.util.ModelUtil; import org.eclipse.emf.ecore.EClass; @@ -158,22 +154,10 @@ public class CDOSessionPackageManagerImpl extends CDOPackageManagerImpl implemen } } - try - { - CDOClientProtocol protocol = (CDOClientProtocol)session.getProtocol(); - new LoadPackageRequest(protocol, cdoPackage, false).send(); - if (!cdoPackage.isDynamic()) - { - OM.LOG.info("Dynamic package created for " + cdoPackage.getPackageURI()); - } - } - catch (RuntimeException ex) - { - throw ex; - } - catch (Exception ex) + session.getSessionProtocol().loadPackage(cdoPackage, false); + if (!cdoPackage.isDynamic()) { - throw new TransportException(ex); + OM.LOG.info("Dynamic package created for " + cdoPackage.getPackageURI()); } } @@ -182,19 +166,6 @@ public class CDOSessionPackageManagerImpl extends CDOPackageManagerImpl implemen */ public void loadPackageEcore(CDOPackage cdoPackage) { - try - { - CDOClientProtocol protocol = (CDOClientProtocol)session.getProtocol(); - String ecore = new LoadPackageRequest(protocol, cdoPackage, true).send(); - ((InternalCDOPackage)cdoPackage).setEcore(ecore); - } - catch (RuntimeException ex) - { - throw ex; - } - catch (Exception ex) - { - throw new TransportException(ex); - } + 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 6988c73524..573b3efff6 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 @@ -101,9 +101,4 @@ public final class SessionUtil return viewSet; } - - public static CDOSessionImpl createSession() - { - return new CDOSessionImpl(); - } } diff --git a/plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/internal/cdo/transaction/CDOAbstractSavepoint.java b/plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/internal/cdo/transaction/AbstractSavepoint.java index dc9c5edbff..ad4c1b8df2 100644 --- a/plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/internal/cdo/transaction/CDOAbstractSavepoint.java +++ b/plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/internal/cdo/transaction/AbstractSavepoint.java @@ -1,5 +1,5 @@ -/** - * Copyright (c) 2004 - 2009 Eike Stepper (Berlin, Germany) and others. +/*************************************************************************** + * Copyright (c) 2004 - 2008 Eike Stepper, Germany. * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v1.0 * which accompanies this distribution, and is available at @@ -8,7 +8,7 @@ * Contributors: * Simon McDuff - initial API and implementation * Eike Stepper - maintenance - */ + **************************************************************************/ package org.eclipse.emf.internal.cdo.transaction; import org.eclipse.emf.cdo.transaction.CDOSavepoint; @@ -18,15 +18,15 @@ import org.eclipse.emf.cdo.transaction.CDOUserTransaction; * @author Simon McDuff * @since 2.0 */ -public abstract class CDOAbstractSavepoint implements CDOSavepoint +public abstract class AbstractSavepoint implements CDOSavepoint { private CDOUserTransaction userTransaction; - private CDOAbstractSavepoint previousSavepoint; + private AbstractSavepoint previousSavepoint; - private CDOAbstractSavepoint nextSavepoint; + private AbstractSavepoint nextSavepoint; - public CDOAbstractSavepoint(CDOUserTransaction transaction, CDOAbstractSavepoint lastSavepoint) + public AbstractSavepoint(CDOUserTransaction transaction, AbstractSavepoint lastSavepoint) { userTransaction = transaction; previousSavepoint = lastSavepoint; @@ -36,12 +36,12 @@ public abstract class CDOAbstractSavepoint implements CDOSavepoint } } - public void setPreviousSavepoint(CDOAbstractSavepoint previousSavepoint) + public void setPreviousSavepoint(AbstractSavepoint previousSavepoint) { this.previousSavepoint = previousSavepoint; } - public void setNextSavepoint(CDOAbstractSavepoint nextSavepoint) + public void setNextSavepoint(AbstractSavepoint nextSavepoint) { this.nextSavepoint = nextSavepoint; } @@ -56,7 +56,7 @@ public abstract class CDOAbstractSavepoint implements CDOSavepoint return previousSavepoint; } - public CDOAbstractSavepoint getFirstSavePoint() + public AbstractSavepoint getFirstSavePoint() { return previousSavepoint != null ? previousSavepoint.getFirstSavePoint() : this; } diff --git a/plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/internal/cdo/transaction/CDOSavepointImpl.java b/plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/internal/cdo/transaction/CDOSavepointImpl.java index 9f3844baf3..c4822d7068 100644 --- a/plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/internal/cdo/transaction/CDOSavepointImpl.java +++ b/plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/internal/cdo/transaction/CDOSavepointImpl.java @@ -39,7 +39,7 @@ import java.util.concurrent.ConcurrentMap; * @author Simon McDuff * @since 2.0 */ -public class CDOSavepointImpl extends CDOAbstractSavepoint +public class CDOSavepointImpl extends AbstractSavepoint { private Map<CDOID, CDOResource> newResources = new HashMap<CDOID, CDOResource>(); diff --git a/plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/internal/cdo/transaction/CDOSingleTransactionStrategy.java b/plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/internal/cdo/transaction/CDOSingleTransactionStrategyImpl.java index e4b4a58d02..afc2bc7b8e 100644 --- a/plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/internal/cdo/transaction/CDOSingleTransactionStrategy.java +++ b/plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/internal/cdo/transaction/CDOSingleTransactionStrategyImpl.java @@ -1,5 +1,5 @@ -/** - * Copyright (c) 2004 - 2009 Eike Stepper (Berlin, Germany) and others. +/*************************************************************************** + * Copyright (c) 2004 - 2008 Eike Stepper, Germany. * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v1.0 * which accompanies this distribution, and is available at @@ -7,24 +7,22 @@ * * Contributors: * Simon McDuff - initial API and implementation - * Eike Stepper - maintenance - */ + **************************************************************************/ package org.eclipse.emf.internal.cdo.transaction; import org.eclipse.emf.cdo.transaction.CDOSavepoint; import org.eclipse.emf.internal.cdo.bundle.OM; -import org.eclipse.emf.internal.cdo.protocol.CDOClientProtocol; -import org.eclipse.emf.internal.cdo.protocol.CommitTransactionRequest; -import org.eclipse.emf.internal.cdo.protocol.CommitTransactionResult; import org.eclipse.net4j.util.om.monitor.EclipseMonitor; +import org.eclipse.net4j.util.om.monitor.OMMonitor; import org.eclipse.net4j.util.om.trace.ContextTracer; import org.eclipse.net4j.util.transaction.TransactionException; import org.eclipse.emf.spi.cdo.CDOTransactionStrategy; -import org.eclipse.emf.spi.cdo.InternalCDOCommitContext; import org.eclipse.emf.spi.cdo.InternalCDOTransaction; +import org.eclipse.emf.spi.cdo.CDOSessionProtocol.CommitTransactionResult; +import org.eclipse.emf.spi.cdo.InternalCDOTransaction.InternalCDOCommitContext; import org.eclipse.core.runtime.IProgressMonitor; @@ -32,13 +30,14 @@ import org.eclipse.core.runtime.IProgressMonitor; * @author Simon McDuff * @since 2.0 */ -public class CDOSingleTransactionStrategy implements CDOTransactionStrategy +public class CDOSingleTransactionStrategyImpl implements CDOTransactionStrategy { - public static final CDOSingleTransactionStrategy INSTANCE = new CDOSingleTransactionStrategy(); + public static final CDOSingleTransactionStrategyImpl INSTANCE = new CDOSingleTransactionStrategyImpl(); - private static final ContextTracer TRACER = new ContextTracer(OM.DEBUG_TRANSCTION, CDOSingleTransactionStrategy.class); + private static final ContextTracer TRACER = new ContextTracer(OM.DEBUG_TRANSCTION, + CDOSingleTransactionStrategyImpl.class); - public CDOSingleTransactionStrategy() + public CDOSingleTransactionStrategyImpl() { } @@ -51,27 +50,25 @@ public class CDOSingleTransactionStrategy implements CDOTransactionStrategy } commitContext.preCommit(); + CommitTransactionResult result = null; if (commitContext.getTransaction().isDirty()) { - CDOClientProtocol protocol = (CDOClientProtocol)transaction.getSession().getProtocol(); - CommitTransactionRequest request = new CommitTransactionRequest(protocol, commitContext); - if (TRACER.isEnabled()) - { - TRACER.format("Sending commit request"); - } + OMMonitor monitor = new EclipseMonitor(progressMonitor); + result = transaction.getSession().getSessionProtocol().commitTransaction(commitContext, monitor); - result = request.send(new EclipseMonitor(progressMonitor)); String rollbackMessage = result.getRollbackMessage(); if (rollbackMessage != null) { throw new TransactionException(rollbackMessage); } } + if (TRACER.isEnabled()) { TRACER.format("CDOCommitContext.postCommit"); } + commitContext.postCommit(result); } 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 3ac7eb00c0..35d9e2eb07 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 @@ -45,7 +45,6 @@ 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.protocol.CommitTransactionResult; import org.eclipse.emf.internal.cdo.session.CDOSessionPackageManagerImpl; import org.eclipse.emf.internal.cdo.util.CompletePackageClosure; import org.eclipse.emf.internal.cdo.util.FSMUtil; @@ -64,10 +63,10 @@ import org.eclipse.net4j.util.transaction.TransactionException; import org.eclipse.emf.common.util.URI; import org.eclipse.emf.ecore.EPackage; import org.eclipse.emf.spi.cdo.CDOTransactionStrategy; -import org.eclipse.emf.spi.cdo.InternalCDOCommitContext; import org.eclipse.emf.spi.cdo.InternalCDOObject; import org.eclipse.emf.spi.cdo.InternalCDOSession; import org.eclipse.emf.spi.cdo.InternalCDOTransaction; +import org.eclipse.emf.spi.cdo.CDOSessionProtocol.CommitTransactionResult; import org.eclipse.core.runtime.IProgressMonitor; import org.eclipse.core.runtime.NullProgressMonitor; @@ -129,7 +128,7 @@ public class CDOTransactionImpl extends CDOViewImpl implements InternalCDOTransa * @since 2.0 */ @Override - protected OptionsImpl initOptions() + protected OptionsImpl createOptions() { return new OptionsImpl(); } diff --git a/plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/internal/cdo/transaction/CDOXATransactionCommitContext.java b/plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/internal/cdo/transaction/CDOXACommitContextImpl.java index cae57c1c89..b2aca39d28 100644 --- a/plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/internal/cdo/transaction/CDOXATransactionCommitContext.java +++ b/plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/internal/cdo/transaction/CDOXACommitContextImpl.java @@ -1,5 +1,5 @@ -/** - * Copyright (c) 2004 - 2009 Eike Stepper (Berlin, Germany) and others. +/*************************************************************************** + * Copyright (c) 2004 - 2008 Eike Stepper, Germany. * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v1.0 * which accompanies this distribution, and is available at @@ -7,13 +7,11 @@ * * Contributors: * Simon McDuff - initial API and implementation - * Eike Stepper - maintenance - */ + **************************************************************************/ 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.id.CDOIDProvider; import org.eclipse.emf.cdo.common.model.CDOPackage; import org.eclipse.emf.cdo.common.revision.CDOReferenceAdjuster; import org.eclipse.emf.cdo.common.revision.delta.CDORevisionDelta; @@ -21,28 +19,28 @@ import org.eclipse.emf.cdo.eresource.CDOResource; import org.eclipse.emf.cdo.internal.common.id.CDOIDExternalTempImpl; import org.eclipse.emf.cdo.util.CDOUtil; -import org.eclipse.emf.internal.cdo.protocol.CommitTransactionResult; import org.eclipse.emf.internal.cdo.transaction.CDOXATransactionImpl.CDOXAState; import org.eclipse.net4j.util.ImplementationError; import org.eclipse.emf.ecore.InternalEObject; -import org.eclipse.emf.spi.cdo.InternalCDOCommitContext; import org.eclipse.emf.spi.cdo.InternalCDOObject; import org.eclipse.emf.spi.cdo.InternalCDOTransaction; +import org.eclipse.emf.spi.cdo.CDOSessionProtocol.CommitTransactionResult; +import org.eclipse.emf.spi.cdo.InternalCDOTransaction.InternalCDOCommitContext; +import org.eclipse.emf.spi.cdo.InternalCDOXATransaction.InternalCDOXACommitContext; import org.eclipse.core.runtime.IProgressMonitor; import java.util.HashMap; import java.util.List; import java.util.Map; -import java.util.concurrent.Callable; /** * @author Simon McDuff * @since 2.0 */ -public class CDOXATransactionCommitContext implements Callable<Object>, CDOIDProvider, InternalCDOCommitContext +public class CDOXACommitContextImpl implements InternalCDOXACommitContext { private CDOXATransactionImpl transactionManager; @@ -58,7 +56,7 @@ public class CDOXATransactionCommitContext implements Callable<Object>, CDOIDPro private Map<InternalCDOObject, CDOIDExternalTempImpl> objectToID = new HashMap<InternalCDOObject, CDOIDExternalTempImpl>(); - public CDOXATransactionCommitContext(CDOXATransactionImpl manager, InternalCDOCommitContext commitContext) + public CDOXACommitContextImpl(CDOXATransactionImpl manager, InternalCDOCommitContext commitContext) { transactionManager = manager; delegateCommitContext = commitContext; diff --git a/plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/internal/cdo/transaction/CDOXASavepoint.java b/plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/internal/cdo/transaction/CDOXASavepointImpl.java index a4805694d3..575d258511 100644 --- a/plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/internal/cdo/transaction/CDOXASavepoint.java +++ b/plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/internal/cdo/transaction/CDOXASavepointImpl.java @@ -1,5 +1,5 @@ -/** - * Copyright (c) 2004 - 2009 Eike Stepper (Berlin, Germany) and others. +/*************************************************************************** + * Copyright (c) 2004 - 2008 Eike Stepper, Germany. * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v1.0 * which accompanies this distribution, and is available at @@ -7,8 +7,7 @@ * * Contributors: * Simon McDuff - initial API and implementation - * Eike Stepper - maintenance - */ + **************************************************************************/ package org.eclipse.emf.internal.cdo.transaction; import org.eclipse.emf.cdo.transaction.CDOSavepoint; @@ -20,11 +19,11 @@ import java.util.List; * @author Simon McDuff * @since 2.0 */ -public class CDOXASavepoint extends CDOAbstractSavepoint +public class CDOXASavepointImpl extends AbstractSavepoint { private List<CDOSavepoint> savepoints; - public CDOXASavepoint(CDOUserTransaction transaction, CDOAbstractSavepoint lastSavepoint) + public CDOXASavepointImpl(CDOUserTransaction transaction, AbstractSavepoint lastSavepoint) { super(transaction, lastSavepoint); diff --git a/plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/internal/cdo/transaction/CDOXATransactionImpl.java b/plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/internal/cdo/transaction/CDOXATransactionImpl.java index 50414f70ed..a289e23416 100644 --- a/plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/internal/cdo/transaction/CDOXATransactionImpl.java +++ b/plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/internal/cdo/transaction/CDOXATransactionImpl.java @@ -19,24 +19,21 @@ import org.eclipse.emf.cdo.util.CDOUtil; import org.eclipse.emf.cdo.view.CDOView; import org.eclipse.emf.cdo.view.CDOViewSet; -import org.eclipse.emf.internal.cdo.protocol.CDOClientProtocol; -import org.eclipse.emf.internal.cdo.protocol.CommitTransactionCancelRequest; -import org.eclipse.emf.internal.cdo.protocol.CommitTransactionPhase1Request; -import org.eclipse.emf.internal.cdo.protocol.CommitTransactionPhase2Request; -import org.eclipse.emf.internal.cdo.protocol.CommitTransactionPhase3Request; -import org.eclipse.emf.internal.cdo.protocol.CommitTransactionResult; - import org.eclipse.net4j.util.CheckUtil; import org.eclipse.net4j.util.om.monitor.EclipseMonitor; +import org.eclipse.net4j.util.om.monitor.OMMonitor; import org.eclipse.net4j.util.om.monitor.EclipseMonitor.SynchonizedSubProgressMonitor; import org.eclipse.net4j.util.transaction.TransactionException; import org.eclipse.emf.common.notify.Adapter; import org.eclipse.emf.common.notify.Notification; import org.eclipse.emf.common.notify.Notifier; +import org.eclipse.emf.spi.cdo.CDOSessionProtocol; import org.eclipse.emf.spi.cdo.CDOTransactionStrategy; -import org.eclipse.emf.spi.cdo.InternalCDOCommitContext; import org.eclipse.emf.spi.cdo.InternalCDOTransaction; +import org.eclipse.emf.spi.cdo.InternalCDOXATransaction; +import org.eclipse.emf.spi.cdo.CDOSessionProtocol.CommitTransactionResult; +import org.eclipse.emf.spi.cdo.InternalCDOTransaction.InternalCDOCommitContext; import org.eclipse.core.runtime.IProgressMonitor; import org.eclipse.core.runtime.NullProgressMonitor; @@ -85,7 +82,7 @@ import java.util.concurrent.TimeoutException; * @author Simon McDuff * @since 2.0 */ -public class CDOXATransactionImpl implements CDOXATransaction +public class CDOXATransactionImpl implements InternalCDOXATransaction { private List<InternalCDOTransaction> transactions = new ArrayList<InternalCDOTransaction>(); @@ -93,13 +90,13 @@ public class CDOXATransactionImpl implements CDOXATransaction private ExecutorService executorService = Executors.newFixedThreadPool(10); - private Map<InternalCDOTransaction, CDOXATransactionCommitContext> activeContext = new HashMap<InternalCDOTransaction, CDOXATransactionCommitContext>(); + private Map<InternalCDOTransaction, CDOXACommitContextImpl> activeContext = new HashMap<InternalCDOTransaction, CDOXACommitContextImpl>(); private Map<InternalCDOTransaction, Set<CDOID>> requestedCDOID = new HashMap<InternalCDOTransaction, Set<CDOID>>(); - private CDOXASavepoint lastSavepoint = new CDOXASavepoint(this, null); + private CDOXASavepointImpl lastSavepoint = new CDOXASavepointImpl(this, null); - private CDOXASavepoint firstSavepoint = lastSavepoint; + private CDOXASavepointImpl firstSavepoint = lastSavepoint; private CDOTransactionStrategy transactionStrategy = new CDOXATransactionStrategyImpl(); @@ -182,12 +179,12 @@ public class CDOXATransactionImpl implements CDOXATransaction return ids.toArray(new CDOID[ids.size()]); } - public CDOXATransactionCommitContext getCommitContext(CDOTransaction transaction) + public CDOXACommitContextImpl getCommitContext(CDOTransaction transaction) { return activeContext.get(transaction); } - private void send(Collection<CDOXATransactionCommitContext> xaContexts, final IProgressMonitor progressMonitor) + private void send(Collection<CDOXACommitContextImpl> xaContexts, final IProgressMonitor progressMonitor) throws InterruptedException, ExecutionException { progressMonitor.beginTask("", xaContexts.size()); @@ -195,7 +192,7 @@ public class CDOXATransactionImpl implements CDOXATransaction try { List<Future<Object>> futures = new ArrayList<Future<Object>>(); - for (CDOXATransactionCommitContext xaContext : xaContexts) + for (CDOXACommitContextImpl xaContext : xaContexts) { xaContext.setProgressMonitor(new SynchonizedSubProgressMonitor(progressMonitor, 1)); futures.add(executorService.submit(xaContext)); @@ -221,7 +218,7 @@ public class CDOXATransactionImpl implements CDOXATransaction finally { progressMonitor.done(); - for (CDOXATransactionCommitContext xaContext : xaContexts) + for (CDOXACommitContextImpl xaContext : xaContexts) { xaContext.setProgressMonitor(null); } @@ -262,7 +259,7 @@ public class CDOXATransactionImpl implements CDOXATransaction for (InternalCDOTransaction transaction : transactions) { InternalCDOCommitContext context = transaction.createCommitContext(); - CDOXATransactionCommitContext xaContext = new CDOXATransactionCommitContext(this, context); + CDOXACommitContextImpl xaContext = new CDOXACommitContextImpl(this, context); xaContext.setState(CDOXAPhase1State.INSTANCE); activeContext.put(transaction, xaContext); } @@ -281,7 +278,7 @@ public class CDOXATransactionImpl implements CDOXATransaction if (phase < 2) { // Phase 0 and 1 are the only two phases we can cancel. - for (CDOXATransactionCommitContext transaction : activeContext.values()) + for (CDOXACommitContextImpl transaction : activeContext.values()) { transaction.setState(CDOXACancel.INSTANCE); } @@ -307,7 +304,7 @@ public class CDOXATransactionImpl implements CDOXATransaction } } - public CDOXASavepoint getLastSavepoint() + public CDOXASavepointImpl getLastSavepoint() { return lastSavepoint; } @@ -334,7 +331,7 @@ public class CDOXATransactionImpl implements CDOXATransaction throw new IllegalArgumentException("Savepoint isn't valid : " + savepoint); } - CDOXASavepoint savepointSet = (CDOXASavepoint)savepoint; + CDOXASavepointImpl savepointSet = (CDOXASavepointImpl)savepoint; List<CDOSavepoint> savepoints = savepointSet.getSavepoints(); if (savepoints == null) { @@ -344,7 +341,7 @@ public class CDOXATransactionImpl implements CDOXATransaction for (CDOSavepoint indexSavePoint : savepoints) { InternalCDOTransaction transaction = (InternalCDOTransaction)indexSavePoint.getUserTransaction(); - CDOSingleTransactionStrategy.INSTANCE.rollback(transaction, indexSavePoint); + CDOSingleTransactionStrategyImpl.INSTANCE.rollback(transaction, indexSavePoint); } lastSavepoint = savepointSet; @@ -358,11 +355,11 @@ public class CDOXATransactionImpl implements CDOXATransaction for (CDOSavepoint savepoint : savepoints) { InternalCDOTransaction transaction = (InternalCDOTransaction)savepoint.getUserTransaction(); - CDOSingleTransactionStrategy.INSTANCE.setSavepoint(transaction); + CDOSingleTransactionStrategyImpl.INSTANCE.setSavepoint(transaction); } getLastSavepoint().setSavepoints(savepoints); - lastSavepoint = new CDOXASavepoint(this, getLastSavepoint()); + lastSavepoint = new CDOXASavepointImpl(this, getLastSavepoint()); return lastSavepoint; } @@ -440,7 +437,7 @@ public class CDOXATransactionImpl implements CDOXATransaction public static final CDOXAState DONE = new CDOXAState() { @Override - protected void handle(CDOXATransactionCommitContext xaContext, IProgressMonitor progressMonitor) throws Exception + protected void handle(CDOXACommitContextImpl xaContext, IProgressMonitor progressMonitor) throws Exception { progressMonitor.done(); } @@ -454,8 +451,7 @@ public class CDOXATransactionImpl implements CDOXATransaction } } - protected abstract void handle(CDOXATransactionCommitContext xaContext, IProgressMonitor progressMonitor) - throws Exception; + protected abstract void handle(CDOXACommitContextImpl xaContext, IProgressMonitor progressMonitor) throws Exception; }; /** @@ -466,18 +462,18 @@ public class CDOXATransactionImpl implements CDOXATransaction public static final CDOXAPhase1State INSTANCE = new CDOXAPhase1State(); @Override - protected void handle(CDOXATransactionCommitContext xaContext, IProgressMonitor progressMonitor) throws Exception + protected void handle(CDOXACommitContextImpl xaContext, IProgressMonitor progressMonitor) throws Exception { xaContext.preCommit(); CommitTransactionResult result = null; if (xaContext.getTransaction().isDirty()) { - // Phase 1 - CDOClientProtocol protocol = (CDOClientProtocol)xaContext.getTransaction().getSession().getProtocol(); - CommitTransactionPhase1Request request = new CommitTransactionPhase1Request(protocol, xaContext); - result = request.send(new EclipseMonitor(progressMonitor)); + CDOSessionProtocol sessionProtocol = xaContext.getTransaction().getSession().getSessionProtocol(); + OMMonitor monitor = new EclipseMonitor(progressMonitor); + result = sessionProtocol.commitTransactionPhase1(xaContext, monitor); check_result(result); } + xaContext.setResult(result); xaContext.setState(CDOXAPhase2State.INSTANCE); } @@ -495,16 +491,16 @@ public class CDOXATransactionImpl implements CDOXATransaction } @Override - protected void handle(CDOXATransactionCommitContext xaContext, IProgressMonitor progressMonitor) throws Exception + protected void handle(CDOXACommitContextImpl xaContext, IProgressMonitor progressMonitor) throws Exception { if (xaContext.getTransaction().isDirty()) { - // Phase 2 - CDOClientProtocol protocol = (CDOClientProtocol)xaContext.getTransaction().getSession().getProtocol(); - CommitTransactionPhase2Request request = new CommitTransactionPhase2Request(protocol, xaContext); - CommitTransactionResult result = request.send(new EclipseMonitor(progressMonitor)); + CDOSessionProtocol sessionProtocol = xaContext.getTransaction().getSession().getSessionProtocol(); + OMMonitor monitor = new EclipseMonitor(progressMonitor); + CommitTransactionResult result = sessionProtocol.commitTransactionPhase2(xaContext, monitor); check_result(result); } + xaContext.setState(CDOXAPhase3State.INSTANCE); } }; @@ -521,14 +517,13 @@ public class CDOXATransactionImpl implements CDOXATransaction } @Override - protected void handle(CDOXATransactionCommitContext xaContext, IProgressMonitor progressMonitor) throws Exception + protected void handle(CDOXACommitContextImpl xaContext, IProgressMonitor progressMonitor) throws Exception { - // Phase 2 if (xaContext.getTransaction().isDirty()) { - CDOClientProtocol protocol = (CDOClientProtocol)xaContext.getTransaction().getSession().getProtocol(); - CommitTransactionPhase3Request request = new CommitTransactionPhase3Request(protocol, xaContext); - CommitTransactionResult result = request.send(new EclipseMonitor(progressMonitor)); + CDOSessionProtocol sessionProtocol = xaContext.getTransaction().getSession().getSessionProtocol(); + OMMonitor monitor = new EclipseMonitor(progressMonitor); + CommitTransactionResult result = sessionProtocol.commitTransactionPhase3(xaContext, monitor); check_result(result); } xaContext.postCommit(xaContext.getResult()); @@ -548,12 +543,11 @@ public class CDOXATransactionImpl implements CDOXATransaction } @Override - protected void handle(CDOXATransactionCommitContext xaContext, IProgressMonitor progressMonitor) throws Exception + protected void handle(CDOXACommitContextImpl xaContext, IProgressMonitor progressMonitor) throws Exception { - // Phase 2 - CDOClientProtocol protocol = (CDOClientProtocol)xaContext.getTransaction().getSession().getProtocol(); - CommitTransactionCancelRequest request = new CommitTransactionCancelRequest(protocol, xaContext); - CommitTransactionResult result = request.send(new EclipseMonitor(progressMonitor)); + CDOSessionProtocol sessionProtocol = xaContext.getTransaction().getSession().getSessionProtocol(); + OMMonitor monitor = new EclipseMonitor(progressMonitor); + CommitTransactionResult result = sessionProtocol.commitTransactionCancel(xaContext, monitor); check_result(result); } }; diff --git a/plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/internal/cdo/view/CDOAuditImpl.java b/plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/internal/cdo/view/CDOAuditImpl.java index ea65c579f4..d7429993c6 100644 --- a/plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/internal/cdo/view/CDOAuditImpl.java +++ b/plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/internal/cdo/view/CDOAuditImpl.java @@ -17,10 +17,6 @@ import org.eclipse.emf.cdo.spi.common.revision.InternalCDORevision; import org.eclipse.emf.cdo.view.CDOAudit; import org.eclipse.emf.internal.cdo.CDOStateMachine; -import org.eclipse.emf.internal.cdo.protocol.CDOClientProtocol; -import org.eclipse.emf.internal.cdo.protocol.SetAuditRequest; - -import org.eclipse.net4j.util.WrappedException; import org.eclipse.emf.spi.cdo.InternalCDOObject; import org.eclipse.emf.spi.cdo.InternalCDOSession; @@ -64,7 +60,7 @@ public class CDOAuditImpl extends CDOViewImpl implements CDOAudit if (this.timeStamp != timeStamp) { List<InternalCDOObject> invalidObjects = getInvalidObjects(timeStamp); - boolean[] existanceFlags = sendSetAuditRequest(timeStamp, invalidObjects); + boolean[] existanceFlags = getSession().getSessionProtocol().setAudit(getViewID(), timeStamp, invalidObjects); this.timeStamp = timeStamp; int i = 0; @@ -85,19 +81,6 @@ public class CDOAuditImpl extends CDOViewImpl implements CDOAudit } } - private boolean[] sendSetAuditRequest(long timeStamp, List<InternalCDOObject> invalidObjects) - { - try - { - CDOClientProtocol protocol = (CDOClientProtocol)getSession().getProtocol(); - return new SetAuditRequest(protocol, getViewID(), timeStamp, invalidObjects).send(); - } - catch (Exception ex) - { - throw WrappedException.wrap(ex); - } - } - @Override public InternalCDORevision getRevision(CDOID id, boolean loadOnDemand) { 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 45bc8f9fca..d86b87c2f1 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 @@ -58,20 +58,12 @@ import org.eclipse.emf.internal.cdo.CDOStateMachine; import org.eclipse.emf.internal.cdo.CDOStore; import org.eclipse.emf.internal.cdo.CDOURIHandler; import org.eclipse.emf.internal.cdo.bundle.OM; -import org.eclipse.emf.internal.cdo.protocol.CDOClientProtocol; -import org.eclipse.emf.internal.cdo.protocol.ChangeSubscriptionRequest; -import org.eclipse.emf.internal.cdo.protocol.LockObjectsRequest; -import org.eclipse.emf.internal.cdo.protocol.ObjectLockedRequest; -import org.eclipse.emf.internal.cdo.protocol.UnlockObjectsRequest; -import org.eclipse.emf.internal.cdo.protocol.ViewsChangedRequest; 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.signal.RemoteException; import org.eclipse.net4j.util.ImplementationError; import org.eclipse.net4j.util.StringUtil; -import org.eclipse.net4j.util.WrappedException; import org.eclipse.net4j.util.ReflectUtil.ExcludeFromDump; import org.eclipse.net4j.util.collection.CloseableIterator; import org.eclipse.net4j.util.collection.HashBag; @@ -82,7 +74,6 @@ import org.eclipse.net4j.util.om.trace.ContextTracer; import org.eclipse.net4j.util.options.OptionsEvent; import org.eclipse.net4j.util.ref.ReferenceType; import org.eclipse.net4j.util.ref.ReferenceValueMap; -import org.eclipse.net4j.util.transaction.TransactionException; import org.eclipse.emf.common.notify.Adapter; import org.eclipse.emf.common.notify.Notification; @@ -155,7 +146,7 @@ public class CDOViewImpl extends Lifecycle implements InternalCDOView */ public CDOViewImpl() { - options = initOptions(); + options = createOptions(); } /** @@ -166,14 +157,6 @@ public class CDOViewImpl extends Lifecycle implements InternalCDOView return options; } - /** - * @since 2.0 - */ - protected OptionsImpl initOptions() - { - return new OptionsImpl(); - } - public int getViewID() { return viewID; @@ -286,39 +269,7 @@ public class CDOViewImpl extends Lifecycle implements InternalCDOView throws InterruptedException { checkActive(); - InterruptedException interruptedException = null; - RuntimeException runtimeException = null; - - try - { - CDOClientProtocol protocol = (CDOClientProtocol)getSession().getProtocol(); - new LockObjectsRequest(protocol, this, objects, timeout, lockType).send(); - } - catch (RemoteException ex) - { - if (ex.getCause() instanceof RuntimeException) - { - runtimeException = (RuntimeException)ex.getCause(); - } - else if (ex.getCause() instanceof InterruptedException) - { - interruptedException = (InterruptedException)ex.getCause(); - } - } - catch (Exception ex) - { - throw WrappedException.wrap(ex); - } - - if (interruptedException != null) - { - throw interruptedException; - } - - if (runtimeException != null) - { - throw runtimeException; - } + session.getSessionProtocol().lockObjects(this, objects, timeout, lockType); } /** @@ -327,16 +278,7 @@ public class CDOViewImpl extends Lifecycle implements InternalCDOView public void unlockObjects(Collection<? extends CDOObject> objects, RWLockManager.LockType lockType) { checkActive(); - - try - { - CDOClientProtocol protocol = (CDOClientProtocol)getSession().getProtocol(); - new UnlockObjectsRequest(protocol, this, objects, lockType).send(); - } - catch (Exception ex) - { - throw WrappedException.wrap(ex); - } + session.getSessionProtocol().unlockObjects(this, objects, lockType); } /** @@ -354,16 +296,7 @@ public class CDOViewImpl extends Lifecycle implements InternalCDOView public boolean isObjectLocked(CDOObject object, RWLockManager.LockType lockType) { checkActive(); - - try - { - CDOClientProtocol protocol = (CDOClientProtocol)getSession().getProtocol(); - return new ObjectLockedRequest(protocol, this, object, lockType).send(); - } - catch (Exception ex) - { - throw WrappedException.wrap(ex); - } + return session.getSessionProtocol().isObjectLocked(this, object, lockType); } /** @@ -1451,6 +1384,14 @@ public class CDOViewImpl extends Lifecycle implements InternalCDOView /** * @since 2.0 */ + protected OptionsImpl createOptions() + { + return new OptionsImpl(); + } + + /** + * @since 2.0 + */ @Override protected void doBeforeActivate() throws Exception { @@ -1465,8 +1406,7 @@ public class CDOViewImpl extends Lifecycle implements InternalCDOView @Override protected void doActivate() throws Exception { - CDOClientProtocol protocol = (CDOClientProtocol)getSession().getProtocol(); - new ViewsChangedRequest(protocol, getViewID(), getProtocolViewType(), getTimeStamp()).send(); + session.getSessionProtocol().openView(getViewID(), getProtocolViewType(), getTimeStamp()); } /** @@ -1475,9 +1415,7 @@ public class CDOViewImpl extends Lifecycle implements InternalCDOView @Override protected void doDeactivate() throws Exception { - CDOClientProtocol protocol = (CDOClientProtocol)getSession().getProtocol(); - new ViewsChangedRequest(protocol, getViewID()).send(); - + session.getSessionProtocol().closeView(getViewID()); session.viewDetached(this); session = null; objects = null; @@ -1722,15 +1660,7 @@ public class CDOViewImpl extends Lifecycle implements InternalCDOView protected void request(List<CDOID> cdoIDs, boolean clear, boolean subscribeMode) { - try - { - CDOClientProtocol protocol = (CDOClientProtocol)getSession().getProtocol(); - new ChangeSubscriptionRequest(protocol, getViewID(), cdoIDs, subscribeMode, clear).send(); - } - catch (Exception ex) - { - throw new TransactionException(ex); - } + session.getSessionProtocol().changeSubscription(getViewID(), cdoIDs, subscribeMode, clear); } protected int getNumberOfValidAdapter(InternalCDOObject object) diff --git a/plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/internal/cdo/view/PluginContainerViewProvider.java b/plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/internal/cdo/view/PluginContainerViewProvider.java index f0c6e59037..e8f4d78dc9 100644 --- a/plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/internal/cdo/view/PluginContainerViewProvider.java +++ b/plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/internal/cdo/view/PluginContainerViewProvider.java @@ -50,7 +50,7 @@ public class PluginContainerViewProvider extends ManagedContainerViewProvider im } String repoUUID = CDOURIUtil.extractRepositoryUUID(uri); - for (Object element : container.getElements(CDOSessionFactory.PRODUCT_GROUP, CDOSessionFactory.TYPE)) + for (Object element : container.getElements(CDOSessionFactory.PRODUCT_GROUP)) { CDOSession session = (CDOSession)element; String uuid = session.repository().getUUID(); diff --git a/plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/spi/cdo/CDOObjectConflictResolver.java b/plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/spi/cdo/AbstractObjectConflictResolver.java index 473788d138..b7fefee024 100644 --- a/plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/spi/cdo/CDOObjectConflictResolver.java +++ b/plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/spi/cdo/AbstractObjectConflictResolver.java @@ -1,5 +1,5 @@ -/** - * Copyright (c) 2004 - 2009 Eike Stepper (Berlin, Germany) and others. +/*************************************************************************** + * Copyright (c) 2004 - 2008 Eike Stepper, Germany. * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v1.0 * which accompanies this distribution, and is available at @@ -7,7 +7,7 @@ * * Contributors: * Eike Stepper - initial API and implementation - */ + **************************************************************************/ package org.eclipse.emf.spi.cdo; import org.eclipse.emf.cdo.CDODeltaNotification; @@ -49,11 +49,11 @@ import java.util.Set; * @author Eike Stepper * @since 2.0 */ -public abstract class CDOObjectConflictResolver implements CDOConflictResolver +public abstract class AbstractObjectConflictResolver implements CDOConflictResolver { private CDOTransaction transaction; - public CDOObjectConflictResolver() + public AbstractObjectConflictResolver() { } @@ -140,7 +140,7 @@ public abstract class CDOObjectConflictResolver implements CDOConflictResolver * @author Eike Stepper * @since 2.0 */ - public static class TakeRemoteChangesThenApplyLocalChanges extends CDOObjectConflictResolver + public static class TakeRemoteChangesThenApplyLocalChanges extends AbstractObjectConflictResolver { public TakeRemoteChangesThenApplyLocalChanges() { @@ -158,7 +158,7 @@ public abstract class CDOObjectConflictResolver implements CDOConflictResolver * @author Eike Stepper * @since 2.0 */ - public static abstract class ThreeWayMerge extends CDOObjectConflictResolver implements CDOAdapterPolicy + public static abstract class ThreeWayMerge extends AbstractObjectConflictResolver implements CDOAdapterPolicy { private ChangeSubscriptionAdapter adapter = new ChangeSubscriptionAdapter(); diff --git a/plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/internal/cdo/query/CDOAbstractQueryIteratorImpl.java b/plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/spi/cdo/AbstractQueryIterator.java index 5c04d93ad5..a00efc6f4c 100644 --- a/plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/internal/cdo/query/CDOAbstractQueryIteratorImpl.java +++ b/plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/spi/cdo/AbstractQueryIterator.java @@ -1,5 +1,5 @@ -/** - * Copyright (c) 2004 - 2009 Eike Stepper (Berlin, Germany) and others. +/*************************************************************************** + * Copyright (c) 2004 - 2008 Eike Stepper, Germany. * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v1.0 * which accompanies this distribution, and is available at @@ -7,33 +7,27 @@ * * Contributors: * Simon McDuff - initial API and implementation - * Eike Stepper - maintenance - */ -package org.eclipse.emf.internal.cdo.query; + **************************************************************************/ +package org.eclipse.emf.spi.cdo; import org.eclipse.emf.cdo.common.CDOQueryInfo; import org.eclipse.emf.cdo.spi.common.AbstractQueryResult; import org.eclipse.emf.cdo.view.CDOView; -import org.eclipse.emf.internal.cdo.protocol.CDOClientProtocol; -import org.eclipse.emf.internal.cdo.protocol.QueryCancelRequest; - import org.eclipse.net4j.util.concurrent.ConcurrentValue; -import org.eclipse.emf.spi.cdo.InternalCDOSession; - import java.util.List; /** * @author Simon McDuff */ -public abstract class CDOAbstractQueryIteratorImpl<T> extends AbstractQueryResult<T> +public abstract class AbstractQueryIterator<T> extends AbstractQueryResult<T> { private static final int UNDEFINED_QUERY_ID = -1; private ConcurrentValue<Boolean> queryIDSet = new ConcurrentValue<Boolean>(false); - public CDOAbstractQueryIteratorImpl(CDOView view, CDOQueryInfo queryInfo) + public AbstractQueryIterator(CDOView view, CDOQueryInfo queryInfo) { super(view, queryInfo, UNDEFINED_QUERY_ID); } @@ -77,15 +71,8 @@ public abstract class CDOAbstractQueryIteratorImpl<T> extends AbstractQueryResul super.close(); queryIDSet.reevaluate(); - try - { - CDOClientProtocol protocol = (CDOClientProtocol)((InternalCDOSession)getView().getSession()).getProtocol(); - new QueryCancelRequest(protocol, getQueryID()).send(); - } - catch (Exception ignore) - { - // Catch all exception - } + InternalCDOSession session = (InternalCDOSession)getView().getSession(); + session.getSessionProtocol().cancelQuery(getQueryID()); } } 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 new file mode 100644 index 0000000000..6969b81a4e --- /dev/null +++ b/plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/spi/cdo/CDOSessionProtocol.java @@ -0,0 +1,398 @@ +/*************************************************************************** + * Copyright (c) 2004 - 2008 Eike Stepper, Germany. + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * Eike Stepper - initial API and implementation + **************************************************************************/ +package org.eclipse.emf.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.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.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; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.Set; + +/** + * @author Eike Stepper + */ +public interface CDOSessionProtocol +{ + public OpenSessionResult openSession(String repositoryName, boolean passiveUpdateEnabled); + + public void loadLibraries(Set<String> missingLibraries, File cacheFolder); + + public void setPassiveUpdate(Map<CDOID, CDORevision> allRevisions, int initialChunkSize, boolean passiveUpdateEnabled); + + public RepositoryTimeResult getRepositoryTime(); + + public void loadPackage(CDOPackage cdoPackage, boolean onlyEcore); + + public Object loadChunk(InternalCDORevision revision, CDOFeature feature, int accessIndex, int fetchIndex, + int fromIndex, int toIndex); + + public List<InternalCDORevision> loadRevisions(Collection<CDOID> ids, int referenceChunk); + + public List<InternalCDORevision> loadRevisionsByTime(Collection<CDOID> ids, int referenceChunk, long timeStamp); + + public InternalCDORevision loadRevisionByVersion(CDOID id, int referenceChunk, int version); + + public List<InternalCDORevision> verifyRevision(List<InternalCDORevision> revisions); + + public Collection<CDOTimeStampContext> syncRevisions(Map<CDOID, CDORevision> allRevisions, int initialChunkSize); + + public void openView(int viewId, byte protocolViewType, long timeStamp); + + public void closeView(int viewId); + + public boolean[] setAudit(int viewId, long timeStamp, List<InternalCDOObject> invalidObjects); + + public void changeSubscription(int viewId, List<CDOID> cdoIDs, boolean subscribeMode, boolean clear); + + public List<Object> query(int viewID, AbstractQueryIterator<?> queryResult); + + public boolean cancelQuery(int queryId); + + public void lockObjects(CDOView view, Collection<? extends CDOObject> objects, long timeout, LockType lockType) + throws InterruptedException; + + public void unlockObjects(CDOView view, Collection<? extends CDOObject> objects, LockType lockType); + + public boolean isObjectLocked(CDOView view, CDOObject object, LockType lockType); + + public CommitTransactionResult commitTransaction(InternalCDOCommitContext commitContext, OMMonitor monitor); + + public CommitTransactionResult commitTransactionPhase1(InternalCDOXACommitContext xaContext, OMMonitor monitor); + + public CommitTransactionResult commitTransactionPhase2(InternalCDOXACommitContext xaContext, OMMonitor monitor); + + public CommitTransactionResult commitTransactionPhase3(InternalCDOXACommitContext xaContext, OMMonitor monitor); + + public CommitTransactionResult commitTransactionCancel(InternalCDOXACommitContext xaContext, OMMonitor monitor); + + /** + * @author Eike Stepper + */ + public final class OpenSessionResult implements CDOPackageURICompressor + { + private int sessionID; + + private String repositoryUUID; + + private long repositoryCreationTime; + + private RepositoryTimeResult repositoryTimeResult; + + private boolean repositorySupportingAudits; + + private CDOIDLibraryDescriptor libraryDescriptor; + + private List<CDOPackageInfo> packageInfos = new ArrayList<CDOPackageInfo>(); + + private StringCompressor compressor = new StringCompressor(true); + + public OpenSessionResult(int sessionID, String repositoryUUID, long repositoryCreationTime, + boolean repositorySupportingAudits, CDOIDLibraryDescriptor libraryDescriptor) + { + this.sessionID = sessionID; + this.repositoryUUID = repositoryUUID; + this.repositoryCreationTime = repositoryCreationTime; + this.repositorySupportingAudits = repositorySupportingAudits; + this.libraryDescriptor = libraryDescriptor; + } + + public int getSessionID() + { + return sessionID; + } + + public String getRepositoryUUID() + { + return repositoryUUID; + } + + public long getRepositoryCreationTime() + { + return repositoryCreationTime; + } + + public boolean isRepositorySupportingAudits() + { + return repositorySupportingAudits; + } + + public RepositoryTimeResult getRepositoryTimeResult() + { + return repositoryTimeResult; + } + + public void setRepositoryTimeResult(RepositoryTimeResult repositoryTimeResult) + { + this.repositoryTimeResult = repositoryTimeResult; + } + + public CDOIDLibraryDescriptor getLibraryDescriptor() + { + 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; + } + + /** + * @since 2.0 + */ + public void writePackageURI(ExtendedDataOutput out, String uri) throws IOException + { + compressor.write(out, uri); + } + + /** + * @since 2.0 + */ + public String readPackageURI(ExtendedDataInput in) throws IOException + { + return compressor.read(in); + } + } + + /** + * @author Eike Stepper + */ + public final class RepositoryTimeResult + { + private long requested; + + private long indicated; + + private long responded; + + private long confirmed; + + public RepositoryTimeResult() + { + } + + public long getRequested() + { + return requested; + } + + public void setRequested(long requested) + { + this.requested = requested; + } + + public long getIndicated() + { + return indicated; + } + + public void setIndicated(long indicated) + { + this.indicated = indicated; + } + + public long getResponded() + { + return responded; + } + + public void setResponded(long responded) + { + this.responded = responded; + } + + public long getConfirmed() + { + return confirmed; + } + + public void setConfirmed(long confirmed) + { + this.confirmed = confirmed; + } + + public long getAproximateRepositoryOffset() + { + long latency = confirmed - requested >> 1; + long shift = confirmed - responded; + return shift - latency; + } + + public long getAproximateRepositoryTime() + { + long offset = getAproximateRepositoryOffset(); + return System.currentTimeMillis() + offset; + } + + @Override + public String toString() + { + return MessageFormat + .format( + "RepositoryTime[requested={0,date} {0,time}, indicated={1,date} {1,time}, responded={2,date} {2,time}, confirmed={3,date} {3,time}]", + requested, indicated, responded, confirmed); + } + } + + /** + * @author Eike Stepper + */ + public final class CommitTransactionResult + { + private String rollbackMessage; + + private long timeStamp; + + private Map<CDOIDTemp, CDOID> idMappings = new HashMap<CDOIDTemp, CDOID>(); + + private CDOReferenceAdjuster referenceAdjuster; + + private InternalCDOCommitContext commitContext; + + public CommitTransactionResult(InternalCDOCommitContext commitContext, String rollbackMessage) + { + this.rollbackMessage = rollbackMessage; + this.commitContext = commitContext; + } + + public CommitTransactionResult(InternalCDOCommitContext commitContext, long timeStamp) + { + this.timeStamp = timeStamp; + this.commitContext = commitContext; + } + + public CDOReferenceAdjuster getReferenceAdjuster() + { + if (referenceAdjuster == null) + { + referenceAdjuster = createReferenceAdjuster(); + } + + return referenceAdjuster; + } + + public void setReferenceAdjuster(CDOReferenceAdjuster referenceAdjuster) + { + this.referenceAdjuster = referenceAdjuster; + } + + public InternalCDOCommitContext getCommitContext() + { + return commitContext; + } + + public String getRollbackMessage() + { + return rollbackMessage; + } + + public long getTimeStamp() + { + return timeStamp; + } + + public Map<CDOIDTemp, CDOID> getIDMappings() + { + return idMappings; + } + + public void addIDMapping(CDOIDTemp oldID, CDOID newID) + { + idMappings.put(oldID, newID); + } + + protected PostCommitReferenceAdjuster createReferenceAdjuster() + { + return new PostCommitReferenceAdjuster(commitContext.getTransaction(), new CDOIDMapper(idMappings)); + } + + /** + * @author Simon McDuff + */ + protected static class PostCommitReferenceAdjuster implements CDOReferenceAdjuster + { + private CDOIDProvider idProvider; + + private CDOIDMapper idMapper; + + public PostCommitReferenceAdjuster(CDOIDProvider idProvider, CDOIDMapper idMapper) + { + this.idProvider = idProvider; + this.idMapper = idMapper; + } + + public CDOIDProvider getIdProvider() + { + return idProvider; + } + + public CDOIDMapper getIdMapper() + { + return idMapper; + } + + public Object adjustReference(Object id) + { + if (id == null) + { + return null; + } + + if (idProvider != null && (id instanceof CDOID || id instanceof InternalEObject)) + { + id = idProvider.provideCDOID(id); + } + + return idMapper.adjustReference(id); + } + } + } +} diff --git a/plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/spi/cdo/CDOTransactionStrategy.java b/plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/spi/cdo/CDOTransactionStrategy.java index 30f14f34b6..af3d83ed82 100644 --- a/plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/spi/cdo/CDOTransactionStrategy.java +++ b/plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/spi/cdo/CDOTransactionStrategy.java @@ -13,22 +13,29 @@ package org.eclipse.emf.spi.cdo; import org.eclipse.emf.cdo.transaction.CDOSavepoint; -import org.eclipse.emf.internal.cdo.transaction.CDOSingleTransactionStrategy; +import org.eclipse.emf.internal.cdo.transaction.CDOSingleTransactionStrategyImpl; + +import org.eclipse.net4j.util.om.monitor.OMMonitor; import org.eclipse.core.runtime.IProgressMonitor; /** + * TODO Simon: JavaDoc + * * @author Simon McDuff * @since 2.0 */ public interface CDOTransactionStrategy { - public static final CDOTransactionStrategy DEFAULT = CDOSingleTransactionStrategy.INSTANCE; + public static final CDOTransactionStrategy DEFAULT = CDOSingleTransactionStrategyImpl.INSTANCE; public void setTarget(InternalCDOTransaction transaction); public void unsetTarget(InternalCDOTransaction transaction); + /** + * TODO Better use an {@link OMMonitor}? + */ public void commit(InternalCDOTransaction transaction, IProgressMonitor progressMonitor) throws Exception; public void rollback(InternalCDOTransaction transaction, CDOSavepoint savepoint); diff --git a/plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/spi/cdo/InternalCDOCommitContext.java b/plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/spi/cdo/InternalCDOCommitContext.java deleted file mode 100644 index 34142879c6..0000000000 --- a/plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/spi/cdo/InternalCDOCommitContext.java +++ /dev/null @@ -1,31 +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: - * Simon McDuff - initial API and implementation - * Eike Stepper - maintenance - */ -package org.eclipse.emf.spi.cdo; - -import org.eclipse.emf.cdo.transaction.CDOCommitContext; - -import org.eclipse.emf.internal.cdo.protocol.CommitTransactionResult; - -/** - * Provides a context for a commit operation. - * - * @author Simon McDuff - * @since 2.0 - */ -public interface InternalCDOCommitContext extends CDOCommitContext -{ - public InternalCDOTransaction getTransaction(); - - public void preCommit(); - - public void postCommit(CommitTransactionResult result); -} 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 6117bc0168..cbb5a23a05 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 @@ -18,7 +18,6 @@ import org.eclipse.emf.cdo.common.model.CDOPackageURICompressor; 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.session.CDOSessionProtocol; import org.eclipse.net4j.util.lifecycle.ILifecycle; @@ -35,7 +34,7 @@ import java.util.Set; public interface InternalCDOSession extends CDOSession, CDOIDObjectFactory, CDOPackageURICompressor, ILifecycle.Introspection { - public CDOSessionProtocol getProtocol(); + public CDOSessionProtocol getSessionProtocol(); public void setRepositoryName(String repositoryName); diff --git a/plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/spi/cdo/InternalCDOTransaction.java b/plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/spi/cdo/InternalCDOTransaction.java index 6c1f5ed4bd..a1b38ac82e 100644 --- a/plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/spi/cdo/InternalCDOTransaction.java +++ b/plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/spi/cdo/InternalCDOTransaction.java @@ -16,9 +16,12 @@ import org.eclipse.emf.cdo.common.id.CDOIDTemp; import org.eclipse.emf.cdo.common.revision.delta.CDOFeatureDelta; import org.eclipse.emf.cdo.common.revision.delta.CDORevisionDelta; import org.eclipse.emf.cdo.eresource.CDOResourceFolder; +import org.eclipse.emf.cdo.transaction.CDOCommitContext; import org.eclipse.emf.cdo.transaction.CDOSavepoint; import org.eclipse.emf.cdo.transaction.CDOTransaction; +import org.eclipse.emf.spi.cdo.CDOSessionProtocol.CommitTransactionResult; + import java.util.List; import java.util.Set; @@ -58,4 +61,18 @@ public interface InternalCDOTransaction extends CDOTransaction, InternalCDOView public void setConflict(InternalCDOObject object); public void handleConflicts(Set<CDOObject> conflicts); + + /** + * Provides a context for a commit operation. + * + * @author Simon McDuff + */ + public interface InternalCDOCommitContext extends CDOCommitContext + { + public InternalCDOTransaction getTransaction(); + + public void preCommit(); + + public void postCommit(CommitTransactionResult result); + } } diff --git a/plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/spi/cdo/InternalCDOXATransaction.java b/plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/spi/cdo/InternalCDOXATransaction.java new file mode 100644 index 0000000000..227b552364 --- /dev/null +++ b/plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/spi/cdo/InternalCDOXATransaction.java @@ -0,0 +1,44 @@ +/*************************************************************************** + * Copyright (c) 2004 - 2008 Eike Stepper, Germany. + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * Eike Stepper - initial API and implementation + **************************************************************************/ +package org.eclipse.emf.spi.cdo; + +import org.eclipse.emf.cdo.common.id.CDOIDProvider; +import org.eclipse.emf.cdo.internal.common.id.CDOIDExternalTempImpl; +import org.eclipse.emf.cdo.transaction.CDOTransaction; +import org.eclipse.emf.cdo.transaction.CDOXATransaction; + +import org.eclipse.emf.spi.cdo.CDOSessionProtocol.CommitTransactionResult; +import org.eclipse.emf.spi.cdo.InternalCDOTransaction.InternalCDOCommitContext; + +import java.util.Map; +import java.util.concurrent.Callable; + +/** + * @author Eike Stepper + * @since 2.0 + */ +public interface InternalCDOXATransaction extends CDOXATransaction +{ + public InternalCDOXACommitContext getCommitContext(CDOTransaction transaction); + + /** + * @author Eike Stepper + * @since 2.0 + */ + public interface InternalCDOXACommitContext extends Callable<Object>, CDOIDProvider, InternalCDOCommitContext + { + public InternalCDOXATransaction getTransactionManager(); + + public Map<CDOIDExternalTempImpl, InternalCDOTransaction> getRequestedIDs(); + + public CommitTransactionResult getResult(); + } +} |