gate
Class Gate

java.lang.Object
  extended by gate.Gate
All Implemented Interfaces:
GateConstants

public class Gate
extends Object
implements GateConstants

The class is responsible for initialising the GATE libraries, and providing access to singleton utility objects, such as the GATE class loader, CREOLE register and so on.


Nested Class Summary
static class Gate.DirectoryInfo
          Stores information about the contents of a CREOLE directory.
static class Gate.ResourceInfo
          Stores information about a resource defined by a CREOLE directory.
private static class Gate.ResourceInfoVisitor
          ClassVisitor that uses information from a CreoleResource annotation on the visited class (if such exists) to fill in the name and comment in the corresponding ResourceInfo.
 
Field Summary
protected static List<URL> autoloadPlugins
          The list of plugins (aka CREOLE directories) the system loads automatically at start-up.
protected static URL builtinCreoleDir
          The "builtin" creole directory URL, where the creole.xml that defines things like DocumentImpl can be found.
private static String[] builtinCreoleDirectoryUrls
          The list of builtin URLs to search for CREOLE resources.
private static GateClassLoader classLoader
          Class loader used e.g. for loading CREOLE modules, of compiling JAPE rule RHSs.
private static CreoleRegister creoleRegister
          The CREOLE register.
private static Executable currentExecutable
          The current executable under execution.
private static DataStoreRegister dataStoreRegister
          The DataStore register
static String DB_OWNER
          The database schema owner (GATEADMIN is default) this one should not be hardcoded but set in the XML initialization files
private static String emptyConfigFile
          An empty config data file.
protected static String ENABLE_BENCHMARKING_FEATURE_NAME
          Feature name that should be used to set if the benchmarking logging should be enabled or disabled.
protected static File gateHome
          The top level directory of the GATE installation.
static int HASH_STH_SIZE
          The default size to be used for Hashtable, HashMap and HashSet.
protected static boolean initFinished
          Records initialisation status.
protected static List<URL> knownPlugins
          The list of plugins (aka CREOLE directories) the system knows about.
private static int lastSym
           
static Map<String,EventListener> listeners
          Deprecated. 
private static boolean localWebServer
          Flag controlling whether we should try to access a web server on localhost, e.g. when setting up a base URL.
protected static org.apache.log4j.Logger log
          A logger to use instead of sending messages to Out or Err
protected static String MIN_JDK_VERSION
          Minimum version of JDK we support
private static boolean netConnected
          Flag controlling whether we should try to access the net, e.g. when setting up a base URL.
private static String nl
          Shorthand for local newline
private static OptionsMap originalUserConfig
          This map stores the init-time config data in case we need it later.
protected static Map<URL,Gate.DirectoryInfo> pluginData
          Map from URL of directory to Gate.DirectoryInfo.
protected static File pluginsHome
          The top level directory for GATE installed plugins.
private static Set<String> registeredIREngines
          A list of names of classes that implement IREngine that will be used as information retrieval engines.
private static boolean sandboxed
          Is true if GATE is to be run in a sandbox
private static File siteConfigFile
          Site config file
private static boolean slugGui
          Flag for SLUG GUI start instead of standart GATE GUI.
static int STRINGBUFFER_SIZE
          The default StringBuffer size, it seems that we need longer string than the StringBuffer class default because of the high number of buffer expansions
static String URI
          The GATE URI used to interpret custom GATE tags
private static URL urlBase
          The URL base for GATE files, e.g.
private static OptionsMap userConfig
          GATE development environment configuration data (stored in gate.xml).
private static String userConfigElement
          Name of the XML element for GATE development environment config data.
private static File userConfigFile
          User config file
protected static File userSessionFile
          The user session file to use.
private static boolean useXMLSerialization
          Flag for whether to use native serialization or xml serialization when saving applications.
 
