You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@synapse.apache.org by de...@apache.org on 2005/11/01 12:03:54 UTC

svn commit: r330023 - in /incubator/synapse/trunk/scratch/prototype1/src/org/apache/synapse: engine/SynapseDeployer.java engine/SynapseEngine.java engine/dispatchers/SynpaseDispatcher.java rule/Rule.java rule/RuleExecutor.java

Author: deepal
Date: Tue Nov  1 03:03:38 2005
New Revision: 330023

URL: http://svn.apache.org/viewcvs?rev=330023&view=rev
Log:
1. Removed AxisConfig reference from Rule 
2. Modified SynapseEngine to keep ConfigurationContext

Modified:
    incubator/synapse/trunk/scratch/prototype1/src/org/apache/synapse/engine/SynapseDeployer.java
    incubator/synapse/trunk/scratch/prototype1/src/org/apache/synapse/engine/SynapseEngine.java
    incubator/synapse/trunk/scratch/prototype1/src/org/apache/synapse/engine/dispatchers/SynpaseDispatcher.java
    incubator/synapse/trunk/scratch/prototype1/src/org/apache/synapse/rule/Rule.java
    incubator/synapse/trunk/scratch/prototype1/src/org/apache/synapse/rule/RuleExecutor.java

Modified: incubator/synapse/trunk/scratch/prototype1/src/org/apache/synapse/engine/SynapseDeployer.java
URL: http://svn.apache.org/viewcvs/incubator/synapse/trunk/scratch/prototype1/src/org/apache/synapse/engine/SynapseDeployer.java?rev=330023&r1=330022&r2=330023&view=diff
==============================================================================
--- incubator/synapse/trunk/scratch/prototype1/src/org/apache/synapse/engine/SynapseDeployer.java (original)
+++ incubator/synapse/trunk/scratch/prototype1/src/org/apache/synapse/engine/SynapseDeployer.java Tue Nov  1 03:03:38 2005
@@ -1,21 +1,21 @@
 package org.apache.synapse.engine;
 
-import org.apache.axis2.om.OMFactory;
 import org.apache.axis2.om.OMAbstractFactory;
-import org.apache.axis2.om.OMElement;
 import org.apache.axis2.om.OMAttribute;
+import org.apache.axis2.om.OMElement;
+import org.apache.axis2.om.OMFactory;
 import org.apache.axis2.om.impl.llom.builder.StAXOMBuilder;
 import org.apache.synapse.SynapseConstants;
 import org.apache.synapse.SynapseException;
 
+import javax.xml.namespace.QName;
 import javax.xml.stream.XMLInputFactory;
-import javax.xml.stream.XMLStreamReader;
 import javax.xml.stream.XMLStreamException;
-import javax.xml.namespace.QName;
+import javax.xml.stream.XMLStreamReader;
 import java.io.File;
-import java.io.InputStream;
 import java.io.FileInputStream;
 import java.io.FileNotFoundException;
