def _parse_name_server(self, address, filter=[], dynamic=False): # Parse a single name server and add it to the root node. if not utils.filtered(['/', address], filter): new_ns_node = NameServer(self._orb, address, self._root, utils.trim_filter(copy.deepcopy(filter), 2), dynamic=dynamic) self._root._add_child(new_ns_node)
def _process_binding(self, binding, orb, filter): if filtered([URI.nameToString(binding.binding_name)], filter): # Do not pass anything which does not pass the filter return trimmed_filter = trim_filter(deepcopy(filter)) with self._mutex: # Process a binding, creating the correct child type for it and # adding that child to this node's children. if binding.binding_type == CosNaming.nobject: # This is a leaf node; either a component or a manager. The # specific type can be determined from the binding name kind. if binding.binding_name[0].kind == "mgr": name = URI.nameToString(binding.binding_name) obj = self._context.resolve(binding.binding_name) if not obj: leaf = Zombie(name, self) return obj = obj._narrow(RTM.Manager) try: leaf = Manager(name, self, obj, dynamic=self.dynamic) except CORBA.OBJECT_NOT_EXIST: # Manager zombie leaf = Zombie(name, self) except CORBA.TRANSIENT: # Manager zombie leaf = Zombie(name, self) self._add_child(leaf) elif binding.binding_name[0].kind == "rtc": name = URI.nameToString(binding.binding_name) obj = self._context.resolve(binding.binding_name) try: obj = obj._narrow(RTC.RTObject) except CORBA.TRANSIENT, e: if e.args[0] == TRANSIENT_ConnectFailed: self._add_child(Zombie(name, self)) return else: raise except CORBA.OBJECT_NOT_EXIST: self._add_child(Zombie(name, self)) return try: leaf = Component(name, self, obj, dynamic=self.dynamic) except CORBA.OBJECT_NOT_EXIST: # Component zombie leaf = Zombie(name, self, dynamic=self.dynamic) except CORBA.TRANSIENT, e: if e.args[0] == TRANSIENT_ConnectFailed: self._add_child(Zombie(name, self)) return else: raise self._add_child(leaf)
def _parse_name_server(self, address, filter=[], dynamic=False): # Parse a single name server and add it to the root node. if not filtered(["/", address], filter): new_ns_node = NameServer(self._orb, address, self._root, trim_filter(deepcopy(filter), 2), dynamic=dynamic) self._root._add_child(new_ns_node)
def _process_binding(self, binding, orb, filter): if filtered([corba_name_to_string(binding.binding_name)], filter): # Do not pass anything which does not pass the filter return trimmed_filter = trim_filter(deepcopy(filter)) with self._mutex: # Process a binding, creating the correct child type for it and # adding that child to this node's children. if binding.binding_type == CosNaming.nobject: # This is a leaf node; either a component or a manager. The # specific type can be determined from the binding name kind. if binding.binding_name[0].kind == 'mgr': name = corba_name_to_string(binding.binding_name) obj = self._context.resolve(binding.binding_name) if not obj: leaf = Zombie(name, self) return obj = obj._narrow(RTM.Manager) try: leaf = Manager(name, self, obj, dynamic=self.dynamic) except CORBA.OBJECT_NOT_EXIST: # Manager zombie leaf = Zombie(name, self) except CORBA.TRANSIENT: # Manager zombie leaf = Zombie(name, self) self._add_child(leaf) elif binding.binding_name[0].kind == 'rtc': name = corba_name_to_string(binding.binding_name) obj = self._context.resolve(binding.binding_name) try: obj = obj._narrow(RTC.RTObject) except CORBA.TRANSIENT as e: if e.args[0] == TRANSIENT_ConnectFailed: self._add_child(Zombie(name, self)) return else: raise except CORBA.OBJECT_NOT_EXIST: self._add_child(Zombie(name, self)) return try: leaf = Component(name, self, obj, dynamic=self.dynamic) except CORBA.OBJECT_NOT_EXIST: # Component zombie leaf = Zombie(name, self, dynamic=self.dynamic) except CORBA.TRANSIENT as e: if e.args[0] == TRANSIENT_ConnectFailed: self._add_child(Zombie(name, self)) return else: raise self._add_child(leaf) else: # Unknown type - add a plain node name = corba_name_to_string(binding.binding_name) obj = self._context.resolve(binding.binding_name) leaf = Unknown(name, self, obj) self._add_child(leaf) else: # This is a context, and therefore a subdirectory. subdir_name = corba_name_to_string(binding.binding_name) subdir = Directory(subdir_name, self, filter=trimmed_filter, dynamic=self.dynamic) subdir_context = self._context.resolve(binding.binding_name) subdir_context = subdir_context._narrow(CosNaming.NamingContext) subdir._parse_context(subdir_context, orb, filter=trimmed_filter) self._add_child(subdir)
def _process_binding(self, binding, orb, filter): if utils.filtered([corba_name_to_string(binding.binding_name)], filter): # Do not pass anything which does not pass the filter return trimmed_filter = utils.trim_filter(copy.deepcopy(filter)) with self._mutex: # Process a binding, creating the correct child type for it and # adding that child to this node's children. if binding.binding_type == CosNaming.nobject: # This is a leaf node; either a component or a manager. The # specific type can be determined from the binding name kind. if binding.binding_name[0].kind == 'mgr': name = corba_name_to_string(binding.binding_name) obj = self._context.resolve(binding.binding_name) if not obj: leaf = Zombie(name, self) return obj = obj._narrow(RTM.Manager) try: leaf = Manager(name, self, obj, dynamic=self.dynamic) except CORBA.OBJECT_NOT_EXIST: # Manager zombie leaf = Zombie(name, self) except CORBA.TRANSIENT: # Manager zombie leaf = Zombie(name, self) self._add_child(leaf) elif binding.binding_name[0].kind == 'rtc': name = corba_name_to_string(binding.binding_name) obj = self._context.resolve(binding.binding_name) try: obj = obj._narrow(RTC.RTObject) except CORBA.TRANSIENT as e: if e.args[0] == TRANSIENT_ConnectFailed: self._add_child(Zombie(name, self)) return else: raise except CORBA.OBJECT_NOT_EXIST: self._add_child(Zombie(name, self)) return try: leaf = Component(name, self, obj, dynamic=self.dynamic) except CORBA.OBJECT_NOT_EXIST: # Component zombie leaf = Zombie(name, self, dynamic=self.dynamic) except CORBA.TRANSIENT as e: if e.args[0] == TRANSIENT_ConnectFailed: self._add_child(Zombie(name, self)) return else: raise self._add_child(leaf) else: # Unknown type - add a plain node name = corba_name_to_string(binding.binding_name) obj = self._context.resolve(binding.binding_name) leaf = Unknown(name, self, obj) self._add_child(leaf) else: # This is a context, and therefore a subdirectory. subdir_name = corba_name_to_string(binding.binding_name) subdir = Directory(subdir_name, self, filter=trimmed_filter, dynamic=self.dynamic) subdir_context = self._context.resolve(binding.binding_name) subdir_context = subdir_context._narrow(CosNaming.NamingContext) subdir._parse_context(subdir_context, orb, filter=trimmed_filter) self._add_child(subdir)