Class Configuration


  • public class Configuration
    extends java.lang.Object
    This class represents a WakeOnLan configuration.
    Author:
    Steffen Moldaner
    • Constructor Summary

      Constructors 
      Constructor Description
      Configuration()  
      Configuration​(java.io.File file)
      Creates a new configuration with the given file.
      Configuration​(java.lang.String path)
      Creates a new configuration with the given path.
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      java.io.File getFile()
      Returns the file for this configuration.
      Machine[] getMachines()
      Returns the machines.
      void loadConfig()
      Loads this configuration from the file returned by getFile().
      void saveConfig()
      Saves this configuration to the file returned by getFile().
      void saveConfigAs​(java.io.File file)
      Saves this configuration to the given file.
      void setMachines​(Machine[] machines)
      Sets the machines.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

      • Configuration

        public Configuration()
      • Configuration

        public Configuration​(java.lang.String path)
        Creates a new configuration with the given path.
        Parameters:
        path - a path that denotes a file the configuration will be saved to
      • Configuration

        public Configuration​(java.io.File file)
        Creates a new configuration with the given file. If the file exists the configurations loads immidiatly from this file.
        Parameters:
        file - a file this configuration will be saved to
        See Also:
        loadConfig()
    • Method Detail

      • getMachines

        public Machine[] getMachines()
        Returns the machines.
        Returns:
        the machines
      • setMachines

        public void setMachines​(Machine[] machines)
        Sets the machines.
        Parameters:
        machines - the machines
      • loadConfig

        public void loadConfig()
                        throws java.io.FileNotFoundException
        Loads this configuration from the file returned by getFile().
        Throws:
        java.io.FileNotFoundException - if the file does not exist.
        See Also:
        getFile()
      • saveConfig

        public void saveConfig()
                        throws java.io.FileNotFoundException
        Saves this configuration to the file returned by getFile(). This is equal to saveConfig(getFile()).
        Throws:
        java.io.FileNotFoundException - if the file exists but is a directory rather than a regular file, does not exist but cannot be created, or cannot be opened for any other reason
        See Also:
        getFile(), saveConfigAs(File)
      • saveConfigAs

        public void saveConfigAs​(java.io.File file)
                          throws java.io.FileNotFoundException
        Saves this configuration to the given file. The configuration will then use this file for saves.
        Parameters:
        file - the file
        Throws:
        java.io.FileNotFoundException - if the file exists but is a directory rather than a regular file, does not exist but cannot be created, or cannot be opened for any other reason
        See Also:
        saveConfigAs(File)
      • getFile

        public java.io.File getFile()
        Returns the file for this configuration.
        Returns:
        the file