summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDwayne Boone <dwayne@zeroc.com>2006-05-09 12:50:43 +0000
committerDwayne Boone <dwayne@zeroc.com>2006-05-09 12:50:43 +0000
commit765822ab9caa9c8079792f17ca40a885bc8261ea (patch)
tree40ee66aaffe1813ba3e82f3133213e0e43c5cea4
parentMore minor fixes (diff)
downloadice-765822ab9caa9c8079792f17ca40a885bc8261ea.tar.bz2
ice-765822ab9caa9c8079792f17ca40a885bc8261ea.tar.xz
ice-765822ab9caa9c8079792f17ca40a885bc8261ea.zip
Added identityToString and stringToIdentity to Communicator
-rw-r--r--cs/CHANGES3
-rwxr-xr-xcs/src/Ice/CommunicatorI.cs10
-rwxr-xr-xjavae/CHANGES3
-rw-r--r--javae/src/Ice/Communicator.java12
-rw-r--r--php/CHANGES3
-rw-r--r--php/src/ice/communicator.cpp53
-rw-r--r--php/src/ice/ice_communicator.h4
-rw-r--r--py/CHANGES3
-rw-r--r--py/modules/IcePy/Communicator.cpp65
-rw-r--r--py/python/Ice.py6
10 files changed, 162 insertions, 0 deletions
diff --git a/cs/CHANGES b/cs/CHANGES
index 0e511b94e46..ec55f45cd31 100644
--- a/cs/CHANGES
+++ b/cs/CHANGES
@@ -1,6 +1,9 @@
Changes since version 3.0.1
---------------------------
+- Added identityToString and stringToIdentity to the Communicator
+ interface.
+
- Added new method Ice::ObjectAdapter::destroy(). After this method
has been called it is now permissible to recreate a new object
adapter with the same name as the destroyed adapter.
diff --git a/cs/src/Ice/CommunicatorI.cs b/cs/src/Ice/CommunicatorI.cs
index 107e86a3da8..a5b3e6ffce5 100755
--- a/cs/src/Ice/CommunicatorI.cs
+++ b/cs/src/Ice/CommunicatorI.cs
@@ -37,6 +37,16 @@ namespace Ice
return instance_.proxyFactory().proxyToString(proxy);
}
+ public Ice.Identity stringToIdentity(string s)
+ {
+ return Ice.Util.stringToIdentity(s);
+ }
+
+ public string identityToString(Ice.Identity ident)
+ {
+ return Ice.Util.identityToString(ident);
+ }
+
public ObjectAdapter createObjectAdapter(string name)
{
return createObjectAdapterWithEndpoints(name, getProperties().getProperty(name + ".Endpoints"));
diff --git a/javae/CHANGES b/javae/CHANGES
index 602b905b798..df304826ea3 100755
--- a/javae/CHANGES
+++ b/javae/CHANGES
@@ -1,6 +1,9 @@
Changes since version 1.1.0
---------------------------
+- Added identityToString and stringToIdentity to the Communicator
+ interface.
+
- Added new method Ice::ObjectAdapter::destroy(). After this method
has been called it is now permissible to recreate a new object
adapter with the same name as the destroyed adapter.
diff --git a/javae/src/Ice/Communicator.java b/javae/src/Ice/Communicator.java
index 6130eb40764..6c6031000fe 100644
--- a/javae/src/Ice/Communicator.java
+++ b/javae/src/Ice/Communicator.java
@@ -41,6 +41,18 @@ public final class Communicator
return _instance.proxyFactory().proxyToString(proxy);
}
+ public Ice.Identity
+ stringToIdentity(String s)
+ {
+ return Ice.Util.stringToIdentity(s);
+ }
+
+ public String
+ identityToString(Ice.Identity ident)
+ {
+ return Ice.Util.identityToString(ident);
+ }
+
public ObjectAdapter
createObjectAdapter(String name)
{
diff --git a/php/CHANGES b/php/CHANGES
index 65158fcf543..97eb027135c 100644
--- a/php/CHANGES
+++ b/php/CHANGES
@@ -1,6 +1,9 @@
Changes since version 3.0.1
---------------------------
+- Added identityToString and stringToIdentity to the Communicator
+ interface.
+
- Removed setDefaultContext operation on Communicator.
- Eliminated the source of deprecation warnings when E_STRICT is
diff --git a/php/src/ice/communicator.cpp b/php/src/ice/communicator.cpp
index b5cdd3c80d0..5331cc0e085 100644
--- a/php/src/ice/communicator.cpp
+++ b/php/src/ice/communicator.cpp
@@ -55,6 +55,8 @@ static function_entry _methods[] =
{"getProperty", PHP_FN(Ice_Communicator_getProperty), NULL},
{"stringToProxy", PHP_FN(Ice_Communicator_stringToProxy), NULL},
{"proxyToString", PHP_FN(Ice_Communicator_proxyToString), NULL},
+ {"stringToIdentity", PHP_FN(Ice_Communicator_stringToIdentity), NULL},
+ {"identityToString", PHP_FN(Ice_Communicator_identityToString), NULL},
{"addObjectFactory", PHP_FN(Ice_Communicator_addObjectFactory), NULL},
{"removeObjectFactory", PHP_FN(Ice_Communicator_removeObjectFactory), NULL},
{"findObjectFactory", PHP_FN(Ice_Communicator_findObjectFactory), NULL},
@@ -280,6 +282,57 @@ ZEND_FUNCTION(Ice_Communicator_proxyToString)
}
}
+ZEND_FUNCTION(Ice_Communicator_identityToString)
+{
+ if(ZEND_NUM_ARGS() != 1)
+ {
+ WRONG_PARAM_COUNT;
+ }
+
+ zend_class_entry* cls = findClass("Ice_Identity" TSRMLS_CC);
+ assert(cls);
+
+ zval *zid;
+
+ if(zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "O", &zid, cls) == FAILURE)
+ {
+ RETURN_NULL();
+ }
+
+ Ice::Identity id;
+ if(extractIdentity(zid, id TSRMLS_CC))
+ {
+ string s = (*_this)->identityToString(id);
+ RETURN_STRINGL(const_cast<char*>(s.c_str()), s.length(), 1);
+ }
+}
+
+ZEND_FUNCTION(Ice_Communicator_stringToIdentity)
+{
+ if(ZEND_NUM_ARGS() != 1)
+ {
+ WRONG_PARAM_COUNT;
+ }
+
+ char* str;
+ int len;
+
+ if(zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s", &str, &len) == FAILURE)
+ {
+ RETURN_NULL();
+ }
+
+ try
+ {
+ Ice::Identity id = (*_this)->stringToIdentity(str);
+ createIdentity(return_value, id TSRMLS_CC);
+ }
+ catch(const IceUtil::Exception& ex)
+ {
+ throwException(ex TSRMLS_CC);
+ }
+}
+
ZEND_FUNCTION(Ice_Communicator_addObjectFactory)
{
if(ZEND_NUM_ARGS() != 2)
diff --git a/php/src/ice/ice_communicator.h b/php/src/ice/ice_communicator.h
index a8f829a472e..9e173628a9d 100644
--- a/php/src/ice/ice_communicator.h
+++ b/php/src/ice/ice_communicator.h
@@ -21,6 +21,8 @@ ZEND_FUNCTION(Ice_Communicator___construct);
ZEND_FUNCTION(Ice_Communicator_getProperty);
ZEND_FUNCTION(Ice_Communicator_stringToProxy);
ZEND_FUNCTION(Ice_Communicator_proxyToString);
+ZEND_FUNCTION(Ice_Communicator_stringToIdentity);
+ZEND_FUNCTION(Ice_Communicator_identityToString);
ZEND_FUNCTION(Ice_Communicator_addObjectFactory);
ZEND_FUNCTION(Ice_Communicator_removeObjectFactory);
ZEND_FUNCTION(Ice_Communicator_findObjectFactory);
@@ -33,6 +35,8 @@ ZEND_FUNCTION(Ice_Communicator_flushBatchRequests);
ZEND_FE(Ice_Communicator_getProperty, NULL) \
ZEND_FE(Ice_Communicator_stringToProxy, NULL) \
ZEND_FE(Ice_Communicator_proxyToString, NULL) \
+ ZEND_FE(Ice_Communicator_stringToIdentity, NULL) \
+ ZEND_FE(Ice_Communicator_identityToString, NULL) \
ZEND_FE(Ice_Communicator_addObjectFactory, NULL) \
ZEND_FE(Ice_Communicator_removeObjectFactory, NULL) \
ZEND_FE(Ice_Communicator_findObjectFactory, NULL) \
diff --git a/py/CHANGES b/py/CHANGES
index 62e6736f983..f04a1a9e464 100644
--- a/py/CHANGES
+++ b/py/CHANGES
@@ -1,6 +1,9 @@
Changes since version 3.0.1
---------------------------
+- Added identityToString and stringToIdentity to the Communicator
+ interface.
+
- Added new method Ice::ObjectAdapter::destroy(). After this method
has been called it is now permissible to recreate a new object
adapter with the same name as the destroyed adapter.
diff --git a/py/modules/IcePy/Communicator.cpp b/py/modules/IcePy/Communicator.cpp
index 63953a661f0..19eb5440013 100644
--- a/py/modules/IcePy/Communicator.cpp
+++ b/py/modules/IcePy/Communicator.cpp
@@ -418,6 +418,67 @@ communicatorProxyToString(CommunicatorObject* self, PyObject* args)
extern "C"
#endif
static PyObject*
+communicatorStringToIdentity(CommunicatorObject* self, PyObject* args)
+{
+ char* str;
+ if(!PyArg_ParseTuple(args, STRCAST("s"), &str))
+ {
+ return NULL;
+ }
+
+ assert(self->communicator);
+ Ice::Identity id;
+ try
+ {
+ id = (*self->communicator)->stringToIdentity(str);
+ }
+ catch(const Ice::Exception& ex)
+ {
+ setPythonException(ex);
+ return NULL;
+ }
+
+ return IcePy::createIdentity(id);
+}
+
+#ifdef WIN32
+extern "C"
+#endif
+static PyObject*
+communicatorIdentityToString(CommunicatorObject* self, PyObject* args)
+{
+ PyObject* identityType = IcePy::lookupType("Ice.Identity");
+ PyObject* obj;
+ if(!PyArg_ParseTuple(args, STRCAST("O!"), identityType, &obj))
+ {
+ return NULL;
+ }
+
+ Ice::Identity id;
+ if(!IcePy::getIdentity(obj, id))
+ {
+ return NULL;
+ }
+ string str;
+
+ assert(self->communicator);
+ try
+ {
+ str = (*self->communicator)->identityToString(id);
+ }
+ catch(const Ice::Exception& ex)
+ {
+ setPythonException(ex);
+ return NULL;
+ }
+
+ return PyString_FromString(const_cast<char*>(str.c_str()));
+}
+
+#ifdef WIN32
+extern "C"
+#endif
+static PyObject*
communicatorFlushBatchRequests(CommunicatorObject* self)
{
assert(self->communicator);
@@ -936,6 +997,10 @@ static PyMethodDef CommunicatorMethods[] =
PyDoc_STR(STRCAST("stringToProxy(str) -> Ice.ObjectPrx")) },
{ STRCAST("proxyToString"), (PyCFunction)communicatorProxyToString, METH_VARARGS,
PyDoc_STR(STRCAST("proxyToString(Ice.ObjectPrx) -> string")) },
+ { STRCAST("stringToIdentity"), (PyCFunction)communicatorStringToIdentity, METH_VARARGS,
+ PyDoc_STR(STRCAST("stringToIdentity(str) -> Ice.Identity")) },
+ { STRCAST("identityToString"), (PyCFunction)communicatorIdentityToString, METH_VARARGS,
+ PyDoc_STR(STRCAST("identityToString(Ice.Identity) -> string")) },
{ STRCAST("createObjectAdapter"), (PyCFunction)communicatorCreateObjectAdapter, METH_VARARGS,
PyDoc_STR(STRCAST("createObjectAdapter(name) -> Ice.ObjectAdapter")) },
{ STRCAST("createObjectAdapterWithEndpoints"), (PyCFunction)communicatorCreateObjectAdapterWithEndpoints,
diff --git a/py/python/Ice.py b/py/python/Ice.py
index a427b811e6a..268e7e4ed56 100644
--- a/py/python/Ice.py
+++ b/py/python/Ice.py
@@ -186,6 +186,12 @@ class CommunicatorI(Communicator):
def proxyToString(self, obj):
return self._impl.proxyToString(obj)
+ def stringToIdentity(self, str):
+ return self._impl.stringToIdentity(str)
+
+ def identityToString(self, obj):
+ return self._impl.identityToString(obj)
+
def createObjectAdapter(self, name):
adapter = self._impl.createObjectAdapter(name)
return ObjectAdapterI(adapter)