Search in sources :

Example 51 with Mediator

use of org.apache.synapse.Mediator in project wso2-synapse by wso2.

the class Axis2MessageContext method getDefaultConfiguration.

public Mediator getDefaultConfiguration(String key) {
    Object o = localEntries.get(key);
    if (o != null && o instanceof Mediator) {
        return (Mediator) o;
    } else {
        Mediator m = getConfiguration().getDefaultConfiguration(key);
        localEntries.put(key, m);
        return m;
    }
}
Also used : TemplateMediator(org.apache.synapse.mediators.template.TemplateMediator) Mediator(org.apache.synapse.Mediator) SequenceMediator(org.apache.synapse.mediators.base.SequenceMediator)

Example 52 with Mediator

use of org.apache.synapse.Mediator in project wso2-synapse by wso2.

the class Axis2SynapseEnvironment method injectMessage.

public boolean injectMessage(final MessageContext synCtx) {
    try {
        if (log.isDebugEnabled()) {
            log.debug("Injecting MessageContext");
        }
        if (synCtx.getEnvironment().isDebuggerEnabled()) {
            SynapseDebugManager debugManager = synCtx.getEnvironment().getSynapseDebugManager();
            debugManager.acquireMediationFlowLock();
            debugManager.advertiseMediationFlowStartPoint(synCtx);
        }
        // setting transport-in name as a message context property
        TransportInDescription trpInDesc = ((Axis2MessageContext) synCtx).getAxis2MessageContext().getTransportIn();
        if (trpInDesc != null) {
            synCtx.setProperty(SynapseConstants.TRANSPORT_IN_NAME, trpInDesc.getName());
        }
        synCtx.setEnvironment(this);
        if (!invokeHandlers(synCtx)) {
            return false;
        }
        Mediator mandatorySeq = synCtx.getConfiguration().getMandatorySequence();
        // the mandatory sequence is optional and hence check for the existence before mediation
        if (mandatorySeq != null) {
            if (log.isDebugEnabled()) {
                log.debug("Start mediating the message in the " + "pre-mediate state using the mandatory sequence");
            }
            if (!mandatorySeq.mediate(synCtx)) {
                if (log.isDebugEnabled()) {
                    log.debug((synCtx.isResponse() ? "Response" : "Request") + " message for the " + (synCtx.getProperty(SynapseConstants.PROXY_SERVICE) != null ? "proxy service " + synCtx.getProperty(SynapseConstants.PROXY_SERVICE) : "message mediation") + " dropped in the " + "pre-mediation state by the mandatory sequence : \n" + synCtx);
                }
                return false;
            }
        }
        String receivingSequence = (String) synCtx.getProperty(SynapseConstants.RECEIVING_SEQUENCE);
        Boolean isContinuationCall = (Boolean) synCtx.getProperty(SynapseConstants.CONTINUATION_CALL);
        // clear the message context properties related to endpoint in last service invocation
        Set keySet = synCtx.getPropertyKeySet();
        if (keySet != null) {
            keySet.remove(SynapseConstants.RECEIVING_SEQUENCE);
            keySet.remove(SynapseConstants.CONTINUATION_CALL);
        }
        if (isContinuationCall != null && isContinuationCall && !synCtx.getContinuationStateStack().isEmpty()) {
            if (log.isDebugEnabled()) {
                log.debug("Response received for the Continuation Call service invocation");
            }
            return mediateFromContinuationStateStack(synCtx);
        }
        // if this is not a response to a proxy service
        String proxyName = (String) synCtx.getProperty(SynapseConstants.PROXY_SERVICE);
        if (proxyName == null || "".equals(proxyName)) {
            // set default fault handler
            synCtx.pushFaultHandler(new MediatorFaultHandler(synCtx.getFaultSequence()));
            if (receivingSequence != null) {
                if (log.isDebugEnabled()) {
                    log.debug("Using Sequence with name: " + receivingSequence + " for injected message");
                }
                Mediator seqMediator = synCtx.getSequence(receivingSequence);
                if (seqMediator != null) {
                    return seqMediator.mediate(synCtx);
                } else {
                    log.warn("Cannot find a Sequence with name: " + receivingSequence + " for injecting the response message");
                    return false;
                }
            } else {
                boolean processed = restHandler.process(synCtx);
                if (processed) {
                    return true;
                }
                if (log.isDebugEnabled()) {
                    log.debug("Using Main Sequence for injected message");
                }
                return synCtx.getMainSequence().mediate(synCtx);
            }
        }
        ProxyService proxyService = synCtx.getConfiguration().getProxyService(proxyName);
        if (proxyService != null) {
            proxyService.registerFaultHandler(synCtx);
            Mediator outSequence = getProxyOutSequence(synCtx, proxyService);
            if (receivingSequence != null) {
                if (log.isDebugEnabled()) {
                    log.debug("Using Sequence with name: " + receivingSequence + " for injected message");
                }
                Mediator seqMediator = synCtx.getSequence(receivingSequence);
                if (seqMediator != null) {
                    seqMediator.mediate(synCtx);
                } else {
                    log.warn("Cannot find a Sequence with name: " + receivingSequence + " for injecting the message");
                    return false;
                }
            } else if (outSequence != null) {
                outSequence.mediate(synCtx);
            } else {
                if (log.isDebugEnabled()) {
                    log.debug(proxyService + " does not specifies an out-sequence - sending the response back");
                }
                Axis2Sender.sendBack(synCtx);
            }
        }
        return true;
    } finally {
        if (synCtx.getEnvironment().isDebuggerEnabled()) {
            SynapseDebugManager debugManager = synCtx.getEnvironment().getSynapseDebugManager();
            debugManager.advertiseMediationFlowTerminatePoint(synCtx);
            debugManager.releaseMediationFlowLock();
        }
    }
}
Also used : MediatorFaultHandler(org.apache.synapse.mediators.MediatorFaultHandler) Set(java.util.Set) Mediator(org.apache.synapse.Mediator) SequenceMediator(org.apache.synapse.mediators.base.SequenceMediator) TransportInDescription(org.apache.axis2.description.TransportInDescription) SynapseDebugManager(org.apache.synapse.debug.SynapseDebugManager)

