org.apache.cocoon.components.source
Class FileSource

java.lang.Object
  extended by org.apache.avalon.framework.logger.AbstractLogEnabled
      extended by org.apache.cocoon.components.source.AbstractStreamSource
          extended by org.apache.cocoon.components.source.AbstractStreamWriteableSource
              extended by org.apache.cocoon.components.source.FileSource
All Implemented Interfaces:
Poolable, Recyclable, LogEnabled, ModifiableSource, Source, WriteableSource, XMLizable

Deprecated. Use the new avalon source resolving instead

public class FileSource
extends AbstractStreamWriteableSource
implements WriteableSource

A org.apache.cocoon.environment.WriteableSource for 'file:/' system IDs.

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

Field Summary
protected  File file
          Deprecated. The underlying file.
 
Fields inherited from class org.apache.cocoon.components.source.AbstractStreamSource
manager, transformerFactory
 
Constructor Summary
FileSource(String url, ComponentManager manager)
          Deprecated. Create a file source from a 'file:' url and a component manager.
 
Method Summary
 boolean canCancel(OutputStream stream)
          Deprecated. Always return false.
 void cancel(OutputStream stream)
          Deprecated. Cancels the output stream.
 boolean exists()
          Deprecated. Returns true if getInputStream() succeeds.
 long getContentLength()
          Deprecated. Override this method to set the Content Length
 InputStream getInputStream()
          Deprecated. Get the input stream for this source.
 long getLastModified()
          Deprecated. Override this method to set the Last Modification date
 OutputStream getOutputStream()
          Deprecated. Get an output stream to write to this source.
 String getSystemId()
          Deprecated. Return the unique identifer for this source
protected  boolean isHTMLContent()
          Deprecated. Returns true if the file name ends with ".htm" or ".html".
 
Methods inherited from class org.apache.cocoon.components.source.AbstractStreamWriteableSource
canCancel, cancel, getContentHandler
 
Methods inherited from class org.apache.cocoon.components.source.AbstractStreamSource
getInputSource, recycle, refresh, toSAX
 
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
 
Methods inherited from interface org.apache.cocoon.environment.WriteableSource
canCancel, cancel, getContentHandler
 
Methods inherited from interface org.apache.cocoon.environment.ModifiableSource
refresh
 
Methods inherited from interface org.apache.cocoon.environment.Source
getInputSource
 
Methods inherited from interface org.apache.avalon.excalibur.pool.Recyclable
recycle
 
Methods inherited from interface org.apache.excalibur.xml.sax.XMLizable
toSAX
 

Field Detail

file

protected File file
Deprecated. 
The underlying file.

Constructor Detail

FileSource

public FileSource(String url,
                  ComponentManager manager)
Deprecated. 
Create a file source from a 'file:' url and a component manager.

Method Detail

exists

public boolean exists()
Deprecated. 
Description copied from class: AbstractStreamSource
Returns true if getInputStream() succeeds. Subclasses can provide a more efficient implementation.

Specified by:
exists in interface WriteableSource
Overrides:
exists in class AbstractStreamSource
Returns:
true if the resource exists.

isHTMLContent

protected boolean isHTMLContent()
Deprecated. 
Returns true if the file name ends with ".htm" or ".html".

Overrides:
isHTMLContent in class AbstractStreamSource

getSystemId

public String getSystemId()
Deprecated. 
Return the unique identifer for this source

Specified by:
getSystemId in interface Source

getInputStream

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

Specified by:
getInputStream in interface Source
Throws:
IOException
ProcessingException

getLastModified

public long getLastModified()
Deprecated. 
Description copied from class: AbstractStreamSource
Override this method to set the Last Modification date

Specified by:
getLastModified in interface Source
Overrides:
getLastModified in class AbstractStreamSource

getContentLength

public long getContentLength()
Deprecated. 
Description copied from class: AbstractStreamSource
Override this method to set the Content Length

Specified by:
getContentLength in interface Source
Overrides:
getContentLength in class AbstractStreamSource

getOutputStream

public OutputStream getOutputStream()
                             throws IOException,
                                    ProcessingException
Deprecated. 
Get an output stream to write to this source. The output stream returned actually writes to a temp file that replaces the real one on close. This temp file is used as lock to forbid multiple simultaneous writes. The real file is updated atomically when the output stream is closed.

Specified by:
getOutputStream in interface WriteableSource
Returns:
a stream to write to
Throws:
ConcurrentModificationException - if another thread is currently writing to this file.
IOException
ProcessingException

canCancel

public boolean canCancel(OutputStream stream)
Deprecated. 
Always return false. To be redefined by implementations that support cancel().

Specified by:
canCancel in interface WriteableSource
Overrides:
canCancel in class AbstractStreamWriteableSource
Returns:
true if the stream can be cancelled

cancel

public void cancel(OutputStream stream)
            throws Exception
Deprecated. 
Cancels the output stream.

Specified by:
cancel in interface WriteableSource
Overrides:
cancel in class AbstractStreamWriteableSource
Throws:
Exception


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