Package org.apache.synapse

Examples of org.apache.synapse.SynapseLog


     * @param synCtx - MessageContext to be mediated and aggregated
     * @return boolean true if the complete condition for the particular aggregate is validated
     */
    public boolean mediate(MessageContext synCtx) {

        SynapseLog synLog = getLog(synCtx);

        if (synLog.isTraceOrDebugEnabled()) {
            synLog.traceOrDebug("Start : Aggregate mediator");

            if (synLog.isTraceTraceEnabled()) {
                synLog.traceTrace("Message : " + synCtx.getEnvelope());
            }
        }

        try {
            Aggregate aggregate = null;

            // if a correlateExpression is provided and there is a coresponding
            // element in the current message prepare to correlate the messages on that
            if (correlateExpression != null
                    && correlateExpression.evaluate(synCtx) != null) {

                while (aggregate == null) {

                    synchronized (lock) {

                        if (activeAggregates.containsKey(correlateExpression.toString())) {

                            aggregate = activeAggregates.get(correlateExpression.toString());
                            if (aggregate != null) {
                                if (!aggregate.getLock()) {
                                    aggregate = null;
                                }
                            }

                        } else {

                            if (synLog.isTraceOrDebugEnabled()) {
                                synLog.traceOrDebug("Creating new Aggregator - " +
                                        (completionTimeoutMillis > 0 ? "expires in : "
                                                + (completionTimeoutMillis / 1000) + "secs" :
                                                "without expiry time"));
                            }

                            aggregate = new Aggregate(
                                    synCtx.getEnvironment(),
                                    correlateExpression.toString(),
                                    completionTimeoutMillis,
                                    minMessagesToComplete,
                                    maxMessagesToComplete, this);

                            if (completionTimeoutMillis > 0) {
                                synCtx.getConfiguration().getSynapseTimer().
                                        schedule(aggregate, completionTimeoutMillis);
                            }
                            aggregate.getLock();
                            activeAggregates.put(correlateExpression.toString(), aggregate);
                        }
                    }
                }

            } else if (synCtx.getProperty(EIPConstants.AGGREGATE_CORRELATION) != null) {
                // if the correlattion cannot be found using the correlateExpression then
                // try the default which is through the AGGREGATE_CORRELATION message property
                // which is the unique original message id of a split or iterate operation and
                // which thus can be used to uniquely group messages into aggregates

                Object o = synCtx.getProperty(EIPConstants.AGGREGATE_CORRELATION);
                String correlation;

                if (o != null && o instanceof String) {
                    correlation = (String) o;
                    while (aggregate == null) {
                        synchronized (lock) {
                            if (activeAggregates.containsKey(correlation)) {
                                aggregate = activeAggregates.get(correlation);
                                if (aggregate != null) {
                                    if (!aggregate.getLock()) {
                                        aggregate = null;
                                    }
                                } else {
                                    break;
                                }
                            } else {
                                if (synLog.isTraceOrDebugEnabled()) {
                                    synLog.traceOrDebug("Creating new Aggregator - " +
                                            (completionTimeoutMillis > 0 ? "expires in : "
                                                    + (completionTimeoutMillis / 1000) + "secs" :
                                                    "without expiry time"));
                                }
                       
                                aggregate = new Aggregate(
                                        synCtx.getEnvironment(),
                                        correlation,
                                        completionTimeoutMillis,
                                        minMessagesToComplete,
                                        maxMessagesToComplete, this);

                                if (completionTimeoutMillis > 0) {
                                    synchronized(aggregate) {
                                        if (!aggregate.isCompleted()) {
                                            synCtx.getConfiguration().getSynapseTimer().
                                                schedule(aggregate, completionTimeoutMillis);
                                        }
                                    }
                                }
                                aggregate.getLock();
                                activeAggregates.put(correlation, aggregate);
                            }
                        }
                    }
                   
                } else {
                    synLog.traceOrDebug("Unable to find aggrgation correlation property");
                    return true;
                }
            } else {
                synLog.traceOrDebug("Unable to find aggrgation correlation XPath or property");
                return true;
            }

            // if there is an aggregate continue on aggregation
            if (aggregate != null) {
                boolean collected = aggregate.addMessage(synCtx);
                if (synLog.isTraceOrDebugEnabled()) {
                    if (collected) {
                        synLog.traceOrDebug("Collected a message during aggregation");
                        if (synLog.isTraceTraceEnabled()) {
                            synLog.traceTrace("Collected message : " + synCtx);
                        }
                    }
                }
               
                // check the completeness of the aggregate and if completed aggregate the messages
                // if not completed return false and block the message sequence till it completes

                if (aggregate.isComplete(synLog)) {
                    synLog.traceOrDebug("Aggregation completed - invoking onComplete");
                    completeAggregate(aggregate);
                   
                    synLog.traceOrDebug("End : Aggregate mediator");
                    return true;
                } else {
                    aggregate.releaseLock();
                }

            } else {
                // if the aggregation correlation cannot be found then continue the message on the
                // normal path by returning true

                synLog.traceOrDebug("Unable to find an aggregate for this message - skip");
                return true;
            }

        } catch (JaxenException e) {
            handleException("Unable to execute the XPATH over the message", e, synCtx);
        }

        synLog.traceOrDebug("End : Aggregate mediator");

        return false;
    }
