Index: java/src/wsif.properties
===================================================================
RCS file: /home/cvspublic/ws-wsif/java/src/wsif.properties,v
retrieving revision 1.7
diff -u -r1.7 wsif.properties
--- java/src/wsif.properties	9 May 2003 12:54:13 -0000	1.7
+++ java/src/wsif.properties	28 Jan 2004 18:47:37 -0000
@@ -26,7 +26,9 @@
 # maximum number of seconds to wait for a response to an async request. 
 # if not defined on invalid defaults to no timeout  
 wsif.asyncrequest.timeout=60
-wsif.servicefactory=customfactory.client.CustomServiceFactoryImpl
+
+# custom WSIFServiceFactory implementation.
+# wsif.servicefactory=customfactory.client.CustomServiceFactoryImpl
 
 # whether WSIF supports unreferenced attachments. Either on or off. Default is off.
 wsif.unreferencedattachments=off
Index: java/src/org/apache/wsif/WSIFServiceFactory.java
===================================================================
RCS file: /home/cvspublic/ws-wsif/java/src/org/apache/wsif/WSIFServiceFactory.java,v
retrieving revision 1.12
diff -u -r1.12 WSIFServiceFactory.java
--- java/src/org/apache/wsif/WSIFServiceFactory.java	6 Mar 2003 15:54:40 -0000	1.12
+++ java/src/org/apache/wsif/WSIFServiceFactory.java	28 Jan 2004 18:47:38 -0000
@@ -63,7 +63,9 @@
 import javax.wsdl.Service;
 
 import org.apache.wsif.base.WSIFServiceFactoryImpl;
+import org.apache.wsif.logging.MessageLogger;
 import org.apache.wsif.logging.Trc;
