synapse-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From sami...@apache.org
Subject svn commit: r399953 - in /incubator/synapse/trunk/scratch/synapse2/modules: core/src/org/apache/synapse/axis2/ core/src/org/apache/synapse/config/ core/src/org/apache/synapse/config/xml/ core/src/org/apache/synapse/mediators/ core/src/org/apache/synaps...
Date Fri, 05 May 2006 04:33:20 GMT
Author: saminda
Date: Thu May  4 21:33:17 2006
New Revision: 399953

URL: http://svn.apache.org/viewcvs?rev=399953&view=rev
Log:
move xml configuration stuff into o.a.s.config.xml fix logging and documentation

Added:
    incubator/synapse/trunk/scratch/synapse2/modules/core/src/org/apache/synapse/config/xml/
    incubator/synapse/trunk/scratch/synapse2/modules/core/src/org/apache/synapse/config/xml/AbstractListMediatorFactory.java
      - copied, changed from r399252, incubator/synapse/trunk/scratch/synapse2/modules/core/src/org/apache/synapse/config/AbstractListMediatorFactory.java
    incubator/synapse/trunk/scratch/synapse2/modules/core/src/org/apache/synapse/config/xml/AbstractMediatorFactory.java
      - copied, changed from r399252, incubator/synapse/trunk/scratch/synapse2/modules/core/src/org/apache/synapse/config/AbstractMediatorFactory.java
    incubator/synapse/trunk/scratch/synapse2/modules/core/src/org/apache/synapse/config/xml/ClassMediatorFactory.java
      - copied, changed from r399252, incubator/synapse/trunk/scratch/synapse2/modules/core/src/org/apache/synapse/config/ClassMediatorFactory.java
    incubator/synapse/trunk/scratch/synapse2/modules/core/src/org/apache/synapse/config/xml/Constants.java
      - copied, changed from r399252, incubator/synapse/trunk/scratch/synapse2/modules/core/src/org/apache/synapse/config/Constants.java
    incubator/synapse/trunk/scratch/synapse2/modules/core/src/org/apache/synapse/config/xml/DropMediatorFactory.java
      - copied, changed from r399252, incubator/synapse/trunk/scratch/synapse2/modules/core/src/org/apache/synapse/config/DropMediatorFactory.java
    incubator/synapse/trunk/scratch/synapse2/modules/core/src/org/apache/synapse/config/xml/FaultMediatorFactory.java
      - copied, changed from r399600, incubator/synapse/trunk/scratch/synapse2/modules/core/src/org/apache/synapse/config/FaultMediatorFactory.java
    incubator/synapse/trunk/scratch/synapse2/modules/core/src/org/apache/synapse/config/xml/FilterMediatorFactory.java
      - copied, changed from r399600, incubator/synapse/trunk/scratch/synapse2/modules/core/src/org/apache/synapse/config/FilterMediatorFactory.java
    incubator/synapse/trunk/scratch/synapse2/modules/core/src/org/apache/synapse/config/xml/HeaderMediatorFactory.java
      - copied, changed from r399670, incubator/synapse/trunk/scratch/synapse2/modules/core/src/org/apache/synapse/config/HeaderMediatorFactory.java
    incubator/synapse/trunk/scratch/synapse2/modules/core/src/org/apache/synapse/config/xml/LogMediatorFactory.java
      - copied, changed from r399670, incubator/synapse/trunk/scratch/synapse2/modules/core/src/org/apache/synapse/config/LogMediatorFactory.java
    incubator/synapse/trunk/scratch/synapse2/modules/core/src/org/apache/synapse/config/xml/MediatorFactory.java
      - copied, changed from r399252, incubator/synapse/trunk/scratch/synapse2/modules/core/src/org/apache/synapse/config/MediatorFactory.java
    incubator/synapse/trunk/scratch/synapse2/modules/core/src/org/apache/synapse/config/xml/MediatorFactoryFinder.java
      - copied, changed from r399600, incubator/synapse/trunk/scratch/synapse2/modules/core/src/org/apache/synapse/config/MediatorFactoryFinder.java
    incubator/synapse/trunk/scratch/synapse2/modules/core/src/org/apache/synapse/config/xml/SendMediatorFactory.java
      - copied, changed from r399252, incubator/synapse/trunk/scratch/synapse2/modules/core/src/org/apache/synapse/config/SendMediatorFactory.java
    incubator/synapse/trunk/scratch/synapse2/modules/core/src/org/apache/synapse/config/xml/SequenceMediatorFactory.java
      - copied, changed from r399252, incubator/synapse/trunk/scratch/synapse2/modules/core/src/org/apache/synapse/config/SequenceMediatorFactory.java
    incubator/synapse/trunk/scratch/synapse2/modules/core/src/org/apache/synapse/config/xml/SynapseConfigurationBuilder.java
      - copied, changed from r399252, incubator/synapse/trunk/scratch/synapse2/modules/core/src/org/apache/synapse/config/SynapseConfigurationBuilder.java
    incubator/synapse/trunk/scratch/synapse2/modules/core/src/org/apache/synapse/config/xml/SynapseMediatorFactory.java
      - copied, changed from r399252, incubator/synapse/trunk/scratch/synapse2/modules/core/src/org/apache/synapse/config/SynapseMediatorFactory.java
    incubator/synapse/trunk/scratch/synapse2/modules/core/src/org/apache/synapse/config/xml/TransformMediatorFactory.java
Removed:
    incubator/synapse/trunk/scratch/synapse2/modules/core/src/org/apache/synapse/config/AbstractListMediatorFactory.java
    incubator/synapse/trunk/scratch/synapse2/modules/core/src/org/apache/synapse/config/AbstractMediatorFactory.java
    incubator/synapse/trunk/scratch/synapse2/modules/core/src/org/apache/synapse/config/ClassMediatorFactory.java
    incubator/synapse/trunk/scratch/synapse2/modules/core/src/org/apache/synapse/config/Constants.java
    incubator/synapse/trunk/scratch/synapse2/modules/core/src/org/apache/synapse/config/DropMediatorFactory.java
    incubator/synapse/trunk/scratch/synapse2/modules/core/src/org/apache/synapse/config/FaultMediatorFactory.java
    incubator/synapse/trunk/scratch/synapse2/modules/core/src/org/apache/synapse/config/FilterMediatorFactory.java
    incubator/synapse/trunk/scratch/synapse2/modules/core/src/org/apache/synapse/config/HeaderMediatorFactory.java
    incubator/synapse/trunk/scratch/synapse2/modules/core/src/org/apache/synapse/config/LogMediatorFactory.java
    incubator/synapse/trunk/scratch/synapse2/modules/core/src/org/apache/synapse/config/MediatorFactory.java
    incubator/synapse/trunk/scratch/synapse2/modules/core/src/org/apache/synapse/config/MediatorFactoryFinder.java
    incubator/synapse/trunk/scratch/synapse2/modules/core/src/org/apache/synapse/config/SendMediatorFactory.java
    incubator/synapse/trunk/scratch/synapse2/modules/core/src/org/apache/synapse/config/SequenceMediatorFactory.java
    incubator/synapse/trunk/scratch/synapse2/modules/core/src/org/apache/synapse/config/SynapseConfigurationBuilder.java
    incubator/synapse/trunk/scratch/synapse2/modules/core/src/org/apache/synapse/config/SynapseMediatorFactory.java
