01 /*
02 * SystemData.java
03 *
04 * Copyright (c) 1995-2010, The University of Sheffield. See the file
05 * COPYRIGHT.txt in the software or at http://gate.ac.uk/gate/COPYRIGHT.txt
06 *
07 * This file is part of GATE (see http://gate.ac.uk/), and is free
08 * software, licenced under the GNU Library General Public License,
09 * Version 2, June 1991 (in the distribution as file licence.html,
10 * and also available at http://gate.ac.uk/gate/licence.html).
11 *
12 * Hamish Cunningham, 9/Nov/2000
13 *
14 * $Id: SystemData.java 12006 2009-12-01 17:24:28Z thomas_heitz $
15 */
16
17 package gate.config;
18
19 import java.util.*;
20
21 import gate.Factory;
22 import gate.FeatureMap;
23 import gate.creole.ResourceInstantiationException;
24 import gate.util.GateSaxException;
25 import gate.util.Strings;
26
27
28 /** This class represents and instantiates systems during
29 * config data parsing.
30 */
31 class SystemData
32 {
33 /** Debug flag */
34 protected static final boolean DEBUG = false;
35
36 /** Default constructor. */
37 SystemData() {
38 } // default constructor
39
40 /** The list of PRs */
41 List prList = new ArrayList();
42
43 /** The list of LRs */
44 List lrList = new ArrayList();
45
46 /** The name of the SYSTEM */
47 String systemName = new String("name not set");
48
49 /** The type name of the SYSTEM's controller */
50 String controllerTypeName = new String("controller type name not set");
51
52 /** Create a Controller; called when all the system data
53 * is present.
54 */
55 void createSystem() throws GateSaxException
56 {
57 // create the controller
58 if(controllerTypeName.equalsIgnoreCase("none")){
59 //no controller required, bail
60 return;
61 }
62 try {
63 FeatureMap controllerParams = Factory.newFeatureMap();
64 Collection controller = (Collection)
65 Factory.createResource(controllerTypeName, controllerParams);
66 controller.addAll(prList);
67 } catch(ResourceInstantiationException e) {
68 throw new GateSaxException(
69 "Couldn't create controller for SYSTEM: " +
70 systemName + "; problem was: " + Strings.getNl() + e
71 );
72 }
73 } // createSystem()
74
75 } // class SystemData
|