Klasse ProductIngestor

java.lang.Object
de.dlr.proseo.ingestor.rest.ProductIngestor

@Component public class ProductIngestor extends Object
Services required to ingest products from pickup points into the prosEO database, and to create, read, updated and delete product file metadata
Autor:
Dr. Thomas Bassler
  • Felddetails

    • rtb

      @Autowired org.springframework.boot.web.client.RestTemplateBuilder rtb
      REST template builder
    • ingestorConfig

      @Autowired IngestorConfiguration ingestorConfig
      Ingestor configuration
    • productManager

      @Autowired ProductManager productManager
      Product Manager
  • Konstruktordetails

    • ProductIngestor

      public ProductIngestor()
  • Methodendetails

    • getFacilityByName

      @Transactional(isolation=REPEATABLE_READ, readOnly=true) public ProcessingFacility getFacilityByName(String facilityName)
      /** Find a processing facility by name (transaction wrapper for repository method)
      Parameter:
      facilityName - the name of the facility to retrieve
      Gibt zurück:
      the processing facility found or null, if no such processing facility exists
    • ingestProducts

      public List<RestProduct> ingestProducts(ProcessingFacility facility, boolean copyFiles, List<IngestorProduct> ingestorProducts, String user, String password) throws IllegalArgumentException, javax.ws.rs.ProcessingException, SecurityException
      Ingest all given products into the storage manager of the given processing facility. If the ID of a product to ingest is null or 0 (zero), then the product will be created, otherwise a matching product will be looked up and updated NOTE: Datatabase transactions are programmatically, therefore no '@Transactional' annotation here.
      Parameter:
      facility - the processing facility to ingest products to
      copyFiles - indicates, whether to copy the files to a different storage area (default "true"; only applicable if source and target storage type are the same)
      ingestorProducts - a list of product descriptions with product file locations
      user - the username to pass on to the Production Planner
      password - the password to pass on to the Production Planner
      Gibt zurück:
      a Json representation of the product updated and/or created including their product files
      Löst aus:
      IllegalArgumentException - if the product ingestion failed (typically due to an error in the Json input)
      javax.ws.rs.ProcessingException - if the communication with the Storage Manager fails
      SecurityException - if a cross-mission data access was attempted
    • getProductFile

      @Transactional(isolation=REPEATABLE_READ, readOnly=true) public RestProductFile getProductFile(Long productId, ProcessingFacility facility) throws javax.persistence.NoResultException, SecurityException
      Get the product file metadata for a product at a given processing facility
      Parameter:
      productId - the ID of the product to retrieve
      facility - the processing facility to retrieve the product file metadata for
      Gibt zurück:
      the Json representation of the product file metadata
      Löst aus:
      javax.persistence.NoResultException - if no product file for the given product ID exists at the given processing facility
      SecurityException - if a cross-mission data access was attempted
    • ingestProductFile

      @Transactional(isolation=REPEATABLE_READ) public RestProductFile ingestProductFile(Long productId, ProcessingFacility facility, RestProductFile productFile, String user, String password) throws IllegalArgumentException, SecurityException
      Create the metadata of a new product file for a product at a given processing facility (it is assumed that the files themselves are already pushed to the Storage Manager)
      Parameter:
      productId - the ID of the product to retrieve
      facility - the processing facility, in which the files have been stored
      productFile - the REST product file to store
      user - the username to pass on to the Production Planner
      password - the password to pass on to the Production Planner
      Gibt zurück:
      the updated REST product file (with ID and version)
      Löst aus:
      IllegalArgumentException - if the product cannot be found, or if the data for the product file is invalid (also, if a product file for the given processing facility already exists)
      SecurityException - if a cross-mission data access was attempted
    • deleteProductFile

      @Transactional(isolation=REPEATABLE_READ) public void deleteProductFile(Long productId, ProcessingFacility facility, Boolean eraseFiles) throws javax.persistence.EntityNotFoundException, RuntimeException, javax.ws.rs.ProcessingException, IllegalArgumentException, SecurityException
      Delete a product file for a product from a given processing facility (metadata and actual data file(s))
      Parameter:
      productId - the ID of the product to retrieve
      facility - the processing facility, from which the files shall be deleted
      eraseFiles - erase the data file(s) from the storage area (default "true")
      Löst aus:
      javax.persistence.EntityNotFoundException - if the product or the product file could not be found
      RuntimeException - if the deletion failed
      javax.ws.rs.ProcessingException - if the communication with the Storage Manager fails
      IllegalArgumentException - if the product currently satisfies a product query for the given processing facility
      SecurityException - if a cross-mission data access was attempted
    • deleteProductFilesOlderThan

      @Transactional(isolation=REPEATABLE_READ) public void deleteProductFilesOlderThan(Instant t)
      Delete all product (files) with eviction time older than t.
      Parameter:
      t - The Instant for eviction time
    • modifyProductFile

      @Transactional(isolation=REPEATABLE_READ) public RestProductFile modifyProductFile(Long productId, ProcessingFacility facility, RestProductFile productFile) throws javax.persistence.EntityNotFoundException, IllegalArgumentException, ConcurrentModificationException, SecurityException
      Update the product file metadata for a product at a given processing facility
      Parameter:
      productId - the ID of the product to retrieve
      facility - the processing facility, in which the files have been stored
      productFile - the REST product file to store
      Gibt zurück:
      the updated REST product file (with ID and version)
      Löst aus:
      IllegalArgumentException - if the product cannot be found, or if the data for the product file is invalid (also, if a product file for the given processing facility already exists)
      ConcurrentModificationException - if the product file was modified since its retrieval by the client
      SecurityException - if a cross-mission data access was attempted
      javax.persistence.EntityNotFoundException