You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@camel.apache.org by souciance <so...@gmail.com> on 2016/03/09 17:37:00 UTC

Camel reference property files with and without OSGI

Hi,

I understand that if you deploy our Camel project to an OSGI environment
like Karaf you can simply write:

<cm:property-placeholder id="INT001_SelfServiceMachine_Properties"
persistent-id="INT001_SelfServiceMachine" />

<camelContext xmlns="http://camel.apache.org/schema/blueprint"
		id="INT001_SelfServiceMachine" useMDCLogging="true">
		<propertyPlaceholder id="properties"
location="blueprint:INT001_SelfServiceMachine_Properties"/>

And this works when the project is deployed to Karaf and the property file
is located there.

But how can you configure it when Karaf is not available?

I used this bean before:
	

But is there a single way to refer to property files regardless of when you
are in Karaf or when you are in your e.g. Eclipse and your property file is
in your /src/resources folder and the bean above works? For instance, when
you use Jenkins and and want to run tests and build the bundle, you may not
have Karaf available.

Thanks for any input on this.

Best
Souciance
		





--
View this message in context: http://camel.465427.n5.nabble.com/Camel-reference-property-files-with-and-without-OSGI-tp5778806.html
Sent from the Camel - Users mailing list archive at Nabble.com.

Re: Camel reference property files with and without OSGI

Posted by souciance <so...@gmail.com>.
Hi,

I am using 2.16.1 and Karaf 4.0.2.

I am not sure if I understand you correctly. Do you mean that I need
to define default properties for every single property in the
blueprint during development and testing, and then when the bundle is
deployed, these values are overridden by the cfg file as that is
loaded by Karaf?

Could you explain what you mean by "specificy them to CBTS in a comma
delimited string"?

Best
Souciance

On Wed, Mar 9, 2016 at 5:59 PM, Ranx [via Camel]
<ml...@n5.nabble.com> wrote:
> What version are you using?  You shouldn't have to replicate the definition
> into Camel context like that anymore.
>
>         <cm:property-placeholder persistent-id="my.persistent.id">
>                 <cm:default-properties>
>                         <cm:property name="someAddress"
> value="http://localhost" />
>
>                         <cm:property name="someValue" value="true" />
>                 </cm:default-properties>
>         </cm:property-placeholder>
>
> You can use the default properties for your testing and override them in
> your .cfg file for deployment.
>
> someAddress=http://anotheraddress.com
> someValue=false
>
> In CamelBlueprintTestSupport you can also override the properties.  You can
> also assign a cfg file in there but I haven't found that to work very well.
>
> I commonly keep my blueprint-properties.xml separate from my other camel
> blueprint xml. That's for a couple of reasons.  If I want to use a different
> properties set in my camel blueprint tests I then point it to the
> blueprint-properties in the src/test/resources directory instead of the one
> in the src/main/resources.
>
> Remember that at deployment Karaf will load all the blueprint files it finds
> in the OSGi-INF folder so there isn't anything special about putting these
> files in separate places.  During testing however you do need to explicitly
> set the files to use (naturally enough). To do that you simply specify them
> to CBTS in a comma delimited String.
>
> ________________________________
> If you reply to this email, your message will be added to the discussion
> below:
> http://camel.465427.n5.nabble.com/Camel-reference-property-files-with-and-without-OSGI-tp5778806p5778809.html
> To start a new topic under Camel - Users, email
> ml-node+s465427n465428h31@n5.nabble.com
> To unsubscribe from Camel reference property files with and without OSGI,
> click here.
> NAML




--
View this message in context: http://camel.465427.n5.nabble.com/Camel-reference-property-files-with-and-without-OSGI-tp5778806p5778810.html
Sent from the Camel - Users mailing list archive at Nabble.com.

Re: Camel reference property files with and without OSGI

Posted by Ranx <br...@mediadriver.com>.
What version are you using?  You shouldn't have to replicate the definition
into Camel context like that anymore.

	<cm:property-placeholder persistent-id="my.persistent.id">
		<cm:default-properties>
			<cm:property name="someAddress" value="http://localhost" />

			<cm:property name="someValue" value="true" />
		</cm:default-properties>
	</cm:property-placeholder>

You can use the default properties for your testing and override them in
your .cfg file for deployment.

someAddress=http://anotheraddress.com
someValue=false

In CamelBlueprintTestSupport you can also override the properties.  You can
also assign a cfg file in there but I haven't found that to work very well.

I commonly keep my blueprint-properties.xml separate from my other camel
blueprint xml. That's for a couple of reasons.  If I want to use a different
properties set in my camel blueprint tests I then point it to the
blueprint-properties in the src/test/resources directory instead of the one
in the src/main/resources.

Remember that at deployment Karaf will load all the blueprint files it finds
in the OSGi-INF folder so there isn't anything special about putting these
files in separate places.  During testing however you do need to explicitly
set the files to use (naturally enough). To do that you simply specify them
to CBTS in a comma delimited String.



--
View this message in context: http://camel.465427.n5.nabble.com/Camel-reference-property-files-with-and-without-OSGI-tp5778806p5778809.html
Sent from the Camel - Users mailing list archive at Nabble.com.