Oracle Reports
Java API Reference
11g Release 1 (11.1.1)
E10775-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

java.lang.String getKey()
Returns the Item Key.

Returns:
The Item Key used to determine the number of cache hits.

getJob

Job getJob()
Returns the job owning this CacheItem.

Returns:
The job object that is associated with the CacheItem.

setJob

void setJob(Job job)
Sets the associated job for this CacheItem.

Parameters:
job - Associates the job object with the CacheItem.

setExpiration

void setExpiration(long expiration)
                   throws 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.
Throws:
RWException

getExpiration

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

boolean isExpired()
Checks if the CacheItem has expired.

Returns:
True if expired, false if not expired.

getFinishedTime

long getFinishedTime()
Returns the completed time of the CacheItem.

Returns:
The finished time stamp expressed in milliseconds.

setFinishedTime

void setFinishedTime(long finishedTime)
                     throws RWException
Sets the completion time for the CacheItem.

Parameters:
finishedTime - Completion time expressed in milliseconds.
Throws:
RWException

setCustomProperties

void setCustomProperties(java.util.Properties props)
                         throws RWException
Sets custom properties for the CacheItem.

Parameters:
props - Custom properties.
Throws:
RWException

clear

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

Throws:
RWException

isValid

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

long getSize()
             throws RWException
Returns the item size expressed in bytes.

Returns:
The size of the CacheItem (total size of all files in the item).
Throws:
RWException

addFile

void addFile(java.lang.String filename,
             short format,
             boolean main)
             throws 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.
Throws:
RWException

addContent

void addContent(java.lang.String filename,
                byte[] bytes,
                short format,
                boolean main)
                throws 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.
Throws:
RWException

getMainFile

java.lang.String getMainFile(org.omg.CORBA.ShortHolder format,
                             org.omg.CORBA.LongHolder size,
                             boolean full)
                             throws RWException
Returns the main file name and format.

Parameters:
format - The format of the main file of the CacheItem.
Returns:
The main file name.
Throws:
RWException

getAdditionalFiles

java.lang.String[] getAdditionalFiles(oracle.reports.ShortArrayHolder formats,
                                      oracle.reports.LongLongArrayHolder sizes,
                                      boolean full)
                                      throws 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.
Throws:
RWException

getContent

java.io.InputStream getContent(java.lang.String filename)
                               throws 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.
Throws:
RWException

setContentReady

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

Throws:
RWException

isContentReady

boolean isContentReady()
                       throws 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.
Throws:
RWException

Oracle Reports
Java API Reference

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