/*
* The Relaxer artifact
* Copyright (c) 2000-2004, ASAMI Tomoharu, All rights reserved.
*
* 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:
*
* - Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
*
* 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 org.xmlsmartdoc.goldenport.macro;
import java.io.*;
import java.net.URL;
import javax.xml.parsers.*;
import org.w3c.dom.*;
import org.xml.sax.*;
import org.xmlsmartdoc.goldenport.lib.*;
/**
* AbstractMacroFactory is generated by Relaxer based on macro.rng.
*
* @version macro.rng 1.0 (Fri Jul 29 11:55:15 JST 2005)
* @author Relaxer 1.1b (http://www.relaxer.org)
*/
public abstract class AbstractMacroFactory implements IMacroFactory {
protected org.xml.sax.ErrorHandler errorHandler;
protected org.xml.sax.EntityResolver entityResolver;
protected String baseUri;
/**
* Gets a Class of <code>GmMacro</code>.
*
* @return Class
*/
public Class getGmMacroClass() {
return (createGmMacro().getClass());
}
/**
* Sets a <b>errorHandler</b>.
*
* @param errorHandler
*/
public void setErrorHandler(org.xml.sax.ErrorHandler errorHandler) {
this.errorHandler = errorHandler;
}
/**
* Gets a <b>errorHandler</b>.
*
* @return org.xml.sax.ErrorHandler
*/
public org.xml.sax.ErrorHandler getErrorHandler() {
return (errorHandler);
}
/**
* Sets a <b>entityResolver</b>.
*
* @param entityResolver
*/
public void setEntityResolver(org.xml.sax.EntityResolver entityResolver) {
this.entityResolver = entityResolver;
}
/**
* Gets a <b>entityResolver</b>.
*
* @return org.xml.sax.EntityResolver
*/
public org.xml.sax.EntityResolver getEntityResolver() {
return (entityResolver);
}
/**
* Sets a <b>baseUri</b>.
*
* @param baseUri
*/
public void setBaseUri(String baseUri) {
this.baseUri = baseUri;
}
/**
* Gets a <b>baseUri</b>.
*
* @return String
*/
public String getBaseUri() {
return (baseUri);
}
/**
* Creates a <code>Object</code> by the File <code>file</code>.
* This method is a template method for concrete classes.
*
* @param file
* @exception IOException
* @exception SAXException
* @exception ParserConfigurationException
* @return Object
*/
public Object create(File file) throws IOException, SAXException, ParserConfigurationException {
Object node = create(UJAXP.getDocument(file, UJAXP.FLAG_NAMESPACE_AWARE, errorHandler, entityResolver));
return (node);
}
/**
* Creates a <code>Object</code> by the String representation of URI <code>uri</code>.
* This method is a template method for concrete classes.
*
* @param uri
* @exception IOException
* @exception SAXException
* @exception ParserConfigurationException
* @return Object
*/
public Object create(String uri) throws IOException, SAXException, ParserConfigurationException {
Object node = create(UJAXP.getDocument(uri, baseUri, UJAXP.FLAG_NAMESPACE_AWARE, errorHandler, entityResolver));
return (node);
}
/**
* Creates a <code>Object</code> by the URL <code>url</code>.
* This method is a template method for concrete classes.
*
* @param url
* @exception IOException
* @exception SAXException
* @exception ParserConfigurationException
* @return Object
*/
public Object create(URL url) throws IOException, SAXException, ParserConfigurationException {
Object node = create(UJAXP.getDocument(url, UJAXP.FLAG_NAMESPACE_AWARE, errorHandler, entityResolver));
return (node);
}
/**
* Creates a <code>Object</code> by the InputStream <code>in</code>.
* This method is a template method for concrete classes.
*
* @param in
* @exception IOException
* @exception SAXException
* @exception ParserConfigurationException
* @return Object
*/
public Object create(InputStream in) throws IOException, SAXException, ParserConfigurationException {
Object node = create(UJAXP.getDocument(in, UJAXP.FLAG_NAMESPACE_AWARE, errorHandler, entityResolver));
return (node);
}
/**
* Creates a <code>Object</code> by the InputSource <code>is</code>.
* This method is a template method for concrete classes.
*
* @param is
* @exception IOException
* @exception SAXException
* @exception ParserConfigurationException
* @return Object
*/
public Object create(InputSource is) throws IOException, SAXException, ParserConfigurationException {
Object node = create(UJAXP.getDocument(is, UJAXP.FLAG_NAMESPACE_AWARE, errorHandler, entityResolver));
return (node);
}
/**
* Creates a <code>Object</code> by the Reader <code>reader</code>.
* This method is a template method for concrete classes.
*
* @param reader
* @exception IOException
* @exception SAXException
* @exception ParserConfigurationException
* @return Object
*/
public Object create(Reader reader) throws IOException, SAXException, ParserConfigurationException {
Object node = create(UJAXP.getDocument(reader, UJAXP.FLAG_NAMESPACE_AWARE, errorHandler, entityResolver));
return (node);
}
/**
* Creates a <code>Object</code> by the copy <code>Object</code>.
* This method is a template method for concrete classes.
*
* @param source
* @return Object
*/
public Object create(Object source) {
if (source instanceof GmMacro) {
GmMacro node = createGmMacro();
node.setup((GmMacro)source);
return(node);
} else {
return (null);
}
}
/**
* Creates a <code>Object</code> by the Document <code>doc</code>.
* This method is a template method for concrete classes.
*
* @param doc
* @exception IOException
* @exception SAXException
* @exception ParserConfigurationException
* @return Object
*/
public Object create(Document doc) throws IOException, SAXException, ParserConfigurationException {
Object node = create(doc.getDocumentElement());
return (node);
}
/**
* Creates a <code>Object</code> by the Element <code>element</code>.
* This method is a template method for concrete classes.
*
* @param element
* @exception IOException
* @exception SAXException
* @exception ParserConfigurationException
* @return Object
*/
public Object create(Element element) throws IOException, SAXException, ParserConfigurationException {
if (GmMacro.isMatch(element)) {
GmMacro node = createGmMacro();
node.setup(element);
return(node);
} else {
return (null);
}
}
/**
* Creates a <code>GmMacro</code> by the File <code>file</code>.
* This method is a template method for concrete classes.
*
* @param file
* @exception IOException
* @exception SAXException
* @exception ParserConfigurationException
* @return GmMacro
*/
public GmMacro createGmMacro(File file) throws IOException, SAXException, ParserConfigurationException {
GmMacro gmMacro_ = createGmMacro();
gmMacro_.setup(UJAXP.getDocument(file, UJAXP.FLAG_NAMESPACE_AWARE, errorHandler, entityResolver));
return (gmMacro_);
}
/**
* Creates a <code>GmMacro</code>
* by the String representation of URI <code>uri</code>.
* This method is a template method for concrete classes.
*
* @param uri
* @exception IOException
* @exception SAXException
* @exception ParserConfigurationException
* @return GmMacro
*/
public GmMacro createGmMacro(String uri) throws IOException, SAXException, ParserConfigurationException {
GmMacro gmMacro_ = createGmMacro();
gmMacro_.setup(UJAXP.getDocument(uri, baseUri, UJAXP.FLAG_NAMESPACE_AWARE, errorHandler, entityResolver));
return (gmMacro_);
}
/**
* Creates a <code>GmMacro</code> by the URL <code>url</code>.
* This method is a template method for concrete classes.
*
* @param url
* @exception IOException
* @exception SAXException
* @exception ParserConfigurationException
* @return GmMacro
*/
public GmMacro createGmMacro(URL url) throws IOException, SAXException, ParserConfigurationException {
GmMacro gmMacro_ = createGmMacro();
gmMacro_.setup(UJAXP.getDocument(url, UJAXP.FLAG_NAMESPACE_AWARE, errorHandler, entityResolver));
return (gmMacro_);
}
/**
* Creates a <code>GmMacro</code> by the InputStream <code>in</code>.
* This method is a template method for concrete classes.
*
* @param in
* @exception IOException
* @exception SAXException
* @exception ParserConfigurationException
* @return GmMacro
*/
public GmMacro createGmMacro(InputStream in) throws IOException, SAXException, ParserConfigurationException {
GmMacro gmMacro_ = createGmMacro();
gmMacro_.setup(UJAXP.getDocument(in, UJAXP.FLAG_NAMESPACE_AWARE, errorHandler, entityResolver));
return (gmMacro_);
}
/**
* Creates a <code>GmMacro</code> by the InputSource <code>is</code>.
* This method is a template method for concrete classes.
*
* @param is
* @exception IOException
* @exception SAXException
* @exception ParserConfigurationException
* @return GmMacro
*/
public GmMacro createGmMacro(InputSource is) throws IOException, SAXException, ParserConfigurationException {
GmMacro gmMacro_ = createGmMacro();
gmMacro_.setup(UJAXP.getDocument(is, UJAXP.FLAG_NAMESPACE_AWARE, errorHandler, entityResolver));
return (gmMacro_);
}
/**
* Creates a <code>GmMacro</code> by the Reader <code>reader</code>.
* This method is a template method for concrete classes.
*
* @param reader
* @exception IOException
* @exception SAXException
* @exception ParserConfigurationException
* @return GmMacro
*/
public GmMacro createGmMacro(Reader reader) throws IOException, SAXException, ParserConfigurationException {
GmMacro gmMacro_ = createGmMacro();
gmMacro_.setup(UJAXP.getDocument(reader, UJAXP.FLAG_NAMESPACE_AWARE, errorHandler, entityResolver));
return (gmMacro_);
}
/**
* Creates a <code>GmMacro</code> by the object <code>source</code>.
* This method is a template method for concrete classes.
*
* @param source
* @return GmMacro
*/
public GmMacro createGmMacro(GmMacro source) {
GmMacro gmMacro_ = createGmMacro();
gmMacro_.setup(source);
return (gmMacro_);
}
/**
* Creates a <code>GmMacro</code> by the Document <code>doc</code>.
* This method is a template method for concrete classes.
*
* @param doc
* @return GmMacro
*/
public GmMacro createGmMacro(Document doc) {
GmMacro gmMacro_ = createGmMacro();
gmMacro_.setup(doc);
return (gmMacro_);
}
/**
* Creates a <code>GmMacro</code> by the Element <code>element</code>.
* This method is a template method for concrete classes.
*
* @param element
* @return GmMacro
*/
public GmMacro createGmMacro(Element element) {
GmMacro gmMacro_ = createGmMacro();
gmMacro_.setup(element);
return (gmMacro_);
}
/**
* Creates a <code>GmMacro</code> by the Stack <code>stack</code>.
* This mehtod is supposed to be used internally
* by the Relaxer system.
* This method is a template method for concrete classes.
*
* @param stack
* @return GmMacro
*/
public GmMacro createGmMacro(RStack stack) {
GmMacro gmMacro_ = createGmMacro();
gmMacro_.setup(stack);
return (gmMacro_);
}
}