Problem using WFS client in multi-classloader environment (fix attached)
------------------------------------------------------------------------

                 Key: GEOT-2984
                 URL: http://jira.codehaus.org/browse/GEOT-2984
             Project: GeoTools
          Issue Type: Bug
          Components: data wfs
    Affects Versions: 2.6.2, 2.6.1
         Environment: Apache Felix 4.0.2
            Reporter: Nathan Mittler
             Fix For: 2.6.3
         Attachments: WFSExtensions.java

I had to fix what I believe to be a bug in the WFS client to get it working 
under OSGI (Apache Felix 2.0.4), and I wanted to share what I found ...  

I had to change the way that org.geotools.data.wfs.protocol.wfs.WFSExtensions 
looks up the WFSResponseParserFactory service.  Currently, the code is going 
straight to the javax.imageio.spi.ServiceRegistry.  Looking around the code, 
however, it seemed that other places were using the 
org.geotools.factory.FactoryCreator class, which is a bit more clever when it 
comes to mulit-classloader environments (such as OSGI).  I modified the core 
logic into the getServiceProviders method to the following:

                    FactoryRegistry factReg = new FactoryCreator( new 
Class[]{WFSResponseParserFactory.class});
                    factReg.scanForPlugins();
                    Iterator<WFSResponseParserFactory> providers = 
factReg.getServiceProviders(WFSResponseParserFactory.class, true);
                    registry = new HashSet<WFSResponseParserFactory>();
                    while (providers.hasNext()) {
                        WFSResponseParserFactory provider = providers.next();
                        registry.add(provider);
                    }

This seems to solve the problem.  I've attached the WFSExtensions.java file 
with my modifications.  This is a change made against geotools 2.6.1, although 
looking in svn 2.6.2 has the same problem.


-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: 
http://jira.codehaus.org/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

------------------------------------------------------------------------------
Download Intel&#174; Parallel Studio Eval
Try the new software tools for yourself. Speed compiling, find bugs
proactively, and fine-tune applications for parallel performance.
See why Intel Parallel Studio got high marks during beta.
http://p.sf.net/sfu/intel-sw-dev
_______________________________________________
Geotools-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/geotools-devel

Reply via email to