You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@synapse.apache.org by sa...@apache.org on 2006/02/15 08:11:37 UTC

svn commit: r377953 [3/9] - in /incubator/synapse/trunk/scratch/synase-multimodules: ./ bin/ etc/ modules/ modules/core/ modules/core/conf/ modules/core/src/ modules/core/src/org/ modules/core/src/org/apache/ modules/core/src/org/apache/synapse/ module...

Added: incubator/synapse/trunk/scratch/synase-multimodules/modules/core/project.xml
URL: http://svn.apache.org/viewcvs/incubator/synapse/trunk/scratch/synase-multimodules/modules/core/project.xml?rev=377953&view=auto
==============================================================================
--- incubator/synapse/trunk/scratch/synase-multimodules/modules/core/project.xml (added)
+++ incubator/synapse/trunk/scratch/synase-multimodules/modules/core/project.xml Tue Feb 14 23:11:24 2006
@@ -0,0 +1,204 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<project>
+	
+    <pomVersion>3</pomVersion>
+    <extend>../../etc/project.xml</extend>
+
+
+    <name>Apache Synapse - Core</name>
+    <id>synapse-core</id>
+    <groupId>synapse</groupId>
+
+    <!-- ============ -->
+    <!-- Dependencies -->
+    <!-- ============ -->
+
+    <dependencies>
+        <!-- external JARs -->
+        <dependency>
+            <groupId>axis2</groupId>
+            <artifactId>axis2-core</artifactId>
+            <version>${axis2.version}</version>
+        </dependency>
+        <dependency>
+            <groupId>commons-logging</groupId>
+            <artifactId>commons-logging</artifactId>
+            <version>${commons.logging.version}</version>
+            <properties>
+                <module>true</module>
+            </properties>
+        </dependency>
+
+        <dependency>
+            <groupId>commons-httpclient</groupId>
+            <artifactId>commons-httpclient</artifactId>
+            <version>${commons.httpclient.version}</version>
+            <properties>
+                <module>true</module>
+            </properties>
+        </dependency>
+        <dependency>
+            <groupId>commons-discovery</groupId>
+            <artifactId>commons-discovery</artifactId>
+            <version>${commons.discovery.version}</version>
+            <properties>
+                <module>true</module>
+            </properties>
+        </dependency>
+        <dependency>
+            <groupId>commons-codec</groupId>
+            <artifactId>commons-codec</artifactId>
+            <version>${commons.codec.version}</version>
+            <properties>
+                <module>true</module>
+            </properties>
+        </dependency>
+        <dependency>
+            <groupId>log4j</groupId>
+            <artifactId>log4j</artifactId>
+            <version>${log4j.version}</version>
+            <properties>
+                <module>true</module>
+            </properties>
+        </dependency>
+        <dependency>
+            <groupId>${stax.impl.groupid}</groupId>
+            <artifactId>${stax.impl.artifactid}</artifactId>
+            <version>${stax.impl.version}</version>
+            <properties>
+                <module>true</module>
+            </properties>
+        </dependency>
+        <dependency>
+            <groupId>stax</groupId>
+            <artifactId>stax-api</artifactId>
+            <version>${stax.api.version}</version>
+            <properties>
+                <module>true</module>
+            </properties>
+        </dependency>
+        <dependency>
+            <groupId>axis</groupId>
+            <artifactId>axis-wsdl4j</artifactId>
+            <version>${axis.wsdl4j.version}</version>
+            <properties>
+                <module>true</module>
+            </properties>
+        </dependency>
+        <dependency>
+            <groupId>geronimo-spec</groupId>
+            <artifactId>geronimo-spec-javamail</artifactId>
+            <version>${geronimo.spec.javamail.version}</version>
+            <properties>
+                <module>true</module>
+            </properties>
+        </dependency>
+        <dependency>
+            <groupId>geronimo-spec</groupId>
+            <artifactId>geronimo-spec-activation</artifactId>
+            <version>${geronimo.spec.activation.version}</version>
+            <properties>
+                <module>true</module>
+            </properties>
+        </dependency>
+        <dependency>
+            <groupId>geronimo-spec</groupId>
+            <artifactId>geronimo-spec-jms</artifactId>
+            <version>${geronimo.spec.jms.version}</version>
+            <properties>
+                <module>true</module>
+            </properties>
+        </dependency>
+        <dependency>
+            <groupId>junit</groupId>
+            <artifactId>junit</artifactId>
+            <version>${junit.version}</version>
+            <properties>
+                <classloader>root</classloader>
+            </properties>
+        </dependency>
+        <dependency>
+            <groupId>jaxen</groupId>
+            <artifactId>jaxen</artifactId>
+            <version>${jaxen.version}</version>
+            <properties>
+                <module>true</module>
+            </properties>
+        </dependency>
+        <dependency>
+            <groupId>xalan</groupId>
+            <artifactId>xalan</artifactId>
+            <version>2.6.0</version>
+            <properties>
+                <module>true</module>
+            </properties>
+        </dependency>
+        <dependency>
+            <groupId>annogen</groupId>
+            <artifactId>annogen</artifactId>
+            <version>${annogen.version}</version>
+            <properties>
+                <module>true</module>
+            </properties>
+        </dependency>
+        <dependency>
+            <groupId>ws-commons</groupId>
+            <artifactId>XmlSchema</artifactId>
+            <version>${XmlSchema.version}</version>
+        </dependency>
+        <dependency>
+            <groupId>ws-commons</groupId>
+            <artifactId>policy</artifactId>
+            <version>${policy.version}</version>
+            <properties>
+                <module>false</module>
+            </properties>
+        </dependency>
+        <dependency>
+            <groupId>ws-commons</groupId>
+            <artifactId>axiom</artifactId>
+            <version>${axiom.version}</version>
+            <properties>
+                <module>false</module>
+            </properties>
+        </dependency>
+        <dependency>
+            <groupId>backport-util-concurrent</groupId>
+            <artifactId>backport-util-concurrent</artifactId>
+            <version>${backport_util_concurrent.version}</version>
+            <properties>
+                <module>true</module>
+            </properties>
+        </dependency>
+    </dependencies>
+
+    <build>
+        <nagEmailAddress>synapse-dev@ws.apache.org</nagEmailAddress>
+        <sourceDirectory>src</sourceDirectory>
+        <unitTestSourceDirectory>test</unitTestSourceDirectory>
+        <unitTest>
+            <includes>
+                <include>**/*Test.java</include>
+            </includes>
+            <!--<excludes>-->
+                <!--<exclude>**/*Test.java</exclude>-->
+            <!--</excludes>-->
+            <resources>
+                <resource>
+                    <directory>test-resources</directory>
+                </resource>
+            </resources>
+        </unitTest>
+
+        <resources>
+			<resource>
+				<directory>conf</directory>
+				<includes>
+					<include>**/*.properties</include>
+				</includes>
+			</resource>
+        </resources>
+
+    </build>
+</project>
+

Added: incubator/synapse/trunk/scratch/synase-multimodules/modules/core/src/org/apache/synapse/Constants.java
URL: http://svn.apache.org/viewcvs/incubator/synapse/trunk/scratch/synase-multimodules/modules/core/src/org/apache/synapse/Constants.java?rev=377953&view=auto
==============================================================================
--- incubator/synapse/trunk/scratch/synase-multimodules/modules/core/src/org/apache/synapse/Constants.java (added)
+++ incubator/synapse/trunk/scratch/synase-multimodules/modules/core/src/org/apache/synapse/Constants.java Tue Feb 14 23:11:24 2006
@@ -0,0 +1,61 @@
+/*
+ * 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;
+
+import javax.xml.namespace.QName;
+
+
+
+/**
+ *
+ * 
+ * <p> Global constants for the Synapse project
+ *
+ */
+public interface Constants {
+	
+
+	String CLASSMEDIATOR = "classmediator";
+
+	QName MEDIATE_OPERATION_NAME = new QName("mediate");
+
+	String MEDIATOR_RESPONSE_PROPERTY = "synapse.mediator.response";
+	String MEDIATOR_SYNAPSE_ENV_PROPERTY = "synapse.mediator.environment";
+
+	String ISRESPONSE_PROPERTY = "synapse.isresponse";
+
+	String EMPTYMEDIATOR = "emptymediator";
+
+    //this is for the synapse.xml config
+    String SYNAPSECONFIGURATION = "SynapseConfiguration";
+
+	String SYNAPSE_ENVIRONMENT = "synapse.environment";
+
+	String ADD_ADDRESSING = "synapse.send.useaddressing";
+
+    // for security supporting
+
+    String SECURITY_QOS = "synapse_security";
+    String ADDRESSING_PROCESSED_CONFIGURATION_CONTEXT = "addressing_processed_configurationContext";
+
+    // addressing properites handling
+
+    String ADDRESSING_PROCESSED = "__ADDRESSING_PROCESSED";
+
+    // transport header selection
+
+    String OK_200 = "200_OK";
+}

