summaryrefslogtreecommitdiff
path: root/js/src/Ice/ObjectPrx.js
diff options
context:
space:
mode:
Diffstat (limited to 'js/src/Ice/ObjectPrx.js')
-rw-r--r--js/src/Ice/ObjectPrx.js860
1 files changed, 399 insertions, 461 deletions
diff --git a/js/src/Ice/ObjectPrx.js b/js/src/Ice/ObjectPrx.js
index 4d0c5e1328c..51bf7bf466a 100644
--- a/js/src/Ice/ObjectPrx.js
+++ b/js/src/Ice/ObjectPrx.js
@@ -7,15 +7,13 @@
//
// **********************************************************************
-var Ice = require("../Ice/ModuleRegistry").Ice;
-Ice.__M.require(module,
+const Ice = require("../Ice/ModuleRegistry").Ice;
+Ice._ModuleRegistry.require(module,
[
- "../Ice/Class",
"../Ice/ArrayUtil",
"../Ice/AsyncResult",
"../Ice/Debug",
"../Ice/FormatType",
- "../Ice/HashMap",
"../Ice/OutgoingAsync",
"../Ice/ReferenceMode",
"../Ice/Current",
@@ -25,44 +23,49 @@ Ice.__M.require(module,
"../Ice/Object"
]);
-var ArrayUtil = Ice.ArrayUtil;
-var AsyncResultBase = Ice.AsyncResultBase;
-var AsyncResult = Ice.AsyncResult;
-var Debug = Ice.Debug;
-var FormatType = Ice.FormatType;
-var HashMap = Ice.HashMap;
-var OutgoingAsync = Ice.OutgoingAsync;
-var ProxyFlushBatch = Ice.ProxyFlushBatch;
-var ProxyGetConnection = Ice.ProxyGetConnection;
-var RefMode = Ice.ReferenceMode;
-var OperationMode = Ice.OperationMode;
+const ArrayUtil = Ice.ArrayUtil;
+const AsyncResultBase = Ice.AsyncResultBase;
+const AsyncResult = Ice.AsyncResult;
+const Debug = Ice.Debug;
+const FormatType = Ice.FormatType;
+const OutgoingAsync = Ice.OutgoingAsync;
+const ProxyFlushBatch = Ice.ProxyFlushBatch;
+const ProxyGetConnection = Ice.ProxyGetConnection;
+const RefMode = Ice.ReferenceMode;
+const OperationMode = Ice.OperationMode;
//
// Ice.ObjectPrx
//
-var ObjectPrx = Ice.Class({
- __init__: function()
+class ObjectPrx
+{
+ constructor()
{
this._reference = null;
this._requestHandler = null;
- },
- hashCode: function(r)
+ }
+
+ hashCode(r)
{
return this._reference.hashCode();
- },
- ice_getCommunicator: function()
+ }
+
+ ice_getCommunicator()
{
return this._reference.getCommunicator();
- },
- toString: function()
+ }
+
+ toString()
{
return this._reference.toString();
- },
- ice_getIdentity: function()
+ }
+
+ ice_getIdentity()
{
return this._reference.getIdentity().clone();
- },
- ice_identity: function(newIdentity)
+ }
+
+ ice_identity(newIdentity)
{
if(newIdentity === undefined || newIdentity === null || newIdentity.name.length === 0)
{
@@ -74,24 +77,28 @@ var ObjectPrx = Ice.Class({
}
else
{
- var proxy = new ObjectPrx();
- proxy.__setup(this._reference.changeIdentity(newIdentity));
+ const proxy = new ObjectPrx();
+ proxy._setup(this._reference.changeIdentity(newIdentity));
return proxy;
}
- },
- ice_getContext: function()
+ }
+
+ ice_getContext()
{
- return new HashMap(this._reference.getContext());
- },
- ice_context: function(newContext)
+ return new Map(this._reference.getContext());
+ }
+
+ ice_context(newContext)
{
- return this.__newInstance(this._reference.changeContext(newContext));
- },
- ice_getFacet: function()
+ return this._newInstance(this._reference.changeContext(newContext));
+ }
+
+ ice_getFacet()
{
return this._reference.getFacet();
- },
- ice_facet: function(newFacet)
+ }
+
+ ice_facet(newFacet)
{
if(newFacet === undefined || newFacet === null)
{
@@ -104,16 +111,18 @@ var ObjectPrx = Ice.Class({
}
else
{
- var proxy = new ObjectPrx();
- proxy.__setup(this._reference.changeFacet(newFacet));
+ const proxy = new ObjectPrx();
+ proxy._setup(this._reference.changeFacet(newFacet));
return proxy;
}
- },
- ice_getAdapterId: function()
+ }
+
+ ice_getAdapterId()
{
return this._reference.getAdapterId();
- },
- ice_adapterId: function(newAdapterId)
+ }
+
+ ice_adapterId(newAdapterId)
{
if(newAdapterId === undefined || newAdapterId === null)
{
@@ -126,14 +135,16 @@ var ObjectPrx = Ice.Class({
}
else
{
- return this.__newInstance(this._reference.changeAdapterId(newAdapterId));
+ return this._newInstance(this._reference.changeAdapterId(newAdapterId));
}
- },
- ice_getEndpoints: function()
+ }
+
+ ice_getEndpoints()
{
return ArrayUtil.clone(this._reference.getEndpoints());
- },
- ice_endpoints: function(newEndpoints)
+ }
+
+ ice_endpoints(newEndpoints)
{
if(newEndpoints === undefined || newEndpoints === null)
{
@@ -146,14 +157,16 @@ var ObjectPrx = Ice.Class({
}
else
{
- return this.__newInstance(this._reference.changeEndpoints(newEndpoints));
+ return this._newInstance(this._reference.changeEndpoints(newEndpoints));
}
- },
- ice_getLocatorCacheTimeout: function()
+ }
+
+ ice_getLocatorCacheTimeout()
{
return this._reference.getLocatorCacheTimeout();
- },
- ice_locatorCacheTimeout: function(newTimeout)
+ }
+
+ ice_locatorCacheTimeout(newTimeout)
{
if(newTimeout < -1)
{
@@ -165,14 +178,16 @@ var ObjectPrx = Ice.Class({
}
else
{
- return this.__newInstance(this._reference.changeLocatorCacheTimeout(newTimeout));
+ return this._newInstance(this._reference.changeLocatorCacheTimeout(newTimeout));
}
- },
- ice_getInvocationTimeout: function()
+ }
+
+ ice_getInvocationTimeout()
{
return this._reference.getInvocationTimeout();
- },
- ice_invocationTimeout: function(newTimeout)
+ }
+
+ ice_invocationTimeout(newTimeout)
{
if(newTimeout < 1 && newTimeout !== -1)
{
@@ -184,14 +199,16 @@ var ObjectPrx = Ice.Class({
}
else
{
- return this.__newInstance(this._reference.changeInvocationTimeout(newTimeout));
+ return this._newInstance(this._reference.changeInvocationTimeout(newTimeout));
}
- },
- ice_isConnectionCached: function()
+ }
+
+ ice_isConnectionCached()
{
return this._reference.getCacheConnection();
- },
- ice_connectionCached: function(newCache)
+ }
+
+ ice_connectionCached(newCache)
{
if(newCache === this._reference.getCacheConnection())
{
@@ -199,14 +216,16 @@ var ObjectPrx = Ice.Class({
}
else
{
- return this.__newInstance(this._reference.changeCacheConnection(newCache));
+ return this._newInstance(this._reference.changeCacheConnection(newCache));
}
- },
- ice_getEndpointSelection: function()
+ }
+
+ ice_getEndpointSelection()
{
return this._reference.getEndpointSelection();
- },
- ice_endpointSelection: function(newType)
+ }
+
+ ice_endpointSelection(newType)
{
if(newType === this._reference.getEndpointSelection())
{
@@ -214,14 +233,16 @@ var ObjectPrx = Ice.Class({
}
else
{
- return this.__newInstance(this._reference.changeEndpointSelection(newType));
+ return this._newInstance(this._reference.changeEndpointSelection(newType));
}
- },
- ice_isSecure: function()
+ }
+
+ ice_isSecure()
{
return this._reference.getSecure();
- },
- ice_secure: function(b)
+ }
+
+ ice_secure(b)
{
if(b === this._reference.getSecure())
{
@@ -229,14 +250,16 @@ var ObjectPrx = Ice.Class({
}
else
{
- return this.__newInstance(this._reference.changeSecure(b));
+ return this._newInstance(this._reference.changeSecure(b));
}
- },
- ice_getEncodingVersion: function()
+ }
+
+ ice_getEncodingVersion()
{
return this._reference.getEncoding().clone();
- },
- ice_encodingVersion: function(e)
+ }
+
+ ice_encodingVersion(e)
{
if(e.equals(this._reference.getEncoding()))
{
@@ -244,14 +267,16 @@ var ObjectPrx = Ice.Class({
}
else
{
- return this.__newInstance(this._reference.changeEncoding(e));
+ return this._newInstance(this._reference.changeEncoding(e));
}
- },
- ice_isPreferSecure: function()
+ }
+
+ ice_isPreferSecure()
{
return this._reference.getPreferSecure();
- },
- ice_preferSecure: function(b)
+ }
+
+ ice_preferSecure(b)
{
if(b === this._reference.getPreferSecure())
{
@@ -259,48 +284,54 @@ var ObjectPrx = Ice.Class({
}
else
{
- return this.__newInstance(this._reference.changePreferSecure(b));
+ return this._newInstance(this._reference.changePreferSecure(b));
}
- },
- ice_getRouter: function()
+ }
+
+ ice_getRouter()
{
- var ri = this._reference.getRouterInfo();
+ const ri = this._reference.getRouterInfo();
return ri !== null ? ri.getRouter() : null;
- },
- ice_router: function(router)
+ }
+
+ ice_router(router)
{
- var ref = this._reference.changeRouter(router);
+ const ref = this._reference.changeRouter(router);
if(ref.equals(this._reference))
{
return this;
}
else
{
- return this.__newInstance(ref);
+ return this._newInstance(ref);
}
- },
- ice_getLocator: function()
+ }
+
+ ice_getLocator()
{
- var ri = this._reference.getLocatorInfo();
+ const ri = this._reference.getLocatorInfo();
return ri !== null ? ri.getLocator() : null;
- },
- ice_locator: function(locator)
+ }
+
+ ice_locator(locator)
{
- var ref = this._reference.changeLocator(locator);
+ const ref = this._reference.changeLocator(locator);
if(ref.equals(this._reference))
{
return this;
}
else
{
- return this.__newInstance(ref);
+ return this._newInstance(ref);
}
- },
- ice_isTwoway: function()
+ }
+
+ ice_isTwoway()
{
return this._reference.getMode() === RefMode.ModeTwoway;
- },
- ice_twoway: function()
+ }
+
+ ice_twoway()
{
if(this._reference.getMode() === RefMode.ModeTwoway)
{
@@ -308,14 +339,16 @@ var ObjectPrx = Ice.Class({
}
else
{
- return this.__newInstance(this._reference.changeMode(RefMode.ModeTwoway));
+ return this._newInstance(this._reference.changeMode(RefMode.ModeTwoway));
}
- },
- ice_isOneway: function()
+ }
+
+ ice_isOneway()
{
return this._reference.getMode() === RefMode.ModeOneway;
- },
- ice_oneway: function()
+ }
+
+ ice_oneway()
{
if(this._reference.getMode() === RefMode.ModeOneway)
{
@@ -323,14 +356,16 @@ var ObjectPrx = Ice.Class({
}
else
{
- return this.__newInstance(this._reference.changeMode(RefMode.ModeOneway));
+ return this._newInstance(this._reference.changeMode(RefMode.ModeOneway));
}
- },
- ice_isBatchOneway: function()
+ }
+
+ ice_isBatchOneway()
{
return this._reference.getMode() === RefMode.ModeBatchOneway;
- },
- ice_batchOneway: function()
+ }
+
+ ice_batchOneway()
{
if(this._reference.getMode() === RefMode.ModeBatchOneway)
{
@@ -338,14 +373,16 @@ var ObjectPrx = Ice.Class({
}
else
{
- return this.__newInstance(this._reference.changeMode(RefMode.ModeBatchOneway));
+ return this._newInstance(this._reference.changeMode(RefMode.ModeBatchOneway));
}
- },
- ice_isDatagram: function()
+ }
+
+ ice_isDatagram()
{
return this._reference.getMode() === RefMode.ModeDatagram;
- },
- ice_datagram: function()
+ }
+
+ ice_datagram()
{
if(this._reference.getMode() === RefMode.ModeDatagram)
{
@@ -353,14 +390,16 @@ var ObjectPrx = Ice.Class({
}
else
{
- return this.__newInstance(this._reference.changeMode(RefMode.ModeDatagram));
+ return this._newInstance(this._reference.changeMode(RefMode.ModeDatagram));
}
- },
- ice_isBatchDatagram: function()
+ }
+
+ ice_isBatchDatagram()
{
return this._reference.getMode() === RefMode.ModeBatchDatagram;
- },
- ice_batchDatagram: function()
+ }
+
+ ice_batchDatagram()
{
if(this._reference.getMode() === RefMode.ModeBatchDatagram)
{
@@ -368,84 +407,79 @@ var ObjectPrx = Ice.Class({
}
else
{
- return this.__newInstance(this._reference.changeMode(RefMode.ModeBatchDatagram));
- }
- },
- ice_compress: function(co)
- {
- var ref = this._reference.changeCompress(co);
- if(ref.equals(this._reference))
- {
- return this;
- }
- else
- {
- return this.__newInstance(ref);
+ return this._newInstance(this._reference.changeMode(RefMode.ModeBatchDatagram));
}
- },
- ice_timeout: function(t)
+ }
+
+ ice_timeout(t)
{
if(t < 1 && t !== -1)
{
throw new Error("invalid value passed to ice_timeout: " + t);
}
- var ref = this._reference.changeTimeout(t);
+ const ref = this._reference.changeTimeout(t);
if(ref.equals(this._reference))
{
return this;
}
else
{
- return this.__newInstance(ref);
+ return this._newInstance(ref);
}
- },
- ice_getConnectionId: function()
+ }
+
+ ice_getConnectionId()
{
return this._reference.getConnectionId();
- },
- ice_connectionId: function(id)
+ }
+
+ ice_connectionId(id)
{
- var ref = this._reference.changeConnectionId(id);
+ const ref = this._reference.changeConnectionId(id);
if(ref.equals(this._reference))
{
return this;
}
else
{
- return this.__newInstance(ref);
+ return this._newInstance(ref);
}
- },
- ice_getConnection: function()
+ }
+
+ ice_getConnection()
{
- var r = new ProxyGetConnection(this, "ice_getConnection");
+ const r = new ProxyGetConnection(this, "ice_getConnection");
try
{
- r.__invoke();
+ r.invoke();
}
catch(ex)
{
- r.__abort(ex);
+ r.abort(ex);
}
return r;
- },
- ice_getCachedConnection: function()
+ }
+
+ ice_getCachedConnection()
{
return this._requestHandler ? this._requestHandler.getConnection() : null;
- },
- ice_flushBatchRequests: function()
+ }
+
+ ice_flushBatchRequests()
{
- var r = new ProxyFlushBatch(this, "ice_flushBatchRequests");
+ const r = new ProxyFlushBatch(this, "ice_flushBatchRequests");
try
{
- r.__invoke();
+ r.invoke();
}
catch(ex)
{
- r.__abort(ex);
+ r.abort(ex);
}
return r;
- },
- equals: function(r)
+ }
+
+ equals(r)
{
if(this === r)
{
@@ -458,22 +492,31 @@ var ObjectPrx = Ice.Class({
}
return false;
- },
- __reference: function()
+ }
+
+ _write(os)
+ {
+ this._reference.getIdentity()._write(os);
+ this._reference.streamWrite(os);
+ }
+
+ _getReference()
{
return this._reference;
- },
- __copyFrom: function(from)
+ }
+
+ _copyFrom(from)
{
Debug.assert(this._reference === null);
Debug.assert(this._requestHandler === null);
this._reference = from._reference;
this._requestHandler = from._requestHandler;
- },
- __handleException: function(ex, handler, mode, sent, sleep, cnt)
+ }
+
+ _handleException(ex, handler, mode, sent, sleep, cnt)
{
- this.__updateRequestHandler(handler, null); // Clear the request handler
+ this._updateRequestHandler(handler, null); // Clear the request handler
//
// We only retry local exception, system exceptions aren't retried.
@@ -521,15 +564,17 @@ var ObjectPrx = Ice.Class({
{
throw ex;
}
- },
- __checkAsyncTwowayOnly: function(name)
+ }
+
+ _checkAsyncTwowayOnly(name)
{
if(!this.ice_isTwoway())
{
throw new Error("`" + name + "' can only be called with a twoway proxy");
}
- },
- __getRequestHandler: function()
+ }
+
+ _getRequestHandler()
{
if(this._reference.getCacheConnection())
{
@@ -539,16 +584,18 @@ var ObjectPrx = Ice.Class({
}
}
return this._reference.getRequestHandler(this);
- },
- __getBatchRequestQueue: function()
+ }
+
+ _getBatchRequestQueue()
{
if(!this._batchRequestQueue)
{
this._batchRequestQueue = this._reference.getBatchRequestQueue();
}
return this._batchRequestQueue;
- },
- __setRequestHandler: function(handler)
+ }
+
+ _setRequestHandler(handler)
{
if(this._reference.getCacheConnection())
{
@@ -559,8 +606,9 @@ var ObjectPrx = Ice.Class({
return this._requestHandler;
}
return handler;
- },
- __updateRequestHandler: function(previous, handler)
+ }
+
+ _updateRequestHandler(previous, handler)
{
if(this._reference.getCacheConnection() && previous !== null)
{
@@ -569,23 +617,26 @@ var ObjectPrx = Ice.Class({
this._requestHandler = this._requestHandler.update(previous, handler);
}
}
- },
+ }
+
//
// Only for use by IceInternal.ProxyFactory
//
- __setup: function(ref)
+ _setup(ref)
{
Debug.assert(this._reference === null);
this._reference = ref;
- },
- __newInstance: function(ref)
+ }
+
+ _newInstance(ref)
{
- var proxy = new this.constructor();
- proxy.__setup(ref);
+ const proxy = new this.constructor();
+ proxy._setup(ref);
return proxy;
- },
- ice_instanceof: function(T)
+ }
+
+ ice_instanceof(T)
{
if(T)
{
@@ -593,351 +644,238 @@ var ObjectPrx = Ice.Class({
{
return true;
}
- return this.constructor.__instanceof(T);
+ return this.constructor._instanceof(T);
}
return false;
}
-});
-//
-// Generic invocation for operations that have input parameters.
-//
-ObjectPrx.__invoke = function(p, name, mode, fmt, ctx, marshalFn, unmarshalFn, userEx, args)
-{
- if(unmarshalFn !== null || userEx.length > 0)
+ //
+ // Generic invocation for operations that have input parameters.
+ //
+ static _invoke(p, name, mode, fmt, ctx, marshalFn, unmarshalFn, userEx, args)
{
- p.__checkAsyncTwowayOnly(name);
- }
-
- var __r = new OutgoingAsync(p, name,
- function(__res)
+ if(unmarshalFn !== null || userEx.length > 0)
{
- ObjectPrx.__completed(__res, unmarshalFn, userEx);
- });
+ p._checkAsyncTwowayOnly(name);
+ }
- try
- {
- __r.__prepare(name, mode, ctx);
- if(marshalFn === null)
+ const r = new OutgoingAsync(p, name,
+ res =>
+ {
+ this._completed(res, unmarshalFn, userEx);
+ });
+
+ try
{
- __r.__writeEmptyParams();
+ r.prepare(name, mode, ctx);
+ if(marshalFn === null)
+ {
+ r.writeEmptyParams();
+ }
+ else
+ {
+ const ostr = r.startWriteParams(fmt);
+ marshalFn.call(null, ostr, args);
+ r.endWriteParams();
+ }
+ r.invoke();
}
- else
+ catch(ex)
{
- var __os = __r.__startWriteParams(fmt);
- marshalFn.call(null, __os, args);
- __r.__endWriteParams();
+ r.abort(ex);
}
- __r.__invoke();
- }
- catch(ex)
- {
- __r.__abort(ex);
+ return r;
}
- return __r;
-};
-//
-// Handles the completion of an invocation.
-//
-ObjectPrx.__completed = function(__r, unmarshalFn, userEx)
-{
- if(!ObjectPrx.__check(__r, userEx))
+ //
+ // Handles the completion of an invocation.
+ //
+ static _completed(r, unmarshalFn, userEx)
{
- return;
- }
+ if(!this._check(r, userEx))
+ {
+ return;
+ }
- try
- {
- if(unmarshalFn === null)
+ try
{
- __r.__readEmptyParams();
- __r.succeed(__r);
+ if(unmarshalFn === null)
+ {
+ r.readEmptyParams();
+ r.resolve();
+ }
+ else
+ {
+ r.resolve(unmarshalFn(r));
+ }
}
- else
+ catch(ex)
{
- var results = unmarshalFn(__r);
- __r.succeed.apply(__r, results);
+ this.dispatchLocalException(r, ex);
+ return;
}
}
- catch(ex)
- {
- ObjectPrx.__dispatchLocalException(__r, ex);
- return;
- }
-};
-
-//
-// Unmarshal callback for operations that return a bool as the only result.
-//
-ObjectPrx.__returns_bool = function(__is, __results)
-{
- __results.push(__is.readBool());
-};
-//
-// Unmarshal callback for operations that return a byte as the only result.
-//
-ObjectPrx.__returns_byte = function(__is, __results)
-{
- __results.push(__is.readByte());
-};
-
-//
-// Unmarshal callback for operations that return a short as the only result.
-//
-ObjectPrx.__returns_short = function(__is, __results)
-{
- __results.push(__is.readShort());
-};
-
-//
-// Unmarshal callback for operations that return an int as the only result.
-//
-ObjectPrx.__returns_int = function(__is, __results)
-{
- __results.push(__is.readInt());
-};
-
-//
-// Unmarshal callback for operations that return a long as the only result.
-//
-ObjectPrx.__returns_long = function(__is, __results)
-{
- __results.push(__is.readLong());
-};
-
-//
-// Unmarshal callback for operations that return a float as the only result.
-//
-ObjectPrx.__returns_float = function(__is, __results)
-{
- __results.push(__is.readFloat());
-};
-
-//
-// Unmarshal callback for operations that return a double as the only result.
-//
-ObjectPrx.__returns_double = function(__is, __results)
-{
- __results.push(__is.readDouble());
-};
-
-//
-// Unmarshal callback for operations that return a string as the only result.
-//
-ObjectPrx.__returns_string = function(__is, __results)
-{
- __results.push(__is.readString());
-};
-
-//
-// Unmarshal callback for operations that return a proxy as the only result.
-//
-ObjectPrx.__returns_ObjectPrx = function(__is, __results)
-{
- __results.push(__is.readProxy());
-};
-
-//
-// Unmarshal callback for operations that return an object as the only result.
-//
-ObjectPrx.__returns_Object = function(__is, __results)
-{
- __is.readObject(function(obj){ __results.push(obj); }, Ice.Object);
- __is.readPendingObjects();
-};
-
-//
-// Handles user exceptions.
-//
-ObjectPrx.__check = function(__r, __uex)
-{
//
- // If __uex is non-null, it must be an array of exception types.
+ // Handles user exceptions.
//
- try
- {
- __r.__throwUserException();
- }
- catch(ex)
+ static _check(r, uex)
{
- if(ex instanceof Ice.UserException)
+ //
+ // If uex is non-null, it must be an array of exception types.
+ //
+ try
{
- if(__uex !== null)
+ r.throwUserException();
+ }
+ catch(ex)
+ {
+ if(ex instanceof Ice.UserException)
{
- for(var i = 0; i < __uex.length; ++i)
+ if(uex !== null)
{
- if(ex instanceof __uex[i])
+ for(let i = 0; i < uex.length; ++i)
{
- __r.fail(ex, __r);
- return false;
+ if(ex instanceof uex[i])
+ {
+ r.reject(ex);
+ return false;
+ }
}
}
+ r.reject(new Ice.UnknownUserException(ex.ice_name()));
+ return false;
+ }
+ else
+ {
+ r.reject(ex);
+ return false;
}
- __r.fail(new Ice.UnknownUserException(ex.ice_name()), __r);
- return false;
- }
- else
- {
- __r.fail(ex, __r);
- return false;
}
- }
- return true;
-};
-
-ObjectPrx.__dispatchLocalException = function(__r, __ex)
-{
- __r.fail(__ex, __r);
-};
-
-ObjectPrx.ice_staticId = Ice.Object.ice_staticId;
-
-ObjectPrx.checkedCast = function(prx, facet, ctx)
-{
- var __r = null;
+ return true;
+ }
- if(prx === undefined || prx === null)
+ static dispatchLocalException(r, ex)
{
- __r = new AsyncResultBase(null, "checkedCast", null, null, null);
- __r.succeed(null, __r);
+ r.reject(ex);
}
- else
+
+ static checkedCast(prx, facet, ctx)
{
- if(facet !== undefined)
+ let r = null;
+
+ if(prx === undefined || prx === null)
{
- prx = prx.ice_facet(facet);
+ r = new AsyncResultBase(null, "checkedCast", null, null, null);
+ r.resolve(null);
}
-
- var self = this;
- __r = new AsyncResultBase(prx.ice_getCommunicator(), "checkedCast", null, prx, null);
- prx.ice_isA(this.ice_staticId(), ctx).then(
- function(__res, __ret)
+ else
+ {
+ if(facet !== undefined)
{
- if(__ret)
- {
- var __h = new self();
- __h.__copyFrom(prx);
- __r.succeed(__h, __r);
- }
- else
- {
- __r.succeed(null, __r);
- }
- }).exception(
- function(__ex)
+ prx = prx.ice_facet(facet);
+ }
+
+ r = new AsyncResultBase(prx.ice_getCommunicator(), "checkedCast", null, prx, null);
+ prx.ice_isA(this.ice_staticId(), ctx).then(
+ ret =>
{
- if(__ex instanceof Ice.FacetNotExistException)
+ if(ret)
{
- __r.succeed(null, __r);
+ const h = new this();
+ h._copyFrom(prx);
+ r.resolve(h);
}
else
{
- __r.fail(__ex, __r);
+ r.resolve(null);
}
- });
- }
+ }).catch(
+ ex =>
+ {
+ if(ex instanceof Ice.FacetNotExistException)
+ {
+ r.resolve(null);
+ }
+ else
+ {
+ r.reject(ex);
+ }
+ });
+ }
- return __r;
-};
+ return r;
+ }
-ObjectPrx.uncheckedCast = function(prx, facet)
-{
- var r = null;
- if(prx !== undefined && prx !== null)
+ static uncheckedCast(prx, facet)
{
- r = new this();
- if(facet !== undefined)
+ let r = null;
+ if(prx !== undefined && prx !== null)
{
- prx = prx.ice_facet(facet);
+ r = new this();
+ if(facet !== undefined)
+ {
+ prx = prx.ice_facet(facet);
+ }
+ r._copyFrom(prx);
}
- r.__copyFrom(prx);
+ return r;
}
- return r;
-};
-
-Object.defineProperty(ObjectPrx, "minWireSize", {
- get: function(){ return 2; }
-});
-ObjectPrx.write = function(os, v)
-{
- os.writeProxy(v);
-};
+ static get minWireSize()
+ {
+ return 2;
+ }
-ObjectPrx.read = function(is)
-{
- return is.readProxy(this);
-};
+ static write(os, v)
+ {
+ os.writeProxy(v);
+ }
-ObjectPrx.writeOpt = function(os, tag, v)
-{
- os.writeOptProxy(tag, v);
-};
+ static read(is)
+ {
+ return is.readProxy(this);
+ }
-ObjectPrx.readOpt = function(is, tag)
-{
- return is.readOptProxy(tag, this);
-};
+ static writeOptional(os, tag, v)
+ {
+ os.writeOptionalProxy(tag, v);
+ }
-ObjectPrx.__instanceof = function(T)
-{
- if(T === this)
+ static readOptional(is, tag)
{
- return true;
+ return is.readOptionalProxy(tag, this);
}
- for(var i in this.__implements)
+ static _instanceof(T)
{
- if(this.__implements[i].__instanceof(T))
+ if(T === this)
{
return true;
}
+
+ for(let i in this._implements)
+ {
+ if(this._implements[i]._instanceof(T))
+ {
+ return true;
+ }
+ }
+
+ return false;
}
- if(this.__parent)
+ static ice_staticId()
{
- return this.__parent.__instanceof(T);
+ return this._id;
}
- return false;
-};
-var Slice = Ice.Slice;
-Slice.defineProxy = function(base, staticId, prxInterfaces)
-{
- var prx = function()
+ static get _implements()
{
- base.call(this);
- };
- prx.__parent = base;
- prx.__implements = prxInterfaces;
-
- // All generated proxies inherit from ObjectPrx
- prx.prototype = new base();
- prx.prototype.constructor = prx;
-
- // Static methods
- prx.ice_staticId = staticId;
-
- // Copy static methods inherited from ObjectPrx
- prx.checkedCast = ObjectPrx.checkedCast;
- prx.uncheckedCast = ObjectPrx.uncheckedCast;
- prx.write = ObjectPrx.write;
- prx.writeOpt = ObjectPrx.writeOpt;
- prx.read = ObjectPrx.read;
- prx.readOpt = ObjectPrx.readOpt;
-
- prx.__instanceof = ObjectPrx.__instanceof;
-
- // Static properties
- Object.defineProperty(prx, "minWireSize", {
- get: function(){ return 2; }
- });
-
- return prx;
-};
+ return [];
+ }
+}
Ice.ObjectPrx = ObjectPrx;
module.exports.Ice = Ice;