org.apache.cocoon.components.source
abstract public class: AbstractSAXSource [javadoc |
source]
java.lang.Object
org.apache.cocoon.components.source.AbstractSAXSource
All Implemented Interfaces:
Source
Direct Known Subclasses:
XMLDBSource
Deprecated! Use - the new Avalon Excalibur Source Resolving
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.
- author:
< - a href="mailto:gianugo@apache.org">Gianugo Rabellino
- version:
CVS - $Id: AbstractSAXSource.java 433543 2006-08-22 06:22:54Z crossley $
| Field Summary |
|---|
| protected Logger | log | The Logger instance |
| protected ComponentManager | manager | The ComponentManager instance |
| Method from org.apache.cocoon.components.source.AbstractSAXSource Detail: |
public long getContentLength() {
return -1;
} Deprecated!Override this method to set the Content Length |
public InputSource getInputSource() throws IOException, ProcessingException {
InputSource is = new InputSource(this.getInputStream());
is.setSystemId(this.getSystemId());
return is;
} Deprecated!Get an InputSource for the given URL. |
public InputStream getInputStream() throws IOException, ProcessingException {
ComponentSelector serializerSelector = null;
Serializer serializer = null;
try {
serializerSelector = (ComponentSelector) this.manager.lookup(Serializer.ROLE + "Selector");
serializer = (Serializer)serializerSelector.select("xml");
ByteArrayOutputStream os = new ByteArrayOutputStream();
serializer.setOutputStream(os);
this.toSAX(serializer);
return new ByteArrayInputStream(os.toByteArray());
} catch (ComponentException cme) {
throw new ProcessingException("could not lookup pipeline components", cme);
} catch (Exception e) {
throw new ProcessingException("Exception during processing of " + this.getSystemId(), e);
} finally {
if (serializer != null) serializerSelector.release(serializer);
if (serializerSelector != null) this.manager.release(serializerSelector);
}
} Deprecated!Get an InputSource for the given URL. Shamelessly stolen
from SitemapSource. |
public long getLastModified() {
return 0;
} Deprecated!Override this method to set the Last Modification date |
abstract public String getSystemId() Deprecated!
Implement this method to set the unique identifier. |
abstract public void toSAX(ContentHandler handler) throws SAXException Deprecated!
Implement this method to obtain SAX events. |