Retrieving Objects

In a Java-client application or applet, you can retrieve objects through the persistence object chooser. In an HTML-client application, you can use the thin Explorer beans to navigate through the BI Beans Catalog, but you must write code to retrieve an object.

To retrieve an object that has been stored in the BI Beans Catalog, you call the lookup method of a BIContext that contains the object.

The folder does not have to be the current folder. You can call the lookup method of a folder that is closer to the root folder. In this case, however, you must specify the path name of the component, relative to the folder whose lookup method you call.

Example: Retrieving a graph

The following code retrieves a graph MySalesBarGraph from a folder named MyGraphsFolder. This example uses an existing instance of a graph.

Because an existing graph is likely to have a Query associated with it, retrieving the graph will also retrieve the Query. A retrieved Query needs a QueryManager object. This example provides a QueryManager, as well as the existing graph instance, to the lookup method.


// ctxRoot is the root folderBIContext ctxMyGraphsFolder = null; // mySalesBarGraph has already been instantiated // session is the BISession for this application // a ManagerFactory has been set on session // through a configuration file ManagerFactory factory = session.getManagerFactory(); QueryManager qManager = factory.lookupManager(ManagerFactory.QUERY_MANAGER, "MyQueryManager", true); Hashtable reference = new Hashtable(); reference.put(Query.QUERY_MANAGER, qManager); try{   ctxMyGraphsFolder = (BIContext) ctxRoot.lookup("MyGraphsFolder");   mySalesBarGraph = (Graph) ctxMyGraphsFolder.lookup("MySalesBarGraph", mySalesBarGraph, reference); } catch (NamingException ne){   ne.printStackTrace(); }