Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorEike Stepper2009-07-11 06:09:52 -0400
committerEike Stepper2009-07-11 06:09:52 -0400
commit4c6ec329bfde3863529cc7d50a2fd3b0bf02e7e8 (patch)
tree1a3c4caab3f92a57359b6aa6aee42acec4f9b301
parentf23f820913cb091abf7c41dba649ae194f29b94a (diff)
downloadcdo-4c6ec329bfde3863529cc7d50a2fd3b0bf02e7e8.tar.gz
cdo-4c6ec329bfde3863529cc7d50a2fd3b0bf02e7e8.tar.xz
cdo-4c6ec329bfde3863529cc7d50a2fd3b0bf02e7e8.zip
[282481] Provide an EmbeddedSessionProtocol
https://bugs.eclipse.org/bugs/show_bug.cgi?id=282481
-rw-r--r--plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/spi/common/revision/InternalCDORevisionManager.java4
-rw-r--r--plugins/org.eclipse.emf.cdo.defs/src/org/eclipse/emf/cdo/defs/CDODefsPackage.java8
-rw-r--r--plugins/org.eclipse.emf.cdo.defs/src/org/eclipse/emf/cdo/defs/CDOSessionDef.java12
-rw-r--r--plugins/org.eclipse.emf.cdo.defs/src/org/eclipse/emf/cdo/defs/impl/CDOSessionDefImpl.java6
-rw-r--r--plugins/org.eclipse.emf.cdo.net4j/plugin.xml11
-rw-r--r--plugins/org.eclipse.emf.cdo.net4j/src/org/eclipse/emf/cdo/internal/net4j/CDONet4jSessionConfigurationImpl.java131
-rw-r--r--plugins/org.eclipse.emf.cdo.net4j/src/org/eclipse/emf/cdo/internal/net4j/CDONet4jSessionImpl.java36
-rw-r--r--plugins/org.eclipse.emf.cdo.net4j/src/org/eclipse/emf/cdo/internal/net4j/FailOverStrategyInjector.java88
-rw-r--r--plugins/org.eclipse.emf.cdo.net4j/src/org/eclipse/emf/cdo/internal/net4j/protocol/AuthenticationIndication.java3
-rw-r--r--plugins/org.eclipse.emf.cdo.server.net4j/src/org/eclipse/emf/cdo/server/internal/net4j/protocol/CDOServerIndication.java2
-rw-r--r--plugins/org.eclipse.emf.cdo.server.net4j/src/org/eclipse/emf/cdo/server/internal/net4j/protocol/CommitTransactionIndication.java2
-rw-r--r--plugins/org.eclipse.emf.cdo.server.net4j/src/org/eclipse/emf/cdo/server/internal/net4j/protocol/OpenSessionIndication.java2
-rw-r--r--plugins/org.eclipse.emf.cdo.server/src/org/eclipse/emf/cdo/internal/server/Repository.java2
-rw-r--r--plugins/org.eclipse.emf.cdo.server/src/org/eclipse/emf/cdo/internal/server/RepositoryConfigurator.java4
-rw-r--r--plugins/org.eclipse.emf.cdo.server/src/org/eclipse/emf/cdo/internal/server/embedded/EmbeddedClientSession.java80
-rw-r--r--plugins/org.eclipse.emf.cdo.server/src/org/eclipse/emf/cdo/internal/server/embedded/EmbeddedClientSessionConfiguration.java59
-rw-r--r--plugins/org.eclipse.emf.cdo.server/src/org/eclipse/emf/cdo/internal/server/embedded/EmbeddedClientSessionProtocol.java6
-rw-r--r--plugins/org.eclipse.emf.cdo.server/src/org/eclipse/emf/cdo/server/CDOServerUtil.java2
-rw-r--r--plugins/org.eclipse.emf.cdo.server/src/org/eclipse/emf/cdo/server/RepositoryNotFoundException.java2
-rw-r--r--plugins/org.eclipse.emf.cdo.tests/src/org/eclipse/emf/cdo/tests/AuditTest.java24
-rw-r--r--plugins/org.eclipse.emf.cdo.tests/src/org/eclipse/emf/cdo/tests/InitialTest.java16
-rw-r--r--plugins/org.eclipse.emf.cdo.tests/src/org/eclipse/emf/cdo/tests/SavePointTest.java4
-rw-r--r--plugins/org.eclipse.emf.cdo.tests/src/org/eclipse/emf/cdo/tests/SessionTest.java2
-rw-r--r--plugins/org.eclipse.emf.cdo.tests/src/org/eclipse/emf/cdo/tests/StateMachineTest.java2
-rw-r--r--plugins/org.eclipse.emf.cdo.tests/src/org/eclipse/emf/cdo/tests/bugzilla/Bugzilla_252214_Test.java4
-rw-r--r--plugins/org.eclipse.emf.cdo.tests/src/org/eclipse/emf/cdo/tests/config/impl/ConfigTest.java10
-rw-r--r--plugins/org.eclipse.emf.cdo.ui/src/org/eclipse/emf/cdo/internal/ui/CDOEditorInputImpl.java4
-rw-r--r--plugins/org.eclipse.emf.cdo.ui/src/org/eclipse/emf/cdo/ui/CDOItemProvider.java2
-rw-r--r--plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/cdo/session/CDORepositoryInfo.java53
-rw-r--r--plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/cdo/session/CDOSession.java67
-rw-r--r--plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/cdo/session/CDOSessionConfiguration.java12
-rw-r--r--plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/cdo/util/CDOURIUtil.java2
-rw-r--r--plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/cdo/util/CDOUtil.java2
-rw-r--r--plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/internal/cdo/CDOObjectImpl.java2
-rw-r--r--plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/internal/cdo/CDOURIHandler.java2
-rw-r--r--plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/internal/cdo/messages/messages.properties5
-rw-r--r--plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/internal/cdo/session/CDOSessionConfigurationImpl.java73
-rw-r--r--plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/internal/cdo/session/CDOSessionImpl.java313
-rw-r--r--plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/internal/cdo/view/CDOViewSetImpl.java4
-rw-r--r--plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/internal/cdo/view/PluginContainerViewProvider.java2
-rw-r--r--plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/spi/cdo/CDOSessionProtocol.java2
-rw-r--r--plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/spi/cdo/InternalCDOSession.java35
-rw-r--r--plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/spi/cdo/InternalCDOSessionConfiguration.java28
43 files changed, 518 insertions, 612 deletions
diff --git a/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/spi/common/revision/InternalCDORevisionManager.java b/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/spi/common/revision/InternalCDORevisionManager.java
index 04122b3502..1483c368d0 100644
--- a/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/spi/common/revision/InternalCDORevisionManager.java
+++ b/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/spi/common/revision/InternalCDORevisionManager.java
@@ -15,6 +15,8 @@ import org.eclipse.emf.cdo.common.revision.CDORevisionFactory;
import org.eclipse.emf.cdo.common.revision.CDORevisionManager;
import org.eclipse.emf.cdo.common.revision.cache.CDORevisionCache;
+import org.eclipse.net4j.util.lifecycle.ILifecycle;
+
import java.util.Collection;
import java.util.List;
@@ -22,7 +24,7 @@ import java.util.List;
* @author Eike Stepper
* @since 3.0
*/
-public interface InternalCDORevisionManager extends CDORevisionManager
+public interface InternalCDORevisionManager extends CDORevisionManager, ILifecycle
{
public RevisionLoader getRevisionLoader();
diff --git a/plugins/org.eclipse.emf.cdo.defs/src/org/eclipse/emf/cdo/defs/CDODefsPackage.java b/plugins/org.eclipse.emf.cdo.defs/src/org/eclipse/emf/cdo/defs/CDODefsPackage.java
index f63d9c4ae3..f40ddebb99 100644
--- a/plugins/org.eclipse.emf.cdo.defs/src/org/eclipse/emf/cdo/defs/CDODefsPackage.java
+++ b/plugins/org.eclipse.emf.cdo.defs/src/org/eclipse/emf/cdo/defs/CDODefsPackage.java
@@ -172,7 +172,7 @@ public interface CDODefsPackage extends EPackage
int CDO_SESSION_DEF__CONNECTOR_DEF = Net4jUtilDefsPackage.DEF_FEATURE_COUNT + 0;
/**
- * The feature id for the '<em><b>Repository Name</b></em>' attribute. <!-- begin-user-doc --> <!-- end-user-doc -->
+ * The feature id for the '<em><b>CDORepositoryInfo Name</b></em>' attribute. <!-- begin-user-doc --> <!-- end-user-doc -->
*
* @generated
* @ordered
@@ -597,9 +597,9 @@ public interface CDODefsPackage extends EPackage
/**
* Returns the meta object for the attribute '{@link org.eclipse.emf.cdo.defs.CDOSessionDef#getRepositoryName
- * <em>Repository Name</em>}'. <!-- begin-user-doc --> <!-- end-user-doc -->
+ * <em>CDORepositoryInfo Name</em>}'. <!-- begin-user-doc --> <!-- end-user-doc -->
*
- * @return the meta object for the attribute '<em>Repository Name</em>'.
+ * @return the meta object for the attribute '<em>CDORepositoryInfo Name</em>'.
* @see org.eclipse.emf.cdo.defs.CDOSessionDef#getRepositoryName()
* @see #getCDOSessionDef()
* @generated
@@ -925,7 +925,7 @@ public interface CDODefsPackage extends EPackage
EReference CDO_SESSION_DEF__CONNECTOR_DEF = eINSTANCE.getCDOSessionDef_ConnectorDef();
/**
- * The meta object literal for the '<em><b>Repository Name</b></em>' attribute feature. <!-- begin-user-doc --> <!--
+ * The meta object literal for the '<em><b>CDORepositoryInfo Name</b></em>' attribute feature. <!-- begin-user-doc --> <!--
* end-user-doc -->
*
* @generated
diff --git a/plugins/org.eclipse.emf.cdo.defs/src/org/eclipse/emf/cdo/defs/CDOSessionDef.java b/plugins/org.eclipse.emf.cdo.defs/src/org/eclipse/emf/cdo/defs/CDOSessionDef.java
index 5ab2c0f13b..cd5e39baa8 100644
--- a/plugins/org.eclipse.emf.cdo.defs/src/org/eclipse/emf/cdo/defs/CDOSessionDef.java
+++ b/plugins/org.eclipse.emf.cdo.defs/src/org/eclipse/emf/cdo/defs/CDOSessionDef.java
@@ -20,7 +20,7 @@ import org.eclipse.net4j.util.defs.Def;
* The following features are supported:
* <ul>
* <li>{@link org.eclipse.emf.cdo.defs.CDOSessionDef#getConnectorDef <em>Connector Def</em>}</li>
- * <li>{@link org.eclipse.emf.cdo.defs.CDOSessionDef#getRepositoryName <em>Repository Name</em>}</li>
+ * <li>{@link org.eclipse.emf.cdo.defs.CDOSessionDef#getRepositoryName <em>CDORepositoryInfo Name</em>}</li>
* <li>{@link org.eclipse.emf.cdo.defs.CDOSessionDef#getCdoPackageRegistryDef <em>Cdo Package Registry Def</em>}</li>
* <li>{@link org.eclipse.emf.cdo.defs.CDOSessionDef#isLegacySupportEnabled <em>Legacy Support Enabled</em>}</li>
* <li>{@link org.eclipse.emf.cdo.defs.CDOSessionDef#getFailOverStrategyDef <em>Fail Over Strategy Def</em>}</li>
@@ -88,14 +88,14 @@ public interface CDOSessionDef extends Def
boolean isSetConnectorDef();
/**
- * Returns the value of the '<em><b>Repository Name</b></em>' attribute. <!-- begin-user-doc -->
+ * Returns the value of the '<em><b>CDORepositoryInfo Name</b></em>' attribute. <!-- begin-user-doc -->
* <p>
- * If the meaning of the '<em>Repository Name</em>' attribute isn't clear, there really should be more of a
+ * If the meaning of the '<em>CDORepositoryInfo Name</em>' attribute isn't clear, there really should be more of a
* description here...
* </p>
* <!-- end-user-doc -->
*
- * @return the value of the '<em>Repository Name</em>' attribute.
+ * @return the value of the '<em>CDORepositoryInfo Name</em>' attribute.
* @see #setRepositoryName(String)
* @see org.eclipse.emf.cdo.defs.CDODefsPackage#getCDOSessionDef_RepositoryName()
* @model unique="false" required="true" ordered="false"
@@ -104,11 +104,11 @@ public interface CDOSessionDef extends Def
String getRepositoryName();
/**
- * Sets the value of the '{@link org.eclipse.emf.cdo.defs.CDOSessionDef#getRepositoryName <em>Repository Name</em>}'
+ * Sets the value of the '{@link org.eclipse.emf.cdo.defs.CDOSessionDef#getRepositoryName <em>CDORepositoryInfo Name</em>}'
* attribute. <!-- begin-user-doc --> <!-- end-user-doc -->
*
* @param value
- * the new value of the '<em>Repository Name</em>' attribute.
+ * the new value of the '<em>CDORepositoryInfo Name</em>' attribute.
* @see #getRepositoryName()
* @generated
*/
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 4b1884b658..5fcd001aea 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
@@ -40,7 +40,7 @@ import org.eclipse.emf.ecore.impl.ENotificationImpl;
* The following features are implemented:
* <ul>
* <li>{@link org.eclipse.emf.cdo.defs.impl.CDOSessionDefImpl#getConnectorDef <em>Connector Def</em>}</li>
- * <li>{@link org.eclipse.emf.cdo.defs.impl.CDOSessionDefImpl#getRepositoryName <em>Repository Name</em>}</li>
+ * <li>{@link org.eclipse.emf.cdo.defs.impl.CDOSessionDefImpl#getRepositoryName <em>CDORepositoryInfo Name</em>}</li>
* <li>{@link org.eclipse.emf.cdo.defs.impl.CDOSessionDefImpl#getCdoPackageRegistryDef <em>Cdo Package Registry Def
* </em>}</li>
* <li>{@link org.eclipse.emf.cdo.defs.impl.CDOSessionDefImpl#isLegacySupportEnabled <em>Legacy Support Enabled</em>}</li>
@@ -71,7 +71,7 @@ public class CDOSessionDefImpl extends DefImpl implements CDOSessionDef
protected boolean connectorDefESet;
/**
- * The default value of the '{@link #getRepositoryName() <em>Repository Name</em>}' attribute. <!-- begin-user-doc -->
+ * The default value of the '{@link #getRepositoryName() <em>CDORepositoryInfo Name</em>}' attribute. <!-- begin-user-doc -->
* <!-- end-user-doc -->
*
* @see #getRepositoryName()
@@ -81,7 +81,7 @@ public class CDOSessionDefImpl extends DefImpl implements CDOSessionDef
protected static final String REPOSITORY_NAME_EDEFAULT = null;
/**
- * The cached value of the '{@link #getRepositoryName() <em>Repository Name</em>}' attribute. <!-- begin-user-doc -->
+ * The cached value of the '{@link #getRepositoryName() <em>CDORepositoryInfo Name</em>}' attribute. <!-- begin-user-doc -->
* <!-- end-user-doc -->
*
* @see #getRepositoryName()
diff --git a/plugins/org.eclipse.emf.cdo.net4j/plugin.xml b/plugins/org.eclipse.emf.cdo.net4j/plugin.xml
index dc22e9adaf..4cc9a75d79 100644
--- a/plugins/org.eclipse.emf.cdo.net4j/plugin.xml
+++ b/plugins/org.eclipse.emf.cdo.net4j/plugin.xml
@@ -25,15 +25,4 @@
type="cdo"/>
</extension>
- <extension
- point="org.eclipse.net4j.util.elementProcessors">
- <elementProcessor
- class="org.eclipse.emf.cdo.internal.net4j.FailOverStrategyInjector">
- </elementProcessor>
- </extension>
-
-
-
-
-
</plugin>
diff --git a/plugins/org.eclipse.emf.cdo.net4j/src/org/eclipse/emf/cdo/internal/net4j/CDONet4jSessionConfigurationImpl.java b/plugins/org.eclipse.emf.cdo.net4j/src/org/eclipse/emf/cdo/internal/net4j/CDONet4jSessionConfigurationImpl.java
index f417d5a863..3addebc676 100644
--- a/plugins/org.eclipse.emf.cdo.net4j/src/org/eclipse/emf/cdo/internal/net4j/CDONet4jSessionConfigurationImpl.java
+++ b/plugins/org.eclipse.emf.cdo.net4j/src/org/eclipse/emf/cdo/internal/net4j/CDONet4jSessionConfigurationImpl.java
@@ -11,9 +11,16 @@
package org.eclipse.emf.cdo.internal.net4j;
import org.eclipse.emf.cdo.common.model.CDOPackageRegistry;
+import org.eclipse.emf.cdo.common.model.CDOPackageUnit;
+import org.eclipse.emf.cdo.common.model.EMFUtil;
import org.eclipse.emf.cdo.common.revision.CDORevisionManager;
-import org.eclipse.emf.cdo.net4j.CDOSession;
+import org.eclipse.emf.cdo.eresource.EresourcePackage;
+import org.eclipse.emf.cdo.internal.common.model.CDOPackageRegistryImpl;
+import org.eclipse.emf.cdo.internal.common.revision.CDORevisionManagerImpl;
+import org.eclipse.emf.cdo.internal.net4j.protocol.CDOClientProtocol;
+import org.eclipse.emf.cdo.session.CDORepositoryInfo;
import org.eclipse.emf.cdo.spi.common.model.InternalCDOPackageRegistry;
+import org.eclipse.emf.cdo.spi.common.model.InternalCDOPackageUnit;
import org.eclipse.emf.cdo.spi.common.revision.InternalCDORevisionManager;
import org.eclipse.emf.internal.cdo.session.CDOSessionConfigurationImpl;
@@ -23,7 +30,10 @@ import org.eclipse.net4j.signal.failover.IFailOverStrategy;
import org.eclipse.net4j.signal.failover.NOOPFailOverStrategy;
import org.eclipse.net4j.util.CheckUtil;
+import org.eclipse.emf.ecore.EcorePackage;
import org.eclipse.emf.spi.cdo.InternalCDOSession;
+import org.eclipse.emf.spi.cdo.CDOSessionProtocol.OpenSessionResult;
+import org.eclipse.emf.spi.cdo.CDOSessionProtocol.RepositoryTimeResult;
/**
* @author Eike Stepper
@@ -37,9 +47,9 @@ public class CDONet4jSessionConfigurationImpl extends CDOSessionConfigurationImp
private IFailOverStrategy failOverStrategy;
- private CDOPackageRegistry packageRegistry;
+ private InternalCDOPackageRegistry packageRegistry;
- private CDORevisionManager revisionManager;
+ private InternalCDORevisionManager revisionManager;
public CDONet4jSessionConfigurationImpl()
{
@@ -78,7 +88,7 @@ public class CDONet4jSessionConfigurationImpl extends CDOSessionConfigurationImp
this.failOverStrategy = failOverStrategy;
}
- public CDOPackageRegistry getPackageRegistry()
+ public InternalCDOPackageRegistry getPackageRegistry()
{
return packageRegistry;
}
@@ -86,10 +96,10 @@ public class CDONet4jSessionConfigurationImpl extends CDOSessionConfigurationImp
public void setPackageRegistry(CDOPackageRegistry packageRegistry)
{
checkNotOpen();
- this.packageRegistry = packageRegistry;
+ this.packageRegistry = (InternalCDOPackageRegistry)packageRegistry;
}
- public CDORevisionManager getRevisionManager()
+ public InternalCDORevisionManager getRevisionManager()
{
return revisionManager;
}
@@ -97,7 +107,7 @@ public class CDONet4jSessionConfigurationImpl extends CDOSessionConfigurationImp
public void setRevisionManager(CDORevisionManager revisionManager)
{
checkNotOpen();
- this.revisionManager = revisionManager;
+ this.revisionManager = (InternalCDORevisionManager)revisionManager;
}
@Override
@@ -106,8 +116,7 @@ public class CDONet4jSessionConfigurationImpl extends CDOSessionConfigurationImp
return (org.eclipse.emf.cdo.net4j.CDOSession)super.openSession();
}
- @Override
- protected InternalCDOSession createSession()
+ public InternalCDOSession createSession()
{
if (isActivateOnOpen())
{
@@ -115,32 +124,91 @@ public class CDONet4jSessionConfigurationImpl extends CDOSessionConfigurationImp
"Specify exactly one of connector or failOverStrategy"); //$NON-NLS-1$
}
- CDONet4jSessionImpl session = new CDONet4jSessionImpl();
- session.setPackageRegistry((InternalCDOPackageRegistry)packageRegistry);
- session.setRevisionManager((InternalCDORevisionManager)revisionManager);
- session.setRepository(new TemporaryRepositoryName(repositoryName));
+ return new CDONet4jSessionImpl(this);
+ }
+
+ @Override
+ public void activateSession(InternalCDOSession session) throws Exception
+ {
+ super.activateSession(session);
+ CDOClientProtocol protocol = new CDOClientProtocol();
+ protocol.setInfraStructure(session);
+ session.setSessionProtocol(protocol);
if (connector != null)
{
- session.setFailOverStrategy(new NOOPFailOverStrategy(connector));
+ protocol.setFailOverStrategy(new NOOPFailOverStrategy(connector));
}
else if (failOverStrategy != null)
{
- session.setFailOverStrategy(failOverStrategy);
+ protocol.setFailOverStrategy(failOverStrategy);
+ }
+
+ packageRegistry = new CDOPackageRegistryImpl();
+ packageRegistry.setPackageProcessor(session);
+ packageRegistry.setPackageLoader(session);
+ packageRegistry.activate();
+
+ revisionManager = new CDORevisionManagerImpl();
+ revisionManager.setRevisionLoader(session.getSessionProtocol());
+ revisionManager.setRevisionLocker(session);
+ revisionManager.activate();
+
+ OpenSessionResult result = protocol.openSession(repositoryName, isPassiveUpdateEnabled());
+ session.setSessionID(result.getSessionID());
+ session.setRepositoryInfo(new RepositoryInfo(repositoryName, result));
+ session.setLibraryDescriptor(result.getLibraryDescriptor());
+
+ for (InternalCDOPackageUnit packageUnit : result.getPackageUnits())
+ {
+ if (EcorePackage.eINSTANCE.getNsURI().equals(packageUnit.getID()))
+ {
+ EMFUtil.addAdapter(EcorePackage.eINSTANCE, packageUnit.getTopLevelPackageInfo());
+ packageUnit.setState(CDOPackageUnit.State.LOADED);
+ }
+ else if (EresourcePackage.eINSTANCE.getNsURI().equals(packageUnit.getID()))
+ {
+ EMFUtil.addAdapter(EresourcePackage.eINSTANCE, packageUnit.getTopLevelPackageInfo());
+ packageUnit.setState(CDOPackageUnit.State.LOADED);
+ }
+
+ getPackageRegistry().putPackageUnit(packageUnit);
}
+ }
+
+ @Override
+ public void deactivateSession(InternalCDOSession session) throws Exception
+ {
+ revisionManager.deactivate();
+ revisionManager = null;
+
+ packageRegistry.deactivate();
+ packageRegistry = null;
- return session;
+ super.deactivateSession(session);
}
/**
* @author Eike Stepper
*/
- private static final class TemporaryRepositoryName implements CDOSession.Repository
+ protected class RepositoryInfo implements CDORepositoryInfo
{
private String name;
- public TemporaryRepositoryName(String name)
+ private String uuid;
+
+ private long creationTime;
+
+ private RepositoryTimeResult timeResult;
+
+ private boolean supportingAudits;
+
+ public RepositoryInfo(String name, OpenSessionResult result)
{
this.name = name;
+ uuid = result.getRepositoryUUID();
+ creationTime = result.getRepositoryCreationTime();
+ timeResult = result.getRepositoryTimeResult();
+ supportingAudits = result.isRepositorySupportingAudits();
}
public String getName()
@@ -148,29 +216,42 @@ public class CDONet4jSessionConfigurationImpl extends CDOSessionConfigurationImp
return name;
}
+ /**
+ * Must be callable before session activation has finished!
+ */
+ public String getUUID()
+ {
+ return uuid;
+ }
+
public long getCreationTime()
{
- throw new UnsupportedOperationException();
+ return creationTime;
}
public long getCurrentTime()
{
- throw new UnsupportedOperationException();
+ return getCurrentTime(false);
}
public long getCurrentTime(boolean forceRefresh)
{
- throw new UnsupportedOperationException();
+ if (timeResult == null || forceRefresh)
+ {
+ timeResult = refreshTime();
+ }
+
+ return timeResult.getAproximateRepositoryTime();
}
- public String getUUID()
+ public boolean isSupportingAudits()
{
- throw new UnsupportedOperationException();
+ return supportingAudits;
}
- public boolean isSupportingAudits()
+ private RepositoryTimeResult refreshTime()
{
- throw new UnsupportedOperationException();
+ return getSession().getSessionProtocol().getRepositoryTime();
}
}
}
diff --git a/plugins/org.eclipse.emf.cdo.net4j/src/org/eclipse/emf/cdo/internal/net4j/CDONet4jSessionImpl.java b/plugins/org.eclipse.emf.cdo.net4j/src/org/eclipse/emf/cdo/internal/net4j/CDONet4jSessionImpl.java
index 7eefbe6a20..fd2404633d 100644
--- a/plugins/org.eclipse.emf.cdo.net4j/src/org/eclipse/emf/cdo/internal/net4j/CDONet4jSessionImpl.java
+++ b/plugins/org.eclipse.emf.cdo.net4j/src/org/eclipse/emf/cdo/internal/net4j/CDONet4jSessionImpl.java
@@ -16,13 +16,13 @@
package org.eclipse.emf.cdo.internal.net4j;
import org.eclipse.emf.cdo.internal.net4j.bundle.OM;
-import org.eclipse.emf.cdo.internal.net4j.protocol.CDOClientProtocol;
import org.eclipse.emf.cdo.net4j.CDOSession;
+import org.eclipse.emf.cdo.spi.common.model.InternalCDOPackageRegistry;
+import org.eclipse.emf.cdo.spi.common.revision.InternalCDORevisionManager;
import org.eclipse.emf.internal.cdo.session.CDOSessionImpl;
import org.eclipse.net4j.signal.ISignalProtocol;
-import org.eclipse.net4j.signal.failover.IFailOverStrategy;
import org.eclipse.emf.spi.cdo.CDOSessionProtocol;
@@ -31,15 +31,25 @@ import org.eclipse.emf.spi.cdo.CDOSessionProtocol;
*/
public class CDONet4jSessionImpl extends CDOSessionImpl implements org.eclipse.emf.cdo.net4j.CDOSession
{
- private IFailOverStrategy failOverStrategy;
+ public CDONet4jSessionImpl(CDONet4jSessionConfigurationImpl configuration)
+ {
+ super(configuration);
+ }
- public CDONet4jSessionImpl()
+ @Override
+ public CDONet4jSessionConfigurationImpl getConfiguration()
{
+ return (CDONet4jSessionConfigurationImpl)super.getConfiguration();
}
- public void setFailOverStrategy(IFailOverStrategy failOverStrategy)
+ public InternalCDOPackageRegistry getPackageRegistry()
{
- this.failOverStrategy = failOverStrategy;
+ return getConfiguration().getPackageRegistry();
+ }
+
+ public InternalCDORevisionManager getRevisionManager()
+ {
+ return getConfiguration().getRevisionManager();
}
@Override
@@ -54,15 +64,6 @@ public class CDONet4jSessionImpl extends CDOSessionImpl implements org.eclipse.e
return new OptionsImpl();
}
- @Override
- protected CDOClientProtocol createSessionProtocol()
- {
- CDOClientProtocol protocol = new CDOClientProtocol();
- protocol.setInfraStructure(this);
- protocol.setFailOverStrategy(options().getFailOverStrategy());
- return protocol;
- }
-
/**
* @author Eike Stepper
*/
@@ -77,11 +78,6 @@ public class CDONet4jSessionImpl extends CDOSessionImpl implements org.eclipse.e
{
}
- public IFailOverStrategy getFailOverStrategy()
- {
- return failOverStrategy;
- }
-
public ISignalProtocol<org.eclipse.emf.cdo.net4j.CDOSession> getProtocol()
{
CDOSessionProtocol protocol = getSessionProtocol();
diff --git a/plugins/org.eclipse.emf.cdo.net4j/src/org/eclipse/emf/cdo/internal/net4j/FailOverStrategyInjector.java b/plugins/org.eclipse.emf.cdo.net4j/src/org/eclipse/emf/cdo/internal/net4j/FailOverStrategyInjector.java
deleted file mode 100644
index c334ac86bc..0000000000
--- a/plugins/org.eclipse.emf.cdo.net4j/src/org/eclipse/emf/cdo/internal/net4j/FailOverStrategyInjector.java
+++ /dev/null
@@ -1,88 +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.internal.net4j;
-
-import org.eclipse.emf.cdo.internal.net4j.messages.Messages;
-
-import org.eclipse.net4j.connector.IConnector;
-import org.eclipse.net4j.signal.failover.NOOPFailOverStrategy;
-import org.eclipse.net4j.util.StringUtil;
-import org.eclipse.net4j.util.container.IElementProcessor;
-import org.eclipse.net4j.util.container.IManagedContainer;
-
-import org.eclipse.spi.net4j.ConnectorFactory;
-
-import java.text.MessageFormat;
-
-/**
- * @author Eike Stepper
- */
-public class FailOverStrategyInjector implements IElementProcessor
-{
- private static final String INVALID_URI_MESSAGE = Messages.getString("InvalidURIException.0"); //$NON-NLS-1$
-
- private static final String SCHEME_SEPARATOR = "://"; //$NON-NLS-1$
-
- public FailOverStrategyInjector()
- {
- }
-
- public Object process(IManagedContainer container, String productGroup, String factoryType, String description,
- Object element)
- {
- if (element instanceof CDONet4jSessionImpl)
- {
- CDONet4jSessionImpl session = (CDONet4jSessionImpl)element;
- NOOPFailOverStrategy failOverStrategy = getFailOverStrategy(container, description);
- session.setFailOverStrategy(failOverStrategy);
- }
-
- return element;
- }
-
- protected NOOPFailOverStrategy getFailOverStrategy(IManagedContainer container, String description)
- {
- IConnector connector = getConnector(container, description);
- return new NOOPFailOverStrategy(connector);
- }
-
- protected IConnector getConnector(IManagedContainer container, String description)
- {
- int pos = description.indexOf(SCHEME_SEPARATOR);
- if (pos == -1)
- {
- throw new IllegalArgumentException(MessageFormat.format(INVALID_URI_MESSAGE, description, Messages
- .getString("FailOverStrategyInjector.0"))); //$NON-NLS-1$
- }
-
- String factoryType = description.substring(0, pos);
- if (StringUtil.isEmpty(factoryType))
- {
- throw new IllegalArgumentException(MessageFormat.format(INVALID_URI_MESSAGE, description, Messages
- .getString("FailOverStrategyInjector.1"))); //$NON-NLS-1$
- }
-
- String connectorDescription = description.substring(pos + SCHEME_SEPARATOR.length());
- if (StringUtil.isEmpty(connectorDescription))
- {
- throw new IllegalArgumentException(MessageFormat.format(INVALID_URI_MESSAGE, description, Messages
- .getString("FailOverStrategyInjector.2"))); //$NON-NLS-1$
- }
-
- pos = connectorDescription.indexOf('?');
- if (pos != -1)
- {
- connectorDescription = connectorDescription.substring(0, pos);
- }
-
- return (IConnector)container.getElement(ConnectorFactory.PRODUCT_GROUP, factoryType, connectorDescription);
- }
-}
diff --git a/plugins/org.eclipse.emf.cdo.net4j/src/org/eclipse/emf/cdo/internal/net4j/protocol/AuthenticationIndication.java b/plugins/org.eclipse.emf.cdo.net4j/src/org/eclipse/emf/cdo/internal/net4j/protocol/AuthenticationIndication.java
index 87688fd3c5..2404d76c80 100644
--- a/plugins/org.eclipse.emf.cdo.net4j/src/org/eclipse/emf/cdo/internal/net4j/protocol/AuthenticationIndication.java
+++ b/plugins/org.eclipse.emf.cdo.net4j/src/org/eclipse/emf/cdo/internal/net4j/protocol/AuthenticationIndication.java
@@ -55,8 +55,7 @@ public class AuthenticationIndication extends IndicationWithResponse
{
try
{
- InternalCDOSession session = getSession();
- CDOAuthenticator authenticator = session.getAuthenticator();
+ CDOAuthenticator authenticator = getSession().getConfiguration().getAuthenticator();
if (authenticator == null)
{
throw new IllegalStateException("No authenticator configured"); //$NON-NLS-1$
diff --git a/plugins/org.eclipse.emf.cdo.server.net4j/src/org/eclipse/emf/cdo/server/internal/net4j/protocol/CDOServerIndication.java b/plugins/org.eclipse.emf.cdo.server.net4j/src/org/eclipse/emf/cdo/server/internal/net4j/protocol/CDOServerIndication.java
index 5b09f654ee..69a108a538 100644
--- a/plugins/org.eclipse.emf.cdo.server.net4j/src/org/eclipse/emf/cdo/server/internal/net4j/protocol/CDOServerIndication.java
+++ b/plugins/org.eclipse.emf.cdo.server.net4j/src/org/eclipse/emf/cdo/server/internal/net4j/protocol/CDOServerIndication.java
@@ -59,7 +59,7 @@ public abstract class CDOServerIndication extends IndicationWithResponse
InternalRepository repository = getSession().getManager().getRepository();
if (!LifecycleUtil.isActive(repository))
{
- throw new IllegalStateException("Repository has been deactivated"); //$NON-NLS-1$
+ throw new IllegalStateException("CDORepositoryInfo has been deactivated"); //$NON-NLS-1$
}
return repository;
diff --git a/plugins/org.eclipse.emf.cdo.server.net4j/src/org/eclipse/emf/cdo/server/internal/net4j/protocol/CommitTransactionIndication.java b/plugins/org.eclipse.emf.cdo.server.net4j/src/org/eclipse/emf/cdo/server/internal/net4j/protocol/CommitTransactionIndication.java
index 0c5778f0b2..90a2ec83c3 100644
--- a/plugins/org.eclipse.emf.cdo.server.net4j/src/org/eclipse/emf/cdo/server/internal/net4j/protocol/CommitTransactionIndication.java
+++ b/plugins/org.eclipse.emf.cdo.server.net4j/src/org/eclipse/emf/cdo/server/internal/net4j/protocol/CommitTransactionIndication.java
@@ -117,7 +117,7 @@ public class CommitTransactionIndication extends IndicationWithMonitoring
InternalRepository repository = getSession().getManager().getRepository();
if (!LifecycleUtil.isActive(repository))
{
- throw new IllegalStateException("Repository has been deactivated"); //$NON-NLS-1$
+ throw new IllegalStateException("CDORepositoryInfo has been deactivated"); //$NON-NLS-1$
}
return repository;
diff --git a/plugins/org.eclipse.emf.cdo.server.net4j/src/org/eclipse/emf/cdo/server/internal/net4j/protocol/OpenSessionIndication.java b/plugins/org.eclipse.emf.cdo.server.net4j/src/org/eclipse/emf/cdo/server/internal/net4j/protocol/OpenSessionIndication.java
index 19021d0884..5482bcba5b 100644
--- a/plugins/org.eclipse.emf.cdo.server.net4j/src/org/eclipse/emf/cdo/server/internal/net4j/protocol/OpenSessionIndication.java
+++ b/plugins/org.eclipse.emf.cdo.server.net4j/src/org/eclipse/emf/cdo/server/internal/net4j/protocol/OpenSessionIndication.java
@@ -117,7 +117,7 @@ public class OpenSessionIndication extends RepositoryTimeIndication
{
if (TRACER.isEnabled())
{
- TRACER.format("Repository {0} not found", repositoryName); //$NON-NLS-1$
+ TRACER.format("CDORepositoryInfo {0} not found", repositoryName); //$NON-NLS-1$
}
out.writeInt(CDOProtocolConstants.ERROR_REPOSITORY_NOT_FOUND);
diff --git a/plugins/org.eclipse.emf.cdo.server/src/org/eclipse/emf/cdo/internal/server/Repository.java b/plugins/org.eclipse.emf.cdo.server/src/org/eclipse/emf/cdo/internal/server/Repository.java
index 0269b87839..85aadf9d57 100644
--- a/plugins/org.eclipse.emf.cdo.server/src/org/eclipse/emf/cdo/internal/server/Repository.java
+++ b/plugins/org.eclipse.emf.cdo.server/src/org/eclipse/emf/cdo/internal/server/Repository.java
@@ -733,7 +733,7 @@ public class Repository extends Container<Object> implements InternalRepository
@Override
public String toString()
{
- return MessageFormat.format("Repository[{0}]", name); //$NON-NLS-1$
+ return MessageFormat.format("CDORepositoryInfo[{0}]", name); //$NON-NLS-1$
}
@Override
diff --git a/plugins/org.eclipse.emf.cdo.server/src/org/eclipse/emf/cdo/internal/server/RepositoryConfigurator.java b/plugins/org.eclipse.emf.cdo.server/src/org/eclipse/emf/cdo/internal/server/RepositoryConfigurator.java
index 84bb5d2f0c..47767f2556 100644
--- a/plugins/org.eclipse.emf.cdo.server/src/org/eclipse/emf/cdo/internal/server/RepositoryConfigurator.java
+++ b/plugins/org.eclipse.emf.cdo.server/src/org/eclipse/emf/cdo/internal/server/RepositoryConfigurator.java
@@ -91,7 +91,7 @@ public class RepositoryConfigurator
String repositoryName = repositoryConfig.getAttribute("name"); //$NON-NLS-1$
if (StringUtil.isEmpty(repositoryName))
{
- throw new IllegalArgumentException("Repository name is missing or empty"); //$NON-NLS-1$
+ throw new IllegalArgumentException("CDORepositoryInfo name is missing or empty"); //$NON-NLS-1$
}
String repositoryType = repositoryConfig.getAttribute("type"); //$NON-NLS-1$
@@ -149,7 +149,7 @@ public class RepositoryConfigurator
"repositoryFactory", "repositoryType", type); //$NON-NLS-1$ //$NON-NLS-2$
if (factory == null)
{
- throw new IllegalStateException("Repository factory not found: " + type); //$NON-NLS-1$
+ throw new IllegalStateException("CDORepositoryInfo factory not found: " + type); //$NON-NLS-1$
}
return factory;
diff --git a/plugins/org.eclipse.emf.cdo.server/src/org/eclipse/emf/cdo/internal/server/embedded/EmbeddedClientSession.java b/plugins/org.eclipse.emf.cdo.server/src/org/eclipse/emf/cdo/internal/server/embedded/EmbeddedClientSession.java
index a7ef45ef28..4e399d51ee 100644
--- a/plugins/org.eclipse.emf.cdo.server/src/org/eclipse/emf/cdo/internal/server/embedded/EmbeddedClientSession.java
+++ b/plugins/org.eclipse.emf.cdo.server/src/org/eclipse/emf/cdo/internal/server/embedded/EmbeddedClientSession.java
@@ -11,96 +11,40 @@
package org.eclipse.emf.cdo.internal.server.embedded;
import org.eclipse.emf.cdo.server.embedded.CDOSession;
+import org.eclipse.emf.cdo.spi.common.model.InternalCDOPackageRegistry;
+import org.eclipse.emf.cdo.spi.common.revision.InternalCDORevisionManager;
import org.eclipse.emf.cdo.spi.server.InternalRepository;
import org.eclipse.emf.internal.cdo.session.CDOSessionImpl;
-import org.eclipse.emf.spi.cdo.CDOSessionProtocol;
-import org.eclipse.emf.spi.cdo.CDOSessionProtocol.OpenSessionResult;
-
/**
* @author Eike Stepper
*/
public class EmbeddedClientSession extends CDOSessionImpl implements CDOSession
{
- private InternalRepository repository;
-
- public EmbeddedClientSession(InternalRepository repository)
- {
- this.repository = repository;
- setPackageRegistry(repository.getPackageRegistry(false));
- setRevisionManager(repository.getRevisionManager());
- }
-
- public InternalRepository getRepository()
+ public EmbeddedClientSession(EmbeddedClientSessionConfiguration configuration)
{
- return repository;
+ super(configuration);
}
@Override
- protected org.eclipse.emf.cdo.session.CDOSession.Repository createRepository(OpenSessionResult result)
+ public EmbeddedClientSessionConfiguration getConfiguration()
{
- return new org.eclipse.emf.cdo.session.CDOSession.Repository()
- {
- public long getCreationTime()
- {
- return repository.getCreationTime();
- }
-
- public long getCurrentTime()
- {
- return getCurrentTime(false);
- }
-
- public long getCurrentTime(boolean forceRefresh)
- {
- return System.currentTimeMillis();
- }
-
- public String getName()
- {
- return repository.getName();
- }
-
- public String getUUID()
- {
- return repository.getUUID();
- }
-
- public boolean isSupportingAudits()
- {
- return repository.isSupportingAudits();
- }
- };
+ return (EmbeddedClientSessionConfiguration)super.getConfiguration();
}
- @Override
- protected CDOSessionProtocol createSessionProtocol()
- {
- return new EmbeddedClientSessionProtocol(this);
- }
-
- @Override
- protected void activatePackageRegistry()
- {
- // Do nothing
- }
-
- @Override
- protected void activateRevisionManager()
+ public InternalRepository getRepository()
{
- // Do nothing
+ return getConfiguration().getRepository();
}
- @Override
- protected void deactivatePackageRegistry()
+ public InternalCDOPackageRegistry getPackageRegistry()
{
- // Do nothing
+ return getRepository().getPackageRegistry();
}
- @Override
- protected void deactivateRevisionManager()
+ public InternalCDORevisionManager getRevisionManager()
{
- // Do nothing
+ return getRepository().getRevisionManager();
}
}
diff --git a/plugins/org.eclipse.emf.cdo.server/src/org/eclipse/emf/cdo/internal/server/embedded/EmbeddedClientSessionConfiguration.java b/plugins/org.eclipse.emf.cdo.server/src/org/eclipse/emf/cdo/internal/server/embedded/EmbeddedClientSessionConfiguration.java
index 6273d97c5b..91410e660e 100644
--- a/plugins/org.eclipse.emf.cdo.server/src/org/eclipse/emf/cdo/internal/server/embedded/EmbeddedClientSessionConfiguration.java
+++ b/plugins/org.eclipse.emf.cdo.server/src/org/eclipse/emf/cdo/internal/server/embedded/EmbeddedClientSessionConfiguration.java
@@ -48,14 +48,67 @@ public class EmbeddedClientSessionConfiguration extends CDOSessionConfigurationI
return (org.eclipse.emf.cdo.server.embedded.CDOSession)super.openSession();
}
- @Override
- protected InternalCDOSession createSession()
+ public InternalCDOSession createSession()
{
if (isActivateOnOpen())
{
CheckUtil.checkState(repository, "Specify a repository"); //$NON-NLS-1$
}
- return new EmbeddedClientSession(repository);
+ return new EmbeddedClientSession(this);
+ }
+
+ @Override
+ public void activateSession(InternalCDOSession session) throws Exception
+ {
+ super.activateSession(session);
+ session.setSessionProtocol(new EmbeddedClientSessionProtocol((EmbeddedClientSession)session));
+ session.setRepositoryInfo(new RepositoryInfo());
+ }
+
+ @Override
+ public void deactivateSession(InternalCDOSession session) throws Exception
+ {
+ super.deactivateSession(session);
+ }
+
+ /**
+ * @author Eike Stepper
+ */
+ protected class RepositoryInfo implements org.eclipse.emf.cdo.session.CDORepositoryInfo
+ {
+ public RepositoryInfo()
+ {
+ }
+
+ public long getCreationTime()
+ {
+ return repository.getCreationTime();
+ }
+
+ public long getCurrentTime()
+ {
+ return getCurrentTime(false);
+ }
+
+ public long getCurrentTime(boolean forceRefresh)
+ {
+ return System.currentTimeMillis();
+ }
+
+ public String getName()
+ {
+ return repository.getName();
+ }
+
+ public String getUUID()
+ {
+ return repository.getUUID();
+ }
+
+ public boolean isSupportingAudits()
+ {
+ return repository.isSupportingAudits();
+ }
}
}
diff --git a/plugins/org.eclipse.emf.cdo.server/src/org/eclipse/emf/cdo/internal/server/embedded/EmbeddedClientSessionProtocol.java b/plugins/org.eclipse.emf.cdo.server/src/org/eclipse/emf/cdo/internal/server/embedded/EmbeddedClientSessionProtocol.java
index 07d040b384..75d91bdf12 100644
--- a/plugins/org.eclipse.emf.cdo.server/src/org/eclipse/emf/cdo/internal/server/embedded/EmbeddedClientSessionProtocol.java
+++ b/plugins/org.eclipse.emf.cdo.server/src/org/eclipse/emf/cdo/internal/server/embedded/EmbeddedClientSessionProtocol.java
@@ -36,7 +36,6 @@ 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.InternalCDORemoteSessionManager;
-import org.eclipse.emf.spi.cdo.InternalCDOSession;
import org.eclipse.emf.spi.cdo.InternalCDOTransaction.InternalCDOCommitContext;
import org.eclipse.emf.spi.cdo.InternalCDOXATransaction.InternalCDOXACommitContext;
@@ -79,7 +78,7 @@ public class EmbeddedClientSessionProtocol extends Lifecycle implements CDOSessi
repository = session.getRepository();
if (!ObjectUtil.equals(repository.getName(), repositoryName))
{
- throw new IllegalArgumentException("Repository name does not match: " + repositoryName);
+ throw new IllegalArgumentException("CDORepositoryInfo name does not match: " + repositoryName);
}
activate();
@@ -280,8 +279,7 @@ public class EmbeddedClientSessionProtocol extends Lifecycle implements CDOSessi
public CDOAuthenticationResult handleAuthenticationChallenge(byte[] randomToken) throws Exception
{
- InternalCDOSession session = getSession();
- CDOAuthenticator authenticator = session.getAuthenticator();
+ CDOAuthenticator authenticator = getSession().getConfiguration().getAuthenticator();
if (authenticator == null)
{
throw new IllegalStateException("No authenticator configured"); //$NON-NLS-1$
diff --git a/plugins/org.eclipse.emf.cdo.server/src/org/eclipse/emf/cdo/server/CDOServerUtil.java b/plugins/org.eclipse.emf.cdo.server/src/org/eclipse/emf/cdo/server/CDOServerUtil.java
index caa73d58e6..03f91d9a02 100644
--- a/plugins/org.eclipse.emf.cdo.server/src/org/eclipse/emf/cdo/server/CDOServerUtil.java
+++ b/plugins/org.eclipse.emf.cdo.server/src/org/eclipse/emf/cdo/server/CDOServerUtil.java
@@ -99,7 +99,7 @@ public final class CDOServerUtil
}
}
- throw new IllegalStateException("Repository config not found: " + repositoryName); //$NON-NLS-1$
+ throw new IllegalStateException("CDORepositoryInfo config not found: " + repositoryName); //$NON-NLS-1$
}
/**
diff --git a/plugins/org.eclipse.emf.cdo.server/src/org/eclipse/emf/cdo/server/RepositoryNotFoundException.java b/plugins/org.eclipse.emf.cdo.server/src/org/eclipse/emf/cdo/server/RepositoryNotFoundException.java
index 6c705b1965..f2e3578e12 100644
--- a/plugins/org.eclipse.emf.cdo.server/src/org/eclipse/emf/cdo/server/RepositoryNotFoundException.java
+++ b/plugins/org.eclipse.emf.cdo.server/src/org/eclipse/emf/cdo/server/RepositoryNotFoundException.java
@@ -32,6 +32,6 @@ public class RepositoryNotFoundException extends CDOException
@Override
public String getMessage()
{
- return "Repository not found: " + getRepositoryName(); //$NON-NLS-1$
+ return "CDORepositoryInfo not found: " + getRepositoryName(); //$NON-NLS-1$
}
}
diff --git a/plugins/org.eclipse.emf.cdo.tests/src/org/eclipse/emf/cdo/tests/AuditTest.java b/plugins/org.eclipse.emf.cdo.tests/src/org/eclipse/emf/cdo/tests/AuditTest.java
index 5f49851ea2..784b2bb401 100644
--- a/plugins/org.eclipse.emf.cdo.tests/src/org/eclipse/emf/cdo/tests/AuditTest.java
+++ b/plugins/org.eclipse.emf.cdo.tests/src/org/eclipse/emf/cdo/tests/AuditTest.java
@@ -68,21 +68,21 @@ public class AuditTest extends AbstractCDOTest
resource.getContents().add(company);
transaction.commit();
long commitTime1 = transaction.getLastCommitTime();
- assertEquals(true, session.repository().getCreationTime() < commitTime1);
+ assertEquals(true, session.getRepositoryInfo().getCreationTime() < commitTime1);
assertEquals("ESC", company.getName());
company.setName("Sympedia");
transaction.commit();
long commitTime2 = transaction.getLastCommitTime();
assertEquals(true, commitTime1 < commitTime2);
- assertEquals(true, session.repository().getCreationTime() < commitTime2);
+ assertEquals(true, session.getRepositoryInfo().getCreationTime() < commitTime2);
assertEquals("Sympedia", company.getName());
company.setName("Eclipse");
transaction.commit();
long commitTime3 = transaction.getLastCommitTime();
assertEquals(true, commitTime2 < commitTime3);
- assertEquals(true, session.repository().getCreationTime() < commitTime2);
+ assertEquals(true, session.getRepositoryInfo().getCreationTime() < commitTime2);
assertEquals("Eclipse", company.getName());
closeSession1();
@@ -111,21 +111,21 @@ public class AuditTest extends AbstractCDOTest
resource.getContents().add(company);
transaction.commit();
long commitTime1 = transaction.getLastCommitTime();
- assertEquals(true, session.repository().getCreationTime() < commitTime1);
+ assertEquals(true, session.getRepositoryInfo().getCreationTime() < commitTime1);
assertEquals("ESC", company.getName());
company.setName("Sympedia");
transaction.commit();
long commitTime2 = transaction.getLastCommitTime();
assertEquals(true, commitTime1 < commitTime2);
- assertEquals(true, session.repository().getCreationTime() < commitTime2);
+ assertEquals(true, session.getRepositoryInfo().getCreationTime() < commitTime2);
assertEquals("Sympedia", company.getName());
company.setName("Eclipse");
transaction.commit();
long commitTime3 = transaction.getLastCommitTime();
assertEquals(true, commitTime2 < commitTime3);
- assertEquals(true, session.repository().getCreationTime() < commitTime2);
+ assertEquals(true, session.getRepositoryInfo().getCreationTime() < commitTime2);
assertEquals("Eclipse", company.getName());
closeSession1();
@@ -166,21 +166,21 @@ public class AuditTest extends AbstractCDOTest
resource.getContents().add(company);
transaction.commit();
long commitTime1 = transaction.getLastCommitTime();
- assertEquals(true, session.repository().getCreationTime() < commitTime1);
+ assertEquals(true, session.getRepositoryInfo().getCreationTime() < commitTime1);
assertEquals("ESC", company.getName());
company.setName("Sympedia");
transaction.commit();
long commitTime2 = transaction.getLastCommitTime();
assertEquals(true, commitTime1 < commitTime2);
- assertEquals(true, session.repository().getCreationTime() < commitTime2);
+ assertEquals(true, session.getRepositoryInfo().getCreationTime() < commitTime2);
assertEquals("Sympedia", company.getName());
company.setName("Eclipse");
transaction.commit();
long commitTime3 = transaction.getLastCommitTime();
assertEquals(true, commitTime2 < commitTime3);
- assertEquals(true, session.repository().getCreationTime() < commitTime2);
+ assertEquals(true, session.getRepositoryInfo().getCreationTime() < commitTime2);
assertEquals("Eclipse", company.getName());
closeSession1();
@@ -322,7 +322,7 @@ public class AuditTest extends AbstractCDOTest
closeSession1();
session = openSession2();
- session.openAudit(session.repository().getCreationTime());
+ session.openAudit(session.getRepositoryInfo().getCreationTime());
session.close();
}
@@ -463,7 +463,7 @@ public class AuditTest extends AbstractCDOTest
public void testRepositoryCreationTime() throws Exception
{
CDOSession session = openSession();
- long repositoryCreationTime = session.repository().getCreationTime();
+ long repositoryCreationTime = session.getRepositoryInfo().getCreationTime();
assertEquals(getRepository().getCreationTime(), repositoryCreationTime);
assertEquals(getRepository().getStore().getCreationTime(), repositoryCreationTime);
}
@@ -471,7 +471,7 @@ public class AuditTest extends AbstractCDOTest
public void testRepositoryTime() throws Exception
{
CDOSession session = openSession();
- long repositoryTime = session.repository().getCurrentTime();
+ long repositoryTime = session.getRepositoryInfo().getCurrentTime();
assertEquals(true, Math.abs(System.currentTimeMillis() - repositoryTime) < 500);
}
diff --git a/plugins/org.eclipse.emf.cdo.tests/src/org/eclipse/emf/cdo/tests/InitialTest.java b/plugins/org.eclipse.emf.cdo.tests/src/org/eclipse/emf/cdo/tests/InitialTest.java
index d360007980..3fd5218e9f 100644
--- a/plugins/org.eclipse.emf.cdo.tests/src/org/eclipse/emf/cdo/tests/InitialTest.java
+++ b/plugins/org.eclipse.emf.cdo.tests/src/org/eclipse/emf/cdo/tests/InitialTest.java
@@ -4,7 +4,7 @@
* 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
*/
@@ -13,6 +13,7 @@ package org.eclipse.emf.cdo.tests;
import org.eclipse.emf.cdo.CDOState;
import org.eclipse.emf.cdo.eresource.CDOResource;
import org.eclipse.emf.cdo.session.CDOSession;
+import org.eclipse.emf.cdo.tests.config.impl.RepositoryConfig;
import org.eclipse.emf.cdo.tests.model1.Category;
import org.eclipse.emf.cdo.tests.model1.OrderAddress;
import org.eclipse.emf.cdo.tests.model1.OrderDetail;
@@ -127,6 +128,8 @@ public class InitialTest extends AbstractCDOTest
CDOSession session = openModel1Session();
assertNotNull(session);
assertEquals(false, session.isClosed());
+ assertEquals(RepositoryConfig.REPOSITORY_NAME, session.getRepositoryInfo().getName());
+ assertEquals(RepositoryConfig.REPOSITORY_NAME, session.getRepositoryInfo().getUUID());
}
public void testStartTransaction() throws Exception
@@ -151,7 +154,7 @@ public class InitialTest extends AbstractCDOTest
msg("Creating resource");
CDOResource resource = transaction.createResource("/test1");
assertNew(resource, transaction);
- assertEquals(URI.createURI("cdo://" + session.repository().getUUID() + "/test1"), resource.getURI());
+ assertEquals(URI.createURI("cdo://" + session.getRepositoryInfo().getUUID() + "/test1"), resource.getURI());
ResourceSet expected = transaction.getResourceSet();
ResourceSet actual = resource.getResourceSet();
assertEquals(expected, actual);
@@ -473,7 +476,7 @@ public class InitialTest extends AbstractCDOTest
msg("Getting resource");
CDOResource resource = transaction.getResource("/test1", true);
assertNotNull(resource);
- assertEquals(URI.createURI("cdo://" + session.repository().getUUID() + "/test1"), resource.getURI());
+ assertEquals(URI.createURI("cdo://" + session.getRepositoryInfo().getUUID() + "/test1"), resource.getURI());
assertEquals(transaction.getResourceSet(), resource.getResourceSet());
assertEquals(1, transaction.getResourceSet().getResources().size());
assertEquals(CDOState.CLEAN, resource.cdoState());
@@ -489,7 +492,7 @@ public class InitialTest extends AbstractCDOTest
CDOResource resource = (CDOResource)transaction.getResourceSet().getResource(
CDOURIUtil.createResourceURI(transaction, "/test1"), true);
assertNotNull(resource);
- assertEquals(URI.createURI("cdo://" + session.repository().getUUID() + "/test1"), resource.getURI());
+ assertEquals(URI.createURI("cdo://" + session.getRepositoryInfo().getUUID() + "/test1"), resource.getURI());
assertEquals(transaction.getResourceSet(), resource.getResourceSet());
assertEquals(1, transaction.getResourceSet().getResources().size());
assertEquals(CDOState.CLEAN, resource.cdoState());
@@ -670,7 +673,10 @@ public class InitialTest extends AbstractCDOTest
msg("Getting resource");
CDOResource resource = transaction.getResource("/test1");
assertNotNull(resource);
- assertEquals(URI.createURI("cdo://" + session.repository().getUUID() + "/test1"), resource.getURI());
+
+ URI uri = URI.createURI("cdo://" + session.getRepositoryInfo().getUUID() + "/test1");
+ URI resourceURI = resource.getURI();
+ assertEquals(uri, resourceURI);
assertEquals(transaction.getResourceSet(), resource.getResourceSet());
assertEquals(CDOState.CLEAN, resource.cdoState());
assertEquals(transaction, resource.cdoView());
diff --git a/plugins/org.eclipse.emf.cdo.tests/src/org/eclipse/emf/cdo/tests/SavePointTest.java b/plugins/org.eclipse.emf.cdo.tests/src/org/eclipse/emf/cdo/tests/SavePointTest.java
index d235e8d022..58036100cf 100644
--- a/plugins/org.eclipse.emf.cdo.tests/src/org/eclipse/emf/cdo/tests/SavePointTest.java
+++ b/plugins/org.eclipse.emf.cdo.tests/src/org/eclipse/emf/cdo/tests/SavePointTest.java
@@ -281,7 +281,7 @@ public class SavePointTest extends AbstractCDOTest
* client2 commits
* client1 rolls back to save point
* Result:
- * Repository: object1 not modified, object2 is modified
+ * CDORepositoryInfo: object1 not modified, object2 is modified
* client1: same as repository
* client2: same as repository
*</pre>
@@ -315,7 +315,7 @@ public class SavePointTest extends AbstractCDOTest
// client1 rolls back to save point
savepoint.rollback();
- // Repository: object1 not modified, object2 is modified
+ // CDORepositoryInfo: object1 not modified, object2 is modified
CDOSession client3 = openSession();
CDOView view = client3.openView();
CDOResource object1Test = view.getResource("/object1");
diff --git a/plugins/org.eclipse.emf.cdo.tests/src/org/eclipse/emf/cdo/tests/SessionTest.java b/plugins/org.eclipse.emf.cdo.tests/src/org/eclipse/emf/cdo/tests/SessionTest.java
index ba40d92855..70e1239143 100644
--- a/plugins/org.eclipse.emf.cdo.tests/src/org/eclipse/emf/cdo/tests/SessionTest.java
+++ b/plugins/org.eclipse.emf.cdo.tests/src/org/eclipse/emf/cdo/tests/SessionTest.java
@@ -34,7 +34,7 @@ public class SessionTest extends AbstractCDOTest
public void testIsSupportingAudits() throws Exception
{
CDOSession session = openSession();
- assertEquals(getRepository().isSupportingAudits(), session.repository().isSupportingAudits());
+ assertEquals(getRepository().isSupportingAudits(), session.getRepositoryInfo().isSupportingAudits());
session.close();
}
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 d896a27732..f4c430838d 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
@@ -51,7 +51,7 @@ public class StateMachineTest extends AbstractCDOTest
CDOTransaction transaction = session.openTransaction();
CDOResource resource = transaction.createResource("/test1");
assertNew(resource, transaction);
- assertEquals(URI.createURI("cdo://" + session.repository().getUUID() + "/test1"), resource.getURI());
+ assertEquals(URI.createURI("cdo://" + session.getRepositoryInfo().getUUID() + "/test1"), resource.getURI());
assertEquals(transaction.getResourceSet(), resource.getResourceSet());
// Attach single object
diff --git a/plugins/org.eclipse.emf.cdo.tests/src/org/eclipse/emf/cdo/tests/bugzilla/Bugzilla_252214_Test.java b/plugins/org.eclipse.emf.cdo.tests/src/org/eclipse/emf/cdo/tests/bugzilla/Bugzilla_252214_Test.java
index 10454a95fc..917fa144cf 100644
--- a/plugins/org.eclipse.emf.cdo.tests/src/org/eclipse/emf/cdo/tests/bugzilla/Bugzilla_252214_Test.java
+++ b/plugins/org.eclipse.emf.cdo.tests/src/org/eclipse/emf/cdo/tests/bugzilla/Bugzilla_252214_Test.java
@@ -60,14 +60,14 @@ public class Bugzilla_252214_Test extends AbstractCDOTest
resource.getContents().add(company);
transaction.commit();
commitTime1 = transaction.getLastCommitTime();
- assertTrue(session.repository().getCreationTime() < commitTime1);
+ assertTrue(session.getRepositoryInfo().getCreationTime() < commitTime1);
assertEquals("ESC", company.getName());
company.setName("Sympedia");
transaction.commit();
commitTime2 = transaction.getLastCommitTime();
assertTrue(commitTime1 < commitTime2);
- assertTrue(session.repository().getCreationTime() < commitTime2);
+ assertTrue(session.getRepositoryInfo().getCreationTime() < commitTime2);
assertEquals("Sympedia", company.getName());
}
diff --git a/plugins/org.eclipse.emf.cdo.tests/src/org/eclipse/emf/cdo/tests/config/impl/ConfigTest.java b/plugins/org.eclipse.emf.cdo.tests/src/org/eclipse/emf/cdo/tests/config/impl/ConfigTest.java
index 229c314c04..79cbc3ee3c 100644
--- a/plugins/org.eclipse.emf.cdo.tests/src/org/eclipse/emf/cdo/tests/config/impl/ConfigTest.java
+++ b/plugins/org.eclipse.emf.cdo.tests/src/org/eclipse/emf/cdo/tests/config/impl/ConfigTest.java
@@ -168,10 +168,10 @@ public abstract class ConfigTest extends AbstractOMTest implements IConstants
}
// /////////////////////////////////////////////////////////////////////////
- // //////////////////////// Repository /////////////////////////////////////
+ // //////////////////////// CDORepositoryInfo /////////////////////////////////////
/**
- *@category Repository
+ *@category CDORepositoryInfo
*/
public IRepositoryConfig getRepositoryConfig()
{
@@ -179,7 +179,7 @@ public abstract class ConfigTest extends AbstractOMTest implements IConstants
}
/**
- *@category Repository
+ *@category CDORepositoryInfo
*/
public Map<String, String> getRepositoryProperties()
{
@@ -187,7 +187,7 @@ public abstract class ConfigTest extends AbstractOMTest implements IConstants
}
/**
- *@category Repository
+ *@category CDORepositoryInfo
*/
public IRepository getRepository(String name)
{
@@ -195,7 +195,7 @@ public abstract class ConfigTest extends AbstractOMTest implements IConstants
}
/**
- *@category Repository
+ *@category CDORepositoryInfo
*/
public InternalRepository getRepository()
{
diff --git a/plugins/org.eclipse.emf.cdo.ui/src/org/eclipse/emf/cdo/internal/ui/CDOEditorInputImpl.java b/plugins/org.eclipse.emf.cdo.ui/src/org/eclipse/emf/cdo/internal/ui/CDOEditorInputImpl.java
index 14774499ed..53a8905a6d 100644
--- a/plugins/org.eclipse.emf.cdo.ui/src/org/eclipse/emf/cdo/internal/ui/CDOEditorInputImpl.java
+++ b/plugins/org.eclipse.emf.cdo.ui/src/org/eclipse/emf/cdo/internal/ui/CDOEditorInputImpl.java
@@ -95,7 +95,7 @@ public class CDOEditorInputImpl extends PlatformObject implements CDOEditorInput
return new Path(resourcePath).lastSegment();
}
- return view.getSession().repository().getName();
+ return view.getSession().getRepositoryInfo().getName();
}
public IPersistableElement getPersistable()
@@ -111,7 +111,7 @@ public class CDOEditorInputImpl extends PlatformObject implements CDOEditorInput
}
CDOSession session = view.getSession();
- String repositoryName = session.repository().getName();
+ String repositoryName = session.getRepositoryInfo().getName();
StringBuilder builder = new StringBuilder();
builder.append(repositoryName);
diff --git a/plugins/org.eclipse.emf.cdo.ui/src/org/eclipse/emf/cdo/ui/CDOItemProvider.java b/plugins/org.eclipse.emf.cdo.ui/src/org/eclipse/emf/cdo/ui/CDOItemProvider.java
index 334e30bd57..3512936591 100644
--- a/plugins/org.eclipse.emf.cdo.ui/src/org/eclipse/emf/cdo/ui/CDOItemProvider.java
+++ b/plugins/org.eclipse.emf.cdo.ui/src/org/eclipse/emf/cdo/ui/CDOItemProvider.java
@@ -159,7 +159,7 @@ public class CDOItemProvider extends ContainerItemProvider<IContainer<Object>>
public static String getSessionLabel(CDOSession session)
{
return MessageFormat.format(
- Messages.getString("CDOItemProvider.0"), session.repository().getName(), session.getSessionID()); //$NON-NLS-1$
+ Messages.getString("CDOItemProvider.0"), session.getRepositoryInfo().getName(), session.getSessionID()); //$NON-NLS-1$
}
/**
diff --git a/plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/cdo/session/CDORepositoryInfo.java b/plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/cdo/session/CDORepositoryInfo.java
new file mode 100644
index 0000000000..5037a940ce
--- /dev/null
+++ b/plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/cdo/session/CDORepositoryInfo.java
@@ -0,0 +1,53 @@
+package org.eclipse.emf.cdo.session;
+
+/**
+ * Describes a model repository a {@link CDOSession session} is connected to.
+ *
+ * @author Eike Stepper
+ * @see CDOSession#getRepositoryInfo()
+ * @since 3.0
+ */
+public interface CDORepositoryInfo
+{
+ /**
+ * Returns the name of this repository.
+ *
+ * @see IRepository#getName()
+ */
+ public String getName();
+
+ /**
+ * Returns the UUID of this repository.
+ *
+ * @see IRepository#getUUID()
+ */
+ public String getUUID();
+
+ /**
+ * Returns the creation time of this repository.
+ *
+ * @see IRepository#getCreationTime()
+ */
+ public long getCreationTime();
+
+ /**
+ * Returns the approximate current time of this repository.
+ * <p>
+ * Same as calling <code>getCurrentTime(false)</code>.
+ *
+ * @see #getCurrentTime(boolean)
+ */
+ public long getCurrentTime();
+
+ /**
+ * Returns the approximate current time of this repository by optionally refreshing the approximation from the server.
+ */
+ public long getCurrentTime(boolean forceRefresh);
+
+ /**
+ * Returns <code>true</code> if this repository supports auditing, <code>false</code> otherwise.
+ *
+ * @see IRepository#isSupportingAudits()
+ */
+ public boolean isSupportingAudits();
+}
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 17adb2b148..1b2d48d630 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
@@ -39,7 +39,7 @@ import java.util.Collection;
* <p>
* A session has the following responsibilities:
* <ul>
- * <li> {@link CDOSession#repository() Repository information}
+ * <li> {@link CDOSession#getRepositoryInfo() CDORepositoryInfo information}
* <li> {@link CDOSession#getPackageRegistry() Package registry}
* <li> {@link CDOSession#getPackageUnitManager() Package unit management}
* <li> {@link CDOSession#getRevisionManager() Data management}
@@ -55,6 +55,11 @@ import java.util.Collection;
public interface CDOSession extends CDOCommonSession, IContainer<CDOView>, IOptionsContainer
{
/**
+ * @since 3.0
+ */
+ public CDOSessionConfiguration getConfiguration();
+
+ /**
* 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>
@@ -161,10 +166,12 @@ 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.
+ * Returns an instance of {@link CDORepositoryInfo} that describes the model repository this {@link CDOSession
+ * session} is connected to.
+ *
+ * @since 3.0
*/
- public Repository repository();
+ public CDORepositoryInfo getRepositoryInfo();
/**
* @author Simon McDuff
@@ -215,58 +222,6 @@ public interface CDOSession extends CDOCommonSession, IContainer<CDOView>, IOpti
}
/**
- * Describes a model repository a {@link CDOSession session} is connected to.
- *
- * @author Eike Stepper
- * @see CDOSession#repository()
- */
- public interface Repository
- {
- /**
- * Returns the name of this repository.
- *
- * @see IRepository#getName()
- */
- public String getName();
-
- /**
- * Returns the UUID of this repository.
- *
- * @see IRepository#getUUID()
- */
- public String getUUID();
-
- /**
- * Returns the creation time of this repository.
- *
- * @see IRepository#getCreationTime()
- */
- public long getCreationTime();
-
- /**
- * Returns the approximate current time of this repository.
- * <p>
- * Same as calling <code>getCurrentTime(false)</code>.
- *
- * @see #getCurrentTime(boolean)
- */
- public long getCurrentTime();
-
- /**
- * Returns the approximate current time of this repository by optionally refreshing the approximation from the
- * server.
- */
- public long getCurrentTime(boolean forceRefresh);
-
- /**
- * Returns <code>true</code> if this repository supports auditing, <code>false</code> otherwise.
- *
- * @see IRepository#isSupportingAudits()
- */
- public boolean isSupportingAudits();
- }
-
- /**
* @author Eike Stepper
*/
public interface ExceptionHandler
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 f3279797e3..450043a83a 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
@@ -19,6 +19,18 @@ import org.eclipse.emf.cdo.common.protocol.CDOAuthenticator;
public interface CDOSessionConfiguration
{
/**
+ * @see CDOSession.Options#isPassiveUpdateEnabled()
+ * @since 3.0
+ */
+ public boolean isPassiveUpdateEnabled();
+
+ /**
+ * @see CDOSession.Options#isPassiveUpdateEnabled()
+ * @since 3.0
+ */
+ public void setPassiveUpdateEnabled(boolean passiveUpdateEnabled);
+
+ /**
* @see CDOSession#getExceptionHandler()
*/
public CDOSession.ExceptionHandler getExceptionHandler();
diff --git a/plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/cdo/util/CDOURIUtil.java b/plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/cdo/util/CDOURIUtil.java
index cc04b194b0..0f3f913166 100644
--- a/plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/cdo/util/CDOURIUtil.java
+++ b/plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/cdo/util/CDOURIUtil.java
@@ -133,7 +133,7 @@ public class CDOURIUtil
public static URI createResourceURI(CDOSession session, String path)
{
- return createResourceURI(session == null ? null : session.repository().getUUID(), path);
+ return createResourceURI(session == null ? null : session.getRepositoryInfo().getUUID(), path);
}
/**
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 dd6a5e18fc..643121ed2c 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
@@ -235,7 +235,7 @@ public final class CDOUtil
if (revision.getVersion() != version)
{
CDOSession session = object.cdoView().getSession();
- if (!session.repository().isSupportingAudits())
+ if (!session.getRepositoryInfo().isSupportingAudits())
{
throw new IllegalStateException(Messages.getString("CDOUtil.0")); //$NON-NLS-1$
}
diff --git a/plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/internal/cdo/CDOObjectImpl.java b/plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/internal/cdo/CDOObjectImpl.java
index 3aaba76e81..aab7a57d8d 100644
--- a/plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/internal/cdo/CDOObjectImpl.java
+++ b/plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/internal/cdo/CDOObjectImpl.java
@@ -535,7 +535,7 @@ public class CDOObjectImpl extends EStoreEObjectImpl implements InternalCDOObjec
/**
* Code took from {@link BasicEObjectImpl#eBasicSetContainer} and modify it to detect when object are moved in the
- * same context. (E.g.: An object is moved from resA to resB. resA and resB belongs to the same Repository. Without
+ * same context. (E.g.: An object is moved from resA to resB. resA and resB belongs to the same CDORepositoryInfo. Without
* this special handling, a detach and newObject will be generated for the object moved)
*
* @since 2.0
diff --git a/plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/internal/cdo/CDOURIHandler.java b/plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/internal/cdo/CDOURIHandler.java
index ab0ab3f6e9..7d14659d2d 100644
--- a/plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/internal/cdo/CDOURIHandler.java
+++ b/plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/internal/cdo/CDOURIHandler.java
@@ -56,7 +56,7 @@ public class CDOURIHandler implements URIHandler
public boolean canHandle(URI uri)
{
return CDO_URI_SCHEME.equals(uri.scheme())
- && view.getSession().repository().getUUID().equals(CDOURIUtil.extractRepositoryUUID(uri));
+ && view.getSession().getRepositoryInfo().getUUID().equals(CDOURIUtil.extractRepositoryUUID(uri));
}
public boolean exists(URI uri, Map<?, ?> options)
diff --git a/plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/internal/cdo/messages/messages.properties b/plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/internal/cdo/messages/messages.properties
index 6e9501a173..5dc3512bc7 100644
--- a/plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/internal/cdo/messages/messages.properties
+++ b/plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/internal/cdo/messages/messages.properties
@@ -3,7 +3,7 @@
# 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:
# Victor Roldan Betancort - initial API and implementation
# Eike Stepper - maintenance
@@ -19,6 +19,7 @@ CDOResourceNodeImpl.3=Null path is not allowed
CDOResourceNodeImpl.4=Root path is not allowed
CDOResourceNodeImpl.5=Duplicate path: {0}
CDOSessionConfigurationImpl.0=Session is already open
+CDOSessionConfigurationImpl.1=Session is not open
CDOSessionFactory.1=Query is empty: {0}
CDOSessionImpl.0=Generated packages locally not available: {0}
CDOSessionImpl.1=Commit notification arrived while session is inactive
@@ -80,7 +81,7 @@ FSMUtil.0=View closed
FSMUtil.1=object == null
FSMUtil.2=view == null
FSMUtil.3=Legacy models not supported
-FSMUtil.4=Use CDOFactory to create dynamic object:
+FSMUtil.4=Use CDOFactory to create dynamic object:
InvalidObjectException.0=Object {0} is not valid anymore
InvalidURIException.0=Invalid URI "{0}": {1}
ObjectNotFoundException.0=Object {0} not found (temporary = {1})
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 6ac0a0db63..c13809fe3c 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
@@ -13,42 +13,49 @@ package org.eclipse.emf.internal.cdo.session;
import org.eclipse.emf.cdo.common.protocol.CDOAuthenticationResult;
import org.eclipse.emf.cdo.common.protocol.CDOAuthenticator;
import org.eclipse.emf.cdo.session.CDOSession;
-import org.eclipse.emf.cdo.session.CDOSessionConfiguration;
+import org.eclipse.emf.cdo.session.remote.CDORemoteSessionManager;
import org.eclipse.emf.internal.cdo.messages.Messages;
+import org.eclipse.emf.internal.cdo.session.remote.CDORemoteSessionManagerImpl;
+import org.eclipse.net4j.util.lifecycle.LifecycleUtil;
import org.eclipse.net4j.util.security.IPasswordCredentials;
import org.eclipse.net4j.util.security.IPasswordCredentialsProvider;
import org.eclipse.net4j.util.security.SecurityUtil;
+import org.eclipse.emf.spi.cdo.CDOSessionProtocol;
+import org.eclipse.emf.spi.cdo.InternalCDORemoteSessionManager;
import org.eclipse.emf.spi.cdo.InternalCDOSession;
+import org.eclipse.emf.spi.cdo.InternalCDOSessionConfiguration;
/**
* @author Eike Stepper
*/
-public abstract class CDOSessionConfigurationImpl implements CDOSessionConfiguration
+public abstract class CDOSessionConfigurationImpl implements InternalCDOSessionConfiguration
{
- private InternalCDOSession session;
-
- private CDOSession.ExceptionHandler exceptionHandler;
+ private boolean passiveUpdateEnabled = true;
private CDOAuthenticator authenticator = new AuthenticatorImpl();
+ private CDOSession.ExceptionHandler exceptionHandler;
+
private boolean activateOnOpen = true;
+ private InternalCDOSession session;
+
public CDOSessionConfigurationImpl()
{
}
- public CDOSession.ExceptionHandler getExceptionHandler()
+ public boolean isPassiveUpdateEnabled()
{
- return exceptionHandler;
+ return passiveUpdateEnabled;
}
- public void setExceptionHandler(CDOSession.ExceptionHandler exceptionHandler)
+ public void setPassiveUpdateEnabled(boolean passiveUpdateEnabled)
{
checkNotOpen();
- this.exceptionHandler = exceptionHandler;
+ this.passiveUpdateEnabled = passiveUpdateEnabled;
}
public CDOAuthenticator getAuthenticator()
@@ -62,6 +69,17 @@ public abstract class CDOSessionConfigurationImpl implements CDOSessionConfigura
this.authenticator = authenticator;
}
+ public CDOSession.ExceptionHandler getExceptionHandler()
+ {
+ return exceptionHandler;
+ }
+
+ public void setExceptionHandler(CDOSession.ExceptionHandler exceptionHandler)
+ {
+ checkNotOpen();
+ this.exceptionHandler = exceptionHandler;
+ }
+
public boolean isActivateOnOpen()
{
return activateOnOpen;
@@ -98,8 +116,6 @@ public abstract class CDOSessionConfigurationImpl implements CDOSessionConfigura
{
session = createSession();
session.setExceptionHandler(exceptionHandler);
- session.setAuthenticator(authenticator);
-
if (activateOnOpen)
{
session.activate();
@@ -109,6 +125,39 @@ public abstract class CDOSessionConfigurationImpl implements CDOSessionConfigura
return session;
}
+ public InternalCDOSession getSession()
+ {
+ checkOpen();
+ return session;
+ }
+
+ public void activateSession(InternalCDOSession session) throws Exception
+ {
+ InternalCDORemoteSessionManager remoteSessionManager = new CDORemoteSessionManagerImpl(session);
+ session.setRemoteSessionManager(remoteSessionManager);
+ remoteSessionManager.activate();
+ }
+
+ public void deactivateSession(InternalCDOSession session) throws Exception
+ {
+ CDORemoteSessionManager remoteSessionManager = session.getRemoteSessionManager();
+ session.setRemoteSessionManager(null);
+ LifecycleUtil.deactivate(remoteSessionManager);
+
+ CDOSessionProtocol sessionProtocol = session.getSessionProtocol();
+ LifecycleUtil.deactivate(sessionProtocol);
+ session.setSessionProtocol(null);
+ session = null;
+ }
+
+ protected void checkOpen()
+ {
+ if (!isSessionOpen())
+ {
+ throw new IllegalStateException(Messages.getString("CDOSessionConfigurationImpl.1")); //$NON-NLS-1$
+ }
+ }
+
protected void checkNotOpen()
{
if (isSessionOpen())
@@ -117,8 +166,6 @@ public abstract class CDOSessionConfigurationImpl implements CDOSessionConfigura
}
}
- protected abstract InternalCDOSession createSession();
-
/**
* @author Eike Stepper
*/
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 6633698117..538f5df98e 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
@@ -24,20 +24,15 @@ import org.eclipse.emf.cdo.common.id.CDOIDObject;
import org.eclipse.emf.cdo.common.id.CDOIDObjectFactory;
import org.eclipse.emf.cdo.common.id.CDOIDUtil;
import org.eclipse.emf.cdo.common.model.CDOPackageUnit;
-import org.eclipse.emf.cdo.common.model.EMFUtil;
import org.eclipse.emf.cdo.common.protocol.CDOAuthenticator;
import org.eclipse.emf.cdo.common.revision.CDORevision;
import org.eclipse.emf.cdo.common.revision.delta.CDORevisionDelta;
import org.eclipse.emf.cdo.common.util.CDOException;
-import org.eclipse.emf.cdo.eresource.EresourcePackage;
-import org.eclipse.emf.cdo.internal.common.model.CDOPackageRegistryImpl;
-import org.eclipse.emf.cdo.internal.common.revision.CDORevisionManagerImpl;
import org.eclipse.emf.cdo.session.CDOCollectionLoadingPolicy;
+import org.eclipse.emf.cdo.session.CDORepositoryInfo;
import org.eclipse.emf.cdo.session.CDOSession;
import org.eclipse.emf.cdo.session.CDOSessionInvalidationEvent;
import org.eclipse.emf.cdo.session.remote.CDORemoteSession;
-import org.eclipse.emf.cdo.spi.common.model.InternalCDOPackageRegistry;
-import org.eclipse.emf.cdo.spi.common.model.InternalCDOPackageUnit;
import org.eclipse.emf.cdo.spi.common.revision.InternalCDORevision;
import org.eclipse.emf.cdo.spi.common.revision.InternalCDORevisionManager;
import org.eclipse.emf.cdo.transaction.CDOTimeStampContext;
@@ -48,7 +43,6 @@ import org.eclipse.emf.cdo.view.CDOView;
import org.eclipse.emf.internal.cdo.CDOFactoryImpl;
import org.eclipse.emf.internal.cdo.bundle.OM;
import org.eclipse.emf.internal.cdo.messages.Messages;
-import org.eclipse.emf.internal.cdo.session.remote.CDORemoteSessionManagerImpl;
import org.eclipse.emf.internal.cdo.transaction.CDOTransactionImpl;
import org.eclipse.emf.internal.cdo.view.CDOAuditImpl;
import org.eclipse.emf.internal.cdo.view.CDOViewImpl;
@@ -78,7 +72,6 @@ import org.eclipse.net4j.util.options.OptionsEvent;
import org.eclipse.emf.ecore.EPackage;
import org.eclipse.emf.ecore.EStructuralFeature;
-import org.eclipse.emf.ecore.EcorePackage;
import org.eclipse.emf.ecore.resource.ResourceSet;
import org.eclipse.emf.ecore.resource.impl.ResourceSetImpl;
import org.eclipse.emf.spi.cdo.AbstractQueryIterator;
@@ -86,11 +79,10 @@ import org.eclipse.emf.spi.cdo.CDOSessionProtocol;
import org.eclipse.emf.spi.cdo.InternalCDOObject;
import org.eclipse.emf.spi.cdo.InternalCDORemoteSessionManager;
import org.eclipse.emf.spi.cdo.InternalCDOSession;
+import org.eclipse.emf.spi.cdo.InternalCDOSessionConfiguration;
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 org.eclipse.emf.spi.cdo.InternalCDOTransaction.InternalCDOCommitContext;
import org.eclipse.emf.spi.cdo.InternalCDOXATransaction.InternalCDOXACommitContext;
@@ -114,6 +106,8 @@ public abstract class CDOSessionImpl extends Container<CDOView> implements Inter
{
private static final ContextTracer TRACER = new ContextTracer(OM.DEBUG_SESSION, CDOSessionImpl.class);
+ private InternalCDOSessionConfiguration configuration;
+
private ExceptionHandler exceptionHandler;
private CDOSessionProtocol sessionProtocol;
@@ -132,13 +126,9 @@ public abstract class CDOSessionImpl extends Container<CDOView> implements Inter
private String userID;
- private CDOSession.Options options;
-
- private CDOSession.Repository repository;
-
- private InternalCDOPackageRegistry packageRegistry;
+ private CDOSession.Options options = createOptions();
- private InternalCDORevisionManager revisionManager;
+ private CDORepositoryInfo repositoryInfo;
private CDOFetchRuleManager ruleManager = CDOFetchRuleManager.NOOP;
@@ -165,10 +155,24 @@ public abstract class CDOSessionImpl extends Container<CDOView> implements Inter
@ExcludeFromDump
private transient int lastViewID;
- public CDOSessionImpl()
+ public CDOSessionImpl(InternalCDOSessionConfiguration configuration)
+ {
+ this.configuration = configuration;
+ }
+
+ public InternalCDOSessionConfiguration getConfiguration()
{
- remoteSessionManager = createRemoteSessionManager();
- options = createOptions();
+ return configuration;
+ }
+
+ public CDORepositoryInfo getRepositoryInfo()
+ {
+ return repositoryInfo;
+ }
+
+ public void setRepositoryInfo(CDORepositoryInfo repositoryInfo)
+ {
+ this.repositoryInfo = repositoryInfo;
}
public int getSessionID()
@@ -176,6 +180,11 @@ public abstract class CDOSessionImpl extends Container<CDOView> implements Inter
return sessionID;
}
+ public void setSessionID(int sessionID)
+ {
+ this.sessionID = sessionID;
+ }
+
public String getUserID()
{
return userID;
@@ -213,31 +222,14 @@ public abstract class CDOSessionImpl extends Container<CDOView> implements Inter
return new OptionsImpl();
}
- /**
- * @since 2.0
- */
- public CDOSession.Repository repository()
- {
- return repository;
- }
-
- public void setRepository(CDOSession.Repository repository)
+ public CDOSessionProtocol getSessionProtocol()
{
- this.repository = repository;
+ return sessionProtocol;
}
- /**
- * @param result
- * @since 2.0
- */
- protected CDOSession.Repository createRepository(OpenSessionResult result)
+ public void setSessionProtocol(CDOSessionProtocol sessionProtocol)
{
- return new RepositoryImpl(repository.getName(), result);
- }
-
- public CDOSessionProtocol getSessionProtocol()
- {
- return sessionProtocol;
+ this.sessionProtocol = sessionProtocol;
}
public CDOIDObject createCDOIDObject(ExtendedDataInput in)
@@ -266,19 +258,6 @@ public abstract class CDOSessionImpl extends Container<CDOView> implements Inter
return !isActive();
}
- /**
- * @since 2.0
- */
- public void setPackageRegistry(InternalCDOPackageRegistry packageRegistry)
- {
- this.packageRegistry = packageRegistry;
- }
-
- public InternalCDOPackageRegistry getPackageRegistry()
- {
- return packageRegistry;
- }
-
public Object processPackage(Object value)
{
CDOFactoryImpl.prepareDynamicEPackage(value);
@@ -291,7 +270,7 @@ public abstract class CDOSessionImpl extends Container<CDOView> implements Inter
{
if (!options().isGeneratedPackageEmulationEnabled())
{
- throw new CDOException(MessageFormat.format(Messages.getString("CDOSessionImpl.0"), packageUnit)); //$NON-NLS-1$
+ throw new CDOException(MessageFormat.format(Messages.getString("CDOSessionImpl.0"), packageUnit));
}
}
@@ -315,16 +294,6 @@ public abstract class CDOSessionImpl extends Container<CDOView> implements Inter
lockmanager.unlock(LockType.WRITE, key, singletonCollection);
}
- public InternalCDORevisionManager getRevisionManager()
- {
- return revisionManager;
- }
-
- public void setRevisionManager(InternalCDORevisionManager revisionManager)
- {
- this.revisionManager = revisionManager;
- }
-
/**
* @since 3.0
*/
@@ -356,6 +325,11 @@ public abstract class CDOSessionImpl extends Container<CDOView> implements Inter
return remoteSessionManager;
}
+ public void setRemoteSessionManager(InternalCDORemoteSessionManager remoteSessionManager)
+ {
+ this.remoteSessionManager = remoteSessionManager;
+ }
+
/**
* @since 2.0
*/
@@ -614,7 +588,7 @@ public abstract class CDOSessionImpl extends Container<CDOView> implements Inter
}
else
{
- OM.LOG.info(Messages.getString("CDOSessionImpl.1")); //$NON-NLS-1$
+ OM.LOG.info(Messages.getString("CDOSessionImpl.1"));
}
}
}
@@ -645,7 +619,7 @@ public abstract class CDOSessionImpl extends Container<CDOView> implements Inter
}
else
{
- OM.LOG.info(Messages.getString("CDOSessionImpl.2")); //$NON-NLS-1$
+ OM.LOG.info(Messages.getString("CDOSessionImpl.2"));
}
}
@@ -661,6 +635,7 @@ public abstract class CDOSessionImpl extends Container<CDOView> implements Inter
private void updateRevisionForRemoteChanges(final long timeStamp, Set<CDOIDAndVersion> dirtyOIDs,
Collection<CDOID> detachedObjects, InternalCDOView excludedView)
{
+ InternalCDORevisionManager revisionManager = getRevisionManager();
if (excludedView == null || timeStamp == CDORevision.UNSPECIFIED_DATE)
{
for (CDOIDAndVersion dirtyOID : dirtyOIDs)
@@ -704,26 +679,8 @@ public abstract class CDOSessionImpl extends Container<CDOView> implements Inter
@Override
public String toString()
{
- String name = repository == null ? "?" : repository.getName();
- return MessageFormat.format("CDOSession[{0}, {1}]", name, sessionID); //$NON-NLS-1$
- }
-
- /**
- * @since 2.0
- */
- protected InternalCDOPackageRegistry createPackageRegistry()
- {
- return new CDOPackageRegistryImpl();
- }
-
- protected InternalCDORevisionManager createRevisionManager()
- {
- return new CDORevisionManagerImpl();
- }
-
- protected InternalCDORemoteSessionManager createRemoteSessionManager()
- {
- return new CDORemoteSessionManagerImpl(this);
+ String name = repositoryInfo == null ? "?" : repositoryInfo.getName();
+ return MessageFormat.format("CDOSession[{0}, {1}]", name, sessionID);
}
protected ResourceSet createResourceSet()
@@ -766,67 +723,24 @@ public abstract class CDOSessionImpl extends Container<CDOView> implements Inter
}
@Override
+ protected void doBeforeActivate() throws Exception
+ {
+ super.doBeforeActivate();
+ }
+
+ @Override
protected void doActivate() throws Exception
{
super.doActivate();
- sessionProtocol = createSessionProtocol();
+ getConfiguration().activateSession(this);
+ checkState(sessionProtocol, "sessionProtocol");
+ checkState(remoteSessionManager, "remoteSessionManager");
if (exceptionHandler != null)
{
sessionProtocol = new DelegatingSessionProtocol(sessionProtocol);
}
EventUtil.addListener(sessionProtocol, sessionProtocolListener);
- if (revisionManager == null)
- {
- revisionManager = createRevisionManager();
- }
-
- activateRevisionManager();
- remoteSessionManager.activate();
- if (packageRegistry == null)
- {
- packageRegistry = createPackageRegistry();
- }
-
- activatePackageRegistry();
-
- String name = repository().getName();
- boolean passiveUpdateEnabled = options().isPassiveUpdateEnabled();
- OpenSessionResult result = getSessionProtocol().openSession(name, passiveUpdateEnabled);
-
- sessionID = result.getSessionID();
- repository = createRepository(result);
- handleLibraryDescriptor(result.getLibraryDescriptor());
-
- for (InternalCDOPackageUnit packageUnit : result.getPackageUnits())
- {
- if (EcorePackage.eINSTANCE.getNsURI().equals(packageUnit.getID()))
- {
- EMFUtil.addAdapter(EcorePackage.eINSTANCE, packageUnit.getTopLevelPackageInfo());
- packageUnit.setState(CDOPackageUnit.State.LOADED);
- }
- else if (EresourcePackage.eINSTANCE.getNsURI().equals(packageUnit.getID()))
- {
- EMFUtil.addAdapter(EresourcePackage.eINSTANCE, packageUnit.getTopLevelPackageInfo());
- packageUnit.setState(CDOPackageUnit.State.LOADED);
- }
-
- packageRegistry.putPackageUnit(packageUnit);
- }
- }
-
- protected void activatePackageRegistry()
- {
- packageRegistry.setPackageProcessor(this);
- packageRegistry.setPackageLoader(this);
- packageRegistry.activate();
- }
-
- protected void activateRevisionManager()
- {
- revisionManager.setRevisionLoader(sessionProtocol);
- revisionManager.setRevisionLocker(this);
- LifecycleUtil.activate(revisionManager);
}
@Override
@@ -844,7 +758,6 @@ public abstract class CDOSessionImpl extends Container<CDOView> implements Inter
}
views.clear();
- views = null;
if (invalidationRunner != null)
{
@@ -852,32 +765,12 @@ public abstract class CDOSessionImpl extends Container<CDOView> implements Inter
invalidationRunner = null;
}
- deactivateRevisionManager();
- revisionManager = null;
-
- deactivatePackageRegistry();
- packageRegistry = null;
-
EventUtil.removeListener(sessionProtocol, sessionProtocolListener);
- LifecycleUtil.deactivate(sessionProtocol);
- sessionProtocol = null;
-
+ getConfiguration().deactivateSession(this);
super.doDeactivate();
}
- protected void deactivatePackageRegistry()
- {
- packageRegistry.deactivate();
- }
-
- protected void deactivateRevisionManager()
- {
- LifecycleUtil.deactivate(revisionManager);
- }
-
- protected abstract CDOSessionProtocol createSessionProtocol();
-
- private void handleLibraryDescriptor(CDOIDLibraryDescriptor libraryDescriptor) throws Exception
+ public void setLibraryDescriptor(CDOIDLibraryDescriptor libraryDescriptor) throws Exception
{
if (libraryDescriptor == null)
{
@@ -887,7 +780,7 @@ public abstract class CDOSessionImpl extends Container<CDOView> implements Inter
String factoryName = libraryDescriptor.getFactoryName();
if (TRACER.isEnabled())
{
- TRACER.format("Using CDOID factory: {0}", factoryName); //$NON-NLS-1$
+ TRACER.format("Using CDOID factory: {0}", factoryName);
}
File cacheFolder = getCacheFolder();
@@ -913,10 +806,10 @@ public abstract class CDOSessionImpl extends Container<CDOView> implements Inter
File lib = new File(cacheFolder, neededLibrary);
if (TRACER.isEnabled())
{
- TRACER.format("Using CDOID library: {0}", lib.getAbsolutePath()); //$NON-NLS-1$
+ TRACER.format("Using CDOID library: {0}", lib.getAbsolutePath());
}
- urls[i++] = new URL("file:///" + lib.getAbsolutePath()); //$NON-NLS-1$
+ urls[i++] = new URL("file:///" + lib.getAbsolutePath());
}
classLoader = new URLClassLoader(urls, classLoader);
@@ -928,7 +821,7 @@ public abstract class CDOSessionImpl extends Container<CDOView> implements Inter
{
String stateLocation = OM.BUNDLE.getStateLocation();
File repos = new File(stateLocation, "repos"); //$NON-NLS-1$
- return new File(repos, repository().getUUID());
+ return new File(repos, getRepositoryInfo().getUUID());
}
private Set<String> createSet(String[] fileNames)
@@ -936,7 +829,7 @@ public abstract class CDOSessionImpl extends Container<CDOView> implements Inter
Set<String> set = new HashSet<String>();
for (String fileName : fileNames)
{
- if (fileName.endsWith(".jar")) //$NON-NLS-1$
+ if (fileName.endsWith(".jar"))
{
set.add(fileName);
}
@@ -1092,76 +985,6 @@ public abstract class CDOSessionImpl extends Container<CDOView> implements Inter
/**
* @author Eike Stepper
*/
- protected class RepositoryImpl implements CDOSession.Repository
- {
- private String name;
-
- private String uuid;
-
- private long creationTime;
-
- private RepositoryTimeResult timeResult;
-
- private boolean supportingAudits;
-
- public RepositoryImpl(String name, OpenSessionResult result)
- {
- this.name = name;
- uuid = result.getRepositoryUUID();
- creationTime = result.getRepositoryCreationTime();
- timeResult = result.getRepositoryTimeResult();
- supportingAudits = result.isRepositorySupportingAudits();
- }
-
- public String getName()
- {
- return name;
- }
-
- /**
- * Must be callable before session activation has finished!
- */
- public String getUUID()
- {
- return uuid;
- }
-
- public long getCreationTime()
- {
- checkActive();
- return creationTime;
- }
-
- public long getCurrentTime()
- {
- return getCurrentTime(false);
- }
-
- public long getCurrentTime(boolean forceRefresh)
- {
- checkActive();
- if (timeResult == null || forceRefresh)
- {
- timeResult = refreshTime();
- }
-
- return timeResult.getAproximateRepositoryTime();
- }
-
- public boolean isSupportingAudits()
- {
- return supportingAudits;
- }
-
- private RepositoryTimeResult refreshTime()
- {
- return getSessionProtocol().getRepositoryTime();
- }
- }
-
- /**
- * @author Eike Stepper
- */
private final class InvalidationEvent extends Event implements CDOSessionInvalidationEvent
{
private static final long serialVersionUID = 1L;
@@ -1226,7 +1049,7 @@ public abstract class CDOSessionImpl extends Container<CDOView> implements Inter
@Override
public String toString()
{
- return "CDOSessionInvalidationEvent: " + dirtyOIDs; //$NON-NLS-1$
+ return "CDOSessionInvalidationEvent: " + dirtyOIDs;
}
}
@@ -1621,22 +1444,6 @@ public abstract class CDOSessionImpl extends Container<CDOView> implements Inter
}
}
- public OpenSessionResult openSession(String repositoryName, boolean passiveUpdateEnabled)
- {
- int attempt = 0;
- for (;;)
- {
- try
- {
- return delegate.openSession(repositoryName, passiveUpdateEnabled);
- }
- catch (Exception ex)
- {
- handleException(++attempt, ex);
- }
- }
- }
-
public void openView(int viewId, CDOCommonView.Type viewType, long timeStamp)
{
int attempt = 0;
diff --git a/plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/internal/cdo/view/CDOViewSetImpl.java b/plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/internal/cdo/view/CDOViewSetImpl.java
index f26e8f5264..3d17c4a269 100644
--- a/plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/internal/cdo/view/CDOViewSetImpl.java
+++ b/plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/internal/cdo/view/CDOViewSetImpl.java
@@ -125,7 +125,7 @@ public class CDOViewSetImpl extends NotifierImpl implements InternalCDOViewSet
public void add(InternalCDOView view)
{
- String repositoryUUID = view.getSession().repository().getUUID();
+ String repositoryUUID = view.getSession().getRepositoryInfo().getUUID();
synchronized (views)
{
CDOView lookupView = mapOfViews.get(repositoryUUID);
@@ -147,7 +147,7 @@ public class CDOViewSetImpl extends NotifierImpl implements InternalCDOViewSet
public void remove(InternalCDOView view)
{
- String repositoryUUID = view.getSession().repository().getUUID();
+ String repositoryUUID = view.getSession().getRepositoryInfo().getUUID();
List<Resource> resToRemove = new ArrayList<Resource>();
synchronized (views)
{
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 832a9ee7d8..ba65fb3912 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
@@ -53,7 +53,7 @@ public class PluginContainerViewProvider extends ManagedContainerViewProvider im
for (Object element : container.getElements(CDOSessionFactory.PRODUCT_GROUP))
{
CDOSession session = (CDOSession)element;
- String uuid = session.repository().getUUID();
+ String uuid = session.getRepositoryInfo().getUUID();
if (repoUUID.equals(uuid))
{
CDOView view = openView(session, resourceSet);
diff --git a/plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/spi/cdo/CDOSessionProtocol.java b/plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/spi/cdo/CDOSessionProtocol.java
index 8b8f6d60c1..108796972e 100644
--- a/plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/spi/cdo/CDOSessionProtocol.java
+++ b/plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/spi/cdo/CDOSessionProtocol.java
@@ -51,8 +51,6 @@ import java.util.Set;
*/
public interface CDOSessionProtocol extends CDOProtocol, PackageLoader, RevisionLoader
{
- public OpenSessionResult openSession(String repositoryName, boolean passiveUpdateEnabled);
-
public void loadLibraries(Set<String> missingLibraries, File cacheFolder);
public void setPassiveUpdate(Map<CDOID, CDOIDAndVersion> idAndVersions, int initialChunkSize,
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 53ef541128..33e1b9a1cb 100644
--- a/plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/spi/cdo/InternalCDOSession.java
+++ b/plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/spi/cdo/InternalCDOSession.java
@@ -12,11 +12,12 @@ package org.eclipse.emf.spi.cdo;
import org.eclipse.emf.cdo.common.id.CDOID;
import org.eclipse.emf.cdo.common.id.CDOIDAndVersion;
+import org.eclipse.emf.cdo.common.id.CDOIDLibraryDescriptor;
import org.eclipse.emf.cdo.common.id.CDOIDObjectFactory;
import org.eclipse.emf.cdo.common.model.CDOPackageUnit;
-import org.eclipse.emf.cdo.common.protocol.CDOAuthenticator;
import org.eclipse.emf.cdo.common.revision.CDORevision;
import org.eclipse.emf.cdo.common.revision.delta.CDORevisionDelta;
+import org.eclipse.emf.cdo.session.CDORepositoryInfo;
import org.eclipse.emf.cdo.session.CDOSession;
import org.eclipse.emf.cdo.spi.common.model.InternalCDOPackageRegistry;
import org.eclipse.emf.cdo.spi.common.model.InternalCDOPackageRegistry.PackageLoader;
@@ -39,11 +40,23 @@ import java.util.Set;
public interface InternalCDOSession extends CDOSession, CDOIDObjectFactory, PackageProcessor, PackageLoader,
RevisionLocker, ILifecycle
{
+ /**
+ * @since 3.0
+ */
+ public InternalCDOSessionConfiguration getConfiguration();
+
public CDOSessionProtocol getSessionProtocol();
/**
* @since 3.0
*/
+ public void setSessionProtocol(CDOSessionProtocol sessionProtocol);
+
+ public InternalCDOPackageRegistry getPackageRegistry();
+
+ /**
+ * @since 3.0
+ */
public InternalCDORevisionManager getRevisionManager();
public void setExceptionHandler(CDOSession.ExceptionHandler exceptionHandler);
@@ -53,13 +66,25 @@ public interface InternalCDOSession extends CDOSession, CDOIDObjectFactory, Pack
*/
public void setFetchRuleManager(CDOFetchRuleManager fetchRuleManager);
- public InternalCDOPackageRegistry getPackageRegistry();
+ /**
+ * @since 3.0
+ */
+ public void setRepositoryInfo(CDORepositoryInfo repositoryInfo);
- public void setPackageRegistry(InternalCDOPackageRegistry packageRegistry);
+ /**
+ * @since 3.0
+ */
+ public void setLibraryDescriptor(CDOIDLibraryDescriptor libraryDescriptor) throws Exception;
- public CDOAuthenticator getAuthenticator();
+ /**
+ * @since 3.0
+ */
+ public void setRemoteSessionManager(InternalCDORemoteSessionManager remoteSessionManager);
- public void setAuthenticator(CDOAuthenticator authenticator);
+ /**
+ * @since 3.0
+ */
+ public void setSessionID(int sessionID);
public void setUserID(String userID);
diff --git a/plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/spi/cdo/InternalCDOSessionConfiguration.java b/plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/spi/cdo/InternalCDOSessionConfiguration.java
new file mode 100644
index 0000000000..3397dba631
--- /dev/null
+++ b/plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/spi/cdo/InternalCDOSessionConfiguration.java
@@ -0,0 +1,28 @@
+/**
+ * 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.spi.cdo;
+
+import org.eclipse.emf.cdo.session.CDOSessionConfiguration;
+
+/**
+ * @author Eike Stepper
+ * @since 3.0
+ */
+public interface InternalCDOSessionConfiguration extends CDOSessionConfiguration
+{
+ public InternalCDOSession getSession();
+
+ public InternalCDOSession createSession();
+
+ public void activateSession(InternalCDOSession session) throws Exception;
+
+ public void deactivateSession(InternalCDOSession session) throws Exception;
+}

Back to the top