Fields inherited from interface gate.GateConstants
ABOUT_URL_JAVA_PROPERTY_NAME, ADD_NAMESPACE_FEATURES, ANNOT_TYPE_TO_EXPORT, APP_ICON_JAVA_PROPERTY_NAME, APP_SPLASH_JAVA_PROPERTY_NAME, APPLICATION_JAVA_PROPERTY_NAME, AUTOLOAD_PLUGIN_PATH_KEY, AUTOLOAD_PLUGIN_PATH_PROPERTY_NAME, BUILTIN_CREOLE_DIR_PROPERTY_NAME, COMPILER_TYPE_KEY, CORPUS_INDEX_DEFINITION_FEATURE_KEY, CORPUS_INDEX_STATISTICS_FEATURE_KEY, DOCEDIT_INSERT_APPEND, DOCEDIT_INSERT_PREPEND, DOCEDIT_READ_ONLY, DOCUMENT_ADD_SPACE_ON_UNPACK_FEATURE_NAME, DOCUMENT_NEW_LINE_TYPE, DOCUMENT_REPOSITIONING_INFO_FEATURE_NAME, ELEMENT_NAMESPACE_PREFIX, ELEMENT_NAMESPACE_URI, GATE_CONFIG_PROPERTY, GATE_DOT_SER, GATE_DOT_XML, GATE_HOME_PROPERTY_NAME, GATE_SITE_CONFIG_PROPERTY_NAME, GATE_USER_CONFIG_PROPERTY_NAME, GATE_USER_SESSION_PROPERTY_NAME, HIDDEN_FEATURE_KEY, KNOWN_PLUGIN_PATH_KEY, LOOK_AND_FEEL, MAIN_FRAME_HEIGHT, MAIN_FRAME_WIDTH, MENU_PATH_KEY, MENUS_FONT, ORIGINAL_DOCUMENT_CONTENT_FEATURE_NAME, ORIGINAL_MARKUPS_ANNOT_SET_NAME, OTHER_COMPONENTS_FONT, PLUGINS, PLUGINS_HOME_PROPERTY_NAME, SAVE_FEATURES_WHEN_PRESERVING_FORMAT, SAVE_OPTIONS_ON_EXIT, SAVE_SESSION_ON_EXIT, SITE_CONFIG_PROPERTY_NAME, TEXT_COMPONENTS_FONT, THROWEX_FORMAT_PROPERTY_NAME, TITLE_JAVA_PROPERTY_NAME, USER_CONFIG_PROPERTY_NAME, WORDNET_CONFIG_FILE
 
Constructor Summary
Gate()
           
 
Method Summary
static void addAutoloadPlugin(URL pluginUrl)
          Adds a new directory to the list of plugins that are loaded automatically at start-up.
static void addCreoleListener(CreoleListener l)
          Registers a CreoleListener with the Gate system
static void addKnownPlugin(URL pluginURL)
          Adds the plugin to the list of known plugins.
static String genSym()
          Returns a new unique string
static List<URL> getAutoloadPlugins()
          Returns the list of CREOLE directories the system loads automatically at start-up.
static URL getBuiltinCreoleDir()
          Get the URL to the "builtin" creole directory, i.e. the directory that contains the creole.xml file that defines things like DocumentImpl, the Controllers, etc.
static GateClassLoader getClassLoader()
          Get the GATE class loader.
static CreoleRegister getCreoleRegister()
          Get the CREOLE register.
static DataStoreRegister getDataStoreRegister()
          Get the DataStore register.
static String getDefaultUserConfigFileName()
          Get the default path to the user's config file, which is used unless an alternative name has been specified via system properties or setUserConfigFile(java.io.File).
static String getDefaultUserSessionFileName()
          Get the default path to the user's session file, which is used unless an alternative name has been specified via system properties or setUserSessionFile(File)
static Gate.DirectoryInfo getDirectoryInfo(URL directory)
          Gets the information about a known directory.
static String getEmptyConfigFile()
          Get an empty config file.
static Executable getExecutable()
          Returns the curently set executable.
static File getGateHome()
          Gets the GATE home location.
static boolean getHiddenAttribute(FeatureMap fm)
          Returns the value for the HIDDEN attribute of a feature map
static List<URL> getKnownPlugins()
          Returns the list of CREOLE directories the system knows about (either pre-installed plugins in the plugins directory or CREOLE directories that have previously been loaded manually).
static Map<String,EventListener> getListeners()
          Returns the listeners map, a map that holds all the listeners that are singletons (e.g. the status listener that updates the status bar on the main frame or the progress listener that updates the progress bar on the main frame).
static String getMinJdkVersion()
          Get the minimum supported version of the JDK
static OptionsMap getOriginalUserConfig()
          Get the original, initialisation-time, GATE development environment configuration data (initialised from gate.xml).
static File getPluginsHome()
          Get the location of the plugins directory.
static Set<String> getRegisteredIREngines()
          Gets the set of registered IR engines.
