GATE
Version 3.1-2270

gate.util.compilers
Class Sun

java.lang.Object
  extended by gate.util.Javac
      extended by gate.util.compilers.Sun
All Implemented Interfaces:
GateConstants

public class Sun
extends Javac

This class copiles a set of java sources by accessing the java compiler from tools.jar file in the jdk. As such, it will not run on a JRE alone, but requires a JDK.


Field Summary
protected static GateClassLoader classLoader
           
 
Fields inherited from class gate.util.Javac
DEFAULT_COMPILER
 
Fields inherited from interface gate.GateConstants
ABOUT_URL_JAVA_PROPERTY_NAME, 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, COMPILER_TYPE_KEY, CORPUS_INDEX_DEFINITION_FEATURE_KEY, CORPUS_INDEX_STATISTICS_FEATURE_KEY, DOCEDIT_INSERT_APPEND, DOCEDIT_INSERT_PREPEND, DOCUMENT_ADD_SPACE_ON_UNPACK_FEATURE_NAME, DOCUMENT_NEW_LINE_TYPE, DOCUMENT_REPOSITIONING_INFO_FEATURE_NAME, GATE_CONFIG_PROPERTY, GATE_DOT_SER, GATE_DOT_XML, GATE_HOME_PROPERTY_NAME, GATE_SITE_CONFIG_PROPERTY_NAME, GATE_USER_CONFIG_PROPERTY_NAME, KNOWN_PLUGIN_PATH_KEY, LAST_FILECHOOSER_LOCATION, LOOK_AND_FEEL, MAIN_FRAME_HEIGHT, MAIN_FRAME_WIDTH, 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
Sun()
           
 
Method Summary
 void compile(Map sources)
          Compiles a set of java sources and loads the compiled classes in the gate class loader.
protected static File getDirectory(File workDir, List pathComponents)
          Gets a file inside a parent directory from a list of path components.
protected static List getPathComponents(String classname)
          Breaks a class name into path components.
protected static void loadAllClasses(File classesDirectory, String packageName)
          Loads the entire hierarchy of classes found in a parent directory.
 
Methods inherited from class gate.util.Javac
loadClasses
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

classLoader

protected static GateClassLoader classLoader
Constructor Detail

Sun

public Sun()
Method Detail

compile

public void compile(Map sources)
             throws GateException
Compiles a set of java sources and loads the compiled classes in the gate class loader.

Specified by:
compile in class Javac
Parameters:
sources - a map from fully qualified classname to java source
Throws:
GateException - in case of a compilation error or warning. In the case of warnings the compiled classes are loaded before the error is raised.

getPathComponents

protected static List getPathComponents(String classname)
Breaks a class name into path components.

Parameters:
classname -
Returns:
a List of Strings.

getDirectory

protected static File getDirectory(File workDir,
                                   List pathComponents)
Gets a file inside a parent directory from a list of path components.

Parameters:
workDir -
pathComponents -
Returns:
a File value.

loadAllClasses

protected static void loadAllClasses(File classesDirectory,
                                     String packageName)
                              throws IOException
Loads the entire hierarchy of classes found in a parent directory.

Parameters:
classesDirectory -
Throws:
IOException

GATE
Version 3.1-2270