Before programming with the Catalog Bean, you need to import the Catalog Bean classes by adding the following import statements to the beginning of your program. The first two import statements are added to import the Catalog Bean, and exception classes. The third is added to import the connection description class.
|
Then you need to create an instance of the Catalog Bean. The constructor of the Catalog Bean has no parameter. After the object has been created, you should then set the report home to the object.
JRCatalog jrCatalog = new JRCatalog();
jrCatalog.setReportHome("c:\\jreport") ;
With the Catalog Bean object, you can manipulate and access many catalogs. You do not need to create a bean for each catalog.
You can load an existing catalog or create a new catalog. After a catalog has been created or loaded, you can manipulate it before closing it. The closeCatalog method closes a catalog, releases resource and clears up the temporary file. Also, the program requires using the closeCatalog method when operations on it have been completed.