Details
-
Type:
Bug
-
Status:
Closed
-
Priority:
Major
-
Resolution: Fixed
-
Affects Version/s: 2.6.1, 2.6.2
-
Component/s: wfs plugin
-
Labels:None
-
Environment:Apache Felix 4.0.2
Description
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())
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.