Crossfire JXClient, Trunk
|
Classes | |
enum | SaveState |
Public Member Functions | |
DirectoryScannerConfig | addDirectoryScanner (String name, String dir, String filePattern, long sizeExceedsMaxBytes, long sinceLastModified) throws IOException, InstanceNotFoundException |
String | getConfigFilename () throws IOException, InstanceNotFoundException |
ScanManagerConfig | getConfiguration () throws IOException, InstanceNotFoundException |
SaveState | getSaveState () throws IOException, InstanceNotFoundException |
void | load () throws IOException, InstanceNotFoundException |
DirectoryScannerConfig | removeDirectoryScanner (String name) throws IOException, InstanceNotFoundException |
void | save () throws IOException, InstanceNotFoundException |
void | setConfiguration (ScanManagerConfig config) throws IOException, InstanceNotFoundException |
The ScanDirConfigMXBean
is in charge of the scandir application configuration.
The ScanDirConfigMXBean
is an MBean which is able to load and save the scandir application configuration to and from an XML file.
It will let you also interactively modify that configuration, which you can later save to the file, by calling save, or discard, by reloading the file without saving - see load.
There can be as many ScanDirConfigMXBean
registered in the MBeanServer as you like, but only one of them will be identified as the current configuration of the ScanManagerMXBean. You can switch to another configuration by calling {ScanManagerMXBean.setConfigurationMBean}.
Once the current configuration has been loaded (by calling load) or modified (by calling one of addDirectoryScanner, removeDirectoryScanner or setConfiguration) it can be pushed to the ScanManagerMXBean by calling {ScanManagerMXBean.applyConfiguration(true)} - true
means that we apply the configuration from memory, without first reloading the file.
Definition at line 83 of file ScanDirConfigMXBean.java.
DirectoryScannerConfig com.sun.jmx.examples.scandir.ScanDirConfigMXBean.addDirectoryScanner | ( | String | name, |
String | dir, | ||
String | filePattern, | ||
long | sizeExceedsMaxBytes, | ||
long | sinceLastModified | ||
) | throws IOException, InstanceNotFoundException |
Adds a new directory scanner to the current configuration data.
This method updates the configuration data in memory, adding a DirectoryScannerConfig to the {directory scanner list}. The #getSaveState state} is switched to { SaveState#MODIFIED MODIFIED}.
Calling load will reload the data from the configuration file, and all modifications will be lost. Calling save will save the modified data to the configuration file.
This action has no effect on the ScanManagerMXBean until ScanManagerMXBean points to this MBean and ScanManagerMXBean.applyConfiguration is called.
name | A name for the new directory scanner. This is the value that will be later used in the DirectoryScannerMXBean ObjectName for the name= key. |
dir | The root directory at which this scanner will start scanning. |
filePattern | A regular expression to match against a selected file name. |
sizeExceedsMaxBytes | Only file whose size exceeds that limit will be selected. <code.0 or a negative value means no limit. |
sinceLastModified | Select files which haven't been modified for that number of milliseconds - i.e. sinceLastModified=3600000
0 or a negative value is provided. |
DirectoryScannerConfig
. IOException | A connection problem occurred when accessing the underlying resource. |
InstanceNotFoundException | The underlying MBean is not registered in the MBeanServer. |
Implemented in com.sun.jmx.examples.scandir.ScanDirConfig.
Referenced by com.sun.jmx.examples.scandir.ScanDirConfigTest.testAddNotificationListener(), com.sun.jmx.examples.scandir.DirectoryScannerTest.testAddNotificationListener(), com.sun.jmx.examples.scandir.DirectoryScannerTest.testGetRootDirectory(), and com.sun.jmx.examples.scandir.DirectoryScannerTest.testScan().
String com.sun.jmx.examples.scandir.ScanDirConfigMXBean.getConfigFilename | ( | ) | throws IOException, InstanceNotFoundException |
Gets the name of the configuration file.
If the configuration file doesn't exists, load will fail and save will attempt to create the file.
IOException | A connection problem occurred when accessing the underlying resource. |
InstanceNotFoundException | The underlying MBean is not registered in the MBeanServer. |
Implemented in com.sun.jmx.examples.scandir.ScanDirConfig.
ScanManagerConfig com.sun.jmx.examples.scandir.ScanDirConfigMXBean.getConfiguration | ( | ) | throws IOException, InstanceNotFoundException |
Gets the current configuration data.
This method returns the configuration data which is currently held in memory.
Call load to reload the data from the configuration file, and save to save the data to the configuration file.
IOException | A connection problem occurred when accessing the underlying resource. |
InstanceNotFoundException | The underlying MBean is not registered in the MBeanServer. |
Implemented in com.sun.jmx.examples.scandir.ScanDirConfig.
Referenced by com.sun.jmx.examples.scandir.ScanManager.applyConfiguration(), com.sun.jmx.examples.scandir.ScanManager.applyCurrentResultLogConfig(), com.sun.jmx.examples.scandir.ScanDirClient.main(), com.sun.jmx.examples.scandir.ScanManager.postRegister(), com.sun.jmx.examples.scandir.ScanDirConfigTest.testAddNotificationListener(), com.sun.jmx.examples.scandir.DirectoryScannerTest.testGetRootDirectory(), and com.sun.jmx.examples.scandir.ScanDirConfigTest.testSave().
SaveState com.sun.jmx.examples.scandir.ScanDirConfigMXBean.getSaveState | ( | ) | throws IOException, InstanceNotFoundException |
Gets the save state of the current configuration data.
CREATED means that the configuration data was just created. It has not been loaded from the configuration file. Calling load will load the data from the configuration file. Calling save will write the empty data to the configuration file.
LOADED means that the configuration data was loaded from the configuration file.
MODIFIED means that the configuration data was modified since it was last loaded or saved. Calling load will reload the data from the configuration file, and all modifications will be lost. Calling save will write the modified data to the configuration file.
SAVED means that the configuration data was saved to the configuration file.
This state doesn't indicate whether this MBean configuration data was applied by the ScanManagerMXBean.
IOException | A connection problem occurred when accessing the underlying resource. |
InstanceNotFoundException | The underlying MBean is not registered in the MBeanServer. |
Implemented in com.sun.jmx.examples.scandir.ScanDirConfig.
void com.sun.jmx.examples.scandir.ScanDirConfigMXBean.load | ( | ) | throws IOException, InstanceNotFoundException |
Loads the configuration from the {configuration file}. Any unsaved modification will be lost. The state is switched to LOADED.
This action has no effect on the ScanManagerMXBean until ScanManagerMXBean points to this MBean and ScanManagerMXBean.applyConfiguration is called.
IOException | The configuration couldn't be loaded from the file, e.g. because the file doesn't exist or isn't readable. |
IOException | A connection problem occurred when accessing the underlying resource. |
InstanceNotFoundException | The underlying MBean is not registered in the MBeanServer. |
Implemented in com.sun.jmx.examples.scandir.ScanDirConfig.
Referenced by com.sun.jmx.examples.scandir.ScanManager.applyConfiguration(), com.sun.jmx.examples.scandir.ScanManager.postRegister(), and com.sun.jmx.examples.scandir.ScanDirConfigTest.testAddNotificationListener().
DirectoryScannerConfig com.sun.jmx.examples.scandir.ScanDirConfigMXBean.removeDirectoryScanner | ( | String | name | ) | throws IOException, InstanceNotFoundException |
Removes a directory scanner from the current configuration data.
This method updates the configuration data in memory, removing a DirectoryScannerConfig from the {directory scanner list}. The #getSaveState state} is switched to { SaveState#MODIFIED MODIFIED}.
Calling load will reload the data from the configuration file, and all modifications will be lost. Calling save will save the modified data to the configuration file.
This action has no effect on the ScanManagerMXBean until ScanManagerMXBean points to this MBean and ScanManagerMXBean.applyConfiguration is called.
name | The name of the new directory scanner. This is the value that is used in the DirectoryScannerMXBean ObjectName for the name= key. |
DirectoryScannerConfig
. IllegalArgumentException | if there's no directory scanner by that name in the current configuration data. |
IOException | A connection problem occurred when accessing the underlying resource. |
InstanceNotFoundException | The underlying MBean is not registered in the MBeanServer. |
Implemented in com.sun.jmx.examples.scandir.ScanDirConfig.
void com.sun.jmx.examples.scandir.ScanDirConfigMXBean.save | ( | ) | throws IOException, InstanceNotFoundException |
Saves the configuration to the {configuration file}. If the configuration file doesn't exists, this method will attempt to create it. Otherwise, the existing file will be renamed by appending a '~' to its name, and a new file will be created, in which the configuration will be saved. The state is switched to SAVED.
This action has no effect on the ScanManagerMXBean.
IOException | The configuration couldn't be saved to the file, e.g. because the file couldn't be created. |
IOException | A connection problem occurred when accessing the underlying resource. |
InstanceNotFoundException | The underlying MBean is not registered in the MBeanServer. |
Implemented in com.sun.jmx.examples.scandir.ScanDirConfig.
Referenced by com.sun.jmx.examples.scandir.ScanManager.applyCurrentResultLogConfig(), com.sun.jmx.examples.scandir.ScanDirConfigTest.testAddNotificationListener(), and com.sun.jmx.examples.scandir.ScanDirConfigTest.testSave().
void com.sun.jmx.examples.scandir.ScanDirConfigMXBean.setConfiguration | ( | ScanManagerConfig | config | ) | throws IOException, InstanceNotFoundException |
Sets the current configuration data.
This method replaces the configuration data in memory. The state is switched to {MODIFIED}.
Calling load will reload the data from the configuration file, and all modifications will be lost. Calling save will save the modified data to the configuration file.
This action has no effect on the ScanManagerMXBean until ScanManagerMXBean points to this MBean and ScanManagerMXBean.applyConfiguration is called.
config | The new configuration data. |
IOException | A connection problem occurred when accessing the underlying resource. |
InstanceNotFoundException | The underlying MBean is not registered in the MBeanServer. |
Implemented in com.sun.jmx.examples.scandir.ScanDirConfig.
Referenced by com.sun.jmx.examples.scandir.ScanManager.applyCurrentResultLogConfig(), com.sun.jmx.examples.scandir.ScanDirConfigTest.testAddNotificationListener(), and com.sun.jmx.examples.scandir.ScanDirConfigTest.testSave().