示例#1
0
 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({})
示例#2
0
 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]
示例#3
0
 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)
示例#4
0
 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({})
示例#5
0
    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>'
示例#6
0
    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>'