View Full Code Here


    private String action = "";

    public boolean mediate(MessageContext synCtx) {

        UserTransaction tx = null;
        final SynapseLog synLog = getLog(synCtx);

        if (synLog.isTraceOrDebugEnabled()) {
            synLog.traceOrDebug("Start : Transaction mediator (" + action + ")");

            if (synLog.isTraceTraceEnabled()) {
                synLog.traceTrace("Message : " + synCtx.getEnvelope());
            }
        }
        initContext(synCtx);
        try {
            tx = (UserTransaction) txContext.lookup(USER_TX_LOOKUP_STR);
        } catch (NamingException e) {
            handleException("Cloud not get the context name " + USER_TX_LOOKUP_STR, e, synCtx);
        }

        if (action.equals(ACTION_COMMIT)) {

            try {
                tx.commit();
            } catch (Exception e) {
                handleException("Unable to commit transaction", e, synCtx);
            }

        } else if (action.equals(ACTION_ROLLBACK)) {

            try {
                tx.rollback();
            } catch (Exception e) {
                handleException("Unable to rollback transaction", e, synCtx);
            }

        } else if (action.equals(ACTION_NEW)) {

            int status = Status.STATUS_UNKNOWN;
            try {
                status = tx.getStatus();
            } catch (Exception e) {
                handleException("Unable to query transaction status", e, synCtx);
            }

            if (status != Status.STATUS_NO_TRANSACTION) {
                throw new SynapseException("Require to begin a new transaction, " +
                        "but a transaction already exist");
            }

            try {
                tx.begin();
            } catch (Exception e) {
                handleException("Unable to begin a new transaction", e, synCtx);
            }

        } else if (action.equals(ACTION_USE_EXISTING_OR_NEW)) {

            int status = Status.STATUS_UNKNOWN;
            try {
                status = tx.getStatus();
            } catch (Exception e) {
                handleException("Unable to query transaction status", e, synCtx);
            }

            try {
                if (status == Status.STATUS_NO_TRANSACTION) {
                    tx.begin();
                }
            } catch (Exception e) {
                handleException("Unable to begin a new transaction", e, synCtx);
            }

        } else if (action.equals(ACTION_FAULT_IF_NO_TX)) {

            int status = Status.STATUS_UNKNOWN;
            try {
                status = tx.getStatus();
            } catch (Exception e) {
                handleException("Unable to query transaction status", e, synCtx);
            }

            if (status != Status.STATUS_ACTIVE)
                throw new SynapseException("No active transaction. Require an active transaction");

        } else {
            handleException("Invalid transaction mediator action : " + action, synCtx);
        }

        if (synLog.isTraceOrDebugEnabled()) {
            synLog.traceOrDebug("End : Transaction mediator");
        }

        return true;
    }