Added: incubator/synapse/trunk/scratch/synase-multimodules/modules/core/src/org/apache/synapse/HeaderType.java
URL: http://svn.apache.org/viewcvs/incubator/synapse/trunk/scratch/synase-multimodules/modules/core/src/org/apache/synapse/HeaderType.java?rev=377953&view=auto
==============================================================================
--- incubator/synapse/trunk/scratch/synase-multimodules/modules/core/src/org/apache/synapse/HeaderType.java (added)
+++ incubator/synapse/trunk/scratch/synase-multimodules/modules/core/src/org/apache/synapse/HeaderType.java Tue Feb 14 23:11:24 2006
@@ -0,0 +1,130 @@
+/*
+ * 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;
+
+import org.apache.axis2.addressing.EndpointReference;
+
+/**
+ *
+ * <p> This class encapsulates access to headers. It has a set of "logical names" (e.g. strings) 
+ * Once you have set the logical name you can read and write that header on a SynapseMessage
+ * It is used by the RegexProcessor and the HeaderProcessor classes.
+ *
+ */
+public class HeaderType {
+
+	private final static int TO = 1, FROM = 2, FAULT = 3, ACTION = 4,
+			REPLYTO = 5;
+
+	public final static String STRTO = "to", STRFROM = "from",
+			STRFAULT = "faultto", STRACTION = "action", STRREPLYTO = "replyto";
+
+	private int headerType = 0;
+
+	public void setHeaderType(String header) {
+		if (header.equalsIgnoreCase(STRTO))
+			headerType = TO;
+		else if (header.equalsIgnoreCase(STRFROM))
+			headerType = FROM;
+		else if (header.equalsIgnoreCase(STRFAULT))
+			headerType = FAULT;
+		else if (header.equalsIgnoreCase(STRACTION))
+			headerType = ACTION;
+		else if (header.equalsIgnoreCase(STRREPLYTO))
+			headerType = REPLYTO;
+		else
+			throw new SynapseException("unknown header type");
+	}
+
+	public String getHeaderType() {
+		switch (headerType) {
+
+		case TO:
+			return STRTO;
+		case FROM:
+			return STRFROM;
+		case FAULT:
+			return STRFAULT;
+		case ACTION:
+			return STRACTION;
+		case REPLYTO:
+			return STRREPLYTO;
+
+		}
+		return null;
+	}
+
+	public String getHeader(SynapseMessage sm) {
+		switch (headerType) {
+		case TO: {
+			if (sm.getTo() != null)
+				return sm.getTo().getAddress();
+
+		}
+		case FROM: {
+			if (sm.getFrom() != null)
+				return sm.getFrom().getAddress();
+			break;
+		}
+		case FAULT: {
+			if (sm.getFaultTo() != null)
+				return sm.getFaultTo().getAddress();
+			break;
+		}
+		case ACTION: {
+			if (sm.getWSAAction() != null)
+				return sm.getWSAAction();
+			break;
+		}
+		case REPLYTO: {
+			if (sm.getReplyTo() != null)
+				return sm.getReplyTo().getAddress();
+			break;
+		}
+		}
+
+		return null;
+	}
+
+	public void setHeader(SynapseMessage sm, String value) {
+		switch (headerType) {
+		case 0: {
+			throw new SynapseException(
+					"headerType=0 in setHeader. Assume called setHeader before setHeaderType");
+		}
+
+		case TO: {
+
+			sm.setTo(new EndpointReference(value));
+			break;
+		}
+		case FROM: {
+			sm.setFrom(new EndpointReference(value));
+			break;
+		}
+		case REPLYTO: {
+			sm.setReplyTo(new EndpointReference(value));
+			break;
+		}
+		case ACTION: {
+			sm.setWSAAction(value);
+			break;
+		}
+
+		}
+	}
+}

Added: incubator/synapse/trunk/scratch/synase-multimodules/modules/core/src/org/apache/synapse/Processor.java
URL: http://svn.apache.org/viewcvs/incubator/synapse/trunk/scratch/synase-multimodules/modules/core/src/org/apache/synapse/Processor.java?rev=377953&view=auto
==============================================================================
--- incubator/synapse/trunk/scratch/synase-multimodules/modules/core/src/org/apache/synapse/Processor.java (added)
+++ incubator/synapse/trunk/scratch/synase-multimodules/modules/core/src/org/apache/synapse/Processor.java Tue Feb 14 23:11:24 2006
@@ -0,0 +1,58 @@
+/*
+ * 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;
+
+
+/**
+ * Processors are the main extension mechanism for Synapse. 
+ * <p>
+ * A Processor together with the XML ProcessorConfigurator extends both the synapse.xml 
+ * and the actual processing power of Synapse.
+ * <p>
+ * Some of the processors are "builtin" and those are defined in the ProcessorConfiguratorFinder
+ * <p>
+ * Other processors can be registered using the JAR Service Provider model:
+ * <br><a href="http://java.sun.com/j2se/1.3/docs/guide/jar/jar.html#Service%20Provider">http://java.sun.com/j2se/1.3/docs/guide/jar/jar.html#Service%20Provider</a><p>
+ * 
+ * The processor then deals with a message. It returns false if no further
+ * processing is desired. It can have a name (or null)
+ * <p>
+ * Processors can either devolve processing to other processors (e.g. a rule,
+ * stage, etc) or deal with the message itself (e.g. mediator)
+ * 
+ */
+public interface Processor {
+	
+	
+	/**
+	 * This method is used to process a message. A response of true indicates continue processing.
+	 * A response of false indicates to stop processing.
+	 */
+	public boolean process(SynapseEnvironment se, SynapseMessage sm);
+	
+	
+	/**
+	 * the name of the instance of this processor
+	 */
+	public String getName();
+	
+	
+	/**
+	 * set the name of the instance of the processor
+	 */
+	public void setName(String name);
+}

Added: incubator/synapse/trunk/scratch/synase-multimodules/modules/core/src/org/apache/synapse/SynapseEnvironment.java
URL: http://svn.apache.org/viewcvs/incubator/synapse/trunk/scratch/synase-multimodules/modules/core/src/org/apache/synapse/SynapseEnvironment.java?rev=377953&view=auto
==============================================================================
--- incubator/synapse/trunk/scratch/synase-multimodules/modules/core/src/org/apache/synapse/SynapseEnvironment.java (added)
+++ incubator/synapse/trunk/scratch/synase-multimodules/modules/core/src/org/apache/synapse/SynapseEnvironment.java Tue Feb 14 23:11:24 2006
@@ -0,0 +1,127 @@
+/*
+ * 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;
+
+import java.util.Map;
+import java.util.HashMap;
+
+
+/**
+ *
+ * 
+ * <p>Common stuff needed to embed Synapse into a given runtime (e.g. Axis2) 
+ * <p>This interface is used by the processors, and also by EnvironmentAware mediators
+ * 
+ *
+ */
+public abstract class SynapseEnvironment {
+
+    protected SynapseEnvironment parent;
+    protected Map properties;
+
+    protected SynapseEnvironment(SynapseEnvironment parent) {
+        this.properties = new HashMap();
+        this.parent = parent;
+    }
+
+    public SynapseEnvironment getParent() {
+        return this.parent;
+    }
+
+    public void setParent(SynapseEnvironment parent) {
+        this.parent = parent;
+    }
+
+    /**
+     * Retrieves an object given a key.
+     *
+     * @param key - if not found, will return null
+     * @return Returns the property.
+     */
+    public Object getProperty(String key) {
+        Object obj = null;
+
+        obj = properties.get(key);
+
+        if ((obj == null) && (parent != null)) {
+            obj = parent.getProperty(key);
+        }
+
+        return obj;
+    }
+
+    /**
+     * Store a property for message context
+     *
+     * @param key
+     * @param value
+     */
+    public void setProperty(String key, Object value) {
+        properties.put(key, value);
+    }
+    
+    /*
+      * This method injects a new message into the Synapse engine
+      * It is used in a couple of ways. Firstly, this is how, for example,
+      * Axis2 kicks messages into Synapse to start with.
+      * <p>
+      * Also mediators can use this to send messages that they want to be mediated by Synapse
+      * <p>For example if you want to send a copy of a message somewhere, you can clone it and then
+      * injectMessage()
+      */
+    abstract public void injectMessage(SynapseMessage smc);
+
+    /*
+      * Processors or Mediators that wish to load classes should use the ClassLoader given here
+      */
+    abstract public ClassLoader getClassLoader();
+
+
+    /**
+     * This method allows you send messages on. As opposed to injectMessage send message does not
+     * process these through Synapse.
+     * <p>
+     * This will send request messages on, and send response messages back to the client
+     */
+    abstract public void send(SynapseMessage smc, SynapseEnvironment se);
+
+
+    /**
+     * This is used by the references to find a processor with a given name
+     *
+     */
+    abstract public Processor lookupProcessor(String name);
+
+
+    /**
+     * This is how you add a processor to the list of processors. The name which it can be
+     * retrieved by is the processor.getName()
+     */
+    abstract public void addProcessor(Processor p);
+
+
+    /**
+     * This returns the "Master Processor" which is the root processor for this instance of
+     * Synapse. Usually this would be the processor derived from &ltsynapse>.
+     */
+    abstract public Processor getMasterProcessor();
+
+
+    /**
+     * This sets the root processor for the engine.
+     */
+    abstract public void setMasterProcessor(Processor p);
+}

Added: incubator/synapse/trunk/scratch/synase-multimodules/modules/core/src/org/apache/synapse/SynapseException.java
URL: http://svn.apache.org/viewcvs/incubator/synapse/trunk/scratch/synase-multimodules/modules/core/src/org/apache/synapse/SynapseException.java?rev=377953&view=auto
==============================================================================
--- incubator/synapse/trunk/scratch/synase-multimodules/modules/core/src/org/apache/synapse/SynapseException.java (added)
+++ incubator/synapse/trunk/scratch/synase-multimodules/modules/core/src/org/apache/synapse/SynapseException.java Tue Feb 14 23:11:24 2006
@@ -0,0 +1,42 @@
+/*
+ * 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;
+
+/**
+ *
+ * <p>Runtime exception for Synapse code to throw
+ *
+ */
+public class SynapseException extends RuntimeException {
+
+	private static final long serialVersionUID = -7244032125641596311L;
+
+	public SynapseException(String string) {
+		super(string);
+
+	}
+
+	public SynapseException(String msg, Throwable e) {
+		super(msg, e);
+
+	}
+
+	public SynapseException(Throwable t) {
+		super(t);
+
+	}
+
+}

