[Gdal-dev] GDAL swig - allregister()
Collins, Benjamin
collinsb at mitre.org
Wed Jul 19 10:26:01 EDT 2006
>-----Original Message-----
>From: gdal-dev-bounces at lists.maptools.org
>[mailto:gdal-dev-bounces at lists.maptools.org] On Behalf Of Norman
Barker
>Sent: Wednesday, July 19, 2006 8:51 AM
>To: gdal-dev at lists.maptools.org
>Subject: [Gdal-dev] GDAL swig - allregister()
>
>
>Hi,
>
>This is such a minor change, but is it possible to add
>gdal.AllRegister() in swig gdal_java.i
>
>%pragma(java) jniclasscode=%{
> private static boolean available = false;
>
> static {
> try {
> System.loadLibrary("gdaljni");
> gdal.AllRegister();
> available = true;
> } catch (UnsatisfiedLinkError e) {
> available = false;
> System.err.println("Native library load failed.");
> System.err.println(e);
> }
> }
>
> public static boolean isAvailable() {
> return available;
> }
>%}
>
>This makes it possible to call gdal from multiple java threads.
>
Norman,
It is possible that one may want to access constants without
registering all drivers. Also, the step may take some time, and so the
programmer may want to delay it for lazy loading. In whatever class
you are writing, you could also have a static initializer that does the
RegisterAll() call, too. I know that the apps I'm working with are
large enough that we want to avoid _all_ startup costs possible.
--
Ben Collins
More information about the Gdal-dev
mailing list