Class ALfnResource<R extends ALfnResourceMetadata>

java.lang.Object
com.luciad.fusion.tilestore.ALfnResource<R>
Direct Known Subclasses:
ALfnAsset, ALfnCoverage, ALfnTheme

public abstract class ALfnResource<R extends ALfnResourceMetadata> extends Object
An abstract superclass for resources: assets, coverages and themes. It defines functionality common to all resources:
  • Access to the metadata.
  • Access to the user data.
  • Access to the data for applicable resources.

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.

Since:
2015.0
  • Constructor Details

    • ALfnResource

      public ALfnResource()
  • Method Details

    • getMetadata

      public abstract R getMetadata()
      Gets this resource's metadata. The metadata is always up to date.
      Returns:
      this resource's metadata
    • getSize

      public long getSize() throws IOException, TLfnServiceException
      Returns an estimate of the total resource data size, in bytes.

      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.

      Returns:
      an estimate of the coverage, in bytes, or its negative complement if the value is still unstable.
      Throws:
      IOException - in case of an I/O failure
      TLfnServiceException
    • importFrom

      Asynchronously imports this resource's data from a source channel, excluding metadata. For coverages, the resource data are the files containing the tiles (the tile containers). For assets, the resource data are the source files, relevant for asset sources in Tile Store. The source channel's content should be the result of an 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.

      Parameters:
      aSource - the channel to import this resource from
      aCallback - the callback, which may be null
      Returns:
      the future of the asynchronous request
      Throws:
      IOException - in case of an I/O failure
      TLfnServiceException - if the request handling failed on a remote entity
    • exportTo

      public 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. For coverages, the resource data are the files containing the tiles (the tile containers). For assets, the resource data are the source files, relevant for asset sources in Tile Store. Progress is reported on the handler in bytes.

      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.

      Parameters:
      aSink - the channel to export this asset to
      aAreaOfInterest - 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 request
    • putUserData

      Puts binary user data related in this resource with a given key. User data is opaque binary data, and is used internally to store checkpoints and replication settings.

      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.

      Parameters:
      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.
      Returns:
      A future, with result code ALfnTileStore.Result.Code.PUT if data with the given key already existed, ALfnTileStore.Result.Code.CREATED if it is new.
      Since:
      2015.0
    • getUserData

      Gets binary user data from this resource with a given key.

      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.

      Parameters:
      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.
      Returns:
      A future, with result code ALfnTileStore.ReadResult.FOUND if data with the given key exists, ALfnTileStore.Result.Code.NOT_FOUND otherwise.
      Since:
      2015.0
    • deleteUserData

      Deletes binary user data from this resource with a given key.

      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.

      Parameters:
      aKey - A key associated with the user data.
      aCallback - A callback that will be invoked when the operation is finished. May be null.
      Returns:
      A future, with result code ALfnTileStore.WriteResult.DELETED if data existed, ALfnTileStore.Result.Code.NOT_FOUND otherwise.
      Since:
      2015.0