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
ConstructorsConstructorDescriptionTLcdOGCModelProvider(ILcdOGCModelDecoderFactory aModelDecoderFactory) Creates a model provider using the givenILcdOGCModelDecoderFactory. -
Method Summary
Modifier and TypeMethodDescriptionvoiddispose()Disposes of this object and allows it to release any system resources that it is holding.getModel(String aSourceName, ALcdRequestContext aRequestContext) Returns theILcdModelcorresponding to the given source name and request context.getModelUpdateSequence(String aSourceName, ALcdRequestContext aRequestContext) SeeILcdOGCModelProviderfor more information about this method.voidinvalidate(String aSourceName) Clears the model cache for the given source.voidClears the entire model cache.Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods 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:ILcdOGCModelProviderReturns theILcdModelcorresponding to the given source name and request context.- Specified by:
getModelin 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
ILcdModelcorresponding 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
ILcdOGCModelProviderfor 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:
getModelUpdateSequencein 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 causegetModelUpdateSequenceto 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 causegetModelUpdateSequenceto return a different value for new calls for all models. -
dispose
public void dispose()Description copied from interface:ILcdDisposableDisposes 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:
disposein interfaceILcdDisposable- Specified by:
disposein interfaceILcdOGCModelProvider
-