synapse-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From p..@apache.org
Subject svn commit: r320784 - in /incubator/synapse/trunk/scratch/paul: ./ org/ org/apache/ org/apache/synapse/ org/apache/synapse/receivers/
Date Thu, 13 Oct 2005 15:45:24 GMT
Author: pzf
Date: Thu Oct 13 08:44:45 2005
New Revision: 320784

URL: http://svn.apache.org/viewcvs?rev=320784&view=rev
Log: (empty)

Added:
    incubator/synapse/trunk/scratch/paul/
    incubator/synapse/trunk/scratch/paul/TestFramework.java
    incubator/synapse/trunk/scratch/paul/org/
    incubator/synapse/trunk/scratch/paul/org/apache/
    incubator/synapse/trunk/scratch/paul/org/apache/synapse/
    incubator/synapse/trunk/scratch/paul/org/apache/synapse/FakeMediatorFinder$FakeMediator.class   (with props)
    incubator/synapse/trunk/scratch/paul/org/apache/synapse/FakeMediatorFinder.class   (with props)
    incubator/synapse/trunk/scratch/paul/org/apache/synapse/FakeMediatorFinder.java
    incubator/synapse/trunk/scratch/paul/org/apache/synapse/Mediator.class   (with props)
    incubator/synapse/trunk/scratch/paul/org/apache/synapse/Mediator.java
    incubator/synapse/trunk/scratch/paul/org/apache/synapse/MediatorFinder.class   (with props)
    incubator/synapse/trunk/scratch/paul/org/apache/synapse/MediatorFinder.java
    incubator/synapse/trunk/scratch/paul/org/apache/synapse/Rule.class   (with props)
    incubator/synapse/trunk/scratch/paul/org/apache/synapse/Rule.java
    incubator/synapse/trunk/scratch/paul/org/apache/synapse/RuleList.class   (with props)
    incubator/synapse/trunk/scratch/paul/org/apache/synapse/RuleList.java
    incubator/synapse/trunk/scratch/paul/org/apache/synapse/SimpleDispatcher.class   (with props)
    incubator/synapse/trunk/scratch/paul/org/apache/synapse/SimpleDispatcher.java
    incubator/synapse/trunk/scratch/paul/org/apache/synapse/receivers/
    incubator/synapse/trunk/scratch/paul/org/apache/synapse/receivers/Receiver.class   (with props)
    incubator/synapse/trunk/scratch/paul/org/apache/synapse/receivers/Receiver.java
    incubator/synapse/trunk/scratch/paul/org/apache/synapse/receivers/SpringAbstractInMessageReceiver.class   (with props)
    incubator/synapse/trunk/scratch/paul/org/apache/synapse/receivers/SpringAbstractInMessageReceiver.java
    incubator/synapse/trunk/scratch/paul/org/apache/synapse/receivers/SpringAbstractInOutSyncMessageReceiver.class   (with props)
    incubator/synapse/trunk/scratch/paul/org/apache/synapse/receivers/SpringAbstractInOutSyncMessageReceiver.java
    incubator/synapse/trunk/scratch/paul/org/apache/synapse/receivers/SpringAbstractMessageReceiver.class   (with props)
    incubator/synapse/trunk/scratch/paul/org/apache/synapse/receivers/SpringAbstractMessageReceiver.java
    incubator/synapse/trunk/scratch/paul/org/apache/synapse/receivers/SpringInOnlyMessageReceiver.class   (with props)
    incubator/synapse/trunk/scratch/paul/org/apache/synapse/receivers/SpringInOnlyMessageReceiver.java
    incubator/synapse/trunk/scratch/paul/org/apache/synapse/receivers/SpringInOutMessageReceiver.class   (with props)
    incubator/synapse/trunk/scratch/paul/org/apache/synapse/receivers/SpringInOutMessageReceiver.java
    incubator/synapse/trunk/scratch/paul/org/apache/synapse/receivers/test.jpage
    incubator/synapse/trunk/scratch/paul/rulelist.xml

Added: incubator/synapse/trunk/scratch/paul/TestFramework.java
URL: http://svn.apache.org/viewcvs/incubator/synapse/trunk/scratch/paul/TestFramework.java?rev=320784&view=auto
==============================================================================
--- incubator/synapse/trunk/scratch/paul/TestFramework.java (added)
+++ incubator/synapse/trunk/scratch/paul/TestFramework.java Thu Oct 13 08:44:45 2005
@@ -0,0 +1,63 @@
+
+
+import java.io.ByteArrayInputStream;
+import java.io.FileInputStream;
+import java.io.FileNotFoundException;
+
+import javax.xml.stream.XMLInputFactory;
+import javax.xml.stream.XMLStreamException;
+import javax.xml.stream.XMLStreamReader;
+
+import org.apache.axis2.om.OMElement;
+import org.apache.axis2.om.impl.llom.builder.StAXOMBuilder;
+import org.apache.synapse.FakeMediatorFinder;
+import org.apache.synapse.RuleList;
+import org.apache.synapse.SimpleDispatcher;
+import org.jaxen.JaxenException;
+
+public class TestFramework {
+
+	/**
+	 * @param args
+	 */
+	public static void main(String[] args) {
+		FakeMediatorFinder fmf = new FakeMediatorFinder();
+		RuleList  rl = null;
+		try {
+			FileInputStream fis = new FileInputStream(args[0]);
+			rl = new RuleList(fis);
+			System.out.println(rl.toString());
+			
+		} catch (FileNotFoundException e) {
+			
+			e.printStackTrace();
+		}
+		String  xml = "<?xml version=\"1.0\" encoding=\"UTF-8\"?><soap:Envelope xmlns:mrns0=\"urn:xmethods-delayed-quotes\" xmlns:soap=\"http://schemas.xmlsoap.org/soap/envelope/\" xmlns:soapenc=\"http://schemas.xmlsoap.org/soap/encoding/\" xmlns:xs=\"http://www.w3.org/2001/XMLSchema\" xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\">   <soap:Body soap:encodingStyle=\"http://schemas.xmlsoap.org/soap/encoding/\">      <mrns0:getQuote>         <symbol xsi:type=\"xs:string\">IBM</symbol>      </mrns0:getQuote>   </soap:Body></soap:Envelope>";
+		
+		byte arr[] = xml.getBytes();
+		ByteArrayInputStream bais = new ByteArrayInputStream(arr);
+
+		XMLStreamReader reader = null;
+		try {
+			XMLInputFactory xif= XMLInputFactory.newInstance();
+			reader= xif.createXMLStreamReader(bais);
+		} catch (XMLStreamException e) {
+			e.printStackTrace();
+		}
+		StAXOMBuilder builder= new StAXOMBuilder(reader);
+		OMElement testEl = builder.getDocumentElement();
+		
+		SimpleDispatcher sd = new SimpleDispatcher(rl, fmf);
+		try {
+			sd.execute(testEl);
+		} catch (JaxenException e) {
+			// TODO Auto-generated catch block
+			e.printStackTrace();
+		}
+		
+		
+		
+		
+	}
+
+}

