@Named public class DefaultUpdatePolicyAnalyzer extends java.lang.Object implements UpdatePolicyAnalyzer, Service
Constructor and Description |
---|
DefaultUpdatePolicyAnalyzer() |
DefaultUpdatePolicyAnalyzer(LoggerFactory loggerFactory) |
Modifier and Type | Method and Description |
---|---|
java.lang.String |
getEffectiveUpdatePolicy(RepositorySystemSession session,
java.lang.String policy1,
java.lang.String policy2)
Returns the policy with the shorter update interval.
|
private int |
getMinutes(java.lang.String policy) |
void |
initService(ServiceLocator locator)
Provides the opportunity to initialize this service and to acquire other services for its operation from the
locator.
|
boolean |
isUpdatedRequired(RepositorySystemSession session,
long lastModified,
java.lang.String policy)
Determines whether the specified modification timestamp satisfies the freshness constraint expressed by the given
update policy.
|
private int |
ordinalOfUpdatePolicy(java.lang.String policy) |
DefaultUpdatePolicyAnalyzer |
setLoggerFactory(LoggerFactory loggerFactory) |
private Logger logger
public DefaultUpdatePolicyAnalyzer()
@Inject DefaultUpdatePolicyAnalyzer(LoggerFactory loggerFactory)
public void initService(ServiceLocator locator)
Service
initService
in interface Service
locator
- The service locator, must not be null
.public DefaultUpdatePolicyAnalyzer setLoggerFactory(LoggerFactory loggerFactory)
public java.lang.String getEffectiveUpdatePolicy(RepositorySystemSession session, java.lang.String policy1, java.lang.String policy2)
UpdatePolicyAnalyzer
getEffectiveUpdatePolicy
in interface UpdatePolicyAnalyzer
session
- The repository system session during which the request is made, must not be null
.policy1
- A policy to compare, may be null
.policy2
- A policy to compare, may be null
.private int ordinalOfUpdatePolicy(java.lang.String policy)
public boolean isUpdatedRequired(RepositorySystemSession session, long lastModified, java.lang.String policy)
UpdatePolicyAnalyzer
isUpdatedRequired
in interface UpdatePolicyAnalyzer
session
- The repository system session during which the check is made, must not be null
.lastModified
- The timestamp to check against the update policy.policy
- The update policy, may be null
.true
if the specified timestamp is older than acceptable by the update policy, false
otherwise.private int getMinutes(java.lang.String policy)