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
|
/*******************************************************************************
* Copyright (c) 2013 Xilinx, Inc. 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:
* Xilinx - initial API and implementation
*******************************************************************************/
package org.eclipse.tcf.internal.services.remote;
import java.util.Map;
import org.eclipse.tcf.core.Command;
import org.eclipse.tcf.protocol.IChannel;
import org.eclipse.tcf.protocol.IToken;
import org.eclipse.tcf.services.IDPrintf;
public class DPrintfProxy implements IDPrintf {
private final IChannel channel;
public DPrintfProxy(IChannel channel) {
this.channel = channel;
}
@Override
public String getName() {
return NAME;
}
@Override
public IToken open(Map<String,Object>[] properties, final DoneCommandOpen done) {
return new Command(channel, this, "open", new Object[]{ properties }) {
@Override
public void done(Exception error, Object[] args) {
String id = null;
if (error == null) {
assert args.length == 2;
error = toError(args[0]);
id = (String)args[1];
}
done.doneCommandOpen(token, error, id);
}
}.token;
}
@Override
public IToken close(final DoneCommandClose done) {
return new Command(channel, this, "close", null) {
@Override
public void done(Exception error, Object[] args) {
if (error == null) {
assert args.length == 1;
error = toError(args[0]);
}
done.doneCommandClose(token, error);
}
}.token;
}
}
|