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
ConstructorsConstructorDescriptionTLfnFileSystemTileStore(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 TypeMethodDescriptionvoidclose()Closes this Tile Store instance.booleandeleteResource(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.voidputMetadata(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-truethe Tile Store may be created on the file system if missing,falsethe Tile Store must not be created if missing and should throwFileNotFoundExceptionaEnvironment- 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-truethe Tile Store may be created on the file system if missing,falsethe Tile Store must not be created if missing and should throwFileNotFoundExceptionaEnvironment- 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-truethe Tile Store may be created on the file system if missing,falsethe Tile Store must not be created if missing and should throwFileNotFoundExceptionaEnvironment- 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-truethe Tile Store may be created on the file system if missing,falsethe Tile Store must not be created if missing and should throwFileNotFoundExceptionaEnvironment- 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:
getURIin classALfnTileStore- Returns:
- Tile Store home URI
-
deleteResource
Description copied from class:ALfnTileStoreDeletes 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:
deleteResourcein classALfnTileStore- Parameters:
aID- the ID of a resource to be deleted- Returns:
trueif the resource has been deleted,falseif 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:ALfnTileStoreGets 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:
getCoveragein classALfnTileStore- Parameters:
aID- the ID of the desired coverage- Returns:
- the coverage or
nullif 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:ALfnTileStoreGets 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:
getAssetin classALfnTileStore- Parameters:
aID- the ID of the desired asset- Returns:
- the asset or
nullif 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:ALfnTileStoreGets 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:
getThemein classALfnTileStore- Parameters:
aID- the ID of the desired theme- Returns:
- the theme, or
nullif 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:ALfnTileStoreQueries 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:
queryin 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:ALfnTileStoreGets the metadata of a resource.This implementation throws
UnsupportedOperationException. Subclasses should override it to do something useful.- Specified by:
getResourceMetadatain interfaceILfnResourceMetadataResolver- Overrides:
getResourceMetadatain classALfnTileStore- Parameters:
aID- the ID of the desired resource- Returns:
- the resource corresponding to the given ID, or
nullif 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:ALfnTileStoreAdds 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.
TLfnServiceExceptionexception will be thrown.This implementation throws
UnsupportedOperationException. Subclasses should override it to do something useful.- Overrides:
putResourceMetadatain 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:ALfnTileStoreGets 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:
getCapabilitiesin 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:ALfnTileStoreUpdates the metadata of this Tile Store.
- Specified by:
putMetadatain 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:ALfnTileStoreGets 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:
getCoverageIdsin classALfnTileStore- Returns:
- the IDs of all this Tile Store's coverages, possibly empty but never
null
-
close
Description copied from class:ALfnTileStoreCloses this Tile Store instance. This method does nothing, but subclasses may override it to do something useful.- Specified by:
closein interfaceAutoCloseable- Specified by:
closein interfaceCloseable- Overrides:
closein 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:ALfnTileStorePuts 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
Futureto wait for the result, or use ahandlerto 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:
putUserDatain 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.PUTif data with the given key already existed,ALfnTileStore.WriteResult.CREATEDif it is new.
-
getUserData
public Future<ALfnTileStore.ReadResult> getUserData(String aKey, WritableByteChannel aSink, ILfnCallback<ALfnTileStore.ReadResult> aCallback) Description copied from class:ALfnTileStoreGets 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
Futureto wait for the result, or use ahandlerto 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:
getUserDatain 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.FOUNDif data with the given key exists,ALfnTileStore.Result.Code.NOT_FOUNDotherwise.
-
deleteUserData
public Future<ALfnTileStore.WriteResult> deleteUserData(String aKey, ILfnCallback<ALfnTileStore.WriteResult> aCallback) Description copied from class:ALfnTileStoreDeletes 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
Futureto wait for the result, or use ahandlerto 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:
deleteUserDatain 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.DELETEDif data existed,ALfnTileStore.WriteResult.NOT_FOUNDotherwise.
-