You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@synapse.apache.org by as...@apache.org on 2007/03/17 17:18:47 UTC

svn commit: r519363 [7/16] - in /webservices/synapse/trunk/java: modules/core/ modules/core/src/main/java/org/apache/synapse/ modules/core/src/main/java/org/apache/synapse/config/ modules/core/src/main/java/org/apache/synapse/config/xml/ modules/core/s...

Modified: webservices/synapse/trunk/java/modules/core/src/main/java/org/apache/synapse/mediators/ext/ClassMediator.java
URL: http://svn.apache.org/viewvc/webservices/synapse/trunk/java/modules/core/src/main/java/org/apache/synapse/mediators/ext/ClassMediator.java?view=diff&rev=519363&r1=519362&r2=519363
==============================================================================
--- webservices/synapse/trunk/java/modules/core/src/main/java/org/apache/synapse/mediators/ext/ClassMediator.java (original)
+++ webservices/synapse/trunk/java/modules/core/src/main/java/org/apache/synapse/mediators/ext/ClassMediator.java Sat Mar 17 09:18:32 2007
@@ -1,146 +1,146 @@
-/*
- *  Licensed to the Apache Software Foundation (ASF) under one
- *  or more contributor license agreements.  See the NOTICE file
- *  distributed with this work for additional information
- *  regarding copyright ownership.  The ASF licenses this file
- *  to you under the Apache License, Version 2.0 (the
- *  "License"); you may not use this file except in compliance
- *  with the License.  You may obtain a copy of the License at
- *
- *   http://www.apache.org/licenses/LICENSE-2.0
- *
- *  Unless required by applicable law or agreed to in writing,
- *  software distributed under the License is distributed on an
- *   * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- *  KIND, either express or implied.  See the License for the
- *  specific language governing permissions and limitations
- *  under the License.
- */
-
-package org.apache.synapse.mediators.ext;
-
-import org.apache.commons.logging.Log;
-import org.apache.commons.logging.LogFactory;
-import org.apache.synapse.Constants;
-import org.apache.synapse.Mediator;
-import org.apache.synapse.MessageContext;
-import org.apache.synapse.SynapseException;
-import org.apache.synapse.core.axis2.Axis2MessageContext;
-import org.apache.synapse.mediators.AbstractMediator;
-import org.apache.synapse.mediators.MediatorProperty;
-
-import java.lang.reflect.Method;
-import java.util.ArrayList;
-import java.util.Iterator;
-import java.util.List;
-
-/**
- * The class mediator delegates the mediation to a new instance of a specified class. The specified class
- * must implement the Mediator interface
- *
- * @see Mediator
- */
-public class ClassMediator extends AbstractMediator {
-
-    private static final Log log = LogFactory.getLog(ClassMediator.class);
-    private static final Log trace = LogFactory.getLog(Constants.TRACE_LOGGER);
-
-    private Class clazz = null;
-    private List properties = new ArrayList();
-
-    /**
-     * Delegate mediation to a new instance of the specified class
-     *
-     * @param synCtx the message context
-     * @return as per standard semantics
-     */
-    public boolean mediate(MessageContext synCtx) {
-
-        log.debug("Class mediator <" + clazz.getName() + ">:: mediate()");
-        boolean shouldTrace = shouldTrace(synCtx.getTracingState());
-        if (shouldTrace) {
-            trace.trace("Start : Class mediator");
-        }
-        Mediator m ;
-        try {
-            try {
-                m = (Mediator) clazz.newInstance();
-            } catch (Exception e) {
-                String msg = "Error while creating an instance of the specified mediator class : " + clazz.getName();
-                if (shouldTrace)
-                    trace.trace(msg);
-                log.error(msg, e);
-                throw new SynapseException(msg, e);
-            }
-
-            setProperties(m, synCtx, shouldTrace);
-            if (shouldTrace) {
-                trace.trace("Executing an instance of the specified class : " + clazz.getName());
-            }
-            return m.mediate(synCtx);
-        } finally {
-            if (shouldTrace) {
-                trace.trace("End : Class mediator");
-            }
-        }
-    }
-
-    /**
-     * Only String properties are supported
-     *
-     * @param m the mediator
-     */
-    private void setProperties(Mediator m, MessageContext synCtx, boolean shouldTrace) {
-
-        Iterator iter = properties.iterator();
-        while (iter.hasNext()) {
-
-            MediatorProperty mProp = (MediatorProperty) iter.next();
-
-            String mName = "set" + Character.toUpperCase(mProp.getName().charAt(0)) + mProp.getName().substring(1);
-            String value = (mProp.getValue() != null ?
-                mProp.getValue() :
-                Axis2MessageContext.getStringValue(mProp.getExpression(), synCtx));
-
-            try {
-                if (value != null) {
-                    Method method = m.getClass().getMethod(mName, new Class[]{String.class});
-                    log.debug("Setting property :: invoking method " + mName + "(" + value + ")");
-                    if (shouldTrace) {
-                        trace.trace("Setting property :: invoking method " + mName + "(" + value + ")");
-                    }
-                    method.invoke(m, new Object[]{value});
-                }
-            } catch (Exception e) {
-                String msg = "Error setting property : " + mProp.getName() + " as a String property into class" +
-                    " mediator : " + m.getClass() + " : " + e.getMessage();
-                log.error(msg);
-                if (shouldTrace) {
-                    trace.trace(msg);
-                }
-                throw new SynapseException(msg, e);
-            }
-        }
-    }
-
-    public void setClazz(Class clazz) {
-        this.clazz = clazz;
-    }
-
-    public Class getClazz() {
-        return clazz;
-    }
-
-    public void addProperty(MediatorProperty p) {
-        properties.add(p);
-    }
-
-    public void addAllProperties(List list) {
-        properties.addAll(list);
-    }
-
-    public List getProperties() {
-        return properties;
-    }
-
-}
+/*
+ *  Licensed to the Apache Software Foundation (ASF) under one
+ *  or more contributor license agreements.  See the NOTICE file
+ *  distributed with this work for additional information
+ *  regarding copyright ownership.  The ASF licenses this file
+ *  to you under the Apache License, Version 2.0 (the
+ *  "License"); you may not use this file except in compliance
+ *  with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ *  Unless required by applicable law or agreed to in writing,
+ *  software distributed under the License is distributed on an
+ *   * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ *  KIND, either express or implied.  See the License for the
+ *  specific language governing permissions and limitations
+ *  under the License.
+ */
+
+package org.apache.synapse.mediators.ext;
+
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+import org.apache.synapse.Constants;
+import org.apache.synapse.Mediator;
+import org.apache.synapse.MessageContext;
+import org.apache.synapse.SynapseException;
+import org.apache.synapse.core.axis2.Axis2MessageContext;
+import org.apache.synapse.mediators.AbstractMediator;
+import org.apache.synapse.mediators.MediatorProperty;
+
+import java.lang.reflect.Method;
+import java.util.ArrayList;
+import java.util.Iterator;
+import java.util.List;
+
+/**
+ * The class mediator delegates the mediation to a new instance of a specified class. The specified class
+ * must implement the Mediator interface
+ *
+ * @see Mediator
+ */
+public class ClassMediator extends AbstractMediator {
+
+    private static final Log log = LogFactory.getLog(ClassMediator.class);
+    private static final Log trace = LogFactory.getLog(Constants.TRACE_LOGGER);
+
+    private Class clazz = null;
+    private List properties = new ArrayList();
+
+    /**
+     * Delegate mediation to a new instance of the specified class
+     *
+     * @param synCtx the message context
+     * @return as per standard semantics
+     */
+    public boolean mediate(MessageContext synCtx) {
+
+        log.debug("Class mediator <" + clazz.getName() + ">:: mediate()");
+        boolean shouldTrace = shouldTrace(synCtx.getTracingState());
+        if (shouldTrace) {
+            trace.trace("Start : Class mediator");
+        }
+        Mediator m ;
+        try {
+            try {
+                m = (Mediator) clazz.newInstance();
+            } catch (Exception e) {
+                String msg = "Error while creating an instance of the specified mediator class : " + clazz.getName();
+                if (shouldTrace)
+                    trace.trace(msg);
+                log.error(msg, e);
+                throw new SynapseException(msg, e);
+            }
+
+            setProperties(m, synCtx, shouldTrace);
+            if (shouldTrace) {
+                trace.trace("Executing an instance of the specified class : " + clazz.getName());
+            }
+            return m.mediate(synCtx);
+        } finally {
+            if (shouldTrace) {
+                trace.trace("End : Class mediator");
+            }
+        }
+    }
+
+    /**
+     * Only String properties are supported
+     *
+     * @param m the mediator
+     */
+    private void setProperties(Mediator m, MessageContext synCtx, boolean shouldTrace) {
+
+        Iterator iter = properties.iterator();
+        while (iter.hasNext()) {
+
+            MediatorProperty mProp = (MediatorProperty) iter.next();
+
+            String mName = "set" + Character.toUpperCase(mProp.getName().charAt(0)) + mProp.getName().substring(1);
+            String value = (mProp.getValue() != null ?
+                mProp.getValue() :
+                Axis2MessageContext.getStringValue(mProp.getExpression(), synCtx));
+
+            try {
+                if (value != null) {
+                    Method method = m.getClass().getMethod(mName, new Class[]{String.class});
+                    log.debug("Setting property :: invoking method " + mName + "(" + value + ")");
+                    if (shouldTrace) {
+                        trace.trace("Setting property :: invoking method " + mName + "(" + value + ")");
+                    }
+                    method.invoke(m, new Object[]{value});
+                }
+            } catch (Exception e) {
+                String msg = "Error setting property : " + mProp.getName() + " as a String property into class" +
+                    " mediator : " + m.getClass() + " : " + e.getMessage();
+                log.error(msg);
+                if (shouldTrace) {
+                    trace.trace(msg);
+                }
+                throw new SynapseException(msg, e);
+            }
+        }
+    }
+
+    public void setClazz(Class clazz) {
+        this.clazz = clazz;
+    }
+
+    public Class getClazz() {
+        return clazz;
+    }
+
+    public void addProperty(MediatorProperty p) {
+        properties.add(p);
+    }
+
+    public void addAllProperties(List list) {
+        properties.addAll(list);
+    }
+
+    public List getProperties() {
+        return properties;
+    }
+
+}

