use of org.pentaho.di.trans.step.StepStatus in project pentaho-kettle by pentaho.
the class SubtransExecutor method updateStatuses.
private synchronized void updateStatuses(Trans subtrans) {
List<StepMetaDataCombi> steps = subtrans.getSteps();
for (StepMetaDataCombi combi : steps) {
StepStatus stepStatus;
if (statuses.containsKey(combi.stepname)) {
stepStatus = statuses.get(combi.stepname);
stepStatus.updateAll(combi.step);
} else {
stepStatus = new StepStatus(combi.step);
statuses.put(combi.stepname, stepStatus);
}
stepStatus.setStatusDescription(StepExecutionStatus.STATUS_RUNNING.getDescription());
}
}
use of org.pentaho.di.trans.step.StepStatus in project pentaho-kettle by pentaho.
the class TransPainter method drawStepPerformanceTable.
private void drawStepPerformanceTable(StepMeta stepMeta) {
if (stepMeta == null) {
return;
}
// draw optional performance indicator
if (trans != null) {
Point pt = stepMeta.getLocation();
if (pt == null) {
pt = new Point(50, 50);
}
Point screen = real2screen(pt.x, pt.y);
int x = screen.x;
int y = screen.y;
List<StepInterface> steps = trans.findBaseSteps(stepMeta.getName());
// draw mouse over performance indicator
if (trans.isRunning()) {
if (stepMeta.isSelected()) {
// determine popup dimensions up front
int popupX = x;
int popupY = y;
int popupWidth = 0;
int popupHeight = 1;
gc.setFont(EFont.SMALL);
Point p = gc.textExtent("0000000000");
int colWidth = p.x + MINI_ICON_MARGIN;
int rowHeight = p.y + MINI_ICON_MARGIN;
int titleWidth = 0;
// calculate max title width to get the colum with
String[] titles = TransPainter.getPeekTitles();
for (String title : titles) {
Point titleExtent = gc.textExtent(title);
titleWidth = Math.max(titleExtent.x + MINI_ICON_MARGIN, titleWidth);
popupHeight += titleExtent.y + MINI_ICON_MARGIN;
}
popupWidth = titleWidth + 2 * MINI_ICON_MARGIN;
// determine total popup width
popupWidth += steps.size() * colWidth;
// determine popup position
popupX = popupX + (iconsize - popupWidth) / 2;
popupY = popupY - popupHeight - MINI_ICON_MARGIN;
// draw the frame
gc.setForeground(EColor.DARKGRAY);
gc.setBackground(EColor.LIGHTGRAY);
gc.setLineWidth(1);
gc.fillRoundRectangle(popupX, popupY, popupWidth, popupHeight, 7, 7);
// draw the title columns
// gc.setBackground(EColor.BACKGROUND);
// gc.fillRoundRectangle(popupX, popupY, titleWidth+MINI_ICON_MARGIN, popupHeight, 7, 7);
gc.setBackground(EColor.LIGHTGRAY);
gc.drawRoundRectangle(popupX, popupY, popupWidth, popupHeight, 7, 7);
for (int i = 0, barY = popupY; i < titles.length; i++) {
if (i % 2 == 1) {
gc.setBackground(EColor.BACKGROUND);
} else {
gc.setBackground(EColor.LIGHTGRAY);
}
gc.fillRoundRectangle(popupX + 1, barY + 1, popupWidth - 2, rowHeight, 7, 7);
barY += rowHeight;
}
// draw the header column
int rowY = popupY + MINI_ICON_MARGIN;
int rowX = popupX + MINI_ICON_MARGIN;
gc.setForeground(EColor.BLACK);
gc.setBackground(EColor.BACKGROUND);
for (int i = 0; i < titles.length; i++) {
if (i % 2 == 1) {
gc.setBackground(EColor.BACKGROUND);
} else {
gc.setBackground(EColor.LIGHTGRAY);
}
gc.drawText(titles[i], rowX, rowY);
rowY += rowHeight;
}
// draw the values for each copy of the step
gc.setBackground(EColor.LIGHTGRAY);
rowX += titleWidth;
for (StepInterface step : steps) {
rowX += colWidth;
rowY = popupY + MINI_ICON_MARGIN;
StepStatus stepStatus = new StepStatus(step);
String[] fields = stepStatus.getPeekFields();
for (int i = 0; i < fields.length; i++) {
if (i % 2 == 1) {
gc.setBackground(EColor.BACKGROUND);
} else {
gc.setBackground(EColor.LIGHTGRAY);
}
drawTextRightAligned(fields[i], rowX, rowY);
rowY += rowHeight;
}
}
}
}
}
}
use of org.pentaho.di.trans.step.StepStatus in project pentaho-kettle by pentaho.
the class SlaveServerTransStatus method getResult.
public Result getResult(TransMeta transMeta) {
Result result = new Result();
for (StepStatus stepStatus : stepStatusList) {
// If the
result.setNrErrors(result.getNrErrors() + stepStatus.getErrors() + (result.isStopped() ? 1 : 0));
if (stepStatus.getStepname().equals(transMeta.getTransLogTable().getStepnameRead())) {
result.increaseLinesRead(stepStatus.getLinesRead());
}
if (stepStatus.getStepname().equals(transMeta.getTransLogTable().getStepnameInput())) {
result.increaseLinesInput(stepStatus.getLinesInput());
}
if (stepStatus.getStepname().equals(transMeta.getTransLogTable().getStepnameWritten())) {
result.increaseLinesWritten(stepStatus.getLinesWritten());
}
if (stepStatus.getStepname().equals(transMeta.getTransLogTable().getStepnameOutput())) {
result.increaseLinesOutput(stepStatus.getLinesOutput());
}
if (stepStatus.getStepname().equals(transMeta.getTransLogTable().getStepnameUpdated())) {
result.increaseLinesUpdated(stepStatus.getLinesUpdated());
}
if (stepStatus.getStepname().equals(transMeta.getTransLogTable().getStepnameRejected())) {
result.increaseLinesRejected(stepStatus.getLinesRejected());
}
if (stepStatus.isStopped()) {
result.setStopped(true);
result.setResult(false);
}
}
return result;
}
use of org.pentaho.di.trans.step.StepStatus in project pentaho-kettle by pentaho.
the class TransGridDelegate method refreshView.
private void refreshView() {
boolean insert = true;
int nrSteps = -1;
int totalSteps = -1;
if (transGridView == null || transGridView.isDisposed()) {
return;
}
if (refresh_busy) {
return;
}
List<StepMeta> selectedSteps = new ArrayList<StepMeta>();
if (showSelectedSteps) {
selectedSteps = transGraph.trans.getTransMeta().getSelectedSteps();
}
int topIdx = transGridView.getTable().getTopIndex();
refresh_busy = true;
Table table = transGridView.table;
long time = new Date().getTime();
long msSinceLastUpdate = time - lastUpdateView;
if (transGraph.trans != null && !transGraph.trans.isPreparing() && msSinceLastUpdate > UPDATE_TIME_VIEW) {
lastUpdateView = time;
nrSteps = transGraph.trans.nrSteps();
totalSteps = nrSteps;
if (hideInactiveSteps) {
nrSteps = transGraph.trans.nrActiveSteps();
}
StepExecutionStatus[] stepStatusLookup = transGraph.trans.getTransStepExecutionStatusLookup();
boolean[] isRunningLookup = transGraph.trans.getTransStepIsRunningLookup();
int sortColumn = transGridView.getSortField();
boolean sortDescending = transGridView.isSortingDescending();
int[] selectedItems = transGridView.getSelectionIndices();
if (table.getItemCount() != nrSteps) {
table.removeAll();
} else {
insert = false;
}
if (nrSteps == 0 && table.getItemCount() == 0) {
new TableItem(table, SWT.NONE);
refresh_busy = false;
return;
}
int nr = 0;
for (int i = 0; i < totalSteps; i++) {
StepInterface baseStep = transGraph.trans.getRunThread(i);
// See if the step is selected & in need of display
//
boolean showSelected;
if (showSelectedSteps) {
if (selectedSteps.size() == 0) {
showSelected = true;
} else {
showSelected = false;
for (StepMeta stepMeta : selectedSteps) {
if (baseStep.getStepMeta().equals(stepMeta)) {
showSelected = true;
break;
}
}
}
} else {
showSelected = true;
}
//
if (showSelected && (hideInactiveSteps && (isRunningLookup[i] || stepStatusLookup[i] != StepExecutionStatus.STATUS_FINISHED)) || (!hideInactiveSteps && stepStatusLookup[i] != StepExecutionStatus.STATUS_EMPTY)) {
TableItem ti = null;
if (insert) {
ti = new TableItem(table, SWT.NONE);
} else {
ti = table.getItem(nr);
}
if (ti == null) {
continue;
}
String num = "" + (i + 1);
if (ti.getText(0).length() < 1) {
ti.setText(0, num);
}
if (ti.getText(0).length() > 0) {
Integer tIndex = Integer.parseInt(ti.getText(0));
tIndex--;
baseStep = transGraph.trans.getRunThread(tIndex);
}
StepStatus stepStatus = new StepStatus(baseStep);
String[] fields = stepStatus.getTransLogFields();
// screen!
for (int f = 1; f < fields.length; f++) {
if (!fields[f].equalsIgnoreCase(ti.getText(f))) {
ti.setText(f, fields[f]);
}
}
// Error lines should appear in red:
if (baseStep.getErrors() > 0) {
ti.setBackground(GUIResource.getInstance().getColorRed());
}
nr++;
Collection<StepStatus> stepStatuses = baseStep.subStatuses();
int subIndex = 1;
for (StepStatus status : stepStatuses) {
String[] subFields = status.getTransLogFields(baseStep.getStatus().getDescription());
subFields[1] = " " + subFields[1];
TableItem subItem = new TableItem(table, SWT.NONE);
subItem.setText(0, num + "." + subIndex++);
for (int f = 1; f < subFields.length; f++) {
subItem.setText(f, subFields[f]);
}
}
}
}
for (int i = 0; i < table.getItems().length; i++) {
TableItem item = table.getItem(i);
item.setForeground(GUIResource.getInstance().getColorBlack());
if (!item.getBackground().equals(GUIResource.getInstance().getColorRed())) {
item.setBackground(i % 2 == 0 ? GUIResource.getInstance().getColorWhite() : GUIResource.getInstance().getColorBlueCustomGrid());
}
}
// default
if (table.getItemCount() > 0 && (sortColumn != 0 || !sortDescending)) {
transGridView.sortTable(sortColumn, sortDescending, false);
}
// if (updateRowNumbers) { transGridView.setRowNums(); }
transGridView.optWidth(true);
if (selectedItems != null && selectedItems.length > 0) {
transGridView.setSelection(selectedItems);
}
// transGridView.getTable().setTopIndex(topIdx);
if (transGridView.getTable().getTopIndex() != topIdx) {
transGridView.getTable().setTopIndex(topIdx);
}
} else {
// We need at least one table-item in a table!
if (table.getItemCount() == 0) {
new TableItem(table, SWT.NONE);
}
}
refresh_busy = false;
}
use of org.pentaho.di.trans.step.StepStatus in project pentaho-kettle by pentaho.
the class GetTransStatusServlet method doGet.
/**
* <div id="mindtouch">
* <h1>/kettle/transStatus</h1>
* <a name="GET"></a>
* <h2>GET</h2>
* <p>Retrieves status of the specified transformation. Status is returned as HTML or XML output
* depending on the input parameters. Status contains information about last execution of the transformation.</p>
* <p><b>Example Request:</b><br />
* <pre function="syntax.xml">
* GET /kettle/transStatus/?name=dummy-trans&xml=Y
* </pre>
*
* </p>
* <h3>Parameters</h3>
* <table class="pentaho-table">
* <tbody>
* <tr>
* <th>name</th>
* <th>description</th>
* <th>type</th>
* </tr>
* <tr>
* <td>name</td>
* <td>Name of the transformation to be used for status generation.</td>
* <td>query</td>
* </tr>
* <tr>
* <td>xml</td>
* <td>Boolean flag which defines output format <code>Y</code> forces XML output to be generated.
* HTML is returned otherwise.</td>
* <td>boolean, optional</td>
* </tr>
* <tr>
* <td>id</td>
* <td>Carte id of the transformation to be used for status generation.</td>
* <td>query, optional</td>
* </tr>
* <tr>
* <td>from</td>
* <td>Start line number of the execution log to be included into response.</td>
* <td>integer, optional</td>
* </tr>
* </tbody>
* </table>
*
* <h3>Response Body</h3>
* <table class="pentaho-table">
* <tbody>
* <tr>
* <td align="right">element:</td>
* <td>(custom)</td>
* </tr>
* <tr>
* <td align="right">media types:</td>
* <td>text/xml, text/html</td>
* </tr>
* </tbody>
* </table>
* <p> Response XML or HTML response containing details about the transformation specified.
* If an error occurs during method invocation <code>result</code> field of the response
* will contain <code>ERROR</code> status.</p>
*
* <p><b>Example Response:</b></p>
* <pre function="syntax.xml">
* <?xml version="1.0" encoding="UTF-8"?>
* <transstatus>
* <transname>dummy-trans</transname>
* <id>c56961b2-c848-49b8-abde-76c8015e29b0</id>
* <status_desc>Stopped</status_desc>
* <error_desc/>
* <paused>N</paused>
* <stepstatuslist>
* <stepstatus><stepname>Dummy (do nothing)</stepname>
* <copy>0</copy><linesRead>0</linesRead>
* <linesWritten>0</linesWritten><linesInput>0</linesInput>
* <linesOutput>0</linesOutput><linesUpdated>0</linesUpdated>
* <linesRejected>0</linesRejected><errors>0</errors>
* <statusDescription>Stopped</statusDescription><seconds>0.0</seconds>
* <speed>-</speed><priority>-</priority><stopped>Y</stopped>
* <paused>N</paused>
* </stepstatus>
* </stepstatuslist>
* <first_log_line_nr>0</first_log_line_nr>
* <last_log_line_nr>37</last_log_line_nr>
* <result>
* <lines_input>0</lines_input>
* <lines_output>0</lines_output>
* <lines_read>0</lines_read>
* <lines_written>0</lines_written>
* <lines_updated>0</lines_updated>
* <lines_rejected>0</lines_rejected>
* <lines_deleted>0</lines_deleted>
* <nr_errors>0</nr_errors>
* <nr_files_retrieved>0</nr_files_retrieved>
* <entry_nr>0</entry_nr>
* <result>Y</result>
* <exit_status>0</exit_status>
* <is_stopped>Y</is_stopped>
* <log_channel_id>10e2c832-07da-409a-a5ba-4b90a234e957</log_channel_id>
* <log_text/>
* <result-file></result-file>
* <result-rows></result-rows>
* </result>
* <logging_string><![CDATA[H4sIAAAAAAAAADMyMDTRNzTUNzJRMDSyMrC0MjFV0FVIKc3NrdQtKUrMKwbyXDKLCxJLkjMy89IViksSi0pSUxTS8osUwPJARm5iSWZ+nkI0kq5YXi4AQVH5bFoAAAA=]]></logging_string>
* </transstatus>
* </pre>
*
* <h3>Status Codes</h3>
* <table class="pentaho-table">
* <tbody>
* <tr>
* <th>code</th>
* <th>description</th>
* </tr>
* <tr>
* <td>200</td>
* <td>Request was processed.</td>
* </tr>
* <tr>
* <td>500</td>
* <td>Internal server error occurs during request processing.</td>
* </tr>
* </tbody>
* </table>
* </div>
*/
public void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
if (isJettyMode() && !request.getContextPath().startsWith(CONTEXT_PATH)) {
return;
}
if (log.isDebug()) {
logDebug(BaseMessages.getString(PKG, "TransStatusServlet.Log.TransStatusRequested"));
}
String transName = request.getParameter("name");
String id = request.getParameter("id");
boolean useXML = "Y".equalsIgnoreCase(request.getParameter("xml"));
int startLineNr = Const.toInt(request.getParameter("from"), 0);
response.setStatus(HttpServletResponse.SC_OK);
if (useXML) {
response.setContentType("text/xml");
response.setCharacterEncoding(Const.XML_ENCODING);
} else {
response.setCharacterEncoding("UTF-8");
response.setContentType("text/html;charset=UTF-8");
}
// ID is optional...
//
Trans trans;
CarteObjectEntry entry;
if (Utils.isEmpty(id)) {
// get the first transformation that matches...
//
entry = getTransformationMap().getFirstCarteObjectEntry(transName);
if (entry == null) {
trans = null;
} else {
id = entry.getId();
trans = getTransformationMap().getTransformation(entry);
}
} else {
// Take the ID into account!
//
entry = new CarteObjectEntry(transName, id);
trans = getTransformationMap().getTransformation(entry);
}
if (trans != null) {
if (useXML) {
try {
OutputStream out = null;
byte[] data = null;
String logId = trans.getLogChannelId();
boolean finishedOrStopped = trans.isFinishedOrStopped();
boolean sendResultXmlWithStatus = "Y".equalsIgnoreCase(request.getParameter(SEND_RESULT));
boolean dontUseCache = sendResultXmlWithStatus;
if (finishedOrStopped && (data = cache.get(logId, startLineNr)) != null && !dontUseCache) {
response.setContentLength(XML_HEADER.length + data.length);
out = response.getOutputStream();
out.write(XML_HEADER);
out.write(data);
out.flush();
} else {
int lastLineNr = KettleLogStore.getLastBufferLineNr();
String logText = getLogText(trans, startLineNr, lastLineNr);
response.setContentType("text/xml");
response.setCharacterEncoding(Const.XML_ENCODING);
SlaveServerTransStatus transStatus = new SlaveServerTransStatus(transName, entry.getId(), trans.getStatus());
transStatus.setFirstLoggingLineNr(startLineNr);
transStatus.setLastLoggingLineNr(lastLineNr);
transStatus.setLogDate(trans.getLogDate());
for (int i = 0; i < trans.nrSteps(); i++) {
StepInterface baseStep = trans.getRunThread(i);
if ((baseStep.isRunning()) || baseStep.getStatus() != StepExecutionStatus.STATUS_EMPTY) {
StepStatus stepStatus = new StepStatus(baseStep);
transStatus.getStepStatusList().add(stepStatus);
}
}
// The log can be quite large at times, we are going to putIfAbsent a base64 encoding around a compressed
// stream
// of bytes to handle this one.
String loggingString = HttpUtil.encodeBase64ZippedString(logText);
transStatus.setLoggingString(loggingString);
// transStatus.setLoggingUncompressedSize( logText.length() );
// Also set the result object...
//
transStatus.setResult(trans.getResult());
// Is the transformation paused?
//
transStatus.setPaused(trans.isPaused());
// Send the result back as XML
//
String xml = transStatus.getXML(sendResultXmlWithStatus);
data = xml.getBytes(Charset.forName(Const.XML_ENCODING));
out = response.getOutputStream();
response.setContentLength(XML_HEADER.length + data.length);
out.write(XML_HEADER);
out.write(data);
out.flush();
if (finishedOrStopped && logId != null && !dontUseCache) {
cache.put(logId, xml, startLineNr);
}
}
response.flushBuffer();
} catch (KettleException e) {
throw new ServletException("Unable to get the transformation status in XML format", e);
}
} else {
PrintWriter out = response.getWriter();
int lastLineNr = KettleLogStore.getLastBufferLineNr();
response.setContentType("text/html;charset=UTF-8");
out.println("<HTML>");
out.println("<HEAD>");
out.println("<TITLE>" + BaseMessages.getString(PKG, "TransStatusServlet.KettleTransStatus") + "</TITLE>");
if (EnvUtil.getSystemProperty(Const.KETTLE_CARTE_REFRESH_STATUS, "N").equalsIgnoreCase("Y")) {
out.println("<META http-equiv=\"Refresh\" content=\"10;url=" + convertContextPath(CONTEXT_PATH) + "?name=" + URLEncoder.encode(transName, "UTF-8") + "&id=" + URLEncoder.encode(id, "UTF-8") + "\">");
}
out.println("<META http-equiv=\"Content-Type\" content=\"text/html; charset=UTF-8\">");
out.println("</HEAD>");
out.println("<BODY>");
out.println("<H1>" + Encode.forHtml(BaseMessages.getString(PKG, "TransStatusServlet.TopTransStatus", transName)) + "</H1>");
try {
out.println("<table border=\"1\">");
out.print("<tr> <th>" + BaseMessages.getString(PKG, "TransStatusServlet.TransName") + "</th> <th>" + BaseMessages.getString(PKG, "TransStatusServlet.CarteObjectId") + "</th> <th>" + BaseMessages.getString(PKG, "TransStatusServlet.TransStatus") + "</th> </tr>");
out.print("<tr>");
out.print("<td>" + Encode.forHtml(transName) + "</td>");
out.print("<td>" + Encode.forHtml(id) + "</td>");
out.print("<td>" + Encode.forHtml(trans.getStatus()) + "</td>");
out.print("</tr>");
out.print("</table>");
out.print("<p>");
// Get the transformation image
//
// out.print("<a href=\"" + convertContextPath(GetTransImageServlet.CONTEXT_PATH) + "?name=" +
// URLEncoder.encode(transName, "UTF-8") + "&id="+id+"\">"
// + BaseMessages.getString(PKG, "TransStatusServlet.GetTransImage") + "</a>");
Point max = trans.getTransMeta().getMaximum();
max.x += 20;
max.y += 20;
out.print("<iframe height=\"" + max.y + "\" width=\"" + max.x + "\" seamless src=\"" + convertContextPath(GetTransImageServlet.CONTEXT_PATH) + "?name=" + URLEncoder.encode(transName, "UTF-8") + "&id=" + URLEncoder.encode(id, "UTF-8") + "\"></iframe>");
out.print("<p>");
if ((trans.isFinished() && trans.isRunning()) || (!trans.isRunning() && !trans.isPreparing() && !trans.isInitializing())) {
out.print("<a href=\"" + convertContextPath(StartTransServlet.CONTEXT_PATH) + "?name=" + URLEncoder.encode(transName, "UTF-8") + "&id=" + URLEncoder.encode(id, "UTF-8") + "\">" + BaseMessages.getString(PKG, "TransStatusServlet.StartTrans") + "</a>");
out.print("<p>");
out.print("<a href=\"" + convertContextPath(PrepareExecutionTransServlet.CONTEXT_PATH) + "?name=" + URLEncoder.encode(transName, "UTF-8") + "&id=" + URLEncoder.encode(id, "UTF-8") + "\">" + BaseMessages.getString(PKG, "TransStatusServlet.PrepareTrans") + "</a><br>");
} else if (trans.isRunning()) {
out.print("<a href=\"" + convertContextPath(PauseTransServlet.CONTEXT_PATH) + "?name=" + URLEncoder.encode(transName, "UTF-8") + "&id=" + URLEncoder.encode(id, "UTF-8") + "\">" + BaseMessages.getString(PKG, "PauseStatusServlet.PauseResumeTrans") + "</a><br>");
out.print("<a href=\"" + convertContextPath(StopTransServlet.CONTEXT_PATH) + "?name=" + URLEncoder.encode(transName, "UTF-8") + "&id=" + URLEncoder.encode(id, "UTF-8") + "\">" + BaseMessages.getString(PKG, "TransStatusServlet.StopTrans") + "</a><br>");
out.print("<a href=\"" + convertContextPath(StopTransServlet.CONTEXT_PATH) + "?name=" + URLEncoder.encode(transName, "UTF-8") + "&id=" + URLEncoder.encode(id, "UTF-8") + "&inputOnly=Y" + "\">" + BaseMessages.getString(PKG, "TransStatusServlet.SafeStopTrans") + "</a>");
out.print("<p>");
}
out.print("<a href=\"" + convertContextPath(CleanupTransServlet.CONTEXT_PATH) + "?name=" + URLEncoder.encode(transName, "UTF-8") + "&id=" + URLEncoder.encode(id, "UTF-8") + "\">" + BaseMessages.getString(PKG, "TransStatusServlet.CleanupTrans") + "</a>");
out.print("<p>");
out.println("<table border=\"1\">");
out.print("<tr> <th>" + BaseMessages.getString(PKG, "TransStatusServlet.Stepname") + "</th> <th>" + BaseMessages.getString(PKG, "TransStatusServlet.CopyNr") + "</th> <th>" + BaseMessages.getString(PKG, "TransStatusServlet.Read") + "</th> <th>" + BaseMessages.getString(PKG, "TransStatusServlet.Written") + "</th> <th>" + BaseMessages.getString(PKG, "TransStatusServlet.Input") + "</th> <th>" + BaseMessages.getString(PKG, "TransStatusServlet.Output") + "</th> " + "<th>" + BaseMessages.getString(PKG, "TransStatusServlet.Updated") + "</th> <th>" + BaseMessages.getString(PKG, "TransStatusServlet.Rejected") + "</th> <th>" + BaseMessages.getString(PKG, "TransStatusServlet.Errors") + "</th> <th>" + BaseMessages.getString(PKG, "TransStatusServlet.Active") + "</th> <th>" + BaseMessages.getString(PKG, "TransStatusServlet.Time") + "</th> " + "<th>" + BaseMessages.getString(PKG, "TransStatusServlet.Speed") + "</th> <th>" + BaseMessages.getString(PKG, "TransStatusServlet.prinout") + "</th> </tr>");
for (int i = 0; i < trans.nrSteps(); i++) {
StepInterface step = trans.getRunThread(i);
if ((step.isRunning()) || step.getStatus() != StepExecutionStatus.STATUS_EMPTY) {
StepStatus stepStatus = new StepStatus(step);
boolean snif = false;
if (step.isRunning() && !step.isStopped() && !step.isPaused()) {
snif = true;
String sniffLink = " <a href=\"" + convertContextPath(SniffStepServlet.CONTEXT_PATH) + "?trans=" + URLEncoder.encode(transName, "UTF-8") + "&id=" + URLEncoder.encode(id, "UTF-8") + "&lines=50" + "©nr=" + step.getCopy() + "&type=" + SniffStepServlet.TYPE_OUTPUT + "&step=" + URLEncoder.encode(step.getStepname(), "UTF-8") + "\">" + Encode.forHtml(stepStatus.getStepname()) + "</a>";
stepStatus.setStepname(sniffLink);
}
out.print(stepStatus.getHTMLTableRow(snif));
}
}
out.println("</table>");
out.println("<p>");
out.print("<a href=\"" + convertContextPath(GetTransStatusServlet.CONTEXT_PATH) + "?name=" + URLEncoder.encode(transName, "UTF-8") + "&id=" + URLEncoder.encode(id, "UTF-8") + "&xml=y\">" + BaseMessages.getString(PKG, "TransStatusServlet.ShowAsXml") + "</a><br>");
out.print("<a href=\"" + convertContextPath(GetStatusServlet.CONTEXT_PATH) + "\">" + BaseMessages.getString(PKG, "TransStatusServlet.BackToStatusPage") + "</a><br>");
out.print("<p><a href=\"" + convertContextPath(GetTransStatusServlet.CONTEXT_PATH) + "?name=" + URLEncoder.encode(transName, "UTF-8") + "&id=" + URLEncoder.encode(id, "UTF-8") + "\">" + BaseMessages.getString(PKG, "TransStatusServlet.Refresh") + "</a>");
// Put the logging below that.
out.println("<p>");
out.println("<textarea id=\"translog\" cols=\"120\" rows=\"20\" " + "wrap=\"off\" name=\"Transformation log\" readonly=\"readonly\">" + Encode.forHtml(getLogText(trans, startLineNr, lastLineNr)) + "</textarea>");
out.println("<script type=\"text/javascript\"> ");
out.println(" translog.scrollTop=translog.scrollHeight; ");
out.println("</script> ");
out.println("<p>");
} catch (Exception ex) {
out.println("<p>");
out.println("<pre>");
out.println(Encode.forHtml(Const.getStackTracker(ex)));
out.println("</pre>");
}
out.println("<p>");
out.println("</BODY>");
out.println("</HTML>");
}
} else {
PrintWriter out = response.getWriter();
if (useXML) {
out.println(new WebResult(WebResult.STRING_ERROR, BaseMessages.getString(PKG, "TransStatusServlet.Log.CoundNotFindSpecTrans", transName)));
} else {
out.println("<H1>" + Encode.forHtml(BaseMessages.getString(PKG, "TransStatusServlet.Log.CoundNotFindTrans", transName)) + "</H1>");
out.println("<a href=\"" + convertContextPath(GetStatusServlet.CONTEXT_PATH) + "\">" + BaseMessages.getString(PKG, "TransStatusServlet.BackToStatusPage") + "</a><p>");
}
}
}
Aggregations