Class TcpSyslogSender
java.lang.Object
org.openehealth.ipf.commons.audit.protocol.RFC5424Protocol
org.openehealth.ipf.commons.audit.protocol.RFC5425Protocol
org.projecthusky.communication.atna.TcpSyslogSender
- All Implemented Interfaces:
org.openehealth.ipf.commons.audit.protocol.AuditTransmissionProtocol
public class TcpSyslogSender
extends org.openehealth.ipf.commons.audit.protocol.RFC5425Protocol
implements org.openehealth.ipf.commons.audit.protocol.AuditTransmissionProtocol
An implementation of a TCP syslog sender, compliant with the RFC 5425 syslog frame format.
- Author:
- Quentin Ligier, Lawrence Tarbox, Derived from code written by Matthew Davis of IBM., Christian Ohr, Quentin Ligier
- Implementation Note:
- This class is a copy of the class
TLSSyslogSenderImpl
, only overriding the constructors to useSocketFactory
instead ofSSLSocketFactory
.
-
Field Summary
Fields inherited from interface org.openehealth.ipf.commons.audit.protocol.AuditTransmissionProtocol
HTTPS_CIPHERSUITES, JAVAX_NET_DEBUG, JAVAX_NET_SSL_KEYSTORE, JAVAX_NET_SSL_KEYSTORE_PASSWORD, JAVAX_NET_SSL_KEYSTORE_TYPE, JAVAX_NET_SSL_TRUSTSTORE, JAVAX_NET_SSL_TRUSTSTORE_PASSWORD, JAVAX_NET_SSL_TRUSTSTORE_TYPE, JAVAX_TLS_CLIENT_CIPHERSUITES, JAVAX_TLS_SERVER_CIPHERSUITES, JDK_TLS_CLIENT_PROTOCOLS
-
Constructor Summary
ConstructorsConstructorDescriptionDefault constructor.TcpSyslogSender
(SocketFactory socketFactory) Constructor with default socket test policy.TcpSyslogSender
(SocketFactory socketFactory, org.openehealth.ipf.commons.audit.protocol.TLSSyslogSenderImpl.SocketTestPolicy socketTestPolicy) Full constructor.TcpSyslogSender
(org.openehealth.ipf.commons.audit.protocol.TLSSyslogSenderImpl.SocketTestPolicy socketTestPolicy) Constructor with default socket factory. -
Method Summary
Modifier and TypeMethodDescriptionvoid
send
(org.openehealth.ipf.commons.audit.AuditContext auditContext, org.openehealth.ipf.commons.audit.AuditMetadataProvider auditMetadataProvider, String auditMessage) protected void
setSocketOptions
(Socket socket) Override this method to set any socket option.void
shutdown()
Methods inherited from class org.openehealth.ipf.commons.audit.protocol.RFC5425Protocol
getTransportPayload
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
Methods inherited from interface org.openehealth.ipf.commons.audit.protocol.AuditTransmissionProtocol
send
-
Constructor Details
-
TcpSyslogSender
public TcpSyslogSender()Default constructor. -
TcpSyslogSender
public TcpSyslogSender(org.openehealth.ipf.commons.audit.protocol.TLSSyslogSenderImpl.SocketTestPolicy socketTestPolicy) Constructor with default socket factory.- Parameters:
socketTestPolicy
- Determining if and when to test the socket for a connection close/reset
-
TcpSyslogSender
Constructor with default socket test policy.- Parameters:
socketFactory
- Socket factory to be used for creating the TCP socket.
-
TcpSyslogSender
public TcpSyslogSender(SocketFactory socketFactory, org.openehealth.ipf.commons.audit.protocol.TLSSyslogSenderImpl.SocketTestPolicy socketTestPolicy) Full constructor.- Parameters:
socketFactory
- Socket factory to be used for creating the TCP socket.socketTestPolicy
- Determining if and when to test the socket for a connection close/reset
-
-
Method Details
-
getTransportName
- Specified by:
getTransportName
in interfaceorg.openehealth.ipf.commons.audit.protocol.AuditTransmissionProtocol
-
send
public void send(org.openehealth.ipf.commons.audit.AuditContext auditContext, org.openehealth.ipf.commons.audit.AuditMetadataProvider auditMetadataProvider, String auditMessage) throws Exception - Specified by:
send
in interfaceorg.openehealth.ipf.commons.audit.protocol.AuditTransmissionProtocol
- Throws:
Exception
-
shutdown
public void shutdown()- Specified by:
shutdown
in interfaceorg.openehealth.ipf.commons.audit.protocol.AuditTransmissionProtocol
-
setSocketOptions
Override this method to set any socket option. The default implementation setsSO_KEEPALIVE
totrue
. The method is called once for every new socket instance that is created before the first ATNA record is sent over that socket connection.BEWARE: If your implementation specify any socket test policy other than
TLSSyslogSenderImpl.SocketTestPolicy.DONT_TEST_POLICY
, thenSO_TIMEOUT
will be set to 1 ms regardless of the value your implementation might set.- Parameters:
socket
- Socket to configure- Throws:
SocketException
- if setting keep alive failed
-