static File getSiteConfigFile()
          Get the site config file (generally set during command-line processing or as a gate.config property).
static URL getUrl()
          Get a URL that points to either an HTTP server or a file system that contains GATE files (such as test cases).
static URL getUrl(String path)
          Get a URL that points to either an HTTP server or a file system that contains GATE files (such as test cases).
static OptionsMap getUserConfig()
          Get the GATE development environment configuration data (initialised from gate.xml).
static String getUserConfigElement()
          Gate the name of the XML element for GATE development environment config data.
static File getUserConfigFile()
          Get the location of the user's config file.
static String getUserConfigFileName()
          Deprecated. Use getUserConfigFile() instead.
static File getUserSessionFile()
          Get the user session file.
static boolean getUseXMLSerialization()
          Should we use XML serialization for applications.
static String guessUnicodeFont()
          Attempts to guess the Unicode font for the platform.
static void init()
          Initialisation - must be called by all clients before using any other parts of the library.
static void initConfigData()
          Reads config data (gate.xml files).
static void initCreoleRegister()
          Initialise the CREOLE register.
protected static void initCreoleRepositories()
          Loads the CREOLE repositories (aka plugins) that the user has selected for automatic loading.
static void initDataStoreRegister()
          Initialise the DataStore register.
protected static void initLocalPaths()
          Initialises the paths to local files of interest like the GATE home, the installed plugins home and site and user configuration files.
static boolean isGateType(String classname)
          Checks whether a particular class is a Gate defined type
static boolean isInitialised()
          Have we successfully run init() before?
static boolean isLocalWebServer()
          Should we assume there's a local web server?
static boolean isNetConnected()
          Should we assume we're connected to the net?
static boolean isSandboxed()
          Find out if GATE is to be run in a sandbox or not.
static boolean isSlugGui()
          Should we start SLUG GUI.
static String locateGateFiles()
          Find the location of the GATE binaries (and resources) in the local file system.
private static URL normaliseCreoleUrl(URL url)
          Makes sure the provided URL ends with "/" (CREOLE URLs always point to directories so thry should always end with a slash.
static void registerIREngine(String className)
          Registers a new IR engine.
static void removeAutoloadPlugin(URL pluginURL)
          Tells the system to remove a plugin URL from the list of plugins that are loaded automatically at system start-up.
static void removeKnownPlugin(URL pluginURL)
          Tells the system to "forget" about one previously known directory.
static void runInSandbox(boolean sandboxed)
          Method to tell GATE if it is being run inside a JVM sandbox.
static boolean runningOnMac()
          This method tries to guess if we are on a Mac OS X system.
static boolean runningOnUnix()
          This method tries to guess if we are on a UNIX system.
static void setBuiltinCreoleDir(URL builtinCreoleDir)
          Set the URL to the "builtin" creole directory.
static void setExecutable(Executable executable)
          Sets the Executable currently under execution.
static void setGateHome(File gateHome)
          Set the location of the GATE home directory.
static void setHiddenAttribute(FeatureMap fm, boolean hidden)
          Sets the value for the HIDDEN attribute of a feature map
static void setLocalWebServer(boolean b)
          Tell GATE whether to assume there's a local web server.
static void setNetConnected(boolean b)
          Tell GATE whether to assume we're connected to the net.
static void setPluginsHome(File pluginsHome)
          Set the location of the plugins directory.
static void setSiteConfigFile(File siteConfigFile)
          Set the site config file (e.g. during command-line processing).
static void setSlugGui(boolean b)
          Tell GATE whether to start SLUG GUI.
static void setUrlBase(URL urlBase)
          Set the URL base for GATE files, e.g.
static void setUserConfigFile(File userConfigFile)
          Set the location of the user's config file.
static void setUserSessionFile(File newUserSessionFile)
          Set the user session file.
static void setUseXMLSerialization(boolean useXMLSerialization)
          Tell GATE whether to use XML serialization for applications.
protected static boolean tryFileSystem()
          Try to find GATE files in the local file system
static boolean tryNetServer(String hostName, int serverPort, String path)
          Try to contact a network server.
static boolean unregisterIREngine(String className)
          Unregisters a previously registered IR engine.
static void writeUserConfig()
          Update the GATE development environment configuration data in the user's gate.xml file (create one if it doesn't exist).
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

log

protected static final org.apache.log4j.Logger log
A logger to use instead of sending messages to Out or Err


