1 19 package org.java.plugin.registry.xml; 20 21 import org.java.plugin.registry.PluginPrerequisite; 22 import org.xml.sax.Attributes ; 23 import org.xml.sax.EntityResolver ; 24 import org.xml.sax.SAXException ; 25 26 29 final class ManifestInfoHandler extends BaseHandler { 30 private ModelManifestInfo manifest = null; 31 32 ManifestInfoHandler(final EntityResolver anEntityResolver) { 33 super(anEntityResolver); 34 } 35 36 40 public void startElement(final String uri, final String localName, 41 final String qName, final Attributes attributes) 42 throws SAXException { 43 if (log.isDebugEnabled()) { 44 log.debug("startElement - [" + uri + "]/[" + localName + "]/[" + qName + "]"); } 47 String name = qName; 48 if ("plugin".equals(name)) { if (manifest != null) { 50 throw new SAXException ("unexpected [" + name + "] element (manifest already defined)"); } 53 manifest = new ModelManifestInfo(); 54 manifest.setId(attributes.getValue("id")); manifest.setVersion(attributes.getValue("version")); manifest.setVendor(attributes.getValue("vendor")); } else if ("plugin-fragment".equals(name)) { if (manifest != null) { 59 throw new SAXException ("unexpected [" + name + "] element (manifest already defined)"); } 62 manifest = new ModelManifestInfo(); 63 manifest.setId(attributes.getValue("id")); manifest.setVersion(attributes.getValue("version")); manifest.setVendor(attributes.getValue("vendor")); manifest.setPluginId(attributes.getValue("plugin-id")); if (attributes.getValue("plugin-version") != null) { manifest.setPluginVersion( 69 attributes.getValue("plugin-version")); } 71 if (attributes.getValue("match") != null) { manifest.setMatch(attributes.getValue("match")); } else { 74 manifest.setMatch(PluginPrerequisite.MATCH_COMPATIBLE); 75 } 76 } else { 77 } 79 } 80 81 85 public void endElement(final String uri, final String localName, 86 final String qName) { 87 if (log.isDebugEnabled()) { 88 log.debug("endElement - [" + uri + "]/[" + localName + "]/[" + qName + "]"); } 91 } 93 94 97 public void characters(final char[] ch, final int start, final int length) { 98 } 100 101 ModelManifestInfo getResult() { 102 return manifest; 103 } 104 } 105 | Popular Tags |