Package org.sonatype.configuration.validation

Examples of org.sonatype.configuration.validation.ValidationMessage


      }
    }
    catch (LocalStorageException e) {
      ValidationResponse response = new ApplicationValidationResponse();

      ValidationMessage error =
          new ValidationMessage("overrideLocalStorageUrl", "Repository has an invalid local storage URL '"
              + localUrl, "Invalid file location");

      response.addValidationError(error);

      throw new InvalidConfigurationException(response);
View Full Code Here


      masterFound = masterFound || StringUtils.equals(repository.getId(), getMasterRepositoryId());
    }

    if (!masterFound) {
      String id = ((CRepository) owner.getConfiguration(false)).getId();
      ValidationMessage message =
          new ValidationMessage("shadowOf", "Master repository id=\"" + getMasterRepositoryId()
              + "\" not found for ShadowRepository with id=\"" + id + "\"!",
              "The source nexus repository is not existing.");

      response.addValidationError(message);
    }
View Full Code Here

    }

    final List<String> memberRepositoryIds = getMemberRepositoryIds();

    if (!allReposesIds.containsAll(memberRepositoryIds)) {
      ValidationMessage message =
          new ValidationMessage(MEMBER_REPOSITORIES, "Group repository points to nonexistent members!",
              "The source nexus repository is not existing.");

      response.addValidationError(message);
    }

    final Set<String> uniqueReposesIds = Sets.newHashSet(memberRepositoryIds);
    if (uniqueReposesIds.size() != memberRepositoryIds.size()) {
      response.addValidationError(new ValidationMessage(
          MEMBER_REPOSITORIES,
          "Group repository has same member multiple times!",
          "Group repository has same member multiple times!"
      ));
    }
View Full Code Here

    if (InvalidConfigurationException.class.isAssignableFrom(e.getClass())) {
      ValidationResponse vr = ((InvalidConfigurationException) e).getValidationResponse();

      if (vr != null && vr.getValidationErrors().size() > 0) {
        ValidationMessage vm = vr.getValidationErrors().get(0);
        nexusErrorResponse = getNexusErrorResponse(vm.getKey(), vm.getShortMessage());
      }
      else {
        nexusErrorResponse = getNexusErrorResponse("*", e.getMessage());
      }
    }
View Full Code Here

              try {
                proxyRepo.setRemoteUrl(model.getRemoteStorage().getRemoteStorageUrl());
              }
              catch (RemoteStorageException e) {
                ValidationResponse vr = new ApplicationValidationResponse();
                ValidationMessage error = new ValidationMessage("remoteStorageUrl", e.getMessage(), e.getMessage());
                vr.addValidationError(error);
                throw new InvalidConfigurationException(vr);
              }
              String oldPasswordForRemoteStorage = null;
              if (proxyRepo.getRemoteAuthenticationSettings() != null
View Full Code Here

      if (getLogger().isDebugEnabled()) {
        getLogger().debug("Validation error for startDate: " + startDate.toString());
      }

      ValidationResponse vr = new ApplicationValidationResponse();
      ValidationMessage vm = new ValidationMessage("startDate", "Date cannot be in the past.");
      vr.addValidationError(vm);
      throw new InvalidConfigurationException(vr);
    }
  }
View Full Code Here

  public void validateTime(String key, Date date)
      throws InvalidConfigurationException
  {
    if (date.before(new Date())) {
      ValidationResponse vr = new ApplicationValidationResponse();
      ValidationMessage vm = new ValidationMessage(key, "Time cannot be in the past.");
      vr.addValidationError(vm);
      throw new InvalidConfigurationException(vr);
    }
  }
View Full Code Here

    ErrorResponse errorResponse;

    ValidationResponse vr = e.getValidationResponse();

    if (vr != null && vr.getValidationErrors().size() > 0) {
      ValidationMessage vm = vr.getValidationErrors().get(0);
      errorResponse = getErrorResponse(vm.getKey(), vm.getShortMessage());
    }
    else {
      errorResponse = getErrorResponse("*", e.getMessage());
    }

View Full Code Here

      }
    }

    if (!found) {
      ValidationResponse response = new ValidationResponse();
      response.addValidationError(new ValidationMessage("status", "Users status is not valid."));
      throw new InvalidConfigurationException(response);
    }
  }
View Full Code Here

                                                            boolean update)
  {
    ValidationResponse response = new ValidationResponse();

    if (ldapServerConfiguration == null) {
      ValidationMessage msg = new ValidationMessage("*", "Configuration is missing.");
      response.addValidationError(msg);
    }
    else {

      if (StringUtils.isEmpty(ldapServerConfiguration.getId()) && !update) {
        ValidationMessage msg = new ValidationMessage("id", "Id was generated.");
        response.addValidationWarning(msg);

        ldapServerConfiguration.setId(idGenerator.generateId());
      }
      else if (StringUtils.isEmpty(ldapServerConfiguration.getId()) && update) {
        ValidationMessage msg = new ValidationMessage("id", "Id cannot be empty.");
        response.addValidationWarning(msg);
      }

      if (StringUtils.isEmpty(ldapServerConfiguration.getName())) {
        ValidationMessage msg = new ValidationMessage("name", "Name cannot be empty.");
        response.addValidationError(msg);
      }

      if (ldapServerConfiguration.getConnectionInfo() != null) {
        ValidationResponse vr = this.validateConnectionInfo(null, ldapServerConfiguration.getConnectionInfo());
        response.append(vr);
      }
      else {
        ValidationMessage msg = new ValidationMessage("*", "Connection Configuration is missing.");
        response.addValidationError(msg);
      }

      if (ldapServerConfiguration.getUserAndGroupConfig() != null) {
        ValidationResponse vr = this.validateUserAndGroupAuthConfiguration(null, ldapServerConfiguration
            .getUserAndGroupConfig());
        response.append(vr);
      }
      else {
        ValidationMessage msg = new ValidationMessage("*", "User And Group Configuration is missing.");
        response.addValidationError(msg);
      }
    }

    return response;
View Full Code Here

TOP

Related Classes of org.sonatype.configuration.validation.ValidationMessage

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.