Java Code Examples for javax.management.MBeanOperationInfo#ACTION
The following examples show how to use
javax.management.MBeanOperationInfo#ACTION .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: TimedJmxDynamicMBean.java From NoraUi with GNU Affero General Public License v3.0 | 6 votes |
@Override public MBeanInfo getMBeanInfo() { MBeanParameterInfo[] withoutParamInfo = new MBeanParameterInfo[0]; MBeanAttributeInfo attributs[] = new MBeanAttributeInfo[value.size()]; int i = 0; for (Entry<String, Long> entry : value.entrySet()) { attributs[i] = new MBeanAttributeInfo(entry.getKey(), "long", "Timed of " + entry.getKey(), true, true, false); i++; } MBeanConstructorInfo[] constructeurs = new MBeanConstructorInfo[1]; constructeurs[0] = new MBeanConstructorInfo("TimedJmxDynamicMBean", "Constructor by default", withoutParamInfo); MBeanOperationInfo[] operations = new MBeanOperationInfo[1]; operations[0] = new MBeanOperationInfo("refresh", "Refresh data", withoutParamInfo, void.class.getName(), MBeanOperationInfo.ACTION); return new MBeanInfo(getClass().getName(), "TimedJmxDynamicMBean", attributs, constructeurs, operations, null); }
Example 2
Source File: JmxFeedTest.java From brooklyn-server with Apache License 2.0 | 6 votes |
@Test public void testJmxOperationWithArgPolledForSensor() throws Exception { // This is awful syntax... MBeanParameterInfo paramInfo = new MBeanParameterInfo("param1", String.class.getName(), "my param1"); MBeanParameterInfo[] paramInfos = new MBeanParameterInfo[] {paramInfo}; MBeanOperationInfo opInfo = new MBeanOperationInfo(opName, "my descr", paramInfos, String.class.getName(), MBeanOperationInfo.ACTION); GeneralisedDynamicMBean mbean = jmxService.registerMBean( Collections.emptyMap(), ImmutableMap.of(opInfo, new Function<Object[], String>() { @Override public String apply(Object[] args) { return args[0]+"suffix"; }}), objectName); feed = JmxFeed.builder() .entity(entity) .pollOperation(new JmxOperationPollConfig<String>(stringAttribute) .objectName(objectName) .operationName(opName) .operationParams(ImmutableList.of("myprefix"))) .build(); assertSensorEventually(stringAttribute, "myprefix"+"suffix", TIMEOUT_MS); }
Example 3
Source File: JmxHelperTest.java From brooklyn-server with Apache License 2.0 | 6 votes |
@Test public void testInvokeOperationWithArgs() throws Exception { final String opReturnPrefix = "my result prefix/"; String opParam1 = "my param 1"; MBeanOperationInfo opInfo = new MBeanOperationInfo( opName, "my descr", new MBeanParameterInfo[] {new MBeanParameterInfo("myParam1", String.class.getName(), "my param1 descr")}, String.class.getName(), MBeanOperationInfo.ACTION); Function<Object[],String> opImpl = new Function<Object[],String>() { @Override public String apply(Object[] input) { return opReturnPrefix+input[0]; } }; GeneralisedDynamicMBean mbean = jmxService.registerMBean(ImmutableMap.of(), ImmutableMap.of(opInfo, opImpl), objectName); assertEquals(jmxHelper.operation(objectName, opName, opParam1), opReturnPrefix+opParam1); }
Example 4
Source File: ActiveMQServerControl.java From activemq-artemis with Apache License 2.0 | 5 votes |
@Operation(desc = "Create a Divert", impact = MBeanOperationInfo.ACTION) void createDivert(@Parameter(name = "name", desc = "Name of the divert") String name, @Parameter(name = "routingName", desc = "Routing name of the divert") String routingName, @Parameter(name = "address", desc = "Address to divert from") String address, @Parameter(name = "forwardingAddress", desc = "Address to divert to") String forwardingAddress, @Parameter(name = "exclusive", desc = "Is the divert exclusive?") boolean exclusive, @Parameter(name = "filterString", desc = "Filter of the divert") String filterString, @Parameter(name = "transformerClassName", desc = "Class name of the divert's transformer") String transformerClassName) throws Exception;
Example 5
Source File: LayoutDynamicMBean.java From cacheonix-core with GNU Lesser General Public License v2.1 | 4 votes |
private void buildDynamicMBeanInfo() throws IntrospectionException { Constructor[] constructors = this.getClass().getConstructors(); dConstructors[0] = new MBeanConstructorInfo( "LayoutDynamicMBean(): Constructs a LayoutDynamicMBean instance", constructors[0]); BeanInfo bi = Introspector.getBeanInfo(layout.getClass()); PropertyDescriptor[] pd = bi.getPropertyDescriptors(); int size = pd.length; for(int i = 0; i < size; i++) { String name = pd[i].getName(); Method readMethod = pd[i].getReadMethod(); Method writeMethod = pd[i].getWriteMethod(); if(readMethod != null) { Class returnClass = readMethod.getReturnType(); if(isSupportedType(returnClass)) { String returnClassName; if(returnClass.isAssignableFrom(Level.class)) { returnClassName = "java.lang.String"; } else { returnClassName = returnClass.getName(); } dAttributes.add(new MBeanAttributeInfo(name, returnClassName, "Dynamic", true, writeMethod != null, false)); dynamicProps.put(name, new MethodUnion(readMethod, writeMethod)); } } } MBeanParameterInfo[] params = new MBeanParameterInfo[0]; dOperations[0] = new MBeanOperationInfo("activateOptions", "activateOptions(): add an layout", params, "void", MBeanOperationInfo.ACTION); }
Example 6
Source File: ActiveMQServerControl.java From activemq-artemis with Apache License 2.0 | 4 votes |
@Operation(desc = "Delete an address", impact = MBeanOperationInfo.ACTION) void deleteAddress(@Parameter(name = "name", desc = "The name of the address") String name, @Parameter(name = "force", desc = "Force consumers and queues out") boolean force) throws Exception;
Example 7
Source File: QueueControl.java From activemq-artemis with Apache License 2.0 | 4 votes |
@Operation(desc = "Move the messages corresponding to the given filter (and returns the number of moved messages)", impact = MBeanOperationInfo.ACTION) int moveMessages(@Parameter(name = "flushLimit", desc = "Limit to flush transactions during the operation to avoid OutOfMemory") int flushLimit, @Parameter(name = "filter", desc = "A message filter (can be empty)") String filter, @Parameter(name = "otherQueueName", desc = "The name of the queue to move the messages to") String otherQueueName, @Parameter(name = "rejectDuplicates", desc = "Reject messages identified as duplicate by the duplicate message") boolean rejectDuplicates) throws Exception;
Example 8
Source File: ActiveMQServerControl.java From activemq-artemis with Apache License 2.0 | 4 votes |
@Operation(desc = "Create a connector service", impact = MBeanOperationInfo.ACTION) void createConnectorService(@Parameter(name = "name", desc = "Name of the connector service") String name, @Parameter(name = "factoryClass", desc = "Class name of the connector service factory") String factoryClass, @Parameter(name = "parameters", desc = "Parameter specific to the connector service") Map<String, Object> parameters) throws Exception;
Example 9
Source File: ActiveMQServerControl.java From activemq-artemis with Apache License 2.0 | 4 votes |
/** * adds a new address setting for a specific address */ @Operation(desc = "Add address settings for addresses matching the addressMatch", impact = MBeanOperationInfo.ACTION) void addAddressSettings(@Parameter(desc = "an address match", name = "addressMatch") String addressMatch, @Parameter(desc = "the dead letter address setting", name = "DLA") String DLA, @Parameter(desc = "the expiry address setting", name = "expiryAddress") String expiryAddress, @Parameter(desc = "the expiry delay setting", name = "expiryDelay") long expiryDelay, @Parameter(desc = "are any queues created for this address a last value queue", name = "lastValueQueue") boolean lastValueQueue, @Parameter(desc = "the delivery attempts", name = "deliveryAttempts") int deliveryAttempts, @Parameter(desc = "the max size in bytes", name = "maxSizeBytes") long maxSizeBytes, @Parameter(desc = "the page size in bytes", name = "pageSizeBytes") int pageSizeBytes, @Parameter(desc = "the max number of pages in the soft memory cache", name = "pageMaxCacheSize") int pageMaxCacheSize, @Parameter(desc = "the redelivery delay", name = "redeliveryDelay") long redeliveryDelay, @Parameter(desc = "the redelivery delay multiplier", name = "redeliveryMultiplier") double redeliveryMultiplier, @Parameter(desc = "the maximum redelivery delay", name = "maxRedeliveryDelay") long maxRedeliveryDelay, @Parameter(desc = "the redistribution delay", name = "redistributionDelay") long redistributionDelay, @Parameter(desc = "do we send to the DLA when there is no where to route the message", name = "sendToDLAOnNoRoute") boolean sendToDLAOnNoRoute, @Parameter(desc = "the policy to use when the address is full", name = "addressFullMessagePolicy") String addressFullMessagePolicy, @Parameter(desc = "when a consumer falls below this threshold in terms of messages consumed per second it will be considered 'slow'", name = "slowConsumerThreshold") long slowConsumerThreshold, @Parameter(desc = "how often (in seconds) to check for slow consumers", name = "slowConsumerCheckPeriod") long slowConsumerCheckPeriod, @Parameter(desc = "the policy to use when a slow consumer is detected", name = "slowConsumerPolicy") String slowConsumerPolicy, @Parameter(desc = "allow jms queues to be created automatically", name = "autoCreateJmsQueues") boolean autoCreateJmsQueues, @Parameter(desc = "allow auto-created jms queues to be deleted automatically", name = "autoDeleteJmsQueues") boolean autoDeleteJmsQueues, @Parameter(desc = "allow jms topics to be created automatically", name = "autoCreateJmsTopics") boolean autoCreateJmsTopics, @Parameter(desc = "allow auto-created jms topics to be deleted automatically", name = "autoDeleteJmsTopics") boolean autoDeleteJmsTopics, @Parameter(desc = "allow queues to be created automatically", name = "autoCreateQueues") boolean autoCreateQueues, @Parameter(desc = "allow auto-created queues to be deleted automatically", name = "autoDeleteQueues") boolean autoDeleteQueues, @Parameter(desc = "allow addresses to be created automatically", name = "autoCreateAddresses") boolean autoCreateAddresses, @Parameter(desc = "allow auto-created addresses to be deleted automatically", name = "autoDeleteAddresses") boolean autoDeleteAddresses, @Parameter(desc = "how to deal with queues deleted from XML at runtime", name = "configDeleteQueues") String configDeleteQueues, @Parameter(desc = "how to deal with addresses deleted from XML at runtime", name = "configDeleteAddresses") String configDeleteAddresses, @Parameter(desc = "used with `BLOCK`, the max size an address can reach before messages are rejected; works in combination with `max-size-bytes` for AMQP clients only", name = "maxSizeBytesRejectThreshold") long maxSizeBytesRejectThreshold, @Parameter(desc = "last-value-key value if none is set on the queue", name = "defaultLastValueKey") String defaultLastValueKey, @Parameter(desc = "non-destructive value if none is set on the queue", name = "defaultNonDestructive") boolean defaultNonDestructive, @Parameter(desc = "exclusive value if none is set on the queue", name = "defaultExclusiveQueue") boolean defaultExclusiveQueue, @Parameter(desc = "group-rebalance value if none is set on the queue", name = "defaultGroupRebalance") boolean defaultGroupRebalance, @Parameter(desc = "group-buckets value if none is set on the queue", name = "defaultGroupBuckets") int defaultGroupBuckets, @Parameter(desc = "group-first-key value if none is set on the queue", name = "defaultGroupFirstKey") String defaultGroupFirstKey, @Parameter(desc = "max-consumers value if none is set on the queue", name = "defaultMaxConsumers") int defaultMaxConsumers, @Parameter(desc = "purge-on-no-consumers value if none is set on the queue", name = "defaultPurgeOnNoConsumers") boolean defaultPurgeOnNoConsumers, @Parameter(desc = "consumers-before-dispatch value if none is set on the queue", name = "defaultConsumersBeforeDispatch") int defaultConsumersBeforeDispatch, @Parameter(desc = "delay-before-dispatch value if none is set on the queue", name = "defaultDelayBeforeDispatch") long defaultDelayBeforeDispatch, @Parameter(desc = "routing-type value if none is set on the queue", name = "defaultQueueRoutingType") String defaultQueueRoutingType, @Parameter(desc = "routing-type value if none is set on the address", name = "defaultAddressRoutingType") String defaultAddressRoutingType, @Parameter(desc = "consumer-window-size value if none is set on the queue", name = "defaultConsumerWindowSize") int defaultConsumerWindowSize, @Parameter(desc = "ring-size value if none is set on the queue", name = "defaultRingSize") long defaultRingSize, @Parameter(desc = "allow created queues to be deleted automatically", name = "autoDeleteCreatedQueues") boolean autoDeleteCreatedQueues, @Parameter(desc = "delay for deleting auto-created queues", name = "autoDeleteQueuesDelay") long autoDeleteQueuesDelay, @Parameter(desc = "the message count the queue must be at or below before it can be auto deleted", name = "autoDeleteQueuesMessageCount") long autoDeleteQueuesMessageCount, @Parameter(desc = "delay for deleting auto-created addresses", name = "autoDeleteAddressesDelay") long autoDeleteAddressesDelay, @Parameter(desc = "factor by which to modify the redelivery delay slightly to avoid collisions", name = "redeliveryCollisionAvoidanceFactor") double redeliveryCollisionAvoidanceFactor, @Parameter(desc = "the number of messages to preserve for future queues created on the matching address", name = "retroactiveMessageCount") long retroactiveMessageCount) throws Exception;
Example 10
Source File: MetricsDynamicMBeanBase.java From hadoop with Apache License 2.0 | 4 votes |
private void createMBeanInfo() { boolean needsMinMaxResetOperation = false; List<MBeanAttributeInfo> attributesInfo = new ArrayList<MBeanAttributeInfo>(); MBeanOperationInfo[] operationsInfo = null; numEntriesInRegistry = metricsRegistry.size(); for (MetricsBase o : metricsRegistry.getMetricsList()) { if (MetricsTimeVaryingRate.class.isInstance(o)) { // For each of the metrics there are 3 different attributes attributesInfo.add(new MBeanAttributeInfo(o.getName() + NUM_OPS, "java.lang.Integer", o.getDescription(), true, false, false)); attributesInfo.add(new MBeanAttributeInfo(o.getName() + AVG_TIME, "java.lang.Long", o.getDescription(), true, false, false)); attributesInfo.add(new MBeanAttributeInfo(o.getName() + MIN_TIME, "java.lang.Long", o.getDescription(), true, false, false)); attributesInfo.add(new MBeanAttributeInfo(o.getName() + MAX_TIME, "java.lang.Long", o.getDescription(), true, false, false)); needsMinMaxResetOperation = true; // the min and max can be reset. // Note the special attributes (AVG_TIME, MIN_TIME, ..) are derived from metrics // Rather than check for the suffix we store them in a map. metricsRateAttributeMod.put(o.getName() + NUM_OPS, o); metricsRateAttributeMod.put(o.getName() + AVG_TIME, o); metricsRateAttributeMod.put(o.getName() + MIN_TIME, o); metricsRateAttributeMod.put(o.getName() + MAX_TIME, o); } else if ( MetricsIntValue.class.isInstance(o) || MetricsTimeVaryingInt.class.isInstance(o) ) { attributesInfo.add(new MBeanAttributeInfo(o.getName(), "java.lang.Integer", o.getDescription(), true, false, false)); } else if ( MetricsLongValue.class.isInstance(o) || MetricsTimeVaryingLong.class.isInstance(o) ) { attributesInfo.add(new MBeanAttributeInfo(o.getName(), "java.lang.Long", o.getDescription(), true, false, false)); } else { MetricsUtil.LOG.error("unknown metrics type: " + o.getClass().getName()); } if (needsMinMaxResetOperation) { operationsInfo = new MBeanOperationInfo[] { new MBeanOperationInfo(RESET_ALL_MIN_MAX_OP, "Reset (zero) All Min Max", null, "void", MBeanOperationInfo.ACTION) }; } } MBeanAttributeInfo[] attrArray = new MBeanAttributeInfo[attributesInfo.size()]; mbeanInfo = new MBeanInfo(this.getClass().getName(), mbeanDescription, attributesInfo.toArray(attrArray), null, operationsInfo, null); }
Example 11
Source File: MetricsDynamicMBeanBase.java From hadoop-gpu with Apache License 2.0 | 4 votes |
private void createMBeanInfo() { metricsRateAttributeMod = new HashMap<String, MetricsBase>(); boolean needsMinMaxResetOperation = false; List<MBeanAttributeInfo> attributesInfo = new ArrayList<MBeanAttributeInfo>(); MBeanOperationInfo[] operationsInfo = null; numEntriesInRegistry = metricsRegistry.size(); for (MetricsBase o : metricsRegistry.getMetricsList()) { if (MetricsTimeVaryingRate.class.isInstance(o)) { // For each of the metrics there are 3 different attributes attributesInfo.add(new MBeanAttributeInfo(o.getName() + NUM_OPS, "java.lang.Integer", o.getDescription(), true, false, false)); attributesInfo.add(new MBeanAttributeInfo(o.getName() + AVG_TIME, "java.lang.Long", o.getDescription(), true, false, false)); attributesInfo.add(new MBeanAttributeInfo(o.getName() + MIN_TIME, "java.lang.Long", o.getDescription(), true, false, false)); attributesInfo.add(new MBeanAttributeInfo(o.getName() + MAX_TIME, "java.lang.Long", o.getDescription(), true, false, false)); needsMinMaxResetOperation = true; // the min and max can be reset. // Note the special attributes (AVG_TIME, MIN_TIME, ..) are derived from metrics // Rather than check for the suffix we store them in a map. metricsRateAttributeMod.put(o.getName() + NUM_OPS, o); metricsRateAttributeMod.put(o.getName() + AVG_TIME, o); metricsRateAttributeMod.put(o.getName() + MIN_TIME, o); metricsRateAttributeMod.put(o.getName() + MAX_TIME, o); } else if ( MetricsIntValue.class.isInstance(o) || MetricsTimeVaryingInt.class.isInstance(o) ) { attributesInfo.add(new MBeanAttributeInfo(o.getName(), "java.lang.Integer", o.getDescription(), true, false, false)); } else if ( MetricsLongValue.class.isInstance(o) || MetricsTimeVaryingLong.class.isInstance(o) ) { attributesInfo.add(new MBeanAttributeInfo(o.getName(), "java.lang.Long", o.getDescription(), true, false, false)); } else { MetricsUtil.LOG.error("unknown metrics type: " + o.getClass().getName()); } if (needsMinMaxResetOperation) { operationsInfo = new MBeanOperationInfo[] { new MBeanOperationInfo(RESET_ALL_MIN_MAX_OP, "Reset (zero) All Min Max", null, "void", MBeanOperationInfo.ACTION) }; } } MBeanAttributeInfo[] attrArray = new MBeanAttributeInfo[attributesInfo.size()]; mbeanInfo = new MBeanInfo(this.getClass().getName(), mbeanDescription, attributesInfo.toArray(attrArray), null, operationsInfo, null); }
Example 12
Source File: ActiveMQServerControl.java From activemq-artemis with Apache License 2.0 | 3 votes |
/** * Set new properties on an existing user (only applicable when using the JAAS PropertiesLoginModule). * * @param username * @param password * @param roles * @param plaintext * @throws Exception */ @Operation(desc = "set new properties on an existing user (only applicable when using the JAAS PropertiesLoginModule)", impact = MBeanOperationInfo.ACTION) void resetUser(@Parameter(name = "username", desc = "Name of the user") String username, @Parameter(name = "password", desc = "User's password") String password, @Parameter(name = "roles", desc = "User's role (comma separated)") String roles, @Parameter(name = "plaintext", desc = "whether or not to store the password in plaintext or hash it") boolean plaintext) throws Exception;
Example 13
Source File: ActiveMQServerControl.java From activemq-artemis with Apache License 2.0 | 2 votes |
/** * List the information about a user or all users if no username is supplied (only applicable when using the JAAS PropertiesLoginModule). * * @param username * @return JSON array of user and role information * @throws Exception */ @Operation(desc = "list info about a user or all users if no username is supplied (only applicable when using the JAAS PropertiesLoginModule)", impact = MBeanOperationInfo.ACTION) String listUser(@Parameter(name = "username", desc = "Name of the user; leave null to list all known users") String username) throws Exception;
Example 14
Source File: QueueControl.java From activemq-artemis with Apache License 2.0 | 2 votes |
/** * Resets the MessagesExpired property */ @Operation(desc = "Resets the MessagesExpired property", impact = MBeanOperationInfo.ACTION) void resetMessagesExpired() throws Exception;
Example 15
Source File: QueueControl.java From activemq-artemis with Apache License 2.0 | 2 votes |
/** * Expires the message corresponding to the specified message ID. * * @return {@code true} if the message was expired, {@code false} else */ @Operation(desc = "Remove the message corresponding to the given messageID", impact = MBeanOperationInfo.ACTION) boolean expireMessage(@Parameter(name = "messageID", desc = "A message ID") long messageID) throws Exception;
Example 16
Source File: AddressControl.java From activemq-artemis with Apache License 2.0 | 2 votes |
/** * Pauses all the queues bound to this address.Messages are no longer delivered to all its bounded queues. * Newly added queue will be paused too until resume is called. * @throws java.lang.Exception */ @Operation(desc = "Pauses the queues bound to this address", impact = MBeanOperationInfo.ACTION) void pause() throws Exception;
Example 17
Source File: QueueControl.java From activemq-artemis with Apache License 2.0 | 2 votes |
/** * Enables the queue. Messages are now routed to this queue. */ @Operation(desc = "Enables routing of messages to the Queue", impact = MBeanOperationInfo.ACTION) void enable() throws Exception;
Example 18
Source File: QueueControl.java From activemq-artemis with Apache License 2.0 | 2 votes |
/** * Enables the queue. Messages are not routed to this queue. */ @Operation(desc = "Disables routing of messages to the Queue", impact = MBeanOperationInfo.ACTION) void disable() throws Exception;
Example 19
Source File: QueueControl.java From activemq-artemis with Apache License 2.0 | 2 votes |
/** * Removes the message corresponding to the specified message ID. * * @return {@code true} if the message was removed, {@code false} else */ @Operation(desc = "Remove the message corresponding to the given messageID", impact = MBeanOperationInfo.ACTION) boolean removeMessage(@Parameter(name = "messageID", desc = "A message ID") long messageID) throws Exception;
Example 20
Source File: ActiveMQServerControl.java From activemq-artemis with Apache License 2.0 | 2 votes |
/** * Create a queue. * <br> * This method throws a {@link org.apache.activemq.artemis.api.core.ActiveMQQueueExistsException}) exception if the queue already exists and {@code ignoreIfExists} is {@code false}. * * @param queueConfiguration the configuration of the queue in JSON format * @param ignoreIfExists whether or not to simply return without an exception if the queue exists * @return the configuration of the created queue in JSON format * @throws Exception */ @Operation(desc = "Create a queue", impact = MBeanOperationInfo.ACTION) String createQueue(@Parameter(name = "queueConfiguration", desc = "the configuration of the queue in JSON format") String queueConfiguration, @Parameter(name = "ignoreIfExists", desc = "whether or not to try to create the queue if it exists already") boolean ignoreIfExists) throws Exception;