glyn 02/02/27 09:13:32
Modified: java/src/org/apache/axis/configuration FileProvider.java
ServletEngineConfigurationFactory.java
java/src/org/apache/axis/utils resources.properties
Log:
Further diagnostics improvements for configuration file problems.
Revision Changes Path
1.24 +22 -14
xml-axis/java/src/org/apache/axis/configuration/FileProvider.java
Index: FileProvider.java
===================================================================
RCS file:
/home/cvs/xml-axis/java/src/org/apache/axis/configuration/FileProvider.java,v
retrieving revision 1.23
retrieving revision 1.24
diff -u -r1.23 -r1.24
--- FileProvider.java 27 Feb 2002 14:54:27 -0000 1.23
+++ FileProvider.java 27 Feb 2002 17:13:32 -0000 1.24
@@ -96,8 +96,8 @@
protected WSDDDeployment deployment = null;
private static final String CURRENT_DIR = ".";
- protected String basepath;
protected String filename;
+ protected File configFile = null;
protected InputStream myInputStream = null;
@@ -109,18 +109,20 @@
/**
* Constructor which accesses a file in the current directory of the
- * engine.
+ * engine or at an absolute path.
*/
public FileProvider(String filename) {
- this(CURRENT_DIR, filename);
+ this.filename = filename;
+ configFile = new File(filename);
+ check();
}
/**
* Constructor which accesses a file relative to a specific base
* path.
*/
- public FileProvider(String basepath, String filename) {
- this.basepath = basepath;
+ public FileProvider(String basepath, String filename)
+ throws ConfigurationException {
this.filename = filename;
File dir = new File(basepath);
@@ -130,13 +132,21 @@
* exception to make it easier to debug setup problems.
*/
if (!dir.isDirectory() || !dir.canRead()) {
- throw new InternalException(JavaUtils.
- getMessage("invalidConfigFilePath",
- basepath));
+ throw new ConfigurationException(JavaUtils.getMessage
+ ("invalidConfigFilePath",
+ basepath));
}
- File file = new File(basepath, filename);
- readOnly = file.canRead() & !file.canWrite();
+ configFile = new File(basepath, filename);
+ check();
+ }
+
+ /**
+ * Check the configuration file attributes and remember whether
+ * or not the file is read-only.
+ */
+ private void check() {
+ readOnly = configFile.canRead() & !configFile.canWrite();
/*
* If file is read-only, log informational message
@@ -178,8 +188,7 @@
try {
if (myInputStream == null) {
try {
- myInputStream = new FileInputStream(basepath + sep +
- filename);
+ myInputStream = new FileInputStream(configFile);
} catch (Exception e) {
if (searchClasspath) {
myInputStream = engine.getClass().
@@ -219,8 +228,7 @@
StringWriter writer = new StringWriter();
XMLUtils.DocumentToWriter(doc, writer);
writer.close();
- FileOutputStream fos = new FileOutputStream(basepath + sep +
- filename);
+ FileOutputStream fos = new FileOutputStream(configFile);
fos.write(writer.getBuffer().toString().getBytes());
fos.close();
} catch (Exception e) {
1.2 +15 -3
xml-axis/java/src/org/apache/axis/configuration/ServletEngineConfigurationFactory.java
Index: ServletEngineConfigurationFactory.java
===================================================================
RCS file:
/home/cvs/xml-axis/java/src/org/apache/axis/configuration/ServletEngineConfigurationFactory.java,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- ServletEngineConfigurationFactory.java 14 Feb 2002 17:12:01 -0000 1.1
+++ ServletEngineConfigurationFactory.java 27 Feb 2002 17:13:32 -0000 1.2
@@ -57,7 +57,11 @@
import org.apache.axis.EngineConfigurationFactory;
import org.apache.axis.EngineConfiguration;
+import org.apache.axis.ConfigurationException;
import org.apache.axis.Constants;
+import org.apache.axis.utils.JavaUtils;
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
import javax.servlet.ServletContext;
@@ -78,6 +82,8 @@
* @author Davanum Srinivas ([EMAIL PROTECTED])
*/
public class ServletEngineConfigurationFactory extends
DefaultEngineConfigurationFactory {
+ protected static Log log =
+ LogFactory.getLog(ServletEngineConfigurationFactory.class.getName());
private ServletContext ctx;
@@ -122,9 +128,15 @@
SERVER_CONFIG_FILE);
if (is != null) config = new FileProvider(is);
}
- if ( config == null )
- config = new FileProvider(webInfPath,
- SERVER_CONFIG_FILE);
+ if ( config == null ) {
+ try {
+ config = new FileProvider(webInfPath,
+ SERVER_CONFIG_FILE);
+ } catch (ConfigurationException ex) {
+ log.error(JavaUtils.getMessage
+ ("servletEngineWebInfError00"), ex);
+ }
+ }
return config;
} else {
return userFactory.getServerEngineConfig();
1.62 +7 -2 xml-axis/java/src/org/apache/axis/utils/resources.properties
Index: resources.properties
===================================================================
RCS file: /home/cvs/xml-axis/java/src/org/apache/axis/utils/resources.properties,v
retrieving revision 1.61
retrieving revision 1.62
diff -u -r1.61 -r1.62
--- resources.properties 26 Feb 2002 15:23:22 -0000 1.61
+++ resources.properties 27 Feb 2002 17:13:32 -0000 1.62
@@ -219,6 +219,8 @@
internalError00=Internal error
internalError01=Internal server error
+invalidConfigFilePath=Configuration file directory ''{0}'' is not readable.
+
invalidWSDD00=Invalid WSDD element ''{0}'' (wanted ''{1}'')
# NOTE: in invokeGet00, do no translate "GET"
@@ -292,8 +294,6 @@
noEngineWSDD=Engine configuration is not present or not WSDD!
-readOnlyConfigFile=Configuration file read-only so engine configuration changes
will not be saved.
-
noHandler00=Cannot locate handler: {0}
# NOTE: in noHandler01, do not translate "QName"
@@ -469,6 +469,8 @@
# NOTE: in reachedServlet00, do not translate "AXIS HTTP Servlet", "URL", "SOAP"
reachedServlet00=Hi, you have reached the AXIS HTTP Servlet. Normally you would be
hitting this URL with a SOAP client rather than a browser.
+readOnlyConfigFile=Configuration file read-only so engine configuration changes
will not be saved.
+
register00=register ''{0}'' - ''{1}''
registerTypeMap00=Registering type mapping {0} -> {1}
registryAdd00=Registry {0} adding ''{1}'' ({2})
@@ -496,6 +498,9 @@
serverRun00=Server is running
serverStop00=Server is stopped
+
+servletEngineWebInfError00=Problem with servlet engine /WEB-INF directory
+
setCurrMsg00=Setting current message form to: {0} (current message is now {1})
setProp00=Setting {0} property in {1}