1 19 package org.openide.xml; 20 21 import org.openide.util.*; 22 import org.xml.sax.*; 23 24 import java.io.*; 25 26 import java.util.*; 27 28 import javax.swing.event.*; 29 30 31 59 public abstract class EntityCatalog implements EntityResolver { 60 63 public static final String PUBLIC_ID = "-//NetBeans//Entity Mapping Registration 1.0//EN"; private static EntityCatalog instance = new Forwarder(); 65 66 69 public static EntityCatalog getDefault() { 70 return instance; 71 } 72 73 76 private static class Forwarder extends EntityCatalog { 77 private Lookup.Result<EntityCatalog> result; 78 79 Forwarder() { 80 } 81 82 public InputSource resolveEntity(String publicID, String systemID) 83 throws IOException, SAXException { 84 if (result == null) { 85 Lookup.Template<EntityCatalog> temp = new Lookup.Template<EntityCatalog>(EntityCatalog.class); 86 result = Lookup.getDefault().lookup(temp); 87 } 88 89 for (EntityCatalog res : result.allInstances()) { 90 InputSource is = res.resolveEntity(publicID, systemID); 92 93 if (is != null) { 94 return is; 95 } 96 } 97 98 return null; 99 } 100 } 101 } 102 | Popular Tags |