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
|
//
// Copyright (c) ZeroC, Inc. All rights reserved.
//
import IceObjc
class AdminFacetFacade: ICEBlobjectFacade {
private let communicator: Communicator
var disp: Disp
init(communicator: Communicator, disp: Disp) {
self.communicator = communicator
self.disp = disp
}
func facadeInvoke(_ adapter: ICEObjectAdapter, inEncaps: Data, con: ICEConnection?,
name: String, category: String, facet: String, operation: String, mode: UInt8,
context: [String: String], requestId: Int32, encodingMajor: UInt8, encodingMinor: UInt8,
response: @escaping ICEBlobjectResponse,
exception: @escaping ICEBlobjectException) {
let objectAdapter = adapter.getSwiftObject(ObjectAdapterI.self) {
let oa = ObjectAdapterI(handle: adapter, communicator: communicator)
// Register the admin OA's id with the servant manager. This is used to distinguish between
// ObjectNotExistException and FacetNotExistException when a servant is not found on
// a Swift Admin OA.
oa.servantManager.setAdminId(Identity(name: name, category: category))
return oa
}
let connection = con?.getSwiftObject(ConnectionI.self) { ConnectionI(handle: con!) } ?? nil
let current = Current(adapter: objectAdapter,
con: connection,
id: Identity(name: name, category: category),
facet: facet,
operation: operation,
mode: OperationMode(rawValue: mode)!,
ctx: context,
requestId: requestId,
encoding: EncodingVersion(major: encodingMajor, minor: encodingMinor))
let incoming = Incoming(istr: InputStream(communicator: communicator,
encoding: EncodingVersion(major: encodingMajor,
minor: encodingMinor),
bytes: inEncaps),
response: response,
exception: exception,
current: current)
dispatch(incoming: incoming, current: current)
}
func dispatch(incoming: Incoming, current: Current) {
// Dispatch directly to the servant. Do not call invoke on Incoming
do {
try disp.dispatch(request: incoming, current: current)
} catch {
incoming.exception(error)
}
}
func facadeRemoved() {}
}
final class UnsupportedAdminFacet: LocalObject<ICEUnsupportedAdminFacet>, Object {
func ice_id(current _: Current) -> String {
return ObjectTraits.staticId
}
func ice_ids(current _: Current) -> [String] {
return ObjectTraits.staticIds
}
func ice_isA(id: String, current _: Current) -> Bool {
return id == ObjectTraits.staticId
}
func ice_ping(current _: Current) {}
}
class AdminFacetFactory: ICEAdminFacetFactory {
static func createProcess(_ communicator: ICECommunicator, handle: ICEProcess) -> ICEBlobjectFacade {
let c = communicator.getCachedSwiftObject(CommunicatorI.self)
return AdminFacetFacade(communicator: c,
disp: ProcessDisp(handle.getSwiftObject(ProcessI.self) {
ProcessI(handle: handle)
}))
}
static func createProperties(_ communicator: ICECommunicator, handle: ICEPropertiesAdmin) -> ICEBlobjectFacade {
let c = communicator.getCachedSwiftObject(CommunicatorI.self)
return AdminFacetFacade(communicator: c,
disp: PropertiesAdminDisp(handle.getSwiftObject(PropertiesAdminI.self) {
PropertiesAdminI(communicator: c, handle: handle)
}))
}
static func createUnsupported(_ communicator: ICECommunicator,
handle: ICEUnsupportedAdminFacet) -> ICEBlobjectFacade {
let c = communicator.getCachedSwiftObject(CommunicatorI.self)
return AdminFacetFacade(communicator: c,
disp: ObjectDisp(handle.getSwiftObject(UnsupportedAdminFacet.self) {
UnsupportedAdminFacet(handle: handle)
}))
}
}
|