Propchange: webservices/synapse/trunk/java/modules/core/src/main/java/org/apache/synapse/mediators/ext/ClassMediator.java
------------------------------------------------------------------------------
    svn:eol-style = native

Modified: webservices/synapse/trunk/java/modules/core/src/main/java/org/apache/synapse/mediators/filters/FilterMediator.java
URL: http://svn.apache.org/viewvc/webservices/synapse/trunk/java/modules/core/src/main/java/org/apache/synapse/mediators/filters/FilterMediator.java?view=diff&rev=519363&r1=519362&r2=519363
==============================================================================
--- webservices/synapse/trunk/java/modules/core/src/main/java/org/apache/synapse/mediators/filters/FilterMediator.java (original)
+++ webservices/synapse/trunk/java/modules/core/src/main/java/org/apache/synapse/mediators/filters/FilterMediator.java Sat Mar 17 09:18:32 2007
@@ -1,147 +1,147 @@
-/*
- *  Licensed to the Apache Software Foundation (ASF) under one
- *  or more contributor license agreements.  See the NOTICE file
- *  distributed with this work for additional information
- *  regarding copyright ownership.  The ASF licenses this file
- *  to you under the Apache License, Version 2.0 (the
- *  "License"); you may not use this file except in compliance
- *  with the License.  You may obtain a copy of the License at
- *
- *   http://www.apache.org/licenses/LICENSE-2.0
- *
- *  Unless required by applicable law or agreed to in writing,
- *  software distributed under the License is distributed on an
- *   * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- *  KIND, either express or implied.  See the License for the
- *  specific language governing permissions and limitations
- *  under the License.
- */
-
-package org.apache.synapse.mediators.filters;
-
-import org.apache.axiom.om.xpath.AXIOMXPath;
-import org.apache.commons.logging.Log;
-import org.apache.commons.logging.LogFactory;
-import org.apache.synapse.Constants;
-import org.apache.synapse.MessageContext;
-import org.apache.synapse.core.axis2.Axis2MessageContext;
-import org.apache.synapse.mediators.AbstractListMediator;
-import org.jaxen.JaxenException;
-
-import java.util.regex.Pattern;
-import java.util.regex.Matcher;
-
-/**
- * The filter mediator combines the regex and xpath filtering functionality. If an xpath
- * is set, it is evaluated; else the given regex is evaluated against the source xpath.
- */
-public class FilterMediator extends AbstractListMediator implements org.apache.synapse.mediators.FilterMediator {
-
-    private static final Log log = LogFactory.getLog(FilterMediator.class);
-    private static final Log trace = LogFactory.getLog(Constants.TRACE_LOGGER);
-    private AXIOMXPath source = null;
-    private Pattern regex = null;
-    private AXIOMXPath xpath = null;
-
-    /**
-     * Executes the list of sub/child mediators, if the filter condition is satisfied
-     *
-     * @param synCtx the current message
-     * @return true if filter condition fails. else returns as per List mediator semantics
-     */
-    public boolean mediate(MessageContext synCtx) {
-        log.debug("Filter mediator mediate()");
-
-        boolean shouldTrace = shouldTrace(synCtx.getTracingState());
-        try {
-            if (shouldTrace) {
-                trace.trace("Start : Filter mediator ");
-            }
-            if (test(synCtx)) {
-                log.debug("Filter condition satisfied.. executing child mediators");
-                return super.mediate(synCtx);
-            } else {
-                log.debug("Filter condition failed.. will skip executing child mediators");
-                return true;
-            }
-        } finally {
-            if (shouldTrace) {
-                trace.trace("End : Filter mediator ");
-            }
-        }
-    }
-
-    /**
-     * Tests the supplied condition after evaluation against the given XPath
-     * or Regex (against a source XPath). When a regular expression is supplied
-     * the source XPath is evaluated into a String value, and matched against
-     * the given regex
-     *
-     * @param synCtx the current message for evaluation of the test condition
-     * @return true if evaluation of the XPath/Regex results in true
-     */
-    public boolean test(MessageContext synCtx) {
-        try {
-            if (xpath != null) {
-                log.debug("Evaluating XPath expression : " + xpath);
-                if (shouldTrace(synCtx.getTracingState())) {
-                    trace.trace("XPath expression : " + xpath + " evaluates to : " +
-                        xpath.booleanValueOf(synCtx.getEnvelope()));
-                }
-                return xpath.booleanValueOf(synCtx.getEnvelope());
-
-            } else if (source != null && regex != null) {
-                log.debug("Evaluating regular expression : " + regex.pattern() + " against source : " + source);
-                String sourceString = Axis2MessageContext.getStringValue(source, synCtx);
-                if (sourceString == null) {
-                    log.warn("Source String has been evaluated to Null");
-                    return false;
-                }
-                if (shouldTrace(synCtx.getTracingState())) {
-                    trace.trace("Regular expression : " + regex.pattern() + " and Source " +
-                            sourceString + " matches : " + regex.matcher(sourceString).matches());
-                }
-                Matcher matcher = regex.matcher(sourceString);
-                if (matcher == null) {
-                    log.warn("Can not find a Regex Pattren Matcher");
-                    return false;
-                }
-                return matcher.matches();
-
-            } else {
-                log.error("Invalid configuration specified");
-                return false;
-            }
-
-        } catch (JaxenException e) {
-            log.error("XPath error : " + e.getMessage());
-            return false;
-        }
-    }
-
-
-    public AXIOMXPath getSource() {
-        return source;
-    }
-
-    public void setSource(AXIOMXPath source) {
-        this.source = source;
-    }
-
-    public Pattern getRegex() {
-        return regex;
-    }
-
-    public void setRegex(Pattern regex) {
-        this.regex = regex;
-    }
-
-    public AXIOMXPath getXpath() {
-        return xpath;
-    }
-
-    public void setXpath(AXIOMXPath xpath) {
-        this.xpath = xpath;
-    }
-
-}
+/*
+ *  Licensed to the Apache Software Foundation (ASF) under one
+ *  or more contributor license agreements.  See the NOTICE file
+ *  distributed with this work for additional information
+ *  regarding copyright ownership.  The ASF licenses this file
+ *  to you under the Apache License, Version 2.0 (the
+ *  "License"); you may not use this file except in compliance
+ *  with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ *  Unless required by applicable law or agreed to in writing,
+ *  software distributed under the License is distributed on an
+ *   * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ *  KIND, either express or implied.  See the License for the
+ *  specific language governing permissions and limitations
+ *  under the License.
+ */
+
+package org.apache.synapse.mediators.filters;
+
+import org.apache.axiom.om.xpath.AXIOMXPath;
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+import org.apache.synapse.Constants;
+import org.apache.synapse.MessageContext;
+import org.apache.synapse.core.axis2.Axis2MessageContext;
+import org.apache.synapse.mediators.AbstractListMediator;
+import org.jaxen.JaxenException;
+
+import java.util.regex.Pattern;
+import java.util.regex.Matcher;
+
+/**
+ * The filter mediator combines the regex and xpath filtering functionality. If an xpath
+ * is set, it is evaluated; else the given regex is evaluated against the source xpath.
+ */
+public class FilterMediator extends AbstractListMediator implements org.apache.synapse.mediators.FilterMediator {
+
+    private static final Log log = LogFactory.getLog(FilterMediator.class);
+    private static final Log trace = LogFactory.getLog(Constants.TRACE_LOGGER);
+    private AXIOMXPath source = null;
+    private Pattern regex = null;
+    private AXIOMXPath xpath = null;
+
+    /**
+     * Executes the list of sub/child mediators, if the filter condition is satisfied
+     *
+     * @param synCtx the current message
+     * @return true if filter condition fails. else returns as per List mediator semantics
+     */
+    public boolean mediate(MessageContext synCtx) {
+        log.debug("Filter mediator mediate()");
+
+        boolean shouldTrace = shouldTrace(synCtx.getTracingState());
+        try {
+            if (shouldTrace) {
+                trace.trace("Start : Filter mediator ");
+            }
+            if (test(synCtx)) {
+                log.debug("Filter condition satisfied.. executing child mediators");
+                return super.mediate(synCtx);
+            } else {
+                log.debug("Filter condition failed.. will skip executing child mediators");
+                return true;
+            }
+        } finally {
+            if (shouldTrace) {
+                trace.trace("End : Filter mediator ");
+            }
+        }
+    }
+
+    /**
+     * Tests the supplied condition after evaluation against the given XPath
+     * or Regex (against a source XPath). When a regular expression is supplied
+     * the source XPath is evaluated into a String value, and matched against
+     * the given regex
+     *
+     * @param synCtx the current message for evaluation of the test condition
+     * @return true if evaluation of the XPath/Regex results in true
+     */
+    public boolean test(MessageContext synCtx) {
+        try {
+            if (xpath != null) {
+                log.debug("Evaluating XPath expression : " + xpath);
+                if (shouldTrace(synCtx.getTracingState())) {
+                    trace.trace("XPath expression : " + xpath + " evaluates to : " +
+                        xpath.booleanValueOf(synCtx.getEnvelope()));
+                }
+                return xpath.booleanValueOf(synCtx.getEnvelope());
+
+            } else if (source != null && regex != null) {
+                log.debug("Evaluating regular expression : " + regex.pattern() + " against source : " + source);
+                String sourceString = Axis2MessageContext.getStringValue(source, synCtx);
+                if (sourceString == null) {
+                    log.warn("Source String has been evaluated to Null");
+                    return false;
+                }
+                if (shouldTrace(synCtx.getTracingState())) {
+                    trace.trace("Regular expression : " + regex.pattern() + " and Source " +
+                            sourceString + " matches : " + regex.matcher(sourceString).matches());
+                }
+                Matcher matcher = regex.matcher(sourceString);
+                if (matcher == null) {
+                    log.warn("Can not find a Regex Pattren Matcher");
+                    return false;
+                }
+                return matcher.matches();
+
+            } else {
+                log.error("Invalid configuration specified");
+                return false;
+            }
+
+        } catch (JaxenException e) {
+            log.error("XPath error : " + e.getMessage());
+            return false;
+        }
+    }
+
+
+    public AXIOMXPath getSource() {
+        return source;
+    }
+
+    public void setSource(AXIOMXPath source) {
+        this.source = source;
+    }
+
+    public Pattern getRegex() {
+        return regex;
+    }
+
+    public void setRegex(Pattern regex) {
+        this.regex = regex;
+    }
+
+    public AXIOMXPath getXpath() {
+        return xpath;
+    }
+
+    public void setXpath(AXIOMXPath xpath) {
+        this.xpath = xpath;
+    }
+
+}

