[OPENDJ-6805] Replace LDIFWriter with SDK's LdifEntryWriter Created: 20/Nov/19  Updated: 30/Jan/20  Resolved: 30/Jan/20

Status: Done
Project: OpenDJ
Component/s: core apis, core server
Affects Version/s: 7.0.0
Fix Version/s: 7.0.0

Type: Task Priority: Major
Reporter: Jean-Noël Rouvignac Assignee: Jean-Noël Rouvignac
Resolution: Fixed Votes: 0
Labels: None

Epic Link: Supportable SDK
Story Points: 5
Dev Assignee: Jean-Noël Rouvignac

 Description   

Steps:

  1. Remove LDIFExportConfig.typesOnly which is not used in production code
  2. Remove support for LDIFExportConfig.invokeExportPlugins (YAGNI)
  3. ...


 Comments   
Comment by Jean-Noël Rouvignac [ 21/Nov/19 ]

When replacing the fields from `LDIFWriter` by a single `LdifEntryWriter` field (baby-steps ) I faced a few problems:

  • LDIFWriter.writeEntry() returns a boolean to indicate whether the entry was exported or skipped.
    • There is no equivalent in LdifEntryWriter
  • LDIFWriter.writeComment(LocalizableMessage comment, int wrapColumn) accepts a wrapColumn parameter
    • It is unclear
      1. why this exists in addition to LDIFExportConfig.getWrapColumn()
      2. and whether the client code making use of it should 1) pass this value to LDIFExportConfig.setWrapColumn(), or 2) drop this value entirely
  • With LDIFWriter, there are logging traces to explain why an entry or specific attributes are excluded. There is no such thing with the SDK.

How should we proceed with these?

Comment by Matthew Swift [ 21/Nov/19 ]

It looks like LDIFWriter.writeEntry() returns a boolean in order for client code to track how many entries were written vs skipped. We could provide similar functionality in the LdifEntryWriter by keeping an internal counter and exposing the result via a getter.

Regarding LDIFWriter.writeComment(LocalizableMessage comment, int wrapColumn), I agree with your analysis. I don't know why this method is needed. Client code should have set the export config wrap column.

Finally, I don't think the logging is critical. I'm actually a little surprised that we've implemented the LdifEntryWriter like this. I'd expect it to be implemented as a couple of EntryWriters, one for writing to an output stream, and a wrapper implementation performing filtering. Perhaps it was to keep symmetry with the LdifEntryReader.

Comment by Jean-Noël Rouvignac [ 30/Jan/20 ]

Done. There is no additional work to do for QA.

Generated at Thu Aug 13 11:13:10 UTC 2020 using Jira 7.13.12#713012-sha1:6e07c38070d5191bbf7353952ed38f111754533a.