STRINGBUFFER_SIZE

public static final int STRINGBUFFER_SIZE
The default StringBuffer size, it seems that we need longer string than the StringBuffer class default because of the high number of buffer expansions

See Also:
Constant Field Values

HASH_STH_SIZE

public static final int HASH_STH_SIZE
The default size to be used for Hashtable, HashMap and HashSet. The defualt is 11 and it leads to big memory usage. Having a default load factor of 0.75, table of size 4 can take 3 elements before being re-hashed - a values that seems to be optimal for most of the cases.

See Also:
Constant Field Values

DB_OWNER

public static final String DB_OWNER
The database schema owner (GATEADMIN is default) this one should not be hardcoded but set in the XML initialization files

See Also:
Constant Field Values

builtinCreoleDirectoryUrls

private static String[] builtinCreoleDirectoryUrls
The list of builtin URLs to search for CREOLE resources.


URI

public static final String URI
The GATE URI used to interpret custom GATE tags

See Also:
Constant Field Values

MIN_JDK_VERSION

protected static final String MIN_JDK_VERSION
Minimum version of JDK we support

See Also:
Constant Field Values

ENABLE_BENCHMARKING_FEATURE_NAME

protected static final String ENABLE_BENCHMARKING_FEATURE_NAME
Feature name that should be used to set if the benchmarking logging should be enabled or disabled.

See Also:
Constant Field Values

sandboxed

private static boolean sandboxed
Is true if GATE is to be run in a sandbox


initFinished

protected static boolean initFinished
Records initialisation status.


netConnected

private static boolean netConnected
Flag controlling whether we should try to access the net, e.g. when setting up a base URL.


lastSym

private static int lastSym

registeredIREngines

private static Set<String> registeredIREngines
A list of names of classes that implement IREngine that will be used as information retrieval engines.


localWebServer

private static boolean localWebServer
Flag controlling whether we should try to access a web server on localhost, e.g. when setting up a base URL. Has to be called before init().


urlBase

private static URL urlBase
The URL base for GATE files, e.g. http://gate.ac.uk/.


classLoader

private static GateClassLoader classLoader
Class loader used e.g. for loading CREOLE modules, of compiling JAPE rule RHSs.


creoleRegister

private static CreoleRegister creoleRegister
The CREOLE register.


dataStoreRegister

private static DataStoreRegister dataStoreRegister
The DataStore register


currentExecutable

private static Executable currentExecutable
The current executable under execution.


userConfig

private static OptionsMap userConfig
GATE development environment configuration data (stored in gate.xml).


originalUserConfig

private static OptionsMap originalUserConfig
This map stores the init-time config data in case we need it later. GATE development environment configuration data (stored in gate.xml).


userConfigElement

private static String userConfigElement
Name of the XML element for GATE development environment config data.


nl

private static String nl
Shorthand for local newline


emptyConfigFile

private static String emptyConfigFile
An empty config data file.


gateHome

protected static File gateHome
The top level directory of the GATE installation.


siteConfigFile

private static File siteConfigFile
Site config file


userConfigFile

private static File userConfigFile
User config file


pluginsHome

protected static File pluginsHome
The top level directory for GATE installed plugins.


builtinCreoleDir

protected static URL builtinCreoleDir
The "builtin" creole directory URL, where the creole.xml that defines things like DocumentImpl can be found.


userSessionFile

protected static File userSessionFile
The user session file to use.


knownPlugins

protected static List<URL> knownPlugins
The list of plugins (aka CREOLE directories) the system knows about. This list contains URL objects.


autoloadPlugins

protected static List<URL> autoloadPlugins
The list of plugins (aka CREOLE directories) the system loads automatically at start-up. This list contains URL objects.


pluginData

protected static Map<URL,Gate.DirectoryInfo> pluginData
Map from URL of directory to Gate.DirectoryInfo.


slugGui

private static boolean slugGui
Flag for SLUG GUI start instead of standart GATE GUI.


useXMLSerialization

private static boolean useXMLSerialization
Flag for whether to use native serialization or xml serialization when saving applications.


listeners

@Deprecated
public static Map<String,EventListener> listeners
Deprecated. 
A Map which holds listeners that are singletons (e.g. the status listener that updates the status bar on the main frame or the progress listener that updates the progress bar on the main frame). The keys used are the class names of the listener interface and the values are the actual listeners (e.g "gate.event.StatusListener" -> this). Deprecated. Call getListeners instead.

