I am not sure I totally understand your situation, but assume that we
have a bundle with the following content from the root of its JAR file:
org/
foo/
resource/
file1.xml
file2.xml
file3.xml
Now further assume that our bundle has the following bundle class path:
Bundle-ClassPath: .
You should be able to access any of these resources using
class.getResourceAsStream("org/foo/resource/file1.xml") and so on. The
important point here is that these resources are accessible on the
bundle's internal class path.
On the other hand, if you have some arbitrary folder inside of your
bundle that is not on your bundle's internal class path, then you will
have to use the bundle entry-related methods, e.g., Bundle.getEntry(),
to gain access to them.
-> richard
[EMAIL PROTECTED] wrote:
Hi, guys, I want to read a group of file from a folder inside the osgi
bundle. The reading of the files is done automatically by the API, and
only one of the file can be create as the entry point. Suppose that I
create a file : File xx = new File("ddd.xxx"); I try to read it as
stream where I use class.getResourceAsStream() method to read the entry
file. However for the other file inside the folder it can not be done.
If I don't read the files using OSGi I can do it properly. But once I
use Osgi tech, I can deploy the bundle. Does anybody knows how to
register the folder so that I can read the whold folder freely Just like
in the HTTPContext where it provide the registerResource method for the
image reading in the servlet.
Thank you very much
Regards
Wei Hui Tan
Student Researcher
BT
Office: +44 (0)1473 605441
Mobile: +44 (0)7816 162922
Fax: +44 (0)1473 606702
Email: [EMAIL PROTECTED]
British Telecommunications plc
Registered office: 81 Newgate Street London EC1A 7AJ
Registered in England no. 1800000
This electronic message contains information from British
Telecommunications plc which may be privileged or confidential. The
information is intended to be for the use of the individual(s) or entity
named above. If you are not the intended recipient be aware that any
disclosure, copying, distribution or use of the contents of this
information is prohibited. If you have received this electronic message
in error, please notify us by telephone or email (to the numbers or
address above) immediately.
Activity and use of the British Telecommunications plc email system is
monitored to secure its effective operation and for other lawful
business purposes. Communications using this system will also be
monitored and may be recorded to secure effective operation and for
other lawful business purposes.