Beispiel #1
0
 private Result doAdd(Host currentHost) {
   UnderlayVector v = new UnderlayVector();
   v.setGroupId(args.get(0));
   v.setArtifcatId(args.get(1));
   v.setVersion(args.get(2));
   List<UnderlayVector> vectors = currentHost.getUnderlayVectors();
   if (vectors == null) {
     vectors = new ArrayList<>();
   }
   Iterator<UnderlayVector> it = vectors.iterator();
   while (it.hasNext()) {
     UnderlayVector oldV = it.next();
     // if( oldV.getGroupId().equals(v.getGroupId()))
   }
   return null;
 }
Beispiel #2
0
  @Override
  public Result execute() {
    Folder cur;
    try {
      cur = currentResource();
    } catch (NotAuthorizedException | BadRequestException ex) {
      return result("can't lookup current resource", ex);
    }
    if (cur == null) {
      return result("current dir not found: " + currentDir);
    }
    String deployUrl = "";
    if (cur instanceof Folder) {
      Folder col = cur;
      try {

        if (args.size() == 1) {
          deployUrl = args.get(0);

          return deploySimple(deployUrl, col);
        } else if (args.size() >= 3) {
          String s = args.get(0);
          boolean isUnderlay = false;
          if (s.equals("-underlay")) {
            isUnderlay = true;
            args.remove(0);
          }

          if (mavenRoot == null || mavenRoot.length() == 0) {
            return result("Cant deploy maven spec, no maven root has been configred");
          }
          String group = args.get(0);
          String artifact = args.get(1);
          String version = args.get(2);
          deployUrl =
              mavenRoot
                  + "/"
                  + group.replace(".", "/")
                  + "/"
                  + artifact
                  + "/"
                  + version
                  + "/"
                  + artifact
                  + "-"
                  + version
                  + ".war";
          log.info("Built maven URL: " + deployUrl);
          if (isUnderlay) {
            UnderlayVector v = new UnderlayVector();
            v.setArtifcatId(artifact);
            v.setGroupId(group);
            v.setVersion(version);
            return deployUnderlay(deployUrl, v);
          } else {
            return deploySimple(deployUrl, col);
          }
        } else {
          return result(
              "Invalid number of arguments. Either give single URL or 3 arguments for a maven vector group artifact id");
        }
      } catch (MalformedURLException ex) {
        return result("Bad url: " + deployUrl);
      } catch (Exception ex) {
        return result("Exception deploying: " + deployUrl, ex);
      }
    } else {
      return result("not a collection: " + cur.getHref());
    }
  }