Class ProcessingVisitor
- java.lang.Object
-
- com.composum.sling.clientlibs.processor.AbstractClientlibVisitor
-
- com.composum.sling.clientlibs.processor.ProcessingVisitor
-
- All Implemented Interfaces:
ClientlibVisitor
public class ProcessingVisitor extends AbstractClientlibVisitor
Appends all embedded files to an input stream.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description protected static class
ProcessingVisitor.ExcludeDependenciesVisitor
If some files are included in / requested by dependencies of the rendered client library, these must not be included into the cached file, since these would be loaded twice by the page.-
Nested classes/interfaces inherited from interface com.composum.sling.clientlibs.handle.ClientlibVisitor
ClientlibVisitor.VisitorMode
-
-
Field Summary
Fields Modifier and Type Field Description protected ProcessorContext
context
protected OutputStream
output
protected ClientlibProcessor
processor
-
Fields inherited from class com.composum.sling.clientlibs.processor.AbstractClientlibVisitor
embeddedHash, hasEmbeddedFiles, HASH_PATTERN, owner, processedElements, resolver, service
-
-
Constructor Summary
Constructors Constructor Description ProcessingVisitor(ClientlibElement owner, ClientlibService service, OutputStream output, ClientlibProcessor processor, ProcessorContext context)
Instantiates a new Processing visitor.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
action(ClientlibFile clientlibFile, ClientlibVisitor.VisitorMode mode, ClientlibResourceFolder parent)
Optional action to take after visiting the element.protected void
alreadyProcessed(ClientlibRef ref, ClientlibVisitor.VisitorMode mode, ClientlibResourceFolder folder)
Warns about everything that should be embedded, but is already processed, and not in thisprotected ClientlibVisitor
createVisitorFor(ClientlibElement element)
Creates a new visitor for the given clientlib or category as owner.protected void
logNotAvailable(org.apache.sling.api.resource.Resource resource, String reference, boolean optional)
-
Methods inherited from class com.composum.sling.clientlibs.processor.AbstractClientlibVisitor
action, action, action, action, execute, getHash, getOwner, getProcessedElements, getVisitorFor, isNotProcessed, markAsProcessed, notPresent, removeMinificationDuplicates, resolveAndAccept, supportsEmbedding, updateHash, visit, visit, visit, visit, visit
-
-
-
-
Field Detail
-
output
protected final OutputStream output
-
processor
protected final ClientlibProcessor processor
-
context
protected final ProcessorContext context
-
-
Constructor Detail
-
ProcessingVisitor
public ProcessingVisitor(ClientlibElement owner, ClientlibService service, OutputStream output, ClientlibProcessor processor, ProcessorContext context)
Instantiates a new Processing visitor.- Parameters:
service
- the serviceoutput
- the output stream to write to. Is not closed in this class - remember to close it outside.processor
- optional processor we pipe our output through.context
- the context where we keep some data
-
-
Method Detail
-
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(ClientlibFile clientlibFile, ClientlibVisitor.VisitorMode mode, ClientlibResourceFolder parent) throws IOException
Description copied from class:AbstractClientlibVisitor
Optional action to take after visiting the element. Default : empty.- Overrides:
action
in classAbstractClientlibVisitor
- Throws:
IOException
-
logNotAvailable
protected void logNotAvailable(org.apache.sling.api.resource.Resource resource, String reference, boolean optional)
-
alreadyProcessed
protected void alreadyProcessed(ClientlibRef ref, ClientlibVisitor.VisitorMode mode, ClientlibResourceFolder folder)
Warns about everything that should be embedded, but is already processed, and not in this- Overrides:
alreadyProcessed
in classAbstractClientlibVisitor
-
-