1 18 19 package org.apache.tools.ant.types.resolver; 20 21 import org.apache.xml.resolver.Catalog; 22 import org.apache.xml.resolver.CatalogEntry; 23 24 import org.apache.xml.resolver.helpers.PublicId; 25 26 41 public class ApacheCatalog extends Catalog { 42 43 44 private ApacheCatalogResolver resolver = null; 45 46 57 protected Catalog newCatalog() { 58 ApacheCatalog cat = (ApacheCatalog) super.newCatalog(); 59 cat.setResolver(resolver); 60 return cat; 61 } 62 63 67 public void setResolver(ApacheCatalogResolver resolver) { 68 this.resolver = resolver; 69 } 70 71 88 public void addEntry(CatalogEntry entry) { 89 90 int type = entry.getEntryType(); 91 92 if (type == PUBLIC) { 93 94 String publicid = PublicId.normalize(entry.getEntryArg(0)); 95 String systemid = normalizeURI(entry.getEntryArg(1)); 96 97 if (resolver == null) { 98 catalogManager.debug 99 .message(1, "Internal Error: null ApacheCatalogResolver"); 100 } else { 101 resolver.addPublicEntry(publicid, systemid, base); 102 } 103 104 } else if (type == URI) { 105 106 String uri = normalizeURI(entry.getEntryArg(0)); 107 String altURI = normalizeURI(entry.getEntryArg(1)); 108 109 if (resolver == null) { 110 catalogManager.debug 111 .message(1, "Internal Error: null ApacheCatalogResolver"); 112 } else { 113 resolver.addURIEntry(uri, altURI, base); 114 } 115 116 } 117 118 super.addEntry(entry); 119 } 120 121 } | Popular Tags |