Class TLfnFileSystemTileStore
- All Implemented Interfaces:
ILfnResourceMetadataResolver
,Closeable
,AutoCloseable
TLfnTileStoreOperation.IMPORT_COVERAGE_OPERATION
.
This class is thread-safe.- Since:
- 10.0
- See Also:
-
Nested Class Summary
Nested classes/interfaces inherited from class com.luciad.fusion.tilestore.ALfnTileStore
ALfnTileStore.CommitPolicy, ALfnTileStore.ReadResult, ALfnTileStore.Result, ALfnTileStore.WriteResult
-
Constructor Summary
ConstructorDescriptionTLfnFileSystemTileStore
(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. -
Method Summary
Modifier and TypeMethodDescriptionvoid
close()
Closes this Tile Store instance.boolean
deleteResource
(String aID) Deletes both the data and metadata of a resource.deleteUserData
(String aKey, ILfnCallback<ALfnTileStore.WriteResult> aCallback) Deletes binary user data from this Tile Store with a given key.Gets an asset from the Tile Store.Gets the capabilities offered by the Tile Store.getCoverage
(String aID) Gets a coverage from the Tile Store.Gets the IDs of all this Tile Store's coverage metadatas.getHome()
Gets the home dir of this Tile Store.<T extends ALfnResourceMetadata>
TGets the metadata of a resource.Gets a theme from the Tile Store.getURI()
Gets the Tile Store home as a URI.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>
TputResourceMetadata
(T aMetadata) Adds or updates the metadata of a resource.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.Methods inherited from class com.luciad.fusion.tilestore.ALfnTileStore
getMetadata, getRasterAssetMetadata, getRasterCoverageMetadata, getThemeMetadata, getVectorAssetMetadata, getVectorCoverageMetadata, putRasterAssetMetadata, putRasterCoverageMetadata, putThemeMetadata, putVectorAssetMetadata, putVectorCoverageMetadata, query, toString
-
Constructor Details
-
TLfnFileSystemTileStore
public TLfnFileSystemTileStore(File aHome, boolean aCreate, ALfnEnvironment aEnvironment) throws IOException Opens a Tile Store on the file system, optionally creating it first. A Tile Store created using this constructor uses the file-system based metadata store for storing and retrieving metadata, in which each metadata is stored in a separate XML file.- Parameters:
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 throwFileNotFoundException
aEnvironment
- the core environment- Throws:
FileNotFoundException
- when the Tile Store is missing and must not be createdIOException
- when the Tile Store cannot be opened
-
TLfnFileSystemTileStore
public TLfnFileSystemTileStore(File aHome, boolean aCreate, ALfnEnvironment aEnvironment, ALfnTileStore.CommitPolicy aCommitPolicy) throws IOException Opens a Tile Store on the file system, optionally creating it first. A Tile Store created using this constructor uses the file-system based metadata store for storing and retrieving metadata, in which each metadata is stored in a separate XML file.- Parameters:
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 throwFileNotFoundException
aEnvironment
- the core environmentaCommitPolicy
- ifPER_COVERAGE
, tiles will not be visible until the whole coverage is completely fused. This contrasts with the defaultPER_TILE
, where new tiles are immediately visible. Use the former if you want a consistent view of the tiles in a coverage.- Throws:
FileNotFoundException
- when the Tile Store is missing and must not be createdIOException
- when the Tile Store cannot be opened
-
TLfnFileSystemTileStore
public TLfnFileSystemTileStore(File aHome, boolean aCreate, ALfnEnvironment aEnvironment, ALfnBinaryMetadataStore aAssetStore, ALfnBinaryMetadataStore aCoverageStore, ALfnBinaryMetadataStore aThemeStore) throws IOException, TLfnServiceException Opens a Tile Store on the file system, optionally creating it first. The metadata stores provided in the constructor are not closed upon shutdown of the environment; you should close them explicitly once they are no longer needed.- Parameters:
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 throwFileNotFoundException
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 metadata- Throws:
FileNotFoundException
- when the Tile Store is missing and must not be createdIOException
- when the Tile Store cannot be openedTLfnServiceException
-
TLfnFileSystemTileStore
public TLfnFileSystemTileStore(File aHome, boolean aCreate, ALfnEnvironment aEnvironment, ALfnTileStore.CommitPolicy aCommitPolicy, ALfnBinaryMetadataStore aAssetStore, ALfnBinaryMetadataStore aCoverageStore, ALfnBinaryMetadataStore aThemeStore) throws IOException, TLfnServiceException Opens a Tile Store on the file system, optionally creating it first. The metadata stores provided in the constructor are not closed upon shutdown of the environment; you should close them explicitly once they are no longer needed.- Parameters:
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 throwFileNotFoundException
aEnvironment
- the core environmentaCommitPolicy
- ifPER_COVERAGE
, tiles will not be visible until the whole coverage is completely fused. This contrasts with the defaultPER_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 metadata- Throws:
FileNotFoundException
- when the Tile Store is missing and must not be createdIOException
- when the Tile Store cannot be openedTLfnServiceException
-
-
Method Details
-
getHome
Gets the home dir of this Tile Store.- Returns:
- the path of the Tile Store home
-
getURI
Gets the Tile Store home as a URI.- Specified by:
getURI
in classALfnTileStore
- Returns:
- Tile Store home URI
-
deleteResource
Description copied from class:ALfnTileStore
Deletes both the data and metadata of a resource. As soon as this method returns, the resource can be considered deleted for all practical purposes. Note however that space reclamation may or may not be immediate, since it is taken care of by a background process.- Overrides:
deleteResource
in classALfnTileStore
- Parameters:
aID
- the ID of a resource to be deleted- Returns:
true
if the resource has been deleted,false
if the resource does not exist- Throws:
IOException
- in case of an I/O failureTLfnServiceException
- in case of a service processing failure
-
getCoverage
Description copied from class:ALfnTileStore
Gets a coverage from the Tile Store. Coverage IDs can be found using either:ALfnTileStore.getCoverageIds()
ALfnTileStore.query(ILfnQueryHandler, TLfnQuery)
and get the ID from the metadata
- Overrides:
getCoverage
in classALfnTileStore
- Parameters:
aID
- the ID of the desired coverage- Returns:
- the coverage or
null
if it does not exist - Throws:
IOException
- in case of an I/O failureTLfnServiceException
- in case of a service processing failure- See Also:
-
getAsset
Description copied from class:ALfnTileStore
Gets an asset from the Tile Store. Asset IDs can be found using either:query(ELfnResourceType.ASSET)
and get the ID from the metadataALfnTileStore.query(ILfnQueryHandler, TLfnQuery)
and get the ID from the metadata
- Overrides:
getAsset
in classALfnTileStore
- Parameters:
aID
- the ID of the desired asset- Returns:
- the asset or
null
if it does not exist - Throws:
IOException
- in case of an I/O failureTLfnServiceException
- in case of a service processing failure
-
getTheme
Description copied from class:ALfnTileStore
Gets a theme from the Tile Store. Theme IDs can be found using either:query(ELfnResourceType.THEME)
and get the ID from the metadataALfnTileStore.query(ILfnQueryHandler, TLfnQuery)
and get the ID from the metadata
- Overrides:
getTheme
in classALfnTileStore
- Parameters:
aID
- the ID of the desired theme- Returns:
- the theme, or
null
if it does not exist - Throws:
IOException
- in case of an I/O failureTLfnServiceException
- in case of a service processing failure
-
query
Description copied from class:ALfnTileStore
Queries the Tile Store for resources' metadata. The query returns the metadata of resources that match a given filter and type. Even though the API is asynchronous, implementations may be synchronous or asynchronous. The default implementations are in fact synchronous, but that is an implementation detail which may change at any time.- Overrides:
query
in classALfnTileStore
- Parameters:
aQueryHandler
- the handler for the resultsaQuery
- the query to be performed- Returns:
- the future of the request, which could be asynchronous
-
getResourceMetadata
public <T extends ALfnResourceMetadata> T getResourceMetadata(String aID) throws IOException, TLfnServiceException Description copied from class:ALfnTileStore
Gets the metadata of a resource.This implementation throws
UnsupportedOperationException
. Subclasses should override it to do something useful.- Specified by:
getResourceMetadata
in interfaceILfnResourceMetadataResolver
- Overrides:
getResourceMetadata
in classALfnTileStore
- Parameters:
aID
- the ID of the desired resource- Returns:
- the resource corresponding to the given ID, or
null
if it does not exist - Throws:
IOException
- in case of an I/O failureTLfnServiceException
- in case of a service processing failure
-
putResourceMetadata
public <T extends ALfnResourceMetadata> T putResourceMetadata(T aMetadata) throws IOException, TLfnServiceException Description copied from class:ALfnTileStore
Adds or updates the metadata of a resource. The put sequence is verified:-
addition of a new resource will fail if a resource with the same ID already exists;
put of an existing resource will fail if the version of the updated metadata does
not match the metadata on the LuciadFusion service.
TLfnServiceException
exception will be thrown.This implementation throws
UnsupportedOperationException
. Subclasses should override it to do something useful.- Overrides:
putResourceMetadata
in classALfnTileStore
- Parameters:
aMetadata
- the metadata describing the resource to be put- Returns:
- the resource metadata with the new put sequence
- Throws:
IOException
- in case of an I/O failureTLfnServiceException
- in case of a service processing failure or conflict
-
getCapabilities
Description copied from class:ALfnTileStore
Gets the capabilities offered by the Tile Store.The capabilities provide the Tile Store metadata and the supported operations. The operations are defined as constants on this class.
- Specified by:
getCapabilities
in classALfnTileStore
- Returns:
- the Tile Store capabilities
- Throws:
IOException
- in case of an I/O failureTLfnServiceException
- in case of a service processing failure
-
putMetadata
public void putMetadata(TLfnTileStoreMetadata aTileStoreMetadata) throws IOException, TLfnServiceException Description copied from class:ALfnTileStore
Updates the metadata of this Tile Store.
- Specified by:
putMetadata
in classALfnTileStore
- Parameters:
aTileStoreMetadata
- The new metadata for this Tile Store- Throws:
IOException
- in case of an I/O failureTLfnServiceException
- in case of a service processing failure
-
getCoverageIds
Description copied from class:ALfnTileStore
Gets the IDs of all this Tile Store's coverage metadatas. This is a blocking call. It is a convenience method for the asynchronousALfnTileStore.query(ILfnQueryHandler, TLfnQuery)
. Any checked exceptions on the asynchronous handler will be wrapped in aRuntimeException
.- Overrides:
getCoverageIds
in classALfnTileStore
- Returns:
- the IDs of all this Tile Store's coverages, possibly empty but never
null
-
close
Description copied from class:ALfnTileStore
Closes this Tile Store instance. This method does nothing, but subclasses may override it to do something useful.- Specified by:
close
in interfaceAutoCloseable
- Specified by:
close
in interfaceCloseable
- Overrides:
close
in classALfnTileStore
- Throws:
IOException
- in case of an I/O failure
-
putUserData
public Future<ALfnTileStore.WriteResult> putUserData(String aKey, ReadableByteChannel aSource, ILfnCallback<ALfnTileStore.WriteResult> aCallback) Description copied from class:ALfnTileStore
Puts binary user data in this Tile Store 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 ahandler
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.- Overrides:
putUserData
in classALfnTileStore
- 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 benull
.- Returns:
- A future, with result code
ALfnTileStore.WriteResult.PUT
if data with the given key already existed,ALfnTileStore.WriteResult.CREATED
if it is new.
-
getUserData
public Future<ALfnTileStore.ReadResult> getUserData(String aKey, WritableByteChannel aSink, ILfnCallback<ALfnTileStore.ReadResult> aCallback) Description copied from class:ALfnTileStore
Gets binary user data from this Tile Store 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 ahandler
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.- Overrides:
getUserData
in classALfnTileStore
- 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 benull
.- Returns:
- A future, with result value
ALfnTileStore.ReadResult.FOUND
if data with the given key exists,ALfnTileStore.Result.Code.NOT_FOUND
otherwise.
-
deleteUserData
public Future<ALfnTileStore.WriteResult> deleteUserData(String aKey, ILfnCallback<ALfnTileStore.WriteResult> aCallback) Description copied from class:ALfnTileStore
Deletes binary user data from this Tile Store 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 ahandler
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.- Overrides:
deleteUserData
in classALfnTileStore
- Parameters:
aKey
- A key associated with the user data.aCallback
- A callback that will be invoked when the operation is finished. May benull
.- Returns:
- A future, with result value
ALfnTileStore.WriteResult.DELETED
if data existed,ALfnTileStore.WriteResult.NOT_FOUND
otherwise.
-