def get_instance_detail(self, instance_name): """ Returns details about the identified instance """ details = None try: details = self._ipopo.get_instance_details(instance_name) except ValueError as ex: return json.dumps({"error" : str(ex)}) # basic info if details is not None: instance_detail = { "kind": "Python", "name": details["name"], "factory": details["factory"], "bundle-id": details["bundle_id"], "state": ipopo_state_to_str(details["state"]), "services": [ str(svc_ref) for svc_ref in details["services"].values() ], "dependencies": [ {dep : { "specification": details["dependencies"][dep]["specification"], "optional": details["dependencies"][dep]["optional"], "aggregate": details["dependencies"][dep]["aggregate"], "handler": details["dependencies"][dep]["handler"], "filter": "not showed here!", "bindings": [ str(binding) for binding in details["dependencies"][dep]["bindings"] ] } } for dep in details["dependencies"] ], "properties" : details["properties"], "error-trace" : details["error_trace"] } # instance properties return json.dumps(instance_detail) else: return json.dumps({})
def get_instances(self): """ Returns the list of iPOPO instances in the local isolate """ ipopo_instances = self._ipopo.get_instances() return [ {"name" : name, "factory": factory, "state": ipopo_state_to_str(state)} for name, factory, state in ipopo_instances]
def get_instances(self): """ Returns the list of iPOPO instances in the local isolate """ ipopo_instances = self._ipopo.get_instances() result = [{ "name": name, "factory": factory, "state": ipopo_state_to_str(state) } for name, factory, state in ipopo_instances] return json.dumps(result)
def get_instance_detail(self, instance_name): """ Returns details about the identified instance """ details = None try: details = self._ipopo.get_instance_details(instance_name) except ValueError as ex: return json.dumps({"error": str(ex)}) # basic info if details is not None: instance_detail = { "kind": "Python", "name": details["name"], "factory": details["factory"], "bundle-id": details["bundle_id"], "state": ipopo_state_to_str(details["state"]), "services": [str(svc_ref) for svc_ref in details["services"].values()], "dependencies": [{ dep: { "specification": details["dependencies"][dep]["specification"], "optional": details["dependencies"][dep]["optional"], "aggregate": details["dependencies"][dep]["aggregate"], "handler": details["dependencies"][dep]["handler"], "filter": "not showed here!", "bindings": [ str(binding) for binding in details["dependencies"] [dep]["bindings"] ] } } for dep in details["dependencies"]], "properties": details["properties"], "error-trace": details["error_trace"] } # instance properties return json.dumps(instance_detail) else: return json.dumps({})
def make_instances(self, request): """ Prints iPOPO components instances details """ headers = ('Name', 'Factory', 'State') instances = self._ipopo.get_instances() # Lines are already sorted lines = ((name, factory, ipopo_state_to_str(state)) for name, factory, state in instances) table = self._utils.make_table(headers, lines) return '<h2>iPOPO Instances</h2><pre>' + table + '</pre>'