StructureWriterManager

The StructureWritingManager is responsible for writing SDMX or EDI output to an output stream. SDMX output comes in many different formats and versions. For example a 2.0 message containing structures could be a StructureDocument, a RegistryInterfaceDocument, or even a RegistryQueryResponseDocument.


Demo Project

The demo project is a Java Web Application, that when launched will expose a RESTful web service. The REST web service is a URL that when entered in a browser, will display a SDMX Structure Document containing a single codelist.

The demo project demonstrates a few things:

  • How to integrate Spring into a web application
  • How to weave dependencies into a Class which is not a singleton (like the servlet)
  • How to create SDMXBeans from an SDMXMutable Bean
  • How to easily output a SdmxBean as SDMX-ML
  • How to easily create a RESTful web service


To download the sample project click Here.


Code Sample

Some sample code for writing a structure to an OutputStream is shown below

  @Autowired
  private StructureWritingManager structureWritingManager;

  /**
   * Writes out the contents of the SdmxBeans container as a Sdmx Version 2.1 Structure Document
   * to the OuputStream provided
   /
  public void writeStructuresV21(SdmxBeans beans, OutputStream out)  {
     structureWritingManager.writeStructures(beans,
                                  STRUCTURE_OUTPUT_FORMAT.SDMX_V21_STRUCTURE_DOCUMENT,
                                  out);
  }