Пример #1
0
  @MsgbusMethod
  public void getBundles(Request req, Response resp) {
    List<Object> l = new ArrayList<Object>();
    for (Bundle bundle : bc.getBundles()) {
      l.add(marshal(bundle));
    }

    resp.put("bundles", l);
  }
Пример #2
0
  @MsgbusMethod
  public void installBundle(Request req, Response resp) {
    if (req.has("path")) {
      String path = req.getString("path");
      long bundleId = bundleManager.installBundle(path);
      resp.put("bundle_id", bundleId);
    } else if (req.has("group_id") && req.has("artifact_id") && req.has("version")) {
      String groupId = req.getString("group_id");
      String artifactId = req.getString("artifact_id");
      String version = req.getString("version");

      try {
        bundleManager.installBundle(new NullMonitor(), groupId, artifactId, version);
      } catch (MavenResolveException e) {
        throw new IllegalStateException(e);
      }
    } else {
      throw new IllegalStateException("invalid install parameter");
    }
  }