Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
BitchX
GitHub Repository: BitchX/BitchX1.3
Path: blob/master/dll/europa/corba/ai.java
1074 views
1
import java.io.*;
2
import org.omg.CORBA.*;
3
import EuropaAI.*;
4
5
class EuropaServant extends _EuropaImplBase {
6
public void inputChat(String text) {
7
System.out.println(text);
8
}
9
}
10
11
public class ai {
12
public static void main(String args[]) {
13
try {
14
ORB orb = ORB.init(args, null);
15
16
// create the servant and register it
17
EuropaServant europaRef = new EuropaServant();
18
orb.connect(europaRef);
19
20
// stringify the europaRef and dump to an ior file
21
String str = orb.object_to_string(europaRef);
22
FileOutputStream fos = new FileOutputStream("ai.ior");
23
PrintStream ps = new PrintStream(fos);
24
ps.print(str);
25
ps.close();
26
27
// wait for invocations from clients
28
java.lang.Object sync = new java.lang.Object();
29
synchronized (sync) {
30
sync.wait();
31
}
32
33
} catch (Exception e) {
34
System.err.println("Error: " + e);
35
e.printStackTrace(System.out);
36
}
37
}
38
}
39
40