summaryrefslogtreecommitdiff
path: root/swift/src
diff options
context:
space:
mode:
Diffstat (limited to 'swift/src')
-rw-r--r--swift/src/Ice/AdminFacetFactory.swift71
-rw-r--r--swift/src/Ice/CommunicatorI.swift104
-rw-r--r--swift/src/Ice/Globals.swift12
-rw-r--r--swift/src/Ice/InitializationData.swift3
-rw-r--r--swift/src/Ice/NativePropertiesAdmin.swift29
-rw-r--r--swift/src/Ice/ObjectAdapterI.swift26
-rw-r--r--swift/src/Ice/ProcessI.swift24
-rw-r--r--swift/src/Ice/PropertiesAdminI.swift46
-rw-r--r--swift/src/IceObjc/BlobjectFacade.mm52
-rw-r--r--swift/src/IceObjc/Communicator.mm145
-rw-r--r--swift/src/IceObjc/Connection.mm2
-rw-r--r--swift/src/IceObjc/IceObjcAdminFacetFactory.h26
-rw-r--r--swift/src/IceObjc/IceObjcBlobjectFacade.h69
-rw-r--r--swift/src/IceObjc/IceObjcCommunicator.h10
-rw-r--r--swift/src/IceObjc/IceObjcConnection.h2
-rw-r--r--swift/src/IceObjc/IceObjcIceUtil.h5
-rw-r--r--swift/src/IceObjc/IceObjcObjectAdapter.h23
-rw-r--r--swift/src/IceObjc/IceObjcProcess.h28
-rw-r--r--swift/src/IceObjc/IceObjcPropertiesAdmin.h30
-rw-r--r--swift/src/IceObjc/IceObjcUnsupportedAdminFacet.h26
-rw-r--r--swift/src/IceObjc/IceObjcUtil.h1
-rw-r--r--swift/src/IceObjc/IceUtil.mm9
-rw-r--r--swift/src/IceObjc/ObjectAdapter.mm64
-rw-r--r--swift/src/IceObjc/Process.mm56
-rw-r--r--swift/src/IceObjc/PropertiesAdmin.mm88
-rw-r--r--swift/src/IceObjc/UnsupportedAdminFacet.mm26
-rw-r--r--swift/src/IceObjc/Util.mm1
-rw-r--r--swift/src/IceObjc/module.map5
28 files changed, 863 insertions, 120 deletions
diff --git a/swift/src/Ice/AdminFacetFactory.swift b/swift/src/Ice/AdminFacetFactory.swift
new file mode 100644
index 00000000000..fe82af303a0
--- /dev/null
+++ b/swift/src/Ice/AdminFacetFactory.swift
@@ -0,0 +1,71 @@
+// **********************************************************************
+//
+// Copyright (c) 2003-2018 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.
+//
+// **********************************************************************
+
+import IceObjc
+
+class AdminFacetFacade: ICEBlobjectFacade {
+ let communicator: Communicator
+ let servant: Object
+
+ init(communicator: Communicator, servant: Object) {
+ self.communicator = communicator
+ self.servant = servant
+ }
+
+ func facadeInvoke(_ adapter: ICEObjectAdapter, is: ICEInputStream, con: ICEConnection,
+ name: String, category: String, facet: String, operation: String, mode: UInt8,
+ context: [String: String], requestId: Int32, encodingMajor: UInt8, encodingMinor: UInt8,
+ response: @escaping (Bool, UnsafeRawPointer?, Int) -> Void,
+ exception: @escaping (ICERuntimeException) -> Void) {
+ let current = Current(adapter: adapter.assign(to: ObjectAdapterI.self) {
+ ObjectAdapterI(handle: adapter, communicator: communicator, queue: communicator.getAdminDispatchQueue())
+ },
+ con: con.assign(to: ConnectionI.self) { ConnectionI(handle: con) },
+ id: Identity(name: name, category: category),
+ facet: facet,
+ operation: operation,
+ mode: OperationMode(rawValue: mode)!,
+ ctx: context,
+ requestId: requestId,
+ encoding: EncodingVersion(major: encodingMajor, minor: encodingMinor))
+
+ current.adapter!.getDispatchQueue().sync {
+ let istr = InputStream(communicator: communicator, inputStream: `is`)
+ let inc = Incoming(istr: istr, response: response, exception: exception, current: current)
+ // Dispatch directly to the servant. Do not call invoke on Incoming
+ do {
+ try servant.iceDispatch(incoming: inc, current: current)
+ } catch let err {
+ exception(inc.convertException(err))
+ }
+ }
+ }
+
+ func facadeRemoved() {}
+}
+
+class UnsupportedAdminFacet: LocalObject<ICEUnsupportedAdminFacet>, Object {}
+
+class AdminFacetFactory: ICEAdminFacetFactory {
+ static func createProcess(_ communicator: ICECommunicator, handle: ICEProcess) -> ICEBlobjectFacade {
+ let c = communicator.to(type: CommunicatorI.self)
+ return AdminFacetFacade(communicator: c, servant: ProcessI(handle: handle))
+ }
+
+ static func createProperties(_ communicator: ICECommunicator, handle: ICEPropertiesAdmin) -> ICEBlobjectFacade {
+ let c = communicator.to(type: CommunicatorI.self)
+ return AdminFacetFacade(communicator: c, servant: PropertiesAdminI(communicator: c, handle: handle))
+ }
+
+ static func createUnsupported(_ communicator: ICECommunicator,
+ handle: ICEUnsupportedAdminFacet) -> ICEBlobjectFacade {
+ let c = communicator.to(type: CommunicatorI.self)
+ return AdminFacetFacade(communicator: c, servant: UnsupportedAdminFacet(handle: handle))
+ }
+}
diff --git a/swift/src/Ice/CommunicatorI.swift b/swift/src/Ice/CommunicatorI.swift
index 11233bbf8dc..d844eb40c55 100644
--- a/swift/src/Ice/CommunicatorI.swift
+++ b/swift/src/Ice/CommunicatorI.swift
@@ -11,15 +11,28 @@ import IceObjc
import PromiseKit
class CommunicatorI: LocalObject<ICECommunicator>, Communicator {
- let properties: Properties
- let logger: Logger
let valueFactoryManager: ValueFactoryManager = ValueFactoryManagerI()
let defaultsAndOverrides: DefaultsAndOverrides
+ let initData: InitializationData
+
+ var mutex: Mutex = Mutex()
+ var _adminAdapter: ObjectAdapter?
+ var adminAdapter: ObjectAdapter? {
+ get {
+ return mutex.sync {
+ _adminAdapter
+ }
+ }
+ set(newAdapter) {
+ mutex.sync {
+ _adminAdapter = newAdapter
+ }
+ }
+ }
- init(handle: ICECommunicator, properties: Properties, logger: Logger) {
- self.properties = properties
- self.logger = logger
- self.defaultsAndOverrides = DefaultsAndOverrides(handle: handle)
+ init(handle: ICECommunicator, initData: InitializationData) {
+ defaultsAndOverrides = DefaultsAndOverrides(handle: handle)
+ self.initData = initData
super.init(handle: handle)
}
@@ -67,13 +80,13 @@ class CommunicatorI: LocalObject<ICECommunicator>, Communicator {
func stringToIdentity(_ str: String) throws -> Identity {
return try autoreleasepool {
- return try Ice.stringToIdentity(str)
+ try Ice.stringToIdentity(str)
}
}
func identityToString(_ id: Identity) throws -> String {
return try autoreleasepool {
- return try Ice.identityToString(id: id)
+ try Ice.identityToString(id: id)
}
}
@@ -106,11 +119,11 @@ class CommunicatorI: LocalObject<ICECommunicator>, Communicator {
}
func getProperties() -> Properties {
- return properties
+ return initData.properties!
}
func getLogger() -> Logger {
- return logger
+ return initData.logger!
}
func getDefaultRouter() -> RouterPrx? {
@@ -164,34 +177,59 @@ class CommunicatorI: LocalObject<ICECommunicator>, Communicator {
}
}
- func createAdmin(adminAdapter _: ObjectAdapter, adminId _: Identity) throws -> ObjectPrx {
- // TODO:
- preconditionFailure("Not yet implemented")
+ func createAdmin(adminAdapter: ObjectAdapter?, adminId: Identity) throws -> ObjectPrx {
+ return try autoreleasepool {
+ let handle = try _handle.createAdmin((adminAdapter as! ObjectAdapterI)._handle,
+ name: adminId.name,
+ category: adminId.category)
+ self.adminAdapter = adminAdapter
+
+ return _ObjectPrxI(handle: handle, communicator: self)
+ }
}
func getAdmin() throws -> ObjectPrx? {
- // TODO:
- preconditionFailure("Not yet implemented")
+ return try autoreleasepool {
+ guard let handle = try _handle.getAdmin() as? ICEObjectPrx else {
+ return nil
+ }
+
+ return _ObjectPrxI(handle: handle, communicator: self)
+ }
}
- func addAdminFacet(servant _: Object, facet _: String) throws {
- // TODO:
- preconditionFailure("Not yet implemented")
+ func addAdminFacet(servant: Object, facet: String) throws {
+ try autoreleasepool {
+ try _handle.addAdminFacet(AdminFacetFacade(communicator: self, servant: servant), facet: facet)
+ }
}
func removeAdminFacet(_ facet: String) throws -> Object {
- // TODO:
- preconditionFailure("Not yet implemented")
+ return try autoreleasepool {
+ guard let facade = try _handle.removeAdminFacet(facet) as? AdminFacetFacade else {
+ preconditionFailure()
+ }
+
+ return facade.servant
+ }
}
func findAdminFacet(_ facet: String) throws -> Object? {
- // TODO:
- preconditionFailure("Not yet implemented")
+ return try autoreleasepool {
+ guard let facade = try _handle.findAdminFacet(facet) as? AdminFacetFacade else {
+ return nil
+ }
+
+ return facade.servant
+ }
}
func findAllAdminFacets() throws -> FacetMap {
- // TODO:
- preconditionFailure("Not yet implemented")
+ return try autoreleasepool {
+ try _handle.findAllAdminFacets().mapValues { facade in
+ (facade as! AdminFacetFacade).servant
+ }
+ }
}
}
@@ -219,16 +257,28 @@ public extension Communicator {
return ObjectAdapterI(handle: handle, communicator: self, queue: queue)
}
}
+
+ func getAdminDispatchQueue() -> DispatchQueue {
+ let impl = (self as! CommunicatorI)
+
+ if let adapter = impl.adminAdapter {
+ return adapter.getDispatchQueue()
+ }
+
+ if let queue = impl.initData.adminDispatchQueue {
+ return queue
+ }
+
+ return serialQueue
+ }
}
public class DefaultsAndOverrides {
-
public init(handle: ICECommunicator) {
-
var defaultEncoding = EncodingVersion()
handle.getDefaultEncoding(major: &defaultEncoding.major, minor: &defaultEncoding.minor)
self.defaultEncoding = defaultEncoding
- self.defaultFormat = FormatType(rawValue: handle.getDefaultFormat())!
+ defaultFormat = FormatType(rawValue: handle.getDefaultFormat())!
}
public let defaultEncoding: EncodingVersion
diff --git a/swift/src/Ice/Globals.swift b/swift/src/Ice/Globals.swift
index 6467e56289b..4d9e0ea6380 100644
--- a/swift/src/Ice/Globals.swift
+++ b/swift/src/Ice/Globals.swift
@@ -13,7 +13,8 @@ import IceObjc
private let initialized: Bool = {
ICEUtil.registerFactories(exception: ExceptionFactory.self,
connectionInfo: ConnectionInfoFactory.self,
- endpointInfo: EndpointInfoFactory.self)
+ endpointInfo: EndpointInfoFactory.self,
+ adminFacet: AdminFacetFactory.self)
return true
}()
@@ -85,7 +86,8 @@ public func initialize(args: StringSeq = [],
precondition(initData.logger != nil && initData.properties != nil)
- return CommunicatorI(handle: handle, properties: initData.properties!, logger: initData.logger!)
+ return CommunicatorI(handle: handle,
+ initData: initData)
}
}
@@ -118,9 +120,9 @@ public func stringToIdentity(_ string: String) throws -> Identity {
public func identityToString(id: Identity, mode: ToStringMode = ToStringMode.Unicode) throws -> String {
return try autoreleasepool {
- return try ICEUtil.identityToString(name: id.name,
- category: id.category,
- mode: mode.rawValue)
+ try ICEUtil.identityToString(name: id.name,
+ category: id.category,
+ mode: mode.rawValue)
}
}
diff --git a/swift/src/Ice/InitializationData.swift b/swift/src/Ice/InitializationData.swift
index b5ba18b077b..6531f8ae73a 100644
--- a/swift/src/Ice/InitializationData.swift
+++ b/swift/src/Ice/InitializationData.swift
@@ -7,9 +7,12 @@
//
// **********************************************************************
+import Dispatch
+
public struct InitializationData {
public init() {}
public var properties: Properties?
public var logger: Logger?
+ public var adminDispatchQueue: DispatchQueue?
}
diff --git a/swift/src/Ice/NativePropertiesAdmin.swift b/swift/src/Ice/NativePropertiesAdmin.swift
new file mode 100644
index 00000000000..1c00c07a9e3
--- /dev/null
+++ b/swift/src/Ice/NativePropertiesAdmin.swift
@@ -0,0 +1,29 @@
+// **********************************************************************
+//
+// Copyright (c) 2003-2018 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.
+//
+// **********************************************************************
+
+/**
+ * Called when the communicator's properties have been updated.
+ * @param PropertyDict A dictionary containing the properties that were added, changed or removed,
+ * with a removed property denoted by an entry whose value is an empty string.
+ */
+typealias PropertiesAdminUpdateCallback = (PropertyDict) -> Void
+
+typealias PropertiesAdminRemoveallback = () -> Void
+
+/**
+ * Base protocol for the Properties admin facet.
+ */
+protocol NativePropertiesAdmin {
+ /**
+ * Register an update callback that will be invoked when property updates occur.
+ * @param cb The callback.
+ * @return A callback to remove cb
+ */
+ func addUpdateCallback(_ cb: @escaping PropertiesAdminUpdateCallback) -> PropertiesAdminRemoveallback
+}
diff --git a/swift/src/Ice/ObjectAdapterI.swift b/swift/src/Ice/ObjectAdapterI.swift
index ee2a91a2d2c..c09d30bf12b 100644
--- a/swift/src/Ice/ObjectAdapterI.swift
+++ b/swift/src/Ice/ObjectAdapterI.swift
@@ -14,9 +14,9 @@ private enum State {
case dead
}
-private let serialQueue = DispatchQueue(label: "com.zeroc.ice.serial")
+let serialQueue = DispatchQueue(label: "com.zeroc.ice.serial")
-class ObjectAdapterI: LocalObject<ICEObjectAdapter>, ObjectAdapter, ICEObjectAdapterFacade {
+class ObjectAdapterI: LocalObject<ICEObjectAdapter>, ObjectAdapter, ICEBlobjectFacade {
let communicator: Communicator
var servantManager: ServantManager
var locator: LocatorPrx?
@@ -27,12 +27,12 @@ class ObjectAdapterI: LocalObject<ICEObjectAdapter>, ObjectAdapter, ICEObjectAda
init(handle: ICEObjectAdapter, communicator: Communicator, queue: DispatchQueue = serialQueue) {
self.communicator = communicator
- self.servantManager = ServantManager(adapterName: handle.getName(), communicator: communicator)
- self.state = .alive
+ servantManager = ServantManager(adapterName: handle.getName(), communicator: communicator)
+ state = .alive
self.queue = queue
super.init(handle: handle)
- handle.registerFacade(self)
+ handle.registerDefaultServant(self)
}
func getName() -> String {
@@ -163,7 +163,6 @@ class ObjectAdapterI: LocalObject<ICEObjectAdapter>, ObjectAdapter, ICEObjectAda
return try mutex.sync {
try checkForDeactivation()
- // TODO: check these vars are correct
return try findFacet(id: proxy.ice_getIdentity(), facet: proxy.ice_getFacet())
}
}
@@ -225,7 +224,7 @@ class ObjectAdapterI: LocalObject<ICEObjectAdapter>, ObjectAdapter, ICEObjectAda
func getLocator() -> LocatorPrx? {
return mutex.sync {
- return locator
+ locator
}
}
@@ -251,11 +250,12 @@ class ObjectAdapterI: LocalObject<ICEObjectAdapter>, ObjectAdapter, ICEObjectAda
return queue
}
- func facadeInvoke(_ is: ICEInputStream, con: ICEConnection, name: String, category: String, facet: String,
- operation: String, mode: UInt8, context: [String: String], requestId: Int32,
- encodingMajor: UInt8, encodingMinor: UInt8,
+ func facadeInvoke(_ adapter: ICEObjectAdapter, is: ICEInputStream, con: ICEConnection, name: String,
+ category: String, facet: String, operation: String, mode: UInt8, context: [String: String],
+ requestId: Int32, encodingMajor: UInt8, encodingMinor: UInt8,
response: @escaping (Bool, UnsafeRawPointer?, Int) -> Void,
exception: @escaping (ICERuntimeException) -> Void) {
+ precondition(_handle == adapter)
let current = Current(adapter: self,
con: con.assign(to: ConnectionI.self) { ConnectionI(handle: con) },
@@ -274,8 +274,11 @@ class ObjectAdapterI: LocalObject<ICEObjectAdapter>, ObjectAdapter, ICEObjectAda
}
func facadeRemoved() {
- self.mutex.sync {
+ mutex.sync {
self.state = .dead
+ // todo clear state
+ servantManager.destroy()
+ locator = nil
}
}
@@ -290,5 +293,4 @@ class ObjectAdapterI: LocalObject<ICEObjectAdapter>, ObjectAdapter, ICEObjectAda
throw IllegalIdentityException(id: id)
}
}
-
}
diff --git a/swift/src/Ice/ProcessI.swift b/swift/src/Ice/ProcessI.swift
new file mode 100644
index 00000000000..e5f28d282b2
--- /dev/null
+++ b/swift/src/Ice/ProcessI.swift
@@ -0,0 +1,24 @@
+// **********************************************************************
+//
+// Copyright (c) 2003-2018 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.
+//
+// **********************************************************************
+
+import IceObjc
+
+class ProcessI: LocalObject<ICEProcess>, Process {
+ func shutdown(current _: Current) throws {
+ try autoreleasepool {
+ try _handle.shutdown()
+ }
+ }
+
+ func writeMessage(message: Swift.String, fd: Swift.Int32, current _: Current) throws {
+ try autoreleasepool {
+ try _handle.writeMessage(message, fd: fd)
+ }
+ }
+}
diff --git a/swift/src/Ice/PropertiesAdminI.swift b/swift/src/Ice/PropertiesAdminI.swift
new file mode 100644
index 00000000000..09d93cca50c
--- /dev/null
+++ b/swift/src/Ice/PropertiesAdminI.swift
@@ -0,0 +1,46 @@
+// **********************************************************************
+//
+// Copyright (c) 2003-2018 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.
+//
+// **********************************************************************
+
+import IceObjc
+
+class PropertiesAdminI: LocalObject<ICEPropertiesAdmin>, PropertiesAdmin, NativePropertiesAdmin {
+ let communicator: Communicator
+
+ init(communicator: Communicator, handle: ICEPropertiesAdmin) {
+ self.communicator = communicator
+ super.init(handle: handle)
+ }
+
+ func getProperty(key: Swift.String, current _: Current) throws -> Swift.String {
+ return try autoreleasepool {
+ try _handle.getProperty(key)
+ }
+ }
+
+ func getPropertiesForPrefix(prefix: Swift.String, current _: Current) throws -> PropertyDict {
+ return try autoreleasepool {
+ try _handle.getPropertiesForPrefix(prefix)
+ }
+ }
+
+ func setProperties(newProperties: PropertyDict, current _: Current) throws {
+ try autoreleasepool {
+ try _handle.setProperties(newProperties)
+ }
+ }
+
+ func addUpdateCallback(_ cb: @escaping PropertiesAdminUpdateCallback) -> PropertiesAdminRemoveallback {
+ return _handle.addUpdateCallback { (props: PropertyDict) in
+ // Run callback closure in the Admin OAs dispatch queue
+ self.communicator.getAdminDispatchQueue().sync {
+ cb(props)
+ }
+ }
+ }
+}
diff --git a/swift/src/IceObjc/BlobjectFacade.mm b/swift/src/IceObjc/BlobjectFacade.mm
new file mode 100644
index 00000000000..6a7dc1a6c65
--- /dev/null
+++ b/swift/src/IceObjc/BlobjectFacade.mm
@@ -0,0 +1,52 @@
+// **********************************************************************
+//
+// Copyright (c) 2003-2018 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.
+//
+// **********************************************************************
+
+#import "IceObjcBlobjectFacade.h"
+#import "IceObjcObjectAdapter.h"
+#import "IceObjcUtil.h"
+
+#import "IceObjcInputStream.h"
+#import "IceObjcConnection.h"
+
+void
+BlobjectFacade::ice_invokeAsync(std::pair<const Byte*, const Byte*> inEncaps,
+ std::function<void(bool, const std::pair<const Byte*, const Byte*>&)> response,
+ std::function<void(std::exception_ptr)> error,
+ const Ice::Current& current)
+{
+ void(^responseCallback)(bool, const void*, size_t) = ^(bool ok, const void* outParams, size_t outSize) {
+ const Ice::Byte* start = reinterpret_cast<const Ice::Byte*>(outParams);
+ response(ok, std::make_pair(start, start + outSize));
+ };
+
+ void(^exceptionCallback)(ICERuntimeException*) = ^(ICERuntimeException* e) {
+ error(convertException(e));
+ };
+
+ // Copy the bytes
+ std::vector<Ice::Byte> inBytes(inEncaps.first, inEncaps.second);
+
+ ICEObjectAdapter* adapter = createLocalObject(current.adapter, [&current] () -> id
+ {
+ return [[ICEObjectAdapter alloc] initWithCppObjectAdapter:current.adapter];
+ });
+ [_facade facadeInvoke:adapter
+ is:[[ICEInputStream alloc] initWithBytes:std::move(inBytes)]
+ con:[[ICEConnection alloc] initWithCppConnection:current.con]
+ name:toNSString(current.id.name) category:toNSString(current.id.category)
+ facet:toNSString(current.facet)
+ operation:toNSString(current.operation)
+ mode:static_cast<uint8_t>(current.mode)
+ context:toNSDictionary(current.ctx)
+ requestId:current.requestId
+ encodingMajor:current.encoding.major
+ encodingMinor:current.encoding.minor
+ response:responseCallback
+ exception:exceptionCallback];
+}
diff --git a/swift/src/IceObjc/Communicator.mm b/swift/src/IceObjc/Communicator.mm
index 3e9b4584f46..a0703ab0aa3 100644
--- a/swift/src/IceObjc/Communicator.mm
+++ b/swift/src/IceObjc/Communicator.mm
@@ -13,6 +13,11 @@
#import "IceObjcLogger.h"
#import "IceObjcImplicitContext.h"
#import "IceObjcProperties.h"
+#import "IceObjcIceUtil.h"
+#import "IceObjcBlobjectFacade.h"
+#import "IceObjcProcess.h"
+#import "IceObjcPropertiesAdmin.h"
+#import "IceObjcUnsupportedAdminFacet.h"
#import "LoggerWrapperI.h"
#import "IceObjcUtil.h"
@@ -262,6 +267,112 @@
}
}
+-(nullable ICEObjectPrx*) createAdmin:(ICEObjectAdapter* _Nullable)adminAdapter
+ name:(NSString*)name
+ category:(NSString*)category
+ error:(NSError**)error
+{
+
+ try
+ {
+ auto ident = Ice::Identity{fromNSString(name), fromNSString(category)};
+ auto servant = adminAdapter ? [adminAdapter objectAdapter] : nullptr;
+ auto prx = _communicator->createAdmin(servant, ident);
+ return [[ICEObjectPrx alloc] initWithCppObjectPrx:prx];
+ }
+ catch(const std::exception& ex)
+ {
+ *error = convertException(ex);
+ return nil;
+ }
+
+}
+
+-(nullable id) getAdmin:(NSError**)error
+{
+ try
+ {
+ auto adminPrx = _communicator->getAdmin();
+ return adminPrx ? [[ICEObjectPrx alloc] initWithCppObjectPrx:adminPrx] : [NSNull null];
+ }
+ catch(const std::exception& ex)
+ {
+ *error = convertException(ex);
+ return nil;
+ }
+}
+
+-(BOOL) addAdminFacet:(id<ICEBlobjectFacade>)facade facet:(NSString*)facet error:(NSError**)error
+{
+ try
+ {
+ auto servant = std::make_shared<BlobjectFacade>(facade);
+ _communicator->addAdminFacet(servant, fromNSString(facet));
+ return YES;
+ }
+ catch(const std::exception& ex)
+ {
+ *error = convertException(ex);
+ return NO;
+ }
+}
+
+-(id<ICEBlobjectFacade>) removeAdminFacet:(NSString*)facet error:(NSError**)error
+{
+ try
+ {
+ // servant can either be a Swift wrapped facet or a builtin admin facet
+ return [self facetToFacade:_communicator->removeAdminFacet(fromNSString(facet))];
+ }
+ catch(const std::exception& ex)
+ {
+ *error = convertException(ex);
+ return nil;
+ }
+}
+
+-(nullable id) findAdminFacet:(NSString*)facet error:(NSError**)error
+{
+ try
+ {
+ // servant can either be null, a Swift wrapped facet, or a builtin admin facet
+ auto servant = _communicator->findAdminFacet(fromNSString(facet));
+
+ if(!servant)
+ {
+ return [NSNull null];
+ }
+
+ return [self facetToFacade:servant];
+
+ }
+ catch(const std::exception& ex)
+ {
+ *error = convertException(ex);
+ return nil;
+ }
+}
+
+-(nullable NSDictionary<NSString*, id<ICEBlobjectFacade>>*) findAllAdminFacets:(NSError**)error
+{
+ try
+ {
+ NSMutableDictionary<NSString*, id<ICEBlobjectFacade>>* facets = [NSMutableDictionary dictionary];
+
+ for(const auto& d : _communicator->findAllAdminFacets())
+ {
+ [facets setObject:[self facetToFacade:d.second] forKey:toNSString(d.first)];
+ }
+
+ return facets;
+ }
+ catch(const std::exception& ex)
+ {
+ *error = convertException(ex);
+ return nil;
+ }
+}
+
-(ICEProperties*) getProperties
{
auto props = _communicator->getProperties();
@@ -279,4 +390,38 @@
{
return static_cast<uint8_t>(IceInternal::getInstance(_communicator)->defaultsAndOverrides()->defaultFormat);
}
+
+-(id<ICEBlobjectFacade>) facetToFacade:(const std::shared_ptr<Ice::Object>&) servant
+{
+ if(!servant)
+ {
+ return nil;
+ }
+
+ auto blobjectFacade = std::dynamic_pointer_cast<BlobjectFacade>(servant);
+ if(blobjectFacade)
+ {
+ return blobjectFacade->getFacade();
+ }
+
+ Class<ICEAdminFacetFactory> factory = [ICEUtil adminFacetFactory];
+
+ auto process = std::dynamic_pointer_cast<Ice::Process>(servant);
+ if(process)
+ {
+ return [factory createProcess:self
+ handle:[[ICEProcess alloc] initWithCppProcess:process]];
+ }
+
+ auto propertiesAdmin = std::dynamic_pointer_cast<Ice::PropertiesAdmin>(servant);
+ if(propertiesAdmin)
+ {
+ return [factory createProperties:self
+ handle: [[ICEPropertiesAdmin alloc] initWithCppPropertiesAdmin:propertiesAdmin]];
+ }
+
+ return [factory createUnsupported:self
+ handle:[[ICEUnsupportedAdminFacet alloc] initWithCppAdminFacet:servant]];
+}
+
@end
diff --git a/swift/src/IceObjc/Connection.mm b/swift/src/IceObjc/Connection.mm
index 0e662b6c039..6defd089a74 100644
--- a/swift/src/IceObjc/Connection.mm
+++ b/swift/src/IceObjc/Connection.mm
@@ -46,11 +46,13 @@
}
}
+// TODO:
//-(BOOL) setAdapter:(ObjectAdapterI*)oa error:(NSError**)error
//{
//
// }
+//TODO??
//-(ObjectAdapterI*) getAdapter
// {
diff --git a/swift/src/IceObjc/IceObjcAdminFacetFactory.h b/swift/src/IceObjc/IceObjcAdminFacetFactory.h
new file mode 100644
index 00000000000..11f5b15429b
--- /dev/null
+++ b/swift/src/IceObjc/IceObjcAdminFacetFactory.h
@@ -0,0 +1,26 @@
+// **********************************************************************
+//
+// Copyright (c) 2003-2018 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.
+//
+// **********************************************************************
+
+#import "IceObjcLocalObject.h"
+
+@class ICECommunicator;
+@class ICEProcess;
+@class ICEPropertiesAdmin;
+@class ICEUnsupportedAdminFacet;
+@protocol ICEBlobjectFacade;
+
+NS_ASSUME_NONNULL_BEGIN
+
+@protocol ICEAdminFacetFactory
++(id<ICEBlobjectFacade>) createProcess:(ICECommunicator*)communicator handle:(ICEProcess*)handle;
++(id<ICEBlobjectFacade>) createProperties:(ICECommunicator*)communicator handle:(ICEPropertiesAdmin*)handle;
++(id<ICEBlobjectFacade>) createUnsupported:(ICECommunicator*)communicator handle:(ICEUnsupportedAdminFacet*)handle;
+@end
+
+NS_ASSUME_NONNULL_END
diff --git a/swift/src/IceObjc/IceObjcBlobjectFacade.h b/swift/src/IceObjc/IceObjcBlobjectFacade.h
new file mode 100644
index 00000000000..1bd5ef74a09
--- /dev/null
+++ b/swift/src/IceObjc/IceObjcBlobjectFacade.h
@@ -0,0 +1,69 @@
+// **********************************************************************
+//
+// Copyright (c) 2003-2018 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.
+//
+// **********************************************************************
+
+#import "IceObjcConfig.h"
+
+@class ICEConnection;
+@class ICEInputStream;
+@class ICEObjectAdapter;
+@class ICERuntimeException;
+
+NS_ASSUME_NONNULL_BEGIN
+
+@protocol ICEBlobjectFacade
+-(void) facadeInvoke:(ICEObjectAdapter*)adapter
+ is:(ICEInputStream*)is
+ con:(ICEConnection*)con
+ name:(NSString*)name
+ category:(NSString*)category
+ facet:(NSString*)facet
+ operation:(NSString*)operation
+ mode:(uint8_t)mode
+ context:(NSDictionary<NSString*, NSString*>*)context
+ requestId:(int32_t)requestId
+ encodingMajor:(uint8_t)encodingMajor
+ encodingMinor:(uint8_t)encodingMinor
+ response:(void (^)(bool, const void* _Null_unspecified, size_t))response
+ exception:(void (^)(ICERuntimeException*))exception;
+-(void) facadeRemoved;
+@end
+
+#ifdef __cplusplus
+
+class BlobjectFacade : public Ice::BlobjectArrayAsync
+{
+public:
+
+ BlobjectFacade(id<ICEBlobjectFacade> facade): _facade(facade)
+ {
+ }
+
+ BlobjectFacade()
+ {
+ [_facade facadeRemoved];
+ }
+
+ virtual void
+ ice_invokeAsync(std::pair<const Byte*, const Byte*> inEncaps,
+ std::function<void(bool, const std::pair<const Byte*, const Byte*>&)> response,
+ std::function<void(std::exception_ptr)> error,
+ const Ice::Current& current);
+
+ id<ICEBlobjectFacade> getFacade() const
+ {
+ return _facade;
+ }
+
+private:
+ id<ICEBlobjectFacade> _facade;
+};
+
+#endif
+
+NS_ASSUME_NONNULL_END
diff --git a/swift/src/IceObjc/IceObjcCommunicator.h b/swift/src/IceObjc/IceObjcCommunicator.h
index 3e9d40ec91d..c60af13046a 100644
--- a/swift/src/IceObjc/IceObjcCommunicator.h
+++ b/swift/src/IceObjc/IceObjcCommunicator.h
@@ -14,6 +14,7 @@
@class ICEProperties;
@class ICEObjectAdapter;
@protocol ICELoggerProtocol;
+@protocol ICEBlobjectFacade;
NS_ASSUME_NONNULL_BEGIN
@@ -41,6 +42,15 @@ NS_SWIFT_NAME(propertyToProxy(property:));
exception:(void (^)(NSError*))exception
sent:(void (^_Nullable)(bool))sent
error:(NSError**)error;
+-(nullable ICEObjectPrx*) createAdmin:(ICEObjectAdapter* _Nullable)adminAdapter
+ name:(NSString*)name
+ category:(NSString*)category
+ error:(NSError**)error;
+-(nullable id) getAdmin:(NSError**)error;
+-(BOOL) addAdminFacet:(id<ICEBlobjectFacade>)servant facet:(NSString*)facet error:(NSError**)error;
+-(nullable id<ICEBlobjectFacade>) removeAdminFacet:(NSString*)facet error:(NSError**)error;
+-(nullable id) findAdminFacet:(NSString*)facet error:(NSError**)error;
+-(nullable NSDictionary<NSString*, id<ICEBlobjectFacade>>*) findAllAdminFacets:(NSError**)error;
-(ICEProperties*) getProperties;
diff --git a/swift/src/IceObjc/IceObjcConnection.h b/swift/src/IceObjc/IceObjcConnection.h
index 2f1cc89e82b..ba8a23a3b11 100644
--- a/swift/src/IceObjc/IceObjcConnection.h
+++ b/swift/src/IceObjc/IceObjcConnection.h
@@ -13,7 +13,7 @@
NS_ASSUME_NONNULL_BEGIN
-@interface ICEConnection: ICELocalObject
+@interface ICEConnection : ICELocalObject
-(void) close:(uint8_t)mode;
-(nullable id) createProxy:(NSString*)name category:(NSString*)category error:(NSError* _Nullable * _Nullable)error;
//-(BOOL) setAdapter:(ObjectAdapterI*)oa error:(NSError* _Nullable * _Nullable)error;
diff --git a/swift/src/IceObjc/IceObjcIceUtil.h b/swift/src/IceObjc/IceObjcIceUtil.h
index 812e13f271f..82dc8aa0064 100644
--- a/swift/src/IceObjc/IceObjcIceUtil.h
+++ b/swift/src/IceObjc/IceObjcIceUtil.h
@@ -13,6 +13,7 @@
#import "IceObjcException.h"
#import "IceObjcLogger.h"
#import "IceObjcProperties.h"
+#import "IceObjcAdminFacetFactory.h"
NS_ASSUME_NONNULL_BEGIN
@@ -23,12 +24,14 @@ NS_ASSUME_NONNULL_BEGIN
@property (class, nonatomic, readonly) Class<ICEExceptionFactory> exceptionFactory;
@property (class, nonatomic, readonly) Class<ICEConnectionInfoFactory> connectionInfoFactory;
@property (class, nonatomic, readonly) Class<ICEEndpointInfoFactory> endpointInfoFactory;
+@property (class, nonatomic, readonly) Class<ICEAdminFacetFactory> adminFacetFactory;
//This method should only be called once to guarenteed thread safety
+(BOOL) registerFactories:(Class<ICEExceptionFactory>)exception
connectionInfo:(Class<ICEConnectionInfoFactory>)connectionInfo
endpointInfo:(Class<ICEEndpointInfoFactory>)endpointInfo
-NS_SWIFT_NAME(registerFactories(exception:connectionInfo:endpointInfo:));
+ adminFacet:(Class<ICEAdminFacetFactory>)adminFacet
+NS_SWIFT_NAME(registerFactories(exception:connectionInfo:endpointInfo:adminFacet:));
+(nullable ICECommunicator*) initialize:(NSArray*)swiftArgs
properties:(ICEProperties*)properties
diff --git a/swift/src/IceObjc/IceObjcObjectAdapter.h b/swift/src/IceObjc/IceObjcObjectAdapter.h
index c1e683bf603..03fb78f5e13 100644
--- a/swift/src/IceObjc/IceObjcObjectAdapter.h
+++ b/swift/src/IceObjc/IceObjcObjectAdapter.h
@@ -15,28 +15,13 @@
@class ICEInputStream;
@class ICEConnection;
@class ICERuntimeException;
+@protocol ICEBlobjectFacade;
NS_ASSUME_NONNULL_BEGIN
-@protocol ICEObjectAdapterFacade
--(void) facadeInvoke:(ICEInputStream*)is
- con:(ICEConnection*)con
- name:(NSString*)name
- category:(NSString*)category
- facet:(NSString*)facet
- operation:(NSString*)operation
- mode:(uint8_t)mode
- context:(NSDictionary<NSString*, NSString*>*)context
- requestId:(int32_t)requestId
- encodingMajor:(uint8_t)encodingMajor
- encodingMinor:(uint8_t)encodingMinor
- response:(void (^)(bool, const void* _Null_unspecified, size_t))response
- exception:(void (^)(ICERuntimeException*))exception;
--(void) facadeRemoved;
-@end
-
@interface ICEObjectAdapter: ICELocalObject
- -(NSString*) getName;
+-(NSString*) getName;
+-(ICECommunicator*) getCommunicator;
-(BOOL) activate:(NSError* _Nullable * _Nullable)error;
-(BOOL) hold:(NSError* _Nullable * _Nullable)error;
-(BOOL) waitForHold:(NSError* _Nullable * _Nullable)error;
@@ -52,7 +37,7 @@ NS_ASSUME_NONNULL_BEGIN
-(NSArray<ICEEndpoint*>*) getPublishedEndpoints;
-(BOOL) setPublishedEndpoints:(NSArray<ICEEndpoint*>*)newEndpoints error:(NSError* _Nullable * _Nullable)error;
--(void) registerFacade:(id<ICEObjectAdapterFacade>)facade NS_SWIFT_NAME(registerFacade(_:));
+-(void) registerDefaultServant:(id<ICEBlobjectFacade>)facade NS_SWIFT_NAME(registerDefaultServant(_:));
@end
#ifdef __cplusplus
diff --git a/swift/src/IceObjc/IceObjcProcess.h b/swift/src/IceObjc/IceObjcProcess.h
new file mode 100644
index 00000000000..787aabad488
--- /dev/null
+++ b/swift/src/IceObjc/IceObjcProcess.h
@@ -0,0 +1,28 @@
+// **********************************************************************
+//
+// Copyright (c) 2003-2018 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.
+//
+// **********************************************************************
+
+#import "IceObjcLocalObject.h"
+
+NS_ASSUME_NONNULL_BEGIN
+
+@interface ICEProcess : ICELocalObject
+-(BOOL) shutdown:(NSError**)error;
+-(BOOL) writeMessage:(NSString*)message fd:(int32_t)fd error:(NSError**)error;
+@end
+
+#ifdef __cplusplus
+
+@interface ICEProcess()
+@property (nonatomic, readonly) std::shared_ptr<Ice::Process> process;
+-(instancetype) initWithCppProcess:(std::shared_ptr<Ice::Process>)process;
+@end
+
+#endif
+
+NS_ASSUME_NONNULL_END
diff --git a/swift/src/IceObjc/IceObjcPropertiesAdmin.h b/swift/src/IceObjc/IceObjcPropertiesAdmin.h
new file mode 100644
index 00000000000..a2ad648b056
--- /dev/null
+++ b/swift/src/IceObjc/IceObjcPropertiesAdmin.h
@@ -0,0 +1,30 @@
+// **********************************************************************
+//
+// Copyright (c) 2003-2018 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.
+//
+// **********************************************************************
+
+#import "IceObjcLocalObject.h"
+
+NS_ASSUME_NONNULL_BEGIN
+
+@interface ICEPropertiesAdmin: ICELocalObject
+-(nullable NSString*) getProperty:(NSString*)key error:(NSError**)error;
+-(nullable NSDictionary<NSString*, NSString*>*) getPropertiesForPrefix:(NSString*)prefix error:(NSError**)error;
+-(BOOL) setProperties:(NSDictionary<NSString*, NSString*>*)newProperties error:(NSError**)error;
+-(void (^)(void)) addUpdateCallback:(void (^)(NSDictionary<NSString*, NSString*>*))cb;
+@end
+
+#ifdef __cplusplus
+
+@interface ICEPropertiesAdmin()
+@property (nonatomic, readonly) std::shared_ptr<Ice::PropertiesAdmin> propertiesAdmin;
+-(instancetype) initWithCppPropertiesAdmin:(std::shared_ptr<Ice::PropertiesAdmin>)propertiesAdmin;
+@end
+
+#endif
+
+NS_ASSUME_NONNULL_END
diff --git a/swift/src/IceObjc/IceObjcUnsupportedAdminFacet.h b/swift/src/IceObjc/IceObjcUnsupportedAdminFacet.h
new file mode 100644
index 00000000000..8fa107c678f
--- /dev/null
+++ b/swift/src/IceObjc/IceObjcUnsupportedAdminFacet.h
@@ -0,0 +1,26 @@
+// **********************************************************************
+//
+// Copyright (c) 2003-2018 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.
+//
+// **********************************************************************
+
+#import "IceObjcLocalObject.h"
+
+NS_ASSUME_NONNULL_BEGIN
+
+@interface ICEUnsupportedAdminFacet: ICELocalObject
+@end
+
+#ifdef __cplusplus
+
+@interface ICEUnsupportedAdminFacet()
+@property (nonatomic, readonly) std::shared_ptr<Ice::Object>facet;
+-(instancetype) initWithCppAdminFacet:(std::shared_ptr<Ice::Object>)facet;
+@end
+
+#endif
+
+NS_ASSUME_NONNULL_END
diff --git a/swift/src/IceObjc/IceObjcUtil.h b/swift/src/IceObjc/IceObjcUtil.h
index 2edf6d6b179..773798b0c64 100644
--- a/swift/src/IceObjc/IceObjcUtil.h
+++ b/swift/src/IceObjc/IceObjcUtil.h
@@ -16,6 +16,7 @@
@class LocalException;
@class ICERuntimeException;
+@protocol ICEBlobjectFacade;
namespace IceSSL
{
diff --git a/swift/src/IceObjc/IceUtil.mm b/swift/src/IceObjc/IceUtil.mm
index c6a506c4064..bd83bc4af9e 100644
--- a/swift/src/IceObjc/IceUtil.mm
+++ b/swift/src/IceObjc/IceUtil.mm
@@ -37,11 +37,11 @@ namespace
static Class<ICEExceptionFactory> _exceptionFactory;
static Class<ICEConnectionInfoFactory> _connectionInfoFactory;
static Class<ICEEndpointInfoFactory> _endpointInfoFactory;
+static Class<ICEAdminFacetFactory> _adminFacetFactory;
+(Class<ICEExceptionFactory>) exceptionFactory
{
return _exceptionFactory;
-
}
+(Class<ICEConnectionInfoFactory>) connectionInfoFactory
@@ -54,13 +54,20 @@ static Class<ICEEndpointInfoFactory> _endpointInfoFactory;
return _endpointInfoFactory;
}
++(Class<ICEAdminFacetFactory>) adminFacetFactory
+{
+ return _adminFacetFactory;
+}
+
+(BOOL) registerFactories:(Class<ICEExceptionFactory>)exception
connectionInfo:(Class<ICEConnectionInfoFactory>)connectionInfo
endpointInfo:(Class<ICEEndpointInfoFactory>)endpointInfo
+ adminFacet:(Class<ICEAdminFacetFactory>)adminFacet
{
_exceptionFactory = exception;
_connectionInfoFactory = connectionInfo;
_endpointInfoFactory = endpointInfo;
+ _adminFacetFactory = adminFacet;
return true;
}
diff --git a/swift/src/IceObjc/ObjectAdapter.mm b/swift/src/IceObjc/ObjectAdapter.mm
index 503d480b3a6..22a75b34f04 100644
--- a/swift/src/IceObjc/ObjectAdapter.mm
+++ b/swift/src/IceObjc/ObjectAdapter.mm
@@ -13,58 +13,8 @@
#import "IceObjcObjectPrx.h"
#import "IceObjcInputStream.h"
#import "IceObjcConnection.h"
-
-namespace
-{
- class DefaultServant : public Ice::BlobjectArrayAsync
- {
- public:
-
- DefaultServant(id<ICEObjectAdapterFacade> facade): _facade(facade)
- {
- }
-
- ~DefaultServant()
- {
- [_facade facadeRemoved];
- }
-
- virtual void
- ice_invokeAsync(std::pair<const Byte*, const Byte*> inEncaps,
- std::function<void(bool, const std::pair<const Byte*, const Byte*>&)> response,
- std::function<void(std::exception_ptr)> error,
- const Ice::Current& current)
- {
- void(^responseCallback)(bool, const void*, size_t) = ^(bool ok, const void* outParams, size_t outSize) {
- const Ice::Byte* start = reinterpret_cast<const Ice::Byte*>(outParams);
- response(ok, std::make_pair(start, start + outSize));
- };
-
- void(^exceptionCallback)(ICERuntimeException*) = ^(ICERuntimeException* e) {
- error(convertException(e));
- };
-
- // Copy the bytes
- std::vector<Ice::Byte> inBytes(inEncaps.first, inEncaps.second);
-
- [_facade facadeInvoke:[[ICEInputStream alloc] initWithBytes:std::move(inBytes)]
- con:[[ICEConnection alloc] initWithCppConnection:current.con]
- name:toNSString(current.id.name) category:toNSString(current.id.category)
- facet:toNSString(current.facet)
- operation:toNSString(current.operation)
- mode:static_cast<uint8_t>(current.mode)
- context:toNSDictionary(current.ctx)
- requestId:current.requestId
- encodingMajor:current.encoding.major
- encodingMinor:current.encoding.minor
- response:responseCallback
- exception:exceptionCallback];
- }
-
- private:
- id<ICEObjectAdapterFacade> _facade;
- };
-}
+#import "IceObjcCommunicator.h"
+#import "IceObjcBlobjectFacade.h"
@implementation ICEObjectAdapter
@@ -83,6 +33,12 @@ namespace
return toNSString(_objectAdapter->getName());
}
+-(ICECommunicator*) getCommunicator
+{
+ auto comm = _objectAdapter->getCommunicator().get();
+ return [ICECommunicator fromLocalObject:comm];
+}
+
-(BOOL) activate:(NSError* _Nullable * _Nullable)error
{
try
@@ -229,9 +185,9 @@ namespace
}
}
--(void) registerFacade:(id<ICEObjectAdapterFacade>)facade
+-(void) registerDefaultServant:(id<ICEBlobjectFacade>)facade
{
- auto servant = std::make_shared<DefaultServant>(facade);
+ auto servant = std::make_shared<BlobjectFacade>(facade);
_objectAdapter->addDefaultServant(servant, "");
}
diff --git a/swift/src/IceObjc/Process.mm b/swift/src/IceObjc/Process.mm
new file mode 100644
index 00000000000..0f8e83a8091
--- /dev/null
+++ b/swift/src/IceObjc/Process.mm
@@ -0,0 +1,56 @@
+// **********************************************************************
+//
+// Copyright (c) 2003-2018 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.
+//
+// **********************************************************************
+
+#import "IceObjcProcess.h"
+#import "IceObjcUtil.h"
+
+@implementation ICEProcess
+
+-(instancetype) initWithCppProcess:(std::shared_ptr<Ice::Process>)process
+{
+ self = [super initWithLocalObject:process.get()];
+ if(!self)
+ {
+ return nil;
+ }
+ _process = process;
+ return self;
+}
+
+-(BOOL) shutdown:(NSError**)error
+{
+ try
+ {
+ // This fuction does not use current so we do not pass it from Swift
+ _process->shutdown(Ice::Current{});
+ return YES;
+ }
+ catch(const std::exception& ex)
+ {
+ *error = convertException(ex);
+ return NO;
+ }
+}
+
+-(BOOL) writeMessage:(NSString*)message fd:(int32_t)fd error:(NSError**)error
+{
+ try
+ {
+ // This function does not use current so we do not pass it from Swift
+ _process->writeMessage(fromNSString(message), fd, Ice::Current{});
+ return YES;
+ }
+ catch(const std::exception& ex)
+ {
+ *error = convertException(ex);
+ return NO;
+ }
+}
+
+@end
diff --git a/swift/src/IceObjc/PropertiesAdmin.mm b/swift/src/IceObjc/PropertiesAdmin.mm
new file mode 100644
index 00000000000..2e175bccc1f
--- /dev/null
+++ b/swift/src/IceObjc/PropertiesAdmin.mm
@@ -0,0 +1,88 @@
+// **********************************************************************
+//
+// Copyright (c) 2003-2018 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.
+//
+// **********************************************************************
+
+#import "IceObjcPropertiesAdmin.h"
+#import "IceObjcUtil.h"
+
+@implementation ICEPropertiesAdmin
+
+-(instancetype) initWithCppPropertiesAdmin:(std::shared_ptr<Ice::PropertiesAdmin>)propertiesAdmin
+{
+ self = [super initWithLocalObject:propertiesAdmin.get()];
+ if(!self)
+ {
+ return nil;
+ }
+ _propertiesAdmin = propertiesAdmin;
+ return self;
+}
+
+-(nullable NSString*) getProperty:(NSString*)key error:(NSError**)error
+{
+ try
+ {
+ // This function does not use current so we do not pass it from Swift
+ return toNSString(_propertiesAdmin->getProperty(fromNSString(key), Ice::Current{}));
+ }
+ catch(const std::exception& ex)
+ {
+ *error = convertException(ex);
+ return nil;
+ }
+}
+
+-(nullable NSDictionary<NSString*, NSString*>*) getPropertiesForPrefix:(NSString*)prefix error:(NSError**)error
+{
+ try
+ {
+ // This function does not use current so we do not pass it from Swift
+ return toNSDictionary(_propertiesAdmin->getPropertiesForPrefix(fromNSString(prefix), Ice::Current{}));
+ }
+ catch(const std::exception& ex)
+ {
+ *error = convertException(ex);
+ return nil;
+ }
+}
+
+-(BOOL) setProperties:(NSDictionary<NSString*, NSString*>*)newProperties error:(NSError**)error
+{
+ try
+ {
+ // This function does not use current so we do not pass it from Swift
+ Ice::PropertyDict props;
+ fromNSDictionary(newProperties, props);
+ _propertiesAdmin->setProperties(props, Ice::Current{});
+ return YES;
+ }
+ catch(const std::exception& ex)
+ {
+ *error = convertException(ex);
+ return NO;
+ }
+}
+
+-(void (^)(void)) addUpdateCallback:(void (^)(NSDictionary<NSString*, NSString*>*))cb
+{
+ auto facet = std::dynamic_pointer_cast<Ice::NativePropertiesAdmin>(_propertiesAdmin);
+ assert(facet);
+
+ auto removeCb = facet->addUpdateCallback([cb] (const Ice::PropertyDict& props)
+ {
+ cb(toNSDictionary(props));
+ });
+
+ return ^
+ {
+ removeCb();
+ };
+
+}
+
+@end
diff --git a/swift/src/IceObjc/UnsupportedAdminFacet.mm b/swift/src/IceObjc/UnsupportedAdminFacet.mm
new file mode 100644
index 00000000000..7ca33c00789
--- /dev/null
+++ b/swift/src/IceObjc/UnsupportedAdminFacet.mm
@@ -0,0 +1,26 @@
+// **********************************************************************
+//
+// Copyright (c) 2003-2018 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.
+//
+// **********************************************************************
+
+#import "IceObjcUnsupportedAdminFacet.h"
+#import "IceObjcUtil.h"
+
+@implementation ICEUnsupportedAdminFacet
+
+-(instancetype) initWithCppAdminFacet:(std::shared_ptr<Ice::Object>)facet
+{
+ self = [super initWithLocalObject:facet.get()];
+ if(!self)
+ {
+ return nil;
+ }
+ _facet = facet;
+ return self;
+}
+
+@end
diff --git a/swift/src/IceObjc/Util.mm b/swift/src/IceObjc/Util.mm
index 2d0e1e7dc74..41764a45f1b 100644
--- a/swift/src/IceObjc/Util.mm
+++ b/swift/src/IceObjc/Util.mm
@@ -7,6 +7,7 @@
//
// **********************************************************************
+#import "IceObjcBlobjectFacade.h"
#import "IceObjcException.h"
#import "IceObjcIceUtil.h"
#import "IceObjcUtil.h"
diff --git a/swift/src/IceObjc/module.map b/swift/src/IceObjc/module.map
index d11485280b0..0d1eaee63bc 100644
--- a/swift/src/IceObjc/module.map
+++ b/swift/src/IceObjc/module.map
@@ -1,4 +1,6 @@
module IceObjc {
+ header "IceObjcAdminFacetFactory.h"
+ header "IceObjcBlobjectFacade.h"
header "IceObjcCommunicator.h"
header "IceObjcConfig.h"
header "IceObjcConnection.h"
@@ -12,7 +14,10 @@ module IceObjc {
header "IceObjcObjectAdapter.h"
header "IceObjcObjectPrx.h"
header "IceObjcOutputStream.h"
+ header "IceObjcProcess.h"
header "IceObjcProperties.h"
+ header "IceObjcPropertiesAdmin.h"
header "IceObjcTraceUtil.h"
+ header "IceObjcUnsupportedAdminFacet.h"
export *
}