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 use SocketFactory instead of SSLSocketFactory.
  • 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

    Constructors
    Constructor
    Description
    Default constructor.
    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 Type
    Method
    Description
     
    void
    send(org.openehealth.ipf.commons.audit.AuditContext auditContext, org.openehealth.ipf.commons.audit.AuditMetadataProvider auditMetadataProvider, String auditMessage)
     
    protected void
    Override this method to set any socket option.
    void
     

    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

      public TcpSyslogSender(SocketFactory socketFactory)
      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

      public String getTransportName()
      Specified by:
      getTransportName in interface org.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 interface org.openehealth.ipf.commons.audit.protocol.AuditTransmissionProtocol
      Throws:
      Exception
    • shutdown

      public void shutdown()
      Specified by:
      shutdown in interface org.openehealth.ipf.commons.audit.protocol.AuditTransmissionProtocol
    • setSocketOptions

      protected void setSocketOptions(Socket socket) throws SocketException
      Override this method to set any socket option. The default implementation sets SO_KEEPALIVE to true. 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, then SO_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