Propchange: webservices/synapse/trunk/java/modules/core/src/main/java/org/apache/synapse/mediators/filters/FilterMediator.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: webservices/synapse/trunk/java/modules/core/src/main/java/org/apache/synapse/mediators/filters/InMediator.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: webservices/synapse/trunk/java/modules/core/src/main/java/org/apache/synapse/mediators/filters/OutMediator.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: webservices/synapse/trunk/java/modules/core/src/main/java/org/apache/synapse/mediators/filters/SwitchMediator.java
------------------------------------------------------------------------------
    svn:eol-style = native

Modified: webservices/synapse/trunk/java/modules/core/src/main/java/org/apache/synapse/mediators/transform/FaultMediator.java
URL: http://svn.apache.org/viewvc/webservices/synapse/trunk/java/modules/core/src/main/java/org/apache/synapse/mediators/transform/FaultMediator.java?view=diff&rev=519363&r1=519362&r2=519363
==============================================================================
--- webservices/synapse/trunk/java/modules/core/src/main/java/org/apache/synapse/mediators/transform/FaultMediator.java (original)
+++ webservices/synapse/trunk/java/modules/core/src/main/java/org/apache/synapse/mediators/transform/FaultMediator.java Sat Mar 17 09:18:32 2007
@@ -1,313 +1,313 @@
-/*
- *  Licensed to the Apache Software Foundation (ASF) under one
- *  or more contributor license agreements.  See the NOTICE file
- *  distributed with this work for additional information
- *  regarding copyright ownership.  The ASF licenses this file
- *  to you under the Apache License, Version 2.0 (the
- *  "License"); you may not use this file except in compliance
- *  with the License.  You may obtain a copy of the License at
- *
- *   http://www.apache.org/licenses/LICENSE-2.0
- *
- *  Unless required by applicable law or agreed to in writing,
- *  software distributed under the License is distributed on an
- *   * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- *  KIND, either express or implied.  See the License for the
- *  specific language governing permissions and limitations
- *  under the License.
- */
-
-package org.apache.synapse.mediators.transform;
-
-import org.apache.axiom.om.OMAbstractFactory;
-import org.apache.axiom.om.OMDocument;
-import org.apache.axiom.om.OMElement;
-import org.apache.axiom.om.xpath.AXIOMXPath;
-import org.apache.axiom.soap.*;
-import org.apache.axis2.AxisFault;
-import org.apache.axis2.addressing.EndpointReference;
-import org.apache.commons.logging.Log;
-import org.apache.commons.logging.LogFactory;
-import org.apache.synapse.MessageContext;
-import org.apache.synapse.SynapseException;
-import org.apache.synapse.Constants;
-import org.apache.synapse.core.axis2.Axis2MessageContext;
-import org.apache.synapse.mediators.AbstractMediator;
-
-import javax.xml.namespace.QName;
-import java.net.URI;
-import java.util.Iterator;
-
-/**
- * This transforms the current message instance into a SOAP Fault message. The
- * SOAP version for the fault message could be explicitly specified. Else if the
- * original message was SOAP 1.1 the fault will also be SOAP 1.1 else, SOAP 1.2
- *
- * This class exposes methods to set SOAP 1.1 and 1.2 fault elements and uses
- * these as required.
- */
-public class FaultMediator extends AbstractMediator {
-
-    private static final Log log = LogFactory.getLog(FaultMediator.class);
-    private static final Log trace = LogFactory.getLog(Constants.TRACE_LOGGER);
-    public static final String WSA_ACTION = "Action";
-    /** Make a SOAP 1.1 fault */
-    public static final int SOAP11 = 1;
-    /** Make a SOAP 1.2 fault */
-    public static final int SOAP12 = 2;
-    /** Holds the SOAP version to be used to make the fault, if specified */
-    private int soapVersion;
-
-    // -- fault elements --
-    /** The fault code QName to be used */
-    private QName faultCodeValue = null;
-    /** An XPath expression that will give the fault code QName at runtime */
-    private AXIOMXPath faultCodeExpr = null;
-    /** The fault reason to be used */
-    private String faultReasonValue = null;
-    /** An XPath expression that will give the fault reason string at runtime */
-    private AXIOMXPath faultReasonExpr = null;
-    /** The fault node URI to be used */
-    private URI faultNode = null;
-    /** The fault role URI to be used - if applicable */
-    private URI faultRole = null;
-    /** The fault detail to be used */
-    private String faultDetail = null;
-
-    public boolean mediate(MessageContext synCtx) {
-        log.debug("Fault mediator mediate()");
-        boolean shouldTrace = shouldTrace(synCtx.getTracingState());
-        SOAPEnvelope envelop = synCtx.getEnvelope();
-        if(shouldTrace) {
-            trace.trace("Start : Fault mediator");
-        }
-        switch (soapVersion) {
-            case SOAP11:
-                return makeSOAPFault(synCtx, SOAP11,shouldTrace);
-            case SOAP12:
-                return makeSOAPFault(synCtx, SOAP12,shouldTrace);
-            default : {
-                if (envelop != null) {
-                    if (SOAP12Constants.SOAP_ENVELOPE_NAMESPACE_URI.equals(
-                        envelop.getNamespace().getNamespaceURI())) {
-                        return makeSOAPFault(synCtx, SOAP12,shouldTrace);
-                    } else {
-                        return makeSOAPFault(synCtx, SOAP11,shouldTrace);
-                    }
-                } else {
-                    return makeSOAPFault(synCtx, SOAP11,shouldTrace);
-                }
-            }
-        }
-    }
-
-    private boolean makeSOAPFault(MessageContext synCtx, int soapVersion,boolean shouldTrace) {
-
-        log.debug("Creating a SOAP fault using SOAP " + (soapVersion == SOAP11 ? "1.1" : "1.2"));
-        // get the correct SOAP factory to be used
-        SOAPFactory factory = (
-            soapVersion == SOAP11 ? OMAbstractFactory.getSOAP11Factory() : OMAbstractFactory.getSOAP12Factory());
-
-        // create the SOAP fault document and envelope
-        OMDocument soapFaultDocument = factory.createOMDocument();
-        SOAPEnvelope faultEnvelope = factory.getDefaultFaultEnvelope();
-        soapFaultDocument.addChild(faultEnvelope);
-
-        // create the fault element  if it is need 
-        SOAPFault fault = faultEnvelope.getBody().getFault();
-        if(fault == null){
-            fault = factory.createSOAPFault();
-        }
-
-        // populate it
-        setFaultCode(synCtx, factory, fault);
-        setFaultResaon(synCtx, factory, fault);
-        setFaultNode(factory, fault);
-        setFaultRole(factory, fault);
-        setFaultDetail(factory, fault);
-
-        // set the all headers of griginal SOAP Envelope to the Fault Envelope
-        Iterator iter = synCtx.getEnvelope().getHeader().examineAllHeaderBlocks();
-        if (iter.hasNext()) {
-            while (iter.hasNext()) {
-                Object o = iter.next();
-                if (o instanceof SOAPHeaderBlock) {
-                    SOAPHeaderBlock header = (SOAPHeaderBlock) o;
-                    faultEnvelope.getHeader().addChild(header);
-                } else if (o instanceof OMElement) {
-                    faultEnvelope.getHeader().addChild((OMElement) o);
-                }
-            }
-        }
-        log.debug("The fault message as : " + fault);
-        // overwrite current message envelope with new fault envelope
-        try {
-            if (shouldTrace) {
-                trace.trace("Original SOAP Message : " + synCtx.getEnvelope().toString());
-                trace.trace("Fault Message created : " + faultEnvelope.toString());
-            }
-            synCtx.setEnvelope(faultEnvelope);
-        } catch (AxisFault af) {
-            String msg = "Error replacing SOAP envelope with a fault envelope " + af.getMessage();
-            log.error(msg);
-            throw new SynapseException(af);
-        }
-        if (shouldTrace) {
-            trace.trace("End : Fault mediator");
-        }
-        return true;
-    }
-
-    private void setFaultCode(MessageContext synCtx, SOAPFactory factory, SOAPFault fault) {
-
-        QName fault_code = null;
-
-        if (faultCodeValue == null && faultCodeExpr == null) {
-            handleException("A valid fault code QName value or expression is required");
-        } else if (faultCodeValue != null) {
-            fault_code = faultCodeValue;
-        } else {
-            fault_code = QName.valueOf(Axis2MessageContext.getStringValue(faultCodeExpr, synCtx));
-        }
-
-        SOAPFaultCode code = factory.createSOAPFaultCode();
-        SOAPFaultValue value = factory.createSOAPFaultValue(code);
-        value.setText(fault_code);
-        fault.setCode(code);
-    }
-
-    private void setFaultResaon(MessageContext synCtx, SOAPFactory factory, SOAPFault fault) {
-        String reasonString = null;
-
-        if (faultReasonValue == null && faultReasonExpr == null) {
-            handleException("A valid fault reason value or expression is required");
-        } else if (faultReasonValue != null) {
-            reasonString = faultReasonValue;
-        } else {
-            reasonString = Axis2MessageContext.getStringValue(faultReasonExpr, synCtx);
-        }
-
-        SOAPFaultReason reason = factory.createSOAPFaultReason();
-        SOAPFaultText text = factory.createSOAPFaultText();
-        text.setText(reasonString);
-        reason.addSOAPText(text);
-        fault.setReason(reason);
-    }
-
-    private void setFaultNode(SOAPFactory factory, SOAPFault fault) {
-        if (faultNode != null) {
-            SOAPFaultNode faultNode = factory.createSOAPFaultNode();
-            faultNode.setNodeValue(faultNode.toString());
-            fault.setNode(faultNode);
-        }
-    }
-
-    private void setFaultRole(SOAPFactory factory, SOAPFault fault) {
-        if (faultRole != null) {
-            SOAPFaultRole soapFaultRole = factory.createSOAPFaultRole();
-            soapFaultRole.setRoleValue(faultRole.toString());
-            fault.setRole(soapFaultRole);
-        }
-    }
-
-    private void setFaultDetail(SOAPFactory factory, SOAPFault fault) {
-        if (faultDetail != null) {
-            SOAPFaultDetail soapFaultDetail = factory.createSOAPFaultDetail();
-            soapFaultDetail.setText(faultDetail);
-            fault.setDetail(soapFaultDetail);
-        }
-    }
-
-    private void handleException(String msg) {
-        log.error(msg);
-        throw new SynapseException(msg);
-    }
-
-    public int getSoapVersion() {
-        return soapVersion;
-    }
-
-    public void setSoapVersion(int soapVersion) {
-        this.soapVersion = soapVersion;
-    }
-
-    public QName getFaultCodeValue() {
-        return faultCodeValue;
-    }
-
-    public void setFaultCodeValue(QName faultCodeValue) {
-
-        if (soapVersion == SOAP11) {
-            this.faultCodeValue = faultCodeValue;
-
-        } else {
-            if (
-                SOAP12Constants.SOAP_ENVELOPE_NAMESPACE_URI.equals(faultCodeValue.getNamespaceURI()) &&
-
-                (SOAP12Constants.FAULT_CODE_DATA_ENCODING_UNKNOWN.equals(faultCodeValue.getLocalPart()) ||
-                SOAP12Constants.FAULT_CODE_MUST_UNDERSTAND.equals(faultCodeValue.getLocalPart()) ||
-                SOAP12Constants.FAULT_CODE_RECEIVER.equals(faultCodeValue.getLocalPart()) ||
-                SOAP12Constants.FAULT_CODE_SENDER.equals(faultCodeValue.getLocalPart()) ||
-                SOAP12Constants.FAULT_CODE_VERSION_MISMATCH.equals(faultCodeValue.getLocalPart())) ){
-
-                this.faultCodeValue = faultCodeValue;
-
-            } else {
-                String msg = "Invalid Fault code value for a SOAP 1.2 fault : " + faultCodeValue;
-                log.error(msg);
-                throw new SynapseException(msg);
-            }
-        }
-    }
-
-    public AXIOMXPath getFaultCodeExpr() {
-        return faultCodeExpr;
-    }
-
-    public void setFaultCodeExpr(AXIOMXPath faultCodeExpr) {
-        this.faultCodeExpr = faultCodeExpr;
-    }
-
-    public String getFaultReasonValue() {
-        return faultReasonValue;
-    }
-
-    public void setFaultReasonValue(String faultReasonValue) {
-        this.faultReasonValue = faultReasonValue;
-    }
-
-    public AXIOMXPath getFaultReasonExpr() {
-        return faultReasonExpr;
-    }
-
-    public void setFaultReasonExpr(AXIOMXPath faultReasonExpr) {
-        this.faultReasonExpr = faultReasonExpr;
-    }
-
-    public URI getFaultNode() {
-        return faultNode;
-    }
-
-    public void setFaultNode(URI faultNode) {
-        if (soapVersion == SOAP11) {
-            handleException("A fault node does not apply to a SOAP 1.1 fault");
-        }
-        this.faultNode = faultNode;
-    }
-
-    public URI getFaultRole() {
-        return faultRole;
-    }
-
-    public void setFaultRole(URI faultRole) {
-        this.faultRole = faultRole;
-    }
-
-    public String getFaultDetail() {
-        return faultDetail;
-    }
-
-    public void setFaultDetail(String faultDetail) {
-        this.faultDetail = faultDetail;
-    }
-}
+/*
+ *  Licensed to the Apache Software Foundation (ASF) under one
+ *  or more contributor license agreements.  See the NOTICE file
+ *  distributed with this work for additional information
+ *  regarding copyright ownership.  The ASF licenses this file
+ *  to you under the Apache License, Version 2.0 (the
+ *  "License"); you may not use this file except in compliance
+ *  with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ *  Unless required by applicable law or agreed to in writing,
+ *  software distributed under the License is distributed on an
+ *   * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ *  KIND, either express or implied.  See the License for the
+ *  specific language governing permissions and limitations
+ *  under the License.
+ */
+
+package org.apache.synapse.mediators.transform;
+
+import org.apache.axiom.om.OMAbstractFactory;
+import org.apache.axiom.om.OMDocument;
+import org.apache.axiom.om.OMElement;
+import org.apache.axiom.om.xpath.AXIOMXPath;
+import org.apache.axiom.soap.*;
+import org.apache.axis2.AxisFault;
+import org.apache.axis2.addressing.EndpointReference;
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+import org.apache.synapse.MessageContext;
+import org.apache.synapse.SynapseException;
+import org.apache.synapse.Constants;
+import org.apache.synapse.core.axis2.Axis2MessageContext;
+import org.apache.synapse.mediators.AbstractMediator;
+
+import javax.xml.namespace.QName;
+import java.net.URI;
+import java.util.Iterator;
+
+/**
+ * This transforms the current message instance into a SOAP Fault message. The
+ * SOAP version for the fault message could be explicitly specified. Else if the
+ * original message was SOAP 1.1 the fault will also be SOAP 1.1 else, SOAP 1.2
+ *
+ * This class exposes methods to set SOAP 1.1 and 1.2 fault elements and uses
+ * these as required.
+ */
+public class FaultMediator extends AbstractMediator {
+
+    private static final Log log = LogFactory.getLog(FaultMediator.class);
+    private static final Log trace = LogFactory.getLog(Constants.TRACE_LOGGER);
+    public static final String WSA_ACTION = "Action";
+    /** Make a SOAP 1.1 fault */
+    public static final int SOAP11 = 1;
+    /** Make a SOAP 1.2 fault */
+    public static final int SOAP12 = 2;
+    /** Holds the SOAP version to be used to make the fault, if specified */
+    private int soapVersion;
+
+    // -- fault elements --
+    /** The fault code QName to be used */
+    private QName faultCodeValue = null;
+    /** An XPath expression that will give the fault code QName at runtime */
+    private AXIOMXPath faultCodeExpr = null;
+    /** The fault reason to be used */
+    private String faultReasonValue = null;
+    /** An XPath expression that will give the fault reason string at runtime */
+    private AXIOMXPath faultReasonExpr = null;
+    /** The fault node URI to be used */
+    private URI faultNode = null;
+    /** The fault role URI to be used - if applicable */
+    private URI faultRole = null;
+    /** The fault detail to be used */
+    private String faultDetail = null;
+
+    public boolean mediate(MessageContext synCtx) {
+        log.debug("Fault mediator mediate()");
+        boolean shouldTrace = shouldTrace(synCtx.getTracingState());
+        SOAPEnvelope envelop = synCtx.getEnvelope();
+        if(shouldTrace) {
+            trace.trace("Start : Fault mediator");
+        }
+        switch (soapVersion) {
+            case SOAP11:
+                return makeSOAPFault(synCtx, SOAP11,shouldTrace);
+            case SOAP12:
+                return makeSOAPFault(synCtx, SOAP12,shouldTrace);
+            default : {
+                if (envelop != null) {
+                    if (SOAP12Constants.SOAP_ENVELOPE_NAMESPACE_URI.equals(
+                        envelop.getNamespace().getNamespaceURI())) {
+                        return makeSOAPFault(synCtx, SOAP12,shouldTrace);
+                    } else {
+                        return makeSOAPFault(synCtx, SOAP11,shouldTrace);
+                    }
+                } else {
+                    return makeSOAPFault(synCtx, SOAP11,shouldTrace);
+                }
+            }
+        }
+    }
+
+    private boolean makeSOAPFault(MessageContext synCtx, int soapVersion,boolean shouldTrace) {
+
+        log.debug("Creating a SOAP fault using SOAP " + (soapVersion == SOAP11 ? "1.1" : "1.2"));
+        // get the correct SOAP factory to be used
+        SOAPFactory factory = (
+            soapVersion == SOAP11 ? OMAbstractFactory.getSOAP11Factory() : OMAbstractFactory.getSOAP12Factory());
+
+        // create the SOAP fault document and envelope
+        OMDocument soapFaultDocument = factory.createOMDocument();
+        SOAPEnvelope faultEnvelope = factory.getDefaultFaultEnvelope();
+        soapFaultDocument.addChild(faultEnvelope);
+
+        // create the fault element  if it is need 
+        SOAPFault fault = faultEnvelope.getBody().getFault();
+        if(fault == null){
+            fault = factory.createSOAPFault();
+        }
+
+        // populate it
+        setFaultCode(synCtx, factory, fault);
+        setFaultResaon(synCtx, factory, fault);
+        setFaultNode(factory, fault);
+        setFaultRole(factory, fault);
+        setFaultDetail(factory, fault);
+
+        // set the all headers of griginal SOAP Envelope to the Fault Envelope
+        Iterator iter = synCtx.getEnvelope().getHeader().examineAllHeaderBlocks();
+        if (iter.hasNext()) {
+            while (iter.hasNext()) {
+                Object o = iter.next();
+                if (o instanceof SOAPHeaderBlock) {
+                    SOAPHeaderBlock header = (SOAPHeaderBlock) o;
+                    faultEnvelope.getHeader().addChild(header);
+                } else if (o instanceof OMElement) {
+                    faultEnvelope.getHeader().addChild((OMElement) o);
+                }
+            }
+        }
+        log.debug("The fault message as : " + fault);
+        // overwrite current message envelope with new fault envelope
+        try {
+            if (shouldTrace) {
+                trace.trace("Original SOAP Message : " + synCtx.getEnvelope().toString());
+                trace.trace("Fault Message created : " + faultEnvelope.toString());
+            }
+            synCtx.setEnvelope(faultEnvelope);
+        } catch (AxisFault af) {
+            String msg = "Error replacing SOAP envelope with a fault envelope " + af.getMessage();
+            log.error(msg);
+            throw new SynapseException(af);
+        }
+        if (shouldTrace) {
+            trace.trace("End : Fault mediator");
+        }
+        return true;
+    }
+
+    private void setFaultCode(MessageContext synCtx, SOAPFactory factory, SOAPFault fault) {
+
+        QName fault_code = null;
+
+        if (faultCodeValue == null && faultCodeExpr == null) {
+            handleException("A valid fault code QName value or expression is required");
+        } else if (faultCodeValue != null) {
+            fault_code = faultCodeValue;
+        } else {
+            fault_code = QName.valueOf(Axis2MessageContext.getStringValue(faultCodeExpr, synCtx));
+        }
+
+        SOAPFaultCode code = factory.createSOAPFaultCode();
+        SOAPFaultValue value = factory.createSOAPFaultValue(code);
+        value.setText(fault_code);
+        fault.setCode(code);
+    }
+
+    private void setFaultResaon(MessageContext synCtx, SOAPFactory factory, SOAPFault fault) {
+        String reasonString = null;
+
+        if (faultReasonValue == null && faultReasonExpr == null) {
+            handleException("A valid fault reason value or expression is required");
+        } else if (faultReasonValue != null) {
+            reasonString = faultReasonValue;
+        } else {
+            reasonString = Axis2MessageContext.getStringValue(faultReasonExpr, synCtx);
+        }
+
+        SOAPFaultReason reason = factory.createSOAPFaultReason();
+        SOAPFaultText text = factory.createSOAPFaultText();
+        text.setText(reasonString);
+        reason.addSOAPText(text);
+        fault.setReason(reason);
+    }
+
+    private void setFaultNode(SOAPFactory factory, SOAPFault fault) {
+        if (faultNode != null) {
+            SOAPFaultNode faultNode = factory.createSOAPFaultNode();
+            faultNode.setNodeValue(faultNode.toString());
+            fault.setNode(faultNode);
+        }
+    }
+
+    private void setFaultRole(SOAPFactory factory, SOAPFault fault) {
+        if (faultRole != null) {
+            SOAPFaultRole soapFaultRole = factory.createSOAPFaultRole();
+            soapFaultRole.setRoleValue(faultRole.toString());
+            fault.setRole(soapFaultRole);
+        }
+    }
+
+    private void setFaultDetail(SOAPFactory factory, SOAPFault fault) {
+        if (faultDetail != null) {
+            SOAPFaultDetail soapFaultDetail = factory.createSOAPFaultDetail();
+            soapFaultDetail.setText(faultDetail);
+            fault.setDetail(soapFaultDetail);
+        }
+    }
+
+    private void handleException(String msg) {
+        log.error(msg);
+        throw new SynapseException(msg);
+    }
+
+    public int getSoapVersion() {
+        return soapVersion;
+    }
+
+    public void setSoapVersion(int soapVersion) {
+        this.soapVersion = soapVersion;
+    }
+
+    public QName getFaultCodeValue() {
+        return faultCodeValue;
+    }
+
+    public void setFaultCodeValue(QName faultCodeValue) {
+
+        if (soapVersion == SOAP11) {
+            this.faultCodeValue = faultCodeValue;
+
+        } else {
+            if (
+                SOAP12Constants.SOAP_ENVELOPE_NAMESPACE_URI.equals(faultCodeValue.getNamespaceURI()) &&
+
+                (SOAP12Constants.FAULT_CODE_DATA_ENCODING_UNKNOWN.equals(faultCodeValue.getLocalPart()) ||
+                SOAP12Constants.FAULT_CODE_MUST_UNDERSTAND.equals(faultCodeValue.getLocalPart()) ||
+                SOAP12Constants.FAULT_CODE_RECEIVER.equals(faultCodeValue.getLocalPart()) ||
+                SOAP12Constants.FAULT_CODE_SENDER.equals(faultCodeValue.getLocalPart()) ||
+                SOAP12Constants.FAULT_CODE_VERSION_MISMATCH.equals(faultCodeValue.getLocalPart())) ){
+
+                this.faultCodeValue = faultCodeValue;
+
+            } else {
+                String msg = "Invalid Fault code value for a SOAP 1.2 fault : " + faultCodeValue;
+                log.error(msg);
+                throw new SynapseException(msg);
+            }
+        }
+    }
+
+    public AXIOMXPath getFaultCodeExpr() {
+        return faultCodeExpr;
+    }
+
+    public void setFaultCodeExpr(AXIOMXPath faultCodeExpr) {
+        this.faultCodeExpr = faultCodeExpr;
+    }
+
+    public String getFaultReasonValue() {
+        return faultReasonValue;
+    }
+
+    public void setFaultReasonValue(String faultReasonValue) {
+        this.faultReasonValue = faultReasonValue;
+    }
+
+    public AXIOMXPath getFaultReasonExpr() {
+        return faultReasonExpr;
+    }
+
+    public void setFaultReasonExpr(AXIOMXPath faultReasonExpr) {
+        this.faultReasonExpr = faultReasonExpr;
+    }
+
+    public URI getFaultNode() {
+        return faultNode;
+    }
+
+    public void setFaultNode(URI faultNode) {
+        if (soapVersion == SOAP11) {
+            handleException("A fault node does not apply to a SOAP 1.1 fault");
+        }
+        this.faultNode = faultNode;
+    }
+
+    public URI getFaultRole() {
+        return faultRole;
+    }
+
+    public void setFaultRole(URI faultRole) {
+        this.faultRole = faultRole;
+    }
+
+    public String getFaultDetail() {
+        return faultDetail;
+    }
+
+    public void setFaultDetail(String faultDetail) {
+        this.faultDetail = faultDetail;
+    }
+}

