Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Finding files and folders in an OSGI Bundle

I am writing test cases that have to be executed in osgi environment, i have put the test data which is a set of files in the test bundle. I am able to access the test data files using bundle.getResource which returns an URL from which i can get the InputStream for a particular file, but how can i find out all the list of files in a particular folder in the test plugin. In eclispe i could use fileLocator to do this.

/bundle
     testdata
        one.txt
        two.txt
        three.txt
        folder1
               file1.txt
               file2.txt

In the above bundle i want to find all the files and folders that are present in the testdata folder.


Best Reards,
Keshav

like image 274
keshav84 Avatar asked Sep 15 '10 09:09

keshav84


People also ask

How does OSGi bundle work?

How does OSGi work? OSGi is a set of specifications that define a dynamic component system for Java. These specifications allow for a development model in which an application is composed of several components, and then packed into bundles. These components communicate locally and through the network via services.

What OSGi stands for?

The OSGi (Open Service Gateway Initiative) specification is a Java framework for developing and deploying modular software programs and libraries.

Why do we need OSGi?

OSGi is a fast framework because it knows that which service will be loaded into OSGi environment thanks to pre-defined xml file. It reduces runtime cost thanks to lazy state. Service instance is created when they needed. Some bundle's different version can be used by other bundle at the same time.


1 Answers

If you know what bundle the information is in, use Bundle.findEntries or Bundle.getEntryPaths.

like image 162
BJ Hargrave Avatar answered Sep 21 '22 06:09

BJ Hargrave