Package org.osgi.service.bindex

Examples of org.osgi.service.bindex.BundleIndexer


    public IndexerTracker(BundleContext context) {
        super(context, BundleIndexer.class.getName(), null);
    }

    public void index(Set<File> jarFiles, OutputStream out, Map<String,String> config) throws Exception {
        BundleIndexer service = (BundleIndexer) waitForService(500);
        if (service == null)
            throw new IllegalStateException("Bundle Indexer service is not available.");

        service.index(jarFiles, out, config);
    }
View Full Code Here


    public IndexerTracker(BundleContext context) {
        super(context, BundleIndexer.class.getName(), null);
    }

    public void index(Set<File> jarFiles, OutputStream out, Map<String,String> config) throws Exception {
        BundleIndexer service = waitForService(500);
        if (service == null)
            throw new IllegalStateException("Bundle Indexer service is not available.");

        service.index(jarFiles, out, config);
    }
View Full Code Here

      throw new IllegalArgumentException("Error initialising local index URL", e);
    }
  }
 
  private void regenerateIndex() throws Exception {
    BundleIndexer indexer = registry.getPlugin(BundleIndexer.class);
    if (indexer == null)
      throw new IllegalStateException("Cannot index repository: no Bundle Indexer service or plugin found.");
   
    Set<File> allFiles = new HashSet<File>();
    gatherFiles(allFiles);
   
    FileOutputStream out = null;
    try {
      out = new FileOutputStream(localIndex);
      if (!allFiles.isEmpty()) {
        Map<String, String> config = new HashMap<String, String>();
        config.put(BundleIndexer.REPOSITORY_NAME, this.getName());
        config.put(BundleIndexer.ROOT_URL, localIndex.getCanonicalFile().toURI().toURL().toString());
        indexer.index(allFiles, out, config);
      } else {
        ByteArrayInputStream emptyRepo = new ByteArrayInputStream("<?xml version='1.0' encoding='UTF-8'?>\n<repository lastmodified='0'/>".getBytes());
        IO.copy(emptyRepo, out);
      }
    } finally {
View Full Code Here

  @Override
  public synchronized File put(Jar jar) throws Exception {
    File newFile = storageRepo.put(jar);
   
    // Index the new file
    BundleIndexer indexer = registry.getPlugin(BundleIndexer.class);
    if (indexer == null)
      throw new IllegalStateException("Cannot index repository: no Bundle Indexer service or plugin found.");
    ByteArrayOutputStream newIndexBuffer = new ByteArrayOutputStream();

    Map<String, String> config = new HashMap<String, String>();
    config.put(BundleIndexer.REPOSITORY_NAME, this.getName());
    config.put(BundleIndexer.ROOT_URL, localIndex.getCanonicalFile().toURI().toURL().toString());
    indexer.index(Collections.singleton(newFile.getCanonicalFile()), newIndexBuffer, null);
   
    // Merge into main index
    File tempIndex = File.createTempFile("repository", ".xml");
    FileOutputStream tempIndexOutput = new FileOutputStream(tempIndex);
    MergeContentFilter merger = new MergeContentFilter();
View Full Code Here

TOP

Related Classes of org.osgi.service.bindex.BundleIndexer

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.