Class 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 Details Link icon

    • open Link icon

      public static ServerConfigFile open(String fileName) throws 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:
      IOException - For file errors.
      FileNotFoundException - If the file is not found.
      PropException - For load errors.
    • loadFile Link icon

      public static EditorServerSettings loadFile(File file) throws 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:
      IOException - For file errors.
      PropException - For load errors.
    • getHistory Link icon

      public static List<File> getHistory()
      Gets the history of configuration files. Only files that do exist are returned.
      Returns:
      The history of configuration files.
    • getNameNoExt Link icon

      public String getNameNoExt()
      Gets the name without file extension.
      Returns:
      The file base name.
    • getPath Link icon

      public String getPath()
      Gets the path of the file.
      Returns:
      The file path.
    • isDirty Link icon

      public boolean isDirty()
      Gets the dirty state.
      Returns:
      true if file needs saving, false if not dirty.
    • triggerNotify Link icon

      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 Link icon

      public boolean doSave(Shell shell, 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 Link icon

      public EditorServerSettings getSettings()
      Gets the Server configuration settings.
      Returns:
      The settings property.
    • release Link icon

      public void release()
      Releases this instance.
    • updateHistory Link icon

      public void updateHistory()
      Updates the history with this file. It is placed as the most recently used in the list.