On Wed, Jul 27, 2011 at 8:26 AM, <[email protected]> wrote:
> Opinions, better ideas ?
The above would be quite uncharacteristic for GeoServer, I would like
to avoid having a third way to make plugins.
All Geotools plugins use the SPI subsystem that Chris is referring to.
All GeoServer plugins use Spring context scans instead based
on the GeoServerExtensions class.
All WMS/WFS output formats are found that way for example,
same goes for annotated WPS processes, OGC services,
KVP and XML parsers and so on.
In case you have to find a single implementation the pattern to
follow would be:
- check if there is an implementation of a certain interface in the
Spring context using GeoServerExtensions.bean(Class type)
- if any is available, use that one
- if none is found programmatically instantiate a default one instead.
The authorization subsystem already works that way, it searches
for a resource access manager, if not found looks for the
old interface, DataAccessManager, if none is found it just builds
the default one instead (wrapping it in the LocalWorkspacesResourceAccessManager
to get the per workspace services behavior):
static ResourceAccessManager lookupResourceAccessManager() throws Exception {
ResourceAccessManager manager =
GeoServerExtensions.bean(ResourceAccessManager.class);
if (manager == null) {
DataAccessManager daManager = lookupDataAccessManager();
manager = new DataAccessManagerAdapter(daManager);
}
LocalWorkspaceResourceAccessManager lwManager = new
LocalWorkspaceResourceAccessManager();
lwManager.setDelegate(manager);
return lwManager;
}
Cheers
Andrea
--
-------------------------------------------------------
Ing. Andrea Aime
GeoSolutions S.A.S.
Tech lead
Via Poggio alle Viti 1187
55054 Massarosa (LU)
Italy
phone: +39 0584 962313
fax: +39 0584 962313
http://www.geo-solutions.it
http://geo-solutions.blogspot.com/
http://www.youtube.com/user/GeoSolutionsIT
http://www.linkedin.com/in/andreaaime
http://twitter.com/geowolf
-------------------------------------------------------
------------------------------------------------------------------------------
Got Input? Slashdot Needs You.
Take our quick survey online. Come on, we don't ask for help often.
Plus, you'll get a chance to win $100 to spend on ThinkGeek.
http://p.sf.net/sfu/slashdot-survey
_______________________________________________
Geoserver-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/geoserver-devel