| OLD | NEW |
| 1 # copyright 2003-2011 LOGILAB S.A. (Paris, FRANCE), all rights reserved. | 1 # copyright 2003-2011 LOGILAB S.A. (Paris, FRANCE), all rights reserved. |
| 2 # contact http://www.logilab.fr/ -- mailto:contact@logilab.fr | 2 # contact http://www.logilab.fr/ -- mailto:contact@logilab.fr |
| 3 # | 3 # |
| 4 # This file is part of logilab-common. | 4 # This file is part of logilab-common. |
| 5 # | 5 # |
| 6 # logilab-common is free software: you can redistribute it and/or modify it unde
r | 6 # logilab-common is free software: you can redistribute it and/or modify it unde
r |
| 7 # the terms of the GNU Lesser General Public License as published by the Free | 7 # the terms of the GNU Lesser General Public License as published by the Free |
| 8 # Software Foundation, either version 2.1 of the License, or (at your option) an
y | 8 # Software Foundation, either version 2.1 of the License, or (at your option) an
y |
| 9 # later version. | 9 # later version. |
| 10 # | 10 # |
| (...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 65 is mapped to | 65 is mapped to |
| 66 'corbaname::hostname#logilab.rootmodule/chatbot.application/chatter.server' | 66 'corbaname::hostname#logilab.rootmodule/chatbot.application/chatter.server' |
| 67 | 67 |
| 68 The get_object_reference() function can be used to resolve such a URL. | 68 The get_object_reference() function can be used to resolve such a URL. |
| 69 """ | 69 """ |
| 70 context = get_root_context() | 70 context = get_root_context() |
| 71 for id, kind in namepath[:-1]: | 71 for id, kind in namepath[:-1]: |
| 72 name = [CosNaming.NameComponent(id, kind)] | 72 name = [CosNaming.NameComponent(id, kind)] |
| 73 try: | 73 try: |
| 74 context = context.bind_new_context(name) | 74 context = context.bind_new_context(name) |
| 75 except CosNaming.NamingContext.AlreadyBound as ex: | 75 except CosNaming.NamingContext.AlreadyBound, ex: |
| 76 context = context.resolve(name)._narrow(CosNaming.NamingContext) | 76 context = context.resolve(name)._narrow(CosNaming.NamingContext) |
| 77 assert context is not None, \ | 77 assert context is not None, \ |
| 78 'test context exists but is not a NamingContext' | 78 'test context exists but is not a NamingContext' |
| 79 | 79 |
| 80 id, kind = namepath[-1] | 80 id, kind = namepath[-1] |
| 81 name = [CosNaming.NameComponent(id, kind)] | 81 name = [CosNaming.NameComponent(id, kind)] |
| 82 try: | 82 try: |
| 83 context.bind(name, object._this()) | 83 context.bind(name, object._this()) |
| 84 except CosNaming.NamingContext.AlreadyBound as ex: | 84 except CosNaming.NamingContext.AlreadyBound, ex: |
| 85 context.rebind(name, object._this()) | 85 context.rebind(name, object._this()) |
| 86 | 86 |
| 87 def activate_POA(): | 87 def activate_POA(): |
| 88 """ | 88 """ |
| 89 This methods activates the Portable Object Adapter. | 89 This methods activates the Portable Object Adapter. |
| 90 You need to call it to enable the reception of messages in your code, | 90 You need to call it to enable the reception of messages in your code, |
| 91 on both the client and the server. | 91 on both the client and the server. |
| 92 """ | 92 """ |
| 93 orb = get_orb() | 93 orb = get_orb() |
| 94 poa = orb.resolve_initial_references('RootPOA') | 94 poa = orb.resolve_initial_references('RootPOA') |
| (...skipping 13 matching lines...) Expand all Loading... |
| 108 See register_object_name() for examples URLs | 108 See register_object_name() for examples URLs |
| 109 """ | 109 """ |
| 110 return get_orb().string_to_object(url) | 110 return get_orb().string_to_object(url) |
| 111 | 111 |
| 112 def get_object_string(host, namepath): | 112 def get_object_string(host, namepath): |
| 113 """given an host name and a name path as described in register_object_name, | 113 """given an host name and a name path as described in register_object_name, |
| 114 return a corba string identifier | 114 return a corba string identifier |
| 115 """ | 115 """ |
| 116 strname = '/'.join(['.'.join(path_elt) for path_elt in namepath]) | 116 strname = '/'.join(['.'.join(path_elt) for path_elt in namepath]) |
| 117 return 'corbaname::%s#%s' % (host, strname) | 117 return 'corbaname::%s#%s' % (host, strname) |
| OLD | NEW |