Package org.glassfish.api.container
Interface Sniffer
-
- All Known Implementing Classes:
AppClientSniffer
,ConfigSniffer
,ConnectorSniffer
,EarSniffer
,EjbSniffer
,FaultToleranceSniffer
,GenericSniffer
,GrizzlyAdapterSniffer
,HealthSniffer
,JPACompositeSniffer
,JPASniffer
,JwtAuthSniffer
,MetricsSniffer
,MicroProfileSniffer
,OpenApiSniffer
,OSGiSniffer
,PayaraResourcesCompositeSniffer
,PayaraResourcesSniffer
,ResourcesCompositeSniffer
,ResourcesSniffer
,SecuritySniffer
,WebServicesSniffer
,WebSniffer
,WeldCompositeSniffer
,WeldSniffer
@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
All Methods Instance Methods Abstract Methods Modifier and Type Method Description String[]
getAnnotationNames(DeploymentContext context)
Returns the list of annotation names that this sniffer is interested in.Class<? extends Annotation>[]
getAnnotationTypes()
Returns the list of annotations types that this sniffer is interested in.String[]
getContainersNames()
Returns the list of Containers that this Sniffer enables.Map<String,String>
getDeploymentConfigurations(ReadableArchive source)
Returns a map of deployment configurations for this Sniffer from the specific archive source.String[]
getIncompatibleSnifferTypes()
String
getModuleType()
Returns the container type associated with this snifferString[]
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 invokedboolean
handles(ReadableArchive source)
Returns true if the passed file or directory is recognized by this sniffer.boolean
handles(DeploymentContext context)
Returns true if the passed file or directory is recognized by this sniffer.boolean
isJavaEE()
boolean
isUserVisible()
com.sun.enterprise.module.HK2Module[]
setup(String containerHome, 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 aModule
s for the module containing the core implementation of the container.boolean
supportsArchiveType(ArchiveType archiveType)
This API is used to help determine if the sniffer should recognize the current archive.void
tearDown()
Tears down a container, remove all imported libraries from the module subsystem.
-
-
-
Method Detail
-
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 aModule
s 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 resideslogger
- 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
-
isJavaEE
boolean isJavaEE()
- Returns:
- whether this sniffer represents a Java 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. 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:
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
-
-