code: public void publish(Collection<? extends WorkUnitState> states)
        throws IOException {
      if (shouldPublishMetadataFirst()) {
        publishMetadata(states);
        publishData(states);
      } else {
        publishData(states);
        publishMetadata(states);
      }
    }
docs: First publish the metadata via {@link DataPublisher#publishMetadata(Collection)}, and then publish the output data
  via the {@link DataPublisher#publishData(Collection)} method.
  
  @param states is a {@link Collection} of {@link WorkUnitState}s.
  @throws IOException if there is a problem with publishing the metadata or the data.