Class MagellanFinder


  • public class MagellanFinder
    extends java.lang.Object
    Small class for start-up help. Two search functions: The Magellan directory and the settings file.
    Version:
    1.0
    Author:
    Andreas
    • Constructor Summary

      Constructors 
      Constructor Description
      MagellanFinder()  
    • Method Summary

      All Methods Static Methods Concrete Methods 
      Modifier and Type Method Description
      protected static boolean checkJar​(java.io.File file)
      Checks if the given file is a zip and contains a "magellan/client/Client.class".
      protected static boolean checkJar​(java.lang.String file)
      Checks if the given file is a zip and contains a "magellan/client/Client.class".
      protected static java.lang.String extractDir​(java.lang.String file)
      Extracts the directory out of the given file.
      static java.io.File findMagellanDirectory()
      Searches for Magellan.
      static java.io.File findSettingsDirectory​(java.io.File magDirectory, java.io.File settDir)
      Tries to create/read the settings file in settDir (first), the user's home directory (second), magDirectory (third) or the current directory (last).
      protected static java.io.File getAppDataDirectory()  
      • Methods inherited from class java.lang.Object

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

      • MagellanFinder

        public MagellanFinder()
    • Method Detail

      • findSettingsDirectory

        public static java.io.File findSettingsDirectory​(java.io.File magDirectory,
                                                         java.io.File settDir)
        Tries to create/read the settings file in settDir (first), the user's home directory (second), magDirectory (third) or the current directory (last). The first valid location is returned.
        Parameters:
        magDirectory - The magellan resource directory
        settDir - null or the magellan settings directory
        Returns:
        The directory where the configuration files reside.
      • getAppDataDirectory

        protected static java.io.File getAppDataDirectory()
      • findMagellanDirectory

        public static java.io.File findMagellanDirectory()
        Searches for Magellan. This method scans the CLASSPATH and searches for JARs containing "magellan.client.Client" or corresponding directory structures.
      • extractDir

        protected static java.lang.String extractDir​(java.lang.String file)
        Extracts the directory out of the given file. If any error occurs, the current directory(".") is returned.
      • checkJar

        protected static boolean checkJar​(java.lang.String file)
        Checks if the given file is a zip and contains a "magellan/client/Client.class". These are the conditions for the file to be a valid magellan Java Archive (JAR).
      • checkJar

        protected static boolean checkJar​(java.io.File file)
        Checks if the given file is a zip and contains a "magellan/client/Client.class". These are the conditions for the file to be a valid magellan Java Archive (JAR).