+import java.io.InputStream;
 import java.util.Iterator;
 /*
 * Copyright 2004,2005 The Apache Software Foundation.
@@ -44,8 +44,8 @@
         this.synpseConfig = synpseConfig;
     }
 
-    public SynapseConfiguration populteConfig() throws SynapseException{
-        SynapseConfiguration synConfig = new  SynapseConfiguration();
+    public SynapseConfiguration populteConfig() throws SynapseException {
+        SynapseConfiguration synConfig = new SynapseConfiguration();
         try {
             InputStream in = new FileInputStream(synpseConfig);
             XMLStreamReader xmlReader =
@@ -57,43 +57,43 @@
             Iterator disElements = element.getChildrenWithName(new QName(SynapseConstants.DIRECTION_IN));
             while (disElements.hasNext()) {
                 OMElement omElement = (OMElement) disElements.next();
-                OMAttribute nameatt =   omElement.getAttribute(new QName("name"));
-                if(nameatt !=null){
-                    if(SynapseConstants.DIRECTION_IN.equals(nameatt.getAttributeValue())){
+                OMAttribute nameatt = omElement.getAttribute(new QName("name"));
+                if (nameatt != null) {
+                    if (SynapseConstants.DIRECTION_IN.equals(nameatt.getAttributeValue())) {
                         Iterator rulitr = omElement.getChildrenWithName(new QName("ruleSet"));
                         while (rulitr.hasNext()) {
                             OMElement rulset = (OMElement) rulitr.next();
                             OMAttribute stageAtt = rulset.getAttribute(new QName("stage"));
-                            if(stageAtt != null){
+                            if (stageAtt != null) {
                                 String satge = stageAtt.getAttributeValue();
-                                if(SynapseConstants.STAGE_IN.equals(satge)){
+                                if (SynapseConstants.STAGE_IN.equals(satge)) {
                                     synConfig.setIncomingPreStageRuleSet(rulset);
-                                } else if(SynapseConstants.STAGE_PROCESS.equals(satge)){
+                                } else if (SynapseConstants.STAGE_PROCESS.equals(satge)) {
                                     synConfig.setIncomingProcessingStageRuleSet(rulset);
-                                } else if (SynapseConstants.STAGE_OUT.equals(satge)){
+                                } else if (SynapseConstants.STAGE_OUT.equals(satge)) {
                                     synConfig.setIncomingPostStageRuleSet(rulset);
                                 }
                             }
                         }
-                    }   else if(SynapseConstants.DIRECTION_OUT.equals(nameatt.getAttributeValue())){
+                    } else if (SynapseConstants.DIRECTION_OUT.equals(nameatt.getAttributeValue())) {
                         Iterator rulitr = omElement.getChildrenWithName(new QName("ruleSet"));
                         while (rulitr.hasNext()) {
                             OMElement rulset = (OMElement) rulitr.next();
                             OMAttribute stageAtt = rulset.getAttribute(new QName("stage"));
-                            if(stageAtt != null){
+                            if (stageAtt != null) {
                                 String satge = stageAtt.getAttributeValue();
-                                if(SynapseConstants.STAGE_IN.equals(satge)){
+                                if (SynapseConstants.STAGE_IN.equals(satge)) {
                                     synConfig.setOutgoingPreStageRuleSet(rulset);
-                                } else if(SynapseConstants.STAGE_PROCESS.equals(satge)){
+                                } else if (SynapseConstants.STAGE_PROCESS.equals(satge)) {
                                     synConfig.setOutgoingProcessingStageRuleSet(rulset);
-                                } else if (SynapseConstants.STAGE_OUT.equals(satge)){
+                                } else if (SynapseConstants.STAGE_OUT.equals(satge)) {
                                     synConfig.setOutgoingPostStageRuleSet(rulset);
                                 }
                             }
                         }
                     }
-                }   else {
-                    throw new SynapseException("direction name requird") ;
+                } else {
+                    throw new SynapseException("direction name requird");
                 }
             }
         } catch (FileNotFoundException e) {

Modified: incubator/synapse/trunk/scratch/prototype1/src/org/apache/synapse/engine/SynapseEngine.java
URL: http://svn.apache.org/viewcvs/incubator/synapse/trunk/scratch/prototype1/src/org/apache/synapse/engine/SynapseEngine.java?rev=330023&r1=330022&r2=330023&view=diff
==============================================================================
--- incubator/synapse/trunk/scratch/prototype1/src/org/apache/synapse/engine/SynapseEngine.java (original)
+++ incubator/synapse/trunk/scratch/prototype1/src/org/apache/synapse/engine/SynapseEngine.java Tue Nov  1 03:03:38 2005
@@ -1,11 +1,12 @@
 package org.apache.synapse.engine;
 
 import org.apache.axis2.AxisFault;
+import org.apache.axis2.context.MessageContext;
+import org.apache.axis2.context.ConfigurationContext;
 import org.apache.axis2.description.AxisService;
 import org.apache.axis2.description.AxisServiceGroup;
 import org.apache.axis2.engine.AxisConfiguration;
 import org.apache.axis2.engine.AxisConfigurationImpl;
-import org.apache.axis2.context.MessageContext;
 import org.apache.axis2.om.OMAttribute;
 import org.apache.axis2.om.OMElement;
 import org.apache.axis2.transport.TransportSender;
@@ -31,6 +32,7 @@
     private RuleSelector outgoingPostStageRuleSelector;
 
     private AxisConfiguration axisConfig;
+    private ConfigurationContext configContxt;
     private AxisServiceGroup mediatorServiceGroup;
 
     /**
@@ -40,6 +42,7 @@
             throws SynapseException {
         //todo : Deepal , the axisConfiguartion creation has to be improevd
         axisConfig = new AxisConfigurationImpl();
+        configContxt = new ConfigurationContext(axisConfig);
         mediatorServiceGroup = new AxisServiceGroup(axisConfig);
         mediatorServiceGroup.setServiceGroupName("mediator_service_group");
         incomingPreStageRuleSelector = createRuleSelector(
@@ -165,7 +168,7 @@
         Iterator inStageRulesIter = ruleSelector.match(messageContext);
         while (inStageRulesIter.hasNext() && proceed) {
             rule = (Rule) inStageRulesIter.next();
-            proceed = RuleExecutor.execute(rule, messageContext);
+            proceed = RuleExecutor.execute(rule, messageContext,configContxt);
         }
     }
 
@@ -210,7 +213,7 @@
         Rule rule;
         while (proceed && (rule = ruleSelector
                 .getBestMatch(messageContext)) != null) {
-            proceed = RuleExecutor.execute(rule, messageContext);
+            proceed = RuleExecutor.execute(rule, messageContext,configContxt);
         }
     }
 

Modified: incubator/synapse/trunk/scratch/prototype1/src/org/apache/synapse/engine/dispatchers/SynpaseDispatcher.java
URL: http://svn.apache.org/viewcvs/incubator/synapse/trunk/scratch/prototype1/src/org/apache/synapse/engine/dispatchers/SynpaseDispatcher.java?rev=330023&r1=330022&r2=330023&view=diff
==============================================================================
--- incubator/synapse/trunk/scratch/prototype1/src/org/apache/synapse/engine/dispatchers/SynpaseDispatcher.java (original)
+++ incubator/synapse/trunk/scratch/prototype1/src/org/apache/synapse/engine/dispatchers/SynpaseDispatcher.java Tue Nov  1 03:03:38 2005
@@ -1,12 +1,11 @@
 package org.apache.synapse.engine.dispatchers;
 
-import org.apache.axis2.engine.AbstractDispatcher;
-import org.apache.axis2.description.HandlerDescription;
-import org.apache.axis2.description.Parameter;
-import org.apache.axis2.description.AxisService;
-import org.apache.axis2.description.AxisOperation;
-import org.apache.axis2.context.MessageContext;
 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.synapse.SynapseConstants;
 
 import javax.xml.namespace.QName;
@@ -47,7 +46,7 @@
     }
 
     public AxisOperation findOperation(AxisService service,
-                                              MessageContext messageContext) throws AxisFault {
+                                       MessageContext messageContext) throws AxisFault {
         return service.getOperation(SynapseConstants.SYNAPSE_OPERATION);
     }
 

Modified: incubator/synapse/trunk/scratch/prototype1/src/org/apache/synapse/rule/Rule.java
URL: http://svn.apache.org/viewcvs/incubator/synapse/trunk/scratch/prototype1/src/org/apache/synapse/rule/Rule.java?rev=330023&r1=330022&r2=330023&view=diff
==============================================================================
--- incubator/synapse/trunk/scratch/prototype1/src/org/apache/synapse/rule/Rule.java (original)
+++ incubator/synapse/trunk/scratch/prototype1/src/org/apache/synapse/rule/Rule.java Tue Nov  1 03:03:38 2005
@@ -9,7 +9,6 @@
 public class Rule {
 
     private Mediator[] mediators;
-    private AxisConfiguration axisConfig;
     private List qosModules;
     private String name;
 
@@ -21,15 +20,6 @@
 
         this.mediators = mediators;
     }
-
-    public AxisConfiguration getAxisConfig() {
-        return axisConfig;
-    }
-
-    public void setAxisConfig(AxisConfiguration axisConfig) {
-        this.axisConfig = axisConfig;
-    }
-
     public List getQosModules() {
         return qosModules;
     }

Modified: incubator/synapse/trunk/scratch/prototype1/src/org/apache/synapse/rule/RuleExecutor.java
URL: http://svn.apache.org/viewcvs/incubator/synapse/trunk/scratch/prototype1/src/org/apache/synapse/rule/RuleExecutor.java?rev=330023&r1=330022&r2=330023&view=diff
==============================================================================
--- incubator/synapse/trunk/scratch/prototype1/src/org/apache/synapse/rule/RuleExecutor.java (original)
+++ incubator/synapse/trunk/scratch/prototype1/src/org/apache/synapse/rule/RuleExecutor.java Tue Nov  1 03:03:38 2005
@@ -15,10 +15,8 @@
 
 public class RuleExecutor {
     // this should get a mediator and should invoke it with an AxisEngine
-    public static boolean execute(Rule rule, MessageContext messageContext) throws SynapseException {
+    public static boolean execute(Rule rule, MessageContext messageContext,ConfigurationContext configurationContext) throws SynapseException {
         try {
-            ConfigurationContext configurationContext = new ConfigurationContext(
-                    rule.getAxisConfig());
             AxisEngine engine = new AxisEngine(configurationContext);
             MessageContext newMessageContext = copyMessageContext(messageContext,
                     configurationContext);



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