public synchronized void loadConfiguration(boolean force) throws ConfigurationException, IOException { if (force || configurationSource.getConfiguration() == null) { getLogger().info("Loading Nexus Configuration..."); configurationSource.loadConfiguration(); boolean modified = false; for (ConfigurationModifier modifier : configurationModifiers) { modified |= modifier.apply(configurationSource.getConfiguration()); } if (modified) { configurationSource.backupConfiguration(); configurationSource.storeConfiguration(); } globalLocalStorageContext = new DefaultLocalStorageContext(null); // create global remote ctx // this one has no parent globalRemoteStorageContext = new DefaultRemoteStorageContext(null); globalRemoteConnectionSettings.configure(this); globalRemoteStorageContext.setRemoteConnectionSettings(globalRemoteConnectionSettings); remoteProxySettingsConfiguration.configure(this); globalRemoteStorageContext.setRemoteProxySettings(remoteProxySettingsConfiguration); ConfigurationPrepareForLoadEvent loadEvent = new ConfigurationPrepareForLoadEvent(this); eventBus.post(loadEvent); if (loadEvent.isVetoed()) { getLogger() .info( vetoFormatter.format( new VetoFormatterRequest(loadEvent, getLogger().isDebugEnabled()))); throw new ConfigurationException("The Nexus configuration is invalid!"); } applyConfiguration(); // we successfully loaded config eventBus.post(new ConfigurationLoadEvent(this)); } }
public synchronized void saveConfiguration() throws IOException { if (applyConfiguration()) { // TODO: when NEXUS-2215 is fixed, this should be remove/moved/cleaned // START <<< // validate before we do anything ValidationRequest request = new ValidationRequest(configurationSource.getConfiguration()); ValidationResponse response = configurationValidator.validateModel(request); if (!response.isValid()) { this.getLogger() .error("Saving nexus configuration caused unexpected error:\n" + response.toString()); throw new IOException( "Saving nexus configuration caused unexpected error:\n" + response.toString()); } // END <<< configurationSource.storeConfiguration(); // we successfully saved config eventBus.post(new ConfigurationSaveEvent(this)); } }
public boolean isConfigurationDefaulted() { return configurationSource.isConfigurationDefaulted(); }
public boolean isConfigurationUpgraded() { return configurationSource.isConfigurationUpgraded(); }
public boolean isInstanceUpgraded() { return configurationSource.isInstanceUpgraded(); }
@Deprecated public Configuration getConfigurationModel() { return configurationSource.getConfiguration(); }