Hi Nenad,
It doesn't matter where the class resides (ie. which package / jar)
and you don't need to create an instance in your code. That will be
done for you by the filter factory.
You tell GeoTools how to find your function via an 'spi' file. For
example, if you have the function in the same jar as your app add a
file to project's META-INF/services folder called
org.opengis.filter.expression.Function (the base class for SLD filter
functions). In this file you add the fully qualified name of the
function: e.g. org.foo.michael.hacks.VarLookupFunction. If you have
more than one function you put each one on a separate line.
Before trying a complicated SLD document you might like to test that
GeoTools can find your function at runtime like this...
FilterFactory2 ff = CommonFactoryFinder.getFilterFactory2(null);
FunctionName fname = ff.functionName("varlookup", 1);
if (fname != null) {
System.out.println("Found " + fname.toString());
} else {
System.out.println("Function not found");
}
Hope this helps.
Michael
------------------------------------------------------------------------------
Join us December 9, 2009 for the Red Hat Virtual Experience,
a free event focused on virtualization and cloud computing.
Attend in-depth sessions from your desk. Your couch. Anywhere.
http://p.sf.net/sfu/redhat-sfdev2dev
_______________________________________________
Geotools-gt2-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/geotools-gt2-users