View Full Code Here

            XMLConstants.W3C_XML_SCHEMA_NS_URI);

    @SuppressWarnings({"ThrowableResultOfMethodCallIgnored"})
    public boolean mediate(MessageContext synCtx) {

        SynapseLog synLog = getLog(synCtx);

        synLog.traceOrDebug("Start : Validate mediator");
        if (synLog.isTraceTraceEnabled()) {
            synLog.traceTrace("Message : " + synCtx.getEnvelope());
        }

        // Input source for the validation
        Source validateSrc = getValidationSource(synCtx, synLog);

        // flag to check if we need to initialize/re-initialize the schema
        boolean reCreate = false;
        // if any of the schemas are not loaded, or have expired, load or re-load them
        for (String propKey : schemaKeys) {
            Entry dp = synCtx.getConfiguration().getEntryDefinition(propKey);
            if (dp != null && dp.isDynamic()) {
                if (!dp.isCached() || dp.isExpired()) {
                    reCreate = true;       // request re-initialization of Validator
                }
            }
        }

        // This is the reference to the DefaultHandler instance
        ValidateMediatorErrorHandler errorHandler = new ValidateMediatorErrorHandler();

        // do not re-initialize schema unless required
        synchronized (validatorLock) {
            if (reCreate || cachedSchema == null) {

                factory.setErrorHandler(errorHandler);
                StreamSource[] sources = new StreamSource[schemaKeys.size()];
                int i = 0;
                for (String propName : schemaKeys) {
                    sources[i++] = SynapseConfigUtils.getStreamSource(synCtx.getEntry(propName));
                }

                try {
                    cachedSchema = factory.newSchema(sources);
                } catch (SAXException e) {
                    handleException("Error creating a new schema objects for " +
                        "schemas : " + schemaKeys.toString(), e, synCtx);
                }

                if (errorHandler.isValidationError()) {
                    //reset the errorhandler state
                    errorHandler.setValidationError(false);
                    handleException("Error creating a new schema objects for schemas : "
                            + schemaKeys.toString(), errorHandler.getSaxParseException(), synCtx);
                }
            }
        }

        // no need to synchronize, schema instances are thread-safe
        try {
            Validator validator = cachedSchema.newValidator();
            validator.setErrorHandler(errorHandler);

            // perform actual validation
            validator.validate(validateSrc);

            if (errorHandler.isValidationError()) {

                if (synLog.isTraceOrDebugEnabled()) {
                    String msg = "Validation of element returned by XPath : " + source +
                        " failed against the given schema(s) " + schemaKeys +
                        "with error : " + errorHandler.getSaxParseException().getMessage() +
                        " Executing 'on-fail' sequence";
                    synLog.traceOrDebug(msg);

                    // write a warning to the service log
                    synCtx.getServiceLog().warn(msg);

                    if (synLog.isTraceTraceEnabled()) {
                        synLog.traceTrace("Failed message envelope : " + synCtx.getEnvelope());
                    }
                }

                // set error message and detail (stack trace) into the message context
                synCtx.setProperty(SynapseConstants.ERROR_MESSAGE,
                    errorHandler.getSaxParseException().getMessage());
                synCtx.setProperty(SynapseConstants.ERROR_EXCEPTION,
                    errorHandler.getSaxParseException());
                synCtx.setProperty(SynapseConstants.ERROR_DETAIL,
                    FaultHandler.getStackTrace(errorHandler.getSaxParseException()));

                // super.mediate() invokes the "on-fail" sequence of mediators
                return super.mediate(synCtx);
            }
        } catch (SAXException e) {
            handleException("Error validating " + source + " element", e, synCtx);
        } catch (IOException e) {
            handleException("Error validating " + source + " element", e, synCtx);
        }

        if (synLog.isTraceOrDebugEnabled()) {
            synLog.traceOrDebug("Validation of element returned by the XPath expression : "
                + source + " succeeded against the given schemas and the current message");
            synLog.traceOrDebug("End : Validate mediator");
        }

        return true;
    }
