Package com.iizigo.server
Class ServerConfigFile
- java.lang.Object
- com.iizix.GenericListener<IServerConfigFileListener>
- com.iizigo.server.ServerConfigFile
 
 
- public class ServerConfigFile extends GenericListener<IServerConfigFileListener> The Server configuration file container. A single copy of each file is used system-wide.- Author:
- Christopher Mindus
 
- Method Summary- All Methods Static Methods Instance Methods Concrete Methods - Modifier and Type - Method - Description - boolean- doSave(org.eclipse.swt.widgets.Shell shell, org.eclipse.core.runtime.IProgressMonitor monitor)Saves the configuration file.- static java.util.List<java.io.File>- getHistory()Gets the history of configuration files.- java.lang.String- getNameNoExt()Gets the name without file extension.- java.lang.String- getPath()Gets the path of the file.- EditorServerSettings- getSettings()Gets the Server configuration settings.- boolean- isDirty()Gets the dirty state.- static EditorServerSettings- loadFile(java.io.File file)Loads the Server Configuration settings file.- static ServerConfigFile- open(java.lang.String fileName)Opens the configuration file.- void- release()Releases this instance.- void- triggerNotify()Triggers a request to update the listeners.- void- updateHistory()Updates the history with this file.- Methods inherited from class com.iizix.GenericListener- addListener, clear, forEach, hasListeners, listeners, removeListener
 
 
- Method Detail- open- public static ServerConfigFile open(java.lang.String fileName) throws java.io.IOException, PropException 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 with- release()when it is no longed referenced.- Parameters:
- fileName- The file name.
- Returns:
- The configuration file instance.
- Throws:
- java.io.IOException- For file errors.
- java.io.FileNotFoundException- If the file is not found.
- PropException- For load errors.
 
 - loadFile- public static EditorServerSettings loadFile(java.io.File file) throws java.io.IOException, PropException 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:
- java.io.IOException- For file errors.
- PropException- For load errors.
 
 - getHistory- public static java.util.List<java.io.File> getHistory() Gets the history of configuration files. Only files that do exist are returned.- Returns:
- The history of configuration files.
 
 - getNameNoExt- public java.lang.String getNameNoExt() Gets the name without file extension.- Returns:
- The file base name.
 
 - getPath- public java.lang.String 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- public boolean doSave(org.eclipse.swt.widgets.Shell shell, org.eclipse.core.runtime.IProgressMonitor monitor)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- public EditorServerSettings 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.