Added: incubator/synapse/trunk/scratch/synase-multimodules/modules/core/src/org/apache/synapse/SynapseMessage.java
URL: http://svn.apache.org/viewcvs/incubator/synapse/trunk/scratch/synase-multimodules/modules/core/src/org/apache/synapse/SynapseMessage.java?rev=377953&view=auto
==============================================================================
--- incubator/synapse/trunk/scratch/synase-multimodules/modules/core/src/org/apache/synapse/SynapseMessage.java (added)
+++ incubator/synapse/trunk/scratch/synase-multimodules/modules/core/src/org/apache/synapse/SynapseMessage.java Tue Feb 14 23:11:24 2006
@@ -0,0 +1,99 @@
+/*
+ * 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;
+
+import org.apache.axis2.AxisFault;
+import org.apache.axis2.addressing.EndpointReference;
+import org.apache.axis2.addressing.RelatesTo;
+import org.apache.axis2.soap.SOAPEnvelope;
+
+/**
+ *
+ * 
+ * <p> The core definition of a message flowing thru Synapse.
+ * <p> The aim of this is to capture the Message Addressing Properties
+ * (aka Message Information Headers) and the SOAP Envelope. 
+ * The core To/From/FaultTo/ReplyTo/MessageID/RelatesTo stuff is here. <p>
+ * In addition this has get/setEnvelope.
+ * <p>
+ *  There is also a bag of properties<p>
+ *  There are markers for whether we support REST, MTOM and also if this is a response or not
+ */
+public interface SynapseMessage {
+
+	public EndpointReference getFaultTo();
+
+	public void setFaultTo(EndpointReference reference);
+
+	public EndpointReference getFrom();
+
+	public void setFrom(EndpointReference reference);
+
+	public SOAPEnvelope getEnvelope();
+
+	public void setEnvelope(SOAPEnvelope envelope) throws AxisFault;
+
+	public String getMessageID();
+
+	public void setMessageID(String string);
+
+	public RelatesTo getRelatesTo();
+
+	public void setRelatesTo(RelatesTo reference);
+
+	public EndpointReference getReplyTo();
+
+	public void setReplyTo(EndpointReference reference);
+
+	public EndpointReference getTo();
+
+	public void setTo(EndpointReference reference);
+
+	public void setWSAAction(String actionURI);
+
+	public String getWSAAction();
+
+	public void setMessageId(String messageID);
+
+	public String getMessageId();
+
+	public Object getProperty(String key);
+
+	public void setProperty(String key, Object value);
+
+	public String getSoapAction();
+
+	public void setSoapAction(String string);
+
+	public boolean isDoingMTOM();
+
+	public void setDoingMTOM(boolean b);
+
+	public boolean isDoingREST();
+
+	public void setDoingREST(boolean b);
+
+	public boolean isSOAP11();
+
+	public void setResponse(boolean b);
+
+	public boolean isResponse();
+
+    public void setFaultResponse(boolean b);
+
+    public boolean isFaultResponse();
+}

Added: incubator/synapse/trunk/scratch/synase-multimodules/modules/core/src/org/apache/synapse/api/EnvironmentAware.java
URL: http://svn.apache.org/viewcvs/incubator/synapse/trunk/scratch/synase-multimodules/modules/core/src/org/apache/synapse/api/EnvironmentAware.java?rev=377953&view=auto
==============================================================================
--- incubator/synapse/trunk/scratch/synase-multimodules/modules/core/src/org/apache/synapse/api/EnvironmentAware.java (added)
+++ incubator/synapse/trunk/scratch/synase-multimodules/modules/core/src/org/apache/synapse/api/EnvironmentAware.java Tue Feb 14 23:11:24 2006
@@ -0,0 +1,30 @@
+/*
+ * 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.api;
+
+import org.apache.synapse.SynapseEnvironment;
+
+/**
+ *
+ * <p>API for Mediators to get access to the Synapse Environment
+ *
+ */
+public interface EnvironmentAware {
+	public void setSynapseEnvironment(SynapseEnvironment se);
+	public void setClassLoader(ClassLoader cl);
+
+}

Added: incubator/synapse/trunk/scratch/synase-multimodules/modules/core/src/org/apache/synapse/api/Mediator.java
URL: http://svn.apache.org/viewcvs/incubator/synapse/trunk/scratch/synase-multimodules/modules/core/src/org/apache/synapse/api/Mediator.java?rev=377953&view=auto
==============================================================================
--- incubator/synapse/trunk/scratch/synase-multimodules/modules/core/src/org/apache/synapse/api/Mediator.java (added)
+++ incubator/synapse/trunk/scratch/synase-multimodules/modules/core/src/org/apache/synapse/api/Mediator.java Tue Feb 14 23:11:24 2006
@@ -0,0 +1,27 @@
+/*
+ * 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.api;
+
+import org.apache.synapse.SynapseMessage;
+
+/**
+ *
+ * <p>API interface for pluggable mediators
+ *
+ */
+public interface Mediator {
+	public boolean mediate(SynapseMessage smc);
+}
\ No newline at end of file

Added: incubator/synapse/trunk/scratch/synase-multimodules/modules/core/src/org/apache/synapse/axis2/Axis2FlexibleMEPClient.java
URL: http://svn.apache.org/viewcvs/incubator/synapse/trunk/scratch/synase-multimodules/modules/core/src/org/apache/synapse/axis2/Axis2FlexibleMEPClient.java?rev=377953&view=auto
==============================================================================
--- incubator/synapse/trunk/scratch/synase-multimodules/modules/core/src/org/apache/synapse/axis2/Axis2FlexibleMEPClient.java (added)
+++ incubator/synapse/trunk/scratch/synase-multimodules/modules/core/src/org/apache/synapse/axis2/Axis2FlexibleMEPClient.java Tue Feb 14 23:11:24 2006
@@ -0,0 +1,176 @@
+/*
+ * 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.axis2;
+
+
+import org.apache.axis2.context.ConfigurationContext;
+import org.apache.axis2.context.MessageContext;
+import org.apache.axis2.context.ServiceContext;
+import org.apache.axis2.context.ServiceGroupContext;
+import org.apache.axis2.description.*;
+import org.apache.axis2.engine.AxisConfiguration;
+
+import org.apache.axis2.soap.SOAPEnvelope;
+import org.apache.axis2.soap.SOAPHeader;
+import org.apache.axis2.soap.SOAPHeaderBlock;
+import org.apache.axis2.soap.SOAP11Constants;
+import org.apache.axis2.util.UUIDGenerator;
+import org.apache.axis2.deployment.util.PhasesInfo;
+import org.apache.axis2.AxisFault;
+import org.apache.axis2.addressing.AddressingConstants;
+import org.apache.axis2.client.OperationClient;
+import org.apache.axis2.client.Options;
+
+import org.apache.synapse.Constants;
+import org.apache.wsdl.WSDLConstants;
+
+
+import javax.xml.namespace.QName;
+import java.util.Iterator;
+import java.util.ArrayList;
+
+
+/**
+ * This is a simple client that handles both in only and in out
+ */
+public class Axis2FlexibleMEPClient {
+
+    public static SOAPEnvelope outEnvelopeConfiguration(MessageContext smc) {
+        SOAPEnvelope env = smc.getEnvelope();
+        SOAPHeader soapHeader = env.getHeader();
+        ArrayList addressingHeaders;
+        if (soapHeader != null) {
+            addressingHeaders = soapHeader.getHeaderBlocksWithNSURI(
+                    AddressingConstants.Submission.WSA_NAMESPACE);
+            if (addressingHeaders != null) {
+                detachAddressingInformation(addressingHeaders);
+
+            } else {
+                addressingHeaders = soapHeader.getHeaderBlocksWithNSURI(
+                        AddressingConstants.Final.WSA_NAMESPACE);
+                if (addressingHeaders != null) {
+                    detachAddressingInformation(addressingHeaders);
+                }
+            }
+        }
+        return env;
+    }
+
+    private static void detachAddressingInformation(ArrayList headerInformation) {
+        Iterator iterator = headerInformation.iterator();
+        while (iterator.hasNext()) {
+            SOAPHeaderBlock headerBlock = (SOAPHeaderBlock) iterator.next();
+            headerBlock.detach();
+        }
+
+    }
+
+    // Following code is based on Axis2 Client code.
+    public static MessageContext send(MessageContext smc) throws AxisFault {
+        // In this logic Synapse Work as a Client to a Server
+        // So here this logic should expect 200 ok, 202 ok and 500 internal server error
+        // current state of the code in Synchronus
+
+        // This is the original_configuration_context
+        ConfigurationContext cc = smc.getConfigurationContext();
+        AxisConfiguration ac = cc.getAxisConfiguration();
+        PhasesInfo phasesInfo = ac.getPhasesInfo();
+
+        // setting operation default chains
+        if (ac.getService("__ANONYMOUS_SERVICE__") == null) {
+            // Lets default be OUT_IN
+            OutInAxisOperation outInOperation =
+                    new OutInAxisOperation(new QName(
+                            "__OPERATION_OUT_IN__"));
+            AxisService axisAnonymousService =
+                    new AxisService("__ANONYMOUS_SERVICE__");
+            axisAnonymousService.addOperation(outInOperation);
+            ac.addService(axisAnonymousService);
+            phasesInfo.setOperationPhases(outInOperation);
+        }
+        ServiceGroupContext sgc = new ServiceGroupContext(cc,
+                ac.getService("__ANONYMOUS_SERVICE__").getParent());
+        ServiceContext sc =
+                sgc.getServiceContext(new AxisService("__ANONYMOUS_SERVICE__"));
+
+        MessageContext mc = new MessageContext();
+        mc.setConfigurationContext(sc.getConfigurationContext());
+        ///////////////////////////////////////////////////////////////////////
+        // filtering properties
+        if (smc.getSoapAction() != null)
+            mc.setSoapAction(smc.getSoapAction());
+        if (smc.getWSAAction() != null)
+            mc.setWSAAction(smc.getWSAAction());
+        if (smc.getFrom() != null)
+            mc.setFrom(smc.getFrom());
+        if (smc.getMessageID() != null)
+            mc.setMessageID(smc.getMessageID());
+        else
+            mc.setMessageID(String.valueOf("uuid:"
+                    + UUIDGenerator.getUUID()));
+        if (smc.getReplyTo() != null)
+            mc.setReplyTo(smc.getReplyTo());
+        if (smc.getRelatesTo() != null)
+            mc.setRelatesTo(smc.getRelatesTo());
+        if (smc.getTo() != null) {
+            mc.setTo(smc.getTo());
+        } else {
+            throw new AxisFault(
+                    "To canno't be null, if null Synapse can't infer the transport");
+        }
+        if (smc.isDoingREST()) {
+            mc.setDoingREST(true);
+        }
+        if (smc.getProperty(
+                org.apache.axis2.Constants.Configuration.DISABLE_ADDRESSING_FOR_OUT_MESSAGES) !=
+                null) {
+            mc.setProperty(
+                    org.apache.axis2.Constants.Configuration.DISABLE_ADDRESSING_FOR_OUT_MESSAGES,
+                    Boolean.TRUE);
+        }
+        mc.setEnvelope(outEnvelopeConfiguration(smc));
+        ///////////////////////////////////////////////////////////////////////
+
+
+        AxisOperation axisAnonymousOperation =
+                ac.getService("__ANONYMOUS_SERVICE__")
+                        .getOperation(new QName("__OPERATION_OUT_IN__"));
+
+        //Options class from Axis2 holds client side settings
+        Options options = new Options();
+        OperationClient mepClient =
+                axisAnonymousOperation.createClient(sc, options);
+        mepClient.addMessageContext(mc);
+        mepClient.execute(true);
+        MessageContext response = mepClient
+                .getMessageContext(WSDLConstants.MESSAGE_LABEL_IN_VALUE);
+        response.setProperty(MessageContext.TRANSPORT_OUT,
+                smc.getProperty(MessageContext.TRANSPORT_OUT));
+        response.setProperty(org.apache.axis2.Constants.OUT_TRANSPORT_INFO,
+                smc.getProperty(
+                        org.apache.axis2.Constants.OUT_TRANSPORT_INFO));
+
+        // If request is REST we assume the response is REST, so set the
+        // variable
+        response.setDoingREST(smc.isDoingREST());
+        response.setProperty(Constants.ISRESPONSE_PROPERTY, new Boolean(
+                true));
+        return response;
+    }
+
+
+}

