nmukhi 2002/12/18 13:19:16
Modified: java/src wsif.properties
java/src/org/apache/wsif WSIFServiceFactory.java
Log:
Added logic to look for factory implementation using a property before instantiating
default factory.
Revision Changes Path
1.4 +2 -1 xml-axis-wsif/java/src/wsif.properties
Index: wsif.properties
===================================================================
RCS file: /home/cvs/xml-axis-wsif/java/src/wsif.properties,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -r1.3 -r1.4
--- wsif.properties 7 Dec 2002 12:34:03 -0000 1.3
+++ wsif.properties 18 Dec 2002 21:19:16 -0000 1.4
@@ -25,4 +25,5 @@
# 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
\ No newline at end of file
+wsif.asyncrequest.timeout=60
+wsif.servicefactory=customfactory.client.CustomServiceFactoryImpl
\ No newline at end of file
1.9 +24 -2 xml-axis-wsif/java/src/org/apache/wsif/WSIFServiceFactory.java
Index: WSIFServiceFactory.java
===================================================================
RCS file: /home/cvs/xml-axis-wsif/java/src/org/apache/wsif/WSIFServiceFactory.java,v
retrieving revision 1.8
retrieving revision 1.9
diff -u -r1.8 -r1.9
--- WSIFServiceFactory.java 7 Dec 2002 12:33:43 -0000 1.8
+++ WSIFServiceFactory.java 18 Dec 2002 21:19:16 -0000 1.9
@@ -64,6 +64,7 @@
import org.apache.wsif.base.WSIFServiceFactoryImpl;
import org.apache.wsif.logging.Trc;
import org.apache.wsif.util.WSIFUtils;
+import org.apache.wsif.util.WSIFProperties;
/**
* Abstract factory class to create instances of WSIFService. Call newInstance
@@ -73,6 +74,7 @@
* @author Owen Burroughs
*/
public abstract class WSIFServiceFactory {
+ public static String FACTORY_PROPERTY_NAME="wsif.servicefactory";
/**
* Creates a new instance of an implementation the abstract
@@ -81,8 +83,28 @@
public static WSIFServiceFactory newInstance() {
Trc.entry(null);
- WSIFServiceFactoryImpl wsf = new WSIFServiceFactoryImpl();
-
+ String desiredFactory = WSIFProperties.getProperty(FACTORY_PROPERTY_NAME);
+ WSIFServiceFactory wsf = null;
+ if (desiredFactory!=null) {
+ try {
+ Class factoryClass =
Class.forName(desiredFactory,true,Thread.currentThread().getContextClassLoader());
+ wsf = (WSIFServiceFactory) factoryClass.newInstance();
+ } catch (ClassNotFoundException exception) {
+ Trc.exception(exception);
+ // ignore the exception and instantiate default factory
+ wsf = new WSIFServiceFactoryImpl();
+ } catch (InstantiationException exception) {
+ Trc.exception(exception);
+ // ignore the exception and instantiate default factory
+ wsf = new WSIFServiceFactoryImpl();
+ } catch (IllegalAccessException exception) {
+ Trc.exception(exception);
+ // ignore the exception and instantiate default factory
+ wsf = new WSIFServiceFactoryImpl();
+ }
+ } else {
+ wsf = new WSIFServiceFactoryImpl();
+ }
// Create the simple types map for use by other WSIF classes
WSIFUtils.createSimpleTypesMap();