On Thu, Nov 10, 2011 at 1:54 AM, Jody Garnett <[email protected]> wrote: > Andrea the ProcessFilter idea is a good one; can we make use of the existing > Hints technique? > Example: > interface ProcessFilter { > boolean filter(ProcessFactory factory, Name name); > }
This interface seems simpler to implement, but also significantly less powerful than the one I was suggesting which allows to wrap the factory. Things you can do with wrapping: - add input/output checks (range checks, size checks and whatnot) - default some input param and hide it - add i18n where there was none - add accounting of some form around all process calls - etc etc So I'd go with the one I proposed, providing an abstract class that one can implement for the simple case of wrapping a factory to just hide processes in it > // global default? > Hints hints = new Hints(Processors.PROCESS_FILTER, new CustomProcessFilter() > ); Yeah, I considered this one too. I can go for it if everybody else feel it's the right way to go, why I did not propose it in my first mail: - a hint is variably treated in geotools from a ignorable suggestion to an order, in this case filtering might be security related so it has to be very clear it's an order - hints are hard to discover, it's something you have to document in examples for people to learn the are there (similar to writing a large comment explainig messy code vs tight ones associated with clean code) > Option: Extend the static final methods to accept optional hints > // From the rendering engine you would need a different process filter > Hints hints = new Hints(Processors.PROCESS_FILTER, new > RenderingProcessFilter() ); > Process process = Processors.createProcess( name, hints ); // makes use of > rendering process filter If we go down with hints I definitely prefer the second, at least the hints are right into your face and the PROCESS_FILTER one can be explained in the javadoc, where there is a good chance it will be discovered. 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 ------------------------------------------------------- ------------------------------------------------------------------------------ RSA(R) Conference 2012 Save $700 by Nov 18 Register now http://p.sf.net/sfu/rsa-sfdev2dev1 _______________________________________________ Geotools-devel mailing list [email protected] https://lists.sourceforge.net/lists/listinfo/geotools-devel
