/** * Convenience method which saves the associated configuration. This method * expects that the managed configuration has already been created and that * a valid file location is available in the current {@code FileHandler}. * The file handler is then used to store the configuration. * * @throws ConfigurationException if an error occurs */ public void save() throws ConfigurationException { getFileHandler().save(); }
/** * Creates a fully initialized builder for a managed configuration. This * method is called by {@code getConfiguration()} whenever a configuration * file is requested which has not yet been loaded. This implementation * delegates to {@code createManagedBuilder()} for actually creating the * builder object. Then it sets the location to the configuration file. * * @param fileName the name of the file to be loaded * @param params a map with initialization parameters for the new builder * @return the newly created and initialized builder instance * @throws ConfigurationException if an error occurs */ protected FileBasedConfigurationBuilder<T> createInitializedManagedBuilder( final String fileName, final Map<String, Object> params) throws ConfigurationException { final FileBasedConfigurationBuilder<T> managedBuilder = createManagedBuilder(fileName, params); managedBuilder.getFileHandler().setFileName(fileName); return managedBuilder; }
/** * Installs the listener for the auto save mechanism if it is not yet * active. */ private void installAutoSaveListener() { if (autoSaveListener == null) { autoSaveListener = new AutoSaveListener(this); addEventListener(ConfigurationEvent.ANY, autoSaveListener); autoSaveListener.updateFileHandler(getFileHandler()); } }
FileBasedConfigurationBuilder fileBuilder = (FileBasedConfigurationBuilder) defBuilder; final URL url = fileBuilder.getFileHandler().getURL(); currentXMLParameters.setBasePath((url != null) ? url .toExternalForm() : fileBuilder.getFileHandler() .getBasePath());