diff options
author | Benoit Foucher <benoit@zeroc.com> | 2006-03-28 14:03:50 +0000 |
---|---|---|
committer | Benoit Foucher <benoit@zeroc.com> | 2006-03-28 14:03:50 +0000 |
commit | 3edb9d1e2ca92fff1bea08d23338cabee47dd2e7 (patch) | |
tree | b62a1dc465ac160616672c6a64f630396e4fae05 | |
parent | Synced with Ice for C++ changes. (diff) | |
download | ice-3edb9d1e2ca92fff1bea08d23338cabee47dd2e7.tar.bz2 ice-3edb9d1e2ca92fff1bea08d23338cabee47dd2e7.tar.xz ice-3edb9d1e2ca92fff1bea08d23338cabee47dd2e7.zip |
Fixed half of bug 847: ice_newIdentiy -> ice_identity, ice_newFacet ->
ice_facet, etc
60 files changed, 753 insertions, 260 deletions
diff --git a/cpp/CHANGES b/cpp/CHANGES index 14f38a25cbb..f90a5aa63dc 100644 --- a/cpp/CHANGES +++ b/cpp/CHANGES @@ -1,6 +1,12 @@ Changes since version 3.0.1 --------------------------- +- Deprecated ice_newIdentity, ice_newFacet, ice_newContext, + ice_newAdapterId and ice_newEndpoints methods proxy. You should now + use the ice_identity, ice_facet, ice_context, ice_adapterId and + ice_endpoints proxy methods. The former methods will be removed from + the next major release. + - Changed the Ice core and services to use the random generator from IceUtil. The initialization of the communicator doesn't call srand or srand48 anymore. It's up to your application to call it if diff --git a/cpp/demo/Glacier2/callback/Client.cpp b/cpp/demo/Glacier2/callback/Client.cpp index cfcabc93870..fd2c4333ab5 100644 --- a/cpp/demo/Glacier2/callback/Client.cpp +++ b/cpp/demo/Glacier2/callback/Client.cpp @@ -179,13 +179,13 @@ CallbackClient::run(int argc, char* argv[]) if(fake) { - twowayR = CallbackReceiverPrx::uncheckedCast(twowayR->ice_newIdentity(callbackReceiverFakeIdent)); - onewayR = CallbackReceiverPrx::uncheckedCast(onewayR->ice_newIdentity(callbackReceiverFakeIdent)); + twowayR = CallbackReceiverPrx::uncheckedCast(twowayR->ice_identity(callbackReceiverFakeIdent)); + onewayR = CallbackReceiverPrx::uncheckedCast(onewayR->ice_identity(callbackReceiverFakeIdent)); } else { - twowayR = CallbackReceiverPrx::uncheckedCast(twowayR->ice_newIdentity(callbackReceiverIdent)); - onewayR = CallbackReceiverPrx::uncheckedCast(onewayR->ice_newIdentity(callbackReceiverIdent)); + twowayR = CallbackReceiverPrx::uncheckedCast(twowayR->ice_identity(callbackReceiverIdent)); + onewayR = CallbackReceiverPrx::uncheckedCast(onewayR->ice_identity(callbackReceiverIdent)); } cout << "callback receiver identity: " << Ice::identityToString(twowayR->ice_getIdentity()) << endl; diff --git a/cpp/include/Ice/Proxy.h b/cpp/include/Ice/Proxy.h index 5babc03e9cf..36e43b04c8f 100644 --- a/cpp/include/Ice/Proxy.h +++ b/cpp/include/Ice/Proxy.h @@ -117,20 +117,25 @@ public: const ::std::pair<const ::Ice::Byte*, const ::Ice::Byte*>&, const ::Ice::Context&); ::Ice::Identity ice_getIdentity() const; - ::Ice::ObjectPrx ice_newIdentity(const ::Ice::Identity&) const; + ICE_DEPRECATED_API ::Ice::ObjectPrx ice_newIdentity(const ::Ice::Identity&) const; + ::Ice::ObjectPrx ice_identity(const ::Ice::Identity&) const; ::Ice::Context ice_getContext() const; - ::Ice::ObjectPrx ice_newContext(const ::Ice::Context&) const; + ICE_DEPRECATED_API ::Ice::ObjectPrx ice_newContext(const ::Ice::Context&) const; + ::Ice::ObjectPrx ice_context(const ::Ice::Context&) const; ::Ice::ObjectPrx ice_defaultContext() const; const ::std::string& ice_getFacet() const; - ::Ice::ObjectPrx ice_newFacet(const ::std::string&) const; + ICE_DEPRECATED_API ::Ice::ObjectPrx ice_newFacet(const ::std::string&) const; + ::Ice::ObjectPrx ice_facet(const ::std::string&) const; ::std::string ice_getAdapterId() const; - ::Ice::ObjectPrx ice_newAdapterId(const ::std::string&) const; + ICE_DEPRECATED_API ::Ice::ObjectPrx ice_newAdapterId(const ::std::string&) const; + ::Ice::ObjectPrx ice_adapterId(const ::std::string&) const; ::Ice::EndpointSeq ice_getEndpoints() const; - ::Ice::ObjectPrx ice_newEndpoints(const ::Ice::EndpointSeq&) const; + ICE_DEPRECATED_API ::Ice::ObjectPrx ice_newEndpoints(const ::Ice::EndpointSeq&) const; + ::Ice::ObjectPrx ice_endpoints(const ::Ice::EndpointSeq&) const; ::Ice::Int ice_getLocatorCacheTimeout() const; ::Ice::ObjectPrx ice_locatorCacheTimeout(::Ice::Int) const; @@ -157,7 +162,6 @@ public: ::Ice::ObjectPrx ice_timeout(int) const; ::Ice::ObjectPrx ice_router(const ::Ice::RouterPrx&) const; ::Ice::ObjectPrx ice_locator(const ::Ice::LocatorPrx&) const; - ::Ice::ObjectPrx ice_collocationOptimization(bool) const; ::Ice::ObjectPrx ice_connectionId(const ::std::string&) const; @@ -423,7 +427,7 @@ uncheckedCastImpl< ::Ice::ObjectPrx>(const ::Ice::ObjectPrx& b, const std::strin ::Ice::ObjectPrx d = 0; if(b) { - d = b->ice_newFacet(f); + d = b->ice_facet(f); } return d; } @@ -468,7 +472,7 @@ uncheckedCastImpl(const ::Ice::ObjectPrx& b, const std::string& f) { typedef typename P::element_type T; - ::Ice::ObjectPrx bb = b->ice_newFacet(f); + ::Ice::ObjectPrx bb = b->ice_facet(f); d = new T; d->__copyFrom(bb); } diff --git a/cpp/include/IceUtil/Config.h b/cpp/include/IceUtil/Config.h index d16c98caebd..2deb5d54e7e 100644 --- a/cpp/include/IceUtil/Config.h +++ b/cpp/include/IceUtil/Config.h @@ -65,6 +65,14 @@ # define ICE_DECLSPEC_IMPORT /**/ #endif +#if defined(_MSC_VER) +# define ICE_DEPRECATED_API __declspec(deprecated) +#elif defined(__GNUC__) +# define ICE_DEPRECATED_API __attribute__((deprecated)) +#else +# define ICE_DEPRECATED_API /**/ +#endif + // // Let's use these extensions with IceUtil: // diff --git a/cpp/src/Freeze/EvictorI.cpp b/cpp/src/Freeze/EvictorI.cpp index ce7b7f783f1..1b0e066b9d5 100644 --- a/cpp/src/Freeze/EvictorI.cpp +++ b/cpp/src/Freeze/EvictorI.cpp @@ -602,7 +602,7 @@ Freeze::EvictorI::addFacet(const ObjectPtr& servant, const Identity& ident, cons ObjectPrx obj = _adapter->createProxy(ident); if(!facet.empty()) { - obj = obj->ice_newFacet(facet); + obj = obj->ice_facet(facet); } return obj; } diff --git a/cpp/src/Glacier2/Blobject.cpp b/cpp/src/Glacier2/Blobject.cpp index 3e7fa8ba5f1..9c69caca6b2 100644 --- a/cpp/src/Glacier2/Blobject.cpp +++ b/cpp/src/Glacier2/Blobject.cpp @@ -109,7 +109,7 @@ Glacier2::Blobject::invoke(ObjectPrx& proxy, const AMD_Array_Object_ice_invokePt // if(!current.facet.empty()) { - proxy = proxy->ice_newFacet(current.facet); + proxy = proxy->ice_facet(current.facet); } // diff --git a/cpp/src/Ice/Proxy.cpp b/cpp/src/Ice/Proxy.cpp index 441e69ef7bb..3bfdc14610a 100644 --- a/cpp/src/Ice/Proxy.cpp +++ b/cpp/src/Ice/Proxy.cpp @@ -54,7 +54,7 @@ IceInternal::checkedCastImpl(const ObjectPrx& b, const string& f, const string& if(b) { - ObjectPrx bb = b->ice_newFacet(f); + ObjectPrx bb = b->ice_facet(f); try { if(bb->ice_isA(typeId)) @@ -88,7 +88,7 @@ IceInternal::checkedCastImpl(const ObjectPrx& b, const string& f, const string& if(b) { - ObjectPrx bb = b->ice_newFacet(f); + ObjectPrx bb = b->ice_facet(f); try { if(bb->ice_isA(typeId, ctx)) @@ -378,7 +378,7 @@ IceProxy::Ice::Object::ice_getIdentity() const } ObjectPrx -IceProxy::Ice::Object::ice_newIdentity(const Identity& newIdentity) const +IceProxy::Ice::Object::ice_identity(const Identity& newIdentity) const { if(newIdentity == _reference->getIdentity()) { @@ -392,6 +392,12 @@ IceProxy::Ice::Object::ice_newIdentity(const Identity& newIdentity) const } } +ObjectPrx +IceProxy::Ice::Object::ice_newIdentity(const Identity& newIdentity) const +{ + return ice_identity(newIdentity); +} + Context IceProxy::Ice::Object::ice_getContext() const { @@ -399,7 +405,7 @@ IceProxy::Ice::Object::ice_getContext() const } ObjectPrx -IceProxy::Ice::Object::ice_newContext(const Context& newContext) const +IceProxy::Ice::Object::ice_context(const Context& newContext) const { ObjectPrx proxy(new ::IceProxy::Ice::Object()); proxy->setup(_reference->changeContext(newContext)); @@ -407,6 +413,12 @@ IceProxy::Ice::Object::ice_newContext(const Context& newContext) const } ObjectPrx +IceProxy::Ice::Object::ice_newContext(const Context& newContext) const +{ + return ice_context(newContext); +} + +ObjectPrx IceProxy::Ice::Object::ice_defaultContext() const { ObjectPrx proxy(new ::IceProxy::Ice::Object()); @@ -421,7 +433,7 @@ IceProxy::Ice::Object::ice_getFacet() const } ObjectPrx -IceProxy::Ice::Object::ice_newFacet(const string& newFacet) const +IceProxy::Ice::Object::ice_facet(const string& newFacet) const { if(newFacet == _reference->getFacet()) { @@ -435,6 +447,12 @@ IceProxy::Ice::Object::ice_newFacet(const string& newFacet) const } } +ObjectPrx +IceProxy::Ice::Object::ice_newFacet(const string& newFacet) const +{ + return ice_facet(newFacet); +} + string IceProxy::Ice::Object::ice_getAdapterId() const { @@ -442,7 +460,7 @@ IceProxy::Ice::Object::ice_getAdapterId() const } ObjectPrx -IceProxy::Ice::Object::ice_newAdapterId(const string& newAdapterId) const +IceProxy::Ice::Object::ice_adapterId(const string& newAdapterId) const { if(newAdapterId == _reference->getAdapterId()) { @@ -456,6 +474,12 @@ IceProxy::Ice::Object::ice_newAdapterId(const string& newAdapterId) const } } +ObjectPrx +IceProxy::Ice::Object::ice_newAdapterId(const string& newAdapterId) const +{ + return ice_adapterId(newAdapterId); +} + EndpointSeq IceProxy::Ice::Object::ice_getEndpoints() const { @@ -469,7 +493,7 @@ IceProxy::Ice::Object::ice_getEndpoints() const } ObjectPrx -IceProxy::Ice::Object::ice_newEndpoints(const EndpointSeq& newEndpoints) const +IceProxy::Ice::Object::ice_endpoints(const EndpointSeq& newEndpoints) const { vector<EndpointIPtr> endpoints; for(EndpointSeq::const_iterator p = newEndpoints.begin(); p != newEndpoints.end(); ++p) @@ -489,6 +513,12 @@ IceProxy::Ice::Object::ice_newEndpoints(const EndpointSeq& newEndpoints) const } } +ObjectPrx +IceProxy::Ice::Object::ice_newEndpoints(const EndpointSeq& newEndpoints) const +{ + return ice_endpoints(newEndpoints); +} + Int IceProxy::Ice::Object::ice_getLocatorCacheTimeout() const { diff --git a/cpp/src/Ice/Reference.h b/cpp/src/Ice/Reference.h index 988cfa83bc8..6026ed4f47a 100644 --- a/cpp/src/Ice/Reference.h +++ b/cpp/src/Ice/Reference.h @@ -53,6 +53,7 @@ public: Ice::CommunicatorPtr getCommunicator() const; virtual bool getSecure() const = 0; + virtual bool getCompress() const = 0; virtual std::string getAdapterId() const = 0; virtual std::vector<EndpointIPtr> getEndpoints() const = 0; virtual bool getCollocationOptimization() const = 0; diff --git a/cpp/src/IceGrid/LocatorI.cpp b/cpp/src/IceGrid/LocatorI.cpp index 47d9321ca67..0284e0a95e7 100644 --- a/cpp/src/IceGrid/LocatorI.cpp +++ b/cpp/src/IceGrid/LocatorI.cpp @@ -98,7 +98,7 @@ public: // if(obj) { - _cb->ice_response(obj->ice_newIdentity(_obj->ice_getIdentity())); + _cb->ice_response(obj->ice_identity(_obj->ice_getIdentity())); } else { @@ -232,7 +232,7 @@ LocatorI::Request::response(const Ice::ObjectPrx& proxy) } Lock sync(*this); - _proxies.push_back(proxy->ice_newIdentity(Ice::stringToIdentity("dummy"))); + _proxies.push_back(proxy->ice_identity(Ice::stringToIdentity("dummy"))); // // If we received all the required proxies, it's time to send the @@ -277,7 +277,7 @@ LocatorI::Request::sendResponse() } Ice::ObjectPrx proxy = _locator->getCommunicator()->stringToProxy("dummy:default"); - _amdCB->ice_response(proxy->ice_newEndpoints(endpoints)); + _amdCB->ice_response(proxy->ice_endpoints(endpoints)); } } diff --git a/cpp/src/slice2cs/Gen.cpp b/cpp/src/slice2cs/Gen.cpp index 08d95db0ae3..47a87d9ac85 100755 --- a/cpp/src/slice2cs/Gen.cpp +++ b/cpp/src/slice2cs/Gen.cpp @@ -3461,7 +3461,7 @@ Slice::Gen::HelperVisitor::visitClassDefStart(const ClassDefPtr& p) _out << sb; _out << nl << "return null;"; _out << eb; - _out << nl << "Ice.ObjectPrx bb = b.ice_newFacet(f);"; + _out << nl << "Ice.ObjectPrx bb = b.ice_facet(f);"; _out << nl << "try"; _out << sb; _out << nl << "if(bb.ice_isA(\"" << p->scoped() << "\"))"; @@ -3483,7 +3483,7 @@ Slice::Gen::HelperVisitor::visitClassDefStart(const ClassDefPtr& p) _out << sb; _out << nl << "return null;"; _out << eb; - _out << nl << "Ice.ObjectPrx bb = b.ice_newFacet(f);"; + _out << nl << "Ice.ObjectPrx bb = b.ice_facet(f);"; _out << nl << "try"; _out << sb; _out << nl << "if(bb.ice_isA(\"" << p->scoped() << "\", ctx))"; @@ -3516,7 +3516,7 @@ Slice::Gen::HelperVisitor::visitClassDefStart(const ClassDefPtr& p) _out << sb; _out << nl << "return null;"; _out << eb; - _out << nl << "Ice.ObjectPrx bb = b.ice_newFacet(f);"; + _out << nl << "Ice.ObjectPrx bb = b.ice_facet(f);"; _out << nl << name << "PrxHelper h = new " << name << "PrxHelper();"; _out << nl << "h.copyFrom__(bb);"; _out << nl << "return h;"; diff --git a/cpp/src/slice2java/Gen.cpp b/cpp/src/slice2java/Gen.cpp index 7f4f6fc770a..5d60f13c254 100644 --- a/cpp/src/slice2java/Gen.cpp +++ b/cpp/src/slice2java/Gen.cpp @@ -3181,7 +3181,7 @@ Slice::Gen::HelperVisitor::visitClassDefStart(const ClassDefPtr& p) out << nl << name << "Prx d = null;"; out << nl << "if(b != null)"; out << sb; - out << nl << "Ice.ObjectPrx bb = b.ice_newFacet(f);"; + out << nl << "Ice.ObjectPrx bb = b.ice_facet(f);"; out << nl << "try"; out << sb; out << nl << "if(bb.ice_isA(\"" << scoped << "\"))"; @@ -3204,7 +3204,7 @@ Slice::Gen::HelperVisitor::visitClassDefStart(const ClassDefPtr& p) out << nl << name << "Prx d = null;"; out << nl << "if(b != null)"; out << sb; - out << nl << "Ice.ObjectPrx bb = b.ice_newFacet(f);"; + out << nl << "Ice.ObjectPrx bb = b.ice_facet(f);"; out << nl << "try"; out << sb; out << nl << "if(bb.ice_isA(\"" << scoped << "\", ctx))"; @@ -3238,7 +3238,7 @@ Slice::Gen::HelperVisitor::visitClassDefStart(const ClassDefPtr& p) out << nl << name << "Prx d = null;"; out << nl << "if(b != null)"; out << sb; - out << nl << "Ice.ObjectPrx bb = b.ice_newFacet(f);"; + out << nl << "Ice.ObjectPrx bb = b.ice_facet(f);"; out << nl << name << "PrxHelper h = new " << name << "PrxHelper();"; out << nl << "h.__copyFrom(bb);"; out << nl << "d = h;"; diff --git a/cpp/src/slice2javae/Gen.cpp b/cpp/src/slice2javae/Gen.cpp index ce10208c083..2b0b0105fbd 100644 --- a/cpp/src/slice2javae/Gen.cpp +++ b/cpp/src/slice2javae/Gen.cpp @@ -2337,7 +2337,7 @@ Slice::Gen::HelperVisitor::visitClassDefStart(const ClassDefPtr& p) out << nl << name << "Prx d = null;"; out << nl << "if(b != null)"; out << sb; - out << nl << "Ice.ObjectPrx bb = b.ice_newFacet(f);"; + out << nl << "Ice.ObjectPrx bb = b.ice_facet(f);"; out << nl << "try"; out << sb; out << nl << "if(bb.ice_isA(\"" << scoped << "\"))"; @@ -2360,7 +2360,7 @@ Slice::Gen::HelperVisitor::visitClassDefStart(const ClassDefPtr& p) out << nl << name << "Prx d = null;"; out << nl << "if(b != null)"; out << sb; - out << nl << "Ice.ObjectPrx bb = b.ice_newFacet(f);"; + out << nl << "Ice.ObjectPrx bb = b.ice_facet(f);"; out << nl << "try"; out << sb; out << nl << "if(bb.ice_isA(\"" << scoped << "\", ctx))"; @@ -2394,7 +2394,7 @@ Slice::Gen::HelperVisitor::visitClassDefStart(const ClassDefPtr& p) out << nl << name << "Prx d = null;"; out << nl << "if(b != null)"; out << sb; - out << nl << "Ice.ObjectPrx bb = b.ice_newFacet(f);"; + out << nl << "Ice.ObjectPrx bb = b.ice_facet(f);"; out << nl << name << "PrxHelper h = new " << name << "PrxHelper();"; out << nl << "h.__copyFrom(bb);"; out << nl << "d = h;"; diff --git a/cpp/src/slice2vb/Gen.cpp b/cpp/src/slice2vb/Gen.cpp index 2ba4aa87429..6b9b248d4e1 100755 --- a/cpp/src/slice2vb/Gen.cpp +++ b/cpp/src/slice2vb/Gen.cpp @@ -3834,7 +3834,7 @@ Slice::Gen::HelperVisitor::visitClassDefStart(const ClassDefPtr& p) _out << nl << "Return Nothing"; _out.dec(); _out << nl << "End If"; - _out << nl << "Dim bb As Ice.ObjectPrx = b.ice_newFacet(f)"; + _out << nl << "Dim bb As Ice.ObjectPrx = b.ice_facet(f)"; _out << nl << "Try"; _out.inc(); _out << nl << "If bb.ice_isA(\"" << p->scoped() << "\") Then"; @@ -3859,7 +3859,7 @@ Slice::Gen::HelperVisitor::visitClassDefStart(const ClassDefPtr& p) _out << nl << "Return Nothing"; _out.dec(); _out << nl << "End If"; - _out << nl << "Dim bb As Ice.ObjectPrx = b.ice_newFacet(f)"; + _out << nl << "Dim bb As Ice.ObjectPrx = b.ice_facet(f)"; _out << nl << "Try"; _out.inc(); _out << nl << "If bb.ice_isA(\"" << p->scoped() << "\", ctx) Then"; @@ -3897,7 +3897,7 @@ Slice::Gen::HelperVisitor::visitClassDefStart(const ClassDefPtr& p) _out << nl << "Return Nothing"; _out.dec(); _out << nl << "End If"; - _out << nl << "Dim bb As Ice.ObjectPrx = b.ice_newFacet(f)"; + _out << nl << "Dim bb As Ice.ObjectPrx = b.ice_facet(f)"; _out << nl << "Dim h As " << name << "PrxHelper = new " << name << "PrxHelper()"; _out << nl << "h.copyFrom__(bb)"; _out << nl << "Return h"; diff --git a/cpp/test/Glacier2/router/Client.cpp b/cpp/test/Glacier2/router/Client.cpp index 9b6489a75c2..aee08743c16 100644 --- a/cpp/test/Glacier2/router/Client.cpp +++ b/cpp/test/Glacier2/router/Client.cpp @@ -617,7 +617,7 @@ CallbackClient::run(int argc, char* argv[]) Context context; context["_fwd"] = "t"; CallbackPrx otherCategoryTwoway = CallbackPrx::uncheckedCast( - twoway->ice_newIdentity(stringToIdentity("c2/callback"))); + twoway->ice_identity(stringToIdentity("c2/callback"))); otherCategoryTwoway->initiateCallback(twowayR, context); test(callbackReceiverImpl->callbackOK()); cout << "ok" << endl; @@ -630,7 +630,7 @@ CallbackClient::run(int argc, char* argv[]) try { CallbackPrx otherCategoryTwoway = CallbackPrx::uncheckedCast( - twoway->ice_newIdentity(stringToIdentity("c3/callback"))); + twoway->ice_identity(stringToIdentity("c3/callback"))); otherCategoryTwoway->initiateCallback(twowayR, context); test(false); } @@ -645,7 +645,7 @@ CallbackClient::run(int argc, char* argv[]) Context context; context["_fwd"] = "t"; CallbackPrx otherCategoryTwoway = CallbackPrx::uncheckedCast( - twoway->ice_newIdentity(stringToIdentity("_userid/callback"))); + twoway->ice_identity(stringToIdentity("_userid/callback"))); otherCategoryTwoway->initiateCallback(twowayR, context); test(callbackReceiverImpl->callbackOK()); cout << "ok" << endl; diff --git a/cpp/test/Ice/binding/AllTests.cpp b/cpp/test/Ice/binding/AllTests.cpp index 901ef628aca..86e37d26ba1 100644 --- a/cpp/test/Ice/binding/AllTests.cpp +++ b/cpp/test/Ice/binding/AllTests.cpp @@ -70,7 +70,7 @@ createTestIntfPrx(vector<RemoteObjectAdapterPrx>& adapters) Ice::EndpointSeq edpts = test->ice_getEndpoints(); endpoints.insert(endpoints.end(), edpts.begin(), edpts.end()); } - return TestIntfPrx::uncheckedCast(test->ice_newEndpoints(endpoints)); + return TestIntfPrx::uncheckedCast(test->ice_endpoints(endpoints)); } void diff --git a/cpp/test/Ice/exceptions/AllTests.cpp b/cpp/test/Ice/exceptions/AllTests.cpp index 7beae0c27c7..15a7c40817f 100644 --- a/cpp/test/Ice/exceptions/AllTests.cpp +++ b/cpp/test/Ice/exceptions/AllTests.cpp @@ -989,7 +989,7 @@ allTests(const Ice::CommunicatorPtr& communicator, bool collocated) Ice::Identity id = Ice::stringToIdentity("does not exist"); try { - ThrowerPrx thrower2 = ThrowerPrx::uncheckedCast(thrower->ice_newIdentity(id)); + ThrowerPrx thrower2 = ThrowerPrx::uncheckedCast(thrower->ice_identity(id)); thrower2->throwAasA(1); // thrower2->ice_ping(); test(false); @@ -1206,7 +1206,7 @@ allTests(const Ice::CommunicatorPtr& communicator, bool collocated) { id = Ice::stringToIdentity("does not exist"); - ThrowerPrx thrower2 = ThrowerPrx::uncheckedCast(thrower->ice_newIdentity(id)); + ThrowerPrx thrower2 = ThrowerPrx::uncheckedCast(thrower->ice_identity(id)); AMI_Thrower_throwAasAObjectNotExistIPtr cb = new AMI_Thrower_throwAasAObjectNotExistI; thrower2->throwAasA_async(cb, 1); test(cb->check()); diff --git a/cpp/test/Ice/operations/Twoways.cpp b/cpp/test/Ice/operations/Twoways.cpp index 79e36af35a3..e71d5a92c18 100644 --- a/cpp/test/Ice/operations/Twoways.cpp +++ b/cpp/test/Ice/operations/Twoways.cpp @@ -633,7 +633,7 @@ twoways(const Ice::CommunicatorPtr& communicator, const Test::MyClassPrx& p) test(r == ctx); } { - Test::MyClassPrx p2 = Test::MyClassPrx::checkedCast(p->ice_newContext(ctx)); + Test::MyClassPrx p2 = Test::MyClassPrx::checkedCast(p->ice_context(ctx)); test(p2->ice_getContext() == ctx); Test::StringStringD r = p2->opContext(); test(r == ctx); @@ -650,7 +650,7 @@ twoways(const Ice::CommunicatorPtr& communicator, const Test::MyClassPrx& p) communicator->setDefaultContext(dflt); test(p->opContext() != dflt); - Test::MyClassPrx p2 = Test::MyClassPrx::uncheckedCast(p->ice_newContext(Ice::Context())); + Test::MyClassPrx p2 = Test::MyClassPrx::uncheckedCast(p->ice_context(Ice::Context())); test(p2->opContext().empty()); p2 = Test::MyClassPrx::uncheckedCast(p->ice_defaultContext()); @@ -665,11 +665,11 @@ twoways(const Ice::CommunicatorPtr& communicator, const Test::MyClassPrx& p) test(c->opContext() == dflt); dflt["a"] = "c"; - Test::MyClassPrx c2 = Test::MyClassPrx::uncheckedCast(c->ice_newContext(dflt)); + Test::MyClassPrx c2 = Test::MyClassPrx::uncheckedCast(c->ice_context(dflt)); test(c2->opContext()["a"] == "c"); dflt.clear(); - Test::MyClassPrx c3 = Test::MyClassPrx::uncheckedCast(c2->ice_newContext(dflt)); + Test::MyClassPrx c3 = Test::MyClassPrx::uncheckedCast(c2->ice_context(dflt)); Ice::Context tmp = c3->opContext(); test(tmp.find("a") == tmp.end()); diff --git a/cpp/test/Ice/operations/TwowaysAMI.cpp b/cpp/test/Ice/operations/TwowaysAMI.cpp index 7f46498f777..9ef5ca5fbac 100644 --- a/cpp/test/Ice/operations/TwowaysAMI.cpp +++ b/cpp/test/Ice/operations/TwowaysAMI.cpp @@ -1202,7 +1202,7 @@ twowaysAMI(const Ice::CommunicatorPtr& communicator, const Test::MyClassPrx& p) p->opContext_async(cb, ctx); test(cb->check()); } - Test::MyClassPrx p2 = Test::MyClassPrx::checkedCast(p->ice_newContext(ctx)); + Test::MyClassPrx p2 = Test::MyClassPrx::checkedCast(p->ice_context(ctx)); test(p2->ice_getContext() == ctx); { AMI_MyClass_opContextEqualIPtr cb = new AMI_MyClass_opContextEqualI(ctx); @@ -1210,7 +1210,7 @@ twowaysAMI(const Ice::CommunicatorPtr& communicator, const Test::MyClassPrx& p) test(cb->check()); } { - Test::MyClassPrx p2 = Test::MyClassPrx::checkedCast(p->ice_newContext(ctx)); + Test::MyClassPrx p2 = Test::MyClassPrx::checkedCast(p->ice_context(ctx)); AMI_MyClass_opContextEqualIPtr cb = new AMI_MyClass_opContextEqualI(ctx); p2->opContext_async(cb, ctx); test(cb->check()); @@ -1228,7 +1228,7 @@ twowaysAMI(const Ice::CommunicatorPtr& communicator, const Test::MyClassPrx& p) test(cb->check()); } - Test::MyClassPrx p2 = Test::MyClassPrx::uncheckedCast(p->ice_newContext(Ice::Context())); + Test::MyClassPrx p2 = Test::MyClassPrx::uncheckedCast(p->ice_context(Ice::Context())); { AMI_MyClass_opContextEqualIPtr cb = new AMI_MyClass_opContextEqualI(Ice::Context()); p2->opContext_async(cb); @@ -1261,7 +1261,7 @@ twowaysAMI(const Ice::CommunicatorPtr& communicator, const Test::MyClassPrx& p) } dflt["a"] = "c"; - Test::MyClassPrx c2 = Test::MyClassPrx::uncheckedCast(c->ice_newContext(dflt)); + Test::MyClassPrx c2 = Test::MyClassPrx::uncheckedCast(c->ice_context(dflt)); { Ice::Context tmp; tmp["a"] = "c"; @@ -1271,7 +1271,7 @@ twowaysAMI(const Ice::CommunicatorPtr& communicator, const Test::MyClassPrx& p) } dflt.clear(); - Test::MyClassPrx c3 = Test::MyClassPrx::uncheckedCast(c2->ice_newContext(dflt)); + Test::MyClassPrx c3 = Test::MyClassPrx::uncheckedCast(c2->ice_context(dflt)); { Ice::Context tmp; AMI_MyClass_opContextEqualIPtr cb = new AMI_MyClass_opContextEqualI(tmp); diff --git a/cppe/include/IceE/Config.h b/cppe/include/IceE/Config.h index d79b271361a..0af91514943 100644 --- a/cppe/include/IceE/Config.h +++ b/cppe/include/IceE/Config.h @@ -129,6 +129,14 @@ # define ICE_DECLSPEC_IMPORT /**/ #endif +#if defined(_MSC_VER) +# define ICE_DEPRECATED_API __declspec(deprecated) +#elif defined(__GNUC__) +# define ICE_DEPRECATED_API __attribute__((deprecated)) +#else +# define ICE_DEPRECATED_API /**/ +#endif + // // Let's use these extensions with IceE: // diff --git a/cppe/include/IceE/Proxy.h b/cppe/include/IceE/Proxy.h index 5037c90ab11..5be5236561a 100644 --- a/cppe/include/IceE/Proxy.h +++ b/cppe/include/IceE/Proxy.h @@ -122,14 +122,17 @@ public: ::std::string ice_id(const ::Ice::Context&); ::Ice::Identity ice_getIdentity() const; - ::Ice::ObjectPrx ice_newIdentity(const ::Ice::Identity&) const; - + ICE_DEPRECATED_API ::Ice::ObjectPrx ice_newIdentity(const ::Ice::Identity&) const; + ::Ice::ObjectPrx ice_identity(const ::Ice::Identity&) const; + ::Ice::Context ice_getContext() const; - ::Ice::ObjectPrx ice_newContext(const ::Ice::Context&) const; + ICE_DEPRECATED_API ::Ice::ObjectPrx ice_newContext(const ::Ice::Context&) const; + ::Ice::ObjectPrx ice_context(const ::Ice::Context&) const; ::Ice::ObjectPrx ice_defaultContext() const; const ::std::string& ice_getFacet() const; - ::Ice::ObjectPrx ice_newFacet(const ::std::string&) const; + ICE_DEPRECATED_API ::Ice::ObjectPrx ice_newFacet(const ::std::string&) const; + ::Ice::ObjectPrx ice_facet(const ::std::string&) const; ::Ice::ObjectPrx ice_twoway() const; bool ice_isTwoway() const; @@ -313,7 +316,7 @@ uncheckedCastImpl< ::Ice::ObjectPrx>(const ::Ice::ObjectPrx& b, const std::strin ::Ice::ObjectPrx d = 0; if(b) { - d = b->ice_newFacet(f); + d = b->ice_facet(f); } return d; } @@ -358,7 +361,7 @@ uncheckedCastImpl(const ::Ice::ObjectPrx& b, const std::string& f) { typedef typename P::element_type T; - ::Ice::ObjectPrx bb = b->ice_newFacet(f); + ::Ice::ObjectPrx bb = b->ice_facet(f); d = new T; d->__copyFrom(bb); } diff --git a/cppe/src/IceE/Proxy.cpp b/cppe/src/IceE/Proxy.cpp index 7a271ec9e8d..9ae070e8d79 100644 --- a/cppe/src/IceE/Proxy.cpp +++ b/cppe/src/IceE/Proxy.cpp @@ -65,7 +65,7 @@ IceInternal::checkedCastImpl(const ObjectPrx& b, const string& f, const string& if(b) { - ObjectPrx bb = b->ice_newFacet(f); + ObjectPrx bb = b->ice_facet(f); try { if(bb->ice_isA(typeId)) @@ -99,7 +99,7 @@ IceInternal::checkedCastImpl(const ObjectPrx& b, const string& f, const string& if(b) { - ObjectPrx bb = b->ice_newFacet(f); + ObjectPrx bb = b->ice_facet(f); try { if(bb->ice_isA(typeId, ctx)) @@ -428,7 +428,7 @@ IceProxy::Ice::Object::ice_getContext() const } ObjectPrx -IceProxy::Ice::Object::ice_newContext(const Context& newContext) const +IceProxy::Ice::Object::ice_context(const Context& newContext) const { ObjectPrx proxy(new ::IceProxy::Ice::Object()); proxy->setup(_reference->changeContext(newContext)); @@ -436,6 +436,12 @@ IceProxy::Ice::Object::ice_newContext(const Context& newContext) const } ObjectPrx +IceProxy::Ice::Object::ice_newContext(const Context& newContext) const +{ + return ice_context(newContext); +} + +ObjectPrx IceProxy::Ice::Object::ice_defaultContext() const { ObjectPrx proxy(new ::IceProxy::Ice::Object()); @@ -450,7 +456,7 @@ IceProxy::Ice::Object::ice_getIdentity() const } ObjectPrx -IceProxy::Ice::Object::ice_newIdentity(const Identity& newIdentity) const +IceProxy::Ice::Object::ice_identity(const Identity& newIdentity) const { if(newIdentity == _reference->getIdentity()) { @@ -464,6 +470,12 @@ IceProxy::Ice::Object::ice_newIdentity(const Identity& newIdentity) const } } +ObjectPrx +IceProxy::Ice::Object::ice_newIdentity(const Identity& newIdentity) const +{ + return ice_identity(newIdentity); +} + const string& IceProxy::Ice::Object::ice_getFacet() const { @@ -471,7 +483,7 @@ IceProxy::Ice::Object::ice_getFacet() const } ObjectPrx -IceProxy::Ice::Object::ice_newFacet(const string& newFacet) const +IceProxy::Ice::Object::ice_facet(const string& newFacet) const { if(newFacet == _reference->getFacet()) { @@ -486,6 +498,12 @@ IceProxy::Ice::Object::ice_newFacet(const string& newFacet) const } ObjectPrx +IceProxy::Ice::Object::ice_newFacet(const string& newFacet) const +{ + return ice_facet(newFacet); +} + +ObjectPrx IceProxy::Ice::Object::ice_twoway() const { ReferencePtr ref = _reference->changeMode(Reference::ModeTwoway); diff --git a/cppe/test/IceE/exceptions/AllTests.cpp b/cppe/test/IceE/exceptions/AllTests.cpp index b0b9de81f0d..3a646af07ea 100644 --- a/cppe/test/IceE/exceptions/AllTests.cpp +++ b/cppe/test/IceE/exceptions/AllTests.cpp @@ -404,7 +404,7 @@ allTests(const Ice::CommunicatorPtr& communicator) Ice::Identity id = Ice::stringToIdentity("does not exist"); try { - ThrowerPrx thrower2 = ThrowerPrx::uncheckedCast(thrower->ice_newIdentity(id)); + ThrowerPrx thrower2 = ThrowerPrx::uncheckedCast(thrower->ice_identity(id)); thrower2->throwAasA(1); // thrower2->ice_ping(); test(false); diff --git a/cppe/test/IceE/operations/Twoways.cpp b/cppe/test/IceE/operations/Twoways.cpp index 7964ea6c288..5bcd0718328 100644 --- a/cppe/test/IceE/operations/Twoways.cpp +++ b/cppe/test/IceE/operations/Twoways.cpp @@ -633,7 +633,7 @@ twoways(const Ice::CommunicatorPtr& communicator, const Test::MyClassPrx& p) test(r == ctx); } { - Test::MyClassPrx p2 = Test::MyClassPrx::checkedCast(p->ice_newContext(ctx)); + Test::MyClassPrx p2 = Test::MyClassPrx::checkedCast(p->ice_context(ctx)); test(p2->ice_getContext() == ctx); Test::StringStringD r = p2->opContext(); test(r == ctx); @@ -650,7 +650,7 @@ twoways(const Ice::CommunicatorPtr& communicator, const Test::MyClassPrx& p) communicator->setDefaultContext(dflt); test(p->opContext() != dflt); - Test::MyClassPrx p2 = Test::MyClassPrx::uncheckedCast(p->ice_newContext(Ice::Context())); + Test::MyClassPrx p2 = Test::MyClassPrx::uncheckedCast(p->ice_context(Ice::Context())); test(p2->opContext().empty()); p2 = Test::MyClassPrx::uncheckedCast(p->ice_defaultContext()); @@ -666,11 +666,11 @@ twoways(const Ice::CommunicatorPtr& communicator, const Test::MyClassPrx& p) test(c->opContext() == dflt); dflt["a"] = "c"; - Test::MyClassPrx c2 = Test::MyClassPrx::uncheckedCast(c->ice_newContext(dflt)); + Test::MyClassPrx c2 = Test::MyClassPrx::uncheckedCast(c->ice_context(dflt)); test(c2->opContext()["a"] == "c"); dflt.clear(); - Test::MyClassPrx c3 = Test::MyClassPrx::uncheckedCast(c2->ice_newContext(dflt)); + Test::MyClassPrx c3 = Test::MyClassPrx::uncheckedCast(c2->ice_context(dflt)); Ice::Context tmp = c3->opContext(); test(tmp.find("a") == tmp.end()); diff --git a/cs/demo/Glacier2/callback/Client.cs b/cs/demo/Glacier2/callback/Client.cs index af54fb05eba..804bd4e02fb 100644 --- a/cs/demo/Glacier2/callback/Client.cs +++ b/cs/demo/Glacier2/callback/Client.cs @@ -174,16 +174,16 @@ public class Client : Ice.Application if(fake) { twowayR = CallbackReceiverPrxHelper.uncheckedCast( - twowayR.ice_newIdentity(callbackReceiverFakeIdent)); + twowayR.ice_identity(callbackReceiverFakeIdent)); onewayR = CallbackReceiverPrxHelper.uncheckedCast( - onewayR.ice_newIdentity(callbackReceiverFakeIdent)); + onewayR.ice_identity(callbackReceiverFakeIdent)); } else { twowayR = CallbackReceiverPrxHelper.uncheckedCast( - twowayR.ice_newIdentity(callbackReceiverIdent)); + twowayR.ice_identity(callbackReceiverIdent)); onewayR = CallbackReceiverPrxHelper.uncheckedCast( - onewayR.ice_newIdentity(callbackReceiverIdent)); + onewayR.ice_identity(callbackReceiverIdent)); } Console.WriteLine("callback receiver identity: " + diff --git a/cs/src/Ice/Proxy.cs b/cs/src/Ice/Proxy.cs index 290be89f2b8..d35fd677c5a 100644 --- a/cs/src/Ice/Proxy.cs +++ b/cs/src/Ice/Proxy.cs @@ -44,20 +44,30 @@ namespace Ice Context context); Identity ice_getIdentity(); + [Obsolete("This method has been deprecated, use ice_identity instead.")] ObjectPrx ice_newIdentity(Identity newIdentity); - + ObjectPrx ice_identity(Identity newIdentity); + Context ice_getContext(); + [Obsolete("This method has been deprecated, use ice_context instead.")] ObjectPrx ice_newContext(Context newContext); + ObjectPrx ice_context(Context newContext); ObjectPrx ice_defaultContext(); string ice_getFacet(); + [Obsolete("This method has been deprecated, use ice_facet instead.")] ObjectPrx ice_newFacet(string newFacet); + ObjectPrx ice_facet(string newFacet); string ice_getAdapterId(); + [Obsolete("This method has been deprecated, use ice_adapterId instead.")] ObjectPrx ice_newAdapterId(string newAdapterId); + ObjectPrx ice_adapterId(string newAdapterId); Endpoint[] ice_getEndpoints(); + [Obsolete("This method has been deprecated, use ice_endpoints instead.")] ObjectPrx ice_newEndpoints(Endpoint[] newEndpoints); + ObjectPrx ice_endpoints(Endpoint[] newEndpoints); int ice_getLocatorCacheTimeout(); ObjectPrx ice_locatorCacheTimeout(int timeout); @@ -277,7 +287,7 @@ namespace Ice return _reference.getIdentity(); } - public ObjectPrx ice_newIdentity(Identity newIdentity) + public ObjectPrx ice_identity(Identity newIdentity) { if(newIdentity.Equals(_reference.getIdentity())) { @@ -291,18 +301,28 @@ namespace Ice } } + public ObjectPrx ice_newIdentity(Identity newIdentity) + { + return ice_identity(newIdentity); + } + public Context ice_getContext() { return _reference.getContext(); } - public ObjectPrx ice_newContext(Context newContext) + public ObjectPrx ice_context(Context newContext) { ObjectPrxHelperBase proxy = new ObjectPrxHelperBase(); proxy.setup(_reference.changeContext(newContext)); return proxy; } + public ObjectPrx ice_newContext(Context newContext) + { + return ice_context(newContext); + } + public ObjectPrx ice_defaultContext() { ObjectPrxHelperBase proxy = new ObjectPrxHelperBase(); @@ -315,7 +335,7 @@ namespace Ice return _reference.getFacet(); } - public ObjectPrx ice_newFacet(string newFacet) + public ObjectPrx ice_facet(string newFacet) { if(newFacet == null) { @@ -334,12 +354,17 @@ namespace Ice } } + public ObjectPrx ice_newFacet(string newFacet) + { + return ice_facet(newFacet); + } + public string ice_getAdapterId() { return _reference.getAdapterId(); } - public ObjectPrx ice_newAdapterId(string newAdapterId) + public ObjectPrx ice_adapterId(string newAdapterId) { if(newAdapterId == null) { @@ -358,12 +383,17 @@ namespace Ice } } + public ObjectPrx ice_newAdapterId(string newAdapterId) + { + return ice_adapterId(newAdapterId); + } + public Endpoint[] ice_getEndpoints() { return _reference.getEndpoints(); } - public ObjectPrx ice_newEndpoints(Endpoint[] newEndpoints) + public ObjectPrx ice_endpoints(Endpoint[] newEndpoints) { if(Arrays.Equals(newEndpoints, _reference.getEndpoints())) { @@ -379,6 +409,11 @@ namespace Ice } } + public ObjectPrx ice_newEndpoints(Endpoint[] newEndpoints) + { + return ice_endpoints(newEndpoints); + } + public int ice_getLocatorCacheTimeout() { return _reference.getLocatorCacheTimeout(); diff --git a/cs/test/Glacier2/router/Client.cs b/cs/test/Glacier2/router/Client.cs index be054d107c7..36f3513a30c 100644 --- a/cs/test/Glacier2/router/Client.cs +++ b/cs/test/Glacier2/router/Client.cs @@ -269,7 +269,7 @@ public class Client : Ice.Application Ice.Context context = new Ice.Context(); context["_fwd"] = "t"; CallbackPrx otherCategoryTwoway = CallbackPrxHelper.uncheckedCast( - twoway.ice_newIdentity(Ice.Util.stringToIdentity("c2/callback"))); + twoway.ice_identity(Ice.Util.stringToIdentity("c2/callback"))); otherCategoryTwoway.initiateCallback(twowayR, context); test(callbackReceiverImpl.callbackOK()); Console.Out.WriteLine("ok"); @@ -283,7 +283,7 @@ public class Client : Ice.Application try { CallbackPrx otherCategoryTwoway = CallbackPrxHelper.uncheckedCast( - twoway.ice_newIdentity(Ice.Util.stringToIdentity("c3/callback"))); + twoway.ice_identity(Ice.Util.stringToIdentity("c3/callback"))); otherCategoryTwoway.initiateCallback(twowayR, context); test(false); } @@ -299,7 +299,7 @@ public class Client : Ice.Application Ice.Context context = new Ice.Context(); context["_fwd"] = "t"; CallbackPrx otherCategoryTwoway = CallbackPrxHelper.uncheckedCast( - twoway.ice_newIdentity(Ice.Util.stringToIdentity("_userid/callback"))); + twoway.ice_identity(Ice.Util.stringToIdentity("_userid/callback"))); otherCategoryTwoway.initiateCallback(twowayR, context); test(callbackReceiverImpl.callbackOK()); Console.Out.WriteLine("ok"); @@ -333,7 +333,7 @@ public class Client : Ice.Application try { router.destroySession(); - test(false); + test(false); } catch(Ice.ConnectionLostException) { @@ -342,6 +342,7 @@ public class Client : Ice.Application { test(false); } + Console.Out.WriteLine("ok"); } diff --git a/cs/test/Ice/binding/AllTests.cs b/cs/test/Ice/binding/AllTests.cs index b480192a86e..d6ce873326f 100755 --- a/cs/test/Ice/binding/AllTests.cs +++ b/cs/test/Ice/binding/AllTests.cs @@ -87,7 +87,7 @@ public class AllTests endpoints.AddRange(ArrayList.Adapter(obj.ice_getEndpoints())); } return TestIntfPrxHelper.uncheckedCast( - obj.ice_newEndpoints((Ice.Endpoint[])endpoints.ToArray(typeof(Ice.Endpoint)))); + obj.ice_endpoints((Ice.Endpoint[])endpoints.ToArray(typeof(Ice.Endpoint)))); } private static void deactivate(RemoteCommunicatorPrx communicator, ArrayList adapters) diff --git a/cs/test/Ice/exceptions/AllTests.cs b/cs/test/Ice/exceptions/AllTests.cs index c3e50001ba7..b3cc4da1672 100755 --- a/cs/test/Ice/exceptions/AllTests.cs +++ b/cs/test/Ice/exceptions/AllTests.cs @@ -1043,7 +1043,7 @@ public class AllTests Ice.Identity id = Ice.Util.stringToIdentity("does not exist"); try { - ThrowerPrx thrower2 = ThrowerPrxHelper.uncheckedCast(thrower.ice_newIdentity(id)); + ThrowerPrx thrower2 = ThrowerPrxHelper.uncheckedCast(thrower.ice_identity(id)); thrower2.ice_ping(); test(false); } @@ -1251,7 +1251,7 @@ public class AllTests { Ice.Identity id = Ice.Util.stringToIdentity("does not exist"); - ThrowerPrx thrower2 = ThrowerPrxHelper.uncheckedCast(thrower.ice_newIdentity(id)); + ThrowerPrx thrower2 = ThrowerPrxHelper.uncheckedCast(thrower.ice_identity(id)); AMI_Thrower_throwAasAObjectNotExistI cb = new AMI_Thrower_throwAasAObjectNotExistI(); thrower2.throwAasA_async(cb, 1); test(cb.check()); diff --git a/cs/test/Ice/operations/Twoways.cs b/cs/test/Ice/operations/Twoways.cs index c87f613caef..b7032300a00 100755 --- a/cs/test/Ice/operations/Twoways.cs +++ b/cs/test/Ice/operations/Twoways.cs @@ -589,7 +589,7 @@ class Twoways test(r.Equals(ctx)); } { - Test.MyClassPrx p2 = Test.MyClassPrxHelper.checkedCast(p.ice_newContext(ctx)); + Test.MyClassPrx p2 = Test.MyClassPrxHelper.checkedCast(p.ice_context(ctx)); test(p2.ice_getContext().Equals(ctx)); Ice.Context r = p2.opContext(); test(r.Equals(ctx)); @@ -605,7 +605,7 @@ class Twoways communicator.setDefaultContext(dflt); test(!p.opContext().Equals(dflt)); - Test.MyClassPrx p2 = Test.MyClassPrxHelper.uncheckedCast(p.ice_newContext(new Ice.Context())); + Test.MyClassPrx p2 = Test.MyClassPrxHelper.uncheckedCast(p.ice_context(new Ice.Context())); test(p2.opContext().Count == 0); p2 = Test.MyClassPrxHelper.uncheckedCast(p.ice_defaultContext()); @@ -620,11 +620,11 @@ class Twoways test(c.opContext().Equals(dflt)); dflt["a"] = "c"; - Test.MyClassPrx c2 = Test.MyClassPrxHelper.uncheckedCast(c.ice_newContext(dflt)); + Test.MyClassPrx c2 = Test.MyClassPrxHelper.uncheckedCast(c.ice_context(dflt)); test(c2.opContext()["a"].Equals("c")); dflt.Clear(); - Test.MyClassPrx c3 = Test.MyClassPrxHelper.uncheckedCast(c2.ice_newContext(dflt)); + Test.MyClassPrx c3 = Test.MyClassPrxHelper.uncheckedCast(c2.ice_context(dflt)); test(c3.opContext()["a"] == null); Test.MyClassPrx c4 = Test.MyClassPrxHelper.uncheckedCast(c2.ice_defaultContext()); diff --git a/cs/test/Ice/operations/TwowaysAMI.cs b/cs/test/Ice/operations/TwowaysAMI.cs index b03562cc825..4823fc8377b 100755 --- a/cs/test/Ice/operations/TwowaysAMI.cs +++ b/cs/test/Ice/operations/TwowaysAMI.cs @@ -1270,7 +1270,7 @@ public class TwowaysAMI p.opContext_async(cb, ctx); test(cb.check()); } - Test.MyClassPrx p2 = Test.MyClassPrxHelper.checkedCast(p.ice_newContext(ctx)); + Test.MyClassPrx p2 = Test.MyClassPrxHelper.checkedCast(p.ice_context(ctx)); test(p2.ice_getContext().Equals(ctx)); { AMI_MyClass_opContextEqualI cb = new AMI_MyClass_opContextEqualI(ctx); @@ -1295,7 +1295,7 @@ public class TwowaysAMI test(cb.check()); } - p2 = Test.MyClassPrxHelper.uncheckedCast(p.ice_newContext(new Ice.Context())); + p2 = Test.MyClassPrxHelper.uncheckedCast(p.ice_context(new Ice.Context())); { AMI_MyClass_opContextEqualI cb = new AMI_MyClass_opContextEqualI(new Ice.Context()); p2.opContext_async(cb); @@ -1328,7 +1328,7 @@ public class TwowaysAMI } dflt["a"] = "c"; - Test.MyClassPrx c2 = Test.MyClassPrxHelper.uncheckedCast(c.ice_newContext(dflt)); + Test.MyClassPrx c2 = Test.MyClassPrxHelper.uncheckedCast(c.ice_context(dflt)); { Ice.Context tmp = new Ice.Context(); tmp["a"] = "c"; @@ -1338,7 +1338,7 @@ public class TwowaysAMI } dflt.Clear(); - Test.MyClassPrx c3 = Test.MyClassPrxHelper.uncheckedCast(c2.ice_newContext(dflt)); + Test.MyClassPrx c3 = Test.MyClassPrxHelper.uncheckedCast(c2.ice_context(dflt)); { Ice.Context tmp = new Ice.Context(); AMI_MyClass_opContextEqualI cb = new AMI_MyClass_opContextEqualI(tmp); diff --git a/java/demo/Glacier2/callback/Client.java b/java/demo/Glacier2/callback/Client.java index 13e841c11d3..95c261874d9 100644 --- a/java/demo/Glacier2/callback/Client.java +++ b/java/demo/Glacier2/callback/Client.java @@ -182,16 +182,16 @@ public class Client extends Ice.Application if(fake) { twowayR = CallbackReceiverPrxHelper.uncheckedCast( - twowayR.ice_newIdentity(callbackReceiverFakeIdent)); + twowayR.ice_identity(callbackReceiverFakeIdent)); onewayR = CallbackReceiverPrxHelper.uncheckedCast( - onewayR.ice_newIdentity(callbackReceiverFakeIdent)); + onewayR.ice_identity(callbackReceiverFakeIdent)); } else { twowayR = CallbackReceiverPrxHelper.uncheckedCast( - twowayR.ice_newIdentity(callbackReceiverIdent)); + twowayR.ice_identity(callbackReceiverIdent)); onewayR = CallbackReceiverPrxHelper.uncheckedCast( - onewayR.ice_newIdentity(callbackReceiverIdent)); + onewayR.ice_identity(callbackReceiverIdent)); } System.out.println("callback receiver identity: " + diff --git a/java/demo/Glacier2/callback/build.xml b/java/demo/Glacier2/callback/build.xml index cfd03a7829c..b036107e10d 100644 --- a/java/demo/Glacier2/callback/build.xml +++ b/java/demo/Glacier2/callback/build.xml @@ -40,11 +40,11 @@ <target name="compile" depends="generate"> <mkdir dir="${class.dir}"/> <javac srcdir="${generated.dir}" destdir="${class.dir}" - source="1.4" debug="${debug}"> + source="1.4" debug="${debug}" deprecation="on"> <classpath refid="ice.classpath"/> </javac> <javac srcdir="." destdir="${class.dir}" source="1.4" - excludes="generated/**" debug="${debug}"> + excludes="generated/**" debug="${debug}" deprecation="on"> <classpath refid="ice.classpath"/> </javac> </target> diff --git a/java/src/Freeze/EvictorI.java b/java/src/Freeze/EvictorI.java index f348b529031..5dd34d1b68a 100644 --- a/java/src/Freeze/EvictorI.java +++ b/java/src/Freeze/EvictorI.java @@ -574,7 +574,7 @@ class EvictorI extends Ice.LocalObjectImpl implements Evictor, Runnable Ice.ObjectPrx obj = _adapter.createProxy(ident); if(facet.length() > 0) { - obj = obj.ice_newFacet(facet); + obj = obj.ice_facet(facet); } return obj; } diff --git a/java/src/Ice/ObjectPrx.java b/java/src/Ice/ObjectPrx.java index 5a0ebb73edf..4bff057a10c 100644 --- a/java/src/Ice/ObjectPrx.java +++ b/java/src/Ice/ObjectPrx.java @@ -39,20 +39,40 @@ public interface ObjectPrx java.util.Map context); Identity ice_getIdentity(); + /** + * @deprecated This method has been replaced with ice_identity. + **/ ObjectPrx ice_newIdentity(Identity newIdentity); + ObjectPrx ice_identity(Identity newIdentity); java.util.Map ice_getContext(); + /** + * @deprecated This method has been replaced with ice_context. + **/ ObjectPrx ice_newContext(java.util.Map newContext); + ObjectPrx ice_context(java.util.Map newContext); ObjectPrx ice_defaultContext(); - String ice_getFacet(); + String ice_getFacet(); + /** + * @deprecated This method has been replaced with ice_facet. + **/ ObjectPrx ice_newFacet(String newFacet); + ObjectPrx ice_facet(String newFacet); String ice_getAdapterId(); + /** + * @deprecated This method has been replaced with ice_adapterId. + **/ ObjectPrx ice_newAdapterId(String newAdapterId); + ObjectPrx ice_adapterId(String newAdapterId); Endpoint[] ice_getEndpoints(); + /** + * @deprecated This method has been replaced with ice_endpoints. + **/ ObjectPrx ice_newEndpoints(Endpoint[] newEndpoints); + ObjectPrx ice_endpoints(Endpoint[] newEndpoints); int ice_getLocatorCacheTimeout(); ObjectPrx ice_locatorCacheTimeout(int newTimeout); diff --git a/java/src/Ice/ObjectPrxHelper.java b/java/src/Ice/ObjectPrxHelper.java index 9415979c90e..709e344cb90 100644 --- a/java/src/Ice/ObjectPrxHelper.java +++ b/java/src/Ice/ObjectPrxHelper.java @@ -29,7 +29,7 @@ public class ObjectPrxHelper extends ObjectPrxHelperBase ObjectPrx d = null; if(b != null) { - Ice.ObjectPrx bb = b.ice_newFacet(f); + Ice.ObjectPrx bb = b.ice_facet(f); try { boolean ok = bb.ice_isA("::Object"); @@ -51,7 +51,7 @@ public class ObjectPrxHelper extends ObjectPrxHelperBase ObjectPrx d = null; if(b != null) { - Ice.ObjectPrx bb = b.ice_newFacet(f); + Ice.ObjectPrx bb = b.ice_facet(f); try { boolean ok = bb.ice_isA("::Object", ctx); @@ -79,7 +79,7 @@ public class ObjectPrxHelper extends ObjectPrxHelperBase ObjectPrx d = null; if(b != null) { - Ice.ObjectPrx bb = b.ice_newFacet(f); + Ice.ObjectPrx bb = b.ice_facet(f); ObjectPrxHelper h = new ObjectPrxHelper(); h.__copyFrom(bb); d = h; diff --git a/java/src/Ice/ObjectPrxHelperBase.java b/java/src/Ice/ObjectPrxHelperBase.java index aafa0088ce4..16c9e769db9 100644 --- a/java/src/Ice/ObjectPrxHelperBase.java +++ b/java/src/Ice/ObjectPrxHelperBase.java @@ -212,7 +212,7 @@ public class ObjectPrxHelperBase implements ObjectPrx } public final ObjectPrx - ice_newIdentity(Identity newIdentity) + ice_identity(Identity newIdentity) { if(newIdentity.equals(_reference.getIdentity())) { @@ -226,6 +226,12 @@ public class ObjectPrxHelperBase implements ObjectPrx } } + public final ObjectPrx + ice_newIdentity(Identity newIdentity) + { + return ice_identity(newIdentity); + } + public final java.util.Map ice_getContext() { @@ -233,7 +239,7 @@ public class ObjectPrxHelperBase implements ObjectPrx } public final ObjectPrx - ice_newContext(java.util.Map newContext) + ice_context(java.util.Map newContext) { ObjectPrxHelperBase proxy = new ObjectPrxHelperBase(); proxy.setup(_reference.changeContext(newContext)); @@ -241,6 +247,12 @@ public class ObjectPrxHelperBase implements ObjectPrx } public final ObjectPrx + ice_newContext(java.util.Map newContext) + { + return ice_context(newContext); + } + + public final ObjectPrx ice_defaultContext() { ObjectPrxHelperBase proxy = new ObjectPrxHelperBase(); @@ -255,7 +267,7 @@ public class ObjectPrxHelperBase implements ObjectPrx } public final ObjectPrx - ice_newFacet(String newFacet) + ice_facet(String newFacet) { if(newFacet == null) { @@ -274,6 +286,12 @@ public class ObjectPrxHelperBase implements ObjectPrx } } + public final ObjectPrx + ice_newFacet(String newFacet) + { + return ice_facet(newFacet); + } + public final String ice_getAdapterId() { @@ -281,7 +299,7 @@ public class ObjectPrxHelperBase implements ObjectPrx } public final ObjectPrx - ice_newAdapterId(String newAdapterId) + ice_adapterId(String newAdapterId) { if(newAdapterId.equals(_reference.getAdapterId())) { @@ -295,6 +313,12 @@ public class ObjectPrxHelperBase implements ObjectPrx } } + public final ObjectPrx + ice_newAdapterId(String newAdapterId) + { + return ice_adapterId(newAdapterId); + } + public final Endpoint[] ice_getEndpoints() { @@ -302,7 +326,7 @@ public class ObjectPrxHelperBase implements ObjectPrx } public final ObjectPrx - ice_newEndpoints(Endpoint[] newEndpoints) + ice_endpoints(Endpoint[] newEndpoints) { if(java.util.Arrays.equals(newEndpoints, _reference.getEndpoints())) { @@ -318,6 +342,12 @@ public class ObjectPrxHelperBase implements ObjectPrx } } + public final ObjectPrx + ice_newEndpoints(Endpoint[] newEndpoints) + { + return ice_endpoints(newEndpoints); + } + public final int ice_getLocatorCacheTimeout() { diff --git a/java/test/Glacier2/router/CallbackClient.java b/java/test/Glacier2/router/CallbackClient.java index 29436dff17b..9794ce73a0f 100644 --- a/java/test/Glacier2/router/CallbackClient.java +++ b/java/test/Glacier2/router/CallbackClient.java @@ -283,7 +283,7 @@ class CallbackClient extends Ice.Application java.util.Map context = new java.util.HashMap(); context.put("_fwd", "t"); CallbackPrx otherCategoryTwoway = CallbackPrxHelper.uncheckedCast( - twoway.ice_newIdentity(Ice.Util.stringToIdentity("c2/callback"))); + twoway.ice_identity(Ice.Util.stringToIdentity("c2/callback"))); otherCategoryTwoway.initiateCallback(twowayR, context); test(callbackReceiverImpl.callbackOK()); System.out.println("ok"); @@ -297,7 +297,7 @@ class CallbackClient extends Ice.Application try { CallbackPrx otherCategoryTwoway = CallbackPrxHelper.uncheckedCast( - twoway.ice_newIdentity(Ice.Util.stringToIdentity("c3/callback"))); + twoway.ice_identity(Ice.Util.stringToIdentity("c3/callback"))); otherCategoryTwoway.initiateCallback(twowayR, context); test(false); } @@ -313,7 +313,7 @@ class CallbackClient extends Ice.Application java.util.Map context = new java.util.HashMap(); context.put("_fwd", "t"); CallbackPrx otherCategoryTwoway = CallbackPrxHelper.uncheckedCast( - twoway.ice_newIdentity(Ice.Util.stringToIdentity("_userid/callback"))); + twoway.ice_identity(Ice.Util.stringToIdentity("_userid/callback"))); otherCategoryTwoway.initiateCallback(twowayR, context); test(callbackReceiverImpl.callbackOK()); System.out.println("ok"); diff --git a/java/test/Ice/binding/AllTests.java b/java/test/Ice/binding/AllTests.java index f56d7dc7987..561153d5ebe 100644 --- a/java/test/Ice/binding/AllTests.java +++ b/java/test/Ice/binding/AllTests.java @@ -81,7 +81,7 @@ public class AllTests endpoints.addAll(java.util.Arrays.asList(edpts)); } return TestIntfPrxHelper.uncheckedCast( - test.ice_newEndpoints((Ice.Endpoint[])endpoints.toArray(new Ice.Endpoint[endpoints.size()]))); + test.ice_endpoints((Ice.Endpoint[])endpoints.toArray(new Ice.Endpoint[endpoints.size()]))); } private static void diff --git a/java/test/Ice/exceptions/AllTests.java b/java/test/Ice/exceptions/AllTests.java index f417accf701..4f483d6928f 100644 --- a/java/test/Ice/exceptions/AllTests.java +++ b/java/test/Ice/exceptions/AllTests.java @@ -1084,7 +1084,7 @@ public class AllTests Ice.Identity id = Ice.Util.stringToIdentity("does not exist"); try { - ThrowerPrx thrower2 = ThrowerPrxHelper.uncheckedCast(thrower.ice_newIdentity(id)); + ThrowerPrx thrower2 = ThrowerPrxHelper.uncheckedCast(thrower.ice_identity(id)); thrower2.ice_ping(); test(false); } @@ -1314,7 +1314,7 @@ public class AllTests { Ice.Identity id = Ice.Util.stringToIdentity("does not exist"); - ThrowerPrx thrower2 = ThrowerPrxHelper.uncheckedCast(thrower.ice_newIdentity(id)); + ThrowerPrx thrower2 = ThrowerPrxHelper.uncheckedCast(thrower.ice_identity(id)); AMI_Thrower_throwAasAObjectNotExistI cb = new AMI_Thrower_throwAasAObjectNotExistI(); thrower2.throwAasA_async(cb, 1); test(cb.check()); diff --git a/java/test/Ice/operations/Twoways.java b/java/test/Ice/operations/Twoways.java index f7e7b25b307..f46aedab62e 100644 --- a/java/test/Ice/operations/Twoways.java +++ b/java/test/Ice/operations/Twoways.java @@ -613,7 +613,7 @@ class Twoways test(r.equals(ctx)); } { - Test.MyClassPrx p2 = Test.MyClassPrxHelper.checkedCast(p.ice_newContext(ctx)); + Test.MyClassPrx p2 = Test.MyClassPrxHelper.checkedCast(p.ice_context(ctx)); test(p2.ice_getContext().equals(ctx)); java.util.Map r = p2.opContext(); test(r.equals(ctx)); @@ -629,7 +629,7 @@ class Twoways communicator.setDefaultContext(dflt); test(!p.opContext().equals(dflt)); - Test.MyClassPrx p2 = Test.MyClassPrxHelper.uncheckedCast(p.ice_newContext(new java.util.HashMap())); + Test.MyClassPrx p2 = Test.MyClassPrxHelper.uncheckedCast(p.ice_context(new java.util.HashMap())); test(p2.opContext().isEmpty()); p2 = Test.MyClassPrxHelper.uncheckedCast(p.ice_defaultContext()); @@ -644,11 +644,11 @@ class Twoways test(c.opContext().equals(dflt)); dflt.put("a", "c"); - Test.MyClassPrx c2 = Test.MyClassPrxHelper.uncheckedCast(c.ice_newContext(dflt)); + Test.MyClassPrx c2 = Test.MyClassPrxHelper.uncheckedCast(c.ice_context(dflt)); test(c2.opContext().get("a").equals("c")); dflt.clear(); - Test.MyClassPrx c3 = Test.MyClassPrxHelper.uncheckedCast(c2.ice_newContext(dflt)); + Test.MyClassPrx c3 = Test.MyClassPrxHelper.uncheckedCast(c2.ice_context(dflt)); test(c3.opContext().get("a") == null); Test.MyClassPrx c4 = Test.MyClassPrxHelper.uncheckedCast(c2.ice_defaultContext()); diff --git a/java/test/Ice/operations/TwowaysAMI.java b/java/test/Ice/operations/TwowaysAMI.java index e0496eea30b..71db5081182 100644 --- a/java/test/Ice/operations/TwowaysAMI.java +++ b/java/test/Ice/operations/TwowaysAMI.java @@ -1423,7 +1423,7 @@ class TwowaysAMI p.opContext_async(cb, ctx); test(cb.check()); } - Test.MyClassPrx p2 = Test.MyClassPrxHelper.checkedCast(p.ice_newContext(ctx)); + Test.MyClassPrx p2 = Test.MyClassPrxHelper.checkedCast(p.ice_context(ctx)); test(p2.ice_getContext().equals(ctx)); { AMI_MyClass_opContextEqualI cb = new AMI_MyClass_opContextEqualI(ctx); @@ -1449,7 +1449,7 @@ class TwowaysAMI test(cb.check()); } - p2 = Test.MyClassPrxHelper.uncheckedCast(p.ice_newContext(new java.util.HashMap())); + p2 = Test.MyClassPrxHelper.uncheckedCast(p.ice_context(new java.util.HashMap())); { AMI_MyClass_opContextEqualI cb = new AMI_MyClass_opContextEqualI(new java.util.HashMap()); p2.opContext_async(cb); @@ -1482,7 +1482,7 @@ class TwowaysAMI } dflt.put("a", "c"); - Test.MyClassPrx c2 = Test.MyClassPrxHelper.uncheckedCast(c.ice_newContext(dflt)); + Test.MyClassPrx c2 = Test.MyClassPrxHelper.uncheckedCast(c.ice_context(dflt)); { java.util.HashMap tmp = new java.util.HashMap(); tmp.put("a", "c"); @@ -1492,7 +1492,7 @@ class TwowaysAMI } dflt.clear(); - Test.MyClassPrx c3 = Test.MyClassPrxHelper.uncheckedCast(c2.ice_newContext(dflt)); + Test.MyClassPrx c3 = Test.MyClassPrxHelper.uncheckedCast(c2.ice_context(dflt)); { java.util.HashMap tmp = new java.util.HashMap(); AMI_MyClass_opContextEqualI cb = new AMI_MyClass_opContextEqualI(tmp); diff --git a/javae/src/Ice/Connection.java b/javae/src/Ice/Connection.java index 717dff0bf7e..b83d87c3080 100644 --- a/javae/src/Ice/Connection.java +++ b/javae/src/Ice/Connection.java @@ -273,31 +273,6 @@ public final class Connection } } - private final static byte[] _requestHdr = - { - IceInternal.Protocol.magic[0], - IceInternal.Protocol.magic[1], - IceInternal.Protocol.magic[2], - IceInternal.Protocol.magic[3], - IceInternal.Protocol.protocolMajor, - IceInternal.Protocol.protocolMinor, - IceInternal.Protocol.encodingMajor, - IceInternal.Protocol.encodingMinor, - IceInternal.Protocol.requestMsg, - (byte)0, // Compression status. - (byte)0, (byte)0, (byte)0, (byte)0, // Message size (placeholder). - (byte)0, (byte)0, (byte)0, (byte)0 // Request ID (placeholder). - }; - - // - // TODO: Should not be a member function of Connection. - // - public byte[] - getRequestHeader() - { - return _requestHdr; - } - public void sendRequest(IceInternal.BasicStream os, IceInternal.Outgoing out) throws IceInternal.LocalExceptionWrapper @@ -473,22 +448,6 @@ public final class Connection } } - private final static byte[] _requestBatchHdr = - { - IceInternal.Protocol.magic[0], - IceInternal.Protocol.magic[1], - IceInternal.Protocol.magic[2], - IceInternal.Protocol.magic[3], - IceInternal.Protocol.protocolMajor, - IceInternal.Protocol.protocolMinor, - IceInternal.Protocol.encodingMajor, - IceInternal.Protocol.encodingMinor, - IceInternal.Protocol.requestBatchMsg, - 0, // Compression status. - (byte)0, (byte)0, (byte)0, (byte)0, // Message size (placeholder). - (byte)0, (byte)0, (byte)0, (byte)0 // Number of requests in batch (placeholder). - }; - public synchronized void prepareBatchRequest(IceInternal.BasicStream os) { @@ -518,7 +477,7 @@ public final class Connection { try { - _batchStream.writeBlob(_requestBatchHdr); + _batchStream.writeBlob(IceInternal.Protocol.requestBatchHdr); } catch(LocalException ex) { @@ -1445,21 +1404,6 @@ public final class Connection } } - private final static byte[] _replyHdr = - { - IceInternal.Protocol.magic[0], - IceInternal.Protocol.magic[1], - IceInternal.Protocol.magic[2], - IceInternal.Protocol.magic[3], - IceInternal.Protocol.protocolMajor, - IceInternal.Protocol.protocolMinor, - IceInternal.Protocol.encodingMajor, - IceInternal.Protocol.encodingMinor, - IceInternal.Protocol.replyMsg, - (byte)0, // Compression status. - (byte)0, (byte)0, (byte)0, (byte)0 // Message size (placeholder). - }; - public void run() { @@ -1656,7 +1600,7 @@ public final class Connection // Add the reply header and request id. // IceInternal.BasicStream os = _in.os(); - os.writeBlob(_replyHdr); + os.writeBlob(IceInternal.Protocol.replyHdr); os.writeInt(info.requestId); } diff --git a/javae/src/Ice/ObjectPrx.java b/javae/src/Ice/ObjectPrx.java index c6add12099c..35ba450d268 100644 --- a/javae/src/Ice/ObjectPrx.java +++ b/javae/src/Ice/ObjectPrx.java @@ -30,14 +30,26 @@ public interface ObjectPrx String ice_id(java.util.Hashtable __context); Identity ice_getIdentity(); + /** + * @deprecated This method has been replaced with ice_identity. + **/ ObjectPrx ice_newIdentity(Identity newIdentity); + ObjectPrx ice_identity(Identity newIdentity); java.util.Hashtable ice_getContext(); + /** + * @deprecated This method has been replaced with ice_context. + **/ ObjectPrx ice_newContext(java.util.Hashtable newContext); + ObjectPrx ice_context(java.util.Hashtable newContext); ObjectPrx ice_defaultContext(); String ice_getFacet(); + /** + * @deprecated This method has been replaced with ice_facet. + **/ ObjectPrx ice_newFacet(String newFacet); + ObjectPrx ice_facet(String newFacet); ObjectPrx ice_twoway(); boolean ice_isTwoway(); diff --git a/javae/src/Ice/ObjectPrxHelper.java b/javae/src/Ice/ObjectPrxHelper.java index ce1209a3f56..2dfef4af660 100644 --- a/javae/src/Ice/ObjectPrxHelper.java +++ b/javae/src/Ice/ObjectPrxHelper.java @@ -29,7 +29,7 @@ public class ObjectPrxHelper extends ObjectPrxHelperBase ObjectPrx d = null; if(b != null) { - Ice.ObjectPrx bb = b.ice_newFacet(f); + Ice.ObjectPrx bb = b.ice_facet(f); try { boolean ok = bb.ice_isA("::Object"); @@ -54,7 +54,7 @@ public class ObjectPrxHelper extends ObjectPrxHelperBase ObjectPrx d = null; if(b != null) { - Ice.ObjectPrx bb = b.ice_newFacet(f); + Ice.ObjectPrx bb = b.ice_facet(f); try { boolean ok = bb.ice_isA("::Object", ctx); @@ -85,7 +85,7 @@ public class ObjectPrxHelper extends ObjectPrxHelperBase ObjectPrx d = null; if(b != null) { - Ice.ObjectPrx bb = b.ice_newFacet(f); + Ice.ObjectPrx bb = b.ice_facet(f); ObjectPrxHelper h = new ObjectPrxHelper(); h.__copyFrom(bb); d = h; diff --git a/javae/src/Ice/ObjectPrxHelperBase.java b/javae/src/Ice/ObjectPrxHelperBase.java index 9260c0b794e..179b32c63cd 100644 --- a/javae/src/Ice/ObjectPrxHelperBase.java +++ b/javae/src/Ice/ObjectPrxHelperBase.java @@ -286,7 +286,7 @@ public class ObjectPrxHelperBase implements ObjectPrx } public final ObjectPrx - ice_newIdentity(Identity newIdentity) + ice_identity(Identity newIdentity) { if(newIdentity.equals(_reference.getIdentity())) { @@ -300,6 +300,12 @@ public class ObjectPrxHelperBase implements ObjectPrx } } + public final ObjectPrx + ice_newIdentity(Identity newIdentity) + { + return ice_identity(newIdentity); + } + public final java.util.Hashtable ice_getContext() { @@ -307,7 +313,7 @@ public class ObjectPrxHelperBase implements ObjectPrx } public final ObjectPrx - ice_newContext(java.util.Hashtable newContext) + ice_context(java.util.Hashtable newContext) { ObjectPrxHelperBase proxy = new ObjectPrxHelperBase(); proxy.setup(_reference.changeContext(newContext)); @@ -315,6 +321,12 @@ public class ObjectPrxHelperBase implements ObjectPrx } public final ObjectPrx + ice_newContext(java.util.Hashtable newContext) + { + return ice_context(newContext); + } + + public final ObjectPrx ice_defaultContext() { ObjectPrxHelperBase proxy = new ObjectPrxHelperBase(); @@ -329,7 +341,7 @@ public class ObjectPrxHelperBase implements ObjectPrx } public final ObjectPrx - ice_newFacet(String newFacet) + ice_facet(String newFacet) { if(newFacet == null) { @@ -349,6 +361,12 @@ public class ObjectPrxHelperBase implements ObjectPrx } public final ObjectPrx + ice_newFacet(String newFacet) + { + return ice_facet(newFacet); + } + + public final ObjectPrx ice_twoway() { IceInternal.Reference ref = _reference.changeMode(IceInternal.Reference.ModeTwoway); diff --git a/javae/src/IceInternal/Outgoing.java b/javae/src/IceInternal/Outgoing.java index a7fc057c24c..aa2ae639a09 100644 --- a/javae/src/IceInternal/Outgoing.java +++ b/javae/src/IceInternal/Outgoing.java @@ -371,7 +371,7 @@ public final class Outgoing case Reference.ModeTwoway: case Reference.ModeOneway: { - _stream.writeBlob(_connection.getRequestHeader()); + _stream.writeBlob(Protocol.requestHdr); break; } diff --git a/javae/src/IceInternal/Protocol.java b/javae/src/IceInternal/Protocol.java index 26fb4522712..cfba31f62e4 100644 --- a/javae/src/IceInternal/Protocol.java +++ b/javae/src/IceInternal/Protocol.java @@ -46,4 +46,52 @@ final public class Protocol public final static byte replyMsg = 2; public final static byte validateConnectionMsg = 3; public final static byte closeConnectionMsg = 4; + + public final static byte[] requestHdr = + { + IceInternal.Protocol.magic[0], + IceInternal.Protocol.magic[1], + IceInternal.Protocol.magic[2], + IceInternal.Protocol.magic[3], + IceInternal.Protocol.protocolMajor, + IceInternal.Protocol.protocolMinor, + IceInternal.Protocol.encodingMajor, + IceInternal.Protocol.encodingMinor, + IceInternal.Protocol.requestMsg, + (byte)0, // Compression status. + (byte)0, (byte)0, (byte)0, (byte)0, // Message size (placeholder). + (byte)0, (byte)0, (byte)0, (byte)0 // Request ID (placeholder). + }; + + public final static byte[] requestBatchHdr = + { + IceInternal.Protocol.magic[0], + IceInternal.Protocol.magic[1], + IceInternal.Protocol.magic[2], + IceInternal.Protocol.magic[3], + IceInternal.Protocol.protocolMajor, + IceInternal.Protocol.protocolMinor, + IceInternal.Protocol.encodingMajor, + IceInternal.Protocol.encodingMinor, + IceInternal.Protocol.requestBatchMsg, + 0, // Compression status. + (byte)0, (byte)0, (byte)0, (byte)0, // Message size (placeholder). + (byte)0, (byte)0, (byte)0, (byte)0 // Number of requests in batch (placeholder). + }; + + public final static byte[] replyHdr = + { + IceInternal.Protocol.magic[0], + IceInternal.Protocol.magic[1], + IceInternal.Protocol.magic[2], + IceInternal.Protocol.magic[3], + IceInternal.Protocol.protocolMajor, + IceInternal.Protocol.protocolMinor, + IceInternal.Protocol.encodingMajor, + IceInternal.Protocol.encodingMinor, + IceInternal.Protocol.replyMsg, + (byte)0, // Compression status. + (byte)0, (byte)0, (byte)0, (byte)0 // Message size (placeholder). + }; + } diff --git a/javae/test/IceE/exceptions/AllTests.java b/javae/test/IceE/exceptions/AllTests.java index 60e085e47a5..31f703a070d 100644 --- a/javae/test/IceE/exceptions/AllTests.java +++ b/javae/test/IceE/exceptions/AllTests.java @@ -375,7 +375,7 @@ public class AllTests Ice.Identity id = Ice.Util.stringToIdentity("does not exist"); try { - ThrowerPrx thrower2 = ThrowerPrxHelper.uncheckedCast(thrower.ice_newIdentity(id)); + ThrowerPrx thrower2 = ThrowerPrxHelper.uncheckedCast(thrower.ice_identity(id)); thrower2.ice_ping(); test(false); } diff --git a/javae/test/IceE/operations/Twoways.java b/javae/test/IceE/operations/Twoways.java index 019eee40401..2c830a0ab3e 100644 --- a/javae/test/IceE/operations/Twoways.java +++ b/javae/test/IceE/operations/Twoways.java @@ -612,7 +612,7 @@ class Twoways test(IceUtil.Hashtable.equals(r, ctx)); } { - Test.MyClassPrx p2 = Test.MyClassPrxHelper.checkedCast(p.ice_newContext(ctx)); + Test.MyClassPrx p2 = Test.MyClassPrxHelper.checkedCast(p.ice_context(ctx)); test(IceUtil.Hashtable.equals(p2.ice_getContext(), ctx)); java.util.Hashtable r = p2.opContext(); test(IceUtil.Hashtable.equals(r, ctx)); @@ -628,7 +628,7 @@ class Twoways communicator.setDefaultContext(dflt); test(!IceUtil.Hashtable.equals(p.opContext(), dflt)); - Test.MyClassPrx p2 = Test.MyClassPrxHelper.uncheckedCast(p.ice_newContext(new java.util.Hashtable())); + Test.MyClassPrx p2 = Test.MyClassPrxHelper.uncheckedCast(p.ice_context(new java.util.Hashtable())); test(p2.opContext().isEmpty()); p2 = Test.MyClassPrxHelper.uncheckedCast(p.ice_defaultContext()); @@ -644,11 +644,11 @@ class Twoways test(IceUtil.Hashtable.equals(c.opContext(), dflt)); dflt.put("a", "c"); - Test.MyClassPrx c2 = Test.MyClassPrxHelper.uncheckedCast(c.ice_newContext(dflt)); + Test.MyClassPrx c2 = Test.MyClassPrxHelper.uncheckedCast(c.ice_context(dflt)); test(c2.opContext().get("a").equals("c")); dflt.clear(); - Test.MyClassPrx c3 = Test.MyClassPrxHelper.uncheckedCast(c2.ice_newContext(dflt)); + Test.MyClassPrx c3 = Test.MyClassPrxHelper.uncheckedCast(c2.ice_context(dflt)); test(c3.opContext().get("a") == null); Test.MyClassPrx c4 = Test.MyClassPrxHelper.uncheckedCast(c2.ice_defaultContext()); diff --git a/php/src/ice/ice_proxy.h b/php/src/ice/ice_proxy.h index 0aef8a16d18..fd0015b7cf0 100644 --- a/php/src/ice/ice_proxy.h +++ b/php/src/ice/ice_proxy.h @@ -26,16 +26,16 @@ ZEND_FUNCTION(Ice_ObjectPrx_ice_ping); ZEND_FUNCTION(Ice_ObjectPrx_ice_id); ZEND_FUNCTION(Ice_ObjectPrx_ice_ids); ZEND_FUNCTION(Ice_ObjectPrx_ice_getIdentity); -ZEND_FUNCTION(Ice_ObjectPrx_ice_newIdentity); +ZEND_FUNCTION(Ice_ObjectPrx_ice_identity); ZEND_FUNCTION(Ice_ObjectPrx_ice_getContext); -ZEND_FUNCTION(Ice_ObjectPrx_ice_newContext); +ZEND_FUNCTION(Ice_ObjectPrx_ice_context); ZEND_FUNCTION(Ice_ObjectPrx_ice_defaultContext); ZEND_FUNCTION(Ice_ObjectPrx_ice_getFacet); -ZEND_FUNCTION(Ice_ObjectPrx_ice_newFacet); +ZEND_FUNCTION(Ice_ObjectPrx_ice_facet); ZEND_FUNCTION(Ice_ObjectPrx_ice_getAdapterId); -ZEND_FUNCTION(Ice_ObjectPrx_ice_newAdapterId); +ZEND_FUNCTION(Ice_ObjectPrx_ice_adapterId); ZEND_FUNCTION(Ice_ObjectPrx_ice_getEndpoints); -ZEND_FUNCTION(Ice_ObjectPrx_ice_newEndpoints); +ZEND_FUNCTION(Ice_ObjectPrx_ice_endpoints); ZEND_FUNCTION(Ice_ObjectPrx_ice_getLocatorCacheTimeout); ZEND_FUNCTION(Ice_ObjectPrx_ice_locatorCacheTimeout); ZEND_FUNCTION(Ice_ObjectPrx_ice_getCacheConnection); @@ -83,16 +83,16 @@ ZEND_FUNCTION(Ice_Connection_toString); ZEND_FE(Ice_ObjectPrx_ice_id, NULL) \ ZEND_FE(Ice_ObjectPrx_ice_ids, NULL) \ ZEND_FE(Ice_ObjectPrx_ice_getIdentity, NULL) \ - ZEND_FE(Ice_ObjectPrx_ice_newIdentity, NULL) \ + ZEND_FE(Ice_ObjectPrx_ice_identity, NULL) \ ZEND_FE(Ice_ObjectPrx_ice_getAdapterId, NULL) \ - ZEND_FE(Ice_ObjectPrx_ice_newAdapterId, NULL) \ + ZEND_FE(Ice_ObjectPrx_ice_adapterId, NULL) \ ZEND_FE(Ice_ObjectPrx_ice_getEndpoints, NULL) \ - ZEND_FE(Ice_ObjectPrx_ice_newEndpoints, NULL) \ + ZEND_FE(Ice_ObjectPrx_ice_endpoints, NULL) \ ZEND_FE(Ice_ObjectPrx_ice_getContext, NULL) \ - ZEND_FE(Ice_ObjectPrx_ice_newContext, NULL) \ + ZEND_FE(Ice_ObjectPrx_ice_context, NULL) \ ZEND_FE(Ice_ObjectPrx_ice_defaultContext, NULL) \ ZEND_FE(Ice_ObjectPrx_ice_getFacet, NULL) \ - ZEND_FE(Ice_ObjectPrx_ice_newFacet, NULL) \ + ZEND_FE(Ice_ObjectPrx_ice_facet, NULL) \ ZEND_FE(Ice_ObjectPrx_ice_twoway, NULL) \ ZEND_FE(Ice_ObjectPrx_ice_isTwoway, NULL) \ ZEND_FE(Ice_ObjectPrx_ice_oneway, NULL) \ diff --git a/php/src/ice/proxy.cpp b/php/src/ice/proxy.cpp index ed4969696c4..615e1d2735c 100644 --- a/php/src/ice/proxy.cpp +++ b/php/src/ice/proxy.cpp @@ -165,16 +165,21 @@ static function_entry _proxyMethods[] = {"ice_id", PHP_FN(Ice_ObjectPrx_ice_id), NULL}, {"ice_ids", PHP_FN(Ice_ObjectPrx_ice_ids), NULL}, {"ice_getIdentity", PHP_FN(Ice_ObjectPrx_ice_getIdentity), NULL}, - {"ice_newIdentity", PHP_FN(Ice_ObjectPrx_ice_newIdentity), NULL}, + {"ice_newIdentity", PHP_FN(Ice_ObjectPrx_ice_identity), NULL}, + {"ice_identity", PHP_FN(Ice_ObjectPrx_ice_identity), NULL}, {"ice_getContext", PHP_FN(Ice_ObjectPrx_ice_getContext), NULL}, - {"ice_newContext", PHP_FN(Ice_ObjectPrx_ice_newContext), NULL}, + {"ice_newContext", PHP_FN(Ice_ObjectPrx_ice_context), NULL}, + {"ice_context", PHP_FN(Ice_ObjectPrx_ice_context), NULL}, {"ice_defaultContext", PHP_FN(Ice_ObjectPrx_ice_defaultContext), NULL}, {"ice_getFacet", PHP_FN(Ice_ObjectPrx_ice_getFacet), NULL}, - {"ice_newFacet", PHP_FN(Ice_ObjectPrx_ice_newFacet), NULL}, + {"ice_newFacet", PHP_FN(Ice_ObjectPrx_ice_facet), NULL}, + {"ice_facet", PHP_FN(Ice_ObjectPrx_ice_facet), NULL}, {"ice_getAdapterId", PHP_FN(Ice_ObjectPrx_ice_getAdapterId), NULL}, - {"ice_newAdapterId", PHP_FN(Ice_ObjectPrx_ice_newAdapterId), NULL}, + {"ice_newAdapterId", PHP_FN(Ice_ObjectPrx_ice_adapterId), NULL}, + {"ice_adapterId", PHP_FN(Ice_ObjectPrx_ice_adapterId), NULL}, {"ice_getEndpoints", PHP_FN(Ice_ObjectPrx_ice_getEndpoints), NULL}, - {"ice_newEndpoints", PHP_FN(Ice_ObjectPrx_ice_newEndpoints), NULL}, + {"ice_newEndpoints", PHP_FN(Ice_ObjectPrx_ice_endpoints), NULL}, + {"ice_endpoints", PHP_FN(Ice_ObjectPrx_ice_endpoints), NULL}, {"ice_getLocatorCacheTimeout", PHP_FN(Ice_ObjectPrx_ice_getLocatorCacheTimeout), NULL}, {"ice_locatorCacheTimeout", PHP_FN(Ice_ObjectPrx_ice_locatorCacheTimeout), NULL}, {"ice_getCacheConnection", PHP_FN(Ice_ObjectPrx_ice_getCacheConnection), NULL}, @@ -617,7 +622,7 @@ ZEND_FUNCTION(Ice_ObjectPrx_ice_getIdentity) createIdentity(return_value, _this->getProxy()->ice_getIdentity() TSRMLS_CC); } -ZEND_FUNCTION(Ice_ObjectPrx_ice_newIdentity) +ZEND_FUNCTION(Ice_ObjectPrx_ice_identity) { if(ZEND_NUM_ARGS() != 1) { @@ -643,7 +648,7 @@ ZEND_FUNCTION(Ice_ObjectPrx_ice_newIdentity) { try { - Ice::ObjectPrx prx = _this->getProxy()->ice_newIdentity(id); + Ice::ObjectPrx prx = _this->getProxy()->ice_identity(id); if(!createProxy(return_value, prx TSRMLS_CC)) { RETURN_NULL(); @@ -671,7 +676,7 @@ ZEND_FUNCTION(Ice_ObjectPrx_ice_getContext) createContext(return_value, _this->getProxy()->ice_getContext() TSRMLS_CC); } -ZEND_FUNCTION(Ice_ObjectPrx_ice_newContext) +ZEND_FUNCTION(Ice_ObjectPrx_ice_context) { if(ZEND_NUM_ARGS() != 1) { @@ -700,7 +705,7 @@ ZEND_FUNCTION(Ice_ObjectPrx_ice_newContext) try { - Ice::ObjectPrx prx = _this->getProxy()->ice_newContext(ctx); + Ice::ObjectPrx prx = _this->getProxy()->ice_context(ctx); if(!createProxy(return_value, prx TSRMLS_CC)) { RETURN_NULL(); @@ -762,7 +767,7 @@ ZEND_FUNCTION(Ice_ObjectPrx_ice_getFacet) } } -ZEND_FUNCTION(Ice_ObjectPrx_ice_newFacet) +ZEND_FUNCTION(Ice_ObjectPrx_ice_facet) { if(ZEND_NUM_ARGS() != 1) { @@ -783,7 +788,7 @@ ZEND_FUNCTION(Ice_ObjectPrx_ice_newFacet) try { - Ice::ObjectPrx prx = _this->getProxy()->ice_newFacet(name); + Ice::ObjectPrx prx = _this->getProxy()->ice_facet(name); if(!createProxy(return_value, prx TSRMLS_CC)) { RETURN_NULL(); @@ -819,7 +824,7 @@ ZEND_FUNCTION(Ice_ObjectPrx_ice_getAdapterId) } } -ZEND_FUNCTION(Ice_ObjectPrx_ice_newAdapterId) +ZEND_FUNCTION(Ice_ObjectPrx_ice_adapterId) { if(ZEND_NUM_ARGS() != 1) { @@ -840,7 +845,7 @@ ZEND_FUNCTION(Ice_ObjectPrx_ice_newAdapterId) try { - Ice::ObjectPrx prx = _this->getProxy()->ice_newAdapterId(id); + Ice::ObjectPrx prx = _this->getProxy()->ice_adapterId(id); if(!createProxy(return_value, prx TSRMLS_CC)) { RETURN_NULL(); @@ -889,7 +894,7 @@ ZEND_FUNCTION(Ice_ObjectPrx_ice_getEndpoints) } } -ZEND_FUNCTION(Ice_ObjectPrx_ice_newEndpoints) +ZEND_FUNCTION(Ice_ObjectPrx_ice_endpoints) { if(ZEND_NUM_ARGS() != 1) { @@ -935,7 +940,7 @@ ZEND_FUNCTION(Ice_ObjectPrx_ice_newEndpoints) try { - Ice::ObjectPrx prx = _this->getProxy()->ice_newEndpoints(seq); + Ice::ObjectPrx prx = _this->getProxy()->ice_endpoints(seq); if(!createProxy(return_value, prx TSRMLS_CC)) { RETURN_NULL(); @@ -1607,7 +1612,7 @@ do_cast(INTERNAL_FUNCTION_PARAMETERS, bool check) Ice::ObjectPrx prx = _this->getProxy(); if(facet) { - prx = prx->ice_newFacet(facet); + prx = prx->ice_facet(facet); } if(check) diff --git a/php/test/Ice/binding/Client.php b/php/test/Ice/binding/Client.php index fff873d192b..6dc0499d357 100644 --- a/php/test/Ice/binding/Client.php +++ b/php/test/Ice/binding/Client.php @@ -34,7 +34,7 @@ function createTestIntfPrx($adapters) $endpoints[] = $e; } } - $test = $test->ice_newEndpoints($endpoints); + $test = $test->ice_endpoints($endpoints); return $test->ice_uncheckedCast("::Test::TestIntf"); } diff --git a/php/test/Ice/exceptions/Client.php b/php/test/Ice/exceptions/Client.php index 89355953d25..56128feac85 100644 --- a/php/test/Ice/exceptions/Client.php +++ b/php/test/Ice/exceptions/Client.php @@ -204,7 +204,7 @@ function allTests() $id = Ice_stringToIdentity("does not exist"); try { - $thrower2 = $thrower->ice_newIdentity($id)->ice_uncheckedCast("::Test::Thrower"); + $thrower2 = $thrower->ice_identity($id)->ice_uncheckedCast("::Test::Thrower"); $thrower2->throwAasA(1); test(false); } diff --git a/php/test/Ice/operations/Client.php b/php/test/Ice/operations/Client.php index f2c35a9af15..b4e1ec0c36a 100644 --- a/php/test/Ice/operations/Client.php +++ b/php/test/Ice/operations/Client.php @@ -395,7 +395,7 @@ function twoways($communicator, $p) test($r == $ctx); } { - $p2 = $p->ice_newContext($ctx)->ice_checkedCast("::Test::MyClass"); + $p2 = $p->ice_context($ctx)->ice_checkedCast("::Test::MyClass"); test($p2->ice_getContext() == $ctx); $r = $p2->opContext(); test($r == $ctx); @@ -410,7 +410,7 @@ function twoways($communicator, $p) $communicator->setDefaultContext($dflt); test($p->opContext() != $dflt); - $p2 = $p->ice_newContext(array())->ice_uncheckedCast("::Test::MyClass"); + $p2 = $p->ice_context(array())->ice_uncheckedCast("::Test::MyClass"); test(count($p2->opContext()) == 0); $p2 = $p->ice_defaultContext()->ice_uncheckedCast("::Test::MyClass"); @@ -424,12 +424,12 @@ function twoways($communicator, $p) test($c->opContext() == $dflt); $dflt["a"] = "c"; - $c2 = $c->ice_newContext($dflt)->ice_uncheckedCast("::Test::MyClass"); + $c2 = $c->ice_context($dflt)->ice_uncheckedCast("::Test::MyClass"); $tmp = $c2->opContext(); test($tmp["a"] == "c"); $dflt = array(); - $c3 = $c2->ice_newContext($dflt)->ice_uncheckedCast("::Test::MyClass"); + $c3 = $c2->ice_context($dflt)->ice_uncheckedCast("::Test::MyClass"); $tmp = $c3->opContext(); test(!isset($tmp["a"])); diff --git a/py/modules/IcePy/Proxy.cpp b/py/modules/IcePy/Proxy.cpp index d6f1a20d305..213b8534a2d 100644 --- a/py/modules/IcePy/Proxy.cpp +++ b/py/modules/IcePy/Proxy.cpp @@ -392,7 +392,7 @@ proxyIceGetIdentity(ProxyObject* self) extern "C" #endif static PyObject* -proxyIceNewIdentity(ProxyObject* self, PyObject* args) +proxyIceIdentity(ProxyObject* self, PyObject* args) { PyObject* identityType = lookupType("Ice.Identity"); assert(identityType); @@ -413,7 +413,7 @@ proxyIceNewIdentity(ProxyObject* self, PyObject* args) Ice::ObjectPrx newProxy; try { - newProxy = (*self->proxy)->ice_newIdentity(ident); + newProxy = (*self->proxy)->ice_identity(ident); } catch(const Ice::Exception& ex) { @@ -428,6 +428,16 @@ proxyIceNewIdentity(ProxyObject* self, PyObject* args) extern "C" #endif static PyObject* +proxyIceNewIdentity(ProxyObject* self, PyObject* args) +{ + PyErr_Warn(PyExc_DeprecationWarning, STRCAST("ice_newIdentity is deprecated, use ice_identity instead.")); + return proxyIceIdentity(self, args); +} + +#ifdef WIN32 +extern "C" +#endif +static PyObject* proxyIceGetContext(ProxyObject* self) { assert(self->proxy); @@ -455,7 +465,7 @@ proxyIceGetContext(ProxyObject* self) extern "C" #endif static PyObject* -proxyIceNewContext(ProxyObject* self, PyObject* args) +proxyIceContext(ProxyObject* self, PyObject* args) { PyObject* dict; if(!PyArg_ParseTuple(args, STRCAST("O!"), &PyDict_Type, &dict)) @@ -474,7 +484,7 @@ proxyIceNewContext(ProxyObject* self, PyObject* args) Ice::ObjectPrx newProxy; try { - newProxy = (*self->proxy)->ice_newContext(ctx); + newProxy = (*self->proxy)->ice_context(ctx); } catch(const Ice::Exception& ex) { @@ -489,6 +499,16 @@ proxyIceNewContext(ProxyObject* self, PyObject* args) extern "C" #endif static PyObject* +proxyIceNewContext(ProxyObject* self, PyObject* args) +{ + PyErr_Warn(PyExc_DeprecationWarning, STRCAST("ice_newContext is deprecated, use ice_context instead.")); + return proxyIceContext(self, args); +} + +#ifdef WIN32 +extern "C" +#endif +static PyObject* proxyIceDefaultContext(ProxyObject* self) { assert(self->proxy); @@ -533,7 +553,7 @@ proxyIceGetFacet(ProxyObject* self) extern "C" #endif static PyObject* -proxyIceNewFacet(ProxyObject* self, PyObject* args) +proxyIceFacet(ProxyObject* self, PyObject* args) { char* facet; if(!PyArg_ParseTuple(args, STRCAST("s"), &facet)) @@ -546,7 +566,7 @@ proxyIceNewFacet(ProxyObject* self, PyObject* args) Ice::ObjectPrx newProxy; try { - newProxy = (*self->proxy)->ice_newFacet(facet); + newProxy = (*self->proxy)->ice_facet(facet); } catch(const Ice::Exception& ex) { @@ -561,6 +581,16 @@ proxyIceNewFacet(ProxyObject* self, PyObject* args) extern "C" #endif static PyObject* +proxyIceNewFacet(ProxyObject* self, PyObject* args) +{ + PyErr_Warn(PyExc_DeprecationWarning, STRCAST("ice_newFacet is deprecated, use ice_facet instead.")); + return proxyIceFacet(self, args); +} + +#ifdef WIN32 +extern "C" +#endif +static PyObject* proxyIceGetAdapterId(ProxyObject* self) { string str = (*self->proxy)->ice_getAdapterId(); @@ -571,7 +601,7 @@ proxyIceGetAdapterId(ProxyObject* self) extern "C" #endif static PyObject* -proxyIceNewAdapterId(ProxyObject* self, PyObject* args) +proxyIceAdapterId(ProxyObject* self, PyObject* args) { char* id; if(!PyArg_ParseTuple(args, STRCAST("s"), &id)) @@ -584,7 +614,7 @@ proxyIceNewAdapterId(ProxyObject* self, PyObject* args) Ice::ObjectPrx newProxy; try { - newProxy = (*self->proxy)->ice_newAdapterId(id); + newProxy = (*self->proxy)->ice_adapterId(id); } catch(const Ice::Exception& ex) { @@ -599,6 +629,16 @@ proxyIceNewAdapterId(ProxyObject* self, PyObject* args) extern "C" #endif static PyObject* +proxyIceNewAdapterId(ProxyObject* self, PyObject* args) +{ + PyErr_Warn(PyExc_DeprecationWarning, STRCAST("ice_newAdapterId is deprecated, use ice_adapterId instead.")); + return proxyIceAdapterId(self, args); +} + +#ifdef WIN32 +extern "C" +#endif +static PyObject* proxyIceGetEndpoints(ProxyObject* self) { Ice::EndpointSeq endpoints = (*self->proxy)->ice_getEndpoints(); @@ -622,7 +662,7 @@ proxyIceGetEndpoints(ProxyObject* self) extern "C" #endif static PyObject* -proxyIceNewEndpoints(ProxyObject* self, PyObject* args) +proxyIceEndpoints(ProxyObject* self, PyObject* args) { PyObject* endpoints; if(!PyArg_ParseTuple(args, STRCAST("O"), &endpoints)) @@ -656,7 +696,7 @@ proxyIceNewEndpoints(ProxyObject* self, PyObject* args) Ice::ObjectPrx newProxy; try { - newProxy = (*self->proxy)->ice_newEndpoints(seq); + newProxy = (*self->proxy)->ice_endpoints(seq); } catch(const Ice::Exception& ex) { @@ -671,6 +711,16 @@ proxyIceNewEndpoints(ProxyObject* self, PyObject* args) extern "C" #endif static PyObject* +proxyIceNewEndpoints(ProxyObject* self, PyObject* args) +{ + PyErr_Warn(PyExc_DeprecationWarning, STRCAST("ice_newEndpoints is deprecated, use ice_endpoints instead.")); + return proxyIceEndpoints(self, args); +} + +#ifdef WIN32 +extern "C" +#endif +static PyObject* proxyIceGetLocatorCacheTimeout(ProxyObject* self) { try @@ -1327,7 +1377,7 @@ checkedCastImpl(ProxyObject* p, const string& id, const string& facet, PyObject* } else { - target = (*p->proxy)->ice_newFacet(facet); + target = (*p->proxy)->ice_facet(facet); } bool b; @@ -1361,7 +1411,7 @@ checkedCastImpl(ProxyObject* p, const string& id, const string& facet, const Ice } else { - target = (*p->proxy)->ice_newFacet(facet); + target = (*p->proxy)->ice_facet(facet); } bool b; @@ -1488,7 +1538,7 @@ proxyIceUncheckedCast(PyObject* type, PyObject* args) if(strlen(facet) > 0) { - return createProxy((*p->proxy)->ice_newFacet(facet), *p->communicator, type); + return createProxy((*p->proxy)->ice_facet(facet), *p->communicator, type); } else { @@ -1616,7 +1666,7 @@ proxyUncheckedCast(PyObject* /*self*/, PyObject* args) if(facet && strlen(facet) > 0) { - return createProxy((*p->proxy)->ice_newFacet(facet), *p->communicator, NULL); + return createProxy((*p->proxy)->ice_facet(facet), *p->communicator, NULL); } else { @@ -1648,25 +1698,35 @@ static PyMethodDef ProxyMethods[] = { STRCAST("ice_getIdentity"), (PyCFunction)proxyIceGetIdentity, METH_NOARGS, PyDoc_STR(STRCAST("ice_getIdentity() -> Ice.Identity")) }, { STRCAST("ice_newIdentity"), (PyCFunction)proxyIceNewIdentity, METH_VARARGS, - PyDoc_STR(STRCAST("ice_newIdentity(id) -> Ice.ObjectPrx")) }, + PyDoc_STR(STRCAST("ice_newIdentity(id) -> Ice.ObjectPrx")) }, // Deprecated + { STRCAST("ice_identity"), (PyCFunction)proxyIceIdentity, METH_VARARGS, + PyDoc_STR(STRCAST("ice_identity(id) -> Ice.ObjectPrx")) }, { STRCAST("ice_getContext"), (PyCFunction)proxyIceGetContext, METH_NOARGS, PyDoc_STR(STRCAST("ice_getContext() -> dict")) }, { STRCAST("ice_newContext"), (PyCFunction)proxyIceNewContext, METH_VARARGS, - PyDoc_STR(STRCAST("ice_newContext(dict) -> Ice.ObjectPrx")) }, + PyDoc_STR(STRCAST("ice_newContext(dict) -> Ice.ObjectPrx")) }, // Deprecated + { STRCAST("ice_context"), (PyCFunction)proxyIceContext, METH_VARARGS, + PyDoc_STR(STRCAST("ice_context(dict) -> Ice.ObjectPrx")) }, { STRCAST("ice_defaultContext"), (PyCFunction)proxyIceDefaultContext, METH_NOARGS, PyDoc_STR(STRCAST("ice_defaultContext() -> Ice.ObjectPrx")) }, { STRCAST("ice_getFacet"), (PyCFunction)proxyIceGetFacet, METH_NOARGS, PyDoc_STR(STRCAST("ice_getFacet() -> string")) }, { STRCAST("ice_newFacet"), (PyCFunction)proxyIceNewFacet, METH_VARARGS, - PyDoc_STR(STRCAST("ice_newFacet(string) -> Ice.ObjectPrx")) }, + PyDoc_STR(STRCAST("ice_newFacet(string) -> Ice.ObjectPrx")) }, // Deprecated + { STRCAST("ice_facet"), (PyCFunction)proxyIceFacet, METH_VARARGS, + PyDoc_STR(STRCAST("ice_facet(string) -> Ice.ObjectPrx")) }, { STRCAST("ice_getAdapterId"), (PyCFunction)proxyIceGetAdapterId, METH_NOARGS, PyDoc_STR(STRCAST("ice_getAdapterId() -> string")) }, { STRCAST("ice_newAdapterId"), (PyCFunction)proxyIceNewAdapterId, METH_VARARGS, - PyDoc_STR(STRCAST("ice_newAdapterId(string) -> proxy")) }, + PyDoc_STR(STRCAST("ice_newAdapterId(string) -> proxy")) }, // Deprecated + { STRCAST("ice_adapterId"), (PyCFunction)proxyIceAdapterId, METH_VARARGS, + PyDoc_STR(STRCAST("ice_adapterId(string) -> proxy")) }, { STRCAST("ice_getEndpoints"), (PyCFunction)proxyIceGetEndpoints, METH_NOARGS, PyDoc_STR(STRCAST("ice_getEndpoints() -> tuple")) }, { STRCAST("ice_newEndpoints"), (PyCFunction)proxyIceNewEndpoints, METH_VARARGS, - PyDoc_STR(STRCAST("ice_newEndpoints(tuple) -> proxy")) }, + PyDoc_STR(STRCAST("ice_newEndpoints(tuple) -> proxy")) }, // Deprecated + { STRCAST("ice_endpoints"), (PyCFunction)proxyIceEndpoints, METH_VARARGS, + PyDoc_STR(STRCAST("ice_endpoints(tuple) -> proxy")) }, { STRCAST("ice_getLocatorCacheTimeout"), (PyCFunction)proxyIceGetLocatorCacheTimeout, METH_NOARGS, PyDoc_STR(STRCAST("ice_getLocatorCacheTimeout() -> int")) }, { STRCAST("ice_locatorCacheTimeout"), (PyCFunction)proxyIceLocatorCacheTimeout, METH_VARARGS, diff --git a/py/test/Ice/binding/AllTests.py b/py/test/Ice/binding/AllTests.py index 3d0a777d209..cd99d820991 100644 --- a/py/test/Ice/binding/AllTests.py +++ b/py/test/Ice/binding/AllTests.py @@ -8,12 +8,43 @@ # # ********************************************************************** -import Ice, Test, random +import Ice, Test, random, threading def test(b): if not b: raise RuntimeError('test assertion failed') +class GetAdapterNameCB: + def __init__(self): + self._name = "" + self._cond = threading.Condition() + + def ice_response(self, name): + self._cond.acquire() + self._name = name + self._cond.notify() + self._cond.release() + + def ice_exception(self, ex): + test(False) + + def getResult(self): + self._cond.acquire() + try: + while self._name == "": + self._cond.wait(5.0) + if self._name != "": + return self._name + else: + return "" + finally: + self._cond.release() + +def getAdapterNameWithAMI(proxy): + cb = GetAdapterNameCB() + proxy.getAdapterName_async(cb) + return cb.getResult() + def createTestIntfPrx(adapters): endpoints = [] test = None @@ -21,7 +52,7 @@ def createTestIntfPrx(adapters): test = p.getTestIntf() edpts = test.ice_getEndpoints() endpoints.extend(edpts) - return Test.TestIntfPrx.uncheckedCast(test.ice_newEndpoints(endpoints)) + return Test.TestIntfPrx.uncheckedCast(test.ice_endpoints(endpoints)) def deactivate(com, adapters): for p in adapters: @@ -63,6 +94,10 @@ def allTests(communicator): adapters.append(com.createObjectAdapter("Adapter12", "default")) adapters.append(com.createObjectAdapter("Adapter13", "default")) + # + # Ensure that when a connection is opened it's reused for new + # proxies and that all endpoints are eventually tried. + # names = ["Adapter11", "Adapter12", "Adapter13"] while len(names) > 0: adpts = adapters[:] @@ -81,8 +116,29 @@ def allTests(communicator): names.remove(name) test1.ice_connection().close(False) - com.deactivateObjectAdapter(adapters[0]) + # + # Ensure that the proxy correctly caches the connection (we + # always send the request over the same connection.) + # + for a in adapters: + a.getTestIntf().ice_ping() + t = createTestIntfPrx(adapters) + name = t.getAdapterName() + i = 0 + nRetry = 5 + while i < nRetry and t.getAdapterName() == name: + i = i + 1 + test(i == nRetry) + + for a in adapters: + a.getTestIntf().ice_connection().close(False) + + # + # Deactivate an adapter and ensure that we can still + # establish the connection to the remaining adapters. + # + com.deactivateObjectAdapter(adapters[0]) names.append("Adapter12") names.append("Adapter13") while len(names) > 0: @@ -102,8 +158,11 @@ def allTests(communicator): names.remove(name) test1.ice_connection().close(False) - com.deactivateObjectAdapter(adapters[2]) - + # + # Deactivate an adapter and ensure that we can still + # establish the connection to the remaining adapters. + # + com.deactivateObjectAdapter(adapters[2]) t = createTestIntfPrx(adapters) test(t.getAdapterName() == "Adapter12") @@ -111,6 +170,89 @@ def allTests(communicator): print "ok" + print "testing binding with multiple endpoints and AMI...", + + adapters = [] + adapters.append(com.createObjectAdapter("AdapterAMI11", "default")) + adapters.append(com.createObjectAdapter("AdapterAMI12", "default")) + adapters.append(com.createObjectAdapter("AdapterAMI13", "default")) + + # + # Ensure that when a connection is opened it's reused for new + # proxies and that all endpoints are eventually tried. + # + names = ["AdapterAMI11", "AdapterAMI12", "AdapterAMI13"] + while len(names) > 0: + adpts = adapters[:] + + test1 = createTestIntfPrx(adpts) + random.shuffle(adpts) + test2 = createTestIntfPrx(adpts) + random.shuffle(adpts) + test3 = createTestIntfPrx(adpts) + + test(test1.ice_connection() == test2.ice_connection()) + test(test2.ice_connection() == test3.ice_connection()) + + name = getAdapterNameWithAMI(test1) + if names.count(name) > 0: + names.remove(name) + test1.ice_connection().close(False) + + # + # Ensure that the proxy correctly caches the connection (we + # always send the request over the same connection.) + # + for a in adapters: + a.getTestIntf().ice_ping() + + t = createTestIntfPrx(adapters) + name = getAdapterNameWithAMI(t) + i = 0 + nRetry = 5 + while i < nRetry and getAdapterNameWithAMI(t) == name: + i = i + 1 + test(i == nRetry) + + for a in adapters: + a.getTestIntf().ice_connection().close(False) + + # + # Deactivate an adapter and ensure that we can still + # establish the connection to the remaining adapters. + # + com.deactivateObjectAdapter(adapters[0]) + names.append("AdapterAMI12") + names.append("AdapterAMI13") + while len(names) > 0: + adpts = adapters[:] + + test1 = createTestIntfPrx(adpts) + random.shuffle(adpts) + test2 = createTestIntfPrx(adpts) + random.shuffle(adpts) + test3 = createTestIntfPrx(adpts) + + test(test1.ice_connection() == test2.ice_connection()) + test(test2.ice_connection() == test3.ice_connection()) + + name = getAdapterNameWithAMI(test1) + if names.count(name) > 0: + names.remove(name) + test1.ice_connection().close(False) + + # + # Deactivate an adapter and ensure that we can still + # establish the connection to the remaining adapters. + # + com.deactivateObjectAdapter(adapters[2]) + t = createTestIntfPrx(adapters) + test(getAdapterNameWithAMI(t) == "AdapterAMI12") + + deactivate(com, adapters) + + print "ok" + print "testing random endpoint selection...", adapters = [] @@ -267,6 +409,39 @@ def allTests(communicator): print "ok" + print "testing per request binding with multiple endpoints and AMI...", + + adapters = [] + adapters.append(com.createObjectAdapter("AdapterAMI51", "default")) + adapters.append(com.createObjectAdapter("AdapterAMI52", "default")) + adapters.append(com.createObjectAdapter("AdapterAMI53", "default")) + + t = Test.TestIntfPrx.uncheckedCast(createTestIntfPrx(adapters).ice_cacheConnection(False)) + test(not t.ice_getCacheConnection()) + + names = ["AdapterAMI51", "AdapterAMI52", "AdapterAMI53"] + while len(names) > 0: + name = getAdapterNameWithAMI(t) + if names.count(name) > 0: + names.remove(name) + + com.deactivateObjectAdapter(adapters[0]) + + names.append("AdapterAMI52") + names.append("AdapterAMI53") + while len(names) > 0: + name = getAdapterNameWithAMI(t) + if names.count(name) > 0: + names.remove(name) + + com.deactivateObjectAdapter(adapters[2]) + + test(getAdapterNameWithAMI(t) == "AdapterAMI52") + + deactivate(com, adapters) + + print "ok" + print "testing per request binding and ordered endpoint selection...", adapters = [] @@ -334,6 +509,73 @@ def allTests(communicator): print "ok" + print "testing per request binding and ordered endpoint selection and AMI...", + + adapters = [] + adapters.append(com.createObjectAdapter("AdapterAMI61", "default")) + adapters.append(com.createObjectAdapter("AdapterAMI62", "default")) + adapters.append(com.createObjectAdapter("AdapterAMI63", "default")) + + t = createTestIntfPrx(adapters) + t = Test.TestIntfPrx.uncheckedCast(t.ice_endpointSelection(Ice.EndpointSelectionType.Ordered)) + test(t.ice_getEndpointSelection() == Ice.EndpointSelectionType.Ordered) + t = Test.TestIntfPrx.uncheckedCast(t.ice_cacheConnection(False)) + test(not t.ice_getCacheConnection()) + nRetry = 5 + + # + # Ensure that endpoints are tried in order by deactiving the adapters + # one after the other. + # + i = 0 + while i < nRetry and getAdapterNameWithAMI(t) == "AdapterAMI61": + i = i + 1 + test(i == nRetry) + com.deactivateObjectAdapter(adapters[0]) + i = 0 + while i < nRetry and getAdapterNameWithAMI(t) == "AdapterAMI62": + i = i + 1 + test(i == nRetry) + com.deactivateObjectAdapter(adapters[1]) + i = 0 + while i < nRetry and getAdapterNameWithAMI(t) == "AdapterAMI63": + i = i + 1 + test(i == nRetry) + com.deactivateObjectAdapter(adapters[2]) + + try: + t.getAdapterName() + except Ice.ConnectionRefusedException: + pass + + endpoints = t.ice_getEndpoints() + + adapters = [] + + # + # Now, re-activate the adapters with the same endpoints in the opposite + # order. + # + adapters.append(com.createObjectAdapter("AdapterAMI66", endpoints[2].toString())) + i = 0 + while i < nRetry and getAdapterNameWithAMI(t) == "AdapterAMI66": + i = i + 1 + test(i == nRetry) + adapters.append(com.createObjectAdapter("AdapterAMI65", endpoints[1].toString())) + i = 0 + while i < nRetry and getAdapterNameWithAMI(t) == "AdapterAMI65": + i = i + 1 + test(i == nRetry) + adapters.append(com.createObjectAdapter("AdapterAMI64", endpoints[0].toString())) + i = 0 + while i < nRetry and getAdapterNameWithAMI(t) == "AdapterAMI64": + i = i + 1 + test(i == nRetry) + + deactivate(com, adapters) + + print "ok" + print "testing endpoint mode filtering...", adapters = [] diff --git a/py/test/Ice/binding/Test.ice b/py/test/Ice/binding/Test.ice index 851f060cbb1..92e04788abe 100644 --- a/py/test/Ice/binding/Test.ice +++ b/py/test/Ice/binding/Test.ice @@ -15,7 +15,7 @@ module Test interface TestIntf { - string getAdapterName(); + ["ami"] string getAdapterName(); }; interface RemoteObjectAdapter diff --git a/py/test/Ice/exceptions/AllTests.py b/py/test/Ice/exceptions/AllTests.py index ba987da3f69..96936d925d8 100644 --- a/py/test/Ice/exceptions/AllTests.py +++ b/py/test/Ice/exceptions/AllTests.py @@ -534,7 +534,7 @@ def allTests(communicator): id = Ice.stringToIdentity("does not exist") try: - thrower2 = Test.ThrowerPrx.uncheckedCast(thrower.ice_newIdentity(id)) + thrower2 = Test.ThrowerPrx.uncheckedCast(thrower.ice_identity(id)) thrower2.throwAasA(1) # thrower2.ice_ping() test(False) @@ -679,7 +679,7 @@ def allTests(communicator): print "catching object not exist exception with AMI... ", id = Ice.stringToIdentity("does not exist") - thrower2 = Test.ThrowerPrx.uncheckedCast(thrower.ice_newIdentity(id)) + thrower2 = Test.ThrowerPrx.uncheckedCast(thrower.ice_identity(id)) cb = AMI_Thrower_throwAasAObjectNotExistI() thrower2.throwAasA_async(cb, 1) test(cb.check()) diff --git a/py/test/Ice/operations/Twoways.py b/py/test/Ice/operations/Twoways.py index 5b7765c6cb0..b70eb8c3fec 100644 --- a/py/test/Ice/operations/Twoways.py +++ b/py/test/Ice/operations/Twoways.py @@ -450,7 +450,7 @@ def twoways(communicator, p): test(len(p.ice_getContext()) == 0) test(r == ctx) - p2 = Test.MyClassPrx.checkedCast(p.ice_newContext(ctx)) + p2 = Test.MyClassPrx.checkedCast(p.ice_context(ctx)) test(p2.ice_getContext() == ctx) r = p2.opContext() test(r == ctx) @@ -464,7 +464,7 @@ def twoways(communicator, p): communicator.setDefaultContext(dflt) test(p.opContext() != dflt) - p2 = Test.MyClassPrx.uncheckedCast(p.ice_newContext({})) + p2 = Test.MyClassPrx.uncheckedCast(p.ice_context({})) test(len(p2.opContext()) == 0) p2 = Test.MyClassPrx.uncheckedCast(p.ice_defaultContext()) @@ -478,11 +478,11 @@ def twoways(communicator, p): test(c.opContext() == dflt) dflt['a'] = 'c' - c2 = Test.MyClassPrx.uncheckedCast(c.ice_newContext(dflt)) + c2 = Test.MyClassPrx.uncheckedCast(c.ice_context(dflt)) test(c2.opContext()['a'] == 'c') dflt = {} - c3 = Test.MyClassPrx.uncheckedCast(c2.ice_newContext(dflt)) + c3 = Test.MyClassPrx.uncheckedCast(c2.ice_context(dflt)) tmp = c3.opContext() test(not tmp.has_key('a')) diff --git a/py/test/Ice/operations/TwowaysAMI.py b/py/test/Ice/operations/TwowaysAMI.py index bea1393dbc8..cbc30370c69 100644 --- a/py/test/Ice/operations/TwowaysAMI.py +++ b/py/test/Ice/operations/TwowaysAMI.py @@ -777,13 +777,13 @@ def twowaysAMI(communicator, p): p.opContext_async(cb, ctx) test(cb.check()) - p2 = Test.MyClassPrx.checkedCast(p.ice_newContext(ctx)) + p2 = Test.MyClassPrx.checkedCast(p.ice_context(ctx)) test(p2.ice_getContext() == ctx) cb = AMI_MyClass_opContextEqualI(ctx) p2.opContext_async(cb) test(cb.check()) - p2 = Test.MyClassPrx.checkedCast(p.ice_newContext(ctx)) + p2 = Test.MyClassPrx.checkedCast(p.ice_context(ctx)) test(p2.ice_getContext() == ctx) cb = AMI_MyClass_opContextEqualI(ctx) p2.opContext_async(cb, ctx) @@ -798,7 +798,7 @@ def twowaysAMI(communicator, p): p.opContext_async(cb) test(cb.check()) - p2 = Test.MyClassPrx.uncheckedCast(p.ice_newContext({})) + p2 = Test.MyClassPrx.uncheckedCast(p.ice_context({})) cb = AMI_MyClass_opContextEqualI({}) p2.opContext_async(cb) test(cb.check()) @@ -820,13 +820,13 @@ def twowaysAMI(communicator, p): test(cb.check()) dflt['a'] = 'c' - c2 = Test.MyClassPrx.uncheckedCast(c.ice_newContext(dflt)) + c2 = Test.MyClassPrx.uncheckedCast(c.ice_context(dflt)) cb = AMI_MyClass_opContextEqualI({'a': 'c'}) c2.opContext_async(cb) test(cb.check()) dflt = {} - c3 = Test.MyClassPrx.uncheckedCast(c2.ice_newContext(dflt)) + c3 = Test.MyClassPrx.uncheckedCast(c2.ice_context(dflt)) cb = AMI_MyClass_opContextEqualI({}) c3.opContext_async(cb) test(cb.check()) |