org.glassfish.api.container
Interface Sniffer

All Known Subinterfaces:
CompositeSniffer

@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 Summary
 java.lang.Class<? extends java.lang.annotation.Annotation>[] getAnnotationTypes()
          Returns the list of annotations types that this sniffer is interested in.
 java.lang.String[] getContainersNames()
          Returns the list of Containers that this Sniffer enables.
 java.util.Map<java.lang.String,java.lang.String> getDeploymentConfigurations(ReadableArchive source)
          Returns a map of deployment configurations for this Sniffer from the specific archive source.
 java.lang.String[] getIncompatibleSnifferTypes()
           
 java.lang.String getModuleType()
          Returns the module type associated with this sniffer
 java.lang.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
 boolean handles(ReadableArchive source, java.lang.ClassLoader loader)
          Returns true if the passed file or directory is recognized by this sniffer.
 boolean isUserVisible()
           
 com.sun.enterprise.module.Module[] setup(java.lang.String containerHome, java.util.logging.Logger logger)
          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 Modules for the module containing the core implementation of the container.
 void tearDown()
          Tears down a container, remove all imported libraries from the module subsystem.
 

Method Detail

handles

boolean handles(ReadableArchive source,
                java.lang.ClassLoader loader)
Returns true if the passed file or directory is recognized by this sniffer.

Parameters:
source - the file or directory abstracted as an archive
loader - if the class loader capable of loading classes and resources from the source archive.
Returns:
true if the location is recognized by this sniffer

getURLPatterns

java.lang.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

java.lang.Class<? extends java.lang.annotation.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

getModuleType

java.lang.String getModuleType()
Returns the module type associated with this sniffer

Returns:
the container name

setup

com.sun.enterprise.module.Module[] setup(java.lang.String containerHome,
                                         java.util.logging.Logger logger)
                                         throws java.io.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 Modules 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:
java.io.IOException - exception if something goes sour

tearDown

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


getContainersNames

java.lang.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

getDeploymentConfigurations

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

Many sniffers (esp. Java 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:
java.io.IOException - in case of errors searching or reading the archive for the deployment configuration(s)

getIncompatibleSnifferTypes

java.lang.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


Copyright © 2012 GlassFish Community. All Rights Reserved.