Example 53 with Mediator

use of org.apache.synapse.Mediator in project wso2-synapse by wso2.

the class APIDebugUtil method registerAPISequenceMediationFlowBreakPoint.

/**
 * Registers/Un-registers a breakpoint, point where mediation flow get suspended
 *
 * @param synCfg Synapse configuration
 * @param mapping either resource url-mapping or uri-template
 * @param method resource http method
 * @param sequenceType Synapse sequence type
 * @param apiKey name of the API
 * @param position array of integers that uniquely specifies a point in mediation route
 * @param registerMode specify whether register or un register
 */
public static void registerAPISequenceMediationFlowBreakPoint(SynapseConfiguration synCfg, String mapping, String method, String sequenceType, String apiKey, int[] position, boolean registerMode) {
    SynapseSequenceType synapseSequenceType = SynapseSequenceType.valueOf(sequenceType.toUpperCase());
    APIMediationFlowPoint breakPoint = new APIMediationFlowPoint();
    breakPoint.setSynapseMediationComponent(SynapseMediationComponent.SEQUENCE);
    breakPoint.setKey(apiKey);
    breakPoint.setMediatorPosition(position);
    breakPoint.setSynapseSequenceType(synapseSequenceType);
    breakPoint.setSequenceBaseType(SynapseDebugCommandConstants.DEBUG_COMMAND_MEDIATION_COMPONENT_SEQUENCE_API);
    breakPoint.setResourceMapping(mapping);
    breakPoint.setResourceHTTPMethod(method);
    Mediator seqMediator = null;
    Resource api_resource = null;
    API api = synCfg.getAPI(apiKey);
    if (api == null) {
        if (log.isDebugEnabled()) {
            log.debug("Non existing API for the key " + breakPoint.getKey());
        }
        debugManager.advertiseCommandResponse(debugManager.createDebugCommandResponse(false, SynapseDebugCommandConstants.DEBUG_COMMAND_RESPONSE_API_NOT_FOUND).toString());
        return;
    }
    Resource[] resource_array = api.getResources();
    for (int counter = 0; counter < resource_array.length; counter++) {
        if (resource_array[counter].getDispatcherHelper() != null && mapping != null) {
            if (mapping.equals(resource_array[counter].getDispatcherHelper().getString())) {
                for (String m1 : resource_array[counter].getMethods()) {
                    if (m1.equals(method)) {
                        api_resource = resource_array[counter];
                        break;
                    }
                }
                if (api_resource != null) {
                    break;
                }
            }
        } else if (resource_array[counter].getDispatcherHelper() == null && mapping == null) {
            for (String m1 : resource_array[counter].getMethods()) {
                if (m1.equals(method)) {
                    api_resource = resource_array[counter];
                    break;
                }
            }
            if (api_resource != null) {
                break;
            }
        }
    }
    if (api_resource != null) {
        if (synapseSequenceType.equals(SynapseSequenceType.API_INSEQ)) {
            seqMediator = api_resource.getInSequence();
        } else if (synapseSequenceType.equals(SynapseSequenceType.API_OUTSEQ)) {
            seqMediator = api_resource.getOutSequence();
        } else if (synapseSequenceType.equals(SynapseSequenceType.API_FAULTSEQ)) {
            seqMediator = api_resource.getFaultSequence();
        }
    } else {
        if (log.isDebugEnabled()) {
            log.debug("Resource not found for the API key " + breakPoint.getKey() + " resource mapping " + breakPoint.getResourceMapping() + " resource HTTP method " + breakPoint.getResourceHTTPMethod());
        }
        debugManager.advertiseCommandResponse(debugManager.createDebugCommandResponse(false, SynapseDebugCommandConstants.DEBUG_COMMAND_RESPONSE_API_RESOURCE_NOT_FOUND).toString());
        return;
    }
    if (seqMediator != null) {
        Mediator current_mediator = null;
        current_mediator = MediatorTreeTraverseUtil.getMediatorReference(synCfg, seqMediator, position);
        if (current_mediator != null) {
            breakPoint.setMediatorReference(current_mediator);
            if (registerMode) {
                if (!((AbstractMediator) current_mediator).isBreakPoint()) {
                    ((AbstractMediator) current_mediator).setBreakPoint(true);
                    ((AbstractMediator) current_mediator).registerMediationFlowPoint(breakPoint);
                    if (log.isDebugEnabled()) {
                        log.info("Registered breakpoint at mediator position " + logMediatorPosition(breakPoint) + " for API key " + breakPoint.getKey() + " resource mapping " + breakPoint.getResourceMapping() + " resource HTTP method " + breakPoint.getResourceHTTPMethod() + " sequence type " + breakPoint.getSynapseSequenceType().toString());
                    }
                    debugManager.advertiseCommandResponse(debugManager.createDebugCommandResponse(true, null).toString());
                } else {
                    if (log.isDebugEnabled()) {
                        log.debug("Failed register breakpoint. Already breakpoint enabled at mediator position " + logMediatorPosition(breakPoint) + " for API key " + breakPoint.getKey() + " resource mapping " + breakPoint.getResourceMapping() + " resource HTTP method " + breakPoint.getResourceHTTPMethod() + " sequence type " + breakPoint.getSynapseSequenceType().toString());
                    }
                    debugManager.advertiseCommandResponse(debugManager.createDebugCommandResponse(false, SynapseDebugCommandConstants.DEBUG_COMMAND_RESPONSE_ALREADY_BREAKPOINT_ENABLED).toString());
                }
            } else {
                if (((AbstractMediator) current_mediator).isBreakPoint()) {
                    ((AbstractMediator) current_mediator).unregisterMediationFlowPoint();
                    ((AbstractMediator) current_mediator).setBreakPoint(false);
                    if (log.isDebugEnabled()) {
                        log.debug("Unregistered breakpoint at mediator position " + logMediatorPosition(breakPoint) + " for API key " + breakPoint.getKey() + " resource mapping " + breakPoint.getResourceMapping() + " resource HTTP method " + breakPoint.getResourceHTTPMethod() + " sequence type " + breakPoint.getSynapseSequenceType().toString());
                    }
                    debugManager.advertiseCommandResponse(debugManager.createDebugCommandResponse(true, null).toString());
                } else {
                    if (log.isDebugEnabled()) {
                        log.debug("Failed unregister breakpoint. Already breakpoint disabled at mediator position " + logMediatorPosition(breakPoint) + " for API key " + breakPoint.getKey() + " resource mapping " + breakPoint.getResourceMapping() + " resource HTTP method " + breakPoint.getResourceHTTPMethod() + " sequence type " + breakPoint.getSynapseSequenceType().toString());
                    }
                    debugManager.advertiseCommandResponse(debugManager.createDebugCommandResponse(false, SynapseDebugCommandConstants.DEBUG_COMMAND_RESPONSE_ALREADY_BREAKPOINT_DISABLED).toString());
                }
            }
        } else {
            if (registerMode) {
                if (log.isDebugEnabled()) {
                    log.debug("Failed register breakpoint. Non existing mediator position at " + logMediatorPosition(breakPoint) + " for API key " + breakPoint.getKey() + " resource mapping " + breakPoint.getResourceMapping() + " resource HTTP method " + breakPoint.getResourceHTTPMethod() + " sequence type " + breakPoint.getSynapseSequenceType().toString());
                }
                debugManager.advertiseCommandResponse(debugManager.createDebugCommandResponse(false, SynapseDebugCommandConstants.DEBUG_COMMAND_RESPONSE_NON_EXISTING_MEDIATOR_POSITION).toString());
            } else {
                if (log.isDebugEnabled()) {
                    log.debug("Failed unregister breakpoint. Non existing mediator position at " + logMediatorPosition(breakPoint) + " for API key " + breakPoint.getKey() + " resource mapping " + breakPoint.getResourceMapping() + " resource HTTP method " + breakPoint.getResourceHTTPMethod() + " sequence type " + breakPoint.getSynapseSequenceType().toString());
                }
                debugManager.advertiseCommandResponse(debugManager.createDebugCommandResponse(false, SynapseDebugCommandConstants.DEBUG_COMMAND_RESPONSE_NON_EXISTING_MEDIATOR_POSITION).toString());
            }
        }
    } else {
        if (registerMode) {
            if (log.isDebugEnabled()) {
                log.debug("Failed register breakpoint. Non existing sequence " + breakPoint.getSynapseSequenceType().toString() + " for API key " + breakPoint.getKey() + " resource mapping " + breakPoint.getResourceMapping() + " resource HTTP method " + breakPoint.getResourceHTTPMethod());
            }
            debugManager.advertiseCommandResponse(debugManager.createDebugCommandResponse(false, SynapseDebugCommandConstants.DEBUG_COMMAND_RESPONSE_NON_EXISTING_SEQUENCE).toString());
        } else {
            if (log.isDebugEnabled()) {
                log.debug("Failed unregister breakpoint. Non existing sequence " + breakPoint.getSynapseSequenceType().toString() + " for API key " + breakPoint.getKey() + " resource mapping " + breakPoint.getResourceMapping() + " resource HTTP method " + breakPoint.getResourceHTTPMethod());
            }
            debugManager.advertiseCommandResponse(debugManager.createDebugCommandResponse(false, SynapseDebugCommandConstants.DEBUG_COMMAND_RESPONSE_NON_EXISTING_SEQUENCE).toString());
        }
    }
}
Also used : SynapseSequenceType(org.apache.synapse.debug.constructs.SynapseSequenceType) APIMediationFlowPoint(org.apache.synapse.debug.constructs.APIMediationFlowPoint) Resource(org.apache.synapse.rest.Resource) AbstractMediator(org.apache.synapse.mediators.AbstractMediator) Mediator(org.apache.synapse.Mediator) API(org.apache.synapse.rest.API) AbstractMediator(org.apache.synapse.mediators.AbstractMediator) APIMediationFlowPoint(org.apache.synapse.debug.constructs.APIMediationFlowPoint) SynapseMediationFlowPoint(org.apache.synapse.debug.constructs.SynapseMediationFlowPoint)

