axis-java-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ami...@apache.org
Subject svn commit: r819458 - in /webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2: deployment/util/Utils.java description/AxisService.java
Date Mon, 28 Sep 2009 06:27:26 GMT
Author: amilas
Date: Mon Sep 28 06:27:26 2009
New Revision: 819458

URL: http://svn.apache.org/viewvc?rev=819458&view=rev
Log:
introduce a new parameter called setEndpointsToAllUsedBindings. This parameter adds new endpoints
for all transports when the user has set
the useorignalwsdl to false but there is a wsdl file in the META-INF to generates the AxisService.
if this parameter sets then first it clear all the available endpoints and add available endpoints
to existing bindings

Modified:
    webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/deployment/util/Utils.java
    webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/description/AxisService.java

Modified: webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/deployment/util/Utils.java
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/deployment/util/Utils.java?rev=819458&r1=819457&r2=819458&view=diff
==============================================================================
--- webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/deployment/util/Utils.java
(original)
+++ webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/deployment/util/Utils.java
Mon Sep 28 06:27:26 2009
@@ -1069,6 +1069,50 @@
         }
     }
 
+    public static void setEndpointsToAllUsedBindings(AxisService axisService) {
+
+        Map<QName, AxisBinding> usedBindings = new HashMap<QName, AxisBinding>();
+        AxisBinding axisBinding = null;
+        for (AxisEndpoint axisEndpoint : axisService.getEndpoints().values()) {
+            axisBinding = axisEndpoint.getBinding();
+            if (!usedBindings.containsKey(axisBinding.getName())) {
+                usedBindings.put(axisBinding.getName(), axisBinding);
+            }
+        }
+
+        // now remove all existing end points
+        axisService.getEndpoints().clear();
+
+        // add new end points according to the available transports
+        List<String> availableTransports = new ArrayList<String>();
+        if (axisService.isEnableAllTransports()) {
+            AxisConfiguration axisConfiguration = axisService.getAxisConfiguration();
+            for (TransportInDescription transportIn : axisConfiguration.getTransportsIn().values())
{
+                availableTransports.add(transportIn.getName());
+            }
+        } else {
+            availableTransports = axisService.getExposedTransports();
+        }
+
+        // add an end point per service per transport description
+        for (AxisBinding usedAxisBinding : usedBindings.values()) {
+
+            for (String transportIn : availableTransports) {
+                String bindingType = usedAxisBinding.getType();
+                // for http bindings we can use only the http transport
+                if (WSDL2Constants.URI_WSDL2_HTTP.equals(bindingType) && !transportIn.startsWith("http")){
+                    continue;
+                }
+                AxisEndpoint axisEndpoint = new AxisEndpoint();
+                axisEndpoint.setName(axisService.getName() + transportIn + usedAxisBinding.getName().getLocalPart()
+ "Endpoint");
+                axisEndpoint.setBinding(usedAxisBinding);
+                axisEndpoint.setTransportInDescription(transportIn);
+                axisEndpoint.setParent(axisService);
+                axisService.addEndpoint(axisEndpoint.getName(), axisEndpoint);
+            }
+        }
+    }
+
     public static void addEndpointsToService(AxisService axisService,
                                              AxisConfiguration axisConfiguration) throws
AxisFault {
 

Modified: webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/description/AxisService.java
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/description/AxisService.java?rev=819458&r1=819457&r2=819458&view=diff
==============================================================================
--- webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/description/AxisService.java
(original)
+++ webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/description/AxisService.java
Mon Sep 28 06:27:26 2009
@@ -1328,12 +1328,33 @@
 			return;
 		}
 
+        if (isSetEndpointsToAllUsedBindings()) {
+            Utils.setEndpointsToAllUsedBindings(this);
+        }
+
 		// Otherwise, generate WSDL ourselves
 		String[] eprArray = requestIP == null ? new String[] { this.endpointName }
 				: calculateEPRs(requestIP);
 		getWSDL(out, eprArray);
 	}
 
+    /**
+     * users can use this parameter when they supply a wsdl file with the .aar file
+     * but wants to generate the endpoints for all available transports. here it assume
+     * that the user has not set the useOriginalwsdl
+     * @return
+     */
+	public boolean isSetEndpointsToAllUsedBindings() {
+		Parameter parameter = getParameter("setEndpointsToAllUsedBindings");
+		if (parameter != null) {
+			String value = (String) parameter.getValue();
+			if ("true".equals(value)) {
+				return true;
+			}
+		}
+		return false;
+	}
+
 	/**
 	 * Print the WSDL with a default URL. This will be called only during
 	 * codegen time.



Mime
View raw message