/** * Creates and returns a new instance of the <CODE>GeoTiffFormat</CODE> class if the required * libraries are present. If JAI and JAI Image I/O are not present, will throw an <CODE> * UnsupportedOperationException</CODE>. * * @return <CODE>GeoTiffFormat</CODE> object. * @throws UnsupportedOperationException if this format is unavailable. */ public AbstractGridFormat createFormat() { if (!isAvailable()) { throw new UnsupportedOperationException( "The GeoTiff plugin requires the JAI and JAI ImageI/O libraries!"); } return new GeoTiffFormat(); }
/** * Creates and returns a new instance of the <CODE>GeoTiffFormat</CODE> * class if the required libraries are present. If JAI and JAI Image I/O are * not present, will throw an <CODE>UnsupportedOperationException</CODE>. * * @return <CODE>GeoTiffFormat</CODE> object. * * @throws UnsupportedOperationException * if this format is unavailable. */ public AbstractGridFormat createFormat() { if (!isAvailable()) { throw new UnsupportedOperationException( "The GeoTiff plugin requires the JAI and JAI ImageI/O libraries!"); } return new GeoTiffFormat(); }
/** * Checks whether the datastore is installed and available (e.g., all the extra libraries it * requires are there) * * @return */ boolean isAvailable() { try { Class<?> clazz = Class.forName(factoryClassName); // TODO: not terribly elegant if (DataStoreFactorySpi.class.isAssignableFrom(clazz)) { DataStoreFactorySpi factory = (DataStoreFactorySpi) clazz.newInstance(); return factory.isAvailable(); } else { GeoTiffFormatFactorySpi factory = (GeoTiffFormatFactorySpi) clazz.newInstance(); return factory.isAvailable(); } } catch (Exception e) { return false; } } }