Karaf
  1. Karaf
  2. KARAF-762

dev:watch should support multiple bundle IDs

    Details

    • Type: Improvement Improvement
    • Status: Closed
    • Priority: Minor Minor
    • Resolution: Fixed
    • Affects Version/s: 2.2.2, 3.0.0
    • Fix Version/s: 2.2.4, 3.0.0
    • Component/s: karaf-shell
    • Labels:
      None

      Description

      if you want to watch multiple bundle you have to re-issue the dev:watch command for every bundle to be watched.
      if dev:watch would accept a list of bundle Ids this would help.

        Activity

        Hide
        Jean-Baptiste Onofré added a comment -

        The most efficient is to extend org.apache.karaf.shell.osgi.BundlesCommand which already supports multi-bundle selection.

        More over, the bundle selection filter (by name, version, version range, bundle id, regex, etc) will be implemented in this class.

        It makes sense that the BundlesCommand, BundleCommand, etc will be part of a shell.util module.

        Show
        Jean-Baptiste Onofré added a comment - The most efficient is to extend org.apache.karaf.shell.osgi.BundlesCommand which already supports multi-bundle selection. More over, the bundle selection filter (by name, version, version range, bundle id, regex, etc) will be implemented in this class. It makes sense that the BundlesCommand, BundleCommand, etc will be part of a shell.util module.
        Hide
        Jean-Baptiste Onofré added a comment -

        After digging into this, more than creating a new shell.util module, as OsgiCommandSupport is in shell.console module, BundlesCommandSupport could be define in this module too.

        Show
        Jean-Baptiste Onofré added a comment - After digging into this, more than creating a new shell.util module, as OsgiCommandSupport is in shell.console module, BundlesCommandSupport could be define in this module too.
        Hide
        Jean-Baptiste Onofré added a comment -

        I'm confused, dev:watch doesn't take a bundle ID. It takes a bundle URL (supporting regex). So I guess that you mean by able to define several regex like:

        dev:watch mvn:my/my1* mvn:my/my2

        Show
        Jean-Baptiste Onofré added a comment - I'm confused, dev:watch doesn't take a bundle ID. It takes a bundle URL (supporting regex). So I guess that you mean by able to define several regex like: dev:watch mvn:my/my1* mvn:my/my2
        Hide
        Jean-Baptiste Onofré added a comment -

        Nevermind, in fact the dev:watch command supports both but the --help is not correct. It should also be fixed.

        Show
        Jean-Baptiste Onofré added a comment - Nevermind, in fact the dev:watch command supports both but the --help is not correct. It should also be fixed.
        Hide
        Glen Mazza added a comment -

        I'm not sure dev:watch takes bundle IDs – it just seems to treat it as a URL, even if it doesn't make sense.

        karaf@root> dev:watch
        No watched urls
        karaf@root> dev:watch 23
        Adding watched urls
        Watched urls:
        23
        karaf@root> dev:watch 23-34
        Adding watched urls
        Watched urls:
        23
        23-34
        karaf@root> dev:watch 2314
        Adding watched urls
        Watched urls:
        23
        23-34
        2314
        karaf@root> dev:watch
        Watched urls:
        23
        23-34
        2314

        But the --help information for dev:watch still needs some elaboration IMO. It currently says:

        The watch command can be used to help at developement time. It allows you to configure a set of URLs that will be monitored. All bundles location matching the given URL will be automatically updated. This avoids the need for manually updating the bundles or even copying the bundle to the system folder if needed. Note that only maven based urls and maven snapshots will actually be updated automatically, so if you run
        > dev:watch *
        It will actually monitor all bundles that have a location matching mvn:* that have '-SNAPSHOT' in their url.

        Problems:

        1.) It doesn't tell us what "monitoring" or "watching" really means – what does watching a bundle URL mean? I think it means when the bundle in the Maven repo has been updated that it will automatically refresh in Karaf as well.

        2.) The example I think is bad, because it will monitor bundles that also don't have the "-SNAPSHOT" in their URL. (Actually dev:watch * means watch everything? What is being watched in that case? How does it watch every Maven URL – how does it know what the full list of Maven URLs are? Confused.)

        3.) The text says "even copying the bundle to the system folder if needed" is no longer necessary. I'm not sure why it wouldn't be--does this mean Karaf will automatically copy over the bundle from the Maven repo to the system folder (physically replace it), or just ignore it and instead just reference what's in the Maven repo, or?

        4.) Some grammatical typos.

        I've attached a patch that I believe fixes (1), (2), and (4) – (3) I'm leaving vague because I don't know the answer to that.

        Show
        Glen Mazza added a comment - I'm not sure dev:watch takes bundle IDs – it just seems to treat it as a URL, even if it doesn't make sense. karaf@root> dev:watch No watched urls karaf@root> dev:watch 23 Adding watched urls Watched urls: 23 karaf@root> dev:watch 23-34 Adding watched urls Watched urls: 23 23-34 karaf@root> dev:watch 2314 Adding watched urls Watched urls: 23 23-34 2314 karaf@root> dev:watch Watched urls: 23 23-34 2314 But the --help information for dev:watch still needs some elaboration IMO. It currently says: The watch command can be used to help at developement time. It allows you to configure a set of URLs that will be monitored. All bundles location matching the given URL will be automatically updated. This avoids the need for manually updating the bundles or even copying the bundle to the system folder if needed. Note that only maven based urls and maven snapshots will actually be updated automatically, so if you run > dev:watch * It will actually monitor all bundles that have a location matching mvn:* that have '-SNAPSHOT' in their url. Problems: 1.) It doesn't tell us what "monitoring" or "watching" really means – what does watching a bundle URL mean? I think it means when the bundle in the Maven repo has been updated that it will automatically refresh in Karaf as well. 2.) The example I think is bad, because it will monitor bundles that also don't have the "-SNAPSHOT" in their URL. (Actually dev:watch * means watch everything? What is being watched in that case? How does it watch every Maven URL – how does it know what the full list of Maven URLs are? Confused.) 3.) The text says "even copying the bundle to the system folder if needed" is no longer necessary. I'm not sure why it wouldn't be--does this mean Karaf will automatically copy over the bundle from the Maven repo to the system folder (physically replace it), or just ignore it and instead just reference what's in the Maven repo, or? 4.) Some grammatical typos. I've attached a patch that I believe fixes (1), (2), and (4) – (3) I'm leaving vague because I don't know the answer to that.
        Hide
        Achim Nierbeck added a comment -

        I applied patch for documentation

        Show
        Achim Nierbeck added a comment - I applied patch for documentation
        Hide
        Jean-Baptiste Onofré added a comment -

        Even if we had a leak on the documentation, the dev:watch behavior looks correct to me:

        • we register URLs (supporting regex) to monitor
        • we can show the list of monitored URLs
        • if an URL contains a new version of an artifact, it''s updated

        So, even if dev:watch accept a bundle ID, it considers it as an URL regex

        Show
        Jean-Baptiste Onofré added a comment - Even if we had a leak on the documentation, the dev:watch behavior looks correct to me: we register URLs (supporting regex) to monitor we can show the list of monitored URLs if an URL contains a new version of an artifact, it''s updated So, even if dev:watch accept a bundle ID, it considers it as an URL regex
        Hide
        Jean-Baptiste Onofré added a comment -

        OK got it.

        In fact, in the BundleWatcher, the getBundlesByURL(String url) check if url is a long (and so a bundle ID). If it's not a long, it's really an URL regex.

        I'm gonna enhance this method, to:

        • split the String with " "
        • after, for each token, check if it's an ID or String
        Show
        Jean-Baptiste Onofré added a comment - OK got it. In fact, in the BundleWatcher, the getBundlesByURL(String url) check if url is a long (and so a bundle ID). If it's not a long, it's really an URL regex. I'm gonna enhance this method, to: split the String with " " after, for each token, check if it's an ID or String
        Hide
        Jean-Baptiste Onofré added a comment -

        Added on trunk: revision 1179400.

        Show
        Jean-Baptiste Onofré added a comment - Added on trunk: revision 1179400.
        Hide
        Jean-Baptiste Onofré added a comment -

        Added on karaf-2.2.x: revision 1179401.

        Show
        Jean-Baptiste Onofré added a comment - Added on karaf-2.2.x: revision 1179401.

          People

          • Assignee:
            Jean-Baptiste Onofré
            Reporter:
            Achim Nierbeck
          • Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved:

              Development