ecologylab.appframework
Class EnvironmentGeneric

java.lang.Object
  extended by ecologylab.generic.Generic
      extended by ecologylab.appframework.EnvironmentGeneric

public class EnvironmentGeneric
extends Generic

Author:
andruid

Field Summary
protected static ParsedURL configDir
           
static ParsedURL MAC_JAVA_PURL
          Where to navigate to to download the lastest Java for the Macintosh.
static ParsedURL SUN_JAVA_PURL
          Where to navigate to to download the lastest Java.
 
Fields inherited from class ecologylab.generic.Generic
SEP
 
Constructor Summary
EnvironmentGeneric()
           
 
Method Summary
static ParsedURL codeBase()
           
static ParsedURL configDir()
          The config directory, as located relative to the codebase, with the jar file and perhaps the sources.
static ParsedURL configPath(java.lang.String relativePath)
          Obtain a path relative to the configDir().
static ParsedURL docBase()
           
static ParsedURL downloadJavaPURL()
          Checks what platform we're on, and returns a suitable PURL that you would navigate to, to download the current Java.
static void exit(int code)
          Called at the end of an invocation.
static ParsedURL getRelativeOrAbsolute(java.lang.String webAddr, java.lang.String errorDescriptor)
          Uses an absolute URL, if the String parameter looks like that, or one that's relative to docBase, if it looks a relative URL.
static ParsedURL getRelativeToCodeBase(java.lang.String relativeURLPath, java.lang.String errorDescriptor)
          Create ParsedURL using the codeBase(), and a relative url string.
static ParsedURL getRelativeToDocBase(java.lang.String relativeURLPath, java.lang.String errorDescriptor)
          Create ParsedURL with doc base and relative url string.
static boolean hasGoodJava()
          Check to see if we're running on what we consider to be a decent, usable version of Java.
static boolean hasXML()
           
static float javaVersion()
           
static java.lang.String javaVersionFull()
           
static void navigate(ParsedURL purl)
          Open a document in a web browser.
static void showDialogAndExit(java.lang.String msg, int code)
           
static void status(java.lang.String msg)
           
 
Methods inherited from class ecologylab.generic.Generic
beep, booleanFromString, findEqual, findThreadGroup, findThreadGroup, findThreadGroup, getMaxMemory, main, narrowFloat, parseFloat, parseInt, raiseMaxPriority, raiseMaxPriority, raiseMaxPriority, raisePriority, round, setPriority, setPriority, showDialog, sleep, sleep
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

configDir

protected static ParsedURL configDir

SUN_JAVA_PURL

public static ParsedURL SUN_JAVA_PURL
Where to navigate to to download the lastest Java.


MAC_JAVA_PURL

public static ParsedURL MAC_JAVA_PURL
Where to navigate to to download the lastest Java for the Macintosh.

Constructor Detail

EnvironmentGeneric

public EnvironmentGeneric()
Method Detail

codeBase

public static ParsedURL codeBase()

configDir

public static ParsedURL configDir()
The config directory, as located relative to the codebase, with the jar file and perhaps the sources. This is where the tree of configuration assets is rooted. Examples of configuration assets include interface graphics, interface semantic descriptions (xml), dictionary, ... These are files that don't change often, and are needed for an application.

Returns:

docBase

public static ParsedURL docBase()

configPath

public static ParsedURL configPath(java.lang.String relativePath)
Obtain a path relative to the configDir().

Parameters:
relativePath -
Returns:

javaVersion

public static float javaVersion()
Returns:
The version of Java we're using (but not the specific release), as in 1.2, 1.3, 1.4,...

hasGoodJava

public static boolean hasGoodJava()
Check to see if we're running on what we consider to be a decent, usable version of Java. For 1.5, this means rel 4 or more; for 1.4, it means 1.42_04 or more.

Returns:
true if the Java we're running on is good; false if its crap.

javaVersionFull

public static java.lang.String javaVersionFull()
Returns:
The version of Java we're using (with the specific release)

hasXML

public static boolean hasXML()

downloadJavaPURL

public static ParsedURL downloadJavaPURL()
Checks what platform we're on, and returns a suitable PURL that you would navigate to, to download the current Java.

Returns:
PURL of www.java.com, or www.apple.com/java.

status

public static void status(java.lang.String msg)

navigate

public static void navigate(ParsedURL purl)
Open a document in a web browser.

Parameters:
purl - The address of the web document.

exit

public static void exit(int code)
Called at the end of an invocation. Calls System.exit(code).

Parameters:
code - -- 0 for normal. other values are application specific.

showDialogAndExit

public static void showDialogAndExit(java.lang.String msg,
                                     int code)

getRelativeOrAbsolute

public static ParsedURL getRelativeOrAbsolute(java.lang.String webAddr,
                                              java.lang.String errorDescriptor)
Uses an absolute URL, if the String parameter looks like that, or one that's relative to docBase, if it looks a relative URL.


getRelativeToDocBase

public static ParsedURL getRelativeToDocBase(java.lang.String relativeURLPath,
                                             java.lang.String errorDescriptor)
Create ParsedURL with doc base and relative url string.

Returns:
null if the docBase is null.

getRelativeToCodeBase

public static ParsedURL getRelativeToCodeBase(java.lang.String relativeURLPath,
                                              java.lang.String errorDescriptor)
Create ParsedURL using the codeBase(), and a relative url string.

Returns:
null if the codeBase is null.