1 19 20 package org.netbeans.modules.j2ee.ddloaders.web; 21 22 import org.netbeans.modules.xml.catalog.spi.*; 23 import org.openide.util.NbBundle; 24 import org.openide.util.Utilities; 25 26 30 public class DDCatalog implements CatalogReader, CatalogDescriptor,org.xml.sax.EntityResolver { 31 private static final String WEB_APP_2_2="-//Sun Microsystems, Inc.//DTD Web Application 2.2//EN"; private static final String WEB_APP_2_3="-//Sun Microsystems, Inc.//DTD Web Application 2.3//EN"; public static final String J2EE_NS = "http://java.sun.com/xml/ns/j2ee"; private static final String WEB_APP_2_4_XSD="web-app_2_4.xsd"; private static final String WEB_APP_2_4=J2EE_NS+"/"+WEB_APP_2_4_XSD; public static final String WEB_APP_2_4_ID="SCHEMA:"+WEB_APP_2_4; private static final String URL_WEB_APP_2_2="nbres:/org/netbeans/modules/j2ee/ddloaders/web/resources/web-app_2_2.dtd"; private static final String URL_WEB_APP_2_3="nbres:/org/netbeans/modules/j2ee/ddloaders/web/resources/web-app_2_3.dtd"; private static final String URL_WEB_APP_2_4="nbres:/org/netbeans/modules/j2ee/ddloaders/web/resources/web-app_2_4.xsd"; private static final String URL_WEB_APP_2_4_DTD="nbres:/org/netbeans/modules/j2ee/ddloaders/web/resources/web-app_2_4.dtd"; private static final String XML_XSD="http://www.w3.org/2001/xml.xsd"; private static final String XML_XSD_DEF="<?xml version='1.0'?><xs:schema targetNamespace=\"http://www.w3.org/XML/1998/namespace\" xmlns:xs=\"http://www.w3.org/2001/XMLSchema\" xml:lang=\"en\"><xs:attribute name=\"lang\" type=\"xs:language\"><xs:annotation><xs:documentation>In due course, we should install the relevant ISO 2- and 3-letter codes as the enumerated possible values . . .</xs:documentation></xs:annotation></xs:attribute></xs:schema>"; 44 public static final String JAVAEE_NS = "http://java.sun.com/xml/ns/javaee"; private static final String WEB_APP_2_5_XSD="web-app_2_5.xsd"; private static final String WEB_APP_2_5=JAVAEE_NS+"/"+WEB_APP_2_5_XSD; public static final String WEB_APP_2_5_ID="SCHEMA:"+WEB_APP_2_5; private static final String URL_WEB_APP_2_5="nbres:/org/netbeans/modules/j2ee/ddloaders/web/resources/web-app_2_5.xsd"; private static final String URL_WEB_APP_2_5_DTD="nbres:/org/netbeans/modules/j2ee/ddloaders/web/resources/web-app_2_5.dtd"; 51 52 public DDCatalog() { 53 } 54 55 59 public java.util.Iterator getPublicIDs() { 60 java.util.List list = new java.util.ArrayList (); 61 list.add(WEB_APP_2_2); 62 list.add(WEB_APP_2_3); 63 list.add(WEB_APP_2_4_ID); 64 list.add(WEB_APP_2_5_ID); 65 return list.listIterator(); 66 } 67 68 72 public String getSystemID(String publicId) { 73 if (WEB_APP_2_2.equals(publicId)) 74 return URL_WEB_APP_2_2; 75 else if (WEB_APP_2_3.equals(publicId)) 76 return URL_WEB_APP_2_3; 77 else if (WEB_APP_2_4_ID.equals(publicId)) 78 return URL_WEB_APP_2_4_DTD; 79 else if (WEB_APP_2_5_ID.equals(publicId)) 80 return URL_WEB_APP_2_5_DTD; 81 else return null; 82 } 83 84 87 public void refresh() { 88 } 89 90 94 public void addCatalogListener(CatalogListener l) { 95 } 96 97 101 public void removeCatalogListener(CatalogListener l) { 102 } 103 104 105 public void addPropertyChangeListener(java.beans.PropertyChangeListener l) { 106 } 107 108 111 public String getDisplayName() { 112 return NbBundle.getMessage (DDCatalog.class, "LBL_DDCatalog"); 113 } 114 115 120 public java.awt.Image getIcon(int type) { 121 return Utilities.loadImage("org/netbeans/modules/j2ee/ddloaders/web/resources/DDCatalog.gif"); } 123 124 127 public String getShortDescription() { 128 return NbBundle.getMessage (DDCatalog.class, "DESC_DDCatalog"); 129 } 130 131 132 public void removePropertyChangeListener(java.beans.PropertyChangeListener l) { 133 } 134 135 141 public org.xml.sax.InputSource resolveEntity(String publicId, String systemId) throws org.xml.sax.SAXException , java.io.IOException { 142 if (WEB_APP_2_4.equals(systemId)) { 143 return new org.xml.sax.InputSource (URL_WEB_APP_2_4); 144 } else if (systemId!=null && systemId.endsWith(WEB_APP_2_4_XSD)) { 145 return new org.xml.sax.InputSource (URL_WEB_APP_2_4); 146 } else if (WEB_APP_2_5.equals(systemId)) { 147 return new org.xml.sax.InputSource (URL_WEB_APP_2_5); 148 } else if (systemId!=null && systemId.endsWith(WEB_APP_2_5_XSD)) { 149 return new org.xml.sax.InputSource (URL_WEB_APP_2_5); 150 } else if (XML_XSD.equals(systemId)) { 151 return new org.xml.sax.InputSource (new java.io.StringReader (XML_XSD_DEF)); 152 } else { 153 return null; 154 } 155 } 156 157 161 public String resolveURI(String name) { 162 return null; 163 } 164 168 public String resolvePublic(String publicId) { 169 return null; 170 } 171 172 } 173 | Popular Tags |