Constructor Detail

Gate

public Gate()
Method Detail

isSandboxed

public static boolean isSandboxed()
Find out if GATE is to be run in a sandbox or not. If true then GATE will not attempt to load any local configuration information during Initialisation making it possible to use GATE from within unsigned applets and web start applications.

Returns:
true if GATE is to be run in a sandbox, false otherwise

runInSandbox

public static void runInSandbox(boolean sandboxed)
Method to tell GATE if it is being run inside a JVM sandbox. If true then GATE will not attempt to load any local configuration information during Initialisation making it possible to use GATE from within unsigned applets and web start applications.

Parameters:
sandboxed - true if GATE is to be run in a sandbox, false otherwise

getMinJdkVersion

public static String getMinJdkVersion()
Get the minimum supported version of the JDK


init

public static void init()
                 throws GateException
Initialisation - must be called by all clients before using any other parts of the library. Also initialises the CREOLE register and reads config data (gate.xml files).

Throws:
GateException
See Also:
initCreoleRegister()

isInitialised

public static boolean isInitialised()
Have we successfully run init() before?


initLocalPaths

protected static void initLocalPaths()
Initialises the paths to local files of interest like the GATE home, the installed plugins home and site and user configuration files.


initCreoleRepositories

protected static void initCreoleRepositories()
Loads the CREOLE repositories (aka plugins) that the user has selected for automatic loading. Loads the information about known plugins in memory.


initCreoleRegister

public static void initCreoleRegister()
                               throws GateException
Initialise the CREOLE register.

Throws:
GateException

initDataStoreRegister

public static void initDataStoreRegister()
Initialise the DataStore register.


initConfigData

public static void initConfigData()
                           throws GateException
Reads config data (gate.xml files). There are three sorts of these files: Settings from files read after some settings have already been made will simply overwrite the previous settings.

Throws:
GateException

guessUnicodeFont

public static String guessUnicodeFont()
Attempts to guess the Unicode font for the platform.


getUrl

public static URL getUrl()
                  throws GateException