Added: incubator/synapse/trunk/scratch/paul/org/apache/synapse/FakeMediatorFinder$FakeMediator.class
URL: http://svn.apache.org/viewcvs/incubator/synapse/trunk/scratch/paul/org/apache/synapse/FakeMediatorFinder%24FakeMediator.class?rev=320784&view=auto
==============================================================================
Binary file - no diff available.

Propchange: incubator/synapse/trunk/scratch/paul/org/apache/synapse/FakeMediatorFinder$FakeMediator.class
------------------------------------------------------------------------------
    svn:mime-type = application/octet-stream

Added: incubator/synapse/trunk/scratch/paul/org/apache/synapse/FakeMediatorFinder.class
URL: http://svn.apache.org/viewcvs/incubator/synapse/trunk/scratch/paul/org/apache/synapse/FakeMediatorFinder.class?rev=320784&view=auto
==============================================================================
Binary file - no diff available.

Propchange: incubator/synapse/trunk/scratch/paul/org/apache/synapse/FakeMediatorFinder.class
------------------------------------------------------------------------------
    svn:mime-type = application/octet-stream

Added: incubator/synapse/trunk/scratch/paul/org/apache/synapse/FakeMediatorFinder.java
URL: http://svn.apache.org/viewcvs/incubator/synapse/trunk/scratch/paul/org/apache/synapse/FakeMediatorFinder.java?rev=320784&view=auto
==============================================================================
--- incubator/synapse/trunk/scratch/paul/org/apache/synapse/FakeMediatorFinder.java (added)
+++ incubator/synapse/trunk/scratch/paul/org/apache/synapse/FakeMediatorFinder.java Thu Oct 13 08:44:45 2005
@@ -0,0 +1,23 @@
+package org.apache.synapse;
+
+import org.apache.axis2.om.OMElement;
+
+public class FakeMediatorFinder implements MediatorFinder {
+	
+	
+	private  class FakeMediator implements Mediator {
+		private String name;
+		public FakeMediator(String name) {
+			this.name = name;
+		}
+		public boolean mediate(OMElement el) {
+			System.out.println(name+ "is Mediating");
+			return true;
+		}
+	}
+
+	public Mediator getMediator(String name) {
+		
+		return new FakeMediator(name);
+	} 
+}

Added: incubator/synapse/trunk/scratch/paul/org/apache/synapse/Mediator.class
URL: http://svn.apache.org/viewcvs/incubator/synapse/trunk/scratch/paul/org/apache/synapse/Mediator.class?rev=320784&view=auto
==============================================================================
Binary file - no diff available.

Propchange: incubator/synapse/trunk/scratch/paul/org/apache/synapse/Mediator.class
------------------------------------------------------------------------------
    svn:mime-type = application/octet-stream

Added: incubator/synapse/trunk/scratch/paul/org/apache/synapse/Mediator.java
URL: http://svn.apache.org/viewcvs/incubator/synapse/trunk/scratch/paul/org/apache/synapse/Mediator.java?rev=320784&view=auto
==============================================================================
--- incubator/synapse/trunk/scratch/paul/org/apache/synapse/Mediator.java (added)
+++ incubator/synapse/trunk/scratch/paul/org/apache/synapse/Mediator.java Thu Oct 13 08:44:45 2005
@@ -0,0 +1,9 @@
+package org.apache.synapse;
+
+
+import org.apache.axis2.om.OMElement;
+
+public interface Mediator {
+	public boolean mediate(OMElement message);
+	
+}

Added: incubator/synapse/trunk/scratch/paul/org/apache/synapse/MediatorFinder.class
URL: http://svn.apache.org/viewcvs/incubator/synapse/trunk/scratch/paul/org/apache/synapse/MediatorFinder.class?rev=320784&view=auto
==============================================================================
Binary file - no diff available.

Propchange: incubator/synapse/trunk/scratch/paul/org/apache/synapse/MediatorFinder.class
------------------------------------------------------------------------------
    svn:mime-type = application/octet-stream

Added: incubator/synapse/trunk/scratch/paul/org/apache/synapse/MediatorFinder.java
URL: http://svn.apache.org/viewcvs/incubator/synapse/trunk/scratch/paul/org/apache/synapse/MediatorFinder.java?rev=320784&view=auto
==============================================================================
--- incubator/synapse/trunk/scratch/paul/org/apache/synapse/MediatorFinder.java (added)
+++ incubator/synapse/trunk/scratch/paul/org/apache/synapse/MediatorFinder.java Thu Oct 13 08:44:45 2005
@@ -0,0 +1,5 @@
+package org.apache.synapse;
+
+public interface MediatorFinder {
+	public Mediator getMediator(String name);
+}

Added: incubator/synapse/trunk/scratch/paul/org/apache/synapse/Rule.class
URL: http://svn.apache.org/viewcvs/incubator/synapse/trunk/scratch/paul/org/apache/synapse/Rule.class?rev=320784&view=auto
==============================================================================
Binary file - no diff available.

Propchange: incubator/synapse/trunk/scratch/paul/org/apache/synapse/Rule.class
------------------------------------------------------------------------------
    svn:mime-type = application/octet-stream

