Skip to content

Commit 297f250

Browse files
committed
Added Dump attribute
If a QBean implements Loggeable, expose its dump
1 parent 5f4c0a5 commit 297f250

File tree

2 files changed

+14
-4
lines changed

2 files changed

+14
-4
lines changed

jpos/src/main/java/org/jpos/q2/QBeanSupport.java

Lines changed: 13 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -22,15 +22,14 @@
2222
import org.jpos.core.Configurable;
2323
import org.jpos.core.Configuration;
2424
import org.jpos.core.ConfigurationException;
25-
import org.jpos.util.ConcurrentUtil;
26-
import org.jpos.util.Log;
27-
import org.jpos.util.LogEvent;
28-
import org.jpos.util.Logger;
25+
import org.jpos.util.*;
2926

3027
import java.beans.BeanInfo;
3128
import java.beans.Introspector;
3229
import java.beans.PropertyDescriptor;
30+
import java.io.ByteArrayOutputStream;
3331
import java.io.Closeable;
32+
import java.io.PrintStream;
3433
import java.lang.reflect.Method;
3534
import java.net.URL;
3635
import java.util.Iterator;
@@ -240,6 +239,16 @@ public void setConfiguration (Configuration cfg)
240239
public Configuration getConfiguration () {
241240
return cfg;
242241
}
242+
243+
public String getDump () {
244+
if (this instanceof Loggeable) {
245+
ByteArrayOutputStream baos = new ByteArrayOutputStream();
246+
PrintStream p = new PrintStream(baos);
247+
((Loggeable)this).dump(p, "");
248+
return baos.toString();
249+
}
250+
return toString();
251+
}
243252
protected void initService() throws Exception {}
244253
protected void startService() throws Exception {}
245254
protected void stopService() throws Exception {}

jpos/src/main/java/org/jpos/q2/QBeanSupportMBean.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,4 +39,5 @@ public interface QBeanSupportMBean extends QBean, QPersist {
3939
String getLogger();
4040
URL[] getLoaderURLS();
4141
QClassLoader getLoader();
42+
String getDump();
4243
}

0 commit comments

Comments
 (0)