Interface Sniffer


@Contract public interface Sniffer
A sniffer implementation is responsible for identifying a particular application type and/or a particular file type.

For clients who want to work with Sniffers, see SnifferManager in the kernel.

Author:
Jerome Dochez
  • Method Details

    • handles

      boolean handles(DeploymentContext context)
      Returns true if the passed file or directory is recognized by this sniffer.
      Parameters:
      context - deployment context
      Returns:
      true if the location is recognized by this sniffer
    • handles

      boolean handles(ReadableArchive source)
      Returns true if the passed file or directory is recognized by this sniffer.
      Parameters:
      source - the file or directory abstracted as an archive resources from the source archive.
      Returns:
      true if the location is recognized by this sniffer
    • getURLPatterns

      String[] getURLPatterns()
      Returns the array of patterns to apply against the request URL If the pattern matches the URL, the service method of the associated container will be invoked
      Returns:
      array of patterns
    • getAnnotationTypes

      Class<? extends Annotation>[] getAnnotationTypes()
      Returns the list of annotations types that this sniffer is interested in. If an application bundle contains at least one class annotated with one of the returned annotations, the deployment process will not call the handles method but will invoke the containers deployers as if the handles method had been called and returned true.
      Returns:
      list of annotations this sniffer is interested in or an empty array
    • getAnnotationNames

      String[] getAnnotationNames(DeploymentContext context)
      Returns the list of annotation names that this sniffer is interested in. If an application bundle contains at least one class annotated with one of the returned annotations, the deployment process will not call the handles method but will invoke the containers deployers as if the handles method had been called and returned true.
      Parameters:
      context - deployment context
      Returns:
      list of annotation names this sniffer is interested in or an empty array
    • getModuleType

      String getModuleType()
      Returns the container type associated with this sniffer
      Returns:
      the container type
    • setup

      com.sun.enterprise.module.HK2Module[] setup(String containerHome, Logger logger) throws IOException
      Sets up the container libraries so that any imported bundle from the connector jar file will now be known to the module subsystem This method returns a HK2Modules for the module containing the core implementation of the container. That means that this module will be locked as long as there is at least one module loaded in the associated container.
      Parameters:
      containerHome - is where the container implementation resides
      logger - the logger to use
      Returns:
      the module definition of the core container implementation.
      Throws:
      IOException - exception if something goes sour
    • tearDown

      void tearDown()
      Tears down a container, remove all imported libraries from the module subsystem.
    • getContainersNames

      String[] getContainersNames()
      Returns the list of Containers that this Sniffer enables. The runtime will look up each container implementing using the names provided in the habitat.
      Returns:
      list of container names known to the habitat for this sniffer
    • isUserVisible

      boolean isUserVisible()
      Returns:
      whether this sniffer should be visible to user
    • isJakartaEE

      boolean isJakartaEE()
      Returns:
      whether this sniffer represents a Jakarta EE container type
    • getDeploymentConfigurations

      Map<String,String> getDeploymentConfigurations(ReadableArchive source) throws IOException
      Returns a map of deployment configurations for this Sniffer from the specific archive source.

      Many sniffers (esp. Jakarta EE sniffers) will choose to set the key of each map entry to the relative path within the ReadableArchive of the deployment descriptor and the value of that map entry to the descriptor's contents.

      Parameters:
      source - the contents of the application's archive
      Returns:
      map of configuration names to configurations for the application
      Throws:
      IOException - in case of errors searching or reading the archive for the deployment configuration(s)
    • getIncompatibleSnifferTypes

      String[] getIncompatibleSnifferTypes()
      Returns:
      the set of the sniffers that should not co-exist for the same module. For example, ejb and appclient sniffers should not be returned in the sniffer list for a certain module. This method will be used to validate and filter the retrieved sniffer lists for a certain module
    • supportsArchiveType

      boolean supportsArchiveType(ArchiveType archiveType)
      This API is used to help determine if the sniffer should recognize the current archive. If the sniffer does not support the archive type associated with the current deployment, the sniffer should not recognize the archive.
      Parameters:
      archiveType - the archive type to check
      Returns:
      whether the sniffer supports the archive type