1 16 package org.apache.cocoon.components.validation.impl; 17 18 import org.apache.avalon.framework.activity.Disposable; 19 import org.apache.avalon.framework.activity.Initializable; 20 import org.apache.avalon.framework.logger.LogEnabled; 21 import org.apache.avalon.framework.logger.Logger; 22 import org.apache.avalon.framework.service.ServiceException; 23 import org.apache.avalon.framework.service.ServiceManager; 24 import org.apache.avalon.framework.service.Serviceable; 25 import org.apache.cocoon.components.validation.Schema; 26 import org.apache.cocoon.components.validation.SchemaParser; 27 import org.apache.excalibur.source.Source; 28 import org.apache.excalibur.source.SourceResolver; 29 import org.apache.excalibur.source.SourceValidity; 30 import org.apache.excalibur.xml.EntityResolver; 31 32 39 public abstract class AbstractSchemaParser 40 implements LogEnabled, Serviceable, Initializable, Disposable, SchemaParser { 41 42 43 protected ServiceManager serviceManager = null; 44 45 protected SourceResolver sourceResolver = null; 46 47 protected EntityResolver entityResolver = null; 48 49 protected Logger logger = null; 50 51 54 public AbstractSchemaParser() { 55 super(); 56 } 57 58 61 public void enableLogging(Logger logger) { 62 this.logger = logger; 63 } 64 65 68 public void service(ServiceManager manager) 69 throws ServiceException { 70 this.serviceManager = manager; 71 } 72 73 78 public void initialize() 79 throws Exception { 80 this.entityResolver = (EntityResolver) this.serviceManager.lookup(EntityResolver.ROLE); 81 this.sourceResolver = (SourceResolver) this.serviceManager.lookup(SourceResolver.ROLE); 82 } 83 84 87 public void dispose() { 88 if (this.entityResolver != null) this.serviceManager.release(this.entityResolver); 89 if (this.sourceResolver != null) this.serviceManager.release(this.sourceResolver); 90 } 91 } 92 | Popular Tags |