Example 54 with Mediator

use of org.apache.synapse.Mediator in project wso2-synapse by wso2.

the class ConnectorDebugUtil method registerConnectorMediationFlowSkip.

/**
 * Registers/Un-registers a skip, point where mediator disables from mediation flow
 *
 * @param synCfg Synapse configuration
 * @param connectorMethod method name of the template
 * @param connectorKey name of the Connector
 * @param position array of integers that uniquely specifies a point in mediation route
 * @param registerMode specify whether register or un register
 */
public static void registerConnectorMediationFlowSkip(SynapseConfiguration synCfg, String connectorKey, String connectorMethod, int[] position, boolean registerMode) {
    ConnectorMediationFlowPoint skipPoint = new ConnectorMediationFlowPoint();
    skipPoint.setSynapseMediationComponent(SynapseMediationComponent.CONNECTOR);
    skipPoint.setKey(connectorKey);
    skipPoint.setConnectorMediationComponentMethod(connectorMethod);
    skipPoint.setMediatorPosition(position);
    Mediator templateMediator = null;
    String template_key = SynapseDebugManagerConstants.CONNECTOR_PACKAGE + "." + connectorKey + "." + connectorMethod;
    templateMediator = synCfg.getSequenceTemplate(template_key);
    if (templateMediator != null) {
        Mediator current_mediator = null;
        current_mediator = MediatorTreeTraverseUtil.getMediatorReference(synCfg, templateMediator, position);
        if (current_mediator != null) {
            skipPoint.setMediatorReference(current_mediator);
            if (registerMode) {
                if (!((AbstractMediator) current_mediator).isSkipEnabled()) {
                    ((AbstractMediator) current_mediator).setSkipEnabled(true);
                    ((AbstractMediator) current_mediator).registerMediationFlowPoint(skipPoint);
                    if (log.isDebugEnabled()) {
                        log.debug("Registered skip at mediator position " + logMediatorPosition(skipPoint) + " for Connector key " + skipPoint.getKey() + " method " + skipPoint.getConnectorMediationComponentMethod());
                    }
                    debugManager.advertiseCommandResponse(debugManager.createDebugCommandResponse(true, null).toString());
                } else {
                    if (log.isDebugEnabled()) {
                        log.debug("Failed register skip. Already skip enabled at mediator position " + logMediatorPosition(skipPoint) + " for Connector key " + skipPoint.getKey() + " method " + skipPoint.getConnectorMediationComponentMethod());
                    }
                    debugManager.advertiseCommandResponse(debugManager.createDebugCommandResponse(false, SynapseDebugCommandConstants.DEBUG_COMMAND_RESPONSE_ALREADY_SKIP_ENABLED).toString());
                }
            } else {
                if (((AbstractMediator) current_mediator).isSkipEnabled()) {
                    ((AbstractMediator) current_mediator).unregisterMediationFlowPoint();
                    ((AbstractMediator) current_mediator).setSkipEnabled(false);
                    if (log.isDebugEnabled()) {
                        log.debug("Unregistered skip at mediator position " + logMediatorPosition(skipPoint) + " for Connector key " + skipPoint.getKey() + " method " + skipPoint.getConnectorMediationComponentMethod());
                    }
                    debugManager.advertiseCommandResponse(debugManager.createDebugCommandResponse(true, null).toString());
                } else {
                    if (log.isDebugEnabled()) {
                        log.debug("Failed unregister skip. Already skip disabled at mediator position " + logMediatorPosition(skipPoint) + " for Connector key " + skipPoint.getKey() + " method " + skipPoint.getConnectorMediationComponentMethod());
                    }
                    debugManager.advertiseCommandResponse(debugManager.createDebugCommandResponse(false, SynapseDebugCommandConstants.DEBUG_COMMAND_RESPONSE_ALREADY_SKIP_DISABLED).toString());
                }
            }
        } else {
            if (registerMode) {
                if (log.isDebugEnabled()) {
                    log.debug("Failed register skip. Non existing mediator position " + logMediatorPosition(skipPoint) + " for Connector key " + skipPoint.getKey() + " method " + skipPoint.getConnectorMediationComponentMethod());
                }
                debugManager.advertiseCommandResponse(debugManager.createDebugCommandResponse(false, SynapseDebugCommandConstants.DEBUG_COMMAND_RESPONSE_NON_EXISTING_MEDIATOR_POSITION).toString());
            } else {
                if (log.isDebugEnabled()) {
                    log.debug("Failed unregister skip. Non existing mediator position at " + logMediatorPosition(skipPoint) + " for Connector key " + skipPoint.getKey() + " method " + skipPoint.getConnectorMediationComponentMethod());
                }
                debugManager.advertiseCommandResponse(debugManager.createDebugCommandResponse(false, SynapseDebugCommandConstants.DEBUG_COMMAND_RESPONSE_NON_EXISTING_MEDIATOR_POSITION).toString());
            }
        }
    } else {
        if (registerMode) {
            if (log.isDebugEnabled()) {
                log.debug("Failed register skip. Non existing template for Connector key " + skipPoint.getKey() + " method " + skipPoint.getConnectorMediationComponentMethod());
            }
            debugManager.advertiseCommandResponse(debugManager.createDebugCommandResponse(false, SynapseDebugCommandConstants.DEBUG_COMMAND_RESPONSE_NON_EXISTING_TEMPLATE).toString());
        } else {
            if (log.isDebugEnabled()) {
                log.debug("Failed unregister skip. Non existing template for Connector key " + skipPoint.getKey() + " method " + skipPoint.getConnectorMediationComponentMethod());
            }
            debugManager.advertiseCommandResponse(debugManager.createDebugCommandResponse(false, SynapseDebugCommandConstants.DEBUG_COMMAND_RESPONSE_NON_EXISTING_TEMPLATE).toString());
        }
    }
}
Also used : ConnectorMediationFlowPoint(org.apache.synapse.debug.constructs.ConnectorMediationFlowPoint) AbstractMediator(org.apache.synapse.mediators.AbstractMediator) Mediator(org.apache.synapse.Mediator) AbstractMediator(org.apache.synapse.mediators.AbstractMediator)

