|
i-net Clear Reports | |||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||
java.lang.Objectcom.inet.report.cache.Cache
public abstract class Cache
This class implements an Engine Data Cache. The typical usage is:
Properties props = new Properties();
props.put( "report", "report1.rpt" );
props.put( "prompt0", "abc" );
Cache cache = Cache.getCache();
ReportCacheKey key = cache.getKey(props);
cache.getPageAndWait( key, 12, 5 * 60 * 1000 );
| Field Summary | |
|---|---|
static int |
TYPE_DATABASE
Use a database as cache medium. |
static int |
TYPE_EXTERNAL_DATABASE
Use a database as cache medium. |
static int |
TYPE_HARDDISK
Use harddisk as cache medium. |
static int |
TYPE_MEMORY
Use memory as cache medium (default cache type). |
| Method Summary | |
|---|---|
void |
addEngine(Engine engine,
ReportCacheKey key)
Save a rendered Engine in the cache. |
ReportCacheKey |
createKey(java.util.Properties props)
This method is calling the method getKey() of the current EngineFactory only. |
ReportCacheKey |
createKey(java.util.Properties props,
PropertiesChecker checker,
java.lang.Object req)
This method is calling the method getKey() of the current EngineFactory only. |
ReportCacheKey |
createKey(java.util.Properties props,
PropertiesChecker checker,
EngineFactory factory,
java.lang.Object req)
This method calls the method EngineFactory.getKey(Properties). |
abstract void |
delete(java.lang.String report)
Delete all reports with the name from the cache. |
abstract void |
delete(ReportCacheKey key)
Removes one report from the cache. |
abstract boolean |
exists(ReportCacheKey key)
Verify if a ReportCacheKey exists in the cache. |
static Cache |
getCache()
Returns the singleton Cache instance. |
static EngineFactory |
getEngineFactory()
Get the current EngineFactory. |
java.lang.Throwable |
getFailureCause(ReportCacheKey key)
Returns the cause for the failure of the report. |
ReportCacheKey |
getKey(java.util.Properties props)
Create a ReportCacheKey and start rendering if report does not exist in the Cache. |
ReportCacheKey |
getKey(java.util.Properties props,
PropertiesChecker checker,
java.lang.Object req)
Create a ReportCacheKey and start rendering if report does not exist in the Cache. |
abstract ReportCacheKey |
getKey(java.util.Properties props,
PropertiesChecker checker,
EngineFactory factory,
java.lang.Object req)
Create a ReportCacheKey and start rendering if report does not exist in the Cache. |
byte[] |
getPageAndWait(ReportCacheKey key,
int page)
The method returns the binary data of pages of a report. |
abstract byte[] |
getPageAndWait(ReportCacheKey key,
int page,
int timeout)
The method returns the binary data of pages of a report. |
int |
getPageCountAndWait(ReportCacheKey key)
Returns the total count of pages and blocks until the rendering is finished. |
abstract int |
getPageCountAndWait(ReportCacheKey key,
int timeout)
Returns the total count of pages and blocks until the rendering is finished. |
abstract ReportCacheKey[] |
getReports()
Returns all reports that are currently listed in the Cache. |
int |
getTotalPageSizeAndWait(ReportCacheKey key)
Returns the total size of all pages in bytes and blocks
until the rendering is finished. |
abstract int |
getTotalPageSizeAndWait(ReportCacheKey key,
int timeout)
Returns the total size of all pages in bytes and blocks
until the rendering is finished. |
int |
getType()
Returns the defined Cache type. |
boolean |
isFailedReport(ReportCacheKey key)
Returns whether the report was rendered without errors. |
boolean |
isFinishWrittenToStore(ReportCacheKey key)
Asserts, whether the report is completly written into the store of the cache or not. |
boolean |
isFinished(ReportCacheKey key)
Checks whether the rendering process is finished. |
abstract boolean |
isPageLimitExceeded(ReportCacheKey key)
Check if the rendering of the report ran into a page limit. |
boolean |
isScheduleReport(ReportCacheKey key)
Shows if the report is a schedule report. |
static boolean |
isTypeSchedulerCache()
This method indicates whether the cache stores reports come from i-net Scheduler only. |
abstract void |
lock(ReportCacheKey key)
Lock the data in the cache and prevent it from modification. |
void |
resetCacheTimeout(ReportCacheKey key)
Causes the timeout for the entry behind this key to be manually restarted. |
static void |
setEngineFactory(EngineFactory engineFactory)
You can override the default EngineFactory. |
abstract void |
setSchedule(ReportCacheKey key,
boolean schedule)
Defines a report in the Cache as a schedule report. |
abstract void |
unlock(ReportCacheKey key)
Unlock the data in the cache. |
| Field Detail |
|---|
public static final int TYPE_MEMORY
public static final int TYPE_DATABASE
public static final int TYPE_HARDDISK
public static final int TYPE_EXTERNAL_DATABASE
ExternalDBCache,
Constant Field Values| Method Detail |
|---|
public static Cache getCache()
public static void setEngineFactory(EngineFactory engineFactory)
engineFactory - the EngineFactory to set.
java.lang.IllegalArgumentException - If the supplied EngineFactory is null.EngineFactory,
getEngineFactory()public static EngineFactory getEngineFactory()
EngineFactory,
setEngineFactory(com.inet.report.cache.EngineFactory)
public ReportCacheKey getKey(java.util.Properties props)
throws ReportException
props - The default Engine Factory need the parameter "report"
ReportException - e.g. if the reportfile does not existsetEngineFactory(EngineFactory),
EngineFactory,
ReportCacheKey,
Engine
public ReportCacheKey getKey(java.util.Properties props,
PropertiesChecker checker,
java.lang.Object req)
throws ReportException
props - The default Engine Factory needs the parameter "report"checker - an implementation of PropertiesChecker for validate the Properties. Can be null.req - The HTTP servlet request, either null or HttpServletRequest
ReportException - e.g. if the reportfile does not existsetEngineFactory(EngineFactory),
EngineFactory,
ReportCacheKey,
PropertiesChecker
public abstract ReportCacheKey getKey(java.util.Properties props,
PropertiesChecker checker,
EngineFactory factory,
java.lang.Object req)
throws ReportException
EngineFactory instance to be used instead of the system-wide
instance set in setEngineFactory(EngineFactory).
props - The default Engine Factory needs the parameter "report"checker - an implementation of PropertiesChecker for validate the Properties. Can be null.factory - EngineFactory instance to use instead of the system-wide one set in setEngineFactory(EngineFactory).req - The HTTP servlet request, either null or HttpServletRequest
ReportException - e.g. if the reportfile does not existsetEngineFactory(EngineFactory),
EngineFactory,
ReportCacheKey,
PropertiesChecker
public final byte[] getPageAndWait(ReportCacheKey key,
int page)
throws PageOutOfRangeException,
KeyNotFoundException,
ReportException
getPageCountAndWait(ReportCacheKey, int)
Exception Object.
The method Cache.isFailedReport(ReportCacheKey) will give the information whether report execution failed
key - the unique key to find the report in the Cachepage - the page number of the page, from which the binary data are returned. The first page has page number 1.
Exception Object.
PageOutOfRangeException - If the page is out of range after the report is finish rendered.
KeyNotFoundException - If the key does not exist in the cache.
This can occur if the key has received its timeout and was removed from the cache.
You can change the cache timeout in the Cache Config Dialog.
ReportException - e.g. if using DBCache and something went wrong with database connectiongetKey(Properties),
getKey(Properties, PropertiesChecker, Object),
getPageAndWait(ReportCacheKey, int, int),
isFailedReport(ReportCacheKey)
public abstract byte[] getPageAndWait(ReportCacheKey key,
int page,
int timeout)
throws PageOutOfRangeException,
KeyNotFoundException,
ReportException
getPageCountAndWait(ReportCacheKey, int)
Exception Object.
The method Cache.isFailedReport(ReportCacheKey) will give the information whether report execution failed
key - the unique key to find the report in the Cachepage - the page number of the page, from which the binary data are returned. The first page has page number 1.timeout - the maximum time that is wait in milli seconds, 0 means unlimited wait.
Exception Object.
PageOutOfRangeException - If the page is out of range after the report is finish rendered.
KeyNotFoundException - If the key does not exist in the cache.
This can occur if the key has received its timeout and was removed from the cache.
You can change the cache timeout in the Cache Config Dialog.
ReportException - e.g. if using DBCache and something went wrong with database connectiongetKey(Properties),
getKey(Properties, PropertiesChecker, Object),
isFailedReport(ReportCacheKey)
public final int getPageCountAndWait(ReportCacheKey key)
throws KeyNotFoundException,
ReportException
key - the key of the report
KeyNotFoundException - If the key does not exist in the cache.
This can occur if the key has received its timeout and was removed from the cache.
You can change the cache timeout in the Cache Config Dialog.
ReportException - e.g. if using DBCache and something went wrong with database connectiongetPageAndWait(ReportCacheKey, int, int)
public abstract int getPageCountAndWait(ReportCacheKey key,
int timeout)
throws KeyNotFoundException,
ReportException
key - the key of the reporttimeout - the maximum time that is wait in milli seconds, 0 means unlimited wait.
KeyNotFoundException - If the key does not exist in the cache.
This can occur if the key has received its timeout and was removed from the cache.
You can change the cache timeout in the Cache Config Dialog.
ReportException - e.g. if using DBCache and something went wrong with database connectiongetPageAndWait(ReportCacheKey, int, int)
public final int getTotalPageSizeAndWait(ReportCacheKey key)
throws KeyNotFoundException,
ReportException
bytes and blocks
until the rendering is finished.
key - the key of the report
KeyNotFoundException - If the key does not exist in the cache.
This can occur if the key has received its timeout and was removed from the cache.
You can change the cache timeout in the Cache Config Dialog.
ReportException - e.g. if using DBCache and something went wrong with database connectiongetPageAndWait(ReportCacheKey, int, int),
getPageCountAndWait(ReportCacheKey, int)
public abstract int getTotalPageSizeAndWait(ReportCacheKey key,
int timeout)
throws KeyNotFoundException,
ReportException
bytes and blocks
until the rendering is finished.
key - the key of the reporttimeout - the maximum time that is wait in milli seconds, 0 means unlimited wait.
KeyNotFoundException - If the key does not exist in the cache.
This can occur if the key has received its timeout and was removed from the cache.
You can change the cache timeout in the Cache Config Dialog.
ReportException - e.g. if using DBCache and something went wrong with database connectiongetPageAndWait(ReportCacheKey, int, int),
getPageCountAndWait(ReportCacheKey,int)
public abstract boolean isPageLimitExceeded(ReportCacheKey key)
throws KeyNotFoundException,
ReportException
key - the key of the report
KeyNotFoundException - If the key does not exist in the cache. This can occur if the key has received its timeout and was
removed from the cache. You can change the cache timeout in the Cache Config Dialog.
ReportException - e.g. if using DBCache and something went wrong with database connection
public abstract void lock(ReportCacheKey key)
throws KeyNotFoundException,
ReportException
key - the key of the report
KeyNotFoundException - If the key does not exist in the cache.
This can occur if the key has received its timeout and was removed from the cache.
You can change the cache timeout in the Cache Config Dialog.
ReportException - e.g. if using DBCache and something went wrong with database connectionunlock(ReportCacheKey)
public abstract void unlock(ReportCacheKey key)
throws KeyNotFoundException,
ReportException
key - the key of the report
KeyNotFoundException - If the key does not exist in the cache.
This can occur if the key has received its timeout and was removed from the cache.
You can change the cache timeout in the Cache Config Dialog.
ReportException - e.g. if using DBCache and something went wrong with database connectionlock(ReportCacheKey),
lock(ReportCacheKey)
public void addEngine(Engine engine,
ReportCacheKey key)
throws ReportException
Cache cache = Cache.getCache();
ReportCacheKey key = cache.createKey(props);
if(!cache.exists(key)){
Engine engine = new Engine();
engine.setReportName( props.get( "report" );
engine.execute();
cache.addEngine( engine, key );
}
cache.getPageAndWait( key, 12 );
engine - the executed enginekey - the key created for that report
ReportException - e.g. if there already exists a report in the cache for
the key. Possible solution is to call Cache.createKey() with an additional
Property or call Cache.delete() with reportname.public abstract boolean exists(ReportCacheKey key)
key - the key of the report
getKey(Properties),
getKey(Properties, PropertiesChecker, Object)
public ReportCacheKey createKey(java.util.Properties props)
throws ReportException
props - Properties for the report
ReportException - will be thrown if no value for the key "report" can be found in PropertiesgetKey(Properties, PropertiesChecker, Object),
createKey(Properties, PropertiesChecker, Object),
EngineFactory
public ReportCacheKey createKey(java.util.Properties props,
PropertiesChecker checker,
java.lang.Object req)
throws ReportException
props - Properties for the reportchecker - an implementation of PropertiesChecker for validate the Properties. Can be null.req - The HTTP servlet request, either null or HttpServletRequest
ReportException - If an error occured while checking the supplied
properties by the PropertiesChecker or while creating the key in the
EngineFactory of the cache.getKey(Properties, PropertiesChecker, Object),
EngineFactory
public ReportCacheKey createKey(java.util.Properties props,
PropertiesChecker checker,
EngineFactory factory,
java.lang.Object req)
throws ReportException
EngineFactory.getKey(Properties). Note it does not start the render job yet.
This method also gives you the opportunity to provide your own EngineFactory instead of the system-wide one set in
setEngineFactory(EngineFactory).
props - Properties for the reportchecker - an implementation of PropertiesChecker for validate the Properties. Can be null.factory - EngineFactory instance to use (can be different than the system-wide one set in setEngineFactory(EngineFactory)req - The HTTP servlet request, either null or HttpServletRequest
ReportException - If an error occured while checking the supplied
properties by the PropertiesChecker or while creating the key in the
EngineFactory of the cache.getKey(Properties, PropertiesChecker, Object),
EngineFactory
public abstract void delete(java.lang.String report)
throws ReportException
report - name of the report
ReportException - e.g. if using DBCache and something went wrong with
database connection
public abstract void delete(ReportCacheKey key)
throws ReportException
key - The ReportCacheKey of the report.
ReportException - e.g. if using DBCache and something went wrong with database connectionlock(ReportCacheKey),
unlock(ReportCacheKey)
public boolean isFinished(ReportCacheKey key)
throws ReportException
key - This key is checked
true if report is completely rendered.false if report is not completely rendered.ReportException - e.g. if using DBCache and something went wrong with database connectionisFinishWrittenToStore(ReportCacheKey),
getPageAndWait(ReportCacheKey, int, int),
getPageCountAndWait(ReportCacheKey, int),
getTotalPageSizeAndWait(ReportCacheKey, int)
public abstract ReportCacheKey[] getReports()
throws ReportException
ReportException - If an error has occurred during cache request
public boolean isFinishWrittenToStore(ReportCacheKey key)
throws ReportException,
KeyNotFoundException
true if you want to skip your application after writing a report in the cache.
key - The ReportCacheKey for the report
true if the report for that key is completely written into the store or an error occur.
KeyNotFoundException - will be thrown if no report for that key exists in the cache.
ReportException - e.g. if using DBCache and something went wrong with database connectionisFinished(ReportCacheKey),
isFailedReport(ReportCacheKey)
public abstract void setSchedule(ReportCacheKey key,
boolean schedule)
throws ReportException
schedule - To set or reset a report as schedule report.key - The key belongs to the report.
java.lang.UnsupportedOperationException - If the Cache is the MemoryCache. It is supported in the harddisk cache and database cache.
ReportException - If there is no respective report in the cache.getType()
public boolean isScheduleReport(ReportCacheKey key)
throws ReportException
key - The key belongs to the report.
ReportException - If there is no respective report in the cache.
public boolean isFailedReport(ReportCacheKey key)
throws ReportException
getFailureCause(ReportCacheKey).
key - The key belongs to the report.
ReportException - If there is no respective report in the cache.
public java.lang.Throwable getFailureCause(ReportCacheKey key)
throws ReportException
finished. If the report execution
failed this will return the cause for the failure. If the report
execution finished without any error this will return null.
key - The key identifying the report.
null if
the report rendered successfully.
ReportException - If there is no respective report in the cache.public int getType()
cache.type
TYPE_MEMORY,
TYPE_DATABASE,
TYPE_HARDDISK,
TYPE_EXTERNAL_DATABASE,
isTypeSchedulerCache()public static boolean isTypeSchedulerCache()
public void resetCacheTimeout(ReportCacheKey key)
If there is no entry associated with the given key, this will not restart creation of the entry.
key - Key of the entry whose cache timeout is to be reset.
|
i-net Clear Reports | |||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||