You are viewing a plain text version of this content. The canonical link for it is here.
Posted to java-dev@axis.apache.org by gd...@apache.org on 2006/04/12 04:58:35 UTC

svn commit: r393371 - in /webservices/axis2/trunk/java/modules: common/src/org/apache/axis2/i18n/ core/src/org/apache/axis2/deployment/ core/src/org/apache/axis2/description/ core/test-resources/deployment/ core/test/org/apache/axis2/deployment/

Author: gdaniels
Date: Tue Apr 11 19:58:33 2006
New Revision: 393371

URL: http://svn.apache.org/viewcvs?rev=393371&view=rev
Log:
* A recent change cause the FileSystemConfigurator to ignore an "axis2.xml" that was in the specified repository on the SimpleHTTPServer command line.  Fix this so that the FSC looks first for a specific filename passed as a constructor arg, then for a file named per the "axis2.xml" system property, and then for "axis2.xml" in the repository directory.

* The TransportDeploymentTest wasn't actually testing the FileSystemConfigurator correctly.  Since it was looking for the "http" transport, the fact that it was actually getting its configuration from the axis2.xml on the classpath was obscured.  Changing this to "custom" (and adding the transport deployment to the XML file) now confirms that the correct file is being processed, and the test passes due to the above change.

* When there's a problem figuring out the transport in ClientUtils, produce more useful errors.

Modified:
    webservices/axis2/trunk/java/modules/common/src/org/apache/axis2/i18n/resource.properties
    webservices/axis2/trunk/java/modules/core/src/org/apache/axis2/deployment/FileSystemConfigurator.java
    webservices/axis2/trunk/java/modules/core/src/org/apache/axis2/description/ClientUtils.java
    webservices/axis2/trunk/java/modules/core/test-resources/deployment/server-transport.xml
    webservices/axis2/trunk/java/modules/core/test/org/apache/axis2/deployment/TransportDeploymentTest.java

Modified: webservices/axis2/trunk/java/modules/common/src/org/apache/axis2/i18n/resource.properties
URL: http://svn.apache.org/viewcvs/webservices/axis2/trunk/java/modules/common/src/org/apache/axis2/i18n/resource.properties?rev=393371&r1=393370&r2=393371&view=diff
==============================================================================
--- webservices/axis2/trunk/java/modules/common/src/org/apache/axis2/i18n/resource.properties (original)
+++ webservices/axis2/trunk/java/modules/common/src/org/apache/axis2/i18n/resource.properties Tue Apr 11 19:58:33 2006
@@ -27,7 +27,8 @@
 errorWhileSafeShutDown=Error during safe shutdown
 invaliduser=Invalid user name
 invalidSOAPversion=Invalid SOAP URI. Axis2 only supports SOAP 1.1 and 1.2
-cannotInferTransport=Cannot infer transport information from the URL information provided
+cannotInferTransport=Cannot infer transport information from the URL {0}
+cannotInferTransportNoAddr=No address information in EPR, cannot infer transport
 cannotBeNullAxisOperation=Axis Operation can not be null
 cannotBeNullServiceContext=ServiceContext can not be null
 cannotBeNullConfigurationContext=ConfigurationContext can not be null

