Skip to main content
summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorEike Stepper2012-01-14 10:27:01 +0000
committerEike Stepper2012-01-14 10:27:01 +0000
commit0266166cb9ff9535c150250073ea1e57b42d2693 (patch)
treec006a3bc0ba1f6e1d8a2bc032eedc346f71eab0d /plugins/org.eclipse.emf.cdo.server/src/org/eclipse/emf/cdo/internal/server/embedded
parent7416443692cdda72d1f704ea4fc5ececcc669df7 (diff)
downloadcdo-0266166cb9ff9535c150250073ea1e57b42d2693.tar.gz
cdo-0266166cb9ff9535c150250073ea1e57b42d2693.tar.xz
cdo-0266166cb9ff9535c150250073ea1e57b42d2693.zip
Adjusted copyrights to 2012
Diffstat (limited to 'plugins/org.eclipse.emf.cdo.server/src/org/eclipse/emf/cdo/internal/server/embedded')
-rw-r--r--plugins/org.eclipse.emf.cdo.server/src/org/eclipse/emf/cdo/internal/server/embedded/EmbeddedClientSession.java200
-rw-r--r--plugins/org.eclipse.emf.cdo.server/src/org/eclipse/emf/cdo/internal/server/embedded/EmbeddedClientSessionConfiguration.java310
-rw-r--r--plugins/org.eclipse.emf.cdo.server/src/org/eclipse/emf/cdo/internal/server/embedded/EmbeddedClientSessionProtocol.java1212
-rw-r--r--plugins/org.eclipse.emf.cdo.server/src/org/eclipse/emf/cdo/internal/server/embedded/EmbeddedServerSessionProtocol.java222
4 files changed, 972 insertions, 972 deletions
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 792f6d475f..4dd107da81 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
@@ -1,100 +1,100 @@
-/*
- * Copyright (c) 2004 - 2011 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
- * Andre Dietisheim - bug 256649
- */
-package org.eclipse.emf.cdo.internal.server.embedded;
-
-import org.eclipse.emf.cdo.common.lob.CDOLobStore;
-import org.eclipse.emf.cdo.common.revision.CDORevisionCache;
-import org.eclipse.emf.cdo.common.revision.CDORevisionUtil;
-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;
-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;
-
-/**
- * @author Eike Stepper
- * @deprecated Not yet supported.
- */
-@Deprecated
-public class EmbeddedClientSession extends CDOSessionImpl implements CDOSession
-{
- private InternalRepository repository;
-
- public EmbeddedClientSession()
- {
- }
-
- public InternalRepository getRepository()
- {
- return repository;
- }
-
- @Override
- public InternalCDOPackageRegistry getPackageRegistry()
- {
- return getRepository().getPackageRegistry();
- }
-
- @Override
- public InternalCDOBranchManager getBranchManager()
- {
- return getRepository().getBranchManager();
- }
-
- @Override
- public InternalCDOCommitInfoManager getCommitInfoManager()
- {
- return getRepository().getCommitInfoManager();
- }
-
- @Override
- public CDOLobStore getLobStore()
- {
- throw new UnsupportedOperationException();
- }
-
- @Override
- protected void doActivate() throws Exception
- {
- super.doActivate();
-
- 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.setSupportingAudits(getRepositoryInfo().isSupportingAudits());
- revisionManager.setSupportingBranches(getRepositoryInfo().isSupportingBranches());
- revisionManager.setCache(CDORevisionCache.NOOP);
- revisionManager.setRevisionLoader(getSessionProtocol());
- revisionManager.setRevisionLocker(this);
- revisionManager.activate();
- }
-
- @Override
- protected void doDeactivate() throws Exception
- {
- super.doDeactivate();
-
- getRevisionManager().deactivate();
- setRevisionManager(null);
- }
-}
+/*
+ * Copyright (c) 2004 - 2012 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
+ * Andre Dietisheim - bug 256649
+ */
+package org.eclipse.emf.cdo.internal.server.embedded;
+
+import org.eclipse.emf.cdo.common.lob.CDOLobStore;
+import org.eclipse.emf.cdo.common.revision.CDORevisionCache;
+import org.eclipse.emf.cdo.common.revision.CDORevisionUtil;
+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;
+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;
+
+/**
+ * @author Eike Stepper
+ * @deprecated Not yet supported.
+ */
+@Deprecated
+public class EmbeddedClientSession extends CDOSessionImpl implements CDOSession
+{
+ private InternalRepository repository;
+
+ public EmbeddedClientSession()
+ {
+ }
+
+ public InternalRepository getRepository()
+ {
+ return repository;
+ }
+
+ @Override
+ public InternalCDOPackageRegistry getPackageRegistry()
+ {
+ return getRepository().getPackageRegistry();
+ }
+
+ @Override
+ public InternalCDOBranchManager getBranchManager()
+ {
+ return getRepository().getBranchManager();
+ }
+
+ @Override
+ public InternalCDOCommitInfoManager getCommitInfoManager()
+ {
+ return getRepository().getCommitInfoManager();
+ }
+
+ @Override
+ public CDOLobStore getLobStore()
+ {
+ throw new UnsupportedOperationException();
+ }
+
+ @Override
+ protected void doActivate() throws Exception
+ {
+ super.doActivate();
+
+ 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.setSupportingAudits(getRepositoryInfo().isSupportingAudits());
+ revisionManager.setSupportingBranches(getRepositoryInfo().isSupportingBranches());
+ revisionManager.setCache(CDORevisionCache.NOOP);
+ revisionManager.setRevisionLoader(getSessionProtocol());
+ revisionManager.setRevisionLocker(this);
+ revisionManager.activate();
+ }
+
+ @Override
+ protected void doDeactivate() throws Exception
+ {
+ super.doDeactivate();
+
+ getRevisionManager().deactivate();
+ setRevisionManager(null);
+ }
+}
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 b4edcbbe65..f0165ebda2 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
@@ -1,155 +1,155 @@
-/*
- * Copyright (c) 2004 - 2011 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.server.embedded;
-
-import org.eclipse.emf.cdo.common.id.CDOID;
-import org.eclipse.emf.cdo.common.id.CDOID.ObjectType;
-import org.eclipse.emf.cdo.server.IRepository;
-import org.eclipse.emf.cdo.server.embedded.CDOSessionConfiguration;
-import org.eclipse.emf.cdo.spi.server.InternalRepository;
-
-import org.eclipse.emf.internal.cdo.session.CDOSessionConfigurationImpl;
-
-import org.eclipse.net4j.util.CheckUtil;
-
-import org.eclipse.emf.spi.cdo.InternalCDOSession;
-
-import java.util.Set;
-
-/**
- * @author Eike Stepper
- * @deprecated Not yet supported.
- */
-@Deprecated
-public class EmbeddedClientSessionConfiguration extends CDOSessionConfigurationImpl implements CDOSessionConfiguration
-{
- private InternalRepository repository;
-
- public EmbeddedClientSessionConfiguration()
- {
- throw new UnsupportedOperationException("Embedded sessions are not yet supported");
- }
-
- public InternalRepository getRepository()
- {
- return repository;
- }
-
- public void setRepository(IRepository repository)
- {
- checkNotOpen();
- this.repository = (InternalRepository)repository;
- }
-
- @Override
- public org.eclipse.emf.cdo.server.embedded.CDOSession openSession()
- {
- return (org.eclipse.emf.cdo.server.embedded.CDOSession)super.openSession();
- }
-
- public InternalCDOSession createSession()
- {
- if (isActivateOnOpen())
- {
- CheckUtil.checkState(repository, "Specify a repository"); //$NON-NLS-1$
- }
-
- return new EmbeddedClientSession();
- }
-
- /**
- * @author Eike Stepper
- */
- protected static class RepositoryInfo implements org.eclipse.emf.cdo.session.CDORepositoryInfo
- {
- private EmbeddedClientSession session;
-
- public RepositoryInfo(EmbeddedClientSession session)
- {
- this.session = session;
- }
-
- public String getName()
- {
- return session.getRepository().getName();
- }
-
- public String getUUID()
- {
- return session.getRepository().getUUID();
- }
-
- public Type getType()
- {
- return session.getRepository().getType();
- }
-
- public State getState()
- {
- return session.getRepository().getState();
- }
-
- public long getCreationTime()
- {
- return session.getRepository().getCreationTime();
- }
-
- public long getTimeStamp()
- {
- return getTimeStamp(false);
- }
-
- public long getTimeStamp(boolean forceRefresh)
- {
- return System.currentTimeMillis();
- }
-
- public CDOID getRootResourceID()
- {
- return session.getRepository().getRootResourceID();
- }
-
- public boolean isSupportingAudits()
- {
- return session.getRepository().isSupportingAudits();
- }
-
- public boolean isSupportingBranches()
- {
- return session.getRepository().isSupportingBranches();
- }
-
- public boolean isSupportingEcore()
- {
- return session.getRepository().isSupportingEcore();
- }
-
- public boolean isEnsuringReferentialIntegrity()
- {
- return session.getRepository().isEnsuringReferentialIntegrity();
- }
-
- public IDGenerationLocation getIDGenerationLocation()
- {
- return session.getRepository().getIDGenerationLocation();
- }
-
- public String getStoreType()
- {
- return session.getRepository().getStoreType();
- }
-
- public Set<ObjectType> getObjectIDTypes()
- {
- return session.getRepository().getObjectIDTypes();
- }
- }
-}
+/*
+ * Copyright (c) 2004 - 2012 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.server.embedded;
+
+import org.eclipse.emf.cdo.common.id.CDOID;
+import org.eclipse.emf.cdo.common.id.CDOID.ObjectType;
+import org.eclipse.emf.cdo.server.IRepository;
+import org.eclipse.emf.cdo.server.embedded.CDOSessionConfiguration;
+import org.eclipse.emf.cdo.spi.server.InternalRepository;
+
+import org.eclipse.emf.internal.cdo.session.CDOSessionConfigurationImpl;
+
+import org.eclipse.net4j.util.CheckUtil;
+
+import org.eclipse.emf.spi.cdo.InternalCDOSession;
+
+import java.util.Set;
+
+/**
+ * @author Eike Stepper
+ * @deprecated Not yet supported.
+ */
+@Deprecated
+public class EmbeddedClientSessionConfiguration extends CDOSessionConfigurationImpl implements CDOSessionConfiguration
+{
+ private InternalRepository repository;
+
+ public EmbeddedClientSessionConfiguration()
+ {
+ throw new UnsupportedOperationException("Embedded sessions are not yet supported");
+ }
+
+ public InternalRepository getRepository()
+ {
+ return repository;
+ }
+
+ public void setRepository(IRepository repository)
+ {
+ checkNotOpen();
+ this.repository = (InternalRepository)repository;
+ }
+
+ @Override
+ public org.eclipse.emf.cdo.server.embedded.CDOSession openSession()
+ {
+ return (org.eclipse.emf.cdo.server.embedded.CDOSession)super.openSession();
+ }
+
+ public InternalCDOSession createSession()
+ {
+ if (isActivateOnOpen())
+ {
+ CheckUtil.checkState(repository, "Specify a repository"); //$NON-NLS-1$
+ }
+
+ return new EmbeddedClientSession();
+ }
+
+ /**
+ * @author Eike Stepper
+ */
+ protected static class RepositoryInfo implements org.eclipse.emf.cdo.session.CDORepositoryInfo
+ {
+ private EmbeddedClientSession session;
+
+ public RepositoryInfo(EmbeddedClientSession session)
+ {
+ this.session = session;
+ }
+
+ public String getName()
+ {
+ return session.getRepository().getName();
+ }
+
+ public String getUUID()
+ {
+ return session.getRepository().getUUID();
+ }
+
+ public Type getType()
+ {
+ return session.getRepository().getType();
+ }
+
+ public State getState()
+ {
+ return session.getRepository().getState();
+ }
+
+ public long getCreationTime()
+ {
+ return session.getRepository().getCreationTime();
+ }
+
+ public long getTimeStamp()
+ {
+ return getTimeStamp(false);
+ }
+
+ public long getTimeStamp(boolean forceRefresh)
+ {
+ return System.currentTimeMillis();
+ }
+
+ public CDOID getRootResourceID()
+ {
+ return session.getRepository().getRootResourceID();
+ }
+
+ public boolean isSupportingAudits()
+ {
+ return session.getRepository().isSupportingAudits();
+ }
+
+ public boolean isSupportingBranches()
+ {
+ return session.getRepository().isSupportingBranches();
+ }
+
+ public boolean isSupportingEcore()
+ {
+ return session.getRepository().isSupportingEcore();
+ }
+
+ public boolean isEnsuringReferentialIntegrity()
+ {
+ return session.getRepository().isEnsuringReferentialIntegrity();
+ }
+
+ public IDGenerationLocation getIDGenerationLocation()
+ {
+ return session.getRepository().getIDGenerationLocation();
+ }
+
+ public String getStoreType()
+ {
+ return session.getRepository().getStoreType();
+ }
+
+ public Set<ObjectType> 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 6a5b082450..e1e741d78a 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
@@ -1,606 +1,606 @@
-/*
- * Copyright (c) 2004 - 2011 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.server.embedded;
-
-import org.eclipse.emf.cdo.CDOObject;
-import org.eclipse.emf.cdo.common.CDOCommonSession.Options.LockNotificationMode;
-import org.eclipse.emf.cdo.common.CDOCommonSession.Options.PassiveUpdateMode;
-import org.eclipse.emf.cdo.common.branch.CDOBranch;
-import org.eclipse.emf.cdo.common.branch.CDOBranchHandler;
-import org.eclipse.emf.cdo.common.branch.CDOBranchPoint;
-import org.eclipse.emf.cdo.common.branch.CDOBranchPointRange;
-import org.eclipse.emf.cdo.common.branch.CDOBranchVersion;
-import org.eclipse.emf.cdo.common.commit.CDOChangeSetData;
-import org.eclipse.emf.cdo.common.commit.CDOCommitData;
-import org.eclipse.emf.cdo.common.commit.CDOCommitInfoHandler;
-import org.eclipse.emf.cdo.common.id.CDOID;
-import org.eclipse.emf.cdo.common.id.CDOIDProvider;
-import org.eclipse.emf.cdo.common.lob.CDOLob;
-import org.eclipse.emf.cdo.common.lob.CDOLobInfo;
-import org.eclipse.emf.cdo.common.lock.CDOLockState;
-import org.eclipse.emf.cdo.common.model.CDOPackageUnit;
-import org.eclipse.emf.cdo.common.protocol.CDOAuthenticator;
-import org.eclipse.emf.cdo.common.revision.CDOIDAndVersion;
-import org.eclipse.emf.cdo.common.revision.CDORevisionHandler;
-import org.eclipse.emf.cdo.common.revision.CDORevisionKey;
-import org.eclipse.emf.cdo.common.util.CDOQueryQueue;
-import org.eclipse.emf.cdo.server.StoreThreadLocal;
-import org.eclipse.emf.cdo.session.remote.CDORemoteSession;
-import org.eclipse.emf.cdo.session.remote.CDORemoteSessionMessage;
-import org.eclipse.emf.cdo.spi.common.CDOAuthenticationResult;
-import org.eclipse.emf.cdo.spi.common.CDORawReplicationContext;
-import org.eclipse.emf.cdo.spi.common.CDOReplicationContext;
-import org.eclipse.emf.cdo.spi.common.commit.CDORevisionAvailabilityInfo;
-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.InternalCDORevisionDelta;
-import org.eclipse.emf.cdo.spi.common.revision.RevisionInfo;
-import org.eclipse.emf.cdo.spi.server.InternalCommitContext;
-import org.eclipse.emf.cdo.spi.server.InternalQueryManager;
-import org.eclipse.emf.cdo.spi.server.InternalQueryResult;
-import org.eclipse.emf.cdo.spi.server.InternalRepository;
-import org.eclipse.emf.cdo.spi.server.InternalSession;
-import org.eclipse.emf.cdo.spi.server.InternalTransaction;
-import org.eclipse.emf.cdo.spi.server.InternalView;
-import org.eclipse.emf.cdo.view.CDOView;
-
-import org.eclipse.net4j.util.collection.Pair;
-import org.eclipse.net4j.util.concurrent.IRWLockManager.LockType;
-import org.eclipse.net4j.util.lifecycle.Lifecycle;
-import org.eclipse.net4j.util.om.monitor.OMMonitor;
-
-import org.eclipse.emf.ecore.EClass;
-import org.eclipse.emf.ecore.EPackage;
-import org.eclipse.emf.ecore.EStructuralFeature;
-import org.eclipse.emf.spi.cdo.AbstractQueryIterator;
-import org.eclipse.emf.spi.cdo.CDOSessionProtocol;
-import org.eclipse.emf.spi.cdo.InternalCDOObject;
-import org.eclipse.emf.spi.cdo.InternalCDORemoteSessionManager;
-import org.eclipse.emf.spi.cdo.InternalCDOTransaction;
-import org.eclipse.emf.spi.cdo.InternalCDOTransaction.InternalCDOCommitContext;
-import org.eclipse.emf.spi.cdo.InternalCDOXATransaction.InternalCDOXACommitContext;
-
-import java.util.ArrayList;
-import java.util.Collection;
-import java.util.List;
-import java.util.Map;
-import java.util.Set;
-
-/**
- * @author Eike Stepper
- * @deprecated Not yet supported.
- */
-@Deprecated
-public class EmbeddedClientSessionProtocol extends Lifecycle implements CDOSessionProtocol
-{
- private EmbeddedClientSession session;
-
- // A separate session protocol instance is required because the getSession() methods are ambiguous!
- private EmbeddedServerSessionProtocol serverSessionProtocol;
-
- private InternalRepository repository;
-
- public EmbeddedClientSessionProtocol(EmbeddedClientSession session)
- {
- this.session = session;
- }
-
- public EmbeddedClientSession getSession()
- {
- return session;
- }
-
- public EmbeddedServerSessionProtocol getServerSessionProtocol()
- {
- return serverSessionProtocol;
- }
-
- public InternalSession openSession(boolean passiveUpdateEnabled)
- {
- repository = session.getRepository();
- activate();
- return serverSessionProtocol.openSession(repository, passiveUpdateEnabled);
- }
-
- public EPackage[] loadPackages(CDOPackageUnit packageUnit)
- {
- throw new UnsupportedOperationException();
- }
-
- public Pair<Integer, Long> createBranch(int branchID, BranchInfo branchInfo)
- {
- throw new UnsupportedOperationException();
- }
-
- public BranchInfo loadBranch(int branchID)
- {
- throw new UnsupportedOperationException();
- }
-
- public SubBranchInfo[] loadSubBranches(int branchID)
- {
- throw new UnsupportedOperationException();
- }
-
- public int loadBranches(int startID, int endID, CDOBranchHandler branchHandler)
- {
- throw new UnsupportedOperationException();
- }
-
- public RepositoryTimeResult getRepositoryTime()
- {
- RepositoryTimeResult result = new RepositoryTimeResult();
- long timeStamp = System.currentTimeMillis();
- result.setRequested(timeStamp);
- result.setIndicated(timeStamp);
- result.setResponded(timeStamp);
- result.setConfirmed(timeStamp);
- return result;
- }
-
- public CDOLockState[] getLockStates(int viewID, Collection<CDOID> ids)
- {
- throw new UnsupportedOperationException();
- }
-
- public void enableLockNotifications(int viewID, boolean enable)
- {
- throw new UnsupportedOperationException();
- }
-
- public void disablePassiveUpdate()
- {
- // serverSessionProtocol.getSession().setPassiveUpdateEnabled(passiveUpdateEnabled);
- // TODO: implement EmbeddedClientSessionProtocol.setPassiveUpdate(idAndVersions, initialChunkSize,
- // passiveUpdateEnabled)
- throw new UnsupportedOperationException();
- }
-
- public void setPassiveUpdateMode(PassiveUpdateMode mode)
- {
- // TODO: implement EmbeddedClientSessionProtocol.setPassiveUpdateMode(mode)
- throw new UnsupportedOperationException();
- }
-
- public void setLockNotificationMode(LockNotificationMode mode)
- {
- throw new UnsupportedOperationException();
- }
-
- public Object loadChunk(InternalCDORevision revision, EStructuralFeature feature, int accessIndex, int fetchIndex,
- int fromIndex, int toIndex)
- {
- throw new UnsupportedOperationException();
- }
-
- public void loadCommitInfos(CDOBranch branch, long startTime, long endTime, CDOCommitInfoHandler handler)
- {
- throw new UnsupportedOperationException();
- }
-
- public CDOCommitData loadCommitData(long timeStamp)
- {
- throw new UnsupportedOperationException();
- }
-
- public InternalCDORevision loadRevisionByVersion(CDOID id, CDOBranchVersion branchVersion, int referenceChunk)
- {
- try
- {
- InternalSession session = serverSessionProtocol.getSession();
- StoreThreadLocal.setSession(session);
- return repository.getRevisionManager().getRevisionByVersion(id, branchVersion, referenceChunk, true);
- }
- finally
- {
- StoreThreadLocal.release();
- }
- }
-
- public List<InternalCDORevision> loadRevisions(List<RevisionInfo> infos, CDOBranchPoint branchPoint,
- int referenceChunk, int prefetchDepth)
- {
- try
- {
- InternalSession session = serverSessionProtocol.getSession();
- StoreThreadLocal.setSession(session);
-
- List<CDOID> ids = new ArrayList<CDOID>(infos.size());
- for (RevisionInfo info : infos)
- {
- ids.add(info.getID());
- }
-
- // @SuppressWarnings("unchecked")
- // List<InternalCDORevision> revisions = (List<InternalCDORevision>)(List<?>)repository.getRevisionManager()
- // .getRevisions(ids, branchPoint, referenceChunk, prefetchDepth, true);
-
- // TODO: implement EmbeddedClientSessionProtocol.loadRevisions(infos, branchPoint, referenceChunk, prefetchDepth)
- throw new UnsupportedOperationException();
- }
- finally
- {
- StoreThreadLocal.release();
- }
- }
-
- public RefreshSessionResult refresh(long lastUpdateTime,
- Map<CDOBranch, Map<CDOID, InternalCDORevision>> viewedRevisions, int initialChunkSize,
- boolean enablePassiveUpdates)
- {
- throw new UnsupportedOperationException();
- }
-
- public void openView(int viewID, boolean readOnly, CDOBranchPoint branchPoint)
- {
- InternalSession session = serverSessionProtocol.getSession();
- if (readOnly)
- {
- session.openView(viewID, branchPoint);
- }
- else
- {
- session.openTransaction(viewID, branchPoint);
- }
- }
-
- public CDOBranchPoint openView(int viewID, boolean readOnly, String durableLockingID)
- {
- throw new UnsupportedOperationException();
- }
-
- public void switchTarget(int viewID, CDOBranchPoint branchPoint, List<InternalCDOObject> invalidObjects,
- List<CDORevisionKey> allChangedObjects, List<CDOIDAndVersion> allDetachedObjects, OMMonitor monitor)
- {
- // TODO: implement EmbeddedClientSessionProtocol.changeView(viewID, branchPoint, invalidObjects, allChangedObjects,
- // allDetachedObjects, monitor)
- throw new UnsupportedOperationException();
-
- // try
- // {
- // monitor.begin();
- // Async async = monitor.forkAsync();
- //
- // try
- // {
- // InternalView view = serverSessionProtocol.getSession().getView(viewID);
- // if (view != null)
- // {
- // List<CDOID> ids = new ArrayList<CDOID>(invalidObjects.size());
- // for (InternalCDOObject object : invalidObjects)
- // {
- // ids.add(object.cdoID());
- // }
- //
- // view.changeTarget(branchPoint, ids, allChangedObjects, allDetachedObjects);
- // }
- // }
- // finally
- // {
- // async.stop();
- // }
- // }
- // finally
- // {
- // monitor.done();
- // }
- }
-
- public void closeView(int viewID)
- {
- InternalView view = serverSessionProtocol.getSession().getView(viewID);
- if (view != null)
- {
- view.close();
- }
- }
-
- public void changeSubscription(int viewID, List<CDOID> ids, boolean subscribeMode, boolean clear)
- {
- throw new UnsupportedOperationException();
- }
-
- public void query(CDOView view, AbstractQueryIterator<?> query)
- {
- InternalView serverView = serverSessionProtocol.getSession().getView(view.getViewID());
- InternalQueryManager queryManager = repository.getQueryManager();
- InternalQueryResult result = queryManager.execute(serverView, query.getQueryInfo());
-
- query.setQueryID(result.getQueryID());
- CDOQueryQueue<Object> resultQueue = query.getQueue();
-
- try
- {
- while (result.hasNext())
- {
- Object object = result.next();
- resultQueue.add(object);
- }
- }
- catch (RuntimeException ex)
- {
- resultQueue.setException(ex);
- }
- catch (Throwable throwable)
- {
- resultQueue.setException(new RuntimeException(throwable.getMessage(), throwable));
- }
- finally
- {
- resultQueue.close();
- }
- }
-
- public boolean cancelQuery(int queryID)
- {
- repository.getQueryManager().cancel(queryID);
- return true;
- }
-
- public boolean isObjectLocked(CDOView view, CDOObject object, LockType lockType, boolean byOthers)
- {
- throw new UnsupportedOperationException();
- }
-
- @Deprecated
- public LockObjectsResult lockObjects(List<InternalCDORevision> viewedRevisions, int viewID, CDOBranch viewedBranch,
- LockType lockType, long timeout) throws InterruptedException
- {
- throw new UnsupportedOperationException();
- }
-
- /**
- * @since 4.1
- */
- public LockObjectsResult lockObjects2(List<CDORevisionKey> keys, int viewID, CDOBranch viewedBranch, LockType type,
- boolean recursive, long timeout) throws InterruptedException
- {
- throw new UnsupportedOperationException();
- }
-
- @Deprecated
- public void unlockObjects(CDOView view, Collection<CDOID> ids, LockType type)
- {
- throw new UnsupportedOperationException();
- }
-
- public UnlockObjectsResult unlockObjects2(CDOView view, Collection<CDOID> ids, LockType type, boolean recursive)
- {
- throw new UnsupportedOperationException();
- }
-
- public LockObjectsResult delegateLockObjects(String lockAreaID, List<CDORevisionKey> keys, CDOBranch viewedBranch,
- LockType type, boolean recursive, long timeout) throws InterruptedException
- {
- throw new UnsupportedOperationException();
- }
-
- public UnlockObjectsResult delegateUnlockObjects(String lockAreaID, Collection<CDOID> ids, LockType type,
- boolean recursive)
- {
- throw new UnsupportedOperationException();
- }
-
- public String changeLockArea(CDOView view, boolean create)
- {
- throw new UnsupportedOperationException();
- }
-
- public List<byte[]> queryLobs(Set<byte[]> ids)
- {
- // TODO: implement EmbeddedClientSessionProtocol.queryLobs(ids)
- throw new UnsupportedOperationException();
- }
-
- public void loadLob(CDOLobInfo info, Object outputStreamOrWriter)
- {
- // TODO: implement EmbeddedClientSessionProtocol.loadLob(info, out)
- throw new UnsupportedOperationException();
- }
-
- public void handleRevisions(EClass eClass, CDOBranch branch, boolean exactBranch, long timeStamp, boolean exactTime,
- CDORevisionHandler handler)
- {
- // TODO: implement EmbeddedClientSessionProtocol.handleRevisions(eClass, branch, exactBranch, timeStamp, exactTime,
- // handler)
- throw new UnsupportedOperationException();
- }
-
- @Deprecated
- public CommitTransactionResult commitTransaction(int transactionID, String comment, boolean releaseLocks,
- CDOIDProvider idProvider, CDOCommitData commitData, Collection<CDOLob<?>> lobs, OMMonitor monitor)
- {
- throw new UnsupportedOperationException();
- }
-
- public CommitTransactionResult commitTransaction(InternalCDOCommitContext context, OMMonitor monitor)
- {
- monitor.begin(2);
- boolean success = false;
- InternalCommitContext serverCommitContext = null;
- CommitTransactionResult result = null;
-
- try
- {
- InternalCDOTransaction transaction = context.getTransaction();
- CDOCommitData commitData = context.getCommitData();
-
- int transactionID = transaction.getViewID();
- InternalTransaction serverTransaction = (InternalTransaction)serverSessionProtocol.getSession().getView(
- transactionID);
- serverCommitContext = serverTransaction.createCommitContext();
- serverCommitContext.preWrite();
- serverCommitContext.setAutoReleaseLocksEnabled(transaction.options().isAutoReleaseLocksEnabled());
-
- List<CDOPackageUnit> npu = commitData.getNewPackageUnits();
- serverCommitContext.setNewPackageUnits(npu.toArray(new InternalCDOPackageUnit[npu.size()]));
-
- List<CDOIDAndVersion> no = commitData.getNewObjects();
- InternalCDORevision[] array = new InternalCDORevision[no.size()];
- int index = 0;
- for (CDOIDAndVersion object : no)
- {
- InternalCDORevision revision = (InternalCDORevision)object;
- // revision.convertEObjects(clientTransaction);
- array[index++] = revision;
- }
-
- serverCommitContext.setNewObjects(array);
-
- List<CDORevisionKey> rd = commitData.getChangedObjects();
- serverCommitContext.setDirtyObjectDeltas(rd.toArray(new InternalCDORevisionDelta[rd.size()]));
-
- List<CDOIDAndVersion> detachedObjects = commitData.getDetachedObjects();
- serverCommitContext.setDetachedObjects(detachedObjects.toArray(new CDOID[detachedObjects.size()]));
-
- serverCommitContext.write(monitor.fork());
- success = serverCommitContext.getRollbackMessage() == null;
- if (success)
- {
- serverCommitContext.commit(monitor.fork());
- }
- else
- {
- monitor.worked();
- }
-
- // result = new CommitTransactionResult(commitData, serverCommitContext.getBranchPoint().getTimeStamp());
- // for (Entry<CDOID, CDOID> entry : serverCommitContext.getIDMappings().entrySet())
- // {
- // result.addIDMapping(entry.getKey(), entry.getValue());
- // }
- }
- finally
- {
- if (serverCommitContext != null)
- {
- serverCommitContext.postCommit(success);
- }
-
- monitor.done();
- }
-
- return result;
- }
-
- @Deprecated
- public CommitTransactionResult commitDelegation(CDOBranch branch, String userID, String comment,
- CDOCommitData commitData, Map<CDOID, EClass> detachedObjectTypes, Collection<CDOLob<?>> lobs, OMMonitor monitor)
- {
- throw new UnsupportedOperationException();
- }
-
- public CommitTransactionResult commitDelegation(InternalCDOCommitContext context, OMMonitor monitor)
- {
- throw new UnsupportedOperationException();
- }
-
- public CommitTransactionResult commitXATransactionCancel(InternalCDOXACommitContext xaContext, OMMonitor monitor)
- {
- throw new UnsupportedOperationException();
- }
-
- public CommitTransactionResult commitXATransactionPhase1(InternalCDOXACommitContext xaContext, OMMonitor monitor)
- {
- throw new UnsupportedOperationException();
- }
-
- public CommitTransactionResult commitXATransactionPhase2(InternalCDOXACommitContext xaContext, OMMonitor monitor)
- {
- throw new UnsupportedOperationException();
- }
-
- public CommitTransactionResult commitXATransactionPhase3(InternalCDOXACommitContext xaContext, OMMonitor monitor)
- {
- throw new UnsupportedOperationException();
- }
-
- public List<CDORemoteSession> getRemoteSessions(InternalCDORemoteSessionManager manager, boolean subscribe)
- {
- throw new UnsupportedOperationException();
- }
-
- public Set<Integer> sendRemoteMessage(CDORemoteSessionMessage message, List<CDORemoteSession> recipients)
- {
- throw new UnsupportedOperationException();
- }
-
- public boolean unsubscribeRemoteSessions()
- {
- throw new UnsupportedOperationException();
- }
-
- public void replicateRepository(CDOReplicationContext context, OMMonitor monitor)
- {
- throw new UnsupportedOperationException();
- }
-
- public void replicateRepositoryRaw(CDORawReplicationContext context, OMMonitor monitor)
- {
- throw new UnsupportedOperationException();
- }
-
- public CDOChangeSetData[] loadChangeSets(CDOBranchPointRange... ranges)
- {
- throw new UnsupportedOperationException();
- }
-
- public Set<CDOID> loadMergeData(CDORevisionAvailabilityInfo targetInfo, CDORevisionAvailabilityInfo sourceInfo,
- CDORevisionAvailabilityInfo targetBaseInfo, CDORevisionAvailabilityInfo sourceBaseInfo)
- {
- throw new UnsupportedOperationException();
- }
-
- public CDOAuthenticationResult handleAuthenticationChallenge(byte[] randomToken) throws Exception
- {
- CDOAuthenticator authenticator = getSession().getAuthenticator();
- if (authenticator == null)
- {
- throw new IllegalStateException("No authenticator configured"); //$NON-NLS-1$
- }
-
- CDOAuthenticationResult result = authenticator.authenticate(randomToken);
- if (result == null)
- {
- throw new SecurityException("Not authenticated"); //$NON-NLS-1$
- }
-
- String userID = result.getUserID();
- if (userID == null)
- {
- throw new SecurityException("No user ID"); //$NON-NLS-1$
- }
-
- byte[] cryptedToken = result.getCryptedToken();
- if (cryptedToken == null)
- {
- throw new SecurityException("No crypted token"); //$NON-NLS-1$
- }
-
- return result;
- }
-
- @Override
- protected void doActivate() throws Exception
- {
- super.doActivate();
- serverSessionProtocol = new EmbeddedServerSessionProtocol(this);
- serverSessionProtocol.activate();
- }
-
- @Override
- protected void doDeactivate() throws Exception
- {
- serverSessionProtocol.deactivate();
- serverSessionProtocol = null;
- super.doDeactivate();
- }
-}
+/*
+ * Copyright (c) 2004 - 2012 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.server.embedded;
+
+import org.eclipse.emf.cdo.CDOObject;
+import org.eclipse.emf.cdo.common.CDOCommonSession.Options.LockNotificationMode;
+import org.eclipse.emf.cdo.common.CDOCommonSession.Options.PassiveUpdateMode;
+import org.eclipse.emf.cdo.common.branch.CDOBranch;
+import org.eclipse.emf.cdo.common.branch.CDOBranchHandler;
+import org.eclipse.emf.cdo.common.branch.CDOBranchPoint;
+import org.eclipse.emf.cdo.common.branch.CDOBranchPointRange;
+import org.eclipse.emf.cdo.common.branch.CDOBranchVersion;
+import org.eclipse.emf.cdo.common.commit.CDOChangeSetData;
+import org.eclipse.emf.cdo.common.commit.CDOCommitData;
+import org.eclipse.emf.cdo.common.commit.CDOCommitInfoHandler;
+import org.eclipse.emf.cdo.common.id.CDOID;
+import org.eclipse.emf.cdo.common.id.CDOIDProvider;
+import org.eclipse.emf.cdo.common.lob.CDOLob;
+import org.eclipse.emf.cdo.common.lob.CDOLobInfo;
+import org.eclipse.emf.cdo.common.lock.CDOLockState;
+import org.eclipse.emf.cdo.common.model.CDOPackageUnit;
+import org.eclipse.emf.cdo.common.protocol.CDOAuthenticator;
+import org.eclipse.emf.cdo.common.revision.CDOIDAndVersion;
+import org.eclipse.emf.cdo.common.revision.CDORevisionHandler;
+import org.eclipse.emf.cdo.common.revision.CDORevisionKey;
+import org.eclipse.emf.cdo.common.util.CDOQueryQueue;
+import org.eclipse.emf.cdo.server.StoreThreadLocal;
+import org.eclipse.emf.cdo.session.remote.CDORemoteSession;
+import org.eclipse.emf.cdo.session.remote.CDORemoteSessionMessage;
+import org.eclipse.emf.cdo.spi.common.CDOAuthenticationResult;
+import org.eclipse.emf.cdo.spi.common.CDORawReplicationContext;
+import org.eclipse.emf.cdo.spi.common.CDOReplicationContext;
+import org.eclipse.emf.cdo.spi.common.commit.CDORevisionAvailabilityInfo;
+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.InternalCDORevisionDelta;
+import org.eclipse.emf.cdo.spi.common.revision.RevisionInfo;
+import org.eclipse.emf.cdo.spi.server.InternalCommitContext;
+import org.eclipse.emf.cdo.spi.server.InternalQueryManager;
+import org.eclipse.emf.cdo.spi.server.InternalQueryResult;
+import org.eclipse.emf.cdo.spi.server.InternalRepository;
+import org.eclipse.emf.cdo.spi.server.InternalSession;
+import org.eclipse.emf.cdo.spi.server.InternalTransaction;
+import org.eclipse.emf.cdo.spi.server.InternalView;
+import org.eclipse.emf.cdo.view.CDOView;
+
+import org.eclipse.net4j.util.collection.Pair;
+import org.eclipse.net4j.util.concurrent.IRWLockManager.LockType;
+import org.eclipse.net4j.util.lifecycle.Lifecycle;
+import org.eclipse.net4j.util.om.monitor.OMMonitor;
+
+import org.eclipse.emf.ecore.EClass;
+import org.eclipse.emf.ecore.EPackage;
+import org.eclipse.emf.ecore.EStructuralFeature;
+import org.eclipse.emf.spi.cdo.AbstractQueryIterator;
+import org.eclipse.emf.spi.cdo.CDOSessionProtocol;
+import org.eclipse.emf.spi.cdo.InternalCDOObject;
+import org.eclipse.emf.spi.cdo.InternalCDORemoteSessionManager;
+import org.eclipse.emf.spi.cdo.InternalCDOTransaction;
+import org.eclipse.emf.spi.cdo.InternalCDOTransaction.InternalCDOCommitContext;
+import org.eclipse.emf.spi.cdo.InternalCDOXATransaction.InternalCDOXACommitContext;
+
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.List;
+import java.util.Map;
+import java.util.Set;
+
+/**
+ * @author Eike Stepper
+ * @deprecated Not yet supported.
+ */
+@Deprecated
+public class EmbeddedClientSessionProtocol extends Lifecycle implements CDOSessionProtocol
+{
+ private EmbeddedClientSession session;
+
+ // A separate session protocol instance is required because the getSession() methods are ambiguous!
+ private EmbeddedServerSessionProtocol serverSessionProtocol;
+
+ private InternalRepository repository;
+
+ public EmbeddedClientSessionProtocol(EmbeddedClientSession session)
+ {
+ this.session = session;
+ }
+
+ public EmbeddedClientSession getSession()
+ {
+ return session;
+ }
+
+ public EmbeddedServerSessionProtocol getServerSessionProtocol()
+ {
+ return serverSessionProtocol;
+ }
+
+ public InternalSession openSession(boolean passiveUpdateEnabled)
+ {
+ repository = session.getRepository();
+ activate();
+ return serverSessionProtocol.openSession(repository, passiveUpdateEnabled);
+ }
+
+ public EPackage[] loadPackages(CDOPackageUnit packageUnit)
+ {
+ throw new UnsupportedOperationException();
+ }
+
+ public Pair<Integer, Long> createBranch(int branchID, BranchInfo branchInfo)
+ {
+ throw new UnsupportedOperationException();
+ }
+
+ public BranchInfo loadBranch(int branchID)
+ {
+ throw new UnsupportedOperationException();
+ }
+
+ public SubBranchInfo[] loadSubBranches(int branchID)
+ {
+ throw new UnsupportedOperationException();
+ }
+
+ public int loadBranches(int startID, int endID, CDOBranchHandler branchHandler)
+ {
+ throw new UnsupportedOperationException();
+ }
+
+ public RepositoryTimeResult getRepositoryTime()
+ {
+ RepositoryTimeResult result = new RepositoryTimeResult();
+ long timeStamp = System.currentTimeMillis();
+ result.setRequested(timeStamp);
+ result.setIndicated(timeStamp);
+ result.setResponded(timeStamp);
+ result.setConfirmed(timeStamp);
+ return result;
+ }
+
+ public CDOLockState[] getLockStates(int viewID, Collection<CDOID> ids)
+ {
+ throw new UnsupportedOperationException();
+ }
+
+ public void enableLockNotifications(int viewID, boolean enable)
+ {
+ throw new UnsupportedOperationException();
+ }
+
+ public void disablePassiveUpdate()
+ {
+ // serverSessionProtocol.getSession().setPassiveUpdateEnabled(passiveUpdateEnabled);
+ // TODO: implement EmbeddedClientSessionProtocol.setPassiveUpdate(idAndVersions, initialChunkSize,
+ // passiveUpdateEnabled)
+ throw new UnsupportedOperationException();
+ }
+
+ public void setPassiveUpdateMode(PassiveUpdateMode mode)
+ {
+ // TODO: implement EmbeddedClientSessionProtocol.setPassiveUpdateMode(mode)
+ throw new UnsupportedOperationException();
+ }
+
+ public void setLockNotificationMode(LockNotificationMode mode)
+ {
+ throw new UnsupportedOperationException();
+ }
+
+ public Object loadChunk(InternalCDORevision revision, EStructuralFeature feature, int accessIndex, int fetchIndex,
+ int fromIndex, int toIndex)
+ {
+ throw new UnsupportedOperationException();
+ }
+
+ public void loadCommitInfos(CDOBranch branch, long startTime, long endTime, CDOCommitInfoHandler handler)
+ {
+ throw new UnsupportedOperationException();
+ }
+
+ public CDOCommitData loadCommitData(long timeStamp)
+ {
+ throw new UnsupportedOperationException();
+ }
+
+ public InternalCDORevision loadRevisionByVersion(CDOID id, CDOBranchVersion branchVersion, int referenceChunk)
+ {
+ try
+ {
+ InternalSession session = serverSessionProtocol.getSession();
+ StoreThreadLocal.setSession(session);
+ return repository.getRevisionManager().getRevisionByVersion(id, branchVersion, referenceChunk, true);
+ }
+ finally
+ {
+ StoreThreadLocal.release();
+ }
+ }
+
+ public List<InternalCDORevision> loadRevisions(List<RevisionInfo> infos, CDOBranchPoint branchPoint,
+ int referenceChunk, int prefetchDepth)
+ {
+ try
+ {
+ InternalSession session = serverSessionProtocol.getSession();
+ StoreThreadLocal.setSession(session);
+
+ List<CDOID> ids = new ArrayList<CDOID>(infos.size());
+ for (RevisionInfo info : infos)
+ {
+ ids.add(info.getID());
+ }
+
+ // @SuppressWarnings("unchecked")
+ // List<InternalCDORevision> revisions = (List<InternalCDORevision>)(List<?>)repository.getRevisionManager()
+ // .getRevisions(ids, branchPoint, referenceChunk, prefetchDepth, true);
+
+ // TODO: implement EmbeddedClientSessionProtocol.loadRevisions(infos, branchPoint, referenceChunk, prefetchDepth)
+ throw new UnsupportedOperationException();
+ }
+ finally
+ {
+ StoreThreadLocal.release();
+ }
+ }
+
+ public RefreshSessionResult refresh(long lastUpdateTime,
+ Map<CDOBranch, Map<CDOID, InternalCDORevision>> viewedRevisions, int initialChunkSize,
+ boolean enablePassiveUpdates)
+ {
+ throw new UnsupportedOperationException();
+ }
+
+ public void openView(int viewID, boolean readOnly, CDOBranchPoint branchPoint)
+ {
+ InternalSession session = serverSessionProtocol.getSession();
+ if (readOnly)
+ {
+ session.openView(viewID, branchPoint);
+ }
+ else
+ {
+ session.openTransaction(viewID, branchPoint);
+ }
+ }
+
+ public CDOBranchPoint openView(int viewID, boolean readOnly, String durableLockingID)
+ {
+ throw new UnsupportedOperationException();
+ }
+
+ public void switchTarget(int viewID, CDOBranchPoint branchPoint, List<InternalCDOObject> invalidObjects,
+ List<CDORevisionKey> allChangedObjects, List<CDOIDAndVersion> allDetachedObjects, OMMonitor monitor)
+ {
+ // TODO: implement EmbeddedClientSessionProtocol.changeView(viewID, branchPoint, invalidObjects, allChangedObjects,
+ // allDetachedObjects, monitor)
+ throw new UnsupportedOperationException();
+
+ // try
+ // {
+ // monitor.begin();
+ // Async async = monitor.forkAsync();
+ //
+ // try
+ // {
+ // InternalView view = serverSessionProtocol.getSession().getView(viewID);
+ // if (view != null)
+ // {
+ // List<CDOID> ids = new ArrayList<CDOID>(invalidObjects.size());
+ // for (InternalCDOObject object : invalidObjects)
+ // {
+ // ids.add(object.cdoID());
+ // }
+ //
+ // view.changeTarget(branchPoint, ids, allChangedObjects, allDetachedObjects);
+ // }
+ // }
+ // finally
+ // {
+ // async.stop();
+ // }
+ // }
+ // finally
+ // {
+ // monitor.done();
+ // }
+ }
+
+ public void closeView(int viewID)
+ {
+ InternalView view = serverSessionProtocol.getSession().getView(viewID);
+ if (view != null)
+ {
+ view.close();
+ }
+ }
+
+ public void changeSubscription(int viewID, List<CDOID> ids, boolean subscribeMode, boolean clear)
+ {
+ throw new UnsupportedOperationException();
+ }
+
+ public void query(CDOView view, AbstractQueryIterator<?> query)
+ {
+ InternalView serverView = serverSessionProtocol.getSession().getView(view.getViewID());
+ InternalQueryManager queryManager = repository.getQueryManager();
+ InternalQueryResult result = queryManager.execute(serverView, query.getQueryInfo());
+
+ query.setQueryID(result.getQueryID());
+ CDOQueryQueue<Object> resultQueue = query.getQueue();
+
+ try
+ {
+ while (result.hasNext())
+ {
+ Object object = result.next();
+ resultQueue.add(object);
+ }
+ }
+ catch (RuntimeException ex)
+ {
+ resultQueue.setException(ex);
+ }
+ catch (Throwable throwable)
+ {
+ resultQueue.setException(new RuntimeException(throwable.getMessage(), throwable));
+ }
+ finally
+ {
+ resultQueue.close();
+ }
+ }
+
+ public boolean cancelQuery(int queryID)
+ {
+ repository.getQueryManager().cancel(queryID);
+ return true;
+ }
+
+ public boolean isObjectLocked(CDOView view, CDOObject object, LockType lockType, boolean byOthers)
+ {
+ throw new UnsupportedOperationException();
+ }
+
+ @Deprecated
+ public LockObjectsResult lockObjects(List<InternalCDORevision> viewedRevisions, int viewID, CDOBranch viewedBranch,
+ LockType lockType, long timeout) throws InterruptedException
+ {
+ throw new UnsupportedOperationException();
+ }
+
+ /**
+ * @since 4.1
+ */
+ public LockObjectsResult lockObjects2(List<CDORevisionKey> keys, int viewID, CDOBranch viewedBranch, LockType type,
+ boolean recursive, long timeout) throws InterruptedException
+ {
+ throw new UnsupportedOperationException();
+ }
+
+ @Deprecated
+ public void unlockObjects(CDOView view, Collection<CDOID> ids, LockType type)
+ {
+ throw new UnsupportedOperationException();
+ }
+
+ public UnlockObjectsResult unlockObjects2(CDOView view, Collection<CDOID> ids, LockType type, boolean recursive)
+ {
+ throw new UnsupportedOperationException();
+ }
+
+ public LockObjectsResult delegateLockObjects(String lockAreaID, List<CDORevisionKey> keys, CDOBranch viewedBranch,
+ LockType type, boolean recursive, long timeout) throws InterruptedException
+ {
+ throw new UnsupportedOperationException();
+ }
+
+ public UnlockObjectsResult delegateUnlockObjects(String lockAreaID, Collection<CDOID> ids, LockType type,
+ boolean recursive)
+ {
+ throw new UnsupportedOperationException();
+ }
+
+ public String changeLockArea(CDOView view, boolean create)
+ {
+ throw new UnsupportedOperationException();
+ }
+
+ public List<byte[]> queryLobs(Set<byte[]> ids)
+ {
+ // TODO: implement EmbeddedClientSessionProtocol.queryLobs(ids)
+ throw new UnsupportedOperationException();
+ }
+
+ public void loadLob(CDOLobInfo info, Object outputStreamOrWriter)
+ {
+ // TODO: implement EmbeddedClientSessionProtocol.loadLob(info, out)
+ throw new UnsupportedOperationException();
+ }
+
+ public void handleRevisions(EClass eClass, CDOBranch branch, boolean exactBranch, long timeStamp, boolean exactTime,
+ CDORevisionHandler handler)
+ {
+ // TODO: implement EmbeddedClientSessionProtocol.handleRevisions(eClass, branch, exactBranch, timeStamp, exactTime,
+ // handler)
+ throw new UnsupportedOperationException();
+ }
+
+ @Deprecated
+ public CommitTransactionResult commitTransaction(int transactionID, String comment, boolean releaseLocks,
+ CDOIDProvider idProvider, CDOCommitData commitData, Collection<CDOLob<?>> lobs, OMMonitor monitor)
+ {
+ throw new UnsupportedOperationException();
+ }
+
+ public CommitTransactionResult commitTransaction(InternalCDOCommitContext context, OMMonitor monitor)
+ {
+ monitor.begin(2);
+ boolean success = false;
+ InternalCommitContext serverCommitContext = null;
+ CommitTransactionResult result = null;
+
+ try
+ {
+ InternalCDOTransaction transaction = context.getTransaction();
+ CDOCommitData commitData = context.getCommitData();
+
+ int transactionID = transaction.getViewID();
+ InternalTransaction serverTransaction = (InternalTransaction)serverSessionProtocol.getSession().getView(
+ transactionID);
+ serverCommitContext = serverTransaction.createCommitContext();
+ serverCommitContext.preWrite();
+ serverCommitContext.setAutoReleaseLocksEnabled(transaction.options().isAutoReleaseLocksEnabled());
+
+ List<CDOPackageUnit> npu = commitData.getNewPackageUnits();
+ serverCommitContext.setNewPackageUnits(npu.toArray(new InternalCDOPackageUnit[npu.size()]));
+
+ List<CDOIDAndVersion> no = commitData.getNewObjects();
+ InternalCDORevision[] array = new InternalCDORevision[no.size()];
+ int index = 0;
+ for (CDOIDAndVersion object : no)
+ {
+ InternalCDORevision revision = (InternalCDORevision)object;
+ // revision.convertEObjects(clientTransaction);
+ array[index++] = revision;
+ }
+
+ serverCommitContext.setNewObjects(array);
+
+ List<CDORevisionKey> rd = commitData.getChangedObjects();
+ serverCommitContext.setDirtyObjectDeltas(rd.toArray(new InternalCDORevisionDelta[rd.size()]));
+
+ List<CDOIDAndVersion> detachedObjects = commitData.getDetachedObjects();
+ serverCommitContext.setDetachedObjects(detachedObjects.toArray(new CDOID[detachedObjects.size()]));
+
+ serverCommitContext.write(monitor.fork());
+ success = serverCommitContext.getRollbackMessage() == null;
+ if (success)
+ {
+ serverCommitContext.commit(monitor.fork());
+ }
+ else
+ {
+ monitor.worked();
+ }
+
+ // result = new CommitTransactionResult(commitData, serverCommitContext.getBranchPoint().getTimeStamp());
+ // for (Entry<CDOID, CDOID> entry : serverCommitContext.getIDMappings().entrySet())
+ // {
+ // result.addIDMapping(entry.getKey(), entry.getValue());
+ // }
+ }
+ finally
+ {
+ if (serverCommitContext != null)
+ {
+ serverCommitContext.postCommit(success);
+ }
+
+ monitor.done();
+ }
+
+ return result;
+ }
+
+ @Deprecated
+ public CommitTransactionResult commitDelegation(CDOBranch branch, String userID, String comment,
+ CDOCommitData commitData, Map<CDOID, EClass> detachedObjectTypes, Collection<CDOLob<?>> lobs, OMMonitor monitor)
+ {
+ throw new UnsupportedOperationException();
+ }
+
+ public CommitTransactionResult commitDelegation(InternalCDOCommitContext context, OMMonitor monitor)
+ {
+ throw new UnsupportedOperationException();
+ }
+
+ public CommitTransactionResult commitXATransactionCancel(InternalCDOXACommitContext xaContext, OMMonitor monitor)
+ {
+ throw new UnsupportedOperationException();
+ }
+
+ public CommitTransactionResult commitXATransactionPhase1(InternalCDOXACommitContext xaContext, OMMonitor monitor)
+ {
+ throw new UnsupportedOperationException();
+ }
+
+ public CommitTransactionResult commitXATransactionPhase2(InternalCDOXACommitContext xaContext, OMMonitor monitor)
+ {
+ throw new UnsupportedOperationException();
+ }
+
+ public CommitTransactionResult commitXATransactionPhase3(InternalCDOXACommitContext xaContext, OMMonitor monitor)
+ {
+ throw new UnsupportedOperationException();
+ }
+
+ public List<CDORemoteSession> getRemoteSessions(InternalCDORemoteSessionManager manager, boolean subscribe)
+ {
+ throw new UnsupportedOperationException();
+ }
+
+ public Set<Integer> sendRemoteMessage(CDORemoteSessionMessage message, List<CDORemoteSession> recipients)
+ {
+ throw new UnsupportedOperationException();
+ }
+
+ public boolean unsubscribeRemoteSessions()
+ {
+ throw new UnsupportedOperationException();
+ }
+
+ public void replicateRepository(CDOReplicationContext context, OMMonitor monitor)
+ {
+ throw new UnsupportedOperationException();
+ }
+
+ public void replicateRepositoryRaw(CDORawReplicationContext context, OMMonitor monitor)
+ {
+ throw new UnsupportedOperationException();
+ }
+
+ public CDOChangeSetData[] loadChangeSets(CDOBranchPointRange... ranges)
+ {
+ throw new UnsupportedOperationException();
+ }
+
+ public Set<CDOID> loadMergeData(CDORevisionAvailabilityInfo targetInfo, CDORevisionAvailabilityInfo sourceInfo,
+ CDORevisionAvailabilityInfo targetBaseInfo, CDORevisionAvailabilityInfo sourceBaseInfo)
+ {
+ throw new UnsupportedOperationException();
+ }
+
+ public CDOAuthenticationResult handleAuthenticationChallenge(byte[] randomToken) throws Exception
+ {
+ CDOAuthenticator authenticator = getSession().getAuthenticator();
+ if (authenticator == null)
+ {
+ throw new IllegalStateException("No authenticator configured"); //$NON-NLS-1$
+ }
+
+ CDOAuthenticationResult result = authenticator.authenticate(randomToken);
+ if (result == null)
+ {
+ throw new SecurityException("Not authenticated"); //$NON-NLS-1$
+ }
+
+ String userID = result.getUserID();
+ if (userID == null)
+ {
+ throw new SecurityException("No user ID"); //$NON-NLS-1$
+ }
+
+ byte[] cryptedToken = result.getCryptedToken();
+ if (cryptedToken == null)
+ {
+ throw new SecurityException("No crypted token"); //$NON-NLS-1$
+ }
+
+ return result;
+ }
+
+ @Override
+ protected void doActivate() throws Exception
+ {
+ super.doActivate();
+ serverSessionProtocol = new EmbeddedServerSessionProtocol(this);
+ serverSessionProtocol.activate();
+ }
+
+ @Override
+ protected void doDeactivate() throws Exception
+ {
+ serverSessionProtocol.deactivate();
+ serverSessionProtocol = null;
+ super.doDeactivate();
+ }
+}
diff --git a/plugins/org.eclipse.emf.cdo.server/src/org/eclipse/emf/cdo/internal/server/embedded/EmbeddedServerSessionProtocol.java b/plugins/org.eclipse.emf.cdo.server/src/org/eclipse/emf/cdo/internal/server/embedded/EmbeddedServerSessionProtocol.java
index f2b0a60c9a..b47d7d8eae 100644
--- a/plugins/org.eclipse.emf.cdo.server/src/org/eclipse/emf/cdo/internal/server/embedded/EmbeddedServerSessionProtocol.java
+++ b/plugins/org.eclipse.emf.cdo.server/src/org/eclipse/emf/cdo/internal/server/embedded/EmbeddedServerSessionProtocol.java
@@ -1,111 +1,111 @@
-/*
- * Copyright (c) 2004 - 2011 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.server.embedded;
-
-import org.eclipse.emf.cdo.common.CDOCommonRepository;
-import org.eclipse.emf.cdo.common.commit.CDOCommitInfo;
-import org.eclipse.emf.cdo.common.id.CDOID;
-import org.eclipse.emf.cdo.common.lock.CDOLockChangeInfo;
-import org.eclipse.emf.cdo.session.remote.CDORemoteSessionMessage;
-import org.eclipse.emf.cdo.spi.common.CDOAuthenticationResult;
-import org.eclipse.emf.cdo.spi.common.branch.InternalCDOBranch;
-import org.eclipse.emf.cdo.spi.server.ISessionProtocol;
-import org.eclipse.emf.cdo.spi.server.InternalRepository;
-import org.eclipse.emf.cdo.spi.server.InternalSession;
-
-import org.eclipse.net4j.util.lifecycle.Lifecycle;
-
-/**
- * @author Eike Stepper
- * @deprecated Not yet supported.
- */
-@Deprecated
-public class EmbeddedServerSessionProtocol extends Lifecycle implements ISessionProtocol
-{
- // A separate session protocol instance is required because the getSession() methods are ambiguous!
- private EmbeddedClientSessionProtocol clientSessionProtocol;
-
- private InternalSession session;
-
- public EmbeddedServerSessionProtocol(EmbeddedClientSessionProtocol clientSessionProtocol)
- {
- this.clientSessionProtocol = clientSessionProtocol;
- }
-
- public EmbeddedClientSessionProtocol getClientSessionProtocol()
- {
- return clientSessionProtocol;
- }
-
- public InternalSession openSession(InternalRepository repository, boolean passiveUpdateEnabled)
- {
- session = repository.getSessionManager().openSession(this);
- session.setPassiveUpdateEnabled(passiveUpdateEnabled);
- return session;
- }
-
- public InternalSession getSession()
- {
- return session;
- }
-
- public CDOAuthenticationResult sendAuthenticationChallenge(byte[] randomToken) throws Exception
- {
- return clientSessionProtocol.handleAuthenticationChallenge(randomToken);
- }
-
- public void sendRepositoryTypeNotification(CDOCommonRepository.Type oldType, CDOCommonRepository.Type newType)
- {
- EmbeddedClientSession clientSession = clientSessionProtocol.getSession();
- clientSession.handleRepositoryTypeChanged(oldType, newType);
- }
-
- @Deprecated
- public void sendRepositoryStateNotification(CDOCommonRepository.State oldState, CDOCommonRepository.State newState)
- {
- sendRepositoryStateNotification(oldState, newState, null);
- }
-
- public void sendRepositoryStateNotification(CDOCommonRepository.State oldState, CDOCommonRepository.State newState,
- CDOID rootResourceID)
- {
- EmbeddedClientSession clientSession = clientSessionProtocol.getSession();
- clientSession.handleRepositoryStateChanged(oldState, newState);
- }
-
- public void sendBranchNotification(InternalCDOBranch branch)
- {
- EmbeddedClientSession clientSession = clientSessionProtocol.getSession();
- clientSession.handleBranchNotification(branch);
- }
-
- public void sendCommitNotification(CDOCommitInfo commitInfo)
- {
- EmbeddedClientSession clientSession = clientSessionProtocol.getSession();
- clientSession.handleCommitNotification(commitInfo);
- }
-
- public void sendLockNotification(CDOLockChangeInfo lockChangeInfo)
- {
- EmbeddedClientSession clientSession = clientSessionProtocol.getSession();
- clientSession.handleLockNotification(lockChangeInfo, null);
- }
-
- public void sendRemoteSessionNotification(InternalSession sender, byte opcode)
- {
- throw new UnsupportedOperationException();
- }
-
- public void sendRemoteMessageNotification(InternalSession sender, CDORemoteSessionMessage message)
- {
- throw new UnsupportedOperationException();
- }
-}
+/*
+ * Copyright (c) 2004 - 2012 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.server.embedded;
+
+import org.eclipse.emf.cdo.common.CDOCommonRepository;
+import org.eclipse.emf.cdo.common.commit.CDOCommitInfo;
+import org.eclipse.emf.cdo.common.id.CDOID;
+import org.eclipse.emf.cdo.common.lock.CDOLockChangeInfo;
+import org.eclipse.emf.cdo.session.remote.CDORemoteSessionMessage;
+import org.eclipse.emf.cdo.spi.common.CDOAuthenticationResult;
+import org.eclipse.emf.cdo.spi.common.branch.InternalCDOBranch;
+import org.eclipse.emf.cdo.spi.server.ISessionProtocol;
+import org.eclipse.emf.cdo.spi.server.InternalRepository;
+import org.eclipse.emf.cdo.spi.server.InternalSession;
+
+import org.eclipse.net4j.util.lifecycle.Lifecycle;
+
+/**
+ * @author Eike Stepper
+ * @deprecated Not yet supported.
+ */
+@Deprecated
+public class EmbeddedServerSessionProtocol extends Lifecycle implements ISessionProtocol
+{
+ // A separate session protocol instance is required because the getSession() methods are ambiguous!
+ private EmbeddedClientSessionProtocol clientSessionProtocol;
+
+ private InternalSession session;
+
+ public EmbeddedServerSessionProtocol(EmbeddedClientSessionProtocol clientSessionProtocol)
+ {
+ this.clientSessionProtocol = clientSessionProtocol;
+ }
+
+ public EmbeddedClientSessionProtocol getClientSessionProtocol()
+ {
+ return clientSessionProtocol;
+ }
+
+ public InternalSession openSession(InternalRepository repository, boolean passiveUpdateEnabled)
+ {
+ session = repository.getSessionManager().openSession(this);
+ session.setPassiveUpdateEnabled(passiveUpdateEnabled);
+ return session;
+ }
+
+ public InternalSession getSession()
+ {
+ return session;
+ }
+
+ public CDOAuthenticationResult sendAuthenticationChallenge(byte[] randomToken) throws Exception
+ {
+ return clientSessionProtocol.handleAuthenticationChallenge(randomToken);
+ }
+
+ public void sendRepositoryTypeNotification(CDOCommonRepository.Type oldType, CDOCommonRepository.Type newType)
+ {
+ EmbeddedClientSession clientSession = clientSessionProtocol.getSession();
+ clientSession.handleRepositoryTypeChanged(oldType, newType);
+ }
+
+ @Deprecated
+ public void sendRepositoryStateNotification(CDOCommonRepository.State oldState, CDOCommonRepository.State newState)
+ {
+ sendRepositoryStateNotification(oldState, newState, null);
+ }
+
+ public void sendRepositoryStateNotification(CDOCommonRepository.State oldState, CDOCommonRepository.State newState,
+ CDOID rootResourceID)
+ {
+ EmbeddedClientSession clientSession = clientSessionProtocol.getSession();
+ clientSession.handleRepositoryStateChanged(oldState, newState);
+ }
+
+ public void sendBranchNotification(InternalCDOBranch branch)
+ {
+ EmbeddedClientSession clientSession = clientSessionProtocol.getSession();
+ clientSession.handleBranchNotification(branch);
+ }
+
+ public void sendCommitNotification(CDOCommitInfo commitInfo)
+ {
+ EmbeddedClientSession clientSession = clientSessionProtocol.getSession();
+ clientSession.handleCommitNotification(commitInfo);
+ }
+
+ public void sendLockNotification(CDOLockChangeInfo lockChangeInfo)
+ {
+ EmbeddedClientSession clientSession = clientSessionProtocol.getSession();
+ clientSession.handleLockNotification(lockChangeInfo, null);
+ }
+
+ public void sendRemoteSessionNotification(InternalSession sender, byte opcode)
+ {
+ throw new UnsupportedOperationException();
+ }
+
+ public void sendRemoteMessageNotification(InternalSession sender, CDORemoteSessionMessage message)
+ {
+ throw new UnsupportedOperationException();
+ }
+}

Back to the top