Package aQute.bnd.service.repository.SearchableRepository

Examples of aQute.bnd.service.repository.SearchableRepository.ResourceDescriptor


  public void testMultipleDownloads() throws Exception {

    final Semaphore s = new Semaphore(0);
    final AtomicInteger downloads = new AtomicInteger();

    ResourceDescriptor rd = create("jar/osgi.jar");
    repoImpl.add("x", rd);

    final Semaphore done = new Semaphore(0);

    DownloadListener l = new DownloadListener() {
View Full Code Here


    PutResult put = indexedRepo.put(IO.getFile("jar/osgi.jar").toURI().toURL().openStream(), null);
    assertNotNull(put);

    // Can we get it?

    ResourceDescriptor desc = indexedRepo.getDescriptor("osgi", new Version("4.0"));
    assertNotNull(desc);

    // Got the same file?

    assertTrue(Arrays.equals(put.digest, desc.id));

    //
    // Check if the description was copied
    //

    assertEquals("OSGi Service Platform Release 4 Interfaces and Classes for use in compiling bundles.",
        desc.description);

    //
    // We must be able to access by its sha1
    //

    ResourceDescriptor resource = indexedRepo.getResource(put.digest);
    assertTrue(Arrays.equals(resource.id, desc.id));

    //
    // Check if we now have a set of resources
    //
    SortedSet<ResourceDescriptor> resources = indexedRepo.getResources();
    assertEquals(1, resources.size());
    ResourceDescriptor rd = resources.iterator().next();
    assertTrue(Arrays.equals(rd.id, put.digest));

    //
    // Check if the bsn brings us back
    //
View Full Code Here

                  if (!(repo instanceof InfoRepository))
                    continue;

                  InfoRepository rp = (InfoRepository) repo;
                  ResourceDescriptor descriptor = rp.getDescriptor(bsn, version);
                  if (descriptor == null) {
                    error("Found bundle, but no descriptor %s;version=%s", bsn, version);
                    return;
                  }
View Full Code Here

          toBeDeleted.remove(id);

          if (persistent.containsKey(id))
            continue;

          final ResourceDescriptor rd = entry.getValue();

          DownloadBlocker blocker = new DownloadBlocker(null) {

            //
            // We steal the thread of the downloader to index
View Full Code Here

  private Map<String,ResourceDescriptor> collectKeys(InfoRepository repo) throws Exception {
    Map<String,ResourceDescriptor> map = new HashMap<String,ResourceDescriptor>();

    for (String bsn : repo.list(null)) {
      for (Version version : repo.versions(bsn)) {
        ResourceDescriptor rd = repo.getDescriptor(bsn, version);
        map.put(Hex.toHexString(rd.id), rd);
      }
    }
    return map;
  }
View Full Code Here

                  if (!(repo instanceof InfoRepository))
                    continue;

                  InfoRepository rp = (InfoRepository) repo;
                  ResourceDescriptor descriptor = rp.getDescriptor(bsn, version);
                  if (descriptor == null) {
                    error("Found bundle, but no descriptor %s;version=%s", bsn, version);
                    return;
                  }
View Full Code Here

    nextFile: for (Iterator<Spec> i = sources.iterator(); i.hasNext();) {
      Spec spec = i.next();

      if (resources != null) {
        ResourceDescriptor rd = resources.getResourceDescriptor(spec.digest);
        if (rd != null)
          // Already exists
          continue nextFile;
      }
View Full Code Here

        map = (Map<String,String>) target[2];

      File f = getLocal(bsn, version, map);

      String s = "";
      ResourceDescriptor descriptor = getDescriptor(bsn, version);
      if (descriptor != null && descriptor.description != null) {
        s = descriptor.description + "\n";
      }

      s += String.format("Path: %s\nSize: %s\nSHA1: %s", f.getAbsolutePath(), readable(f.length(), 0), SHA1
View Full Code Here

    Jar tmpjar = jar;
    if (jar == null)
      tmpjar = new Jar(f);
    try {
      Manifest m = tmpjar.getManifest();
      ResourceDescriptor rd = new ResourceDescriptor();
      rd.bsn = bsn;
      rd.version = version;
      rd.description = m.getMainAttributes().getValue(Constants.BUNDLE_DESCRIPTION);
      rd.id = digest;
      if (rd.id == null)
View Full Code Here

    //

    if (newer.getWithoutQualifier().equals(older.getWithoutQualifier())) {
      RepositoryPlugin rr = getBaselineRepo();
      if (rr instanceof InfoRepository) {
        ResourceDescriptor descriptor = ((InfoRepository) rr).getDescriptor(getBsn(), older);
        if (descriptor != null && descriptor.phase != Phase.STAGING) {
          error("Baselining %s against same version %s but the repository says the older repository version is not the required %s but is instead %s",
              getBsn(), getVersion(), Phase.STAGING, descriptor.phase);
          return;
        }
View Full Code Here

TOP

Related Classes of aQute.bnd.service.repository.SearchableRepository.ResourceDescriptor

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.