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

java.lang.Object
  extended by org.apache.avalon.framework.logger.AbstractLogEnabled
      extended by org.apache.cocoon.components.source.impl.BlobSource
All Implemented Interfaces:
LogEnabled, Serviceable, Source

public class BlobSource
extends AbstractLogEnabled
implements Source, Serviceable

A Source that takes its content in a single JDBC column. Any kind of column can be used (clob, blob, varchar, etc), but "Blob" means that the whole content is contained in a single column.

The URL syntax is "blob:/datasource/table/column[cond]", where :

For example, "blob:/personel/people/photo[userid='foo']" will fetch the first column returned by the statement "SELECT photo from people where userid='foo'" in the datasource "personel"

Version:
CVS $Id: BlobSource.html 1304258 2012-03-23 10:09:27Z ilgrosso $
Author:
Sylvain Wallez, Stephan Michels

Constructor Summary
BlobSource(String url)
          Create a file source from a 'blob:' url and a component manager.
 
Method Summary
 boolean exists()
           
 long getContentLength()
          Return the content length of the content or -1 if the length is unknown
 InputStream getInputStream()
          Get the input stream for this source.
 long getLastModified()
          Get the last modification 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
 String getURI()
          Return the unique identifer for this source
 SourceValidity getValidity()
          Get the Validity object.
 void refresh()
          Refresh the content of this object after the underlying data content has changed.
 void service(ServiceManager manager)
          Set the current ServiceManager instance used by this Serviceable.
 
Methods inherited from class org.apache.avalon.framework.logger.AbstractLogEnabled
enableLogging, getLogger, setupLogger, setupLogger, setupLogger
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

BlobSource

public BlobSource(String url)
           throws MalformedURLException
Create a file source from a 'blob:' url and a component manager.

The url is of the form "blob:/datasource/table/column[condition]

Throws:
MalformedURLException
Method Detail

service

public void service(ServiceManager manager)
Set the current ServiceManager instance used by this Serviceable.

Specified by:
service in interface Serviceable

getScheme

public String getScheme()
Return the protocol

Specified by:
getScheme in interface Source

getURI

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

Specified by:
getURI in interface Source

getInputStream

public InputStream getInputStream()
                           throws IOException,
                                  SourceException
Get the input stream for this source.

Specified by:
getInputStream in interface Source
Throws:
IOException
SourceException

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 the content of this object after the underlying data content has changed.

Specified by:
refresh in interface Source

exists

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

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

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.

Specified by:
getLastModified in interface Source
Returns:
The last modification in milliseconds since January 1, 1970 GMT or 0 if it is unknown

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.