All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.purej.vminspect.html.MBeansInvokeOperationView Maven / Gradle / Ivy

// Copyright (c), 2013, adopus consulting GmbH Switzerland, all rights reserved.
package com.purej.vminspect.html;

import java.io.IOException;
import com.purej.vminspect.data.MBeanData;
import com.purej.vminspect.data.MBeanOperation;
import com.purej.vminspect.data.MBeanParameter;

/**
 * Displays the view to invoke an operation of an MBean.
 *
 * @author Stefan Mueller
 */
public class MBeansInvokeOperationView extends AbstractMBeansView {
  private final MBeanData _mbean;
  private final int _mbOpIdx;
  private final MBeanOperation _operation;
  private final ConfirmState _confirm;
  private final String[] _parameters;

  /**
   * Creates a new instance of this view.
   */
  public MBeansInvokeOperationView(StringBuilder output, MBeanData mbean, int mbOpIdx, MBeanOperation operation, ConfirmState confirmState,
      String[] parameters) {
    super(output);
    _mbean = mbean;
    _mbOpIdx = mbOpIdx;
    _operation = operation;
    _confirm = confirmState;
    _parameters = parameters;
  }

  @Override
  public void render() throws IOException {
    // Write the mbean title:
    writeln("

" + img("icons/beans-24.png", "MBean") + " MBean: " + htmlEncode(_mbean.getName().getObjectNameString()) + "

"); if (_confirm.isNow()) { writeln("
Please confirm the MBeans operation invocation!

"); } // Write the form with a table: writeln("

"); HtmlTable table = new HtmlTable("MBean Operation"); table.nextRow(); table.addValue(img("icons/flash-16.png", "MBean Operation") + " Operation     "); table.addValue("" + htmlEncode(_operation.getName()) + ""); table.nextRow("Description", htmlEncode(_operation.getDescription())); table.nextRow("Impact", htmlEncode(_operation.getImpact().name())); table.nextRow("Return Type", htmlEncode(_operation.getReturnType())); for (int i = 0; i < _operation.getParameters().length; i++) { table.nextRow("
", ""); MBeanParameter parameter = _operation.getParameters()[i]; table.nextRow("Parameter", "" + parameter.getName() + ""); table.nextRow("Description", parameter.getDescription()); table.nextRow("Type", parameter.getType()); if (_confirm.isNow()) { table.nextRow("Value", _parameters[i] + ""); } else { table.nextRow("Value", ""); } } table.nextRow("
", ""); table.nextRow(""); String okAction = _confirm.isNext() ? "mbOpInvokeConfirm" : "mbOpInvoke"; table.addValueRight(""); table.endTable(); writeln(""); writeln(""); writeln(""); writeln(""); writeln("
"); } }




© 2015 - 2025 Weber Informatics LLC | Privacy Policy