Andrea Aime wrote: > Justin Deoliveira ha scritto: >> Hi all, >> >> I wanted to write this up while it is still fresh in my mind. For those >> of us unfamiliar with the problem, the "factory problem" is this: >> >> How do we enable the user to supplement geotools code with custom >> factories. Why you ask. The number one use case is to get data stores to >> create geometries and features optimized for rendering. > > Another interesting case is having the datastore map shapefile records > to beans that happen to implement the feature interface, but provide extra > functionality (this could really turn our data stores into a sort of o/r > mapper > :-p) > >> The way this has been done in the past is with the use of Hints. While >> this solution works, a more explicit approach is often desired. The one >> used more often then not is with containers. The use of hints is not >> container friendly. To use the buzz word, a nice solution is >> "constructor and setter injection". >> >> So what we came up with is a couple of guidelines. If a data store uses >> a factory, it should either: >> >> 1. Take the factory as a parameter in the constructor, or: >> 2. Add a setter method for the factory, but provide a default >> implementation in the event where the setter is not called. >> >> Having a class locate a factory implementation via factory finder spi is >> kind of pointless, it defeats the purpose of having an interface. > > Hum, I guess sometimes a data store may have an opinion on which > implementation > is best for it, some times it does not. Why not fall on a default > implementation > located thru the factory SPI in that case?
Fair enough. Its just if there is only one default implementation around why fake a pluggable system with factory spi, why not just instantiate it directly. But either works for me. -Justin > > Cheers > Andrea > > !DSPAM:1004,4514e368130421775926497! > -- Justin Deoliveira [EMAIL PROTECTED] The Open Planning Project http://topp.openplans.org ------------------------------------------------------------------------- Take Surveys. Earn Cash. Influence the Future of IT Join SourceForge.net's Techsay panel and you'll get the chance to share your opinions on IT & business topics through brief surveys -- and earn cash http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV _______________________________________________ Geotools-devel mailing list [email protected] https://lists.sourceforge.net/lists/listinfo/geotools-devel
