Example #1
0
 def build_memory(self) -> IReplayMemory:
     """
     # see : IFactory.build_memory()
     """
     memory_class_string = str(
         self._config_handler.get_config_property(KatConfigurationProperty.MEMORY_CLASS,
                                                  KatConfigurationProperty.MEMORY_CLASS.prop_type))
     return reflection.get_instance(memory_class_string, IReplayMemory)
Example #2
0
 def build_metrics_tracer(self) -> IMetricTracer:
     """
     # see : IFactory.build_metrics_tracer()
     """
     tracer_class_string = str(
         self._config_handler.get_config_property(KatConfigurationProperty.METRICS_TRACER_CLASS,
                                                  KatConfigurationProperty.METRICS_TRACER_CLASS.prop_type))
     return reflection.get_instance(tracer_class_string, IMetricTracer)
Example #3
0
 def build_agent(self) -> IAgent:
     """
     # see : IFactory.build_agent()
     """
     agent_class_string = str(
         self._config_handler.get_config_property(KatConfigurationProperty.AGENT_CLASS,
                                                  KatConfigurationProperty.AGENT_CLASS.prop_type))
     return reflection.get_instance(agent_class_string, IAgent)
Example #4
0
 def build_network(self) -> INetwork:
     """
     # see : IFactory.build_network()
     """
     network_class_string = str(
         self._config_handler.get_config_property(KatConfigurationProperty.NETWORK_CLASS,
                                                  KatConfigurationProperty.NETWORK_CLASS.prop_type))
     return reflection.get_instance(network_class_string, INetwork)
Example #5
0
 def build_driver(self) -> IDriver:
     """
     # see : IFactory.build_driver()
     """
     driver_class_string = str(
         self._config_handler.get_config_property(KatConfigurationProperty.DRIVER_CLASS,
                                                  KatConfigurationProperty.DRIVER_CLASS.prop_type))
     return reflection.get_instance(driver_class_string, IDriver)
Example #6
0
 def build_game(self) -> IGame:
     """
     # see : IFactory.build_game()
     """
     game_class_string = str(
         self._config_handler.get_config_property(KatConfigurationProperty.GAME_CLASS,
                                                  KatConfigurationProperty.GAME_CLASS.prop_type))
     return reflection.get_instance(game_class_string, IGame)
Example #7
0
 def build_model_storage_driver(self) -> IModelStorageDriver:
     """
     # see : IFactory.build_model_storage_driver()
     """
     model_storage_driver_class = str(
         self._config_handler.get_config_property(KatConfigurationProperty.MODEL_STORAGE_DRIVER_CLASS,
                                                  KatConfigurationProperty.MODEL_STORAGE_DRIVER_CLASS.prop_type))
     return reflection.get_instance(model_storage_driver_class, IModelStorageDriver)
Example #8
0
 def build_model_serializer(self) -> IModelSerializer:
     """
     # see : IFactory.build_model_serializer()
     """
     model_serializer_class = str(
         self._config_handler.get_config_property(KatConfigurationProperty.MODEL_SERIALIZER_CLASS,
                                                  KatConfigurationProperty.MODEL_SERIALIZER_CLASS.prop_type))
     return reflection.get_instance(model_serializer_class, IModelSerializer)
Example #9
0
    def init(factory_class: str, config_handler_class: str,
             config_uri: str) -> None:
        """
        Runtime initialization.

        :param factory_class:
            factory implementation's  canonical name
        :param config_handler_class:
            config implementation's  canonical name
        :param config_uri:
            configuration uri
        """
        if not factory_class:
            raise ValueError("No factory specified.")
        if not config_handler_class:
            raise ValueError("No config handler specified.")
        if not config_uri:
            raise ValueError("No config_uri specified.")
        KatherineApplication.config_handler = reflection.get_instance(
            config_handler_class, IConfigurationHandler, config_uri)
        KatherineApplication.application_factory = reflection.get_instance(
            factory_class, IFactory)