summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorCaspar De Groot2010-10-11 03:14:20 (EDT)
committerCaspar De Groot2010-10-11 03:14:20 (EDT)
commit9fb93157a93d7ddd0f6cef07d5a362a8959d7eb2 (patch)
treebb1f662b0b1e63cf6e9de04bb92fc1059a46ec29
parent51287706ff9bd5f983392816c84a69338cda5db6 (diff)
downloadcdo-9fb93157a93d7ddd0f6cef07d5a362a8959d7eb2.zip
cdo-9fb93157a93d7ddd0f6cef07d5a362a8959d7eb2.tar.gz
cdo-9fb93157a93d7ddd0f6cef07d5a362a8959d7eb2.tar.bz2
[327296] Clean up relation between Session and SessionConfig
https://bugs.eclipse.org/bugs/show_bug.cgi?id=327296
-rw-r--r--plugins/org.eclipse.emf.cdo.net4j/src/org/eclipse/emf/cdo/internal/net4j/CDONet4jSessionConfigurationImpl.java188
-rw-r--r--plugins/org.eclipse.emf.cdo.net4j/src/org/eclipse/emf/cdo/internal/net4j/CDONet4jSessionImpl.java143
-rw-r--r--plugins/org.eclipse.emf.cdo.net4j/src/org/eclipse/emf/cdo/internal/net4j/FailoverCDOSessionConfigurationImpl.java161
-rw-r--r--plugins/org.eclipse.emf.cdo.net4j/src/org/eclipse/emf/cdo/internal/net4j/FailoverCDOSessionImpl.java158
-rw-r--r--plugins/org.eclipse.emf.cdo.net4j/src/org/eclipse/emf/cdo/internal/net4j/Net4jConnectorInjector.java2
-rw-r--r--plugins/org.eclipse.emf.cdo.net4j/src/org/eclipse/emf/cdo/internal/net4j/protocol/AuthenticationIndication.java2
-rw-r--r--plugins/org.eclipse.emf.cdo.net4j/src/org/eclipse/emf/cdo/net4j/CDONet4jUtil.java16
-rw-r--r--plugins/org.eclipse.emf.cdo.net4j/src/org/eclipse/emf/cdo/net4j/CDONet4jViewProvider.java6
-rw-r--r--plugins/org.eclipse.emf.cdo.server/src/org/eclipse/emf/cdo/internal/server/ServerCDOView.java29
-rw-r--r--plugins/org.eclipse.emf.cdo.server/src/org/eclipse/emf/cdo/internal/server/embedded/EmbeddedClientSession.java51
-rw-r--r--plugins/org.eclipse.emf.cdo.server/src/org/eclipse/emf/cdo/internal/server/embedded/EmbeddedClientSessionConfiguration.java78
-rw-r--r--plugins/org.eclipse.emf.cdo.server/src/org/eclipse/emf/cdo/internal/server/embedded/EmbeddedClientSessionProtocol.java2
-rw-r--r--plugins/org.eclipse.emf.cdo.tests/src/org/eclipse/emf/cdo/tests/config/impl/RepositoryConfig.java2
-rw-r--r--plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/cdo/session/CDOSession.java13
-rw-r--r--plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/internal/cdo/session/CDOSessionConfigurationImpl.java111
-rw-r--r--plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/internal/cdo/session/CDOSessionImpl.java192
-rw-r--r--plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/spi/cdo/InternalCDOSession.java46
-rw-r--r--plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/spi/cdo/InternalCDOSessionConfiguration.java4
18 files changed, 650 insertions, 554 deletions
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 33ff7bc..c013a3a 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,25 +11,8 @@
**************************************************************************/
package org.eclipse.emf.cdo.internal.net4j;
-import org.eclipse.emf.cdo.common.branch.CDOBranchManager;
-import org.eclipse.emf.cdo.common.commit.CDOCommitInfoManager;
import org.eclipse.emf.cdo.common.id.CDOID;
-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.common.revision.CDORevisionUtil;
-import org.eclipse.emf.cdo.eresource.EresourcePackage;
-import org.eclipse.emf.cdo.internal.common.model.CDOPackageRegistryImpl;
-import org.eclipse.emf.cdo.internal.net4j.protocol.CDOClientProtocol;
import org.eclipse.emf.cdo.session.CDORepositoryInfo;
-import org.eclipse.emf.cdo.spi.common.branch.CDOBranchUtil;
-import org.eclipse.emf.cdo.spi.common.branch.InternalCDOBranchManager;
-import org.eclipse.emf.cdo.spi.common.commit.CDOCommitInfoUtil;
-import org.eclipse.emf.cdo.spi.common.commit.InternalCDOCommitInfoManager;
-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;
@@ -37,7 +20,6 @@ import org.eclipse.net4j.connector.IConnector;
import org.eclipse.net4j.util.CheckUtil;
import org.eclipse.net4j.util.io.IStreamWrapper;
-import org.eclipse.emf.ecore.EcorePackage;
import org.eclipse.emf.spi.cdo.CDOSessionProtocol.OpenSessionResult;
import org.eclipse.emf.spi.cdo.CDOSessionProtocol.RepositoryTimeResult;
import org.eclipse.emf.spi.cdo.InternalCDOSession;
@@ -56,14 +38,6 @@ public class CDONet4jSessionConfigurationImpl extends CDOSessionConfigurationImp
private IStreamWrapper streamWrapper;
- private InternalCDOBranchManager branchManager;
-
- private InternalCDOPackageRegistry packageRegistry;
-
- private InternalCDORevisionManager revisionManager;
-
- private InternalCDOCommitInfoManager commitInfoManager;
-
public CDONet4jSessionConfigurationImpl()
{
}
@@ -111,64 +85,6 @@ public class CDONet4jSessionConfigurationImpl extends CDOSessionConfigurationImp
this.streamWrapper = streamWrapper;
}
- public InternalCDOBranchManager getBranchManager()
- {
- return branchManager;
- }
-
- public void setBranchManager(CDOBranchManager branchManager)
- {
- checkNotOpen();
- this.branchManager = (InternalCDOBranchManager)branchManager;
- }
-
- public InternalCDOPackageRegistry getPackageRegistry()
- {
- return packageRegistry;
- }
-
- public void setPackageRegistry(CDOPackageRegistry packageRegistry)
- {
- checkNotOpen();
- this.packageRegistry = (InternalCDOPackageRegistry)packageRegistry;
- }
-
- public InternalCDORevisionManager getRevisionManager()
- {
- return revisionManager;
- }
-
- public void setRevisionManager(CDORevisionManager revisionManager)
- {
- checkNotOpen();
- this.revisionManager = (InternalCDORevisionManager)revisionManager;
- }
-
- /**
- * Returns the commit info manager. The commit info manager may be used to query commit infos.
- *
- * @return the commit info manager
- * @see CDOCommitInfoManager
- */
- public InternalCDOCommitInfoManager getCommitInfoManager()
- {
- return commitInfoManager;
- }
-
- /**
- * Sets the commit info manager. The commit info manager may be used to query commit infos. May only be called as long
- * as the session's not opened yet
- *
- * @param commitInfoManager
- * the new commit info manager
- * @see CDOCommitInfoManager
- */
- public void setCommitInfoManager(CDOCommitInfoManager commitInfoManager)
- {
- checkNotOpen();
- this.commitInfoManager = (InternalCDOCommitInfoManager)commitInfoManager;
- }
-
@Override
public org.eclipse.emf.cdo.net4j.CDOSession openSession()
{
@@ -182,105 +98,24 @@ public class CDONet4jSessionConfigurationImpl extends CDOSessionConfigurationImp
CheckUtil.checkState(connector, "connector"); //$NON-NLS-1$
}
- return new CDONet4jSessionImpl(this);
+ return new CDONet4jSessionImpl();
}
@Override
- public void activateSession(InternalCDOSession session) throws Exception
+ protected void configureSession(InternalCDOSession session)
{
- super.activateSession(session);
- OpenSessionResult result = initProtocol(session);
+ super.configureSession(session);
- if (packageRegistry == null)
- {
- packageRegistry = new CDOPackageRegistryImpl();
- }
-
- packageRegistry.setPackageProcessor(session);
- packageRegistry.setPackageLoader(session);
- packageRegistry.activate();
-
- if (revisionManager == null)
- {
- revisionManager = (InternalCDORevisionManager)CDORevisionUtil.createRevisionManager();
- }
-
- revisionManager.setSupportingBranches(session.getRepositoryInfo().isSupportingBranches());
- revisionManager.setRevisionLoader(session.getSessionProtocol());
- revisionManager.setRevisionLocker(session);
- revisionManager.activate();
-
- if (branchManager == null)
- {
- branchManager = CDOBranchUtil.createBranchManager();
- }
-
- branchManager.setBranchLoader(session.getSessionProtocol());
- branchManager.setTimeProvider(session.getRepositoryInfo());
- branchManager.initMainBranch(false, session.getRepositoryInfo().getCreationTime());
- branchManager.activate();
-
- if (commitInfoManager == null)
- {
- commitInfoManager = CDOCommitInfoUtil.createCommitInfoManager();
- }
-
- commitInfoManager.setCommitInfoLoader(session.getSessionProtocol());
- commitInfoManager.activate();
-
- for (InternalCDOPackageUnit packageUnit : result.getPackageUnits())
- {
- if (EcorePackage.eINSTANCE.getNsURI().equals(packageUnit.getID()))
- {
- EMFUtil.addAdapter(EcorePackage.eINSTANCE, packageUnit.getTopLevelPackageInfo());
- packageUnit.setState(CDOPackageUnit.State.LOADED);
- }
- else if (EresourcePackage.eINSTANCE.getNsURI().equals(packageUnit.getID()))
- {
- EMFUtil.addAdapter(EresourcePackage.eINSTANCE, packageUnit.getTopLevelPackageInfo());
- packageUnit.setState(CDOPackageUnit.State.LOADED);
- }
-
- getPackageRegistry().putPackageUnit(packageUnit);
- }
- }
-
- protected OpenSessionResult initProtocol(InternalCDOSession session)
- {
- CDOClientProtocol protocol = new CDOClientProtocol();
- protocol.setInfraStructure(session);
- if (streamWrapper != null)
- {
- protocol.setStreamWrapper(streamWrapper);
- }
-
- session.setSessionProtocol(protocol);
- protocol.open(connector);
-
- OpenSessionResult result = protocol.openSession(repositoryName, isPassiveUpdateEnabled(), getPassiveUpdateMode());
- session.setSessionID(result.getSessionID());
- session.setUserID(result.getUserID());
- session.setLastUpdateTime(result.getLastUpdateTime());
- session.setRepositoryInfo(new RepositoryInfo(repositoryName, result));
- return result;
- }
-
- @Override
- public void deactivateSession(InternalCDOSession session) throws Exception
- {
- commitInfoManager.deactivate();
- revisionManager.deactivate();
-
- // branchManager.deactivate();
- // packageRegistry.deactivate();
-
- super.deactivateSession(session);
+ CDONet4jSessionImpl sessionImpl = (CDONet4jSessionImpl)session;
+ sessionImpl.setStreamWrapper(streamWrapper);
+ sessionImpl.setConnector(connector);
+ sessionImpl.setRepositoryName(repositoryName);
}
/**
* @author Eike Stepper
*/
- public class RepositoryInfo implements CDORepositoryInfo
+ public static class RepositoryInfo implements CDORepositoryInfo
{
private String name;
@@ -306,7 +141,9 @@ public class CDONet4jSessionConfigurationImpl extends CDOSessionConfigurationImp
private boolean ensuringReferentialIntegrity;
- public RepositoryInfo(String name, OpenSessionResult result)
+ private InternalCDOSession session;
+
+ public RepositoryInfo(String name, OpenSessionResult result, InternalCDOSession session)
{
this.name = name;
uuid = result.getRepositoryUUID();
@@ -320,6 +157,7 @@ public class CDONet4jSessionConfigurationImpl extends CDOSessionConfigurationImp
supportingAudits = result.isRepositorySupportingAudits();
supportingBranches = result.isRepositorySupportingBranches();
ensuringReferentialIntegrity = result.isRepositoryEnsuringReferentialIntegrity();
+ this.session = session;
}
public String getName()
@@ -407,7 +245,7 @@ public class CDONet4jSessionConfigurationImpl extends CDOSessionConfigurationImp
private RepositoryTimeResult refreshTime()
{
- return getSession().getSessionProtocol().getRepositoryTime();
+ return session.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 081dbe1..4d27cc1 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,53 +16,61 @@
**************************************************************************/
package org.eclipse.emf.cdo.internal.net4j;
+import org.eclipse.emf.cdo.common.model.CDOPackageUnit;
+import org.eclipse.emf.cdo.common.model.EMFUtil;
+import org.eclipse.emf.cdo.common.revision.CDORevisionUtil;
+import org.eclipse.emf.cdo.eresource.EresourcePackage;
+import org.eclipse.emf.cdo.internal.common.model.CDOPackageRegistryImpl;
+import org.eclipse.emf.cdo.internal.net4j.CDONet4jSessionConfigurationImpl.RepositoryInfo;
+import org.eclipse.emf.cdo.internal.net4j.protocol.CDOClientProtocol;
import org.eclipse.emf.cdo.internal.net4j.protocol.CommitTransactionRequest;
import org.eclipse.emf.cdo.net4j.CDOSession;
+import org.eclipse.emf.cdo.spi.common.branch.CDOBranchUtil;
import org.eclipse.emf.cdo.spi.common.branch.InternalCDOBranchManager;
+import org.eclipse.emf.cdo.spi.common.commit.CDOCommitInfoUtil;
import org.eclipse.emf.cdo.spi.common.commit.InternalCDOCommitInfoManager;
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.CDOSessionImpl;
+import org.eclipse.net4j.connector.IConnector;
import org.eclipse.net4j.signal.ISignalProtocol;
+import org.eclipse.net4j.util.io.IStreamWrapper;
+import org.eclipse.emf.ecore.EcorePackage;
import org.eclipse.emf.spi.cdo.CDOSessionProtocol;
+import org.eclipse.emf.spi.cdo.CDOSessionProtocol.OpenSessionResult;
/**
* @author Eike Stepper
*/
public class CDONet4jSessionImpl extends CDOSessionImpl implements org.eclipse.emf.cdo.net4j.CDOSession
{
- public CDONet4jSessionImpl(CDONet4jSessionConfigurationImpl configuration)
- {
- super(configuration);
- }
+ private IStreamWrapper streamWrapper;
- @Override
- public CDONet4jSessionConfigurationImpl getConfiguration()
- {
- return (CDONet4jSessionConfigurationImpl)super.getConfiguration();
- }
+ private IConnector connector;
+
+ protected String repositoryName; // TODO (CD) Eliminate? (Duplicates name in repoInfo field)
- public InternalCDOPackageRegistry getPackageRegistry()
+ public CDONet4jSessionImpl()
{
- return getConfiguration().getPackageRegistry();
}
- public InternalCDOBranchManager getBranchManager()
+ public void setStreamWrapper(IStreamWrapper streamWrapper)
{
- return getConfiguration().getBranchManager();
+ this.streamWrapper = streamWrapper;
}
- public InternalCDORevisionManager getRevisionManager()
+ public void setConnector(IConnector connector)
{
- return getConfiguration().getRevisionManager();
+ this.connector = connector;
}
- public InternalCDOCommitInfoManager getCommitInfoManager()
+ public void setRepositoryName(String repositoryName)
{
- return getConfiguration().getCommitInfoManager();
+ this.repositoryName = repositoryName;
}
@Override
@@ -77,6 +85,107 @@ public class CDONet4jSessionImpl extends CDOSessionImpl implements org.eclipse.e
return new OptionsImpl();
}
+ @Override
+ protected void activateSession() throws Exception
+ {
+ super.activateSession();
+ OpenSessionResult result = initProtocol();
+
+ InternalCDOPackageRegistry packageRegistry = getPackageRegistry();
+ if (packageRegistry == null)
+ {
+ packageRegistry = new CDOPackageRegistryImpl();
+ setPackageRegistry(packageRegistry);
+ }
+
+ packageRegistry.setPackageProcessor(this);
+ packageRegistry.setPackageLoader(this);
+ packageRegistry.activate();
+
+ InternalCDORevisionManager revisionManager = getRevisionManager();
+ if (revisionManager == null)
+ {
+ revisionManager = (InternalCDORevisionManager)CDORevisionUtil.createRevisionManager();
+ setRevisionManager(revisionManager);
+ }
+
+ revisionManager.setSupportingBranches(getRepositoryInfo().isSupportingBranches());
+ revisionManager.setRevisionLoader(getSessionProtocol());
+ revisionManager.setRevisionLocker(this);
+ revisionManager.activate();
+
+ InternalCDOBranchManager branchManager = getBranchManager();
+ if (branchManager == null)
+ {
+ branchManager = CDOBranchUtil.createBranchManager();
+ setBranchManager(branchManager);
+ }
+
+ branchManager.setBranchLoader(getSessionProtocol());
+ branchManager.setTimeProvider(getRepositoryInfo());
+ branchManager.initMainBranch(false, getRepositoryInfo().getCreationTime());
+ branchManager.activate();
+
+ InternalCDOCommitInfoManager commitInfoManager = getCommitInfoManager();
+ if (commitInfoManager == null)
+ {
+ commitInfoManager = CDOCommitInfoUtil.createCommitInfoManager();
+ setCommitInfoManager(commitInfoManager);
+ }
+
+ commitInfoManager.setCommitInfoLoader(getSessionProtocol());
+ commitInfoManager.activate();
+
+ for (InternalCDOPackageUnit packageUnit : result.getPackageUnits())
+ {
+ if (EcorePackage.eINSTANCE.getNsURI().equals(packageUnit.getID()))
+ {
+ EMFUtil.addAdapter(EcorePackage.eINSTANCE, packageUnit.getTopLevelPackageInfo());
+ packageUnit.setState(CDOPackageUnit.State.LOADED);
+ }
+ else if (EresourcePackage.eINSTANCE.getNsURI().equals(packageUnit.getID()))
+ {
+ EMFUtil.addAdapter(EresourcePackage.eINSTANCE, packageUnit.getTopLevelPackageInfo());
+ packageUnit.setState(CDOPackageUnit.State.LOADED);
+ }
+
+ getPackageRegistry().putPackageUnit(packageUnit);
+ }
+ }
+
+ protected OpenSessionResult initProtocol()
+ {
+ CDOClientProtocol protocol = new CDOClientProtocol();
+ protocol.setInfraStructure(this);
+ if (streamWrapper != null)
+ {
+ protocol.setStreamWrapper(streamWrapper);
+ }
+
+ setSessionProtocol(protocol);
+ protocol.open(connector);
+
+ OpenSessionResult result = protocol.openSession(repositoryName, options().isPassiveUpdateEnabled(), options()
+ .getPassiveUpdateMode());
+ setSessionID(result.getSessionID());
+ setUserID(result.getUserID());
+ setLastUpdateTime(result.getLastUpdateTime());
+ setRepositoryInfo(new RepositoryInfo(repositoryName, result, this));
+ return result;
+ }
+
+ @Override
+ protected void deactivateSession() throws Exception
+ {
+ getCommitInfoManager().deactivate();
+ getRevisionManager().deactivate();
+
+ // branchManager.deactivate();
+ // packageRegistry.deactivate();
+
+ super.deactivateSession();
+ }
+
/**
* @author Eike Stepper
*/
diff --git a/plugins/org.eclipse.emf.cdo.net4j/src/org/eclipse/emf/cdo/internal/net4j/FailoverCDOSessionConfigurationImpl.java b/plugins/org.eclipse.emf.cdo.net4j/src/org/eclipse/emf/cdo/internal/net4j/FailoverCDOSessionConfigurationImpl.java
index c319e64..f805e07 100644
--- a/plugins/org.eclipse.emf.cdo.net4j/src/org/eclipse/emf/cdo/internal/net4j/FailoverCDOSessionConfigurationImpl.java
+++ b/plugins/org.eclipse.emf.cdo.net4j/src/org/eclipse/emf/cdo/internal/net4j/FailoverCDOSessionConfigurationImpl.java
@@ -10,30 +10,13 @@
*/
package org.eclipse.emf.cdo.internal.net4j;
-import org.eclipse.emf.cdo.common.branch.CDOBranchPoint;
-import org.eclipse.emf.cdo.internal.net4j.FailoverCDOSessionImpl.AfterFailoverRunnable;
import org.eclipse.emf.cdo.net4j.FailoverCDOSessionConfiguration;
import org.eclipse.emf.cdo.session.CDOSession.ExceptionHandler;
-import org.eclipse.emf.cdo.spi.common.branch.CDOBranchUtil;
-import org.eclipse.emf.cdo.transaction.CDOTransaction;
import org.eclipse.net4j.connector.IConnector;
-import org.eclipse.net4j.signal.RequestWithConfirmation;
-import org.eclipse.net4j.signal.SignalProtocol;
-import org.eclipse.net4j.signal.heartbeat.HeartBeatProtocol;
-import org.eclipse.net4j.util.ObjectUtil;
-import org.eclipse.net4j.util.WrappedException;
import org.eclipse.net4j.util.container.IManagedContainer;
-import org.eclipse.net4j.util.container.IPluginContainer;
-import org.eclipse.net4j.util.io.ExtendedDataInputStream;
-import org.eclipse.net4j.util.io.ExtendedDataOutputStream;
-import org.eclipse.emf.spi.cdo.CDOSessionProtocol;
import org.eclipse.emf.spi.cdo.InternalCDOSession;
-import org.eclipse.emf.spi.cdo.InternalCDOView;
-
-import java.util.ArrayList;
-import java.util.List;
/**
* @author Eike Stepper
@@ -44,20 +27,16 @@ public class FailoverCDOSessionConfigurationImpl extends CDONet4jSessionConfigur
{
private String monitorConnectorDescription;
- // private IConnector monitorConnector;
- //
- // private SignalProtocol<Object> monitorProtocol;
-
private String repositoryGroup;
- private String repositoryConnectorDescription;
+ private IManagedContainer container;
- private String repositoryName;
-
- public FailoverCDOSessionConfigurationImpl(String monitorConnectorDescription, String repositoryGroup)
+ public FailoverCDOSessionConfigurationImpl(String monitorConnectorDescription, String repositoryGroup,
+ IManagedContainer container)
{
this.monitorConnectorDescription = monitorConnectorDescription;
this.repositoryGroup = repositoryGroup;
+ this.container = container;
}
public String getMonitorConnectorDescription()
@@ -91,131 +70,11 @@ public class FailoverCDOSessionConfigurationImpl extends CDONet4jSessionConfigur
@Override
public InternalCDOSession createSession()
{
- updateConnectorAndRepositoryName();
- return new FailoverCDOSessionImpl(this);
- }
-
- public List<AfterFailoverRunnable> failover(FailoverCDOSessionImpl session)
- {
- try
- {
- List<AfterFailoverRunnable> runnables = new ArrayList<AfterFailoverRunnable>();
- for (InternalCDOView view : session.getViews())
- {
- runnables.add(new OpenViewRunnable(view));
- }
-
- uncheckedSetPassiveUpdateEnabled(session.options().isPassiveUpdateEnabled());
- uncheckedSetPassiveUpdateMode(session.options().getPassiveUpdateMode());
-
- updateConnectorAndRepositoryName();
- initProtocol(session);
- return runnables;
- }
- catch (RuntimeException ex)
- {
- session.deactivate();
- throw ex;
- }
- catch (Error ex)
- {
- session.deactivate();
- throw ex;
- }
- }
-
- private void updateConnectorAndRepositoryName()
- {
- System.out.println("Querying fail-over monitor...");
- queryRepositoryInfoFromMonitor();
-
- System.out.println("Connecting to " + repositoryConnectorDescription + "/" + repositoryName + "...");
- IConnector connector = getConnector(repositoryConnectorDescription);
- new HeartBeatProtocol(connector, getContainer()).start(1000L, 5000L);
-
- uncheckedSetConnector(connector);
- uncheckedSetRepositoryName(repositoryName);
- }
-
- protected void queryRepositoryInfoFromMonitor()
- {
- IConnector connector = getConnector(monitorConnectorDescription);
- SignalProtocol<Object> protocol = new SignalProtocol<Object>("failover-client");
- protocol.open(connector);
-
- try
- {
- String oldRepositoryConnectorDescription = repositoryConnectorDescription;
- String oldRepositoryName = repositoryName;
-
- while (ObjectUtil.equals(repositoryConnectorDescription, oldRepositoryConnectorDescription)
- && ObjectUtil.equals(repositoryName, oldRepositoryName))
- {
- new RequestWithConfirmation<Boolean>(protocol, (short)1, "QueryRepositoryInfo")
- {
- @Override
- protected void requesting(ExtendedDataOutputStream out) throws Exception
- {
- out.writeString(repositoryGroup);
- }
-
- @Override
- protected Boolean confirming(ExtendedDataInputStream in) throws Exception
- {
- repositoryConnectorDescription = in.readString();
- repositoryName = in.readString();
- return true;
- }
- }.send();
- }
- }
- catch (Exception ex)
- {
- throw WrappedException.wrap(ex);
- }
- finally
- {
- protocol.close();
- if (connector.getChannels().isEmpty())
- {
- connector.close();
- }
- }
- }
-
- protected IConnector getConnector(String description)
- {
- IManagedContainer container = getContainer();
- // container.removeElement("org.eclipse.net4j.connectors", "tcp", description);
- return (IConnector)container.getElement("org.eclipse.net4j.connectors", "tcp", description);
- }
-
- protected IManagedContainer getContainer()
- {
- return IPluginContainer.INSTANCE;
- }
-
- /**
- * @author Eike Stepper
- */
- private final class OpenViewRunnable implements AfterFailoverRunnable
- {
- private int viewID;
-
- private CDOBranchPoint branchPoint;
-
- private boolean transaction;
-
- public OpenViewRunnable(InternalCDOView view)
- {
- viewID = view.getViewID();
- branchPoint = CDOBranchUtil.copyBranchPoint(view);
- transaction = view instanceof CDOTransaction;
- }
-
- public void run(CDOSessionProtocol sessionProtocol)
- {
- sessionProtocol.openView(viewID, branchPoint, !transaction);
- }
+ FailoverCDOSessionImpl session = new FailoverCDOSessionImpl();
+ session.setMonitorConnectionDescription(monitorConnectorDescription);
+ session.setRepositoryGroup(repositoryGroup);
+ session.setContainer(container);
+ session.updateConnectorAndRepositoryName(); // TODO (CD) Can't we leave it to the session to call this?
+ return session;
}
}
diff --git a/plugins/org.eclipse.emf.cdo.net4j/src/org/eclipse/emf/cdo/internal/net4j/FailoverCDOSessionImpl.java b/plugins/org.eclipse.emf.cdo.net4j/src/org/eclipse/emf/cdo/internal/net4j/FailoverCDOSessionImpl.java
index fa3ef8a..f27ad87 100644
--- a/plugins/org.eclipse.emf.cdo.net4j/src/org/eclipse/emf/cdo/internal/net4j/FailoverCDOSessionImpl.java
+++ b/plugins/org.eclipse.emf.cdo.net4j/src/org/eclipse/emf/cdo/internal/net4j/FailoverCDOSessionImpl.java
@@ -10,11 +10,26 @@
*/
package org.eclipse.emf.cdo.internal.net4j;
+import org.eclipse.emf.cdo.common.branch.CDOBranchPoint;
import org.eclipse.emf.cdo.net4j.CDOSessionFailoverEvent;
import org.eclipse.emf.cdo.session.CDOSession;
+import org.eclipse.emf.cdo.spi.common.branch.CDOBranchUtil;
+import org.eclipse.emf.cdo.transaction.CDOTransaction;
+
+import org.eclipse.net4j.connector.IConnector;
+import org.eclipse.net4j.signal.RequestWithConfirmation;
+import org.eclipse.net4j.signal.SignalProtocol;
+import org.eclipse.net4j.signal.heartbeat.HeartBeatProtocol;
+import org.eclipse.net4j.util.ObjectUtil;
+import org.eclipse.net4j.util.WrappedException;
+import org.eclipse.net4j.util.container.IManagedContainer;
+import org.eclipse.net4j.util.io.ExtendedDataInputStream;
+import org.eclipse.net4j.util.io.ExtendedDataOutputStream;
import org.eclipse.emf.spi.cdo.CDOSessionProtocol;
+import org.eclipse.emf.spi.cdo.InternalCDOView;
+import java.util.ArrayList;
import java.util.List;
/**
@@ -22,15 +37,31 @@ import java.util.List;
*/
public class FailoverCDOSessionImpl extends CDONet4jSessionImpl
{
- public FailoverCDOSessionImpl(FailoverCDOSessionConfigurationImpl configuration)
+ private IManagedContainer container;
+
+ private String monitorConnectorDescription;
+
+ private String repositoryGroup;
+
+ private String repositoryConnectorDescription;
+
+ public FailoverCDOSessionImpl()
{
- super(configuration);
}
- @Override
- public FailoverCDOSessionConfigurationImpl getConfiguration()
+ public void setContainer(IManagedContainer container)
+ {
+ this.container = container;
+ }
+
+ public void setMonitorConnectionDescription(String monitorConnectorDescription)
+ {
+ this.monitorConnectorDescription = monitorConnectorDescription;
+ }
+
+ public void setRepositoryGroup(String repositoryGroup)
{
- return (FailoverCDOSessionConfigurationImpl)super.getConfiguration();
+ this.repositoryGroup = repositoryGroup;
}
@Override
@@ -39,7 +70,7 @@ public class FailoverCDOSessionImpl extends CDONet4jSessionImpl
fireFailoverEvent(CDOSessionFailoverEvent.Type.STARTED);
unhookSessionProtocol();
- List<AfterFailoverRunnable> runnables = getConfiguration().failover(FailoverCDOSessionImpl.this);
+ List<AfterFailoverRunnable> runnables = failover();
CDOSessionProtocol sessionProtocol = hookSessionProtocol();
for (AfterFailoverRunnable runnable : runnables)
@@ -66,6 +97,97 @@ public class FailoverCDOSessionImpl extends CDONet4jSessionImpl
});
}
+ public List<AfterFailoverRunnable> failover()
+ {
+ try
+ {
+ List<AfterFailoverRunnable> runnables = new ArrayList<AfterFailoverRunnable>();
+ for (InternalCDOView view : getViews())
+ {
+ runnables.add(new OpenViewRunnable(view));
+ }
+
+ updateConnectorAndRepositoryName();
+ initProtocol();
+ return runnables;
+ }
+ catch (RuntimeException ex)
+ {
+ deactivate();
+ throw ex;
+ }
+ catch (Error ex)
+ {
+ deactivate();
+ throw ex;
+ }
+ }
+
+ // TODO (CD) Default access allows config object to call this once. Does this make sense?
+ void updateConnectorAndRepositoryName()
+ {
+ System.out.println("Querying fail-over monitor...");
+ queryRepositoryInfoFromMonitor();
+
+ System.out.println("Connecting to " + repositoryConnectorDescription + "/" + repositoryName + "...");
+ IConnector connector = getConnector(repositoryConnectorDescription);
+ new HeartBeatProtocol(connector, container).start(1000L, 5000L);
+
+ setConnector(connector);
+ setRepositoryName(repositoryName);
+ }
+
+ protected void queryRepositoryInfoFromMonitor()
+ {
+ IConnector connector = getConnector(monitorConnectorDescription);
+ SignalProtocol<Object> protocol = new SignalProtocol<Object>("failover-client");
+ protocol.open(connector);
+
+ try
+ {
+ String oldRepositoryConnectorDescription = repositoryConnectorDescription;
+ String oldRepositoryName = repositoryName;
+
+ while (ObjectUtil.equals(repositoryConnectorDescription, oldRepositoryConnectorDescription)
+ && ObjectUtil.equals(repositoryName, oldRepositoryName))
+ {
+ new RequestWithConfirmation<Boolean>(protocol, (short)1, "QueryRepositoryInfo")
+ {
+ @Override
+ protected void requesting(ExtendedDataOutputStream out) throws Exception
+ {
+ out.writeString(repositoryGroup);
+ }
+
+ @Override
+ protected Boolean confirming(ExtendedDataInputStream in) throws Exception
+ {
+ repositoryConnectorDescription = in.readString();
+ repositoryName = in.readString();
+ return true;
+ }
+ }.send();
+ }
+ }
+ catch (Exception ex)
+ {
+ throw WrappedException.wrap(ex);
+ }
+ finally
+ {
+ protocol.close();
+ if (connector.getChannels().isEmpty())
+ {
+ connector.close();
+ }
+ }
+ }
+
+ protected IConnector getConnector(String description)
+ {
+ return (IConnector)container.getElement("org.eclipse.net4j.connectors", "tcp", description);
+ }
+
/**
* @author Eike Stepper
*/
@@ -73,4 +195,28 @@ public class FailoverCDOSessionImpl extends CDONet4jSessionImpl
{
public void run(CDOSessionProtocol sessionProtocol);
}
+
+ /**
+ * @author Eike Stepper
+ */
+ private final class OpenViewRunnable implements AfterFailoverRunnable
+ {
+ private int viewID;
+
+ private CDOBranchPoint branchPoint;
+
+ private boolean transaction;
+
+ public OpenViewRunnable(InternalCDOView view)
+ {
+ viewID = view.getViewID();
+ branchPoint = CDOBranchUtil.copyBranchPoint(view);
+ transaction = view instanceof CDOTransaction;
+ }
+
+ public void run(CDOSessionProtocol sessionProtocol)
+ {
+ sessionProtocol.openView(viewID, branchPoint, !transaction);
+ }
+ }
}
diff --git a/plugins/org.eclipse.emf.cdo.net4j/src/org/eclipse/emf/cdo/internal/net4j/Net4jConnectorInjector.java b/plugins/org.eclipse.emf.cdo.net4j/src/org/eclipse/emf/cdo/internal/net4j/Net4jConnectorInjector.java
index f6ed2e4..340f78a 100644
--- a/plugins/org.eclipse.emf.cdo.net4j/src/org/eclipse/emf/cdo/internal/net4j/Net4jConnectorInjector.java
+++ b/plugins/org.eclipse.emf.cdo.net4j/src/org/eclipse/emf/cdo/internal/net4j/Net4jConnectorInjector.java
@@ -41,7 +41,7 @@ public class Net4jConnectorInjector implements IElementProcessor
{
CDONet4jSessionImpl session = (CDONet4jSessionImpl)element;
IConnector connector = getConnector(container, description);
- session.getConfiguration().setConnector(connector);
+ session.setConnector(connector);
}
return element;
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 ab77645..8660025 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,7 +55,7 @@ public class AuthenticationIndication extends IndicationWithResponse
{
try
{
- CDOAuthenticator authenticator = getSession().getConfiguration().getAuthenticator();
+ CDOAuthenticator authenticator = getSession().getAuthenticator();
if (authenticator == null)
{
throw new IllegalStateException("No authenticator configured"); //$NON-NLS-1$
diff --git a/plugins/org.eclipse.emf.cdo.net4j/src/org/eclipse/emf/cdo/net4j/CDONet4jUtil.java b/plugins/org.eclipse.emf.cdo.net4j/src/org/eclipse/emf/cdo/net4j/CDONet4jUtil.java
index 28568ea..271ea81 100644
--- a/plugins/org.eclipse.emf.cdo.net4j/src/org/eclipse/emf/cdo/net4j/CDONet4jUtil.java
+++ b/plugins/org.eclipse.emf.cdo.net4j/src/org/eclipse/emf/cdo/net4j/CDONet4jUtil.java
@@ -22,6 +22,7 @@ import org.eclipse.emf.cdo.view.CDOViewProvider;
import org.eclipse.emf.cdo.view.CDOViewProviderRegistry;
import org.eclipse.net4j.util.container.IManagedContainer;
+import org.eclipse.net4j.util.container.IPluginContainer;
import org.eclipse.net4j.util.om.OMPlatform;
import org.eclipse.emf.ecore.resource.Resource;
@@ -80,25 +81,18 @@ public final class CDONet4jUtil
* @since 4.0
*/
public static FailoverCDOSessionConfiguration createFailoverSessionConfiguration(String monitorConnectorDescription,
- String repositoryGroup, final IManagedContainer container)
+ String repositoryGroup)
{
- return new FailoverCDOSessionConfigurationImpl(monitorConnectorDescription, repositoryGroup)
- {
- @Override
- protected IManagedContainer getContainer()
- {
- return container;
- }
- };
+ return createFailoverSessionConfiguration(monitorConnectorDescription, repositoryGroup, IPluginContainer.INSTANCE);
}
/**
* @since 4.0
*/
public static FailoverCDOSessionConfiguration createFailoverSessionConfiguration(String monitorConnectorDescription,
- String repositoryGroup)
+ String repositoryGroup, IManagedContainer container)
{
- return new FailoverCDOSessionConfigurationImpl(monitorConnectorDescription, repositoryGroup);
+ return new FailoverCDOSessionConfigurationImpl(monitorConnectorDescription, repositoryGroup, container);
}
public static void prepareContainer(IManagedContainer container)
diff --git a/plugins/org.eclipse.emf.cdo.net4j/src/org/eclipse/emf/cdo/net4j/CDONet4jViewProvider.java b/plugins/org.eclipse.emf.cdo.net4j/src/org/eclipse/emf/cdo/net4j/CDONet4jViewProvider.java
index 64efece..d3fefed 100644
--- a/plugins/org.eclipse.emf.cdo.net4j/src/org/eclipse/emf/cdo/net4j/CDONet4jViewProvider.java
+++ b/plugins/org.eclipse.emf.cdo.net4j/src/org/eclipse/emf/cdo/net4j/CDONet4jViewProvider.java
@@ -12,6 +12,7 @@ package org.eclipse.emf.cdo.net4j;
import org.eclipse.emf.cdo.common.branch.CDOBranch;
import org.eclipse.emf.cdo.common.branch.CDOBranchPoint;
+import org.eclipse.emf.cdo.common.protocol.CDOAuthenticator;
import org.eclipse.emf.cdo.util.CDOURIData;
import org.eclipse.emf.cdo.view.AbstractCDOViewProvider;
import org.eclipse.emf.cdo.view.CDOView;
@@ -25,6 +26,7 @@ import org.eclipse.net4j.util.security.PasswordCredentialsProvider;
import org.eclipse.emf.common.util.URI;
import org.eclipse.emf.ecore.resource.ResourceSet;
+import org.eclipse.emf.spi.cdo.InternalCDOSession;
import java.text.SimpleDateFormat;
import java.util.Date;
@@ -72,8 +74,8 @@ public abstract class CDONet4jViewProvider extends AbstractCDOViewProvider
CDOSession session = (CDOSession)view.getSession();
- IPasswordCredentialsProvider credentialsProvider = session.getConfiguration().getAuthenticator()
- .getCredentialsProvider();
+ CDOAuthenticator authenticator = ((InternalCDOSession)session).getAuthenticator();
+ IPasswordCredentialsProvider credentialsProvider = authenticator.getCredentialsProvider();
if (credentialsProvider != null)
{
IPasswordCredentials credentials = credentialsProvider.getCredentials();
diff --git a/plugins/org.eclipse.emf.cdo.server/src/org/eclipse/emf/cdo/internal/server/ServerCDOView.java b/plugins/org.eclipse.emf.cdo.server/src/org/eclipse/emf/cdo/internal/server/ServerCDOView.java
index 55937c4..b91f7fe 100644
--- a/plugins/org.eclipse.emf.cdo.server/src/org/eclipse/emf/cdo/internal/server/ServerCDOView.java
+++ b/plugins/org.eclipse.emf.cdo.server/src/org/eclipse/emf/cdo/internal/server/ServerCDOView.java
@@ -19,6 +19,7 @@ import org.eclipse.emf.cdo.common.id.CDOID.ObjectType;
import org.eclipse.emf.cdo.common.id.CDOIDAndVersion;
import org.eclipse.emf.cdo.common.model.CDOPackageUnit;
import org.eclipse.emf.cdo.common.model.lob.CDOLobStore;
+import org.eclipse.emf.cdo.common.protocol.CDOAuthenticator;
import org.eclipse.emf.cdo.common.revision.CDORevision;
import org.eclipse.emf.cdo.common.revision.CDORevisionKey;
import org.eclipse.emf.cdo.common.revision.CDORevisionProvider;
@@ -64,7 +65,6 @@ import org.eclipse.emf.spi.cdo.CDOSessionProtocol.RefreshSessionResult;
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;
@@ -697,7 +697,32 @@ public class ServerCDOView extends AbstractCDOView implements org.eclipse.emf.cd
throw new UnsupportedOperationException();
}
- public InternalCDOSessionConfiguration getConfiguration()
+ public CDOAuthenticator getAuthenticator()
+ {
+ throw new UnsupportedOperationException();
+ }
+
+ public void setAuthenticator(CDOAuthenticator authenticator)
+ {
+ throw new UnsupportedOperationException();
+ }
+
+ public void setRevisionManager(InternalCDORevisionManager revisionManager)
+ {
+ throw new UnsupportedOperationException();
+ }
+
+ public void setBranchManager(InternalCDOBranchManager branchManager)
+ {
+ throw new UnsupportedOperationException();
+ }
+
+ public void setCommitInfoManager(InternalCDOCommitInfoManager commitInfoManager)
+ {
+ throw new UnsupportedOperationException();
+ }
+
+ public void setPackageRegistry(InternalCDOPackageRegistry packageRegistry)
{
throw new UnsupportedOperationException();
}
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 c1f3fe3..7521d98 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
@@ -12,6 +12,9 @@
package org.eclipse.emf.cdo.internal.server.embedded;
import org.eclipse.emf.cdo.common.model.lob.CDOLobStore;
+import org.eclipse.emf.cdo.common.revision.CDORevisionUtil;
+import org.eclipse.emf.cdo.common.revision.cache.CDORevisionCache;
+import org.eclipse.emf.cdo.internal.server.embedded.EmbeddedClientSessionConfiguration.RepositoryInfo;
import org.eclipse.emf.cdo.server.embedded.CDOSession;
import org.eclipse.emf.cdo.spi.common.branch.InternalCDOBranchManager;
import org.eclipse.emf.cdo.spi.common.commit.InternalCDOCommitInfoManager;
@@ -26,37 +29,30 @@ import org.eclipse.emf.internal.cdo.session.CDOSessionImpl;
*/
public class EmbeddedClientSession extends CDOSessionImpl implements CDOSession
{
- public EmbeddedClientSession(EmbeddedClientSessionConfiguration configuration)
- {
- super(configuration);
- }
+ private InternalRepository repository;
- @Override
- public EmbeddedClientSessionConfiguration getConfiguration()
+ public EmbeddedClientSession()
{
- return (EmbeddedClientSessionConfiguration)super.getConfiguration();
}
public InternalRepository getRepository()
{
- return getConfiguration().getRepository();
+ return repository;
}
+ @Override
public InternalCDOPackageRegistry getPackageRegistry()
{
return getRepository().getPackageRegistry();
}
+ @Override
public InternalCDOBranchManager getBranchManager()
{
return getRepository().getBranchManager();
}
- public InternalCDORevisionManager getRevisionManager()
- {
- return getConfiguration().getRevisionManager();
- }
-
+ @Override
public InternalCDOCommitInfoManager getCommitInfoManager()
{
return getRepository().getCommitInfoManager();
@@ -67,4 +63,33 @@ public class EmbeddedClientSession extends CDOSessionImpl implements CDOSession
{
throw new UnsupportedOperationException();
}
+
+ @Override
+ protected void activateSession() throws Exception
+ {
+ super.activateSession();
+ EmbeddedClientSessionProtocol protocol = new EmbeddedClientSessionProtocol(this);
+ setSessionProtocol(protocol);
+ protocol.activate();
+ protocol.openSession(options().isPassiveUpdateEnabled());
+
+ setLastUpdateTime(repository.getLastCommitTimeStamp());
+ setRepositoryInfo(new RepositoryInfo(this));
+
+ InternalCDORevisionManager revisionManager = (InternalCDORevisionManager)CDORevisionUtil.createRevisionManager();
+ setRevisionManager(revisionManager);
+ revisionManager.setSupportingBranches(getRepositoryInfo().isSupportingBranches());
+ revisionManager.setCache(CDORevisionCache.NOOP);
+ revisionManager.setRevisionLoader(getSessionProtocol());
+ revisionManager.setRevisionLocker(this);
+ revisionManager.activate();
+ }
+
+ @Override
+ protected void deactivateSession() throws Exception
+ {
+ getRevisionManager().deactivate();
+ setRevisionManager(null);
+ super.deactivateSession();
+ }
}
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 a8ccb28..14731eb 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
@@ -12,12 +12,8 @@ package org.eclipse.emf.cdo.internal.server.embedded;
import org.eclipse.emf.cdo.common.id.CDOID;
import org.eclipse.emf.cdo.common.id.CDOID.ObjectType;
-import org.eclipse.emf.cdo.common.revision.CDORevisionManager;
-import org.eclipse.emf.cdo.common.revision.CDORevisionUtil;
-import org.eclipse.emf.cdo.common.revision.cache.CDORevisionCache;
import org.eclipse.emf.cdo.server.IRepository;
import org.eclipse.emf.cdo.server.embedded.CDOSessionConfiguration;
-import org.eclipse.emf.cdo.spi.common.revision.InternalCDORevisionManager;
import org.eclipse.emf.cdo.spi.server.InternalRepository;
import org.eclipse.emf.internal.cdo.session.CDOSessionConfigurationImpl;
@@ -35,8 +31,6 @@ public class EmbeddedClientSessionConfiguration extends CDOSessionConfigurationI
{
private InternalRepository repository;
- private InternalCDORevisionManager revisionManager;
-
public EmbeddedClientSessionConfiguration()
{
throw new UnsupportedOperationException("Embedded sessions are not yet supported");
@@ -53,17 +47,6 @@ public class EmbeddedClientSessionConfiguration extends CDOSessionConfigurationI
this.repository = (InternalRepository)repository;
}
- public InternalCDORevisionManager getRevisionManager()
- {
- return revisionManager;
- }
-
- public void setRevisionManager(CDORevisionManager revisionManager)
- {
- checkNotOpen();
- this.revisionManager = (InternalCDORevisionManager)revisionManager;
- }
-
@Override
public org.eclipse.emf.cdo.server.embedded.CDOSession openSession()
{
@@ -77,69 +60,46 @@ public class EmbeddedClientSessionConfiguration extends CDOSessionConfigurationI
CheckUtil.checkState(repository, "Specify a repository"); //$NON-NLS-1$
}
- return new EmbeddedClientSession(this);
- }
-
- @Override
- public void activateSession(InternalCDOSession session) throws Exception
- {
- super.activateSession(session);
- EmbeddedClientSessionProtocol protocol = new EmbeddedClientSessionProtocol((EmbeddedClientSession)session);
- session.setSessionProtocol(protocol);
- protocol.activate();
- protocol.openSession(isPassiveUpdateEnabled());
-
- session.setLastUpdateTime(repository.getLastCommitTimeStamp());
- session.setRepositoryInfo(new RepositoryInfo());
-
- revisionManager = (InternalCDORevisionManager)CDORevisionUtil.createRevisionManager();
- revisionManager.setSupportingBranches(session.getRepositoryInfo().isSupportingBranches());
- revisionManager.setCache(CDORevisionCache.NOOP);
- revisionManager.setRevisionLoader(session.getSessionProtocol());
- revisionManager.setRevisionLocker(session);
- revisionManager.activate();
- }
-
- @Override
- public void deactivateSession(InternalCDOSession session) throws Exception
- {
- revisionManager.deactivate();
- revisionManager = null;
- super.deactivateSession(session);
+ EmbeddedClientSession session = new EmbeddedClientSession();
+ // TODO (CD) Additional config here
+ return session;
}
/**
* @author Eike Stepper
*/
- protected class RepositoryInfo implements org.eclipse.emf.cdo.session.CDORepositoryInfo
+ protected static class RepositoryInfo implements org.eclipse.emf.cdo.session.CDORepositoryInfo
{
- public RepositoryInfo()
+ private EmbeddedClientSession session;
+
+ public RepositoryInfo(EmbeddedClientSession session)
{
+ this.session = session;
}
public String getName()
{
- return repository.getName();
+ return session.getRepository().getName();
}
public String getUUID()
{
- return repository.getUUID();
+ return session.getRepository().getUUID();
}
public Type getType()
{
- return repository.getType();
+ return session.getRepository().getType();
}
public State getState()
{
- return repository.getState();
+ return session.getRepository().getState();
}
public long getCreationTime()
{
- return repository.getCreationTime();
+ return session.getRepository().getCreationTime();
}
public long getTimeStamp()
@@ -154,32 +114,32 @@ public class EmbeddedClientSessionConfiguration extends CDOSessionConfigurationI
public CDOID getRootResourceID()
{
- return repository.getRootResourceID();
+ return session.getRepository().getRootResourceID();
}
public boolean isSupportingAudits()
{
- return repository.isSupportingAudits();
+ return session.getRepository().isSupportingAudits();
}
public boolean isSupportingBranches()
{
- return repository.isSupportingBranches();
+ return session.getRepository().isSupportingBranches();
}
public boolean isEnsuringReferentialIntegrity()
{
- return repository.isEnsuringReferentialIntegrity();
+ return session.getRepository().isEnsuringReferentialIntegrity();
}
public String getStoreType()
{
- return repository.getStoreType();
+ return session.getRepository().getStoreType();
}
public Set<ObjectType> getObjectIDTypes()
{
- return repository.getObjectIDTypes();
+ return session.getRepository().getObjectIDTypes();
}
}
}
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 25dfc1f..8f31c8a 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
@@ -467,7 +467,7 @@ public class EmbeddedClientSessionProtocol extends Lifecycle implements CDOSessi
public CDOAuthenticationResult handleAuthenticationChallenge(byte[] randomToken) throws Exception
{
- CDOAuthenticator authenticator = getSession().getConfiguration().getAuthenticator();
+ CDOAuthenticator authenticator = getSession().getAuthenticator();
if (authenticator == null)
{
throw new IllegalStateException("No authenticator configured"); //$NON-NLS-1$
diff --git a/plugins/org.eclipse.emf.cdo.tests/src/org/eclipse/emf/cdo/tests/config/impl/RepositoryConfig.java b/plugins/org.eclipse.emf.cdo.tests/src/org/eclipse/emf/cdo/tests/config/impl/RepositoryConfig.java
index 40e9195..c8bd4e5 100644
--- a/plugins/org.eclipse.emf.cdo.tests/src/org/eclipse/emf/cdo/tests/config/impl/RepositoryConfig.java
+++ b/plugins/org.eclipse.emf.cdo.tests/src/org/eclipse/emf/cdo/tests/config/impl/RepositoryConfig.java
@@ -406,7 +406,7 @@ public abstract class RepositoryConfig extends Config implements IRepositoryConf
@Override
public InternalCDOSession createSession()
{
- return new CDONet4jSessionImpl(this)
+ return new CDONet4jSessionImpl()
{
volatile int counter = 1;
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 182ec51..bcc9eaf 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
@@ -56,9 +56,12 @@ import org.eclipse.emf.ecore.resource.ResourceSet;
public interface CDOSession extends CDOCommonSession, CDOUpdatable, IContainer<CDOView>
{
/**
+ * Returns an instance of {@link CDORepositoryInfo} that describes the model repository this {@link CDOSession
+ * session} is connected to.
+ *
* @since 3.0
*/
- public CDOSessionConfiguration getConfiguration();
+ public CDORepositoryInfo getRepositoryInfo();
/**
* Returns the EMF {@link EPackage.Registry package registry} that is used by all {@link EObject objects} of all
@@ -223,14 +226,6 @@ public interface CDOSession extends CDOCommonSession, CDOUpdatable, IContainer<C
public Options options();
/**
- * Returns an instance of {@link CDORepositoryInfo} that describes the model repository this {@link CDOSession
- * session} is connected to.
- *
- * @since 3.0
- */
- public CDORepositoryInfo getRepositoryInfo();
-
- /**
* @author Simon McDuff
*/
public interface Options extends CDOCommonSession.Options
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 59bcf8a..2224230 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
@@ -11,21 +11,24 @@
package org.eclipse.emf.internal.cdo.session;
import org.eclipse.emf.cdo.common.CDOCommonSession.Options.PassiveUpdateMode;
+import org.eclipse.emf.cdo.common.branch.CDOBranchManager;
+import org.eclipse.emf.cdo.common.commit.CDOCommitInfoManager;
+import org.eclipse.emf.cdo.common.model.CDOPackageRegistry;
import org.eclipse.emf.cdo.common.protocol.CDOAuthenticationResult;
import org.eclipse.emf.cdo.common.protocol.CDOAuthenticator;
+import org.eclipse.emf.cdo.common.revision.CDORevisionManager;
import org.eclipse.emf.cdo.session.CDOSession;
-import org.eclipse.emf.cdo.session.remote.CDORemoteSessionManager;
+import org.eclipse.emf.cdo.spi.common.branch.InternalCDOBranchManager;
+import org.eclipse.emf.cdo.spi.common.commit.InternalCDOCommitInfoManager;
+import org.eclipse.emf.cdo.spi.common.model.InternalCDOPackageRegistry;
+import org.eclipse.emf.cdo.spi.common.revision.InternalCDORevisionManager;
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;
@@ -42,6 +45,14 @@ public abstract class CDOSessionConfigurationImpl implements InternalCDOSessionC
private CDOSession.ExceptionHandler exceptionHandler;
+ private InternalCDOBranchManager branchManager;
+
+ private InternalCDOPackageRegistry packageRegistry;
+
+ private InternalCDORevisionManager revisionManager;
+
+ private InternalCDOCommitInfoManager commitInfoManager;
+
private boolean activateOnOpen = true;
private InternalCDOSession session;
@@ -104,6 +115,64 @@ public abstract class CDOSessionConfigurationImpl implements InternalCDOSessionC
this.exceptionHandler = exceptionHandler;
}
+ public InternalCDOBranchManager getBranchManager()
+ {
+ return branchManager;
+ }
+
+ public void setBranchManager(CDOBranchManager branchManager)
+ {
+ checkNotOpen();
+ this.branchManager = (InternalCDOBranchManager)branchManager;
+ }
+
+ public InternalCDOPackageRegistry getPackageRegistry()
+ {
+ return packageRegistry;
+ }
+
+ public void setPackageRegistry(CDOPackageRegistry packageRegistry)
+ {
+ checkNotOpen();
+ this.packageRegistry = (InternalCDOPackageRegistry)packageRegistry;
+ }
+
+ public InternalCDORevisionManager getRevisionManager()
+ {
+ return revisionManager;
+ }
+
+ public void setRevisionManager(CDORevisionManager revisionManager)
+ {
+ checkNotOpen();
+ this.revisionManager = (InternalCDORevisionManager)revisionManager;
+ }
+
+ /**
+ * Returns the commit info manager. The commit info manager may be used to query commit infos.
+ *
+ * @return the commit info manager
+ * @see CDOCommitInfoManager
+ */
+ public InternalCDOCommitInfoManager getCommitInfoManager()
+ {
+ return commitInfoManager;
+ }
+
+ /**
+ * Sets the commit info manager. The commit info manager may be used to query commit infos. May only be called as long
+ * as the session's not opened yet
+ *
+ * @param commitInfoManager
+ * the new commit info manager
+ * @see CDOCommitInfoManager
+ */
+ public void setCommitInfoManager(CDOCommitInfoManager commitInfoManager)
+ {
+ checkNotOpen();
+ this.commitInfoManager = (InternalCDOCommitInfoManager)commitInfoManager;
+ }
+
public boolean isActivateOnOpen()
{
return activateOnOpen;
@@ -139,7 +208,7 @@ public abstract class CDOSessionConfigurationImpl implements InternalCDOSessionC
if (!isSessionOpen())
{
session = createSession();
- session.setExceptionHandler(exceptionHandler);
+ configureSession(session);
if (activateOnOpen)
{
session.activate();
@@ -149,6 +218,16 @@ public abstract class CDOSessionConfigurationImpl implements InternalCDOSessionC
return session;
}
+ protected void configureSession(InternalCDOSession session)
+ {
+ session.setExceptionHandler(exceptionHandler);
+ session.setAuthenticator(authenticator);
+ session.setRevisionManager(revisionManager);
+ session.setBranchManager(branchManager);
+ session.setCommitInfoManager(commitInfoManager);
+ session.setPackageRegistry(packageRegistry);
+ }
+
public InternalCDOSession getSession()
{
checkOpen();
@@ -160,26 +239,6 @@ public abstract class CDOSessionConfigurationImpl implements InternalCDOSessionC
this.session = session;
}
- public void activateSession(InternalCDOSession session) throws Exception
- {
- InternalCDORemoteSessionManager remoteSessionManager = new CDORemoteSessionManagerImpl();
- remoteSessionManager.setLocalSession(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())
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 e627d03..9817b3f 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
@@ -58,11 +58,14 @@ 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.session.remote.CDORemoteSessionManager;
import org.eclipse.emf.cdo.session.remote.CDORemoteSessionMessage;
import org.eclipse.emf.cdo.spi.common.CDORawReplicationContext;
import org.eclipse.emf.cdo.spi.common.CDOReplicationContext;
import org.eclipse.emf.cdo.spi.common.branch.InternalCDOBranch;
+import org.eclipse.emf.cdo.spi.common.branch.InternalCDOBranchManager;
import org.eclipse.emf.cdo.spi.common.commit.CDORevisionAvailabilityInfo;
+import org.eclipse.emf.cdo.spi.common.commit.InternalCDOCommitInfoManager;
import org.eclipse.emf.cdo.spi.common.model.CDOLobStoreImpl;
import org.eclipse.emf.cdo.spi.common.model.InternalCDOPackageRegistry;
import org.eclipse.emf.cdo.spi.common.model.InternalCDOPackageUnit;
@@ -78,6 +81,7 @@ 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.CDOViewImpl;
@@ -118,7 +122,6 @@ import org.eclipse.emf.spi.cdo.CDOSessionProtocol.RefreshSessionResult;
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;
@@ -149,10 +152,16 @@ 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 InternalCDOPackageRegistry packageRegistry;
+
+ private InternalCDOBranchManager branchManager;
+
+ private InternalCDORevisionManager revisionManager;
+
+ private InternalCDOCommitInfoManager commitInfoManager;
+
private CDOSessionProtocol sessionProtocol;
@ExcludeFromDump
@@ -210,14 +219,8 @@ public abstract class CDOSessionImpl extends Container<CDOView> implements Inter
@ExcludeFromDump
private int lastViewID;
- public CDOSessionImpl(InternalCDOSessionConfiguration configuration)
+ public CDOSessionImpl()
{
- this.configuration = configuration;
- }
-
- public InternalCDOSessionConfiguration getConfiguration()
- {
- return configuration;
}
public CDORepositoryInfo getRepositoryInfo()
@@ -261,20 +264,44 @@ public abstract class CDOSessionImpl extends Container<CDOView> implements Inter
this.exceptionHandler = exceptionHandler;
}
- /**
- * @since 2.0
- */
- public CDOSession.Options options()
+ public InternalCDOPackageRegistry getPackageRegistry()
{
- return options;
+ return packageRegistry;
}
- /**
- * @since 2.0
- */
- protected CDOSession.Options createOptions()
+ public void setPackageRegistry(InternalCDOPackageRegistry packageRegistry)
{
- return new OptionsImpl();
+ this.packageRegistry = packageRegistry;
+ }
+
+ public InternalCDOBranchManager getBranchManager()
+ {
+ return branchManager;
+ }
+
+ public void setBranchManager(InternalCDOBranchManager branchManager)
+ {
+ this.branchManager = branchManager;
+ }
+
+ public InternalCDORevisionManager getRevisionManager()
+ {
+ return revisionManager;
+ }
+
+ public void setRevisionManager(InternalCDORevisionManager revisionManager)
+ {
+ this.revisionManager = revisionManager;
+ }
+
+ public InternalCDOCommitInfoManager getCommitInfoManager()
+ {
+ return commitInfoManager;
+ }
+
+ public void setCommitInfoManager(InternalCDOCommitInfoManager commitInfoManager)
+ {
+ this.commitInfoManager = commitInfoManager;
}
public CDOSessionProtocol getSessionProtocol()
@@ -287,6 +314,42 @@ public abstract class CDOSessionImpl extends Container<CDOView> implements Inter
this.sessionProtocol = sessionProtocol;
}
+ /**
+ * @since 3.0
+ */
+ public CDOFetchRuleManager getFetchRuleManager()
+ {
+ return ruleManager;
+ }
+
+ /**
+ * @since 3.0
+ */
+ public void setFetchRuleManager(CDOFetchRuleManager fetchRuleManager)
+ {
+ ruleManager = fetchRuleManager;
+ }
+
+ public CDOAuthenticator getAuthenticator()
+ {
+ return authenticator;
+ }
+
+ public void setAuthenticator(CDOAuthenticator authenticator)
+ {
+ this.authenticator = authenticator;
+ }
+
+ public InternalCDORemoteSessionManager getRemoteSessionManager()
+ {
+ return remoteSessionManager;
+ }
+
+ public void setRemoteSessionManager(InternalCDORemoteSessionManager remoteSessionManager)
+ {
+ this.remoteSessionManager = remoteSessionManager;
+ }
+
public CDOLobStore getLobStore()
{
final CDOLobStore cache = options().getLobCache();
@@ -314,7 +377,7 @@ public abstract class CDOSessionImpl extends Container<CDOView> implements Inter
}
}
}
-
+
@Override
public Reader getCharacter(CDOLobInfo info) throws IOException
{
@@ -337,12 +400,12 @@ public abstract class CDOSessionImpl extends Container<CDOView> implements Inter
}
}
}
-
+
private void loadBinary(final CDOLobInfo info) throws IOException
{
final File file = getDelegate().getBinaryFile(info.getID());
final FileOutputStream out = new FileOutputStream(file);
-
+
loadLobAsync(info, new Runnable()
{
public void run()
@@ -359,12 +422,12 @@ public abstract class CDOSessionImpl extends Container<CDOView> implements Inter
}
});
}
-
+
private void loadCharacter(final CDOLobInfo info) throws IOException
{
final File file = getDelegate().getCharacterFile(info.getID());
final FileWriter out = new FileWriter(file);
-
+
loadLobAsync(info, new Runnable()
{
public void run()
@@ -381,7 +444,7 @@ public abstract class CDOSessionImpl extends Container<CDOView> implements Inter
}
});
}
-
+
@Override
protected CDOLobStore getDelegate()
{
@@ -408,6 +471,22 @@ public abstract class CDOSessionImpl extends Container<CDOView> implements Inter
return !isActive();
}
+ /**
+ * @since 2.0
+ */
+ public CDOSession.Options options()
+ {
+ return options;
+ }
+
+ /**
+ * @since 2.0
+ */
+ protected CDOSession.Options createOptions()
+ {
+ return new OptionsImpl();
+ }
+
public Object processPackage(Object value)
{
CDOFactoryImpl.prepareDynamicEPackage(value);
@@ -423,7 +502,7 @@ public abstract class CDOSessionImpl extends Container<CDOView> implements Inter
throw new CDOException(MessageFormat.format(Messages.getString("CDOSessionImpl.0"), packageUnit)); //$NON-NLS-1$
}
}
-
+
return getSessionProtocol().loadPackages(packageUnit);
}
@@ -444,42 +523,6 @@ public abstract class CDOSessionImpl extends Container<CDOView> implements Inter
lockmanager.unlock(LockType.WRITE, key, singletonCollection);
}
- /**
- * @since 3.0
- */
- public CDOFetchRuleManager getFetchRuleManager()
- {
- return ruleManager;
- }
-
- /**
- * @since 3.0
- */
- public void setFetchRuleManager(CDOFetchRuleManager fetchRuleManager)
- {
- ruleManager = fetchRuleManager;
- }
-
- public CDOAuthenticator getAuthenticator()
- {
- return authenticator;
- }
-
- public void setAuthenticator(CDOAuthenticator authenticator)
- {
- this.authenticator = authenticator;
- }
-
- public InternalCDORemoteSessionManager getRemoteSessionManager()
- {
- return remoteSessionManager;
- }
-
- public void setRemoteSessionManager(InternalCDORemoteSessionManager remoteSessionManager)
- {
- this.remoteSessionManager = remoteSessionManager;
- }
-
public InternalCDOTransaction openTransaction(CDOBranch branch, ResourceSet resourceSet)
{
checkActive();
@@ -1128,12 +1171,31 @@ public abstract class CDOSessionImpl extends Container<CDOView> implements Inter
protected void doActivate() throws Exception
{
super.doActivate();
- getConfiguration().activateSession(this);
+ activateSession();
checkState(sessionProtocol, "sessionProtocol"); //$NON-NLS-1$
checkState(remoteSessionManager, "remoteSessionManager"); //$NON-NLS-1$
hookSessionProtocol();
}
+ protected void activateSession() throws Exception
+ {
+ InternalCDORemoteSessionManager remoteSessionManager = new CDORemoteSessionManagerImpl();
+ remoteSessionManager.setLocalSession(this);
+ setRemoteSessionManager(remoteSessionManager);
+ remoteSessionManager.activate();
+ }
+
+ protected void deactivateSession() throws Exception
+ {
+ CDORemoteSessionManager remoteSessionManager = getRemoteSessionManager();
+ setRemoteSessionManager(null);
+ LifecycleUtil.deactivate(remoteSessionManager);
+
+ CDOSessionProtocol sessionProtocol = getSessionProtocol();
+ LifecycleUtil.deactivate(sessionProtocol);
+ setSessionProtocol(null);
+ }
+
@Override
protected void doDeactivate() throws Exception
{
@@ -1157,7 +1219,7 @@ public abstract class CDOSessionImpl extends Container<CDOView> implements Inter
}
unhookSessionProtocol();
- getConfiguration().deactivateSession(this);
+ deactivateSession();
super.doDeactivate();
}
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 d01abe1..7559dd6 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
@@ -15,6 +15,7 @@ import org.eclipse.emf.cdo.common.branch.CDOBranch;
import org.eclipse.emf.cdo.common.commit.CDOCommitInfo;
import org.eclipse.emf.cdo.common.id.CDOID;
import org.eclipse.emf.cdo.common.model.lob.CDOLobStore;
+import org.eclipse.emf.cdo.common.protocol.CDOAuthenticator;
import org.eclipse.emf.cdo.common.revision.CDORevision;
import org.eclipse.emf.cdo.session.CDORepositoryInfo;
import org.eclipse.emf.cdo.session.CDOSession;
@@ -43,26 +44,41 @@ import java.util.Map;
*/
public interface InternalCDOSession extends CDOSession, PackageProcessor, PackageLoader, RevisionLocker, ILifecycle
{
+ public CDOSessionProtocol getSessionProtocol();
+
/**
* @since 3.0
*/
- public InternalCDOSessionConfiguration getConfiguration();
+ public void setSessionProtocol(CDOSessionProtocol sessionProtocol);
- public CDOSessionProtocol getSessionProtocol();
+ /**
+ * @since 4.0
+ */
+ public CDOAuthenticator getAuthenticator();
/**
- * @since 3.0
+ * @since 4.0
*/
- public void setSessionProtocol(CDOSessionProtocol sessionProtocol);
+ public void setAuthenticator(CDOAuthenticator authenticator);
public InternalCDOPackageRegistry getPackageRegistry();
/**
+ * @since 4.0
+ */
+ public void setPackageRegistry(InternalCDOPackageRegistry packageRegistry);
+
+ /**
* @since 3.0
*/
public InternalCDOBranchManager getBranchManager();
/**
+ * @since 4.0
+ */
+ public void setBranchManager(InternalCDOBranchManager branchManager);
+
+ /**
* @since 3.0
*/
public InternalCDORevisionManager getRevisionManager();
@@ -70,34 +86,44 @@ public interface InternalCDOSession extends CDOSession, PackageProcessor, Packag
/**
* @since 4.0
*/
- public CDOLobStore getLobStore();
+ public void setRevisionManager(InternalCDORevisionManager revisionManager);
/**
* @since 3.0
*/
public InternalCDOCommitInfoManager getCommitInfoManager();
- public void setExceptionHandler(CDOSession.ExceptionHandler exceptionHandler);
+ /**
+ * @since 4.0
+ */
+ public void setCommitInfoManager(InternalCDOCommitInfoManager commitInfoManager);
/**
* @since 3.0
*/
- public void setFetchRuleManager(CDOFetchRuleManager fetchRuleManager);
+ public InternalCDORemoteSessionManager getRemoteSessionManager();
/**
* @since 3.0
*/
- public void setRepositoryInfo(CDORepositoryInfo repositoryInfo);
+ public void setRemoteSessionManager(InternalCDORemoteSessionManager remoteSessionManager);
+
+ /**
+ * @since 4.0
+ */
+ public CDOLobStore getLobStore();
+
+ public void setExceptionHandler(CDOSession.ExceptionHandler exceptionHandler);
/**
* @since 3.0
*/
- public InternalCDORemoteSessionManager getRemoteSessionManager();
+ public void setFetchRuleManager(CDOFetchRuleManager fetchRuleManager);
/**
* @since 3.0
*/
- public void setRemoteSessionManager(InternalCDORemoteSessionManager remoteSessionManager);
+ public void setRepositoryInfo(CDORepositoryInfo repositoryInfo);
/**
* @since 3.0
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
index 06c81ab..4a35ebc 100644
--- 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
@@ -21,8 +21,4 @@ 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;
}