Added: incubator/synapse/trunk/scratch/paul/org/apache/synapse/Rule.java
URL: http://svn.apache.org/viewcvs/incubator/synapse/trunk/scratch/paul/org/apache/synapse/Rule.java?rev=320784&view=auto
==============================================================================
--- incubator/synapse/trunk/scratch/paul/org/apache/synapse/Rule.java (added)
+++ incubator/synapse/trunk/scratch/paul/org/apache/synapse/Rule.java Thu Oct 13 08:44:45 2005
@@ -0,0 +1,58 @@
+package org.apache.synapse;
+
+public class Rule {
+	private String xpath = null;
+	private String mediatorName = null;
+	private boolean secure = false;
+	private boolean reliable = false;
+	private boolean transactional = false;
+	public void setXpath(String xpath) {
+		this.xpath = xpath;
+	}
+	public String getXpath() {
+		return xpath;
+	}
+	public void setMediatorName(String mediatorName) {
+		this.mediatorName = mediatorName;
+	}
+	public  String getMediatorName() {
+		return mediatorName;
+	}
+	public void setSecure(boolean secure) {
+		this.secure = secure;
+	}
+	public  boolean isSecure() {
+		return secure;
+	}
+	public  void setReliable(boolean reliable) {
+		this.reliable = reliable;
+	}
+	public boolean isReliable() {
+		return reliable;
+	}
+	public void setTransactional(boolean transactional) {
+		this.transactional = transactional;
+	}
+	public boolean isTransactional() {
+		return transactional;
+	}
+	public String toString() {
+		StringBuffer sb = new StringBuffer();
+		sb.append('{');
+		sb.append('\'');
+		sb.append(xpath);
+		sb.append('\'');
+		sb.append('}');
+		sb.append(' ');
+		sb.append('-');
+		sb.append('>');
+		sb.append(' ');
+		sb.append(mediatorName);
+		if (isReliable()) { sb.append(','); sb.append("reliable"); }
+		if (isSecure()) { sb.append(','); sb.append("secure"); }
+		if (isTransactional()) { sb.append(','); sb.append("transactional"); }
+		sb.append(';');
+		
+		return sb.toString();
+	}
+}

Added: incubator/synapse/trunk/scratch/paul/org/apache/synapse/RuleList.class
URL: http://svn.apache.org/viewcvs/incubator/synapse/trunk/scratch/paul/org/apache/synapse/RuleList.class?rev=320784&view=auto
==============================================================================
Binary file - no diff available.

Propchange: incubator/synapse/trunk/scratch/paul/org/apache/synapse/RuleList.class
------------------------------------------------------------------------------
    svn:mime-type = application/octet-stream

Added: incubator/synapse/trunk/scratch/paul/org/apache/synapse/RuleList.java
URL: http://svn.apache.org/viewcvs/incubator/synapse/trunk/scratch/paul/org/apache/synapse/RuleList.java?rev=320784&view=auto
==============================================================================
--- incubator/synapse/trunk/scratch/paul/org/apache/synapse/RuleList.java (added)
+++ incubator/synapse/trunk/scratch/paul/org/apache/synapse/RuleList.java Thu Oct 13 08:44:45 2005
@@ -0,0 +1,103 @@
+package org.apache.synapse;
+import java.io.InputStream;
+import java.util.ArrayList;
+import java.util.Iterator;
+
+import javax.xml.namespace.QName;
+import javax.xml.stream.XMLInputFactory;
+
+import javax.xml.stream.XMLStreamReader;
+
+
+import org.apache.axis2.om.OMElement;
+import org.apache.axis2.om.impl.llom.builder.StAXOMBuilder;
+
+public class RuleList extends ArrayList {
+	// private namespaceContext
+	
+	private String name = null;
+
+	private static final long serialVersionUID = 6108743941694238422L;
+	public static final String namespace = "http://ws.apache.org/synapse/ns/rulelist/1";
+	public static final QName ruleQ = new QName(namespace,"rule");
+	public static final QName rulelistQ = new QName(namespace,"rulelist");
+	public static final QName nameQ = new QName("","name");
+	public static final QName xpathQ = new QName("","xpath");
+	public static final QName mediatorQ = new QName("","mediator");
+	public static final QName secureQ = new QName("","secure");
+	public static final QName reliableQ = new QName("","reliable");
+	public static final QName transactionalQ = new QName("","transactional");
+	
+	public RuleList(InputStream in) {
+		XMLInputFactory xif = XMLInputFactory.newInstance();
+		try {
+			XMLStreamReader xsr = xif.createXMLStreamReader(in);
+			StAXOMBuilder builder = new StAXOMBuilder(xsr);
+			OMElement rulelist = builder.getDocumentElement();
+			
+		
+			
+			if (!rulelist.getQName().equals(rulelistQ)) throw new Exception("not a "+rulelistQ.toString()+" element");
+			
+			if (rulelist.getAttribute(nameQ)==null) throw new Exception("no "+nameQ.toString()+" attribute");
+			String rlname = rulelist.getAttribute(nameQ).getValue();
+			this.setName(rlname);
+			
+					
+			
+			Iterator ruleIt = rulelist.getChildrenWithName(ruleQ);
+			
+			while (ruleIt.hasNext()) {
+				OMElement rule = (OMElement)ruleIt.next();
+				Rule r = new Rule();
+				if (rule.getAttribute(xpathQ)==null) throw new Exception("missing "+xpathQ.toString()+" attribute");
+				r.setXpath(rule.getAttribute(xpathQ).getValue());
+				if (rule.getAttribute(mediatorQ)==null) throw new Exception("missing "+mediatorQ.toString()+" attribute");
+				r.setMediatorName(rule.getAttribute(mediatorQ).getValue());
+				if (rule.getAttribute(reliableQ)!=null) r.setReliable(isTrue(rule.getAttribute(reliableQ).getValue()));
+				if (rule.getAttribute(secureQ)!=null) r.setSecure(isTrue(rule.getAttribute(secureQ).getValue()));
+				if (rule.getAttribute(transactionalQ)!=null) r.setTransactional(isTrue(rule.getAttribute(transactionalQ).getValue()));
+				this.add(r);
+			}
+			
+			
+		} catch (Exception e) {
+			
+			e.printStackTrace();
+		}
+		
+		
+	}
+
+	public void setName(String name) {
+		this.name = name;
+	}
+
+	public String getName() {
+		return name;
+	}
+	
+	private boolean isTrue(String att) {
+		char c = att.toLowerCase().charAt(0);
+		return c=='t' || c=='y';
+	}
+	
+	public String toString() {
+		StringBuffer sb = new StringBuffer();
+		sb.append("[rulelist('"+name+"')]\n");
+		int i=1;
+		Iterator it = this.iterator();
+		while (it.hasNext()) {
+			Rule r = (Rule)it.next();
+			sb.append(i++);
+			sb.append('.');
+			sb.append(' ');
+			sb.append(r.toString());
+			sb.append('\n');
+		}
+		return sb.toString();
+	}
+	
+}
+
+

