You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@camel.apache.org by ychawla <pr...@yahoo.com> on 2011/05/16 01:45:49 UTC

Read file from within bundle?

Hello All,
I have some data file that reside inside a camel 2.6.0 bundle deployed
inside of ServiceMix 4.3.  I included some resources in my bundle:

<Include-Resource>
				{maven-resources},
src/test/resources/xml/test=src/test/resources/xml/test
</Include-Resource>

However, I am not sure how I can read these files in my application.  I
tried reading them as a spring resource, class path resource, and some other
different ways, but no luck.

What is the proper way to read files from my bundle?  Eventually I worked
around this by copying my files to the /tmp directory, but my preferred
method is to read these files from the bundle. I am assumming I should use
bundle.getResource, but not sure how to get at the bundle.

Any ideas?

Thanks,
Yogesh

--
View this message in context: http://camel.465427.n5.nabble.com/Read-file-from-within-bundle-tp4398824p4398824.html
Sent from the Camel - Users mailing list archive at Nabble.com.

Re: Read file from within bundle?

Posted by ychawla <pr...@yahoo.com>.
Hello All,
This thread on the ServiceMix list shows you how to solve this problem:

http://servicemix.396122.n5.nabble.com/Classpath-protocol-in-servicemix-td4490171.html#a4492467

Cheers,
Yogesh

--
View this message in context: http://camel.465427.n5.nabble.com/Read-file-from-within-bundle-tp4398824p4512830.html
Sent from the Camel - Users mailing list archive at Nabble.com.

Re: Read file from within bundle?

Posted by Pham Ngoc Hai <pn...@yahoo.com>.
Will this help?
http://stackoverflow.com/questions/3810303/how-to-reference-an-included-file-in-osgi-bundle-when-performing-java-io-file-or

Regards,
Ngoc Hai

--- On Mon, 5/16/11, ychawla <pr...@yahoo.com> wrote:

> From: ychawla <pr...@yahoo.com>
> Subject: Read file from within bundle?
> To: users@camel.apache.org
> Date: Monday, May 16, 2011, 6:45 AM
> Hello All,
> I have some data file that reside inside a camel 2.6.0
> bundle deployed
> inside of ServiceMix 4.3.  I included some resources
> in my bundle:
> 
> <Include-Resource>
>            
>     {maven-resources},
> src/test/resources/xml/test=src/test/resources/xml/test
> </Include-Resource>
> 
> However, I am not sure how I can read these files in my
> application.  I
> tried reading them as a spring resource, class path
> resource, and some other
> different ways, but no luck.
> 
> What is the proper way to read files from my bundle? 
> Eventually I worked
> around this by copying my files to the /tmp directory, but
> my preferred
> method is to read these files from the bundle. I am
> assumming I should use
> bundle.getResource, but not sure how to get at the bundle.
> 
> Any ideas?
> 
> Thanks,
> Yogesh
> 
> --
> View this message in context: http://camel.465427.n5.nabble.com/Read-file-from-within-bundle-tp4398824p4398824.html
> Sent from the Camel - Users mailing list archive at
> Nabble.com.
>