Package org.apache.sis.storage
Class AbstractGridCoverageResource
Object
AbstractResource
AbstractGridCoverageResource
- All Implemented Interfaces:
- DataSet,- GridCoverageResource,- Resource
public abstract class AbstractGridCoverageResource
extends AbstractResource
implements GridCoverageResource
Default implementations of several methods for classes that want to implement the 
GridCoverageResource interface.
 Subclasses should override the following methods:
 - GridCoverageResource.getGridGeometry()(mandatory)
- GridCoverageResource.getSampleDimensions()(mandatory)
read(…) method in subclasses:
 - canNotRead(String, GridGeometry, Throwable)for reporting a failure to read operation.
- logReadOperation(Object, GridGeometry, long)for logging a notice about a read operation.
- Since:
- 1.2
Defined in the sis-storage module
- 
Field SummaryFields inherited from class AbstractResourcelisteners
- 
Constructor SummaryConstructorsModifierConstructorDescriptionprotectedAbstractGridCoverageResource(StoreListeners parentListeners, boolean hidden) Creates a new resource which can send notifications to the given set of listeners.
- 
Method SummaryModifier and TypeMethodDescriptionprotected DataStoreExceptioncanNotRead(String filename, GridGeometry request, Throwable cause) Creates an exception for a failure to load data.protected MetadataInvoked in a synchronized block the first time thatgetMetadata()is invoked.Returns the envelope of the grid geometry if known.protected voidlogReadOperation(Object file, GridGeometry domain, long startTime) Logs the execution of aGridCoverageResource.read(GridGeometry, int...)operation.Methods inherited from class AbstractResourceaddListener, clearCache, getIdentifier, getMetadata, getSynchronizationLock, removeListenerMethods inherited from class Objectclone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface GridCoverageResourcegetGridGeometry, getLoadingStrategy, getResolutions, getSampleDimensions, read, setLoadingStrategy, subsetMethods inherited from interface ResourceaddListener, getIdentifier, getMetadata, removeListener
- 
Constructor Details- 
AbstractGridCoverageResourceCreates a new resource which can send notifications to the given set of listeners. Ifhiddenisfalse(the recommended value), then this resource will have its own set of listeners with this resource declared as the source of events. It will be possible to add and remove listeners independently from the set of parent listeners. Conversely ifhiddenistrue, then the given listeners will be used directly and this resource will not appear as the source of any event.In any cases, the listeners of all parents (ultimately the data store that created this resource) will always be notified, either directly if hiddenistrueor indirectly ifhiddenisfalse.- Parameters:
- parentListeners- listeners of the parent resource, or- nullif none. This is usually the listeners of the- DataStorethat created this resource.
- hidden-- falseif this resource shall use its own- StoreListenerswith the specified parent, or- truefor using- parentListenersdirectly.
 
 
- 
- 
Method Details- 
getEnvelopeReturns the envelope of the grid geometry if known. The envelope is absent if the grid geometry does not provide this information.- Specified by:
- getEnvelopein interface- DataSet
- Overrides:
- getEnvelopein class- AbstractResource
- Returns:
- the grid geometry envelope.
- Throws:
- DataStoreException- if an error occurred while computing the grid geometry.
- See Also:
 
- 
createMetadataInvoked in a synchronized block the first time thatgetMetadata()is invoked. The default implementation populates metadata based on information provided bygetIdentifier(),getEnvelope(),getGridGeometry()andgetSampleDimensions(). Subclasses should override if they can provide more information. The default value can be completed by casting toDefaultMetadata.- Overrides:
- createMetadatain class- AbstractResource
- Returns:
- the newly created metadata, or nullif unknown.
- Throws:
- DataStoreException- if an error occurred while reading metadata from this resource.
 
- 
canNotReadCreates an exception for a failure to load data. The exception sub-type is inferred from the arguments. If the failure is caused by an envelope outside the resource domain, then that envelope will be inferred from therequestargument.- Parameters:
- filename- some identification (typically a file name) of the data that cannot be read.
- request- the requested domain, or- nullif unspecified.
- cause- the cause of the failure, or- nullif none.
- Returns:
- the exception to throw.
- See Also:
 
- 
logReadOperationLogs the execution of aGridCoverageResource.read(GridGeometry, int...)operation. The log level will beLevel.FINEif the operation was quick enough, orPerformanceLevel.SLOWNESSor higher level otherwise.- Parameters:
- file- the file that was opened, or- nullfor- StoreListeners.getSourceName().
- domain- domain of the created grid coverage.
- startTime- value of- System.nanoTime()when the loading process started.
 
 
-