Propchange: webservices/synapse/trunk/java/modules/core/src/main/java/org/apache/synapse/mediators/transform/FaultMediator.java
------------------------------------------------------------------------------
    svn:eol-style = native

Modified: webservices/synapse/trunk/java/modules/core/src/main/java/org/apache/synapse/mediators/transform/HeaderMediator.java
URL: http://svn.apache.org/viewvc/webservices/synapse/trunk/java/modules/core/src/main/java/org/apache/synapse/mediators/transform/HeaderMediator.java?view=diff&rev=519363&r1=519362&r2=519363
==============================================================================
--- webservices/synapse/trunk/java/modules/core/src/main/java/org/apache/synapse/mediators/transform/HeaderMediator.java (original)
+++ webservices/synapse/trunk/java/modules/core/src/main/java/org/apache/synapse/mediators/transform/HeaderMediator.java Sat Mar 17 09:18:32 2007
@@ -1,186 +1,186 @@
-/*
- *  Licensed to the Apache Software Foundation (ASF) under one
- *  or more contributor license agreements.  See the NOTICE file
- *  distributed with this work for additional information
- *  regarding copyright ownership.  The ASF licenses this file
- *  to you under the Apache License, Version 2.0 (the
- *  "License"); you may not use this file except in compliance
- *  with the License.  You may obtain a copy of the License at
- *
- *   http://www.apache.org/licenses/LICENSE-2.0
- *
- *  Unless required by applicable law or agreed to in writing,
- *  software distributed under the License is distributed on an
- *   * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- *  KIND, either express or implied.  See the License for the
- *  specific language governing permissions and limitations
- *  under the License.
- */
-
-package org.apache.synapse.mediators.transform;
-
-import org.apache.axiom.om.xpath.AXIOMXPath;
-import org.apache.axiom.om.OMElement;
-import org.apache.axiom.soap.SOAPHeaderBlock;
-import org.apache.commons.logging.Log;
-import org.apache.commons.logging.LogFactory;
-import org.apache.synapse.*;
-import org.apache.synapse.core.axis2.Axis2MessageContext;
-import org.apache.synapse.mediators.AbstractMediator;
-import org.apache.axis2.addressing.EndpointReference;
-
-import javax.xml.namespace.QName;
-import java.util.List;
-import java.util.Iterator;
-
-/**
- * The header mediator is able to set a given value as a SOAP header, or remove a given
- * header from the current message instance. This supports the headers currently
- * supported by the HeaderType class. If an expression is supplied, its runtime value
- * is evaluated using the current message. Unless the action is set to remove, the
- * default behaviour of this mediator is to set a header value.
- */
-public class HeaderMediator extends AbstractMediator {
-
-    private static final Log log = LogFactory.getLog(HeaderMediator.class);
-    private static final Log trace = LogFactory.getLog(Constants.TRACE_LOGGER);
-    public static final int ACTION_SET = 0;
-    public static final int ACTION_REMOVE = 1;
-
-    /** The qName of the header @see HeaderType */
-    private QName qName = null;
-    /** The literal value to be set as the header (if one was specified) */
-    private String value = null;
-    /** Set the header (ACTION_SET) or remove it (ACTION_REMOVE). Defaults to ACTION_SET */
-    private int action = ACTION_SET;
-    /** An expression which should be evaluated, and the result set as the header value */
-    private AXIOMXPath expression = null;
-
-    /**
-     * Sets/Removes a SOAP header on the current message
-     *
-     * @param synCtx the current message which is altered as necessary
-     * @return true always
-     */
-    public boolean mediate(MessageContext synCtx) {
-        log.debug("Header mediator <" + (action == ACTION_SET ? "Set" : "Remove") + "> :: mediate()");
-        boolean shouldTrace = shouldTrace(synCtx.getTracingState());
-        if(shouldTrace) {
-            trace.trace("Start : Header mediator, action = " +
-                (action == ACTION_SET ? "set" : "remove"));
-        }
-        if (action == ACTION_SET) {
-            String value = (getValue() != null ? getValue() :
-                Axis2MessageContext.getStringValue(getExpression(), synCtx));
-
-            log.debug("Setting header : " + qName + " to : " + value);
-            if(shouldTrace) {
-                trace.trace("Set Header : " + qName + " to : " + value);
-            }
-            if (qName.getNamespaceURI() == null || "".equals(qName.getNamespaceURI())) {
-                if (Constants.HEADER_TO.equals(qName.getLocalPart())) {
-                    synCtx.setTo(new EndpointReference(value));
-                } else if (Constants.HEADER_FROM.equals(qName.getLocalPart())){
-                    synCtx.setFrom(new EndpointReference(value));
-                } else if (Constants.HEADER_ACTION.equals(qName.getLocalPart())) {
-                    synCtx.setWSAAction(value);
-                } else if (Constants.HEADER_FAULT.equals(qName.getLocalPart())) {
-                    synCtx.setFaultTo(new EndpointReference(value));
-                } else if (Constants.HEADER_REPLY_TO.equals(qName.getLocalPart())) {
-                    synCtx.setReplyTo(new EndpointReference(value));
-                } else {
-                    handleException("Unsupported header : " + qName.getLocalPart());
-                }
-            }
-
-        } else {
-            log.debug("Removing header : " + qName + " from current message");
-
-            if (shouldTrace) {
-                trace.trace("Remove Header : " + qName);
-            }
-
-            if (qName.getNamespaceURI() == null || "".equals(qName.getNamespaceURI())) {
-                if (Constants.HEADER_TO.equals(qName.getLocalPart())) {
-                    synCtx.setTo(null);
-                } else if (Constants.HEADER_FROM.equals(qName.getLocalPart())){
-                    synCtx.setFrom(null);
-                } else if (Constants.HEADER_ACTION.equals(qName.getLocalPart())) {
-                    synCtx.setWSAAction(null);
-                } else if (Constants.HEADER_FAULT.equals(qName.getLocalPart())) {
-                    synCtx.setFaultTo(null);
-                } else if (Constants.HEADER_REPLY_TO.equals(qName.getLocalPart())) {
-                    synCtx.setReplyTo(null);
-                } else {
-                    removeFromHeaderList(synCtx.getEnvelope().getHeader().getHeaderBlocksWithNSURI(""));
-                }                
-            } else {
-                removeFromHeaderList(synCtx.getEnvelope().getHeader().
-                    getHeaderBlocksWithNSURI(qName.getNamespaceURI()));
-            }
-        }
-        if (shouldTrace) {
-            trace.trace("End : Header mediator");
-        }
-        return true;
-    }
-
-    private void removeFromHeaderList(List headersList) {
-        if (headersList == null || headersList.isEmpty()) {
-            return;
-        }
-        
-        Iterator iter = headersList.iterator();
-        while (iter.hasNext()) {
-            Object o = iter.next();
-            if (o instanceof SOAPHeaderBlock) {
-                SOAPHeaderBlock header = (SOAPHeaderBlock) o;
-                if (header.getLocalName().equals(qName.getLocalPart())) {
-                    header.detach();
-                }
-            } else if (o instanceof OMElement) {
-                OMElement omElem = (OMElement) o;
-                if (omElem.getLocalName().equals(qName.getLocalPart())) {
-                    omElem.detach();
-                }
-            }
-        }
-    }
-
-    public int getAction() {
-        return action;
-    }
-
-    public void setAction(int action) {
-        this.action = action;
-    }
-
-    public QName getQName() {
-        return qName;
-    }
-
-    public void setQName(QName qName) {
-        this.qName = qName;
-    }
-
-    public String getValue() {
-        return value;
-    }
-
-    public void setValue(String value) {
-        this.value = value;
-    }
-
-    public AXIOMXPath getExpression() {
-        return expression;
-    }
-
-    public void setExpression(AXIOMXPath expression) {
-        this.expression = expression;
-    }
-
-    private void handleException(String msg) {
-        log.error(msg);
-        throw new SynapseException(msg);
-    }
-}
+/*
+ *  Licensed to the Apache Software Foundation (ASF) under one
+ *  or more contributor license agreements.  See the NOTICE file
+ *  distributed with this work for additional information
+ *  regarding copyright ownership.  The ASF licenses this file
+ *  to you under the Apache License, Version 2.0 (the
+ *  "License"); you may not use this file except in compliance
+ *  with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ *  Unless required by applicable law or agreed to in writing,
+ *  software distributed under the License is distributed on an
+ *   * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ *  KIND, either express or implied.  See the License for the
+ *  specific language governing permissions and limitations
+ *  under the License.
+ */
+
+package org.apache.synapse.mediators.transform;
+
+import org.apache.axiom.om.xpath.AXIOMXPath;
+import org.apache.axiom.om.OMElement;
+import org.apache.axiom.soap.SOAPHeaderBlock;
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+import org.apache.synapse.*;
+import org.apache.synapse.core.axis2.Axis2MessageContext;
+import org.apache.synapse.mediators.AbstractMediator;
+import org.apache.axis2.addressing.EndpointReference;
+
+import javax.xml.namespace.QName;
+import java.util.List;
+import java.util.Iterator;
+
+/**
+ * The header mediator is able to set a given value as a SOAP header, or remove a given
+ * header from the current message instance. This supports the headers currently
+ * supported by the HeaderType class. If an expression is supplied, its runtime value
+ * is evaluated using the current message. Unless the action is set to remove, the
+ * default behaviour of this mediator is to set a header value.
+ */
+public class HeaderMediator extends AbstractMediator {
+
+    private static final Log log = LogFactory.getLog(HeaderMediator.class);
+    private static final Log trace = LogFactory.getLog(Constants.TRACE_LOGGER);
+    public static final int ACTION_SET = 0;
+    public static final int ACTION_REMOVE = 1;
+
+    /** The qName of the header @see HeaderType */
+    private QName qName = null;
+    /** The literal value to be set as the header (if one was specified) */
+    private String value = null;
+    /** Set the header (ACTION_SET) or remove it (ACTION_REMOVE). Defaults to ACTION_SET */
+    private int action = ACTION_SET;
+    /** An expression which should be evaluated, and the result set as the header value */
+    private AXIOMXPath expression = null;
+
+    /**
+     * Sets/Removes a SOAP header on the current message
+     *
+     * @param synCtx the current message which is altered as necessary
+     * @return true always
+     */
+    public boolean mediate(MessageContext synCtx) {
+        log.debug("Header mediator <" + (action == ACTION_SET ? "Set" : "Remove") + "> :: mediate()");
+        boolean shouldTrace = shouldTrace(synCtx.getTracingState());
+        if(shouldTrace) {
+            trace.trace("Start : Header mediator, action = " +
+                (action == ACTION_SET ? "set" : "remove"));
+        }
+        if (action == ACTION_SET) {
+            String value = (getValue() != null ? getValue() :
+                Axis2MessageContext.getStringValue(getExpression(), synCtx));
+
+            log.debug("Setting header : " + qName + " to : " + value);
+            if(shouldTrace) {
+                trace.trace("Set Header : " + qName + " to : " + value);
+            }
+            if (qName.getNamespaceURI() == null || "".equals(qName.getNamespaceURI())) {
+                if (Constants.HEADER_TO.equals(qName.getLocalPart())) {
+                    synCtx.setTo(new EndpointReference(value));
+                } else if (Constants.HEADER_FROM.equals(qName.getLocalPart())){
+                    synCtx.setFrom(new EndpointReference(value));
+                } else if (Constants.HEADER_ACTION.equals(qName.getLocalPart())) {
+                    synCtx.setWSAAction(value);
+                } else if (Constants.HEADER_FAULT.equals(qName.getLocalPart())) {
+                    synCtx.setFaultTo(new EndpointReference(value));
+                } else if (Constants.HEADER_REPLY_TO.equals(qName.getLocalPart())) {
+                    synCtx.setReplyTo(new EndpointReference(value));
+                } else {
+                    handleException("Unsupported header : " + qName.getLocalPart());
+                }
+            }
+
+        } else {
+            log.debug("Removing header : " + qName + " from current message");
+
+            if (shouldTrace) {
+                trace.trace("Remove Header : " + qName);
+            }
+
+            if (qName.getNamespaceURI() == null || "".equals(qName.getNamespaceURI())) {
+                if (Constants.HEADER_TO.equals(qName.getLocalPart())) {
+                    synCtx.setTo(null);
+                } else if (Constants.HEADER_FROM.equals(qName.getLocalPart())){
+                    synCtx.setFrom(null);
+                } else if (Constants.HEADER_ACTION.equals(qName.getLocalPart())) {
+                    synCtx.setWSAAction(null);
+                } else if (Constants.HEADER_FAULT.equals(qName.getLocalPart())) {
+                    synCtx.setFaultTo(null);
+                } else if (Constants.HEADER_REPLY_TO.equals(qName.getLocalPart())) {
+                    synCtx.setReplyTo(null);
+                } else {
+                    removeFromHeaderList(synCtx.getEnvelope().getHeader().getHeaderBlocksWithNSURI(""));
+                }                
+            } else {
+                removeFromHeaderList(synCtx.getEnvelope().getHeader().
+                    getHeaderBlocksWithNSURI(qName.getNamespaceURI()));
+            }
+        }
+        if (shouldTrace) {
+            trace.trace("End : Header mediator");
+        }
+        return true;
+    }
+
+    private void removeFromHeaderList(List headersList) {
+        if (headersList == null || headersList.isEmpty()) {
+            return;
+        }
+        
+        Iterator iter = headersList.iterator();
+        while (iter.hasNext()) {
+            Object o = iter.next();
+            if (o instanceof SOAPHeaderBlock) {
+                SOAPHeaderBlock header = (SOAPHeaderBlock) o;
+                if (header.getLocalName().equals(qName.getLocalPart())) {
+                    header.detach();
+                }
+            } else if (o instanceof OMElement) {
+                OMElement omElem = (OMElement) o;
+                if (omElem.getLocalName().equals(qName.getLocalPart())) {
+                    omElem.detach();
+                }
+            }
+        }
+    }
+
+    public int getAction() {
+        return action;
+    }
+
+    public void setAction(int action) {
+        this.action = action;
+    }
+
+    public QName getQName() {
+        return qName;
+    }
+
+    public void setQName(QName qName) {
+        this.qName = qName;
+    }
+
+    public String getValue() {
+        return value;
+    }
+
+    public void setValue(String value) {
+        this.value = value;
+    }
+
+    public AXIOMXPath getExpression() {
+        return expression;
+    }
+
+    public void setExpression(AXIOMXPath expression) {
+        this.expression = expression;
+    }
+
+    private void handleException(String msg) {
+        log.error(msg);
+        throw new SynapseException(msg);
+    }
+}