Example 55 with Mediator

use of org.apache.synapse.Mediator in project wso2-synapse by wso2.

the class ConnectorDebugUtil method registerConnectorMediationFlowBreakPoint.

/**
 * Registers/Un-registers a breakpoint, point where mediation flow get suspended
 *
 * @param synCfg Synapse configuration
 * @param connectorMethod method name of the template
 * @param connectorKey name of the Connector
 * @param position array of integers that uniquely specifies a point in mediation route
 * @param registerMode specify whether register or un register
 */
public static void registerConnectorMediationFlowBreakPoint(SynapseConfiguration synCfg, String connectorKey, String connectorMethod, int[] position, boolean registerMode) {
    ConnectorMediationFlowPoint breakPoint = new ConnectorMediationFlowPoint();
    breakPoint.setSynapseMediationComponent(SynapseMediationComponent.CONNECTOR);
    breakPoint.setKey(connectorKey);
    breakPoint.setConnectorMediationComponentMethod(connectorMethod);
    breakPoint.setMediatorPosition(position);
    Mediator templateMediator = null;
    String template_key = SynapseDebugManagerConstants.CONNECTOR_PACKAGE + "." + connectorKey + "." + connectorMethod;
    templateMediator = synCfg.getSequenceTemplate(template_key);
    if (templateMediator != null) {
        Mediator current_mediator = null;
        current_mediator = MediatorTreeTraverseUtil.getMediatorReference(synCfg, templateMediator, position);
        if (current_mediator != null) {
            breakPoint.setMediatorReference(current_mediator);
            if (registerMode) {
                if (!((AbstractMediator) current_mediator).isBreakPoint()) {
                    ((AbstractMediator) current_mediator).setBreakPoint(true);
                    ((AbstractMediator) current_mediator).registerMediationFlowPoint(breakPoint);
                    if (log.isDebugEnabled()) {
                        log.debug("Registered breakpoint at mediator position " + logMediatorPosition(breakPoint) + " for Connector key " + breakPoint.getKey() + " method " + breakPoint.getConnectorMediationComponentMethod());
                    }
                    debugManager.advertiseCommandResponse(debugManager.createDebugCommandResponse(true, null).toString());
                } else {
                    if (log.isDebugEnabled()) {
                        log.debug("Failed register breakpoint. Already breakpoint enabled at mediator position " + logMediatorPosition(breakPoint) + " for Connector key " + breakPoint.getKey() + " method " + breakPoint.getConnectorMediationComponentMethod());
                    }
                    debugManager.advertiseCommandResponse(debugManager.createDebugCommandResponse(false, SynapseDebugCommandConstants.DEBUG_COMMAND_RESPONSE_ALREADY_BREAKPOINT_ENABLED).toString());
                }
            } else {
                if (((AbstractMediator) current_mediator).isBreakPoint()) {
                    ((AbstractMediator) current_mediator).unregisterMediationFlowPoint();
                    ((AbstractMediator) current_mediator).setBreakPoint(false);
                    if (log.isDebugEnabled()) {
                        log.debug("Unregistered breakpoint at mediator position " + logMediatorPosition(breakPoint) + " for Connector key " + breakPoint.getKey() + " method " + breakPoint.getConnectorMediationComponentMethod());
                    }
                    debugManager.advertiseCommandResponse(debugManager.createDebugCommandResponse(true, null).toString());
                } else {
                    if (log.isDebugEnabled()) {
                        log.debug("Failed unregister breakpoint. Already breakpoint disabled at mediator position " + logMediatorPosition(breakPoint) + " for Connector key " + breakPoint.getKey() + " method " + breakPoint.getConnectorMediationComponentMethod());
                    }
                    debugManager.advertiseCommandResponse(debugManager.createDebugCommandResponse(false, SynapseDebugCommandConstants.DEBUG_COMMAND_RESPONSE_ALREADY_BREAKPOINT_DISABLED).toString());
                }
            }
        } else {
            if (registerMode) {
                if (log.isDebugEnabled()) {
                    log.debug("Failed register breakpoint. Non existing mediator position at " + logMediatorPosition(breakPoint) + " for Connector key " + breakPoint.getKey() + " method " + breakPoint.getConnectorMediationComponentMethod());
                }
                debugManager.advertiseCommandResponse(debugManager.createDebugCommandResponse(false, SynapseDebugCommandConstants.DEBUG_COMMAND_RESPONSE_NON_EXISTING_MEDIATOR_POSITION).toString());
            } else {
                if (log.isDebugEnabled()) {
                    log.debug("Failed unregister breakpoint. Non existing mediator position at " + logMediatorPosition(breakPoint) + " for Connector key " + breakPoint.getKey() + " method " + breakPoint.getConnectorMediationComponentMethod());
                }
                debugManager.advertiseCommandResponse(debugManager.createDebugCommandResponse(false, SynapseDebugCommandConstants.DEBUG_COMMAND_RESPONSE_NON_EXISTING_MEDIATOR_POSITION).toString());
            }
        }
    } else {
        if (registerMode) {
            if (log.isDebugEnabled()) {
                log.debug("Failed register breakpoint. Non existing template for Connector key " + breakPoint.getKey() + " method " + breakPoint.getConnectorMediationComponentMethod());
            }
            debugManager.advertiseCommandResponse(debugManager.createDebugCommandResponse(false, SynapseDebugCommandConstants.DEBUG_COMMAND_RESPONSE_NON_EXISTING_TEMPLATE).toString());
        } else {
            if (log.isDebugEnabled()) {
                log.debug("Failed unregister breakpoint. Non existing template for Connector key " + breakPoint.getKey() + " method " + breakPoint.getConnectorMediationComponentMethod());
            }
            debugManager.advertiseCommandResponse(debugManager.createDebugCommandResponse(false, SynapseDebugCommandConstants.DEBUG_COMMAND_RESPONSE_NON_EXISTING_TEMPLATE).toString());
        }
    }
}
Also used : ConnectorMediationFlowPoint(org.apache.synapse.debug.constructs.ConnectorMediationFlowPoint) AbstractMediator(org.apache.synapse.mediators.AbstractMediator) Mediator(org.apache.synapse.Mediator) AbstractMediator(org.apache.synapse.mediators.AbstractMediator)

