use of org.apache.synapse.aspects.AspectConfiguration in project wso2-synapse by wso2.
the class Resource method setComponentStatisticsId.
public void setComponentStatisticsId(ArtifactHolder holder) {
StatisticIdentityGenerator.reportingBranchingEvents(holder);
if (aspectConfiguration == null) {
aspectConfiguration = new AspectConfiguration(name);
}
String resourceId = StatisticIdentityGenerator.getIdForComponent(getResourceClassName(), ComponentType.RESOURCE, holder);
aspectConfiguration.setUniqueId(resourceId);
String childId = null;
if (inSequenceKey != null) {
childId = StatisticIdentityGenerator.getIdReferencingComponent(inSequenceKey, ComponentType.SEQUENCE, holder);
StatisticIdentityGenerator.reportingEndEvent(childId, ComponentType.SEQUENCE, holder);
}
if (inSequence != null) {
inSequence.setComponentStatisticsId(holder);
}
if (outSequenceKey != null) {
childId = StatisticIdentityGenerator.getIdReferencingComponent(outSequenceKey, ComponentType.SEQUENCE, holder);
StatisticIdentityGenerator.reportingEndEvent(childId, ComponentType.SEQUENCE, holder);
}
if (outSequence != null) {
outSequence.setComponentStatisticsId(holder);
}
if (faultSequenceKey != null) {
childId = StatisticIdentityGenerator.getIdReferencingComponent(faultSequenceKey, ComponentType.SEQUENCE, holder);
StatisticIdentityGenerator.reportingEndEvent(childId, ComponentType.SEQUENCE, holder);
}
if (faultSequence != null) {
faultSequence.setComponentStatisticsId(holder);
}
StatisticIdentityGenerator.reportingEndEvent(resourceId, ComponentType.RESOURCE, holder);
}
use of org.apache.synapse.aspects.AspectConfiguration in project wso2-synapse by wso2.
the class AbstractEndpoint method prepareForEndpointStatistics.
/**
* Process statistics for this message
* @param synCtx the current message
*/
protected void prepareForEndpointStatistics(MessageContext synCtx) {
// Setting Required property to reportForComponent the End Point aspects
if (definition != null && definition.isStatisticsEnable()) {
String opName = null;
if (synCtx.getProperty(SynapseConstants.ENDPOINT_OPERATION) != null) {
opName = synCtx.getProperty(SynapseConstants.ENDPOINT_OPERATION).toString();
} else if (synCtx instanceof Axis2MessageContext) {
AxisOperation operation = ((Axis2MessageContext) synCtx).getAxis2MessageContext().getAxisOperation();
if (operation != null) {
opName = operation.getName().getLocalPart();
}
if (opName == null || SynapseConstants.SYNAPSE_OPERATION_NAME.getLocalPart().equals(opName)) {
String soapAction = synCtx.getSoapAction();
opName = null;
if (soapAction != null) {
int index = soapAction.indexOf("urn:");
if (index >= 0) {
opName = soapAction.substring("urn:".length());
} else {
opName = soapAction;
}
}
}
}
AspectConfiguration oldConfiguration = definition.getAspectConfiguration();
if (opName != null) {
AspectConfiguration newConfiguration = new AspectConfiguration(oldConfiguration.getId() + SynapseConstants.STATISTICS_KEY_SEPARATOR + opName);
if (oldConfiguration.isStatisticsEnable()) {
newConfiguration.enableStatistics();
}
if (oldConfiguration.isTracingEnabled()) {
newConfiguration.enableTracing();
}
}
}
}
use of org.apache.synapse.aspects.AspectConfiguration in project wso2-synapse by wso2.
the class AbstractEndpoint method setComponentStatisticsId.
public void setComponentStatisticsId(ArtifactHolder holder) {
if (this instanceof IndirectEndpoint) {
String sequenceId = StatisticIdentityGenerator.getIdReferencingComponent(((IndirectEndpoint) (this)).getKey(), ComponentType.ENDPOINT, holder);
StatisticIdentityGenerator.reportingEndEvent(sequenceId, ComponentType.ENDPOINT, holder);
} else {
if (definition == null) {
EndpointDefinition definition = new EndpointDefinition();
this.setDefinition(definition);
}
if (definition.getAspectConfiguration() == null) {
definition.configure(new AspectConfiguration(getReportingName()));
}
String sequenceId = StatisticIdentityGenerator.getIdForComponent(getReportingName(), ComponentType.ENDPOINT, holder);
definition.getAspectConfiguration().setUniqueId(sequenceId);
StatisticIdentityGenerator.reportingEndEvent(sequenceId, ComponentType.ENDPOINT, holder);
}
}
use of org.apache.synapse.aspects.AspectConfiguration 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();
}
}
}
}
}
use of org.apache.synapse.aspects.AspectConfiguration in project wso2-synapse by wso2.
the class ThrottleMediator method setComponentStatisticsId.
@Override
public void setComponentStatisticsId(ArtifactHolder holder) {
if (getAspectConfiguration() == null) {
configure(new AspectConfiguration(getMediatorName()));
}
String mediatorId = StatisticIdentityGenerator.getIdForFlowContinuableMediator(getMediatorName(), ComponentType.MEDIATOR, holder);
getAspectConfiguration().setUniqueId(mediatorId);
String childId;
if (onAcceptSeqKey != null) {
childId = StatisticIdentityGenerator.getIdReferencingComponent(onAcceptSeqKey, ComponentType.SEQUENCE, holder);
StatisticIdentityGenerator.reportingEndEvent(childId, ComponentType.SEQUENCE, holder);
} else if (onAcceptMediator != null) {
onAcceptMediator.setComponentStatisticsId(holder);
}
if (onRejectSeqKey != null) {
childId = StatisticIdentityGenerator.getIdReferencingComponent(onRejectSeqKey, ComponentType.SEQUENCE, holder);
StatisticIdentityGenerator.reportingEndEvent(childId, ComponentType.SEQUENCE, holder);
} else if (onRejectMediator != null) {
onRejectMediator.setComponentStatisticsId(holder);
}
StatisticIdentityGenerator.reportingFlowContinuableEndEvent(mediatorId, ComponentType.MEDIATOR, holder);
}
Aggregations