javax.management.MBeanOperationInfo#INFO源码实例Demo

下面列出了javax.management.MBeanOperationInfo#INFO 实例代码,或者点击链接到github查看源代码,也可以在右侧发表评论。

源代码1 项目: wildfly-core   文件: PluggableMBeanServerImpl.java
private boolean isOperationReadOnly(ObjectName name, String operationName, String[] signature) {
    MBeanInfo info;
    try {
        info = getMBeanInfo(name, false, true);
    } catch (Exception e) {
        //This should not happen, just in case say it is not RO
        return false;
    }
    if (info == null) {
        //Default to not RO
        return false;
    }
    for (MBeanOperationInfo op : info.getOperations()) {
        if (op.getName().equals(operationName)) {
            MBeanParameterInfo[] params = op.getSignature();
            if (params.length != signature.length) {
                continue;
            }
            boolean same = true;
            for (int i = 0 ; i < params.length ; i++) {
                if (!params[i].getType().equals(signature[i])) {
                    same = false;
                    break;
                }
            }
            if (same) {
                return op.getImpact() == MBeanOperationInfo.INFO;
            }
        }
    }
    //Default to not RO
    return false;
}
 
源代码2 项目: kogito-runtimes   文件: KnowledgeBaseMonitoring.java
/**
 *  Initialize the open mbean metadata
 */
private void initOpenMBeanInfo() {
    OpenMBeanAttributeInfoSupport[] attributes = new OpenMBeanAttributeInfoSupport[4];
    OpenMBeanConstructorInfoSupport[] constructors = new OpenMBeanConstructorInfoSupport[1];
    OpenMBeanOperationInfoSupport[] operations = new OpenMBeanOperationInfoSupport[2];
    MBeanNotificationInfo[] notifications = new MBeanNotificationInfo[0];

    try {
        // Define the attributes 
        attributes[0] = new OpenMBeanAttributeInfoSupport(ATTR_ID,
                                                          "Knowledge Base Id",
                                                          SimpleType.STRING,
                                                          true,
                                                          false,
                                                          false);
        attributes[1] = new OpenMBeanAttributeInfoSupport(ATTR_SESSION_COUNT,
                                                          "Number of created sessions for this Knowledge Base",
                                                          SimpleType.LONG,
                                                          true,
                                                          false,
                                                          false);
        attributes[2] = new OpenMBeanAttributeInfoSupport(ATTR_GLOBALS,
                                                          "List of globals",
                                                           globalsTableType,
                                                           true,
                                                           false,
                                                           false );
        attributes[3] = new OpenMBeanAttributeInfoSupport( ATTR_PACKAGES,
                                                           "List of Packages",
                                                           new ArrayType( 1,
                                                                          SimpleType.STRING ),
                                                           true,
                                                           false,
                                                           false );
        //No arg constructor                
        constructors[0] = new OpenMBeanConstructorInfoSupport( "KnowledgeBaseMonitoringMXBean",
                                                               "Constructs a KnowledgeBaseMonitoringMXBean instance.",
                                                               new OpenMBeanParameterInfoSupport[0] );
        //Operations 
        OpenMBeanParameterInfo[] params = new OpenMBeanParameterInfoSupport[0];
        operations[0] = new OpenMBeanOperationInfoSupport( OP_START_INTERNAL_MBEANS,
                                                           "Creates, registers and starts all the dependent MBeans that allow monitor all the details in this KnowledgeBase.",
                                                           params,
                                                           SimpleType.VOID,
                                                           MBeanOperationInfo.INFO );
        operations[1] = new OpenMBeanOperationInfoSupport( OP_STOP_INTERNAL_MBEANS,
                                                           "Stops and disposes all the dependent MBeans that allow monitor all the details in this KnowledgeBase.",
                                                           params,
                                                           SimpleType.VOID,
                                                           MBeanOperationInfo.INFO );

        //Build the info 
        info = new OpenMBeanInfoSupport( this.getClass().getName(),
                                         "Knowledge Base Monitor MXBean",
                                         attributes,
                                         constructors,
                                         operations,
                                         notifications );
    } catch ( Exception e ) {
        e.printStackTrace();
    }
}
 
