Revision: 17650
          http://sourceforge.net/p/gate/code/17650
Author:   markagreenwood
Date:     2014-03-13 15:11:47 +0000 (Thu, 13 Mar 2014)
Log Message:
-----------
removed support for the SYSTEM element in gate.xml given that the code didn't 
work anyway

Modified Paths:
--------------
    gate/trunk/src/main/gate/config/ConfigXmlHandler.java

Removed Paths:
-------------
    gate/trunk/src/main/gate/config/SystemData.java

Modified: gate/trunk/src/main/gate/config/ConfigXmlHandler.java
===================================================================
--- gate/trunk/src/main/gate/config/ConfigXmlHandler.java       2014-03-13 
15:04:17 UTC (rev 17649)
+++ gate/trunk/src/main/gate/config/ConfigXmlHandler.java       2014-03-13 
15:11:47 UTC (rev 17650)
@@ -16,20 +16,27 @@
 
 package gate.config;
 
+import gate.CreoleRegister;
+import gate.DataStoreRegister;
+import gate.Factory;
+import gate.FeatureMap;
+import gate.Gate;
+import gate.util.GateException;
+import gate.util.GateSaxException;
+import gate.util.Out;
+import gate.util.Strings;
+import gate.xml.SimpleErrorHandler;
+
 import java.net.MalformedURLException;
 import java.net.URL;
-import java.util.List;
 import java.util.Stack;
 
-import org.xml.sax.*;
+import org.xml.sax.Attributes;
+import org.xml.sax.SAXException;
+import org.xml.sax.SAXParseException;
 import org.xml.sax.helpers.DefaultHandler;
 
-import gate.*;
-import gate.creole.ResourceInstantiationException;
-import gate.util.*;
-import gate.xml.SimpleErrorHandler;
 
-
 /** This is a SAX handler for processing <CODE>gate.xml</CODE> files.
   */
 public class ConfigXmlHandler extends DefaultHandler {
@@ -41,9 +48,6 @@
    */
   private Stack<String> contentStack = new Stack<String>();
 
-  /** The current resource data object */
-  private SystemData systemData;
-
   /** The current element's attribute list */
   private Attributes currentAttributes;
 
@@ -135,14 +139,7 @@
     currentAttributes = atts;
     currentAttributeMap = attributeListToParameterList();
 
-    // if it's a SYSTEM, create a new one and set its name
-    if(elementName.toUpperCase().equals("SYSTEM")) {
-      systemData = new SystemData();
-      for(int i=0, len=currentAttributes.getLength(); i<len; i++) {
-        if(currentAttributes.getQName(i).toUpperCase().equals("NAME"))
-          systemData.systemName = currentAttributes.getValue(i);
-      }
-    } else if(elementName.toUpperCase().equals("DBCONFIG")) {
+    if(elementName.toUpperCase().equals("DBCONFIG")) {
       DataStoreRegister.addConfig(currentAttributeMap);
     } else if(elementName.toUpperCase().equals(Gate.getUserConfigElement())) {
       Gate.getUserConfig().putAll(currentAttributeMap);
@@ -150,15 +147,6 @@
 
   } // startElement
 
-  /** Utility function to throw exceptions on stack errors. */
-  private void checkStack(String methodName, String elementName)
-  throws GateSaxException {
-    if(contentStack.isEmpty())
-      throw new GateSaxException(
-        methodName + " called for element " + elementName + " with empty stack"
-      );
-  } // checkStack
-
   /** Called when the SAX parser encounts the end of an XML element.
     * This is actions happen.
     */
@@ -189,25 +177,6 @@
       }
 
     //////////////////////////////////////////////////////////////////
-    } else if(elementName.toUpperCase().equals("SYSTEM")) {
-// check we got correct params on systemData?
-      systemData.createSystem();
-
-    //////////////////////////////////////////////////////////////////
-    } else if(elementName.toUpperCase().equals("CONTROLLER")) {
-      systemData.controllerTypeName = contentStack.pop();
-
-    //////////////////////////////////////////////////////////////////
-    } else if(elementName.toUpperCase().equals("LR")) {
-      // create an LR and add it to the SystemData
-      createResource(contentStack.pop(), systemData.lrList);
-
-    //////////////////////////////////////////////////////////////////
-    } else if(elementName.toUpperCase().equals("PR")) {
-      // create a PR and add it to the SystemData
-      createResource(contentStack.pop(), systemData.prList);
-
-    //////////////////////////////////////////////////////////////////
     } else if(elementName.toUpperCase().equals("DBCONFIG")) {
       // these are empty elements with attributes; nothing to do here
 
@@ -252,28 +221,6 @@
     if(DEBUG) Out.println(content);
   } // characters
 
-  /** Utility method to create a resource and add to appropriate list.
-   *  Parameters for the resource are pulled out of the current attribute
-   *  list.
-   */
-  protected void createResource(String resourceTypeName, List resourceList)
-  throws GateSaxException
-  {
-    if(DEBUG) Out.prln(resourceTypeName + ": " + currentAttributeMap);
-    try {
-      resourceList.add(
-        Factory.createResource(
-          resourceTypeName, currentAttributeMap
-        )
-      );
-    } catch(ResourceInstantiationException e) {
-      throw new GateSaxException(
-        "Couldn't create resource for SYSTEM: " +
-        systemData.systemName + "; problem was: " + Strings.getNl() + e
-      );
-    }
-  } // createResource
-
   /** Utility method to convert the current SAX attribute list to a
    *  FeatureMap
    */

Deleted: gate/trunk/src/main/gate/config/SystemData.java
===================================================================
--- gate/trunk/src/main/gate/config/SystemData.java     2014-03-13 15:04:17 UTC 
(rev 17649)
+++ gate/trunk/src/main/gate/config/SystemData.java     2014-03-13 15:11:47 UTC 
(rev 17650)
@@ -1,75 +0,0 @@
-/*
- *  SystemData.java
- *
- *  Copyright (c) 1995-2012, The University of Sheffield. See the file
- *  COPYRIGHT.txt in the software or at http://gate.ac.uk/gate/COPYRIGHT.txt
- *
- *  This file is part of GATE (see http://gate.ac.uk/), and is free
- *  software, licenced under the GNU Library General Public License,
- *  Version 2, June 1991 (in the distribution as file licence.html,
- *  and also available at http://gate.ac.uk/gate/licence.html).
- *
- *  Hamish Cunningham, 9/Nov/2000
- *
- *  $Id$
- */
-
-package gate.config;
-
-import java.util.*;
-
-import gate.Factory;
-import gate.FeatureMap;
-import gate.creole.ResourceInstantiationException;
-import gate.util.GateSaxException;
-import gate.util.Strings;
-
-
-/** This class represents and instantiates systems during
-  * config data parsing.
-  */
-class SystemData
-{
-  /** Debug flag */
-  protected static final boolean DEBUG = false;
-
-  /** Default constructor. */
-  SystemData() {
-  } // default constructor
-
-  /** The list of PRs */
-  List prList = new ArrayList();
-
-  /** The list of LRs */
-  List lrList = new ArrayList();
-
-  /** The name of the SYSTEM */
-  String systemName = new String("name not set");
-
-  /** The type name of the SYSTEM's controller */
-  String controllerTypeName = new String("controller type name not set");
-
-  /** Create a Controller; called when all the system data
-    * is present.
-    */
-  void createSystem() throws GateSaxException
-  {
-    // create the controller
-    if(controllerTypeName.equalsIgnoreCase("none")){
-      //no controller required, bail
-      return;
-    }
-    try {
-      FeatureMap controllerParams = Factory.newFeatureMap();
-      Collection controller = (Collection)
-        Factory.createResource(controllerTypeName, controllerParams);
-      controller.addAll(prList);
-    } catch(ResourceInstantiationException e) {
-      throw new GateSaxException(
-        "Couldn't create controller for SYSTEM: " +
-        systemName + "; problem was: " + Strings.getNl() + e
-      );
-    }
-  } // createSystem()
-
-} // class SystemData

This was sent by the SourceForge.net collaborative development platform, the 
world's largest Open Source development site.


------------------------------------------------------------------------------
Learn Graph Databases - Download FREE O'Reilly Book
"Graph Databases" is the definitive new guide to graph databases and their
applications. Written by three acclaimed leaders in the field,
this first edition is now available. Download your free book today!
http://p.sf.net/sfu/13534_NeoTech
_______________________________________________
GATE-cvs mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/gate-cvs

Reply via email to