Hi, Create a new module for your code snippet, add the dependencies to the pom and then set Private-Package to include any packages you need and o believe they will be sucked into your jar.
There is a property for setting private package, but I can't recall the exact name. Good luck. Alasdair Nottingham On 8 Mar 2011, at 22:37, Emily Jiang <[email protected]> wrote: > In Apache Aries, our resolver is able to take in any external repositories. > It is also able to generate repository xml by using the following code > snippet (lifted from the module of application itest, > OBRResolverAdvancedTest.java). *By the way, the repository xml generated by > apache aries includes the blueprint service/reference infomation, which > cannot be achived by bindex (a repository generator).* > > private void generateOBRRepoXML(boolean nullURI, String ... bundleFiles) > throws Exception > { > Set<ModelledResource> mrs = new HashSet<ModelledResource>(); > FileOutputStream fout = new FileOutputStream("repository.xml"); > RepositoryGenerator repositoryGenerator = > getOsgiService(RepositoryGenerator.class); > ModelledResourceManager modelledResourceManager = > getOsgiService(ModelledResourceManager.class); > for (String fileName : bundleFiles) { > File bundleFile = new File(fileName); > IDirectory jarDir = FileSystem.getFSRoot(bundleFile); > String uri = ""; > if (!!!nullURI) { > uri = bundleFile.toURI().toString(); > } > mrs.add(modelledResourceManager.getModelledResource(uri, jarDir)); > } > repositoryGenerator.generateRepository("Test repo description", mrs, > fout); > fout.close(); > } > > In order to get a repository xml, end users have to write the code snippet > above, which is not ideal. I propose to provide a jar file containing all > classes needed to generate the repository. The end user will just execute > the jar file and pass in the location of bundles in order to generate a > repository xml. > > At the moment, the classes required for generating repository files are in > the modules of org.apache.aries.application.utils, > org.apache.aries.application.api, org.apache.aries.application.modeller, > org.apache.aries.obr.resolver, org.apache.aries.blueprint, felix bundle > repository. However, I don't want to duplicate the classes due to future > maintence concern. > > Any suggestions on how we can best achive this. > > Thanks > Emily > ================= > Emily Jiang > [email protected]
