コード例 #1
0
 void put(final URI uri, ArtifactData data) throws Exception {
   reporter.trace("put %s %s", uri, data);
   File tmp = createTempFile(repoDir, "mtp", ".whatever");
   tmp.deleteOnExit();
   try {
     copy(uri.toURL(), tmp);
     byte[] sha = SHA1.digest(tmp).digest();
     reporter.trace("SHA %s %s", uri, Hex.toHexString(sha));
     ArtifactData existing = get(sha);
     if (existing != null) {
       reporter.trace("existing");
       xcopy(existing, data);
       return;
     }
     File meta = new File(repoDir, Hex.toHexString(sha) + ".json");
     File file = new File(repoDir, Hex.toHexString(sha));
     rename(tmp, file);
     reporter.trace("file %s", file);
     data.file = file.getAbsolutePath();
     data.sha = sha;
     data.busy = false;
     CommandData cmddata = parseCommandData(data);
     if (cmddata.bsn != null) {
       data.name = cmddata.bsn + "-" + cmddata.version;
     } else data.name = Strings.display(cmddata.title, cmddata.bsn, cmddata.name, uri);
     codec.enc().to(meta).put(data);
     reporter.trace("TD = " + data);
   } finally {
     tmp.delete();
     reporter.trace("puted %s %s", uri, data);
   }
 }
コード例 #2
0
  /** We parse the -runremote and create sessions for each one of them */
  @Override
  public void prepare() throws Exception {
    if (prepared) return;

    prepared = true;

    updateFromProject();

    Map<String, Object> properties = new HashMap<String, Object>(getRunProperties());

    calculatedProperties(properties);

    Collection<String> embeddedActivators = getActivators();
    if (embeddedActivators != null && !embeddedActivators.isEmpty()) {
      properties.put("biz.aQute.remote.embedded", Strings.join(embeddedActivators));
    }

    for (Entry<String, Attrs> entry : runremote.entrySet()) {
      RunRemoteDTO dto = converter.convert(RunRemoteDTO.class, entry.getValue());
      dto.name = entry.getKey();

      Map<String, Object> sessionProperties = new HashMap<String, Object>(properties);
      sessionProperties.putAll(entry.getValue());
      sessionProperties.put("session.name", dto.name);

      if (dto.jmx != null) {
        tryJMXDeploy(dto.jmx, "biz.aQute.remote.agent");
      }

      RunSessionImpl session = new RunSessionImpl(this, dto, properties);
      sessions.add(session);
    }
  }
コード例 #3
0
 /**
  * Turn the shas into a readable form
  *
  * @param dependencies
  * @return
  * @throws Exception
  */
 public List<?> toString(List<byte[]> dependencies) throws Exception {
   List<String> out = new ArrayList<String>();
   for (byte[] dependency : dependencies) {
     ArtifactData data = get(dependency);
     if (data == null) out.add(Hex.toHexString(dependency));
     else {
       out.add(Strings.display(data.name, Hex.toHexString(dependency)));
     }
   }
   return out;
 }