Class UpdateTimeVisitor
- java.lang.Object
-
- com.composum.sling.clientlibs.processor.AbstractClientlibVisitor
-
- com.composum.sling.clientlibs.processor.UpdateTimeVisitor
-
- All Implemented Interfaces:
ClientlibVisitor
public class UpdateTimeVisitor extends AbstractClientlibVisitor
Determines the hash of the embedded items of a clientlib or -category for recency checking of cached files.
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from interface com.composum.sling.clientlibs.handle.ClientlibVisitor
ClientlibVisitor.VisitorMode
-
-
Field Summary
Fields Modifier and Type Field Description protected Calendar
lastUpdateTime
-
Fields inherited from class com.composum.sling.clientlibs.processor.AbstractClientlibVisitor
embeddedHash, hasEmbeddedFiles, HASH_PATTERN, owner, processedElements, resolver, service
-
-
Constructor Summary
Constructors Modifier Constructor Description UpdateTimeVisitor(ClientlibElement owner, ClientlibService service, org.apache.sling.api.resource.ResourceResolver resolver)
protected
UpdateTimeVisitor(ClientlibElement owner, ClientlibService service, org.apache.sling.api.resource.ResourceResolver resolver, LinkedHashSet<ClientlibLink> processedElements)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
action(ClientlibFile file, ClientlibVisitor.VisitorMode mode, ClientlibResourceFolder parent)
Optional action to take after visiting the element.void
action(Clientlib clientlib, ClientlibVisitor.VisitorMode mode, ClientlibResourceFolder parent)
Optional action to take after visiting the element.protected ClientlibVisitor
createVisitorFor(ClientlibElement element)
Creates a new visitor for the given clientlib or category as owner.UpdateTimeVisitor
execute()
Triggers the processing of theClientlibVisitor.getOwner()
by callingClientlibElement.accept(ClientlibVisitor, VisitorMode, ClientlibResourceFolder)
.Calendar
getLastUpdateTime()
Returns the last update time estimated from the file update times and clientlib folder create times.protected void
updateTime(Object entity, Calendar resourceTime)
-
Methods inherited from class com.composum.sling.clientlibs.processor.AbstractClientlibVisitor
action, action, action, alreadyProcessed, getHash, getOwner, getProcessedElements, getVisitorFor, isNotProcessed, markAsProcessed, notPresent, removeMinificationDuplicates, resolveAndAccept, supportsEmbedding, updateHash, visit, visit, visit, visit, visit
-
-
-
-
Field Detail
-
lastUpdateTime
protected Calendar lastUpdateTime
-
-
Constructor Detail
-
UpdateTimeVisitor
public UpdateTimeVisitor(ClientlibElement owner, ClientlibService service, org.apache.sling.api.resource.ResourceResolver resolver)
-
UpdateTimeVisitor
protected UpdateTimeVisitor(ClientlibElement owner, ClientlibService service, org.apache.sling.api.resource.ResourceResolver resolver, LinkedHashSet<ClientlibLink> processedElements)
-
-
Method Detail
-
execute
public UpdateTimeVisitor execute() throws IOException, javax.jcr.RepositoryException
Description copied from interface:ClientlibVisitor
Triggers the processing of theClientlibVisitor.getOwner()
by callingClientlibElement.accept(ClientlibVisitor, VisitorMode, ClientlibResourceFolder)
.- Specified by:
execute
in interfaceClientlibVisitor
- Overrides:
execute
in classAbstractClientlibVisitor
- Returns:
- this
- Throws:
IOException
javax.jcr.RepositoryException
-
getLastUpdateTime
public Calendar getLastUpdateTime()
Returns the last update time estimated from the file update times and clientlib folder create times. This is only a lower bound for the update time of the client library including its embedded files.
-
createVisitorFor
protected ClientlibVisitor createVisitorFor(ClientlibElement element)
Description copied from class:AbstractClientlibVisitor
Creates a new visitor for the given clientlib or category as owner. That'll usually be of the same type as ourselves. Caution: they have to share the sameAbstractClientlibVisitor.processedElements
set!- Specified by:
createVisitorFor
in classAbstractClientlibVisitor
-
action
public void action(Clientlib clientlib, ClientlibVisitor.VisitorMode mode, ClientlibResourceFolder parent)
Description copied from class:AbstractClientlibVisitor
Optional action to take after visiting the element. Default : empty.- Overrides:
action
in classAbstractClientlibVisitor
-
action
public void action(ClientlibFile file, ClientlibVisitor.VisitorMode mode, ClientlibResourceFolder parent)
Description copied from class:AbstractClientlibVisitor
Optional action to take after visiting the element. Default : empty.- Overrides:
action
in classAbstractClientlibVisitor
-
-