Uploaded image for project: 'Directory Studio'
  1. Directory Studio
  2. DIRSTUDIO-958

Exporting schemas as OpenLDAP files outputs entries in random order

    Details

    • Type: Bug
    • Status: Resolved
    • Priority: Minor
    • Resolution: Fixed
    • Affects Version/s: 2.0.0-M8 (2.0.0.v20130628)
    • Component/s: studio-schemaeditor
    • Labels:
      None
    • Environment:
      Ubuntu 12.04 x86_64
      Java 1.7.0_45-b18

      Description

      To reproduce:
      1. Create two separate schema projects; for example one online and one offline from the same server
      2. Open schema editor, choose the online project, select 'apache' schema, right click, choose Export -> Schemas as OpenLDAP files. See the generated file.
      3. Open the offline project, export 'apache' schema as described above
      4. Files differ although the schema is the same!

      It seems that the order of entries during schema export is random. It would be correct if entries are sorted by type first, then by OID.

      Note that the random order may cause problems when the exported schema is used in some directory servers - you may have a parent object class appear after its child object class. As result a directory server will report schema as invalid due to 'missing' parent object class.

        Activity

        Hide
        seelmann Stefan Seelmann added a comment -

        Actually the order is not random, but the same order the schema objects were added to the project. For online project the schema objects are exported in the same order as received from the server. And attribute types are always exported first, then object classes.

        That said I agree that it makes sense to export them using their hierarchical order.

        I wonder if we can reuse existing code (e.g. Registries) to build the hierarchy and allows to traverse them for export? I see some difficulties because a single schema (in the sense of what we call schema in the Studio schema editor, a set of object classes and attribute types) on its own may not be valid as AT and OC not included in the schema may be referenced.

        Show
        seelmann Stefan Seelmann added a comment - Actually the order is not random, but the same order the schema objects were added to the project. For online project the schema objects are exported in the same order as received from the server. And attribute types are always exported first, then object classes. That said I agree that it makes sense to export them using their hierarchical order. I wonder if we can reuse existing code (e.g. Registries) to build the hierarchy and allows to traverse them for export? I see some difficulties because a single schema (in the sense of what we call schema in the Studio schema editor, a set of object classes and attribute types) on its own may not be valid as AT and OC not included in the schema may be referenced.
        Hide
        elecharny Emmanuel Lecharny added a comment -

        There is no guarantee that the server will return a schema in any specific order. We can still order the returned element, but its impossible to get back the same order than the original file.

        Show
        elecharny Emmanuel Lecharny added a comment - There is no guarantee that the server will return a schema in any specific order. We can still order the returned element, but its impossible to get back the same order than the original file.
        Hide
        seelmann Stefan Seelmann added a comment -
        Show
        seelmann Stefan Seelmann added a comment - AT and OC are now ordered hierarchically: http://svn.apache.org/r1547587 http://svn.apache.org/r1547588 http://svn.apache.org/r1547602

          People

          • Assignee:
            seelmann Stefan Seelmann
            Reporter:
            pkubowicz Piotr Kubowicz
          • Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved:

              Development