|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectuk.ac.starlink.util.Loader
Provides utilities associated with loading resources.
Field Summary | |
static String |
PROPERTIES_FILE
Name of the file in the user's home directory from which properties are loaded. |
Constructor Summary | |
Loader()
|
Method Summary | |
static Object |
getClassInstance(String className,
Class type)
Attempts to obtain an instance of a class with a given name which is an instance of a given type. |
static List |
getClassInstances(String[] defaultNames,
String propertyName,
Class type)
Returns a list of class instances got from a combination of a default list of classnames and the name of a property which may contain a colon-separated list of other classnames. |
static List |
getClassInstances(String propertyName,
Class type)
Attempts to obtain instances of a class from a colon-separated list of classnames in a named system property. |
static File |
getPropertiesFile()
Returns the name of the file from which properties will be loaded by this class. |
static boolean |
is64Bit()
Tests whether the JVM appears to be 64-bit or not. |
static void |
loadLibrary(String libname)
Loads a native library given its name. |
static void |
loadProperties()
Ensures that the user's customised properties have been loaded; these are read once from the file returned by the getPropertiesFile() method and incorporated into
the System properties. |
static File |
starjavaDirectory()
Returns the location of the main Starlink java directory which contains the lib, bin, etc, source directories and others. |
static void |
tweakGuiForMac()
Unless it's been set already, sets the value of the apple.laf.useScreenMenuBar system property to true. |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
public static final String PROPERTIES_FILE
Constructor Detail |
public Loader()
Method Detail |
public static File starjavaDirectory()
If for some reason the directory cannot be located, null is returned.
public static void loadLibrary(String libname) throws SecurityException, UnsatisfiedLinkError
libname
- the name of the library (not including system-specifics
such as 'lib' or '.so')
SecurityException
- if a security manager exists and its
checkLink method doesn't allow loading of the
specified dynamic library
UnsatisfiedLinkError
- if the library does not existSystem.loadLibrary(java.lang.String)
public static File getPropertiesFile() throws SecurityException
PROPERTIES_FILE
in the directory
given by the System property "user.home".
SecurityException
public static void loadProperties()
getPropertiesFile()
method and incorporated into
the System properties.
Calling this method after the first time has no effect.
System.getProperties()
public static Object getClassInstance(String className, Class type)
className
- name of the class to instantiatetype
- class which the instantiated class must be assignable
from
public static List getClassInstances(String propertyName, Class type)
getClassInstance(java.lang.String, java.lang.Class)
is called on each colon-separated
element of the property value, and if there is a non-null return,
it is added to the return list. For colon-separated elements which
do not correspond to usable classes, a message may be written
through the logging system.
propertyName
- name of a system property containing
colon-separated classnamestype
- class which instantiated classes must be assignable from
public static List getClassInstances(String[] defaultNames, String propertyName, Class type)
defaultNames
- array of stringpublic static boolean is64Bit()
public static void tweakGuiForMac()
28 Nov 2005: There is at least one sighting of this code causing trouble on Macs; a not-obviously-related ArrayIndexOutOfBoundsException thrown in apple.laf.ScreenMenuBar code in Treeview at Mac OS X 10.4.3 on a PowerPC G5, running Java 1.4.2_09. If the property is set false on the command line it goes away (if it's set true on the command line it stays, so it's not a case of it not being set early enough). So I think, given that I don't have a Mac to debug it on, I'm going to have to leave it unset by default.
11 Jan 2006: Apparently this is fixed at OS X's Java 1.5 JRE. So for JRE versions >= 1.5, the screen top menus are reinstated.
|
Copyright © 2004 CLRC: Central Laboratory of the Research Councils. All rights reserved. | |||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |