Actuate BIRT Viewer Reference : Configuring Actuate BIRT Viewer : Configuring a BIRT Viewer Java Extension
 
Configuring a BIRT Viewer Java Extension
The BIRT Design Engine API provides the IBirtViewerExtension, IBirtViewerContext, IBirtViewerOp, and IBirtViewer Session Java interfaces to extend the functionality of BIRT Viewer. Classes implementing these interfaces are associated with the BIRT Viewer web application when they are added in the birtviewer-extension.xml configuration file. Its location is:
<context root>\WEB-INF\birtviewer-extension.xml
For example, to enable myIVExtension.jar to operate on BIRT Viewer, add an entry to birtviewer-extension.xml as follows:
<?xml version="1.0" encoding="UTF-8" ?>
<BirtWebViewerExtension>
<!-- Class name for Interactive viewer extension -->
<InteractiveViewer>com.actuate.sample.MyIvExtension
</InteractiveViewer>
</BirtWebViewerExtension>
Save the compiled code archive to the <context root>\WEB-INF\lib folder for the BIRT Viewer web application and restart the application to enable the custom interface. The interfaces are part of the com.actuate.birtviewer.extension package of the BIRT Design Engine API.
The IBirtViewerExtension interface defines the event handler methods that activate implemented code, as follows:
package com.actuate.birtviewer.extension;
 
public interface IBirtViewerExtension{
 
// Event handler that runs when a design changes
void afterDesignChange( IBirtViewerContext context, IBirtViewerOp operation, ReportDesignHandle designHandle );
 
// Event handler after design get opened.
void afterDesignOpen( IBirtViewerContext context, ReportDesignHandle designHandle );
 
// Event handler that runs when a design is saved
void afterDesignSave( IBirtViewerContext context, IBirtViewerOp operation, ReportDesignHandle designHandle, String path );
 
//Event handler that runs when viewer creates a new session object
void afterViewerSessionStart( IBirtViewerContext context );
 
// Event handler that runs before a design change occurs
void beforeDesignChange( IBirtViewerContext context, IBirtViewerOp operation, ReportDesignHandle designHandle );
 
// Event handler that runs before a design opens
void beforeDesignOpen( IBirtViewerContext context, String path );
 
// Event handler that runs before a design is saved
boolean beforeDesignSave( IBirtViewerContext context, IBirtViewerOp operation, ReportDesignHandle designHandle, String path );
 
// Event handler before soap response get sent back.
void beforeResponse( IBirtViewerContext context, IBirtViewerOp operation, GetUpdatedObjectsResponse response );
 
// Triggered when session object gets destroyed.
void beforeViewerSessionClose( IBirtViewerSession session );
}
The IBirtViewerContext interface defines methods that retrieve information from the HTTP session, as follows:
package com.actuate.birtviewer.extension;
 
public interface IBirtViewerContext {
 
// Gets the base URL for the viewer
String getAppBaseUrl( );
 
// Gets reportlet id/bookmark if user is working on a reportlet.
String getReportletId( );
 
// Gets the extended session object
IBirtViewerSession getSession( );
 
// Gets the current user name
String getUserName( );
 
// Gets the volume profile name
String getVolumeProfile( );
 
// Gets the resource folder name
String getVolumeResourceFolder( );
}
The IBirtViewerOp interface defines methods that retrieve information from the extended session for BIRT Viewer, as follows:
package com.actuate.birtviewer.extension;
 
public interface IBirtViewerOp {
 
// Gets column ids if target element is a table
String[] getColumnIIds( );
 
// Gets the operation name
String getName( );
 
// Gets the target element instance ids
String[] getTargetIIds( );
 
// Get target element type
String getTargetType( );
}
The IBirtViewerSession interface defines methods that retrieve and set a session from the extended session for BIRT Viewer, as follows:
package com.actuate.birtviewer.extension;
 
public interface IBirtViewerSession {
 
// Check whether key exists.
boolean containsKey( String key );
 
//Get attribute from session.
Object getAttribute( String key );
 
//Set attribute into session.
void setAttribute( String key, Object attribute );
}