Package com.iizigo.server
Class ServerConfigFile
The Server configuration file container. A single copy of each file is used system-wide.
- Author:
- Christopher Mindus
Method Summary
Modifier and TypeMethodDescriptionboolean
doSave
(Shell shell, IProgressMonitor monitor) Saves the configuration file.Gets the history of configuration files.Gets the name without file extension.getPath()
Gets the path of the file.Gets the Server configuration settings.boolean
isDirty()
Gets the dirty state.static EditorServerSettings
Loads the Server Configuration settings file.static ServerConfigFile
Opens the configuration file.void
release()
Releases this instance.void
Triggers a request to update the listeners.void
Updates the history with this file.Methods inherited from class com.iizix.GenericListener
addListener, clear, forEach, hasListeners, listeners, removeListener
Method Details
open
Opens the configuration file. The reference count of the file is increased, and as there is only one instance of it system-wide, it is VERY important to release it withrelease()
when it is no longed referenced.- Parameters:
fileName
- The file name.- Returns:
- The configuration file instance.
- Throws:
IOException
- For file errors.FileNotFoundException
- If the file is not found.PropException
- For load errors.
loadFile
Loads the Server Configuration settings file. This method does not affect the internal state of the ServerConfigFile instance or the global settings. It's just a method to load the file.- Parameters:
file
- The file.- Returns:
- The settings.
- Throws:
IOException
- For file errors.PropException
- For load errors.
getHistory
Gets the history of configuration files. Only files that do exist are returned.- Returns:
- The history of configuration files.
getNameNoExt
Gets the name without file extension.- Returns:
- The file base name.
getPath
Gets the path of the file.- Returns:
- The file path.
isDirty
public boolean isDirty()Gets the dirty state.- Returns:
- true if file needs saving, false if not dirty.
triggerNotify
public void triggerNotify()Triggers a request to update the listeners. This can be called from any thread. The listeners will be notified with a delay of (currently) 300ms.doSave
Saves the configuration file. The dirty state is changed upon successful save. Call this method from the UI thread.- Parameters:
shell
- The shell for message boxes in case of error.monitor
- The progress monitor- Returns:
- Success flag.
getSettings
Gets the Server configuration settings.- Returns:
- The settings property.
release
public void release()Releases this instance.updateHistory
public void updateHistory()Updates the history with this file. It is placed as the most recently used in the list.