Modified:
    incubator/synapse/trunk/scratch/synapse2/modules/core/src/org/apache/synapse/axis2/Axis2SynapseContext.java
    incubator/synapse/trunk/scratch/synapse2/modules/core/src/org/apache/synapse/mediators/AbstractListMediator.java
    incubator/synapse/trunk/scratch/synapse2/modules/core/src/org/apache/synapse/mediators/AbstractMediator.java
    incubator/synapse/trunk/scratch/synapse2/modules/core/src/org/apache/synapse/mediators/MediatorProperty.java
    incubator/synapse/trunk/scratch/synapse2/modules/core/src/org/apache/synapse/mediators/base/SequenceMediator.java
    incubator/synapse/trunk/scratch/synapse2/modules/core/src/org/apache/synapse/mediators/builtin/DropMediator.java
    incubator/synapse/trunk/scratch/synapse2/modules/core/src/org/apache/synapse/mediators/builtin/LogMediator.java
    incubator/synapse/trunk/scratch/synapse2/modules/core/src/org/apache/synapse/mediators/builtin/SendMediator.java
    incubator/synapse/trunk/scratch/synapse2/modules/core/src/org/apache/synapse/mediators/ext/ClassMediator.java
    incubator/synapse/trunk/scratch/synapse2/modules/core/src/org/apache/synapse/mediators/filters/FilterMediator.java
    incubator/synapse/trunk/scratch/synapse2/modules/core/src/org/apache/synapse/mediators/transform/FaultMediator.java
    incubator/synapse/trunk/scratch/synapse2/modules/core/src/org/apache/synapse/mediators/transform/HeaderMediator.java
    incubator/synapse/trunk/scratch/synapse2/modules/core/src/org/apache/synapse/mediators/transform/TransformMediator.java
    incubator/synapse/trunk/scratch/synapse2/modules/samples/src/samples/userguide/DumbStockQuoteClient.java

Modified: incubator/synapse/trunk/scratch/synapse2/modules/core/src/org/apache/synapse/axis2/Axis2SynapseContext.java
URL: http://svn.apache.org/viewcvs/incubator/synapse/trunk/scratch/synapse2/modules/core/src/org/apache/synapse/axis2/Axis2SynapseContext.java?rev=399953&r1=399952&r2=399953&view=diff
==============================================================================
--- incubator/synapse/trunk/scratch/synapse2/modules/core/src/org/apache/synapse/axis2/Axis2SynapseContext.java (original)
+++ incubator/synapse/trunk/scratch/synapse2/modules/core/src/org/apache/synapse/axis2/Axis2SynapseContext.java Thu May  4 21:33:17 2006
@@ -21,7 +21,7 @@
 import org.apache.synapse.SynapseContext;
 import org.apache.synapse.SynapseMessage;
 import org.apache.synapse.config.SynapseConfiguration;
-import org.apache.synapse.config.SynapseConfigurationBuilder;
+import org.apache.synapse.config.xml.SynapseConfigurationBuilder;
 
 import java.io.InputStream;
 

Copied: incubator/synapse/trunk/scratch/synapse2/modules/core/src/org/apache/synapse/config/xml/AbstractListMediatorFactory.java (from r399252, incubator/synapse/trunk/scratch/synapse2/modules/core/src/org/apache/synapse/config/AbstractListMediatorFactory.java)
URL: http://svn.apache.org/viewcvs/incubator/synapse/trunk/scratch/synapse2/modules/core/src/org/apache/synapse/config/xml/AbstractListMediatorFactory.java?p2=incubator/synapse/trunk/scratch/synapse2/modules/core/src/org/apache/synapse/config/xml/AbstractListMediatorFactory.java&p1=incubator/synapse/trunk/scratch/synapse2/modules/core/src/org/apache/synapse/config/AbstractListMediatorFactory.java&r1=399252&r2=399953&rev=399953&view=diff
==============================================================================
--- incubator/synapse/trunk/scratch/synapse2/modules/core/src/org/apache/synapse/config/AbstractListMediatorFactory.java (original)
+++ incubator/synapse/trunk/scratch/synapse2/modules/core/src/org/apache/synapse/config/xml/AbstractListMediatorFactory.java Thu May  4 21:33:17 2006
@@ -13,7 +13,7 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
-package org.apache.synapse.config;
+package org.apache.synapse.config.xml;
 
 import java.util.Iterator;
 
@@ -24,16 +24,17 @@
 import org.apache.synapse.api.ListMediator;
 import org.apache.synapse.api.Mediator;
 import org.apache.axiom.om.OMElement;
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
 
 /**
- *
- * 
- * <p> This is the abstract parent of any tag which is a "Node" - so &ltstage>, &ltin>&ltout> and &ltnever> all fit this model
- * <p>It recursively creates a list of processors from the children. 
- *
+ * This implements the basic logic to build a list mediator from a given XML
+ * configuration. It recursively builds the child mediators of the list.
  */
 public abstract class AbstractListMediatorFactory extends AbstractMediatorFactory {
 
+    private static final Log log = LogFactory.getLog(AbstractListMediatorFactory.class);
+
     public void addChildren(SynapseContext synCtx, OMElement el, ListMediator m)
     {
         Iterator it = el.getChildElements();
@@ -49,7 +50,4 @@
             }
         }
     }
-
-
-
 }

Copied: incubator/synapse/trunk/scratch/synapse2/modules/core/src/org/apache/synapse/config/xml/AbstractMediatorFactory.java (from r399252, incubator/synapse/trunk/scratch/synapse2/modules/core/src/org/apache/synapse/config/AbstractMediatorFactory.java)
URL: http://svn.apache.org/viewcvs/incubator/synapse/trunk/scratch/synapse2/modules/core/src/org/apache/synapse/config/xml/AbstractMediatorFactory.java?p2=incubator/synapse/trunk/scratch/synapse2/modules/core/src/org/apache/synapse/config/xml/AbstractMediatorFactory.java&p1=incubator/synapse/trunk/scratch/synapse2/modules/core/src/org/apache/synapse/config/AbstractMediatorFactory.java&r1=399252&r2=399953&rev=399953&view=diff
==============================================================================
--- incubator/synapse/trunk/scratch/synapse2/modules/core/src/org/apache/synapse/config/AbstractMediatorFactory.java (original)
+++ incubator/synapse/trunk/scratch/synapse2/modules/core/src/org/apache/synapse/config/xml/AbstractMediatorFactory.java Thu May  4 21:33:17 2006
@@ -13,19 +13,13 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
-package org.apache.synapse.config;
+package org.apache.synapse.config.xml;
 
 import org.apache.commons.logging.Log;
 import org.apache.commons.logging.LogFactory;
 
 /**
- *
- * 
- * <p> This is the abstract superclass of any tag that isn't a "node". I.e. mediators or builtin
- * mediators like log
- *
+ * Is the abstract superclass of MediatorFactory's
  */
 public abstract class AbstractMediatorFactory implements MediatorFactory {
-
-    Log log = LogFactory.getLog(getClass());
 }

Copied: incubator/synapse/trunk/scratch/synapse2/modules/core/src/org/apache/synapse/config/xml/ClassMediatorFactory.java (from r399252, incubator/synapse/trunk/scratch/synapse2/modules/core/src/org/apache/synapse/config/ClassMediatorFactory.java)
URL: http://svn.apache.org/viewcvs/incubator/synapse/trunk/scratch/synapse2/modules/core/src/org/apache/synapse/config/xml/ClassMediatorFactory.java?p2=incubator/synapse/trunk/scratch/synapse2/modules/core/src/org/apache/synapse/config/xml/ClassMediatorFactory.java&p1=incubator/synapse/trunk/scratch/synapse2/modules/core/src/org/apache/synapse/config/ClassMediatorFactory.java&r1=399252&r2=399953&rev=399953&view=diff
==============================================================================
--- incubator/synapse/trunk/scratch/synapse2/modules/core/src/org/apache/synapse/config/ClassMediatorFactory.java (original)
+++ incubator/synapse/trunk/scratch/synapse2/modules/core/src/org/apache/synapse/config/xml/ClassMediatorFactory.java Thu May  4 21:33:17 2006
@@ -13,11 +13,11 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
-package org.apache.synapse.config;
+package org.apache.synapse.config.xml;
 
 import javax.xml.namespace.QName;
 
-import org.apache.synapse.config.Constants;
+import org.apache.synapse.config.xml.Constants;
 import org.apache.synapse.SynapseContext;
 import org.apache.synapse.SynapseException;
 import org.apache.synapse.api.Mediator;

