Search in sources :

Example 1 with BundleIndexerImpl

use of org.osgi.impl.bundle.bindex.BundleIndexerImpl in project bnd by bndtools.

the class TestMultipleLocalIndexGeneration method setUp.

protected void setUp() throws Exception {
    // Ensure output directory exists and is empty
    outputDir = IO.getFile("generated/tmp/test/" + getName());
    IO.deleteWithException(outputDir);
    if (!outputDir.exists() && !outputDir.mkdirs()) {
        throw new IOException("Could not create directory " + outputDir);
    }
    // Setup the repo
    reporter = new Processor();
    repo = new LocalIndexedRepo();
    Map<String, String> config = new HashMap<String, String>();
    config.put("local", outputDir.getAbsolutePath());
    config.put("type", "OBR|R5");
    repo.setProperties(config);
    // Add the BundleIndexer plugin
    registry = new MockRegistry();
    BundleIndexerImpl obrIndexer = new BundleIndexerImpl();
    registry.addPlugin(obrIndexer);
    repo.setRegistry(registry);
    repo.setReporter(reporter);
}
Also used : Processor(aQute.bnd.osgi.Processor) HashMap(java.util.HashMap) MockRegistry(test.lib.MockRegistry) IOException(java.io.IOException) BundleIndexerImpl(org.osgi.impl.bundle.bindex.BundleIndexerImpl)

Example 2 with BundleIndexerImpl

use of org.osgi.impl.bundle.bindex.BundleIndexerImpl in project bnd by bndtools.

the class TestObrCapReqParsing method parseIndex.

private static List<Resource> parseIndex(InputStream stream, URI baseUri) throws Exception {
    ObrContentProvider parser = new ObrContentProvider(new BundleIndexerImpl());
    final List<Resource> resources = new LinkedList<Resource>();
    IRepositoryIndexProcessor processor = new IRepositoryIndexProcessor() {

        public void processResource(Resource resource) {
            resources.add(resource);
        }

        public void processReferral(URI parentUri, Referral referral, int maxDepth, int currentDepth) {
        }
    };
    parser.parseIndex(stream, baseUri, processor, new NullLogService());
    return resources;
}
Also used : Referral(aQute.bnd.deployer.repository.api.Referral) IRepositoryIndexProcessor(aQute.bnd.deployer.repository.api.IRepositoryIndexProcessor) Resource(org.osgi.resource.Resource) NullLogService(aQute.bnd.deployer.repository.NullLogService) URI(java.net.URI) BundleIndexerImpl(org.osgi.impl.bundle.bindex.BundleIndexerImpl) LinkedList(java.util.LinkedList)

Aggregations

BundleIndexerImpl (org.osgi.impl.bundle.bindex.BundleIndexerImpl)2 NullLogService (aQute.bnd.deployer.repository.NullLogService)1 IRepositoryIndexProcessor (aQute.bnd.deployer.repository.api.IRepositoryIndexProcessor)1 Referral (aQute.bnd.deployer.repository.api.Referral)1 Processor (aQute.bnd.osgi.Processor)1 IOException (java.io.IOException)1 URI (java.net.URI)1 HashMap (java.util.HashMap)1 LinkedList (java.util.LinkedList)1 Resource (org.osgi.resource.Resource)1 MockRegistry (test.lib.MockRegistry)1