org.geotoolkit.coverage.io
Class GridCoverageStore

Object
  extended by GridCoverageStore
All Implemented Interfaces:
Localized, LogProducer
Direct Known Subclasses:
GridCoverageReader, GridCoverageWriter

public abstract class GridCoverageStore
extends Object
implements LogProducer, Localized

Base class of GridCoverageReader and GridCoverageWriter. This base class provides common functionalities to set the locale used for error messages, abort a reading or writing process, and reset or dispose the reader or writer.

Since:
3.12
Version:
3.20
Author:
Martin Desruisseaux (Geomatys)
Module:
coverage/geotk-coverageio (download)    View source code for this class

Field Summary
protected  boolean abortRequested
          true if a request to abort the current read or write operation has been made.
 
Constructor Summary
protected GridCoverageStore()
          Creates a new instance.
 
Method Summary
 void abort()
          Cancels the read or write operation which is currently under progress in an other thread.
 void dispose()
          Allows any resources held by this reader or writer to be released.
 Locale getLocale()
          Returns the locale to use for formatting warnings and error messages, or null for the default.
 Level getLogLevel()
          Returns the logging level to use for read and write operations.
 void reset()
          Restores this reader or writer to its initial state.
 void setLocale(Locale locale)
          Sets the current locale of this coverage reader or writer to the given value.
 void setLogLevel(Level level)
          Sets the logging level to use for read and write operations.
 
Methods inherited from class Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

abortRequested

protected volatile boolean abortRequested
true if a request to abort the current read or write operation has been made. Subclasses should set this field to false at the beginning of each read or write operation, and pool the value regularly during the operation.

See Also:
abort()
Constructor Detail

GridCoverageStore

protected GridCoverageStore()
Creates a new instance.

Method Detail

getLogLevel

public Level getLogLevel()
Returns the logging level to use for read and write operations. The default value is one of the PerformanceLevel constants, determined according the duration of the operation.

Specified by:
getLogLevel in interface LogProducer
Returns:
The current logging level.
Since:
3.15

setLogLevel

public void setLogLevel(Level level)
Sets the logging level to use for read and write operations. A null value restores the default level documented in the getLogLevel() method.

Specified by:
setLogLevel in interface LogProducer
Parameters:
level - The new logging level, or null for the default.
Since:
3.15

getLocale

public Locale getLocale()
Returns the locale to use for formatting warnings and error messages, or null for the default.

Specified by:
getLocale in interface Localized
Returns:
The current locale, or null.
See Also:
ImageReader.getLocale(), ImageWriter.getLocale()

setLocale

public void setLocale(Locale locale)
Sets the current locale of this coverage reader or writer to the given value. A value of null removes any previous setting, and indicates that the reader or writer should localize as it sees fit.

Parameters:
locale - The new locale to use, or null for a default one.
See Also:
ImageReader.setLocale(Locale), ImageWriter.setLocale(Locale)

abort

public void abort()
Cancels the read or write operation which is currently under progress in an other thread. Invoking this method will cause a CancellationException to be thrown in the reading or writing thread (not this thread), unless the operation had the time to complete.

Note for implementors
Subclasses should set the abortRequested field to false at the beginning of each read or write operation, and poll the value regularly during the operation.

See Also:
abortRequested, ImageReader.abort(), ImageWriter.abort()

reset

public void reset()
           throws CoverageStoreException
Restores this reader or writer to its initial state.

Throws:
CoverageStoreException - if an error occurs while restoring to the initial state.
See Also:
ImageReader.reset(), ImageWriter.reset()

dispose

public void dispose()
             throws CoverageStoreException
Allows any resources held by this reader or writer to be released. The result of calling any other method subsequent to a call to this method is undefined.

Subclass implementations shall ensure that all resources, especially JCBC connections, are released.

Throws:
CoverageStoreException - if an error occurs while disposing resources.
See Also:
ImageReader.dispose(), ImageWriter.dispose()


Copyright © 2009-2013 Geotoolkit.org. All Rights Reserved.