BIServlet is a simple servlet that demonstrates how a BI application can set up a connection to Oracle9i 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.
If you have not already done so, you must perform several installation
and configuration tasks, then open the workspace servlet\Servlet.jws
under the samples
directory within JDeveloper. All the necessary
files for this sample can be found in the bootstrap.jpr
project
under the Servlet.jws
workspace.
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 retrieve the QueryManager using the ManagerFactory.
m_queryManager = (QueryManager)m_biSession.getManagerFactory().lookupManager(ManagerFactory.QUERY_MANAGER,
null, true);
The disconnect
method in the sample shows how to disconnect from Oracle9i
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 loading 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" );
}
To run the BIServlet example within JDeveloper, simply right-click on BIServlet.java under bootstrap.jpr, and choose Run BIServlet.java. When the application appears in a browser, enter the username and password of the user that owns the BI Beans Catalog (e.g. BIBCAT).
![]() |
|
---|---|
Copyright © 2002, 2003 Oracle. All Rights Reserved. |
Oracle is a registered trademark of Oracle Corporation and/or its affiliates. Other names may be trademarks of their respective owners. |