org.eclipse.ohf.ihe.atna.audit.syslog.bsd
Class BSDClient

java.lang.Object
  extended by org.eclipse.ohf.ihe.atna.audit.syslog.bsd.BSDClient

public class BSDClient
extends java.lang.Object

Class allowing to send a BSD message to a BSD server
example of use

BSDClient client = new BSDClient("127.0.0.1:515");

AuditMessage auditMessage ;

    try
        {
        Prototype :         new QueryMessage(         int eventOutcomeIndicator ,
               The eventOutcomeIndicator should be :
               0 : Success
               4 : Minor failure
               8 : Serious failure
               12: Major failure; action made unavailable

        String userIDActiveParticipantConsumer ,
        String userIDActiveParticipantRegistry ,
        String auditSourceId ,
        String participantObjectId ,
        String participantObjectQuery
       )


        auditMessage = new QueryMessage( 0 , "Inpriva", "Registry", "localhost", "the patient", "select eo.id FROM...");

        BSDMessage bsdMessage = new BSDMessage(InetAddress.getByName("lswin10.dfw.ibm.com"),
               "H_Simpson", auditMessage.toXml());


        Prototype : BSDMessage( InetAddress toIP , String tag , String message )
        client.sendMessage(bsdMessage);
        }
        catch (Exception e)
        {
        e.printStackTrace();
}


Constructor Summary
BSDClient(java.net.InetAddress address, int port)
          Create a Client for sending a BSD message with an address and a port
BSDClient(java.lang.String addressAndPort)
          Create a Client for sending a BSD message with a String Address:port
BSDClient(java.lang.String address, int port)
          Create a Client for sending a BSD message with an address and a port
 
Method Summary
static void main(java.lang.String[] args)
           
 void sendMessage(BSDMessage message)
          send a message to the server specified in the constructor
 void sendMessage(java.lang.String message)
          send a message to the server specified in the constructor
 void sendMessageFromFile(java.lang.String fromFile)
          Send several message in a file
The file MUST contain one message by line
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

BSDClient

public BSDClient(java.net.InetAddress address,
                 int port)
Create a Client for sending a BSD message with an address and a port

Parameters:
address - Addess of the BSD server. The address should be of InetAddress type.
port - Port of the BSD Server Example of use : BSDClient client = new BSDClient(InetAddress.getByName("127.0.0.1"),515 ) ;

BSDClient

public BSDClient(java.lang.String address,
                 int port)
          throws java.net.UnknownHostException
Create a Client for sending a BSD message with an address and a port

Parameters:
address - Addess of the BSD server. The address should be of String type.
port - Port of the BSD Server Example of use : BSDClient client = new BSDClient( "127.0.0.1" ,515 ) ;
Throws:
java.net.UnknownHostException

BSDClient

public BSDClient(java.lang.String addressAndPort)
          throws java.net.UnknownHostException
Create a Client for sending a BSD message with a String Address:port

Parameters:
addressAndPort - Addess and the port of the BSD server.
Example of use : BSDClient client = new BSDClient( "127.0.0.1:515" ) ;
Throws:
java.net.UnknownHostException
Method Detail

sendMessage

public void sendMessage(BSDMessage message)
                 throws java.io.IOException
send a message to the server specified in the constructor

Parameters:
message - a BSDMessage created previously
Throws:
java.io.IOException

sendMessage

public void sendMessage(java.lang.String message)
                 throws java.io.IOException
send a message to the server specified in the constructor

Parameters:
message - a string BSDMessage created previously.
The message SHOULD be formated as :
Timestamp IPAddress Tag:Message
or Timestamp IPAddress Tag:Message
example :
<55>Oct 18 11:23:07 192.168.0.112 hsimpson:<AuditMessage>...<AuditMessage>
Throws:
java.io.IOException

main

public static void main(java.lang.String[] args)
                 throws java.io.IOException
Throws:
java.io.IOException

sendMessageFromFile

public void sendMessageFromFile(java.lang.String fromFile)
                         throws java.io.IOException
Send several message in a file
The file MUST contain one message by line

Parameters:
fromFile -
Throws:
java.io.IOException