Examples of RevisionRef


Examples of aQute.service.library.Library.RevisionRef

   * @throws Exception
   */
  Runnable getUpdateAction(Program program, String bsn) throws Exception {
    final List<Runnable> update = new ArrayList<Runnable>();
    for (Version v : index.getVersions(bsn)) {
      RevisionRef resource = index.getRevisionRef(bsn, v);
      Runnable updateAction = getUpdateAction(program, resource);
      if (updateAction != null)
        update.add(updateAction);
    }
    if (update.isEmpty())
View Full Code Here

Examples of aQute.service.library.Library.RevisionRef

   * @return
   * @throws Exception
   */

  private Runnable getUpdateAction(Program program, final RevisionRef current) throws Exception {
    RevisionRef candidateRef = null;
    Version candidate = toVersion(current.baseline, current.qualifier);

    for (RevisionRef r : program.revisions) {
      Version refVersion = toVersion(r.baseline, r.qualifier);
      if (eq(r.classifier, current.classifier)) {
        if (refVersion.compareTo(candidate) >= 0) {
          candidate = refVersion;
          candidateRef = r;
        }
      }
    }
    if (candidateRef == null)
      //
      // We're not present anymore, should never happen ...
      //
      return new Runnable() {

        @Override
        public void run() {
          try {
            index.delete(current.bsn, toVersion(current.baseline, current.qualifier));
          }
          catch (Exception e) {
            throw new RuntimeException(e);
          }
        }

        public String toString() {
          return "[delete]";
        }
      };

    //
    // Check if we are not same revision
    //
    if (!candidateRef.version.equals(current.version)) {
      final RevisionRef toAdd = candidateRef;
      return new Runnable() {
        //
        // Replace the current version
        //
        public void run() {
          try {
            index.delete(current.bsn, toVersion(current.baseline, current.qualifier));
            index.addRevision(toAdd);
            index.save();
          }
          catch (Exception e) {
            throw new RuntimeException(e);
          }
        }

        public String toString() {
          return toAdd.version;
        }
      };
    }

    //
    // So now we are the same, check if the phase has changed
    //
    if (candidateRef.phase != current.phase) {
      final RevisionRef toChange = candidateRef;
      return new Runnable() {

        @Override
        public void run() {
          try {
View Full Code Here

Examples of aQute.service.library.Library.RevisionRef

    }
  }

  public void add(String bsn, Version version) throws Exception {
    reporter.trace("Add %s %s", bsn, version);
    RevisionRef ref = getRevisionRef(bsn, version);
    add(ref);
  }
View Full Code Here

Examples of aQute.service.library.Library.RevisionRef

      if (resource != null) {
        reporter.trace("resource already loaded " + uri);
        return true;
      }

      RevisionRef ref = new RevisionRef(revision);
      reporter.trace("adding revision " + ref);
      add(ref);
      return true;
    }
    catch (Exception e) {
View Full Code Here

Examples of aQute.service.library.Library.RevisionRef

      Set<ResourceDescriptor> resources = new HashSet<ResourceDescriptor>();
      Revision revision = getRevision(new Coordinate(m.group(1), m.group(2), m.group(3), m.group(4)));

      if (revision != null) {
        ResourceDescriptor rd = createResourceDescriptor(new RevisionRef(revision));
        resources.add(rd);
        if (includeDependencies) {
          for (RevisionRef dependency : library.getClosure(revision._id, false)) {
            ResourceDescriptor dep = createResourceDescriptor(dependency);
            dep.dependency = true;
View Full Code Here

Examples of aQute.service.library.Library.RevisionRef

  }

  // @Override
  public Set<ResourceDescriptor> query(String query) throws Exception {
    Set<ResourceDescriptor> resources = new HashSet<ResourceDescriptor>();
    RevisionRef master = null;
    RevisionRef staging = null;

    for (Program p : library.getQueryPrograms(query, 0, 100)) {
      for (RevisionRef ref : p.revisions) {
        if (master == null && ref.phase == Library.Phase.MASTER) {
          master = ref;
View Full Code Here

Examples of aQute.service.library.Library.RevisionRef

  }

  // @Override
  public boolean addResource(ResourceDescriptor resource) throws Exception {
    if (resource instanceof ResourceDescriptorImpl) {
      RevisionRef ref = ((ResourceDescriptorImpl) resource).revision;
      if (index.addRevision(ref)) {
        index.save();
        return true;
      }
    }
View Full Code Here

Examples of aQute.service.library.Library.RevisionRef

        reporter.trace("Dependency " + c);

        if (!Verifier.isVersion(c.getVersion()))
          continue;

        RevisionRef ref = index.getRevisionRef(c.getBundleSymbolicName(), new Version(c.getVersion()));
        if (ref != null)
          refs.remove(ref);
        else {
          // missing!
          reporter.trace("Missing " + c.getBundleSymbolicName());
          Coordinate coord = new Coordinate(c.getBundleSymbolicName());
          Revision rev = library.getRevisionByCoordinate(coord);
          if (rev != null) {
            index.addRevision(new RevisionRef(rev));
          } else
            System.out.printf("not found %s\n", c);
        }
        keep.add(ref);
      }
View Full Code Here

Examples of aQute.service.library.Library.RevisionRef

   * @param version
   * @return
   * @throws Exception
   */
  public ResourceDescriptor getDescriptor(String bsn, Version version) throws Exception {
    RevisionRef revisionRef = index.getRevisionRef(bsn, version);
    if (revisionRef == null)
      return null;

    return createResourceDescriptor(revisionRef);
  }
View Full Code Here

Examples of aQute.service.library.Library.RevisionRef

      return null;

    // Fixup the change from ref.url to ref.urls ...
    boolean save = false;

    RevisionRef ref = map.get(version);
    if (ref == null) {
      return null;
    }

    if (ref.urls.isEmpty() && ref.url != null) {
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.