View Full Code Here

    private static final Map<String, Entry> sequenceMap =
            Collections.synchronizedMap(new HashMap<String, Entry>());

    public boolean mediate(MessageContext synCtx) {

        SynapseLog synLog = getLog(synCtx);

        if (synLog.isTraceOrDebugEnabled()) {
            synLog.traceOrDebug("Start : RMSequence mediator");

            if (synLog.isTraceTraceEnabled()) {
                synLog.traceTrace("Message : " + synCtx.getEnvelope());
            }
        }

        if (!(synCtx instanceof Axis2MessageContext)) {
            synLog.traceOrDebug("Only axis2 message contexts are supported");

        } else {
            Axis2MessageContext axis2MessageCtx = (Axis2MessageContext) synCtx;
            org.apache.axis2.context.MessageContext orgMessageCtx =
                axis2MessageCtx.getAxis2MessageContext();

            cleanupSequenceMap();

            String version = getVersionValue();
            orgMessageCtx.getOptions().setProperty(
                SandeshaClientConstants.RM_SPEC_VERSION, version);

            // always we need to start a new sequence if there is an terminated sequence
            orgMessageCtx.getOptions().setProperty(
                        SandeshaClientConstants.AUTO_START_NEW_SEQUENCE, "true");

            if (isSingle()) {
                orgMessageCtx.getOptions().setProperty(
                    SandeshaClientConstants.LAST_MESSAGE, "true");

                if (synLog.isTraceOrDebugEnabled()) {
                    synLog.traceOrDebug("Using WS-RM version " + version);
                }

            } else {

                String correlationValue = getCorrelationValue(synCtx);
                boolean lastMessage = isLastMessage(synCtx);
                String offeredSeqID = null;

                if (!sequenceMap.containsKey(correlationValue)) {
                    offeredSeqID = UIDGenerator.generateURNString();
                    orgMessageCtx.getOptions().setProperty(
                        SandeshaClientConstants.OFFERED_SEQUENCE_ID, offeredSeqID);
                }

                String sequenceID = retrieveSequenceID(correlationValue);
                orgMessageCtx.getOptions().setProperty(
                    SandeshaClientConstants.SEQUENCE_KEY, sequenceID);

                if (lastMessage) {
                    orgMessageCtx.getOptions().setProperty(
                        SandeshaClientConstants.LAST_MESSAGE, "true");
                    sequenceMap.remove(correlationValue);
                }

                if (synLog.isTraceOrDebugEnabled()) {
                    synLog.traceOrDebug("Correlation value : " + correlationValue +
                            " last message = " + lastMessage + " using sequence : " + sequenceID +
                            (offeredSeqID != null ? " offering sequence : " + offeredSeqID : ""));
                }
            }
        }

        synLog.traceOrDebug("End : RMSequence mediator");
        return true;
    }
View Full Code Here

     * @param synCtx the current message
     * @return false always
     */
    public boolean mediate(MessageContext synCtx) {

         SynapseLog synLog = getLog(synCtx);

        if (synLog.isTraceOrDebugEnabled()) {
            synLog.traceOrDebug("Start : Drop mediator");

            if (synLog.isTraceTraceEnabled()) {
                synLog.traceTrace("Message : " + synCtx.getEnvelope());
            }
        }

        synCtx.setTo(null);

        // if this is a response , this the end of the outflow
        if (synCtx.isResponse()) {
            StatisticsReporter.reportForAllOnOutFlowEnd(synCtx);
        }

        if (synLog.isTraceOrDebugEnabled()) {
            synLog.traceOrDebug("End : Drop mediator");
        }

        return false;
    }
