You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@synapse.apache.org by pz...@apache.org on 2005/11/14 11:51:47 UTC
svn commit: r344100 - in
/incubator/synapse/trunk/scratch/yomsp2/src/org/apache/synapse:
mediators/SpringMediatorConfigurator.java ruleEngines/AllRuleEngine.java
ruleEngines/OnceRuleEngine.java ruleEngines/Rule.java
ruleEngines/XPathRuleEngine.java
Author: pzf
Date: Mon Nov 14 02:51:41 2005
New Revision: 344100
URL: http://svn.apache.org/viewcvs?rev=344100&view=rev
Log:
more changes and bugfixes
Modified:
incubator/synapse/trunk/scratch/yomsp2/src/org/apache/synapse/mediators/SpringMediatorConfigurator.java
incubator/synapse/trunk/scratch/yomsp2/src/org/apache/synapse/ruleEngines/AllRuleEngine.java
incubator/synapse/trunk/scratch/yomsp2/src/org/apache/synapse/ruleEngines/OnceRuleEngine.java
incubator/synapse/trunk/scratch/yomsp2/src/org/apache/synapse/ruleEngines/Rule.java
incubator/synapse/trunk/scratch/yomsp2/src/org/apache/synapse/ruleEngines/XPathRuleEngine.java
Modified: incubator/synapse/trunk/scratch/yomsp2/src/org/apache/synapse/mediators/SpringMediatorConfigurator.java
URL: http://svn.apache.org/viewcvs/incubator/synapse/trunk/scratch/yomsp2/src/org/apache/synapse/mediators/SpringMediatorConfigurator.java?rev=344100&r1=344099&r2=344100&view=diff
==============================================================================
--- incubator/synapse/trunk/scratch/yomsp2/src/org/apache/synapse/mediators/SpringMediatorConfigurator.java (original)
+++ incubator/synapse/trunk/scratch/yomsp2/src/org/apache/synapse/mediators/SpringMediatorConfigurator.java Mon Nov 14 02:51:41 2005
@@ -12,6 +12,7 @@
import org.apache.axis2.om.OMElement;
import org.apache.synapse.MediatorConfiguration;
import org.apache.synapse.MediatorConfigurator;
+
import org.apache.synapse.SynapseException;
import org.springframework.beans.factory.xml.XmlBeanDefinitionReader;
import org.springframework.context.support.GenericApplicationContext;
@@ -21,6 +22,7 @@
public MediatorConfiguration parse(OMElement el, ClassLoader cl) {
+
SpringMediatorConfiguration mc = new SpringMediatorConfiguration();
OMAttribute name = el.getAttribute(new QName("", "name"));
if (name == null) throw new SynapseException("missing name attribute on "+el.toString());
Modified: incubator/synapse/trunk/scratch/yomsp2/src/org/apache/synapse/ruleEngines/AllRuleEngine.java
URL: http://svn.apache.org/viewcvs/incubator/synapse/trunk/scratch/yomsp2/src/org/apache/synapse/ruleEngines/AllRuleEngine.java?rev=344100&r1=344099&r2=344100&view=diff
==============================================================================
--- incubator/synapse/trunk/scratch/yomsp2/src/org/apache/synapse/ruleEngines/AllRuleEngine.java (original)
+++ incubator/synapse/trunk/scratch/yomsp2/src/org/apache/synapse/ruleEngines/AllRuleEngine.java Mon Nov 14 02:51:41 2005
@@ -4,11 +4,12 @@
import org.apache.axis2.context.SOAPMessageContext;
import org.apache.axis2.om.OMElement;
+import org.apache.synapse.Constants;
public class AllRuleEngine extends OnceRuleEngine {
private static final QName ALL_RULE_Q = new QName(
- "http://ws.apache.org/ns/synapse/allrule", "rule");
+ Constants.SYNAPSE_NAMESPACE, "rule");
public static final RuleCondition always = new RuleCondition() {
public boolean matches(SOAPMessageContext smc) {
Modified: incubator/synapse/trunk/scratch/yomsp2/src/org/apache/synapse/ruleEngines/OnceRuleEngine.java
URL: http://svn.apache.org/viewcvs/incubator/synapse/trunk/scratch/yomsp2/src/org/apache/synapse/ruleEngines/OnceRuleEngine.java?rev=344100&r1=344099&r2=344100&view=diff
==============================================================================
--- incubator/synapse/trunk/scratch/yomsp2/src/org/apache/synapse/ruleEngines/OnceRuleEngine.java (original)
+++ incubator/synapse/trunk/scratch/yomsp2/src/org/apache/synapse/ruleEngines/OnceRuleEngine.java Mon Nov 14 02:51:41 2005
@@ -62,10 +62,15 @@
Rule ra = (Rule) it.next();
RuleCondition rc = ra.getRuleCondition();
if (rc.matches(smc)) {
- MediatorConfiguration mc = ra.getMediatorConfiguration();
- boolean ret = se.executeMediator(mc, smc);
- if (!ret)
- return false;
+ List medConfigs = ra.getMediatorConfigurations();
+ if (medConfigs==null) return true;
+ Iterator mcs = medConfigs.iterator();
+ while (mcs.hasNext()) {
+ MediatorConfiguration mc = (MediatorConfiguration)mcs.next();
+ boolean ret = se.executeMediator(mc, smc);
+ if (!ret) return false;
+ }
+
}
}
return true;
Modified: incubator/synapse/trunk/scratch/yomsp2/src/org/apache/synapse/ruleEngines/Rule.java
URL: http://svn.apache.org/viewcvs/incubator/synapse/trunk/scratch/yomsp2/src/org/apache/synapse/ruleEngines/Rule.java?rev=344100&r1=344099&r2=344100&view=diff
==============================================================================
--- incubator/synapse/trunk/scratch/yomsp2/src/org/apache/synapse/ruleEngines/Rule.java (original)
+++ incubator/synapse/trunk/scratch/yomsp2/src/org/apache/synapse/ruleEngines/Rule.java Mon Nov 14 02:51:41 2005
@@ -1,6 +1,8 @@
package org.apache.synapse.ruleEngines;
+import java.util.List;
import java.util.Iterator;
+import java.util.LinkedList;
import org.apache.axis2.om.OMAttribute;
import org.apache.axis2.om.OMElement;
@@ -12,39 +14,45 @@
public class Rule {
private RuleCondition rc = null;
- private MediatorConfiguration mc = null;
- private int mediatorType = 0;
+ private List mcs = new LinkedList();
+
public void init(OMElement ruleContainer, ClassLoader cl) {
Iterator it = ruleContainer.getChildrenWithName(Constants.MEDIATOR_Q);
- if (it.hasNext()) {
- OMElement med = (OMElement)it.next(); // only use first mediator
+
+
+ while (it.hasNext()) {
+ OMElement med = (OMElement)it.next();
OMAttribute type = med.getAttribute(Constants.TYPE_ATT_Q);
if (type==null) throw new SynapseException("no type declaration on "+med.toString());
MediatorConfigurator config = MediatorTypes.getMediatorConfigurator(type.getAttributeValue());
- mc = config.parse(med, cl);
- mediatorType = MediatorTypes.getType(type.getAttributeValue());
+ if (config!=null) {
+ MediatorConfiguration mc = config.parse(med, cl);
+ if (mc!=null) {
+ mcs.add(mc);
+ }
+ else throw new SynapseException("failed to parse mediator component"+med.toString());
+ }
+ else throw new SynapseException("could not find mediator configurator for type "+type.getAttributeValue());
+
+
}
+
+
// deal with QoS apply elements here TODO
}
//public QoS getQoS();
- public MediatorConfiguration getMediatorConfiguration() {
- return mc;
- }
- public int getMediatorType() {
- return mediatorType;
+ public List getMediatorConfigurations() {
+ return mcs;
}
-
public RuleCondition getRuleCondition() {
return rc;
}
public void setRuleCondition(RuleCondition rc) {
this.rc = rc;
}
-
-
}
Modified: incubator/synapse/trunk/scratch/yomsp2/src/org/apache/synapse/ruleEngines/XPathRuleEngine.java
URL: http://svn.apache.org/viewcvs/incubator/synapse/trunk/scratch/yomsp2/src/org/apache/synapse/ruleEngines/XPathRuleEngine.java?rev=344100&r1=344099&r2=344100&view=diff
==============================================================================
--- incubator/synapse/trunk/scratch/yomsp2/src/org/apache/synapse/ruleEngines/XPathRuleEngine.java (original)
+++ incubator/synapse/trunk/scratch/yomsp2/src/org/apache/synapse/ruleEngines/XPathRuleEngine.java Mon Nov 14 02:51:41 2005
@@ -9,14 +9,15 @@
import org.apache.axis2.om.OMElement;
import org.apache.axis2.om.xpath.AXIOMXPath;
+import org.apache.synapse.Constants;
import org.apache.synapse.SynapseException;
import org.jaxen.JaxenException;
public class XPathRuleEngine extends OnceRuleEngine {
- private static final String XPATH_NS = "http://ws.apache.org/synapse/ns/xpathrule";
+
private static final QName XPATH_RULE_Q = new QName(
- XPATH_NS, "rule", "xpath");
- private static final QName XPATH_CONDITION_ATT_Q = new QName(XPATH_NS, "xpath");
+ Constants.SYNAPSE_NAMESPACE, "rule", "xpath");
+ private static final QName XPATH_CONDITION_ATT_Q = new QName("", "xpath");
public RuleCondition getRuleCondition(OMElement om) {
OMAttribute xpath=om.getAttribute(XPATH_CONDITION_ATT_Q);
---------------------------------------------------------------------
To unsubscribe, e-mail: synapse-dev-unsubscribe@ws.apache.org
For additional commands, e-mail: synapse-dev-help@ws.apache.org