blob: 9539d9c5228363ab4d21e7442142a8bfa498a18c (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
|
/*
* Copyright (c) 2010-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.CDOBranchPoint;
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 static final DelegationIDProvider delegationIDProvider = new DelegationIDProvider();
private CDOBranch branch;
private String userID;
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 long getLastUpdateTime()
{
return CDOBranchPoint.UNSPECIFIED_DATE;
}
@Override
protected CDOBranch getBranch()
{
return branch;
}
@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;
}
}
}
|