View Full Code Here

        }
    }

    public boolean mediate(MessageContext synCtx) {

        SynapseLog synLog = getLog(synCtx);

        if (synLog.isTraceOrDebugEnabled()) {
            synLog.traceOrDebug("Start : Cache mediator");

            if (synLog.isTraceTraceEnabled()) {
                synLog.traceTrace("Message : " + synCtx.getEnvelope());
            }
        }

        // if maxMessageSize is specified check for the message size before processing
        if (maxMessageSize > 0) {
            FixedByteArrayOutputStream fbaos = new FixedByteArrayOutputStream(maxMessageSize);
            try {
                MessageHelper.cloneSOAPEnvelope(synCtx.getEnvelope()).serialize(fbaos);
            } catch (XMLStreamException e) {
                handleException("Error in checking the message size", e, synCtx);
            } catch (SynapseException syne) {
                synLog.traceOrDebug("Message size exceeds the upper bound for caching, " +
                            "request will not be cached");
                return true;
            }
        }

        ConfigurationContext cfgCtx =
            ((Axis2MessageContext) synCtx).getAxis2MessageContext().getConfigurationContext();
        if (cfgCtx == null) {
            handleException("Unable to perform caching, "
                + " ConfigurationContext cannot be found", synCtx);
            return false; // never executes.. but keeps IDE happy
        }

        if (synLog.isTraceOrDebugEnabled()) {
            synLog.traceOrDebug("Looking up cache at scope : " + scope + " with ID : "
                    + cacheKey);
        }

        // look up cache
        Object prop = cfgCtx.getPropertyNonReplicable(CachingConstants.CACHE_MANAGER);
        CacheManager cacheManager;
        if (prop != null && prop instanceof CacheManager) {
            cacheManager = (CacheManager) prop;
        } else {
            synchronized (cfgCtx) {
                // check again after taking the lock to make sure no one else did it before us
                prop = cfgCtx.getPropertyNonReplicable(CachingConstants.CACHE_MANAGER);
                if (prop != null && prop instanceof CacheManager) {
                    cacheManager = (CacheManager) prop;

                } else {
                    synLog.traceOrDebug("Creating/recreating the cache object");
                    cacheManager = new CacheManager();
                    cfgCtx.setProperty(CachingConstants.CACHE_MANAGER, cacheManager);
                }
            }
        }

        boolean result = true;
        try {

            if (synCtx.isResponse()) {
                processResponseMessage(synCtx, cfgCtx, synLog, cacheManager);

            } else {
                result = processRequestMessage(synCtx, cfgCtx, synLog, cacheManager);
            }

        } catch (ClusteringFault clusteringFault) {
            synLog.traceOrDebug("Unable to replicate Cache mediator state among the cluster");
        }

        synLog.traceOrDebug("End : Cache mediator");

        return result;
    }
