001    /**
002     * InitGate.java
003     * jCOLIBRI2 framework. 
004     * @author Juan A. Recio-García.
005     * GAIA - Group for Artificial Intelligence Applications
006     * http://gaia.fdi.ucm.es
007     * 23/06/2007
008     */
009    package jcolibri.extensions.textual.IE.gate.gateinit;
010    
011    import gate.util.GateException;
012    
013    import java.io.File;
014    
015    /**
016     * Initalizes GATE with the configuration files included in this package.
017     * See GATE's tutorial for details.
018     * @author Juan A. Recio-Garcia
019     * @version 1.0
020     */
021    public class InitGate
022    {
023        private static boolean initialized = false;
024    
025        public static void initGate()
026        {
027            if (initialized)
028                return;
029            try
030            {
031                File gateHome = new File(jcolibri.util.FileIO.findFile("jcolibri/extensions/textual/IE/gate/gateinit").getFile());
032                gate.Gate.setGateHome(gateHome);
033                gate.Gate.setUserConfigFile(new File(gateHome, "user-gate.xml"));
034                gate.Gate.init();
035                gate.Gate.getCreoleRegister().registerDirectories(jcolibri.util.FileIO.findFile("jcolibri/extensions/textual/IE/gate/gateinit/plugins/ANNIE"));
036                initialized = true;
037            } catch (GateException e)
038            {
039                org.apache.commons.logging.LogFactory.getLog(InitGate.class).error(e);
040            }
041        }
042    }