Class TLcdOGCModelProvider
- All Implemented Interfaces:
ILcdOGCModelProvider
,ILcdDisposable
,AutoCloseable
Default model provider implementation that delegates to the given ILcdOGCModelDecoderFactory
.
This implementation
- supports multi-dimensions
- adds a model cache
The getModelUpdateSequence
method implementation is based on the use of
System.currentTimeMillis()
. When a model gets decoded, it is assigned an update sequence, based on the
current time. When invalidate(String)
or invalidateAll()
is called, it will trigger the model
to be re-decoded, and the model update sequence will be updated. When the model changes in-memory (detected
using a model listener), the update sequence will be updated as well.
- Since:
- 2017.0
-
Constructor Summary
ConstructorDescriptionTLcdOGCModelProvider
(ILcdOGCModelDecoderFactory aModelDecoderFactory) Creates a model provider using the givenILcdOGCModelDecoderFactory
. -
Method Summary
Modifier and TypeMethodDescriptionvoid
dispose()
Disposes of this object and allows it to release any system resources that it is holding.getModel
(String aSourceName, ALcdRequestContext aRequestContext) Returns theILcdModel
corresponding to the given source name and request context.getModelUpdateSequence
(String aSourceName, ALcdRequestContext aRequestContext) SeeILcdOGCModelProvider
for more information about this method.void
invalidate
(String aSourceName) Clears the model cache for the given source.void
Clears the entire model cache.Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
Methods inherited from interface com.luciad.util.ILcdDisposable
close
-
Constructor Details
-
TLcdOGCModelProvider
Creates a model provider using the givenILcdOGCModelDecoderFactory
.- Parameters:
aModelDecoderFactory
- a model decoder factory.
-
-
Method Details
-
getModel
public ILcdModel getModel(String aSourceName, ALcdRequestContext aRequestContext) throws IOException Description copied from interface:ILcdOGCModelProvider
Returns theILcdModel
corresponding to the given source name and request context.- Specified by:
getModel
in interfaceILcdOGCModelProvider
- Parameters:
aSourceName
- the source name of the model.aRequestContext
- the request context. This can be null if the method is called by a process which is not handling a request.- Returns:
- the
ILcdModel
corresponding to the given source name. - Throws:
IOException
- if the model can not be returned (because decoding fails).
-
getModelUpdateSequence
public String getModelUpdateSequence(String aSourceName, ALcdRequestContext aRequestContext) throws IOException See
ILcdOGCModelProvider
for more information about this method.This implementation listens to the model, and in case of a change, updates the update sequence using
System.currentTimeMillis()
.- Specified by:
getModelUpdateSequence
in interfaceILcdOGCModelProvider
- Parameters:
aSourceName
- the source name of the model.aRequestContext
- the request context. This can be null if the method is called by a process which is not handling a request.- Returns:
- the update sequence value associated with the mode identified by the given source name.
- Throws:
IOException
- if the update sequence can not be determined
-
invalidate
Clears the model cache for the given source. Note that this will causegetModelUpdateSequence
to return a different value for new calls for the given source name.- Parameters:
aSourceName
- the source name.
-
invalidateAll
public void invalidateAll()Clears the entire model cache. Note that this will causegetModelUpdateSequence
to return a different value for new calls for all models. -
dispose
public void dispose()Description copied from interface:ILcdDisposable
Disposes of this object and allows it to release any system resources that it is holding.
The result of calling any other method (other than
finalize
) on this object subsequent to a call to this method is undefined.- Specified by:
dispose
in interfaceILcdDisposable
- Specified by:
dispose
in interfaceILcdOGCModelProvider
-