[Carbon-dev] svn commit r31330 - in trunk/carbon-components/jar-services: org.wso2.carbon.jarservices.ui/src/main/java/org/wso2/carbon/jarservices/ui/fileupload org.wso2.carbon.jarservices.ui/src/main/resources org.wso2.carbon.jarservices.ui/src/main/resources/org/wso2/carbon/jarservices/ui/i18n org.wso2.carbon.jarservices.ui/src/main/resources/web/jarservices org.wso2.carbon.jarservices/src/main/java/org/wso2/carbon/jarservices

azeez at wso2.com azeez at wso2.com
Mon Feb 23 07:52:38 PST 2009


Author: azeez
Date: Mon Feb 23 07:52:36 2009
New Revision: 31330
URL: http://wso2.org/svn/browse/wso2?view=rev&revision=31330

Log:
More improvements to Jar services

Added:
   trunk/carbon-components/jar-services/org.wso2.carbon.jarservices/src/main/java/org/wso2/carbon/jarservices/DuplicateServiceException.java
   trunk/carbon-components/jar-services/org.wso2.carbon.jarservices/src/main/java/org/wso2/carbon/jarservices/Operation.java
      - copied, changed from r31246, /trunk/carbon-components/jar-services/org.wso2.carbon.jarservices/src/main/java/org/wso2/carbon/jarservices/MethodData.java
   trunk/carbon-components/jar-services/org.wso2.carbon.jarservices/src/main/java/org/wso2/carbon/jarservices/Service.java
      - copied, changed from r31246, /trunk/carbon-components/jar-services/org.wso2.carbon.jarservices/src/main/java/org/wso2/carbon/jarservices/ClassMethodsData.java
Removed:
   trunk/carbon-components/jar-services/org.wso2.carbon.jarservices/src/main/java/org/wso2/carbon/jarservices/ClassMethodsData.java
   trunk/carbon-components/jar-services/org.wso2.carbon.jarservices/src/main/java/org/wso2/carbon/jarservices/MethodData.java
Modified:
   trunk/carbon-components/jar-services/org.wso2.carbon.jarservices.ui/src/main/java/org/wso2/carbon/jarservices/ui/fileupload/JarServiceAdminClient.java
   trunk/carbon-components/jar-services/org.wso2.carbon.jarservices.ui/src/main/java/org/wso2/carbon/jarservices/ui/fileupload/Utils.java
   trunk/carbon-components/jar-services/org.wso2.carbon.jarservices.ui/src/main/resources/JarServiceCreatorAdmin.wsdl
   trunk/carbon-components/jar-services/org.wso2.carbon.jarservices.ui/src/main/resources/org/wso2/carbon/jarservices/ui/i18n/Resources.properties
   trunk/carbon-components/jar-services/org.wso2.carbon.jarservices.ui/src/main/resources/web/jarservices/finish.jsp
   trunk/carbon-components/jar-services/org.wso2.carbon.jarservices.ui/src/main/resources/web/jarservices/list_classes.jsp
   trunk/carbon-components/jar-services/org.wso2.carbon.jarservices.ui/src/main/resources/web/jarservices/list_methods.jsp
   trunk/carbon-components/jar-services/org.wso2.carbon.jarservices/src/main/java/org/wso2/carbon/jarservices/JarServiceCreatorAdmin.java
   trunk/carbon-components/jar-services/org.wso2.carbon.jarservices/src/main/java/org/wso2/carbon/jarservices/UploadArtifactsResponse.java

Modified: trunk/carbon-components/jar-services/org.wso2.carbon.jarservices.ui/src/main/java/org/wso2/carbon/jarservices/ui/fileupload/JarServiceAdminClient.java
URL: http://wso2.org/svn/browse/wso2/trunk/carbon-components/jar-services/org.wso2.carbon.jarservices.ui/src/main/java/org/wso2/carbon/jarservices/ui/fileupload/JarServiceAdminClient.java?rev=31330&r1=31329&r2=31330&view=diff
==============================================================================
--- trunk/carbon-components/jar-services/org.wso2.carbon.jarservices.ui/src/main/java/org/wso2/carbon/jarservices/ui/fileupload/JarServiceAdminClient.java	(original)
+++ trunk/carbon-components/jar-services/org.wso2.carbon.jarservices.ui/src/main/java/org/wso2/carbon/jarservices/ui/fileupload/JarServiceAdminClient.java	Mon Feb 23 07:52:36 2009
@@ -10,9 +10,7 @@
 import org.wso2.carbon.jarservices.ui.JarServiceCreatorAdminStub;
 import org.wso2.carbon.jarservices.ui.types.UploadArtifactsResponse;
 import org.wso2.carbon.jarservices.ui.types.Resource;
-import org.wso2.carbon.jarservices.ui.types.ClassMethodsData;
-
-import java.rmi.RemoteException;
+import org.wso2.carbon.jarservices.ui.types.Service;
 
 public class JarServiceAdminClient {
     private static final Log log = LogFactory.getLog(JarServiceAdminClient.class);
@@ -40,7 +38,7 @@
         }
     }
 
