summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBernard Normier <bernard@zeroc.com>2019-06-14 12:07:56 -0400
committerBernard Normier <bernard@zeroc.com>2019-06-14 12:07:56 -0400
commit511dc777643c66f9af20ca645a463ddea2ff071a (patch)
tree81b4364bbee9faa3e95e552c2cd7c700ab0bc708
parentAdd doc comments to Input/Output stream extensions for enumerated types (diff)
downloadice-511dc777643c66f9af20ca645a463ddea2ff071a.tar.bz2
ice-511dc777643c66f9af20ca645a463ddea2ff071a.tar.xz
ice-511dc777643c66f9af20ca645a463ddea2ff071a.zip
Support for dispatch interceptors
-rw-r--r--cpp/src/slice2swift/Gen.cpp6
-rw-r--r--cpp/src/slice2swift/SwiftUtil.cpp2
-rw-r--r--swift/src/Ice/AdminFacetFactory.swift2
-rw-r--r--swift/src/Ice/Blobject.swift8
-rw-r--r--swift/src/Ice/BlobjectAsync.swift10
-rw-r--r--swift/src/Ice/Incoming.swift2
-rw-r--r--swift/src/Ice/Object.swift34
7 files changed, 36 insertions, 28 deletions
diff --git a/cpp/src/slice2swift/Gen.cpp b/cpp/src/slice2swift/Gen.cpp
index b1bc67fa658..4ced089cfe6 100644
--- a/cpp/src/slice2swift/Gen.cpp
+++ b/cpp/src/slice2swift/Gen.cpp
@@ -1590,7 +1590,7 @@ Gen::ObjectVisitor::visitClassDefStart(const ClassDefPtr& p)
out << nl;
out << "public func dispatch";
out << spar;
- out << ("incoming inS: " + getUnqualified("Ice.Incoming", swiftModule));
+ out << ("request: " + getUnqualified("Ice.Request", swiftModule));
out << ("current: " + getUnqualified("Ice.Current", swiftModule));
out << epar;
out << " throws";
@@ -1607,11 +1607,11 @@ Gen::ObjectVisitor::visitClassDefStart(const ClassDefPtr& p)
if(opName == "ice_id" || opName == "ice_ids" || opName == "ice_isA" || opName == "ice_ping")
{
out << nl << "try (servant as? Object ?? " << disp << ".defaultObject)._iceD_"
- << opName << "(incoming: inS, current: current)";
+ << opName << "(incoming: request, current: current)";
}
else
{
- out << nl << "try servant._iceD_" << opName << "(incoming: inS, current: current)";
+ out << nl << "try servant._iceD_" << opName << "(incoming: request, current: current)";
}
out.dec();
}
diff --git a/cpp/src/slice2swift/SwiftUtil.cpp b/cpp/src/slice2swift/SwiftUtil.cpp
index e458c185069..8d169f971b3 100644
--- a/cpp/src/slice2swift/SwiftUtil.cpp
+++ b/cpp/src/slice2swift/SwiftUtil.cpp
@@ -683,7 +683,7 @@ SwiftGenerator::writeOpDocSummary(IceUtilInternal::Output& out,
out << nl << "///";
if(dispatch)
{
- out << nl << "/// - parameter current: `Ice.Current` - The Current object for the invocation.";
+ out << nl << "/// - parameter current: `Ice.Current` - The Current object for the dispatch.";
}
else
{
diff --git a/swift/src/Ice/AdminFacetFactory.swift b/swift/src/Ice/AdminFacetFactory.swift
index e233bb2a03b..dafb66ed703 100644
--- a/swift/src/Ice/AdminFacetFactory.swift
+++ b/swift/src/Ice/AdminFacetFactory.swift
@@ -54,7 +54,7 @@ class AdminFacetFacade: ICEBlobjectFacade {
func dispatch(incoming: Incoming, current: Current) {
// Dispatch directly to the servant. Do not call invoke on Incoming
do {
- try disp.dispatch(incoming: incoming, current: current)
+ try disp.dispatch(request: incoming, current: current)
} catch {
incoming.exception(error)
}
diff --git a/swift/src/Ice/Blobject.swift b/swift/src/Ice/Blobject.swift
index 2f4075d0e13..c7134a48ab9 100644
--- a/swift/src/Ice/Blobject.swift
+++ b/swift/src/Ice/Blobject.swift
@@ -24,7 +24,7 @@ public protocol Blobject {
func ice_invoke(inEncaps: Data, current: Current) throws -> (ok: Bool, outParams: Data)
}
-/// Dispatcher for Blobject servants.
+/// Request dispatcher for Blobject servants.
public struct BlobjectDisp: Disp {
public let servant: Blobject
@@ -32,9 +32,9 @@ public struct BlobjectDisp: Disp {
self.servant = servant
}
- public func dispatch(incoming inS: Incoming, current: Current) throws {
- let inEncaps = try inS.readParamEncaps()
+ public func dispatch(request: Request, current: Current) throws {
+ let inEncaps = try request.readParamEncaps()
let invokeResult = try servant.ice_invoke(inEncaps: inEncaps, current: current)
- inS.writeParamEncaps(ok: invokeResult.ok, outParams: invokeResult.outParams)
+ request.writeParamEncaps(ok: invokeResult.ok, outParams: invokeResult.outParams)
}
}
diff --git a/swift/src/Ice/BlobjectAsync.swift b/swift/src/Ice/BlobjectAsync.swift
index ecec547d910..e00e92abb61 100644
--- a/swift/src/Ice/BlobjectAsync.swift
+++ b/swift/src/Ice/BlobjectAsync.swift
@@ -25,7 +25,7 @@ public protocol BlobjectAsync {
func ice_invokeAsync(inEncaps: Data, current: Current) -> Promise<(ok: Bool, outParams: Data)>
}
-/// Dispatcher for BlobjectAsync servants.
+/// Request dispatcher for BlobjectAsync servants.
public struct BlobjectAsyncDisp: Disp {
public let servant: BlobjectAsync
@@ -33,14 +33,14 @@ public struct BlobjectAsyncDisp: Disp {
self.servant = servant
}
- public func dispatch(incoming inS: Incoming, current: Current) throws {
- let inEncaps = try inS.readParamEncaps()
+ public func dispatch(request: Request, current: Current) throws {
+ let inEncaps = try request.readParamEncaps()
firstly {
self.servant.ice_invokeAsync(inEncaps: inEncaps, current: current)
}.done(on: nil) { invokeResult in
- inS.writeParamEncaps(ok: invokeResult.ok, outParams: invokeResult.outParams)
+ request.writeParamEncaps(ok: invokeResult.ok, outParams: invokeResult.outParams)
}.catch(on: nil) { err in
- inS.exception(err)
+ request.exception(err)
}
}
}
diff --git a/swift/src/Ice/Incoming.swift b/swift/src/Ice/Incoming.swift
index 59a4de3a0ce..001550738d5 100644
--- a/swift/src/Ice/Incoming.swift
+++ b/swift/src/Ice/Incoming.swift
@@ -145,7 +145,7 @@ public final class Incoming {
// Dispatch in the incoming call
//
do {
- try s.dispatch(incoming: self, current: current)
+ try s.dispatch(request: self, current: current)
} catch {
exception(error)
}
diff --git a/swift/src/Ice/Object.swift b/swift/src/Ice/Object.swift
index 7233032cf60..0dc06eaed1a 100644
--- a/swift/src/Ice/Object.swift
+++ b/swift/src/Ice/Object.swift
@@ -4,10 +4,18 @@
import IceObjc
-/// A Dispatcher (Disp) is a helper struct used by object adapters to dispatch requests
-/// to servants. Its dispatch method should not be called directly by user applications.
+/// Request is an opaque type that represents an incoming request.
+public typealias Request = Incoming
+
+/// A request dispatcher (Disp) is a helper struct used by object adapters to dispatch
+/// requests to servants.
public protocol Disp {
- func dispatch(incoming: Incoming, current: Current) throws
+ /// Dispatch request to servant.
+ ///
+ /// - parameter request: `Ice.Request` - The incoming request.
+ ///
+ /// - parameter current: `Ice.Current` - The Current object for the dispatch.
+ func dispatch(request: Request, current: Current) throws
}
/// A SliceTraits struct describes a Slice interface, class or exception.
@@ -23,14 +31,14 @@ public protocol SliceTraits {
public protocol Object {
/// Returns the Slice type ID of the most-derived interface supported by this object.
///
- /// - parameter current: `Ice.Current` - The Current object for the invocation.
+ /// - parameter current: `Ice.Current` - The Current object for the dispatch.
///
/// - returns: `String` - The Slice type ID of the most-derived interface.
func ice_id(current: Current) throws -> String
/// Returns the Slice type IDs of the interfaces supported by this object.
///
- /// - parameter current: `Ice.Current` - The Current object for the invocation.
+ /// - parameter current: `Ice.Current` - The Current object for the dispatch.
///
/// - returns: `[String]` The Slice type IDs of the interfaces supported by this object, in base-to-derived
/// order. The first element of the returned array is always `::Ice::Object`.
@@ -40,7 +48,7 @@ public protocol Object {
///
/// - parameter s: `String` - The type ID of the Slice interface to test against.
///
- /// - parameter current: `Ice.Current` - The Current object for the invocation.
+ /// - parameter current: `Ice.Current` - The Current object for the dispatch.
///
/// - returns: `Bool` - True if this object has the interface specified by s or
/// derives from the interface specified by s.
@@ -48,7 +56,7 @@ public protocol Object {
/// Tests whether this object can be reached.
///
- /// - parameter current: The Current object for the invocation.
+ /// - parameter current: The Current object for the dispatch.
func ice_ping(current: Current) throws
}
@@ -120,7 +128,7 @@ open class ObjectI<T: SliceTraits>: Object {
}
}
-/// Dispatcher for plain Object servants.
+/// Request dispatcher for plain Object servants.
public struct ObjectDisp: Disp {
public let servant: Object
@@ -128,16 +136,16 @@ public struct ObjectDisp: Disp {
self.servant = servant
}
- public func dispatch(incoming: Incoming, current: Current) throws {
+ public func dispatch(request: Request, current: Current) throws {
switch current.operation {
case "ice_id":
- try servant._iceD_ice_id(incoming: incoming, current: current)
+ try servant._iceD_ice_id(incoming: request, current: current)
case "ice_ids":
- try servant._iceD_ice_ids(incoming: incoming, current: current)
+ try servant._iceD_ice_ids(incoming: request, current: current)
case "ice_isA":
- try servant._iceD_ice_isA(incoming: incoming, current: current)
+ try servant._iceD_ice_isA(incoming: request, current: current)
case "ice_ping":
- try servant._iceD_ice_ping(incoming: incoming, current: current)
+ try servant._iceD_ice_ping(incoming: request, current: current)
default:
throw OperationNotExistException(id: current.id, facet: current.facet, operation: current.operation)
}