示例#1
0
  /**
   * Get the version directory-deployed from the given directory
   *
   * @param directory
   * @return the name of the version currently using the directory, else null
   * @throws VersioningSyntaxException *
   */
  public String getVersionFromSameDir(File dir) throws VersioningSyntaxException {

    try {
      Iterator it = domain.getApplications().getApplications().iterator();
      Application app = null;

      // check if directory deployment exist
      while (it.hasNext()) {
        app = (Application) it.next();
        /*
         * A lifecycle module appears as an application but has a null location.
         */
        if (dir.toURI().toString().equals(app.getLocation())) {
          if (!VersioningUtils.getUntaggedName(app.getName()).equals(app.getName())) {
            return app.getName();
          }
        }
      }
    } catch (VersioningSyntaxException ex) {
      // return null if an exception is thrown
    }
    return null;
  }