org.apache.cocoon.components.source.impl
Class CocoonToAvalonSource

java.lang.Object
  extended by org.apache.cocoon.components.source.impl.CocoonToAvalonSource
All Implemented Interfaces:
Poolable, Recyclable, Source, XMLizable

public final class CocoonToAvalonSource
extends Object
implements Source, XMLizable, Recyclable

This source objects wraps an obsolete Cocoon Source object to avoid recoding existing source objects.

Version:
CVS $Id: CocoonToAvalonSource.html 1304258 2012-03-23 10:09:27Z ilgrosso $
Author:
Carsten Ziegeler

Field Summary
protected  String protocol
          The protocol
protected  Source source
          The real source
 
Constructor Summary
CocoonToAvalonSource(String location, Source source)
          Constructor
 
Method Summary
 boolean exists()
           
 long getContentLength()
          Return the content length of the content or -1 if the length is unknown
 InputStream getInputStream()
          Return an InputStream object to read from the source.
 long getLastModified()
          Get the last modification date of the source or 0 if it is not possible to determine the date.
 String getMimeType()
          The mime-type of the content described by this object.
 String getParameter(String name)
          Get the value of a parameter.
 long getParameterAsLong(String name)
          Get the value of a parameter.
 Iterator getParameterNames()
          Get parameter names Using this it is possible to get custom information provided by the source implementation, like an expires date, HTTP headers etc.
 String getScheme()
          Return the protocol identifier.
 String getURI()
          Return the unique identifer for this source
 SourceValidity getValidity()
          Get the Validity object.
 void recycle()
          Recyclable
 void refresh()
          Refresh this object and update the last modified date and content length.
 void toSAX(ContentHandler contentHandler)
          Stream content to the content handler
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

source

protected Source source
The real source


protocol

protected String protocol
The protocol

Constructor Detail

CocoonToAvalonSource

public CocoonToAvalonSource(String location,
                            Source source)
Constructor

Method Detail

getScheme

public String getScheme()
Return the protocol identifier.

Specified by:
getScheme in interface Source

exists

public boolean exists()
Specified by:
exists in interface Source
See Also:
Source.exists()

getInputStream

public InputStream getInputStream()
                           throws IOException,
                                  SourceException
Return an InputStream object to read from the source.

Specified by:
getInputStream in interface Source
Throws:
IOException
SourceException

getURI

public String getURI()
Return the unique identifer for this source

Specified by:
getURI in interface Source

getValidity

public SourceValidity getValidity()
Get the Validity object. This can either wrap the last modification date or the expires information or... If it is currently not possible to calculate such an information null is returned.

Specified by:
getValidity in interface Source

refresh

public void refresh()
Refresh this object and update the last modified date and content length.

Specified by:
refresh in interface Source

getMimeType

public String getMimeType()
The mime-type of the content described by this object. If the source is not able to determine the mime-type by itself this can be null.

Specified by:
getMimeType in interface Source

toSAX

public void toSAX(ContentHandler contentHandler)
           throws SAXException
Stream content to the content handler

Specified by:
toSAX in interface XMLizable
Throws:
SAXException

recycle

public void recycle()
Recyclable

Specified by:
recycle in interface Recyclable

getContentLength

public long getContentLength()
Return the content length of the content or -1 if the length is unknown

Specified by:
getContentLength in interface Source

getLastModified

public long getLastModified()
Get the last modification date of the source or 0 if it is not possible to determine the date.

Specified by:
getLastModified in interface Source

getParameter

public String getParameter(String name)
Get the value of a parameter. Using this it is possible to get custom information provided by the source implementation, like an expires date, HTTP headers etc.


getParameterAsLong

public long getParameterAsLong(String name)
Get the value of a parameter. Using this it is possible to get custom information provided by the source implementation, like an expires date, HTTP headers etc.


getParameterNames

public Iterator getParameterNames()
Get parameter names Using this it is possible to get custom information provided by the source implementation, like an expires date, HTTP headers etc.



Copyright © 1999-2010 The Apache Software Foundation. All Rights Reserved.