MCPcopy Create free account
hub / github.com/GateNLP/gate-core / init

Method init

src/main/java/gate/Gate.java:213–284  ·  view source on GitHub ↗

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). @see #initCreoleRegister

()

Source from the content-addressed store, hash-verified

211 * @see #initCreoleRegister
212 */
213 public static void init() throws GateException {
214 // init local paths
215 if (!sandboxed) initLocalPaths();
216
217 // check if benchmarking should be enabled or disabled
218 if(System.getProperty(ENABLE_BENCHMARKING_FEATURE_NAME) != null
219 && System.getProperty(ENABLE_BENCHMARKING_FEATURE_NAME).equalsIgnoreCase(
220 "true")) {
221 Benchmark.setBenchmarkingEnabled(true);
222 }
223
224 // builtin creole dir
225 if(builtinCreoleDir == null) {
226 String builtinCreoleDirPropertyValue =
227 System.getProperty(BUILTIN_CREOLE_DIR_PROPERTY_NAME);
228 if(builtinCreoleDirPropertyValue == null) {
229 // default to /gate/resources/creole in gate.jar
230 builtinCreoleDir = Files.getGateResource("/creole/");
231 }
232 else {
233 String builtinCreoleDirPath = builtinCreoleDirPropertyValue;
234 // add a slash onto the end of the path if it doesn't have one already -
235 // a creole directory URL should always end with a forward slash
236 if(!builtinCreoleDirPath.endsWith("/")) {
237 builtinCreoleDirPath += "/";
238 }
239 try {
240 builtinCreoleDir = new URL(builtinCreoleDirPath);
241 }
242 catch(MalformedURLException mue) {
243 // couldn't parse as a File either, so throw an exception
244 throw new GateRuntimeException(BUILTIN_CREOLE_DIR_PROPERTY_NAME
245 + " value \"" + builtinCreoleDirPropertyValue + "\" could"
246 + " not be parsed as either a URL or a file path.");
247 }
248 log.info("Using " + builtinCreoleDir + " as built-in CREOLE"
249 + " directory URL");
250 }
251 }
252
253 // initialise the symbols generator
254 lastSym = 0;
255
256 // create class loader and creole register if they're null
257 if(classLoader == null)
258 classLoader = new GateClassLoader("Top-Level GATE ClassLoader", Gate.class.getClassLoader());
259 if(creoleRegister == null) creoleRegister = new CreoleRegisterImpl();
260 if(knownPlugins == null) knownPlugins = new HashSet<Plugin>();
261 if(autoloadPlugins == null) autoloadPlugins = new ArrayList<Plugin>();
262 //if(pluginData == null) pluginData = new HashSet<Plugin>();
263 // init the creole register
264 initCreoleRegister();
265 // init the data store register
266 initDataStoreRegister();
267
268 // read gate.xml files; this must come before creole register
269 // initialisation in order for the CREOLE-DIR elements to have and effect
270 if (!sandboxed) initConfigData();

Callers 15

setUpMethod · 0.95
setUpMethod · 0.95
mainMethod · 0.95
setUpMethod · 0.95
setUpMethod · 0.95
setUpMethod · 0.95
setUpMethod · 0.95
setUpMethod · 0.95
setUpMethod · 0.95
setUpMethod · 0.95
setUpMethod · 0.95
setUpMethod · 0.95

Calls 13

initLocalPathsMethod · 0.95
getGateResourceMethod · 0.95
initCreoleRegisterMethod · 0.95
initDataStoreRegisterMethod · 0.95
initConfigDataMethod · 0.95
addCreoleListenerMethod · 0.95
infoMethod · 0.80
getClassLoaderMethod · 0.80
getPropertyMethod · 0.65
addCreoleListenerMethod · 0.65

Tested by 15

setUpMethod · 0.76
setUpMethod · 0.76
mainMethod · 0.76
setUpMethod · 0.76
setUpMethod · 0.76
setUpMethod · 0.76
setUpMethod · 0.76
setUpMethod · 0.76
setUpMethod · 0.76
setUpMethod · 0.76
setUpMethod · 0.76
setUpMethod · 0.76