Oracle Business Intelligence Beans Sample

Connecting to Oracle OLAP and the BI Beans Catalog

Overview

BIServlet is a simple servlet that demonstrates how a BI application can set up a connection to OLAP (the source of the business data for the application) and to the BI Beans Catalog (where object definitions, such as crosstabs and graphs, are saved).

The first page displayed by the servlet prompts a user for security credentials. It then makes the two connections described above. The second page reports the status of the connections. The user can disconnect the connections described above on the second page of the servlet.

This sample is used by the other samples that require the connections.

Code Highlights

The connect method in the sample shows how connections to the Oracle OLAP Services and the BI Beans Catalog are created.  The following section provides a walkthrough and explanations of the code fragments.

Before it sets up the connections, an application must first create a new user session.  This is accomplished by creating a new BISession object.  A BISession can take the name of a BI Configuration file as an argument.  A BI Configuration file is an XML file that contains the definition of the connections.

 m_session = new BISession(m_configFile);

In addition, an application must specify the name of the application user. 

 m_session.setBIUser(new BIUser(userName));

Note that this information could also be specified within the BI Configuration file.

After a session has been created, an application can retrieve the MetadataManager that is already associated with the specified connections through the ManagerFactory (since the connection definitions are already defined in the BI Configuration file).

 m_metadataManager = (MetadataManager)m_biSession.getManagerFactory().lookupManager(ManagerFactory.METADATA_MANAGER, null, true);

The application can use the ManagerFactory to retrieve the QueryManager.

 m_queryManager = (QueryManager)m_biSession.getManagerFactory().lookupManager(ManagerFactory.QUERY_MANAGER, null, true);

The disconnect method in the sample shows how to disconnect from OLAP and from the BI Beans Catalog. 

All that the application has to do is to disconnect the current user session by calling the disconnect method on the BISession object.

 m_session.disconnect();

For applications using thin beans, the MetadataManager needs to create the ThinCrosstab, ThinGraph and ThinTable when it loads the Crosstab, Graph and Table objects from the BI Beans Catalog. The ObjectFactory instance of the MetadataManager is initialized to use the thin classes when loading the objects from the BI Beans Catalog.

 ObjectFactory objectFactory = m_metadataManager.getObjectFactory(false);
 if(objectFactory != null) {
  objectFactory.setObjectInstanceClassName(PersistableConstants.CROSSTAB,
  "oracle.dss.thin.beans.crosstab.ThinCrosstab" );
  objectFactory.setObjectInstanceClassName(PersistableConstants.GRAPH,
  "oracle.dss.thin.beans.graph.ThinGraph" );
  objectFactory.setObjectInstanceClassName(PersistableConstants.TABLE,
  "oracle.dss.thin.beans.table.ThinTable" );
 }


Copyright © 2004 Oracle Corporation.
All Rights Reserved.