Added: incubator/synapse/trunk/scratch/paul/org/apache/synapse/SimpleDispatcher.class
URL: http://svn.apache.org/viewcvs/incubator/synapse/trunk/scratch/paul/org/apache/synapse/SimpleDispatcher.class?rev=320784&view=auto
==============================================================================
Binary file - no diff available.

Propchange: incubator/synapse/trunk/scratch/paul/org/apache/synapse/SimpleDispatcher.class
------------------------------------------------------------------------------
    svn:mime-type = application/octet-stream

Added: incubator/synapse/trunk/scratch/paul/org/apache/synapse/SimpleDispatcher.java
URL: http://svn.apache.org/viewcvs/incubator/synapse/trunk/scratch/paul/org/apache/synapse/SimpleDispatcher.java?rev=320784&view=auto
==============================================================================
--- incubator/synapse/trunk/scratch/paul/org/apache/synapse/SimpleDispatcher.java (added)
+++ incubator/synapse/trunk/scratch/paul/org/apache/synapse/SimpleDispatcher.java Thu Oct 13 08:44:45 2005
@@ -0,0 +1,47 @@
+package org.apache.synapse;
+
+import java.util.Iterator;
+
+import org.apache.axis2.om.OMElement;
+import org.apache.axis2.om.xpath.AXIOMXPath;
+import org.jaxen.JaxenException;
+
+public class SimpleDispatcher {
+
+
+	private RuleList rl = null;
+
+	private MediatorFinder finder = null;
+	
+	
+	public void setMediatorFinder(MediatorFinder mf) {
+		finder = mf;
+	}
+
+	public SimpleDispatcher(RuleList rl, MediatorFinder mf) {
+		this.setRuleList(rl);
+		this.setMediatorFinder(mf);
+	}
+
+
+
+	public void execute(OMElement message) throws JaxenException{
+		Iterator iterator = rl.iterator();
+		while (iterator.hasNext()) {
+				Rule r = (Rule) iterator.next();
+				AXIOMXPath xp = new AXIOMXPath(r.getXpath());
+				if (xp.booleanValueOf(message)) {
+					Mediator m = finder.getMediator(r.getMediatorName());
+					boolean cont = m.mediate(message);
+					if (!cont) return;
+				}
+		}
+		// send now
+		System.out.println("sending");
+	}
+
+	private void setRuleList(RuleList rl) {
+		this.rl = rl;
+	}
+
+}

Added: incubator/synapse/trunk/scratch/paul/org/apache/synapse/receivers/Receiver.class
URL: http://svn.apache.org/viewcvs/incubator/synapse/trunk/scratch/paul/org/apache/synapse/receivers/Receiver.class?rev=320784&view=auto
==============================================================================
Binary file - no diff available.

Propchange: incubator/synapse/trunk/scratch/paul/org/apache/synapse/receivers/Receiver.class
------------------------------------------------------------------------------
    svn:mime-type = application/octet-stream

Added: incubator/synapse/trunk/scratch/paul/org/apache/synapse/receivers/Receiver.java
URL: http://svn.apache.org/viewcvs/incubator/synapse/trunk/scratch/paul/org/apache/synapse/receivers/Receiver.java?rev=320784&view=auto
==============================================================================
--- incubator/synapse/trunk/scratch/paul/org/apache/synapse/receivers/Receiver.java (added)
+++ incubator/synapse/trunk/scratch/paul/org/apache/synapse/receivers/Receiver.java Thu Oct 13 08:44:45 2005
@@ -0,0 +1,77 @@
+
+/*
+ * 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.receivers;
+
+import org.apache.axis2.AxisFault;
+import org.apache.axis2.Constants;
+import org.apache.axis2.context.MessageContext;
+import org.apache.axis2.description.OperationDescription;
+
+import org.apache.axis2.engine.MessageReceiver;
+import org.apache.axis2.receivers.AbstractInMessageReceiver;
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+
+
+/**
+ * This is a Simple java Provider.
+ */
+public class Receiver extends AbstractInMessageReceiver implements
+		MessageReceiver {
+	/**
+	 * Field log
+	 */
+	protected Log log = LogFactory.getLog(getClass());
+
+	/**
+	 * Field scope
+	 */
+	private String scope;
+
+	/**
+	 * Field method
+	 */
+
+	/**
+	 * Constructor RawXMLProvider
+	 */
+	public Receiver() {
+		scope = Constants.APPLICATION_SCOPE;
+	}
+
+	public void invokeBusinessLogic(MessageContext msgContext) throws AxisFault {
+		try {
+
+			// get the implementation class for the Web Service
+
+			// find the WebService method
+
+			OperationDescription op = msgContext.getOperationContext()
+					.getAxisOperation();
+			System.out.println(op);
+
+			System.out.println(msgContext.getMessageID());
+			System.out.println(msgContext.getSoapAction());
+			System.out.println(msgContext.getTo());
+			System.out.println(msgContext.getEnvelope());
+		} catch (Exception e) {
+			throw AxisFault.makeFault(e);
+		}
+
+	}
+}

Added: incubator/synapse/trunk/scratch/paul/org/apache/synapse/receivers/SpringAbstractInMessageReceiver.class
URL: http://svn.apache.org/viewcvs/incubator/synapse/trunk/scratch/paul/org/apache/synapse/receivers/SpringAbstractInMessageReceiver.class?rev=320784&view=auto
==============================================================================
Binary file - no diff available.

Propchange: incubator/synapse/trunk/scratch/paul/org/apache/synapse/receivers/SpringAbstractInMessageReceiver.class
------------------------------------------------------------------------------
    svn:mime-type = application/octet-stream

Added: incubator/synapse/trunk/scratch/paul/org/apache/synapse/receivers/SpringAbstractInMessageReceiver.java
URL: http://svn.apache.org/viewcvs/incubator/synapse/trunk/scratch/paul/org/apache/synapse/receivers/SpringAbstractInMessageReceiver.java?rev=320784&view=auto
==============================================================================
--- incubator/synapse/trunk/scratch/paul/org/apache/synapse/receivers/SpringAbstractInMessageReceiver.java (added)
+++ incubator/synapse/trunk/scratch/paul/org/apache/synapse/receivers/SpringAbstractInMessageReceiver.java Thu Oct 13 08:44:45 2005
@@ -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.receivers;
+
+import org.apache.axis2.AxisFault;
+import org.apache.axis2.context.MessageContext;
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+
+/**
+ * This is takes care of the IN-OUT sync MEP in the server side
+ */
+public abstract class SpringAbstractInMessageReceiver
+        extends SpringAbstractMessageReceiver {
+    protected Log log = LogFactory.getLog(getClass());
+
+    public abstract void invokeBusinessLogic(MessageContext inMessage) throws AxisFault;
+
+    public final void receive(final MessageContext messgeCtx) throws AxisFault {
+        invokeBusinessLogic(messgeCtx);
+    }
+
+}