Propchange: webservices/synapse/trunk/java/modules/core/src/main/java/org/apache/synapse/mediators/transform/HeaderMediator.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: webservices/synapse/trunk/java/modules/core/src/main/java/org/apache/synapse/metrics/Constants.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: webservices/synapse/trunk/java/modules/core/src/main/java/org/apache/synapse/metrics/Counter.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: webservices/synapse/trunk/java/modules/core/src/main/java/org/apache/synapse/metrics/GlobalRequestCountHandler.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: webservices/synapse/trunk/java/modules/core/src/main/java/org/apache/synapse/metrics/MetricsAggregatorModule.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: webservices/synapse/trunk/java/modules/core/src/main/java/org/apache/synapse/registry/AbstractRegistry.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: webservices/synapse/trunk/java/modules/core/src/main/java/org/apache/synapse/registry/Registry.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: webservices/synapse/trunk/java/modules/core/src/main/java/org/apache/synapse/registry/RegistryEntry.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: webservices/synapse/trunk/java/modules/core/src/main/java/org/apache/synapse/registry/url/SimpleURLRegistry.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: webservices/synapse/trunk/java/modules/core/src/main/java/org/apache/synapse/registry/url/URLRegistryEntry.java
------------------------------------------------------------------------------
    svn:eol-style = native