-    public ClassMethodsData[] getClassMethods(String directoryPath, String[] classes) throws Exception {
+    public Service[] getClassMethods(String directoryPath, Service[] classes) throws Exception {
         try {
             return stub.getClassMethods(directoryPath, classes);
         } catch (Exception e) {
@@ -50,7 +48,7 @@
         }
     }
 
-    public void createAndDeployService(String directoryPath, ClassMethodsData[] methods) throws Exception {
+    public void createAndDeployService(String directoryPath, Service[] methods) throws Exception {
         try {
             stub.createAndDeployService(directoryPath, methods);
         } catch (Exception e) {

Modified: trunk/carbon-components/jar-services/org.wso2.carbon.jarservices.ui/src/main/java/org/wso2/carbon/jarservices/ui/fileupload/Utils.java
URL: http://wso2.org/svn/browse/wso2/trunk/carbon-components/jar-services/org.wso2.carbon.jarservices.ui/src/main/java/org/wso2/carbon/jarservices/ui/fileupload/Utils.java?rev=31330&r1=31329&r2=31330&view=diff
==============================================================================
--- trunk/carbon-components/jar-services/org.wso2.carbon.jarservices.ui/src/main/java/org/wso2/carbon/jarservices/ui/fileupload/Utils.java	(original)
+++ trunk/carbon-components/jar-services/org.wso2.carbon.jarservices.ui/src/main/java/org/wso2/carbon/jarservices/ui/fileupload/Utils.java	Mon Feb 23 07:52:36 2009
@@ -15,8 +15,8 @@
  */
 package org.wso2.carbon.jarservices.ui.fileupload;
 
-import org.wso2.carbon.jarservices.ui.types.ClassMethodsData;
-import org.wso2.carbon.jarservices.ui.types.MethodData;
+import org.wso2.carbon.jarservices.ui.types.Service;
+import org.wso2.carbon.jarservices.ui.types.Operation;
 
 import javax.servlet.http.HttpServletRequest;
 import java.util.List;
@@ -28,31 +28,50 @@
  *
  */
 public class Utils {
-    public static ClassMethodsData[] getClassMethodsFromRequest(HttpServletRequest request) {
-        Map<String, List<MethodData>> items = new HashMap<String, List<MethodData>>();
-        String[] classes = request.getParameterValues("method");
-        for (String clazz : classes) {
-            String[] strings = clazz.split("#");
-            List<MethodData> dataList = items.get(strings[0]);
+    public static Service[] getServices2(HttpServletRequest request, String paramName) {
+        Map<String, List<Operation>> items = new HashMap<String, List<Operation>>();
+        List<String> serviceNames = new ArrayList<String>();
+        String[] methods = request.getParameterValues(paramName);
+        for (String method : methods) {
+            String[] strings = method.split("#");
+            List<Operation> dataList = items.get(strings[0]);
             if (dataList == null) {
-                dataList = new ArrayList<MethodData>();
+                dataList = new ArrayList<Operation>();
             }
             items.put(strings[0], dataList);
-            if (strings.length == 2) {
-                MethodData methodData = new MethodData();
-                methodData.setMethodName(strings[1]);
-                dataList.add(methodData);
+            serviceNames.add(strings[1]);
+            if (strings.length == 3) {
+                Operation operation = new Operation();
+                operation.setOperationName(strings[2]);
+                dataList.add(operation);
             }
         }
-        ClassMethodsData[] methodsDatas = new ClassMethodsData[items.size()];
+        Service[] methodsDatas = new Service[items.size()];
         int i = 0;
         for (String clazz : items.keySet()) {
-            methodsDatas[i] = new ClassMethodsData();
+            methodsDatas[i] = new Service();
             methodsDatas[i].setClassName(clazz);
-            List<MethodData> dataList = items.get(clazz);
-            methodsDatas[i].setMethods(dataList.toArray(new MethodData[dataList.size()]));
+            methodsDatas[i].setServiceName(serviceNames.get(i));
+            List<Operation> dataList = items.get(clazz);
+            methodsDatas[i].setOperations(dataList.toArray(new Operation[dataList.size()]));
             i++;
         }
         return methodsDatas;
     }
+
+    public static Service[] getServices(HttpServletRequest request, String paramName) {
+        List<Service> dataList = new ArrayList<Service>();
+        String[] methods = request.getParameterValues(paramName);
+        for (String method : methods) {
+            if(method.equals("")){
+                continue;
+            }
+            String[] strings = method.split("#");
+            Service service = new Service();
+            service.setClassName(strings[0]);
+            service.setServiceName(strings[1]);
+            dataList.add(service);
+        }
+        return dataList.toArray(new Service[dataList.size()]);
+    }
 }

Modified: trunk/carbon-components/jar-services/org.wso2.carbon.jarservices.ui/src/main/resources/JarServiceCreatorAdmin.wsdl
URL: http://wso2.org/svn/browse/wso2/trunk/carbon-components/jar-services/org.wso2.carbon.jarservices.ui/src/main/resources/JarServiceCreatorAdmin.wsdl?rev=31330&r1=31329&r2=31330&view=diff
==============================================================================
--- trunk/carbon-components/jar-services/org.wso2.carbon.jarservices.ui/src/main/resources/JarServiceCreatorAdmin.wsdl	(original)
+++ trunk/carbon-components/jar-services/org.wso2.carbon.jarservices.ui/src/main/resources/JarServiceCreatorAdmin.wsdl	Mon Feb 23 07:52:36 2009
@@ -26,8 +26,8 @@
                     <xs:sequence>
                         <xs:element minOccurs="0" name="directoryPath" nillable="true"
                                     type="xs:string"/>
-                        <xs:element maxOccurs="unbounded" minOccurs="0" name="classNames"
-                                    nillable="true" type="xs:string"/>
+                        <xs:element maxOccurs="unbounded" minOccurs="0" name="services"
+                                    nillable="true" type="ax26:Service"/>
                     </xs:sequence>
                 </xs:complexType>
             </xs:element>
@@ -36,7 +36,7 @@
                 <xs:complexType>
                     <xs:sequence>
                         <xs:element maxOccurs="unbounded" minOccurs="0" name="return"
-                                    nillable="true" type="ax26:ClassMethodsData"/>
+                                    nillable="true" type="ax26:Service"/>
                     </xs:sequence>
                 </xs:complexType>
             </xs:element>
@@ -67,54 +67,77 @@
                 </xs:complexType>
 
             </xs:element>
+            <xs:element name="DuplicateServiceException">
+                <xs:complexType>
+                    <xs:sequence>
+                        <xs:element minOccurs="0" name="DuplicateServiceException" nillable="true"
+                                    type="ax26:DuplicateServiceException"/>
+                    </xs:sequence>
+                </xs:complexType>
+            </xs:element>
             <xs:element name="createAndDeployService">
+
                 <xs:complexType>
                     <xs:sequence>
                         <xs:element minOccurs="0" name="directoryPath" nillable="true"
                                     type="xs:string"/>
                         <xs:element maxOccurs="unbounded" minOccurs="0" name="data" nillable="true"
-                                    type="ax26:ClassMethodsData"/>
+                                    type="ax26:Service"/>
                     </xs:sequence>
                 </xs:complexType>
             </xs:element>
-
         </xs:schema>
-        <xs:schema attributeFormDefault="qualified" elementFormDefault="qualified"
+        <xs:schema xmlns:ax28="http://jarservices.carbon.wso2.org" attributeFormDefault="qualified"
+                   elementFormDefault="qualified"
                    targetNamespace="http://jarservices.carbon.wso2.org/xsd">
-            <xs:complexType name="ClassMethodsData">
+
+            <xs:import namespace="http://jarservices.carbon.wso2.org"/>
+            <xs:complexType name="Service">
                 <xs:sequence>
                     <xs:element minOccurs="0" name="className" nillable="true" type="xs:string"/>
-                    <xs:element maxOccurs="unbounded" minOccurs="0" name="methods" nillable="true"
-                                type="ax26:MethodData"/>
+                    <xs:element minOccurs="0" name="deploymentScope" nillable="true"
+                                type="xs:string"/>
+                    <xs:element maxOccurs="unbounded" minOccurs="0" name="operations"
+                                nillable="true" type="ax26:Operation"/>
+                    <xs:element minOccurs="0" name="serviceName" nillable="true" type="xs:string"/>
                 </xs:sequence>
             </xs:complexType>
-            <xs:complexType name="MethodData">
 
+            <xs:complexType name="Operation">
                 <xs:sequence>
-                    <xs:element minOccurs="0" name="methodName" nillable="true" type="xs:string"/>
-                    <xs:element minOccurs="0" name="overload" type="xs:boolean"/>
+                    <xs:element minOccurs="0" name="operationName" nillable="true"
+                                type="xs:string"/>
+                    <xs:element minOccurs="0" name="overloaded" type="xs:boolean"/>
                 </xs:sequence>
             </xs:complexType>
             <xs:complexType name="Resource">
                 <xs:sequence>
                     <xs:element minOccurs="0" name="dataHandler" nillable="true"
                                 type="xs:base64Binary"/>
-                    <xs:element minOccurs="0" name="fileName" nillable="true" type="xs:string"/>
 
+                    <xs:element minOccurs="0" name="fileName" nillable="true" type="xs:string"/>
                 </xs:sequence>
             </xs:complexType>
             <xs:complexType name="UploadArtifactsResponse">
                 <xs:sequence>
-                    <xs:element maxOccurs="unbounded" minOccurs="0" name="classes" nillable="true"
-                                type="xs:string"/>
                     <xs:element minOccurs="0" name="primaryResourceFilePath" nillable="true"
                                 type="xs:string"/>
                     <xs:element minOccurs="0" name="resourcesDirPath" nillable="true"
                                 type="xs:string"/>
+                    <xs:element maxOccurs="unbounded" minOccurs="0" name="services" nillable="true"
+                                type="ax26:Service"/>
                 </xs:sequence>
-            </xs:complexType>
 
+            </xs:complexType>
+            <xs:complexType name="DuplicateServiceException">
+                <xs:complexContent>
+                    <xs:extension base="ax28:Exception">
+                        <xs:sequence/>
+                    </xs:extension>
+                </xs:complexContent>
+            </xs:complexType>
         </xs:schema>
+
     </wsdl:types>
     <wsdl:message name="getClassMethodsRequest">
         <wsdl:part name="parameters" element="ns:getClassMethods"/>
@@ -123,8 +146,8 @@
         <wsdl:part name="parameters" element="ns:getClassMethodsResponse"/>
     </wsdl:message>
     <wsdl:message name="uploadServiceRequest"/>
-
     <wsdl:message name="uploadServiceResponse"/>
+
     <wsdl:message name="uploadRequest">
         <wsdl:part name="parameters" element="ns:upload"/>
     </wsdl:message>
@@ -133,18 +156,21 @@
     </wsdl:message>
     <wsdl:message name="Exception">
         <wsdl:part name="parameters" element="ns:Exception"/>
-
     </wsdl:message>
+
     <wsdl:message name="createAndDeployServiceRequest">
         <wsdl:part name="parameters" element="ns:createAndDeployService"/>
     </wsdl:message>
+    <wsdl:message name="DuplicateServiceException">
+        <wsdl:part name="parameters" element="ns:DuplicateServiceException"/>
+    </wsdl:message>
     <wsdl:portType name="JarServiceCreatorAdminPortType">
         <wsdl:operation name="getClassMethods">
             <wsdl:input message="ns:getClassMethodsRequest" wsaw:Action="urn:getClassMethods"/>
+
             <wsdl:output message="ns:getClassMethodsResponse"
                          wsaw:Action="urn:getClassMethodsResponse"/>
         </wsdl:operation>
-
         <wsdl:operation name="uploadService">
             <wsdl:input message="ns:uploadServiceRequest" wsaw:Action="urn:uploadService"/>
             <wsdl:output message="ns:uploadServiceResponse"
@@ -153,100 +179,109 @@
         <wsdl:operation name="upload">
             <wsdl:input message="ns:uploadRequest" wsaw:Action="urn:upload"/>
             <wsdl:output message="ns:uploadResponse" wsaw:Action="urn:uploadResponse"/>
+
             <wsdl:fault message="ns:Exception" name="Exception" wsaw:Action="urn:uploadException"/>
         </wsdl:operation>
-
         <wsdl:operation name="createAndDeployService">
             <wsdl:input message="ns:createAndDeployServiceRequest"
                         wsaw:Action="urn:createAndDeployService"/>
+            <wsdl:fault message="ns:DuplicateServiceException" name="DuplicateServiceException"
+                        wsaw:Action="urn:createAndDeployServiceDuplicateServiceException"/>
         </wsdl:operation>
     </wsdl:portType>
     <wsdl:binding name="JarServiceCreatorAdminSoap11Binding"
                   type="ns:JarServiceCreatorAdminPortType">
         <soap:binding transport="http://schemas.xmlsoap.org/soap/http" style="document"/>
+
         <wsdl:operation name="getClassMethods">
             <soap:operation soapAction="urn:getClassMethods" style="document"/>
             <wsdl:input>
-
                 <soap:body use="literal"/>
             </wsdl:input>
             <wsdl:output>
                 <soap:body use="literal"/>
             </wsdl:output>
         </wsdl:operation>
+
         <wsdl:operation name="uploadService">
             <soap:operation soapAction="urn:uploadService" style="document"/>
             <wsdl:input>
-
                 <soap:body use="literal"/>
             </wsdl:input>
             <wsdl:output>
                 <soap:body use="literal"/>
             </wsdl:output>
         </wsdl:operation>
+
         <wsdl:operation name="upload">
             <soap:operation soapAction="urn:upload" style="document"/>
             <wsdl:input>
-
                 <soap:body use="literal"/>
             </wsdl:input>
             <wsdl:output>
                 <soap:body use="literal"/>
             </wsdl:output>
             <wsdl:fault name="Exception">
+
                 <soap:fault use="literal" name="Exception"/>
             </wsdl:fault>
         </wsdl:operation>
-
         <wsdl:operation name="createAndDeployService">
             <soap:operation soapAction="urn:createAndDeployService" style="document"/>
             <wsdl:input>
                 <soap:body use="literal"/>
             </wsdl:input>
+            <wsdl:fault name="DuplicateServiceException">
+
+                <soap:fault use="literal" name="DuplicateServiceException"/>
+            </wsdl:fault>
         </wsdl:operation>
     </wsdl:binding>
     <wsdl:binding name="JarServiceCreatorAdminSoap12Binding"
                   type="ns:JarServiceCreatorAdminPortType">
         <soap12:binding transport="http://schemas.xmlsoap.org/soap/http" style="document"/>
-
         <wsdl:operation name="getClassMethods">
             <soap12:operation soapAction="urn:getClassMethods" style="document"/>
             <wsdl:input>
+
                 <soap12:body use="literal"/>
             </wsdl:input>
             <wsdl:output>
                 <soap12:body use="literal"/>
             </wsdl:output>
         </wsdl:operation>
-
         <wsdl:operation name="uploadService">
             <soap12:operation soapAction="urn:uploadService" style="document"/>
             <wsdl:input>
+
                 <soap12:body use="literal"/>
             </wsdl:input>
             <wsdl:output>
                 <soap12:body use="literal"/>
             </wsdl:output>
         </wsdl:operation>
-
         <wsdl:operation name="upload">
             <soap12:operation soapAction="urn:upload" style="document"/>
             <wsdl:input>
+
                 <soap12:body use="literal"/>
             </wsdl:input>
             <wsdl:output>
                 <soap12:body use="literal"/>
             </wsdl:output>
             <wsdl:fault name="Exception">
-
                 <soap12:fault use="literal" name="Exception"/>
             </wsdl:fault>
         </wsdl:operation>
+
         <wsdl:operation name="createAndDeployService">
             <soap12:operation soapAction="urn:createAndDeployService" style="document"/>
             <wsdl:input>
                 <soap12:body use="literal"/>
             </wsdl:input>
+            <wsdl:fault name="DuplicateServiceException">
+                <soap12:fault use="literal" name="DuplicateServiceException"/>
+            </wsdl:fault>
         </wsdl:operation>
 
     </wsdl:binding>
@@ -294,18 +329,18 @@
         <wsdl:port name="JarServiceCreatorAdminHttpsSoap11Endpoint"
                    binding="ns:JarServiceCreatorAdminSoap11Binding">
             <soap:address
-                    location="https://172.16.212.1:9443/services/JarServiceCreatorAdmin.JarServiceCreatorAdminHttpsSoap11Endpoint"/>
+                    location="https://10.100.1.202:9443/services/JarServiceCreatorAdmin.JarServiceCreatorAdminHttpsSoap11Endpoint"/>
         </wsdl:port>
         <wsdl:port name="JarServiceCreatorAdminHttpsSoap12Endpoint"
                    binding="ns:JarServiceCreatorAdminSoap12Binding">
             <soap12:address
-                    location="https://172.16.212.1:9443/services/JarServiceCreatorAdmin.JarServiceCreatorAdminHttpsSoap12Endpoint"/>
+                    location="https://10.100.1.202:9443/services/JarServiceCreatorAdmin.JarServiceCreatorAdminHttpsSoap12Endpoint"/>
         </wsdl:port>
         <wsdl:port name="JarServiceCreatorAdminHttpsEndpoint"
                    binding="ns:JarServiceCreatorAdminHttpBinding">
 
             <http:address
-                    location="https://172.16.212.1:9443/services/JarServiceCreatorAdmin.JarServiceCreatorAdminHttpsEndpoint"/>
+                    location="https://10.100.1.202:9443/services/JarServiceCreatorAdmin.JarServiceCreatorAdminHttpsEndpoint"/>
         </wsdl:port>
     </wsdl:service>
 </wsdl:definitions>
\ No newline at end of file

Modified: trunk/carbon-components/jar-services/org.wso2.carbon.jarservices.ui/src/main/resources/org/wso2/carbon/jarservices/ui/i18n/Resources.properties
URL: http://wso2.org/svn/browse/wso2/trunk/carbon-components/jar-services/org.wso2.carbon.jarservices.ui/src/main/resources/org/wso2/carbon/jarservices/ui/i18n/Resources.properties?rev=31330&r1=31329&r2=31330&view=diff
==============================================================================
--- trunk/carbon-components/jar-services/org.wso2.carbon.jarservices.ui/src/main/resources/org/wso2/carbon/jarservices/ui/i18n/Resources.properties	(original)
+++ trunk/carbon-components/jar-services/org.wso2.carbon.jarservices.ui/src/main/resources/org/wso2/carbon/jarservices/ui/i18n/Resources.properties	Mon Feb 23 07:52:36 2009
@@ -1,4 +1,4 @@
-service.jar.services=Jar/Zip Service
+service.jar.services=Jar Service
 select.at.least.one.jar=Please select at least one .jar or .zip file to upload
 select.jar.or.zip.file.only=Only .jar or .zip files are allowed
 add.service.archive=Add a Service Archive
@@ -18,4 +18,6 @@
 finish=Finish
 add.jar.service=Add Jar Service
 select.at.least.one.class=Select at least one class to be exposed as a Web  service
-select.at.least.one.method=Select at least one method to be exposed as a Web service operation
\ No newline at end of file
+select.at.least.one.method=Select at least one method to be exposed as a Web service operation
+class1=Class
+service.name=Service Name
\ No newline at end of file

Modified: trunk/carbon-components/jar-services/org.wso2.carbon.jarservices.ui/src/main/resources/web/jarservices/finish.jsp
URL: http://wso2.org/svn/browse/wso2/trunk/carbon-components/jar-services/org.wso2.carbon.jarservices.ui/src/main/resources/web/jarservices/finish.jsp?rev=31330&r1=31329&r2=31330&view=diff
==============================================================================
--- trunk/carbon-components/jar-services/org.wso2.carbon.jarservices.ui/src/main/resources/web/jarservices/finish.jsp	(original)
+++ trunk/carbon-components/jar-services/org.wso2.carbon.jarservices.ui/src/main/resources/web/jarservices/finish.jsp	Mon Feb 23 07:52:36 2009
@@ -2,12 +2,11 @@
 <%@ page import="org.wso2.carbon.CarbonConstants" %>
 <%@ page import="org.wso2.carbon.jarservices.ui.fileupload.JarServiceAdminClient" %>
 <%@ page import="org.wso2.carbon.jarservices.ui.fileupload.Utils" %>
-<%@ page import="org.wso2.carbon.jarservices.ui.types.ClassMethodsData" %>
-<%@ page import="org.wso2.carbon.jarservices.ui.types.MethodData" %>
 <%@ page import="org.wso2.carbon.jarservices.ui.types.UploadArtifactsResponse" %>
 <%@ page import="org.wso2.carbon.ui.CarbonUIMessage" %>
 <%@ page import="org.wso2.carbon.ui.CarbonUIUtil" %>
 <%@ page import="org.wso2.carbon.utils.ServerConstants" %>
+<%@ page import="org.wso2.carbon.jarservices.ui.types.Service" %>
 <%@ taglib prefix="fmt" uri="http://java.sun.com/jsp/jstl/fmt" %>
 <%@ taglib uri="http://wso2.org/projects/carbon/taglibs/carbontags.jar" prefix="carbon" %>
 
@@ -15,7 +14,7 @@
 <jsp:include page="../dialog/display_messages.jsp"/>
 
 <%
-    ClassMethodsData[] methodsDatas = Utils.getClassMethodsFromRequest(request);
+    Service[] services = Utils.getServices2(request, "method");
 
     String cookie = (String) session.getAttribute(ServerConstants.ADMIN_SERVICE_COOKIE);
     String backendServerURL = CarbonUIUtil.getServerURL(config.getServletContext(), session);
@@ -25,7 +24,7 @@
     try {
         JarServiceAdminClient jarServiceAdminClient = new JarServiceAdminClient(configContext, backendServerURL, cookie);
         String path = ((UploadArtifactsResponse) session.getAttribute("UploadArtifactsResponse")).getResourcesDirPath();
-        jarServiceAdminClient.createAndDeployService(path, methodsDatas);
+        jarServiceAdminClient.createAndDeployService(path, services);
 
         String msg = "Service archive successfully created. Please refresh this page in a while to see "
                      + "the status of the created Axis2 services";

Modified: trunk/carbon-components/jar-services/org.wso2.carbon.jarservices.ui/src/main/resources/web/jarservices/list_classes.jsp
URL: http://wso2.org/svn/browse/wso2/trunk/carbon-components/jar-services/org.wso2.carbon.jarservices.ui/src/main/resources/web/jarservices/list_classes.jsp?rev=31330&r1=31329&r2=31330&view=diff
==============================================================================
--- trunk/carbon-components/jar-services/org.wso2.carbon.jarservices.ui/src/main/resources/web/jarservices/list_classes.jsp	(original)
+++ trunk/carbon-components/jar-services/org.wso2.carbon.jarservices.ui/src/main/resources/web/jarservices/list_classes.jsp	Mon Feb 23 07:52:36 2009
@@ -1,4 +1,5 @@
 <%@ page import="org.wso2.carbon.jarservices.ui.types.UploadArtifactsResponse" %>
+<%@ page import="org.wso2.carbon.jarservices.ui.types.Service" %>
 <%@ taglib prefix="fmt" uri="http://java.sun.com/jsp/jstl/fmt" %>
 <%@ taglib uri="http://wso2.org/projects/carbon/taglibs/carbontags.jar" prefix="carbon" %>
 
@@ -7,19 +8,31 @@
 
 <fmt:bundle basename="org.wso2.carbon.jarservices.ui.i18n.Resources">
     <script type="text/javascript">
-        function submitForm(){
+        function setClass(clazzId) {
+            var chk = document.getElementById(clazzId + "Chk");
+            var txt = document.getElementById(clazzId + "Txt");
+            var hid = document.getElementById(clazzId + "Hid");
+
+            if (chk.checked) {
+                hid.value = chk.value + "#" + txt.value;
+            } else {
+                hid.value = "";             
+            }
+        }
+
+        function submitForm() {
             var selected;
-            if (document.classesForm.clazz[0] != null) { // there is more than 1
-                for (var j = 0; j < document.classesForm.clazz.length; j++) {
-                    selected = document.classesForm.clazz[j].checked;
+            if (document.classesForm.clazzChk[0] != null) { // there is more than 1
+                for (var j = 0; j < document.classesForm.clazzChk.length; j++) {
+                    selected = document.classesForm.clazzChk[j].checked;
                     if (selected) {
                         break;
                     }
                 }
-            } else if (document.classesForm.clazz != null) { // only 1
-                selected = document.classesForm.clazz.checked;
+            } else if (document.classesForm.clazzChk != null) { // only 1
+                selected = document.classesForm.clazzChk.checked;
             }
-            if(!selected){
+            if (!selected) {
                 CARBON.showWarningDialog('<fmt:message key="select.at.least.one.class"/>');
                 return false;
             }
@@ -34,39 +47,52 @@
 
     <div id="middle">
         <h2><fmt:message key="add.jar.service"/></h2>
-        
+
         <div id="workArea">
             <form method="post" action="list_methods.jsp" target="_self" name="classesForm">
                 <table class="styledLeft" id="archiveTbl">
                     <thead>
                     <tr>
-                        <th colspan="2"><fmt:message key="classes"/></th>
+                        <th colspan="3"><fmt:message key="classes"/></th>
                     </tr>
                     </thead>
 
                     <%
                         UploadArtifactsResponse uploadResponse =
                                 (UploadArtifactsResponse) session.getAttribute("UploadArtifactsResponse");
-                        String[] classes = uploadResponse.getClasses();
-                        for (String clazz : classes) {
+                        Service[] services = uploadResponse.getServices();
+                        for (Service clazz : services) {
                     %>
                     <tr>
+                        <td>&nbsp;</td>
+                        <td><strong><fmt:message key="class1"/></strong></td>
+                        <td><strong><fmt:message key="service.name"/></strong></td>
+                    </tr>
+                    <tr>
                         <td class="formRow" width="15px">
-                            <input type="checkbox" name="clazz" value="<%= clazz%>"/>
+                            <input id="<%= clazz.getClassName()%>Chk" name="clazzChk" type="checkbox" value="<%= clazz.getClassName() %>"
+                                   onclick="setClass('<%= clazz.getClassName()%>');"/>
+                        </td>
+                        <td class="formRow">
+                            <%= clazz.getClassName() %>
+                            <input id="<%= clazz.getClassName()%>Hid" type="hidden" name="clazz"
+                                   value="<%= clazz + "#" + clazz.getServiceName()%>"/>
                         </td>
                         <td class="formRow">
-                            <%= clazz %>
+                            <input id="<%= clazz.getClassName()%>Txt" type="text" size="50"
+                                   value="<%= clazz.getServiceName() %>"
+                                   onchange="setClass('<%= clazz.getClassName()%>Txt');"/>
                         </td>
                     </tr>
                     <% } %>
                     <tr>
-                        <td class="buttonRow" colspan="2">
+                        <td class="buttonRow" colspan="3">
                             <input type="button" class="button"
                                    value=" <fmt:message key="back"/> " onclick="history.back();"/>
                             <input type="button" class="button"
                                    value=" <fmt:message key="next"/> " onclick="submitForm();"/>
                             <input type="button" class="button"
-                                   onclick="location.href='../service-mgt/index.jsp'"
+                                   onclick="location.href='../service-mgt/index.jsp';"
                                    value=" <fmt:message key="cancel"/> "/>
                         </td>
                     </tr>

Modified: trunk/carbon-components/jar-services/org.wso2.carbon.jarservices.ui/src/main/resources/web/jarservices/list_methods.jsp
URL: http://wso2.org/svn/browse/wso2/trunk/carbon-components/jar-services/org.wso2.carbon.jarservices.ui/src/main/resources/web/jarservices/list_methods.jsp?rev=31330&r1=31329&r2=31330&view=diff
==============================================================================
--- trunk/carbon-components/jar-services/org.wso2.carbon.jarservices.ui/src/main/resources/web/jarservices/list_methods.jsp	(original)
+++ trunk/carbon-components/jar-services/org.wso2.carbon.jarservices.ui/src/main/resources/web/jarservices/list_methods.jsp	Mon Feb 23 07:52:36 2009
@@ -4,9 +4,10 @@
 <%@ page import="org.wso2.carbon.ui.CarbonUIMessage" %>
 <%@ page import="org.apache.axis2.context.ConfigurationContext" %>
 <%@ page import="org.wso2.carbon.jarservices.ui.types.UploadArtifactsResponse" %>
-<%@ page import="org.wso2.carbon.jarservices.ui.types.ClassMethodsData" %>
-<%@ page import="org.wso2.carbon.jarservices.ui.types.MethodData" %>
 <%@ page import="org.wso2.carbon.ui.CarbonUIUtil" %>
+<%@ page import="org.wso2.carbon.jarservices.ui.fileupload.Utils" %>
+<%@ page import="org.wso2.carbon.jarservices.ui.types.Service" %>
+<%@ page import="org.wso2.carbon.jarservices.ui.types.Operation" %>
 <%@ taglib prefix="fmt" uri="http://java.sun.com/jsp/jstl/fmt" %>
 <%@ taglib uri="http://wso2.org/projects/carbon/taglibs/carbontags.jar" prefix="carbon" %>
 
@@ -16,19 +17,17 @@
 <jsp:include page="../dialog/display_messages.jsp"/>
 
 <%
-    String[] classes = request.getParameterValues("clazz");
+    Service[] services = Utils.getServices(request, "clazz");
 
     String cookie = (String) session.getAttribute(ServerConstants.ADMIN_SERVICE_COOKIE);
     String backendServerURL = CarbonUIUtil.getServerURL(config.getServletContext(), session);
     ConfigurationContext configContext =
             (ConfigurationContext) config.getServletContext().getAttribute(CarbonConstants.CONFIGURATION_CONTEXT);
 
-    ClassMethodsData[] classMethods;
-
     try {
         JarServiceAdminClient jarServiceAdminClient = new JarServiceAdminClient(configContext, backendServerURL, cookie);
         String path = ((UploadArtifactsResponse) session.getAttribute("UploadArtifactsResponse")).getResourcesDirPath();
-        classMethods = jarServiceAdminClient.getClassMethods(path, classes);
+        services = jarServiceAdminClient.getClassMethods(path, services);
     } catch (Exception e) {
         response.setStatus(500);
         CarbonUIMessage uiMsg = new CarbonUIMessage(CarbonUIMessage.ERROR, e.getMessage(), e);
@@ -109,38 +108,38 @@
                     </thead>
 
                     <%
-                        for (ClassMethodsData methods : classMethods) {
+                        for (Service service : services) {
                     %>
                     <script type="text/javascript">
                         var clazz = new CarbonClass();
-                        clazz.setClassName('<%= methods.getClassName()%>');
+                        clazz.setClassName('<%= service.getClassName()%>');
                         classes.push(clazz);
                     </script>
                     <tr>
                         <td class="formRow">
-                            <input type="hidden" name="clazz" value="<%= methods.getClassName()%>"/>
-                            <table class="styledLeft" id="<%= methods.getClassName()%>Tbl">
+                            <input type="hidden" name="clazz" value="<%= service.getClassName()%>"/>
+                            <table class="styledLeft" id="<%= service.getClassName()%>Tbl">
                                 <tbody>
                                 <tr>
                                     <td colspan="2"><strong><fmt:message
-                                            key="class"/></strong> <%= methods.getClassName()%>
+                                            key="class"/></strong> <%= service.getClassName()%>
                                     </td>
                                 </tr>
                                 <%
-                                    for (MethodData method : methods.getMethods()) {
+                                    for (Operation operation : service.getOperations()) {
                                 %>
                                 <script type="text/javascript">
                                     var method = new CarbonMethod();
-                                    method.setMethodName('<%= method.getMethodName()%>');
+                                    method.setMethodName('<%= operation.getOperationName()%>');
                                     clazz.addMethod(method);
                                 </script>
                                 <tr>
                                     <td width="15px">
-                                        <input type="checkbox" name="methodChk" value="<%= methods.getClassName() + "#" + method.getMethodName()%>" checked="true" onclick="selectMethod('<%= methods.getClassName()%>', '<%= method.getMethodName()%>', this.checked);"/>
-                                        <input type="hidden" name="method" value="<%= methods.getClassName()%>"/>
+                                        <input type="checkbox" name="methodChk" value="<%= service.getClassName()  + "#" + service.getServiceName() + "#" + operation.getOperationName()%>" checked="true" onclick="selectMethod('<%= service.getClassName()%>', '<%= operation.getOperationName()%>', this.checked);"/>
+                                        <input type="hidden" name="method" value="<%= service.getClassName() + "#" + service.getServiceName()%>"/>
                                     </td>
                                     <td>
-                                        <%= method.getMethodName() %>
+                                        <%= operation.getOperationName() %>
                                     </td>
                                 </tr>
                                 <%
@@ -149,7 +148,7 @@
                                 </tbody>
                             </table>
                             <script type="text/javascript">
-                                alternateTableRows('<%= methods.getClassName()%>Tbl', 'tableEvenRow', 'tableOddRow');
+                                alternateTableRows('<%= service.getClassName()%>Tbl', 'tableEvenRow', 'tableOddRow');
                             </script>
                         </td>
                     </tr>

Deleted: trunk/carbon-components/jar-services/org.wso2.carbon.jarservices/src/main/java/org/wso2/carbon/jarservices/ClassMethodsData.java
URL: http://wso2.org/svn/browse/wso2/None?pathrev=31329

Added: trunk/carbon-components/jar-services/org.wso2.carbon.jarservices/src/main/java/org/wso2/carbon/jarservices/DuplicateServiceException.java
URL: http://wso2.org/svn/browse/wso2/trunk/carbon-components/jar-services/org.wso2.carbon.jarservices/src/main/java/org/wso2/carbon/jarservices/DuplicateServiceException.java?pathrev=31330
==============================================================================
--- (empty file)
+++ trunk/carbon-components/jar-services/org.wso2.carbon.jarservices/src/main/java/org/wso2/carbon/jarservices/DuplicateServiceException.java	Mon Feb 23 07:52:36 2009
@@ -0,0 +1,37 @@
+/*                                                                             
+ * Copyright 2004,2005 The Apache Software Foundation.                         
+ *                                                                             
+ * Licensed under the Apache License, Version 2.0 (the "License");             
+ * you may not use this file except in compliance with the License.            
+ * You may obtain a copy of the License at                                     
+ *                                                                             
+ *      http://www.apache.org/licenses/LICENSE-2.0                             
+ *                                                                             
+ * Unless required by applicable law or agreed to in writing, software         
+ * distributed under the License is distributed on an "AS IS" BASIS,           
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.    
+ * See the License for the specific language governing permissions and         
+ * limitations under the License.                                              
+ */
+package org.wso2.carbon.jarservices;
+
+/**
+ *
+ */
+public class DuplicateServiceException extends Exception {
+    public DuplicateServiceException() {
+        super();
+    }
+
+    public DuplicateServiceException(String message) {
+        super(message);
+    }
+
+    public DuplicateServiceException(String message, Throwable cause) {
+        super(message, cause);
+    }
+
+    public DuplicateServiceException(Throwable cause) {
+        super(cause);
+    }
+}

Modified: trunk/carbon-components/jar-services/org.wso2.carbon.jarservices/src/main/java/org/wso2/carbon/jarservices/JarServiceCreatorAdmin.java
URL: http://wso2.org/svn/browse/wso2/trunk/carbon-components/jar-services/org.wso2.carbon.jarservices/src/main/java/org/wso2/carbon/jarservices/JarServiceCreatorAdmin.java?rev=31330&r1=31329&r2=31330&view=diff
==============================================================================
--- trunk/carbon-components/jar-services/org.wso2.carbon.jarservices/src/main/java/org/wso2/carbon/jarservices/JarServiceCreatorAdmin.java	(original)
+++ trunk/carbon-components/jar-services/org.wso2.carbon.jarservices/src/main/java/org/wso2/carbon/jarservices/JarServiceCreatorAdmin.java	Mon Feb 23 07:52:36 2009
@@ -14,12 +14,12 @@
 import java.net.MalformedURLException;
 import java.net.URL;
 import java.net.URLClassLoader;
-import java.lang.reflect.Method;
 import java.lang.reflect.Modifier;
 
 import javax.activation.DataHandler;
 
 import org.apache.axis2.AxisFault;
+import org.apache.axis2.engine.AxisConfiguration;
 import org.apache.axis2.context.ConfigurationContext;
 import org.apache.axis2.context.MessageContext;
 import org.apache.commons.logging.Log;
@@ -54,23 +54,23 @@
             String tempDir = getTempDir();
             String libDir = tempDir + File.separator + "lib";
             new File(libDir).mkdirs();
-            List<String> classes = new ArrayList<String>();
+            List<Service> services = new ArrayList<Service>();
             for (int i = 0; i < resources.length; i++) {
                 Resource resource = resources[i];
                 writeToFileSystem(libDir,
                                   resource.getFileName(),
                                   resource.getDataHandler());
-                classes.addAll(getClassNames(libDir + File.separator + resource.getFileName()));
+                services.addAll(getClasses(libDir + File.separator + resource.getFileName()));
             }
 
             UploadArtifactsResponse response = new UploadArtifactsResponse();
             response.setResourcesDirPath(tempDir);
-            Collections.sort(classes, new Comparator<String>(){
-                public int compare(String o1, String o2) {
-                    return o1.compareTo(o2);
+            Collections.sort(services, new Comparator<Service>(){
+                public int compare(Service o1, Service o2) {
+                    return o1.getClassName().compareTo(o2.getClassName());
                 }
             });
-            response.setClasses(classes.toArray(new String[classes.size()]));
+            response.setServices(services.toArray(new Service[services.size()]));
             return response;
         } catch (IOException e) {
             String msg = "Error occured while uploading jar/zip service ";
@@ -95,41 +95,50 @@
      *         archive
      * @throws AxisFault
      */
-    private List<String> getClassNames(String filePath) throws AxisFault {
+    private List<Service> getClasses(String filePath) throws AxisFault {
+        List<Service> services = new ArrayList<Service>();
         if (filePath != null) {
             try {
                 String[] entries = new ArchiveManipulator().check(filePath);
-                List<String> classnames = new ArrayList<String>();
                 for (int i = 0; i < entries.length; i++) {
                     String entry = entries[i];
                     if (entry.endsWith(".class")) {
                         entry = entry.replace('/', '.').substring(0,
                                                                   entry.lastIndexOf(".class"));
-                        classnames.add(entry);
+                        Service service = new Service();
+                        service.setClassName(entry);
+
+                        AxisConfiguration axisConfig = MessageContext.getCurrentMessageContext().getConfigurationContext().getAxisConfiguration();
+                        String serviceName = entry;
+                        int x = 1;
+                        while(axisConfig.getService(serviceName + x) != null){
+                            x++;
+                        }
+                        service.setServiceName(serviceName + x);
+                        services.add(service);
                     }
                 }
-                return classnames;
             } catch (IOException e) {
                 String msg = "Could not read archive";
                 log.error(msg, e);
                 throw new AxisFault(msg, e);
             }
         }
-        return new ArrayList<String>();
+        return services;
     }
 
     /**
      * This method will list all the public methods for the given classes.
      *
      * @param directoryPath Temp dir innto which all jars were uploaded
-     * @param classNames full qualified class name
+     * @param services Selected classes
      * @return All methods in the selected classes
      * @throws AxisFault will be thrown
      */
-    public ClassMethodsData[] getClassMethods(String directoryPath,
-                                              String[] classNames) throws AxisFault {
-        if (classNames == null || classNames.length == 0) {
-            String msg = "Cannot find classes";
+    public Service[] getClassMethods(String directoryPath,
+                                     Service[] services) throws AxisFault {
+        if (services == null || services.length == 0) {
+            String msg = "Cannot find services";
             log.error(msg);
             throw new AxisFault(msg);
         }
@@ -141,75 +150,71 @@
         methodExcludeList.add("notifyAll");
         methodExcludeList.add("toString");
         methodExcludeList.add("wait");
-        List<URL> resourecesList = new ArrayList<URL>();
+        List<URL> resourcesList = new ArrayList<URL>();
 
         File[] files = new File(directoryPath + File.separator + "lib").listFiles();
         for(File file: files){
             try {
-                resourecesList.add(file.toURL());
+                resourcesList.add(file.toURL());
             } catch (MalformedURLException ignored) {
                 // This exception will not occur
             }
         }
 
-        URL[] urls = resourecesList.toArray(new URL[resourecesList.size()]);
+        URL[] urls = resourcesList.toArray(new URL[resourcesList.size()]);
         ClassLoader classLoader =
                 URLClassLoader.newInstance(urls,
                                            getClass().getClassLoader()); //TODO: Check OSGi issues here
-        List<ClassMethodsData> classMethodList = new ArrayList<ClassMethodsData>();
-        for (int i = 0; i < classNames.length; i++) {
-            String className = classNames[i];
+        for (int i = 0; i < services.length; i++) {
+            Service service = services[i];
+            String className = service.getClassName();
             try {
                 Class clazz = classLoader.loadClass(className);
-                ClassMethodsData classMethodsData = new ClassMethodsData();
-                classMethodsData.setClassName(clazz.getName());
-                Method[] methods = clazz.getMethods();
-                List<MethodData> methodList = new ArrayList<MethodData>();
+                java.lang.reflect.Method[] methods = clazz.getMethods();
+                List<Operation> operationList = new ArrayList<Operation>();
                 for (int j = 0; j < methods.length; j++) {
-                    Method method = methods[j];
+                    java.lang.reflect.Method method = methods[j];
                     String methodName = method.getName();
                     int modifiers = method.getModifiers();
                     if (Modifier.isPublic(modifiers)
                         && !methodExcludeList.contains(methodName)) {
-                        MethodData methodData = new MethodData();
-                        methodData.setMethodName(methodName);
-                        methodList.add(methodData);
+                        Operation operation = new Operation();
+                        operation.setOperationName(methodName);
+                        operationList.add(operation);
                     }
                 }
-                findOverloadedMethods(methodList);
-                classMethodsData.setMethods(methodList.toArray(new MethodData[methodList.size()]));
-                classMethodList.add(classMethodsData);
+                findOverloadedMethods(operationList);
+                service.setOperations(operationList.toArray(new Operation[operationList.size()]));
             } catch (ClassNotFoundException e) {
                 String msg = "The class " + className + " cannot be loaded";
                 log.error(msg);
             }
-
         }
-        return classMethodList.toArray(new ClassMethodsData[classMethodList.size()]);
+        return services;
     }
 
     private void findOverloadedMethods(List methodList) {
         Map finalMap = new HashMap();
         int size = methodList.size();
         for (int k = 0; k < size - 1; k++) {
-            MethodData startPointer = (MethodData) methodList.get(k);
-            if (!finalMap.containsKey(startPointer.getMethodName())) {
+            Operation startPointer = (Operation) methodList.get(k);
+            if (!finalMap.containsKey(startPointer.getOperationName())) {
                 int count = 0;
                 for (Iterator iterator = methodList.iterator(); iterator
                         .hasNext();) {
-                    MethodData method = (MethodData) iterator.next();
-                    if (method.getMethodName().equals(
-                            startPointer.getMethodName())) {
+                    Operation operation = (Operation) iterator.next();
+                    if (operation.getOperationName().equals(
+                            startPointer.getOperationName())) {
                         count++;
                     }
                 }
                 for (Iterator iterator = methodList.iterator(); iterator
                         .hasNext();) {
-                    MethodData method = (MethodData) iterator.next();
-                    if (method.getMethodName().equals(
-                            startPointer.getMethodName())) {
+                    Operation operation = (Operation) iterator.next();
+                    if (operation.getOperationName().equals(
+                            startPointer.getOperationName())) {
                         if (count > 1) {
-                            method.setOverload(true);
+                            operation.setOverloaded(true);
                         }
                     }
                 }
@@ -227,9 +232,11 @@
      * @param directoryPath  archive id
      * @param data       info array. data contains the excluded method names.
      * @throws AxisFault will be thrown
+     * @throws DuplicateServiceException If a service which already exists is trying to be created
      */
     public void createAndDeployService(String directoryPath,
-                                       ClassMethodsData[] data) throws AxisFault {
+                                       Service[] data) throws AxisFault,
+                                                                       DuplicateServiceException {
         String archiveFileName = UUIDGenerator.getUUID();
 
 
@@ -251,6 +258,8 @@
             OMElement servicesXML = createServicesXML(data);
             servicesXML.build();
             servicesXML.serialize(os);
+        } catch (DuplicateServiceException e) {
+            throw e;
         } catch (Exception e) {
             String msg = "Cannot write services XML";
             log.error(msg, e);
@@ -288,15 +297,24 @@
         }
     }
 
-    private OMElement createServicesXML(ClassMethodsData[] data) {
+    private OMElement createServicesXML(Service[] data) throws DuplicateServiceException {
         OMFactory factory = OMAbstractFactory.getOMFactory();
         OMNamespace emptyNS = factory.createOMNamespace("", "");
         OMElement serviceGroupEle = factory.createOMElement("serviceGroup", "", "");
 
         for (int i = 0; i < data.length; i++) {
-            ClassMethodsData datum = data[i];
+            Service datum = data[i];
             String serviceClass = datum.getClassName();
-            String serviceName = serviceClass.substring(serviceClass.lastIndexOf(".") + 1);
+            String serviceName = datum.getServiceName();
+            AxisConfiguration axisConfig = MessageContext.getCurrentMessageContext().getConfigurationContext().getAxisConfiguration();
+            try {
+                if(axisConfig.getService(serviceName) != null) {
+                    String msg = "An Axis2 service  with name " + serviceName + " already exists";
+                    log.warn(msg);
+                    throw new DuplicateServiceException(msg);
+                }
+            } catch (AxisFault ignored) {
+            }
 
             OMElement serviceEle = factory.createOMElement("service", "", "");
 
@@ -341,15 +359,15 @@
             serviceEle.addChild(serviceTypeParamEle);
             
             // Operations
-            MethodData[] methodData = datum.getMethods();
-            if (methodData != null) {
-                if (methodData.length > 0) {
+            Operation[] operation = datum.getOperations();
+            if (operation != null) {
+                if (operation.length > 0) {
                     OMElement excludesEle = factory.createOMElement(
                             "excludeOperations", "", "");
                     serviceEle.addChild(excludesEle);
                     List operationDuplicationList = new ArrayList();
-                    for (int j = 0; j < methodData.length; j++) {
-                        String methodName = methodData[j].getMethodName();
+                    for (int j = 0; j < operation.length; j++) {
+                        String methodName = operation[j].getOperationName();
                         if (!operationDuplicationList.contains(methodName)) {
                             OMElement operationEle = factory.createOMElement(
                                     "operation", "", "");

Deleted: trunk/carbon-components/jar-services/org.wso2.carbon.jarservices/src/main/java/org/wso2/carbon/jarservices/MethodData.java
URL: http://wso2.org/svn/browse/wso2/None?pathrev=31329

Copied: trunk/carbon-components/jar-services/org.wso2.carbon.jarservices/src/main/java/org/wso2/carbon/jarservices/Operation.java (from r31246, /trunk/carbon-components/jar-services/org.wso2.carbon.jarservices/src/main/java/org/wso2/carbon/jarservices/MethodData.java)
URL: http://wso2.org/svn/browse/wso2/trunk/carbon-components/jar-services/org.wso2.carbon.jarservices/src/main/java/org/wso2/carbon/jarservices/Operation.java?rev=31330&r1=31246&r2=31330&view=diff
==============================================================================
--- /trunk/carbon-components/jar-services/org.wso2.carbon.jarservices/src/main/java/org/wso2/carbon/jarservices/MethodData.java	(original)
+++ trunk/carbon-components/jar-services/org.wso2.carbon.jarservices/src/main/java/org/wso2/carbon/jarservices/Operation.java	Mon Feb 23 07:52:36 2009
@@ -18,23 +18,26 @@
 /**
  * This util class will hold information related to public method.
  */
-public class MethodData {
-    private String methodName;
-    private boolean overload;
+public class Operation {
+    private String operationName;
+    private boolean isOverloaded;
 
-    public String getMethodName() {
-        return methodName;
+    public Operation() {
     }
 
-    public void setMethodName(String methodName) {
-        this.methodName = methodName;
+    public String getOperationName() {
+        return operationName;
     }
 
-    public boolean isOverload() {
-        return overload;
+    public void setOperationName(String operationName) {
+        this.operationName = operationName;
     }
 
-    public void setOverload(boolean overload) {
-        this.overload = overload;
+    public boolean isOverloaded() {
+        return isOverloaded;
+    }
+
+    public void setOverloaded(boolean overloaded) {
+        isOverloaded = overloaded;
     }
 }

Copied: trunk/carbon-components/jar-services/org.wso2.carbon.jarservices/src/main/java/org/wso2/carbon/jarservices/Service.java (from r31246, /trunk/carbon-components/jar-services/org.wso2.carbon.jarservices/src/main/java/org/wso2/carbon/jarservices/ClassMethodsData.java)
URL: http://wso2.org/svn/browse/wso2/trunk/carbon-components/jar-services/org.wso2.carbon.jarservices/src/main/java/org/wso2/carbon/jarservices/Service.java?rev=31330&r1=31246&r2=31330&view=diff
==============================================================================
--- /trunk/carbon-components/jar-services/org.wso2.carbon.jarservices/src/main/java/org/wso2/carbon/jarservices/ClassMethodsData.java	(original)
+++ trunk/carbon-components/jar-services/org.wso2.carbon.jarservices/src/main/java/org/wso2/carbon/jarservices/Service.java	Mon Feb 23 07:52:36 2009
@@ -16,11 +16,16 @@
 package org.wso2.carbon.jarservices;
 
 /**
- * This util class holds the information of class and it related public methods
+ * This util class holds the information of Service
  */
-public class ClassMethodsData {
+public class Service {
     private String className;
-    private MethodData[] methods;
+    private String serviceName;
+    private String deploymentScope;
+    private Operation[] operations;
+
+    public Service() {
+    }
 
     public String getClassName() {
         return className;
@@ -30,11 +35,27 @@
         this.className = className;
     }
 
-    public MethodData[] getMethods() {
-        return methods;
+    public Operation[] getOperations() {
+        return operations;
+    }
+
+    public void setOperations(Operation[] operations) {
+        this.operations = operations;
+    }
+
+    public String getServiceName() {
+        return serviceName;
+    }
+
+    public void setServiceName(String serviceName) {
+        this.serviceName = serviceName;
+    }
+
+    public String getDeploymentScope() {
+        return deploymentScope;
     }
 
-    public void setMethods(MethodData[] methods) {
-        this.methods = methods;
+    public void setDeploymentScope(String deploymentScope) {
+        this.deploymentScope = deploymentScope;
     }
 }

Modified: trunk/carbon-components/jar-services/org.wso2.carbon.jarservices/src/main/java/org/wso2/carbon/jarservices/UploadArtifactsResponse.java
URL: http://wso2.org/svn/browse/wso2/trunk/carbon-components/jar-services/org.wso2.carbon.jarservices/src/main/java/org/wso2/carbon/jarservices/UploadArtifactsResponse.java?rev=31330&r1=31329&r2=31330&view=diff
==============================================================================
--- trunk/carbon-components/jar-services/org.wso2.carbon.jarservices/src/main/java/org/wso2/carbon/jarservices/UploadArtifactsResponse.java	(original)
+++ trunk/carbon-components/jar-services/org.wso2.carbon.jarservices/src/main/java/org/wso2/carbon/jarservices/UploadArtifactsResponse.java	Mon Feb 23 07:52:36 2009
@@ -21,14 +21,14 @@
 public class UploadArtifactsResponse {
     private String primaryResourceFilePath;
     private String resourcesDirPath;
-    private String[] classes;
+    private Service[] services;
 
-    public String[] getClasses() {
-        return classes;
+    public Service[] getServices() {
+        return services;
     }
 
-    public void setClasses(String[] classes) {
-        this.classes = classes;
+    public void setServices(Service[] services) {
+        this.services = services;
     }
 
     public String getPrimaryResourceFilePath() {



More information about the Carbon-dev mailing list