Пример #1
0
 def create(plugin_name):
     creators = FactoryBase.get_registered("L2ImageWriterBase")
     for crea in creators:
         LOGGER.info("Trying L2 : " + crea.__name__)
         if crea().can_write(plugin_name):
             l2writer = crea()
             return l2writer
     raise MajaFactoryException(
         "No factory to generate L2ImageWriter for " + plugin_name)
 def get_list_of_l2_products(directory):
     creators = FactoryBase.get_registered("L2ImageReaderBase")
     product_list = list()
     for crea in creators:
         LOGGER.info("Trying : " + crea.__name__)
         crea().detect_l2_products(directory, product_list)
     if product_list.__len__() == 0:
         raise MajaFactoryException("No input L2 product available")
     return product_list
 def create(plugin_name, product_info, app_handler, l2comm, dem, mode):
     creators = FactoryBase.get_registered("L1ImageReaderBase")
     for crea in creators:
         LOGGER.info("Trying : " + crea.__name__)
         if crea().can_read(plugin_name):
             l1reader = crea()
             l1reader.read(product_info, app_handler, l2comm, dem, mode)
             return l1reader
     raise MajaFactoryException("No factory to handle " +
                                product_info.ProductFileName)
 def create_with_unique_sat(sat_name, app_handler):
     creators = FactoryBase.get_registered("PluginBase")
     for crea in creators:
         LOGGER.info("Trying : " + crea.__name__ + " for satellite " +
                     sat_name)
         if crea().is_valid_with_unique_satellite(sat_name):
             plugin = crea()
             plugin.initialize(app_handler)
             return plugin
     raise MajaFactoryException("No factory to create plugin for sat " +
                                sat_name)
 def create(plugin_name, app_handler):
     creators = FactoryBase.get_registered("PluginBase")
     for crea in creators:
         LOGGER.info("Trying : " + crea.__name__ + " for plugin " +
                     plugin_name)
         if crea().is_valid(plugin_name):
             plugin = crea()
             plugin.initialize(app_handler)
             return plugin
     raise MajaFactoryException("No factory to create plugin for " +
                                plugin_name)
 def create(product_filename, app_handler, enable_reading_public, dem):
     creators = FactoryBase.get_registered("L2ImageReaderBase")
     for crea in creators:
         LOGGER.info("Trying : " + crea.__name__)
         if crea().can_read(product_filename):
             l2reader = crea()
             l2reader.read_info(product_filename, enable_reading_public)
             l2reader.read(product_filename, app_handler,
                           enable_reading_public, dem)
             return l2reader
     raise MajaFactoryException("No factory to handle " + product_filename)
    def create(plugin_name, app_handler):
        LOGGER.debug("Create header writer for %s", plugin_name)
        LOGGER.debug(app_handler)

        creators = FactoryBase.get_registered("L2HeaderWriterBase")
        for crea in creators:
            LOGGER.debug("Trying L2 HEADER WRITER PROVIDER: " + crea.__name__)
            creator = crea()
            if creator.create(plugin_name, app_handler):
                LOGGER.debug("CREATOR: ")
                LOGGER.debug(creator)
                return creator
        raise MajaFactoryException("No factory to generate L2HeaderWriter for " + plugin_name)
 def get_list_of_l1products(directory, tile_id=None):
     creators = FactoryBase.get_registered("L1ImageInformationsBase")
     product_list = list()
     for crea in creators:
         LOGGER.info("Trying : " + crea.__name__)
         if tile_id is not None and hasattr(
                 crea(), 'IS_TILE_DEPENDENT') and crea().IS_TILE_DEPENDENT:
             crea().detect_l1_products(directory,
                                       product_list,
                                       tile_id=tile_id)
         else:
             crea().detect_l1_products(directory, product_list)
     if product_list.__len__() == 0:
         raise MajaFactoryException("No input L1 product available")
     return product_list
 def create(product_filename, tile_id=None):
     creators = FactoryBase.get_registered("L1ImageInformationsBase")
     for crea in creators:
         LOGGER.info("Trying : " + crea.__name__)
         try:
             creator = crea()
             if tile_id is not None and hasattr(
                     creator,
                     'IS_TILE_DEPENDENT') and creator.IS_TILE_DEPENDENT:
                 if creator.initialize(product_filename, tile_id=tile_id):
                     return creator
             else:
                 if creator.initialize(product_filename):
                     return creator
         except Exception as e:
             LOGGER.debug(e)
             pass
     raise MajaFactoryException("No factory to handle " + product_filename)