Added: incubator/synapse/trunk/scratch/synase-multimodules/modules/core/src/org/apache/synapse/axis2/Axis2Sender.java
URL: http://svn.apache.org/viewcvs/incubator/synapse/trunk/scratch/synase-multimodules/modules/core/src/org/apache/synapse/axis2/Axis2Sender.java?rev=377953&view=auto
==============================================================================
--- incubator/synapse/trunk/scratch/synase-multimodules/modules/core/src/org/apache/synapse/axis2/Axis2Sender.java (added)
+++ incubator/synapse/trunk/scratch/synase-multimodules/modules/core/src/org/apache/synapse/axis2/Axis2Sender.java Tue Feb 14 23:11:24 2006
@@ -0,0 +1,173 @@
+/*
+ * 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.axis2;
+
+import org.apache.axis2.AxisFault;
+import org.apache.axis2.soap.SOAPEnvelope;
+import org.apache.axis2.soap.SOAP12Constants;
+import org.apache.axis2.soap.SOAPFactory;
+import org.apache.axis2.soap.SOAP11Constants;
+
+import org.apache.axis2.context.MessageContext;
+import org.apache.axis2.context.ConfigurationContext;
+import org.apache.axis2.description.TransportInDescription;
+
+import org.apache.axis2.engine.AxisEngine;
+import org.apache.axis2.om.OMAbstractFactory;
+import org.apache.axis2.om.OMNamespace;
+
+import org.apache.synapse.Constants;
+import org.apache.synapse.SynapseException;
+import org.apache.synapse.SynapseMessage;
+import org.apache.synapse.SynapseEnvironment;
+
+import java.util.Iterator;
+
+
+/**
+ * This class helps the Axis2SynapseEnvironment implement the send method
+ */
+public class Axis2Sender {
+
+    public static void sendOn(SynapseMessage smc, SynapseEnvironment se) {
+
+        try {
+
+            MessageContext messageContext = ((Axis2SynapseMessage) smc)
+                    .getMessageContext();
+            // runtime switch between AddressingOutProcessor.
+            // By default addressing is engaged. At runtime we check
+            // SynapseEnvironemnt, whether Addressing engaged. If not using the following code
+            // ar runtime Synapse will desable Axis2's AddressingOutHandler
+            if (se.getProperty(Constants.ADDRESSING_PROCESSED) == null) {
+                messageContext
+                        .setProperty(
+                                org.apache.axis2.Constants.Configuration.DISABLE_ADDRESSING_FOR_OUT_MESSAGES,
+                                Boolean.TRUE);
+            }
+
+            MessageContext outMsgContext = Axis2FlexibleMEPClient
+                    .send(messageContext);
+
+            // run all rules on response
+
+            // todo: this logic need to be imporved with sendNow() and drop()
+            smc.setResponse(true);
+            ///////////////////////////////////////////////////////////////////
+            // special treat for Module Engagement
+            ConfigurationContext configContext = (ConfigurationContext) smc
+                    .getProperty(
+                            Constants.ADDRESSING_PROCESSED_CONFIGURATION_CONTEXT);
+            if (configContext != null) {
+                outMsgContext.setProperty(
+                        Constants.ADDRESSING_PROCESSED_CONFIGURATION_CONTEXT,
+                        configContext);
+            }
+            //////////////////////////////////////////////////////////////////
+
+            outMsgContext.setServerSide(true);
+
+            // deal with the fact that AddressingOutHandler has a bug if
+            // there is no header at all.        
+            // fixed in axis 0.9652 
+            SOAPEnvelope envelope = outMsgContext.getEnvelope();
+            // temporarty hack
+            SOAPEnvelope newEnvelope;
+            if (envelope.getHeader() == null) {
+                SOAPFactory soapFactory;
+                if (envelope.getNamespace().getName()
+                        .equals(SOAP12Constants.SOAP_ENVELOPE_NAMESPACE_URI)) {
+                    soapFactory = OMAbstractFactory.getSOAP12Factory();
+                    newEnvelope = soapFactory.getDefaultEnvelope();
+                } else {
+                    soapFactory = OMAbstractFactory.getSOAP11Factory();
+                    newEnvelope = soapFactory.getDefaultEnvelope();
+
+                }
+                /**
+                 * Need a big fix here. Axis2 folks should fix this
+                 */
+                //envelope.addChild(soapFactory.createSOAPHeader(envelope));
+                //todo: bug in Axiom when another tree is declared and copy some elements from one tree to other
+                //todo: the second tree doesn't serialize attribute aware namespaces properly
+                //todo: as a temporartory hack this was taken into account
+                Iterator iterator = envelope.getAllDeclaredNamespaces();
+                while (iterator.hasNext()) {
+                    OMNamespace namespace = (OMNamespace) iterator.next();
+                    if (namespace.getName()
+                            .equals(SOAP11Constants.SOAP_ENVELOPE_NAMESPACE_URI) ||
+                            namespace.getName()
+                                    .equals(SOAP12Constants.SOAP_ENVELOPE_NAMESPACE_URI))
+                    {
+                        continue;
+                    }
+                    newEnvelope.declareNamespace(namespace);
+                }
+                newEnvelope.getBody()
+                        .addChild(envelope.getBody().getFirstElement());
+                outMsgContext.setEnvelope(newEnvelope);
+            }
+
+            Object os = messageContext
+                    .getProperty(MessageContext.TRANSPORT_OUT);
+            outMsgContext.setProperty(MessageContext.TRANSPORT_OUT, os);
+            TransportInDescription ti = messageContext.getTransportIn();
+
+            outMsgContext.setTransportIn(ti);
+            se.injectMessage(new Axis2SynapseMessage(outMsgContext));
+
+        } catch (Exception e) {
+            throw new SynapseException(e);
+        }
+    }
+
+    public static void sendBack(SynapseMessage smc) {
+        MessageContext messageContext = ((Axis2SynapseMessage) smc)
+                .getMessageContext();
+        AxisEngine ae =
+                new AxisEngine(messageContext.getConfigurationContext());
+        try {
+            if (messageContext.getEnvelope().getHeader() == null) {
+                messageContext.getEnvelope().getBody().insertSiblingBefore(
+                        OMAbstractFactory.getSOAP11Factory()
+                                .getDefaultEnvelope()
+                                .getHeader());
+
+            }
+            
+
+            messageContext
+                    .setProperty(Constants.ISRESPONSE_PROPERTY, new Boolean(
+                            true));
+            // check for addressing is alredy engaged for this message.
+            // if engage we should use the address enable Configuraion context.
+            ConfigurationContext configContext = (ConfigurationContext) smc
+                    .getProperty(
+                            Constants.ADDRESSING_PROCESSED_CONFIGURATION_CONTEXT);
+            if (configContext != null) {
+                messageContext.setConfigurationContext(configContext);
+            }
+
+            ae.send(messageContext);
+        } catch (AxisFault e) {
+            throw new SynapseException(e);
+
+        }
+
+    }
+
+}