Copied: incubator/synapse/trunk/scratch/synapse2/modules/core/src/org/apache/synapse/config/xml/Constants.java (from r399252, incubator/synapse/trunk/scratch/synapse2/modules/core/src/org/apache/synapse/config/Constants.java)
URL: http://svn.apache.org/viewcvs/incubator/synapse/trunk/scratch/synapse2/modules/core/src/org/apache/synapse/config/xml/Constants.java?p2=incubator/synapse/trunk/scratch/synapse2/modules/core/src/org/apache/synapse/config/xml/Constants.java&p1=incubator/synapse/trunk/scratch/synapse2/modules/core/src/org/apache/synapse/config/Constants.java&r1=399252&r2=399953&rev=399953&view=diff
==============================================================================
--- incubator/synapse/trunk/scratch/synapse2/modules/core/src/org/apache/synapse/config/Constants.java (original)
+++ incubator/synapse/trunk/scratch/synapse2/modules/core/src/org/apache/synapse/config/xml/Constants.java Thu May  4 21:33:17 2006
@@ -13,7 +13,7 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
-package org.apache.synapse.config;
+package org.apache.synapse.config.xml;
 
 import javax.xml.namespace.QName;
 

Copied: incubator/synapse/trunk/scratch/synapse2/modules/core/src/org/apache/synapse/config/xml/DropMediatorFactory.java (from r399252, incubator/synapse/trunk/scratch/synapse2/modules/core/src/org/apache/synapse/config/DropMediatorFactory.java)
URL: http://svn.apache.org/viewcvs/incubator/synapse/trunk/scratch/synapse2/modules/core/src/org/apache/synapse/config/xml/DropMediatorFactory.java?p2=incubator/synapse/trunk/scratch/synapse2/modules/core/src/org/apache/synapse/config/xml/DropMediatorFactory.java&p1=incubator/synapse/trunk/scratch/synapse2/modules/core/src/org/apache/synapse/config/DropMediatorFactory.java&r1=399252&r2=399953&rev=399953&view=diff
==============================================================================
--- incubator/synapse/trunk/scratch/synapse2/modules/core/src/org/apache/synapse/config/DropMediatorFactory.java (original)
+++ incubator/synapse/trunk/scratch/synapse2/modules/core/src/org/apache/synapse/config/xml/DropMediatorFactory.java Thu May  4 21:33:17 2006
@@ -14,17 +14,21 @@
  * limitations under the License.
  */
 
-package org.apache.synapse.config;
+package org.apache.synapse.config.xml;
 
 import org.apache.synapse.SynapseContext;
-import org.apache.synapse.config.Constants;
+import org.apache.synapse.config.xml.Constants;
 import org.apache.synapse.api.Mediator;
 import org.apache.synapse.mediators.builtin.DropMediator;
 import org.apache.axiom.om.OMElement;
 
 import javax.xml.namespace.QName;
 
