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

Service PID for a JSON configuration

Attach filesAttach ScreenshotVotersWatch issueWatchersCreate sub-taskLinkCloneUpdate Comment AuthorReplace String in CommentUpdate Comment VisibilityDelete Comments
    XMLWordPrintableJSON

Details

    • Improvement
    • Status: Resolved
    • Minor
    • Resolution: Fixed
    • 4.4.3
    • 4.4.4, 4.3.10
    • karaf
    • None

    Description

      I tried to use a  json configuration with Karaf 4.4.3. For example I
      created a test.cfg.json:

      {
        "test1":"testString",
        "test2":false
      } 

      I can see that Karaf read this config viac config:list

      Pid:            test.cfg
      BundleLocation: ?
      Properties:
         felix.fileinstall.filename =
      file:/home/jakub/java/apache-karaf-4.4.3/etc/test.cfg.json
         service.pid = test.cfg
         test1 = testString
         test2 = false 

      But what is little surprise for me is that a service pid is
      "test.cfg". I assume that cfg.json is an extension for json files in
      the Karaf and the service pid is constructed as <pid>.cfg.json. We
      have lot of blueprints where config (with cfg extension) is referenced
      with "<pid>.cfg" scheme. That is why I will have to change lot of
      files if it is necessary to append .cfg for every
      cm:managed-properties elements.

      Service PID for JSON is created by this method

          public static ConfigurationPID parseFilename(final String filename) {
              final String pid = filename.substring(0, filename.lastIndexOf('.'));
              return parsePid(pid);
          } 

      As for me it would be better if parseFilename created pid also from a
      file extension, what do you mean? Pid will be the same i.e .cfg
      .config .cfg.json all will have the same pid.

      Attachments

        Activity

          This comment will be Viewable by All Users Viewable by All Users
          Cancel

          People

            jbonofre Jean-Baptiste Onofré
            jherkel Jakub Herkel
            Votes:
            0 Vote for this issue
            Watchers:
            4 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:

              Slack

                Issue deployment