Package org.opensaml.core.xml.persist
Class AbstractConditionalLoadXMLObjectLoadSaveManager<T extends XMLObject>
java.lang.Object
org.opensaml.core.xml.persist.AbstractConditionalLoadXMLObjectLoadSaveManager<T>
- Type Parameters:
T
- the base type of XML objects being managed
- All Implemented Interfaces:
ConditionalLoadXMLObjectLoadSaveManager<T>
,XMLObjectLoadSaveManager<T>
- Direct Known Subclasses:
FilesystemLoadSaveManager
,MapLoadSaveManager
public abstract class AbstractConditionalLoadXMLObjectLoadSaveManager<T extends XMLObject>
extends Object
implements ConditionalLoadXMLObjectLoadSaveManager<T>
Abstract base class for
XMLObjectLoadSaveManager
implementations which
track the modify times of requested data such that XMLObjectLoadSaveManager.load(String)
returns
data only if the data associated with the key has been modified since the last
request.-
Field Summary
FieldsModifier and TypeFieldDescriptionprivate boolean
Configuration flag for whetherXMLObjectLoadSaveManager.load(String)
will check and return data only if modified since the last request for that data.Storage for last modified time of requested data. -
Constructor Summary
ConstructorsModifierConstructorDescriptionprotected
AbstractConditionalLoadXMLObjectLoadSaveManager
(boolean conditionalLoad) Constructor. -
Method Summary
Modifier and TypeMethodDescriptionvoid
Clear the cached modified times for the last load for all keys.Clear the cached modified time for the last load of the specified key.Retrieve the cached modified time for the last load of the specified key.boolean
Get whetherXMLObjectLoadSaveManager.load(String)
will check and return data only if modified since the last request for that data.protected abstract boolean
Check whether the data corresponding to the specified key has been modified since the last timeXMLObjectLoadSaveManager.load(String)
was called for that key.protected Instant
Update the cached modified time for the specified key with the current time.protected Instant
updateLoadLastModified
(String key, Instant modified) Update the cached modified time for the specified key with the specified time.
-
Field Details
-
loadConditionally
private boolean loadConditionallyConfiguration flag for whetherXMLObjectLoadSaveManager.load(String)
will check and return data only if modified since the last request for that data. -
loadLastModified
Storage for last modified time of requested data.
-
-
Constructor Details
-
AbstractConditionalLoadXMLObjectLoadSaveManager
protected AbstractConditionalLoadXMLObjectLoadSaveManager(@ParameterName(name="conditionalLoad") boolean conditionalLoad) Constructor.- Parameters:
conditionalLoad
- whetherXMLObjectLoadSaveManager.load(String)
should behave as defined inConditionalLoadXMLObjectLoadSaveManager
-
-
Method Details
-
isLoadConditionally
public boolean isLoadConditionally()Get whetherXMLObjectLoadSaveManager.load(String)
will check and return data only if modified since the last request for that data.- Specified by:
isLoadConditionally
in interfaceConditionalLoadXMLObjectLoadSaveManager<T extends XMLObject>
- Returns:
- true if data modify time check is enabled, false if not
-
getLoadLastModified
Retrieve the cached modified time for the last load of the specified key.Note that this will be null if
XMLObjectLoadSaveManager.load(String)
has not been called for the specified key since construction or since the last call toConditionalLoadXMLObjectLoadSaveManager.clearLoadLastModified(String)
orConditionalLoadXMLObjectLoadSaveManager.clearAllLoadLastModified()
.- Specified by:
getLoadLastModified
in interfaceConditionalLoadXMLObjectLoadSaveManager<T extends XMLObject>
- Parameters:
key
- the target key- Returns:
- the current cached modified time, may be null
-
clearLoadLastModified
Clear the cached modified time for the last load of the specified key.- Specified by:
clearLoadLastModified
in interfaceConditionalLoadXMLObjectLoadSaveManager<T extends XMLObject>
- Parameters:
key
- the target key- Returns:
- the previously cached modified time, or null if did not exist
-
clearAllLoadLastModified
public void clearAllLoadLastModified()Clear the cached modified times for the last load for all keys.- Specified by:
clearAllLoadLastModified
in interfaceConditionalLoadXMLObjectLoadSaveManager<T extends XMLObject>
-
updateLoadLastModified
Update the cached modified time for the specified key with the current time.- Parameters:
key
- the target key- Returns:
- the previously cached modified time, or null if did not exist
-
updateLoadLastModified
Update the cached modified time for the specified key with the specified time.- Parameters:
key
- the target keymodified
- the new cached modified time- Returns:
- the previously cached modified time, or null if did not exist
-
isUnmodifiedSinceLastLoad
Check whether the data corresponding to the specified key has been modified since the last timeXMLObjectLoadSaveManager.load(String)
was called for that key.- Parameters:
key
- the data key- Returns:
- true if the corresponding data has been modified since the last load, false otherwise
- Throws:
IOException
- if there is a fatal error evaluating the last modified status
-