You are viewing a plain text version of this content. The canonical link for it is here.
Posted to axis-cvs@ws.apache.org by de...@apache.org on 2006/03/03 14:33:40 UTC

svn commit: r382805 - in /webservices/axis2/trunk/java/modules: codegen/src/org/apache/axis2/wsdl/template/general/ core/src/org/apache/axis2/ core/src/org/apache/axis2/deployment/ core/src/org/apache/axis2/deployment/listener/ core/src/org/apache/axis...

Author: deepal
Date: Fri Mar  3 05:33:39 2006
New Revision: 382805

URL: http://svn.apache.org/viewcvs?rev=382805&view=rev
Log:
- changed wsamapping into actionMapping
- hot update for directories
- module engagement will throw an error when try to engage not exist module
- module will be notify when they engage to an operation
- Auto start of AxisServelet
- and few more bug fixes

Modified:
    webservices/axis2/trunk/java/modules/codegen/src/org/apache/axis2/wsdl/template/general/ServiceXMLTemplate.xsl
    webservices/axis2/trunk/java/modules/core/src/org/apache/axis2/Constants.java
    webservices/axis2/trunk/java/modules/core/src/org/apache/axis2/deployment/ModuleBuilder.java
    webservices/axis2/trunk/java/modules/core/src/org/apache/axis2/deployment/ServiceBuilder.java
    webservices/axis2/trunk/java/modules/core/src/org/apache/axis2/deployment/listener/RepositoryListenerImpl.java
    webservices/axis2/trunk/java/modules/core/src/org/apache/axis2/deployment/repository/util/WSInfoList.java
    webservices/axis2/trunk/java/modules/core/src/org/apache/axis2/description/AxisService.java
    webservices/axis2/trunk/java/modules/core/src/org/apache/axis2/transport/http/SimpleHTTPServer.java
    webservices/axis2/trunk/java/modules/core/test/org/apache/axis2/deployment/SameServiceAddingTest.java
    webservices/axis2/trunk/java/modules/samples/src/userguide/example3/META-INF/services.xml
    webservices/axis2/trunk/java/modules/webapp/conf/web.xml

Modified: webservices/axis2/trunk/java/modules/codegen/src/org/apache/axis2/wsdl/template/general/ServiceXMLTemplate.xsl
URL: http://svn.apache.org/viewcvs/webservices/axis2/trunk/java/modules/codegen/src/org/apache/axis2/wsdl/template/general/ServiceXMLTemplate.xsl?rev=382805&r1=382804&r2=382805&view=diff
==============================================================================
--- webservices/axis2/trunk/java/modules/codegen/src/org/apache/axis2/wsdl/template/general/ServiceXMLTemplate.xsl (original)
+++ webservices/axis2/trunk/java/modules/codegen/src/org/apache/axis2/wsdl/template/general/ServiceXMLTemplate.xsl Fri Mar  3 05:33:39 2006
@@ -46,9 +46,9 @@
 				<operation>
 					<xsl:attribute name="name"><xsl:value-of select="@name"/></xsl:attribute>
 					<xsl:attribute name="mep"><xsl:value-of select="@mep"/></xsl:attribute>
-					<wsamapping>
+					<actionMapping>
 						<xsl:value-of select="@soapaction"/>
-					</wsamapping>
+					</actionMapping>
 				</operation>
 			</xsl:for-each>
         </service>

Modified: webservices/axis2/trunk/java/modules/core/src/org/apache/axis2/Constants.java
URL: http://svn.apache.org/viewcvs/webservices/axis2/trunk/java/modules/core/src/org/apache/axis2/Constants.java?rev=382805&r1=382804&r2=382805&view=diff
==============================================================================
--- webservices/axis2/trunk/java/modules/core/src/org/apache/axis2/Constants.java (original)
+++ webservices/axis2/trunk/java/modules/core/src/org/apache/axis2/Constants.java Fri Mar  3 05:33:39 2006
@@ -152,7 +152,7 @@
     public static final String ENGAGE_STATUS = "engagestatus";
     public static final String CONFIG_CONTEXT = "config_context";
     public static final String WSDL_CONTENT = "wsdl";