Added: incubator/synapse/trunk/scratch/synase-multimodules/modules/core/src/org/apache/synapse/axis2/Axis2SynapseEnvironment.java
URL: http://svn.apache.org/viewcvs/incubator/synapse/trunk/scratch/synase-multimodules/modules/core/src/org/apache/synapse/axis2/Axis2SynapseEnvironment.java?rev=377953&view=auto
==============================================================================
--- incubator/synapse/trunk/scratch/synase-multimodules/modules/core/src/org/apache/synapse/axis2/Axis2SynapseEnvironment.java (added)
+++ incubator/synapse/trunk/scratch/synase-multimodules/modules/core/src/org/apache/synapse/axis2/Axis2SynapseEnvironment.java Tue Feb 14 23:11:24 2006
@@ -0,0 +1,94 @@
+/*
+ * 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.axis2;
+
+import java.util.HashMap;
+import java.util.Map;
+
+import org.apache.axis2.om.OMElement;
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+
+import org.apache.synapse.Processor;
+import org.apache.synapse.SynapseEnvironment;
+import org.apache.synapse.SynapseMessage;
+
+import org.apache.synapse.xml.ProcessorConfiguratorFinder;
+
+/**
+ *
+ *
+ * 
+ * <p> This is the Axis2 implementation of the SynapseEnvironment 
+ *
+ */
+public class Axis2SynapseEnvironment extends SynapseEnvironment {
+	private Processor mainprocessor = null;
+
+	private ClassLoader cl = null;
+
+	private Map processors = new HashMap();
+
+    private Log log = LogFactory.getLog(getClass());
+
+	public Axis2SynapseEnvironment(OMElement synapseConfiguration,
+			ClassLoader cl) {
+		super(null);
+		this.cl = cl;
+		if (synapseConfiguration!=null)
+			mainprocessor = ProcessorConfiguratorFinder.getProcessor(this, synapseConfiguration);
+	}
+
+	public void injectMessage(SynapseMessage smc) {
+		mainprocessor.process(this, smc);
+	}
+
+	public ClassLoader getClassLoader() {
+		return cl;
+	}
+
+	public void setClassLoader(ClassLoader cl) {
+		this.cl = cl;
+	}
+
+	public void send(SynapseMessage sm, SynapseEnvironment se) {
+		if (sm.isResponse()) 
+			Axis2Sender.sendBack(sm);
+		else 
+			Axis2Sender.sendOn(sm, se);
+	}
+
+	
+	public Processor lookupProcessor(String name) {
+		return (Processor) processors.get(name);
+	}
+
+	public void addProcessor(Processor p) {
+		log.debug("adding processor with name " + p.getName());
+		if (processors.containsKey(p.getName()))
+			log.warn("name " + p.getName() + "already present");
+		processors.put(p.getName(), p);
+	}
+
+	public Processor getMasterProcessor() {
+		return mainprocessor;
+	}
+	
+	public void setMasterProcessor(Processor p) {
+		mainprocessor = p;
+	}
+}

Added: incubator/synapse/trunk/scratch/synase-multimodules/modules/core/src/org/apache/synapse/axis2/Axis2SynapseEnvironmentFinder.java
URL: http://svn.apache.org/viewcvs/incubator/synapse/trunk/scratch/synase-multimodules/modules/core/src/org/apache/synapse/axis2/Axis2SynapseEnvironmentFinder.java?rev=377953&view=auto
==============================================================================
--- incubator/synapse/trunk/scratch/synase-multimodules/modules/core/src/org/apache/synapse/axis2/Axis2SynapseEnvironmentFinder.java (added)
+++ incubator/synapse/trunk/scratch/synase-multimodules/modules/core/src/org/apache/synapse/axis2/Axis2SynapseEnvironmentFinder.java Tue Feb 14 23:11:24 2006
@@ -0,0 +1,84 @@
+/*
+ * 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.axis2;
+
+import java.io.InputStream;
+
+import javax.xml.stream.XMLStreamException;
+
+import org.apache.axis2.AxisFault;
+import org.apache.axis2.context.MessageContext;
+import org.apache.axis2.description.Parameter;
+import org.apache.axis2.description.ParameterImpl;
+import org.apache.axis2.engine.AxisConfiguration;
+import org.apache.axis2.om.OMElement;
+import org.apache.axis2.om.impl.llom.builder.StAXOMBuilder;
+
+import org.apache.synapse.SynapseEnvironment;
+import org.apache.synapse.SynapseException;
+import org.apache.synapse.Constants;
+
+/**
+ * <p/>
+ * The SynapseEnvironment needs to be set up and then is used by the SynapseMessageReceiver to inject messages.
+ * This class is used by the SynapseMessageReceiver to find the environment. The env is stored in a Parameter to the Axis2 config
+ */
+public class Axis2SynapseEnvironmentFinder implements Constants {
+
+    public static synchronized SynapseEnvironment getSynapseEnvironment(
+            MessageContext mc) {
+        AxisConfiguration ac =
+                mc.getConfigurationContext().getAxisConfiguration();
+        Parameter synapseEnvParam = ac.getParameter(SYNAPSE_ENVIRONMENT);
+        if (synapseEnvParam == null) {
+
+            Parameter param = ac.getParameter(SYNAPSECONFIGURATION);
+            if (param == null) {
+                throw new SynapseException("no parameter '"
+                        + SYNAPSECONFIGURATION + "' in axis2.xml");
+            }
+            String synapseConfig = (String) param.getValue();
+            InputStream is = mc.getAxisService().getClassLoader()
+                    .getResourceAsStream(synapseConfig.trim());
+
+            StAXOMBuilder builder;
+            try {
+                builder = new StAXOMBuilder(is);
+
+            } catch (XMLStreamException e1) {
+                throw new SynapseException(
+                        "Trouble parsing Synapse Configuration ", e1);
+
+            }
+            OMElement config = builder.getDocumentElement();
+            config.build();
+            Axis2SynapseEnvironment se = new Axis2SynapseEnvironment(config, mc
+                    .getAxisService().getClassLoader());
+
+            synapseEnvParam = new ParameterImpl(SYNAPSE_ENVIRONMENT, null);
+            synapseEnvParam.setValue(se);
+            try {
+                ac.addParameter(synapseEnvParam);
+            } catch (AxisFault e) {
+                throw new SynapseException(e);
+            }
+        }
+        return (SynapseEnvironment) synapseEnvParam.getValue();
+
+    }
+
+}

Added: incubator/synapse/trunk/scratch/synase-multimodules/modules/core/src/org/apache/synapse/axis2/Axis2SynapseMessage.java
URL: http://svn.apache.org/viewcvs/incubator/synapse/trunk/scratch/synase-multimodules/modules/core/src/org/apache/synapse/axis2/Axis2SynapseMessage.java?rev=377953&view=auto
==============================================================================
--- incubator/synapse/trunk/scratch/synase-multimodules/modules/core/src/org/apache/synapse/axis2/Axis2SynapseMessage.java (added)
+++ incubator/synapse/trunk/scratch/synase-multimodules/modules/core/src/org/apache/synapse/axis2/Axis2SynapseMessage.java Tue Feb 14 23:11:24 2006
@@ -0,0 +1,215 @@
+/*
+ * 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.axis2;
+
+import java.util.HashMap;
+import java.util.Iterator;
+import java.util.Map;
+import org.apache.axis2.AxisFault;
+import org.apache.axis2.addressing.EndpointReference;
+import org.apache.axis2.addressing.RelatesTo;
+import org.apache.axis2.context.MessageContext;
+import org.apache.axis2.soap.SOAPEnvelope;
+import org.apache.synapse.Constants;
+import org.apache.synapse.SynapseMessage;
+
+/**
+ *
+ * 
+ * <p>
+ * A wrapper on Axis2's Message Context that implements the SynapseMessage interface
+ *
+ */
+public class Axis2SynapseMessage implements SynapseMessage {
+
+	private MessageContext mc = null;
+
+	private Map props = new HashMap();
+
+	private boolean response = false;
+
+    private boolean faultResponse = false;
+
+    public Axis2SynapseMessage(MessageContext mc) {
+		setMessageContext(mc);
+	}
+
+	public EndpointReference getFaultTo() {
+		return mc.getFaultTo();
+	}
+
+	public void setFaultTo(EndpointReference reference) {
+		mc.setFaultTo(reference);
+	}
+
+	public EndpointReference getFrom() {
+		return mc.getFrom();
+	}
+
+	public void setFrom(EndpointReference reference) {
+		mc.setFrom(reference);
+
+	}
+
+	public SOAPEnvelope getEnvelope() {
+
+		return mc.getEnvelope();
+	}
+
+	public void setEnvelope(SOAPEnvelope envelope) throws AxisFault {
+		mc.setEnvelope(envelope);
+
+	}
+
+	public String getMessageID() {
+		return mc.getMessageID();
+	}
+
+	public void setMessageID(String string) {
+		mc.setMessageID(string);
+
+	}
+
+	public RelatesTo getRelatesTo() {
+		return mc.getRelatesTo();
+
+	}
+
+	public void setRelatesTo(RelatesTo reference) {
+		mc.setRelatesTo(reference);
+
+	}
+
+	public EndpointReference getReplyTo() {
+		return mc.getReplyTo();
+
+	}
+
+	public void setReplyTo(EndpointReference reference) {
+		mc.setReplyTo(reference);
+
+	}
+
+	public EndpointReference getTo() {
+		return mc.getTo();
+
+	}
+
+	public void setTo(EndpointReference reference) {
+		mc.setTo(reference);
+
+	}
+
+	public void setWSAAction(String actionURI) {
+		mc.setWSAAction(actionURI);
+
+	}
+
+	public String getWSAAction() {
+
+		return mc.getWSAAction();
+	}
+
+	public void setMessageId(String messageID) {
+		mc.setWSAMessageId(messageID);
+
+	}
+
+	public String getMessageId() {
+		return mc.getMessageID();
+	}
+
+	public Object getProperty(String key) {
+        Object obj = props.get(key);
+        if ( obj == null) {
+            obj = mc.getProperty(key);
+        }        
+        return obj;
+
+	}
+
+	public void setProperty(String key, Object value) {
+		props.put(key, value);
+	}
+
+	public Iterator getPropertyNames() {
+		return props.keySet().iterator();
+	}
+
+	public String getSoapAction() {
+		return mc.getSoapAction();
+	}
+
+	public void setSoapAction(String string) {
+		mc.setSoapAction(string);
+
+	}
+
+	public boolean isDoingMTOM() {
+
+		return mc.isDoingMTOM();
+	}
+
+	public void setDoingMTOM(boolean b) {
+		mc.setDoingMTOM(b);
+
+	}
+
+	public boolean isDoingREST() {
+
+		return mc.isDoingREST();
+	}
+
+	public void setDoingREST(boolean b) {
+		mc.setDoingREST(b);
+
+	}
+
+	public boolean isSOAP11() {
+
+		return mc.isSOAP11();
+	}
+
+	public MessageContext getMessageContext() {
+		return mc;
+	}
+
+	public void setMessageContext(MessageContext mc) {
+		this.mc = mc;
+		Boolean resp = (Boolean) mc.getProperty(Constants.ISRESPONSE_PROPERTY);
+		if (resp != null)
+			response = resp.booleanValue();
+	}
+
+	public void setResponse(boolean b) {
+		response = b;
+		mc.setProperty(Constants.ISRESPONSE_PROPERTY, Boolean.valueOf(b));
+	}
+
+	public boolean isResponse() {
+		return response;
+	}
+
+    public void setFaultResponse(boolean b) {
+        this.faultResponse = b;
+    }
+
+    public boolean isFaultResponse() {
+        return this.faultResponse;  
+    }
+
+}

Added: incubator/synapse/trunk/scratch/synase-multimodules/modules/core/src/org/apache/synapse/axis2/DynamicAxisOperation.java
URL: http://svn.apache.org/viewcvs/incubator/synapse/trunk/scratch/synase-multimodules/modules/core/src/org/apache/synapse/axis2/DynamicAxisOperation.java?rev=377953&view=auto
==============================================================================
--- incubator/synapse/trunk/scratch/synase-multimodules/modules/core/src/org/apache/synapse/axis2/DynamicAxisOperation.java (added)
+++ incubator/synapse/trunk/scratch/synase-multimodules/modules/core/src/org/apache/synapse/axis2/DynamicAxisOperation.java Tue Feb 14 23:11:24 2006
@@ -0,0 +1,168 @@
+/*
+ * 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.axis2;
+
+import org.apache.axis2.description.*;
+import org.apache.axis2.context.MessageContext;
+import org.apache.axis2.context.OperationContext;
+import org.apache.axis2.context.ServiceContext;
+import org.apache.axis2.context.ConfigurationContext;
+import org.apache.axis2.AxisFault;
+import org.apache.axis2.engine.AxisEngine;
+import org.apache.axis2.addressing.EndpointReference;
+import org.apache.axis2.client.OperationClient;
+import org.apache.axis2.client.Options;
+import org.apache.axis2.client.async.Callback;
+import org.apache.synapse.SynapseException;
+import org.apache.wsdl.WSDLConstants;
+
+import javax.xml.namespace.QName;
+import java.util.HashMap;
+
+/**
+ * DynamicAxisOperation which switch dyamcially between MEPs
+ */
+public class DynamicAxisOperation extends InOutAxisOperation {
+    public DynamicAxisOperation() {
+        super();
+    }
+
+    public DynamicAxisOperation(QName name) {
+        super(name);
+    }
+
+    public void addMessageContext(MessageContext msgContext,
+                                  OperationContext opContext) throws AxisFault {
+        HashMap mep = opContext.getMessageContexts();
+        MessageContext immsgContext = (MessageContext) mep
+                .get(MESSAGE_LABEL_IN_VALUE);
+        MessageContext outmsgContext = (MessageContext) mep
+                .get(MESSAGE_LABEL_OUT_VALUE);
+
+        if ((immsgContext != null) && (outmsgContext != null)) {
+            throw new AxisFault(
+                    "Invalid message addition , operation context completed");
+        }
+
+        if (outmsgContext == null) {
+            mep.put(MESSAGE_LABEL_OUT_VALUE, msgContext);
+        } else {
+            mep.put(MESSAGE_LABEL_IN_VALUE, msgContext);
+            opContext.setComplete(true);
+        }
+    }
+
+
+    public OperationClient createClient(ServiceContext sc, Options options) {
+        return new DynamicOperationClient(this,sc,options);
+    }
+
+}
+
+class DynamicOperationClient implements OperationClient {
+    private DynamicAxisOperation axisOp;
+    private ServiceContext sc;
+    private OperationContext oc;
+    private Options options;
+
+    public DynamicOperationClient(DynamicAxisOperation axisOp, ServiceContext sc, Options options){
+        this.options = options;
+        this.axisOp = axisOp;
+        this.sc = sc;
+        this.oc = new OperationContext(axisOp,sc);
+        this.oc.setParent(this.sc);
+    }
+
+    public void setOptions(Options options) {
+        // Not supported
+    }
+
+    public Options getOptions() {
+        throw new SynapseException("Not Supported");
+    }
+
+    public void addMessageContext(MessageContext mc) throws AxisFault {
+        mc.setServiceContext(sc);
+        axisOp.registerOperationContext(mc, oc);
+    }
+
+    public MessageContext getMessageContext(String messageLabel) throws AxisFault {
+        return oc.getMessageContext(messageLabel);
+    }
+
+    public void setCallback(Callback callback) {
+        // Not supported
+    }
+
+    public void execute(boolean block) throws AxisFault {
+        if (block) {
+            ConfigurationContext cc = sc.getConfigurationContext();
+
+            // copy interesting info from options to message context.
+            MessageContext mc = oc
+                    .getMessageContext(WSDLConstants.MESSAGE_LABEL_OUT_VALUE);
+            if (mc == null) {
+                throw new AxisFault(
+                        "Out message context is null ,"
+                                + " please set the out message context before calling this method");
+            }
+
+            EndpointReference toEPR = mc.getTo();
+
+            TransportOutDescription transportOut = ClientUtils.inferOutTransport(cc
+                    .getAxisConfiguration(), toEPR);
+            mc.setTransportOut(transportOut);
+
+            /*
+            Options need to Infer TransportInDescription
+            */
+            if (mc.getTransportIn() == null) {
+                TransportInDescription transportIn = options.getTransportIn();
+                if (transportIn == null) {
+                    mc.setTransportIn(ClientUtils.inferInTransport(cc
+                            .getAxisConfiguration(), options, mc
+                            .getServiceContext()));
+                } else {
+                    mc.setTransportIn(transportIn);
+                }
+            }
+
+            if (mc.getSoapAction() == null || "".equals(mc.getSoapAction())) {
+                Parameter soapaction = axisOp.getParameter(AxisOperation.SOAP_ACTION);
+                if (soapaction != null) {
+                    mc.setSoapAction((String) soapaction.getValue());
+                }
+            }
+
+            oc.addMessageContext(mc);
+            // ship it out
+            AxisEngine engine = new AxisEngine(cc);
+            engine.send(mc);
+        }
+
+    }
+
+    public void reset() throws AxisFault {
+        // Not supported
+    }
+
+    public void complete(MessageContext msgCtxt) throws AxisFault {
+        // Not supported
+    }
+
+
+}

