Uploaded image for project: 'Karaf'
  1. Karaf
  2. KARAF-717

Refactor Actions to get services injected instead of fetching them

    Details

    • Type: Improvement
    • Status: Closed
    • Priority: Minor
    • Resolution: Not A Problem
    • Affects Version/s: None
    • Fix Version/s: None
    • Component/s: karaf
    • Labels:
      None

      Description

      Currently we use abstract classes like ObrCommandSupport and OsgiCommandSupport to handle the bundleContext and service references.
      This makes the code harder to test and mixes technical and business code. By business I mean the stuff the class is meant to do by technical I mean other domains like osgi services.

      So I propose to inject the services we need using blueprint so in the Action there is only the interface to the service and a setter. Additionally I would even skip the AbstractAction as it is not good to store the CommandSession in a class attribute as this makes the code non reentrant.

      I have done a sample refactoring in http://svn.apache.org/viewvc?view=revision&revision=1144288

      It shows how to change the ListCommand of the Obr to not need any abstract support classes to handle the RepositoryAdmin service.

      This issue is a marker that we should do the refactoring and should be split into smaller tasks when we start the refactoring.

        Attachments

          Activity

            People

            • Assignee:
              Unassigned
              Reporter:
              chris@die-schneider.net Christian Schneider
            • Votes:
              0 Vote for this issue
              Watchers:
              1 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved: