/** Insert the method's description here. Creation date: (30.07.00 11:30:34) */ private final void load() { try { // D.d("---> ToolSpecification: " + theURL.toString()); // Step 1: create a DocumentBuilderFactory and configure it DocumentBuilderFactory dbf = DocumentBuilderFactory.newInstance(); // Optional: set various configuration options dbf.setValidating(false); dbf.setIgnoringComments(true); dbf.setIgnoringElementContentWhitespace(true); // dbf.setCoalescing(putCDATAIntoText); // The opposite of creating entity ref nodes is expanding them inline // dbf.setExpandEntityReferences(!createEntityRefs); // At this point the DocumentBuilderFactory instance can be saved // and reused to create any number of DocumentBuilder instances // with the same configuration options. // Step 2: create a DocumentBuilder that satisfies the constraints // specified by the DocumentBuilderFactory DocumentBuilder db = null; try { db = dbf.newDocumentBuilder(); } catch (ParserConfigurationException pce) { System.err.println(pce); System.exit(1); } // // Set an ErrorHandler before parsing // db.setErrorHandler(new MyErrorHandler(System.err)); // Step 3: parse the input file Document doc = null; try { doc = db.parse(theURL.toString()); } catch (SAXException se) { System.err.println(se.getMessage()); System.exit(1); } catch (IOException ioe) { System.err.println(ioe); System.exit(1); } NodeList theTagList; NodeList allowedNettypesList; org.w3c.dom.Node actTag, actNettypeTag; org.w3c.dom.Node allowedNettypesTag; Element root; root = doc.getDocumentElement(); theTagList = root.getChildNodes(); for (int i = 0; i < theTagList.getLength(); i++) { actTag = theTagList.item(i); String actTagName = actTag.getNodeName(); // D.d(actTagName + " " + " " ); //////////////////////////// if (actTagName == "nettype") { URL typeSpecificationURL = new URL(((Element) actTag).getAttribute("typeSpecification")); nettypeId2nettypeURL.put(((Element) actTag).getAttribute("id"), typeSpecificationURL); /** * ********* // Step 3: parse the input file Document actNettypeSpecificationDoc = null; * try { actNettypeSpecificationDoc = db.parse(typeSpecificationURL.toString()); } catch * (SAXException se) { System.err.println(" Error: " + se.getMessage()); // * System.exit(1); } catch (IOException ioe) { System.err.println(" Error: " + ioe); // * System.exit(1); } if (actNettypeSpecificationDoc != null) { Element ntSpecRoot = * actNettypeSpecificationDoc.getDocumentElement(); String nettypeName = * ntSpecRoot.getAttribute("name"); Hashtable specificationTable = new Hashtable(); * NodeList extendableList = ntSpecRoot.getElementsByTagName("extendable"); for (int j = * 0; j < extendableList.getLength(); j++) { org.w3c.dom.Node actExtendableTag = * extendableList.item(j); String extendableClassName = * ((Element)actExtendableTag).getAttribute("class"); Hashtable * extensionName2ExtensionClassName = new Hashtable(); NodeList extensionList = * ((Element)actExtendableTag).getElementsByTagName("extension"); for (int k = 0; k < * extensionList.getLength(); k++) { org.w3c.dom.Node actExtensionTag = * extensionList.item(k); extensionName2ExtensionClassName.put( * ((Element)actExtensionTag).getAttribute("name"), * ((Element)actExtensionTag).getAttribute("class") ); } * specificationTable.put(extendableClassName, extensionName2ExtensionClassName); } } * ********* */ } ///////////////////////////// if (actTagName == "application") { String maxinstancesString = ((Element) actTag).getAttribute("maxinstances"); int maxinstances; if (maxinstancesString.equals("inf")) maxinstances = Integer.MAX_VALUE; else maxinstances = Integer.parseInt(maxinstancesString); allowedNettypesTag = ((Element) actTag).getElementsByTagName("allowedNettypes").item(0); Vector allowedNettypes = null; if (allowedNettypesTag != null) { allowedNettypes = new Vector(); allowedNettypesList = ((Element) allowedNettypesTag).getElementsByTagName("ntref"); for (int j = 0; j < allowedNettypesList.getLength(); j++) { actNettypeTag = allowedNettypesList.item(j); allowedNettypes.addElement(((Element) actNettypeTag).getAttribute("ref")); } // D.d("+-+-+-+-+-+-+-+-+ App: " + allowedNettypes + " " + allowedNettypesList); } Vector apptypeinfo = new Vector(); apptypeinfo.add(((Element) actTag).getAttribute("mainClass")); apptypeinfo.add(new Integer(maxinstances)); apptypeinfo.add(allowedNettypes); apptypeId2apptypeinfo.put(((Element) actTag).getAttribute("id"), apptypeinfo); } if (actTagName == "format") { allowedNettypesTag = ((Element) actTag).getElementsByTagName("allowedNettypes").item(0); Vector allowedNettypes = null; if (allowedNettypesTag != null) { allowedNettypes = new Vector(); allowedNettypesList = ((Element) allowedNettypesTag).getElementsByTagName("ntref"); for (int j = 0; j < allowedNettypesList.getLength(); j++) { actNettypeTag = allowedNettypesList.item(j); allowedNettypes.addElement(((Element) actNettypeTag).getAttribute("ref")); } // D.d("+-+-+-+-+-+-+-+-+ IO: " + allowedNettypes + " " + allowedNettypesList); } Vector ioformatinfo = new Vector(); ioformatinfo.add(((Element) actTag).getAttribute("ioClass")); ioformatinfo.add(allowedNettypes); ioFormatId2ioformatinfo.put(((Element) actTag).getAttribute("id"), ioformatinfo); } if (actTagName == "standardNettype") { this.idOfStandardNettype = ((Element) actTag).getAttribute("ref"); } if (actTagName == "standardApplication") { this.idOfStandardApplication = ((Element) actTag).getAttribute("ref"); } if (actTagName == "standardFormat") { this.idOfStandardIOFormat = ((Element) actTag).getAttribute("ref"); } } } catch (Throwable t) { D.d("Error in ToolSpecification:"); t.printStackTrace(); } }
/** Insert the method's description here. Creation date: (22.09.00 19:26:49) (not implemented) */ public final void save() { D.d("ToolSpecification: Save not implemented yet (TODO...)"); // ########## Ich glaub, da fehlt noch was... }