1 19 20 25 26 package org.netbeans.modules.web.struts; 27 28 import org.netbeans.modules.xml.catalog.spi.*; 29 import org.openide.util.NbBundle; 30 import org.openide.util.Utilities; 31 35 public class StrutsCatalog implements CatalogReader, CatalogDescriptor, org.xml.sax.EntityResolver { 36 37 private static final String STRUTS_ID_1_0 = "-//Apache Software Foundation//DTD Struts Configuration 1.0//EN"; private static final String STRUTS_ID_1_1 = "-//Apache Software Foundation//DTD Struts Configuration 1.1//EN"; private static final String STRUTS_ID_1_2 = "-//Apache Software Foundation//DTD Struts Configuration 1.2//EN"; private static final String TILES_ID_1_1 = "-//Apache Software Foundation//DTD Tiles Configuration 1.1//EN"; private static final String VALIDATOR_ID_1_1_3 = "-//Apache Software Foundation//DTD Commons Validator Rules Configuration 1.1.3//EN"; 43 private static final String URL_STRUTS_1_0 ="nbres:/org/netbeans/modules/web/struts/resources/struts-config_1_0.dtd"; private static final String URL_STRUTS_1_1 ="nbres:/org/netbeans/modules/web/struts/resources/struts-config_1_1.dtd"; private static final String URL_STRUTS_1_2 ="nbres:/org/netbeans/modules/web/struts/resources/struts-config_1_2.dtd"; private static final String URL_TILES_1_1 = "nbres:/org/netbeans/modules/web/struts/resources/tiles-config_1_1.dtd"; private static final String URL_VALIDATOR_1_1_3 = "nbres:/org/netbeans/modules/web/struts/resources/validator_1_1_3.dtd"; 49 50 public StrutsCatalog() { 51 } 52 53 57 public java.util.Iterator getPublicIDs() { 58 java.util.List list = new java.util.ArrayList (); 59 list.add(STRUTS_ID_1_0); 60 list.add(STRUTS_ID_1_1); 61 list.add(STRUTS_ID_1_2); 62 list.add(TILES_ID_1_1); 63 list.add(VALIDATOR_ID_1_1_3); 64 return list.listIterator(); 65 } 66 67 71 public String getSystemID(String publicId) { 72 if (STRUTS_ID_1_0.equals(publicId)) 73 return URL_STRUTS_1_0; 74 else if (STRUTS_ID_1_1.equals(publicId)) 75 return URL_STRUTS_1_1; 76 else if (STRUTS_ID_1_2.equals(publicId)) 77 return URL_STRUTS_1_2; 78 else if (TILES_ID_1_1.equals(publicId)) 79 return URL_TILES_1_1; 80 else if (VALIDATOR_ID_1_1_3.equals(publicId)) 81 return URL_VALIDATOR_1_1_3; 82 else return null; 83 } 84 85 88 public void refresh() { 89 } 90 91 95 public void addCatalogListener(CatalogListener l) { 96 } 97 98 102 public void removeCatalogListener(CatalogListener l) { 103 } 104 105 106 public void addPropertyChangeListener(java.beans.PropertyChangeListener l) { 107 } 108 109 110 public void removePropertyChangeListener(java.beans.PropertyChangeListener l) { 111 } 112 113 116 public String getDisplayName() { 117 return NbBundle.getMessage (StrutsCatalog.class, "LBL_StrutsCatalog"); } 119 120 125 public java.awt.Image getIcon(int type) { 126 return Utilities.loadImage("org/netbeans/modules/web/struts/resources/StrutsCatalog.png"); } 128 129 132 public String getShortDescription() { 133 return NbBundle.getMessage (StrutsCatalog.class, "DESC_StrutsCatalog"); } 135 136 142 public org.xml.sax.InputSource resolveEntity(String publicId, String systemId) throws org.xml.sax.SAXException , java.io.IOException { 143 if (STRUTS_ID_1_0.equals(publicId)) { 144 return new org.xml.sax.InputSource (URL_STRUTS_1_0); 145 } else if (STRUTS_ID_1_1.equals(publicId)) { 146 return new org.xml.sax.InputSource (URL_STRUTS_1_1); 147 } else if (STRUTS_ID_1_2.equals(publicId)) { 148 return new org.xml.sax.InputSource (URL_STRUTS_1_2); 149 } else if (TILES_ID_1_1.equals(publicId)) { 150 return new org.xml.sax.InputSource (URL_TILES_1_1); 151 } else if (VALIDATOR_ID_1_1_3.equals(publicId)) { 152 return new org.xml.sax.InputSource (URL_VALIDATOR_1_1_3); 153 } else { 154 return null; 155 } 156 } 157 158 162 public String resolveURI(String name) { 163 return null; 164 } 165 169 public String resolvePublic(String publicId) { 170 return null; 171 } 172 } 173 | Popular Tags |