View Full Code Here

     * @param synCtx the message context
     * @return true always
     */
    public boolean mediate(MessageContext synCtx) {

        SynapseLog synLog = getLog(synCtx);

        if (synLog.isTraceOrDebugEnabled()) {
            synLog.traceOrDebug("Start : Property mediator");

            if (synLog.isTraceTraceEnabled()) {
                synLog.traceTrace("Message : " + synCtx.getEnvelope());
            }
        }

        if (action == ACTION_SET) {

            Object resultValue = getResultValue(synCtx);

            // if the result value is a String we can apply a reguar expression to
            // choose part of it
            if (resultValue instanceof String && pattern != null) {
                resultValue = getMatchedValue((String) resultValue, synLog);
            }

            if (synLog.isTraceOrDebugEnabled()) {
                synLog.traceOrDebug("Setting property : " + name + " at scope : " +
                    (scope == null ? "default" : scope) + " to : " + resultValue + " (i.e. " +
                    (value != null ? "constant : " + value :
                          "result of expression : " + expression) + ")");
            }

            if (scope == null || XMLConfigConstants.SCOPE_DEFAULT.equals(scope)) {
                //Setting property into the  Synapse Context
                synCtx.setProperty(name, resultValue);

            } else if (XMLConfigConstants.SCOPE_AXIS2.equals(scope)
                    && synCtx instanceof Axis2MessageContext) {
                //Setting property into the  Axis2 Message Context
                Axis2MessageContext axis2smc = (Axis2MessageContext) synCtx;
                org.apache.axis2.context.MessageContext axis2MessageCtx =
                        axis2smc.getAxis2MessageContext();
                axis2MessageCtx.setProperty(name, resultValue);

            } else if (XMLConfigConstants.SCOPE_CLIENT.equals(scope)
                    && synCtx instanceof Axis2MessageContext) {
                //Setting property into the  Axis2 Message Context client options
                Axis2MessageContext axis2smc = (Axis2MessageContext) synCtx;
                org.apache.axis2.context.MessageContext axis2MessageCtx =
                        axis2smc.getAxis2MessageContext();
                axis2MessageCtx.getOptions().setProperty(name, resultValue);

            } else if (XMLConfigConstants.SCOPE_TRANSPORT.equals(scope)
                    && synCtx instanceof Axis2MessageContext) {
                //Setting Transport Headers
                Axis2MessageContext axis2smc = (Axis2MessageContext) synCtx;
                org.apache.axis2.context.MessageContext axis2MessageCtx =
                        axis2smc.getAxis2MessageContext();
                Object headers = axis2MessageCtx.getProperty(
                        org.apache.axis2.context.MessageContext.TRANSPORT_HEADERS);

                if (headers != null && headers instanceof Map) {
                    Map headersMap = (Map) headers;
                    headersMap.put(name, resultValue);
                }
                if (headers == null) {
                    Map headersMap = new HashMap();
                    headersMap.put(name, resultValue);
                    axis2MessageCtx.setProperty(
                            org.apache.axis2.context.MessageContext.TRANSPORT_HEADERS,
                            headersMap);
                }
            }

        } else {
            if (synLog.isTraceOrDebugEnabled()) {
                synLog.traceOrDebug("Removing property : " + name +
                    " (scope:" + (scope == null ? "default" : scope) + ")");
            }

            if (scope == null || XMLConfigConstants.SCOPE_DEFAULT.equals(scope)) {
                //Removing property from the  Synapse Context
                Set pros = synCtx.getPropertyKeySet();
                if (pros != null) {
                    pros.remove(name);
                }

            } else if ((XMLConfigConstants.SCOPE_AXIS2.equals(scope) ||
                XMLConfigConstants.SCOPE_CLIENT.equals(scope))
                && synCtx instanceof Axis2MessageContext) {
               
                //Removing property from the Axis2 Message Context
                Axis2MessageContext axis2smc = (Axis2MessageContext) synCtx;
                org.apache.axis2.context.MessageContext axis2MessageCtx =
                        axis2smc.getAxis2MessageContext();
                axis2MessageCtx.removeProperty(name);

            } else if (XMLConfigConstants.SCOPE_TRANSPORT.equals(scope)
                    && synCtx instanceof Axis2MessageContext) {
                // Removing transport headers
                Axis2MessageContext axis2smc = (Axis2MessageContext) synCtx;
                org.apache.axis2.context.MessageContext axis2MessageCtx =
                        axis2smc.getAxis2MessageContext();
                Object headers = axis2MessageCtx.getProperty(
                        org.apache.axis2.context.MessageContext.TRANSPORT_HEADERS);
                if (headers != null && headers instanceof Map) {
                    Map headersMap = (Map) headers;
                    headersMap.remove(name);
                } else {
                    synLog.traceOrDebug("No transport headers found for the message");
                }
            }
        }
        synLog.traceOrDebug("End : Property mediator");
        return true;
    }
