예제 #1
0
 /**
  * Get all of the versions that exist for the given ApplicationID (tenant and app).
  *
  * @return List<String> version numbers.
  */
 public static List<String> getAppVersions(
     String tenant, String app, String status, String branch) {
   ApplicationID.validateTenant(tenant);
   ApplicationID.validateApp(app);
   ApplicationID.validateBranch(branch);
   return getPersister().getAppVersions(tenant, app, status, branch);
 }
예제 #2
0
  public static ApplicationID getApplicationID(
      String tenant, String app, Map<String, Object> coord) {
    ApplicationID.validateTenant(tenant);
    ApplicationID.validateApp(tenant);

    if (coord == null) {
      coord = new HashMap<>();
    }

    NCube bootCube = getCube(ApplicationID.getBootVersion(tenant, app), SYS_BOOTSTRAP);

    if (bootCube == null) {
      throw new IllegalStateException(
          "Missing " + SYS_BOOTSTRAP + " cube in the 0.0.0 version for the app: " + app);
    }

    ApplicationID bootAppId = (ApplicationID) bootCube.getCell(coord);
    String version = bootAppId.getVersion();
    String status = bootAppId.getStatus();
    String branch = bootAppId.getBranch();

    if (!tenant.equalsIgnoreCase(bootAppId.getTenant())) {
      LOG.warn(
          "sys.bootstrap cube for tenant '"
              + tenant
              + "', app '"
              + app
              + "' is returning a different tenant '"
              + bootAppId.getTenant()
              + "' than requested. Using '"
              + tenant
              + "' instead.");
    }

    if (!app.equalsIgnoreCase(bootAppId.getApp())) {
      LOG.warn(
          "sys.bootstrap cube for tenant '"
              + tenant
              + "', app '"
              + app
              + "' is returning a different app '"
              + bootAppId.getApp()
              + "' than requested. Using '"
              + app
              + "' instead.");
    }

    return new ApplicationID(tenant, app, version, status, branch);
  }