Get a URL that points to either an HTTP server or a file system that contains GATE files (such as test cases). The following locations are tried in sequence: In each case we assume that a Web server will be running on port 80, and that if we can open a socket to that port then the server is running. (This is a bit of a strong assumption, but this URL is used largely by the test suite, so we're not betting anything too critical on it.)

Note that the value returned will only be calculated when the existing value recorded by this class is null (which will be the case when neither setUrlBase nor getUrlBase have been called, or if setUrlBase(null) has been called).

Throws:
GateException

getUrl

public static URL getUrl(String path)
                  throws GateException
Get a URL that points to either an HTTP server or a file system that contains GATE files (such as test cases). Calls getUrl() then adds the path parameter to the result.

Parameters:
path - a path to add to the base URL.
Throws:
GateException
See Also:
getUrl()

registerIREngine

public static void registerIREngine(String className)
                             throws GateException,
                                    ClassNotFoundException
Registers a new IR engine. The class named should implement IREngine and be accessible via the GATE class loader.

Parameters:
className - the fully qualified name of the class to be registered
Throws:
GateException - if the class does not implement the IREngine interface.
ClassNotFoundException - if the named class cannot be found.

unregisterIREngine

public static boolean unregisterIREngine(String className)
Unregisters a previously registered IR engine.

Parameters:
className - the name of the class to be removed from the list of registered IR engines.
Returns:
true if the class was found and removed.

getRegisteredIREngines

public static Set<String> getRegisteredIREngines()
Gets the set of registered IR engines.

Returns:
an unmodifiable Set value.

getGateHome

public static File getGateHome()
Gets the GATE home location.

Returns:
a File value.

isNetConnected

public static boolean isNetConnected()
Should we assume we're connected to the net?


setNetConnected

public static void setNetConnected(boolean b)
Tell GATE whether to assume we're connected to the net. Has to be called before init().


isLocalWebServer

public static boolean isLocalWebServer()
Should we assume there's a local web server?


setLocalWebServer

public static void setLocalWebServer(boolean b)
Tell GATE whether to assume there's a local web server.


tryNetServer

public static boolean tryNetServer(String hostName,
                                   int serverPort,
                                   String path)
                            throws MalformedURLException
Try to contact a network server. When sucessfull sets urlBase to an HTTP URL for the server.

Parameters:
hostName - the name of the host to try and connect to
serverPort - the port to try and connect to
path - a path to append to the URL when we make a successfull connection. E.g. for host xyz, port 80, path /thing, the resultant URL would be http://xyz:80/thing.
Throws:
MalformedURLException

tryFileSystem

protected static boolean tryFileSystem()
                                throws MalformedURLException
Try to find GATE files in the local file system

Throws:
MalformedURLException

locateGateFiles

public static String locateGateFiles()
Find the location of the GATE binaries (and resources) in the local file system.


isGateType

public static boolean isGateType(String classname)
Checks whether a particular class is a Gate defined type


getHiddenAttribute

public static boolean getHiddenAttribute(FeatureMap fm)
Returns the value for the HIDDEN attribute of a feature map


setHiddenAttribute

public static void setHiddenAttribute(FeatureMap fm,
                                      boolean hidden)
Sets the value for the HIDDEN attribute of a feature map


addCreoleListener

public static void addCreoleListener(CreoleListener l)
Registers a CreoleListener with the Gate system


setUrlBase

public static void setUrlBase(URL urlBase)
Set the URL base for GATE files, e.g. http://gate.ac.uk/.


getClassLoader

public static GateClassLoader getClassLoader()
Get the GATE class loader.


getCreoleRegister

public static CreoleRegister getCreoleRegister()
Get the CREOLE register.


getDataStoreRegister

public static DataStoreRegister getDataStoreRegister()
Get the DataStore register.


setExecutable

public static void setExecutable(Executable executable)
Sets the Executable currently under execution. At a given time there can be only one executable set. After the executable has finished its execution this value should be set back to null. An attempt to set the executable while this value is not null will result in the method call waiting until the old executable is set to null.


getExecutable

public static Executable getExecutable()
Returns the curently set executable.

See Also:
setExecutable(gate.Executable)

genSym

public static String genSym()
Returns a new unique string


getUserConfigElement

public static String getUserConfigElement()
Gate the name of the XML element for GATE development environment config data.


getSiteConfigFile

public static File getSiteConfigFile()
Get the site config file (generally set during command-line processing or as a gate.config property). If the config is null, this method checks the gate.config property and uses it if non-null.


setSiteConfigFile

public static void setSiteConfigFile(File siteConfigFile)
Set the site config file (e.g. during command-line processing).


getEmptyConfigFile

public static String getEmptyConfigFile()
Get an empty config file. NOTE: this method is intended only for use by the test suite.


getUserConfig

public static OptionsMap getUserConfig()
Get the GATE development environment configuration data (initialised from gate.xml).


getOriginalUserConfig

public static OptionsMap getOriginalUserConfig()
Get the original, initialisation-time, GATE development environment configuration data (initialised from gate.xml).


writeUserConfig

public static void writeUserConfig()
                            throws GateException
Update the GATE development environment configuration data in the user's gate.xml file (create one if it doesn't exist).

Throws:
GateException

getUserConfigFileName

public static String getUserConfigFileName()
Deprecated. Use getUserConfigFile() instead.

Get the name of the user's gate.xml config file (this doesn't guarantee that file exists!).


getDefaultUserConfigFileName

public static String getDefaultUserConfigFileName()
Get the default path to the user's config file, which is used unless an alternative name has been specified via system properties or setUserConfigFile(java.io.File).

Returns:
the default user config file path.

getDefaultUserSessionFileName

public static String getDefaultUserSessionFileName()
Get the default path to the user's session file, which is used unless an alternative name has been specified via system properties or setUserSessionFile(File)

Returns:
the default user session file path.

runningOnUnix

public static boolean runningOnUnix()
This method tries to guess if we are on a UNIX system. It does this by checking the value of System.getProperty("file.separator"); if this is "/" it concludes we are on UNIX. This is obviously not a very good idea in the general case, so nothing much should be made to depend on this method (e.g. just naming of config file .gate.xml as opposed to gate.xml).


runningOnMac

public static boolean runningOnMac()
This method tries to guess if we are on a Mac OS X system. It does this by checking the value of System.getProperty("os.name"). Note that if this method returns true, runningOnUnix() will also return true (i.e. Mac is considered a Unix platform) but the reverse is not necessarily the case.


getKnownPlugins

public static List<URL> getKnownPlugins()
Returns the list of CREOLE directories the system knows about (either pre-installed plugins in the plugins directory or CREOLE directories that have previously been loaded manually).