Added: incubator/synapse/trunk/scratch/paul/org/apache/synapse/receivers/SpringAbstractInOutSyncMessageReceiver.class
URL: http://svn.apache.org/viewcvs/incubator/synapse/trunk/scratch/paul/org/apache/synapse/receivers/SpringAbstractInOutSyncMessageReceiver.class?rev=320784&view=auto
==============================================================================
Binary file - no diff available.

Propchange: incubator/synapse/trunk/scratch/paul/org/apache/synapse/receivers/SpringAbstractInOutSyncMessageReceiver.class
------------------------------------------------------------------------------
    svn:mime-type = application/octet-stream

Added: incubator/synapse/trunk/scratch/paul/org/apache/synapse/receivers/SpringAbstractInOutSyncMessageReceiver.java
URL: http://svn.apache.org/viewcvs/incubator/synapse/trunk/scratch/paul/org/apache/synapse/receivers/SpringAbstractInOutSyncMessageReceiver.java?rev=320784&view=auto
==============================================================================
--- incubator/synapse/trunk/scratch/paul/org/apache/synapse/receivers/SpringAbstractInOutSyncMessageReceiver.java (added)
+++ incubator/synapse/trunk/scratch/paul/org/apache/synapse/receivers/SpringAbstractInOutSyncMessageReceiver.java Thu Oct 13 08:44:45 2005
@@ -0,0 +1,82 @@
+/*
+ * 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.receivers;
+
+import org.apache.axis2.AxisFault;
+import org.apache.axis2.addressing.AddressingConstants;
+import org.apache.axis2.addressing.MessageInformationHeaders;
+import org.apache.axis2.addressing.miheaders.RelatesTo;
+import org.apache.axis2.context.MessageContext;
+import org.apache.axis2.engine.AxisEngine;
+import org.apache.axis2.transport.http.HTTPConstants;
+import org.apache.axis2.util.UUIDGenerator;
+
+/**
+ * This is the Absract IN-OUT MEP MessageReceiver. The
+ * protected abstract methods are only for the sake of breaking down the logic
+ */
+public abstract class SpringAbstractInOutSyncMessageReceiver extends SpringAbstractMessageReceiver {
+    public abstract void invokeBusinessLogic(MessageContext inMessage,
+                                             MessageContext outMessage)
+            throws AxisFault;
+
+    public final void receive(MessageContext msgContext) throws AxisFault {
+        MessageContext outMsgContext =
+                new MessageContext(msgContext.getSystemContext(),
+                        msgContext.getSessionContext(),
+                        msgContext.getTransportIn(),
+                        msgContext.getTransportOut());
+
+        MessageInformationHeaders oldMessageInfoHeaders =
+                msgContext.getMessageInformationHeaders();
+        MessageInformationHeaders messageInformationHeaders =
+                new MessageInformationHeaders();
+        messageInformationHeaders.setMessageId(UUIDGenerator.getUUID());
+        messageInformationHeaders.setTo(oldMessageInfoHeaders.getReplyTo());
+        messageInformationHeaders.setFaultTo(
+                oldMessageInfoHeaders.getFaultTo());
+        messageInformationHeaders.setFrom(oldMessageInfoHeaders.getTo());
+        messageInformationHeaders.setRelatesTo(
+                new RelatesTo(oldMessageInfoHeaders.getMessageId(),
+                        AddressingConstants.Submission.WSA_RELATES_TO_RELATIONSHIP_TYPE_DEFAULT_VALUE));
+        messageInformationHeaders.setAction(oldMessageInfoHeaders.getAction());
+        outMsgContext.setMessageInformationHeaders(messageInformationHeaders);
+        outMsgContext.setOperationContext(msgContext.getOperationContext());
+        outMsgContext.setServiceContext(msgContext.getServiceContext());
+        outMsgContext.setServiceGroupContextId(msgContext.getServiceGroupContextId());
+        outMsgContext.setProperty(MessageContext.TRANSPORT_OUT,
+                msgContext.getProperty(MessageContext.TRANSPORT_OUT));
+        outMsgContext.setProperty(HTTPConstants.HTTPOutTransportInfo,
+                msgContext.getProperty(HTTPConstants.HTTPOutTransportInfo));
+        
+        //Setting the charater set encoding
+        outMsgContext.setProperty(MessageContext.CHARACTER_SET_ENCODING, msgContext
+				.getProperty(MessageContext.CHARACTER_SET_ENCODING));
+        
+        outMsgContext.setDoingREST(msgContext.isDoingREST());
+        outMsgContext.setDoingMTOM(msgContext.isDoingMTOM());
+        outMsgContext.setServerSide(msgContext.isServerSide());
+
+        invokeBusinessLogic(msgContext, outMsgContext);
+
+        AxisEngine engine =
+                new AxisEngine(
+                        msgContext.getOperationContext().getServiceContext()
+                .getEngineContext());
+        engine.send(outMsgContext);
+    }
+}

Added: incubator/synapse/trunk/scratch/paul/org/apache/synapse/receivers/SpringAbstractMessageReceiver.class
URL: http://svn.apache.org/viewcvs/incubator/synapse/trunk/scratch/paul/org/apache/synapse/receivers/SpringAbstractMessageReceiver.class?rev=320784&view=auto
==============================================================================
Binary file - no diff available.

Propchange: incubator/synapse/trunk/scratch/paul/org/apache/synapse/receivers/SpringAbstractMessageReceiver.class
------------------------------------------------------------------------------
    svn:mime-type = application/octet-stream

