About the serverContext object
The BIRT engine uses an object called serverContext to store information about the iHub environment. The serverContext methods and properties are defined in the IServerContext interface. The container for the serverContext object is the application context object appContext. The appContext object stores objects and values that are used in all phases of report generation and presentation.
The appContext object, in turn, is a property of the reportContext object. This object stores information associated with the instance of the report that is being generated or viewed. For example, the reportContext object stores information about report parameters, global variables, report output format, locale, the request that runs the report, and the application context. The report context class defines methods for setting and retrieving these properties. Every event handler in a BIRT report has access to the reportContext object. In Java, the report context object is an argument to all event-handler methods.
To call a method to retrieve iHub environment information, the code must reflect the relationships between the serverContext, appContext, and reportContext objects.
The following JavaScript code snippet shows how to call the getVolumeName( ) method to retrieve the name of the iHub volume in which a report runs:
reportContext.getAppContext().get("ServerContext").getVolumeName()
The following example shows the equivalent code snippet in Java:
IServerContext scontext;
scontext = (IServerContext) reportContext.getAppContext().get("ServerContext");
scontext.getVolumeName();