code: public void store(DataSources metadata, XMLStreamWriter writer) throws Exception
     {
        if (metadata != null && writer != null)
        {
           writer.writeStartElement(XML.ELEMENT_DATASOURCES);
  
           if (metadata.getDataSource() != null && !metadata.getDataSource().isEmpty())
           {
              for (DataSource ds : metadata.getDataSource())
              {
                 storeDataSource(ds, writer);
              }
           }
           if (metadata.getXaDataSource() != null && !metadata.getXaDataSource().isEmpty())
           {
              for (XaDataSource xads : metadata.getXaDataSource())
              {
                 storeXaDataSource(xads, writer);
              }
           }
           if (metadata.getDrivers() != null && !metadata.getDrivers().isEmpty())
           {
              writer.writeStartElement(XML.ELEMENT_DRIVERS);
              for (Driver drv : metadata.getDrivers())
              {
                 storeDriver(drv, writer);
              }
              writer.writeEndElement();
           }
  
           writer.writeEndElement();
        }
     }
docs: Store a -ds.xml file
  @param metadata The datasource definitions
  @param writer The writer
  @exception Exception Thrown if an error occurs