axis-java-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Nirmal Mukhi <nmu...@us.ibm.com>
Subject Re: [wsif] Proposed change to WSIF service factory
Date Wed, 18 Dec 2002 20:55:05 GMT
Hi Ant,

I'll catch the exceptions separately and trace them. However, I think the 
correct behaviour is to ignore exceptions, since we have a fallback 
default factory, and users can be informed through the trace about the 
excdeption if they care. The alternative is to throw a WSIFException but I 
don't recall other abstract factory implementations (in WSDL4J, JAXP and 
so on) throwing exceptions from newInstance() - that is an unnecessary 
thing the user would have to take care of.

Thanks for your comments,
Nirmal.




"Anthony Elder" <ant.elder@uk.ibm.com>
12/18/2002 01:24 PM
Please respond to axis-dev
 
        To:     axis-dev@xml.apache.org
        cc: 
        Subject:        Re: [wsif] Proposed change to WSIF service factory



The code policeman probably wont like you catching Exception rather than
each specific Exception subclasses, and also not tracing that the 
exception
is ignored.
If there was a problem would the user want to  know by having a
WSIFException thrown instead of just returning the default factory? For
example if there's a security problem?

       ...ant

Anthony Elder
ant.elder@uk.ibm.com
Web Services Development
IBM UK Laboratories,  Hursley Park
(+44) 01962 818320, x248320, MP208.


Nirmal Mukhi/Watson/IBM@IBMUS on 18/12/2002 16:45:49

Please respond to axis-dev@xml.apache.org

To:    axis-dev@xml.apache.org
cc:
Subject:    [wsif] Proposed change to WSIF service factory




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.





Mime
View raw message