Camel
  1. Camel
  2. CAMEL-2791

Properties component - Add option to let it look first/last for JVM system property

    Details

    • Type: New Feature New Feature
    • Status: Closed
    • Priority: Minor Minor
    • Resolution: Fixed
    • Affects Version/s: 2.3.0
    • Fix Version/s: Future
    • Component/s: camel-core
    • Labels:
      None

      Description

      See nabble
      http://old.nabble.com/File-Consumer-directoryName-problem-ts28777347.html

      By default the properties component will only resolve properties from properties files.
      But sometimes you may want to be able to set a JVM system property with either override or is used as fallback in case of a key. Such as if a key is missing it can fallback to a JVM key. Or a JVM key can override an existing key in the properties file.

      There are no Sub-Tasks for this issue.

        Activity

        Hide
        Claus Ibsen added a comment -

        Closing all resolved tickets from 2010 or older

        Show
        Claus Ibsen added a comment - Closing all resolved tickets from 2010 or older
        Hide
        Ashwin Karpe added a comment - - edited

        Updated, tested and committed to revision 992299 and fixed and committed with Claus' final recommendation to 992302.

        Show
        Ashwin Karpe added a comment - - edited Updated, tested and committed to revision 992299 and fixed and committed with Claus' final recommendation to 992302.
        Hide
        Claus Ibsen added a comment -

        You still must set the replaced

        This should be kept as the first code line as it was in the original source code.

        +            replaced.add(placeholderPart);
        

        Otherwise +1

        Show
        Claus Ibsen added a comment - You still must set the replaced This should be kept as the first code line as it was in the original source code. + replaced.add(placeholderPart); Otherwise +1
        Hide
        Ashwin Karpe added a comment -

        Hi All,

        Please find the updated fix with all the required updates. I have cleared the system properties (Yikes!!!) and changed the log message to info.

        Cheers,

        Ashwin...

        Show
        Ashwin Karpe added a comment - Hi All, Please find the updated fix with all the required updates. I have cleared the system properties (Yikes!!!) and changed the log message to info. Cheers, Ashwin...
        Hide
        Ashwin Karpe added a comment -

        Oops... Missed that. I will reset the system properties after the test...

        I will incorporate your changes and check it in...

        Cheers,

        Ashwin...

        Show
        Ashwin Karpe added a comment - Oops... Missed that. I will reset the system properties after the test... I will incorporate your changes and check it in... Cheers, Ashwin...
        Hide
        Claus Ibsen added a comment -

        You always need to add the value to the replaced, so Camel can keep track.

        And I think a WARN log is a bit rough, it should just be INFO or DEBUG level.
        And its called a JVM system property. And you should output its value also.

        Show
        Claus Ibsen added a comment - You always need to add the value to the replaced, so Camel can keep track. And I think a WARN log is a bit rough, it should just be INFO or DEBUG level. And its called a JVM system property. And you should output its value also.
        Hide
        Willem Jiang added a comment -

        Hi Ashwin,

        Just one comments of the unit test, please remove the system property when you finish the test.
        As we are not forking a new JVM per test case, which means you need to clean up the system property yourself.

        Regards,

        Willem

        Show
        Willem Jiang added a comment - Hi Ashwin, Just one comments of the unit test, please remove the system property when you finish the test. As we are not forking a new JVM per test case, which means you need to clean up the system property yourself. Regards, Willem
        Hide
        Ashwin Karpe added a comment -

        Hi Claus,

        Please find attached a patch for this issue. It is a small fix. I have performed the necessary checkstyle sourcecheck, and added a unit test to verify that it works.

        I will check it in tomorrow a.m after incorporating any final comments you may have.

        Cheers,

        Ashwin...

        Show
        Ashwin Karpe added a comment - Hi Claus, Please find attached a patch for this issue. It is a small fix. I have performed the necessary checkstyle sourcecheck, and added a unit test to verify that it works. I will check it in tomorrow a.m after incorporating any final comments you may have. Cheers, Ashwin...
        Hide
        Ashwin Karpe added a comment -

        Hi Claus,

        After implementing this fix as an override, there is no need to add a system scheme to the properties component. If the environment variable is available its value will be picked up overriding the property value in another property location.

        I am implementing only the requirement expressed in the issue above.

        Cheers,

        Ashwin...

        Show
        Ashwin Karpe added a comment - Hi Claus, After implementing this fix as an override, there is no need to add a system scheme to the properties component. If the environment variable is available its value will be picked up overriding the property value in another property location. I am implementing only the requirement expressed in the issue above. Cheers, Ashwin...
        Hide
        Ashwin Karpe added a comment -

        Ok cool. Looks like you like the idea for "system:..". I will implement that as well...

        Cheers,

        Ashwin...

        Show
        Ashwin Karpe added a comment - Ok cool. Looks like you like the idea for "system:..". I will implement that as well... Cheers, Ashwin...
        Hide
        Ashwin Karpe added a comment - - edited

        Hi Claus,

        Sure, No worries... I was reviewing the component code and wanted my approach to be clear as to whether we were doing a load of system properties using a location "system:..." or whether it as a default fallback to do a lookup and adjust.

        I will implement the solution as an override and provide fallback as a check before giving up.

        Do you think there is any merit to adding a "system:..." as an addtional way of injecting properties independently like "file:..."?

        Please let me know.

        Cheers,

        Ashwin...

        Show
        Ashwin Karpe added a comment - - edited Hi Claus, Sure, No worries... I was reviewing the component code and wanted my approach to be clear as to whether we were doing a load of system properties using a location "system:..." or whether it as a default fallback to do a lookup and adjust. I will implement the solution as an override and provide fallback as a check before giving up. Do you think there is any merit to adding a "system:..." as an addtional way of injecting properties independently like "file:..."? Please let me know. Cheers, Ashwin...
        Hide
        Claus Ibsen added a comment -

        Ashwin the idea is that you can override an existing property with a JVM system property. For example if something is wrong, then you can quickly remedy the issue by overriding the property from the JVM command line.

        The other idea is to have it to fallback to a system property if no property exists with the given key.
        So I was looking for adding a switch to the PropertiesComponent to dictate this behavior.

        To have an system scheme in the properties component. Yeah why not. The bits are already there as we got that in the simple language as well.

        Show
        Claus Ibsen added a comment - Ashwin the idea is that you can override an existing property with a JVM system property. For example if something is wrong, then you can quickly remedy the issue by overriding the property from the JVM command line. The other idea is to have it to fallback to a system property if no property exists with the given key. So I was looking for adding a switch to the PropertiesComponent to dictate this behavior. To have an system scheme in the properties component. Yeah why not. The bits are already there as we got that in the simple language as well.

          People

          • Assignee:
            Ashwin Karpe
            Reporter:
            Claus Ibsen
          • Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved:

              Development