public abstract class ALfnResource<R extends ALfnResourceMetadata> extends Object
Themes have no tangible data, they consist solely of metadata.
The operations accessing their data throw UnsupportedOperationException
.
Assets and coverages may contain tangible data. For coverages, the tangible data are the tiles. Non-tiled coverages don't have any tiles. For assets, the tangible data are the asset sources, relevant for asset sources in Tile Store.
You can get resources from a ALfnTileStore
instance using one of the methods
ALfnTileStore.getCoverage(String)
,
ALfnTileStore.getAsset(String)
or
ALfnTileStore.getTheme(String)
.
The canonical mechanism for getting resource IDs is by using
ALfnTileStore.query(ILfnQueryHandler, TLfnQuery)
, and then extract the IDs from
the metadata.
ALfnTileStore.query(ELfnResourceType)
is a convenience method to get the
metadata of all resources a specific type.
For coverages, there is a convenience method ALfnTileStore.getCoverageIds()
to get the IDs of all the
coverages directly.
Constructor and Description |
---|
ALfnResource() |
Modifier and Type | Method and Description |
---|---|
Future<ALfnTileStore.WriteResult> |
deleteUserData(String aKey,
ILfnCallback<ALfnTileStore.WriteResult> aCallback)
Deletes binary user data from this resource with a given key.
|
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.
|
abstract R |
getMetadata()
Gets this resource's metadata.
|
long |
getSize()
Returns an estimate of the total resource data size, in bytes.
|
Future<ALfnTileStore.ReadResult> |
getUserData(String aKey,
WritableByteChannel aSink,
ILfnCallback<ALfnTileStore.ReadResult> aCallback)
Gets binary user data from this resource with a given key.
|
Future<ALfnTileStore.WriteResult> |
importFrom(ReadableByteChannel aSource,
ILfnProgressCallback<ALfnTileStore.WriteResult> aCallback)
Asynchronously imports this resource's data from a source channel, excluding metadata.
|
Future<ALfnTileStore.WriteResult> |
putUserData(String aKey,
ReadableByteChannel aSource,
ILfnCallback<ALfnTileStore.WriteResult> aCallback)
Puts binary user data related in this resource with a given key.
|
public abstract R getMetadata()
public long getSize() throws IOException, TLfnServiceException
A non-negative value indicates the returned size is stable,
meaning that as long as no new resource data is added, the value won't change.
A negative value indicates the returned size is a partial result, meaning that the size is only partially
calculated and may still be updated, even if no new resource data is added.
If negative, the returned value is the complement of the actual size, that is - size - 1
.
The returned size is only an estimate and should not be relied upon. The coverage metadata for example might be excluded from the computation.
IOException
- in case of an I/O failureTLfnServiceException
public Future<ALfnTileStore.WriteResult> importFrom(ReadableByteChannel aSource, ILfnProgressCallback<ALfnTileStore.WriteResult> aCallback)
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.
aSource
- the channel to import this resource fromaCallback
- the callback, which may be null
IOException
- in case of an I/O failureTLfnServiceException
- if the request handling failed on a remote entitypublic Future<ALfnTileStore.ReadResult> exportTo(WritableByteChannel aSink, ILcdShape aAreaOfInterest, ILcdGeoReference aAreaOfInterestGeoReference, ILfnProgressCallback<ALfnTileStore.ReadResult> aCallback)
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.
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<ALfnTileStore.WriteResult> putUserData(String aKey, ReadableByteChannel aSource, ILfnCallback<ALfnTileStore.WriteResult> aCallback)
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.
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)
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.
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)
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.
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.