Modified: webservices/axis2/trunk/java/modules/core/src/org/apache/axis2/deployment/FileSystemConfigurator.java
URL: http://svn.apache.org/viewcvs/webservices/axis2/trunk/java/modules/core/src/org/apache/axis2/deployment/FileSystemConfigurator.java?rev=393371&r1=393370&r2=393371&view=diff
==============================================================================
--- webservices/axis2/trunk/java/modules/core/src/org/apache/axis2/deployment/FileSystemConfigurator.java (original)
+++ webservices/axis2/trunk/java/modules/core/src/org/apache/axis2/deployment/FileSystemConfigurator.java Tue Apr 11 19:58:33 2006
@@ -49,46 +49,53 @@
     public FileSystemConfigurator(String repoLocation, String axis2xml) {
         if (repoLocation == null) {
             //checking wether user has set the system property
-            String propertyRepo = System.getProperty(Constants.AXIS2_REPO);
-            if (propertyRepo != null) {
-                try {
-                    File repo = new File(propertyRepo);
-                    if (repo.exists()) {
-                        this.repoLocation = repo.getAbsolutePath();
-                    } else {
-                        this.repoLocation = null;
-                    }
-                } catch (Exception e) {
-                    this.repoLocation = null;
-                    log.info("Error in file creation inside FileSystemConfigurator");
-                }
-            } else {
-                this.repoLocation = null;
+            repoLocation = System.getProperty(Constants.AXIS2_REPO);
+            if (repoLocation == null) {
+                // Should we default to anything here?  Current
+                // directory?  ~/.axis?
             }
-        } else {
-            this.repoLocation = repoLocation;
         }
+
+        // OK, we've got a repository location in mind.  Let's make
+        // sure it exists.
+        try {
+            File repo = new File(repoLocation);
+            if (repo.exists()) {
+                // ok, save it if so
+                this.repoLocation = repo.getAbsolutePath();
+            }
+        } catch (Exception e) {
+            log.info("Couldn't find repository location '" +
+                    repoLocation + "'");
+            this.repoLocation = null;
+        }
+
+        // Deal with the config file.  If a filename was specified as an
+        // arg to this constructor, just respect it.
         if (axis2xml == null) {
-            String propertyAxis2xml = System.getProperty(Constants.AXIS2_CONF);
-            if (propertyAxis2xml != null) {
-                try {
-                    File axis2discriptor = new File(propertyAxis2xml);
-                    if (axis2discriptor.exists()) {
-                        this.axis2xml = axis2discriptor.getAbsolutePath();
-                    } else {
-                        this.axis2xml = null;
-                    }
-                } catch (Exception e) {
-                    this.axis2xml = null;
-                    log.info("Error in file (axis2.xml) creation inside FileSystemConfigurator");
-                }
+            // If not, check for a system property setting
+            axis2xml = System.getProperty(Constants.AXIS2_CONF);
 
-            } else {
-                this.axis2xml = null;
+            // If system property not set, use default filename
+            if (axis2xml == null) {
+                axis2xml = Constants.AXIS2_CONF;
+            }
+
+            // In either case, check that the file exists... if not
+            // we'll use the default axis2.xml on the classpath.
+            try {
+                axis2xml = this.repoLocation + File.separator + axis2xml;
+                File configFile = new File(axis2xml);
+                if (!configFile.exists()) {
+                    axis2xml = null;
+                }
+            } catch (Exception e) {
+                axis2xml = null;
+                log.info("Error in file (axis2.xml) creation inside FileSystemConfigurator");
             }
-        } else {
-            this.axis2xml = axis2xml;
         }
+
+        this.axis2xml = axis2xml;
     }
 
     /**

Modified: webservices/axis2/trunk/java/modules/core/src/org/apache/axis2/description/ClientUtils.java
URL: http://svn.apache.org/viewcvs/webservices/axis2/trunk/java/modules/core/src/org/apache/axis2/description/ClientUtils.java?rev=393371&r1=393370&r2=393371&view=diff
==============================================================================
--- webservices/axis2/trunk/java/modules/core/src/org/apache/axis2/description/ClientUtils.java (original)
+++ webservices/axis2/trunk/java/modules/core/src/org/apache/axis2/description/ClientUtils.java Tue Apr 11 19:58:33 2006
@@ -28,11 +28,11 @@
             if (transport != null) {
                 return ac.getTransportOut(new QName(transport));
             } else {
-                throw new AxisFault(Messages.getMessage("cannotInferTransport"));
+                throw new AxisFault(Messages.getMessage("cannotInferTransport", transportURI));
             }
         } else {
             if (epr == null || (epr.getAddress() == null)) {
-                throw new AxisFault(Messages.getMessage("cannotInferTransport"));
+                throw new AxisFault(Messages.getMessage("cannotInferTransportNoAddr"));
             }
             String uri = epr.getAddress();
             int index = uri.indexOf(':');
@@ -40,7 +40,7 @@
             if (transport != null) {
                 return ac.getTransportOut(new QName(transport));
             } else {
-                throw new AxisFault(Messages.getMessage("cannotInferTransport"));
+                throw new AxisFault(Messages.getMessage("cannotInferTransport", uri));
             }
         }
     }

Modified: webservices/axis2/trunk/java/modules/core/test-resources/deployment/server-transport.xml
URL: http://svn.apache.org/viewcvs/webservices/axis2/trunk/java/modules/core/test-resources/deployment/server-transport.xml?rev=393371&r1=393370&r2=393371&view=diff
==============================================================================
--- webservices/axis2/trunk/java/modules/core/test-resources/deployment/server-transport.xml (original)
+++ webservices/axis2/trunk/java/modules/core/test-resources/deployment/server-transport.xml Tue Apr 11 19:58:33 2006
@@ -1,9 +1,9 @@
 <axisconfig name="AxisJava2.0">
     <messageReceiver mep="INOUT" class="org.apache.axis2.receivers.RawXMLINOutMessageReceiver"/>
-    <transportReceiver name="http">
+    <transportReceiver name="custom">
         <parameter name="para1" locked="xsd:true">10</parameter>
     </transportReceiver>
-    <transportSender name="http" class="org.apache.axis2.transport.http.CommonsHTTPTransportSender">
+    <transportSender name="custom" class="org.apache.axis2.transport.http.CommonsHTTPTransportSender">
         <parameter name="PROTOCOL" locked="false">HTTP/1.0</parameter>
     </transportSender>
  

Modified: webservices/axis2/trunk/java/modules/core/test/org/apache/axis2/deployment/TransportDeploymentTest.java
URL: http://svn.apache.org/viewcvs/webservices/axis2/trunk/java/modules/core/test/org/apache/axis2/deployment/TransportDeploymentTest.java?rev=393371&r1=393370&r2=393371&view=diff
==============================================================================
--- webservices/axis2/trunk/java/modules/core/test/org/apache/axis2/deployment/TransportDeploymentTest.java (original)
+++ webservices/axis2/trunk/java/modules/core/test/org/apache/axis2/deployment/TransportDeploymentTest.java Tue Apr 11 19:58:33 2006
@@ -45,10 +45,10 @@
         File xml = new File(xmlFile);
         FileSystemConfigurator fsc = new FileSystemConfigurator(repo.getAbsolutePath(), xml.getAbsolutePath());
         AxisConfiguration er = fsc.getAxisConfiguration();
-        TransportInDescription transport = er.getTransportIn(new QName("http"));
+        TransportInDescription transport = er.getTransportIn(new QName("custom"));
         assertNotNull(transport);
         TransportOutDescription transport1 = er.getTransportOut(
-                new QName("http"));
+                new QName("custom"));
         assertNotNull(transport1);
     }
 }