# Class FragmentJarScannerCallback

java.lang.Object
org.apache.tomcat.util.descriptor.web.FragmentJarScannerCallback

All Implemented Interfaces:
  `JarScannerCallback`

public class FragmentJarScannerCallback extends Object implements JarScannerCallback
Callback handling a web-fragment.xml descriptor.

- ## Constructor Summary

  Constructors
  Constructor
  Description
  `FragmentJarScannerCallback(WebXmlParser webXmlParser, boolean delegate, boolean parseRequired)`
  Creates a new fragment jar scanner callback.

- ## Method Summary

  Modifier and Type
  Method
  Description
  `Map<String,WebXml>`
  `getFragments()`
  Returns the map of parsed web fragments, keyed by fragment name.
  `boolean`
  `isOk()`
  Returns whether all fragments were parsed successfully.
  `void`
  `scan(File file, String webappPath, boolean isWebapp)`
  A directory was found that is to be treated as an unpacked JAR.
  `void`
  `scan(Jar jar, String webappPath, boolean isWebapp)`
  A JAR was found and may be accessed for further processing via the provided URL connection.
  `void`
  `scanWebInfClasses()`
  A directory structure was found within the web application at /WEB-INF/classes that should be handled as an unpacked JAR.

  ### Methods inherited from class Object

  `clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- ## Constructor Details

  - ### FragmentJarScannerCallback

    public FragmentJarScannerCallback(WebXmlParser webXmlParser, boolean delegate, boolean parseRequired)
    Creates a new fragment jar scanner callback.
    Parameters:
      `webXmlParser` - The parser used to parse web-fragment.xml files
      `delegate` - Whether delegation is enabled
      `parseRequired` - Whether parsing is required

- ## Method Details

  - ### scan

    public void scan(Jar jar, String webappPath, boolean isWebapp) throws IOException
    Description copied from interface: `JarScannerCallback`
    A JAR was found and may be accessed for further processing via the provided URL connection. The caller is responsible for closing the JAR.
    Specified by:
      `scan` in interface `JarScannerCallback`
    Parameters:
      `jar` - The JAR to process
      `webappPath` - The path, if any, to the JAR within the web application
      `isWebapp` - Indicates if the JAR was found within a web application. If `false` the JAR should be treated as being provided by the container
    Throws:
      `IOException` - if an I/O error occurs while scanning the JAR

  - ### scan

    public void scan(File file, String webappPath, boolean isWebapp) throws IOException
    Description copied from interface: `JarScannerCallback`
    A directory was found that is to be treated as an unpacked JAR. The directory may be accessed for further processing via the provided file.
    Specified by:
      `scan` in interface `JarScannerCallback`
    Parameters:
      `file` - The directory containing the unpacked JAR.
      `webappPath` - The path, if any, to the file within the web application
      `isWebapp` - Indicates if the JAR was found within a web application. If `false` the JAR should be treated as being provided by the container
    Throws:
      `IOException` - if an I/O error occurs while scanning the JAR

  - ### scanWebInfClasses

    public void scanWebInfClasses()
    Description copied from interface: `JarScannerCallback`
    A directory structure was found within the web application at /WEB-INF/classes that should be handled as an unpacked JAR. Note that all resource access must be via the ServletContext to ensure that any additional resources are visible.
    Specified by:
      `scanWebInfClasses` in interface `JarScannerCallback`

  - ### isOk

    public boolean isOk()
    Returns whether all fragments were parsed successfully.
    Returns:
      `true` if parsing was successful

  - ### getFragments

    public Map<String,WebXml> getFragments()
    Returns the map of parsed web fragments, keyed by fragment name.
    Returns:
      The map of fragment name to WebXml