public abstract class ALfnCoverage extends ALfnResource<ALfnCoverageMetadata>
ELfnDataType
, for example IMAGE
or ELEVATION
WGS 84
geodetic systemjpg
or png
UnsupportedOperationException
.
Implementations of this class should override and implement the operation methods that need to be supported.
Implementations of this class are thread-safe.
You can associate arbitrary binary data with a coverage using its user data
.
Each coverage has a key-blob store that you can use to store your own data.
This user data is stored on the Tile Store itself, so you can access from anywhere. When the coverage is removed, the user data is also removed.
Note: this store is not optimized for very frequent access, large blobs or many keys.
Constructor and Description |
---|
ALfnCoverage() |
Modifier and Type | Method and Description |
---|---|
Future<?> |
deleteTile(ILfnDeleteTileHandler aHandler,
TLfnTileCoordinates aCoordinates)
Deprecated.
|
Future<ALfnTileStore.WriteResult> |
deleteTile(TLfnTileCoordinates aCoordinates,
ILfnCallback<ALfnTileStore.WriteResult> aCallback)
Asynchronously deletes a tile from this coverage.
|
Future<ALfnTileStore.WriteResult> |
deleteUserData(String aKey,
ILfnCallback<ALfnTileStore.WriteResult> aCallback)
Deletes binary user data from this resource with a given key.
|
Future<?> |
exportTo(ILfnExportHandler aHandler,
WritableByteChannel aSink)
|
Future<ALfnTileStore.ReadResult> |
exportTo(WritableByteChannel aSink,
ILcdShape aAreaOfInterest,
ILcdGeoReference aAreaOfInterestGeoReference,
ILfnProgressCallback<ALfnTileStore.ReadResult> aCallback)
Asynchronously exports this resource's data to a channel, excluding metadata.
|
Future<?> |
getTile(ILfnGetTileHandler aHandler,
TLfnTileCoordinates aCoordinates,
long aModificationTime,
WritableByteChannel aSink,
ByteBuffer aMessageDigest)
|
Future<ALfnTileStore.ReadResult> |
getTile(TLfnTileCoordinates aCoordinates,
long aModificationTime,
WritableByteChannel aSink,
ByteBuffer aMessageDigest,
ILfnReadCallback aCallback)
Asynchronously gets a tile from this coverage, including the tile message digest.
|
Iterable<TLfnTileCoordinates> |
getTileCoordinates()
Returns an
Iterable to iterate over all the coordinates of all tiles that are in the coverage. |
TLfnTransactionStatus |
getTransactionStatus()
Gets the status of the Tile Store's transaction management for this coverage.
|
Future<ALfnTileStore.ReadResult> |
getUserData(String aKey,
WritableByteChannel aSink,
ILfnCallback<ALfnTileStore.ReadResult> aCallback)
Gets binary user data from this resource with a given key.
|
Future<?> |
importFrom(ILfnImportHandler aHandler,
ReadableByteChannel aSource)
Deprecated.
|
Future<ALfnTileStore.WriteResult> |
importFrom(ReadableByteChannel aSource,
ILfnProgressCallback<ALfnTileStore.WriteResult> aCallback)
Asynchronously imports this resource's data from a source channel, excluding metadata.
|
Future<?> |
putTile(ILfnPutTileHandler aHandler,
TLfnTileCoordinates aCoordinates,
ReadableByteChannel aSource,
ByteBuffer aMessageDigest)
|
Future<ALfnTileStore.WriteResult> |
putTile(TLfnTileCoordinates aCoordinates,
ReadableByteChannel aSource,
ByteBuffer aMessageDigest,
ILfnCallback<ALfnTileStore.WriteResult> aCallback)
Asynchronously puts a tile into this coverage, including the tile digest.
|
Future<ALfnTileStore.WriteResult> |
putUserData(String aKey,
ReadableByteChannel aSource,
ILfnCallback<ALfnTileStore.WriteResult> aCallback)
Puts binary user data related in this resource with a given key.
|
String |
toString() |
getMetadata, getSize
public Future<ALfnTileStore.WriteResult> putTile(TLfnTileCoordinates aCoordinates, ReadableByteChannel aSource, ByteBuffer aMessageDigest, ILfnCallback<ALfnTileStore.WriteResult> aCallback)
aCallback
- the asynchronous callback that will be called upon success or failure.
Upon success, the implementation does not guarantee that the tile has been
committed to persistent storage. It does allow applications to track
commitment, see ALfnTileStore.WriteResult
.aCoordinates
- the coordinates defining the location of the tile within the coverageaSource
- the channel providing the tile data. Implementations will deplete the
channel, but will not close it. It is up to the application to
close the channel.aMessageDigest
- a byte buffer containing the message digest of the tile, or null
if digests are not required
by this coverage.
The message digest should be computed on the contents of aData
using the message digest
algorithm that is specified on this coverage's metadata. Callers of this method should make sure
the message digest has been written into the byte buffer at the moment the last byte has been read from
aData
. Correspondingly, implementations of this method should only access
aMessageDigest
after aData
has been fully read.
If the digest algorithm on the coverage metadata is null
, aMessageDigest
may be
null
or empty.ILfnCallback
,
ALfnTileStore.WriteResult
,
ALfnCoverageMetadata.getMessageDigestAlgorithm()
public Future<?> putTile(ILfnPutTileHandler aHandler, TLfnTileCoordinates aCoordinates, ReadableByteChannel aSource, ByteBuffer aMessageDigest)
public Future<ALfnTileStore.WriteResult> deleteTile(TLfnTileCoordinates aCoordinates, ILfnCallback<ALfnTileStore.WriteResult> aCallback)
aCallback
- the asynchronous callback that will be called upon success or failure.Upon success, the implementation
does not guarantee that the tile has been reliably removed from persistent storage. It does allow
applications to track commitment, see ILfnDeleteTileHandler.deleted(long, long, long)
.aCoordinates
- the coordinates defining the location of the tile within the coverageILfnCallback
,
ALfnTileStore.WriteResult
public Future<?> deleteTile(ILfnDeleteTileHandler aHandler, TLfnTileCoordinates aCoordinates)
deleteTile(com.luciad.fusion.core.TLfnTileCoordinates, com.luciad.fusion.util.ILfnCallback)
insteadpublic Future<ALfnTileStore.ReadResult> getTile(TLfnTileCoordinates aCoordinates, long aModificationTime, WritableByteChannel aSink, ByteBuffer aMessageDigest, ILfnReadCallback aCallback)
Future
. In case of cancellation before completion,
the handler will not be notified. The caller should check the future first for successful completion or
cancellation via Future.get()
.aCallback
- the asynchronous callback for the requestaCoordinates
- the coordinates defining the location of the tile within the coverageaModificationTime
- the time after which the tile must have been modified or -1
to get the
current tile, regardless of its modification timeaSink
- the channel to which the tile data will be written. Implementations will not close the channelaMessageDigest
- a byte buffer to which the message digest of the tile will be written, or null
.
This argument can be null
if you are not interested in the resulting message digest,
or if the digest algorithm on the coverage metadata is null
, in which case nothing
will be written to it anyway. In the latter case, the buffer can be empty as well.
The message digest is computed on the contents of aData
using the message digest
algorithm that is specified on this coverage's metadata. The message digest may be accessed from
the moment ILfnGetTileHandler.found(long, long)
is called on aHandler
. Correspondingly,
implementations should make sure aMessageDigest
is filled in at the moment
ILfnGetTileHandler.found(long, long)
is called.ALfnTileStore.ReadResult
,
ILfnReadCallback
public Future<?> getTile(ILfnGetTileHandler aHandler, TLfnTileCoordinates aCoordinates, long aModificationTime, WritableByteChannel aSink, ByteBuffer aMessageDigest)
public Future<ALfnTileStore.WriteResult> importFrom(ReadableByteChannel aSource, ILfnProgressCallback<ALfnTileStore.WriteResult> aCallback)
ALfnResource
ALfnResource.exportTo(java.nio.channels.WritableByteChannel, com.luciad.shape.ILcdShape, com.luciad.reference.ILcdGeoReference, com.luciad.fusion.tilestore.ILfnProgressCallback<com.luciad.fusion.tilestore.ALfnTileStore.ReadResult>)
operation.
This operation can only be performed when this resource is empty.
An import is a write operation, but it is implemented outside of the transaction subsystem.
The result is a WriteResult
with code CREATED
and without any transaction information.
All transaction related fields are -1
, and you may ignore them.
Future implementations may return more useful transaction information, or even a code PUT
.
The source channel will not be closed at the end of the import.
importFrom
in class ALfnResource<ALfnCoverageMetadata>
aSource
- the channel to import this resource fromaCallback
- the callback, which may be null
public Future<?> importFrom(ILfnImportHandler aHandler, ReadableByteChannel aSource)
importFrom(java.nio.channels.ReadableByteChannel, ILfnProgressCallback)
insteadpublic Future<ALfnTileStore.ReadResult> exportTo(WritableByteChannel aSink, ILcdShape aAreaOfInterest, ILcdGeoReference aAreaOfInterestGeoReference, ILfnProgressCallback<ALfnTileStore.ReadResult> aCallback)
ALfnResource
This request supports cancellation through the future.
In case of cancellation before completion, the handler will not be notified.
The caller should check the future first for successful completion or cancellation via Future.get()
.
An export is a read operations.
The result of an import is a ReadResult
with code FOUND
.
The target channel will not be closed at the end of the export.
exportTo
in class ALfnResource<ALfnCoverageMetadata>
aSink
- the channel to export this asset toaAreaOfInterest
- an optional area of interest to limit the export to, may be null
aAreaOfInterestGeoReference
- a geographic reference for the area of interest.
If the area of interest is not null
, then this parameter must also not be null
.aCallback
- the callback, which may be null
@return the future of the asynchronous requestpublic Future<?> exportTo(ILfnExportHandler aHandler, WritableByteChannel aSink)
public TLfnTransactionStatus getTransactionStatus() throws IOException, TLfnServiceException
IOException
- in case of an I/O failureTLfnServiceException
- in case of a service processing failureputTile(com.luciad.fusion.core.TLfnTileCoordinates, java.nio.channels.ReadableByteChannel, java.nio.ByteBuffer, com.luciad.fusion.util.ILfnCallback<com.luciad.fusion.tilestore.ALfnTileStore.WriteResult>)
public Iterable<TLfnTileCoordinates> getTileCoordinates() throws IOException, TLfnServiceException
Iterable
to iterate over all the coordinates of all tiles that are in the coverage.
Note: care should be taken when calling this method. Coverages can be very large, in which case iterating over
all tiles may be a costly operation.
In case an exception would occur during iteration (for example because of an I/O failure), the called method on the
iterator will throw a RuntimeException (wrapping the original exception, in case of a checked exception).
This operation is currently not supported for remote coverages accessed through the LTS protocol. Only local file
system coverages support the operation. Its primary use case is corruption checking on local file system Tile
Stores.
Since 2013.0, the iterable no longer throws ConcurrentModificationExceptions. It is possible
to keep on iterating over the tile coordinates even while write operations are still ongoing. As a result, the tile
coordinates returned by the iteration may return stale values. It may "miss" recently added tiles, and it may still
return recently deleted tiles. When no write operations have happened since the creation of the iterable, it is
still safe to assume that the iteration returns the complete set (and nothing but the complete set) of tile
coordinates.Iterable
to iterate over all tiles that are available in the coverage.IOException
- in case of an I/O failureTLfnServiceException
- in case of a service processing failurepublic Future<ALfnTileStore.WriteResult> putUserData(String aKey, ReadableByteChannel aSource, ILfnCallback<ALfnTileStore.WriteResult> aCallback)
ALfnResource
The user data is read from the given channel.
If user data with the given key already exists, it is overwritten and this call returns true
.
The user data key is an arbitrary string, but you are encouraged to use a java-like hierarchical naming scheme,
for example "com.luciad.fusion.yourUniqueKey"
.
This operation is asynchronous.
Callers can use the returned Future
to wait for the result,
or use a handler
to be notified of the result.
This operation is optional.
Use TLfnTileStoreOperation.isUserDataSupported(com.luciad.fusion.tilestore.TLfnTileStoreCapabilities)
to check if this operation is supported.
putUserData
in class ALfnResource<ALfnCoverageMetadata>
aKey
- A key associated with the user data.aSource
- The input channel the user data is read from.aCallback
- A callback that will be invoked when the operation is finished. May be null
.ALfnTileStore.Result.Code.PUT
if data with
the given key already existed, ALfnTileStore.Result.Code.CREATED
if it
is new.public Future<ALfnTileStore.ReadResult> getUserData(String aKey, WritableByteChannel aSink, ILfnCallback<ALfnTileStore.ReadResult> aCallback)
ALfnResource
The user data is written to the given channel, if it exists.
The user data key is an arbitrary string, but you are encouraged to use a java-like hierarchical naming scheme,
for example "com.luciad.fusion.youruniquekey"
.
This operation is asynchronous.
Callers can use the returned Future
to wait for the result,
or use a handler
to be notified of the result.
This operation is optional.
Use TLfnTileStoreOperation.isUserDataSupported(com.luciad.fusion.tilestore.TLfnTileStoreCapabilities)
to check if this operation is supported.
getUserData
in class ALfnResource<ALfnCoverageMetadata>
aKey
- A key associated with the user data.aSink
- The output channel the data is written to, if it exists.aCallback
- A callback that will be invoked when the operation is finished. May be null
.ALfnTileStore.ReadResult.FOUND
if data with the given key exists,
ALfnTileStore.Result.Code.NOT_FOUND
otherwise.public Future<ALfnTileStore.WriteResult> deleteUserData(String aKey, ILfnCallback<ALfnTileStore.WriteResult> aCallback)
ALfnResource
The user data key is an arbitrary string, but you should use a java-like hierarchical naming scheme.
This operation is asynchronous.
Callers can use the returned Future
to wait for the result,
or use a handler
to be notified of the result.
This operation is optional.
User TLfnTileStoreOperation.isUserDataSupported(com.luciad.fusion.tilestore.TLfnTileStoreCapabilities)
to check if this operation is supported.
deleteUserData
in class ALfnResource<ALfnCoverageMetadata>
aKey
- A key associated with the user data.aCallback
- A callback that will be invoked when the operation is finished. May be null
.ALfnTileStore.WriteResult.DELETED
if
data existed, ALfnTileStore.Result.Code.NOT_FOUND
otherwise.