Class StructuredTextWriter

java.lang.Object
org.eso.ias.cdb.structuredtext.StructuredTextWriter
All Implemented Interfaces:
CdbWriter

public class StructuredTextWriter extends Object implements CdbWriter
  • Field Details

    • initialized

      protected final AtomicBoolean initialized
      Signal if the reader has been initialized
    • closed

      protected final AtomicBoolean closed
      Signal if the reader has been closed
    • cdbFileNames

      protected final CdbFiles cdbFileNames
      cdbFileNames return the names of the files to read
    • cdbFilesType

      public final TextFileType cdbFilesType
      The type of the files of the CDB
  • Constructor Details

    • StructuredTextWriter

      public StructuredTextWriter(CdbFiles cdbFileNames)
      Constructor
      Parameters:
      cdbFileNames - The files of the CDB
    • StructuredTextWriter

      public StructuredTextWriter(File parentFolder) throws IasCdbException
      Throws:
      IasCdbException
  • Method Details

    • init

      public void init() throws IasCdbException
      Initialize the CDB
      Specified by:
      init in interface CdbWriter
      Throws:
      IasCdbException
    • shutdown

      public void shutdown() throws IasCdbException
      Close the CDB and release the associated resources
      Specified by:
      shutdown in interface CdbWriter
      Throws:
      IasCdbException
    • getObjectMapper

      protected com.fasterxml.jackson.databind.ObjectMapper getObjectMapper()
      Get the ObjectMapper depending on the type of files in the CDB
      Returns:
      The ObjectMapper to parse the files
    • writeIas

      public void writeIas(IasDao ias) throws IasCdbException
      Serialize the ias in the JSON file.
      Specified by:
      writeIas in interface CdbWriter
      Parameters:
      ias - The IAS configuration to write in the file
      Throws:
      IasCdbException - In case of error writing the IAS
    • writeSupervisor

      public void writeSupervisor(SupervisorDao superv) throws IasCdbException
      Serialize the Supervisor in the JSON file.
      Specified by:
      writeSupervisor in interface CdbWriter
      Parameters:
      superv - The Supervisor configuration to write in the file
      Throws:
      IasCdbException - In case of error writing the Supervisor
    • writeIasio

      public void writeIasio(IasioDao iasio, boolean append) throws IasCdbException
      Serialize the IASIO in the structured text file by delegation to writeIasios(Set, boolean)
      Specified by:
      writeIasio in interface CdbWriter
      Parameters:
      iasio - The IASIO configuration to write in the file
      append - : if true the passed iasio is appended to the file otherwise a new file is created
      Throws:
      IasCdbException - In case of error writing the IASIO
      See Also:
    • writeIasios

      public void writeIasios(Set<IasioDao> iasios, boolean append) throws IasCdbException
      Serialize the IASIOs in the JSON file.

      If append is false then a new file is created otherwise the IASIOs in the passed files are written at the end of the file.
      If a IASIO in iasios already exists in the file, the latter is replaced by that in the set.

      Specified by:
      writeIasios in interface CdbWriter
      Parameters:
      iasios - The IASIOs to write in the file
      append - : if true the passed iasios are appended to the file otherwise a new file is created
      Throws:
      IasCdbException - In case of error writing the IASIOs
      See Also:
    • writeDasu

      public void writeDasu(DasuDao dasu) throws IasCdbException
      Serialize the DASU in the JSON file.
      Specified by:
      writeDasu in interface CdbWriter
      Parameters:
      dasu - The DASU configuration to write in the file
      Throws:
      IasCdbException - In case of error writing the DASU
    • writeAsce

      public void writeAsce(AsceDao asce) throws IasCdbException
      Serialize the ASCE in the JSON file.
      Specified by:
      writeAsce in interface CdbWriter
      Parameters:
      asce - The ASCE configuration to write in the file
      Throws:
      IasCdbException - In case of error writing the ASCE
    • writeTransferFunction

      public void writeTransferFunction(TransferFunctionDao transferFunction) throws IasCdbException
      Write the transfer function to the CDB
      Specified by:
      writeTransferFunction in interface CdbWriter
      Parameters:
      transferFunction - The TF configuration to write in the file
      Throws:
      IasCdbException - In case of error writing the TF
    • writeTemplate

      public void writeTemplate(TemplateDao templateDao) throws IasCdbException
      Write the passed template to the CDB
      Specified by:
      writeTemplate in interface CdbWriter
      Parameters:
      templateDao - The template DAO to write in the file
      Throws:
      IasCdbException - In case of error writing the TF
    • writePluginConfig

      public void writePluginConfig(PluginConfigDao pluginConfigDao) throws IasCdbException
      Write the configuration of the passed plugin
      Specified by:
      writePluginConfig in interface CdbWriter
      Parameters:
      pluginConfigDao - the configuraton of the plugin
      Throws:
      IasCdbException - In case of error writing the configuration
    • writeClientConfig

      public void writeClientConfig(ClientConfigDao clientConfigDao) throws IasCdbException
      Write the configuration of the client with the passed identifier. The configuration is written as it is i.e. without converting to JSON because the format of the config is defined by each client
      Specified by:
      writeClientConfig in interface CdbWriter
      Parameters:
      clientConfigDao - the configuraton of the client
      Throws:
      IasCdbException - In case of error writing the configuration