Class TLSSyslogSenderImpl
java.lang.Object
org.openehealth.ipf.commons.audit.protocol.RFC5424Protocol
org.openehealth.ipf.commons.audit.protocol.RFC5425Protocol
org.openehealth.ipf.commons.audit.protocol.TLSSyslogSenderImpl
- All Implemented Interfaces:
AuditTransmissionProtocol
Simple client implementation of RFC 5425 TLS syslog transport for sending
audit messages to an Audit Record Repository that implements TLS syslog.
Multiple messages may be sent over the same socket.
Designed to run in a standalone mode and is not dependent on any context or configuration.
Note that this implementation disobeys the ATNA specification saying, that the Secure Application, Secure Node, or Audit Record Forwarder is unable to send the message to the Audit Record Repository, then the actor shall store the audit record locally and send it when it is able.
- Since:
- 3.5
- Author:
- Lawrence Tarbox, Derived from code written by Matthew Davis of IBM., Christian Ohr
-
Nested Class Summary
Modifier and TypeClassDescriptionstatic enum
Enum to control the level of paranoia when it comes to trusting the socket connection. -
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
ConstructorDescriptionConstructor which uses default values for all parameters.TLSSyslogSenderImpl
(SSLSocketFactory socketFactory, TLSSyslogSenderImpl.SocketTestPolicy socketTestPolicy) TLSSyslogSenderImpl
(TLSSyslogSenderImpl.SocketTestPolicy socketTestPolicy) TLSSyslogSenderImpl
(TlsParameters tlsParameters) TLSSyslogSenderImpl
(TlsParameters tlsParameters, TLSSyslogSenderImpl.SocketTestPolicy socketTestPolicy) -
Method Summary
Modifier and TypeMethodDescriptionvoid
send
(AuditContext auditContext, AuditMetadataProvider auditMetadataProvider, String auditMessage) Transmits the messageprotected void
setSocketOptions
(Socket socket) Override this method to set any socket option.void
shutdown()
May be implemented to clean up instances on shut downMethods 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
-
TLSSyslogSenderImpl
public TLSSyslogSenderImpl()Constructor which uses default values for all parameters. -
TLSSyslogSenderImpl
-
TLSSyslogSenderImpl
-
TLSSyslogSenderImpl
public TLSSyslogSenderImpl(SSLSocketFactory socketFactory, TLSSyslogSenderImpl.SocketTestPolicy socketTestPolicy) - Parameters:
socketFactory
- SSL socket factory to be used for creating the TCP socket.socketTestPolicy
- Determining if and when to test the socket for a connection close/reset
-
TLSSyslogSenderImpl
public TLSSyslogSenderImpl(TlsParameters tlsParameters, TLSSyslogSenderImpl.SocketTestPolicy socketTestPolicy) - Parameters:
tlsParameters
- TlsParameters 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 interfaceAuditTransmissionProtocol
- Returns:
- name of the AuditTransmissionProtocol
-
send
public void send(AuditContext auditContext, AuditMetadataProvider auditMetadataProvider, String auditMessage) throws Exception Description copied from interface:AuditTransmissionProtocol
Transmits the message- Specified by:
send
in interfaceAuditTransmissionProtocol
- Parameters:
auditContext
- audit context that e.g. contains the destinationauditMetadataProvider
- dedicated (message-specific) audit metadataauditMessage
- audit message strings- Throws:
Exception
- thrown if sending the messages has failed
-
shutdown
public void shutdown()Description copied from interface:AuditTransmissionProtocol
May be implemented to clean up instances on shut down- Specified by:
shutdown
in interfaceAuditTransmissionProtocol
-
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
-