gate.util
Class Javac

java.lang.Object
  extended bygate.util.Javac
All Implemented Interfaces:
GateConstants

public class Javac
extends Object
implements GateConstants

This class copiles a set of java sources by accessing the java compiler from tools.jar file in the jdk. All processing is done without touching the disk.


Field Summary
protected static GateClassLoader classLoader
           
 
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, CORPUS_INDEX_DEFINITION_FEATURE_KEY, CORPUS_INDEX_STATISTICS_FEATURE_KEY, 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, LOOK_AND_FEEL, MAIN_FRAME_HEIGHT, MAIN_FRAME_WIDTH, MENUS_FONT, ORIGINAL_DOCUMENT_CONTENT_FEATURE_NAME, ORIGINAL_MARKUPS_ANNOT_SET_NAME, OTHER_COMPONENTS_FONT, SAVE_FEATURES_WHEN_PRESERVING_FORMAT, SAVE_OPTIONS_ON_EXIT, SAVE_SESSION_ON_EXIT, TEXT_COMPONENTS_FONT, THROWEX_FORMAT_PROPERTY_NAME, TITLE_JAVA_PROPERTY_NAME, WORDNET_CONFIG_FILE
 
Constructor Summary
Javac()
           
 
Method Summary
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.
static void loadClasses(Map sources)
          Compiles a set of java sources and loads the compiled classes in the gate class loader.
 
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

Javac

public Javac()
Method Detail

loadClasses

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

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:

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:

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