Modified: webservices/synapse/trunk/java/modules/core/src/main/java/org/apache/synapse/statistics/Statistics.java
URL: http://svn.apache.org/viewvc/webservices/synapse/trunk/java/modules/core/src/main/java/org/apache/synapse/statistics/Statistics.java?view=diff&rev=519363&r1=519362&r2=519363
==============================================================================
--- webservices/synapse/trunk/java/modules/core/src/main/java/org/apache/synapse/statistics/Statistics.java (original)
+++ webservices/synapse/trunk/java/modules/core/src/main/java/org/apache/synapse/statistics/Statistics.java Sat Mar 17 09:18:32 2007
@@ -1,100 +1,100 @@
-/*
- *  Licensed to the Apache Software Foundation (ASF) under one
- *  or more contributor license agreements.  See the NOTICE file
- *  distributed with this work for additional information
- *  regarding copyright ownership.  The ASF licenses this file
- *  to you under the Apache License, Version 2.0 (the
- *  "License"); you may not use this file except in compliance
- *  with the License.  You may obtain a copy of the License at
- *
- *   http://www.apache.org/licenses/LICENSE-2.0
- *
- *  Unless required by applicable law or agreed to in writing,
- *  software distributed under the License is distributed on an
- *   * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- *  KIND, either express or implied.  See the License for the
- *  specific language governing permissions and limitations
- *  under the License.
- */
-package org.apache.synapse.statistics;
-
-/**
- * The statistics data structure
- */
-
-public class Statistics {
-
-    /**  Maximum Processing time for a one way flow  */
-    private long maxProcessingTime = 0;
-    /** Minmum Processing time for a one way flow   */
-    private long minProcessingTime = -1;
-    /** Avarage Processing time for a one way flow */
-    private double avgProcessingTime = 0;
-    /** Total Processing time for a one way flow  */
-    private double totalProcessingTime;
-    /** The number of access count for a one way flow  */
-    private int count = 0;
-    /** The number of fault count for a one way flow  */
-    private int faultCount = 0;
-
-    /**
-     * Update the statistics
-     *
-     * @param inTime  - The processing start time
-     * @param outTime - The processing end time
-     * @param isFault - A boolean value that indicate whether falut has occured or not
-     */
-    public void update(long inTime, long outTime, boolean isFault) {
-        count++;
-        if (isFault) {
-            faultCount++;
-        }
-        long responseTime = outTime - inTime;
-        if (maxProcessingTime < responseTime) {
-            maxProcessingTime = responseTime;
-        }
-        if (minProcessingTime > responseTime) {
-            minProcessingTime = responseTime;
-        }
-        if (minProcessingTime == -1) {
-            minProcessingTime = responseTime;
-        }
-        totalProcessingTime = totalProcessingTime + responseTime;
-        avgProcessingTime = totalProcessingTime / count;
-    }
-
-    /**
-     * @return Returns the Maximum processing time
-     */
-    public long getMaxProcessingTime() {
-        return maxProcessingTime;
-    }
-
-    /**
-     * @return Returns the Avarage processing time
-     */
-    public double getAvgProcessingTime() {
-        return avgProcessingTime;
-    }
-
-    /**
-     * @return Returns the minimum processing time
-     */
-    public long getMinProcessingTime() {
-        return minProcessingTime;
-    }
-
-    /**
-     * @return Returns the fault count
-     */
-    public int getFaultCount() {
-        return faultCount;
-    }
-
-    /**
-     * @return Returns the total count that represents number of access in a one way flow
-     */
-    public int getCount() {
-        return count;
-    }
-}
+/*
+ *  Licensed to the Apache Software Foundation (ASF) under one
+ *  or more contributor license agreements.  See the NOTICE file
+ *  distributed with this work for additional information
+ *  regarding copyright ownership.  The ASF licenses this file
+ *  to you under the Apache License, Version 2.0 (the
+ *  "License"); you may not use this file except in compliance
+ *  with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ *  Unless required by applicable law or agreed to in writing,
+ *  software distributed under the License is distributed on an
+ *   * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ *  KIND, either express or implied.  See the License for the
+ *  specific language governing permissions and limitations
+ *  under the License.
+ */
+package org.apache.synapse.statistics;
+
+/**
+ * The statistics data structure
+ */
+
+public class Statistics {
+
+    /**  Maximum Processing time for a one way flow  */
+    private long maxProcessingTime = 0;
+    /** Minmum Processing time for a one way flow   */
+    private long minProcessingTime = -1;
+    /** Avarage Processing time for a one way flow */
+    private double avgProcessingTime = 0;
+    /** Total Processing time for a one way flow  */
+    private double totalProcessingTime;
+    /** The number of access count for a one way flow  */
+    private int count = 0;
+    /** The number of fault count for a one way flow  */
+    private int faultCount = 0;
+
+    /**
+     * Update the statistics
+     *
+     * @param inTime  - The processing start time
+     * @param outTime - The processing end time
+     * @param isFault - A boolean value that indicate whether falut has occured or not
+     */
+    public void update(long inTime, long outTime, boolean isFault) {
+        count++;
+        if (isFault) {
+            faultCount++;
+        }
+        long responseTime = outTime - inTime;
+        if (maxProcessingTime < responseTime) {
+            maxProcessingTime = responseTime;
+        }
+        if (minProcessingTime > responseTime) {
+            minProcessingTime = responseTime;
+        }
+        if (minProcessingTime == -1) {
+            minProcessingTime = responseTime;
+        }
+        totalProcessingTime = totalProcessingTime + responseTime;
+        avgProcessingTime = totalProcessingTime / count;
+    }
+
+    /**
+     * @return Returns the Maximum processing time
+     */
+    public long getMaxProcessingTime() {
+        return maxProcessingTime;
+    }
+
+    /**
+     * @return Returns the Avarage processing time
+     */
+    public double getAvgProcessingTime() {
+        return avgProcessingTime;
+    }
+
+    /**
+     * @return Returns the minimum processing time
+     */
+    public long getMinProcessingTime() {
+        return minProcessingTime;
+    }
+
+    /**
+     * @return Returns the fault count
+     */
+    public int getFaultCount() {
+        return faultCount;
+    }
+
+    /**
+     * @return Returns the total count that represents number of access in a one way flow
+     */
+    public int getCount() {
+        return count;
+    }
+}

