org.apache.cocoon.components.source
Class AbstractSAXSource

java.lang.Object
  |
  +--org.apache.cocoon.components.source.AbstractSAXSource
All Implemented Interfaces:
org.apache.avalon.excalibur.pool.Poolable, org.apache.avalon.excalibur.pool.Recyclable, Source, XMLizable
Direct Known Subclasses:
XMLDBSource

public abstract class AbstractSAXSource
extends java.lang.Object
implements Source

This abstract class provides convenience methods to implement a SAX based Source. Implement toSAX() and getSystemId() and optionally override getLastModified() and getContentLength() to obtain a valid Source implementation.

Version:
$Id: AbstractSAXSource.java,v 1.5 2002/02/22 07:00:13 cziegeler Exp $
Author:
Gianugo Rabellino

Field Summary
protected  org.apache.log.Logger log
          The Logger instance
protected  org.apache.avalon.framework.component.ComponentManager manager
          The ComponentManager instance
 
Constructor Summary
AbstractSAXSource(Environment environment, org.apache.avalon.framework.component.ComponentManager manager, org.apache.log.Logger logger)
          The constructor.
 
Method Summary
 long getContentLength()
          Override this method to set the Content Length
 org.xml.sax.InputSource getInputSource()
          Get an InputSource for the given URL.
 java.io.InputStream getInputStream()
          Get an InputSource for the given URL.
 long getLastModified()
          Override this method to set the Last Modification date
abstract  java.lang.String getSystemId()
          Implement this method to set the unique identifier.
abstract  void toSAX(org.xml.sax.ContentHandler handler)
          Implement this method to obtain SAX events.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface org.apache.avalon.excalibur.pool.Recyclable
recycle
 

Field Detail

log

protected org.apache.log.Logger log
The Logger instance

manager

protected org.apache.avalon.framework.component.ComponentManager manager
The ComponentManager instance
Constructor Detail

AbstractSAXSource

public AbstractSAXSource(Environment environment,
                         org.apache.avalon.framework.component.ComponentManager manager,
                         org.apache.log.Logger logger)
The constructor.
Parameters:
environment - the Cocoon Environment.
manager - an Avalon Component Manager
logger - A LogKit logger
Method Detail

getInputStream

public java.io.InputStream getInputStream()
                                   throws ProcessingException,
                                          java.io.IOException
Get an InputSource for the given URL. Shamelessly stolen from SitemapSource.
Specified by:
getInputStream in interface Source

getInputSource

public org.xml.sax.InputSource getInputSource()
                                       throws ProcessingException,
                                              java.io.IOException
Get an InputSource for the given URL.
Specified by:
getInputSource in interface Source
Following copied from interface: org.apache.cocoon.environment.Source
Returns:
an InputSource value
Throws:
ProcessingException - if an error occurs
java.io.IOException - if an error occurs

toSAX

public abstract void toSAX(org.xml.sax.ContentHandler handler)
                    throws org.xml.sax.SAXException,
                           ProcessingException
Implement this method to obtain SAX events.
Specified by:
toSAX in interface XMLizable

getSystemId

public abstract java.lang.String getSystemId()
Implement this method to set the unique identifier.
Specified by:
getSystemId in interface Source

getContentLength

public long getContentLength()
Override this method to set the Content Length
Specified by:
getContentLength in interface Source

getLastModified

public long getLastModified()
Override this method to set the Last Modification date
Specified by:
getLastModified in interface Source


Copyright � 1999-2002 Apache Software Foundation. All Rights Reserved.