+import org.apache.wsif.util.WSIFProperties;
 import org.apache.wsif.util.WSIFUtils;
 
 /**
@@ -75,6 +77,8 @@
  */
 public abstract class WSIFServiceFactory {
 
+    private static final String SERVICE_FACTORY_PROPERTY = "wsif.servicefactory";
+
     /** 
      * Creates a new instance of an implementation the abstract
      * WSIFServiceFactory class.
@@ -82,7 +86,28 @@
     public static WSIFServiceFactory newInstance() {
         Trc.entry(null);
 
-        WSIFServiceFactoryImpl wsf = new WSIFServiceFactoryImpl();
+        WSIFServiceFactory wsf;
+    
+        String serviceFactoryName = WSIFProperties.getProperty(SERVICE_FACTORY_PROPERTY);
+        if ( serviceFactoryName == null ) {
+            wsf = new WSIFServiceFactoryImpl();
+        } else {
+            try {
+                wsf = (WSIFServiceFactory)Thread.currentThread().getContextClassLoader().loadClass(serviceFactoryName).newInstance();
+            } catch (InstantiationException e) {
+                Trc.exception(e);
+                MessageLogger.log("WSIF.0012W",new String[] {serviceFactoryName,e.getClass().getName(),e.getMessage()});
+                wsf = new WSIFServiceFactoryImpl();
+            } catch (IllegalAccessException e) {
+                Trc.exception(e);
+                MessageLogger.log("WSIF.0012W",new String[] {serviceFactoryName,e.getClass().getName(),e.getMessage()});
+                wsf = new WSIFServiceFactoryImpl();
+            } catch (ClassNotFoundException e) {
+                Trc.exception(e);
+                MessageLogger.log("WSIF.0012W",new String[] {serviceFactoryName,e.getClass().getName(),e.getMessage()});
+                wsf = new WSIFServiceFactoryImpl();
+            }
+        }
 
         // Create the simple types map for use by other WSIF classes
         WSIFUtils.createSimpleTypesMap();
Index: java/src/org/apache/wsif/catalog/Messages.properties
===================================================================
RCS file: /home/cvspublic/ws-wsif/java/src/org/apache/wsif/catalog/Messages.properties,v
retrieving revision 1.7
diff -u -r1.7 Messages.properties
--- java/src/org/apache/wsif/catalog/Messages.properties	7 Dec 2002 12:33:57 -0000	1.7
+++ java/src/org/apache/wsif/catalog/Messages.properties	28 Jan 2004 18:47:38 -0000
@@ -63,3 +63,29 @@
 # Parameter(s):    {0} the user's preferred port
 # Description:     The preferred port set by the user on org.apache.wsif.WSIFService is not available
 # User Action:     None unless this message appears for long periods of time in which case the user might want to pick a different port as their preferred port
+
+WSIF.0012W=WSIF0012W: Could not create instance of custom WSIFServiceFactory ''{0}'', using default instead. This was due to a ''{1}'': ''{2}''
+# Parameter(s):    {0} the class name of the custom factory.
+#                  {1} the class name of the exception causing the failure.
+#                  {2} the text of the message from the exception.
+# Description:     Failed to instantiate the custom WSIFServiceFactory for some reason.
+# User Action:     This could indicate the the class was not found, or not accessible. The user should check that 
+#                  the class name is correct, that the class is available from the calling thread's context classloader
+#                  and that the class is publicly accessible. Additionally, the class must have a default (no argument)
+#                  constructor, which must also be publicly accessible.
+
+WSIF.0013W=WSIF0013W: Could not load wsif.properties file ''{0}'', continuing to load from other files. This was due to a ''{1}'': {2}
+# Parameter(s):    {0} the URL of the properties file that failed to load.
+#                  {1} the class name of the exception caught.
+#                  {2} the text of the message from the exception.
+# Description:     Failed to load a wsif.properties file.
+# User Action:     This indicates that although a classloader reported the existance of a properties file, it could not
+#                  be loaded into the properties instance. This might be caused be a permissions problem, or some
+#                  kind of low level filesystem problem.
+
+WSIF.0014W=WSIF0014W: Could not load wsif.properties files from the context classloader, continuing with no properties loaded. This was due to a ''{0}'': ''{1}''
+# Parameter(s):    {0} the class name of the exception caught.
+#                  {1} the text of the message from the exception.
+# Description:     Failed to load the wsif.properties files.
+# User Action:     This indicates that the classloader had IO problems while attempting to find a list of wsif.properties files.
+#                  This probably indicates that one of the entries in the classpath is corrupt in some manner.
Index: java/src/org/apache/wsif/util/WSIFProperties.java
===================================================================
RCS file: /home/cvspublic/ws-wsif/java/src/org/apache/wsif/util/WSIFProperties.java,v
retrieving revision 1.6
diff -u -r1.6 WSIFProperties.java
--- java/src/org/apache/wsif/util/WSIFProperties.java	12 Mar 2003 11:42:25 -0000	1.6
+++ java/src/org/apache/wsif/util/WSIFProperties.java	28 Jan 2004 18:47:40 -0000
@@ -57,12 +57,15 @@
 
 package org.apache.wsif.util;
 
-import java.io.InputStream;
+import java.io.IOException;
+import java.net.URL;
 import java.security.AccessController;
 import java.security.PrivilegedAction;
+import java.util.Enumeration;
 import java.util.Properties;
 
 import org.apache.wsif.WSIFConstants;
+import org.apache.wsif.logging.MessageLogger;
 import org.apache.wsif.logging.Trc;
 
 /**
@@ -88,17 +91,18 @@
             properties =
                 (Properties) AccessController.doPrivileged(new PrivilegedAction() {
                 public Object run() {
-                    InputStream in = (Thread.currentThread().getContextClassLoader())
-                       .getResourceAsStream(WSIFConstants.WSIF_PROPERTIES);
-
-                    Properties p2 = new Properties();
+                    ClassLoader lContextCL = Thread.currentThread().getContextClassLoader();
+                    Enumeration lPropertyFileURLs;
                     try {
-                        p2.load(in);
-                    } catch (Exception ignored) {
-			        	Trc.exception(ignored);
+                        lPropertyFileURLs =
+                            lContextCL.getResources(WSIFConstants.WSIF_PROPERTIES);
+                    } catch (IOException e) {
+                        Trc.exception(e);
+                        MessageLogger.log("WSIF.0014W", e.getClass().getName(),e.getMessage());
                         return null;
                     }
-                    return p2;
+
+                    return buildPropertiesFromURLList(lPropertyFileURLs);
                 }
             });
         }
@@ -111,6 +115,23 @@
         String s = properties.getProperty(property);
         Trc.exit(s);
         return s;
+    }
+    
+    private static Properties buildPropertiesFromURLList(Enumeration pPropertyFileURLs) {
+        Trc.entry(null,pPropertyFileURLs);
+        Properties p2 = new Properties();
+        while (pPropertyFileURLs.hasMoreElements()) {
+            URL lResourceURL = (URL) pPropertyFileURLs.nextElement();
+            try {
+                Trc.event(null,"Loading wsif.properties from URL ",lResourceURL.toString());
+                p2.load(lResourceURL.openStream());
+            } catch (IOException e) {
+                Trc.exception(e);
+                MessageLogger.log("WSIF.0013W",new String[] {lResourceURL.toString(),e.getClass().getName(),e.getMessage()});
+            }
+        }
+        Trc.exit(p2);
+        return p2;
     }
 
     /**
