Package org.sonatype.configuration

Examples of org.sonatype.configuration.ConfigurationException


      if (loadEvent.isVetoed()) {
        log.info(
            vetoFormatter.format(new VetoFormatterRequest(loadEvent, log.isDebugEnabled())));

        throw new ConfigurationException("The Nexus configuration is invalid!");
      }

      applyConfiguration();

      // we successfully loaded config
View Full Code Here


      final Class<Repository> klazz = (Class<Repository>) uberClassLoader.loadClass(repositoryModel.getProviderRole());
      return instantiateRepository(configuration, klazz, repositoryModel.getProviderHint(), repositoryModel);
    }
    catch (Exception e) {
      Throwables.propagateIfInstanceOf(e, ConfigurationException.class);
      throw new ConfigurationException("Cannot instantiate repository " + repositoryModel.getProviderRole() + ":"
          + repositoryModel.getProviderHint(), e);
    }
  }
View Full Code Here

              + ") cannot be created. It's repository type " + rtd + " is limited to " + maxCount
              + " instances, and it already has " + rtd.getInstanceCount() + " of them.";

      log.warn(msg);

      throw new ConfigurationException(msg);
    }
  }
View Full Code Here

  {
    // propagate call and fill in defaults too
    nexusDefaults.loadConfiguration();

    if (getConfigurationFile() == null || getConfigurationFile().getAbsolutePath().contains("${")) {
      throw new ConfigurationException("The configuration file is not set or resolved properly: "
          + getConfigurationFile().getAbsolutePath());
    }

    if (!getConfigurationFile().exists()) {
      log.warn("No configuration file in place, copying the default one and continuing with it.");
View Full Code Here

    setConfiguration(configurationUpgrader.loadOldConfiguration(file));

    // after all we should have a configuration
    if (getConfiguration() == null) {
      throw new ConfigurationException("Could not upgrade Nexus configuration! Please replace the "
          + file.getAbsolutePath() + " file with a valid Nexus configuration file.");
    }

    log.info("Creating backup from the old file and saving the upgraded configuration.");
View Full Code Here

      configuration = reader.read(ip);
    }
    catch (XmlPullParserException e) {
      configuration = null;

      throw new ConfigurationException("Nexus configuration file was not loaded, it has the wrong structure.", e);
    }
    finally {
      if (fr != null) {
        fr.close();
      }
    }

    // check the model version if loaded
    if (configuration != null && !Configuration.MODEL_VERSION.equals(configuration.getVersion())) {
      final String message = "Nexus configuration file was loaded but discarded, it has the wrong version number."
          + (" (expected " + Configuration.MODEL_VERSION + ", actual " + configuration.getVersion() + ")");

      rejectConfiguration(message, null);

      throw new ConfigurationException(message);
    }

    if (getConfiguration() != null) {
      log.info("Configuration loaded successfully.");
    }
View Full Code Here

  {
    if (configuration instanceof ApplicationConfiguration) {
      return new CRemoteProxySettingsCoreConfiguration((ApplicationConfiguration) configuration);
    }
    else {
      throw new ConfigurationException("The passed configuration object is of class \""
          + configuration.getClass().getName() + "\" and not the required \""
          + ApplicationConfiguration.class.getName() + "\"!");
    }
  }
View Full Code Here

          String.format(
              "Repository being created \"%s\" (repoId=%s) has corresponding type that is not registered in Core: Repository type %s:%s is unknown to Nexus Core. It is probably contributed by an old Nexus plugin. Please contact plugin developers to upgrade the plugin, and register the new repository type(s) properly!",
              repoConfig.getName(), repoConfig.getId(), repoConfig.getProviderRole(),
              repoConfig.getProviderHint());

      throw new ConfigurationException(msg);
    }

    ContentClass contentClass = repositoryTypeRegistry.getRepositoryContentClass(rtd.getRole(), rtd.getHint());

    return new ManuallyConfiguredRepositoryTemplate(this, "manual", "Manually created template", contentClass,
View Full Code Here

  {
    if (configuration instanceof ApplicationConfiguration) {
      return new CGlobalRemoteConnectionSettingsCoreConfiguration((ApplicationConfiguration) configuration);
    }
    else {
      throw new ConfigurationException("The passed configuration object is of class \""
          + configuration.getClass().getName() + "\" and not the required \""
          + ApplicationConfiguration.class.getName() + "\"!");
    }
  }
View Full Code Here

  {
    // propagate call and fill in defaults too
    securityDefaults.loadConfiguration();

    if (getConfigurationFile() == null || getConfigurationFile().getAbsolutePath().contains("${")) {
      throw new ConfigurationException("The configuration file is not set or resolved properly: "
          + (getConfigurationFile() == null ? "null" : getConfigurationFile().getAbsolutePath()));
    }

    if (!getConfigurationFile().exists()) {
      getLogger().warn("No configuration file in place, copying the default one and continuing with it.");
View Full Code Here

TOP

Related Classes of org.sonatype.configuration.ConfigurationException

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.