use of org.apache.synapse.Nameable in project wso2-synapse by wso2.
the class AbstractMediatorFactory method processAuditStatus.
/**
* This is to Initialize the mediator regarding tracing and statistics.
*
* @param mediator of which trace state has to be set
* @param mediatorOmElement from which the trace state is extracted
*
* @since 2.0
*/
protected void processAuditStatus(Mediator mediator, OMElement mediatorOmElement) {
String name = null;
if (mediator instanceof Nameable) {
name = ((Nameable) mediator).getName();
}
if (name == null || "".equals(name)) {
name = SynapseConstants.ANONYMOUS_SEQUENCE;
}
if (mediator instanceof AspectConfigurable) {
AspectConfiguration configuration = new AspectConfiguration(name);
((AspectConfigurable) mediator).configure(configuration);
OMAttribute statistics = mediatorOmElement.getAttribute(ATT_STATS);
if (statistics != null) {
String statisticsValue = statistics.getAttributeValue();
if (statisticsValue != null) {
if (XMLConfigConstants.STATISTICS_ENABLE.equals(statisticsValue)) {
configuration.enableStatistics();
}
}
}
OMAttribute trace = mediatorOmElement.getAttribute(new QName(XMLConfigConstants.NULL_NAMESPACE, XMLConfigConstants.TRACE_ATTRIB_NAME));
if (trace != null) {
String traceValue = trace.getAttributeValue();
if (traceValue != null) {
if (traceValue.equals(XMLConfigConstants.TRACE_ENABLE)) {
configuration.enableTracing();
}
}
}
}
}
Aggregations