Package org.sonatype.configuration.validation

Examples of org.sonatype.configuration.validation.InvalidConfigurationException


      final String mungledHint = remoteProviderHintFactory.getRoleHint(remoteUrl, provider);
      final RemoteRepositoryStorage result = remoteRepositoryStorages.get(mungledHint);
      if (result != null) {
        return result;
      }
      throw new InvalidConfigurationException("Repository " + repoId
          + " have remote storage with unsupported provider: " + provider);
    }
    catch (IllegalArgumentException e) {
      throw new InvalidConfigurationException("Repository " + repoId
          + " have remote storage with unsupported provider: " + provider, e);
    }
  }
View Full Code Here


  protected void validate(CPathMappingItem pathItem)
      throws InvalidConfigurationException
  {
    ValidationResponse response = this.validator.validateGroupsSettingPathMappingItem(null, pathItem);
    if (!response.isValid()) {
      throw new InvalidConfigurationException(response);
    }
  }
View Full Code Here

    // first save the user
    // this is the UserManager that owns the user
    UserManager userManager = userManagerFacade.getUserManager(user.getSource());

    if (!userManager.supportsWrite()) {
      throw new InvalidConfigurationException("UserManager: " + userManager.getSource()
          + " does not support writing.");
    }

    userManager.addUser(user, password);
View Full Code Here

    // first update the user
    // this is the UserManager that owns the user
    UserManager userManager = userManagerFacade.getUserManager(user.getSource());

    if (!userManager.supportsWrite()) {
      throw new InvalidConfigurationException("UserManager: " + userManager.getSource()
          + " does not support writing.");
    }

    final User oldUser = userManager.getUser(user.getUserId());
    userManager.updateUser(user);
View Full Code Here

  public void setAnonymousAccess(final boolean enabled, final String username, final String password)
      throws InvalidConfigurationException
  {
    if (enabled) {
      if (Strings.isNullOrEmpty(username) || Strings.isNullOrEmpty(password)) {
        throw new InvalidConfigurationException(
            "Anonymous access is getting enabled without valid username and/or password!");
      }

      final String oldUsername = getSecuritySystem().getAnonymousUsername();
      final String oldPassword = getSecuritySystem().getAnonymousPassword();

      // try to enable the "anonymous" user defined in XML realm, but ignore any problem (users might
      // delete
      // or already disabled it, or completely removed XML realm)
      // this is needed as below we will try a login
      final boolean statusChanged = setAnonymousUserEnabled(username, true);

      // detect change
      if (!Objects.equals(oldUsername, username) || !Objects.equals(oldPassword, password)) {
        try {
          // test authc with changed credentials
          try {
            // try to "log in" with supplied credentials
            // the anon user a) should exists
            securitySystem.getUser(username);
            // b) the pwd must work
            securitySystem.authenticate(new UsernamePasswordToken(username, password));
          }
          catch (UserNotFoundException e) {
            final String msg = "User \"" + username + "'\" does not exist.";
            log.warn(
                "Nexus refused to apply configuration, the supplied anonymous information is wrong: " + msg,
                e);
            throw new InvalidConfigurationException(msg, e);
          }
          catch (AuthenticationException e) {
            final String msg = "The password of user \"" + username + "\" is incorrect.";
            log.warn(
                "Nexus refused to apply configuration, the supplied anonymous information is wrong: " + msg,
                e);
            throw new InvalidConfigurationException(msg, e);
          }
        }
        catch (InvalidConfigurationException e) {
          if (statusChanged) {
            setAnonymousUserEnabled(username, false);
View Full Code Here

    }

    ValidationResponse vr = configurationValidator.validateRepository(ctx, settings);

    if (!vr.isValid()) {
      throw new InvalidConfigurationException(vr);
    }
  }
View Full Code Here

      }

      return getConfiguration();
    }
    else {
      throw new InvalidConfigurationException(vResponse);
    }
  }
View Full Code Here

      final Provider<? extends Repository> rp = beanLocator.locate(Key.get(type, Names.named(name))).iterator().next()
          .getProvider();
      return rp.get();
    }
    catch (Exception e) {
      throw new InvalidConfigurationException("Could not lookup a new instance of Repository!", e);
    }
  }
View Full Code Here

  protected void checkValidationResponse(ValidationResponse response)
      throws ConfigurationException
  {
    if (!response.isValid()) {
      throw new InvalidConfigurationException(response);
    }
  }
View Full Code Here

    final ValidationResponse vr = validateConfig(result);
    if (vr.isValid()) {
      return result;
    }
    else {
      log.warn("Invalid Kenai Realm configuration, not using it ", new InvalidConfigurationException(vr));
      return new Configuration();
    }
  }
View Full Code Here

TOP

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

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.