View Full Code Here

    private int priority = 0;

    private String sequenceName = null;

    public boolean mediate(MessageContext synCtx) {
        SynapseLog log = getLog(synCtx);
        if (log.isTraceOrDebugEnabled()) {
            log.traceOrDebug("Start: enqueue mediator");
        }

        assert executorName != null : "executor name shouldn't be null";

        PriorityExecutor executor = synCtx.getConfiguration().
                getPriorityExecutors().get(executorName);
        if (executor == null) {
            handleException("executor cannot be found for the name : " + executorName, synCtx);
            return false;
        }


        Mediator m = synCtx.getSequence(sequenceName);
        if (m != null && m instanceof SequenceMediator) {
            MediatorWorker worker = new MediatorWorker(m, synCtx);
            // execute with the given priority
            executor.execute(worker, priority);

            // with the nio transport, this causes the listener not to write a 202
            // Accepted response, as this implies that Synapse does not yet know if
            // a 202 or 200 response would be written back.
            ((Axis2MessageContext) synCtx).getAxis2MessageContext().getOperationContext().setProperty(
                    org.apache.axis2.Constants.RESPONSE_WRITTEN, "SKIP");

            if (log.isTraceOrDebugEnabled()) {
                log.traceOrDebug("End: enqueue mediator");
            }

            return true;
        } else {
            handleException("Sequence cannot be found : " + sequenceName, synCtx);
View Full Code Here

     * @param synCtx (current) message to be logged
     * @return true always
     */
    public boolean mediate(MessageContext synCtx) {

        SynapseLog synLog = getLog(synCtx);

        if (synLog.isTraceOrDebugEnabled()) {
            synLog.traceOrDebug("Start : Log mediator");

            if (synLog.isTraceTraceEnabled()) {
                synLog.traceTrace("Message : " + synCtx.getEnvelope());
            }
        }

        switch (category) {
            case CATEGORY_INFO :
                synLog.auditLog(getLogMessage(synCtx));
                break;
            case CATEGORY_TRACE :
                synLog.auditTrace(getLogMessage(synCtx));
                break;
            case CATEGORY_DEBUG :
                synLog.auditDebug(getLogMessage(synCtx));
                break;
            case CATEGORY_WARN :
                synLog.auditWarn(getLogMessage(synCtx));
                break;
            case CATEGORY_ERROR :
                synLog.auditError(getLogMessage(synCtx));
                break;
            case CATEGORY_FATAL :
                synLog.auditFatal(getLogMessage(synCtx));
                break;
        }

        synLog.traceOrDebug("End : Log mediator");
        return true;
    }
View Full Code Here

     * @param synCtx the current message to be sent
     * @return false always as this is a leaf mediator
     */
    public boolean mediate(MessageContext synCtx) {

        SynapseLog synLog = getLog(synCtx);

        synLog.traceOrDebug("Start : Send mediator");
        if (synLog.isTraceTraceEnabled()) {
            synLog.traceTrace("Message : " + synCtx.getEnvelope());
        }

        // if no endpoints are defined, send where implicitly stated
        if (endpoint == null) {

            if (synLog.isTraceOrDebugEnabled()) {
                StringBuffer sb = new StringBuffer();
                sb.append("Sending ").append(synCtx.isResponse() ? "response" : "request")
                        .append(" message using implicit message properties..");
                sb.append("\nSending To: ").append(synCtx.getTo() != null ?
                        synCtx.getTo().getAddress() : "null");
                sb.append("\nSOAPAction: ").append(synCtx.getWSAAction() != null ?
                        synCtx.getWSAAction() : "null");
                synLog.traceOrDebug(sb.toString());
            }

            if (synLog.isTraceTraceEnabled()) {
                synLog.traceTrace("Envelope : " + synCtx.getEnvelope());
            }
            synCtx.getEnvironment().send(null, synCtx);

        } else {
            endpoint.send(synCtx);
        }

        synLog.traceOrDebug("End : Send mediator");

        return true;
    }
View Full Code Here

TOP

Related Classes of org.apache.synapse.SynapseLog

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.