Class LdifRecord

All Implemented Interfaces:
Serializable

public class LdifRecord extends BasicDirRecord
This class represents an entire ldif record. As yet, this is an incomplete implementation. Not all aspects of ldif, as defined in RFC2849 are implemented. No schema checking is carried out by this class and only version 1 is supported. While we may later allow enforcement of the rule that only changes or content be present on a stream, for the present we will allow a mixed stream.

ldif-content records are largely implemented. The result of calling read with a valid ldif-content input stream is that the record will be populated with a dn and attributes with values and the stream will be left positioned at the start of the next record. The resulting record can be written as a directory record.

ldif-changes records are partially (and possibly incorrectly) implemented. deletions are complete. A delete record consists of a dn only. adds are complete. An add record is the same as a content record. modify is incomplete.

Attribute options are not yet implemented nor recognized. base64 encoded dns may be improperly converted to strings. We may need to specify the locale. (May be true of any encoded value) URL values not implemented.

While reading input we can be in a number of states. An ldif record consists of:

  • dn
  • controls
  • changetype
  • <attributes-or-changes>
All except the dn are sort of optional. If we don't have a changetype in the appropriate place then, once we have started processing attributes, we may have an attribute named changetype.
See Also:
  • Field Details

    • changeTypes

      public static final String[] changeTypes
  • Constructor Details

    • LdifRecord

      public LdifRecord()
      Create an LdifRecord object ready for further processing.
  • Method Details

    • clear

      public void clear()
      Description copied from class: DirRecord
      Should be overriden to clear attributes.
      Overrides:
      clear in class BasicDirRecord
    • read

      public boolean read(LdifRecord.Input in) throws NamingException
      Read an entire ldif record from an input stream
      Parameters:
      in - Input object to read from input stream
      Returns:
      boolean true if we read some ldif data. false if there was no data
      Throws:
      NamingException
    • setMods

      public void setMods(ModificationItem[] val)
    • getMods

      public ModificationItem[] getMods() throws NamingException
      Overrides:
      getMods in class DirRecord
      Returns:
      ModificationItem[]
      Throws:
      NamingException
    • writeInputData

      public boolean writeInputData(Writer wtr) throws Throwable
      Write the data we built this from
      Parameters:
      wtr - Writer to write to
      Returns:
      boolean false for no data
      Throws:
      Throwable
    • write

      public void write(Writer wtr) throws Throwable
      Write an ldif record representing this object
      Parameters:
      wtr - Writer to write to
      Throws:
      Throwable