public TracerServiceInfo getMessages(int numberOfMessages, String filter) throws AxisFault {
ConfigurationContext configContext = getConfigContext();
AxisConfiguration axisConfiguration = configContext.getAxisConfiguration();
CircularBuffer msgSeqBuff = getMessageSequenceBuffer();
Object[] messageObjs;
TracerServiceInfo tracerServiceInfo = new TracerServiceInfo();
AxisModule axisModule = axisConfiguration.getModule(TracerConstants.WSO2_TRACER);
if (axisModule == null) {
throw new AxisFault(TracerConstants.WSO2_TRACER + " module is not available");
}
TracePersister tracePersister = getTracePersister();
tracerServiceInfo.setTracePersister(tracePersister.getClass().getName());
if (tracePersister.isTracingEnabled()) {
if (!axisConfiguration.isEngaged(axisModule)) {
axisConfiguration.engageModule(axisModule);
}
tracerServiceInfo.setFlag("ON");
} else {
if (axisConfiguration.isEngaged(axisModule)) {
axisConfiguration.disengageModule(axisModule);
}
tracerServiceInfo.setFlag("OFF");
}
if (msgSeqBuff == null) {
tracerServiceInfo.setEmpty(true);
return tracerServiceInfo;
} else {
messageObjs = msgSeqBuff.getObjects(numberOfMessages);
if (messageObjs.length == 0) {
tracerServiceInfo.setEmpty(true);
return tracerServiceInfo;