public class TLfnFileSystemTileStore extends ALfnTileStore
TLfnTileStoreOperation.IMPORT_COVERAGE_OPERATION
.
This class is thread-safe.ALfnTileStore
ALfnTileStore.CommitPolicy, ALfnTileStore.ReadResult, ALfnTileStore.Result, ALfnTileStore.WriteResult
Constructor and Description |
---|
TLfnFileSystemTileStore(File aHome,
boolean aCreate,
ALfnEnvironment aEnvironment)
Opens a Tile Store on the file system, optionally creating it first.
|
TLfnFileSystemTileStore(File aHome,
boolean aCreate,
ALfnEnvironment aEnvironment,
ALfnBinaryMetadataStore aAssetStore,
ALfnBinaryMetadataStore aCoverageStore,
ALfnBinaryMetadataStore aThemeStore)
Opens a Tile Store on the file system, optionally creating it first.
|
TLfnFileSystemTileStore(File aHome,
boolean aCreate,
ALfnEnvironment aEnvironment,
ALfnTileStore.CommitPolicy aCommitPolicy)
Opens a Tile Store on the file system, optionally creating it first.
|
TLfnFileSystemTileStore(File aHome,
boolean aCreate,
ALfnEnvironment aEnvironment,
ALfnTileStore.CommitPolicy aCommitPolicy,
ALfnBinaryMetadataStore aAssetStore,
ALfnBinaryMetadataStore aCoverageStore,
ALfnBinaryMetadataStore aThemeStore)
Opens a Tile Store on the file system, optionally creating it first.
|
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.
|
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.
|
File |
getHome()
Gets the home dir of this Tile Store.
|
<T extends ALfnResourceMetadata> |
getResourceMetadata(String aID)
Gets the metadata of a resource.
|
ALfnTheme |
getTheme(String aID)
Gets a theme from the Tile Store.
|
URI |
getURI()
Gets the Tile Store home as a URI.
|
Future<ALfnTileStore.ReadResult> |
getUserData(String aKey,
WritableByteChannel aSink,
ILfnCallback<ALfnTileStore.ReadResult> aCallback)
Gets binary user data from this Tile Store with a given key.
|
void |
putMetadata(TLfnTileStoreMetadata aTileStoreMetadata)
Updates the metadata of this Tile Store.
|
<T extends ALfnResourceMetadata> |
putResourceMetadata(T aMetadata)
Adds or updates the metadata of a resource.
|
Future<ALfnTileStore.WriteResult> |
putUserData(String aKey,
ReadableByteChannel aSource,
ILfnCallback<ALfnTileStore.WriteResult> aCallback)
Puts binary user data in this Tile Store with a given key.
|
Future<?> |
query(ILfnQueryHandler aQueryHandler,
TLfnQuery aQuery)
Queries the Tile Store for resources' metadata.
|
getMetadata, getRasterAssetMetadata, getRasterCoverageMetadata, getThemeMetadata, getVectorAssetMetadata, getVectorCoverageMetadata, putRasterAssetMetadata, putRasterCoverageMetadata, putThemeMetadata, putVectorAssetMetadata, putVectorCoverageMetadata, query, toString
public TLfnFileSystemTileStore(File aHome, boolean aCreate, ALfnEnvironment aEnvironment) throws IOException
aHome
- the home directory of the Tile StoreaCreate
- true
the Tile Store may be created on the file system if missing,
false
the Tile Store must not be created if missing and should throw
FileNotFoundException
aEnvironment
- the core environmentFileNotFoundException
- when the Tile Store is missing and must not be createdIOException
- when the Tile Store cannot be openedpublic TLfnFileSystemTileStore(File aHome, boolean aCreate, ALfnEnvironment aEnvironment, ALfnTileStore.CommitPolicy aCommitPolicy) throws IOException
aHome
- the home directory of the Tile StoreaCreate
- true
the Tile Store may be created on the file system if missing,
false
the Tile Store must not be created if missing and should
throw FileNotFoundException
aEnvironment
- the core environmentaCommitPolicy
- if PER_COVERAGE
, tiles will not be visible until the whole
coverage is completely fused. This contrasts with the default PER_TILE
, where new tiles are immediately visible. Use the former if you
want a consistent view of the tiles in a coverage.FileNotFoundException
- when the Tile Store is missing and must not be createdIOException
- when the Tile Store cannot be openedpublic TLfnFileSystemTileStore(File aHome, boolean aCreate, ALfnEnvironment aEnvironment, ALfnBinaryMetadataStore aAssetStore, ALfnBinaryMetadataStore aCoverageStore, ALfnBinaryMetadataStore aThemeStore) throws IOException, TLfnServiceException
aHome
- the home directory of the Tile StoreaCreate
- true
the Tile Store may be created on the file system if missing,
false
the Tile Store must not be created if missing and should
throw FileNotFoundException
aEnvironment
- the core environmentaAssetStore
- the metadata store to store and retrieve asset metadataaCoverageStore
- the metadata store to store and retrieve coverage metadataaThemeStore
- the metadata store to store and retrieve theme metadataFileNotFoundException
- when the Tile Store is missing and must not be createdIOException
- when the Tile Store cannot be openedTLfnServiceException
public TLfnFileSystemTileStore(File aHome, boolean aCreate, ALfnEnvironment aEnvironment, ALfnTileStore.CommitPolicy aCommitPolicy, ALfnBinaryMetadataStore aAssetStore, ALfnBinaryMetadataStore aCoverageStore, ALfnBinaryMetadataStore aThemeStore) throws IOException, TLfnServiceException
aHome
- the home directory of the Tile StoreaCreate
- true
the Tile Store may be created on the file system if missing,
false
the Tile Store must not be created if missing and should
throw FileNotFoundException
aEnvironment
- the core environmentaCommitPolicy
- if PER_COVERAGE
, tiles will not be visible until the whole
coverage is completely fused. This contrasts with the default PER_TILE
, where new tiles are immediately visible. Use the former if you
want a consistent view of the tiles in a coverage.aAssetStore
- the metadata store to store and retrieve asset metadataaCoverageStore
- the metadata store to store and retrieve coverage metadataaThemeStore
- the metadata store to store and retrieve theme metadataFileNotFoundException
- when the Tile Store is missing and must not be createdIOException
- when the Tile Store cannot be openedTLfnServiceException
public File getHome()
public URI getURI()
getURI
in class ALfnTileStore
public boolean deleteResource(String aID) throws IOException, TLfnServiceException
ALfnTileStore
deleteResource
in class ALfnTileStore
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 ALfnCoverage getCoverage(String aID) throws IOException, TLfnServiceException
ALfnTileStore
ALfnTileStore.getCoverageIds()
ALfnTileStore.query(ILfnQueryHandler, TLfnQuery)
and get the ID from the metadatagetCoverage
in class ALfnTileStore
aID
- 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
ALfnTileStore
query(ELfnResourceType.ASSET)
and get the ID from the metadataALfnTileStore.query(ILfnQueryHandler, TLfnQuery)
and get the ID from the metadatagetAsset
in class ALfnTileStore
aID
- 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
ALfnTileStore
query(ELfnResourceType.THEME)
and get the ID from the metadataALfnTileStore.query(ILfnQueryHandler, TLfnQuery)
and get the ID from the metadatagetTheme
in class ALfnTileStore
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 Future<?> query(ILfnQueryHandler aQueryHandler, TLfnQuery aQuery)
ALfnTileStore
query
in class ALfnTileStore
aQueryHandler
- the handler for the resultsaQuery
- the query to be performedpublic <T extends ALfnResourceMetadata> T getResourceMetadata(String aID) throws IOException, TLfnServiceException
ALfnTileStore
This implementation throws UnsupportedOperationException
.
Subclasses should override it to do something useful.
getResourceMetadata
in interface ILfnResourceMetadataResolver
getResourceMetadata
in class ALfnTileStore
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
ALfnTileStore
TLfnServiceException
exception will be thrown.
This implementation throws UnsupportedOperationException
.
Subclasses should override it to do something useful.
putResourceMetadata
in class ALfnTileStore
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 TLfnTileStoreCapabilities getCapabilities() throws IOException, TLfnServiceException
ALfnTileStore
The capabilities provide the Tile Store metadata and the supported operations. The operations are defined as constants on this class.
getCapabilities
in class ALfnTileStore
IOException
- in case of an I/O failureTLfnServiceException
- in case of a service processing failurepublic void putMetadata(TLfnTileStoreMetadata aTileStoreMetadata) throws IOException, TLfnServiceException
ALfnTileStore
Updates the metadata of this Tile Store.
putMetadata
in class ALfnTileStore
aTileStoreMetadata
- The new metadata for this Tile StoreIOException
- in case of an I/O failureTLfnServiceException
- in case of a service processing failurepublic List<String> getCoverageIds()
ALfnTileStore
ALfnTileStore.query(ILfnQueryHandler, TLfnQuery)
.
Any checked exceptions on the asynchronous handler will be wrapped in a RuntimeException
.getCoverageIds
in class ALfnTileStore
null
public void close() throws IOException
ALfnTileStore
close
in interface Closeable
close
in interface AutoCloseable
close
in class ALfnTileStore
IOException
- in case of an I/O failurepublic Future<ALfnTileStore.WriteResult> putUserData(String aKey, ReadableByteChannel aSource, ILfnCallback<ALfnTileStore.WriteResult> aCallback)
ALfnTileStore
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 ALfnTileStore
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)
ALfnTileStore
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 ALfnTileStore
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)
ALfnTileStore
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 ALfnTileStore
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.