Geotoolkit

Factory.isAvailable() needs to report why a factory is not available

Details

  • Type: Improvement Improvement
  • Status: Closed Closed
  • Priority: Minor Minor
  • Resolution: Fixed
  • Affects Version/s: 3.03
  • Fix Version/s: 3.03
  • Component/s: Referencing, Utilities
  • Labels:

Description

Factory.isAvailable() returns a boolean value indicating if the factory is ready for use or not. In the case of the EPSG factory, there is many raisons why the factory may not be available:

  • The Derby or JavaDB JDBC driver is not on the classpath.
  • The JDBC driver is presents on the classpath but is an older version than the one which created the local EPSG database.
  • The EPSG database is installed on a remote server and we failed to connect to that server (wrong password, network problem, etc.)
  • The EPSG database is not installed on the local directory and the scripts for creating it are not found.
  • We don't have write permission in the local directory of the EPSG database.
  • The database is currently in use by an other process.
  • The database is corrupted.
  • etc........

In current Geotk version, if we failed to fetch the EPSG factory, the message in the exception said only "Authority "EPSG" is unknown or doesn't match the supplied hints. Maybe it is defined in an unreachable JAR file?". The cause is actually logged at the FINE or CONFIG level, but when the user did not configured his logger to show those levels, it is very hard to guess from the exception alone why the factory is not available.

The raison why the exception message doesn't contain the cause is that the Factory.isAvailable() method returns only a boolean value. We need to replace that method by a new one, Factory.availability(), which returns a ConformanceResult object (from ISO 19115) instead. ConformanceResult contains a boolean pass attribute, together with an explanation one which allow us to pass more informations.

Activity

Hide
Martin Desruisseaux added a comment - 21/Aug/2009 19:29

It was a typical example of a problem which seem simple and trivial at first look, but appears very tricky when we start the work.

Show
Martin Desruisseaux added a comment - 21/Aug/2009 19:29 It was a typical example of a problem which seem simple and trivial at first look, but appears very tricky when we start the work.

People

Vote (0)
Watch (0)

Dates

  • Created:
    20/Aug/2009 13:12
    Updated:
    13/Apr/2011 15:52
    Resolved:
    13/Apr/2011 15:52

Time Tracking

Estimated:
4h
Original Estimate - 4 hours Original Estimate - 4 hours
Remaining:
0m
Remaining Estimate - 0 minutes
Logged:
2d
Time Spent - 2 days