0

I want to do two things: Load a properties into a bean and update the bean when properties is updated.

I use JBoss Fuse 6.1 where to install my application bundle and have a properties file on the server where I need to read some configuration. The properties have the follow line:

mediaTypeList=JSON,DOCX,TXT

And I have a Java Bean that is a mirror of the file property:

public class MediatType {

    private List<String> mediaTypeList;

    // GETTERs and SETTERs

}

The property mediaTypeList indicate the list of HTTP MediaType that the application admit, and this list could be updated over time so the application have to see the changes.

The application receive file upload request and only if the file type is admited the file can be uploaded. To validate this I need to read the property file using a bean.

I use Apache Camel 2.12 and configure the route by Java DSL. Also I read this for loading properties in beans using PropertyPlaceholder but it does not fit my requirements.

Is there a way to do the above requirements with Apache Camel PropertyPlaceholder? Or there another way?

Regards,

Community
  • 1
  • 1
ffcc
  • 50
  • 1
  • 1
  • 10
  • 2
    Fuse uses Karaf. You should thus be able to utilize the [Configuration Admin Service](http://www.liquid-reality.de/display/liquid/2011/09/23/Karaf+Tutorial+Part+2+-+Using+the+Configuration+Admin+Service). – Ralf May 03 '16 at 13:52
  • Thanks @Ralf! I read the reference and it looks what I need. – ffcc May 03 '16 at 15:49
  • Do you use Fabric with JBoss fuse? or standalone? Also, do you use Blueprint or Spring or Java DSL? – Ramin Arabbagheri May 03 '16 at 18:20
  • I use a standalone server and Spring with Java DSL combined. All route builder I create using Java DSL and Spring to create the camel context where register route beans. – ffcc May 03 '16 at 19:51
  • @Ralf I migrate my configuration to OSGI Blueprint and works perfectly. I just configured a `cm:property-placeholder` with the attribute `update-strategy="reload"`. Thanks! – ffcc May 06 '16 at 19:07

1 Answers1

1

In blueprint file use cm:property-placeholder and create a property file with name sample.cfg and place it in $FUSE_HOME/etc folder

<cm:property-placeholder persistent-id="sample"
update-strategy="reload">
</cm:property-placeholder>

In camel route you can read property using

<from uri="timer:foo?period={{period}}" />
Ramu
  • 26
  • 2