Commit 1aea1c15 authored by Andre Freyssinet's avatar Andre Freyssinet

Adds dumpProperties MBean method.

parent 8db72b40
......@@ -22,7 +22,10 @@
*/
package org.objectweb.joram.mom.dest;
import java.util.Iterator;
import java.util.Map;
import java.util.Properties;
import java.util.Set;
import org.objectweb.joram.mom.notifications.ClientMessages;
import org.objectweb.joram.shared.DestinationConstants;
......@@ -51,6 +54,33 @@ public class AcquisitionQueue extends Queue implements AcquisitionQueueMBean {
/** Stores the last set of properties defined. */
private Properties properties;
public String dumpProperties() {
Set<Map.Entry<Object, Object>> entries = properties.entrySet();
int max = entries.size() - 1;
if (max == -1)
return "{}";
StringBuilder sb = new StringBuilder();
Iterator<Map.Entry<Object, Object>> it = entries.iterator();
sb.append('{');
for (int i = 0; ; i++) {
Map.Entry<Object, Object> e = it.next();
String key = (String) e.getKey();
String value = (String) e.getValue();
sb.append(key.toString());
sb.append('=');
if (key.indexOf("pass") == -1)
sb.append(value.toString());
else
sb.append("***");
if (i == max)
return sb.append('}').toString();
sb.append(", ");
}
}
/** Stores the id of the last message received to avoid duplicates. */
private String lastMessageId;
......
......@@ -73,6 +73,9 @@ public interface AcquisitionQueueMBean extends QueueMBean, AcquisitionMBean {
*/
long getPendingMin();
public String dumpProperties();
/**
* Starts the handler.
*/
......
......@@ -22,7 +22,10 @@
*/
package org.objectweb.joram.mom.dest;
import java.util.Iterator;
import java.util.Map;
import java.util.Properties;
import java.util.Set;
import org.objectweb.joram.mom.notifications.ClientMessages;
import org.objectweb.joram.shared.DestinationConstants;
......@@ -40,7 +43,6 @@ import fr.dyade.aaa.common.Debug;
* using an {@link AcquisitionModule}.
*/
public class AcquisitionTopic extends Topic implements AcquisitionTopicMBean {
/** define serialVersionUID for interoperability */
private static final long serialVersionUID = 1L;
......@@ -51,6 +53,34 @@ public class AcquisitionTopic extends Topic implements AcquisitionTopicMBean {
/** Stores the last set of properties defined. */
private Properties properties;
public String dumpProperties() {
Set<Map.Entry<Object, Object>> entries = properties.entrySet();
int max = entries.size() - 1;
if (max == -1)
return "{}";
StringBuilder sb = new StringBuilder();
Iterator<Map.Entry<Object, Object>> it = entries.iterator();
sb.append('{');
for (int i = 0; ; i++) {
Map.Entry<Object, Object> e = it.next();
String key = (String) e.getKey();
String value = (String) e.getValue();
sb.append(key.toString());
sb.append('=');
if (key.indexOf("pass") == -1)
sb.append(value.toString());
else
sb.append("***");
if (i == max)
return sb.append('}').toString();
sb.append(", ");
}
}
/** Stores the id of the last message received to avoid duplicates. */
private String lastMessageId;
......
......@@ -26,5 +26,5 @@ package org.objectweb.joram.mom.dest;
* JMX interface for the monitoring topic.
*/
public interface AcquisitionTopicMBean extends TopicMBean, AcquisitionMBean {
public String dumpProperties();
}
......@@ -24,7 +24,9 @@ package org.objectweb.joram.mom.dest;
import java.util.Iterator;
import java.util.List;
import java.util.Map;
import java.util.Properties;
import java.util.Set;
import org.objectweb.joram.mom.notifications.ClientMessages;
import org.objectweb.joram.mom.notifications.WakeUpNot;
......@@ -46,7 +48,7 @@ import fr.dyade.aaa.common.Debug;
* The {@link DistributionQueue} class implements the MOM distribution queue
* behavior, delivering messages via the {@link DistributionModule}.
*/
public class DistributionQueue extends Queue {
public class DistributionQueue extends Queue implements DistributionQueueMBean {
public static Logger logger = Debug.getLogger(DistributionQueue.class.getName());
/** Default period used to clean queue and re-distribute failing messages. */
......@@ -77,6 +79,33 @@ public class DistributionQueue extends Queue {
private boolean isAsyncDistribution;
private Properties properties;
public String dumpProperties() {
Set<Map.Entry<Object, Object>> entries = properties.entrySet();
int max = entries.size() - 1;
if (max == -1)
return "{}";
StringBuilder sb = new StringBuilder();
Iterator<Map.Entry<Object, Object>> it = entries.iterator();
sb.append('{');
for (int i = 0; ; i++) {
Map.Entry<Object, Object> e = it.next();
String key = (String) e.getKey();
String value = (String) e.getValue();
sb.append(key.toString());
sb.append('=');
if (key.indexOf("pass") == -1)
sb.append(value.toString());
else
sb.append("***");
if (i == max)
return sb.append('}').toString();
sb.append(", ");
}
}
public DistributionQueue() {
super();
......
......@@ -22,8 +22,11 @@
*/
package org.objectweb.joram.mom.dest;
import java.util.Iterator;
import java.util.List;
import java.util.Map;
import java.util.Properties;
import java.util.Set;
import org.objectweb.joram.mom.notifications.ClientMessages;
import org.objectweb.joram.mom.notifications.WakeUpNot;
......@@ -44,7 +47,7 @@ import fr.dyade.aaa.common.Debug;
* The {@link DistributionQueue} class implements the MOM distribution topic
* behavior, delivering messages via the {@link DistributionModule}.
*/
public class DistributionTopic extends Topic {
public class DistributionTopic extends Topic implements DistributionTopicMBean {
public static Logger logger = Debug.getLogger(DistributionTopic.class.getName());
......@@ -58,6 +61,33 @@ public class DistributionTopic extends Topic {
private Properties properties;
public String dumpProperties() {
Set<Map.Entry<Object, Object>> entries = properties.entrySet();
int max = entries.size() - 1;
if (max == -1)
return "{}";
StringBuilder sb = new StringBuilder();
Iterator<Map.Entry<Object, Object>> it = entries.iterator();
sb.append('{');
for (int i = 0; ; i++) {
Map.Entry<Object, Object> e = it.next();
String key = (String) e.getKey();
String value = (String) e.getValue();
sb.append(key.toString());
sb.append('=');
if (key.indexOf("pass") == -1)
sb.append(value.toString());
else
sb.append("***");
if (i == max)
return sb.append('}').toString();
sb.append(", ");
}
}
private transient DistributionDaemon distributionDaemon;
/**
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment