Package aQute.service.library.Library

Examples of aQute.service.library.Library.RevisionRef


  public File get(String bsn, Version version, Map<String,String> attrs, final DownloadListener... listeners)
      throws Exception {

    init();
    // Check if we're supposed to have this
    RevisionRef resource = index.getRevisionRef(bsn, version);
    if (resource == null)
      return null;
    else
      return getLocal(resource, attrs, listeners);
  }
View Full Code Here


    bsn: for (String bsn : index.getBsns()) {
      if (glob.matcher(bsn).matches()) {
        if (phase != null) {
          boolean hasPhase = false;
          revision: for (Version version : index.getVersions(bsn)) {
            RevisionRef ref = index.getRevisionRef(bsn, version);
            if (ref.phase == phase) {
              hasPhase = true;
              break revision;
            }
          }
View Full Code Here

            toClipboard(bsn, versions.first());
          }

        });

      RevisionRef ref = p.revisions.get(0);
      Version latest = toVersion(ref.baseline, ref.qualifier);
      for (Version v : index.getVersions(bsn)) {
        if (v.equals(latest)) {
          latest = null;
          break;
View Full Code Here

    }
    return null;
  }

  private String revisionTooltip(String bsn, Version version) throws Exception {
    RevisionRef r = getRevisionRef(bsn, version);

    if (r == null)
      return null;

    Formatter sb = new Formatter();
View Full Code Here

    if (isSha(bsn) && version.equals(Version.LOWEST)) {
      Revision r = getRevision(new Coordinate(bsn));
      if (r == null)
        return null;

      return new RevisionRef(r);
    }
    reporter.trace("Looking for %s-%s", bsn, version);
    for (RevisionRef r : getRevisionRefs(bsn)) {
      Version v = toVersion(r.baseline, r.qualifier);
      if (v.equals(version))
View Full Code Here

   * @throws Exception
   */
  Runnable getUpdateAction(Program program, String bsn) throws Exception {
    final Set<Runnable> update = new TreeSet<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

   * @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

    }
  }

  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

      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

      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

TOP

Related Classes of aQute.service.library.Library.RevisionRef

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.