Returns:
a List of URLs.

addKnownPlugin

public static void addKnownPlugin(URL pluginURL)
Adds the plugin to the list of known plugins.

Parameters:
pluginURL - the URL for the new plugin.

normaliseCreoleUrl

private static URL normaliseCreoleUrl(URL url)
Makes sure the provided URL ends with "/" (CREOLE URLs always point to directories so thry should always end with a slash.

Parameters:
url - the URL to be normalised
Returns:
the (maybe) corrected URL.

getAutoloadPlugins

public static List<URL> getAutoloadPlugins()
Returns the list of CREOLE directories the system loads automatically at start-up.

Returns:
a List of URLs.

addAutoloadPlugin

public static void addAutoloadPlugin(URL pluginUrl)
Adds a new directory to the list of plugins that are loaded automatically at start-up.

Parameters:
pluginUrl - the URL for the new plugin.

getDirectoryInfo

public static Gate.DirectoryInfo getDirectoryInfo(URL directory)
Gets the information about a known directory.

Parameters:
directory - the URL for the directory in question.
Returns:
a Gate.DirectoryInfo value.

removeKnownPlugin

public static void removeKnownPlugin(URL pluginURL)
Tells the system to "forget" about one previously known directory. If the specified directory was loaded, it will be unloaded as well - i.e. all the metadata relating to resources defined by this directory will be removed from memory.

Parameters:
pluginURL -

removeAutoloadPlugin

public static void removeAutoloadPlugin(URL pluginURL)
Tells the system to remove a plugin URL from the list of plugins that are loaded automatically at system start-up. This will be reflected in the user's configuration data file.

Parameters:
pluginURL - the URL to be removed.

setGateHome

public static void setGateHome(File gateHome)
Set the location of the GATE home directory.

Throws:
IllegalStateException - if the value has already been set.

setPluginsHome

public static void setPluginsHome(File pluginsHome)
Set the location of the plugins directory.

Throws:
IllegalStateException - if the value has already been set.

getPluginsHome

public static File getPluginsHome()
Get the location of the plugins directory.

Returns:
the plugins drectory, or null if this has not yet been set (i.e. Gate.init() has not yet been called).

setUserConfigFile

public static void setUserConfigFile(File userConfigFile)
Set the location of the user's config file.

Throws:
IllegalStateException - if the value has already been set.

getUserConfigFile

public static File getUserConfigFile()
Get the location of the user's config file.

Returns:
the user config file, or null if this has not yet been set (i.e. Gate.init() has not yet been called).

setBuiltinCreoleDir

public static void setBuiltinCreoleDir(URL builtinCreoleDir)
Set the URL to the "builtin" creole directory. The URL must point to a directory, and must end with a forward slash.

Throws:
IllegalStateException - if the value has already been set.

getBuiltinCreoleDir

public static URL getBuiltinCreoleDir()
Get the URL to the "builtin" creole directory, i.e. the directory that contains the creole.xml file that defines things like DocumentImpl, the Controllers, etc.


setUserSessionFile

public static void setUserSessionFile(File newUserSessionFile)
Set the user session file. This can only done prior to calling Gate.init() which will set the file to either the OS-specific default or whatever has been set by the property gate.user.session

Throws:
IllegalStateException - if the value has already been set.

getUserSessionFile

public static File getUserSessionFile()
Get the user session file.

Returns:
the file corresponding to the user session file or null, if not yet set.

isSlugGui

public static boolean isSlugGui()
Should we start SLUG GUI.


setSlugGui

public static void setSlugGui(boolean b)
Tell GATE whether to start SLUG GUI.


setUseXMLSerialization

public static void setUseXMLSerialization(boolean useXMLSerialization)
Tell GATE whether to use XML serialization for applications.


getUseXMLSerialization

public static boolean getUseXMLSerialization()
Should we use XML serialization for applications.


getListeners

public static Map<String,EventListener> getListeners()
Returns the listeners map, a map that holds all the listeners that are singletons (e.g. the status listener that updates the status bar on the main frame or the progress listener that updates the progress bar on the main frame). The keys used are the class names of the listener interface and the values are the actual listeners (e.g "gate.event.StatusListener" -> this). The returned map is the actual data member used to store the listeners so any changes in this map will be visible to everyone.

Returns:
the listeners map