Using ClassLoader.getResourceAsStream(), the file has to be in the
classloader.
Basicly, you can add a new classpath entry in the servicemix startup
script (for example etc/my-config and update the CLASSPATH).
Putting it in your project resources directory is not good as this
properties file needs to be changed by the users I guess.
Regards
JB
boday wrote:
that is what I was looking for...one last question, where would the
"my.properties" file need to be located...or how would it be added to the
path to be made available exactly...thanks again
Jean-Baptiste Onofré wrote:
Ah OK Ben,
using Java, you can construct the URIs by hand and provide in endpoint.
For example, you can use system wide properties, or load a properties
file from the classpath (or using Spring resource):
Properties properties = new Properties();
properties.load(this.getClass().getClassLoader().getResourceAsStream("my.properties");
String route = properties.getProperty("route_endpoint");
String jbiEndpoint = "jbi:" + route:
from("timer:mytime").to(jbiEndpoint);
in your RouteBuilder configure() method.
I never tried this but it should work.
Regards
JB
boday wrote:
thanks. I saw this article earlier, but I'm using the Java DSL (not XML)
to
configure my routes. How do I pass/access these properties from
MyRouteBuilder.java file?
Overall, are there other ways to get machine specific properties into SMX
builds (System properties, etc) besides the Spring configuration?
Jean-Baptiste Onofré wrote:
Hi Ben;
Charles Mouillard from Camel has blog this:
http://cmoulliard.blogspot.com/2009/05/trick-to-pass-uri-declared-in-property.html
-----
Ben O'Day
Vektrel - Senior Consultant
--
Jean-Baptiste Onofré (Nanthrax)
BuildProcess/AutoDeploy Project Leader
http://buildprocess.sourceforge.net
[email protected]
PGP : 17D4F086
-----
Ben O'Day
Vektrel - Senior Consultant
--
Jean-Baptiste Onofré
---------------------------------
HomePage
http://www.nanthrax.net
---------------------------------
Contacts
[email protected]
[email protected]
---------------------------------
OpenSource
BuildProcess/AutoDeploy
http://buildprocess.sourceforge.net
Apache ServiceMix
http://servicemix.apache.org
-----------------------------------
PGP : 17D4F086