|

3. Integration
3.1. Building
the Cache class
To compile your Cache
class, you need to have the rwrun.jar
in your classpath. The rwrun.jar file is in the $ORACLE_HOME/reports/jlib
directory. If you are using Oracle9i JDeveloper (Oracle9iDS)
just add the Reports Runtime library to your project
The complete size
cache example used in this tutorial is available in the
resources section.
3.2. Deploying
the classes on your server
To deploy the cache
classes on your server, you can either:
- Deploy Java classes
- Deploy a JAR file.
3.2.1. Deploy Java
Classes
If you are running
a Reports Server version 9.0.2.0.4 or lower, you should:
- Create a classes
directory in your $ORACLE_HOME/reports/
directory
- Copy your classes
to this new directory ($ORACLE_HOME/reports/classes)
If you are running
a Reports Server version 9.0.2.0.5 or higher, you should copy
your classes to the $ORACLE_HOME/reports/jlib/classes
directory.
3.2.2. Deploy a
JAR file
If you packaged your
classes in a JAR file, you need to manually modify the class
path to point to the JAR file.
The Java class plath
of your Report Server depends on the way that you use the server
: In-Process or Stand-Alone. You can find more information in
chapter Specifying an In-Process Server of Publishing Reports to the Web Using Oracle9iAS Reports
Services manual.
The In-Process server
configuration is the default. The In-Process server enables
faster response time, since it reduces the communication expense
between processes and consequently increases response times.
In this context, the Reports Server starts automatically, whenever
it receives the first request from the client via the Reports
Servlet (rwservlet) or a Reports JSP.
If you configure
the server as a Stand-Alone server you should start it manually
with the rwserver command line. In this context, Reports Server
and the application server processes are independent. You can
use this configuration when debugging your reports extension,
stopping and starting the Reports Server without any effect
on your application server.
If you are using
the "In-Process" server (the class path used by Oracle9i
Reports is the OC4J path).
- Copy the JAR file
in a directory, often we use the $ORACLE_HOME/reports/jlib
directory to store Oracle9i Reports related JAR files.
- Open the OC4J
configuration file $ORACLE_HOME/j2ee/<instance_name>/config/server.xml.
The <instance_name>
represents the name of the OC4J where the reports are
executing, by default in Oracle9iDS the instance
is Oracle9iDS and
in Oracle9iAS it is OC4J_BI_Form
- Add the JAR file
to the class path using this XML entry, for example if you
put the JAR file under $ORACLE_HOME/reports/jlib
directory
<library path="../../../reports/jlib/SizeCache.jar"
/>
If you are using
the "Stand-Alone" server:
- Copy the JAR file
to the $ORACLE_HOME/reports/jlib
directory
- Add file address
$ORACLE_HOME/reports/jlib/SizeCache.jar
to the REPORTS_CLASSPATH environment variable. On Windows
the REPORTS_CLASSPATH is in the registry. On unix you can
modify the REPORTS_CLASSPATH in the $ORACLE_HOME/bin/reports.sh
file.
3.3. Registering the new cache
To register the new
cache, add an XML entry for the cache plug-in in the Reports
Server configuration file.
Open the Reports
Server configuration file ($ORACLE_HOME/reports/conf/rep_<your
server>.conf), and add a new XML entry.
For example, in
the size cache example, the entry looks like this:
<cache class="oracle.reports.plugin.cache.size.SizeCache"> <property name="cacheSize" value="<max_cache_size>"/> <property name="cacheDir" value="<your_cache_directory>"/> <property name="maxCacheFileNumber" value="<max_number_of_cache_files>"/> </cache>
The cache tag has
one attribute:
- class
contains the complete class name of the cache plugin.
If your cache needs
some specific parameters you can use the property tag to create
name-value pairs. The parameters used by the size cache are:
- cacheSize:
maximum size of the cache you want to allow.
- cacheDir:
path of your cache directory - the default value is <ORACLE_HOME>/reports/cache
- maxCacheFileNumber:
maximum number of files you want to allow in the cache.
3.4. Using your new cache
Now your new size
cache is deployed and registered with your Reports Server. The
cache will now be managed on the basis of "biggest file
size" logic. That means, whenever the cache size or number
of files in the cache exceeds the parameters you specify in
the server.conf file, the biggest 5 files will be deleted from
the cache directory.

|