public abstract class ALfnTileStore extends Object implements ILfnResourceMetadataResolver, Closeable
UnsupportedOperationException
.
Implementations of this class should override and implement the operation methods that need to be supported.
The Tile Store can be accessed via a LTS client or
it can be directly accessed on the file system.
Implementations of this class are thread-safe.Modifier and Type | Class and Description |
---|---|
static class |
ALfnTileStore.CommitPolicy
The commit policy determines when new tiles will be visible.
|
static class |
ALfnTileStore.ReadResult
The final result of a read operation ("get").
|
static class |
ALfnTileStore.Result
The result of an operation on a Tile Store.
|
static class |
ALfnTileStore.WriteResult
The final result of a write operation ("put", "delete").
|
Constructor and Description |
---|
ALfnTileStore() |
Modifier and Type | Method and Description |
---|---|
void |
close()
Closes this Tile Store instance.
|
boolean |
deleteResource(String aID)
Deletes both the data and metadata of a resource.
|
Future<ALfnTileStore.WriteResult> |
deleteUserData(String aKey,
ILfnCallback<ALfnTileStore.WriteResult> aCallback)
Deletes binary user data from this Tile Store with a given key.
|
ALfnAsset |
getAsset(String aID)
Gets an asset from the Tile Store.
|
abstract TLfnTileStoreCapabilities |
getCapabilities()
Gets the capabilities offered by the Tile Store.
|
ALfnCoverage |
getCoverage(String aID)
Gets a coverage from the Tile Store.
|
List<String> |
getCoverageIds()
Gets the IDs of all this Tile Store's coverage metadatas.
|
TLfnTileStoreMetadata |
getMetadata()
Returns the metadata of this Tile Store.
|
TLfnRasterAssetMetadata |
getRasterAssetMetadata(String aID)
Gets a raster asset metadata.
|
TLfnRasterCoverageMetadata |
getRasterCoverageMetadata(String aID)
Gets a raster coverage metadata.
|
<T extends ALfnResourceMetadata> |
getResourceMetadata(String aID)
Gets the metadata of a resource.
|
ALfnTheme |
getTheme(String aID)
Gets a theme from the Tile Store.
|
TLfnThemeMetadata |
getThemeMetadata(String aID)
Gets the metadata of a theme.
|
abstract URI |
getURI()
Gets URI identifier of this Tile Store.
|
Future<ALfnTileStore.ReadResult> |
getUserData(String aKey,
WritableByteChannel aSink,
ILfnCallback<ALfnTileStore.ReadResult> aCallback)
Gets binary user data from this Tile Store with a given key.
|
TLfnVectorAssetMetadata |
getVectorAssetMetadata(String aID)
Gets a vector asset metadata.
|
TLfnVectorCoverageMetadata |
getVectorCoverageMetadata(String aID)
Gets a vector coverage metadata.
|
abstract void |
putMetadata(TLfnTileStoreMetadata aTileStoreMetadata)
Updates the metadata of this Tile Store.
|
TLfnRasterAssetMetadata |
putRasterAssetMetadata(TLfnRasterAssetMetadata aMetadata)
Adds or updates an asset.
|
TLfnRasterCoverageMetadata |
putRasterCoverageMetadata(TLfnRasterCoverageMetadata aMetadata)
Adds or updates a coverage.
|
<T extends ALfnResourceMetadata> |
putResourceMetadata(T aMetadata)
Adds or updates the metadata of a resource.
|
TLfnThemeMetadata |
putThemeMetadata(TLfnThemeMetadata aMetadata)
Adds or updates a theme metadata.
|
Future<ALfnTileStore.WriteResult> |
putUserData(String aKey,
ReadableByteChannel aSource,
ILfnCallback<ALfnTileStore.WriteResult> aCallback)
Puts binary user data in this Tile Store with a given key.
|
TLfnVectorAssetMetadata |
putVectorAssetMetadata(TLfnVectorAssetMetadata aMetadata)
Adds or updates an asset.
|
TLfnVectorCoverageMetadata |
putVectorCoverageMetadata(TLfnVectorCoverageMetadata aMetadata)
Adds or updates a coverage.
|
<R extends ALfnResourceMetadata> |
query(ELfnResourceType aResourceType)
Gets all the resource metadatas in this Tile Store of a given type.
|
Future<?> |
query(ILfnQueryHandler aHandler,
TLfnQuery aQuery)
Queries the Tile Store for resources' metadata.
|
String |
toString()
Returns the URI as a string representation of this Tile Store.
|
public abstract URI getURI()
public abstract TLfnTileStoreCapabilities getCapabilities() throws IOException, TLfnServiceException
The capabilities provide the Tile Store metadata and the supported operations. The operations are defined as constants on this class.
IOException
- in case of an I/O failureTLfnServiceException
- in case of a service processing failurepublic TLfnTileStoreMetadata getMetadata() throws IOException, TLfnServiceException
Returns the metadata of this Tile Store.
Short for
getCapabilities().getMetadata()
IOException
- in case of an I/O failureTLfnServiceException
- in case of a service processing failurepublic abstract void putMetadata(TLfnTileStoreMetadata aTileStoreMetadata) throws IOException, TLfnServiceException
Updates the metadata of this Tile Store.
aTileStoreMetadata
- The new metadata for this Tile StoreIOException
- in case of an I/O failureTLfnServiceException
- in case of a service processing failurepublic ALfnCoverage getCoverage(String aID) throws IOException, TLfnServiceException
getCoverageIds()
query(ILfnQueryHandler, TLfnQuery)
and get the ID from the metadataaID
- the ID of the desired coveragenull
if it does not existIOException
- in case of an I/O failureTLfnServiceException
- in case of a service processing failureALfnCoverage
public ALfnAsset getAsset(String aID) throws IOException, TLfnServiceException
query(ELfnResourceType.ASSET)
and get the ID from the metadataquery(ILfnQueryHandler, TLfnQuery)
and get the ID from the metadataaID
- the ID of the desired assetnull
if it does not existIOException
- in case of an I/O failureTLfnServiceException
- in case of a service processing failurepublic ALfnTheme getTheme(String aID) throws IOException, TLfnServiceException
query(ELfnResourceType.THEME)
and get the ID from the metadataquery(ILfnQueryHandler, TLfnQuery)
and get the ID from the metadataaID
- the ID of the desired themenull
if it does not existIOException
- in case of an I/O failureTLfnServiceException
- in case of a service processing failurepublic <T extends ALfnResourceMetadata> T getResourceMetadata(String aID) throws IOException, TLfnServiceException
This implementation throws UnsupportedOperationException
.
Subclasses should override it to do something useful.
getResourceMetadata
in interface ILfnResourceMetadataResolver
aID
- the ID of the desired resourcenull
if it does not existIOException
- in case of an I/O failureTLfnServiceException
- in case of a service processing failurepublic <T extends ALfnResourceMetadata> T putResourceMetadata(T aMetadata) throws IOException, TLfnServiceException
TLfnServiceException
exception will be thrown.
This implementation throws UnsupportedOperationException
.
Subclasses should override it to do something useful.
aMetadata
- the metadata describing the resource to be putIOException
- in case of an I/O failureTLfnServiceException
- in case of a service processing failure or conflictpublic TLfnThemeMetadata getThemeMetadata(String aID) throws IOException, TLfnServiceException
getResourceMetadata(String)
, which is suitable for most subclasses.aID
- the ID of the desired themenull
if it does not existIOException
- in case of an I/O failureTLfnServiceException
- in case of a service processing failurepublic TLfnThemeMetadata putThemeMetadata(TLfnThemeMetadata aMetadata) throws IOException, TLfnServiceException
TLfnServiceException
exception will be thrown.
This implementation delegates to putResourceMetadata(com.luciad.fusion.tilestore.metadata.ALfnResourceMetadata)
, which is suitable for most subclasses.
aMetadata
- the metadata describing the theme to be putIOException
- in case of an I/O failureTLfnServiceException
- in case of a service processing failure or conflictpublic TLfnRasterCoverageMetadata getRasterCoverageMetadata(String aID) throws IOException, TLfnServiceException
getResourceMetadata(String)
, which is suitable for most subclasses.aID
- the ID of the desired raster coveragenull
if it does not existIOException
- in case of an I/O failureTLfnServiceException
- in case of a service processing failurepublic TLfnRasterCoverageMetadata putRasterCoverageMetadata(TLfnRasterCoverageMetadata aMetadata) throws IOException, TLfnServiceException
TLfnServiceException
This implementation delegates to putResourceMetadata(com.luciad.fusion.tilestore.metadata.ALfnResourceMetadata)
, which is suitable for most subclasses.
aMetadata
- the metadata describing the coverage to be putIOException
- in case of an I/O failureTLfnServiceException
- in case of a service processing failurepublic TLfnVectorCoverageMetadata getVectorCoverageMetadata(String aID) throws IOException, TLfnServiceException
getResourceMetadata(String)
, which is suitable for most subclasses.aID
- the ID of the vector coveragenull
if it does not existIOException
- in case of an I/O failureTLfnServiceException
- in case of a service processing failurepublic TLfnVectorCoverageMetadata putVectorCoverageMetadata(TLfnVectorCoverageMetadata aMetadata) throws IOException, TLfnServiceException
TLfnServiceException
This implementation delegates to putResourceMetadata(com.luciad.fusion.tilestore.metadata.ALfnResourceMetadata)
, which is suitable for most subclasses.
aMetadata
- the metadata describing the coverage to be putIOException
- in case of an I/O failureTLfnServiceException
- in case of a service processing failurepublic TLfnRasterAssetMetadata getRasterAssetMetadata(String aID) throws IOException, TLfnServiceException
getResourceMetadata(String)
, which is suitable for most subclasses.aID
- the ID of the desired raster assetnull
if it does not existIOException
- in case of an I/O failureTLfnServiceException
- in case of a service processing failurepublic TLfnRasterAssetMetadata putRasterAssetMetadata(TLfnRasterAssetMetadata aMetadata) throws IOException, TLfnServiceException
TLfnServiceException
.
This implementation delegates to putResourceMetadata(com.luciad.fusion.tilestore.metadata.ALfnResourceMetadata)
, which is suitable for most subclasses.
aMetadata
- the metadata describing the asset to be putIOException
- in case of an I/O failureTLfnServiceException
- in case of a service processing failurepublic TLfnVectorAssetMetadata getVectorAssetMetadata(String aID) throws IOException, TLfnServiceException
getResourceMetadata(String)
, which is suitable for most subclasses.aID
- the ID of the desired vector assetnull
if it does not existIOException
- in case of an I/O failureTLfnServiceException
- in case of a service processing failurepublic TLfnVectorAssetMetadata putVectorAssetMetadata(TLfnVectorAssetMetadata aMetadata) throws IOException, TLfnServiceException
TLfnServiceException
.
This implementation delegates to putResourceMetadata(com.luciad.fusion.tilestore.metadata.ALfnResourceMetadata)
, which is suitable for most subclasses.
aMetadata
- the metadata describing the asset to be putIOException
- in case of an I/O failureTLfnServiceException
- in case of a service processing failurepublic boolean deleteResource(String aID) throws IOException, TLfnServiceException
aID
- the ID of a resource to be deletedtrue
if the resource has been deleted, false
if the resource does not existIOException
- in case of an I/O failureTLfnServiceException
- in case of a service processing failurepublic Future<?> query(ILfnQueryHandler aHandler, TLfnQuery aQuery)
aHandler
- the handler for the resultsaQuery
- the query to be performedpublic List<String> getCoverageIds()
query(ILfnQueryHandler, TLfnQuery)
.
Any checked exceptions on the asynchronous handler will be wrapped in a RuntimeException
.null
public <R extends ALfnResourceMetadata> List<R> query(ELfnResourceType aResourceType)
query(ILfnQueryHandler, TLfnQuery)
.
Any checked exceptions on the asynchronous handler will be wrapped in a RuntimeException
.R
- the expected resource type, which must not be null
aResourceType
- null
public 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.WriteResult.PUT
if data
with the given key already existed,
ALfnTileStore.WriteResult.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.WriteResult.NOT_FOUND
otherwise.public String toString()
public void close() throws IOException
close
in interface Closeable
close
in interface AutoCloseable
IOException
- in case of an I/O failure