

Public Methods | |
| OpenXMLDecoder (Context _decoders) | |
| OpenXMLDecoder () | |
| void | importElement (Context _configuration, String _xml_file_name, ContextFactory _context_factory, ClassPathFinder _finder) throws JonathanException |
Private Methods | |
| XMLElement | readXMLElementFromResource (String _resource_name, ClassPathFinder _finder) throws JonathanException |
Static Private Attributes | |
| HTable | default_decoders = HTable.newTable() |
In order to be able to decode a given custom-made component type, a specific TagCompiler must be implemented for this type, and provided in the OpenXMLDecoder configuration context (i.e. in its constructor Context parameter) as the value of an Element named after the component type's XML tag.
An instance of OpenXMLDecoder is automatically used at startup by Jonathan's KKernel to decode Jonathan's runtime configuration file. A complete configuration of OpenXMLDecoder is therefore provided in Jonathan's compiled boot configuration.
Definition at line 74 of file OpenXMLDecoder.java.
|
|
creates a new xml decoder with the given additional specific decoders
Definition at line 95 of file OpenXMLDecoder.java. 00095 {
00096 decoders = _decoders;
00097 }
|
|
|
Definition at line 99 of file OpenXMLDecoder.java. 00099 {
00100 decoders = null;
00101 }
|
|
|
imports an XML file in the given configuration. First reads the root XML element, and then dispatches its decoding to a new Dispatcher.
Reimplemented from File2Configuration. Definition at line 112 of file OpenXMLDecoder.java. 00116 {
00117 XMLElement $xml_element = readXMLElementFromResource(_xml_file_name,_finder);
00118 String $current_tag = $xml_element.getTagName();
00119 Dispatcher $dispatcher = new Dispatcher(_context_factory,decoders,_finder);
00120 if ($current_tag.equals("CONFIGURATION")) {
00121 $dispatcher.importXMLElements($xml_element.enumerateChildren(),_configuration);
00122 } else {
00123 $dispatcher.importXMLElement($xml_element,_configuration);
00124 }
00125 }
|
|
|
Reads a resource and parses it as an XML file. Used by
Definition at line 134 of file OpenXMLDecoder.java. 00135 {
00136 try {
00137 InputStream $is = _finder.findResource(_resource_name);
00138 if ($is == null) {
00139 throw new JonathanException("Resource " + _resource_name + " not found.");
00140 }
00141 XMLElement $result = new XMLElement();
00142 $result.parseFromReader(new BufferedReader(new InputStreamReader($is)));
00143 return $result;
00144 } catch (IOException e) {
00145 throw new JonathanException(e);
00146 } catch (XMLParseException e) {
00147 throw new JonathanException(e);
00148 }
00149 }
|
|
|
the built-in decoders Definition at line 77 of file OpenXMLDecoder.java. |
1.2.6 written by Dimitri van Heesch,
© 1997-2001