/* * Reference ETL Parser for Java * Copyright (c) 2000-2009 Constantine A Plotnikov * * Permission is hereby granted, free of charge, to any person * obtaining a copy of this software and associated documentation * files (the "Software"), to deal in the Software without restriction, * including without limitation the rights to use, copy, modify, merge, * publish, distribute, sublicense, and/or sell copies of the Software, * and to permit persons to whom the Software is furnished to do so, * subject to the following conditions: * * The above copyright notice and this permission notice shall be * included in all copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE * SOFTWARE. */ package net.sf.etl.parsers; import org.xml.sax.EntityResolver; import net.sf.etl.parsers.internal.term_parser.DefaultTermParserFactory; /** * A factory for term parser. This interface is used to create instances of term * parser. * * @author const */ public abstract class TermParserFactory { /** Default grammar to be used by parser */ private String defaultGrammarPublicId; /** Default grammar to be used by parser */ private String defaultGrammarSystemId; /** default context to be used by parser */ private String defaultContext; /** the entity resolver */ private EntityResolver entityResolver; /** * @return current entity resolver of the parser */ public EntityResolver getEntityResolver() { return entityResolver; } /** * Set new resolver for the parser * * @param resolver * a new resolver */ public void setEntityResolver(EntityResolver resolver) { entityResolver = resolver; } /** * @return Returns the defaultContext. */ public String getDefaultContext() { return defaultContext; } /** * @return Returns the defaultGrammar. */ public String getDefaultGrammarPublicId() { return defaultGrammarPublicId; } /** * @return Returns the defaultGrammar. */ public String getDefaultGrammarSystemId() { return defaultGrammarSystemId; } /** * Set default grammar for the parser * * @param publicId * default grammar publicId * @param systemId * default grammar systemId * @param context * a default context within grammar */ public void setDefaultGrammar(String publicId, String systemId, String context) { this.defaultGrammarPublicId = publicId; this.defaultGrammarSystemId = systemId; this.defaultContext = context; } /** * Get new term parser * * @return a new term parser */ public abstract TermParser newTermParser(); /** * @return new instance of term parser factory */ public static TermParserFactory newInstance() { return new DefaultTermParserFactory(); } }