couple of small changes to JMX mbeans - no jira

This commit is contained in:
Andy Taylor 2017-01-09 13:32:01 +00:00
parent 83e83e7d87
commit 6af85a2cc4
4 changed files with 27 additions and 5 deletions

View File

@ -39,6 +39,12 @@ public interface AddressControl {
@Attribute(desc = "Get the delivery modes enabled on this address") @Attribute(desc = "Get the delivery modes enabled on this address")
Set<RoutingType> getDeliveryModes(); Set<RoutingType> getDeliveryModes();
/*
* Whether multicast routing is enabled for this address
* */
@Attribute(desc = "Get the delivery modes enabled on this address as JSON")
String getDeliveryModesAsJSON() throws Exception;
/** /**
* Returns the roles (name and permissions) associated with this address. * Returns the roles (name and permissions) associated with this address.
*/ */

View File

@ -357,7 +357,7 @@ public interface QueueControl {
*/ */
@Operation(desc = "Sends a TextMessage to a password-protected destination.", impact = MBeanOperationInfo.ACTION) @Operation(desc = "Sends a TextMessage to a password-protected destination.", impact = MBeanOperationInfo.ACTION)
String sendMessage(@Parameter(name = "headers", desc = "The headers to add to the message") Map<String, String> headers, String sendMessage(@Parameter(name = "headers", desc = "The headers to add to the message") Map<String, String> headers,
@Parameter(name = "headers", desc = "A type for the message") final int type, @Parameter(name = "type", desc = "A type for the message") final int type,
@Parameter(name = "body", desc = "The body (byte[]) of the message encoded as a string using Base64") String body, @Parameter(name = "body", desc = "The body (byte[]) of the message encoded as a string using Base64") String body,
@Parameter(name = "durable", desc = "Whether the message is durable") boolean durable, @Parameter(name = "durable", desc = "Whether the message is durable") boolean durable,
@Parameter(name = "user", desc = "The user to authenticate with") String user, @Parameter(name = "user", desc = "The user to authenticate with") String user,
@ -448,7 +448,7 @@ public interface QueueControl {
* Resets the MessagesAdded property * Resets the MessagesAdded property
*/ */
@Operation(desc = "Browse Messages", impact = MBeanOperationInfo.ACTION) @Operation(desc = "Browse Messages", impact = MBeanOperationInfo.ACTION)
CompositeData[] browse(String filter) throws Exception; CompositeData[] browse(@Parameter(name = "filter", desc = "A message filter (can be empty)") String filter) throws Exception;
/** /**
* Resets the MessagesAdded property * Resets the MessagesAdded property

View File

@ -101,6 +101,22 @@ public class AddressControlImpl extends AbstractControl implements AddressContro
return addressInfo.getRoutingTypes(); return addressInfo.getRoutingTypes();
} }
@Override
public String getDeliveryModesAsJSON() throws Exception {
clearIO();
try {
JsonArrayBuilder json = JsonLoader.createArrayBuilder();
Set<RoutingType> routingTypes = getDeliveryModes();
for (RoutingType routingType : routingTypes) {
json.add(routingType.toString());
}
return json.build().toString();
} finally {
blockOnIO();
}
}
@Override @Override
public String[] getQueueNames() throws Exception { public String[] getQueueNames() throws Exception {
clearIO(); clearIO();

View File

@ -915,7 +915,7 @@ public class QueueControlImpl extends AbstractControl implements QueueControl {
return browse(null); return browse(null);
} }
@Override @Override
public CompositeData[] browse(String filterStr) throws Exception { public CompositeData[] browse(String filter) throws Exception {
checkStarted(); checkStarted();
clearIO(); clearIO();
@ -923,12 +923,12 @@ public class QueueControlImpl extends AbstractControl implements QueueControl {
int pageSize = addressSettingsRepository.getMatch(queue.getName().toString()).getManagementBrowsePageSize(); int pageSize = addressSettingsRepository.getMatch(queue.getName().toString()).getManagementBrowsePageSize();
int currentPageSize = 0; int currentPageSize = 0;
ArrayList<CompositeData> c = new ArrayList<>(); ArrayList<CompositeData> c = new ArrayList<>();
Filter filter = FilterImpl.createFilter(filterStr); Filter thefilter = FilterImpl.createFilter(filter);
queue.flushExecutor(); queue.flushExecutor();
try (LinkedListIterator<MessageReference> iterator = queue.browserIterator()) { try (LinkedListIterator<MessageReference> iterator = queue.browserIterator()) {
while (iterator.hasNext() && currentPageSize++ < pageSize) { while (iterator.hasNext() && currentPageSize++ < pageSize) {
MessageReference ref = iterator.next(); MessageReference ref = iterator.next();
if (filter == null || filter.match(ref.getMessage())) { if (thefilter == null || thefilter.match(ref.getMessage())) {
c.add(OpenTypeSupport.convert(ref)); c.add(OpenTypeSupport.convert(ref));
} }