Class PipeProtocol


  • public class PipeProtocol
    extends Protocol
    Used for sending packets to a local SmartInspect Console over a named pipe connection.

    This class is used for sending packets through a local named pipe to the SmartInspect Console. It is used when the 'pipe' protocol is specified in the connections string. Please see the isValidOption method for a list of available protocol options. Please note that this protocol can only be used for local connections. For remote connections to other machines, please use TcpProtocol.

    The public members of this class are threadsafe.

    • Constructor Detail

      • PipeProtocol

        public PipeProtocol()
        Creates and initializes a PipeProtocol instance. For a list of available pipe protocol options, please refer to the isValidOption method.
    • Method Detail

      • getName

        protected String getName()
        Overridden. Returns "pipe".
        Specified by:
        getName in class Protocol
        Returns:
        The name of a real protocol implementation
      • isValidOption

        protected boolean isValidOption​(String name)
        Overridden. Validates if a protocol option is supported.

        The following table lists all valid options, their default values and descriptions for the pipe protocol.

        Pipe protocol options
        Valid Options Default Value Description
        pipename "smartinspect" Specifies the named pipe for sending log packets to the SmartInspect Console.

        For further options which affect the behavior of this protocol, please have a look at the documentation of the Protocol.isValidOption(java.lang.String) method of the parent class.

        Example:

         SiAuto.Si.setConnections("pipe()");
         SiAuto.Si.setConnections("pipe(pipename=\\"logging\\")");
         
        Overrides:
        isValidOption in class Protocol
        Parameters:
        name - The option name to validate.
        Returns:
        True if the option is supported and false otherwise.
      • buildOptions

        protected void buildOptions​(ConnectionsBuilder builder)
        Overridden. Fills a ConnectionsBuilder instance with the options currently used by this pipe protocol.
        Overrides:
        buildOptions in class Protocol
        Parameters:
        builder - The ConnectionsBuilder object to fill with the current options of this protocol
      • loadOptions

        protected void loadOptions()
        Overridden. Loads and inspects pipe specific options.

        This method loads all relevant options and ensures their correctness. See isValidOption for a list of options which are recognized by the pipe protocol.

        Overrides:
        loadOptions in class Protocol
      • internalConnect

        protected void internalConnect()
                                throws Exception
        This method tries to establish a connection to a local named pipe of a SmartInspect Console. The name of the pipe can be specified by passing the "pipename" option to the initialize method.

        Overridden. Connects to the specified local named pipe.

        Specified by:
        internalConnect in class Protocol
        Throws:
        Exception - if establishing the named pipe connection failed
      • internalWritePacket

        protected void internalWritePacket​(Packet packet)
                                    throws Exception
        Overridden. Sends a packet to the Console. This method sends the supplied packet to the SmartInspect Console over the previously established named pipe connection.
        Specified by:
        internalWritePacket in class Protocol
        Parameters:
        packet - The packet to write
        Throws:
        Exception - if sending the packet to the Console failed
      • internalDisconnect

        protected void internalDisconnect()
                                   throws Exception
        Overridden. Closes the connection to the specified local named pipe.

        This method closes the named pipe handle if previously created and disposes any supplemental objects.

        Specified by:
        internalDisconnect in class Protocol
        Throws:
        Exception - If closing the named pipe handle failed