Author: ruwan
Date: Thu Mar 15 05:35:52 2007
New Revision: 518607

URL: http://svn.apache.org/viewvc?view=rev&rev=518607
Log:
Applying the patch of Kasun

Modified:
    
webservices/synapse/trunk/java/modules/core/src/main/java/org/apache/synapse/config/xml/XMLConfigurationBuilder.java
    
webservices/synapse/trunk/java/repository/conf/sample/resources/spring/synapse_spring_unittest.xml

Modified: 
webservices/synapse/trunk/java/modules/core/src/main/java/org/apache/synapse/config/xml/XMLConfigurationBuilder.java
URL: 
http://svn.apache.org/viewvc/webservices/synapse/trunk/java/modules/core/src/main/java/org/apache/synapse/config/xml/XMLConfigurationBuilder.java?view=diff&rev=518607&r1=518606&r2=518607
==============================================================================
--- 
webservices/synapse/trunk/java/modules/core/src/main/java/org/apache/synapse/config/xml/XMLConfigurationBuilder.java
 (original)
+++ 
webservices/synapse/trunk/java/modules/core/src/main/java/org/apache/synapse/config/xml/XMLConfigurationBuilder.java
 Thu Mar 15 05:35:52 2007
@@ -61,27 +61,34 @@
             definitions = new StAXOMBuilder(is).getDocumentElement();
             definitions.build();
 
-            Iterator iter = definitions.getChildren();
-
-            while (iter.hasNext()) {
-                Object o = iter.next();
-                if (o instanceof OMElement) {
-                    OMElement elt = (OMElement) o;
-                    if (Constants.SEQUENCE_ELT.equals(elt.getQName())) {
-                        defineSequence(config, elt);
-                    } else if (Constants.ENDPOINT_ELT.equals(elt.getQName())) {
-                        defineEndpoint(config, elt);
-                    } else if (Constants.ENTRY_ELT.equals(elt.getQName())) {
-                        defineEntry(config, elt);
-                    } else if (Constants.PROXY_ELT.equals(elt.getQName())) {
-                        defineProxy(config, elt);
-                    } else if (Constants.REGISTRY_ELT.equals(elt.getQName())) {
-                        defineRegistry(config, elt);
-                    } else {
-                        Mediator m = 
MediatorFactoryFinder.getInstance().getMediator(elt);
-                        rootSequence.addChild(m);
+            if 
(Constants.SYNAPSE_NAMESPACE.equals(definitions.getNamespace().getNamespaceURI())
+                && Constants.DEFINITIONS_ELT.getLocalPart()
+                    .equals(definitions.getQName().getLocalPart())) {
+
+                Iterator iter = definitions.getChildren();
+
+                while (iter.hasNext()) {
+                    Object o = iter.next();
+                    if (o instanceof OMElement) {
+                        OMElement elt = (OMElement) o;
+                        if (Constants.SEQUENCE_ELT.equals(elt.getQName())) {
+                            defineSequence(config, elt);
+                        } else if 
(Constants.ENDPOINT_ELT.equals(elt.getQName())) {
+                            defineEndpoint(config, elt);
+                        } else if (Constants.ENTRY_ELT.equals(elt.getQName())) 
{
+                            defineEntry(config, elt);
+                        } else if (Constants.PROXY_ELT.equals(elt.getQName())) 
{
+                            defineProxy(config, elt);
+                        } else if 
(Constants.REGISTRY_ELT.equals(elt.getQName())) {
+                            defineRegistry(config, elt);
+                        } else {
+                            Mediator m = 
MediatorFactoryFinder.getInstance().getMediator(elt);
+                            rootSequence.addChild(m);
+                        }
                     }
                 }
+            } else {
+                handleException("Invalid Synapse Configuration : No definition 
element found");
             }
 
         } catch (XMLStreamException e) {
@@ -153,7 +160,7 @@
                 handleException("Duplicate endpoint definition : " + name);
             }
             Endpoint endpoint =
-                
EndpointAbstractFactory.getEndpointFactroy(ele).createEndpoint(ele, false);
+                    
EndpointAbstractFactory.getEndpointFactroy(ele).createEndpoint(ele, false);
             config.addEndpoint(name, endpoint);
         } else {
             handleException("Invalid endpoint definition without a name");
@@ -163,6 +170,7 @@
     /**
      * Return the main sequence if one is not defined. This implementation 
defaults to
      * a simple sequence with a <send/>
+     *
      * @param config the configuration to be updated
      */
     private static void setDefaultMainSequence(SynapseConfiguration config) {
@@ -175,6 +183,7 @@
     /**
      * Return the fault sequence if one is not defined. This implementation 
defaults to
      * a simple sequence with a <log level="full"/>
+     *
      * @param config the configuration to be updated
      */
     private static void setDefaultFaultSequence(SynapseConfiguration config) {

Modified: 
webservices/synapse/trunk/java/repository/conf/sample/resources/spring/synapse_spring_unittest.xml
URL: 
http://svn.apache.org/viewvc/webservices/synapse/trunk/java/repository/conf/sample/resources/spring/synapse_spring_unittest.xml?view=diff&rev=518607&r1=518606&r2=518607
==============================================================================
--- 
webservices/synapse/trunk/java/repository/conf/sample/resources/spring/synapse_spring_unittest.xml
 (original)
+++ 
webservices/synapse/trunk/java/repository/conf/sample/resources/spring/synapse_spring_unittest.xml
 Thu Mar 15 05:35:52 2007
@@ -17,7 +17,7 @@
   ~  under the License.
   -->
 
-<synapse xmlns="http://ws.apache.org/ns/synapse"; 
xmlns:spring="http://ws.apache.org/ns/synapse/spring";>
+<definitions xmlns="http://ws.apache.org/ns/synapse"; 
xmlns:spring="http://ws.apache.org/ns/synapse/spring";>
 
        <registry provider="org.apache.synapse.registry.url.SimpleURLRegistry">
                <parameter name="root">file:./../../repository/</parameter>
@@ -29,4 +29,4 @@
        <spring:spring bean="springtest" 
key="conf/sample/resources/spring/springsample.xml"/>
        <spring:spring bean="springtest" key="springconfig2"/>
 
-</synapse> 
\ No newline at end of file
+</definitions> 
\ No newline at end of file



---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to