Class AbstractContainerScannerPlugin<I,E,D extends FileContainerDescriptor>
java.lang.Object
com.buschmais.jqassistant.plugin.common.api.scanner.AbstractScannerPlugin<I,D>
com.buschmais.jqassistant.plugin.common.api.scanner.AbstractResourceScannerPlugin<I,D>
com.buschmais.jqassistant.plugin.common.api.scanner.AbstractContainerScannerPlugin<I,E,D>
- Type Parameters:
I- The container type.E- The element type.D- The descriptor type.
- All Implemented Interfaces:
ScannerPlugin<I,,D> com.buschmais.jqassistant.core.shared.lifecycle.ContextualConfigurableLifecycleAware<ScannerContext,,Map<String, Object>> com.buschmais.jqassistant.core.shared.lifecycle.LifecycleAware
- Direct Known Subclasses:
AbstractArchiveInputStreamScannerPlugin,AbstractDirectoryScannerPlugin,ZipFileScannerPlugin
public abstract class AbstractContainerScannerPlugin<I,E,D extends FileContainerDescriptor>
extends AbstractResourceScannerPlugin<I,D>
Abstract base implementation for scanner plugins that handle containers of
elements like directories, archives, etc.
-
Nested Class Summary
Nested classes/interfaces inherited from interface com.buschmais.jqassistant.core.scanner.api.ScannerPlugin
ScannerPlugin.Requires -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprotected abstract voidenterContainer(I container, D containerDescriptor, ScannerContext scannerContext) Create a scope depending on the container type, e.g. a JAR file should return classpath scope.protected abstract DgetContainerDescriptor(I container, ScannerContext scannerContext) Return the descriptor representing the artifact.protected abstract StringgetContainerPath(I container, String path) Return the normalized path to the container.getEntries(I container) Return an iterable which delivers the entries of the container.protected abstract ResourceReturn aResourcerepresenting an entry.protected abstract StringgetRelativePath(I container, E entry) Return the relative path of an element within the container.protected abstract voidleaveContainer(I container, D containerDescriptor, ScannerContext scannerContext) Destroy the container dependent scope.final DMethods inherited from class com.buschmais.jqassistant.plugin.common.api.scanner.AbstractResourceScannerPlugin
getDescriptorType, getTypeMethods inherited from class com.buschmais.jqassistant.plugin.common.api.scanner.AbstractScannerPlugin
configure, configure, equals, getBooleanProperty, getDirectoryPath, getName, getProperties, getProperty, getScannerContext, getStringProperty, getTypeParameter, hashCodeMethods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface com.buschmais.jqassistant.core.scanner.api.ScannerPlugin
accepts, destroy, initialize
-
Constructor Details
-
AbstractContainerScannerPlugin
public AbstractContainerScannerPlugin()
-
-
Method Details
-
scan
- Throws:
IOException
-
getContainerDescriptor
Return the descriptor representing the artifact.- Parameters:
container- The container.scannerContext- The scanner context.- Returns:
- The artifact descriptor.
-
getEntries
Return an iterable which delivers the entries of the container.The entries must not contain the relative root element, i.e. "/".
- Parameters:
container- The container.- Returns:
- The iterable of entries.
- Throws:
IOException- If the entries cannot be determined.
-
getContainerPath
Return the normalized path to the container.- Parameters:
container- The container.- Returns:
- The normalized path.
-
getRelativePath
Return the relative path of an element within the container.The following conditions must be considered:
- The separator to use is "/".
- The path must start with "/".
- The path must not end with "/".
- Parameters:
container- The container.entry- The entry.- Returns:
- The relative path.
-
enterContainer
protected abstract void enterContainer(I container, D containerDescriptor, ScannerContext scannerContext) throws IOException Create a scope depending on the container type, e.g. a JAR file should return classpath scope.- Parameters:
container- The container.containerDescriptor- The container descriptor.scannerContext- The scanner context.- Throws:
IOException
-
leaveContainer
protected abstract void leaveContainer(I container, D containerDescriptor, ScannerContext scannerContext) throws IOException Destroy the container dependent scope.- Parameters:
container- The container.containerDescriptor- The container descriptorscannerContext- The scanner context.- Throws:
IOException
-
getEntry
Return aResourcerepresenting an entry.- Parameters:
container- The container.entry- The entry.- Returns:
- The
FileResource.
-