[wsas-java-dev] svn commit r9607 - branches/wsas/java/2.1/commons/wsdl-converter/src/main/java/org/wso2/tryit

svn at wso2.org svn at wso2.org
Fri Nov 9 00:32:40 PST 2007


Author: saminda
Date: Fri Nov  9 00:32:36 2007
New Revision: 9607

Modified:
   branches/wsas/java/2.1/commons/wsdl-converter/src/main/java/org/wso2/tryit/GenericAJAXClient.java
Log:
Giving user friendly names to created proxy services 


Modified: branches/wsas/java/2.1/commons/wsdl-converter/src/main/java/org/wso2/tryit/GenericAJAXClient.java
==============================================================================
--- branches/wsas/java/2.1/commons/wsdl-converter/src/main/java/org/wso2/tryit/GenericAJAXClient.java	(original)
+++ branches/wsas/java/2.1/commons/wsdl-converter/src/main/java/org/wso2/tryit/GenericAJAXClient.java	Fri Nov  9 00:32:36 2007
@@ -113,10 +113,8 @@
                 throw AxisFault.makeFault(e);
             }
             service = builder.populateService();
-            service.setName("TryItProxyService" + Long.toString(System.currentTimeMillis()));
-            AxisServiceGroup asg = new AxisServiceGroup(MessageContext.getCurrentMessageContext()
+            updateMockProxyServiceGroup(service, MessageContext.getCurrentMessageContext()
                     .getConfigurationContext().getAxisConfiguration());
-            service.setParent(asg);
             List exposeTxList = new ArrayList();
             exposeTxList.add("http");
             service.setExposedTransports(exposeTxList);
@@ -190,8 +188,6 @@
                 fileResourcesMap.put(htmlFileLocation.getUuid(),
                                      files1[0].getAbsoluteFile().getAbsolutePath());
             }
-            updateMockProxyServiceGroup(service, MessageContext.getCurrentMessageContext()
-                    .getConfigurationContext().getAxisConfiguration());
             return WSO2Constants.ContextPaths.DOWNLOAD_PATH + "?id=" + htmlFileLocation.getUuid();
         } catch (IOException e) {
             throw AxisFault.makeFault(e);
@@ -211,11 +207,11 @@
     private synchronized void updateMockProxyServiceGroup(AxisService axisService,
                                                           AxisConfiguration axisConfig)
             throws AxisFault {
-        axisService.addParameter("supportSingleOperation", Boolean.TRUE);
+        /*axisService.addParameter("supportSingleOperation", Boolean.TRUE);
         AxisOperation singleOP = new InOutAxisOperation(new QName("invokeTryItProxyService"));
         singleOP.setDocumentation("This operation is a 'passthrough' for all operations in " +
                                   " TryIt proxy service.");
-        axisService.addOperation(singleOP);
+        axisService.addOperation(singleOP);*/
         ProxyMessageReceiver receiver = new ProxyMessageReceiver();
         PhasesInfo phaseInfo = axisConfig.getPhasesInfo();
         for (Iterator i = axisService.getOperations(); i.hasNext();) {
@@ -230,6 +226,18 @@
                 serviceGroup = new AxisServiceGroup();
                 serviceGroup.setServiceGroupName(TRYIT_SG_NAME);
             }
+            
+            // resolving Axis service name conflicts.
+            AxisService testService = axisConfig.getService(axisService.getName());
+            if (testService != null) {
+                for (int loop = 1 ; ;loop++) {
+                    String testName = axisService.getName() + "_" + loop;
+                    if (axisConfig.getService(testName) == null) {
+                        axisService.setName(testName);
+                        break;
+                    }
+                }
+            }
             serviceGroup.addService(axisService);
             axisConfig.addServiceGroup(serviceGroup);
             axisService.addParameter(LAST_TOUCH_TIME, new Long(System.currentTimeMillis()));




More information about the Wsas-java-dev mailing list