You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@synapse.apache.org by ru...@apache.org on 2010/08/16 11:07:11 UTC

svn commit: r985834 - in /synapse/trunk/java/modules/core/src/main/java/org/apache/synapse/config/xml: MultiXMLConfigurationBuilder.java SynapseXMLConfigurationFactory.java

Author: ruwan
Date: Mon Aug 16 09:07:10 2010
New Revision: 985834

URL: http://svn.apache.org/viewvc?rev=985834&view=rev
Log:
Getting rid of the top level mediators in the synapse configuration being treated as main sequence

Modified:
    synapse/trunk/java/modules/core/src/main/java/org/apache/synapse/config/xml/MultiXMLConfigurationBuilder.java
    synapse/trunk/java/modules/core/src/main/java/org/apache/synapse/config/xml/SynapseXMLConfigurationFactory.java

Modified: synapse/trunk/java/modules/core/src/main/java/org/apache/synapse/config/xml/MultiXMLConfigurationBuilder.java
URL: http://svn.apache.org/viewvc/synapse/trunk/java/modules/core/src/main/java/org/apache/synapse/config/xml/MultiXMLConfigurationBuilder.java?rev=985834&r1=985833&r2=985834&view=diff
==============================================================================
--- synapse/trunk/java/modules/core/src/main/java/org/apache/synapse/config/xml/MultiXMLConfigurationBuilder.java (original)
+++ synapse/trunk/java/modules/core/src/main/java/org/apache/synapse/config/xml/MultiXMLConfigurationBuilder.java Mon Aug 16 09:07:10 2010
@@ -51,6 +51,7 @@ import java.io.*;
  *  <li>CONF_HOME/local-entries</li>
  *  <li>CONF_HOME/tasks</li>
  *  <li>CONF_HOME/event-sources</li>
+ *  <li>CONF_HOME/priorityExecutors</li>
  * </ul>
  *
  * Each of these directories will house a set of XML files. Each file will define exactly
@@ -99,7 +100,7 @@ public class MultiXMLConfigurationBuilde
             synapseConfig.setDefaultQName(XMLConfigConstants.DEFINITIONS_ELT);
         } else if (log.isDebugEnabled()) {
             log.debug("Found a synapse configuration in the " + SynapseConstants.SYNAPSE_XML
-                    + " file at the artifact repository root, which gets the presedence "
+                    + " file at the artifact repository root, which gets the precedence "
                     + "over other definitions");
         }
 

Modified: synapse/trunk/java/modules/core/src/main/java/org/apache/synapse/config/xml/SynapseXMLConfigurationFactory.java
URL: http://svn.apache.org/viewvc/synapse/trunk/java/modules/core/src/main/java/org/apache/synapse/config/xml/SynapseXMLConfigurationFactory.java?rev=985834&r1=985833&r2=985834&view=diff
==============================================================================
--- synapse/trunk/java/modules/core/src/main/java/org/apache/synapse/config/xml/SynapseXMLConfigurationFactory.java (original)
+++ synapse/trunk/java/modules/core/src/main/java/org/apache/synapse/config/xml/SynapseXMLConfigurationFactory.java Mon Aug 16 09:07:10 2010
@@ -57,14 +57,7 @@ public class SynapseXMLConfigurationFact
         SynapseConfiguration config = SynapseConfigUtils.newConfiguration();               
         config.setDefaultQName(definitions.getQName());
 
-        SequenceMediator rootSequence = new SequenceMediator();
-        rootSequence.setName(org.apache.synapse.SynapseConstants.MAIN_SEQUENCE_KEY);
-
-        // aspect configuration
-        AspectConfiguration configuration = new AspectConfiguration(rootSequence.getName());
-        rootSequence.configure(configuration);
         Iterator iter = definitions.getChildren();
-
         while (iter.hasNext()) {
             Object o = iter.next();
             if (o instanceof OMElement) {
@@ -72,10 +65,9 @@ public class SynapseXMLConfigurationFact
                 if (XMLConfigConstants.SEQUENCE_ELT.equals(elt.getQName())) {
                     String key = elt.getAttributeValue(
                             new QName(XMLConfigConstants.NULL_NAMESPACE, "key"));
-                    // this could be a sequence def or a mediator of the main sequence
+                    // this could be a sequence def or a referred sequence
                     if (key != null) {
-                        Mediator m = MediatorFactoryFinder.getInstance().getMediator(elt);
-                        rootSequence.addChild(m);
+                        handleException("Referred sequences are not allowed at the top level");
                     } else {
                         defineSequence(config, elt);
                     }
@@ -94,27 +86,13 @@ public class SynapseXMLConfigurationFact
                 } else if (StartupFinder.getInstance().isStartup(elt.getQName())) {
                     defineStartup(config, elt);
                 } else {
-                    Mediator m = MediatorFactoryFinder.getInstance().getMediator(elt);
-                    rootSequence.addChild(m);
+                    handleException("Invalid configuration element at the top level, one of \'sequence\', " +
+                            "\'endpoint\', \'proxy\', \'eventSource\', \'localEntry\', \'priorityExecutor\' " +
+                            "or \'registry\' is expected");
                 }
             }
         }
 
-        // if there is no sequence named main defined locally look for the set of mediators in
-        // the root level before trying to look in the registry (hence config.getMainSequence
-        // can not be used here)
-        if (!config.getLocalRegistry().containsKey(SynapseConstants.MAIN_SEQUENCE_KEY)) {
-            // if the root tag contains child mediators & registry does not have an
-            // entry with key 'main' then set as main sequence
-            if (!rootSequence.getList().isEmpty() && config.getMainSequence() == null) {
-                config.addSequence(rootSequence.getName(), rootSequence);
-            }
-        } else if (!rootSequence.getList().isEmpty()) {
-            handleException("Invalid Synapse Configuration : Conflict in resolving the \"main\" " +
-                    "mediator\n\tSynapse Configuration cannot have sequence named \"main\" and " +
-                    "toplevel mediators simultaniously");
-        }
-
         return config;
     }