-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathClient.java
47 lines (37 loc) · 908 Bytes
/
Client.java
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
import org.omg.CORBA.ORB;
import java.io.*;
public class Client {
public static void main(String[] args) {
java.util.Properties props = System.getProperties();
int status;
ORB orb = null;
try {
orb = org.omg.CORBA.ORB.init(args, props);
status = run(orb);
} catch (Exception ex) {
ex.printStackTrace();
status = 1;
}
if (orb != null) {
try {
orb.destroy();
} catch (Exception ex) {
ex.printStackTrace();
status = 1;
}
}
System.exit(status);
}
static int run(org.omg.CORBA.ORB orb) throws IOException {
org.omg.CORBA.Object obj;
String refFile = "Hello.ref";
FileInputStream file = new FileInputStream(refFile);
BufferedReader in = new BufferedReader(new InputStreamReader(file));
String ref = in .readLine();
file.close();
obj = orb.string_to_object(ref);
Hello hello = HelloHelper.narrow(obj);
hello.hello();
return 0;
}
}