Class JPASniffer

  • All Implemented Interfaces:
    org.glassfish.api.container.Sniffer
    Direct Known Subclasses:
    JPACompositeSniffer

    @Service(name="jpa")
    @Singleton
    public class JPASniffer
    extends org.glassfish.internal.deployment.GenericSniffer
    Implementation of the Sniffer for JPA.
    Author:
    Mitesh Meswani
    • Field Summary

      • Fields inherited from class org.glassfish.internal.deployment.GenericSniffer

        habitat, modulesRegistry
    • Constructor Summary

      Constructors 
      Constructor Description
      JPASniffer()  
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      String[] getContainersNames()  
      boolean handles​(org.glassfish.api.deployment.archive.ReadableArchive location)
      Returns true if the archive contains persistence.xml as defined by packaging rules of JPA Tries to getResource("META-INF/persitsence.xml") on current classLoader.
      protected boolean scanForPURootsInLibDir​(org.glassfish.api.deployment.archive.ReadableArchive parentArchive, String libLocation)  
      boolean supportsArchiveType​(org.glassfish.api.deployment.archive.ArchiveType archiveType)
      This API is used to help determine if the sniffer should recognize the current archive.
      • Methods inherited from class org.glassfish.internal.deployment.GenericSniffer

        equals, getAnnotationNames, getAnnotationTypes, getContainerModuleNames, getDeploymentConfigurationPaths, getDeploymentConfigurations, getIncompatibleSnifferTypes, getModuleType, getURLPatterns, handles, hashCode, isJavaEE, isUserVisible, setup, tearDown
    • Constructor Detail

      • JPASniffer

        public JPASniffer()
    • Method Detail

      • handles

        public boolean handles​(org.glassfish.api.deployment.archive.ReadableArchive location)
        Returns true if the archive contains persistence.xml as defined by packaging rules of JPA Tries to getResource("META-INF/persitsence.xml") on current classLoader. If it succeeds, current archive is a pu root. This method will be called for each bundle inside an application which would include .war (the resource can be present in WEB-INF/classes or WEB-INF/lib/pu.jar), ejb.jar (the resource can be present in root of the jar),
        Specified by:
        handles in interface org.glassfish.api.container.Sniffer
        Overrides:
        handles in class org.glassfish.internal.deployment.GenericSniffer
      • scanForPURootsInLibDir

        protected boolean scanForPURootsInLibDir​(org.glassfish.api.deployment.archive.ReadableArchive parentArchive,
                                                 String libLocation)
      • getContainersNames

        public String[] getContainersNames()
      • supportsArchiveType

        public boolean supportsArchiveType​(org.glassfish.api.deployment.archive.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