源代码3 项目: text-ui   文件: MBeanInfoRenderer.java
@Override
public LineRenderer renderer(Iterator<MBeanInfo> stream) {

  List<LineRenderer> renderers = new ArrayList<LineRenderer>();

  while (stream.hasNext()) {
    MBeanInfo info = stream.next();

    //
    TreeElement root = new TreeElement(info.getClassName());

    // Descriptor
    TableElement descriptor = new TableElement().
        overflow(Overflow.HIDDEN).
        rightCellPadding(1);
    Descriptor descriptorInfo = info.getDescriptor();
    if (descriptorInfo != null) {
      for (String fieldName : descriptorInfo.getFieldNames()) {
        String fieldValue = String.valueOf(descriptorInfo.getFieldValue(fieldName));
        descriptor.row(fieldName, fieldValue);
      }
    }

    // Attributes
    TableElement attributes = new TableElement().
        overflow(Overflow.HIDDEN).
        rightCellPadding(1).
        add(new RowElement().style(Decoration.bold.fg(Color.black).bg(Color.white)).add("NAME", "TYPE", "DESCRIPTION"));
    for (MBeanAttributeInfo attributeInfo : info.getAttributes()) {
      attributes.row(attributeInfo.getName(), attributeInfo.getType(), attributeInfo.getDescription());
    }

    // Operations
    TreeElement operations = new TreeElement("Operations");
    for (MBeanOperationInfo operationInfo : info.getOperations()) {
      TableElement signature = new TableElement().
          overflow(Overflow.HIDDEN).
          rightCellPadding(1);
      MBeanParameterInfo[] parameterInfos = operationInfo.getSignature();
      for (MBeanParameterInfo parameterInfo : parameterInfos) {
        signature.row(parameterInfo.getName(), parameterInfo.getType(), parameterInfo.getDescription());
      }
      TreeElement operation = new TreeElement(operationInfo.getName());
      String impact;
      switch (operationInfo.getImpact()) {
        case MBeanOperationInfo.ACTION:
          impact = "ACTION";
          break;
        case MBeanOperationInfo.INFO:
          impact = "INFO";
          break;
        case MBeanOperationInfo.ACTION_INFO:
          impact = "ACTION_INFO";
          break;
        default:
          impact = "UNKNOWN";
      }
      operation.addChild(new TableElement().
          add(
              new RowElement().add("Type: ", operationInfo.getReturnType()),
              new RowElement().add("Description: ", operationInfo.getDescription()),
              new RowElement().add("Impact: ", impact),
              new RowElement().add(new LabelElement("Signature: "), signature)
          )
      );

      operations.addChild(operation);
    }

    //
    root.addChild(
      new TableElement().leftCellPadding(1).overflow(Overflow.HIDDEN).
        row("ClassName", info.getClassName()).
        row("Description", info.getDescription()
      )
    );
    root.addChild(new TreeElement("Descriptor").addChild(descriptor));
    root.addChild(new TreeElement("Attributes").addChild(attributes));
    root.addChild(operations);

    //
    renderers.add(root.renderer());
  }




  return LineRenderer.vertical(renderers);
}
 
源代码4 项目: activemq-artemis   文件: QueueControl.java
@Operation(desc = "Returns the number of the messages in the queue", impact = MBeanOperationInfo.INFO)
long countMessages() throws Exception;
 
源代码5 项目: activemq-artemis   文件: ActiveMQServerControl.java
/**
 * Closes the consumer with the given id.
 */
@Operation(desc = "Closes the consumer with the id", impact = MBeanOperationInfo.INFO)
boolean closeConsumerWithID(@Parameter(desc = "The session ID", name = "sessionID") String sessionID,
                            @Parameter(desc = "The consumer ID", name = "ID") String ID) throws Exception;
 
源代码6 项目: activemq-artemis   文件: ActiveMQServerControl.java
@Operation(desc = "Search for Addresses", impact = MBeanOperationInfo.INFO)
String listAddresses(@Parameter(name = "options", desc = "Options") String options,
                     @Parameter(name = "pageNumber", desc = "Page Number") int page,
                     @Parameter(name = "pageSize", desc = "Page Size") int pageSize) throws Exception;
 
源代码7 项目: activemq-artemis   文件: ActiveMQServerControl.java
@Operation(desc = "Get a list of bindings associated with an address", impact = MBeanOperationInfo.INFO)
String listBindingsForAddress(@Parameter(name = "address", desc = "The address") String address) throws Exception;
 
源代码8 项目: activemq-artemis   文件: ActiveMQServerControl.java
@Operation(desc = "Search for Consumers", impact = MBeanOperationInfo.INFO)
String listConsumers(@Parameter(name = "options", desc = "Options") String options,
                     @Parameter(name = "pageNumber", desc = "Page Number") int page,
                     @Parameter(name = "pageSize", desc = "Page Size") int pageSize) throws Exception;
 