Added: incubator/synapse/trunk/scratch/paul/org/apache/synapse/receivers/SpringAbstractMessageReceiver.java
URL: http://svn.apache.org/viewcvs/incubator/synapse/trunk/scratch/paul/org/apache/synapse/receivers/SpringAbstractMessageReceiver.java?rev=320784&view=auto
==============================================================================
--- incubator/synapse/trunk/scratch/paul/org/apache/synapse/receivers/SpringAbstractMessageReceiver.java (added)
+++ incubator/synapse/trunk/scratch/paul/org/apache/synapse/receivers/SpringAbstractMessageReceiver.java Thu Oct 13 08:44:45 2005
@@ -0,0 +1,159 @@
+/*
+ * 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.receivers;
+
+import java.lang.reflect.Method;
+
+import org.apache.axis2.AxisFault;
+import org.apache.axis2.Constants;
+import org.apache.axis2.context.ConfigurationContext;
+import org.apache.axis2.context.MessageContext;
+import org.apache.axis2.context.SessionContext;
+import org.apache.axis2.description.Parameter;
+import org.apache.axis2.description.ServiceDescription;
+import org.apache.axis2.engine.MessageReceiver;
+import org.apache.axis2.i18n.Messages;
+import org.apache.axis2.om.OMAbstractFactory;
+import org.apache.axis2.soap.SOAP11Constants;
+import org.apache.axis2.soap.SOAP12Constants;
+import org.apache.axis2.soap.SOAPFactory;
+import org.springframework.beans.factory.BeanFactory;
+
+import org.springframework.context.support.ClassPathXmlApplicationContext;
+
+import javax.xml.namespace.QName;
+
+public abstract class SpringAbstractMessageReceiver implements MessageReceiver {
+    public static final String SERVICE_SPRING_XML = "SpringXmlURL";
+    public static final String SERVICE_SPRING_INLINE_XML = "SpringXMLInline";
+    public static final String SERVICE_SPRING_BEANNAME = "SpringBeanName";
+    public static final String SCOPE = "scope";
+
+    protected SOAPFactory fac;
+
+    /**
+     * Method makeNewServiceObject
+     *
+     * @param msgContext
+     * @return
+     * @throws AxisFault
+     */
+    protected Object makeNewServiceObject(MessageContext msgContext)
+        throws AxisFault {
+        try {
+
+            String nsURI = msgContext.getEnvelope().getNamespace().getName();
+            if (SOAP12Constants.SOAP_ENVELOPE_NAMESPACE_URI.equals(nsURI)) {
+                fac = OMAbstractFactory.getSOAP12Factory();
+            } else if (
+                SOAP11Constants.SOAP_ENVELOPE_NAMESPACE_URI.equals(nsURI)) {
+                fac = OMAbstractFactory.getSOAP11Factory();
+            } else {
+                throw new AxisFault(Messages.getMessage("invalidSOAPversion"));
+            }
+
+            ServiceDescription service =
+                msgContext
+                    .getOperationContext()
+                    .getServiceContext()
+                    .getServiceConfig();
+                        
+            Parameter implInlineParam = service.getParameter(SERVICE_SPRING_INLINE_XML);
+            Parameter implXMLParam = service.getParameter(SERVICE_SPRING_XML);
+            Parameter implBeanParam = service.getParameter(SERVICE_SPRING_BEANNAME);
+            
+            String beanName = ((String) implBeanParam.getValue()).trim();
+            if (implXMLParam != null && implBeanParam != null) {
+            	ClassLoader cl  = service.getClassLoader();
+            	String xmlFile = ((String) implXMLParam.getValue()).trim();
+            	
+            	ClassPathXmlApplicationContext ctx = new ClassPathXmlApplicationContext(new String[] {xmlFile}, false);
+            	ctx.setClassLoader(cl);
+            	ctx.refresh();
+            	Object bean = ((BeanFactory)ctx).getBean(beanName);
+            	System.out.println(bean);
+            	System.out.println(bean.getClass());
+                return bean;
+            //} else if (implInlineParam != null && implBeanParam != null){
+            //	String xmlInline = ((String) implInlineParam.getValue()).trim();
+                //XmlBeanFactory xbf = new XmlBeanFactory(new ByteArrayResource(xmlInline.getBytes()));
+                //return xbf.getBean(beanName);
+            } else {
+                throw new AxisFault(
+                    Messages.getMessage(
+                        "paramIsNotSpecified",
+                        "SERVICE_CLASS"));
+            }
+            
+        } catch (Exception e) {
+            throw AxisFault.makeFault(e);
+        }
+    }
+
+    /**
+     * Method getTheImplementationObject
+     *
+     * @param msgContext
+     * @return
+     * @throws AxisFault
+     */
+    protected Object getTheImplementationObject(MessageContext msgContext)
+        throws AxisFault {
+        ServiceDescription service =
+            msgContext
+                .getOperationContext()
+                .getServiceContext()
+                .getServiceConfig();
+
+        Parameter scopeParam = service.getParameter(SCOPE);	
+        QName serviceName = service.getName();
+        if (scopeParam != null
+            && Constants.SESSION_SCOPE.equals(scopeParam.getValue())) {
+            SessionContext sessionContext = msgContext.getSessionContext();
+            synchronized (sessionContext) {
+                Object obj =
+                    sessionContext.getProperty(serviceName.getLocalPart());
+                if (obj == null) {
+                    obj = makeNewServiceObject(msgContext);
+                    sessionContext.setProperty(serviceName.getLocalPart(), obj);
+                }
+                return obj;
+            }
+        } else if (
+            scopeParam != null
+                && Constants.APPLICATION_SCOPE.equals(scopeParam.getValue())) {
+            ConfigurationContext globalContext = msgContext.getSystemContext();
+            synchronized (globalContext) {
+                Object obj =
+                    globalContext.getProperty(serviceName.getLocalPart());
+                if (obj == null) {
+                    obj = makeNewServiceObject(msgContext);
+                    globalContext.setProperty(serviceName.getLocalPart(), obj);
+                }
+                return obj;
+            }
+        } else {
+            return makeNewServiceObject(msgContext);
+        }
+    }
+
+    public SOAPFactory getSOAPFactory() {
+        return fac;
+    }
+    
+
+}

Added: incubator/synapse/trunk/scratch/paul/org/apache/synapse/receivers/SpringInOnlyMessageReceiver.class
URL: http://svn.apache.org/viewcvs/incubator/synapse/trunk/scratch/paul/org/apache/synapse/receivers/SpringInOnlyMessageReceiver.class?rev=320784&view=auto
==============================================================================
Binary file - no diff available.