Added: incubator/synapse/trunk/scratch/synase-multimodules/modules/core/src/org/apache/synapse/axis2/EmptyMessageReceiver.java
URL: http://svn.apache.org/viewcvs/incubator/synapse/trunk/scratch/synase-multimodules/modules/core/src/org/apache/synapse/axis2/EmptyMessageReceiver.java?rev=377953&view=auto
==============================================================================
--- incubator/synapse/trunk/scratch/synase-multimodules/modules/core/src/org/apache/synapse/axis2/EmptyMessageReceiver.java (added)
+++ incubator/synapse/trunk/scratch/synase-multimodules/modules/core/src/org/apache/synapse/axis2/EmptyMessageReceiver.java Tue Feb 14 23:11:24 2006
@@ -0,0 +1,37 @@
+/*
+ * 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.axis2;
+
+import org.apache.axis2.AxisFault;
+import org.apache.axis2.context.MessageContext;
+
+import org.apache.axis2.engine.MessageReceiver;
+import org.apache.synapse.Constants;
+
+/**
+ *
+ * <p>Does nothing! Used as an endpoint so we can engage modules
+ *
+ */
+public class EmptyMessageReceiver implements MessageReceiver {
+
+	public void receive(MessageContext mc) throws AxisFault {
+		mc.setProperty(Constants.MEDIATOR_RESPONSE_PROPERTY, Boolean
+				.valueOf(true));
+	}
+
+}

Added: incubator/synapse/trunk/scratch/synase-multimodules/modules/core/src/org/apache/synapse/axis2/ServiceMediatorMessageReceiver.java
URL: http://svn.apache.org/viewcvs/incubator/synapse/trunk/scratch/synase-multimodules/modules/core/src/org/apache/synapse/axis2/ServiceMediatorMessageReceiver.java?rev=377953&view=auto
==============================================================================
--- incubator/synapse/trunk/scratch/synase-multimodules/modules/core/src/org/apache/synapse/axis2/ServiceMediatorMessageReceiver.java (added)
+++ incubator/synapse/trunk/scratch/synase-multimodules/modules/core/src/org/apache/synapse/axis2/ServiceMediatorMessageReceiver.java Tue Feb 14 23:11:24 2006
@@ -0,0 +1,30 @@
+package org.apache.synapse.axis2;
+
+import org.apache.axis2.AxisFault;
+import org.apache.axis2.context.MessageContext;
+import org.apache.axis2.receivers.AbstractMessageReceiver;
+import org.apache.synapse.Constants;
+import org.apache.synapse.SynapseEnvironment;
+import org.apache.synapse.SynapseMessage;
+import org.apache.synapse.api.EnvironmentAware;
+import org.apache.synapse.api.Mediator;
+
+public class ServiceMediatorMessageReceiver extends AbstractMessageReceiver {
+    public void receive(MessageContext messageContext) throws AxisFault {
+        Object obj = makeNewServiceObject(messageContext);
+
+        Mediator mediator = (Mediator) obj;
+
+        if (EnvironmentAware.class.isAssignableFrom(mediator.getClass())) {
+            SynapseEnvironment se = (SynapseEnvironment) messageContext
+                    .getProperty(Constants.MEDIATOR_SYNAPSE_ENV_PROPERTY);
+            ((EnvironmentAware) mediator).setSynapseEnvironment(se);
+            ((EnvironmentAware) mediator).setClassLoader(
+                    messageContext.getAxisService().getClassLoader());
+        }
+        SynapseMessage smc = new Axis2SynapseMessage(messageContext);
+        boolean returnValue = mediator.mediate(smc);
+        messageContext.setProperty(Constants.MEDIATOR_RESPONSE_PROPERTY,
+                new Boolean(returnValue));
+    }
+}

Added: incubator/synapse/trunk/scratch/synase-multimodules/modules/core/src/org/apache/synapse/axis2/SynapseDispatcher.java
URL: http://svn.apache.org/viewcvs/incubator/synapse/trunk/scratch/synase-multimodules/modules/core/src/org/apache/synapse/axis2/SynapseDispatcher.java?rev=377953&view=auto
==============================================================================
--- incubator/synapse/trunk/scratch/synase-multimodules/modules/core/src/org/apache/synapse/axis2/SynapseDispatcher.java (added)
+++ incubator/synapse/trunk/scratch/synase-multimodules/modules/core/src/org/apache/synapse/axis2/SynapseDispatcher.java Tue Feb 14 23:11:24 2006
@@ -0,0 +1,63 @@
+/*
+ * 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.axis2;
+
+import javax.xml.namespace.QName;
+
+import org.apache.axis2.AxisFault;
+import org.apache.axis2.context.MessageContext;
+import org.apache.axis2.description.AxisOperation;
+import org.apache.axis2.description.AxisService;
+import org.apache.axis2.description.HandlerDescription;
+import org.apache.axis2.engine.AbstractDispatcher;
+import org.apache.axis2.engine.AxisConfiguration;
+
+/**
+ *
+ * 
+ * This sends every message to the SynapseMessageReceiver so that it can pass them to Synapse
+ *
+ */
+public class SynapseDispatcher extends AbstractDispatcher {
+	// FOR EVERY REQUEST - ALWAYS DISPATH TO THE SYNAPSE SERVICE
+
+	private static final long serialVersionUID = -6970206989111592645L;
+
+	private static final String SYNAPSE_SERVICE_NAME = "synapse";
+
+	private static final QName MEDIATE_OPERATION_NAME = new QName("mediate");
+
+	public void initDispatcher() {
+		QName qn = new QName("http://synapse.apache.org", "SynapseDispatcher");
+		HandlerDescription hd = new HandlerDescription(qn);
+		super.init(hd);
+
+	}
+
+	public AxisService findService(MessageContext mc) throws AxisFault {
+		AxisConfiguration ac = mc.getConfigurationContext().getAxisConfiguration();
+		AxisService as = ac.getService(SYNAPSE_SERVICE_NAME);
+		return as;
+	}
+
+	public AxisOperation findOperation(AxisService svc, MessageContext mc)
+			throws AxisFault {
+
+		AxisOperation ao = svc.getOperation(MEDIATE_OPERATION_NAME);
+		return ao;
+	}
+
+}

Added: incubator/synapse/trunk/scratch/synase-multimodules/modules/core/src/org/apache/synapse/axis2/SynapseMessageReceiver.java
URL: http://svn.apache.org/viewcvs/incubator/synapse/trunk/scratch/synase-multimodules/modules/core/src/org/apache/synapse/axis2/SynapseMessageReceiver.java?rev=377953&view=auto
==============================================================================
--- incubator/synapse/trunk/scratch/synase-multimodules/modules/core/src/org/apache/synapse/axis2/SynapseMessageReceiver.java (added)
+++ incubator/synapse/trunk/scratch/synase-multimodules/modules/core/src/org/apache/synapse/axis2/SynapseMessageReceiver.java Tue Feb 14 23:11:24 2006
@@ -0,0 +1,69 @@
+/*
+ * 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.axis2;
+
+import org.apache.axis2.AxisFault;
+import org.apache.axis2.Constants;
+import org.apache.axis2.context.MessageContext;
+
+import org.apache.axis2.engine.MessageReceiver;
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+
+import org.apache.synapse.SynapseEnvironment;
+import org.apache.synapse.SynapseMessage;
+
+/**
+ * <p/>
+ * <p/>
+ * This is used to "catch" messages in Axis2 and pass them to Synapse for processing.
+ */
+public class SynapseMessageReceiver implements MessageReceiver {
+
+    private Log log = LogFactory.getLog(getClass());
+
+    public void receive(MessageContext mc) throws AxisFault {
+        log.debug("receiving message");
+        SynapseEnvironment env = Axis2SynapseEnvironmentFinder
+                .getSynapseEnvironment(mc);
+        ////////////////////////////////////////////////////////////////////////
+        // SynapseEnvironment is set as a property in MessageContext. This is due
+        // use we can expect in ServiceMeidatorProcessor and many extensions yet to come
+        // So it a mediator uses EnvironmentAware, that mediator will be injected with the correct environment
+        mc.setProperty(
+                org.apache.synapse.Constants.MEDIATOR_SYNAPSE_ENV_PROPERTY,
+                env);
+        ////////////////////////////////////////////////////////////////////////
+        SynapseMessage smc = new Axis2SynapseMessage(mc);
+        env.injectMessage(smc);
+
+        ///////////////////////////////////////////////////////////////////////
+        // Response handling mechanism for 200/202 and 5XX
+        // smc.isResponse =true then the response will be handle with 200 OK
+        // else, response will be 202 OK without no http body
+        // smc.isFaultRespose = true then the response is a fault with 500 Internal Server Error
+        if (smc.isResponse()) {
+            mc.getOperationContext().setProperty(Constants.RESPONSE_WRITTEN,
+                    Constants.VALUE_TRUE);
+        }
+        if (smc.isFaultResponse()) {
+            // todo: a good way to inject faultSoapEnv to the Axis2 Transport 
+            throw new AxisFault(
+                    "Synapse Encounters an Error - Please See Log for More Details");
+        }
+        ///////////////////////////////////////////////////////////////////////
+    }
+}

Added: incubator/synapse/trunk/scratch/synase-multimodules/modules/core/src/org/apache/synapse/processors/AbstractProcessor.java
URL: http://svn.apache.org/viewcvs/incubator/synapse/trunk/scratch/synase-multimodules/modules/core/src/org/apache/synapse/processors/AbstractProcessor.java?rev=377953&view=auto
==============================================================================
--- incubator/synapse/trunk/scratch/synase-multimodules/modules/core/src/org/apache/synapse/processors/AbstractProcessor.java (added)
+++ incubator/synapse/trunk/scratch/synase-multimodules/modules/core/src/org/apache/synapse/processors/AbstractProcessor.java Tue Feb 14 23:11:24 2006
@@ -0,0 +1,37 @@
+/*
+ * 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.processors;
+
+import org.apache.synapse.Processor;
+
+/**
+ *
+ * <p> 
+ * Abstract Processor... simply has a name
+ * 
+ *
+ */
+public abstract class AbstractProcessor implements Processor {
+	private String name = null;
+
+	public String getName() {
+		return name;
+	}
+	public void setName(String name) {
+		this.name = name;
+	}
+}

