net.sf.jasperreports.engine.fill
Class JRFileVirtualizer

java.lang.Object
  extended bynet.sf.jasperreports.engine.fill.JRFileVirtualizer
All Implemented Interfaces:
JRVirtualizer

public class JRFileVirtualizer
extends java.lang.Object
implements JRVirtualizer

Virtualizes data to the filesystem. When this object is finalized, it removes the swap files it makes. The virtualized objects have references to this object, so finalization does not occur until this object and the objects using it are only weakly referenced.

Version:
$Id: JRFileVirtualizer.java,v 1.7 2005/09/07 13:58:26 teodord Exp $
Author:
John Bindel

Constructor Summary
JRFileVirtualizer(int maxSize)
          Uses the process's working directory as the location to store files.
JRFileVirtualizer(int maxSize, java.lang.String directory)
           
 
Method Summary
 void clearData(JRVirtualizable o)
          Called when the virtual object paged-out data should be freed.
 void deregisterObject(JRVirtualizable o)
          Lets this virtualizer know that it no longer must track the object.
protected  void finalize()
           
 boolean isReadOnly()
           
 void registerObject(JRVirtualizable o)
          Lets this virtualizer know that it must track the object.
 void requestData(JRVirtualizable o)
          Called when the virtual object must be paged-in.
 void setReadOnly(boolean ro)
           
 void touch(JRVirtualizable o)
          Lets the virtualizer know that this object is still being used.
 void virtualizeData(JRVirtualizable o)
          Called when the virtual object should be paged-out.
 
Methods inherited from class java.lang.Object
clone, equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

JRFileVirtualizer

public JRFileVirtualizer(int maxSize)
Uses the process's working directory as the location to store files.

Parameters:
maxSize - the maximum size (in JRVirtualizable objects) of the paged in cache.

JRFileVirtualizer

public JRFileVirtualizer(int maxSize,
                         java.lang.String directory)
Parameters:
maxSize - the maximum size (in JRVirtualizable objects) of the paged in cache.
directory - the base directory in the filesystem where the paged out data is to be stored
Method Detail

setReadOnly

public void setReadOnly(boolean ro)

isReadOnly

public boolean isReadOnly()

registerObject

public void registerObject(JRVirtualizable o)
Description copied from interface: JRVirtualizer
Lets this virtualizer know that it must track the object.

All virtualizable object must register with their virtualizer upon construction.

Specified by:
registerObject in interface JRVirtualizer

deregisterObject

public void deregisterObject(JRVirtualizable o)
Description copied from interface: JRVirtualizer
Lets this virtualizer know that it no longer must track the object.

Specified by:
deregisterObject in interface JRVirtualizer

touch

public void touch(JRVirtualizable o)
Description copied from interface: JRVirtualizer
Lets the virtualizer know that this object is still being used. This should be called to help the virtualizer determine which objects to keep in its cache, and which objects to page-out when it must do some paging-out.

The virtualizer gets to decide what type of caching strategy it will use.

Specified by:
touch in interface JRVirtualizer

requestData

public void requestData(JRVirtualizable o)
Description copied from interface: JRVirtualizer
Called when the virtual object must be paged-in.

Specified by:
requestData in interface JRVirtualizer

clearData

public void clearData(JRVirtualizable o)
Description copied from interface: JRVirtualizer
Called when the virtual object paged-out data should be freed.

Specified by:
clearData in interface JRVirtualizer

virtualizeData

public void virtualizeData(JRVirtualizable o)
Description copied from interface: JRVirtualizer
Called when the virtual object should be paged-out.

Specified by:
virtualizeData in interface JRVirtualizer

finalize

protected void finalize()
                 throws java.lang.Throwable
Throws:
java.lang.Throwable


© 2001-2005 JasperSoft Corporation www.jaspersoft.com