You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@servicemix.apache.org by Jeroen Verhagen <je...@gmail.com> on 2010/08/11 10:36:50 UTC

Help overriding properties

Hi all,

I'm using a PropertyPlaceholderConfigurer to configure ftp locations
in my ftp SU. At deployment I want to override these properties for
different locations (test/acceptance/production) so that I will not
accidentally deploy a production release to test causing the wrong ftp
locations to be used with the possibly disastrous consequences of
production data being lost in the test machine.

I was thinking this could be done by adding a custom property file to
the $apache-servicemix/conf directory and then adding to service.xml
something like

  <bean id="propertyConfigurer"
class="org.springframework.beans.factory.config.PropertyPlaceholderConfigurer">
      <property name="location" value="classpath:servicemix.properties" />
      <property name="location" value="classpath:custom.properties" />
  </bean>

but this does not work. Also adding the overriden properties to
servicemix.properties does not seem to work.

I read on the mailinglist to look into Spring's
PropertyOverrideConfigurer. However this wants to directly set
properties on Spring beans, but I don't know how the following
ftp:poller translates into a Spring bean:

  <ftp:poller service="dsvcts:ftp"
            endpoint="pollerEndpoint"
            targetService="dsvcts:file"
            targetEndpoint="ftp-sender"
            uri="${ftp.poller.url}">
  </ftp:poller>

If the PropertyOverrideConfigurer is the way to go about this can
anybody please tell how to use this override the uri of this
ftp:poller?

Thanks for any help.

-- 

regards,

Jeroen

Re: Help overriding properties

Posted by Jean-Baptiste Onofré <jb...@nanthrax.net>.
Hi Jeroen,

the conf directory is not included in SMX classpath, that's why 
classpath:servicemix.properties doesn't work.

What you can do is :
- create a directory conf/services
- modify classworlds description (conf/servicemix.conf) to add 
conf/services in the classpath. You can add the conf directory into the 
classpath too. You should have something like:

main is org.apache.servicemix.Main from app

[app]
	load ${servicemix.home}/conf
	load ${servicemix.home}/conf/services
	load ${servicemix.home}/lib/*.jar
	load ${servicemix.home}/lib/optional/*.jar

After that you will be able to use both classpath:servicemix.properties 
and classpath:custom.properties.

Regards
JB

On 08/11/2010 10:36 AM, Jeroen Verhagen wrote:
> Hi all,
>
> I'm using a PropertyPlaceholderConfigurer to configure ftp locations
> in my ftp SU. At deployment I want to override these properties for
> different locations (test/acceptance/production) so that I will not
> accidentally deploy a production release to test causing the wrong ftp
> locations to be used with the possibly disastrous consequences of
> production data being lost in the test machine.
>
> I was thinking this could be done by adding a custom property file to
> the $apache-servicemix/conf directory and then adding to service.xml
> something like
>
>    <bean id="propertyConfigurer"
> class="org.springframework.beans.factory.config.PropertyPlaceholderConfigurer">
>        <property name="location" value="classpath:servicemix.properties" />
>        <property name="location" value="classpath:custom.properties" />
>    </bean>
>
> but this does not work. Also adding the overriden properties to
> servicemix.properties does not seem to work.
>
> I read on the mailinglist to look into Spring's
> PropertyOverrideConfigurer. However this wants to directly set
> properties on Spring beans, but I don't know how the following
> ftp:poller translates into a Spring bean:
>
>    <ftp:poller service="dsvcts:ftp"
>              endpoint="pollerEndpoint"
>              targetService="dsvcts:file"
>              targetEndpoint="ftp-sender"
>              uri="${ftp.poller.url}">
>    </ftp:poller>
>
> If the PropertyOverrideConfigurer is the way to go about this can
> anybody please tell how to use this override the uri of this
> ftp:poller?
>
> Thanks for any help.
>