Propchange: webservices/synapse/trunk/java/modules/core/src/main/java/org/apache/synapse/statistics/Statistics.java
------------------------------------------------------------------------------
    svn:eol-style = native

Modified: webservices/synapse/trunk/java/modules/core/src/main/java/org/apache/synapse/statistics/StatisticsCollector.java
URL: http://svn.apache.org/viewvc/webservices/synapse/trunk/java/modules/core/src/main/java/org/apache/synapse/statistics/StatisticsCollector.java?view=diff&rev=519363&r1=519362&r2=519363
==============================================================================
--- webservices/synapse/trunk/java/modules/core/src/main/java/org/apache/synapse/statistics/StatisticsCollector.java (original)
+++ webservices/synapse/trunk/java/modules/core/src/main/java/org/apache/synapse/statistics/StatisticsCollector.java Sat Mar 17 09:18:32 2007
@@ -1,127 +1,127 @@
-/*
- *  Licensed to the Apache Software Foundation (ASF) under one
- *  or more contributor license agreements.  See the NOTICE file
- *  distributed with this work for additional information
- *  regarding copyright ownership.  The ASF licenses this file
- *  to you under the Apache License, Version 2.0 (the
- *  "License"); you may not use this file except in compliance
- *  with the License.  You may obtain a copy of the License at
- *
- *   http://www.apache.org/licenses/LICENSE-2.0
- *
- *  Unless required by applicable law or agreed to in writing,
- *  software distributed under the License is distributed on an
- *   * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- *  KIND, either express or implied.  See the License for the
- *  specific language governing permissions and limitations
- *  under the License.
- */
-package org.apache.synapse.statistics;
-
-import org.apache.synapse.Constants;
-
-import java.util.*;
-
-/**
- * To collect statistics
- */
-
-public class StatisticsCollector {
-
-    /**  A synchronized map for holding sequence statistics  */
-    private Map sequenceStatistics = Collections.synchronizedMap(new HashMap());
-
-    /**  A synchronized map for holding end point statistics */
-    private Map endpointStatistics = Collections.synchronizedMap(new HashMap());
-
-    /**  A synchronized map for holding proxy services statistics */
-    private Map proxyServicesStatistics = Collections.synchronizedMap(new HashMap());
-
-    /**
-     * To report the statistics related to a  EndPonit
-     *
-     * @param keyOfStatistic - key for hold Statistic
-     * @param isResponse     - A boolean value that indicate whether message flow is in or out
-     * @param inTime         - The processing start time
-     * @param outTime        - The processing end time
-     * @param isFault        - A boolean value that indicate whether falut has occured or not
-     */
-    public void reportForEndPoint(String keyOfStatistic, boolean isResponse, long inTime, long outTime, boolean isFault) {
-        StatisticsHolder statisticsHolder = (StatisticsHolder) endpointStatistics.get(keyOfStatistic);
-        if (statisticsHolder == null) {
-            statisticsHolder = new StatisticsHolder();
-            statisticsHolder.setKey(keyOfStatistic);
-            statisticsHolder.setStatisticsCategory(Constants.ENDPOINT_STATISTICS);
-            endpointStatistics.put(keyOfStatistic, statisticsHolder);
-        }
-        statisticsHolder.update(isResponse, inTime, outTime, isFault);
-
-    }
-
-    /**
-     * To report the statistics related to a  ProxyService
-     *
-     * @param keyOfStatistic - key for hold Statistic
-     * @param isResponse     - A boolean value that indicate whether message flow is in or out
-     * @param inTime         - The processing start time
-     * @param outTime        - The processing end time
-     * @param isFault        - A boolean value that indicate whether falut has occured or not
-     */
-    public void reportForProxyService(String keyOfStatistic, boolean isResponse, long inTime, long outTime, boolean isFault) {
-        StatisticsHolder statisticsHolder = (StatisticsHolder) proxyServicesStatistics.get(keyOfStatistic);
-        if (statisticsHolder == null) {
-            statisticsHolder = new StatisticsHolder();
-            statisticsHolder.setKey(keyOfStatistic);
-            statisticsHolder.setStatisticsCategory(Constants.PROXYSERVICE_STATISTICS);
-            proxyServicesStatistics.put(keyOfStatistic, statisticsHolder);
-        }
-        statisticsHolder.update(isResponse, inTime, outTime, isFault);
-    }
-
-    /**
-     * To report the statistics related to a  Sequence
-     *
-     * @param keyOfStatistic - key for hold Statistic
-     * @param isResponse     - A boolean value that indicate whether message flow is in or out
-     * @param inTime         - The processing start time
-     * @param outTime        - The processing end time
-     * @param isFault        - A boolean value that indicate whether falut has occured or not
-     */
-    public void reportForSequence(String keyOfStatistic, boolean isResponse, long inTime, long outTime, boolean isFault) {
-        StatisticsHolder statisticsHolder = (StatisticsHolder) sequenceStatistics.get(keyOfStatistic);
-        if (statisticsHolder == null) {
-            statisticsHolder = new StatisticsHolder();
-            statisticsHolder.setKey(keyOfStatistic);
-            statisticsHolder.setStatisticsCategory(Constants.SEQUENCE_STATISTICS);
-            sequenceStatistics.put(keyOfStatistic, statisticsHolder);
-        }
-        statisticsHolder.update(isResponse, inTime, outTime, isFault);
-    }
-
-    /**
-     * To access all sequence statistics
-     *
-     * @return all sequence statistics
-     */
-    public Iterator getSequenceStatistics() {
-        return sequenceStatistics.values().iterator();
-    }
-
-    /**
-     * To access all proxy services statistics
-     *
-     * @return all proxy services statistics
-     */
-    public Iterator getProxyServiceStatistics() {
-        return proxyServicesStatistics.values().iterator();
-    }
-
-    /**
-     * To access all endpoint statistics
-     *
-     * @return all endpoint statistics
-     */
-    public Iterator getEndPointStatistics() {
-        return endpointStatistics.values().iterator();
-    }
-}
+/*
+ *  Licensed to the Apache Software Foundation (ASF) under one
+ *  or more contributor license agreements.  See the NOTICE file
+ *  distributed with this work for additional information
+ *  regarding copyright ownership.  The ASF licenses this file
+ *  to you under the Apache License, Version 2.0 (the
+ *  "License"); you may not use this file except in compliance
+ *  with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ *  Unless required by applicable law or agreed to in writing,
+ *  software distributed under the License is distributed on an
+ *   * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ *  KIND, either express or implied.  See the License for the
+ *  specific language governing permissions and limitations
+ *  under the License.
+ */
+package org.apache.synapse.statistics;
+
+import org.apache.synapse.Constants;
+
+import java.util.*;
+
+/**
+ * To collect statistics
+ */
+
+public class StatisticsCollector {
+
+    /**  A synchronized map for holding sequence statistics  */
+    private Map sequenceStatistics = Collections.synchronizedMap(new HashMap());
+
+    /**  A synchronized map for holding end point statistics */
+    private Map endpointStatistics = Collections.synchronizedMap(new HashMap());
+
+    /**  A synchronized map for holding proxy services statistics */
+    private Map proxyServicesStatistics = Collections.synchronizedMap(new HashMap());
+
+    /**
+     * To report the statistics related to a  EndPonit
+     *
+     * @param keyOfStatistic - key for hold Statistic
+     * @param isResponse     - A boolean value that indicate whether message flow is in or out
+     * @param inTime         - The processing start time
+     * @param outTime        - The processing end time
+     * @param isFault        - A boolean value that indicate whether falut has occured or not
+     */
+    public void reportForEndPoint(String keyOfStatistic, boolean isResponse, long inTime, long outTime, boolean isFault) {
+        StatisticsHolder statisticsHolder = (StatisticsHolder) endpointStatistics.get(keyOfStatistic);
+        if (statisticsHolder == null) {
+            statisticsHolder = new StatisticsHolder();
+            statisticsHolder.setKey(keyOfStatistic);
+            statisticsHolder.setStatisticsCategory(Constants.ENDPOINT_STATISTICS);
+            endpointStatistics.put(keyOfStatistic, statisticsHolder);
+        }
+        statisticsHolder.update(isResponse, inTime, outTime, isFault);
+
+    }
+
+    /**
+     * To report the statistics related to a  ProxyService
+     *
+     * @param keyOfStatistic - key for hold Statistic
+     * @param isResponse     - A boolean value that indicate whether message flow is in or out
+     * @param inTime         - The processing start time
+     * @param outTime        - The processing end time
+     * @param isFault        - A boolean value that indicate whether falut has occured or not
+     */
+    public void reportForProxyService(String keyOfStatistic, boolean isResponse, long inTime, long outTime, boolean isFault) {
+        StatisticsHolder statisticsHolder = (StatisticsHolder) proxyServicesStatistics.get(keyOfStatistic);
+        if (statisticsHolder == null) {
+            statisticsHolder = new StatisticsHolder();
+            statisticsHolder.setKey(keyOfStatistic);
+            statisticsHolder.setStatisticsCategory(Constants.PROXYSERVICE_STATISTICS);
+            proxyServicesStatistics.put(keyOfStatistic, statisticsHolder);
+        }
+        statisticsHolder.update(isResponse, inTime, outTime, isFault);
+    }
+
+    /**
+     * To report the statistics related to a  Sequence
+     *
+     * @param keyOfStatistic - key for hold Statistic
+     * @param isResponse     - A boolean value that indicate whether message flow is in or out
+     * @param inTime         - The processing start time
+     * @param outTime        - The processing end time
+     * @param isFault        - A boolean value that indicate whether falut has occured or not
+     */
+    public void reportForSequence(String keyOfStatistic, boolean isResponse, long inTime, long outTime, boolean isFault) {
+        StatisticsHolder statisticsHolder = (StatisticsHolder) sequenceStatistics.get(keyOfStatistic);
+        if (statisticsHolder == null) {
+            statisticsHolder = new StatisticsHolder();
+            statisticsHolder.setKey(keyOfStatistic);
+            statisticsHolder.setStatisticsCategory(Constants.SEQUENCE_STATISTICS);
+            sequenceStatistics.put(keyOfStatistic, statisticsHolder);
+        }
+        statisticsHolder.update(isResponse, inTime, outTime, isFault);
+    }
+
+    /**
+     * To access all sequence statistics
+     *
+     * @return all sequence statistics
+     */
+    public Iterator getSequenceStatistics() {
+        return sequenceStatistics.values().iterator();
+    }
+
+    /**
+     * To access all proxy services statistics
+     *
+     * @return all proxy services statistics
+     */
+    public Iterator getProxyServiceStatistics() {
+        return proxyServicesStatistics.values().iterator();
+    }
+
+    /**
+     * To access all endpoint statistics
+     *
+     * @return all endpoint statistics
+     */
+    public Iterator getEndPointStatistics() {
+        return endpointStatistics.values().iterator();
+    }
+}

Propchange: webservices/synapse/trunk/java/modules/core/src/main/java/org/apache/synapse/statistics/StatisticsCollector.java
------------------------------------------------------------------------------
    svn:eol-style = native



---------------------------------------------------------------------
To unsubscribe, e-mail: synapse-dev-unsubscribe@ws.apache.org
For additional commands, e-mail: synapse-dev-help@ws.apache.org