Class JPASniffer

  • All Implemented Interfaces:
    Sniffer
    Direct Known Subclasses:
    JPACompositeSniffer

    @Service(name="jpa")
    @Singleton
    public class JPASniffer
    extends GenericSniffer
    Implementation of the Sniffer for JPA.
    Author:
    Mitesh Meswani
    • Constructor Detail

      • JPASniffer

        public JPASniffer()
    • Method Detail

      • handles

        public boolean handles​(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 Sniffer
        Overrides:
        handles in class GenericSniffer
        Parameters:
        location - the file or directory to explore
        Returns:
        true if this sniffer handles this application type
      • scanForPURootsInLibDir

        protected boolean scanForPURootsInLibDir​(ReadableArchive parentArchive,
                                                 String libLocation)
      • getContainersNames

        public String[] getContainersNames()
        Description copied from interface: Sniffer
        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
      • supportsArchiveType

        public 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