Class PacketParserFactory

  • Direct Known Subclasses:
    ActiveMQPacketParserFactory

    public abstract class PacketParserFactory
    extends Object
    Factory used to find and create instances of DiscoveryAgent using the name of the desired agent to locate it's factory class definition file.
    • Constructor Detail

      • PacketParserFactory

        public PacketParserFactory()
    • Method Detail

      • createPacketParser

        public abstract PacketParser createPacketParser​(String key)
                                                 throws Exception
        Creates an instance of the given PacketParser
        Parameters:
        key - the name of the required packet parser for the agent.
        Returns:
        a new PacketParser instance.
        Throws:
        Exception - if an error occurs while creating the PacketParser instance.
      • getName

        public abstract String getName()
        Returns:
        the name of this packet parser, e.g ActiveMQ.
      • createAgent

        public static PacketParser createAgent​(String key)
                                        throws Exception
        Static create method that performs the PacketParser search and handles the configuration and setup.
        Parameters:
        key - the name of the desired PacketParser type.
        Returns:
        a new PacketParser instance that is ready for use.
        Throws:
        Exception - if an error occurs while creating the PacketParser instance.
      • findAgentFactory

        protected static PacketParserFactory findAgentFactory​(String key)
                                                       throws IOException
        Searches for a PacketParserFactory by using the given key. The search first checks the local cache of packet parser factories before moving on to search in the classpath.
        Parameters:
        key - The name of the PacketParserFactory that should be located.
        Returns:
        a PacketParserFactory instance matching the given key.
        Throws:
        IOException - if an error occurs while locating the factory.