Uploaded image for project: 'Directory Client API'
  1. Directory Client API
  2. DIRAPI-170

Allow StandaloneLdapApiServices to be configured without system properties

    Details

    • Type: Improvement
    • Status: Closed
    • Priority: Critical
    • Resolution: Fixed
    • Affects Version/s: 1.0.0-M20
    • Fix Version/s: 1.0.0-M21
    • Labels:
      None

      Description

      Requiring configuration via system properties makes the client api near unusable in situations where you do not control startup of the application (like in a web container).

      Also, DI containers don't work well with the Singleton factory approach as you don't control the order in which your beans are constructed so you would have to be careful to initialize the factory with your hand constructed service in every place that it might be used or the default service may be initialized first forcing your custom initialization to fail.

      Finally, it just make sense to allow an LdapNetworkConnection to be configured independent of any other LdapNetworkConnection.

      1. DIRAPI-170.patch
        17 kB
        lucas theisen

        Activity

        Hide
        ltheisen@mitre.org lucas theisen added a comment -

        I attached a patch for this issue. It was a little more difficult than expected as there are many classes that just assume the singleton factory is the place to get the service from so even if I construct an LdapNetworkConnection with a hand configured service api, its parent class was using the singleton factory to look it up again (which is odd, why would LdapNetworkConnection have its own instance var instead of using its parents). And other places did the same thing. So I went through and added an overloaded constructor in all the places that mattered so that if you supply an LdapApiService to the LdapNetworkConnection constructor, all things created by that connection will also use that service (I trusted the unit tests rather than checking every line of code).

        Show
        ltheisen@mitre.org lucas theisen added a comment - I attached a patch for this issue. It was a little more difficult than expected as there are many classes that just assume the singleton factory is the place to get the service from so even if I construct an LdapNetworkConnection with a hand configured service api, its parent class was using the singleton factory to look it up again (which is odd, why would LdapNetworkConnection have its own instance var instead of using its parents). And other places did the same thing. So I went through and added an overloaded constructor in all the places that mattered so that if you supply an LdapApiService to the LdapNetworkConnection constructor, all things created by that connection will also use that service (I trusted the unit tests rather than checking every line of code).
        Hide
        akiran Kiran Ayyagari added a comment -

        Thanks Lucas for the patch, it was committed here http://svn.apache.org/r1555852

        Show
        akiran Kiran Ayyagari added a comment - Thanks Lucas for the patch, it was committed here http://svn.apache.org/r1555852
        Hide
        elecharny Emmanuel Lecharny added a comment -

        Closing the resolved issues.

        Show
        elecharny Emmanuel Lecharny added a comment - Closing the resolved issues.

          People

          • Assignee:
            elecharny Emmanuel Lecharny
            Reporter:
            ltheisen@mitre.org lucas theisen
          • Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved:

              Development