public class TLcdOGCModelProvider extends Object implements ILcdOGCModelProvider
Default model provider implementation that delegates to the given ILcdOGCModelDecoderFactory
.
This implementation
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.
Constructor and Description |
---|
TLcdOGCModelProvider(ILcdOGCModelDecoderFactory aModelDecoderFactory)
Creates a model provider using the given
ILcdOGCModelDecoderFactory . |
Modifier and Type | Method and Description |
---|---|
void |
dispose()
Disposes of this object and allows it to release any system resources that it is holding.
|
ILcdModel |
getModel(String aSourceName,
ALcdRequestContext aRequestContext)
Returns the
ILcdModel corresponding to the given source name and request context. |
String |
getModelUpdateSequence(String aSourceName,
ALcdRequestContext aRequestContext)
See
ILcdOGCModelProvider for more information about this method. |
void |
invalidate(String aSourceName)
Clears the model cache for the given source.
|
void |
invalidateAll()
Clears the entire model cache.
|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
close
public TLcdOGCModelProvider(ILcdOGCModelDecoderFactory aModelDecoderFactory)
ILcdOGCModelDecoderFactory
.aModelDecoderFactory
- a model decoder factory.public ILcdModel getModel(String aSourceName, ALcdRequestContext aRequestContext) throws IOException
ILcdOGCModelProvider
ILcdModel
corresponding to the given source name and request context.getModel
in interface ILcdOGCModelProvider
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.ILcdModel
corresponding to the given source name.IOException
- if the model can not be returned (because decoding fails).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()
.
getModelUpdateSequence
in interface ILcdOGCModelProvider
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.IOException
- if the update sequence can not be determinedpublic void invalidate(String aSourceName)
getModelUpdateSequence
to return a different value for new calls for the given source name.aSourceName
- the source name.public void invalidateAll()
getModelUpdateSequence
to return a different value for new calls for all models.public void dispose()
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.
dispose
in interface ILcdOGCModelProvider
dispose
in interface ILcdDisposable