1 16 package org.apache.cocoon.xml; 17 18 import org.apache.avalon.framework.logger.AbstractLogEnabled; 19 import org.xml.sax.EntityResolver ; 20 import org.xml.sax.InputSource ; 21 import org.xml.sax.SAXException ; 22 23 import java.io.IOException ; 24 import java.util.Collections ; 25 import java.util.HashSet ; 26 import java.util.Set ; 27 28 34 public class LoggingEntityResolver extends AbstractLogEnabled implements EntityResolver { 35 36 protected EntityResolver resolver; 37 protected Set dependencies; 38 39 public LoggingEntityResolver(EntityResolver resolver) { 40 this.resolver = resolver; 41 dependencies = new HashSet (); 42 } 43 44 public InputSource resolveEntity(String public_id, String system_id) throws SAXException ,IOException { 45 InputSource input_source = resolver.resolveEntity(public_id,system_id); 46 dependencies.add(input_source); 47 getLogger().debug("Dependency: "+input_source.getSystemId()); 48 return input_source; 49 } 50 51 public Set getDependencies() { 52 return Collections.unmodifiableSet(dependencies); 53 } 54 55 } 56 | Popular Tags |