1 //
2 // Copyright (c) ZeroC, Inc. All rights reserved.
3 //
4 
5 package test.Ice.echo;
6 
7 public class Server extends test.TestHelper
8 {
9     class EchoI extends test.Ice.echo.Test._EchoDisp
10     {
EchoI(BlobjectI blob)11         public EchoI(BlobjectI blob)
12         {
13             _blob = blob;
14         }
15 
16         @Override
startBatch(Ice.Current current)17         public void startBatch(Ice.Current current)
18         {
19             _blob.startBatch();
20         }
21 
22         @Override
flushBatch(Ice.Current current)23         public void flushBatch(Ice.Current current)
24         {
25             _blob.flushBatch();
26         }
27 
28         @Override
shutdown(Ice.Current current)29         public void shutdown(Ice.Current current)
30         {
31             current.adapter.getCommunicator().shutdown();
32         }
33 
34         final private BlobjectI _blob;
35     };
36 
run(String[] args)37     public void run(String[] args)
38     {
39         Ice.Properties properties = createTestProperties(args);
40         properties.setProperty("Ice.Package.Test", "test.Ice.echo");
41         try(Ice.Communicator communicator = initialize(properties))
42         {
43             communicator.getProperties().setProperty("TestAdapter.Endpoints", getTestEndpoint(0));
44             Ice.ObjectAdapter adapter = communicator.createObjectAdapter("TestAdapter");
45             BlobjectI blob = new BlobjectI();
46             adapter.addDefaultServant(blob, "");
47             adapter.add(new EchoI(blob), Ice.Util.stringToIdentity("__echo"));
48             adapter.activate();
49             serverReady();
50             communicator.waitForShutdown();
51         }
52     }
53 }
54