源代码9 项目: activemq-artemis   文件: ActiveMQServerControl.java
@Operation(desc = "Get roles for a specific address match", impact = MBeanOperationInfo.INFO)
Object[] getRoles(@Parameter(desc = "an address match", name = "addressMatch") String addressMatch) throws Exception;
 
源代码10 项目: activemq-artemis   文件: ActiveMQServerControl.java
@Operation(desc = "Get roles (as a JSON string) for a specific address match", impact = MBeanOperationInfo.INFO)
String getRolesAsJSON(@Parameter(desc = "an address match", name = "addressMatch") String addressMatch) throws Exception;
 
源代码11 项目: activemq-artemis   文件: ActiveMQServerControl.java
/**
 * Jon plugin doesn't recognize an Operation whose name is in
 * form getXXXX(), so add this one.
 */
@Operation(desc = "names of the diverts deployed on this server", impact = MBeanOperationInfo.INFO)
default String[] listDivertNames() {
   return getDivertNames();
}
 
源代码12 项目: activemq-artemis   文件: ActiveMQServerControl.java
/**
 * Lists the addresses of all the clients connected to this address.
 */
@Operation(desc = "List the client addresses", impact = MBeanOperationInfo.INFO)
String[] listRemoteAddresses() throws Exception;
 
源代码13 项目: activemq-artemis   文件: ActiveMQServerControl.java
/**
 * Lists the addresses of the clients connected to this address which matches the specified IP address.
 */
@Operation(desc = "List the client addresses which match the given IP Address", impact = MBeanOperationInfo.INFO)
String[] listRemoteAddresses(@Parameter(desc = "an IP address", name = "ipAddress") String ipAddress) throws Exception;
 
源代码14 项目: activemq-artemis   文件: ActiveMQServerControl.java
/**
 * Returns the names of the cluster-connections deployed on this server.
 */
@Operation(desc = "Names of the cluster-connections deployed on this server", impact = MBeanOperationInfo.INFO)
String[] getClusterConnectionNames();
 
源代码15 项目: activemq-artemis   文件: ActiveMQServerControl.java
/**
 * Closes all the connections of clients connected to this server which matches the specified IP address.
 */
@Operation(desc = "Closes all the consumer connections for the given messaging address", impact = MBeanOperationInfo.INFO)
boolean closeConsumerConnectionsForAddress(@Parameter(desc = "a messaging address", name = "address") String address) throws Exception;
 
源代码16 项目: activemq-artemis   文件: QueueControl.java
/**
 * Lists the message counter for this queue as a HTML table.
 */
@Operation(desc = "List the message counters as HTML", impact = MBeanOperationInfo.INFO)
String listMessageCounterAsHTML() throws Exception;
 
源代码17 项目: activemq-artemis   文件: QueueControl.java
/**
 * Lists the message counter for this queue.
 */
@Operation(desc = "List the message counters", impact = MBeanOperationInfo.INFO)
String listMessageCounter() throws Exception;
 
源代码18 项目: sis   文件: Supervisor.java
/**
 * Returns the operations impact, which is {@code INFO}.
 *
 * @return {@code INFO}.
 */
@Override
protected int getImpact(final MBeanOperationInfo info) {
    return MBeanOperationInfo.INFO;
}
 
源代码19 项目: activemq-artemis   文件: ActiveMQServerControl.java
/**
 * Lists details about all sessions.
 * The returned String is a JSON string containing details about each and every session, e.g.:
 * <pre>
 * [
 *   {
 *     "sessionID":"e71d61d7-2176-11e8-9057-a0afbd82eaba",
 *     "creationTime":1520365520212,
 *     "consumerCount":1,
 *     "principal":"myUser"
 *   },
 *   {
 *     "sessionID":"e718a6e6-2176-11e8-9057-a0afbd82eaba",
 *     "creationTime":1520365520191,
 *     "consumerCount":0,
 *     "principal":"guest"
 *   }
 * ]
 * </pre>
 */
@Operation(desc = "List all sessions as a JSON string", impact = MBeanOperationInfo.INFO)
String listAllSessionsAsJSON() throws Exception;
 
源代码20 项目: activemq-artemis   文件: QueueControl.java
/**
 * Counts the number of messages in this queue matching the specified filter, grouped by the given property field.
 * In case of null property will be grouped in "null"
 * <br>
 * Using {@code null} or an empty filter will count <em>all</em> messages from this queue.
 */
@Operation(desc = "Returns the number of the messages in the queue matching the given filter, grouped by the given property field", impact = MBeanOperationInfo.INFO)
String countMessages(@Parameter(name = "filter", desc = "This filter separate account messages") String filter, @Parameter(name = "groupByProperty", desc = "This property to group by") String groupByProperty) throws Exception;