Class PipeProtocol
- java.lang.Object
-
- com.gurock.smartinspect.protocols.Protocol
-
- com.gurock.smartinspect.protocols.pipe.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.
-
-
Field Summary
-
Fields inherited from class com.gurock.smartinspect.protocols.Protocol
fConnected
-
-
Constructor Summary
Constructors Constructor Description PipeProtocol()Creates and initializes a PipeProtocol instance.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected voidbuildOptions(ConnectionsBuilder builder)Overridden.protected StringgetName()Overridden.protected voidinternalConnect()This method tries to establish a connection to a local named pipe of a SmartInspect Console.protected voidinternalDisconnect()Overridden.protected voidinternalWritePacket(Packet packet)Overridden.protected booleanisValidOption(String name)Overridden.protected voidloadOptions()Overridden.-
Methods inherited from class com.gurock.smartinspect.protocols.Protocol
addListener, composeLogHeaderPacket, connect, disconnect, dispatch, dispose, doError, failed, getAppName, getAsyncEnabledDefaultValue, getAsyncQueueDefaultValue, getAsyncThrottleDefaultValue, getBooleanOption, getBytesOption, getCaption, getHostName, getIntegerOption, getLevelOption, getReconnectDefaultValue, getRotateOption, getSizeOption, getStringOption, getTimespanOption, handleException, implConnect, implDisconnect, implDispatch, implWritePacket, initialize, internalDispatch, internalReconnect, internalWriteLogHeader, isAsynchronous, removeListener, reset, scheduleWritePacket, setAppName, setHostName, writePacket
-
-
-
-
Method Detail
-
getName
protected String getName()
Overridden. Returns "pipe".
-
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:
isValidOptionin classProtocol- 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:
buildOptionsin classProtocol- 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:
loadOptionsin classProtocol
-
internalConnect
protected void internalConnect() throws ExceptionThis 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:
internalConnectin classProtocol- 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:
internalWritePacketin classProtocol- Parameters:
packet- The packet to write- Throws:
Exception- if sending the packet to the Console failed
-
internalDisconnect
protected void internalDisconnect() throws ExceptionOverridden. 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:
internalDisconnectin classProtocol- Throws:
Exception- If closing the named pipe handle failed
-
-