Package org.osgi.service.indexer

Examples of org.osgi.service.indexer.ResourceIndexer


        super(context, ResourceIndexer.class.getName(), null);
        this.timeout = timeout;
    }

    public void index(Set<File> files, OutputStream out, Map<String,String> config) throws Exception {
        ResourceIndexer indexer = doGetIndexer();
        indexer.index(files, out, config);
    }
View Full Code Here


        ResourceIndexer indexer = doGetIndexer();
        indexer.index(files, out, config);
    }

    public void indexFragment(Set<File> files, Writer out, Map<String,String> config) throws Exception {
        ResourceIndexer indexer = doGetIndexer();
        indexer.indexFragment(files, out, config);
    }
View Full Code Here

        ResourceIndexer indexer = doGetIndexer();
        indexer.indexFragment(files, out, config);
    }

    private ResourceIndexer doGetIndexer() throws InterruptedException {
        ResourceIndexer indexer = (ResourceIndexer) waitForService(timeout);
        if (indexer == null)
            throw new IllegalStateException("Resource indexer service not available.");
        return indexer;
    }
View Full Code Here

        super(context, ResourceIndexer.class.getName(), null);
        this.timeout = timeout;
    }

    public void index(Set<File> files, OutputStream out, Map<String,String> config) throws Exception {
        ResourceIndexer indexer = doGetIndexer();
        indexer.index(files, out, config);
    }
View Full Code Here

        ResourceIndexer indexer = doGetIndexer();
        indexer.index(files, out, config);
    }

    public void indexFragment(Set<File> files, Writer out, Map<String,String> config) throws Exception {
        ResourceIndexer indexer = doGetIndexer();
        indexer.indexFragment(files, out, config);
    }
View Full Code Here

        ResourceIndexer indexer = doGetIndexer();
        indexer.indexFragment(files, out, config);
    }

    public IndexResult indexFile(File file) throws Exception {
        ResourceIndexer indexer = doGetIndexer();
        return indexer.indexFile(file);
    }
View Full Code Here

        ResourceIndexer indexer = doGetIndexer();
        return indexer.indexFile(file);
    }

    private ResourceIndexer doGetIndexer() throws InterruptedException {
        ResourceIndexer indexer = waitForService(timeout);
        if (indexer == null)
            throw new IllegalStateException("Resource indexer service not available.");
        return indexer;
    }
View Full Code Here

    deleteWithException(tempDir);
  }

  public void testBasicServiceInvocation() throws Exception {
    ServiceReference ref = context.getServiceReference(ResourceIndexer.class.getName());
    ResourceIndexer indexer = (ResourceIndexer) context.getService(ref);

    StringWriter writer = new StringWriter();

    Map<String, String> config = new HashMap<String, String>();
    config.put(ResourceIndexer.ROOT_URL, tempDir.getAbsoluteFile().toURI().toString());
    indexer.indexFragment(Collections.singleton(copyToTempFile(tempDir, "testdata/01-bsn+version.jar")), writer, config);

    assertEquals(readStream(TestOSGiServices.class.getResourceAsStream("/testdata/fragment-basic.txt")), writer.toString().trim());

    context.ungetService(ref);
  }
View Full Code Here

  // Test whiteboard registration of Resource Analyzers.
  public void testWhiteboardAnalyzer() throws Exception {
    ServiceRegistration reg = context.registerService(ResourceAnalyzer.class.getName(), new WibbleAnalyzer(), null);

    ServiceReference ref = context.getServiceReference(ResourceIndexer.class.getName());
    ResourceIndexer indexer = (ResourceIndexer) context.getService(ref);
    StringWriter writer = new StringWriter();

    Map<String, String> config = new HashMap<String, String>();
    config.put(ResourceIndexer.ROOT_URL, tempDir.getAbsoluteFile().toURI().toString());
    indexer.indexFragment(Collections.singleton(copyToTempFile(tempDir, "testdata/01-bsn+version.jar")), writer, config);

    assertEquals(readStream(TestOSGiServices.class.getResourceAsStream("/testdata/fragment-wibble.txt")), writer.toString().trim());

    context.ungetService(ref);
    reg.unregister();
View Full Code Here

    Dictionary<String, Object> analyzerProps = new Hashtable<String, Object>();
    analyzerProps.put(ResourceAnalyzer.FILTER, "(location=*sion.jar)");
    ServiceRegistration reg = context.registerService(ResourceAnalyzer.class.getName(), new WibbleAnalyzer(), analyzerProps);

    ServiceReference ref = context.getServiceReference(ResourceIndexer.class.getName());
    ResourceIndexer indexer = (ResourceIndexer) context.getService(ref);
    StringWriter writer = new StringWriter();

    Set<File> files = new LinkedHashSet<File>();
    files.add(copyToTempFile(tempDir, "testdata/01-bsn+version.jar"));
    files.add(copyToTempFile(tempDir, "testdata/02-localization.jar"));

    Map<String, String> config = new HashMap<String, String>();
    config.put(ResourceIndexer.ROOT_URL, tempDir.getAbsoluteFile().toURI().toString());
    indexer.indexFragment(files, writer, config);

    assertEquals(readStream(TestOSGiServices.class.getResourceAsStream("/testdata/fragment-wibble-filtered.txt")), writer.toString().trim());

    context.ungetService(ref);
    reg.unregister();
View Full Code Here

TOP

Related Classes of org.osgi.service.indexer.ResourceIndexer

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.