blob: 68406941bf8cc9c98c37e825a7393d8828592845 (
plain)
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
86
87
88
89
90
91
92
93
94
|
/*
D-Bus Java Implementation
Copyright (c) 2005-2006 Matthew Johnson
This program is free software; you can redistribute it and/or modify it
under the terms of either the GNU Lesser General Public License Version 2 or the
Academic Free Licence Version 2.1.
Full licence texts are included in the COPYING file with this program.
*/
package org.freedesktop.dbus.test;
import java.lang.reflect.Type;
import java.io.FileOutputStream;
import java.io.PrintWriter;
import java.util.Arrays;
import java.util.List;
import java.util.Map;
import org.freedesktop.dbus.DirectConnection;
import org.freedesktop.dbus.Path;
import org.freedesktop.dbus.UInt16;
public class test_p2p_server implements TestRemoteInterface
{
public int[][] teststructstruct(TestStruct3 in)
{
List<List<Integer>> lli = in.b;
int[][] out = new int[lli.size()][];
for (int j = 0; j < out.length; j++) {
out[j] = new int[lli.get(j).size()];
for (int k = 0; k < out[j].length; k++)
out[j][k] = lli.get(j).get(k);
}
return out;
}
public String getNameAndThrow()
{
return getName();
}
public String getName()
{
System.out.println("getName called");
return "Peer2Peer Server";
}
public <T> int frobnicate(List<Long> n, Map<String,Map<UInt16,Short>> m, T v)
{
return 3;
}
public void throwme() throws TestException
{
System.out.println("throwme called");
throw new TestException("BOO");
}
public void waitawhile()
{
return;
}
public int overload()
{
return 1;
}
public void sig(Type[] s)
{
}
public void newpathtest(Path p)
{
}
public void reg13291(byte[] as, byte[] bs)
{
}
public Path pathrv(Path a) { return a; }
public List<Path> pathlistrv(List<Path> a) { return a; }
public Map<Path,Path> pathmaprv(Map<Path,Path> a) { return a; }
public boolean isRemote() { return false; }
public float testfloat(float[] f)
{
System.out.println("got float: "+Arrays.toString(f));
return f[0];
}
public static void main(String[] args) throws Exception
{
String address = DirectConnection.createDynamicSession();
//String address = "tcp:host=localhost,port=12344,guid="+Transport.genGUID();
PrintWriter w = new PrintWriter(new FileOutputStream("address"));
w.println(address);
w.flush();
w.close();
DirectConnection dc = new DirectConnection(address+",listen=true");
System.out.println("Connected");
dc.exportObject("/Test", new test_p2p_server());
}
}
|