The plugin system for geotools allows you to write your plugin; and then register it in your jar as a service so that the rest of the library can use it. To register make a text file with the complete name of your function class in META-INF/services/
The name of the text file is the interface being implemented (in this case "org.opengis.filter.expression.Function"), the contents is a list of functions, one per line. I cannot remember if you need an extra line feed at the end of the file or not. Some background here: - http://docs.codehaus.org/display/GEOTDOC/05+How+to+write+a+Plugin+-+from+Interface+to+Factory (note the example says function but it is just to explain how the design works) For a good working example look at the cql module: - http://svn.geotools.org/trunk/modules/library/cql/ It advertises one function here: - http://svn.geotools.org/trunk/modules/library/cql/src/main/resources/META-INF/services/org.opengis.filter.expression.Function And implements it here: - http://svn.geotools.org/trunk/modules/library/cql/src/main/java/org/geotools/filter/function/PropertyExistsFunction.java Jody On 08/08/2010, at 1:54 PM, tom.williamson wrote: > > I apologize in advance if this is a stupid newbie question, but with all the > refactoring and suchlike, I can't make my old code work anymore, so I'm > without an example to follow. > > How do I add a function to the function list so it can be found with > FunctionFinder.findFunction()? Or is that even the proper class to use > anymore? I'm trying to build a simple app based off of the old > StyleFunctionLab example, which unfortunately no longer works with 2.7. > > The error I'm getting is: > > Exception in thread "main" java.lang.RuntimeException: Unable to find > function Banana > at > org.geotools.filter.FunctionFinder.findFunction(FunctionFinder.java:177) > at > org.geotools.filter.FunctionFinder.findFunction(FunctionFinder.java:74) > at > org.geotools.filter.FilterFactoryImpl.function(FilterFactoryImpl.java:467) > at > org.geotools.demo.StyleFunctionLab.createStyle(StyleFunctionLab.java:158) > etc.... > > Thanks in advance - Tom > -- > View this message in context: > http://osgeo-org.1803224.n2.nabble.com/Adding-a-function-to-the-function-list-tp5385277p5385277.html > Sent from the geotools-gt2-users mailing list archive at Nabble.com. > > ------------------------------------------------------------------------------ > This SF.net email is sponsored by > > Make an app they can't live without > Enter the BlackBerry Developer Challenge > http://p.sf.net/sfu/RIM-dev2dev > _______________________________________________ > Geotools-gt2-users mailing list > [email protected] > https://lists.sourceforge.net/lists/listinfo/geotools-gt2-users ------------------------------------------------------------------------------ This SF.net email is sponsored by Make an app they can't live without Enter the BlackBerry Developer Challenge http://p.sf.net/sfu/RIM-dev2dev _______________________________________________ Geotools-gt2-users mailing list [email protected] https://lists.sourceforge.net/lists/listinfo/geotools-gt2-users