-    public static final String WSA_ACTION = "wsamapping";
+    public static final String ACTION_MAPPING = "actionMapping";
     public static final String VALUE_TRUE = "true";
     public static final String VALUE_FALSE = "false";
     public static final String TESTING_PATH = "target/test-resources/";

Modified: webservices/axis2/trunk/java/modules/core/src/org/apache/axis2/deployment/ModuleBuilder.java
URL: http://svn.apache.org/viewcvs/webservices/axis2/trunk/java/modules/core/src/org/apache/axis2/deployment/ModuleBuilder.java?rev=382805&r1=382804&r2=382805&view=diff
==============================================================================
--- webservices/axis2/trunk/java/modules/core/src/org/apache/axis2/deployment/ModuleBuilder.java (original)
+++ webservices/axis2/trunk/java/modules/core/src/org/apache/axis2/deployment/ModuleBuilder.java Fri Mar  3 05:33:39 2006
@@ -226,7 +226,7 @@
             processParameters(parameters, op_descrip, module);
 
             //To process wsamapping;
-            Iterator mappingIterator = operation.getChildrenWithName(new QName(Constants.WSA_ACTION));
+            Iterator mappingIterator = operation.getChildrenWithName(new QName(Constants.ACTION_MAPPING));
             if (mappingIterator != null) {
                 ArrayList wsamappings = processWsaMapping(mappingIterator);
                 op_descrip.setWsamappingList(wsamappings);

Modified: webservices/axis2/trunk/java/modules/core/src/org/apache/axis2/deployment/ServiceBuilder.java
URL: http://svn.apache.org/viewcvs/webservices/axis2/trunk/java/modules/core/src/org/apache/axis2/deployment/ServiceBuilder.java?rev=382805&r1=382804&r2=382805&view=diff
==============================================================================
--- webservices/axis2/trunk/java/modules/core/src/org/apache/axis2/deployment/ServiceBuilder.java (original)
+++ webservices/axis2/trunk/java/modules/core/src/org/apache/axis2/deployment/ServiceBuilder.java Fri Mar  3 05:33:39 2006
@@ -343,7 +343,7 @@
             Iterator parameters = operation.getChildrenWithName(new QName(TAG_PARAMETER));
             processParameters(parameters, op_descrip, service);
             //To process wsamapping;
-            Iterator mappingIterator = operation.getChildrenWithName(new QName(Constants.WSA_ACTION));
+            Iterator mappingIterator = operation.getChildrenWithName(new QName(Constants.ACTION_MAPPING));
             if (mappingIterator != null) {
                 ArrayList wsamappings = processWsaMapping(mappingIterator);
                 op_descrip.setWsamappingList(wsamappings);

Modified: webservices/axis2/trunk/java/modules/core/src/org/apache/axis2/deployment/listener/RepositoryListenerImpl.java
URL: http://svn.apache.org/viewcvs/webservices/axis2/trunk/java/modules/core/src/org/apache/axis2/deployment/listener/RepositoryListenerImpl.java?rev=382805&r1=382804&r2=382805&view=diff
==============================================================================
--- webservices/axis2/trunk/java/modules/core/src/org/apache/axis2/deployment/listener/RepositoryListenerImpl.java (original)
+++ webservices/axis2/trunk/java/modules/core/src/org/apache/axis2/deployment/listener/RepositoryListenerImpl.java Fri Mar  3 05:33:39 2006
@@ -141,9 +141,9 @@
      * Finds a list of services in the folder and adds to wsInfoList.
      */
     public void checkServices() {
-        String modulepath = folderName + SERVICE_PATH;
+        String servicedir = folderName + SERVICE_PATH;
 
-        findServicesInDirectory(modulepath);
+        findServicesInDirectory(servicedir);
         update();
     }
 

Modified: webservices/axis2/trunk/java/modules/core/src/org/apache/axis2/deployment/repository/util/WSInfoList.java
URL: http://svn.apache.org/viewcvs/webservices/axis2/trunk/java/modules/core/src/org/apache/axis2/deployment/repository/util/WSInfoList.java?rev=382805&r1=382804&r2=382805&view=diff
==============================================================================
--- webservices/axis2/trunk/java/modules/core/src/org/apache/axis2/deployment/repository/util/WSInfoList.java (original)
+++ webservices/axis2/trunk/java/modules/core/src/org/apache/axis2/deployment/repository/util/WSInfoList.java Fri Mar  3 05:33:39 2006
@@ -31,7 +31,7 @@
      * This is to store all the jar files in a specified folder (WEB_INF)
      */
     private static List jarList = new ArrayList();
-    private boolean check = false;   
+    private boolean check = false;
 
     /**
      * All the curently updated jars
@@ -50,12 +50,12 @@
     /**
      * First checks whether the file is already available by the
      * system call isFileExist. If it is not deployed yet then adds to the jarList
-     * and to the deployment engine as a new service or module. 
-     * While adding new item to jarList, first creates the WSInfo object and 
+     * and to the deployment engine as a new service or module.
+     * While adding new item to jarList, first creates the WSInfo object and
      * then adds to the jarlist and actual jar file is added to DeploymentEngine.
      * <p/>
      * If the files already exists, then checks whether it has been updated
-     * then changes the last update date of the wsInfo and adds two entries to 
+     * then changes the last update date of the wsInfo and adds two entries to
      * DeploymentEngine - one for New Deployment and other for undeployment.
      *
      * @param file actual jar files for either Module or service
@@ -75,7 +75,6 @@
                 } else {
                     if (deployer.isHotUpdate()) {
                         WSInfo tempWSInfo = getFileItem(file.getName());
-
                         if (isModified(file, tempWSInfo)) {    // check whether file is updated
                             tempWSInfo.setLastModifiedDate(file.lastModified());
 
@@ -103,7 +102,7 @@
                     ArchiveFileData archiveFileData = new ArchiveFileData(file, TYPE_MODULE);
 
                     deployer.addWSToDeploy(archiveFileData);    // inform that new web service is deployed
-                } 
+                }
 
                 break;
             }
@@ -121,7 +120,7 @@
      * list then it is assumed that the jar file has been removed
      * and that is hot undeployment.
      */
-    public void checkForUndeployedServices() {
+    private void checkForUndeployedServices() {
         if (!check) {
             return;
         } else {
@@ -198,11 +197,11 @@
     }
 
     /**
-     * Gets the WSInfo object related to a file if it exists, null otherwise. 
+     * Gets the WSInfo object related to a file if it exists, null otherwise.
      *
      * @param filename
      */
-    public WSInfo getFileItem(String filename) {
+    private WSInfo getFileItem(String filename) {
         int sise = jarList.size();
 
         for (int i = 0; i < sise; i++) {
@@ -221,19 +220,59 @@
      *
      * @param filename
      */
-    public boolean isFileExist(String filename) {
+    private boolean isFileExist(String filename) {
         return !(getFileItem(filename) == null);
     }
 
     /**
-     * Checks if a file has been modified by comparing the last update date of 
-     * both files and WSInfo. If they are different, the file is assumed to have 
+     * Checks if a file has been modified by comparing the last update date of
+     * both files and WSInfo. If they are different, the file is assumed to have
      * been modified.
      *
      * @param file
      * @param wsInfo
      */
-    public boolean isModified(File file, WSInfo wsInfo) {
-        return (wsInfo.getLastModifiedDate() != file.lastModified());
+    private boolean isModified(File file, WSInfo wsInfo) {
+        if (file.isDirectory()) {
+            if (isChanged(file, wsInfo.getLastModifiedDate(), wsInfo)) {
+                setLastModifiedDate(file, wsInfo);
+                return true;
+            } else {
+                return false;
+            }
+        } else {
+            return (wsInfo.getLastModifiedDate() != file.lastModified());
+        }
+    }
+
+    private void setLastModifiedDate(File file, WSInfo wsInfo) {
+        File files [] = file.listFiles();
+        for (int i = 0; i < files.length; i++) {
+            File fileItem = files[i];
+            if (fileItem.isDirectory()) {
+                setLastModifiedDate(fileItem, wsInfo);
+            } else {
+                fileItem.setLastModified(wsInfo.getLastModifiedDate());
+            }
+        }
+    }
+
+    private boolean isChanged(File file, long lastModifedData, WSInfo wsInfo) {
+        File files [] = file.listFiles();
+        for (int i = 0; i < files.length; i++) {
+            File fileItem = files[i];
+            if (fileItem.isDirectory()) {
+                if (isChanged(fileItem, lastModifedData, wsInfo)) {
+                    wsInfo.setLastModifiedDate(fileItem.lastModified());
+                    return true;
+                }
+            } else {
+                if (lastModifedData != fileItem.lastModified()) {
+                    wsInfo.setLastModifiedDate(fileItem.lastModified());
+                    return true;
+                }
+            }
+        }
+        return false;
     }
 }

Modified: webservices/axis2/trunk/java/modules/core/src/org/apache/axis2/description/AxisService.java
URL: http://svn.apache.org/viewcvs/webservices/axis2/trunk/java/modules/core/src/org/apache/axis2/description/AxisService.java?rev=382805&r1=382804&r2=382805&view=diff
==============================================================================
--- webservices/axis2/trunk/java/modules/core/src/org/apache/axis2/description/AxisService.java (original)
+++ webservices/axis2/trunk/java/modules/core/src/org/apache/axis2/description/AxisService.java Fri Mar  3 05:33:39 2006
@@ -274,9 +274,8 @@
     public void engageModule(AxisModule moduleref, AxisConfiguration axisConfig)
             throws AxisFault {
         if (moduleref == null) {
-            return;
+            throw new AxisFault("Module not found ");
         }
-
         boolean needToadd = true;
         Iterator itr_engageModules = engagedModules.iterator();
 

Modified: webservices/axis2/trunk/java/modules/core/src/org/apache/axis2/transport/http/SimpleHTTPServer.java
URL: http://svn.apache.org/viewcvs/webservices/axis2/trunk/java/modules/core/src/org/apache/axis2/transport/http/SimpleHTTPServer.java?rev=382805&r1=382804&r2=382805&view=diff
==============================================================================
--- webservices/axis2/trunk/java/modules/core/src/org/apache/axis2/transport/http/SimpleHTTPServer.java (original)
+++ webservices/axis2/trunk/java/modules/core/src/org/apache/axis2/transport/http/SimpleHTTPServer.java Fri Mar  3 05:33:39 2006
@@ -230,7 +230,6 @@
             }
         }
         if (embedded != null) {
-            // todo this has to fix
             return new EndpointReference("http://" + hostAddress + ":" + (embedded.getLocalPort())
                     + "/axis2/services/" + serviceName);
         } else {

Modified: webservices/axis2/trunk/java/modules/core/test/org/apache/axis2/deployment/SameServiceAddingTest.java
URL: http://svn.apache.org/viewcvs/webservices/axis2/trunk/java/modules/core/test/org/apache/axis2/deployment/SameServiceAddingTest.java?rev=382805&r1=382804&r2=382805&view=diff
==============================================================================
--- webservices/axis2/trunk/java/modules/core/test/org/apache/axis2/deployment/SameServiceAddingTest.java (original)
+++ webservices/axis2/trunk/java/modules/core/test/org/apache/axis2/deployment/SameServiceAddingTest.java Fri Mar  3 05:33:39 2006
@@ -4,6 +4,7 @@
 import org.apache.axis2.AxisFault;
 import org.apache.axis2.context.ConfigurationContextFactory;
 import org.apache.axis2.description.AxisService;
+import org.apache.axis2.description.AxisServiceGroup;
 import org.apache.axis2.engine.AxisConfiguration;
 /*
 * Copyright 2004,2005 The Apache Software Foundation.
@@ -30,19 +31,45 @@
  */
 public class SameServiceAddingTest extends TestCase {
     AxisConfiguration ar;
-    String repo ="./test-resources/deployment/ServiceGroup";
-
 
     public void testServiceGroup() throws AxisFault {
-        ar = ConfigurationContextFactory.createConfigurationContextFromFileSystem(repo,null).getAxisConfiguration();
+        ar = ConfigurationContextFactory.createConfigurationContextFromFileSystem(null, null).getAxisConfiguration();
+        AxisServiceGroup axisServiceGroup1 = new AxisServiceGroup();
+        axisServiceGroup1.setServiceGroupName("ServiceGroup1");
+        AxisService service1 = new AxisService();
+        service1.setName("serevice1");
+        axisServiceGroup1.addService(service1);
+
+        AxisService service4 = new AxisService();
+        service4.setName("serevice4");
+        axisServiceGroup1.addService(service4);
+        ar.addServiceGroup(axisServiceGroup1);
+
+
+        AxisServiceGroup axisServiceGroup2 = new AxisServiceGroup();
+        axisServiceGroup2.setServiceGroupName("ServiceGroup2");
+        AxisService service2 = new AxisService();
+        service2.setName("serevice2");
+        axisServiceGroup2.addService(service2);
+
+        AxisService service24 = new AxisService();
+        service24.setName("serevice4");
+        axisServiceGroup2.addService(service24);
+        try {
+            ar.addServiceGroup(axisServiceGroup2);
+        } catch (AxisFault axisFault) {
+            //I have to ignore this
+        }
+
+
         AxisService servie = ar.getService("serevice1");
         assertNotNull(servie);
         servie = ar.getService("serevice4");
         assertNotNull(servie);
 
         servie = ar.getService("serevice2");
-        assertEquals(null,servie);
-        assertEquals(null,ar.getServiceGroup("service2"));
+        assertEquals(null, servie);
+        assertEquals(null, ar.getServiceGroup("service2"));
     }
 
 }

Modified: webservices/axis2/trunk/java/modules/samples/src/userguide/example3/META-INF/services.xml
URL: http://svn.apache.org/viewcvs/webservices/axis2/trunk/java/modules/samples/src/userguide/example3/META-INF/services.xml?rev=382805&r1=382804&r2=382805&view=diff
==============================================================================
--- webservices/axis2/trunk/java/modules/samples/src/userguide/example3/META-INF/services.xml (original)
+++ webservices/axis2/trunk/java/modules/samples/src/userguide/example3/META-INF/services.xml Fri Mar  3 05:33:39 2006
@@ -8,7 +8,7 @@
         <operation name="echo">
             <messageReceiver
                     class="org.apache.axis2.receivers.RawXMLINOutMessageReceiver"/>
-            <wsamapping>urn:sample/echo</wsamapping>
+            <actionMapping>urn:sample/echo</actionMapping>
         </operation>
     </service>
 </serviceGroup>

Modified: webservices/axis2/trunk/java/modules/webapp/conf/web.xml
URL: http://svn.apache.org/viewcvs/webservices/axis2/trunk/java/modules/webapp/conf/web.xml?rev=382805&r1=382804&r2=382805&view=diff
==============================================================================
--- webservices/axis2/trunk/java/modules/webapp/conf/web.xml (original)
+++ webservices/axis2/trunk/java/modules/webapp/conf/web.xml Fri Mar  3 05:33:39 2006
@@ -7,9 +7,8 @@
     <servlet>
         <servlet-name>AxisServlet</servlet-name>
         <display-name>Apache-Axis Servlet</display-name>
-        <servlet-class>
-        org.apache.axis2.transport.http.AxisServlet
-        </servlet-class>
+        <servlet-class>org.apache.axis2.transport.http.AxisServlet</servlet-class>
+        <load-on-startup>1</load-on-startup>
     </servlet>
 
     <servlet-mapping>