# Oracle Business Intelligence Beans Sample

## Using the BI Beans Catalog

### Overview

The BI Beans Catalog sample application demonstrates how to use various catalog components and APIs in a java client application.

The `BICatalog` class extends `BIFrame`. The `BICatalog` class provides a menu with access to a simple connection dialog, which prompts a user for security credentials. It then makes the two connections described above. Once the connections are established, the following functionality is available through the various menu items:

1. Setup a sample user folder structure with different levels of access (Tools/Create Folder Structures).

2. Display the BI Beans Explorer, which allows you to navigate the folders of the BI Beans Catalog (Tools/Explorer).

3. Export the contents of the BI Beans Catalog to an XML file on the file system (Tools/Export Catalog to file).

4. Open any of the components stored in the BI Beans Catalog and display them (File/Open).

5. Open and display the XML representation of any of the components in the BI Beans Catalog (File/Open as XML).

6. On connect/disconnect, store the user settings in the BI Beans Catalog. The 6 most recently used (MRU) items and the current path are stored in the user settings. The MRUs are also available as separate menu items.

### Setup Requirements

#### To register this sample in the BI Beans Catalog

In order to load and save the user settings you will need to register this sample component in the BI Beans Catalog. To do this, use SQL*Plus to connect to the schema in which the BI Beans Catalog is installed and register the Application settings type with the following sql commands:

insert into bism_object_types values(9001, 'ApplicationSettings');
commit;

You must also make sure that the run time settings are pointing to a remote BI Beans Catalog.

#### To copy objects to the BI Beans Catalog for this sample:

In order to make use of the Open and Open XML menu items, you must have saved or copied some components like graphs and crosstabs in the referenced BI Beans Catalog using the other samples such as the Using the Local and Remote Catalog sample.

#### To create the folders structures for this sample:

Run the sample and select Tools - Create Folders Structures from the application menu. This will create a sample folder structure and allow user settings to be saved for the users: anna, chadwick, henry and yekesa. Note: the newly installed users have no access to any of the folders other then the newly installed folders. As the Schema user using the BI Beans Explorer, you can either grant the users access to other folders or copy some components to their folders. Afterwards, you can connect using the other users such as anna, chadwick, henry and yekesa. Since the sample applicatioin is not authenticating the user, you can leave the password blank for the other users.

### Code Highlights

See the following methods for interesting usage of BI Beans Catalog / Persistence service API. The method

`protected void createFolderStructures()`

creates the sample folder structures. The method shows how to create folders and how to set access to the folders. The method

`protected void showExplorer()`

shows how to create and display the BI Beans Explorer. The method

`protected String openObjectChooser()`

demonstrates how to create, initialize, and display the `ObjectChooser`. The resulting selected object name is then used in the method

`protected void openComponent(String name, boolean showXML)`

to explain how to actually load the component from the BI Beans Catalog and display it or its XML. Exporting the contents of the BI Beans Catalog is demonstrated using the method

`protected void exportCatalog()`

See the overloaded methods

`protected void connect()
protected void disconnect()
`

for an example of how to load (`lookup`) and save (`bind`) a component, when the user's settings are loaded and saved.

Also examine

`public class ApplicationSettings`

because it is a good example of how to make your own components capable of being stored in the BI Beans Catalog. The methods

`public String getXMLAsString()
public boolean setXMLAsString(String xml)`

are especially interesting because they show how to use XML and the Oracle XML parser to set and get state from the settings component.

Copyright © 2004 Oracle Corporation. All Rights Reserved.