diff options
author | Eike Stepper | 2012-07-19 08:22:04 +0000 |
---|---|---|
committer | Eike Stepper | 2012-07-19 08:22:04 +0000 |
commit | 1460904fd3c193ffaf809913b2983a400fce9d94 (patch) | |
tree | 72f3a17b75fedba3ae1060df1d32c9c7889be954 /plugins/org.eclipse.emf.cdo.net4j/src/org/eclipse/emf/cdo/internal/net4j/protocol | |
parent | 5f360965ae87478e0681899bf310a210cafc2c44 (diff) | |
download | cdo-1460904fd3c193ffaf809913b2983a400fce9d94.tar.gz cdo-1460904fd3c193ffaf809913b2983a400fce9d94.tar.xz cdo-1460904fd3c193ffaf809913b2983a400fce9d94.zip |
Fix line endings in master (dos2unix)
Diffstat (limited to 'plugins/org.eclipse.emf.cdo.net4j/src/org/eclipse/emf/cdo/internal/net4j/protocol')
57 files changed, 4763 insertions, 4763 deletions
diff --git a/plugins/org.eclipse.emf.cdo.net4j/src/org/eclipse/emf/cdo/internal/net4j/protocol/BranchNotificationIndication.java b/plugins/org.eclipse.emf.cdo.net4j/src/org/eclipse/emf/cdo/internal/net4j/protocol/BranchNotificationIndication.java index bda761a4c8..e8a5e70082 100644 --- a/plugins/org.eclipse.emf.cdo.net4j/src/org/eclipse/emf/cdo/internal/net4j/protocol/BranchNotificationIndication.java +++ b/plugins/org.eclipse.emf.cdo.net4j/src/org/eclipse/emf/cdo/internal/net4j/protocol/BranchNotificationIndication.java @@ -1,40 +1,40 @@ -/*
- * 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
- * Simon McDuff - bug 233490
- */
-package org.eclipse.emf.cdo.internal.net4j.protocol;
-
-import org.eclipse.emf.cdo.common.branch.CDOBranch;
-import org.eclipse.emf.cdo.common.protocol.CDODataInput;
-import org.eclipse.emf.cdo.common.protocol.CDOProtocolConstants;
-import org.eclipse.emf.cdo.spi.common.branch.InternalCDOBranch;
-import org.eclipse.emf.cdo.spi.common.branch.InternalCDOBranchManager;
-
-import java.io.IOException;
-
-/**
- * @author Eike Stepper
- */
-public class BranchNotificationIndication extends CDOClientIndication
-{
- public BranchNotificationIndication(CDOClientProtocol protocol)
- {
- super(protocol, CDOProtocolConstants.SIGNAL_BRANCH_NOTIFICATION);
- }
-
- @Override
- protected void indicating(CDODataInput in) throws IOException
- {
- CDOBranch branch = in.readCDOBranch();
-
- InternalCDOBranchManager branchManager = getSession().getBranchManager();
- branchManager.handleBranchCreated((InternalCDOBranch)branch);
- }
-}
+/* + * 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 + * Simon McDuff - bug 233490 + */ +package org.eclipse.emf.cdo.internal.net4j.protocol; + +import org.eclipse.emf.cdo.common.branch.CDOBranch; +import org.eclipse.emf.cdo.common.protocol.CDODataInput; +import org.eclipse.emf.cdo.common.protocol.CDOProtocolConstants; +import org.eclipse.emf.cdo.spi.common.branch.InternalCDOBranch; +import org.eclipse.emf.cdo.spi.common.branch.InternalCDOBranchManager; + +import java.io.IOException; + +/** + * @author Eike Stepper + */ +public class BranchNotificationIndication extends CDOClientIndication +{ + public BranchNotificationIndication(CDOClientProtocol protocol) + { + super(protocol, CDOProtocolConstants.SIGNAL_BRANCH_NOTIFICATION); + } + + @Override + protected void indicating(CDODataInput in) throws IOException + { + CDOBranch branch = in.readCDOBranch(); + + InternalCDOBranchManager branchManager = getSession().getBranchManager(); + branchManager.handleBranchCreated((InternalCDOBranch)branch); + } +} diff --git a/plugins/org.eclipse.emf.cdo.net4j/src/org/eclipse/emf/cdo/internal/net4j/protocol/CDOClientIndication.java b/plugins/org.eclipse.emf.cdo.net4j/src/org/eclipse/emf/cdo/internal/net4j/protocol/CDOClientIndication.java index 73146f26a1..b9098bf82c 100644 --- a/plugins/org.eclipse.emf.cdo.net4j/src/org/eclipse/emf/cdo/internal/net4j/protocol/CDOClientIndication.java +++ b/plugins/org.eclipse.emf.cdo.net4j/src/org/eclipse/emf/cdo/internal/net4j/protocol/CDOClientIndication.java @@ -1,103 +1,103 @@ -/*
- * 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
- * Simon McDuff - bug 233490
- */
-package org.eclipse.emf.cdo.internal.net4j.protocol;
-
-import org.eclipse.emf.cdo.common.branch.CDOBranchManager;
-import org.eclipse.emf.cdo.common.commit.CDOCommitInfoManager;
-import org.eclipse.emf.cdo.common.lob.CDOLobStore;
-import org.eclipse.emf.cdo.common.model.CDOPackageRegistry;
-import org.eclipse.emf.cdo.common.protocol.CDODataInput;
-import org.eclipse.emf.cdo.common.revision.CDOListFactory;
-import org.eclipse.emf.cdo.common.revision.CDORevisionFactory;
-import org.eclipse.emf.cdo.internal.common.protocol.CDODataInputImpl;
-import org.eclipse.emf.cdo.internal.common.revision.CDOListWithElementProxiesImpl;
-
-import org.eclipse.net4j.signal.Indication;
-import org.eclipse.net4j.util.io.ExtendedDataInputStream;
-import org.eclipse.net4j.util.io.StringIO;
-
-import org.eclipse.emf.spi.cdo.InternalCDOSession;
-
-import java.io.IOException;
-
-/**
- * @author Eike Stepper
- */
-public abstract class CDOClientIndication extends Indication
-{
- public CDOClientIndication(CDOClientProtocol protocol, short signalID)
- {
- super(protocol, signalID);
- }
-
- @Override
- public CDOClientProtocol getProtocol()
- {
- return (CDOClientProtocol)super.getProtocol();
- }
-
- protected InternalCDOSession getSession()
- {
- return (InternalCDOSession)getProtocol().getSession();
- }
-
- @Override
- protected final void indicating(ExtendedDataInputStream in) throws Exception
- {
- indicating(new CDODataInputImpl(in)
- {
- @Override
- protected StringIO getPackageURICompressor()
- {
- return getProtocol().getPackageURICompressor();
- }
-
- @Override
- protected CDOListFactory getListFactory()
- {
- return CDOListWithElementProxiesImpl.FACTORY;
- }
-
- @Override
- protected CDOPackageRegistry getPackageRegistry()
- {
- return getSession().getPackageRegistry();
- }
-
- @Override
- protected CDOBranchManager getBranchManager()
- {
- return getSession().getBranchManager();
- }
-
- @Override
- protected CDOCommitInfoManager getCommitInfoManager()
- {
- return getSession().getCommitInfoManager();
- }
-
- @Override
- protected CDORevisionFactory getRevisionFactory()
- {
- return getSession().getRevisionManager().getFactory();
- }
-
- @Override
- protected CDOLobStore getLobStore()
- {
- return getSession().getLobStore();
- }
- });
- }
-
- protected abstract void indicating(CDODataInput in) throws IOException;
-}
+/* + * 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 + * Simon McDuff - bug 233490 + */ +package org.eclipse.emf.cdo.internal.net4j.protocol; + +import org.eclipse.emf.cdo.common.branch.CDOBranchManager; +import org.eclipse.emf.cdo.common.commit.CDOCommitInfoManager; +import org.eclipse.emf.cdo.common.lob.CDOLobStore; +import org.eclipse.emf.cdo.common.model.CDOPackageRegistry; +import org.eclipse.emf.cdo.common.protocol.CDODataInput; +import org.eclipse.emf.cdo.common.revision.CDOListFactory; +import org.eclipse.emf.cdo.common.revision.CDORevisionFactory; +import org.eclipse.emf.cdo.internal.common.protocol.CDODataInputImpl; +import org.eclipse.emf.cdo.internal.common.revision.CDOListWithElementProxiesImpl; + +import org.eclipse.net4j.signal.Indication; +import org.eclipse.net4j.util.io.ExtendedDataInputStream; +import org.eclipse.net4j.util.io.StringIO; + +import org.eclipse.emf.spi.cdo.InternalCDOSession; + +import java.io.IOException; + +/** + * @author Eike Stepper + */ +public abstract class CDOClientIndication extends Indication +{ + public CDOClientIndication(CDOClientProtocol protocol, short signalID) + { + super(protocol, signalID); + } + + @Override + public CDOClientProtocol getProtocol() + { + return (CDOClientProtocol)super.getProtocol(); + } + + protected InternalCDOSession getSession() + { + return (InternalCDOSession)getProtocol().getSession(); + } + + @Override + protected final void indicating(ExtendedDataInputStream in) throws Exception + { + indicating(new CDODataInputImpl(in) + { + @Override + protected StringIO getPackageURICompressor() + { + return getProtocol().getPackageURICompressor(); + } + + @Override + protected CDOListFactory getListFactory() + { + return CDOListWithElementProxiesImpl.FACTORY; + } + + @Override + protected CDOPackageRegistry getPackageRegistry() + { + return getSession().getPackageRegistry(); + } + + @Override + protected CDOBranchManager getBranchManager() + { + return getSession().getBranchManager(); + } + + @Override + protected CDOCommitInfoManager getCommitInfoManager() + { + return getSession().getCommitInfoManager(); + } + + @Override + protected CDORevisionFactory getRevisionFactory() + { + return getSession().getRevisionManager().getFactory(); + } + + @Override + protected CDOLobStore getLobStore() + { + return getSession().getLobStore(); + } + }); + } + + protected abstract void indicating(CDODataInput in) throws IOException; +} diff --git a/plugins/org.eclipse.emf.cdo.net4j/src/org/eclipse/emf/cdo/internal/net4j/protocol/CDOClientProtocol.java b/plugins/org.eclipse.emf.cdo.net4j/src/org/eclipse/emf/cdo/internal/net4j/protocol/CDOClientProtocol.java index f0ab9f9f18..55ee5d22e3 100644 --- a/plugins/org.eclipse.emf.cdo.net4j/src/org/eclipse/emf/cdo/internal/net4j/protocol/CDOClientProtocol.java +++ b/plugins/org.eclipse.emf.cdo.net4j/src/org/eclipse/emf/cdo/internal/net4j/protocol/CDOClientProtocol.java @@ -1,551 +1,551 @@ -/*
- * 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.net4j.protocol;
-
-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.CDOProtocolConstants;
-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.TransportException;
-import org.eclipse.emf.cdo.internal.net4j.bundle.OM;
-import org.eclipse.emf.cdo.session.CDOSession;
-import org.eclipse.emf.cdo.session.remote.CDORemoteSession;
-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.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.RevisionInfo;
-import org.eclipse.emf.cdo.view.CDOView;
-
-import org.eclipse.net4j.signal.RemoteException;
-import org.eclipse.net4j.signal.RequestWithConfirmation;
-import org.eclipse.net4j.signal.RequestWithMonitoring;
-import org.eclipse.net4j.signal.SignalProtocol;
-import org.eclipse.net4j.signal.SignalReactor;
-import org.eclipse.net4j.util.WrappedException;
-import org.eclipse.net4j.util.collection.Pair;
-import org.eclipse.net4j.util.concurrent.IRWLockManager.LockType;
-import org.eclipse.net4j.util.io.StringCompressor;
-import org.eclipse.net4j.util.io.StringIO;
-import org.eclipse.net4j.util.om.monitor.OMMonitor;
-import org.eclipse.net4j.util.om.trace.PerfTracer;
-
-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.InternalCDOCommitContext;
-import org.eclipse.emf.spi.cdo.InternalCDOXATransaction.InternalCDOXACommitContext;
-
-import java.io.IOException;
-import java.util.Collection;
-import java.util.List;
-import java.util.Map;
-import java.util.Set;
-
-/**
- * @author Eike Stepper
- */
-public class CDOClientProtocol extends SignalProtocol<CDOSession> implements CDOSessionProtocol
-{
- private static final PerfTracer REVISION_LOADING = new PerfTracer(OM.PERF_REVISION_LOADING, CDOClientProtocol.class);
-
- private StringIO packageURICompressor = StringCompressor.BYPASS ? StringIO.DIRECT : new StringCompressor(true);
-
- public CDOClientProtocol()
- {
- super(CDOProtocolConstants.PROTOCOL_NAME);
- }
-
- public CDOSession getSession()
- {
- return getInfraStructure();
- }
-
- public StringIO getPackageURICompressor()
- {
- return packageURICompressor;
- }
-
- public OpenSessionResult openSession(String repositoryName, boolean passiveUpdateEnabled,
- PassiveUpdateMode passiveUpdateMode, LockNotificationMode lockNotificationMode)
- {
- return send(new OpenSessionRequest(this, repositoryName, passiveUpdateEnabled, passiveUpdateMode,
- lockNotificationMode));
- }
-
- public void disablePassiveUpdate()
- {
- send(new DisablePassiveUpdateRequest(this));
- }
-
- public void setPassiveUpdateMode(PassiveUpdateMode mode)
- {
- send(new SetPassiveUpdateModeRequest(this, mode));
- }
-
- public RepositoryTimeResult getRepositoryTime()
- {
- return send(new RepositoryTimeRequest(this));
- }
-
- public EPackage[] loadPackages(CDOPackageUnit packageUnit)
- {
- return send(new LoadPackagesRequest(this, (InternalCDOPackageUnit)packageUnit));
- }
-
- public Pair<Integer, Long> createBranch(int branchID, BranchInfo branchInfo)
- {
- return send(new CreateBranchRequest(this, branchID, branchInfo));
- }
-
- public BranchInfo loadBranch(int branchID)
- {
- return send(new LoadBranchRequest(this, branchID));
- }
-
- public SubBranchInfo[] loadSubBranches(int branchID)
- {
- return send(new LoadSubBranchesRequest(this, branchID));
- }
-
- public int loadBranches(int startID, int endID, CDOBranchHandler handler)
- {
- return send(new LoadBranchesRequest(this, startID, endID, handler));
- }
-
- public void loadCommitInfos(CDOBranch branch, long startTime, long endTime, CDOCommitInfoHandler handler)
- {
- send(new LoadCommitInfosRequest(this, branch, startTime, endTime, handler));
- }
-
- public CDOCommitData loadCommitData(long timeStamp)
- {
- return send(new LoadCommitDataRequest(this, timeStamp));
- }
-
- public Object loadChunk(InternalCDORevision revision, EStructuralFeature feature, int accessIndex, int fetchIndex,
- int fromIndex, int toIndex)
- {
- return send(new LoadChunkRequest(this, revision, feature, accessIndex, fetchIndex, fromIndex, toIndex));
- }
-
- public List<InternalCDORevision> loadRevisions(List<RevisionInfo> infos, CDOBranchPoint branchPoint,
- int referenceChunk, int prefetchDepth)
- {
- return send(new LoadRevisionsRequest(this, infos, branchPoint, referenceChunk, prefetchDepth));
- }
-
- public InternalCDORevision loadRevisionByVersion(CDOID id, CDOBranchVersion branchVersion, int referenceChunk)
- {
- return send(new LoadRevisionByVersionRequest(this, id, branchVersion, referenceChunk));
- }
-
- public RefreshSessionResult refresh(long lastUpdateTime,
- Map<CDOBranch, Map<CDOID, InternalCDORevision>> viewedRevisions, int initialChunkSize,
- boolean enablePassiveUpdates)
- {
- return send(new RefreshSessionRequest(this, lastUpdateTime, viewedRevisions, initialChunkSize, enablePassiveUpdates));
- }
-
- public void openView(int viewID, boolean readOnly, CDOBranchPoint branchPoint)
- {
- send(new OpenViewRequest(this, viewID, readOnly, branchPoint));
- }
-
- public CDOBranchPoint openView(int viewID, boolean readOnly, String durableLockingID)
- {
- return send(new OpenViewRequest(this, viewID, readOnly, durableLockingID));
- }
-
- public void switchTarget(int viewID, CDOBranchPoint branchPoint, List<InternalCDOObject> invalidObjects,
- List<CDORevisionKey> allChangedObjects, List<CDOIDAndVersion> allDetachedObjects, OMMonitor monitor)
- {
- send(new SwitchTargetRequest(this, viewID, branchPoint, invalidObjects, allChangedObjects, allDetachedObjects),
- monitor);
- }
-
- public void closeView(int viewID)
- {
- send(new CloseViewRequest(this, viewID));
- }
-
- public void changeSubscription(int viewID, List<CDOID> ids, boolean subscribeMode, boolean clear)
- {
- send(new ChangeSubscriptionRequest(this, viewID, ids, subscribeMode, clear));
- }
-
- public void query(CDOView view, AbstractQueryIterator<?> queryResult)
- {
- send(new QueryRequest(this, view, queryResult));
- }
-
- public boolean cancelQuery(int queryId)
- {
- try
- {
- return new QueryCancelRequest(this, queryId).send();
- }
- catch (Exception ignore)
- {
- return false;
- }
- }
-
- @Deprecated
- public LockObjectsResult lockObjects(List<InternalCDORevision> revisions, int viewID, CDOBranch viewedBranch,
- LockType lockType, long timeout) throws InterruptedException
- {
- // List<CDORevisionKey> revisionKeys = new LinkedList<CDORevisionKey>();
- // for (InternalCDORevision rev : revisions)
- // {
- // revisionKeys.add(rev);
- // }
- //
- // return lockObjects2(revisionKeys, viewID, viewedBranch, lockType, false, timeout);
-
- throw new UnsupportedOperationException();
- }
-
- public LockObjectsResult lockObjects2(List<CDORevisionKey> revisionKeys, int viewID, CDOBranch viewedBranch,
- LockType lockType, boolean recursive, long timeout) throws InterruptedException
- {
- InterruptedException interruptedException = null;
- RuntimeException runtimeException = null;
-
- try
- {
- return new LockObjectsRequest(this, revisionKeys, viewID, lockType, recursive, timeout).send();
- }
- catch (RemoteException ex)
- {
- if (ex.getCause() instanceof RuntimeException)
- {
- runtimeException = (RuntimeException)ex.getCause();
- }
- else if (ex.getCause() instanceof InterruptedException)
- {
- interruptedException = (InterruptedException)ex.getCause();
- }
- else
- {
- runtimeException = WrappedException.wrap(ex);
- }
- }
- catch (Exception ex)
- {
- throw WrappedException.wrap(ex);
- }
-
- if (interruptedException != null)
- {
- throw interruptedException;
- }
-
- throw runtimeException;
- }
-
- public LockObjectsResult delegateLockObjects(String lockAreaID, List<CDORevisionKey> revisionKeys,
- CDOBranch viewedBranch, LockType lockType, boolean recursive, long timeout) throws InterruptedException
- {
- InterruptedException interruptedException = null;
- RuntimeException runtimeException = null;
-
- try
- {
- return new LockDelegationRequest(this, lockAreaID, revisionKeys, viewedBranch, lockType, recursive, timeout)
- .send();
- }
- catch (RemoteException ex)
- {
- if (ex.getCause() instanceof RuntimeException)
- {
- runtimeException = (RuntimeException)ex.getCause();
- }
- else if (ex.getCause() instanceof InterruptedException)
- {
- interruptedException = (InterruptedException)ex.getCause();
- }
- else
- {
- runtimeException = WrappedException.wrap(ex);
- }
- }
- catch (Exception ex)
- {
- throw WrappedException.wrap(ex);
- }
-
- if (interruptedException != null)
- {
- throw interruptedException;
- }
-
- throw runtimeException;
- }
-
- @Deprecated
- public void unlockObjects(CDOView view, Collection<CDOID> objectIDs, LockType lockType)
- {
- // send(new UnlockObjectsRequest(this, view.getViewID(), objectIDs, lockType, false));
-
- throw new UnsupportedOperationException();
- }
-
- public UnlockObjectsResult unlockObjects2(CDOView view, Collection<CDOID> objectIDs, LockType lockType,
- boolean recursive)
- {
- return send(new UnlockObjectsRequest(this, view.getViewID(), objectIDs, lockType, recursive));
- }
-
- public UnlockObjectsResult delegateUnlockObjects(String lockAreaID, Collection<CDOID> objectIDs, LockType lockType,
- boolean recursive)
- {
- return send(new UnlockDelegationRequest(this, lockAreaID, objectIDs, lockType, recursive));
- }
-
- public boolean isObjectLocked(CDOView view, CDOObject object, LockType lockType, boolean byOthers)
- {
- return send(new ObjectLockedRequest(this, view, object, lockType, byOthers));
- }
-
- public String changeLockArea(CDOView view, boolean create)
- {
- return send(new LockAreaRequest(this, view, create));
- }
-
- public List<byte[]> queryLobs(Set<byte[]> ids)
- {
- return send(new QueryLobsRequest(this, ids));
- }
-
- public void loadLob(CDOLobInfo info, Object outputStreamOrWriter) throws IOException
- {
- try
- {
- new LoadLobRequest(this, info, outputStreamOrWriter).send();
- }
- catch (RuntimeException ex)
- {
- throw ex;
- }
- catch (IOException ex)
- {
- throw ex;
- }
- catch (Exception ex)
- {
- throw new TransportException(ex);
- }
- }
-
- public void handleRevisions(EClass eClass, CDOBranch branch, boolean exactBranch, long timeStamp, boolean exactTime,
- CDORevisionHandler handler)
- {
- send(new HandleRevisionsRequest(this, eClass, branch, exactBranch, timeStamp, exactTime, handler));
- }
-
- @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)
- {
- return send(new CommitTransactionRequest(this, context), monitor);
- }
-
- @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)
- {
- return send(new CommitDelegationRequest(this, context), monitor);
- }
-
- public CommitTransactionResult commitXATransactionPhase1(InternalCDOXACommitContext xaContext, OMMonitor monitor)
- {
- return send(new CommitXATransactionPhase1Request(this, xaContext), monitor);
- }
-
- public CommitTransactionResult commitXATransactionPhase2(InternalCDOXACommitContext xaContext, OMMonitor monitor)
- {
- return send(new CommitXATransactionPhase2Request(this, xaContext), monitor);
- }
-
- public CommitTransactionResult commitXATransactionPhase3(InternalCDOXACommitContext xaContext, OMMonitor monitor)
- {
- return send(new CommitXATransactionPhase3Request(this, xaContext), monitor);
- }
-
- public CommitTransactionResult commitXATransactionCancel(InternalCDOXACommitContext xaContext, OMMonitor monitor)
- {
- return send(new CommitXATransactionCancelRequest(this, xaContext), monitor);
- }
-
- public List<CDORemoteSession> getRemoteSessions(InternalCDORemoteSessionManager manager, boolean subscribe)
- {
- return send(new GetRemoteSessionsRequest(this, subscribe));
- }
-
- public Set<Integer> sendRemoteMessage(CDORemoteSessionMessage message, List<CDORemoteSession> recipients)
- {
- return send(new RemoteMessageRequest(this, message, recipients));
- }
-
- public boolean unsubscribeRemoteSessions()
- {
- return send(new UnsubscribeRemoteSessionsRequest(this));
- }
-
- public void replicateRepository(CDOReplicationContext context, OMMonitor monitor)
- {
- send(new ReplicateRepositoryRequest(this, context, monitor));
- }
-
- public void replicateRepositoryRaw(CDORawReplicationContext context, OMMonitor monitor)
- {
- send(new ReplicateRepositoryRawRequest(this, context), monitor);
- }
-
- public CDOChangeSetData[] loadChangeSets(CDOBranchPointRange... ranges)
- {
- return send(new LoadChangeSetsRequest(this, ranges));
- }
-
- public Set<CDOID> loadMergeData(CDORevisionAvailabilityInfo targetInfo, CDORevisionAvailabilityInfo sourceInfo,
- CDORevisionAvailabilityInfo targetBaseInfo, CDORevisionAvailabilityInfo sourceBaseInfo)
- {
- return send(new LoadMergeDataRequest(this, targetInfo, sourceInfo, targetBaseInfo, sourceBaseInfo));
- }
-
- @Override
- protected SignalReactor createSignalReactor(short signalID)
- {
- switch (signalID)
- {
- case CDOProtocolConstants.SIGNAL_AUTHENTICATION:
- return new AuthenticationIndication(this);
-
- case CDOProtocolConstants.SIGNAL_BRANCH_NOTIFICATION:
- return new BranchNotificationIndication(this);
-
- case CDOProtocolConstants.SIGNAL_REPOSITORY_TYPE_NOTIFICATION:
- return new RepositoryTypeNotificationIndication(this);
-
- case CDOProtocolConstants.SIGNAL_REPOSITORY_STATE_NOTIFICATION:
- return new RepositoryStateNotificationIndication(this);
-
- case CDOProtocolConstants.SIGNAL_COMMIT_NOTIFICATION:
- return new CommitNotificationIndication(this);
-
- case CDOProtocolConstants.SIGNAL_REMOTE_SESSION_NOTIFICATION:
- return new RemoteSessionNotificationIndication(this);
-
- case CDOProtocolConstants.SIGNAL_REMOTE_MESSAGE_NOTIFICATION:
- return new RemoteMessageNotificationIndication(this);
-
- case CDOProtocolConstants.SIGNAL_LOCK_NOTIFICATION:
- return new LockNotificationIndication(this);
-
- default:
- return super.createSignalReactor(signalID);
- }
- }
-
- private <RESULT> RESULT send(RequestWithConfirmation<RESULT> request)
- {
- try
- {
- return request.send();
- }
- catch (RuntimeException ex)
- {
- throw ex;
- }
- catch (Exception ex)
- {
- throw new TransportException(ex);
- }
- }
-
- private <RESULT> RESULT send(RequestWithMonitoring<RESULT> request, OMMonitor monitor)
- {
- try
- {
- return request.send(monitor);
- }
- catch (RuntimeException ex)
- {
- throw ex;
- }
- catch (Exception ex)
- {
- throw new TransportException(ex);
- }
- }
-
- private List<InternalCDORevision> send(LoadRevisionsRequest request)
- {
- try
- {
- REVISION_LOADING.start(request);
- return send((RequestWithConfirmation<List<InternalCDORevision>>)request);
- }
- finally
- {
- REVISION_LOADING.stop(request);
- }
- }
-
- public CDOLockState[] getLockStates(int viewID, Collection<CDOID> ids)
- {
- return send(new LockStateRequest(this, viewID, ids));
- }
-
- public void enableLockNotifications(int viewID, boolean on)
- {
- send(new EnableLockNotificationRequest(this, viewID, on));
- }
-
- public void setLockNotificationMode(LockNotificationMode mode)
- {
- send(new SetLockNotificationModeRequest(this, mode));
- }
-}
+/* + * 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.net4j.protocol; + +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.CDOProtocolConstants; +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.TransportException; +import org.eclipse.emf.cdo.internal.net4j.bundle.OM; +import org.eclipse.emf.cdo.session.CDOSession; +import org.eclipse.emf.cdo.session.remote.CDORemoteSession; +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.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.RevisionInfo; +import org.eclipse.emf.cdo.view.CDOView; + +import org.eclipse.net4j.signal.RemoteException; +import org.eclipse.net4j.signal.RequestWithConfirmation; +import org.eclipse.net4j.signal.RequestWithMonitoring; +import org.eclipse.net4j.signal.SignalProtocol; +import org.eclipse.net4j.signal.SignalReactor; +import org.eclipse.net4j.util.WrappedException; +import org.eclipse.net4j.util.collection.Pair; +import org.eclipse.net4j.util.concurrent.IRWLockManager.LockType; +import org.eclipse.net4j.util.io.StringCompressor; +import org.eclipse.net4j.util.io.StringIO; +import org.eclipse.net4j.util.om.monitor.OMMonitor; +import org.eclipse.net4j.util.om.trace.PerfTracer; + +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.InternalCDOCommitContext; +import org.eclipse.emf.spi.cdo.InternalCDOXATransaction.InternalCDOXACommitContext; + +import java.io.IOException; +import java.util.Collection; +import java.util.List; +import java.util.Map; +import java.util.Set; + +/** + * @author Eike Stepper + */ +public class CDOClientProtocol extends SignalProtocol<CDOSession> implements CDOSessionProtocol +{ + private static final PerfTracer REVISION_LOADING = new PerfTracer(OM.PERF_REVISION_LOADING, CDOClientProtocol.class); + + private StringIO packageURICompressor = StringCompressor.BYPASS ? StringIO.DIRECT : new StringCompressor(true); + + public CDOClientProtocol() + { + super(CDOProtocolConstants.PROTOCOL_NAME); + } + + public CDOSession getSession() + { + return getInfraStructure(); + } + + public StringIO getPackageURICompressor() + { + return packageURICompressor; + } + + public OpenSessionResult openSession(String repositoryName, boolean passiveUpdateEnabled, + PassiveUpdateMode passiveUpdateMode, LockNotificationMode lockNotificationMode) + { + return send(new OpenSessionRequest(this, repositoryName, passiveUpdateEnabled, passiveUpdateMode, + lockNotificationMode)); + } + + public void disablePassiveUpdate() + { + send(new DisablePassiveUpdateRequest(this)); + } + + public void setPassiveUpdateMode(PassiveUpdateMode mode) + { + send(new SetPassiveUpdateModeRequest(this, mode)); + } + + public RepositoryTimeResult getRepositoryTime() + { + return send(new RepositoryTimeRequest(this)); + } + + public EPackage[] loadPackages(CDOPackageUnit packageUnit) + { + return send(new LoadPackagesRequest(this, (InternalCDOPackageUnit)packageUnit)); + } + + public Pair<Integer, Long> createBranch(int branchID, BranchInfo branchInfo) + { + return send(new CreateBranchRequest(this, branchID, branchInfo)); + } + + public BranchInfo loadBranch(int branchID) + { + return send(new LoadBranchRequest(this, branchID)); + } + + public SubBranchInfo[] loadSubBranches(int branchID) + { + return send(new LoadSubBranchesRequest(this, branchID)); + } + + public int loadBranches(int startID, int endID, CDOBranchHandler handler) + { + return send(new LoadBranchesRequest(this, startID, endID, handler)); + } + + public void loadCommitInfos(CDOBranch branch, long startTime, long endTime, CDOCommitInfoHandler handler) + { + send(new LoadCommitInfosRequest(this, branch, startTime, endTime, handler)); + } + + public CDOCommitData loadCommitData(long timeStamp) + { + return send(new LoadCommitDataRequest(this, timeStamp)); + } + + public Object loadChunk(InternalCDORevision revision, EStructuralFeature feature, int accessIndex, int fetchIndex, + int fromIndex, int toIndex) + { + return send(new LoadChunkRequest(this, revision, feature, accessIndex, fetchIndex, fromIndex, toIndex)); + } + + public List<InternalCDORevision> loadRevisions(List<RevisionInfo> infos, CDOBranchPoint branchPoint, + int referenceChunk, int prefetchDepth) + { + return send(new LoadRevisionsRequest(this, infos, branchPoint, referenceChunk, prefetchDepth)); + } + + public InternalCDORevision loadRevisionByVersion(CDOID id, CDOBranchVersion branchVersion, int referenceChunk) + { + return send(new LoadRevisionByVersionRequest(this, id, branchVersion, referenceChunk)); + } + + public RefreshSessionResult refresh(long lastUpdateTime, + Map<CDOBranch, Map<CDOID, InternalCDORevision>> viewedRevisions, int initialChunkSize, + boolean enablePassiveUpdates) + { + return send(new RefreshSessionRequest(this, lastUpdateTime, viewedRevisions, initialChunkSize, enablePassiveUpdates)); + } + + public void openView(int viewID, boolean readOnly, CDOBranchPoint branchPoint) + { + send(new OpenViewRequest(this, viewID, readOnly, branchPoint)); + } + + public CDOBranchPoint openView(int viewID, boolean readOnly, String durableLockingID) + { + return send(new OpenViewRequest(this, viewID, readOnly, durableLockingID)); + } + + public void switchTarget(int viewID, CDOBranchPoint branchPoint, List<InternalCDOObject> invalidObjects, + List<CDORevisionKey> allChangedObjects, List<CDOIDAndVersion> allDetachedObjects, OMMonitor monitor) + { + send(new SwitchTargetRequest(this, viewID, branchPoint, invalidObjects, allChangedObjects, allDetachedObjects), + monitor); + } + + public void closeView(int viewID) + { + send(new CloseViewRequest(this, viewID)); + } + + public void changeSubscription(int viewID, List<CDOID> ids, boolean subscribeMode, boolean clear) + { + send(new ChangeSubscriptionRequest(this, viewID, ids, subscribeMode, clear)); + } + + public void query(CDOView view, AbstractQueryIterator<?> queryResult) + { + send(new QueryRequest(this, view, queryResult)); + } + + public boolean cancelQuery(int queryId) + { + try + { + return new QueryCancelRequest(this, queryId).send(); + } + catch (Exception ignore) + { + return false; + } + } + + @Deprecated + public LockObjectsResult lockObjects(List<InternalCDORevision> revisions, int viewID, CDOBranch viewedBranch, + LockType lockType, long timeout) throws InterruptedException + { + // List<CDORevisionKey> revisionKeys = new LinkedList<CDORevisionKey>(); + // for (InternalCDORevision rev : revisions) + // { + // revisionKeys.add(rev); + // } + // + // return lockObjects2(revisionKeys, viewID, viewedBranch, lockType, false, timeout); + + throw new UnsupportedOperationException(); + } + + public LockObjectsResult lockObjects2(List<CDORevisionKey> revisionKeys, int viewID, CDOBranch viewedBranch, + LockType lockType, boolean recursive, long timeout) throws InterruptedException + { + InterruptedException interruptedException = null; + RuntimeException runtimeException = null; + + try + { + return new LockObjectsRequest(this, revisionKeys, viewID, lockType, recursive, timeout).send(); + } + catch (RemoteException ex) + { + if (ex.getCause() instanceof RuntimeException) + { + runtimeException = (RuntimeException)ex.getCause(); + } + else if (ex.getCause() instanceof InterruptedException) + { + interruptedException = (InterruptedException)ex.getCause(); + } + else + { + runtimeException = WrappedException.wrap(ex); + } + } + catch (Exception ex) + { + throw WrappedException.wrap(ex); + } + + if (interruptedException != null) + { + throw interruptedException; + } + + throw runtimeException; + } + + public LockObjectsResult delegateLockObjects(String lockAreaID, List<CDORevisionKey> revisionKeys, + CDOBranch viewedBranch, LockType lockType, boolean recursive, long timeout) throws InterruptedException + { + InterruptedException interruptedException = null; + RuntimeException runtimeException = null; + + try + { + return new LockDelegationRequest(this, lockAreaID, revisionKeys, viewedBranch, lockType, recursive, timeout) + .send(); + } + catch (RemoteException ex) + { + if (ex.getCause() instanceof RuntimeException) + { + runtimeException = (RuntimeException)ex.getCause(); + } + else if (ex.getCause() instanceof InterruptedException) + { + interruptedException = (InterruptedException)ex.getCause(); + } + else + { + runtimeException = WrappedException.wrap(ex); + } + } + catch (Exception ex) + { + throw WrappedException.wrap(ex); + } + + if (interruptedException != null) + { + throw interruptedException; + } + + throw runtimeException; + } + + @Deprecated + public void unlockObjects(CDOView view, Collection<CDOID> objectIDs, LockType lockType) + { + // send(new UnlockObjectsRequest(this, view.getViewID(), objectIDs, lockType, false)); + + throw new UnsupportedOperationException(); + } + + public UnlockObjectsResult unlockObjects2(CDOView view, Collection<CDOID> objectIDs, LockType lockType, + boolean recursive) + { + return send(new UnlockObjectsRequest(this, view.getViewID(), objectIDs, lockType, recursive)); + } + + public UnlockObjectsResult delegateUnlockObjects(String lockAreaID, Collection<CDOID> objectIDs, LockType lockType, + boolean recursive) + { + return send(new UnlockDelegationRequest(this, lockAreaID, objectIDs, lockType, recursive)); + } + + public boolean isObjectLocked(CDOView view, CDOObject object, LockType lockType, boolean byOthers) + { + return send(new ObjectLockedRequest(this, view, object, lockType, byOthers)); + } + + public String changeLockArea(CDOView view, boolean create) + { + return send(new LockAreaRequest(this, view, create)); + } + + public List<byte[]> queryLobs(Set<byte[]> ids) + { + return send(new QueryLobsRequest(this, ids)); + } + + public void loadLob(CDOLobInfo info, Object outputStreamOrWriter) throws IOException + { + try + { + new LoadLobRequest(this, info, outputStreamOrWriter).send(); + } + catch (RuntimeException ex) + { + throw ex; + } + catch (IOException ex) + { + throw ex; + } + catch (Exception ex) + { + throw new TransportException(ex); + } + } + + public void handleRevisions(EClass eClass, CDOBranch branch, boolean exactBranch, long timeStamp, boolean exactTime, + CDORevisionHandler handler) + { + send(new HandleRevisionsRequest(this, eClass, branch, exactBranch, timeStamp, exactTime, handler)); + } + + @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) + { + return send(new CommitTransactionRequest(this, context), monitor); + } + + @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) + { + return send(new CommitDelegationRequest(this, context), monitor); + } + + public CommitTransactionResult commitXATransactionPhase1(InternalCDOXACommitContext xaContext, OMMonitor monitor) + { + return send(new CommitXATransactionPhase1Request(this, xaContext), monitor); + } + + public CommitTransactionResult commitXATransactionPhase2(InternalCDOXACommitContext xaContext, OMMonitor monitor) + { + return send(new CommitXATransactionPhase2Request(this, xaContext), monitor); + } + + public CommitTransactionResult commitXATransactionPhase3(InternalCDOXACommitContext xaContext, OMMonitor monitor) + { + return send(new CommitXATransactionPhase3Request(this, xaContext), monitor); + } + + public CommitTransactionResult commitXATransactionCancel(InternalCDOXACommitContext xaContext, OMMonitor monitor) + { + return send(new CommitXATransactionCancelRequest(this, xaContext), monitor); + } + + public List<CDORemoteSession> getRemoteSessions(InternalCDORemoteSessionManager manager, boolean subscribe) + { + return send(new GetRemoteSessionsRequest(this, subscribe)); + } + + public Set<Integer> sendRemoteMessage(CDORemoteSessionMessage message, List<CDORemoteSession> recipients) + { + return send(new RemoteMessageRequest(this, message, recipients)); + } + + public boolean unsubscribeRemoteSessions() + { + return send(new UnsubscribeRemoteSessionsRequest(this)); + } + + public void replicateRepository(CDOReplicationContext context, OMMonitor monitor) + { + send(new ReplicateRepositoryRequest(this, context, monitor)); + } + + public void replicateRepositoryRaw(CDORawReplicationContext context, OMMonitor monitor) + { + send(new ReplicateRepositoryRawRequest(this, context), monitor); + } + + public CDOChangeSetData[] loadChangeSets(CDOBranchPointRange... ranges) + { + return send(new LoadChangeSetsRequest(this, ranges)); + } + + public Set<CDOID> loadMergeData(CDORevisionAvailabilityInfo targetInfo, CDORevisionAvailabilityInfo sourceInfo, + CDORevisionAvailabilityInfo targetBaseInfo, CDORevisionAvailabilityInfo sourceBaseInfo) + { + return send(new LoadMergeDataRequest(this, targetInfo, sourceInfo, targetBaseInfo, sourceBaseInfo)); + } + + @Override + protected SignalReactor createSignalReactor(short signalID) + { + switch (signalID) + { + case CDOProtocolConstants.SIGNAL_AUTHENTICATION: + return new AuthenticationIndication(this); + + case CDOProtocolConstants.SIGNAL_BRANCH_NOTIFICATION: + return new BranchNotificationIndication(this); + + case CDOProtocolConstants.SIGNAL_REPOSITORY_TYPE_NOTIFICATION: + return new RepositoryTypeNotificationIndication(this); + + case CDOProtocolConstants.SIGNAL_REPOSITORY_STATE_NOTIFICATION: + return new RepositoryStateNotificationIndication(this); + + case CDOProtocolConstants.SIGNAL_COMMIT_NOTIFICATION: + return new CommitNotificationIndication(this); + + case CDOProtocolConstants.SIGNAL_REMOTE_SESSION_NOTIFICATION: + return new RemoteSessionNotificationIndication(this); + + case CDOProtocolConstants.SIGNAL_REMOTE_MESSAGE_NOTIFICATION: + return new RemoteMessageNotificationIndication(this); + + case CDOProtocolConstants.SIGNAL_LOCK_NOTIFICATION: + return new LockNotificationIndication(this); + + default: + return super.createSignalReactor(signalID); + } + } + + private <RESULT> RESULT send(RequestWithConfirmation<RESULT> request) + { + try + { + return request.send(); + } + catch (RuntimeException ex) + { + throw ex; + } + catch (Exception ex) + { + throw new TransportException(ex); + } + } + + private <RESULT> RESULT send(RequestWithMonitoring<RESULT> request, OMMonitor monitor) + { + try + { + return request.send(monitor); + } + catch (RuntimeException ex) + { + throw ex; + } + catch (Exception ex) + { + throw new TransportException(ex); + } + } + + private List<InternalCDORevision> send(LoadRevisionsRequest request) + { + try + { + REVISION_LOADING.start(request); + return send((RequestWithConfirmation<List<InternalCDORevision>>)request); + } + finally + { + REVISION_LOADING.stop(request); + } + } + + public CDOLockState[] getLockStates(int viewID, Collection<CDOID> ids) + { + return send(new LockStateRequest(this, viewID, ids)); + } + + public void enableLockNotifications(int viewID, boolean on) + { + send(new EnableLockNotificationRequest(this, viewID, on)); + } + + public void setLockNotificationMode(LockNotificationMode mode) + { + send(new SetLockNotificationModeRequest(this, mode)); + } +} diff --git a/plugins/org.eclipse.emf.cdo.net4j/src/org/eclipse/emf/cdo/internal/net4j/protocol/CDOClientProtocolFactory.java b/plugins/org.eclipse.emf.cdo.net4j/src/org/eclipse/emf/cdo/internal/net4j/protocol/CDOClientProtocolFactory.java index 166ffff2e4..fe6c88fa3d 100644 --- a/plugins/org.eclipse.emf.cdo.net4j/src/org/eclipse/emf/cdo/internal/net4j/protocol/CDOClientProtocolFactory.java +++ b/plugins/org.eclipse.emf.cdo.net4j/src/org/eclipse/emf/cdo/internal/net4j/protocol/CDOClientProtocolFactory.java @@ -1,40 +1,40 @@ -/*
- * 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.net4j.protocol;
-
-import org.eclipse.emf.cdo.common.protocol.CDOProtocolConstants;
-
-import org.eclipse.net4j.util.container.IManagedContainer;
-
-import org.eclipse.spi.net4j.ClientProtocolFactory;
-
-/**
- * @author Eike Stepper
- */
-public final class CDOClientProtocolFactory extends ClientProtocolFactory
-{
- public static final String TYPE = CDOProtocolConstants.PROTOCOL_NAME;
-
- public CDOClientProtocolFactory()
- {
- super(TYPE);
- }
-
- public CDOClientProtocol create(String description)
- {
- return new CDOClientProtocol();
- }
-
- public static CDOClientProtocol get(IManagedContainer container, String description)
- {
- return (CDOClientProtocol)container.getElement(PRODUCT_GROUP, TYPE, description);
- }
-}
+/* + * 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.net4j.protocol; + +import org.eclipse.emf.cdo.common.protocol.CDOProtocolConstants; + +import org.eclipse.net4j.util.container.IManagedContainer; + +import org.eclipse.spi.net4j.ClientProtocolFactory; + +/** + * @author Eike Stepper + */ +public final class CDOClientProtocolFactory extends ClientProtocolFactory +{ + public static final String TYPE = CDOProtocolConstants.PROTOCOL_NAME; + + public CDOClientProtocolFactory() + { + super(TYPE); + } + + public CDOClientProtocol create(String description) + { + return new CDOClientProtocol(); + } + + public static CDOClientProtocol get(IManagedContainer container, String description) + { + return (CDOClientProtocol)container.getElement(PRODUCT_GROUP, TYPE, description); + } +} diff --git a/plugins/org.eclipse.emf.cdo.net4j/src/org/eclipse/emf/cdo/internal/net4j/protocol/CDOClientRequest.java b/plugins/org.eclipse.emf.cdo.net4j/src/org/eclipse/emf/cdo/internal/net4j/protocol/CDOClientRequest.java index e9ce6c2b5d..b3e3e69447 100644 --- a/plugins/org.eclipse.emf.cdo.net4j/src/org/eclipse/emf/cdo/internal/net4j/protocol/CDOClientRequest.java +++ b/plugins/org.eclipse.emf.cdo.net4j/src/org/eclipse/emf/cdo/internal/net4j/protocol/CDOClientRequest.java @@ -1,139 +1,139 @@ -/*
- * 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
- * Simon McDuff - maintenance
- */
-package org.eclipse.emf.cdo.internal.net4j.protocol;
-
-import org.eclipse.emf.cdo.common.branch.CDOBranchManager;
-import org.eclipse.emf.cdo.common.commit.CDOCommitInfoManager;
-import org.eclipse.emf.cdo.common.id.CDOIDProvider;
-import org.eclipse.emf.cdo.common.lob.CDOLobStore;
-import org.eclipse.emf.cdo.common.model.CDOPackageRegistry;
-import org.eclipse.emf.cdo.common.protocol.CDODataInput;
-import org.eclipse.emf.cdo.common.protocol.CDODataOutput;
-import org.eclipse.emf.cdo.common.revision.CDOListFactory;
-import org.eclipse.emf.cdo.common.revision.CDORevisionFactory;
-import org.eclipse.emf.cdo.internal.common.protocol.CDODataInputImpl;
-import org.eclipse.emf.cdo.internal.common.protocol.CDODataOutputImpl;
-import org.eclipse.emf.cdo.internal.common.revision.CDOListWithElementProxiesImpl;
-
-import org.eclipse.net4j.signal.RequestWithConfirmation;
-import org.eclipse.net4j.util.io.ExtendedDataInputStream;
-import org.eclipse.net4j.util.io.ExtendedDataOutputStream;
-import org.eclipse.net4j.util.io.StringIO;
-
-import org.eclipse.emf.spi.cdo.InternalCDOSession;
-
-import java.io.IOException;
-
-/**
- * @author Eike Stepper
- */
-public abstract class CDOClientRequest<RESULT> extends RequestWithConfirmation<RESULT>
-{
- public CDOClientRequest(CDOClientProtocol protocol, short signalID)
- {
- super(protocol, signalID);
- }
-
- @Override
- public CDOClientProtocol getProtocol()
- {
- return (CDOClientProtocol)super.getProtocol();
- }
-
- protected InternalCDOSession getSession()
- {
- return (InternalCDOSession)getProtocol().getSession();
- }
-
- protected CDOIDProvider getIDProvider()
- {
- throw new UnsupportedOperationException();
- }
-
- @Override
- protected void requesting(ExtendedDataOutputStream out) throws Exception
- {
- requesting(new CDODataOutputImpl(out)
- {
- @Override
- public CDOPackageRegistry getPackageRegistry()
- {
- return getSession().getPackageRegistry();
- }
-
- @Override
- public CDOIDProvider getIDProvider()
- {
- return CDOClientRequest.this.getIDProvider();
- }
-
- @Override
- protected StringIO getPackageURICompressor()
- {
- return getProtocol().getPackageURICompressor();
- }
- });
- }
-
- @Override
- protected RESULT confirming(ExtendedDataInputStream in) throws Exception
- {
- return confirming(new CDODataInputImpl(in)
- {
- @Override
- protected CDOPackageRegistry getPackageRegistry()
- {
- return getSession().getPackageRegistry();
- }
-
- @Override
- protected StringIO getPackageURICompressor()
- {
- return getProtocol().getPackageURICompressor();
- }
-
- @Override
- protected CDOBranchManager getBranchManager()
- {
- return getSession().getBranchManager();
- }
-
- @Override
- protected CDOCommitInfoManager getCommitInfoManager()
- {
- return getSession().getCommitInfoManager();
- }
-
- @Override
- protected CDORevisionFactory getRevisionFactory()
- {
- return getSession().getRevisionManager().getFactory();
- }
-
- @Override
- protected CDOLobStore getLobStore()
- {
- return getSession().getLobStore();
- }
-
- @Override
- protected CDOListFactory getListFactory()
- {
- return CDOListWithElementProxiesImpl.FACTORY;
- }
- });
- }
-
- protected abstract void requesting(CDODataOutput out) throws IOException;
-
- protected abstract RESULT confirming(CDODataInput in) throws IOException;
-}
+/* + * 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 + * Simon McDuff - maintenance + */ +package org.eclipse.emf.cdo.internal.net4j.protocol; + +import org.eclipse.emf.cdo.common.branch.CDOBranchManager; +import org.eclipse.emf.cdo.common.commit.CDOCommitInfoManager; +import org.eclipse.emf.cdo.common.id.CDOIDProvider; +import org.eclipse.emf.cdo.common.lob.CDOLobStore; +import org.eclipse.emf.cdo.common.model.CDOPackageRegistry; +import org.eclipse.emf.cdo.common.protocol.CDODataInput; +import org.eclipse.emf.cdo.common.protocol.CDODataOutput; +import org.eclipse.emf.cdo.common.revision.CDOListFactory; +import org.eclipse.emf.cdo.common.revision.CDORevisionFactory; +import org.eclipse.emf.cdo.internal.common.protocol.CDODataInputImpl; +import org.eclipse.emf.cdo.internal.common.protocol.CDODataOutputImpl; +import org.eclipse.emf.cdo.internal.common.revision.CDOListWithElementProxiesImpl; + +import org.eclipse.net4j.signal.RequestWithConfirmation; +import org.eclipse.net4j.util.io.ExtendedDataInputStream; +import org.eclipse.net4j.util.io.ExtendedDataOutputStream; +import org.eclipse.net4j.util.io.StringIO; + +import org.eclipse.emf.spi.cdo.InternalCDOSession; + +import java.io.IOException; + +/** + * @author Eike Stepper + */ +public abstract class CDOClientRequest<RESULT> extends RequestWithConfirmation<RESULT> +{ + public CDOClientRequest(CDOClientProtocol protocol, short signalID) + { + super(protocol, signalID); + } + + @Override + public CDOClientProtocol getProtocol() + { + return (CDOClientProtocol)super.getProtocol(); + } + + protected InternalCDOSession getSession() + { + return (InternalCDOSession)getProtocol().getSession(); + } + + protected CDOIDProvider getIDProvider() + { + throw new UnsupportedOperationException(); + } + + @Override + protected void requesting(ExtendedDataOutputStream out) throws Exception + { + requesting(new CDODataOutputImpl(out) + { + @Override + public CDOPackageRegistry getPackageRegistry() + { + return getSession().getPackageRegistry(); + } + + @Override + public CDOIDProvider getIDProvider() + { + return CDOClientRequest.this.getIDProvider(); + } + + @Override + protected StringIO getPackageURICompressor() + { + return getProtocol().getPackageURICompressor(); + } + }); + } + + @Override + protected RESULT confirming(ExtendedDataInputStream in) throws Exception + { + return confirming(new CDODataInputImpl(in) + { + @Override + protected CDOPackageRegistry getPackageRegistry() + { + return getSession().getPackageRegistry(); + } + + @Override + protected StringIO getPackageURICompressor() + { + return getProtocol().getPackageURICompressor(); + } + + @Override + protected CDOBranchManager getBranchManager() + { + return getSession().getBranchManager(); + } + + @Override + protected CDOCommitInfoManager getCommitInfoManager() + { + return getSession().getCommitInfoManager(); + } + + @Override + protected CDORevisionFactory getRevisionFactory() + { + return getSession().getRevisionManager().getFactory(); + } + + @Override + protected CDOLobStore getLobStore() + { + return getSession().getLobStore(); + } + + @Override + protected CDOListFactory getListFactory() + { + return CDOListWithElementProxiesImpl.FACTORY; + } + }); + } + + protected abstract void requesting(CDODataOutput out) throws IOException; + + protected abstract RESULT confirming(CDODataInput in) throws IOException; +} diff --git a/plugins/org.eclipse.emf.cdo.net4j/src/org/eclipse/emf/cdo/internal/net4j/protocol/CDOClientRequestWithMonitoring.java b/plugins/org.eclipse.emf.cdo.net4j/src/org/eclipse/emf/cdo/internal/net4j/protocol/CDOClientRequestWithMonitoring.java index a63e337ab9..7676875b90 100644 --- a/plugins/org.eclipse.emf.cdo.net4j/src/org/eclipse/emf/cdo/internal/net4j/protocol/CDOClientRequestWithMonitoring.java +++ b/plugins/org.eclipse.emf.cdo.net4j/src/org/eclipse/emf/cdo/internal/net4j/protocol/CDOClientRequestWithMonitoring.java @@ -1,166 +1,166 @@ -/*
- * 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
- * Simon McDuff - bug 201266
- * Simon McDuff - bug 215688
- * Simon McDuff - bug 213402
- * Andre Dietisheim - bug 256649
- */
-package org.eclipse.emf.cdo.internal.net4j.protocol;
-
-import org.eclipse.emf.cdo.common.branch.CDOBranchManager;
-import org.eclipse.emf.cdo.common.commit.CDOCommitInfoManager;
-import org.eclipse.emf.cdo.common.id.CDOIDProvider;
-import org.eclipse.emf.cdo.common.lob.CDOLobStore;
-import org.eclipse.emf.cdo.common.model.CDOPackageRegistry;
-import org.eclipse.emf.cdo.common.protocol.CDODataInput;
-import org.eclipse.emf.cdo.common.protocol.CDODataOutput;
-import org.eclipse.emf.cdo.common.revision.CDOListFactory;
-import org.eclipse.emf.cdo.common.revision.CDORevisionFactory;
-import org.eclipse.emf.cdo.internal.common.protocol.CDODataInputImpl;
-import org.eclipse.emf.cdo.internal.common.protocol.CDODataOutputImpl;
-import org.eclipse.emf.cdo.internal.common.revision.CDOListWithElementProxiesImpl;
-
-import org.eclipse.net4j.signal.RequestWithMonitoring;
-import org.eclipse.net4j.util.io.ExtendedDataInputStream;
-import org.eclipse.net4j.util.io.ExtendedDataOutputStream;
-import org.eclipse.net4j.util.io.StringIO;
-import org.eclipse.net4j.util.om.monitor.OMMonitor;
-
-import org.eclipse.emf.spi.cdo.InternalCDOSession;
-
-import java.io.IOException;
-
-/**
- * @author Eike Stepper
- */
-public abstract class CDOClientRequestWithMonitoring<RESULT> extends RequestWithMonitoring<RESULT>
-{
- private ExtendedDataOutputStream requestStream;
-
- private ExtendedDataInputStream confirmationStream;
-
- public CDOClientRequestWithMonitoring(CDOClientProtocol protocol, short signalID)
- {
- super(protocol, signalID);
- }
-
- @Override
- public CDOClientProtocol getProtocol()
- {
- return (CDOClientProtocol)super.getProtocol();
- }
-
- protected ExtendedDataOutputStream getRequestStream()
- {
- return requestStream;
- }
-
- protected ExtendedDataInputStream getConfirmationStream()
- {
- return confirmationStream;
- }
-
- protected InternalCDOSession getSession()
- {
- return (InternalCDOSession)getProtocol().getSession();
- }
-
- protected CDOIDProvider getIDProvider()
- {
- return null;
- }
-
- @Override
- protected int getMonitorProgressSeconds()
- {
- org.eclipse.emf.cdo.net4j.CDONet4jSession session = (org.eclipse.emf.cdo.net4j.CDONet4jSession)getSession();
- return session.options().getProgressInterval();
- }
-
- @Override
- protected final void requesting(ExtendedDataOutputStream out, OMMonitor monitor) throws Exception
- {
- requestStream = out;
- requesting(new CDODataOutputImpl(out)
- {
- @Override
- public CDOPackageRegistry getPackageRegistry()
- {
- return getSession().getPackageRegistry();
- }
-
- @Override
- public CDOIDProvider getIDProvider()
- {
- return CDOClientRequestWithMonitoring.this.getIDProvider();
- }
-
- @Override
- protected StringIO getPackageURICompressor()
- {
- return getProtocol().getPackageURICompressor();
- }
- }, monitor);
- }
-
- @Override
- protected final RESULT confirming(ExtendedDataInputStream in, OMMonitor monitor) throws Exception
- {
- confirmationStream = in;
- return confirming(new CDODataInputImpl(in)
- {
- @Override
- protected StringIO getPackageURICompressor()
- {
- return getProtocol().getPackageURICompressor();
- }
-
- @Override
- protected CDOPackageRegistry getPackageRegistry()
- {
- return getSession().getPackageRegistry();
- }
-
- @Override
- protected CDOBranchManager getBranchManager()
- {
- return getSession().getBranchManager();
- }
-
- @Override
- protected CDOCommitInfoManager getCommitInfoManager()
- {
- return getSession().getCommitInfoManager();
- }
-
- @Override
- protected CDORevisionFactory getRevisionFactory()
- {
- return getSession().getRevisionManager().getFactory();
- }
-
- @Override
- protected CDOLobStore getLobStore()
- {
- return getSession().getLobStore();
- }
-
- @Override
- protected CDOListFactory getListFactory()
- {
- return CDOListWithElementProxiesImpl.FACTORY;
- }
- }, monitor);
- }
-
- protected abstract void requesting(CDODataOutput out, OMMonitor monitor) throws IOException;
-
- protected abstract RESULT confirming(CDODataInput in, OMMonitor monitor) throws IOException;
-}
+/* + * 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 + * Simon McDuff - bug 201266 + * Simon McDuff - bug 215688 + * Simon McDuff - bug 213402 + * Andre Dietisheim - bug 256649 + */ +package org.eclipse.emf.cdo.internal.net4j.protocol; + +import org.eclipse.emf.cdo.common.branch.CDOBranchManager; +import org.eclipse.emf.cdo.common.commit.CDOCommitInfoManager; +import org.eclipse.emf.cdo.common.id.CDOIDProvider; +import org.eclipse.emf.cdo.common.lob.CDOLobStore; +import org.eclipse.emf.cdo.common.model.CDOPackageRegistry; +import org.eclipse.emf.cdo.common.protocol.CDODataInput; +import org.eclipse.emf.cdo.common.protocol.CDODataOutput; +import org.eclipse.emf.cdo.common.revision.CDOListFactory; +import org.eclipse.emf.cdo.common.revision.CDORevisionFactory; +import org.eclipse.emf.cdo.internal.common.protocol.CDODataInputImpl; +import org.eclipse.emf.cdo.internal.common.protocol.CDODataOutputImpl; +import org.eclipse.emf.cdo.internal.common.revision.CDOListWithElementProxiesImpl; + +import org.eclipse.net4j.signal.RequestWithMonitoring; +import org.eclipse.net4j.util.io.ExtendedDataInputStream; +import org.eclipse.net4j.util.io.ExtendedDataOutputStream; +import org.eclipse.net4j.util.io.StringIO; +import org.eclipse.net4j.util.om.monitor.OMMonitor; + +import org.eclipse.emf.spi.cdo.InternalCDOSession; + +import java.io.IOException; + +/** + * @author Eike Stepper + */ +public abstract class CDOClientRequestWithMonitoring<RESULT> extends RequestWithMonitoring<RESULT> +{ + private ExtendedDataOutputStream requestStream; + + private ExtendedDataInputStream confirmationStream; + + public CDOClientRequestWithMonitoring(CDOClientProtocol protocol, short signalID) + { + super(protocol, signalID); + } + + @Override + public CDOClientProtocol getProtocol() + { + return (CDOClientProtocol)super.getProtocol(); + } + + protected ExtendedDataOutputStream getRequestStream() + { + return requestStream; + } + + protected ExtendedDataInputStream getConfirmationStream() + { + return confirmationStream; + } + + protected InternalCDOSession getSession() + { + return (InternalCDOSession)getProtocol().getSession(); + } + + protected CDOIDProvider getIDProvider() + { + return null; + } + + @Override + protected int getMonitorProgressSeconds() + { + org.eclipse.emf.cdo.net4j.CDONet4jSession session = (org.eclipse.emf.cdo.net4j.CDONet4jSession)getSession(); + return session.options().getProgressInterval(); + } + + @Override + protected final void requesting(ExtendedDataOutputStream out, OMMonitor monitor) throws Exception + { + requestStream = out; + requesting(new CDODataOutputImpl(out) + { + @Override + public CDOPackageRegistry getPackageRegistry() + { + return getSession().getPackageRegistry(); + } + + @Override + public CDOIDProvider getIDProvider() + { + return CDOClientRequestWithMonitoring.this.getIDProvider(); + } + + @Override + protected StringIO getPackageURICompressor() + { + return getProtocol().getPackageURICompressor(); + } + }, monitor); + } + + @Override + protected final RESULT confirming(ExtendedDataInputStream in, OMMonitor monitor) throws Exception + { + confirmationStream = in; + return confirming(new CDODataInputImpl(in) + { + @Override + protected StringIO getPackageURICompressor() + { + return getProtocol().getPackageURICompressor(); + } + + @Override + protected CDOPackageRegistry getPackageRegistry() + { + return getSession().getPackageRegistry(); + } + + @Override + protected CDOBranchManager getBranchManager() + { + return getSession().getBranchManager(); + } + + @Override + protected CDOCommitInfoManager getCommitInfoManager() + { + return getSession().getCommitInfoManager(); + } + + @Override + protected CDORevisionFactory getRevisionFactory() + { + return getSession().getRevisionManager().getFactory(); + } + + @Override + protected CDOLobStore getLobStore() + { + return getSession().getLobStore(); + } + + @Override + protected CDOListFactory getListFactory() + { + return CDOListWithElementProxiesImpl.FACTORY; + } + }, monitor); + } + + protected abstract void requesting(CDODataOutput out, OMMonitor monitor) throws IOException; + + protected abstract RESULT confirming(CDODataInput in, OMMonitor monitor) throws IOException; +} diff --git a/plugins/org.eclipse.emf.cdo.net4j/src/org/eclipse/emf/cdo/internal/net4j/protocol/CDOTimeRequest.java b/plugins/org.eclipse.emf.cdo.net4j/src/org/eclipse/emf/cdo/internal/net4j/protocol/CDOTimeRequest.java index 0c7ad1da01..58c06800d2 100644 --- a/plugins/org.eclipse.emf.cdo.net4j/src/org/eclipse/emf/cdo/internal/net4j/protocol/CDOTimeRequest.java +++ b/plugins/org.eclipse.emf.cdo.net4j/src/org/eclipse/emf/cdo/internal/net4j/protocol/CDOTimeRequest.java @@ -1,76 +1,76 @@ -/*
- * 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.net4j.protocol;
-
-import org.eclipse.emf.cdo.common.protocol.CDODataInput;
-import org.eclipse.emf.cdo.common.protocol.CDODataOutput;
-import org.eclipse.emf.cdo.common.util.CDOCommonUtil;
-import org.eclipse.emf.cdo.internal.net4j.bundle.OM;
-
-import org.eclipse.net4j.util.om.trace.ContextTracer;
-
-import org.eclipse.emf.spi.cdo.CDOSessionProtocol.RepositoryTimeResult;
-
-import java.io.IOException;
-
-/**
- * @author Eike Stepper
- */
-public abstract class CDOTimeRequest<RESULT> extends CDOClientRequest<RESULT>
-{
- private static final ContextTracer TRACER = new ContextTracer(OM.DEBUG_PROTOCOL, CDOTimeRequest.class);
-
- private RepositoryTimeResult repositoryTimeResult = new RepositoryTimeResult();
-
- public CDOTimeRequest(CDOClientProtocol protocol, short signalID)
- {
- super(protocol, signalID);
- }
-
- public RepositoryTimeResult getRepositoryTimeResult()
- {
- return repositoryTimeResult;
- }
-
- @Override
- protected void requesting(CDODataOutput out) throws IOException
- {
- repositoryTimeResult.setRequested(System.currentTimeMillis());
- if (TRACER.isEnabled())
- {
- TRACER.format("Requested: {0}", CDOCommonUtil.formatTimeStamp(repositoryTimeResult.getRequested())); //$NON-NLS-1$
- }
- }
-
- @Override
- protected RESULT confirming(CDODataInput in) throws IOException
- {
- repositoryTimeResult.setConfirmed(System.currentTimeMillis());
- if (TRACER.isEnabled())
- {
- TRACER.format("Confirmed: {0}", CDOCommonUtil.formatTimeStamp(repositoryTimeResult.getConfirmed())); //$NON-NLS-1$
- }
-
- repositoryTimeResult.setIndicated(in.readLong());
- if (TRACER.isEnabled())
- {
- TRACER.format("Read indicated: {0}", CDOCommonUtil.formatTimeStamp(repositoryTimeResult.getIndicated())); //$NON-NLS-1$
- }
-
- repositoryTimeResult.setResponded(in.readLong());
- if (TRACER.isEnabled())
- {
- TRACER.format("Read responded: {0}", CDOCommonUtil.formatTimeStamp(repositoryTimeResult.getResponded())); //$NON-NLS-1$
- }
-
- return 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 + */ +package org.eclipse.emf.cdo.internal.net4j.protocol; + +import org.eclipse.emf.cdo.common.protocol.CDODataInput; +import org.eclipse.emf.cdo.common.protocol.CDODataOutput; +import org.eclipse.emf.cdo.common.util.CDOCommonUtil; +import org.eclipse.emf.cdo.internal.net4j.bundle.OM; + +import org.eclipse.net4j.util.om.trace.ContextTracer; + +import org.eclipse.emf.spi.cdo.CDOSessionProtocol.RepositoryTimeResult; + +import java.io.IOException; + +/** + * @author Eike Stepper + */ +public abstract class CDOTimeRequest<RESULT> extends CDOClientRequest<RESULT> +{ + private static final ContextTracer TRACER = new ContextTracer(OM.DEBUG_PROTOCOL, CDOTimeRequest.class); + + private RepositoryTimeResult repositoryTimeResult = new RepositoryTimeResult(); + + public CDOTimeRequest(CDOClientProtocol protocol, short signalID) + { + super(protocol, signalID); + } + + public RepositoryTimeResult getRepositoryTimeResult() + { + return repositoryTimeResult; + } + + @Override + protected void requesting(CDODataOutput out) throws IOException + { + repositoryTimeResult.setRequested(System.currentTimeMillis()); + if (TRACER.isEnabled()) + { + TRACER.format("Requested: {0}", CDOCommonUtil.formatTimeStamp(repositoryTimeResult.getRequested())); //$NON-NLS-1$ + } + } + + @Override + protected RESULT confirming(CDODataInput in) throws IOException + { + repositoryTimeResult.setConfirmed(System.currentTimeMillis()); + if (TRACER.isEnabled()) + { + TRACER.format("Confirmed: {0}", CDOCommonUtil.formatTimeStamp(repositoryTimeResult.getConfirmed())); //$NON-NLS-1$ + } + + repositoryTimeResult.setIndicated(in.readLong()); + if (TRACER.isEnabled()) + { + TRACER.format("Read indicated: {0}", CDOCommonUtil.formatTimeStamp(repositoryTimeResult.getIndicated())); //$NON-NLS-1$ + } + + repositoryTimeResult.setResponded(in.readLong()); + if (TRACER.isEnabled()) + { + TRACER.format("Read responded: {0}", CDOCommonUtil.formatTimeStamp(repositoryTimeResult.getResponded())); //$NON-NLS-1$ + } + + return null; + } +} diff --git a/plugins/org.eclipse.emf.cdo.net4j/src/org/eclipse/emf/cdo/internal/net4j/protocol/ChangeSubscriptionRequest.java b/plugins/org.eclipse.emf.cdo.net4j/src/org/eclipse/emf/cdo/internal/net4j/protocol/ChangeSubscriptionRequest.java index d10d68dfc9..d0f2fe1605 100644 --- a/plugins/org.eclipse.emf.cdo.net4j/src/org/eclipse/emf/cdo/internal/net4j/protocol/ChangeSubscriptionRequest.java +++ b/plugins/org.eclipse.emf.cdo.net4j/src/org/eclipse/emf/cdo/internal/net4j/protocol/ChangeSubscriptionRequest.java @@ -1,77 +1,77 @@ -/*
- * 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:
- * Simon McDuff - initial API and implementation
- * Simon McDuff - bug 230832
- * Eike Stepper - maintenance
- */
-package org.eclipse.emf.cdo.internal.net4j.protocol;
-
-import org.eclipse.emf.cdo.common.id.CDOID;
-import org.eclipse.emf.cdo.common.protocol.CDODataInput;
-import org.eclipse.emf.cdo.common.protocol.CDODataOutput;
-import org.eclipse.emf.cdo.common.protocol.CDOProtocolConstants;
-import org.eclipse.emf.cdo.internal.net4j.bundle.OM;
-
-import org.eclipse.net4j.util.om.trace.ContextTracer;
-
-import java.io.IOException;
-import java.util.List;
-
-/**
- * @author Simon McDuff
- */
-public class ChangeSubscriptionRequest extends CDOClientRequest<Boolean>
-{
- private static final ContextTracer TRACER = new ContextTracer(OM.DEBUG_PROTOCOL, ChangeSubscriptionRequest.class);
-
- private int viewID;
-
- private List<CDOID> ids;
-
- /**
- * true - it will subscribe id's. <br>
- * false - it will unsubscribe id's.
- */
- private boolean subscribeMode;
-
- private boolean clear;
-
- public ChangeSubscriptionRequest(CDOClientProtocol protocol, int viewID, List<CDOID> ids, boolean subscribeMode,
- boolean clear)
- {
- super(protocol, CDOProtocolConstants.SIGNAL_CHANGE_SUBSCRIPTION);
- this.viewID = viewID;
- this.ids = ids;
- this.subscribeMode = subscribeMode;
- this.clear = clear;
- }
-
- @Override
- protected void requesting(CDODataOutput out) throws IOException
- {
- if (TRACER.isEnabled())
- {
- TRACER.trace("View " + viewID + " subscribing to " + ids.size()); //$NON-NLS-1$ //$NON-NLS-2$
- }
-
- out.writeInt(viewID);
- out.writeBoolean(clear);
- out.writeInt(subscribeMode ? ids.size() : -ids.size());
- for (CDOID id : ids)
- {
- out.writeCDOID(id);
- }
- }
-
- @Override
- protected Boolean confirming(CDODataInput in) throws IOException
- {
- return in.readBoolean();
- }
-}
+/* + * 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: + * Simon McDuff - initial API and implementation + * Simon McDuff - bug 230832 + * Eike Stepper - maintenance + */ +package org.eclipse.emf.cdo.internal.net4j.protocol; + +import org.eclipse.emf.cdo.common.id.CDOID; +import org.eclipse.emf.cdo.common.protocol.CDODataInput; +import org.eclipse.emf.cdo.common.protocol.CDODataOutput; +import org.eclipse.emf.cdo.common.protocol.CDOProtocolConstants; +import org.eclipse.emf.cdo.internal.net4j.bundle.OM; + +import org.eclipse.net4j.util.om.trace.ContextTracer; + +import java.io.IOException; +import java.util.List; + +/** + * @author Simon McDuff + */ +public class ChangeSubscriptionRequest extends CDOClientRequest<Boolean> +{ + private static final ContextTracer TRACER = new ContextTracer(OM.DEBUG_PROTOCOL, ChangeSubscriptionRequest.class); + + private int viewID; + + private List<CDOID> ids; + + /** + * true - it will subscribe id's. <br> + * false - it will unsubscribe id's. + */ + private boolean subscribeMode; + + private boolean clear; + + public ChangeSubscriptionRequest(CDOClientProtocol protocol, int viewID, List<CDOID> ids, boolean subscribeMode, + boolean clear) + { + super(protocol, CDOProtocolConstants.SIGNAL_CHANGE_SUBSCRIPTION); + this.viewID = viewID; + this.ids = ids; + this.subscribeMode = subscribeMode; + this.clear = clear; + } + + @Override + protected void requesting(CDODataOutput out) throws IOException + { + if (TRACER.isEnabled()) + { + TRACER.trace("View " + viewID + " subscribing to " + ids.size()); //$NON-NLS-1$ //$NON-NLS-2$ + } + + out.writeInt(viewID); + out.writeBoolean(clear); + out.writeInt(subscribeMode ? ids.size() : -ids.size()); + for (CDOID id : ids) + { + out.writeCDOID(id); + } + } + + @Override + protected Boolean confirming(CDODataInput in) throws IOException + { + return in.readBoolean(); + } +} diff --git a/plugins/org.eclipse.emf.cdo.net4j/src/org/eclipse/emf/cdo/internal/net4j/protocol/CloseViewRequest.java b/plugins/org.eclipse.emf.cdo.net4j/src/org/eclipse/emf/cdo/internal/net4j/protocol/CloseViewRequest.java index 3d0dafd84f..948754df29 100644 --- a/plugins/org.eclipse.emf.cdo.net4j/src/org/eclipse/emf/cdo/internal/net4j/protocol/CloseViewRequest.java +++ b/plugins/org.eclipse.emf.cdo.net4j/src/org/eclipse/emf/cdo/internal/net4j/protocol/CloseViewRequest.java @@ -1,43 +1,43 @@ -/*
- * 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.net4j.protocol;
-
-import org.eclipse.emf.cdo.common.protocol.CDODataInput;
-import org.eclipse.emf.cdo.common.protocol.CDODataOutput;
-import org.eclipse.emf.cdo.common.protocol.CDOProtocolConstants;
-
-import java.io.IOException;
-
-/**
- * @author Eike Stepper
- */
-public class CloseViewRequest extends CDOClientRequest<Boolean>
-{
- private int viewID;
-
- public CloseViewRequest(CDOClientProtocol protocol, int viewID)
- {
- super(protocol, CDOProtocolConstants.SIGNAL_CLOSE_VIEW);
- this.viewID = viewID;
- }
-
- @Override
- protected void requesting(CDODataOutput out) throws IOException
- {
- out.writeInt(viewID);
- }
-
- @Override
- protected Boolean confirming(CDODataInput in) throws IOException
- {
- return in.readBoolean();
- }
-}
+/* + * 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.net4j.protocol; + +import org.eclipse.emf.cdo.common.protocol.CDODataInput; +import org.eclipse.emf.cdo.common.protocol.CDODataOutput; +import org.eclipse.emf.cdo.common.protocol.CDOProtocolConstants; + +import java.io.IOException; + +/** + * @author Eike Stepper + */ +public class CloseViewRequest extends CDOClientRequest<Boolean> +{ + private int viewID; + + public CloseViewRequest(CDOClientProtocol protocol, int viewID) + { + super(protocol, CDOProtocolConstants.SIGNAL_CLOSE_VIEW); + this.viewID = viewID; + } + + @Override + protected void requesting(CDODataOutput out) throws IOException + { + out.writeInt(viewID); + } + + @Override + protected Boolean confirming(CDODataInput in) throws IOException + { + return in.readBoolean(); + } +} diff --git a/plugins/org.eclipse.emf.cdo.net4j/src/org/eclipse/emf/cdo/internal/net4j/protocol/CommitDelegationRequest.java b/plugins/org.eclipse.emf.cdo.net4j/src/org/eclipse/emf/cdo/internal/net4j/protocol/CommitDelegationRequest.java index 0edd51e88d..035c8bbc99 100644 --- a/plugins/org.eclipse.emf.cdo.net4j/src/org/eclipse/emf/cdo/internal/net4j/protocol/CommitDelegationRequest.java +++ b/plugins/org.eclipse.emf.cdo.net4j/src/org/eclipse/emf/cdo/internal/net4j/protocol/CommitDelegationRequest.java @@ -1,73 +1,73 @@ -/*
- * 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.net4j.protocol;
-
-import org.eclipse.emf.cdo.common.branch.CDOBranch;
-import org.eclipse.emf.cdo.common.id.CDOID;
-import org.eclipse.emf.cdo.common.id.CDOIDProvider;
-import org.eclipse.emf.cdo.common.protocol.CDODataOutput;
-import org.eclipse.emf.cdo.common.protocol.CDOProtocolConstants;
-
-import org.eclipse.emf.ecore.EClass;
-import org.eclipse.emf.spi.cdo.InternalCDOTransaction.InternalCDOCommitContext;
-
-import java.io.IOException;
-
-/**
- * @author Eike Stepper
- */
-public class CommitDelegationRequest extends CommitTransactionRequest
-{
- private CDOBranch branch;
-
- private String userID;
-
- private static final DelegationIDProvider delegationIDProvider = new DelegationIDProvider();
-
- public CommitDelegationRequest(CDOClientProtocol protocol, InternalCDOCommitContext context)
- {
- super(protocol, CDOProtocolConstants.SIGNAL_COMMIT_DELEGATION, context);
-
- branch = context.getBranch();
- userID = context.getUserID();
- }
-
- @Override
- protected void requestingTransactionInfo(CDODataOutput out) throws IOException
- {
- out.writeCDOBranch(branch);
- out.writeString(userID);
- }
-
- @Override
- protected EClass getObjectType(CDOID id)
- {
- // The types of detached objects are delivered through the wire and don't need to be queried locally.
- throw new UnsupportedOperationException();
- }
-
- @Override
- protected CDOIDProvider getIDProvider()
- {
- return delegationIDProvider;
- }
-
- /**
- * @author Eike Stepper
- */
- private static class DelegationIDProvider implements CDOIDProvider
- {
- public CDOID provideCDOID(Object idOrObject)
- {
- return (CDOID)idOrObject;
- }
- }
-}
+/* + * 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.net4j.protocol; + +import org.eclipse.emf.cdo.common.branch.CDOBranch; +import org.eclipse.emf.cdo.common.id.CDOID; +import org.eclipse.emf.cdo.common.id.CDOIDProvider; +import org.eclipse.emf.cdo.common.protocol.CDODataOutput; +import org.eclipse.emf.cdo.common.protocol.CDOProtocolConstants; + +import org.eclipse.emf.ecore.EClass; +import org.eclipse.emf.spi.cdo.InternalCDOTransaction.InternalCDOCommitContext; + +import java.io.IOException; + +/** + * @author Eike Stepper + */ +public class CommitDelegationRequest extends CommitTransactionRequest +{ + private CDOBranch branch; + + private String userID; + + private static final DelegationIDProvider delegationIDProvider = new DelegationIDProvider(); + + public CommitDelegationRequest(CDOClientProtocol protocol, InternalCDOCommitContext context) + { + super(protocol, CDOProtocolConstants.SIGNAL_COMMIT_DELEGATION, context); + + branch = context.getBranch(); + userID = context.getUserID(); + } + + @Override + protected void requestingTransactionInfo(CDODataOutput out) throws IOException + { + out.writeCDOBranch(branch); + out.writeString(userID); + } + + @Override + protected EClass getObjectType(CDOID id) + { + // The types of detached objects are delivered through the wire and don't need to be queried locally. + throw new UnsupportedOperationException(); + } + + @Override + protected CDOIDProvider getIDProvider() + { + return delegationIDProvider; + } + + /** + * @author Eike Stepper + */ + private static class DelegationIDProvider implements CDOIDProvider + { + public CDOID provideCDOID(Object idOrObject) + { + return (CDOID)idOrObject; + } + } +} diff --git a/plugins/org.eclipse.emf.cdo.net4j/src/org/eclipse/emf/cdo/internal/net4j/protocol/CommitNotificationIndication.java b/plugins/org.eclipse.emf.cdo.net4j/src/org/eclipse/emf/cdo/internal/net4j/protocol/CommitNotificationIndication.java index e281b4600b..77588ac82f 100644 --- a/plugins/org.eclipse.emf.cdo.net4j/src/org/eclipse/emf/cdo/internal/net4j/protocol/CommitNotificationIndication.java +++ b/plugins/org.eclipse.emf.cdo.net4j/src/org/eclipse/emf/cdo/internal/net4j/protocol/CommitNotificationIndication.java @@ -1,39 +1,39 @@ -/*
- * 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
- * Simon McDuff - bug 233490
- */
-package org.eclipse.emf.cdo.internal.net4j.protocol;
-
-import org.eclipse.emf.cdo.common.commit.CDOCommitInfo;
-import org.eclipse.emf.cdo.common.protocol.CDODataInput;
-import org.eclipse.emf.cdo.common.protocol.CDOProtocolConstants;
-
-import org.eclipse.emf.spi.cdo.InternalCDOSession;
-
-import java.io.IOException;
-
-/**
- * @author Eike Stepper
- */
-public class CommitNotificationIndication extends CDOClientIndication
-{
- public CommitNotificationIndication(CDOClientProtocol protocol)
- {
- super(protocol, CDOProtocolConstants.SIGNAL_COMMIT_NOTIFICATION);
- }
-
- @Override
- protected void indicating(CDODataInput in) throws IOException
- {
- InternalCDOSession session = getSession();
- CDOCommitInfo commitInfo = in.readCDOCommitInfo();
- session.handleCommitNotification(commitInfo);
- }
-}
+/* + * 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 + * Simon McDuff - bug 233490 + */ +package org.eclipse.emf.cdo.internal.net4j.protocol; + +import org.eclipse.emf.cdo.common.commit.CDOCommitInfo; +import org.eclipse.emf.cdo.common.protocol.CDODataInput; +import org.eclipse.emf.cdo.common.protocol.CDOProtocolConstants; + +import org.eclipse.emf.spi.cdo.InternalCDOSession; + +import java.io.IOException; + +/** + * @author Eike Stepper + */ +public class CommitNotificationIndication extends CDOClientIndication +{ + public CommitNotificationIndication(CDOClientProtocol protocol) + { + super(protocol, CDOProtocolConstants.SIGNAL_COMMIT_NOTIFICATION); + } + + @Override + protected void indicating(CDODataInput in) throws IOException + { + InternalCDOSession session = getSession(); + CDOCommitInfo commitInfo = in.readCDOCommitInfo(); + session.handleCommitNotification(commitInfo); + } +} diff --git a/plugins/org.eclipse.emf.cdo.net4j/src/org/eclipse/emf/cdo/internal/net4j/protocol/CommitTransactionRequest.java b/plugins/org.eclipse.emf.cdo.net4j/src/org/eclipse/emf/cdo/internal/net4j/protocol/CommitTransactionRequest.java index 60ccc656dd..4a54858412 100644 --- a/plugins/org.eclipse.emf.cdo.net4j/src/org/eclipse/emf/cdo/internal/net4j/protocol/CommitTransactionRequest.java +++ b/plugins/org.eclipse.emf.cdo.net4j/src/org/eclipse/emf/cdo/internal/net4j/protocol/CommitTransactionRequest.java @@ -1,323 +1,323 @@ -/*
- * 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
- * Simon McDuff - bug 201266
- * Simon McDuff - bug 215688
- * Simon McDuff - bug 213402
- * Andre Dietisheim - bug 256649
- */
-package org.eclipse.emf.cdo.internal.net4j.protocol;
-
-import org.eclipse.emf.cdo.CDOObject;
-import org.eclipse.emf.cdo.CDOObjectReference;
-import org.eclipse.emf.cdo.common.branch.CDOBranchPoint;
-import org.eclipse.emf.cdo.common.commit.CDOCommitData;
-import org.eclipse.emf.cdo.common.id.CDOID;
-import org.eclipse.emf.cdo.common.id.CDOIDProvider;
-import org.eclipse.emf.cdo.common.id.CDOIDReference;
-import org.eclipse.emf.cdo.common.id.CDOIDTemp;
-import org.eclipse.emf.cdo.common.id.CDOIDUtil;
-import org.eclipse.emf.cdo.common.lob.CDOBlob;
-import org.eclipse.emf.cdo.common.lob.CDOClob;
-import org.eclipse.emf.cdo.common.lob.CDOLob;
-import org.eclipse.emf.cdo.common.lock.CDOLockState;
-import org.eclipse.emf.cdo.common.model.CDOPackageUnit;
-import org.eclipse.emf.cdo.common.protocol.CDODataInput;
-import org.eclipse.emf.cdo.common.protocol.CDODataOutput;
-import org.eclipse.emf.cdo.common.protocol.CDOProtocolConstants;
-import org.eclipse.emf.cdo.common.revision.CDOIDAndVersion;
-import org.eclipse.emf.cdo.common.revision.CDORevision;
-import org.eclipse.emf.cdo.common.revision.CDORevisionKey;
-import org.eclipse.emf.cdo.common.revision.delta.CDORevisionDelta;
-import org.eclipse.emf.cdo.internal.net4j.bundle.OM;
-import org.eclipse.emf.cdo.transaction.CDOTransaction;
-
-import org.eclipse.emf.internal.cdo.object.CDOObjectReferenceImpl;
-
-import org.eclipse.net4j.util.concurrent.ConcurrencyUtil;
-import org.eclipse.net4j.util.io.ExtendedDataOutputStream;
-import org.eclipse.net4j.util.io.IOUtil;
-import org.eclipse.net4j.util.om.monitor.OMMonitor;
-import org.eclipse.net4j.util.om.trace.ContextTracer;
-
-import org.eclipse.emf.ecore.EClass;
-import org.eclipse.emf.spi.cdo.CDOSessionProtocol.CommitTransactionResult;
-import org.eclipse.emf.spi.cdo.InternalCDOTransaction.InternalCDOCommitContext;
-
-import java.io.IOException;
-import java.io.OutputStreamWriter;
-import java.util.ArrayList;
-import java.util.Collection;
-import java.util.List;
-
-/**
- * @author Eike Stepper
- */
-public class CommitTransactionRequest extends CDOClientRequestWithMonitoring<CommitTransactionResult>
-{
- private static final ContextTracer TRACER = new ContextTracer(OM.DEBUG_PROTOCOL, CommitTransactionRequest.class);
-
- private static long sleepMillisForTesting = 0L;
-
- private CDOIDProvider idProvider; // CDOTransaction
-
- private String comment;
-
- private boolean releaseLocks;
-
- private CDOCommitData commitData;
-
- private Collection<CDOLob<?>> lobs;
-
- private Collection<CDOLockState> locksOnNewObjects;
-
- private int viewID;
-
- private CDOTransaction transaction;
-
- public CommitTransactionRequest(CDOClientProtocol protocol, InternalCDOCommitContext context)
- {
- this(protocol, CDOProtocolConstants.SIGNAL_COMMIT_TRANSACTION, context);
- }
-
- public CommitTransactionRequest(CDOClientProtocol protocol, short signalID, InternalCDOCommitContext context)
- {
- super(protocol, signalID);
-
- transaction = context.getTransaction();
- comment = context.getCommitComment();
- releaseLocks = context.isAutoReleaseLocks();
- idProvider = context.getTransaction();
- commitData = context.getCommitData();
- lobs = context.getLobs();
- locksOnNewObjects = context.getLocksOnNewObjects();
- viewID = context.getViewID();
- }
-
- @Override
- protected int getMonitorTimeoutSeconds()
- {
- org.eclipse.emf.cdo.net4j.CDONet4jSession session = (org.eclipse.emf.cdo.net4j.CDONet4jSession)getSession();
- return session.options().getCommitTimeout();
- }
-
- @Override
- protected CDOIDProvider getIDProvider()
- {
- return idProvider;
- }
-
- @Override
- protected void requesting(CDODataOutput out, OMMonitor monitor) throws IOException
- {
- requestingTransactionInfo(out);
- requestingCommit(out);
- }
-
- protected void requestingTransactionInfo(CDODataOutput out) throws IOException
- {
- out.writeInt(viewID);
- }
-
- protected void requestingCommit(CDODataOutput out) throws IOException
- {
- List<CDOPackageUnit> newPackageUnits = commitData.getNewPackageUnits();
- List<CDOIDAndVersion> newObjects = commitData.getNewObjects();
- List<CDORevisionKey> changedObjects = commitData.getChangedObjects();
- List<CDOIDAndVersion> detachedObjects = commitData.getDetachedObjects();
-
- out.writeBoolean(releaseLocks);
- out.writeString(comment);
- out.writeInt(newPackageUnits.size());
- out.writeInt(locksOnNewObjects.size());
- out.writeInt(newObjects.size());
- out.writeInt(changedObjects.size());
- out.writeInt(detachedObjects.size());
-
- if (TRACER.isEnabled())
- {
- TRACER.format("Writing {0} new package units", newPackageUnits.size()); //$NON-NLS-1$
- }
-
- for (CDOPackageUnit newPackageUnit : newPackageUnits)
- {
- out.writeCDOPackageUnit(newPackageUnit, true);
- }
-
- if (TRACER.isEnabled())
- {
- TRACER.format("Writing {0} locks on new objects", locksOnNewObjects.size()); //$NON-NLS-1$
- }
-
- for (CDOLockState lockState : locksOnNewObjects)
- {
- out.writeCDOLockState(lockState);
- }
-
- if (TRACER.isEnabled())
- {
- TRACER.format("Writing {0} new objects", newObjects.size()); //$NON-NLS-1$
- }
-
- for (CDOIDAndVersion newObject : newObjects)
- {
- out.writeCDORevision((CDORevision)newObject, CDORevision.UNCHUNKED);
-
- if (sleepMillisForTesting != 0L)
- {
- ConcurrencyUtil.sleep(sleepMillisForTesting);
- }
- }
-
- if (TRACER.isEnabled())
- {
- TRACER.format("Writing {0} dirty objects", changedObjects.size()); //$NON-NLS-1$
- }
-
- for (CDORevisionKey changedObject : changedObjects)
- {
- out.writeCDORevisionDelta((CDORevisionDelta)changedObject);
- }
-
- if (TRACER.isEnabled())
- {
- TRACER.format("Writing {0} detached objects", detachedObjects.size()); //$NON-NLS-1$
- }
-
- boolean ensuringReferentialIntegrity = getSession().getRepositoryInfo().isEnsuringReferentialIntegrity();
- for (CDOIDAndVersion detachedObject : detachedObjects)
- {
- CDOID id = detachedObject.getID();
- out.writeCDOID(id);
- if (ensuringReferentialIntegrity)
- {
- EClass eClass = getObjectType(id);
- out.writeCDOClassifierRef(eClass);
- }
- }
-
- requestingLobs();
- }
-
- protected void requestingLobs() throws IOException
- {
- ExtendedDataOutputStream out = getRequestStream();
- out.writeInt(lobs.size());
- for (CDOLob<?> lob : lobs)
- {
- out.writeByteArray(lob.getID());
- long size = lob.getSize();
- if (lob instanceof CDOBlob)
- {
- CDOBlob blob = (CDOBlob)lob;
- out.writeLong(size);
- IOUtil.copyBinary(blob.getContents(), out, size);
- }
- else
- {
- CDOClob clob = (CDOClob)lob;
- out.writeLong(-size);
- IOUtil.copyCharacter(clob.getContents(), new OutputStreamWriter(out), size);
- }
- }
- }
-
- protected EClass getObjectType(CDOID id)
- {
- CDOObject object = transaction.getObject(id);
- return object.eClass();
- }
-
- @Override
- protected CommitTransactionResult confirming(CDODataInput in, OMMonitor monitor) throws IOException
- {
- CommitTransactionResult result = confirmingCheckError(in);
- if (result != null)
- {
- return result;
- }
-
- result = confirmingResult(in);
- confirmingMappingNewObjects(in, result);
- confirmingNewLockStates(in, result);
- return result;
- }
-
- protected CommitTransactionResult confirmingCheckError(CDODataInput in) throws IOException
- {
- boolean success = in.readBoolean();
- if (!success)
- {
- String rollbackMessage = in.readString();
- OM.LOG.error(rollbackMessage);
-
- CDOBranchPoint branchPoint = in.readCDOBranchPoint();
- long previousTimeStamp = in.readLong();
-
- List<CDOObjectReference> xRefs = null;
- int size = in.readInt();
- if (size != 0)
- {
- xRefs = new ArrayList<CDOObjectReference>(size);
- for (int i = 0; i < size; i++)
- {
- CDOIDReference idReference = in.readCDOIDReference();
- xRefs.add(new CDOObjectReferenceImpl(transaction, idReference));
- }
- }
-
- return new CommitTransactionResult(idProvider, rollbackMessage, branchPoint, previousTimeStamp, xRefs);
- }
-
- return null;
- }
-
- protected CommitTransactionResult confirmingResult(CDODataInput in) throws IOException
- {
- CDOBranchPoint branchPoint = in.readCDOBranchPoint();
- long previousTimeStamp = in.readLong();
- return new CommitTransactionResult(idProvider, branchPoint, previousTimeStamp);
- }
-
- protected void confirmingMappingNewObjects(CDODataInput in, CommitTransactionResult result) throws IOException
- {
- for (;;)
- {
- CDOID id = in.readCDOID();
- if (CDOIDUtil.isNull(id))
- {
- break;
- }
-
- if (id instanceof CDOIDTemp)
- {
- CDOIDTemp oldID = (CDOIDTemp)id;
- CDOID newID = in.readCDOID();
- result.addIDMapping(oldID, newID);
- }
- else
- {
- throw new ClassCastException("Not a temporary ID: " + id);
- }
- }
- }
-
- protected void confirmingNewLockStates(CDODataInput in, CommitTransactionResult result) throws IOException
- {
- int n = in.readInt();
- CDOLockState[] newLockStates = new CDOLockState[n];
-
- for (int i = 0; i < n; i++)
- {
- newLockStates[i] = in.readCDOLockState();
- }
-
- result.setNewLockStates(newLockStates);
- }
-}
+/* + * 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 + * Simon McDuff - bug 201266 + * Simon McDuff - bug 215688 + * Simon McDuff - bug 213402 + * Andre Dietisheim - bug 256649 + */ +package org.eclipse.emf.cdo.internal.net4j.protocol; + +import org.eclipse.emf.cdo.CDOObject; +import org.eclipse.emf.cdo.CDOObjectReference; +import org.eclipse.emf.cdo.common.branch.CDOBranchPoint; +import org.eclipse.emf.cdo.common.commit.CDOCommitData; +import org.eclipse.emf.cdo.common.id.CDOID; +import org.eclipse.emf.cdo.common.id.CDOIDProvider; +import org.eclipse.emf.cdo.common.id.CDOIDReference; +import org.eclipse.emf.cdo.common.id.CDOIDTemp; +import org.eclipse.emf.cdo.common.id.CDOIDUtil; +import org.eclipse.emf.cdo.common.lob.CDOBlob; +import org.eclipse.emf.cdo.common.lob.CDOClob; +import org.eclipse.emf.cdo.common.lob.CDOLob; +import org.eclipse.emf.cdo.common.lock.CDOLockState; +import org.eclipse.emf.cdo.common.model.CDOPackageUnit; +import org.eclipse.emf.cdo.common.protocol.CDODataInput; +import org.eclipse.emf.cdo.common.protocol.CDODataOutput; +import org.eclipse.emf.cdo.common.protocol.CDOProtocolConstants; +import org.eclipse.emf.cdo.common.revision.CDOIDAndVersion; +import org.eclipse.emf.cdo.common.revision.CDORevision; +import org.eclipse.emf.cdo.common.revision.CDORevisionKey; +import org.eclipse.emf.cdo.common.revision.delta.CDORevisionDelta; +import org.eclipse.emf.cdo.internal.net4j.bundle.OM; +import org.eclipse.emf.cdo.transaction.CDOTransaction; + +import org.eclipse.emf.internal.cdo.object.CDOObjectReferenceImpl; + +import org.eclipse.net4j.util.concurrent.ConcurrencyUtil; +import org.eclipse.net4j.util.io.ExtendedDataOutputStream; +import org.eclipse.net4j.util.io.IOUtil; +import org.eclipse.net4j.util.om.monitor.OMMonitor; +import org.eclipse.net4j.util.om.trace.ContextTracer; + +import org.eclipse.emf.ecore.EClass; +import org.eclipse.emf.spi.cdo.CDOSessionProtocol.CommitTransactionResult; +import org.eclipse.emf.spi.cdo.InternalCDOTransaction.InternalCDOCommitContext; + +import java.io.IOException; +import java.io.OutputStreamWriter; +import java.util.ArrayList; +import java.util.Collection; +import java.util.List; + +/** + * @author Eike Stepper + */ +public class CommitTransactionRequest extends CDOClientRequestWithMonitoring<CommitTransactionResult> +{ + private static final ContextTracer TRACER = new ContextTracer(OM.DEBUG_PROTOCOL, CommitTransactionRequest.class); + + private static long sleepMillisForTesting = 0L; + + private CDOIDProvider idProvider; // CDOTransaction + + private String comment; + + private boolean releaseLocks; + + private CDOCommitData commitData; + + private Collection<CDOLob<?>> lobs; + + private Collection<CDOLockState> locksOnNewObjects; + + private int viewID; + + private CDOTransaction transaction; + + public CommitTransactionRequest(CDOClientProtocol protocol, InternalCDOCommitContext context) + { + this(protocol, CDOProtocolConstants.SIGNAL_COMMIT_TRANSACTION, context); + } + + public CommitTransactionRequest(CDOClientProtocol protocol, short signalID, InternalCDOCommitContext context) + { + super(protocol, signalID); + + transaction = context.getTransaction(); + comment = context.getCommitComment(); + releaseLocks = context.isAutoReleaseLocks(); + idProvider = context.getTransaction(); + commitData = context.getCommitData(); + lobs = context.getLobs(); + locksOnNewObjects = context.getLocksOnNewObjects(); + viewID = context.getViewID(); + } + + @Override + protected int getMonitorTimeoutSeconds() + { + org.eclipse.emf.cdo.net4j.CDONet4jSession session = (org.eclipse.emf.cdo.net4j.CDONet4jSession)getSession(); + return session.options().getCommitTimeout(); + } + + @Override + protected CDOIDProvider getIDProvider() + { + return idProvider; + } + + @Override + protected void requesting(CDODataOutput out, OMMonitor monitor) throws IOException + { + requestingTransactionInfo(out); + requestingCommit(out); + } + + protected void requestingTransactionInfo(CDODataOutput out) throws IOException + { + out.writeInt(viewID); + } + + protected void requestingCommit(CDODataOutput out) throws IOException + { + List<CDOPackageUnit> newPackageUnits = commitData.getNewPackageUnits(); + List<CDOIDAndVersion> newObjects = commitData.getNewObjects(); + List<CDORevisionKey> changedObjects = commitData.getChangedObjects(); + List<CDOIDAndVersion> detachedObjects = commitData.getDetachedObjects(); + + out.writeBoolean(releaseLocks); + out.writeString(comment); + out.writeInt(newPackageUnits.size()); + out.writeInt(locksOnNewObjects.size()); + out.writeInt(newObjects.size()); + out.writeInt(changedObjects.size()); + out.writeInt(detachedObjects.size()); + + if (TRACER.isEnabled()) + { + TRACER.format("Writing {0} new package units", newPackageUnits.size()); //$NON-NLS-1$ + } + + for (CDOPackageUnit newPackageUnit : newPackageUnits) + { + out.writeCDOPackageUnit(newPackageUnit, true); + } + + if (TRACER.isEnabled()) + { + TRACER.format("Writing {0} locks on new objects", locksOnNewObjects.size()); //$NON-NLS-1$ + } + + for (CDOLockState lockState : locksOnNewObjects) + { + out.writeCDOLockState(lockState); + } + + if (TRACER.isEnabled()) + { + TRACER.format("Writing {0} new objects", newObjects.size()); //$NON-NLS-1$ + } + + for (CDOIDAndVersion newObject : newObjects) + { + out.writeCDORevision((CDORevision)newObject, CDORevision.UNCHUNKED); + + if (sleepMillisForTesting != 0L) + { + ConcurrencyUtil.sleep(sleepMillisForTesting); + } + } + + if (TRACER.isEnabled()) + { + TRACER.format("Writing {0} dirty objects", changedObjects.size()); //$NON-NLS-1$ + } + + for (CDORevisionKey changedObject : changedObjects) + { + out.writeCDORevisionDelta((CDORevisionDelta)changedObject); + } + + if (TRACER.isEnabled()) + { + TRACER.format("Writing {0} detached objects", detachedObjects.size()); //$NON-NLS-1$ + } + + boolean ensuringReferentialIntegrity = getSession().getRepositoryInfo().isEnsuringReferentialIntegrity(); + for (CDOIDAndVersion detachedObject : detachedObjects) + { + CDOID id = detachedObject.getID(); + out.writeCDOID(id); + if (ensuringReferentialIntegrity) + { + EClass eClass = getObjectType(id); + out.writeCDOClassifierRef(eClass); + } + } + + requestingLobs(); + } + + protected void requestingLobs() throws IOException + { + ExtendedDataOutputStream out = getRequestStream(); + out.writeInt(lobs.size()); + for (CDOLob<?> lob : lobs) + { + out.writeByteArray(lob.getID()); + long size = lob.getSize(); + if (lob instanceof CDOBlob) + { + CDOBlob blob = (CDOBlob)lob; + out.writeLong(size); + IOUtil.copyBinary(blob.getContents(), out, size); + } + else + { + CDOClob clob = (CDOClob)lob; + out.writeLong(-size); + IOUtil.copyCharacter(clob.getContents(), new OutputStreamWriter(out), size); + } + } + } + + protected EClass getObjectType(CDOID id) + { + CDOObject object = transaction.getObject(id); + return object.eClass(); + } + + @Override + protected CommitTransactionResult confirming(CDODataInput in, OMMonitor monitor) throws IOException + { + CommitTransactionResult result = confirmingCheckError(in); + if (result != null) + { + return result; + } + + result = confirmingResult(in); + confirmingMappingNewObjects(in, result); + confirmingNewLockStates(in, result); + return result; + } + + protected CommitTransactionResult confirmingCheckError(CDODataInput in) throws IOException + { + boolean success = in.readBoolean(); + if (!success) + { + String rollbackMessage = in.readString(); + OM.LOG.error(rollbackMessage); + + CDOBranchPoint branchPoint = in.readCDOBranchPoint(); + long previousTimeStamp = in.readLong(); + + List<CDOObjectReference> xRefs = null; + int size = in.readInt(); + if (size != 0) + { + xRefs = new ArrayList<CDOObjectReference>(size); + for (int i = 0; i < size; i++) + { + CDOIDReference idReference = in.readCDOIDReference(); + xRefs.add(new CDOObjectReferenceImpl(transaction, idReference)); + } + } + + return new CommitTransactionResult(idProvider, rollbackMessage, branchPoint, previousTimeStamp, xRefs); + } + + return null; + } + + protected CommitTransactionResult confirmingResult(CDODataInput in) throws IOException + { + CDOBranchPoint branchPoint = in.readCDOBranchPoint(); + long previousTimeStamp = in.readLong(); + return new CommitTransactionResult(idProvider, branchPoint, previousTimeStamp); + } + + protected void confirmingMappingNewObjects(CDODataInput in, CommitTransactionResult result) throws IOException + { + for (;;) + { + CDOID id = in.readCDOID(); + if (CDOIDUtil.isNull(id)) + { + break; + } + + if (id instanceof CDOIDTemp) + { + CDOIDTemp oldID = (CDOIDTemp)id; + CDOID newID = in.readCDOID(); + result.addIDMapping(oldID, newID); + } + else + { + throw new ClassCastException("Not a temporary ID: " + id); + } + } + } + + protected void confirmingNewLockStates(CDODataInput in, CommitTransactionResult result) throws IOException + { + int n = in.readInt(); + CDOLockState[] newLockStates = new CDOLockState[n]; + + for (int i = 0; i < n; i++) + { + newLockStates[i] = in.readCDOLockState(); + } + + result.setNewLockStates(newLockStates); + } +} diff --git a/plugins/org.eclipse.emf.cdo.net4j/src/org/eclipse/emf/cdo/internal/net4j/protocol/CommitXATransactionCancelRequest.java b/plugins/org.eclipse.emf.cdo.net4j/src/org/eclipse/emf/cdo/internal/net4j/protocol/CommitXATransactionCancelRequest.java index 7cb49f2b1e..888be64cbb 100644 --- a/plugins/org.eclipse.emf.cdo.net4j/src/org/eclipse/emf/cdo/internal/net4j/protocol/CommitXATransactionCancelRequest.java +++ b/plugins/org.eclipse.emf.cdo.net4j/src/org/eclipse/emf/cdo/internal/net4j/protocol/CommitXATransactionCancelRequest.java @@ -1,52 +1,52 @@ -/*
- * 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:
- * Simon McDuff - initial API and implementation
- */
-package org.eclipse.emf.cdo.internal.net4j.protocol;
-
-import org.eclipse.emf.cdo.common.protocol.CDODataInput;
-import org.eclipse.emf.cdo.common.protocol.CDODataOutput;
-import org.eclipse.emf.cdo.common.protocol.CDOProtocolConstants;
-import org.eclipse.emf.cdo.transaction.CDOTransaction;
-
-import org.eclipse.net4j.util.om.monitor.OMMonitor;
-
-import org.eclipse.emf.spi.cdo.CDOSessionProtocol.CommitTransactionResult;
-import org.eclipse.emf.spi.cdo.InternalCDOXATransaction.InternalCDOXACommitContext;
-
-import java.io.IOException;
-
-/**
- * Determine at which moment the server side can complete the transaction.
- * <p>
- * At this stage, everything on the database was done except to flush on the disk.
- * <p>
- * It is useful to assure that all {@link CDOTransaction} involve in that commit are synchronize.
- *
- * @author Simon McDuff
- */
-public class CommitXATransactionCancelRequest extends CommitXATransactionRequest
-{
- public CommitXATransactionCancelRequest(CDOClientProtocol protocol, InternalCDOXACommitContext xaContext)
- {
- super(protocol, CDOProtocolConstants.SIGNAL_XA_COMMIT_TRANSACTION_CANCEL, xaContext);
- }
-
- @Override
- protected void requesting(CDODataOutput out, OMMonitor monitor) throws IOException
- {
- requestingTransactionInfo(out);
- }
-
- @Override
- protected CommitTransactionResult confirming(CDODataInput in, OMMonitor monitor) throws IOException
- {
- return confirmingCheckError(in);
- }
-}
+/* + * 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: + * Simon McDuff - initial API and implementation + */ +package org.eclipse.emf.cdo.internal.net4j.protocol; + +import org.eclipse.emf.cdo.common.protocol.CDODataInput; +import org.eclipse.emf.cdo.common.protocol.CDODataOutput; +import org.eclipse.emf.cdo.common.protocol.CDOProtocolConstants; +import org.eclipse.emf.cdo.transaction.CDOTransaction; + +import org.eclipse.net4j.util.om.monitor.OMMonitor; + +import org.eclipse.emf.spi.cdo.CDOSessionProtocol.CommitTransactionResult; +import org.eclipse.emf.spi.cdo.InternalCDOXATransaction.InternalCDOXACommitContext; + +import java.io.IOException; + +/** + * Determine at which moment the server side can complete the transaction. + * <p> + * At this stage, everything on the database was done except to flush on the disk. + * <p> + * It is useful to assure that all {@link CDOTransaction} involve in that commit are synchronize. + * + * @author Simon McDuff + */ +public class CommitXATransactionCancelRequest extends CommitXATransactionRequest +{ + public CommitXATransactionCancelRequest(CDOClientProtocol protocol, InternalCDOXACommitContext xaContext) + { + super(protocol, CDOProtocolConstants.SIGNAL_XA_COMMIT_TRANSACTION_CANCEL, xaContext); + } + + @Override + protected void requesting(CDODataOutput out, OMMonitor monitor) throws IOException + { + requestingTransactionInfo(out); + } + + @Override + protected CommitTransactionResult confirming(CDODataInput in, OMMonitor monitor) throws IOException + { + return confirmingCheckError(in); + } +} diff --git a/plugins/org.eclipse.emf.cdo.net4j/src/org/eclipse/emf/cdo/internal/net4j/protocol/CommitXATransactionPhase1Request.java b/plugins/org.eclipse.emf.cdo.net4j/src/org/eclipse/emf/cdo/internal/net4j/protocol/CommitXATransactionPhase1Request.java index 5492cd5384..f7c0ec1fbb 100644 --- a/plugins/org.eclipse.emf.cdo.net4j/src/org/eclipse/emf/cdo/internal/net4j/protocol/CommitXATransactionPhase1Request.java +++ b/plugins/org.eclipse.emf.cdo.net4j/src/org/eclipse/emf/cdo/internal/net4j/protocol/CommitXATransactionPhase1Request.java @@ -1,59 +1,59 @@ -/*
- * 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:
- * Simon McDuff - initial API and implementation
- */
-package org.eclipse.emf.cdo.internal.net4j.protocol;
-
-import org.eclipse.emf.cdo.common.id.CDOIDProvider;
-import org.eclipse.emf.cdo.common.protocol.CDODataInput;
-import org.eclipse.emf.cdo.common.protocol.CDOProtocolConstants;
-import org.eclipse.emf.cdo.transaction.CDOTransaction;
-
-import org.eclipse.net4j.util.om.monitor.OMMonitor;
-
-import org.eclipse.emf.spi.cdo.CDOSessionProtocol.CommitTransactionResult;
-import org.eclipse.emf.spi.cdo.InternalCDOXATransaction.InternalCDOXACommitContext;
-
-import java.io.IOException;
-
-/**
- * Phase 1 will send all the modifications to the server.
- * <p>
- * It needs to fill id mappings for objects immediately to be use by other {@link CDOTransaction} involve in that
- * commit.
- *
- * @author Simon McDuff
- */
-public class CommitXATransactionPhase1Request extends CommitXATransactionRequest
-{
- public CommitXATransactionPhase1Request(CDOClientProtocol protocol, InternalCDOXACommitContext xaContext)
- {
- super(protocol, CDOProtocolConstants.SIGNAL_XA_COMMIT_TRANSACTION_PHASE1, xaContext);
- }
-
- @Override
- protected CDOIDProvider getIDProvider()
- {
- return getCommitContext();
- }
-
- @Override
- protected CommitTransactionResult confirming(CDODataInput in, OMMonitor monitor) throws IOException
- {
- CommitTransactionResult result = confirmingCheckError(in);
- if (result != null)
- {
- return result;
- }
-
- result = confirmingResult(in);
- confirmingMappingNewObjects(in, result);
- return result;
- }
-}
+/* + * 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: + * Simon McDuff - initial API and implementation + */ +package org.eclipse.emf.cdo.internal.net4j.protocol; + +import org.eclipse.emf.cdo.common.id.CDOIDProvider; +import org.eclipse.emf.cdo.common.protocol.CDODataInput; +import org.eclipse.emf.cdo.common.protocol.CDOProtocolConstants; +import org.eclipse.emf.cdo.transaction.CDOTransaction; + +import org.eclipse.net4j.util.om.monitor.OMMonitor; + +import org.eclipse.emf.spi.cdo.CDOSessionProtocol.CommitTransactionResult; +import org.eclipse.emf.spi.cdo.InternalCDOXATransaction.InternalCDOXACommitContext; + +import java.io.IOException; + +/** + * Phase 1 will send all the modifications to the server. + * <p> + * It needs to fill id mappings for objects immediately to be use by other {@link CDOTransaction} involve in that + * commit. + * + * @author Simon McDuff + */ +public class CommitXATransactionPhase1Request extends CommitXATransactionRequest +{ + public CommitXATransactionPhase1Request(CDOClientProtocol protocol, InternalCDOXACommitContext xaContext) + { + super(protocol, CDOProtocolConstants.SIGNAL_XA_COMMIT_TRANSACTION_PHASE1, xaContext); + } + + @Override + protected CDOIDProvider getIDProvider() + { + return getCommitContext(); + } + + @Override + protected CommitTransactionResult confirming(CDODataInput in, OMMonitor monitor) throws IOException + { + CommitTransactionResult result = confirmingCheckError(in); + if (result != null) + { + return result; + } + + result = confirmingResult(in); + confirmingMappingNewObjects(in, result); + return result; + } +} diff --git a/plugins/org.eclipse.emf.cdo.net4j/src/org/eclipse/emf/cdo/internal/net4j/protocol/CommitXATransactionPhase2Request.java b/plugins/org.eclipse.emf.cdo.net4j/src/org/eclipse/emf/cdo/internal/net4j/protocol/CommitXATransactionPhase2Request.java index 5acf3b9722..c91980f524 100644 --- a/plugins/org.eclipse.emf.cdo.net4j/src/org/eclipse/emf/cdo/internal/net4j/protocol/CommitXATransactionPhase2Request.java +++ b/plugins/org.eclipse.emf.cdo.net4j/src/org/eclipse/emf/cdo/internal/net4j/protocol/CommitXATransactionPhase2Request.java @@ -1,115 +1,115 @@ -/*
- * 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:
- * Simon McDuff - initial API and implementation
- */
-package org.eclipse.emf.cdo.internal.net4j.protocol;
-
-import org.eclipse.emf.cdo.common.id.CDOID;
-import org.eclipse.emf.cdo.common.id.CDOIDUtil;
-import org.eclipse.emf.cdo.common.protocol.CDODataInput;
-import org.eclipse.emf.cdo.common.protocol.CDODataOutput;
-import org.eclipse.emf.cdo.common.protocol.CDOProtocolConstants;
-import org.eclipse.emf.cdo.internal.common.id.CDOIDTempObjectExternalImpl;
-import org.eclipse.emf.cdo.internal.net4j.bundle.OM;
-import org.eclipse.emf.cdo.internal.net4j.messages.Messages;
-import org.eclipse.emf.cdo.util.CDOURIUtil;
-
-import org.eclipse.net4j.util.om.monitor.OMMonitor;
-import org.eclipse.net4j.util.om.trace.ContextTracer;
-
-import org.eclipse.emf.common.util.URI;
-import org.eclipse.emf.spi.cdo.CDOSessionProtocol.CommitTransactionResult;
-import org.eclipse.emf.spi.cdo.InternalCDOTransaction;
-import org.eclipse.emf.spi.cdo.InternalCDOXATransaction.InternalCDOXACommitContext;
-
-import java.io.IOException;
-import java.text.MessageFormat;
-import java.util.Map;
-import java.util.Map.Entry;
-
-/**
- * <p>
- * Phase 2 consist of sending the mapping of temporary/persistent CDOID from other CDOTransaction.
- * <p>
- * It will return confirmation only when the commit is ready to flush to disk.
- *
- * @author Simon McDuff
- */
-public class CommitXATransactionPhase2Request extends CommitXATransactionRequest
-{
- private static final ContextTracer PROTOCOL = new ContextTracer(OM.DEBUG_PROTOCOL,
- CommitXATransactionPhase1Request.class);
-
- public CommitXATransactionPhase2Request(CDOClientProtocol protocol, InternalCDOXACommitContext xaContext)
- {
- super(protocol, CDOProtocolConstants.SIGNAL_XA_COMMIT_TRANSACTION_PHASE2, xaContext);
- }
-
- @Override
- protected void requesting(CDODataOutput out, OMMonitor monitor) throws IOException
- {
- requestingTransactionInfo(out);
- requestingIDMapping(out);
- }
-
- /**
- * Write IDs that are needed. only If it needs to
- */
- protected void requestingIDMapping(CDODataOutput out) throws IOException
- {
- InternalCDOXACommitContext context = getCommitContext();
- Map<CDOIDTempObjectExternalImpl, InternalCDOTransaction> requestedIDs = context.getRequestedIDs();
- int size = requestedIDs.size();
- out.writeInt(size);
- if (PROTOCOL.isEnabled())
- {
- PROTOCOL.format("Number of ids requested: {0}", size); //$NON-NLS-1$
- }
-
- for (Entry<CDOIDTempObjectExternalImpl, InternalCDOTransaction> entry : requestedIDs.entrySet())
- {
- CDOIDTempObjectExternalImpl tempID = entry.getKey();
- URI oldURIExternal = URI.createURI(tempID.toURIFragment());
- CDOID oldCDOID = CDOIDUtil.read(oldURIExternal.fragment());
-
- InternalCDOXACommitContext commitContext = context.getTransactionManager().getCommitContext(entry.getValue());
- if (commitContext == null)
- {
- throw new IllegalStateException(MessageFormat.format(
- Messages.getString("CommitTransactionPhase2Request.1"), entry //$NON-NLS-1$
- .getValue()));
- }
-
- CDOID newID = commitContext.getResult().getIDMappings().get(oldCDOID);
- if (newID == null)
- {
- throw new IllegalStateException(MessageFormat.format(
- Messages.getString("CommitTransactionPhase2Request.2"), oldCDOID //$NON-NLS-1$
- .toURIFragment()));
- }
-
- CDOID newIDExternal = CDOURIUtil.convertExternalCDOID(oldURIExternal, newID);
- if (PROTOCOL.isEnabled())
- {
- PROTOCOL.format("ID mapping: {0} --> {1}", tempID.toURIFragment(), newIDExternal.toURIFragment()); //$NON-NLS-1$
- }
-
- out.writeCDOID(tempID);
- out.writeCDOID(newIDExternal);
-
- context.getResult().addIDMapping(tempID, newIDExternal);
- }
- }
-
- @Override
- protected CommitTransactionResult confirming(CDODataInput in, OMMonitor monitor) throws IOException
- {
- return confirmingCheckError(in);
- }
-}
+/* + * 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: + * Simon McDuff - initial API and implementation + */ +package org.eclipse.emf.cdo.internal.net4j.protocol; + +import org.eclipse.emf.cdo.common.id.CDOID; +import org.eclipse.emf.cdo.common.id.CDOIDUtil; +import org.eclipse.emf.cdo.common.protocol.CDODataInput; +import org.eclipse.emf.cdo.common.protocol.CDODataOutput; +import org.eclipse.emf.cdo.common.protocol.CDOProtocolConstants; +import org.eclipse.emf.cdo.internal.common.id.CDOIDTempObjectExternalImpl; +import org.eclipse.emf.cdo.internal.net4j.bundle.OM; +import org.eclipse.emf.cdo.internal.net4j.messages.Messages; +import org.eclipse.emf.cdo.util.CDOURIUtil; + +import org.eclipse.net4j.util.om.monitor.OMMonitor; +import org.eclipse.net4j.util.om.trace.ContextTracer; + +import org.eclipse.emf.common.util.URI; +import org.eclipse.emf.spi.cdo.CDOSessionProtocol.CommitTransactionResult; +import org.eclipse.emf.spi.cdo.InternalCDOTransaction; +import org.eclipse.emf.spi.cdo.InternalCDOXATransaction.InternalCDOXACommitContext; + +import java.io.IOException; +import java.text.MessageFormat; +import java.util.Map; +import java.util.Map.Entry; + +/** + * <p> + * Phase 2 consist of sending the mapping of temporary/persistent CDOID from other CDOTransaction. + * <p> + * It will return confirmation only when the commit is ready to flush to disk. + * + * @author Simon McDuff + */ +public class CommitXATransactionPhase2Request extends CommitXATransactionRequest +{ + private static final ContextTracer PROTOCOL = new ContextTracer(OM.DEBUG_PROTOCOL, + CommitXATransactionPhase1Request.class); + + public CommitXATransactionPhase2Request(CDOClientProtocol protocol, InternalCDOXACommitContext xaContext) + { + super(protocol, CDOProtocolConstants.SIGNAL_XA_COMMIT_TRANSACTION_PHASE2, xaContext); + } + + @Override + protected void requesting(CDODataOutput out, OMMonitor monitor) throws IOException + { + requestingTransactionInfo(out); + requestingIDMapping(out); + } + + /** + * Write IDs that are needed. only If it needs to + */ + protected void requestingIDMapping(CDODataOutput out) throws IOException + { + InternalCDOXACommitContext context = getCommitContext(); + Map<CDOIDTempObjectExternalImpl, InternalCDOTransaction> requestedIDs = context.getRequestedIDs(); + int size = requestedIDs.size(); + out.writeInt(size); + if (PROTOCOL.isEnabled()) + { + PROTOCOL.format("Number of ids requested: {0}", size); //$NON-NLS-1$ + } + + for (Entry<CDOIDTempObjectExternalImpl, InternalCDOTransaction> entry : requestedIDs.entrySet()) + { + CDOIDTempObjectExternalImpl tempID = entry.getKey(); + URI oldURIExternal = URI.createURI(tempID.toURIFragment()); + CDOID oldCDOID = CDOIDUtil.read(oldURIExternal.fragment()); + + InternalCDOXACommitContext commitContext = context.getTransactionManager().getCommitContext(entry.getValue()); + if (commitContext == null) + { + throw new IllegalStateException(MessageFormat.format( + Messages.getString("CommitTransactionPhase2Request.1"), entry //$NON-NLS-1$ + .getValue())); + } + + CDOID newID = commitContext.getResult().getIDMappings().get(oldCDOID); + if (newID == null) + { + throw new IllegalStateException(MessageFormat.format( + Messages.getString("CommitTransactionPhase2Request.2"), oldCDOID //$NON-NLS-1$ + .toURIFragment())); + } + + CDOID newIDExternal = CDOURIUtil.convertExternalCDOID(oldURIExternal, newID); + if (PROTOCOL.isEnabled()) + { + PROTOCOL.format("ID mapping: {0} --> {1}", tempID.toURIFragment(), newIDExternal.toURIFragment()); //$NON-NLS-1$ + } + + out.writeCDOID(tempID); + out.writeCDOID(newIDExternal); + + context.getResult().addIDMapping(tempID, newIDExternal); + } + } + + @Override + protected CommitTransactionResult confirming(CDODataInput in, OMMonitor monitor) throws IOException + { + return confirmingCheckError(in); + } +} diff --git a/plugins/org.eclipse.emf.cdo.net4j/src/org/eclipse/emf/cdo/internal/net4j/protocol/CommitXATransactionPhase3Request.java b/plugins/org.eclipse.emf.cdo.net4j/src/org/eclipse/emf/cdo/internal/net4j/protocol/CommitXATransactionPhase3Request.java index 6d726ee421..f904ecb0fc 100644 --- a/plugins/org.eclipse.emf.cdo.net4j/src/org/eclipse/emf/cdo/internal/net4j/protocol/CommitXATransactionPhase3Request.java +++ b/plugins/org.eclipse.emf.cdo.net4j/src/org/eclipse/emf/cdo/internal/net4j/protocol/CommitXATransactionPhase3Request.java @@ -1,59 +1,59 @@ -/*
- * 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:
- * Simon McDuff - initial API and implementation
- */
-package org.eclipse.emf.cdo.internal.net4j.protocol;
-
-import org.eclipse.emf.cdo.common.protocol.CDODataInput;
-import org.eclipse.emf.cdo.common.protocol.CDODataOutput;
-import org.eclipse.emf.cdo.common.protocol.CDOProtocolConstants;
-import org.eclipse.emf.cdo.transaction.CDOTransaction;
-
-import org.eclipse.net4j.util.om.monitor.OMMonitor;
-
-import org.eclipse.emf.spi.cdo.CDOSessionProtocol.CommitTransactionResult;
-import org.eclipse.emf.spi.cdo.InternalCDOXATransaction.InternalCDOXACommitContext;
-
-import java.io.IOException;
-
-/**
- * Determine at which moment the server side can complete the transaction.
- * <p>
- * At this stage, everything on the database was done except to flush on the disk.
- * <p>
- * It is useful to assure that all {@link CDOTransaction} involve in that commit are synchronize.
- *
- * @author Simon McDuff
- */
-public class CommitXATransactionPhase3Request extends CommitXATransactionRequest
-{
- public CommitXATransactionPhase3Request(CDOClientProtocol protocol, InternalCDOXACommitContext xaContext)
- {
- super(protocol, CDOProtocolConstants.SIGNAL_XA_COMMIT_TRANSACTION_PHASE3, xaContext);
- }
-
- @Override
- protected void requesting(CDODataOutput out, OMMonitor monitor) throws IOException
- {
- requestingTransactionInfo(out);
- }
-
- @Override
- protected CommitTransactionResult confirming(CDODataInput in, OMMonitor monitor) throws IOException
- {
- CommitTransactionResult result = confirmingCheckError(in);
- if (result != null)
- {
- return result;
- }
-
- InternalCDOXACommitContext context = getCommitContext();
- return context.getResult();
- }
-}
+/* + * 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: + * Simon McDuff - initial API and implementation + */ +package org.eclipse.emf.cdo.internal.net4j.protocol; + +import org.eclipse.emf.cdo.common.protocol.CDODataInput; +import org.eclipse.emf.cdo.common.protocol.CDODataOutput; +import org.eclipse.emf.cdo.common.protocol.CDOProtocolConstants; +import org.eclipse.emf.cdo.transaction.CDOTransaction; + +import org.eclipse.net4j.util.om.monitor.OMMonitor; + +import org.eclipse.emf.spi.cdo.CDOSessionProtocol.CommitTransactionResult; +import org.eclipse.emf.spi.cdo.InternalCDOXATransaction.InternalCDOXACommitContext; + +import java.io.IOException; + +/** + * Determine at which moment the server side can complete the transaction. + * <p> + * At this stage, everything on the database was done except to flush on the disk. + * <p> + * It is useful to assure that all {@link CDOTransaction} involve in that commit are synchronize. + * + * @author Simon McDuff + */ +public class CommitXATransactionPhase3Request extends CommitXATransactionRequest +{ + public CommitXATransactionPhase3Request(CDOClientProtocol protocol, InternalCDOXACommitContext xaContext) + { + super(protocol, CDOProtocolConstants.SIGNAL_XA_COMMIT_TRANSACTION_PHASE3, xaContext); + } + + @Override + protected void requesting(CDODataOutput out, OMMonitor monitor) throws IOException + { + requestingTransactionInfo(out); + } + + @Override + protected CommitTransactionResult confirming(CDODataInput in, OMMonitor monitor) throws IOException + { + CommitTransactionResult result = confirmingCheckError(in); + if (result != null) + { + return result; + } + + InternalCDOXACommitContext context = getCommitContext(); + return context.getResult(); + } +} diff --git a/plugins/org.eclipse.emf.cdo.net4j/src/org/eclipse/emf/cdo/internal/net4j/protocol/CommitXATransactionRequest.java b/plugins/org.eclipse.emf.cdo.net4j/src/org/eclipse/emf/cdo/internal/net4j/protocol/CommitXATransactionRequest.java index 4126cce66e..27aca47951 100644 --- a/plugins/org.eclipse.emf.cdo.net4j/src/org/eclipse/emf/cdo/internal/net4j/protocol/CommitXATransactionRequest.java +++ b/plugins/org.eclipse.emf.cdo.net4j/src/org/eclipse/emf/cdo/internal/net4j/protocol/CommitXATransactionRequest.java @@ -1,32 +1,32 @@ -/*
- * 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.net4j.protocol;
-
-import org.eclipse.emf.spi.cdo.InternalCDOXATransaction.InternalCDOXACommitContext;
-
-/**
- * @author Eike Stepper
- */
-public class CommitXATransactionRequest extends CommitTransactionRequest
-{
- private InternalCDOXACommitContext xaContext;
-
- public CommitXATransactionRequest(CDOClientProtocol protocol, short signalID, InternalCDOXACommitContext xaContext)
- {
- super(protocol, signalID, xaContext);
- this.xaContext = xaContext;
- }
-
- protected InternalCDOXACommitContext getCommitContext()
- {
- return xaContext;
- }
-}
+/* + * 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.net4j.protocol; + +import org.eclipse.emf.spi.cdo.InternalCDOXATransaction.InternalCDOXACommitContext; + +/** + * @author Eike Stepper + */ +public class CommitXATransactionRequest extends CommitTransactionRequest +{ + private InternalCDOXACommitContext xaContext; + + public CommitXATransactionRequest(CDOClientProtocol protocol, short signalID, InternalCDOXACommitContext xaContext) + { + super(protocol, signalID, xaContext); + this.xaContext = xaContext; + } + + protected InternalCDOXACommitContext getCommitContext() + { + return xaContext; + } +} diff --git a/plugins/org.eclipse.emf.cdo.net4j/src/org/eclipse/emf/cdo/internal/net4j/protocol/CreateBranchRequest.java b/plugins/org.eclipse.emf.cdo.net4j/src/org/eclipse/emf/cdo/internal/net4j/protocol/CreateBranchRequest.java index ffe5867d78..a7a859c18c 100644 --- a/plugins/org.eclipse.emf.cdo.net4j/src/org/eclipse/emf/cdo/internal/net4j/protocol/CreateBranchRequest.java +++ b/plugins/org.eclipse.emf.cdo.net4j/src/org/eclipse/emf/cdo/internal/net4j/protocol/CreateBranchRequest.java @@ -1,52 +1,52 @@ -/*
- * 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.net4j.protocol;
-
-import org.eclipse.emf.cdo.common.protocol.CDODataInput;
-import org.eclipse.emf.cdo.common.protocol.CDODataOutput;
-import org.eclipse.emf.cdo.common.protocol.CDOProtocolConstants;
-import org.eclipse.emf.cdo.spi.common.branch.InternalCDOBranchManager.BranchLoader.BranchInfo;
-
-import org.eclipse.net4j.util.collection.Pair;
-
-import java.io.IOException;
-
-/**
- * @author Eike Stepper
- */
-public class CreateBranchRequest extends CDOClientRequest<Pair<Integer, Long>>
-{
- private int branchID;
-
- private BranchInfo branchInfo;
-
- public CreateBranchRequest(CDOClientProtocol protocol, int branchID, BranchInfo branchInfo)
- {
- super(protocol, CDOProtocolConstants.SIGNAL_CREATE_BRANCH);
- this.branchID = branchID;
- this.branchInfo = branchInfo;
- }
-
- @Override
- protected void requesting(CDODataOutput out) throws IOException
- {
- out.writeInt(branchID);
- branchInfo.write(out);
- }
-
- @Override
- protected Pair<Integer, Long> confirming(CDODataInput in) throws IOException
- {
- branchID = in.readInt();
- long baseTimeStamp = in.readLong();
- return new Pair<Integer, Long>(branchID, baseTimeStamp);
- }
-}
+/* + * 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.net4j.protocol; + +import org.eclipse.emf.cdo.common.protocol.CDODataInput; +import org.eclipse.emf.cdo.common.protocol.CDODataOutput; +import org.eclipse.emf.cdo.common.protocol.CDOProtocolConstants; +import org.eclipse.emf.cdo.spi.common.branch.InternalCDOBranchManager.BranchLoader.BranchInfo; + +import org.eclipse.net4j.util.collection.Pair; + +import java.io.IOException; + +/** + * @author Eike Stepper + */ +public class CreateBranchRequest extends CDOClientRequest<Pair<Integer, Long>> +{ + private int branchID; + + private BranchInfo branchInfo; + + public CreateBranchRequest(CDOClientProtocol protocol, int branchID, BranchInfo branchInfo) + { + super(protocol, CDOProtocolConstants.SIGNAL_CREATE_BRANCH); + this.branchID = branchID; + this.branchInfo = branchInfo; + } + + @Override + protected void requesting(CDODataOutput out) throws IOException + { + out.writeInt(branchID); + branchInfo.write(out); + } + + @Override + protected Pair<Integer, Long> confirming(CDODataInput in) throws IOException + { + branchID = in.readInt(); + long baseTimeStamp = in.readLong(); + return new Pair<Integer, Long>(branchID, baseTimeStamp); + } +} diff --git a/plugins/org.eclipse.emf.cdo.net4j/src/org/eclipse/emf/cdo/internal/net4j/protocol/DisablePassiveUpdateRequest.java b/plugins/org.eclipse.emf.cdo.net4j/src/org/eclipse/emf/cdo/internal/net4j/protocol/DisablePassiveUpdateRequest.java index d842d2e3de..c3d2f2a9fe 100644 --- a/plugins/org.eclipse.emf.cdo.net4j/src/org/eclipse/emf/cdo/internal/net4j/protocol/DisablePassiveUpdateRequest.java +++ b/plugins/org.eclipse.emf.cdo.net4j/src/org/eclipse/emf/cdo/internal/net4j/protocol/DisablePassiveUpdateRequest.java @@ -1,40 +1,40 @@ -/*
- * 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
- * Simon McDuff - bug 230832
- */
-package org.eclipse.emf.cdo.internal.net4j.protocol;
-
-import org.eclipse.emf.cdo.common.protocol.CDODataInput;
-import org.eclipse.emf.cdo.common.protocol.CDODataOutput;
-import org.eclipse.emf.cdo.common.protocol.CDOProtocolConstants;
-
-import java.io.IOException;
-
-/**
- * @author Eike Stepper
- */
-public class DisablePassiveUpdateRequest extends CDOClientRequest<Boolean>
-{
- public DisablePassiveUpdateRequest(CDOClientProtocol protocol)
- {
- super(protocol, CDOProtocolConstants.SIGNAL_DISABLE_PASSIVE_UPDATE);
- }
-
- @Override
- protected void requesting(CDODataOutput out) throws IOException
- {
- }
-
- @Override
- protected Boolean confirming(CDODataInput in) throws IOException
- {
- return in.readBoolean();
- }
-}
+/* + * 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 + * Simon McDuff - bug 230832 + */ +package org.eclipse.emf.cdo.internal.net4j.protocol; + +import org.eclipse.emf.cdo.common.protocol.CDODataInput; +import org.eclipse.emf.cdo.common.protocol.CDODataOutput; +import org.eclipse.emf.cdo.common.protocol.CDOProtocolConstants; + +import java.io.IOException; + +/** + * @author Eike Stepper + */ +public class DisablePassiveUpdateRequest extends CDOClientRequest<Boolean> +{ + public DisablePassiveUpdateRequest(CDOClientProtocol protocol) + { + super(protocol, CDOProtocolConstants.SIGNAL_DISABLE_PASSIVE_UPDATE); + } + + @Override + protected void requesting(CDODataOutput out) throws IOException + { + } + + @Override + protected Boolean confirming(CDODataInput in) throws IOException + { + return in.readBoolean(); + } +} diff --git a/plugins/org.eclipse.emf.cdo.net4j/src/org/eclipse/emf/cdo/internal/net4j/protocol/EnableLockNotificationRequest.java b/plugins/org.eclipse.emf.cdo.net4j/src/org/eclipse/emf/cdo/internal/net4j/protocol/EnableLockNotificationRequest.java index e161606ea7..edebee6245 100644 --- a/plugins/org.eclipse.emf.cdo.net4j/src/org/eclipse/emf/cdo/internal/net4j/protocol/EnableLockNotificationRequest.java +++ b/plugins/org.eclipse.emf.cdo.net4j/src/org/eclipse/emf/cdo/internal/net4j/protocol/EnableLockNotificationRequest.java @@ -1,47 +1,47 @@ -/*
- * 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:
- * Caspar De Groot - initial API and implementation
- */
-package org.eclipse.emf.cdo.internal.net4j.protocol;
-
-import org.eclipse.emf.cdo.common.protocol.CDODataInput;
-import org.eclipse.emf.cdo.common.protocol.CDODataOutput;
-import org.eclipse.emf.cdo.common.protocol.CDOProtocolConstants;
-
-import java.io.IOException;
-
-/**
- * @author Caspar De Groot
- */
-public class EnableLockNotificationRequest extends CDOClientRequest<Boolean>
-{
- private int viewID;
-
- private boolean on;
-
- public EnableLockNotificationRequest(CDOClientProtocol protocol, int viewID, boolean on)
- {
- super(protocol, CDOProtocolConstants.SIGNAL_ENABLE_LOCK_NOTIFICATION);
- this.viewID = viewID;
- this.on = on;
- }
-
- @Override
- protected void requesting(CDODataOutput out) throws IOException
- {
- out.writeInt(viewID);
- out.writeBoolean(on);
- }
-
- @Override
- protected Boolean confirming(CDODataInput in) throws IOException
- {
- return in.readBoolean();
- }
-}
+/* + * 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: + * Caspar De Groot - initial API and implementation + */ +package org.eclipse.emf.cdo.internal.net4j.protocol; + +import org.eclipse.emf.cdo.common.protocol.CDODataInput; +import org.eclipse.emf.cdo.common.protocol.CDODataOutput; +import org.eclipse.emf.cdo.common.protocol.CDOProtocolConstants; + +import java.io.IOException; + +/** + * @author Caspar De Groot + */ +public class EnableLockNotificationRequest extends CDOClientRequest<Boolean> +{ + private int viewID; + + private boolean on; + + public EnableLockNotificationRequest(CDOClientProtocol protocol, int viewID, boolean on) + { + super(protocol, CDOProtocolConstants.SIGNAL_ENABLE_LOCK_NOTIFICATION); + this.viewID = viewID; + this.on = on; + } + + @Override + protected void requesting(CDODataOutput out) throws IOException + { + out.writeInt(viewID); + out.writeBoolean(on); + } + + @Override + protected Boolean confirming(CDODataInput in) throws IOException + { + return in.readBoolean(); + } +} diff --git a/plugins/org.eclipse.emf.cdo.net4j/src/org/eclipse/emf/cdo/internal/net4j/protocol/GetRemoteSessionsRequest.java b/plugins/org.eclipse.emf.cdo.net4j/src/org/eclipse/emf/cdo/internal/net4j/protocol/GetRemoteSessionsRequest.java index 822d333081..22d4b03032 100644 --- a/plugins/org.eclipse.emf.cdo.net4j/src/org/eclipse/emf/cdo/internal/net4j/protocol/GetRemoteSessionsRequest.java +++ b/plugins/org.eclipse.emf.cdo.net4j/src/org/eclipse/emf/cdo/internal/net4j/protocol/GetRemoteSessionsRequest.java @@ -1,75 +1,75 @@ -/*
- * 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.net4j.protocol;
-
-import org.eclipse.emf.cdo.common.protocol.CDODataInput;
-import org.eclipse.emf.cdo.common.protocol.CDODataOutput;
-import org.eclipse.emf.cdo.common.protocol.CDOProtocolConstants;
-import org.eclipse.emf.cdo.internal.net4j.bundle.OM;
-import org.eclipse.emf.cdo.session.remote.CDORemoteSession;
-
-import org.eclipse.net4j.util.om.trace.ContextTracer;
-
-import org.eclipse.emf.spi.cdo.InternalCDORemoteSessionManager;
-
-import java.io.IOException;
-import java.util.ArrayList;
-import java.util.List;
-
-/**
- * @author Eike Stepper
- */
-public class GetRemoteSessionsRequest extends CDOClientRequest<List<CDORemoteSession>>
-{
- private static final ContextTracer TRACER = new ContextTracer(OM.DEBUG_PROTOCOL, GetRemoteSessionsRequest.class);
-
- private boolean subscribe;
-
- public GetRemoteSessionsRequest(CDOClientProtocol protocol, boolean subscribe)
- {
- super(protocol, CDOProtocolConstants.SIGNAL_GET_REMOTE_SESSIONS);
- this.subscribe = subscribe;
- }
-
- @Override
- protected void requesting(CDODataOutput out) throws IOException
- {
- if (TRACER.isEnabled())
- {
- TRACER.format("Writing subscribe: {0}", subscribe); //$NON-NLS-1$
- }
-
- out.writeBoolean(subscribe);
- }
-
- @Override
- protected List<CDORemoteSession> confirming(CDODataInput in) throws IOException
- {
- List<CDORemoteSession> result = new ArrayList<CDORemoteSession>();
-
- for (;;)
- {
- int sessionID = in.readInt();
- if (sessionID == CDOProtocolConstants.NO_MORE_REMOTE_SESSIONS)
- {
- break;
- }
-
- String userID = in.readString();
- boolean subscribed = in.readBoolean();
- InternalCDORemoteSessionManager manager = getSession().getRemoteSessionManager();
- CDORemoteSession remoteSession = manager.createRemoteSession(sessionID, userID, subscribed);
- result.add(remoteSession);
- }
-
- return result;
- }
-}
+/* + * 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.net4j.protocol; + +import org.eclipse.emf.cdo.common.protocol.CDODataInput; +import org.eclipse.emf.cdo.common.protocol.CDODataOutput; +import org.eclipse.emf.cdo.common.protocol.CDOProtocolConstants; +import org.eclipse.emf.cdo.internal.net4j.bundle.OM; +import org.eclipse.emf.cdo.session.remote.CDORemoteSession; + +import org.eclipse.net4j.util.om.trace.ContextTracer; + +import org.eclipse.emf.spi.cdo.InternalCDORemoteSessionManager; + +import java.io.IOException; +import java.util.ArrayList; +import java.util.List; + +/** + * @author Eike Stepper + */ +public class GetRemoteSessionsRequest extends CDOClientRequest<List<CDORemoteSession>> +{ + private static final ContextTracer TRACER = new ContextTracer(OM.DEBUG_PROTOCOL, GetRemoteSessionsRequest.class); + + private boolean subscribe; + + public GetRemoteSessionsRequest(CDOClientProtocol protocol, boolean subscribe) + { + super(protocol, CDOProtocolConstants.SIGNAL_GET_REMOTE_SESSIONS); + this.subscribe = subscribe; + } + + @Override + protected void requesting(CDODataOutput out) throws IOException + { + if (TRACER.isEnabled()) + { + TRACER.format("Writing subscribe: {0}", subscribe); //$NON-NLS-1$ + } + + out.writeBoolean(subscribe); + } + + @Override + protected List<CDORemoteSession> confirming(CDODataInput in) throws IOException + { + List<CDORemoteSession> result = new ArrayList<CDORemoteSession>(); + + for (;;) + { + int sessionID = in.readInt(); + if (sessionID == CDOProtocolConstants.NO_MORE_REMOTE_SESSIONS) + { + break; + } + + String userID = in.readString(); + boolean subscribed = in.readBoolean(); + InternalCDORemoteSessionManager manager = getSession().getRemoteSessionManager(); + CDORemoteSession remoteSession = manager.createRemoteSession(sessionID, userID, subscribed); + result.add(remoteSession); + } + + return result; + } +} diff --git a/plugins/org.eclipse.emf.cdo.net4j/src/org/eclipse/emf/cdo/internal/net4j/protocol/HandleRevisionsRequest.java b/plugins/org.eclipse.emf.cdo.net4j/src/org/eclipse/emf/cdo/internal/net4j/protocol/HandleRevisionsRequest.java index 81cb185d65..d90f8fbd70 100644 --- a/plugins/org.eclipse.emf.cdo.net4j/src/org/eclipse/emf/cdo/internal/net4j/protocol/HandleRevisionsRequest.java +++ b/plugins/org.eclipse.emf.cdo.net4j/src/org/eclipse/emf/cdo/internal/net4j/protocol/HandleRevisionsRequest.java @@ -1,127 +1,127 @@ -/*
- * 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.net4j.protocol;
-
-import org.eclipse.emf.cdo.common.branch.CDOBranch;
-import org.eclipse.emf.cdo.common.protocol.CDODataInput;
-import org.eclipse.emf.cdo.common.protocol.CDODataOutput;
-import org.eclipse.emf.cdo.common.protocol.CDOProtocolConstants;
-import org.eclipse.emf.cdo.common.revision.CDORevision;
-import org.eclipse.emf.cdo.common.revision.CDORevisionHandler;
-import org.eclipse.emf.cdo.common.util.CDOCommonUtil;
-import org.eclipse.emf.cdo.internal.net4j.bundle.OM;
-
-import org.eclipse.net4j.util.om.trace.ContextTracer;
-
-import org.eclipse.emf.ecore.EClass;
-
-import java.io.IOException;
-
-/**
- * @author Eike Stepper
- */
-public class HandleRevisionsRequest extends CDOClientRequest<Boolean>
-{
- private static final ContextTracer TRACER = new ContextTracer(OM.DEBUG_PROTOCOL, HandleRevisionsRequest.class);
-
- private EClass eClass;
-
- private CDOBranch branch;
-
- private boolean exactBranch;
-
- private long timeStamp;
-
- private boolean exactTime;
-
- private CDORevisionHandler handler;
-
- public HandleRevisionsRequest(CDOClientProtocol protocol, EClass eClass, CDOBranch branch, boolean exactBranch,
- long timeStamp, boolean exactTime, CDORevisionHandler handler)
- {
- super(protocol, CDOProtocolConstants.SIGNAL_HANDLE_REVISIONS);
- this.eClass = eClass;
- this.branch = branch;
- this.exactBranch = exactBranch;
- this.timeStamp = timeStamp;
- this.exactTime = exactTime;
- this.handler = handler;
- }
-
- @Override
- protected void requesting(CDODataOutput out) throws IOException
- {
- if (eClass != null)
- {
- out.writeBoolean(true);
- if (TRACER.isEnabled())
- {
- TRACER.format("Writing eClass: {0}", eClass); //$NON-NLS-1$
- }
-
- out.writeCDOClassifierRef(eClass);
- }
- else
- {
- out.writeBoolean(false);
- }
-
- if (branch != null)
- {
- out.writeBoolean(true);
- if (TRACER.isEnabled())
- {
- TRACER.format("Writing branch: {0}", branch); //$NON-NLS-1$
- }
-
- out.writeCDOBranch(branch);
- if (TRACER.isEnabled())
- {
- TRACER.format("Writing exactBranch: {0}", exactBranch); //$NON-NLS-1$
- }
-
- out.writeBoolean(exactBranch);
- }
- else
- {
- out.writeBoolean(false);
- }
- if (TRACER.isEnabled())
- {
- TRACER.format("Writing timeStamp: {0}", CDOCommonUtil.formatTimeStamp(timeStamp)); //$NON-NLS-1$
- }
-
- out.writeLong(timeStamp);
- if (TRACER.isEnabled())
- {
- TRACER.format("Writing exactTime: {0}", exactTime); //$NON-NLS-1$
- }
-
- out.writeBoolean(exactTime);
- }
-
- @Override
- protected Boolean confirming(CDODataInput in) throws IOException
- {
- while (in.readBoolean())
- {
- CDORevision revision = in.readCDORevision();
- if (TRACER.isEnabled())
- {
- TRACER.format("Read revision: {0}", revision); //$NON-NLS-1$
- }
-
- handler.handleRevision(revision);
- }
-
- return true;
- }
-}
+/* + * 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.net4j.protocol; + +import org.eclipse.emf.cdo.common.branch.CDOBranch; +import org.eclipse.emf.cdo.common.protocol.CDODataInput; +import org.eclipse.emf.cdo.common.protocol.CDODataOutput; +import org.eclipse.emf.cdo.common.protocol.CDOProtocolConstants; +import org.eclipse.emf.cdo.common.revision.CDORevision; +import org.eclipse.emf.cdo.common.revision.CDORevisionHandler; +import org.eclipse.emf.cdo.common.util.CDOCommonUtil; +import org.eclipse.emf.cdo.internal.net4j.bundle.OM; + +import org.eclipse.net4j.util.om.trace.ContextTracer; + +import org.eclipse.emf.ecore.EClass; + +import java.io.IOException; + +/** + * @author Eike Stepper + */ +public class HandleRevisionsRequest extends CDOClientRequest<Boolean> +{ + private static final ContextTracer TRACER = new ContextTracer(OM.DEBUG_PROTOCOL, HandleRevisionsRequest.class); + + private EClass eClass; + + private CDOBranch branch; + + private boolean exactBranch; + + private long timeStamp; + + private boolean exactTime; + + private CDORevisionHandler handler; + + public HandleRevisionsRequest(CDOClientProtocol protocol, EClass eClass, CDOBranch branch, boolean exactBranch, + long timeStamp, boolean exactTime, CDORevisionHandler handler) + { + super(protocol, CDOProtocolConstants.SIGNAL_HANDLE_REVISIONS); + this.eClass = eClass; + this.branch = branch; + this.exactBranch = exactBranch; + this.timeStamp = timeStamp; + this.exactTime = exactTime; + this.handler = handler; + } + + @Override + protected void requesting(CDODataOutput out) throws IOException + { + if (eClass != null) + { + out.writeBoolean(true); + if (TRACER.isEnabled()) + { + TRACER.format("Writing eClass: {0}", eClass); //$NON-NLS-1$ + } + + out.writeCDOClassifierRef(eClass); + } + else + { + out.writeBoolean(false); + } + + if (branch != null) + { + out.writeBoolean(true); + if (TRACER.isEnabled()) + { + TRACER.format("Writing branch: {0}", branch); //$NON-NLS-1$ + } + + out.writeCDOBranch(branch); + if (TRACER.isEnabled()) + { + TRACER.format("Writing exactBranch: {0}", exactBranch); //$NON-NLS-1$ + } + + out.writeBoolean(exactBranch); + } + else + { + out.writeBoolean(false); + } + if (TRACER.isEnabled()) + { + TRACER.format("Writing timeStamp: {0}", CDOCommonUtil.formatTimeStamp(timeStamp)); //$NON-NLS-1$ + } + + out.writeLong(timeStamp); + if (TRACER.isEnabled()) + { + TRACER.format("Writing exactTime: {0}", exactTime); //$NON-NLS-1$ + } + + out.writeBoolean(exactTime); + } + + @Override + protected Boolean confirming(CDODataInput in) throws IOException + { + while (in.readBoolean()) + { + CDORevision revision = in.readCDORevision(); + if (TRACER.isEnabled()) + { + TRACER.format("Read revision: {0}", revision); //$NON-NLS-1$ + } + + handler.handleRevision(revision); + } + + return true; + } +} diff --git a/plugins/org.eclipse.emf.cdo.net4j/src/org/eclipse/emf/cdo/internal/net4j/protocol/LoadBranchRequest.java b/plugins/org.eclipse.emf.cdo.net4j/src/org/eclipse/emf/cdo/internal/net4j/protocol/LoadBranchRequest.java index 379d10fd67..805e984d1f 100644 --- a/plugins/org.eclipse.emf.cdo.net4j/src/org/eclipse/emf/cdo/internal/net4j/protocol/LoadBranchRequest.java +++ b/plugins/org.eclipse.emf.cdo.net4j/src/org/eclipse/emf/cdo/internal/net4j/protocol/LoadBranchRequest.java @@ -1,44 +1,44 @@ -/*
- * 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.net4j.protocol;
-
-import org.eclipse.emf.cdo.common.protocol.CDODataInput;
-import org.eclipse.emf.cdo.common.protocol.CDODataOutput;
-import org.eclipse.emf.cdo.common.protocol.CDOProtocolConstants;
-import org.eclipse.emf.cdo.spi.common.branch.InternalCDOBranchManager.BranchLoader.BranchInfo;
-
-import java.io.IOException;
-
-/**
- * @author Eike Stepper
- */
-public class LoadBranchRequest extends CDOClientRequest<BranchInfo>
-{
- private int branchID;
-
- public LoadBranchRequest(CDOClientProtocol protocol, int branchID)
- {
- super(protocol, CDOProtocolConstants.SIGNAL_LOAD_BRANCH);
- this.branchID = branchID;
- }
-
- @Override
- protected void requesting(CDODataOutput out) throws IOException
- {
- out.writeInt(branchID);
- }
-
- @Override
- protected BranchInfo confirming(CDODataInput in) throws IOException
- {
- return new BranchInfo(in);
- }
-}
+/* + * 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.net4j.protocol; + +import org.eclipse.emf.cdo.common.protocol.CDODataInput; +import org.eclipse.emf.cdo.common.protocol.CDODataOutput; +import org.eclipse.emf.cdo.common.protocol.CDOProtocolConstants; +import org.eclipse.emf.cdo.spi.common.branch.InternalCDOBranchManager.BranchLoader.BranchInfo; + +import java.io.IOException; + +/** + * @author Eike Stepper + */ +public class LoadBranchRequest extends CDOClientRequest<BranchInfo> +{ + private int branchID; + + public LoadBranchRequest(CDOClientProtocol protocol, int branchID) + { + super(protocol, CDOProtocolConstants.SIGNAL_LOAD_BRANCH); + this.branchID = branchID; + } + + @Override + protected void requesting(CDODataOutput out) throws IOException + { + out.writeInt(branchID); + } + + @Override + protected BranchInfo confirming(CDODataInput in) throws IOException + { + return new BranchInfo(in); + } +} diff --git a/plugins/org.eclipse.emf.cdo.net4j/src/org/eclipse/emf/cdo/internal/net4j/protocol/LoadBranchesRequest.java b/plugins/org.eclipse.emf.cdo.net4j/src/org/eclipse/emf/cdo/internal/net4j/protocol/LoadBranchesRequest.java index 22e6a721f7..094f864795 100644 --- a/plugins/org.eclipse.emf.cdo.net4j/src/org/eclipse/emf/cdo/internal/net4j/protocol/LoadBranchesRequest.java +++ b/plugins/org.eclipse.emf.cdo.net4j/src/org/eclipse/emf/cdo/internal/net4j/protocol/LoadBranchesRequest.java @@ -1,60 +1,60 @@ -/*
- * 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.net4j.protocol;
-
-import org.eclipse.emf.cdo.common.branch.CDOBranch;
-import org.eclipse.emf.cdo.common.branch.CDOBranchHandler;
-import org.eclipse.emf.cdo.common.protocol.CDODataInput;
-import org.eclipse.emf.cdo.common.protocol.CDODataOutput;
-import org.eclipse.emf.cdo.common.protocol.CDOProtocolConstants;
-
-import java.io.IOException;
-
-/**
- * @author Eike Stepper
- */
-public class LoadBranchesRequest extends CDOClientRequest<Integer>
-{
- private int startID;
-
- private int endID;
-
- private CDOBranchHandler handler;
-
- public LoadBranchesRequest(CDOClientProtocol protocol, int startID, int endID, CDOBranchHandler handler)
- {
- super(protocol, CDOProtocolConstants.SIGNAL_LOAD_BRANCHES);
- this.startID = startID;
- this.endID = endID;
- this.handler = handler;
- }
-
- @Override
- protected void requesting(CDODataOutput out) throws IOException
- {
- out.writeInt(startID);
- out.writeInt(endID);
- }
-
- @Override
- protected Integer confirming(CDODataInput in) throws IOException
- {
- int count = 0;
- while (in.readByte() == CDOProtocolConstants.REPLICATE_BRANCH)
- {
- CDOBranch branch = in.readCDOBranch();
- handler.handleBranch(branch);
- ++count;
- }
-
- return count;
- }
-}
+/* + * 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.net4j.protocol; + +import org.eclipse.emf.cdo.common.branch.CDOBranch; +import org.eclipse.emf.cdo.common.branch.CDOBranchHandler; +import org.eclipse.emf.cdo.common.protocol.CDODataInput; +import org.eclipse.emf.cdo.common.protocol.CDODataOutput; +import org.eclipse.emf.cdo.common.protocol.CDOProtocolConstants; + +import java.io.IOException; + +/** + * @author Eike Stepper + */ +public class LoadBranchesRequest extends CDOClientRequest<Integer> +{ + private int startID; + + private int endID; + + private CDOBranchHandler handler; + + public LoadBranchesRequest(CDOClientProtocol protocol, int startID, int endID, CDOBranchHandler handler) + { + super(protocol, CDOProtocolConstants.SIGNAL_LOAD_BRANCHES); + this.startID = startID; + this.endID = endID; + this.handler = handler; + } + + @Override + protected void requesting(CDODataOutput out) throws IOException + { + out.writeInt(startID); + out.writeInt(endID); + } + + @Override + protected Integer confirming(CDODataInput in) throws IOException + { + int count = 0; + while (in.readByte() == CDOProtocolConstants.REPLICATE_BRANCH) + { + CDOBranch branch = in.readCDOBranch(); + handler.handleBranch(branch); + ++count; + } + + return count; + } +} diff --git a/plugins/org.eclipse.emf.cdo.net4j/src/org/eclipse/emf/cdo/internal/net4j/protocol/LoadChangeSetsRequest.java b/plugins/org.eclipse.emf.cdo.net4j/src/org/eclipse/emf/cdo/internal/net4j/protocol/LoadChangeSetsRequest.java index 7c952c68fc..62629ae1f1 100644 --- a/plugins/org.eclipse.emf.cdo.net4j/src/org/eclipse/emf/cdo/internal/net4j/protocol/LoadChangeSetsRequest.java +++ b/plugins/org.eclipse.emf.cdo.net4j/src/org/eclipse/emf/cdo/internal/net4j/protocol/LoadChangeSetsRequest.java @@ -1,57 +1,57 @@ -/*
- * 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.net4j.protocol;
-
-import org.eclipse.emf.cdo.common.branch.CDOBranchPointRange;
-import org.eclipse.emf.cdo.common.commit.CDOChangeSetData;
-import org.eclipse.emf.cdo.common.protocol.CDODataInput;
-import org.eclipse.emf.cdo.common.protocol.CDODataOutput;
-import org.eclipse.emf.cdo.common.protocol.CDOProtocolConstants;
-
-import java.io.IOException;
-
-/**
- * @author Eike Stepper
- */
-public class LoadChangeSetsRequest extends CDOClientRequest<CDOChangeSetData[]>
-{
- private CDOBranchPointRange[] ranges;
-
- public LoadChangeSetsRequest(CDOClientProtocol protocol, CDOBranchPointRange... ranges)
- {
- super(protocol, CDOProtocolConstants.SIGNAL_LOAD_CHANGE_SETS);
- this.ranges = ranges;
- }
-
- @Override
- protected void requesting(CDODataOutput out) throws IOException
- {
- out.writeInt(ranges.length);
- for (CDOBranchPointRange range : ranges)
- {
- out.writeCDOBranchPoint(range.getStartPoint());
- out.writeCDOBranchPoint(range.getEndPoint());
- }
- }
-
- @Override
- protected CDOChangeSetData[] confirming(CDODataInput in) throws IOException
- {
- CDOChangeSetData[] result = new CDOChangeSetData[ranges.length];
- for (int i = 0; i < result.length; i++)
- {
- CDOChangeSetData changeSetData = in.readCDOChangeSetData();
- result[i] = changeSetData;
- }
-
- return result;
- }
-}
+/* + * 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.net4j.protocol; + +import org.eclipse.emf.cdo.common.branch.CDOBranchPointRange; +import org.eclipse.emf.cdo.common.commit.CDOChangeSetData; +import org.eclipse.emf.cdo.common.protocol.CDODataInput; +import org.eclipse.emf.cdo.common.protocol.CDODataOutput; +import org.eclipse.emf.cdo.common.protocol.CDOProtocolConstants; + +import java.io.IOException; + +/** + * @author Eike Stepper + */ +public class LoadChangeSetsRequest extends CDOClientRequest<CDOChangeSetData[]> +{ + private CDOBranchPointRange[] ranges; + + public LoadChangeSetsRequest(CDOClientProtocol protocol, CDOBranchPointRange... ranges) + { + super(protocol, CDOProtocolConstants.SIGNAL_LOAD_CHANGE_SETS); + this.ranges = ranges; + } + + @Override + protected void requesting(CDODataOutput out) throws IOException + { + out.writeInt(ranges.length); + for (CDOBranchPointRange range : ranges) + { + out.writeCDOBranchPoint(range.getStartPoint()); + out.writeCDOBranchPoint(range.getEndPoint()); + } + } + + @Override + protected CDOChangeSetData[] confirming(CDODataInput in) throws IOException + { + CDOChangeSetData[] result = new CDOChangeSetData[ranges.length]; + for (int i = 0; i < result.length; i++) + { + CDOChangeSetData changeSetData = in.readCDOChangeSetData(); + result[i] = changeSetData; + } + + return result; + } +} diff --git a/plugins/org.eclipse.emf.cdo.net4j/src/org/eclipse/emf/cdo/internal/net4j/protocol/LoadChunkRequest.java b/plugins/org.eclipse.emf.cdo.net4j/src/org/eclipse/emf/cdo/internal/net4j/protocol/LoadChunkRequest.java index 4b43d7388a..ada38a676b 100644 --- a/plugins/org.eclipse.emf.cdo.net4j/src/org/eclipse/emf/cdo/internal/net4j/protocol/LoadChunkRequest.java +++ b/plugins/org.eclipse.emf.cdo.net4j/src/org/eclipse/emf/cdo/internal/net4j/protocol/LoadChunkRequest.java @@ -1,125 +1,125 @@ -/*
- * 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.net4j.protocol;
-
-import org.eclipse.emf.cdo.common.branch.CDOBranch;
-import org.eclipse.emf.cdo.common.id.CDOID;
-import org.eclipse.emf.cdo.common.model.CDOModelUtil;
-import org.eclipse.emf.cdo.common.model.CDOType;
-import org.eclipse.emf.cdo.common.protocol.CDODataInput;
-import org.eclipse.emf.cdo.common.protocol.CDODataOutput;
-import org.eclipse.emf.cdo.common.protocol.CDOProtocolConstants;
-import org.eclipse.emf.cdo.internal.net4j.bundle.OM;
-import org.eclipse.emf.cdo.spi.common.revision.InternalCDOList;
-import org.eclipse.emf.cdo.spi.common.revision.InternalCDORevision;
-
-import org.eclipse.net4j.util.om.trace.ContextTracer;
-
-import org.eclipse.emf.ecore.EStructuralFeature;
-
-import java.io.IOException;
-
-/**
- * @author Eike Stepper
- */
-public class LoadChunkRequest extends CDOClientRequest<Object>
-{
- private static final ContextTracer TRACER = new ContextTracer(OM.DEBUG_PROTOCOL, LoadChunkRequest.class);
-
- private InternalCDORevision revision;
-
- private EStructuralFeature feature;
-
- private int accessIndex;
-
- private int fromIndex;
-
- private int toIndex;
-
- private int fetchIndex;
-
- public LoadChunkRequest(CDOClientProtocol protocol, InternalCDORevision revision, EStructuralFeature feature,
- int accessIndex, int fetchIndex, int fromIndex, int toIndex)
- {
- super(protocol, CDOProtocolConstants.SIGNAL_LOAD_CHUNK);
- this.revision = revision;
- this.feature = feature;
- this.accessIndex = accessIndex;
- this.fetchIndex = fetchIndex;
- this.fromIndex = fromIndex;
- this.toIndex = toIndex;
- }
-
- @Override
- protected void requesting(CDODataOutput out) throws IOException
- {
- CDOID id = revision.getID();
- if (TRACER.isEnabled())
- {
- TRACER.format("Writing revision ID: {0}", id); //$NON-NLS-1$
- }
-
- out.writeCDOID(id);
- CDOBranch branch = revision.getBranch();
- if (TRACER.isEnabled())
- {
- TRACER.format("Writing branch: {0}", branch); //$NON-NLS-1$
- }
-
- out.writeCDOBranch(branch);
- int version = revision.getVersion();
- if (TRACER.isEnabled())
- {
- TRACER.format("Writing version: {0}", version); //$NON-NLS-1$
- }
-
- out.writeInt(version);
- if (TRACER.isEnabled())
- {
- TRACER.format("Writing feature: {0}", feature); //$NON-NLS-1$
- }
-
- out.writeCDOClassifierRef(feature.getEContainingClass());
- out.writeInt(feature.getFeatureID());
- if (TRACER.isEnabled())
- {
- TRACER.format("Writing fromIndex: {0}", fromIndex); //$NON-NLS-1$
- }
-
- int diffIndex = accessIndex - fetchIndex;
- out.writeInt(fromIndex - diffIndex);
- if (TRACER.isEnabled())
- {
- TRACER.format("Writing toIndex: {0}", toIndex); //$NON-NLS-1$
- }
-
- out.writeInt(toIndex - diffIndex);
- }
-
- @Override
- protected Object confirming(CDODataInput in) throws IOException
- {
- CDOType type = CDOModelUtil.getType(feature);
- Object accessID = null;
- InternalCDOList list = (InternalCDOList)revision.getList(feature);
- for (int i = fromIndex; i <= toIndex; i++)
- {
- Object value = type.readValue(in);
- list.setWithoutFrozenCheck(i, value);
- if (i == accessIndex)
- {
- accessID = value;
- }
- }
-
- return accessID;
- }
-}
+/* + * 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.net4j.protocol; + +import org.eclipse.emf.cdo.common.branch.CDOBranch; +import org.eclipse.emf.cdo.common.id.CDOID; +import org.eclipse.emf.cdo.common.model.CDOModelUtil; +import org.eclipse.emf.cdo.common.model.CDOType; +import org.eclipse.emf.cdo.common.protocol.CDODataInput; +import org.eclipse.emf.cdo.common.protocol.CDODataOutput; +import org.eclipse.emf.cdo.common.protocol.CDOProtocolConstants; +import org.eclipse.emf.cdo.internal.net4j.bundle.OM; +import org.eclipse.emf.cdo.spi.common.revision.InternalCDOList; +import org.eclipse.emf.cdo.spi.common.revision.InternalCDORevision; + +import org.eclipse.net4j.util.om.trace.ContextTracer; + +import org.eclipse.emf.ecore.EStructuralFeature; + +import java.io.IOException; + +/** + * @author Eike Stepper + */ +public class LoadChunkRequest extends CDOClientRequest<Object> +{ + private static final ContextTracer TRACER = new ContextTracer(OM.DEBUG_PROTOCOL, LoadChunkRequest.class); + + private InternalCDORevision revision; + + private EStructuralFeature feature; + + private int accessIndex; + + private int fromIndex; + + private int toIndex; + + private int fetchIndex; + + public LoadChunkRequest(CDOClientProtocol protocol, InternalCDORevision revision, EStructuralFeature feature, + int accessIndex, int fetchIndex, int fromIndex, int toIndex) + { + super(protocol, CDOProtocolConstants.SIGNAL_LOAD_CHUNK); + this.revision = revision; + this.feature = feature; + this.accessIndex = accessIndex; + this.fetchIndex = fetchIndex; + this.fromIndex = fromIndex; + this.toIndex = toIndex; + } + + @Override + protected void requesting(CDODataOutput out) throws IOException + { + CDOID id = revision.getID(); + if (TRACER.isEnabled()) + { + TRACER.format("Writing revision ID: {0}", id); //$NON-NLS-1$ + } + + out.writeCDOID(id); + CDOBranch branch = revision.getBranch(); + if (TRACER.isEnabled()) + { + TRACER.format("Writing branch: {0}", branch); //$NON-NLS-1$ + } + + out.writeCDOBranch(branch); + int version = revision.getVersion(); + if (TRACER.isEnabled()) + { + TRACER.format("Writing version: {0}", version); //$NON-NLS-1$ + } + + out.writeInt(version); + if (TRACER.isEnabled()) + { + TRACER.format("Writing feature: {0}", feature); //$NON-NLS-1$ + } + + out.writeCDOClassifierRef(feature.getEContainingClass()); + out.writeInt(feature.getFeatureID()); + if (TRACER.isEnabled()) + { + TRACER.format("Writing fromIndex: {0}", fromIndex); //$NON-NLS-1$ + } + + int diffIndex = accessIndex - fetchIndex; + out.writeInt(fromIndex - diffIndex); + if (TRACER.isEnabled()) + { + TRACER.format("Writing toIndex: {0}", toIndex); //$NON-NLS-1$ + } + + out.writeInt(toIndex - diffIndex); + } + + @Override + protected Object confirming(CDODataInput in) throws IOException + { + CDOType type = CDOModelUtil.getType(feature); + Object accessID = null; + InternalCDOList list = (InternalCDOList)revision.getList(feature); + for (int i = fromIndex; i <= toIndex; i++) + { + Object value = type.readValue(in); + list.setWithoutFrozenCheck(i, value); + if (i == accessIndex) + { + accessID = value; + } + } + + return accessID; + } +} diff --git a/plugins/org.eclipse.emf.cdo.net4j/src/org/eclipse/emf/cdo/internal/net4j/protocol/LoadCommitDataRequest.java b/plugins/org.eclipse.emf.cdo.net4j/src/org/eclipse/emf/cdo/internal/net4j/protocol/LoadCommitDataRequest.java index 43cb767d03..36b4b6e4e3 100644 --- a/plugins/org.eclipse.emf.cdo.net4j/src/org/eclipse/emf/cdo/internal/net4j/protocol/LoadCommitDataRequest.java +++ b/plugins/org.eclipse.emf.cdo.net4j/src/org/eclipse/emf/cdo/internal/net4j/protocol/LoadCommitDataRequest.java @@ -1,44 +1,44 @@ -/*
- * 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.net4j.protocol;
-
-import org.eclipse.emf.cdo.common.commit.CDOCommitData;
-import org.eclipse.emf.cdo.common.protocol.CDODataInput;
-import org.eclipse.emf.cdo.common.protocol.CDODataOutput;
-import org.eclipse.emf.cdo.common.protocol.CDOProtocolConstants;
-
-import java.io.IOException;
-
-/**
- * @author Eike Stepper
- */
-public class LoadCommitDataRequest extends CDOClientRequest<CDOCommitData>
-{
- private long timeStamp;
-
- public LoadCommitDataRequest(CDOClientProtocol protocol, long timeStamp)
- {
- super(protocol, CDOProtocolConstants.SIGNAL_LOAD_COMMIT_DATA);
- this.timeStamp = timeStamp;
- }
-
- @Override
- protected void requesting(CDODataOutput out) throws IOException
- {
- out.writeLong(timeStamp);
- }
-
- @Override
- protected CDOCommitData confirming(CDODataInput in) throws IOException
- {
- return in.readCDOCommitData();
- }
-}
+/* + * 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.net4j.protocol; + +import org.eclipse.emf.cdo.common.commit.CDOCommitData; +import org.eclipse.emf.cdo.common.protocol.CDODataInput; +import org.eclipse.emf.cdo.common.protocol.CDODataOutput; +import org.eclipse.emf.cdo.common.protocol.CDOProtocolConstants; + +import java.io.IOException; + +/** + * @author Eike Stepper + */ +public class LoadCommitDataRequest extends CDOClientRequest<CDOCommitData> +{ + private long timeStamp; + + public LoadCommitDataRequest(CDOClientProtocol protocol, long timeStamp) + { + super(protocol, CDOProtocolConstants.SIGNAL_LOAD_COMMIT_DATA); + this.timeStamp = timeStamp; + } + + @Override + protected void requesting(CDODataOutput out) throws IOException + { + out.writeLong(timeStamp); + } + + @Override + protected CDOCommitData confirming(CDODataInput in) throws IOException + { + return in.readCDOCommitData(); + } +} diff --git a/plugins/org.eclipse.emf.cdo.net4j/src/org/eclipse/emf/cdo/internal/net4j/protocol/LoadCommitInfosRequest.java b/plugins/org.eclipse.emf.cdo.net4j/src/org/eclipse/emf/cdo/internal/net4j/protocol/LoadCommitInfosRequest.java index 50724e0791..e5fd2b0ff8 100644 --- a/plugins/org.eclipse.emf.cdo.net4j/src/org/eclipse/emf/cdo/internal/net4j/protocol/LoadCommitInfosRequest.java +++ b/plugins/org.eclipse.emf.cdo.net4j/src/org/eclipse/emf/cdo/internal/net4j/protocol/LoadCommitInfosRequest.java @@ -1,89 +1,89 @@ -/*
- * 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.net4j.protocol;
-
-import org.eclipse.emf.cdo.common.branch.CDOBranch;
-import org.eclipse.emf.cdo.common.commit.CDOCommitInfo;
-import org.eclipse.emf.cdo.common.commit.CDOCommitInfoHandler;
-import org.eclipse.emf.cdo.common.protocol.CDODataInput;
-import org.eclipse.emf.cdo.common.protocol.CDODataOutput;
-import org.eclipse.emf.cdo.common.protocol.CDOProtocolConstants;
-import org.eclipse.emf.cdo.internal.net4j.bundle.OM;
-import org.eclipse.emf.cdo.spi.common.commit.InternalCDOCommitInfoManager;
-
-import java.io.IOException;
-
-/**
- * @author Eike Stepper
- */
-public class LoadCommitInfosRequest extends CDOClientRequest<Boolean>
-{
- private CDOBranch branch;
-
- private long startTime;
-
- private long endTime;
-
- private CDOCommitInfoHandler handler;
-
- public LoadCommitInfosRequest(CDOClientProtocol protocol, CDOBranch branch, long startTime, long endTime,
- CDOCommitInfoHandler handler)
- {
- super(protocol, CDOProtocolConstants.SIGNAL_LOAD_COMMIT_INFOS);
- this.branch = branch;
- this.startTime = startTime;
- this.endTime = endTime;
- this.handler = handler;
- }
-
- @Override
- protected void requesting(CDODataOutput out) throws IOException
- {
- if (branch == null)
- {
- out.writeBoolean(false);
- }
- else
- {
- out.writeBoolean(true);
- out.writeCDOBranch(branch);
- }
-
- out.writeLong(startTime);
- out.writeLong(endTime);
- }
-
- @Override
- protected Boolean confirming(CDODataInput in) throws IOException
- {
- InternalCDOCommitInfoManager manager = getSession().getCommitInfoManager();
- while (in.readBoolean())
- {
- long id = in.readLong();
- CDOBranch branch = this.branch == null ? in.readCDOBranch() : this.branch;
- long timeStamp = in.readLong();
- String userID = in.readString();
- String comment = in.readString();
-
- try
- {
- CDOCommitInfo commitInfo = manager.createCommitInfo(branch, timeStamp, id, userID, comment, null);
- handler.handleCommitInfo(commitInfo);
- }
- catch (Exception ex)
- {
- OM.LOG.error(ex);
- }
- }
-
- return true;
- }
-}
+/* + * 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.net4j.protocol; + +import org.eclipse.emf.cdo.common.branch.CDOBranch; +import org.eclipse.emf.cdo.common.commit.CDOCommitInfo; +import org.eclipse.emf.cdo.common.commit.CDOCommitInfoHandler; +import org.eclipse.emf.cdo.common.protocol.CDODataInput; +import org.eclipse.emf.cdo.common.protocol.CDODataOutput; +import org.eclipse.emf.cdo.common.protocol.CDOProtocolConstants; +import org.eclipse.emf.cdo.internal.net4j.bundle.OM; +import org.eclipse.emf.cdo.spi.common.commit.InternalCDOCommitInfoManager; + +import java.io.IOException; + +/** + * @author Eike Stepper + */ +public class LoadCommitInfosRequest extends CDOClientRequest<Boolean> +{ + private CDOBranch branch; + + private long startTime; + + private long endTime; + + private CDOCommitInfoHandler handler; + + public LoadCommitInfosRequest(CDOClientProtocol protocol, CDOBranch branch, long startTime, long endTime, + CDOCommitInfoHandler handler) + { + super(protocol, CDOProtocolConstants.SIGNAL_LOAD_COMMIT_INFOS); + this.branch = branch; + this.startTime = startTime; + this.endTime = endTime; + this.handler = handler; + } + + @Override + protected void requesting(CDODataOutput out) throws IOException + { + if (branch == null) + { + out.writeBoolean(false); + } + else + { + out.writeBoolean(true); + out.writeCDOBranch(branch); + } + + out.writeLong(startTime); + out.writeLong(endTime); + } + + @Override + protected Boolean confirming(CDODataInput in) throws IOException + { + InternalCDOCommitInfoManager manager = getSession().getCommitInfoManager(); + while (in.readBoolean()) + { + long id = in.readLong(); + CDOBranch branch = this.branch == null ? in.readCDOBranch() : this.branch; + long timeStamp = in.readLong(); + String userID = in.readString(); + String comment = in.readString(); + + try + { + CDOCommitInfo commitInfo = manager.createCommitInfo(branch, timeStamp, id, userID, comment, null); + handler.handleCommitInfo(commitInfo); + } + catch (Exception ex) + { + OM.LOG.error(ex); + } + } + + return true; + } +} diff --git a/plugins/org.eclipse.emf.cdo.net4j/src/org/eclipse/emf/cdo/internal/net4j/protocol/LoadLobRequest.java b/plugins/org.eclipse.emf.cdo.net4j/src/org/eclipse/emf/cdo/internal/net4j/protocol/LoadLobRequest.java index b2e24b26cf..0206cdccb2 100644 --- a/plugins/org.eclipse.emf.cdo.net4j/src/org/eclipse/emf/cdo/internal/net4j/protocol/LoadLobRequest.java +++ b/plugins/org.eclipse.emf.cdo.net4j/src/org/eclipse/emf/cdo/internal/net4j/protocol/LoadLobRequest.java @@ -1,68 +1,68 @@ -/*
- * 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.net4j.protocol;
-
-import org.eclipse.emf.cdo.common.lob.CDOLobInfo;
-import org.eclipse.emf.cdo.common.protocol.CDODataInput;
-import org.eclipse.emf.cdo.common.protocol.CDODataOutput;
-import org.eclipse.emf.cdo.common.protocol.CDOProtocolConstants;
-
-import org.eclipse.net4j.util.io.ExtendedDataInputStream;
-import org.eclipse.net4j.util.io.IOUtil;
-
-import java.io.IOException;
-import java.io.InputStreamReader;
-import java.io.OutputStream;
-import java.io.Writer;
-
-/**
- * @author Eike Stepper
- */
-public class LoadLobRequest extends CDOClientRequest<Boolean>
-{
- private CDOLobInfo info;
-
- private Object out;
-
- public LoadLobRequest(CDOClientProtocol protocol, CDOLobInfo info, Object out)
- {
- super(protocol, CDOProtocolConstants.SIGNAL_LOAD_LOB);
- this.info = info;
- this.out = out;
- }
-
- @Override
- protected void requesting(CDODataOutput out) throws IOException
- {
- out.writeByteArray(info.getID());
- }
-
- @Override
- protected Boolean confirming(ExtendedDataInputStream in) throws Exception
- {
- if (out instanceof OutputStream)
- {
- IOUtil.copyBinary(in, (OutputStream)out, info.getSize());
- }
- else
- {
- IOUtil.copyCharacter(new InputStreamReader(in), (Writer)out, info.getSize());
- }
-
- return true;
- }
-
- @Override
- protected Boolean confirming(CDODataInput in) throws IOException
- {
- 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.net4j.protocol; + +import org.eclipse.emf.cdo.common.lob.CDOLobInfo; +import org.eclipse.emf.cdo.common.protocol.CDODataInput; +import org.eclipse.emf.cdo.common.protocol.CDODataOutput; +import org.eclipse.emf.cdo.common.protocol.CDOProtocolConstants; + +import org.eclipse.net4j.util.io.ExtendedDataInputStream; +import org.eclipse.net4j.util.io.IOUtil; + +import java.io.IOException; +import java.io.InputStreamReader; +import java.io.OutputStream; +import java.io.Writer; + +/** + * @author Eike Stepper + */ +public class LoadLobRequest extends CDOClientRequest<Boolean> +{ + private CDOLobInfo info; + + private Object out; + + public LoadLobRequest(CDOClientProtocol protocol, CDOLobInfo info, Object out) + { + super(protocol, CDOProtocolConstants.SIGNAL_LOAD_LOB); + this.info = info; + this.out = out; + } + + @Override + protected void requesting(CDODataOutput out) throws IOException + { + out.writeByteArray(info.getID()); + } + + @Override + protected Boolean confirming(ExtendedDataInputStream in) throws Exception + { + if (out instanceof OutputStream) + { + IOUtil.copyBinary(in, (OutputStream)out, info.getSize()); + } + else + { + IOUtil.copyCharacter(new InputStreamReader(in), (Writer)out, info.getSize()); + } + + return true; + } + + @Override + protected Boolean confirming(CDODataInput in) throws IOException + { + throw new UnsupportedOperationException(); + } +} diff --git a/plugins/org.eclipse.emf.cdo.net4j/src/org/eclipse/emf/cdo/internal/net4j/protocol/LoadMergeDataRequest.java b/plugins/org.eclipse.emf.cdo.net4j/src/org/eclipse/emf/cdo/internal/net4j/protocol/LoadMergeDataRequest.java index beb11464ea..0b0e74ffda 100644 --- a/plugins/org.eclipse.emf.cdo.net4j/src/org/eclipse/emf/cdo/internal/net4j/protocol/LoadMergeDataRequest.java +++ b/plugins/org.eclipse.emf.cdo.net4j/src/org/eclipse/emf/cdo/internal/net4j/protocol/LoadMergeDataRequest.java @@ -1,217 +1,217 @@ -/*
- * 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.net4j.protocol;
-
-import org.eclipse.emf.cdo.common.id.CDOID;
-import org.eclipse.emf.cdo.common.protocol.CDODataInput;
-import org.eclipse.emf.cdo.common.protocol.CDODataOutput;
-import org.eclipse.emf.cdo.common.protocol.CDOProtocolConstants;
-import org.eclipse.emf.cdo.common.revision.CDORevision;
-import org.eclipse.emf.cdo.common.revision.CDORevisionKey;
-import org.eclipse.emf.cdo.spi.common.commit.CDORevisionAvailabilityInfo;
-
-import org.eclipse.net4j.util.om.monitor.OMMonitor;
-
-import java.io.IOException;
-import java.util.HashSet;
-import java.util.Iterator;
-import java.util.Map;
-import java.util.Set;
-
-/**
- * @author Eike Stepper
- */
-public class LoadMergeDataRequest extends CDOClientRequestWithMonitoring<Set<CDOID>>
-{
- private CDORevisionAvailabilityInfo targetInfo;
-
- private CDORevisionAvailabilityInfo sourceInfo;
-
- private CDORevisionAvailabilityInfo targetBaseInfo;
-
- private CDORevisionAvailabilityInfo sourceBaseInfo;
-
- private int infos;
-
- public LoadMergeDataRequest(CDOClientProtocol protocol, CDORevisionAvailabilityInfo targetInfo,
- CDORevisionAvailabilityInfo sourceInfo, CDORevisionAvailabilityInfo targetBaseInfo,
- CDORevisionAvailabilityInfo sourceBaseInfo)
- {
- super(protocol, CDOProtocolConstants.SIGNAL_LOAD_MERGE_DATA);
- this.targetInfo = targetInfo;
- this.sourceInfo = sourceInfo;
- this.targetBaseInfo = targetBaseInfo;
- this.sourceBaseInfo = sourceBaseInfo;
- infos = 2 + (targetBaseInfo != null ? 1 : 0) + (sourceBaseInfo != null ? 1 : 0);
- }
-
- @Override
- protected void requesting(CDODataOutput out, OMMonitor monitor) throws IOException
- {
- out.writeInt(infos);
- monitor.begin(infos);
-
- try
- {
- writeRevisionAvailabilityInfo(out, targetInfo, monitor.fork());
- writeRevisionAvailabilityInfo(out, sourceInfo, monitor.fork());
-
- if (infos > 2)
- {
- writeRevisionAvailabilityInfo(out, targetBaseInfo, monitor.fork());
- }
-
- if (infos > 3)
- {
- writeRevisionAvailabilityInfo(out, sourceBaseInfo, monitor.fork());
- }
- }
- finally
- {
- monitor.done();
- }
- }
-
- private void writeRevisionAvailabilityInfo(CDODataOutput out, CDORevisionAvailabilityInfo info, OMMonitor monitor)
- throws IOException
- {
- Set<CDOID> availableRevisions = info.getAvailableRevisions().keySet();
- int size = availableRevisions.size();
-
- out.writeCDOBranchPoint(info.getBranchPoint());
- out.writeInt(size);
-
- monitor.begin(size);
-
- try
- {
- for (CDOID id : availableRevisions)
- {
- out.writeCDOID(id);
- monitor.worked();
- }
- }
- finally
- {
- monitor.done();
- }
- }
-
- @Override
- protected Set<CDOID> confirming(CDODataInput in, OMMonitor monitor) throws IOException
- {
- Set<CDOID> result = new HashSet<CDOID>();
-
- int size = in.readInt();
- monitor.begin(size + infos);
-
- try
- {
- for (int i = 0; i < size; i++)
- {
- CDOID id = in.readCDOID();
- result.add(id);
- monitor.worked();
- }
-
- readRevisionAvailabilityInfo(in, targetInfo, result, monitor.fork());
- readRevisionAvailabilityInfo(in, sourceInfo, result, monitor.fork());
-
- if (infos > 2)
- {
- readRevisionAvailabilityInfo(in, targetBaseInfo, result, monitor.fork());
- }
-
- if (infos > 3)
- {
- readRevisionAvailabilityInfo(in, sourceBaseInfo, result, monitor.fork());
- }
-
- return result;
- }
- finally
- {
- monitor.done();
- }
- }
-
- private void readRevisionAvailabilityInfo(CDODataInput in, CDORevisionAvailabilityInfo info, Set<CDOID> result,
- OMMonitor monitor) throws IOException
- {
- int size = in.readInt();
- monitor.begin(size + 1);
-
- try
- {
- for (int i = 0; i < size; i++)
- {
- CDORevision revision;
- if (in.readBoolean())
- {
- revision = in.readCDORevision();
- }
- else
- {
- CDORevisionKey key = in.readCDORevisionKey();
- revision = getRevision(key, targetInfo);
-
- if (revision == null && sourceInfo != null)
- {
- revision = getRevision(key, sourceInfo);
- }
-
- if (revision == null && targetBaseInfo != null)
- {
- revision = getRevision(key, targetBaseInfo);
- }
-
- if (revision == null)
- {
- throw new IllegalStateException("Missing revision: " + key);
- }
- }
-
- info.addRevision(revision);
- monitor.worked();
- }
-
- Set<Map.Entry<CDOID, CDORevisionKey>> entrySet = info.getAvailableRevisions().entrySet();
- for (Iterator<Map.Entry<CDOID, CDORevisionKey>> it = entrySet.iterator(); it.hasNext();)
- {
- Map.Entry<CDOID, CDORevisionKey> entry = it.next();
- if (!result.contains(entry.getKey()))
- {
- it.remove();
- }
- }
-
- monitor.worked();
- }
- finally
- {
- monitor.done();
- }
- }
-
- private CDORevision getRevision(CDORevisionKey key, CDORevisionAvailabilityInfo info)
- {
- CDORevisionKey revision = info.getRevision(key.getID());
- if (revision instanceof CDORevision)
- {
- if (key.equals(revision))
- {
- return (CDORevision)revision;
- }
- }
-
- return 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 + */ +package org.eclipse.emf.cdo.internal.net4j.protocol; + +import org.eclipse.emf.cdo.common.id.CDOID; +import org.eclipse.emf.cdo.common.protocol.CDODataInput; +import org.eclipse.emf.cdo.common.protocol.CDODataOutput; +import org.eclipse.emf.cdo.common.protocol.CDOProtocolConstants; +import org.eclipse.emf.cdo.common.revision.CDORevision; +import org.eclipse.emf.cdo.common.revision.CDORevisionKey; +import org.eclipse.emf.cdo.spi.common.commit.CDORevisionAvailabilityInfo; + +import org.eclipse.net4j.util.om.monitor.OMMonitor; + +import java.io.IOException; +import java.util.HashSet; +import java.util.Iterator; +import java.util.Map; +import java.util.Set; + +/** + * @author Eike Stepper + */ +public class LoadMergeDataRequest extends CDOClientRequestWithMonitoring<Set<CDOID>> +{ + private CDORevisionAvailabilityInfo targetInfo; + + private CDORevisionAvailabilityInfo sourceInfo; + + private CDORevisionAvailabilityInfo targetBaseInfo; + + private CDORevisionAvailabilityInfo sourceBaseInfo; + + private int infos; + + public LoadMergeDataRequest(CDOClientProtocol protocol, CDORevisionAvailabilityInfo targetInfo, + CDORevisionAvailabilityInfo sourceInfo, CDORevisionAvailabilityInfo targetBaseInfo, + CDORevisionAvailabilityInfo sourceBaseInfo) + { + super(protocol, CDOProtocolConstants.SIGNAL_LOAD_MERGE_DATA); + this.targetInfo = targetInfo; + this.sourceInfo = sourceInfo; + this.targetBaseInfo = targetBaseInfo; + this.sourceBaseInfo = sourceBaseInfo; + infos = 2 + (targetBaseInfo != null ? 1 : 0) + (sourceBaseInfo != null ? 1 : 0); + } + + @Override + protected void requesting(CDODataOutput out, OMMonitor monitor) throws IOException + { + out.writeInt(infos); + monitor.begin(infos); + + try + { + writeRevisionAvailabilityInfo(out, targetInfo, monitor.fork()); + writeRevisionAvailabilityInfo(out, sourceInfo, monitor.fork()); + + if (infos > 2) + { + writeRevisionAvailabilityInfo(out, targetBaseInfo, monitor.fork()); + } + + if (infos > 3) + { + writeRevisionAvailabilityInfo(out, sourceBaseInfo, monitor.fork()); + } + } + finally + { + monitor.done(); + } + } + + private void writeRevisionAvailabilityInfo(CDODataOutput out, CDORevisionAvailabilityInfo info, OMMonitor monitor) + throws IOException + { + Set<CDOID> availableRevisions = info.getAvailableRevisions().keySet(); + int size = availableRevisions.size(); + + out.writeCDOBranchPoint(info.getBranchPoint()); + out.writeInt(size); + + monitor.begin(size); + + try + { + for (CDOID id : availableRevisions) + { + out.writeCDOID(id); + monitor.worked(); + } + } + finally + { + monitor.done(); + } + } + + @Override + protected Set<CDOID> confirming(CDODataInput in, OMMonitor monitor) throws IOException + { + Set<CDOID> result = new HashSet<CDOID>(); + + int size = in.readInt(); + monitor.begin(size + infos); + + try + { + for (int i = 0; i < size; i++) + { + CDOID id = in.readCDOID(); + result.add(id); + monitor.worked(); + } + + readRevisionAvailabilityInfo(in, targetInfo, result, monitor.fork()); + readRevisionAvailabilityInfo(in, sourceInfo, result, monitor.fork()); + + if (infos > 2) + { + readRevisionAvailabilityInfo(in, targetBaseInfo, result, monitor.fork()); + } + + if (infos > 3) + { + readRevisionAvailabilityInfo(in, sourceBaseInfo, result, monitor.fork()); + } + + return result; + } + finally + { + monitor.done(); + } + } + + private void readRevisionAvailabilityInfo(CDODataInput in, CDORevisionAvailabilityInfo info, Set<CDOID> result, + OMMonitor monitor) throws IOException + { + int size = in.readInt(); + monitor.begin(size + 1); + + try + { + for (int i = 0; i < size; i++) + { + CDORevision revision; + if (in.readBoolean()) + { + revision = in.readCDORevision(); + } + else + { + CDORevisionKey key = in.readCDORevisionKey(); + revision = getRevision(key, targetInfo); + + if (revision == null && sourceInfo != null) + { + revision = getRevision(key, sourceInfo); + } + + if (revision == null && targetBaseInfo != null) + { + revision = getRevision(key, targetBaseInfo); + } + + if (revision == null) + { + throw new IllegalStateException("Missing revision: " + key); + } + } + + info.addRevision(revision); + monitor.worked(); + } + + Set<Map.Entry<CDOID, CDORevisionKey>> entrySet = info.getAvailableRevisions().entrySet(); + for (Iterator<Map.Entry<CDOID, CDORevisionKey>> it = entrySet.iterator(); it.hasNext();) + { + Map.Entry<CDOID, CDORevisionKey> entry = it.next(); + if (!result.contains(entry.getKey())) + { + it.remove(); + } + } + + monitor.worked(); + } + finally + { + monitor.done(); + } + } + + private CDORevision getRevision(CDORevisionKey key, CDORevisionAvailabilityInfo info) + { + CDORevisionKey revision = info.getRevision(key.getID()); + if (revision instanceof CDORevision) + { + if (key.equals(revision)) + { + return (CDORevision)revision; + } + } + + return null; + } +} diff --git a/plugins/org.eclipse.emf.cdo.net4j/src/org/eclipse/emf/cdo/internal/net4j/protocol/LoadPackagesRequest.java b/plugins/org.eclipse.emf.cdo.net4j/src/org/eclipse/emf/cdo/internal/net4j/protocol/LoadPackagesRequest.java index be8f8981f1..e1b811b0ea 100644 --- a/plugins/org.eclipse.emf.cdo.net4j/src/org/eclipse/emf/cdo/internal/net4j/protocol/LoadPackagesRequest.java +++ b/plugins/org.eclipse.emf.cdo.net4j/src/org/eclipse/emf/cdo/internal/net4j/protocol/LoadPackagesRequest.java @@ -1,62 +1,62 @@ -/*
- * 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.net4j.protocol;
-
-import org.eclipse.emf.cdo.common.model.CDOModelUtil;
-import org.eclipse.emf.cdo.common.model.EMFUtil;
-import org.eclipse.emf.cdo.common.protocol.CDODataInput;
-import org.eclipse.emf.cdo.common.protocol.CDODataOutput;
-import org.eclipse.emf.cdo.common.protocol.CDOProtocolConstants;
-import org.eclipse.emf.cdo.internal.net4j.bundle.OM;
-import org.eclipse.emf.cdo.spi.common.model.InternalCDOPackageUnit;
-
-import org.eclipse.net4j.util.om.trace.ContextTracer;
-
-import org.eclipse.emf.ecore.EPackage;
-import org.eclipse.emf.ecore.resource.ResourceSet;
-
-import java.io.IOException;
-
-/**
- * @author Eike Stepper
- */
-public class LoadPackagesRequest extends CDOClientRequest<EPackage[]>
-{
- private static final ContextTracer TRACER = new ContextTracer(OM.DEBUG_PROTOCOL, LoadPackagesRequest.class);
-
- private InternalCDOPackageUnit packageUnit;
-
- public LoadPackagesRequest(CDOClientProtocol protocol, InternalCDOPackageUnit packageUnit)
- {
- super(protocol, CDOProtocolConstants.SIGNAL_LOAD_PACKAGES);
- this.packageUnit = packageUnit;
- }
-
- @Override
- protected void requesting(CDODataOutput out) throws IOException
- {
- String packageUnitID = packageUnit.getID();
- if (TRACER.isEnabled())
- {
- TRACER.format("Writing packageUnitID: {0}", packageUnitID); //$NON-NLS-1$
- }
-
- out.writeCDOPackageURI(packageUnitID);
- }
-
- @Override
- protected EPackage[] confirming(CDODataInput in) throws IOException
- {
- ResourceSet resourceSet = EMFUtil.newEcoreResourceSet(packageUnit.getPackageRegistry());
- EPackage ePackage = CDOModelUtil.readPackage(in, resourceSet, false);
- return EMFUtil.getAllPackages(ePackage);
- }
-}
+/* + * 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.net4j.protocol; + +import org.eclipse.emf.cdo.common.model.CDOModelUtil; +import org.eclipse.emf.cdo.common.model.EMFUtil; +import org.eclipse.emf.cdo.common.protocol.CDODataInput; +import org.eclipse.emf.cdo.common.protocol.CDODataOutput; +import org.eclipse.emf.cdo.common.protocol.CDOProtocolConstants; +import org.eclipse.emf.cdo.internal.net4j.bundle.OM; +import org.eclipse.emf.cdo.spi.common.model.InternalCDOPackageUnit; + +import org.eclipse.net4j.util.om.trace.ContextTracer; + +import org.eclipse.emf.ecore.EPackage; +import org.eclipse.emf.ecore.resource.ResourceSet; + +import java.io.IOException; + +/** + * @author Eike Stepper + */ +public class LoadPackagesRequest extends CDOClientRequest<EPackage[]> +{ + private static final ContextTracer TRACER = new ContextTracer(OM.DEBUG_PROTOCOL, LoadPackagesRequest.class); + + private InternalCDOPackageUnit packageUnit; + + public LoadPackagesRequest(CDOClientProtocol protocol, InternalCDOPackageUnit packageUnit) + { + super(protocol, CDOProtocolConstants.SIGNAL_LOAD_PACKAGES); + this.packageUnit = packageUnit; + } + + @Override + protected void requesting(CDODataOutput out) throws IOException + { + String packageUnitID = packageUnit.getID(); + if (TRACER.isEnabled()) + { + TRACER.format("Writing packageUnitID: {0}", packageUnitID); //$NON-NLS-1$ + } + + out.writeCDOPackageURI(packageUnitID); + } + + @Override + protected EPackage[] confirming(CDODataInput in) throws IOException + { + ResourceSet resourceSet = EMFUtil.newEcoreResourceSet(packageUnit.getPackageRegistry()); + EPackage ePackage = CDOModelUtil.readPackage(in, resourceSet, false); + return EMFUtil.getAllPackages(ePackage); + } +} diff --git a/plugins/org.eclipse.emf.cdo.net4j/src/org/eclipse/emf/cdo/internal/net4j/protocol/LoadRevisionByVersionRequest.java b/plugins/org.eclipse.emf.cdo.net4j/src/org/eclipse/emf/cdo/internal/net4j/protocol/LoadRevisionByVersionRequest.java index d25270f92b..2624cc50bc 100644 --- a/plugins/org.eclipse.emf.cdo.net4j/src/org/eclipse/emf/cdo/internal/net4j/protocol/LoadRevisionByVersionRequest.java +++ b/plugins/org.eclipse.emf.cdo.net4j/src/org/eclipse/emf/cdo/internal/net4j/protocol/LoadRevisionByVersionRequest.java @@ -1,84 +1,84 @@ -/*
- * 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.net4j.protocol;
-
-import org.eclipse.emf.cdo.common.branch.CDOBranchVersion;
-import org.eclipse.emf.cdo.common.id.CDOID;
-import org.eclipse.emf.cdo.common.protocol.CDODataInput;
-import org.eclipse.emf.cdo.common.protocol.CDODataOutput;
-import org.eclipse.emf.cdo.common.protocol.CDOProtocolConstants;
-import org.eclipse.emf.cdo.internal.net4j.bundle.OM;
-import org.eclipse.emf.cdo.spi.common.revision.InternalCDORevision;
-import org.eclipse.emf.cdo.spi.common.revision.RevisionInfo;
-
-import org.eclipse.net4j.util.om.trace.ContextTracer;
-
-import java.io.IOException;
-import java.text.MessageFormat;
-
-/**
- * @author Eike Stepper
- */
-public class LoadRevisionByVersionRequest extends CDOClientRequest<InternalCDORevision>
-{
- private static final ContextTracer TRACER = new ContextTracer(OM.DEBUG_PROTOCOL, LoadRevisionByVersionRequest.class);
-
- private CDOID id;
-
- private CDOBranchVersion branchVersion;
-
- private int referenceChunk;
-
- public LoadRevisionByVersionRequest(CDOClientProtocol protocol, CDOID id, CDOBranchVersion branchVersion,
- int referenceChunk)
- {
- super(protocol, CDOProtocolConstants.SIGNAL_LOAD_REVISION_BY_VERSION);
- this.id = id;
- this.branchVersion = branchVersion;
- this.referenceChunk = referenceChunk;
- }
-
- @Override
- protected void requesting(CDODataOutput out) throws IOException
- {
- if (TRACER.isEnabled())
- {
- TRACER.format("Writing id: {0}", id); //$NON-NLS-1$
- }
-
- out.writeCDOID(id);
- if (TRACER.isEnabled())
- {
- TRACER.format("Writing branchVersion: {0}", branchVersion); //$NON-NLS-1$
- }
-
- out.writeCDOBranchVersion(branchVersion);
- if (TRACER.isEnabled())
- {
- TRACER.format("Writing referenceChunk: {0}", referenceChunk); //$NON-NLS-1$
- }
-
- out.writeInt(referenceChunk);
- }
-
- @Override
- protected InternalCDORevision confirming(CDODataInput in) throws IOException
- {
- return RevisionInfo.readResult(in, id, branchVersion.getBranch());
- }
-
- @Override
- public String toString()
- {
- return MessageFormat.format("LoadRevisionByVersionRequest(id={0}, branchVersion={1}, referenceChunk={2})", id,
- branchVersion, referenceChunk);
- }
-}
+/* + * 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.net4j.protocol; + +import org.eclipse.emf.cdo.common.branch.CDOBranchVersion; +import org.eclipse.emf.cdo.common.id.CDOID; +import org.eclipse.emf.cdo.common.protocol.CDODataInput; +import org.eclipse.emf.cdo.common.protocol.CDODataOutput; +import org.eclipse.emf.cdo.common.protocol.CDOProtocolConstants; +import org.eclipse.emf.cdo.internal.net4j.bundle.OM; +import org.eclipse.emf.cdo.spi.common.revision.InternalCDORevision; +import org.eclipse.emf.cdo.spi.common.revision.RevisionInfo; + +import org.eclipse.net4j.util.om.trace.ContextTracer; + +import java.io.IOException; +import java.text.MessageFormat; + +/** + * @author Eike Stepper + */ +public class LoadRevisionByVersionRequest extends CDOClientRequest<InternalCDORevision> +{ + private static final ContextTracer TRACER = new ContextTracer(OM.DEBUG_PROTOCOL, LoadRevisionByVersionRequest.class); + + private CDOID id; + + private CDOBranchVersion branchVersion; + + private int referenceChunk; + + public LoadRevisionByVersionRequest(CDOClientProtocol protocol, CDOID id, CDOBranchVersion branchVersion, + int referenceChunk) + { + super(protocol, CDOProtocolConstants.SIGNAL_LOAD_REVISION_BY_VERSION); + this.id = id; + this.branchVersion = branchVersion; + this.referenceChunk = referenceChunk; + } + + @Override + protected void requesting(CDODataOutput out) throws IOException + { + if (TRACER.isEnabled()) + { + TRACER.format("Writing id: {0}", id); //$NON-NLS-1$ + } + + out.writeCDOID(id); + if (TRACER.isEnabled()) + { + TRACER.format("Writing branchVersion: {0}", branchVersion); //$NON-NLS-1$ + } + + out.writeCDOBranchVersion(branchVersion); + if (TRACER.isEnabled()) + { + TRACER.format("Writing referenceChunk: {0}", referenceChunk); //$NON-NLS-1$ + } + + out.writeInt(referenceChunk); + } + + @Override + protected InternalCDORevision confirming(CDODataInput in) throws IOException + { + return RevisionInfo.readResult(in, id, branchVersion.getBranch()); + } + + @Override + public String toString() + { + return MessageFormat.format("LoadRevisionByVersionRequest(id={0}, branchVersion={1}, referenceChunk={2})", id, + branchVersion, referenceChunk); + } +} diff --git a/plugins/org.eclipse.emf.cdo.net4j/src/org/eclipse/emf/cdo/internal/net4j/protocol/LoadSubBranchesRequest.java b/plugins/org.eclipse.emf.cdo.net4j/src/org/eclipse/emf/cdo/internal/net4j/protocol/LoadSubBranchesRequest.java index 9bb0573e19..db612a1a7a 100644 --- a/plugins/org.eclipse.emf.cdo.net4j/src/org/eclipse/emf/cdo/internal/net4j/protocol/LoadSubBranchesRequest.java +++ b/plugins/org.eclipse.emf.cdo.net4j/src/org/eclipse/emf/cdo/internal/net4j/protocol/LoadSubBranchesRequest.java @@ -1,51 +1,51 @@ -/*
- * 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.net4j.protocol;
-
-import org.eclipse.emf.cdo.common.protocol.CDODataInput;
-import org.eclipse.emf.cdo.common.protocol.CDODataOutput;
-import org.eclipse.emf.cdo.common.protocol.CDOProtocolConstants;
-import org.eclipse.emf.cdo.spi.common.branch.InternalCDOBranchManager.BranchLoader.SubBranchInfo;
-
-import java.io.IOException;
-
-/**
- * @author Eike Stepper
- */
-public class LoadSubBranchesRequest extends CDOClientRequest<SubBranchInfo[]>
-{
- private int branchID;
-
- public LoadSubBranchesRequest(CDOClientProtocol protocol, int branchID)
- {
- super(protocol, CDOProtocolConstants.SIGNAL_LOAD_SUB_BRANCHES);
- this.branchID = branchID;
- }
-
- @Override
- protected void requesting(CDODataOutput out) throws IOException
- {
- out.writeInt(branchID);
- }
-
- @Override
- protected SubBranchInfo[] confirming(CDODataInput in) throws IOException
- {
- int size = in.readInt();
- SubBranchInfo[] infos = new SubBranchInfo[size];
- for (int i = 0; i < infos.length; i++)
- {
- infos[i] = new SubBranchInfo(in);
- }
-
- return infos;
- }
-}
+/* + * 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.net4j.protocol; + +import org.eclipse.emf.cdo.common.protocol.CDODataInput; +import org.eclipse.emf.cdo.common.protocol.CDODataOutput; +import org.eclipse.emf.cdo.common.protocol.CDOProtocolConstants; +import org.eclipse.emf.cdo.spi.common.branch.InternalCDOBranchManager.BranchLoader.SubBranchInfo; + +import java.io.IOException; + +/** + * @author Eike Stepper + */ +public class LoadSubBranchesRequest extends CDOClientRequest<SubBranchInfo[]> +{ + private int branchID; + + public LoadSubBranchesRequest(CDOClientProtocol protocol, int branchID) + { + super(protocol, CDOProtocolConstants.SIGNAL_LOAD_SUB_BRANCHES); + this.branchID = branchID; + } + + @Override + protected void requesting(CDODataOutput out) throws IOException + { + out.writeInt(branchID); + } + + @Override + protected SubBranchInfo[] confirming(CDODataInput in) throws IOException + { + int size = in.readInt(); + SubBranchInfo[] infos = new SubBranchInfo[size]; + for (int i = 0; i < infos.length; i++) + { + infos[i] = new SubBranchInfo(in); + } + + return infos; + } +} diff --git a/plugins/org.eclipse.emf.cdo.net4j/src/org/eclipse/emf/cdo/internal/net4j/protocol/LockAreaRequest.java b/plugins/org.eclipse.emf.cdo.net4j/src/org/eclipse/emf/cdo/internal/net4j/protocol/LockAreaRequest.java index e65225c30d..90a36c5485 100644 --- a/plugins/org.eclipse.emf.cdo.net4j/src/org/eclipse/emf/cdo/internal/net4j/protocol/LockAreaRequest.java +++ b/plugins/org.eclipse.emf.cdo.net4j/src/org/eclipse/emf/cdo/internal/net4j/protocol/LockAreaRequest.java @@ -1,48 +1,48 @@ -/*
- * 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.net4j.protocol;
-
-import org.eclipse.emf.cdo.common.protocol.CDODataInput;
-import org.eclipse.emf.cdo.common.protocol.CDODataOutput;
-import org.eclipse.emf.cdo.common.protocol.CDOProtocolConstants;
-import org.eclipse.emf.cdo.view.CDOView;
-
-import java.io.IOException;
-
-/**
- * @author Eike Stepper
- */
-public class LockAreaRequest extends CDOClientRequest<String>
-{
- private CDOView view;
-
- private boolean create;
-
- public LockAreaRequest(CDOClientProtocol protocol, CDOView view, boolean create)
- {
- super(protocol, CDOProtocolConstants.SIGNAL_LOCK_AREA);
- this.view = view;
- this.create = create;
- }
-
- @Override
- protected void requesting(CDODataOutput out) throws IOException
- {
- out.writeInt(view.getViewID());
- out.writeBoolean(create);
- }
-
- @Override
- protected String confirming(CDODataInput in) throws IOException
- {
- return in.readString();
- }
-}
+/* + * 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.net4j.protocol; + +import org.eclipse.emf.cdo.common.protocol.CDODataInput; +import org.eclipse.emf.cdo.common.protocol.CDODataOutput; +import org.eclipse.emf.cdo.common.protocol.CDOProtocolConstants; +import org.eclipse.emf.cdo.view.CDOView; + +import java.io.IOException; + +/** + * @author Eike Stepper + */ +public class LockAreaRequest extends CDOClientRequest<String> +{ + private CDOView view; + + private boolean create; + + public LockAreaRequest(CDOClientProtocol protocol, CDOView view, boolean create) + { + super(protocol, CDOProtocolConstants.SIGNAL_LOCK_AREA); + this.view = view; + this.create = create; + } + + @Override + protected void requesting(CDODataOutput out) throws IOException + { + out.writeInt(view.getViewID()); + out.writeBoolean(create); + } + + @Override + protected String confirming(CDODataInput in) throws IOException + { + return in.readString(); + } +} diff --git a/plugins/org.eclipse.emf.cdo.net4j/src/org/eclipse/emf/cdo/internal/net4j/protocol/LockDelegationRequest.java b/plugins/org.eclipse.emf.cdo.net4j/src/org/eclipse/emf/cdo/internal/net4j/protocol/LockDelegationRequest.java index 5b59cbafa4..9dc23ccbc9 100644 --- a/plugins/org.eclipse.emf.cdo.net4j/src/org/eclipse/emf/cdo/internal/net4j/protocol/LockDelegationRequest.java +++ b/plugins/org.eclipse.emf.cdo.net4j/src/org/eclipse/emf/cdo/internal/net4j/protocol/LockDelegationRequest.java @@ -1,47 +1,47 @@ -/*
- * 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:
- * Caspar De Groot - initial API and implementation
- */
-package org.eclipse.emf.cdo.internal.net4j.protocol;
-
-import org.eclipse.emf.cdo.common.branch.CDOBranch;
-import org.eclipse.emf.cdo.common.protocol.CDODataOutput;
-import org.eclipse.emf.cdo.common.protocol.CDOProtocolConstants;
-import org.eclipse.emf.cdo.common.revision.CDORevisionKey;
-
-import org.eclipse.net4j.util.concurrent.IRWLockManager.LockType;
-
-import java.io.IOException;
-import java.util.List;
-
-/**
- * @author Caspar De Groot
- */
-public class LockDelegationRequest extends LockObjectsRequest
-{
- private String lockAreaID;
-
- private CDOBranch viewedBranch;
-
- public LockDelegationRequest(CDOClientProtocol protocol, String lockAreaID, List<CDORevisionKey> revisionKeys,
- CDOBranch viewedBranch, LockType lockType, boolean recursive, long timeout)
- {
- super(protocol, CDOProtocolConstants.SIGNAL_LOCK_DELEGATION, revisionKeys, 0, lockType, recursive, timeout);
- this.lockAreaID = lockAreaID;
- this.viewedBranch = viewedBranch;
- }
-
- @Override
- protected void requesting(CDODataOutput out) throws IOException
- {
- out.writeString(lockAreaID);
- out.writeCDOBranch(viewedBranch);
- super.requesting(out);
- }
-}
+/* + * 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: + * Caspar De Groot - initial API and implementation + */ +package org.eclipse.emf.cdo.internal.net4j.protocol; + +import org.eclipse.emf.cdo.common.branch.CDOBranch; +import org.eclipse.emf.cdo.common.protocol.CDODataOutput; +import org.eclipse.emf.cdo.common.protocol.CDOProtocolConstants; +import org.eclipse.emf.cdo.common.revision.CDORevisionKey; + +import org.eclipse.net4j.util.concurrent.IRWLockManager.LockType; + +import java.io.IOException; +import java.util.List; + +/** + * @author Caspar De Groot + */ +public class LockDelegationRequest extends LockObjectsRequest +{ + private String lockAreaID; + + private CDOBranch viewedBranch; + + public LockDelegationRequest(CDOClientProtocol protocol, String lockAreaID, List<CDORevisionKey> revisionKeys, + CDOBranch viewedBranch, LockType lockType, boolean recursive, long timeout) + { + super(protocol, CDOProtocolConstants.SIGNAL_LOCK_DELEGATION, revisionKeys, 0, lockType, recursive, timeout); + this.lockAreaID = lockAreaID; + this.viewedBranch = viewedBranch; + } + + @Override + protected void requesting(CDODataOutput out) throws IOException + { + out.writeString(lockAreaID); + out.writeCDOBranch(viewedBranch); + super.requesting(out); + } +} diff --git a/plugins/org.eclipse.emf.cdo.net4j/src/org/eclipse/emf/cdo/internal/net4j/protocol/LockNotificationIndication.java b/plugins/org.eclipse.emf.cdo.net4j/src/org/eclipse/emf/cdo/internal/net4j/protocol/LockNotificationIndication.java index 568c3e4d8b..ec04b5da28 100644 --- a/plugins/org.eclipse.emf.cdo.net4j/src/org/eclipse/emf/cdo/internal/net4j/protocol/LockNotificationIndication.java +++ b/plugins/org.eclipse.emf.cdo.net4j/src/org/eclipse/emf/cdo/internal/net4j/protocol/LockNotificationIndication.java @@ -1,38 +1,38 @@ -/*
- * 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:
- * Caspar De Groot - initial API and implementation
- */
-package org.eclipse.emf.cdo.internal.net4j.protocol;
-
-import org.eclipse.emf.cdo.common.lock.CDOLockChangeInfo;
-import org.eclipse.emf.cdo.common.protocol.CDODataInput;
-import org.eclipse.emf.cdo.common.protocol.CDOProtocolConstants;
-
-import org.eclipse.emf.spi.cdo.InternalCDOSession;
-
-import java.io.IOException;
-
-/**
- * @author Caspar De Groot
- */
-public class LockNotificationIndication extends CDOClientIndication
-{
- public LockNotificationIndication(CDOClientProtocol protocol)
- {
- super(protocol, CDOProtocolConstants.SIGNAL_LOCK_NOTIFICATION);
- }
-
- @Override
- protected void indicating(CDODataInput in) throws IOException
- {
- CDOLockChangeInfo lockChangeInfo = in.readCDOLockChangeInfo();
- InternalCDOSession session = getSession();
- session.handleLockNotification(lockChangeInfo, 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: + * Caspar De Groot - initial API and implementation + */ +package org.eclipse.emf.cdo.internal.net4j.protocol; + +import org.eclipse.emf.cdo.common.lock.CDOLockChangeInfo; +import org.eclipse.emf.cdo.common.protocol.CDODataInput; +import org.eclipse.emf.cdo.common.protocol.CDOProtocolConstants; + +import org.eclipse.emf.spi.cdo.InternalCDOSession; + +import java.io.IOException; + +/** + * @author Caspar De Groot + */ +public class LockNotificationIndication extends CDOClientIndication +{ + public LockNotificationIndication(CDOClientProtocol protocol) + { + super(protocol, CDOProtocolConstants.SIGNAL_LOCK_NOTIFICATION); + } + + @Override + protected void indicating(CDODataInput in) throws IOException + { + CDOLockChangeInfo lockChangeInfo = in.readCDOLockChangeInfo(); + InternalCDOSession session = getSession(); + session.handleLockNotification(lockChangeInfo, null); + } +} diff --git a/plugins/org.eclipse.emf.cdo.net4j/src/org/eclipse/emf/cdo/internal/net4j/protocol/LockObjectsRequest.java b/plugins/org.eclipse.emf.cdo.net4j/src/org/eclipse/emf/cdo/internal/net4j/protocol/LockObjectsRequest.java index b7c8b2ef9f..fbbf1e2537 100644 --- a/plugins/org.eclipse.emf.cdo.net4j/src/org/eclipse/emf/cdo/internal/net4j/protocol/LockObjectsRequest.java +++ b/plugins/org.eclipse.emf.cdo.net4j/src/org/eclipse/emf/cdo/internal/net4j/protocol/LockObjectsRequest.java @@ -1,103 +1,103 @@ -/*
- * 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
- * Caspar De Groot - maintenance
- */
-package org.eclipse.emf.cdo.internal.net4j.protocol;
-
-import org.eclipse.emf.cdo.common.lock.CDOLockState;
-import org.eclipse.emf.cdo.common.protocol.CDODataInput;
-import org.eclipse.emf.cdo.common.protocol.CDODataOutput;
-import org.eclipse.emf.cdo.common.protocol.CDOProtocolConstants;
-import org.eclipse.emf.cdo.common.revision.CDORevisionKey;
-
-import org.eclipse.net4j.util.concurrent.IRWLockManager;
-import org.eclipse.net4j.util.concurrent.IRWLockManager.LockType;
-
-import org.eclipse.emf.spi.cdo.CDOSessionProtocol.LockObjectsResult;
-
-import java.io.IOException;
-import java.util.List;
-
-/**
- * @author Eike Stepper, Caspar De Groot
- */
-public class LockObjectsRequest extends CDOClientRequest<LockObjectsResult>
-{
- private int viewID;
-
- private IRWLockManager.LockType lockType;
-
- private long timeout;
-
- private List<CDORevisionKey> revisionKeys;
-
- private boolean recursive;
-
- public LockObjectsRequest(CDOClientProtocol protocol, List<CDORevisionKey> revisionKeys, int viewID,
- LockType lockType, boolean recursive, long timeout)
- {
- this(protocol, CDOProtocolConstants.SIGNAL_LOCK_OBJECTS, revisionKeys, viewID, lockType, recursive, timeout);
- }
-
- protected LockObjectsRequest(CDOClientProtocol protocol, short signalID, List<CDORevisionKey> revisionKeys,
- int viewID, LockType lockType, boolean recursive, long timeout)
- {
- super(protocol, signalID);
-
- this.viewID = viewID;
- this.lockType = lockType;
- this.timeout = timeout;
- this.revisionKeys = revisionKeys;
- this.recursive = recursive;
- }
-
- @Override
- protected void requesting(CDODataOutput out) throws IOException
- {
- out.writeInt(viewID);
- out.writeCDOLockType(lockType);
- out.writeBoolean(recursive);
- out.writeLong(timeout);
-
- out.writeInt(revisionKeys.size());
- for (CDORevisionKey revKey : revisionKeys)
- {
- out.writeCDORevisionKey(revKey);
- }
- }
-
- @Override
- protected LockObjectsResult confirming(CDODataInput in) throws IOException
- {
- boolean succesful = in.readBoolean();
- boolean timeout = in.readBoolean();
- boolean waitForUpdate = in.readBoolean();
- long requiredTimestamp = in.readLong();
-
- int nStaleRevisions = in.readInt();
- CDORevisionKey[] staleRevisions = new CDORevisionKey[nStaleRevisions];
- for (int i = 0; i < nStaleRevisions; i++)
- {
- staleRevisions[i] = in.readCDORevisionKey();
- }
-
- long timestamp = in.readLong();
-
- int n = in.readInt();
- CDOLockState[] newLockStates = new CDOLockState[n];
- for (int i = 0; i < n; i++)
- {
- newLockStates[i] = in.readCDOLockState();
- }
-
- return new LockObjectsResult(succesful, timeout, waitForUpdate, requiredTimestamp, staleRevisions, newLockStates,
- timestamp);
- }
-}
+/* + * 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 + * Caspar De Groot - maintenance + */ +package org.eclipse.emf.cdo.internal.net4j.protocol; + +import org.eclipse.emf.cdo.common.lock.CDOLockState; +import org.eclipse.emf.cdo.common.protocol.CDODataInput; +import org.eclipse.emf.cdo.common.protocol.CDODataOutput; +import org.eclipse.emf.cdo.common.protocol.CDOProtocolConstants; +import org.eclipse.emf.cdo.common.revision.CDORevisionKey; + +import org.eclipse.net4j.util.concurrent.IRWLockManager; +import org.eclipse.net4j.util.concurrent.IRWLockManager.LockType; + +import org.eclipse.emf.spi.cdo.CDOSessionProtocol.LockObjectsResult; + +import java.io.IOException; +import java.util.List; + +/** + * @author Eike Stepper, Caspar De Groot + */ +public class LockObjectsRequest extends CDOClientRequest<LockObjectsResult> +{ + private int viewID; + + private IRWLockManager.LockType lockType; + + private long timeout; + + private List<CDORevisionKey> revisionKeys; + + private boolean recursive; + + public LockObjectsRequest(CDOClientProtocol protocol, List<CDORevisionKey> revisionKeys, int viewID, + LockType lockType, boolean recursive, long timeout) + { + this(protocol, CDOProtocolConstants.SIGNAL_LOCK_OBJECTS, revisionKeys, viewID, lockType, recursive, timeout); + } + + protected LockObjectsRequest(CDOClientProtocol protocol, short signalID, List<CDORevisionKey> revisionKeys, + int viewID, LockType lockType, boolean recursive, long timeout) + { + super(protocol, signalID); + + this.viewID = viewID; + this.lockType = lockType; + this.timeout = timeout; + this.revisionKeys = revisionKeys; + this.recursive = recursive; + } + + @Override + protected void requesting(CDODataOutput out) throws IOException + { + out.writeInt(viewID); + out.writeCDOLockType(lockType); + out.writeBoolean(recursive); + out.writeLong(timeout); + + out.writeInt(revisionKeys.size()); + for (CDORevisionKey revKey : revisionKeys) + { + out.writeCDORevisionKey(revKey); + } + } + + @Override + protected LockObjectsResult confirming(CDODataInput in) throws IOException + { + boolean succesful = in.readBoolean(); + boolean timeout = in.readBoolean(); + boolean waitForUpdate = in.readBoolean(); + long requiredTimestamp = in.readLong(); + + int nStaleRevisions = in.readInt(); + CDORevisionKey[] staleRevisions = new CDORevisionKey[nStaleRevisions]; + for (int i = 0; i < nStaleRevisions; i++) + { + staleRevisions[i] = in.readCDORevisionKey(); + } + + long timestamp = in.readLong(); + + int n = in.readInt(); + CDOLockState[] newLockStates = new CDOLockState[n]; + for (int i = 0; i < n; i++) + { + newLockStates[i] = in.readCDOLockState(); + } + + return new LockObjectsResult(succesful, timeout, waitForUpdate, requiredTimestamp, staleRevisions, newLockStates, + timestamp); + } +} diff --git a/plugins/org.eclipse.emf.cdo.net4j/src/org/eclipse/emf/cdo/internal/net4j/protocol/LockStateRequest.java b/plugins/org.eclipse.emf.cdo.net4j/src/org/eclipse/emf/cdo/internal/net4j/protocol/LockStateRequest.java index 22d8b03ed6..3d3c2c81c6 100644 --- a/plugins/org.eclipse.emf.cdo.net4j/src/org/eclipse/emf/cdo/internal/net4j/protocol/LockStateRequest.java +++ b/plugins/org.eclipse.emf.cdo.net4j/src/org/eclipse/emf/cdo/internal/net4j/protocol/LockStateRequest.java @@ -1,61 +1,61 @@ -/*
- * 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:
- * Caspar De Groot - initial API and implementation
- */
-package org.eclipse.emf.cdo.internal.net4j.protocol;
-
-import org.eclipse.emf.cdo.common.id.CDOID;
-import org.eclipse.emf.cdo.common.lock.CDOLockState;
-import org.eclipse.emf.cdo.common.protocol.CDODataInput;
-import org.eclipse.emf.cdo.common.protocol.CDODataOutput;
-import org.eclipse.emf.cdo.common.protocol.CDOProtocolConstants;
-
-import java.io.IOException;
-import java.util.Collection;
-
-/**
- * @author Caspar De Groot
- */
-public class LockStateRequest extends CDOClientRequest<CDOLockState[]>
-{
- private int viewID;
-
- private Collection<CDOID> ids;
-
- public LockStateRequest(CDOClientProtocol protocol, int viewID, Collection<CDOID> ids)
- {
- super(protocol, CDOProtocolConstants.SIGNAL_LOCK_STATE);
- this.viewID = viewID;
- this.ids = ids;
- }
-
- @Override
- protected void requesting(CDODataOutput out) throws IOException
- {
- out.writeInt(viewID);
- out.writeInt(ids.size());
- for (CDOID id : ids)
- {
- out.writeCDOID(id);
- }
- }
-
- @Override
- protected CDOLockState[] confirming(CDODataInput in) throws IOException
- {
- int n = in.readInt();
- CDOLockState[] lockStates = new CDOLockState[n];
- for (int i = 0; i < n; i++)
- {
- lockStates[i] = in.readCDOLockState();
- }
-
- return lockStates;
- }
-}
+/* + * 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: + * Caspar De Groot - initial API and implementation + */ +package org.eclipse.emf.cdo.internal.net4j.protocol; + +import org.eclipse.emf.cdo.common.id.CDOID; +import org.eclipse.emf.cdo.common.lock.CDOLockState; +import org.eclipse.emf.cdo.common.protocol.CDODataInput; +import org.eclipse.emf.cdo.common.protocol.CDODataOutput; +import org.eclipse.emf.cdo.common.protocol.CDOProtocolConstants; + +import java.io.IOException; +import java.util.Collection; + +/** + * @author Caspar De Groot + */ +public class LockStateRequest extends CDOClientRequest<CDOLockState[]> +{ + private int viewID; + + private Collection<CDOID> ids; + + public LockStateRequest(CDOClientProtocol protocol, int viewID, Collection<CDOID> ids) + { + super(protocol, CDOProtocolConstants.SIGNAL_LOCK_STATE); + this.viewID = viewID; + this.ids = ids; + } + + @Override + protected void requesting(CDODataOutput out) throws IOException + { + out.writeInt(viewID); + out.writeInt(ids.size()); + for (CDOID id : ids) + { + out.writeCDOID(id); + } + } + + @Override + protected CDOLockState[] confirming(CDODataInput in) throws IOException + { + int n = in.readInt(); + CDOLockState[] lockStates = new CDOLockState[n]; + for (int i = 0; i < n; i++) + { + lockStates[i] = in.readCDOLockState(); + } + + return lockStates; + } +} diff --git a/plugins/org.eclipse.emf.cdo.net4j/src/org/eclipse/emf/cdo/internal/net4j/protocol/ObjectLockedRequest.java b/plugins/org.eclipse.emf.cdo.net4j/src/org/eclipse/emf/cdo/internal/net4j/protocol/ObjectLockedRequest.java index 17618f662c..85e73bcddc 100644 --- a/plugins/org.eclipse.emf.cdo.net4j/src/org/eclipse/emf/cdo/internal/net4j/protocol/ObjectLockedRequest.java +++ b/plugins/org.eclipse.emf.cdo.net4j/src/org/eclipse/emf/cdo/internal/net4j/protocol/ObjectLockedRequest.java @@ -1,70 +1,70 @@ -/*
- * 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:
- * Simon McDuff - initial API and implementation
- */
-package org.eclipse.emf.cdo.internal.net4j.protocol;
-
-import org.eclipse.emf.cdo.CDOObject;
-import org.eclipse.emf.cdo.common.protocol.CDODataInput;
-import org.eclipse.emf.cdo.common.protocol.CDODataOutput;
-import org.eclipse.emf.cdo.common.protocol.CDOProtocolConstants;
-import org.eclipse.emf.cdo.internal.net4j.bundle.OM;
-import org.eclipse.emf.cdo.view.CDOView;
-
-import org.eclipse.net4j.util.concurrent.IRWLockManager.LockType;
-import org.eclipse.net4j.util.om.trace.ContextTracer;
-
-import java.io.IOException;
-
-/**
- * @author Simon McDuff
- */
-public class ObjectLockedRequest extends CDOClientRequest<Boolean>
-{
- private static final ContextTracer TRACER = new ContextTracer(OM.DEBUG_PROTOCOL, ObjectLockedRequest.class);
-
- private CDOView view;
-
- private CDOObject object;
-
- private LockType lockType;
-
- private boolean byOthers;
-
- public ObjectLockedRequest(CDOClientProtocol protocol, CDOView view, CDOObject object, LockType lockType,
- boolean byOthers)
- {
- super(protocol, CDOProtocolConstants.SIGNAL_OBJECT_LOCKED);
- this.view = view;
- this.object = object;
- this.lockType = lockType;
- this.byOthers = byOthers;
- }
-
- @Override
- protected void requesting(CDODataOutput out) throws IOException
- {
- if (TRACER.isEnabled())
- {
- TRACER.format("Requesting if object {0} has of lock for object {1}", object.cdoID(), //$NON-NLS-1$
- lockType == LockType.READ ? "read" : "write"); //$NON-NLS-1$ //$NON-NLS-2$
- }
-
- out.writeInt(view.getViewID());
- out.writeCDOLockType(lockType);
- out.writeCDOID(object.cdoID());
- out.writeBoolean(byOthers);
- }
-
- @Override
- protected Boolean confirming(CDODataInput in) throws IOException
- {
- return in.readBoolean();
- }
-}
+/* + * 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: + * Simon McDuff - initial API and implementation + */ +package org.eclipse.emf.cdo.internal.net4j.protocol; + +import org.eclipse.emf.cdo.CDOObject; +import org.eclipse.emf.cdo.common.protocol.CDODataInput; +import org.eclipse.emf.cdo.common.protocol.CDODataOutput; +import org.eclipse.emf.cdo.common.protocol.CDOProtocolConstants; +import org.eclipse.emf.cdo.internal.net4j.bundle.OM; +import org.eclipse.emf.cdo.view.CDOView; + +import org.eclipse.net4j.util.concurrent.IRWLockManager.LockType; +import org.eclipse.net4j.util.om.trace.ContextTracer; + +import java.io.IOException; + +/** + * @author Simon McDuff + */ +public class ObjectLockedRequest extends CDOClientRequest<Boolean> +{ + private static final ContextTracer TRACER = new ContextTracer(OM.DEBUG_PROTOCOL, ObjectLockedRequest.class); + + private CDOView view; + + private CDOObject object; + + private LockType lockType; + + private boolean byOthers; + + public ObjectLockedRequest(CDOClientProtocol protocol, CDOView view, CDOObject object, LockType lockType, + boolean byOthers) + { + super(protocol, CDOProtocolConstants.SIGNAL_OBJECT_LOCKED); + this.view = view; + this.object = object; + this.lockType = lockType; + this.byOthers = byOthers; + } + + @Override + protected void requesting(CDODataOutput out) throws IOException + { + if (TRACER.isEnabled()) + { + TRACER.format("Requesting if object {0} has of lock for object {1}", object.cdoID(), //$NON-NLS-1$ + lockType == LockType.READ ? "read" : "write"); //$NON-NLS-1$ //$NON-NLS-2$ + } + + out.writeInt(view.getViewID()); + out.writeCDOLockType(lockType); + out.writeCDOID(object.cdoID()); + out.writeBoolean(byOthers); + } + + @Override + protected Boolean confirming(CDODataInput in) throws IOException + { + return in.readBoolean(); + } +} diff --git a/plugins/org.eclipse.emf.cdo.net4j/src/org/eclipse/emf/cdo/internal/net4j/protocol/OpenViewRequest.java b/plugins/org.eclipse.emf.cdo.net4j/src/org/eclipse/emf/cdo/internal/net4j/protocol/OpenViewRequest.java index d7771ed62b..e45b9c34b6 100644 --- a/plugins/org.eclipse.emf.cdo.net4j/src/org/eclipse/emf/cdo/internal/net4j/protocol/OpenViewRequest.java +++ b/plugins/org.eclipse.emf.cdo.net4j/src/org/eclipse/emf/cdo/internal/net4j/protocol/OpenViewRequest.java @@ -1,89 +1,89 @@ -/*
- * 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.net4j.protocol;
-
-import org.eclipse.emf.cdo.common.branch.CDOBranchPoint;
-import org.eclipse.emf.cdo.common.lock.IDurableLockingManager.LockAreaNotFoundException;
-import org.eclipse.emf.cdo.common.protocol.CDODataInput;
-import org.eclipse.emf.cdo.common.protocol.CDODataOutput;
-import org.eclipse.emf.cdo.common.protocol.CDOProtocolConstants;
-
-import java.io.IOException;
-
-/**
- * @author Eike Stepper
- */
-public class OpenViewRequest extends CDOClientRequest<CDOBranchPoint>
-{
- private int viewID;
-
- private boolean readOnly;
-
- private CDOBranchPoint branchPoint;
-
- private String durableLockingID;
-
- public OpenViewRequest(CDOClientProtocol protocol, int viewID, boolean readOnly, CDOBranchPoint branchPoint)
- {
- super(protocol, CDOProtocolConstants.SIGNAL_OPEN_VIEW);
- this.viewID = viewID;
- this.readOnly = readOnly;
- this.branchPoint = branchPoint;
- }
-
- public OpenViewRequest(CDOClientProtocol protocol, int viewID, boolean readOnly, String durableLockingID)
- {
- super(protocol, CDOProtocolConstants.SIGNAL_OPEN_VIEW);
- this.viewID = viewID;
- this.readOnly = readOnly;
- this.durableLockingID = durableLockingID;
- }
-
- @Override
- protected void requesting(CDODataOutput out) throws IOException
- {
- out.writeInt(viewID);
- out.writeBoolean(readOnly);
-
- if (branchPoint != null)
- {
- out.writeBoolean(true);
- out.writeCDOBranchPoint(branchPoint);
- }
- else
- {
- out.writeBoolean(false);
- out.writeString(durableLockingID);
- }
- }
-
- @Override
- protected CDOBranchPoint confirming(CDODataInput in) throws IOException
- {
- if (in.readBoolean())
- {
- return in.readCDOBranchPoint();
- }
-
- if (durableLockingID != null)
- {
- String message = in.readString();
- if (message != null)
- {
- throw new IllegalStateException(message);
- }
-
- throw new LockAreaNotFoundException(durableLockingID);
- }
-
- return 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 + */ +package org.eclipse.emf.cdo.internal.net4j.protocol; + +import org.eclipse.emf.cdo.common.branch.CDOBranchPoint; +import org.eclipse.emf.cdo.common.lock.IDurableLockingManager.LockAreaNotFoundException; +import org.eclipse.emf.cdo.common.protocol.CDODataInput; +import org.eclipse.emf.cdo.common.protocol.CDODataOutput; +import org.eclipse.emf.cdo.common.protocol.CDOProtocolConstants; + +import java.io.IOException; + +/** + * @author Eike Stepper + */ +public class OpenViewRequest extends CDOClientRequest<CDOBranchPoint> +{ + private int viewID; + + private boolean readOnly; + + private CDOBranchPoint branchPoint; + + private String durableLockingID; + + public OpenViewRequest(CDOClientProtocol protocol, int viewID, boolean readOnly, CDOBranchPoint branchPoint) + { + super(protocol, CDOProtocolConstants.SIGNAL_OPEN_VIEW); + this.viewID = viewID; + this.readOnly = readOnly; + this.branchPoint = branchPoint; + } + + public OpenViewRequest(CDOClientProtocol protocol, int viewID, boolean readOnly, String durableLockingID) + { + super(protocol, CDOProtocolConstants.SIGNAL_OPEN_VIEW); + this.viewID = viewID; + this.readOnly = readOnly; + this.durableLockingID = durableLockingID; + } + + @Override + protected void requesting(CDODataOutput out) throws IOException + { + out.writeInt(viewID); + out.writeBoolean(readOnly); + + if (branchPoint != null) + { + out.writeBoolean(true); + out.writeCDOBranchPoint(branchPoint); + } + else + { + out.writeBoolean(false); + out.writeString(durableLockingID); + } + } + + @Override + protected CDOBranchPoint confirming(CDODataInput in) throws IOException + { + if (in.readBoolean()) + { + return in.readCDOBranchPoint(); + } + + if (durableLockingID != null) + { + String message = in.readString(); + if (message != null) + { + throw new IllegalStateException(message); + } + + throw new LockAreaNotFoundException(durableLockingID); + } + + return null; + } +} diff --git a/plugins/org.eclipse.emf.cdo.net4j/src/org/eclipse/emf/cdo/internal/net4j/protocol/QueryCancelRequest.java b/plugins/org.eclipse.emf.cdo.net4j/src/org/eclipse/emf/cdo/internal/net4j/protocol/QueryCancelRequest.java index 9e48679faa..cf85023a78 100644 --- a/plugins/org.eclipse.emf.cdo.net4j/src/org/eclipse/emf/cdo/internal/net4j/protocol/QueryCancelRequest.java +++ b/plugins/org.eclipse.emf.cdo.net4j/src/org/eclipse/emf/cdo/internal/net4j/protocol/QueryCancelRequest.java @@ -1,61 +1,61 @@ -/*
- * 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:
- * Simon McDuff - initial API and implementation
- * Eike Stepper - maintenance
- */
-package org.eclipse.emf.cdo.internal.net4j.protocol;
-
-import org.eclipse.emf.cdo.common.protocol.CDODataInput;
-import org.eclipse.emf.cdo.common.protocol.CDODataOutput;
-import org.eclipse.emf.cdo.common.protocol.CDOProtocolConstants;
-import org.eclipse.emf.cdo.internal.net4j.bundle.OM;
-
-import org.eclipse.net4j.util.om.trace.ContextTracer;
-
-import java.io.IOException;
-
-/**
- * @author Simon McDuff
- */
-public class QueryCancelRequest extends CDOClientRequest<Boolean>
-{
- private static final ContextTracer TRACER = new ContextTracer(OM.DEBUG_PROTOCOL, QueryCancelRequest.class);
-
- private int queryID;
-
- public QueryCancelRequest(CDOClientProtocol protocol, int queryID)
- {
- super(protocol, CDOProtocolConstants.SIGNAL_QUERY_CANCEL);
- this.queryID = queryID;
- }
-
- @Override
- protected void requesting(CDODataOutput out) throws IOException
- {
- if (TRACER.isEnabled())
- {
- TRACER.trace("Cancel query " + queryID); //$NON-NLS-1$
- }
-
- out.writeInt(queryID);
- }
-
- @Override
- protected Boolean confirming(CDODataInput in) throws IOException
- {
- boolean exception = in.readBoolean();
- if (exception)
- {
- String message = in.readString();
- throw new RuntimeException(message);
- }
-
- return true;
- }
-}
+/* + * 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: + * Simon McDuff - initial API and implementation + * Eike Stepper - maintenance + */ +package org.eclipse.emf.cdo.internal.net4j.protocol; + +import org.eclipse.emf.cdo.common.protocol.CDODataInput; +import org.eclipse.emf.cdo.common.protocol.CDODataOutput; +import org.eclipse.emf.cdo.common.protocol.CDOProtocolConstants; +import org.eclipse.emf.cdo.internal.net4j.bundle.OM; + +import org.eclipse.net4j.util.om.trace.ContextTracer; + +import java.io.IOException; + +/** + * @author Simon McDuff + */ +public class QueryCancelRequest extends CDOClientRequest<Boolean> +{ + private static final ContextTracer TRACER = new ContextTracer(OM.DEBUG_PROTOCOL, QueryCancelRequest.class); + + private int queryID; + + public QueryCancelRequest(CDOClientProtocol protocol, int queryID) + { + super(protocol, CDOProtocolConstants.SIGNAL_QUERY_CANCEL); + this.queryID = queryID; + } + + @Override + protected void requesting(CDODataOutput out) throws IOException + { + if (TRACER.isEnabled()) + { + TRACER.trace("Cancel query " + queryID); //$NON-NLS-1$ + } + + out.writeInt(queryID); + } + + @Override + protected Boolean confirming(CDODataInput in) throws IOException + { + boolean exception = in.readBoolean(); + if (exception) + { + String message = in.readString(); + throw new RuntimeException(message); + } + + return true; + } +} diff --git a/plugins/org.eclipse.emf.cdo.net4j/src/org/eclipse/emf/cdo/internal/net4j/protocol/QueryLobsRequest.java b/plugins/org.eclipse.emf.cdo.net4j/src/org/eclipse/emf/cdo/internal/net4j/protocol/QueryLobsRequest.java index a79bc78305..c71934782d 100644 --- a/plugins/org.eclipse.emf.cdo.net4j/src/org/eclipse/emf/cdo/internal/net4j/protocol/QueryLobsRequest.java +++ b/plugins/org.eclipse.emf.cdo.net4j/src/org/eclipse/emf/cdo/internal/net4j/protocol/QueryLobsRequest.java @@ -1,57 +1,57 @@ -/*
- * 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.net4j.protocol;
-
-import org.eclipse.emf.cdo.common.protocol.CDODataInput;
-import org.eclipse.emf.cdo.common.protocol.CDODataOutput;
-import org.eclipse.emf.cdo.common.protocol.CDOProtocolConstants;
-
-import java.io.IOException;
-import java.util.ArrayList;
-import java.util.Collection;
-import java.util.List;
-
-/**
- * @author Eike Stepper
- */
-public class QueryLobsRequest extends CDOClientRequest<List<byte[]>>
-{
- private Collection<byte[]> ids;
-
- public QueryLobsRequest(CDOClientProtocol protocol, Collection<byte[]> ids)
- {
- super(protocol, CDOProtocolConstants.SIGNAL_QUERY_LOBS);
- this.ids = ids;
- }
-
- @Override
- protected void requesting(CDODataOutput out) throws IOException
- {
- out.writeInt(ids.size());
- for (byte[] id : ids)
- {
- out.writeByteArray(id);
- }
- }
-
- @Override
- protected List<byte[]> confirming(CDODataInput in) throws IOException
- {
- int size = in.readInt();
- List<byte[]> result = new ArrayList<byte[]>(size);
- for (int i = 0; i < size; i++)
- {
- result.add(in.readByteArray());
- }
-
- return result;
- }
-}
+/* + * 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.net4j.protocol; + +import org.eclipse.emf.cdo.common.protocol.CDODataInput; +import org.eclipse.emf.cdo.common.protocol.CDODataOutput; +import org.eclipse.emf.cdo.common.protocol.CDOProtocolConstants; + +import java.io.IOException; +import java.util.ArrayList; +import java.util.Collection; +import java.util.List; + +/** + * @author Eike Stepper + */ +public class QueryLobsRequest extends CDOClientRequest<List<byte[]>> +{ + private Collection<byte[]> ids; + + public QueryLobsRequest(CDOClientProtocol protocol, Collection<byte[]> ids) + { + super(protocol, CDOProtocolConstants.SIGNAL_QUERY_LOBS); + this.ids = ids; + } + + @Override + protected void requesting(CDODataOutput out) throws IOException + { + out.writeInt(ids.size()); + for (byte[] id : ids) + { + out.writeByteArray(id); + } + } + + @Override + protected List<byte[]> confirming(CDODataInput in) throws IOException + { + int size = in.readInt(); + List<byte[]> result = new ArrayList<byte[]>(size); + for (int i = 0; i < size; i++) + { + result.add(in.readByteArray()); + } + + return result; + } +} diff --git a/plugins/org.eclipse.emf.cdo.net4j/src/org/eclipse/emf/cdo/internal/net4j/protocol/RefreshSessionRequest.java b/plugins/org.eclipse.emf.cdo.net4j/src/org/eclipse/emf/cdo/internal/net4j/protocol/RefreshSessionRequest.java index e24ad08087..b3cc44db89 100644 --- a/plugins/org.eclipse.emf.cdo.net4j/src/org/eclipse/emf/cdo/internal/net4j/protocol/RefreshSessionRequest.java +++ b/plugins/org.eclipse.emf.cdo.net4j/src/org/eclipse/emf/cdo/internal/net4j/protocol/RefreshSessionRequest.java @@ -1,127 +1,127 @@ -/*
- * 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:
- * Simon McDuff - initial API and implementation
- * Eike Stepper - maintenance
- */
-package org.eclipse.emf.cdo.internal.net4j.protocol;
-
-import org.eclipse.emf.cdo.common.branch.CDOBranch;
-import org.eclipse.emf.cdo.common.id.CDOID;
-import org.eclipse.emf.cdo.common.model.CDOPackageUnit;
-import org.eclipse.emf.cdo.common.model.EMFUtil;
-import org.eclipse.emf.cdo.common.protocol.CDODataInput;
-import org.eclipse.emf.cdo.common.protocol.CDODataOutput;
-import org.eclipse.emf.cdo.common.protocol.CDOProtocolConstants;
-import org.eclipse.emf.cdo.common.revision.CDORevisionKey;
-import org.eclipse.emf.cdo.spi.common.revision.InternalCDORevision;
-
-import org.eclipse.emf.ecore.resource.ResourceSet;
-import org.eclipse.emf.spi.cdo.CDOSessionProtocol.RefreshSessionResult;
-
-import java.io.IOException;
-import java.util.Map;
-import java.util.Map.Entry;
-
-/**
- * @author Simon McDuff
- * @since 2.0
- */
-public class RefreshSessionRequest extends CDOClientRequest<RefreshSessionResult>
-{
- private long lastUpdateTime;
-
- private Map<CDOBranch, Map<CDOID, InternalCDORevision>> viewedRevisions;
-
- private int initialChunkSize;
-
- private boolean enablePassiveUpdates;
-
- public RefreshSessionRequest(CDOClientProtocol protocol, long lastUpdateTime,
- Map<CDOBranch, Map<CDOID, InternalCDORevision>> viewedRevisions, int initialChunkSize,
- boolean enablePassiveUpdates)
- {
- this(protocol, CDOProtocolConstants.SIGNAL_REFRESH_SESSION, lastUpdateTime, viewedRevisions, initialChunkSize,
- enablePassiveUpdates);
- }
-
- protected RefreshSessionRequest(CDOClientProtocol protocol, short signalID, long lastUpdateTime,
- Map<CDOBranch, Map<CDOID, InternalCDORevision>> viewedRevisions, int initialChunkSize,
- boolean enablePassiveUpdates)
- {
- super(protocol, signalID);
- this.lastUpdateTime = lastUpdateTime;
- this.viewedRevisions = viewedRevisions;
- this.initialChunkSize = initialChunkSize;
- this.enablePassiveUpdates = enablePassiveUpdates;
- }
-
- @Override
- protected void requesting(CDODataOutput out) throws IOException
- {
- out.writeLong(lastUpdateTime);
- out.writeInt(initialChunkSize);
- out.writeBoolean(enablePassiveUpdates);
-
- out.writeInt(viewedRevisions.size());
- for (Entry<CDOBranch, Map<CDOID, InternalCDORevision>> entry : viewedRevisions.entrySet())
- {
- CDOBranch branch = entry.getKey();
- Map<CDOID, InternalCDORevision> revisions = entry.getValue();
-
- out.writeCDOBranch(branch);
- out.writeInt(revisions.size());
- for (InternalCDORevision revision : revisions.values())
- {
- out.writeCDORevisionKey(revision);
- }
- }
- }
-
- @Override
- protected RefreshSessionResult confirming(CDODataInput in) throws IOException
- {
- lastUpdateTime = in.readLong();
- RefreshSessionResult result = new RefreshSessionResult(lastUpdateTime);
-
- ResourceSet resourceSet = EMFUtil.newEcoreResourceSet();
- for (;;)
- {
- byte type = in.readByte();
- switch (type)
- {
- case CDOProtocolConstants.REFRESH_PACKAGE_UNIT:
- {
- CDOPackageUnit packageUnit = in.readCDOPackageUnit(resourceSet);
- result.addPackageUnit(packageUnit);
- break;
- }
-
- case CDOProtocolConstants.REFRESH_CHANGED_OBJECT:
- {
- InternalCDORevision revision = (InternalCDORevision)in.readCDORevision();
- result.addChangedObject(revision);
- break;
- }
-
- case CDOProtocolConstants.REFRESH_DETACHED_OBJECT:
- {
- CDORevisionKey key = in.readCDORevisionKey();
- result.addDetachedObject(key);
- break;
- }
-
- case CDOProtocolConstants.REFRESH_FINISHED:
- return result;
-
- default:
- throw new IOException("Invalid refresh type: " + type);
- }
- }
- }
-}
+/* + * 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: + * Simon McDuff - initial API and implementation + * Eike Stepper - maintenance + */ +package org.eclipse.emf.cdo.internal.net4j.protocol; + +import org.eclipse.emf.cdo.common.branch.CDOBranch; +import org.eclipse.emf.cdo.common.id.CDOID; +import org.eclipse.emf.cdo.common.model.CDOPackageUnit; +import org.eclipse.emf.cdo.common.model.EMFUtil; +import org.eclipse.emf.cdo.common.protocol.CDODataInput; +import org.eclipse.emf.cdo.common.protocol.CDODataOutput; +import org.eclipse.emf.cdo.common.protocol.CDOProtocolConstants; +import org.eclipse.emf.cdo.common.revision.CDORevisionKey; +import org.eclipse.emf.cdo.spi.common.revision.InternalCDORevision; + +import org.eclipse.emf.ecore.resource.ResourceSet; +import org.eclipse.emf.spi.cdo.CDOSessionProtocol.RefreshSessionResult; + +import java.io.IOException; +import java.util.Map; +import java.util.Map.Entry; + +/** + * @author Simon McDuff + * @since 2.0 + */ +public class RefreshSessionRequest extends CDOClientRequest<RefreshSessionResult> +{ + private long lastUpdateTime; + + private Map<CDOBranch, Map<CDOID, InternalCDORevision>> viewedRevisions; + + private int initialChunkSize; + + private boolean enablePassiveUpdates; + + public RefreshSessionRequest(CDOClientProtocol protocol, long lastUpdateTime, + Map<CDOBranch, Map<CDOID, InternalCDORevision>> viewedRevisions, int initialChunkSize, + boolean enablePassiveUpdates) + { + this(protocol, CDOProtocolConstants.SIGNAL_REFRESH_SESSION, lastUpdateTime, viewedRevisions, initialChunkSize, + enablePassiveUpdates); + } + + protected RefreshSessionRequest(CDOClientProtocol protocol, short signalID, long lastUpdateTime, + Map<CDOBranch, Map<CDOID, InternalCDORevision>> viewedRevisions, int initialChunkSize, + boolean enablePassiveUpdates) + { + super(protocol, signalID); + this.lastUpdateTime = lastUpdateTime; + this.viewedRevisions = viewedRevisions; + this.initialChunkSize = initialChunkSize; + this.enablePassiveUpdates = enablePassiveUpdates; + } + + @Override + protected void requesting(CDODataOutput out) throws IOException + { + out.writeLong(lastUpdateTime); + out.writeInt(initialChunkSize); + out.writeBoolean(enablePassiveUpdates); + + out.writeInt(viewedRevisions.size()); + for (Entry<CDOBranch, Map<CDOID, InternalCDORevision>> entry : viewedRevisions.entrySet()) + { + CDOBranch branch = entry.getKey(); + Map<CDOID, InternalCDORevision> revisions = entry.getValue(); + + out.writeCDOBranch(branch); + out.writeInt(revisions.size()); + for (InternalCDORevision revision : revisions.values()) + { + out.writeCDORevisionKey(revision); + } + } + } + + @Override + protected RefreshSessionResult confirming(CDODataInput in) throws IOException + { + lastUpdateTime = in.readLong(); + RefreshSessionResult result = new RefreshSessionResult(lastUpdateTime); + + ResourceSet resourceSet = EMFUtil.newEcoreResourceSet(); + for (;;) + { + byte type = in.readByte(); + switch (type) + { + case CDOProtocolConstants.REFRESH_PACKAGE_UNIT: + { + CDOPackageUnit packageUnit = in.readCDOPackageUnit(resourceSet); + result.addPackageUnit(packageUnit); + break; + } + + case CDOProtocolConstants.REFRESH_CHANGED_OBJECT: + { + InternalCDORevision revision = (InternalCDORevision)in.readCDORevision(); + result.addChangedObject(revision); + break; + } + + case CDOProtocolConstants.REFRESH_DETACHED_OBJECT: + { + CDORevisionKey key = in.readCDORevisionKey(); + result.addDetachedObject(key); + break; + } + + case CDOProtocolConstants.REFRESH_FINISHED: + return result; + + default: + throw new IOException("Invalid refresh type: " + type); + } + } + } +} diff --git a/plugins/org.eclipse.emf.cdo.net4j/src/org/eclipse/emf/cdo/internal/net4j/protocol/RemoteMessageNotificationIndication.java b/plugins/org.eclipse.emf.cdo.net4j/src/org/eclipse/emf/cdo/internal/net4j/protocol/RemoteMessageNotificationIndication.java index ac97b4b9d4..2f9017100d 100644 --- a/plugins/org.eclipse.emf.cdo.net4j/src/org/eclipse/emf/cdo/internal/net4j/protocol/RemoteMessageNotificationIndication.java +++ b/plugins/org.eclipse.emf.cdo.net4j/src/org/eclipse/emf/cdo/internal/net4j/protocol/RemoteMessageNotificationIndication.java @@ -1,56 +1,56 @@ -/*
- * 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
- * Simon McDuff - bug 233490
- */
-package org.eclipse.emf.cdo.internal.net4j.protocol;
-
-import org.eclipse.emf.cdo.common.protocol.CDODataInput;
-import org.eclipse.emf.cdo.common.protocol.CDOProtocolConstants;
-import org.eclipse.emf.cdo.internal.net4j.bundle.OM;
-import org.eclipse.emf.cdo.session.remote.CDORemoteSessionMessage;
-
-import org.eclipse.net4j.util.om.trace.ContextTracer;
-
-import org.eclipse.emf.spi.cdo.InternalCDORemoteSessionManager;
-
-import java.io.IOException;
-
-/**
- * @author Eike Stepper
- */
-public class RemoteMessageNotificationIndication extends CDOClientIndication
-{
- private static final ContextTracer TRACER = new ContextTracer(OM.DEBUG_PROTOCOL,
- RemoteMessageNotificationIndication.class);
-
- public RemoteMessageNotificationIndication(CDOClientProtocol protocol)
- {
- super(protocol, CDOProtocolConstants.SIGNAL_REMOTE_MESSAGE_NOTIFICATION);
- }
-
- @Override
- protected void indicating(CDODataInput in) throws IOException
- {
- int senderID = in.readInt();
- if (TRACER.isEnabled())
- {
- TRACER.trace("Read senderID: " + senderID); //$NON-NLS-1$
- }
-
- CDORemoteSessionMessage message = new CDORemoteSessionMessage(in);
- if (TRACER.isEnabled())
- {
- TRACER.trace("Read message: " + message); //$NON-NLS-1$
- }
-
- InternalCDORemoteSessionManager remoteSessionManager = getSession().getRemoteSessionManager();
- remoteSessionManager.handleRemoteSessionMessage(senderID, message);
- }
-}
+/* + * 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 + * Simon McDuff - bug 233490 + */ +package org.eclipse.emf.cdo.internal.net4j.protocol; + +import org.eclipse.emf.cdo.common.protocol.CDODataInput; +import org.eclipse.emf.cdo.common.protocol.CDOProtocolConstants; +import org.eclipse.emf.cdo.internal.net4j.bundle.OM; +import org.eclipse.emf.cdo.session.remote.CDORemoteSessionMessage; + +import org.eclipse.net4j.util.om.trace.ContextTracer; + +import org.eclipse.emf.spi.cdo.InternalCDORemoteSessionManager; + +import java.io.IOException; + +/** + * @author Eike Stepper + */ +public class RemoteMessageNotificationIndication extends CDOClientIndication +{ + private static final ContextTracer TRACER = new ContextTracer(OM.DEBUG_PROTOCOL, + RemoteMessageNotificationIndication.class); + + public RemoteMessageNotificationIndication(CDOClientProtocol protocol) + { + super(protocol, CDOProtocolConstants.SIGNAL_REMOTE_MESSAGE_NOTIFICATION); + } + + @Override + protected void indicating(CDODataInput in) throws IOException + { + int senderID = in.readInt(); + if (TRACER.isEnabled()) + { + TRACER.trace("Read senderID: " + senderID); //$NON-NLS-1$ + } + + CDORemoteSessionMessage message = new CDORemoteSessionMessage(in); + if (TRACER.isEnabled()) + { + TRACER.trace("Read message: " + message); //$NON-NLS-1$ + } + + InternalCDORemoteSessionManager remoteSessionManager = getSession().getRemoteSessionManager(); + remoteSessionManager.handleRemoteSessionMessage(senderID, message); + } +} diff --git a/plugins/org.eclipse.emf.cdo.net4j/src/org/eclipse/emf/cdo/internal/net4j/protocol/RemoteMessageRequest.java b/plugins/org.eclipse.emf.cdo.net4j/src/org/eclipse/emf/cdo/internal/net4j/protocol/RemoteMessageRequest.java index a0a0846c0a..b86d231aaa 100644 --- a/plugins/org.eclipse.emf.cdo.net4j/src/org/eclipse/emf/cdo/internal/net4j/protocol/RemoteMessageRequest.java +++ b/plugins/org.eclipse.emf.cdo.net4j/src/org/eclipse/emf/cdo/internal/net4j/protocol/RemoteMessageRequest.java @@ -1,85 +1,85 @@ -/*
- * 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.net4j.protocol;
-
-import org.eclipse.emf.cdo.common.protocol.CDODataInput;
-import org.eclipse.emf.cdo.common.protocol.CDODataOutput;
-import org.eclipse.emf.cdo.common.protocol.CDOProtocolConstants;
-import org.eclipse.emf.cdo.internal.net4j.bundle.OM;
-import org.eclipse.emf.cdo.session.remote.CDORemoteSession;
-import org.eclipse.emf.cdo.session.remote.CDORemoteSessionMessage;
-
-import org.eclipse.net4j.util.om.trace.ContextTracer;
-
-import java.io.IOException;
-import java.util.HashSet;
-import java.util.List;
-import java.util.Set;
-
-/**
- * @author Eike Stepper
- */
-public class RemoteMessageRequest extends CDOClientRequest<Set<Integer>>
-{
- private static final ContextTracer TRACER = new ContextTracer(OM.DEBUG_PROTOCOL, RemoteMessageRequest.class);
-
- private CDORemoteSessionMessage message;
-
- private List<CDORemoteSession> recipients;
-
- public RemoteMessageRequest(CDOClientProtocol protocol, CDORemoteSessionMessage message,
- List<CDORemoteSession> recipients)
- {
- super(protocol, CDOProtocolConstants.SIGNAL_REMOTE_MESSAGE);
- this.message = message;
- this.recipients = recipients;
- }
-
- @Override
- protected void requesting(CDODataOutput out) throws IOException
- {
- if (TRACER.isEnabled())
- {
- TRACER.trace("Writing message: " + message); //$NON-NLS-1$
- }
-
- message.write(out);
- if (TRACER.isEnabled())
- {
- TRACER.format("Writing {0} recipients", recipients.size()); //$NON-NLS-1$
- }
-
- out.writeInt(recipients.size());
- for (CDORemoteSession recipient : recipients)
- {
- if (TRACER.isEnabled())
- {
- TRACER.trace("Writing recipient: " + recipient); //$NON-NLS-1$
- }
-
- out.writeInt(recipient.getSessionID());
- }
- }
-
- @Override
- protected Set<Integer> confirming(CDODataInput in) throws IOException
- {
- Set<Integer> sessionIDs = new HashSet<Integer>();
- int count = in.readInt();
- for (int i = 0; i < count; i++)
- {
- int sessionID = in.readInt();
- sessionIDs.add(sessionID);
- }
-
- return sessionIDs;
- }
-}
+/* + * 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.net4j.protocol; + +import org.eclipse.emf.cdo.common.protocol.CDODataInput; +import org.eclipse.emf.cdo.common.protocol.CDODataOutput; +import org.eclipse.emf.cdo.common.protocol.CDOProtocolConstants; +import org.eclipse.emf.cdo.internal.net4j.bundle.OM; +import org.eclipse.emf.cdo.session.remote.CDORemoteSession; +import org.eclipse.emf.cdo.session.remote.CDORemoteSessionMessage; + +import org.eclipse.net4j.util.om.trace.ContextTracer; + +import java.io.IOException; +import java.util.HashSet; +import java.util.List; +import java.util.Set; + +/** + * @author Eike Stepper + */ +public class RemoteMessageRequest extends CDOClientRequest<Set<Integer>> +{ + private static final ContextTracer TRACER = new ContextTracer(OM.DEBUG_PROTOCOL, RemoteMessageRequest.class); + + private CDORemoteSessionMessage message; + + private List<CDORemoteSession> recipients; + + public RemoteMessageRequest(CDOClientProtocol protocol, CDORemoteSessionMessage message, + List<CDORemoteSession> recipients) + { + super(protocol, CDOProtocolConstants.SIGNAL_REMOTE_MESSAGE); + this.message = message; + this.recipients = recipients; + } + + @Override + protected void requesting(CDODataOutput out) throws IOException + { + if (TRACER.isEnabled()) + { + TRACER.trace("Writing message: " + message); //$NON-NLS-1$ + } + + message.write(out); + if (TRACER.isEnabled()) + { + TRACER.format("Writing {0} recipients", recipients.size()); //$NON-NLS-1$ + } + + out.writeInt(recipients.size()); + for (CDORemoteSession recipient : recipients) + { + if (TRACER.isEnabled()) + { + TRACER.trace("Writing recipient: " + recipient); //$NON-NLS-1$ + } + + out.writeInt(recipient.getSessionID()); + } + } + + @Override + protected Set<Integer> confirming(CDODataInput in) throws IOException + { + Set<Integer> sessionIDs = new HashSet<Integer>(); + int count = in.readInt(); + for (int i = 0; i < count; i++) + { + int sessionID = in.readInt(); + sessionIDs.add(sessionID); + } + + return sessionIDs; + } +} diff --git a/plugins/org.eclipse.emf.cdo.net4j/src/org/eclipse/emf/cdo/internal/net4j/protocol/RemoteSessionNotificationIndication.java b/plugins/org.eclipse.emf.cdo.net4j/src/org/eclipse/emf/cdo/internal/net4j/protocol/RemoteSessionNotificationIndication.java index 70347cfc30..7c402c8481 100644 --- a/plugins/org.eclipse.emf.cdo.net4j/src/org/eclipse/emf/cdo/internal/net4j/protocol/RemoteSessionNotificationIndication.java +++ b/plugins/org.eclipse.emf.cdo.net4j/src/org/eclipse/emf/cdo/internal/net4j/protocol/RemoteSessionNotificationIndication.java @@ -1,54 +1,54 @@ -/*
- * 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
- * Simon McDuff - bug 233490
- */
-package org.eclipse.emf.cdo.internal.net4j.protocol;
-
-import org.eclipse.emf.cdo.common.protocol.CDODataInput;
-import org.eclipse.emf.cdo.common.protocol.CDOProtocolConstants;
-
-import java.io.IOException;
-
-/**
- * @author Eike Stepper
- */
-public class RemoteSessionNotificationIndication extends CDOClientIndication
-{
- public RemoteSessionNotificationIndication(CDOClientProtocol protocol)
- {
- super(protocol, CDOProtocolConstants.SIGNAL_REMOTE_SESSION_NOTIFICATION);
- }
-
- @Override
- protected void indicating(CDODataInput in) throws IOException
- {
- int sessionID = in.readInt();
- byte opcode = in.readByte();
- switch (opcode)
- {
- case CDOProtocolConstants.REMOTE_SESSION_OPENED:
- String userID = in.readString();
- getSession().getRemoteSessionManager().handleRemoteSessionOpened(sessionID, userID);
- break;
-
- case CDOProtocolConstants.REMOTE_SESSION_CLOSED:
- getSession().getRemoteSessionManager().handleRemoteSessionClosed(sessionID);
- break;
-
- case CDOProtocolConstants.REMOTE_SESSION_SUBSCRIBED:
- getSession().getRemoteSessionManager().handleRemoteSessionSubscribed(sessionID, true);
- break;
-
- case CDOProtocolConstants.REMOTE_SESSION_UNSUBSCRIBED:
- getSession().getRemoteSessionManager().handleRemoteSessionSubscribed(sessionID, false);
- break;
- }
- }
-}
+/* + * 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 + * Simon McDuff - bug 233490 + */ +package org.eclipse.emf.cdo.internal.net4j.protocol; + +import org.eclipse.emf.cdo.common.protocol.CDODataInput; +import org.eclipse.emf.cdo.common.protocol.CDOProtocolConstants; + +import java.io.IOException; + +/** + * @author Eike Stepper + */ +public class RemoteSessionNotificationIndication extends CDOClientIndication +{ + public RemoteSessionNotificationIndication(CDOClientProtocol protocol) + { + super(protocol, CDOProtocolConstants.SIGNAL_REMOTE_SESSION_NOTIFICATION); + } + + @Override + protected void indicating(CDODataInput in) throws IOException + { + int sessionID = in.readInt(); + byte opcode = in.readByte(); + switch (opcode) + { + case CDOProtocolConstants.REMOTE_SESSION_OPENED: + String userID = in.readString(); + getSession().getRemoteSessionManager().handleRemoteSessionOpened(sessionID, userID); + break; + + case CDOProtocolConstants.REMOTE_SESSION_CLOSED: + getSession().getRemoteSessionManager().handleRemoteSessionClosed(sessionID); + break; + + case CDOProtocolConstants.REMOTE_SESSION_SUBSCRIBED: + getSession().getRemoteSessionManager().handleRemoteSessionSubscribed(sessionID, true); + break; + + case CDOProtocolConstants.REMOTE_SESSION_UNSUBSCRIBED: + getSession().getRemoteSessionManager().handleRemoteSessionSubscribed(sessionID, false); + break; + } + } +} diff --git a/plugins/org.eclipse.emf.cdo.net4j/src/org/eclipse/emf/cdo/internal/net4j/protocol/ReplicateRepositoryRawRequest.java b/plugins/org.eclipse.emf.cdo.net4j/src/org/eclipse/emf/cdo/internal/net4j/protocol/ReplicateRepositoryRawRequest.java index ae4fe4a9d4..dd80a267c2 100644 --- a/plugins/org.eclipse.emf.cdo.net4j/src/org/eclipse/emf/cdo/internal/net4j/protocol/ReplicateRepositoryRawRequest.java +++ b/plugins/org.eclipse.emf.cdo.net4j/src/org/eclipse/emf/cdo/internal/net4j/protocol/ReplicateRepositoryRawRequest.java @@ -1,48 +1,48 @@ -/*
- * 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.net4j.protocol;
-
-import org.eclipse.emf.cdo.common.protocol.CDODataInput;
-import org.eclipse.emf.cdo.common.protocol.CDODataOutput;
-import org.eclipse.emf.cdo.common.protocol.CDOProtocolConstants;
-import org.eclipse.emf.cdo.spi.common.CDORawReplicationContext;
-
-import org.eclipse.net4j.util.om.monitor.OMMonitor;
-
-import java.io.IOException;
-
-/**
- * @author Eike Stepper
- */
-public class ReplicateRepositoryRawRequest extends CDOClientRequestWithMonitoring<Boolean>
-{
- private CDORawReplicationContext context;
-
- public ReplicateRepositoryRawRequest(CDOClientProtocol protocol, CDORawReplicationContext context)
- {
- super(protocol, CDOProtocolConstants.SIGNAL_REPLICATE_REPOSITORY_RAW);
- this.context = context;
- }
-
- @Override
- protected void requesting(CDODataOutput out, OMMonitor monitor) throws IOException
- {
- out.writeInt(context.getLastReplicatedBranchID());
- out.writeLong(context.getLastReplicatedCommitTime());
- }
-
- @Override
- protected Boolean confirming(CDODataInput in, OMMonitor monitor) throws IOException
- {
- context.replicateRaw(in, monitor);
- return true;
- }
-}
+/* + * 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.net4j.protocol; + +import org.eclipse.emf.cdo.common.protocol.CDODataInput; +import org.eclipse.emf.cdo.common.protocol.CDODataOutput; +import org.eclipse.emf.cdo.common.protocol.CDOProtocolConstants; +import org.eclipse.emf.cdo.spi.common.CDORawReplicationContext; + +import org.eclipse.net4j.util.om.monitor.OMMonitor; + +import java.io.IOException; + +/** + * @author Eike Stepper + */ +public class ReplicateRepositoryRawRequest extends CDOClientRequestWithMonitoring<Boolean> +{ + private CDORawReplicationContext context; + + public ReplicateRepositoryRawRequest(CDOClientProtocol protocol, CDORawReplicationContext context) + { + super(protocol, CDOProtocolConstants.SIGNAL_REPLICATE_REPOSITORY_RAW); + this.context = context; + } + + @Override + protected void requesting(CDODataOutput out, OMMonitor monitor) throws IOException + { + out.writeInt(context.getLastReplicatedBranchID()); + out.writeLong(context.getLastReplicatedCommitTime()); + } + + @Override + protected Boolean confirming(CDODataInput in, OMMonitor monitor) throws IOException + { + context.replicateRaw(in, monitor); + return true; + } +} diff --git a/plugins/org.eclipse.emf.cdo.net4j/src/org/eclipse/emf/cdo/internal/net4j/protocol/ReplicateRepositoryRequest.java b/plugins/org.eclipse.emf.cdo.net4j/src/org/eclipse/emf/cdo/internal/net4j/protocol/ReplicateRepositoryRequest.java index 3cb4a30921..87f9bb161c 100644 --- a/plugins/org.eclipse.emf.cdo.net4j/src/org/eclipse/emf/cdo/internal/net4j/protocol/ReplicateRepositoryRequest.java +++ b/plugins/org.eclipse.emf.cdo.net4j/src/org/eclipse/emf/cdo/internal/net4j/protocol/ReplicateRepositoryRequest.java @@ -1,89 +1,89 @@ -/*
- * 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.net4j.protocol;
-
-import org.eclipse.emf.cdo.common.lock.CDOLockUtil;
-import org.eclipse.emf.cdo.common.lock.IDurableLockingManager.LockArea;
-import org.eclipse.emf.cdo.common.protocol.CDODataInput;
-import org.eclipse.emf.cdo.common.protocol.CDODataOutput;
-import org.eclipse.emf.cdo.common.protocol.CDOProtocolConstants;
-import org.eclipse.emf.cdo.spi.common.CDOReplicationContext;
-
-import org.eclipse.net4j.util.om.monitor.OMMonitor;
-
-import java.io.IOException;
-
-/**
- * @author Eike Stepper
- */
-public class ReplicateRepositoryRequest extends CDOClientRequest<Boolean>
-{
- private CDOReplicationContext context;
-
- public ReplicateRepositoryRequest(CDOClientProtocol protocol, CDOReplicationContext context, OMMonitor monitor)
- {
- super(protocol, CDOProtocolConstants.SIGNAL_REPLICATE_REPOSITORY);
- this.context = context;
- }
-
- @Override
- protected void requesting(CDODataOutput out) throws IOException
- {
- out.writeInt(context.getLastReplicatedBranchID());
- out.writeLong(context.getLastReplicatedCommitTime());
-
- String[] lockAreaIDs = context.getLockAreaIDs();
- out.writeInt(lockAreaIDs.length);
- for (int i = 0; i < lockAreaIDs.length; i++)
- {
- out.writeString(lockAreaIDs[i]);
- }
- }
-
- @Override
- protected Boolean confirming(CDODataInput in) throws IOException
- {
- for (;;)
- {
- byte opcode = in.readByte();
- switch (opcode)
- {
- case CDOProtocolConstants.REPLICATE_FINISHED:
- return true;
-
- case CDOProtocolConstants.REPLICATE_BRANCH:
- context.handleBranch(in.readCDOBranch());
- break;
-
- case CDOProtocolConstants.REPLICATE_COMMIT:
- context.handleCommitInfo(in.readCDOCommitInfo());
- break;
-
- case CDOProtocolConstants.REPLICATE_LOCKAREA:
- boolean missing = !in.readBoolean();
- if (missing)
- {
- String missingLockAreaID = in.readString();
- LockArea area = CDOLockUtil.createLockArea(missingLockAreaID);
- context.handleLockArea(area);
- }
- else
- {
- context.handleLockArea(in.readCDOLockArea());
- }
- break;
-
- default:
- throw new IllegalStateException("Invalid replicate opcode: " + opcode);
- }
- }
- }
-}
+/* + * 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.net4j.protocol; + +import org.eclipse.emf.cdo.common.lock.CDOLockUtil; +import org.eclipse.emf.cdo.common.lock.IDurableLockingManager.LockArea; +import org.eclipse.emf.cdo.common.protocol.CDODataInput; +import org.eclipse.emf.cdo.common.protocol.CDODataOutput; +import org.eclipse.emf.cdo.common.protocol.CDOProtocolConstants; +import org.eclipse.emf.cdo.spi.common.CDOReplicationContext; + +import org.eclipse.net4j.util.om.monitor.OMMonitor; + +import java.io.IOException; + +/** + * @author Eike Stepper + */ +public class ReplicateRepositoryRequest extends CDOClientRequest<Boolean> +{ + private CDOReplicationContext context; + + public ReplicateRepositoryRequest(CDOClientProtocol protocol, CDOReplicationContext context, OMMonitor monitor) + { + super(protocol, CDOProtocolConstants.SIGNAL_REPLICATE_REPOSITORY); + this.context = context; + } + + @Override + protected void requesting(CDODataOutput out) throws IOException + { + out.writeInt(context.getLastReplicatedBranchID()); + out.writeLong(context.getLastReplicatedCommitTime()); + + String[] lockAreaIDs = context.getLockAreaIDs(); + out.writeInt(lockAreaIDs.length); + for (int i = 0; i < lockAreaIDs.length; i++) + { + out.writeString(lockAreaIDs[i]); + } + } + + @Override + protected Boolean confirming(CDODataInput in) throws IOException + { + for (;;) + { + byte opcode = in.readByte(); + switch (opcode) + { + case CDOProtocolConstants.REPLICATE_FINISHED: + return true; + + case CDOProtocolConstants.REPLICATE_BRANCH: + context.handleBranch(in.readCDOBranch()); + break; + + case CDOProtocolConstants.REPLICATE_COMMIT: + context.handleCommitInfo(in.readCDOCommitInfo()); + break; + + case CDOProtocolConstants.REPLICATE_LOCKAREA: + boolean missing = !in.readBoolean(); + if (missing) + { + String missingLockAreaID = in.readString(); + LockArea area = CDOLockUtil.createLockArea(missingLockAreaID); + context.handleLockArea(area); + } + else + { + context.handleLockArea(in.readCDOLockArea()); + } + break; + + default: + throw new IllegalStateException("Invalid replicate opcode: " + opcode); + } + } + } +} diff --git a/plugins/org.eclipse.emf.cdo.net4j/src/org/eclipse/emf/cdo/internal/net4j/protocol/RepositoryStateNotificationIndication.java b/plugins/org.eclipse.emf.cdo.net4j/src/org/eclipse/emf/cdo/internal/net4j/protocol/RepositoryStateNotificationIndication.java index 66ff88f532..07b3a7fad0 100644 --- a/plugins/org.eclipse.emf.cdo.net4j/src/org/eclipse/emf/cdo/internal/net4j/protocol/RepositoryStateNotificationIndication.java +++ b/plugins/org.eclipse.emf.cdo.net4j/src/org/eclipse/emf/cdo/internal/net4j/protocol/RepositoryStateNotificationIndication.java @@ -1,47 +1,47 @@ -/*
- * 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
- * Simon McDuff - bug 233490
- */
-package org.eclipse.emf.cdo.internal.net4j.protocol;
-
-import org.eclipse.emf.cdo.common.CDOCommonRepository;
-import org.eclipse.emf.cdo.common.id.CDOID;
-import org.eclipse.emf.cdo.common.protocol.CDODataInput;
-import org.eclipse.emf.cdo.common.protocol.CDOProtocolConstants;
-import org.eclipse.emf.cdo.internal.net4j.CDONet4jSessionConfigurationImpl.RepositoryInfo;
-import org.eclipse.emf.cdo.internal.net4j.CDONet4jSessionImpl;
-
-import java.io.IOException;
-
-/**
- * @author Eike Stepper
- */
-public class RepositoryStateNotificationIndication extends CDOClientIndication
-{
- public RepositoryStateNotificationIndication(CDOClientProtocol protocol)
- {
- super(protocol, CDOProtocolConstants.SIGNAL_REPOSITORY_STATE_NOTIFICATION);
- }
-
- @Override
- protected void indicating(CDODataInput in) throws IOException
- {
- CDOCommonRepository.State oldState = in.readEnum(CDOCommonRepository.State.class);
- CDOCommonRepository.State newState = in.readEnum(CDOCommonRepository.State.class);
- CDOID rootResourceID = in.readCDOID();
-
- CDONet4jSessionImpl session = (CDONet4jSessionImpl)getSession();
- RepositoryInfo repositoryInfo = (RepositoryInfo)session.getRepositoryInfo();
- repositoryInfo.setState(newState);
- repositoryInfo.setRootResourceID(rootResourceID);
-
- session.handleRepositoryStateChanged(oldState, newState);
- }
-}
+/* + * 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 + * Simon McDuff - bug 233490 + */ +package org.eclipse.emf.cdo.internal.net4j.protocol; + +import org.eclipse.emf.cdo.common.CDOCommonRepository; +import org.eclipse.emf.cdo.common.id.CDOID; +import org.eclipse.emf.cdo.common.protocol.CDODataInput; +import org.eclipse.emf.cdo.common.protocol.CDOProtocolConstants; +import org.eclipse.emf.cdo.internal.net4j.CDONet4jSessionConfigurationImpl.RepositoryInfo; +import org.eclipse.emf.cdo.internal.net4j.CDONet4jSessionImpl; + +import java.io.IOException; + +/** + * @author Eike Stepper + */ +public class RepositoryStateNotificationIndication extends CDOClientIndication +{ + public RepositoryStateNotificationIndication(CDOClientProtocol protocol) + { + super(protocol, CDOProtocolConstants.SIGNAL_REPOSITORY_STATE_NOTIFICATION); + } + + @Override + protected void indicating(CDODataInput in) throws IOException + { + CDOCommonRepository.State oldState = in.readEnum(CDOCommonRepository.State.class); + CDOCommonRepository.State newState = in.readEnum(CDOCommonRepository.State.class); + CDOID rootResourceID = in.readCDOID(); + + CDONet4jSessionImpl session = (CDONet4jSessionImpl)getSession(); + RepositoryInfo repositoryInfo = (RepositoryInfo)session.getRepositoryInfo(); + repositoryInfo.setState(newState); + repositoryInfo.setRootResourceID(rootResourceID); + + session.handleRepositoryStateChanged(oldState, newState); + } +} diff --git a/plugins/org.eclipse.emf.cdo.net4j/src/org/eclipse/emf/cdo/internal/net4j/protocol/RepositoryTimeRequest.java b/plugins/org.eclipse.emf.cdo.net4j/src/org/eclipse/emf/cdo/internal/net4j/protocol/RepositoryTimeRequest.java index 602067a0d7..c4f0eb6b24 100644 --- a/plugins/org.eclipse.emf.cdo.net4j/src/org/eclipse/emf/cdo/internal/net4j/protocol/RepositoryTimeRequest.java +++ b/plugins/org.eclipse.emf.cdo.net4j/src/org/eclipse/emf/cdo/internal/net4j/protocol/RepositoryTimeRequest.java @@ -1,36 +1,36 @@ -/*
- * 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.net4j.protocol;
-
-import org.eclipse.emf.cdo.common.protocol.CDODataInput;
-import org.eclipse.emf.cdo.common.protocol.CDOProtocolConstants;
-
-import org.eclipse.emf.spi.cdo.CDOSessionProtocol.RepositoryTimeResult;
-
-import java.io.IOException;
-
-/**
- * @author Eike Stepper
- */
-public class RepositoryTimeRequest extends CDOTimeRequest<RepositoryTimeResult>
-{
- public RepositoryTimeRequest(CDOClientProtocol protocol)
- {
- super(protocol, CDOProtocolConstants.SIGNAL_REPOSITORY_TIME);
- }
-
- @Override
- protected RepositoryTimeResult confirming(CDODataInput in) throws IOException
- {
- super.confirming(in);
- return getRepositoryTimeResult();
- }
-}
+/* + * 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.net4j.protocol; + +import org.eclipse.emf.cdo.common.protocol.CDODataInput; +import org.eclipse.emf.cdo.common.protocol.CDOProtocolConstants; + +import org.eclipse.emf.spi.cdo.CDOSessionProtocol.RepositoryTimeResult; + +import java.io.IOException; + +/** + * @author Eike Stepper + */ +public class RepositoryTimeRequest extends CDOTimeRequest<RepositoryTimeResult> +{ + public RepositoryTimeRequest(CDOClientProtocol protocol) + { + super(protocol, CDOProtocolConstants.SIGNAL_REPOSITORY_TIME); + } + + @Override + protected RepositoryTimeResult confirming(CDODataInput in) throws IOException + { + super.confirming(in); + return getRepositoryTimeResult(); + } +} diff --git a/plugins/org.eclipse.emf.cdo.net4j/src/org/eclipse/emf/cdo/internal/net4j/protocol/RepositoryTypeNotificationIndication.java b/plugins/org.eclipse.emf.cdo.net4j/src/org/eclipse/emf/cdo/internal/net4j/protocol/RepositoryTypeNotificationIndication.java index 9e40db41fd..04918808da 100644 --- a/plugins/org.eclipse.emf.cdo.net4j/src/org/eclipse/emf/cdo/internal/net4j/protocol/RepositoryTypeNotificationIndication.java +++ b/plugins/org.eclipse.emf.cdo.net4j/src/org/eclipse/emf/cdo/internal/net4j/protocol/RepositoryTypeNotificationIndication.java @@ -1,43 +1,43 @@ -/*
- * 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
- * Simon McDuff - bug 233490
- */
-package org.eclipse.emf.cdo.internal.net4j.protocol;
-
-import org.eclipse.emf.cdo.common.CDOCommonRepository;
-import org.eclipse.emf.cdo.common.protocol.CDODataInput;
-import org.eclipse.emf.cdo.common.protocol.CDOProtocolConstants;
-import org.eclipse.emf.cdo.internal.net4j.CDONet4jSessionConfigurationImpl.RepositoryInfo;
-import org.eclipse.emf.cdo.internal.net4j.CDONet4jSessionImpl;
-
-import java.io.IOException;
-
-/**
- * @author Eike Stepper
- */
-public class RepositoryTypeNotificationIndication extends CDOClientIndication
-{
- public RepositoryTypeNotificationIndication(CDOClientProtocol protocol)
- {
- super(protocol, CDOProtocolConstants.SIGNAL_REPOSITORY_TYPE_NOTIFICATION);
- }
-
- @Override
- protected void indicating(CDODataInput in) throws IOException
- {
- CDOCommonRepository.Type oldType = in.readEnum(CDOCommonRepository.Type.class);
- CDOCommonRepository.Type newType = in.readEnum(CDOCommonRepository.Type.class);
-
- CDONet4jSessionImpl session = (CDONet4jSessionImpl)getSession();
- RepositoryInfo repositoryInfo = (RepositoryInfo)session.getRepositoryInfo();
- repositoryInfo.setType(newType);
- session.handleRepositoryTypeChanged(oldType, newType);
- }
-}
+/* + * 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 + * Simon McDuff - bug 233490 + */ +package org.eclipse.emf.cdo.internal.net4j.protocol; + +import org.eclipse.emf.cdo.common.CDOCommonRepository; +import org.eclipse.emf.cdo.common.protocol.CDODataInput; +import org.eclipse.emf.cdo.common.protocol.CDOProtocolConstants; +import org.eclipse.emf.cdo.internal.net4j.CDONet4jSessionConfigurationImpl.RepositoryInfo; +import org.eclipse.emf.cdo.internal.net4j.CDONet4jSessionImpl; + +import java.io.IOException; + +/** + * @author Eike Stepper + */ +public class RepositoryTypeNotificationIndication extends CDOClientIndication +{ + public RepositoryTypeNotificationIndication(CDOClientProtocol protocol) + { + super(protocol, CDOProtocolConstants.SIGNAL_REPOSITORY_TYPE_NOTIFICATION); + } + + @Override + protected void indicating(CDODataInput in) throws IOException + { + CDOCommonRepository.Type oldType = in.readEnum(CDOCommonRepository.Type.class); + CDOCommonRepository.Type newType = in.readEnum(CDOCommonRepository.Type.class); + + CDONet4jSessionImpl session = (CDONet4jSessionImpl)getSession(); + RepositoryInfo repositoryInfo = (RepositoryInfo)session.getRepositoryInfo(); + repositoryInfo.setType(newType); + session.handleRepositoryTypeChanged(oldType, newType); + } +} diff --git a/plugins/org.eclipse.emf.cdo.net4j/src/org/eclipse/emf/cdo/internal/net4j/protocol/SetLockNotificationModeRequest.java b/plugins/org.eclipse.emf.cdo.net4j/src/org/eclipse/emf/cdo/internal/net4j/protocol/SetLockNotificationModeRequest.java index f8ad3ec10b..b9c6830f42 100644 --- a/plugins/org.eclipse.emf.cdo.net4j/src/org/eclipse/emf/cdo/internal/net4j/protocol/SetLockNotificationModeRequest.java +++ b/plugins/org.eclipse.emf.cdo.net4j/src/org/eclipse/emf/cdo/internal/net4j/protocol/SetLockNotificationModeRequest.java @@ -1,44 +1,44 @@ -/*
- * 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:
- * Caspar De Groot - initial API and implementation
- */
-package org.eclipse.emf.cdo.internal.net4j.protocol;
-
-import org.eclipse.emf.cdo.common.CDOCommonSession.Options.LockNotificationMode;
-import org.eclipse.emf.cdo.common.protocol.CDODataInput;
-import org.eclipse.emf.cdo.common.protocol.CDODataOutput;
-import org.eclipse.emf.cdo.common.protocol.CDOProtocolConstants;
-
-import java.io.IOException;
-
-/**
- * @author Caspar De Groot
- */
-public class SetLockNotificationModeRequest extends CDOClientRequest<Boolean>
-{
- private LockNotificationMode mode;
-
- public SetLockNotificationModeRequest(CDOClientProtocol protocol, LockNotificationMode mode)
- {
- super(protocol, CDOProtocolConstants.SIGNAL_SET_LOCK_NOTIFICATION_MODE);
- this.mode = mode;
- }
-
- @Override
- protected void requesting(CDODataOutput out) throws IOException
- {
- out.writeEnum(mode);
- }
-
- @Override
- protected Boolean confirming(CDODataInput in) throws IOException
- {
- return in.readBoolean();
- }
-}
+/* + * 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: + * Caspar De Groot - initial API and implementation + */ +package org.eclipse.emf.cdo.internal.net4j.protocol; + +import org.eclipse.emf.cdo.common.CDOCommonSession.Options.LockNotificationMode; +import org.eclipse.emf.cdo.common.protocol.CDODataInput; +import org.eclipse.emf.cdo.common.protocol.CDODataOutput; +import org.eclipse.emf.cdo.common.protocol.CDOProtocolConstants; + +import java.io.IOException; + +/** + * @author Caspar De Groot + */ +public class SetLockNotificationModeRequest extends CDOClientRequest<Boolean> +{ + private LockNotificationMode mode; + + public SetLockNotificationModeRequest(CDOClientProtocol protocol, LockNotificationMode mode) + { + super(protocol, CDOProtocolConstants.SIGNAL_SET_LOCK_NOTIFICATION_MODE); + this.mode = mode; + } + + @Override + protected void requesting(CDODataOutput out) throws IOException + { + out.writeEnum(mode); + } + + @Override + protected Boolean confirming(CDODataInput in) throws IOException + { + return in.readBoolean(); + } +} diff --git a/plugins/org.eclipse.emf.cdo.net4j/src/org/eclipse/emf/cdo/internal/net4j/protocol/SetPassiveUpdateModeRequest.java b/plugins/org.eclipse.emf.cdo.net4j/src/org/eclipse/emf/cdo/internal/net4j/protocol/SetPassiveUpdateModeRequest.java index 0fe22f8abd..044182b0d8 100644 --- a/plugins/org.eclipse.emf.cdo.net4j/src/org/eclipse/emf/cdo/internal/net4j/protocol/SetPassiveUpdateModeRequest.java +++ b/plugins/org.eclipse.emf.cdo.net4j/src/org/eclipse/emf/cdo/internal/net4j/protocol/SetPassiveUpdateModeRequest.java @@ -1,45 +1,45 @@ -/*
- * 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
- * Simon McDuff - bug 230832
- */
-package org.eclipse.emf.cdo.internal.net4j.protocol;
-
-import org.eclipse.emf.cdo.common.CDOCommonSession.Options.PassiveUpdateMode;
-import org.eclipse.emf.cdo.common.protocol.CDODataInput;
-import org.eclipse.emf.cdo.common.protocol.CDODataOutput;
-import org.eclipse.emf.cdo.common.protocol.CDOProtocolConstants;
-
-import java.io.IOException;
-
-/**
- * @author Eike Stepper
- */
-public class SetPassiveUpdateModeRequest extends CDOClientRequest<Boolean>
-{
- private PassiveUpdateMode mode;
-
- public SetPassiveUpdateModeRequest(CDOClientProtocol protocol, PassiveUpdateMode mode)
- {
- super(protocol, CDOProtocolConstants.SIGNAL_SET_PASSIVE_UPDATE_MODE);
- this.mode = mode;
- }
-
- @Override
- protected void requesting(CDODataOutput out) throws IOException
- {
- out.writeByte(mode.ordinal());
- }
-
- @Override
- protected Boolean confirming(CDODataInput in) throws IOException
- {
- return in.readBoolean();
- }
-}
+/* + * 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 + * Simon McDuff - bug 230832 + */ +package org.eclipse.emf.cdo.internal.net4j.protocol; + +import org.eclipse.emf.cdo.common.CDOCommonSession.Options.PassiveUpdateMode; +import org.eclipse.emf.cdo.common.protocol.CDODataInput; +import org.eclipse.emf.cdo.common.protocol.CDODataOutput; +import org.eclipse.emf.cdo.common.protocol.CDOProtocolConstants; + +import java.io.IOException; + +/** + * @author Eike Stepper + */ +public class SetPassiveUpdateModeRequest extends CDOClientRequest<Boolean> +{ + private PassiveUpdateMode mode; + + public SetPassiveUpdateModeRequest(CDOClientProtocol protocol, PassiveUpdateMode mode) + { + super(protocol, CDOProtocolConstants.SIGNAL_SET_PASSIVE_UPDATE_MODE); + this.mode = mode; + } + + @Override + protected void requesting(CDODataOutput out) throws IOException + { + out.writeByte(mode.ordinal()); + } + + @Override + protected Boolean confirming(CDODataInput in) throws IOException + { + return in.readBoolean(); + } +} diff --git a/plugins/org.eclipse.emf.cdo.net4j/src/org/eclipse/emf/cdo/internal/net4j/protocol/SwitchTargetRequest.java b/plugins/org.eclipse.emf.cdo.net4j/src/org/eclipse/emf/cdo/internal/net4j/protocol/SwitchTargetRequest.java index 94d07b9454..e9e867e5a4 100644 --- a/plugins/org.eclipse.emf.cdo.net4j/src/org/eclipse/emf/cdo/internal/net4j/protocol/SwitchTargetRequest.java +++ b/plugins/org.eclipse.emf.cdo.net4j/src/org/eclipse/emf/cdo/internal/net4j/protocol/SwitchTargetRequest.java @@ -1,88 +1,88 @@ -/*
- * 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.net4j.protocol;
-
-import org.eclipse.emf.cdo.common.branch.CDOBranchPoint;
-import org.eclipse.emf.cdo.common.branch.CDOBranchVersion;
-import org.eclipse.emf.cdo.common.id.CDOID;
-import org.eclipse.emf.cdo.common.id.CDOIDUtil;
-import org.eclipse.emf.cdo.common.protocol.CDODataInput;
-import org.eclipse.emf.cdo.common.protocol.CDODataOutput;
-import org.eclipse.emf.cdo.common.protocol.CDOProtocolConstants;
-import org.eclipse.emf.cdo.common.revision.CDOIDAndVersion;
-import org.eclipse.emf.cdo.common.revision.CDORevisionKey;
-
-import org.eclipse.net4j.util.om.monitor.OMMonitor;
-
-import org.eclipse.emf.spi.cdo.InternalCDOObject;
-
-import java.io.IOException;
-import java.util.List;
-
-/**
- * @author Eike Stepper
- */
-public class SwitchTargetRequest extends CDOClientRequestWithMonitoring<Object>
-{
- private int viewID;
-
- private CDOBranchPoint branchPoint;
-
- private List<InternalCDOObject> invalidObjects;
-
- private List<CDORevisionKey> allChangedObjects;
-
- private List<CDOIDAndVersion> allDetachedObjects;
-
- public SwitchTargetRequest(CDOClientProtocol protocol, int viewID, CDOBranchPoint branchPoint,
- List<InternalCDOObject> invalidObjects, List<CDORevisionKey> allChangedObjects,
- List<CDOIDAndVersion> allDetachedObjects)
- {
- super(protocol, CDOProtocolConstants.SIGNAL_SWITCH_TARGET);
- this.viewID = viewID;
- this.branchPoint = branchPoint;
- this.invalidObjects = invalidObjects;
- this.allChangedObjects = allChangedObjects;
- this.allDetachedObjects = allDetachedObjects;
- }
-
- @Override
- protected void requesting(CDODataOutput out, OMMonitor monitor) throws IOException
- {
- out.writeInt(viewID);
- out.writeCDOBranchPoint(branchPoint);
-
- out.writeInt(invalidObjects.size());
- for (InternalCDOObject object : invalidObjects)
- {
- out.writeCDOID(object.cdoID());
- }
- }
-
- @Override
- protected boolean[] confirming(CDODataInput in, OMMonitor monitor) throws IOException
- {
- int size = in.readInt();
- for (int i = 0; i < size; i++)
- {
- allChangedObjects.add(in.readCDORevisionDelta());
- }
-
- size = in.readInt();
- for (int i = 0; i < size; i++)
- {
- CDOID id = in.readCDOID();
- allDetachedObjects.add(CDOIDUtil.createIDAndVersion(id, CDOBranchVersion.UNSPECIFIED_VERSION));
- }
-
- return 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 + */ +package org.eclipse.emf.cdo.internal.net4j.protocol; + +import org.eclipse.emf.cdo.common.branch.CDOBranchPoint; +import org.eclipse.emf.cdo.common.branch.CDOBranchVersion; +import org.eclipse.emf.cdo.common.id.CDOID; +import org.eclipse.emf.cdo.common.id.CDOIDUtil; +import org.eclipse.emf.cdo.common.protocol.CDODataInput; +import org.eclipse.emf.cdo.common.protocol.CDODataOutput; +import org.eclipse.emf.cdo.common.protocol.CDOProtocolConstants; +import org.eclipse.emf.cdo.common.revision.CDOIDAndVersion; +import org.eclipse.emf.cdo.common.revision.CDORevisionKey; + +import org.eclipse.net4j.util.om.monitor.OMMonitor; + +import org.eclipse.emf.spi.cdo.InternalCDOObject; + +import java.io.IOException; +import java.util.List; + +/** + * @author Eike Stepper + */ +public class SwitchTargetRequest extends CDOClientRequestWithMonitoring<Object> +{ + private int viewID; + + private CDOBranchPoint branchPoint; + + private List<InternalCDOObject> invalidObjects; + + private List<CDORevisionKey> allChangedObjects; + + private List<CDOIDAndVersion> allDetachedObjects; + + public SwitchTargetRequest(CDOClientProtocol protocol, int viewID, CDOBranchPoint branchPoint, + List<InternalCDOObject> invalidObjects, List<CDORevisionKey> allChangedObjects, + List<CDOIDAndVersion> allDetachedObjects) + { + super(protocol, CDOProtocolConstants.SIGNAL_SWITCH_TARGET); + this.viewID = viewID; + this.branchPoint = branchPoint; + this.invalidObjects = invalidObjects; + this.allChangedObjects = allChangedObjects; + this.allDetachedObjects = allDetachedObjects; + } + + @Override + protected void requesting(CDODataOutput out, OMMonitor monitor) throws IOException + { + out.writeInt(viewID); + out.writeCDOBranchPoint(branchPoint); + + out.writeInt(invalidObjects.size()); + for (InternalCDOObject object : invalidObjects) + { + out.writeCDOID(object.cdoID()); + } + } + + @Override + protected boolean[] confirming(CDODataInput in, OMMonitor monitor) throws IOException + { + int size = in.readInt(); + for (int i = 0; i < size; i++) + { + allChangedObjects.add(in.readCDORevisionDelta()); + } + + size = in.readInt(); + for (int i = 0; i < size; i++) + { + CDOID id = in.readCDOID(); + allDetachedObjects.add(CDOIDUtil.createIDAndVersion(id, CDOBranchVersion.UNSPECIFIED_VERSION)); + } + + return null; + } +} diff --git a/plugins/org.eclipse.emf.cdo.net4j/src/org/eclipse/emf/cdo/internal/net4j/protocol/UnlockDelegationRequest.java b/plugins/org.eclipse.emf.cdo.net4j/src/org/eclipse/emf/cdo/internal/net4j/protocol/UnlockDelegationRequest.java index ac15fb2a7e..dc53a8f80a 100644 --- a/plugins/org.eclipse.emf.cdo.net4j/src/org/eclipse/emf/cdo/internal/net4j/protocol/UnlockDelegationRequest.java +++ b/plugins/org.eclipse.emf.cdo.net4j/src/org/eclipse/emf/cdo/internal/net4j/protocol/UnlockDelegationRequest.java @@ -1,42 +1,42 @@ -/*
- * 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:
- * Caspar De Groot - initial API and implementation
- */
-package org.eclipse.emf.cdo.internal.net4j.protocol;
-
-import org.eclipse.emf.cdo.common.id.CDOID;
-import org.eclipse.emf.cdo.common.protocol.CDODataOutput;
-import org.eclipse.emf.cdo.common.protocol.CDOProtocolConstants;
-
-import org.eclipse.net4j.util.concurrent.IRWLockManager.LockType;
-
-import java.io.IOException;
-import java.util.Collection;
-
-/**
- * @author Caspar De Groot
- */
-public class UnlockDelegationRequest extends UnlockObjectsRequest
-{
- private String lockAreaID;
-
- public UnlockDelegationRequest(CDOClientProtocol protocol, String lockAreaID, Collection<CDOID> objectIDs,
- LockType lockType, boolean recursive)
- {
- super(protocol, CDOProtocolConstants.SIGNAL_UNLOCK_DELEGATION, 0, objectIDs, lockType, recursive);
- this.lockAreaID = lockAreaID;
- }
-
- @Override
- protected void requesting(CDODataOutput out) throws IOException
- {
- out.writeString(lockAreaID);
- super.requesting(out);
- }
-}
+/* + * 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: + * Caspar De Groot - initial API and implementation + */ +package org.eclipse.emf.cdo.internal.net4j.protocol; + +import org.eclipse.emf.cdo.common.id.CDOID; +import org.eclipse.emf.cdo.common.protocol.CDODataOutput; +import org.eclipse.emf.cdo.common.protocol.CDOProtocolConstants; + +import org.eclipse.net4j.util.concurrent.IRWLockManager.LockType; + +import java.io.IOException; +import java.util.Collection; + +/** + * @author Caspar De Groot + */ +public class UnlockDelegationRequest extends UnlockObjectsRequest +{ + private String lockAreaID; + + public UnlockDelegationRequest(CDOClientProtocol protocol, String lockAreaID, Collection<CDOID> objectIDs, + LockType lockType, boolean recursive) + { + super(protocol, CDOProtocolConstants.SIGNAL_UNLOCK_DELEGATION, 0, objectIDs, lockType, recursive); + this.lockAreaID = lockAreaID; + } + + @Override + protected void requesting(CDODataOutput out) throws IOException + { + out.writeString(lockAreaID); + super.requesting(out); + } +} diff --git a/plugins/org.eclipse.emf.cdo.net4j/src/org/eclipse/emf/cdo/internal/net4j/protocol/UnlockObjectsRequest.java b/plugins/org.eclipse.emf.cdo.net4j/src/org/eclipse/emf/cdo/internal/net4j/protocol/UnlockObjectsRequest.java index 7032567181..1dd7f4d5aa 100644 --- a/plugins/org.eclipse.emf.cdo.net4j/src/org/eclipse/emf/cdo/internal/net4j/protocol/UnlockObjectsRequest.java +++ b/plugins/org.eclipse.emf.cdo.net4j/src/org/eclipse/emf/cdo/internal/net4j/protocol/UnlockObjectsRequest.java @@ -1,107 +1,107 @@ -/*
- * 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:
- * Simon McDuff - initial API and implementation
- */
-package org.eclipse.emf.cdo.internal.net4j.protocol;
-
-import org.eclipse.emf.cdo.common.id.CDOID;
-import org.eclipse.emf.cdo.common.lock.CDOLockState;
-import org.eclipse.emf.cdo.common.protocol.CDODataInput;
-import org.eclipse.emf.cdo.common.protocol.CDODataOutput;
-import org.eclipse.emf.cdo.common.protocol.CDOProtocolConstants;
-import org.eclipse.emf.cdo.internal.net4j.bundle.OM;
-
-import org.eclipse.net4j.util.concurrent.IRWLockManager.LockType;
-import org.eclipse.net4j.util.om.trace.ContextTracer;
-
-import org.eclipse.emf.spi.cdo.CDOSessionProtocol.UnlockObjectsResult;
-
-import java.io.IOException;
-import java.util.Collection;
-
-/**
- * @author Simon McDuff
- */
-public class UnlockObjectsRequest extends CDOClientRequest<UnlockObjectsResult>
-{
- private static final ContextTracer TRACER = new ContextTracer(OM.DEBUG_PROTOCOL, UnlockObjectsRequest.class);
-
- private int viewID;
-
- private Collection<CDOID> objectIDs;
-
- private LockType lockType;
-
- private boolean recursive;
-
- public UnlockObjectsRequest(CDOClientProtocol protocol, int viewID, Collection<CDOID> objects, LockType lockType,
- boolean recursive)
- {
- this(protocol, CDOProtocolConstants.SIGNAL_UNLOCK_OBJECTS, viewID, objects, lockType, recursive);
- }
-
- protected UnlockObjectsRequest(CDOClientProtocol protocol, short signalID, int viewID, Collection<CDOID> objectIDs,
- LockType lockType, boolean recursive)
- {
- super(protocol, signalID);
- this.viewID = viewID;
- this.objectIDs = objectIDs;
- this.lockType = lockType;
- this.recursive = recursive;
- }
-
- @Override
- protected void requesting(CDODataOutput out) throws IOException
- {
- out.writeInt(viewID);
- out.writeCDOLockType(lockType);
- out.writeBoolean(recursive);
- if (objectIDs == null)
- {
- if (TRACER.isEnabled())
- {
- TRACER.format("Unlocking all objects for view {0}", viewID); //$NON-NLS-1$
- }
-
- out.writeInt(CDOProtocolConstants.RELEASE_ALL_LOCKS);
- }
- else
- {
- if (TRACER.isEnabled())
- {
- TRACER.format("Unlocking of type {0} requested for view {1}", lockType == LockType.READ ? "read" //$NON-NLS-1$ //$NON-NLS-2$
- : "write", viewID); //$NON-NLS-1$
- }
-
- out.writeInt(objectIDs.size());
- for (CDOID id : objectIDs)
- {
- if (TRACER.isEnabled())
- {
- TRACER.format("Unlocking requested for object {0}", id); //$NON-NLS-1$
- }
-
- out.writeCDOID(id);
- }
- }
- }
-
- @Override
- protected UnlockObjectsResult confirming(CDODataInput in) throws IOException
- {
- long timestamp = in.readLong();
- int n = in.readInt();
- CDOLockState[] newLockStates = new CDOLockState[n];
- for (int i = 0; i < n; i++)
- {
- newLockStates[i] = in.readCDOLockState();
- }
- return new UnlockObjectsResult(newLockStates, timestamp);
- }
-}
+/* + * 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: + * Simon McDuff - initial API and implementation + */ +package org.eclipse.emf.cdo.internal.net4j.protocol; + +import org.eclipse.emf.cdo.common.id.CDOID; +import org.eclipse.emf.cdo.common.lock.CDOLockState; +import org.eclipse.emf.cdo.common.protocol.CDODataInput; +import org.eclipse.emf.cdo.common.protocol.CDODataOutput; +import org.eclipse.emf.cdo.common.protocol.CDOProtocolConstants; +import org.eclipse.emf.cdo.internal.net4j.bundle.OM; + +import org.eclipse.net4j.util.concurrent.IRWLockManager.LockType; +import org.eclipse.net4j.util.om.trace.ContextTracer; + +import org.eclipse.emf.spi.cdo.CDOSessionProtocol.UnlockObjectsResult; + +import java.io.IOException; +import java.util.Collection; + +/** + * @author Simon McDuff + */ +public class UnlockObjectsRequest extends CDOClientRequest<UnlockObjectsResult> +{ + private static final ContextTracer TRACER = new ContextTracer(OM.DEBUG_PROTOCOL, UnlockObjectsRequest.class); + + private int viewID; + + private Collection<CDOID> objectIDs; + + private LockType lockType; + + private boolean recursive; + + public UnlockObjectsRequest(CDOClientProtocol protocol, int viewID, Collection<CDOID> objects, LockType lockType, + boolean recursive) + { + this(protocol, CDOProtocolConstants.SIGNAL_UNLOCK_OBJECTS, viewID, objects, lockType, recursive); + } + + protected UnlockObjectsRequest(CDOClientProtocol protocol, short signalID, int viewID, Collection<CDOID> objectIDs, + LockType lockType, boolean recursive) + { + super(protocol, signalID); + this.viewID = viewID; + this.objectIDs = objectIDs; + this.lockType = lockType; + this.recursive = recursive; + } + + @Override + protected void requesting(CDODataOutput out) throws IOException + { + out.writeInt(viewID); + out.writeCDOLockType(lockType); + out.writeBoolean(recursive); + if (objectIDs == null) + { + if (TRACER.isEnabled()) + { + TRACER.format("Unlocking all objects for view {0}", viewID); //$NON-NLS-1$ + } + + out.writeInt(CDOProtocolConstants.RELEASE_ALL_LOCKS); + } + else + { + if (TRACER.isEnabled()) + { + TRACER.format("Unlocking of type {0} requested for view {1}", lockType == LockType.READ ? "read" //$NON-NLS-1$ //$NON-NLS-2$ + : "write", viewID); //$NON-NLS-1$ + } + + out.writeInt(objectIDs.size()); + for (CDOID id : objectIDs) + { + if (TRACER.isEnabled()) + { + TRACER.format("Unlocking requested for object {0}", id); //$NON-NLS-1$ + } + + out.writeCDOID(id); + } + } + } + + @Override + protected UnlockObjectsResult confirming(CDODataInput in) throws IOException + { + long timestamp = in.readLong(); + int n = in.readInt(); + CDOLockState[] newLockStates = new CDOLockState[n]; + for (int i = 0; i < n; i++) + { + newLockStates[i] = in.readCDOLockState(); + } + return new UnlockObjectsResult(newLockStates, timestamp); + } +} diff --git a/plugins/org.eclipse.emf.cdo.net4j/src/org/eclipse/emf/cdo/internal/net4j/protocol/UnsubscribeRemoteSessionsRequest.java b/plugins/org.eclipse.emf.cdo.net4j/src/org/eclipse/emf/cdo/internal/net4j/protocol/UnsubscribeRemoteSessionsRequest.java index b294347686..724d8b21c7 100644 --- a/plugins/org.eclipse.emf.cdo.net4j/src/org/eclipse/emf/cdo/internal/net4j/protocol/UnsubscribeRemoteSessionsRequest.java +++ b/plugins/org.eclipse.emf.cdo.net4j/src/org/eclipse/emf/cdo/internal/net4j/protocol/UnsubscribeRemoteSessionsRequest.java @@ -1,49 +1,49 @@ -/*
- * 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.net4j.protocol;
-
-import org.eclipse.emf.cdo.common.protocol.CDODataInput;
-import org.eclipse.emf.cdo.common.protocol.CDODataOutput;
-import org.eclipse.emf.cdo.common.protocol.CDOProtocolConstants;
-import org.eclipse.emf.cdo.internal.net4j.bundle.OM;
-
-import org.eclipse.net4j.util.om.trace.ContextTracer;
-
-import java.io.IOException;
-
-/**
- * @author Eike Stepper
- */
-public class UnsubscribeRemoteSessionsRequest extends CDOClientRequest<Boolean>
-{
- private static final ContextTracer TRACER = new ContextTracer(OM.DEBUG_PROTOCOL,
- UnsubscribeRemoteSessionsRequest.class);
-
- public UnsubscribeRemoteSessionsRequest(CDOClientProtocol protocol)
- {
- super(protocol, CDOProtocolConstants.SIGNAL_UNSUBSCRIBE_REMOTE_SESSIONS);
- }
-
- @Override
- protected void requesting(CDODataOutput out) throws IOException
- {
- if (TRACER.isEnabled())
- {
- TRACER.trace("Unsubscribing"); //$NON-NLS-1$
- }
- }
-
- @Override
- protected Boolean confirming(CDODataInput in) throws IOException
- {
- return in.readBoolean();
- }
-}
+/* + * 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.net4j.protocol; + +import org.eclipse.emf.cdo.common.protocol.CDODataInput; +import org.eclipse.emf.cdo.common.protocol.CDODataOutput; +import org.eclipse.emf.cdo.common.protocol.CDOProtocolConstants; +import org.eclipse.emf.cdo.internal.net4j.bundle.OM; + +import org.eclipse.net4j.util.om.trace.ContextTracer; + +import java.io.IOException; + +/** + * @author Eike Stepper + */ +public class UnsubscribeRemoteSessionsRequest extends CDOClientRequest<Boolean> +{ + private static final ContextTracer TRACER = new ContextTracer(OM.DEBUG_PROTOCOL, + UnsubscribeRemoteSessionsRequest.class); + + public UnsubscribeRemoteSessionsRequest(CDOClientProtocol protocol) + { + super(protocol, CDOProtocolConstants.SIGNAL_UNSUBSCRIBE_REMOTE_SESSIONS); + } + + @Override + protected void requesting(CDODataOutput out) throws IOException + { + if (TRACER.isEnabled()) + { + TRACER.trace("Unsubscribing"); //$NON-NLS-1$ + } + } + + @Override + protected Boolean confirming(CDODataInput in) throws IOException + { + return in.readBoolean(); + } +} |