camel-issues mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Aleksey Sushko (JIRA)" <j...@apache.org>
Subject [jira] [Updated] (CAMEL-5438) Dynamic resolve property for CamelContext
Date Wed, 11 Jul 2012 20:31:33 GMT

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

Aleksey Sushko updated CAMEL-5438:
----------------------------------

    Description: 
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().getProprties().get("my_property");
{code}
Replace the call of the new method
{code}
String value = getCamelContext().getProprty("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}

  was:
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().getProprties().get("my_property");
{code}
Replace the call of the new method
{code}
String value = getCamelContext().getProprties("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}

    
> 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
>
> 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().getProprties().get("my_property");
> {code}
> Replace the call of the new method
> {code}
> String value = getCamelContext().getProprty("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

        

Mime
View raw message