org.openhealthexchange.openpixpdq.ihe.audit
Class BsdMessenger

java.lang.Object
  extended by org.openhealthexchange.openpixpdq.ihe.audit.BsdMessenger
All Implemented Interfaces:
IMessageTransmitter

 class BsdMessenger
extends java.lang.Object
implements IMessageTransmitter

Sends the message to a given BSD logger. The original idea was to use Log4J's bsd logger, but that ended up being way too complex, so I just rolled my own. Note that if your message is over 1024, you might be hosed since many BSD loggers only take 1024 messages.

You will need to do something to keep this thread safe. The simple solution (and the one currently implemented) is to generate a new instance of this class every time you make a new message. That is how it currently works. Otherwise the IheAuditTrail will have to do a bunch more work to keep the single instance synchronized. (Not to mention that there might be different audit servers used by different actors.)

Version:
1.0 - Nov 20, 2005
Author:
Josh Flachsbart

Nested Class Summary
 
Nested classes/interfaces inherited from interface org.openhealthexchange.openpixpdq.ihe.audit.IMessageTransmitter
IMessageTransmitter.Severity
 
Constructor Summary
BsdMessenger(AuditTrailDescription description)
          Use to create a "connection" to a BSD audit repository.
 
Method Summary
 AuditTrailDescription getAuditTrailDescription()
          Gets the audit trail description
 void sendMessage(java.lang.String message)
          Sends BSD message using the default facility and level.
 void sendMessage(java.lang.String message, IMessageTransmitter.Severity severity)
          Sends BSD message using a givien facility and level.
 void setDefaultSeverity(IMessageTransmitter.Severity severity)
          Sets the severity to be used for non specific messages.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

BsdMessenger

public BsdMessenger(AuditTrailDescription description)
Use to create a "connection" to a BSD audit repository. Note that BSD syslog uses UDP not TCP, so it isn't really a "connection" and as such this is thread safe if all the threads use the same connection info and default severity.

Parameters:
description - All the info needed to connect to the audit repository.
Method Detail

sendMessage

public void sendMessage(java.lang.String message)
Sends BSD message using the default facility and level.

Specified by:
sendMessage in interface IMessageTransmitter

sendMessage

public void sendMessage(java.lang.String message,
                        IMessageTransmitter.Severity severity)
Sends BSD message using a givien facility and level.

Specified by:
sendMessage in interface IMessageTransmitter

setDefaultSeverity

public void setDefaultSeverity(IMessageTransmitter.Severity severity)
Sets the severity to be used for non specific messages.

Specified by:
setDefaultSeverity in interface IMessageTransmitter

getAuditTrailDescription

public AuditTrailDescription getAuditTrailDescription()
Gets the audit trail description

Specified by:
getAuditTrailDescription in interface IMessageTransmitter