Added: incubator/synapse/trunk/scratch/synase-multimodules/modules/core/src/org/apache/synapse/processors/DefineProcessor.java
URL: http://svn.apache.org/viewcvs/incubator/synapse/trunk/scratch/synase-multimodules/modules/core/src/org/apache/synapse/processors/DefineProcessor.java?rev=377953&view=auto
==============================================================================
--- incubator/synapse/trunk/scratch/synase-multimodules/modules/core/src/org/apache/synapse/processors/DefineProcessor.java (added)
+++ incubator/synapse/trunk/scratch/synase-multimodules/modules/core/src/org/apache/synapse/processors/DefineProcessor.java Tue Feb 14 23:11:24 2006
@@ -0,0 +1,44 @@
+/*
+ * 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.processors;
+
+import org.apache.synapse.SynapseEnvironment;
+import org.apache.synapse.SynapseMessage;
+
+/**
+ *
+ */
+public class DefineProcessor extends ListProcessor {
+
+    public boolean process(SynapseEnvironment se, SynapseMessage sm) {
+        return true;
+    }
+
+    /*
+    Thre Processor.process() is common to every one. Define Processor is a unique
+    mediator that is not run in-line. It should always reference by some entity. This
+    Entity is "<refdefine/>. <refdefine/> has the @ref which will reference to the
+    <define/>.
+
+    The Following method processRef(SynapseEnvironment se, SynapseMessage sm); will
+    allow to refernce the <define/> process and, will not allow the <define/> to be a inline
+    process either.
+    */
+
+    public boolean processRef(SynapseEnvironment se, SynapseMessage sm) {
+        return super.process(se,sm);
+    }
+}

Added: incubator/synapse/trunk/scratch/synase-multimodules/modules/core/src/org/apache/synapse/processors/InProcessor.java
URL: http://svn.apache.org/viewcvs/incubator/synapse/trunk/scratch/synase-multimodules/modules/core/src/org/apache/synapse/processors/InProcessor.java?rev=377953&view=auto
==============================================================================
--- incubator/synapse/trunk/scratch/synase-multimodules/modules/core/src/org/apache/synapse/processors/InProcessor.java (added)
+++ incubator/synapse/trunk/scratch/synase-multimodules/modules/core/src/org/apache/synapse/processors/InProcessor.java Tue Feb 14 23:11:24 2006
@@ -0,0 +1,38 @@
+/*
+ * 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.processors;
+
+
+import org.apache.synapse.SynapseEnvironment;
+import org.apache.synapse.SynapseMessage;
+
+/**
+ *
+ * 
+ * Only processes if this is not a response
+ *
+ */
+public class InProcessor extends ListProcessor{
+
+	public boolean process(SynapseEnvironment se, SynapseMessage sm) {
+		if (!sm.isResponse()) return super.process(se,sm);
+		return true;
+		
+	}
+	
+
+}

Added: incubator/synapse/trunk/scratch/synase-multimodules/modules/core/src/org/apache/synapse/processors/ListProcessor.java
URL: http://svn.apache.org/viewcvs/incubator/synapse/trunk/scratch/synase-multimodules/modules/core/src/org/apache/synapse/processors/ListProcessor.java?rev=377953&view=auto
==============================================================================
--- incubator/synapse/trunk/scratch/synase-multimodules/modules/core/src/org/apache/synapse/processors/ListProcessor.java (added)
+++ incubator/synapse/trunk/scratch/synase-multimodules/modules/core/src/org/apache/synapse/processors/ListProcessor.java Tue Feb 14 23:11:24 2006
@@ -0,0 +1,72 @@
+/*
+ * 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.processors;
+
+import java.util.Iterator;
+
+import java.util.List;
+
+
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+import org.apache.synapse.Processor;
+import org.apache.synapse.SynapseEnvironment;
+import org.apache.synapse.SynapseMessage;
+
+
+/**
+ *
+ *         stages, mediations that it has as subelements It is a way of grouping
+ *         stuff.
+ * 
+ */
+public abstract class ListProcessor extends AbstractProcessor {
+	
+	private Log log = LogFactory.getLog(getClass());
+
+	List processors = null;
+	
+	public boolean process(SynapseEnvironment se, SynapseMessage smc) {
+		log.debug("process");
+		if (processors == null) {
+			log.info("process called on empty processor list");
+			return true;
+		}
+		Iterator it = processors.iterator();
+		while (it.hasNext()) {
+			Processor p = (Processor) it.next();
+			log.debug(p.getName() + " = "+ p.getClass());
+			if (!p.process(se,smc))
+				return false;
+		}
+		return true;
+	}
+
+	public void setList(List p) {
+		log.debug("setting list");
+		Iterator it = p.iterator();
+		while (it.hasNext()) {
+			Processor x = (Processor)it.next();
+			log.debug(x.getName() +" = "+ x.getClass());
+		}
+		processors = p;
+	}
+	public List getList() {
+		return processors;
+	}
+
+}

Added: incubator/synapse/trunk/scratch/synase-multimodules/modules/core/src/org/apache/synapse/processors/NeverProcessor.java
URL: http://svn.apache.org/viewcvs/incubator/synapse/trunk/scratch/synase-multimodules/modules/core/src/org/apache/synapse/processors/NeverProcessor.java?rev=377953&view=auto
==============================================================================
--- incubator/synapse/trunk/scratch/synase-multimodules/modules/core/src/org/apache/synapse/processors/NeverProcessor.java (added)
+++ incubator/synapse/trunk/scratch/synase-multimodules/modules/core/src/org/apache/synapse/processors/NeverProcessor.java Tue Feb 14 23:11:24 2006
@@ -0,0 +1,35 @@
+/*
+ * 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.processors;
+
+
+import org.apache.synapse.SynapseEnvironment;
+import org.apache.synapse.SynapseMessage;
+
+/**
+ *
+ * This never executes its children. Used as a holder (for references)
+ *
+ */
+public class NeverProcessor extends ListProcessor{
+
+	public boolean process(SynapseEnvironment se, SynapseMessage sm) {
+		return true;
+	}
+	
+
+}

Added: incubator/synapse/trunk/scratch/synase-multimodules/modules/core/src/org/apache/synapse/processors/OutProcessor.java
URL: http://svn.apache.org/viewcvs/incubator/synapse/trunk/scratch/synase-multimodules/modules/core/src/org/apache/synapse/processors/OutProcessor.java?rev=377953&view=auto
==============================================================================
--- incubator/synapse/trunk/scratch/synase-multimodules/modules/core/src/org/apache/synapse/processors/OutProcessor.java (added)
+++ incubator/synapse/trunk/scratch/synase-multimodules/modules/core/src/org/apache/synapse/processors/OutProcessor.java Tue Feb 14 23:11:24 2006
@@ -0,0 +1,39 @@
+/*
+ * 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.processors;
+
+
+import org.apache.synapse.SynapseEnvironment;
+import org.apache.synapse.SynapseMessage;
+
+/**
+ *
+ * 
+ * <p>
+ * This only executes on response messages
+ *
+ */
+public class OutProcessor extends ListProcessor{
+
+	public boolean process(SynapseEnvironment se, SynapseMessage sm) {
+		if (sm.isResponse()) return super.process(se,sm);
+		return true;
+		
+	}
+	
+
+}

Added: incubator/synapse/trunk/scratch/synase-multimodules/modules/core/src/org/apache/synapse/processors/RefDefineProcessor.java
URL: http://svn.apache.org/viewcvs/incubator/synapse/trunk/scratch/synase-multimodules/modules/core/src/org/apache/synapse/processors/RefDefineProcessor.java?rev=377953&view=auto
==============================================================================
--- incubator/synapse/trunk/scratch/synase-multimodules/modules/core/src/org/apache/synapse/processors/RefDefineProcessor.java (added)
+++ incubator/synapse/trunk/scratch/synase-multimodules/modules/core/src/org/apache/synapse/processors/RefDefineProcessor.java Tue Feb 14 23:11:24 2006
@@ -0,0 +1,51 @@
+/*
+ * 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.processors;
+
+import org.apache.synapse.SynapseEnvironment;
+import org.apache.synapse.SynapseMessage;
+import org.apache.synapse.Processor;
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+
+/**
+ * Processor that reference to <refdefine/>
+ */
+public class RefDefineProcessor extends AbstractProcessor{
+    private Log log = LogFactory.getLog(getClass());
+	private String refDefine = null;
+
+    public boolean process(SynapseEnvironment se, SynapseMessage sm) {
+        log.debug("RefDfineProcessor-Process");
+        Processor p = se.lookupProcessor(getRefDefine());
+		if (p==null) log.debug("processor with name "+this.getRefDefine()+" not found");
+		else if (p instanceof DefineProcessor) {
+            DefineProcessor defp = (DefineProcessor)p;
+            return defp.processRef(se,sm);
+        }
+		return true;
+    }
+
+    public void setRefDefine(String refDefine) {
+        this.refDefine = refDefine;
+    }
+
+    public String getRefDefine() {
+        return this.refDefine;
+    }
+
+}



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