-
+/**
+ * This creates a drop mediator instance
+ *
+ * <drop/>
+ */
 public class DropMediatorFactory extends AbstractMediatorFactory {
 
     private static final QName DROP_Q = new QName(Constants.SYNAPSE_NAMESPACE, "drop");

Copied: incubator/synapse/trunk/scratch/synapse2/modules/core/src/org/apache/synapse/config/xml/FaultMediatorFactory.java (from r399600, incubator/synapse/trunk/scratch/synapse2/modules/core/src/org/apache/synapse/config/FaultMediatorFactory.java)
URL: http://svn.apache.org/viewcvs/incubator/synapse/trunk/scratch/synapse2/modules/core/src/org/apache/synapse/config/xml/FaultMediatorFactory.java?p2=incubator/synapse/trunk/scratch/synapse2/modules/core/src/org/apache/synapse/config/xml/FaultMediatorFactory.java&p1=incubator/synapse/trunk/scratch/synapse2/modules/core/src/org/apache/synapse/config/FaultMediatorFactory.java&r1=399600&r2=399953&rev=399953&view=diff
==============================================================================
--- incubator/synapse/trunk/scratch/synapse2/modules/core/src/org/apache/synapse/config/FaultMediatorFactory.java (original)
+++ incubator/synapse/trunk/scratch/synapse2/modules/core/src/org/apache/synapse/config/xml/FaultMediatorFactory.java Thu May  4 21:33:17 2006
@@ -13,23 +13,27 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
-package org.apache.synapse.config;
+package org.apache.synapse.config.xml;
 
 import javax.xml.namespace.QName;
 
 import org.apache.synapse.SynapseContext;
-import org.apache.synapse.config.Constants;
+import org.apache.synapse.config.xml.Constants;
 import org.apache.synapse.api.Mediator;
 import org.apache.synapse.mediators.transform.FaultMediator;
 import org.apache.axiom.om.OMElement;
 import org.apache.axiom.om.OMAttribute;
 
 /**
+ * Creates a fault mediator instance
  *
- *         <p>
- *         <xmp><synapse:fault name="optional"/> </xmp>
- * 	TODO add the ability to configure the fault codes, etc
- * 
+ * <makefault [version="soap11|soap12"]>
+ *   <code (value="literal" | expression="xpath")/>
+ *   <reason (value="literal" | expression="xpath")>
+ *   <node>?
+ *   <role>?
+ *   <detail>?
+ * </makefault>
  */
 public class FaultMediatorFactory extends AbstractMediatorFactory {
 

Copied: incubator/synapse/trunk/scratch/synapse2/modules/core/src/org/apache/synapse/config/xml/FilterMediatorFactory.java (from r399600, incubator/synapse/trunk/scratch/synapse2/modules/core/src/org/apache/synapse/config/FilterMediatorFactory.java)
URL: http://svn.apache.org/viewcvs/incubator/synapse/trunk/scratch/synapse2/modules/core/src/org/apache/synapse/config/xml/FilterMediatorFactory.java?p2=incubator/synapse/trunk/scratch/synapse2/modules/core/src/org/apache/synapse/config/xml/FilterMediatorFactory.java&p1=incubator/synapse/trunk/scratch/synapse2/modules/core/src/org/apache/synapse/config/FilterMediatorFactory.java&r1=399600&r2=399953&rev=399953&view=diff
==============================================================================
--- incubator/synapse/trunk/scratch/synapse2/modules/core/src/org/apache/synapse/config/FilterMediatorFactory.java (original)
+++ incubator/synapse/trunk/scratch/synapse2/modules/core/src/org/apache/synapse/config/xml/FilterMediatorFactory.java Thu May  4 21:33:17 2006
@@ -13,7 +13,7 @@
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */
-package org.apache.synapse.config;
+package org.apache.synapse.config.xml;
 
 import org.apache.synapse.api.Mediator;
 import org.apache.synapse.SynapseContext;
@@ -23,6 +23,8 @@
 import org.apache.axiom.om.OMAttribute;
 import org.apache.axiom.om.OMNamespace;
 import org.apache.axiom.om.xpath.AXIOMXPath;
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
 import org.jaxen.JaxenException;
 
 import javax.xml.namespace.QName;
@@ -30,7 +32,16 @@
 import java.util.regex.PatternSyntaxException;
 import java.util.Iterator;
 
+/**
+ * Creates a filter mediator instance
+ *
+ * <filter (source="xpath" regex="string") | xpath="xpath">
+ *   mediator+
+ * </filter>
+ */
 public class FilterMediatorFactory extends AbstractListMediatorFactory {
+
+    private static final Log log = LogFactory.getLog(FaultMediatorFactory.class);
 
     private static final QName FILTER_Q    = new QName(Constants.SYNAPSE_NAMESPACE, "filter");
 

Copied: incubator/synapse/trunk/scratch/synapse2/modules/core/src/org/apache/synapse/config/xml/HeaderMediatorFactory.java (from r399670, incubator/synapse/trunk/scratch/synapse2/modules/core/src/org/apache/synapse/config/HeaderMediatorFactory.java)
URL: http://svn.apache.org/viewcvs/incubator/synapse/trunk/scratch/synapse2/modules/core/src/org/apache/synapse/config/xml/HeaderMediatorFactory.java?p2=incubator/synapse/trunk/scratch/synapse2/modules/core/src/org/apache/synapse/config/xml/HeaderMediatorFactory.java&p1=incubator/synapse/trunk/scratch/synapse2/modules/core/src/org/apache/synapse/config/HeaderMediatorFactory.java&r1=399670&r2=399953&rev=399953&view=diff
==============================================================================
--- incubator/synapse/trunk/scratch/synapse2/modules/core/src/org/apache/synapse/config/HeaderMediatorFactory.java (original)
+++ incubator/synapse/trunk/scratch/synapse2/modules/core/src/org/apache/synapse/config/xml/HeaderMediatorFactory.java Thu May  4 21:33:17 2006
@@ -13,25 +13,35 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
-package org.apache.synapse.config;
+package org.apache.synapse.config.xml;
 
 import javax.xml.namespace.QName;
 
 import org.apache.synapse.SynapseContext;
 import org.apache.synapse.SynapseException;
-import org.apache.synapse.config.Constants;
+import org.apache.synapse.config.xml.Constants;
 import org.apache.synapse.api.Mediator;
 import org.apache.synapse.mediators.transform.HeaderMediator;
 import org.apache.synapse.mediators.transform.HeaderMediator;
 import org.apache.axiom.om.OMElement;
 import org.apache.axiom.om.OMAttribute;
 import org.apache.axiom.om.xpath.AXIOMXPath;
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
 import org.jaxen.JaxenException;
 
 /**
+ * This builds a Header Mediator parsing the XML configuration supplied
  *
+ * Set header
+ *   <header name="qname" (value="literal" | expression="xpath")/>
+ *
+ * Remove header
+ *   <header name="qname" action="remove"/>
  */
 public class HeaderMediatorFactory extends AbstractMediatorFactory {
+
+    private static final Log log = LogFactory.getLog(HeaderMediatorFactory.class);
 
     private static final QName HEADER_Q = new QName(Constants.SYNAPSE_NAMESPACE, "header");
 

Copied: incubator/synapse/trunk/scratch/synapse2/modules/core/src/org/apache/synapse/config/xml/LogMediatorFactory.java (from r399670, incubator/synapse/trunk/scratch/synapse2/modules/core/src/org/apache/synapse/config/LogMediatorFactory.java)
URL: http://svn.apache.org/viewcvs/incubator/synapse/trunk/scratch/synapse2/modules/core/src/org/apache/synapse/config/xml/LogMediatorFactory.java?p2=incubator/synapse/trunk/scratch/synapse2/modules/core/src/org/apache/synapse/config/xml/LogMediatorFactory.java&p1=incubator/synapse/trunk/scratch/synapse2/modules/core/src/org/apache/synapse/config/LogMediatorFactory.java&r1=399670&r2=399953&rev=399953&view=diff
==============================================================================
--- incubator/synapse/trunk/scratch/synapse2/modules/core/src/org/apache/synapse/config/LogMediatorFactory.java (original)
+++ incubator/synapse/trunk/scratch/synapse2/modules/core/src/org/apache/synapse/config/xml/LogMediatorFactory.java Thu May  4 21:33:17 2006
@@ -14,7 +14,7 @@
  * limitations under the License.
  */
 
-package org.apache.synapse.config;
+package org.apache.synapse.config.xml;
 
 import javax.xml.namespace.QName;
 
@@ -26,6 +26,8 @@
 import org.apache.axiom.om.OMElement;
 import org.apache.axiom.om.OMAttribute;
 import org.apache.axiom.om.xpath.AXIOMXPath;
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
 import org.jaxen.JaxenException;
 
 import java.util.Iterator;
@@ -33,11 +35,13 @@
 /**
  * Created a Log mediator that logs messages using commons-logging.
  *
- * <log [level="simple|headers|full"]>
+ * <log [level="simple|headers|full|custom"]>
  *      <property> *
  * </log>
  */
 public class LogMediatorFactory extends AbstractMediatorFactory {
+
+    private static final Log log = LogFactory.getLog(LogMediatorFactory.class);
 
     private static final QName LOG_Q    = new QName(Constants.SYNAPSE_NAMESPACE, "log");
     private static final String SIMPLE  = "simple";

Copied: incubator/synapse/trunk/scratch/synapse2/modules/core/src/org/apache/synapse/config/xml/MediatorFactory.java (from r399252, incubator/synapse/trunk/scratch/synapse2/modules/core/src/org/apache/synapse/config/MediatorFactory.java)
URL: http://svn.apache.org/viewcvs/incubator/synapse/trunk/scratch/synapse2/modules/core/src/org/apache/synapse/config/xml/MediatorFactory.java?p2=incubator/synapse/trunk/scratch/synapse2/modules/core/src/org/apache/synapse/config/xml/MediatorFactory.java&p1=incubator/synapse/trunk/scratch/synapse2/modules/core/src/org/apache/synapse/config/MediatorFactory.java&r1=399252&r2=399953&rev=399953&view=diff
==============================================================================
--- incubator/synapse/trunk/scratch/synapse2/modules/core/src/org/apache/synapse/config/MediatorFactory.java (original)
+++ incubator/synapse/trunk/scratch/synapse2/modules/core/src/org/apache/synapse/config/xml/MediatorFactory.java Thu May  4 21:33:17 2006
@@ -14,7 +14,7 @@
  * limitations under the License.
  */
 
-package org.apache.synapse.config;
+package org.apache.synapse.config.xml;
 
 import javax.xml.namespace.QName;
 
@@ -22,7 +22,22 @@
 import org.apache.synapse.api.Mediator;
 import org.apache.axiom.om.OMElement;
 
+/**
+ * A mediator factory capable of creating an instance of a mediator through a given
+ * XML should implement this interface
+ */
 public interface MediatorFactory {
+    /**
+     * Creates an instance of the mediator using the OMElement
+     * @param se
+     * @param el
+     * @return the created mediator
+     */
     public Mediator createMediator(SynapseContext se, OMElement el);
+
+    /**
+     * The QName of this mediator element in the XML config
+     * @return QName of the mediator element
+     */
     public QName getTagQName();
 }

Copied: incubator/synapse/trunk/scratch/synapse2/modules/core/src/org/apache/synapse/config/xml/MediatorFactoryFinder.java (from r399600, incubator/synapse/trunk/scratch/synapse2/modules/core/src/org/apache/synapse/config/MediatorFactoryFinder.java)
URL: http://svn.apache.org/viewcvs/incubator/synapse/trunk/scratch/synapse2/modules/core/src/org/apache/synapse/config/xml/MediatorFactoryFinder.java?p2=incubator/synapse/trunk/scratch/synapse2/modules/core/src/org/apache/synapse/config/xml/MediatorFactoryFinder.java&p1=incubator/synapse/trunk/scratch/synapse2/modules/core/src/org/apache/synapse/config/MediatorFactoryFinder.java&r1=399600&r2=399953&rev=399953&view=diff
==============================================================================
--- incubator/synapse/trunk/scratch/synapse2/modules/core/src/org/apache/synapse/config/MediatorFactoryFinder.java (original)
+++ incubator/synapse/trunk/scratch/synapse2/modules/core/src/org/apache/synapse/config/xml/MediatorFactoryFinder.java Thu May  4 21:33:17 2006
@@ -15,7 +15,7 @@
  */
 
 
-package org.apache.synapse.config;
+package org.apache.synapse.config.xml;
 
 import java.util.HashMap;
 import java.util.Iterator;
@@ -29,7 +29,7 @@
 
 import org.apache.synapse.SynapseContext;
 import org.apache.synapse.SynapseException;
-import org.apache.synapse.config.MediatorFactory;
+import org.apache.synapse.config.xml.MediatorFactory;
 import org.apache.synapse.api.Mediator;
 import org.apache.axiom.om.OMElement;
 import org.apache.axiom.om.OMNamespace;
@@ -46,7 +46,7 @@
 public class MediatorFactoryFinder {
 
     private static Map factoryMap = new HashMap();
-	private Log log = LogFactory.getLog(getClass());
+	private static final Log log = LogFactory.getLog(MediatorFactoryFinder.class);
 
 	private static final Class[] mediatorFactories = {
         SequenceMediatorFactory.class,
@@ -56,7 +56,8 @@
         SynapseMediatorFactory.class,
         DropMediatorFactory.class,
         HeaderMediatorFactory.class,
-        FaultMediatorFactory.class
+        FaultMediatorFactory.class,
+        TransformMediatorFactory.class
       };
 
     private static MediatorFactoryFinder instance = null;

Copied: incubator/synapse/trunk/scratch/synapse2/modules/core/src/org/apache/synapse/config/xml/SendMediatorFactory.java (from r399252, incubator/synapse/trunk/scratch/synapse2/modules/core/src/org/apache/synapse/config/SendMediatorFactory.java)
URL: http://svn.apache.org/viewcvs/incubator/synapse/trunk/scratch/synapse2/modules/core/src/org/apache/synapse/config/xml/SendMediatorFactory.java?p2=incubator/synapse/trunk/scratch/synapse2/modules/core/src/org/apache/synapse/config/xml/SendMediatorFactory.java&p1=incubator/synapse/trunk/scratch/synapse2/modules/core/src/org/apache/synapse/config/SendMediatorFactory.java&r1=399252&r2=399953&rev=399953&view=diff
==============================================================================
--- incubator/synapse/trunk/scratch/synapse2/modules/core/src/org/apache/synapse/config/SendMediatorFactory.java (original)
+++ incubator/synapse/trunk/scratch/synapse2/modules/core/src/org/apache/synapse/config/xml/SendMediatorFactory.java Thu May  4 21:33:17 2006
@@ -14,7 +14,7 @@
  * limitations under the License.
  */
 
-package org.apache.synapse.config;
+package org.apache.synapse.config.xml;
 
 import javax.xml.namespace.QName;
 
@@ -28,6 +28,33 @@
  * The Send mediator factory parses a Send element and creates an instance of the mediator
  *
  * //TODO support endpoints, failover and loadbalacing
+ *
+ * The <send> element is used to send messages out of Synapse to some endpoint. In the simplest case,
+ * the place to send the message to is implicit in the message (via a property of the message itself)-
+ * that is indicated by the following
+ *  <send/>
+ *
+ * If the message is to be sent to one or more endpoints, then the following is used:
+ *  <send>
+ *   (endpointref | endpoint)+
+ *  </send>
+ * where the endpointref token refers to the following:
+ * <endpoint ref="name"/>
+ * and the endpoint token refers to an anonymous endpoint defined inline:
+ *  <endpoint address="url"/>
+ * If the message is to be sent to an endpoint selected by load balancing across a set of endpoints,
+ * then it is indicated by the following:
+ * <send>
+ *   <load-balance algorithm="uri">
+ *     (endpointref | endpoint)+
+ *   </load-balance>
+ * </send>
+ * Similarly, if the message is to be sent to an endpoint with failover semantics, then it is indicated by the following:
+ * <send>
+ *   <failover>
+ *     (endpointref | endpoint)+
+ *   </failover>
+ * </send>
  */
 public class SendMediatorFactory extends AbstractMediatorFactory {
 

Copied: incubator/synapse/trunk/scratch/synapse2/modules/core/src/org/apache/synapse/config/xml/SequenceMediatorFactory.java (from r399252, incubator/synapse/trunk/scratch/synapse2/modules/core/src/org/apache/synapse/config/SequenceMediatorFactory.java)
URL: http://svn.apache.org/viewcvs/incubator/synapse/trunk/scratch/synapse2/modules/core/src/org/apache/synapse/config/xml/SequenceMediatorFactory.java?p2=incubator/synapse/trunk/scratch/synapse2/modules/core/src/org/apache/synapse/config/xml/SequenceMediatorFactory.java&p1=incubator/synapse/trunk/scratch/synapse2/modules/core/src/org/apache/synapse/config/SequenceMediatorFactory.java&r1=399252&r2=399953&rev=399953&view=diff
==============================================================================
--- incubator/synapse/trunk/scratch/synapse2/modules/core/src/org/apache/synapse/config/SequenceMediatorFactory.java (original)
+++ incubator/synapse/trunk/scratch/synapse2/modules/core/src/org/apache/synapse/config/xml/SequenceMediatorFactory.java Thu May  4 21:33:17 2006
@@ -13,7 +13,7 @@
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */
-package org.apache.synapse.config;
+package org.apache.synapse.config.xml;
 
 import org.apache.synapse.api.Mediator;
 import org.apache.synapse.SynapseContext;
@@ -21,14 +21,25 @@
 import org.apache.synapse.mediators.base.SequenceMediator;
 import org.apache.axiom.om.OMElement;
 import org.apache.axiom.om.OMAttribute;
+import org.apache.commons.logging.LogFactory;
+import org.apache.commons.logging.Log;
 
 import javax.xml.namespace.QName;
 
 /**
  * Builds an instance of a Sequence mediator through the Synapse configuration. It follows the following
- * <sequence (ref="name" | name="name")> mediator* </sequence>
+ *
+ * <sequence name="string">
+ *   mediator+
+ * </sequence>
+ *
+ * OR
+ *
+ * <sequence ref="name"/>
  */
 public class SequenceMediatorFactory extends AbstractListMediatorFactory {
+
+    private static final Log log = LogFactory.getLog(SequenceMediatorFactory.class);
 
     private static final QName SEQUENCE_Q = new QName(Constants.SYNAPSE_NAMESPACE, "sequence");
 

Copied: incubator/synapse/trunk/scratch/synapse2/modules/core/src/org/apache/synapse/config/xml/SynapseConfigurationBuilder.java (from r399252, incubator/synapse/trunk/scratch/synapse2/modules/core/src/org/apache/synapse/config/SynapseConfigurationBuilder.java)
URL: http://svn.apache.org/viewcvs/incubator/synapse/trunk/scratch/synapse2/modules/core/src/org/apache/synapse/config/xml/SynapseConfigurationBuilder.java?p2=incubator/synapse/trunk/scratch/synapse2/modules/core/src/org/apache/synapse/config/xml/SynapseConfigurationBuilder.java&p1=incubator/synapse/trunk/scratch/synapse2/modules/core/src/org/apache/synapse/config/SynapseConfigurationBuilder.java&r1=399252&r2=399953&rev=399953&view=diff
==============================================================================
--- incubator/synapse/trunk/scratch/synapse2/modules/core/src/org/apache/synapse/config/SynapseConfigurationBuilder.java (original)
+++ incubator/synapse/trunk/scratch/synapse2/modules/core/src/org/apache/synapse/config/xml/SynapseConfigurationBuilder.java Thu May  4 21:33:17 2006
@@ -13,13 +13,14 @@
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */
-package org.apache.synapse.config;
+package org.apache.synapse.config.xml;
 
 import org.apache.axiom.om.OMContainer;
 import org.apache.axiom.om.OMElement;
 import org.apache.axiom.om.impl.builder.StAXOMBuilder;
 import org.apache.synapse.SynapseContext;
 import org.apache.synapse.SynapseException;
+import org.apache.synapse.config.SynapseConfiguration;
 import org.apache.synapse.mediators.base.SequenceMediator;
 import org.apache.synapse.mediators.base.SynapseMediator;
 import org.apache.commons.logging.Log;

Copied: incubator/synapse/trunk/scratch/synapse2/modules/core/src/org/apache/synapse/config/xml/SynapseMediatorFactory.java (from r399252, incubator/synapse/trunk/scratch/synapse2/modules/core/src/org/apache/synapse/config/SynapseMediatorFactory.java)
URL: http://svn.apache.org/viewcvs/incubator/synapse/trunk/scratch/synapse2/modules/core/src/org/apache/synapse/config/xml/SynapseMediatorFactory.java?p2=incubator/synapse/trunk/scratch/synapse2/modules/core/src/org/apache/synapse/config/xml/SynapseMediatorFactory.java&p1=incubator/synapse/trunk/scratch/synapse2/modules/core/src/org/apache/synapse/config/SynapseMediatorFactory.java&r1=399252&r2=399953&rev=399953&view=diff
==============================================================================
--- incubator/synapse/trunk/scratch/synapse2/modules/core/src/org/apache/synapse/config/SynapseMediatorFactory.java (original)
+++ incubator/synapse/trunk/scratch/synapse2/modules/core/src/org/apache/synapse/config/xml/SynapseMediatorFactory.java Thu May  4 21:33:17 2006
@@ -14,16 +14,23 @@
  * limitations under the License.
  */
 
-package org.apache.synapse.config;
+package org.apache.synapse.config.xml;
 
 import javax.xml.namespace.QName;
 
 import org.apache.synapse.SynapseContext;
-import org.apache.synapse.config.Constants;
+import org.apache.synapse.config.xml.Constants;
 import org.apache.synapse.api.Mediator;
 import org.apache.synapse.mediators.base.SynapseMediator;
 import org.apache.axiom.om.OMElement;
 
+/**
+ * Builds the main mediator (@see SynapseConfiguration) of the Synapse instance
+ *
+ * <rules>
+ *   mediator+
+ * <rules>
+ */
 public class SynapseMediatorFactory extends AbstractListMediatorFactory {
 
     private final static QName tagname = new QName(Constants.SYNAPSE_NAMESPACE, "rules");

Added: incubator/synapse/trunk/scratch/synapse2/modules/core/src/org/apache/synapse/config/xml/TransformMediatorFactory.java
URL: http://svn.apache.org/viewcvs/incubator/synapse/trunk/scratch/synapse2/modules/core/src/org/apache/synapse/config/xml/TransformMediatorFactory.java?rev=399953&view=auto
==============================================================================
--- incubator/synapse/trunk/scratch/synapse2/modules/core/src/org/apache/synapse/config/xml/TransformMediatorFactory.java (added)
+++ incubator/synapse/trunk/scratch/synapse2/modules/core/src/org/apache/synapse/config/xml/TransformMediatorFactory.java Thu May  4 21:33:17 2006
@@ -0,0 +1,95 @@
+/*
+* Copyright 2004,2005 The Apache Software Foundation.
+*
+* Licensed 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.config.xml;
+
+import org.apache.axiom.om.OMElement;
+import org.apache.axiom.om.OMAttribute;
+import org.apache.axiom.om.xpath.AXIOMXPath;
+import org.apache.synapse.SynapseContext;
+import org.apache.synapse.SynapseException;
+import org.apache.synapse.mediators.transform.TransformMediator;
+import org.apache.synapse.api.Mediator;
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+import org.jaxen.JaxenException;
+
+import javax.xml.namespace.QName;
+import java.net.URL;
+import java.net.MalformedURLException;
+
+/**
+ * Creates a transform mediator from the given XML
+ *
+ * <transform xslt|xquery="url" [source="xpath"]>
+ *   <property name="string" (value="literal" | expression="xpath")/>*
+ * </transform>
+ */
+public class TransformMediatorFactory extends AbstractMediatorFactory {
+
+    private static final Log log = LogFactory.getLog(TransformMediatorFactory.class);
+    private static final QName LOG_Q    = new QName(Constants.SYNAPSE_NAMESPACE, "transform");
+
+    public QName getTagQName() {
+        return LOG_Q;
+    }
+
+    public Mediator createMediator(SynapseContext synCtx, OMElement elem) {
+
+        TransformMediator transformMediator = new TransformMediator();
+
+        OMAttribute attXslt   = elem.getAttribute(new QName(Constants.NULL_NAMESPACE, "xslt"));
+        OMAttribute attXQuery = elem.getAttribute(new QName(Constants.NULL_NAMESPACE, "xquery"));
+        OMAttribute attSource = elem.getAttribute(new QName(Constants.NULL_NAMESPACE, "source"));
+
+        if (attXslt != null) {
+            try {
+                transformMediator.setXsltUrl(new URL(attXslt.getAttributeValue()));
+            } catch (MalformedURLException e) {
+                String msg = "Invalid URL specified for the xslt attribute : " + attXslt.getAttributeValue();
+                log.error(msg);
+                throw new SynapseException(msg);
+            }
+
+        } else  if (attXQuery != null) {
+            try {
+                transformMediator.setXQueryUrl(new URL(attXQuery.getAttributeValue()));
+            } catch (MalformedURLException e) {
+                String msg = "Invalid URL specified for the xquery attribute : " + attXQuery.getAttributeValue();
+                log.error(msg);
+                throw new SynapseException(msg);
+            }
+
+        } else {
+            String msg = "The 'xslt' or 'xquery' attributes are required for the Transform mediator";
+            log.error(msg);
+            throw new SynapseException(msg);
+        }
+
+        if (attSource != null) {
+            try {
+                transformMediator.setSource(new AXIOMXPath(attSource.getAttributeValue()));
+            } catch (JaxenException e) {
+                String msg = "Invalid XPath specified for the source attribute : " + attSource.getAttributeValue();
+                log.error(msg);
+                throw new SynapseException(msg);
+            }
+
+        }
+
+        return transformMediator;
+    }
+
+}
\ No newline at end of file

Modified: incubator/synapse/trunk/scratch/synapse2/modules/core/src/org/apache/synapse/mediators/AbstractListMediator.java
URL: http://svn.apache.org/viewcvs/incubator/synapse/trunk/scratch/synapse2/modules/core/src/org/apache/synapse/mediators/AbstractListMediator.java?rev=399953&r1=399952&r2=399953&view=diff
==============================================================================
--- incubator/synapse/trunk/scratch/synapse2/modules/core/src/org/apache/synapse/mediators/AbstractListMediator.java (original)
+++ incubator/synapse/trunk/scratch/synapse2/modules/core/src/org/apache/synapse/mediators/AbstractListMediator.java Thu May  4 21:33:17 2006
@@ -19,6 +19,8 @@
 import org.apache.synapse.SynapseMessage;
 import org.apache.synapse.api.Mediator;
 import org.apache.synapse.api.ListMediator;
+import org.apache.commons.logging.LogFactory;
+import org.apache.commons.logging.Log;
 
 import java.util.ArrayList;
 import java.util.Iterator;
@@ -30,6 +32,8 @@
  * @see ListMediator
  */
 public abstract class AbstractListMediator extends AbstractMediator implements ListMediator {
+
+    private static final Log log = LogFactory.getLog(AbstractListMediator.class);
 
     protected List mediators = new ArrayList();
 

Modified: incubator/synapse/trunk/scratch/synapse2/modules/core/src/org/apache/synapse/mediators/AbstractMediator.java
URL: http://svn.apache.org/viewcvs/incubator/synapse/trunk/scratch/synapse2/modules/core/src/org/apache/synapse/mediators/AbstractMediator.java?rev=399953&r1=399952&r2=399953&view=diff
==============================================================================
--- incubator/synapse/trunk/scratch/synapse2/modules/core/src/org/apache/synapse/mediators/AbstractMediator.java (original)
+++ incubator/synapse/trunk/scratch/synapse2/modules/core/src/org/apache/synapse/mediators/AbstractMediator.java Thu May  4 21:33:17 2006
@@ -25,8 +25,6 @@
  */
 public abstract class AbstractMediator implements Mediator {
 
-    protected final Log log = LogFactory.getLog(getClass());
-
     /**
      * Returns the class name of the mediator
      * @return the class name of the mediator

Modified: incubator/synapse/trunk/scratch/synapse2/modules/core/src/org/apache/synapse/mediators/MediatorProperty.java
URL: http://svn.apache.org/viewcvs/incubator/synapse/trunk/scratch/synapse2/modules/core/src/org/apache/synapse/mediators/MediatorProperty.java?rev=399953&r1=399952&r2=399953&view=diff
==============================================================================
--- incubator/synapse/trunk/scratch/synapse2/modules/core/src/org/apache/synapse/mediators/MediatorProperty.java (original)
+++ incubator/synapse/trunk/scratch/synapse2/modules/core/src/org/apache/synapse/mediators/MediatorProperty.java Thu May  4 21:33:17 2006
@@ -15,7 +15,7 @@
 */
 package org.apache.synapse.mediators;
 
-import org.apache.synapse.config.Constants;
+import org.apache.synapse.config.xml.Constants;
 import org.apache.synapse.Util;
 import org.apache.synapse.SynapseMessage;
 import org.apache.axiom.om.xpath.AXIOMXPath;

Modified: incubator/synapse/trunk/scratch/synapse2/modules/core/src/org/apache/synapse/mediators/base/SequenceMediator.java
URL: http://svn.apache.org/viewcvs/incubator/synapse/trunk/scratch/synapse2/modules/core/src/org/apache/synapse/mediators/base/SequenceMediator.java?rev=399953&r1=399952&r2=399953&view=diff
==============================================================================
--- incubator/synapse/trunk/scratch/synapse2/modules/core/src/org/apache/synapse/mediators/base/SequenceMediator.java (original)
+++ incubator/synapse/trunk/scratch/synapse2/modules/core/src/org/apache/synapse/mediators/base/SequenceMediator.java Thu May  4 21:33:17 2006
@@ -19,6 +19,8 @@
 import org.apache.synapse.SynapseException;
 import org.apache.synapse.api.Mediator;
 import org.apache.synapse.mediators.AbstractListMediator;
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
 
 /**
  * The Sequence mediator either refers to another Sequence mediator instance
@@ -26,6 +28,7 @@
  */
 public class SequenceMediator extends AbstractListMediator {
 
+    private static final Log log = LogFactory.getLog(SequenceMediator.class);
     private String name = null;
     private String ref = null;
 

Modified: incubator/synapse/trunk/scratch/synapse2/modules/core/src/org/apache/synapse/mediators/builtin/DropMediator.java
URL: http://svn.apache.org/viewcvs/incubator/synapse/trunk/scratch/synapse2/modules/core/src/org/apache/synapse/mediators/builtin/DropMediator.java?rev=399953&r1=399952&r2=399953&view=diff
==============================================================================
--- incubator/synapse/trunk/scratch/synapse2/modules/core/src/org/apache/synapse/mediators/builtin/DropMediator.java (original)
+++ incubator/synapse/trunk/scratch/synapse2/modules/core/src/org/apache/synapse/mediators/builtin/DropMediator.java Thu May  4 21:33:17 2006
@@ -18,11 +18,15 @@
 
 import org.apache.synapse.SynapseMessage;
 import org.apache.synapse.mediators.AbstractMediator;
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
 
 /**
  * Halts further processing/mediation of the current message. i.e. returns false
  */
 public class DropMediator extends AbstractMediator {
+
+    private static final Log log = LogFactory.getLog(LogMediator.class);
 
     /**
      * Halts further mediation of the current message by returning false.

Modified: incubator/synapse/trunk/scratch/synapse2/modules/core/src/org/apache/synapse/mediators/builtin/LogMediator.java
URL: http://svn.apache.org/viewcvs/incubator/synapse/trunk/scratch/synapse2/modules/core/src/org/apache/synapse/mediators/builtin/LogMediator.java?rev=399953&r1=399952&r2=399953&view=diff
==============================================================================
--- incubator/synapse/trunk/scratch/synapse2/modules/core/src/org/apache/synapse/mediators/builtin/LogMediator.java (original)
+++ incubator/synapse/trunk/scratch/synapse2/modules/core/src/org/apache/synapse/mediators/builtin/LogMediator.java Thu May  4 21:33:17 2006
@@ -20,6 +20,8 @@
 import org.apache.synapse.SynapseMessage;
 import org.apache.synapse.mediators.AbstractMediator;
 import org.apache.synapse.mediators.MediatorProperty;
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
 
 import java.util.Iterator;
 import java.util.List;
@@ -34,6 +36,8 @@
  * using the defined seperator (\n, "," etc)
  */
 public class LogMediator extends AbstractMediator {
+
+    private static final Log log = LogFactory.getLog(LogMediator.class);
 
     public static final int CUSTOM = 0;
     public static final int SIMPLE = 1;

Modified: incubator/synapse/trunk/scratch/synapse2/modules/core/src/org/apache/synapse/mediators/builtin/SendMediator.java
URL: http://svn.apache.org/viewcvs/incubator/synapse/trunk/scratch/synapse2/modules/core/src/org/apache/synapse/mediators/builtin/SendMediator.java?rev=399953&r1=399952&r2=399953&view=diff
==============================================================================
--- incubator/synapse/trunk/scratch/synapse2/modules/core/src/org/apache/synapse/mediators/builtin/SendMediator.java (original)
+++ incubator/synapse/trunk/scratch/synapse2/modules/core/src/org/apache/synapse/mediators/builtin/SendMediator.java Thu May  4 21:33:17 2006
@@ -19,6 +19,8 @@
 import org.apache.synapse.SynapseMessage;
 import org.apache.synapse.Constants;
 import org.apache.synapse.mediators.AbstractMediator;
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
 
 /**
  * The Send mediator sends the message using the following semantics.
@@ -29,6 +31,7 @@
  */
 public class SendMediator extends AbstractMediator {
 
+    private static final Log log = LogFactory.getLog(SendMediator.class);
     /**
      * This is a leaf mediator. i.e. processing stops once send is invoked,
      * as it always returns false

Modified: incubator/synapse/trunk/scratch/synapse2/modules/core/src/org/apache/synapse/mediators/ext/ClassMediator.java
URL: http://svn.apache.org/viewcvs/incubator/synapse/trunk/scratch/synapse2/modules/core/src/org/apache/synapse/mediators/ext/ClassMediator.java?rev=399953&r1=399952&r2=399953&view=diff
==============================================================================
--- incubator/synapse/trunk/scratch/synapse2/modules/core/src/org/apache/synapse/mediators/ext/ClassMediator.java (original)
+++ incubator/synapse/trunk/scratch/synapse2/modules/core/src/org/apache/synapse/mediators/ext/ClassMediator.java Thu May  4 21:33:17 2006
@@ -21,6 +21,8 @@
 import org.apache.synapse.SynapseMessage;
 import org.apache.synapse.api.Mediator;
 import org.apache.synapse.mediators.AbstractMediator;
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
 
 
 /**
@@ -33,6 +35,7 @@
 
     private Class clazz = null;
 
+    private static final Log log = LogFactory.getLog(ClassMediator.class);
 
     public boolean mediate(SynapseMessage smc) {
         log.debug(getType() + " mediate()");

Modified: incubator/synapse/trunk/scratch/synapse2/modules/core/src/org/apache/synapse/mediators/filters/FilterMediator.java
URL: http://svn.apache.org/viewcvs/incubator/synapse/trunk/scratch/synapse2/modules/core/src/org/apache/synapse/mediators/filters/FilterMediator.java?rev=399953&r1=399952&r2=399953&view=diff
==============================================================================
--- incubator/synapse/trunk/scratch/synapse2/modules/core/src/org/apache/synapse/mediators/filters/FilterMediator.java (original)
+++ incubator/synapse/trunk/scratch/synapse2/modules/core/src/org/apache/synapse/mediators/filters/FilterMediator.java Thu May  4 21:33:17 2006
@@ -23,6 +23,8 @@
 import org.apache.synapse.SynapseMessage;
 import org.apache.synapse.Util;
 import org.apache.synapse.mediators.AbstractListMediator;
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
 import org.jaxen.JaxenException;
 
 import java.util.regex.Pattern;
@@ -35,6 +37,7 @@
  */
 public class FilterMediator extends AbstractListMediator implements org.apache.synapse.api.FilterMediator {
 
+    private static final Log log = LogFactory.getLog(FilterMediator.class);
     private AXIOMXPath source = null;
     private Pattern regex = null;
     private AXIOMXPath xpath = null;

Modified: incubator/synapse/trunk/scratch/synapse2/modules/core/src/org/apache/synapse/mediators/transform/FaultMediator.java
URL: http://svn.apache.org/viewcvs/incubator/synapse/trunk/scratch/synapse2/modules/core/src/org/apache/synapse/mediators/transform/FaultMediator.java?rev=399953&r1=399952&r2=399953&view=diff
==============================================================================
--- incubator/synapse/trunk/scratch/synapse2/modules/core/src/org/apache/synapse/mediators/transform/FaultMediator.java (original)
+++ incubator/synapse/trunk/scratch/synapse2/modules/core/src/org/apache/synapse/mediators/transform/FaultMediator.java Thu May  4 21:33:17 2006
@@ -36,6 +36,8 @@
  * TODO this class needs more attention! - revisit later
  */
 public class FaultMediator extends AbstractMediator {
+    
+    private static final Log log = LogFactory.getLog(FaultMediator.class);
 
     public static final int SOAP11 = 1;
     public static final int SOAP12 = 2;

Modified: incubator/synapse/trunk/scratch/synapse2/modules/core/src/org/apache/synapse/mediators/transform/HeaderMediator.java
URL: http://svn.apache.org/viewcvs/incubator/synapse/trunk/scratch/synapse2/modules/core/src/org/apache/synapse/mediators/transform/HeaderMediator.java?rev=399953&r1=399952&r2=399953&view=diff
==============================================================================
--- incubator/synapse/trunk/scratch/synapse2/modules/core/src/org/apache/synapse/mediators/transform/HeaderMediator.java (original)
+++ incubator/synapse/trunk/scratch/synapse2/modules/core/src/org/apache/synapse/mediators/transform/HeaderMediator.java Thu May  4 21:33:17 2006
@@ -20,6 +20,8 @@
 import org.apache.synapse.HeaderType;
 import org.apache.synapse.Util;
 import org.apache.axiom.om.xpath.AXIOMXPath;
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
 
 /**
  * The header mediator is able to set a given value as a SOAP header, or remove a given
@@ -31,6 +33,8 @@
  * @see HeaderType
  */
 public class HeaderMediator extends AbstractMediator {
+
+    private static final Log log = LogFactory.getLog(HeaderMediator.class);
 
     public static final int ACTION_SET = 0;
     public static final int ACTION_REMOVE = 1;

Modified: incubator/synapse/trunk/scratch/synapse2/modules/core/src/org/apache/synapse/mediators/transform/TransformMediator.java
URL: http://svn.apache.org/viewcvs/incubator/synapse/trunk/scratch/synapse2/modules/core/src/org/apache/synapse/mediators/transform/TransformMediator.java?rev=399953&r1=399952&r2=399953&view=diff
==============================================================================
--- incubator/synapse/trunk/scratch/synapse2/modules/core/src/org/apache/synapse/mediators/transform/TransformMediator.java (original)
+++ incubator/synapse/trunk/scratch/synapse2/modules/core/src/org/apache/synapse/mediators/transform/TransformMediator.java Thu May  4 21:33:17 2006
@@ -2,11 +2,20 @@
 
 
 import org.apache.axiom.om.OMNode;
+import org.apache.axiom.om.OMDocument;
+import org.apache.axiom.om.OMContainer;
+import org.apache.axiom.om.OMAbstractFactory;
 import org.apache.axiom.om.impl.builder.StAXOMBuilder;
 import org.apache.axiom.om.xpath.AXIOMXPath;
+import org.apache.axiom.soap.SOAPEnvelope;
+import org.apache.axiom.soap.SOAPFactory;
+import org.apache.axiom.soap.SOAP12Constants;
+import org.apache.axiom.soap.SOAP11Constants;
 import org.apache.synapse.SynapseException;
 import org.apache.synapse.SynapseMessage;
 import org.apache.synapse.mediators.AbstractMediator;
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
 import org.jaxen.JaxenException;
 
 import javax.xml.stream.XMLOutputFactory;
@@ -20,6 +29,7 @@
 import java.io.IOException;
 import java.net.MalformedURLException;
 import java.net.URL;
+import java.util.List;
 
 /**
  * The transform mediator performs an XSLT or XQuery transformation requested, using
@@ -29,9 +39,11 @@
  */
 public class TransformMediator extends AbstractMediator {
 
+    private static final Log log = LogFactory.getLog(TransformMediator.class);
+
     private URL xsltUrl = null;
-    private URL xqUrl = null;
-    private String source = null;
+    private URL xQueryUrl = null;
+    private AXIOMXPath source = null;
 
     /**
      * Transforms this message (or its element specified as the source) using the
@@ -46,7 +58,7 @@
             performXLST(synMsg);
             return true;
 
-        } else if (xqUrl != null) {
+        } else if (xQueryUrl != null) {
             //TODO later revisit later
             System.err.println("Unimplemented functionality..");
             return true;
@@ -67,17 +79,7 @@
             ByteArrayOutputStream baosForSource = new ByteArrayOutputStream();
             XMLStreamWriter xsWriterForSource = XMLOutputFactory.newInstance().createXMLStreamWriter(baosForSource);
 
-            AXIOMXPath xp = new AXIOMXPath(source);
-            Object result = xp.evaluate(synMsg.getEnvelope());
-            OMNode sourceNode = null;
-
-            if (result instanceof OMNode) {
-                sourceNode = (OMNode) result;
-            } else {
-                String msg = "XPath evaluation of the source element did not return an OMNode";
-                log.error(msg);
-                throw new SynapseException(msg);
-            }
+            OMNode sourceNode = getTransformSource(synMsg);
             sourceNode.serialize(xsWriterForSource);
             Source transformSrc = new StreamSource(new ByteArrayInputStream(baosForSource.toByteArray()));
 
@@ -89,7 +91,15 @@
             transformer.transform(transformSrc, transformTgt);
 
             StAXOMBuilder builder = new StAXOMBuilder(new ByteArrayInputStream(baosForTarget.toByteArray()));
-            sourceNode.getParent().addChild(builder.getDocumentElement());
+            OMContainer parent = sourceNode.getParent();
+
+            if (parent instanceof SOAPEnvelope) {
+                ((SOAPEnvelope) parent).getBody().getFirstOMChild().detach();
+                ((SOAPEnvelope) parent).getBody().setFirstChild(builder.getDocumentElement());
+            } else {
+                parent.getFirstOMChild().detach();
+                parent.addChild(builder.getDocumentElement());
+            }
 
         } catch (MalformedURLException mue) {
             handleException(mue);
@@ -97,8 +107,6 @@
             handleException(tce);
         } catch (XMLStreamException xse) {
             handleException(xse);
-        } catch (JaxenException je) {
-            handleException(je);
         } catch (TransformerException te) {
             handleException(te);
         } catch (IOException ioe) {
@@ -106,10 +114,63 @@
         }
     }
 
+    private OMNode getTransformSource(SynapseMessage synMsg) {
+
+        if (source == null) {
+            try {
+                source = new AXIOMXPath("//SOAP-ENV:Body");
+                source.addNamespace("SOAP-ENV", synMsg.isSOAP11() ?
+                    SOAP11Constants.SOAP_ENVELOPE_NAMESPACE_URI : SOAP12Constants.SOAP_ENVELOPE_NAMESPACE_URI);
+            } catch (JaxenException e) {}
+        }
+
+        try {
+            Object o = source.evaluate(synMsg.getEnvelope());;
+            if (o instanceof OMNode) {
+                return (OMNode) o;
+            } else if (o instanceof List && !((List) o).isEmpty()) {
+                return (OMNode) ((List) o).get(0);  // Always fetches *only* the first
+            } else {
+                String msg = "The evaluation of the XPath expression " + source + " must result in an OMNode";
+                log.error(msg);
+                throw new SynapseException(msg);
+            }
+
+        } catch (JaxenException e) {
+            String msg = "Error evaluating XPath " + source + " on message";
+            log.error(msg);
+            throw new SynapseException(msg, e);
+        }
+    }
+
     private void handleException(Exception e) {
         String msg = "Error performing XSLT/XQ transformation " + e.getMessage();
         log.error(msg);
         throw new SynapseException(msg, e);
+    }
+
+    public AXIOMXPath getSource() {
+        return source;
+    }
+
+    public void setSource(AXIOMXPath source) {
+        this.source = source;
+    }
+
+    public URL getXsltUrl() {
+        return xsltUrl;
+    }
+
+    public void setXsltUrl(URL xsltUrl) {
+        this.xsltUrl = xsltUrl;
+    }
+
+    public URL getXQueryUrl() {
+        return xQueryUrl;
+    }
+
+    public void setXQueryUrl(URL xQueryUrl) {
+        this.xQueryUrl = xQueryUrl;
     }
 
 }

Modified: incubator/synapse/trunk/scratch/synapse2/modules/samples/src/samples/userguide/DumbStockQuoteClient.java
URL: http://svn.apache.org/viewcvs/incubator/synapse/trunk/scratch/synapse2/modules/samples/src/samples/userguide/DumbStockQuoteClient.java?rev=399953&r1=399952&r2=399953&view=diff
==============================================================================
--- incubator/synapse/trunk/scratch/synapse2/modules/samples/src/samples/userguide/DumbStockQuoteClient.java (original)
+++ incubator/synapse/trunk/scratch/synapse2/modules/samples/src/samples/userguide/DumbStockQuoteClient.java Thu May  4 21:33:17 2006
@@ -63,7 +63,7 @@
             EndpointReference targetEPR = new EndpointReference(url);
 
             Options options = new Options();
-            options.setTo(targetEPR);
+              options.setTo(targetEPR);
 
             options.setAction("http://www.webserviceX.NET/GetQuote");
                         



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


Mime
View raw message