Example #1
0
    def handle_request(self, context, request):
        logger.debug("Received RMC request: protocol=%i, call=%i, method=%i",
                     request.protocol, request.call_id, request.method)

        input = streams.StreamIn(request.body, self.settings)
        output = streams.StreamOut(self.settings)

        result = common.Result()
        if request.protocol in self.servers:
            try:
                self.servers[request.protocol].handle(context, request.method,
                                                      input, output)
            except common.RMCError as e:
                result = common.Result(e.code)
            except Exception as e:
                logger.error("Exception occurred while handling method call")

                import traceback
                traceback.print_exc()

                if isinstance(e, TypeError):
                    result = common.Result.error("PythonCore::TypeError")
                elif isinstance(e, IndexError):
                    result = common.Result.error("PythonCore::IndexError")
                elif isinstance(e, MemoryError):
                    result = common.Result.error("PythonCore::MemoryError")
                elif isinstance(e, KeyError):
                    result = common.Result.error("PythonCore::KeyError")
                else:
                    result = common.Result.error("PythonCore::Exception")
        else:
            logger.warning(
                "Received RMC request with unimplemented protocol id: 0x%X",
                protocol_id)
            result = common.Result.error("Core::NotImplemented")

        if result.is_success():
            response = RMCMessage.response(self.settings, request.protocol,
                                           request.method, request.call_id,
                                           output.get())
        else:
            response = RMCMessage.error(self.settings, request.protocol,
                                        request.method, request.call_id,
                                        result.code())
        return response
Example #2
0
 def handle_get_ranking_by_unique_id_list(self, caller_id, input, output):
     logger.warning(
         "RankingSever.get_ranking_by_unique_id_list is unsupported")
     return common.Result("Core::NotImplemented")
Example #3
0
 def handle_get_approx_order(self, caller_id, input, output):
     logger.warning("RankingSever.get_approx_order is unsupported")
     return common.Result("Core::NotImplemented")
Example #4
0
 def handle_change_all_attributes(self, caller_id, input, output):
     logger.warning("RankingSever.change_all_attributes is unsupported")
     return common.Result("Core::NotImplemented")
Example #5
0
 def handle_delete_common_data(self, caller_id, input, output):
     logger.warning("RankingSever.delete_common_data is unsupported")
     return common.Result("Core::NotImplemented")
Example #6
0
 def handle_upload_score(self, caller_id, input, output):
     logger.warning("RankingSever.upload_score is unsupported")
     return common.Result("Core::NotImplemented")
Example #7
0
 def handle_search_object_light(self, context, input, output):
     logger.warning("DataStoreSever.search_object_light is unsupported")
     return common.Result("Core::NotImplemented")
Example #8
0
 def handle_get_object_infos(self, context, input, output):
     logger.warning("DataStoreSever.get_object_infos is unsupported")
     return common.Result("Core::NotImplemented")
Example #9
0
 def handle_rate_objects_with_posting(self, context, input, output):
     logger.warning(
         "DataStoreSever.rate_objects_with_posting is unsupported")
     return common.Result("Core::NotImplemented")
Example #10
0
 def handle_post_meta_binaries_with_data_id(self, context, input, output):
     logger.warning(
         "DataStoreSever.post_meta_binaries_with_data_id is unsupported")
     return common.Result("Core::NotImplemented")
Example #11
0
 def handle_change_metas(self, context, input, output):
     logger.warning("DataStoreSever.change_metas is unsupported")
     return common.Result("Core::NotImplemented")
Example #12
0
 def handle_unperpetuate_object(self, context, input, output):
     logger.warning("DataStoreSever.unperpetuate_object is unsupported")
     return common.Result("Core::NotImplemented")
Example #13
0
 def handle_get_specific_meta(self, context, input, output):
     logger.warning("DataStoreSever.get_specific_meta is unsupported")
     return common.Result("Core::NotImplemented")
Example #14
0
 def handle_get_new_arrived_notifications(self, context, input, output):
     logger.warning(
         "DataStoreSever.get_new_arrived_notifications is unsupported")
     return common.Result("Core::NotImplemented")