org.gudy.azureus2.plugins.config
Interface PluginConfigSource

All Known Implementing Classes:
PluginConfigSourceImpl

public interface PluginConfigSource

This interface provides a mechanism for plugins to store configuration settings in a separate configuration file (rather than the main Azureus configuration file).

Important: If you are using this class for a plugin which previously used to store configuration settings in the main configuration file (which is what most existing plugins do), you should call the forceSettingsMigration() method to get existing settings moved over - please read the comments for that file if you need to do that.

To create an instance of this file, you need to call PluginConfig.enableExternalConfigSource(). Once you have an instance, you then need to call initialize() to configure it - though there are additional methods that you can call for additional configuration.

Note: Only for implementation by Azureus, not plugins.


Method Summary
 void forceSettingsMigration()
          If your plugin previously used to store data in the main configuration file, you can call this method (which needs to be done soon after initialization) which will move all monitored parameters over to this object.
 File getConfigFile()
          Returns a file object which represents the location of the configuration file that this object interacts with.
 void initialize()
          This initializes this configuration object and gets the external configuration file integrated with Azureus.
 void save(boolean force)
          Manually saves the configuration settings recorded by this object to disk.
 void setConfigFilename(String filename)
          This method sets the filename for the configuration file that this object links to - this must be done before the initialize() method is called.
 

Method Detail

initialize

void initialize()
This initializes this configuration object and gets the external configuration file integrated with Azureus.

It performs the following steps:


setConfigFilename

void setConfigFilename(String filename)
This method sets the filename for the configuration file that this object links to - this must be done before the initialize() method is called.

Parameters:
filename - The filename to use.

getConfigFile

File getConfigFile()
Returns a file object which represents the location of the configuration file that this object interacts with.


save

void save(boolean force)
Manually saves the configuration settings recorded by this object to disk. This isn't normally required, as Azureus will automatically save the configuration file when the main configuration file is saved, but you can choose to save on demand if you wish.

Parameters:
force - true if you want the file to be written to regardless of whether there are any changes, false if you only want to save the file if there are unsaved changes.

forceSettingsMigration

void forceSettingsMigration()
If your plugin previously used to store data in the main configuration file, you can call this method (which needs to be done soon after initialization) which will move all monitored parameters over to this object.

You have to call this method before you initialize the object. It's also recommended that if you call this method, that you call save(boolean) to save any settings copied across - probably best to be done as the last thing of the Plugin.initialize(PluginInterface) method.