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
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
|
// **********************************************************************
//
// Copyright (c) 2003-2016 ZeroC, Inc. All rights reserved.
//
// This copy of Ice is licensed to you under the terms described in the
// ICE_LICENSE file included in this distribution.
//
// **********************************************************************
const Ice = require("../Ice/ModuleRegistry").Ice;
Ice._ModuleRegistry.require(module,
[
"../Ice/Instance",
"../Ice/UUID",
"../Ice/AsyncResultBase"
]);
const Instance = Ice.Instance;
//
// Ice.Communicator
//
class Communicator
{
constructor(initData)
{
this._instance = new Instance(initData);
}
//
// Certain initialization tasks need to be completed after the
// constructor.
//
finishSetup(promise)
{
this._instance.finishSetup(this, promise);
}
destroy()
{
return this._instance.destroy();
}
shutdown()
{
this._instance.objectAdapterFactory().shutdown();
}
waitForShutdown()
{
return this._instance.objectAdapterFactory().waitForShutdown();
}
isShutdown()
{
return this._instance.objectAdapterFactory().isShutdown();
}
stringToProxy(s)
{
return this._instance.proxyFactory().stringToProxy(s);
}
proxyToString(proxy)
{
return this._instance.proxyFactory().proxyToString(proxy);
}
propertyToProxy(s)
{
return this._instance.proxyFactory().propertyToProxy(s);
}
proxyToProperty(proxy, prefix)
{
return this._instance.proxyFactory().proxyToProperty(proxy, prefix);
}
stringToIdentity(s)
{
return Ice.stringToIdentity(s);
}
identityToString(ident)
{
return Ice.identityToString(ident, this._instance.toStringMode());
}
createObjectAdapter(name)
{
const promise = new Ice.AsyncResultBase(this, "createObjectAdapter", this, null, null);
this._instance.objectAdapterFactory().createObjectAdapter(name, null, promise);
return promise;
}
createObjectAdapterWithEndpoints(name, endpoints)
{
if(name.length === 0)
{
name = Ice.generateUUID();
}
this.getProperties().setProperty(name + ".Endpoints", endpoints);
const promise = new Ice.AsyncResultBase(this, "createObjectAdapterWithEndpoints", this, null, null);
this._instance.objectAdapterFactory().createObjectAdapter(name, null, promise);
return promise;
}
createObjectAdapterWithRouter(name, router)
{
if(name.length === 0)
{
name = Ice.generateUUID();
}
const promise = new Ice.AsyncResultBase(this, "createObjectAdapterWithRouter", this, null, null);
//
// We set the proxy properties here, although we still use the proxy supplied.
//
this.proxyToProperty(router, name + ".Router").forEach((value, key) =>
{
this.getProperties().setProperty(key, value);
});
this._instance.objectAdapterFactory().createObjectAdapter(name, router, promise);
return promise;
}
addObjectFactory(factory, id)
{
this._instance.addObjectFactory(factory, id);
}
findObjectFactory(id)
{
return this._instance.findObjectFactory(id);
}
getValueFactoryManager()
{
return this._instance.initializationData().valueFactoryManager;
}
getImplicitContext()
{
return this._instance.getImplicitContext();
}
getProperties()
{
return this._instance.initializationData().properties;
}
getLogger()
{
return this._instance.initializationData().logger;
}
getDefaultRouter()
{
return this._instance.referenceFactory().getDefaultRouter();
}
setDefaultRouter(router)
{
this._instance.setDefaultRouter(router);
}
getDefaultLocator()
{
return this._instance.referenceFactory().getDefaultLocator();
}
setDefaultLocator(locator)
{
this._instance.setDefaultLocator(locator);
}
flushBatchRequests()
{
return this._instance.outgoingConnectionFactory().flushAsyncBatchRequests();
}
get instance()
{
return this._instance;
}
}
Ice.Communicator = Communicator;
module.exports.Ice = Ice;
|