You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@camel.apache.org by "Willem Jiang (JIRA)" <ji...@apache.org> on 2012/07/12 04:59:33 UTC

[jira] [Assigned] (CAMEL-5438) Dynamic resolve property for CamelContext

     [ https://issues.apache.org/jira/browse/CAMEL-5438?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Willem Jiang reassigned CAMEL-5438:
-----------------------------------

    Assignee: Willem Jiang
    
> Dynamic resolve property for CamelContext
> -----------------------------------------
>
>                 Key: CAMEL-5438
>                 URL: https://issues.apache.org/jira/browse/CAMEL-5438
>             Project: Camel
>          Issue Type: New Feature
>          Components: camel-core
>    Affects Versions: 2.10.0
>            Reporter: Aleksey Sushko
>            Assignee: Willem Jiang
>
> If you read the description of the camel http4 component you can find an example set of parameters for a consumer.
> {code}
> <camelContext>
>   <properties>
>     <property key="http.proxyHost" value="172.168.18.9"/>
>     <property key="http.proxyPort" value="8080"/>
>   </properties>
> </camelContext>
> {code}
> In this example, the xml has no universal solution.
> I think that the universal solution is to use a property placeholder. In this case, you can use an external configuration.
> {code}
> <camelContext>
>   <properties>
>     <property key="http.proxyHost" value="{{http.proxyHost}}"/>
>     <property key="http.proxyPort" value="{{http.proxyPort}}"/>
>   </properties>
> </camelContext>
> {code}
> One possible solution is to replace the existing structure to access the property
> {code}
> String value = getCamelContext().getProperties().get("my_property");
> {code}
> Replace the call of the new method
> {code}
> String value = getCamelContext().getProperty("my_property");
> {code}
> Inside a method call to use the old design and a response sent to the method of resolvePropertyPlaceholders.
> {code:title=An example of implementation}
> public String getProperty(String name) { 
>    String value = getProperties().get(name); 
>    if(ObjectHelper.isNotEmpty(value)) 
>       value = resolvePropertyPlaceholders(value); 
>    return value; 
> }
> {code}

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira