Oracle Reports
Java API Reference
10g Release 2 (10.1.2)
B14049-01

oracle.reports.cache
Interface CacheItem


public interface CacheItem

Defines the CacheItem interface used by the Oracle Reports Cache class.


Method Summary
 void addContent(java.lang.String filename, byte[] bytes, short format, boolean main)
          Adds a file and its content to the CacheItem.
 void addFile(java.lang.String filename, short format, boolean main)
          Adds a cache file to the CacheItem.
 void clear()
          Clears the content of the CacheItem and sets its state to invalid.
 java.lang.String[] getAdditionalFiles(oracle.reports.ShortArrayHolder formats, oracle.reports.LongLongArrayHolder sizes, boolean full)
          Returns additional file names and formats.
 java.io.InputStream getContent(java.lang.String filename)
          Returns file content from the cache.
 long getExpiration()
          Returns the expiration time for the CacheItem.
 long getFinishedTime()
          Returns the completed time of the CacheItem.
 Job getJob()
          Returns the job owning this CacheItem.
 java.lang.String getKey()
          Returns the Item Key.
 java.lang.String getMainFile(org.omg.CORBA.ShortHolder format, org.omg.CORBA.LongHolder size, boolean full)
          Returns the main file name and format.
 long getSize()
          Returns the item size expressed in bytes.
 boolean isContentReady()
          Checks if the content for the CacheItem is ready to be used.
 boolean isExpired()
          Checks if the CacheItem has expired.
 boolean isValid()
          Checks if the CacheItem is valid to use.
 void setContentReady()
          Specifies whether the content for the CacheItem is ready to be used.
 void setCustomProperties(java.util.Properties props)
          Sets custom properties for the CacheItem.
 void setExpiration(long expiration)
          Sets the expiration time for the CacheItem.
 void setFinishedTime(long finishedTime)
          Sets the completion time for the CacheItem.
 void setJob(Job job)
          Sets the associated job for this CacheItem.

 

Method Detail

getKey

public java.lang.String getKey()
Returns the Item Key.
Returns:
The Item Key used to determine the number of cache hits.

getJob

public Job getJob()
Returns the job owning this CacheItem.
Returns:
The job object that is associated with the CacheItem.

setJob

public void setJob(Job job)
Sets the associated job for this CacheItem.
Parameters:
job - Associates the job object with the CacheItem.

setExpiration

public void setExpiration(long expiration)
                   throws oracle.reports.RWException
Sets the expiration time for the CacheItem.
Parameters:
expiration - Time in milliseconds. If a CacheItem has no expiration set, the item will never expire and it will only become invalid when the cache system uses FIFO to clear the item when it is full, or when it is intentionally cleared.

getExpiration

public long getExpiration()
Returns the expiration time for the CacheItem.
Returns:
The expiration time in milliseconds. A value of -1 means it will never expire.

isExpired

public boolean isExpired()
Checks if the CacheItem has expired.
Returns:
True if expired, false if not expired.

getFinishedTime

public long getFinishedTime()
Returns the completed time of the CacheItem.
Returns:
The finished time stamp expressed in milliseconds.

setFinishedTime

public void setFinishedTime(long finishedTime)
                     throws oracle.reports.RWException
Sets the completion time for the CacheItem.
Parameters:
finishedTime - Completion time expressed in milliseconds.

setCustomProperties

public void setCustomProperties(java.util.Properties props)
                         throws oracle.reports.RWException
Sets custom properties for the CacheItem.
Parameters:
props - Custom properties.

clear

public void clear()
           throws oracle.reports.RWException
Clears the content of the CacheItem and sets its state to invalid.

isValid

public boolean isValid()
Checks if the CacheItem is valid to use. A CacheItem becomes invalid when it expires, or when it is cleared by the cache system.
Returns:
True if the CacheItem is valid, false if it is invalid.

getSize

public long getSize()
             throws oracle.reports.RWException
Returns the item size expressed in bytes.
Returns:
The size of the CacheItem (total size of all files in the item).

addFile

public void addFile(java.lang.String filename,
                    short format,
                    boolean main)
             throws oracle.reports.RWException
Adds a cache file to the CacheItem. The contents of the added file has been or will be uploaded into the cache system separately.
Parameters:
filename - Name of the file to be added.
format - File format of the file to be added.
main - Specifies whether this file is the main part of the CacheItem.

addContent

public void addContent(java.lang.String filename,
                       byte[] bytes,
                       short format,
                       boolean main)
                throws oracle.reports.RWException
Adds a file and its content to the CacheItem. If the file does not exist in the item, it creates the new file in the CacheItem. Otherwise, it appends the content for the file. This allows the client to call this method multiple times to upload the content piece by piece. Internally, the cache service adjusts the item size according to the size in bytes.
Parameters:
filename - Name of the file to be added or appended.
bytes - Byte array that holds content.
format - Format of the subitem.
main - Specifies whether this file is the main part of the CacheItem.

getMainFile

public java.lang.String getMainFile(org.omg.CORBA.ShortHolder format,
                                    org.omg.CORBA.LongHolder size,
                                    boolean full)
                             throws oracle.reports.RWException
Returns the main file name and format.
Parameters:
format - The format of the main file of the CacheItem.
Returns:
The main file name.

getAdditionalFiles

public java.lang.String[] getAdditionalFiles(oracle.reports.ShortArrayHolder formats,
                                             oracle.reports.LongLongArrayHolder sizes,
                                             boolean full)
                                      throws oracle.reports.RWException
Returns additional file names and formats.
Parameters:
formats - An array of formats for additional files.
sizes - An array of sizes for additional files.
full - Governs how the returned path is formatted. Either as a full directory path and file name, or only as a file name.
Returns:
An array of additional file names in the current CacheItem.

getContent

public java.io.InputStream getContent(java.lang.String filename)
                               throws oracle.reports.RWException
Returns file content from the cache.
Parameters:
filename - File name that holds the content.
Returns:
An input stream from which the contents can be read.

setContentReady

public void setContentReady()
                     throws oracle.reports.RWException
Specifies whether the content for the CacheItem is ready to be used.

isContentReady

public boolean isContentReady()
                       throws oracle.reports.RWException
Checks if the content for the CacheItem is ready to be used.
Returns:
True if the content is ready, false if it is not ready.

Oracle Reports
Java API Reference

Copyright © 1994, 2005 Oracle Corporation. All Rights Reserved.