Propchange: incubator/synapse/trunk/scratch/paul/org/apache/synapse/receivers/SpringInOnlyMessageReceiver.class
------------------------------------------------------------------------------
    svn:mime-type = application/octet-stream

Added: incubator/synapse/trunk/scratch/paul/org/apache/synapse/receivers/SpringInOnlyMessageReceiver.java
URL: http://svn.apache.org/viewcvs/incubator/synapse/trunk/scratch/paul/org/apache/synapse/receivers/SpringInOnlyMessageReceiver.java?rev=320784&view=auto
==============================================================================
--- incubator/synapse/trunk/scratch/paul/org/apache/synapse/receivers/SpringInOnlyMessageReceiver.java (added)
+++ incubator/synapse/trunk/scratch/paul/org/apache/synapse/receivers/SpringInOnlyMessageReceiver.java Thu Oct 13 08:44:45 2005
@@ -0,0 +1,134 @@
+/*
+ * 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.receivers;
+
+import org.apache.axis2.AxisFault;
+import org.apache.axis2.Constants;
+import org.apache.axis2.context.MessageContext;
+import org.apache.axis2.description.OperationDescription;
+import org.apache.axis2.engine.DependencyManager;
+import org.apache.axis2.engine.MessageReceiver;
+import org.apache.axis2.i18n.Messages;
+import org.apache.axis2.om.OMElement;
+import org.apache.axis2.soap.SOAPEnvelope;
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+import org.apache.wsdl.WSDLService;
+
+
+
+import java.lang.reflect.Method;
+
+/**
+ * This is a Simple java Provider.
+ */
+public class SpringInOnlyMessageReceiver
+        extends SpringAbstractInMessageReceiver
+        implements MessageReceiver {
+    /**
+     * Field log
+     */
+    protected Log log = LogFactory.getLog(getClass());
+
+    /**
+     * Field scope
+     */
+    private String scope;
+
+    /**
+     * Field method
+     */
+    private Method method;
+
+    /**
+     * Field classLoader
+     */
+    private ClassLoader classLoader;
+
+    /**
+     * Constructor RawXMLProvider
+     */
+    public SpringInOnlyMessageReceiver() {
+        scope = Constants.APPLICATION_SCOPE;
+    }
+
+    public void invokeBusinessLogic(MessageContext msgContext)
+            throws AxisFault {
+        try {
+
+            // get the implementation class for the Web Service
+        	Object obj = getTheImplementationObject(msgContext);
+        	
+        	// find the WebService method
+        	Class ImplClass = obj.getClass();
+        	DependencyManager.configureBusinessLogicProvider(obj, msgContext, null);
+        	
+        	OperationDescription op = msgContext.getOperationContext()
+        	.getAxisOperation();
+        	if (op == null) {
+        		throw new AxisFault(
+        		"Operation is not located, if this is doclit style the SOAP-ACTION should specified via the SOAP Action to use the RawXMLProvider");
+        	}
+        	String methodName = op.getName().getLocalPart();
+        	
+        	Method[] methods = ImplClass.getMethods();
+        	for (int i = 0; i < methods.length; i++) {
+        		if (methods[i].getName().equals(methodName)) {
+        			this.method = methods[i];
+        			break;
+        		}
+        	}
+        	Class[] parameters = method.getParameterTypes();
+        	if ((parameters != null)
+        			&& (parameters.length == 1)
+        			&&
+        			OMElement.class.getName().equals(parameters[0].getName())) {
+        		OMElement methodElement = msgContext.getEnvelope().getBody()
+        		.getFirstElement();
+        		
+        		OMElement parmeter = null;
+        		SOAPEnvelope envelope = null;
+        		
+        		String style = msgContext.getOperationContext()
+        		.getAxisOperation()
+        		.getStyle();
+        		
+        		if (WSDLService.STYLE_DOC.equals(style)) {
+        			parmeter = methodElement;
+        			Object[] parms = new Object[]{parmeter};
+        			//Need not have a return here
+        			method.invoke(obj, parms);
+        			
+        		} else if (WSDLService.STYLE_RPC.equals(style)) {
+        			parmeter = methodElement.getFirstElement();
+        			Object[] parms = new Object[]{parmeter};
+        			
+        			// invoke the WebService
+        			method.invoke(obj, parms);
+        			
+        		} else {
+        			throw new AxisFault(Messages.getMessage("unknownStyle",style));
+        		}
+        	} else {
+                throw new AxisFault(Messages.getMessage("SpringInOnlyReceiverIsLimited"));
+            }
+        } catch (Exception e) {
+            throw AxisFault.makeFault(e);
+        }
+
+    }
+}

Added: incubator/synapse/trunk/scratch/paul/org/apache/synapse/receivers/SpringInOutMessageReceiver.class
URL: http://svn.apache.org/viewcvs/incubator/synapse/trunk/scratch/paul/org/apache/synapse/receivers/SpringInOutMessageReceiver.class?rev=320784&view=auto
==============================================================================
Binary file - no diff available.

Propchange: incubator/synapse/trunk/scratch/paul/org/apache/synapse/receivers/SpringInOutMessageReceiver.class
------------------------------------------------------------------------------
    svn:mime-type = application/octet-stream

