Shutting down the ODA

After the ODA generates the appropriate content, Business Object Wizard displays Step 6, Save Business Objects dialog box (Step 6). This dialog box allows users to specify how to save the generated content. As part of this step, Business Object Wizard terminates the ODA. The ODA runtime calls the terminate() method to perform clean-up tasks and to release resources for the ODA. For example, if your ODA has connected to a data source in its init() method, it should disconnect from this source in its terminate() method. In the ODK API, the terminate() method for an ODA is part of the low-level ODA base class, ODKAgentBase. It is inherited by the ODA base class, ODKAgentBase2, and in turn by your ODA class.

Figure 75 shows a sample terminate() method for an ODA that closes a database connection and performs clean-up on objects that accessed the database.

Figure 75. A sample ODA terminate() method

public void terminate()
 {
    specList = null;
 
   //close connection
    if(db != null)
       db.disconnect();
 
   if(dbAnalizer != null)
       dbAnalizer.cleanup();
  }
 

Copyright IBM Corp. 1997, 2003