forked from zeroc-ice/ice-demos
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathClient.java
47 lines (42 loc) · 1.27 KB
/
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
// **********************************************************************
//
// Copyright (c) 2003-2017 ZeroC, Inc. All rights reserved.
//
// **********************************************************************
import Filesystem.*;
public class Client
{
public static void main(String[] args)
{
int status = 0;
//
// try with resource block - communicator is automatically destroyed
// at the end of this try block
//
try(com.zeroc.Ice.Communicator communicator = com.zeroc.Ice.Util.initialize(args))
{
//
// Create a proxy for the root directory
//
com.zeroc.Ice.ObjectPrx base = communicator.stringToProxy("RootDir:default -h localhost -p 10000");
//
// Down-cast the proxy to a Directory proxy.
//
DirectoryPrx rootDir = DirectoryPrx.checkedCast(base);
if(rootDir == null)
{
throw new Error("Invalid proxy");
}
Parser p = new Parser(rootDir);
status = p.parse();
}
System.exit(status);
}
private static class Error extends RuntimeException
{
public Error(String msg)
{
super(msg);
}
}
}