Author: asankha
Date: Thu Nov  2 22:43:42 2006
New Revision: 470691

URL: http://svn.apache.org/viewvc?view=rev&rev=470691
Log:
Fix EndpointSerializer to handle references

Modified:
    
incubator/synapse/trunk/java/modules/core/src/org/apache/synapse/config/xml/EndpointSerializer.java
    
incubator/synapse/trunk/java/modules/core/src/org/apache/synapse/config/xml/FaultMediatorFactory.java

Modified: 
incubator/synapse/trunk/java/modules/core/src/org/apache/synapse/config/xml/EndpointSerializer.java
URL: 
http://svn.apache.org/viewvc/incubator/synapse/trunk/java/modules/core/src/org/apache/synapse/config/xml/EndpointSerializer.java?view=diff&rev=470691&r1=470690&r2=470691
==============================================================================
--- 
incubator/synapse/trunk/java/modules/core/src/org/apache/synapse/config/xml/EndpointSerializer.java
 (original)
+++ 
incubator/synapse/trunk/java/modules/core/src/org/apache/synapse/config/xml/EndpointSerializer.java
 Thu Nov  2 22:43:42 2006
@@ -57,35 +57,44 @@
     public static OMElement serializeEndpoint(Endpoint endpt, OMElement 
parent) {
 
         OMElement endpoint = fac.createOMElement("endpoint", synNS);
-        endpoint.addAttribute(fac.createOMAttribute(
-                "name", nullNS, endpt.getName()));
-        if (endpt.getAddress() != null) {
+
+        // is this an endpoint ref or an actual endpoint
+        if (endpt.getName() == null && endpt.getRef() != null) {
             endpoint.addAttribute(fac.createOMAttribute(
-                "address", nullNS, endpt.getAddress()));
+                "ref", nullNS, endpt.getRef()));
+            
         } else {
-            handleException("Invalid Endpoint. Address is required");
-        }
 
-        if (endpt.isAddressingOn()) {
-            endpoint.addChild(fac.createOMElement("enableAddressing", synNS));
-        }
+            endpoint.addAttribute(fac.createOMAttribute(
+                    "name", nullNS, endpt.getName()));
+            if (endpt.getAddress() != null) {
+                endpoint.addAttribute(fac.createOMAttribute(
+                    "address", nullNS, endpt.getAddress()));
+            } else {
+                handleException("Invalid Endpoint. Address is required");
+            }
+
+            if (endpt.isAddressingOn()) {
+                endpoint.addChild(fac.createOMElement("enableAddressing", 
synNS));
+            }
 
-        if (endpt.isReliableMessagingOn()) {
-            OMElement rm = fac.createOMElement("enableRM", synNS);
-            if (endpt.getWsRMPolicyKey() != null) {
-                rm.addAttribute(fac.createOMAttribute(
-                    "policy", nullNS, endpt.getWsRMPolicyKey()));
+            if (endpt.isReliableMessagingOn()) {
+                OMElement rm = fac.createOMElement("enableRM", synNS);
+                if (endpt.getWsRMPolicyKey() != null) {
+                    rm.addAttribute(fac.createOMAttribute(
+                        "policy", nullNS, endpt.getWsRMPolicyKey()));
+                }
+                endpoint.addChild(rm);
             }
-            endpoint.addChild(rm);
-        }
 
-        if (endpt.isSecurityOn()) {
-            OMElement sec = fac.createOMElement("enableSec", synNS);
-            if (endpt.getWsSecPolicyKey() != null) {
-                sec.addAttribute(fac.createOMAttribute(
-                    "policy", nullNS, endpt.getWsSecPolicyKey()));
+            if (endpt.isSecurityOn()) {
+                OMElement sec = fac.createOMElement("enableSec", synNS);
+                if (endpt.getWsSecPolicyKey() != null) {
+                    sec.addAttribute(fac.createOMAttribute(
+                        "policy", nullNS, endpt.getWsSecPolicyKey()));
+                }
+                endpoint.addChild(sec);
             }
-            endpoint.addChild(sec);
         }
 
         if (parent != null) {

Modified: 
incubator/synapse/trunk/java/modules/core/src/org/apache/synapse/config/xml/FaultMediatorFactory.java
URL: 
http://svn.apache.org/viewvc/incubator/synapse/trunk/java/modules/core/src/org/apache/synapse/config/xml/FaultMediatorFactory.java?view=diff&rev=470691&r1=470690&r2=470691
==============================================================================
--- 
incubator/synapse/trunk/java/modules/core/src/org/apache/synapse/config/xml/FaultMediatorFactory.java
 (original)
+++ 
incubator/synapse/trunk/java/modules/core/src/org/apache/synapse/config/xml/FaultMediatorFactory.java
 Thu Nov  2 22:43:42 2006
@@ -139,7 +139,7 @@
                 throw new SynapseException(msg);
             }
 
-        }else {
+        } else {
             String msg = "The fault reason is a required attribute for the 
makefault mediator";
             log.error(msg);
             throw new SynapseException(msg);



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

Reply via email to