Added: incubator/synapse/trunk/scratch/paul/org/apache/synapse/receivers/SpringInOutMessageReceiver.java
URL: http://svn.apache.org/viewcvs/incubator/synapse/trunk/scratch/paul/org/apache/synapse/receivers/SpringInOutMessageReceiver.java?rev=320784&view=auto
==============================================================================
--- incubator/synapse/trunk/scratch/paul/org/apache/synapse/receivers/SpringInOutMessageReceiver.java (added)
+++ incubator/synapse/trunk/scratch/paul/org/apache/synapse/receivers/SpringInOutMessageReceiver.java Thu Oct 13 08:44:45 2005
@@ -0,0 +1,159 @@
+/*
+ * 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.receivers;
+
+import org.apache.axis2.AxisFault;
+import org.apache.axis2.Constants;
+import org.apache.axis2.context.MessageContext;
+import org.apache.axis2.description.OperationDescription;
+import org.apache.axis2.engine.DependencyManager;
+import org.apache.axis2.engine.MessageReceiver;
+import org.apache.axis2.i18n.Messages;
+import org.apache.axis2.om.OMElement;
+import org.apache.axis2.om.OMNamespace;
+import org.apache.axis2.soap.SOAPEnvelope;
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+import org.apache.wsdl.WSDLService;
+
+import java.lang.reflect.Method;
+
+/**
+ * This is a Simple java Provider.
+ */
+public class SpringInOutMessageReceiver
+        extends SpringAbstractInOutSyncMessageReceiver
+        implements MessageReceiver {
+    /**
+     * Field log
+     */
+    protected Log log = LogFactory.getLog(getClass());
+
+    /**
+     * Field scope
+     */
+    private String scope;
+
+    /**
+     * Field classLoader
+     */
+    private ClassLoader classLoader;
+
+    /**
+     * Constructor RawXMLProvider
+     */
+    public SpringInOutMessageReceiver() {
+        scope = Constants.APPLICATION_SCOPE;
+    }
+
+    public void invokeBusinessLogic(MessageContext msgContext,
+                                    MessageContext newmsgContext)
+            throws AxisFault {
+        try {
+
+            // get the implementation class for the Web Service
+            Object obj = getTheImplementationObject(msgContext);
+
+            // find the WebService method
+            Class ImplClass = obj.getClass();
+
+            //Inject the Message Context if it is asked for
+            DependencyManager.configureBusinessLogicProvider(obj, msgContext, newmsgContext);
+
+            OperationDescription opDesc = msgContext.getOperationContext()
+                    .getAxisOperation();
+            Method method = findOperation(opDesc, ImplClass);
+            if (method != null) {
+                String style = msgContext.getOperationContext()
+                        .getAxisOperation()
+                        .getStyle();
+
+                Class[] parameters = method.getParameterTypes();
+                Object[] args = null;
+
+                if (parameters == null || parameters.length == 0) {
+                    args = new Object[0];
+                } else if (parameters.length == 1) {
+                    OMElement omElement = null;
+                    if (WSDLService.STYLE_DOC.equals(style)) {
+                        omElement =
+                                msgContext.getEnvelope().getBody()
+                                .getFirstElement();
+                    } else if (WSDLService.STYLE_RPC.equals(style)) {
+                        OMElement operationElement = msgContext.getEnvelope()
+                                .getBody()
+                                .getFirstElement();
+                        if (operationElement != null) {
+                            if (operationElement.getLocalName() != null &&
+                                    operationElement.getLocalName().startsWith(
+                                            method.getName())) {
+                                omElement = operationElement.getFirstElement();
+                            } else {
+                                throw new AxisFault(Messages.getMessage("AandBdonotmatch","Operation Name","immediate child name",operationElement.getLocalName(),method.getName()));
+                            }
+                        } else {
+                            throw new AxisFault(Messages.getMessage("rpcNeedmatchingChild"));
+                        }
+                    } else {
+                        throw new AxisFault(Messages.getMessage("unknownStyle",style));
+                    }
+                    args = new Object[]{omElement};
+                } else {
+                    throw new AxisFault(Messages.getMessage("rawXmlProivdeIsLimited"));
+                }
+
+                OMElement result = (OMElement) method.invoke(obj, args);
+
+                OMElement bodyContent = null;
+                if (WSDLService.STYLE_RPC.equals(style)) {
+                    OMNamespace ns = getSOAPFactory().createOMNamespace(
+                            "http://soapenc/", "res");
+                    bodyContent =
+                            getSOAPFactory().createOMElement(
+                                    method.getName() + "Response", ns);
+                    bodyContent.addChild(result);
+                } else {
+                    bodyContent = result;
+                }
+
+                SOAPEnvelope envelope = getSOAPFactory().getDefaultEnvelope();
+                if (bodyContent != null) {
+                    envelope.getBody().addChild(bodyContent);
+                }
+                newmsgContext.setEnvelope(envelope);
+            } else {
+                throw new AxisFault(Messages.getMessage("methodNotImplemented",opDesc.getName().toString()));
+            }
+        } catch (Exception e) {
+            throw AxisFault.makeFault(e);
+        }
+
+    }
+
+    public Method findOperation(OperationDescription op, Class ImplClass) {
+        Method method = null;
+        String methodName = op.getName().getLocalPart();
+        Method[] methods = ImplClass.getMethods();
+        for (int i = 0; i < methods.length; i++) {
+            if (methods[i].getName().equals(methodName)) {
+                method = methods[i];
+                break;
+            }
+        }
+        return method;
+    }
+}

Added: incubator/synapse/trunk/scratch/paul/org/apache/synapse/receivers/test.jpage
URL: http://svn.apache.org/viewcvs/incubator/synapse/trunk/scratch/paul/org/apache/synapse/receivers/test.jpage?rev=320784&view=auto
==============================================================================
--- incubator/synapse/trunk/scratch/paul/org/apache/synapse/receivers/test.jpage (added)
+++ incubator/synapse/trunk/scratch/paul/org/apache/synapse/receivers/test.jpage Thu Oct 13 08:44:45 2005
@@ -0,0 +1,10 @@
+
+		 org.jaxen.XPath x = new org.apache.axis2.om.xpath.AXIOMXPath("test=5");
+		 
+		 org.apache.axis2.om.OMFactory f = org.apache.axis2.om.OMAbstractFactory.getOMFactory();
+		 org.apache.axis2.om.OMElement e= f.createOMElement("test", "","");
+		 
+		 f.createText(e, "5");
+		 e.serializeWithCache(javax.xml.stream.XMLOutputFactory.newInstance().createXMLStreamWriter(System.out));
+		 
+		
\ No newline at end of file

Added: incubator/synapse/trunk/scratch/paul/rulelist.xml
URL: http://svn.apache.org/viewcvs/incubator/synapse/trunk/scratch/paul/rulelist.xml?rev=320784&view=auto
==============================================================================
--- incubator/synapse/trunk/scratch/paul/rulelist.xml (added)
+++ incubator/synapse/trunk/scratch/paul/rulelist.xml Thu Oct 13 08:44:45 2005
@@ -0,0 +1,14 @@
+<rulelist name="rulespace1"
+
+	xmlns:other="http://test.other.org/ns/1"
+	
+	xmlns="http://ws.apache.org/synapse/ns/rulelist/1">
+	
+	
+	<!--general rules-->
+	<rule xpath="*" mediator="logbean"/>
+	
+	<!--specific rules-->
+	<rule xpath="//*[symbol='IBM']" mediator="redirect"/>
+	
+</rulelist>	
\ No newline at end of file



Mime
View raw message