Creating the JSP report viewer logic

The logic for a JSP report viewer is contained in a JSP that is called by the Data Management Portal. A typical implementation of a JSP report uses a Java™ helper class called TMSDataHelper to query the TADDM API. The results of the query are objects that can be manipulated using Java methods. For more information about the TADDM API and model, consult the SDK documentation in $COLLATION_HOME/sdk/doc.

The following example is a simple JSP report viewer implementation. Copy the following contents into a new file, $COLLATION_HOME/deploy-tomcat/reports.war/WEB-INF/view/custom.jsp if you use TADDM 7.3.0, or $COLLATION_HOME/apps/reports.war/WEB-INF/view/custom.jsp if you use TADDM, and later, and make the file readable and executable by the user that runs the TADDM server.

The following example shows the appServers.xsl style sheet used to transform the appServers.xml file generated by the shell script. The report displays application server names and their product versions. Copy the contents into a new file, $COLLATION_HOME/sdk/bin/appServers.xsl and make the file readable by the user that runs the TADDM server.
<%@ page language="java" %>
<%@ page import="com.collation.cdm.common.util.TMSDataHelper" %>
<%@ page import="java.lang.StringBuffer" %>
<%@ page import="com.collation.cdm.reports.util.ReportsParser" %>
<%@ page import="com.collation.cdm.common.util.TMSReportingTransformer" %>
<%@ page import="com.collation.platform.model.AttributeNotSetException" %>
<%@ page import="com.collation.platform.model.ModelObject" %>
<%@ page import="com.collation.platform.model.topology.sys.ComputerSystem" %>
<%@ page import="com.collation.platform.model.topology.process.BusinessProcess" %>
<%@ page import="com.collation.platform.model.topology.process.Activity" %>
<%@ taglib prefix="x" uri="" %>
<%@ taglib prefix="c" uri="" %>
<%@ page import="com.collation.platform.util.Props" %>
<%@ page import="java.util.ArrayList"%>
<%@ page import="com.collation.cdm.common.messages.CdmLocalizedMessages"%>
<%@ taglib uri="/WEB-INF/struts-bean.tld" prefix="bean" %>
<%@ taglib uri="/WEB-INF/struts-html.tld" prefix="html" %>
java.util.Locale locale = 
    if (null == session.getAttribute(org.apache.struts.Globals.LOCALE_KEY)) {
session.setAttribute(org.apache.struts.Globals.LOCALE_KEY, locale);
//TMSDataHelper is a utility class for running MQL queries against the DB
TMSDataHelper tms = new TMSDataHelper(locale);

//Perform a query for all ComputerSystems
ModelObject dataIn[] = tms.doModelObjectQuery("SELECT * FROM ComputerSystem",null);

  //Build an HTML report based on the API output
  StringBuffer output = new StringBuffer();
  output.append("<table border=\"1\">");
                int c = 0;
                int s = dataIn.length;
                while (cs) {
                        ComputerSystem tmo = (ComputerSystem)dataIn[c];
                        String csName = null;
                        String csLabel = null;
                        if (tmo.hasName()) {
                                try {
                                        csName = tmo.getName();
                                } catch (AttributeNotSetException e) {
                                        csName = "unknown";
                        if (tmo.hasSignature()) {
                                try {
                                        csLabel = tmo.getSignature();
                                } catch (AttributeNotSetException e) {
                                        csLabel = "";
                        output.append("<tr><td colspan=\"2\" bgcolor=\"#9999FF\">");
                        output.append("ComputerSystem" + "<br>");
                        output.append(" Name: " + csName + "<br>");
                        output.append("Signature: " + csLabel);
String bpstring = output.toString();
<h1>Sample JSP Report/h1>