summaryrefslogtreecommitdiff
path: root/py/modules/IcePy/Communicator.cpp
diff options
context:
space:
mode:
authorBernard Normier <bernard@zeroc.com>2014-09-08 12:03:16 -0400
committerBernard Normier <bernard@zeroc.com>2014-09-08 12:03:16 -0400
commita0f6b6fc1a619c40979f5ba00d71dc661cfc6499 (patch)
tree81b40da86417ed18a186d595c119bb7823b17fcf /py/modules/IcePy/Communicator.cpp
parentICE-5658 - NPM support for IceJS distribution (diff)
downloadice-a0f6b6fc1a619c40979f5ba00d71dc661cfc6499.tar.bz2
ice-a0f6b6fc1a619c40979f5ba00d71dc661cfc6499.tar.xz
ice-a0f6b6fc1a619c40979f5ba00d71dc661cfc6499.zip
Fixed ICE-5667: Added Communicator::createAdmin in C++, Java, C# and Python
Diffstat (limited to 'py/modules/IcePy/Communicator.cpp')
-rw-r--r--py/modules/IcePy/Communicator.cpp52
1 files changed, 52 insertions, 0 deletions
diff --git a/py/modules/IcePy/Communicator.cpp b/py/modules/IcePy/Communicator.cpp
index 593988ce462..976f6cdabb9 100644
--- a/py/modules/IcePy/Communicator.cpp
+++ b/py/modules/IcePy/Communicator.cpp
@@ -795,6 +795,56 @@ communicatorEndFlushBatchRequests(CommunicatorObject* self, PyObject* args)
extern "C"
#endif
static PyObject*
+communicatorCreateAdmin(CommunicatorObject* self, PyObject* args)
+{
+ PyObject* adapter;
+ PyObject* identityType = lookupType("Ice.Identity");
+ PyObject* id;
+ if(!PyArg_ParseTuple(args, STRCAST("OO!"), &adapter, identityType, &id))
+ {
+ return 0;
+ }
+
+ Ice::ObjectAdapterPtr oa;
+
+ PyObject* adapterType = lookupType("Ice.ObjectAdapter");
+ if(adapter != Py_None && !PyObject_IsInstance(adapter, adapterType))
+ {
+ PyErr_Format(PyExc_ValueError, STRCAST("expected ObjectAdapter or None"));
+ return 0;
+ }
+
+ if(adapter != Py_None)
+ {
+ oa = unwrapObjectAdapter(adapter);
+ }
+
+ Ice::Identity identity;
+ if(!getIdentity(id, identity))
+ {
+ return 0;
+ }
+
+ assert(self->communicator);
+ Ice::ObjectPrx proxy;
+ try
+ {
+ proxy = (*self->communicator)->createAdmin(oa, identity);
+ assert(proxy);
+
+ return createProxy(proxy, *self->communicator);
+ }
+ catch(const Ice::Exception& ex)
+ {
+ setPythonException(ex);
+ return 0;
+ }
+}
+
+#ifdef WIN32
+extern "C"
+#endif
+static PyObject*
communicatorGetAdmin(CommunicatorObject* self)
{
assert(self->communicator);
@@ -1475,6 +1525,8 @@ static PyMethodDef CommunicatorMethods[] =
PyDoc_STR(STRCAST("begin_flushBatchRequests([_ex][, _sent]) -> Ice.AsyncResult")) },
{ STRCAST("end_flushBatchRequests"), reinterpret_cast<PyCFunction>(communicatorEndFlushBatchRequests),
METH_VARARGS, PyDoc_STR(STRCAST("end_flushBatchRequests(Ice.AsyncResult) -> None")) },
+ { STRCAST("createAdmin"), reinterpret_cast<PyCFunction>(communicatorCreateAdmin), METH_VARARGS,
+ PyDoc_STR(STRCAST("createAdmin(adminAdapter, adminIdentity) -> Ice.ObjectPrx")) },
{ STRCAST("getAdmin"), reinterpret_cast<PyCFunction>(communicatorGetAdmin), METH_NOARGS,
PyDoc_STR(STRCAST("getAdmin() -> Ice.ObjectPrx")) },
{ STRCAST("addAdminFacet"), reinterpret_cast<PyCFunction>(communicatorAddAdminFacet), METH_VARARGS,