You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@synapse.apache.org by as...@apache.org on 2006/10/27 09:59:35 UTC

svn commit: r468308 - in /incubator/synapse/trunk/java/modules/core/src/org/apache/synapse: config/xml/ProxyServiceFactory.java config/xml/ProxyServiceSerializer.java core/axis2/ProxyService.java

Author: asankha
Date: Fri Oct 27 00:59:34 2006
New Revision: 468308

URL: http://svn.apache.org/viewvc?view=rev&rev=468308
Log:
Commiting for ruwan


Modified:
    incubator/synapse/trunk/java/modules/core/src/org/apache/synapse/config/xml/ProxyServiceFactory.java
    incubator/synapse/trunk/java/modules/core/src/org/apache/synapse/config/xml/ProxyServiceSerializer.java
    incubator/synapse/trunk/java/modules/core/src/org/apache/synapse/core/axis2/ProxyService.java

Modified: incubator/synapse/trunk/java/modules/core/src/org/apache/synapse/config/xml/ProxyServiceFactory.java
URL: http://svn.apache.org/viewvc/incubator/synapse/trunk/java/modules/core/src/org/apache/synapse/config/xml/ProxyServiceFactory.java?view=diff&rev=468308&r1=468307&r2=468308
==============================================================================
--- incubator/synapse/trunk/java/modules/core/src/org/apache/synapse/config/xml/ProxyServiceFactory.java (original)
+++ incubator/synapse/trunk/java/modules/core/src/org/apache/synapse/config/xml/ProxyServiceFactory.java Fri Oct 27 00:59:34 2006
@@ -26,6 +26,8 @@
 import java.net.MalformedURLException;
 import java.net.URL;
 import java.util.Iterator;
+import java.util.StringTokenizer;
+import java.util.ArrayList;
 
 /**
  * Creates a ProxyService instance using the XML fragment specification
@@ -55,14 +57,22 @@
             proxy.setName(name.getAttributeValue());
         }
 
-        OMAttribute desc = elem.getAttribute(new QName(Constants.NULL_NAMESPACE, "description"));
-        if (desc != null) {
-            proxy.setDescription(desc.getAttributeValue());
-        }
-
         OMAttribute trans = elem.getAttribute(new QName(Constants.NULL_NAMESPACE, "transports"));
         if (trans != null) {
-            proxy.setTransports(trans.getAttributeValue());
+            String transports = trans.getAttributeValue();
+            if (transports == null || ProxyService.ALL_TRANSPORTS.equals(transports)) {
+                        // default to all transports using service name as destination
+            } else {
+                StringTokenizer st = new StringTokenizer(transports, " ,");
+                ArrayList transportList = new ArrayList();
+                while(st.hasMoreTokens()) {
+                    String token = st.nextToken();
+                    if(token.length() != 0) {
+                        transportList.add(token);
+                    }
+                }
+                proxy.setTransports(transportList);
+            }
         }
 
         // read definition of the target of this proxy service. The target could be an 'endpoint'

Modified: incubator/synapse/trunk/java/modules/core/src/org/apache/synapse/config/xml/ProxyServiceSerializer.java
URL: http://svn.apache.org/viewvc/incubator/synapse/trunk/java/modules/core/src/org/apache/synapse/config/xml/ProxyServiceSerializer.java?view=diff&rev=468308&r1=468307&r2=468308
==============================================================================
--- incubator/synapse/trunk/java/modules/core/src/org/apache/synapse/config/xml/ProxyServiceSerializer.java (original)
+++ incubator/synapse/trunk/java/modules/core/src/org/apache/synapse/config/xml/ProxyServiceSerializer.java Fri Oct 27 00:59:34 2006
@@ -25,6 +25,7 @@
 import org.apache.synapse.core.axis2.ProxyService;
 
 import java.util.Iterator;
+import java.util.ArrayList;
 
 /**
  * <proxy name="string" [description="string"] [transports="(http|https|jms)+|all"]>
@@ -60,10 +61,13 @@
                 "description", nullNS, service.getDescription()));
         }
 
-        if (service.getTransports() != null &&
-            !ProxyService.ALL_TRANSPORTS.equals(service.getTransports())) {
-            proxy.addAttribute(fac.createOMAttribute(
-                "transports", nullNS, service.getTransports()));
+        if (service.getTransports() != null && service.getTransports().size() != 0) {
+            ArrayList transports = service.getTransports();
+            String transportStr = "" + transports.get(0);
+            for(int i = 1; i < transports.size(); i++) {
+                transportStr = transportStr + " " + transports.get(i);
+            }
+            proxy.addAttribute(fac.createOMAttribute("transports", nullNS, transportStr));
         }
 
         if (service.getTargetEndpoint() != null) {

Modified: incubator/synapse/trunk/java/modules/core/src/org/apache/synapse/core/axis2/ProxyService.java
URL: http://svn.apache.org/viewvc/incubator/synapse/trunk/java/modules/core/src/org/apache/synapse/core/axis2/ProxyService.java?view=diff&rev=468308&r1=468307&r2=468308
==============================================================================
--- incubator/synapse/trunk/java/modules/core/src/org/apache/synapse/core/axis2/ProxyService.java (original)
+++ incubator/synapse/trunk/java/modules/core/src/org/apache/synapse/core/axis2/ProxyService.java Fri Oct 27 00:59:34 2006
@@ -58,7 +58,8 @@
     /** The proxy service description */
     private String description;
     /** The transport/s over which this service should be exposed */
-    private String transports;
+    //private String transports;
+    private ArrayList transports;
     /** The target endpoint, if assigned */
     private String targetEndpoint = null;
     /** The target sequence, if assigned */
@@ -144,15 +145,10 @@
         // process transports and expose over requested transports. If none
         // is specified, default to all transports using service name as
         // destination
-        if (transports == null || ALL_TRANSPORTS.equals(transports)) {
+        if (transports == null || transports.size() == 0) {
             // default to all transports using service name as destination
         } else {
-            StringTokenizer st = new StringTokenizer(transports, " ");
-            ArrayList transportList = new ArrayList();
-            for (int i=0; i<st.countTokens(); i++) {
-                transportList.add(st.nextToken());
-            }
-            proxyService.setExposedTransports(transportList);
+            proxyService.setExposedTransports(transports);
         }
 
         // process parameters
@@ -251,8 +247,8 @@
         this.description = description;
     }
 
-    public String getTransports() {
-        return transports != null ? transports : ALL_TRANSPORTS;
+    public ArrayList getTransports() {
+        return transports;
     }
 
     public void addProperty(String name, String value) {
@@ -263,7 +259,7 @@
         return this.properties;
     }
 
-    public void setTransports(String transports) {
+    public void setTransports(ArrayList transports) {
         this.transports = transports;
     }
 



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