Aggregations

Mediator (org.apache.synapse.Mediator)108 Properties (java.util.Properties)30 SequenceMediator (org.apache.synapse.mediators.base.SequenceMediator)24 OMElement (org.apache.axiom.om.OMElement)22 AbstractMediator (org.apache.synapse.mediators.AbstractMediator)22 MessageContext (org.apache.synapse.MessageContext)16 SynapseLog (org.apache.synapse.SynapseLog)16 FlowContinuableMediator (org.apache.synapse.mediators.FlowContinuableMediator)13 SynapseException (org.apache.synapse.SynapseException)12 TestMessageContext (org.apache.synapse.TestMessageContext)12 SynapseConfiguration (org.apache.synapse.config.SynapseConfiguration)12 Axis2SynapseEnvironment (org.apache.synapse.core.axis2.Axis2SynapseEnvironment)12 TemplateMediator (org.apache.synapse.mediators.template.TemplateMediator)12 Test (org.junit.Test)10 AbstractListMediator (org.apache.synapse.mediators.AbstractListMediator)9 SynapseSequenceType (org.apache.synapse.debug.constructs.SynapseSequenceType)8 SequenceMediationFlowPoint (org.apache.synapse.debug.constructs.SequenceMediationFlowPoint)6 ForEachMediatorFactory (org.apache.synapse.config.xml.ForEachMediatorFactory)5 MediatorFactory (org.apache.synapse.config.xml.MediatorFactory)5 MediatorFaultHandler (org.apache.synapse.mediators.MediatorFaultHandler)5