<html>
<head>
<title>TADDM Launcher</title>
<%@page import="com.collation.proxy.api.client.CMDBApi"%>
<%@page import="com.collation.proxy.api.client.ApiConnection"%>
<%@page import="com.collation.proxy.api.client.ApiSession"%>
<%@page import="com.collation.platform.model.ModelObject"%>
<%@page import="com.collation.platform.model.Guid"%>
<%@page import="com.ibm.cdb.api.ApiFactory"%>

<%
String TADDM_SERVER = "ismtaddm.tivlab.raleigh.ibm.com";
String USER = "administrator";
String PASSWORD = "collation";
String url = null;

try
{
%>
Connecting to the API....<br>
<%
ApiConnection connection = ApiFactory.getInstance().getApiConnection (TADDM_SERVER, -1, null, false);

ApiSession apiSession = ApiFactory.getInstance().getSession (connection, USER, PASSWORD, ApiSession.DEFAULT_VERSION);

    CMDBApi api = apiSession.createCMDBApi ();
   
    String name = request.getParameter ("name");
%>
Name: <%=name%>
<%

String mql = "select guid from ComputerSystem where name =='" + name + "'";
%>

Query: <%=mql%>


<%
ModelObject[] objects = api.find (mql, 1, null, null);  
Guid guid = objects[0].getGuid ();
    url = "http://" + TADDM_SERVER + ":9430/cdm/servlet/LICServlet?guid=" + guid;
%>
URL: <%= url %>
<%   
    }
    catch (Exception exception)
    {
%>
Exception: <%=exception%>
<%
    }
%>
<meta http-equiv="Refresh" content="1; URL=<%=url%>">
</head>
<body>
</body>
</html>