Hi,
one comment, maybe it would be better to use current thread class loader to
get the factory class, something like:
Class factoryClass = Class.forName(desiredFactory,
true,
Thread.currentThread
().getContextClassLoader());
Regards,
Piotr Przybylski, IBM
Internet: [EMAIL PROTECTED]
Nirmal
Mukhi/Watson/IBM@ To: [EMAIL PROTECTED]
IBMUS cc:
Subject: [wsif] Proposed change to
WSIF service factory
12/18/2002 11:45
AM
Please respond to
axis-dev
Hi,
I'd like to change the newInstance method in the WSIF service factory.
currently it just instantiates the default factory implementation. This is
a problem since it doesn't allow users to plug in their own factories. We
should follow the JAXP-style algorithm for looking for a suitable factory
before resorting to the default one.
For now however, I'm proposing just a simple change which gives the desired
flexibility with minimum change to code: just looking for a system property
that names the desired factory. Jeremy since you've been taking care of
this part of the code, can you eyeball this before I commit any change?
Here's the proposed method with changes:
public static WSIFServiceFactory newInstance() {
Trc.entry(null);
String desiredFactory =
WSIFProperties.getProperty(FACTORY_PROPERTY_NAME);
WSIFServiceFactory wsf = null;
if (desiredFactory!=null) {
try {
Class factoryClass = Class.forName(desiredFactory);
wsf = (WSIFServiceFactory) factoryClass.newInstance();
} catch (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();
Trc.exit(wsf);
return wsf;
}
What do you think?
Nirmal.